Scan always for <pthread.h>.
[p5sagit/p5-mst-13.2.git] / Configure
1 #! /bin/sh
2 #
3 # If these # comments don't work, trim them. Don't worry about any other
4 # shell scripts, Configure will trim # comments from them for you.
5 #
6 # (If you are trying to port this package to a machine without sh,
7 # I would suggest you have a look at the prototypical config_h.SH file
8 # and edit it to reflect your system. Some packages may include samples
9 # of config.h for certain machines, so you might look for one of those.)
10 #
11 # Yes, you may rip this off to use in other distribution packages. This
12 # script belongs to the public domain and cannot be copyrighted.
13 #
14 # (Note: this Configure script was generated automatically. Rather than
15 # working with this copy of Configure, you may wish to get metaconfig.
16 # The dist-3.0 package (which contains metaconfig) was posted in
17 # comp.sources.misc and is available on CPAN under authors/id/RAM so
18 # you may fetch it yourself from your nearest archive site.)
19 #
20
21 # $Id: Head.U,v 3.0.1.9 1997/02/28 15:02:09 ram Exp $
22 #
23 # Generated on Mon Sep 13 19:24:34 EET DST 1999 [metaconfig 3.0 PL70]
24 # (with additional metaconfig patches by perlbug@perl.com)
25
26 cat >/tmp/c1$$ <<EOF
27 ARGGGHHHH!!!!!
28
29 SCO csh still thinks true is false.  Write to SCO today and tell them that next
30 year Configure ought to "rm /bin/csh" unless they fix their blasted shell. :-)
31
32 (Actually, Configure ought to just patch csh in place.  Hmm.  Hmmmmm.  All
33 we'd have to do is go in and swap the && and || tokens, wherever they are.)
34
35 [End of diatribe. We now return you to your regularly scheduled programming...]
36 EOF
37 cat >/tmp/c2$$ <<EOF
38
39 OOPS!  You naughty creature!  You didn't run Configure with sh!
40 I will attempt to remedy the situation by running sh for you...
41 EOF
42
43 true || cat /tmp/c1$$ /tmp/c2$$
44 true || exec sh $0 $argv:q
45
46 (exit $?0) || cat /tmp/c2$$
47 (exit $?0) || exec sh $0 $argv:q
48 rm -f /tmp/c1$$ /tmp/c2$$
49
50 : compute my invocation name
51 me=$0
52 case "$0" in
53 */*)
54         me=`echo $0 | sed -e 's!.*/\(.*\)!\1!' 2>/dev/null`
55         test "$me" || me=$0
56         ;;
57 esac
58
59 : Proper separator for the PATH environment variable
60 p_=:
61 : On OS/2 this directory should exist if this is not floppy only system :-]
62 if test -d c:/. ; then
63     if test -n "$OS2_SHELL"; then
64                 p_=\;
65                 PATH=`cmd /c "echo %PATH%" | tr '\\\\' / `
66                 OS2_SHELL=`cmd /c "echo %OS2_SHELL%" | tr '\\\\' / | tr '[A-Z]' '[a-z]'`
67         elif test -n "$DJGPP"; then
68                 p_=\;
69         fi
70 fi
71
72 : Proper PATH setting
73 paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin'
74 paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin"
75 paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin"
76 paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin"
77 paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb"
78 paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /usr/ccs/bin"
79 paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib"
80 paths="$paths /sbin /usr/sbin /usr/libexec"
81
82 for p in $paths
83 do
84         case "$p_$PATH$p_" in
85         *$p_$p$p_*) ;;
86         *) test -d $p && PATH=$PATH$p_$p ;;
87         esac
88 done
89
90 PATH=.$p_$PATH
91 export PATH
92
93 : shall we be using ksh?
94 inksh=''
95 needksh=''
96 avoidksh=''
97 newsh=/bin/ksh
98 changesh=''
99 if (PATH=.; alias -x) >/dev/null 2>&1; then
100                 inksh=true
101 fi
102 if test -f /hp-ux -a -f /bin/ksh; then
103         needksh='to avoid sh bug in "here document" expansion'
104 fi
105 if test -d /usr/lpp -a -f /usr/bin/bsh -a -f /usr/bin/uname; then
106         if test X`/usr/bin/uname -v` = X4; then
107                 avoidksh="to avoid AIX 4's /bin/sh"
108                 newsh=/usr/bin/bsh
109         fi
110 fi
111 if test -f /osf_boot -a -f /usr/sbin/setld; then
112         if test X`/usr/bin/uname -s` = XOSF1; then
113                 avoidksh="to avoid Digital UNIX' ksh"
114                 newsh=/bin/sh
115                 unset BIN_SH # if this is 'xpg4' sh will start up ksh
116         fi
117 fi
118 case "$inksh/$needksh" in
119 /[a-z]*)
120                 ENV=''
121                 changesh=true
122                 reason="$needksh"
123         ;;
124 esac
125 case "$inksh/$avoidksh" in
126 true/[a-z]*)
127         changesh=true
128         reason="$avoidksh"
129         ;;
130 esac
131 case "$inksh/$needksh-$avoidksh-" in
132 true/--)
133                 cat <<EOM
134 (I see you are using the Korn shell.  Some ksh's blow up on $me,
135 mainly on older exotic systems.  If yours does, try the Bourne shell instead.)
136 EOM
137         ;;
138 esac
139 case "$changesh" in
140 true)
141         echo "(Feeding myself to $newsh $reason.)"
142         case "$0" in
143         Configure|*/Configure) exec $newsh $0 "$@";;
144         *) exec $newsh Configure "$@";;
145         esac
146         ;;
147 esac
148
149 : if needed set CDPATH to a harmless value that is not chatty
150 : avoid bash 2.02 problems with empty CDPATH.
151 case "$CDPATH" in
152 '')     ;;
153 *)      case "$SHELL" in
154         *bash*) CDPATH='.' ;;
155         *)              CDPATH='' ;;
156         esac
157         ;;
158 esac
159 : Configure runs within the UU subdirectory
160 test -d UU || mkdir UU
161 cd UU && rm -f ./*
162
163 ccsymbols=''
164 cppccsymbols=''
165 cppsymbols=''
166 dynamic_ext=''
167 extensions=''
168 known_extensions=''
169 nonxs_ext=''
170 static_ext=''
171 useopcode=''
172 useposix=''
173 d_bsd=''
174 d_eunice=''
175 d_xenix=''
176 eunicefix=''
177 Mcc=''
178 ar=''
179 awk=''
180 bash=''
181 bison=''
182 byacc=''
183 cat=''
184 chgrp=''
185 chmod=''
186 chown=''
187 comm=''
188 compress=''
189 cp=''
190 cpio=''
191 cpp=''
192 csh=''
193 date=''
194 echo=''
195 egrep=''
196 emacs=''
197 expr=''
198 find=''
199 flex=''
200 grep=''
201 gzip=''
202 inews=''
203 ksh=''
204 less=''
205 line=''
206 lint=''
207 ln=''
208 lp=''
209 lpr=''
210 ls=''
211 mail=''
212 mailx=''
213 make=''
214 mkdir=''
215 more=''
216 mv=''
217 nm=''
218 nroff=''
219 perl=''
220 pg=''
221 pmake=''
222 pr=''
223 rm=''
224 rmail=''
225 sed=''
226 sendmail=''
227 shar=''
228 sleep=''
229 smail=''
230 sort=''
231 submit=''
232 tail=''
233 tar=''
234 tbl=''
235 tee=''
236 test=''
237 touch=''
238 tr=''
239 troff=''
240 uname=''
241 uniq=''
242 uuname=''
243 vi=''
244 zcat=''
245 zip=''
246 full_ar=''
247 full_sed=''
248 libswanted=''
249 hint=''
250 myuname=''
251 osname=''
252 osvers=''
253 Author=''
254 Date=''
255 Header=''
256 Id=''
257 Locker=''
258 Log=''
259 RCSfile=''
260 Revision=''
261 Source=''
262 State=''
263 _a=''
264 _exe=''
265 _o=''
266 archobjs=''
267 exe_ext=''
268 firstmakefile=''
269 lib_ext=''
270 obj_ext=''
271 path_sep=''
272 afs=''
273 alignbytes=''
274 ansi2knr=''
275 archlib=''
276 archlibexp=''
277 d_archlib=''
278 installarchlib=''
279 archname=''
280 myarchname=''
281 d_atolf=''
282 d_atoll=''
283 baserev=''
284 bin=''
285 binexp=''
286 installbin=''
287 bincompat5005=''
288 d_bincompat5005=''
289 byteorder=''
290 cc=''
291 gccversion=''
292 ccflags=''
293 cppflags=''
294 ldflags=''
295 lkflags=''
296 locincpth=''
297 optimize=''
298 cf_email=''
299 cf_by=''
300 cf_time=''
301 contains=''
302 cpp_stuff=''
303 cpplast=''
304 cppminus=''
305 cpprun=''
306 cppstdin=''
307 crosscompile=''
308 d_access=''
309 d_accessx=''
310 d_alarm=''
311 d_attribut=''
312 d_bcmp=''
313 d_bcopy=''
314 d_bzero=''
315 d_casti32=''
316 castflags=''
317 d_castneg=''
318 d_chown=''
319 d_chroot=''
320 d_chsize=''
321 d_closedir=''
322 d_void_closedir=''
323 d_const=''
324 cryptlib=''
325 d_crypt=''
326 d_csh=''
327 full_csh=''
328 d_cuserid=''
329 d_dbl_dig=''
330 d_difftime=''
331 d_dlerror=''
332 d_dlopen=''
333 d_dlsymun=''
334 d_dosuid=''
335 d_suidsafe=''
336 d_drand48proto=''
337 d_dup2=''
338 d_eaccess=''
339 d_endgrent=''
340 d_endhent=''
341 d_endnent=''
342 d_endpent=''
343 d_endpwent=''
344 d_endsent=''
345 d_endspent=''
346 d_fchmod=''
347 d_fchown=''
348 d_fcntl=''
349 d_fd_macros=''
350 d_fd_set=''
351 d_fds_bits=''
352 d_fgetpos=''
353 d_flexfnam=''
354 d_flock=''
355 d_fork=''
356 d_fseeko=''
357 d_fsetpos=''
358 d_ftello=''
359 d_ftime=''
360 d_gettimeod=''
361 d_Gconvert=''
362 d_getgrent=''
363 d_getgrps=''
364 d_gethbyaddr=''
365 d_gethbyname=''
366 d_gethent=''
367 aphostname=''
368 d_gethname=''
369 d_phostname=''
370 d_uname=''
371 d_gethostprotos=''
372 d_getlogin=''
373 d_getmntent=''
374 d_getnbyaddr=''
375 d_getnbyname=''
376 d_getnent=''
377 d_getnetprotos=''
378 d_getpent=''
379 d_getpgid=''
380 d_getpgrp2=''
381 d_bsdgetpgrp=''
382 d_getpgrp=''
383 d_getppid=''
384 d_getprior=''
385 d_getpbyname=''
386 d_getpbynumber=''
387 d_getprotoprotos=''
388 d_getpwent=''
389 d_getsent=''
390 d_getservprotos=''
391 d_getspent=''
392 d_getspnam=''
393 d_getsbyname=''
394 d_getsbyport=''
395 d_gnulibc=''
396 d_hasmntopt=''
397 d_htonl=''
398 d_inetaton=''
399 d_isascii=''
400 d_killpg=''
401 d_lchown=''
402 d_ldbl_dig=''
403 d_link=''
404 d_locconv=''
405 d_lockf=''
406 d_longdbl=''
407 longdblsize=''
408 d_longlong=''
409 longlongsize=''
410 d_lstat=''
411 d_madvise=''
412 d_mblen=''
413 d_mbstowcs=''
414 d_mbtowc=''
415 d_memchr=''
416 d_memcmp=''
417 d_memcpy=''
418 d_memmove=''
419 d_memset=''
420 d_mkdir=''
421 d_mkfifo=''
422 d_mktime=''
423 d_mmap=''
424 mmaptype=''
425 d_mprotect=''
426 d_msg=''
427 d_msgctl=''
428 d_msgget=''
429 d_msgrcv=''
430 d_msgsnd=''
431 d_msync=''
432 d_munmap=''
433 d_nice=''
434 d_open3=''
435 d_fpathconf=''
436 d_pathconf=''
437 d_pause=''
438 d_pipe=''
439 d_poll=''
440 d_portable=''
441 d_old_pthread_create_joinable=''
442 old_pthread_create_joinable=''
443 d_pthread_yield=''
444 d_sched_yield=''
445 sched_yield=''
446 d_readdir=''
447 d_rewinddir=''
448 d_seekdir=''
449 d_telldir=''
450 d_readlink=''
451 d_readv=''
452 d_rename=''
453 d_rmdir=''
454 d_safebcpy=''
455 d_safemcpy=''
456 d_sanemcmp=''
457 d_select=''
458 d_sem=''
459 d_semctl=''
460 d_semget=''
461 d_semop=''
462 d_setegid=''
463 d_seteuid=''
464 d_setgrent=''
465 d_setgrps=''
466 d_sethent=''
467 d_setlinebuf=''
468 d_setlocale=''
469 d_setnent=''
470 d_setpent=''
471 d_setpgid=''
472 d_setpgrp2=''
473 d_bsdsetpgrp=''
474 d_setpgrp=''
475 d_setprior=''
476 d_setpwent=''
477 d_setregid=''
478 d_setresgid=''
479 d_setresuid=''
480 d_setreuid=''
481 d_setrgid=''
482 d_setruid=''
483 d_setsent=''
484 d_setsid=''
485 d_setspent=''
486 d_setvbuf=''
487 d_sfio=''
488 usesfio=''
489 d_shm=''
490 d_shmat=''
491 d_shmatprototype=''
492 shmattype=''
493 d_shmctl=''
494 d_shmdt=''
495 d_shmget=''
496 d_sigaction=''
497 d_sigsetjmp=''
498 d_cmsghdr_s=''
499 d_msg_ctrunc=''
500 d_msg_dontroute=''
501 d_msg_oob=''
502 d_msg_peek=''
503 d_msg_proxy=''
504 d_msghdr_s=''
505 d_oldsock=''
506 d_recvmsg=''
507 d_scm_rights=''
508 d_sendmsg=''
509 d_socket=''
510 d_sockpair=''
511 sockethdr=''
512 socketlib=''
513 d_statblks=''
514 d_fstatfs=''
515 d_statfs=''
516 d_statfsflags=''
517 d_fstatvfs=''
518 d_statvfs=''
519 d_stdio_cnt_lval=''
520 d_stdio_ptr_lval=''
521 d_stdiobase=''
522 d_stdstdio=''
523 stdio_base=''
524 stdio_bufsiz=''
525 stdio_cnt=''
526 stdio_filbuf=''
527 stdio_ptr=''
528 d_index=''
529 d_strchr=''
530 d_strcoll=''
531 d_strctcpy=''
532 d_strerrm=''
533 d_strerror=''
534 d_sysernlst=''
535 d_syserrlst=''
536 d_strtod=''
537 d_strtol=''
538 d_strtoul=''
539 d_strxfrm=''
540 d_symlink=''
541 d_syscall=''
542 d_sysconf=''
543 d_system=''
544 d_tcgetpgrp=''
545 d_tcsetpgrp=''
546 d_telldirproto=''
547 d_time=''
548 timetype=''
549 clocktype=''
550 d_times=''
551 d_truncate=''
552 d_tzname=''
553 d_umask=''
554 d_semctl_semid_ds=''
555 d_semctl_semun=''
556 d_union_semun=''
557 d_vfork=''
558 usevfork=''
559 d_voidsig=''
560 signal_t=''
561 d_volatile=''
562 d_charvspr=''
563 d_vprintf=''
564 d_wait4=''
565 d_waitpid=''
566 d_wcstombs=''
567 d_wctomb=''
568 d_writev=''
569 dlext=''
570 cccdlflags=''
571 ccdlflags=''
572 dlsrc=''
573 ld=''
574 lddlflags=''
575 usedl=''
576 doublesize=''
577 ebcdic=''
578 fflushNULL=''
579 fflushall=''
580 fpostype=''
581 gidtype=''
582 groupstype=''
583 h_fcntl=''
584 h_sysfile=''
585 i_arpainet=''
586 db_hashtype=''
587 db_prefixtype=''
588 i_db=''
589 i_dbm=''
590 i_rpcsvcdbm=''
591 d_dirnamlen=''
592 direntrytype=''
593 i_dirent=''
594 i_dld=''
595 i_dlfcn=''
596 i_fcntl=''
597 i_float=''
598 i_gdbm=''
599 d_grpasswd=''
600 i_grp=''
601 d_int64t=''
602 i_inttypes=''
603 i_limits=''
604 i_locale=''
605 i_machcthr=''
606 i_malloc=''
607 i_math=''
608 i_memory=''
609 i_mntent=''
610 i_ndbm=''
611 i_netdb=''
612 i_neterrno=''
613 i_netinettcp=''
614 i_niin=''
615 i_sysin=''
616 i_poll=''
617 i_pthread=''
618 d_pwage=''
619 d_pwchange=''
620 d_pwclass=''
621 d_pwcomment=''
622 d_pwexpire=''
623 d_pwgecos=''
624 d_pwpasswd=''
625 d_pwquota=''
626 i_pwd=''
627 i_sfio=''
628 i_shadow=''
629 i_socks=''
630 i_stddef=''
631 i_stdlib=''
632 i_string=''
633 strings=''
634 i_sysaccess=''
635 i_sysdir=''
636 i_sysfile=''
637 d_voidtty=''
638 i_bsdioctl=''
639 i_sysfilio=''
640 i_sysioctl=''
641 i_syssockio=''
642 i_sysmman=''
643 i_sysmount=''
644 i_sysndir=''
645 i_sysparam=''
646 i_sysresrc=''
647 i_syssecrt=''
648 i_sysselct=''
649 i_sysstat=''
650 i_sysstatvfs=''
651 i_systimes=''
652 i_systypes=''
653 d_iovec_s=''
654 i_sysuio=''
655 i_sysun=''
656 i_syswait=''
657 i_sgtty=''
658 i_termio=''
659 i_termios=''
660 i_systime=''
661 i_systimek=''
662 i_time=''
663 timeincl=''
664 i_unistd=''
665 i_utime=''
666 i_values=''
667 i_stdarg=''
668 i_varargs=''
669 i_varhdr=''
670 i_vfork=''
671 installprefix=''
672 installprefixexp=''
673 installstyle=''
674 installusrbinperl=''
675 intsize=''
676 longsize=''
677 shortsize=''
678 d_fpos64_t=''
679 d_llseek=''
680 d_off64_t=''
681 libc=''
682 ldlibpthname=''
683 libperl=''
684 shrpenv=''
685 useshrplib=''
686 glibpth=''
687 libpth=''
688 loclibpth=''
689 plibpth=''
690 xlibpth=''
691 ignore_versioned_solibs=''
692 libs=''
693 lns=''
694 d_PRIEldbl=''
695 d_PRIFldbl=''
696 d_PRIGldbl=''
697 d_PRIeldbl=''
698 d_PRIfldbl=''
699 d_PRIgldbl=''
700 sPRIEldbl=''
701 sPRIFldbl=''
702 sPRIGldbl=''
703 sPRIeldbl=''
704 sPRIfldbl=''
705 sPRIgldbl=''
706 lseeksize=''
707 lseektype=''
708 make_set_make=''
709 d_mymalloc=''
710 freetype=''
711 mallocobj=''
712 mallocsrc=''
713 malloctype=''
714 usemymalloc=''
715 installman1dir=''
716 man1dir=''
717 man1direxp=''
718 man1ext=''
719 installman3dir=''
720 man3dir=''
721 man3direxp=''
722 man3ext=''
723 huge=''
724 large=''
725 medium=''
726 models=''
727 small=''
728 split=''
729 modetype=''
730 multiarch=''
731 mydomain=''
732 myhostname=''
733 phostname=''
734 c=''
735 n=''
736 d_eofnblk=''
737 eagain=''
738 o_nonblock=''
739 rd_nodata=''
740 netdb_hlen_type=''
741 netdb_host_type=''
742 netdb_name_type=''
743 netdb_net_type=''
744 groupcat=''
745 hostcat=''
746 passcat=''
747 orderlib=''
748 ranlib=''
749 package=''
750 spackage=''
751 pager=''
752 apiversion=''
753 patchlevel=''
754 subversion=''
755 version=''
756 perladmin=''
757 perlpath=''
758 pidtype=''
759 prefix=''
760 prefixexp=''
761 installprivlib=''
762 privlib=''
763 privlibexp=''
764 prototype=''
765 ptrsize=''
766 d_PRIX64=''
767 d_PRId64=''
768 d_PRIi64=''
769 d_PRIo64=''
770 d_PRIu64=''
771 d_PRIx64=''
772 sPRIX64=''
773 sPRId64=''
774 sPRIi64=''
775 sPRIo64=''
776 sPRIu64=''
777 sPRIx64=''
778 drand01=''
779 randbits=''
780 randfunc=''
781 randseedtype=''
782 seedfunc=''
783 installscript=''
784 scriptdir=''
785 scriptdirexp=''
786 selectminbits=''
787 selecttype=''
788 sh=''
789 sig_count=''
790 sig_name=''
791 sig_name_init=''
792 sig_num=''
793 sig_num_init=''
794 installsitearch=''
795 sitearch=''
796 sitearchexp=''
797 installsitelib=''
798 sitelib=''
799 sitelibexp=''
800 siteprefix=''
801 siteprefixexp=''
802 sizetype=''
803 so=''
804 sharpbang=''
805 shsharp=''
806 spitshell=''
807 src=''
808 ssizetype=''
809 startperl=''
810 startsh=''
811 stdchar=''
812 d_stdio_stream_array=''
813 stdio_stream_array=''
814 d_strtoull=''
815 sysman=''
816 trnl=''
817 uidtype=''
818 archname64=''
819 use64bits=''
820 uselongdouble=''
821 usemultiplicity=''
822 nm_opt=''
823 nm_so_opt=''
824 runnm=''
825 usenm=''
826 useperlio=''
827 usesocks=''
828 d_oldpthreads=''
829 usethreads=''
830 incpath=''
831 mips=''
832 mips_type=''
833 usrinc=''
834 d_vendorlib=''
835 installvendorlib=''
836 vendorlib=''
837 vendorlibexp=''
838 usevendorprefix=''
839 vendorprefix=''
840 vendorprefixexp=''
841 defvoidused=''
842 voidflags=''
843 CONFIG=''
844
845 define='define'
846 undef='undef'
847 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
848 rmlist=''
849
850 : We must find out about Eunice early
851 eunicefix=':'
852 if test -f /etc/unixtovms; then
853         eunicefix=/etc/unixtovms
854 fi
855 if test -f /etc/unixtovms.exe; then
856         eunicefix=/etc/unixtovms.exe
857 fi
858
859 i_whoami=''
860 : Possible local include directories to search.
861 : Set locincpth to "" in a hint file to defeat local include searches.
862 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
863 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
864 :
865 : no include file wanted by default
866 inclwanted=''
867
868 : list of known cpp symbols, sorted alphabetically
869 al="AMIX BIT_MSF BSD BSD4_3 BSD_NET2 CMU CRAY DGUX DOLPHIN DPX2"
870 al="$al GO32 GOULD_PN HP700 I386 I80960 I960 Lynx M68000 M68K MACH"
871 al="$al MIPSEB MIPSEL MSDOS MTXINU MULTIMAX MVS"
872 al="$al M_COFF M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM"
873 al="$al M_SYS3 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX"
874 al="$al NeXT OCS88 OSF1 PARISC PC532 PORTAR POSIX"
875 al="$al PWB R3000 RES RISC6000 RT Sun386i SVR3 SVR4"
876 al="$al SYSTYPE_BSD SYSTYPE_SVR4 SYSTYPE_SYSV Tek4132 Tek4300"
877 al="$al UMAXV USGr4 USGr4_2 UTEK UTS UTek UnicomPBB UnicomPBD Utek"
878 al="$al VMS Xenix286"
879 al="$al _AIX _AIX32 _AIX370 _AIX41 _AM29000 _COFF _CRAY _CX_UX _EPI"
880 al="$al _IBMESA _IBMR2 _M88K _M88KBCS_TARGET _POWER"
881 al="$al _MIPSEB _MIPSEL _M_COFF _M_I86 _M_I86SM _M_SYS3"
882 al="$al _M_SYS5 _M_SYSIII _M_SYSV _M_UNIX _M_XENIX _NLS _PGC_ _R3000"
883 al="$al _SYSTYPE_BSD _SYSTYPE_BSD43 _SYSTYPE_SVR4"
884 al="$al _SYSTYPE_SYSV _SYSV3 _U370 _UNICOS"
885 al="$al __386BSD__ __BIG_ENDIAN __BIG_ENDIAN__ __BSD_4_4__"
886 al="$al __DGUX__ __DPX2__ __H3050R __H3050RX"
887 al="$al __LITTLE_ENDIAN __LITTLE_ENDIAN__ __MACH__"
888 al="$al __MIPSEB __MIPSEB__ __MIPSEL __MIPSEL__"
889 al="$al __Next__ __OSF1__ __PARAGON__ __PGC__ __PWB __STDC__"
890 al="$al __SVR4_2__ __UMAXV__"
891 al="$al ____386BSD____ __alpha __alpha__ __amiga"
892 al="$al __bsd4_2 __bsd4_2__ __bsdi__ __convex__"
893 al="$al __host_mips__"
894 al="$al __hp9000s200 __hp9000s300 __hp9000s400 __hp9000s500"
895 al="$al __hp9000s500 __hp9000s700 __hp9000s800"
896 al="$al __hppa __hpux __hp_osf __i286 __i286__ __i386 __i386__"
897 al="$al __i486 __i486__ __i860 __i860__ __ibmesa __ksr1__ __linux__"
898 al="$al __m68k __m68k__ __m88100__ __m88k __m88k__"
899 al="$al __mc68000 __mc68000__ __mc68020 __mc68020__"
900 al="$al __mc68030 __mc68030__ __mc68040 __mc68040__"
901 al="$al __mc88100 __mc88100__ __mips __mips__"
902 al="$al __motorola__ __osf__ __pa_risc __sparc__ __stdc__"
903 al="$al __sun __sun__ __svr3__ __svr4__ __ultrix __ultrix__"
904 al="$al __unix __unix__ __uxpm__ __uxps__ __vax __vax__"
905 al="$al _host_mips _mips _unix"
906 al="$al a29k aegis aix aixpc alliant alpha am29000 amiga ansi ardent"
907 al="$al apollo ardent att386 att3b"
908 al="$al bsd bsd43 bsd4_2 bsd4_3 bsd4_4 bsdi bull"
909 al="$al cadmus clipper concurrent convex cray ctix"
910 al="$al dmert encore gcos gcx gimpel gould"
911 al="$al hbullx20 hcx host_mips hp200 hp300 hp700 hp800"
912 al="$al hp9000 hp9000s300 hp9000s400 hp9000s500"
913 al="$al hp9000s700 hp9000s800 hp9k8 hppa hpux"
914 al="$al i186 i286 i386 i486 i8086"
915 al="$al i80960 i860 iAPX286 ibm ibm032 ibmrt interdata is68k"
916 al="$al ksr1 linux luna luna88k m68k m88100 m88k"
917 al="$al mc300 mc500 mc68000 mc68010 mc68020 mc68030"
918 al="$al mc68040 mc68060 mc68k mc68k32 mc700"
919 al="$al mc88000 mc88100 merlin mert mips mvs n16"
920 al="$al ncl_el ncl_mr"
921 al="$al news1500 news1700 news1800 news1900 news3700"
922 al="$al news700 news800 news900 ns16000 ns32000"
923 al="$al ns32016 ns32332 ns32k nsc32000 os osf"
924 al="$al parisc pc532 pdp11 plexus posix pyr"
925 al="$al riscix riscos scs sequent sgi sinix sony sony_news"
926 al="$al sonyrisc sparc sparclite spectrum stardent stratos"
927 al="$al sun sun3 sun386 svr4 sysV68 sysV88"
928 al="$al titan tower tower32 tower32_200 tower32_600 tower32_700"
929 al="$al tower32_800 tower32_850 tss u370 u3b u3b2 u3b20 u3b200"
930 al="$al u3b20d u3b5 ultrix unix unixpc unos vax venix vms"
931 al="$al xenix z8000"
932
933 : Trailing extension.  Override this in a hint file, if needed.
934 _exe=''
935 : Extra object files, if any, needed on this platform.
936 archobjs=''
937 groupstype=''
938 : change the next line if compiling for Xenix/286 on Xenix/386
939 xlibpth='/usr/lib/386 /lib/386'
940
941 : Possible local library directories to search.
942 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
943 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
944
945 : general looking path for locating libraries
946 glibpth="/shlib /usr/shlib /lib/pa1.1 /usr/lib/large"
947 glibpth="$glibpth /lib /usr/lib $xlibpth"
948 glibpth="$glibpth /lib/large /usr/lib/small /lib/small"
949 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
950
951 : Private path used by Configure to find libraries.  Its value
952 : is prepended to libpth. This variable takes care of special
953 : machines, like the mips.  Usually, it should be empty.
954 plibpth=''
955
956 : default library list
957 libswanted=''
958 : some systems want to use only the non-versioned libso:s
959 ignore_versioned_solibs=''
960 : full support for void wanted by default
961 defvoidused=15
962
963 : set useposix=false in your hint file to disable the POSIX extension.
964 useposix=true
965 : set useopcode=false in your hint file to disable the Opcode extension.
966 useopcode=true
967 : set usemultiplicity on the Configure command line to enable multiplicity.
968 : set usesocks on the Configure command line to enable socks.
969 : set usethreads on the Configure command line to enable threads.
970 : List of libraries we want.
971 : If anyone needs -lnet, put it in a hint file.
972 libswanted='sfio socket inet nsl nm ndbm gdbm dbm db malloc dl'
973 libswanted="$libswanted dld ld sun m c cposix posix"
974 libswanted="$libswanted ndir dir crypt sec"
975 libswanted="$libswanted ucb bsd BSD PW x"
976 : We probably want to search /usr/shlib before most other libraries.
977 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
978 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
979 glibpth="/usr/shlib $glibpth"
980 : Do not use vfork unless overridden by a hint file.
981 usevfork=false
982
983 : Find the basic shell for Bourne shell scripts
984 case "$sh" in
985 '')
986         case "$SYSTYPE" in
987         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
988         *) xxx='/bin/sh';;
989         esac
990         if test -f "$xxx"; then
991                 sh="$xxx"
992         else
993                 : Build up a list and do a single loop so we can 'break' out.
994                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
995                 for xxx in sh bash ksh pdksh ash; do
996                         for p in $pth; do
997                                 try="$try ${p}/${xxx}"
998                         done
999                 done
1000                 for xxx in $try; do
1001                         if test -f "$xxx"; then
1002                                 sh="$xxx";
1003                                 break
1004                         elif test -f "$xxx.exe"; then
1005                                 sh="$xxx";
1006                                 break
1007                         fi
1008                 done
1009         fi
1010         ;;
1011 esac
1012
1013 case "$sh" in
1014 '')     cat <<EOM >&2
1015 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
1016
1017 Usually it's in /bin/sh.  How did you even get this far?
1018 Please contact me (Perl Maintainers) at perlbug@perl.com and 
1019 we'll try to straighten this all out.
1020 EOM
1021         exit 1
1022         ;;
1023 esac
1024
1025 : see if sh knows # comments
1026 if `$sh -c '#' >/dev/null 2>&1`; then
1027         shsharp=true
1028         spitshell=cat
1029         xcat=/bin/cat
1030         test -f $xcat || xcat=/usr/bin/cat
1031         echo "#!$xcat" >try
1032         $eunicefix try
1033         chmod +x try
1034         ./try > today
1035         if test -s today; then
1036                 sharpbang='#!'
1037         else
1038                 echo "#! $xcat" > try
1039                 $eunicefix try
1040                 chmod +x try
1041                 ./try > today
1042                 if test -s today; then
1043                         sharpbang='#! '
1044                 else
1045                         sharpbang=': use '
1046                 fi
1047         fi
1048 else
1049         echo " "
1050         echo "Your $sh doesn't grok # comments--I will strip them later on."
1051         shsharp=false
1052         cd ..
1053         echo "exec grep -v '^[  ]*#'" >spitshell
1054         chmod +x spitshell
1055         $eunicefix spitshell
1056         spitshell=`pwd`/spitshell
1057         cd UU
1058         echo "I presume that if # doesn't work, #! won't work either!"
1059         sharpbang=': use '
1060 fi
1061 rm -f try today
1062
1063 : figure out how to guarantee sh startup
1064 case "$startsh" in
1065 '') startsh=${sharpbang}${sh} ;;
1066 *)
1067 esac
1068 cat >try <<EOSS
1069 $startsh
1070 set abc
1071 test "$?abc" != 1
1072 EOSS
1073
1074 chmod +x try
1075 $eunicefix try
1076 if ./try; then
1077         : echo "Yup, it does."
1078 else
1079         echo "Hmm... '$startsh' does not guarantee sh startup..."
1080         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1081 fi
1082 rm -f try
1083
1084
1085 : Save command line options in file UU/cmdline.opt for later use in
1086 : generating config.sh.
1087 cat > cmdline.opt <<EOSH
1088 # Configure command line arguments.
1089 config_arg0='$0'
1090 config_args='$*'
1091 config_argc=$#
1092 EOSH
1093 argn=1
1094 for arg in "$@"; do
1095         cat >>cmdline.opt <<EOSH
1096 config_arg$argn='$arg'
1097 EOSH
1098         argn=`expr $argn + 1`
1099 done
1100
1101 : produce awk script to parse command line options
1102 cat >options.awk <<'EOF'
1103 BEGIN {
1104         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1105
1106         len = length(optstr);
1107         for (i = 1; i <= len; i++) {
1108                 c = substr(optstr, i, 1);
1109                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1110                 if (a == ":") {
1111                         arg[c] = 1;
1112                         i++;
1113                 }
1114                 opt[c] = 1;
1115         }
1116 }
1117 {
1118         expect = 0;
1119         str = $0;
1120         if (substr(str, 1, 1) != "-") {
1121                 printf("'%s'\n", str);
1122                 next;
1123         }
1124         len = length($0);
1125         for (i = 2; i <= len; i++) {
1126                 c = substr(str, i, 1);
1127                 if (!opt[c]) {
1128                         printf("-%s\n", substr(str, i));
1129                         next;
1130                 }
1131                 printf("-%s\n", c);
1132                 if (arg[c]) {
1133                         if (i < len)
1134                                 printf("'%s'\n", substr(str, i + 1));
1135                         else
1136                                 expect = 1;
1137                         next;
1138                 }
1139         }
1140 }
1141 END {
1142         if (expect)
1143                 print "?";
1144 }
1145 EOF
1146
1147 : process the command line options
1148 set X `for arg in "$@"; do echo "X$arg"; done |
1149         sed -e s/X// | awk -f options.awk`
1150 eval "set $*"
1151 shift
1152 rm -f options.awk
1153
1154 : set up default values
1155 fastread=''
1156 reuseval=false
1157 config_sh=''
1158 alldone=''
1159 error=''
1160 silent=''
1161 extractsh=''
1162 override=''
1163 knowitall=''
1164 rm -f optdef.sh posthint.sh
1165 cat >optdef.sh <<EOS
1166 $startsh
1167 EOS
1168
1169
1170 : option parsing
1171 while test $# -gt 0; do
1172         case "$1" in
1173         -d) shift; fastread=yes;;
1174         -e) shift; alldone=cont;;
1175         -f)
1176                 shift
1177                 cd ..
1178                 if test -r "$1"; then
1179                         config_sh="$1"
1180                 else
1181                         echo "$me: cannot read config file $1." >&2
1182                         error=true
1183                 fi
1184                 cd UU
1185                 shift;;
1186         -h) shift; error=true;;
1187         -r) shift; reuseval=true;;
1188         -s) shift; silent=true; realsilent=true;;
1189         -E) shift; alldone=exit;;
1190         -K) shift; knowitall=true;;
1191         -O) shift; override=true;;
1192         -S) shift; silent=true; extractsh=true;;
1193         -D)
1194                 shift
1195                 case "$1" in
1196                 *=)
1197                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1198                         echo "$me: ignoring -D $1" >&2
1199                         ;;
1200                 *=*) echo "$1" | \
1201                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1202                 *) echo "$1='define'" >> optdef.sh;;
1203                 esac
1204                 shift
1205                 ;;
1206         -U)
1207                 shift
1208                 case "$1" in
1209                 *=) echo "$1" >> optdef.sh;;
1210                 *=*)
1211                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1212                         echo "$me: ignoring -U $1" >&2
1213                         ;;
1214                 *) echo "$1='undef'" >> optdef.sh;;
1215                 esac
1216                 shift
1217                 ;;
1218         -A)
1219             shift
1220             xxx=''
1221             yyy="$1"
1222             case "$yyy" in
1223             *:*) xxx=`echo $yyy|sed 's!:.*!!'`
1224                  yyy=`echo $yyy|sed 's!^[^:]*:!!'`
1225                  ;;
1226             esac
1227             case "$xxx" in
1228             '') xxx=define ;;
1229             esac
1230             zzz=''
1231             uuu='undef'
1232             case "$yyy" in
1233             *=*) zzz=`echo $yyy|sed 's!^[^=]*=!!'`
1234                  yyy=`echo $yyy|sed 's!=.*!!'`
1235                  case "$yyy:$zzz" in
1236                  undef:) uuu='' ;;
1237                  esac
1238                  ;;
1239             esac
1240             case "$xxx" in
1241             append)
1242                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh
1243                 ;;
1244             clear)
1245                 echo "$yyy=''"                  >> posthint.sh
1246                 ;;
1247             define)
1248                 case "$zzz" in
1249                 '') zzz=define ;;
1250                 esac
1251                 echo "$yyy='$zzz'"              >> posthint.sh
1252                 ;; 
1253             eval)
1254                 echo "eval \"$yyy=$zzz\""       >> posthint.sh
1255                 ;; 
1256             prepend)
1257                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh
1258                 ;; 
1259             undef)
1260                 case "$zzz" in
1261                 '') zzz="$uuu" ;;
1262                 esac
1263                 echo "$yyy=$zzz"                >> posthint.sh
1264                 ;; 
1265             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2
1266                 ;;
1267             esac
1268             ;;
1269         -V) echo "$me generated by metaconfig 3.0 PL70." >&2
1270                 exit 0;;
1271         --) break;;
1272         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1273         *) break;;
1274         esac
1275 done
1276
1277 case "$error" in
1278 true)
1279         cat >&2 <<EOM
1280 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1281                  [-U symbol] [-U symbol=] [-A command:symbol...]
1282   -d : use defaults for all answers.
1283   -e : go on without questioning past the production of config.sh.
1284   -f : specify an alternate default configuration file.
1285   -h : print this help message and exit (with an error status).
1286   -r : reuse C symbols value if possible (skips costly nm extraction).
1287   -s : silent mode, only echoes questions and essential information.
1288   -D : define symbol to have some value:
1289          -D symbol         symbol gets the value 'define'
1290          -D symbol=value   symbol gets the value 'value'
1291   -E : stop at the end of questions, after having produced config.sh.
1292   -K : do not use unless you know what you are doing.
1293   -O : let -D and -U override definitions from loaded configuration file.
1294   -S : perform variable substitutions on all .SH files (can mix with -f)
1295   -U : undefine symbol:
1296          -U symbol    symbol gets the value 'undef'
1297          -U symbol=   symbol gets completely empty
1298   -A : manipulate symbol after the platform specific hints have been applied:
1299          -A append:symbol=value         append value to symbol
1300          -A define:symbol=value         define symbol to have value
1301          -A symbol=value                define symbol to have value
1302          -A clear:symbol                define symbol to be ''
1303          -A define:symbol               define symbol to be 'define'
1304          -A eval:symbol=value           define symbol to be eval of value
1305          -A prepend:symbol=value        prepend value to symbol
1306          -A undef:symbol                define symbol to be 'undef'
1307          -A undef:symbol=               define symbol to be ''
1308   -V : print version number and exit (with a zero status).
1309 EOM
1310         exit 1
1311         ;;
1312 esac
1313
1314 : Sanity checks
1315 case "$fastread$alldone" in
1316 yescont|yesexit) ;;
1317 *)
1318         if test ! -t 0; then
1319                 echo "Say 'sh Configure', not 'sh <Configure'"
1320                 exit 1
1321         fi
1322         ;;
1323 esac
1324
1325 exec 4>&1
1326 case "$silent" in
1327 true) exec 1>/dev/null;;
1328 esac
1329
1330 : run the defines and the undefines, if any, but leave the file out there...
1331 touch optdef.sh
1332 . ./optdef.sh
1333 : create the posthint manipulation script and leave the file out there...
1334 touch posthint.sh
1335 . ./posthint.sh
1336
1337 : set package name
1338 package=perl5
1339 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1340 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1341 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1342 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1343 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1344 esac
1345
1346 : Some greps do not return status, grrr.
1347 echo "grimblepritz" >grimble
1348 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1349         contains=contains
1350 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1351         contains=grep
1352 else
1353         contains=contains
1354 fi
1355 rm -f grimble
1356 : the following should work in any shell
1357 case "$contains" in
1358 contains*)
1359         echo " "
1360         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1361         cat >contains <<'EOSS'
1362 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1363 EOSS
1364 chmod +x contains
1365 esac
1366
1367 : Find the path to the source tree
1368 case "$src" in
1369 '') case "$0" in
1370     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1371          case "$src" in
1372          /*)    ;;
1373          *)     src=`cd ../$src && pwd` ;;
1374          esac
1375          ;;
1376     *)   src='.';;
1377     esac;;
1378 esac
1379 case "$src" in
1380 '')     src=/
1381         rsrc=/
1382         ;;
1383 /*) rsrc="$src";;
1384 *) rsrc="../$src";;
1385 esac
1386 if test -f $rsrc/Configure && \
1387         $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1388 then
1389    : found it, so we are ok.
1390 else
1391         rsrc=''
1392         for src in . .. ../.. ../../.. ../../../..; do
1393                 if test -f ../$src/Configure && \
1394                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1395                 then
1396                         rsrc=../$src
1397                         break
1398                 fi
1399         done
1400 fi
1401 case "$rsrc" in
1402 '')
1403         cat <<EOM >&4
1404
1405 Sorry, I can't seem to locate the source dir for $package.  Please start
1406 Configure with an explicit path -- i.e. /some/path/Configure.
1407
1408 EOM
1409         exit 1
1410         ;;
1411 ../.)   rsrc='..';;
1412 *)
1413         echo " "
1414         echo "Sources for $package found in \"$src\"." >&4
1415         ;;
1416 esac
1417
1418 : script used to extract .SH files with variable substitutions
1419 cat >extract <<'EOS'
1420 CONFIGDOTSH=true
1421 echo "Doing variable substitutions on .SH files..."
1422 if test -f $src/MANIFEST; then
1423         set x `awk '{print $1}' <$src/MANIFEST | grep '\.SH$'`
1424 else
1425         echo "(Looking for .SH files under the source directory.)"
1426         set x `(cd $src; find . -name "*.SH" -print)`
1427 fi
1428 shift
1429 case $# in
1430 0) set x `(cd $src; echo *.SH)`; shift;;
1431 esac
1432 if test ! -f $src/$1; then
1433         shift
1434 fi
1435 mkdir_p='
1436 name=$1;
1437 create="";
1438 while test $name; do
1439         if test ! -d "$name"; then
1440                 create="$name $create";
1441                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1442                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1443         else
1444                 name="";
1445         fi;
1446 done;
1447 for file in $create; do
1448         mkdir $file;
1449 done
1450 '
1451 for file in $*; do
1452         case "$src" in
1453         ".")
1454                 case "$file" in
1455                 */*)
1456                         dir=`expr X$file : 'X\(.*\)/'`
1457                         file=`expr X$file : 'X.*/\(.*\)'`
1458                         (cd $dir && . ./$file)
1459                         ;;
1460                 *)
1461                         . ./$file
1462                         ;;
1463                 esac
1464                 ;;
1465         *)
1466                 case "$file" in
1467                 */*)
1468                         dir=`expr X$file : 'X\(.*\)/'`
1469                         file=`expr X$file : 'X.*/\(.*\)'`
1470                         (set x $dir; shift; eval $mkdir_p)
1471                         sh <$src/$dir/$file
1472                         ;;
1473                 *)
1474                         sh <$src/$file
1475                         ;;
1476                 esac
1477                 ;;
1478         esac
1479 done
1480 if test -f $src/config_h.SH; then
1481         if test ! -f config.h; then
1482         : oops, they left it out of MANIFEST, probably, so do it anyway.
1483         . $src/config_h.SH
1484         fi
1485 fi
1486 EOS
1487
1488 : extract files and exit if asked to do so
1489 case "$extractsh" in
1490 true)
1491         case "$realsilent" in
1492         true) ;;
1493         *) exec 1>&4;;
1494         esac
1495         case "$config_sh" in
1496         '') config_sh='config.sh';;
1497         esac
1498         echo " "
1499         echo "Fetching answers from $config_sh..."
1500         cd ..
1501         . $config_sh
1502         test "$override" && . ./optdef.sh
1503         echo " "
1504         . UU/extract
1505         rm -rf UU
1506         echo "Done."
1507         exit 0
1508         ;;
1509 esac
1510
1511 : Eunice requires " " instead of "", can you believe it
1512 echo " "
1513 : Here we go...
1514 echo "Beginning of configuration questions for $package."
1515
1516 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1517
1518 : first determine how to suppress newline on echo command
1519 echo " "
1520 echo "Checking echo to see how to suppress newlines..."
1521 (echo "hi there\c" ; echo " ") >.echotmp
1522 if $contains c .echotmp >/dev/null 2>&1 ; then
1523         echo "...using -n."
1524         n='-n'
1525         c=''
1526 else
1527         cat <<'EOM'
1528 ...using \c
1529 EOM
1530         n=''
1531         c='\c'
1532 fi
1533 echo $n "The star should be here-->$c"
1534 echo '*'
1535 rm -f .echotmp
1536
1537 : Now test for existence of everything in MANIFEST
1538 echo " "
1539 if test -f $rsrc/MANIFEST; then
1540         echo "First let's make sure your kit is complete.  Checking..." >&4
1541         awk '$1 !~ /PACK[A-Z]+/ {print $1}' $rsrc/MANIFEST | split -50
1542         rm -f missing
1543         tmppwd=`pwd`
1544         for filelist in x??; do
1545                 (cd $rsrc; ls `cat $tmppwd/$filelist` >/dev/null 2>>$tmppwd/missing)
1546         done
1547         if test -s missing; then
1548                 cat missing >&4
1549                 cat >&4 <<'EOM'
1550
1551 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1552
1553 You have the option of continuing the configuration process, despite the
1554 distinct possibility that your kit is damaged, by typing 'y'es.  If you
1555 do, don't blame me if something goes wrong.  I advise you to type 'n'o
1556 and contact the author (perlbug@perl.com).
1557
1558 EOM
1559                 echo $n "Continue? [n] $c" >&4
1560                 read ans
1561                 case "$ans" in
1562                 y*)
1563                         echo "Continuing..." >&4
1564                         rm -f missing
1565                         ;;
1566                 *)
1567                         echo "ABORTING..." >&4
1568                         kill $$
1569                         ;;
1570                 esac
1571         else
1572                 echo "Looks good..."
1573         fi
1574 else
1575         echo "There is no MANIFEST file.  I hope your kit is complete !"
1576 fi
1577 rm -f missing x??
1578
1579 echo " "
1580 : Find the appropriate value for a newline for tr
1581 if test -n "$DJGPP"; then
1582        trnl='\012'
1583 fi
1584 if test X"$trnl" = X; then
1585         case "`echo foo|tr '\n' x 2>/dev/null`" in
1586         foox) trnl='\n' ;;
1587         esac
1588 fi
1589 if test X"$trnl" = X; then
1590         case "`echo foo|tr '\012' x 2>/dev/null`" in
1591         foox) trnl='\012' ;;
1592         esac
1593 fi
1594 if test X"$trnl" = X; then
1595         cat <<EOM >&2
1596
1597 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
1598
1599 EOM
1600         exit 1
1601 fi
1602
1603 : compute the number of columns on the terminal for proper question formatting
1604 case "$COLUMNS" in
1605 '') COLUMNS='80';;
1606 esac
1607
1608 : set up the echo used in my read
1609 myecho="case \"\$xxxm\" in
1610 '') echo $n \"\$rp $c\" >&4;;
1611 *) case \"\$rp\" in
1612         '') echo $n \"[\$xxxm] $c\";;
1613         *)
1614                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
1615                         echo \"\$rp\" >&4
1616                         echo $n \"[\$xxxm] $c\" >&4
1617                 else
1618                         echo $n \"\$rp [\$xxxm] $c\" >&4
1619                 fi
1620                 ;;
1621         esac;;
1622 esac"
1623
1624 : now set up to do reads with possible shell escape and default assignment
1625 cat <<EOSC >myread
1626 $startsh
1627 xxxm=\$dflt
1628 $myecho
1629 ans='!'
1630 case "\$fastread" in
1631 yes) case "\$dflt" in
1632         '') ;;
1633         *) ans='';
1634                 case "\$silent-\$rp" in
1635                 true-) ;;
1636                 *) echo " " >&4;;
1637                 esac;;
1638         esac;;
1639 *) case "\$silent" in
1640         true) case "\$rp" in
1641                 '') ans='';;
1642                 esac;;
1643         esac;;
1644 esac
1645 while expr "X\$ans" : "X!" >/dev/null; do
1646         read answ
1647         set x \$xxxm
1648         shift
1649         aok=''; eval "ans=\\"\$answ\\"" && aok=y
1650         case  "\$answ" in
1651         "!")
1652                 sh 1>&4
1653                 echo " "
1654                 $myecho
1655                 ;;
1656         !*)
1657                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
1658                 shift
1659                 sh 1>&4 -c "\$*"
1660                 echo " "
1661                 $myecho
1662                 ;;
1663         "\$ans")
1664                 case "\$ans" in
1665                 \\&*)
1666                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
1667                         shift
1668                         case "\$1" in
1669                         -d)
1670                                 fastread=yes
1671                                 echo "(OK, I'll run with -d after this question.)" >&4
1672                                 ;;
1673                         -*)
1674                                 echo "*** Sorry, \$1 not supported yet." >&4
1675                                 ;;
1676                         esac
1677                         $myecho
1678                         ans=!
1679                         ;;
1680                 esac;;
1681         *)
1682                 case "\$aok" in
1683                 y)
1684                         echo "*** Substitution done -- please confirm."
1685                         xxxm="\$ans"
1686                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
1687                         xxxm="\$ans"
1688                         ans=!
1689                         ;;
1690                 *)
1691                         echo "*** Error -- try again."
1692                         ans=!
1693                         ;;
1694                 esac
1695                 $myecho
1696                 ;;
1697         esac
1698         case "\$ans\$xxxm\$nostick" in
1699         '')
1700                 ans=!
1701                 $myecho
1702                 ;;
1703         esac
1704 done
1705 case "\$ans" in
1706 '') ans="\$xxxm";;
1707 esac
1708 EOSC
1709
1710 : create .config dir to save info across Configure sessions
1711 test -d ../.config || mkdir ../.config
1712 cat >../.config/README <<EOF
1713 This directory created by Configure to save information that should
1714 persist across sessions for $package.
1715
1716 You may safely delete it if you wish.
1717 EOF
1718
1719 : general instructions
1720 needman=true
1721 firsttime=true
1722 user=`(logname) 2>/dev/null`
1723 case "$user" in
1724 '') user=`whoami 2>&1`;;
1725 esac
1726 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
1727         firsttime=false
1728         echo " "
1729         rp='Would you like to see the instructions?'
1730         dflt=n
1731         . ./myread
1732         case "$ans" in
1733         [yY]*) ;;
1734         *) needman=false;;
1735         esac
1736 fi
1737 if $needman; then
1738         cat <<EOH
1739
1740 This installation shell script will examine your system and ask you questions
1741 to determine how the perl5 package should be installed. If you get
1742 stuck on a question, you may use a ! shell escape to start a subshell or
1743 execute a command.  Many of the questions will have default answers in square
1744 brackets; typing carriage return will give you the default.
1745
1746 On some of the questions which ask for file or directory names you are allowed
1747 to use the ~name construct to specify the login directory belonging to "name",
1748 even if you don't have a shell which knows about that.  Questions where this is
1749 allowed will be marked "(~name ok)".
1750
1751 EOH
1752         rp=''
1753         dflt='Type carriage return to continue'
1754         . ./myread
1755         cat <<'EOH'
1756
1757 The prompter used in this script allows you to use shell variables and
1758 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
1759 in the default answer, as if the default line was a set of arguments given to a
1760 script shell.  This means you may also use $* to repeat the whole default line,
1761 so you do not have to re-type everything to add something to the default.
1762
1763 Everytime there is a substitution, you will have to confirm.  If there is an
1764 error (e.g. an unmatched backtick), the default answer will remain unchanged
1765 and you will be prompted again.
1766
1767 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
1768 the questions and use the computed defaults (or the previous answers if there
1769 was already a config.sh file). Type 'Configure -h' for a list of options.
1770 You may also start interactively and then answer '& -d' at any prompt to turn
1771 on the non-interactive behaviour for the remainder of the execution.
1772
1773 EOH
1774         . ./myread
1775         cat <<EOH
1776
1777 Much effort has been expended to ensure that this shell script will run on any
1778 Unix system.  If despite that it blows up on yours, your best bet is to edit
1779 Configure and run it again.  If you can't run Configure for some reason,
1780 you'll have to generate a config.sh file by hand.  Whatever problems you
1781 have, let me (perlbug@perl.com) know how I blew it.
1782
1783 This installation script affects things in two ways:
1784
1785 1) it may do direct variable substitutions on some of the files included
1786    in this kit.
1787 2) it builds a config.h file for inclusion in C programs.  You may edit
1788    any of these files as the need arises after running this script.
1789
1790 If you make a mistake on a question, there is no easy way to back up to it
1791 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
1792 files.  Configure will offer to let you do this before it runs the SH files.
1793
1794 EOH
1795         dflt='Type carriage return to continue'
1796         . ./myread
1797         case "$firsttime" in
1798         true) echo $user >>../.config/instruct;;
1799         esac
1800 fi
1801
1802 : find out where common programs are
1803 echo " "
1804 echo "Locating common programs..." >&4
1805 cat <<EOSC >loc
1806 $startsh
1807 case \$# in
1808 0) exit 1;;
1809 esac
1810 thing=\$1
1811 shift
1812 dflt=\$1
1813 shift
1814 for dir in \$*; do
1815         case "\$thing" in
1816         .)
1817         if test -d \$dir/\$thing; then
1818                 echo \$dir
1819                 exit 0
1820         fi
1821         ;;
1822         *)
1823         for thisthing in \$dir/\$thing; do
1824                 : just loop through to pick last item
1825         done
1826         if test -f \$thisthing; then
1827                 echo \$thisthing
1828                 exit 0
1829         elif test -f \$dir/\$thing.exe; then
1830                 if test -n "$DJGPP"; then
1831                         echo \$dir/\$thing.exe
1832                 else
1833                         : on Eunice apparently
1834                         echo \$dir/\$thing
1835                 fi
1836                 exit 0
1837         fi
1838         ;;
1839         esac
1840 done
1841 echo \$dflt
1842 exit 1
1843 EOSC
1844 chmod +x loc
1845 $eunicefix loc
1846 loclist="
1847 awk
1848 cat
1849 comm
1850 cp
1851 echo
1852 expr
1853 grep
1854 ls
1855 make
1856 mkdir
1857 rm
1858 sed
1859 sort
1860 touch
1861 tr
1862 uniq
1863 "
1864 trylist="
1865 Mcc
1866 ar
1867 byacc
1868 cpp
1869 csh
1870 date
1871 egrep
1872 gzip
1873 less
1874 ln
1875 more
1876 nm
1877 nroff
1878 pg
1879 test
1880 uname
1881 zip
1882 "
1883 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1884 pth="$pth /lib /usr/lib"
1885 for file in $loclist; do
1886         eval xxx=\$$file
1887         case "$xxx" in
1888         /*|?:[\\/]*)
1889                 if test -f "$xxx"; then
1890                         : ok
1891                 else
1892                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
1893                         xxx=`./loc $file $file $pth`
1894                 fi
1895                 ;;
1896         '') xxx=`./loc $file $file $pth`;;
1897         *) xxx=`./loc $xxx $xxx $pth`;;
1898         esac
1899         eval $file=$xxx
1900         eval _$file=$xxx
1901         case "$xxx" in
1902         /*)
1903                 echo $file is in $xxx.
1904                 ;;
1905         ?:[\\/]*)
1906                 echo $file is in $xxx.
1907                 ;;
1908         *)
1909                 echo "I don't know where '$file' is, and my life depends on it." >&4
1910                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
1911                 exit 1
1912                 ;;
1913         esac
1914 done
1915 echo " "
1916 echo "Don't worry if any of the following aren't found..."
1917 say=offhand
1918 for file in $trylist; do
1919         eval xxx=\$$file
1920         case "$xxx" in
1921         /*|?:[\\/]*)
1922                 if test -f "$xxx"; then
1923                         : ok
1924                 else
1925                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
1926                         xxx=`./loc $file $file $pth`
1927                 fi
1928                 ;;
1929         '') xxx=`./loc $file $file $pth`;;
1930         *) xxx=`./loc $xxx $xxx $pth`;;
1931         esac
1932         eval $file=$xxx
1933         eval _$file=$xxx
1934         case "$xxx" in
1935         /*)
1936                 echo $file is in $xxx.
1937                 ;;
1938         ?:[\\/]*)
1939                 echo $file is in $xxx.
1940                 ;;
1941         *)
1942                 echo "I don't see $file out there, $say."
1943                 say=either
1944                 ;;
1945         esac
1946 done
1947 case "$egrep" in
1948 egrep)
1949         echo "Substituting grep for egrep."
1950         egrep=$grep
1951         ;;
1952 esac
1953 case "$ln" in
1954 ln)
1955         echo "Substituting cp for ln."
1956         ln=$cp
1957         ;;
1958 esac
1959 case "$test" in
1960 test)
1961         echo "Hopefully test is built into your sh."
1962         ;;
1963 *)
1964         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
1965                 echo "Using the test built into your sh."
1966                 test=test
1967                 _test=test
1968         fi
1969         ;;
1970 esac
1971 case "$echo" in
1972 echo)
1973         echo "Hopefully echo is built into your sh."
1974         ;;
1975 '') ;;
1976 *)
1977         echo " "
1978 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
1979         $echo $n "hi there$c" >foo1
1980         echo $n "hi there$c" >foo2
1981         if cmp foo1 foo2 >/dev/null 2>&1; then
1982                 echo "They are compatible.  In fact, they may be identical."
1983         else
1984                 case "$n" in
1985                 '-n') n='' c='\c';;
1986                 *) n='-n' c='';;
1987                 esac
1988                 cat <<FOO
1989 They are not compatible!  You are probably running ksh on a non-USG system.
1990 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
1991 have echo built in and we may have to run some Bourne shell scripts.  That
1992 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
1993
1994 FOO
1995                 $echo $n "The star should be here-->$c"
1996                 $echo "*"
1997         fi
1998         $rm -f foo1 foo2
1999         ;;
2000 esac
2001
2002 : determine whether symbolic links are supported
2003 echo " "
2004 $touch blurfl
2005 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2006         echo "Symbolic links are supported." >&4
2007         lns="$ln -s"
2008 else
2009         echo "Symbolic links are NOT supported." >&4
2010         lns="$ln"
2011 fi
2012 $rm -f blurfl sym
2013
2014 : see whether [:lower:] and [:upper:] are supported character classes
2015 echo " "
2016 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2017 ABYZ)
2018         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2019         up='[:upper:]'
2020         low='[:lower:]'
2021         ;;
2022 *)      # There is a discontinuity in EBCDIC between 'I' and 'J'
2023         # (0xc9 and 0xd1), therefore that is a nice testing point.
2024         if test "X$up" = X -o "X$low" = X; then
2025             case "`echo IJ | $tr '[I-J]' '[i-j]' 2>/dev/null`" in
2026             ij) up='[A-Z]'
2027                 low='[a-z]'
2028                 ;;
2029             esac
2030         fi
2031         if test "X$up" = X -o "X$low" = X; then
2032             case "`echo IJ | $tr I-J i-j 2>/dev/null`" in
2033             ij) up='A-Z'
2034                 low='a-z'
2035                 ;;
2036             esac
2037         fi
2038         if test "X$up" = X -o "X$low" = X; then
2039             case "`echo IJ | od -x 2>/dev/null`" in
2040             *C9D1*|*c9d1*)
2041                 echo "Hey, this might be EBCDIC." >&4
2042                 if test "X$up" = X -o "X$low" = X; then
2043                     case "`echo IJ | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
2044                     ij) up='[A-IJ-RS-Z]'
2045                         low='[a-ij-rs-z]'
2046                         ;;
2047                     esac
2048                 fi
2049                 if test "X$up" = X -o "X$low" = X; then
2050                     case "`echo IJ | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
2051                     ij) up='A-IJ-RS-Z'
2052                         low='a-ij-rs-z'
2053                         ;;
2054                     esac
2055                 fi
2056                 ;;
2057             esac
2058         fi
2059 esac
2060 case "`echo IJ | $tr \"$up\" \"$low\" 2>/dev/null`" in
2061 ij)
2062     echo "Using $up and $low to convert case." >&4
2063     ;;
2064 *)
2065     echo "I don't know how to translate letters from upper to lower case." >&4
2066     echo "Your tr is not acting any way I know of." >&4
2067     exit 1
2068     ;;
2069 esac
2070 : set up the translation script tr, must be called with ./tr of course
2071 cat >tr <<EOSC
2072 $startsh
2073 case "\$1\$2" in
2074 '[A-Z][a-z]') exec $tr '$up' '$low';;
2075 '[a-z][A-Z]') exec $tr '$low' '$up';;
2076 esac
2077 exec $tr "\$@"
2078 EOSC
2079 chmod +x tr
2080 $eunicefix tr
2081
2082 : Try to determine whether config.sh was made on this system
2083 case "$config_sh" in
2084 '')
2085 myuname=`( ($uname -a) 2>/dev/null || hostname) 2>&1`
2086 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
2087 # because the A-Z/a-z are not consecutive.
2088 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
2089         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
2090 newmyuname="$myuname"
2091 dflt=n
2092 case "$knowitall" in
2093 '')
2094         if test -f ../config.sh; then
2095                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
2096                         eval "`grep myuname= ../config.sh`"
2097                 fi
2098                 if test "X$myuname" = "X$newmyuname"; then
2099                         dflt=y
2100                 fi
2101         fi
2102         ;;
2103 *) dflt=y;;
2104 esac
2105
2106 : Get old answers from old config file if Configure was run on the
2107 : same system, otherwise use the hints.
2108 hint=default
2109 cd ..
2110 if test -f config.sh; then
2111         echo " "
2112         rp="I see a config.sh file.  Shall I use it to set the defaults?"
2113         . UU/myread
2114         case "$ans" in
2115         n*|N*) echo "OK, I'll ignore it."; mv config.sh config.sh.old;;
2116         *)  echo "Fetching default answers from your old config.sh file..." >&4
2117                 tmp_n="$n"
2118                 tmp_c="$c"
2119                 tmp_sh="$sh"
2120                 . ./config.sh
2121                 cp config.sh UU
2122                 n="$tmp_n"
2123                 c="$tmp_c"
2124                 : Older versions did not always set $sh.  Catch re-use of such
2125                 : an old config.sh.
2126                 case "$sh" in
2127                 '') sh="$tmp_sh" ;;
2128                 esac
2129                 hint=previous
2130                 ;;
2131         esac
2132 fi
2133 if test ! -f config.sh; then
2134         $cat <<EOM
2135
2136 First time through, eh?  I have some defaults handy for some systems
2137 that need some extra help getting the Configure answers right:
2138
2139 EOM
2140         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
2141         dflt=''
2142         : Half the following guesses are probably wrong... If you have better
2143         : tests or hints, please send them to perlbug@perl.com
2144         : The metaconfig authors would also appreciate a copy...
2145         $test -f /irix && osname=irix
2146         $test -f /xenix && osname=sco_xenix
2147         $test -f /dynix && osname=dynix
2148         $test -f /dnix && osname=dnix
2149         $test -f /lynx.os && osname=lynxos
2150         $test -f /unicos && osname=unicos && osvers=`$uname -r`
2151         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
2152         $test -f /bin/mips && /bin/mips && osname=mips
2153         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
2154                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
2155         $test -d /usr/apollo/bin && osname=apollo
2156         $test -f /etc/saf/_sactab && osname=svr4
2157         $test -d /usr/include/minix && osname=minix
2158         if $test -d /MachTen -o -d /MachTen_Folder; then
2159                 osname=machten
2160                 if $test -x /sbin/version; then
2161                         osvers=`/sbin/version | $awk '{print $2}' |
2162                         $sed -e 's/[A-Za-z]$//'`
2163                 elif $test -x /usr/etc/version; then
2164                         osvers=`/usr/etc/version | $awk '{print $2}' |
2165                         $sed -e 's/[A-Za-z]$//'`
2166                 else
2167                         osvers="$2.$3"
2168                 fi
2169         fi
2170        $test -f /sys/posix.dll &&
2171                $test -f /usr/bin/what &&
2172                set X `/usr/bin/what /sys/posix.dll` &&
2173                $test "$3" = UWIN &&
2174                osname=uwin &&
2175                osvers="$5"
2176         if $test -f $uname; then
2177                 set X $myuname
2178                 shift
2179
2180                 case "$5" in
2181                 fps*) osname=fps ;;
2182                 mips*)
2183                         case "$4" in
2184                         umips) osname=umips ;;
2185                         *) osname=mips ;;
2186                         esac;;
2187                 [23]100) osname=mips ;;
2188                 next*) osname=next ;;
2189                 i386*)
2190                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
2191                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
2192                                 osname='sco'
2193                                 osvers=$tmp
2194                         elif $test -f /etc/kconfig; then
2195                                 osname=isc
2196                                 if test "$lns" = "$ln -s"; then
2197                                         osvers=4
2198                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
2199                                         osvers=3
2200                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
2201                                         osvers=2
2202                                 fi
2203                         fi
2204                         tmp=''
2205                         ;;
2206                 pc*)
2207                         if test -n "$DJGPP"; then
2208                                 osname=dos
2209                                 osvers=djgpp
2210                         fi
2211                         ;;
2212                 esac
2213
2214                 case "$1" in
2215                 aix) osname=aix
2216                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
2217                         case "$tmp" in
2218                         'not found') osvers="$4"."$3" ;;
2219                         '<3240'|'<>3240') osvers=3.2.0 ;;
2220                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
2221                         '=3250'|'>3250') osvers=3.2.5 ;;
2222                         *) osvers=$tmp;;
2223                         esac
2224                         ;;
2225                 *dc.osx) osname=dcosx
2226                         osvers="$3"
2227                         ;;
2228                 dnix) osname=dnix
2229                         osvers="$3"
2230                         ;;
2231                 domainos) osname=apollo
2232                         osvers="$3"
2233                         ;;
2234                 dgux) osname=dgux 
2235                         osvers="$3"
2236                         ;;
2237                 dynixptx*) osname=dynixptx
2238                         osvers=`echo "$4"|sed 's/^v//'`
2239                         ;;
2240                 freebsd) osname=freebsd 
2241                         osvers="$3" ;;
2242                 genix) osname=genix ;;
2243                 hp*) osname=hpux 
2244                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
2245                         ;;
2246                 irix*) osname=irix
2247                         case "$3" in
2248                         4*) osvers=4 ;;
2249                         5*) osvers=5 ;;
2250                         *)      osvers="$3" ;;
2251                         esac
2252                         ;;
2253                 linux) osname=linux
2254                         case "$3" in
2255                         *)      osvers="$3" ;;
2256                         esac
2257                         ;;
2258                 MiNT) osname=mint
2259                         ;;
2260                 netbsd*) osname=netbsd
2261                         osvers="$3"
2262                         ;;
2263                 news-os) osvers="$3"
2264                         case "$3" in
2265                         4*) osname=newsos4 ;;
2266                         *) osname=newsos ;;
2267                         esac
2268                         ;;
2269                 bsd386) osname=bsd386
2270                         osvers=`$uname -r`
2271                         ;;
2272                 POSIX-BC | posix-bc ) osname=posix-bc
2273                         osvers="$3"
2274                         ;;
2275                 powerux | power_ux | powermax_os | powermaxos | \
2276                 powerunix | power_unix) osname=powerux
2277                         osvers="$3"
2278                         ;;
2279                 next*) osname=next ;;
2280                 solaris) osname=solaris
2281                         case "$3" in
2282                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
2283                         *)      osvers="$3" ;;
2284                         esac
2285                         ;;
2286                 sunos) osname=sunos
2287                         case "$3" in
2288                         5*) osname=solaris
2289                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
2290                         *)      osvers="$3" ;;
2291                         esac
2292                         ;;
2293                 titanos) osname=titanos
2294                         case "$3" in
2295                         1*) osvers=1 ;;
2296                         2*) osvers=2 ;;
2297                         3*) osvers=3 ;;
2298                         4*) osvers=4 ;;
2299                         *)      osvers="$3" ;;
2300                         esac
2301                         ;;
2302                 ultrix) osname=ultrix
2303                         osvers="$3"
2304                         ;;
2305                 osf1|mls+)      case "$5" in
2306                                 alpha)
2307                                         osname=dec_osf
2308                                         osvers=`echo "$3" | sed 's/^[xvt]//'`
2309                                         ;;
2310                         hp*)    osname=hp_osf1  ;;
2311                         mips)   osname=mips_osf1 ;;
2312                         esac
2313                         ;;
2314                 uts) osname=uts 
2315                         osvers="$3"
2316                         ;;
2317                 qnx) osname=qnx
2318                         osvers="$4"
2319                         ;;
2320                 $2) case "$osname" in
2321                         *isc*) ;;
2322                         *freebsd*) ;;
2323                         svr*)
2324                                 : svr4.x or possibly later
2325                                 case "svr$3" in 
2326                                 ${osname}*)
2327                                         osname=svr$3
2328                                         osvers=$4
2329                                         ;;
2330                                 esac
2331                                 case "$osname" in
2332                                 svr4.0)
2333                                         : Check for ESIX
2334                                         if test -f /stand/boot ; then
2335                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
2336                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
2337                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
2338                                                         if test -n "$isesix"; then
2339                                                                 osname=esix4
2340                                                         fi
2341                                                 fi
2342                                         fi
2343                                         ;;
2344                                 esac
2345                                 ;;
2346                         *)      if test -f /etc/systemid; then
2347                                         osname=sco
2348                                         set `echo $3 | $sed 's/\./ /g'` $4
2349                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
2350                                                 osvers=$1.$2.$3
2351                                         elif $test -f $src/hints/sco_$1_$2.sh; then
2352                                                 osvers=$1.$2
2353                                         elif $test -f $src/hints/sco_$1.sh; then
2354                                                 osvers=$1
2355                                         fi
2356                                 else
2357                                         case "$osname" in
2358                                         '') : Still unknown.  Probably a generic Sys V.
2359                                                 osname="sysv"
2360                                                 osvers="$3"
2361                                                 ;;
2362                                         esac
2363                                 fi
2364                                 ;;
2365                         esac
2366                         ;;
2367                 *)      case "$osname" in
2368                         '') : Still unknown.  Probably a generic BSD.
2369                                 osname="$1"
2370                                 osvers="$3"
2371                                 ;;
2372                         esac
2373                         ;;
2374                 esac
2375         else
2376                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
2377                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
2378                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
2379                                 osname=news_os
2380                         fi
2381                         $rm -f UU/kernel.what
2382                 elif test -d c:/.; then
2383                         set X $myuname
2384                         osname=os2
2385                         osvers="$5"
2386                 fi
2387         fi
2388         
2389         : Now look for a hint file osname_osvers, unless one has been
2390         : specified already.
2391         case "$hintfile" in
2392         ''|' ')
2393                 file=`echo "${osname}_${osvers}" | $sed -e 's@\.@_@g' -e 's@_$@@'`
2394                 : Also try without trailing minor version numbers.
2395                 xfile=`echo $file | $sed -e 's@_[^_]*$@@'`
2396                 xxfile=`echo $xfile | $sed -e 's@_[^_]*$@@'`
2397                 xxxfile=`echo $xxfile | $sed -e 's@_[^_]*$@@'`
2398                 xxxxfile=`echo $xxxfile | $sed -e 's@_[^_]*$@@'`
2399                 case "$file" in
2400                 '') dflt=none ;;
2401                 *)  case "$osvers" in
2402                         '') dflt=$file
2403                                 ;;
2404                         *)  if $test -f $src/hints/$file.sh ; then
2405                                         dflt=$file
2406                                 elif $test -f $src/hints/$xfile.sh ; then
2407                                         dflt=$xfile
2408                                 elif $test -f $src/hints/$xxfile.sh ; then
2409                                         dflt=$xxfile
2410                                 elif $test -f $src/hints/$xxxfile.sh ; then
2411                                         dflt=$xxxfile
2412                                 elif $test -f $src/hints/$xxxxfile.sh ; then
2413                                         dflt=$xxxxfile
2414                                 elif $test -f "$src/hints/${osname}.sh" ; then
2415                                         dflt="${osname}"
2416                                 else
2417                                         dflt=none
2418                                 fi
2419                                 ;;
2420                         esac
2421                         ;;
2422                 esac
2423                 if $test -f Policy.sh ; then
2424                         case "$dflt" in
2425                         *Policy*) ;;
2426                         none) dflt="Policy" ;;
2427                         *) dflt="Policy $dflt" ;;
2428                         esac
2429                 fi
2430                 ;;
2431         *)
2432                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
2433                 ;;
2434         esac
2435
2436         if $test -f Policy.sh ; then
2437                 $cat <<EOM
2438
2439 There's also a Policy hint file available, which should make the
2440 site-specific (policy) questions easier to answer.
2441 EOM
2442
2443         fi
2444
2445         $cat <<EOM
2446
2447 You may give one or more space-separated answers, or "none" if appropriate.
2448 A well-behaved OS will have no hints, so answering "none" or just "Policy"
2449 is a good thing.  DO NOT give a wrong version or a wrong OS.
2450
2451 EOM
2452
2453         rp="Which of these apply, if any?"
2454         . UU/myread
2455         tans=$ans
2456         for file in $tans; do
2457                 if $test X$file = XPolicy -a -f Policy.sh; then
2458                         . Policy.sh
2459                         $cat Policy.sh >> UU/config.sh
2460                 elif $test -f $src/hints/$file.sh; then
2461                         . $src/hints/$file.sh
2462                         $cat $src/hints/$file.sh >> UU/config.sh
2463                 elif $test X$tans = X -o X$tans = Xnone ; then
2464                         : nothing
2465                 else
2466                         : Give one chance to correct a possible typo.
2467                         echo "$file.sh does not exist"
2468                         dflt=$file
2469                         rp="hint to use instead?"
2470                         . UU/myread
2471                         for file in $ans; do
2472                                 if $test -f "$src/hints/$file.sh"; then
2473                                         . $src/hints/$file.sh
2474                                         $cat $src/hints/$file.sh >> UU/config.sh
2475                                 elif $test X$ans = X -o X$ans = Xnone ; then
2476                                         : nothing
2477                                 else
2478                                         echo "$file.sh does not exist -- ignored."
2479                                 fi
2480                         done
2481                 fi
2482         done
2483
2484         hint=recommended
2485         : Remember our hint file for later.
2486         if $test -f "$src/hints/$file.sh" ; then
2487                 hintfile="$file"
2488         else
2489                 hintfile=''
2490         fi
2491 fi
2492 cd UU
2493 ;;
2494 *)
2495         echo " "
2496         echo "Fetching default answers from $config_sh..." >&4
2497         tmp_n="$n"
2498         tmp_c="$c"
2499         cd ..
2500         cp $config_sh config.sh 2>/dev/null
2501         chmod +w config.sh
2502         . ./config.sh
2503         cd UU
2504         cp ../config.sh .
2505         n="$tmp_n"
2506         c="$tmp_c"
2507         hint=previous
2508         ;;
2509 esac
2510 test "$override" && . ./optdef.sh
2511 myuname="$newmyuname"
2512
2513 : Restore computed paths
2514 for file in $loclist $trylist; do
2515         eval $file="\$_$file"
2516 done
2517
2518 cat << EOM
2519
2520 Configure uses the operating system name and version to set some defaults.
2521 The default value is probably right if the name rings a bell. Otherwise,
2522 since spelling matters for me, either accept the default or answer "none"
2523 to leave it blank.
2524
2525 EOM
2526 case "$osname" in
2527         ''|' ')
2528                 case "$hintfile" in
2529                 ''|' '|none) dflt=none ;;
2530                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
2531                 esac
2532                 ;;
2533         *) dflt="$osname" ;;
2534 esac
2535 rp="Operating system name?"
2536 . ./myread
2537 case "$ans" in
2538 none)  osname='' ;;
2539 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
2540 esac
2541 echo " "
2542 case "$osvers" in
2543         ''|' ')
2544                 case "$hintfile" in
2545                 ''|' '|none) dflt=none ;;
2546                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
2547                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
2548                         case "$dflt" in
2549                         ''|' ') dflt=none ;;
2550                         esac
2551                         ;;
2552                 esac
2553                 ;;
2554         *) dflt="$osvers" ;;
2555 esac
2556 rp="Operating system version?"
2557 . ./myread
2558 case "$ans" in
2559 none)  osvers='' ;;
2560 *) osvers="$ans" ;;
2561 esac
2562
2563
2564 . ./posthint.sh
2565
2566 : who configured the system
2567 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
2568 cf_by=`(logname) 2>/dev/null`
2569 case "$cf_by" in
2570 "")
2571         cf_by=`(whoami) 2>/dev/null`
2572         case "$cf_by" in
2573         "") cf_by=unknown ;;
2574         esac ;;
2575 esac
2576
2577 : set up the script used to warn in case of inconsistency
2578 cat <<EOS >whoa
2579 $startsh
2580 EOS
2581 cat <<'EOSC' >>whoa
2582 dflt=y
2583 echo " "
2584 echo "*** WHOA THERE!!! ***" >&4
2585 echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
2586 rp="    Keep the $hint value?"
2587 . ./myread
2588 case "$ans" in
2589 y) td=$was; tu=$was;;
2590 esac
2591 EOSC
2592
2593 : function used to set $1 to $val
2594 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
2595 case "$val$was" in
2596 $define$undef) . ./whoa; eval "$var=\$td";;
2597 $undef$define) . ./whoa; eval "$var=\$tu";;
2598 *) eval "$var=$val";;
2599 esac'
2600
2601 cat <<EOM
2602
2603 Perl can be built to take advantage of threads, on some systems.
2604 To do so, Configure must be run with -Dusethreads.
2605
2606 Note that threading is a highly experimental feature, and
2607 some known race conditions still remain.  If you choose to try
2608 it, be very sure to not actually deploy it for production
2609 purposes.  README.threads has more details, and is required
2610 reading if you enable threads.
2611 EOM
2612 case "$usethreads" in
2613 $define|true|[yY]*)     dflt='y';;
2614 *) dflt='n';;
2615 esac
2616 rp='Build a threading Perl?'
2617 . ./myread
2618 case "$ans" in
2619 y|Y)    val="$define" ;;     
2620 *)      val="$undef" ;;
2621 esac
2622 set usethreads
2623 eval $setvar 
2624
2625 case "$d_oldpthreads" in
2626 '')     : Configure tests would be welcome here.  For now, assume undef.
2627         val="$undef" ;;
2628 *)      val="$d_oldpthreads" ;;
2629 esac
2630 set d_oldpthreads
2631 eval $setvar
2632
2633
2634 case "$usethreads" in
2635 "$define"|true|[yY]*)
2636 : Look for a hint-file generated 'call-back-unit'.  If the
2637 : user has specified that a threading perl is to be built,
2638 : we may need to set or change some other defaults.
2639         if $test -f usethreads.cbu; then
2640                 echo "Your platform has some specific hints for threaded builds, using them..."
2641                 . ./usethreads.cbu
2642         else
2643                 $cat <<EOM
2644 (Your platform doesn't have any specific hints for threaded builds.
2645  Assuming POSIX threads, then.)
2646 EOM
2647         fi
2648     ;;
2649 esac
2650
2651 cat <<EOM
2652
2653 Perl can be built so that multiple Perl interpreters can coexist
2654 within the same Perl executable.  To do so, Configure must be run with
2655 -Dusemultiplicity.
2656
2657 Normally you do not need this and you should answer no.
2658
2659 EOM
2660 case "$usemultiplicity" in
2661 $define|true|[yY]*)     dflt='y';;
2662 *) dflt='n';;
2663 esac
2664 rp='Build Perl for multiplicity?'
2665 . ./myread
2666 case "$ans" in
2667 y|Y)    val="$define" ;;     
2668 *)      val="$undef" ;;
2669 esac
2670 set usemultiplicity
2671 eval $setvar 
2672
2673 : determine where manual pages are on this system
2674 echo " "
2675 case "$sysman" in
2676 '') 
2677         syspath='/usr/man/man1 /usr/man/mann /usr/man/manl /usr/man/local/man1'
2678         syspath="$syspath /usr/man/u_man/man1 /usr/share/man/man1"
2679         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
2680         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
2681         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
2682         sysman=`./loc . /usr/man/man1 $syspath`
2683         ;;
2684 esac
2685 if $test -d "$sysman"; then
2686         echo "System manual is in $sysman." >&4
2687 else
2688         echo "Could not find manual pages in source form." >&4
2689 fi
2690
2691 : see what memory models we can support
2692 case "$models" in
2693 '')
2694         $cat >pdp11.c <<'EOP'
2695 int main() {
2696 #ifdef pdp11
2697         exit(0);
2698 #else
2699         exit(1);
2700 #endif
2701 }
2702 EOP
2703         ( cc -o pdp11 pdp11.c ) >/dev/null 2>&1
2704         if $test -f pdp11 && ./pdp11 2>/dev/null; then
2705                 dflt='unsplit split'
2706         else
2707                 tans=`./loc . X /lib/small /lib/large /usr/lib/small /usr/lib/large /lib/medium /usr/lib/medium /lib/huge`
2708                 case "$tans" in
2709                 X) dflt='none';;
2710                 *) if $test -d /lib/small || $test -d /usr/lib/small; then
2711                                 dflt='small'
2712                         else
2713                                 dflt=''
2714                         fi
2715                         if $test -d /lib/medium || $test -d /usr/lib/medium; then
2716                                 dflt="$dflt medium"
2717                         fi
2718                         if $test -d /lib/large || $test -d /usr/lib/large; then
2719                                 dflt="$dflt large"
2720                         fi
2721                         if $test -d /lib/huge || $test -d /usr/lib/huge; then
2722                                 dflt="$dflt huge"
2723                         fi
2724                 esac
2725         fi;;
2726 *) dflt="$models";;
2727 esac
2728 $cat <<EOM
2729  
2730 Some systems have different model sizes.  On most systems they are called
2731 small, medium, large, and huge.  On the PDP11 they are called unsplit and
2732 split.  If your system doesn't support different memory models, say "none".
2733 If you wish to force everything to one memory model, say "none" here and
2734 put the appropriate flags later when it asks you for other cc and ld flags.
2735 Venix systems may wish to put "none" and let the compiler figure things out.
2736 (In the following question multiple model names should be space separated.)
2737
2738 The default for most systems is "none".
2739
2740 EOM
2741 rp="Which memory models are supported?"
2742 . ./myread
2743 models="$ans"
2744
2745 case "$models" in
2746 none)
2747         small=''
2748         medium=''
2749         large=''
2750         huge=''
2751         unsplit=''
2752         split=''
2753         ;;
2754 *split)
2755         case "$split" in
2756         '') if $contains '\-i' $sysman/ld.1 >/dev/null 2>&1 || \
2757                          $contains '\-i' $sysman/cc.1 >/dev/null 2>&1; then
2758                         dflt='-i'
2759                 else
2760                         dflt='none'
2761                 fi;;
2762         *) dflt="$split";;
2763         esac
2764         rp="What flag indicates separate I and D space?"
2765         . ./myread
2766         tans="$ans"
2767         case "$tans" in
2768         none) tans='';;
2769         esac
2770         split="$tans"
2771         unsplit='';;
2772 *large*|*small*|*medium*|*huge*)
2773         case "$models" in
2774         *large*)
2775                 case "$large" in
2776                 '') dflt='-Ml';;
2777                 *) dflt="$large";;
2778                 esac
2779         rp="What flag indicates large model?"
2780         . ./myread
2781         tans="$ans"
2782         case "$tans" in
2783         none) tans='';
2784         esac
2785         large="$tans";;
2786         *) large='';;
2787         esac
2788         case "$models" in
2789         *huge*) case "$huge" in
2790                 '') dflt='-Mh';;
2791                 *) dflt="$huge";;
2792                 esac
2793                 rp="What flag indicates huge model?"
2794                 . ./myread
2795                 tans="$ans"
2796                 case "$tans" in
2797                 none) tans='';
2798                 esac
2799                 huge="$tans";;
2800         *) huge="$large";;
2801         esac
2802         case "$models" in
2803         *medium*) case "$medium" in
2804                 '') dflt='-Mm';;
2805                 *) dflt="$medium";;
2806                 esac
2807                 rp="What flag indicates medium model?"
2808                 . ./myread
2809                 tans="$ans"
2810                 case "$tans" in
2811                 none) tans='';
2812                 esac
2813                 medium="$tans";;
2814         *) medium="$large";;
2815         esac
2816         case "$models" in
2817         *small*) case "$small" in
2818                 '') dflt='none';;
2819                 *) dflt="$small";;
2820                 esac
2821                 rp="What flag indicates small model?"
2822                 . ./myread
2823                 tans="$ans"
2824                 case "$tans" in
2825                 none) tans='';
2826                 esac
2827                 small="$tans";;
2828         *) small='';;
2829         esac
2830         ;;
2831 *)
2832         echo "Unrecognized memory models--you may have to edit Makefile.SH" >&4
2833         ;;
2834 esac
2835 $rm -f pdp11.* pdp11
2836
2837 : make some quick guesses about what we are up against
2838 echo " "
2839 $echo $n "Hmm...  $c"
2840 echo exit 1 >bsd
2841 echo exit 1 >usg
2842 echo exit 1 >v7
2843 echo exit 1 >osf1
2844 echo exit 1 >eunice
2845 echo exit 1 >xenix
2846 echo exit 1 >venix
2847 echo exit 1 >os2
2848 d_bsd="$undef"
2849 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
2850 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
2851 then
2852         echo "Looks kind of like an OSF/1 system, but we'll see..."
2853         echo exit 0 >osf1
2854 elif test `echo abc | tr a-z A-Z` = Abc ; then
2855         xxx=`./loc addbib blurfl $pth`
2856         if $test -f $xxx; then
2857         echo "Looks kind of like a USG system with BSD features, but we'll see..."
2858                 echo exit 0 >bsd
2859                 echo exit 0 >usg
2860         else
2861                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
2862                         echo "Looks kind of like an extended USG system, but we'll see..."
2863                 else
2864                         echo "Looks kind of like a USG system, but we'll see..."
2865                 fi
2866                 echo exit 0 >usg
2867         fi
2868 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
2869         echo "Looks kind of like a BSD system, but we'll see..."
2870         d_bsd="$define"
2871         echo exit 0 >bsd
2872 else
2873         echo "Looks kind of like a Version 7 system, but we'll see..."
2874         echo exit 0 >v7
2875 fi
2876 case "$eunicefix" in
2877 *unixtovms*)
2878         $cat <<'EOI'
2879 There is, however, a strange, musty smell in the air that reminds me of
2880 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
2881 EOI
2882         echo exit 0 >eunice
2883         d_eunice="$define"
2884 : it so happens the Eunice I know will not run shell scripts in Unix format
2885         ;;
2886 *)
2887         echo " "
2888         echo "Congratulations.  You aren't running Eunice."
2889         d_eunice="$undef"
2890         ;;
2891 esac
2892 : Detect OS2.  The p_ variable is set above in the Head.U unit.
2893 case "$p_" in
2894 :) ;;
2895 *)
2896         $cat <<'EOI'
2897 I have the feeling something is not exactly right, however...don't tell me...
2898 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
2899 EOI
2900         echo exit 0 >os2
2901         ;;
2902 esac
2903 if test -f /xenix; then
2904         echo "Actually, this looks more like a XENIX system..."
2905         echo exit 0 >xenix
2906         d_xenix="$define"
2907 else
2908         echo " "
2909         echo "It's not Xenix..."
2910         d_xenix="$undef"
2911 fi
2912 chmod +x xenix
2913 $eunicefix xenix
2914 if test -f /venix; then
2915         echo "Actually, this looks more like a VENIX system..."
2916         echo exit 0 >venix
2917 else
2918         echo " "
2919         if ./xenix; then
2920                 : null
2921         else
2922                 echo "Nor is it Venix..."
2923         fi
2924 fi
2925 chmod +x bsd usg v7 osf1 eunice xenix venix os2
2926 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
2927 $rm -f foo
2928
2929 : see if we need a special compiler
2930 echo " "
2931 if ./usg; then
2932         case "$cc" in
2933         '') case "$Mcc" in
2934                 /*) dflt='Mcc';;
2935                 *) case "$large" in
2936                         -M*) dflt='cc';;
2937                         *)      if $contains '\-M' $sysman/cc.1 >/dev/null 2>&1 ; then
2938                                         if $contains '\-M' $sysman/cpp.1 >/dev/null 2>&1; then
2939                                                 dflt='cc'
2940                                         else
2941                                                 dflt='cc -M'
2942                                         fi
2943                                 else
2944                                         dflt='cc'
2945                                 fi;;
2946                         esac;;
2947                 esac;;
2948         *)  dflt="$cc";;
2949         esac
2950         case "$dflt" in
2951         *M*)    $cat <<'EOM'
2952 On some older systems the default C compiler will not resolve multiple global
2953 references that happen to have the same name.  On some such systems the "Mcc"
2954 command may be used to force these to be resolved.  On other systems a "cc -M"
2955 command is required.  (Note that the -M flag on other systems indicates a
2956 memory model to use!) If you have the Gnu C compiler, you might wish to use
2957 that instead.
2958
2959 EOM
2960         ;;
2961         esac
2962         rp="Use which C compiler?"
2963         . ./myread
2964         cc="$ans"
2965 else
2966         case "$cc" in
2967         '') dflt=cc;;
2968         *) dflt="$cc";;
2969         esac
2970         rp="Use which C compiler?"
2971         . ./myread
2972         cc="$ans"
2973 fi
2974 : Look for a hint-file generated 'call-back-unit'.  Now that the
2975 : user has specified the compiler, we may need to set or change some
2976 : other defaults.
2977 if $test -f cc.cbu; then
2978     . ./cc.cbu
2979 fi
2980 echo " "
2981 echo "Checking for GNU cc in disguise and/or its version number..." >&4
2982 $cat >gccvers.c <<EOM
2983 #include <stdio.h>
2984 int main() {
2985 #ifdef __GNUC__
2986 #ifdef __VERSION__
2987         printf("%s\n", __VERSION__);
2988 #else
2989         printf("%s\n", "1");
2990 #endif
2991 #endif
2992         exit(0);
2993 }
2994 EOM
2995 if $cc -o gccvers gccvers.c; then
2996         gccversion=`./gccvers`
2997         case "$gccversion" in
2998         '') echo "You are not using GNU cc." ;;
2999         *)  echo "You are using GNU cc $gccversion." ;;
3000         esac
3001 else
3002         echo " "
3003         echo "*** WHOA THERE!!! ***" >&4
3004         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
3005         case "$knowitall" in
3006         '')
3007         echo "    You'd better start hunting for one and let me know about it." >&4
3008                 exit 1
3009                 ;;
3010         esac
3011 fi
3012 $rm -f gccvers*
3013 case "$gccversion" in
3014 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
3015 esac
3016
3017 cat <<EOM
3018
3019 Perl can be built to take advantage of explicit 64-bit interfaces,
3020 on some systems.  To do so, Configure must be run with -Duse64bits.
3021
3022 If this doesn't make any sense to you, just accept the default 'n'.
3023 EOM
3024 case "$use64bits" in
3025 $define|true|[yY]*)     dflt='y';;
3026 *) dflt='n';;
3027 esac
3028 rp='Try to use explicit 64-bit interfaces, if available?'
3029 . ./myread
3030 case "$ans" in
3031 y|Y) 
3032         val="$define"
3033         ;;     
3034 *)      
3035         val="$undef"
3036         ;;
3037 esac
3038 set use64bits
3039 eval $setvar
3040
3041 case "$archname64" in
3042 '') archname64='' ;;    # not a typo
3043 esac
3044
3045 case "$use64bits" in
3046 "$define"|true|[yY]*)
3047 : Look for a hint-file generated 'call-back-unit'.  If the
3048 : user has specified that a 64 bit perl is to be built,
3049 : we may need to set or change some other defaults.
3050         if $test -f use64bits.cbu; then
3051                 echo "Your platform has some specific hints for 64-bit builds, using them..."
3052                 . ./use64bits.cbu
3053         else
3054                 $cat <<EOM
3055 (Your platform doesn't have any specific hints for 64-bit builds.
3056  This is probably okay, especially if your system is a true 64-bit system.)
3057 EOM
3058                 case "$gccversion" in
3059                 '')     ;;
3060                 *)      $cat <<EOM
3061 But since you seem to be using gcc,
3062 I will now add -DUSE_LONG_LONG to the compilation flags.
3063 EOM
3064                         ccflags="$ccflags -DUSE_LONG_LONG"
3065                         ;;
3066                 esac
3067         fi
3068         ;;
3069 esac
3070
3071 : determine the architecture name
3072 echo " "
3073 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
3074         tarch=`arch`"-$osname"
3075 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
3076         if uname -m > tmparch 2>&1 ; then
3077                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
3078                         -e 's/$/'"-$osname/" tmparch`
3079         else
3080                 tarch="$osname"
3081         fi
3082         $rm -f tmparch
3083 else
3084         tarch="$osname"
3085 fi
3086 case "$myarchname" in
3087 ''|"$tarch") ;;
3088 *)
3089         echo "(Your architecture name used to be $myarchname.)"
3090         archname=''
3091         ;;
3092 esac
3093 myarchname="$tarch"
3094 case "$archname" in
3095 '') dflt="$tarch";;
3096 *) dflt="$archname";;
3097 esac
3098 rp='What is your architecture name'
3099 . ./myread
3100 archname="$ans"
3101 case "$usethreads" in
3102 $define)
3103         echo "Threads selected." >&4
3104         case "$archname" in
3105         *-thread*) echo "...and architecture name already has -thread." >&4
3106                 ;;
3107         *)      archname="$archname-thread"
3108                 echo "...setting architecture name to $archname." >&4
3109                 ;;
3110         esac
3111         ;;
3112 esac
3113 case "$usemultiplicity" in
3114 $define)
3115         echo "Multiplicity selected." >&4
3116         case "$archname" in
3117         *-multi*) echo "...and architecture name already has -multi." >&4
3118                 ;;
3119         *)      archname="$archname-multi"
3120                 echo "...setting architecture name to $archname." >&4
3121                 ;;
3122         esac
3123         ;;
3124 esac
3125 case "$use64bits" in
3126 $define)
3127         echo "Explicit 64-bitness selected." >&4
3128         case "$archname64" in
3129         '')
3130                 ;;
3131         *)
3132                 case "$archname" in
3133                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
3134                         ;;
3135                 *)      archname="$archname-$archname64"
3136                         echo "...setting architecture name to $archname." >&4
3137                         ;;
3138                 esac
3139                 ;;
3140         esac
3141 esac
3142
3143 : decide how portable to be.  Allow command line overrides.
3144 case "$d_portable" in
3145 "$undef") ;;
3146 *)      d_portable="$define" ;;
3147 esac
3148
3149 : set up shell script to do ~ expansion
3150 cat >filexp <<EOSS
3151 $startsh
3152 : expand filename
3153 case "\$1" in
3154  ~/*|~)
3155         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3156         ;;
3157  ~*)
3158         if $test -f /bin/csh; then
3159                 /bin/csh -f -c "glob \$1"
3160                 failed=\$?
3161                 echo ""
3162                 exit \$failed
3163         else
3164                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3165                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3166                 if $test ! -d "\$dir"; then
3167                         me=\`basename \$0\`
3168                         echo "\$me: can't locate home directory for: \$name" >&2
3169                         exit 1
3170                 fi
3171                 case "\$1" in
3172                 */*)
3173                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3174                         ;;
3175                 *)
3176                         echo \$dir
3177                         ;;
3178                 esac
3179         fi
3180         ;;
3181 *)
3182         echo \$1
3183         ;;
3184 esac
3185 EOSS
3186 chmod +x filexp
3187 $eunicefix filexp
3188
3189 : now set up to get a file name
3190 cat <<EOS >getfile
3191 $startsh
3192 EOS
3193 cat <<'EOSC' >>getfile
3194 tilde=''
3195 fullpath=''
3196 already=''
3197 skip=''
3198 none_ok=''
3199 exp_file=''
3200 nopath_ok=''
3201 orig_rp="$rp"
3202 orig_dflt="$dflt"
3203 case "$gfpth" in
3204 '') gfpth='.' ;;
3205 esac
3206
3207 case "$fn" in
3208 *\(*)
3209         expr $fn : '.*(\(.*\)).*' | tr ',' $trnl >getfile.ok
3210         fn=`echo $fn | sed 's/(.*)//'`
3211         ;;
3212 esac
3213
3214 case "$fn" in
3215 *:*)
3216         loc_file=`expr $fn : '.*:\(.*\)'`
3217         fn=`expr $fn : '\(.*\):.*'`
3218         ;;
3219 esac
3220
3221 case "$fn" in
3222 *~*) tilde=true;;
3223 esac
3224 case "$fn" in
3225 */*) fullpath=true;;
3226 esac
3227 case "$fn" in
3228 *+*) skip=true;;
3229 esac
3230 case "$fn" in
3231 *n*) none_ok=true;;
3232 esac
3233 case "$fn" in
3234 *e*) exp_file=true;;
3235 esac
3236 case "$fn" in
3237 *p*) nopath_ok=true;;
3238 esac
3239
3240 case "$fn" in
3241 *f*) type='File';;
3242 *d*) type='Directory';;
3243 *l*) type='Locate';;
3244 esac
3245
3246 what="$type"
3247 case "$what" in
3248 Locate) what='File';;
3249 esac
3250
3251 case "$exp_file" in
3252 '')
3253         case "$d_portable" in
3254         "$define") ;;
3255         *) exp_file=true;;
3256         esac
3257         ;;
3258 esac
3259
3260 cd ..
3261 while test "$type"; do
3262         redo=''
3263         rp="$orig_rp"
3264         dflt="$orig_dflt"
3265         case "$tilde" in
3266         true) rp="$rp (~name ok)";;
3267         esac
3268         . UU/myread
3269         if test -f UU/getfile.ok && \
3270                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3271         then
3272                 value="$ans"
3273                 ansexp="$ans"
3274                 break
3275         fi
3276         case "$ans" in
3277         none)
3278                 value=''
3279                 ansexp=''
3280                 case "$none_ok" in
3281                 true) type='';;
3282                 esac
3283                 ;;
3284         *)
3285                 case "$tilde" in
3286                 '') value="$ans"
3287                         ansexp="$ans";;
3288                 *)
3289                         value=`UU/filexp $ans`
3290                         case $? in
3291                         0)
3292                                 if test "$ans" != "$value"; then
3293                                         echo "(That expands to $value on this system.)"
3294                                 fi
3295                                 ;;
3296                         *) value="$ans";;
3297                         esac
3298                         ansexp="$value"
3299                         case "$exp_file" in
3300                         '') value="$ans";;
3301                         esac
3302                         ;;
3303                 esac
3304                 case "$fullpath" in
3305                 true)
3306                         case "$ansexp" in
3307                         /*) value="$ansexp" ;;
3308                         *)
3309                                 redo=true
3310                                 case "$already" in
3311                                 true)
3312                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
3313                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
3314                                         ;;
3315                                 *)
3316                                 echo "Please give a full path name, starting with slash." >&4
3317                                         case "$tilde" in
3318                                         true)
3319                                 echo "Note that using ~name is ok provided it expands well." >&4
3320                                                 already=true
3321                                                 ;;
3322                                         esac
3323                                 esac
3324                                 ;;
3325                         esac
3326                         ;;
3327                 esac
3328                 case "$redo" in
3329                 '')
3330                         case "$type" in
3331                         File)
3332                                 for fp in $gfpth; do
3333                                         if test "X$fp" = X.; then
3334                                             pf="$ansexp"
3335                                         else    
3336                                             pf="$fp/$ansexp"
3337                                         fi
3338                                         if test -f "$pf"; then
3339                                                 type=''
3340                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3341                                         then
3342                                                 echo "($value is not a plain file, but that's ok.)"
3343                                                 type=''
3344                                         fi
3345                                         if test X"$type" = X; then
3346                                             value="$pf"
3347                                             break
3348                                         fi
3349                                 done
3350                                 ;;
3351                         Directory)
3352                                 for fp in $gfpth; do
3353                                         if test "X$fp" = X.; then
3354                                             pf="$ansexp"
3355                                         else    
3356                                             pf="$fp/$ansexp"
3357                                         fi
3358                                         if test -d "$pf"; then
3359                                                 type=''
3360                                                 value="$pf"
3361                                                 break
3362                                         fi
3363                                 done
3364                                 ;;
3365                         Locate)
3366                                 if test -d "$ansexp"; then
3367                                         echo "(Looking for $loc_file in directory $value.)"
3368                                         value="$value/$loc_file"
3369                                         ansexp="$ansexp/$loc_file"
3370                                 fi
3371                                 if test -f "$ansexp"; then
3372                                         type=''
3373                                 fi
3374                                 case "$nopath_ok" in
3375                                 true)   case "$value" in
3376                                         */*) ;;
3377                                         *)      echo "Assuming $value will be in people's path."
3378                                                 type=''
3379                                                 ;;
3380                                         esac
3381                                         ;;
3382                                 esac
3383                                 ;;
3384                         esac
3385
3386                         case "$skip" in
3387                         true) type='';
3388                         esac
3389
3390                         case "$type" in
3391                         '') ;;
3392                         *)
3393                                 if test "$fastread" = yes; then
3394                                         dflt=y
3395                                 else
3396                                         dflt=n
3397                                 fi
3398                                 rp="$what $value doesn't exist.  Use that name anyway?"
3399                                 . UU/myread
3400                                 dflt=''
3401                                 case "$ans" in
3402                                 y*) type='';;
3403                                 *) echo " ";;
3404                                 esac
3405                                 ;;
3406                         esac
3407                         ;;
3408                 esac
3409                 ;;
3410         esac
3411 done
3412 cd UU
3413 ans="$value"
3414 rp="$orig_rp"
3415 dflt="$orig_dflt"
3416 rm -f getfile.ok
3417 test "X$gfpthkeep" != Xy && gfpth=""
3418 EOSC
3419
3420 : determine root of directory hierarchy where package will be installed.
3421 case "$prefix" in
3422 '')
3423         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
3424         ;;
3425 *)
3426         dflt="$prefix"
3427         ;;
3428 esac
3429 $cat <<EOM
3430
3431 By default, $package will be installed in $dflt/bin, manual pages
3432 under $dflt/man, etc..., i.e. with $dflt as prefix for all
3433 installation directories. Typically this is something like /usr/local.
3434 If you wish to have binaries under /usr/bin but other parts of the
3435 installation under /usr/local, that's ok: you will be prompted
3436 separately for each of the installation directories, the prefix being
3437 only used to set the defaults.
3438
3439 EOM
3440 fn=d~
3441 rp='Installation prefix to use?'
3442 . ./getfile
3443 oldprefix=''
3444 case "$prefix" in
3445 '') ;;
3446 *)
3447         case "$ans" in
3448         "$prefix") ;;
3449         *) oldprefix="$prefix";;
3450         esac
3451         ;;
3452 esac
3453 prefix="$ans"
3454 prefixexp="$ansexp"
3455
3456 : is AFS running?
3457 echo " "
3458 case "$afs" in
3459 $define|true)   afs=true ;;
3460 $undef|false)   afs=false ;;
3461 *)      if test -d /afs; then
3462                 afs=true
3463         else
3464                 afs=false
3465         fi
3466         ;;
3467 esac
3468 if $afs; then
3469         echo "AFS may be running... I'll be extra cautious then..." >&4
3470 else
3471         echo "AFS does not seem to be running..." >&4
3472 fi
3473
3474 : determine installation prefix for where package is to be installed.
3475 if $afs; then 
3476 $cat <<EOM
3477
3478 Since you are running AFS, I need to distinguish the directory in which
3479 files will reside from the directory in which they are installed (and from
3480 which they are presumably copied to the former directory by occult means).
3481
3482 EOM
3483         case "$installprefix" in
3484         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
3485         *) dflt="$installprefix";;
3486         esac
3487 else
3488 $cat <<EOM
3489
3490 In some special cases, particularly when building $package for distribution,
3491 it is convenient to distinguish between the directory in which files should 
3492 be installed from the directory ($prefix) in which they 
3493 will eventually reside.  For most users, these two directories are the same.
3494
3495 EOM
3496         case "$installprefix" in
3497         '') dflt=$prefix ;;
3498         *) dflt=$installprefix;;
3499         esac
3500 fi
3501 fn=d~
3502 rp='What installation prefix should I use for installing files?'
3503 . ./getfile
3504 installprefix="$ans"
3505 installprefixexp="$ansexp"
3506
3507 : set the prefixit variable, to compute a suitable default value
3508 prefixit='case "$3" in
3509 ""|none)
3510         case "$oldprefix" in
3511         "") eval "$1=\"\$$2\"";;
3512         *)
3513                 case "$3" in
3514                 "") eval "$1=";;
3515                 none)
3516                         eval "tp=\"\$$2\"";
3517                         case "$tp" in
3518                         ""|" ") eval "$1=\"\$$2\"";;
3519                         *) eval "$1=";;
3520                         esac;;
3521                 esac;;
3522         esac;;
3523 *)
3524         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
3525         case "$tp" in
3526         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
3527         /*-$oldprefix/*|\~*-$oldprefix/*)
3528                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
3529         *) eval "$1=\"\$$2\"";;
3530         esac;;
3531 esac'
3532
3533 : set the base revision
3534 baserev=5.0
3535
3536 : get the patchlevel
3537 echo " "
3538 echo "Getting the current patchlevel..." >&4
3539 if $test -r $rsrc/patchlevel.h;then
3540         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
3541         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
3542 else
3543         patchlevel=0
3544         subversion=0
3545 fi
3546 $echo $n "(You have $package" $c
3547 case "$package" in
3548 "*$baserev")    ;;
3549 *)              $echo $n " $baserev" $c ;;
3550 esac
3551 $echo $n " patchlevel $patchlevel" $c
3552 test 0 -eq "$subversion" || $echo $n " subversion $subversion" $c
3553 echo ".)"
3554
3555 if test 0 -eq "$subversion"; then
3556         version=`LC_ALL=C; export LC_ALL; \
3557                  echo $baserev $patchlevel | \
3558                  $awk '{ printf "%.3f\n", $1 + $2/1000.0 }'`
3559 else
3560         version=`LC_ALL=C; export LC_ALL; \
3561                  echo $baserev $patchlevel $subversion | \
3562                  $awk '{ printf "%.5f\n", $1 + $2/1000.0 + $3/100000.0 }'`
3563 fi
3564 : Figure out perl API version.  Perhaps this should be in patchlevel.h
3565 if test "$subversion" -lt 50; then
3566         apiversion=`LC_ALL=C; export LC_ALL; \
3567                  LANGUAGE=C; export LANGUAGE; \
3568                  echo $baserev $patchlevel | \
3569                  $awk '{ printf "%.3f\n", $1 + $2/1000.0 }'`
3570 else
3571         apiversion="$version"
3572 fi
3573
3574 : determine installation style
3575 : For now, try to deduce it from prefix unless it is already set.
3576 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
3577 case "$installstyle" in
3578 '')     case "$prefix" in
3579                 *perl*) dflt='lib';;
3580                 *) dflt='lib/perl5' ;;
3581         esac
3582         ;;
3583 *)      dflt='lib/perl5' ;;
3584 esac
3585 : Probably not worth prompting for this since we prompt for all
3586 : the directories individually, and the prompt would be too long and
3587 : confusing anyway.
3588 installstyle=$dflt
3589
3590 : determine where private library files go
3591 : Usual default is /usr/local/lib/perl5/$version.
3592 : Also allow things like /opt/perl/lib/$version, since 
3593 : /opt/perl/lib/perl5... would be redundant.
3594 : The default "style" setting is made in installstyle.U
3595 case "$installstyle" in
3596 *lib/perl5*) set dflt privlib lib/$package/$version ;;
3597 *)       set dflt privlib lib/$version ;;
3598 esac
3599 eval $prefixit
3600 $cat <<EOM
3601
3602 There are some auxiliary files for $package that need to be put into a
3603 private library directory that is accessible by everyone.
3604
3605 EOM
3606 fn=d~+
3607 rp='Pathname where the private library files will reside?'
3608 . ./getfile
3609 privlib="$ans"
3610 privlibexp="$ansexp"
3611 : Change installation prefix, if necessary.
3612 if $test X"$prefix" != X"$installprefix"; then
3613         installprivlib=`echo $privlibexp | sed "s#^$prefix#$installprefix#"`
3614 else
3615         installprivlib="$privlibexp"
3616 fi
3617
3618 : set the prefixup variable, to restore leading tilda escape
3619 prefixup='case "$prefixexp" in
3620 "$prefix") ;;
3621 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
3622 esac'
3623
3624 : determine where public architecture dependent libraries go
3625 set archlib archlib
3626 eval $prefixit
3627 : privlib default is /usr/local/lib/$package/$version
3628 : archlib default is /usr/local/lib/$package/$version/$archname
3629 : privlib may have an optional trailing /share.
3630 tdflt=`echo $privlib | $sed 's,/share$,,'`
3631 tdflt=$tdflt/$archname
3632 case "$archlib" in
3633 '')     dflt=$tdflt
3634         ;;
3635 *)      dflt="$archlib"
3636     ;;
3637 esac
3638 $cat <<EOM
3639
3640 $spackage contains architecture-dependent library files.  If you are
3641 sharing libraries in a heterogeneous environment, you might store
3642 these files in a separate location.  Otherwise, you can just include
3643 them with the rest of the public library files.
3644
3645 EOM
3646 fn=d+~
3647 rp='Where do you want to put the public architecture-dependent libraries?'
3648 . ./getfile
3649 archlib="$ans"
3650 archlibexp="$ansexp"
3651 if $test X"$archlib" = X"$privlib"; then
3652         d_archlib="$undef"
3653 else
3654         d_archlib="$define"
3655 fi
3656 : Change installation prefix, if necessary.
3657 if $test X"$prefix" != X"$installprefix"; then
3658         installarchlib=`echo $archlibexp | sed "s#^$prefix#$installprefix#"`
3659 else
3660         installarchlib="$archlibexp"
3661 fi
3662
3663
3664 : Binary compatibility with 5.005 is not possible for builds
3665 : with advanced features
3666 case "$usethreads$usemultiplicity" in
3667 *define*)
3668         bincompat5005="$undef"
3669         d_bincompat5005="$undef"
3670         ;;
3671 *)      $cat <<EOM
3672
3673 Perl 5.006 can be compiled for binary compatibility with 5.005.
3674 If you decide to do so, you will be able to continue using most
3675 of the extensions that were compiled for Perl 5.005.
3676
3677 EOM
3678         case "$bincompat5005$d_bincompat5005" in
3679         *"$undef"*) dflt=n ;;
3680         *) dflt=y ;;
3681         esac
3682         rp='Binary compatibility with Perl 5.005?'
3683         . ./myread
3684         case "$ans" in
3685         y*) val="$define" ;;
3686         *)  val="$undef" ;;
3687         esac
3688         set d_bincompat5005
3689         eval $setvar
3690         case "$d_bincompat5005" in
3691         "$define")
3692                 bincompat5005="$define"
3693                 ;;
3694         *)      bincompat5005="$undef"
3695                 d_bincompat5005="$undef"
3696                 ;;
3697         esac
3698         ;;
3699 esac
3700
3701
3702 : see if setuid scripts can be secure
3703 $cat <<EOM
3704
3705 Some kernels have a bug that prevents setuid #! scripts from being
3706 secure.  Some sites have disabled setuid #! scripts because of this.
3707
3708 First let's decide if your kernel supports secure setuid #! scripts.
3709 (If setuid #! scripts would be secure but have been disabled anyway,
3710 don't say that they are secure if asked.)
3711
3712 EOM
3713
3714 val="$undef"
3715 if $test -d /dev/fd; then
3716         echo "#!$ls" >reflect
3717         chmod +x,u+s reflect
3718         ./reflect >flect 2>&1
3719         if $contains "/dev/fd" flect >/dev/null; then
3720                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
3721                 val="$define"
3722         else
3723                 $cat <<EOM
3724 If you are not sure if they are secure, I can check but I'll need a
3725 username and password different from the one you are using right now.
3726 If you don't have such a username or don't want me to test, simply
3727 enter 'none'.
3728
3729 EOM
3730                 rp='Other username to test security of setuid scripts with?'
3731                 dflt='none'
3732                 . ./myread
3733                 case "$ans" in
3734                 n|none)
3735                         case "$d_suidsafe" in
3736                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
3737                                 dflt=n;;
3738                         "$undef")
3739                                 echo "Well, the $hint value is *not* secure." >&4
3740                                 dflt=n;;
3741                         *)      echo "Well, the $hint value *is* secure." >&4
3742                                 dflt=y;;
3743                         esac
3744                         ;;
3745                 *)
3746                         $rm -f reflect flect
3747                         echo "#!$ls" >reflect
3748                         chmod +x,u+s reflect
3749                         echo >flect
3750                         chmod a+w flect
3751                         echo '"su" will (probably) prompt you for '"$ans's password."
3752                         su $ans -c './reflect >flect'
3753                         if $contains "/dev/fd" flect >/dev/null; then
3754                                 echo "Okay, it looks like setuid scripts are secure." >&4
3755                                 dflt=y
3756                         else
3757                                 echo "I don't think setuid scripts are secure." >&4
3758                                 dflt=n
3759                         fi
3760                         ;;
3761                 esac
3762                 rp='Does your kernel have *secure* setuid scripts?'
3763                 . ./myread
3764                 case "$ans" in
3765                 [yY]*)  val="$define";;
3766                 *)      val="$undef";;
3767                 esac
3768         fi
3769 else
3770         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
3771         echo "(That's for file descriptors, not floppy disks.)"
3772         val="$undef"
3773 fi
3774 set d_suidsafe
3775 eval $setvar
3776
3777 $rm -f reflect flect
3778
3779 : now see if they want to do setuid emulation
3780 echo " "
3781 val="$undef"
3782 case "$d_suidsafe" in
3783 "$define")
3784         val="$undef"
3785         echo "No need to emulate SUID scripts since they are secure here." >& 4
3786         ;;
3787 *)
3788         $cat <<EOM
3789 Some systems have disabled setuid scripts, especially systems where
3790 setuid scripts cannot be secure.  On systems where setuid scripts have
3791 been disabled, the setuid/setgid bits on scripts are currently
3792 useless.  It is possible for $package to detect those bits and emulate
3793 setuid/setgid in a secure fashion.  This emulation will only work if
3794 setuid scripts have been disabled in your kernel.
3795
3796 EOM
3797         case "$d_dosuid" in
3798         "$define") dflt=y ;;
3799         *) dflt=n ;;
3800         esac
3801         rp="Do you want to do setuid/setgid emulation?"
3802         . ./myread
3803         case "$ans" in
3804         [yY]*)  val="$define";;
3805         *)      val="$undef";;
3806         esac
3807         ;;
3808 esac
3809 set d_dosuid
3810 eval $setvar
3811
3812 : What should the include directory be ?
3813 echo " "
3814 $echo $n "Hmm...  $c"
3815 dflt='/usr/include'
3816 incpath=''
3817 mips_type=''
3818 if $test -f /bin/mips && /bin/mips; then
3819         echo "Looks like a MIPS system..."
3820         $cat >usr.c <<'EOCP'
3821 #ifdef SYSTYPE_BSD43
3822 /bsd43
3823 #endif
3824 EOCP
3825         if $cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
3826                 dflt='/bsd43/usr/include'
3827                 incpath='/bsd43'
3828                 mips_type='BSD 4.3'
3829         else
3830                 mips_type='System V'
3831         fi
3832         $rm -f usr.c usr.out
3833         echo "and you're compiling with the $mips_type compiler and libraries."
3834         xxx_prompt=y
3835         echo "exit 0" >mips
3836 else
3837         echo "Doesn't look like a MIPS system."
3838         xxx_prompt=n
3839         echo "exit 1" >mips
3840 fi
3841 chmod +x mips
3842 $eunicefix mips
3843 case "$usrinc" in
3844 '') ;;
3845 *) dflt="$usrinc";;
3846 esac
3847 case "$xxx_prompt" in
3848 y)      fn=d/
3849         echo " "
3850         rp='Where are the include files you want to use?'
3851         . ./getfile
3852         usrinc="$ans"
3853         ;;
3854 *)      usrinc="$dflt"
3855         ;;
3856 esac
3857
3858 : see how we invoke the C preprocessor
3859 echo " "
3860 echo "Now, how can we feed standard input to your C preprocessor..." >&4
3861 cat <<'EOT' >testcpp.c
3862 #define ABC abc
3863 #define XYZ xyz
3864 ABC.XYZ
3865 EOT
3866 cd ..
3867 if test ! -f cppstdin; then
3868         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
3869                 # AIX cc -E doesn't show the absolute headerfile
3870                 # locations but we'll cheat by using the -M flag.
3871                 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
3872         else
3873                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
3874         fi
3875 else
3876         echo "Keeping your $hint cppstdin wrapper."
3877 fi
3878 chmod 755 cppstdin
3879 wrapper=`pwd`/cppstdin
3880 ok='false'
3881 cd UU
3882
3883 if $test "X$cppstdin" != "X" && \
3884         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
3885         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3886 then
3887         echo "You used to use $cppstdin $cppminus so we'll use that again."
3888         case "$cpprun" in
3889         '') echo "But let's see if we can live without a wrapper..." ;;
3890         *)
3891                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
3892                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3893                 then
3894                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
3895                         ok='true'
3896                 else
3897                         echo "(However, $cpprun $cpplast does not work, let's see...)"
3898                 fi
3899                 ;;
3900         esac
3901 else
3902         case "$cppstdin" in
3903         '') ;;
3904         *)
3905                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
3906                 ;;
3907         esac
3908 fi
3909
3910 if $ok; then
3911         : nothing
3912 elif echo 'Maybe "'"$cc"' -E" will work...'; \
3913         $cc -E <testcpp.c >testcpp.out 2>&1; \
3914         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3915         echo "Yup, it does."
3916         x_cpp="$cc -E"
3917         x_minus='';
3918 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
3919         $cc -E - <testcpp.c >testcpp.out 2>&1; \
3920         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3921         echo "Yup, it does."
3922         x_cpp="$cc -E"
3923         x_minus='-';
3924 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
3925         $cc -P <testcpp.c >testcpp.out 2>&1; \
3926         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3927         echo "Yipee, that works!"
3928         x_cpp="$cc -P"
3929         x_minus='';
3930 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
3931         $cc -P - <testcpp.c >testcpp.out 2>&1; \
3932         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3933         echo "At long last!"
3934         x_cpp="$cc -P"
3935         x_minus='-';
3936 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
3937         $cpp <testcpp.c >testcpp.out 2>&1; \
3938         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3939         echo "It works!"
3940         x_cpp="$cpp"
3941         x_minus='';
3942 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
3943         $cpp - <testcpp.c >testcpp.out 2>&1; \
3944         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3945         echo "Hooray, it works!  I was beginning to wonder."
3946         x_cpp="$cpp"
3947         x_minus='-';
3948 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
3949         $wrapper <testcpp.c >testcpp.out 2>&1; \
3950         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3951         x_cpp="$wrapper"
3952         x_minus=''
3953         echo "Eureka!"
3954 else
3955         dflt=''
3956         rp="No dice.  I can't find a C preprocessor.  Name one:"
3957         . ./myread
3958         x_cpp="$ans"
3959         x_minus=''
3960         $x_cpp <testcpp.c >testcpp.out 2>&1
3961         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3962                 echo "OK, that will do." >&4
3963         else
3964 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
3965                 exit 1
3966         fi
3967 fi
3968
3969 case "$ok" in
3970 false)
3971         cppstdin="$x_cpp"
3972         cppminus="$x_minus"
3973         cpprun="$x_cpp"
3974         cpplast="$x_minus"
3975         set X $x_cpp
3976         shift
3977         case "$1" in
3978         "$cpp")
3979                 echo "Perhaps can we force $cc -E using a wrapper..."
3980                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
3981                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3982                 then
3983                         echo "Yup, we can."
3984                         cppstdin="$wrapper"
3985                         cppminus='';
3986                 else
3987                         echo "Nope, we'll have to live without it..."
3988                 fi
3989                 ;;
3990         esac
3991         case "$cpprun" in
3992         "$wrapper")
3993                 cpprun=''
3994                 cpplast=''
3995                 ;;
3996         esac
3997         ;;
3998 esac
3999
4000 case "$cppstdin" in
4001 "$wrapper"|'cppstdin') ;;
4002 *) $rm -f $wrapper;;
4003 esac
4004 $rm -f testcpp.c testcpp.out
4005
4006 : Set private lib path
4007 case "$plibpth" in
4008 '') if ./mips; then
4009                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
4010         fi;;
4011 esac
4012 case "$libpth" in
4013 ' ') dlist='';;
4014 '') dlist="$loclibpth $plibpth $glibpth";;
4015 *) dlist="$libpth";;
4016 esac
4017
4018 : Now check and see which directories actually exist, avoiding duplicates
4019 libpth=''
4020 for xxx in $dlist
4021 do
4022     if $test -d $xxx; then
4023                 case " $libpth " in
4024                 *" $xxx "*) ;;
4025                 *) libpth="$libpth $xxx";;
4026                 esac
4027     fi
4028 done
4029 $cat <<'EOM'
4030
4031 Some systems have incompatible or broken versions of libraries.  Among
4032 the directories listed in the question below, please remove any you
4033 know not to be holding relevant libraries, and add any that are needed.
4034 Say "none" for none.
4035
4036 EOM
4037 case "$libpth" in
4038 '') dflt='none';;
4039 *)
4040         set X $libpth
4041         shift
4042         dflt=${1+"$@"}
4043         ;;
4044 esac
4045 rp="Directories to use for library searches?"
4046 . ./myread
4047 case "$ans" in
4048 none) libpth=' ';;
4049 *) libpth="$ans";;
4050 esac
4051
4052 : compute shared library extension
4053 case "$so" in
4054 '')
4055         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
4056                 dflt='sl'
4057         else
4058                 dflt='so'
4059         fi
4060         ;;
4061 *) dflt="$so";;
4062 esac
4063 $cat <<EOM
4064
4065 On some systems, shared libraries may be available.  Answer 'none' if
4066 you want to suppress searching of shared libraries for the remaining
4067 of this configuration.
4068
4069 EOM
4070 rp='What is the file extension used for shared libraries?'
4071 . ./myread
4072 so="$ans"
4073
4074 : Define several unixisms.
4075 : Hints files or command line option can be used to override them.
4076 : The convoluted testing is in case hints files set either the old
4077 : or the new name.
4078 case "$_exe" in
4079 '')     case "$exe_ext" in
4080     '') ;;
4081         *)      _exe="$exe_ext" ;;
4082         esac
4083         ;;
4084 esac
4085 case "$_a" in
4086 '')     case "$lib_ext" in
4087     '') _a='.a';;
4088         *)      _a="$lib_ext" ;;
4089         esac
4090         ;;
4091 esac
4092 case "$_o" in
4093 '') case "$obj_ext" in
4094         '')     _o='.o';;
4095         *)      _o="$obj_ext";;
4096         esac
4097         ;;
4098 esac
4099 case "$p_" in
4100 '') case "$path_sep" in
4101         '')     p_=':';;
4102         *)      p_="$path_sep";;
4103         esac
4104         ;;
4105 esac
4106 exe_ext=$_exe
4107 lib_ext=$_a
4108 obj_ext=$_o
4109 path_sep=$p_
4110
4111 : Which makefile gets called first.  This is used by make depend.
4112 case "$firstmakefile" in
4113 '') firstmakefile='makefile';;
4114 esac
4115
4116 cat <<EOM
4117
4118 Perl can be built to use the SOCKS proxy protocol library.  To do so,
4119 Configure must be run with -Dusesocks.
4120
4121 Normally you do not need this and you should answer no.
4122
4123 EOM
4124 case "$usesocks" in
4125 $define|true|[yY]*)     dflt='y';;
4126 *) dflt='n';;
4127 esac
4128 rp='Build Perl for SOCKS?'
4129 . ./myread
4130 case "$ans" in
4131 y|Y)    val="$define" ;;     
4132 *)      val="$undef" ;;
4133 esac
4134 set usesocks
4135 eval $setvar
4136
4137 : Looking for optional libraries
4138 echo " "
4139 echo "Checking for optional libraries..." >&4
4140 case "$libs" in
4141 ' '|'') dflt='';;
4142 *) dflt="$libs";;
4143 esac
4144 case "$libswanted" in
4145 '') libswanted='c_s';;
4146 esac
4147 case "$usesocks" in
4148 $define)
4149         libswanted="$libswanted socks5 socks5_sh"
4150         ;;
4151 esac
4152 for thislib in $libswanted; do
4153         
4154         if xxx=`./loc lib$thislib.$so.[0-9]'*' X $libpth`;
4155                 $test -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
4156                 echo "Found -l$thislib (shared)."
4157                 case " $dflt " in
4158                 *"-l$thislib "*);;
4159                 *) dflt="$dflt -l$thislib";;
4160                 esac
4161         elif xxx=`./loc lib$thislib.$so X $libpth` ; $test -f "$xxx"; then
4162                 echo "Found -l$thislib (shared)."
4163                 case " $dflt " in
4164                 *"-l$thislib "*);;
4165                 *) dflt="$dflt -l$thislib";;
4166                 esac
4167         elif xxx=`./loc lib$thislib$_a X $libpth`; $test -f "$xxx"; then
4168                 echo "Found -l$thislib."
4169                 case " $dflt " in
4170                 *"-l$thislib "*);;
4171                 *) dflt="$dflt -l$thislib";;
4172                 esac
4173         elif xxx=`./loc $thislib$_a X $libpth`; $test -f "$xxx"; then
4174                 echo "Found -l$thislib."
4175                 case " $dflt " in
4176                 *"-l$thislib "*);;
4177                 *) dflt="$dflt -l$thislib";;
4178                 esac
4179         elif xxx=`./loc lib${thislib}_s$_a X $libpth`; $test -f "$xxx"; then
4180                 echo "Found -l${thislib}_s."
4181                 case " $dflt " in
4182                 *"-l$thislib "*);;
4183                 *) dflt="$dflt -l${thislib}_s";;
4184                 esac
4185         elif xxx=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$xxx"; then
4186                 echo "Found -l$thislib."
4187                 case " $dflt " in
4188                 *"-l$thislib "*);;
4189                 *) dflt="$dflt -l$thislib";;
4190                 esac
4191         else
4192                 echo "No -l$thislib."
4193         fi
4194 done
4195 set X $dflt
4196 shift
4197 dflt="$*"
4198 case "$libs" in
4199 '') dflt="$dflt";;
4200 *) dflt="$libs";;
4201 esac
4202 case "$dflt" in
4203 ' '|'') dflt='none';;
4204 esac
4205
4206 $cat <<EOM
4207
4208 In order to compile $package on your machine, a number of libraries
4209 are usually needed.  Include any other special libraries here as well.
4210 Say "none" for none.  The default list is almost always right.
4211 EOM
4212
4213 echo " "
4214 rp="What libraries to use?"
4215 . ./myread
4216 case "$ans" in
4217 none) libs=' ';;
4218 *) libs="$ans";;
4219 esac
4220
4221 : determine optimization, if desired, or use for debug flag also
4222 case "$optimize" in
4223 ' '|$undef) dflt='none';;
4224 '') dflt='-O';;
4225 *) dflt="$optimize";;
4226 esac
4227 $cat <<EOH
4228
4229 By default, $package compiles with the -O flag to use the optimizer.
4230 Alternately, you might want to use the symbolic debugger, which uses
4231 the -g flag (on traditional Unix systems).  Either flag can be
4232 specified here.  To use neither flag, specify the word "none".
4233
4234 EOH
4235 rp="What optimizer/debugger flag should be used?"
4236 . ./myread
4237 optimize="$ans"
4238 case "$optimize" in
4239 'none') optimize=" ";;
4240 esac
4241
4242 dflt=''
4243 : We will not override a previous value, but we might want to
4244 : augment a hint file
4245 case "$hint" in
4246 default|recommended)
4247         case "$gccversion" in
4248         1*) dflt='-fpcc-struct-return' ;;
4249         esac
4250         case "$optimize" in
4251         *-g*) dflt="$dflt -DDEBUGGING";;
4252         esac
4253         case "$gccversion" in
4254         2*) if test -d /etc/conf/kconfig.d &&
4255                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
4256                 then
4257                         dflt="$dflt -posix"
4258                 fi
4259                 ;;
4260         esac
4261         case "$gccversion" in
4262         1*) ;;
4263         2.[0-8]*) ;;
4264         *)      echo " "
4265                 echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
4266                 echo 'int main(void) { return 0; }' > gcctest.c
4267                 if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
4268                         echo "Yes, it does." 2>&1
4269                         case "$ccflags" in
4270                         *strict-aliasing*) 
4271                                 echo "Leaving current flags $ccflags alone." 2>&1
4272                                 ;;
4273                         *) dflt="$dflt -fno-strict-aliasing" ;;
4274                         esac
4275                 else
4276                         echo "Nope, it doesn't, but that's ok." 2>&1
4277                 fi
4278                 ;;
4279         esac
4280         ;;
4281 esac
4282
4283 case "$mips_type" in
4284 *BSD*|'') inclwanted="$locincpth $usrinc";;
4285 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
4286 esac
4287 for thisincl in $inclwanted; do
4288         if $test -d $thisincl; then
4289                 if $test x$thisincl != x$usrinc; then
4290                         case "$dflt" in
4291                         *$thisincl*);;
4292                         *) dflt="$dflt -I$thisincl";;
4293                         esac
4294                 fi
4295         fi
4296 done
4297
4298 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
4299         xxx=true;
4300 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
4301         xxx=true;
4302 else
4303         xxx=false;
4304 fi;
4305 if $xxx; then
4306         case "$dflt" in
4307         *$2*);;
4308         *) dflt="$dflt -D$2";;
4309         esac;
4310 fi'
4311
4312 set signal.h LANGUAGE_C; eval $inctest
4313
4314 case "$usesocks" in
4315 $define)
4316         ccflags="$ccflags -DSOCKS"
4317         ;;
4318 esac
4319
4320 case "$hint" in
4321 default|recommended) dflt="$ccflags $dflt" ;;
4322 *) dflt="$ccflags";;
4323 esac
4324
4325 case "$dflt" in
4326 ''|' ') dflt=none;;
4327 esac
4328 $cat <<EOH
4329
4330 Your C compiler may want other flags.  For this question you should include
4331 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
4332 but you should NOT include libraries or ld flags like -lwhatever.  If you
4333 want $package to honor its debug switch, you should include -DDEBUGGING here.
4334 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
4335
4336 To use no flags, specify the word "none".
4337
4338 EOH
4339 set X $dflt
4340 shift
4341 dflt=${1+"$@"}
4342 rp="Any additional cc flags?"
4343 . ./myread
4344 case "$ans" in
4345 none) ccflags='';;
4346 *) ccflags="$ans";;
4347 esac
4348
4349 : the following weeds options from ccflags that are of no interest to cpp
4350 cppflags="$ccflags"
4351 case "$gccversion" in
4352 1*) cppflags="$cppflags -D__GNUC__"
4353 esac
4354 case "$mips_type" in
4355 '');;
4356 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
4357 esac
4358 case "$cppflags" in
4359 '');;
4360 *)
4361         echo " "
4362         echo "Let me guess what the preprocessor flags are..." >&4
4363         set X $cppflags
4364         shift
4365         cppflags=''
4366         $cat >cpp.c <<'EOM'
4367 #define BLURFL foo
4368
4369 BLURFL xx LFRULB
4370 EOM
4371         previous=''
4372         for flag in $*
4373         do
4374                 case "$flag" in
4375                 -*) ftry="$flag";;
4376                 *) ftry="$previous $flag";;
4377                 esac
4378                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
4379                         >cpp1.out 2>/dev/null && \
4380                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
4381                         >cpp2.out 2>/dev/null && \
4382                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
4383                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
4384                 then
4385                         cppflags="$cppflags $ftry"
4386                         previous=''
4387                 else
4388                         previous="$flag"
4389                 fi
4390         done
4391         set X $cppflags
4392         shift
4393         cppflags=${1+"$@"}
4394         case "$cppflags" in
4395         *-*)  echo "They appear to be: $cppflags";;
4396         esac
4397         $rm -f cpp.c cpp?.out
4398         ;;
4399 esac
4400
4401 : flags used in final linking phase
4402 case "$ldflags" in
4403 '') if ./venix; then
4404                 dflt='-i -z'
4405         else
4406                 dflt=''
4407         fi
4408         case "$ccflags" in
4409         *-posix*) dflt="$dflt -posix" ;;
4410         esac
4411         ;;
4412 *) dflt="$ldflags";;
4413 esac
4414
4415 : Try to guess additional flags to pick up local libraries.
4416 for thislibdir in $libpth; do
4417         case " $loclibpth " in
4418         *" $thislibdir "*)
4419                 case "$dflt " in 
4420                 *"-L$thislibdir "*) ;;
4421                 *)  dflt="$dflt -L$thislibdir" ;;
4422                 esac
4423                 ;;
4424         esac
4425 done
4426
4427 case "$dflt" in
4428 '') dflt='none' ;;
4429 esac
4430
4431 $cat <<EOH
4432
4433 Your C linker may need flags.  For this question you should
4434 include -L/whatever and any other flags used by the C linker, but you
4435 should NOT include libraries like -lwhatever.
4436
4437 Make sure you include the appropriate -L/path flags if your C linker
4438 does not normally search all of the directories you specified above,
4439 namely
4440         $libpth
4441 To use no flags, specify the word "none".
4442
4443 EOH
4444
4445 rp="Any additional ld flags (NOT including libraries)?"
4446 . ./myread
4447 case "$ans" in
4448 none) ldflags='';;
4449 *) ldflags="$ans";;
4450 esac
4451 rmlist="$rmlist pdp11"
4452
4453 : coherency check
4454 echo " "
4455 echo "Checking your choice of C compiler and flags for coherency..." >&4
4456 $cat > try.c <<'EOF'
4457 #include <stdio.h>
4458 int main() { printf("Ok\n"); exit(0); }
4459 EOF
4460 set X $cc $optimize $ccflags -o try $ldflags try.c $libs
4461 shift
4462 $cat >try.msg <<'EOM'
4463 I've tried to compile and run the following simple program:
4464
4465 EOM
4466 $cat try.c >> try.msg
4467
4468 $cat >> try.msg <<EOM
4469
4470 I used the command:
4471
4472         $*
4473         ./try
4474
4475 and I got the following output:
4476
4477 EOM
4478 dflt=y
4479 if sh -c "$cc $optimize $ccflags -o try $ldflags try.c $libs" >>try.msg 2>&1; then
4480         if sh -c './try' >>try.msg 2>&1; then
4481                 xxx=`./try`
4482                 case "$xxx" in
4483                 "Ok") dflt=n ;;
4484                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
4485                         case " $libs " in
4486                         *" -lsfio "*)
4487                                 cat >> try.msg <<'EOQS'
4488 If $libs contains -lsfio, and sfio is mis-configured, then it
4489 sometimes (apparently) runs and exits with a 0 status, but with no
4490 output!  It may have to do with sfio's use of _exit vs. exit.
4491
4492 EOQS
4493                                 rp="You have a big problem.  Shall I abort Configure"
4494                                 dflt=y
4495                                 ;;
4496                         esac
4497                         ;;
4498                 esac
4499         else
4500                 echo "The program compiled OK, but exited with status $?." >>try.msg
4501                 rp="You have a problem.  Shall I abort Configure"
4502                 dflt=y
4503         fi
4504 else
4505         echo "I can't compile the test program." >>try.msg
4506         rp="You have a BIG problem.  Shall I abort Configure"
4507         dflt=y
4508 fi
4509 case "$dflt" in
4510 y)
4511         $cat try.msg >&4
4512         case "$knowitall" in
4513         '')
4514                 echo "(The supplied flags or libraries might be incorrect.)"
4515                 ;;
4516         *) dflt=n;;
4517         esac
4518         echo " "
4519         . ./myread
4520         case "$ans" in
4521         n*|N*) ;;
4522         *)      echo "Ok.  Stopping Configure." >&4
4523                 exit 1
4524                 ;;
4525         esac
4526         ;;
4527 n) echo "OK, that should do.";;
4528 esac
4529 $rm -f try try.* core
4530
4531 : determine filename position in cpp output
4532 echo " "
4533 echo "Computing filename position in cpp output for #include directives..." >&4
4534 echo '#include <stdio.h>' > foo.c
4535 $cat >fieldn <<EOF
4536 $startsh
4537 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
4538 $grep '^[       ]*#.*stdio\.h' | \
4539 while read cline; do
4540         pos=1
4541         set \$cline
4542         while $test \$# -gt 0; do
4543                 if $test -r \`echo \$1 | $tr -d '"'\`; then
4544                         echo "\$pos"
4545                         exit 0
4546                 fi
4547                 shift
4548                 pos=\`expr \$pos + 1\`
4549         done
4550 done
4551 EOF
4552 chmod +x fieldn
4553 fieldn=`./fieldn`
4554 $rm -f foo.c fieldn
4555 case $fieldn in
4556 '') pos='???';;
4557 1) pos=first;;
4558 2) pos=second;;
4559 3) pos=third;;
4560 *) pos="${fieldn}th";;
4561 esac
4562 echo "Your cpp writes the filename in the $pos field of the line."
4563
4564 : locate header file
4565 $cat >findhdr <<EOF
4566 $startsh
4567 wanted=\$1
4568 name=''
4569 for usrincdir in $usrinc
4570 do
4571         if test -f \$usrincdir/\$wanted; then
4572                 echo "\$usrincdir/\$wanted"
4573                 exit 0
4574         fi
4575 done
4576 awkprg='{ print \$$fieldn }'
4577 echo "#include <\$wanted>" > foo\$\$.c
4578 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
4579 $grep "^[       ]*#.*\$wanted" | \
4580 while read cline; do
4581         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
4582         case "\$name" in
4583         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
4584         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
4585         *) exit 2;;
4586         esac;
4587 done;
4588 #
4589 # status = 0: grep returned 0 lines, case statement not executed
4590 # status = 1: headerfile found
4591 # status = 2: while loop executed, no headerfile found
4592 #
4593 status=\$?
4594 $rm -f foo\$\$.c;
4595 if test \$status -eq 1; then
4596         exit 0;
4597 fi
4598 exit 1
4599 EOF
4600 chmod +x findhdr
4601
4602 : define an alternate in-header-list? function
4603 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
4604 cont=true; xxf="echo \"<\$1> found.\" >&4";
4605 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
4606 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
4607 esac;
4608 case $# in 4) instead=instead;; *) instead="at last";; esac;
4609 while $test "$cont"; do
4610         xxx=`./findhdr $1`
4611         var=$2; eval "was=\$$2";
4612         if $test "$xxx" && $test -r "$xxx";
4613         then eval $xxf;
4614         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
4615                 cont="";
4616         else eval $xxnf;
4617         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
4618         set $yyy; shift; shift; yyy=$@;
4619         case $# in 0) cont="";;
4620         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
4621                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
4622         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
4623                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
4624         esac;
4625 done;
4626 while $test "$yyy";
4627 do set $yyy; var=$2; eval "was=\$$2";
4628         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
4629         set $yyy; shift; shift; yyy=$@;
4630 done'
4631
4632 : see if this is a malloc.h system
4633 set malloc.h i_malloc
4634 eval $inhdr
4635
4636 : see if stdlib is available
4637 set stdlib.h i_stdlib
4638 eval $inhdr
4639
4640 : determine which malloc to compile in
4641 echo " "
4642 case "$usemymalloc" in
4643 ''|[yY]*|true|$define)  dflt='y' ;;
4644 *)      dflt='n' ;;
4645 esac
4646 rp="Do you wish to attempt to use the malloc that comes with $package?"
4647 . ./myread
4648 usemymalloc="$ans"
4649 case "$ans" in
4650 y*|true)
4651         usemymalloc='y'
4652         mallocsrc='malloc.c'
4653         mallocobj="malloc$_o"
4654         d_mymalloc="$define"
4655         case "$libs" in
4656         *-lmalloc*)
4657                 : Remove malloc from list of libraries to use
4658                 echo "Removing unneeded -lmalloc from library list" >&4
4659                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
4660                 shift
4661                 libs="$*"
4662                 echo "libs = $libs" >&4
4663                 ;;
4664         esac
4665         ;;
4666 *)
4667         usemymalloc='n'
4668         mallocsrc=''
4669         mallocobj=''
4670         d_mymalloc="$undef"
4671         ;;
4672 esac
4673
4674 : compute the return types of malloc and free
4675 echo " "
4676 $cat >malloc.c <<END
4677 #$i_malloc I_MALLOC
4678 #$i_stdlib I_STDLIB
4679 #include <stdio.h>
4680 #include <sys/types.h>
4681 #ifdef I_MALLOC
4682 #include <malloc.h>
4683 #endif
4684 #ifdef I_STDLIB
4685 #include <stdlib.h>
4686 #endif
4687 #ifdef TRY_MALLOC
4688 void *malloc();
4689 #endif
4690 #ifdef TRY_FREE
4691 void free();
4692 #endif
4693 END
4694 case "$malloctype" in
4695 '')
4696         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
4697                 malloctype='void *'
4698         else
4699                 malloctype='char *'
4700         fi
4701         ;;
4702 esac
4703 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
4704
4705 case "$freetype" in
4706 '')
4707         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
4708                 freetype='void'
4709         else
4710                 freetype='int'
4711         fi
4712         ;;
4713 esac
4714 echo "Your system uses $freetype free(), it would seem." >&4
4715 $rm -f malloc.[co]
4716 $cat <<EOM
4717
4718 The installation process will also create a directory for
4719 vendor-supplied add-ons.  Vendors who supply perl with their system
4720 may find it convenient to place all vendor-supplied files in this
4721 directory rather than in the main distribution directory.  This will
4722 ease upgrades between binary-compatible maintenance versions of perl.
4723
4724 Of course you may also use these directories in whatever way you see
4725 fit.  For example, you might use them to access modules shared over a
4726 company-wide network.
4727
4728 The default answer should be fine for most people.
4729 This causes further questions about vendor add-ons to be skipped
4730 and no vendor-specific directories will be configured for perl.
4731
4732 EOM
4733 rp='Do you want to configure vendor-specific add-on directories?'
4734 case "$usevendorprefix" in
4735 define|true|[yY]*) dflt=y ;;
4736 *) dflt=n ;;
4737 esac
4738 . ./myread
4739 case "$ans" in
4740 [yY]*)  fn=d~+
4741         rp='Installation prefix to use for vendor-supplied add-ons?'
4742         case "$vendorprefix" in
4743         '') dflt='' ;;
4744         *)  dflt=$vendorprefix ;;
4745         esac
4746         . ./getfile
4747         oldvendorprefix=''
4748         case "$vendorprefix" in
4749         '') ;;
4750         *)      case "$ans" in
4751                 "$prefix") ;;
4752                 *) oldvendorprefix="$prefix";;
4753                 esac
4754                 ;;
4755         esac
4756         usevendorprefix="$define"
4757         vendorprefix="$ans"
4758         vendorprefixexp="$ansexp"
4759         ;;
4760 *)      usevendorprefix="$undef"
4761         vendorprefix=''
4762         vendorprefixexp=''
4763         ;;
4764 esac
4765
4766 case "$vendorprefix" in
4767 '')     d_vendorlib="$undef"
4768         vendorlib=''
4769         vendorlibexp=''
4770         ;;
4771 *)      d_vendorlib="$define"
4772         : determine where vendor-supplied modules go.
4773         : Usual default is /usr/local/lib/perl5/vendor_perl
4774         prog=`echo $package | $sed 's/-*[0-9.]*$//'`
4775         case "$installstyle" in
4776         *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog ;;
4777         *)           dflt=$vendorprefix/lib/vendor_$prog ;;
4778         esac
4779         fn=d~+
4780         rp='Pathname for the vendor-supplied library files?'
4781         . ./getfile
4782         vendorlib="$ans"
4783         vendorlibexp="$ansexp"
4784         : Change installation prefix, if necessary.
4785         if $test X"$prefix" != X"$installprefix"; then
4786                 installvendorlib=`echo $vendorlibexp | $sed "s#^$prefix#$installprefix#"`
4787         else
4788                 installvendorlib="$vendorlibexp"
4789         fi
4790         ;;
4791 esac
4792
4793 : Cruising for prototypes
4794 echo " "
4795 echo "Checking out function prototypes..." >&4
4796 $cat >prototype.c <<'EOCP'
4797 int main(int argc, char *argv[]) {
4798         exit(0);}
4799 EOCP
4800 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
4801         echo "Your C compiler appears to support function prototypes."
4802         val="$define"
4803 else
4804         echo "Your C compiler doesn't seem to understand function prototypes."
4805         val="$undef"
4806 fi
4807 set prototype
4808 eval $setvar
4809 $rm -f prototype*
4810
4811 case "$prototype" in
4812 "$define") ;;
4813 *)      ansi2knr='ansi2knr'
4814         echo " "
4815         cat <<EOM >&4
4816
4817 $me:  FATAL ERROR:
4818 This version of $package can only be compiled by a compiler that 
4819 understands function prototypes.  Unfortunately, your C compiler 
4820         $cc $ccflags
4821 doesn't seem to understand them.  Sorry about that.
4822
4823 If GNU cc is available for your system, perhaps you could try that instead.  
4824
4825 Eventually, we hope to support building Perl with pre-ANSI compilers.
4826 If you would like to help in that effort, please contact <perlbug@perl.org>.
4827
4828 Aborting Configure now.
4829 EOM
4830         exit 2
4831         ;;
4832 esac
4833
4834 : determine where public executables go
4835 echo " "
4836 set dflt bin bin
4837 eval $prefixit
4838 fn=d~
4839 rp='Pathname where the public executables will reside?'
4840 . ./getfile
4841 if $test "X$ansexp" != "X$binexp"; then
4842         installbin=''
4843 fi
4844 bin="$ans"
4845 binexp="$ansexp"
4846 : Change installation prefix, if necessary.
4847 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
4848 if $test X"$prefix" != X"$installprefix"; then
4849         installbin=`echo $binexp | sed "s#^$prefix#$installprefix#"`
4850 else
4851         installbin="$binexp"
4852 fi
4853
4854 : determine whether to install perl also as /usr/bin/perl
4855
4856 echo " "
4857 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
4858         $cat <<EOM
4859 Many scripts expect to perl to be installed as /usr/bin/perl.
4860 I can install the perl you are about to compile also as /usr/bin/perl
4861 (in addition to $installbin/perl).
4862 EOM
4863         case "$installusrbinperl" in
4864         "$undef"|[nN]*) dflt='n';;
4865         *)              dflt='y';;
4866         esac
4867         rp="Do you want to install perl as /usr/bin/perl?"
4868         . ./myread
4869         case "$ans" in
4870         [yY]*)  val="$define";;
4871         *)      val="$undef" ;;
4872         esac
4873 else
4874         val="$undef"
4875 fi
4876 set installusrbinperl
4877 eval $setvar
4878
4879 : define a shorthand compile call
4880 compile='
4881 mc_file=$1;
4882 shift;
4883 $cc $optimize $ccflags $ldflags -o ${mc_file} $* ${mc_file}.c $libs > /dev/null 2>&1;'
4884 : define a shorthand compile call for compilations that should be ok.
4885 compile_ok='
4886 mc_file=$1;
4887 shift;
4888 $cc $optimize $ccflags $ldflags -o ${mc_file} $* ${mc_file}.c $libs;'
4889
4890 echo " "
4891 echo "Checking for GNU C Library..." >&4
4892 cat >gnulibc.c <<EOM
4893 #include <stdio.h>
4894 int main()
4895 {
4896 #ifdef __GLIBC__
4897     exit(0);
4898 #else
4899     exit(1);
4900 #endif
4901 }
4902 EOM
4903 set gnulibc
4904 if eval $compile_ok && ./gnulibc; then
4905         val="$define"
4906         echo "You are using the GNU C Library"
4907 else
4908         val="$undef"
4909         echo "You are not using the GNU C Library"
4910 fi
4911 $rm -f gnulibc*
4912 set d_gnulibc
4913 eval $setvar
4914
4915 : see if nm is to be used to determine whether a symbol is defined or not
4916 case "$usenm" in
4917 '')
4918         dflt=''
4919         case "$d_gnulibc" in
4920         "$define")
4921                 echo " "
4922                 echo "nm probably won't work on the GNU C Library." >&4
4923                 dflt=n
4924                 ;;
4925         esac
4926         case "$dflt" in
4927         '') 
4928                 if $test "$osname" = aix -a ! -f /lib/syscalls.exp; then
4929                         echo " "
4930                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
4931                         echo "'nm' won't be sufficient on this sytem." >&4
4932                         dflt=n
4933                 fi
4934                 ;;
4935         esac
4936         case "$dflt" in
4937         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
4938                 if $test $dflt -gt 20; then
4939                         dflt=y
4940                 else
4941                         dflt=n
4942                 fi
4943                 ;;
4944         esac
4945         ;;
4946 *)
4947         case "$usenm" in
4948         true|$define) dflt=y;;
4949         *) dflt=n;;
4950         esac
4951         ;;
4952 esac
4953 $cat <<EOM
4954
4955 I can use $nm to extract the symbols from your C libraries. This
4956 is a time consuming task which may generate huge output on the disk (up
4957 to 3 megabytes) but that should make the symbols extraction faster. The
4958 alternative is to skip the 'nm' extraction part and to compile a small
4959 test program instead to determine whether each symbol is present. If
4960 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
4961 this may be the best solution.
4962
4963 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
4964
4965 EOM
4966 rp="Shall I use $nm to extract C symbols from the libraries?"
4967 . ./myread
4968 case "$ans" in
4969 [Nn]*) usenm=false;;
4970 *) usenm=true;;
4971 esac
4972
4973 runnm=$usenm
4974 case "$reuseval" in
4975 true) runnm=false;;
4976 esac
4977
4978 : nm options which may be necessary
4979 case "$nm_opt" in
4980 '') if $test -f /mach_boot; then
4981                 nm_opt=''       # Mach
4982         elif $test -d /usr/ccs/lib; then
4983                 nm_opt='-p'     # Solaris (and SunOS?)
4984         elif $test -f /dgux; then
4985                 nm_opt='-p'     # DG-UX
4986         elif $test -f /lib64/rld; then
4987                 nm_opt='-p'     # 64-bit Irix
4988         else
4989                 nm_opt=''
4990         fi;;
4991 esac
4992
4993 : nm options which may be necessary for shared libraries but illegal
4994 : for archive libraries.  Thank you, Linux.
4995 case "$nm_so_opt" in
4996 '')     case "$myuname" in
4997         *linux*)
4998                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
4999                         nm_so_opt='--dynamic'
5000                 fi
5001                 ;;
5002         esac
5003         ;;
5004 esac
5005
5006 case "$runnm" in
5007 true)
5008 : get list of predefined functions in a handy place
5009 echo " "
5010 case "$libc" in
5011 '') libc=unknown
5012         case "$libs" in
5013         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
5014         esac
5015         ;;
5016 esac
5017 libnames='';
5018 case "$libs" in
5019 '') ;;
5020 *)  for thislib in $libs; do
5021         case "$thislib" in
5022         -lc|-lc_s)
5023                 : Handle C library specially below.
5024                 ;;
5025         -l*)
5026                 thislib=`echo $thislib | $sed -e 's/^-l//'`
5027                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
5028                         :
5029                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
5030                         :
5031                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
5032                         :
5033                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
5034                         :
5035                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
5036                         :
5037                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
5038                         :
5039                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
5040                         :
5041                 else
5042                         try=''
5043                 fi
5044                 libnames="$libnames $try"
5045                 ;;
5046         *) libnames="$libnames $thislib" ;;
5047         esac
5048         done
5049         ;;
5050 esac
5051 xxx=normal
5052 case "$libc" in
5053 unknown)
5054         set /lib/libc.$so
5055         for xxx in $libpth; do
5056                 $test -r $1 || set $xxx/libc.$so
5057                 : The messy sed command sorts on library version numbers.
5058                 $test -r $1 || \
5059                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
5060                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
5061                                 h
5062                                 s/[0-9][0-9]*/0000&/g
5063                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
5064                                 G
5065                                 s/\n/ /' | \
5066                          sort | $sed -e 's/^.* //'`
5067                 eval set \$$#
5068         done
5069         $test -r $1 || set /usr/ccs/lib/libc.$so
5070         $test -r $1 || set /lib/libsys_s$_a
5071         ;;
5072 *)
5073         set blurfl
5074         ;;
5075 esac
5076 if $test -r "$1"; then
5077         echo "Your (shared) C library seems to be in $1."
5078         libc="$1"
5079 elif $test -r /lib/libc && $test -r /lib/clib; then
5080         echo "Your C library seems to be in both /lib/clib and /lib/libc."
5081         xxx=apollo
5082         libc='/lib/clib /lib/libc'
5083         if $test -r /lib/syslib; then
5084                 echo "(Your math library is in /lib/syslib.)"
5085                 libc="$libc /lib/syslib"
5086         fi
5087 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5088         echo "Your C library seems to be in $libc, as you said before."
5089 elif $test -r $incpath/usr/lib/libc$_a; then
5090         libc=$incpath/usr/lib/libc$_a;
5091         echo "Your C library seems to be in $libc.  That's fine."
5092 elif $test -r /lib/libc$_a; then
5093         libc=/lib/libc$_a;
5094         echo "Your C library seems to be in $libc.  You're normal."
5095 else
5096         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
5097                 :
5098         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
5099                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
5100         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
5101                 :
5102         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5103                 :
5104         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5105                 :
5106         else
5107                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
5108         fi
5109         if $test -r "$tans"; then
5110                 echo "Your C library seems to be in $tans, of all places."
5111                 libc=$tans
5112         else
5113                 libc='blurfl'
5114         fi
5115 fi
5116 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5117         dflt="$libc"
5118         cat <<EOM
5119
5120 If the guess above is wrong (which it might be if you're using a strange
5121 compiler, or your machine supports multiple models), you can override it here.
5122
5123 EOM
5124 else
5125         dflt=''
5126         echo $libpth | tr ' ' $trnl | sort | uniq > libpath
5127         cat >&4 <<EOM
5128 I can't seem to find your C library.  I've looked in the following places:
5129
5130 EOM
5131         $sed 's/^/      /' libpath
5132         cat <<EOM
5133
5134 None of these seems to contain your C library. I need to get its name...
5135
5136 EOM
5137 fi
5138 fn=f
5139 rp='Where is your C library?'
5140 . ./getfile
5141 libc="$ans"
5142
5143 echo " "
5144 echo $libc $libnames | tr ' ' $trnl | sort | uniq > libnames
5145 set X `cat libnames`
5146 shift
5147 xxx=files
5148 case $# in 1) xxx=file; esac
5149 echo "Extracting names from the following $xxx for later perusal:" >&4
5150 echo " "
5151 $sed 's/^/      /' libnames >&4
5152 echo " "
5153 $echo $n "This may take a while...$c" >&4
5154
5155 for file in $*; do
5156         case $file in
5157         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
5158         *) $nm $nm_opt $file 2>/dev/null;;
5159         esac
5160 done >libc.tmp
5161
5162 $echo $n ".$c"
5163 $grep fprintf libc.tmp > libc.ptf
5164 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
5165 xrun='eval "<libc.tmp $com >libc.list"; echo "done" >&4'
5166 xxx='[ADTSIW]'
5167 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *_[_.]*//p' -e 's/^.* $xxx  *//p'";\
5168         eval $xscan;\
5169         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5170                 eval $xrun
5171 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
5172         eval $xscan;\
5173         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5174                 eval $xrun
5175 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
5176         eval $xscan;\
5177         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5178                 eval $xrun
5179 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
5180         eval $xscan;\
5181         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5182                 eval $xrun
5183 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
5184         eval $xscan;\
5185         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5186                 eval $xrun
5187 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
5188         eval $xscan;\
5189         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5190                 eval $xrun
5191 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
5192                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
5193         eval $xscan;\
5194         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5195                 eval $xrun
5196 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
5197         eval $xscan;\
5198         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5199                 eval $xrun
5200 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
5201         eval $xscan;\
5202         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5203                 eval $xrun
5204 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
5205         eval $xscan;\
5206         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5207                 eval $xrun
5208 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
5209         eval $xscan;\
5210         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5211                 eval $xrun
5212 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
5213         eval $xscan;\
5214         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5215                 eval $xrun
5216 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
5217         eval $xscan;\
5218         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5219                 eval $xrun
5220 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
5221         eval $xscan;\
5222         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5223                 eval $xrun
5224 else
5225         $nm -p $* 2>/dev/null >libc.tmp
5226         $grep fprintf libc.tmp > libc.ptf
5227         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
5228                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
5229         then
5230                 nm_opt='-p'
5231                 eval $xrun
5232         else
5233                 echo " "
5234                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
5235                 com=''
5236                 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
5237                         for thisname in $libnames $libc; do
5238                                 $ar t $thisname >>libc.tmp
5239                         done
5240                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
5241                         echo "Ok." >&4
5242                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
5243                         # Repeat libc to extract forwarders to DLL entries too
5244                         for thisname in $libnames $libc; do
5245                                 $ar tv $thisname >>libc.tmp
5246                                 # Revision 50 of EMX has bug in $ar.
5247                                 # it will not extract forwarders to DLL entries
5248                                 # Use emximp which will extract exactly them.
5249                                 emximp -o tmp.imp $thisname \
5250                                     2>/dev/null && \
5251                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
5252                                     < tmp.imp >>libc.tmp
5253                                 $rm tmp.imp
5254                         done
5255                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
5256                         echo "Ok." >&4
5257                 else
5258                         echo "$ar didn't seem to work right." >&4
5259                         echo "Maybe this is a Cray...trying bld instead..." >&4
5260                         if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
5261                         then
5262                                 for thisname in $libnames; do
5263                                         bld t $libnames | \
5264                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
5265                                         $ar t $thisname >>libc.tmp
5266                                 done
5267                                 echo "Ok." >&4
5268                         else
5269                                 echo "That didn't work either.  Giving up." >&4
5270                                 exit 1
5271                         fi
5272                 fi
5273         fi
5274 fi
5275 nm_extract="$com"
5276 if $test -f /lib/syscalls.exp; then
5277         echo " "
5278         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
5279         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*$/\1/p' /lib/syscalls.exp >>libc.list
5280 fi
5281 ;;
5282 esac
5283 $rm -f libnames libpath
5284
5285 : see if dld is available
5286 set dld.h i_dld
5287 eval $inhdr
5288
5289 : is a C symbol defined?
5290 csym='tlook=$1;
5291 case "$3" in
5292 -v) tf=libc.tmp; tc=""; tdc="";;
5293 -a) tf=libc.tmp; tc="[0]"; tdc="[]";;
5294 *) tlook="^$1\$"; tf=libc.list; tc="()"; tdc="()";;
5295 esac;
5296 tx=yes;
5297 case "$reuseval-$4" in
5298 true-) ;;
5299 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
5300 esac;
5301 case "$tx" in
5302 yes)
5303         case "$runnm" in
5304         true)
5305                 if $contains $tlook $tf >/dev/null 2>&1;
5306                 then tval=true;
5307                 else tval=false;
5308                 fi;;
5309         *)
5310                 echo "int main() { extern short $1$tdc; printf(\"%hd\", $1$tc); }" > t.c;
5311                 if $cc $optimize $ccflags $ldflags -o t t.c $libs >/dev/null 2>&1;
5312                 then tval=true;
5313                 else tval=false;
5314                 fi;
5315                 $rm -f t t.c;;
5316         esac;;
5317 *)
5318         case "$tval" in
5319         $define) tval=true;;
5320         *) tval=false;;
5321         esac;;
5322 esac;
5323 eval "$2=$tval"'
5324
5325 : define an is-in-libc? function
5326 inlibc='echo " "; td=$define; tu=$undef;
5327 sym=$1; var=$2; eval "was=\$$2";
5328 tx=yes;
5329 case "$reuseval$was" in
5330 true) ;;
5331 true*) tx=no;;
5332 esac;
5333 case "$tx" in
5334 yes)
5335         set $sym tres -f;
5336         eval $csym;
5337         case "$tres" in
5338         true)
5339                 echo "$sym() found." >&4;
5340                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
5341         *)
5342                 echo "$sym() NOT found." >&4;
5343                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
5344         esac;;
5345 *)
5346         case "$was" in
5347         $define) echo "$sym() found." >&4;;
5348         *) echo "$sym() NOT found." >&4;;
5349         esac;;
5350 esac'
5351
5352 : see if dlopen exists
5353 xxx_runnm="$runnm"
5354 runnm=false
5355 set dlopen d_dlopen
5356 eval $inlibc
5357 runnm="$xxx_runnm"
5358
5359 : determine which dynamic loading, if any, to compile in
5360 echo " "
5361 dldir="ext/DynaLoader"
5362 case "$usedl" in
5363 $define|y|true)
5364         dflt='y'
5365         usedl="$define"
5366         ;;
5367 $undef|n|false)
5368         dflt='n'
5369         usedl="$undef"
5370         ;;
5371 *) 
5372         dflt='n'
5373         case "$d_dlopen" in
5374             $define) dflt='y' ;;
5375         esac
5376         case "$i_dld" in
5377             $define) dflt='y' ;;
5378         esac
5379         : Does a dl_xxx.xs file exist for this operating system
5380         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
5381         ;;
5382 esac
5383 rp="Do you wish to use dynamic loading?"
5384 . ./myread
5385 usedl="$ans"
5386 case "$ans" in
5387 y*) usedl="$define"
5388         case "$dlsrc" in
5389         '')
5390                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
5391                         dflt="$dldir/dl_${osname}.xs"
5392                 elif $test "$d_dlopen" = "$define" ; then
5393                         dflt="$dldir/dl_dlopen.xs"
5394                 elif $test "$i_dld" = "$define" ; then
5395                         dflt="$dldir/dl_dld.xs"
5396                 else
5397                         dflt=''
5398                 fi
5399                 ;;
5400         *)      dflt="$dldir/$dlsrc"
5401                 ;;
5402         esac
5403     echo "The following dynamic loading files are available:"
5404         : Can not go over to $dldir because getfile has path hard-coded in.
5405         tdir=`pwd`; cd $rsrc; $ls -C $dldir/dl*.xs; cd $tdir
5406         rp="Source file to use for dynamic loading"
5407         fn="fne"
5408         gfpth="$src"
5409         . ./getfile
5410         usedl="$define"
5411         : emulate basename
5412         dlsrc=`echo $ans | $sed -e 's@.*/\([^/]*\)$@\1@'`
5413
5414         $cat << EOM
5415
5416 Some systems may require passing special flags to $cc -c to
5417 compile modules that will be used to create a shared library.
5418 To use no flags, say "none".
5419
5420 EOM
5421     case "$cccdlflags" in
5422     '') case "$gccversion" in
5423                 '') case "$osname" in
5424                         hpux)   dflt='+z' ;;
5425                         next)   dflt='none' ;;
5426                         irix*)  dflt='-KPIC' ;;
5427                         svr4*|esix*|solaris) dflt='-KPIC' ;;
5428                         sunos)  dflt='-pic' ;;
5429                         *)      dflt='none' ;;
5430                     esac
5431                         ;;
5432                 *)  case "$osname" in
5433                         svr4*|esix*|solaris) dflt='-fPIC' ;;
5434                         *)      dflt='-fpic' ;;
5435                     esac ;;
5436             esac ;;
5437         ' ') dflt='none' ;;
5438     *)  dflt="$cccdlflags" ;;
5439     esac
5440     rp="Any special flags to pass to $cc -c to compile shared library modules?"
5441     . ./myread
5442     case "$ans" in
5443     none) cccdlflags=' ' ;;
5444     *) cccdlflags="$ans" ;;
5445     esac
5446
5447     cat << EOM
5448
5449 Some systems use ld to create libraries that can be dynamically loaded,
5450 while other systems (such as those using ELF) use $cc.
5451
5452 EOM
5453         case "$ld" in
5454         '')     $cat >try.c <<'EOM'
5455 /* Test for whether ELF binaries are produced */
5456 #include <fcntl.h>
5457 #include <stdlib.h>
5458 int main() {
5459         char b[4];
5460         int i = open("a.out",O_RDONLY);
5461         if(i == -1) 
5462                 exit(1); /* fail */
5463         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
5464                 exit(0); /* succeed (yes, it's ELF) */
5465         else
5466                 exit(1); /* fail */
5467 }
5468 EOM
5469                 if $cc $ccflags try.c >/dev/null 2>&1 && ./a.out; then
5470                         cat <<EOM
5471 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
5472 EOM
5473                         dflt="$cc"
5474                 else
5475                         echo "I'll use ld to build dynamic libraries."
5476                         dflt='ld'
5477                 fi
5478                 rm -f try.c a.out
5479                 ;;
5480         *)      dflt="$ld"
5481                 ;;
5482         esac
5483
5484     rp="What command should be used to create dynamic libraries?"
5485     . ./myread
5486         ld="$ans"
5487
5488     cat << EOM
5489
5490 Some systems may require passing special flags to $ld to create a
5491 library that can be dynamically loaded.  If your ld flags include
5492 -L/other/path options to locate libraries outside your loader's normal
5493 search path, you may need to specify those -L options here as well.  To
5494 use no flags, say "none".
5495
5496 EOM
5497     case "$lddlflags" in
5498     '') case "$osname" in
5499                         beos) dflt='-nostart' ;;
5500                         hpux)  dflt='-b' ;;
5501                         linux|irix*)    dflt='-shared' ;;
5502                         next)  dflt='none' ;;
5503                         solaris) dflt='-G' ;;
5504                         sunos) dflt='-assert nodefinitions' ;;
5505                         svr4*|esix*) dflt="-G $ldflags" ;;
5506                 *)     dflt='none' ;;
5507                         esac
5508                         ;;
5509     *) dflt="$lddlflags" ;;
5510     esac
5511
5512         : Try to guess additional flags to pick up local libraries.
5513         : Be careful not to append to a plain 'none'
5514         case "$dflt" in
5515         none) dflt='' ;;
5516         esac
5517         for thisflag in $ldflags; do
5518                 case "$thisflag" in
5519                 -L*)
5520                         case " $dflt " in
5521                         *" $thisflag "*) ;;
5522                         *) dflt="$dflt $thisflag" ;;
5523                         esac
5524                         ;;
5525                 esac
5526         done
5527
5528         case "$dflt" in
5529         ''|' ') dflt='none' ;;
5530         esac
5531
5532     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
5533     . ./myread
5534     case "$ans" in
5535     none) lddlflags=' ' ;;
5536     *) lddlflags="$ans" ;;
5537     esac
5538
5539         cat <<EOM
5540
5541 Some systems may require passing special flags to $cc to indicate that
5542 the resulting executable will use dynamic linking.  To use no flags,
5543 say "none".
5544
5545 EOM
5546     case "$ccdlflags" in
5547     '') case "$osname" in
5548                 hpux)   dflt='-Wl,-E' ;;
5549                 linux)  dflt='-rdynamic' ;;
5550                 next)   dflt='none' ;;
5551                 sunos)  dflt='none' ;;
5552                 *)      dflt='none' ;;
5553             esac ;;
5554     ' ')  dflt='none' ;;
5555     *)  dflt="$ccdlflags" ;;
5556     esac
5557     rp="Any special flags to pass to $cc to use dynamic loading?"
5558     . ./myread
5559     case "$ans" in
5560     none) ccdlflags=' ' ;;
5561     *) ccdlflags="$ans" ;;
5562     esac
5563     ;;
5564 *)  usedl="$undef"
5565         ld='ld'
5566     dlsrc='dl_none.xs'
5567     lddlflags=''
5568     ccdlflags=''
5569     ;;
5570 esac
5571
5572 also=''
5573 case "$usedl" in
5574 $undef)
5575         # No dynamic loading being used, so don't bother even to prompt.
5576         useshrplib='false'
5577         ;;
5578 *)      case "$useshrplib" in
5579         '')     case "$osname" in
5580                 svr4*|dgux|dynixptx|esix|powerux|beos)
5581                         dflt=y
5582                         also='Building a shared libperl is required for dynamic loading to work on your system.'
5583                         ;;
5584                 next*)
5585                         case "$osvers" in
5586                         4*)     dflt=y
5587                                 also='Building a shared libperl is needed for MAB support.'
5588                                 ;;
5589                         *)      dflt=n
5590                                 ;;
5591                         esac
5592                         ;;
5593                 *)      dflt=n
5594                         ;;
5595                 esac
5596                 ;;
5597         $define|true|[Yy]*)
5598                 dflt=y
5599                 ;;
5600         *)      dflt=n
5601                 ;;
5602         esac
5603         $cat << EOM
5604
5605 The perl executable is normally obtained by linking perlmain.c with
5606 libperl${_a}, any static extensions (usually just DynaLoader), and
5607 any other libraries needed on this system (such as -lm, etc.).  Since
5608 your system supports dynamic loading, it is probably possible to build
5609 a shared libperl.$so.  If you will have more than one executable linked
5610 to libperl.$so, this will significantly reduce the size of each
5611 executable, but it may have a noticeable affect on performance.  The
5612 default is probably sensible for your system.
5613 $also
5614
5615 EOM
5616         rp="Build a shared libperl.$so (y/n)"
5617         . ./myread
5618         case "$ans" in
5619         true|$define|[Yy]*)
5620                 useshrplib='true'  ;;
5621         *)      useshrplib='false' ;;
5622         esac
5623         ;;
5624 esac
5625
5626 case "$useshrplib" in
5627 true)
5628         case "$libperl" in
5629         '')
5630                 # Figure out a good name for libperl.so.  Since it gets stored in
5631                 # a version-specific architecture-dependent library, the version
5632                 # number isn't really that important, except for making cc/ld happy.
5633                 #
5634                 # A name such as libperl.so.3.1
5635                 majmin="libperl.$so.$patchlevel.$subversion"
5636                 # A name such as libperl.so.301
5637                 majonly=`echo $patchlevel $subversion |
5638                         $awk '{printf "%d%02d", $1, $2}'`
5639                 majonly=libperl.$so.$majonly
5640                 # I'd prefer to keep the os-specific stuff here to a minimum, and
5641                 # rely on figuring it out from the naming of libc.
5642                 case "${osname}${osvers}" in
5643                 next4*)
5644                         dflt=libperl.5.$so
5645                         # XXX How handle the --version stuff for MAB?
5646                         ;;
5647                 linux*)  # ld won't link with a bare -lperl otherwise.
5648                         dflt=libperl.$so
5649                         ;;
5650                 *)      # Try to guess based on whether libc has major.minor.
5651                         case "$libc" in
5652                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
5653                         *libc.$so.[0-9]*) dflt=$majonly ;;
5654                         *)      dflt=libperl.$so ;;
5655                         esac
5656                         ;;
5657                 esac
5658                 ;;
5659         *)      dflt=$libperl
5660                 ;;
5661         esac
5662         cat << EOM
5663
5664 I need to select a good name for the shared libperl.  If your system uses
5665 library names with major and minor numbers, then you might want something
5666 like $majmin.  Alternatively, if your system uses a single version
5667 number for shared libraries, then you might want to use $majonly.
5668 Or, your system might be quite happy with a simple libperl.$so.
5669
5670 Since the shared libperl will get installed into a version-specific
5671 architecture-dependent directory, the version number of the shared perl
5672 library probably isn't important, so the default should be o.k.
5673
5674 EOM
5675         rp='What name do you want to give to the shared libperl?'
5676         . ./myread
5677         libperl=$ans
5678         echo "Ok, I'll use $libperl"
5679         ;;
5680 *)
5681         libperl="libperl${_a}"
5682         ;;
5683 esac
5684
5685 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
5686 case "$shrpdir" in
5687 '') ;;
5688 *)      $cat >&4 <<EOM
5689 WARNING:  Use of the shrpdir variable for the installation location of
5690 the shared $libperl is not supported.  It was never documented and
5691 will not work in this version.  Let me (perlbug@perl.com)
5692 know of any problems this may cause.
5693
5694 EOM
5695         case "$shrpdir" in
5696         "$archlibexp/CORE")
5697                 $cat >&4 <<EOM
5698 But your current setting of $shrpdir is
5699 the default anyway, so it's harmless.
5700 EOM
5701                 ;;
5702         *)
5703                 $cat >&4 <<EOM
5704 Further, your current attempted setting of $shrpdir
5705 conflicts with the value of $archlibexp/CORE
5706 that installperl will use.
5707 EOM
5708                 ;;
5709         esac
5710         ;;
5711 esac
5712
5713 # How will the perl executable find the installed shared $libperl?
5714 # Add $xxx to ccdlflags.
5715 # If we can't figure out a command-line option, use $shrpenv to
5716 # set env LD_RUN_PATH.  The main perl makefile uses this.
5717 shrpdir=$archlibexp/CORE
5718 xxx=''
5719 tmp_shrpenv=''
5720 if "$useshrplib"; then
5721     case "$osname" in 
5722         aix)
5723                 # We'll set it in Makefile.SH...
5724                 ;;
5725         solaris|netbsd)
5726                 xxx="-R $shrpdir"
5727                 ;;
5728         freebsd)
5729                 xxx="-Wl,-R$shrpdir"
5730                 ;;
5731         linux|irix*|dec_osf)
5732                 xxx="-Wl,-rpath,$shrpdir"
5733                 ;;
5734         next)
5735                 # next doesn't like the default...
5736                 ;;
5737         beos)
5738                 # beos doesn't like the default, either.
5739                 ;;
5740         hpux*)
5741                 # hpux doesn't like the default, either.
5742                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
5743                 ;;
5744         *)
5745                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
5746                 ;;
5747         esac
5748         case "$xxx" in
5749         '') ;;
5750         *)      
5751                 # Only add $xxx if it isn't already in ccdlflags.
5752                 case " $ccdlflags " in
5753                 *" $xxx "*)     ;;
5754                 *)      ccdlflags="$ccdlflags $xxx"
5755                         cat <<EOM >&4
5756
5757 Adding $xxx to the flags
5758 passed to $ld so that the perl executable will find the 
5759 installed shared $libperl.
5760
5761 EOM
5762                         ;;
5763                 esac
5764                 ;;
5765         esac
5766 fi
5767 # Fix ccdlflags in AIX for building external extensions.
5768 # (For building Perl itself bare -bE:perl.exp is needed,
5769 #  Makefile.SH takes care of this.)
5770 case "$osname" in
5771 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
5772 esac
5773 # Respect a hint or command-line value.
5774 case "$shrpenv" in
5775 '') shrpenv="$tmp_shrpenv" ;;
5776 esac
5777 case "$ldlibpthname" in
5778 '')     ldlibpthname=LD_LIBRARY_PATH ;;
5779 none)   ldlibpthname='' ;;
5780 esac
5781
5782 : determine where manual pages go
5783 set man1dir man1dir none
5784 eval $prefixit
5785 $cat <<EOM
5786
5787 $spackage has manual pages available in source form.
5788 EOM
5789 case "$nroff" in
5790 nroff)
5791         echo "However, you don't have nroff, so they're probably useless to you."
5792         case "$man1dir" in
5793         '') man1dir="none";;
5794         esac;;
5795 esac
5796 echo "If you don't want the manual sources installed, answer 'none'."
5797 case "$man1dir" in
5798 ' ') dflt=none
5799         ;;
5800 '')
5801         lookpath="$prefixexp/man/man1 $prefixexp/man/l_man/man1"
5802         lookpath="$lookpath $prefixexp/man/p_man/man1"
5803         lookpath="$lookpath $prefixexp/man/u_man/man1"
5804         lookpath="$lookpath $prefixexp/man/man.1"
5805         case "$sysman" in
5806         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
5807         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
5808         esac
5809         set dflt
5810         eval $prefixup
5811         ;;
5812 *)  dflt="$man1dir"
5813         ;;
5814 esac
5815 echo " "
5816 fn=dn+~
5817 rp="Where do the main $spackage manual pages (source) go?"
5818 . ./getfile
5819 if $test "X$man1direxp" != "X$ansexp"; then
5820         installman1dir=''
5821 fi
5822 man1dir="$ans"
5823 man1direxp="$ansexp"
5824 case "$man1dir" in
5825 '')     man1dir=' '
5826         installman1dir='';;
5827 esac
5828
5829 : Change installation prefix, if necessary.
5830 if $test X"$prefix" != X"$installprefix"; then
5831         installman1dir=`echo $man1direxp | $sed "s#^$prefix#$installprefix#"`
5832 else
5833         installman1dir="$man1direxp"
5834 fi
5835
5836 : What suffix to use on installed man pages
5837
5838 case "$man1dir" in
5839 ' ')
5840         man1ext='0'
5841         ;;
5842 *)
5843         rp="What suffix should be used for the main $spackage man pages?"
5844         case "$man1ext" in
5845         '')     case "$man1dir" in
5846                 *1)  dflt=1 ;;
5847                 *1p) dflt=1p ;;
5848                 *1pm) dflt=1pm ;;
5849                 *l) dflt=l;;
5850                 *n) dflt=n;;
5851                 *o) dflt=o;;
5852                 *p) dflt=p;;
5853                 *C) dflt=C;;
5854                 *L) dflt=L;;
5855                 *L1) dflt=L1;;
5856                 *) dflt=1;;
5857                 esac
5858                 ;;
5859         *)      dflt="$man1ext";;
5860         esac
5861         . ./myread
5862         man1ext="$ans"
5863         ;;
5864 esac
5865
5866 : see if we can have long filenames
5867 echo " "
5868 rmlist="$rmlist /tmp/cf$$"
5869 $test -d /tmp/cf$$ || mkdir /tmp/cf$$
5870 first=123456789abcdef
5871 second=/tmp/cf$$/$first
5872 $rm -f $first $second
5873 if (echo hi >$first) 2>/dev/null; then
5874         if $test -f 123456789abcde; then
5875                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
5876                 val="$undef"
5877         else
5878                 if (echo hi >$second) 2>/dev/null; then
5879                         if $test -f /tmp/cf$$/123456789abcde; then
5880                                 $cat <<'EOM'
5881 That's peculiar... You can have filenames longer than 14 characters, but only
5882 on some of the filesystems.  Maybe you are using NFS.  Anyway, to avoid problems
5883 I shall consider your system cannot support long filenames at all.
5884 EOM
5885                                 val="$undef"
5886                         else
5887                                 echo 'You can have filenames longer than 14 characters.' >&4
5888                                 val="$define"
5889                         fi
5890                 else
5891                         $cat <<'EOM'
5892 How confusing! Some of your filesystems are sane enough to allow filenames
5893 longer than 14 characters but some others like /tmp can't even think about them.
5894 So, for now on, I shall assume your kernel does not allow them at all.
5895 EOM
5896                         val="$undef"
5897                 fi
5898         fi
5899 else
5900         $cat <<'EOM'
5901 You can't have filenames longer than 14 chars.  You can't even think about them!
5902 EOM
5903         val="$undef"
5904 fi 
5905 set d_flexfnam
5906 eval $setvar
5907 $rm -rf /tmp/cf$$ 123456789abcde*
5908
5909 : determine where library module manual pages go
5910 set man3dir man3dir none
5911 eval $prefixit
5912 $cat <<EOM
5913
5914 $spackage has manual pages for many of the library modules.
5915 EOM
5916
5917 case "$nroff" in
5918 nroff)
5919         $cat <<'EOM'
5920 However, you don't have nroff, so they're probably useless to you.
5921 EOM
5922         case "$man3dir" in
5923         '') man3dir="none";;
5924         esac;;
5925 esac
5926
5927 case "$d_flexfnam" in
5928 undef)
5929         $cat <<'EOM'
5930 However, your system can't handle the long file names like File::Basename.3. 
5931 EOM
5932         case "$man3dir" in
5933         '') man3dir="none";;
5934         esac;;
5935 esac
5936
5937 echo "If you don't want the manual sources installed, answer 'none'."
5938 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
5939 case "$man3dir" in
5940 '')     dflt=`echo $man1dir | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
5941         if $test -d "$privlib/man/man3"; then
5942                 cat <<EOM >&4
5943
5944 WARNING:  Previous versions of perl installed man3 pages into
5945 $privlib/man/man3.  This version will suggest a 
5946 new default of $dflt.  
5947 EOM
5948                 tdflt=$dflt
5949                 dflt='n'
5950                 rp='Do you wish to preserve the old behavior?(y/n)'
5951                 . ./myread
5952                 case "$ans" in
5953                 y*) dflt="$privlib/man/man3" ;;
5954                 *)  dflt=$tdflt ;;
5955                 esac
5956     fi
5957         ;;
5958 ' ') dflt=none;;
5959 *)      dflt="$man3dir" ;;
5960 esac
5961 echo " "
5962 fn=dn+~
5963 rp="Where do the $package library man pages (source) go?"
5964 . ./getfile
5965 man3dir="$ans"
5966 man3direxp="$ansexp"
5967 case "$man1dir" in
5968 '')     man3dir=' '
5969         installman3dir='';;
5970 esac
5971
5972 : Change installation prefix, if necessary.
5973 if $test X"$prefix" != X"$installprefix"; then
5974         installman3dir=`echo $man3direxp | $sed "s#^$prefix#$installprefix#"`
5975 else
5976         installman3dir="$man3direxp"
5977 fi
5978
5979 : What suffix to use on installed man pages
5980 case "$man3dir" in
5981 ' ')
5982         man3ext='0'
5983         ;;
5984 *)
5985         rp="What suffix should be used for the $package library man pages?"
5986         case "$man3ext" in
5987         '')     case "$man3dir" in
5988                 *3)  dflt=3 ;;
5989                 *3p) dflt=3p ;;
5990                 *3pm) dflt=3pm ;;
5991                 *l) dflt=l;;
5992                 *n) dflt=n;;
5993                 *o) dflt=o;;
5994                 *p) dflt=p;;
5995                 *C) dflt=C;;
5996                 *L) dflt=L;;
5997                 *L3) dflt=L3;;
5998                 *) dflt=3;;
5999                 esac
6000                 ;;
6001         *)      dflt="$man3ext";;
6002         esac
6003         . ./myread
6004         man3ext="$ans"
6005         ;;
6006 esac
6007
6008 : see if we have to deal with yellow pages, now NIS.
6009 if $test -d /usr/etc/yp || $test -d /etc/yp; then
6010         if $test -f /usr/etc/nibindd; then
6011                 echo " "
6012                 echo "I'm fairly confident you're on a NeXT."
6013                 echo " "
6014                 rp='Do you get the hosts file via NetInfo?'
6015                 dflt=y
6016                 case "$hostcat" in
6017                 nidump*) ;;
6018                 '') ;;
6019                 *) dflt=n;;
6020                 esac
6021                 . ./myread
6022                 case "$ans" in
6023                 y*) hostcat='nidump hosts .';;
6024                 *)      case "$hostcat" in
6025                         nidump*) hostcat='';;
6026                         esac
6027                         ;;
6028                 esac
6029         fi
6030         case "$hostcat" in
6031         nidump*) ;;
6032         *)
6033                 case "$hostcat" in
6034                 *ypcat*) dflt=y;;
6035                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
6036                                 dflt=y
6037                         else
6038                                 dflt=n
6039                         fi;;
6040                 *) dflt=n;;
6041                 esac
6042                 echo " "
6043                 rp='Are you getting the hosts file via yellow pages?'
6044                 . ./myread
6045                 case "$ans" in
6046                 y*) hostcat='ypcat hosts';;
6047                 *) hostcat='cat /etc/hosts';;
6048                 esac
6049                 ;;
6050         esac
6051 fi
6052 case "$hostcat" in
6053 '') hostcat='cat /etc/hosts';;
6054 esac
6055 case "$groupcat" in
6056 '') groupcat='cat /etc/group';;
6057 esac
6058 case "$passcat" in
6059 '') passcat='cat /etc/passwd';;
6060 esac
6061
6062 : now get the host name
6063 echo " "
6064 echo "Figuring out host name..." >&4
6065 case "$myhostname" in
6066 '') cont=true
6067         echo 'Maybe "hostname" will work...'
6068         if tans=`sh -c hostname 2>&1` ; then
6069                 myhostname=$tans
6070                 phostname=hostname
6071                 cont=''
6072         fi
6073         ;;
6074 *) cont='';;
6075 esac
6076 if $test "$cont"; then
6077         if ./xenix; then
6078                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
6079                 if tans=`cat /etc/systemid 2>&1` ; then
6080                         myhostname=$tans
6081                         phostname='cat /etc/systemid'
6082                         echo "Whadyaknow.  Xenix always was a bit strange..."
6083                         cont=''
6084                 fi
6085         elif $test -r /etc/systemid; then
6086                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
6087         fi
6088 fi
6089 if $test "$cont"; then
6090         echo 'No, maybe "uuname -l" will work...'
6091         if tans=`sh -c 'uuname -l' 2>&1` ; then
6092                 myhostname=$tans
6093                 phostname='uuname -l'
6094         else
6095                 echo 'Strange.  Maybe "uname -n" will work...'
6096                 if tans=`sh -c 'uname -n' 2>&1` ; then
6097                         myhostname=$tans
6098                         phostname='uname -n'
6099                 else
6100                         echo 'Oh well, maybe I can mine it out of whoami.h...'
6101                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
6102                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
6103                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
6104                         else
6105                                 case "$myhostname" in
6106                                 '') echo "Does this machine have an identity crisis or something?"
6107                                         phostname='';;
6108                                 *)
6109                                         echo "Well, you said $myhostname before..."
6110                                         phostname='echo $myhostname';;
6111                                 esac
6112                         fi
6113                 fi
6114         fi
6115 fi
6116 : you do not want to know about this
6117 set $myhostname
6118 myhostname=$1
6119
6120 : verify guess
6121 if $test "$myhostname" ; then
6122         dflt=y
6123         rp='Your host name appears to be "'$myhostname'".'" Right?"
6124         . ./myread
6125         case "$ans" in
6126         y*) ;;
6127         *) myhostname='';;
6128         esac
6129 fi
6130
6131 : bad guess or no guess
6132 while $test "X$myhostname" = X ; do
6133         dflt=''
6134         rp="Please type the (one word) name of your host:"
6135         . ./myread
6136         myhostname="$ans"
6137 done
6138
6139 : translate upper to lower if necessary
6140 case "$myhostname" in
6141 *[A-Z]*)
6142         echo "(Normalizing case in your host name)"
6143         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
6144         ;;
6145 esac
6146
6147 case "$myhostname" in
6148 *.*)
6149         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
6150         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
6151         echo "(Trimming domain name from host name--host name is now $myhostname)"
6152         ;;
6153 *) case "$mydomain" in
6154         '')
6155                 {
6156                         test "X$hostcat" = "Xypcat hosts" &&
6157                         ypmatch "$myhostname" hosts 2>/dev/null |\
6158                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
6159                         $test -s hosts
6160                 } || {
6161                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
6162                                         /[       ]$myhostname[  . ]/p" > hosts
6163                 }
6164                 tmp_re="[       . ]"
6165                 $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
6166                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
6167                 dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
6168                         hosts | $sort | $uniq | \
6169                         $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
6170                 case `$echo X$dflt` in
6171                 X*\ *)  echo "(Several hosts in /etc/hosts matched hostname)"
6172                         dflt=.
6173                         ;;
6174                 X.) echo "(You do not have fully-qualified names in /etc/hosts)"
6175                         ;;
6176                 esac
6177                 case "$dflt" in
6178                 .)
6179                         tans=`./loc resolv.conf X /etc /usr/etc`
6180                         if $test -f "$tans"; then
6181                                 echo "(Attempting domain name extraction from $tans)"
6182                                 dflt=.`$sed -n -e 's/   / /g' \
6183                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
6184                                   | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
6185                                 case "$dflt" in
6186                                 .) dflt=.`$sed -n -e 's/        / /g' \
6187                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
6188                                      | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
6189                                         ;;
6190                                 esac
6191                         fi
6192                         ;;
6193                 esac
6194                 case "$dflt" in
6195                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
6196                         dflt=.`sh -c domainname 2>/dev/null`
6197                         case "$dflt" in
6198                         '') dflt='.';;
6199                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
6200                         esac
6201                         ;;
6202                 esac
6203                 case "$dflt" in
6204                 .) echo "(Lost all hope -- silly guess then)"
6205                         dflt='.uucp'
6206                         ;;
6207                 esac
6208                 $rm -f hosts
6209                 ;;
6210         *) dflt="$mydomain";;
6211         esac;;
6212 esac
6213 echo " "
6214 rp="What is your domain name?"
6215 . ./myread
6216 tans="$ans"
6217 case "$ans" in
6218 '') ;;
6219 .*) ;;
6220 *) tans=".$tans";;
6221 esac
6222 mydomain="$tans"
6223
6224 : translate upper to lower if necessary
6225 case "$mydomain" in
6226 *[A-Z]*)
6227         echo "(Normalizing case in your domain name)"
6228         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
6229         ;;
6230 esac
6231
6232 : a little sanity check here
6233 case "$phostname" in
6234 '') ;;
6235 *)
6236         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
6237         $myhostname$mydomain|$myhostname) ;;
6238         *)
6239                 case "$phostname" in
6240                 sed*)
6241                         echo "(That doesn't agree with your whoami.h file, by the way.)"
6242                         ;;
6243                 *)
6244                         echo "(That doesn't agree with your $phostname command, by the way.)"
6245                         ;;
6246                 esac
6247         ;;
6248         esac
6249         ;;
6250 esac
6251
6252 $cat <<EOM
6253
6254 I need to get your e-mail address in Internet format if possible, i.e.
6255 something like user@host.domain. Please answer accurately since I have
6256 no easy means to double check it. The default value provided below
6257 is most probably close to the reality but may not be valid from outside
6258 your organization...
6259
6260 EOM
6261 cont=x
6262 while test "$cont"; do
6263         case "$cf_email" in
6264         '') dflt="$cf_by@$myhostname$mydomain";;
6265         *) dflt="$cf_email";;
6266         esac
6267         rp='What is your e-mail address?'
6268         . ./myread
6269         cf_email="$ans"
6270         case "$cf_email" in
6271         *@*.*) cont='' ;;
6272         *)
6273                 rp='Address does not look like an Internet one.  Use it anyway?'
6274                 case "$fastread" in
6275                 yes) dflt=y ;;
6276                 *) dflt=n ;;
6277                 esac
6278                 . ./myread
6279                 case "$ans" in
6280                 y*) cont='' ;;
6281                 *) echo " " ;;
6282                 esac
6283                 ;;
6284         esac
6285 done
6286
6287 $cat <<EOM
6288
6289 If you or somebody else will be maintaining perl at your site, please
6290 fill in the correct e-mail address here so that they may be contacted
6291 if necessary. Currently, the "perlbug" program included with perl
6292 will send mail to this address in addition to perlbug@perl.com. You may
6293 enter "none" for no administrator.
6294
6295 EOM
6296 case "$perladmin" in
6297 '') dflt="$cf_email";;
6298 *) dflt="$perladmin";;
6299 esac
6300 rp='Perl administrator e-mail address'
6301 . ./myread
6302 perladmin="$ans"
6303
6304 : figure out how to guarantee perl startup
6305 case "$startperl" in
6306 '')
6307         case "$sharpbang" in
6308         *!)
6309                 $cat <<EOH
6310
6311 I can use the #! construct to start perl on your system. This will
6312 make startup of perl scripts faster, but may cause problems if you
6313 want to share those scripts and perl is not in a standard place
6314 ($binexp/perl) on all your platforms. The alternative is to force
6315 a shell by starting the script with a single ':' character.
6316
6317 EOH
6318                 dflt="$binexp/perl"
6319                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
6320                 . ./myread
6321                 case "$ans" in
6322                 none)   startperl=": # use perl";;
6323                 *)      startperl="#!$ans"
6324                         if $test 30 -lt `echo "$ans" | wc -c`; then
6325                                 $cat >&4 <<EOM
6326
6327 WARNING:  Some systems limit the #! command to 32 characters.
6328 If you experience difficulty running Perl scripts with #!, try
6329 installing Perl in a directory with a shorter pathname.
6330
6331 EOM
6332                         fi ;;
6333                 esac
6334                 ;;
6335         *) startperl=": # use perl"
6336                 ;;
6337         esac
6338         ;;
6339 esac
6340 echo "I'll use $startperl to start perl scripts."
6341
6342 : figure best path for perl in scripts
6343 case "$perlpath" in
6344 '')
6345         perlpath="$binexp/perl"
6346         case "$startperl" in
6347         *!*) ;;
6348         *)
6349                 $cat <<EOH
6350
6351 I will use the "eval 'exec'" idiom to start Perl on your system.
6352 I can use the full path of your Perl binary for this purpose, but
6353 doing so may cause problems if you want to share those scripts and
6354 Perl is not always in a standard place ($binexp/perl).
6355
6356 EOH
6357                 dflt="$binexp/perl"
6358                 rp="What path shall I use in \"eval 'exec'\"?"
6359                 . ./myread
6360                 perlpath="$ans"
6361                 ;;
6362         esac
6363         ;;
6364 esac
6365 case "$startperl" in
6366 *!*)    ;;
6367 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
6368 esac
6369
6370 : determine where public executable scripts go
6371 set scriptdir scriptdir
6372 eval $prefixit
6373 case "$scriptdir" in
6374 '')
6375         dflt="$bin"
6376         : guess some guesses
6377         $test -d /usr/share/scripts && dflt=/usr/share/scripts
6378         $test -d /usr/share/bin     && dflt=/usr/share/bin
6379         $test -d /usr/local/script  && dflt=/usr/local/script
6380         $test -d /usr/local/scripts && dflt=/usr/local/scripts
6381         $test -d $prefixexp/script  && dflt=$prefixexp/script
6382         set dflt
6383         eval $prefixup
6384         ;;
6385 *)  dflt="$scriptdir"
6386         ;;
6387 esac
6388 $cat <<EOM
6389  
6390 Some installations have a separate directory just for executable scripts so
6391 that they can mount it across multiple architectures but keep the scripts in
6392 one spot.  You might, for example, have a subdirectory of /usr/share for this.
6393 Or you might just lump your scripts in with all your other executables.
6394  
6395 EOM
6396 fn=d~
6397 rp='Where do you keep publicly executable scripts?'
6398 . ./getfile
6399 if $test "X$ansexp" != "X$scriptdirexp"; then
6400         installscript=''
6401 fi
6402 scriptdir="$ans"
6403 scriptdirexp="$ansexp"
6404 : Change installation prefix, if necessary.
6405 if $test X"$prefix" != X"$installprefix"; then
6406         installscript=`echo $scriptdirexp | sed "s#^$prefix#$installprefix#"`
6407 else
6408         installscript="$scriptdirexp"
6409 fi
6410
6411 $cat <<EOM
6412
6413 After $package is installed, you may wish to install various
6414 add-on modules and utilities.  Typically, these add-ons will
6415 be installed under $prefix with the rest
6416 of this package.  However, you may wish to install such add-ons
6417 elsewhere under a different prefix.
6418
6419 If you do not wish to put everything under a single prefix, that's
6420 ok.  You will be prompted for the individual locations; this siteprefix
6421 is only used to suggest the defaults.
6422
6423 The default should be fine for most people.
6424
6425 EOM
6426 fn=d~+
6427 rp='Installation prefix to use for add-on modules and utilities?'
6428 : XXX Here might be another good place for an installstyle setting.
6429 case "$siteprefix" in
6430 '') dflt=$prefix ;;
6431 *)  dflt=$siteprefix ;;
6432 esac
6433 . ./getfile
6434 oldsiteprefix=''
6435 case "$siteprefix" in
6436 '') ;;
6437 *)
6438         case "$ans" in
6439         "$prefix") ;;
6440         *) oldsiteprefix="$prefix";;
6441         esac
6442         ;;
6443 esac
6444 siteprefix="$ans"
6445 siteprefixexp="$ansexp"
6446
6447 : determine where site specific libraries go.
6448 : Usual default is /usr/local/lib/perl5/site_perl
6449 : The default "style" setting is made in installstyle.U
6450 : XXX No longer works with Prefixit stuff.
6451 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6452 case "$installstyle" in
6453 *lib/perl5*) dflt=$siteprefix/lib/site_$prog ;;
6454 *)       dflt=$siteprefix/lib/site_$prog ;;
6455 esac
6456 $cat <<EOM
6457
6458 The installation process will create a directory for
6459 site-specific extensions and modules.  Most users find it convenient
6460 to place all site-specific files in this directory rather than in the
6461 main distribution directory.
6462
6463 EOM
6464 fn=d~+
6465 rp='Pathname for the site-specific library files?'
6466 . ./getfile
6467 sitelib="$ans"
6468 sitelibexp="$ansexp"
6469 : Change installation prefix, if necessary.
6470 if $test X"$prefix" != X"$installprefix"; then
6471         installsitelib=`echo $sitelibexp | sed "s#^$prefix#$installprefix#"`
6472 else
6473         installsitelib="$sitelibexp"
6474 fi
6475
6476 : determine where site specific architecture-dependent libraries go.
6477 : sitelib  default is /usr/local/lib/perl5/site_perl/
6478 : sitearch default is /usr/local/lib/perl5/site_perl/$apiversion/$archname
6479 : sitelib may have an optional trailing /share.
6480 tdflt=`echo $sitelib | $sed 's,/share$,,'`
6481 tdflt="$tdflt/$apiversion/$archname"
6482 set sitearch sitearch none
6483 eval $prefixit
6484 case "$sitearch" in
6485 '')     dflt="$tdflt" ;;
6486 *)      dflt="$sitearch" ;;
6487 esac
6488 $cat <<EOM
6489
6490 The installation process will also create a directory for
6491 architecture-dependent site-specific extensions and modules.
6492
6493 EOM
6494 fn=nd~+
6495 rp='Pathname for the site-specific architecture-dependent library files?'
6496 . ./getfile
6497 sitearch="$ans"
6498 sitearchexp="$ansexp"
6499 : Change installation prefix, if necessary.
6500 if $test X"$prefix" != X"$installprefix"; then
6501         installsitearch=`echo $sitearchexp | sed "s#^$prefix#$installprefix#"`
6502 else
6503         installsitearch="$sitearchexp"
6504 fi
6505
6506 cat <<EOM
6507
6508 Perl can be built to take advantage of long doubles which
6509 (if available) may give more accuracy and range for floating point
6510 numbers.  To do so, Configure must be run with -Duselongdouble.
6511
6512 If this doesn't make any sense to you, just accept the default 'n'.
6513 EOM
6514 case "$uselongdouble" in
6515 $define|true|[yY]*)     dflt='y';;
6516 *) dflt='n';;
6517 esac
6518 rp='Try to use long doubles if available?'
6519 . ./myread
6520 case "$ans" in
6521 y|Y)    val="$define"   ;;
6522 *)      val="$undef"    ;;
6523 esac
6524 set uselongdouble
6525 eval $setvar
6526
6527 case "$uselongdouble" in
6528 "$define"|true|[yY]*)
6529 : Look for a hint-file generated 'call-back-unit'.  If the
6530 : user has specified that long doubles should be used,
6531 : we may need to set or change some other defaults.
6532         if $test -f uselongdouble.cbu; then
6533                 echo "Your platform has some specific hints for long doubles, using them..."
6534                 . ./uselongdouble.cbu
6535         else
6536                 $cat <<EOM
6537 (Your platform doesn't have any specific hints for long doubles.)
6538 EOM
6539         fi
6540         ;;
6541 esac
6542
6543 cat <<EOM
6544
6545 Previous version of $package used the standard IO mechanisms as defined
6546 in <stdio.h>.  Versions 5.003_02 and later of perl allow alternate IO
6547 mechanisms via a "PerlIO" abstraction, but the stdio mechanism is still
6548 the default.  This abstraction layer can use AT&T's sfio (if you already
6549 have sfio installed) or regular stdio.  Using PerlIO with sfio may cause
6550 problems with some extension modules.  Using PerlIO with stdio is safe,
6551 but it is slower than plain stdio and therefore is not the default.
6552
6553 If this doesn't make any sense to you, just accept the default 'n'.
6554 EOM
6555 case "$useperlio" in
6556 $define|true|[yY]*)     dflt='y';;
6557 *) dflt='n';;
6558 esac
6559 rp='Use the experimental PerlIO abstraction layer?'
6560 . ./myread
6561 case "$ans" in
6562 y|Y) 
6563         val="$define"
6564         ;;     
6565 *)      
6566         echo "Ok, doing things the stdio way"
6567         val="$undef"
6568         ;;
6569 esac
6570 set useperlio
6571 eval $setvar 
6572
6573 : Check how to convert floats to strings.
6574 if test "X$d_Gconvert" = X; then
6575         echo " "
6576         echo "Checking for an efficient way to convert floats to strings."
6577         $cat >try.c <<'EOP'
6578 #ifdef TRY_gconvert
6579 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
6580 char *myname = "gconvert";
6581 #endif
6582 #ifdef TRY_gcvt
6583 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
6584 char *myname = "gcvt";
6585 #endif
6586 #ifdef TRY_sprintf
6587 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
6588 char *myname = "sprintf";
6589 #endif
6590
6591 #include <stdio.h>
6592
6593 int
6594 checkit(expect, got)
6595 char *expect;
6596 char *got;
6597 {
6598     if (strcmp(expect, got)) {
6599                 printf("%s oddity:  Expected %s, got %s\n",
6600                         myname, expect, got);
6601                 exit(1);
6602         }
6603 }
6604
6605 int main()
6606
6607         char buf[64]; 
6608         buf[63] = '\0';
6609
6610         /* This must be 1st test on (which?) platform */
6611         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
6612         Gconvert(0.1, 8, 0, buf);
6613         checkit("0.1", buf);
6614
6615         Gconvert(1.0, 8, 0, buf); 
6616         checkit("1", buf);
6617
6618         Gconvert(0.0, 8, 0, buf); 
6619         checkit("0", buf);
6620
6621         Gconvert(-1.0, 8, 0, buf); 
6622         checkit("-1", buf);
6623
6624         /* Some Linux gcvt's give 1.e+5 here. */
6625         Gconvert(100000.0, 8, 0, buf); 
6626         checkit("100000", buf);
6627         
6628         /* Some Linux gcvt's give -1.e+5 here. */
6629         Gconvert(-100000.0, 8, 0, buf); 
6630         checkit("-100000", buf);
6631
6632         exit(0);
6633 }
6634 EOP
6635         case "$d_Gconvert" in
6636         gconvert*) xxx_list='gconvert gcvt sprintf' ;;
6637         gcvt*) xxx_list='gcvt gconvert sprintf' ;;
6638         sprintf*) xxx_list='sprintf gconvert gcvt' ;;
6639         *) xxx_list='gconvert gcvt sprintf' ;;
6640         esac
6641
6642         for xxx_convert in $xxx_list; do
6643                 echo "Trying $xxx_convert"
6644                 $rm -f try try$_o
6645                 set try -DTRY_$xxx_convert
6646                 if eval $compile; then
6647                         echo "$xxx_convert" found. >&4
6648                         if ./try; then
6649                                 echo "I'll use $xxx_convert to convert floats into a string." >&4
6650                                 break;
6651                         else
6652                                 echo "...But $xxx_convert didn't work as I expected."
6653                         fi
6654                 else
6655                         echo "$xxx_convert NOT found." >&4
6656                 fi
6657         done
6658                 
6659         case "$xxx_convert" in
6660         gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
6661         gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
6662         *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
6663         esac
6664 fi
6665
6666 : see if inttypes.h is available
6667 : we want a real compile instead of Inhdr because some systems
6668 : have an inttypes.h which includes non-existent headers
6669 echo " "
6670 $cat >try.c <<EOCP
6671 #include <inttypes.h>
6672 int main() {
6673         static int32_t foo32 = 0x12345678;
6674 }
6675 EOCP
6676 set try
6677 if eval $compile; then
6678         echo "<inttypes.h> found." >&4
6679         val="$define"
6680 else
6681         echo "<inttypes.h> NOT found." >&4
6682         val="$undef"
6683 fi
6684 $rm -f try.c try
6685 set i_inttypes
6686 eval $setvar
6687
6688 : check for int64_t
6689 case "$use64bits" in
6690 "$define" )
6691         echo " "
6692         echo $n "Checking to see if your system supports int64_t...$c" >&4
6693         $cat >try.c <<EOCP
6694 #include <sys/types.h>
6695 #$i_inttypes I_INTTYPES
6696 #ifdef I_INTTYPES
6697 #include <inttypes.h>
6698 #endif
6699 int64_t foo() { int64_t x; x = 7; return x; }
6700 EOCP
6701         if $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then
6702                 val="$define"
6703                 echo " Yup, it does." >&4
6704         else
6705                 val="$undef"
6706                 echo " Nope, it doesn't." >&4
6707         fi
6708         $rm -f try.*
6709         ;;
6710 *)      val="$undef"
6711         ;;
6712 esac
6713 set d_int64t
6714 eval $setvar
6715
6716
6717 : check for lengths of integral types
6718 echo " "
6719 case "$intsize" in
6720 '')
6721         echo "Checking to see how big your integers are..." >&4
6722         $cat >intsize.c <<'EOCP'
6723 #include <stdio.h>
6724 int main()
6725 {
6726         printf("intsize=%d;\n", sizeof(int));
6727         printf("longsize=%d;\n", sizeof(long));
6728         printf("shortsize=%d;\n", sizeof(short));
6729         exit(0);
6730 }
6731 EOCP
6732         set intsize
6733         if eval $compile_ok && ./intsize > /dev/null; then
6734                 eval `./intsize`
6735                 echo "Your integers are $intsize bytes long."
6736                 echo "Your long integers are $longsize bytes long."
6737                 echo "Your short integers are $shortsize bytes long."
6738         else
6739                 $cat >&4 <<EOM
6740 !
6741 Help! I can't compile and run the intsize test program: please enlighten me!
6742 (This is probably a misconfiguration in your system or libraries, and
6743 you really ought to fix it.  Still, I'll try anyway.)
6744 !
6745 EOM
6746                 dflt=4
6747                 rp="What is the size of an integer (in bytes)?"
6748                 . ./myread
6749                 intsize="$ans"
6750                 dflt=$intsize
6751                 rp="What is the size of a long integer (in bytes)?"
6752                 . ./myread
6753                 longsize="$ans"
6754                 dflt=2
6755                 rp="What is the size of a short integer (in bytes)?"
6756                 . ./myread
6757                 shortsize="$ans"
6758         fi
6759         ;;
6760 esac
6761 $rm -f intsize intsize.*
6762
6763 : check for long long
6764 echo " "
6765 echo $n "Checking to see if your system supports long long...$c" >&4
6766 echo 'long long foo() { long long x; x = 7; return x; }' > try.c
6767 if $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then
6768         val="$define"
6769         echo " Yup, it does." >&4
6770 else
6771         val="$undef"
6772         echo " Nope, it doesn't." >&4
6773 fi
6774 $rm try.*
6775 set d_longlong
6776 eval $setvar
6777
6778 : check for length of long long
6779 case "${d_longlong}${longlongsize}" in
6780 $define)
6781         echo " "
6782         $echo $n "Checking to see how big your long longs are...$c" >&4
6783         $cat >try.c <<'EOCP'
6784 #include <stdio.h>
6785 int main()
6786 {
6787         printf("%d\n", sizeof(long long));
6788 }
6789 EOCP
6790         set try
6791         if eval $compile_ok; then
6792                 longlongsize=`./try`
6793                 $echo " $longlongsize bytes." >&4
6794         else
6795                 dflt='8'
6796                 echo " "
6797                 echo "(I can't seem to compile the test program.  Guessing...)"
6798                 rp="What is the size of a long long (in bytes)?"
6799                 . ./myread
6800                 longlongsize="$ans"
6801         fi
6802         if $test "X$longsize" = "X$longlongsize"; then
6803                 echo "(That isn't any different from an ordinary long.)"
6804         fi      
6805         ;;
6806 esac
6807 $rm -f try.c try
6808
6809 echo " "
6810
6811 if $test X"$intsize" = X8 -o X"$longsize" = X8 -o X"$d_int64t" = X"$define" -o X"$d_longlong" = X"$define"; then
6812
6813 echo "Checking how to print 64-bit integers..." >&4
6814
6815 if $test X"$sPRId64" = X -a X"$intsize" = X8; then
6816         quad=int
6817         $cat >try.c <<'EOCP'
6818 #include <sys/types.h>
6819 #include <stdio.h>
6820 int main() {
6821   int q = 12345678901;
6822   printf("%ld\n", q);
6823 }
6824 EOCP
6825         set try
6826         if eval $compile; then
6827                 yyy=`./try$exe_ext`
6828                 case "$yyy" in
6829                 12345678901)
6830                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
6831                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIX64='"X"';
6832                         echo "We will use %d."
6833                         ;;
6834                 esac
6835         fi
6836 fi
6837
6838 if $test X"$sPRId64" = X -a X"$longsize" = X8; then
6839         quad=long
6840         $cat >try.c <<'EOCP'
6841 #include <sys/types.h>
6842 #include <stdio.h>
6843 int main() {
6844   long q = 12345678901;
6845   printf("%ld\n", q);
6846 }
6847 EOCP
6848         set try
6849         if eval $compile; then
6850                 yyy=`./try$exe_ext`
6851                 case "$yyy" in
6852                 12345678901)
6853                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
6854                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIX64='"lX"';
6855                         echo "We will use %ld."
6856                         ;;
6857                 esac
6858         fi
6859 fi
6860
6861 if $test X"$sPRId64" = X -a X"$i_inttypes.h" = X"$define" -a X"$d_int64t" = X"$define"; then
6862         quad=int64_t
6863         $cat >try.c <<'EOCP'
6864 #include <sys/types.h>
6865 #include <inttypes.h>
6866 #include <stdio.h>
6867 int main() {
6868   int64_t q = 12345678901;
6869   printf("%" PRId64 "\n", q);
6870 }
6871 EOCP
6872         set try
6873         if eval $compile; then
6874                 yyy=`./try$exe_ext`
6875                 case "$yyy" in
6876                 12345678901)
6877                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
6878                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIX64=PRIX64;
6879                         echo "We will use the C9X style."
6880                         ;;
6881                 esac
6882         fi
6883 fi
6884
6885 if $test X"$sPRId64" = X -a X"$d_longlong" = X"$define" -a X"$longlongsize" = X8; then
6886         quad="long long"
6887         $cat >try.c <<'EOCP'
6888 #include <sys/types.h>
6889 #include <stdio.h>
6890 int main() {
6891   long long q = 12345678901LL; /* AIX cc requires the LL prefix. */
6892   printf("%lld\n", q);
6893 }
6894 EOCP
6895         set try
6896         if eval $compile; then
6897                 yyy=`./try$exe_ext`
6898                 case "$yyy" in
6899                 12345678901)
6900                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
6901                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIX64='"llX"';
6902                         echo "We will use the %lld style."
6903                         ;;
6904                 esac
6905         fi
6906 fi
6907
6908 if $test X"$sPRId64" = X -a X"$quad" != X; then
6909         $cat >try.c <<EOCP
6910 #include <sys/types.h>
6911 #include <stdio.h>
6912 int main() {
6913   $quad q = 12345678901;
6914   printf("%Ld\n", q);
6915 }
6916 EOCP
6917         set try
6918         if eval $compile; then
6919                 yyy=`./try$exe_ext`
6920                 case "$yyy" in
6921                 12345678901)
6922                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
6923                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIX64='"LX"';
6924                         echo "We will use %lld."
6925                         ;;
6926                 esac
6927         fi
6928 fi
6929
6930 if $test X"$sPRId64" = X -a X"$quad" != X; then
6931         $cat >try.c <<EOCP
6932 #include <sys/types.h>
6933 #include <stdio.h>
6934 int main() {
6935   $quad q = 12345678901;
6936   printf("%qd\n", q);
6937 }
6938 EOCP
6939         set try
6940         if eval $compile; then
6941                 yyy=`./try$exe_ext`
6942                 case "$yyy" in
6943                 12345678901)
6944                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
6945                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIX64='"qX"';
6946                         echo "We will use %qd."
6947                         ;;
6948                 esac
6949         fi
6950 fi
6951
6952 if $test X"$sPRId64" = X; then
6953         echo "Cannot figure out how to print 64-bit integers." >&4
6954 fi
6955
6956 $rm -f try try.*
6957
6958 fi # intsize -o longsize -o d_int64t -o d_longlong
6959
6960 case "$sPRId64" in
6961 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef"; 
6962         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIX64="$undef"; 
6963         ;;
6964 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define"; 
6965         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIX64="$define"; 
6966         ;;
6967 esac
6968
6969 : check for length of double
6970 echo " "
6971 case "$doublesize" in
6972 '')
6973         $echo $n "Checking to see how big your double precision numbers are...$c" >&4
6974         $cat >try.c <<'EOCP'
6975 #include <stdio.h>
6976 int main()
6977 {
6978         printf("%d\n", sizeof(double));
6979 }
6980 EOCP
6981         set try
6982         if eval $compile_ok; then
6983                 doublesize=`./try`
6984                 $echo " $doublesize bytes." >&4
6985         else
6986                 dflt='8'
6987                 echo "(I can't seem to compile the test program.  Guessing...)"
6988                 rp="What is the size of a double precision number (in bytes)?"
6989                 . ./myread
6990                 doublesize="$ans"
6991         fi
6992         ;;
6993 esac
6994 $rm -f try.c try
6995
6996 : check for long doubles
6997 echo " "
6998 echo $n "Checking to see if your system supports long double...$c" >&4
6999 echo 'long double foo() { long double x; x = 7.0; return x; }' > try.c
7000 if $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then
7001         val="$define"
7002         echo " Yup, it does." >&4
7003 else
7004         val="$undef"
7005         echo " Nope, it doesn't." >&4
7006 fi
7007 $rm try.*
7008 set d_longdbl
7009 eval $setvar
7010
7011 : check for length of long double
7012 case "${d_longdbl}${longdblsize}" in
7013 $define)
7014         echo " "
7015         $echo $n "Checking to see how big your long doubles are...$c" >&4
7016         $cat >try.c <<'EOCP'
7017 #include <stdio.h>
7018 int main()
7019 {
7020         printf("%d\n", sizeof(long double));
7021 }
7022 EOCP
7023         set try
7024         if eval $compile; then
7025                 longdblsize=`./try`
7026                 $echo " $longdblsize bytes." >&4
7027         else
7028                 dflt='8'
7029                 echo " "
7030                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
7031                 rp="What is the size of a long double (in bytes)?"
7032                 . ./myread
7033                 longdblsize="$ans"
7034         fi
7035         if $test "X$doublesize" = "X$longdblsize"; then
7036                 echo "(That isn't any different from an ordinary double.)"
7037         fi      
7038         ;;
7039 esac
7040 $rm -f try.c try
7041
7042 echo " "
7043
7044 if $test X"$d_longdbl" = X"$define"; then
7045
7046 echo "Checking how to print long doubles..." >&4
7047
7048 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
7049         $cat >try.c <<'EOCP'
7050 #include <sys/types.h>
7051 #include <stdio.h>
7052 int main() {
7053   double d = 123.456;
7054   printf("%.3f\n", d);
7055 }
7056 EOCP
7057         set try
7058         if eval $compile; then
7059                 yyy=`./try$exe_ext`
7060                 case "$yyy" in
7061                 123.456)
7062                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
7063                         sPRIFldbl='"F"'; sPRIGldbl='"G"'; sPRIEldbl='"E"';
7064                         echo "We will use %f."
7065                         ;;
7066                 esac
7067         fi
7068 fi
7069
7070 if $test X"$sPRIfldbl" = X; then
7071         $cat >try.c <<'EOCP'
7072 #include <sys/types.h>
7073 #include <stdio.h>
7074 int main() {
7075   long double d = 123.456;
7076   printf("%.3llf\n", d);
7077 }
7078 EOCP
7079         set try
7080         if eval $compile; then
7081                 yyy=`./try$exe_ext`
7082                 case "$yyy" in
7083                 123.456)
7084                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
7085                         sPRIFldbl='"llF"'; sPRIGldbl='"llG"'; sPRIEldbl='"llE"';
7086                         echo "We will use %llf."
7087                         ;;
7088                 esac
7089         fi
7090 fi
7091
7092 if $test X"$sPRIfldbl" = X; then
7093         $cat >try.c <<'EOCP'
7094 #include <sys/types.h>
7095 #include <stdio.h>
7096 int main() {
7097   long double d = 123.456;
7098   printf("%.3Lf\n", d);
7099 }
7100 EOCP
7101         set try
7102         if eval $compile; then
7103                 yyy=`./try$exe_ext`
7104                 case "$yyy" in
7105                 123.456)
7106                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
7107                         sPRIFldbl='"LF"'; sPRIGldbl='"LG"'; sPRIEldbl='"LE"';
7108                         echo "We will use %Lf."
7109                         ;;
7110                 esac
7111         fi
7112 fi
7113
7114 if $test X"$sPRIfldbl" = X; then
7115         $cat >try.c <<'EOCP'
7116 #include <sys/types.h>
7117 #include <stdio.h>
7118 int main() {
7119   long double d = 123.456;
7120   printf("%.3lf\n", d);
7121 }
7122 EOCP
7123         set try
7124         if eval $compile; then
7125                 yyy=`./try$exe_ext`
7126                 case "$yyy" in
7127                 123.456)
7128                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
7129                         sPRIFldbl='"lF"'; sPRIGldbl='"lG"'; sPRIEldbl='"lE"';
7130                         echo "We will use %lf."
7131                         ;;
7132                 esac
7133         fi
7134 fi
7135
7136 if $test X"$sPRIfldbl" = X; then
7137         echo "Cannot figure out how to print long doubles." >&4
7138 fi
7139
7140 $rm -f try try.*
7141
7142 fi # d_longdbl
7143
7144 case "$sPRIfldbl" in
7145 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef"; 
7146         d_PRIFldbl="$undef"; d_PRIGldbl="$undef"; d_PRIEldbl="$undef"; 
7147         ;;
7148 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define"; 
7149         d_PRIFldbl="$define"; d_PRIGldbl="$define"; d_PRIEldbl="$define"; 
7150         ;;
7151 esac
7152
7153 : Initialize h_fcntl
7154 h_fcntl=false
7155
7156 : Initialize h_sysfile
7157 h_sysfile=false
7158
7159 : access call always available on UNIX
7160 set access d_access
7161 eval $inlibc
7162
7163 : locate the flags for 'access()'
7164 case "$d_access" in
7165 "$define")
7166         echo " "
7167         $cat >access.c <<'EOCP'
7168 #include <sys/types.h>
7169 #ifdef I_FCNTL
7170 #include <fcntl.h>
7171 #endif
7172 #ifdef I_SYS_FILE
7173 #include <sys/file.h>
7174 #endif
7175 #ifdef I_UNISTD
7176 #include <unistd.h>
7177 #endif
7178 int main() {
7179         exit(R_OK);
7180 }
7181 EOCP
7182         : check sys/file.h first, no particular reason here
7183         if $test `./findhdr sys/file.h` && \
7184                 $cc $cppflags -DI_SYS_FILE -o access access.c >/dev/null 2>&1 ; then
7185                 h_sysfile=true;
7186                 echo "<sys/file.h> defines the *_OK access constants." >&4
7187         elif $test `./findhdr fcntl.h` && \
7188                 $cc $cppflags -DI_FCNTL -o access access.c >/dev/null 2>&1 ; then
7189                 h_fcntl=true;
7190                 echo "<fcntl.h> defines the *_OK access constants." >&4
7191         elif $test `./findhdr unistd.h` && \
7192                 $cc $cppflags -DI_UNISTD -o access access.c >/dev/null 2>&1 ; then
7193                 echo "<unistd.h> defines the *_OK access constants." >&4
7194         else
7195                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
7196         fi
7197         ;;
7198 esac
7199 $rm -f access*
7200
7201 : see if accessx exists
7202 set accessx d_accessx
7203 eval $inlibc
7204
7205 : see if alarm exists
7206 set alarm d_alarm
7207 eval $inlibc
7208
7209 : see if atolf exists
7210 set atolf d_atolf
7211 eval $inlibc
7212
7213 : see if atoll exists
7214 set atoll d_atoll
7215 eval $inlibc
7216
7217 : Look for GNU-cc style attribute checking
7218 echo " "
7219 echo "Checking whether your compiler can handle __attribute__ ..." >&4
7220 $cat >attrib.c <<'EOCP'
7221 #include <stdio.h>
7222 void croak (char* pat,...) __attribute__((format(printf,1,2),noreturn));
7223 EOCP
7224 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
7225         if $contains 'warning' attrib.out >/dev/null 2>&1; then
7226                 echo "Your C compiler doesn't fully support __attribute__."
7227                 val="$undef"
7228         else
7229                 echo "Your C compiler supports __attribute__."
7230                 val="$define"
7231         fi
7232 else
7233         echo "Your C compiler doesn't seem to understand __attribute__ at all."
7234         val="$undef"
7235 fi
7236 set d_attribut
7237 eval $setvar
7238 $rm -f attrib*
7239
7240 : see if bcmp exists
7241 set bcmp d_bcmp
7242 eval $inlibc
7243
7244 : see if bcopy exists
7245 set bcopy d_bcopy
7246 eval $inlibc
7247
7248 : see if this is a unistd.h system
7249 set unistd.h i_unistd
7250 eval $inhdr
7251
7252 : see if getpgrp exists
7253 set getpgrp d_getpgrp
7254 eval $inlibc
7255
7256 case "$d_getpgrp" in
7257 "$define")
7258         echo " "
7259         echo "Checking to see which flavor of getpgrp is in use..."
7260         $cat >set.c <<EOP
7261 #$i_unistd I_UNISTD
7262 #include <sys/types.h>
7263 #ifdef I_UNISTD
7264 #  include <unistd.h>
7265 #endif
7266 int main()
7267 {
7268         if (getuid() == 0) {
7269                 printf("(I see you are running Configure as super-user...)\n");
7270                 setuid(1);
7271         }
7272 #ifdef TRY_BSD_PGRP
7273         if (getpgrp(1) == 0)
7274                 exit(0);
7275 #else
7276         if (getpgrp() > 0)
7277                 exit(0);
7278 #endif
7279         exit(1);
7280 }
7281 EOP
7282         if $cc -DTRY_BSD_PGRP $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7283                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
7284                 val="$define"
7285         elif $cc $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7286                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
7287                 val="$undef"
7288         else
7289                 echo "I can't seem to compile and run the test program."
7290                 if ./usg; then
7291                         xxx="a USG one, i.e. you use getpgrp()."
7292                 else
7293                         # SVR4 systems can appear rather BSD-ish.
7294                         case "$i_unistd" in
7295                         $undef)
7296                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
7297                                 val="$define"
7298                                 ;;
7299                         $define)
7300                                 xxx="probably a USG one, i.e. you use getpgrp()."
7301                                 val="$undef"
7302                                 ;;
7303                         esac
7304                 fi
7305                 echo "Assuming your getpgrp is $xxx" >&4
7306         fi
7307         ;;
7308 *) val="$undef";;
7309 esac
7310 set d_bsdgetpgrp
7311 eval $setvar
7312 $rm -f set set.c
7313
7314 : see if setpgrp exists
7315 set setpgrp d_setpgrp
7316 eval $inlibc
7317
7318 case "$d_setpgrp" in
7319 "$define")
7320         echo " "
7321         echo "Checking to see which flavor of setpgrp is in use..."
7322         $cat >set.c <<EOP
7323 #$i_unistd I_UNISTD
7324 #include <sys/types.h>
7325 #ifdef I_UNISTD
7326 #  include <unistd.h>
7327 #endif
7328 int main()
7329 {
7330         if (getuid() == 0) {
7331                 printf("(I see you are running Configure as super-user...)\n");
7332                 setuid(1);
7333         }
7334 #ifdef TRY_BSD_PGRP
7335         if (-1 == setpgrp(1, 1))
7336                 exit(0);
7337 #else
7338         if (setpgrp() != -1)
7339                 exit(0);
7340 #endif
7341         exit(1);
7342 }
7343 EOP
7344         if $cc -DTRY_BSD_PGRP $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7345                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
7346                 val="$define"
7347         elif $cc $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7348                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
7349                 val="$undef"
7350         else
7351                 echo "(I can't seem to compile and run the test program.)"
7352                 if ./usg; then
7353                         xxx="a USG one, i.e. you use setpgrp()."
7354                 else
7355                         # SVR4 systems can appear rather BSD-ish.
7356                         case "$i_unistd" in
7357                         $undef)
7358                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
7359                                 val="$define"
7360                                 ;;
7361                         $define)
7362                                 xxx="probably a USG one, i.e. you use setpgrp()."
7363                                 val="$undef"
7364                                 ;;
7365                         esac
7366                 fi
7367                 echo "Assuming your setpgrp is $xxx" >&4
7368         fi
7369         ;;
7370 *) val="$undef";;
7371 esac
7372 set d_bsdsetpgrp
7373 eval $setvar
7374 $rm -f set set.c
7375 : see if bzero exists
7376 set bzero d_bzero
7377 eval $inlibc
7378
7379 : see if signal is declared as pointer to function returning int or void
7380 echo " "
7381 xxx=`./findhdr signal.h`
7382 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
7383 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
7384         echo "You have int (*signal())() instead of void." >&4
7385         val="$undef"
7386 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
7387         echo "You have void (*signal())()." >&4
7388         val="$define"
7389 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
7390         echo "You have int (*signal())() instead of void." >&4
7391         val="$undef"
7392 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
7393         echo "You have void (*signal())()." >&4
7394         val="$define"
7395 else
7396         case "$d_voidsig" in
7397         '')
7398         echo "I can't determine whether signal handler returns void or int..." >&4
7399                 dflt=void
7400                 rp="What type does your signal handler return?"
7401                 . ./myread
7402                 case "$ans" in
7403                 v*) val="$define";;
7404                 *) val="$undef";;
7405                 esac;;
7406         "$define")
7407                 echo "As you already told me, signal handler returns void." >&4
7408                 val="$define"
7409                 ;;
7410         *)      echo "As you already told me, signal handler returns int." >&4
7411                 val="$undef"
7412                 ;;
7413         esac
7414 fi
7415 set d_voidsig
7416 eval $setvar
7417 case "$d_voidsig" in
7418 "$define") signal_t="void";;
7419 *) signal_t="int";;
7420 esac
7421 $rm -f $$.tmp
7422
7423 : check for ability to cast large floats to 32-bit ints.
7424 echo " "
7425 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
7426 if $test "$intsize" -ge 4; then
7427         xxx=int
7428 else
7429         xxx=long
7430 fi
7431 $cat >try.c <<EOCP
7432 #include <stdio.h>
7433 #include <sys/types.h>
7434 #include <signal.h>
7435 $signal_t blech(s) int s; { exit(3); }
7436 int main()
7437 {
7438         $xxx i32;
7439         double f, g;
7440         int result = 0;
7441         char str[16];
7442         signal(SIGFPE, blech);
7443
7444         /* Don't let compiler optimize the test away.  Store the number 
7445            in a writable string for gcc to pass to sscanf under HP/UX.
7446         */
7447         sprintf(str, "2147483647");
7448         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
7449         g = 10 * f;
7450         i32  = ($xxx) g;
7451
7452         /* x86 processors will probably give 0x8000 0000, which is a
7453        sign change.  We don't want that.  We want to mimic SPARC
7454            behavior here, which is to preserve the sign and give
7455            back 0x7fff ffff.
7456         */
7457         if (i32 != ($xxx) f)
7458                 result |= 1;
7459         exit(result);
7460 }
7461 EOCP
7462 set try
7463 if eval $compile_ok; then
7464         ./try
7465         yyy=$?
7466 else
7467         echo "(I can't seem to compile the test program--assuming it can't)"
7468         yyy=1
7469 fi
7470 case "$yyy" in
7471 0)      val="$define"
7472         echo "Yup, it can."
7473         ;;
7474 *)      val="$undef"
7475         echo "Nope, it can't."
7476         ;;
7477 esac
7478 set d_casti32
7479 eval $setvar
7480 $rm -f try try.*
7481
7482 : check for ability to cast negative floats to unsigned
7483 echo " "
7484 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
7485 $cat >try.c <<EOCP
7486 #include <stdio.h>
7487 #include <sys/types.h>
7488 #include <signal.h>
7489 $signal_t blech(s) int s; { exit(7); }
7490 $signal_t blech_in_list(s) int s; { exit(4); }
7491 unsigned long dummy_long(p) unsigned long p; { return p; }
7492 unsigned int dummy_int(p) unsigned int p; { return p; }
7493 unsigned short dummy_short(p) unsigned short p; { return p; }
7494 int main()
7495 {
7496         double f;
7497         unsigned long along;
7498         unsigned int aint;
7499         unsigned short ashort;
7500         int result = 0;
7501         char str[16];
7502         
7503         /* Frustrate gcc-2.7.2's optimizer which failed this test with
7504            a direct f = -123. assignment.  gcc-2.8.0 reportedly
7505            optimized the whole file away
7506         */
7507         /* Store the number in a writable string for gcc to pass to 
7508            sscanf under HP/UX.
7509         */
7510         sprintf(str, "-123");
7511         sscanf(str, "%lf", &f);  /* f = -123.; */
7512
7513         signal(SIGFPE, blech);
7514         along = (unsigned long)f;
7515         aint = (unsigned int)f;
7516         ashort = (unsigned short)f;
7517         if (along != (unsigned long)-123)
7518                 result |= 1;
7519         if (aint != (unsigned int)-123)
7520                 result |= 1;
7521         if (ashort != (unsigned short)-123)
7522                 result |= 1;
7523         sprintf(str, "1073741824.");
7524         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
7525         f = f + f;
7526         along = 0;
7527         along = (unsigned long)f;
7528         if (along != 0x80000000)
7529                 result |= 2;
7530         f -= 1.;
7531         along = 0;
7532         along = (unsigned long)f;
7533         if (along != 0x7fffffff)
7534                 result |= 1;
7535         f += 2.;
7536         along = 0;
7537         along = (unsigned long)f;
7538         if (along != 0x80000001)
7539                 result |= 2;
7540         if (result)
7541                 exit(result);
7542         signal(SIGFPE, blech_in_list);
7543         sprintf(str, "123.");
7544         sscanf(str, "%lf", &f);  /* f = 123.; */
7545         along = dummy_long((unsigned long)f);
7546         aint = dummy_int((unsigned int)f);
7547         ashort = dummy_short((unsigned short)f);
7548         if (along != (unsigned long)123)
7549                 result |= 4;
7550         if (aint != (unsigned int)123)
7551                 result |= 4;
7552         if (ashort != (unsigned short)123)
7553                 result |= 4;
7554         exit(result);
7555
7556 }
7557 EOCP
7558 set try
7559 if eval $compile_ok; then
7560         ./try
7561         castflags=$?
7562 else
7563         echo "(I can't seem to compile the test program--assuming it can't)"
7564         castflags=7
7565 fi
7566 case "$castflags" in
7567 0)      val="$define"
7568         echo "Yup, it can."
7569         ;;
7570 *)      val="$undef"
7571         echo "Nope, it can't."
7572         ;;
7573 esac
7574 set d_castneg
7575 eval $setvar
7576 $rm -f try.*
7577
7578 : see if vprintf exists
7579 echo " "
7580 if set vprintf val -f d_vprintf; eval $csym; $val; then
7581         echo 'vprintf() found.' >&4
7582         val="$define"
7583         $cat >vprintf.c <<'EOF'
7584 #include <varargs.h>
7585
7586 int main() { xxx("foo"); }
7587
7588 xxx(va_alist)
7589 va_dcl
7590 {
7591         va_list args;
7592         char buf[10];
7593
7594         va_start(args);
7595         exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
7596 }
7597 EOF
7598         set vprintf
7599         if eval $compile && ./vprintf; then
7600                 echo "Your vsprintf() returns (int)." >&4
7601                 val2="$undef"
7602         else
7603                 echo "Your vsprintf() returns (char*)." >&4
7604                 val2="$define"
7605         fi
7606 else
7607         echo 'vprintf() NOT found.' >&4
7608                 val="$undef"
7609                 val2="$undef"
7610 fi
7611 set d_vprintf
7612 eval $setvar
7613 val=$val2
7614 set d_charvspr
7615 eval $setvar
7616
7617 : see if chown exists
7618 set chown d_chown
7619 eval $inlibc
7620
7621 : see if chroot exists
7622 set chroot d_chroot
7623 eval $inlibc
7624
7625 : see if chsize exists
7626 set chsize d_chsize
7627 eval $inlibc
7628
7629 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
7630 while $test $# -ge 2; do
7631         case "$1" in
7632         $define) echo "#include <$2>";;
7633         esac ;
7634     shift 2;
7635 done > try.c;
7636 echo "int main () { struct $struct foo; foo.$field = 0; }" >> try.c;
7637 if $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then
7638         val="$define";
7639 else
7640         val="$undef";
7641 fi;
7642 set $varname;
7643 eval $setvar;
7644 $rm -f try.c try.o'
7645
7646 : see if this is a sys/uio.h system
7647 set sys/uio.h i_sysuio
7648 eval $inhdr
7649
7650 echo "Checking to see if your system supports struct iovec..." >&4
7651 set d_iovec_s iovec iov_base $i_sysuio sys/uio.h
7652 eval $hasfield
7653 case "$d_iovec_s" in
7654 "$define")      echo "Yup, it does." >&4
7655                 ;;
7656 *)              echo "Nope, it doesn't." >&4
7657                 ;;
7658 esac
7659
7660 socketlib=''
7661 sockethdr=''
7662 : see whether socket exists
7663 echo " "
7664 $echo $n "Hmm... $c" >&4
7665 if set socket val -f d_socket; eval $csym; $val; then
7666         echo "Looks like you have Berkeley networking support." >&4
7667         d_socket="$define"
7668         if set setsockopt val -f; eval $csym; $val; then
7669                 d_oldsock="$undef"
7670         else
7671                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
7672                 d_oldsock="$define"
7673         fi
7674 else
7675         if $contains socklib libc.list >/dev/null 2>&1; then
7676                 echo "Looks like you have Berkeley networking support." >&4
7677                 d_socket="$define"
7678                 : we will have to assume that it supports the 4.2 BSD interface
7679                 d_oldsock="$undef"
7680         else
7681                 echo "You don't have Berkeley networking in libc$_a..." >&4
7682                 if test "X$d_socket" = "X$define"; then
7683                    echo "...but you seem to believe that you have sockets." >&4
7684                 else
7685                         for net in net socket
7686                         do
7687                                 if test -f /usr/lib/lib$net$_a; then
7688                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
7689                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
7690                                         if $contains socket libc.list >/dev/null 2>&1; then
7691                                                 d_socket="$define"
7692                                                 socketlib="-l$net"
7693                                                 case "$net" in
7694                                                 net)
7695                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
7696                                                         sockethdr="-I/usr/netinclude"
7697                                                         ;;
7698                                                 esac
7699                                                 echo "Found Berkeley sockets interface in lib$net." >& 4 
7700                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
7701                                                         d_oldsock="$undef"
7702                                                 else
7703                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
7704                                                         d_oldsock="$define"
7705                                                 fi
7706                                                 break
7707                                         fi
7708                                 fi
7709                         done
7710                         if test "X$d_socket" != "X$define"; then
7711                            echo "or anywhere else I see." >&4
7712                            d_socket="$undef"
7713                            d_oldsock="$undef"
7714                         fi
7715                 fi
7716         fi
7717 fi
7718
7719 : see if socketpair exists
7720 set socketpair d_sockpair
7721 eval $inlibc
7722
7723
7724 echo " "
7725 echo "Checking the availability of certain socket constants..." >& 4
7726 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
7727         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
7728         $cat >try.c <<EOF
7729 #include <sys/types.h>
7730 #include <sys/socket.h>
7731 int main() {
7732     int i = $ENUM;
7733 }
7734 EOF
7735         val="$undef"
7736         set try; if eval $compile; then
7737                 val="$define"
7738         fi
7739         set d_${enum}; eval $setvar
7740         $rm -f try.c try
7741 done
7742
7743 set sendmsg d_sendmsg
7744 eval $inlibc
7745
7746 set recvmsg d_recvmsg
7747 eval $inlibc
7748
7749 echo " "
7750 $echo $n "Checking to see if your system supports struct msghdr...$c" >&4
7751 set d_msghdr_s msghdr msg_name define sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
7752 eval $hasfield
7753 case "$d_msghdr_s" in
7754 "$define")      echo "Yup, it does." >&4
7755                 ;;
7756 *)              echo "Nope, it doesn't." >&4
7757                 ;;
7758 esac
7759
7760 $echo $n "Checking to see if your system supports struct cmsghdr...$c" >&4
7761 set d_cmsghdr_s cmsghdr cmsg_len define sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
7762 eval $hasfield
7763 case "$d_cmsghdr_s" in
7764 "$define")      echo "Yup, it does." >&4
7765                 ;;
7766 *)              echo "Nope, it doesn't." >&4
7767                 ;;
7768 esac
7769
7770 : check for const keyword
7771 echo " "
7772 echo 'Checking to see if your C compiler knows about "const"...' >&4
7773 $cat >const.c <<'EOCP'
7774 typedef struct spug { int drokk; } spug;
7775 int main()
7776 {
7777         const char *foo;
7778         const spug y;
7779 }
7780 EOCP
7781 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
7782         val="$define"
7783         echo "Yup, it does."
7784 else
7785         val="$undef"
7786         echo "Nope, it doesn't."
7787 fi
7788 set d_const
7789 eval $setvar
7790
7791 : see if crypt exists
7792 echo " "
7793 if set crypt val -f d_crypt; eval $csym; $val; then
7794         echo 'crypt() found.' >&4
7795         val="$define"
7796         cryptlib=''
7797 else
7798         cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
7799         if $test -z "$cryptlib"; then
7800                 cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
7801         else
7802                 cryptlib=-lcrypt
7803         fi
7804         if $test -z "$cryptlib"; then
7805                 cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
7806         else
7807                 cryptlib=-lcrypt
7808         fi
7809         if $test -z "$cryptlib"; then
7810                 cryptlib=`./loc libcrypt$_a "" $libpth`
7811         else
7812                 cryptlib=-lcrypt
7813         fi
7814         if $test -z "$cryptlib"; then
7815                 echo 'crypt() NOT found.' >&4
7816                 val="$undef"
7817         else
7818                 val="$define"
7819         fi
7820 fi
7821 set d_crypt
7822 eval $setvar
7823
7824 : get csh whereabouts
7825 case "$csh" in
7826 'csh') val="$undef" ;;
7827 *) val="$define" ;;
7828 esac
7829 set d_csh
7830 eval $setvar
7831 : Respect a hint or command line value for full_csh.
7832 case "$full_csh" in
7833 '') full_csh=$csh ;;
7834 esac
7835
7836 : see if cuserid exists
7837 set cuserid d_cuserid
7838 eval $inlibc
7839
7840 : see if this is a limits.h system
7841 set limits.h i_limits
7842 eval $inhdr
7843
7844 : see if this is a float.h system
7845 set float.h i_float
7846 eval $inhdr
7847
7848 : See if number of significant digits in a double precision number is known
7849 echo " "
7850 $cat >dbl_dig.c <<EOM
7851 #$i_limits I_LIMITS
7852 #$i_float I_FLOAT
7853 #ifdef I_LIMITS
7854 #include <limits.h>
7855 #endif
7856 #ifdef I_FLOAT
7857 #include <float.h>
7858 #endif
7859 #ifdef DBL_DIG
7860 printf("Contains DBL_DIG");
7861 #endif
7862 EOM
7863 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
7864 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
7865         echo "DBL_DIG found." >&4
7866         val="$define"
7867 else
7868         echo "DBL_DIG NOT found." >&4
7869         val="$undef"
7870 fi
7871 $rm -f dbl_dig.?
7872 set d_dbl_dig
7873 eval $setvar
7874
7875 : see if difftime exists
7876 set difftime d_difftime
7877 eval $inlibc
7878
7879 : see if this is a dirent system
7880 echo " "
7881 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
7882         val="$define"
7883         echo "<dirent.h> found." >&4
7884 else
7885         val="$undef"
7886         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
7887                 echo "<sys/dir.h> found." >&4
7888                 echo " "
7889         else
7890                 xinc=`./findhdr sys/ndir.h`
7891         fi
7892         echo "<dirent.h> NOT found." >&4
7893 fi
7894 set i_dirent
7895 eval $setvar
7896
7897 : Look for type of directory structure.
7898 echo " "
7899 $cppstdin $cppflags $cppminus < "$xinc" > try.c
7900
7901 case "$direntrytype" in
7902 ''|' ')
7903         case "$i_dirent" in
7904         $define) guess1='struct dirent' ;;
7905         *) guess1='struct direct'  ;;
7906         esac
7907         ;;
7908 *)      guess1="$direntrytype"
7909         ;;
7910 esac
7911
7912 case "$guess1" in
7913 'struct dirent') guess2='struct direct' ;;
7914 *) guess2='struct dirent' ;;
7915 esac
7916                 
7917 if $contains "$guess1" try.c >/dev/null 2>&1; then
7918         direntrytype="$guess1"
7919         echo "Your directory entries are $direntrytype." >&4
7920 elif $contains "$guess2" try.c >/dev/null 2>&1; then
7921         direntrytype="$guess2"
7922         echo "Your directory entries seem to be $direntrytype." >&4
7923 else
7924         echo "I don't recognize your system's directory entries." >&4
7925         rp="What type is used for directory entries on this system?"
7926         dflt="$guess1"
7927         . ./myread
7928         direntrytype="$ans"
7929 fi
7930 $rm -f try.c
7931
7932
7933 : see if the directory entry stores field length
7934 echo " "
7935 $cppstdin $cppflags $cppminus < "$xinc" > try.c
7936 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
7937         echo "Good, your directory entry keeps length information in d_namlen." >&4
7938         val="$define"
7939 else
7940         echo "Your directory entry does not know about the d_namlen field." >&4
7941         val="$undef"
7942 fi
7943 set d_dirnamlen
7944 eval $setvar
7945 $rm -f try.c
7946
7947 : see if dlerror exists
7948 xxx_runnm="$runnm"
7949 runnm=false
7950 set dlerror d_dlerror
7951 eval $inlibc
7952 runnm="$xxx_runnm"
7953
7954 : see if dlfcn is available
7955 set dlfcn.h i_dlfcn
7956 eval $inhdr
7957
7958 case "$usedl" in
7959 $define|y|true)
7960         $cat << EOM
7961
7962 On a few systems, the dynamically loaded modules that perl generates and uses
7963 will need a different extension than shared libs. The default will probably
7964 be appropriate.
7965
7966 EOM
7967         case "$dlext" in
7968         '')     dflt="$so" ;;
7969         *)      dflt="$dlext" ;;
7970         esac
7971         rp='What is the extension of dynamically loaded modules'
7972         . ./myread
7973         dlext="$ans"
7974         ;;
7975 *)
7976         dlext="none"
7977         ;;
7978 esac
7979
7980 : Check if dlsym need a leading underscore
7981 echo " "
7982 val="$undef"
7983
7984 case "$dlsrc" in
7985 dl_dlopen.xs)
7986         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
7987         $cat >dyna.c <<'EOM'
7988 fred () { }
7989 EOM
7990
7991 $cat >fred.c<<EOM
7992
7993 #include <stdio.h>
7994 #$i_dlfcn I_DLFCN
7995 #ifdef I_DLFCN
7996 #include <dlfcn.h>      /* the dynamic linker include file for Sunos/Solaris */
7997 #else
7998 #include <sys/types.h>
7999 #include <nlist.h>
8000 #include <link.h>
8001 #endif
8002
8003 extern int fred() ;
8004
8005 int main()
8006 {
8007     void * handle ;
8008     void * symbol ;
8009 #ifndef RTLD_LAZY
8010     int mode = 1 ;
8011 #else
8012     int mode = RTLD_LAZY ;
8013 #endif
8014     handle = dlopen("./dyna.$dlext", mode) ;
8015     if (handle == NULL) {
8016         printf ("1\n") ;
8017         fflush (stdout) ;
8018         exit(0);
8019     }
8020     symbol = dlsym(handle, "fred") ;
8021     if (symbol == NULL) {
8022         /* try putting a leading underscore */
8023         symbol = dlsym(handle, "_fred") ;
8024         if (symbol == NULL) {
8025             printf ("2\n") ;
8026             fflush (stdout) ;
8027             exit(0);
8028         }
8029         printf ("3\n") ;
8030     }
8031     else
8032         printf ("4\n") ;
8033     fflush (stdout) ;
8034     exit(0);
8035 }
8036 EOM
8037         : Call the object file tmp-dyna.o in case dlext=o.
8038         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 && 
8039                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 && 
8040                 $ld $lddlflags -o dyna.$dlext tmp-dyna${_o} > /dev/null 2>&1 && 
8041                 $cc $ccflags -o fred $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1; then
8042                 xxx=`./fred`
8043                 case $xxx in
8044                 1)      echo "Test program failed using dlopen." >&4
8045                         echo "Perhaps you should not use dynamic loading." >&4;;
8046                 2)      echo "Test program failed using dlsym." >&4
8047                         echo "Perhaps you should not use dynamic loading." >&4;;
8048                 3)      echo "dlsym needs a leading underscore" >&4
8049                         val="$define" ;;
8050                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
8051                 esac
8052         else
8053                 echo "I can't compile and run the test program." >&4
8054                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
8055         fi
8056         ;;
8057 esac
8058                 
8059 $rm -f fred fred.? dyna.$dlext dyna.? tmp-dyna.?
8060
8061 set d_dlsymun
8062 eval $setvar
8063
8064 hasproto='varname=$1; func=$2; shift; shift;
8065 while $test $# -ge 2; do
8066         case "$1" in
8067         $define) echo "#include <$2>";;
8068         esac ;
8069     shift 2;
8070 done > try.c;
8071 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
8072 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
8073         echo "$func() prototype found.";
8074         val="$define";
8075 else
8076         echo "$func() prototype NOT found.";
8077         val="$undef";
8078 fi;
8079 set $varname;
8080 eval $setvar;
8081 $rm -f try.c tryout.c'
8082
8083 : see if prototype for drand48 is available
8084 echo " "
8085 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
8086 eval $hasproto
8087
8088 : see if dup2 exists
8089 set dup2 d_dup2
8090 eval $inlibc
8091
8092 : see if eaccess exists
8093 set eaccess d_eaccess
8094 eval $inlibc
8095
8096 : see if endgrent exists
8097 set endgrent d_endgrent
8098 eval $inlibc
8099
8100 : see if endhostent exists
8101 set endhostent d_endhent
8102 eval $inlibc
8103
8104 : see if endnetent exists
8105 set endnetent d_endnent
8106 eval $inlibc
8107
8108 : see if endprotoent exists
8109 set endprotoent d_endpent
8110 eval $inlibc
8111
8112 : see if endpwent exists
8113 set endpwent d_endpwent
8114 eval $inlibc
8115
8116 : see if endservent exists
8117 set endservent d_endsent
8118 eval $inlibc
8119
8120 : see if endspent exists
8121 set endspent d_endspent
8122 eval $inlibc
8123
8124 : Locate the flags for 'open()'
8125 echo " "
8126 $cat >open3.c <<'EOCP'
8127 #include <sys/types.h>
8128 #ifdef I_FCNTL
8129 #include <fcntl.h>
8130 #endif
8131 #ifdef I_SYS_FILE
8132 #include <sys/file.h>
8133 #endif
8134 int main() {
8135         if(O_RDONLY);
8136 #ifdef O_TRUNC
8137         exit(0);
8138 #else
8139         exit(1);
8140 #endif
8141 }
8142 EOCP
8143 : check sys/file.h first to get FREAD on Sun
8144 if $test `./findhdr sys/file.h` && \
8145                 set open3 -DI_SYS_FILE && eval $compile; then
8146         h_sysfile=true;
8147         echo "<sys/file.h> defines the O_* constants..." >&4
8148         if ./open3; then
8149                 echo "and you have the 3 argument form of open()." >&4
8150                 val="$define"
8151         else
8152                 echo "but not the 3 argument form of open().  Oh, well." >&4
8153                 val="$undef"
8154         fi
8155 elif $test `./findhdr fcntl.h` && \
8156                 set open3 -DI_FCNTL && eval $compile; then
8157         h_fcntl=true;
8158         echo "<fcntl.h> defines the O_* constants..." >&4
8159         if ./open3; then
8160                 echo "and you have the 3 argument form of open()." >&4
8161                 val="$define"
8162         else
8163                 echo "but not the 3 argument form of open().  Oh, well." >&4
8164                 val="$undef"
8165         fi
8166 else
8167         val="$undef"
8168         echo "I can't find the O_* constant definitions!  You got problems." >&4
8169 fi
8170 set d_open3
8171 eval $setvar
8172 $rm -f open3*
8173
8174 : check for non-blocking I/O stuff
8175 case "$h_sysfile" in
8176 true) echo "#include <sys/file.h>" > head.c;;
8177 *)
8178         case "$h_fcntl" in
8179         true) echo "#include <fcntl.h>" > head.c;;
8180         *) echo "#include <sys/fcntl.h>" > head.c;;
8181         esac
8182         ;;
8183 esac
8184 echo " "
8185 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
8186 case "$o_nonblock" in
8187 '')
8188         $cat head.c > try.c
8189         $cat >>try.c <<'EOCP'
8190 int main() {
8191 #ifdef O_NONBLOCK
8192         printf("O_NONBLOCK\n");
8193         exit(0);
8194 #endif
8195 #ifdef O_NDELAY
8196         printf("O_NDELAY\n");
8197         exit(0);
8198 #endif
8199 #ifdef FNDELAY
8200         printf("FNDELAY\n");
8201         exit(0);
8202 #endif
8203         exit(0);
8204 }
8205 EOCP
8206         set try
8207         if eval $compile_ok; then
8208                 o_nonblock=`./try`
8209                 case "$o_nonblock" in
8210                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
8211                 *) echo "Seems like we can use $o_nonblock.";;
8212                 esac
8213         else
8214                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
8215         fi
8216         ;;
8217 *) echo "Using $hint value $o_nonblock.";;
8218 esac
8219 $rm -f try try.* .out core
8220
8221 echo " "
8222 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
8223 case "$eagain" in
8224 '')
8225         $cat head.c > try.c
8226         $cat >>try.c <<EOCP
8227 #include <errno.h>
8228 #include <sys/types.h>
8229 #include <signal.h>
8230 #define MY_O_NONBLOCK $o_nonblock
8231 #ifndef errno  /* XXX need better Configure test */
8232 extern int errno;
8233 #endif
8234 $signal_t blech(x) int x; { exit(3); }
8235 EOCP
8236         $cat >> try.c <<'EOCP'
8237 int main()
8238 {
8239         int pd[2];
8240         int pu[2];
8241         char buf[1];
8242         char string[100];
8243
8244         pipe(pd);       /* Down: child -> parent */
8245         pipe(pu);       /* Up: parent -> child */
8246         if (0 != fork()) {
8247                 int ret;
8248                 close(pd[1]);   /* Parent reads from pd[0] */
8249                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
8250                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
8251                         exit(1);
8252                 signal(SIGALRM, blech);
8253                 alarm(5);
8254                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
8255                         exit(2);
8256                 sprintf(string, "%d\n", ret);
8257                 write(2, string, strlen(string));
8258                 alarm(0);
8259 #ifdef EAGAIN
8260                 if (errno == EAGAIN) {
8261                         printf("EAGAIN\n");
8262                         goto ok;
8263                 }
8264 #endif
8265 #ifdef EWOULDBLOCK
8266                 if (errno == EWOULDBLOCK)
8267                         printf("EWOULDBLOCK\n");
8268 #endif
8269         ok:
8270                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
8271                 sleep(2);                               /* Give it time to close our pipe */
8272                 alarm(5);
8273                 ret = read(pd[0], buf, 1);      /* Should read EOF */
8274                 alarm(0);
8275                 sprintf(string, "%d\n", ret);
8276                 write(3, string, strlen(string));
8277                 exit(0);
8278         }
8279
8280         close(pd[0]);                   /* We write to pd[1] */
8281         close(pu[1]);                   /* We read from pu[0] */
8282         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
8283         close(pd[1]);                   /* Pipe pd is now fully closed! */
8284         exit(0);                                /* Bye bye, thank you for playing! */
8285 }
8286 EOCP
8287         set try
8288         if eval $compile_ok; then
8289                 echo "$startsh" >mtry
8290                 echo "./try >try.out 2>try.ret 3>try.err || exit 4" >>mtry
8291                 chmod +x mtry
8292                 ./mtry >/dev/null 2>&1
8293                 case $? in
8294                 0) eagain=`$cat try.out`;;
8295                 1) echo "Could not perform non-blocking setting!";;
8296                 2) echo "I did a successful read() for something that was not there!";;
8297                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
8298                 *) echo "Something terribly wrong happened during testing.";;
8299                 esac
8300                 rd_nodata=`$cat try.ret`
8301                 echo "A read() system call with no data present returns $rd_nodata."
8302                 case "$rd_nodata" in
8303                 0|-1) ;;
8304                 *)
8305                         echo "(That's peculiar, fixing that to be -1.)"
8306                         rd_nodata=-1
8307                         ;;
8308                 esac
8309                 case "$eagain" in
8310                 '')
8311                         echo "Forcing errno EAGAIN on read() with no data available."
8312                         eagain=EAGAIN
8313                         ;;
8314                 *)
8315                         echo "Your read() sets errno to $eagain when no data is available."
8316                         ;;
8317                 esac
8318                 status=`$cat try.err`
8319                 case "$status" in
8320                 0) echo "And it correctly returns 0 to signal EOF.";;
8321                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
8322                 *) echo "However, your read() returns '$status' on EOF??";;
8323                 esac
8324                 val="$define"
8325                 if test "$status" = "$rd_nodata"; then
8326                         echo "WARNING: you can't distinguish between EOF and no data!"
8327                         val="$undef"
8328                 fi
8329         else
8330                 echo "I can't compile the test program--assuming errno EAGAIN will do."
8331                 eagain=EAGAIN
8332         fi
8333         set d_eofnblk
8334         eval $setvar
8335         ;;
8336 *)
8337         echo "Using $hint value $eagain."
8338         echo "Your read() returns $rd_nodata when no data is present."
8339         case "$d_eofnblk" in
8340         "$define") echo "And you can see EOF because read() returns 0.";;
8341         "$undef") echo "But you can't see EOF status from read() returned value.";;
8342         *)
8343                 echo "(Assuming you can't see EOF status from read anyway.)"
8344                 d_eofnblk=$undef
8345                 ;;
8346         esac
8347         ;;
8348 esac
8349 $rm -f try try.* .out core head.c mtry
8350
8351 : see if fchmod exists
8352 set fchmod d_fchmod
8353 eval $inlibc
8354
8355 : see if fchown exists
8356 set fchown d_fchown
8357 eval $inlibc
8358
8359 : see if this is an fcntl system
8360 set fcntl d_fcntl
8361 eval $inlibc
8362
8363 : see if sys/select.h has to be included
8364 set sys/select.h i_sysselct
8365 eval $inhdr
8366
8367 : see if we should include time.h, sys/time.h, or both
8368 echo " "
8369 if test "X$timeincl" = X; then
8370         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
8371         $echo $n "I'm now running the test program...$c"
8372         $cat >try.c <<'EOCP'
8373 #include <sys/types.h>
8374 #ifdef I_TIME
8375 #include <time.h>
8376 #endif
8377 #ifdef I_SYSTIME
8378 #ifdef SYSTIMEKERNEL
8379 #define KERNEL
8380 #endif
8381 #include <sys/time.h>
8382 #endif
8383 #ifdef I_SYSSELECT
8384 #include <sys/select.h>
8385 #endif
8386 int main()
8387 {
8388         struct tm foo;
8389 #ifdef S_TIMEVAL
8390         struct timeval bar;
8391 #endif
8392 #ifdef S_TIMEZONE
8393         struct timezone tzp;
8394 #endif
8395         if (foo.tm_sec == foo.tm_sec)
8396                 exit(0);
8397 #ifdef S_TIMEVAL
8398         if (bar.tv_sec == bar.tv_sec)
8399                 exit(0);
8400 #endif
8401         exit(1);
8402 }
8403 EOCP
8404         flags=''
8405         for s_timezone in '-DS_TIMEZONE' ''; do
8406         sysselect=''
8407         for s_timeval in '-DS_TIMEVAL' ''; do
8408         for i_systimek in '' '-DSYSTIMEKERNEL'; do
8409         for i_time in '' '-DI_TIME'; do
8410         for i_systime in '-DI_SYSTIME' ''; do
8411                 case "$flags" in
8412                 '') $echo $n ".$c"
8413                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
8414                         if eval $compile; then
8415                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
8416                                 shift
8417                                 flags="$*"
8418                                 echo " "
8419                                 $echo $n "Succeeded with $flags$c"
8420                         fi
8421                         ;;
8422                 esac
8423         done
8424         done
8425         done
8426         done
8427         done
8428         timeincl=''
8429         echo " "
8430         case "$flags" in
8431         *SYSTIMEKERNEL*) i_systimek="$define"
8432                 timeincl=`./findhdr sys/time.h`
8433                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
8434         *) i_systimek="$undef";;
8435         esac
8436         case "$flags" in
8437         *I_TIME*) i_time="$define"
8438                 timeincl=`./findhdr time.h`" $timeincl"
8439                 echo "We'll include <time.h>." >&4;;
8440         *) i_time="$undef";;
8441         esac
8442         case "$flags" in
8443         *I_SYSTIME*) i_systime="$define"
8444                 timeincl=`./findhdr sys/time.h`" $timeincl"
8445                 echo "We'll include <sys/time.h>." >&4;;
8446         *) i_systime="$undef";;
8447         esac
8448         $rm -f try.c try
8449 fi
8450
8451 : check for fd_set items
8452 $cat <<EOM
8453
8454 Checking to see how well your C compiler handles fd_set and friends ...
8455 EOM
8456 $cat >fd_set.c <<EOCP
8457 #$i_systime I_SYS_TIME
8458 #$i_sysselct I_SYS_SELECT
8459 #$d_socket HAS_SOCKET
8460 #include <sys/types.h>
8461 #ifdef HAS_SOCKET
8462 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
8463 #endif
8464 #ifdef I_SYS_TIME
8465 #include <sys/time.h>
8466 #endif
8467 #ifdef I_SYS_SELECT
8468 #include <sys/select.h>
8469 #endif
8470 int main() {
8471         fd_set fds;
8472
8473 #ifdef TRYBITS
8474         if(fds.fds_bits);
8475 #endif
8476
8477 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
8478         exit(0);
8479 #else
8480         exit(1);
8481 #endif
8482 }
8483 EOCP
8484 set fd_set -DTRYBITS
8485 if eval $compile; then
8486         d_fds_bits="$define"
8487         d_fd_set="$define"
8488         echo "Well, your system knows about the normal fd_set typedef..." >&4
8489         if ./fd_set; then
8490                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
8491                 d_fd_macros="$define"
8492         else
8493                 $cat >&4 <<'EOM'
8494 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
8495 EOM
8496                 d_fd_macros="$undef"
8497         fi
8498 else
8499         $cat <<'EOM'
8500 Hmm, your compiler has some difficulty with fd_set.  Checking further...
8501 EOM
8502         set fd_set
8503         if eval $compile; then
8504                 d_fds_bits="$undef"
8505                 d_fd_set="$define"
8506                 echo "Well, your system has some sort of fd_set available..." >&4
8507                 if ./fd_set; then
8508                         echo "and you have the normal fd_set macros." >&4
8509                         d_fd_macros="$define"
8510                 else
8511                         $cat <<'EOM'
8512 but not the normal fd_set macros!  Gross!  More work for me...
8513 EOM
8514                         d_fd_macros="$undef"
8515                 fi
8516         else
8517         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
8518                 d_fd_set="$undef"
8519                 d_fds_bits="$undef"
8520                 d_fd_macros="$undef"
8521         fi
8522 fi
8523 $rm -f fd_set*
8524
8525 : see if fgetpos exists
8526 set fgetpos d_fgetpos
8527 eval $inlibc
8528
8529 : see if flock exists
8530 set flock d_flock
8531 eval $inlibc
8532
8533 : see if fork exists
8534 set fork d_fork
8535 eval $inlibc
8536
8537 : see if pathconf exists
8538 set pathconf d_pathconf
8539 eval $inlibc
8540
8541 : see if fpathconf exists
8542 set fpathconf d_fpathconf
8543 eval $inlibc
8544
8545
8546 : see if llseek exists
8547 set llseek d_llseek
8548 eval $inlibc
8549
8550 : check for off64_t
8551 echo " "
8552 echo $n "Checking to see if your system supports off64_t...$c" >&4
8553 $cat >try.c <<EOCP
8554 #include <sys/types.h>
8555 #include <unistd.h>
8556 off64_t foo() { off64_t x; x = 7; return x; }'
8557 EOCP
8558 if $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then
8559         val="$define"
8560         echo " Yup, it does." >&4
8561 else
8562         val="$undef"
8563         echo " Nope, it doesn't." >&4
8564 fi
8565 $rm -f try.*
8566 set d_off64_t
8567 eval $setvar
8568
8569 : check for fpos64_t
8570 echo " "
8571 echo $n "Checking to see if your system supports fpos64_t...$c" >&4
8572 $cat >try.c <<EOCP
8573 #include <sys/stdio.h>
8574 fpos64_t foo() { fpos64_t x; x = 7; return x; }'
8575 EOCP
8576 if $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then
8577         val="$define"
8578         echo " Yup, it does." >&4
8579 else
8580         val="$undef"
8581         echo " Nope, it doesn't." >&4
8582 fi
8583 $rm -f try.*
8584 set d_fpos64_t
8585 eval $setvar
8586
8587 : see if fseeko exists
8588 set fseeko d_fseeko
8589 eval $inlibc
8590
8591 : see if fsetpos exists
8592 set fsetpos d_fsetpos
8593 eval $inlibc
8594
8595 : see if this is a sys/param system
8596 set sys/param.h i_sysparam
8597 eval $inhdr
8598
8599 : see if this is a sys/mount.h system
8600 set sys/mount.h i_sysmount
8601 eval $inhdr
8602
8603
8604 : see if statfs exists
8605 set statfs d_statfs
8606 eval $inlibc
8607
8608 : see if fstatfs exists
8609 set fstatfs d_fstatfs
8610 eval $inlibc
8611
8612 : see if statfs knows about mount flags
8613 set d_statfsflags statfs f_flags $i_sysparam sys/param.h $i_sysmount sys/mount.h
8614 eval $hasfield
8615
8616
8617 : see if statvfs exists
8618 set statvfs d_statvfs
8619 eval $inlibc
8620
8621 : see if fstatvfs exists
8622 set fstatvfs d_fstatvfs
8623 eval $inlibc
8624
8625
8626 : see if ftello exists
8627 set ftello d_ftello
8628 eval $inlibc
8629
8630 : see if getgrent exists
8631 set getgrent d_getgrent
8632 eval $inlibc
8633
8634 : see if gethostbyaddr exists
8635 set gethostbyaddr d_gethbyaddr
8636 eval $inlibc
8637
8638 : see if gethostbyname exists
8639 set gethostbyname d_gethbyname
8640 eval $inlibc
8641
8642 : see if gethostent exists
8643 set gethostent d_gethent
8644 eval $inlibc
8645
8646 : see how we will look up host name
8647 echo " "
8648 call=''
8649 if set gethostname val -f d_gethname; eval $csym; $val; then
8650         echo 'gethostname() found.' >&4
8651         d_gethname="$define"
8652         call=gethostname
8653 fi
8654 if set uname val -f d_uname; eval $csym; $val; then
8655         if ./xenix; then
8656                 $cat <<'EOM'
8657 uname() was found, but you're running xenix, and older versions of xenix
8658 have a broken uname(). If you don't really know whether your xenix is old
8659 enough to have a broken system call, use the default answer.
8660
8661 EOM
8662                 dflt=y
8663                 case "$d_uname" in
8664                 "$define") dflt=n;;
8665                 esac
8666                 rp='Is your uname() broken?'
8667                 . ./myread
8668                 case "$ans" in
8669                 n*) d_uname="$define"; call=uname;;
8670                 esac
8671         else
8672                 echo 'uname() found.' >&4
8673                 d_uname="$define"
8674                 case "$call" in
8675                 '') call=uname ;;
8676                 esac
8677         fi
8678 fi
8679 case "$d_gethname" in
8680 '') d_gethname="$undef";;
8681 esac
8682 case "$d_uname" in
8683 '') d_uname="$undef";;
8684 esac
8685 case "$d_uname$d_gethname" in
8686 *define*)
8687         dflt=n
8688         cat <<EOM
8689  
8690 Every now and then someone has a $call() that lies about the hostname
8691 but can't be fixed for political or economic reasons.  If you wish, I can
8692 pretend $call() isn't there and maybe compute hostname at run-time
8693 thanks to the '$phostname' command.
8694
8695 EOM
8696         rp="Shall I ignore $call() from now on?"
8697         . ./myread
8698         case "$ans" in
8699         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
8700         esac;;
8701 esac
8702 case "$phostname" in
8703 '') aphostname='';;
8704 *) case "$aphostname" in
8705         /*) ;;
8706         *) set X $phostname
8707                 shift
8708                 file=$1
8709                 shift
8710                 file=`./loc $file $file $pth`
8711                 aphostname=`echo $file $*`
8712                 ;;
8713         esac
8714         ;;
8715 esac
8716 case "$d_uname$d_gethname" in
8717 *define*) ;;
8718 *)
8719         case "$phostname" in
8720         '')
8721                 echo "There will be no way for $package to get your hostname." >&4;;
8722         *)
8723         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
8724                 ;;
8725         esac;;
8726 esac
8727 case "$d_phostname" in
8728 '') d_phostname="$undef";;
8729 esac
8730
8731 : see if this is a netdb.h system
8732 set netdb.h i_netdb
8733 eval $inhdr
8734
8735 : see if prototypes for various gethostxxx netdb.h functions are available
8736 echo " "
8737 set d_gethostprotos gethostent $i_netdb netdb.h
8738 eval $hasproto
8739
8740 : see if getlogin exists
8741 set getlogin d_getlogin
8742 eval $inlibc
8743
8744 : see if getmntent exists
8745 set getmntent d_getmntent
8746 eval $inlibc
8747
8748 : see if getnetbyaddr exists
8749 set getnetbyaddr d_getnbyaddr
8750 eval $inlibc
8751
8752 : see if getnetbyname exists
8753 set getnetbyname d_getnbyname
8754 eval $inlibc
8755
8756 : see if getnetent exists
8757 set getnetent d_getnent
8758 eval $inlibc
8759
8760 : see if prototypes for various getnetxxx netdb.h functions are available
8761 echo " "
8762 set d_getnetprotos getnetent $i_netdb netdb.h
8763 eval $hasproto
8764
8765
8766 : see if getprotobyname exists
8767 set getprotobyname d_getpbyname
8768 eval $inlibc
8769
8770 : see if getprotobynumber exists
8771 set getprotobynumber d_getpbynumber
8772 eval $inlibc
8773
8774 : see if getprotoent exists
8775 set getprotoent d_getpent
8776 eval $inlibc
8777
8778 : see if getpgid exists
8779 set getpgid d_getpgid
8780 eval $inlibc
8781
8782 : see if getpgrp2 exists
8783 set getpgrp2 d_getpgrp2
8784 eval $inlibc
8785
8786 : see if getppid exists
8787 set getppid d_getppid
8788 eval $inlibc
8789
8790 : see if getpriority exists
8791 set getpriority d_getprior
8792 eval $inlibc
8793
8794 : see if prototypes for various getprotoxxx netdb.h functions are available
8795 echo " "
8796 set d_getprotoprotos getprotoent $i_netdb netdb.h
8797 eval $hasproto
8798
8799 : see if getpwent exists
8800 set getpwent d_getpwent
8801 eval $inlibc
8802
8803
8804 : see if getservbyname exists
8805 set getservbyname d_getsbyname
8806 eval $inlibc
8807
8808 : see if getservbyport exists
8809 set getservbyport d_getsbyport
8810 eval $inlibc
8811
8812 : see if getservent exists
8813 set getservent d_getsent
8814 eval $inlibc
8815
8816 : see if prototypes for various getservxxx netdb.h functions are available
8817 echo " "
8818 set d_getservprotos getservent $i_netdb netdb.h
8819 eval $hasproto
8820
8821 : see if getspent exists
8822 set getspent d_getspent
8823 eval $inlibc
8824
8825 : see if getspnam exists
8826 set getspnam d_getspnam
8827 eval $inlibc
8828
8829 : see if gettimeofday or ftime exists
8830 set gettimeofday d_gettimeod
8831 eval $inlibc
8832 case "$d_gettimeod" in
8833 "$undef")
8834         set ftime d_ftime 
8835         eval $inlibc
8836         ;;
8837 *)
8838         val="$undef"; set d_ftime; eval $setvar
8839         ;;
8840 esac
8841 case "$d_gettimeod$d_ftime" in
8842 "$undef$undef")
8843         echo " "
8844         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
8845         ;;
8846 esac
8847
8848 : see if this is an grp system
8849 set grp.h i_grp
8850 eval $inhdr
8851
8852 case "$i_grp" in
8853 $define)
8854         xxx=`./findhdr grp.h`
8855         $cppstdin $cppflags $cppminus < $xxx >$$.h
8856
8857         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
8858                 val="$define"
8859         else
8860                 val="$undef"
8861         fi
8862         set d_grpasswd
8863         eval $setvar
8864
8865         $rm -f $$.h
8866         ;;
8867 *)
8868         val="$undef";
8869         set d_grpasswd; eval $setvar
8870         ;;
8871 esac
8872
8873 : see if hasmntopt exists
8874 set hasmntopt d_hasmntopt
8875 eval $inlibc
8876
8877 : see if this is a netinet/in.h or sys/in.h system
8878 set netinet/in.h i_niin sys/in.h i_sysin
8879 eval $inhdr
8880
8881 : see if arpa/inet.h has to be included
8882 set arpa/inet.h i_arpainet
8883 eval $inhdr
8884
8885 : see if htonl --and friends-- exists
8886 val=''
8887 set htonl val
8888 eval $inlibc
8889
8890 : Maybe they are macros.
8891 case "$val" in
8892 $undef)
8893         $cat >htonl.c <<EOM
8894 #include <stdio.h>
8895 #include <sys/types.h>
8896 #$i_niin I_NETINET_IN
8897 #$i_sysin I_SYS_IN
8898 #$i_arpainet I_ARPA_INET
8899 #ifdef I_NETINET_IN
8900 #include <netinet/in.h>
8901 #endif
8902 #ifdef I_SYS_IN
8903 #include <sys/in.h>
8904 #endif
8905 #ifdef I_ARPA_INET
8906 #include <arpa/inet.h>
8907 #endif
8908 #ifdef htonl
8909 printf("Defined as a macro.");
8910 #endif
8911 EOM
8912         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
8913         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
8914                 val="$define"
8915                 echo "But it seems to be defined as a macro." >&4
8916         fi
8917         $rm -f htonl.?
8918         ;;
8919 esac
8920 set d_htonl
8921 eval $setvar
8922
8923 : see which of string.h or strings.h is needed
8924 echo " "
8925 strings=`./findhdr string.h`
8926 if $test "$strings" && $test -r "$strings"; then
8927         echo "Using <string.h> instead of <strings.h>." >&4
8928         val="$define"
8929 else
8930         val="$undef"
8931         strings=`./findhdr strings.h`
8932         if $test "$strings" && $test -r "$strings"; then
8933                 echo "Using <strings.h> instead of <string.h>." >&4
8934         else
8935                 echo "No string header found -- You'll surely have problems." >&4
8936         fi
8937 fi
8938 set i_string
8939 eval $setvar
8940 case "$i_string" in
8941 "$undef") strings=`./findhdr strings.h`;;
8942 *)        strings=`./findhdr string.h`;;
8943 esac
8944
8945 : index or strchr
8946 echo " "
8947 if set index val -f; eval $csym; $val; then
8948         if set strchr val -f d_strchr; eval $csym; $val; then
8949                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
8950                         val="$define"
8951                         vali="$undef"
8952                         echo "strchr() found." >&4
8953                 else
8954                         val="$undef"
8955                         vali="$define"
8956                         echo "index() found." >&4
8957                 fi
8958         else
8959                 val="$undef"
8960                 vali="$define"
8961                 echo "index() found." >&4
8962         fi
8963 else
8964         if set strchr val -f d_strchr; eval $csym; $val; then
8965                 val="$define"
8966                 vali="$undef"
8967                 echo "strchr() found." >&4
8968         else
8969                 echo "No index() or strchr() found!" >&4
8970                 val="$undef"
8971                 vali="$undef"
8972         fi
8973 fi
8974 set d_strchr; eval $setvar
8975 val="$vali"
8976 set d_index; eval $setvar
8977
8978 : check whether inet_aton exists
8979 set inet_aton d_inetaton
8980 eval $inlibc
8981
8982 : Look for isascii
8983 echo " "
8984 $cat >isascii.c <<'EOCP'
8985 #include <stdio.h>
8986 #include <ctype.h>
8987 int main() {
8988         int c = 'A';
8989         if (isascii(c))
8990                 exit(0);
8991         else
8992                 exit(1);
8993 }
8994 EOCP
8995 set isascii
8996 if eval $compile; then
8997         echo "isascii() found." >&4
8998         val="$define"
8999 else
9000         echo "isascii() NOT found." >&4
9001         val="$undef"
9002 fi
9003 set d_isascii
9004 eval $setvar
9005 $rm -f isascii*
9006
9007 : see if killpg exists
9008 set killpg d_killpg
9009 eval $inlibc
9010
9011 : see if lchown exists
9012 echo " "
9013 $cat > try.c <<'EOCP'
9014 /* System header to define __stub macros and hopefully few prototypes,
9015     which can conflict with char lchown(); below.  */
9016 #include <assert.h>
9017 /* Override any gcc2 internal prototype to avoid an error.  */
9018 /* We use char because int might match the return type of a gcc2
9019    builtin and then its argument prototype would still apply.  */
9020 char lchown();
9021 int main() {
9022     /*  The GNU C library defines this for functions which it implements
9023         to always fail with ENOSYS.  Some functions are actually named
9024         something starting with __ and the normal name is an alias.  */
9025 #if defined (__stub_lchown) || defined (__stub___lchown)
9026 choke me
9027 #else
9028 lchown();
9029 #endif
9030 ; return 0; }
9031 EOCP
9032 set try
9033 if eval $compile; then
9034     $echo "lchown() found." >&4
9035     val="$define"
9036 else
9037     $echo "lchown() NOT found." >&4
9038     val="$undef"
9039 fi
9040 set d_lchown
9041 eval $setvar
9042
9043 : See if number of significant digits in a double precision number is known
9044 echo " "
9045 $cat >ldbl_dig.c <<EOM
9046 #$i_limits I_LIMITS
9047 #$i_float I_FLOAT
9048 #ifdef I_LIMITS
9049 #include <limits.h>
9050 #endif
9051 #ifdef I_FLOAT
9052 #include <float.h>
9053 #endif
9054 #ifdef LDBL_DIG
9055 printf("Contains LDBL_DIG");
9056 #endif
9057 EOM
9058 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
9059 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
9060         echo "LDBL_DIG found." >&4
9061         val="$define"
9062 else
9063         echo "LDBL_DIG NOT found." >&4
9064         val="$undef"
9065 fi
9066 $rm -f ldbl_dig.?
9067 set d_ldbl_dig
9068 eval $setvar
9069
9070 : see if link exists
9071 set link d_link
9072 eval $inlibc
9073
9074 : see if localeconv exists
9075 set localeconv d_locconv
9076 eval $inlibc
9077
9078 : see if lockf exists
9079 set lockf d_lockf
9080 eval $inlibc
9081
9082 : see if lstat exists
9083 set lstat d_lstat
9084 eval $inlibc
9085
9086 : see if madvise exists
9087 set madvise d_madvise
9088 eval $inlibc
9089
9090 : see if mblen exists
9091 set mblen d_mblen
9092 eval $inlibc
9093
9094 : see if mbstowcs exists
9095 set mbstowcs d_mbstowcs
9096 eval $inlibc
9097
9098 : see if mbtowc exists
9099 set mbtowc d_mbtowc
9100 eval $inlibc
9101
9102 : see if memchr exists
9103 set memchr d_memchr
9104 eval $inlibc
9105
9106 : see if memcmp exists
9107 set memcmp d_memcmp
9108 eval $inlibc
9109
9110 : see if memcpy exists
9111 set memcpy d_memcpy
9112 eval $inlibc
9113
9114 : see if memmove exists
9115 set memmove d_memmove
9116 eval $inlibc
9117
9118 : see if memset exists
9119 set memset d_memset
9120 eval $inlibc
9121
9122 : see if mkdir exists
9123 set mkdir d_mkdir
9124 eval $inlibc
9125
9126 : see if mkfifo exists
9127 set mkfifo d_mkfifo
9128 eval $inlibc
9129
9130 : see if mktime exists
9131 set mktime d_mktime
9132 eval $inlibc
9133
9134 : see if this is a sys/mman.h system
9135 set sys/mman.h i_sysmman
9136 eval $inhdr
9137
9138 : see if mmap exists
9139 set mmap d_mmap
9140 eval $inlibc
9141 : see what shmat returns
9142 : default to something harmless
9143 mmaptype='void *'
9144 case "$i_sysmman$d_mmap" in
9145 "$define$define")
9146         $cat >mmap.c <<'END'
9147 #include <sys/mman.h>
9148 void *mmap();
9149 END
9150         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
9151                 mmaptype='void *'
9152         else
9153                 mmaptype='caddr_t'
9154         fi
9155         echo "and it returns ($mmaptype)." >&4
9156         ;;
9157 esac
9158
9159
9160
9161 : see if mprotect exists
9162 set mprotect d_mprotect
9163 eval $inlibc
9164
9165 : see if msgctl exists
9166 set msgctl d_msgctl
9167 eval $inlibc
9168
9169 : see if msgget exists
9170 set msgget d_msgget
9171 eval $inlibc
9172
9173 : see if msgsnd exists
9174 set msgsnd d_msgsnd
9175 eval $inlibc
9176
9177 : see if msgrcv exists
9178 set msgrcv d_msgrcv
9179 eval $inlibc
9180
9181 : see how much of the 'msg*(2)' library is present.
9182 h_msg=true
9183 echo " "
9184 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
9185 *"$undef"*) h_msg=false;;
9186 esac
9187 case "$osname" in
9188 freebsd)
9189     case "`ipcs 2>&1`" in
9190     "SVID messages"*"not configured"*)
9191         echo "Your $osname does not have the msg*(2) configured." >&4
9192         h_msg=false
9193         val="$undef"
9194         set msgctl d_msgctl
9195         eval $setvar
9196         set msgget d_msgget
9197         eval $setvar
9198         set msgsnd d_msgsnd
9199         eval $setvar
9200         set msgrcv d_msgrcv
9201         eval $setvar
9202         ;;
9203     esac
9204     ;;
9205 esac
9206 : we could also check for sys/ipc.h ...
9207 if $h_msg && $test `./findhdr sys/msg.h`; then
9208         echo "You have the full msg*(2) library." >&4
9209         val="$define"
9210 else
9211         echo "You don't have the full msg*(2) library." >&4
9212         val="$undef"
9213 fi
9214 set d_msg
9215 eval $setvar
9216
9217 : see if msync exists
9218 set msync d_msync
9219 eval $inlibc
9220
9221 : see if munmap exists
9222 set munmap d_munmap
9223 eval $inlibc
9224
9225 : see if nice exists
9226 set nice d_nice
9227 eval $inlibc
9228
9229 : see if POSIX threads are available
9230 set pthread.h i_pthread
9231 eval $inhdr
9232
9233
9234
9235
9236 : how to create joinable pthreads
9237 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
9238         echo " "
9239         echo "Checking what constant to use for creating joinable pthreads..." >&4 
9240         $cat >try.c <<'EOCP'
9241 #include <pthread.h>
9242 int main() {
9243     int detachstate = JOINABLE;
9244 }
9245 EOCP
9246         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
9247         if eval $compile; then
9248                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
9249                 val="$undef" # Yes, undef.
9250                 set d_old_pthread_create_joinable
9251                 eval $setvar
9252                 val=""
9253                 set old_pthread_create_joinable
9254                 eval $setvar
9255         else
9256                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
9257                 if eval $compile; then
9258                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
9259                         val="$define"
9260                         set d_old_pthread_create_joinable
9261                         eval $setvar
9262                         val=PTHREAD_CREATE_UNDETACHED
9263                         set old_pthread_create_joinable
9264                         eval $setvar
9265                 else            
9266                         set try -DJOINABLE=__UNDETACHED
9267                         if eval $compile; then
9268                                 echo "You seem to use __UNDETACHED." >&4
9269                                 val="$define"
9270                                 set d_old_pthread_create_joinable
9271                                 eval $setvar
9272                                 val=__UNDETACHED
9273                                 set old_pthread_create_joinable
9274                                 eval $setvar
9275                         else
9276                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
9277                                 val="$define"
9278                                 set d_old_pthread_create_joinable
9279                                 eval $setvar
9280                                 val=0
9281                                 set old_pthread_create_joinable
9282                                 eval $setvar
9283                         fi
9284                 fi
9285         fi
9286         $rm -f try try.*
9287 else
9288     d_old_pthread_create_joinable="$undef"
9289     old_pthread_create_joinable=""
9290 fi
9291
9292 : see if pause exists
9293 set pause d_pause
9294 eval $inlibc
9295
9296 : see if pipe exists
9297 set pipe d_pipe
9298 eval $inlibc
9299
9300 : see if poll exists
9301 set poll d_poll
9302 eval $inlibc
9303
9304
9305 : see whether the various POSIXish _yields exist
9306 $cat >try.c <<EOP
9307 #include <pthread.h>
9308 #include <stdio.h>
9309 int main() {
9310 #ifdef SCHED_YIELD
9311         sched_yield();
9312 #else
9313 #ifdef PTHREAD_YIELD
9314         pthread_yield();
9315 #else
9316 #ifdef PTHREAD_YIELD_NULL
9317         pthread_yield(NULL);
9318 #endif
9319 #endif
9320 #endif
9321 }
9322 EOP
9323 : see if sched_yield exists
9324 set try -DSCHED_YIELD
9325 if eval $compile; then
9326     val="$define"
9327     sched_yield='sched_yield()'
9328 else
9329     val="$undef"
9330 fi
9331 case "$usethreads" in
9332 $define)
9333         case "$val" in
9334         $define) echo 'sched_yield() found.' >&4        ;;
9335         *)       echo 'sched_yield() NOT found.' >&4    ;;
9336         esac
9337 esac
9338 set d_sched_yield
9339 eval $setvar
9340
9341 : see if pthread_yield exists
9342 set try -DPTHREAD_YIELD
9343 if eval $compile; then
9344     val="$define"
9345     case "$sched_yield" in
9346     '') sched_yield='pthread_yield()' ;;
9347     esac
9348 else
9349     set try -DPTHREAD_YIELD_NULL
9350     if eval $compile; then
9351         val="$define"
9352         case "$sched_yield" in
9353         '') sched_yield='pthread_yield(NULL)' ;;
9354         esac
9355     else
9356         val="$undef"
9357     fi
9358 fi
9359 case "$usethreads" in
9360 $define)
9361         case "$val" in
9362         $define) echo 'pthread_yield() found.' >&4      ;;
9363         *)       echo 'pthread_yield() NOT found.' >&4  ;;
9364         esac
9365         ;;
9366 esac
9367 set d_pthread_yield
9368 eval $setvar
9369
9370 case "$sched_yield" in
9371 '') sched_yield=undef ;;
9372 esac
9373
9374 $rm -f try try.*
9375
9376 : see if this is a pwd.h system
9377 set pwd.h i_pwd
9378 eval $inhdr
9379
9380 case "$i_pwd" in
9381 $define)
9382         xxx=`./findhdr pwd.h`
9383         $cppstdin $cppflags $cppminus < $xxx >$$.h
9384
9385         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
9386                 val="$define"
9387         else
9388                 val="$undef"
9389         fi
9390         set d_pwquota
9391         eval $setvar
9392
9393         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
9394                 val="$define"
9395         else
9396                 val="$undef"
9397         fi
9398         set d_pwage
9399         eval $setvar
9400
9401         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
9402                 val="$define"
9403         else
9404                 val="$undef"
9405         fi
9406         set d_pwchange
9407         eval $setvar
9408
9409         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
9410                 val="$define"
9411         else
9412                 val="$undef"
9413         fi
9414         set d_pwclass
9415         eval $setvar
9416
9417         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
9418                 val="$define"
9419         else
9420                 val="$undef"
9421         fi
9422         set d_pwexpire
9423         eval $setvar
9424
9425         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
9426                 val="$define"
9427         else
9428                 val="$undef"
9429         fi
9430         set d_pwcomment
9431         eval $setvar
9432
9433         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
9434                 val="$define"
9435         else
9436                 val="$undef"
9437         fi
9438         set d_pwgecos
9439         eval $setvar
9440
9441         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
9442                 val="$define"
9443         else
9444                 val="$undef"
9445         fi
9446         set d_pwpasswd
9447         eval $setvar
9448
9449         $rm -f $$.h
9450         ;;
9451 *)
9452         val="$undef"; 
9453         set d_pwquota; eval $setvar
9454         set d_pwage; eval $setvar
9455         set d_pwchange; eval $setvar
9456         set d_pwclass; eval $setvar
9457         set d_pwexpire; eval $setvar
9458         set d_pwcomment; eval $setvar
9459         set d_pwgecos; eval $setvar
9460         set d_pwpasswd; eval $setvar
9461         ;;
9462 esac
9463
9464 : see if readdir and friends exist
9465 set readdir d_readdir
9466 eval $inlibc
9467 set seekdir d_seekdir
9468 eval $inlibc
9469 set telldir d_telldir
9470 eval $inlibc
9471 set rewinddir d_rewinddir
9472 eval $inlibc
9473
9474 : see if readlink exists
9475 set readlink d_readlink
9476 eval $inlibc
9477
9478 : see if readv exists
9479 set readv d_readv
9480 eval $inlibc
9481
9482 : see if rename exists
9483 set rename d_rename
9484 eval $inlibc
9485
9486 : see if rmdir exists
9487 set rmdir d_rmdir
9488 eval $inlibc
9489
9490 : see if memory.h is available.
9491 val=''
9492 set memory.h val
9493 eval $inhdr
9494
9495 : See if it conflicts with string.h
9496 case "$val" in
9497 $define)
9498         case "$strings" in
9499         '') ;;
9500         *)
9501                 $cppstdin $cppflags $cppminus < $strings > mem.h
9502                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
9503                         echo " "
9504                         echo "We won't be including <memory.h>."
9505                         val="$undef"
9506                 fi
9507                 $rm -f mem.h
9508                 ;;
9509         esac
9510 esac
9511 set i_memory
9512 eval $setvar
9513
9514 : can bcopy handle overlapping blocks?
9515 val="$undef"
9516 case "$d_bcopy" in
9517 "$define")
9518         echo " "
9519         echo "Checking to see if your bcopy() can do overlapping copies..." >&4
9520         $cat >try.c <<EOCP
9521 #$i_memory I_MEMORY
9522 #$i_stdlib I_STDLIB
9523 #$i_string I_STRING
9524 #$i_unistd I_UNISTD
9525 EOCP
9526         $cat >>try.c <<'EOCP'
9527 #include <stdio.h>
9528 #ifdef I_MEMORY
9529 #  include <memory.h>
9530 #endif
9531 #ifdef I_STDLIB
9532 #  include <stdlib.h>
9533 #endif
9534 #ifdef I_STRING
9535 #  include <string.h>
9536 #else
9537 #  include <strings.h>
9538 #endif
9539 #ifdef I_UNISTD
9540 #  include <unistd.h>  /* Needed for NetBSD */
9541 #endif
9542 int main()
9543 {
9544 char buf[128], abc[128];
9545 char *b;
9546 int len;
9547 int off;
9548 int align;
9549
9550 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
9551
9552 for (align = 7; align >= 0; align--) {
9553         for (len = 36; len; len--) {
9554                 b = buf+align;
9555                 bcopy(abc, b, len);
9556                 for (off = 1; off <= len; off++) {
9557                         bcopy(b, b+off, len);
9558                         bcopy(b+off, b, len);
9559                         if (bcmp(b, abc, len))
9560                                 exit(1);
9561                 }
9562         }
9563 }
9564 exit(0);
9565 }
9566 EOCP
9567         set try
9568         if eval $compile_ok; then
9569                 if ./try 2>/dev/null; then
9570                         echo "Yes, it can."
9571                         val="$define"
9572                 else
9573                         echo "It can't, sorry."
9574                         case "$d_memmove" in
9575                         "$define") echo "But that's Ok since you have memmove()." ;;
9576                         esac
9577                 fi
9578         else
9579                 echo "(I can't compile the test program, so we'll assume not...)"
9580                 case "$d_memmove" in
9581                 "$define") echo "But that's Ok since you have memmove()." ;;
9582                 esac
9583         fi
9584         ;;
9585 esac
9586 $rm -f try.* try core
9587 set d_safebcpy
9588 eval $setvar
9589
9590 : can memcpy handle overlapping blocks?
9591 val="$undef"
9592 case "$d_memcpy" in
9593 "$define")
9594         echo " "
9595         echo "Checking to see if your memcpy() can do overlapping copies..." >&4
9596         $cat >try.c <<EOCP
9597 #$i_memory I_MEMORY
9598 #$i_stdlib I_STDLIB
9599 #$i_string I_STRING
9600 #$i_unistd I_UNISTD
9601 EOCP
9602         $cat >>try.c <<'EOCP'
9603 #include <stdio.h>
9604 #ifdef I_MEMORY
9605 #  include <memory.h>
9606 #endif
9607 #ifdef I_STDLIB
9608 #  include <stdlib.h>
9609 #endif
9610 #ifdef I_STRING
9611 #  include <string.h>
9612 #else
9613 #  include <strings.h>
9614 #endif
9615 #ifdef I_UNISTD
9616 #  include <unistd.h>  /* Needed for NetBSD */
9617 #endif
9618 int main()
9619 {
9620 char buf[128], abc[128];
9621 char *b;
9622 int len;
9623 int off;
9624 int align;
9625
9626 /* Copy "abcde..." string to char abc[] so that gcc doesn't
9627    try to store the string in read-only memory. */
9628 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
9629
9630 for (align = 7; align >= 0; align--) {
9631         for (len = 36; len; len--) {
9632                 b = buf+align;
9633                 memcpy(b, abc, len);
9634                 for (off = 1; off <= len; off++) {
9635                         memcpy(b+off, b, len);
9636                         memcpy(b, b+off, len);
9637                         if (memcmp(b, abc, len))
9638                                 exit(1);
9639                 }
9640         }
9641 }
9642 exit(0);
9643 }
9644 EOCP
9645         set try
9646         if eval $compile_ok; then
9647                 if ./try 2>/dev/null; then
9648                         echo "Yes, it can."
9649                         val="$define"
9650                 else
9651                         echo "It can't, sorry."
9652                         case "$d_memmove" in
9653                         "$define") echo "But that's Ok since you have memmove()." ;;
9654                         esac
9655                 fi
9656         else
9657                 echo "(I can't compile the test program, so we'll assume not...)"
9658                 case "$d_memmove" in
9659                 "$define") echo "But that's Ok since you have memmove()." ;;
9660                 esac
9661         fi
9662         ;;
9663 esac
9664 $rm -f try.* try core
9665 set d_safemcpy
9666 eval $setvar
9667
9668 : can memcmp be trusted to compare relative magnitude?
9669 val="$undef"
9670 case "$d_memcmp" in
9671 "$define")
9672         echo " "
9673         echo "Checking if your memcmp() can compare relative magnitude..." >&4
9674         $cat >try.c <<EOCP
9675 #$i_memory I_MEMORY
9676 #$i_stdlib I_STDLIB
9677 #$i_string I_STRING
9678 #$i_unistd I_UNISTD
9679 EOCP
9680         $cat >>try.c <<'EOCP'
9681 #include <stdio.h>
9682 #ifdef I_MEMORY
9683 #  include <memory.h>
9684 #endif
9685 #ifdef I_STDLIB
9686 #  include <stdlib.h>
9687 #endif
9688 #ifdef I_STRING
9689 #  include <string.h>
9690 #else
9691 #  include <strings.h>
9692 #endif
9693 #ifdef I_UNISTD
9694 #  include <unistd.h>  /* Needed for NetBSD */
9695 #endif
9696 int main()
9697 {
9698 char a = -1;
9699 char b = 0;
9700 if ((a < b) && memcmp(&a, &b, 1) < 0)
9701         exit(1);
9702 exit(0);
9703 }
9704 EOCP
9705         set try
9706         if eval $compile_ok; then
9707                 if ./try 2>/dev/null; then
9708                         echo "Yes, it can."
9709                         val="$define"
9710                 else
9711                         echo "No, it can't (it uses signed chars)."
9712                 fi
9713         else
9714                 echo "(I can't compile the test program, so we'll assume not...)"
9715         fi
9716         ;;
9717 esac
9718 $rm -f try.* try core
9719 set d_sanemcmp
9720 eval $setvar
9721
9722 : see if select exists
9723 set select d_select
9724 eval $inlibc
9725
9726 : see if semctl exists
9727 set semctl d_semctl
9728 eval $inlibc
9729
9730 : see if semget exists
9731 set semget d_semget
9732 eval $inlibc
9733
9734 : see if semop exists
9735 set semop d_semop
9736 eval $inlibc
9737
9738 : see how much of the 'sem*(2)' library is present.
9739 h_sem=true
9740 echo " "
9741 case "$d_semctl$d_semget$d_semop" in
9742 *"$undef"*) h_sem=false;;
9743 esac
9744 case "$osname" in
9745 freebsd)
9746     case "`ipcs 2>&1`" in
9747     "SVID messages"*"not configured"*)
9748         echo "Your $osname does not have the sem*(2) configured." >&4
9749         h_sem=false
9750         val="$undef"
9751         set semctl d_semctl
9752         eval $setvar
9753         set semget d_semget
9754         eval $setvar
9755         set semop d_semop
9756         eval $setvar
9757         ;;
9758     esac
9759     ;;
9760 esac
9761 : we could also check for sys/ipc.h ...
9762 if $h_sem && $test `./findhdr sys/sem.h`; then
9763         echo "You have the full sem*(2) library." >&4
9764         val="$define"
9765 else
9766         echo "You don't have the full sem*(2) library." >&4
9767         val="$undef"
9768 fi
9769 set d_sem
9770 eval $setvar
9771
9772 : see whether sys/sem.h defines union semun
9773 echo " "
9774 $cat > try.c <<'END'
9775 #include <sys/types.h>
9776 #include <sys/ipc.h>
9777 #include <sys/sem.h>
9778 int main () { union semun semun; semun.buf = 0; }
9779 END
9780 set try
9781 if eval $compile; then
9782     echo "You have union semun in <sys/sem.h>." >&4
9783     val="$define"
9784 else
9785     echo "You do not have union semun in <sys/sem.h>." >&4
9786     val="$undef"
9787 fi
9788 $rm -f try try.c try.h
9789 set d_union_semun
9790 eval $setvar
9791
9792 : see how to do semctl IPC_STAT
9793 case "$d_sem" in
9794 $define)
9795     : see whether semctl IPC_STAT can use union semun
9796     echo " "
9797     $cat > try.h <<END
9798 #ifndef S_IRUSR
9799 #   ifdef S_IREAD
9800 #       define S_IRUSR S_IREAD
9801 #       define S_IWUSR S_IWRITE
9802 #       define S_IXUSR S_IEXEC
9803 #   else
9804 #       define S_IRUSR 0400
9805 #       define S_IWUSR 0200
9806 #       define S_IXUSR 0100
9807 #   endif
9808 #   define S_IRGRP (S_IRUSR>>3)
9809 #   define S_IWGRP (S_IWUSR>>3)
9810 #   define S_IXGRP (S_IXUSR>>3)
9811 #   define S_IROTH (S_IRUSR>>6)
9812 #   define S_IWOTH (S_IWUSR>>6)
9813 #   define S_IXOTH (S_IXUSR>>6)
9814 #endif
9815 #ifndef S_IRWXU
9816 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
9817 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
9818 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
9819 #endif
9820 END
9821
9822     $cat > try.c <<END
9823 #include <sys/types.h>
9824 #include <sys/ipc.h>
9825 #include <sys/sem.h>
9826 #include <sys/stat.h>
9827 #include <stdio.h>
9828 #include <errno.h>
9829 #include "try.h"
9830 #ifndef errno
9831 extern int errno;
9832 #endif
9833 #$d_union_semun HAS_UNION_SEMUN
9834 int main() {
9835     union semun
9836 #ifndef HAS_UNION_SEMUN
9837     {
9838         int val;
9839         struct semid_ds *buf;
9840         unsigned short *array;
9841     }
9842 #endif
9843     arg;
9844     int sem, st;
9845
9846 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
9847     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
9848     if (sem > -1) {
9849         struct semid_ds argbuf;
9850         arg.buf = &argbuf;
9851 #       ifdef IPC_STAT
9852         st = semctl(sem, 0, IPC_STAT, arg);
9853         if (st == 0)
9854             printf("semun\n");
9855         else
9856 #       endif /* IPC_STAT */
9857             printf("semctl IPC_STAT failed: errno = %d\n", errno);
9858 #       ifdef IPC_RMID
9859         if (semctl(sem, 0, IPC_RMID, arg) != 0)
9860 #       endif /* IPC_RMID */
9861             printf("semctl IPC_RMID failed: errno = %d\n", errno);
9862     } else
9863 #endif /* IPC_PRIVATE && ... */
9864         printf("semget failed: errno = %d\n", errno);
9865   return 0;
9866 }
9867 END
9868     val="$undef"
9869     set try
9870     if eval $compile; then
9871         xxx=`./try`
9872         case "$xxx" in
9873         semun) val="$define" ;;
9874         esac
9875     fi
9876     $rm -f try try.c
9877     set d_semctl_semun
9878     eval $setvar
9879     case "$d_semctl_semun" in
9880     $define)
9881         echo "You can use union semun for semctl IPC_STAT." >&4
9882         also='also'
9883         ;;
9884     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
9885         also=''
9886         ;;
9887     esac
9888
9889     : see whether semctl IPC_STAT can use struct semid_ds pointer
9890     $cat > try.c <<'END'
9891 #include <sys/types.h>
9892 #include <sys/ipc.h>
9893 #include <sys/sem.h>
9894 #include <sys/stat.h>
9895 #include "try.h"
9896 #include <stdio.h>
9897 #include <errno.h>
9898 #ifndef errno
9899 extern int errno;
9900 #endif
9901 int main() {
9902     struct semid_ds arg;
9903     int sem, st;
9904
9905 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
9906     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
9907     if (sem > -1) {
9908 #       ifdef IPC_STAT
9909         st = semctl(sem, 0, IPC_STAT, &arg);
9910         if (st == 0)
9911             printf("semid_ds\n");
9912         else
9913 #       endif /* IPC_STAT */
9914             printf("semctl IPC_STAT failed: errno = %d\n", errno);
9915 #       ifdef IPC_RMID
9916         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
9917 #       endif /* IPC_RMID */
9918             printf("semctl IPC_RMID failed: errno = %d\n", errno);
9919     } else
9920 #endif /* IPC_PRIVATE && ... */
9921         printf("semget failed: errno = %d\n", errno);
9922
9923     return 0;
9924 }
9925 END
9926     val="$undef"
9927     set try
9928     if eval $compile; then
9929         xxx=`./try`
9930         case "$xxx" in
9931         semid_ds) val="$define" ;;
9932         esac
9933     fi
9934     $rm -f try try.c
9935     set d_semctl_semid_ds
9936     eval $setvar
9937     case "$d_semctl_semid_ds" in
9938     $define)
9939         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
9940         ;;
9941     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
9942         ;;
9943     esac
9944     $rm -f try.h
9945     ;;
9946 *)  val="$undef"
9947
9948     # We do not have the full sem*(2) library, so assume we can not
9949     # use either.
9950
9951     set d_semctl_semun
9952     eval $setvar
9953
9954     set d_semctl_semid_ds
9955     eval $setvar
9956     ;;
9957 esac
9958
9959 : see if setegid exists
9960 set setegid d_setegid
9961 eval $inlibc
9962
9963 : see if seteuid exists
9964 set seteuid d_seteuid
9965 eval $inlibc
9966
9967 : see if setgrent exists
9968 set setgrent d_setgrent
9969 eval $inlibc
9970
9971 : see if sethostent exists
9972 set sethostent d_sethent
9973 eval $inlibc
9974
9975 : see if setlinebuf exists
9976 set setlinebuf d_setlinebuf
9977 eval $inlibc
9978
9979 : see if setlocale exists
9980 set setlocale d_setlocale
9981 eval $inlibc
9982
9983 : see if setnetent exists
9984 set setnetent d_setnent
9985 eval $inlibc
9986
9987 : see if setprotoent exists
9988 set setprotoent d_setpent
9989 eval $inlibc
9990
9991 : see if setpgid exists
9992 set setpgid d_setpgid
9993 eval $inlibc
9994
9995 : see if setpgrp2 exists
9996 set setpgrp2 d_setpgrp2
9997 eval $inlibc
9998
9999 : see if setpriority exists
10000 set setpriority d_setprior
10001 eval $inlibc
10002
10003 : see if setpwent exists
10004 set setpwent d_setpwent
10005 eval $inlibc
10006
10007 : see if setregid exists
10008 set setregid d_setregid
10009 eval $inlibc
10010 set setresgid d_setresgid
10011 eval $inlibc
10012
10013 : see if setreuid exists
10014 set setreuid d_setreuid
10015 eval $inlibc
10016 set setresuid d_setresuid
10017 eval $inlibc
10018
10019 : see if setrgid exists
10020 set setrgid d_setrgid
10021 eval $inlibc
10022
10023 : see if setruid exists
10024 set setruid d_setruid
10025 eval $inlibc
10026
10027 : see if setservent exists
10028 set setservent d_setsent
10029 eval $inlibc
10030
10031 : see if setsid exists
10032 set setsid d_setsid
10033 eval $inlibc
10034
10035 : see if setspent exists
10036 set setspent d_setspent
10037 eval $inlibc
10038
10039 : see if setvbuf exists
10040 set setvbuf d_setvbuf
10041 eval $inlibc
10042
10043 : see if sfio.h is available
10044 set sfio.h i_sfio
10045 eval $inhdr
10046
10047
10048 : see if sfio library is available
10049 case "$i_sfio" in
10050 $define)
10051         val=''
10052         set sfreserve val
10053         eval $inlibc
10054         ;;
10055 *)
10056         val="$undef"
10057         ;;
10058 esac
10059 : Ok, but do we want to use it.
10060 case "$val" in
10061 $define)
10062         case "$usesfio" in
10063         true|$define|[yY]*) dflt='y';;
10064         *) dflt='n';;
10065         esac
10066         echo "$package can use the sfio library, but it is experimental."
10067         rp="You seem to have sfio available, do you want to try using it?"
10068         . ./myread
10069         case "$ans" in
10070         y|Y) ;;
10071         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
10072                 val="$undef"
10073                 : Remove sfio from list of libraries to use
10074                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
10075                 shift
10076                 libs="$*"
10077                 echo "libs = $libs" >&4
10078                 ;;
10079         esac
10080         ;;
10081 *)      case "$usesfio" in
10082         true|$define|[yY]*)
10083                 echo "Sorry, cannot find sfio on this machine" >&4
10084                 echo "Ignoring your setting of usesfio=$usesfio" >&4
10085                 ;;
10086         esac
10087         ;;
10088 esac
10089 set d_sfio
10090 eval $setvar
10091 case "$d_sfio" in
10092 $define) usesfio='true';;
10093 *) usesfio='false';;
10094 esac
10095
10096 : see if shmctl exists
10097 set shmctl d_shmctl
10098 eval $inlibc
10099
10100 : see if shmget exists
10101 set shmget d_shmget
10102 eval $inlibc
10103
10104 : see if shmat exists
10105 set shmat d_shmat
10106 eval $inlibc
10107 : see what shmat returns
10108 case "$d_shmat" in
10109 "$define")
10110         $cat >shmat.c <<'END'
10111 #include <sys/shm.h>
10112 void *shmat();
10113 END
10114         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
10115                 shmattype='void *'
10116         else
10117                 shmattype='char *'
10118         fi
10119         echo "and it returns ($shmattype)." >&4
10120         : see if a prototype for shmat is available
10121         xxx=`./findhdr sys/shm.h`
10122         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
10123         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
10124                 val="$define"
10125         else
10126                 val="$undef"
10127         fi
10128         $rm -f shmat.[co]
10129         ;;
10130 *)
10131         val="$undef"
10132         ;;
10133 esac
10134 set d_shmatprototype
10135 eval $setvar
10136
10137 : see if shmdt exists
10138 set shmdt d_shmdt
10139 eval $inlibc
10140
10141 : see how much of the 'shm*(2)' library is present.
10142 h_shm=true
10143 echo " "
10144 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
10145 *"$undef"*) h_shm=false;;
10146 esac
10147 case "$osname" in
10148 freebsd)
10149     case "`ipcs 2>&1`" in
10150     "SVID shared memory"*"not configured"*)
10151         echo "Your $osname does not have the shm*(2) configured." >&4
10152         h_shm=false
10153         val="$undef"
10154         set shmctl d_shmctl
10155         evat $setvar
10156         set shmget d_shmget
10157         evat $setvar
10158         set shmat d_shmat
10159         evat $setvar
10160         set shmdt d_shmdt
10161         evat $setvar
10162         ;;
10163     esac
10164     ;;
10165 esac
10166 : we could also check for sys/ipc.h ...
10167 if $h_shm && $test `./findhdr sys/shm.h`; then
10168         echo "You have the full shm*(2) library." >&4
10169         val="$define"
10170 else
10171         echo "You don't have the full shm*(2) library." >&4
10172         val="$undef"
10173 fi
10174 set d_shm
10175 eval $setvar
10176
10177 echo " "
10178 : see if we have sigaction
10179 if set sigaction val -f d_sigaction; eval $csym; $val; then
10180         echo 'sigaction() found.' >&4
10181         $cat > try.c <<'EOP'
10182 #include <stdio.h>
10183 #include <sys/types.h>
10184 #include <signal.h>
10185 int main()
10186 {
10187     struct sigaction act, oact;
10188 }
10189 EOP
10190         set try
10191         if eval $compile_ok; then
10192                 val="$define"
10193         else
10194                 echo "But you don't seem to have a useable struct sigaction." >&4
10195                 val="$undef"
10196         fi
10197 else
10198         echo 'sigaction NOT found.' >&4
10199         val="$undef"
10200 fi
10201 set d_sigaction; eval $setvar
10202 $rm -f try try$_o try.c
10203
10204 : see if sigsetjmp exists
10205 echo " "
10206 case "$d_sigsetjmp" in
10207 '')
10208         $cat >try.c <<'EOP'
10209 #include <setjmp.h>
10210 sigjmp_buf env;
10211 int set = 1;
10212 int main()
10213 {
10214         if (sigsetjmp(env,1))
10215                 exit(set);
10216         set = 0;
10217         siglongjmp(env, 1);
10218         exit(1);
10219 }
10220 EOP
10221         set try
10222         if eval $compile; then
10223                 if ./try >/dev/null 2>&1; then
10224                         echo "POSIX sigsetjmp found." >&4
10225                         val="$define"
10226                 else
10227                         $cat >&4 <<EOM
10228 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
10229 I'll ignore them.
10230 EOM
10231                         val="$undef"
10232                 fi
10233         else
10234                 echo "sigsetjmp not found." >&4
10235                 val="$undef"
10236         fi
10237         ;;
10238 *) val="$d_sigsetjmp"
10239         case "$d_sigsetjmp" in
10240         $define) echo "POSIX sigsetjmp found." >&4;;
10241         $undef) echo "sigsetjmp not found." >&4;;
10242         esac
10243         ;;
10244 esac
10245 set d_sigsetjmp
10246 eval $setvar
10247 $rm -f try.c try
10248
10249 : see if sys/stat.h is available
10250 set sys/stat.h i_sysstat
10251 eval $inhdr
10252
10253 : see if stat knows about block sizes
10254 echo " "
10255 set d_statblks stat st_blocks $i_sysstat sys/stat.h
10256 eval $hasfield
10257
10258 : see if _ptr and _cnt from stdio act std
10259 echo " "
10260 if $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
10261         echo "(Looks like you have stdio.h from Linux.)"
10262         case "$stdio_ptr" in
10263         '') stdio_ptr='((fp)->_IO_read_ptr)'
10264                 ptr_lval=$define
10265                 ;;
10266         *)      ptr_lval=$d_stdio_ptr_lval;;
10267         esac
10268         case "$stdio_cnt" in
10269         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
10270                 cnt_lval=$undef
10271                 ;;
10272         *)      cnt_lval=$d_stdio_cnt_lval;;
10273         esac
10274         case "$stdio_base" in
10275         '') stdio_base='((fp)->_IO_read_base)';;
10276         esac
10277         case "$stdio_bufsiz" in
10278         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
10279         esac
10280 else
10281         case "$stdio_ptr" in
10282         '') stdio_ptr='((fp)->_ptr)'
10283                 ptr_lval=$define
10284                 ;;
10285         *)      ptr_lval=$d_stdio_ptr_lval;;
10286         esac
10287         case "$stdio_cnt" in
10288         '') stdio_cnt='((fp)->_cnt)'
10289                 cnt_lval=$define
10290                 ;;
10291         *)      cnt_lval=$d_stdio_cnt_lval;;
10292         esac
10293         case "$stdio_base" in
10294         '') stdio_base='((fp)->_base)';;
10295         esac
10296         case "$stdio_bufsiz" in
10297         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
10298         esac
10299 fi
10300 : test whether _ptr and _cnt really work
10301 echo "Checking how std your stdio is..." >&4
10302 $cat >try.c <<EOP
10303 #include <stdio.h>
10304 #define FILE_ptr(fp)    $stdio_ptr
10305 #define FILE_cnt(fp)    $stdio_cnt
10306 int main() {
10307         FILE *fp = fopen("try.c", "r");
10308         char c = getc(fp);
10309         if (
10310                 18 <= FILE_cnt(fp) &&
10311                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
10312         )
10313                 exit(0);
10314         exit(1);
10315 }
10316 EOP
10317 val="$undef"
10318 set try
10319 if eval $compile; then
10320         if ./try; then
10321                 echo "Your stdio acts pretty std."
10322                 val="$define"
10323         else
10324                 echo "Your stdio isn't very std."
10325         fi
10326 else
10327         echo "Your stdio doesn't appear very std."
10328 fi
10329 $rm -f try.c try
10330 set d_stdstdio
10331 eval $setvar
10332
10333 : Can _ptr be used as an lvalue?
10334 case "$d_stdstdio$ptr_lval" in
10335 $define$define) val=$define ;;
10336 *) val=$undef ;;
10337 esac
10338 set d_stdio_ptr_lval
10339 eval $setvar
10340
10341 : Can _cnt be used as an lvalue?
10342 case "$d_stdstdio$cnt_lval" in
10343 $define$define) val=$define ;;
10344 *) val=$undef ;;
10345 esac
10346 set d_stdio_cnt_lval
10347 eval $setvar
10348
10349 : see if _base is also standard
10350 val="$undef"
10351 case "$d_stdstdio" in
10352 $define)
10353         $cat >try.c <<EOP
10354 #include <stdio.h>
10355 #define FILE_base(fp)   $stdio_base
10356 #define FILE_bufsiz(fp) $stdio_bufsiz
10357 int main() {
10358         FILE *fp = fopen("try.c", "r");
10359         char c = getc(fp);
10360         if (
10361                 19 <= FILE_bufsiz(fp) &&
10362                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
10363         )
10364                 exit(0);
10365         exit(1);
10366 }
10367 EOP
10368         set try
10369         if eval $compile; then
10370                 if ./try; then
10371                         echo "And its _base field acts std."
10372                         val="$define"
10373                 else
10374                         echo "But its _base field isn't std."
10375                 fi
10376         else
10377                 echo "However, it seems to be lacking the _base field."
10378         fi
10379         $rm -f try.c try
10380         ;;
10381 esac
10382 set d_stdiobase
10383 eval $setvar
10384
10385 $cat >&4 <<EOM
10386 Checking how to access stdio streams by file descriptor number...
10387 EOM
10388 case "$stdio_stream_array" in
10389 '')     $cat >try.c <<EOCP
10390 #include <stdio.h>
10391 int main() {
10392   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
10393     printf("yes\n");
10394 }
10395 EOCP
10396         for s in _iob __iob __sF
10397         do
10398                 set try -DSTDIO_STREAM_ARRAY=$s
10399                 if eval $compile; then
10400                         case "`./try$exe_ext`" in
10401                         yes)    stdio_stream_array=$s; break ;;
10402                         esac
10403                 fi
10404         done
10405         $rm -f try.* try$exe_ext
10406 esac
10407 case "$stdio_stream_array" in
10408 '')     $cat >&4 <<EOM
10409 I can't figure out how to access stdio streams by file descriptor number.
10410 EOM
10411         d_stdio_stream_array="$undef"
10412         ;;
10413 *)      $cat >&4 <<EOM
10414 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
10415 EOM
10416         d_stdio_stream_array="$define"
10417         ;;
10418 esac
10419
10420 : see if strcoll exists
10421 set strcoll d_strcoll
10422 eval $inlibc
10423
10424 : check for structure copying
10425 echo " "
10426 echo "Checking to see if your C compiler can copy structs..." >&4
10427 $cat >try.c <<'EOCP'
10428 int main()
10429 {
10430         struct blurfl {
10431                 int dyick;
10432         } foo, bar;
10433
10434         foo = bar;
10435 }
10436 EOCP
10437 if $cc -c try.c >/dev/null 2>&1 ; then
10438         val="$define"
10439         echo "Yup, it can."
10440 else
10441         val="$undef"
10442         echo "Nope, it can't."
10443 fi
10444 set d_strctcpy
10445 eval $setvar
10446 $rm -f try.*
10447
10448 : see if strerror and/or sys_errlist[] exist
10449 echo " "
10450 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
10451     if set strerror val -f d_strerror; eval $csym; $val; then
10452                 echo 'strerror() found.' >&4
10453                 d_strerror="$define"
10454                 d_strerrm='strerror(e)'
10455                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
10456                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
10457                         d_syserrlst="$define"
10458                 else
10459                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
10460                         d_syserrlst="$undef"
10461                 fi
10462     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
10463                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
10464                 echo 'strerror() found in string header.' >&4
10465                 d_strerror="$define"
10466                 d_strerrm='strerror(e)'
10467                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
10468                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
10469                                 d_syserrlst="$define"
10470                 else
10471                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
10472                         d_syserrlst="$undef"
10473                 fi
10474     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
10475                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
10476                 d_strerror="$undef"
10477                 d_syserrlst="$define"
10478                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
10479     else
10480                 echo 'strerror() and sys_errlist[] NOT found.' >&4
10481                 d_strerror="$undef"
10482                 d_syserrlst="$undef"
10483                 d_strerrm='"unknown"'
10484     fi
10485 fi
10486
10487 : see if strtod exists
10488 set strtod d_strtod
10489 eval $inlibc
10490
10491 : see if strtol exists
10492 set strtol d_strtol
10493 eval $inlibc
10494
10495 : see if strtoul exists
10496 set strtoul d_strtoul
10497 eval $inlibc
10498
10499 : see if strtoull exists
10500 set strtoull d_strtoull
10501 eval $inlibc
10502
10503 : see if strxfrm exists
10504 set strxfrm d_strxfrm
10505 eval $inlibc
10506
10507 : see if symlink exists
10508 set symlink d_symlink
10509 eval $inlibc
10510
10511 : see if syscall exists
10512 set syscall d_syscall
10513 eval $inlibc
10514
10515 : see if sysconf exists
10516 set sysconf d_sysconf
10517 eval $inlibc
10518
10519 : see if system exists
10520 set system d_system
10521 eval $inlibc
10522
10523 : see if tcgetpgrp exists
10524 set tcgetpgrp d_tcgetpgrp
10525 eval $inlibc
10526
10527 : see if tcsetpgrp exists
10528 set tcsetpgrp d_tcsetpgrp
10529 eval $inlibc
10530
10531 : see if sys/types.h has to be included
10532 set sys/types.h i_systypes
10533 eval $inhdr
10534
10535 : see if prototype for telldir is available
10536 echo " "
10537 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
10538 eval $hasproto
10539
10540 : define an is-a-typedef? function
10541 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
10542 case "$inclist" in
10543 "") inclist="sys/types.h";;
10544 esac;
10545 eval "varval=\$$var";
10546 case "$varval" in
10547 "")
10548         $rm -f temp.c;
10549         for inc in $inclist; do
10550                 echo "#include <$inc>" >>temp.c;
10551         done;
10552         echo "#ifdef $type" >> temp.c;
10553         echo "printf(\"We have $type\");" >> temp.c;
10554         echo "#endif" >> temp.c;
10555         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
10556         if $contains $type temp.E >/dev/null 2>&1; then
10557                 eval "$var=\$type";
10558         else
10559                 eval "$var=\$def";
10560         fi;
10561         $rm -f temp.?;;
10562 *) eval "$var=\$varval";;
10563 esac'
10564
10565 : define an is-a-typedef? function that prompts if the type is not available.
10566 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
10567 case "$inclist" in
10568 "") inclist="sys/types.h";;
10569 esac;
10570 eval "varval=\$$var";
10571 case "$varval" in
10572 "")
10573         $rm -f temp.c;
10574         for inc in $inclist; do
10575                 echo "#include <$inc>" >>temp.c;
10576         done;
10577         echo "#ifdef $type" >> temp.c;
10578         echo "printf(\"We have $type\");" >> temp.c;
10579         echo "#endif" >> temp.c;
10580         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
10581         echo " " ;
10582         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
10583         if $contains $type temp.E >/dev/null 2>&1; then
10584                 echo "$type found." >&4;
10585                 eval "$var=\$type";
10586         else
10587                 echo "$type NOT found." >&4;
10588                 dflt="$def";
10589                 . ./myread ;
10590                 eval "$var=\$ans";
10591         fi;
10592         $rm -f temp.?;;
10593 *) eval "$var=\$varval";;
10594 esac'
10595
10596 : see if this is a sys/times.h system
10597 set sys/times.h i_systimes
10598 eval $inhdr
10599
10600 : see if times exists
10601 echo " "
10602 if set times val -f d_times; eval $csym; $val; then
10603         echo 'times() found.' >&4
10604         d_times="$define"
10605         inc=''
10606         case "$i_systimes" in
10607         "$define") inc='sys/times.h';;
10608         esac
10609         rp="What is the type returned by times() on this system?"
10610         set clock_t clocktype long stdio.h sys/types.h $inc
10611         eval $typedef_ask
10612 else
10613         echo 'times() NOT found, hope that will do.' >&4
10614         d_times="$undef"
10615         clocktype='int'
10616 fi
10617
10618 : see if truncate exists
10619 set truncate d_truncate
10620 eval $inlibc
10621
10622 : see if tzname[] exists
10623 echo " "
10624 if set tzname val -a d_tzname; eval $csym; $val; then
10625         val="$define"
10626         echo 'tzname[] found.' >&4
10627 else
10628         val="$undef"
10629         echo 'tzname[] NOT found.' >&4
10630 fi
10631 set d_tzname
10632 eval $setvar
10633
10634 : see if umask exists
10635 set umask d_umask
10636 eval $inlibc
10637
10638 : backward compatibility for d_hvfork
10639 if test X$d_hvfork != X; then
10640         d_vfork="$d_hvfork"
10641         d_hvfork=''
10642 fi
10643 : see if there is a vfork
10644 val=''
10645 set vfork val
10646 eval $inlibc
10647
10648 : Ok, but do we want to use it. vfork is reportedly unreliable in 
10649 : perl on Solaris 2.x, and probably elsewhere.
10650 case "$val" in
10651 $define)
10652         echo " "
10653         case "$usevfork" in
10654         false) dflt='n';;
10655         *) dflt='y';;
10656         esac
10657         cat <<'EOM'
10658  
10659 Perl can only use a vfork() that doesn't suffer from strict
10660 restrictions on calling functions or modifying global data in
10661 the child.  For example, glibc-2.1 contains such a vfork()
10662 that is unsuitable.  If your system provides a proper fork()
10663 call, chances are that you do NOT want perl to use vfork().
10664
10665 EOM
10666         rp="Do you still want to use vfork()?"
10667         . ./myread
10668         case "$ans" in
10669         y|Y) ;;
10670         *)
10671                 echo "Ok, we won't use vfork()."
10672                 val="$undef"
10673                 ;;
10674         esac
10675         ;;
10676 esac
10677 set d_vfork
10678 eval $setvar
10679 case "$d_vfork" in
10680 $define) usevfork='true';;
10681 *) usevfork='false';;
10682 esac
10683
10684 : see if this is an sysdir system
10685 set sys/dir.h i_sysdir
10686 eval $inhdr
10687
10688 : see if this is an sysndir system
10689 set sys/ndir.h i_sysndir
10690 eval $inhdr
10691
10692 : see if closedir exists
10693 set closedir d_closedir
10694 eval $inlibc
10695
10696 case "$d_closedir" in
10697 "$define")
10698         echo " "
10699         echo "Checking whether closedir() returns a status..." >&4
10700         cat > closedir.c <<EOM
10701 #$i_dirent I_DIRENT             /**/
10702 #$i_sysdir I_SYS_DIR            /**/
10703 #$i_sysndir I_SYS_NDIR          /**/
10704 #$i_systypes I_SYS_TYPES        /**/
10705
10706 #if defined(I_SYS_TYPES)
10707 #include <sys/types.h>
10708 #endif
10709 #if defined(I_DIRENT)
10710 #include <dirent.h>
10711 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
10712 #include <sys/dir.h>
10713 #endif
10714 #else
10715 #ifdef I_SYS_NDIR
10716 #include <sys/ndir.h>
10717 #else
10718 #ifdef I_SYS_DIR
10719 #ifdef hp9000s500
10720 #include <ndir.h>       /* may be wrong in the future */
10721 #else
10722 #include <sys/dir.h>
10723 #endif
10724 #endif
10725 #endif
10726 #endif 
10727 int main() { return closedir(opendir(".")); }
10728 EOM
10729         set closedir
10730         if eval $compile_ok; then
10731                 if ./closedir > /dev/null 2>&1 ; then
10732                         echo "Yes, it does."
10733                         val="$undef"
10734                 else
10735                         echo "No, it doesn't."
10736                         val="$define"
10737                 fi
10738         else
10739                 echo "(I can't seem to compile the test program--assuming it doesn't)"
10740                 val="$define"
10741         fi
10742         ;;
10743 *)
10744         val="$undef";
10745         ;;
10746 esac
10747 set d_void_closedir
10748 eval $setvar
10749 $rm -f closedir*
10750 : check for volatile keyword
10751 echo " "
10752 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
10753 $cat >try.c <<'EOCP'
10754 int main()
10755 {
10756         typedef struct _goo_struct goo_struct;
10757         goo_struct * volatile goo = ((goo_struct *)0);
10758         struct _goo_struct {
10759                 long long_int;
10760                 int reg_int;
10761                 char char_var;
10762         };
10763         typedef unsigned short foo_t;
10764         char *volatile foo;
10765         volatile int bar;
10766         volatile foo_t blech;
10767         foo = foo;
10768 }
10769 EOCP
10770 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
10771         val="$define"
10772         echo "Yup, it does."
10773 else
10774         val="$undef"
10775         echo "Nope, it doesn't."
10776 fi
10777 set d_volatile
10778 eval $setvar
10779 $rm -f try.*
10780
10781 : see if there is a wait4
10782 set wait4 d_wait4
10783 eval $inlibc
10784
10785 : see if waitpid exists
10786 set waitpid d_waitpid
10787 eval $inlibc
10788
10789 : see if wcstombs exists
10790 set wcstombs d_wcstombs
10791 eval $inlibc
10792
10793 : see if wctomb exists
10794 set wctomb d_wctomb
10795 eval $inlibc
10796
10797 : see if writev exists
10798 set writev d_writev
10799 eval $inlibc
10800
10801 : preserve RCS keywords in files with variable substitution, grrr
10802 Date='$Date'
10803 Id='$Id'
10804 Log='$Log'
10805 RCSfile='$RCSfile'
10806 Revision='$Revision'
10807
10808 case "$crosscompile" in
10809 ''|[nN]*) crosscompile="$undef" ;;
10810 esac
10811
10812 case "$osname" in
10813 next|rhapsody) multiarch="$define" ;;
10814 esac
10815 case "$multiarch" in
10816 ''|[nN]*) multiarch="$undef" ;;
10817 esac
10818
10819 : check for alignment requirements
10820 echo " "
10821 case "$crosscompile$multiarch" in
10822 *$define*)
10823         $cat <<EOM
10824 You seem to be either cross-compiling or doing a multiarchitecture build,
10825 skipping the memory alignment check.
10826
10827 EOM
10828         case "$alignbytes" in
10829         '') alignbytes=8 ;;
10830         esac
10831         ;;
10832 *)
10833         case "$alignbytes" in
10834         '') echo "Checking alignment constraints..." >&4
10835                 $cat >try.c <<'EOCP'
10836 struct foobar {
10837         char foo;
10838         double bar;
10839 } try_algn;
10840 int main()
10841 {
10842         printf("%d\n", (char *)&try_algn.bar - (char *)&try_algn.foo);
10843 }
10844 EOCP
10845                 set try
10846                 if eval $compile_ok; then
10847                         dflt=`./try`
10848                 else
10849                         dflt='8'
10850                         echo "(I can't seem to compile the test program...)"
10851                 fi
10852                 ;;
10853         *) dflt="$alignbytes"
10854                 ;;
10855         esac
10856         rp="Doubles must be aligned on a how-many-byte boundary?"
10857         . ./myread
10858         alignbytes="$ans"
10859         $rm -f try.c try
10860         ;;
10861 esac
10862
10863
10864 : check for ordering of bytes in a long
10865 echo " "
10866 case "$crosscompile$multiarch" in
10867 *$define*)
10868         $cat <<EOM
10869 You seem to be either cross-compiling or doing a multiarchitecture build,
10870 skipping the byteorder check.
10871
10872 EOM
10873         byteorder='0xffff'
10874         ;;
10875 *)
10876         case "$byteorder" in
10877         '')
10878                 $cat <<'EOM'
10879 In the following, larger digits indicate more significance.  A big-endian
10880 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
10881 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
10882 machines may have weird orders like 3412.  A Cray will report 87654321,
10883 an Alpha will report 12345678. If the test program works the default is
10884 probably right.
10885 I'm now running the test program...
10886 EOM
10887                 $cat >try.c <<'EOCP'
10888 #include <stdio.h>
10889 int main()
10890 {
10891         int i;
10892         union {
10893                 unsigned long l;
10894                 char c[sizeof(long)];
10895         } u;
10896
10897         if (sizeof(long) > 4)
10898                 u.l = (0x08070605L << 32) | 0x04030201L;
10899         else
10900                 u.l = 0x04030201L;
10901         for (i = 0; i < sizeof(long); i++)
10902                 printf("%c", u.c[i]+'0');
10903         printf("\n");
10904         exit(0);
10905 }
10906 EOCP
10907                 xxx_prompt=y
10908                 set try
10909                 if eval $compile && ./try > /dev/null; then
10910                         dflt=`./try`
10911                         case "$dflt" in
10912                         [1-4][1-4][1-4][1-4]|12345678|87654321)
10913                                 echo "(The test program ran ok.)"
10914                                 echo "byteorder=$dflt"
10915                                 xxx_prompt=n
10916                         ;;
10917                         ????|????????) echo "(The test program ran ok.)" ;;
10918                         *) echo "(The test program didn't run right for some reason.)" ;;
10919                         esac
10920                 else
10921                         dflt='4321'
10922                         cat <<'EOM'
10923 (I can't seem to compile the test program.  Guessing big-endian...)
10924 EOM
10925                 fi
10926                 case "$xxx_prompt" in
10927                 y)
10928                         rp="What is the order of bytes in a long?"
10929                         . ./myread
10930                         byteorder="$ans"
10931                         ;;
10932                 *)      byteorder=$dflt
10933                         ;;
10934                 esac
10935                 ;;
10936         esac
10937         $rm -f try.c try
10938         ;;
10939 esac
10940
10941
10942 : how do we catenate cpp tokens here?
10943 echo " "
10944 echo "Checking to see how your cpp does stuff like catenate tokens..." >&4
10945 $cat >cpp_stuff.c <<'EOCP'
10946 #define RCAT(a,b)a/**/b
10947 #define ACAT(a,b)a ## b
10948 RCAT(Rei,ser)
10949 ACAT(Cir,cus)
10950 EOCP
10951 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
10952 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
10953         echo "Oh!  Smells like ANSI's been here." >&4
10954         echo "We can catify or stringify, separately or together!"
10955         cpp_stuff=42
10956 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
10957         echo "Ah, yes!  The good old days!" >&4
10958         echo "However, in the good old days we don't know how to stringify and"
10959         echo "catify at the same time."
10960         cpp_stuff=1
10961 else
10962         $cat >&4 <<EOM
10963 Hmm, I don't seem to be able to catenate tokens with your cpp.  You're going
10964 to have to edit the values of CAT[2-5] in config.h...
10965 EOM
10966         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
10967 fi
10968 $rm -f cpp_stuff.*
10969
10970 : see if this is a db.h system
10971 set db.h i_db
10972 eval $inhdr
10973
10974 case "$i_db" in
10975 $define)
10976         : Check db version.
10977         echo " "
10978         echo "Checking Berkeley DB version ..." >&4
10979         $cat >try.c <<EOCP
10980 #$d_const HASCONST
10981 #ifndef HASCONST
10982 #define const
10983 #endif
10984 #include <sys/types.h>
10985 #include <stdio.h>
10986 #include <db.h>
10987 int main()
10988 {
10989 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
10990     int Major, Minor, Patch ;
10991     unsigned long Version ;
10992     (void)db_version(&Major, &Minor, &Patch) ;
10993     printf("You have Berkeley DB Version 2 or greater\n");
10994
10995     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
10996                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
10997     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
10998                 Major, Minor, Patch) ;
10999
11000     /* check that db.h & libdb are compatible */
11001     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
11002         printf("db.h and libdb are incompatible\n") ;
11003         exit(3);        
11004     }
11005
11006     printf("db.h and libdb are compatible\n") ;
11007
11008     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
11009                 + DB_VERSION_PATCH ;
11010
11011     /* needs to be >= 2.3.4 */
11012     if (Version < 2003004) {
11013     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
11014         printf("but Perl needs Berkeley DB 2.3.4 or greater\n") ;
11015         exit(2);        
11016     }
11017
11018     exit(0);
11019 #else
11020 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
11021     printf("You have Berkeley DB Version 1\n");
11022     exit(0);    /* DB version < 2: the coast is clear. */
11023 #else
11024     exit(1);    /* <db.h> not Berkeley DB? */
11025 #endif
11026 #endif
11027 }
11028 EOCP
11029         set try
11030         if eval $compile && ./try; then
11031                 echo 'Looks OK.' >&4
11032         else
11033                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
11034                 i_db=$undef
11035                 case " $libs " in
11036                 *"-ldb "*)
11037                         : Remove db from list of libraries to use
11038                         echo "Removing unusable -ldb from library list" >&4
11039                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
11040                         shift
11041                         libs="$*"
11042                         echo "libs = $libs" >&4
11043                         ;;
11044                 esac
11045         fi
11046         $rm -f try.*
11047         ;;
11048 esac
11049
11050 case "$i_db" in
11051 define)
11052         : Check the return type needed for hash 
11053         echo " "
11054         echo "Checking return type needed for hash for Berkeley DB ..." >&4
11055         $cat >try.c <<EOCP
11056 #$d_const HASCONST
11057 #ifndef HASCONST
11058 #define const
11059 #endif
11060 #include <sys/types.h>
11061 #include <db.h>
11062
11063 #ifndef DB_VERSION_MAJOR
11064 u_int32_t hash_cb (ptr, size)
11065 const void *ptr;
11066 size_t size;
11067 {
11068 }
11069 HASHINFO info;
11070 int main()
11071 {
11072         info.hash = hash_cb;
11073 }
11074 #endif
11075 EOCP
11076         if $cc $ccflags -c try.c >try.out 2>&1 ; then
11077                 if $contains warning try.out >>/dev/null 2>&1 ; then
11078                         db_hashtype='int'
11079                 else
11080                         db_hashtype='u_int32_t'
11081                 fi
11082         else
11083                 : XXX Maybe we should just give up here.
11084                 db_hashtype=u_int32_t
11085                 $cat try.out >&4
11086                 echo "Help:  I can't seem to compile the db test program." >&4
11087                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
11088         fi
11089         $rm -f try.*
11090         echo "Your version of Berkeley DB uses $db_hashtype for hash."
11091         ;;
11092 *)      db_hashtype=u_int32_t
11093         ;;
11094 esac
11095 case "$i_db" in
11096 define)
11097         : Check the return type needed for prefix 
11098         echo " "
11099         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
11100         cat >try.c <<EOCP
11101 #$d_const HASCONST
11102 #ifndef HASCONST
11103 #define const
11104 #endif
11105 #include <sys/types.h>
11106 #include <db.h>
11107
11108 #ifndef DB_VERSION_MAJOR
11109 size_t prefix_cb (key1, key2)
11110 const DBT *key1;
11111 const DBT *key2;
11112 {
11113 }
11114 BTREEINFO info;
11115 int main()
11116 {
11117         info.prefix = prefix_cb;
11118 }
11119 #endif
11120 EOCP
11121         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
11122                 if $contains warning try.out >>/dev/null 2>&1 ; then
11123                         db_prefixtype='int'
11124                 else
11125                         db_prefixtype='size_t'
11126                 fi
11127         else
11128                 db_prefixtype='size_t'
11129                 : XXX Maybe we should just give up here.
11130                 $cat try.out >&4
11131                 echo "Help:  I can't seem to compile the db test program." >&4
11132                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
11133         fi
11134         $rm -f try.*
11135         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
11136         ;;
11137 *)      db_prefixtype='size_t'
11138         ;;
11139 esac
11140
11141 : check for void type
11142 echo " "
11143 echo "Checking to see how well your C compiler groks the void type..." >&4
11144 case "$voidflags" in
11145 '')
11146         $cat >try.c <<'EOCP'
11147 #if TRY & 1
11148 void sub() {
11149 #else
11150 sub() {
11151 #endif
11152         extern void moo();      /* function returning void */
11153         void (*goo)();          /* ptr to func returning void */
11154 #if TRY & 8
11155         void *hue;              /* generic ptr */
11156 #endif
11157 #if TRY & 2
11158         void (*foo[10])();
11159 #endif
11160
11161 #if TRY & 4
11162         if(goo == moo) {
11163                 exit(0);
11164         }
11165 #endif
11166         exit(0);
11167 }
11168 int main() { sub(); }
11169 EOCP
11170         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
11171                 voidflags=$defvoidused
11172         echo "Good.  It appears to support void to the level $package wants.">&4
11173                 if $contains warning .out >/dev/null 2>&1; then
11174                         echo "However, you might get some warnings that look like this:"
11175                         $cat .out
11176                 fi
11177         else
11178 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
11179                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
11180                         echo "It supports 1..."
11181                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
11182                                 echo "It also supports 2..."
11183                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
11184                                         voidflags=7
11185                                         echo "And it supports 4 but not 8 definitely."
11186                                 else
11187                                         echo "It doesn't support 4..."
11188                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
11189                                                 voidflags=11
11190                                                 echo "But it supports 8."
11191                                         else
11192                                                 voidflags=3
11193                                                 echo "Neither does it support 8."
11194                                         fi
11195                                 fi
11196                         else
11197                                 echo "It does not support 2..."
11198                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
11199                                         voidflags=13
11200                                         echo "But it supports 4 and 8."
11201                                 else
11202                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
11203                                                 voidflags=5
11204                                                 echo "And it supports 4 but has not heard about 8."
11205                                         else
11206                                                 echo "However it supports 8 but not 4."
11207                                         fi
11208                                 fi
11209                         fi
11210                 else
11211                         echo "There is no support at all for void."
11212                         voidflags=0
11213                 fi
11214         fi
11215 esac
11216 case "$voidflags" in
11217 "$defvoidused") ;;
11218 *)      $cat >&4 <<'EOM'
11219   Support flag bits are:
11220     1: basic void declarations.
11221     2: arrays of pointers to functions returning void.
11222     4: operations between pointers to and addresses of void functions.
11223     8: generic void pointers.
11224 EOM
11225         dflt="$voidflags";
11226         rp="Your void support flags add up to what?"
11227         . ./myread
11228         voidflags="$ans"
11229         ;;
11230 esac
11231 $rm -f try.* .out
11232
11233
11234 : How can we generate normalized random numbers ?
11235 echo " "
11236 echo "Looking for a random number function..." >&4
11237 case "$randfunc" in
11238 '')
11239         if set drand48 val -f; eval $csym; $val; then
11240                 dflt="drand48"
11241                 echo "Good, found drand48()." >&4
11242         elif set random val -f; eval $csym; $val; then
11243                 dflt="random"
11244                 echo "OK, found random()." >&4
11245         else
11246                 dflt="rand"
11247                 echo "Yick, looks like I have to use rand()." >&4
11248         fi
11249         echo " "
11250         ;;
11251 *)
11252         dflt="$randfunc"
11253         ;;
11254 esac
11255 cont=true
11256
11257 case "$ccflags" in
11258 *-Dmy_rand=*|*-Dmy_srand=*)
11259         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
11260         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
11261         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
11262         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
11263         ;;
11264 esac
11265
11266 while $test "$cont"; do
11267         rp="Use which function to generate random numbers?"
11268         . ./myread
11269         if $test "$ans" = "$dflt"; then
11270                 : null
11271         else
11272                 randbits=''
11273         fi
11274         randfunc="$ans"
11275         if set $ans val -f; eval $csym; $val; then
11276                 cont=''
11277         else
11278                 dflt=y
11279                 rp="I cannot find function $ans. Use that name anyway?"
11280                 . ./myread
11281                 dflt=rand
11282                 case "$ans" in
11283                         [yY]*) cont='';;
11284                 esac
11285         fi
11286         case "$cont" in
11287         '')
11288                 case "$randfunc" in
11289                 drand48)
11290                         drand01="drand48()"
11291                         seedfunc="srand48"
11292                         randbits=48
11293                         randseedtype=long
11294                         ;;
11295                 rand|random)
11296                         case "$randbits" in
11297                         '')
11298 echo "Checking to see how many bits your $randfunc() function produces..." >&4
11299                                 $cat >try.c <<EOCP
11300 #$i_unistd I_UNISTD
11301 #$i_stdlib I_STDLIB
11302 #include <stdio.h>
11303 #ifdef I_UNISTD
11304 #  include <unistd.h>
11305 #endif
11306 #ifdef I_STDLIB
11307 #  include <stdlib.h>
11308 #endif
11309 int main()
11310 {
11311         register int i;
11312         register unsigned long tmp;
11313         register unsigned long max = 0L;
11314
11315         for (i = 1000; i; i--) {
11316                 tmp = (unsigned long) $randfunc();
11317                 if (tmp > max) max = tmp;
11318         }
11319         for (i = 0; max; i++)
11320                 max /= 2;
11321         printf("%d\n",i);
11322 }
11323 EOCP
11324                                 set try
11325                                 if eval $compile_ok; then
11326                                         dflt=`try`
11327                                 else
11328                                         dflt='?'
11329                                         echo "(I can't seem to compile the test program...)"
11330                                 fi
11331                                 ;;
11332                         *)
11333                                 dflt="$randbits"
11334                                 ;;
11335                         esac
11336                         rp="How many bits does your $randfunc() function produce?"
11337                         . ./myread
11338                         randbits="$ans"
11339                         $rm -f try.c try
11340                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
11341                         seedfunc="s$randfunc"
11342                         randseedtype=unsigned
11343                         ;;
11344                 *)
11345                         dflt="31"
11346                         rp="How many bits does your $randfunc() function produce?"
11347                         . ./myread
11348                         randbits="$ans"
11349                         seedfunc="s$randfunc"
11350                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
11351                         if set $seedfunc val -f; eval $csym; $val; then
11352                                 echo "(Using $seedfunc() to seed random generator)"
11353                         else
11354                                 echo "(Warning: no $seedfunc() to seed random generator)"
11355                                 seedfunc=rand
11356                         fi
11357                         randseedtype=unsigned
11358                         ;;
11359                 esac
11360                 ;;
11361         esac
11362 done
11363
11364 echo " "
11365 echo "Determining whether or not we are on an EBCDIC system..." >&4
11366 $cat >tebcdic.c <<'EOM'
11367 int main()
11368 {
11369   if ('M'==0xd4) return 0;
11370   return 1;
11371 }
11372 EOM
11373
11374 val=$undef
11375 set tebcdic
11376 if eval $compile_ok; then
11377         if ./tebcdic; then
11378                 echo "You have EBCDIC." >&4
11379                 val="$define"
11380         else
11381                 echo "Nope, no EBCDIC.  Assuming ASCII or some ISO Latin, or UTF." >&4
11382         fi
11383 else
11384         echo "I'm unable to compile the test program." >&4
11385         echo "I'll assume ASCII or some ISO Latin." >&4
11386 fi
11387 $rm -f tebcdic.c tebcdic
11388 set ebcdic
11389 eval $setvar
11390
11391 echo " "
11392 $cat >&4 <<EOM
11393 Checking how to flush all pending stdio output...
11394 EOM
11395 # I only know how to find the first 32 possibly open files on SunOS.
11396 # See also hints/sunos_4_1.sh and util.c  --AD
11397 case "$osname" in
11398 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
11399 esac
11400 $cat >>try.c <<EOCP
11401 #include <stdio.h>
11402 #$i_unistd I_UNISTD
11403 #ifdef I_UNISTD
11404 # include <unistd.h>
11405 #endif
11406 #$d_sysconf HAS_SYSCONF
11407 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
11408 #ifdef HAS_STDIO_STREAM_ARRAY
11409 # define STDIO_STREAM_ARRAY $stdio_stream_array
11410 #endif
11411 int main() {
11412   FILE* p = fopen("try.out", "w");
11413 #ifdef TRY_FPUTC
11414   fputc('x', p);
11415 #else
11416 # ifdef TRY_FPRINTF
11417   fprintf(p, "x");
11418 # endif
11419 #endif
11420 #ifdef TRY_FFLUSH_NULL
11421   fflush(NULL);
11422 #endif
11423 #ifdef TRY_FFLUSH_ALL
11424   {
11425     long open_max = -1;
11426 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
11427     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
11428 # else
11429 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
11430     open_max = sysconf(_SC_OPEN_MAX);
11431 #  else
11432 #   ifdef FOPEN_MAX
11433     open_max = FOPEN_MAX;
11434 #   else
11435 #    ifdef OPEN_MAX
11436     open_max = OPEN_MAX;
11437 #    else
11438 #     ifdef _NFILE
11439     open_max = _NFILE;
11440 #     endif
11441 #    endif
11442 #   endif
11443 #  endif
11444 # endif 
11445 # ifdef HAS_STDIO_STREAM_ARRAY
11446     if (open_max > 0) {
11447       long i;
11448       for (i = 0; i < open_max; i++)
11449             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
11450                 STDIO_STREAM_ARRAY[i]._file < open_max &&
11451                 STDIO_STREAM_ARRAY[i]._flag)
11452                 fflush(&STDIO_STREAM_ARRAY[i]);
11453     }   
11454   }
11455 # endif
11456 #endif
11457   _exit(42);
11458 }
11459 EOCP
11460 : first we have to find out how _not_ to flush
11461 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
11462     output=''
11463     set try -DTRY_FPUTC
11464     if eval $compile; then
11465             $rm -f try.out
11466             ./try$exe_ext 2>/dev/null
11467             if $test ! -s try.out -a "X$?" = X42; then
11468                 output=-DTRY_FPUTC
11469             fi
11470     fi
11471     case "$output" in
11472     '')
11473             set try -DTRY_FPRINTF
11474             $rm -f try.out
11475             if eval $compile; then
11476                     $rm -f try.out
11477                     ./try$exe_ext 2>/dev/null
11478                     if $test ! -s try.out -a "X$?" = X42; then
11479                         output=-DTRY_FPRINTF
11480                     fi
11481             fi
11482         ;;
11483     esac
11484 fi
11485 : check for fflush NULL behaviour
11486 case "$fflushNULL" in
11487 '')     set try -DTRY_FFLUSH_NULL $output
11488         if eval $compile; then
11489                 $rm -f try.out
11490                 ./try$exe_ext 2>/dev/null
11491                 code="$?"
11492                 if $test -s try.out -a "X$code" = X42; then
11493                         fflushNULL="`$cat try.out`"
11494                 else
11495                         if $test "X$code" != X42; then
11496                                 $cat >&4 <<EOM
11497 (If this test failed, don't worry, we'll try another method shortly.)
11498 EOM
11499                         fi
11500                 fi
11501         fi
11502         $rm -f core try.core core.try.*
11503         case "$fflushNULL" in
11504         x)      $cat >&4 <<EOM
11505 Your fflush(NULL) works okay.
11506 EOM
11507                 fflushNULL="$define"
11508                 ;;
11509         '')     $cat >&4 <<EOM
11510 Your fflush(NULL) isn't working (contrary to ANSI C).
11511 EOM
11512                 fflushNULL="$undef"
11513                 ;;
11514         *)      $cat >&4 <<EOM
11515 Cannot figure out whether your fflush(NULL) works or not.
11516 I'm assuming it doesn't (contrary to ANSI C).
11517 EOM
11518                 fflushNULL="$undef"
11519                 ;;
11520         esac
11521         ;;
11522 $define|true|[yY]*)
11523         fflushNULL="$define"
11524         ;;
11525 *)
11526         fflushNULL="$undef"
11527         ;;
11528 esac
11529 : check explicit looping only if NULL did not work
11530 case "$fflushNULL" in
11531 "$undef")
11532         : check for fflush all behaviour
11533         case "$fflushall" in
11534         '')     set try -DTRY_FFLUSH_ALL $output
11535                 if eval $compile; then
11536                         $cat >&4 <<EOM
11537 (Now testing the other method--but note that also this may fail.)
11538 EOM
11539                         $rm -f try.out
11540                         ./try$exe_ext 2>/dev/null
11541                         if $test -s try.out -a "X$?" = X42; then
11542                                 fflushall="`$cat try.out`"
11543                         fi
11544                 fi
11545                 $rm -f core try.core core.try.*
11546                 case "$fflushall" in
11547                 x)      $cat >&4 <<EOM
11548 Whew. Flushing explicitly all the stdio streams works.
11549 EOM
11550                         fflushall="$define"
11551                         ;;
11552                 '')     $cat >&4 <<EOM
11553 Sigh. Flushing explicitly all the stdio streams doesn't work.
11554 EOM
11555                         fflushall="$undef"
11556                         ;;
11557                 *)      $cat >&4 <<EOM
11558 Cannot figure out whether flushing stdio streams explicitly works or not.
11559 I'm assuming it doesn't.
11560 EOM
11561                         fflushall="$undef"
11562                         ;;
11563                 esac
11564                 ;;
11565         "$define"|true|[yY]*)
11566                 fflushall="$define"
11567                 ;;
11568         *)
11569                 fflushall="$undef"
11570                 ;;
11571         esac
11572         ;;
11573 *)      fflushall="$undef"      
11574         ;;
11575 esac
11576 case "$fflushNULL$fflushall" in
11577 undefundef)
11578         $cat <<EOM
11579 I cannot figure out how to flush pending stdio output.
11580 EOM
11581         ;;
11582 esac
11583 $rm -f try.* try$exe_ext
11584
11585 : see what type file positions are declared as in the library
11586 rp="What is the type for file position used by fsetpos()?"
11587 set fpos_t fpostype long stdio.h sys/types.h
11588 eval $typedef_ask
11589
11590 : Store the full pathname to the ar program for use in the C program
11591 : Respect a hint or command line value for full_ar.
11592 case "$full_ar" in
11593 '') full_ar=$ar ;;
11594 esac
11595
11596 : Store the full pathname to the sed program for use in the C program
11597 full_sed=$sed
11598
11599 : see what type gids are declared as in the kernel
11600 echo " "
11601 echo "Looking for the type for group ids returned by getgid()."
11602 set gid_t gidtype xxx stdio.h sys/types.h
11603 eval $typedef
11604 case "$gidtype" in
11605 xxx)
11606         xxx=`./findhdr sys/user.h`
11607         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
11608         case $1 in
11609         unsigned) dflt="$1 $2" ;;
11610         *) dflt="$1" ;;
11611         esac
11612         ;;
11613 *) dflt="$gidtype";;
11614 esac
11615 case "$gidtype" in
11616 gid_t) echo "gid_t found." ;;
11617 *)      rp="What is the type for group ids returned by getgid()?"
11618         . ./myread
11619         gidtype="$ans"
11620         ;;
11621 esac
11622
11623 : see if getgroups exists
11624 set getgroups d_getgrps
11625 eval $inlibc
11626
11627 : see if setgroups exists
11628 set setgroups d_setgrps
11629 eval $inlibc
11630
11631
11632 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
11633 echo " "
11634 case "$d_getgrps$d_setgrps" in
11635 *define*)
11636         case "$groupstype" in
11637         '') dflt="$gidtype" ;;
11638         *)  dflt="$groupstype" ;;
11639         esac
11640         $cat <<EOM
11641 What type of pointer is the second argument to getgroups() and setgroups()?
11642 Usually this is the same as group ids, $gidtype, but not always.
11643
11644 EOM
11645         rp='What type pointer is the second argument to getgroups() and setgroups()?'
11646         . ./myread
11647         groupstype="$ans"
11648         ;;
11649 *)  groupstype="$gidtype";;
11650 esac
11651
11652 : see what type lseek is declared as in the kernel
11653 rp="What is the type used for lseek's offset on this system?"
11654 set off_t lseektype long stdio.h sys/types.h
11655 eval $typedef_ask
11656
11657 echo " "
11658 $echo $n "Checking to see how big your file offsets are...$c" >&4
11659 $cat >try.c <<EOCP
11660 #include <sys/types.h>
11661 #include <stdio.h>
11662 int main()
11663 {
11664         printf("%d\n", sizeof($lseektype));
11665 }
11666 EOCP
11667 set try
11668 if eval $compile_ok; then
11669         lseeksize=`./try`
11670         $echo " $lseeksize bytes." >&4
11671 else
11672         dflt='4'
11673         echo " "
11674         echo "(I can't seem to compile the test program.  Guessing...)"
11675         rp="What is the size of your file offsets (in bytes)?"
11676         . ./myread
11677         lseeksize="$ans"
11678 fi
11679 $rm -f try.c try
11680
11681 echo " "
11682 echo "Checking if your $make program sets \$(MAKE)..." >&4
11683 case "$make_set_make" in
11684 '')
11685         $sed 's/^X //' > testmake.mak << 'EOF'
11686 Xall:
11687 X       @echo 'maketemp="$(MAKE)"'
11688 EOF
11689         case "`$make -f testmake.mak 2>/dev/null`" in
11690         *maketemp=*) make_set_make='#' ;;
11691         *)      make_set_make="MAKE=$make" ;;
11692         esac
11693         $rm -f testmake.mak
11694         ;;
11695 esac
11696 case "$make_set_make" in
11697 '#') echo "Yup, it does.";;
11698 *) echo "Nope, it doesn't.";;
11699 esac
11700
11701 : see what type is used for mode_t
11702 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
11703 set mode_t modetype int stdio.h sys/types.h
11704 eval $typedef_ask
11705
11706 : define a fucntion to check prototypes
11707 $cat > protochk <<EOSH
11708 $startsh
11709 cc="$cc"
11710 optimize="$optimize"
11711 ccflags="$ccflags"
11712 prototype="$prototype"
11713 define="$define"
11714 rm=$rm
11715 EOSH
11716
11717 $cat >> protochk <<'EOSH'
11718
11719 $rm -f try.c
11720 foo="$1"
11721 shift
11722 while test $# -ge 2; do
11723         case "$1" in
11724                 $define) echo "#include <$2>" >> try.c ;;
11725                 literal) echo "$2" >> try.c ;;
11726         esac
11727     shift 2
11728 done
11729 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
11730 cat >> try.c <<'EOCP'
11731 #ifdef CAN_PROTOTYPE
11732 #define _(args) args
11733 #else
11734 #define _(args) ()
11735 #endif
11736 EOCP
11737 echo "$foo" >> try.c
11738 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
11739 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
11740 status=$?
11741 $rm -f try.[co]
11742 exit $status
11743 EOSH
11744 chmod +x protochk
11745 $eunicefix protochk
11746
11747 : see what type is used for size_t
11748 rp="What is the type used for the length parameter for string functions?"
11749 set size_t sizetype 'unsigned int' stdio.h sys/types.h
11750 eval $typedef_ask
11751
11752 : check for type of arguments to gethostbyaddr. 
11753 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
11754         case "$d_gethbyaddr" in
11755         $define)
11756                 $cat <<EOM
11757
11758 Checking to see what type of arguments are accepted by gethostbyaddr().
11759 EOM
11760                 hdrs="$define sys/types.h
11761                         $d_socket sys/socket.h 
11762                         $i_niin netinet/in.h 
11763                         $i_netdb netdb.h
11764                         $i_unistd unistd.h"
11765                 : The first arg can 'char *' or 'void *'
11766                 : The second arg is some of integral type
11767                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
11768                         for yyy in size_t long int; do
11769                                 case "$netdb_host_type" in
11770                                 '')     try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
11771                                         if ./protochk "$try" $hdrs; then
11772                                                 echo "Your system accepts $xxx for the first arg."
11773                                                 echo "...and $yyy for the second arg."
11774                                                 netdb_host_type="$xxx"
11775                                                 netdb_hlen_type="$yyy"
11776                                         fi
11777                                         ;;
11778                                 esac
11779                         done
11780                 done
11781                 : In case none of those worked, prompt the user.
11782                 case "$netdb_host_type" in
11783                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
11784                         dflt='char *'
11785                         . ./myread
11786                         netdb_host_type=$ans
11787                         rp='What is the type for the 2nd argument to gethostbyaddr?'
11788                         dflt="$sizetype"
11789                         . ./myread
11790                         netdb_hlen_type=$ans
11791                         ;;
11792                 esac
11793                 ;;
11794         *)      : no gethostbyaddr, so pick harmless defaults
11795                 netdb_host_type='char *'
11796                 netdb_hlen_type="$sizetype"
11797                 ;;
11798         esac
11799         # Remove the "const" if needed. -- but then we'll have a 
11800         # prototype clash!
11801         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
11802 fi
11803
11804 : check for type of argument to gethostbyname. 
11805 if test "X$netdb_name_type" = X ; then
11806         case "$d_gethbyname" in
11807         $define)
11808                 $cat <<EOM
11809
11810 Checking to see what type of argument is accepted by gethostbyname().
11811 EOM
11812                 hdrs="$define sys/types.h
11813                         $d_socket sys/socket.h 
11814                         $i_niin netinet/in.h 
11815                         $i_netdb netdb.h
11816                         $i_unistd unistd.h"
11817                 for xxx in "const char *" "char *"; do
11818                         case "$netdb_name_type" in
11819                         '')     try="extern struct hostent *gethostbyname($xxx);"
11820                                 if ./protochk "$try" $hdrs; then
11821                                         echo "Your system accepts $xxx."
11822                                         netdb_name_type="$xxx"
11823                                 fi
11824                                 ;;
11825                         esac
11826                 done
11827                 : In case none of those worked, prompt the user.
11828                 case "$netdb_name_type" in
11829                 '')     rp='What is the type for the 1st argument to gethostbyname?'
11830                         dflt='char *'
11831                         . ./myread
11832                         netdb_name_type=$ans
11833                         ;;
11834                 esac
11835                 ;;
11836         *)      : no gethostbyname, so pick harmless default
11837                 netdb_name_type='char *'
11838                 ;;
11839         esac
11840 fi
11841
11842 : check for type of 1st argument to getnetbyaddr. 
11843 if test "X$netdb_net_type" = X ; then
11844         case "$d_getnbyaddr" in
11845         $define)
11846                 $cat <<EOM
11847
11848 Checking to see what type of 1st argument is accepted by getnetbyaddr().
11849 EOM
11850                 hdrs="$define sys/types.h
11851                         $d_socket sys/socket.h 
11852                         $i_niin netinet/in.h 
11853                         $i_netdb netdb.h
11854                         $i_unistd unistd.h"
11855                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
11856                         case "$netdb_net_type" in
11857                         '')     try="extern struct netent *getnetbyaddr($xxx, int);"
11858                                 if ./protochk "$try" $hdrs; then
11859                                         echo "Your system accepts $xxx."
11860                                         netdb_net_type="$xxx"
11861                                 fi
11862                                 ;;
11863                         esac
11864                 done
11865                 : In case none of those worked, prompt the user.
11866                 case "$netdb_net_type" in
11867                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
11868                         dflt='long'
11869                         . ./myread
11870                         netdb_net_type=$ans
11871                         ;;
11872                 esac
11873                 ;;
11874         *)      : no getnetbyaddr, so pick harmless default
11875                 netdb_net_type='long'
11876                 ;;
11877         esac
11878 fi
11879 : locate the preferred pager for this system
11880 case "$pager" in
11881 '')
11882         dflt=''
11883         case "$pg" in
11884         /*) dflt=$pg;;
11885         esac
11886         case "$more" in
11887         /*) dflt=$more;;
11888         esac
11889         case "$less" in
11890         /*) dflt=$less;;
11891         esac
11892         case "$dflt" in
11893         '') dflt=/usr/ucb/more;;
11894         esac
11895         ;;
11896 *) dflt="$pager";;
11897 esac
11898 echo " "
11899 fn=f/
11900 rp='What pager is used on your system?'
11901 . ./getfile
11902 pager="$ans"
11903
11904 : see what type pids are declared as in the kernel
11905 rp="What is the type of process ids on this system?"
11906 set pid_t pidtype int stdio.h sys/types.h
11907 eval $typedef_ask
11908
11909 : check for length of pointer
11910 echo " "
11911 case "$ptrsize" in
11912 '')
11913         $echo $n "Checking to see how big your pointers are...$c" >&4
11914         if test "$voidflags" -gt 7; then
11915                 echo '#define VOID_PTR char *' > try.c
11916         else
11917                 echo '#define VOID_PTR void *' > try.c
11918         fi
11919         $cat >>try.c <<'EOCP'
11920 #include <stdio.h>
11921 int main()
11922 {
11923         printf("%d\n", sizeof(VOID_PTR));
11924         exit(0);
11925 }
11926 EOCP
11927         set try
11928         if eval $compile_ok; then
11929                 ptrsize=`./try`
11930                 $echo " $ptrsize bytes." >&4
11931         else
11932                 dflt='4'
11933                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
11934                 rp="What is the size of a pointer (in bytes)?"
11935                 . ./myread
11936                 ptrsize="$ans"
11937         fi
11938         ;;
11939 esac
11940 $rm -f try.c try
11941
11942 : see if ar generates random libraries by itself
11943 echo " "
11944 echo "Checking how to generate random libraries on your machine..." >&4
11945 echo 'int bar1() { return bar2(); }' > bar1.c
11946 echo 'int bar2() { return 2; }' > bar2.c
11947 $cat > foo.c <<'EOP'
11948 int main() { printf("%d\n", bar1()); exit(0); }
11949 EOP
11950 $cc $ccflags -c bar1.c >/dev/null 2>&1
11951 $cc $ccflags -c bar2.c >/dev/null 2>&1
11952 $cc $ccflags -c foo.c >/dev/null 2>&1
11953 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
11954 if $cc $ccflags $ldflags -o foobar foo$_o bar$_a $libs > /dev/null 2>&1 &&
11955         ./foobar >/dev/null 2>&1; then
11956         echo "$ar appears to generate random libraries itself."
11957         orderlib=false
11958         ranlib=":"
11959 elif $ar ts bar$_a >/dev/null 2>&1 &&
11960         $cc $ccflags $ldflags -o foobar foo$_o bar$_a $libs > /dev/null 2>&1 &&
11961         ./foobar >/dev/null 2>&1; then
11962                 echo "a table of contents needs to be added with '$ar ts'."
11963                 orderlib=false
11964                 ranlib="$ar ts"
11965 else
11966         case "$ranlib" in
11967         :) ranlib='';;
11968         '')
11969                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
11970                 $test -f $ranlib || ranlib=''
11971                 ;;
11972         esac
11973         if $test -n "$ranlib"; then
11974                 echo "your system has '$ranlib'; we'll use that."
11975                 orderlib=false
11976         else
11977                 echo "your system doesn't seem to support random libraries"
11978                 echo "so we'll use lorder and tsort to order the libraries."
11979                 orderlib=true
11980                 ranlib=":"
11981         fi
11982 fi
11983 $rm -f foo* bar* 
11984
11985 : check for type of arguments to select. 
11986 case "$selecttype" in
11987 '') case "$d_select" in
11988         $define)
11989                 $cat <<EOM
11990 Checking to see what type of arguments are accepted by select().
11991 EOM
11992                 hdrs="$define sys/types.h
11993                         $i_systime sys/time.h 
11994                         $i_sysselct sys/select.h
11995                         $d_socket sys/socket.h"
11996                 : The first arg can be int, unsigned, or size_t
11997                 : The last arg may or may not be 'const'
11998                 val=''
11999                 : void pointer has been seen but using that
12000                 : breaks the selectminbits test
12001                 for xxx in 'fd_set *' 'int *'; do
12002                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
12003                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
12004                                         case "$val" in
12005                                         '')     try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
12006                                                 if ./protochk "$try" $hdrs; then
12007                                                         echo "Your system accepts $xxx."
12008                                                         val="$xxx"
12009                                                 fi
12010                                                 ;;
12011                                         esac
12012                                 done
12013                         done
12014                 done
12015                 case "$val" in
12016                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
12017                         case "$d_fd_set" in
12018                                 $define) dflt="fd_set *" ;;
12019                                 *)              dflt="int *" ;;
12020                         esac
12021                         . ./myread
12022                         val=$ans
12023                         ;;
12024                 esac
12025                 selecttype="$val"
12026                 ;;
12027         *)      : no select, so pick a harmless default
12028                 selecttype='int *'
12029                 ;;
12030         esac
12031         ;;
12032 esac
12033
12034 : check for the select 'width'
12035 case "$selectminbits" in
12036 '') case "$d_select" in
12037         $define)
12038                 $cat <<EOM
12039
12040 Checking to see on how many bits at a time your select() operates...
12041 EOM
12042                 $cat >try.c <<EOCP
12043 #include <sys/types.h>
12044 #$i_time I_TIME
12045 #$i_systime I_SYS_TIME
12046 #$i_systimek I_SYS_TIME_KERNEL
12047 #ifdef I_TIME
12048 #   include <time.h>
12049 #endif
12050 #ifdef I_SYS_TIME
12051 #   ifdef I_SYS_TIME_KERNEL
12052 #       define KERNEL
12053 #   endif
12054 #   include <sys/time.h>
12055 #   ifdef I_SYS_TIME_KERNEL
12056 #       undef KERNEL
12057 #   endif
12058 #endif
12059 #$i_sysselct I_SYS_SELECT
12060 #ifdef I_SYS_SELECT
12061 #include <sys/select.h>
12062 #endif
12063 #$d_socket HAS_SOCKET
12064 #ifdef HAS_SOCKET
12065 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
12066 #endif
12067 #include <stdio.h>
12068 $selecttype b;
12069 #define S sizeof(*(b))
12070 #define MINBITS 64
12071 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
12072 #define NBITS  (NBYTES * 8)
12073 int main() {
12074     char s[NBYTES];
12075     struct timeval t;
12076     int i;
12077     FILE* fp;
12078     int fd;
12079
12080     fclose(stdin);
12081     fp = fopen("try.c", "r");
12082     if (fp == 0)
12083       exit(1);
12084     fd = fileno(fp);
12085     if (fd < 0)
12086       exit(2);
12087     b = ($selecttype)s;
12088     for (i = 0; i < NBITS; i++)
12089         FD_SET(i, b);
12090     t.tv_sec  = 0;
12091     t.tv_usec = 0;
12092     select(fd + 1, b, 0, 0, &t);
12093     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
12094     printf("%d\n", i + 1);
12095     return 0;
12096 }
12097 EOCP
12098                 set try
12099                 if eval $compile_ok; then
12100                         selectminbits=`./try`
12101                         case "$selectminbits" in
12102                         '')     cat >&4 <<EOM
12103 Cannot figure out on how many bits at a time your select() operates.
12104 I'll play safe and guess it is 32 bits.
12105 EOM
12106                                 selectminbits=32
12107                                 bits="32 bits"
12108                                 ;;
12109                         1)      bits="1 bit" ;;
12110                         *)      bits="$selectminbits bits" ;;
12111                         esac
12112                         echo "Your select() operates on $bits at a time." >&4
12113                 else
12114                         rp='What is the minimum number of bits your select() operates on?'
12115                         case "$byteorder" in
12116                         1234|12345678)  dflt=32 ;;
12117                         *)              dflt=1  ;;
12118                         esac
12119                         . ./myread
12120                         val=$ans
12121                         selectminbits="$val"
12122                 fi
12123                 $rm -f try.* try
12124                 ;;
12125         *)      : no select, so pick a harmless default
12126                 selectminbits='32'
12127                 ;;
12128         esac
12129         ;;
12130 esac
12131
12132 : Trace out the files included by signal.h, then look for SIGxxx names.
12133 : Remove SIGARRAYSIZE used by HPUX.
12134 : Remove SIGSTKSIZE used by Linux.
12135 : Remove SIGSTKSZ used by Posix.
12136 : Remove SIGTYP void lines used by OS2.
12137 xxx=`echo '#include <signal.h>' |
12138         $cppstdin $cppminus $cppflags 2>/dev/null |
12139         $grep '^[       ]*#.*include' | 
12140         $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sort | $uniq`
12141 : Check this list of files to be sure we have parsed the cpp output ok.
12142 : This will also avoid potentially non-existent files, such 
12143 : as ../foo/bar.h
12144 xxxfiles=''
12145 for xx in $xxx /dev/null ; do
12146         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
12147 done
12148 : If we have found no files, at least try signal.h
12149 case "$xxxfiles" in
12150 '')     xxxfiles=`./findhdr signal.h` ;;
12151 esac
12152 xxx=`awk '
12153 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
12154         print substr($2, 4, 20)
12155 }
12156 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
12157         print substr($3, 4, 20)
12158 }' $xxxfiles`
12159 : Append some common names just in case the awk scan failed.
12160 xxx="$xxx ABRT ALRM BUS CHLD CLD CONT DIL EMT FPE HUP ILL INT IO IOT KILL"
12161 xxx="$xxx LOST PHONE PIPE POLL PROF PWR QUIT SEGV STKFLT STOP SYS TERM TRAP"
12162 xxx="$xxx TSTP TTIN TTOU URG USR1 USR2 USR3 USR4 VTALRM"
12163 xxx="$xxx WINCH WIND WINDOW XCPU XFSZ"
12164 : generate a few handy files for later
12165 $cat > signal.c <<'EOCP'
12166 #include <sys/types.h>
12167 #include <signal.h>
12168 #include <stdio.h>
12169 int main() {
12170
12171 /* Strange style to avoid deeply-nested #if/#else/#endif */
12172 #ifndef NSIG
12173 #  ifdef _NSIG
12174 #    define NSIG (_NSIG)
12175 #  endif
12176 #endif
12177
12178 #ifndef NSIG
12179 #  ifdef SIGMAX
12180 #    define NSIG (SIGMAX+1)
12181 #  endif
12182 #endif
12183
12184 #ifndef NSIG
12185 #  ifdef SIG_MAX
12186 #    define NSIG (SIG_MAX+1)
12187 #  endif
12188 #endif
12189
12190 #ifndef NSIG
12191 #  ifdef MAXSIG
12192 #    define NSIG (MAXSIG+1)
12193 #  endif
12194 #endif
12195
12196 #ifndef NSIG
12197 #  ifdef MAX_SIG
12198 #    define NSIG (MAX_SIG+1)
12199 #  endif
12200 #endif
12201
12202 #ifndef NSIG
12203 #  ifdef SIGARRAYSIZE
12204 #    define NSIG (SIGARRAYSIZE+1) /* Not sure of the +1 */
12205 #  endif
12206 #endif
12207
12208 #ifndef NSIG
12209 #  ifdef _sys_nsig
12210 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
12211 #  endif
12212 #endif
12213
12214 /* Default to some arbitrary number that's big enough to get most
12215    of the common signals.
12216 */
12217 #ifndef NSIG
12218 #    define NSIG 50
12219 #endif
12220
12221 printf("NSIG %d\n", NSIG);
12222
12223 #ifndef JUST_NSIG
12224
12225 EOCP
12226
12227 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
12228 {
12229         printf "#ifdef SIG"; printf $1; printf "\n"
12230         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
12231         printf $1; printf ");\n"
12232         printf "#endif\n"
12233 }
12234 END {
12235         printf "#endif /* JUST_NSIG */\n";
12236         printf "}\n";
12237 }
12238 ' >>signal.c
12239 $cat >signal.awk <<'EOP'
12240 BEGIN { ndups = 0 }
12241 $1 ~ /^NSIG$/ { nsig = $2 }
12242 ($1 !~ /^NSIG$/) && (NF == 2) {
12243     if ($2 > maxsig) { maxsig = $2 }
12244     if (sig_name[$2]) {
12245         dup_name[ndups] = $1
12246         dup_num[ndups] = $2
12247         ndups++ 
12248     }
12249     else {
12250         sig_name[$2] = $1
12251         sig_num[$2] = $2
12252     }
12253 }
12254 END { 
12255     if (nsig == 0) {
12256         nsig = maxsig + 1
12257     }
12258     printf("NSIG %d\n", nsig);
12259     for (n = 1; n < nsig; n++) {
12260         if (sig_name[n]) {
12261             printf("%s %d\n", sig_name[n], sig_num[n])
12262         }
12263         else {
12264             printf("NUM%d %d\n", n, n) 
12265         }
12266     }
12267     for (n = 0; n < ndups; n++) {
12268         printf("%s %d\n", dup_name[n], dup_num[n])
12269     }
12270 }
12271 EOP
12272 $cat >signal_cmd <<EOS
12273 $startsh
12274 if $test -s signal.lst; then
12275     echo "Using your existing signal.lst file"
12276         exit 0
12277 fi
12278 xxx="$xxx"
12279 EOS
12280 $cat >>signal_cmd <<'EOS'
12281
12282 set signal
12283 if eval $compile_ok; then
12284         ./signal$_exe | $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
12285 else
12286         echo "(I can't seem be able to compile the whole test program)" >&4
12287         echo "(I'll try it in little pieces.)" >&4
12288         set signal -DJUST_NSIG
12289         if eval $compile_ok; then
12290                 ./signal$_exe > signal.nsg
12291                 $cat signal.nsg
12292         else
12293                 echo "I can't seem to figure out how many signals you have." >&4
12294                 echo "Guessing 50." >&4
12295                 echo 'NSIG 50' > signal.nsg
12296         fi
12297         : Now look at all the signal names, one at a time.
12298         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
12299                 $cat > signal.c <<EOCP
12300 #include <sys/types.h>
12301 #include <signal.h>
12302 #include <stdio.h>
12303 int main() {
12304 printf("$xx %d\n", SIG${xx});
12305 return 0;
12306 }
12307 EOCP
12308                 set signal
12309                 if eval $compile; then
12310                         echo "SIG${xx} found."
12311                         ./signal$_exe  >> signal.ls1
12312                 else
12313                         echo "SIG${xx} NOT found."
12314                 fi
12315         done
12316         if $test -s signal.ls1; then
12317                 $cat signal.nsg signal.ls1 |
12318                         $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
12319         fi
12320
12321 fi
12322 if $test -s signal.lst; then
12323         :
12324 else
12325         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
12326         echo 'kill -l' >signal
12327         set X `csh -f <signal`
12328         $rm -f signal
12329         shift
12330         case $# in
12331         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
12332         esac
12333         echo $@ | $tr ' ' $trnl | \
12334             $awk '{ printf "%s %d\n", $1, ++s; }
12335                   END { printf "NSIG %d\n", ++s }' >signal.lst
12336 fi
12337 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
12338 EOS
12339 chmod a+x signal_cmd
12340 $eunicefix signal_cmd
12341
12342 : generate list of signal names
12343 echo " "
12344 case "$sig_name_init" in
12345 '') doinit=yes ;;
12346 *)  case "$sig_num_init" in
12347     ''|*,*) doinit=yes ;;
12348     esac ;;
12349 esac
12350 case "$doinit" in
12351 yes)
12352         echo "Generating a list of signal names and numbers..." >&4
12353         . ./signal_cmd
12354         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
12355         sig_name=`$awk 'BEGIN { printf "ZERO " }
12356                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
12357         sig_num=`$awk  'BEGIN { printf "0 " }
12358                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
12359         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
12360                              !/^NSIG/   { printf "\"%s\", ", $1 }
12361                              END        { printf "0\n" }' signal.lst`
12362         sig_num_init=`$awk  'BEGIN      { printf "0, " }
12363                              !/^NSIG/   { printf "%d, ", $2}
12364                              END        { printf "0\n"}' signal.lst`
12365         ;;
12366 esac
12367 echo "The following $sig_count signals are available:"
12368 echo " "
12369 echo $sig_name | $awk \
12370 'BEGIN { linelen = 0 }
12371 {
12372         for (i = 1; i <= NF; i++) {
12373                 name = "SIG" $i " "
12374                 linelen = linelen + length(name)
12375                 if (linelen > 70) {
12376                         printf "\n"
12377                         linelen = length(name)
12378                 }
12379                 printf "%s", name
12380         }
12381         printf "\n"
12382 }'
12383 $rm -f signal signal.c signal.awk signal.lst signal_cmd 
12384
12385 : see what type is used for signed size_t
12386 set ssize_t ssizetype int stdio.h sys/types.h
12387 eval $typedef
12388 dflt="$ssizetype"
12389 $cat > ssize.c <<EOM
12390 #include <stdio.h>
12391 #include <sys/types.h>
12392 #define Size_t $sizetype
12393 #define SSize_t $dflt
12394 int main()
12395 {
12396         if (sizeof(Size_t) == sizeof(SSize_t))
12397                 printf("$dflt\n");
12398         else if (sizeof(Size_t) == sizeof(int))
12399                 printf("int\n");
12400         else 
12401                 printf("long\n");
12402         exit(0);
12403 }
12404 EOM
12405 echo " "
12406 set ssize
12407 if eval $compile_ok && ./ssize > /dev/null; then
12408         ssizetype=`./ssize`
12409         echo "I'll be using $ssizetype for functions returning a byte count." >&4
12410 else
12411         $cat >&4 <<EOM
12412 Help! I can't compile and run the ssize_t test program: please enlighten me!
12413 (This is probably a misconfiguration in your system or libraries, and
12414 you really ought to fix it.  Still, I'll try anyway.)
12415
12416 I need a type that is the same size as $sizetype, but is guaranteed to
12417 be signed.  Common values are ssize_t, int and long.
12418
12419 EOM
12420         rp="What signed type is the same size as $sizetype?"
12421         . ./myread
12422         ssizetype="$ans"
12423 fi
12424 $rm -f ssize ssize.*
12425
12426 : see what type of char stdio uses.
12427 echo " "
12428 if $contains 'unsigned.*char.*_ptr;' `./findhdr stdio.h` >/dev/null 2>&1 ; then
12429         echo "Your stdio uses unsigned chars." >&4
12430         stdchar="unsigned char"
12431 else
12432         echo "Your stdio uses signed chars." >&4
12433         stdchar="char"
12434 fi
12435
12436 : see if time exists
12437 echo " "
12438 if test "X$d_time" = X -o X"$timetype" = X; then
12439     if set time val -f d_time; eval $csym; $val; then
12440                 echo 'time() found.' >&4
12441                 val="$define"
12442                 rp="What is the type returned by time() on this system?"
12443                 set time_t timetype long stdio.h sys/types.h
12444                 eval $typedef_ask
12445     else
12446                 echo 'time() not found, hope that will do.' >&4
12447                 val="$undef"
12448                 timetype='int';
12449     fi
12450     set d_time
12451     eval $setvar
12452 fi
12453
12454 : see what type uids are declared as in the kernel
12455 echo " "
12456 echo "Looking for the type for user ids returned by getuid()."
12457 set uid_t uidtype xxx stdio.h sys/types.h
12458 eval $typedef
12459 case "$uidtype" in
12460 xxx)
12461         xxx=`./findhdr sys/user.h`
12462         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
12463         case $1 in
12464         unsigned) dflt="$1 $2" ;;
12465         *) dflt="$1" ;;
12466         esac
12467         ;;
12468 *) dflt="$uidtype";;
12469 esac
12470 case "$uidtype" in
12471 uid_t)  echo "uid_t found." ;;
12472 *)      rp="What is the type for user ids returned by getuid()?"
12473         . ./myread
12474         uidtype="$ans"
12475         ;;
12476 esac
12477
12478 : see if dbm.h is available
12479 : see if dbmclose exists
12480 set dbmclose d_dbmclose
12481 eval $inlibc
12482
12483 case "$d_dbmclose" in
12484 $define)
12485         set dbm.h i_dbm
12486         eval $inhdr
12487         case "$i_dbm" in
12488         $define)
12489                 val="$undef"
12490                 set i_rpcsvcdbm
12491                 eval $setvar
12492                 ;;
12493         *)      set rpcsvc/dbm.h i_rpcsvcdbm
12494                 eval $inhdr
12495                 ;;
12496         esac
12497         ;;
12498 *)      echo "We won't be including <dbm.h>"
12499         val="$undef"
12500         set i_dbm
12501         eval $setvar
12502         val="$undef"
12503         set i_rpcsvcdbm
12504         eval $setvar
12505         ;;
12506 esac
12507
12508 : see if this is a sys/file.h system
12509 val=''
12510 set sys/file.h val
12511 eval $inhdr
12512
12513 : do we need to include sys/file.h ?
12514 case "$val" in
12515 "$define")
12516         echo " "
12517         if $h_sysfile; then
12518                 val="$define"
12519                 echo "We'll be including <sys/file.h>." >&4
12520         else
12521                 val="$undef"
12522                 echo "We won't be including <sys/file.h>." >&4
12523         fi
12524         ;;
12525 *)
12526         h_sysfile=false
12527         ;;
12528 esac
12529 set i_sysfile
12530 eval $setvar
12531
12532 : see if fcntl.h is there
12533 val=''
12534 set fcntl.h val
12535 eval $inhdr
12536
12537 : see if we can include fcntl.h
12538 case "$val" in
12539 "$define")
12540         echo " "
12541         if $h_fcntl; then
12542                 val="$define"
12543                 echo "We'll be including <fcntl.h>." >&4
12544         else
12545                 val="$undef"
12546                 if $h_sysfile; then
12547         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
12548                 else
12549                         echo "We won't be including <fcntl.h>." >&4
12550                 fi
12551         fi
12552         ;;
12553 *)
12554         h_fcntl=false
12555         val="$undef"
12556         ;;
12557 esac
12558 set i_fcntl
12559 eval $setvar
12560
12561 : see if locale.h is available
12562 set locale.h i_locale
12563 eval $inhdr
12564
12565 : see if mach cthreads are available
12566 if test "X$usethreads" = "X$define"; then
12567         set mach/cthreads.h i_machcthr
12568         eval $inhdr
12569 else
12570         i_machcthr="$undef"
12571 fi
12572
12573
12574
12575 : see if this is a math.h system
12576 set math.h i_math
12577 eval $inhdr
12578
12579 : see if this is a mntent.h system
12580 set mntent.h i_mntent
12581 eval $inhdr
12582
12583 : see if ndbm.h is available
12584 set ndbm.h t_ndbm
12585 eval $inhdr
12586 case "$t_ndbm" in
12587 $define)
12588         : see if dbm_open exists
12589         set dbm_open d_dbm_open
12590         eval $inlibc
12591         case "$d_dbm_open" in
12592         $undef)
12593                 t_ndbm="$undef"
12594                 echo "We won't be including <ndbm.h>"
12595                 ;;
12596         esac
12597         ;;
12598 esac
12599 val="$t_ndbm"
12600 set i_ndbm
12601 eval $setvar
12602
12603 : see if net/errno.h is available
12604 val=''
12605 set net/errno.h val
12606 eval $inhdr
12607
12608 : Unfortunately, it causes problems on some systems.  Arrgh.
12609 case "$val" in
12610 $define)
12611         cat > try.c <<'EOM'
12612 #include <stdio.h>
12613 #include <errno.h>
12614 #include <net/errno.h>
12615 int func()
12616 {
12617         return ENOTSOCK;
12618 }
12619 EOM
12620         if $cc $ccflags -c try.c >/dev/null 2>&1; then
12621                 echo "We'll be including <net/errno.h>." >&4
12622         else
12623                 echo "We won't be including <net/errno.h>." >&4
12624                 val="$undef"
12625         fi
12626         $rm -f try.* try
12627         ;;
12628 esac
12629 set i_neterrno
12630 eval $setvar
12631
12632 : see if netinet/tcp.h is available
12633 set netinet/tcp.h i_netinettcp
12634 eval $inhdr
12635
12636 : see if this is a poll.h system
12637 set poll.h i_poll
12638 eval $inhdr
12639
12640 : get C preprocessor symbols handy
12641 echo " "
12642 $echo $n "Hmm... $c"
12643 echo $al | $tr ' ' $trnl >Cppsym.know
12644 $cat <<EOSS >Cppsym
12645 $startsh
12646 case "\$1" in
12647 -l) list=true
12648         shift
12649         ;;
12650 esac
12651 unknown=''
12652 case "\$list\$#" in
12653 1|2)
12654         for sym do
12655                 if $contains "^\$1$" Cppsym.true >/dev/null 2>&1; then
12656                         exit 0
12657                 elif $contains "^\$1$" Cppsym.know >/dev/null 2>&1; then
12658                         :
12659                 else
12660                         unknown="\$unknown \$sym"
12661                 fi
12662         done
12663         set X \$unknown
12664         shift
12665         ;;
12666 esac
12667 case \$# in
12668 0) exit 1;;
12669 esac
12670 echo \$* | $tr ' ' '$trnl' | $sed -e 's/\(.*\)/\\
12671 #ifdef \1\\
12672 exit 0; _ _ _ _\1\\      \1\\
12673 #endif\\
12674 /' >Cppsym\$\$
12675 echo "exit 1; _ _ _" >>Cppsym\$\$
12676 $cppstdin $cppminus <Cppsym\$\$ | $grep '^exit [01]; _ _'  >Cppsym2\$\$
12677 case "\$list" in
12678 true) $awk 'NF > 5 {print substr(\$6,2,100)}' <Cppsym2\$\$ ;;
12679 *)
12680         sh Cppsym2\$\$
12681         status=\$?
12682         ;;
12683 esac
12684 $rm -f Cppsym\$\$ Cppsym2\$\$
12685 exit \$status
12686 EOSS
12687 chmod +x Cppsym
12688 $eunicefix Cppsym
12689 ./Cppsym -l $al | $sort | $grep -v '^$' >Cppsym.true
12690
12691 : now check the C compiler for additional symbols
12692 postprocess_cc_v=''
12693 case "$osname" in
12694 aix) postprocess_cc_v="|$tr , ' '" ;;
12695 esac
12696 $cat >ccsym <<EOS
12697 $startsh
12698 $cat >tmp.c <<EOF
12699 extern int foo;
12700 EOF
12701 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
12702 do
12703         case "\$i" in
12704         -D*) echo "\$i" | $sed 's/^-D//';;
12705         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A\(.*\)(\(.*\))/\1=\2/';;
12706         esac
12707 done
12708 $rm -f try.c
12709 EOS
12710 postprocess_cc_v=''
12711 chmod +x ccsym
12712 $eunicefix ccsym
12713 ./ccsym > ccsym1.raw
12714 if $test -s ccsym1.raw; then
12715        $sort ccsym1.raw | $uniq >ccsym.raw
12716 else
12717        mv ccsym1.raw ccsym.raw
12718 fi
12719
12720 $awk '/\=/ { print $0; next }
12721         { print $0"=1" }' ccsym.raw >ccsym.list
12722 $awk '{ print $0"=1" }' Cppsym.true >ccsym.true
12723 $comm -13 ccsym.true ccsym.list >ccsym.own
12724 $comm -12 ccsym.true ccsym.list >ccsym.com
12725 $comm -23 ccsym.true ccsym.list >ccsym.cpp
12726 also=''
12727 if $test -z ccsym.raw; then
12728         echo "Your C compiler doesn't seem to define any symbols!" >&4
12729         echo " "
12730         echo "However, your C preprocessor defines the following symbols:"
12731         $cat Cppsym.true
12732         ccsymbols=''
12733         cppsymbols=`$cat Cppsym.true`
12734         cppsymbols=`echo $cppsymbols`
12735         cppccsymbols="$cppsymbols"
12736 else
12737         if $test -s ccsym.com; then
12738                 echo "Your C compiler and pre-processor define these symbols:"
12739                 $sed -e 's/\(.*\)=.*/\1/' ccsym.com
12740                 also='also '
12741                 symbols='ones'
12742                 cppccsymbols=`$cat ccsym.com`
12743                 cppccsymbols=`echo $cppccsymbols`
12744                 $test "$silent" || sleep 1
12745         fi
12746         if $test -s ccsym.cpp; then
12747                 $test "$also" && echo " "
12748                 echo "Your C pre-processor ${also}defines the following symbols:"
12749                 $sed -e 's/\(.*\)=.*/\1/' ccsym.cpp
12750                 also='further '
12751                 cppsymbols=`$cat ccsym.cpp`
12752                 cppsymbols=`echo $cppsymbols`
12753                 $test "$silent" || sleep 1
12754         fi
12755         if $test -s ccsym.own; then
12756                 $test "$also" && echo " "
12757                 echo "Your C compiler ${also}defines the following cpp symbols:"
12758                 $sed -e 's/\(.*\)=1/\1/' ccsym.own
12759                 $sed -e 's/\(.*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
12760                 ccsymbols=`$cat ccsym.own`
12761                 ccsymbols=`echo $ccsymbols`
12762                 $test "$silent" || sleep 1
12763         fi
12764 fi
12765 $rm -f ccsym*
12766
12767 : see if this is a termio system
12768 val="$undef"
12769 val2="$undef"
12770 val3="$undef"
12771 if $test `./findhdr termios.h`; then
12772         set tcsetattr i_termios
12773         eval $inlibc
12774         val3="$i_termios"
12775 fi
12776 echo " "
12777 case "$val3" in
12778 "$define") echo "You have POSIX termios.h... good!" >&4;;
12779 *) if ./Cppsym pyr; then
12780                 case "`/bin/universe`" in
12781                 ucb) if $test `./findhdr sgtty.h`; then
12782                                 val2="$define"
12783                                 echo "<sgtty.h> found." >&4
12784                         else
12785                                 echo "System is pyramid with BSD universe."
12786                                 echo "<sgtty.h> not found--you could have problems." >&4
12787                         fi;;
12788                 *) if $test `./findhdr termio.h`; then
12789                                 val="$define"
12790                                 echo "<termio.h> found." >&4
12791                         else
12792                                 echo "System is pyramid with USG universe."
12793                                 echo "<termio.h> not found--you could have problems." >&4
12794                         fi;;
12795                 esac
12796         elif ./usg; then
12797                 if $test `./findhdr termio.h`; then
12798                         echo "<termio.h> found." >&4
12799                         val="$define"
12800                 elif $test `./findhdr sgtty.h`; then
12801                         echo "<sgtty.h> found." >&4
12802                         val2="$define"
12803                 else
12804 echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
12805                 fi
12806         else
12807                 if $test `./findhdr sgtty.h`; then
12808                         echo "<sgtty.h> found." >&4
12809                         val2="$define"
12810                 elif $test `./findhdr termio.h`; then
12811                         echo "<termio.h> found." >&4
12812                         val="$define"
12813                 else
12814 echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
12815                 fi
12816         fi;;
12817 esac
12818 set i_termio; eval $setvar
12819 val=$val2; set i_sgtty; eval $setvar
12820 val=$val3; set i_termios; eval $setvar
12821
12822 : see if this is a shadow.h system
12823 set shadow.h i_shadow
12824 eval $inhdr
12825
12826 : see if this is a socks.h system
12827 set socks.h i_socks
12828 eval $inhdr
12829
12830 : see if stdarg is available
12831 echo " "
12832 if $test `./findhdr stdarg.h`; then
12833         echo "<stdarg.h> found." >&4
12834         valstd="$define"
12835 else
12836         echo "<stdarg.h> NOT found." >&4
12837         valstd="$undef"
12838 fi
12839
12840 : see if varags is available
12841 echo " "
12842 if $test `./findhdr varargs.h`; then
12843         echo "<varargs.h> found." >&4
12844 else
12845         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
12846 fi
12847
12848 : set up the varargs testing programs
12849 $cat > varargs.c <<EOP
12850 #ifdef I_STDARG
12851 #include <stdarg.h>
12852 #endif
12853 #ifdef I_VARARGS
12854 #include <varargs.h>
12855 #endif
12856
12857 #ifdef I_STDARG
12858 int f(char *p, ...)
12859 #else
12860 int f(va_alist)
12861 va_dcl
12862 #endif
12863 {
12864         va_list ap;
12865 #ifndef I_STDARG
12866         char *p;
12867 #endif
12868 #ifdef I_STDARG
12869         va_start(ap,p);
12870 #else
12871         va_start(ap);
12872         p = va_arg(ap, char *);
12873 #endif
12874         va_end(ap);
12875 }
12876 EOP
12877 $cat > varargs <<EOP
12878 $startsh
12879 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
12880         echo "true"
12881 else
12882         echo "false"
12883 fi
12884 $rm -f varargs$_o
12885 EOP
12886 chmod +x varargs
12887
12888 : now check which varargs header should be included
12889 echo " "
12890 i_varhdr=''
12891 case "$valstd" in
12892 "$define")
12893         if `./varargs I_STDARG`; then
12894                 val='stdarg.h'
12895         elif `./varargs I_VARARGS`; then
12896                 val='varargs.h'
12897         fi
12898         ;;
12899 *)
12900         if `./varargs I_VARARGS`; then
12901                 val='varargs.h'
12902         fi
12903         ;;
12904 esac
12905 case "$val" in
12906 '')
12907 echo "I could not find the definition for va_dcl... You have problems..." >&4
12908         val="$undef"; set i_stdarg; eval $setvar
12909         val="$undef"; set i_varargs; eval $setvar
12910         ;;
12911 *) 
12912         set i_varhdr
12913         eval $setvar
12914         case "$i_varhdr" in
12915         stdarg.h)
12916                 val="$define"; set i_stdarg; eval $setvar
12917                 val="$undef"; set i_varargs; eval $setvar
12918                 ;;
12919         varargs.h)
12920                 val="$undef"; set i_stdarg; eval $setvar
12921                 val="$define"; set i_varargs; eval $setvar
12922                 ;;
12923         esac
12924         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
12925 esac
12926 $rm -f varargs*
12927
12928 : see if stddef is available
12929 set stddef.h i_stddef
12930 eval $inhdr
12931
12932 : see if sys/access.h is available
12933 set sys/access.h i_sysaccess
12934 eval $inhdr
12935
12936 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
12937 set sys/filio.h i_sysfilio
12938 eval $inhdr
12939 echo " "
12940 if $test `./findhdr sys/ioctl.h`; then
12941         val="$define"
12942         echo '<sys/ioctl.h> found.' >&4
12943 else
12944         val="$undef"
12945         if $test $i_sysfilio = "$define"; then
12946             echo '<sys/ioctl.h> NOT found.' >&4
12947         else
12948                 $test $i_sgtty = "$define" && xxx="sgtty.h"
12949                 $test $i_termio = "$define" && xxx="termio.h"
12950                 $test $i_termios = "$define" && xxx="termios.h"
12951 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
12952         fi
12953 fi
12954 set i_sysioctl
12955 eval $setvar
12956
12957 : see if sys/resource.h has to be included
12958 set sys/resource.h i_sysresrc
12959 eval $inhdr
12960
12961 : see if sys/security.h is available
12962 set sys/security.h i_syssecrt
12963 eval $inhdr
12964
12965 : see if this is a sys/statvfs.h system
12966 set sys/statvfs.h i_sysstatvfs
12967 eval $inhdr
12968
12969 : see if this is a sys/un.h system
12970 set sys/un.h i_sysun
12971 eval $inhdr
12972
12973 : see if this is a syswait system
12974 set sys/wait.h i_syswait
12975 eval $inhdr
12976
12977 : see if this is an utime system
12978 set utime.h i_utime
12979 eval $inhdr
12980
12981 : see if this is a values.h system
12982 set values.h i_values
12983 eval $inhdr
12984
12985 : see if this is a vfork system
12986 case "$d_vfork" in
12987 "$define")
12988         set vfork.h i_vfork
12989         eval $inhdr
12990         ;;
12991 *)
12992         i_vfork="$undef"
12993         ;;
12994 esac
12995
12996 : see if gdbm.h is available
12997 set gdbm.h t_gdbm
12998 eval $inhdr
12999 case "$t_gdbm" in
13000 $define)
13001         : see if gdbm_open exists
13002         set gdbm_open d_gdbm_open
13003         eval $inlibc
13004         case "$d_gdbm_open" in
13005         $undef)
13006                 t_gdbm="$undef"
13007                 echo "We won't be including <gdbm.h>"
13008                 ;;
13009         esac
13010         ;;
13011 esac
13012 val="$t_gdbm"
13013 set i_gdbm
13014 eval $setvar
13015
13016 echo " "
13017 echo "Looking for extensions..." >&4
13018 : If we are using the old config.sh, known_extensions may contain
13019 : old or inaccurate or duplicate values.
13020 known_extensions=''
13021 nonxs_extensions=''
13022 : We do not use find because it might not be available.
13023 : We do not just use MANIFEST because the user may have dropped
13024 : some additional extensions into the source tree and expect them
13025 : to be built.
13026
13027 : Function to recursively find available extensions, ignoring DynaLoader
13028 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
13029 find_extensions='
13030     for xxx in *; do
13031        case "$xxx" in
13032            DynaLoader|dynaload) ;;
13033            *)
13034            if $test -f $xxx/$xxx.xs; then
13035                known_extensions="$known_extensions $1$xxx";
13036            elif $test -f $xxx/Makefile.PL; then
13037                nonxs_extensions="$nonxs_extensions $1$xxx";
13038            else
13039                if $test -d $xxx -a $# -lt 10; then
13040                    set $1$xxx/ $*;
13041                    cd $xxx;
13042                    eval $find_extensions;
13043                    cd ..;
13044                    shift;
13045                fi;
13046            fi
13047            ;;
13048        esac;
13049     done'
13050 tdir=`pwd`
13051 cd $rsrc/ext
13052 set X
13053 shift
13054 eval $find_extensions
13055 set X $nonxs_extensions
13056 shift
13057 nonxs_extensions="$*"
13058 set X $known_extensions
13059 shift
13060 known_extensions="$*"
13061 cd $tdir
13062
13063 : Now see which are supported on this system.
13064 avail_ext=''
13065 for xxx in $known_extensions ; do
13066         case "$xxx" in
13067         DB_File|db_file)
13068                 case "$i_db" in
13069                 $define) avail_ext="$avail_ext $xxx" ;;
13070                 esac
13071                 ;;
13072         GDBM_File|gdbm_fil)
13073                 case "$i_gdbm" in 
13074                 $define) avail_ext="$avail_ext $xxx" ;;
13075                 esac
13076                 ;;
13077         NDBM_File|ndbm_fil)
13078                 case "$i_ndbm" in
13079                 $define) avail_ext="$avail_ext $xxx" ;;
13080                 esac
13081                 ;;
13082         ODBM_File|odbm_fil) 
13083                 case "${i_dbm}${i_rpcsvcdbm}" in
13084                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
13085                 esac
13086                 ;;
13087         POSIX|posix)
13088                 case "$useposix" in
13089                 true|define|y) avail_ext="$avail_ext $xxx" ;;
13090                 esac
13091                 ;;
13092         Opcode|opcode)
13093                 case "$useopcode" in
13094                 true|define|y) avail_ext="$avail_ext $xxx" ;;
13095                 esac
13096                 ;;
13097         Socket|socket)
13098                 case "$d_socket" in 
13099                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
13100                 esac
13101                 ;;
13102         Thread|thread)
13103                 case "$usethreads" in 
13104                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
13105                 esac
13106                 ;;
13107         IPC/SysV|ipc/sysv)
13108                 : XXX Do we need a useipcsysv variable here
13109                 case "${d_msg}${d_sem}${d_shm}" in 
13110                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
13111                 esac
13112                 ;;
13113         *)      avail_ext="$avail_ext $xxx"
13114                 ;;
13115         esac
13116 done
13117
13118 set X $avail_ext
13119 shift
13120 avail_ext="$*"
13121
13122 : Now see which nonxs extensions are supported on this system.
13123 : For now assume all are.
13124 nonxs_ext=''
13125 for xxx in $nonxs_extensions ; do
13126         case "$xxx" in
13127         *)      nonxs_ext="$nonxs_ext $xxx"
13128                 ;;
13129         esac
13130 done
13131
13132 set X $nonxs_ext
13133 shift
13134 nonxs_ext="$*"
13135
13136 case $usedl in
13137 $define)
13138         $cat <<EOM
13139 A number of extensions are supplied with $package.  You may choose to
13140 compile these extensions for dynamic loading (the default), compile
13141 them into the $package executable (static loading), or not include
13142 them at all.  Answer "none" to include no extensions.
13143 Note that DynaLoader is always built and need not be mentioned here.
13144
13145 EOM
13146         case "$dynamic_ext" in
13147         '') dflt="$avail_ext" ;;
13148         *)      dflt="$dynamic_ext"
13149                 # Perhaps we are reusing an old out-of-date config.sh.
13150                 case "$hint" in
13151                 previous)
13152                         if test X"$dynamic_ext" != X"$avail_ext"; then
13153                                 $cat <<EOM
13154 NOTICE:  Your previous config.sh list may be incorrect. 
13155 The extensions now available to you are 
13156         ${avail_ext}
13157 but the default list from your previous config.sh is
13158         ${dynamic_ext} 
13159
13160 EOM
13161                         fi
13162                         ;;
13163                 esac
13164                 ;;
13165         esac
13166         case "$dflt" in
13167         '')     dflt=none;;
13168         esac
13169         rp="What extensions do you wish to load dynamically?"
13170         . ./myread
13171         case "$ans" in
13172         none) dynamic_ext=' ' ;;
13173         *) dynamic_ext="$ans" ;;
13174         esac
13175
13176         case "$static_ext" in
13177         '')
13178                 : Exclude those already listed in dynamic linking
13179                 dflt=''
13180                 for xxx in $avail_ext; do
13181                         case " $dynamic_ext " in
13182                         *" $xxx "*) ;;
13183                         *) dflt="$dflt $xxx" ;;
13184                         esac
13185                 done
13186                 set X $dflt
13187                 shift
13188                 dflt="$*"
13189                 ;;
13190         *)  dflt="$static_ext" 
13191                 ;;
13192         esac
13193
13194         case "$dflt" in
13195         '')     dflt=none;;
13196         esac
13197         rp="What extensions do you wish to load statically?"
13198         . ./myread
13199         case "$ans" in
13200         none) static_ext=' ' ;;
13201         *) static_ext="$ans" ;;
13202         esac
13203         ;;
13204 *)
13205         $cat <<EOM
13206 A number of extensions are supplied with $package.  Answer "none" 
13207 to include no extensions. 
13208 Note that DynaLoader is always built and need not be mentioned here.
13209
13210 EOM
13211         case "$static_ext" in
13212         '') dflt="$avail_ext" ;;
13213         *)      dflt="$static_ext"
13214                 # Perhaps we are reusing an old out-of-date config.sh.
13215                 case "$hint" in
13216                 previous)
13217                         if test X"$static_ext" != X"$avail_ext"; then
13218                                 $cat <<EOM
13219 NOTICE:  Your previous config.sh list may be incorrect. 
13220 The extensions now available to you are 
13221         ${avail_ext}
13222 but the default list from your previous config.sh is
13223         ${static_ext} 
13224
13225 EOM
13226                         fi
13227                         ;;
13228                 esac
13229                 ;;
13230         esac
13231         : Exclude those that are not xs extensions
13232         case "$dflt" in
13233         '')     dflt=none;;
13234         esac
13235         rp="What extensions do you wish to include?"
13236         . ./myread
13237         case "$ans" in
13238         none) static_ext=' ' ;;
13239         *) static_ext="$ans" ;;
13240         esac
13241         ;;
13242 esac
13243
13244 set X $dynamic_ext $static_ext $nonxs_ext
13245 shift
13246 extensions="$*"
13247
13248 : Remove build directory name from cppstdin so it can be used from
13249 : either the present location or the final installed location.
13250 echo " "
13251 : Get out of the UU directory to get correct path name.
13252 cd ..
13253 case "$cppstdin" in
13254 `pwd`/cppstdin)
13255         echo "Stripping down cppstdin path name"
13256         cppstdin=cppstdin
13257         ;;
13258 esac
13259 cd UU
13260
13261 : end of configuration questions
13262 echo " "
13263 echo "End of configuration questions."
13264 echo " "
13265
13266 : back to where it started
13267 if test -d ../UU; then
13268         cd ..
13269 fi
13270
13271 : configuration may be patched via a 'config.over' file
13272 if $test -f config.over; then
13273         echo " "
13274         dflt=y
13275         rp='I see a config.over file.  Do you wish to load it?'
13276         . UU/myread
13277         case "$ans" in
13278         n*) echo "OK, I'll ignore it.";;
13279         *)      . ./config.over
13280                 echo "Configuration override changes have been loaded."
13281                 ;;
13282         esac
13283 fi
13284
13285 : in case they want portability, strip down executable paths
13286 case "$d_portable" in
13287 "$define")
13288         echo " "
13289         echo "Stripping down executable paths..." >&4
13290         for file in $loclist $trylist; do
13291                 eval temp=\$$file
13292                 eval $file=`basename $temp`
13293         done
13294         ;;
13295 esac
13296
13297 : create config.sh file
13298 echo " "
13299 echo "Creating config.sh..." >&4
13300 $spitshell <<EOT >config.sh
13301 $startsh
13302 #
13303 # This file was produced by running the Configure script. It holds all the
13304 # definitions figured out by Configure. Should you modify one of these values,
13305 # do not forget to propagate your changes by running "Configure -der". You may
13306 # instead choose to run each of the .SH files by yourself, or "Configure -S".
13307 #
13308
13309 # Package name      : $package
13310 # Source directory  : $src
13311 # Configuration time: $cf_time
13312 # Configured by     : $cf_by
13313 # Target system     : $myuname
13314
13315 Author='$Author'
13316 Date='$Date'
13317 Header='$Header'
13318 Id='$Id'
13319 Locker='$Locker'
13320 Log='$Log'
13321 Mcc='$Mcc'
13322 RCSfile='$RCSfile'
13323 Revision='$Revision'
13324 Source='$Source'
13325 State='$State'
13326 _a='$_a'
13327 _exe='$_exe'
13328 _o='$_o'
13329 afs='$afs'
13330 alignbytes='$alignbytes'
13331 ansi2knr='$ansi2knr'
13332 aphostname='$aphostname'
13333 apiversion='$apiversion'
13334 ar='$ar'
13335 archlib='$archlib'
13336 archlibexp='$archlibexp'
13337 archname64='$archname64'
13338 archname='$archname'
13339 archobjs='$archobjs'
13340 awk='$awk'
13341 baserev='$baserev'
13342 bash='$bash'
13343 bin='$bin'
13344 bincompat5005='$bincompat5005'
13345 binexp='$binexp'
13346 bison='$bison'
13347 byacc='$byacc'
13348 byteorder='$byteorder'
13349 c='$c'
13350 castflags='$castflags'
13351 cat='$cat'
13352 cc='$cc'
13353 cccdlflags='$cccdlflags'
13354 ccdlflags='$ccdlflags'
13355 ccflags='$ccflags'
13356 ccsymbols='$ccsymbols'
13357 cf_by='$cf_by'
13358 cf_email='$cf_email'
13359 cf_time='$cf_time'
13360 chgrp='$chgrp'
13361 chmod='$chmod'
13362 chown='$chown'
13363 clocktype='$clocktype'
13364 comm='$comm'
13365 compress='$compress'
13366 contains='$contains'
13367 cp='$cp'
13368 cpio='$cpio'
13369 cpp='$cpp'
13370 cpp_stuff='$cpp_stuff'
13371 cppccsymbols='$cppccsymbols'
13372 cppflags='$cppflags'
13373 cpplast='$cpplast'
13374 cppminus='$cppminus'
13375 cpprun='$cpprun'
13376 cppstdin='$cppstdin'
13377 cppsymbols='$cppsymbols'
13378 crosscompile='$crosscompile'
13379 cryptlib='$cryptlib'
13380 csh='$csh'
13381 d_Gconvert='$d_Gconvert'
13382 d_PRIEldbl='$d_PRIEldbl'
13383 d_PRIFldbl='$d_PRIFldbl'
13384 d_PRIGldbl='$d_PRIGldbl'
13385 d_PRIX64='$d_PRIX64'
13386 d_PRId64='$d_PRId64'
13387 d_PRIeldbl='$d_PRIeldbl'
13388 d_PRIfldbl='$d_PRIfldbl'
13389 d_PRIgldbl='$d_PRIgldbl'
13390 d_PRIi64='$d_PRIi64'
13391 d_PRIo64='$d_PRIo64'
13392 d_PRIu64='$d_PRIu64'
13393 d_PRIx64='$d_PRIx64'
13394 d_access='$d_access'
13395 d_accessx='$d_accessx'
13396 d_alarm='$d_alarm'
13397 d_archlib='$d_archlib'
13398 d_atolf='$d_atolf'
13399 d_atoll='$d_atoll'
13400 d_attribut='$d_attribut'
13401 d_bcmp='$d_bcmp'
13402 d_bcopy='$d_bcopy'
13403 d_bincompat5005='$d_bincompat5005'
13404 d_bsd='$d_bsd'
13405 d_bsdgetpgrp='$d_bsdgetpgrp'
13406 d_bsdsetpgrp='$d_bsdsetpgrp'
13407 d_bzero='$d_bzero'
13408 d_casti32='$d_casti32'
13409 d_castneg='$d_castneg'
13410 d_charvspr='$d_charvspr'
13411 d_chown='$d_chown'
13412 d_chroot='$d_chroot'
13413 d_chsize='$d_chsize'
13414 d_closedir='$d_closedir'
13415 d_cmsghdr_s='$d_cmsghdr_s'
13416 d_const='$d_const'
13417 d_crypt='$d_crypt'
13418 d_csh='$d_csh'
13419 d_cuserid='$d_cuserid'
13420 d_dbl_dig='$d_dbl_dig'
13421 d_difftime='$d_difftime'
13422 d_dirnamlen='$d_dirnamlen'
13423 d_dlerror='$d_dlerror'
13424 d_dlopen='$d_dlopen'
13425 d_dlsymun='$d_dlsymun'
13426 d_dosuid='$d_dosuid'
13427 d_drand48proto='$d_drand48proto'
13428 d_dup2='$d_dup2'
13429 d_eaccess='$d_eaccess'
13430 d_endgrent='$d_endgrent'
13431 d_endhent='$d_endhent'
13432 d_endnent='$d_endnent'
13433 d_endpent='$d_endpent'
13434 d_endpwent='$d_endpwent'
13435 d_endsent='$d_endsent'
13436 d_endspent='$d_endspent'
13437 d_eofnblk='$d_eofnblk'
13438 d_eunice='$d_eunice'
13439 d_fchmod='$d_fchmod'
13440 d_fchown='$d_fchown'
13441 d_fcntl='$d_fcntl'
13442 d_fd_macros='$d_fd_macros'
13443 d_fd_set='$d_fd_set'
13444 d_fds_bits='$d_fds_bits'
13445 d_fgetpos='$d_fgetpos'
13446 d_flexfnam='$d_flexfnam'
13447 d_flock='$d_flock'
13448 d_fork='$d_fork'
13449 d_fpathconf='$d_fpathconf'
13450 d_fpos64_t='$d_fpos64_t'
13451 d_fseeko='$d_fseeko'
13452 d_fsetpos='$d_fsetpos'
13453 d_fstatfs='$d_fstatfs'
13454 d_fstatvfs='$d_fstatvfs'
13455 d_ftello='$d_ftello'
13456 d_ftime='$d_ftime'
13457 d_getgrent='$d_getgrent'
13458 d_getgrps='$d_getgrps'
13459 d_gethbyaddr='$d_gethbyaddr'
13460 d_gethbyname='$d_gethbyname'
13461 d_gethent='$d_gethent'
13462 d_gethname='$d_gethname'
13463 d_gethostprotos='$d_gethostprotos'
13464 d_getlogin='$d_getlogin'
13465 d_getmntent='$d_getmntent'
13466 d_getnbyaddr='$d_getnbyaddr'
13467 d_getnbyname='$d_getnbyname'
13468 d_getnent='$d_getnent'
13469 d_getnetprotos='$d_getnetprotos'
13470 d_getpbyname='$d_getpbyname'
13471 d_getpbynumber='$d_getpbynumber'
13472 d_getpent='$d_getpent'
13473 d_getpgid='$d_getpgid'
13474 d_getpgrp2='$d_getpgrp2'
13475 d_getpgrp='$d_getpgrp'
13476 d_getppid='$d_getppid'
13477 d_getprior='$d_getprior'
13478 d_getprotoprotos='$d_getprotoprotos'
13479 d_getpwent='$d_getpwent'
13480 d_getsbyname='$d_getsbyname'
13481 d_getsbyport='$d_getsbyport'
13482 d_getsent='$d_getsent'
13483 d_getservprotos='$d_getservprotos'
13484 d_getspent='$d_getspent'
13485 d_getspnam='$d_getspnam'
13486 d_gettimeod='$d_gettimeod'
13487 d_gnulibc='$d_gnulibc'
13488 d_grpasswd='$d_grpasswd'
13489 d_hasmntopt='$d_hasmntopt'
13490 d_htonl='$d_htonl'
13491 d_index='$d_index'
13492 d_inetaton='$d_inetaton'
13493 d_int64t='$d_int64t'
13494 d_iovec_s='$d_iovec_s'
13495 d_isascii='$d_isascii'
13496 d_killpg='$d_killpg'
13497 d_lchown='$d_lchown'
13498 d_ldbl_dig='$d_ldbl_dig'
13499 d_link='$d_link'
13500 d_llseek='$d_llseek'
13501 d_locconv='$d_locconv'
13502 d_lockf='$d_lockf'
13503 d_longdbl='$d_longdbl'
13504 d_longlong='$d_longlong'
13505 d_lstat='$d_lstat'
13506 d_madvise='$d_madvise'
13507 d_mblen='$d_mblen'
13508 d_mbstowcs='$d_mbstowcs'
13509 d_mbtowc='$d_mbtowc'
13510 d_memchr='$d_memchr'
13511 d_memcmp='$d_memcmp'
13512 d_memcpy='$d_memcpy'
13513 d_memmove='$d_memmove'
13514 d_memset='$d_memset'
13515 d_mkdir='$d_mkdir'
13516 d_mkfifo='$d_mkfifo'
13517 d_mktime='$d_mktime'
13518 d_mmap='$d_mmap'
13519 d_mprotect='$d_mprotect'
13520 d_msg='$d_msg'
13521 d_msg_ctrunc='$d_msg_ctrunc'
13522 d_msg_dontroute='$d_msg_dontroute'
13523 d_msg_oob='$d_msg_oob'
13524 d_msg_peek='$d_msg_peek'
13525 d_msg_proxy='$d_msg_proxy'
13526 d_msgctl='$d_msgctl'
13527 d_msgget='$d_msgget'
13528 d_msghdr_s='$d_msghdr_s'
13529 d_msgrcv='$d_msgrcv'
13530 d_msgsnd='$d_msgsnd'
13531 d_msync='$d_msync'
13532 d_munmap='$d_munmap'
13533 d_mymalloc='$d_mymalloc'
13534 d_nice='$d_nice'
13535 d_off64_t='$d_off64_t'
13536 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
13537 d_oldpthreads='$d_oldpthreads'
13538 d_oldsock='$d_oldsock'
13539 d_open3='$d_open3'
13540 d_pathconf='$d_pathconf'
13541 d_pause='$d_pause'
13542 d_phostname='$d_phostname'
13543 d_pipe='$d_pipe'
13544 d_poll='$d_poll'
13545 d_portable='$d_portable'
13546 d_pthread_yield='$d_pthread_yield'
13547 d_pwage='$d_pwage'
13548 d_pwchange='$d_pwchange'
13549 d_pwclass='$d_pwclass'
13550 d_pwcomment='$d_pwcomment'
13551 d_pwexpire='$d_pwexpire'
13552 d_pwgecos='$d_pwgecos'
13553 d_pwpasswd='$d_pwpasswd'
13554 d_pwquota='$d_pwquota'
13555 d_readdir='$d_readdir'
13556 d_readlink='$d_readlink'
13557 d_readv='$d_readv'
13558 d_recvmsg='$d_recvmsg'
13559 d_rename='$d_rename'
13560 d_rewinddir='$d_rewinddir'
13561 d_rmdir='$d_rmdir'
13562 d_safebcpy='$d_safebcpy'
13563 d_safemcpy='$d_safemcpy'
13564 d_sanemcmp='$d_sanemcmp'
13565 d_sched_yield='$d_sched_yield'
13566 d_scm_rights='$d_scm_rights'
13567 d_seekdir='$d_seekdir'
13568 d_select='$d_select'
13569 d_sem='$d_sem'
13570 d_semctl='$d_semctl'
13571 d_semctl_semid_ds='$d_semctl_semid_ds'
13572 d_semctl_semun='$d_semctl_semun'
13573 d_semget='$d_semget'
13574 d_semop='$d_semop'
13575 d_sendmsg='$d_sendmsg'
13576 d_setegid='$d_setegid'
13577 d_seteuid='$d_seteuid'
13578 d_setgrent='$d_setgrent'
13579 d_setgrps='$d_setgrps'
13580 d_sethent='$d_sethent'
13581 d_setlinebuf='$d_setlinebuf'
13582 d_setlocale='$d_setlocale'
13583 d_setnent='$d_setnent'
13584 d_setpent='$d_setpent'
13585 d_setpgid='$d_setpgid'
13586 d_setpgrp2='$d_setpgrp2'
13587 d_setpgrp='$d_setpgrp'
13588 d_setprior='$d_setprior'
13589 d_setpwent='$d_setpwent'
13590 d_setregid='$d_setregid'
13591 d_setresgid='$d_setresgid'
13592 d_setresuid='$d_setresuid'
13593 d_setreuid='$d_setreuid'
13594 d_setrgid='$d_setrgid'
13595 d_setruid='$d_setruid'
13596 d_setsent='$d_setsent'
13597 d_setsid='$d_setsid'
13598 d_setspent='$d_setspent'
13599 d_setvbuf='$d_setvbuf'
13600 d_sfio='$d_sfio'
13601 d_shm='$d_shm'
13602 d_shmat='$d_shmat'
13603 d_shmatprototype='$d_shmatprototype'
13604 d_shmctl='$d_shmctl'
13605 d_shmdt='$d_shmdt'
13606 d_shmget='$d_shmget'
13607 d_sigaction='$d_sigaction'
13608 d_sigsetjmp='$d_sigsetjmp'
13609 d_socket='$d_socket'
13610 d_sockpair='$d_sockpair'
13611 d_statblks='$d_statblks'
13612 d_statfs='$d_statfs'
13613 d_statfsflags='$d_statfsflags'
13614 d_statvfs='$d_statvfs'
13615 d_stdio_cnt_lval='$d_stdio_cnt_lval'
13616 d_stdio_ptr_lval='$d_stdio_ptr_lval'
13617 d_stdio_stream_array='$d_stdio_stream_array'
13618 d_stdiobase='$d_stdiobase'
13619 d_stdstdio='$d_stdstdio'
13620 d_strchr='$d_strchr'
13621 d_strcoll='$d_strcoll'
13622 d_strctcpy='$d_strctcpy'
13623 d_strerrm='$d_strerrm'
13624 d_strerror='$d_strerror'
13625 d_strtod='$d_strtod'
13626 d_strtol='$d_strtol'
13627 d_strtoul='$d_strtoul'
13628 d_strtoull='$d_strtoull'
13629 d_strxfrm='$d_strxfrm'
13630 d_suidsafe='$d_suidsafe'
13631 d_symlink='$d_symlink'
13632 d_syscall='$d_syscall'
13633 d_sysconf='$d_sysconf'
13634 d_sysernlst='$d_sysernlst'
13635 d_syserrlst='$d_syserrlst'
13636 d_system='$d_system'
13637 d_tcgetpgrp='$d_tcgetpgrp'
13638 d_tcsetpgrp='$d_tcsetpgrp'
13639 d_telldir='$d_telldir'
13640 d_telldirproto='$d_telldirproto'
13641 d_time='$d_time'
13642 d_times='$d_times'
13643 d_truncate='$d_truncate'
13644 d_tzname='$d_tzname'
13645 d_umask='$d_umask'
13646 d_uname='$d_uname'
13647 d_union_semun='$d_union_semun'
13648 d_vendorlib='$d_vendorlib'
13649 d_vfork='$d_vfork'
13650 d_void_closedir='$d_void_closedir'
13651 d_voidsig='$d_voidsig'
13652 d_voidtty='$d_voidtty'
13653 d_volatile='$d_volatile'
13654 d_vprintf='$d_vprintf'
13655 d_wait4='$d_wait4'
13656 d_waitpid='$d_waitpid'
13657 d_wcstombs='$d_wcstombs'
13658 d_wctomb='$d_wctomb'
13659 d_writev='$d_writev'
13660 d_xenix='$d_xenix'
13661 date='$date'
13662 db_hashtype='$db_hashtype'
13663 db_prefixtype='$db_prefixtype'
13664 defvoidused='$defvoidused'
13665 direntrytype='$direntrytype'
13666 dlext='$dlext'
13667 dlsrc='$dlsrc'
13668 doublesize='$doublesize'
13669 drand01='$drand01'
13670 dynamic_ext='$dynamic_ext'
13671 eagain='$eagain'
13672 ebcdic='$ebcdic'
13673 echo='$echo'
13674 egrep='$egrep'
13675 emacs='$emacs'
13676 eunicefix='$eunicefix'
13677 exe_ext='$exe_ext'
13678 expr='$expr'
13679 extensions='$extensions'
13680 fflushNULL='$fflushNULL'
13681 fflushall='$fflushall'
13682 find='$find'
13683 firstmakefile='$firstmakefile'
13684 flex='$flex'
13685 fpostype='$fpostype'
13686 freetype='$freetype'
13687 full_ar='$full_ar'
13688 full_csh='$full_csh'
13689 full_sed='$full_sed'
13690 gccversion='$gccversion'
13691 gidtype='$gidtype'
13692 glibpth='$glibpth'
13693 grep='$grep'
13694 groupcat='$groupcat'
13695 groupstype='$groupstype'
13696 gzip='$gzip'
13697 h_fcntl='$h_fcntl'
13698 h_sysfile='$h_sysfile'
13699 hint='$hint'
13700 hostcat='$hostcat'
13701 huge='$huge'
13702 i_arpainet='$i_arpainet'
13703 i_bsdioctl='$i_bsdioctl'
13704 i_db='$i_db'
13705 i_dbm='$i_dbm'
13706 i_dirent='$i_dirent'
13707 i_dld='$i_dld'
13708 i_dlfcn='$i_dlfcn'
13709 i_fcntl='$i_fcntl'
13710 i_float='$i_float'
13711 i_gdbm='$i_gdbm'
13712 i_grp='$i_grp'
13713 i_inttypes='$i_inttypes'
13714 i_limits='$i_limits'
13715 i_locale='$i_locale'
13716 i_machcthr='$i_machcthr'
13717 i_malloc='$i_malloc'
13718 i_math='$i_math'
13719 i_memory='$i_memory'
13720 i_mntent='$i_mntent'
13721 i_ndbm='$i_ndbm'
13722 i_netdb='$i_netdb'
13723 i_neterrno='$i_neterrno'
13724 i_netinettcp='$i_netinettcp'
13725 i_niin='$i_niin'
13726 i_poll='$i_poll'
13727 i_pthread='$i_pthread'
13728 i_pwd='$i_pwd'
13729 i_rpcsvcdbm='$i_rpcsvcdbm'
13730 i_sfio='$i_sfio'
13731 i_sgtty='$i_sgtty'
13732 i_shadow='$i_shadow'
13733 i_socks='$i_socks'
13734 i_stdarg='$i_stdarg'
13735 i_stddef='$i_stddef'
13736 i_stdlib='$i_stdlib'
13737 i_string='$i_string'
13738 i_sysaccess='$i_sysaccess'
13739 i_sysdir='$i_sysdir'
13740 i_sysfile='$i_sysfile'
13741 i_sysfilio='$i_sysfilio'
13742 i_sysin='$i_sysin'
13743 i_sysioctl='$i_sysioctl'
13744 i_sysmman='$i_sysmman'
13745 i_sysmount='$i_sysmount'
13746 i_sysndir='$i_sysndir'
13747 i_sysparam='$i_sysparam'
13748 i_sysresrc='$i_sysresrc'
13749 i_syssecrt='$i_syssecrt'
13750 i_sysselct='$i_sysselct'
13751 i_syssockio='$i_syssockio'
13752 i_sysstat='$i_sysstat'
13753 i_sysstatvfs='$i_sysstatvfs'
13754 i_systime='$i_systime'
13755 i_systimek='$i_systimek'
13756 i_systimes='$i_systimes'
13757 i_systypes='$i_systypes'
13758 i_sysuio='$i_sysuio'
13759 i_sysun='$i_sysun'
13760 i_syswait='$i_syswait'
13761 i_termio='$i_termio'
13762 i_termios='$i_termios'
13763 i_time='$i_time'
13764 i_unistd='$i_unistd'
13765 i_utime='$i_utime'
13766 i_values='$i_values'
13767 i_varargs='$i_varargs'
13768 i_varhdr='$i_varhdr'
13769 i_vfork='$i_vfork'
13770 ignore_versioned_solibs='$ignore_versioned_solibs'
13771 incpath='$incpath'
13772 inews='$inews'
13773 installarchlib='$installarchlib'
13774 installbin='$installbin'
13775 installman1dir='$installman1dir'
13776 installman3dir='$installman3dir'
13777 installprefix='$installprefix'
13778 installprefixexp='$installprefixexp'
13779 installprivlib='$installprivlib'
13780 installscript='$installscript'
13781 installsitearch='$installsitearch'
13782 installsitelib='$installsitelib'
13783 installstyle='$installstyle'
13784 installusrbinperl='$installusrbinperl'
13785 installvendorlib='$installvendorlib'
13786 intsize='$intsize'
13787 known_extensions='$known_extensions'
13788 ksh='$ksh'
13789 large='$large'
13790 ld='$ld'
13791 lddlflags='$lddlflags'
13792 ldflags='$ldflags'
13793 ldlibpthname='$ldlibpthname'
13794 less='$less'
13795 lib_ext='$lib_ext'
13796 libc='$libc'
13797 libperl='$libperl'
13798 libpth='$libpth'
13799 libs='$libs'
13800 libswanted='$libswanted'
13801 line='$line'
13802 lint='$lint'
13803 lkflags='$lkflags'
13804 ln='$ln'
13805 lns='$lns'
13806 locincpth='$locincpth'
13807 loclibpth='$loclibpth'
13808 longdblsize='$longdblsize'
13809 longlongsize='$longlongsize'
13810 longsize='$longsize'
13811 lp='$lp'
13812 lpr='$lpr'
13813 ls='$ls'
13814 lseeksize='$lseeksize'
13815 lseektype='$lseektype'
13816 mail='$mail'
13817 mailx='$mailx'
13818 make='$make'
13819 make_set_make='$make_set_make'
13820 mallocobj='$mallocobj'
13821 mallocsrc='$mallocsrc'
13822 malloctype='$malloctype'
13823 man1dir='$man1dir'
13824 man1direxp='$man1direxp'
13825 man1ext='$man1ext'
13826 man3dir='$man3dir'
13827 man3direxp='$man3direxp'
13828 man3ext='$man3ext'
13829 medium='$medium'
13830 mips='$mips'
13831 mips_type='$mips_type'
13832 mkdir='$mkdir'
13833 mmaptype='$mmaptype'
13834 models='$models'
13835 modetype='$modetype'
13836 more='$more'
13837 multiarch='$multiarch'
13838 mv='$mv'
13839 myarchname='$myarchname'
13840 mydomain='$mydomain'
13841 myhostname='$myhostname'
13842 myuname='$myuname'
13843 n='$n'
13844 netdb_hlen_type='$netdb_hlen_type'
13845 netdb_host_type='$netdb_host_type'
13846 netdb_name_type='$netdb_name_type'
13847 netdb_net_type='$netdb_net_type'
13848 nm='$nm'
13849 nm_opt='$nm_opt'
13850 nm_so_opt='$nm_so_opt'
13851 nonxs_ext='$nonxs_ext'
13852 nroff='$nroff'
13853 o_nonblock='$o_nonblock'
13854 obj_ext='$obj_ext'
13855 old_pthread_create_joinable='$old_pthread_create_joinable'
13856 optimize='$optimize'
13857 orderlib='$orderlib'
13858 osname='$osname'
13859 osvers='$osvers'
13860 package='$package'
13861 pager='$pager'
13862 passcat='$passcat'
13863 patchlevel='$patchlevel'
13864 path_sep='$path_sep'
13865 perl='$perl'
13866 perladmin='$perladmin'
13867 perlpath='$perlpath'
13868 pg='$pg'
13869 phostname='$phostname'
13870 pidtype='$pidtype'
13871 plibpth='$plibpth'
13872 pmake='$pmake'
13873 pr='$pr'
13874 prefix='$prefix'
13875 prefixexp='$prefixexp'
13876 privlib='$privlib'
13877 privlibexp='$privlibexp'
13878 prototype='$prototype'
13879 ptrsize='$ptrsize'
13880 randbits='$randbits'
13881 randfunc='$randfunc'
13882 randseedtype='$randseedtype'
13883 ranlib='$ranlib'
13884 rd_nodata='$rd_nodata'
13885 rm='$rm'
13886 rmail='$rmail'
13887 runnm='$runnm'
13888 sPRIEldbl='$sPRIEldbl'
13889 sPRIFldbl='$sPRIFldbl'
13890 sPRIGldbl='$sPRIGldbl'
13891 sPRIX64='$sPRIX64'
13892 sPRId64='$sPRId64'
13893 sPRIeldbl='$sPRIeldbl'
13894 sPRIfldbl='$sPRIfldbl'
13895 sPRIgldbl='$sPRIgldbl'
13896 sPRIi64='$sPRIi64'
13897 sPRIo64='$sPRIo64'
13898 sPRIu64='$sPRIu64'
13899 sPRIx64='$sPRIx64'
13900 sched_yield='$sched_yield'
13901 scriptdir='$scriptdir'
13902 scriptdirexp='$scriptdirexp'
13903 sed='$sed'
13904 seedfunc='$seedfunc'
13905 selectminbits='$selectminbits'
13906 selecttype='$selecttype'
13907 sendmail='$sendmail'
13908 sh='$sh'
13909 shar='$shar'
13910 sharpbang='$sharpbang'
13911 shmattype='$shmattype'
13912 shortsize='$shortsize'
13913 shrpenv='$shrpenv'
13914 shsharp='$shsharp'
13915 sig_count='$sig_count'
13916 sig_name='$sig_name'
13917 sig_name_init='$sig_name_init'
13918 sig_num='$sig_num'
13919 sig_num_init='$sig_num_init'
13920 signal_t='$signal_t'
13921 sitearch='$sitearch'
13922 sitearchexp='$sitearchexp'
13923 sitelib='$sitelib'
13924 sitelibexp='$sitelibexp'
13925 siteprefix='$siteprefix'
13926 siteprefixexp='$siteprefixexp'
13927 sizetype='$sizetype'
13928 sleep='$sleep'
13929 smail='$smail'
13930 small='$small'
13931 so='$so'
13932 sockethdr='$sockethdr'
13933 socketlib='$socketlib'
13934 sort='$sort'
13935 spackage='$spackage'
13936 spitshell='$spitshell'
13937 split='$split'
13938 src='$src'
13939 ssizetype='$ssizetype'
13940 startperl='$startperl'
13941 startsh='$startsh'
13942 static_ext='$static_ext'
13943 stdchar='$stdchar'
13944 stdio_base='$stdio_base'
13945 stdio_bufsiz='$stdio_bufsiz'
13946 stdio_cnt='$stdio_cnt'
13947 stdio_filbuf='$stdio_filbuf'
13948 stdio_ptr='$stdio_ptr'
13949 stdio_stream_array='$stdio_stream_array'
13950 strings='$strings'
13951 submit='$submit'
13952 subversion='$subversion'
13953 sysman='$sysman'
13954 tail='$tail'
13955 tar='$tar'
13956 tbl='$tbl'
13957 tee='$tee'
13958 test='$test'
13959 timeincl='$timeincl'
13960 timetype='$timetype'
13961 touch='$touch'
13962 tr='$tr'
13963 trnl='$trnl'
13964 troff='$troff'
13965 uidtype='$uidtype'
13966 uname='$uname'
13967 uniq='$uniq'
13968 use64bits='$use64bits'
13969 usedl='$usedl'
13970 uselongdouble='$uselongdouble'
13971 usemultiplicity='$usemultiplicity'
13972 usemymalloc='$usemymalloc'
13973 usenm='$usenm'
13974 useopcode='$useopcode'
13975 useperlio='$useperlio'
13976 useposix='$useposix'
13977 usesfio='$usesfio'
13978 useshrplib='$useshrplib'
13979 usesocks='$usesocks'
13980 usethreads='$usethreads'
13981 usevendorprefix='$usevendorprefix'
13982 usevfork='$usevfork'
13983 usrinc='$usrinc'
13984 uuname='$uuname'
13985 vendorlib='$vendorlib'
13986 vendorlibexp='$vendorlibexp'
13987 vendorprefix='$vendorprefix'
13988 vendorprefixexp='$vendorprefixexp'
13989 version='$version'
13990 vi='$vi'
13991 voidflags='$voidflags'
13992 xlibpth='$xlibpth'
13993 zcat='$zcat'
13994 zip='$zip'
13995 EOT
13996
13997 : Add in command line options if available
13998 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
13999
14000 : add special variables
14001 $test -f $src/patchlevel.h && \
14002 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
14003 echo "CONFIGDOTSH=true" >>config.sh
14004
14005 : propagate old symbols
14006 if $test -f UU/config.sh; then
14007         <UU/config.sh sort | uniq >UU/oldconfig.sh
14008         sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
14009         sort | uniq -u >UU/oldsyms
14010         set X `cat UU/oldsyms`
14011         shift
14012         case $# in
14013         0) ;;
14014         *)
14015                 cat <<EOM
14016 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
14017 EOM
14018                 echo "# Variables propagated from previous config.sh file." >>config.sh
14019                 for sym in `cat UU/oldsyms`; do
14020                         echo "    Propagating $hint variable "'$'"$sym..."
14021                         eval 'tmp="$'"${sym}"'"'
14022                         echo "$tmp" | \
14023                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
14024                 done
14025                 ;;
14026         esac
14027 fi
14028
14029 : Finish up by extracting the .SH files
14030 case "$alldone" in
14031 exit)
14032         $rm -rf UU
14033         echo "Done."
14034         exit 0
14035         ;;
14036 cont)
14037         ;;
14038 '')
14039         dflt=''
14040         nostick=true
14041         $cat <<EOM
14042
14043 If you'd like to make any changes to the config.sh file before I begin
14044 to configure things, do it as a shell escape now (e.g. !vi config.sh).
14045
14046 EOM
14047         rp="Press return or use a shell escape to edit config.sh:"
14048         . UU/myread
14049         nostick=''
14050         case "$ans" in
14051         '') ;;
14052         *) : in case they cannot read
14053                 sh 1>&4 -c "$ans";;
14054         esac
14055         ;;
14056 esac
14057
14058 : if this fails, just run all the .SH files by hand
14059 . ./config.sh
14060
14061 echo " "
14062 exec 1>&4
14063 . ./UU/extract
14064
14065 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
14066         dflt=y
14067         case "$silent" in
14068         true) ;;
14069         *)
14070                 $cat <<EOM
14071
14072 Now you need to generate make dependencies by running "$make depend".
14073 You might prefer to run it in background: "$make depend > makedepend.out &"
14074 It can take a while, so you might not want to run it right now.
14075
14076 EOM
14077                 ;;
14078         esac
14079         rp="Run $make depend now?"
14080         . UU/myread
14081         case "$ans" in
14082         y*)
14083                 $make depend && echo "Now you must run a $make."
14084                 ;;
14085         *)
14086                 echo "You must run '$make depend' then '$make'."
14087                 ;;
14088         esac
14089 elif test -f [Mm]akefile; then
14090         echo " "
14091         echo "Now you must run a $make."
14092 else
14093         echo "Done."
14094 fi
14095
14096 if $test -f Policy.sh; then
14097     $cat <<EOM
14098
14099 If you compile $package on a different machine or from a different object
14100 directory, copy the Policy.sh file from this object directory to the
14101 new one before you run Configure -- this will help you with most of
14102 the policy defaults.
14103
14104 EOM
14105 fi
14106 if $test -f config.msg; then
14107     echo "Hmm.  I also noted the following information while running:"
14108     echo " "
14109     $cat config.msg >&4
14110     $rm -f config.msg
14111 fi
14112 $rm -f kit*isdone ark*isdone
14113 $rm -rf UU
14114
14115 : End of Configure
14116