Regen Configure.
[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 Fri Oct 29 00:58:35 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_mblen=''
415 d_mbstowcs=''
416 d_mbtowc=''
417 d_memchr=''
418 d_memcmp=''
419 d_memcpy=''
420 d_memmove=''
421 d_memset=''
422 d_mkdir=''
423 d_mkfifo=''
424 d_mktime=''
425 d_msg=''
426 d_msgctl=''
427 d_msgget=''
428 d_msgrcv=''
429 d_msgsnd=''
430 d_nice=''
431 d_open3=''
432 d_fpathconf=''
433 d_pathconf=''
434 d_pause=''
435 d_pipe=''
436 d_poll=''
437 d_portable=''
438 d_old_pthread_create_joinable=''
439 old_pthread_create_joinable=''
440 d_pthread_yield=''
441 d_sched_yield=''
442 sched_yield=''
443 d_readdir=''
444 d_rewinddir=''
445 d_seekdir=''
446 d_telldir=''
447 d_readlink=''
448 d_rename=''
449 d_rmdir=''
450 d_safebcpy=''
451 d_safemcpy=''
452 d_sanemcmp=''
453 d_select=''
454 d_sem=''
455 d_semctl=''
456 d_semget=''
457 d_semop=''
458 d_setegid=''
459 d_seteuid=''
460 d_setgrent=''
461 d_setgrps=''
462 d_sethent=''
463 d_setlinebuf=''
464 d_setlocale=''
465 d_setnent=''
466 d_setpent=''
467 d_setpgid=''
468 d_setpgrp2=''
469 d_bsdsetpgrp=''
470 d_setpgrp=''
471 d_setprior=''
472 d_setpwent=''
473 d_setregid=''
474 d_setresgid=''
475 d_setresuid=''
476 d_setreuid=''
477 d_setrgid=''
478 d_setruid=''
479 d_setsent=''
480 d_setsid=''
481 d_setspent=''
482 d_setvbuf=''
483 d_sfio=''
484 usesfio=''
485 d_shm=''
486 d_shmat=''
487 d_shmatprototype=''
488 shmattype=''
489 d_shmctl=''
490 d_shmdt=''
491 d_shmget=''
492 d_sigaction=''
493 d_sigsetjmp=''
494 d_msg_ctrunc=''
495 d_msg_dontroute=''
496 d_msg_oob=''
497 d_msg_peek=''
498 d_msg_proxy=''
499 d_oldsock=''
500 d_scm_rights=''
501 d_socket=''
502 d_sockpair=''
503 sockethdr=''
504 socketlib=''
505 d_sqrtl=''
506 d_statblks=''
507 d_statfs_f_flags=''
508 d_statfs_s=''
509 d_fstatvfs=''
510 d_statvfs=''
511 d_stdio_cnt_lval=''
512 d_stdio_ptr_lval=''
513 d_stdiobase=''
514 d_stdstdio=''
515 stdio_base=''
516 stdio_bufsiz=''
517 stdio_cnt=''
518 stdio_filbuf=''
519 stdio_ptr=''
520 d_index=''
521 d_strchr=''
522 d_strcoll=''
523 d_strctcpy=''
524 d_strerrm=''
525 d_strerror=''
526 d_sysernlst=''
527 d_syserrlst=''
528 d_strtod=''
529 d_strtol=''
530 d_strtoul=''
531 d_strxfrm=''
532 d_symlink=''
533 d_syscall=''
534 d_sysconf=''
535 d_system=''
536 d_tcgetpgrp=''
537 d_tcsetpgrp=''
538 d_telldirproto=''
539 d_time=''
540 timetype=''
541 clocktype=''
542 d_times=''
543 d_truncate=''
544 d_tzname=''
545 d_umask=''
546 d_semctl_semid_ds=''
547 d_semctl_semun=''
548 d_union_semun=''
549 d_ustat=''
550 d_vfork=''
551 usevfork=''
552 d_voidsig=''
553 signal_t=''
554 d_volatile=''
555 d_charvspr=''
556 d_vprintf=''
557 d_wait4=''
558 d_waitpid=''
559 d_wcstombs=''
560 d_wctomb=''
561 dlext=''
562 cccdlflags=''
563 ccdlflags=''
564 dlsrc=''
565 ld=''
566 lddlflags=''
567 usedl=''
568 doublesize=''
569 ebcdic=''
570 fflushNULL=''
571 fflushall=''
572 fpostype=''
573 gidsign=''
574 gidsize=''
575 gidtype=''
576 groupstype=''
577 h_fcntl=''
578 h_sysfile=''
579 i_arpainet=''
580 db_hashtype=''
581 db_prefixtype=''
582 i_db=''
583 i_dbm=''
584 i_rpcsvcdbm=''
585 d_dirnamlen=''
586 direntrytype=''
587 i_dirent=''
588 i_dld=''
589 i_dlfcn=''
590 i_fcntl=''
591 i_float=''
592 i_gdbm=''
593 d_grpasswd=''
594 i_grp=''
595 d_int64t=''
596 i_inttypes=''
597 i_limits=''
598 i_locale=''
599 i_machcthr=''
600 i_malloc=''
601 i_math=''
602 i_memory=''
603 i_mntent=''
604 i_ndbm=''
605 i_netdb=''
606 i_neterrno=''
607 i_netinettcp=''
608 i_niin=''
609 i_sysin=''
610 i_poll=''
611 i_pthread=''
612 d_pwage=''
613 d_pwchange=''
614 d_pwclass=''
615 d_pwcomment=''
616 d_pwexpire=''
617 d_pwgecos=''
618 d_pwpasswd=''
619 d_pwquota=''
620 i_pwd=''
621 i_sfio=''
622 i_shadow=''
623 i_socks=''
624 i_stddef=''
625 i_stdlib=''
626 i_string=''
627 strings=''
628 i_sysaccess=''
629 i_sysdir=''
630 i_sysfile=''
631 d_voidtty=''
632 i_bsdioctl=''
633 i_sysfilio=''
634 i_sysioctl=''
635 i_syssockio=''
636 i_sysmount=''
637 i_sysndir=''
638 i_sysparam=''
639 i_sysresrc=''
640 i_syssecrt=''
641 i_sysselct=''
642 i_sysstat=''
643 i_sysstatfs=''
644 i_sysstatvfs=''
645 i_systimes=''
646 i_systypes=''
647 d_iovec_s=''
648 i_sysuio=''
649 i_sysun=''
650 i_sysvfs=''
651 i_syswait=''
652 i_sgtty=''
653 i_termio=''
654 i_termios=''
655 i_systime=''
656 i_systimek=''
657 i_time=''
658 timeincl=''
659 i_unistd=''
660 i_ustat=''
661 i_utime=''
662 i_values=''
663 i_stdarg=''
664 i_varargs=''
665 i_varhdr=''
666 i_vfork=''
667 installprefix=''
668 installprefixexp=''
669 installstyle=''
670 installusrbinperl=''
671 intsize=''
672 longsize=''
673 shortsize=''
674 d_fpos64_t=''
675 d_llseek=''
676 d_off64_t=''
677 libc=''
678 ldlibpthname=''
679 libperl=''
680 shrpenv=''
681 useshrplib=''
682 glibpth=''
683 libpth=''
684 loclibpth=''
685 plibpth=''
686 xlibpth=''
687 ignore_versioned_solibs=''
688 libs=''
689 lns=''
690 d_PRIEldbl=''
691 d_PRIFldbl=''
692 d_PRIGldbl=''
693 d_PRIeldbl=''
694 d_PRIfldbl=''
695 d_PRIgldbl=''
696 sPRIEldbl=''
697 sPRIFldbl=''
698 sPRIGldbl=''
699 sPRIeldbl=''
700 sPRIfldbl=''
701 sPRIgldbl=''
702 lseeksize=''
703 lseektype=''
704 make_set_make=''
705 d_mymalloc=''
706 freetype=''
707 mallocobj=''
708 mallocsrc=''
709 malloctype=''
710 usemymalloc=''
711 installman1dir=''
712 man1dir=''
713 man1direxp=''
714 man1ext=''
715 installman3dir=''
716 man3dir=''
717 man3direxp=''
718 man3ext=''
719 huge=''
720 large=''
721 medium=''
722 models=''
723 small=''
724 split=''
725 modetype=''
726 multiarch=''
727 mydomain=''
728 myhostname=''
729 phostname=''
730 c=''
731 n=''
732 d_eofnblk=''
733 eagain=''
734 o_nonblock=''
735 rd_nodata=''
736 netdb_hlen_type=''
737 netdb_host_type=''
738 netdb_name_type=''
739 netdb_net_type=''
740 groupcat=''
741 hostcat=''
742 passcat=''
743 orderlib=''
744 ranlib=''
745 package=''
746 spackage=''
747 pager=''
748 apiversion=''
749 patchlevel=''
750 subversion=''
751 version=''
752 perladmin=''
753 perlpath=''
754 pidtype=''
755 prefix=''
756 prefixexp=''
757 installprivlib=''
758 privlib=''
759 privlibexp=''
760 prototype=''
761 ptrsize=''
762 d_PRIX64=''
763 d_PRId64=''
764 d_PRIi64=''
765 d_PRIo64=''
766 d_PRIu64=''
767 d_PRIx64=''
768 sPRIX64=''
769 sPRId64=''
770 sPRIi64=''
771 sPRIo64=''
772 sPRIu64=''
773 sPRIx64=''
774 drand01=''
775 randbits=''
776 randfunc=''
777 randseedtype=''
778 seedfunc=''
779 installscript=''
780 scriptdir=''
781 scriptdirexp=''
782 selectminbits=''
783 selecttype=''
784 sh=''
785 sig_count=''
786 sig_name=''
787 sig_name_init=''
788 sig_num=''
789 sig_num_init=''
790 installsitearch=''
791 sitearch=''
792 sitearchexp=''
793 installsitebin=''
794 sitebin=''
795 sitebinexp=''
796 installsitelib=''
797 sitelib=''
798 sitelibexp=''
799 siteprefix=''
800 siteprefixexp=''
801 sizetype=''
802 so=''
803 sharpbang=''
804 shsharp=''
805 spitshell=''
806 src=''
807 ssizetype=''
808 startperl=''
809 startsh=''
810 stdchar=''
811 d_stdio_stream_array=''
812 stdio_stream_array=''
813 d_strtoull=''
814 sysman=''
815 trnl=''
816 uidsign=''
817 uidsize=''
818 uidtype=''
819 archname64=''
820 use64bits=''
821 uselargefiles=''
822 uselongdouble=''
823 usemorebits=''
824 usemultiplicity=''
825 nm_opt=''
826 nm_so_opt=''
827 runnm=''
828 usenm=''
829 useperlio=''
830 usesocks=''
831 d_oldpthreads=''
832 usethreads=''
833 incpath=''
834 mips_type=''
835 usrinc=''
836 d_vendorbin=''
837 installvendorbin=''
838 vendorbin=''
839 vendorbinexp=''
840 d_vendorlib=''
841 installvendorlib=''
842 vendorlib=''
843 vendorlibexp=''
844 usevendorprefix=''
845 vendorprefix=''
846 vendorprefixexp=''
847 defvoidused=''
848 voidflags=''
849 pm_apiversion=''
850 xs_apiversion=''
851 CONFIG=''
852
853 define='define'
854 undef='undef'
855 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
856 rmlist=''
857
858 : We must find out about Eunice early
859 eunicefix=':'
860 if test -f /etc/unixtovms; then
861         eunicefix=/etc/unixtovms
862 fi
863 if test -f /etc/unixtovms.exe; then
864         eunicefix=/etc/unixtovms.exe
865 fi
866
867 i_whoami=''
868 : Possible local include directories to search.
869 : Set locincpth to "" in a hint file to defeat local include searches.
870 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
871 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
872 :
873 : no include file wanted by default
874 inclwanted=''
875
876 : list of known cpp symbols, sorted alphabetically
877 al="AMIX BIT_MSF BSD BSD4_3 BSD_NET2 CMU CRAY DGUX DOLPHIN DPX2"
878 al="$al GO32 GOULD_PN HP700 I386 I80960 I960 Lynx M68000 M68K MACH"
879 al="$al MIPSEB MIPSEL MSDOS MTXINU MULTIMAX MVS"
880 al="$al M_COFF M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM"
881 al="$al M_SYS3 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX"
882 al="$al NeXT OCS88 OSF1 PARISC PC532 PORTAR POSIX"
883 al="$al PWB R3000 RES RISC6000 RT Sun386i SVR3 SVR4 SVR5"
884 al="$al SYSTYPE_BSD SYSTYPE_SVR4 SYSTYPE_SYSV Tek4132 Tek4300"
885 al="$al UMAXV USGr4 USGr4_2 UTEK UTS UTek UnicomPBB UnicomPBD Utek"
886 al="$al VMS Xenix286"
887 al="$al _AIX _AIX32 _AIX370 _AIX41 _AM29000 _COFF _CRAY _CX_UX _EPI"
888 al="$al _IBMESA _IBMR2 _M88K _M88KBCS_TARGET _POWER"
889 al="$al _MIPSEB _MIPSEL _M_COFF _M_I86 _M_I86SM _M_SYS3"
890 al="$al _M_SYS5 _M_SYSIII _M_SYSV _M_UNIX _M_XENIX _NLS _PGC_ _R3000"
891 al="$al _SYSTYPE_BSD _SYSTYPE_BSD43 _SYSTYPE_SVR4"
892 al="$al _SYSTYPE_SYSV _SYSV3 _U370 _UNICOS"
893 al="$al __386BSD__ __BIG_ENDIAN __BIG_ENDIAN__ __BSD_4_4__"
894 al="$al __DGUX__ __DPX2__ __H3050R __H3050RX"
895 al="$al __LITTLE_ENDIAN __LITTLE_ENDIAN__ __MACH__"
896 al="$al __MIPSEB __MIPSEB__ __MIPSEL __MIPSEL__"
897 al="$al __Next__ __OSF1__ __PARAGON__ __PGC__ __PWB __STDC__"
898 al="$al __SVR4_2__ __UMAXV__"
899 al="$al ____386BSD____ __alpha __alpha__ __amiga"
900 al="$al __bsd4_2 __bsd4_2__ __bsdi__ __convex__"
901 al="$al __host_mips__"
902 al="$al __hp9000s200 __hp9000s300 __hp9000s400 __hp9000s500"
903 al="$al __hp9000s500 __hp9000s700 __hp9000s800"
904 al="$al __hppa __hpux __hp_osf __i286 __i286__ __i386 __i386__"
905 al="$al __i486 __i486__ __i860 __i860__ __ibmesa __ksr1__ __linux__"
906 al="$al __m68k __m68k__ __m88100__ __m88k __m88k__"
907 al="$al __mc68000 __mc68000__ __mc68020 __mc68020__"
908 al="$al __mc68030 __mc68030__ __mc68040 __mc68040__"
909 al="$al __mc88100 __mc88100__ __mips __mips__"
910 al="$al __motorola__ __osf__ __pa_risc __sparc__ __stdc__"
911 al="$al __sun __sun__ __svr3__ __svr4__ __ultrix __ultrix__"
912 al="$al __unix __unix__ __uxpm__ __uxps__ __vax __vax__"
913 al="$al _host_mips _mips _unix"
914 al="$al a29k aegis aix aixpc alliant alpha am29000 amiga ansi ardent"
915 al="$al apollo ardent att386 att3b"
916 al="$al bsd bsd43 bsd4_2 bsd4_3 bsd4_4 bsdi bull"
917 al="$al cadmus clipper concurrent convex cray ctix"
918 al="$al dmert encore gcos gcx gimpel gould"
919 al="$al hbullx20 hcx host_mips hp200 hp300 hp700 hp800"
920 al="$al hp9000 hp9000s300 hp9000s400 hp9000s500"
921 al="$al hp9000s700 hp9000s800 hp9k8 hppa hpux"
922 al="$al i186 i286 i386 i486 i8086"
923 al="$al i80960 i860 iAPX286 ibm ibm032 ibmrt interdata is68k"
924 al="$al ksr1 linux luna luna88k m68k m88100 m88k"
925 al="$al mc300 mc500 mc68000 mc68010 mc68020 mc68030"
926 al="$al mc68040 mc68060 mc68k mc68k32 mc700"
927 al="$al mc88000 mc88100 merlin mert mips mvs n16"
928 al="$al ncl_el ncl_mr"
929 al="$al news1500 news1700 news1800 news1900 news3700"
930 al="$al news700 news800 news900 ns16000 ns32000"
931 al="$al ns32016 ns32332 ns32k nsc32000 os osf"
932 al="$al parisc pc532 pdp11 plexus posix pyr"
933 al="$al riscix riscos scs sequent sgi sinix sony sony_news"
934 al="$al sonyrisc sparc sparclite spectrum stardent stratos"
935 al="$al sun sun3 sun386 svr4 sysV68 sysV88"
936 al="$al titan tower tower32 tower32_200 tower32_600 tower32_700"
937 al="$al tower32_800 tower32_850 tss u370 u3b u3b2 u3b20 u3b200"
938 al="$al u3b20d u3b5 ultrix unix unixpc unos vax venix vms"
939 al="$al xenix z8000"
940
941 : Trailing extension.  Override this in a hint file, if needed.
942 _exe=''
943 : Extra object files, if any, needed on this platform.
944 archobjs=''
945 groupstype=''
946 : change the next line if compiling for Xenix/286 on Xenix/386
947 xlibpth='/usr/lib/386 /lib/386'
948
949 : Possible local library directories to search.
950 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
951 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
952
953 : general looking path for locating libraries
954 glibpth="/shlib /usr/shlib /lib/pa1.1 /usr/lib/large"
955 glibpth="$glibpth /lib /usr/lib $xlibpth"
956 glibpth="$glibpth /lib/large /usr/lib/small /lib/small"
957 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
958
959 : Private path used by Configure to find libraries.  Its value
960 : is prepended to libpth. This variable takes care of special
961 : machines, like the mips.  Usually, it should be empty.
962 plibpth=''
963
964 : default library list
965 libswanted=''
966 : some systems want to use only the non-versioned libso:s
967 ignore_versioned_solibs=''
968 : full support for void wanted by default
969 defvoidused=15
970
971 : set useposix=false in your hint file to disable the POSIX extension.
972 useposix=true
973 : set useopcode=false in your hint file to disable the Opcode extension.
974 useopcode=true
975 : set usemultiplicity on the Configure command line to enable multiplicity.
976 : set usesocks on the Configure command line to enable socks.
977 : set usethreads on the Configure command line to enable threads.
978 : List of libraries we want.
979 : If anyone needs -lnet, put it in a hint file.
980 libswanted='sfio socket inet nsl nm ndbm gdbm dbm db malloc dl'
981 libswanted="$libswanted dld ld sun m c cposix posix"
982 libswanted="$libswanted ndir dir crypt sec"
983 libswanted="$libswanted ucb bsd BSD PW x"
984 : We probably want to search /usr/shlib before most other libraries.
985 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
986 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
987 glibpth="/usr/shlib $glibpth"
988 : Do not use vfork unless overridden by a hint file.
989 usevfork=false
990
991 : Find the basic shell for Bourne shell scripts
992 case "$sh" in
993 '')
994         case "$SYSTYPE" in
995         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
996         *) xxx='/bin/sh';;
997         esac
998         if test -f "$xxx"; then
999                 sh="$xxx"
1000         else
1001                 : Build up a list and do a single loop so we can 'break' out.
1002                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1003                 for xxx in sh bash ksh pdksh ash; do
1004                         for p in $pth; do
1005                                 try="$try ${p}/${xxx}"
1006                         done
1007                 done
1008                 for xxx in $try; do
1009                         if test -f "$xxx"; then
1010                                 sh="$xxx";
1011                                 break
1012                         elif test -f "$xxx.exe"; then
1013                                 sh="$xxx";
1014                                 break
1015                         fi
1016                 done
1017         fi
1018         ;;
1019 esac
1020
1021 case "$sh" in
1022 '')     cat <<EOM >&2
1023 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
1024
1025 Usually it's in /bin/sh.  How did you even get this far?
1026 Please contact me (Perl Maintainers) at perlbug@perl.com and 
1027 we'll try to straighten this all out.
1028 EOM
1029         exit 1
1030         ;;
1031 esac
1032
1033 : see if sh knows # comments
1034 if `$sh -c '#' >/dev/null 2>&1`; then
1035         shsharp=true
1036         spitshell=cat
1037         xcat=/bin/cat
1038         test -f $xcat || xcat=/usr/bin/cat
1039         echo "#!$xcat" >try
1040         $eunicefix try
1041         chmod +x try
1042         ./try > today
1043         if test -s today; then
1044                 sharpbang='#!'
1045         else
1046                 echo "#! $xcat" > try
1047                 $eunicefix try
1048                 chmod +x try
1049                 ./try > today
1050                 if test -s today; then
1051                         sharpbang='#! '
1052                 else
1053                         sharpbang=': use '
1054                 fi
1055         fi
1056 else
1057         echo " "
1058         echo "Your $sh doesn't grok # comments--I will strip them later on."
1059         shsharp=false
1060         cd ..
1061         echo "exec grep -v '^[  ]*#'" >spitshell
1062         chmod +x spitshell
1063         $eunicefix spitshell
1064         spitshell=`pwd`/spitshell
1065         cd UU
1066         echo "I presume that if # doesn't work, #! won't work either!"
1067         sharpbang=': use '
1068 fi
1069 rm -f try today
1070
1071 : figure out how to guarantee sh startup
1072 case "$startsh" in
1073 '') startsh=${sharpbang}${sh} ;;
1074 *)
1075 esac
1076 cat >try <<EOSS
1077 $startsh
1078 set abc
1079 test "$?abc" != 1
1080 EOSS
1081
1082 chmod +x try
1083 $eunicefix try
1084 if ./try; then
1085         : echo "Yup, it does."
1086 else
1087         echo "Hmm... '$startsh' does not guarantee sh startup..."
1088         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1089 fi
1090 rm -f try
1091
1092
1093 : Save command line options in file UU/cmdline.opt for later use in
1094 : generating config.sh.
1095 cat > cmdline.opt <<EOSH
1096 # Configure command line arguments.
1097 config_arg0='$0'
1098 config_args='$*'
1099 config_argc=$#
1100 EOSH
1101 argn=1
1102 for arg in "$@"; do
1103         cat >>cmdline.opt <<EOSH
1104 config_arg$argn='$arg'
1105 EOSH
1106         argn=`expr $argn + 1`
1107 done
1108
1109 : produce awk script to parse command line options
1110 cat >options.awk <<'EOF'
1111 BEGIN {
1112         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1113
1114         len = length(optstr);
1115         for (i = 1; i <= len; i++) {
1116                 c = substr(optstr, i, 1);
1117                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1118                 if (a == ":") {
1119                         arg[c] = 1;
1120                         i++;
1121                 }
1122                 opt[c] = 1;
1123         }
1124 }
1125 {
1126         expect = 0;
1127         str = $0;
1128         if (substr(str, 1, 1) != "-") {
1129                 printf("'%s'\n", str);
1130                 next;
1131         }
1132         len = length($0);
1133         for (i = 2; i <= len; i++) {
1134                 c = substr(str, i, 1);
1135                 if (!opt[c]) {
1136                         printf("-%s\n", substr(str, i));
1137                         next;
1138                 }
1139                 printf("-%s\n", c);
1140                 if (arg[c]) {
1141                         if (i < len)
1142                                 printf("'%s'\n", substr(str, i + 1));
1143                         else
1144                                 expect = 1;
1145                         next;
1146                 }
1147         }
1148 }
1149 END {
1150         if (expect)
1151                 print "?";
1152 }
1153 EOF
1154
1155 : process the command line options
1156 set X `for arg in "$@"; do echo "X$arg"; done |
1157         sed -e s/X// | awk -f options.awk`
1158 eval "set $*"
1159 shift
1160 rm -f options.awk
1161
1162 : set up default values
1163 fastread=''
1164 reuseval=false
1165 config_sh=''
1166 alldone=''
1167 error=''
1168 silent=''
1169 extractsh=''
1170 override=''
1171 knowitall=''
1172 rm -f optdef.sh posthint.sh
1173 cat >optdef.sh <<EOS
1174 $startsh
1175 EOS
1176
1177
1178 : option parsing
1179 while test $# -gt 0; do
1180         case "$1" in
1181         -d) shift; fastread=yes;;
1182         -e) shift; alldone=cont;;
1183         -f)
1184                 shift
1185                 cd ..
1186                 if test -r "$1"; then
1187                         config_sh="$1"
1188                 else
1189                         echo "$me: cannot read config file $1." >&2
1190                         error=true
1191                 fi
1192                 cd UU
1193                 shift;;
1194         -h) shift; error=true;;
1195         -r) shift; reuseval=true;;
1196         -s) shift; silent=true; realsilent=true;;
1197         -E) shift; alldone=exit;;
1198         -K) shift; knowitall=true;;
1199         -O) shift; override=true;;
1200         -S) shift; silent=true; extractsh=true;;
1201         -D)
1202                 shift
1203                 case "$1" in
1204                 *=)
1205                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1206                         echo "$me: ignoring -D $1" >&2
1207                         ;;
1208                 *=*) echo "$1" | \
1209                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1210                 *) echo "$1='define'" >> optdef.sh;;
1211                 esac
1212                 shift
1213                 ;;
1214         -U)
1215                 shift
1216                 case "$1" in
1217                 *=) echo "$1" >> optdef.sh;;
1218                 *=*)
1219                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1220                         echo "$me: ignoring -U $1" >&2
1221                         ;;
1222                 *) echo "$1='undef'" >> optdef.sh;;
1223                 esac
1224                 shift
1225                 ;;
1226         -A)
1227             shift
1228             xxx=''
1229             yyy="$1"
1230             zzz=''
1231             uuu=undef
1232             case "$yyy" in
1233             *=*) zzz=`echo $yyy|sed 's!=.*!!'`
1234                  case "$zzz" in
1235                  *:*) zzz='' ;;
1236                  *)   xxx=append
1237                       zzz=" "`echo $yyy|sed 's!^[^=]*=!!'` 
1238                       yyy=`echo $yyy|sed 's!=.*!!'` ;;
1239                  esac
1240                  ;;
1241             esac
1242             case "$xxx" in
1243             '')  case "$yyy" in
1244                  *:*) xxx=`echo $yyy|sed 's!:.*!!'`
1245                       yyy=`echo $yyy|sed 's!^[^:]*:!!'`
1246                       zzz=`echo $yyy|sed 's!^[^=]*=!!'`
1247                       yyy=`echo $yyy|sed 's!=.*!!'` ;;
1248                  *)   xxx=`echo $yyy|sed 's!:.*!!'`
1249                       yyy=`echo $yyy|sed 's!^[^:]*:!!'` ;;
1250                  esac
1251                  ;;       
1252             esac
1253             case "$xxx" in
1254             append)
1255                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1256             clear)
1257                 echo "$yyy=''"                  >> posthint.sh ;;
1258             define)
1259                 case "$zzz" in
1260                 '') zzz=define ;;
1261                 esac
1262                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1263             eval)
1264                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1265             prepend)
1266                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1267             undef)
1268                 case "$zzz" in
1269                 '') zzz="$uuu" ;;
1270                 esac
1271                 echo "$yyy=$zzz"                >> posthint.sh ;;
1272             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1273             esac
1274             ;;
1275         -V) echo "$me generated by metaconfig 3.0 PL70." >&2
1276             exit 0;;
1277         --) break;;
1278         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1279         *) break;;
1280         esac
1281 done
1282
1283 case "$error" in
1284 true)
1285         cat >&2 <<EOM
1286 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1287                  [-U symbol] [-U symbol=] [-A command:symbol...]
1288   -d : use defaults for all answers.
1289   -e : go on without questioning past the production of config.sh.
1290   -f : specify an alternate default configuration file.
1291   -h : print this help message and exit (with an error status).
1292   -r : reuse C symbols value if possible (skips costly nm extraction).
1293   -s : silent mode, only echoes questions and essential information.
1294   -D : define symbol to have some value:
1295          -D symbol         symbol gets the value 'define'
1296          -D symbol=value   symbol gets the value 'value'
1297   -E : stop at the end of questions, after having produced config.sh.
1298   -K : do not use unless you know what you are doing.
1299   -O : let -D and -U override definitions from loaded configuration file.
1300   -S : perform variable substitutions on all .SH files (can mix with -f)
1301   -U : undefine symbol:
1302          -U symbol    symbol gets the value 'undef'
1303          -U symbol=   symbol gets completely empty
1304   -A : manipulate symbol after the platform specific hints have been applied:
1305          -A symbol=value                append " "value to symbol
1306          -A append:symbol=value         append value to symbol
1307          -A define:symbol=value         define symbol to have value
1308          -A clear:symbol                define symbol to be ''
1309          -A define:symbol               define symbol to be 'define'
1310          -A eval:symbol=value           define symbol to be eval of value
1311          -A prepend:symbol=value        prepend value to symbol
1312          -A undef:symbol                define symbol to be 'undef'
1313          -A undef:symbol=               define symbol to be ''
1314   -V : print version number and exit (with a zero status).
1315 EOM
1316         exit 1
1317         ;;
1318 esac
1319
1320 : Sanity checks
1321 case "$fastread$alldone" in
1322 yescont|yesexit) ;;
1323 *)
1324         if test ! -t 0; then
1325                 echo "Say 'sh Configure', not 'sh <Configure'"
1326                 exit 1
1327         fi
1328         ;;
1329 esac
1330
1331 exec 4>&1
1332 case "$silent" in
1333 true) exec 1>/dev/null;;
1334 esac
1335
1336 : run the defines and the undefines, if any, but leave the file out there...
1337 touch optdef.sh
1338 . ./optdef.sh
1339 : create the posthint manipulation script and leave the file out there...
1340 touch posthint.sh
1341
1342 : set package name
1343 package=perl5
1344 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1345 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1346 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1347 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1348 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1349 esac
1350
1351 : Some greps do not return status, grrr.
1352 echo "grimblepritz" >grimble
1353 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1354         contains=contains
1355 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1356         contains=grep
1357 else
1358         contains=contains
1359 fi
1360 rm -f grimble
1361 : the following should work in any shell
1362 case "$contains" in
1363 contains*)
1364         echo " "
1365         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1366         cat >contains <<'EOSS'
1367 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1368 EOSS
1369 chmod +x contains
1370 esac
1371
1372 : Find the path to the source tree
1373 case "$src" in
1374 '') case "$0" in
1375     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1376          case "$src" in
1377          /*)    ;;
1378          *)     src=`cd ../$src && pwd` ;;
1379          esac
1380          ;;
1381     *)   src='.';;
1382     esac;;
1383 esac
1384 case "$src" in
1385 '')     src=/
1386         rsrc=/
1387         ;;
1388 /*) rsrc="$src";;
1389 *) rsrc="../$src";;
1390 esac
1391 if test -f $rsrc/Configure && \
1392         $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1393 then
1394    : found it, so we are ok.
1395 else
1396         rsrc=''
1397         for src in . .. ../.. ../../.. ../../../..; do
1398                 if test -f ../$src/Configure && \
1399                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1400                 then
1401                         rsrc=../$src
1402                         break
1403                 fi
1404         done
1405 fi
1406 case "$rsrc" in
1407 '')
1408         cat <<EOM >&4
1409
1410 Sorry, I can't seem to locate the source dir for $package.  Please start
1411 Configure with an explicit path -- i.e. /some/path/Configure.
1412
1413 EOM
1414         exit 1
1415         ;;
1416 ../.)   rsrc='..';;
1417 *)
1418         echo " "
1419         echo "Sources for $package found in \"$src\"." >&4
1420         ;;
1421 esac
1422
1423 : script used to extract .SH files with variable substitutions
1424 cat >extract <<'EOS'
1425 CONFIGDOTSH=true
1426 echo "Doing variable substitutions on .SH files..."
1427 if test -f $src/MANIFEST; then
1428         set x `awk '{print $1}' <$src/MANIFEST | grep '\.SH$'`
1429 else
1430         echo "(Looking for .SH files under the source directory.)"
1431         set x `(cd $src; find . -name "*.SH" -print)`
1432 fi
1433 shift
1434 case $# in
1435 0) set x `(cd $src; echo *.SH)`; shift;;
1436 esac
1437 if test ! -f $src/$1; then
1438         shift
1439 fi
1440 mkdir_p='
1441 name=$1;
1442 create="";
1443 while test $name; do
1444         if test ! -d "$name"; then
1445                 create="$name $create";
1446                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1447                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1448         else
1449                 name="";
1450         fi;
1451 done;
1452 for file in $create; do
1453         mkdir $file;
1454 done
1455 '
1456 for file in $*; do
1457         case "$src" in
1458         ".")
1459                 case "$file" in
1460                 */*)
1461                         dir=`expr X$file : 'X\(.*\)/'`
1462                         file=`expr X$file : 'X.*/\(.*\)'`
1463                         (cd $dir && . ./$file)
1464                         ;;
1465                 *)
1466                         . ./$file
1467                         ;;
1468                 esac
1469                 ;;
1470         *)
1471                 case "$file" in
1472                 */*)
1473                         dir=`expr X$file : 'X\(.*\)/'`
1474                         file=`expr X$file : 'X.*/\(.*\)'`
1475                         (set x $dir; shift; eval $mkdir_p)
1476                         sh <$src/$dir/$file
1477                         ;;
1478                 *)
1479                         sh <$src/$file
1480                         ;;
1481                 esac
1482                 ;;
1483         esac
1484 done
1485 if test -f $src/config_h.SH; then
1486         if test ! -f config.h; then
1487         : oops, they left it out of MANIFEST, probably, so do it anyway.
1488         . $src/config_h.SH
1489         fi
1490 fi
1491 EOS
1492
1493 : extract files and exit if asked to do so
1494 case "$extractsh" in
1495 true)
1496         case "$realsilent" in
1497         true) ;;
1498         *) exec 1>&4;;
1499         esac
1500         case "$config_sh" in
1501         '') config_sh='config.sh';;
1502         esac
1503         echo " "
1504         echo "Fetching answers from $config_sh..."
1505         cd ..
1506         . $config_sh
1507         test "$override" && . ./optdef.sh
1508         echo " "
1509         . UU/extract
1510         rm -rf UU
1511         echo "Done."
1512         exit 0
1513         ;;
1514 esac
1515
1516 : Eunice requires " " instead of "", can you believe it
1517 echo " "
1518 : Here we go...
1519 echo "Beginning of configuration questions for $package."
1520
1521 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1522
1523 : first determine how to suppress newline on echo command
1524 echo " "
1525 echo "Checking echo to see how to suppress newlines..."
1526 (echo "hi there\c" ; echo " ") >.echotmp
1527 if $contains c .echotmp >/dev/null 2>&1 ; then
1528         echo "...using -n."
1529         n='-n'
1530         c=''
1531 else
1532         cat <<'EOM'
1533 ...using \c
1534 EOM
1535         n=''
1536         c='\c'
1537 fi
1538 echo $n "The star should be here-->$c"
1539 echo '*'
1540 rm -f .echotmp
1541
1542 : Now test for existence of everything in MANIFEST
1543 echo " "
1544 if test -f $rsrc/MANIFEST; then
1545         echo "First let's make sure your kit is complete.  Checking..." >&4
1546         awk '$1 !~ /PACK[A-Z]+/ {print $1}' $rsrc/MANIFEST | split -50
1547         rm -f missing
1548         tmppwd=`pwd`
1549         for filelist in x??; do
1550                 (cd $rsrc; ls `cat $tmppwd/$filelist` >/dev/null 2>>$tmppwd/missing)
1551         done
1552         if test -s missing; then
1553                 cat missing >&4
1554                 cat >&4 <<'EOM'
1555
1556 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1557
1558 You have the option of continuing the configuration process, despite the
1559 distinct possibility that your kit is damaged, by typing 'y'es.  If you
1560 do, don't blame me if something goes wrong.  I advise you to type 'n'o
1561 and contact the author (perlbug@perl.com).
1562
1563 EOM
1564                 echo $n "Continue? [n] $c" >&4
1565                 read ans
1566                 case "$ans" in
1567                 y*)
1568                         echo "Continuing..." >&4
1569                         rm -f missing
1570                         ;;
1571                 *)
1572                         echo "ABORTING..." >&4
1573                         kill $$
1574                         ;;
1575                 esac
1576         else
1577                 echo "Looks good..."
1578         fi
1579 else
1580         echo "There is no MANIFEST file.  I hope your kit is complete !"
1581 fi
1582 rm -f missing x??
1583
1584 echo " "
1585 : Find the appropriate value for a newline for tr
1586 if test -n "$DJGPP"; then
1587        trnl='\012'
1588 fi
1589 if test X"$trnl" = X; then
1590         case "`echo foo|tr '\n' x 2>/dev/null`" in
1591         foox) trnl='\n' ;;
1592         esac
1593 fi
1594 if test X"$trnl" = X; then
1595         case "`echo foo|tr '\012' x 2>/dev/null`" in
1596         foox) trnl='\012' ;;
1597         esac
1598 fi
1599 if test X"$trnl" = X; then
1600         cat <<EOM >&2
1601
1602 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
1603
1604 EOM
1605         exit 1
1606 fi
1607
1608 : compute the number of columns on the terminal for proper question formatting
1609 case "$COLUMNS" in
1610 '') COLUMNS='80';;
1611 esac
1612
1613 : set up the echo used in my read
1614 myecho="case \"\$xxxm\" in
1615 '') echo $n \"\$rp $c\" >&4;;
1616 *) case \"\$rp\" in
1617         '') echo $n \"[\$xxxm] $c\";;
1618         *)
1619                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
1620                         echo \"\$rp\" >&4
1621                         echo $n \"[\$xxxm] $c\" >&4
1622                 else
1623                         echo $n \"\$rp [\$xxxm] $c\" >&4
1624                 fi
1625                 ;;
1626         esac;;
1627 esac"
1628
1629 : now set up to do reads with possible shell escape and default assignment
1630 cat <<EOSC >myread
1631 $startsh
1632 xxxm=\$dflt
1633 $myecho
1634 ans='!'
1635 case "\$fastread" in
1636 yes) case "\$dflt" in
1637         '') ;;
1638         *) ans='';
1639                 case "\$silent-\$rp" in
1640                 true-) ;;
1641                 *) echo " " >&4;;
1642                 esac;;
1643         esac;;
1644 *) case "\$silent" in
1645         true) case "\$rp" in
1646                 '') ans='';;
1647                 esac;;
1648         esac;;
1649 esac
1650 while expr "X\$ans" : "X!" >/dev/null; do
1651         read answ
1652         set x \$xxxm
1653         shift
1654         aok=''; eval "ans=\\"\$answ\\"" && aok=y
1655         case  "\$answ" in
1656         "!")
1657                 sh 1>&4
1658                 echo " "
1659                 $myecho
1660                 ;;
1661         !*)
1662                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
1663                 shift
1664                 sh 1>&4 -c "\$*"
1665                 echo " "
1666                 $myecho
1667                 ;;
1668         "\$ans")
1669                 case "\$ans" in
1670                 \\&*)
1671                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
1672                         shift
1673                         case "\$1" in
1674                         -d)
1675                                 fastread=yes
1676                                 echo "(OK, I'll run with -d after this question.)" >&4
1677                                 ;;
1678                         -*)
1679                                 echo "*** Sorry, \$1 not supported yet." >&4
1680                                 ;;
1681                         esac
1682                         $myecho
1683                         ans=!
1684                         ;;
1685                 esac;;
1686         *)
1687                 case "\$aok" in
1688                 y)
1689                         echo "*** Substitution done -- please confirm."
1690                         xxxm="\$ans"
1691                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
1692                         xxxm="\$ans"
1693                         ans=!
1694                         ;;
1695                 *)
1696                         echo "*** Error -- try again."
1697                         ans=!
1698                         ;;
1699                 esac
1700                 $myecho
1701                 ;;
1702         esac
1703         case "\$ans\$xxxm\$nostick" in
1704         '')
1705                 ans=!
1706                 $myecho
1707                 ;;
1708         esac
1709 done
1710 case "\$ans" in
1711 '') ans="\$xxxm";;
1712 esac
1713 EOSC
1714
1715 : create .config dir to save info across Configure sessions
1716 test -d ../.config || mkdir ../.config
1717 cat >../.config/README <<EOF
1718 This directory created by Configure to save information that should
1719 persist across sessions for $package.
1720
1721 You may safely delete it if you wish.
1722 EOF
1723
1724 : general instructions
1725 needman=true
1726 firsttime=true
1727 user=`(logname) 2>/dev/null`
1728 case "$user" in
1729 '') user=`whoami 2>&1`;;
1730 esac
1731 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
1732         firsttime=false
1733         echo " "
1734         rp='Would you like to see the instructions?'
1735         dflt=n
1736         . ./myread
1737         case "$ans" in
1738         [yY]*) ;;
1739         *) needman=false;;
1740         esac
1741 fi
1742 if $needman; then
1743         cat <<EOH
1744
1745 This installation shell script will examine your system and ask you questions
1746 to determine how the perl5 package should be installed. If you get
1747 stuck on a question, you may use a ! shell escape to start a subshell or
1748 execute a command.  Many of the questions will have default answers in square
1749 brackets; typing carriage return will give you the default.
1750
1751 On some of the questions which ask for file or directory names you are allowed
1752 to use the ~name construct to specify the login directory belonging to "name",
1753 even if you don't have a shell which knows about that.  Questions where this is
1754 allowed will be marked "(~name ok)".
1755
1756 EOH
1757         rp=''
1758         dflt='Type carriage return to continue'
1759         . ./myread
1760         cat <<'EOH'
1761
1762 The prompter used in this script allows you to use shell variables and
1763 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
1764 in the default answer, as if the default line was a set of arguments given to a
1765 script shell.  This means you may also use $* to repeat the whole default line,
1766 so you do not have to re-type everything to add something to the default.
1767
1768 Everytime there is a substitution, you will have to confirm.  If there is an
1769 error (e.g. an unmatched backtick), the default answer will remain unchanged
1770 and you will be prompted again.
1771
1772 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
1773 the questions and use the computed defaults (or the previous answers if there
1774 was already a config.sh file). Type 'Configure -h' for a list of options.
1775 You may also start interactively and then answer '& -d' at any prompt to turn
1776 on the non-interactive behaviour for the remainder of the execution.
1777
1778 EOH
1779         . ./myread
1780         cat <<EOH
1781
1782 Much effort has been expended to ensure that this shell script will run on any
1783 Unix system.  If despite that it blows up on yours, your best bet is to edit
1784 Configure and run it again.  If you can't run Configure for some reason,
1785 you'll have to generate a config.sh file by hand.  Whatever problems you
1786 have, let me (perlbug@perl.com) know how I blew it.
1787
1788 This installation script affects things in two ways:
1789
1790 1) it may do direct variable substitutions on some of the files included
1791    in this kit.
1792 2) it builds a config.h file for inclusion in C programs.  You may edit
1793    any of these files as the need arises after running this script.
1794
1795 If you make a mistake on a question, there is no easy way to back up to it
1796 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
1797 files.  Configure will offer to let you do this before it runs the SH files.
1798
1799 EOH
1800         dflt='Type carriage return to continue'
1801         . ./myread
1802         case "$firsttime" in
1803         true) echo $user >>../.config/instruct;;
1804         esac
1805 fi
1806
1807 : find out where common programs are
1808 echo " "
1809 echo "Locating common programs..." >&4
1810 cat <<EOSC >loc
1811 $startsh
1812 case \$# in
1813 0) exit 1;;
1814 esac
1815 thing=\$1
1816 shift
1817 dflt=\$1
1818 shift
1819 for dir in \$*; do
1820         case "\$thing" in
1821         .)
1822         if test -d \$dir/\$thing; then
1823                 echo \$dir
1824                 exit 0
1825         fi
1826         ;;
1827         *)
1828         for thisthing in \$dir/\$thing; do
1829                 : just loop through to pick last item
1830         done
1831         if test -f \$thisthing; then
1832                 echo \$thisthing
1833                 exit 0
1834         elif test -f \$dir/\$thing.exe; then
1835                 if test -n "$DJGPP"; then
1836                         echo \$dir/\$thing.exe
1837                 else
1838                         : on Eunice apparently
1839                         echo \$dir/\$thing
1840                 fi
1841                 exit 0
1842         fi
1843         ;;
1844         esac
1845 done
1846 echo \$dflt
1847 exit 1
1848 EOSC
1849 chmod +x loc
1850 $eunicefix loc
1851 loclist="
1852 awk
1853 cat
1854 comm
1855 cp
1856 echo
1857 expr
1858 grep
1859 ls
1860 make
1861 mkdir
1862 rm
1863 sed
1864 sort
1865 touch
1866 tr
1867 uniq
1868 "
1869 trylist="
1870 Mcc
1871 ar
1872 byacc
1873 cpp
1874 csh
1875 date
1876 egrep
1877 gzip
1878 less
1879 ln
1880 more
1881 nm
1882 nroff
1883 pg
1884 test
1885 uname
1886 zip
1887 "
1888 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1889 pth="$pth /lib /usr/lib"
1890 for file in $loclist; do
1891         eval xxx=\$$file
1892         case "$xxx" in
1893         /*|?:[\\/]*)
1894                 if test -f "$xxx"; then
1895                         : ok
1896                 else
1897                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
1898                         xxx=`./loc $file $file $pth`
1899                 fi
1900                 ;;
1901         '') xxx=`./loc $file $file $pth`;;
1902         *) xxx=`./loc $xxx $xxx $pth`;;
1903         esac
1904         eval $file=$xxx
1905         eval _$file=$xxx
1906         case "$xxx" in
1907         /*)
1908                 echo $file is in $xxx.
1909                 ;;
1910         ?:[\\/]*)
1911                 echo $file is in $xxx.
1912                 ;;
1913         *)
1914                 echo "I don't know where '$file' is, and my life depends on it." >&4
1915                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
1916                 exit 1
1917                 ;;
1918         esac
1919 done
1920 echo " "
1921 echo "Don't worry if any of the following aren't found..."
1922 say=offhand
1923 for file in $trylist; do
1924         eval xxx=\$$file
1925         case "$xxx" in
1926         /*|?:[\\/]*)
1927                 if test -f "$xxx"; then
1928                         : ok
1929                 else
1930                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
1931                         xxx=`./loc $file $file $pth`
1932                 fi
1933                 ;;
1934         '') xxx=`./loc $file $file $pth`;;
1935         *) xxx=`./loc $xxx $xxx $pth`;;
1936         esac
1937         eval $file=$xxx
1938         eval _$file=$xxx
1939         case "$xxx" in
1940         /*)
1941                 echo $file is in $xxx.
1942                 ;;
1943         ?:[\\/]*)
1944                 echo $file is in $xxx.
1945                 ;;
1946         *)
1947                 echo "I don't see $file out there, $say."
1948                 say=either
1949                 ;;
1950         esac
1951 done
1952 case "$egrep" in
1953 egrep)
1954         echo "Substituting grep for egrep."
1955         egrep=$grep
1956         ;;
1957 esac
1958 case "$ln" in
1959 ln)
1960         echo "Substituting cp for ln."
1961         ln=$cp
1962         ;;
1963 esac
1964 case "$test" in
1965 test)
1966         echo "Hopefully test is built into your sh."
1967         ;;
1968 *)
1969         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
1970                 echo "Using the test built into your sh."
1971                 test=test
1972                 _test=test
1973         fi
1974         ;;
1975 esac
1976 case "$echo" in
1977 echo)
1978         echo "Hopefully echo is built into your sh."
1979         ;;
1980 '') ;;
1981 *)
1982         echo " "
1983 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
1984         $echo $n "hi there$c" >foo1
1985         echo $n "hi there$c" >foo2
1986         if cmp foo1 foo2 >/dev/null 2>&1; then
1987                 echo "They are compatible.  In fact, they may be identical."
1988         else
1989                 case "$n" in
1990                 '-n') n='' c='\c';;
1991                 *) n='-n' c='';;
1992                 esac
1993                 cat <<FOO
1994 They are not compatible!  You are probably running ksh on a non-USG system.
1995 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
1996 have echo built in and we may have to run some Bourne shell scripts.  That
1997 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
1998
1999 FOO
2000                 $echo $n "The star should be here-->$c"
2001                 $echo "*"
2002         fi
2003         $rm -f foo1 foo2
2004         ;;
2005 esac
2006
2007 : determine whether symbolic links are supported
2008 echo " "
2009 $touch blurfl
2010 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2011         echo "Symbolic links are supported." >&4
2012         lns="$ln -s"
2013 else
2014         echo "Symbolic links are NOT supported." >&4
2015         lns="$ln"
2016 fi
2017 $rm -f blurfl sym
2018
2019 : see whether [:lower:] and [:upper:] are supported character classes
2020 echo " "
2021 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2022 ABYZ)
2023         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2024         up='[:upper:]'
2025         low='[:lower:]'
2026         ;;
2027 *)      # There is a discontinuity in EBCDIC between 'I' and 'J'
2028         # (0xc9 and 0xd1), therefore that is a nice testing point.
2029         if test "X$up" = X -o "X$low" = X; then
2030             case "`echo IJ | $tr '[I-J]' '[i-j]' 2>/dev/null`" in
2031             ij) up='[A-Z]'
2032                 low='[a-z]'
2033                 ;;
2034             esac
2035         fi
2036         if test "X$up" = X -o "X$low" = X; then
2037             case "`echo IJ | $tr I-J i-j 2>/dev/null`" in
2038             ij) up='A-Z'
2039                 low='a-z'
2040                 ;;
2041             esac
2042         fi
2043         if test "X$up" = X -o "X$low" = X; then
2044             case "`echo IJ | od -x 2>/dev/null`" in
2045             *C9D1*|*c9d1*)
2046                 echo "Hey, this might be EBCDIC." >&4
2047                 if test "X$up" = X -o "X$low" = X; then
2048                     case "`echo IJ | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
2049                     ij) up='[A-IJ-RS-Z]'
2050                         low='[a-ij-rs-z]'
2051                         ;;
2052                     esac
2053                 fi
2054                 if test "X$up" = X -o "X$low" = X; then
2055                     case "`echo IJ | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
2056                     ij) up='A-IJ-RS-Z'
2057                         low='a-ij-rs-z'
2058                         ;;
2059                     esac
2060                 fi
2061                 ;;
2062             esac
2063         fi
2064 esac
2065 case "`echo IJ | $tr \"$up\" \"$low\" 2>/dev/null`" in
2066 ij)
2067     echo "Using $up and $low to convert case." >&4
2068     ;;
2069 *)
2070     echo "I don't know how to translate letters from upper to lower case." >&4
2071     echo "Your tr is not acting any way I know of." >&4
2072     exit 1
2073     ;;
2074 esac
2075 : set up the translation script tr, must be called with ./tr of course
2076 cat >tr <<EOSC
2077 $startsh
2078 case "\$1\$2" in
2079 '[A-Z][a-z]') exec $tr '$up' '$low';;
2080 '[a-z][A-Z]') exec $tr '$low' '$up';;
2081 esac
2082 exec $tr "\$@"
2083 EOSC
2084 chmod +x tr
2085 $eunicefix tr
2086
2087 : Try to determine whether config.sh was made on this system
2088 case "$config_sh" in
2089 '')
2090 myuname=`( ($uname -a) 2>/dev/null || hostname) 2>&1`
2091 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
2092 # because the A-Z/a-z are not consecutive.
2093 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
2094         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
2095 newmyuname="$myuname"
2096 dflt=n
2097 case "$knowitall" in
2098 '')
2099         if test -f ../config.sh; then
2100                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
2101                         eval "`grep myuname= ../config.sh`"
2102                 fi
2103                 if test "X$myuname" = "X$newmyuname"; then
2104                         dflt=y
2105                 fi
2106         fi
2107         ;;
2108 *) dflt=y;;
2109 esac
2110
2111 : Get old answers from old config file if Configure was run on the
2112 : same system, otherwise use the hints.
2113 hint=default
2114 cd ..
2115 if test -f config.sh; then
2116         echo " "
2117         rp="I see a config.sh file.  Shall I use it to set the defaults?"
2118         . UU/myread
2119         case "$ans" in
2120         n*|N*) echo "OK, I'll ignore it."; mv config.sh config.sh.old;;
2121         *)  echo "Fetching default answers from your old config.sh file..." >&4
2122                 tmp_n="$n"
2123                 tmp_c="$c"
2124                 tmp_sh="$sh"
2125                 . ./config.sh
2126                 cp config.sh UU
2127                 n="$tmp_n"
2128                 c="$tmp_c"
2129                 : Older versions did not always set $sh.  Catch re-use of such
2130                 : an old config.sh.
2131                 case "$sh" in
2132                 '') sh="$tmp_sh" ;;
2133                 esac
2134                 hint=previous
2135                 ;;
2136         esac
2137 fi
2138 if test ! -f config.sh; then
2139         $cat <<EOM
2140
2141 First time through, eh?  I have some defaults handy for some systems
2142 that need some extra help getting the Configure answers right:
2143
2144 EOM
2145         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
2146         dflt=''
2147         : Half the following guesses are probably wrong... If you have better
2148         : tests or hints, please send them to perlbug@perl.com
2149         : The metaconfig authors would also appreciate a copy...
2150         $test -f /irix && osname=irix
2151         $test -f /xenix && osname=sco_xenix
2152         $test -f /dynix && osname=dynix
2153         $test -f /dnix && osname=dnix
2154         $test -f /lynx.os && osname=lynxos
2155         $test -f /unicos && osname=unicos && osvers=`$uname -r`
2156         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
2157         $test -f /bin/mips && /bin/mips && osname=mips
2158         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
2159                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
2160         $test -d /usr/apollo/bin && osname=apollo
2161         $test -f /etc/saf/_sactab && osname=svr4
2162         $test -d /usr/include/minix && osname=minix
2163         if $test -d /MachTen -o -d /MachTen_Folder; then
2164                 osname=machten
2165                 if $test -x /sbin/version; then
2166                         osvers=`/sbin/version | $awk '{print $2}' |
2167                         $sed -e 's/[A-Za-z]$//'`
2168                 elif $test -x /usr/etc/version; then
2169                         osvers=`/usr/etc/version | $awk '{print $2}' |
2170                         $sed -e 's/[A-Za-z]$//'`
2171                 else
2172                         osvers="$2.$3"
2173                 fi
2174         fi
2175        $test -f /sys/posix.dll &&
2176                $test -f /usr/bin/what &&
2177                set X `/usr/bin/what /sys/posix.dll` &&
2178                $test "$3" = UWIN &&
2179                osname=uwin &&
2180                osvers="$5"
2181         if $test -f $uname; then
2182                 set X $myuname
2183                 shift
2184
2185                 case "$5" in
2186                 fps*) osname=fps ;;
2187                 mips*)
2188                         case "$4" in
2189                         umips) osname=umips ;;
2190                         *) osname=mips ;;
2191                         esac;;
2192                 [23]100) osname=mips ;;
2193                 next*) osname=next ;;
2194                 i386*)
2195                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
2196                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
2197                                 osname='sco'
2198                                 osvers=$tmp
2199                         elif $test -f /etc/kconfig; then
2200                                 osname=isc
2201                                 if test "$lns" = "$ln -s"; then
2202                                         osvers=4
2203                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
2204                                         osvers=3
2205                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
2206                                         osvers=2
2207                                 fi
2208                         fi
2209                         tmp=''
2210                         ;;
2211                 pc*)
2212                         if test -n "$DJGPP"; then
2213                                 osname=dos
2214                                 osvers=djgpp
2215                         fi
2216                         ;;
2217                 esac
2218
2219                 case "$1" in
2220                 aix) osname=aix
2221                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
2222                         case "$tmp" in
2223                         'not found') osvers="$4"."$3" ;;
2224                         '<3240'|'<>3240') osvers=3.2.0 ;;
2225                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
2226                         '=3250'|'>3250') osvers=3.2.5 ;;
2227                         *) osvers=$tmp;;
2228                         esac
2229                         ;;
2230                 *dc.osx) osname=dcosx
2231                         osvers="$3"
2232                         ;;
2233                 dnix) osname=dnix
2234                         osvers="$3"
2235                         ;;
2236                 domainos) osname=apollo
2237                         osvers="$3"
2238                         ;;
2239                 dgux) osname=dgux 
2240                         osvers="$3"
2241                         ;;
2242                 dynixptx*) osname=dynixptx
2243                         osvers=`echo "$4"|sed 's/^v//'`
2244                         ;;
2245                 freebsd) osname=freebsd 
2246                         osvers="$3" ;;
2247                 genix) osname=genix ;;
2248                 hp*) osname=hpux 
2249                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
2250                         ;;
2251                 irix*) osname=irix
2252                         case "$3" in
2253                         4*) osvers=4 ;;
2254                         5*) osvers=5 ;;
2255                         *)      osvers="$3" ;;
2256                         esac
2257                         ;;
2258                 linux) osname=linux
2259                         case "$3" in
2260                         *)      osvers="$3" ;;
2261                         esac
2262                         ;;
2263                 MiNT) osname=mint
2264                         ;;
2265                 netbsd*) osname=netbsd
2266                         osvers="$3"
2267                         ;;
2268                 news-os) osvers="$3"
2269                         case "$3" in
2270                         4*) osname=newsos4 ;;
2271                         *) osname=newsos ;;
2272                         esac
2273                         ;;
2274                 bsd386) osname=bsd386
2275                         osvers=`$uname -r`
2276                         ;;
2277                 POSIX-BC | posix-bc ) osname=posix-bc
2278                         osvers="$3"
2279                         ;;
2280                 powerux | power_ux | powermax_os | powermaxos | \
2281                 powerunix | power_unix) osname=powerux
2282                         osvers="$3"
2283                         ;;
2284                 next*) osname=next ;;
2285                 solaris) osname=solaris
2286                         case "$3" in
2287                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
2288                         *)      osvers="$3" ;;
2289                         esac
2290                         ;;
2291                 sunos) osname=sunos
2292                         case "$3" in
2293                         5*) osname=solaris
2294                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
2295                         *)      osvers="$3" ;;
2296                         esac
2297                         ;;
2298                 titanos) osname=titanos
2299                         case "$3" in
2300                         1*) osvers=1 ;;
2301                         2*) osvers=2 ;;
2302                         3*) osvers=3 ;;
2303                         4*) osvers=4 ;;
2304                         *)      osvers="$3" ;;
2305                         esac
2306                         ;;
2307                 ultrix) osname=ultrix
2308                         osvers="$3"
2309                         ;;
2310                 osf1|mls+)      case "$5" in
2311                                 alpha)
2312                                         osname=dec_osf
2313                                         osvers=`echo "$3" | sed 's/^[xvt]//'`
2314                                         ;;
2315                         hp*)    osname=hp_osf1  ;;
2316                         mips)   osname=mips_osf1 ;;
2317                         esac
2318                         ;;
2319                 unixware) osname=svr5
2320                         osvers="$4"
2321                         ;;
2322                 uts) osname=uts
2323                         osvers="$3"
2324                         ;;
2325                 qnx) osname=qnx
2326                         osvers="$4"
2327                         ;;
2328                 $2) case "$osname" in
2329                         *isc*) ;;
2330                         *freebsd*) ;;
2331                         svr*)
2332                                 : svr4.x or possibly later
2333                                 case "svr$3" in 
2334                                 ${osname}*)
2335                                         osname=svr$3
2336                                         osvers=$4
2337                                         ;;
2338                                 esac
2339                                 case "$osname" in
2340                                 svr4.0)
2341                                         : Check for ESIX
2342                                         if test -f /stand/boot ; then
2343                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
2344                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
2345                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
2346                                                         if test -n "$isesix"; then
2347                                                                 osname=esix4
2348                                                         fi
2349                                                 fi
2350                                         fi
2351                                         ;;
2352                                 esac
2353                                 ;;
2354                         *)      if test -f /etc/systemid; then
2355                                         osname=sco
2356                                         set `echo $3 | $sed 's/\./ /g'` $4
2357                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
2358                                                 osvers=$1.$2.$3
2359                                         elif $test -f $src/hints/sco_$1_$2.sh; then
2360                                                 osvers=$1.$2
2361                                         elif $test -f $src/hints/sco_$1.sh; then
2362                                                 osvers=$1
2363                                         fi
2364                                 else
2365                                         case "$osname" in
2366                                         '') : Still unknown.  Probably a generic Sys V.
2367                                                 osname="sysv"
2368                                                 osvers="$3"
2369                                                 ;;
2370                                         esac
2371                                 fi
2372                                 ;;
2373                         esac
2374                         ;;
2375                 *)      case "$osname" in
2376                         '') : Still unknown.  Probably a generic BSD.
2377                                 osname="$1"
2378                                 osvers="$3"
2379                                 ;;
2380                         esac
2381                         ;;
2382                 esac
2383         else
2384                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
2385                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
2386                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
2387                                 osname=news_os
2388                         fi
2389                         $rm -f UU/kernel.what
2390                 elif test -d c:/.; then
2391                         set X $myuname
2392                         osname=os2
2393                         osvers="$5"
2394                 fi
2395         fi
2396         
2397         : Now look for a hint file osname_osvers, unless one has been
2398         : specified already.
2399         case "$hintfile" in
2400         ''|' ')
2401                 file=`echo "${osname}_${osvers}" | $sed -e 's@\.@_@g' -e 's@_$@@'`
2402                 : Also try without trailing minor version numbers.
2403                 xfile=`echo $file | $sed -e 's@_[^_]*$@@'`
2404                 xxfile=`echo $xfile | $sed -e 's@_[^_]*$@@'`
2405                 xxxfile=`echo $xxfile | $sed -e 's@_[^_]*$@@'`
2406                 xxxxfile=`echo $xxxfile | $sed -e 's@_[^_]*$@@'`
2407                 case "$file" in
2408                 '') dflt=none ;;
2409                 *)  case "$osvers" in
2410                         '') dflt=$file
2411                                 ;;
2412                         *)  if $test -f $src/hints/$file.sh ; then
2413                                         dflt=$file
2414                                 elif $test -f $src/hints/$xfile.sh ; then
2415                                         dflt=$xfile
2416                                 elif $test -f $src/hints/$xxfile.sh ; then
2417                                         dflt=$xxfile
2418                                 elif $test -f $src/hints/$xxxfile.sh ; then
2419                                         dflt=$xxxfile
2420                                 elif $test -f $src/hints/$xxxxfile.sh ; then
2421                                         dflt=$xxxxfile
2422                                 elif $test -f "$src/hints/${osname}.sh" ; then
2423                                         dflt="${osname}"
2424                                 else
2425                                         dflt=none
2426                                 fi
2427                                 ;;
2428                         esac
2429                         ;;
2430                 esac
2431                 if $test -f Policy.sh ; then
2432                         case "$dflt" in
2433                         *Policy*) ;;
2434                         none) dflt="Policy" ;;
2435                         *) dflt="Policy $dflt" ;;
2436                         esac
2437                 fi
2438                 ;;
2439         *)
2440                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
2441                 ;;
2442         esac
2443
2444         if $test -f Policy.sh ; then
2445                 $cat <<EOM
2446
2447 There's also a Policy hint file available, which should make the
2448 site-specific (policy) questions easier to answer.
2449 EOM
2450
2451         fi
2452
2453         $cat <<EOM
2454
2455 You may give one or more space-separated answers, or "none" if appropriate.
2456 A well-behaved OS will have no hints, so answering "none" or just "Policy"
2457 is a good thing.  DO NOT give a wrong version or a wrong OS.
2458
2459 EOM
2460
2461         rp="Which of these apply, if any?"
2462         . UU/myread
2463         tans=$ans
2464         for file in $tans; do
2465                 if $test X$file = XPolicy -a -f Policy.sh; then
2466                         . Policy.sh
2467                         $cat Policy.sh >> UU/config.sh
2468                 elif $test -f $src/hints/$file.sh; then
2469                         . $src/hints/$file.sh
2470                         $cat $src/hints/$file.sh >> UU/config.sh
2471                 elif $test X$tans = X -o X$tans = Xnone ; then
2472                         : nothing
2473                 else
2474                         : Give one chance to correct a possible typo.
2475                         echo "$file.sh does not exist"
2476                         dflt=$file
2477                         rp="hint to use instead?"
2478                         . UU/myread
2479                         for file in $ans; do
2480                                 if $test -f "$src/hints/$file.sh"; then
2481                                         . $src/hints/$file.sh
2482                                         $cat $src/hints/$file.sh >> UU/config.sh
2483                                 elif $test X$ans = X -o X$ans = Xnone ; then
2484                                         : nothing
2485                                 else
2486                                         echo "$file.sh does not exist -- ignored."
2487                                 fi
2488                         done
2489                 fi
2490         done
2491
2492         hint=recommended
2493         : Remember our hint file for later.
2494         if $test -f "$src/hints/$file.sh" ; then
2495                 hintfile="$file"
2496         else
2497                 hintfile=''
2498         fi
2499 fi
2500 cd UU
2501 ;;
2502 *)
2503         echo " "
2504         echo "Fetching default answers from $config_sh..." >&4
2505         tmp_n="$n"
2506         tmp_c="$c"
2507         cd ..
2508         cp $config_sh config.sh 2>/dev/null
2509         chmod +w config.sh
2510         . ./config.sh
2511         cd UU
2512         cp ../config.sh .
2513         n="$tmp_n"
2514         c="$tmp_c"
2515         hint=previous
2516         ;;
2517 esac
2518 test "$override" && . ./optdef.sh
2519 myuname="$newmyuname"
2520
2521 : Restore computed paths
2522 for file in $loclist $trylist; do
2523         eval $file="\$_$file"
2524 done
2525
2526 cat << EOM
2527
2528 Configure uses the operating system name and version to set some defaults.
2529 The default value is probably right if the name rings a bell. Otherwise,
2530 since spelling matters for me, either accept the default or answer "none"
2531 to leave it blank.
2532
2533 EOM
2534 case "$osname" in
2535         ''|' ')
2536                 case "$hintfile" in
2537                 ''|' '|none) dflt=none ;;
2538                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
2539                 esac
2540                 ;;
2541         *) dflt="$osname" ;;
2542 esac
2543 rp="Operating system name?"
2544 . ./myread
2545 case "$ans" in
2546 none)  osname='' ;;
2547 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
2548 esac
2549 echo " "
2550 case "$osvers" in
2551         ''|' ')
2552                 case "$hintfile" in
2553                 ''|' '|none) dflt=none ;;
2554                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
2555                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
2556                         case "$dflt" in
2557                         ''|' ') dflt=none ;;
2558                         esac
2559                         ;;
2560                 esac
2561                 ;;
2562         *) dflt="$osvers" ;;
2563 esac
2564 rp="Operating system version?"
2565 . ./myread
2566 case "$ans" in
2567 none)  osvers='' ;;
2568 *) osvers="$ans" ;;
2569 esac
2570
2571
2572 . ./posthint.sh
2573
2574 : who configured the system
2575 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
2576 cf_by=`(logname) 2>/dev/null`
2577 case "$cf_by" in
2578 "")
2579         cf_by=`(whoami) 2>/dev/null`
2580         case "$cf_by" in
2581         "") cf_by=unknown ;;
2582         esac ;;
2583 esac
2584
2585 : set up the script used to warn in case of inconsistency
2586 cat <<EOS >whoa
2587 $startsh
2588 EOS
2589 cat <<'EOSC' >>whoa
2590 dflt=y
2591 echo " "
2592 echo "*** WHOA THERE!!! ***" >&4
2593 echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
2594 rp="    Keep the $hint value?"
2595 . ./myread
2596 case "$ans" in
2597 y) td=$was; tu=$was;;
2598 esac
2599 EOSC
2600
2601 : function used to set $1 to $val
2602 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
2603 case "$val$was" in
2604 $define$undef) . ./whoa; eval "$var=\$td";;
2605 $undef$define) . ./whoa; eval "$var=\$tu";;
2606 *) eval "$var=$val";;
2607 esac'
2608
2609 cat <<EOM
2610
2611 Perl can be built to take advantage of threads, on some systems.
2612 To do so, Configure must be run with -Dusethreads.
2613
2614 Note that threading is a highly experimental feature, and
2615 some known race conditions still remain.  If you choose to try
2616 it, be very sure to not actually deploy it for production
2617 purposes.  README.threads has more details, and is required
2618 reading if you enable threads.
2619 EOM
2620 case "$usethreads" in
2621 $define|true|[yY]*)     dflt='y';;
2622 *) dflt='n';;
2623 esac
2624 rp='Build a threading Perl?'
2625 . ./myread
2626 case "$ans" in
2627 y|Y)    val="$define" ;;     
2628 *)      val="$undef" ;;
2629 esac
2630 set usethreads
2631 eval $setvar 
2632
2633 case "$d_oldpthreads" in
2634 '')     : Configure tests would be welcome here.  For now, assume undef.
2635         val="$undef" ;;
2636 *)      val="$d_oldpthreads" ;;
2637 esac
2638 set d_oldpthreads
2639 eval $setvar
2640
2641
2642 case "$usethreads" in
2643 "$define"|true|[yY]*)
2644 : Look for a hint-file generated 'call-back-unit'.  If the
2645 : user has specified that a threading perl is to be built,
2646 : we may need to set or change some other defaults.
2647         if $test -f usethreads.cbu; then
2648                 echo "Your platform has some specific hints for threaded builds, using them..."
2649                 . ./usethreads.cbu
2650         else
2651                 $cat <<EOM
2652 (Your platform doesn't have any specific hints for threaded builds.
2653  Assuming POSIX threads, then.)
2654 EOM
2655         fi
2656     ;;
2657 esac
2658
2659 cat <<EOM
2660
2661 Perl can be built so that multiple Perl interpreters can coexist
2662 within the same Perl executable.  To do so, Configure must be run with
2663 -Dusemultiplicity.
2664
2665 Normally you do not need this and you should answer no.
2666
2667 EOM
2668 case "$usemultiplicity" in
2669 $define|true|[yY]*)     dflt='y';;
2670 *) dflt='n';;
2671 esac
2672 rp='Build Perl for multiplicity?'
2673 . ./myread
2674 case "$ans" in
2675 y|Y)    val="$define" ;;     
2676 *)      val="$undef" ;;
2677 esac
2678 set usemultiplicity
2679 eval $setvar 
2680
2681 : determine where manual pages are on this system
2682 echo " "
2683 case "$sysman" in
2684 '') 
2685         syspath='/usr/man/man1 /usr/man/mann /usr/man/manl /usr/man/local/man1'
2686         syspath="$syspath /usr/man/u_man/man1 /usr/share/man/man1"
2687         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
2688         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
2689         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
2690         sysman=`./loc . /usr/man/man1 $syspath`
2691         ;;
2692 esac
2693 if $test -d "$sysman"; then
2694         echo "System manual is in $sysman." >&4
2695 else
2696         echo "Could not find manual pages in source form." >&4
2697 fi
2698
2699 : see what memory models we can support
2700 case "$models" in
2701 '')
2702         $cat >pdp11.c <<'EOP'
2703 int main() {
2704 #ifdef pdp11
2705         exit(0);
2706 #else
2707         exit(1);
2708 #endif
2709 }
2710 EOP
2711         ( cc -o pdp11 pdp11.c ) >/dev/null 2>&1
2712         if $test -f pdp11 && ./pdp11 2>/dev/null; then
2713                 dflt='unsplit split'
2714         else
2715                 tans=`./loc . X /lib/small /lib/large /usr/lib/small /usr/lib/large /lib/medium /usr/lib/medium /lib/huge`
2716                 case "$tans" in
2717                 X) dflt='none';;
2718                 *) if $test -d /lib/small || $test -d /usr/lib/small; then
2719                                 dflt='small'
2720                         else
2721                                 dflt=''
2722                         fi
2723                         if $test -d /lib/medium || $test -d /usr/lib/medium; then
2724                                 dflt="$dflt medium"
2725                         fi
2726                         if $test -d /lib/large || $test -d /usr/lib/large; then
2727                                 dflt="$dflt large"
2728                         fi
2729                         if $test -d /lib/huge || $test -d /usr/lib/huge; then
2730                                 dflt="$dflt huge"
2731                         fi
2732                 esac
2733         fi;;
2734 *) dflt="$models";;
2735 esac
2736 $cat <<EOM
2737  
2738 Some systems have different model sizes.  On most systems they are called
2739 small, medium, large, and huge.  On the PDP11 they are called unsplit and
2740 split.  If your system doesn't support different memory models, say "none".
2741 If you wish to force everything to one memory model, say "none" here and
2742 put the appropriate flags later when it asks you for other cc and ld flags.
2743 Venix systems may wish to put "none" and let the compiler figure things out.
2744 (In the following question multiple model names should be space separated.)
2745
2746 The default for most systems is "none".
2747
2748 EOM
2749 rp="Which memory models are supported?"
2750 . ./myread
2751 models="$ans"
2752
2753 case "$models" in
2754 none)
2755         small=''
2756         medium=''
2757         large=''
2758         huge=''
2759         unsplit=''
2760         split=''
2761         ;;
2762 *split)
2763         case "$split" in
2764         '') if $contains '\-i' $sysman/ld.1 >/dev/null 2>&1 || \
2765                          $contains '\-i' $sysman/cc.1 >/dev/null 2>&1; then
2766                         dflt='-i'
2767                 else
2768                         dflt='none'
2769                 fi;;
2770         *) dflt="$split";;
2771         esac
2772         rp="What flag indicates separate I and D space?"
2773         . ./myread
2774         tans="$ans"
2775         case "$tans" in
2776         none) tans='';;
2777         esac
2778         split="$tans"
2779         unsplit='';;
2780 *large*|*small*|*medium*|*huge*)
2781         case "$models" in
2782         *large*)
2783                 case "$large" in
2784                 '') dflt='-Ml';;
2785                 *) dflt="$large";;
2786                 esac
2787         rp="What flag indicates large model?"
2788         . ./myread
2789         tans="$ans"
2790         case "$tans" in
2791         none) tans='';
2792         esac
2793         large="$tans";;
2794         *) large='';;
2795         esac
2796         case "$models" in
2797         *huge*) case "$huge" in
2798                 '') dflt='-Mh';;
2799                 *) dflt="$huge";;
2800                 esac
2801                 rp="What flag indicates huge model?"
2802                 . ./myread
2803                 tans="$ans"
2804                 case "$tans" in
2805                 none) tans='';
2806                 esac
2807                 huge="$tans";;
2808         *) huge="$large";;
2809         esac
2810         case "$models" in
2811         *medium*) case "$medium" in
2812                 '') dflt='-Mm';;
2813                 *) dflt="$medium";;
2814                 esac
2815                 rp="What flag indicates medium model?"
2816                 . ./myread
2817                 tans="$ans"
2818                 case "$tans" in
2819                 none) tans='';
2820                 esac
2821                 medium="$tans";;
2822         *) medium="$large";;
2823         esac
2824         case "$models" in
2825         *small*) case "$small" in
2826                 '') dflt='none';;
2827                 *) dflt="$small";;
2828                 esac
2829                 rp="What flag indicates small model?"
2830                 . ./myread
2831                 tans="$ans"
2832                 case "$tans" in
2833                 none) tans='';
2834                 esac
2835                 small="$tans";;
2836         *) small='';;
2837         esac
2838         ;;
2839 *)
2840         echo "Unrecognized memory models--you may have to edit Makefile.SH" >&4
2841         ;;
2842 esac
2843 $rm -f pdp11.* pdp11
2844
2845 : make some quick guesses about what we are up against
2846 echo " "
2847 $echo $n "Hmm...  $c"
2848 echo exit 1 >bsd
2849 echo exit 1 >usg
2850 echo exit 1 >v7
2851 echo exit 1 >osf1
2852 echo exit 1 >eunice
2853 echo exit 1 >xenix
2854 echo exit 1 >venix
2855 echo exit 1 >os2
2856 d_bsd="$undef"
2857 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
2858 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
2859 then
2860         echo "Looks kind of like an OSF/1 system, but we'll see..."
2861         echo exit 0 >osf1
2862 elif test `echo abc | tr a-z A-Z` = Abc ; then
2863         xxx=`./loc addbib blurfl $pth`
2864         if $test -f $xxx; then
2865         echo "Looks kind of like a USG system with BSD features, but we'll see..."
2866                 echo exit 0 >bsd
2867                 echo exit 0 >usg
2868         else
2869                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
2870                         echo "Looks kind of like an extended USG system, but we'll see..."
2871                 else
2872                         echo "Looks kind of like a USG system, but we'll see..."
2873                 fi
2874                 echo exit 0 >usg
2875         fi
2876 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
2877         echo "Looks kind of like a BSD system, but we'll see..."
2878         d_bsd="$define"
2879         echo exit 0 >bsd
2880 else
2881         echo "Looks kind of like a Version 7 system, but we'll see..."
2882         echo exit 0 >v7
2883 fi
2884 case "$eunicefix" in
2885 *unixtovms*)
2886         $cat <<'EOI'
2887 There is, however, a strange, musty smell in the air that reminds me of
2888 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
2889 EOI
2890         echo exit 0 >eunice
2891         d_eunice="$define"
2892 : it so happens the Eunice I know will not run shell scripts in Unix format
2893         ;;
2894 *)
2895         echo " "
2896         echo "Congratulations.  You aren't running Eunice."
2897         d_eunice="$undef"
2898         ;;
2899 esac
2900 : Detect OS2.  The p_ variable is set above in the Head.U unit.
2901 case "$p_" in
2902 :) ;;
2903 *)
2904         $cat <<'EOI'
2905 I have the feeling something is not exactly right, however...don't tell me...
2906 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
2907 EOI
2908         echo exit 0 >os2
2909         ;;
2910 esac
2911 if test -f /xenix; then
2912         echo "Actually, this looks more like a XENIX system..."
2913         echo exit 0 >xenix
2914         d_xenix="$define"
2915 else
2916         echo " "
2917         echo "It's not Xenix..."
2918         d_xenix="$undef"
2919 fi
2920 chmod +x xenix
2921 $eunicefix xenix
2922 if test -f /venix; then
2923         echo "Actually, this looks more like a VENIX system..."
2924         echo exit 0 >venix
2925 else
2926         echo " "
2927         if ./xenix; then
2928                 : null
2929         else
2930                 echo "Nor is it Venix..."
2931         fi
2932 fi
2933 chmod +x bsd usg v7 osf1 eunice xenix venix os2
2934 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
2935 $rm -f foo
2936
2937 : see if we need a special compiler
2938 echo " "
2939 if ./usg; then
2940         case "$cc" in
2941         '') case "$Mcc" in
2942                 /*) dflt='Mcc';;
2943                 *) case "$large" in
2944                         -M*) dflt='cc';;
2945                         *)      if $contains '\-M' $sysman/cc.1 >/dev/null 2>&1 ; then
2946                                         if $contains '\-M' $sysman/cpp.1 >/dev/null 2>&1; then
2947                                                 dflt='cc'
2948                                         else
2949                                                 dflt='cc -M'
2950                                         fi
2951                                 else
2952                                         dflt='cc'
2953                                 fi;;
2954                         esac;;
2955                 esac;;
2956         *)  dflt="$cc";;
2957         esac
2958         case "$dflt" in
2959         *M*)    $cat <<'EOM'
2960 On some older systems the default C compiler will not resolve multiple global
2961 references that happen to have the same name.  On some such systems the "Mcc"
2962 command may be used to force these to be resolved.  On other systems a "cc -M"
2963 command is required.  (Note that the -M flag on other systems indicates a
2964 memory model to use!) If you have the Gnu C compiler, you might wish to use
2965 that instead.
2966
2967 EOM
2968         ;;
2969         esac
2970         rp="Use which C compiler?"
2971         . ./myread
2972         cc="$ans"
2973 else
2974         case "$cc" in
2975         '') dflt=cc;;
2976         *) dflt="$cc";;
2977         esac
2978         rp="Use which C compiler?"
2979         . ./myread
2980         cc="$ans"
2981 fi
2982 : Look for a hint-file generated 'call-back-unit'.  Now that the
2983 : user has specified the compiler, we may need to set or change some
2984 : other defaults.
2985 if $test -f cc.cbu; then
2986     . ./cc.cbu
2987 fi
2988 echo " "
2989 echo "Checking for GNU cc in disguise and/or its version number..." >&4
2990 $cat >gccvers.c <<EOM
2991 #include <stdio.h>
2992 int main() {
2993 #ifdef __GNUC__
2994 #ifdef __VERSION__
2995         printf("%s\n", __VERSION__);
2996 #else
2997         printf("%s\n", "1");
2998 #endif
2999 #endif
3000         exit(0);
3001 }
3002 EOM
3003 if $cc -o gccvers gccvers.c; then
3004         gccversion=`./gccvers`
3005         case "$gccversion" in
3006         '') echo "You are not using GNU cc." ;;
3007         *)  echo "You are using GNU cc $gccversion." ;;
3008         esac
3009 else
3010         echo " "
3011         echo "*** WHOA THERE!!! ***" >&4
3012         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
3013         case "$knowitall" in
3014         '')
3015         echo "    You'd better start hunting for one and let me know about it." >&4
3016                 exit 1
3017                 ;;
3018         esac
3019 fi
3020 $rm -f gccvers*
3021 case "$gccversion" in
3022 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
3023 esac
3024
3025
3026 case "$usemorebits" in
3027 "$define"|true|[yY]*)
3028         use64bits="$define"
3029         uselongdouble="$define"
3030         usemorebits="$define"
3031         ;;
3032 *)      usemorebits="$undef"
3033         ;;
3034 esac
3035
3036
3037 cat <<EOM
3038
3039 Perl can be built to understand large files (files larger than 2 gigabytes)
3040 on some systems.  To do so, Configure must be run with -Duselargefiles.
3041
3042 If this doesn't make any sense to you, just accept the default.
3043 EOM
3044 case "$uselargefiles" in
3045 "$define"|true|[yY]*) dflt='y' ;;
3046 *)      dflt='n' ;;
3047 esac
3048 rp='Try to understand large files?'
3049 . ./myread
3050 case "$ans" in
3051 y|Y)    val="$define" ;;
3052 *)      val="$undef"  ;;
3053 esac
3054 set uselargefiles
3055 eval $setvar
3056 case "$uselargefiles" in
3057 "$define") use64bits="$define" ;;
3058 esac
3059
3060 cat <<EOM
3061
3062 Perl can be built to take advantage of explicit 64-bit interfaces,
3063 on some systems.  To do so, Configure must be run with -Duse64bits.
3064
3065 If this doesn't make any sense to you, just accept the default.
3066 EOM
3067 case "$use64bits" in
3068 $define|true|[yY]*)     dflt='y';;
3069 *) dflt='n';;
3070 esac
3071 rp='Try to use explicit 64-bit interfaces, if available?'
3072 . ./myread
3073 case "$ans" in
3074 y|Y) 
3075         val="$define"
3076         ;;     
3077 *)      
3078         val="$undef"
3079         ;;
3080 esac
3081 set use64bits
3082 eval $setvar
3083
3084 case "$archname64" in
3085 '') archname64='' ;;    # not a typo
3086 esac
3087
3088 case "$use64bits" in
3089 "$define"|true|[yY]*)
3090 : Look for a hint-file generated 'call-back-unit'.  If the
3091 : user has specified that a 64 bit perl is to be built,
3092 : we may need to set or change some other defaults.
3093         if $test -f use64bits.cbu; then
3094                 echo "Your platform has some specific hints for 64-bit builds, using them..."
3095                 . ./use64bits.cbu
3096         else
3097                 $cat <<EOM
3098 (Your platform doesn't have any specific hints for 64-bit builds.
3099  This is probably okay, especially if your system is a true 64-bit system.)
3100 EOM
3101                 case "$gccversion" in
3102                 '')     ;;
3103                 *)      $cat <<EOM
3104 But since you seem to be using gcc,
3105 I will now add -DUSE_LONG_LONG to the compilation flags.
3106 EOM
3107                         ccflags="$ccflags -DUSE_LONG_LONG"
3108                         ;;
3109                 esac
3110         fi
3111         ;;
3112 esac
3113
3114 : determine the architecture name
3115 echo " "
3116 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
3117         tarch=`arch`"-$osname"
3118 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
3119         if uname -m > tmparch 2>&1 ; then
3120                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
3121                         -e 's/$/'"-$osname/" tmparch`
3122         else
3123                 tarch="$osname"
3124         fi
3125         $rm -f tmparch
3126 else
3127         tarch="$osname"
3128 fi
3129 case "$myarchname" in
3130 ''|"$tarch") ;;
3131 *)
3132         echo "(Your architecture name used to be $myarchname.)"
3133         archname=''
3134         ;;
3135 esac
3136 myarchname="$tarch"
3137 case "$archname" in
3138 '') dflt="$tarch";;
3139 *) dflt="$archname";;
3140 esac
3141 rp='What is your architecture name'
3142 . ./myread
3143 archname="$ans"
3144 case "$usethreads" in
3145 $define)
3146         echo "Threads selected." >&4
3147         case "$archname" in
3148         *-thread*) echo "...and architecture name already has -thread." >&4
3149                 ;;
3150         *)      archname="$archname-thread"
3151                 echo "...setting architecture name to $archname." >&4
3152                 ;;
3153         esac
3154         ;;
3155 esac
3156 case "$usemultiplicity" in
3157 $define)
3158         echo "Multiplicity selected." >&4
3159         case "$archname" in
3160         *-multi*) echo "...and architecture name already has -multi." >&4
3161                 ;;
3162         *)      archname="$archname-multi"
3163                 echo "...setting architecture name to $archname." >&4
3164                 ;;
3165         esac
3166         ;;
3167 esac
3168 case "$use64bits" in
3169 $define)
3170         echo "Explicit 64-bitness selected." >&4
3171         case "$archname64" in
3172         '')
3173                 ;;
3174         *)
3175                 case "$archname" in
3176                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
3177                         ;;
3178                 *)      archname="$archname-$archname64"
3179                         echo "...setting architecture name to $archname." >&4
3180                         ;;
3181                 esac
3182                 ;;
3183         esac
3184 esac
3185
3186 : decide how portable to be.  Allow command line overrides.
3187 case "$d_portable" in
3188 "$undef") ;;
3189 *)      d_portable="$define" ;;
3190 esac
3191
3192 : set up shell script to do ~ expansion
3193 cat >filexp <<EOSS
3194 $startsh
3195 : expand filename
3196 case "\$1" in
3197  ~/*|~)
3198         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3199         ;;
3200  ~*)
3201         if $test -f /bin/csh; then
3202                 /bin/csh -f -c "glob \$1"
3203                 failed=\$?
3204                 echo ""
3205                 exit \$failed
3206         else
3207                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3208                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3209                 if $test ! -d "\$dir"; then
3210                         me=\`basename \$0\`
3211                         echo "\$me: can't locate home directory for: \$name" >&2
3212                         exit 1
3213                 fi
3214                 case "\$1" in
3215                 */*)
3216                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3217                         ;;
3218                 *)
3219                         echo \$dir
3220                         ;;
3221                 esac
3222         fi
3223         ;;
3224 *)
3225         echo \$1
3226         ;;
3227 esac
3228 EOSS
3229 chmod +x filexp
3230 $eunicefix filexp
3231
3232 : now set up to get a file name
3233 cat <<EOS >getfile
3234 $startsh
3235 EOS
3236 cat <<'EOSC' >>getfile
3237 tilde=''
3238 fullpath=''
3239 already=''
3240 skip=''
3241 none_ok=''
3242 exp_file=''
3243 nopath_ok=''
3244 orig_rp="$rp"
3245 orig_dflt="$dflt"
3246 case "$gfpth" in
3247 '') gfpth='.' ;;
3248 esac
3249
3250 case "$fn" in
3251 *\(*)
3252         expr $fn : '.*(\(.*\)).*' | tr ',' $trnl >getfile.ok
3253         fn=`echo $fn | sed 's/(.*)//'`
3254         ;;
3255 esac
3256
3257 case "$fn" in
3258 *:*)
3259         loc_file=`expr $fn : '.*:\(.*\)'`
3260         fn=`expr $fn : '\(.*\):.*'`
3261         ;;
3262 esac
3263
3264 case "$fn" in
3265 *~*) tilde=true;;
3266 esac
3267 case "$fn" in
3268 */*) fullpath=true;;
3269 esac
3270 case "$fn" in
3271 *+*) skip=true;;
3272 esac
3273 case "$fn" in
3274 *n*) none_ok=true;;
3275 esac
3276 case "$fn" in
3277 *e*) exp_file=true;;
3278 esac
3279 case "$fn" in
3280 *p*) nopath_ok=true;;
3281 esac
3282
3283 case "$fn" in
3284 *f*) type='File';;
3285 *d*) type='Directory';;
3286 *l*) type='Locate';;
3287 esac
3288
3289 what="$type"
3290 case "$what" in
3291 Locate) what='File';;
3292 esac
3293
3294 case "$exp_file" in
3295 '')
3296         case "$d_portable" in
3297         "$define") ;;
3298         *) exp_file=true;;
3299         esac
3300         ;;
3301 esac
3302
3303 cd ..
3304 while test "$type"; do
3305         redo=''
3306         rp="$orig_rp"
3307         dflt="$orig_dflt"
3308         case "$tilde" in
3309         true) rp="$rp (~name ok)";;
3310         esac
3311         . UU/myread
3312         if test -f UU/getfile.ok && \
3313                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3314         then
3315                 value="$ans"
3316                 ansexp="$ans"
3317                 break
3318         fi
3319         case "$ans" in
3320         none)
3321                 value=''
3322                 ansexp=''
3323                 case "$none_ok" in
3324                 true) type='';;
3325                 esac
3326                 ;;
3327         *)
3328                 case "$tilde" in
3329                 '') value="$ans"
3330                         ansexp="$ans";;
3331                 *)
3332                         value=`UU/filexp $ans`
3333                         case $? in
3334                         0)
3335                                 if test "$ans" != "$value"; then
3336                                         echo "(That expands to $value on this system.)"
3337                                 fi
3338                                 ;;
3339                         *) value="$ans";;
3340                         esac
3341                         ansexp="$value"
3342                         case "$exp_file" in
3343                         '') value="$ans";;
3344                         esac
3345                         ;;
3346                 esac
3347                 case "$fullpath" in
3348                 true)
3349                         case "$ansexp" in
3350                         /*) value="$ansexp" ;;
3351                         *)
3352                                 redo=true
3353                                 case "$already" in
3354                                 true)
3355                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
3356                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
3357                                         ;;
3358                                 *)
3359                                 echo "Please give a full path name, starting with slash." >&4
3360                                         case "$tilde" in
3361                                         true)
3362                                 echo "Note that using ~name is ok provided it expands well." >&4
3363                                                 already=true
3364                                                 ;;
3365                                         esac
3366                                 esac
3367                                 ;;
3368                         esac
3369                         ;;
3370                 esac
3371                 case "$redo" in
3372                 '')
3373                         case "$type" in
3374                         File)
3375                                 for fp in $gfpth; do
3376                                         if test "X$fp" = X.; then
3377                                             pf="$ansexp"
3378                                         else    
3379                                             pf="$fp/$ansexp"
3380                                         fi
3381                                         if test -f "$pf"; then
3382                                                 type=''
3383                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3384                                         then
3385                                                 echo "($value is not a plain file, but that's ok.)"
3386                                                 type=''
3387                                         fi
3388                                         if test X"$type" = X; then
3389                                             value="$pf"
3390                                             break
3391                                         fi
3392                                 done
3393                                 ;;
3394                         Directory)
3395                                 for fp in $gfpth; do
3396                                         if test "X$fp" = X.; then
3397                                             pf="$ansexp"
3398                                         else    
3399                                             pf="$fp/$ansexp"
3400                                         fi
3401                                         if test -d "$pf"; then
3402                                                 type=''
3403                                                 value="$pf"
3404                                                 break
3405                                         fi
3406                                 done
3407                                 ;;
3408                         Locate)
3409                                 if test -d "$ansexp"; then
3410                                         echo "(Looking for $loc_file in directory $value.)"
3411                                         value="$value/$loc_file"
3412                                         ansexp="$ansexp/$loc_file"
3413                                 fi
3414                                 if test -f "$ansexp"; then
3415                                         type=''
3416                                 fi
3417                                 case "$nopath_ok" in
3418                                 true)   case "$value" in
3419                                         */*) ;;
3420                                         *)      echo "Assuming $value will be in people's path."
3421                                                 type=''
3422                                                 ;;
3423                                         esac
3424                                         ;;
3425                                 esac
3426                                 ;;
3427                         esac
3428
3429                         case "$skip" in
3430                         true) type='';
3431                         esac
3432
3433                         case "$type" in
3434                         '') ;;
3435                         *)
3436                                 if test "$fastread" = yes; then
3437                                         dflt=y
3438                                 else
3439                                         dflt=n
3440                                 fi
3441                                 rp="$what $value doesn't exist.  Use that name anyway?"
3442                                 . UU/myread
3443                                 dflt=''
3444                                 case "$ans" in
3445                                 y*) type='';;
3446                                 *) echo " ";;
3447                                 esac
3448                                 ;;
3449                         esac
3450                         ;;
3451                 esac
3452                 ;;
3453         esac
3454 done
3455 cd UU
3456 ans="$value"
3457 rp="$orig_rp"
3458 dflt="$orig_dflt"
3459 rm -f getfile.ok
3460 test "X$gfpthkeep" != Xy && gfpth=""
3461 EOSC
3462
3463 : determine root of directory hierarchy where package will be installed.
3464 case "$prefix" in
3465 '')
3466         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
3467         ;;
3468 *)
3469         dflt="$prefix"
3470         ;;
3471 esac
3472 $cat <<EOM
3473
3474 By default, $package will be installed in $dflt/bin, manual pages
3475 under $dflt/man, etc..., i.e. with $dflt as prefix for all
3476 installation directories. Typically this is something like /usr/local.
3477 If you wish to have binaries under /usr/bin but other parts of the
3478 installation under /usr/local, that's ok: you will be prompted
3479 separately for each of the installation directories, the prefix being
3480 only used to set the defaults.
3481
3482 EOM
3483 fn=d~
3484 rp='Installation prefix to use?'
3485 . ./getfile
3486 oldprefix=''
3487 case "$prefix" in
3488 '') ;;
3489 *)
3490         case "$ans" in
3491         "$prefix") ;;
3492         *) oldprefix="$prefix";;
3493         esac
3494         ;;
3495 esac
3496 prefix="$ans"
3497 prefixexp="$ansexp"
3498
3499 : is AFS running?
3500 echo " "
3501 case "$afs" in
3502 $define|true)   afs=true ;;
3503 $undef|false)   afs=false ;;
3504 *)      if test -d /afs; then
3505                 afs=true
3506         else
3507                 afs=false
3508         fi
3509         ;;
3510 esac
3511 if $afs; then
3512         echo "AFS may be running... I'll be extra cautious then..." >&4
3513 else
3514         echo "AFS does not seem to be running..." >&4
3515 fi
3516
3517 : determine installation prefix for where package is to be installed.
3518 if $afs; then 
3519 $cat <<EOM
3520
3521 Since you are running AFS, I need to distinguish the directory in which
3522 files will reside from the directory in which they are installed (and from
3523 which they are presumably copied to the former directory by occult means).
3524
3525 EOM
3526         case "$installprefix" in
3527         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
3528         *) dflt="$installprefix";;
3529         esac
3530 else
3531 $cat <<EOM
3532
3533 In some special cases, particularly when building $package for distribution,
3534 it is convenient to distinguish between the directory in which files should 
3535 be installed from the directory ($prefix) in which they 
3536 will eventually reside.  For most users, these two directories are the same.
3537
3538 EOM
3539         case "$installprefix" in
3540         '') dflt=$prefix ;;
3541         *) dflt=$installprefix;;
3542         esac
3543 fi
3544 fn=d~
3545 rp='What installation prefix should I use for installing files?'
3546 . ./getfile
3547 installprefix="$ans"
3548 installprefixexp="$ansexp"
3549
3550 : set the prefixit variable, to compute a suitable default value
3551 prefixit='case "$3" in
3552 ""|none)
3553         case "$oldprefix" in
3554         "") eval "$1=\"\$$2\"";;
3555         *)
3556                 case "$3" in
3557                 "") eval "$1=";;
3558                 none)
3559                         eval "tp=\"\$$2\"";
3560                         case "$tp" in
3561                         ""|" ") eval "$1=\"\$$2\"";;
3562                         *) eval "$1=";;
3563                         esac;;
3564                 esac;;
3565         esac;;
3566 *)
3567         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
3568         case "$tp" in
3569         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
3570         /*-$oldprefix/*|\~*-$oldprefix/*)
3571                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
3572         *) eval "$1=\"\$$2\"";;
3573         esac;;
3574 esac'
3575
3576 : set the base revision
3577 baserev=5.0
3578
3579 : get the patchlevel
3580 echo " "
3581 echo "Getting the current patchlevel..." >&4
3582 if $test -r $rsrc/patchlevel.h;then
3583         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
3584         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
3585         apiversion=`awk '/define[       ]+PERL_APIVERSION/ {print $3}' $rsrc/patchlevel.h`
3586 else
3587         patchlevel=0
3588         subversion=0
3589         apiversion=0
3590 fi
3591 $echo $n "(You have $package" $c
3592 case "$package" in
3593 "*$baserev")    ;;
3594 *)              $echo $n " $baserev" $c ;;
3595 esac
3596 $echo $n " patchlevel $patchlevel" $c
3597 test 0 -eq "$subversion" || $echo $n " subversion $subversion" $c
3598 echo ".)"
3599
3600 if test 0 -eq "$subversion"; then
3601         version=`LC_ALL=C; export LC_ALL; \
3602                  echo $baserev $patchlevel | \
3603                  $awk '{ printf "%.3f\n", $1 + $2/1000.0 }'`
3604 else
3605         version=`LC_ALL=C; export LC_ALL; \
3606                  echo $baserev $patchlevel $subversion | \
3607                  $awk '{ printf "%.5f\n", $1 + $2/1000.0 + $3/100000.0 }'`
3608 fi
3609
3610 : determine installation style
3611 : For now, try to deduce it from prefix unless it is already set.
3612 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
3613 case "$installstyle" in
3614 '')     case "$prefix" in
3615                 *perl*) dflt='lib';;
3616                 *) dflt='lib/perl5' ;;
3617         esac
3618         ;;
3619 *)      dflt='lib/perl5' ;;
3620 esac
3621 : Probably not worth prompting for this since we prompt for all
3622 : the directories individually, and the prompt would be too long and
3623 : confusing anyway.
3624 installstyle=$dflt
3625
3626 : determine where private library files go
3627 : Usual default is /usr/local/lib/perl5/$version.
3628 : Also allow things like /opt/perl/lib/$version, since 
3629 : /opt/perl/lib/perl5... would be redundant.
3630 : The default "style" setting is made in installstyle.U
3631 case "$installstyle" in
3632 *lib/perl5*) set dflt privlib lib/$package/$version ;;
3633 *)       set dflt privlib lib/$version ;;
3634 esac
3635 eval $prefixit
3636 $cat <<EOM
3637
3638 There are some auxiliary files for $package that need to be put into a
3639 private library directory that is accessible by everyone.
3640
3641 EOM
3642 fn=d~+
3643 rp='Pathname where the private library files will reside?'
3644 . ./getfile
3645 privlib="$ans"
3646 privlibexp="$ansexp"
3647 : Change installation prefix, if necessary.
3648 if $test X"$prefix" != X"$installprefix"; then
3649         installprivlib=`echo $privlibexp | sed "s#^$prefix#$installprefix#"`
3650 else
3651         installprivlib="$privlibexp"
3652 fi
3653
3654 : set the prefixup variable, to restore leading tilda escape
3655 prefixup='case "$prefixexp" in
3656 "$prefix") ;;
3657 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
3658 esac'
3659
3660 : determine where public architecture dependent libraries go
3661 set archlib archlib
3662 eval $prefixit
3663 : privlib default is /usr/local/lib/$package/$version
3664 : archlib default is /usr/local/lib/$package/$version/$archname
3665 : privlib may have an optional trailing /share.
3666 tdflt=`echo $privlib | $sed 's,/share$,,'`
3667 tdflt=$tdflt/$archname
3668 case "$archlib" in
3669 '')     dflt=$tdflt
3670         ;;
3671 *)      dflt="$archlib"
3672     ;;
3673 esac
3674 $cat <<EOM
3675
3676 $spackage contains architecture-dependent library files.  If you are
3677 sharing libraries in a heterogeneous environment, you might store
3678 these files in a separate location.  Otherwise, you can just include
3679 them with the rest of the public library files.
3680
3681 EOM
3682 fn=d+~
3683 rp='Where do you want to put the public architecture-dependent libraries?'
3684 . ./getfile
3685 archlib="$ans"
3686 archlibexp="$ansexp"
3687 if $test X"$archlib" = X"$privlib"; then
3688         d_archlib="$undef"
3689 else
3690         d_archlib="$define"
3691 fi
3692 : Change installation prefix, if necessary.
3693 if $test X"$prefix" != X"$installprefix"; then
3694         installarchlib=`echo $archlibexp | sed "s#^$prefix#$installprefix#"`
3695 else
3696         installarchlib="$archlibexp"
3697 fi
3698
3699
3700 : Binary compatibility with 5.005 is not possible for builds
3701 : with advanced features
3702 case "$usethreads$usemultiplicity" in
3703 *define*)
3704         bincompat5005="$undef"
3705         d_bincompat5005="$undef"
3706         ;;
3707 *)      $cat <<EOM
3708
3709 Perl 5.006 can be compiled for binary compatibility with 5.005.
3710 If you decide to do so, you will be able to continue using most
3711 of the extensions that were compiled for Perl 5.005.
3712
3713 EOM
3714         case "$bincompat5005$d_bincompat5005" in
3715         *"$undef"*) dflt=n ;;
3716         *) dflt=y ;;
3717         esac
3718         rp='Binary compatibility with Perl 5.005?'
3719         . ./myread
3720         case "$ans" in
3721         y*) val="$define" ;;
3722         *)  val="$undef" ;;
3723         esac
3724         set d_bincompat5005
3725         eval $setvar
3726         case "$d_bincompat5005" in
3727         "$define")
3728                 bincompat5005="$define"
3729                 ;;
3730         *)      bincompat5005="$undef"
3731                 d_bincompat5005="$undef"
3732                 ;;
3733         esac
3734         ;;
3735 esac
3736
3737
3738 : see if setuid scripts can be secure
3739 $cat <<EOM
3740
3741 Some kernels have a bug that prevents setuid #! scripts from being
3742 secure.  Some sites have disabled setuid #! scripts because of this.
3743
3744 First let's decide if your kernel supports secure setuid #! scripts.
3745 (If setuid #! scripts would be secure but have been disabled anyway,
3746 don't say that they are secure if asked.)
3747
3748 EOM
3749
3750 val="$undef"
3751 if $test -d /dev/fd; then
3752         echo "#!$ls" >reflect
3753         chmod +x,u+s reflect
3754         ./reflect >flect 2>&1
3755         if $contains "/dev/fd" flect >/dev/null; then
3756                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
3757                 val="$define"
3758         else
3759                 $cat <<EOM
3760 If you are not sure if they are secure, I can check but I'll need a
3761 username and password different from the one you are using right now.
3762 If you don't have such a username or don't want me to test, simply
3763 enter 'none'.
3764
3765 EOM
3766                 rp='Other username to test security of setuid scripts with?'
3767                 dflt='none'
3768                 . ./myread
3769                 case "$ans" in
3770                 n|none)
3771                         case "$d_suidsafe" in
3772                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
3773                                 dflt=n;;
3774                         "$undef")
3775                                 echo "Well, the $hint value is *not* secure." >&4
3776                                 dflt=n;;
3777                         *)      echo "Well, the $hint value *is* secure." >&4
3778                                 dflt=y;;
3779                         esac
3780                         ;;
3781                 *)
3782                         $rm -f reflect flect
3783                         echo "#!$ls" >reflect
3784                         chmod +x,u+s reflect
3785                         echo >flect
3786                         chmod a+w flect
3787                         echo '"su" will (probably) prompt you for '"$ans's password."
3788                         su $ans -c './reflect >flect'
3789                         if $contains "/dev/fd" flect >/dev/null; then
3790                                 echo "Okay, it looks like setuid scripts are secure." >&4
3791                                 dflt=y
3792                         else
3793                                 echo "I don't think setuid scripts are secure." >&4
3794                                 dflt=n
3795                         fi
3796                         ;;
3797                 esac
3798                 rp='Does your kernel have *secure* setuid scripts?'
3799                 . ./myread
3800                 case "$ans" in
3801                 [yY]*)  val="$define";;
3802                 *)      val="$undef";;
3803                 esac
3804         fi
3805 else
3806         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
3807         echo "(That's for file descriptors, not floppy disks.)"
3808         val="$undef"
3809 fi
3810 set d_suidsafe
3811 eval $setvar
3812
3813 $rm -f reflect flect
3814
3815 : now see if they want to do setuid emulation
3816 echo " "
3817 val="$undef"
3818 case "$d_suidsafe" in
3819 "$define")
3820         val="$undef"
3821         echo "No need to emulate SUID scripts since they are secure here." >& 4
3822         ;;
3823 *)
3824         $cat <<EOM
3825 Some systems have disabled setuid scripts, especially systems where
3826 setuid scripts cannot be secure.  On systems where setuid scripts have
3827 been disabled, the setuid/setgid bits on scripts are currently
3828 useless.  It is possible for $package to detect those bits and emulate
3829 setuid/setgid in a secure fashion.  This emulation will only work if
3830 setuid scripts have been disabled in your kernel.
3831
3832 EOM
3833         case "$d_dosuid" in
3834         "$define") dflt=y ;;
3835         *) dflt=n ;;
3836         esac
3837         rp="Do you want to do setuid/setgid emulation?"
3838         . ./myread
3839         case "$ans" in
3840         [yY]*)  val="$define";;
3841         *)      val="$undef";;
3842         esac
3843         ;;
3844 esac
3845 set d_dosuid
3846 eval $setvar
3847
3848 : What should the include directory be ?
3849 echo " "
3850 $echo $n "Hmm...  $c"
3851 dflt='/usr/include'
3852 incpath=''
3853 mips_type=''
3854 if $test -f /bin/mips && /bin/mips; then
3855         echo "Looks like a MIPS system..."
3856         $cat >usr.c <<'EOCP'
3857 #ifdef SYSTYPE_BSD43
3858 /bsd43
3859 #endif
3860 EOCP
3861         if $cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
3862                 dflt='/bsd43/usr/include'
3863                 incpath='/bsd43'
3864                 mips_type='BSD 4.3'
3865         else
3866                 mips_type='System V'
3867         fi
3868         $rm -f usr.c usr.out
3869         echo "and you're compiling with the $mips_type compiler and libraries."
3870         xxx_prompt=y
3871         echo "exit 0" >mips
3872 else
3873         echo "Doesn't look like a MIPS system."
3874         xxx_prompt=n
3875         echo "exit 1" >mips
3876 fi
3877 chmod +x mips
3878 $eunicefix mips
3879 case "$usrinc" in
3880 '') ;;
3881 *) dflt="$usrinc";;
3882 esac
3883 case "$xxx_prompt" in
3884 y)      fn=d/
3885         echo " "
3886         rp='Where are the include files you want to use?'
3887         . ./getfile
3888         usrinc="$ans"
3889         ;;
3890 *)      usrinc="$dflt"
3891         ;;
3892 esac
3893
3894 : see how we invoke the C preprocessor
3895 echo " "
3896 echo "Now, how can we feed standard input to your C preprocessor..." >&4
3897 cat <<'EOT' >testcpp.c
3898 #define ABC abc
3899 #define XYZ xyz
3900 ABC.XYZ
3901 EOT
3902 cd ..
3903 if test ! -f cppstdin; then
3904         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
3905                 # AIX cc -E doesn't show the absolute headerfile
3906                 # locations but we'll cheat by using the -M flag.
3907                 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
3908         else
3909                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
3910         fi
3911 else
3912         echo "Keeping your $hint cppstdin wrapper."
3913 fi
3914 chmod 755 cppstdin
3915 wrapper=`pwd`/cppstdin
3916 ok='false'
3917 cd UU
3918
3919 if $test "X$cppstdin" != "X" && \
3920         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
3921         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3922 then
3923         echo "You used to use $cppstdin $cppminus so we'll use that again."
3924         case "$cpprun" in
3925         '') echo "But let's see if we can live without a wrapper..." ;;
3926         *)
3927                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
3928                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3929                 then
3930                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
3931                         ok='true'
3932                 else
3933                         echo "(However, $cpprun $cpplast does not work, let's see...)"
3934                 fi
3935                 ;;
3936         esac
3937 else
3938         case "$cppstdin" in
3939         '') ;;
3940         *)
3941                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
3942                 ;;
3943         esac
3944 fi
3945
3946 if $ok; then
3947         : nothing
3948 elif echo 'Maybe "'"$cc"' -E" will work...'; \
3949         $cc -E <testcpp.c >testcpp.out 2>&1; \
3950         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3951         echo "Yup, it does."
3952         x_cpp="$cc -E"
3953         x_minus='';
3954 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
3955         $cc -E - <testcpp.c >testcpp.out 2>&1; \
3956         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3957         echo "Yup, it does."
3958         x_cpp="$cc -E"
3959         x_minus='-';
3960 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
3961         $cc -P <testcpp.c >testcpp.out 2>&1; \
3962         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3963         echo "Yipee, that works!"
3964         x_cpp="$cc -P"
3965         x_minus='';
3966 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
3967         $cc -P - <testcpp.c >testcpp.out 2>&1; \
3968         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3969         echo "At long last!"
3970         x_cpp="$cc -P"
3971         x_minus='-';
3972 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
3973         $cpp <testcpp.c >testcpp.out 2>&1; \
3974         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3975         echo "It works!"
3976         x_cpp="$cpp"
3977         x_minus='';
3978 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
3979         $cpp - <testcpp.c >testcpp.out 2>&1; \
3980         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3981         echo "Hooray, it works!  I was beginning to wonder."
3982         x_cpp="$cpp"
3983         x_minus='-';
3984 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
3985         $wrapper <testcpp.c >testcpp.out 2>&1; \
3986         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3987         x_cpp="$wrapper"
3988         x_minus=''
3989         echo "Eureka!"
3990 else
3991         dflt=''
3992         rp="No dice.  I can't find a C preprocessor.  Name one:"
3993         . ./myread
3994         x_cpp="$ans"
3995         x_minus=''
3996         $x_cpp <testcpp.c >testcpp.out 2>&1
3997         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3998                 echo "OK, that will do." >&4
3999         else
4000 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
4001                 exit 1
4002         fi
4003 fi
4004
4005 case "$ok" in
4006 false)
4007         cppstdin="$x_cpp"
4008         cppminus="$x_minus"
4009         cpprun="$x_cpp"
4010         cpplast="$x_minus"
4011         set X $x_cpp
4012         shift
4013         case "$1" in
4014         "$cpp")
4015                 echo "Perhaps can we force $cc -E using a wrapper..."
4016                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4017                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4018                 then
4019                         echo "Yup, we can."
4020                         cppstdin="$wrapper"
4021                         cppminus='';
4022                 else
4023                         echo "Nope, we'll have to live without it..."
4024                 fi
4025                 ;;
4026         esac
4027         case "$cpprun" in
4028         "$wrapper")
4029                 cpprun=''
4030                 cpplast=''
4031                 ;;
4032         esac
4033         ;;
4034 esac
4035
4036 case "$cppstdin" in
4037 "$wrapper"|'cppstdin') ;;
4038 *) $rm -f $wrapper;;
4039 esac
4040 $rm -f testcpp.c testcpp.out
4041
4042 : Set private lib path
4043 case "$plibpth" in
4044 '') if ./mips; then
4045                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
4046         fi;;
4047 esac
4048 case "$libpth" in
4049 ' ') dlist='';;
4050 '') dlist="$loclibpth $plibpth $glibpth";;
4051 *) dlist="$libpth";;
4052 esac
4053
4054 : Now check and see which directories actually exist, avoiding duplicates
4055 libpth=''
4056 for xxx in $dlist
4057 do
4058     if $test -d $xxx; then
4059                 case " $libpth " in
4060                 *" $xxx "*) ;;
4061                 *) libpth="$libpth $xxx";;
4062                 esac
4063     fi
4064 done
4065 $cat <<'EOM'
4066
4067 Some systems have incompatible or broken versions of libraries.  Among
4068 the directories listed in the question below, please remove any you
4069 know not to be holding relevant libraries, and add any that are needed.
4070 Say "none" for none.
4071
4072 EOM
4073 case "$libpth" in
4074 '') dflt='none';;
4075 *)
4076         set X $libpth
4077         shift
4078         dflt=${1+"$@"}
4079         ;;
4080 esac
4081 rp="Directories to use for library searches?"
4082 . ./myread
4083 case "$ans" in
4084 none) libpth=' ';;
4085 *) libpth="$ans";;
4086 esac
4087
4088 : compute shared library extension
4089 case "$so" in
4090 '')
4091         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
4092                 dflt='sl'
4093         else
4094                 dflt='so'
4095         fi
4096         ;;
4097 *) dflt="$so";;
4098 esac
4099 $cat <<EOM
4100
4101 On some systems, shared libraries may be available.  Answer 'none' if
4102 you want to suppress searching of shared libraries for the remaining
4103 of this configuration.
4104
4105 EOM
4106 rp='What is the file extension used for shared libraries?'
4107 . ./myread
4108 so="$ans"
4109
4110 : Define several unixisms.
4111 : Hints files or command line option can be used to override them.
4112 : The convoluted testing is in case hints files set either the old
4113 : or the new name.
4114 case "$_exe" in
4115 '')     case "$exe_ext" in
4116     '') ;;
4117         *)      _exe="$exe_ext" ;;
4118         esac
4119         ;;
4120 esac
4121 case "$_a" in
4122 '')     case "$lib_ext" in
4123     '') _a='.a';;
4124         *)      _a="$lib_ext" ;;
4125         esac
4126         ;;
4127 esac
4128 case "$_o" in
4129 '') case "$obj_ext" in
4130         '')     _o='.o';;
4131         *)      _o="$obj_ext";;
4132         esac
4133         ;;
4134 esac
4135 case "$p_" in
4136 '') case "$path_sep" in
4137         '')     p_=':';;
4138         *)      p_="$path_sep";;
4139         esac
4140         ;;
4141 esac
4142 exe_ext=$_exe
4143 lib_ext=$_a
4144 obj_ext=$_o
4145 path_sep=$p_
4146
4147 : Which makefile gets called first.  This is used by make depend.
4148 case "$firstmakefile" in
4149 '') firstmakefile='makefile';;
4150 esac
4151
4152 cat <<EOM
4153
4154 Perl can be built to use the SOCKS proxy protocol library.  To do so,
4155 Configure must be run with -Dusesocks.
4156
4157 Normally you do not need this and you should answer no.
4158
4159 EOM
4160 case "$usesocks" in
4161 $define|true|[yY]*)     dflt='y';;
4162 *) dflt='n';;
4163 esac
4164 rp='Build Perl for SOCKS?'
4165 . ./myread
4166 case "$ans" in
4167 y|Y)    val="$define" ;;     
4168 *)      val="$undef" ;;
4169 esac
4170 set usesocks
4171 eval $setvar
4172
4173 : Looking for optional libraries
4174 echo " "
4175 echo "Checking for optional libraries..." >&4
4176 case "$libs" in
4177 ' '|'') dflt='';;
4178 *) dflt="$libs";;
4179 esac
4180 case "$libswanted" in
4181 '') libswanted='c_s';;
4182 esac
4183 case "$usesocks" in
4184 $define)
4185         libswanted="$libswanted socks5 socks5_sh"
4186         ;;
4187 esac
4188 for thislib in $libswanted; do
4189         
4190         if xxx=`./loc lib$thislib.$so.[0-9]'*' X $libpth`;
4191                 $test -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
4192                 echo "Found -l$thislib (shared)."
4193                 case " $dflt " in
4194                 *"-l$thislib "*);;
4195                 *) dflt="$dflt -l$thislib";;
4196                 esac
4197         elif xxx=`./loc lib$thislib.$so X $libpth` ; $test -f "$xxx"; then
4198                 echo "Found -l$thislib (shared)."
4199                 case " $dflt " in
4200                 *"-l$thislib "*);;
4201                 *) dflt="$dflt -l$thislib";;
4202                 esac
4203         elif xxx=`./loc lib$thislib$_a X $libpth`; $test -f "$xxx"; then
4204                 echo "Found -l$thislib."
4205                 case " $dflt " in
4206                 *"-l$thislib "*);;
4207                 *) dflt="$dflt -l$thislib";;
4208                 esac
4209         elif xxx=`./loc $thislib$_a X $libpth`; $test -f "$xxx"; then
4210                 echo "Found -l$thislib."
4211                 case " $dflt " in
4212                 *"-l$thislib "*);;
4213                 *) dflt="$dflt -l$thislib";;
4214                 esac
4215         elif xxx=`./loc lib${thislib}_s$_a X $libpth`; $test -f "$xxx"; then
4216                 echo "Found -l${thislib}_s."
4217                 case " $dflt " in
4218                 *"-l$thislib "*);;
4219                 *) dflt="$dflt -l${thislib}_s";;
4220                 esac
4221         elif xxx=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$xxx"; then
4222                 echo "Found -l$thislib."
4223                 case " $dflt " in
4224                 *"-l$thislib "*);;
4225                 *) dflt="$dflt -l$thislib";;
4226                 esac
4227         else
4228                 echo "No -l$thislib."
4229         fi
4230 done
4231 set X $dflt
4232 shift
4233 dflt="$*"
4234 case "$libs" in
4235 '') dflt="$dflt";;
4236 *) dflt="$libs";;
4237 esac
4238 case "$dflt" in
4239 ' '|'') dflt='none';;
4240 esac
4241
4242 $cat <<EOM
4243
4244 In order to compile $package on your machine, a number of libraries
4245 are usually needed.  Include any other special libraries here as well.
4246 Say "none" for none.  The default list is almost always right.
4247 EOM
4248
4249 echo " "
4250 rp="What libraries to use?"
4251 . ./myread
4252 case "$ans" in
4253 none) libs=' ';;
4254 *) libs="$ans";;
4255 esac
4256
4257 : determine optimization, if desired, or use for debug flag also
4258 case "$optimize" in
4259 ' '|$undef) dflt='none';;
4260 '') dflt='-O';;
4261 *) dflt="$optimize";;
4262 esac
4263 $cat <<EOH
4264
4265 By default, $package compiles with the -O flag to use the optimizer.
4266 Alternately, you might want to use the symbolic debugger, which uses
4267 the -g flag (on traditional Unix systems).  Either flag can be
4268 specified here.  To use neither flag, specify the word "none".
4269
4270 EOH
4271 rp="What optimizer/debugger flag should be used?"
4272 . ./myread
4273 optimize="$ans"
4274 case "$optimize" in
4275 'none') optimize=" ";;
4276 esac
4277
4278 dflt=''
4279 : We will not override a previous value, but we might want to
4280 : augment a hint file
4281 case "$hint" in
4282 default|recommended)
4283         case "$gccversion" in
4284         1*) dflt='-fpcc-struct-return' ;;
4285         esac
4286         case "$optimize" in
4287         *-g*) dflt="$dflt -DDEBUGGING";;
4288         esac
4289         case "$gccversion" in
4290         2*) if test -d /etc/conf/kconfig.d &&
4291                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
4292                 then
4293                         dflt="$dflt -posix"
4294                 fi
4295                 ;;
4296         esac
4297         case "$gccversion" in
4298         1*) ;;
4299         2.[0-8]*) ;;
4300         ?*)     echo " "
4301                 echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
4302                 echo 'int main(void) { return 0; }' > gcctest.c
4303                 if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
4304                         echo "Yes, it does." 2>&1
4305                         case "$ccflags" in
4306                         *strict-aliasing*) 
4307                                 echo "Leaving current flags $ccflags alone." 2>&1
4308                                 ;;
4309                         *) dflt="$dflt -fno-strict-aliasing" ;;
4310                         esac
4311                 else
4312                         echo "Nope, it doesn't, but that's ok." 2>&1
4313                 fi
4314                 ;;
4315         esac
4316         ;;
4317 esac
4318
4319 case "$mips_type" in
4320 *BSD*|'') inclwanted="$locincpth $usrinc";;
4321 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
4322 esac
4323 for thisincl in $inclwanted; do
4324         if $test -d $thisincl; then
4325                 if $test x$thisincl != x$usrinc; then
4326                         case "$dflt" in
4327                         *$thisincl*);;
4328                         *) dflt="$dflt -I$thisincl";;
4329                         esac
4330                 fi
4331         fi
4332 done
4333
4334 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
4335         xxx=true;
4336 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
4337         xxx=true;
4338 else
4339         xxx=false;
4340 fi;
4341 if $xxx; then
4342         case "$dflt" in
4343         *$2*);;
4344         *) dflt="$dflt -D$2";;
4345         esac;
4346 fi'
4347
4348 set signal.h LANGUAGE_C; eval $inctest
4349
4350 case "$usesocks" in
4351 $define)
4352         ccflags="$ccflags -DSOCKS"
4353         ;;
4354 esac
4355
4356 case "$hint" in
4357 default|recommended) dflt="$ccflags $dflt" ;;
4358 *) dflt="$ccflags";;
4359 esac
4360
4361 case "$dflt" in
4362 ''|' ') dflt=none;;
4363 esac
4364 $cat <<EOH
4365
4366 Your C compiler may want other flags.  For this question you should include
4367 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
4368 but you should NOT include libraries or ld flags like -lwhatever.  If you
4369 want $package to honor its debug switch, you should include -DDEBUGGING here.
4370 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
4371
4372 To use no flags, specify the word "none".
4373
4374 EOH
4375 set X $dflt
4376 shift
4377 dflt=${1+"$@"}
4378 rp="Any additional cc flags?"
4379 . ./myread
4380 case "$ans" in
4381 none) ccflags='';;
4382 *) ccflags="$ans";;
4383 esac
4384
4385 : the following weeds options from ccflags that are of no interest to cpp
4386 cppflags="$ccflags"
4387 case "$gccversion" in
4388 1*) cppflags="$cppflags -D__GNUC__"
4389 esac
4390 case "$mips_type" in
4391 '');;
4392 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
4393 esac
4394 case "$cppflags" in
4395 '');;
4396 *)
4397         echo " "
4398         echo "Let me guess what the preprocessor flags are..." >&4
4399         set X $cppflags
4400         shift
4401         cppflags=''
4402         $cat >cpp.c <<'EOM'
4403 #define BLURFL foo
4404
4405 BLURFL xx LFRULB
4406 EOM
4407         previous=''
4408         for flag in $*
4409         do
4410                 case "$flag" in
4411                 -*) ftry="$flag";;
4412                 *) ftry="$previous $flag";;
4413                 esac
4414                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
4415                         >cpp1.out 2>/dev/null && \
4416                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
4417                         >cpp2.out 2>/dev/null && \
4418                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
4419                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
4420                 then
4421                         cppflags="$cppflags $ftry"
4422                         previous=''
4423                 else
4424                         previous="$flag"
4425                 fi
4426         done
4427         set X $cppflags
4428         shift
4429         cppflags=${1+"$@"}
4430         case "$cppflags" in
4431         *-*)  echo "They appear to be: $cppflags";;
4432         esac
4433         $rm -f cpp.c cpp?.out
4434         ;;
4435 esac
4436
4437 : flags used in final linking phase
4438 case "$ldflags" in
4439 '') if ./venix; then
4440                 dflt='-i -z'
4441         else
4442                 dflt=''
4443         fi
4444         case "$ccflags" in
4445         *-posix*) dflt="$dflt -posix" ;;
4446         esac
4447         ;;
4448 *) dflt="$ldflags";;
4449 esac
4450
4451 : Try to guess additional flags to pick up local libraries.
4452 for thislibdir in $libpth; do
4453         case " $loclibpth " in
4454         *" $thislibdir "*)
4455                 case "$dflt " in 
4456                 *"-L$thislibdir "*) ;;
4457                 *)  dflt="$dflt -L$thislibdir" ;;
4458                 esac
4459                 ;;
4460         esac
4461 done
4462
4463 case "$dflt" in
4464 '') dflt='none' ;;
4465 esac
4466
4467 $cat <<EOH
4468
4469 Your C linker may need flags.  For this question you should
4470 include -L/whatever and any other flags used by the C linker, but you
4471 should NOT include libraries like -lwhatever.
4472
4473 Make sure you include the appropriate -L/path flags if your C linker
4474 does not normally search all of the directories you specified above,
4475 namely
4476         $libpth
4477 To use no flags, specify the word "none".
4478
4479 EOH
4480
4481 rp="Any additional ld flags (NOT including libraries)?"
4482 . ./myread
4483 case "$ans" in
4484 none) ldflags='';;
4485 *) ldflags="$ans";;
4486 esac
4487 rmlist="$rmlist pdp11"
4488
4489 : coherency check
4490 echo " "
4491 echo "Checking your choice of C compiler and flags for coherency..." >&4
4492 $cat > try.c <<'EOF'
4493 #include <stdio.h>
4494 int main() { printf("Ok\n"); exit(0); }
4495 EOF
4496 set X $cc $optimize $ccflags -o try $ldflags try.c $libs
4497 shift
4498 $cat >try.msg <<'EOM'
4499 I've tried to compile and run the following simple program:
4500
4501 EOM
4502 $cat try.c >> try.msg
4503
4504 $cat >> try.msg <<EOM
4505
4506 I used the command:
4507
4508         $*
4509         ./try
4510
4511 and I got the following output:
4512
4513 EOM
4514 dflt=y
4515 if sh -c "$cc $optimize $ccflags -o try $ldflags try.c $libs" >>try.msg 2>&1; then
4516         if sh -c './try' >>try.msg 2>&1; then
4517                 xxx=`./try`
4518                 case "$xxx" in
4519                 "Ok") dflt=n ;;
4520                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
4521                         case " $libs " in
4522                         *" -lsfio "*)
4523                                 cat >> try.msg <<'EOQS'
4524 If $libs contains -lsfio, and sfio is mis-configured, then it
4525 sometimes (apparently) runs and exits with a 0 status, but with no
4526 output!  It may have to do with sfio's use of _exit vs. exit.
4527
4528 EOQS
4529                                 rp="You have a big problem.  Shall I abort Configure"
4530                                 dflt=y
4531                                 ;;
4532                         esac
4533                         ;;
4534                 esac
4535         else
4536                 echo "The program compiled OK, but exited with status $?." >>try.msg
4537                 rp="You have a problem.  Shall I abort Configure"
4538                 dflt=y
4539         fi
4540 else
4541         echo "I can't compile the test program." >>try.msg
4542         rp="You have a BIG problem.  Shall I abort Configure"
4543         dflt=y
4544 fi
4545 case "$dflt" in
4546 y)
4547         $cat try.msg >&4
4548         case "$knowitall" in
4549         '')
4550                 echo "(The supplied flags or libraries might be incorrect.)"
4551                 ;;
4552         *) dflt=n;;
4553         esac
4554         echo " "
4555         . ./myread
4556         case "$ans" in
4557         n*|N*) ;;
4558         *)      echo "Ok.  Stopping Configure." >&4
4559                 exit 1
4560                 ;;
4561         esac
4562         ;;
4563 n) echo "OK, that should do.";;
4564 esac
4565 $rm -f try try.* core
4566
4567 : determine filename position in cpp output
4568 echo " "
4569 echo "Computing filename position in cpp output for #include directives..." >&4
4570 echo '#include <stdio.h>' > foo.c
4571 $cat >fieldn <<EOF
4572 $startsh
4573 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
4574 $grep '^[       ]*#.*stdio\.h' | \
4575 while read cline; do
4576         pos=1
4577         set \$cline
4578         while $test \$# -gt 0; do
4579                 if $test -r \`echo \$1 | $tr -d '"'\`; then
4580                         echo "\$pos"
4581                         exit 0
4582                 fi
4583                 shift
4584                 pos=\`expr \$pos + 1\`
4585         done
4586 done
4587 EOF
4588 chmod +x fieldn
4589 fieldn=`./fieldn`
4590 $rm -f foo.c fieldn
4591 case $fieldn in
4592 '') pos='???';;
4593 1) pos=first;;
4594 2) pos=second;;
4595 3) pos=third;;
4596 *) pos="${fieldn}th";;
4597 esac
4598 echo "Your cpp writes the filename in the $pos field of the line."
4599
4600 : locate header file
4601 $cat >findhdr <<EOF
4602 $startsh
4603 wanted=\$1
4604 name=''
4605 for usrincdir in $usrinc
4606 do
4607         if test -f \$usrincdir/\$wanted; then
4608                 echo "\$usrincdir/\$wanted"
4609                 exit 0
4610         fi
4611 done
4612 awkprg='{ print \$$fieldn }'
4613 echo "#include <\$wanted>" > foo\$\$.c
4614 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
4615 $grep "^[       ]*#.*\$wanted" | \
4616 while read cline; do
4617         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
4618         case "\$name" in
4619         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
4620         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
4621         *) exit 2;;
4622         esac;
4623 done;
4624 #
4625 # status = 0: grep returned 0 lines, case statement not executed
4626 # status = 1: headerfile found
4627 # status = 2: while loop executed, no headerfile found
4628 #
4629 status=\$?
4630 $rm -f foo\$\$.c;
4631 if test \$status -eq 1; then
4632         exit 0;
4633 fi
4634 exit 1
4635 EOF
4636 chmod +x findhdr
4637
4638 : define an alternate in-header-list? function
4639 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
4640 cont=true; xxf="echo \"<\$1> found.\" >&4";
4641 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
4642 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
4643 esac;
4644 case $# in 4) instead=instead;; *) instead="at last";; esac;
4645 while $test "$cont"; do
4646         xxx=`./findhdr $1`
4647         var=$2; eval "was=\$$2";
4648         if $test "$xxx" && $test -r "$xxx";
4649         then eval $xxf;
4650         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
4651                 cont="";
4652         else eval $xxnf;
4653         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
4654         set $yyy; shift; shift; yyy=$@;
4655         case $# in 0) cont="";;
4656         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
4657                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
4658         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
4659                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
4660         esac;
4661 done;
4662 while $test "$yyy";
4663 do set $yyy; var=$2; eval "was=\$$2";
4664         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
4665         set $yyy; shift; shift; yyy=$@;
4666 done'
4667
4668 : see if this is a malloc.h system
4669 set malloc.h i_malloc
4670 eval $inhdr
4671
4672 : see if stdlib is available
4673 set stdlib.h i_stdlib
4674 eval $inhdr
4675
4676 : determine which malloc to compile in
4677 echo " "
4678 case "$usemymalloc" in
4679 ''|[yY]*|true|$define)  dflt='y' ;;
4680 *)      dflt='n' ;;
4681 esac
4682 rp="Do you wish to attempt to use the malloc that comes with $package?"
4683 . ./myread
4684 usemymalloc="$ans"
4685 case "$ans" in
4686 y*|true)
4687         usemymalloc='y'
4688         mallocsrc='malloc.c'
4689         mallocobj="malloc$_o"
4690         d_mymalloc="$define"
4691         case "$libs" in
4692         *-lmalloc*)
4693                 : Remove malloc from list of libraries to use
4694                 echo "Removing unneeded -lmalloc from library list" >&4
4695                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
4696                 shift
4697                 libs="$*"
4698                 echo "libs = $libs" >&4
4699                 ;;
4700         esac
4701         ;;
4702 *)
4703         usemymalloc='n'
4704         mallocsrc=''
4705         mallocobj=''
4706         d_mymalloc="$undef"
4707         ;;
4708 esac
4709
4710 : compute the return types of malloc and free
4711 echo " "
4712 $cat >malloc.c <<END
4713 #$i_malloc I_MALLOC
4714 #$i_stdlib I_STDLIB
4715 #include <stdio.h>
4716 #include <sys/types.h>
4717 #ifdef I_MALLOC
4718 #include <malloc.h>
4719 #endif
4720 #ifdef I_STDLIB
4721 #include <stdlib.h>
4722 #endif
4723 #ifdef TRY_MALLOC
4724 void *malloc();
4725 #endif
4726 #ifdef TRY_FREE
4727 void free();
4728 #endif
4729 END
4730 case "$malloctype" in
4731 '')
4732         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
4733                 malloctype='void *'
4734         else
4735                 malloctype='char *'
4736         fi
4737         ;;
4738 esac
4739 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
4740
4741 case "$freetype" in
4742 '')
4743         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
4744                 freetype='void'
4745         else
4746                 freetype='int'
4747         fi
4748         ;;
4749 esac
4750 echo "Your system uses $freetype free(), it would seem." >&4
4751 $rm -f malloc.[co]
4752 $cat <<EOM
4753
4754 The installation process will also create a directory for
4755 vendor-supplied add-ons.  Vendors who supply perl with their system
4756 may find it convenient to place all vendor-supplied files in this
4757 directory rather than in the main distribution directory.  This will
4758 ease upgrades between binary-compatible maintenance versions of perl.
4759
4760 Of course you may also use these directories in whatever way you see
4761 fit.  For example, you might use them to access modules shared over a
4762 company-wide network.
4763
4764 The default answer should be fine for most people.
4765 This causes further questions about vendor add-ons to be skipped
4766 and no vendor-specific directories will be configured for perl.
4767
4768 EOM
4769 rp='Do you want to configure vendor-specific add-on directories?'
4770 case "$usevendorprefix" in
4771 define|true|[yY]*) dflt=y ;;
4772 *) dflt=n ;;
4773 esac
4774 . ./myread
4775 case "$ans" in
4776 [yY]*)  fn=d~+
4777         rp='Installation prefix to use for vendor-supplied add-ons?'
4778         case "$vendorprefix" in
4779         '') dflt='' ;;
4780         *)  dflt=$vendorprefix ;;
4781         esac
4782         . ./getfile
4783         oldvendorprefix=''
4784         case "$vendorprefix" in
4785         '') ;;
4786         *)      case "$ans" in
4787                 "$prefix") ;;
4788                 *) oldvendorprefix="$prefix";;
4789                 esac
4790                 ;;
4791         esac
4792         usevendorprefix="$define"
4793         vendorprefix="$ans"
4794         vendorprefixexp="$ansexp"
4795         ;;
4796 *)      usevendorprefix="$undef"
4797         vendorprefix=''
4798         vendorprefixexp=''
4799         ;;
4800 esac
4801
4802 case "$vendorprefix" in
4803 '')     d_vendorlib="$undef"
4804         vendorlib=''
4805         vendorlibexp=''
4806         ;;
4807 *)      d_vendorlib="$define"
4808         : determine where vendor-supplied modules go.
4809         : Usual default is /usr/local/lib/perl5/vendor_perl
4810         prog=`echo $package | $sed 's/-*[0-9.]*$//'`
4811         case "$installstyle" in
4812         *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog ;;
4813         *)           dflt=$vendorprefix/lib/vendor_$prog ;;
4814         esac
4815         fn=d~+
4816         rp='Pathname for the vendor-supplied library files?'
4817         . ./getfile
4818         vendorlib="$ans"
4819         vendorlibexp="$ansexp"
4820         : Change installation prefix, if necessary.
4821         if $test X"$prefix" != X"$installprefix"; then
4822                 installvendorlib=`echo $vendorlibexp | $sed "s#^$prefix#$installprefix#"`
4823         else
4824                 installvendorlib="$vendorlibexp"
4825         fi
4826         ;;
4827 esac
4828
4829 : Cruising for prototypes
4830 echo " "
4831 echo "Checking out function prototypes..." >&4
4832 $cat >prototype.c <<'EOCP'
4833 int main(int argc, char *argv[]) {
4834         exit(0);}
4835 EOCP
4836 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
4837         echo "Your C compiler appears to support function prototypes."
4838         val="$define"
4839 else
4840         echo "Your C compiler doesn't seem to understand function prototypes."
4841         val="$undef"
4842 fi
4843 set prototype
4844 eval $setvar
4845 $rm -f prototype*
4846
4847 case "$prototype" in
4848 "$define") ;;
4849 *)      ansi2knr='ansi2knr'
4850         echo " "
4851         cat <<EOM >&4
4852
4853 $me:  FATAL ERROR:
4854 This version of $package can only be compiled by a compiler that 
4855 understands function prototypes.  Unfortunately, your C compiler 
4856         $cc $ccflags
4857 doesn't seem to understand them.  Sorry about that.
4858
4859 If GNU cc is available for your system, perhaps you could try that instead.  
4860
4861 Eventually, we hope to support building Perl with pre-ANSI compilers.
4862 If you would like to help in that effort, please contact <perlbug@perl.org>.
4863
4864 Aborting Configure now.
4865 EOM
4866         exit 2
4867         ;;
4868 esac
4869
4870 : determine where public executables go
4871 echo " "
4872 set dflt bin bin
4873 eval $prefixit
4874 fn=d~
4875 rp='Pathname where the public executables will reside?'
4876 . ./getfile
4877 if $test "X$ansexp" != "X$binexp"; then
4878         installbin=''
4879 fi
4880 bin="$ans"
4881 binexp="$ansexp"
4882 : Change installation prefix, if necessary.
4883 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
4884 if $test X"$prefix" != X"$installprefix"; then
4885         installbin=`echo $binexp | sed "s#^$prefix#$installprefix#"`
4886 else
4887         installbin="$binexp"
4888 fi
4889
4890 : determine whether to install perl also as /usr/bin/perl
4891
4892 echo " "
4893 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
4894         $cat <<EOM
4895 Many scripts expect to perl to be installed as /usr/bin/perl.
4896 I can install the perl you are about to compile also as /usr/bin/perl
4897 (in addition to $installbin/perl).
4898 EOM
4899         case "$installusrbinperl" in
4900         "$undef"|[nN]*) dflt='n';;
4901         *)              dflt='y';;
4902         esac
4903         rp="Do you want to install perl as /usr/bin/perl?"
4904         . ./myread
4905         case "$ans" in
4906         [yY]*)  val="$define";;
4907         *)      val="$undef" ;;
4908         esac
4909 else
4910         val="$undef"
4911 fi
4912 set installusrbinperl
4913 eval $setvar
4914
4915 : define a shorthand compile call
4916 compile='
4917 mc_file=$1;
4918 shift;
4919 $cc $optimize $ccflags $ldflags -o ${mc_file} $* ${mc_file}.c $libs > /dev/null 2>&1;'
4920 : define a shorthand compile call for compilations that should be ok.
4921 compile_ok='
4922 mc_file=$1;
4923 shift;
4924 $cc $optimize $ccflags $ldflags -o ${mc_file} $* ${mc_file}.c $libs;'
4925
4926 echo " "
4927 echo "Checking for GNU C Library..." >&4
4928 cat >gnulibc.c <<EOM
4929 #include <stdio.h>
4930 int main()
4931 {
4932 #ifdef __GLIBC__
4933     exit(0);
4934 #else
4935     exit(1);
4936 #endif
4937 }
4938 EOM
4939 set gnulibc
4940 if eval $compile_ok && ./gnulibc; then
4941         val="$define"
4942         echo "You are using the GNU C Library"
4943 else
4944         val="$undef"
4945         echo "You are not using the GNU C Library"
4946 fi
4947 $rm -f gnulibc*
4948 set d_gnulibc
4949 eval $setvar
4950
4951 : see if nm is to be used to determine whether a symbol is defined or not
4952 case "$usenm" in
4953 '')
4954         dflt=''
4955         case "$d_gnulibc" in
4956         "$define")
4957                 echo " "
4958                 echo "nm probably won't work on the GNU C Library." >&4
4959                 dflt=n
4960                 ;;
4961         esac
4962         case "$dflt" in
4963         '') 
4964                 if $test "$osname" = aix -a ! -f /lib/syscalls.exp; then
4965                         echo " "
4966                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
4967                         echo "'nm' won't be sufficient on this sytem." >&4
4968                         dflt=n
4969                 fi
4970                 ;;
4971         esac
4972         case "$dflt" in
4973         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
4974                 if $test $dflt -gt 20; then
4975                         dflt=y
4976                 else
4977                         dflt=n
4978                 fi
4979                 ;;
4980         esac
4981         ;;
4982 *)
4983         case "$usenm" in
4984         true|$define) dflt=y;;
4985         *) dflt=n;;
4986         esac
4987         ;;
4988 esac
4989 $cat <<EOM
4990
4991 I can use $nm to extract the symbols from your C libraries. This
4992 is a time consuming task which may generate huge output on the disk (up
4993 to 3 megabytes) but that should make the symbols extraction faster. The
4994 alternative is to skip the 'nm' extraction part and to compile a small
4995 test program instead to determine whether each symbol is present. If
4996 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
4997 this may be the best solution.
4998
4999 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
5000
5001 EOM
5002 rp="Shall I use $nm to extract C symbols from the libraries?"
5003 . ./myread
5004 case "$ans" in
5005 [Nn]*) usenm=false;;
5006 *) usenm=true;;
5007 esac
5008
5009 runnm=$usenm
5010 case "$reuseval" in
5011 true) runnm=false;;
5012 esac
5013
5014 : nm options which may be necessary
5015 case "$nm_opt" in
5016 '') if $test -f /mach_boot; then
5017                 nm_opt=''       # Mach
5018         elif $test -d /usr/ccs/lib; then
5019                 nm_opt='-p'     # Solaris (and SunOS?)
5020         elif $test -f /dgux; then
5021                 nm_opt='-p'     # DG-UX
5022         elif $test -f /lib64/rld; then
5023                 nm_opt='-p'     # 64-bit Irix
5024         else
5025                 nm_opt=''
5026         fi;;
5027 esac
5028
5029 : nm options which may be necessary for shared libraries but illegal
5030 : for archive libraries.  Thank you, Linux.
5031 case "$nm_so_opt" in
5032 '')     case "$myuname" in
5033         *linux*)
5034                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
5035                         nm_so_opt='--dynamic'
5036                 fi
5037                 ;;
5038         esac
5039         ;;
5040 esac
5041
5042 case "$runnm" in
5043 true)
5044 : get list of predefined functions in a handy place
5045 echo " "
5046 case "$libc" in
5047 '') libc=unknown
5048         case "$libs" in
5049         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
5050         esac
5051         ;;
5052 esac
5053 libnames='';
5054 case "$libs" in
5055 '') ;;
5056 *)  for thislib in $libs; do
5057         case "$thislib" in
5058         -lc|-lc_s)
5059                 : Handle C library specially below.
5060                 ;;
5061         -l*)
5062                 thislib=`echo $thislib | $sed -e 's/^-l//'`
5063                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
5064                         :
5065                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
5066                         :
5067                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
5068                         :
5069                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
5070                         :
5071                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
5072                         :
5073                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
5074                         :
5075                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
5076                         :
5077                 else
5078                         try=''
5079                 fi
5080                 libnames="$libnames $try"
5081                 ;;
5082         *) libnames="$libnames $thislib" ;;
5083         esac
5084         done
5085         ;;
5086 esac
5087 xxx=normal
5088 case "$libc" in
5089 unknown)
5090         set /lib/libc.$so
5091         for xxx in $libpth; do
5092                 $test -r $1 || set $xxx/libc.$so
5093                 : The messy sed command sorts on library version numbers.
5094                 $test -r $1 || \
5095                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
5096                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
5097                                 h
5098                                 s/[0-9][0-9]*/0000&/g
5099                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
5100                                 G
5101                                 s/\n/ /' | \
5102                          sort | $sed -e 's/^.* //'`
5103                 eval set \$$#
5104         done
5105         $test -r $1 || set /usr/ccs/lib/libc.$so
5106         $test -r $1 || set /lib/libsys_s$_a
5107         ;;
5108 *)
5109         set blurfl
5110         ;;
5111 esac
5112 if $test -r "$1"; then
5113         echo "Your (shared) C library seems to be in $1."
5114         libc="$1"
5115 elif $test -r /lib/libc && $test -r /lib/clib; then
5116         echo "Your C library seems to be in both /lib/clib and /lib/libc."
5117         xxx=apollo
5118         libc='/lib/clib /lib/libc'
5119         if $test -r /lib/syslib; then
5120                 echo "(Your math library is in /lib/syslib.)"
5121                 libc="$libc /lib/syslib"
5122         fi
5123 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5124         echo "Your C library seems to be in $libc, as you said before."
5125 elif $test -r $incpath/usr/lib/libc$_a; then
5126         libc=$incpath/usr/lib/libc$_a;
5127         echo "Your C library seems to be in $libc.  That's fine."
5128 elif $test -r /lib/libc$_a; then
5129         libc=/lib/libc$_a;
5130         echo "Your C library seems to be in $libc.  You're normal."
5131 else
5132         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
5133                 :
5134         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
5135                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
5136         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
5137                 :
5138         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5139                 :
5140         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5141                 :
5142         else
5143                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
5144         fi
5145         if $test -r "$tans"; then
5146                 echo "Your C library seems to be in $tans, of all places."
5147                 libc=$tans
5148         else
5149                 libc='blurfl'
5150         fi
5151 fi
5152 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5153         dflt="$libc"
5154         cat <<EOM
5155
5156 If the guess above is wrong (which it might be if you're using a strange
5157 compiler, or your machine supports multiple models), you can override it here.
5158
5159 EOM
5160 else
5161         dflt=''
5162         echo $libpth | tr ' ' $trnl | sort | uniq > libpath
5163         cat >&4 <<EOM
5164 I can't seem to find your C library.  I've looked in the following places:
5165
5166 EOM
5167         $sed 's/^/      /' libpath
5168         cat <<EOM
5169
5170 None of these seems to contain your C library. I need to get its name...
5171
5172 EOM
5173 fi
5174 fn=f
5175 rp='Where is your C library?'
5176 . ./getfile
5177 libc="$ans"
5178
5179 echo " "
5180 echo $libc $libnames | tr ' ' $trnl | sort | uniq > libnames
5181 set X `cat libnames`
5182 shift
5183 xxx=files
5184 case $# in 1) xxx=file; esac
5185 echo "Extracting names from the following $xxx for later perusal:" >&4
5186 echo " "
5187 $sed 's/^/      /' libnames >&4
5188 echo " "
5189 $echo $n "This may take a while...$c" >&4
5190
5191 for file in $*; do
5192         case $file in
5193         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
5194         *) $nm $nm_opt $file 2>/dev/null;;
5195         esac
5196 done >libc.tmp
5197
5198 $echo $n ".$c"
5199 $grep fprintf libc.tmp > libc.ptf
5200 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
5201 xrun='eval "<libc.tmp $com >libc.list"; echo "done" >&4'
5202 xxx='[ADTSIW]'
5203 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *_[_.]*//p' -e 's/^.* $xxx  *//p'";\
5204         eval $xscan;\
5205         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5206                 eval $xrun
5207 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
5208         eval $xscan;\
5209         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5210                 eval $xrun
5211 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
5212         eval $xscan;\
5213         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5214                 eval $xrun
5215 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
5216         eval $xscan;\
5217         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5218                 eval $xrun
5219 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
5220         eval $xscan;\
5221         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5222                 eval $xrun
5223 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
5224         eval $xscan;\
5225         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5226                 eval $xrun
5227 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
5228                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
5229         eval $xscan;\
5230         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5231                 eval $xrun
5232 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
5233         eval $xscan;\
5234         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5235                 eval $xrun
5236 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
5237         eval $xscan;\
5238         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5239                 eval $xrun
5240 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
5241         eval $xscan;\
5242         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5243                 eval $xrun
5244 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
5245         eval $xscan;\
5246         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5247                 eval $xrun
5248 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
5249         eval $xscan;\
5250         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5251                 eval $xrun
5252 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
5253         eval $xscan;\
5254         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5255                 eval $xrun
5256 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
5257         eval $xscan;\
5258         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5259                 eval $xrun
5260 else
5261         $nm -p $* 2>/dev/null >libc.tmp
5262         $grep fprintf libc.tmp > libc.ptf
5263         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
5264                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
5265         then
5266                 nm_opt='-p'
5267                 eval $xrun
5268         else
5269                 echo " "
5270                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
5271                 com=''
5272                 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
5273                         for thisname in $libnames $libc; do
5274                                 $ar t $thisname >>libc.tmp
5275                         done
5276                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
5277                         echo "Ok." >&4
5278                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
5279                         # Repeat libc to extract forwarders to DLL entries too
5280                         for thisname in $libnames $libc; do
5281                                 $ar tv $thisname >>libc.tmp
5282                                 # Revision 50 of EMX has bug in $ar.
5283                                 # it will not extract forwarders to DLL entries
5284                                 # Use emximp which will extract exactly them.
5285                                 emximp -o tmp.imp $thisname \
5286                                     2>/dev/null && \
5287                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
5288                                     < tmp.imp >>libc.tmp
5289                                 $rm tmp.imp
5290                         done
5291                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
5292                         echo "Ok." >&4
5293                 else
5294                         echo "$ar didn't seem to work right." >&4
5295                         echo "Maybe this is a Cray...trying bld instead..." >&4
5296                         if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
5297                         then
5298                                 for thisname in $libnames; do
5299                                         bld t $libnames | \
5300                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
5301                                         $ar t $thisname >>libc.tmp
5302                                 done
5303                                 echo "Ok." >&4
5304                         else
5305                                 echo "That didn't work either.  Giving up." >&4
5306                                 exit 1
5307                         fi
5308                 fi
5309         fi
5310 fi
5311 nm_extract="$com"
5312 if $test -f /lib/syscalls.exp; then
5313         echo " "
5314         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
5315         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*$/\1/p' /lib/syscalls.exp >>libc.list
5316 fi
5317 ;;
5318 esac
5319 $rm -f libnames libpath
5320
5321 : see if dld is available
5322 set dld.h i_dld
5323 eval $inhdr
5324
5325 : is a C symbol defined?
5326 csym='tlook=$1;
5327 case "$3" in
5328 -v) tf=libc.tmp; tc=""; tdc="";;
5329 -a) tf=libc.tmp; tc="[0]"; tdc="[]";;
5330 *) tlook="^$1\$"; tf=libc.list; tc="()"; tdc="()";;
5331 esac;
5332 tx=yes;
5333 case "$reuseval-$4" in
5334 true-) ;;
5335 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
5336 esac;
5337 case "$tx" in
5338 yes)
5339         case "$runnm" in
5340         true)
5341                 if $contains $tlook $tf >/dev/null 2>&1;
5342                 then tval=true;
5343                 else tval=false;
5344                 fi;;
5345         *)
5346                 echo "int main() { extern short $1$tdc; printf(\"%hd\", $1$tc); }" > t.c;
5347                 if $cc $optimize $ccflags $ldflags -o t t.c $libs >/dev/null 2>&1;
5348                 then tval=true;
5349                 else tval=false;
5350                 fi;
5351                 $rm -f t t.c;;
5352         esac;;
5353 *)
5354         case "$tval" in
5355         $define) tval=true;;
5356         *) tval=false;;
5357         esac;;
5358 esac;
5359 eval "$2=$tval"'
5360
5361 : define an is-in-libc? function
5362 inlibc='echo " "; td=$define; tu=$undef;
5363 sym=$1; var=$2; eval "was=\$$2";
5364 tx=yes;
5365 case "$reuseval$was" in
5366 true) ;;
5367 true*) tx=no;;
5368 esac;
5369 case "$tx" in
5370 yes)
5371         set $sym tres -f;
5372         eval $csym;
5373         case "$tres" in
5374         true)
5375                 echo "$sym() found." >&4;
5376                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
5377         *)
5378                 echo "$sym() NOT found." >&4;
5379                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
5380         esac;;
5381 *)
5382         case "$was" in
5383         $define) echo "$sym() found." >&4;;
5384         *) echo "$sym() NOT found." >&4;;
5385         esac;;
5386 esac'
5387
5388 : see if dlopen exists
5389 xxx_runnm="$runnm"
5390 runnm=false
5391 set dlopen d_dlopen
5392 eval $inlibc
5393 runnm="$xxx_runnm"
5394
5395 : determine which dynamic loading, if any, to compile in
5396 echo " "
5397 dldir="ext/DynaLoader"
5398 case "$usedl" in
5399 $define|y|true)
5400         dflt='y'
5401         usedl="$define"
5402         ;;
5403 $undef|n|false)
5404         dflt='n'
5405         usedl="$undef"
5406         ;;
5407 *) 
5408         dflt='n'
5409         case "$d_dlopen" in
5410             $define) dflt='y' ;;
5411         esac
5412         case "$i_dld" in
5413             $define) dflt='y' ;;
5414         esac
5415         : Does a dl_xxx.xs file exist for this operating system
5416         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
5417         ;;
5418 esac
5419 rp="Do you wish to use dynamic loading?"
5420 . ./myread
5421 usedl="$ans"
5422 case "$ans" in
5423 y*) usedl="$define"
5424         case "$dlsrc" in
5425         '')
5426                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
5427                         dflt="$dldir/dl_${osname}.xs"
5428                 elif $test "$d_dlopen" = "$define" ; then
5429                         dflt="$dldir/dl_dlopen.xs"
5430                 elif $test "$i_dld" = "$define" ; then
5431                         dflt="$dldir/dl_dld.xs"
5432                 else
5433                         dflt=''
5434                 fi
5435                 ;;
5436         *)      dflt="$dldir/$dlsrc"
5437                 ;;
5438         esac
5439     echo "The following dynamic loading files are available:"
5440         : Can not go over to $dldir because getfile has path hard-coded in.
5441         tdir=`pwd`; cd $rsrc; $ls -C $dldir/dl*.xs; cd $tdir
5442         rp="Source file to use for dynamic loading"
5443         fn="fne"
5444         gfpth="$src"
5445         . ./getfile
5446         usedl="$define"
5447         : emulate basename
5448         dlsrc=`echo $ans | $sed -e 's@.*/\([^/]*\)$@\1@'`
5449
5450         $cat << EOM
5451
5452 Some systems may require passing special flags to $cc -c to
5453 compile modules that will be used to create a shared library.
5454 To use no flags, say "none".
5455
5456 EOM
5457     case "$cccdlflags" in
5458     '') case "$gccversion" in
5459                 '') case "$osname" in
5460                         hpux)   dflt='+z' ;;
5461                         next)   dflt='none' ;;
5462                         irix*)  dflt='-KPIC' ;;
5463                         svr4*|esix*|solaris) dflt='-KPIC' ;;
5464                         sunos)  dflt='-pic' ;;
5465                         *)      dflt='none' ;;
5466                     esac
5467                         ;;
5468                 *)  case "$osname" in
5469                         svr4*|esix*|solaris) dflt='-fPIC' ;;
5470                         *)      dflt='-fpic' ;;
5471                     esac ;;
5472             esac ;;
5473         ' ') dflt='none' ;;
5474     *)  dflt="$cccdlflags" ;;
5475     esac
5476     rp="Any special flags to pass to $cc -c to compile shared library modules?"
5477     . ./myread
5478     case "$ans" in
5479     none) cccdlflags=' ' ;;
5480     *) cccdlflags="$ans" ;;
5481     esac
5482
5483     cat << EOM
5484
5485 Some systems use ld to create libraries that can be dynamically loaded,
5486 while other systems (such as those using ELF) use $cc.
5487
5488 EOM
5489         case "$ld" in
5490         '')     $cat >try.c <<'EOM'
5491 /* Test for whether ELF binaries are produced */
5492 #include <fcntl.h>
5493 #include <stdlib.h>
5494 int main() {
5495         char b[4];
5496         int i = open("a.out",O_RDONLY);
5497         if(i == -1) 
5498                 exit(1); /* fail */
5499         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
5500                 exit(0); /* succeed (yes, it's ELF) */
5501         else
5502                 exit(1); /* fail */
5503 }
5504 EOM
5505                 if $cc $ccflags try.c >/dev/null 2>&1 && ./a.out; then
5506                         cat <<EOM
5507 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
5508 EOM
5509                         dflt="$cc"
5510                 else
5511                         echo "I'll use ld to build dynamic libraries."
5512                         dflt='ld'
5513                 fi
5514                 rm -f try.c a.out
5515                 ;;
5516         *)      dflt="$ld"
5517                 ;;
5518         esac
5519
5520     rp="What command should be used to create dynamic libraries?"
5521     . ./myread
5522         ld="$ans"
5523
5524     cat << EOM
5525
5526 Some systems may require passing special flags to $ld to create a
5527 library that can be dynamically loaded.  If your ld flags include
5528 -L/other/path options to locate libraries outside your loader's normal
5529 search path, you may need to specify those -L options here as well.  To
5530 use no flags, say "none".
5531
5532 EOM
5533     case "$lddlflags" in
5534     '') case "$osname" in
5535                         beos) dflt='-nostart' ;;
5536                         hpux)  dflt='-b' ;;
5537                         linux|irix*)    dflt='-shared' ;;
5538                         next)  dflt='none' ;;
5539                         solaris) dflt='-G' ;;
5540                         sunos) dflt='-assert nodefinitions' ;;
5541                         svr4*|esix*) dflt="-G $ldflags" ;;
5542                 *)     dflt='none' ;;
5543                         esac
5544                         ;;
5545     *) dflt="$lddlflags" ;;
5546     esac
5547
5548         : Try to guess additional flags to pick up local libraries.
5549         : Be careful not to append to a plain 'none'
5550         case "$dflt" in
5551         none) dflt='' ;;
5552         esac
5553         for thisflag in $ldflags; do
5554                 case "$thisflag" in
5555                 -L*)
5556                         case " $dflt " in
5557                         *" $thisflag "*) ;;
5558                         *) dflt="$dflt $thisflag" ;;
5559                         esac
5560                         ;;
5561                 esac
5562         done
5563
5564         case "$dflt" in
5565         ''|' ') dflt='none' ;;
5566         esac
5567
5568     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
5569     . ./myread
5570     case "$ans" in
5571     none) lddlflags=' ' ;;
5572     *) lddlflags="$ans" ;;
5573     esac
5574
5575         cat <<EOM
5576
5577 Some systems may require passing special flags to $cc to indicate that
5578 the resulting executable will use dynamic linking.  To use no flags,
5579 say "none".
5580
5581 EOM
5582     case "$ccdlflags" in
5583     '') case "$osname" in
5584                 hpux)   dflt='-Wl,-E' ;;
5585                 linux)  dflt='-rdynamic' ;;
5586                 next)   dflt='none' ;;
5587                 sunos)  dflt='none' ;;
5588                 *)      dflt='none' ;;
5589             esac ;;
5590     ' ')  dflt='none' ;;
5591     *)  dflt="$ccdlflags" ;;
5592     esac
5593     rp="Any special flags to pass to $cc to use dynamic loading?"
5594     . ./myread
5595     case "$ans" in
5596     none) ccdlflags=' ' ;;
5597     *) ccdlflags="$ans" ;;
5598     esac
5599     ;;
5600 *)  usedl="$undef"
5601         ld='ld'
5602     dlsrc='dl_none.xs'
5603     lddlflags=''
5604     ccdlflags=''
5605     ;;
5606 esac
5607
5608 also=''
5609 case "$usedl" in
5610 $undef)
5611         # No dynamic loading being used, so don't bother even to prompt.
5612         useshrplib='false'
5613         ;;
5614 *)      case "$useshrplib" in
5615         '')     case "$osname" in
5616                 svr4*|dgux|dynixptx|esix|powerux|beos)
5617                         dflt=y
5618                         also='Building a shared libperl is required for dynamic loading to work on your system.'
5619                         ;;
5620                 next*)
5621                         case "$osvers" in
5622                         4*)     dflt=y
5623                                 also='Building a shared libperl is needed for MAB support.'
5624                                 ;;
5625                         *)      dflt=n
5626                                 ;;
5627                         esac
5628                         ;;
5629                 *)      dflt=n
5630                         ;;
5631                 esac
5632                 ;;
5633         $define|true|[Yy]*)
5634                 dflt=y
5635                 ;;
5636         *)      dflt=n
5637                 ;;
5638         esac
5639         $cat << EOM
5640
5641 The perl executable is normally obtained by linking perlmain.c with
5642 libperl${_a}, any static extensions (usually just DynaLoader), and
5643 any other libraries needed on this system (such as -lm, etc.).  Since
5644 your system supports dynamic loading, it is probably possible to build
5645 a shared libperl.$so.  If you will have more than one executable linked
5646 to libperl.$so, this will significantly reduce the size of each
5647 executable, but it may have a noticeable affect on performance.  The
5648 default is probably sensible for your system.
5649 $also
5650
5651 EOM
5652         rp="Build a shared libperl.$so (y/n)"
5653         . ./myread
5654         case "$ans" in
5655         true|$define|[Yy]*)
5656                 useshrplib='true'  ;;
5657         *)      useshrplib='false' ;;
5658         esac
5659         ;;
5660 esac
5661
5662 case "$useshrplib" in
5663 true)
5664         case "$libperl" in
5665         '')
5666                 # Figure out a good name for libperl.so.  Since it gets stored in
5667                 # a version-specific architecture-dependent library, the version
5668                 # number isn't really that important, except for making cc/ld happy.
5669                 #
5670                 # A name such as libperl.so.3.1
5671                 majmin="libperl.$so.$patchlevel.$subversion"
5672                 # A name such as libperl.so.301
5673                 majonly=`echo $patchlevel $subversion |
5674                         $awk '{printf "%d%02d", $1, $2}'`
5675                 majonly=libperl.$so.$majonly
5676                 # I'd prefer to keep the os-specific stuff here to a minimum, and
5677                 # rely on figuring it out from the naming of libc.
5678                 case "${osname}${osvers}" in
5679                 next4*)
5680                         dflt=libperl.5.$so
5681                         # XXX How handle the --version stuff for MAB?
5682                         ;;
5683                 linux*)  # ld won't link with a bare -lperl otherwise.
5684                         dflt=libperl.$so
5685                         ;;
5686                 *)      # Try to guess based on whether libc has major.minor.
5687                         case "$libc" in
5688                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
5689                         *libc.$so.[0-9]*) dflt=$majonly ;;
5690                         *)      dflt=libperl.$so ;;
5691                         esac
5692                         ;;
5693                 esac
5694                 ;;
5695         *)      dflt=$libperl
5696                 ;;
5697         esac
5698         cat << EOM
5699
5700 I need to select a good name for the shared libperl.  If your system uses
5701 library names with major and minor numbers, then you might want something
5702 like $majmin.  Alternatively, if your system uses a single version
5703 number for shared libraries, then you might want to use $majonly.
5704 Or, your system might be quite happy with a simple libperl.$so.
5705
5706 Since the shared libperl will get installed into a version-specific
5707 architecture-dependent directory, the version number of the shared perl
5708 library probably isn't important, so the default should be o.k.
5709
5710 EOM
5711         rp='What name do you want to give to the shared libperl?'
5712         . ./myread
5713         libperl=$ans
5714         echo "Ok, I'll use $libperl"
5715         ;;
5716 *)
5717         libperl="libperl${_a}"
5718         ;;
5719 esac
5720
5721 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
5722 case "$shrpdir" in
5723 '') ;;
5724 *)      $cat >&4 <<EOM
5725 WARNING:  Use of the shrpdir variable for the installation location of
5726 the shared $libperl is not supported.  It was never documented and
5727 will not work in this version.  Let me (perlbug@perl.com)
5728 know of any problems this may cause.
5729
5730 EOM
5731         case "$shrpdir" in
5732         "$archlibexp/CORE")
5733                 $cat >&4 <<EOM
5734 But your current setting of $shrpdir is
5735 the default anyway, so it's harmless.
5736 EOM
5737                 ;;
5738         *)
5739                 $cat >&4 <<EOM
5740 Further, your current attempted setting of $shrpdir
5741 conflicts with the value of $archlibexp/CORE
5742 that installperl will use.
5743 EOM
5744                 ;;
5745         esac
5746         ;;
5747 esac
5748
5749 # How will the perl executable find the installed shared $libperl?
5750 # Add $xxx to ccdlflags.
5751 # If we can't figure out a command-line option, use $shrpenv to
5752 # set env LD_RUN_PATH.  The main perl makefile uses this.
5753 shrpdir=$archlibexp/CORE
5754 xxx=''
5755 tmp_shrpenv=''
5756 if "$useshrplib"; then
5757     case "$osname" in 
5758         aix)
5759                 # We'll set it in Makefile.SH...
5760                 ;;
5761         solaris|netbsd)
5762                 xxx="-R $shrpdir"
5763                 ;;
5764         freebsd)
5765                 xxx="-Wl,-R$shrpdir"
5766                 ;;
5767         linux|irix*|dec_osf)
5768                 xxx="-Wl,-rpath,$shrpdir"
5769                 ;;
5770         next)
5771                 # next doesn't like the default...
5772                 ;;
5773         beos)
5774                 # beos doesn't like the default, either.
5775                 ;;
5776         hpux*)
5777                 # hpux doesn't like the default, either.
5778                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
5779                 ;;
5780         *)
5781                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
5782                 ;;
5783         esac
5784         case "$xxx" in
5785         '') ;;
5786         *)      
5787                 # Only add $xxx if it isn't already in ccdlflags.
5788                 case " $ccdlflags " in
5789                 *" $xxx "*)     ;;
5790                 *)      ccdlflags="$ccdlflags $xxx"
5791                         cat <<EOM >&4
5792
5793 Adding $xxx to the flags
5794 passed to $ld so that the perl executable will find the 
5795 installed shared $libperl.
5796
5797 EOM
5798                         ;;
5799                 esac
5800                 ;;
5801         esac
5802 fi
5803 # Fix ccdlflags in AIX for building external extensions.
5804 # (For building Perl itself bare -bE:perl.exp is needed,
5805 #  Makefile.SH takes care of this.)
5806 case "$osname" in
5807 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
5808 esac
5809 # Respect a hint or command-line value.
5810 case "$shrpenv" in
5811 '') shrpenv="$tmp_shrpenv" ;;
5812 esac
5813 case "$ldlibpthname" in
5814 '')     ldlibpthname=LD_LIBRARY_PATH ;;
5815 none)   ldlibpthname='' ;;
5816 esac
5817
5818 : determine where manual pages go
5819 set man1dir man1dir none
5820 eval $prefixit
5821 $cat <<EOM
5822
5823 $spackage has manual pages available in source form.
5824 EOM
5825 case "$nroff" in
5826 nroff)
5827         echo "However, you don't have nroff, so they're probably useless to you."
5828         case "$man1dir" in
5829         '') man1dir="none";;
5830         esac;;
5831 esac
5832 echo "If you don't want the manual sources installed, answer 'none'."
5833 case "$man1dir" in
5834 ' ') dflt=none
5835         ;;
5836 '')
5837         lookpath="$prefixexp/man/man1 $prefixexp/man/l_man/man1"
5838         lookpath="$lookpath $prefixexp/man/p_man/man1"
5839         lookpath="$lookpath $prefixexp/man/u_man/man1"
5840         lookpath="$lookpath $prefixexp/man/man.1"
5841         case "$sysman" in
5842         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
5843         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
5844         esac
5845         set dflt
5846         eval $prefixup
5847         ;;
5848 *)  dflt="$man1dir"
5849         ;;
5850 esac
5851 echo " "
5852 fn=dn+~
5853 rp="Where do the main $spackage manual pages (source) go?"
5854 . ./getfile
5855 if $test "X$man1direxp" != "X$ansexp"; then
5856         installman1dir=''
5857 fi
5858 man1dir="$ans"
5859 man1direxp="$ansexp"
5860 case "$man1dir" in
5861 '')     man1dir=' '
5862         installman1dir='';;
5863 esac
5864
5865 : Change installation prefix, if necessary.
5866 if $test X"$prefix" != X"$installprefix"; then
5867         installman1dir=`echo $man1direxp | $sed "s#^$prefix#$installprefix#"`
5868 else
5869         installman1dir="$man1direxp"
5870 fi
5871
5872 : What suffix to use on installed man pages
5873
5874 case "$man1dir" in
5875 ' ')
5876         man1ext='0'
5877         ;;
5878 *)
5879         rp="What suffix should be used for the main $spackage man pages?"
5880         case "$man1ext" in
5881         '')     case "$man1dir" in
5882                 *1)  dflt=1 ;;
5883                 *1p) dflt=1p ;;
5884                 *1pm) dflt=1pm ;;
5885                 *l) dflt=l;;
5886                 *n) dflt=n;;
5887                 *o) dflt=o;;
5888                 *p) dflt=p;;
5889                 *C) dflt=C;;
5890                 *L) dflt=L;;
5891                 *L1) dflt=L1;;
5892                 *) dflt=1;;
5893                 esac
5894                 ;;
5895         *)      dflt="$man1ext";;
5896         esac
5897         . ./myread
5898         man1ext="$ans"
5899         ;;
5900 esac
5901
5902 : see if we can have long filenames
5903 echo " "
5904 rmlist="$rmlist /tmp/cf$$"
5905 $test -d /tmp/cf$$ || mkdir /tmp/cf$$
5906 first=123456789abcdef
5907 second=/tmp/cf$$/$first
5908 $rm -f $first $second
5909 if (echo hi >$first) 2>/dev/null; then
5910         if $test -f 123456789abcde; then
5911                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
5912                 val="$undef"
5913         else
5914                 if (echo hi >$second) 2>/dev/null; then
5915                         if $test -f /tmp/cf$$/123456789abcde; then
5916                                 $cat <<'EOM'
5917 That's peculiar... You can have filenames longer than 14 characters, but only
5918 on some of the filesystems.  Maybe you are using NFS.  Anyway, to avoid problems
5919 I shall consider your system cannot support long filenames at all.
5920 EOM
5921                                 val="$undef"
5922                         else
5923                                 echo 'You can have filenames longer than 14 characters.' >&4
5924                                 val="$define"
5925                         fi
5926                 else
5927                         $cat <<'EOM'
5928 How confusing! Some of your filesystems are sane enough to allow filenames
5929 longer than 14 characters but some others like /tmp can't even think about them.
5930 So, for now on, I shall assume your kernel does not allow them at all.
5931 EOM
5932                         val="$undef"
5933                 fi
5934         fi
5935 else
5936         $cat <<'EOM'
5937 You can't have filenames longer than 14 chars.  You can't even think about them!
5938 EOM
5939         val="$undef"
5940 fi 
5941 set d_flexfnam
5942 eval $setvar
5943 $rm -rf /tmp/cf$$ 123456789abcde*
5944
5945 : determine where library module manual pages go
5946 set man3dir man3dir none
5947 eval $prefixit
5948 $cat <<EOM
5949
5950 $spackage has manual pages for many of the library modules.
5951 EOM
5952
5953 case "$nroff" in
5954 nroff)
5955         $cat <<'EOM'
5956 However, you don't have nroff, so they're probably useless to you.
5957 EOM
5958         case "$man3dir" in
5959         '') man3dir="none";;
5960         esac;;
5961 esac
5962
5963 case "$d_flexfnam" in
5964 undef)
5965         $cat <<'EOM'
5966 However, your system can't handle the long file names like File::Basename.3. 
5967 EOM
5968         case "$man3dir" in
5969         '') man3dir="none";;
5970         esac;;
5971 esac
5972
5973 echo "If you don't want the manual sources installed, answer 'none'."
5974 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
5975 case "$man3dir" in
5976 '')     dflt=`echo $man1dir | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
5977         if $test -d "$privlib/man/man3"; then
5978                 cat <<EOM >&4
5979
5980 WARNING:  Previous versions of perl installed man3 pages into
5981 $privlib/man/man3.  This version will suggest a 
5982 new default of $dflt.  
5983 EOM
5984                 tdflt=$dflt
5985                 dflt='n'
5986                 rp='Do you wish to preserve the old behavior?(y/n)'
5987                 . ./myread
5988                 case "$ans" in
5989                 y*) dflt="$privlib/man/man3" ;;
5990                 *)  dflt=$tdflt ;;
5991                 esac
5992     fi
5993         ;;
5994 ' ') dflt=none;;
5995 *)      dflt="$man3dir" ;;
5996 esac
5997 echo " "
5998 fn=dn+~
5999 rp="Where do the $package library man pages (source) go?"
6000 . ./getfile
6001 man3dir="$ans"
6002 man3direxp="$ansexp"
6003 case "$man1dir" in
6004 '')     man3dir=' '
6005         installman3dir='';;
6006 esac
6007
6008 : Change installation prefix, if necessary.
6009 if $test X"$prefix" != X"$installprefix"; then
6010         installman3dir=`echo $man3direxp | $sed "s#^$prefix#$installprefix#"`
6011 else
6012         installman3dir="$man3direxp"
6013 fi
6014
6015 : What suffix to use on installed man pages
6016 case "$man3dir" in
6017 ' ')
6018         man3ext='0'
6019         ;;
6020 *)
6021         rp="What suffix should be used for the $package library man pages?"
6022         case "$man3ext" in
6023         '')     case "$man3dir" in
6024                 *3)  dflt=3 ;;
6025                 *3p) dflt=3p ;;
6026                 *3pm) dflt=3pm ;;
6027                 *l) dflt=l;;
6028                 *n) dflt=n;;
6029                 *o) dflt=o;;
6030                 *p) dflt=p;;
6031                 *C) dflt=C;;
6032                 *L) dflt=L;;
6033                 *L3) dflt=L3;;
6034                 *) dflt=3;;
6035                 esac
6036                 ;;
6037         *)      dflt="$man3ext";;
6038         esac
6039         . ./myread
6040         man3ext="$ans"
6041         ;;
6042 esac
6043
6044 : see if we have to deal with yellow pages, now NIS.
6045 if $test -d /usr/etc/yp || $test -d /etc/yp; then
6046         if $test -f /usr/etc/nibindd; then
6047                 echo " "
6048                 echo "I'm fairly confident you're on a NeXT."
6049                 echo " "
6050                 rp='Do you get the hosts file via NetInfo?'
6051                 dflt=y
6052                 case "$hostcat" in
6053                 nidump*) ;;
6054                 '') ;;
6055                 *) dflt=n;;
6056                 esac
6057                 . ./myread
6058                 case "$ans" in
6059                 y*) hostcat='nidump hosts .';;
6060                 *)      case "$hostcat" in
6061                         nidump*) hostcat='';;
6062                         esac
6063                         ;;
6064                 esac
6065         fi
6066         case "$hostcat" in
6067         nidump*) ;;
6068         *)
6069                 case "$hostcat" in
6070                 *ypcat*) dflt=y;;
6071                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
6072                                 dflt=y
6073                         else
6074                                 dflt=n
6075                         fi;;
6076                 *) dflt=n;;
6077                 esac
6078                 echo " "
6079                 rp='Are you getting the hosts file via yellow pages?'
6080                 . ./myread
6081                 case "$ans" in
6082                 y*) hostcat='ypcat hosts';;
6083                 *) hostcat='cat /etc/hosts';;
6084                 esac
6085                 ;;
6086         esac
6087 fi
6088 case "$hostcat" in
6089 '') hostcat='cat /etc/hosts';;
6090 esac
6091 case "$groupcat" in
6092 '') groupcat='cat /etc/group';;
6093 esac
6094 case "$passcat" in
6095 '') passcat='cat /etc/passwd';;
6096 esac
6097
6098 : now get the host name
6099 echo " "
6100 echo "Figuring out host name..." >&4
6101 case "$myhostname" in
6102 '') cont=true
6103         echo 'Maybe "hostname" will work...'
6104         if tans=`sh -c hostname 2>&1` ; then
6105                 myhostname=$tans
6106                 phostname=hostname
6107                 cont=''
6108         fi
6109         ;;
6110 *) cont='';;
6111 esac
6112 if $test "$cont"; then
6113         if ./xenix; then
6114                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
6115                 if tans=`cat /etc/systemid 2>&1` ; then
6116                         myhostname=$tans
6117                         phostname='cat /etc/systemid'
6118                         echo "Whadyaknow.  Xenix always was a bit strange..."
6119                         cont=''
6120                 fi
6121         elif $test -r /etc/systemid; then
6122                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
6123         fi
6124 fi
6125 if $test "$cont"; then
6126         echo 'No, maybe "uuname -l" will work...'
6127         if tans=`sh -c 'uuname -l' 2>&1` ; then
6128                 myhostname=$tans
6129                 phostname='uuname -l'
6130         else
6131                 echo 'Strange.  Maybe "uname -n" will work...'
6132                 if tans=`sh -c 'uname -n' 2>&1` ; then
6133                         myhostname=$tans
6134                         phostname='uname -n'
6135                 else
6136                         echo 'Oh well, maybe I can mine it out of whoami.h...'
6137                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
6138                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
6139                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
6140                         else
6141                                 case "$myhostname" in
6142                                 '') echo "Does this machine have an identity crisis or something?"
6143                                         phostname='';;
6144                                 *)
6145                                         echo "Well, you said $myhostname before..."
6146                                         phostname='echo $myhostname';;
6147                                 esac
6148                         fi
6149                 fi
6150         fi
6151 fi
6152 : you do not want to know about this
6153 set $myhostname
6154 myhostname=$1
6155
6156 : verify guess
6157 if $test "$myhostname" ; then
6158         dflt=y
6159         rp='Your host name appears to be "'$myhostname'".'" Right?"
6160         . ./myread
6161         case "$ans" in
6162         y*) ;;
6163         *) myhostname='';;
6164         esac
6165 fi
6166
6167 : bad guess or no guess
6168 while $test "X$myhostname" = X ; do
6169         dflt=''
6170         rp="Please type the (one word) name of your host:"
6171         . ./myread
6172         myhostname="$ans"
6173 done
6174
6175 : translate upper to lower if necessary
6176 case "$myhostname" in
6177 *[A-Z]*)
6178         echo "(Normalizing case in your host name)"
6179         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
6180         ;;
6181 esac
6182
6183 case "$myhostname" in
6184 *.*)
6185         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
6186         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
6187         echo "(Trimming domain name from host name--host name is now $myhostname)"
6188         ;;
6189 *) case "$mydomain" in
6190         '')
6191                 {
6192                         test "X$hostcat" = "Xypcat hosts" &&
6193                         ypmatch "$myhostname" hosts 2>/dev/null |\
6194                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
6195                         $test -s hosts
6196                 } || {
6197                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
6198                                         /[       ]$myhostname[  . ]/p" > hosts
6199                 }
6200                 tmp_re="[       . ]"
6201                 $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
6202                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
6203                 dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
6204                         hosts | $sort | $uniq | \
6205                         $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
6206                 case `$echo X$dflt` in
6207                 X*\ *)  echo "(Several hosts in /etc/hosts matched hostname)"
6208                         dflt=.
6209                         ;;
6210                 X.) echo "(You do not have fully-qualified names in /etc/hosts)"
6211                         ;;
6212                 esac
6213                 case "$dflt" in
6214                 .)
6215                         tans=`./loc resolv.conf X /etc /usr/etc`
6216                         if $test -f "$tans"; then
6217                                 echo "(Attempting domain name extraction from $tans)"
6218                                 dflt=.`$sed -n -e 's/   / /g' \
6219                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
6220                                   | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
6221                                 case "$dflt" in
6222                                 .) dflt=.`$sed -n -e 's/        / /g' \
6223                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
6224                                      | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
6225                                         ;;
6226                                 esac
6227                         fi
6228                         ;;
6229                 esac
6230                 case "$dflt" in
6231                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
6232                         dflt=.`sh -c domainname 2>/dev/null`
6233                         case "$dflt" in
6234                         '') dflt='.';;
6235                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
6236                         esac
6237                         ;;
6238                 esac
6239                 case "$dflt" in
6240                 .) echo "(Lost all hope -- silly guess then)"
6241                         dflt='.uucp'
6242                         ;;
6243                 esac
6244                 $rm -f hosts
6245                 ;;
6246         *) dflt="$mydomain";;
6247         esac;;
6248 esac
6249 echo " "
6250 rp="What is your domain name?"
6251 . ./myread
6252 tans="$ans"
6253 case "$ans" in
6254 '') ;;
6255 .*) ;;
6256 *) tans=".$tans";;
6257 esac
6258 mydomain="$tans"
6259
6260 : translate upper to lower if necessary
6261 case "$mydomain" in
6262 *[A-Z]*)
6263         echo "(Normalizing case in your domain name)"
6264         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
6265         ;;
6266 esac
6267
6268 : a little sanity check here
6269 case "$phostname" in
6270 '') ;;
6271 *)
6272         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
6273         $myhostname$mydomain|$myhostname) ;;
6274         *)
6275                 case "$phostname" in
6276                 sed*)
6277                         echo "(That doesn't agree with your whoami.h file, by the way.)"
6278                         ;;
6279                 *)
6280                         echo "(That doesn't agree with your $phostname command, by the way.)"
6281                         ;;
6282                 esac
6283         ;;
6284         esac
6285         ;;
6286 esac
6287
6288 $cat <<EOM
6289
6290 I need to get your e-mail address in Internet format if possible, i.e.
6291 something like user@host.domain. Please answer accurately since I have
6292 no easy means to double check it. The default value provided below
6293 is most probably close to the reality but may not be valid from outside
6294 your organization...
6295
6296 EOM
6297 cont=x
6298 while test "$cont"; do
6299         case "$cf_email" in
6300         '') dflt="$cf_by@$myhostname$mydomain";;
6301         *) dflt="$cf_email";;
6302         esac
6303         rp='What is your e-mail address?'
6304         . ./myread
6305         cf_email="$ans"
6306         case "$cf_email" in
6307         *@*.*) cont='' ;;
6308         *)
6309                 rp='Address does not look like an Internet one.  Use it anyway?'
6310                 case "$fastread" in
6311                 yes) dflt=y ;;
6312                 *) dflt=n ;;
6313                 esac
6314                 . ./myread
6315                 case "$ans" in
6316                 y*) cont='' ;;
6317                 *) echo " " ;;
6318                 esac
6319                 ;;
6320         esac
6321 done
6322
6323 $cat <<EOM
6324
6325 If you or somebody else will be maintaining perl at your site, please
6326 fill in the correct e-mail address here so that they may be contacted
6327 if necessary. Currently, the "perlbug" program included with perl
6328 will send mail to this address in addition to perlbug@perl.com. You may
6329 enter "none" for no administrator.
6330
6331 EOM
6332 case "$perladmin" in
6333 '') dflt="$cf_email";;
6334 *) dflt="$perladmin";;
6335 esac
6336 rp='Perl administrator e-mail address'
6337 . ./myread
6338 perladmin="$ans"
6339
6340 : figure out how to guarantee perl startup
6341 case "$startperl" in
6342 '')
6343         case "$sharpbang" in
6344         *!)
6345                 $cat <<EOH
6346
6347 I can use the #! construct to start perl on your system. This will
6348 make startup of perl scripts faster, but may cause problems if you
6349 want to share those scripts and perl is not in a standard place
6350 ($binexp/perl) on all your platforms. The alternative is to force
6351 a shell by starting the script with a single ':' character.
6352
6353 EOH
6354                 dflt="$binexp/perl"
6355                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
6356                 . ./myread
6357                 case "$ans" in
6358                 none)   startperl=": # use perl";;
6359                 *)      startperl="#!$ans"
6360                         if $test 30 -lt `echo "$ans" | wc -c`; then
6361                                 $cat >&4 <<EOM
6362
6363 WARNING:  Some systems limit the #! command to 32 characters.
6364 If you experience difficulty running Perl scripts with #!, try
6365 installing Perl in a directory with a shorter pathname.
6366
6367 EOM
6368                         fi ;;
6369                 esac
6370                 ;;
6371         *) startperl=": # use perl"
6372                 ;;
6373         esac
6374         ;;
6375 esac
6376 echo "I'll use $startperl to start perl scripts."
6377
6378 : figure best path for perl in scripts
6379 case "$perlpath" in
6380 '')
6381         perlpath="$binexp/perl"
6382         case "$startperl" in
6383         *!*) ;;
6384         *)
6385                 $cat <<EOH
6386
6387 I will use the "eval 'exec'" idiom to start Perl on your system.
6388 I can use the full path of your Perl binary for this purpose, but
6389 doing so may cause problems if you want to share those scripts and
6390 Perl is not always in a standard place ($binexp/perl).
6391
6392 EOH
6393                 dflt="$binexp/perl"
6394                 rp="What path shall I use in \"eval 'exec'\"?"
6395                 . ./myread
6396                 perlpath="$ans"
6397                 ;;
6398         esac
6399         ;;
6400 esac
6401 case "$startperl" in
6402 *!*)    ;;
6403 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
6404 esac
6405
6406 : determine where public executable scripts go
6407 set scriptdir scriptdir
6408 eval $prefixit
6409 case "$scriptdir" in
6410 '')
6411         dflt="$bin"
6412         : guess some guesses
6413         $test -d /usr/share/scripts && dflt=/usr/share/scripts
6414         $test -d /usr/share/bin     && dflt=/usr/share/bin
6415         $test -d /usr/local/script  && dflt=/usr/local/script
6416         $test -d /usr/local/scripts && dflt=/usr/local/scripts
6417         $test -d $prefixexp/script  && dflt=$prefixexp/script
6418         set dflt
6419         eval $prefixup
6420         ;;
6421 *)  dflt="$scriptdir"
6422         ;;
6423 esac
6424 $cat <<EOM
6425  
6426 Some installations have a separate directory just for executable scripts so
6427 that they can mount it across multiple architectures but keep the scripts in
6428 one spot.  You might, for example, have a subdirectory of /usr/share for this.
6429 Or you might just lump your scripts in with all your other executables.
6430  
6431 EOM
6432 fn=d~
6433 rp='Where do you keep publicly executable scripts?'
6434 . ./getfile
6435 if $test "X$ansexp" != "X$scriptdirexp"; then
6436         installscript=''
6437 fi
6438 scriptdir="$ans"
6439 scriptdirexp="$ansexp"
6440 : Change installation prefix, if necessary.
6441 if $test X"$prefix" != X"$installprefix"; then
6442         installscript=`echo $scriptdirexp | sed "s#^$prefix#$installprefix#"`
6443 else
6444         installscript="$scriptdirexp"
6445 fi
6446
6447 $cat <<EOM
6448
6449 After $package is installed, you may wish to install various
6450 add-on modules and utilities.  Typically, these add-ons will
6451 be installed under $prefix with the rest
6452 of this package.  However, you may wish to install such add-ons
6453 elsewhere under a different prefix.
6454
6455 If you do not wish to put everything under a single prefix, that's
6456 ok.  You will be prompted for the individual locations; this siteprefix
6457 is only used to suggest the defaults.
6458
6459 The default should be fine for most people.
6460
6461 EOM
6462 fn=d~+
6463 rp='Installation prefix to use for add-on modules and utilities?'
6464 : XXX Here might be another good place for an installstyle setting.
6465 case "$siteprefix" in
6466 '') dflt=$prefix ;;
6467 *)  dflt=$siteprefix ;;
6468 esac
6469 . ./getfile
6470 oldsiteprefix=''
6471 case "$siteprefix" in
6472 '') ;;
6473 *)
6474         case "$ans" in
6475         "$prefix") ;;
6476         *) oldsiteprefix="$prefix";;
6477         esac
6478         ;;
6479 esac
6480 siteprefix="$ans"
6481 siteprefixexp="$ansexp"
6482
6483 : determine where site specific libraries go.
6484 : Usual default is /usr/local/lib/perl5/site_perl
6485 : The default "style" setting is made in installstyle.U
6486 : XXX No longer works with Prefixit stuff.
6487 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6488 case "$installstyle" in
6489 *lib/perl5*) dflt=$siteprefix/lib/site_$prog ;;
6490 *)       dflt=$siteprefix/lib/site_$prog ;;
6491 esac
6492 $cat <<EOM
6493
6494 The installation process will create a directory for
6495 site-specific extensions and modules.  Most users find it convenient
6496 to place all site-specific files in this directory rather than in the
6497 main distribution directory.
6498
6499 EOM
6500 fn=d~+
6501 rp='Pathname for the site-specific library files?'
6502 . ./getfile
6503 sitelib="$ans"
6504 sitelibexp="$ansexp"
6505 : Change installation prefix, if necessary.
6506 if $test X"$prefix" != X"$installprefix"; then
6507         installsitelib=`echo $sitelibexp | sed "s#^$prefix#$installprefix#"`
6508 else
6509         installsitelib="$sitelibexp"
6510 fi
6511
6512 : determine where site specific architecture-dependent libraries go.
6513 : sitelib  default is /usr/local/lib/perl5/site_perl/
6514 : sitearch default is /usr/local/lib/perl5/site_perl/$apiversion/$archname
6515 : sitelib may have an optional trailing /share.
6516 tdflt=`echo $sitelib | $sed 's,/share$,,'`
6517 tdflt="$tdflt/$apiversion/$archname"
6518 set sitearch sitearch none
6519 eval $prefixit
6520 case "$sitearch" in
6521 '')     dflt="$tdflt" ;;
6522 *)      dflt="$sitearch" ;;
6523 esac
6524 $cat <<EOM
6525
6526 The installation process will also create a directory for
6527 architecture-dependent site-specific extensions and modules.
6528
6529 EOM
6530 fn=nd~+
6531 rp='Pathname for the site-specific architecture-dependent library files?'
6532 . ./getfile
6533 sitearch="$ans"
6534 sitearchexp="$ansexp"
6535 : Change installation prefix, if necessary.
6536 if $test X"$prefix" != X"$installprefix"; then
6537         installsitearch=`echo $sitearchexp | sed "s#^$prefix#$installprefix#"`
6538 else
6539         installsitearch="$sitearchexp"
6540 fi
6541
6542 : determine where add-on public executables go
6543 case "$sitebin" in
6544 '')     dflt=$siteprefix/bin ;;
6545 *)      dflt=$sitebin ;;
6546 esac
6547 fn=d~
6548 rp='Pathname where the add-on public executables should be installed?'
6549 . ./getfile
6550 sitebin="$ans"
6551 sitebinexp="$ansexp"
6552 : Change installation prefix, if necessary.
6553 if $test X"$prefix" != X"$installprefix"; then
6554         installsitebin=`echo $sitebinexp | sed "s#^$prefix#$installprefix#"`
6555 else
6556         installsitebin="$sitebinexp"
6557 fi
6558
6559 cat <<EOM
6560
6561 Perl can be built to take advantage of long doubles which
6562 (if available) may give more accuracy and range for floating point
6563 numbers.  To do so, Configure must be run with -Duselongdouble.
6564
6565 If this doesn't make any sense to you, just accept the default 'n'.
6566 EOM
6567 case "$uselongdouble" in
6568 $define|true|[yY]*)     dflt='y';;
6569 *) dflt='n';;
6570 esac
6571 rp='Try to use long doubles if available?'
6572 . ./myread
6573 case "$ans" in
6574 y|Y)    val="$define"   ;;
6575 *)      val="$undef"    ;;
6576 esac
6577 set uselongdouble
6578 eval $setvar
6579
6580 case "$uselongdouble" in
6581 "$define"|true|[yY]*)
6582 : Look for a hint-file generated 'call-back-unit'.  If the
6583 : user has specified that long doubles should be used,
6584 : we may need to set or change some other defaults.
6585         if $test -f uselongdouble.cbu; then
6586                 echo "Your platform has some specific hints for long doubles, using them..."
6587                 . ./uselongdouble.cbu
6588         else
6589                 $cat <<EOM
6590 (Your platform doesn't have any specific hints for long doubles.)
6591 EOM
6592         fi
6593         ;;
6594 esac
6595
6596 cat <<EOM
6597
6598 Previous version of $package used the standard IO mechanisms as defined
6599 in <stdio.h>.  Versions 5.003_02 and later of perl allow alternate IO
6600 mechanisms via a "PerlIO" abstraction, but the stdio mechanism is still
6601 the default.  This abstraction layer can use AT&T's sfio (if you already
6602 have sfio installed) or regular stdio.  Using PerlIO with sfio may cause
6603 problems with some extension modules.  Using PerlIO with stdio is safe,
6604 but it is slower than plain stdio and therefore is not the default.
6605
6606 If this doesn't make any sense to you, just accept the default 'n'.
6607 EOM
6608 case "$useperlio" in
6609 $define|true|[yY]*)     dflt='y';;
6610 *) dflt='n';;
6611 esac
6612 rp='Use the experimental PerlIO abstraction layer?'
6613 . ./myread
6614 case "$ans" in
6615 y|Y) 
6616         val="$define"
6617         ;;     
6618 *)      
6619         echo "Ok, doing things the stdio way"
6620         val="$undef"
6621         ;;
6622 esac
6623 set useperlio
6624 eval $setvar 
6625
6626 case "$vendorprefix" in
6627 '')     d_vendorbin="$undef"
6628         vendorbin=''
6629         vendorbinexp=''
6630         ;;
6631 *)      d_vendorbin="$define"
6632         : determine where vendor-supplied executables go.
6633         dflt=$vendorprefix/bin
6634         fn=d~+
6635         rp='Pathname for the vendor-supplied executables directory?'
6636         . ./getfile
6637         vendorbin="$ans"
6638         vendorbinexp="$ansexp"
6639         : Change installation prefix, if necessary.
6640         if $test X"$prefix" != X"$installprefix"; then
6641                 installvendorbin=`echo $vendorbinexp | $sed "s#^$prefix#$installprefix#"`
6642         else
6643                 installvendorbin="$vendorbinexp"
6644         fi
6645         ;;
6646 esac
6647
6648 : Check how to convert floats to strings.
6649 if test "X$d_Gconvert" = X; then
6650         echo " "
6651         echo "Checking for an efficient way to convert floats to strings."
6652         $cat >try.c <<'EOP'
6653 #ifdef TRY_gconvert
6654 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
6655 char *myname = "gconvert";
6656 #endif
6657 #ifdef TRY_gcvt
6658 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
6659 char *myname = "gcvt";
6660 #endif
6661 #ifdef TRY_sprintf
6662 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
6663 char *myname = "sprintf";
6664 #endif
6665
6666 #include <stdio.h>
6667
6668 int
6669 checkit(expect, got)
6670 char *expect;
6671 char *got;
6672 {
6673     if (strcmp(expect, got)) {
6674                 printf("%s oddity:  Expected %s, got %s\n",
6675                         myname, expect, got);
6676                 exit(1);
6677         }
6678 }
6679
6680 int main()
6681
6682         char buf[64]; 
6683         buf[63] = '\0';
6684
6685         /* This must be 1st test on (which?) platform */
6686         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
6687         Gconvert(0.1, 8, 0, buf);
6688         checkit("0.1", buf);
6689
6690         Gconvert(1.0, 8, 0, buf); 
6691         checkit("1", buf);
6692
6693         Gconvert(0.0, 8, 0, buf); 
6694         checkit("0", buf);
6695
6696         Gconvert(-1.0, 8, 0, buf); 
6697         checkit("-1", buf);
6698
6699         /* Some Linux gcvt's give 1.e+5 here. */
6700         Gconvert(100000.0, 8, 0, buf); 
6701         checkit("100000", buf);
6702         
6703         /* Some Linux gcvt's give -1.e+5 here. */
6704         Gconvert(-100000.0, 8, 0, buf); 
6705         checkit("-100000", buf);
6706
6707         exit(0);
6708 }
6709 EOP
6710         case "$d_Gconvert" in
6711         gconvert*) xxx_list='gconvert gcvt sprintf' ;;
6712         gcvt*) xxx_list='gcvt gconvert sprintf' ;;
6713         sprintf*) xxx_list='sprintf gconvert gcvt' ;;
6714         *) xxx_list='gconvert gcvt sprintf' ;;
6715         esac
6716
6717         for xxx_convert in $xxx_list; do
6718                 echo "Trying $xxx_convert"
6719                 $rm -f try try$_o
6720                 set try -DTRY_$xxx_convert
6721                 if eval $compile; then
6722                         echo "$xxx_convert" found. >&4
6723                         if ./try; then
6724                                 echo "I'll use $xxx_convert to convert floats into a string." >&4
6725                                 break;
6726                         else
6727                                 echo "...But $xxx_convert didn't work as I expected."
6728                         fi
6729                 else
6730                         echo "$xxx_convert NOT found." >&4
6731                 fi
6732         done
6733                 
6734         case "$xxx_convert" in
6735         gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
6736         gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
6737         *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
6738         esac
6739 fi
6740
6741 : see if inttypes.h is available
6742 : we want a real compile instead of Inhdr because some systems
6743 : have an inttypes.h which includes non-existent headers
6744 echo " "
6745 $cat >try.c <<EOCP
6746 #include <inttypes.h>
6747 int main() {
6748         static int32_t foo32 = 0x12345678;
6749 }
6750 EOCP
6751 set try
6752 if eval $compile; then
6753         echo "<inttypes.h> found." >&4
6754         val="$define"
6755 else
6756         echo "<inttypes.h> NOT found." >&4
6757         val="$undef"
6758 fi
6759 $rm -f try.c try
6760 set i_inttypes
6761 eval $setvar
6762
6763 : check for int64_t
6764 case "$use64bits" in
6765 "$define" )
6766         echo " "
6767         $echo $n "Checking to see if your system supports int64_t...$c" >&4
6768         $cat >try.c <<EOCP
6769 #include <sys/types.h>
6770 #$i_inttypes I_INTTYPES
6771 #ifdef I_INTTYPES
6772 #include <inttypes.h>
6773 #endif
6774 int64_t foo() { int64_t x; x = 7; return x; }
6775 EOCP
6776         if $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then
6777                 val="$define"
6778                 echo " Yup, it does." >&4
6779         else
6780                 val="$undef"
6781                 echo " Nope, it doesn't." >&4
6782         fi
6783         $rm -f try.*
6784         ;;
6785 *)      val="$undef"
6786         ;;
6787 esac
6788 set d_int64t
6789 eval $setvar
6790
6791
6792 : check for lengths of integral types
6793 echo " "
6794 case "$intsize" in
6795 '')
6796         echo "Checking to see how big your integers are..." >&4
6797         $cat >intsize.c <<'EOCP'
6798 #include <stdio.h>
6799 int main()
6800 {
6801         printf("intsize=%d;\n", sizeof(int));
6802         printf("longsize=%d;\n", sizeof(long));
6803         printf("shortsize=%d;\n", sizeof(short));
6804         exit(0);
6805 }
6806 EOCP
6807         set intsize
6808         if eval $compile_ok && ./intsize > /dev/null; then
6809                 eval `./intsize`
6810                 echo "Your integers are $intsize bytes long."
6811                 echo "Your long integers are $longsize bytes long."
6812                 echo "Your short integers are $shortsize bytes long."
6813         else
6814                 $cat >&4 <<EOM
6815 !
6816 Help! I can't compile and run the intsize test program: please enlighten me!
6817 (This is probably a misconfiguration in your system or libraries, and
6818 you really ought to fix it.  Still, I'll try anyway.)
6819 !
6820 EOM
6821                 dflt=4
6822                 rp="What is the size of an integer (in bytes)?"
6823                 . ./myread
6824                 intsize="$ans"
6825                 dflt=$intsize
6826                 rp="What is the size of a long integer (in bytes)?"
6827                 . ./myread
6828                 longsize="$ans"
6829                 dflt=2
6830                 rp="What is the size of a short integer (in bytes)?"
6831                 . ./myread
6832                 shortsize="$ans"
6833         fi
6834         ;;
6835 esac
6836 $rm -f intsize intsize.*
6837
6838 : check for long long
6839 echo " "
6840 $echo $n "Checking to see if your system supports long long...$c" >&4
6841 echo 'long long foo() { long long x; x = 7; return x; }' > try.c
6842 if $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then
6843         val="$define"
6844         echo " Yup, it does." >&4
6845 else
6846         val="$undef"
6847         echo " Nope, it doesn't." >&4
6848 fi
6849 $rm try.*
6850 set d_longlong
6851 eval $setvar
6852
6853 : check for length of long long
6854 case "${d_longlong}${longlongsize}" in
6855 $define)
6856         echo " "
6857         $echo $n "Checking to see how big your long longs are...$c" >&4
6858         $cat >try.c <<'EOCP'
6859 #include <stdio.h>
6860 int main()
6861 {
6862         printf("%d\n", sizeof(long long));
6863 }
6864 EOCP
6865         set try
6866         if eval $compile_ok; then
6867                 longlongsize=`./try`
6868                 $echo " $longlongsize bytes." >&4
6869         else
6870                 dflt='8'
6871                 echo " "
6872                 echo "(I can't seem to compile the test program.  Guessing...)"
6873                 rp="What is the size of a long long (in bytes)?"
6874                 . ./myread
6875                 longlongsize="$ans"
6876         fi
6877         if $test "X$longsize" = "X$longlongsize"; then
6878                 echo "(That isn't any different from an ordinary long.)"
6879         fi      
6880         ;;
6881 esac
6882 $rm -f try.c try
6883
6884 echo " "
6885
6886 if $test X"$intsize" = X8 -o X"$longsize" = X8 -o X"$d_int64t" = X"$define" -o X"$d_longlong" = X"$define"; then
6887
6888 echo "Checking how to print 64-bit integers..." >&4
6889
6890 if $test X"$sPRId64" = X -a X"$intsize" = X8; then
6891         quad=int
6892         $cat >try.c <<'EOCP'
6893 #include <sys/types.h>
6894 #include <stdio.h>
6895 int main() {
6896   int q = 12345678901;
6897   printf("%ld\n", q);
6898 }
6899 EOCP
6900         set try
6901         if eval $compile; then
6902                 yyy=`./try$exe_ext`
6903                 case "$yyy" in
6904                 12345678901)
6905                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
6906                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIX64='"X"';
6907                         echo "We will use %d."
6908                         ;;
6909                 esac
6910         fi
6911 fi
6912
6913 if $test X"$sPRId64" = X -a X"$longsize" = X8; then
6914         quad=long
6915         $cat >try.c <<'EOCP'
6916 #include <sys/types.h>
6917 #include <stdio.h>
6918 int main() {
6919   long q = 12345678901;
6920   printf("%ld\n", q);
6921 }
6922 EOCP
6923         set try
6924         if eval $compile; then
6925                 yyy=`./try$exe_ext`
6926                 case "$yyy" in
6927                 12345678901)
6928                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
6929                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIX64='"lX"';
6930                         echo "We will use %ld."
6931                         ;;
6932                 esac
6933         fi
6934 fi
6935
6936 if $test X"$sPRId64" = X -a X"$i_inttypes.h" = X"$define" -a X"$d_int64t" = X"$define"; then
6937         quad=int64_t
6938         $cat >try.c <<'EOCP'
6939 #include <sys/types.h>
6940 #include <inttypes.h>
6941 #include <stdio.h>
6942 int main() {
6943   int64_t q = 12345678901;
6944   printf("%" PRId64 "\n", q);
6945 }
6946 EOCP
6947         set try
6948         if eval $compile; then
6949                 yyy=`./try$exe_ext`
6950                 case "$yyy" in
6951                 12345678901)
6952                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
6953                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIX64=PRIX64;
6954                         echo "We will use the C9X style."
6955                         ;;
6956                 esac
6957         fi
6958 fi
6959
6960 if $test X"$sPRId64" = X -a X"$d_longlong" = X"$define" -a X"$longlongsize" = X8; then
6961         quad="long long"
6962         $cat >try.c <<'EOCP'
6963 #include <sys/types.h>
6964 #include <stdio.h>
6965 int main() {
6966   long long q = 12345678901LL; /* AIX cc requires the LL prefix. */
6967   printf("%lld\n", q);
6968 }
6969 EOCP
6970         set try
6971         if eval $compile; then
6972                 yyy=`./try$exe_ext`
6973                 case "$yyy" in
6974                 12345678901)
6975                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
6976                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIX64='"llX"';
6977                         echo "We will use the %lld style."
6978                         ;;
6979                 esac
6980         fi
6981 fi
6982
6983 if $test X"$sPRId64" = X -a X"$quad" != X; then
6984         $cat >try.c <<EOCP
6985 #include <sys/types.h>
6986 #include <stdio.h>
6987 int main() {
6988   $quad q = 12345678901;
6989   printf("%Ld\n", q);
6990 }
6991 EOCP
6992         set try
6993         if eval $compile; then
6994                 yyy=`./try$exe_ext`
6995                 case "$yyy" in
6996                 12345678901)
6997                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
6998                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIX64='"LX"';
6999                         echo "We will use %lld."
7000                         ;;
7001                 esac
7002         fi
7003 fi
7004
7005 if $test X"$sPRId64" = X -a X"$quad" != X; then
7006         $cat >try.c <<EOCP
7007 #include <sys/types.h>
7008 #include <stdio.h>
7009 int main() {
7010   $quad q = 12345678901;
7011   printf("%qd\n", q);
7012 }
7013 EOCP
7014         set try
7015         if eval $compile; then
7016                 yyy=`./try$exe_ext`
7017                 case "$yyy" in
7018                 12345678901)
7019                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
7020                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIX64='"qX"';
7021                         echo "We will use %qd."
7022                         ;;
7023                 esac
7024         fi
7025 fi
7026
7027 if $test X"$sPRId64" = X; then
7028         echo "Cannot figure out how to print 64-bit integers." >&4
7029 fi
7030
7031 $rm -f try try.*
7032
7033 fi # intsize -o longsize -o d_int64t -o d_longlong
7034
7035 case "$sPRId64" in
7036 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef"; 
7037         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIX64="$undef"; 
7038         ;;
7039 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define"; 
7040         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIX64="$define"; 
7041         ;;
7042 esac
7043
7044 : check for length of double
7045 echo " "
7046 case "$doublesize" in
7047 '')
7048         $echo $n "Checking to see how big your double precision numbers are...$c" >&4
7049         $cat >try.c <<'EOCP'
7050 #include <stdio.h>
7051 int main()
7052 {
7053         printf("%d\n", sizeof(double));
7054 }
7055 EOCP
7056         set try
7057         if eval $compile_ok; then
7058                 doublesize=`./try`
7059                 $echo " $doublesize bytes." >&4
7060         else
7061                 dflt='8'
7062                 echo "(I can't seem to compile the test program.  Guessing...)"
7063                 rp="What is the size of a double precision number (in bytes)?"
7064                 . ./myread
7065                 doublesize="$ans"
7066         fi
7067         ;;
7068 esac
7069 $rm -f try.c try
7070
7071 : check for long doubles
7072 echo " "
7073 $echo $n "Checking to see if your system supports long double...$c" >&4
7074 echo 'long double foo() { long double x; x = 7.0; return x; }' > try.c
7075 if $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then
7076         val="$define"
7077         echo " Yup, it does." >&4
7078 else
7079         val="$undef"
7080         echo " Nope, it doesn't." >&4
7081 fi
7082 $rm try.*
7083 set d_longdbl
7084 eval $setvar
7085
7086 : check for length of long double
7087 case "${d_longdbl}${longdblsize}" in
7088 $define)
7089         echo " "
7090         $echo $n "Checking to see how big your long doubles are...$c" >&4
7091         $cat >try.c <<'EOCP'
7092 #include <stdio.h>
7093 int main()
7094 {
7095         printf("%d\n", sizeof(long double));
7096 }
7097 EOCP
7098         set try
7099         if eval $compile; then
7100                 longdblsize=`./try`
7101                 $echo " $longdblsize bytes." >&4
7102         else
7103                 dflt='8'
7104                 echo " "
7105                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
7106                 rp="What is the size of a long double (in bytes)?"
7107                 . ./myread
7108                 longdblsize="$ans"
7109         fi
7110         if $test "X$doublesize" = "X$longdblsize"; then
7111                 echo "(That isn't any different from an ordinary double.)"
7112         fi      
7113         ;;
7114 esac
7115 $rm -f try.c try
7116
7117 echo " "
7118
7119 if $test X"$d_longdbl" = X"$define"; then
7120
7121 echo "Checking how to print long doubles..." >&4
7122
7123 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
7124         $cat >try.c <<'EOCP'
7125 #include <sys/types.h>
7126 #include <stdio.h>
7127 int main() {
7128   double d = 123.456;
7129   printf("%.3f\n", d);
7130 }
7131 EOCP
7132         set try
7133         if eval $compile; then
7134                 yyy=`./try$exe_ext`
7135                 case "$yyy" in
7136                 123.456)
7137                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
7138                         sPRIFldbl='"F"'; sPRIGldbl='"G"'; sPRIEldbl='"E"';
7139                         echo "We will use %f."
7140                         ;;
7141                 esac
7142         fi
7143 fi
7144
7145 if $test X"$sPRIfldbl" = X; then
7146         $cat >try.c <<'EOCP'
7147 #include <sys/types.h>
7148 #include <stdio.h>
7149 int main() {
7150   long double d = 123.456;
7151   printf("%.3llf\n", d);
7152 }
7153 EOCP
7154         set try
7155         if eval $compile; then
7156                 yyy=`./try$exe_ext`
7157                 case "$yyy" in
7158                 123.456)
7159                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
7160                         sPRIFldbl='"llF"'; sPRIGldbl='"llG"'; sPRIEldbl='"llE"';
7161                         echo "We will use %llf."
7162                         ;;
7163                 esac
7164         fi
7165 fi
7166
7167 if $test X"$sPRIfldbl" = X; then
7168         $cat >try.c <<'EOCP'
7169 #include <sys/types.h>
7170 #include <stdio.h>
7171 int main() {
7172   long double d = 123.456;
7173   printf("%.3Lf\n", d);
7174 }
7175 EOCP
7176         set try
7177         if eval $compile; then
7178                 yyy=`./try$exe_ext`
7179                 case "$yyy" in
7180                 123.456)
7181                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
7182                         sPRIFldbl='"LF"'; sPRIGldbl='"LG"'; sPRIEldbl='"LE"';
7183                         echo "We will use %Lf."
7184                         ;;
7185                 esac
7186         fi
7187 fi
7188
7189 if $test X"$sPRIfldbl" = X; then
7190         $cat >try.c <<'EOCP'
7191 #include <sys/types.h>
7192 #include <stdio.h>
7193 int main() {
7194   long double d = 123.456;
7195   printf("%.3lf\n", d);
7196 }
7197 EOCP
7198         set try
7199         if eval $compile; then
7200                 yyy=`./try$exe_ext`
7201                 case "$yyy" in
7202                 123.456)
7203                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
7204                         sPRIFldbl='"lF"'; sPRIGldbl='"lG"'; sPRIEldbl='"lE"';
7205                         echo "We will use %lf."
7206                         ;;
7207                 esac
7208         fi
7209 fi
7210
7211 if $test X"$sPRIfldbl" = X; then
7212         echo "Cannot figure out how to print long doubles." >&4
7213 fi
7214
7215 $rm -f try try.*
7216
7217 fi # d_longdbl
7218
7219 case "$sPRIfldbl" in
7220 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef"; 
7221         d_PRIFldbl="$undef"; d_PRIGldbl="$undef"; d_PRIEldbl="$undef"; 
7222         ;;
7223 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define"; 
7224         d_PRIFldbl="$define"; d_PRIGldbl="$define"; d_PRIEldbl="$define"; 
7225         ;;
7226 esac
7227
7228 : Initialize h_fcntl
7229 h_fcntl=false
7230
7231 : Initialize h_sysfile
7232 h_sysfile=false
7233
7234 : access call always available on UNIX
7235 set access d_access
7236 eval $inlibc
7237
7238 : locate the flags for 'access()'
7239 case "$d_access" in
7240 "$define")
7241         echo " "
7242         $cat >access.c <<'EOCP'
7243 #include <sys/types.h>
7244 #ifdef I_FCNTL
7245 #include <fcntl.h>
7246 #endif
7247 #ifdef I_SYS_FILE
7248 #include <sys/file.h>
7249 #endif
7250 #ifdef I_UNISTD
7251 #include <unistd.h>
7252 #endif
7253 int main() {
7254         exit(R_OK);
7255 }
7256 EOCP
7257         : check sys/file.h first, no particular reason here
7258         if $test `./findhdr sys/file.h` && \
7259                 $cc $cppflags -DI_SYS_FILE -o access access.c >/dev/null 2>&1 ; then
7260                 h_sysfile=true;
7261                 echo "<sys/file.h> defines the *_OK access constants." >&4
7262         elif $test `./findhdr fcntl.h` && \
7263                 $cc $cppflags -DI_FCNTL -o access access.c >/dev/null 2>&1 ; then
7264                 h_fcntl=true;
7265                 echo "<fcntl.h> defines the *_OK access constants." >&4
7266         elif $test `./findhdr unistd.h` && \
7267                 $cc $cppflags -DI_UNISTD -o access access.c >/dev/null 2>&1 ; then
7268                 echo "<unistd.h> defines the *_OK access constants." >&4
7269         else
7270                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
7271         fi
7272         ;;
7273 esac
7274 $rm -f access*
7275
7276 : see if accessx exists
7277 set accessx d_accessx
7278 eval $inlibc
7279
7280 : see if alarm exists
7281 set alarm d_alarm
7282 eval $inlibc
7283
7284 : see if atolf exists
7285 set atolf d_atolf
7286 eval $inlibc
7287
7288 : see if atoll exists
7289 set atoll d_atoll
7290 eval $inlibc
7291
7292 : Look for GNU-cc style attribute checking
7293 echo " "
7294 echo "Checking whether your compiler can handle __attribute__ ..." >&4
7295 $cat >attrib.c <<'EOCP'
7296 #include <stdio.h>
7297 void croak (char* pat,...) __attribute__((format(printf,1,2),noreturn));
7298 EOCP
7299 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
7300         if $contains 'warning' attrib.out >/dev/null 2>&1; then
7301                 echo "Your C compiler doesn't fully support __attribute__."
7302                 val="$undef"
7303         else
7304                 echo "Your C compiler supports __attribute__."
7305                 val="$define"
7306         fi
7307 else
7308         echo "Your C compiler doesn't seem to understand __attribute__ at all."
7309         val="$undef"
7310 fi
7311 set d_attribut
7312 eval $setvar
7313 $rm -f attrib*
7314
7315 : see if bcmp exists
7316 set bcmp d_bcmp
7317 eval $inlibc
7318
7319 : see if bcopy exists
7320 set bcopy d_bcopy
7321 eval $inlibc
7322
7323 : see if this is a unistd.h system
7324 set unistd.h i_unistd
7325 eval $inhdr
7326
7327 : see if getpgrp exists
7328 set getpgrp d_getpgrp
7329 eval $inlibc
7330
7331 case "$d_getpgrp" in
7332 "$define")
7333         echo " "
7334         echo "Checking to see which flavor of getpgrp is in use..."
7335         $cat >set.c <<EOP
7336 #$i_unistd I_UNISTD
7337 #include <sys/types.h>
7338 #ifdef I_UNISTD
7339 #  include <unistd.h>
7340 #endif
7341 int main()
7342 {
7343         if (getuid() == 0) {
7344                 printf("(I see you are running Configure as super-user...)\n");
7345                 setuid(1);
7346         }
7347 #ifdef TRY_BSD_PGRP
7348         if (getpgrp(1) == 0)
7349                 exit(0);
7350 #else
7351         if (getpgrp() > 0)
7352                 exit(0);
7353 #endif
7354         exit(1);
7355 }
7356 EOP
7357         if $cc -DTRY_BSD_PGRP $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7358                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
7359                 val="$define"
7360         elif $cc $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7361                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
7362                 val="$undef"
7363         else
7364                 echo "I can't seem to compile and run the test program."
7365                 if ./usg; then
7366                         xxx="a USG one, i.e. you use getpgrp()."
7367                 else
7368                         # SVR4 systems can appear rather BSD-ish.
7369                         case "$i_unistd" in
7370                         $undef)
7371                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
7372                                 val="$define"
7373                                 ;;
7374                         $define)
7375                                 xxx="probably a USG one, i.e. you use getpgrp()."
7376                                 val="$undef"
7377                                 ;;
7378                         esac
7379                 fi
7380                 echo "Assuming your getpgrp is $xxx" >&4
7381         fi
7382         ;;
7383 *) val="$undef";;
7384 esac
7385 set d_bsdgetpgrp
7386 eval $setvar
7387 $rm -f set set.c
7388
7389 : see if setpgrp exists
7390 set setpgrp d_setpgrp
7391 eval $inlibc
7392
7393 case "$d_setpgrp" in
7394 "$define")
7395         echo " "
7396         echo "Checking to see which flavor of setpgrp is in use..."
7397         $cat >set.c <<EOP
7398 #$i_unistd I_UNISTD
7399 #include <sys/types.h>
7400 #ifdef I_UNISTD
7401 #  include <unistd.h>
7402 #endif
7403 int main()
7404 {
7405         if (getuid() == 0) {
7406                 printf("(I see you are running Configure as super-user...)\n");
7407                 setuid(1);
7408         }
7409 #ifdef TRY_BSD_PGRP
7410         if (-1 == setpgrp(1, 1))
7411                 exit(0);
7412 #else
7413         if (setpgrp() != -1)
7414                 exit(0);
7415 #endif
7416         exit(1);
7417 }
7418 EOP
7419         if $cc -DTRY_BSD_PGRP $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7420                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
7421                 val="$define"
7422         elif $cc $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7423                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
7424                 val="$undef"
7425         else
7426                 echo "(I can't seem to compile and run the test program.)"
7427                 if ./usg; then
7428                         xxx="a USG one, i.e. you use setpgrp()."
7429                 else
7430                         # SVR4 systems can appear rather BSD-ish.
7431                         case "$i_unistd" in
7432                         $undef)
7433                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
7434                                 val="$define"
7435                                 ;;
7436                         $define)
7437                                 xxx="probably a USG one, i.e. you use setpgrp()."
7438                                 val="$undef"
7439                                 ;;
7440                         esac
7441                 fi
7442                 echo "Assuming your setpgrp is $xxx" >&4
7443         fi
7444         ;;
7445 *) val="$undef";;
7446 esac
7447 set d_bsdsetpgrp
7448 eval $setvar
7449 $rm -f set set.c
7450 : see if bzero exists
7451 set bzero d_bzero
7452 eval $inlibc
7453
7454 : see if signal is declared as pointer to function returning int or void
7455 echo " "
7456 xxx=`./findhdr signal.h`
7457 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
7458 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
7459         echo "You have int (*signal())() instead of void." >&4
7460         val="$undef"
7461 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
7462         echo "You have void (*signal())()." >&4
7463         val="$define"
7464 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
7465         echo "You have int (*signal())() instead of void." >&4
7466         val="$undef"
7467 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
7468         echo "You have void (*signal())()." >&4
7469         val="$define"
7470 else
7471         case "$d_voidsig" in
7472         '')
7473         echo "I can't determine whether signal handler returns void or int..." >&4
7474                 dflt=void
7475                 rp="What type does your signal handler return?"
7476                 . ./myread
7477                 case "$ans" in
7478                 v*) val="$define";;
7479                 *) val="$undef";;
7480                 esac;;
7481         "$define")
7482                 echo "As you already told me, signal handler returns void." >&4
7483                 val="$define"
7484                 ;;
7485         *)      echo "As you already told me, signal handler returns int." >&4
7486                 val="$undef"
7487                 ;;
7488         esac
7489 fi
7490 set d_voidsig
7491 eval $setvar
7492 case "$d_voidsig" in
7493 "$define") signal_t="void";;
7494 *) signal_t="int";;
7495 esac
7496 $rm -f $$.tmp
7497
7498 : check for ability to cast large floats to 32-bit ints.
7499 echo " "
7500 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
7501 if $test "$intsize" -ge 4; then
7502         xxx=int
7503 else
7504         xxx=long
7505 fi
7506 $cat >try.c <<EOCP
7507 #include <stdio.h>
7508 #include <sys/types.h>
7509 #include <signal.h>
7510 $signal_t blech(s) int s; { exit(3); }
7511 int main()
7512 {
7513         $xxx i32;
7514         double f, g;
7515         int result = 0;
7516         char str[16];
7517         signal(SIGFPE, blech);
7518
7519         /* Don't let compiler optimize the test away.  Store the number 
7520            in a writable string for gcc to pass to sscanf under HP/UX.
7521         */
7522         sprintf(str, "2147483647");
7523         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
7524         g = 10 * f;
7525         i32  = ($xxx) g;
7526
7527         /* x86 processors will probably give 0x8000 0000, which is a
7528        sign change.  We don't want that.  We want to mimic SPARC
7529            behavior here, which is to preserve the sign and give
7530            back 0x7fff ffff.
7531         */
7532         if (i32 != ($xxx) f)
7533                 result |= 1;
7534         exit(result);
7535 }
7536 EOCP
7537 set try
7538 if eval $compile_ok; then
7539         ./try
7540         yyy=$?
7541 else
7542         echo "(I can't seem to compile the test program--assuming it can't)"
7543         yyy=1
7544 fi
7545 case "$yyy" in
7546 0)      val="$define"
7547         echo "Yup, it can."
7548         ;;
7549 *)      val="$undef"
7550         echo "Nope, it can't."
7551         ;;
7552 esac
7553 set d_casti32
7554 eval $setvar
7555 $rm -f try try.*
7556
7557 : check for ability to cast negative floats to unsigned
7558 echo " "
7559 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
7560 $cat >try.c <<EOCP
7561 #include <stdio.h>
7562 #include <sys/types.h>
7563 #include <signal.h>
7564 $signal_t blech(s) int s; { exit(7); }
7565 $signal_t blech_in_list(s) int s; { exit(4); }
7566 unsigned long dummy_long(p) unsigned long p; { return p; }
7567 unsigned int dummy_int(p) unsigned int p; { return p; }
7568 unsigned short dummy_short(p) unsigned short p; { return p; }
7569 int main()
7570 {
7571         double f;
7572         unsigned long along;
7573         unsigned int aint;
7574         unsigned short ashort;
7575         int result = 0;
7576         char str[16];
7577         
7578         /* Frustrate gcc-2.7.2's optimizer which failed this test with
7579            a direct f = -123. assignment.  gcc-2.8.0 reportedly
7580            optimized the whole file away
7581         */
7582         /* Store the number in a writable string for gcc to pass to 
7583            sscanf under HP/UX.
7584         */
7585         sprintf(str, "-123");
7586         sscanf(str, "%lf", &f);  /* f = -123.; */
7587
7588         signal(SIGFPE, blech);
7589         along = (unsigned long)f;
7590         aint = (unsigned int)f;
7591         ashort = (unsigned short)f;
7592         if (along != (unsigned long)-123)
7593                 result |= 1;
7594         if (aint != (unsigned int)-123)
7595                 result |= 1;
7596         if (ashort != (unsigned short)-123)
7597                 result |= 1;
7598         sprintf(str, "1073741824.");
7599         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
7600         f = f + f;
7601         along = 0;
7602         along = (unsigned long)f;
7603         if (along != 0x80000000)
7604                 result |= 2;
7605         f -= 1.;
7606         along = 0;
7607         along = (unsigned long)f;
7608         if (along != 0x7fffffff)
7609                 result |= 1;
7610         f += 2.;
7611         along = 0;
7612         along = (unsigned long)f;
7613         if (along != 0x80000001)
7614                 result |= 2;
7615         if (result)
7616                 exit(result);
7617         signal(SIGFPE, blech_in_list);
7618         sprintf(str, "123.");
7619         sscanf(str, "%lf", &f);  /* f = 123.; */
7620         along = dummy_long((unsigned long)f);
7621         aint = dummy_int((unsigned int)f);
7622         ashort = dummy_short((unsigned short)f);
7623         if (along != (unsigned long)123)
7624                 result |= 4;
7625         if (aint != (unsigned int)123)
7626                 result |= 4;
7627         if (ashort != (unsigned short)123)
7628                 result |= 4;
7629         exit(result);
7630
7631 }
7632 EOCP
7633 set try
7634 if eval $compile_ok; then
7635         ./try
7636         castflags=$?
7637 else
7638         echo "(I can't seem to compile the test program--assuming it can't)"
7639         castflags=7
7640 fi
7641 case "$castflags" in
7642 0)      val="$define"
7643         echo "Yup, it can."
7644         ;;
7645 *)      val="$undef"
7646         echo "Nope, it can't."
7647         ;;
7648 esac
7649 set d_castneg
7650 eval $setvar
7651 $rm -f try.*
7652
7653 : see if vprintf exists
7654 echo " "
7655 if set vprintf val -f d_vprintf; eval $csym; $val; then
7656         echo 'vprintf() found.' >&4
7657         val="$define"
7658         $cat >vprintf.c <<'EOF'
7659 #include <varargs.h>
7660
7661 int main() { xxx("foo"); }
7662
7663 xxx(va_alist)
7664 va_dcl
7665 {
7666         va_list args;
7667         char buf[10];
7668
7669         va_start(args);
7670         exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
7671 }
7672 EOF
7673         set vprintf
7674         if eval $compile && ./vprintf; then
7675                 echo "Your vsprintf() returns (int)." >&4
7676                 val2="$undef"
7677         else
7678                 echo "Your vsprintf() returns (char*)." >&4
7679                 val2="$define"
7680         fi
7681 else
7682         echo 'vprintf() NOT found.' >&4
7683                 val="$undef"
7684                 val2="$undef"
7685 fi
7686 set d_vprintf
7687 eval $setvar
7688 val=$val2
7689 set d_charvspr
7690 eval $setvar
7691
7692 : see if chown exists
7693 set chown d_chown
7694 eval $inlibc
7695
7696 : see if chroot exists
7697 set chroot d_chroot
7698 eval $inlibc
7699
7700 : see if chsize exists
7701 set chsize d_chsize
7702 eval $inlibc
7703
7704 : check for const keyword
7705 echo " "
7706 echo 'Checking to see if your C compiler knows about "const"...' >&4
7707 $cat >const.c <<'EOCP'
7708 typedef struct spug { int drokk; } spug;
7709 int main()
7710 {
7711         const char *foo;
7712         const spug y;
7713 }
7714 EOCP
7715 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
7716         val="$define"
7717         echo "Yup, it does."
7718 else
7719         val="$undef"
7720         echo "Nope, it doesn't."
7721 fi
7722 set d_const
7723 eval $setvar
7724
7725 : see if crypt exists
7726 echo " "
7727 if set crypt val -f d_crypt; eval $csym; $val; then
7728         echo 'crypt() found.' >&4
7729         val="$define"
7730         cryptlib=''
7731 else
7732         cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
7733         if $test -z "$cryptlib"; then
7734                 cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
7735         else
7736                 cryptlib=-lcrypt
7737         fi
7738         if $test -z "$cryptlib"; then
7739                 cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
7740         else
7741                 cryptlib=-lcrypt
7742         fi
7743         if $test -z "$cryptlib"; then
7744                 cryptlib=`./loc libcrypt$_a "" $libpth`
7745         else
7746                 cryptlib=-lcrypt
7747         fi
7748         if $test -z "$cryptlib"; then
7749                 echo 'crypt() NOT found.' >&4
7750                 val="$undef"
7751         else
7752                 val="$define"
7753         fi
7754 fi
7755 set d_crypt
7756 eval $setvar
7757
7758 : get csh whereabouts
7759 case "$csh" in
7760 'csh') val="$undef" ;;
7761 *) val="$define" ;;
7762 esac
7763 set d_csh
7764 eval $setvar
7765 : Respect a hint or command line value for full_csh.
7766 case "$full_csh" in
7767 '') full_csh=$csh ;;
7768 esac
7769
7770 : see if cuserid exists
7771 set cuserid d_cuserid
7772 eval $inlibc
7773
7774 : see if this is a limits.h system
7775 set limits.h i_limits
7776 eval $inhdr
7777
7778 : see if this is a float.h system
7779 set float.h i_float
7780 eval $inhdr
7781
7782 : See if number of significant digits in a double precision number is known
7783 echo " "
7784 $cat >dbl_dig.c <<EOM
7785 #$i_limits I_LIMITS
7786 #$i_float I_FLOAT
7787 #ifdef I_LIMITS
7788 #include <limits.h>
7789 #endif
7790 #ifdef I_FLOAT
7791 #include <float.h>
7792 #endif
7793 #ifdef DBL_DIG
7794 printf("Contains DBL_DIG");
7795 #endif
7796 EOM
7797 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
7798 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
7799         echo "DBL_DIG found." >&4
7800         val="$define"
7801 else
7802         echo "DBL_DIG NOT found." >&4
7803         val="$undef"
7804 fi
7805 $rm -f dbl_dig.?
7806 set d_dbl_dig
7807 eval $setvar
7808
7809 : see if difftime exists
7810 set difftime d_difftime
7811 eval $inlibc
7812
7813 : see if this is a dirent system
7814 echo " "
7815 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
7816         val="$define"
7817         echo "<dirent.h> found." >&4
7818 else
7819         val="$undef"
7820         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
7821                 echo "<sys/dir.h> found." >&4
7822                 echo " "
7823         else
7824                 xinc=`./findhdr sys/ndir.h`
7825         fi
7826         echo "<dirent.h> NOT found." >&4
7827 fi
7828 set i_dirent
7829 eval $setvar
7830
7831 : Look for type of directory structure.
7832 echo " "
7833 $cppstdin $cppflags $cppminus < "$xinc" > try.c
7834
7835 case "$direntrytype" in
7836 ''|' ')
7837         case "$i_dirent" in
7838         $define) guess1='struct dirent' ;;
7839         *) guess1='struct direct'  ;;
7840         esac
7841         ;;
7842 *)      guess1="$direntrytype"
7843         ;;
7844 esac
7845
7846 case "$guess1" in
7847 'struct dirent') guess2='struct direct' ;;
7848 *) guess2='struct dirent' ;;
7849 esac
7850                 
7851 if $contains "$guess1" try.c >/dev/null 2>&1; then
7852         direntrytype="$guess1"
7853         echo "Your directory entries are $direntrytype." >&4
7854 elif $contains "$guess2" try.c >/dev/null 2>&1; then
7855         direntrytype="$guess2"
7856         echo "Your directory entries seem to be $direntrytype." >&4
7857 else
7858         echo "I don't recognize your system's directory entries." >&4
7859         rp="What type is used for directory entries on this system?"
7860         dflt="$guess1"
7861         . ./myread
7862         direntrytype="$ans"
7863 fi
7864 $rm -f try.c
7865
7866
7867 : see if the directory entry stores field length
7868 echo " "
7869 $cppstdin $cppflags $cppminus < "$xinc" > try.c
7870 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
7871         echo "Good, your directory entry keeps length information in d_namlen." >&4
7872         val="$define"
7873 else
7874         echo "Your directory entry does not know about the d_namlen field." >&4
7875         val="$undef"
7876 fi
7877 set d_dirnamlen
7878 eval $setvar
7879 $rm -f try.c
7880
7881 : see if dlerror exists
7882 xxx_runnm="$runnm"
7883 runnm=false
7884 set dlerror d_dlerror
7885 eval $inlibc
7886 runnm="$xxx_runnm"
7887
7888 : see if dlfcn is available
7889 set dlfcn.h i_dlfcn
7890 eval $inhdr
7891
7892 case "$usedl" in
7893 $define|y|true)
7894         $cat << EOM
7895
7896 On a few systems, the dynamically loaded modules that perl generates and uses
7897 will need a different extension than shared libs. The default will probably
7898 be appropriate.
7899
7900 EOM
7901         case "$dlext" in
7902         '')     dflt="$so" ;;
7903         *)      dflt="$dlext" ;;
7904         esac
7905         rp='What is the extension of dynamically loaded modules'
7906         . ./myread
7907         dlext="$ans"
7908         ;;
7909 *)
7910         dlext="none"
7911         ;;
7912 esac
7913
7914 : Check if dlsym need a leading underscore
7915 echo " "
7916 val="$undef"
7917
7918 case "$dlsrc" in
7919 dl_dlopen.xs)
7920         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
7921         $cat >dyna.c <<'EOM'
7922 fred () { }
7923 EOM
7924
7925 $cat >fred.c<<EOM
7926
7927 #include <stdio.h>
7928 #$i_dlfcn I_DLFCN
7929 #ifdef I_DLFCN
7930 #include <dlfcn.h>      /* the dynamic linker include file for Sunos/Solaris */
7931 #else
7932 #include <sys/types.h>
7933 #include <nlist.h>
7934 #include <link.h>
7935 #endif
7936
7937 extern int fred() ;
7938
7939 int main()
7940 {
7941     void * handle ;
7942     void * symbol ;
7943 #ifndef RTLD_LAZY
7944     int mode = 1 ;
7945 #else
7946     int mode = RTLD_LAZY ;
7947 #endif
7948     handle = dlopen("./dyna.$dlext", mode) ;
7949     if (handle == NULL) {
7950         printf ("1\n") ;
7951         fflush (stdout) ;
7952         exit(0);
7953     }
7954     symbol = dlsym(handle, "fred") ;
7955     if (symbol == NULL) {
7956         /* try putting a leading underscore */
7957         symbol = dlsym(handle, "_fred") ;
7958         if (symbol == NULL) {
7959             printf ("2\n") ;
7960             fflush (stdout) ;
7961             exit(0);
7962         }
7963         printf ("3\n") ;
7964     }
7965     else
7966         printf ("4\n") ;
7967     fflush (stdout) ;
7968     exit(0);
7969 }
7970 EOM
7971         : Call the object file tmp-dyna.o in case dlext=o.
7972         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 && 
7973                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 && 
7974                 $ld $lddlflags -o dyna.$dlext tmp-dyna${_o} > /dev/null 2>&1 && 
7975                 $cc $ccflags -o fred $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1; then
7976                 xxx=`./fred`
7977                 case $xxx in
7978                 1)      echo "Test program failed using dlopen." >&4
7979                         echo "Perhaps you should not use dynamic loading." >&4;;
7980                 2)      echo "Test program failed using dlsym." >&4
7981                         echo "Perhaps you should not use dynamic loading." >&4;;
7982                 3)      echo "dlsym needs a leading underscore" >&4
7983                         val="$define" ;;
7984                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
7985                 esac
7986         else
7987                 echo "I can't compile and run the test program." >&4
7988                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
7989         fi
7990         ;;
7991 esac
7992                 
7993 $rm -f fred fred.? dyna.$dlext dyna.? tmp-dyna.?
7994
7995 set d_dlsymun
7996 eval $setvar
7997
7998 hasproto='varname=$1; func=$2; shift; shift;
7999 while $test $# -ge 2; do
8000         case "$1" in
8001         $define) echo "#include <$2>";;
8002         esac ;
8003     shift 2;
8004 done > try.c;
8005 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
8006 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
8007         echo "$func() prototype found.";
8008         val="$define";
8009 else
8010         echo "$func() prototype NOT found.";
8011         val="$undef";
8012 fi;
8013 set $varname;
8014 eval $setvar;
8015 $rm -f try.c tryout.c'
8016
8017 : see if prototype for drand48 is available
8018 echo " "
8019 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
8020 eval $hasproto
8021
8022 : see if dup2 exists
8023 set dup2 d_dup2
8024 eval $inlibc
8025
8026 : see if eaccess exists
8027 set eaccess d_eaccess
8028 eval $inlibc
8029
8030 : see if endgrent exists
8031 set endgrent d_endgrent
8032 eval $inlibc
8033
8034 : see if endhostent exists
8035 set endhostent d_endhent
8036 eval $inlibc
8037
8038 : see if endnetent exists
8039 set endnetent d_endnent
8040 eval $inlibc
8041
8042 : see if endprotoent exists
8043 set endprotoent d_endpent
8044 eval $inlibc
8045
8046 : see if endpwent exists
8047 set endpwent d_endpwent
8048 eval $inlibc
8049
8050 : see if endservent exists
8051 set endservent d_endsent
8052 eval $inlibc
8053
8054 : see if endspent exists
8055 set endspent d_endspent
8056 eval $inlibc
8057
8058 : Locate the flags for 'open()'
8059 echo " "
8060 $cat >open3.c <<'EOCP'
8061 #include <sys/types.h>
8062 #ifdef I_FCNTL
8063 #include <fcntl.h>
8064 #endif
8065 #ifdef I_SYS_FILE
8066 #include <sys/file.h>
8067 #endif
8068 int main() {
8069         if(O_RDONLY);
8070 #ifdef O_TRUNC
8071         exit(0);
8072 #else
8073         exit(1);
8074 #endif
8075 }
8076 EOCP
8077 : check sys/file.h first to get FREAD on Sun
8078 if $test `./findhdr sys/file.h` && \
8079                 set open3 -DI_SYS_FILE && eval $compile; then
8080         h_sysfile=true;
8081         echo "<sys/file.h> defines the O_* constants..." >&4
8082         if ./open3; then
8083                 echo "and you have the 3 argument form of open()." >&4
8084                 val="$define"
8085         else
8086                 echo "but not the 3 argument form of open().  Oh, well." >&4
8087                 val="$undef"
8088         fi
8089 elif $test `./findhdr fcntl.h` && \
8090                 set open3 -DI_FCNTL && eval $compile; then
8091         h_fcntl=true;
8092         echo "<fcntl.h> defines the O_* constants..." >&4
8093         if ./open3; then
8094                 echo "and you have the 3 argument form of open()." >&4
8095                 val="$define"
8096         else
8097                 echo "but not the 3 argument form of open().  Oh, well." >&4
8098                 val="$undef"
8099         fi
8100 else
8101         val="$undef"
8102         echo "I can't find the O_* constant definitions!  You got problems." >&4
8103 fi
8104 set d_open3
8105 eval $setvar
8106 $rm -f open3*
8107
8108 : check for non-blocking I/O stuff
8109 case "$h_sysfile" in
8110 true) echo "#include <sys/file.h>" > head.c;;
8111 *)
8112         case "$h_fcntl" in
8113         true) echo "#include <fcntl.h>" > head.c;;
8114         *) echo "#include <sys/fcntl.h>" > head.c;;
8115         esac
8116         ;;
8117 esac
8118 echo " "
8119 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
8120 case "$o_nonblock" in
8121 '')
8122         $cat head.c > try.c
8123         $cat >>try.c <<'EOCP'
8124 int main() {
8125 #ifdef O_NONBLOCK
8126         printf("O_NONBLOCK\n");
8127         exit(0);
8128 #endif
8129 #ifdef O_NDELAY
8130         printf("O_NDELAY\n");
8131         exit(0);
8132 #endif
8133 #ifdef FNDELAY
8134         printf("FNDELAY\n");
8135         exit(0);
8136 #endif
8137         exit(0);
8138 }
8139 EOCP
8140         set try
8141         if eval $compile_ok; then
8142                 o_nonblock=`./try`
8143                 case "$o_nonblock" in
8144                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
8145                 *) echo "Seems like we can use $o_nonblock.";;
8146                 esac
8147         else
8148                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
8149         fi
8150         ;;
8151 *) echo "Using $hint value $o_nonblock.";;
8152 esac
8153 $rm -f try try.* .out core
8154
8155 echo " "
8156 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
8157 case "$eagain" in
8158 '')
8159         $cat head.c > try.c
8160         $cat >>try.c <<EOCP
8161 #include <errno.h>
8162 #include <sys/types.h>
8163 #include <signal.h>
8164 #define MY_O_NONBLOCK $o_nonblock
8165 #ifndef errno  /* XXX need better Configure test */
8166 extern int errno;
8167 #endif
8168 $signal_t blech(x) int x; { exit(3); }
8169 EOCP
8170         $cat >> try.c <<'EOCP'
8171 int main()
8172 {
8173         int pd[2];
8174         int pu[2];
8175         char buf[1];
8176         char string[100];
8177
8178         pipe(pd);       /* Down: child -> parent */
8179         pipe(pu);       /* Up: parent -> child */
8180         if (0 != fork()) {
8181                 int ret;
8182                 close(pd[1]);   /* Parent reads from pd[0] */
8183                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
8184                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
8185                         exit(1);
8186                 signal(SIGALRM, blech);
8187                 alarm(5);
8188                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
8189                         exit(2);
8190                 sprintf(string, "%d\n", ret);
8191                 write(2, string, strlen(string));
8192                 alarm(0);
8193 #ifdef EAGAIN
8194                 if (errno == EAGAIN) {
8195                         printf("EAGAIN\n");
8196                         goto ok;
8197                 }
8198 #endif
8199 #ifdef EWOULDBLOCK
8200                 if (errno == EWOULDBLOCK)
8201                         printf("EWOULDBLOCK\n");
8202 #endif
8203         ok:
8204                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
8205                 sleep(2);                               /* Give it time to close our pipe */
8206                 alarm(5);
8207                 ret = read(pd[0], buf, 1);      /* Should read EOF */
8208                 alarm(0);
8209                 sprintf(string, "%d\n", ret);
8210                 write(3, string, strlen(string));
8211                 exit(0);
8212         }
8213
8214         close(pd[0]);                   /* We write to pd[1] */
8215         close(pu[1]);                   /* We read from pu[0] */
8216         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
8217         close(pd[1]);                   /* Pipe pd is now fully closed! */
8218         exit(0);                                /* Bye bye, thank you for playing! */
8219 }
8220 EOCP
8221         set try
8222         if eval $compile_ok; then
8223                 echo "$startsh" >mtry
8224                 echo "./try >try.out 2>try.ret 3>try.err || exit 4" >>mtry
8225                 chmod +x mtry
8226                 ./mtry >/dev/null 2>&1
8227                 case $? in
8228                 0) eagain=`$cat try.out`;;
8229                 1) echo "Could not perform non-blocking setting!";;
8230                 2) echo "I did a successful read() for something that was not there!";;
8231                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
8232                 *) echo "Something terribly wrong happened during testing.";;
8233                 esac
8234                 rd_nodata=`$cat try.ret`
8235                 echo "A read() system call with no data present returns $rd_nodata."
8236                 case "$rd_nodata" in
8237                 0|-1) ;;
8238                 *)
8239                         echo "(That's peculiar, fixing that to be -1.)"
8240                         rd_nodata=-1
8241                         ;;
8242                 esac
8243                 case "$eagain" in
8244                 '')
8245                         echo "Forcing errno EAGAIN on read() with no data available."
8246                         eagain=EAGAIN
8247                         ;;
8248                 *)
8249                         echo "Your read() sets errno to $eagain when no data is available."
8250                         ;;
8251                 esac
8252                 status=`$cat try.err`
8253                 case "$status" in
8254                 0) echo "And it correctly returns 0 to signal EOF.";;
8255                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
8256                 *) echo "However, your read() returns '$status' on EOF??";;
8257                 esac
8258                 val="$define"
8259                 if test "$status" = "$rd_nodata"; then
8260                         echo "WARNING: you can't distinguish between EOF and no data!"
8261                         val="$undef"
8262                 fi
8263         else
8264                 echo "I can't compile the test program--assuming errno EAGAIN will do."
8265                 eagain=EAGAIN
8266         fi
8267         set d_eofnblk
8268         eval $setvar
8269         ;;
8270 *)
8271         echo "Using $hint value $eagain."
8272         echo "Your read() returns $rd_nodata when no data is present."
8273         case "$d_eofnblk" in
8274         "$define") echo "And you can see EOF because read() returns 0.";;
8275         "$undef") echo "But you can't see EOF status from read() returned value.";;
8276         *)
8277                 echo "(Assuming you can't see EOF status from read anyway.)"
8278                 d_eofnblk=$undef
8279                 ;;
8280         esac
8281         ;;
8282 esac
8283 $rm -f try try.* .out core head.c mtry
8284
8285 : see if fchmod exists
8286 set fchmod d_fchmod
8287 eval $inlibc
8288
8289 : see if fchown exists
8290 set fchown d_fchown
8291 eval $inlibc
8292
8293 : see if this is an fcntl system
8294 set fcntl d_fcntl
8295 eval $inlibc
8296
8297 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
8298 while $test $# -ge 2; do
8299         case "$1" in
8300         $define) echo "#include <$2>";;
8301         esac ;
8302     shift 2;
8303 done > try.c;
8304 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
8305 set try;
8306 if eval $compile; then
8307         val="$define";
8308 else
8309         val="$undef";
8310 fi;
8311 set $varname;
8312 eval $setvar;
8313 $rm -f try.c try.o'
8314
8315 socketlib=''
8316 sockethdr=''
8317 : see whether socket exists
8318 echo " "
8319 $echo $n "Hmm... $c" >&4
8320 if set socket val -f d_socket; eval $csym; $val; then
8321         echo "Looks like you have Berkeley networking support." >&4
8322         d_socket="$define"
8323         if set setsockopt val -f; eval $csym; $val; then
8324                 d_oldsock="$undef"
8325         else
8326                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
8327                 d_oldsock="$define"
8328         fi
8329 else
8330         if $contains socklib libc.list >/dev/null 2>&1; then
8331                 echo "Looks like you have Berkeley networking support." >&4
8332                 d_socket="$define"
8333                 : we will have to assume that it supports the 4.2 BSD interface
8334                 d_oldsock="$undef"
8335         else
8336                 echo "You don't have Berkeley networking in libc$_a..." >&4
8337                 if test "X$d_socket" = "X$define"; then
8338                    echo "...but you seem to believe that you have sockets." >&4
8339                 else
8340                         for net in net socket
8341                         do
8342                                 if test -f /usr/lib/lib$net$_a; then
8343                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
8344                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
8345                                         if $contains socket libc.list >/dev/null 2>&1; then
8346                                                 d_socket="$define"
8347                                                 socketlib="-l$net"
8348                                                 case "$net" in
8349                                                 net)
8350                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
8351                                                         sockethdr="-I/usr/netinclude"
8352                                                         ;;
8353                                                 esac
8354                                                 echo "Found Berkeley sockets interface in lib$net." >& 4 
8355                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
8356                                                         d_oldsock="$undef"
8357                                                 else
8358                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
8359                                                         d_oldsock="$define"
8360                                                 fi
8361                                                 break
8362                                         fi
8363                                 fi
8364                         done
8365                         if test "X$d_socket" != "X$define"; then
8366                            echo "or anywhere else I see." >&4
8367                            d_socket="$undef"
8368                            d_oldsock="$undef"
8369                         fi
8370                 fi
8371         fi
8372 fi
8373
8374 : see if socketpair exists
8375 set socketpair d_sockpair
8376 eval $inlibc
8377
8378
8379 echo " "
8380 echo "Checking the availability of certain socket constants..." >& 4
8381 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
8382         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
8383         $cat >try.c <<EOF
8384 #include <sys/types.h>
8385 #include <sys/socket.h>
8386 int main() {
8387     int i = $ENUM;
8388 }
8389 EOF
8390         val="$undef"
8391         set try; if eval $compile; then
8392                 val="$define"
8393         fi
8394         set d_${enum}; eval $setvar
8395         $rm -f try.c try
8396 done
8397
8398 : see if sys/select.h has to be included
8399 set sys/select.h i_sysselct
8400 eval $inhdr
8401
8402 : see if we should include time.h, sys/time.h, or both
8403 echo " "
8404 if test "X$timeincl" = X; then
8405         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
8406         $echo $n "I'm now running the test program...$c"
8407         $cat >try.c <<'EOCP'
8408 #include <sys/types.h>
8409 #ifdef I_TIME
8410 #include <time.h>
8411 #endif
8412 #ifdef I_SYSTIME
8413 #ifdef SYSTIMEKERNEL
8414 #define KERNEL
8415 #endif
8416 #include <sys/time.h>
8417 #endif
8418 #ifdef I_SYSSELECT
8419 #include <sys/select.h>
8420 #endif
8421 int main()
8422 {
8423         struct tm foo;
8424 #ifdef S_TIMEVAL
8425         struct timeval bar;
8426 #endif
8427 #ifdef S_TIMEZONE
8428         struct timezone tzp;
8429 #endif
8430         if (foo.tm_sec == foo.tm_sec)
8431                 exit(0);
8432 #ifdef S_TIMEVAL
8433         if (bar.tv_sec == bar.tv_sec)
8434                 exit(0);
8435 #endif
8436         exit(1);
8437 }
8438 EOCP
8439         flags=''
8440         for s_timezone in '-DS_TIMEZONE' ''; do
8441         sysselect=''
8442         for s_timeval in '-DS_TIMEVAL' ''; do
8443         for i_systimek in '' '-DSYSTIMEKERNEL'; do
8444         for i_time in '' '-DI_TIME'; do
8445         for i_systime in '-DI_SYSTIME' ''; do
8446                 case "$flags" in
8447                 '') $echo $n ".$c"
8448                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
8449                         if eval $compile; then
8450                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
8451                                 shift
8452                                 flags="$*"
8453                                 echo " "
8454                                 $echo $n "Succeeded with $flags$c"
8455                         fi
8456                         ;;
8457                 esac
8458         done
8459         done
8460         done
8461         done
8462         done
8463         timeincl=''
8464         echo " "
8465         case "$flags" in
8466         *SYSTIMEKERNEL*) i_systimek="$define"
8467                 timeincl=`./findhdr sys/time.h`
8468                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
8469         *) i_systimek="$undef";;
8470         esac
8471         case "$flags" in
8472         *I_TIME*) i_time="$define"
8473                 timeincl=`./findhdr time.h`" $timeincl"
8474                 echo "We'll include <time.h>." >&4;;
8475         *) i_time="$undef";;
8476         esac
8477         case "$flags" in
8478         *I_SYSTIME*) i_systime="$define"
8479                 timeincl=`./findhdr sys/time.h`" $timeincl"
8480                 echo "We'll include <sys/time.h>." >&4;;
8481         *) i_systime="$undef";;
8482         esac
8483         $rm -f try.c try
8484 fi
8485
8486 : check for fd_set items
8487 $cat <<EOM
8488
8489 Checking to see how well your C compiler handles fd_set and friends ...
8490 EOM
8491 $cat >fd_set.c <<EOCP
8492 #$i_systime I_SYS_TIME
8493 #$i_sysselct I_SYS_SELECT
8494 #$d_socket HAS_SOCKET
8495 #include <sys/types.h>
8496 #ifdef HAS_SOCKET
8497 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
8498 #endif
8499 #ifdef I_SYS_TIME
8500 #include <sys/time.h>
8501 #endif
8502 #ifdef I_SYS_SELECT
8503 #include <sys/select.h>
8504 #endif
8505 int main() {
8506         fd_set fds;
8507
8508 #ifdef TRYBITS
8509         if(fds.fds_bits);
8510 #endif
8511
8512 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
8513         exit(0);
8514 #else
8515         exit(1);
8516 #endif
8517 }
8518 EOCP
8519 set fd_set -DTRYBITS
8520 if eval $compile; then
8521         d_fds_bits="$define"
8522         d_fd_set="$define"
8523         echo "Well, your system knows about the normal fd_set typedef..." >&4
8524         if ./fd_set; then
8525                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
8526                 d_fd_macros="$define"
8527         else
8528                 $cat >&4 <<'EOM'
8529 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
8530 EOM
8531                 d_fd_macros="$undef"
8532         fi
8533 else
8534         $cat <<'EOM'
8535 Hmm, your compiler has some difficulty with fd_set.  Checking further...
8536 EOM
8537         set fd_set
8538         if eval $compile; then
8539                 d_fds_bits="$undef"
8540                 d_fd_set="$define"
8541                 echo "Well, your system has some sort of fd_set available..." >&4
8542                 if ./fd_set; then
8543                         echo "and you have the normal fd_set macros." >&4
8544                         d_fd_macros="$define"
8545                 else
8546                         $cat <<'EOM'
8547 but not the normal fd_set macros!  Gross!  More work for me...
8548 EOM
8549                         d_fd_macros="$undef"
8550                 fi
8551         else
8552         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
8553                 d_fd_set="$undef"
8554                 d_fds_bits="$undef"
8555                 d_fd_macros="$undef"
8556         fi
8557 fi
8558 $rm -f fd_set*
8559
8560 : see if fgetpos exists
8561 set fgetpos d_fgetpos
8562 eval $inlibc
8563
8564 : see if flock exists
8565 set flock d_flock
8566 eval $inlibc
8567
8568 : see if fork exists
8569 set fork d_fork
8570 eval $inlibc
8571
8572 : see if pathconf exists
8573 set pathconf d_pathconf
8574 eval $inlibc
8575
8576 : see if fpathconf exists
8577 set fpathconf d_fpathconf
8578 eval $inlibc
8579
8580
8581 : see if llseek exists
8582 set llseek d_llseek
8583 eval $inlibc
8584
8585 : check for off64_t
8586 echo " "
8587 $echo $n "Checking to see if your system supports off64_t...$c" >&4
8588 $cat >try.c <<EOCP
8589 #include <sys/types.h>
8590 #include <unistd.h>
8591 off64_t foo() { off64_t x; x = 7; return x; }'
8592 EOCP
8593 if $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then
8594         val="$define"
8595         echo " Yup, it does." >&4
8596 else
8597         val="$undef"
8598         echo " Nope, it doesn't." >&4
8599 fi
8600 $rm -f try.*
8601 set d_off64_t
8602 eval $setvar
8603
8604 : check for fpos64_t
8605 echo " "
8606 $echo $n "Checking to see if your system supports fpos64_t...$c" >&4
8607 $cat >try.c <<EOCP
8608 #include <sys/stdio.h>
8609 fpos64_t foo() { fpos64_t x; x = 7; return x; }'
8610 EOCP
8611 if $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then
8612         val="$define"
8613         echo " Yup, it does." >&4
8614 else
8615         val="$undef"
8616         echo " Nope, it doesn't." >&4
8617 fi
8618 $rm -f try.*
8619 set d_fpos64_t
8620 eval $setvar
8621
8622 hasstruct='varname=$1; struct=$2; shift; shift;
8623 while $test $# -ge 2; do
8624         case "$1" in
8625         $define) echo "#include <$2>";;
8626         esac ;
8627     shift 2;
8628 done > try.c;
8629 echo "int main () { struct $struct foo; }" >> try.c;
8630 set try;
8631 if eval $compile; then
8632         val="$define";
8633 else
8634         val="$undef";
8635 fi;
8636 set $varname;
8637 eval $setvar;
8638 $rm -f try.c try.o'
8639
8640 : see if this is a sys/param system
8641 set sys/param.h i_sysparam
8642 eval $inhdr
8643
8644 : see if this is a sys/mount.h system
8645 set sys/mount.h i_sysmount
8646 eval $inhdr
8647
8648 : see if sys/types.h has to be included
8649 set sys/types.h i_systypes
8650 eval $inhdr
8651
8652
8653 echo " "
8654 echo "Checking to see if your system supports struct fs_data..." >&4
8655 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
8656 eval $hasstruct
8657 case "$d_fs_data_s" in
8658 "$define")      echo "Yup, it does."     >&4 ;;
8659 *)              echo "Nope, it doesn't." >&4 ;;
8660 esac
8661
8662 : see if fseeko exists
8663 set fseeko d_fseeko
8664 eval $inlibc
8665
8666 : see if fsetpos exists
8667 set fsetpos d_fsetpos
8668 eval $inlibc
8669
8670
8671 : see if fstatfs exists
8672 set fstatfs d_fstatfs
8673 eval $inlibc
8674
8675
8676 : see if statvfs exists
8677 set statvfs d_statvfs
8678 eval $inlibc
8679
8680 : see if fstatvfs exists
8681 set fstatvfs d_fstatvfs
8682 eval $inlibc
8683
8684
8685 : see if ftello exists
8686 set ftello d_ftello
8687 eval $inlibc
8688
8689 : see if getgrent exists
8690 set getgrent d_getgrent
8691 eval $inlibc
8692
8693 : see if gethostbyaddr exists
8694 set gethostbyaddr d_gethbyaddr
8695 eval $inlibc
8696
8697 : see if gethostbyname exists
8698 set gethostbyname d_gethbyname
8699 eval $inlibc
8700
8701 : see if gethostent exists
8702 set gethostent d_gethent
8703 eval $inlibc
8704
8705 : see how we will look up host name
8706 echo " "
8707 call=''
8708 if set gethostname val -f d_gethname; eval $csym; $val; then
8709         echo 'gethostname() found.' >&4
8710         d_gethname="$define"
8711         call=gethostname
8712 fi
8713 if set uname val -f d_uname; eval $csym; $val; then
8714         if ./xenix; then
8715                 $cat <<'EOM'
8716 uname() was found, but you're running xenix, and older versions of xenix
8717 have a broken uname(). If you don't really know whether your xenix is old
8718 enough to have a broken system call, use the default answer.
8719
8720 EOM
8721                 dflt=y
8722                 case "$d_uname" in
8723                 "$define") dflt=n;;
8724                 esac
8725                 rp='Is your uname() broken?'
8726                 . ./myread
8727                 case "$ans" in
8728                 n*) d_uname="$define"; call=uname;;
8729                 esac
8730         else
8731                 echo 'uname() found.' >&4
8732                 d_uname="$define"
8733                 case "$call" in
8734                 '') call=uname ;;
8735                 esac
8736         fi
8737 fi
8738 case "$d_gethname" in
8739 '') d_gethname="$undef";;
8740 esac
8741 case "$d_uname" in
8742 '') d_uname="$undef";;
8743 esac
8744 case "$d_uname$d_gethname" in
8745 *define*)
8746         dflt=n
8747         cat <<EOM
8748  
8749 Every now and then someone has a $call() that lies about the hostname
8750 but can't be fixed for political or economic reasons.  If you wish, I can
8751 pretend $call() isn't there and maybe compute hostname at run-time
8752 thanks to the '$phostname' command.
8753
8754 EOM
8755         rp="Shall I ignore $call() from now on?"
8756         . ./myread
8757         case "$ans" in
8758         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
8759         esac;;
8760 esac
8761 case "$phostname" in
8762 '') aphostname='';;
8763 *) case "$aphostname" in
8764         /*) ;;
8765         *) set X $phostname
8766                 shift
8767                 file=$1
8768                 shift
8769                 file=`./loc $file $file $pth`
8770                 aphostname=`echo $file $*`
8771                 ;;
8772         esac
8773         ;;
8774 esac
8775 case "$d_uname$d_gethname" in
8776 *define*) ;;
8777 *)
8778         case "$phostname" in
8779         '')
8780                 echo "There will be no way for $package to get your hostname." >&4;;
8781         *)
8782         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
8783                 ;;
8784         esac;;
8785 esac
8786 case "$d_phostname" in
8787 '') d_phostname="$undef";;
8788 esac
8789
8790 : see if this is a netdb.h system
8791 set netdb.h i_netdb
8792 eval $inhdr
8793
8794 : see if prototypes for various gethostxxx netdb.h functions are available
8795 echo " "
8796 set d_gethostprotos gethostent $i_netdb netdb.h
8797 eval $hasproto
8798
8799 : see if getlogin exists
8800 set getlogin d_getlogin
8801 eval $inlibc
8802
8803 : see if getmnt exists
8804 set getmnt d_getmnt
8805 eval $inlibc
8806
8807 : see if getmntent exists
8808 set getmntent d_getmntent
8809 eval $inlibc
8810
8811 : see if getnetbyaddr exists
8812 set getnetbyaddr d_getnbyaddr
8813 eval $inlibc
8814
8815 : see if getnetbyname exists
8816 set getnetbyname d_getnbyname
8817 eval $inlibc
8818
8819 : see if getnetent exists
8820 set getnetent d_getnent
8821 eval $inlibc
8822
8823 : see if prototypes for various getnetxxx netdb.h functions are available
8824 echo " "
8825 set d_getnetprotos getnetent $i_netdb netdb.h
8826 eval $hasproto
8827
8828
8829 : see if getprotobyname exists
8830 set getprotobyname d_getpbyname
8831 eval $inlibc
8832
8833 : see if getprotobynumber exists
8834 set getprotobynumber d_getpbynumber
8835 eval $inlibc
8836
8837 : see if getprotoent exists
8838 set getprotoent d_getpent
8839 eval $inlibc
8840
8841 : see if getpgid exists
8842 set getpgid d_getpgid
8843 eval $inlibc
8844
8845 : see if getpgrp2 exists
8846 set getpgrp2 d_getpgrp2
8847 eval $inlibc
8848
8849 : see if getppid exists
8850 set getppid d_getppid
8851 eval $inlibc
8852
8853 : see if getpriority exists
8854 set getpriority d_getprior
8855 eval $inlibc
8856
8857 : see if prototypes for various getprotoxxx netdb.h functions are available
8858 echo " "
8859 set d_getprotoprotos getprotoent $i_netdb netdb.h
8860 eval $hasproto
8861
8862 : see if getpwent exists
8863 set getpwent d_getpwent
8864 eval $inlibc
8865
8866
8867 : see if getservbyname exists
8868 set getservbyname d_getsbyname
8869 eval $inlibc
8870
8871 : see if getservbyport exists
8872 set getservbyport d_getsbyport
8873 eval $inlibc
8874
8875 : see if getservent exists
8876 set getservent d_getsent
8877 eval $inlibc
8878
8879 : see if prototypes for various getservxxx netdb.h functions are available
8880 echo " "
8881 set d_getservprotos getservent $i_netdb netdb.h
8882 eval $hasproto
8883
8884 : see if getspent exists
8885 set getspent d_getspent
8886 eval $inlibc
8887
8888 : see if getspnam exists
8889 set getspnam d_getspnam
8890 eval $inlibc
8891
8892 : see if gettimeofday or ftime exists
8893 set gettimeofday d_gettimeod
8894 eval $inlibc
8895 case "$d_gettimeod" in
8896 "$undef")
8897         set ftime d_ftime 
8898         eval $inlibc
8899         ;;
8900 *)
8901         val="$undef"; set d_ftime; eval $setvar
8902         ;;
8903 esac
8904 case "$d_gettimeod$d_ftime" in
8905 "$undef$undef")
8906         echo " "
8907         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
8908         ;;
8909 esac
8910
8911 : see if this is an grp system
8912 set grp.h i_grp
8913 eval $inhdr
8914
8915 case "$i_grp" in
8916 $define)
8917         xxx=`./findhdr grp.h`
8918         $cppstdin $cppflags $cppminus < $xxx >$$.h
8919
8920         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
8921                 val="$define"
8922         else
8923                 val="$undef"
8924         fi
8925         set d_grpasswd
8926         eval $setvar
8927
8928         $rm -f $$.h
8929         ;;
8930 *)
8931         val="$undef";
8932         set d_grpasswd; eval $setvar
8933         ;;
8934 esac
8935
8936 : see if hasmntopt exists
8937 set hasmntopt d_hasmntopt
8938 eval $inlibc
8939
8940 : see if this is a netinet/in.h or sys/in.h system
8941 set netinet/in.h i_niin sys/in.h i_sysin
8942 eval $inhdr
8943
8944 : see if arpa/inet.h has to be included
8945 set arpa/inet.h i_arpainet
8946 eval $inhdr
8947
8948 : see if htonl --and friends-- exists
8949 val=''
8950 set htonl val
8951 eval $inlibc
8952
8953 : Maybe they are macros.
8954 case "$val" in
8955 $undef)
8956         $cat >htonl.c <<EOM
8957 #include <stdio.h>
8958 #include <sys/types.h>
8959 #$i_niin I_NETINET_IN
8960 #$i_sysin I_SYS_IN
8961 #$i_arpainet I_ARPA_INET
8962 #ifdef I_NETINET_IN
8963 #include <netinet/in.h>
8964 #endif
8965 #ifdef I_SYS_IN
8966 #include <sys/in.h>
8967 #endif
8968 #ifdef I_ARPA_INET
8969 #include <arpa/inet.h>
8970 #endif
8971 #ifdef htonl
8972 printf("Defined as a macro.");
8973 #endif
8974 EOM
8975         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
8976         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
8977                 val="$define"
8978                 echo "But it seems to be defined as a macro." >&4
8979         fi
8980         $rm -f htonl.?
8981         ;;
8982 esac
8983 set d_htonl
8984 eval $setvar
8985
8986 : see which of string.h or strings.h is needed
8987 echo " "
8988 strings=`./findhdr string.h`
8989 if $test "$strings" && $test -r "$strings"; then
8990         echo "Using <string.h> instead of <strings.h>." >&4
8991         val="$define"
8992 else
8993         val="$undef"
8994         strings=`./findhdr strings.h`
8995         if $test "$strings" && $test -r "$strings"; then
8996                 echo "Using <strings.h> instead of <string.h>." >&4
8997         else
8998                 echo "No string header found -- You'll surely have problems." >&4
8999         fi
9000 fi
9001 set i_string
9002 eval $setvar
9003 case "$i_string" in
9004 "$undef") strings=`./findhdr strings.h`;;
9005 *)        strings=`./findhdr string.h`;;
9006 esac
9007
9008 : index or strchr
9009 echo " "
9010 if set index val -f; eval $csym; $val; then
9011         if set strchr val -f d_strchr; eval $csym; $val; then
9012                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
9013                         val="$define"
9014                         vali="$undef"
9015                         echo "strchr() found." >&4
9016                 else
9017                         val="$undef"
9018                         vali="$define"
9019                         echo "index() found." >&4
9020                 fi
9021         else
9022                 val="$undef"
9023                 vali="$define"
9024                 echo "index() found." >&4
9025         fi
9026 else
9027         if set strchr val -f d_strchr; eval $csym; $val; then
9028                 val="$define"
9029                 vali="$undef"
9030                 echo "strchr() found." >&4
9031         else
9032                 echo "No index() or strchr() found!" >&4
9033                 val="$undef"
9034                 vali="$undef"
9035         fi
9036 fi
9037 set d_strchr; eval $setvar
9038 val="$vali"
9039 set d_index; eval $setvar
9040
9041 : check whether inet_aton exists
9042 set inet_aton d_inetaton
9043 eval $inlibc
9044
9045 : Look for isascii
9046 echo " "
9047 $cat >isascii.c <<'EOCP'
9048 #include <stdio.h>
9049 #include <ctype.h>
9050 int main() {
9051         int c = 'A';
9052         if (isascii(c))
9053                 exit(0);
9054         else
9055                 exit(1);
9056 }
9057 EOCP
9058 set isascii
9059 if eval $compile; then
9060         echo "isascii() found." >&4
9061         val="$define"
9062 else
9063         echo "isascii() NOT found." >&4
9064         val="$undef"
9065 fi
9066 set d_isascii
9067 eval $setvar
9068 $rm -f isascii*
9069
9070 : see if killpg exists
9071 set killpg d_killpg
9072 eval $inlibc
9073
9074 : see if lchown exists
9075 echo " "
9076 $cat > try.c <<'EOCP'
9077 /* System header to define __stub macros and hopefully few prototypes,
9078     which can conflict with char lchown(); below.  */
9079 #include <assert.h>
9080 /* Override any gcc2 internal prototype to avoid an error.  */
9081 /* We use char because int might match the return type of a gcc2
9082    builtin and then its argument prototype would still apply.  */
9083 char lchown();
9084 int main() {
9085     /*  The GNU C library defines this for functions which it implements
9086         to always fail with ENOSYS.  Some functions are actually named
9087         something starting with __ and the normal name is an alias.  */
9088 #if defined (__stub_lchown) || defined (__stub___lchown)
9089 choke me
9090 #else
9091 lchown();
9092 #endif
9093 ; return 0; }
9094 EOCP
9095 set try
9096 if eval $compile; then
9097     $echo "lchown() found." >&4
9098     val="$define"
9099 else
9100     $echo "lchown() NOT found." >&4
9101     val="$undef"
9102 fi
9103 set d_lchown
9104 eval $setvar
9105
9106 : See if number of significant digits in a double precision number is known
9107 echo " "
9108 $cat >ldbl_dig.c <<EOM
9109 #$i_limits I_LIMITS
9110 #$i_float I_FLOAT
9111 #ifdef I_LIMITS
9112 #include <limits.h>
9113 #endif
9114 #ifdef I_FLOAT
9115 #include <float.h>
9116 #endif
9117 #ifdef LDBL_DIG
9118 printf("Contains LDBL_DIG");
9119 #endif
9120 EOM
9121 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
9122 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
9123         echo "LDBL_DIG found." >&4
9124         val="$define"
9125 else
9126         echo "LDBL_DIG NOT found." >&4
9127         val="$undef"
9128 fi
9129 $rm -f ldbl_dig.?
9130 set d_ldbl_dig
9131 eval $setvar
9132
9133 : see if link exists
9134 set link d_link
9135 eval $inlibc
9136
9137 : see if localeconv exists
9138 set localeconv d_locconv
9139 eval $inlibc
9140
9141 : see if lockf exists
9142 set lockf d_lockf
9143 eval $inlibc
9144
9145 : see if lstat exists
9146 set lstat d_lstat
9147 eval $inlibc
9148
9149 : see if mblen exists
9150 set mblen d_mblen
9151 eval $inlibc
9152
9153 : see if mbstowcs exists
9154 set mbstowcs d_mbstowcs
9155 eval $inlibc
9156
9157 : see if mbtowc exists
9158 set mbtowc d_mbtowc
9159 eval $inlibc
9160
9161 : see if memchr exists
9162 set memchr d_memchr
9163 eval $inlibc
9164
9165 : see if memcmp exists
9166 set memcmp d_memcmp
9167 eval $inlibc
9168
9169 : see if memcpy exists
9170 set memcpy d_memcpy
9171 eval $inlibc
9172
9173 : see if memmove exists
9174 set memmove d_memmove
9175 eval $inlibc
9176
9177 : see if memset exists
9178 set memset d_memset
9179 eval $inlibc
9180
9181 : see if mkdir exists
9182 set mkdir d_mkdir
9183 eval $inlibc
9184
9185 : see if mkfifo exists
9186 set mkfifo d_mkfifo
9187 eval $inlibc
9188
9189 : see if mktime exists
9190 set mktime d_mktime
9191 eval $inlibc
9192
9193 : see if msgctl exists
9194 set msgctl d_msgctl
9195 eval $inlibc
9196
9197 : see if msgget exists
9198 set msgget d_msgget
9199 eval $inlibc
9200
9201 : see if msgsnd exists
9202 set msgsnd d_msgsnd
9203 eval $inlibc
9204
9205 : see if msgrcv exists
9206 set msgrcv d_msgrcv
9207 eval $inlibc
9208
9209 : see how much of the 'msg*(2)' library is present.
9210 h_msg=true
9211 echo " "
9212 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
9213 *"$undef"*) h_msg=false;;
9214 esac
9215 case "$osname" in
9216 freebsd)
9217     case "`ipcs 2>&1`" in
9218     "SVID messages"*"not configured"*)
9219         echo "Your $osname does not have the msg*(2) configured." >&4
9220         h_msg=false
9221         val="$undef"
9222         set msgctl d_msgctl
9223         eval $setvar
9224         set msgget d_msgget
9225         eval $setvar
9226         set msgsnd d_msgsnd
9227         eval $setvar
9228         set msgrcv d_msgrcv
9229         eval $setvar
9230         ;;
9231     esac
9232     ;;
9233 esac
9234 : we could also check for sys/ipc.h ...
9235 if $h_msg && $test `./findhdr sys/msg.h`; then
9236         echo "You have the full msg*(2) library." >&4
9237         val="$define"
9238 else
9239         echo "You don't have the full msg*(2) library." >&4
9240         val="$undef"
9241 fi
9242 set d_msg
9243 eval $setvar
9244
9245 : see if nice exists
9246 set nice d_nice
9247 eval $inlibc
9248
9249 : see if POSIX threads are available
9250 set pthread.h i_pthread
9251 eval $inhdr
9252
9253
9254
9255
9256 : how to create joinable pthreads
9257 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
9258         echo " "
9259         echo "Checking what constant to use for creating joinable pthreads..." >&4 
9260         $cat >try.c <<'EOCP'
9261 #include <pthread.h>
9262 int main() {
9263     int detachstate = JOINABLE;
9264 }
9265 EOCP
9266         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
9267         if eval $compile; then
9268                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
9269                 val="$undef" # Yes, undef.
9270                 set d_old_pthread_create_joinable
9271                 eval $setvar
9272                 val=""
9273                 set old_pthread_create_joinable
9274                 eval $setvar
9275         else
9276                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
9277                 if eval $compile; then
9278                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
9279                         val="$define"
9280                         set d_old_pthread_create_joinable
9281                         eval $setvar
9282                         val=PTHREAD_CREATE_UNDETACHED
9283                         set old_pthread_create_joinable
9284                         eval $setvar
9285                 else            
9286                         set try -DJOINABLE=__UNDETACHED
9287                         if eval $compile; then
9288                                 echo "You seem to use __UNDETACHED." >&4
9289                                 val="$define"
9290                                 set d_old_pthread_create_joinable
9291                                 eval $setvar
9292                                 val=__UNDETACHED
9293                                 set old_pthread_create_joinable
9294                                 eval $setvar
9295                         else
9296                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
9297                                 val="$define"
9298                                 set d_old_pthread_create_joinable
9299                                 eval $setvar
9300                                 val=0
9301                                 set old_pthread_create_joinable
9302                                 eval $setvar
9303                         fi
9304                 fi
9305         fi
9306         $rm -f try try.*
9307 else
9308     d_old_pthread_create_joinable="$undef"
9309     old_pthread_create_joinable=""
9310 fi
9311
9312 : see if pause exists
9313 set pause d_pause
9314 eval $inlibc
9315
9316 : see if pipe exists
9317 set pipe d_pipe
9318 eval $inlibc
9319
9320 : see if poll exists
9321 set poll d_poll
9322 eval $inlibc
9323
9324
9325 : see whether the various POSIXish _yields exist
9326 $cat >try.c <<EOP
9327 #include <pthread.h>
9328 #include <stdio.h>
9329 int main() {
9330 #ifdef SCHED_YIELD
9331         sched_yield();
9332 #else
9333 #ifdef PTHREAD_YIELD
9334         pthread_yield();
9335 #else
9336 #ifdef PTHREAD_YIELD_NULL
9337         pthread_yield(NULL);
9338 #endif
9339 #endif
9340 #endif
9341 }
9342 EOP
9343 : see if sched_yield exists
9344 set try -DSCHED_YIELD
9345 if eval $compile; then
9346     val="$define"
9347     sched_yield='sched_yield()'
9348 else
9349     val="$undef"
9350 fi
9351 case "$usethreads" in
9352 $define)
9353         case "$val" in
9354         $define) echo 'sched_yield() found.' >&4        ;;
9355         *)       echo 'sched_yield() NOT found.' >&4    ;;
9356         esac
9357 esac
9358 set d_sched_yield
9359 eval $setvar
9360
9361 : see if pthread_yield exists
9362 set try -DPTHREAD_YIELD
9363 if eval $compile; then
9364     val="$define"
9365     case "$sched_yield" in
9366     '') sched_yield='pthread_yield()' ;;
9367     esac
9368 else
9369     set try -DPTHREAD_YIELD_NULL
9370     if eval $compile; then
9371         val="$define"
9372         case "$sched_yield" in
9373         '') sched_yield='pthread_yield(NULL)' ;;
9374         esac
9375     else
9376         val="$undef"
9377     fi
9378 fi
9379 case "$usethreads" in
9380 $define)
9381         case "$val" in
9382         $define) echo 'pthread_yield() found.' >&4      ;;
9383         *)       echo 'pthread_yield() NOT found.' >&4  ;;
9384         esac
9385         ;;
9386 esac
9387 set d_pthread_yield
9388 eval $setvar
9389
9390 case "$sched_yield" in
9391 '') sched_yield=undef ;;
9392 esac
9393
9394 $rm -f try try.*
9395
9396 : see if this is a pwd.h system
9397 set pwd.h i_pwd
9398 eval $inhdr
9399
9400 case "$i_pwd" in
9401 $define)
9402         xxx=`./findhdr pwd.h`
9403         $cppstdin $cppflags $cppminus < $xxx >$$.h
9404
9405         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
9406                 val="$define"
9407         else
9408                 val="$undef"
9409         fi
9410         set d_pwquota
9411         eval $setvar
9412
9413         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
9414                 val="$define"
9415         else
9416                 val="$undef"
9417         fi
9418         set d_pwage
9419         eval $setvar
9420
9421         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
9422                 val="$define"
9423         else
9424                 val="$undef"
9425         fi
9426         set d_pwchange
9427         eval $setvar
9428
9429         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
9430                 val="$define"
9431         else
9432                 val="$undef"
9433         fi
9434         set d_pwclass
9435         eval $setvar
9436
9437         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
9438                 val="$define"
9439         else
9440                 val="$undef"
9441         fi
9442         set d_pwexpire
9443         eval $setvar
9444
9445         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
9446                 val="$define"
9447         else
9448                 val="$undef"
9449         fi
9450         set d_pwcomment
9451         eval $setvar
9452
9453         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
9454                 val="$define"
9455         else
9456                 val="$undef"
9457         fi
9458         set d_pwgecos
9459         eval $setvar
9460
9461         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
9462                 val="$define"
9463         else
9464                 val="$undef"
9465         fi
9466         set d_pwpasswd
9467         eval $setvar
9468
9469         $rm -f $$.h
9470         ;;
9471 *)
9472         val="$undef"; 
9473         set d_pwquota; eval $setvar
9474         set d_pwage; eval $setvar
9475         set d_pwchange; eval $setvar
9476         set d_pwclass; eval $setvar
9477         set d_pwexpire; eval $setvar
9478         set d_pwcomment; eval $setvar
9479         set d_pwgecos; eval $setvar
9480         set d_pwpasswd; eval $setvar
9481         ;;
9482 esac
9483
9484 : see if readdir and friends exist
9485 set readdir d_readdir
9486 eval $inlibc
9487 set seekdir d_seekdir
9488 eval $inlibc
9489 set telldir d_telldir
9490 eval $inlibc
9491 set rewinddir d_rewinddir
9492 eval $inlibc
9493
9494 : see if readlink exists
9495 set readlink d_readlink
9496 eval $inlibc
9497
9498 : see if rename exists
9499 set rename d_rename
9500 eval $inlibc
9501
9502 : see if rmdir exists
9503 set rmdir d_rmdir
9504 eval $inlibc
9505
9506 : see if memory.h is available.
9507 val=''
9508 set memory.h val
9509 eval $inhdr
9510
9511 : See if it conflicts with string.h
9512 case "$val" in
9513 $define)
9514         case "$strings" in
9515         '') ;;
9516         *)
9517                 $cppstdin $cppflags $cppminus < $strings > mem.h
9518                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
9519                         echo " "
9520                         echo "We won't be including <memory.h>."
9521                         val="$undef"
9522                 fi
9523                 $rm -f mem.h
9524                 ;;
9525         esac
9526 esac
9527 set i_memory
9528 eval $setvar
9529
9530 : can bcopy handle overlapping blocks?
9531 val="$undef"
9532 case "$d_bcopy" in
9533 "$define")
9534         echo " "
9535         echo "Checking to see if your bcopy() can do overlapping copies..." >&4
9536         $cat >try.c <<EOCP
9537 #$i_memory I_MEMORY
9538 #$i_stdlib I_STDLIB
9539 #$i_string I_STRING
9540 #$i_unistd I_UNISTD
9541 EOCP
9542         $cat >>try.c <<'EOCP'
9543 #include <stdio.h>
9544 #ifdef I_MEMORY
9545 #  include <memory.h>
9546 #endif
9547 #ifdef I_STDLIB
9548 #  include <stdlib.h>
9549 #endif
9550 #ifdef I_STRING
9551 #  include <string.h>
9552 #else
9553 #  include <strings.h>
9554 #endif
9555 #ifdef I_UNISTD
9556 #  include <unistd.h>  /* Needed for NetBSD */
9557 #endif
9558 int main()
9559 {
9560 char buf[128], abc[128];
9561 char *b;
9562 int len;
9563 int off;
9564 int align;
9565
9566 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
9567
9568 for (align = 7; align >= 0; align--) {
9569         for (len = 36; len; len--) {
9570                 b = buf+align;
9571                 bcopy(abc, b, len);
9572                 for (off = 1; off <= len; off++) {
9573                         bcopy(b, b+off, len);
9574                         bcopy(b+off, b, len);
9575                         if (bcmp(b, abc, len))
9576                                 exit(1);
9577                 }
9578         }
9579 }
9580 exit(0);
9581 }
9582 EOCP
9583         set try
9584         if eval $compile_ok; then
9585                 if ./try 2>/dev/null; then
9586                         echo "Yes, it can."
9587                         val="$define"
9588                 else
9589                         echo "It can't, sorry."
9590                         case "$d_memmove" in
9591                         "$define") echo "But that's Ok since you have memmove()." ;;
9592                         esac
9593                 fi
9594         else
9595                 echo "(I can't compile the test program, so we'll assume not...)"
9596                 case "$d_memmove" in
9597                 "$define") echo "But that's Ok since you have memmove()." ;;
9598                 esac
9599         fi
9600         ;;
9601 esac
9602 $rm -f try.* try core
9603 set d_safebcpy
9604 eval $setvar
9605
9606 : can memcpy handle overlapping blocks?
9607 val="$undef"
9608 case "$d_memcpy" in
9609 "$define")
9610         echo " "
9611         echo "Checking to see if your memcpy() can do overlapping copies..." >&4
9612         $cat >try.c <<EOCP
9613 #$i_memory I_MEMORY
9614 #$i_stdlib I_STDLIB
9615 #$i_string I_STRING
9616 #$i_unistd I_UNISTD
9617 EOCP
9618         $cat >>try.c <<'EOCP'
9619 #include <stdio.h>
9620 #ifdef I_MEMORY
9621 #  include <memory.h>
9622 #endif
9623 #ifdef I_STDLIB
9624 #  include <stdlib.h>
9625 #endif
9626 #ifdef I_STRING
9627 #  include <string.h>
9628 #else
9629 #  include <strings.h>
9630 #endif
9631 #ifdef I_UNISTD
9632 #  include <unistd.h>  /* Needed for NetBSD */
9633 #endif
9634 int main()
9635 {
9636 char buf[128], abc[128];
9637 char *b;
9638 int len;
9639 int off;
9640 int align;
9641
9642 /* Copy "abcde..." string to char abc[] so that gcc doesn't
9643    try to store the string in read-only memory. */
9644 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
9645
9646 for (align = 7; align >= 0; align--) {
9647         for (len = 36; len; len--) {
9648                 b = buf+align;
9649                 memcpy(b, abc, len);
9650                 for (off = 1; off <= len; off++) {
9651                         memcpy(b+off, b, len);
9652                         memcpy(b, b+off, len);
9653                         if (memcmp(b, abc, len))
9654                                 exit(1);
9655                 }
9656         }
9657 }
9658 exit(0);
9659 }
9660 EOCP
9661         set try
9662         if eval $compile_ok; then
9663                 if ./try 2>/dev/null; then
9664                         echo "Yes, it can."
9665                         val="$define"
9666                 else
9667                         echo "It can't, sorry."
9668                         case "$d_memmove" in
9669                         "$define") echo "But that's Ok since you have memmove()." ;;
9670                         esac
9671                 fi
9672         else
9673                 echo "(I can't compile the test program, so we'll assume not...)"
9674                 case "$d_memmove" in
9675                 "$define") echo "But that's Ok since you have memmove()." ;;
9676                 esac
9677         fi
9678         ;;
9679 esac
9680 $rm -f try.* try core
9681 set d_safemcpy
9682 eval $setvar
9683
9684 : can memcmp be trusted to compare relative magnitude?
9685 val="$undef"
9686 case "$d_memcmp" in
9687 "$define")
9688         echo " "
9689         echo "Checking if your memcmp() can compare relative magnitude..." >&4
9690         $cat >try.c <<EOCP
9691 #$i_memory I_MEMORY
9692 #$i_stdlib I_STDLIB
9693 #$i_string I_STRING
9694 #$i_unistd I_UNISTD
9695 EOCP
9696         $cat >>try.c <<'EOCP'
9697 #include <stdio.h>
9698 #ifdef I_MEMORY
9699 #  include <memory.h>
9700 #endif
9701 #ifdef I_STDLIB
9702 #  include <stdlib.h>
9703 #endif
9704 #ifdef I_STRING
9705 #  include <string.h>
9706 #else
9707 #  include <strings.h>
9708 #endif
9709 #ifdef I_UNISTD
9710 #  include <unistd.h>  /* Needed for NetBSD */
9711 #endif
9712 int main()
9713 {
9714 char a = -1;
9715 char b = 0;
9716 if ((a < b) && memcmp(&a, &b, 1) < 0)
9717         exit(1);
9718 exit(0);
9719 }
9720 EOCP
9721         set try
9722         if eval $compile_ok; then
9723                 if ./try 2>/dev/null; then
9724                         echo "Yes, it can."
9725                         val="$define"
9726                 else
9727                         echo "No, it can't (it uses signed chars)."
9728                 fi
9729         else
9730                 echo "(I can't compile the test program, so we'll assume not...)"
9731         fi
9732         ;;
9733 esac
9734 $rm -f try.* try core
9735 set d_sanemcmp
9736 eval $setvar
9737
9738 : see if select exists
9739 set select d_select
9740 eval $inlibc
9741
9742 : see if semctl exists
9743 set semctl d_semctl
9744 eval $inlibc
9745
9746 : see if semget exists
9747 set semget d_semget
9748 eval $inlibc
9749
9750 : see if semop exists
9751 set semop d_semop
9752 eval $inlibc
9753
9754 : see how much of the 'sem*(2)' library is present.
9755 h_sem=true
9756 echo " "
9757 case "$d_semctl$d_semget$d_semop" in
9758 *"$undef"*) h_sem=false;;
9759 esac
9760 case "$osname" in
9761 freebsd)
9762     case "`ipcs 2>&1`" in
9763     "SVID messages"*"not configured"*)
9764         echo "Your $osname does not have the sem*(2) configured." >&4
9765         h_sem=false
9766         val="$undef"
9767         set semctl d_semctl
9768         eval $setvar
9769         set semget d_semget
9770         eval $setvar
9771         set semop d_semop
9772         eval $setvar
9773         ;;
9774     esac
9775     ;;
9776 esac
9777 : we could also check for sys/ipc.h ...
9778 if $h_sem && $test `./findhdr sys/sem.h`; then
9779         echo "You have the full sem*(2) library." >&4
9780         val="$define"
9781 else
9782         echo "You don't have the full sem*(2) library." >&4
9783         val="$undef"
9784 fi
9785 set d_sem
9786 eval $setvar
9787
9788 : see whether sys/sem.h defines union semun
9789 echo " "
9790 $cat > try.c <<'END'
9791 #include <sys/types.h>
9792 #include <sys/ipc.h>
9793 #include <sys/sem.h>
9794 int main () { union semun semun; semun.buf = 0; }
9795 END
9796 set try
9797 if eval $compile; then
9798     echo "You have union semun in <sys/sem.h>." >&4
9799     val="$define"
9800 else
9801     echo "You do not have union semun in <sys/sem.h>." >&4
9802     val="$undef"
9803 fi
9804 $rm -f try try.c try.h
9805 set d_union_semun
9806 eval $setvar
9807
9808 : see how to do semctl IPC_STAT
9809 case "$d_sem" in
9810 $define)
9811     : see whether semctl IPC_STAT can use union semun
9812     echo " "
9813     $cat > try.h <<END
9814 #ifndef S_IRUSR
9815 #   ifdef S_IREAD
9816 #       define S_IRUSR S_IREAD
9817 #       define S_IWUSR S_IWRITE
9818 #       define S_IXUSR S_IEXEC
9819 #   else
9820 #       define S_IRUSR 0400
9821 #       define S_IWUSR 0200
9822 #       define S_IXUSR 0100
9823 #   endif
9824 #   define S_IRGRP (S_IRUSR>>3)
9825 #   define S_IWGRP (S_IWUSR>>3)
9826 #   define S_IXGRP (S_IXUSR>>3)
9827 #   define S_IROTH (S_IRUSR>>6)
9828 #   define S_IWOTH (S_IWUSR>>6)
9829 #   define S_IXOTH (S_IXUSR>>6)
9830 #endif
9831 #ifndef S_IRWXU
9832 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
9833 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
9834 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
9835 #endif
9836 END
9837
9838     $cat > try.c <<END
9839 #include <sys/types.h>
9840 #include <sys/ipc.h>
9841 #include <sys/sem.h>
9842 #include <sys/stat.h>
9843 #include <stdio.h>
9844 #include <errno.h>
9845 #include "try.h"
9846 #ifndef errno
9847 extern int errno;
9848 #endif
9849 #$d_union_semun HAS_UNION_SEMUN
9850 int main() {
9851     union semun
9852 #ifndef HAS_UNION_SEMUN
9853     {
9854         int val;
9855         struct semid_ds *buf;
9856         unsigned short *array;
9857     }
9858 #endif
9859     arg;
9860     int sem, st;
9861
9862 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
9863     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
9864     if (sem > -1) {
9865         struct semid_ds argbuf;
9866         arg.buf = &argbuf;
9867 #       ifdef IPC_STAT
9868         st = semctl(sem, 0, IPC_STAT, arg);
9869         if (st == 0)
9870             printf("semun\n");
9871         else
9872 #       endif /* IPC_STAT */
9873             printf("semctl IPC_STAT failed: errno = %d\n", errno);
9874 #       ifdef IPC_RMID
9875         if (semctl(sem, 0, IPC_RMID, arg) != 0)
9876 #       endif /* IPC_RMID */
9877             printf("semctl IPC_RMID failed: errno = %d\n", errno);
9878     } else
9879 #endif /* IPC_PRIVATE && ... */
9880         printf("semget failed: errno = %d\n", errno);
9881   return 0;
9882 }
9883 END
9884     val="$undef"
9885     set try
9886     if eval $compile; then
9887         xxx=`./try`
9888         case "$xxx" in
9889         semun) val="$define" ;;
9890         esac
9891     fi
9892     $rm -f try try.c
9893     set d_semctl_semun
9894     eval $setvar
9895     case "$d_semctl_semun" in
9896     $define)
9897         echo "You can use union semun for semctl IPC_STAT." >&4
9898         also='also'
9899         ;;
9900     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
9901         also=''
9902         ;;
9903     esac
9904
9905     : see whether semctl IPC_STAT can use struct semid_ds pointer
9906     $cat > try.c <<'END'
9907 #include <sys/types.h>
9908 #include <sys/ipc.h>
9909 #include <sys/sem.h>
9910 #include <sys/stat.h>
9911 #include "try.h"
9912 #include <stdio.h>
9913 #include <errno.h>
9914 #ifndef errno
9915 extern int errno;
9916 #endif
9917 int main() {
9918     struct semid_ds arg;
9919     int sem, st;
9920
9921 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
9922     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
9923     if (sem > -1) {
9924 #       ifdef IPC_STAT
9925         st = semctl(sem, 0, IPC_STAT, &arg);
9926         if (st == 0)
9927             printf("semid_ds\n");
9928         else
9929 #       endif /* IPC_STAT */
9930             printf("semctl IPC_STAT failed: errno = %d\n", errno);
9931 #       ifdef IPC_RMID
9932         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
9933 #       endif /* IPC_RMID */
9934             printf("semctl IPC_RMID failed: errno = %d\n", errno);
9935     } else
9936 #endif /* IPC_PRIVATE && ... */
9937         printf("semget failed: errno = %d\n", errno);
9938
9939     return 0;
9940 }
9941 END
9942     val="$undef"
9943     set try
9944     if eval $compile; then
9945         xxx=`./try`
9946         case "$xxx" in
9947         semid_ds) val="$define" ;;
9948         esac
9949     fi
9950     $rm -f try try.c
9951     set d_semctl_semid_ds
9952     eval $setvar
9953     case "$d_semctl_semid_ds" in
9954     $define)
9955         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
9956         ;;
9957     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
9958         ;;
9959     esac
9960     $rm -f try.h
9961     ;;
9962 *)  val="$undef"
9963
9964     # We do not have the full sem*(2) library, so assume we can not
9965     # use either.
9966
9967     set d_semctl_semun
9968     eval $setvar
9969
9970     set d_semctl_semid_ds
9971     eval $setvar
9972     ;;
9973 esac
9974
9975 : see if setegid exists
9976 set setegid d_setegid
9977 eval $inlibc
9978
9979 : see if seteuid exists
9980 set seteuid d_seteuid
9981 eval $inlibc
9982
9983 : see if setgrent exists
9984 set setgrent d_setgrent
9985 eval $inlibc
9986
9987 : see if sethostent exists
9988 set sethostent d_sethent
9989 eval $inlibc
9990
9991 : see if setlinebuf exists
9992 set setlinebuf d_setlinebuf
9993 eval $inlibc
9994
9995 : see if setlocale exists
9996 set setlocale d_setlocale
9997 eval $inlibc
9998
9999 : see if setnetent exists
10000 set setnetent d_setnent
10001 eval $inlibc
10002
10003 : see if setprotoent exists
10004 set setprotoent d_setpent
10005 eval $inlibc
10006
10007 : see if setpgid exists
10008 set setpgid d_setpgid
10009 eval $inlibc
10010
10011 : see if setpgrp2 exists
10012 set setpgrp2 d_setpgrp2
10013 eval $inlibc
10014
10015 : see if setpriority exists
10016 set setpriority d_setprior
10017 eval $inlibc
10018
10019 : see if setpwent exists
10020 set setpwent d_setpwent
10021 eval $inlibc
10022
10023 : see if setregid exists
10024 set setregid d_setregid
10025 eval $inlibc
10026 set setresgid d_setresgid
10027 eval $inlibc
10028
10029 : see if setreuid exists
10030 set setreuid d_setreuid
10031 eval $inlibc
10032 set setresuid d_setresuid
10033 eval $inlibc
10034
10035 : see if setrgid exists
10036 set setrgid d_setrgid
10037 eval $inlibc
10038
10039 : see if setruid exists
10040 set setruid d_setruid
10041 eval $inlibc
10042
10043 : see if setservent exists
10044 set setservent d_setsent
10045 eval $inlibc
10046
10047 : see if setsid exists
10048 set setsid d_setsid
10049 eval $inlibc
10050
10051 : see if setspent exists
10052 set setspent d_setspent
10053 eval $inlibc
10054
10055 : see if setvbuf exists
10056 set setvbuf d_setvbuf
10057 eval $inlibc
10058
10059 : see if sfio.h is available
10060 set sfio.h i_sfio
10061 eval $inhdr
10062
10063
10064 : see if sfio library is available
10065 case "$i_sfio" in
10066 $define)
10067         val=''
10068         set sfreserve val
10069         eval $inlibc
10070         ;;
10071 *)
10072         val="$undef"
10073         ;;
10074 esac
10075 : Ok, but do we want to use it.
10076 case "$val" in
10077 $define)
10078         case "$usesfio" in
10079         true|$define|[yY]*) dflt='y';;
10080         *) dflt='n';;
10081         esac
10082         echo "$package can use the sfio library, but it is experimental."
10083         rp="You seem to have sfio available, do you want to try using it?"
10084         . ./myread
10085         case "$ans" in
10086         y|Y) ;;
10087         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
10088                 val="$undef"
10089                 : Remove sfio from list of libraries to use
10090                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
10091                 shift
10092                 libs="$*"
10093                 echo "libs = $libs" >&4
10094                 ;;
10095         esac
10096         ;;
10097 *)      case "$usesfio" in
10098         true|$define|[yY]*)
10099                 echo "Sorry, cannot find sfio on this machine" >&4
10100                 echo "Ignoring your setting of usesfio=$usesfio" >&4
10101                 ;;
10102         esac
10103         ;;
10104 esac
10105 set d_sfio
10106 eval $setvar
10107 case "$d_sfio" in
10108 $define) usesfio='true';;
10109 *) usesfio='false';;
10110 esac
10111
10112 : see if shmctl exists
10113 set shmctl d_shmctl
10114 eval $inlibc
10115
10116 : see if shmget exists
10117 set shmget d_shmget
10118 eval $inlibc
10119
10120 : see if shmat exists
10121 set shmat d_shmat
10122 eval $inlibc
10123 : see what shmat returns
10124 case "$d_shmat" in
10125 "$define")
10126         $cat >shmat.c <<'END'
10127 #include <sys/shm.h>
10128 void *shmat();
10129 END
10130         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
10131                 shmattype='void *'
10132         else
10133                 shmattype='char *'
10134         fi
10135         echo "and it returns ($shmattype)." >&4
10136         : see if a prototype for shmat is available
10137         xxx=`./findhdr sys/shm.h`
10138         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
10139         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
10140                 val="$define"
10141         else
10142                 val="$undef"
10143         fi
10144         $rm -f shmat.[co]
10145         ;;
10146 *)
10147         val="$undef"
10148         ;;
10149 esac
10150 set d_shmatprototype
10151 eval $setvar
10152
10153 : see if shmdt exists
10154 set shmdt d_shmdt
10155 eval $inlibc
10156
10157 : see how much of the 'shm*(2)' library is present.
10158 h_shm=true
10159 echo " "
10160 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
10161 *"$undef"*) h_shm=false;;
10162 esac
10163 case "$osname" in
10164 freebsd)
10165     case "`ipcs 2>&1`" in
10166     "SVID shared memory"*"not configured"*)
10167         echo "Your $osname does not have the shm*(2) configured." >&4
10168         h_shm=false
10169         val="$undef"
10170         set shmctl d_shmctl
10171         evat $setvar
10172         set shmget d_shmget
10173         evat $setvar
10174         set shmat d_shmat
10175         evat $setvar
10176         set shmdt d_shmdt
10177         evat $setvar
10178         ;;
10179     esac
10180     ;;
10181 esac
10182 : we could also check for sys/ipc.h ...
10183 if $h_shm && $test `./findhdr sys/shm.h`; then
10184         echo "You have the full shm*(2) library." >&4
10185         val="$define"
10186 else
10187         echo "You don't have the full shm*(2) library." >&4
10188         val="$undef"
10189 fi
10190 set d_shm
10191 eval $setvar
10192
10193 echo " "
10194 : see if we have sigaction
10195 if set sigaction val -f d_sigaction; eval $csym; $val; then
10196         echo 'sigaction() found.' >&4
10197         $cat > try.c <<'EOP'
10198 #include <stdio.h>
10199 #include <sys/types.h>
10200 #include <signal.h>
10201 int main()
10202 {
10203     struct sigaction act, oact;
10204     act.sa_flags = 0;
10205     oact.sa_handler = 0;
10206 }
10207 EOP
10208         set try
10209         if eval $compile_ok; then
10210                 val="$define"
10211         else
10212                 echo "But you don't seem to have a useable struct sigaction." >&4
10213                 val="$undef"
10214         fi
10215 else
10216         echo 'sigaction NOT found.' >&4
10217         val="$undef"
10218 fi
10219 set d_sigaction; eval $setvar
10220 $rm -f try try$_o try.c
10221
10222 : see if sigsetjmp exists
10223 echo " "
10224 case "$d_sigsetjmp" in
10225 '')
10226         $cat >try.c <<'EOP'
10227 #include <setjmp.h>
10228 sigjmp_buf env;
10229 int set = 1;
10230 int main()
10231 {
10232         if (sigsetjmp(env,1))
10233                 exit(set);
10234         set = 0;
10235         siglongjmp(env, 1);
10236         exit(1);
10237 }
10238 EOP
10239         set try
10240         if eval $compile; then
10241                 if ./try >/dev/null 2>&1; then
10242                         echo "POSIX sigsetjmp found." >&4
10243                         val="$define"
10244                 else
10245                         $cat >&4 <<EOM
10246 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
10247 I'll ignore them.
10248 EOM
10249                         val="$undef"
10250                 fi
10251         else
10252                 echo "sigsetjmp not found." >&4
10253                 val="$undef"
10254         fi
10255         ;;
10256 *) val="$d_sigsetjmp"
10257         case "$d_sigsetjmp" in
10258         $define) echo "POSIX sigsetjmp found." >&4;;
10259         $undef) echo "sigsetjmp not found." >&4;;
10260         esac
10261         ;;
10262 esac
10263 set d_sigsetjmp
10264 eval $setvar
10265 $rm -f try.c try
10266
10267 : see if sqrtl exists
10268 set sqrtl d_sqrtl
10269 eval $inlibc
10270
10271 : see if sys/stat.h is available
10272 set sys/stat.h i_sysstat
10273 eval $inhdr
10274
10275
10276 : see if stat knows about block sizes
10277 echo " "
10278 echo "Checking to see if your struct stat has st_blocks field..." >&4
10279 set d_statblks stat st_blocks $i_sysstat sys/stat.h
10280 eval $hasfield
10281
10282
10283 : see if this is a sys/vfs.h system
10284 set sys/vfs.h i_sysvfs
10285 eval $inhdr
10286
10287
10288 : see if this is a sys/statfs.h system
10289 set sys/statfs.h i_sysstatfs
10290 eval $inhdr
10291
10292
10293 echo " "
10294 echo "Checking to see if your system supports struct statfs..." >&4
10295 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
10296 eval $hasstruct
10297 case "$d_statfs_s" in
10298 "$define")      echo "Yup, it does."     >&4 ;;
10299 *)              echo "Nope, it doesn't." >&4 ;;
10300 esac
10301
10302
10303
10304 : see if struct statfs knows about f_flags
10305 case "$d_statfs_s" in
10306 define) 
10307         echo " "
10308         echo "Checking to see if your struct statfs has f_flags field..." >&4
10309         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
10310         eval $hasfield
10311         ;;
10312 *)      val="$undef"
10313         set d_statfs_f_flags
10314         eval $setvar
10315         ;;
10316 esac
10317 case "$d_statfs_f_flags" in
10318 "$define")      echo "Yup, it does."     >&4 ;;
10319 *)              echo "Nope, it doesn't." >&4 ;;
10320 esac
10321
10322 : see if _ptr and _cnt from stdio act std
10323 echo " "
10324 if $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
10325         echo "(Looks like you have stdio.h from Linux.)"
10326         case "$stdio_ptr" in
10327         '') stdio_ptr='((fp)->_IO_read_ptr)'
10328                 ptr_lval=$define
10329                 ;;
10330         *)      ptr_lval=$d_stdio_ptr_lval;;
10331         esac
10332         case "$stdio_cnt" in
10333         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
10334                 cnt_lval=$undef
10335                 ;;
10336         *)      cnt_lval=$d_stdio_cnt_lval;;
10337         esac
10338         case "$stdio_base" in
10339         '') stdio_base='((fp)->_IO_read_base)';;
10340         esac
10341         case "$stdio_bufsiz" in
10342         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
10343         esac
10344 else
10345         case "$stdio_ptr" in
10346         '') stdio_ptr='((fp)->_ptr)'
10347                 ptr_lval=$define
10348                 ;;
10349         *)      ptr_lval=$d_stdio_ptr_lval;;
10350         esac
10351         case "$stdio_cnt" in
10352         '') stdio_cnt='((fp)->_cnt)'
10353                 cnt_lval=$define
10354                 ;;
10355         *)      cnt_lval=$d_stdio_cnt_lval;;
10356         esac
10357         case "$stdio_base" in
10358         '') stdio_base='((fp)->_base)';;
10359         esac
10360         case "$stdio_bufsiz" in
10361         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
10362         esac
10363 fi
10364 : test whether _ptr and _cnt really work
10365 echo "Checking how std your stdio is..." >&4
10366 $cat >try.c <<EOP
10367 #include <stdio.h>
10368 #define FILE_ptr(fp)    $stdio_ptr
10369 #define FILE_cnt(fp)    $stdio_cnt
10370 int main() {
10371         FILE *fp = fopen("try.c", "r");
10372         char c = getc(fp);
10373         if (
10374                 18 <= FILE_cnt(fp) &&
10375                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
10376         )
10377                 exit(0);
10378         exit(1);
10379 }
10380 EOP
10381 val="$undef"
10382 set try
10383 if eval $compile; then
10384         if ./try; then
10385                 echo "Your stdio acts pretty std."
10386                 val="$define"
10387         else
10388                 echo "Your stdio isn't very std."
10389         fi
10390 else
10391         echo "Your stdio doesn't appear very std."
10392 fi
10393 $rm -f try.c try
10394 set d_stdstdio
10395 eval $setvar
10396
10397 : Can _ptr be used as an lvalue?
10398 case "$d_stdstdio$ptr_lval" in
10399 $define$define) val=$define ;;
10400 *) val=$undef ;;
10401 esac
10402 set d_stdio_ptr_lval
10403 eval $setvar
10404
10405 : Can _cnt be used as an lvalue?
10406 case "$d_stdstdio$cnt_lval" in
10407 $define$define) val=$define ;;
10408 *) val=$undef ;;
10409 esac
10410 set d_stdio_cnt_lval
10411 eval $setvar
10412
10413 : see if _base is also standard
10414 val="$undef"
10415 case "$d_stdstdio" in
10416 $define)
10417         $cat >try.c <<EOP
10418 #include <stdio.h>
10419 #define FILE_base(fp)   $stdio_base
10420 #define FILE_bufsiz(fp) $stdio_bufsiz
10421 int main() {
10422         FILE *fp = fopen("try.c", "r");
10423         char c = getc(fp);
10424         if (
10425                 19 <= FILE_bufsiz(fp) &&
10426                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
10427         )
10428                 exit(0);
10429         exit(1);
10430 }
10431 EOP
10432         set try
10433         if eval $compile; then
10434                 if ./try; then
10435                         echo "And its _base field acts std."
10436                         val="$define"
10437                 else
10438                         echo "But its _base field isn't std."
10439                 fi
10440         else
10441                 echo "However, it seems to be lacking the _base field."
10442         fi
10443         $rm -f try.c try
10444         ;;
10445 esac
10446 set d_stdiobase
10447 eval $setvar
10448
10449 $cat >&4 <<EOM
10450 Checking how to access stdio streams by file descriptor number...
10451 EOM
10452 case "$stdio_stream_array" in
10453 '')     $cat >try.c <<EOCP
10454 #include <stdio.h>
10455 int main() {
10456   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
10457     printf("yes\n");
10458 }
10459 EOCP
10460         for s in _iob __iob __sF
10461         do
10462                 set try -DSTDIO_STREAM_ARRAY=$s
10463                 if eval $compile; then
10464                         case "`./try$exe_ext`" in
10465                         yes)    stdio_stream_array=$s; break ;;
10466                         esac
10467                 fi
10468         done
10469         $rm -f try.* try$exe_ext
10470 esac
10471 case "$stdio_stream_array" in
10472 '')     $cat >&4 <<EOM
10473 I can't figure out how to access stdio streams by file descriptor number.
10474 EOM
10475         d_stdio_stream_array="$undef"
10476         ;;
10477 *)      $cat >&4 <<EOM
10478 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
10479 EOM
10480         d_stdio_stream_array="$define"
10481         ;;
10482 esac
10483
10484 : see if strcoll exists
10485 set strcoll d_strcoll
10486 eval $inlibc
10487
10488 : check for structure copying
10489 echo " "
10490 echo "Checking to see if your C compiler can copy structs..." >&4
10491 $cat >try.c <<'EOCP'
10492 int main()
10493 {
10494         struct blurfl {
10495                 int dyick;
10496         } foo, bar;
10497
10498         foo = bar;
10499 }
10500 EOCP
10501 if $cc -c try.c >/dev/null 2>&1 ; then
10502         val="$define"
10503         echo "Yup, it can."
10504 else
10505         val="$undef"
10506         echo "Nope, it can't."
10507 fi
10508 set d_strctcpy
10509 eval $setvar
10510 $rm -f try.*
10511
10512 : see if strerror and/or sys_errlist[] exist
10513 echo " "
10514 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
10515     if set strerror val -f d_strerror; eval $csym; $val; then
10516                 echo 'strerror() found.' >&4
10517                 d_strerror="$define"
10518                 d_strerrm='strerror(e)'
10519                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
10520                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
10521                         d_syserrlst="$define"
10522                 else
10523                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
10524                         d_syserrlst="$undef"
10525                 fi
10526     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
10527                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
10528                 echo 'strerror() found in string header.' >&4
10529                 d_strerror="$define"
10530                 d_strerrm='strerror(e)'
10531                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
10532                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
10533                                 d_syserrlst="$define"
10534                 else
10535                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
10536                         d_syserrlst="$undef"
10537                 fi
10538     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
10539                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
10540                 d_strerror="$undef"
10541                 d_syserrlst="$define"
10542                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
10543     else
10544                 echo 'strerror() and sys_errlist[] NOT found.' >&4
10545                 d_strerror="$undef"
10546                 d_syserrlst="$undef"
10547                 d_strerrm='"unknown"'
10548     fi
10549 fi
10550
10551 : see if strtod exists
10552 set strtod d_strtod
10553 eval $inlibc
10554
10555 : see if strtol exists
10556 set strtol d_strtol
10557 eval $inlibc
10558
10559 : see if strtoul exists
10560 set strtoul d_strtoul
10561 eval $inlibc
10562
10563 : see if strtoull exists
10564 set strtoull d_strtoull
10565 eval $inlibc
10566
10567 : see if strxfrm exists
10568 set strxfrm d_strxfrm
10569 eval $inlibc
10570
10571 : see if symlink exists
10572 set symlink d_symlink
10573 eval $inlibc
10574
10575 : see if syscall exists
10576 set syscall d_syscall
10577 eval $inlibc
10578
10579 : see if sysconf exists
10580 set sysconf d_sysconf
10581 eval $inlibc
10582
10583 : see if system exists
10584 set system d_system
10585 eval $inlibc
10586
10587 : see if tcgetpgrp exists
10588 set tcgetpgrp d_tcgetpgrp
10589 eval $inlibc
10590
10591 : see if tcsetpgrp exists
10592 set tcsetpgrp d_tcsetpgrp
10593 eval $inlibc
10594
10595 : see if prototype for telldir is available
10596 echo " "
10597 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
10598 eval $hasproto
10599
10600 : define an is-a-typedef? function
10601 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
10602 case "$inclist" in
10603 "") inclist="sys/types.h";;
10604 esac;
10605 eval "varval=\$$var";
10606 case "$varval" in
10607 "")
10608         $rm -f temp.c;
10609         for inc in $inclist; do
10610                 echo "#include <$inc>" >>temp.c;
10611         done;
10612         echo "#ifdef $type" >> temp.c;
10613         echo "printf(\"We have $type\");" >> temp.c;
10614         echo "#endif" >> temp.c;
10615         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
10616         if $contains $type temp.E >/dev/null 2>&1; then
10617                 eval "$var=\$type";
10618         else
10619                 eval "$var=\$def";
10620         fi;
10621         $rm -f temp.?;;
10622 *) eval "$var=\$varval";;
10623 esac'
10624
10625 : define an is-a-typedef? function that prompts if the type is not available.
10626 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
10627 case "$inclist" in
10628 "") inclist="sys/types.h";;
10629 esac;
10630 eval "varval=\$$var";
10631 case "$varval" in
10632 "")
10633         $rm -f temp.c;
10634         for inc in $inclist; do
10635                 echo "#include <$inc>" >>temp.c;
10636         done;
10637         echo "#ifdef $type" >> temp.c;
10638         echo "printf(\"We have $type\");" >> temp.c;
10639         echo "#endif" >> temp.c;
10640         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
10641         echo " " ;
10642         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
10643         if $contains $type temp.E >/dev/null 2>&1; then
10644                 echo "$type found." >&4;
10645                 eval "$var=\$type";
10646         else
10647                 echo "$type NOT found." >&4;
10648                 dflt="$def";
10649                 . ./myread ;
10650                 eval "$var=\$ans";
10651         fi;
10652         $rm -f temp.?;;
10653 *) eval "$var=\$varval";;
10654 esac'
10655
10656 : see if this is a sys/times.h system
10657 set sys/times.h i_systimes
10658 eval $inhdr
10659
10660 : see if times exists
10661 echo " "
10662 if set times val -f d_times; eval $csym; $val; then
10663         echo 'times() found.' >&4
10664         d_times="$define"
10665         inc=''
10666         case "$i_systimes" in
10667         "$define") inc='sys/times.h';;
10668         esac
10669         rp="What is the type returned by times() on this system?"
10670         set clock_t clocktype long stdio.h sys/types.h $inc
10671         eval $typedef_ask
10672 else
10673         echo 'times() NOT found, hope that will do.' >&4
10674         d_times="$undef"
10675         clocktype='int'
10676 fi
10677
10678 : see if truncate exists
10679 set truncate d_truncate
10680 eval $inlibc
10681
10682 : see if tzname[] exists
10683 echo " "
10684 if set tzname val -a d_tzname; eval $csym; $val; then
10685         val="$define"
10686         echo 'tzname[] found.' >&4
10687 else
10688         val="$undef"
10689         echo 'tzname[] NOT found.' >&4
10690 fi
10691 set d_tzname
10692 eval $setvar
10693
10694 : see if umask exists
10695 set umask d_umask
10696 eval $inlibc
10697
10698 : see if ustat exists
10699 set ustat d_ustat
10700 eval $inlibc
10701
10702 : backward compatibility for d_hvfork
10703 if test X$d_hvfork != X; then
10704         d_vfork="$d_hvfork"
10705         d_hvfork=''
10706 fi
10707 : see if there is a vfork
10708 val=''
10709 set vfork val
10710 eval $inlibc
10711
10712 : Ok, but do we want to use it. vfork is reportedly unreliable in 
10713 : perl on Solaris 2.x, and probably elsewhere.
10714 case "$val" in
10715 $define)
10716         echo " "
10717         case "$usevfork" in
10718         false) dflt='n';;
10719         *) dflt='y';;
10720         esac
10721         cat <<'EOM'
10722  
10723 Perl can only use a vfork() that doesn't suffer from strict
10724 restrictions on calling functions or modifying global data in
10725 the child.  For example, glibc-2.1 contains such a vfork()
10726 that is unsuitable.  If your system provides a proper fork()
10727 call, chances are that you do NOT want perl to use vfork().
10728
10729 EOM
10730         rp="Do you still want to use vfork()?"
10731         . ./myread
10732         case "$ans" in
10733         y|Y) ;;
10734         *)
10735                 echo "Ok, we won't use vfork()."
10736                 val="$undef"
10737                 ;;
10738         esac
10739         ;;
10740 esac
10741 set d_vfork
10742 eval $setvar
10743 case "$d_vfork" in
10744 $define) usevfork='true';;
10745 *) usevfork='false';;
10746 esac
10747
10748 : see if this is an sysdir system
10749 set sys/dir.h i_sysdir
10750 eval $inhdr
10751
10752 : see if this is an sysndir system
10753 set sys/ndir.h i_sysndir
10754 eval $inhdr
10755
10756 : see if closedir exists
10757 set closedir d_closedir
10758 eval $inlibc
10759
10760 case "$d_closedir" in
10761 "$define")
10762         echo " "
10763         echo "Checking whether closedir() returns a status..." >&4
10764         cat > closedir.c <<EOM
10765 #$i_dirent I_DIRENT             /**/
10766 #$i_sysdir I_SYS_DIR            /**/
10767 #$i_sysndir I_SYS_NDIR          /**/
10768 #$i_systypes I_SYS_TYPES        /**/
10769
10770 #if defined(I_SYS_TYPES)
10771 #include <sys/types.h>
10772 #endif
10773 #if defined(I_DIRENT)
10774 #include <dirent.h>
10775 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
10776 #include <sys/dir.h>
10777 #endif
10778 #else
10779 #ifdef I_SYS_NDIR
10780 #include <sys/ndir.h>
10781 #else
10782 #ifdef I_SYS_DIR
10783 #ifdef hp9000s500
10784 #include <ndir.h>       /* may be wrong in the future */
10785 #else
10786 #include <sys/dir.h>
10787 #endif
10788 #endif
10789 #endif
10790 #endif 
10791 int main() { return closedir(opendir(".")); }
10792 EOM
10793         set closedir
10794         if eval $compile_ok; then
10795                 if ./closedir > /dev/null 2>&1 ; then
10796                         echo "Yes, it does."
10797                         val="$undef"
10798                 else
10799                         echo "No, it doesn't."
10800                         val="$define"
10801                 fi
10802         else
10803                 echo "(I can't seem to compile the test program--assuming it doesn't)"
10804                 val="$define"
10805         fi
10806         ;;
10807 *)
10808         val="$undef";
10809         ;;
10810 esac
10811 set d_void_closedir
10812 eval $setvar
10813 $rm -f closedir*
10814 : check for volatile keyword
10815 echo " "
10816 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
10817 $cat >try.c <<'EOCP'
10818 int main()
10819 {
10820         typedef struct _goo_struct goo_struct;
10821         goo_struct * volatile goo = ((goo_struct *)0);
10822         struct _goo_struct {
10823                 long long_int;
10824                 int reg_int;
10825                 char char_var;
10826         };
10827         typedef unsigned short foo_t;
10828         char *volatile foo;
10829         volatile int bar;
10830         volatile foo_t blech;
10831         foo = foo;
10832 }
10833 EOCP
10834 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
10835         val="$define"
10836         echo "Yup, it does."
10837 else
10838         val="$undef"
10839         echo "Nope, it doesn't."
10840 fi
10841 set d_volatile
10842 eval $setvar
10843 $rm -f try.*
10844
10845 : see if there is a wait4
10846 set wait4 d_wait4
10847 eval $inlibc
10848
10849 : see if waitpid exists
10850 set waitpid d_waitpid
10851 eval $inlibc
10852
10853 : see if wcstombs exists
10854 set wcstombs d_wcstombs
10855 eval $inlibc
10856
10857 : see if wctomb exists
10858 set wctomb d_wctomb
10859 eval $inlibc
10860
10861 : preserve RCS keywords in files with variable substitution, grrr
10862 Date='$Date'
10863 Id='$Id'
10864 Log='$Log'
10865 RCSfile='$RCSfile'
10866 Revision='$Revision'
10867
10868 case "$crosscompile" in
10869 ''|[nN]*) crosscompile="$undef" ;;
10870 esac
10871
10872 case "$osname" in
10873 next|rhapsody) multiarch="$define" ;;
10874 esac
10875 case "$multiarch" in
10876 ''|[nN]*) multiarch="$undef" ;;
10877 esac
10878
10879 : check for alignment requirements
10880 echo " "
10881 case "$crosscompile$multiarch" in
10882 *$define*)
10883         $cat <<EOM
10884 You seem to be either cross-compiling or doing a multiarchitecture build,
10885 skipping the memory alignment check.
10886
10887 EOM
10888         case "$alignbytes" in
10889         '') alignbytes=8 ;;
10890         esac
10891         ;;
10892 *)
10893         case "$alignbytes" in
10894         '') echo "Checking alignment constraints..." >&4
10895                 $cat >try.c <<'EOCP'
10896 struct foobar {
10897         char foo;
10898         double bar;
10899 } try_algn;
10900 int main()
10901 {
10902         printf("%d\n", (char *)&try_algn.bar - (char *)&try_algn.foo);
10903 }
10904 EOCP
10905                 set try
10906                 if eval $compile_ok; then
10907                         dflt=`./try`
10908                 else
10909                         dflt='8'
10910                         echo "(I can't seem to compile the test program...)"
10911                 fi
10912                 ;;
10913         *) dflt="$alignbytes"
10914                 ;;
10915         esac
10916         rp="Doubles must be aligned on a how-many-byte boundary?"
10917         . ./myread
10918         alignbytes="$ans"
10919         $rm -f try.c try
10920         ;;
10921 esac
10922
10923
10924 : check for ordering of bytes in a long
10925 echo " "
10926 case "$crosscompile$multiarch" in
10927 *$define*)
10928         $cat <<EOM
10929 You seem to be either cross-compiling or doing a multiarchitecture build,
10930 skipping the byteorder check.
10931
10932 EOM
10933         byteorder='0xffff'
10934         ;;
10935 *)
10936         case "$byteorder" in
10937         '')
10938                 $cat <<'EOM'
10939 In the following, larger digits indicate more significance.  A big-endian
10940 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
10941 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
10942 machines may have weird orders like 3412.  A Cray will report 87654321,
10943 an Alpha will report 12345678. If the test program works the default is
10944 probably right.
10945 I'm now running the test program...
10946 EOM
10947                 $cat >try.c <<'EOCP'
10948 #include <stdio.h>
10949 int main()
10950 {
10951         int i;
10952         union {
10953                 unsigned long l;
10954                 char c[sizeof(long)];
10955         } u;
10956
10957         if (sizeof(long) > 4)
10958                 u.l = (0x08070605L << 32) | 0x04030201L;
10959         else
10960                 u.l = 0x04030201L;
10961         for (i = 0; i < sizeof(long); i++)
10962                 printf("%c", u.c[i]+'0');
10963         printf("\n");
10964         exit(0);
10965 }
10966 EOCP
10967                 xxx_prompt=y
10968                 set try
10969                 if eval $compile && ./try > /dev/null; then
10970                         dflt=`./try`
10971                         case "$dflt" in
10972                         [1-4][1-4][1-4][1-4]|12345678|87654321)
10973                                 echo "(The test program ran ok.)"
10974                                 echo "byteorder=$dflt"
10975                                 xxx_prompt=n
10976                         ;;
10977                         ????|????????) echo "(The test program ran ok.)" ;;
10978                         *) echo "(The test program didn't run right for some reason.)" ;;
10979                         esac
10980                 else
10981                         dflt='4321'
10982                         cat <<'EOM'
10983 (I can't seem to compile the test program.  Guessing big-endian...)
10984 EOM
10985                 fi
10986                 case "$xxx_prompt" in
10987                 y)
10988                         rp="What is the order of bytes in a long?"
10989                         . ./myread
10990                         byteorder="$ans"
10991                         ;;
10992                 *)      byteorder=$dflt
10993                         ;;
10994                 esac
10995                 ;;
10996         esac
10997         $rm -f try.c try
10998         ;;
10999 esac
11000
11001
11002 : how do we catenate cpp tokens here?
11003 echo " "
11004 echo "Checking to see how your cpp does stuff like catenate tokens..." >&4
11005 $cat >cpp_stuff.c <<'EOCP'
11006 #define RCAT(a,b)a/**/b
11007 #define ACAT(a,b)a ## b
11008 RCAT(Rei,ser)
11009 ACAT(Cir,cus)
11010 EOCP
11011 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
11012 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
11013         echo "Oh!  Smells like ANSI's been here." >&4
11014         echo "We can catify or stringify, separately or together!"
11015         cpp_stuff=42
11016 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
11017         echo "Ah, yes!  The good old days!" >&4
11018         echo "However, in the good old days we don't know how to stringify and"
11019         echo "catify at the same time."
11020         cpp_stuff=1
11021 else
11022         $cat >&4 <<EOM
11023 Hmm, I don't seem to be able to catenate tokens with your cpp.  You're going
11024 to have to edit the values of CAT[2-5] in config.h...
11025 EOM
11026         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
11027 fi
11028 $rm -f cpp_stuff.*
11029
11030 : see if this is a db.h system
11031 set db.h i_db
11032 eval $inhdr
11033
11034 case "$i_db" in
11035 $define)
11036         : Check db version.
11037         echo " "
11038         echo "Checking Berkeley DB version ..." >&4
11039         $cat >try.c <<EOCP
11040 #$d_const HASCONST
11041 #ifndef HASCONST
11042 #define const
11043 #endif
11044 #include <sys/types.h>
11045 #include <stdio.h>
11046 #include <db.h>
11047 int main()
11048 {
11049 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
11050     int Major, Minor, Patch ;
11051     unsigned long Version ;
11052     (void)db_version(&Major, &Minor, &Patch) ;
11053     printf("You have Berkeley DB Version 2 or greater\n");
11054
11055     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
11056                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
11057     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
11058                 Major, Minor, Patch) ;
11059
11060     /* check that db.h & libdb are compatible */
11061     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
11062         printf("db.h and libdb are incompatible\n") ;
11063         exit(3);        
11064     }
11065
11066     printf("db.h and libdb are compatible\n") ;
11067
11068     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
11069                 + DB_VERSION_PATCH ;
11070
11071     /* needs to be >= 2.3.4 */
11072     if (Version < 2003004) {
11073     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
11074         printf("but Perl needs Berkeley DB 2.3.4 or greater\n") ;
11075         exit(2);        
11076     }
11077
11078     exit(0);
11079 #else
11080 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
11081     printf("You have Berkeley DB Version 1\n");
11082     exit(0);    /* DB version < 2: the coast is clear. */
11083 #else
11084     exit(1);    /* <db.h> not Berkeley DB? */
11085 #endif
11086 #endif
11087 }
11088 EOCP
11089         set try
11090         if eval $compile && ./try; then
11091                 echo 'Looks OK.' >&4
11092         else
11093                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
11094                 i_db=$undef
11095                 case " $libs " in
11096                 *"-ldb "*)
11097                         : Remove db from list of libraries to use
11098                         echo "Removing unusable -ldb from library list" >&4
11099                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
11100                         shift
11101                         libs="$*"
11102                         echo "libs = $libs" >&4
11103                         ;;
11104                 esac
11105         fi
11106         $rm -f try.*
11107         ;;
11108 esac
11109
11110 case "$i_db" in
11111 define)
11112         : Check the return type needed for hash 
11113         echo " "
11114         echo "Checking return type needed for hash for Berkeley DB ..." >&4
11115         $cat >try.c <<EOCP
11116 #$d_const HASCONST
11117 #ifndef HASCONST
11118 #define const
11119 #endif
11120 #include <sys/types.h>
11121 #include <db.h>
11122
11123 #ifndef DB_VERSION_MAJOR
11124 u_int32_t hash_cb (ptr, size)
11125 const void *ptr;
11126 size_t size;
11127 {
11128 }
11129 HASHINFO info;
11130 int main()
11131 {
11132         info.hash = hash_cb;
11133 }
11134 #endif
11135 EOCP
11136         if $cc $ccflags -c try.c >try.out 2>&1 ; then
11137                 if $contains warning try.out >>/dev/null 2>&1 ; then
11138                         db_hashtype='int'
11139                 else
11140                         db_hashtype='u_int32_t'
11141                 fi
11142         else
11143                 : XXX Maybe we should just give up here.
11144                 db_hashtype=u_int32_t
11145                 $cat try.out >&4
11146                 echo "Help:  I can't seem to compile the db test program." >&4
11147                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
11148         fi
11149         $rm -f try.*
11150         echo "Your version of Berkeley DB uses $db_hashtype for hash."
11151         ;;
11152 *)      db_hashtype=u_int32_t
11153         ;;
11154 esac
11155 case "$i_db" in
11156 define)
11157         : Check the return type needed for prefix 
11158         echo " "
11159         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
11160         cat >try.c <<EOCP
11161 #$d_const HASCONST
11162 #ifndef HASCONST
11163 #define const
11164 #endif
11165 #include <sys/types.h>
11166 #include <db.h>
11167
11168 #ifndef DB_VERSION_MAJOR
11169 size_t prefix_cb (key1, key2)
11170 const DBT *key1;
11171 const DBT *key2;
11172 {
11173 }
11174 BTREEINFO info;
11175 int main()
11176 {
11177         info.prefix = prefix_cb;
11178 }
11179 #endif
11180 EOCP
11181         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
11182                 if $contains warning try.out >>/dev/null 2>&1 ; then
11183                         db_prefixtype='int'
11184                 else
11185                         db_prefixtype='size_t'
11186                 fi
11187         else
11188                 db_prefixtype='size_t'
11189                 : XXX Maybe we should just give up here.
11190                 $cat try.out >&4
11191                 echo "Help:  I can't seem to compile the db test program." >&4
11192                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
11193         fi
11194         $rm -f try.*
11195         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
11196         ;;
11197 *)      db_prefixtype='size_t'
11198         ;;
11199 esac
11200
11201 : check for void type
11202 echo " "
11203 echo "Checking to see how well your C compiler groks the void type..." >&4
11204 case "$voidflags" in
11205 '')
11206         $cat >try.c <<'EOCP'
11207 #if TRY & 1
11208 void sub() {
11209 #else
11210 sub() {
11211 #endif
11212         extern void moo();      /* function returning void */
11213         void (*goo)();          /* ptr to func returning void */
11214 #if TRY & 8
11215         void *hue;              /* generic ptr */
11216 #endif
11217 #if TRY & 2
11218         void (*foo[10])();
11219 #endif
11220
11221 #if TRY & 4
11222         if(goo == moo) {
11223                 exit(0);
11224         }
11225 #endif
11226         exit(0);
11227 }
11228 int main() { sub(); }
11229 EOCP
11230         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
11231                 voidflags=$defvoidused
11232         echo "Good.  It appears to support void to the level $package wants.">&4
11233                 if $contains warning .out >/dev/null 2>&1; then
11234                         echo "However, you might get some warnings that look like this:"
11235                         $cat .out
11236                 fi
11237         else
11238 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
11239                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
11240                         echo "It supports 1..."
11241                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
11242                                 echo "It also supports 2..."
11243                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
11244                                         voidflags=7
11245                                         echo "And it supports 4 but not 8 definitely."
11246                                 else
11247                                         echo "It doesn't support 4..."
11248                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
11249                                                 voidflags=11
11250                                                 echo "But it supports 8."
11251                                         else
11252                                                 voidflags=3
11253                                                 echo "Neither does it support 8."
11254                                         fi
11255                                 fi
11256                         else
11257                                 echo "It does not support 2..."
11258                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
11259                                         voidflags=13
11260                                         echo "But it supports 4 and 8."
11261                                 else
11262                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
11263                                                 voidflags=5
11264                                                 echo "And it supports 4 but has not heard about 8."
11265                                         else
11266                                                 echo "However it supports 8 but not 4."
11267                                         fi
11268                                 fi
11269                         fi
11270                 else
11271                         echo "There is no support at all for void."
11272                         voidflags=0
11273                 fi
11274         fi
11275 esac
11276 case "$voidflags" in
11277 "$defvoidused") ;;
11278 *)      $cat >&4 <<'EOM'
11279   Support flag bits are:
11280     1: basic void declarations.
11281     2: arrays of pointers to functions returning void.
11282     4: operations between pointers to and addresses of void functions.
11283     8: generic void pointers.
11284 EOM
11285         dflt="$voidflags";
11286         rp="Your void support flags add up to what?"
11287         . ./myread
11288         voidflags="$ans"
11289         ;;
11290 esac
11291 $rm -f try.* .out
11292
11293
11294 : How can we generate normalized random numbers ?
11295 echo " "
11296 echo "Looking for a random number function..." >&4
11297 case "$randfunc" in
11298 '')
11299         if set drand48 val -f; eval $csym; $val; then
11300                 dflt="drand48"
11301                 echo "Good, found drand48()." >&4
11302         elif set random val -f; eval $csym; $val; then
11303                 dflt="random"
11304                 echo "OK, found random()." >&4
11305         else
11306                 dflt="rand"
11307                 echo "Yick, looks like I have to use rand()." >&4
11308         fi
11309         echo " "
11310         ;;
11311 *)
11312         dflt="$randfunc"
11313         ;;
11314 esac
11315 cont=true
11316
11317 case "$ccflags" in
11318 *-Dmy_rand=*|*-Dmy_srand=*)
11319         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
11320         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
11321         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
11322         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
11323         ;;
11324 esac
11325
11326 while $test "$cont"; do
11327         rp="Use which function to generate random numbers?"
11328         . ./myread
11329         if $test "$ans" = "$dflt"; then
11330                 : null
11331         else
11332                 randbits=''
11333         fi
11334         randfunc="$ans"
11335         if set $ans val -f; eval $csym; $val; then
11336                 cont=''
11337         else
11338                 dflt=y
11339                 rp="I cannot find function $ans. Use that name anyway?"
11340                 . ./myread
11341                 dflt=rand
11342                 case "$ans" in
11343                         [yY]*) cont='';;
11344                 esac
11345         fi
11346         case "$cont" in
11347         '')
11348                 case "$randfunc" in
11349                 drand48)
11350                         drand01="drand48()"
11351                         seedfunc="srand48"
11352                         randbits=48
11353                         randseedtype=long
11354                         ;;
11355                 rand|random)
11356                         case "$randbits" in
11357                         '')
11358 echo "Checking to see how many bits your $randfunc() function produces..." >&4
11359                                 $cat >try.c <<EOCP
11360 #$i_unistd I_UNISTD
11361 #$i_stdlib I_STDLIB
11362 #include <stdio.h>
11363 #ifdef I_UNISTD
11364 #  include <unistd.h>
11365 #endif
11366 #ifdef I_STDLIB
11367 #  include <stdlib.h>
11368 #endif
11369 int main()
11370 {
11371         register int i;
11372         register unsigned long tmp;
11373         register unsigned long max = 0L;
11374
11375         for (i = 1000; i; i--) {
11376                 tmp = (unsigned long) $randfunc();
11377                 if (tmp > max) max = tmp;
11378         }
11379         for (i = 0; max; i++)
11380                 max /= 2;
11381         printf("%d\n",i);
11382 }
11383 EOCP
11384                                 set try
11385                                 if eval $compile_ok; then
11386                                         dflt=`try`
11387                                 else
11388                                         dflt='?'
11389                                         echo "(I can't seem to compile the test program...)"
11390                                 fi
11391                                 ;;
11392                         *)
11393                                 dflt="$randbits"
11394                                 ;;
11395                         esac
11396                         rp="How many bits does your $randfunc() function produce?"
11397                         . ./myread
11398                         randbits="$ans"
11399                         $rm -f try.c try
11400                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
11401                         seedfunc="s$randfunc"
11402                         randseedtype=unsigned
11403                         ;;
11404                 *)
11405                         dflt="31"
11406                         rp="How many bits does your $randfunc() function produce?"
11407                         . ./myread
11408                         randbits="$ans"
11409                         seedfunc="s$randfunc"
11410                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
11411                         if set $seedfunc val -f; eval $csym; $val; then
11412                                 echo "(Using $seedfunc() to seed random generator)"
11413                         else
11414                                 echo "(Warning: no $seedfunc() to seed random generator)"
11415                                 seedfunc=rand
11416                         fi
11417                         randseedtype=unsigned
11418                         ;;
11419                 esac
11420                 ;;
11421         esac
11422 done
11423
11424 echo " "
11425 echo "Determining whether or not we are on an EBCDIC system..." >&4
11426 $cat >tebcdic.c <<'EOM'
11427 int main()
11428 {
11429   if ('M'==0xd4) return 0;
11430   return 1;
11431 }
11432 EOM
11433
11434 val=$undef
11435 set tebcdic
11436 if eval $compile_ok; then
11437         if ./tebcdic; then
11438                 echo "You have EBCDIC." >&4
11439                 val="$define"
11440         else
11441                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin." >&4
11442         fi
11443 else
11444         echo "I'm unable to compile the test program." >&4
11445         echo "I'll assume ASCII or some ISO Latin." >&4
11446 fi
11447 $rm -f tebcdic.c tebcdic
11448 set ebcdic
11449 eval $setvar
11450
11451 echo " "
11452 $cat >&4 <<EOM
11453 Checking how to flush all pending stdio output...
11454 EOM
11455 # I only know how to find the first 32 possibly open files on SunOS.
11456 # See also hints/sunos_4_1.sh and util.c  --AD
11457 case "$osname" in
11458 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
11459 esac
11460 $cat >>try.c <<EOCP
11461 #include <stdio.h>
11462 #$i_unistd I_UNISTD
11463 #ifdef I_UNISTD
11464 # include <unistd.h>
11465 #endif
11466 #$d_sysconf HAS_SYSCONF
11467 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
11468 #ifdef HAS_STDIO_STREAM_ARRAY
11469 # define STDIO_STREAM_ARRAY $stdio_stream_array
11470 #endif
11471 int main() {
11472   FILE* p = fopen("try.out", "w");
11473 #ifdef TRY_FPUTC
11474   fputc('x', p);
11475 #else
11476 # ifdef TRY_FPRINTF
11477   fprintf(p, "x");
11478 # endif
11479 #endif
11480 #ifdef TRY_FFLUSH_NULL
11481   fflush(NULL);
11482 #endif
11483 #ifdef TRY_FFLUSH_ALL
11484   {
11485     long open_max = -1;
11486 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
11487     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
11488 # else
11489 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
11490     open_max = sysconf(_SC_OPEN_MAX);
11491 #  else
11492 #   ifdef FOPEN_MAX
11493     open_max = FOPEN_MAX;
11494 #   else
11495 #    ifdef OPEN_MAX
11496     open_max = OPEN_MAX;
11497 #    else
11498 #     ifdef _NFILE
11499     open_max = _NFILE;
11500 #     endif
11501 #    endif
11502 #   endif
11503 #  endif
11504 # endif 
11505 # ifdef HAS_STDIO_STREAM_ARRAY
11506     if (open_max > 0) {
11507       long i;
11508       for (i = 0; i < open_max; i++)
11509             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
11510                 STDIO_STREAM_ARRAY[i]._file < open_max &&
11511                 STDIO_STREAM_ARRAY[i]._flag)
11512                 fflush(&STDIO_STREAM_ARRAY[i]);
11513     }   
11514   }
11515 # endif
11516 #endif
11517   _exit(42);
11518 }
11519 EOCP
11520 : first we have to find out how _not_ to flush
11521 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
11522     output=''
11523     set try -DTRY_FPUTC
11524     if eval $compile; then
11525             $rm -f try.out
11526             ./try$exe_ext 2>/dev/null
11527             if $test ! -s try.out -a "X$?" = X42; then
11528                 output=-DTRY_FPUTC
11529             fi
11530     fi
11531     case "$output" in
11532     '')
11533             set try -DTRY_FPRINTF
11534             $rm -f try.out
11535             if eval $compile; then
11536                     $rm -f try.out
11537                     ./try$exe_ext 2>/dev/null
11538                     if $test ! -s try.out -a "X$?" = X42; then
11539                         output=-DTRY_FPRINTF
11540                     fi
11541             fi
11542         ;;
11543     esac
11544 fi
11545 : check for fflush NULL behaviour
11546 case "$fflushNULL" in
11547 '')     set try -DTRY_FFLUSH_NULL $output
11548         if eval $compile; then
11549                 $rm -f try.out
11550                 ./try$exe_ext 2>/dev/null
11551                 code="$?"
11552                 if $test -s try.out -a "X$code" = X42; then
11553                         fflushNULL="`$cat try.out`"
11554                 else
11555                         if $test "X$code" != X42; then
11556                                 $cat >&4 <<EOM
11557 (If this test failed, don't worry, we'll try another method shortly.)
11558 EOM
11559                         fi
11560                 fi
11561         fi
11562         $rm -f core try.core core.try.*
11563         case "$fflushNULL" in
11564         x)      $cat >&4 <<EOM
11565 Your fflush(NULL) works okay.
11566 EOM
11567                 fflushNULL="$define"
11568                 ;;
11569         '')     $cat >&4 <<EOM
11570 Your fflush(NULL) isn't working (contrary to ANSI C).
11571 EOM
11572                 fflushNULL="$undef"
11573                 ;;
11574         *)      $cat >&4 <<EOM
11575 Cannot figure out whether your fflush(NULL) works or not.
11576 I'm assuming it doesn't (contrary to ANSI C).
11577 EOM
11578                 fflushNULL="$undef"
11579                 ;;
11580         esac
11581         ;;
11582 $define|true|[yY]*)
11583         fflushNULL="$define"
11584         ;;
11585 *)
11586         fflushNULL="$undef"
11587         ;;
11588 esac
11589 : check explicit looping only if NULL did not work
11590 case "$fflushNULL" in
11591 "$undef")
11592         : check for fflush all behaviour
11593         case "$fflushall" in
11594         '')     set try -DTRY_FFLUSH_ALL $output
11595                 if eval $compile; then
11596                         $cat >&4 <<EOM
11597 (Now testing the other method--but note that also this may fail.)
11598 EOM
11599                         $rm -f try.out
11600                         ./try$exe_ext 2>/dev/null
11601                         if $test -s try.out -a "X$?" = X42; then
11602                                 fflushall="`$cat try.out`"
11603                         fi
11604                 fi
11605                 $rm -f core try.core core.try.*
11606                 case "$fflushall" in
11607                 x)      $cat >&4 <<EOM
11608 Whew. Flushing explicitly all the stdio streams works.
11609 EOM
11610                         fflushall="$define"
11611                         ;;
11612                 '')     $cat >&4 <<EOM
11613 Sigh. Flushing explicitly all the stdio streams doesn't work.
11614 EOM
11615                         fflushall="$undef"
11616                         ;;
11617                 *)      $cat >&4 <<EOM
11618 Cannot figure out whether flushing stdio streams explicitly works or not.
11619 I'm assuming it doesn't.
11620 EOM
11621                         fflushall="$undef"
11622                         ;;
11623                 esac
11624                 ;;
11625         "$define"|true|[yY]*)
11626                 fflushall="$define"
11627                 ;;
11628         *)
11629                 fflushall="$undef"
11630                 ;;
11631         esac
11632         ;;
11633 *)      fflushall="$undef"      
11634         ;;
11635 esac
11636 case "$fflushNULL$fflushall" in
11637 undefundef)
11638         $cat <<EOM
11639 I cannot figure out how to flush pending stdio output.
11640 EOM
11641         ;;
11642 esac
11643 $rm -f try.* try$exe_ext
11644
11645 : see what type file positions are declared as in the library
11646 rp="What is the type for file position used by fsetpos()?"
11647 set fpos_t fpostype long stdio.h sys/types.h
11648 eval $typedef_ask
11649
11650 : Store the full pathname to the ar program for use in the C program
11651 : Respect a hint or command line value for full_ar.
11652 case "$full_ar" in
11653 '') full_ar=$ar ;;
11654 esac
11655
11656 : Store the full pathname to the sed program for use in the C program
11657 full_sed=$sed
11658
11659 : see what type gids are declared as in the kernel
11660 echo " "
11661 echo "Looking for the type for group ids returned by getgid()."
11662 set gid_t gidtype xxx stdio.h sys/types.h
11663 eval $typedef
11664 case "$gidtype" in
11665 xxx)
11666         xxx=`./findhdr sys/user.h`
11667         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
11668         case $1 in
11669         unsigned) dflt="$1 $2" ;;
11670         *) dflt="$1" ;;
11671         esac
11672         ;;
11673 *) dflt="$gidtype";;
11674 esac
11675 case "$gidtype" in
11676 gid_t) echo "gid_t found." ;;
11677 *)      rp="What is the type for group ids returned by getgid()?"
11678         . ./myread
11679         gidtype="$ans"
11680         ;;
11681 esac
11682
11683 echo " "
11684 case "$gidtype" in
11685 *_t) zzz="$gidtype"     ;;
11686 *)   zzz="gid"          ;;
11687 esac
11688 echo "Checking the sign of $zzz..." >&4 
11689 cat > try.c <<EOCP
11690 #include <sys/types.h>
11691 #include <stdio.h>
11692 int main() {
11693         $gidtype foo = -1;
11694         if (foo < 0)
11695                 printf("-1\n");
11696         else
11697                 printf("1\n");
11698 }
11699 EOCP
11700 set try
11701 if eval $compile; then
11702         yyy=`./try`
11703         case "$yyy" in
11704         '')     gidsign=1
11705                 echo "(I can't execute the test program--guessing unsigned.)" >&4
11706                 ;;
11707         *)      gidsign=$yyy
11708                 case "$gidsign" in
11709                  1) echo "Your $zzz is unsigned." ;;
11710                 -1) echo "Your $zzz is signed."   ;;
11711                 esac
11712                 ;;
11713         esac
11714 else
11715         gidsign=1
11716         echo "(I can't compile the test program--guessing unsigned.)" >&4
11717 fi
11718
11719
11720 echo " "
11721 case "$gidtype" in
11722 *_t) zzz="$gidtype"     ;;
11723 *)   zzz="gid"          ;;
11724 esac
11725 echo "Checking the size of $zzz..." >&4 
11726 cat > try.c <<EOCP
11727 #include <sys/types.h>
11728 #include <stdio.h>
11729 int main() {
11730     printf("%d\n", sizeof($gidtype));
11731 }
11732 EOCP
11733 set try
11734 if eval $compile_ok; then
11735         yyy=`./try`
11736         case "$yyy" in
11737         '')     gidsize=4
11738                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
11739                 ;;
11740         *)      gidsize=$yyy
11741                 echo "Your $zzz size is $gidsize bytes."
11742                 ;;
11743         esac
11744 else
11745         gidsize=4
11746         echo "(I can't compile the test program--guessing $gidsize.)" >&4
11747 fi
11748
11749
11750 : see if getgroups exists
11751 set getgroups d_getgrps
11752 eval $inlibc
11753
11754 : see if setgroups exists
11755 set setgroups d_setgrps
11756 eval $inlibc
11757
11758
11759 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
11760 echo " "
11761 case "$d_getgrps$d_setgrps" in
11762 *define*)
11763         case "$groupstype" in
11764         '') dflt="$gidtype" ;;
11765         *)  dflt="$groupstype" ;;
11766         esac
11767         $cat <<EOM
11768 What type of pointer is the second argument to getgroups() and setgroups()?
11769 Usually this is the same as group ids, $gidtype, but not always.
11770
11771 EOM
11772         rp='What type pointer is the second argument to getgroups() and setgroups()?'
11773         . ./myread
11774         groupstype="$ans"
11775         ;;
11776 *)  groupstype="$gidtype";;
11777 esac
11778
11779 : see what type lseek is declared as in the kernel
11780 rp="What is the type used for lseek's offset on this system?"
11781 set off_t lseektype long stdio.h sys/types.h
11782 eval $typedef_ask
11783
11784 echo " "
11785 $echo $n "Checking to see how big your file offsets are...$c" >&4
11786 $cat >try.c <<EOCP
11787 #include <sys/types.h>
11788 #include <stdio.h>
11789 int main()
11790 {
11791         printf("%d\n", sizeof($lseektype));
11792 }
11793 EOCP
11794 set try
11795 if eval $compile_ok; then
11796         lseeksize=`./try`
11797         $echo " $lseeksize bytes." >&4
11798 else
11799         dflt='4'
11800         echo " "
11801         echo "(I can't seem to compile the test program.  Guessing...)"
11802         rp="What is the size of your file offsets (in bytes)?"
11803         . ./myread
11804         lseeksize="$ans"
11805 fi
11806 $rm -f try.c try
11807
11808 echo " "
11809 echo "Checking if your $make program sets \$(MAKE)..." >&4
11810 case "$make_set_make" in
11811 '')
11812         $sed 's/^X //' > testmake.mak << 'EOF'
11813 Xall:
11814 X       @echo 'maketemp="$(MAKE)"'
11815 EOF
11816         case "`$make -f testmake.mak 2>/dev/null`" in
11817         *maketemp=*) make_set_make='#' ;;
11818         *)      make_set_make="MAKE=$make" ;;
11819         esac
11820         $rm -f testmake.mak
11821         ;;
11822 esac
11823 case "$make_set_make" in
11824 '#') echo "Yup, it does.";;
11825 *) echo "Nope, it doesn't.";;
11826 esac
11827
11828 : see what type is used for mode_t
11829 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
11830 set mode_t modetype int stdio.h sys/types.h
11831 eval $typedef_ask
11832
11833 : define a fucntion to check prototypes
11834 $cat > protochk <<EOSH
11835 $startsh
11836 cc="$cc"
11837 optimize="$optimize"
11838 ccflags="$ccflags"
11839 prototype="$prototype"
11840 define="$define"
11841 rm=$rm
11842 EOSH
11843
11844 $cat >> protochk <<'EOSH'
11845
11846 $rm -f try.c
11847 foo="$1"
11848 shift
11849 while test $# -ge 2; do
11850         case "$1" in
11851                 $define) echo "#include <$2>" >> try.c ;;
11852                 literal) echo "$2" >> try.c ;;
11853         esac
11854     shift 2
11855 done
11856 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
11857 cat >> try.c <<'EOCP'
11858 #ifdef CAN_PROTOTYPE
11859 #define _(args) args
11860 #else
11861 #define _(args) ()
11862 #endif
11863 EOCP
11864 echo "$foo" >> try.c
11865 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
11866 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
11867 status=$?
11868 $rm -f try.[co]
11869 exit $status
11870 EOSH
11871 chmod +x protochk
11872 $eunicefix protochk
11873
11874 : see what type is used for size_t
11875 rp="What is the type used for the length parameter for string functions?"
11876 set size_t sizetype 'unsigned int' stdio.h sys/types.h
11877 eval $typedef_ask
11878
11879 : check for type of arguments to gethostbyaddr. 
11880 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
11881         case "$d_gethbyaddr" in
11882         $define)
11883                 $cat <<EOM
11884
11885 Checking to see what type of arguments are accepted by gethostbyaddr().
11886 EOM
11887                 hdrs="$define sys/types.h
11888                         $d_socket sys/socket.h 
11889                         $i_niin netinet/in.h 
11890                         $i_netdb netdb.h
11891                         $i_unistd unistd.h"
11892                 : The first arg can 'char *' or 'void *'
11893                 : The second arg is some of integral type
11894                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
11895                         for yyy in size_t long int; do
11896                                 case "$netdb_host_type" in
11897                                 '')     try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
11898                                         if ./protochk "$try" $hdrs; then
11899                                                 echo "Your system accepts $xxx for the first arg."
11900                                                 echo "...and $yyy for the second arg."
11901                                                 netdb_host_type="$xxx"
11902                                                 netdb_hlen_type="$yyy"
11903                                         fi
11904                                         ;;
11905                                 esac
11906                         done
11907                 done
11908                 : In case none of those worked, prompt the user.
11909                 case "$netdb_host_type" in
11910                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
11911                         dflt='char *'
11912                         . ./myread
11913                         netdb_host_type=$ans
11914                         rp='What is the type for the 2nd argument to gethostbyaddr?'
11915                         dflt="$sizetype"
11916                         . ./myread
11917                         netdb_hlen_type=$ans
11918                         ;;
11919                 esac
11920                 ;;
11921         *)      : no gethostbyaddr, so pick harmless defaults
11922                 netdb_host_type='char *'
11923                 netdb_hlen_type="$sizetype"
11924                 ;;
11925         esac
11926         # Remove the "const" if needed. -- but then we'll have a 
11927         # prototype clash!
11928         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
11929 fi
11930
11931 : check for type of argument to gethostbyname. 
11932 if test "X$netdb_name_type" = X ; then
11933         case "$d_gethbyname" in
11934         $define)
11935                 $cat <<EOM
11936
11937 Checking to see what type of argument is accepted by gethostbyname().
11938 EOM
11939                 hdrs="$define sys/types.h
11940                         $d_socket sys/socket.h 
11941                         $i_niin netinet/in.h 
11942                         $i_netdb netdb.h
11943                         $i_unistd unistd.h"
11944                 for xxx in "const char *" "char *"; do
11945                         case "$netdb_name_type" in
11946                         '')     try="extern struct hostent *gethostbyname($xxx);"
11947                                 if ./protochk "$try" $hdrs; then
11948                                         echo "Your system accepts $xxx."
11949                                         netdb_name_type="$xxx"
11950                                 fi
11951                                 ;;
11952                         esac
11953                 done
11954                 : In case none of those worked, prompt the user.
11955                 case "$netdb_name_type" in
11956                 '')     rp='What is the type for the 1st argument to gethostbyname?'
11957                         dflt='char *'
11958                         . ./myread
11959                         netdb_name_type=$ans
11960                         ;;
11961                 esac
11962                 ;;
11963         *)      : no gethostbyname, so pick harmless default
11964                 netdb_name_type='char *'
11965                 ;;
11966         esac
11967 fi
11968
11969 : check for type of 1st argument to getnetbyaddr. 
11970 if test "X$netdb_net_type" = X ; then
11971         case "$d_getnbyaddr" in
11972         $define)
11973                 $cat <<EOM
11974
11975 Checking to see what type of 1st argument is accepted by getnetbyaddr().
11976 EOM
11977                 hdrs="$define sys/types.h
11978                         $d_socket sys/socket.h 
11979                         $i_niin netinet/in.h 
11980                         $i_netdb netdb.h
11981                         $i_unistd unistd.h"
11982                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
11983                         case "$netdb_net_type" in
11984                         '')     try="extern struct netent *getnetbyaddr($xxx, int);"
11985                                 if ./protochk "$try" $hdrs; then
11986                                         echo "Your system accepts $xxx."
11987                                         netdb_net_type="$xxx"
11988                                 fi
11989                                 ;;
11990                         esac
11991                 done
11992                 : In case none of those worked, prompt the user.
11993                 case "$netdb_net_type" in
11994                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
11995                         dflt='long'
11996                         . ./myread
11997                         netdb_net_type=$ans
11998                         ;;
11999                 esac
12000                 ;;
12001         *)      : no getnetbyaddr, so pick harmless default
12002                 netdb_net_type='long'
12003                 ;;
12004         esac
12005 fi
12006 : locate the preferred pager for this system
12007 case "$pager" in
12008 '')
12009         dflt=''
12010         case "$pg" in
12011         /*) dflt=$pg;;
12012         esac
12013         case "$more" in
12014         /*) dflt=$more;;
12015         esac
12016         case "$less" in
12017         /*) dflt=$less;;
12018         esac
12019         case "$dflt" in
12020         '') dflt=/usr/ucb/more;;
12021         esac
12022         ;;
12023 *) dflt="$pager";;
12024 esac
12025 echo " "
12026 fn=f/
12027 rp='What pager is used on your system?'
12028 . ./getfile
12029 pager="$ans"
12030
12031 : see what type pids are declared as in the kernel
12032 rp="What is the type of process ids on this system?"
12033 set pid_t pidtype int stdio.h sys/types.h
12034 eval $typedef_ask
12035
12036 : Find earliest binary compatible site_perl subdirectory perl can use.
12037 case "$bincompat5005" in
12038 "$define") xs_apiversion='5.005' ;;
12039 *) xs_apiversion=$apiversion ;;   # The current site_perl version.
12040 esac
12041 : Find earliest pure perl site_perl subdirectory perl can use.
12042 : The versioned directories started at 5.005.
12043 pm_apiversion='5.005'
12044
12045 : check for length of pointer
12046 echo " "
12047 case "$ptrsize" in
12048 '')
12049         $echo $n "Checking to see how big your pointers are...$c" >&4
12050         if test "$voidflags" -gt 7; then
12051                 echo '#define VOID_PTR char *' > try.c
12052         else
12053                 echo '#define VOID_PTR void *' > try.c
12054         fi
12055         $cat >>try.c <<'EOCP'
12056 #include <stdio.h>
12057 int main()
12058 {
12059         printf("%d\n", sizeof(VOID_PTR));
12060         exit(0);
12061 }
12062 EOCP
12063         set try
12064         if eval $compile_ok; then
12065                 ptrsize=`./try`
12066                 $echo " $ptrsize bytes." >&4
12067         else
12068                 dflt='4'
12069                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
12070                 rp="What is the size of a pointer (in bytes)?"
12071                 . ./myread
12072                 ptrsize="$ans"
12073         fi
12074         ;;
12075 esac
12076 $rm -f try.c try
12077
12078 : see if ar generates random libraries by itself
12079 echo " "
12080 echo "Checking how to generate random libraries on your machine..." >&4
12081 echo 'int bar1() { return bar2(); }' > bar1.c
12082 echo 'int bar2() { return 2; }' > bar2.c
12083 $cat > foo.c <<'EOP'
12084 int main() { printf("%d\n", bar1()); exit(0); }
12085 EOP
12086 $cc $ccflags -c bar1.c >/dev/null 2>&1
12087 $cc $ccflags -c bar2.c >/dev/null 2>&1
12088 $cc $ccflags -c foo.c >/dev/null 2>&1
12089 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
12090 if $cc $ccflags $ldflags -o foobar foo$_o bar$_a $libs > /dev/null 2>&1 &&
12091         ./foobar >/dev/null 2>&1; then
12092         echo "$ar appears to generate random libraries itself."
12093         orderlib=false
12094         ranlib=":"
12095 elif $ar ts bar$_a >/dev/null 2>&1 &&
12096         $cc $ccflags $ldflags -o foobar foo$_o bar$_a $libs > /dev/null 2>&1 &&
12097         ./foobar >/dev/null 2>&1; then
12098                 echo "a table of contents needs to be added with '$ar ts'."
12099                 orderlib=false
12100                 ranlib="$ar ts"
12101 else
12102         case "$ranlib" in
12103         :) ranlib='';;
12104         '')
12105                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
12106                 $test -f $ranlib || ranlib=''
12107                 ;;
12108         esac
12109         if $test -n "$ranlib"; then
12110                 echo "your system has '$ranlib'; we'll use that."
12111                 orderlib=false
12112         else
12113                 echo "your system doesn't seem to support random libraries"
12114                 echo "so we'll use lorder and tsort to order the libraries."
12115                 orderlib=true
12116                 ranlib=":"
12117         fi
12118 fi
12119 $rm -f foo* bar* 
12120
12121 : check for type of arguments to select. 
12122 case "$selecttype" in
12123 '') case "$d_select" in
12124         $define)
12125                 $cat <<EOM
12126 Checking to see what type of arguments are accepted by select().
12127 EOM
12128                 hdrs="$define sys/types.h
12129                         $i_systime sys/time.h 
12130                         $i_sysselct sys/select.h
12131                         $d_socket sys/socket.h"
12132                 : The first arg can be int, unsigned, or size_t
12133                 : The last arg may or may not be 'const'
12134                 val=''
12135                 : void pointer has been seen but using that
12136                 : breaks the selectminbits test
12137                 for xxx in 'fd_set *' 'int *'; do
12138                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
12139                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
12140                                         case "$val" in
12141                                         '')     try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
12142                                                 if ./protochk "$try" $hdrs; then
12143                                                         echo "Your system accepts $xxx."
12144                                                         val="$xxx"
12145                                                 fi
12146                                                 ;;
12147                                         esac
12148                                 done
12149                         done
12150                 done
12151                 case "$val" in
12152                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
12153                         case "$d_fd_set" in
12154                                 $define) dflt="fd_set *" ;;
12155                                 *)              dflt="int *" ;;
12156                         esac
12157                         . ./myread
12158                         val=$ans
12159                         ;;
12160                 esac
12161                 selecttype="$val"
12162                 ;;
12163         *)      : no select, so pick a harmless default
12164                 selecttype='int *'
12165                 ;;
12166         esac
12167         ;;
12168 esac
12169
12170 : check for the select 'width'
12171 case "$selectminbits" in
12172 '') case "$d_select" in
12173         $define)
12174                 $cat <<EOM
12175
12176 Checking to see on how many bits at a time your select() operates...
12177 EOM
12178                 $cat >try.c <<EOCP
12179 #include <sys/types.h>
12180 #$i_time I_TIME
12181 #$i_systime I_SYS_TIME
12182 #$i_systimek I_SYS_TIME_KERNEL
12183 #ifdef I_TIME
12184 #   include <time.h>
12185 #endif
12186 #ifdef I_SYS_TIME
12187 #   ifdef I_SYS_TIME_KERNEL
12188 #       define KERNEL
12189 #   endif
12190 #   include <sys/time.h>
12191 #   ifdef I_SYS_TIME_KERNEL
12192 #       undef KERNEL
12193 #   endif
12194 #endif
12195 #$i_sysselct I_SYS_SELECT
12196 #ifdef I_SYS_SELECT
12197 #include <sys/select.h>
12198 #endif
12199 #$d_socket HAS_SOCKET
12200 #ifdef HAS_SOCKET
12201 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
12202 #endif
12203 #include <stdio.h>
12204 $selecttype b;
12205 #define S sizeof(*(b))
12206 #define MINBITS 64
12207 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
12208 #define NBITS  (NBYTES * 8)
12209 int main() {
12210     char s[NBYTES];
12211     struct timeval t;
12212     int i;
12213     FILE* fp;
12214     int fd;
12215
12216     fclose(stdin);
12217     fp = fopen("try.c", "r");
12218     if (fp == 0)
12219       exit(1);
12220     fd = fileno(fp);
12221     if (fd < 0)
12222       exit(2);
12223     b = ($selecttype)s;
12224     for (i = 0; i < NBITS; i++)
12225         FD_SET(i, b);
12226     t.tv_sec  = 0;
12227     t.tv_usec = 0;
12228     select(fd + 1, b, 0, 0, &t);
12229     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
12230     printf("%d\n", i + 1);
12231     return 0;
12232 }
12233 EOCP
12234                 set try
12235                 if eval $compile_ok; then
12236                         selectminbits=`./try`
12237                         case "$selectminbits" in
12238                         '')     cat >&4 <<EOM
12239 Cannot figure out on how many bits at a time your select() operates.
12240 I'll play safe and guess it is 32 bits.
12241 EOM
12242                                 selectminbits=32
12243                                 bits="32 bits"
12244                                 ;;
12245                         1)      bits="1 bit" ;;
12246                         *)      bits="$selectminbits bits" ;;
12247                         esac
12248                         echo "Your select() operates on $bits at a time." >&4
12249                 else
12250                         rp='What is the minimum number of bits your select() operates on?'
12251                         case "$byteorder" in
12252                         1234|12345678)  dflt=32 ;;
12253                         *)              dflt=1  ;;
12254                         esac
12255                         . ./myread
12256                         val=$ans
12257                         selectminbits="$val"
12258                 fi
12259                 $rm -f try.* try
12260                 ;;
12261         *)      : no select, so pick a harmless default
12262                 selectminbits='32'
12263                 ;;
12264         esac
12265         ;;
12266 esac
12267
12268 : Trace out the files included by signal.h, then look for SIGxxx names.
12269 : Remove SIGARRAYSIZE used by HPUX.
12270 : Remove SIGSTKSIZE used by Linux.
12271 : Remove SIGSTKSZ used by Posix.
12272 : Remove SIGTYP void lines used by OS2.
12273 xxx=`echo '#include <signal.h>' |
12274         $cppstdin $cppminus $cppflags 2>/dev/null |
12275         $grep '^[       ]*#.*include' | 
12276         $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sort | $uniq`
12277 : Check this list of files to be sure we have parsed the cpp output ok.
12278 : This will also avoid potentially non-existent files, such 
12279 : as ../foo/bar.h
12280 xxxfiles=''
12281 for xx in $xxx /dev/null ; do
12282         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
12283 done
12284 : If we have found no files, at least try signal.h
12285 case "$xxxfiles" in
12286 '')     xxxfiles=`./findhdr signal.h` ;;
12287 esac
12288 xxx=`awk '
12289 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
12290         print substr($2, 4, 20)
12291 }
12292 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
12293         print substr($3, 4, 20)
12294 }' $xxxfiles`
12295 : Append some common names just in case the awk scan failed.
12296 xxx="$xxx ABRT ALRM BUS CHLD CLD CONT DIL EMT FPE HUP ILL INT IO IOT KILL"
12297 xxx="$xxx LOST PHONE PIPE POLL PROF PWR QUIT SEGV STKFLT STOP SYS TERM TRAP"
12298 xxx="$xxx TSTP TTIN TTOU URG USR1 USR2 USR3 USR4 VTALRM"
12299 xxx="$xxx WINCH WIND WINDOW XCPU XFSZ"
12300 : generate a few handy files for later
12301 $cat > signal.c <<'EOCP'
12302 #include <sys/types.h>
12303 #include <signal.h>
12304 #include <stdio.h>
12305 int main() {
12306
12307 /* Strange style to avoid deeply-nested #if/#else/#endif */
12308 #ifndef NSIG
12309 #  ifdef _NSIG
12310 #    define NSIG (_NSIG)
12311 #  endif
12312 #endif
12313
12314 #ifndef NSIG
12315 #  ifdef SIGMAX
12316 #    define NSIG (SIGMAX+1)
12317 #  endif
12318 #endif
12319
12320 #ifndef NSIG
12321 #  ifdef SIG_MAX
12322 #    define NSIG (SIG_MAX+1)
12323 #  endif
12324 #endif
12325
12326 #ifndef NSIG
12327 #  ifdef MAXSIG
12328 #    define NSIG (MAXSIG+1)
12329 #  endif
12330 #endif
12331
12332 #ifndef NSIG
12333 #  ifdef MAX_SIG
12334 #    define NSIG (MAX_SIG+1)
12335 #  endif
12336 #endif
12337
12338 #ifndef NSIG
12339 #  ifdef SIGARRAYSIZE
12340 #    define NSIG (SIGARRAYSIZE+1) /* Not sure of the +1 */
12341 #  endif
12342 #endif
12343
12344 #ifndef NSIG
12345 #  ifdef _sys_nsig
12346 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
12347 #  endif
12348 #endif
12349
12350 /* Default to some arbitrary number that's big enough to get most
12351    of the common signals.
12352 */
12353 #ifndef NSIG
12354 #    define NSIG 50
12355 #endif
12356
12357 printf("NSIG %d\n", NSIG);
12358
12359 #ifndef JUST_NSIG
12360
12361 EOCP
12362
12363 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
12364 {
12365         printf "#ifdef SIG"; printf $1; printf "\n"
12366         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
12367         printf $1; printf ");\n"
12368         printf "#endif\n"
12369 }
12370 END {
12371         printf "#endif /* JUST_NSIG */\n";
12372         printf "}\n";
12373 }
12374 ' >>signal.c
12375 $cat >signal.awk <<'EOP'
12376 BEGIN { ndups = 0 }
12377 $1 ~ /^NSIG$/ { nsig = $2 }
12378 ($1 !~ /^NSIG$/) && (NF == 2) {
12379     if ($2 > maxsig) { maxsig = $2 }
12380     if (sig_name[$2]) {
12381         dup_name[ndups] = $1
12382         dup_num[ndups] = $2
12383         ndups++ 
12384     }
12385     else {
12386         sig_name[$2] = $1
12387         sig_num[$2] = $2
12388     }
12389 }
12390 END { 
12391     if (nsig == 0) {
12392         nsig = maxsig + 1
12393     }
12394     printf("NSIG %d\n", nsig);
12395     for (n = 1; n < nsig; n++) {
12396         if (sig_name[n]) {
12397             printf("%s %d\n", sig_name[n], sig_num[n])
12398         }
12399         else {
12400             printf("NUM%d %d\n", n, n) 
12401         }
12402     }
12403     for (n = 0; n < ndups; n++) {
12404         printf("%s %d\n", dup_name[n], dup_num[n])
12405     }
12406 }
12407 EOP
12408 $cat >signal_cmd <<EOS
12409 $startsh
12410 if $test -s signal.lst; then
12411     echo "Using your existing signal.lst file"
12412         exit 0
12413 fi
12414 xxx="$xxx"
12415 EOS
12416 $cat >>signal_cmd <<'EOS'
12417
12418 set signal
12419 if eval $compile_ok; then
12420         ./signal$_exe | $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
12421 else
12422         echo "(I can't seem be able to compile the whole test program)" >&4
12423         echo "(I'll try it in little pieces.)" >&4
12424         set signal -DJUST_NSIG
12425         if eval $compile_ok; then
12426                 ./signal$_exe > signal.nsg
12427                 $cat signal.nsg
12428         else
12429                 echo "I can't seem to figure out how many signals you have." >&4
12430                 echo "Guessing 50." >&4
12431                 echo 'NSIG 50' > signal.nsg
12432         fi
12433         : Now look at all the signal names, one at a time.
12434         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
12435                 $cat > signal.c <<EOCP
12436 #include <sys/types.h>
12437 #include <signal.h>
12438 #include <stdio.h>
12439 int main() {
12440 printf("$xx %d\n", SIG${xx});
12441 return 0;
12442 }
12443 EOCP
12444                 set signal
12445                 if eval $compile; then
12446                         echo "SIG${xx} found."
12447                         ./signal$_exe  >> signal.ls1
12448                 else
12449                         echo "SIG${xx} NOT found."
12450                 fi
12451         done
12452         if $test -s signal.ls1; then
12453                 $cat signal.nsg signal.ls1 |
12454                         $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
12455         fi
12456
12457 fi
12458 if $test -s signal.lst; then
12459         :
12460 else
12461         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
12462         echo 'kill -l' >signal
12463         set X `csh -f <signal`
12464         $rm -f signal
12465         shift
12466         case $# in
12467         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
12468         esac
12469         echo $@ | $tr ' ' $trnl | \
12470             $awk '{ printf "%s %d\n", $1, ++s; }
12471                   END { printf "NSIG %d\n", ++s }' >signal.lst
12472 fi
12473 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
12474 EOS
12475 chmod a+x signal_cmd
12476 $eunicefix signal_cmd
12477
12478 : generate list of signal names
12479 echo " "
12480 case "$sig_name_init" in
12481 '') doinit=yes ;;
12482 *)  case "$sig_num_init" in
12483     ''|*,*) doinit=yes ;;
12484     esac ;;
12485 esac
12486 case "$doinit" in
12487 yes)
12488         echo "Generating a list of signal names and numbers..." >&4
12489         . ./signal_cmd
12490         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
12491         sig_name=`$awk 'BEGIN { printf "ZERO " }
12492                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
12493         sig_num=`$awk  'BEGIN { printf "0 " }
12494                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
12495         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
12496                              !/^NSIG/   { printf "\"%s\", ", $1 }
12497                              END        { printf "0\n" }' signal.lst`
12498         sig_num_init=`$awk  'BEGIN      { printf "0, " }
12499                              !/^NSIG/   { printf "%d, ", $2}
12500                              END        { printf "0\n"}' signal.lst`
12501         ;;
12502 esac
12503 echo "The following $sig_count signals are available:"
12504 echo " "
12505 echo $sig_name | $awk \
12506 'BEGIN { linelen = 0 }
12507 {
12508         for (i = 1; i <= NF; i++) {
12509                 name = "SIG" $i " "
12510                 linelen = linelen + length(name)
12511                 if (linelen > 70) {
12512                         printf "\n"
12513                         linelen = length(name)
12514                 }
12515                 printf "%s", name
12516         }
12517         printf "\n"
12518 }'
12519 $rm -f signal signal.c signal.awk signal.lst signal_cmd 
12520
12521 : see what type is used for signed size_t
12522 set ssize_t ssizetype int stdio.h sys/types.h
12523 eval $typedef
12524 dflt="$ssizetype"
12525 $cat > ssize.c <<EOM
12526 #include <stdio.h>
12527 #include <sys/types.h>
12528 #define Size_t $sizetype
12529 #define SSize_t $dflt
12530 int main()
12531 {
12532         if (sizeof(Size_t) == sizeof(SSize_t))
12533                 printf("$dflt\n");
12534         else if (sizeof(Size_t) == sizeof(int))
12535                 printf("int\n");
12536         else 
12537                 printf("long\n");
12538         exit(0);
12539 }
12540 EOM
12541 echo " "
12542 set ssize
12543 if eval $compile_ok && ./ssize > /dev/null; then
12544         ssizetype=`./ssize`
12545         echo "I'll be using $ssizetype for functions returning a byte count." >&4
12546 else
12547         $cat >&4 <<EOM
12548 Help! I can't compile and run the ssize_t test program: please enlighten me!
12549 (This is probably a misconfiguration in your system or libraries, and
12550 you really ought to fix it.  Still, I'll try anyway.)
12551
12552 I need a type that is the same size as $sizetype, but is guaranteed to
12553 be signed.  Common values are ssize_t, int and long.
12554
12555 EOM
12556         rp="What signed type is the same size as $sizetype?"
12557         . ./myread
12558         ssizetype="$ans"
12559 fi
12560 $rm -f ssize ssize.*
12561
12562 : see what type of char stdio uses.
12563 echo " "
12564 if $contains 'unsigned.*char.*_ptr;' `./findhdr stdio.h` >/dev/null 2>&1 ; then
12565         echo "Your stdio uses unsigned chars." >&4
12566         stdchar="unsigned char"
12567 else
12568         echo "Your stdio uses signed chars." >&4
12569         stdchar="char"
12570 fi
12571
12572 : see if time exists
12573 echo " "
12574 if test "X$d_time" = X -o X"$timetype" = X; then
12575     if set time val -f d_time; eval $csym; $val; then
12576                 echo 'time() found.' >&4
12577                 val="$define"
12578                 rp="What is the type returned by time() on this system?"
12579                 set time_t timetype long stdio.h sys/types.h
12580                 eval $typedef_ask
12581     else
12582                 echo 'time() not found, hope that will do.' >&4
12583                 val="$undef"
12584                 timetype='int';
12585     fi
12586     set d_time
12587     eval $setvar
12588 fi
12589
12590 : see what type uids are declared as in the kernel
12591 echo " "
12592 echo "Looking for the type for user ids returned by getuid()."
12593 set uid_t uidtype xxx stdio.h sys/types.h
12594 eval $typedef
12595 case "$uidtype" in
12596 xxx)
12597         xxx=`./findhdr sys/user.h`
12598         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
12599         case $1 in
12600         unsigned) dflt="$1 $2" ;;
12601         *) dflt="$1" ;;
12602         esac
12603         ;;
12604 *) dflt="$uidtype";;
12605 esac
12606 case "$uidtype" in
12607 uid_t)  echo "uid_t found." ;;
12608 *)      rp="What is the type for user ids returned by getuid()?"
12609         . ./myread
12610         uidtype="$ans"
12611         ;;
12612 esac
12613
12614 echo " "
12615 case "$uidtype" in
12616 *_t) zzz="$uidtype"     ;;
12617 *)   zzz="uid"          ;;
12618 esac
12619 echo "Checking the sign of $zzz..." >&4
12620 cat > try.c <<EOCP
12621 #include <sys/types.h>
12622 #include <stdio.h>
12623 int main() {
12624         $uidtype foo = -1;
12625         if (foo < 0)
12626                 printf("-1\n");
12627         else
12628                 printf("1\n");
12629 }
12630 EOCP
12631 set try
12632 if eval $compile; then
12633         yyy=`./try`
12634         case "$yyy" in
12635         '')     uidsign=1
12636                 echo "(I can't execute the test program--guessing unsigned.)" >&4
12637                 ;;
12638         *)      uidsign=$yyy
12639                 case "$uidsign" in
12640                  1) echo "Your $zzz is unsigned." ;;
12641                 -1) echo "Your $zzz is signed."   ;;
12642                 esac
12643                 ;;
12644         esac
12645 else
12646         uidsign=1
12647         echo "(I can't compile the test program--guessing unsigned.)" >&4
12648 fi
12649
12650
12651 echo " "
12652 case "$uidtype" in
12653 *_t) zzz="$uidtype"     ;;
12654 *)   zzz="uid"          ;;
12655 esac
12656 echo "Checking the size of $zzz..." >&4 
12657 cat > try.c <<EOCP
12658 #include <sys/types.h>
12659 #include <stdio.h>
12660 int main() {
12661     printf("%d\n", sizeof($uidtype));
12662 }
12663 EOCP
12664 set try
12665 if eval $compile_ok; then
12666         yyy=`./try`
12667         case "$yyy" in
12668         '')     uidsize=4
12669                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
12670                 ;;
12671         *)      uidsize=$yyy
12672                 echo "Your $zzz size is $uidsize bytes."
12673                 ;;
12674         esac
12675 else
12676         uidsize=4
12677         echo "(I can't compile the test program--guessing $uidsize.)" >&4
12678 fi
12679
12680 : see if dbm.h is available
12681 : see if dbmclose exists
12682 set dbmclose d_dbmclose
12683 eval $inlibc
12684
12685 case "$d_dbmclose" in
12686 $define)
12687         set dbm.h i_dbm
12688         eval $inhdr
12689         case "$i_dbm" in
12690         $define)
12691                 val="$undef"
12692                 set i_rpcsvcdbm
12693                 eval $setvar
12694                 ;;
12695         *)      set rpcsvc/dbm.h i_rpcsvcdbm
12696                 eval $inhdr
12697                 ;;
12698         esac
12699         ;;
12700 *)      echo "We won't be including <dbm.h>"
12701         val="$undef"
12702         set i_dbm
12703         eval $setvar
12704         val="$undef"
12705         set i_rpcsvcdbm
12706         eval $setvar
12707         ;;
12708 esac
12709
12710 : see if this is a sys/file.h system
12711 val=''
12712 set sys/file.h val
12713 eval $inhdr
12714
12715 : do we need to include sys/file.h ?
12716 case "$val" in
12717 "$define")
12718         echo " "
12719         if $h_sysfile; then
12720                 val="$define"
12721                 echo "We'll be including <sys/file.h>." >&4
12722         else
12723                 val="$undef"
12724                 echo "We won't be including <sys/file.h>." >&4
12725         fi
12726         ;;
12727 *)
12728         h_sysfile=false
12729         ;;
12730 esac
12731 set i_sysfile
12732 eval $setvar
12733
12734 : see if fcntl.h is there
12735 val=''
12736 set fcntl.h val
12737 eval $inhdr
12738
12739 : see if we can include fcntl.h
12740 case "$val" in
12741 "$define")
12742         echo " "
12743         if $h_fcntl; then
12744                 val="$define"
12745                 echo "We'll be including <fcntl.h>." >&4
12746         else
12747                 val="$undef"
12748                 if $h_sysfile; then
12749         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
12750                 else
12751                         echo "We won't be including <fcntl.h>." >&4
12752                 fi
12753         fi
12754         ;;
12755 *)
12756         h_fcntl=false
12757         val="$undef"
12758         ;;
12759 esac
12760 set i_fcntl
12761 eval $setvar
12762
12763 : see if locale.h is available
12764 set locale.h i_locale
12765 eval $inhdr
12766
12767 : see if mach cthreads are available
12768 if test "X$usethreads" = "X$define"; then
12769         set mach/cthreads.h i_machcthr
12770         eval $inhdr
12771 else
12772         i_machcthr="$undef"
12773 fi
12774
12775
12776
12777 : see if this is a math.h system
12778 set math.h i_math
12779 eval $inhdr
12780
12781 : see if this is a mntent.h system
12782 set mntent.h i_mntent
12783 eval $inhdr
12784
12785 : see if ndbm.h is available
12786 set ndbm.h t_ndbm
12787 eval $inhdr
12788 case "$t_ndbm" in
12789 $define)
12790         : see if dbm_open exists
12791         set dbm_open d_dbm_open
12792         eval $inlibc
12793         case "$d_dbm_open" in
12794         $undef)
12795                 t_ndbm="$undef"
12796                 echo "We won't be including <ndbm.h>"
12797                 ;;
12798         esac
12799         ;;
12800 esac
12801 val="$t_ndbm"
12802 set i_ndbm
12803 eval $setvar
12804
12805 : see if net/errno.h is available
12806 val=''
12807 set net/errno.h val
12808 eval $inhdr
12809
12810 : Unfortunately, it causes problems on some systems.  Arrgh.
12811 case "$val" in
12812 $define)
12813         cat > try.c <<'EOM'
12814 #include <stdio.h>
12815 #include <errno.h>
12816 #include <net/errno.h>
12817 int func()
12818 {
12819         return ENOTSOCK;
12820 }
12821 EOM
12822         if $cc $ccflags -c try.c >/dev/null 2>&1; then
12823                 echo "We'll be including <net/errno.h>." >&4
12824         else
12825                 echo "We won't be including <net/errno.h>." >&4
12826                 val="$undef"
12827         fi
12828         $rm -f try.* try
12829         ;;
12830 esac
12831 set i_neterrno
12832 eval $setvar
12833
12834 : see if netinet/tcp.h is available
12835 set netinet/tcp.h i_netinettcp
12836 eval $inhdr
12837
12838 : see if this is a poll.h system
12839 set poll.h i_poll
12840 eval $inhdr
12841
12842 : get C preprocessor symbols handy
12843 echo " "
12844 $echo $n "Hmm... $c"
12845 echo $al | $tr ' ' $trnl >Cppsym.know
12846 $cat <<EOSS >Cppsym
12847 $startsh
12848 case "\$1" in
12849 -l) list=true
12850         shift
12851         ;;
12852 esac
12853 unknown=''
12854 case "\$list\$#" in
12855 1|2)
12856         for sym do
12857                 if $contains "^\$1$" Cppsym.true >/dev/null 2>&1; then
12858                         exit 0
12859                 elif $contains "^\$1$" Cppsym.know >/dev/null 2>&1; then
12860                         :
12861                 else
12862                         unknown="\$unknown \$sym"
12863                 fi
12864         done
12865         set X \$unknown
12866         shift
12867         ;;
12868 esac
12869 case \$# in
12870 0) exit 1;;
12871 esac
12872 echo \$* | $tr ' ' '$trnl' | $sed -e 's/\(.*\)/\\
12873 #ifdef \1\\
12874 exit 0; _ _ _ _\1\\      \1\\
12875 #endif\\
12876 /' >Cppsym\$\$
12877 echo "exit 1; _ _ _" >>Cppsym\$\$
12878 $cppstdin $cppminus <Cppsym\$\$ | $grep '^exit [01]; _ _'  >Cppsym2\$\$
12879 case "\$list" in
12880 true) $awk 'NF > 5 {print substr(\$6,2,100)}' <Cppsym2\$\$ ;;
12881 *)
12882         sh Cppsym2\$\$
12883         status=\$?
12884         ;;
12885 esac
12886 $rm -f Cppsym\$\$ Cppsym2\$\$
12887 exit \$status
12888 EOSS
12889 chmod +x Cppsym
12890 $eunicefix Cppsym
12891 ./Cppsym -l $al | $sort | $grep -v '^$' >Cppsym.true
12892
12893 : now check the C compiler for additional symbols
12894 postprocess_cc_v=''
12895 case "$osname" in
12896 aix) postprocess_cc_v="|$tr , ' '" ;;
12897 esac
12898 $cat >ccsym <<EOS
12899 $startsh
12900 $cat >tmp.c <<EOF
12901 extern int foo;
12902 EOF
12903 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
12904 do
12905         case "\$i" in
12906         -D*) echo "\$i" | $sed 's/^-D//';;
12907         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A\(.*\)(\(.*\))/\1=\2/';;
12908         esac
12909 done
12910 $rm -f try.c
12911 EOS
12912 postprocess_cc_v=''
12913 chmod +x ccsym
12914 $eunicefix ccsym
12915 ./ccsym > ccsym1.raw
12916 if $test -s ccsym1.raw; then
12917        $sort ccsym1.raw | $uniq >ccsym.raw
12918 else
12919        mv ccsym1.raw ccsym.raw
12920 fi
12921
12922 $awk '/\=/ { print $0; next }
12923         { print $0"=1" }' ccsym.raw >ccsym.list
12924 $awk '{ print $0"=1" }' Cppsym.true >ccsym.true
12925 $comm -13 ccsym.true ccsym.list >ccsym.own
12926 $comm -12 ccsym.true ccsym.list >ccsym.com
12927 $comm -23 ccsym.true ccsym.list >ccsym.cpp
12928 also=''
12929 if $test -z ccsym.raw; then
12930         echo "Your C compiler doesn't seem to define any symbols!" >&4
12931         echo " "
12932         echo "However, your C preprocessor defines the following symbols:"
12933         $cat Cppsym.true
12934         ccsymbols=''
12935         cppsymbols=`$cat Cppsym.true`
12936         cppsymbols=`echo $cppsymbols`
12937         cppccsymbols="$cppsymbols"
12938 else
12939         if $test -s ccsym.com; then
12940                 echo "Your C compiler and pre-processor define these symbols:"
12941                 $sed -e 's/\(.*\)=.*/\1/' ccsym.com
12942                 also='also '
12943                 symbols='ones'
12944                 cppccsymbols=`$cat ccsym.com`
12945                 cppccsymbols=`echo $cppccsymbols`
12946                 $test "$silent" || sleep 1
12947         fi
12948         if $test -s ccsym.cpp; then
12949                 $test "$also" && echo " "
12950                 echo "Your C pre-processor ${also}defines the following symbols:"
12951                 $sed -e 's/\(.*\)=.*/\1/' ccsym.cpp
12952                 also='further '
12953                 cppsymbols=`$cat ccsym.cpp`
12954                 cppsymbols=`echo $cppsymbols`
12955                 $test "$silent" || sleep 1
12956         fi
12957         if $test -s ccsym.own; then
12958                 $test "$also" && echo " "
12959                 echo "Your C compiler ${also}defines the following cpp symbols:"
12960                 $sed -e 's/\(.*\)=1/\1/' ccsym.own
12961                 $sed -e 's/\(.*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
12962                 ccsymbols=`$cat ccsym.own`
12963                 ccsymbols=`echo $ccsymbols`
12964                 $test "$silent" || sleep 1
12965         fi
12966 fi
12967 $rm -f ccsym*
12968
12969 : see if this is a termio system
12970 val="$undef"
12971 val2="$undef"
12972 val3="$undef"
12973 if $test `./findhdr termios.h`; then
12974         set tcsetattr i_termios
12975         eval $inlibc
12976         val3="$i_termios"
12977 fi
12978 echo " "
12979 case "$val3" in
12980 "$define") echo "You have POSIX termios.h... good!" >&4;;
12981 *) if ./Cppsym pyr; then
12982                 case "`/bin/universe`" in
12983                 ucb) if $test `./findhdr sgtty.h`; then
12984                                 val2="$define"
12985                                 echo "<sgtty.h> found." >&4
12986                         else
12987                                 echo "System is pyramid with BSD universe."
12988                                 echo "<sgtty.h> not found--you could have problems." >&4
12989                         fi;;
12990                 *) if $test `./findhdr termio.h`; then
12991                                 val="$define"
12992                                 echo "<termio.h> found." >&4
12993                         else
12994                                 echo "System is pyramid with USG universe."
12995                                 echo "<termio.h> not found--you could have problems." >&4
12996                         fi;;
12997                 esac
12998         elif ./usg; then
12999                 if $test `./findhdr termio.h`; then
13000                         echo "<termio.h> found." >&4
13001                         val="$define"
13002                 elif $test `./findhdr sgtty.h`; then
13003                         echo "<sgtty.h> found." >&4
13004                         val2="$define"
13005                 else
13006 echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
13007                 fi
13008         else
13009                 if $test `./findhdr sgtty.h`; then
13010                         echo "<sgtty.h> found." >&4
13011                         val2="$define"
13012                 elif $test `./findhdr termio.h`; then
13013                         echo "<termio.h> found." >&4
13014                         val="$define"
13015                 else
13016 echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
13017                 fi
13018         fi;;
13019 esac
13020 set i_termio; eval $setvar
13021 val=$val2; set i_sgtty; eval $setvar
13022 val=$val3; set i_termios; eval $setvar
13023
13024 : see if this is a shadow.h system
13025 set shadow.h i_shadow
13026 eval $inhdr
13027
13028 : see if this is a socks.h system
13029 set socks.h i_socks
13030 eval $inhdr
13031
13032 : see if stdarg is available
13033 echo " "
13034 if $test `./findhdr stdarg.h`; then
13035         echo "<stdarg.h> found." >&4
13036         valstd="$define"
13037 else
13038         echo "<stdarg.h> NOT found." >&4
13039         valstd="$undef"
13040 fi
13041
13042 : see if varags is available
13043 echo " "
13044 if $test `./findhdr varargs.h`; then
13045         echo "<varargs.h> found." >&4
13046 else
13047         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
13048 fi
13049
13050 : set up the varargs testing programs
13051 $cat > varargs.c <<EOP
13052 #ifdef I_STDARG
13053 #include <stdarg.h>
13054 #endif
13055 #ifdef I_VARARGS
13056 #include <varargs.h>
13057 #endif
13058
13059 #ifdef I_STDARG
13060 int f(char *p, ...)
13061 #else
13062 int f(va_alist)
13063 va_dcl
13064 #endif
13065 {
13066         va_list ap;
13067 #ifndef I_STDARG
13068         char *p;
13069 #endif
13070 #ifdef I_STDARG
13071         va_start(ap,p);
13072 #else
13073         va_start(ap);
13074         p = va_arg(ap, char *);
13075 #endif
13076         va_end(ap);
13077 }
13078 EOP
13079 $cat > varargs <<EOP
13080 $startsh
13081 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
13082         echo "true"
13083 else
13084         echo "false"
13085 fi
13086 $rm -f varargs$_o
13087 EOP
13088 chmod +x varargs
13089
13090 : now check which varargs header should be included
13091 echo " "
13092 i_varhdr=''
13093 case "$valstd" in
13094 "$define")
13095         if `./varargs I_STDARG`; then
13096                 val='stdarg.h'
13097         elif `./varargs I_VARARGS`; then
13098                 val='varargs.h'
13099         fi
13100         ;;
13101 *)
13102         if `./varargs I_VARARGS`; then
13103                 val='varargs.h'
13104         fi
13105         ;;
13106 esac
13107 case "$val" in
13108 '')
13109 echo "I could not find the definition for va_dcl... You have problems..." >&4
13110         val="$undef"; set i_stdarg; eval $setvar
13111         val="$undef"; set i_varargs; eval $setvar
13112         ;;
13113 *) 
13114         set i_varhdr
13115         eval $setvar
13116         case "$i_varhdr" in
13117         stdarg.h)
13118                 val="$define"; set i_stdarg; eval $setvar
13119                 val="$undef"; set i_varargs; eval $setvar
13120                 ;;
13121         varargs.h)
13122                 val="$undef"; set i_stdarg; eval $setvar
13123                 val="$define"; set i_varargs; eval $setvar
13124                 ;;
13125         esac
13126         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
13127 esac
13128 $rm -f varargs*
13129
13130 : see if stddef is available
13131 set stddef.h i_stddef
13132 eval $inhdr
13133
13134 : see if sys/access.h is available
13135 set sys/access.h i_sysaccess
13136 eval $inhdr
13137
13138 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
13139 set sys/filio.h i_sysfilio
13140 eval $inhdr
13141 echo " "
13142 if $test `./findhdr sys/ioctl.h`; then
13143         val="$define"
13144         echo '<sys/ioctl.h> found.' >&4
13145 else
13146         val="$undef"
13147         if $test $i_sysfilio = "$define"; then
13148             echo '<sys/ioctl.h> NOT found.' >&4
13149         else
13150                 $test $i_sgtty = "$define" && xxx="sgtty.h"
13151                 $test $i_termio = "$define" && xxx="termio.h"
13152                 $test $i_termios = "$define" && xxx="termios.h"
13153 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
13154         fi
13155 fi
13156 set i_sysioctl
13157 eval $setvar
13158
13159 : see if sys/resource.h has to be included
13160 set sys/resource.h i_sysresrc
13161 eval $inhdr
13162
13163 : see if sys/security.h is available
13164 set sys/security.h i_syssecrt
13165 eval $inhdr
13166
13167 : see if this is a sys/statvfs.h system
13168 set sys/statvfs.h i_sysstatvfs
13169 eval $inhdr
13170
13171 : see if this is a sys/uio.h system
13172 set sys/uio.h i_sysuio
13173 eval $inhdr
13174
13175 echo "Checking to see if your system supports struct iovec..." >&4
13176 set d_iovec_s iovec iov_base $i_sysuio sys/uio.h
13177 eval $hasfield
13178 case "$d_iovec_s" in
13179 "$define")      echo "Yup, it does." >&4
13180                 ;;
13181 *)              echo "Nope, it doesn't." >&4
13182                 ;;
13183 esac
13184
13185 : see if this is a sys/un.h system
13186 set sys/un.h i_sysun
13187 eval $inhdr
13188
13189 : see if this is a syswait system
13190 set sys/wait.h i_syswait
13191 eval $inhdr
13192
13193 : see if this is a ustat.h system
13194 set ustat.h i_ustat
13195 eval $inhdr
13196
13197 : see if this is an utime system
13198 set utime.h i_utime
13199 eval $inhdr
13200
13201 : see if this is a values.h system
13202 set values.h i_values
13203 eval $inhdr
13204
13205 : see if this is a vfork system
13206 case "$d_vfork" in
13207 "$define")
13208         set vfork.h i_vfork
13209         eval $inhdr
13210         ;;
13211 *)
13212         i_vfork="$undef"
13213         ;;
13214 esac
13215
13216 : see if gdbm.h is available
13217 set gdbm.h t_gdbm
13218 eval $inhdr
13219 case "$t_gdbm" in
13220 $define)
13221         : see if gdbm_open exists
13222         set gdbm_open d_gdbm_open
13223         eval $inlibc
13224         case "$d_gdbm_open" in
13225         $undef)
13226                 t_gdbm="$undef"
13227                 echo "We won't be including <gdbm.h>"
13228                 ;;
13229         esac
13230         ;;
13231 esac
13232 val="$t_gdbm"
13233 set i_gdbm
13234 eval $setvar
13235
13236 echo " "
13237 echo "Looking for extensions..." >&4
13238 : If we are using the old config.sh, known_extensions may contain
13239 : old or inaccurate or duplicate values.
13240 known_extensions=''
13241 nonxs_extensions=''
13242 : We do not use find because it might not be available.
13243 : We do not just use MANIFEST because the user may have dropped
13244 : some additional extensions into the source tree and expect them
13245 : to be built.
13246
13247 : Function to recursively find available extensions, ignoring DynaLoader
13248 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
13249 find_extensions='
13250     for xxx in *; do
13251        case "$xxx" in
13252            DynaLoader|dynaload) ;;
13253            *)
13254            if $test -f $xxx/$xxx.xs; then
13255                known_extensions="$known_extensions $1$xxx";
13256            elif $test -f $xxx/Makefile.PL; then
13257                nonxs_extensions="$nonxs_extensions $1$xxx";
13258            else
13259                if $test -d $xxx -a $# -lt 10; then
13260                    set $1$xxx/ $*;
13261                    cd $xxx;
13262                    eval $find_extensions;
13263                    cd ..;
13264                    shift;
13265                fi;
13266            fi
13267            ;;
13268        esac;
13269     done'
13270 tdir=`pwd`
13271 cd $rsrc/ext
13272 set X
13273 shift
13274 eval $find_extensions
13275 set X $nonxs_extensions
13276 shift
13277 nonxs_extensions="$*"
13278 set X $known_extensions
13279 shift
13280 known_extensions="$*"
13281 cd $tdir
13282
13283 : Now see which are supported on this system.
13284 avail_ext=''
13285 for xxx in $known_extensions ; do
13286         case "$xxx" in
13287         DB_File|db_file)
13288                 case "$i_db" in
13289                 $define) avail_ext="$avail_ext $xxx" ;;
13290                 esac
13291                 ;;
13292         GDBM_File|gdbm_fil)
13293                 case "$i_gdbm" in 
13294                 $define) avail_ext="$avail_ext $xxx" ;;
13295                 esac
13296                 ;;
13297         NDBM_File|ndbm_fil)
13298                 case "$i_ndbm" in
13299                 $define) avail_ext="$avail_ext $xxx" ;;
13300                 esac
13301                 ;;
13302         ODBM_File|odbm_fil) 
13303                 case "${i_dbm}${i_rpcsvcdbm}" in
13304                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
13305                 esac
13306                 ;;
13307         POSIX|posix)
13308                 case "$useposix" in
13309                 true|define|y) avail_ext="$avail_ext $xxx" ;;
13310                 esac
13311                 ;;
13312         Opcode|opcode)
13313                 case "$useopcode" in
13314                 true|define|y) avail_ext="$avail_ext $xxx" ;;
13315                 esac
13316                 ;;
13317         Socket|socket)
13318                 case "$d_socket" in 
13319                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
13320                 esac
13321                 ;;
13322         Thread|thread)
13323                 case "$usethreads" in 
13324                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
13325                 esac
13326                 ;;
13327         IPC/SysV|ipc/sysv)
13328                 : XXX Do we need a useipcsysv variable here
13329                 case "${d_msg}${d_sem}${d_shm}" in 
13330                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
13331                 esac
13332                 ;;
13333         *)      avail_ext="$avail_ext $xxx"
13334                 ;;
13335         esac
13336 done
13337
13338 set X $avail_ext
13339 shift
13340 avail_ext="$*"
13341
13342 : Now see which nonxs extensions are supported on this system.
13343 : For now assume all are.
13344 nonxs_ext=''
13345 for xxx in $nonxs_extensions ; do
13346         case "$xxx" in
13347         *)      nonxs_ext="$nonxs_ext $xxx"
13348                 ;;
13349         esac
13350 done
13351
13352 set X $nonxs_ext
13353 shift
13354 nonxs_ext="$*"
13355
13356 case $usedl in
13357 $define)
13358         $cat <<EOM
13359 A number of extensions are supplied with $package.  You may choose to
13360 compile these extensions for dynamic loading (the default), compile
13361 them into the $package executable (static loading), or not include
13362 them at all.  Answer "none" to include no extensions.
13363 Note that DynaLoader is always built and need not be mentioned here.
13364
13365 EOM
13366         case "$dynamic_ext" in
13367         '') dflt="$avail_ext" ;;
13368         *)      dflt="$dynamic_ext"
13369                 # Perhaps we are reusing an old out-of-date config.sh.
13370                 case "$hint" in
13371                 previous)
13372                         if test X"$dynamic_ext" != X"$avail_ext"; then
13373                                 $cat <<EOM
13374 NOTICE:  Your previous config.sh list may be incorrect. 
13375 The extensions now available to you are 
13376         ${avail_ext}
13377 but the default list from your previous config.sh is
13378         ${dynamic_ext} 
13379
13380 EOM
13381                         fi
13382                         ;;
13383                 esac
13384                 ;;
13385         esac
13386         case "$dflt" in
13387         '')     dflt=none;;
13388         esac
13389         rp="What extensions do you wish to load dynamically?"
13390         . ./myread
13391         case "$ans" in
13392         none) dynamic_ext=' ' ;;
13393         *) dynamic_ext="$ans" ;;
13394         esac
13395
13396         case "$static_ext" in
13397         '')
13398                 : Exclude those already listed in dynamic linking
13399                 dflt=''
13400                 for xxx in $avail_ext; do
13401                         case " $dynamic_ext " in
13402                         *" $xxx "*) ;;
13403                         *) dflt="$dflt $xxx" ;;
13404                         esac
13405                 done
13406                 set X $dflt
13407                 shift
13408                 dflt="$*"
13409                 ;;
13410         *)  dflt="$static_ext" 
13411                 ;;
13412         esac
13413
13414         case "$dflt" in
13415         '')     dflt=none;;
13416         esac
13417         rp="What extensions do you wish to load statically?"
13418         . ./myread
13419         case "$ans" in
13420         none) static_ext=' ' ;;
13421         *) static_ext="$ans" ;;
13422         esac
13423         ;;
13424 *)
13425         $cat <<EOM
13426 A number of extensions are supplied with $package.  Answer "none" 
13427 to include no extensions. 
13428 Note that DynaLoader is always built and need not be mentioned here.
13429
13430 EOM
13431         case "$static_ext" in
13432         '') dflt="$avail_ext" ;;
13433         *)      dflt="$static_ext"
13434                 # Perhaps we are reusing an old out-of-date config.sh.
13435                 case "$hint" in
13436                 previous)
13437                         if test X"$static_ext" != X"$avail_ext"; then
13438                                 $cat <<EOM
13439 NOTICE:  Your previous config.sh list may be incorrect. 
13440 The extensions now available to you are 
13441         ${avail_ext}
13442 but the default list from your previous config.sh is
13443         ${static_ext} 
13444
13445 EOM
13446                         fi
13447                         ;;
13448                 esac
13449                 ;;
13450         esac
13451         : Exclude those that are not xs extensions
13452         case "$dflt" in
13453         '')     dflt=none;;
13454         esac
13455         rp="What extensions do you wish to include?"
13456         . ./myread
13457         case "$ans" in
13458         none) static_ext=' ' ;;
13459         *) static_ext="$ans" ;;
13460         esac
13461         ;;
13462 esac
13463
13464 set X $dynamic_ext $static_ext $nonxs_ext
13465 shift
13466 extensions="$*"
13467
13468 : Remove build directory name from cppstdin so it can be used from
13469 : either the present location or the final installed location.
13470 echo " "
13471 : Get out of the UU directory to get correct path name.
13472 cd ..
13473 case "$cppstdin" in
13474 `pwd`/cppstdin)
13475         echo "Stripping down cppstdin path name"
13476         cppstdin=cppstdin
13477         ;;
13478 esac
13479 cd UU
13480
13481 : end of configuration questions
13482 echo " "
13483 echo "End of configuration questions."
13484 echo " "
13485
13486 : back to where it started
13487 if test -d ../UU; then
13488         cd ..
13489 fi
13490
13491 : configuration may be patched via a 'config.over' file
13492 if $test -f config.over; then
13493         echo " "
13494         dflt=y
13495         rp='I see a config.over file.  Do you wish to load it?'
13496         . UU/myread
13497         case "$ans" in
13498         n*) echo "OK, I'll ignore it.";;
13499         *)      . ./config.over
13500                 echo "Configuration override changes have been loaded."
13501                 ;;
13502         esac
13503 fi
13504
13505 : in case they want portability, strip down executable paths
13506 case "$d_portable" in
13507 "$define")
13508         echo " "
13509         echo "Stripping down executable paths..." >&4
13510         for file in $loclist $trylist; do
13511                 eval temp=\$$file
13512                 eval $file=`basename $temp`
13513         done
13514         ;;
13515 esac
13516
13517 : create config.sh file
13518 echo " "
13519 echo "Creating config.sh..." >&4
13520 $spitshell <<EOT >config.sh
13521 $startsh
13522 #
13523 # This file was produced by running the Configure script. It holds all the
13524 # definitions figured out by Configure. Should you modify one of these values,
13525 # do not forget to propagate your changes by running "Configure -der". You may
13526 # instead choose to run each of the .SH files by yourself, or "Configure -S".
13527 #
13528
13529 # Package name      : $package
13530 # Source directory  : $src
13531 # Configuration time: $cf_time
13532 # Configured by     : $cf_by
13533 # Target system     : $myuname
13534
13535 Author='$Author'
13536 Date='$Date'
13537 Header='$Header'
13538 Id='$Id'
13539 Locker='$Locker'
13540 Log='$Log'
13541 Mcc='$Mcc'
13542 RCSfile='$RCSfile'
13543 Revision='$Revision'
13544 Source='$Source'
13545 State='$State'
13546 _a='$_a'
13547 _exe='$_exe'
13548 _o='$_o'
13549 afs='$afs'
13550 alignbytes='$alignbytes'
13551 ansi2knr='$ansi2knr'
13552 aphostname='$aphostname'
13553 apiversion='$apiversion'
13554 ar='$ar'
13555 archlib='$archlib'
13556 archlibexp='$archlibexp'
13557 archname64='$archname64'
13558 archname='$archname'
13559 archobjs='$archobjs'
13560 awk='$awk'
13561 baserev='$baserev'
13562 bash='$bash'
13563 bin='$bin'
13564 bincompat5005='$bincompat5005'
13565 binexp='$binexp'
13566 bison='$bison'
13567 byacc='$byacc'
13568 byteorder='$byteorder'
13569 c='$c'
13570 castflags='$castflags'
13571 cat='$cat'
13572 cc='$cc'
13573 cccdlflags='$cccdlflags'
13574 ccdlflags='$ccdlflags'
13575 ccflags='$ccflags'
13576 ccsymbols='$ccsymbols'
13577 cf_by='$cf_by'
13578 cf_email='$cf_email'
13579 cf_time='$cf_time'
13580 chgrp='$chgrp'
13581 chmod='$chmod'
13582 chown='$chown'
13583 clocktype='$clocktype'
13584 comm='$comm'
13585 compress='$compress'
13586 contains='$contains'
13587 cp='$cp'
13588 cpio='$cpio'
13589 cpp='$cpp'
13590 cpp_stuff='$cpp_stuff'
13591 cppccsymbols='$cppccsymbols'
13592 cppflags='$cppflags'
13593 cpplast='$cpplast'
13594 cppminus='$cppminus'
13595 cpprun='$cpprun'
13596 cppstdin='$cppstdin'
13597 cppsymbols='$cppsymbols'
13598 crosscompile='$crosscompile'
13599 cryptlib='$cryptlib'
13600 csh='$csh'
13601 d_Gconvert='$d_Gconvert'
13602 d_PRIEldbl='$d_PRIEldbl'
13603 d_PRIFldbl='$d_PRIFldbl'
13604 d_PRIGldbl='$d_PRIGldbl'
13605 d_PRIX64='$d_PRIX64'
13606 d_PRId64='$d_PRId64'
13607 d_PRIeldbl='$d_PRIeldbl'
13608 d_PRIfldbl='$d_PRIfldbl'
13609 d_PRIgldbl='$d_PRIgldbl'
13610 d_PRIi64='$d_PRIi64'
13611 d_PRIo64='$d_PRIo64'
13612 d_PRIu64='$d_PRIu64'
13613 d_PRIx64='$d_PRIx64'
13614 d_access='$d_access'
13615 d_accessx='$d_accessx'
13616 d_alarm='$d_alarm'
13617 d_archlib='$d_archlib'
13618 d_atolf='$d_atolf'
13619 d_atoll='$d_atoll'
13620 d_attribut='$d_attribut'
13621 d_bcmp='$d_bcmp'
13622 d_bcopy='$d_bcopy'
13623 d_bincompat5005='$d_bincompat5005'
13624 d_bsd='$d_bsd'
13625 d_bsdgetpgrp='$d_bsdgetpgrp'
13626 d_bsdsetpgrp='$d_bsdsetpgrp'
13627 d_bzero='$d_bzero'
13628 d_casti32='$d_casti32'
13629 d_castneg='$d_castneg'
13630 d_charvspr='$d_charvspr'
13631 d_chown='$d_chown'
13632 d_chroot='$d_chroot'
13633 d_chsize='$d_chsize'
13634 d_closedir='$d_closedir'
13635 d_const='$d_const'
13636 d_crypt='$d_crypt'
13637 d_csh='$d_csh'
13638 d_cuserid='$d_cuserid'
13639 d_dbl_dig='$d_dbl_dig'
13640 d_difftime='$d_difftime'
13641 d_dirnamlen='$d_dirnamlen'
13642 d_dlerror='$d_dlerror'
13643 d_dlopen='$d_dlopen'
13644 d_dlsymun='$d_dlsymun'
13645 d_dosuid='$d_dosuid'
13646 d_drand48proto='$d_drand48proto'
13647 d_dup2='$d_dup2'
13648 d_eaccess='$d_eaccess'
13649 d_endgrent='$d_endgrent'
13650 d_endhent='$d_endhent'
13651 d_endnent='$d_endnent'
13652 d_endpent='$d_endpent'
13653 d_endpwent='$d_endpwent'
13654 d_endsent='$d_endsent'
13655 d_endspent='$d_endspent'
13656 d_eofnblk='$d_eofnblk'
13657 d_eunice='$d_eunice'
13658 d_fchmod='$d_fchmod'
13659 d_fchown='$d_fchown'
13660 d_fcntl='$d_fcntl'
13661 d_fd_macros='$d_fd_macros'
13662 d_fd_set='$d_fd_set'
13663 d_fds_bits='$d_fds_bits'
13664 d_fgetpos='$d_fgetpos'
13665 d_flexfnam='$d_flexfnam'
13666 d_flock='$d_flock'
13667 d_fork='$d_fork'
13668 d_fpathconf='$d_fpathconf'
13669 d_fpos64_t='$d_fpos64_t'
13670 d_fs_data_s='$d_fs_data_s'
13671 d_fseeko='$d_fseeko'
13672 d_fsetpos='$d_fsetpos'
13673 d_fstatfs='$d_fstatfs'
13674 d_fstatvfs='$d_fstatvfs'
13675 d_ftello='$d_ftello'
13676 d_ftime='$d_ftime'
13677 d_getgrent='$d_getgrent'
13678 d_getgrps='$d_getgrps'
13679 d_gethbyaddr='$d_gethbyaddr'
13680 d_gethbyname='$d_gethbyname'
13681 d_gethent='$d_gethent'
13682 d_gethname='$d_gethname'
13683 d_gethostprotos='$d_gethostprotos'
13684 d_getlogin='$d_getlogin'
13685 d_getmnt='$d_getmnt'
13686 d_getmntent='$d_getmntent'
13687 d_getnbyaddr='$d_getnbyaddr'
13688 d_getnbyname='$d_getnbyname'
13689 d_getnent='$d_getnent'
13690 d_getnetprotos='$d_getnetprotos'
13691 d_getpbyname='$d_getpbyname'
13692 d_getpbynumber='$d_getpbynumber'
13693 d_getpent='$d_getpent'
13694 d_getpgid='$d_getpgid'
13695 d_getpgrp2='$d_getpgrp2'
13696 d_getpgrp='$d_getpgrp'
13697 d_getppid='$d_getppid'
13698 d_getprior='$d_getprior'
13699 d_getprotoprotos='$d_getprotoprotos'
13700 d_getpwent='$d_getpwent'
13701 d_getsbyname='$d_getsbyname'
13702 d_getsbyport='$d_getsbyport'
13703 d_getsent='$d_getsent'
13704 d_getservprotos='$d_getservprotos'
13705 d_getspent='$d_getspent'
13706 d_getspnam='$d_getspnam'
13707 d_gettimeod='$d_gettimeod'
13708 d_gnulibc='$d_gnulibc'
13709 d_grpasswd='$d_grpasswd'
13710 d_hasmntopt='$d_hasmntopt'
13711 d_htonl='$d_htonl'
13712 d_index='$d_index'
13713 d_inetaton='$d_inetaton'
13714 d_int64t='$d_int64t'
13715 d_iovec_s='$d_iovec_s'
13716 d_isascii='$d_isascii'
13717 d_killpg='$d_killpg'
13718 d_lchown='$d_lchown'
13719 d_ldbl_dig='$d_ldbl_dig'
13720 d_link='$d_link'
13721 d_llseek='$d_llseek'
13722 d_locconv='$d_locconv'
13723 d_lockf='$d_lockf'
13724 d_longdbl='$d_longdbl'
13725 d_longlong='$d_longlong'
13726 d_lstat='$d_lstat'
13727 d_mblen='$d_mblen'
13728 d_mbstowcs='$d_mbstowcs'
13729 d_mbtowc='$d_mbtowc'
13730 d_memchr='$d_memchr'
13731 d_memcmp='$d_memcmp'
13732 d_memcpy='$d_memcpy'
13733 d_memmove='$d_memmove'
13734 d_memset='$d_memset'
13735 d_mkdir='$d_mkdir'
13736 d_mkfifo='$d_mkfifo'
13737 d_mktime='$d_mktime'
13738 d_msg='$d_msg'
13739 d_msg_ctrunc='$d_msg_ctrunc'
13740 d_msg_dontroute='$d_msg_dontroute'
13741 d_msg_oob='$d_msg_oob'
13742 d_msg_peek='$d_msg_peek'
13743 d_msg_proxy='$d_msg_proxy'
13744 d_msgctl='$d_msgctl'
13745 d_msgget='$d_msgget'
13746 d_msgrcv='$d_msgrcv'
13747 d_msgsnd='$d_msgsnd'
13748 d_mymalloc='$d_mymalloc'
13749 d_nice='$d_nice'
13750 d_off64_t='$d_off64_t'
13751 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
13752 d_oldpthreads='$d_oldpthreads'
13753 d_oldsock='$d_oldsock'
13754 d_open3='$d_open3'
13755 d_pathconf='$d_pathconf'
13756 d_pause='$d_pause'
13757 d_phostname='$d_phostname'
13758 d_pipe='$d_pipe'
13759 d_poll='$d_poll'
13760 d_portable='$d_portable'
13761 d_pthread_yield='$d_pthread_yield'
13762 d_pwage='$d_pwage'
13763 d_pwchange='$d_pwchange'
13764 d_pwclass='$d_pwclass'
13765 d_pwcomment='$d_pwcomment'
13766 d_pwexpire='$d_pwexpire'
13767 d_pwgecos='$d_pwgecos'
13768 d_pwpasswd='$d_pwpasswd'
13769 d_pwquota='$d_pwquota'
13770 d_readdir='$d_readdir'
13771 d_readlink='$d_readlink'
13772 d_rename='$d_rename'
13773 d_rewinddir='$d_rewinddir'
13774 d_rmdir='$d_rmdir'
13775 d_safebcpy='$d_safebcpy'
13776 d_safemcpy='$d_safemcpy'
13777 d_sanemcmp='$d_sanemcmp'
13778 d_sched_yield='$d_sched_yield'
13779 d_scm_rights='$d_scm_rights'
13780 d_seekdir='$d_seekdir'
13781 d_select='$d_select'
13782 d_sem='$d_sem'
13783 d_semctl='$d_semctl'
13784 d_semctl_semid_ds='$d_semctl_semid_ds'
13785 d_semctl_semun='$d_semctl_semun'
13786 d_semget='$d_semget'
13787 d_semop='$d_semop'
13788 d_setegid='$d_setegid'
13789 d_seteuid='$d_seteuid'
13790 d_setgrent='$d_setgrent'
13791 d_setgrps='$d_setgrps'
13792 d_sethent='$d_sethent'
13793 d_setlinebuf='$d_setlinebuf'
13794 d_setlocale='$d_setlocale'
13795 d_setnent='$d_setnent'
13796 d_setpent='$d_setpent'
13797 d_setpgid='$d_setpgid'
13798 d_setpgrp2='$d_setpgrp2'
13799 d_setpgrp='$d_setpgrp'
13800 d_setprior='$d_setprior'
13801 d_setpwent='$d_setpwent'
13802 d_setregid='$d_setregid'
13803 d_setresgid='$d_setresgid'
13804 d_setresuid='$d_setresuid'
13805 d_setreuid='$d_setreuid'
13806 d_setrgid='$d_setrgid'
13807 d_setruid='$d_setruid'
13808 d_setsent='$d_setsent'
13809 d_setsid='$d_setsid'
13810 d_setspent='$d_setspent'
13811 d_setvbuf='$d_setvbuf'
13812 d_sfio='$d_sfio'
13813 d_shm='$d_shm'
13814 d_shmat='$d_shmat'
13815 d_shmatprototype='$d_shmatprototype'
13816 d_shmctl='$d_shmctl'
13817 d_shmdt='$d_shmdt'
13818 d_shmget='$d_shmget'
13819 d_sigaction='$d_sigaction'
13820 d_sigsetjmp='$d_sigsetjmp'
13821 d_socket='$d_socket'
13822 d_sockpair='$d_sockpair'
13823 d_sqrtl='$d_sqrtl'
13824 d_statblks='$d_statblks'
13825 d_statfs_f_flags='$d_statfs_f_flags'
13826 d_statfs_s='$d_statfs_s'
13827 d_statvfs='$d_statvfs'
13828 d_stdio_cnt_lval='$d_stdio_cnt_lval'
13829 d_stdio_ptr_lval='$d_stdio_ptr_lval'
13830 d_stdio_stream_array='$d_stdio_stream_array'
13831 d_stdiobase='$d_stdiobase'
13832 d_stdstdio='$d_stdstdio'
13833 d_strchr='$d_strchr'
13834 d_strcoll='$d_strcoll'
13835 d_strctcpy='$d_strctcpy'
13836 d_strerrm='$d_strerrm'
13837 d_strerror='$d_strerror'
13838 d_strtod='$d_strtod'
13839 d_strtol='$d_strtol'
13840 d_strtoul='$d_strtoul'
13841 d_strtoull='$d_strtoull'
13842 d_strxfrm='$d_strxfrm'
13843 d_suidsafe='$d_suidsafe'
13844 d_symlink='$d_symlink'
13845 d_syscall='$d_syscall'
13846 d_sysconf='$d_sysconf'
13847 d_sysernlst='$d_sysernlst'
13848 d_syserrlst='$d_syserrlst'
13849 d_system='$d_system'
13850 d_tcgetpgrp='$d_tcgetpgrp'
13851 d_tcsetpgrp='$d_tcsetpgrp'
13852 d_telldir='$d_telldir'
13853 d_telldirproto='$d_telldirproto'
13854 d_time='$d_time'
13855 d_times='$d_times'
13856 d_truncate='$d_truncate'
13857 d_tzname='$d_tzname'
13858 d_umask='$d_umask'
13859 d_uname='$d_uname'
13860 d_union_semun='$d_union_semun'
13861 d_ustat='$d_ustat'
13862 d_vendorbin='$d_vendorbin'
13863 d_vendorlib='$d_vendorlib'
13864 d_vfork='$d_vfork'
13865 d_void_closedir='$d_void_closedir'
13866 d_voidsig='$d_voidsig'
13867 d_voidtty='$d_voidtty'
13868 d_volatile='$d_volatile'
13869 d_vprintf='$d_vprintf'
13870 d_wait4='$d_wait4'
13871 d_waitpid='$d_waitpid'
13872 d_wcstombs='$d_wcstombs'
13873 d_wctomb='$d_wctomb'
13874 d_xenix='$d_xenix'
13875 date='$date'
13876 db_hashtype='$db_hashtype'
13877 db_prefixtype='$db_prefixtype'
13878 defvoidused='$defvoidused'
13879 direntrytype='$direntrytype'
13880 dlext='$dlext'
13881 dlsrc='$dlsrc'
13882 doublesize='$doublesize'
13883 drand01='$drand01'
13884 dynamic_ext='$dynamic_ext'
13885 eagain='$eagain'
13886 ebcdic='$ebcdic'
13887 echo='$echo'
13888 egrep='$egrep'
13889 emacs='$emacs'
13890 eunicefix='$eunicefix'
13891 exe_ext='$exe_ext'
13892 expr='$expr'
13893 extensions='$extensions'
13894 fflushNULL='$fflushNULL'
13895 fflushall='$fflushall'
13896 find='$find'
13897 firstmakefile='$firstmakefile'
13898 flex='$flex'
13899 fpostype='$fpostype'
13900 freetype='$freetype'
13901 full_ar='$full_ar'
13902 full_csh='$full_csh'
13903 full_sed='$full_sed'
13904 gccversion='$gccversion'
13905 gidsign='$gidsign'
13906 gidsize='$gidsize'
13907 gidtype='$gidtype'
13908 glibpth='$glibpth'
13909 grep='$grep'
13910 groupcat='$groupcat'
13911 groupstype='$groupstype'
13912 gzip='$gzip'
13913 h_fcntl='$h_fcntl'
13914 h_sysfile='$h_sysfile'
13915 hint='$hint'
13916 hostcat='$hostcat'
13917 huge='$huge'
13918 i_arpainet='$i_arpainet'
13919 i_bsdioctl='$i_bsdioctl'
13920 i_db='$i_db'
13921 i_dbm='$i_dbm'
13922 i_dirent='$i_dirent'
13923 i_dld='$i_dld'
13924 i_dlfcn='$i_dlfcn'
13925 i_fcntl='$i_fcntl'
13926 i_float='$i_float'
13927 i_gdbm='$i_gdbm'
13928 i_grp='$i_grp'
13929 i_inttypes='$i_inttypes'
13930 i_limits='$i_limits'
13931 i_locale='$i_locale'
13932 i_machcthr='$i_machcthr'
13933 i_malloc='$i_malloc'
13934 i_math='$i_math'
13935 i_memory='$i_memory'
13936 i_mntent='$i_mntent'
13937 i_ndbm='$i_ndbm'
13938 i_netdb='$i_netdb'
13939 i_neterrno='$i_neterrno'
13940 i_netinettcp='$i_netinettcp'
13941 i_niin='$i_niin'
13942 i_poll='$i_poll'
13943 i_pthread='$i_pthread'
13944 i_pwd='$i_pwd'
13945 i_rpcsvcdbm='$i_rpcsvcdbm'
13946 i_sfio='$i_sfio'
13947 i_sgtty='$i_sgtty'
13948 i_shadow='$i_shadow'
13949 i_socks='$i_socks'
13950 i_stdarg='$i_stdarg'
13951 i_stddef='$i_stddef'
13952 i_stdlib='$i_stdlib'
13953 i_string='$i_string'
13954 i_sysaccess='$i_sysaccess'
13955 i_sysdir='$i_sysdir'
13956 i_sysfile='$i_sysfile'
13957 i_sysfilio='$i_sysfilio'
13958 i_sysin='$i_sysin'
13959 i_sysioctl='$i_sysioctl'
13960 i_sysmount='$i_sysmount'
13961 i_sysndir='$i_sysndir'
13962 i_sysparam='$i_sysparam'
13963 i_sysresrc='$i_sysresrc'
13964 i_syssecrt='$i_syssecrt'
13965 i_sysselct='$i_sysselct'
13966 i_syssockio='$i_syssockio'
13967 i_sysstat='$i_sysstat'
13968 i_sysstatfs='$i_sysstatfs'
13969 i_sysstatvfs='$i_sysstatvfs'
13970 i_systime='$i_systime'
13971 i_systimek='$i_systimek'
13972 i_systimes='$i_systimes'
13973 i_systypes='$i_systypes'
13974 i_sysuio='$i_sysuio'
13975 i_sysun='$i_sysun'
13976 i_sysvfs='$i_sysvfs'
13977 i_syswait='$i_syswait'
13978 i_termio='$i_termio'
13979 i_termios='$i_termios'
13980 i_time='$i_time'
13981 i_unistd='$i_unistd'
13982 i_ustat='$i_ustat'
13983 i_utime='$i_utime'
13984 i_values='$i_values'
13985 i_varargs='$i_varargs'
13986 i_varhdr='$i_varhdr'
13987 i_vfork='$i_vfork'
13988 ignore_versioned_solibs='$ignore_versioned_solibs'
13989 incpath='$incpath'
13990 inews='$inews'
13991 installarchlib='$installarchlib'
13992 installbin='$installbin'
13993 installman1dir='$installman1dir'
13994 installman3dir='$installman3dir'
13995 installprefix='$installprefix'
13996 installprefixexp='$installprefixexp'
13997 installprivlib='$installprivlib'
13998 installscript='$installscript'
13999 installsitearch='$installsitearch'
14000 installsitebin='$installsitebin'
14001 installsitelib='$installsitelib'
14002 installstyle='$installstyle'
14003 installusrbinperl='$installusrbinperl'
14004 installvendorbin='$installvendorbin'
14005 installvendorlib='$installvendorlib'
14006 intsize='$intsize'
14007 known_extensions='$known_extensions'
14008 ksh='$ksh'
14009 large='$large'
14010 ld='$ld'
14011 lddlflags='$lddlflags'
14012 ldflags='$ldflags'
14013 ldlibpthname='$ldlibpthname'
14014 less='$less'
14015 lib_ext='$lib_ext'
14016 libc='$libc'
14017 libperl='$libperl'
14018 libpth='$libpth'
14019 libs='$libs'
14020 libswanted='$libswanted'
14021 line='$line'
14022 lint='$lint'
14023 lkflags='$lkflags'
14024 ln='$ln'
14025 lns='$lns'
14026 locincpth='$locincpth'
14027 loclibpth='$loclibpth'
14028 longdblsize='$longdblsize'
14029 longlongsize='$longlongsize'
14030 longsize='$longsize'
14031 lp='$lp'
14032 lpr='$lpr'
14033 ls='$ls'
14034 lseeksize='$lseeksize'
14035 lseektype='$lseektype'
14036 mail='$mail'
14037 mailx='$mailx'
14038 make='$make'
14039 make_set_make='$make_set_make'
14040 mallocobj='$mallocobj'
14041 mallocsrc='$mallocsrc'
14042 malloctype='$malloctype'
14043 man1dir='$man1dir'
14044 man1direxp='$man1direxp'
14045 man1ext='$man1ext'
14046 man3dir='$man3dir'
14047 man3direxp='$man3direxp'
14048 man3ext='$man3ext'
14049 medium='$medium'
14050 mips_type='$mips_type'
14051 mkdir='$mkdir'
14052 models='$models'
14053 modetype='$modetype'
14054 more='$more'
14055 multiarch='$multiarch'
14056 mv='$mv'
14057 myarchname='$myarchname'
14058 mydomain='$mydomain'
14059 myhostname='$myhostname'
14060 myuname='$myuname'
14061 n='$n'
14062 netdb_hlen_type='$netdb_hlen_type'
14063 netdb_host_type='$netdb_host_type'
14064 netdb_name_type='$netdb_name_type'
14065 netdb_net_type='$netdb_net_type'
14066 nm='$nm'
14067 nm_opt='$nm_opt'
14068 nm_so_opt='$nm_so_opt'
14069 nonxs_ext='$nonxs_ext'
14070 nroff='$nroff'
14071 o_nonblock='$o_nonblock'
14072 obj_ext='$obj_ext'
14073 old_pthread_create_joinable='$old_pthread_create_joinable'
14074 optimize='$optimize'
14075 orderlib='$orderlib'
14076 osname='$osname'
14077 osvers='$osvers'
14078 package='$package'
14079 pager='$pager'
14080 passcat='$passcat'
14081 patchlevel='$patchlevel'
14082 path_sep='$path_sep'
14083 perl='$perl'
14084 perladmin='$perladmin'
14085 perlpath='$perlpath'
14086 pg='$pg'
14087 phostname='$phostname'
14088 pidtype='$pidtype'
14089 plibpth='$plibpth'
14090 pm_apiversion='$pm_apiversion'
14091 pmake='$pmake'
14092 pr='$pr'
14093 prefix='$prefix'
14094 prefixexp='$prefixexp'
14095 privlib='$privlib'
14096 privlibexp='$privlibexp'
14097 prototype='$prototype'
14098 ptrsize='$ptrsize'
14099 randbits='$randbits'
14100 randfunc='$randfunc'
14101 randseedtype='$randseedtype'
14102 ranlib='$ranlib'
14103 rd_nodata='$rd_nodata'
14104 rm='$rm'
14105 rmail='$rmail'
14106 runnm='$runnm'
14107 sPRIEldbl='$sPRIEldbl'
14108 sPRIFldbl='$sPRIFldbl'
14109 sPRIGldbl='$sPRIGldbl'
14110 sPRIX64='$sPRIX64'
14111 sPRId64='$sPRId64'
14112 sPRIeldbl='$sPRIeldbl'
14113 sPRIfldbl='$sPRIfldbl'
14114 sPRIgldbl='$sPRIgldbl'
14115 sPRIi64='$sPRIi64'
14116 sPRIo64='$sPRIo64'
14117 sPRIu64='$sPRIu64'
14118 sPRIx64='$sPRIx64'
14119 sched_yield='$sched_yield'
14120 scriptdir='$scriptdir'
14121 scriptdirexp='$scriptdirexp'
14122 sed='$sed'
14123 seedfunc='$seedfunc'
14124 selectminbits='$selectminbits'
14125 selecttype='$selecttype'
14126 sendmail='$sendmail'
14127 sh='$sh'
14128 shar='$shar'
14129 sharpbang='$sharpbang'
14130 shmattype='$shmattype'
14131 shortsize='$shortsize'
14132 shrpenv='$shrpenv'
14133 shsharp='$shsharp'
14134 sig_count='$sig_count'
14135 sig_name='$sig_name'
14136 sig_name_init='$sig_name_init'
14137 sig_num='$sig_num'
14138 sig_num_init='$sig_num_init'
14139 signal_t='$signal_t'
14140 sitearch='$sitearch'
14141 sitearchexp='$sitearchexp'
14142 sitebin='$sitebin'
14143 sitebinexp='$sitebinexp'
14144 sitelib='$sitelib'
14145 sitelibexp='$sitelibexp'
14146 siteprefix='$siteprefix'
14147 siteprefixexp='$siteprefixexp'
14148 sizetype='$sizetype'
14149 sleep='$sleep'
14150 smail='$smail'
14151 small='$small'
14152 so='$so'
14153 sockethdr='$sockethdr'
14154 socketlib='$socketlib'
14155 sort='$sort'
14156 spackage='$spackage'
14157 spitshell='$spitshell'
14158 split='$split'
14159 src='$src'
14160 ssizetype='$ssizetype'
14161 startperl='$startperl'
14162 startsh='$startsh'
14163 static_ext='$static_ext'
14164 stdchar='$stdchar'
14165 stdio_base='$stdio_base'
14166 stdio_bufsiz='$stdio_bufsiz'
14167 stdio_cnt='$stdio_cnt'
14168 stdio_filbuf='$stdio_filbuf'
14169 stdio_ptr='$stdio_ptr'
14170 stdio_stream_array='$stdio_stream_array'
14171 strings='$strings'
14172 submit='$submit'
14173 subversion='$subversion'
14174 sysman='$sysman'
14175 tail='$tail'
14176 tar='$tar'
14177 tbl='$tbl'
14178 tee='$tee'
14179 test='$test'
14180 timeincl='$timeincl'
14181 timetype='$timetype'
14182 touch='$touch'
14183 tr='$tr'
14184 trnl='$trnl'
14185 troff='$troff'
14186 uidsign='$uidsign'
14187 uidsize='$uidsize'
14188 uidtype='$uidtype'
14189 uname='$uname'
14190 uniq='$uniq'
14191 use64bits='$use64bits'
14192 usedl='$usedl'
14193 uselargefiles='$uselargefiles'
14194 uselongdouble='$uselongdouble'
14195 usemorebits='$usemorebits'
14196 usemultiplicity='$usemultiplicity'
14197 usemymalloc='$usemymalloc'
14198 usenm='$usenm'
14199 useopcode='$useopcode'
14200 useperlio='$useperlio'
14201 useposix='$useposix'
14202 usesfio='$usesfio'
14203 useshrplib='$useshrplib'
14204 usesocks='$usesocks'
14205 usethreads='$usethreads'
14206 usevendorprefix='$usevendorprefix'
14207 usevfork='$usevfork'
14208 usrinc='$usrinc'
14209 uuname='$uuname'
14210 vendorbin='$vendorbin'
14211 vendorbinexp='$vendorbinexp'
14212 vendorlib='$vendorlib'
14213 vendorlibexp='$vendorlibexp'
14214 vendorprefix='$vendorprefix'
14215 vendorprefixexp='$vendorprefixexp'
14216 version='$version'
14217 vi='$vi'
14218 voidflags='$voidflags'
14219 xlibpth='$xlibpth'
14220 xs_apiversion='$xs_apiversion'
14221 zcat='$zcat'
14222 zip='$zip'
14223 EOT
14224
14225 : Add in command line options if available
14226 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
14227
14228 : add special variables
14229 $test -f $src/patchlevel.h && \
14230 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
14231 echo "CONFIGDOTSH=true" >>config.sh
14232
14233 : propagate old symbols
14234 if $test -f UU/config.sh; then
14235         <UU/config.sh sort | uniq >UU/oldconfig.sh
14236         sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
14237         sort | uniq -u >UU/oldsyms
14238         set X `cat UU/oldsyms`
14239         shift
14240         case $# in
14241         0) ;;
14242         *)
14243                 cat <<EOM
14244 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
14245 EOM
14246                 echo "# Variables propagated from previous config.sh file." >>config.sh
14247                 for sym in `cat UU/oldsyms`; do
14248                         echo "    Propagating $hint variable "'$'"$sym..."
14249                         eval 'tmp="$'"${sym}"'"'
14250                         echo "$tmp" | \
14251                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
14252                 done
14253                 ;;
14254         esac
14255 fi
14256
14257 : Finish up by extracting the .SH files
14258 case "$alldone" in
14259 exit)
14260         $rm -rf UU
14261         echo "Done."
14262         exit 0
14263         ;;
14264 cont)
14265         ;;
14266 '')
14267         dflt=''
14268         nostick=true
14269         $cat <<EOM
14270
14271 If you'd like to make any changes to the config.sh file before I begin
14272 to configure things, do it as a shell escape now (e.g. !vi config.sh).
14273
14274 EOM
14275         rp="Press return or use a shell escape to edit config.sh:"
14276         . UU/myread
14277         nostick=''
14278         case "$ans" in
14279         '') ;;
14280         *) : in case they cannot read
14281                 sh 1>&4 -c "$ans";;
14282         esac
14283         ;;
14284 esac
14285
14286 : if this fails, just run all the .SH files by hand
14287 . ./config.sh
14288
14289 echo " "
14290 exec 1>&4
14291 . ./UU/extract
14292
14293 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
14294         dflt=y
14295         case "$silent" in
14296         true) ;;
14297         *)
14298                 $cat <<EOM
14299
14300 Now you need to generate make dependencies by running "$make depend".
14301 You might prefer to run it in background: "$make depend > makedepend.out &"
14302 It can take a while, so you might not want to run it right now.
14303
14304 EOM
14305                 ;;
14306         esac
14307         rp="Run $make depend now?"
14308         . UU/myread
14309         case "$ans" in
14310         y*)
14311                 $make depend && echo "Now you must run a $make."
14312                 ;;
14313         *)
14314                 echo "You must run '$make depend' then '$make'."
14315                 ;;
14316         esac
14317 elif test -f [Mm]akefile; then
14318         echo " "
14319         echo "Now you must run a $make."
14320 else
14321         echo "Done."
14322 fi
14323
14324 if $test -f Policy.sh; then
14325     $cat <<EOM
14326
14327 If you compile $package on a different machine or from a different object
14328 directory, copy the Policy.sh file from this object directory to the
14329 new one before you run Configure -- this will help you with most of
14330 the policy defaults.
14331
14332 EOM
14333 fi
14334 if $test -f config.msg; then
14335     echo "Hmm.  I also noted the following information while running:"
14336     echo " "
14337     $cat config.msg >&4
14338     $rm -f config.msg
14339 fi
14340 $rm -f kit*isdone ark*isdone
14341 $rm -rf UU
14342
14343 : End of Configure
14344