Another hints tweak.
[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 Sat Oct 23 18:23:43 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_sqrtl=''
514 d_statblks=''
515 d_fstatfs=''
516 d_statfs=''
517 d_statfsflags=''
518 d_fstatvfs=''
519 d_statvfs=''
520 d_stdio_cnt_lval=''
521 d_stdio_ptr_lval=''
522 d_stdiobase=''
523 d_stdstdio=''
524 stdio_base=''
525 stdio_bufsiz=''
526 stdio_cnt=''
527 stdio_filbuf=''
528 stdio_ptr=''
529 d_index=''
530 d_strchr=''
531 d_strcoll=''
532 d_strctcpy=''
533 d_strerrm=''
534 d_strerror=''
535 d_sysernlst=''
536 d_syserrlst=''
537 d_strtod=''
538 d_strtol=''
539 d_strtoul=''
540 d_strxfrm=''
541 d_symlink=''
542 d_syscall=''
543 d_sysconf=''
544 d_system=''
545 d_tcgetpgrp=''
546 d_tcsetpgrp=''
547 d_telldirproto=''
548 d_time=''
549 timetype=''
550 clocktype=''
551 d_times=''
552 d_truncate=''
553 d_tzname=''
554 d_umask=''
555 d_semctl_semid_ds=''
556 d_semctl_semun=''
557 d_union_semun=''
558 d_vfork=''
559 usevfork=''
560 d_voidsig=''
561 signal_t=''
562 d_volatile=''
563 d_charvspr=''
564 d_vprintf=''
565 d_wait4=''
566 d_waitpid=''
567 d_wcstombs=''
568 d_wctomb=''
569 d_writev=''
570 dlext=''
571 cccdlflags=''
572 ccdlflags=''
573 dlsrc=''
574 ld=''
575 lddlflags=''
576 usedl=''
577 doublesize=''
578 ebcdic=''
579 fflushNULL=''
580 fflushall=''
581 fpostype=''
582 gidtype=''
583 groupstype=''
584 h_fcntl=''
585 h_sysfile=''
586 i_arpainet=''
587 db_hashtype=''
588 db_prefixtype=''
589 i_db=''
590 i_dbm=''
591 i_rpcsvcdbm=''
592 d_dirnamlen=''
593 direntrytype=''
594 i_dirent=''
595 i_dld=''
596 i_dlfcn=''
597 i_fcntl=''
598 i_float=''
599 i_gdbm=''
600 d_grpasswd=''
601 i_grp=''
602 d_int64t=''
603 i_inttypes=''
604 i_limits=''
605 i_locale=''
606 i_machcthr=''
607 i_malloc=''
608 i_math=''
609 i_memory=''
610 i_mntent=''
611 i_ndbm=''
612 i_netdb=''
613 i_neterrno=''
614 i_netinettcp=''
615 i_niin=''
616 i_sysin=''
617 i_poll=''
618 i_pthread=''
619 d_pwage=''
620 d_pwchange=''
621 d_pwclass=''
622 d_pwcomment=''
623 d_pwexpire=''
624 d_pwgecos=''
625 d_pwpasswd=''
626 d_pwquota=''
627 i_pwd=''
628 i_sfio=''
629 i_shadow=''
630 i_socks=''
631 i_stddef=''
632 i_stdlib=''
633 i_string=''
634 strings=''
635 i_sysaccess=''
636 i_sysdir=''
637 i_sysfile=''
638 d_voidtty=''
639 i_bsdioctl=''
640 i_sysfilio=''
641 i_sysioctl=''
642 i_syssockio=''
643 i_sysmman=''
644 i_sysmount=''
645 i_sysndir=''
646 i_sysparam=''
647 i_sysresrc=''
648 i_syssecrt=''
649 i_sysselct=''
650 i_sysstat=''
651 i_sysstatvfs=''
652 i_systimes=''
653 i_systypes=''
654 d_iovec_s=''
655 i_sysuio=''
656 i_sysun=''
657 i_syswait=''
658 i_sgtty=''
659 i_termio=''
660 i_termios=''
661 i_systime=''
662 i_systimek=''
663 i_time=''
664 timeincl=''
665 i_unistd=''
666 i_utime=''
667 i_values=''
668 i_stdarg=''
669 i_varargs=''
670 i_varhdr=''
671 i_vfork=''
672 installprefix=''
673 installprefixexp=''
674 installstyle=''
675 installusrbinperl=''
676 intsize=''
677 longsize=''
678 shortsize=''
679 d_fpos64_t=''
680 d_llseek=''
681 d_off64_t=''
682 libc=''
683 ldlibpthname=''
684 libperl=''
685 shrpenv=''
686 useshrplib=''
687 glibpth=''
688 libpth=''
689 loclibpth=''
690 plibpth=''
691 xlibpth=''
692 ignore_versioned_solibs=''
693 libs=''
694 lns=''
695 d_PRIEldbl=''
696 d_PRIFldbl=''
697 d_PRIGldbl=''
698 d_PRIeldbl=''
699 d_PRIfldbl=''
700 d_PRIgldbl=''
701 sPRIEldbl=''
702 sPRIFldbl=''
703 sPRIGldbl=''
704 sPRIeldbl=''
705 sPRIfldbl=''
706 sPRIgldbl=''
707 lseeksize=''
708 lseektype=''
709 make_set_make=''
710 d_mymalloc=''
711 freetype=''
712 mallocobj=''
713 mallocsrc=''
714 malloctype=''
715 usemymalloc=''
716 installman1dir=''
717 man1dir=''
718 man1direxp=''
719 man1ext=''
720 installman3dir=''
721 man3dir=''
722 man3direxp=''
723 man3ext=''
724 huge=''
725 large=''
726 medium=''
727 models=''
728 small=''
729 split=''
730 modetype=''
731 multiarch=''
732 mydomain=''
733 myhostname=''
734 phostname=''
735 c=''
736 n=''
737 d_eofnblk=''
738 eagain=''
739 o_nonblock=''
740 rd_nodata=''
741 netdb_hlen_type=''
742 netdb_host_type=''
743 netdb_name_type=''
744 netdb_net_type=''
745 groupcat=''
746 hostcat=''
747 passcat=''
748 orderlib=''
749 ranlib=''
750 package=''
751 spackage=''
752 pager=''
753 apiversion=''
754 patchlevel=''
755 subversion=''
756 version=''
757 perladmin=''
758 perlpath=''
759 pidtype=''
760 prefix=''
761 prefixexp=''
762 installprivlib=''
763 privlib=''
764 privlibexp=''
765 prototype=''
766 ptrsize=''
767 d_PRIX64=''
768 d_PRId64=''
769 d_PRIi64=''
770 d_PRIo64=''
771 d_PRIu64=''
772 d_PRIx64=''
773 sPRIX64=''
774 sPRId64=''
775 sPRIi64=''
776 sPRIo64=''
777 sPRIu64=''
778 sPRIx64=''
779 drand01=''
780 randbits=''
781 randfunc=''
782 randseedtype=''
783 seedfunc=''
784 installscript=''
785 scriptdir=''
786 scriptdirexp=''
787 selectminbits=''
788 selecttype=''
789 sh=''
790 sig_count=''
791 sig_name=''
792 sig_name_init=''
793 sig_num=''
794 sig_num_init=''
795 installsitearch=''
796 sitearch=''
797 sitearchexp=''
798 installsitebin=''
799 sitebin=''
800 sitebinexp=''
801 installsitelib=''
802 sitelib=''
803 sitelibexp=''
804 siteprefix=''
805 siteprefixexp=''
806 sizetype=''
807 so=''
808 sharpbang=''
809 shsharp=''
810 spitshell=''
811 src=''
812 ssizetype=''
813 startperl=''
814 startsh=''
815 stdchar=''
816 d_stdio_stream_array=''
817 stdio_stream_array=''
818 d_strtoull=''
819 sysman=''
820 trnl=''
821 uidsign=''
822 uidtype=''
823 archname64=''
824 use64bits=''
825 uselargefiles=''
826 uselongdouble=''
827 usemorebits=''
828 usemultiplicity=''
829 nm_opt=''
830 nm_so_opt=''
831 runnm=''
832 usenm=''
833 useperlio=''
834 usesocks=''
835 d_oldpthreads=''
836 usethreads=''
837 incpath=''
838 mips=''
839 mips_type=''
840 usrinc=''
841 d_vendorbin=''
842 installvendorbin=''
843 vendorbin=''
844 vendorbinexp=''
845 d_vendorlib=''
846 installvendorlib=''
847 vendorlib=''
848 vendorlibexp=''
849 usevendorprefix=''
850 vendorprefix=''
851 vendorprefixexp=''
852 defvoidused=''
853 voidflags=''
854 pm_apiversion=''
855 xs_apiversion=''
856 CONFIG=''
857
858 define='define'
859 undef='undef'
860 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
861 rmlist=''
862
863 : We must find out about Eunice early
864 eunicefix=':'
865 if test -f /etc/unixtovms; then
866         eunicefix=/etc/unixtovms
867 fi
868 if test -f /etc/unixtovms.exe; then
869         eunicefix=/etc/unixtovms.exe
870 fi
871
872 i_whoami=''
873 : Possible local include directories to search.
874 : Set locincpth to "" in a hint file to defeat local include searches.
875 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
876 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
877 :
878 : no include file wanted by default
879 inclwanted=''
880
881 : list of known cpp symbols, sorted alphabetically
882 al="AMIX BIT_MSF BSD BSD4_3 BSD_NET2 CMU CRAY DGUX DOLPHIN DPX2"
883 al="$al GO32 GOULD_PN HP700 I386 I80960 I960 Lynx M68000 M68K MACH"
884 al="$al MIPSEB MIPSEL MSDOS MTXINU MULTIMAX MVS"
885 al="$al M_COFF M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM"
886 al="$al M_SYS3 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX"
887 al="$al NeXT OCS88 OSF1 PARISC PC532 PORTAR POSIX"
888 al="$al PWB R3000 RES RISC6000 RT Sun386i SVR3 SVR4 SVR5"
889 al="$al SYSTYPE_BSD SYSTYPE_SVR4 SYSTYPE_SYSV Tek4132 Tek4300"
890 al="$al UMAXV USGr4 USGr4_2 UTEK UTS UTek UnicomPBB UnicomPBD Utek"
891 al="$al VMS Xenix286"
892 al="$al _AIX _AIX32 _AIX370 _AIX41 _AM29000 _COFF _CRAY _CX_UX _EPI"
893 al="$al _IBMESA _IBMR2 _M88K _M88KBCS_TARGET _POWER"
894 al="$al _MIPSEB _MIPSEL _M_COFF _M_I86 _M_I86SM _M_SYS3"
895 al="$al _M_SYS5 _M_SYSIII _M_SYSV _M_UNIX _M_XENIX _NLS _PGC_ _R3000"
896 al="$al _SYSTYPE_BSD _SYSTYPE_BSD43 _SYSTYPE_SVR4"
897 al="$al _SYSTYPE_SYSV _SYSV3 _U370 _UNICOS"
898 al="$al __386BSD__ __BIG_ENDIAN __BIG_ENDIAN__ __BSD_4_4__"
899 al="$al __DGUX__ __DPX2__ __H3050R __H3050RX"
900 al="$al __LITTLE_ENDIAN __LITTLE_ENDIAN__ __MACH__"
901 al="$al __MIPSEB __MIPSEB__ __MIPSEL __MIPSEL__"
902 al="$al __Next__ __OSF1__ __PARAGON__ __PGC__ __PWB __STDC__"
903 al="$al __SVR4_2__ __UMAXV__"
904 al="$al ____386BSD____ __alpha __alpha__ __amiga"
905 al="$al __bsd4_2 __bsd4_2__ __bsdi__ __convex__"
906 al="$al __host_mips__"
907 al="$al __hp9000s200 __hp9000s300 __hp9000s400 __hp9000s500"
908 al="$al __hp9000s500 __hp9000s700 __hp9000s800"
909 al="$al __hppa __hpux __hp_osf __i286 __i286__ __i386 __i386__"
910 al="$al __i486 __i486__ __i860 __i860__ __ibmesa __ksr1__ __linux__"
911 al="$al __m68k __m68k__ __m88100__ __m88k __m88k__"
912 al="$al __mc68000 __mc68000__ __mc68020 __mc68020__"
913 al="$al __mc68030 __mc68030__ __mc68040 __mc68040__"
914 al="$al __mc88100 __mc88100__ __mips __mips__"
915 al="$al __motorola__ __osf__ __pa_risc __sparc__ __stdc__"
916 al="$al __sun __sun__ __svr3__ __svr4__ __ultrix __ultrix__"
917 al="$al __unix __unix__ __uxpm__ __uxps__ __vax __vax__"
918 al="$al _host_mips _mips _unix"
919 al="$al a29k aegis aix aixpc alliant alpha am29000 amiga ansi ardent"
920 al="$al apollo ardent att386 att3b"
921 al="$al bsd bsd43 bsd4_2 bsd4_3 bsd4_4 bsdi bull"
922 al="$al cadmus clipper concurrent convex cray ctix"
923 al="$al dmert encore gcos gcx gimpel gould"
924 al="$al hbullx20 hcx host_mips hp200 hp300 hp700 hp800"
925 al="$al hp9000 hp9000s300 hp9000s400 hp9000s500"
926 al="$al hp9000s700 hp9000s800 hp9k8 hppa hpux"
927 al="$al i186 i286 i386 i486 i8086"
928 al="$al i80960 i860 iAPX286 ibm ibm032 ibmrt interdata is68k"
929 al="$al ksr1 linux luna luna88k m68k m88100 m88k"
930 al="$al mc300 mc500 mc68000 mc68010 mc68020 mc68030"
931 al="$al mc68040 mc68060 mc68k mc68k32 mc700"
932 al="$al mc88000 mc88100 merlin mert mips mvs n16"
933 al="$al ncl_el ncl_mr"
934 al="$al news1500 news1700 news1800 news1900 news3700"
935 al="$al news700 news800 news900 ns16000 ns32000"
936 al="$al ns32016 ns32332 ns32k nsc32000 os osf"
937 al="$al parisc pc532 pdp11 plexus posix pyr"
938 al="$al riscix riscos scs sequent sgi sinix sony sony_news"
939 al="$al sonyrisc sparc sparclite spectrum stardent stratos"
940 al="$al sun sun3 sun386 svr4 sysV68 sysV88"
941 al="$al titan tower tower32 tower32_200 tower32_600 tower32_700"
942 al="$al tower32_800 tower32_850 tss u370 u3b u3b2 u3b20 u3b200"
943 al="$al u3b20d u3b5 ultrix unix unixpc unos vax venix vms"
944 al="$al xenix z8000"
945
946 : Trailing extension.  Override this in a hint file, if needed.
947 _exe=''
948 : Extra object files, if any, needed on this platform.
949 archobjs=''
950 groupstype=''
951 : change the next line if compiling for Xenix/286 on Xenix/386
952 xlibpth='/usr/lib/386 /lib/386'
953
954 : Possible local library directories to search.
955 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
956 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
957
958 : general looking path for locating libraries
959 glibpth="/shlib /usr/shlib /lib/pa1.1 /usr/lib/large"
960 glibpth="$glibpth /lib /usr/lib $xlibpth"
961 glibpth="$glibpth /lib/large /usr/lib/small /lib/small"
962 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
963
964 : Private path used by Configure to find libraries.  Its value
965 : is prepended to libpth. This variable takes care of special
966 : machines, like the mips.  Usually, it should be empty.
967 plibpth=''
968
969 : default library list
970 libswanted=''
971 : some systems want to use only the non-versioned libso:s
972 ignore_versioned_solibs=''
973 : full support for void wanted by default
974 defvoidused=15
975
976 : set useposix=false in your hint file to disable the POSIX extension.
977 useposix=true
978 : set useopcode=false in your hint file to disable the Opcode extension.
979 useopcode=true
980 : set usemultiplicity on the Configure command line to enable multiplicity.
981 : set usesocks on the Configure command line to enable socks.
982 : set usethreads on the Configure command line to enable threads.
983 : List of libraries we want.
984 : If anyone needs -lnet, put it in a hint file.
985 libswanted='sfio socket inet nsl nm ndbm gdbm dbm db malloc dl'
986 libswanted="$libswanted dld ld sun m c cposix posix"
987 libswanted="$libswanted ndir dir crypt sec"
988 libswanted="$libswanted ucb bsd BSD PW x"
989 : We probably want to search /usr/shlib before most other libraries.
990 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
991 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
992 glibpth="/usr/shlib $glibpth"
993 : Do not use vfork unless overridden by a hint file.
994 usevfork=false
995
996 : Find the basic shell for Bourne shell scripts
997 case "$sh" in
998 '')
999         case "$SYSTYPE" in
1000         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1001         *) xxx='/bin/sh';;
1002         esac
1003         if test -f "$xxx"; then
1004                 sh="$xxx"
1005         else
1006                 : Build up a list and do a single loop so we can 'break' out.
1007                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1008                 for xxx in sh bash ksh pdksh ash; do
1009                         for p in $pth; do
1010                                 try="$try ${p}/${xxx}"
1011                         done
1012                 done
1013                 for xxx in $try; do
1014                         if test -f "$xxx"; then
1015                                 sh="$xxx";
1016                                 break
1017                         elif test -f "$xxx.exe"; then
1018                                 sh="$xxx";
1019                                 break
1020                         fi
1021                 done
1022         fi
1023         ;;
1024 esac
1025
1026 case "$sh" in
1027 '')     cat <<EOM >&2
1028 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
1029
1030 Usually it's in /bin/sh.  How did you even get this far?
1031 Please contact me (Perl Maintainers) at perlbug@perl.com and 
1032 we'll try to straighten this all out.
1033 EOM
1034         exit 1
1035         ;;
1036 esac
1037
1038 : see if sh knows # comments
1039 if `$sh -c '#' >/dev/null 2>&1`; then
1040         shsharp=true
1041         spitshell=cat
1042         xcat=/bin/cat
1043         test -f $xcat || xcat=/usr/bin/cat
1044         echo "#!$xcat" >try
1045         $eunicefix try
1046         chmod +x try
1047         ./try > today
1048         if test -s today; then
1049                 sharpbang='#!'
1050         else
1051                 echo "#! $xcat" > try
1052                 $eunicefix try
1053                 chmod +x try
1054                 ./try > today
1055                 if test -s today; then
1056                         sharpbang='#! '
1057                 else
1058                         sharpbang=': use '
1059                 fi
1060         fi
1061 else
1062         echo " "
1063         echo "Your $sh doesn't grok # comments--I will strip them later on."
1064         shsharp=false
1065         cd ..
1066         echo "exec grep -v '^[  ]*#'" >spitshell
1067         chmod +x spitshell
1068         $eunicefix spitshell
1069         spitshell=`pwd`/spitshell
1070         cd UU
1071         echo "I presume that if # doesn't work, #! won't work either!"
1072         sharpbang=': use '
1073 fi
1074 rm -f try today
1075
1076 : figure out how to guarantee sh startup
1077 case "$startsh" in
1078 '') startsh=${sharpbang}${sh} ;;
1079 *)
1080 esac
1081 cat >try <<EOSS
1082 $startsh
1083 set abc
1084 test "$?abc" != 1
1085 EOSS
1086
1087 chmod +x try
1088 $eunicefix try
1089 if ./try; then
1090         : echo "Yup, it does."
1091 else
1092         echo "Hmm... '$startsh' does not guarantee sh startup..."
1093         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1094 fi
1095 rm -f try
1096
1097
1098 : Save command line options in file UU/cmdline.opt for later use in
1099 : generating config.sh.
1100 cat > cmdline.opt <<EOSH
1101 # Configure command line arguments.
1102 config_arg0='$0'
1103 config_args='$*'
1104 config_argc=$#
1105 EOSH
1106 argn=1
1107 for arg in "$@"; do
1108         cat >>cmdline.opt <<EOSH
1109 config_arg$argn='$arg'
1110 EOSH
1111         argn=`expr $argn + 1`
1112 done
1113
1114 : produce awk script to parse command line options
1115 cat >options.awk <<'EOF'
1116 BEGIN {
1117         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1118
1119         len = length(optstr);
1120         for (i = 1; i <= len; i++) {
1121                 c = substr(optstr, i, 1);
1122                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1123                 if (a == ":") {
1124                         arg[c] = 1;
1125                         i++;
1126                 }
1127                 opt[c] = 1;
1128         }
1129 }
1130 {
1131         expect = 0;
1132         str = $0;
1133         if (substr(str, 1, 1) != "-") {
1134                 printf("'%s'\n", str);
1135                 next;
1136         }
1137         len = length($0);
1138         for (i = 2; i <= len; i++) {
1139                 c = substr(str, i, 1);
1140                 if (!opt[c]) {
1141                         printf("-%s\n", substr(str, i));
1142                         next;
1143                 }
1144                 printf("-%s\n", c);
1145                 if (arg[c]) {
1146                         if (i < len)
1147                                 printf("'%s'\n", substr(str, i + 1));
1148                         else
1149                                 expect = 1;
1150                         next;
1151                 }
1152         }
1153 }
1154 END {
1155         if (expect)
1156                 print "?";
1157 }
1158 EOF
1159
1160 : process the command line options
1161 set X `for arg in "$@"; do echo "X$arg"; done |
1162         sed -e s/X// | awk -f options.awk`
1163 eval "set $*"
1164 shift
1165 rm -f options.awk
1166
1167 : set up default values
1168 fastread=''
1169 reuseval=false
1170 config_sh=''
1171 alldone=''
1172 error=''
1173 silent=''
1174 extractsh=''
1175 override=''
1176 knowitall=''
1177 rm -f optdef.sh posthint.sh
1178 cat >optdef.sh <<EOS
1179 $startsh
1180 EOS
1181
1182
1183 : option parsing
1184 while test $# -gt 0; do
1185         case "$1" in
1186         -d) shift; fastread=yes;;
1187         -e) shift; alldone=cont;;
1188         -f)
1189                 shift
1190                 cd ..
1191                 if test -r "$1"; then
1192                         config_sh="$1"
1193                 else
1194                         echo "$me: cannot read config file $1." >&2
1195                         error=true
1196                 fi
1197                 cd UU
1198                 shift;;
1199         -h) shift; error=true;;
1200         -r) shift; reuseval=true;;
1201         -s) shift; silent=true; realsilent=true;;
1202         -E) shift; alldone=exit;;
1203         -K) shift; knowitall=true;;
1204         -O) shift; override=true;;
1205         -S) shift; silent=true; extractsh=true;;
1206         -D)
1207                 shift
1208                 case "$1" in
1209                 *=)
1210                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1211                         echo "$me: ignoring -D $1" >&2
1212                         ;;
1213                 *=*) echo "$1" | \
1214                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1215                 *) echo "$1='define'" >> optdef.sh;;
1216                 esac
1217                 shift
1218                 ;;
1219         -U)
1220                 shift
1221                 case "$1" in
1222                 *=) echo "$1" >> optdef.sh;;
1223                 *=*)
1224                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1225                         echo "$me: ignoring -U $1" >&2
1226                         ;;
1227                 *) echo "$1='undef'" >> optdef.sh;;
1228                 esac
1229                 shift
1230                 ;;
1231         -A)
1232             shift
1233             xxx=''
1234             yyy="$1"
1235             zzz=''
1236             uuu=undef
1237             case "$yyy" in
1238             *=*) zzz=`echo $yyy|sed 's!=.*!!'`
1239                  case "$zzz" in
1240                  *:*) zzz='' ;;
1241                  *)   xxx=append
1242                       zzz=" "`echo $yyy|sed 's!^[^=]*=!!'` 
1243                       yyy=`echo $yyy|sed 's!=.*!!'` ;;
1244                  esac
1245                  ;;
1246             esac
1247             case "$xxx" in
1248             '')  case "$yyy" in
1249                  *:*) xxx=`echo $yyy|sed 's!:.*!!'`
1250                       yyy=`echo $yyy|sed 's!^[^:]*:!!'`
1251                       zzz=`echo $yyy|sed 's!^[^=]*=!!'`
1252                       yyy=`echo $yyy|sed 's!=.*!!'` ;;
1253                  *)   xxx=`echo $yyy|sed 's!:.*!!'`
1254                       yyy=`echo $yyy|sed 's!^[^:]*:!!'` ;;
1255                  esac
1256                  ;;       
1257             esac
1258             case "$xxx" in
1259             append)
1260                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1261             clear)
1262                 echo "$yyy=''"                  >> posthint.sh ;;
1263             define)
1264                 case "$zzz" in
1265                 '') zzz=define ;;
1266                 esac
1267                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1268             eval)
1269                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1270             prepend)
1271                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1272             undef)
1273                 case "$zzz" in
1274                 '') zzz="$uuu" ;;
1275                 esac
1276                 echo "$yyy=$zzz"                >> posthint.sh ;;
1277             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1278             esac
1279             ;;
1280         -V) echo "$me generated by metaconfig 3.0 PL70." >&2
1281             exit 0;;
1282         --) break;;
1283         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1284         *) break;;
1285         esac
1286 done
1287
1288 case "$error" in
1289 true)
1290         cat >&2 <<EOM
1291 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1292                  [-U symbol] [-U symbol=] [-A command:symbol...]
1293   -d : use defaults for all answers.
1294   -e : go on without questioning past the production of config.sh.
1295   -f : specify an alternate default configuration file.
1296   -h : print this help message and exit (with an error status).
1297   -r : reuse C symbols value if possible (skips costly nm extraction).
1298   -s : silent mode, only echoes questions and essential information.
1299   -D : define symbol to have some value:
1300          -D symbol         symbol gets the value 'define'
1301          -D symbol=value   symbol gets the value 'value'
1302   -E : stop at the end of questions, after having produced config.sh.
1303   -K : do not use unless you know what you are doing.
1304   -O : let -D and -U override definitions from loaded configuration file.
1305   -S : perform variable substitutions on all .SH files (can mix with -f)
1306   -U : undefine symbol:
1307          -U symbol    symbol gets the value 'undef'
1308          -U symbol=   symbol gets completely empty
1309   -A : manipulate symbol after the platform specific hints have been applied:
1310          -A symbol=value                append " "value to symbol
1311          -A append:symbol=value         append value to symbol
1312          -A define:symbol=value         define symbol to have value
1313          -A clear:symbol                define symbol to be ''
1314          -A define:symbol               define symbol to be 'define'
1315          -A eval:symbol=value           define symbol to be eval of value
1316          -A prepend:symbol=value        prepend value to symbol
1317          -A undef:symbol                define symbol to be 'undef'
1318          -A undef:symbol=               define symbol to be ''
1319   -V : print version number and exit (with a zero status).
1320 EOM
1321         exit 1
1322         ;;
1323 esac
1324
1325 : Sanity checks
1326 case "$fastread$alldone" in
1327 yescont|yesexit) ;;
1328 *)
1329         if test ! -t 0; then
1330                 echo "Say 'sh Configure', not 'sh <Configure'"
1331                 exit 1
1332         fi
1333         ;;
1334 esac
1335
1336 exec 4>&1
1337 case "$silent" in
1338 true) exec 1>/dev/null;;
1339 esac
1340
1341 : run the defines and the undefines, if any, but leave the file out there...
1342 touch optdef.sh
1343 . ./optdef.sh
1344 : create the posthint manipulation script and leave the file out there...
1345 touch posthint.sh
1346
1347 : set package name
1348 package=perl5
1349 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1350 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1351 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1352 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1353 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1354 esac
1355
1356 : Some greps do not return status, grrr.
1357 echo "grimblepritz" >grimble
1358 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1359         contains=contains
1360 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1361         contains=grep
1362 else
1363         contains=contains
1364 fi
1365 rm -f grimble
1366 : the following should work in any shell
1367 case "$contains" in
1368 contains*)
1369         echo " "
1370         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1371         cat >contains <<'EOSS'
1372 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1373 EOSS
1374 chmod +x contains
1375 esac
1376
1377 : Find the path to the source tree
1378 case "$src" in
1379 '') case "$0" in
1380     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1381          case "$src" in
1382          /*)    ;;
1383          *)     src=`cd ../$src && pwd` ;;
1384          esac
1385          ;;
1386     *)   src='.';;
1387     esac;;
1388 esac
1389 case "$src" in
1390 '')     src=/
1391         rsrc=/
1392         ;;
1393 /*) rsrc="$src";;
1394 *) rsrc="../$src";;
1395 esac
1396 if test -f $rsrc/Configure && \
1397         $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1398 then
1399    : found it, so we are ok.
1400 else
1401         rsrc=''
1402         for src in . .. ../.. ../../.. ../../../..; do
1403                 if test -f ../$src/Configure && \
1404                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1405                 then
1406                         rsrc=../$src
1407                         break
1408                 fi
1409         done
1410 fi
1411 case "$rsrc" in
1412 '')
1413         cat <<EOM >&4
1414
1415 Sorry, I can't seem to locate the source dir for $package.  Please start
1416 Configure with an explicit path -- i.e. /some/path/Configure.
1417
1418 EOM
1419         exit 1
1420         ;;
1421 ../.)   rsrc='..';;
1422 *)
1423         echo " "
1424         echo "Sources for $package found in \"$src\"." >&4
1425         ;;
1426 esac
1427
1428 : script used to extract .SH files with variable substitutions
1429 cat >extract <<'EOS'
1430 CONFIGDOTSH=true
1431 echo "Doing variable substitutions on .SH files..."
1432 if test -f $src/MANIFEST; then
1433         set x `awk '{print $1}' <$src/MANIFEST | grep '\.SH$'`
1434 else
1435         echo "(Looking for .SH files under the source directory.)"
1436         set x `(cd $src; find . -name "*.SH" -print)`
1437 fi
1438 shift
1439 case $# in
1440 0) set x `(cd $src; echo *.SH)`; shift;;
1441 esac
1442 if test ! -f $src/$1; then
1443         shift
1444 fi
1445 mkdir_p='
1446 name=$1;
1447 create="";
1448 while test $name; do
1449         if test ! -d "$name"; then
1450                 create="$name $create";
1451                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1452                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1453         else
1454                 name="";
1455         fi;
1456 done;
1457 for file in $create; do
1458         mkdir $file;
1459 done
1460 '
1461 for file in $*; do
1462         case "$src" in
1463         ".")
1464                 case "$file" in
1465                 */*)
1466                         dir=`expr X$file : 'X\(.*\)/'`
1467                         file=`expr X$file : 'X.*/\(.*\)'`
1468                         (cd $dir && . ./$file)
1469                         ;;
1470                 *)
1471                         . ./$file
1472                         ;;
1473                 esac
1474                 ;;
1475         *)
1476                 case "$file" in
1477                 */*)
1478                         dir=`expr X$file : 'X\(.*\)/'`
1479                         file=`expr X$file : 'X.*/\(.*\)'`
1480                         (set x $dir; shift; eval $mkdir_p)
1481                         sh <$src/$dir/$file
1482                         ;;
1483                 *)
1484                         sh <$src/$file
1485                         ;;
1486                 esac
1487                 ;;
1488         esac
1489 done
1490 if test -f $src/config_h.SH; then
1491         if test ! -f config.h; then
1492         : oops, they left it out of MANIFEST, probably, so do it anyway.
1493         . $src/config_h.SH
1494         fi
1495 fi
1496 EOS
1497
1498 : extract files and exit if asked to do so
1499 case "$extractsh" in
1500 true)
1501         case "$realsilent" in
1502         true) ;;
1503         *) exec 1>&4;;
1504         esac
1505         case "$config_sh" in
1506         '') config_sh='config.sh';;
1507         esac
1508         echo " "
1509         echo "Fetching answers from $config_sh..."
1510         cd ..
1511         . $config_sh
1512         test "$override" && . ./optdef.sh
1513         echo " "
1514         . UU/extract
1515         rm -rf UU
1516         echo "Done."
1517         exit 0
1518         ;;
1519 esac
1520
1521 : Eunice requires " " instead of "", can you believe it
1522 echo " "
1523 : Here we go...
1524 echo "Beginning of configuration questions for $package."
1525
1526 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1527
1528 : first determine how to suppress newline on echo command
1529 echo " "
1530 echo "Checking echo to see how to suppress newlines..."
1531 (echo "hi there\c" ; echo " ") >.echotmp
1532 if $contains c .echotmp >/dev/null 2>&1 ; then
1533         echo "...using -n."
1534         n='-n'
1535         c=''
1536 else
1537         cat <<'EOM'
1538 ...using \c
1539 EOM
1540         n=''
1541         c='\c'
1542 fi
1543 echo $n "The star should be here-->$c"
1544 echo '*'
1545 rm -f .echotmp
1546
1547 : Now test for existence of everything in MANIFEST
1548 echo " "
1549 if test -f $rsrc/MANIFEST; then
1550         echo "First let's make sure your kit is complete.  Checking..." >&4
1551         awk '$1 !~ /PACK[A-Z]+/ {print $1}' $rsrc/MANIFEST | split -50
1552         rm -f missing
1553         tmppwd=`pwd`
1554         for filelist in x??; do
1555                 (cd $rsrc; ls `cat $tmppwd/$filelist` >/dev/null 2>>$tmppwd/missing)
1556         done
1557         if test -s missing; then
1558                 cat missing >&4
1559                 cat >&4 <<'EOM'
1560
1561 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1562
1563 You have the option of continuing the configuration process, despite the
1564 distinct possibility that your kit is damaged, by typing 'y'es.  If you
1565 do, don't blame me if something goes wrong.  I advise you to type 'n'o
1566 and contact the author (perlbug@perl.com).
1567
1568 EOM
1569                 echo $n "Continue? [n] $c" >&4
1570                 read ans
1571                 case "$ans" in
1572                 y*)
1573                         echo "Continuing..." >&4
1574                         rm -f missing
1575                         ;;
1576                 *)
1577                         echo "ABORTING..." >&4
1578                         kill $$
1579                         ;;
1580                 esac
1581         else
1582                 echo "Looks good..."
1583         fi
1584 else
1585         echo "There is no MANIFEST file.  I hope your kit is complete !"
1586 fi
1587 rm -f missing x??
1588
1589 echo " "
1590 : Find the appropriate value for a newline for tr
1591 if test -n "$DJGPP"; then
1592        trnl='\012'
1593 fi
1594 if test X"$trnl" = X; then
1595         case "`echo foo|tr '\n' x 2>/dev/null`" in
1596         foox) trnl='\n' ;;
1597         esac
1598 fi
1599 if test X"$trnl" = X; then
1600         case "`echo foo|tr '\012' x 2>/dev/null`" in
1601         foox) trnl='\012' ;;
1602         esac
1603 fi
1604 if test X"$trnl" = X; then
1605         cat <<EOM >&2
1606
1607 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
1608
1609 EOM
1610         exit 1
1611 fi
1612
1613 : compute the number of columns on the terminal for proper question formatting
1614 case "$COLUMNS" in
1615 '') COLUMNS='80';;
1616 esac
1617
1618 : set up the echo used in my read
1619 myecho="case \"\$xxxm\" in
1620 '') echo $n \"\$rp $c\" >&4;;
1621 *) case \"\$rp\" in
1622         '') echo $n \"[\$xxxm] $c\";;
1623         *)
1624                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
1625                         echo \"\$rp\" >&4
1626                         echo $n \"[\$xxxm] $c\" >&4
1627                 else
1628                         echo $n \"\$rp [\$xxxm] $c\" >&4
1629                 fi
1630                 ;;
1631         esac;;
1632 esac"
1633
1634 : now set up to do reads with possible shell escape and default assignment
1635 cat <<EOSC >myread
1636 $startsh
1637 xxxm=\$dflt
1638 $myecho
1639 ans='!'
1640 case "\$fastread" in
1641 yes) case "\$dflt" in
1642         '') ;;
1643         *) ans='';
1644                 case "\$silent-\$rp" in
1645                 true-) ;;
1646                 *) echo " " >&4;;
1647                 esac;;
1648         esac;;
1649 *) case "\$silent" in
1650         true) case "\$rp" in
1651                 '') ans='';;
1652                 esac;;
1653         esac;;
1654 esac
1655 while expr "X\$ans" : "X!" >/dev/null; do
1656         read answ
1657         set x \$xxxm
1658         shift
1659         aok=''; eval "ans=\\"\$answ\\"" && aok=y
1660         case  "\$answ" in
1661         "!")
1662                 sh 1>&4
1663                 echo " "
1664                 $myecho
1665                 ;;
1666         !*)
1667                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
1668                 shift
1669                 sh 1>&4 -c "\$*"
1670                 echo " "
1671                 $myecho
1672                 ;;
1673         "\$ans")
1674                 case "\$ans" in
1675                 \\&*)
1676                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
1677                         shift
1678                         case "\$1" in
1679                         -d)
1680                                 fastread=yes
1681                                 echo "(OK, I'll run with -d after this question.)" >&4
1682                                 ;;
1683                         -*)
1684                                 echo "*** Sorry, \$1 not supported yet." >&4
1685                                 ;;
1686                         esac
1687                         $myecho
1688                         ans=!
1689                         ;;
1690                 esac;;
1691         *)
1692                 case "\$aok" in
1693                 y)
1694                         echo "*** Substitution done -- please confirm."
1695                         xxxm="\$ans"
1696                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
1697                         xxxm="\$ans"
1698                         ans=!
1699                         ;;
1700                 *)
1701                         echo "*** Error -- try again."
1702                         ans=!
1703                         ;;
1704                 esac
1705                 $myecho
1706                 ;;
1707         esac
1708         case "\$ans\$xxxm\$nostick" in
1709         '')
1710                 ans=!
1711                 $myecho
1712                 ;;
1713         esac
1714 done
1715 case "\$ans" in
1716 '') ans="\$xxxm";;
1717 esac
1718 EOSC
1719
1720 : create .config dir to save info across Configure sessions
1721 test -d ../.config || mkdir ../.config
1722 cat >../.config/README <<EOF
1723 This directory created by Configure to save information that should
1724 persist across sessions for $package.
1725
1726 You may safely delete it if you wish.
1727 EOF
1728
1729 : general instructions
1730 needman=true
1731 firsttime=true
1732 user=`(logname) 2>/dev/null`
1733 case "$user" in
1734 '') user=`whoami 2>&1`;;
1735 esac
1736 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
1737         firsttime=false
1738         echo " "
1739         rp='Would you like to see the instructions?'
1740         dflt=n
1741         . ./myread
1742         case "$ans" in
1743         [yY]*) ;;
1744         *) needman=false;;
1745         esac
1746 fi
1747 if $needman; then
1748         cat <<EOH
1749
1750 This installation shell script will examine your system and ask you questions
1751 to determine how the perl5 package should be installed. If you get
1752 stuck on a question, you may use a ! shell escape to start a subshell or
1753 execute a command.  Many of the questions will have default answers in square
1754 brackets; typing carriage return will give you the default.
1755
1756 On some of the questions which ask for file or directory names you are allowed
1757 to use the ~name construct to specify the login directory belonging to "name",
1758 even if you don't have a shell which knows about that.  Questions where this is
1759 allowed will be marked "(~name ok)".
1760
1761 EOH
1762         rp=''
1763         dflt='Type carriage return to continue'
1764         . ./myread
1765         cat <<'EOH'
1766
1767 The prompter used in this script allows you to use shell variables and
1768 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
1769 in the default answer, as if the default line was a set of arguments given to a
1770 script shell.  This means you may also use $* to repeat the whole default line,
1771 so you do not have to re-type everything to add something to the default.
1772
1773 Everytime there is a substitution, you will have to confirm.  If there is an
1774 error (e.g. an unmatched backtick), the default answer will remain unchanged
1775 and you will be prompted again.
1776
1777 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
1778 the questions and use the computed defaults (or the previous answers if there
1779 was already a config.sh file). Type 'Configure -h' for a list of options.
1780 You may also start interactively and then answer '& -d' at any prompt to turn
1781 on the non-interactive behaviour for the remainder of the execution.
1782
1783 EOH
1784         . ./myread
1785         cat <<EOH
1786
1787 Much effort has been expended to ensure that this shell script will run on any
1788 Unix system.  If despite that it blows up on yours, your best bet is to edit
1789 Configure and run it again.  If you can't run Configure for some reason,
1790 you'll have to generate a config.sh file by hand.  Whatever problems you
1791 have, let me (perlbug@perl.com) know how I blew it.
1792
1793 This installation script affects things in two ways:
1794
1795 1) it may do direct variable substitutions on some of the files included
1796    in this kit.
1797 2) it builds a config.h file for inclusion in C programs.  You may edit
1798    any of these files as the need arises after running this script.
1799
1800 If you make a mistake on a question, there is no easy way to back up to it
1801 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
1802 files.  Configure will offer to let you do this before it runs the SH files.
1803
1804 EOH
1805         dflt='Type carriage return to continue'
1806         . ./myread
1807         case "$firsttime" in
1808         true) echo $user >>../.config/instruct;;
1809         esac
1810 fi
1811
1812 : find out where common programs are
1813 echo " "
1814 echo "Locating common programs..." >&4
1815 cat <<EOSC >loc
1816 $startsh
1817 case \$# in
1818 0) exit 1;;
1819 esac
1820 thing=\$1
1821 shift
1822 dflt=\$1
1823 shift
1824 for dir in \$*; do
1825         case "\$thing" in
1826         .)
1827         if test -d \$dir/\$thing; then
1828                 echo \$dir
1829                 exit 0
1830         fi
1831         ;;
1832         *)
1833         for thisthing in \$dir/\$thing; do
1834                 : just loop through to pick last item
1835         done
1836         if test -f \$thisthing; then
1837                 echo \$thisthing
1838                 exit 0
1839         elif test -f \$dir/\$thing.exe; then
1840                 if test -n "$DJGPP"; then
1841                         echo \$dir/\$thing.exe
1842                 else
1843                         : on Eunice apparently
1844                         echo \$dir/\$thing
1845                 fi
1846                 exit 0
1847         fi
1848         ;;
1849         esac
1850 done
1851 echo \$dflt
1852 exit 1
1853 EOSC
1854 chmod +x loc
1855 $eunicefix loc
1856 loclist="
1857 awk
1858 cat
1859 comm
1860 cp
1861 echo
1862 expr
1863 grep
1864 ls
1865 make
1866 mkdir
1867 rm
1868 sed
1869 sort
1870 touch
1871 tr
1872 uniq
1873 "
1874 trylist="
1875 Mcc
1876 ar
1877 byacc
1878 cpp
1879 csh
1880 date
1881 egrep
1882 gzip
1883 less
1884 ln
1885 more
1886 nm
1887 nroff
1888 pg
1889 test
1890 uname
1891 zip
1892 "
1893 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1894 pth="$pth /lib /usr/lib"
1895 for file in $loclist; do
1896         eval xxx=\$$file
1897         case "$xxx" in
1898         /*|?:[\\/]*)
1899                 if test -f "$xxx"; then
1900                         : ok
1901                 else
1902                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
1903                         xxx=`./loc $file $file $pth`
1904                 fi
1905                 ;;
1906         '') xxx=`./loc $file $file $pth`;;
1907         *) xxx=`./loc $xxx $xxx $pth`;;
1908         esac
1909         eval $file=$xxx
1910         eval _$file=$xxx
1911         case "$xxx" in
1912         /*)
1913                 echo $file is in $xxx.
1914                 ;;
1915         ?:[\\/]*)
1916                 echo $file is in $xxx.
1917                 ;;
1918         *)
1919                 echo "I don't know where '$file' is, and my life depends on it." >&4
1920                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
1921                 exit 1
1922                 ;;
1923         esac
1924 done
1925 echo " "
1926 echo "Don't worry if any of the following aren't found..."
1927 say=offhand
1928 for file in $trylist; do
1929         eval xxx=\$$file
1930         case "$xxx" in
1931         /*|?:[\\/]*)
1932                 if test -f "$xxx"; then
1933                         : ok
1934                 else
1935                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
1936                         xxx=`./loc $file $file $pth`
1937                 fi
1938                 ;;
1939         '') xxx=`./loc $file $file $pth`;;
1940         *) xxx=`./loc $xxx $xxx $pth`;;
1941         esac
1942         eval $file=$xxx
1943         eval _$file=$xxx
1944         case "$xxx" in
1945         /*)
1946                 echo $file is in $xxx.
1947                 ;;
1948         ?:[\\/]*)
1949                 echo $file is in $xxx.
1950                 ;;
1951         *)
1952                 echo "I don't see $file out there, $say."
1953                 say=either
1954                 ;;
1955         esac
1956 done
1957 case "$egrep" in
1958 egrep)
1959         echo "Substituting grep for egrep."
1960         egrep=$grep
1961         ;;
1962 esac
1963 case "$ln" in
1964 ln)
1965         echo "Substituting cp for ln."
1966         ln=$cp
1967         ;;
1968 esac
1969 case "$test" in
1970 test)
1971         echo "Hopefully test is built into your sh."
1972         ;;
1973 *)
1974         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
1975                 echo "Using the test built into your sh."
1976                 test=test
1977                 _test=test
1978         fi
1979         ;;
1980 esac
1981 case "$echo" in
1982 echo)
1983         echo "Hopefully echo is built into your sh."
1984         ;;
1985 '') ;;
1986 *)
1987         echo " "
1988 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
1989         $echo $n "hi there$c" >foo1
1990         echo $n "hi there$c" >foo2
1991         if cmp foo1 foo2 >/dev/null 2>&1; then
1992                 echo "They are compatible.  In fact, they may be identical."
1993         else
1994                 case "$n" in
1995                 '-n') n='' c='\c';;
1996                 *) n='-n' c='';;
1997                 esac
1998                 cat <<FOO
1999 They are not compatible!  You are probably running ksh on a non-USG system.
2000 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2001 have echo built in and we may have to run some Bourne shell scripts.  That
2002 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2003
2004 FOO
2005                 $echo $n "The star should be here-->$c"
2006                 $echo "*"
2007         fi
2008         $rm -f foo1 foo2
2009         ;;
2010 esac
2011
2012 : determine whether symbolic links are supported
2013 echo " "
2014 $touch blurfl
2015 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2016         echo "Symbolic links are supported." >&4
2017         lns="$ln -s"
2018 else
2019         echo "Symbolic links are NOT supported." >&4
2020         lns="$ln"
2021 fi
2022 $rm -f blurfl sym
2023
2024 : see whether [:lower:] and [:upper:] are supported character classes
2025 echo " "
2026 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2027 ABYZ)
2028         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2029         up='[:upper:]'
2030         low='[:lower:]'
2031         ;;
2032 *)      # There is a discontinuity in EBCDIC between 'I' and 'J'
2033         # (0xc9 and 0xd1), therefore that is a nice testing point.
2034         if test "X$up" = X -o "X$low" = X; then
2035             case "`echo IJ | $tr '[I-J]' '[i-j]' 2>/dev/null`" in
2036             ij) up='[A-Z]'
2037                 low='[a-z]'
2038                 ;;
2039             esac
2040         fi
2041         if test "X$up" = X -o "X$low" = X; then
2042             case "`echo IJ | $tr I-J i-j 2>/dev/null`" in
2043             ij) up='A-Z'
2044                 low='a-z'
2045                 ;;
2046             esac
2047         fi
2048         if test "X$up" = X -o "X$low" = X; then
2049             case "`echo IJ | od -x 2>/dev/null`" in
2050             *C9D1*|*c9d1*)
2051                 echo "Hey, this might be EBCDIC." >&4
2052                 if test "X$up" = X -o "X$low" = X; then
2053                     case "`echo IJ | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
2054                     ij) up='[A-IJ-RS-Z]'
2055                         low='[a-ij-rs-z]'
2056                         ;;
2057                     esac
2058                 fi
2059                 if test "X$up" = X -o "X$low" = X; then
2060                     case "`echo IJ | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
2061                     ij) up='A-IJ-RS-Z'
2062                         low='a-ij-rs-z'
2063                         ;;
2064                     esac
2065                 fi
2066                 ;;
2067             esac
2068         fi
2069 esac
2070 case "`echo IJ | $tr \"$up\" \"$low\" 2>/dev/null`" in
2071 ij)
2072     echo "Using $up and $low to convert case." >&4
2073     ;;
2074 *)
2075     echo "I don't know how to translate letters from upper to lower case." >&4
2076     echo "Your tr is not acting any way I know of." >&4
2077     exit 1
2078     ;;
2079 esac
2080 : set up the translation script tr, must be called with ./tr of course
2081 cat >tr <<EOSC
2082 $startsh
2083 case "\$1\$2" in
2084 '[A-Z][a-z]') exec $tr '$up' '$low';;
2085 '[a-z][A-Z]') exec $tr '$low' '$up';;
2086 esac
2087 exec $tr "\$@"
2088 EOSC
2089 chmod +x tr
2090 $eunicefix tr
2091
2092 : Try to determine whether config.sh was made on this system
2093 case "$config_sh" in
2094 '')
2095 myuname=`( ($uname -a) 2>/dev/null || hostname) 2>&1`
2096 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
2097 # because the A-Z/a-z are not consecutive.
2098 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
2099         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
2100 newmyuname="$myuname"
2101 dflt=n
2102 case "$knowitall" in
2103 '')
2104         if test -f ../config.sh; then
2105                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
2106                         eval "`grep myuname= ../config.sh`"
2107                 fi
2108                 if test "X$myuname" = "X$newmyuname"; then
2109                         dflt=y
2110                 fi
2111         fi
2112         ;;
2113 *) dflt=y;;
2114 esac
2115
2116 : Get old answers from old config file if Configure was run on the
2117 : same system, otherwise use the hints.
2118 hint=default
2119 cd ..
2120 if test -f config.sh; then
2121         echo " "
2122         rp="I see a config.sh file.  Shall I use it to set the defaults?"
2123         . UU/myread
2124         case "$ans" in
2125         n*|N*) echo "OK, I'll ignore it."; mv config.sh config.sh.old;;
2126         *)  echo "Fetching default answers from your old config.sh file..." >&4
2127                 tmp_n="$n"
2128                 tmp_c="$c"
2129                 tmp_sh="$sh"
2130                 . ./config.sh
2131                 cp config.sh UU
2132                 n="$tmp_n"
2133                 c="$tmp_c"
2134                 : Older versions did not always set $sh.  Catch re-use of such
2135                 : an old config.sh.
2136                 case "$sh" in
2137                 '') sh="$tmp_sh" ;;
2138                 esac
2139                 hint=previous
2140                 ;;
2141         esac
2142 fi
2143 if test ! -f config.sh; then
2144         $cat <<EOM
2145
2146 First time through, eh?  I have some defaults handy for some systems
2147 that need some extra help getting the Configure answers right:
2148
2149 EOM
2150         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
2151         dflt=''
2152         : Half the following guesses are probably wrong... If you have better
2153         : tests or hints, please send them to perlbug@perl.com
2154         : The metaconfig authors would also appreciate a copy...
2155         $test -f /irix && osname=irix
2156         $test -f /xenix && osname=sco_xenix
2157         $test -f /dynix && osname=dynix
2158         $test -f /dnix && osname=dnix
2159         $test -f /lynx.os && osname=lynxos
2160         $test -f /unicos && osname=unicos && osvers=`$uname -r`
2161         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
2162         $test -f /bin/mips && /bin/mips && osname=mips
2163         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
2164                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
2165         $test -d /usr/apollo/bin && osname=apollo
2166         $test -f /etc/saf/_sactab && osname=svr4
2167         $test -d /usr/include/minix && osname=minix
2168         if $test -d /MachTen -o -d /MachTen_Folder; then
2169                 osname=machten
2170                 if $test -x /sbin/version; then
2171                         osvers=`/sbin/version | $awk '{print $2}' |
2172                         $sed -e 's/[A-Za-z]$//'`
2173                 elif $test -x /usr/etc/version; then
2174                         osvers=`/usr/etc/version | $awk '{print $2}' |
2175                         $sed -e 's/[A-Za-z]$//'`
2176                 else
2177                         osvers="$2.$3"
2178                 fi
2179         fi
2180        $test -f /sys/posix.dll &&
2181                $test -f /usr/bin/what &&
2182                set X `/usr/bin/what /sys/posix.dll` &&
2183                $test "$3" = UWIN &&
2184                osname=uwin &&
2185                osvers="$5"
2186         if $test -f $uname; then
2187                 set X $myuname
2188                 shift
2189
2190                 case "$5" in
2191                 fps*) osname=fps ;;
2192                 mips*)
2193                         case "$4" in
2194                         umips) osname=umips ;;
2195                         *) osname=mips ;;
2196                         esac;;
2197                 [23]100) osname=mips ;;
2198                 next*) osname=next ;;
2199                 i386*)
2200                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
2201                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
2202                                 osname='sco'
2203                                 osvers=$tmp
2204                         elif $test -f /etc/kconfig; then
2205                                 osname=isc
2206                                 if test "$lns" = "$ln -s"; then
2207                                         osvers=4
2208                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
2209                                         osvers=3
2210                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
2211                                         osvers=2
2212                                 fi
2213                         fi
2214                         tmp=''
2215                         ;;
2216                 pc*)
2217                         if test -n "$DJGPP"; then
2218                                 osname=dos
2219                                 osvers=djgpp
2220                         fi
2221                         ;;
2222                 esac
2223
2224                 case "$1" in
2225                 aix) osname=aix
2226                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
2227                         case "$tmp" in
2228                         'not found') osvers="$4"."$3" ;;
2229                         '<3240'|'<>3240') osvers=3.2.0 ;;
2230                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
2231                         '=3250'|'>3250') osvers=3.2.5 ;;
2232                         *) osvers=$tmp;;
2233                         esac
2234                         ;;
2235                 *dc.osx) osname=dcosx
2236                         osvers="$3"
2237                         ;;
2238                 dnix) osname=dnix
2239                         osvers="$3"
2240                         ;;
2241                 domainos) osname=apollo
2242                         osvers="$3"
2243                         ;;
2244                 dgux) osname=dgux 
2245                         osvers="$3"
2246                         ;;
2247                 dynixptx*) osname=dynixptx
2248                         osvers=`echo "$4"|sed 's/^v//'`
2249                         ;;
2250                 freebsd) osname=freebsd 
2251                         osvers="$3" ;;
2252                 genix) osname=genix ;;
2253                 hp*) osname=hpux 
2254                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
2255                         ;;
2256                 irix*) osname=irix
2257                         case "$3" in
2258                         4*) osvers=4 ;;
2259                         5*) osvers=5 ;;
2260                         *)      osvers="$3" ;;
2261                         esac
2262                         ;;
2263                 linux) osname=linux
2264                         case "$3" in
2265                         *)      osvers="$3" ;;
2266                         esac
2267                         ;;
2268                 MiNT) osname=mint
2269                         ;;
2270                 netbsd*) osname=netbsd
2271                         osvers="$3"
2272                         ;;
2273                 news-os) osvers="$3"
2274                         case "$3" in
2275                         4*) osname=newsos4 ;;
2276                         *) osname=newsos ;;
2277                         esac
2278                         ;;
2279                 bsd386) osname=bsd386
2280                         osvers=`$uname -r`
2281                         ;;
2282                 POSIX-BC | posix-bc ) osname=posix-bc
2283                         osvers="$3"
2284                         ;;
2285                 powerux | power_ux | powermax_os | powermaxos | \
2286                 powerunix | power_unix) osname=powerux
2287                         osvers="$3"
2288                         ;;
2289                 next*) osname=next ;;
2290                 solaris) osname=solaris
2291                         case "$3" in
2292                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
2293                         *)      osvers="$3" ;;
2294                         esac
2295                         ;;
2296                 sunos) osname=sunos
2297                         case "$3" in
2298                         5*) osname=solaris
2299                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
2300                         *)      osvers="$3" ;;
2301                         esac
2302                         ;;
2303                 titanos) osname=titanos
2304                         case "$3" in
2305                         1*) osvers=1 ;;
2306                         2*) osvers=2 ;;
2307                         3*) osvers=3 ;;
2308                         4*) osvers=4 ;;
2309                         *)      osvers="$3" ;;
2310                         esac
2311                         ;;
2312                 ultrix) osname=ultrix
2313                         osvers="$3"
2314                         ;;
2315                 osf1|mls+)      case "$5" in
2316                                 alpha)
2317                                         osname=dec_osf
2318                                         osvers=`echo "$3" | sed 's/^[xvt]//'`
2319                                         ;;
2320                         hp*)    osname=hp_osf1  ;;
2321                         mips)   osname=mips_osf1 ;;
2322                         esac
2323                         ;;
2324                 unixware) osname=svr5
2325                         osvers="$4"
2326                         ;;
2327                 uts) osname=uts
2328                         osvers="$3"
2329                         ;;
2330                 qnx) osname=qnx
2331                         osvers="$4"
2332                         ;;
2333                 $2) case "$osname" in
2334                         *isc*) ;;
2335                         *freebsd*) ;;
2336                         svr*)
2337                                 : svr4.x or possibly later
2338                                 case "svr$3" in 
2339                                 ${osname}*)
2340                                         osname=svr$3
2341                                         osvers=$4
2342                                         ;;
2343                                 esac
2344                                 case "$osname" in
2345                                 svr4.0)
2346                                         : Check for ESIX
2347                                         if test -f /stand/boot ; then
2348                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
2349                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
2350                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
2351                                                         if test -n "$isesix"; then
2352                                                                 osname=esix4
2353                                                         fi
2354                                                 fi
2355                                         fi
2356                                         ;;
2357                                 esac
2358                                 ;;
2359                         *)      if test -f /etc/systemid; then
2360                                         osname=sco
2361                                         set `echo $3 | $sed 's/\./ /g'` $4
2362                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
2363                                                 osvers=$1.$2.$3
2364                                         elif $test -f $src/hints/sco_$1_$2.sh; then
2365                                                 osvers=$1.$2
2366                                         elif $test -f $src/hints/sco_$1.sh; then
2367                                                 osvers=$1
2368                                         fi
2369                                 else
2370                                         case "$osname" in
2371                                         '') : Still unknown.  Probably a generic Sys V.
2372                                                 osname="sysv"
2373                                                 osvers="$3"
2374                                                 ;;
2375                                         esac
2376                                 fi
2377                                 ;;
2378                         esac
2379                         ;;
2380                 *)      case "$osname" in
2381                         '') : Still unknown.  Probably a generic BSD.
2382                                 osname="$1"
2383                                 osvers="$3"
2384                                 ;;
2385                         esac
2386                         ;;
2387                 esac
2388         else
2389                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
2390                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
2391                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
2392                                 osname=news_os
2393                         fi
2394                         $rm -f UU/kernel.what
2395                 elif test -d c:/.; then
2396                         set X $myuname
2397                         osname=os2
2398                         osvers="$5"
2399                 fi
2400         fi
2401         
2402         : Now look for a hint file osname_osvers, unless one has been
2403         : specified already.
2404         case "$hintfile" in
2405         ''|' ')
2406                 file=`echo "${osname}_${osvers}" | $sed -e 's@\.@_@g' -e 's@_$@@'`
2407                 : Also try without trailing minor version numbers.
2408                 xfile=`echo $file | $sed -e 's@_[^_]*$@@'`
2409                 xxfile=`echo $xfile | $sed -e 's@_[^_]*$@@'`
2410                 xxxfile=`echo $xxfile | $sed -e 's@_[^_]*$@@'`
2411                 xxxxfile=`echo $xxxfile | $sed -e 's@_[^_]*$@@'`
2412                 case "$file" in
2413                 '') dflt=none ;;
2414                 *)  case "$osvers" in
2415                         '') dflt=$file
2416                                 ;;
2417                         *)  if $test -f $src/hints/$file.sh ; then
2418                                         dflt=$file
2419                                 elif $test -f $src/hints/$xfile.sh ; then
2420                                         dflt=$xfile
2421                                 elif $test -f $src/hints/$xxfile.sh ; then
2422                                         dflt=$xxfile
2423                                 elif $test -f $src/hints/$xxxfile.sh ; then
2424                                         dflt=$xxxfile
2425                                 elif $test -f $src/hints/$xxxxfile.sh ; then
2426                                         dflt=$xxxxfile
2427                                 elif $test -f "$src/hints/${osname}.sh" ; then
2428                                         dflt="${osname}"
2429                                 else
2430                                         dflt=none
2431                                 fi
2432                                 ;;
2433                         esac
2434                         ;;
2435                 esac
2436                 if $test -f Policy.sh ; then
2437                         case "$dflt" in
2438                         *Policy*) ;;
2439                         none) dflt="Policy" ;;
2440                         *) dflt="Policy $dflt" ;;
2441                         esac
2442                 fi
2443                 ;;
2444         *)
2445                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
2446                 ;;
2447         esac
2448
2449         if $test -f Policy.sh ; then
2450                 $cat <<EOM
2451
2452 There's also a Policy hint file available, which should make the
2453 site-specific (policy) questions easier to answer.
2454 EOM
2455
2456         fi
2457
2458         $cat <<EOM
2459
2460 You may give one or more space-separated answers, or "none" if appropriate.
2461 A well-behaved OS will have no hints, so answering "none" or just "Policy"
2462 is a good thing.  DO NOT give a wrong version or a wrong OS.
2463
2464 EOM
2465
2466         rp="Which of these apply, if any?"
2467         . UU/myread
2468         tans=$ans
2469         for file in $tans; do
2470                 if $test X$file = XPolicy -a -f Policy.sh; then
2471                         . Policy.sh
2472                         $cat Policy.sh >> UU/config.sh
2473                 elif $test -f $src/hints/$file.sh; then
2474                         . $src/hints/$file.sh
2475                         $cat $src/hints/$file.sh >> UU/config.sh
2476                 elif $test X$tans = X -o X$tans = Xnone ; then
2477                         : nothing
2478                 else
2479                         : Give one chance to correct a possible typo.
2480                         echo "$file.sh does not exist"
2481                         dflt=$file
2482                         rp="hint to use instead?"
2483                         . UU/myread
2484                         for file in $ans; do
2485                                 if $test -f "$src/hints/$file.sh"; then
2486                                         . $src/hints/$file.sh
2487                                         $cat $src/hints/$file.sh >> UU/config.sh
2488                                 elif $test X$ans = X -o X$ans = Xnone ; then
2489                                         : nothing
2490                                 else
2491                                         echo "$file.sh does not exist -- ignored."
2492                                 fi
2493                         done
2494                 fi
2495         done
2496
2497         hint=recommended
2498         : Remember our hint file for later.
2499         if $test -f "$src/hints/$file.sh" ; then
2500                 hintfile="$file"
2501         else
2502                 hintfile=''
2503         fi
2504 fi
2505 cd UU
2506 ;;
2507 *)
2508         echo " "
2509         echo "Fetching default answers from $config_sh..." >&4
2510         tmp_n="$n"
2511         tmp_c="$c"
2512         cd ..
2513         cp $config_sh config.sh 2>/dev/null
2514         chmod +w config.sh
2515         . ./config.sh
2516         cd UU
2517         cp ../config.sh .
2518         n="$tmp_n"
2519         c="$tmp_c"
2520         hint=previous
2521         ;;
2522 esac
2523 test "$override" && . ./optdef.sh
2524 myuname="$newmyuname"
2525
2526 : Restore computed paths
2527 for file in $loclist $trylist; do
2528         eval $file="\$_$file"
2529 done
2530
2531 cat << EOM
2532
2533 Configure uses the operating system name and version to set some defaults.
2534 The default value is probably right if the name rings a bell. Otherwise,
2535 since spelling matters for me, either accept the default or answer "none"
2536 to leave it blank.
2537
2538 EOM
2539 case "$osname" in
2540         ''|' ')
2541                 case "$hintfile" in
2542                 ''|' '|none) dflt=none ;;
2543                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
2544                 esac
2545                 ;;
2546         *) dflt="$osname" ;;
2547 esac
2548 rp="Operating system name?"
2549 . ./myread
2550 case "$ans" in
2551 none)  osname='' ;;
2552 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
2553 esac
2554 echo " "
2555 case "$osvers" in
2556         ''|' ')
2557                 case "$hintfile" in
2558                 ''|' '|none) dflt=none ;;
2559                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
2560                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
2561                         case "$dflt" in
2562                         ''|' ') dflt=none ;;
2563                         esac
2564                         ;;
2565                 esac
2566                 ;;
2567         *) dflt="$osvers" ;;
2568 esac
2569 rp="Operating system version?"
2570 . ./myread
2571 case "$ans" in
2572 none)  osvers='' ;;
2573 *) osvers="$ans" ;;
2574 esac
2575
2576
2577 . ./posthint.sh
2578
2579 : who configured the system
2580 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
2581 cf_by=`(logname) 2>/dev/null`
2582 case "$cf_by" in
2583 "")
2584         cf_by=`(whoami) 2>/dev/null`
2585         case "$cf_by" in
2586         "") cf_by=unknown ;;
2587         esac ;;
2588 esac
2589
2590 : set up the script used to warn in case of inconsistency
2591 cat <<EOS >whoa
2592 $startsh
2593 EOS
2594 cat <<'EOSC' >>whoa
2595 dflt=y
2596 echo " "
2597 echo "*** WHOA THERE!!! ***" >&4
2598 echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
2599 rp="    Keep the $hint value?"
2600 . ./myread
2601 case "$ans" in
2602 y) td=$was; tu=$was;;
2603 esac
2604 EOSC
2605
2606 : function used to set $1 to $val
2607 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
2608 case "$val$was" in
2609 $define$undef) . ./whoa; eval "$var=\$td";;
2610 $undef$define) . ./whoa; eval "$var=\$tu";;
2611 *) eval "$var=$val";;
2612 esac'
2613
2614 cat <<EOM
2615
2616 Perl can be built to take advantage of threads, on some systems.
2617 To do so, Configure must be run with -Dusethreads.
2618
2619 Note that threading is a highly experimental feature, and
2620 some known race conditions still remain.  If you choose to try
2621 it, be very sure to not actually deploy it for production
2622 purposes.  README.threads has more details, and is required
2623 reading if you enable threads.
2624 EOM
2625 case "$usethreads" in
2626 $define|true|[yY]*)     dflt='y';;
2627 *) dflt='n';;
2628 esac
2629 rp='Build a threading Perl?'
2630 . ./myread
2631 case "$ans" in
2632 y|Y)    val="$define" ;;     
2633 *)      val="$undef" ;;
2634 esac
2635 set usethreads
2636 eval $setvar 
2637
2638 case "$d_oldpthreads" in
2639 '')     : Configure tests would be welcome here.  For now, assume undef.
2640         val="$undef" ;;
2641 *)      val="$d_oldpthreads" ;;
2642 esac
2643 set d_oldpthreads
2644 eval $setvar
2645
2646
2647 case "$usethreads" in
2648 "$define"|true|[yY]*)
2649 : Look for a hint-file generated 'call-back-unit'.  If the
2650 : user has specified that a threading perl is to be built,
2651 : we may need to set or change some other defaults.
2652         if $test -f usethreads.cbu; then
2653                 echo "Your platform has some specific hints for threaded builds, using them..."
2654                 . ./usethreads.cbu
2655         else
2656                 $cat <<EOM
2657 (Your platform doesn't have any specific hints for threaded builds.
2658  Assuming POSIX threads, then.)
2659 EOM
2660         fi
2661     ;;
2662 esac
2663
2664 cat <<EOM
2665
2666 Perl can be built so that multiple Perl interpreters can coexist
2667 within the same Perl executable.  To do so, Configure must be run with
2668 -Dusemultiplicity.
2669
2670 Normally you do not need this and you should answer no.
2671
2672 EOM
2673 case "$usemultiplicity" in
2674 $define|true|[yY]*)     dflt='y';;
2675 *) dflt='n';;
2676 esac
2677 rp='Build Perl for multiplicity?'
2678 . ./myread
2679 case "$ans" in
2680 y|Y)    val="$define" ;;     
2681 *)      val="$undef" ;;
2682 esac
2683 set usemultiplicity
2684 eval $setvar 
2685
2686 : determine where manual pages are on this system
2687 echo " "
2688 case "$sysman" in
2689 '') 
2690         syspath='/usr/man/man1 /usr/man/mann /usr/man/manl /usr/man/local/man1'
2691         syspath="$syspath /usr/man/u_man/man1 /usr/share/man/man1"
2692         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
2693         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
2694         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
2695         sysman=`./loc . /usr/man/man1 $syspath`
2696         ;;
2697 esac
2698 if $test -d "$sysman"; then
2699         echo "System manual is in $sysman." >&4
2700 else
2701         echo "Could not find manual pages in source form." >&4
2702 fi
2703
2704 : see what memory models we can support
2705 case "$models" in
2706 '')
2707         $cat >pdp11.c <<'EOP'
2708 int main() {
2709 #ifdef pdp11
2710         exit(0);
2711 #else
2712         exit(1);
2713 #endif
2714 }
2715 EOP
2716         ( cc -o pdp11 pdp11.c ) >/dev/null 2>&1
2717         if $test -f pdp11 && ./pdp11 2>/dev/null; then
2718                 dflt='unsplit split'
2719         else
2720                 tans=`./loc . X /lib/small /lib/large /usr/lib/small /usr/lib/large /lib/medium /usr/lib/medium /lib/huge`
2721                 case "$tans" in
2722                 X) dflt='none';;
2723                 *) if $test -d /lib/small || $test -d /usr/lib/small; then
2724                                 dflt='small'
2725                         else
2726                                 dflt=''
2727                         fi
2728                         if $test -d /lib/medium || $test -d /usr/lib/medium; then
2729                                 dflt="$dflt medium"
2730                         fi
2731                         if $test -d /lib/large || $test -d /usr/lib/large; then
2732                                 dflt="$dflt large"
2733                         fi
2734                         if $test -d /lib/huge || $test -d /usr/lib/huge; then
2735                                 dflt="$dflt huge"
2736                         fi
2737                 esac
2738         fi;;
2739 *) dflt="$models";;
2740 esac
2741 $cat <<EOM
2742  
2743 Some systems have different model sizes.  On most systems they are called
2744 small, medium, large, and huge.  On the PDP11 they are called unsplit and
2745 split.  If your system doesn't support different memory models, say "none".
2746 If you wish to force everything to one memory model, say "none" here and
2747 put the appropriate flags later when it asks you for other cc and ld flags.
2748 Venix systems may wish to put "none" and let the compiler figure things out.
2749 (In the following question multiple model names should be space separated.)
2750
2751 The default for most systems is "none".
2752
2753 EOM
2754 rp="Which memory models are supported?"
2755 . ./myread
2756 models="$ans"
2757
2758 case "$models" in
2759 none)
2760         small=''
2761         medium=''
2762         large=''
2763         huge=''
2764         unsplit=''
2765         split=''
2766         ;;
2767 *split)
2768         case "$split" in
2769         '') if $contains '\-i' $sysman/ld.1 >/dev/null 2>&1 || \
2770                          $contains '\-i' $sysman/cc.1 >/dev/null 2>&1; then
2771                         dflt='-i'
2772                 else
2773                         dflt='none'
2774                 fi;;
2775         *) dflt="$split";;
2776         esac
2777         rp="What flag indicates separate I and D space?"
2778         . ./myread
2779         tans="$ans"
2780         case "$tans" in
2781         none) tans='';;
2782         esac
2783         split="$tans"
2784         unsplit='';;
2785 *large*|*small*|*medium*|*huge*)
2786         case "$models" in
2787         *large*)
2788                 case "$large" in
2789                 '') dflt='-Ml';;
2790                 *) dflt="$large";;
2791                 esac
2792         rp="What flag indicates large model?"
2793         . ./myread
2794         tans="$ans"
2795         case "$tans" in
2796         none) tans='';
2797         esac
2798         large="$tans";;
2799         *) large='';;
2800         esac
2801         case "$models" in
2802         *huge*) case "$huge" in
2803                 '') dflt='-Mh';;
2804                 *) dflt="$huge";;
2805                 esac
2806                 rp="What flag indicates huge model?"
2807                 . ./myread
2808                 tans="$ans"
2809                 case "$tans" in
2810                 none) tans='';
2811                 esac
2812                 huge="$tans";;
2813         *) huge="$large";;
2814         esac
2815         case "$models" in
2816         *medium*) case "$medium" in
2817                 '') dflt='-Mm';;
2818                 *) dflt="$medium";;
2819                 esac
2820                 rp="What flag indicates medium model?"
2821                 . ./myread
2822                 tans="$ans"
2823                 case "$tans" in
2824                 none) tans='';
2825                 esac
2826                 medium="$tans";;
2827         *) medium="$large";;
2828         esac
2829         case "$models" in
2830         *small*) case "$small" in
2831                 '') dflt='none';;
2832                 *) dflt="$small";;
2833                 esac
2834                 rp="What flag indicates small model?"
2835                 . ./myread
2836                 tans="$ans"
2837                 case "$tans" in
2838                 none) tans='';
2839                 esac
2840                 small="$tans";;
2841         *) small='';;
2842         esac
2843         ;;
2844 *)
2845         echo "Unrecognized memory models--you may have to edit Makefile.SH" >&4
2846         ;;
2847 esac
2848 $rm -f pdp11.* pdp11
2849
2850 : make some quick guesses about what we are up against
2851 echo " "
2852 $echo $n "Hmm...  $c"
2853 echo exit 1 >bsd
2854 echo exit 1 >usg
2855 echo exit 1 >v7
2856 echo exit 1 >osf1
2857 echo exit 1 >eunice
2858 echo exit 1 >xenix
2859 echo exit 1 >venix
2860 echo exit 1 >os2
2861 d_bsd="$undef"
2862 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
2863 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
2864 then
2865         echo "Looks kind of like an OSF/1 system, but we'll see..."
2866         echo exit 0 >osf1
2867 elif test `echo abc | tr a-z A-Z` = Abc ; then
2868         xxx=`./loc addbib blurfl $pth`
2869         if $test -f $xxx; then
2870         echo "Looks kind of like a USG system with BSD features, but we'll see..."
2871                 echo exit 0 >bsd
2872                 echo exit 0 >usg
2873         else
2874                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
2875                         echo "Looks kind of like an extended USG system, but we'll see..."
2876                 else
2877                         echo "Looks kind of like a USG system, but we'll see..."
2878                 fi
2879                 echo exit 0 >usg
2880         fi
2881 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
2882         echo "Looks kind of like a BSD system, but we'll see..."
2883         d_bsd="$define"
2884         echo exit 0 >bsd
2885 else
2886         echo "Looks kind of like a Version 7 system, but we'll see..."
2887         echo exit 0 >v7
2888 fi
2889 case "$eunicefix" in
2890 *unixtovms*)
2891         $cat <<'EOI'
2892 There is, however, a strange, musty smell in the air that reminds me of
2893 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
2894 EOI
2895         echo exit 0 >eunice
2896         d_eunice="$define"
2897 : it so happens the Eunice I know will not run shell scripts in Unix format
2898         ;;
2899 *)
2900         echo " "
2901         echo "Congratulations.  You aren't running Eunice."
2902         d_eunice="$undef"
2903         ;;
2904 esac
2905 : Detect OS2.  The p_ variable is set above in the Head.U unit.
2906 case "$p_" in
2907 :) ;;
2908 *)
2909         $cat <<'EOI'
2910 I have the feeling something is not exactly right, however...don't tell me...
2911 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
2912 EOI
2913         echo exit 0 >os2
2914         ;;
2915 esac
2916 if test -f /xenix; then
2917         echo "Actually, this looks more like a XENIX system..."
2918         echo exit 0 >xenix
2919         d_xenix="$define"
2920 else
2921         echo " "
2922         echo "It's not Xenix..."
2923         d_xenix="$undef"
2924 fi
2925 chmod +x xenix
2926 $eunicefix xenix
2927 if test -f /venix; then
2928         echo "Actually, this looks more like a VENIX system..."
2929         echo exit 0 >venix
2930 else
2931         echo " "
2932         if ./xenix; then
2933                 : null
2934         else
2935                 echo "Nor is it Venix..."
2936         fi
2937 fi
2938 chmod +x bsd usg v7 osf1 eunice xenix venix os2
2939 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
2940 $rm -f foo
2941
2942 : see if we need a special compiler
2943 echo " "
2944 if ./usg; then
2945         case "$cc" in
2946         '') case "$Mcc" in
2947                 /*) dflt='Mcc';;
2948                 *) case "$large" in
2949                         -M*) dflt='cc';;
2950                         *)      if $contains '\-M' $sysman/cc.1 >/dev/null 2>&1 ; then
2951                                         if $contains '\-M' $sysman/cpp.1 >/dev/null 2>&1; then
2952                                                 dflt='cc'
2953                                         else
2954                                                 dflt='cc -M'
2955                                         fi
2956                                 else
2957                                         dflt='cc'
2958                                 fi;;
2959                         esac;;
2960                 esac;;
2961         *)  dflt="$cc";;
2962         esac
2963         case "$dflt" in
2964         *M*)    $cat <<'EOM'
2965 On some older systems the default C compiler will not resolve multiple global
2966 references that happen to have the same name.  On some such systems the "Mcc"
2967 command may be used to force these to be resolved.  On other systems a "cc -M"
2968 command is required.  (Note that the -M flag on other systems indicates a
2969 memory model to use!) If you have the Gnu C compiler, you might wish to use
2970 that instead.
2971
2972 EOM
2973         ;;
2974         esac
2975         rp="Use which C compiler?"
2976         . ./myread
2977         cc="$ans"
2978 else
2979         case "$cc" in
2980         '') dflt=cc;;
2981         *) dflt="$cc";;
2982         esac
2983         rp="Use which C compiler?"
2984         . ./myread
2985         cc="$ans"
2986 fi
2987 : Look for a hint-file generated 'call-back-unit'.  Now that the
2988 : user has specified the compiler, we may need to set or change some
2989 : other defaults.
2990 if $test -f cc.cbu; then
2991     . ./cc.cbu
2992 fi
2993 echo " "
2994 echo "Checking for GNU cc in disguise and/or its version number..." >&4
2995 $cat >gccvers.c <<EOM
2996 #include <stdio.h>
2997 int main() {
2998 #ifdef __GNUC__
2999 #ifdef __VERSION__
3000         printf("%s\n", __VERSION__);
3001 #else
3002         printf("%s\n", "1");
3003 #endif
3004 #endif
3005         exit(0);
3006 }
3007 EOM
3008 if $cc -o gccvers gccvers.c; then
3009         gccversion=`./gccvers`
3010         case "$gccversion" in
3011         '') echo "You are not using GNU cc." ;;
3012         *)  echo "You are using GNU cc $gccversion." ;;
3013         esac
3014 else
3015         echo " "
3016         echo "*** WHOA THERE!!! ***" >&4
3017         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
3018         case "$knowitall" in
3019         '')
3020         echo "    You'd better start hunting for one and let me know about it." >&4
3021                 exit 1
3022                 ;;
3023         esac
3024 fi
3025 $rm -f gccvers*
3026 case "$gccversion" in
3027 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
3028 esac
3029
3030
3031 case "$usemorebits" in
3032 "$define"|true|[yY]*)
3033         use64bits="$define"
3034         uselongdouble="$define"
3035         usemorebits="$define"
3036         ;;
3037 *)      usemorebits="$undef"
3038         ;;
3039 esac
3040
3041
3042 cat <<EOM
3043
3044 Perl can be built to understand large files (files larger than 2 gigabytes)
3045 on some systems.  To do so, Configure must be run with -Duselargefiles.
3046
3047 If this doesn't make any sense to you, just accept the default.
3048 EOM
3049 case "$uselargefiles" in
3050 "$define"|true|[yY]*) dflt='y' ;;
3051 *)      dflt='n' ;;
3052 esac
3053 rp='Try to understand large files?'
3054 . ./myread
3055 case "$ans" in
3056 y|Y)    val="$define" ;;
3057 *)      val="$undef"  ;;
3058 esac
3059 set uselargefiles
3060 eval $setvar
3061 case "$uselargefiles" in
3062 "$define") use64bits="$define" ;;
3063 esac
3064
3065 cat <<EOM
3066
3067 Perl can be built to take advantage of explicit 64-bit interfaces,
3068 on some systems.  To do so, Configure must be run with -Duse64bits.
3069
3070 If this doesn't make any sense to you, just accept the default.
3071 EOM
3072 case "$use64bits" in
3073 $define|true|[yY]*)     dflt='y';;
3074 *) dflt='n';;
3075 esac
3076 rp='Try to use explicit 64-bit interfaces, if available?'
3077 . ./myread
3078 case "$ans" in
3079 y|Y) 
3080         val="$define"
3081         ;;     
3082 *)      
3083         val="$undef"
3084         ;;
3085 esac
3086 set use64bits
3087 eval $setvar
3088
3089 case "$archname64" in
3090 '') archname64='' ;;    # not a typo
3091 esac
3092
3093 case "$use64bits" in
3094 "$define"|true|[yY]*)
3095 : Look for a hint-file generated 'call-back-unit'.  If the
3096 : user has specified that a 64 bit perl is to be built,
3097 : we may need to set or change some other defaults.
3098         if $test -f use64bits.cbu; then
3099                 echo "Your platform has some specific hints for 64-bit builds, using them..."
3100                 . ./use64bits.cbu
3101         else
3102                 $cat <<EOM
3103 (Your platform doesn't have any specific hints for 64-bit builds.
3104  This is probably okay, especially if your system is a true 64-bit system.)
3105 EOM
3106                 case "$gccversion" in
3107                 '')     ;;
3108                 *)      $cat <<EOM
3109 But since you seem to be using gcc,
3110 I will now add -DUSE_LONG_LONG to the compilation flags.
3111 EOM
3112                         ccflags="$ccflags -DUSE_LONG_LONG"
3113                         ;;
3114                 esac
3115         fi
3116         ;;
3117 esac
3118
3119 : determine the architecture name
3120 echo " "
3121 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
3122         tarch=`arch`"-$osname"
3123 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
3124         if uname -m > tmparch 2>&1 ; then
3125                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
3126                         -e 's/$/'"-$osname/" tmparch`
3127         else
3128                 tarch="$osname"
3129         fi
3130         $rm -f tmparch
3131 else
3132         tarch="$osname"
3133 fi
3134 case "$myarchname" in
3135 ''|"$tarch") ;;
3136 *)
3137         echo "(Your architecture name used to be $myarchname.)"
3138         archname=''
3139         ;;
3140 esac
3141 myarchname="$tarch"
3142 case "$archname" in
3143 '') dflt="$tarch";;
3144 *) dflt="$archname";;
3145 esac
3146 rp='What is your architecture name'
3147 . ./myread
3148 archname="$ans"
3149 case "$usethreads" in
3150 $define)
3151         echo "Threads selected." >&4
3152         case "$archname" in
3153         *-thread*) echo "...and architecture name already has -thread." >&4
3154                 ;;
3155         *)      archname="$archname-thread"
3156                 echo "...setting architecture name to $archname." >&4
3157                 ;;
3158         esac
3159         ;;
3160 esac
3161 case "$usemultiplicity" in
3162 $define)
3163         echo "Multiplicity selected." >&4
3164         case "$archname" in
3165         *-multi*) echo "...and architecture name already has -multi." >&4
3166                 ;;
3167         *)      archname="$archname-multi"
3168                 echo "...setting architecture name to $archname." >&4
3169                 ;;
3170         esac
3171         ;;
3172 esac
3173 case "$use64bits" in
3174 $define)
3175         echo "Explicit 64-bitness selected." >&4
3176         case "$archname64" in
3177         '')
3178                 ;;
3179         *)
3180                 case "$archname" in
3181                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
3182                         ;;
3183                 *)      archname="$archname-$archname64"
3184                         echo "...setting architecture name to $archname." >&4
3185                         ;;
3186                 esac
3187                 ;;
3188         esac
3189 esac
3190
3191 : decide how portable to be.  Allow command line overrides.
3192 case "$d_portable" in
3193 "$undef") ;;
3194 *)      d_portable="$define" ;;
3195 esac
3196
3197 : set up shell script to do ~ expansion
3198 cat >filexp <<EOSS
3199 $startsh
3200 : expand filename
3201 case "\$1" in
3202  ~/*|~)
3203         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3204         ;;
3205  ~*)
3206         if $test -f /bin/csh; then
3207                 /bin/csh -f -c "glob \$1"
3208                 failed=\$?
3209                 echo ""
3210                 exit \$failed
3211         else
3212                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3213                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3214                 if $test ! -d "\$dir"; then
3215                         me=\`basename \$0\`
3216                         echo "\$me: can't locate home directory for: \$name" >&2
3217                         exit 1
3218                 fi
3219                 case "\$1" in
3220                 */*)
3221                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3222                         ;;
3223                 *)
3224                         echo \$dir
3225                         ;;
3226                 esac
3227         fi
3228         ;;
3229 *)
3230         echo \$1
3231         ;;
3232 esac
3233 EOSS
3234 chmod +x filexp
3235 $eunicefix filexp
3236
3237 : now set up to get a file name
3238 cat <<EOS >getfile
3239 $startsh
3240 EOS
3241 cat <<'EOSC' >>getfile
3242 tilde=''
3243 fullpath=''
3244 already=''
3245 skip=''
3246 none_ok=''
3247 exp_file=''
3248 nopath_ok=''
3249 orig_rp="$rp"
3250 orig_dflt="$dflt"
3251 case "$gfpth" in
3252 '') gfpth='.' ;;
3253 esac
3254
3255 case "$fn" in
3256 *\(*)
3257         expr $fn : '.*(\(.*\)).*' | tr ',' $trnl >getfile.ok
3258         fn=`echo $fn | sed 's/(.*)//'`
3259         ;;
3260 esac
3261
3262 case "$fn" in
3263 *:*)
3264         loc_file=`expr $fn : '.*:\(.*\)'`
3265         fn=`expr $fn : '\(.*\):.*'`
3266         ;;
3267 esac
3268
3269 case "$fn" in
3270 *~*) tilde=true;;
3271 esac
3272 case "$fn" in
3273 */*) fullpath=true;;
3274 esac
3275 case "$fn" in
3276 *+*) skip=true;;
3277 esac
3278 case "$fn" in
3279 *n*) none_ok=true;;
3280 esac
3281 case "$fn" in
3282 *e*) exp_file=true;;
3283 esac
3284 case "$fn" in
3285 *p*) nopath_ok=true;;
3286 esac
3287
3288 case "$fn" in
3289 *f*) type='File';;
3290 *d*) type='Directory';;
3291 *l*) type='Locate';;
3292 esac
3293
3294 what="$type"
3295 case "$what" in
3296 Locate) what='File';;
3297 esac
3298
3299 case "$exp_file" in
3300 '')
3301         case "$d_portable" in
3302         "$define") ;;
3303         *) exp_file=true;;
3304         esac
3305         ;;
3306 esac
3307
3308 cd ..
3309 while test "$type"; do
3310         redo=''
3311         rp="$orig_rp"
3312         dflt="$orig_dflt"
3313         case "$tilde" in
3314         true) rp="$rp (~name ok)";;
3315         esac
3316         . UU/myread
3317         if test -f UU/getfile.ok && \
3318                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3319         then
3320                 value="$ans"
3321                 ansexp="$ans"
3322                 break
3323         fi
3324         case "$ans" in
3325         none)
3326                 value=''
3327                 ansexp=''
3328                 case "$none_ok" in
3329                 true) type='';;
3330                 esac
3331                 ;;
3332         *)
3333                 case "$tilde" in
3334                 '') value="$ans"
3335                         ansexp="$ans";;
3336                 *)
3337                         value=`UU/filexp $ans`
3338                         case $? in
3339                         0)
3340                                 if test "$ans" != "$value"; then
3341                                         echo "(That expands to $value on this system.)"
3342                                 fi
3343                                 ;;
3344                         *) value="$ans";;
3345                         esac
3346                         ansexp="$value"
3347                         case "$exp_file" in
3348                         '') value="$ans";;
3349                         esac
3350                         ;;
3351                 esac
3352                 case "$fullpath" in
3353                 true)
3354                         case "$ansexp" in
3355                         /*) value="$ansexp" ;;
3356                         *)
3357                                 redo=true
3358                                 case "$already" in
3359                                 true)
3360                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
3361                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
3362                                         ;;
3363                                 *)
3364                                 echo "Please give a full path name, starting with slash." >&4
3365                                         case "$tilde" in
3366                                         true)
3367                                 echo "Note that using ~name is ok provided it expands well." >&4
3368                                                 already=true
3369                                                 ;;
3370                                         esac
3371                                 esac
3372                                 ;;
3373                         esac
3374                         ;;
3375                 esac
3376                 case "$redo" in
3377                 '')
3378                         case "$type" in
3379                         File)
3380                                 for fp in $gfpth; do
3381                                         if test "X$fp" = X.; then
3382                                             pf="$ansexp"
3383                                         else    
3384                                             pf="$fp/$ansexp"
3385                                         fi
3386                                         if test -f "$pf"; then
3387                                                 type=''
3388                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3389                                         then
3390                                                 echo "($value is not a plain file, but that's ok.)"
3391                                                 type=''
3392                                         fi
3393                                         if test X"$type" = X; then
3394                                             value="$pf"
3395                                             break
3396                                         fi
3397                                 done
3398                                 ;;
3399                         Directory)
3400                                 for fp in $gfpth; do
3401                                         if test "X$fp" = X.; then
3402                                             pf="$ansexp"
3403                                         else    
3404                                             pf="$fp/$ansexp"
3405                                         fi
3406                                         if test -d "$pf"; then
3407                                                 type=''
3408                                                 value="$pf"
3409                                                 break
3410                                         fi
3411                                 done
3412                                 ;;
3413                         Locate)
3414                                 if test -d "$ansexp"; then
3415                                         echo "(Looking for $loc_file in directory $value.)"
3416                                         value="$value/$loc_file"
3417                                         ansexp="$ansexp/$loc_file"
3418                                 fi
3419                                 if test -f "$ansexp"; then
3420                                         type=''
3421                                 fi
3422                                 case "$nopath_ok" in
3423                                 true)   case "$value" in
3424                                         */*) ;;
3425                                         *)      echo "Assuming $value will be in people's path."
3426                                                 type=''
3427                                                 ;;
3428                                         esac
3429                                         ;;
3430                                 esac
3431                                 ;;
3432                         esac
3433
3434                         case "$skip" in
3435                         true) type='';
3436                         esac
3437
3438                         case "$type" in
3439                         '') ;;
3440                         *)
3441                                 if test "$fastread" = yes; then
3442                                         dflt=y
3443                                 else
3444                                         dflt=n
3445                                 fi
3446                                 rp="$what $value doesn't exist.  Use that name anyway?"
3447                                 . UU/myread
3448                                 dflt=''
3449                                 case "$ans" in
3450                                 y*) type='';;
3451                                 *) echo " ";;
3452                                 esac
3453                                 ;;
3454                         esac
3455                         ;;
3456                 esac
3457                 ;;
3458         esac
3459 done
3460 cd UU
3461 ans="$value"
3462 rp="$orig_rp"
3463 dflt="$orig_dflt"
3464 rm -f getfile.ok
3465 test "X$gfpthkeep" != Xy && gfpth=""
3466 EOSC
3467
3468 : determine root of directory hierarchy where package will be installed.
3469 case "$prefix" in
3470 '')
3471         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
3472         ;;
3473 *)
3474         dflt="$prefix"
3475         ;;
3476 esac
3477 $cat <<EOM
3478
3479 By default, $package will be installed in $dflt/bin, manual pages
3480 under $dflt/man, etc..., i.e. with $dflt as prefix for all
3481 installation directories. Typically this is something like /usr/local.
3482 If you wish to have binaries under /usr/bin but other parts of the
3483 installation under /usr/local, that's ok: you will be prompted
3484 separately for each of the installation directories, the prefix being
3485 only used to set the defaults.
3486
3487 EOM
3488 fn=d~
3489 rp='Installation prefix to use?'
3490 . ./getfile
3491 oldprefix=''
3492 case "$prefix" in
3493 '') ;;
3494 *)
3495         case "$ans" in
3496         "$prefix") ;;
3497         *) oldprefix="$prefix";;
3498         esac
3499         ;;
3500 esac
3501 prefix="$ans"
3502 prefixexp="$ansexp"
3503
3504 : is AFS running?
3505 echo " "
3506 case "$afs" in
3507 $define|true)   afs=true ;;
3508 $undef|false)   afs=false ;;
3509 *)      if test -d /afs; then
3510                 afs=true
3511         else
3512                 afs=false
3513         fi
3514         ;;
3515 esac
3516 if $afs; then
3517         echo "AFS may be running... I'll be extra cautious then..." >&4
3518 else
3519         echo "AFS does not seem to be running..." >&4
3520 fi
3521
3522 : determine installation prefix for where package is to be installed.
3523 if $afs; then 
3524 $cat <<EOM
3525
3526 Since you are running AFS, I need to distinguish the directory in which
3527 files will reside from the directory in which they are installed (and from
3528 which they are presumably copied to the former directory by occult means).
3529
3530 EOM
3531         case "$installprefix" in
3532         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
3533         *) dflt="$installprefix";;
3534         esac
3535 else
3536 $cat <<EOM
3537
3538 In some special cases, particularly when building $package for distribution,
3539 it is convenient to distinguish between the directory in which files should 
3540 be installed from the directory ($prefix) in which they 
3541 will eventually reside.  For most users, these two directories are the same.
3542
3543 EOM
3544         case "$installprefix" in
3545         '') dflt=$prefix ;;
3546         *) dflt=$installprefix;;
3547         esac
3548 fi
3549 fn=d~
3550 rp='What installation prefix should I use for installing files?'
3551 . ./getfile
3552 installprefix="$ans"
3553 installprefixexp="$ansexp"
3554
3555 : set the prefixit variable, to compute a suitable default value
3556 prefixit='case "$3" in
3557 ""|none)
3558         case "$oldprefix" in
3559         "") eval "$1=\"\$$2\"";;
3560         *)
3561                 case "$3" in
3562                 "") eval "$1=";;
3563                 none)
3564                         eval "tp=\"\$$2\"";
3565                         case "$tp" in
3566                         ""|" ") eval "$1=\"\$$2\"";;
3567                         *) eval "$1=";;
3568                         esac;;
3569                 esac;;
3570         esac;;
3571 *)
3572         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
3573         case "$tp" in
3574         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
3575         /*-$oldprefix/*|\~*-$oldprefix/*)
3576                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
3577         *) eval "$1=\"\$$2\"";;
3578         esac;;
3579 esac'
3580
3581 : set the base revision
3582 baserev=5.0
3583
3584 : get the patchlevel
3585 echo " "
3586 echo "Getting the current patchlevel..." >&4
3587 if $test -r $rsrc/patchlevel.h;then
3588         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
3589         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
3590         apiversion=`awk '/define[       ]+PERL_APIVERSION/ {print $3}' $rsrc/patchlevel.h`
3591 else
3592         patchlevel=0
3593         subversion=0
3594         apiversion=0
3595 fi
3596 $echo $n "(You have $package" $c
3597 case "$package" in
3598 "*$baserev")    ;;
3599 *)              $echo $n " $baserev" $c ;;
3600 esac
3601 $echo $n " patchlevel $patchlevel" $c
3602 test 0 -eq "$subversion" || $echo $n " subversion $subversion" $c
3603 echo ".)"
3604
3605 if test 0 -eq "$subversion"; then
3606         version=`LC_ALL=C; export LC_ALL; \
3607                  echo $baserev $patchlevel | \
3608                  $awk '{ printf "%.3f\n", $1 + $2/1000.0 }'`
3609 else
3610         version=`LC_ALL=C; export LC_ALL; \
3611                  echo $baserev $patchlevel $subversion | \
3612                  $awk '{ printf "%.5f\n", $1 + $2/1000.0 + $3/100000.0 }'`
3613 fi
3614
3615 : determine installation style
3616 : For now, try to deduce it from prefix unless it is already set.
3617 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
3618 case "$installstyle" in
3619 '')     case "$prefix" in
3620                 *perl*) dflt='lib';;
3621                 *) dflt='lib/perl5' ;;
3622         esac
3623         ;;
3624 *)      dflt='lib/perl5' ;;
3625 esac
3626 : Probably not worth prompting for this since we prompt for all
3627 : the directories individually, and the prompt would be too long and
3628 : confusing anyway.
3629 installstyle=$dflt
3630
3631 : determine where private library files go
3632 : Usual default is /usr/local/lib/perl5/$version.
3633 : Also allow things like /opt/perl/lib/$version, since 
3634 : /opt/perl/lib/perl5... would be redundant.
3635 : The default "style" setting is made in installstyle.U
3636 case "$installstyle" in
3637 *lib/perl5*) set dflt privlib lib/$package/$version ;;
3638 *)       set dflt privlib lib/$version ;;
3639 esac
3640 eval $prefixit
3641 $cat <<EOM
3642
3643 There are some auxiliary files for $package that need to be put into a
3644 private library directory that is accessible by everyone.
3645
3646 EOM
3647 fn=d~+
3648 rp='Pathname where the private library files will reside?'
3649 . ./getfile
3650 privlib="$ans"
3651 privlibexp="$ansexp"
3652 : Change installation prefix, if necessary.
3653 if $test X"$prefix" != X"$installprefix"; then
3654         installprivlib=`echo $privlibexp | sed "s#^$prefix#$installprefix#"`
3655 else
3656         installprivlib="$privlibexp"
3657 fi
3658
3659 : set the prefixup variable, to restore leading tilda escape
3660 prefixup='case "$prefixexp" in
3661 "$prefix") ;;
3662 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
3663 esac'
3664
3665 : determine where public architecture dependent libraries go
3666 set archlib archlib
3667 eval $prefixit
3668 : privlib default is /usr/local/lib/$package/$version
3669 : archlib default is /usr/local/lib/$package/$version/$archname
3670 : privlib may have an optional trailing /share.
3671 tdflt=`echo $privlib | $sed 's,/share$,,'`
3672 tdflt=$tdflt/$archname
3673 case "$archlib" in
3674 '')     dflt=$tdflt
3675         ;;
3676 *)      dflt="$archlib"
3677     ;;
3678 esac
3679 $cat <<EOM
3680
3681 $spackage contains architecture-dependent library files.  If you are
3682 sharing libraries in a heterogeneous environment, you might store
3683 these files in a separate location.  Otherwise, you can just include
3684 them with the rest of the public library files.
3685
3686 EOM
3687 fn=d+~
3688 rp='Where do you want to put the public architecture-dependent libraries?'
3689 . ./getfile
3690 archlib="$ans"
3691 archlibexp="$ansexp"
3692 if $test X"$archlib" = X"$privlib"; then
3693         d_archlib="$undef"
3694 else
3695         d_archlib="$define"
3696 fi
3697 : Change installation prefix, if necessary.
3698 if $test X"$prefix" != X"$installprefix"; then
3699         installarchlib=`echo $archlibexp | sed "s#^$prefix#$installprefix#"`
3700 else
3701         installarchlib="$archlibexp"
3702 fi
3703
3704
3705 : Binary compatibility with 5.005 is not possible for builds
3706 : with advanced features
3707 case "$usethreads$usemultiplicity" in
3708 *define*)
3709         bincompat5005="$undef"
3710         d_bincompat5005="$undef"
3711         ;;
3712 *)      $cat <<EOM
3713
3714 Perl 5.006 can be compiled for binary compatibility with 5.005.
3715 If you decide to do so, you will be able to continue using most
3716 of the extensions that were compiled for Perl 5.005.
3717
3718 EOM
3719         case "$bincompat5005$d_bincompat5005" in
3720         *"$undef"*) dflt=n ;;
3721         *) dflt=y ;;
3722         esac
3723         rp='Binary compatibility with Perl 5.005?'
3724         . ./myread
3725         case "$ans" in
3726         y*) val="$define" ;;
3727         *)  val="$undef" ;;
3728         esac
3729         set d_bincompat5005
3730         eval $setvar
3731         case "$d_bincompat5005" in
3732         "$define")
3733                 bincompat5005="$define"
3734                 ;;
3735         *)      bincompat5005="$undef"
3736                 d_bincompat5005="$undef"
3737                 ;;
3738         esac
3739         ;;
3740 esac
3741
3742
3743 : see if setuid scripts can be secure
3744 $cat <<EOM
3745
3746 Some kernels have a bug that prevents setuid #! scripts from being
3747 secure.  Some sites have disabled setuid #! scripts because of this.
3748
3749 First let's decide if your kernel supports secure setuid #! scripts.
3750 (If setuid #! scripts would be secure but have been disabled anyway,
3751 don't say that they are secure if asked.)
3752
3753 EOM
3754
3755 val="$undef"
3756 if $test -d /dev/fd; then
3757         echo "#!$ls" >reflect
3758         chmod +x,u+s reflect
3759         ./reflect >flect 2>&1
3760         if $contains "/dev/fd" flect >/dev/null; then
3761                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
3762                 val="$define"
3763         else
3764                 $cat <<EOM
3765 If you are not sure if they are secure, I can check but I'll need a
3766 username and password different from the one you are using right now.
3767 If you don't have such a username or don't want me to test, simply
3768 enter 'none'.
3769
3770 EOM
3771                 rp='Other username to test security of setuid scripts with?'
3772                 dflt='none'
3773                 . ./myread
3774                 case "$ans" in
3775                 n|none)
3776                         case "$d_suidsafe" in
3777                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
3778                                 dflt=n;;
3779                         "$undef")
3780                                 echo "Well, the $hint value is *not* secure." >&4
3781                                 dflt=n;;
3782                         *)      echo "Well, the $hint value *is* secure." >&4
3783                                 dflt=y;;
3784                         esac
3785                         ;;
3786                 *)
3787                         $rm -f reflect flect
3788                         echo "#!$ls" >reflect
3789                         chmod +x,u+s reflect
3790                         echo >flect
3791                         chmod a+w flect
3792                         echo '"su" will (probably) prompt you for '"$ans's password."
3793                         su $ans -c './reflect >flect'
3794                         if $contains "/dev/fd" flect >/dev/null; then
3795                                 echo "Okay, it looks like setuid scripts are secure." >&4
3796                                 dflt=y
3797                         else
3798                                 echo "I don't think setuid scripts are secure." >&4
3799                                 dflt=n
3800                         fi
3801                         ;;
3802                 esac
3803                 rp='Does your kernel have *secure* setuid scripts?'
3804                 . ./myread
3805                 case "$ans" in
3806                 [yY]*)  val="$define";;
3807                 *)      val="$undef";;
3808                 esac
3809         fi
3810 else
3811         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
3812         echo "(That's for file descriptors, not floppy disks.)"
3813         val="$undef"
3814 fi
3815 set d_suidsafe
3816 eval $setvar
3817
3818 $rm -f reflect flect
3819
3820 : now see if they want to do setuid emulation
3821 echo " "
3822 val="$undef"
3823 case "$d_suidsafe" in
3824 "$define")
3825         val="$undef"
3826         echo "No need to emulate SUID scripts since they are secure here." >& 4
3827         ;;
3828 *)
3829         $cat <<EOM
3830 Some systems have disabled setuid scripts, especially systems where
3831 setuid scripts cannot be secure.  On systems where setuid scripts have
3832 been disabled, the setuid/setgid bits on scripts are currently
3833 useless.  It is possible for $package to detect those bits and emulate
3834 setuid/setgid in a secure fashion.  This emulation will only work if
3835 setuid scripts have been disabled in your kernel.
3836
3837 EOM
3838         case "$d_dosuid" in
3839         "$define") dflt=y ;;
3840         *) dflt=n ;;
3841         esac
3842         rp="Do you want to do setuid/setgid emulation?"
3843         . ./myread
3844         case "$ans" in
3845         [yY]*)  val="$define";;
3846         *)      val="$undef";;
3847         esac
3848         ;;
3849 esac
3850 set d_dosuid
3851 eval $setvar
3852
3853 : What should the include directory be ?
3854 echo " "
3855 $echo $n "Hmm...  $c"
3856 dflt='/usr/include'
3857 incpath=''
3858 mips_type=''
3859 if $test -f /bin/mips && /bin/mips; then
3860         echo "Looks like a MIPS system..."
3861         $cat >usr.c <<'EOCP'
3862 #ifdef SYSTYPE_BSD43
3863 /bsd43
3864 #endif
3865 EOCP
3866         if $cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
3867                 dflt='/bsd43/usr/include'
3868                 incpath='/bsd43'
3869                 mips_type='BSD 4.3'
3870         else
3871                 mips_type='System V'
3872         fi
3873         $rm -f usr.c usr.out
3874         echo "and you're compiling with the $mips_type compiler and libraries."
3875         xxx_prompt=y
3876         echo "exit 0" >mips
3877 else
3878         echo "Doesn't look like a MIPS system."
3879         xxx_prompt=n
3880         echo "exit 1" >mips
3881 fi
3882 chmod +x mips
3883 $eunicefix mips
3884 case "$usrinc" in
3885 '') ;;
3886 *) dflt="$usrinc";;
3887 esac
3888 case "$xxx_prompt" in
3889 y)      fn=d/
3890         echo " "
3891         rp='Where are the include files you want to use?'
3892         . ./getfile
3893         usrinc="$ans"
3894         ;;
3895 *)      usrinc="$dflt"
3896         ;;
3897 esac
3898
3899 : see how we invoke the C preprocessor
3900 echo " "
3901 echo "Now, how can we feed standard input to your C preprocessor..." >&4
3902 cat <<'EOT' >testcpp.c
3903 #define ABC abc
3904 #define XYZ xyz
3905 ABC.XYZ
3906 EOT
3907 cd ..
3908 if test ! -f cppstdin; then
3909         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
3910                 # AIX cc -E doesn't show the absolute headerfile
3911                 # locations but we'll cheat by using the -M flag.
3912                 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
3913         else
3914                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
3915         fi
3916 else
3917         echo "Keeping your $hint cppstdin wrapper."
3918 fi
3919 chmod 755 cppstdin
3920 wrapper=`pwd`/cppstdin
3921 ok='false'
3922 cd UU
3923
3924 if $test "X$cppstdin" != "X" && \
3925         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
3926         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3927 then
3928         echo "You used to use $cppstdin $cppminus so we'll use that again."
3929         case "$cpprun" in
3930         '') echo "But let's see if we can live without a wrapper..." ;;
3931         *)
3932                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
3933                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3934                 then
3935                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
3936                         ok='true'
3937                 else
3938                         echo "(However, $cpprun $cpplast does not work, let's see...)"
3939                 fi
3940                 ;;
3941         esac
3942 else
3943         case "$cppstdin" in
3944         '') ;;
3945         *)
3946                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
3947                 ;;
3948         esac
3949 fi
3950
3951 if $ok; then
3952         : nothing
3953 elif echo 'Maybe "'"$cc"' -E" will work...'; \
3954         $cc -E <testcpp.c >testcpp.out 2>&1; \
3955         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3956         echo "Yup, it does."
3957         x_cpp="$cc -E"
3958         x_minus='';
3959 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
3960         $cc -E - <testcpp.c >testcpp.out 2>&1; \
3961         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3962         echo "Yup, it does."
3963         x_cpp="$cc -E"
3964         x_minus='-';
3965 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
3966         $cc -P <testcpp.c >testcpp.out 2>&1; \
3967         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3968         echo "Yipee, that works!"
3969         x_cpp="$cc -P"
3970         x_minus='';
3971 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
3972         $cc -P - <testcpp.c >testcpp.out 2>&1; \
3973         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3974         echo "At long last!"
3975         x_cpp="$cc -P"
3976         x_minus='-';
3977 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
3978         $cpp <testcpp.c >testcpp.out 2>&1; \
3979         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3980         echo "It works!"
3981         x_cpp="$cpp"
3982         x_minus='';
3983 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
3984         $cpp - <testcpp.c >testcpp.out 2>&1; \
3985         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3986         echo "Hooray, it works!  I was beginning to wonder."
3987         x_cpp="$cpp"
3988         x_minus='-';
3989 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
3990         $wrapper <testcpp.c >testcpp.out 2>&1; \
3991         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3992         x_cpp="$wrapper"
3993         x_minus=''
3994         echo "Eureka!"
3995 else
3996         dflt=''
3997         rp="No dice.  I can't find a C preprocessor.  Name one:"
3998         . ./myread
3999         x_cpp="$ans"
4000         x_minus=''
4001         $x_cpp <testcpp.c >testcpp.out 2>&1
4002         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4003                 echo "OK, that will do." >&4
4004         else
4005 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
4006                 exit 1
4007         fi
4008 fi
4009
4010 case "$ok" in
4011 false)
4012         cppstdin="$x_cpp"
4013         cppminus="$x_minus"
4014         cpprun="$x_cpp"
4015         cpplast="$x_minus"
4016         set X $x_cpp
4017         shift
4018         case "$1" in
4019         "$cpp")
4020                 echo "Perhaps can we force $cc -E using a wrapper..."
4021                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4022                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4023                 then
4024                         echo "Yup, we can."
4025                         cppstdin="$wrapper"
4026                         cppminus='';
4027                 else
4028                         echo "Nope, we'll have to live without it..."
4029                 fi
4030                 ;;
4031         esac
4032         case "$cpprun" in
4033         "$wrapper")
4034                 cpprun=''
4035                 cpplast=''
4036                 ;;
4037         esac
4038         ;;
4039 esac
4040
4041 case "$cppstdin" in
4042 "$wrapper"|'cppstdin') ;;
4043 *) $rm -f $wrapper;;
4044 esac
4045 $rm -f testcpp.c testcpp.out
4046
4047 : Set private lib path
4048 case "$plibpth" in
4049 '') if ./mips; then
4050                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
4051         fi;;
4052 esac
4053 case "$libpth" in
4054 ' ') dlist='';;
4055 '') dlist="$loclibpth $plibpth $glibpth";;
4056 *) dlist="$libpth";;
4057 esac
4058
4059 : Now check and see which directories actually exist, avoiding duplicates
4060 libpth=''
4061 for xxx in $dlist
4062 do
4063     if $test -d $xxx; then
4064                 case " $libpth " in
4065                 *" $xxx "*) ;;
4066                 *) libpth="$libpth $xxx";;
4067                 esac
4068     fi
4069 done
4070 $cat <<'EOM'
4071
4072 Some systems have incompatible or broken versions of libraries.  Among
4073 the directories listed in the question below, please remove any you
4074 know not to be holding relevant libraries, and add any that are needed.
4075 Say "none" for none.
4076
4077 EOM
4078 case "$libpth" in
4079 '') dflt='none';;
4080 *)
4081         set X $libpth
4082         shift
4083         dflt=${1+"$@"}
4084         ;;
4085 esac
4086 rp="Directories to use for library searches?"
4087 . ./myread
4088 case "$ans" in
4089 none) libpth=' ';;
4090 *) libpth="$ans";;
4091 esac
4092
4093 : compute shared library extension
4094 case "$so" in
4095 '')
4096         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
4097                 dflt='sl'
4098         else
4099                 dflt='so'
4100         fi
4101         ;;
4102 *) dflt="$so";;
4103 esac
4104 $cat <<EOM
4105
4106 On some systems, shared libraries may be available.  Answer 'none' if
4107 you want to suppress searching of shared libraries for the remaining
4108 of this configuration.
4109
4110 EOM
4111 rp='What is the file extension used for shared libraries?'
4112 . ./myread
4113 so="$ans"
4114
4115 : Define several unixisms.
4116 : Hints files or command line option can be used to override them.
4117 : The convoluted testing is in case hints files set either the old
4118 : or the new name.
4119 case "$_exe" in
4120 '')     case "$exe_ext" in
4121     '') ;;
4122         *)      _exe="$exe_ext" ;;
4123         esac
4124         ;;
4125 esac
4126 case "$_a" in
4127 '')     case "$lib_ext" in
4128     '') _a='.a';;
4129         *)      _a="$lib_ext" ;;
4130         esac
4131         ;;
4132 esac
4133 case "$_o" in
4134 '') case "$obj_ext" in
4135         '')     _o='.o';;
4136         *)      _o="$obj_ext";;
4137         esac
4138         ;;
4139 esac
4140 case "$p_" in
4141 '') case "$path_sep" in
4142         '')     p_=':';;
4143         *)      p_="$path_sep";;
4144         esac
4145         ;;
4146 esac
4147 exe_ext=$_exe
4148 lib_ext=$_a
4149 obj_ext=$_o
4150 path_sep=$p_
4151
4152 : Which makefile gets called first.  This is used by make depend.
4153 case "$firstmakefile" in
4154 '') firstmakefile='makefile';;
4155 esac
4156
4157 cat <<EOM
4158
4159 Perl can be built to use the SOCKS proxy protocol library.  To do so,
4160 Configure must be run with -Dusesocks.
4161
4162 Normally you do not need this and you should answer no.
4163
4164 EOM
4165 case "$usesocks" in
4166 $define|true|[yY]*)     dflt='y';;
4167 *) dflt='n';;
4168 esac
4169 rp='Build Perl for SOCKS?'
4170 . ./myread
4171 case "$ans" in
4172 y|Y)    val="$define" ;;     
4173 *)      val="$undef" ;;
4174 esac
4175 set usesocks
4176 eval $setvar
4177
4178 : Looking for optional libraries
4179 echo " "
4180 echo "Checking for optional libraries..." >&4
4181 case "$libs" in
4182 ' '|'') dflt='';;
4183 *) dflt="$libs";;
4184 esac
4185 case "$libswanted" in
4186 '') libswanted='c_s';;
4187 esac
4188 case "$usesocks" in
4189 $define)
4190         libswanted="$libswanted socks5 socks5_sh"
4191         ;;
4192 esac
4193 for thislib in $libswanted; do
4194         
4195         if xxx=`./loc lib$thislib.$so.[0-9]'*' X $libpth`;
4196                 $test -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
4197                 echo "Found -l$thislib (shared)."
4198                 case " $dflt " in
4199                 *"-l$thislib "*);;
4200                 *) dflt="$dflt -l$thislib";;
4201                 esac
4202         elif xxx=`./loc lib$thislib.$so X $libpth` ; $test -f "$xxx"; then
4203                 echo "Found -l$thislib (shared)."
4204                 case " $dflt " in
4205                 *"-l$thislib "*);;
4206                 *) dflt="$dflt -l$thislib";;
4207                 esac
4208         elif xxx=`./loc lib$thislib$_a X $libpth`; $test -f "$xxx"; then
4209                 echo "Found -l$thislib."
4210                 case " $dflt " in
4211                 *"-l$thislib "*);;
4212                 *) dflt="$dflt -l$thislib";;
4213                 esac
4214         elif xxx=`./loc $thislib$_a X $libpth`; $test -f "$xxx"; then
4215                 echo "Found -l$thislib."
4216                 case " $dflt " in
4217                 *"-l$thislib "*);;
4218                 *) dflt="$dflt -l$thislib";;
4219                 esac
4220         elif xxx=`./loc lib${thislib}_s$_a X $libpth`; $test -f "$xxx"; then
4221                 echo "Found -l${thislib}_s."
4222                 case " $dflt " in
4223                 *"-l$thislib "*);;
4224                 *) dflt="$dflt -l${thislib}_s";;
4225                 esac
4226         elif xxx=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$xxx"; then
4227                 echo "Found -l$thislib."
4228                 case " $dflt " in
4229                 *"-l$thislib "*);;
4230                 *) dflt="$dflt -l$thislib";;
4231                 esac
4232         else
4233                 echo "No -l$thislib."
4234         fi
4235 done
4236 set X $dflt
4237 shift
4238 dflt="$*"
4239 case "$libs" in
4240 '') dflt="$dflt";;
4241 *) dflt="$libs";;
4242 esac
4243 case "$dflt" in
4244 ' '|'') dflt='none';;
4245 esac
4246
4247 $cat <<EOM
4248
4249 In order to compile $package on your machine, a number of libraries
4250 are usually needed.  Include any other special libraries here as well.
4251 Say "none" for none.  The default list is almost always right.
4252 EOM
4253
4254 echo " "
4255 rp="What libraries to use?"
4256 . ./myread
4257 case "$ans" in
4258 none) libs=' ';;
4259 *) libs="$ans";;
4260 esac
4261
4262 : determine optimization, if desired, or use for debug flag also
4263 case "$optimize" in
4264 ' '|$undef) dflt='none';;
4265 '') dflt='-O';;
4266 *) dflt="$optimize";;
4267 esac
4268 $cat <<EOH
4269
4270 By default, $package compiles with the -O flag to use the optimizer.
4271 Alternately, you might want to use the symbolic debugger, which uses
4272 the -g flag (on traditional Unix systems).  Either flag can be
4273 specified here.  To use neither flag, specify the word "none".
4274
4275 EOH
4276 rp="What optimizer/debugger flag should be used?"
4277 . ./myread
4278 optimize="$ans"
4279 case "$optimize" in
4280 'none') optimize=" ";;
4281 esac
4282
4283 dflt=''
4284 : We will not override a previous value, but we might want to
4285 : augment a hint file
4286 case "$hint" in
4287 default|recommended)
4288         case "$gccversion" in
4289         1*) dflt='-fpcc-struct-return' ;;
4290         esac
4291         case "$optimize" in
4292         *-g*) dflt="$dflt -DDEBUGGING";;
4293         esac
4294         case "$gccversion" in
4295         2*) if test -d /etc/conf/kconfig.d &&
4296                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
4297                 then
4298                         dflt="$dflt -posix"
4299                 fi
4300                 ;;
4301         esac
4302         case "$gccversion" in
4303         1*) ;;
4304         2.[0-8]*) ;;
4305         ?*)     echo " "
4306                 echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
4307                 echo 'int main(void) { return 0; }' > gcctest.c
4308                 if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
4309                         echo "Yes, it does." 2>&1
4310                         case "$ccflags" in
4311                         *strict-aliasing*) 
4312                                 echo "Leaving current flags $ccflags alone." 2>&1
4313                                 ;;
4314                         *) dflt="$dflt -fno-strict-aliasing" ;;
4315                         esac
4316                 else
4317                         echo "Nope, it doesn't, but that's ok." 2>&1
4318                 fi
4319                 ;;
4320         esac
4321         ;;
4322 esac
4323
4324 case "$mips_type" in
4325 *BSD*|'') inclwanted="$locincpth $usrinc";;
4326 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
4327 esac
4328 for thisincl in $inclwanted; do
4329         if $test -d $thisincl; then
4330                 if $test x$thisincl != x$usrinc; then
4331                         case "$dflt" in
4332                         *$thisincl*);;
4333                         *) dflt="$dflt -I$thisincl";;
4334                         esac
4335                 fi
4336         fi
4337 done
4338
4339 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
4340         xxx=true;
4341 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
4342         xxx=true;
4343 else
4344         xxx=false;
4345 fi;
4346 if $xxx; then
4347         case "$dflt" in
4348         *$2*);;
4349         *) dflt="$dflt -D$2";;
4350         esac;
4351 fi'
4352
4353 set signal.h LANGUAGE_C; eval $inctest
4354
4355 case "$usesocks" in
4356 $define)
4357         ccflags="$ccflags -DSOCKS"
4358         ;;
4359 esac
4360
4361 case "$hint" in
4362 default|recommended) dflt="$ccflags $dflt" ;;
4363 *) dflt="$ccflags";;
4364 esac
4365
4366 case "$dflt" in
4367 ''|' ') dflt=none;;
4368 esac
4369 $cat <<EOH
4370
4371 Your C compiler may want other flags.  For this question you should include
4372 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
4373 but you should NOT include libraries or ld flags like -lwhatever.  If you
4374 want $package to honor its debug switch, you should include -DDEBUGGING here.
4375 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
4376
4377 To use no flags, specify the word "none".
4378
4379 EOH
4380 set X $dflt
4381 shift
4382 dflt=${1+"$@"}
4383 rp="Any additional cc flags?"
4384 . ./myread
4385 case "$ans" in
4386 none) ccflags='';;
4387 *) ccflags="$ans";;
4388 esac
4389
4390 : the following weeds options from ccflags that are of no interest to cpp
4391 cppflags="$ccflags"
4392 case "$gccversion" in
4393 1*) cppflags="$cppflags -D__GNUC__"
4394 esac
4395 case "$mips_type" in
4396 '');;
4397 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
4398 esac
4399 case "$cppflags" in
4400 '');;
4401 *)
4402         echo " "
4403         echo "Let me guess what the preprocessor flags are..." >&4
4404         set X $cppflags
4405         shift
4406         cppflags=''
4407         $cat >cpp.c <<'EOM'
4408 #define BLURFL foo
4409
4410 BLURFL xx LFRULB
4411 EOM
4412         previous=''
4413         for flag in $*
4414         do
4415                 case "$flag" in
4416                 -*) ftry="$flag";;
4417                 *) ftry="$previous $flag";;
4418                 esac
4419                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
4420                         >cpp1.out 2>/dev/null && \
4421                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
4422                         >cpp2.out 2>/dev/null && \
4423                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
4424                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
4425                 then
4426                         cppflags="$cppflags $ftry"
4427                         previous=''
4428                 else
4429                         previous="$flag"
4430                 fi
4431         done
4432         set X $cppflags
4433         shift
4434         cppflags=${1+"$@"}
4435         case "$cppflags" in
4436         *-*)  echo "They appear to be: $cppflags";;
4437         esac
4438         $rm -f cpp.c cpp?.out
4439         ;;
4440 esac
4441
4442 : flags used in final linking phase
4443 case "$ldflags" in
4444 '') if ./venix; then
4445                 dflt='-i -z'
4446         else
4447                 dflt=''
4448         fi
4449         case "$ccflags" in
4450         *-posix*) dflt="$dflt -posix" ;;
4451         esac
4452         ;;
4453 *) dflt="$ldflags";;
4454 esac
4455
4456 : Try to guess additional flags to pick up local libraries.
4457 for thislibdir in $libpth; do
4458         case " $loclibpth " in
4459         *" $thislibdir "*)
4460                 case "$dflt " in 
4461                 *"-L$thislibdir "*) ;;
4462                 *)  dflt="$dflt -L$thislibdir" ;;
4463                 esac
4464                 ;;
4465         esac
4466 done
4467
4468 case "$dflt" in
4469 '') dflt='none' ;;
4470 esac
4471
4472 $cat <<EOH
4473
4474 Your C linker may need flags.  For this question you should
4475 include -L/whatever and any other flags used by the C linker, but you
4476 should NOT include libraries like -lwhatever.
4477
4478 Make sure you include the appropriate -L/path flags if your C linker
4479 does not normally search all of the directories you specified above,
4480 namely
4481         $libpth
4482 To use no flags, specify the word "none".
4483
4484 EOH
4485
4486 rp="Any additional ld flags (NOT including libraries)?"
4487 . ./myread
4488 case "$ans" in
4489 none) ldflags='';;
4490 *) ldflags="$ans";;
4491 esac
4492 rmlist="$rmlist pdp11"
4493
4494 : coherency check
4495 echo " "
4496 echo "Checking your choice of C compiler and flags for coherency..." >&4
4497 $cat > try.c <<'EOF'
4498 #include <stdio.h>
4499 int main() { printf("Ok\n"); exit(0); }
4500 EOF
4501 set X $cc $optimize $ccflags -o try $ldflags try.c $libs
4502 shift
4503 $cat >try.msg <<'EOM'
4504 I've tried to compile and run the following simple program:
4505
4506 EOM
4507 $cat try.c >> try.msg
4508
4509 $cat >> try.msg <<EOM
4510
4511 I used the command:
4512
4513         $*
4514         ./try
4515
4516 and I got the following output:
4517
4518 EOM
4519 dflt=y
4520 if sh -c "$cc $optimize $ccflags -o try $ldflags try.c $libs" >>try.msg 2>&1; then
4521         if sh -c './try' >>try.msg 2>&1; then
4522                 xxx=`./try`
4523                 case "$xxx" in
4524                 "Ok") dflt=n ;;
4525                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
4526                         case " $libs " in
4527                         *" -lsfio "*)
4528                                 cat >> try.msg <<'EOQS'
4529 If $libs contains -lsfio, and sfio is mis-configured, then it
4530 sometimes (apparently) runs and exits with a 0 status, but with no
4531 output!  It may have to do with sfio's use of _exit vs. exit.
4532
4533 EOQS
4534                                 rp="You have a big problem.  Shall I abort Configure"
4535                                 dflt=y
4536                                 ;;
4537                         esac
4538                         ;;
4539                 esac
4540         else
4541                 echo "The program compiled OK, but exited with status $?." >>try.msg
4542                 rp="You have a problem.  Shall I abort Configure"
4543                 dflt=y
4544         fi
4545 else
4546         echo "I can't compile the test program." >>try.msg
4547         rp="You have a BIG problem.  Shall I abort Configure"
4548         dflt=y
4549 fi
4550 case "$dflt" in
4551 y)
4552         $cat try.msg >&4
4553         case "$knowitall" in
4554         '')
4555                 echo "(The supplied flags or libraries might be incorrect.)"
4556                 ;;
4557         *) dflt=n;;
4558         esac
4559         echo " "
4560         . ./myread
4561         case "$ans" in
4562         n*|N*) ;;
4563         *)      echo "Ok.  Stopping Configure." >&4
4564                 exit 1
4565                 ;;
4566         esac
4567         ;;
4568 n) echo "OK, that should do.";;
4569 esac
4570 $rm -f try try.* core
4571
4572 : determine filename position in cpp output
4573 echo " "
4574 echo "Computing filename position in cpp output for #include directives..." >&4
4575 echo '#include <stdio.h>' > foo.c
4576 $cat >fieldn <<EOF
4577 $startsh
4578 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
4579 $grep '^[       ]*#.*stdio\.h' | \
4580 while read cline; do
4581         pos=1
4582         set \$cline
4583         while $test \$# -gt 0; do
4584                 if $test -r \`echo \$1 | $tr -d '"'\`; then
4585                         echo "\$pos"
4586                         exit 0
4587                 fi
4588                 shift
4589                 pos=\`expr \$pos + 1\`
4590         done
4591 done
4592 EOF
4593 chmod +x fieldn
4594 fieldn=`./fieldn`
4595 $rm -f foo.c fieldn
4596 case $fieldn in
4597 '') pos='???';;
4598 1) pos=first;;
4599 2) pos=second;;
4600 3) pos=third;;
4601 *) pos="${fieldn}th";;
4602 esac
4603 echo "Your cpp writes the filename in the $pos field of the line."
4604
4605 : locate header file
4606 $cat >findhdr <<EOF
4607 $startsh
4608 wanted=\$1
4609 name=''
4610 for usrincdir in $usrinc
4611 do
4612         if test -f \$usrincdir/\$wanted; then
4613                 echo "\$usrincdir/\$wanted"
4614                 exit 0
4615         fi
4616 done
4617 awkprg='{ print \$$fieldn }'
4618 echo "#include <\$wanted>" > foo\$\$.c
4619 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
4620 $grep "^[       ]*#.*\$wanted" | \
4621 while read cline; do
4622         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
4623         case "\$name" in
4624         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
4625         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
4626         *) exit 2;;
4627         esac;
4628 done;
4629 #
4630 # status = 0: grep returned 0 lines, case statement not executed
4631 # status = 1: headerfile found
4632 # status = 2: while loop executed, no headerfile found
4633 #
4634 status=\$?
4635 $rm -f foo\$\$.c;
4636 if test \$status -eq 1; then
4637         exit 0;
4638 fi
4639 exit 1
4640 EOF
4641 chmod +x findhdr
4642
4643 : define an alternate in-header-list? function
4644 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
4645 cont=true; xxf="echo \"<\$1> found.\" >&4";
4646 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
4647 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
4648 esac;
4649 case $# in 4) instead=instead;; *) instead="at last";; esac;
4650 while $test "$cont"; do
4651         xxx=`./findhdr $1`
4652         var=$2; eval "was=\$$2";
4653         if $test "$xxx" && $test -r "$xxx";
4654         then eval $xxf;
4655         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
4656                 cont="";
4657         else eval $xxnf;
4658         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
4659         set $yyy; shift; shift; yyy=$@;
4660         case $# in 0) cont="";;
4661         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
4662                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
4663         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
4664                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
4665         esac;
4666 done;
4667 while $test "$yyy";
4668 do set $yyy; var=$2; eval "was=\$$2";
4669         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
4670         set $yyy; shift; shift; yyy=$@;
4671 done'
4672
4673 : see if this is a malloc.h system
4674 set malloc.h i_malloc
4675 eval $inhdr
4676
4677 : see if stdlib is available
4678 set stdlib.h i_stdlib
4679 eval $inhdr
4680
4681 : determine which malloc to compile in
4682 echo " "
4683 case "$usemymalloc" in
4684 ''|[yY]*|true|$define)  dflt='y' ;;
4685 *)      dflt='n' ;;
4686 esac
4687 rp="Do you wish to attempt to use the malloc that comes with $package?"
4688 . ./myread
4689 usemymalloc="$ans"
4690 case "$ans" in
4691 y*|true)
4692         usemymalloc='y'
4693         mallocsrc='malloc.c'
4694         mallocobj="malloc$_o"
4695         d_mymalloc="$define"
4696         case "$libs" in
4697         *-lmalloc*)
4698                 : Remove malloc from list of libraries to use
4699                 echo "Removing unneeded -lmalloc from library list" >&4
4700                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
4701                 shift
4702                 libs="$*"
4703                 echo "libs = $libs" >&4
4704                 ;;
4705         esac
4706         ;;
4707 *)
4708         usemymalloc='n'
4709         mallocsrc=''
4710         mallocobj=''
4711         d_mymalloc="$undef"
4712         ;;
4713 esac
4714
4715 : compute the return types of malloc and free
4716 echo " "
4717 $cat >malloc.c <<END
4718 #$i_malloc I_MALLOC
4719 #$i_stdlib I_STDLIB
4720 #include <stdio.h>
4721 #include <sys/types.h>
4722 #ifdef I_MALLOC
4723 #include <malloc.h>
4724 #endif
4725 #ifdef I_STDLIB
4726 #include <stdlib.h>
4727 #endif
4728 #ifdef TRY_MALLOC
4729 void *malloc();
4730 #endif
4731 #ifdef TRY_FREE
4732 void free();
4733 #endif
4734 END
4735 case "$malloctype" in
4736 '')
4737         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
4738                 malloctype='void *'
4739         else
4740                 malloctype='char *'
4741         fi
4742         ;;
4743 esac
4744 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
4745
4746 case "$freetype" in
4747 '')
4748         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
4749                 freetype='void'
4750         else
4751                 freetype='int'
4752         fi
4753         ;;
4754 esac
4755 echo "Your system uses $freetype free(), it would seem." >&4
4756 $rm -f malloc.[co]
4757 $cat <<EOM
4758
4759 The installation process will also create a directory for
4760 vendor-supplied add-ons.  Vendors who supply perl with their system
4761 may find it convenient to place all vendor-supplied files in this
4762 directory rather than in the main distribution directory.  This will
4763 ease upgrades between binary-compatible maintenance versions of perl.
4764
4765 Of course you may also use these directories in whatever way you see
4766 fit.  For example, you might use them to access modules shared over a
4767 company-wide network.
4768
4769 The default answer should be fine for most people.
4770 This causes further questions about vendor add-ons to be skipped
4771 and no vendor-specific directories will be configured for perl.
4772
4773 EOM
4774 rp='Do you want to configure vendor-specific add-on directories?'
4775 case "$usevendorprefix" in
4776 define|true|[yY]*) dflt=y ;;
4777 *) dflt=n ;;
4778 esac
4779 . ./myread
4780 case "$ans" in
4781 [yY]*)  fn=d~+
4782         rp='Installation prefix to use for vendor-supplied add-ons?'
4783         case "$vendorprefix" in
4784         '') dflt='' ;;
4785         *)  dflt=$vendorprefix ;;
4786         esac
4787         . ./getfile
4788         oldvendorprefix=''
4789         case "$vendorprefix" in
4790         '') ;;
4791         *)      case "$ans" in
4792                 "$prefix") ;;
4793                 *) oldvendorprefix="$prefix";;
4794                 esac
4795                 ;;
4796         esac
4797         usevendorprefix="$define"
4798         vendorprefix="$ans"
4799         vendorprefixexp="$ansexp"
4800         ;;
4801 *)      usevendorprefix="$undef"
4802         vendorprefix=''
4803         vendorprefixexp=''
4804         ;;
4805 esac
4806
4807 case "$vendorprefix" in
4808 '')     d_vendorlib="$undef"
4809         vendorlib=''
4810         vendorlibexp=''
4811         ;;
4812 *)      d_vendorlib="$define"
4813         : determine where vendor-supplied modules go.
4814         : Usual default is /usr/local/lib/perl5/vendor_perl
4815         prog=`echo $package | $sed 's/-*[0-9.]*$//'`
4816         case "$installstyle" in
4817         *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog ;;
4818         *)           dflt=$vendorprefix/lib/vendor_$prog ;;
4819         esac
4820         fn=d~+
4821         rp='Pathname for the vendor-supplied library files?'
4822         . ./getfile
4823         vendorlib="$ans"
4824         vendorlibexp="$ansexp"
4825         : Change installation prefix, if necessary.
4826         if $test X"$prefix" != X"$installprefix"; then
4827                 installvendorlib=`echo $vendorlibexp | $sed "s#^$prefix#$installprefix#"`
4828         else
4829                 installvendorlib="$vendorlibexp"
4830         fi
4831         ;;
4832 esac
4833
4834 : Cruising for prototypes
4835 echo " "
4836 echo "Checking out function prototypes..." >&4
4837 $cat >prototype.c <<'EOCP'
4838 int main(int argc, char *argv[]) {
4839         exit(0);}
4840 EOCP
4841 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
4842         echo "Your C compiler appears to support function prototypes."
4843         val="$define"
4844 else
4845         echo "Your C compiler doesn't seem to understand function prototypes."
4846         val="$undef"
4847 fi
4848 set prototype
4849 eval $setvar
4850 $rm -f prototype*
4851
4852 case "$prototype" in
4853 "$define") ;;
4854 *)      ansi2knr='ansi2knr'
4855         echo " "
4856         cat <<EOM >&4
4857
4858 $me:  FATAL ERROR:
4859 This version of $package can only be compiled by a compiler that 
4860 understands function prototypes.  Unfortunately, your C compiler 
4861         $cc $ccflags
4862 doesn't seem to understand them.  Sorry about that.
4863
4864 If GNU cc is available for your system, perhaps you could try that instead.  
4865
4866 Eventually, we hope to support building Perl with pre-ANSI compilers.
4867 If you would like to help in that effort, please contact <perlbug@perl.org>.
4868
4869 Aborting Configure now.
4870 EOM
4871         exit 2
4872         ;;
4873 esac
4874
4875 : determine where public executables go
4876 echo " "
4877 set dflt bin bin
4878 eval $prefixit
4879 fn=d~
4880 rp='Pathname where the public executables will reside?'
4881 . ./getfile
4882 if $test "X$ansexp" != "X$binexp"; then
4883         installbin=''
4884 fi
4885 bin="$ans"
4886 binexp="$ansexp"
4887 : Change installation prefix, if necessary.
4888 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
4889 if $test X"$prefix" != X"$installprefix"; then
4890         installbin=`echo $binexp | sed "s#^$prefix#$installprefix#"`
4891 else
4892         installbin="$binexp"
4893 fi
4894
4895 : determine whether to install perl also as /usr/bin/perl
4896
4897 echo " "
4898 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
4899         $cat <<EOM
4900 Many scripts expect to perl to be installed as /usr/bin/perl.
4901 I can install the perl you are about to compile also as /usr/bin/perl
4902 (in addition to $installbin/perl).
4903 EOM
4904         case "$installusrbinperl" in
4905         "$undef"|[nN]*) dflt='n';;
4906         *)              dflt='y';;
4907         esac
4908         rp="Do you want to install perl as /usr/bin/perl?"
4909         . ./myread
4910         case "$ans" in
4911         [yY]*)  val="$define";;
4912         *)      val="$undef" ;;
4913         esac
4914 else
4915         val="$undef"
4916 fi
4917 set installusrbinperl
4918 eval $setvar
4919
4920 : define a shorthand compile call
4921 compile='
4922 mc_file=$1;
4923 shift;
4924 $cc $optimize $ccflags $ldflags -o ${mc_file} $* ${mc_file}.c $libs > /dev/null 2>&1;'
4925 : define a shorthand compile call for compilations that should be ok.
4926 compile_ok='
4927 mc_file=$1;
4928 shift;
4929 $cc $optimize $ccflags $ldflags -o ${mc_file} $* ${mc_file}.c $libs;'
4930
4931 echo " "
4932 echo "Checking for GNU C Library..." >&4
4933 cat >gnulibc.c <<EOM
4934 #include <stdio.h>
4935 int main()
4936 {
4937 #ifdef __GLIBC__
4938     exit(0);
4939 #else
4940     exit(1);
4941 #endif
4942 }
4943 EOM
4944 set gnulibc
4945 if eval $compile_ok && ./gnulibc; then
4946         val="$define"
4947         echo "You are using the GNU C Library"
4948 else
4949         val="$undef"
4950         echo "You are not using the GNU C Library"
4951 fi
4952 $rm -f gnulibc*
4953 set d_gnulibc
4954 eval $setvar
4955
4956 : see if nm is to be used to determine whether a symbol is defined or not
4957 case "$usenm" in
4958 '')
4959         dflt=''
4960         case "$d_gnulibc" in
4961         "$define")
4962                 echo " "
4963                 echo "nm probably won't work on the GNU C Library." >&4
4964                 dflt=n
4965                 ;;
4966         esac
4967         case "$dflt" in
4968         '') 
4969                 if $test "$osname" = aix -a ! -f /lib/syscalls.exp; then
4970                         echo " "
4971                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
4972                         echo "'nm' won't be sufficient on this sytem." >&4
4973                         dflt=n
4974                 fi
4975                 ;;
4976         esac
4977         case "$dflt" in
4978         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
4979                 if $test $dflt -gt 20; then
4980                         dflt=y
4981                 else
4982                         dflt=n
4983                 fi
4984                 ;;
4985         esac
4986         ;;
4987 *)
4988         case "$usenm" in
4989         true|$define) dflt=y;;
4990         *) dflt=n;;
4991         esac
4992         ;;
4993 esac
4994 $cat <<EOM
4995
4996 I can use $nm to extract the symbols from your C libraries. This
4997 is a time consuming task which may generate huge output on the disk (up
4998 to 3 megabytes) but that should make the symbols extraction faster. The
4999 alternative is to skip the 'nm' extraction part and to compile a small
5000 test program instead to determine whether each symbol is present. If
5001 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
5002 this may be the best solution.
5003
5004 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
5005
5006 EOM
5007 rp="Shall I use $nm to extract C symbols from the libraries?"
5008 . ./myread
5009 case "$ans" in
5010 [Nn]*) usenm=false;;
5011 *) usenm=true;;
5012 esac
5013
5014 runnm=$usenm
5015 case "$reuseval" in
5016 true) runnm=false;;
5017 esac
5018
5019 : nm options which may be necessary
5020 case "$nm_opt" in
5021 '') if $test -f /mach_boot; then
5022                 nm_opt=''       # Mach
5023         elif $test -d /usr/ccs/lib; then
5024                 nm_opt='-p'     # Solaris (and SunOS?)
5025         elif $test -f /dgux; then
5026                 nm_opt='-p'     # DG-UX
5027         elif $test -f /lib64/rld; then
5028                 nm_opt='-p'     # 64-bit Irix
5029         else
5030                 nm_opt=''
5031         fi;;
5032 esac
5033
5034 : nm options which may be necessary for shared libraries but illegal
5035 : for archive libraries.  Thank you, Linux.
5036 case "$nm_so_opt" in
5037 '')     case "$myuname" in
5038         *linux*)
5039                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
5040                         nm_so_opt='--dynamic'
5041                 fi
5042                 ;;
5043         esac
5044         ;;
5045 esac
5046
5047 case "$runnm" in
5048 true)
5049 : get list of predefined functions in a handy place
5050 echo " "
5051 case "$libc" in
5052 '') libc=unknown
5053         case "$libs" in
5054         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
5055         esac
5056         ;;
5057 esac
5058 libnames='';
5059 case "$libs" in
5060 '') ;;
5061 *)  for thislib in $libs; do
5062         case "$thislib" in
5063         -lc|-lc_s)
5064                 : Handle C library specially below.
5065                 ;;
5066         -l*)
5067                 thislib=`echo $thislib | $sed -e 's/^-l//'`
5068                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
5069                         :
5070                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
5071                         :
5072                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
5073                         :
5074                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
5075                         :
5076                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
5077                         :
5078                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
5079                         :
5080                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
5081                         :
5082                 else
5083                         try=''
5084                 fi
5085                 libnames="$libnames $try"
5086                 ;;
5087         *) libnames="$libnames $thislib" ;;
5088         esac
5089         done
5090         ;;
5091 esac
5092 xxx=normal
5093 case "$libc" in
5094 unknown)
5095         set /lib/libc.$so
5096         for xxx in $libpth; do
5097                 $test -r $1 || set $xxx/libc.$so
5098                 : The messy sed command sorts on library version numbers.
5099                 $test -r $1 || \
5100                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
5101                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
5102                                 h
5103                                 s/[0-9][0-9]*/0000&/g
5104                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
5105                                 G
5106                                 s/\n/ /' | \
5107                          sort | $sed -e 's/^.* //'`
5108                 eval set \$$#
5109         done
5110         $test -r $1 || set /usr/ccs/lib/libc.$so
5111         $test -r $1 || set /lib/libsys_s$_a
5112         ;;
5113 *)
5114         set blurfl
5115         ;;
5116 esac
5117 if $test -r "$1"; then
5118         echo "Your (shared) C library seems to be in $1."
5119         libc="$1"
5120 elif $test -r /lib/libc && $test -r /lib/clib; then
5121         echo "Your C library seems to be in both /lib/clib and /lib/libc."
5122         xxx=apollo
5123         libc='/lib/clib /lib/libc'
5124         if $test -r /lib/syslib; then
5125                 echo "(Your math library is in /lib/syslib.)"
5126                 libc="$libc /lib/syslib"
5127         fi
5128 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5129         echo "Your C library seems to be in $libc, as you said before."
5130 elif $test -r $incpath/usr/lib/libc$_a; then
5131         libc=$incpath/usr/lib/libc$_a;
5132         echo "Your C library seems to be in $libc.  That's fine."
5133 elif $test -r /lib/libc$_a; then
5134         libc=/lib/libc$_a;
5135         echo "Your C library seems to be in $libc.  You're normal."
5136 else
5137         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
5138                 :
5139         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
5140                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
5141         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
5142                 :
5143         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5144                 :
5145         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5146                 :
5147         else
5148                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
5149         fi
5150         if $test -r "$tans"; then
5151                 echo "Your C library seems to be in $tans, of all places."
5152                 libc=$tans
5153         else
5154                 libc='blurfl'
5155         fi
5156 fi
5157 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5158         dflt="$libc"
5159         cat <<EOM
5160
5161 If the guess above is wrong (which it might be if you're using a strange
5162 compiler, or your machine supports multiple models), you can override it here.
5163
5164 EOM
5165 else
5166         dflt=''
5167         echo $libpth | tr ' ' $trnl | sort | uniq > libpath
5168         cat >&4 <<EOM
5169 I can't seem to find your C library.  I've looked in the following places:
5170
5171 EOM
5172         $sed 's/^/      /' libpath
5173         cat <<EOM
5174
5175 None of these seems to contain your C library. I need to get its name...
5176
5177 EOM
5178 fi
5179 fn=f
5180 rp='Where is your C library?'
5181 . ./getfile
5182 libc="$ans"
5183
5184 echo " "
5185 echo $libc $libnames | tr ' ' $trnl | sort | uniq > libnames
5186 set X `cat libnames`
5187 shift
5188 xxx=files
5189 case $# in 1) xxx=file; esac
5190 echo "Extracting names from the following $xxx for later perusal:" >&4
5191 echo " "
5192 $sed 's/^/      /' libnames >&4
5193 echo " "
5194 $echo $n "This may take a while...$c" >&4
5195
5196 for file in $*; do
5197         case $file in
5198         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
5199         *) $nm $nm_opt $file 2>/dev/null;;
5200         esac
5201 done >libc.tmp
5202
5203 $echo $n ".$c"
5204 $grep fprintf libc.tmp > libc.ptf
5205 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
5206 xrun='eval "<libc.tmp $com >libc.list"; echo "done" >&4'
5207 xxx='[ADTSIW]'
5208 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *_[_.]*//p' -e 's/^.* $xxx  *//p'";\
5209         eval $xscan;\
5210         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5211                 eval $xrun
5212 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
5213         eval $xscan;\
5214         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5215                 eval $xrun
5216 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
5217         eval $xscan;\
5218         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5219                 eval $xrun
5220 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
5221         eval $xscan;\
5222         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5223                 eval $xrun
5224 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
5225         eval $xscan;\
5226         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5227                 eval $xrun
5228 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
5229         eval $xscan;\
5230         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5231                 eval $xrun
5232 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
5233                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
5234         eval $xscan;\
5235         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5236                 eval $xrun
5237 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
5238         eval $xscan;\
5239         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5240                 eval $xrun
5241 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
5242         eval $xscan;\
5243         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5244                 eval $xrun
5245 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
5246         eval $xscan;\
5247         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5248                 eval $xrun
5249 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
5250         eval $xscan;\
5251         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5252                 eval $xrun
5253 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
5254         eval $xscan;\
5255         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5256                 eval $xrun
5257 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
5258         eval $xscan;\
5259         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5260                 eval $xrun
5261 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
5262         eval $xscan;\
5263         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5264                 eval $xrun
5265 else
5266         $nm -p $* 2>/dev/null >libc.tmp
5267         $grep fprintf libc.tmp > libc.ptf
5268         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
5269                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
5270         then
5271                 nm_opt='-p'
5272                 eval $xrun
5273         else
5274                 echo " "
5275                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
5276                 com=''
5277                 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
5278                         for thisname in $libnames $libc; do
5279                                 $ar t $thisname >>libc.tmp
5280                         done
5281                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
5282                         echo "Ok." >&4
5283                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
5284                         # Repeat libc to extract forwarders to DLL entries too
5285                         for thisname in $libnames $libc; do
5286                                 $ar tv $thisname >>libc.tmp
5287                                 # Revision 50 of EMX has bug in $ar.
5288                                 # it will not extract forwarders to DLL entries
5289                                 # Use emximp which will extract exactly them.
5290                                 emximp -o tmp.imp $thisname \
5291                                     2>/dev/null && \
5292                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
5293                                     < tmp.imp >>libc.tmp
5294                                 $rm tmp.imp
5295                         done
5296                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
5297                         echo "Ok." >&4
5298                 else
5299                         echo "$ar didn't seem to work right." >&4
5300                         echo "Maybe this is a Cray...trying bld instead..." >&4
5301                         if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
5302                         then
5303                                 for thisname in $libnames; do
5304                                         bld t $libnames | \
5305                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
5306                                         $ar t $thisname >>libc.tmp
5307                                 done
5308                                 echo "Ok." >&4
5309                         else
5310                                 echo "That didn't work either.  Giving up." >&4
5311                                 exit 1
5312                         fi
5313                 fi
5314         fi
5315 fi
5316 nm_extract="$com"
5317 if $test -f /lib/syscalls.exp; then
5318         echo " "
5319         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
5320         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*$/\1/p' /lib/syscalls.exp >>libc.list
5321 fi
5322 ;;
5323 esac
5324 $rm -f libnames libpath
5325
5326 : see if dld is available
5327 set dld.h i_dld
5328 eval $inhdr
5329
5330 : is a C symbol defined?
5331 csym='tlook=$1;
5332 case "$3" in
5333 -v) tf=libc.tmp; tc=""; tdc="";;
5334 -a) tf=libc.tmp; tc="[0]"; tdc="[]";;
5335 *) tlook="^$1\$"; tf=libc.list; tc="()"; tdc="()";;
5336 esac;
5337 tx=yes;
5338 case "$reuseval-$4" in
5339 true-) ;;
5340 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
5341 esac;
5342 case "$tx" in
5343 yes)
5344         case "$runnm" in
5345         true)
5346                 if $contains $tlook $tf >/dev/null 2>&1;
5347                 then tval=true;
5348                 else tval=false;
5349                 fi;;
5350         *)
5351                 echo "int main() { extern short $1$tdc; printf(\"%hd\", $1$tc); }" > t.c;
5352                 if $cc $optimize $ccflags $ldflags -o t t.c $libs >/dev/null 2>&1;
5353                 then tval=true;
5354                 else tval=false;
5355                 fi;
5356                 $rm -f t t.c;;
5357         esac;;
5358 *)
5359         case "$tval" in
5360         $define) tval=true;;
5361         *) tval=false;;
5362         esac;;
5363 esac;
5364 eval "$2=$tval"'
5365
5366 : define an is-in-libc? function
5367 inlibc='echo " "; td=$define; tu=$undef;
5368 sym=$1; var=$2; eval "was=\$$2";
5369 tx=yes;
5370 case "$reuseval$was" in
5371 true) ;;
5372 true*) tx=no;;
5373 esac;
5374 case "$tx" in
5375 yes)
5376         set $sym tres -f;
5377         eval $csym;
5378         case "$tres" in
5379         true)
5380                 echo "$sym() found." >&4;
5381                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
5382         *)
5383                 echo "$sym() NOT found." >&4;
5384                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
5385         esac;;
5386 *)
5387         case "$was" in
5388         $define) echo "$sym() found." >&4;;
5389         *) echo "$sym() NOT found." >&4;;
5390         esac;;
5391 esac'
5392
5393 : see if dlopen exists
5394 xxx_runnm="$runnm"
5395 runnm=false
5396 set dlopen d_dlopen
5397 eval $inlibc
5398 runnm="$xxx_runnm"
5399
5400 : determine which dynamic loading, if any, to compile in
5401 echo " "
5402 dldir="ext/DynaLoader"
5403 case "$usedl" in
5404 $define|y|true)
5405         dflt='y'
5406         usedl="$define"
5407         ;;
5408 $undef|n|false)
5409         dflt='n'
5410         usedl="$undef"
5411         ;;
5412 *) 
5413         dflt='n'
5414         case "$d_dlopen" in
5415             $define) dflt='y' ;;
5416         esac
5417         case "$i_dld" in
5418             $define) dflt='y' ;;
5419         esac
5420         : Does a dl_xxx.xs file exist for this operating system
5421         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
5422         ;;
5423 esac
5424 rp="Do you wish to use dynamic loading?"
5425 . ./myread
5426 usedl="$ans"
5427 case "$ans" in
5428 y*) usedl="$define"
5429         case "$dlsrc" in
5430         '')
5431                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
5432                         dflt="$dldir/dl_${osname}.xs"
5433                 elif $test "$d_dlopen" = "$define" ; then
5434                         dflt="$dldir/dl_dlopen.xs"
5435                 elif $test "$i_dld" = "$define" ; then
5436                         dflt="$dldir/dl_dld.xs"
5437                 else
5438                         dflt=''
5439                 fi
5440                 ;;
5441         *)      dflt="$dldir/$dlsrc"
5442                 ;;
5443         esac
5444     echo "The following dynamic loading files are available:"
5445         : Can not go over to $dldir because getfile has path hard-coded in.
5446         tdir=`pwd`; cd $rsrc; $ls -C $dldir/dl*.xs; cd $tdir
5447         rp="Source file to use for dynamic loading"
5448         fn="fne"
5449         gfpth="$src"
5450         . ./getfile
5451         usedl="$define"
5452         : emulate basename
5453         dlsrc=`echo $ans | $sed -e 's@.*/\([^/]*\)$@\1@'`
5454
5455         $cat << EOM
5456
5457 Some systems may require passing special flags to $cc -c to
5458 compile modules that will be used to create a shared library.
5459 To use no flags, say "none".
5460
5461 EOM
5462     case "$cccdlflags" in
5463     '') case "$gccversion" in
5464                 '') case "$osname" in
5465                         hpux)   dflt='+z' ;;
5466                         next)   dflt='none' ;;
5467                         irix*)  dflt='-KPIC' ;;
5468                         svr4*|esix*|solaris) dflt='-KPIC' ;;
5469                         sunos)  dflt='-pic' ;;
5470                         *)      dflt='none' ;;
5471                     esac
5472                         ;;
5473                 *)  case "$osname" in
5474                         svr4*|esix*|solaris) dflt='-fPIC' ;;
5475                         *)      dflt='-fpic' ;;
5476                     esac ;;
5477             esac ;;
5478         ' ') dflt='none' ;;
5479     *)  dflt="$cccdlflags" ;;
5480     esac
5481     rp="Any special flags to pass to $cc -c to compile shared library modules?"
5482     . ./myread
5483     case "$ans" in
5484     none) cccdlflags=' ' ;;
5485     *) cccdlflags="$ans" ;;
5486     esac
5487
5488     cat << EOM
5489
5490 Some systems use ld to create libraries that can be dynamically loaded,
5491 while other systems (such as those using ELF) use $cc.
5492
5493 EOM
5494         case "$ld" in
5495         '')     $cat >try.c <<'EOM'
5496 /* Test for whether ELF binaries are produced */
5497 #include <fcntl.h>
5498 #include <stdlib.h>
5499 int main() {
5500         char b[4];
5501         int i = open("a.out",O_RDONLY);
5502         if(i == -1) 
5503                 exit(1); /* fail */
5504         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
5505                 exit(0); /* succeed (yes, it's ELF) */
5506         else
5507                 exit(1); /* fail */
5508 }
5509 EOM
5510                 if $cc $ccflags try.c >/dev/null 2>&1 && ./a.out; then
5511                         cat <<EOM
5512 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
5513 EOM
5514                         dflt="$cc"
5515                 else
5516                         echo "I'll use ld to build dynamic libraries."
5517                         dflt='ld'
5518                 fi
5519                 rm -f try.c a.out
5520                 ;;
5521         *)      dflt="$ld"
5522                 ;;
5523         esac
5524
5525     rp="What command should be used to create dynamic libraries?"
5526     . ./myread
5527         ld="$ans"
5528
5529     cat << EOM
5530
5531 Some systems may require passing special flags to $ld to create a
5532 library that can be dynamically loaded.  If your ld flags include
5533 -L/other/path options to locate libraries outside your loader's normal
5534 search path, you may need to specify those -L options here as well.  To
5535 use no flags, say "none".
5536
5537 EOM
5538     case "$lddlflags" in
5539     '') case "$osname" in
5540                         beos) dflt='-nostart' ;;
5541                         hpux)  dflt='-b' ;;
5542                         linux|irix*)    dflt='-shared' ;;
5543                         next)  dflt='none' ;;
5544                         solaris) dflt='-G' ;;
5545                         sunos) dflt='-assert nodefinitions' ;;
5546                         svr4*|esix*) dflt="-G $ldflags" ;;
5547                 *)     dflt='none' ;;
5548                         esac
5549                         ;;
5550     *) dflt="$lddlflags" ;;
5551     esac
5552
5553         : Try to guess additional flags to pick up local libraries.
5554         : Be careful not to append to a plain 'none'
5555         case "$dflt" in
5556         none) dflt='' ;;
5557         esac
5558         for thisflag in $ldflags; do
5559                 case "$thisflag" in
5560                 -L*)
5561                         case " $dflt " in
5562                         *" $thisflag "*) ;;
5563                         *) dflt="$dflt $thisflag" ;;
5564                         esac
5565                         ;;
5566                 esac
5567         done
5568
5569         case "$dflt" in
5570         ''|' ') dflt='none' ;;
5571         esac
5572
5573     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
5574     . ./myread
5575     case "$ans" in
5576     none) lddlflags=' ' ;;
5577     *) lddlflags="$ans" ;;
5578     esac
5579
5580         cat <<EOM
5581
5582 Some systems may require passing special flags to $cc to indicate that
5583 the resulting executable will use dynamic linking.  To use no flags,
5584 say "none".
5585
5586 EOM
5587     case "$ccdlflags" in
5588     '') case "$osname" in
5589                 hpux)   dflt='-Wl,-E' ;;
5590                 linux)  dflt='-rdynamic' ;;
5591                 next)   dflt='none' ;;
5592                 sunos)  dflt='none' ;;
5593                 *)      dflt='none' ;;
5594             esac ;;
5595     ' ')  dflt='none' ;;
5596     *)  dflt="$ccdlflags" ;;
5597     esac
5598     rp="Any special flags to pass to $cc to use dynamic loading?"
5599     . ./myread
5600     case "$ans" in
5601     none) ccdlflags=' ' ;;
5602     *) ccdlflags="$ans" ;;
5603     esac
5604     ;;
5605 *)  usedl="$undef"
5606         ld='ld'
5607     dlsrc='dl_none.xs'
5608     lddlflags=''
5609     ccdlflags=''
5610     ;;
5611 esac
5612
5613 also=''
5614 case "$usedl" in
5615 $undef)
5616         # No dynamic loading being used, so don't bother even to prompt.
5617         useshrplib='false'
5618         ;;
5619 *)      case "$useshrplib" in
5620         '')     case "$osname" in
5621                 svr4*|dgux|dynixptx|esix|powerux|beos)
5622                         dflt=y
5623                         also='Building a shared libperl is required for dynamic loading to work on your system.'
5624                         ;;
5625                 next*)
5626                         case "$osvers" in
5627                         4*)     dflt=y
5628                                 also='Building a shared libperl is needed for MAB support.'
5629                                 ;;
5630                         *)      dflt=n
5631                                 ;;
5632                         esac
5633                         ;;
5634                 *)      dflt=n
5635                         ;;
5636                 esac
5637                 ;;
5638         $define|true|[Yy]*)
5639                 dflt=y
5640                 ;;
5641         *)      dflt=n
5642                 ;;
5643         esac
5644         $cat << EOM
5645
5646 The perl executable is normally obtained by linking perlmain.c with
5647 libperl${_a}, any static extensions (usually just DynaLoader), and
5648 any other libraries needed on this system (such as -lm, etc.).  Since
5649 your system supports dynamic loading, it is probably possible to build
5650 a shared libperl.$so.  If you will have more than one executable linked
5651 to libperl.$so, this will significantly reduce the size of each
5652 executable, but it may have a noticeable affect on performance.  The
5653 default is probably sensible for your system.
5654 $also
5655
5656 EOM
5657         rp="Build a shared libperl.$so (y/n)"
5658         . ./myread
5659         case "$ans" in
5660         true|$define|[Yy]*)
5661                 useshrplib='true'  ;;
5662         *)      useshrplib='false' ;;
5663         esac
5664         ;;
5665 esac
5666
5667 case "$useshrplib" in
5668 true)
5669         case "$libperl" in
5670         '')
5671                 # Figure out a good name for libperl.so.  Since it gets stored in
5672                 # a version-specific architecture-dependent library, the version
5673                 # number isn't really that important, except for making cc/ld happy.
5674                 #
5675                 # A name such as libperl.so.3.1
5676                 majmin="libperl.$so.$patchlevel.$subversion"
5677                 # A name such as libperl.so.301
5678                 majonly=`echo $patchlevel $subversion |
5679                         $awk '{printf "%d%02d", $1, $2}'`
5680                 majonly=libperl.$so.$majonly
5681                 # I'd prefer to keep the os-specific stuff here to a minimum, and
5682                 # rely on figuring it out from the naming of libc.
5683                 case "${osname}${osvers}" in
5684                 next4*)
5685                         dflt=libperl.5.$so
5686                         # XXX How handle the --version stuff for MAB?
5687                         ;;
5688                 linux*)  # ld won't link with a bare -lperl otherwise.
5689                         dflt=libperl.$so
5690                         ;;
5691                 *)      # Try to guess based on whether libc has major.minor.
5692                         case "$libc" in
5693                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
5694                         *libc.$so.[0-9]*) dflt=$majonly ;;
5695                         *)      dflt=libperl.$so ;;
5696                         esac
5697                         ;;
5698                 esac
5699                 ;;
5700         *)      dflt=$libperl
5701                 ;;
5702         esac
5703         cat << EOM
5704
5705 I need to select a good name for the shared libperl.  If your system uses
5706 library names with major and minor numbers, then you might want something
5707 like $majmin.  Alternatively, if your system uses a single version
5708 number for shared libraries, then you might want to use $majonly.
5709 Or, your system might be quite happy with a simple libperl.$so.
5710
5711 Since the shared libperl will get installed into a version-specific
5712 architecture-dependent directory, the version number of the shared perl
5713 library probably isn't important, so the default should be o.k.
5714
5715 EOM
5716         rp='What name do you want to give to the shared libperl?'
5717         . ./myread
5718         libperl=$ans
5719         echo "Ok, I'll use $libperl"
5720         ;;
5721 *)
5722         libperl="libperl${_a}"
5723         ;;
5724 esac
5725
5726 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
5727 case "$shrpdir" in
5728 '') ;;
5729 *)      $cat >&4 <<EOM
5730 WARNING:  Use of the shrpdir variable for the installation location of
5731 the shared $libperl is not supported.  It was never documented and
5732 will not work in this version.  Let me (perlbug@perl.com)
5733 know of any problems this may cause.
5734
5735 EOM
5736         case "$shrpdir" in
5737         "$archlibexp/CORE")
5738                 $cat >&4 <<EOM
5739 But your current setting of $shrpdir is
5740 the default anyway, so it's harmless.
5741 EOM
5742                 ;;
5743         *)
5744                 $cat >&4 <<EOM
5745 Further, your current attempted setting of $shrpdir
5746 conflicts with the value of $archlibexp/CORE
5747 that installperl will use.
5748 EOM
5749                 ;;
5750         esac
5751         ;;
5752 esac
5753
5754 # How will the perl executable find the installed shared $libperl?
5755 # Add $xxx to ccdlflags.
5756 # If we can't figure out a command-line option, use $shrpenv to
5757 # set env LD_RUN_PATH.  The main perl makefile uses this.
5758 shrpdir=$archlibexp/CORE
5759 xxx=''
5760 tmp_shrpenv=''
5761 if "$useshrplib"; then
5762     case "$osname" in 
5763         aix)
5764                 # We'll set it in Makefile.SH...
5765                 ;;
5766         solaris|netbsd)
5767                 xxx="-R $shrpdir"
5768                 ;;
5769         freebsd)
5770                 xxx="-Wl,-R$shrpdir"
5771                 ;;
5772         linux|irix*|dec_osf)
5773                 xxx="-Wl,-rpath,$shrpdir"
5774                 ;;
5775         next)
5776                 # next doesn't like the default...
5777                 ;;
5778         beos)
5779                 # beos doesn't like the default, either.
5780                 ;;
5781         hpux*)
5782                 # hpux doesn't like the default, either.
5783                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
5784                 ;;
5785         *)
5786                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
5787                 ;;
5788         esac
5789         case "$xxx" in
5790         '') ;;
5791         *)      
5792                 # Only add $xxx if it isn't already in ccdlflags.
5793                 case " $ccdlflags " in
5794                 *" $xxx "*)     ;;
5795                 *)      ccdlflags="$ccdlflags $xxx"
5796                         cat <<EOM >&4
5797
5798 Adding $xxx to the flags
5799 passed to $ld so that the perl executable will find the 
5800 installed shared $libperl.
5801
5802 EOM
5803                         ;;
5804                 esac
5805                 ;;
5806         esac
5807 fi
5808 # Fix ccdlflags in AIX for building external extensions.
5809 # (For building Perl itself bare -bE:perl.exp is needed,
5810 #  Makefile.SH takes care of this.)
5811 case "$osname" in
5812 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
5813 esac
5814 # Respect a hint or command-line value.
5815 case "$shrpenv" in
5816 '') shrpenv="$tmp_shrpenv" ;;
5817 esac
5818 case "$ldlibpthname" in
5819 '')     ldlibpthname=LD_LIBRARY_PATH ;;
5820 none)   ldlibpthname='' ;;
5821 esac
5822
5823 : determine where manual pages go
5824 set man1dir man1dir none
5825 eval $prefixit
5826 $cat <<EOM
5827
5828 $spackage has manual pages available in source form.
5829 EOM
5830 case "$nroff" in
5831 nroff)
5832         echo "However, you don't have nroff, so they're probably useless to you."
5833         case "$man1dir" in
5834         '') man1dir="none";;
5835         esac;;
5836 esac
5837 echo "If you don't want the manual sources installed, answer 'none'."
5838 case "$man1dir" in
5839 ' ') dflt=none
5840         ;;
5841 '')
5842         lookpath="$prefixexp/man/man1 $prefixexp/man/l_man/man1"
5843         lookpath="$lookpath $prefixexp/man/p_man/man1"
5844         lookpath="$lookpath $prefixexp/man/u_man/man1"
5845         lookpath="$lookpath $prefixexp/man/man.1"
5846         case "$sysman" in
5847         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
5848         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
5849         esac
5850         set dflt
5851         eval $prefixup
5852         ;;
5853 *)  dflt="$man1dir"
5854         ;;
5855 esac
5856 echo " "
5857 fn=dn+~
5858 rp="Where do the main $spackage manual pages (source) go?"
5859 . ./getfile
5860 if $test "X$man1direxp" != "X$ansexp"; then
5861         installman1dir=''
5862 fi
5863 man1dir="$ans"
5864 man1direxp="$ansexp"
5865 case "$man1dir" in
5866 '')     man1dir=' '
5867         installman1dir='';;
5868 esac
5869
5870 : Change installation prefix, if necessary.
5871 if $test X"$prefix" != X"$installprefix"; then
5872         installman1dir=`echo $man1direxp | $sed "s#^$prefix#$installprefix#"`
5873 else
5874         installman1dir="$man1direxp"
5875 fi
5876
5877 : What suffix to use on installed man pages
5878
5879 case "$man1dir" in
5880 ' ')
5881         man1ext='0'
5882         ;;
5883 *)
5884         rp="What suffix should be used for the main $spackage man pages?"
5885         case "$man1ext" in
5886         '')     case "$man1dir" in
5887                 *1)  dflt=1 ;;
5888                 *1p) dflt=1p ;;
5889                 *1pm) dflt=1pm ;;
5890                 *l) dflt=l;;
5891                 *n) dflt=n;;
5892                 *o) dflt=o;;
5893                 *p) dflt=p;;
5894                 *C) dflt=C;;
5895                 *L) dflt=L;;
5896                 *L1) dflt=L1;;
5897                 *) dflt=1;;
5898                 esac
5899                 ;;
5900         *)      dflt="$man1ext";;
5901         esac
5902         . ./myread
5903         man1ext="$ans"
5904         ;;
5905 esac
5906
5907 : see if we can have long filenames
5908 echo " "
5909 rmlist="$rmlist /tmp/cf$$"
5910 $test -d /tmp/cf$$ || mkdir /tmp/cf$$
5911 first=123456789abcdef
5912 second=/tmp/cf$$/$first
5913 $rm -f $first $second
5914 if (echo hi >$first) 2>/dev/null; then
5915         if $test -f 123456789abcde; then
5916                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
5917                 val="$undef"
5918         else
5919                 if (echo hi >$second) 2>/dev/null; then
5920                         if $test -f /tmp/cf$$/123456789abcde; then
5921                                 $cat <<'EOM'
5922 That's peculiar... You can have filenames longer than 14 characters, but only
5923 on some of the filesystems.  Maybe you are using NFS.  Anyway, to avoid problems
5924 I shall consider your system cannot support long filenames at all.
5925 EOM
5926                                 val="$undef"
5927                         else
5928                                 echo 'You can have filenames longer than 14 characters.' >&4
5929                                 val="$define"
5930                         fi
5931                 else
5932                         $cat <<'EOM'
5933 How confusing! Some of your filesystems are sane enough to allow filenames
5934 longer than 14 characters but some others like /tmp can't even think about them.
5935 So, for now on, I shall assume your kernel does not allow them at all.
5936 EOM
5937                         val="$undef"
5938                 fi
5939         fi
5940 else
5941         $cat <<'EOM'
5942 You can't have filenames longer than 14 chars.  You can't even think about them!
5943 EOM
5944         val="$undef"
5945 fi 
5946 set d_flexfnam
5947 eval $setvar
5948 $rm -rf /tmp/cf$$ 123456789abcde*
5949
5950 : determine where library module manual pages go
5951 set man3dir man3dir none
5952 eval $prefixit
5953 $cat <<EOM
5954
5955 $spackage has manual pages for many of the library modules.
5956 EOM
5957
5958 case "$nroff" in
5959 nroff)
5960         $cat <<'EOM'
5961 However, you don't have nroff, so they're probably useless to you.
5962 EOM
5963         case "$man3dir" in
5964         '') man3dir="none";;
5965         esac;;
5966 esac
5967
5968 case "$d_flexfnam" in
5969 undef)
5970         $cat <<'EOM'
5971 However, your system can't handle the long file names like File::Basename.3. 
5972 EOM
5973         case "$man3dir" in
5974         '') man3dir="none";;
5975         esac;;
5976 esac
5977
5978 echo "If you don't want the manual sources installed, answer 'none'."
5979 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
5980 case "$man3dir" in
5981 '')     dflt=`echo $man1dir | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
5982         if $test -d "$privlib/man/man3"; then
5983                 cat <<EOM >&4
5984
5985 WARNING:  Previous versions of perl installed man3 pages into
5986 $privlib/man/man3.  This version will suggest a 
5987 new default of $dflt.  
5988 EOM
5989                 tdflt=$dflt
5990                 dflt='n'
5991                 rp='Do you wish to preserve the old behavior?(y/n)'
5992                 . ./myread
5993                 case "$ans" in
5994                 y*) dflt="$privlib/man/man3" ;;
5995                 *)  dflt=$tdflt ;;
5996                 esac
5997     fi
5998         ;;
5999 ' ') dflt=none;;
6000 *)      dflt="$man3dir" ;;
6001 esac
6002 echo " "
6003 fn=dn+~
6004 rp="Where do the $package library man pages (source) go?"
6005 . ./getfile
6006 man3dir="$ans"
6007 man3direxp="$ansexp"
6008 case "$man1dir" in
6009 '')     man3dir=' '
6010         installman3dir='';;
6011 esac
6012
6013 : Change installation prefix, if necessary.
6014 if $test X"$prefix" != X"$installprefix"; then
6015         installman3dir=`echo $man3direxp | $sed "s#^$prefix#$installprefix#"`
6016 else
6017         installman3dir="$man3direxp"
6018 fi
6019
6020 : What suffix to use on installed man pages
6021 case "$man3dir" in
6022 ' ')
6023         man3ext='0'
6024         ;;
6025 *)
6026         rp="What suffix should be used for the $package library man pages?"
6027         case "$man3ext" in
6028         '')     case "$man3dir" in
6029                 *3)  dflt=3 ;;
6030                 *3p) dflt=3p ;;
6031                 *3pm) dflt=3pm ;;
6032                 *l) dflt=l;;
6033                 *n) dflt=n;;
6034                 *o) dflt=o;;
6035                 *p) dflt=p;;
6036                 *C) dflt=C;;
6037                 *L) dflt=L;;
6038                 *L3) dflt=L3;;
6039                 *) dflt=3;;
6040                 esac
6041                 ;;
6042         *)      dflt="$man3ext";;
6043         esac
6044         . ./myread
6045         man3ext="$ans"
6046         ;;
6047 esac
6048
6049 : see if we have to deal with yellow pages, now NIS.
6050 if $test -d /usr/etc/yp || $test -d /etc/yp; then
6051         if $test -f /usr/etc/nibindd; then
6052                 echo " "
6053                 echo "I'm fairly confident you're on a NeXT."
6054                 echo " "
6055                 rp='Do you get the hosts file via NetInfo?'
6056                 dflt=y
6057                 case "$hostcat" in
6058                 nidump*) ;;
6059                 '') ;;
6060                 *) dflt=n;;
6061                 esac
6062                 . ./myread
6063                 case "$ans" in
6064                 y*) hostcat='nidump hosts .';;
6065                 *)      case "$hostcat" in
6066                         nidump*) hostcat='';;
6067                         esac
6068                         ;;
6069                 esac
6070         fi
6071         case "$hostcat" in
6072         nidump*) ;;
6073         *)
6074                 case "$hostcat" in
6075                 *ypcat*) dflt=y;;
6076                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
6077                                 dflt=y
6078                         else
6079                                 dflt=n
6080                         fi;;
6081                 *) dflt=n;;
6082                 esac
6083                 echo " "
6084                 rp='Are you getting the hosts file via yellow pages?'
6085                 . ./myread
6086                 case "$ans" in
6087                 y*) hostcat='ypcat hosts';;
6088                 *) hostcat='cat /etc/hosts';;
6089                 esac
6090                 ;;
6091         esac
6092 fi
6093 case "$hostcat" in
6094 '') hostcat='cat /etc/hosts';;
6095 esac
6096 case "$groupcat" in
6097 '') groupcat='cat /etc/group';;
6098 esac
6099 case "$passcat" in
6100 '') passcat='cat /etc/passwd';;
6101 esac
6102
6103 : now get the host name
6104 echo " "
6105 echo "Figuring out host name..." >&4
6106 case "$myhostname" in
6107 '') cont=true
6108         echo 'Maybe "hostname" will work...'
6109         if tans=`sh -c hostname 2>&1` ; then
6110                 myhostname=$tans
6111                 phostname=hostname
6112                 cont=''
6113         fi
6114         ;;
6115 *) cont='';;
6116 esac
6117 if $test "$cont"; then
6118         if ./xenix; then
6119                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
6120                 if tans=`cat /etc/systemid 2>&1` ; then
6121                         myhostname=$tans
6122                         phostname='cat /etc/systemid'
6123                         echo "Whadyaknow.  Xenix always was a bit strange..."
6124                         cont=''
6125                 fi
6126         elif $test -r /etc/systemid; then
6127                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
6128         fi
6129 fi
6130 if $test "$cont"; then
6131         echo 'No, maybe "uuname -l" will work...'
6132         if tans=`sh -c 'uuname -l' 2>&1` ; then
6133                 myhostname=$tans
6134                 phostname='uuname -l'
6135         else
6136                 echo 'Strange.  Maybe "uname -n" will work...'
6137                 if tans=`sh -c 'uname -n' 2>&1` ; then
6138                         myhostname=$tans
6139                         phostname='uname -n'
6140                 else
6141                         echo 'Oh well, maybe I can mine it out of whoami.h...'
6142                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
6143                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
6144                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
6145                         else
6146                                 case "$myhostname" in
6147                                 '') echo "Does this machine have an identity crisis or something?"
6148                                         phostname='';;
6149                                 *)
6150                                         echo "Well, you said $myhostname before..."
6151                                         phostname='echo $myhostname';;
6152                                 esac
6153                         fi
6154                 fi
6155         fi
6156 fi
6157 : you do not want to know about this
6158 set $myhostname
6159 myhostname=$1
6160
6161 : verify guess
6162 if $test "$myhostname" ; then
6163         dflt=y
6164         rp='Your host name appears to be "'$myhostname'".'" Right?"
6165         . ./myread
6166         case "$ans" in
6167         y*) ;;
6168         *) myhostname='';;
6169         esac
6170 fi
6171
6172 : bad guess or no guess
6173 while $test "X$myhostname" = X ; do
6174         dflt=''
6175         rp="Please type the (one word) name of your host:"
6176         . ./myread
6177         myhostname="$ans"
6178 done
6179
6180 : translate upper to lower if necessary
6181 case "$myhostname" in
6182 *[A-Z]*)
6183         echo "(Normalizing case in your host name)"
6184         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
6185         ;;
6186 esac
6187
6188 case "$myhostname" in
6189 *.*)
6190         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
6191         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
6192         echo "(Trimming domain name from host name--host name is now $myhostname)"
6193         ;;
6194 *) case "$mydomain" in
6195         '')
6196                 {
6197                         test "X$hostcat" = "Xypcat hosts" &&
6198                         ypmatch "$myhostname" hosts 2>/dev/null |\
6199                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
6200                         $test -s hosts
6201                 } || {
6202                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
6203                                         /[       ]$myhostname[  . ]/p" > hosts
6204                 }
6205                 tmp_re="[       . ]"
6206                 $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
6207                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
6208                 dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
6209                         hosts | $sort | $uniq | \
6210                         $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
6211                 case `$echo X$dflt` in
6212                 X*\ *)  echo "(Several hosts in /etc/hosts matched hostname)"
6213                         dflt=.
6214                         ;;
6215                 X.) echo "(You do not have fully-qualified names in /etc/hosts)"
6216                         ;;
6217                 esac
6218                 case "$dflt" in
6219                 .)
6220                         tans=`./loc resolv.conf X /etc /usr/etc`
6221                         if $test -f "$tans"; then
6222                                 echo "(Attempting domain name extraction from $tans)"
6223                                 dflt=.`$sed -n -e 's/   / /g' \
6224                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
6225                                   | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
6226                                 case "$dflt" in
6227                                 .) dflt=.`$sed -n -e 's/        / /g' \
6228                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
6229                                      | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
6230                                         ;;
6231                                 esac
6232                         fi
6233                         ;;
6234                 esac
6235                 case "$dflt" in
6236                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
6237                         dflt=.`sh -c domainname 2>/dev/null`
6238                         case "$dflt" in
6239                         '') dflt='.';;
6240                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
6241                         esac
6242                         ;;
6243                 esac
6244                 case "$dflt" in
6245                 .) echo "(Lost all hope -- silly guess then)"
6246                         dflt='.uucp'
6247                         ;;
6248                 esac
6249                 $rm -f hosts
6250                 ;;
6251         *) dflt="$mydomain";;
6252         esac;;
6253 esac
6254 echo " "
6255 rp="What is your domain name?"
6256 . ./myread
6257 tans="$ans"
6258 case "$ans" in
6259 '') ;;
6260 .*) ;;
6261 *) tans=".$tans";;
6262 esac
6263 mydomain="$tans"
6264
6265 : translate upper to lower if necessary
6266 case "$mydomain" in
6267 *[A-Z]*)
6268         echo "(Normalizing case in your domain name)"
6269         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
6270         ;;
6271 esac
6272
6273 : a little sanity check here
6274 case "$phostname" in
6275 '') ;;
6276 *)
6277         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
6278         $myhostname$mydomain|$myhostname) ;;
6279         *)
6280                 case "$phostname" in
6281                 sed*)
6282                         echo "(That doesn't agree with your whoami.h file, by the way.)"
6283                         ;;
6284                 *)
6285                         echo "(That doesn't agree with your $phostname command, by the way.)"
6286                         ;;
6287                 esac
6288         ;;
6289         esac
6290         ;;
6291 esac
6292
6293 $cat <<EOM
6294
6295 I need to get your e-mail address in Internet format if possible, i.e.
6296 something like user@host.domain. Please answer accurately since I have
6297 no easy means to double check it. The default value provided below
6298 is most probably close to the reality but may not be valid from outside
6299 your organization...
6300
6301 EOM
6302 cont=x
6303 while test "$cont"; do
6304         case "$cf_email" in
6305         '') dflt="$cf_by@$myhostname$mydomain";;
6306         *) dflt="$cf_email";;
6307         esac
6308         rp='What is your e-mail address?'
6309         . ./myread
6310         cf_email="$ans"
6311         case "$cf_email" in
6312         *@*.*) cont='' ;;
6313         *)
6314                 rp='Address does not look like an Internet one.  Use it anyway?'
6315                 case "$fastread" in
6316                 yes) dflt=y ;;
6317                 *) dflt=n ;;
6318                 esac
6319                 . ./myread
6320                 case "$ans" in
6321                 y*) cont='' ;;
6322                 *) echo " " ;;
6323                 esac
6324                 ;;
6325         esac
6326 done
6327
6328 $cat <<EOM
6329
6330 If you or somebody else will be maintaining perl at your site, please
6331 fill in the correct e-mail address here so that they may be contacted
6332 if necessary. Currently, the "perlbug" program included with perl
6333 will send mail to this address in addition to perlbug@perl.com. You may
6334 enter "none" for no administrator.
6335
6336 EOM
6337 case "$perladmin" in
6338 '') dflt="$cf_email";;
6339 *) dflt="$perladmin";;
6340 esac
6341 rp='Perl administrator e-mail address'
6342 . ./myread
6343 perladmin="$ans"
6344
6345 : figure out how to guarantee perl startup
6346 case "$startperl" in
6347 '')
6348         case "$sharpbang" in
6349         *!)
6350                 $cat <<EOH
6351
6352 I can use the #! construct to start perl on your system. This will
6353 make startup of perl scripts faster, but may cause problems if you
6354 want to share those scripts and perl is not in a standard place
6355 ($binexp/perl) on all your platforms. The alternative is to force
6356 a shell by starting the script with a single ':' character.
6357
6358 EOH
6359                 dflt="$binexp/perl"
6360                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
6361                 . ./myread
6362                 case "$ans" in
6363                 none)   startperl=": # use perl";;
6364                 *)      startperl="#!$ans"
6365                         if $test 30 -lt `echo "$ans" | wc -c`; then
6366                                 $cat >&4 <<EOM
6367
6368 WARNING:  Some systems limit the #! command to 32 characters.
6369 If you experience difficulty running Perl scripts with #!, try
6370 installing Perl in a directory with a shorter pathname.
6371
6372 EOM
6373                         fi ;;
6374                 esac
6375                 ;;
6376         *) startperl=": # use perl"
6377                 ;;
6378         esac
6379         ;;
6380 esac
6381 echo "I'll use $startperl to start perl scripts."
6382
6383 : figure best path for perl in scripts
6384 case "$perlpath" in
6385 '')
6386         perlpath="$binexp/perl"
6387         case "$startperl" in
6388         *!*) ;;
6389         *)
6390                 $cat <<EOH
6391
6392 I will use the "eval 'exec'" idiom to start Perl on your system.
6393 I can use the full path of your Perl binary for this purpose, but
6394 doing so may cause problems if you want to share those scripts and
6395 Perl is not always in a standard place ($binexp/perl).
6396
6397 EOH
6398                 dflt="$binexp/perl"
6399                 rp="What path shall I use in \"eval 'exec'\"?"
6400                 . ./myread
6401                 perlpath="$ans"
6402                 ;;
6403         esac
6404         ;;
6405 esac
6406 case "$startperl" in
6407 *!*)    ;;
6408 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
6409 esac
6410
6411 : determine where public executable scripts go
6412 set scriptdir scriptdir
6413 eval $prefixit
6414 case "$scriptdir" in
6415 '')
6416         dflt="$bin"
6417         : guess some guesses
6418         $test -d /usr/share/scripts && dflt=/usr/share/scripts
6419         $test -d /usr/share/bin     && dflt=/usr/share/bin
6420         $test -d /usr/local/script  && dflt=/usr/local/script
6421         $test -d /usr/local/scripts && dflt=/usr/local/scripts
6422         $test -d $prefixexp/script  && dflt=$prefixexp/script
6423         set dflt
6424         eval $prefixup
6425         ;;
6426 *)  dflt="$scriptdir"
6427         ;;
6428 esac
6429 $cat <<EOM
6430  
6431 Some installations have a separate directory just for executable scripts so
6432 that they can mount it across multiple architectures but keep the scripts in
6433 one spot.  You might, for example, have a subdirectory of /usr/share for this.
6434 Or you might just lump your scripts in with all your other executables.
6435  
6436 EOM
6437 fn=d~
6438 rp='Where do you keep publicly executable scripts?'
6439 . ./getfile
6440 if $test "X$ansexp" != "X$scriptdirexp"; then
6441         installscript=''
6442 fi
6443 scriptdir="$ans"
6444 scriptdirexp="$ansexp"
6445 : Change installation prefix, if necessary.
6446 if $test X"$prefix" != X"$installprefix"; then
6447         installscript=`echo $scriptdirexp | sed "s#^$prefix#$installprefix#"`
6448 else
6449         installscript="$scriptdirexp"
6450 fi
6451
6452 $cat <<EOM
6453
6454 After $package is installed, you may wish to install various
6455 add-on modules and utilities.  Typically, these add-ons will
6456 be installed under $prefix with the rest
6457 of this package.  However, you may wish to install such add-ons
6458 elsewhere under a different prefix.
6459
6460 If you do not wish to put everything under a single prefix, that's
6461 ok.  You will be prompted for the individual locations; this siteprefix
6462 is only used to suggest the defaults.
6463
6464 The default should be fine for most people.
6465
6466 EOM
6467 fn=d~+
6468 rp='Installation prefix to use for add-on modules and utilities?'
6469 : XXX Here might be another good place for an installstyle setting.
6470 case "$siteprefix" in
6471 '') dflt=$prefix ;;
6472 *)  dflt=$siteprefix ;;
6473 esac
6474 . ./getfile
6475 oldsiteprefix=''
6476 case "$siteprefix" in
6477 '') ;;
6478 *)
6479         case "$ans" in
6480         "$prefix") ;;
6481         *) oldsiteprefix="$prefix";;
6482         esac
6483         ;;
6484 esac
6485 siteprefix="$ans"
6486 siteprefixexp="$ansexp"
6487
6488 : determine where site specific libraries go.
6489 : Usual default is /usr/local/lib/perl5/site_perl
6490 : The default "style" setting is made in installstyle.U
6491 : XXX No longer works with Prefixit stuff.
6492 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6493 case "$installstyle" in
6494 *lib/perl5*) dflt=$siteprefix/lib/site_$prog ;;
6495 *)       dflt=$siteprefix/lib/site_$prog ;;
6496 esac
6497 $cat <<EOM
6498
6499 The installation process will create a directory for
6500 site-specific extensions and modules.  Most users find it convenient
6501 to place all site-specific files in this directory rather than in the
6502 main distribution directory.
6503
6504 EOM
6505 fn=d~+
6506 rp='Pathname for the site-specific library files?'
6507 . ./getfile
6508 sitelib="$ans"
6509 sitelibexp="$ansexp"
6510 : Change installation prefix, if necessary.
6511 if $test X"$prefix" != X"$installprefix"; then
6512         installsitelib=`echo $sitelibexp | sed "s#^$prefix#$installprefix#"`
6513 else
6514         installsitelib="$sitelibexp"
6515 fi
6516
6517 : determine where site specific architecture-dependent libraries go.
6518 : sitelib  default is /usr/local/lib/perl5/site_perl/
6519 : sitearch default is /usr/local/lib/perl5/site_perl/$apiversion/$archname
6520 : sitelib may have an optional trailing /share.
6521 tdflt=`echo $sitelib | $sed 's,/share$,,'`
6522 tdflt="$tdflt/$apiversion/$archname"
6523 set sitearch sitearch none
6524 eval $prefixit
6525 case "$sitearch" in
6526 '')     dflt="$tdflt" ;;
6527 *)      dflt="$sitearch" ;;
6528 esac
6529 $cat <<EOM
6530
6531 The installation process will also create a directory for
6532 architecture-dependent site-specific extensions and modules.
6533
6534 EOM
6535 fn=nd~+
6536 rp='Pathname for the site-specific architecture-dependent library files?'
6537 . ./getfile
6538 sitearch="$ans"
6539 sitearchexp="$ansexp"
6540 : Change installation prefix, if necessary.
6541 if $test X"$prefix" != X"$installprefix"; then
6542         installsitearch=`echo $sitearchexp | sed "s#^$prefix#$installprefix#"`
6543 else
6544         installsitearch="$sitearchexp"
6545 fi
6546
6547 : determine where add-on public executables go
6548 case "$sitebin" in
6549 '')     dflt=$siteprefix/bin ;;
6550 *)      dflt=$sitebin ;;
6551 esac
6552 fn=d~
6553 rp='Pathname where the add-on public executables should be installed?'
6554 . ./getfile
6555 sitebin="$ans"
6556 sitebinexp="$ansexp"
6557 : Change installation prefix, if necessary.
6558 if $test X"$prefix" != X"$installprefix"; then
6559         installsitebin=`echo $sitebinexp | sed "s#^$prefix#$installprefix#"`
6560 else
6561         installsitebin="$sitebinexp"
6562 fi
6563
6564 cat <<EOM
6565
6566 Perl can be built to take advantage of long doubles which
6567 (if available) may give more accuracy and range for floating point
6568 numbers.  To do so, Configure must be run with -Duselongdouble.
6569
6570 If this doesn't make any sense to you, just accept the default 'n'.
6571 EOM
6572 case "$uselongdouble" in
6573 $define|true|[yY]*)     dflt='y';;
6574 *) dflt='n';;
6575 esac
6576 rp='Try to use long doubles if available?'
6577 . ./myread
6578 case "$ans" in
6579 y|Y)    val="$define"   ;;
6580 *)      val="$undef"    ;;
6581 esac
6582 set uselongdouble
6583 eval $setvar
6584
6585 case "$uselongdouble" in
6586 "$define"|true|[yY]*)
6587 : Look for a hint-file generated 'call-back-unit'.  If the
6588 : user has specified that long doubles should be used,
6589 : we may need to set or change some other defaults.
6590         if $test -f uselongdouble.cbu; then
6591                 echo "Your platform has some specific hints for long doubles, using them..."
6592                 . ./uselongdouble.cbu
6593         else
6594                 $cat <<EOM
6595 (Your platform doesn't have any specific hints for long doubles.)
6596 EOM
6597         fi
6598         ;;
6599 esac
6600
6601 cat <<EOM
6602
6603 Previous version of $package used the standard IO mechanisms as defined
6604 in <stdio.h>.  Versions 5.003_02 and later of perl allow alternate IO
6605 mechanisms via a "PerlIO" abstraction, but the stdio mechanism is still
6606 the default.  This abstraction layer can use AT&T's sfio (if you already
6607 have sfio installed) or regular stdio.  Using PerlIO with sfio may cause
6608 problems with some extension modules.  Using PerlIO with stdio is safe,
6609 but it is slower than plain stdio and therefore is not the default.
6610
6611 If this doesn't make any sense to you, just accept the default 'n'.
6612 EOM
6613 case "$useperlio" in
6614 $define|true|[yY]*)     dflt='y';;
6615 *) dflt='n';;
6616 esac
6617 rp='Use the experimental PerlIO abstraction layer?'
6618 . ./myread
6619 case "$ans" in
6620 y|Y) 
6621         val="$define"
6622         ;;     
6623 *)      
6624         echo "Ok, doing things the stdio way"
6625         val="$undef"
6626         ;;
6627 esac
6628 set useperlio
6629 eval $setvar 
6630
6631 case "$vendorprefix" in
6632 '')     d_vendorbin="$undef"
6633         vendorbin=''
6634         vendorbinexp=''
6635         ;;
6636 *)      d_vendorbin="$define"
6637         : determine where vendor-supplied executables go.
6638         dflt=$vendorprefix/bin
6639         fn=d~+
6640         rp='Pathname for the vendor-supplied executables directory?'
6641         . ./getfile
6642         vendorbin="$ans"
6643         vendorbinexp="$ansexp"
6644         : Change installation prefix, if necessary.
6645         if $test X"$prefix" != X"$installprefix"; then
6646                 installvendorbin=`echo $vendorbinexp | $sed "s#^$prefix#$installprefix#"`
6647         else
6648                 installvendorbin="$vendorbinexp"
6649         fi
6650         ;;
6651 esac
6652
6653 : Check how to convert floats to strings.
6654 if test "X$d_Gconvert" = X; then
6655         echo " "
6656         echo "Checking for an efficient way to convert floats to strings."
6657         $cat >try.c <<'EOP'
6658 #ifdef TRY_gconvert
6659 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
6660 char *myname = "gconvert";
6661 #endif
6662 #ifdef TRY_gcvt
6663 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
6664 char *myname = "gcvt";
6665 #endif
6666 #ifdef TRY_sprintf
6667 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
6668 char *myname = "sprintf";
6669 #endif
6670
6671 #include <stdio.h>
6672
6673 int
6674 checkit(expect, got)
6675 char *expect;
6676 char *got;
6677 {
6678     if (strcmp(expect, got)) {
6679                 printf("%s oddity:  Expected %s, got %s\n",
6680                         myname, expect, got);
6681                 exit(1);
6682         }
6683 }
6684
6685 int main()
6686
6687         char buf[64]; 
6688         buf[63] = '\0';
6689
6690         /* This must be 1st test on (which?) platform */
6691         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
6692         Gconvert(0.1, 8, 0, buf);
6693         checkit("0.1", buf);
6694
6695         Gconvert(1.0, 8, 0, buf); 
6696         checkit("1", buf);
6697
6698         Gconvert(0.0, 8, 0, buf); 
6699         checkit("0", buf);
6700
6701         Gconvert(-1.0, 8, 0, buf); 
6702         checkit("-1", buf);
6703
6704         /* Some Linux gcvt's give 1.e+5 here. */
6705         Gconvert(100000.0, 8, 0, buf); 
6706         checkit("100000", buf);
6707         
6708         /* Some Linux gcvt's give -1.e+5 here. */
6709         Gconvert(-100000.0, 8, 0, buf); 
6710         checkit("-100000", buf);
6711
6712         exit(0);
6713 }
6714 EOP
6715         case "$d_Gconvert" in
6716         gconvert*) xxx_list='gconvert gcvt sprintf' ;;
6717         gcvt*) xxx_list='gcvt gconvert sprintf' ;;
6718         sprintf*) xxx_list='sprintf gconvert gcvt' ;;
6719         *) xxx_list='gconvert gcvt sprintf' ;;
6720         esac
6721
6722         for xxx_convert in $xxx_list; do
6723                 echo "Trying $xxx_convert"
6724                 $rm -f try try$_o
6725                 set try -DTRY_$xxx_convert
6726                 if eval $compile; then
6727                         echo "$xxx_convert" found. >&4
6728                         if ./try; then
6729                                 echo "I'll use $xxx_convert to convert floats into a string." >&4
6730                                 break;
6731                         else
6732                                 echo "...But $xxx_convert didn't work as I expected."
6733                         fi
6734                 else
6735                         echo "$xxx_convert NOT found." >&4
6736                 fi
6737         done
6738                 
6739         case "$xxx_convert" in
6740         gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
6741         gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
6742         *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
6743         esac
6744 fi
6745
6746 : see if inttypes.h is available
6747 : we want a real compile instead of Inhdr because some systems
6748 : have an inttypes.h which includes non-existent headers
6749 echo " "
6750 $cat >try.c <<EOCP
6751 #include <inttypes.h>
6752 int main() {
6753         static int32_t foo32 = 0x12345678;
6754 }
6755 EOCP
6756 set try
6757 if eval $compile; then
6758         echo "<inttypes.h> found." >&4
6759         val="$define"
6760 else
6761         echo "<inttypes.h> NOT found." >&4
6762         val="$undef"
6763 fi
6764 $rm -f try.c try
6765 set i_inttypes
6766 eval $setvar
6767
6768 : check for int64_t
6769 case "$use64bits" in
6770 "$define" )
6771         echo " "
6772         $echo $n "Checking to see if your system supports int64_t...$c" >&4
6773         $cat >try.c <<EOCP
6774 #include <sys/types.h>
6775 #$i_inttypes I_INTTYPES
6776 #ifdef I_INTTYPES
6777 #include <inttypes.h>
6778 #endif
6779 int64_t foo() { int64_t x; x = 7; return x; }
6780 EOCP
6781         if $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then
6782                 val="$define"
6783                 echo " Yup, it does." >&4
6784         else
6785                 val="$undef"
6786                 echo " Nope, it doesn't." >&4
6787         fi
6788         $rm -f try.*
6789         ;;
6790 *)      val="$undef"
6791         ;;
6792 esac
6793 set d_int64t
6794 eval $setvar
6795
6796
6797 : check for lengths of integral types
6798 echo " "
6799 case "$intsize" in
6800 '')
6801         echo "Checking to see how big your integers are..." >&4
6802         $cat >intsize.c <<'EOCP'
6803 #include <stdio.h>
6804 int main()
6805 {
6806         printf("intsize=%d;\n", sizeof(int));
6807         printf("longsize=%d;\n", sizeof(long));
6808         printf("shortsize=%d;\n", sizeof(short));
6809         exit(0);
6810 }
6811 EOCP
6812         set intsize
6813         if eval $compile_ok && ./intsize > /dev/null; then
6814                 eval `./intsize`
6815                 echo "Your integers are $intsize bytes long."
6816                 echo "Your long integers are $longsize bytes long."
6817                 echo "Your short integers are $shortsize bytes long."
6818         else
6819                 $cat >&4 <<EOM
6820 !
6821 Help! I can't compile and run the intsize test program: please enlighten me!
6822 (This is probably a misconfiguration in your system or libraries, and
6823 you really ought to fix it.  Still, I'll try anyway.)
6824 !
6825 EOM
6826                 dflt=4
6827                 rp="What is the size of an integer (in bytes)?"
6828                 . ./myread
6829                 intsize="$ans"
6830                 dflt=$intsize
6831                 rp="What is the size of a long integer (in bytes)?"
6832                 . ./myread
6833                 longsize="$ans"
6834                 dflt=2
6835                 rp="What is the size of a short integer (in bytes)?"
6836                 . ./myread
6837                 shortsize="$ans"
6838         fi
6839         ;;
6840 esac
6841 $rm -f intsize intsize.*
6842
6843 : check for long long
6844 echo " "
6845 $echo $n "Checking to see if your system supports long long...$c" >&4
6846 echo 'long long foo() { long long x; x = 7; return x; }' > try.c
6847 if $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then
6848         val="$define"
6849         echo " Yup, it does." >&4
6850 else
6851         val="$undef"
6852         echo " Nope, it doesn't." >&4
6853 fi
6854 $rm try.*
6855 set d_longlong
6856 eval $setvar
6857
6858 : check for length of long long
6859 case "${d_longlong}${longlongsize}" in
6860 $define)
6861         echo " "
6862         $echo $n "Checking to see how big your long longs are...$c" >&4
6863         $cat >try.c <<'EOCP'
6864 #include <stdio.h>
6865 int main()
6866 {
6867         printf("%d\n", sizeof(long long));
6868 }
6869 EOCP
6870         set try
6871         if eval $compile_ok; then
6872                 longlongsize=`./try`
6873                 $echo " $longlongsize bytes." >&4
6874         else
6875                 dflt='8'
6876                 echo " "
6877                 echo "(I can't seem to compile the test program.  Guessing...)"
6878                 rp="What is the size of a long long (in bytes)?"
6879                 . ./myread
6880                 longlongsize="$ans"
6881         fi
6882         if $test "X$longsize" = "X$longlongsize"; then
6883                 echo "(That isn't any different from an ordinary long.)"
6884         fi      
6885         ;;
6886 esac
6887 $rm -f try.c try
6888
6889 echo " "
6890
6891 if $test X"$intsize" = X8 -o X"$longsize" = X8 -o X"$d_int64t" = X"$define" -o X"$d_longlong" = X"$define"; then
6892
6893 echo "Checking how to print 64-bit integers..." >&4
6894
6895 if $test X"$sPRId64" = X -a X"$intsize" = X8; then
6896         quad=int
6897         $cat >try.c <<'EOCP'
6898 #include <sys/types.h>
6899 #include <stdio.h>
6900 int main() {
6901   int q = 12345678901;
6902   printf("%ld\n", q);
6903 }
6904 EOCP
6905         set try
6906         if eval $compile; then
6907                 yyy=`./try$exe_ext`
6908                 case "$yyy" in
6909                 12345678901)
6910                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
6911                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIX64='"X"';
6912                         echo "We will use %d."
6913                         ;;
6914                 esac
6915         fi
6916 fi
6917
6918 if $test X"$sPRId64" = X -a X"$longsize" = X8; then
6919         quad=long
6920         $cat >try.c <<'EOCP'
6921 #include <sys/types.h>
6922 #include <stdio.h>
6923 int main() {
6924   long q = 12345678901;
6925   printf("%ld\n", q);
6926 }
6927 EOCP
6928         set try
6929         if eval $compile; then
6930                 yyy=`./try$exe_ext`
6931                 case "$yyy" in
6932                 12345678901)
6933                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
6934                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIX64='"lX"';
6935                         echo "We will use %ld."
6936                         ;;
6937                 esac
6938         fi
6939 fi
6940
6941 if $test X"$sPRId64" = X -a X"$i_inttypes.h" = X"$define" -a X"$d_int64t" = X"$define"; then
6942         quad=int64_t
6943         $cat >try.c <<'EOCP'
6944 #include <sys/types.h>
6945 #include <inttypes.h>
6946 #include <stdio.h>
6947 int main() {
6948   int64_t q = 12345678901;
6949   printf("%" PRId64 "\n", q);
6950 }
6951 EOCP
6952         set try
6953         if eval $compile; then
6954                 yyy=`./try$exe_ext`
6955                 case "$yyy" in
6956                 12345678901)
6957                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
6958                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIX64=PRIX64;
6959                         echo "We will use the C9X style."
6960                         ;;
6961                 esac
6962         fi
6963 fi
6964
6965 if $test X"$sPRId64" = X -a X"$d_longlong" = X"$define" -a X"$longlongsize" = X8; then
6966         quad="long long"
6967         $cat >try.c <<'EOCP'
6968 #include <sys/types.h>
6969 #include <stdio.h>
6970 int main() {
6971   long long q = 12345678901LL; /* AIX cc requires the LL prefix. */
6972   printf("%lld\n", q);
6973 }
6974 EOCP
6975         set try
6976         if eval $compile; then
6977                 yyy=`./try$exe_ext`
6978                 case "$yyy" in
6979                 12345678901)
6980                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
6981                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIX64='"llX"';
6982                         echo "We will use the %lld style."
6983                         ;;
6984                 esac
6985         fi
6986 fi
6987
6988 if $test X"$sPRId64" = X -a X"$quad" != X; then
6989         $cat >try.c <<EOCP
6990 #include <sys/types.h>
6991 #include <stdio.h>
6992 int main() {
6993   $quad q = 12345678901;
6994   printf("%Ld\n", q);
6995 }
6996 EOCP
6997         set try
6998         if eval $compile; then
6999                 yyy=`./try$exe_ext`
7000                 case "$yyy" in
7001                 12345678901)
7002                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
7003                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIX64='"LX"';
7004                         echo "We will use %lld."
7005                         ;;
7006                 esac
7007         fi
7008 fi
7009
7010 if $test X"$sPRId64" = X -a X"$quad" != X; then
7011         $cat >try.c <<EOCP
7012 #include <sys/types.h>
7013 #include <stdio.h>
7014 int main() {
7015   $quad q = 12345678901;
7016   printf("%qd\n", q);
7017 }
7018 EOCP
7019         set try
7020         if eval $compile; then
7021                 yyy=`./try$exe_ext`
7022                 case "$yyy" in
7023                 12345678901)
7024                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
7025                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIX64='"qX"';
7026                         echo "We will use %qd."
7027                         ;;
7028                 esac
7029         fi
7030 fi
7031
7032 if $test X"$sPRId64" = X; then
7033         echo "Cannot figure out how to print 64-bit integers." >&4
7034 fi
7035
7036 $rm -f try try.*
7037
7038 fi # intsize -o longsize -o d_int64t -o d_longlong
7039
7040 case "$sPRId64" in
7041 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef"; 
7042         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIX64="$undef"; 
7043         ;;
7044 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define"; 
7045         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIX64="$define"; 
7046         ;;
7047 esac
7048
7049 : check for length of double
7050 echo " "
7051 case "$doublesize" in
7052 '')
7053         $echo $n "Checking to see how big your double precision numbers are...$c" >&4
7054         $cat >try.c <<'EOCP'
7055 #include <stdio.h>
7056 int main()
7057 {
7058         printf("%d\n", sizeof(double));
7059 }
7060 EOCP
7061         set try
7062         if eval $compile_ok; then
7063                 doublesize=`./try`
7064                 $echo " $doublesize bytes." >&4
7065         else
7066                 dflt='8'
7067                 echo "(I can't seem to compile the test program.  Guessing...)"
7068                 rp="What is the size of a double precision number (in bytes)?"
7069                 . ./myread
7070                 doublesize="$ans"
7071         fi
7072         ;;
7073 esac
7074 $rm -f try.c try
7075
7076 : check for long doubles
7077 echo " "
7078 $echo $n "Checking to see if your system supports long double...$c" >&4
7079 echo 'long double foo() { long double x; x = 7.0; return x; }' > try.c
7080 if $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then
7081         val="$define"
7082         echo " Yup, it does." >&4
7083 else
7084         val="$undef"
7085         echo " Nope, it doesn't." >&4
7086 fi
7087 $rm try.*
7088 set d_longdbl
7089 eval $setvar
7090
7091 : check for length of long double
7092 case "${d_longdbl}${longdblsize}" in
7093 $define)
7094         echo " "
7095         $echo $n "Checking to see how big your long doubles are...$c" >&4
7096         $cat >try.c <<'EOCP'
7097 #include <stdio.h>
7098 int main()
7099 {
7100         printf("%d\n", sizeof(long double));
7101 }
7102 EOCP
7103         set try
7104         if eval $compile; then
7105                 longdblsize=`./try`
7106                 $echo " $longdblsize bytes." >&4
7107         else
7108                 dflt='8'
7109                 echo " "
7110                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
7111                 rp="What is the size of a long double (in bytes)?"
7112                 . ./myread
7113                 longdblsize="$ans"
7114         fi
7115         if $test "X$doublesize" = "X$longdblsize"; then
7116                 echo "(That isn't any different from an ordinary double.)"
7117         fi      
7118         ;;
7119 esac
7120 $rm -f try.c try
7121
7122 echo " "
7123
7124 if $test X"$d_longdbl" = X"$define"; then
7125
7126 echo "Checking how to print long doubles..." >&4
7127
7128 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
7129         $cat >try.c <<'EOCP'
7130 #include <sys/types.h>
7131 #include <stdio.h>
7132 int main() {
7133   double d = 123.456;
7134   printf("%.3f\n", d);
7135 }
7136 EOCP
7137         set try
7138         if eval $compile; then
7139                 yyy=`./try$exe_ext`
7140                 case "$yyy" in
7141                 123.456)
7142                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
7143                         sPRIFldbl='"F"'; sPRIGldbl='"G"'; sPRIEldbl='"E"';
7144                         echo "We will use %f."
7145                         ;;
7146                 esac
7147         fi
7148 fi
7149
7150 if $test X"$sPRIfldbl" = X; then
7151         $cat >try.c <<'EOCP'
7152 #include <sys/types.h>
7153 #include <stdio.h>
7154 int main() {
7155   long double d = 123.456;
7156   printf("%.3llf\n", d);
7157 }
7158 EOCP
7159         set try
7160         if eval $compile; then
7161                 yyy=`./try$exe_ext`
7162                 case "$yyy" in
7163                 123.456)
7164                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
7165                         sPRIFldbl='"llF"'; sPRIGldbl='"llG"'; sPRIEldbl='"llE"';
7166                         echo "We will use %llf."
7167                         ;;
7168                 esac
7169         fi
7170 fi
7171
7172 if $test X"$sPRIfldbl" = X; then
7173         $cat >try.c <<'EOCP'
7174 #include <sys/types.h>
7175 #include <stdio.h>
7176 int main() {
7177   long double d = 123.456;
7178   printf("%.3Lf\n", d);
7179 }
7180 EOCP
7181         set try
7182         if eval $compile; then
7183                 yyy=`./try$exe_ext`
7184                 case "$yyy" in
7185                 123.456)
7186                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
7187                         sPRIFldbl='"LF"'; sPRIGldbl='"LG"'; sPRIEldbl='"LE"';
7188                         echo "We will use %Lf."
7189                         ;;
7190                 esac
7191         fi
7192 fi
7193
7194 if $test X"$sPRIfldbl" = X; then
7195         $cat >try.c <<'EOCP'
7196 #include <sys/types.h>
7197 #include <stdio.h>
7198 int main() {
7199   long double d = 123.456;
7200   printf("%.3lf\n", d);
7201 }
7202 EOCP
7203         set try
7204         if eval $compile; then
7205                 yyy=`./try$exe_ext`
7206                 case "$yyy" in
7207                 123.456)
7208                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
7209                         sPRIFldbl='"lF"'; sPRIGldbl='"lG"'; sPRIEldbl='"lE"';
7210                         echo "We will use %lf."
7211                         ;;
7212                 esac
7213         fi
7214 fi
7215
7216 if $test X"$sPRIfldbl" = X; then
7217         echo "Cannot figure out how to print long doubles." >&4
7218 fi
7219
7220 $rm -f try try.*
7221
7222 fi # d_longdbl
7223
7224 case "$sPRIfldbl" in
7225 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef"; 
7226         d_PRIFldbl="$undef"; d_PRIGldbl="$undef"; d_PRIEldbl="$undef"; 
7227         ;;
7228 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define"; 
7229         d_PRIFldbl="$define"; d_PRIGldbl="$define"; d_PRIEldbl="$define"; 
7230         ;;
7231 esac
7232
7233 : Initialize h_fcntl
7234 h_fcntl=false
7235
7236 : Initialize h_sysfile
7237 h_sysfile=false
7238
7239 : access call always available on UNIX
7240 set access d_access
7241 eval $inlibc
7242
7243 : locate the flags for 'access()'
7244 case "$d_access" in
7245 "$define")
7246         echo " "
7247         $cat >access.c <<'EOCP'
7248 #include <sys/types.h>
7249 #ifdef I_FCNTL
7250 #include <fcntl.h>
7251 #endif
7252 #ifdef I_SYS_FILE
7253 #include <sys/file.h>
7254 #endif
7255 #ifdef I_UNISTD
7256 #include <unistd.h>
7257 #endif
7258 int main() {
7259         exit(R_OK);
7260 }
7261 EOCP
7262         : check sys/file.h first, no particular reason here
7263         if $test `./findhdr sys/file.h` && \
7264                 $cc $cppflags -DI_SYS_FILE -o access access.c >/dev/null 2>&1 ; then
7265                 h_sysfile=true;
7266                 echo "<sys/file.h> defines the *_OK access constants." >&4
7267         elif $test `./findhdr fcntl.h` && \
7268                 $cc $cppflags -DI_FCNTL -o access access.c >/dev/null 2>&1 ; then
7269                 h_fcntl=true;
7270                 echo "<fcntl.h> defines the *_OK access constants." >&4
7271         elif $test `./findhdr unistd.h` && \
7272                 $cc $cppflags -DI_UNISTD -o access access.c >/dev/null 2>&1 ; then
7273                 echo "<unistd.h> defines the *_OK access constants." >&4
7274         else
7275                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
7276         fi
7277         ;;
7278 esac
7279 $rm -f access*
7280
7281 : see if accessx exists
7282 set accessx d_accessx
7283 eval $inlibc
7284
7285 : see if alarm exists
7286 set alarm d_alarm
7287 eval $inlibc
7288
7289 : see if atolf exists
7290 set atolf d_atolf
7291 eval $inlibc
7292
7293 : see if atoll exists
7294 set atoll d_atoll
7295 eval $inlibc
7296
7297 : Look for GNU-cc style attribute checking
7298 echo " "
7299 echo "Checking whether your compiler can handle __attribute__ ..." >&4
7300 $cat >attrib.c <<'EOCP'
7301 #include <stdio.h>
7302 void croak (char* pat,...) __attribute__((format(printf,1,2),noreturn));
7303 EOCP
7304 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
7305         if $contains 'warning' attrib.out >/dev/null 2>&1; then
7306                 echo "Your C compiler doesn't fully support __attribute__."
7307                 val="$undef"
7308         else
7309                 echo "Your C compiler supports __attribute__."
7310                 val="$define"
7311         fi
7312 else
7313         echo "Your C compiler doesn't seem to understand __attribute__ at all."
7314         val="$undef"
7315 fi
7316 set d_attribut
7317 eval $setvar
7318 $rm -f attrib*
7319
7320 : see if bcmp exists
7321 set bcmp d_bcmp
7322 eval $inlibc
7323
7324 : see if bcopy exists
7325 set bcopy d_bcopy
7326 eval $inlibc
7327
7328 : see if this is a unistd.h system
7329 set unistd.h i_unistd
7330 eval $inhdr
7331
7332 : see if getpgrp exists
7333 set getpgrp d_getpgrp
7334 eval $inlibc
7335
7336 case "$d_getpgrp" in
7337 "$define")
7338         echo " "
7339         echo "Checking to see which flavor of getpgrp is in use..."
7340         $cat >set.c <<EOP
7341 #$i_unistd I_UNISTD
7342 #include <sys/types.h>
7343 #ifdef I_UNISTD
7344 #  include <unistd.h>
7345 #endif
7346 int main()
7347 {
7348         if (getuid() == 0) {
7349                 printf("(I see you are running Configure as super-user...)\n");
7350                 setuid(1);
7351         }
7352 #ifdef TRY_BSD_PGRP
7353         if (getpgrp(1) == 0)
7354                 exit(0);
7355 #else
7356         if (getpgrp() > 0)
7357                 exit(0);
7358 #endif
7359         exit(1);
7360 }
7361 EOP
7362         if $cc -DTRY_BSD_PGRP $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7363                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
7364                 val="$define"
7365         elif $cc $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7366                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
7367                 val="$undef"
7368         else
7369                 echo "I can't seem to compile and run the test program."
7370                 if ./usg; then
7371                         xxx="a USG one, i.e. you use getpgrp()."
7372                 else
7373                         # SVR4 systems can appear rather BSD-ish.
7374                         case "$i_unistd" in
7375                         $undef)
7376                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
7377                                 val="$define"
7378                                 ;;
7379                         $define)
7380                                 xxx="probably a USG one, i.e. you use getpgrp()."
7381                                 val="$undef"
7382                                 ;;
7383                         esac
7384                 fi
7385                 echo "Assuming your getpgrp is $xxx" >&4
7386         fi
7387         ;;
7388 *) val="$undef";;
7389 esac
7390 set d_bsdgetpgrp
7391 eval $setvar
7392 $rm -f set set.c
7393
7394 : see if setpgrp exists
7395 set setpgrp d_setpgrp
7396 eval $inlibc
7397
7398 case "$d_setpgrp" in
7399 "$define")
7400         echo " "
7401         echo "Checking to see which flavor of setpgrp is in use..."
7402         $cat >set.c <<EOP
7403 #$i_unistd I_UNISTD
7404 #include <sys/types.h>
7405 #ifdef I_UNISTD
7406 #  include <unistd.h>
7407 #endif
7408 int main()
7409 {
7410         if (getuid() == 0) {
7411                 printf("(I see you are running Configure as super-user...)\n");
7412                 setuid(1);
7413         }
7414 #ifdef TRY_BSD_PGRP
7415         if (-1 == setpgrp(1, 1))
7416                 exit(0);
7417 #else
7418         if (setpgrp() != -1)
7419                 exit(0);
7420 #endif
7421         exit(1);
7422 }
7423 EOP
7424         if $cc -DTRY_BSD_PGRP $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7425                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
7426                 val="$define"
7427         elif $cc $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7428                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
7429                 val="$undef"
7430         else
7431                 echo "(I can't seem to compile and run the test program.)"
7432                 if ./usg; then
7433                         xxx="a USG one, i.e. you use setpgrp()."
7434                 else
7435                         # SVR4 systems can appear rather BSD-ish.
7436                         case "$i_unistd" in
7437                         $undef)
7438                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
7439                                 val="$define"
7440                                 ;;
7441                         $define)
7442                                 xxx="probably a USG one, i.e. you use setpgrp()."
7443                                 val="$undef"
7444                                 ;;
7445                         esac
7446                 fi
7447                 echo "Assuming your setpgrp is $xxx" >&4
7448         fi
7449         ;;
7450 *) val="$undef";;
7451 esac
7452 set d_bsdsetpgrp
7453 eval $setvar
7454 $rm -f set set.c
7455 : see if bzero exists
7456 set bzero d_bzero
7457 eval $inlibc
7458
7459 : see if signal is declared as pointer to function returning int or void
7460 echo " "
7461 xxx=`./findhdr signal.h`
7462 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
7463 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
7464         echo "You have int (*signal())() instead of void." >&4
7465         val="$undef"
7466 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
7467         echo "You have void (*signal())()." >&4
7468         val="$define"
7469 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
7470         echo "You have int (*signal())() instead of void." >&4
7471         val="$undef"
7472 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
7473         echo "You have void (*signal())()." >&4
7474         val="$define"
7475 else
7476         case "$d_voidsig" in
7477         '')
7478         echo "I can't determine whether signal handler returns void or int..." >&4
7479                 dflt=void
7480                 rp="What type does your signal handler return?"
7481                 . ./myread
7482                 case "$ans" in
7483                 v*) val="$define";;
7484                 *) val="$undef";;
7485                 esac;;
7486         "$define")
7487                 echo "As you already told me, signal handler returns void." >&4
7488                 val="$define"
7489                 ;;
7490         *)      echo "As you already told me, signal handler returns int." >&4
7491                 val="$undef"
7492                 ;;
7493         esac
7494 fi
7495 set d_voidsig
7496 eval $setvar
7497 case "$d_voidsig" in
7498 "$define") signal_t="void";;
7499 *) signal_t="int";;
7500 esac
7501 $rm -f $$.tmp
7502
7503 : check for ability to cast large floats to 32-bit ints.
7504 echo " "
7505 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
7506 if $test "$intsize" -ge 4; then
7507         xxx=int
7508 else
7509         xxx=long
7510 fi
7511 $cat >try.c <<EOCP
7512 #include <stdio.h>
7513 #include <sys/types.h>
7514 #include <signal.h>
7515 $signal_t blech(s) int s; { exit(3); }
7516 int main()
7517 {
7518         $xxx i32;
7519         double f, g;
7520         int result = 0;
7521         char str[16];
7522         signal(SIGFPE, blech);
7523
7524         /* Don't let compiler optimize the test away.  Store the number 
7525            in a writable string for gcc to pass to sscanf under HP/UX.
7526         */
7527         sprintf(str, "2147483647");
7528         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
7529         g = 10 * f;
7530         i32  = ($xxx) g;
7531
7532         /* x86 processors will probably give 0x8000 0000, which is a
7533        sign change.  We don't want that.  We want to mimic SPARC
7534            behavior here, which is to preserve the sign and give
7535            back 0x7fff ffff.
7536         */
7537         if (i32 != ($xxx) f)
7538                 result |= 1;
7539         exit(result);
7540 }
7541 EOCP
7542 set try
7543 if eval $compile_ok; then
7544         ./try
7545         yyy=$?
7546 else
7547         echo "(I can't seem to compile the test program--assuming it can't)"
7548         yyy=1
7549 fi
7550 case "$yyy" in
7551 0)      val="$define"
7552         echo "Yup, it can."
7553         ;;
7554 *)      val="$undef"
7555         echo "Nope, it can't."
7556         ;;
7557 esac
7558 set d_casti32
7559 eval $setvar
7560 $rm -f try try.*
7561
7562 : check for ability to cast negative floats to unsigned
7563 echo " "
7564 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
7565 $cat >try.c <<EOCP
7566 #include <stdio.h>
7567 #include <sys/types.h>
7568 #include <signal.h>
7569 $signal_t blech(s) int s; { exit(7); }
7570 $signal_t blech_in_list(s) int s; { exit(4); }
7571 unsigned long dummy_long(p) unsigned long p; { return p; }
7572 unsigned int dummy_int(p) unsigned int p; { return p; }
7573 unsigned short dummy_short(p) unsigned short p; { return p; }
7574 int main()
7575 {
7576         double f;
7577         unsigned long along;
7578         unsigned int aint;
7579         unsigned short ashort;
7580         int result = 0;
7581         char str[16];
7582         
7583         /* Frustrate gcc-2.7.2's optimizer which failed this test with
7584            a direct f = -123. assignment.  gcc-2.8.0 reportedly
7585            optimized the whole file away
7586         */
7587         /* Store the number in a writable string for gcc to pass to 
7588            sscanf under HP/UX.
7589         */
7590         sprintf(str, "-123");
7591         sscanf(str, "%lf", &f);  /* f = -123.; */
7592
7593         signal(SIGFPE, blech);
7594         along = (unsigned long)f;
7595         aint = (unsigned int)f;
7596         ashort = (unsigned short)f;
7597         if (along != (unsigned long)-123)
7598                 result |= 1;
7599         if (aint != (unsigned int)-123)
7600                 result |= 1;
7601         if (ashort != (unsigned short)-123)
7602                 result |= 1;
7603         sprintf(str, "1073741824.");
7604         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
7605         f = f + f;
7606         along = 0;
7607         along = (unsigned long)f;
7608         if (along != 0x80000000)
7609                 result |= 2;
7610         f -= 1.;
7611         along = 0;
7612         along = (unsigned long)f;
7613         if (along != 0x7fffffff)
7614                 result |= 1;
7615         f += 2.;
7616         along = 0;
7617         along = (unsigned long)f;
7618         if (along != 0x80000001)
7619                 result |= 2;
7620         if (result)
7621                 exit(result);
7622         signal(SIGFPE, blech_in_list);
7623         sprintf(str, "123.");
7624         sscanf(str, "%lf", &f);  /* f = 123.; */
7625         along = dummy_long((unsigned long)f);
7626         aint = dummy_int((unsigned int)f);
7627         ashort = dummy_short((unsigned short)f);
7628         if (along != (unsigned long)123)
7629                 result |= 4;
7630         if (aint != (unsigned int)123)
7631                 result |= 4;
7632         if (ashort != (unsigned short)123)
7633                 result |= 4;
7634         exit(result);
7635
7636 }
7637 EOCP
7638 set try
7639 if eval $compile_ok; then
7640         ./try
7641         castflags=$?
7642 else
7643         echo "(I can't seem to compile the test program--assuming it can't)"
7644         castflags=7
7645 fi
7646 case "$castflags" in
7647 0)      val="$define"
7648         echo "Yup, it can."
7649         ;;
7650 *)      val="$undef"
7651         echo "Nope, it can't."
7652         ;;
7653 esac
7654 set d_castneg
7655 eval $setvar
7656 $rm -f try.*
7657
7658 : see if vprintf exists
7659 echo " "
7660 if set vprintf val -f d_vprintf; eval $csym; $val; then
7661         echo 'vprintf() found.' >&4
7662         val="$define"
7663         $cat >vprintf.c <<'EOF'
7664 #include <varargs.h>
7665
7666 int main() { xxx("foo"); }
7667
7668 xxx(va_alist)
7669 va_dcl
7670 {
7671         va_list args;
7672         char buf[10];
7673
7674         va_start(args);
7675         exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
7676 }
7677 EOF
7678         set vprintf
7679         if eval $compile && ./vprintf; then
7680                 echo "Your vsprintf() returns (int)." >&4
7681                 val2="$undef"
7682         else
7683                 echo "Your vsprintf() returns (char*)." >&4
7684                 val2="$define"
7685         fi
7686 else
7687         echo 'vprintf() NOT found.' >&4
7688                 val="$undef"
7689                 val2="$undef"
7690 fi
7691 set d_vprintf
7692 eval $setvar
7693 val=$val2
7694 set d_charvspr
7695 eval $setvar
7696
7697 : see if chown exists
7698 set chown d_chown
7699 eval $inlibc
7700
7701 : see if chroot exists
7702 set chroot d_chroot
7703 eval $inlibc
7704
7705 : see if chsize exists
7706 set chsize d_chsize
7707 eval $inlibc
7708
7709 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
7710 while $test $# -ge 2; do
7711         case "$1" in
7712         $define) echo "#include <$2>";;
7713         esac ;
7714     shift 2;
7715 done > try.c;
7716 echo "int main () { struct $struct foo; foo.$field = 0; }" >> try.c;
7717 if $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then
7718         val="$define";
7719 else
7720         val="$undef";
7721 fi;
7722 set $varname;
7723 eval $setvar;
7724 $rm -f try.c try.o'
7725
7726 : see if this is a sys/uio.h system
7727 set sys/uio.h i_sysuio
7728 eval $inhdr
7729
7730 echo "Checking to see if your system supports struct iovec..." >&4
7731 set d_iovec_s iovec iov_base $i_sysuio sys/uio.h
7732 eval $hasfield
7733 case "$d_iovec_s" in
7734 "$define")      echo "Yup, it does." >&4
7735                 ;;
7736 *)              echo "Nope, it doesn't." >&4
7737                 ;;
7738 esac
7739
7740 socketlib=''
7741 sockethdr=''
7742 : see whether socket exists
7743 echo " "
7744 $echo $n "Hmm... $c" >&4
7745 if set socket val -f d_socket; eval $csym; $val; then
7746         echo "Looks like you have Berkeley networking support." >&4
7747         d_socket="$define"
7748         if set setsockopt val -f; eval $csym; $val; then
7749                 d_oldsock="$undef"
7750         else
7751                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
7752                 d_oldsock="$define"
7753         fi
7754 else
7755         if $contains socklib libc.list >/dev/null 2>&1; then
7756                 echo "Looks like you have Berkeley networking support." >&4
7757                 d_socket="$define"
7758                 : we will have to assume that it supports the 4.2 BSD interface
7759                 d_oldsock="$undef"
7760         else
7761                 echo "You don't have Berkeley networking in libc$_a..." >&4
7762                 if test "X$d_socket" = "X$define"; then
7763                    echo "...but you seem to believe that you have sockets." >&4
7764                 else
7765                         for net in net socket
7766                         do
7767                                 if test -f /usr/lib/lib$net$_a; then
7768                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
7769                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
7770                                         if $contains socket libc.list >/dev/null 2>&1; then
7771                                                 d_socket="$define"
7772                                                 socketlib="-l$net"
7773                                                 case "$net" in
7774                                                 net)
7775                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
7776                                                         sockethdr="-I/usr/netinclude"
7777                                                         ;;
7778                                                 esac
7779                                                 echo "Found Berkeley sockets interface in lib$net." >& 4 
7780                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
7781                                                         d_oldsock="$undef"
7782                                                 else
7783                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
7784                                                         d_oldsock="$define"
7785                                                 fi
7786                                                 break
7787                                         fi
7788                                 fi
7789                         done
7790                         if test "X$d_socket" != "X$define"; then
7791                            echo "or anywhere else I see." >&4
7792                            d_socket="$undef"
7793                            d_oldsock="$undef"
7794                         fi
7795                 fi
7796         fi
7797 fi
7798
7799 : see if socketpair exists
7800 set socketpair d_sockpair
7801 eval $inlibc
7802
7803
7804 echo " "
7805 echo "Checking the availability of certain socket constants..." >& 4
7806 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
7807         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
7808         $cat >try.c <<EOF
7809 #include <sys/types.h>
7810 #include <sys/socket.h>
7811 int main() {
7812     int i = $ENUM;
7813 }
7814 EOF
7815         val="$undef"
7816         set try; if eval $compile; then
7817                 val="$define"
7818         fi
7819         set d_${enum}; eval $setvar
7820         $rm -f try.c try
7821 done
7822
7823 set sendmsg d_sendmsg
7824 eval $inlibc
7825
7826 set recvmsg d_recvmsg
7827 eval $inlibc
7828
7829 echo " "
7830 $echo $n "Checking to see if your system supports struct msghdr...$c" >&4
7831 set d_msghdr_s msghdr msg_name define sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
7832 eval $hasfield
7833 case "$d_msghdr_s" in
7834 "$define")      echo "Yup, it does." >&4
7835                 ;;
7836 *)              echo "Nope, it doesn't." >&4
7837                 ;;
7838 esac
7839
7840 $echo $n "Checking to see if your system supports struct cmsghdr...$c" >&4
7841 set d_cmsghdr_s cmsghdr cmsg_len define sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
7842 eval $hasfield
7843 case "$d_cmsghdr_s" in
7844 "$define")      echo "Yup, it does." >&4
7845                 ;;
7846 *)              echo "Nope, it doesn't." >&4
7847                 ;;
7848 esac
7849
7850 : check for const keyword
7851 echo " "
7852 echo 'Checking to see if your C compiler knows about "const"...' >&4
7853 $cat >const.c <<'EOCP'
7854 typedef struct spug { int drokk; } spug;
7855 int main()
7856 {
7857         const char *foo;
7858         const spug y;
7859 }
7860 EOCP
7861 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
7862         val="$define"
7863         echo "Yup, it does."
7864 else
7865         val="$undef"
7866         echo "Nope, it doesn't."
7867 fi
7868 set d_const
7869 eval $setvar
7870
7871 : see if crypt exists
7872 echo " "
7873 if set crypt val -f d_crypt; eval $csym; $val; then
7874         echo 'crypt() found.' >&4
7875         val="$define"
7876         cryptlib=''
7877 else
7878         cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
7879         if $test -z "$cryptlib"; then
7880                 cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
7881         else
7882                 cryptlib=-lcrypt
7883         fi
7884         if $test -z "$cryptlib"; then
7885                 cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
7886         else
7887                 cryptlib=-lcrypt
7888         fi
7889         if $test -z "$cryptlib"; then
7890                 cryptlib=`./loc libcrypt$_a "" $libpth`
7891         else
7892                 cryptlib=-lcrypt
7893         fi
7894         if $test -z "$cryptlib"; then
7895                 echo 'crypt() NOT found.' >&4
7896                 val="$undef"
7897         else
7898                 val="$define"
7899         fi
7900 fi
7901 set d_crypt
7902 eval $setvar
7903
7904 : get csh whereabouts
7905 case "$csh" in
7906 'csh') val="$undef" ;;
7907 *) val="$define" ;;
7908 esac
7909 set d_csh
7910 eval $setvar
7911 : Respect a hint or command line value for full_csh.
7912 case "$full_csh" in
7913 '') full_csh=$csh ;;
7914 esac
7915
7916 : see if cuserid exists
7917 set cuserid d_cuserid
7918 eval $inlibc
7919
7920 : see if this is a limits.h system
7921 set limits.h i_limits
7922 eval $inhdr
7923
7924 : see if this is a float.h system
7925 set float.h i_float
7926 eval $inhdr
7927
7928 : See if number of significant digits in a double precision number is known
7929 echo " "
7930 $cat >dbl_dig.c <<EOM
7931 #$i_limits I_LIMITS
7932 #$i_float I_FLOAT
7933 #ifdef I_LIMITS
7934 #include <limits.h>
7935 #endif
7936 #ifdef I_FLOAT
7937 #include <float.h>
7938 #endif
7939 #ifdef DBL_DIG
7940 printf("Contains DBL_DIG");
7941 #endif
7942 EOM
7943 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
7944 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
7945         echo "DBL_DIG found." >&4
7946         val="$define"
7947 else
7948         echo "DBL_DIG NOT found." >&4
7949         val="$undef"
7950 fi
7951 $rm -f dbl_dig.?
7952 set d_dbl_dig
7953 eval $setvar
7954
7955 : see if difftime exists
7956 set difftime d_difftime
7957 eval $inlibc
7958
7959 : see if this is a dirent system
7960 echo " "
7961 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
7962         val="$define"
7963         echo "<dirent.h> found." >&4
7964 else
7965         val="$undef"
7966         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
7967                 echo "<sys/dir.h> found." >&4
7968                 echo " "
7969         else
7970                 xinc=`./findhdr sys/ndir.h`
7971         fi
7972         echo "<dirent.h> NOT found." >&4
7973 fi
7974 set i_dirent
7975 eval $setvar
7976
7977 : Look for type of directory structure.
7978 echo " "
7979 $cppstdin $cppflags $cppminus < "$xinc" > try.c
7980
7981 case "$direntrytype" in
7982 ''|' ')
7983         case "$i_dirent" in
7984         $define) guess1='struct dirent' ;;
7985         *) guess1='struct direct'  ;;
7986         esac
7987         ;;
7988 *)      guess1="$direntrytype"
7989         ;;
7990 esac
7991
7992 case "$guess1" in
7993 'struct dirent') guess2='struct direct' ;;
7994 *) guess2='struct dirent' ;;
7995 esac
7996                 
7997 if $contains "$guess1" try.c >/dev/null 2>&1; then
7998         direntrytype="$guess1"
7999         echo "Your directory entries are $direntrytype." >&4
8000 elif $contains "$guess2" try.c >/dev/null 2>&1; then
8001         direntrytype="$guess2"
8002         echo "Your directory entries seem to be $direntrytype." >&4
8003 else
8004         echo "I don't recognize your system's directory entries." >&4
8005         rp="What type is used for directory entries on this system?"
8006         dflt="$guess1"
8007         . ./myread
8008         direntrytype="$ans"
8009 fi
8010 $rm -f try.c
8011
8012
8013 : see if the directory entry stores field length
8014 echo " "
8015 $cppstdin $cppflags $cppminus < "$xinc" > try.c
8016 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
8017         echo "Good, your directory entry keeps length information in d_namlen." >&4
8018         val="$define"
8019 else
8020         echo "Your directory entry does not know about the d_namlen field." >&4
8021         val="$undef"
8022 fi
8023 set d_dirnamlen
8024 eval $setvar
8025 $rm -f try.c
8026
8027 : see if dlerror exists
8028 xxx_runnm="$runnm"
8029 runnm=false
8030 set dlerror d_dlerror
8031 eval $inlibc
8032 runnm="$xxx_runnm"
8033
8034 : see if dlfcn is available
8035 set dlfcn.h i_dlfcn
8036 eval $inhdr
8037
8038 case "$usedl" in
8039 $define|y|true)
8040         $cat << EOM
8041
8042 On a few systems, the dynamically loaded modules that perl generates and uses
8043 will need a different extension than shared libs. The default will probably
8044 be appropriate.
8045
8046 EOM
8047         case "$dlext" in
8048         '')     dflt="$so" ;;
8049         *)      dflt="$dlext" ;;
8050         esac
8051         rp='What is the extension of dynamically loaded modules'
8052         . ./myread
8053         dlext="$ans"
8054         ;;
8055 *)
8056         dlext="none"
8057         ;;
8058 esac
8059
8060 : Check if dlsym need a leading underscore
8061 echo " "
8062 val="$undef"
8063
8064 case "$dlsrc" in
8065 dl_dlopen.xs)
8066         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
8067         $cat >dyna.c <<'EOM'
8068 fred () { }
8069 EOM
8070
8071 $cat >fred.c<<EOM
8072
8073 #include <stdio.h>
8074 #$i_dlfcn I_DLFCN
8075 #ifdef I_DLFCN
8076 #include <dlfcn.h>      /* the dynamic linker include file for Sunos/Solaris */
8077 #else
8078 #include <sys/types.h>
8079 #include <nlist.h>
8080 #include <link.h>
8081 #endif
8082
8083 extern int fred() ;
8084
8085 int main()
8086 {
8087     void * handle ;
8088     void * symbol ;
8089 #ifndef RTLD_LAZY
8090     int mode = 1 ;
8091 #else
8092     int mode = RTLD_LAZY ;
8093 #endif
8094     handle = dlopen("./dyna.$dlext", mode) ;
8095     if (handle == NULL) {
8096         printf ("1\n") ;
8097         fflush (stdout) ;
8098         exit(0);
8099     }
8100     symbol = dlsym(handle, "fred") ;
8101     if (symbol == NULL) {
8102         /* try putting a leading underscore */
8103         symbol = dlsym(handle, "_fred") ;
8104         if (symbol == NULL) {
8105             printf ("2\n") ;
8106             fflush (stdout) ;
8107             exit(0);
8108         }
8109         printf ("3\n") ;
8110     }
8111     else
8112         printf ("4\n") ;
8113     fflush (stdout) ;
8114     exit(0);
8115 }
8116 EOM
8117         : Call the object file tmp-dyna.o in case dlext=o.
8118         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 && 
8119                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 && 
8120                 $ld $lddlflags -o dyna.$dlext tmp-dyna${_o} > /dev/null 2>&1 && 
8121                 $cc $ccflags -o fred $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1; then
8122                 xxx=`./fred`
8123                 case $xxx in
8124                 1)      echo "Test program failed using dlopen." >&4
8125                         echo "Perhaps you should not use dynamic loading." >&4;;
8126                 2)      echo "Test program failed using dlsym." >&4
8127                         echo "Perhaps you should not use dynamic loading." >&4;;
8128                 3)      echo "dlsym needs a leading underscore" >&4
8129                         val="$define" ;;
8130                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
8131                 esac
8132         else
8133                 echo "I can't compile and run the test program." >&4
8134                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
8135         fi
8136         ;;
8137 esac
8138                 
8139 $rm -f fred fred.? dyna.$dlext dyna.? tmp-dyna.?
8140
8141 set d_dlsymun
8142 eval $setvar
8143
8144 hasproto='varname=$1; func=$2; shift; shift;
8145 while $test $# -ge 2; do
8146         case "$1" in
8147         $define) echo "#include <$2>";;
8148         esac ;
8149     shift 2;
8150 done > try.c;
8151 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
8152 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
8153         echo "$func() prototype found.";
8154         val="$define";
8155 else
8156         echo "$func() prototype NOT found.";
8157         val="$undef";
8158 fi;
8159 set $varname;
8160 eval $setvar;
8161 $rm -f try.c tryout.c'
8162
8163 : see if prototype for drand48 is available
8164 echo " "
8165 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
8166 eval $hasproto
8167
8168 : see if dup2 exists
8169 set dup2 d_dup2
8170 eval $inlibc
8171
8172 : see if eaccess exists
8173 set eaccess d_eaccess
8174 eval $inlibc
8175
8176 : see if endgrent exists
8177 set endgrent d_endgrent
8178 eval $inlibc
8179
8180 : see if endhostent exists
8181 set endhostent d_endhent
8182 eval $inlibc
8183
8184 : see if endnetent exists
8185 set endnetent d_endnent
8186 eval $inlibc
8187
8188 : see if endprotoent exists
8189 set endprotoent d_endpent
8190 eval $inlibc
8191
8192 : see if endpwent exists
8193 set endpwent d_endpwent
8194 eval $inlibc
8195
8196 : see if endservent exists
8197 set endservent d_endsent
8198 eval $inlibc
8199
8200 : see if endspent exists
8201 set endspent d_endspent
8202 eval $inlibc
8203
8204 : Locate the flags for 'open()'
8205 echo " "
8206 $cat >open3.c <<'EOCP'
8207 #include <sys/types.h>
8208 #ifdef I_FCNTL
8209 #include <fcntl.h>
8210 #endif
8211 #ifdef I_SYS_FILE
8212 #include <sys/file.h>
8213 #endif
8214 int main() {
8215         if(O_RDONLY);
8216 #ifdef O_TRUNC
8217         exit(0);
8218 #else
8219         exit(1);
8220 #endif
8221 }
8222 EOCP
8223 : check sys/file.h first to get FREAD on Sun
8224 if $test `./findhdr sys/file.h` && \
8225                 set open3 -DI_SYS_FILE && eval $compile; then
8226         h_sysfile=true;
8227         echo "<sys/file.h> defines the O_* constants..." >&4
8228         if ./open3; then
8229                 echo "and you have the 3 argument form of open()." >&4
8230                 val="$define"
8231         else
8232                 echo "but not the 3 argument form of open().  Oh, well." >&4
8233                 val="$undef"
8234         fi
8235 elif $test `./findhdr fcntl.h` && \
8236                 set open3 -DI_FCNTL && eval $compile; then
8237         h_fcntl=true;
8238         echo "<fcntl.h> defines the O_* constants..." >&4
8239         if ./open3; then
8240                 echo "and you have the 3 argument form of open()." >&4
8241                 val="$define"
8242         else
8243                 echo "but not the 3 argument form of open().  Oh, well." >&4
8244                 val="$undef"
8245         fi
8246 else
8247         val="$undef"
8248         echo "I can't find the O_* constant definitions!  You got problems." >&4
8249 fi
8250 set d_open3
8251 eval $setvar
8252 $rm -f open3*
8253
8254 : check for non-blocking I/O stuff
8255 case "$h_sysfile" in
8256 true) echo "#include <sys/file.h>" > head.c;;
8257 *)
8258         case "$h_fcntl" in
8259         true) echo "#include <fcntl.h>" > head.c;;
8260         *) echo "#include <sys/fcntl.h>" > head.c;;
8261         esac
8262         ;;
8263 esac
8264 echo " "
8265 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
8266 case "$o_nonblock" in
8267 '')
8268         $cat head.c > try.c
8269         $cat >>try.c <<'EOCP'
8270 int main() {
8271 #ifdef O_NONBLOCK
8272         printf("O_NONBLOCK\n");
8273         exit(0);
8274 #endif
8275 #ifdef O_NDELAY
8276         printf("O_NDELAY\n");
8277         exit(0);
8278 #endif
8279 #ifdef FNDELAY
8280         printf("FNDELAY\n");
8281         exit(0);
8282 #endif
8283         exit(0);
8284 }
8285 EOCP
8286         set try
8287         if eval $compile_ok; then
8288                 o_nonblock=`./try`
8289                 case "$o_nonblock" in
8290                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
8291                 *) echo "Seems like we can use $o_nonblock.";;
8292                 esac
8293         else
8294                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
8295         fi
8296         ;;
8297 *) echo "Using $hint value $o_nonblock.";;
8298 esac
8299 $rm -f try try.* .out core
8300
8301 echo " "
8302 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
8303 case "$eagain" in
8304 '')
8305         $cat head.c > try.c
8306         $cat >>try.c <<EOCP
8307 #include <errno.h>
8308 #include <sys/types.h>
8309 #include <signal.h>
8310 #define MY_O_NONBLOCK $o_nonblock
8311 #ifndef errno  /* XXX need better Configure test */
8312 extern int errno;
8313 #endif
8314 $signal_t blech(x) int x; { exit(3); }
8315 EOCP
8316         $cat >> try.c <<'EOCP'
8317 int main()
8318 {
8319         int pd[2];
8320         int pu[2];
8321         char buf[1];
8322         char string[100];
8323
8324         pipe(pd);       /* Down: child -> parent */
8325         pipe(pu);       /* Up: parent -> child */
8326         if (0 != fork()) {
8327                 int ret;
8328                 close(pd[1]);   /* Parent reads from pd[0] */
8329                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
8330                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
8331                         exit(1);
8332                 signal(SIGALRM, blech);
8333                 alarm(5);
8334                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
8335                         exit(2);
8336                 sprintf(string, "%d\n", ret);
8337                 write(2, string, strlen(string));
8338                 alarm(0);
8339 #ifdef EAGAIN
8340                 if (errno == EAGAIN) {
8341                         printf("EAGAIN\n");
8342                         goto ok;
8343                 }
8344 #endif
8345 #ifdef EWOULDBLOCK
8346                 if (errno == EWOULDBLOCK)
8347                         printf("EWOULDBLOCK\n");
8348 #endif
8349         ok:
8350                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
8351                 sleep(2);                               /* Give it time to close our pipe */
8352                 alarm(5);
8353                 ret = read(pd[0], buf, 1);      /* Should read EOF */
8354                 alarm(0);
8355                 sprintf(string, "%d\n", ret);
8356                 write(3, string, strlen(string));
8357                 exit(0);
8358         }
8359
8360         close(pd[0]);                   /* We write to pd[1] */
8361         close(pu[1]);                   /* We read from pu[0] */
8362         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
8363         close(pd[1]);                   /* Pipe pd is now fully closed! */
8364         exit(0);                                /* Bye bye, thank you for playing! */
8365 }
8366 EOCP
8367         set try
8368         if eval $compile_ok; then
8369                 echo "$startsh" >mtry
8370                 echo "./try >try.out 2>try.ret 3>try.err || exit 4" >>mtry
8371                 chmod +x mtry
8372                 ./mtry >/dev/null 2>&1
8373                 case $? in
8374                 0) eagain=`$cat try.out`;;
8375                 1) echo "Could not perform non-blocking setting!";;
8376                 2) echo "I did a successful read() for something that was not there!";;
8377                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
8378                 *) echo "Something terribly wrong happened during testing.";;
8379                 esac
8380                 rd_nodata=`$cat try.ret`
8381                 echo "A read() system call with no data present returns $rd_nodata."
8382                 case "$rd_nodata" in
8383                 0|-1) ;;
8384                 *)
8385                         echo "(That's peculiar, fixing that to be -1.)"
8386                         rd_nodata=-1
8387                         ;;
8388                 esac
8389                 case "$eagain" in
8390                 '')
8391                         echo "Forcing errno EAGAIN on read() with no data available."
8392                         eagain=EAGAIN
8393                         ;;
8394                 *)
8395                         echo "Your read() sets errno to $eagain when no data is available."
8396                         ;;
8397                 esac
8398                 status=`$cat try.err`
8399                 case "$status" in
8400                 0) echo "And it correctly returns 0 to signal EOF.";;
8401                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
8402                 *) echo "However, your read() returns '$status' on EOF??";;
8403                 esac
8404                 val="$define"
8405                 if test "$status" = "$rd_nodata"; then
8406                         echo "WARNING: you can't distinguish between EOF and no data!"
8407                         val="$undef"
8408                 fi
8409         else
8410                 echo "I can't compile the test program--assuming errno EAGAIN will do."
8411                 eagain=EAGAIN
8412         fi
8413         set d_eofnblk
8414         eval $setvar
8415         ;;
8416 *)
8417         echo "Using $hint value $eagain."
8418         echo "Your read() returns $rd_nodata when no data is present."
8419         case "$d_eofnblk" in
8420         "$define") echo "And you can see EOF because read() returns 0.";;
8421         "$undef") echo "But you can't see EOF status from read() returned value.";;
8422         *)
8423                 echo "(Assuming you can't see EOF status from read anyway.)"
8424                 d_eofnblk=$undef
8425                 ;;
8426         esac
8427         ;;
8428 esac
8429 $rm -f try try.* .out core head.c mtry
8430
8431 : see if fchmod exists
8432 set fchmod d_fchmod
8433 eval $inlibc
8434
8435 : see if fchown exists
8436 set fchown d_fchown
8437 eval $inlibc
8438
8439 : see if this is an fcntl system
8440 set fcntl d_fcntl
8441 eval $inlibc
8442
8443 : see if sys/select.h has to be included
8444 set sys/select.h i_sysselct
8445 eval $inhdr
8446
8447 : see if we should include time.h, sys/time.h, or both
8448 echo " "
8449 if test "X$timeincl" = X; then
8450         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
8451         $echo $n "I'm now running the test program...$c"
8452         $cat >try.c <<'EOCP'
8453 #include <sys/types.h>
8454 #ifdef I_TIME
8455 #include <time.h>
8456 #endif
8457 #ifdef I_SYSTIME
8458 #ifdef SYSTIMEKERNEL
8459 #define KERNEL
8460 #endif
8461 #include <sys/time.h>
8462 #endif
8463 #ifdef I_SYSSELECT
8464 #include <sys/select.h>
8465 #endif
8466 int main()
8467 {
8468         struct tm foo;
8469 #ifdef S_TIMEVAL
8470         struct timeval bar;
8471 #endif
8472 #ifdef S_TIMEZONE
8473         struct timezone tzp;
8474 #endif
8475         if (foo.tm_sec == foo.tm_sec)
8476                 exit(0);
8477 #ifdef S_TIMEVAL
8478         if (bar.tv_sec == bar.tv_sec)
8479                 exit(0);
8480 #endif
8481         exit(1);
8482 }
8483 EOCP
8484         flags=''
8485         for s_timezone in '-DS_TIMEZONE' ''; do
8486         sysselect=''
8487         for s_timeval in '-DS_TIMEVAL' ''; do
8488         for i_systimek in '' '-DSYSTIMEKERNEL'; do
8489         for i_time in '' '-DI_TIME'; do
8490         for i_systime in '-DI_SYSTIME' ''; do
8491                 case "$flags" in
8492                 '') $echo $n ".$c"
8493                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
8494                         if eval $compile; then
8495                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
8496                                 shift
8497                                 flags="$*"
8498                                 echo " "
8499                                 $echo $n "Succeeded with $flags$c"
8500                         fi
8501                         ;;
8502                 esac
8503         done
8504         done
8505         done
8506         done
8507         done
8508         timeincl=''
8509         echo " "
8510         case "$flags" in
8511         *SYSTIMEKERNEL*) i_systimek="$define"
8512                 timeincl=`./findhdr sys/time.h`
8513                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
8514         *) i_systimek="$undef";;
8515         esac
8516         case "$flags" in
8517         *I_TIME*) i_time="$define"
8518                 timeincl=`./findhdr time.h`" $timeincl"
8519                 echo "We'll include <time.h>." >&4;;
8520         *) i_time="$undef";;
8521         esac
8522         case "$flags" in
8523         *I_SYSTIME*) i_systime="$define"
8524                 timeincl=`./findhdr sys/time.h`" $timeincl"
8525                 echo "We'll include <sys/time.h>." >&4;;
8526         *) i_systime="$undef";;
8527         esac
8528         $rm -f try.c try
8529 fi
8530
8531 : check for fd_set items
8532 $cat <<EOM
8533
8534 Checking to see how well your C compiler handles fd_set and friends ...
8535 EOM
8536 $cat >fd_set.c <<EOCP
8537 #$i_systime I_SYS_TIME
8538 #$i_sysselct I_SYS_SELECT
8539 #$d_socket HAS_SOCKET
8540 #include <sys/types.h>
8541 #ifdef HAS_SOCKET
8542 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
8543 #endif
8544 #ifdef I_SYS_TIME
8545 #include <sys/time.h>
8546 #endif
8547 #ifdef I_SYS_SELECT
8548 #include <sys/select.h>
8549 #endif
8550 int main() {
8551         fd_set fds;
8552
8553 #ifdef TRYBITS
8554         if(fds.fds_bits);
8555 #endif
8556
8557 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
8558         exit(0);
8559 #else
8560         exit(1);
8561 #endif
8562 }
8563 EOCP
8564 set fd_set -DTRYBITS
8565 if eval $compile; then
8566         d_fds_bits="$define"
8567         d_fd_set="$define"
8568         echo "Well, your system knows about the normal fd_set typedef..." >&4
8569         if ./fd_set; then
8570                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
8571                 d_fd_macros="$define"
8572         else
8573                 $cat >&4 <<'EOM'
8574 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
8575 EOM
8576                 d_fd_macros="$undef"
8577         fi
8578 else
8579         $cat <<'EOM'
8580 Hmm, your compiler has some difficulty with fd_set.  Checking further...
8581 EOM
8582         set fd_set
8583         if eval $compile; then
8584                 d_fds_bits="$undef"
8585                 d_fd_set="$define"
8586                 echo "Well, your system has some sort of fd_set available..." >&4
8587                 if ./fd_set; then
8588                         echo "and you have the normal fd_set macros." >&4
8589                         d_fd_macros="$define"
8590                 else
8591                         $cat <<'EOM'
8592 but not the normal fd_set macros!  Gross!  More work for me...
8593 EOM
8594                         d_fd_macros="$undef"
8595                 fi
8596         else
8597         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
8598                 d_fd_set="$undef"
8599                 d_fds_bits="$undef"
8600                 d_fd_macros="$undef"
8601         fi
8602 fi
8603 $rm -f fd_set*
8604
8605 : see if fgetpos exists
8606 set fgetpos d_fgetpos
8607 eval $inlibc
8608
8609 : see if flock exists
8610 set flock d_flock
8611 eval $inlibc
8612
8613 : see if fork exists
8614 set fork d_fork
8615 eval $inlibc
8616
8617 : see if pathconf exists
8618 set pathconf d_pathconf
8619 eval $inlibc
8620
8621 : see if fpathconf exists
8622 set fpathconf d_fpathconf
8623 eval $inlibc
8624
8625
8626 : see if llseek exists
8627 set llseek d_llseek
8628 eval $inlibc
8629
8630 : check for off64_t
8631 echo " "
8632 $echo $n "Checking to see if your system supports off64_t...$c" >&4
8633 $cat >try.c <<EOCP
8634 #include <sys/types.h>
8635 #include <unistd.h>
8636 off64_t foo() { off64_t x; x = 7; return x; }'
8637 EOCP
8638 if $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then
8639         val="$define"
8640         echo " Yup, it does." >&4
8641 else
8642         val="$undef"
8643         echo " Nope, it doesn't." >&4
8644 fi
8645 $rm -f try.*
8646 set d_off64_t
8647 eval $setvar
8648
8649 : check for fpos64_t
8650 echo " "
8651 $echo $n "Checking to see if your system supports fpos64_t...$c" >&4
8652 $cat >try.c <<EOCP
8653 #include <sys/stdio.h>
8654 fpos64_t foo() { fpos64_t x; x = 7; return x; }'
8655 EOCP
8656 if $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then
8657         val="$define"
8658         echo " Yup, it does." >&4
8659 else
8660         val="$undef"
8661         echo " Nope, it doesn't." >&4
8662 fi
8663 $rm -f try.*
8664 set d_fpos64_t
8665 eval $setvar
8666
8667 : see if fseeko exists
8668 set fseeko d_fseeko
8669 eval $inlibc
8670
8671 : see if fsetpos exists
8672 set fsetpos d_fsetpos
8673 eval $inlibc
8674
8675 : see if this is a sys/param system
8676 set sys/param.h i_sysparam
8677 eval $inhdr
8678
8679 : see if this is a sys/mount.h system
8680 set sys/mount.h i_sysmount
8681 eval $inhdr
8682
8683
8684 : see if statfs exists
8685 set statfs d_statfs
8686 eval $inlibc
8687
8688 : see if fstatfs exists
8689 set fstatfs d_fstatfs
8690 eval $inlibc
8691
8692 : see if statfs knows about mount flags
8693 set d_statfsflags statfs f_flags $i_sysparam sys/param.h $i_sysmount sys/mount.h
8694 eval $hasfield
8695
8696
8697 : see if statvfs exists
8698 set statvfs d_statvfs
8699 eval $inlibc
8700
8701 : see if fstatvfs exists
8702 set fstatvfs d_fstatvfs
8703 eval $inlibc
8704
8705
8706 : see if ftello exists
8707 set ftello d_ftello
8708 eval $inlibc
8709
8710 : see if getgrent exists
8711 set getgrent d_getgrent
8712 eval $inlibc
8713
8714 : see if gethostbyaddr exists
8715 set gethostbyaddr d_gethbyaddr
8716 eval $inlibc
8717
8718 : see if gethostbyname exists
8719 set gethostbyname d_gethbyname
8720 eval $inlibc
8721
8722 : see if gethostent exists
8723 set gethostent d_gethent
8724 eval $inlibc
8725
8726 : see how we will look up host name
8727 echo " "
8728 call=''
8729 if set gethostname val -f d_gethname; eval $csym; $val; then
8730         echo 'gethostname() found.' >&4
8731         d_gethname="$define"
8732         call=gethostname
8733 fi
8734 if set uname val -f d_uname; eval $csym; $val; then
8735         if ./xenix; then
8736                 $cat <<'EOM'
8737 uname() was found, but you're running xenix, and older versions of xenix
8738 have a broken uname(). If you don't really know whether your xenix is old
8739 enough to have a broken system call, use the default answer.
8740
8741 EOM
8742                 dflt=y
8743                 case "$d_uname" in
8744                 "$define") dflt=n;;
8745                 esac
8746                 rp='Is your uname() broken?'
8747                 . ./myread
8748                 case "$ans" in
8749                 n*) d_uname="$define"; call=uname;;
8750                 esac
8751         else
8752                 echo 'uname() found.' >&4
8753                 d_uname="$define"
8754                 case "$call" in
8755                 '') call=uname ;;
8756                 esac
8757         fi
8758 fi
8759 case "$d_gethname" in
8760 '') d_gethname="$undef";;
8761 esac
8762 case "$d_uname" in
8763 '') d_uname="$undef";;
8764 esac
8765 case "$d_uname$d_gethname" in
8766 *define*)
8767         dflt=n
8768         cat <<EOM
8769  
8770 Every now and then someone has a $call() that lies about the hostname
8771 but can't be fixed for political or economic reasons.  If you wish, I can
8772 pretend $call() isn't there and maybe compute hostname at run-time
8773 thanks to the '$phostname' command.
8774
8775 EOM
8776         rp="Shall I ignore $call() from now on?"
8777         . ./myread
8778         case "$ans" in
8779         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
8780         esac;;
8781 esac
8782 case "$phostname" in
8783 '') aphostname='';;
8784 *) case "$aphostname" in
8785         /*) ;;
8786         *) set X $phostname
8787                 shift
8788                 file=$1
8789                 shift
8790                 file=`./loc $file $file $pth`
8791                 aphostname=`echo $file $*`
8792                 ;;
8793         esac
8794         ;;
8795 esac
8796 case "$d_uname$d_gethname" in
8797 *define*) ;;
8798 *)
8799         case "$phostname" in
8800         '')
8801                 echo "There will be no way for $package to get your hostname." >&4;;
8802         *)
8803         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
8804                 ;;
8805         esac;;
8806 esac
8807 case "$d_phostname" in
8808 '') d_phostname="$undef";;
8809 esac
8810
8811 : see if this is a netdb.h system
8812 set netdb.h i_netdb
8813 eval $inhdr
8814
8815 : see if prototypes for various gethostxxx netdb.h functions are available
8816 echo " "
8817 set d_gethostprotos gethostent $i_netdb netdb.h
8818 eval $hasproto
8819
8820 : see if getlogin exists
8821 set getlogin d_getlogin
8822 eval $inlibc
8823
8824 : see if getmntent exists
8825 set getmntent d_getmntent
8826 eval $inlibc
8827
8828 : see if getnetbyaddr exists
8829 set getnetbyaddr d_getnbyaddr
8830 eval $inlibc
8831
8832 : see if getnetbyname exists
8833 set getnetbyname d_getnbyname
8834 eval $inlibc
8835
8836 : see if getnetent exists
8837 set getnetent d_getnent
8838 eval $inlibc
8839
8840 : see if prototypes for various getnetxxx netdb.h functions are available
8841 echo " "
8842 set d_getnetprotos getnetent $i_netdb netdb.h
8843 eval $hasproto
8844
8845
8846 : see if getprotobyname exists
8847 set getprotobyname d_getpbyname
8848 eval $inlibc
8849
8850 : see if getprotobynumber exists
8851 set getprotobynumber d_getpbynumber
8852 eval $inlibc
8853
8854 : see if getprotoent exists
8855 set getprotoent d_getpent
8856 eval $inlibc
8857
8858 : see if getpgid exists
8859 set getpgid d_getpgid
8860 eval $inlibc
8861
8862 : see if getpgrp2 exists
8863 set getpgrp2 d_getpgrp2
8864 eval $inlibc
8865
8866 : see if getppid exists
8867 set getppid d_getppid
8868 eval $inlibc
8869
8870 : see if getpriority exists
8871 set getpriority d_getprior
8872 eval $inlibc
8873
8874 : see if prototypes for various getprotoxxx netdb.h functions are available
8875 echo " "
8876 set d_getprotoprotos getprotoent $i_netdb netdb.h
8877 eval $hasproto
8878
8879 : see if getpwent exists
8880 set getpwent d_getpwent
8881 eval $inlibc
8882
8883
8884 : see if getservbyname exists
8885 set getservbyname d_getsbyname
8886 eval $inlibc
8887
8888 : see if getservbyport exists
8889 set getservbyport d_getsbyport
8890 eval $inlibc
8891
8892 : see if getservent exists
8893 set getservent d_getsent
8894 eval $inlibc
8895
8896 : see if prototypes for various getservxxx netdb.h functions are available
8897 echo " "
8898 set d_getservprotos getservent $i_netdb netdb.h
8899 eval $hasproto
8900
8901 : see if getspent exists
8902 set getspent d_getspent
8903 eval $inlibc
8904
8905 : see if getspnam exists
8906 set getspnam d_getspnam
8907 eval $inlibc
8908
8909 : see if gettimeofday or ftime exists
8910 set gettimeofday d_gettimeod
8911 eval $inlibc
8912 case "$d_gettimeod" in
8913 "$undef")
8914         set ftime d_ftime 
8915         eval $inlibc
8916         ;;
8917 *)
8918         val="$undef"; set d_ftime; eval $setvar
8919         ;;
8920 esac
8921 case "$d_gettimeod$d_ftime" in
8922 "$undef$undef")
8923         echo " "
8924         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
8925         ;;
8926 esac
8927
8928 : see if this is an grp system
8929 set grp.h i_grp
8930 eval $inhdr
8931
8932 case "$i_grp" in
8933 $define)
8934         xxx=`./findhdr grp.h`
8935         $cppstdin $cppflags $cppminus < $xxx >$$.h
8936
8937         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
8938                 val="$define"
8939         else
8940                 val="$undef"
8941         fi
8942         set d_grpasswd
8943         eval $setvar
8944
8945         $rm -f $$.h
8946         ;;
8947 *)
8948         val="$undef";
8949         set d_grpasswd; eval $setvar
8950         ;;
8951 esac
8952
8953 : see if hasmntopt exists
8954 set hasmntopt d_hasmntopt
8955 eval $inlibc
8956
8957 : see if this is a netinet/in.h or sys/in.h system
8958 set netinet/in.h i_niin sys/in.h i_sysin
8959 eval $inhdr
8960
8961 : see if arpa/inet.h has to be included
8962 set arpa/inet.h i_arpainet
8963 eval $inhdr
8964
8965 : see if htonl --and friends-- exists
8966 val=''
8967 set htonl val
8968 eval $inlibc
8969
8970 : Maybe they are macros.
8971 case "$val" in
8972 $undef)
8973         $cat >htonl.c <<EOM
8974 #include <stdio.h>
8975 #include <sys/types.h>
8976 #$i_niin I_NETINET_IN
8977 #$i_sysin I_SYS_IN
8978 #$i_arpainet I_ARPA_INET
8979 #ifdef I_NETINET_IN
8980 #include <netinet/in.h>
8981 #endif
8982 #ifdef I_SYS_IN
8983 #include <sys/in.h>
8984 #endif
8985 #ifdef I_ARPA_INET
8986 #include <arpa/inet.h>
8987 #endif
8988 #ifdef htonl
8989 printf("Defined as a macro.");
8990 #endif
8991 EOM
8992         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
8993         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
8994                 val="$define"
8995                 echo "But it seems to be defined as a macro." >&4
8996         fi
8997         $rm -f htonl.?
8998         ;;
8999 esac
9000 set d_htonl
9001 eval $setvar
9002
9003 : see which of string.h or strings.h is needed
9004 echo " "
9005 strings=`./findhdr string.h`
9006 if $test "$strings" && $test -r "$strings"; then
9007         echo "Using <string.h> instead of <strings.h>." >&4
9008         val="$define"
9009 else
9010         val="$undef"
9011         strings=`./findhdr strings.h`
9012         if $test "$strings" && $test -r "$strings"; then
9013                 echo "Using <strings.h> instead of <string.h>." >&4
9014         else
9015                 echo "No string header found -- You'll surely have problems." >&4
9016         fi
9017 fi
9018 set i_string
9019 eval $setvar
9020 case "$i_string" in
9021 "$undef") strings=`./findhdr strings.h`;;
9022 *)        strings=`./findhdr string.h`;;
9023 esac
9024
9025 : index or strchr
9026 echo " "
9027 if set index val -f; eval $csym; $val; then
9028         if set strchr val -f d_strchr; eval $csym; $val; then
9029                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
9030                         val="$define"
9031                         vali="$undef"
9032                         echo "strchr() found." >&4
9033                 else
9034                         val="$undef"
9035                         vali="$define"
9036                         echo "index() found." >&4
9037                 fi
9038         else
9039                 val="$undef"
9040                 vali="$define"
9041                 echo "index() found." >&4
9042         fi
9043 else
9044         if set strchr val -f d_strchr; eval $csym; $val; then
9045                 val="$define"
9046                 vali="$undef"
9047                 echo "strchr() found." >&4
9048         else
9049                 echo "No index() or strchr() found!" >&4
9050                 val="$undef"
9051                 vali="$undef"
9052         fi
9053 fi
9054 set d_strchr; eval $setvar
9055 val="$vali"
9056 set d_index; eval $setvar
9057
9058 : check whether inet_aton exists
9059 set inet_aton d_inetaton
9060 eval $inlibc
9061
9062 : Look for isascii
9063 echo " "
9064 $cat >isascii.c <<'EOCP'
9065 #include <stdio.h>
9066 #include <ctype.h>
9067 int main() {
9068         int c = 'A';
9069         if (isascii(c))
9070                 exit(0);
9071         else
9072                 exit(1);
9073 }
9074 EOCP
9075 set isascii
9076 if eval $compile; then
9077         echo "isascii() found." >&4
9078         val="$define"
9079 else
9080         echo "isascii() NOT found." >&4
9081         val="$undef"
9082 fi
9083 set d_isascii
9084 eval $setvar
9085 $rm -f isascii*
9086
9087 : see if killpg exists
9088 set killpg d_killpg
9089 eval $inlibc
9090
9091 : see if lchown exists
9092 echo " "
9093 $cat > try.c <<'EOCP'
9094 /* System header to define __stub macros and hopefully few prototypes,
9095     which can conflict with char lchown(); below.  */
9096 #include <assert.h>
9097 /* Override any gcc2 internal prototype to avoid an error.  */
9098 /* We use char because int might match the return type of a gcc2
9099    builtin and then its argument prototype would still apply.  */
9100 char lchown();
9101 int main() {
9102     /*  The GNU C library defines this for functions which it implements
9103         to always fail with ENOSYS.  Some functions are actually named
9104         something starting with __ and the normal name is an alias.  */
9105 #if defined (__stub_lchown) || defined (__stub___lchown)
9106 choke me
9107 #else
9108 lchown();
9109 #endif
9110 ; return 0; }
9111 EOCP
9112 set try
9113 if eval $compile; then
9114     $echo "lchown() found." >&4
9115     val="$define"
9116 else
9117     $echo "lchown() NOT found." >&4
9118     val="$undef"
9119 fi
9120 set d_lchown
9121 eval $setvar
9122
9123 : See if number of significant digits in a double precision number is known
9124 echo " "
9125 $cat >ldbl_dig.c <<EOM
9126 #$i_limits I_LIMITS
9127 #$i_float I_FLOAT
9128 #ifdef I_LIMITS
9129 #include <limits.h>
9130 #endif
9131 #ifdef I_FLOAT
9132 #include <float.h>
9133 #endif
9134 #ifdef LDBL_DIG
9135 printf("Contains LDBL_DIG");
9136 #endif
9137 EOM
9138 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
9139 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
9140         echo "LDBL_DIG found." >&4
9141         val="$define"
9142 else
9143         echo "LDBL_DIG NOT found." >&4
9144         val="$undef"
9145 fi
9146 $rm -f ldbl_dig.?
9147 set d_ldbl_dig
9148 eval $setvar
9149
9150 : see if link exists
9151 set link d_link
9152 eval $inlibc
9153
9154 : see if localeconv exists
9155 set localeconv d_locconv
9156 eval $inlibc
9157
9158 : see if lockf exists
9159 set lockf d_lockf
9160 eval $inlibc
9161
9162 : see if lstat exists
9163 set lstat d_lstat
9164 eval $inlibc
9165
9166 : see if madvise exists
9167 set madvise d_madvise
9168 eval $inlibc
9169
9170 : see if mblen exists
9171 set mblen d_mblen
9172 eval $inlibc
9173
9174 : see if mbstowcs exists
9175 set mbstowcs d_mbstowcs
9176 eval $inlibc
9177
9178 : see if mbtowc exists
9179 set mbtowc d_mbtowc
9180 eval $inlibc
9181
9182 : see if memchr exists
9183 set memchr d_memchr
9184 eval $inlibc
9185
9186 : see if memcmp exists
9187 set memcmp d_memcmp
9188 eval $inlibc
9189
9190 : see if memcpy exists
9191 set memcpy d_memcpy
9192 eval $inlibc
9193
9194 : see if memmove exists
9195 set memmove d_memmove
9196 eval $inlibc
9197
9198 : see if memset exists
9199 set memset d_memset
9200 eval $inlibc
9201
9202 : see if mkdir exists
9203 set mkdir d_mkdir
9204 eval $inlibc
9205
9206 : see if mkfifo exists
9207 set mkfifo d_mkfifo
9208 eval $inlibc
9209
9210 : see if mktime exists
9211 set mktime d_mktime
9212 eval $inlibc
9213
9214 : see if this is a sys/mman.h system
9215 set sys/mman.h i_sysmman
9216 eval $inhdr
9217
9218 : see if mmap exists
9219 set mmap d_mmap
9220 eval $inlibc
9221 : see what shmat returns
9222 : default to something harmless
9223 mmaptype='void *'
9224 case "$i_sysmman$d_mmap" in
9225 "$define$define")
9226         $cat >mmap.c <<'END'
9227 #include <sys/mman.h>
9228 void *mmap();
9229 END
9230         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
9231                 mmaptype='void *'
9232         else
9233                 mmaptype='caddr_t'
9234         fi
9235         echo "and it returns ($mmaptype)." >&4
9236         ;;
9237 esac
9238
9239
9240
9241 : see if mprotect exists
9242 set mprotect d_mprotect
9243 eval $inlibc
9244
9245 : see if msgctl exists
9246 set msgctl d_msgctl
9247 eval $inlibc
9248
9249 : see if msgget exists
9250 set msgget d_msgget
9251 eval $inlibc
9252
9253 : see if msgsnd exists
9254 set msgsnd d_msgsnd
9255 eval $inlibc
9256
9257 : see if msgrcv exists
9258 set msgrcv d_msgrcv
9259 eval $inlibc
9260
9261 : see how much of the 'msg*(2)' library is present.
9262 h_msg=true
9263 echo " "
9264 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
9265 *"$undef"*) h_msg=false;;
9266 esac
9267 case "$osname" in
9268 freebsd)
9269     case "`ipcs 2>&1`" in
9270     "SVID messages"*"not configured"*)
9271         echo "Your $osname does not have the msg*(2) configured." >&4
9272         h_msg=false
9273         val="$undef"
9274         set msgctl d_msgctl
9275         eval $setvar
9276         set msgget d_msgget
9277         eval $setvar
9278         set msgsnd d_msgsnd
9279         eval $setvar
9280         set msgrcv d_msgrcv
9281         eval $setvar
9282         ;;
9283     esac
9284     ;;
9285 esac
9286 : we could also check for sys/ipc.h ...
9287 if $h_msg && $test `./findhdr sys/msg.h`; then
9288         echo "You have the full msg*(2) library." >&4
9289         val="$define"
9290 else
9291         echo "You don't have the full msg*(2) library." >&4
9292         val="$undef"
9293 fi
9294 set d_msg
9295 eval $setvar
9296
9297 : see if msync exists
9298 set msync d_msync
9299 eval $inlibc
9300
9301 : see if munmap exists
9302 set munmap d_munmap
9303 eval $inlibc
9304
9305 : see if nice exists
9306 set nice d_nice
9307 eval $inlibc
9308
9309 : see if POSIX threads are available
9310 set pthread.h i_pthread
9311 eval $inhdr
9312
9313
9314
9315
9316 : how to create joinable pthreads
9317 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
9318         echo " "
9319         echo "Checking what constant to use for creating joinable pthreads..." >&4 
9320         $cat >try.c <<'EOCP'
9321 #include <pthread.h>
9322 int main() {
9323     int detachstate = JOINABLE;
9324 }
9325 EOCP
9326         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
9327         if eval $compile; then
9328                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
9329                 val="$undef" # Yes, undef.
9330                 set d_old_pthread_create_joinable
9331                 eval $setvar
9332                 val=""
9333                 set old_pthread_create_joinable
9334                 eval $setvar
9335         else
9336                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
9337                 if eval $compile; then
9338                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
9339                         val="$define"
9340                         set d_old_pthread_create_joinable
9341                         eval $setvar
9342                         val=PTHREAD_CREATE_UNDETACHED
9343                         set old_pthread_create_joinable
9344                         eval $setvar
9345                 else            
9346                         set try -DJOINABLE=__UNDETACHED
9347                         if eval $compile; then
9348                                 echo "You seem to use __UNDETACHED." >&4
9349                                 val="$define"
9350                                 set d_old_pthread_create_joinable
9351                                 eval $setvar
9352                                 val=__UNDETACHED
9353                                 set old_pthread_create_joinable
9354                                 eval $setvar
9355                         else
9356                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
9357                                 val="$define"
9358                                 set d_old_pthread_create_joinable
9359                                 eval $setvar
9360                                 val=0
9361                                 set old_pthread_create_joinable
9362                                 eval $setvar
9363                         fi
9364                 fi
9365         fi
9366         $rm -f try try.*
9367 else
9368     d_old_pthread_create_joinable="$undef"
9369     old_pthread_create_joinable=""
9370 fi
9371
9372 : see if pause exists
9373 set pause d_pause
9374 eval $inlibc
9375
9376 : see if pipe exists
9377 set pipe d_pipe
9378 eval $inlibc
9379
9380 : see if poll exists
9381 set poll d_poll
9382 eval $inlibc
9383
9384
9385 : see whether the various POSIXish _yields exist
9386 $cat >try.c <<EOP
9387 #include <pthread.h>
9388 #include <stdio.h>
9389 int main() {
9390 #ifdef SCHED_YIELD
9391         sched_yield();
9392 #else
9393 #ifdef PTHREAD_YIELD
9394         pthread_yield();
9395 #else
9396 #ifdef PTHREAD_YIELD_NULL
9397         pthread_yield(NULL);
9398 #endif
9399 #endif
9400 #endif
9401 }
9402 EOP
9403 : see if sched_yield exists
9404 set try -DSCHED_YIELD
9405 if eval $compile; then
9406     val="$define"
9407     sched_yield='sched_yield()'
9408 else
9409     val="$undef"
9410 fi
9411 case "$usethreads" in
9412 $define)
9413         case "$val" in
9414         $define) echo 'sched_yield() found.' >&4        ;;
9415         *)       echo 'sched_yield() NOT found.' >&4    ;;
9416         esac
9417 esac
9418 set d_sched_yield
9419 eval $setvar
9420
9421 : see if pthread_yield exists
9422 set try -DPTHREAD_YIELD
9423 if eval $compile; then
9424     val="$define"
9425     case "$sched_yield" in
9426     '') sched_yield='pthread_yield()' ;;
9427     esac
9428 else
9429     set try -DPTHREAD_YIELD_NULL
9430     if eval $compile; then
9431         val="$define"
9432         case "$sched_yield" in
9433         '') sched_yield='pthread_yield(NULL)' ;;
9434         esac
9435     else
9436         val="$undef"
9437     fi
9438 fi
9439 case "$usethreads" in
9440 $define)
9441         case "$val" in
9442         $define) echo 'pthread_yield() found.' >&4      ;;
9443         *)       echo 'pthread_yield() NOT found.' >&4  ;;
9444         esac
9445         ;;
9446 esac
9447 set d_pthread_yield
9448 eval $setvar
9449
9450 case "$sched_yield" in
9451 '') sched_yield=undef ;;
9452 esac
9453
9454 $rm -f try try.*
9455
9456 : see if this is a pwd.h system
9457 set pwd.h i_pwd
9458 eval $inhdr
9459
9460 case "$i_pwd" in
9461 $define)
9462         xxx=`./findhdr pwd.h`
9463         $cppstdin $cppflags $cppminus < $xxx >$$.h
9464
9465         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
9466                 val="$define"
9467         else
9468                 val="$undef"
9469         fi
9470         set d_pwquota
9471         eval $setvar
9472
9473         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
9474                 val="$define"
9475         else
9476                 val="$undef"
9477         fi
9478         set d_pwage
9479         eval $setvar
9480
9481         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
9482                 val="$define"
9483         else
9484                 val="$undef"
9485         fi
9486         set d_pwchange
9487         eval $setvar
9488
9489         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
9490                 val="$define"
9491         else
9492                 val="$undef"
9493         fi
9494         set d_pwclass
9495         eval $setvar
9496
9497         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
9498                 val="$define"
9499         else
9500                 val="$undef"
9501         fi
9502         set d_pwexpire
9503         eval $setvar
9504
9505         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
9506                 val="$define"
9507         else
9508                 val="$undef"
9509         fi
9510         set d_pwcomment
9511         eval $setvar
9512
9513         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
9514                 val="$define"
9515         else
9516                 val="$undef"
9517         fi
9518         set d_pwgecos
9519         eval $setvar
9520
9521         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
9522                 val="$define"
9523         else
9524                 val="$undef"
9525         fi
9526         set d_pwpasswd
9527         eval $setvar
9528
9529         $rm -f $$.h
9530         ;;
9531 *)
9532         val="$undef"; 
9533         set d_pwquota; eval $setvar
9534         set d_pwage; eval $setvar
9535         set d_pwchange; eval $setvar
9536         set d_pwclass; eval $setvar
9537         set d_pwexpire; eval $setvar
9538         set d_pwcomment; eval $setvar
9539         set d_pwgecos; eval $setvar
9540         set d_pwpasswd; eval $setvar
9541         ;;
9542 esac
9543
9544 : see if readdir and friends exist
9545 set readdir d_readdir
9546 eval $inlibc
9547 set seekdir d_seekdir
9548 eval $inlibc
9549 set telldir d_telldir
9550 eval $inlibc
9551 set rewinddir d_rewinddir
9552 eval $inlibc
9553
9554 : see if readlink exists
9555 set readlink d_readlink
9556 eval $inlibc
9557
9558 : see if readv exists
9559 set readv d_readv
9560 eval $inlibc
9561
9562 : see if rename exists
9563 set rename d_rename
9564 eval $inlibc
9565
9566 : see if rmdir exists
9567 set rmdir d_rmdir
9568 eval $inlibc
9569
9570 : see if memory.h is available.
9571 val=''
9572 set memory.h val
9573 eval $inhdr
9574
9575 : See if it conflicts with string.h
9576 case "$val" in
9577 $define)
9578         case "$strings" in
9579         '') ;;
9580         *)
9581                 $cppstdin $cppflags $cppminus < $strings > mem.h
9582                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
9583                         echo " "
9584                         echo "We won't be including <memory.h>."
9585                         val="$undef"
9586                 fi
9587                 $rm -f mem.h
9588                 ;;
9589         esac
9590 esac
9591 set i_memory
9592 eval $setvar
9593
9594 : can bcopy handle overlapping blocks?
9595 val="$undef"
9596 case "$d_bcopy" in
9597 "$define")
9598         echo " "
9599         echo "Checking to see if your bcopy() can do overlapping copies..." >&4
9600         $cat >try.c <<EOCP
9601 #$i_memory I_MEMORY
9602 #$i_stdlib I_STDLIB
9603 #$i_string I_STRING
9604 #$i_unistd I_UNISTD
9605 EOCP
9606         $cat >>try.c <<'EOCP'
9607 #include <stdio.h>
9608 #ifdef I_MEMORY
9609 #  include <memory.h>
9610 #endif
9611 #ifdef I_STDLIB
9612 #  include <stdlib.h>
9613 #endif
9614 #ifdef I_STRING
9615 #  include <string.h>
9616 #else
9617 #  include <strings.h>
9618 #endif
9619 #ifdef I_UNISTD
9620 #  include <unistd.h>  /* Needed for NetBSD */
9621 #endif
9622 int main()
9623 {
9624 char buf[128], abc[128];
9625 char *b;
9626 int len;
9627 int off;
9628 int align;
9629
9630 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
9631
9632 for (align = 7; align >= 0; align--) {
9633         for (len = 36; len; len--) {
9634                 b = buf+align;
9635                 bcopy(abc, b, len);
9636                 for (off = 1; off <= len; off++) {
9637                         bcopy(b, b+off, len);
9638                         bcopy(b+off, b, len);
9639                         if (bcmp(b, abc, len))
9640                                 exit(1);
9641                 }
9642         }
9643 }
9644 exit(0);
9645 }
9646 EOCP
9647         set try
9648         if eval $compile_ok; then
9649                 if ./try 2>/dev/null; then
9650                         echo "Yes, it can."
9651                         val="$define"
9652                 else
9653                         echo "It can't, sorry."
9654                         case "$d_memmove" in
9655                         "$define") echo "But that's Ok since you have memmove()." ;;
9656                         esac
9657                 fi
9658         else
9659                 echo "(I can't compile the test program, so we'll assume not...)"
9660                 case "$d_memmove" in
9661                 "$define") echo "But that's Ok since you have memmove()." ;;
9662                 esac
9663         fi
9664         ;;
9665 esac
9666 $rm -f try.* try core
9667 set d_safebcpy
9668 eval $setvar
9669
9670 : can memcpy handle overlapping blocks?
9671 val="$undef"
9672 case "$d_memcpy" in
9673 "$define")
9674         echo " "
9675         echo "Checking to see if your memcpy() can do overlapping copies..." >&4
9676         $cat >try.c <<EOCP
9677 #$i_memory I_MEMORY
9678 #$i_stdlib I_STDLIB
9679 #$i_string I_STRING
9680 #$i_unistd I_UNISTD
9681 EOCP
9682         $cat >>try.c <<'EOCP'
9683 #include <stdio.h>
9684 #ifdef I_MEMORY
9685 #  include <memory.h>
9686 #endif
9687 #ifdef I_STDLIB
9688 #  include <stdlib.h>
9689 #endif
9690 #ifdef I_STRING
9691 #  include <string.h>
9692 #else
9693 #  include <strings.h>
9694 #endif
9695 #ifdef I_UNISTD
9696 #  include <unistd.h>  /* Needed for NetBSD */
9697 #endif
9698 int main()
9699 {
9700 char buf[128], abc[128];
9701 char *b;
9702 int len;
9703 int off;
9704 int align;
9705
9706 /* Copy "abcde..." string to char abc[] so that gcc doesn't
9707    try to store the string in read-only memory. */
9708 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
9709
9710 for (align = 7; align >= 0; align--) {
9711         for (len = 36; len; len--) {
9712                 b = buf+align;
9713                 memcpy(b, abc, len);
9714                 for (off = 1; off <= len; off++) {
9715                         memcpy(b+off, b, len);
9716                         memcpy(b, b+off, len);
9717                         if (memcmp(b, abc, len))
9718                                 exit(1);
9719                 }
9720         }
9721 }
9722 exit(0);
9723 }
9724 EOCP
9725         set try
9726         if eval $compile_ok; then
9727                 if ./try 2>/dev/null; then
9728                         echo "Yes, it can."
9729                         val="$define"
9730                 else
9731                         echo "It can't, sorry."
9732                         case "$d_memmove" in
9733                         "$define") echo "But that's Ok since you have memmove()." ;;
9734                         esac
9735                 fi
9736         else
9737                 echo "(I can't compile the test program, so we'll assume not...)"
9738                 case "$d_memmove" in
9739                 "$define") echo "But that's Ok since you have memmove()." ;;
9740                 esac
9741         fi
9742         ;;
9743 esac
9744 $rm -f try.* try core
9745 set d_safemcpy
9746 eval $setvar
9747
9748 : can memcmp be trusted to compare relative magnitude?
9749 val="$undef"
9750 case "$d_memcmp" in
9751 "$define")
9752         echo " "
9753         echo "Checking if your memcmp() can compare relative magnitude..." >&4
9754         $cat >try.c <<EOCP
9755 #$i_memory I_MEMORY
9756 #$i_stdlib I_STDLIB
9757 #$i_string I_STRING
9758 #$i_unistd I_UNISTD
9759 EOCP
9760         $cat >>try.c <<'EOCP'
9761 #include <stdio.h>
9762 #ifdef I_MEMORY
9763 #  include <memory.h>
9764 #endif
9765 #ifdef I_STDLIB
9766 #  include <stdlib.h>
9767 #endif
9768 #ifdef I_STRING
9769 #  include <string.h>
9770 #else
9771 #  include <strings.h>
9772 #endif
9773 #ifdef I_UNISTD
9774 #  include <unistd.h>  /* Needed for NetBSD */
9775 #endif
9776 int main()
9777 {
9778 char a = -1;
9779 char b = 0;
9780 if ((a < b) && memcmp(&a, &b, 1) < 0)
9781         exit(1);
9782 exit(0);
9783 }
9784 EOCP
9785         set try
9786         if eval $compile_ok; then
9787                 if ./try 2>/dev/null; then
9788                         echo "Yes, it can."
9789                         val="$define"
9790                 else
9791                         echo "No, it can't (it uses signed chars)."
9792                 fi
9793         else
9794                 echo "(I can't compile the test program, so we'll assume not...)"
9795         fi
9796         ;;
9797 esac
9798 $rm -f try.* try core
9799 set d_sanemcmp
9800 eval $setvar
9801
9802 : see if select exists
9803 set select d_select
9804 eval $inlibc
9805
9806 : see if semctl exists
9807 set semctl d_semctl
9808 eval $inlibc
9809
9810 : see if semget exists
9811 set semget d_semget
9812 eval $inlibc
9813
9814 : see if semop exists
9815 set semop d_semop
9816 eval $inlibc
9817
9818 : see how much of the 'sem*(2)' library is present.
9819 h_sem=true
9820 echo " "
9821 case "$d_semctl$d_semget$d_semop" in
9822 *"$undef"*) h_sem=false;;
9823 esac
9824 case "$osname" in
9825 freebsd)
9826     case "`ipcs 2>&1`" in
9827     "SVID messages"*"not configured"*)
9828         echo "Your $osname does not have the sem*(2) configured." >&4
9829         h_sem=false
9830         val="$undef"
9831         set semctl d_semctl
9832         eval $setvar
9833         set semget d_semget
9834         eval $setvar
9835         set semop d_semop
9836         eval $setvar
9837         ;;
9838     esac
9839     ;;
9840 esac
9841 : we could also check for sys/ipc.h ...
9842 if $h_sem && $test `./findhdr sys/sem.h`; then
9843         echo "You have the full sem*(2) library." >&4
9844         val="$define"
9845 else
9846         echo "You don't have the full sem*(2) library." >&4
9847         val="$undef"
9848 fi
9849 set d_sem
9850 eval $setvar
9851
9852 : see whether sys/sem.h defines union semun
9853 echo " "
9854 $cat > try.c <<'END'
9855 #include <sys/types.h>
9856 #include <sys/ipc.h>
9857 #include <sys/sem.h>
9858 int main () { union semun semun; semun.buf = 0; }
9859 END
9860 set try
9861 if eval $compile; then
9862     echo "You have union semun in <sys/sem.h>." >&4
9863     val="$define"
9864 else
9865     echo "You do not have union semun in <sys/sem.h>." >&4
9866     val="$undef"
9867 fi
9868 $rm -f try try.c try.h
9869 set d_union_semun
9870 eval $setvar
9871
9872 : see how to do semctl IPC_STAT
9873 case "$d_sem" in
9874 $define)
9875     : see whether semctl IPC_STAT can use union semun
9876     echo " "
9877     $cat > try.h <<END
9878 #ifndef S_IRUSR
9879 #   ifdef S_IREAD
9880 #       define S_IRUSR S_IREAD
9881 #       define S_IWUSR S_IWRITE
9882 #       define S_IXUSR S_IEXEC
9883 #   else
9884 #       define S_IRUSR 0400
9885 #       define S_IWUSR 0200
9886 #       define S_IXUSR 0100
9887 #   endif
9888 #   define S_IRGRP (S_IRUSR>>3)
9889 #   define S_IWGRP (S_IWUSR>>3)
9890 #   define S_IXGRP (S_IXUSR>>3)
9891 #   define S_IROTH (S_IRUSR>>6)
9892 #   define S_IWOTH (S_IWUSR>>6)
9893 #   define S_IXOTH (S_IXUSR>>6)
9894 #endif
9895 #ifndef S_IRWXU
9896 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
9897 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
9898 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
9899 #endif
9900 END
9901
9902     $cat > try.c <<END
9903 #include <sys/types.h>
9904 #include <sys/ipc.h>
9905 #include <sys/sem.h>
9906 #include <sys/stat.h>
9907 #include <stdio.h>
9908 #include <errno.h>
9909 #include "try.h"
9910 #ifndef errno
9911 extern int errno;
9912 #endif
9913 #$d_union_semun HAS_UNION_SEMUN
9914 int main() {
9915     union semun
9916 #ifndef HAS_UNION_SEMUN
9917     {
9918         int val;
9919         struct semid_ds *buf;
9920         unsigned short *array;
9921     }
9922 #endif
9923     arg;
9924     int sem, st;
9925
9926 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
9927     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
9928     if (sem > -1) {
9929         struct semid_ds argbuf;
9930         arg.buf = &argbuf;
9931 #       ifdef IPC_STAT
9932         st = semctl(sem, 0, IPC_STAT, arg);
9933         if (st == 0)
9934             printf("semun\n");
9935         else
9936 #       endif /* IPC_STAT */
9937             printf("semctl IPC_STAT failed: errno = %d\n", errno);
9938 #       ifdef IPC_RMID
9939         if (semctl(sem, 0, IPC_RMID, arg) != 0)
9940 #       endif /* IPC_RMID */
9941             printf("semctl IPC_RMID failed: errno = %d\n", errno);
9942     } else
9943 #endif /* IPC_PRIVATE && ... */
9944         printf("semget failed: errno = %d\n", errno);
9945   return 0;
9946 }
9947 END
9948     val="$undef"
9949     set try
9950     if eval $compile; then
9951         xxx=`./try`
9952         case "$xxx" in
9953         semun) val="$define" ;;
9954         esac
9955     fi
9956     $rm -f try try.c
9957     set d_semctl_semun
9958     eval $setvar
9959     case "$d_semctl_semun" in
9960     $define)
9961         echo "You can use union semun for semctl IPC_STAT." >&4
9962         also='also'
9963         ;;
9964     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
9965         also=''
9966         ;;
9967     esac
9968
9969     : see whether semctl IPC_STAT can use struct semid_ds pointer
9970     $cat > try.c <<'END'
9971 #include <sys/types.h>
9972 #include <sys/ipc.h>
9973 #include <sys/sem.h>
9974 #include <sys/stat.h>
9975 #include "try.h"
9976 #include <stdio.h>
9977 #include <errno.h>
9978 #ifndef errno
9979 extern int errno;
9980 #endif
9981 int main() {
9982     struct semid_ds arg;
9983     int sem, st;
9984
9985 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
9986     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
9987     if (sem > -1) {
9988 #       ifdef IPC_STAT
9989         st = semctl(sem, 0, IPC_STAT, &arg);
9990         if (st == 0)
9991             printf("semid_ds\n");
9992         else
9993 #       endif /* IPC_STAT */
9994             printf("semctl IPC_STAT failed: errno = %d\n", errno);
9995 #       ifdef IPC_RMID
9996         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
9997 #       endif /* IPC_RMID */
9998             printf("semctl IPC_RMID failed: errno = %d\n", errno);
9999     } else
10000 #endif /* IPC_PRIVATE && ... */
10001         printf("semget failed: errno = %d\n", errno);
10002
10003     return 0;
10004 }
10005 END
10006     val="$undef"
10007     set try
10008     if eval $compile; then
10009         xxx=`./try`
10010         case "$xxx" in
10011         semid_ds) val="$define" ;;
10012         esac
10013     fi
10014     $rm -f try try.c
10015     set d_semctl_semid_ds
10016     eval $setvar
10017     case "$d_semctl_semid_ds" in
10018     $define)
10019         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
10020         ;;
10021     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
10022         ;;
10023     esac
10024     $rm -f try.h
10025     ;;
10026 *)  val="$undef"
10027
10028     # We do not have the full sem*(2) library, so assume we can not
10029     # use either.
10030
10031     set d_semctl_semun
10032     eval $setvar
10033
10034     set d_semctl_semid_ds
10035     eval $setvar
10036     ;;
10037 esac
10038
10039 : see if setegid exists
10040 set setegid d_setegid
10041 eval $inlibc
10042
10043 : see if seteuid exists
10044 set seteuid d_seteuid
10045 eval $inlibc
10046
10047 : see if setgrent exists
10048 set setgrent d_setgrent
10049 eval $inlibc
10050
10051 : see if sethostent exists
10052 set sethostent d_sethent
10053 eval $inlibc
10054
10055 : see if setlinebuf exists
10056 set setlinebuf d_setlinebuf
10057 eval $inlibc
10058
10059 : see if setlocale exists
10060 set setlocale d_setlocale
10061 eval $inlibc
10062
10063 : see if setnetent exists
10064 set setnetent d_setnent
10065 eval $inlibc
10066
10067 : see if setprotoent exists
10068 set setprotoent d_setpent
10069 eval $inlibc
10070
10071 : see if setpgid exists
10072 set setpgid d_setpgid
10073 eval $inlibc
10074
10075 : see if setpgrp2 exists
10076 set setpgrp2 d_setpgrp2
10077 eval $inlibc
10078
10079 : see if setpriority exists
10080 set setpriority d_setprior
10081 eval $inlibc
10082
10083 : see if setpwent exists
10084 set setpwent d_setpwent
10085 eval $inlibc
10086
10087 : see if setregid exists
10088 set setregid d_setregid
10089 eval $inlibc
10090 set setresgid d_setresgid
10091 eval $inlibc
10092
10093 : see if setreuid exists
10094 set setreuid d_setreuid
10095 eval $inlibc
10096 set setresuid d_setresuid
10097 eval $inlibc
10098
10099 : see if setrgid exists
10100 set setrgid d_setrgid
10101 eval $inlibc
10102
10103 : see if setruid exists
10104 set setruid d_setruid
10105 eval $inlibc
10106
10107 : see if setservent exists
10108 set setservent d_setsent
10109 eval $inlibc
10110
10111 : see if setsid exists
10112 set setsid d_setsid
10113 eval $inlibc
10114
10115 : see if setspent exists
10116 set setspent d_setspent
10117 eval $inlibc
10118
10119 : see if setvbuf exists
10120 set setvbuf d_setvbuf
10121 eval $inlibc
10122
10123 : see if sfio.h is available
10124 set sfio.h i_sfio
10125 eval $inhdr
10126
10127
10128 : see if sfio library is available
10129 case "$i_sfio" in
10130 $define)
10131         val=''
10132         set sfreserve val
10133         eval $inlibc
10134         ;;
10135 *)
10136         val="$undef"
10137         ;;
10138 esac
10139 : Ok, but do we want to use it.
10140 case "$val" in
10141 $define)
10142         case "$usesfio" in
10143         true|$define|[yY]*) dflt='y';;
10144         *) dflt='n';;
10145         esac
10146         echo "$package can use the sfio library, but it is experimental."
10147         rp="You seem to have sfio available, do you want to try using it?"
10148         . ./myread
10149         case "$ans" in
10150         y|Y) ;;
10151         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
10152                 val="$undef"
10153                 : Remove sfio from list of libraries to use
10154                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
10155                 shift
10156                 libs="$*"
10157                 echo "libs = $libs" >&4
10158                 ;;
10159         esac
10160         ;;
10161 *)      case "$usesfio" in
10162         true|$define|[yY]*)
10163                 echo "Sorry, cannot find sfio on this machine" >&4
10164                 echo "Ignoring your setting of usesfio=$usesfio" >&4
10165                 ;;
10166         esac
10167         ;;
10168 esac
10169 set d_sfio
10170 eval $setvar
10171 case "$d_sfio" in
10172 $define) usesfio='true';;
10173 *) usesfio='false';;
10174 esac
10175
10176 : see if shmctl exists
10177 set shmctl d_shmctl
10178 eval $inlibc
10179
10180 : see if shmget exists
10181 set shmget d_shmget
10182 eval $inlibc
10183
10184 : see if shmat exists
10185 set shmat d_shmat
10186 eval $inlibc
10187 : see what shmat returns
10188 case "$d_shmat" in
10189 "$define")
10190         $cat >shmat.c <<'END'
10191 #include <sys/shm.h>
10192 void *shmat();
10193 END
10194         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
10195                 shmattype='void *'
10196         else
10197                 shmattype='char *'
10198         fi
10199         echo "and it returns ($shmattype)." >&4
10200         : see if a prototype for shmat is available
10201         xxx=`./findhdr sys/shm.h`
10202         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
10203         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
10204                 val="$define"
10205         else
10206                 val="$undef"
10207         fi
10208         $rm -f shmat.[co]
10209         ;;
10210 *)
10211         val="$undef"
10212         ;;
10213 esac
10214 set d_shmatprototype
10215 eval $setvar
10216
10217 : see if shmdt exists
10218 set shmdt d_shmdt
10219 eval $inlibc
10220
10221 : see how much of the 'shm*(2)' library is present.
10222 h_shm=true
10223 echo " "
10224 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
10225 *"$undef"*) h_shm=false;;
10226 esac
10227 case "$osname" in
10228 freebsd)
10229     case "`ipcs 2>&1`" in
10230     "SVID shared memory"*"not configured"*)
10231         echo "Your $osname does not have the shm*(2) configured." >&4
10232         h_shm=false
10233         val="$undef"
10234         set shmctl d_shmctl
10235         evat $setvar
10236         set shmget d_shmget
10237         evat $setvar
10238         set shmat d_shmat
10239         evat $setvar
10240         set shmdt d_shmdt
10241         evat $setvar
10242         ;;
10243     esac
10244     ;;
10245 esac
10246 : we could also check for sys/ipc.h ...
10247 if $h_shm && $test `./findhdr sys/shm.h`; then
10248         echo "You have the full shm*(2) library." >&4
10249         val="$define"
10250 else
10251         echo "You don't have the full shm*(2) library." >&4
10252         val="$undef"
10253 fi
10254 set d_shm
10255 eval $setvar
10256
10257 echo " "
10258 : see if we have sigaction
10259 if set sigaction val -f d_sigaction; eval $csym; $val; then
10260         echo 'sigaction() found.' >&4
10261         $cat > try.c <<'EOP'
10262 #include <stdio.h>
10263 #include <sys/types.h>
10264 #include <signal.h>
10265 int main()
10266 {
10267     struct sigaction act, oact;
10268     act.sa_flags = 0;
10269     oact.sa_handler = 0;
10270 }
10271 EOP
10272         set try
10273         if eval $compile_ok; then
10274                 val="$define"
10275         else
10276                 echo "But you don't seem to have a useable struct sigaction." >&4
10277                 val="$undef"
10278         fi
10279 else
10280         echo 'sigaction NOT found.' >&4
10281         val="$undef"
10282 fi
10283 set d_sigaction; eval $setvar
10284 $rm -f try try$_o try.c
10285
10286 : see if sigsetjmp exists
10287 echo " "
10288 case "$d_sigsetjmp" in
10289 '')
10290         $cat >try.c <<'EOP'
10291 #include <setjmp.h>
10292 sigjmp_buf env;
10293 int set = 1;
10294 int main()
10295 {
10296         if (sigsetjmp(env,1))
10297                 exit(set);
10298         set = 0;
10299         siglongjmp(env, 1);
10300         exit(1);
10301 }
10302 EOP
10303         set try
10304         if eval $compile; then
10305                 if ./try >/dev/null 2>&1; then
10306                         echo "POSIX sigsetjmp found." >&4
10307                         val="$define"
10308                 else
10309                         $cat >&4 <<EOM
10310 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
10311 I'll ignore them.
10312 EOM
10313                         val="$undef"
10314                 fi
10315         else
10316                 echo "sigsetjmp not found." >&4
10317                 val="$undef"
10318         fi
10319         ;;
10320 *) val="$d_sigsetjmp"
10321         case "$d_sigsetjmp" in
10322         $define) echo "POSIX sigsetjmp found." >&4;;
10323         $undef) echo "sigsetjmp not found." >&4;;
10324         esac
10325         ;;
10326 esac
10327 set d_sigsetjmp
10328 eval $setvar
10329 $rm -f try.c try
10330
10331 : see if sqrtl exists
10332 set sqrtl d_sqrtl
10333 eval $inlibc
10334
10335 : see if sys/stat.h is available
10336 set sys/stat.h i_sysstat
10337 eval $inhdr
10338
10339 : see if stat knows about block sizes
10340 echo " "
10341 set d_statblks stat st_blocks $i_sysstat sys/stat.h
10342 eval $hasfield
10343
10344 : see if _ptr and _cnt from stdio act std
10345 echo " "
10346 if $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
10347         echo "(Looks like you have stdio.h from Linux.)"
10348         case "$stdio_ptr" in
10349         '') stdio_ptr='((fp)->_IO_read_ptr)'
10350                 ptr_lval=$define
10351                 ;;
10352         *)      ptr_lval=$d_stdio_ptr_lval;;
10353         esac
10354         case "$stdio_cnt" in
10355         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
10356                 cnt_lval=$undef
10357                 ;;
10358         *)      cnt_lval=$d_stdio_cnt_lval;;
10359         esac
10360         case "$stdio_base" in
10361         '') stdio_base='((fp)->_IO_read_base)';;
10362         esac
10363         case "$stdio_bufsiz" in
10364         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
10365         esac
10366 else
10367         case "$stdio_ptr" in
10368         '') stdio_ptr='((fp)->_ptr)'
10369                 ptr_lval=$define
10370                 ;;
10371         *)      ptr_lval=$d_stdio_ptr_lval;;
10372         esac
10373         case "$stdio_cnt" in
10374         '') stdio_cnt='((fp)->_cnt)'
10375                 cnt_lval=$define
10376                 ;;
10377         *)      cnt_lval=$d_stdio_cnt_lval;;
10378         esac
10379         case "$stdio_base" in
10380         '') stdio_base='((fp)->_base)';;
10381         esac
10382         case "$stdio_bufsiz" in
10383         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
10384         esac
10385 fi
10386 : test whether _ptr and _cnt really work
10387 echo "Checking how std your stdio is..." >&4
10388 $cat >try.c <<EOP
10389 #include <stdio.h>
10390 #define FILE_ptr(fp)    $stdio_ptr
10391 #define FILE_cnt(fp)    $stdio_cnt
10392 int main() {
10393         FILE *fp = fopen("try.c", "r");
10394         char c = getc(fp);
10395         if (
10396                 18 <= FILE_cnt(fp) &&
10397                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
10398         )
10399                 exit(0);
10400         exit(1);
10401 }
10402 EOP
10403 val="$undef"
10404 set try
10405 if eval $compile; then
10406         if ./try; then
10407                 echo "Your stdio acts pretty std."
10408                 val="$define"
10409         else
10410                 echo "Your stdio isn't very std."
10411         fi
10412 else
10413         echo "Your stdio doesn't appear very std."
10414 fi
10415 $rm -f try.c try
10416 set d_stdstdio
10417 eval $setvar
10418
10419 : Can _ptr be used as an lvalue?
10420 case "$d_stdstdio$ptr_lval" in
10421 $define$define) val=$define ;;
10422 *) val=$undef ;;
10423 esac
10424 set d_stdio_ptr_lval
10425 eval $setvar
10426
10427 : Can _cnt be used as an lvalue?
10428 case "$d_stdstdio$cnt_lval" in
10429 $define$define) val=$define ;;
10430 *) val=$undef ;;
10431 esac
10432 set d_stdio_cnt_lval
10433 eval $setvar
10434
10435 : see if _base is also standard
10436 val="$undef"
10437 case "$d_stdstdio" in
10438 $define)
10439         $cat >try.c <<EOP
10440 #include <stdio.h>
10441 #define FILE_base(fp)   $stdio_base
10442 #define FILE_bufsiz(fp) $stdio_bufsiz
10443 int main() {
10444         FILE *fp = fopen("try.c", "r");
10445         char c = getc(fp);
10446         if (
10447                 19 <= FILE_bufsiz(fp) &&
10448                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
10449         )
10450                 exit(0);
10451         exit(1);
10452 }
10453 EOP
10454         set try
10455         if eval $compile; then
10456                 if ./try; then
10457                         echo "And its _base field acts std."
10458                         val="$define"
10459                 else
10460                         echo "But its _base field isn't std."
10461                 fi
10462         else
10463                 echo "However, it seems to be lacking the _base field."
10464         fi
10465         $rm -f try.c try
10466         ;;
10467 esac
10468 set d_stdiobase
10469 eval $setvar
10470
10471 $cat >&4 <<EOM
10472 Checking how to access stdio streams by file descriptor number...
10473 EOM
10474 case "$stdio_stream_array" in
10475 '')     $cat >try.c <<EOCP
10476 #include <stdio.h>
10477 int main() {
10478   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
10479     printf("yes\n");
10480 }
10481 EOCP
10482         for s in _iob __iob __sF
10483         do
10484                 set try -DSTDIO_STREAM_ARRAY=$s
10485                 if eval $compile; then
10486                         case "`./try$exe_ext`" in
10487                         yes)    stdio_stream_array=$s; break ;;
10488                         esac
10489                 fi
10490         done
10491         $rm -f try.* try$exe_ext
10492 esac
10493 case "$stdio_stream_array" in
10494 '')     $cat >&4 <<EOM
10495 I can't figure out how to access stdio streams by file descriptor number.
10496 EOM
10497         d_stdio_stream_array="$undef"
10498         ;;
10499 *)      $cat >&4 <<EOM
10500 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
10501 EOM
10502         d_stdio_stream_array="$define"
10503         ;;
10504 esac
10505
10506 : see if strcoll exists
10507 set strcoll d_strcoll
10508 eval $inlibc
10509
10510 : check for structure copying
10511 echo " "
10512 echo "Checking to see if your C compiler can copy structs..." >&4
10513 $cat >try.c <<'EOCP'
10514 int main()
10515 {
10516         struct blurfl {
10517                 int dyick;
10518         } foo, bar;
10519
10520         foo = bar;
10521 }
10522 EOCP
10523 if $cc -c try.c >/dev/null 2>&1 ; then
10524         val="$define"
10525         echo "Yup, it can."
10526 else
10527         val="$undef"
10528         echo "Nope, it can't."
10529 fi
10530 set d_strctcpy
10531 eval $setvar
10532 $rm -f try.*
10533
10534 : see if strerror and/or sys_errlist[] exist
10535 echo " "
10536 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
10537     if set strerror val -f d_strerror; eval $csym; $val; then
10538                 echo 'strerror() found.' >&4
10539                 d_strerror="$define"
10540                 d_strerrm='strerror(e)'
10541                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
10542                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
10543                         d_syserrlst="$define"
10544                 else
10545                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
10546                         d_syserrlst="$undef"
10547                 fi
10548     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
10549                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
10550                 echo 'strerror() found in string header.' >&4
10551                 d_strerror="$define"
10552                 d_strerrm='strerror(e)'
10553                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
10554                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
10555                                 d_syserrlst="$define"
10556                 else
10557                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
10558                         d_syserrlst="$undef"
10559                 fi
10560     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
10561                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
10562                 d_strerror="$undef"
10563                 d_syserrlst="$define"
10564                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
10565     else
10566                 echo 'strerror() and sys_errlist[] NOT found.' >&4
10567                 d_strerror="$undef"
10568                 d_syserrlst="$undef"
10569                 d_strerrm='"unknown"'
10570     fi
10571 fi
10572
10573 : see if strtod exists
10574 set strtod d_strtod
10575 eval $inlibc
10576
10577 : see if strtol exists
10578 set strtol d_strtol
10579 eval $inlibc
10580
10581 : see if strtoul exists
10582 set strtoul d_strtoul
10583 eval $inlibc
10584
10585 : see if strtoull exists
10586 set strtoull d_strtoull
10587 eval $inlibc
10588
10589 : see if strxfrm exists
10590 set strxfrm d_strxfrm
10591 eval $inlibc
10592
10593 : see if symlink exists
10594 set symlink d_symlink
10595 eval $inlibc
10596
10597 : see if syscall exists
10598 set syscall d_syscall
10599 eval $inlibc
10600
10601 : see if sysconf exists
10602 set sysconf d_sysconf
10603 eval $inlibc
10604
10605 : see if system exists
10606 set system d_system
10607 eval $inlibc
10608
10609 : see if tcgetpgrp exists
10610 set tcgetpgrp d_tcgetpgrp
10611 eval $inlibc
10612
10613 : see if tcsetpgrp exists
10614 set tcsetpgrp d_tcsetpgrp
10615 eval $inlibc
10616
10617 : see if sys/types.h has to be included
10618 set sys/types.h i_systypes
10619 eval $inhdr
10620
10621 : see if prototype for telldir is available
10622 echo " "
10623 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
10624 eval $hasproto
10625
10626 : define an is-a-typedef? function
10627 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
10628 case "$inclist" in
10629 "") inclist="sys/types.h";;
10630 esac;
10631 eval "varval=\$$var";
10632 case "$varval" in
10633 "")
10634         $rm -f temp.c;
10635         for inc in $inclist; do
10636                 echo "#include <$inc>" >>temp.c;
10637         done;
10638         echo "#ifdef $type" >> temp.c;
10639         echo "printf(\"We have $type\");" >> temp.c;
10640         echo "#endif" >> temp.c;
10641         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
10642         if $contains $type temp.E >/dev/null 2>&1; then
10643                 eval "$var=\$type";
10644         else
10645                 eval "$var=\$def";
10646         fi;
10647         $rm -f temp.?;;
10648 *) eval "$var=\$varval";;
10649 esac'
10650
10651 : define an is-a-typedef? function that prompts if the type is not available.
10652 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
10653 case "$inclist" in
10654 "") inclist="sys/types.h";;
10655 esac;
10656 eval "varval=\$$var";
10657 case "$varval" in
10658 "")
10659         $rm -f temp.c;
10660         for inc in $inclist; do
10661                 echo "#include <$inc>" >>temp.c;
10662         done;
10663         echo "#ifdef $type" >> temp.c;
10664         echo "printf(\"We have $type\");" >> temp.c;
10665         echo "#endif" >> temp.c;
10666         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
10667         echo " " ;
10668         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
10669         if $contains $type temp.E >/dev/null 2>&1; then
10670                 echo "$type found." >&4;
10671                 eval "$var=\$type";
10672         else
10673                 echo "$type NOT found." >&4;
10674                 dflt="$def";
10675                 . ./myread ;
10676                 eval "$var=\$ans";
10677         fi;
10678         $rm -f temp.?;;
10679 *) eval "$var=\$varval";;
10680 esac'
10681
10682 : see if this is a sys/times.h system
10683 set sys/times.h i_systimes
10684 eval $inhdr
10685
10686 : see if times exists
10687 echo " "
10688 if set times val -f d_times; eval $csym; $val; then
10689         echo 'times() found.' >&4
10690         d_times="$define"
10691         inc=''
10692         case "$i_systimes" in
10693         "$define") inc='sys/times.h';;
10694         esac
10695         rp="What is the type returned by times() on this system?"
10696         set clock_t clocktype long stdio.h sys/types.h $inc
10697         eval $typedef_ask
10698 else
10699         echo 'times() NOT found, hope that will do.' >&4
10700         d_times="$undef"
10701         clocktype='int'
10702 fi
10703
10704 : see if truncate exists
10705 set truncate d_truncate
10706 eval $inlibc
10707
10708 : see if tzname[] exists
10709 echo " "
10710 if set tzname val -a d_tzname; eval $csym; $val; then
10711         val="$define"
10712         echo 'tzname[] found.' >&4
10713 else
10714         val="$undef"
10715         echo 'tzname[] NOT found.' >&4
10716 fi
10717 set d_tzname
10718 eval $setvar
10719
10720 : see if umask exists
10721 set umask d_umask
10722 eval $inlibc
10723
10724 : backward compatibility for d_hvfork
10725 if test X$d_hvfork != X; then
10726         d_vfork="$d_hvfork"
10727         d_hvfork=''
10728 fi
10729 : see if there is a vfork
10730 val=''
10731 set vfork val
10732 eval $inlibc
10733
10734 : Ok, but do we want to use it. vfork is reportedly unreliable in 
10735 : perl on Solaris 2.x, and probably elsewhere.
10736 case "$val" in
10737 $define)
10738         echo " "
10739         case "$usevfork" in
10740         false) dflt='n';;
10741         *) dflt='y';;
10742         esac
10743         cat <<'EOM'
10744  
10745 Perl can only use a vfork() that doesn't suffer from strict
10746 restrictions on calling functions or modifying global data in
10747 the child.  For example, glibc-2.1 contains such a vfork()
10748 that is unsuitable.  If your system provides a proper fork()
10749 call, chances are that you do NOT want perl to use vfork().
10750
10751 EOM
10752         rp="Do you still want to use vfork()?"
10753         . ./myread
10754         case "$ans" in
10755         y|Y) ;;
10756         *)
10757                 echo "Ok, we won't use vfork()."
10758                 val="$undef"
10759                 ;;
10760         esac
10761         ;;
10762 esac
10763 set d_vfork
10764 eval $setvar
10765 case "$d_vfork" in
10766 $define) usevfork='true';;
10767 *) usevfork='false';;
10768 esac
10769
10770 : see if this is an sysdir system
10771 set sys/dir.h i_sysdir
10772 eval $inhdr
10773
10774 : see if this is an sysndir system
10775 set sys/ndir.h i_sysndir
10776 eval $inhdr
10777
10778 : see if closedir exists
10779 set closedir d_closedir
10780 eval $inlibc
10781
10782 case "$d_closedir" in
10783 "$define")
10784         echo " "
10785         echo "Checking whether closedir() returns a status..." >&4
10786         cat > closedir.c <<EOM
10787 #$i_dirent I_DIRENT             /**/
10788 #$i_sysdir I_SYS_DIR            /**/
10789 #$i_sysndir I_SYS_NDIR          /**/
10790 #$i_systypes I_SYS_TYPES        /**/
10791
10792 #if defined(I_SYS_TYPES)
10793 #include <sys/types.h>
10794 #endif
10795 #if defined(I_DIRENT)
10796 #include <dirent.h>
10797 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
10798 #include <sys/dir.h>
10799 #endif
10800 #else
10801 #ifdef I_SYS_NDIR
10802 #include <sys/ndir.h>
10803 #else
10804 #ifdef I_SYS_DIR
10805 #ifdef hp9000s500
10806 #include <ndir.h>       /* may be wrong in the future */
10807 #else
10808 #include <sys/dir.h>
10809 #endif
10810 #endif
10811 #endif
10812 #endif 
10813 int main() { return closedir(opendir(".")); }
10814 EOM
10815         set closedir
10816         if eval $compile_ok; then
10817                 if ./closedir > /dev/null 2>&1 ; then
10818                         echo "Yes, it does."
10819                         val="$undef"
10820                 else
10821                         echo "No, it doesn't."
10822                         val="$define"
10823                 fi
10824         else
10825                 echo "(I can't seem to compile the test program--assuming it doesn't)"
10826                 val="$define"
10827         fi
10828         ;;
10829 *)
10830         val="$undef";
10831         ;;
10832 esac
10833 set d_void_closedir
10834 eval $setvar
10835 $rm -f closedir*
10836 : check for volatile keyword
10837 echo " "
10838 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
10839 $cat >try.c <<'EOCP'
10840 int main()
10841 {
10842         typedef struct _goo_struct goo_struct;
10843         goo_struct * volatile goo = ((goo_struct *)0);
10844         struct _goo_struct {
10845                 long long_int;
10846                 int reg_int;
10847                 char char_var;
10848         };
10849         typedef unsigned short foo_t;
10850         char *volatile foo;
10851         volatile int bar;
10852         volatile foo_t blech;
10853         foo = foo;
10854 }
10855 EOCP
10856 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
10857         val="$define"
10858         echo "Yup, it does."
10859 else
10860         val="$undef"
10861         echo "Nope, it doesn't."
10862 fi
10863 set d_volatile
10864 eval $setvar
10865 $rm -f try.*
10866
10867 : see if there is a wait4
10868 set wait4 d_wait4
10869 eval $inlibc
10870
10871 : see if waitpid exists
10872 set waitpid d_waitpid
10873 eval $inlibc
10874
10875 : see if wcstombs exists
10876 set wcstombs d_wcstombs
10877 eval $inlibc
10878
10879 : see if wctomb exists
10880 set wctomb d_wctomb
10881 eval $inlibc
10882
10883 : see if writev exists
10884 set writev d_writev
10885 eval $inlibc
10886
10887 : preserve RCS keywords in files with variable substitution, grrr
10888 Date='$Date'
10889 Id='$Id'
10890 Log='$Log'
10891 RCSfile='$RCSfile'
10892 Revision='$Revision'
10893
10894 case "$crosscompile" in
10895 ''|[nN]*) crosscompile="$undef" ;;
10896 esac
10897
10898 case "$osname" in
10899 next|rhapsody) multiarch="$define" ;;
10900 esac
10901 case "$multiarch" in
10902 ''|[nN]*) multiarch="$undef" ;;
10903 esac
10904
10905 : check for alignment requirements
10906 echo " "
10907 case "$crosscompile$multiarch" in
10908 *$define*)
10909         $cat <<EOM
10910 You seem to be either cross-compiling or doing a multiarchitecture build,
10911 skipping the memory alignment check.
10912
10913 EOM
10914         case "$alignbytes" in
10915         '') alignbytes=8 ;;
10916         esac
10917         ;;
10918 *)
10919         case "$alignbytes" in
10920         '') echo "Checking alignment constraints..." >&4
10921                 $cat >try.c <<'EOCP'
10922 struct foobar {
10923         char foo;
10924         double bar;
10925 } try_algn;
10926 int main()
10927 {
10928         printf("%d\n", (char *)&try_algn.bar - (char *)&try_algn.foo);
10929 }
10930 EOCP
10931                 set try
10932                 if eval $compile_ok; then
10933                         dflt=`./try`
10934                 else
10935                         dflt='8'
10936                         echo "(I can't seem to compile the test program...)"
10937                 fi
10938                 ;;
10939         *) dflt="$alignbytes"
10940                 ;;
10941         esac
10942         rp="Doubles must be aligned on a how-many-byte boundary?"
10943         . ./myread
10944         alignbytes="$ans"
10945         $rm -f try.c try
10946         ;;
10947 esac
10948
10949
10950 : check for ordering of bytes in a long
10951 echo " "
10952 case "$crosscompile$multiarch" in
10953 *$define*)
10954         $cat <<EOM
10955 You seem to be either cross-compiling or doing a multiarchitecture build,
10956 skipping the byteorder check.
10957
10958 EOM
10959         byteorder='0xffff'
10960         ;;
10961 *)
10962         case "$byteorder" in
10963         '')
10964                 $cat <<'EOM'
10965 In the following, larger digits indicate more significance.  A big-endian
10966 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
10967 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
10968 machines may have weird orders like 3412.  A Cray will report 87654321,
10969 an Alpha will report 12345678. If the test program works the default is
10970 probably right.
10971 I'm now running the test program...
10972 EOM
10973                 $cat >try.c <<'EOCP'
10974 #include <stdio.h>
10975 int main()
10976 {
10977         int i;
10978         union {
10979                 unsigned long l;
10980                 char c[sizeof(long)];
10981         } u;
10982
10983         if (sizeof(long) > 4)
10984                 u.l = (0x08070605L << 32) | 0x04030201L;
10985         else
10986                 u.l = 0x04030201L;
10987         for (i = 0; i < sizeof(long); i++)
10988                 printf("%c", u.c[i]+'0');
10989         printf("\n");
10990         exit(0);
10991 }
10992 EOCP
10993                 xxx_prompt=y
10994                 set try
10995                 if eval $compile && ./try > /dev/null; then
10996                         dflt=`./try`
10997                         case "$dflt" in
10998                         [1-4][1-4][1-4][1-4]|12345678|87654321)
10999                                 echo "(The test program ran ok.)"
11000                                 echo "byteorder=$dflt"
11001                                 xxx_prompt=n
11002                         ;;
11003                         ????|????????) echo "(The test program ran ok.)" ;;
11004                         *) echo "(The test program didn't run right for some reason.)" ;;
11005                         esac
11006                 else
11007                         dflt='4321'
11008                         cat <<'EOM'
11009 (I can't seem to compile the test program.  Guessing big-endian...)
11010 EOM
11011                 fi
11012                 case "$xxx_prompt" in
11013                 y)
11014                         rp="What is the order of bytes in a long?"
11015                         . ./myread
11016                         byteorder="$ans"
11017                         ;;
11018                 *)      byteorder=$dflt
11019                         ;;
11020                 esac
11021                 ;;
11022         esac
11023         $rm -f try.c try
11024         ;;
11025 esac
11026
11027
11028 : how do we catenate cpp tokens here?
11029 echo " "
11030 echo "Checking to see how your cpp does stuff like catenate tokens..." >&4
11031 $cat >cpp_stuff.c <<'EOCP'
11032 #define RCAT(a,b)a/**/b
11033 #define ACAT(a,b)a ## b
11034 RCAT(Rei,ser)
11035 ACAT(Cir,cus)
11036 EOCP
11037 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
11038 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
11039         echo "Oh!  Smells like ANSI's been here." >&4
11040         echo "We can catify or stringify, separately or together!"
11041         cpp_stuff=42
11042 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
11043         echo "Ah, yes!  The good old days!" >&4
11044         echo "However, in the good old days we don't know how to stringify and"
11045         echo "catify at the same time."
11046         cpp_stuff=1
11047 else
11048         $cat >&4 <<EOM
11049 Hmm, I don't seem to be able to catenate tokens with your cpp.  You're going
11050 to have to edit the values of CAT[2-5] in config.h...
11051 EOM
11052         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
11053 fi
11054 $rm -f cpp_stuff.*
11055
11056 : see if this is a db.h system
11057 set db.h i_db
11058 eval $inhdr
11059
11060 case "$i_db" in
11061 $define)
11062         : Check db version.
11063         echo " "
11064         echo "Checking Berkeley DB version ..." >&4
11065         $cat >try.c <<EOCP
11066 #$d_const HASCONST
11067 #ifndef HASCONST
11068 #define const
11069 #endif
11070 #include <sys/types.h>
11071 #include <stdio.h>
11072 #include <db.h>
11073 int main()
11074 {
11075 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
11076     int Major, Minor, Patch ;
11077     unsigned long Version ;
11078     (void)db_version(&Major, &Minor, &Patch) ;
11079     printf("You have Berkeley DB Version 2 or greater\n");
11080
11081     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
11082                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
11083     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
11084                 Major, Minor, Patch) ;
11085
11086     /* check that db.h & libdb are compatible */
11087     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
11088         printf("db.h and libdb are incompatible\n") ;
11089         exit(3);        
11090     }
11091
11092     printf("db.h and libdb are compatible\n") ;
11093
11094     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
11095                 + DB_VERSION_PATCH ;
11096
11097     /* needs to be >= 2.3.4 */
11098     if (Version < 2003004) {
11099     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
11100         printf("but Perl needs Berkeley DB 2.3.4 or greater\n") ;
11101         exit(2);        
11102     }
11103
11104     exit(0);
11105 #else
11106 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
11107     printf("You have Berkeley DB Version 1\n");
11108     exit(0);    /* DB version < 2: the coast is clear. */
11109 #else
11110     exit(1);    /* <db.h> not Berkeley DB? */
11111 #endif
11112 #endif
11113 }
11114 EOCP
11115         set try
11116         if eval $compile && ./try; then
11117                 echo 'Looks OK.' >&4
11118         else
11119                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
11120                 i_db=$undef
11121                 case " $libs " in
11122                 *"-ldb "*)
11123                         : Remove db from list of libraries to use
11124                         echo "Removing unusable -ldb from library list" >&4
11125                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
11126                         shift
11127                         libs="$*"
11128                         echo "libs = $libs" >&4
11129                         ;;
11130                 esac
11131         fi
11132         $rm -f try.*
11133         ;;
11134 esac
11135
11136 case "$i_db" in
11137 define)
11138         : Check the return type needed for hash 
11139         echo " "
11140         echo "Checking return type needed for hash for Berkeley DB ..." >&4
11141         $cat >try.c <<EOCP
11142 #$d_const HASCONST
11143 #ifndef HASCONST
11144 #define const
11145 #endif
11146 #include <sys/types.h>
11147 #include <db.h>
11148
11149 #ifndef DB_VERSION_MAJOR
11150 u_int32_t hash_cb (ptr, size)
11151 const void *ptr;
11152 size_t size;
11153 {
11154 }
11155 HASHINFO info;
11156 int main()
11157 {
11158         info.hash = hash_cb;
11159 }
11160 #endif
11161 EOCP
11162         if $cc $ccflags -c try.c >try.out 2>&1 ; then
11163                 if $contains warning try.out >>/dev/null 2>&1 ; then
11164                         db_hashtype='int'
11165                 else
11166                         db_hashtype='u_int32_t'
11167                 fi
11168         else
11169                 : XXX Maybe we should just give up here.
11170                 db_hashtype=u_int32_t
11171                 $cat try.out >&4
11172                 echo "Help:  I can't seem to compile the db test program." >&4
11173                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
11174         fi
11175         $rm -f try.*
11176         echo "Your version of Berkeley DB uses $db_hashtype for hash."
11177         ;;
11178 *)      db_hashtype=u_int32_t
11179         ;;
11180 esac
11181 case "$i_db" in
11182 define)
11183         : Check the return type needed for prefix 
11184         echo " "
11185         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
11186         cat >try.c <<EOCP
11187 #$d_const HASCONST
11188 #ifndef HASCONST
11189 #define const
11190 #endif
11191 #include <sys/types.h>
11192 #include <db.h>
11193
11194 #ifndef DB_VERSION_MAJOR
11195 size_t prefix_cb (key1, key2)
11196 const DBT *key1;
11197 const DBT *key2;
11198 {
11199 }
11200 BTREEINFO info;
11201 int main()
11202 {
11203         info.prefix = prefix_cb;
11204 }
11205 #endif
11206 EOCP
11207         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
11208                 if $contains warning try.out >>/dev/null 2>&1 ; then
11209                         db_prefixtype='int'
11210                 else
11211                         db_prefixtype='size_t'
11212                 fi
11213         else
11214                 db_prefixtype='size_t'
11215                 : XXX Maybe we should just give up here.
11216                 $cat try.out >&4
11217                 echo "Help:  I can't seem to compile the db test program." >&4
11218                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
11219         fi
11220         $rm -f try.*
11221         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
11222         ;;
11223 *)      db_prefixtype='size_t'
11224         ;;
11225 esac
11226
11227 : check for void type
11228 echo " "
11229 echo "Checking to see how well your C compiler groks the void type..." >&4
11230 case "$voidflags" in
11231 '')
11232         $cat >try.c <<'EOCP'
11233 #if TRY & 1
11234 void sub() {
11235 #else
11236 sub() {
11237 #endif
11238         extern void moo();      /* function returning void */
11239         void (*goo)();          /* ptr to func returning void */
11240 #if TRY & 8
11241         void *hue;              /* generic ptr */
11242 #endif
11243 #if TRY & 2
11244         void (*foo[10])();
11245 #endif
11246
11247 #if TRY & 4
11248         if(goo == moo) {
11249                 exit(0);
11250         }
11251 #endif
11252         exit(0);
11253 }
11254 int main() { sub(); }
11255 EOCP
11256         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
11257                 voidflags=$defvoidused
11258         echo "Good.  It appears to support void to the level $package wants.">&4
11259                 if $contains warning .out >/dev/null 2>&1; then
11260                         echo "However, you might get some warnings that look like this:"
11261                         $cat .out
11262                 fi
11263         else
11264 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
11265                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
11266                         echo "It supports 1..."
11267                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
11268                                 echo "It also supports 2..."
11269                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
11270                                         voidflags=7
11271                                         echo "And it supports 4 but not 8 definitely."
11272                                 else
11273                                         echo "It doesn't support 4..."
11274                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
11275                                                 voidflags=11
11276                                                 echo "But it supports 8."
11277                                         else
11278                                                 voidflags=3
11279                                                 echo "Neither does it support 8."
11280                                         fi
11281                                 fi
11282                         else
11283                                 echo "It does not support 2..."
11284                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
11285                                         voidflags=13
11286                                         echo "But it supports 4 and 8."
11287                                 else
11288                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
11289                                                 voidflags=5
11290                                                 echo "And it supports 4 but has not heard about 8."
11291                                         else
11292                                                 echo "However it supports 8 but not 4."
11293                                         fi
11294                                 fi
11295                         fi
11296                 else
11297                         echo "There is no support at all for void."
11298                         voidflags=0
11299                 fi
11300         fi
11301 esac
11302 case "$voidflags" in
11303 "$defvoidused") ;;
11304 *)      $cat >&4 <<'EOM'
11305   Support flag bits are:
11306     1: basic void declarations.
11307     2: arrays of pointers to functions returning void.
11308     4: operations between pointers to and addresses of void functions.
11309     8: generic void pointers.
11310 EOM
11311         dflt="$voidflags";
11312         rp="Your void support flags add up to what?"
11313         . ./myread
11314         voidflags="$ans"
11315         ;;
11316 esac
11317 $rm -f try.* .out
11318
11319
11320 : How can we generate normalized random numbers ?
11321 echo " "
11322 echo "Looking for a random number function..." >&4
11323 case "$randfunc" in
11324 '')
11325         if set drand48 val -f; eval $csym; $val; then
11326                 dflt="drand48"
11327                 echo "Good, found drand48()." >&4
11328         elif set random val -f; eval $csym; $val; then
11329                 dflt="random"
11330                 echo "OK, found random()." >&4
11331         else
11332                 dflt="rand"
11333                 echo "Yick, looks like I have to use rand()." >&4
11334         fi
11335         echo " "
11336         ;;
11337 *)
11338         dflt="$randfunc"
11339         ;;
11340 esac
11341 cont=true
11342
11343 case "$ccflags" in
11344 *-Dmy_rand=*|*-Dmy_srand=*)
11345         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
11346         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
11347         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
11348         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
11349         ;;
11350 esac
11351
11352 while $test "$cont"; do
11353         rp="Use which function to generate random numbers?"
11354         . ./myread
11355         if $test "$ans" = "$dflt"; then
11356                 : null
11357         else
11358                 randbits=''
11359         fi
11360         randfunc="$ans"
11361         if set $ans val -f; eval $csym; $val; then
11362                 cont=''
11363         else
11364                 dflt=y
11365                 rp="I cannot find function $ans. Use that name anyway?"
11366                 . ./myread
11367                 dflt=rand
11368                 case "$ans" in
11369                         [yY]*) cont='';;
11370                 esac
11371         fi
11372         case "$cont" in
11373         '')
11374                 case "$randfunc" in
11375                 drand48)
11376                         drand01="drand48()"
11377                         seedfunc="srand48"
11378                         randbits=48
11379                         randseedtype=long
11380                         ;;
11381                 rand|random)
11382                         case "$randbits" in
11383                         '')
11384 echo "Checking to see how many bits your $randfunc() function produces..." >&4
11385                                 $cat >try.c <<EOCP
11386 #$i_unistd I_UNISTD
11387 #$i_stdlib I_STDLIB
11388 #include <stdio.h>
11389 #ifdef I_UNISTD
11390 #  include <unistd.h>
11391 #endif
11392 #ifdef I_STDLIB
11393 #  include <stdlib.h>
11394 #endif
11395 int main()
11396 {
11397         register int i;
11398         register unsigned long tmp;
11399         register unsigned long max = 0L;
11400
11401         for (i = 1000; i; i--) {
11402                 tmp = (unsigned long) $randfunc();
11403                 if (tmp > max) max = tmp;
11404         }
11405         for (i = 0; max; i++)
11406                 max /= 2;
11407         printf("%d\n",i);
11408 }
11409 EOCP
11410                                 set try
11411                                 if eval $compile_ok; then
11412                                         dflt=`try`
11413                                 else
11414                                         dflt='?'
11415                                         echo "(I can't seem to compile the test program...)"
11416                                 fi
11417                                 ;;
11418                         *)
11419                                 dflt="$randbits"
11420                                 ;;
11421                         esac
11422                         rp="How many bits does your $randfunc() function produce?"
11423                         . ./myread
11424                         randbits="$ans"
11425                         $rm -f try.c try
11426                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
11427                         seedfunc="s$randfunc"
11428                         randseedtype=unsigned
11429                         ;;
11430                 *)
11431                         dflt="31"
11432                         rp="How many bits does your $randfunc() function produce?"
11433                         . ./myread
11434                         randbits="$ans"
11435                         seedfunc="s$randfunc"
11436                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
11437                         if set $seedfunc val -f; eval $csym; $val; then
11438                                 echo "(Using $seedfunc() to seed random generator)"
11439                         else
11440                                 echo "(Warning: no $seedfunc() to seed random generator)"
11441                                 seedfunc=rand
11442                         fi
11443                         randseedtype=unsigned
11444                         ;;
11445                 esac
11446                 ;;
11447         esac
11448 done
11449
11450 echo " "
11451 echo "Determining whether or not we are on an EBCDIC system..." >&4
11452 $cat >tebcdic.c <<'EOM'
11453 int main()
11454 {
11455   if ('M'==0xd4) return 0;
11456   return 1;
11457 }
11458 EOM
11459
11460 val=$undef
11461 set tebcdic
11462 if eval $compile_ok; then
11463         if ./tebcdic; then
11464                 echo "You have EBCDIC." >&4
11465                 val="$define"
11466         else
11467                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin." >&4
11468         fi
11469 else
11470         echo "I'm unable to compile the test program." >&4
11471         echo "I'll assume ASCII or some ISO Latin." >&4
11472 fi
11473 $rm -f tebcdic.c tebcdic
11474 set ebcdic
11475 eval $setvar
11476
11477 echo " "
11478 $cat >&4 <<EOM
11479 Checking how to flush all pending stdio output...
11480 EOM
11481 # I only know how to find the first 32 possibly open files on SunOS.
11482 # See also hints/sunos_4_1.sh and util.c  --AD
11483 case "$osname" in
11484 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
11485 esac
11486 $cat >>try.c <<EOCP
11487 #include <stdio.h>
11488 #$i_unistd I_UNISTD
11489 #ifdef I_UNISTD
11490 # include <unistd.h>
11491 #endif
11492 #$d_sysconf HAS_SYSCONF
11493 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
11494 #ifdef HAS_STDIO_STREAM_ARRAY
11495 # define STDIO_STREAM_ARRAY $stdio_stream_array
11496 #endif
11497 int main() {
11498   FILE* p = fopen("try.out", "w");
11499 #ifdef TRY_FPUTC
11500   fputc('x', p);
11501 #else
11502 # ifdef TRY_FPRINTF
11503   fprintf(p, "x");
11504 # endif
11505 #endif
11506 #ifdef TRY_FFLUSH_NULL
11507   fflush(NULL);
11508 #endif
11509 #ifdef TRY_FFLUSH_ALL
11510   {
11511     long open_max = -1;
11512 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
11513     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
11514 # else
11515 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
11516     open_max = sysconf(_SC_OPEN_MAX);
11517 #  else
11518 #   ifdef FOPEN_MAX
11519     open_max = FOPEN_MAX;
11520 #   else
11521 #    ifdef OPEN_MAX
11522     open_max = OPEN_MAX;
11523 #    else
11524 #     ifdef _NFILE
11525     open_max = _NFILE;
11526 #     endif
11527 #    endif
11528 #   endif
11529 #  endif
11530 # endif 
11531 # ifdef HAS_STDIO_STREAM_ARRAY
11532     if (open_max > 0) {
11533       long i;
11534       for (i = 0; i < open_max; i++)
11535             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
11536                 STDIO_STREAM_ARRAY[i]._file < open_max &&
11537                 STDIO_STREAM_ARRAY[i]._flag)
11538                 fflush(&STDIO_STREAM_ARRAY[i]);
11539     }   
11540   }
11541 # endif
11542 #endif
11543   _exit(42);
11544 }
11545 EOCP
11546 : first we have to find out how _not_ to flush
11547 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
11548     output=''
11549     set try -DTRY_FPUTC
11550     if eval $compile; then
11551             $rm -f try.out
11552             ./try$exe_ext 2>/dev/null
11553             if $test ! -s try.out -a "X$?" = X42; then
11554                 output=-DTRY_FPUTC
11555             fi
11556     fi
11557     case "$output" in
11558     '')
11559             set try -DTRY_FPRINTF
11560             $rm -f try.out
11561             if eval $compile; then
11562                     $rm -f try.out
11563                     ./try$exe_ext 2>/dev/null
11564                     if $test ! -s try.out -a "X$?" = X42; then
11565                         output=-DTRY_FPRINTF
11566                     fi
11567             fi
11568         ;;
11569     esac
11570 fi
11571 : check for fflush NULL behaviour
11572 case "$fflushNULL" in
11573 '')     set try -DTRY_FFLUSH_NULL $output
11574         if eval $compile; then
11575                 $rm -f try.out
11576                 ./try$exe_ext 2>/dev/null
11577                 code="$?"
11578                 if $test -s try.out -a "X$code" = X42; then
11579                         fflushNULL="`$cat try.out`"
11580                 else
11581                         if $test "X$code" != X42; then
11582                                 $cat >&4 <<EOM
11583 (If this test failed, don't worry, we'll try another method shortly.)
11584 EOM
11585                         fi
11586                 fi
11587         fi
11588         $rm -f core try.core core.try.*
11589         case "$fflushNULL" in
11590         x)      $cat >&4 <<EOM
11591 Your fflush(NULL) works okay.
11592 EOM
11593                 fflushNULL="$define"
11594                 ;;
11595         '')     $cat >&4 <<EOM
11596 Your fflush(NULL) isn't working (contrary to ANSI C).
11597 EOM
11598                 fflushNULL="$undef"
11599                 ;;
11600         *)      $cat >&4 <<EOM
11601 Cannot figure out whether your fflush(NULL) works or not.
11602 I'm assuming it doesn't (contrary to ANSI C).
11603 EOM
11604                 fflushNULL="$undef"
11605                 ;;
11606         esac
11607         ;;
11608 $define|true|[yY]*)
11609         fflushNULL="$define"
11610         ;;
11611 *)
11612         fflushNULL="$undef"
11613         ;;
11614 esac
11615 : check explicit looping only if NULL did not work
11616 case "$fflushNULL" in
11617 "$undef")
11618         : check for fflush all behaviour
11619         case "$fflushall" in
11620         '')     set try -DTRY_FFLUSH_ALL $output
11621                 if eval $compile; then
11622                         $cat >&4 <<EOM
11623 (Now testing the other method--but note that also this may fail.)
11624 EOM
11625                         $rm -f try.out
11626                         ./try$exe_ext 2>/dev/null
11627                         if $test -s try.out -a "X$?" = X42; then
11628                                 fflushall="`$cat try.out`"
11629                         fi
11630                 fi
11631                 $rm -f core try.core core.try.*
11632                 case "$fflushall" in
11633                 x)      $cat >&4 <<EOM
11634 Whew. Flushing explicitly all the stdio streams works.
11635 EOM
11636                         fflushall="$define"
11637                         ;;
11638                 '')     $cat >&4 <<EOM
11639 Sigh. Flushing explicitly all the stdio streams doesn't work.
11640 EOM
11641                         fflushall="$undef"
11642                         ;;
11643                 *)      $cat >&4 <<EOM
11644 Cannot figure out whether flushing stdio streams explicitly works or not.
11645 I'm assuming it doesn't.
11646 EOM
11647                         fflushall="$undef"
11648                         ;;
11649                 esac
11650                 ;;
11651         "$define"|true|[yY]*)
11652                 fflushall="$define"
11653                 ;;
11654         *)
11655                 fflushall="$undef"
11656                 ;;
11657         esac
11658         ;;
11659 *)      fflushall="$undef"      
11660         ;;
11661 esac
11662 case "$fflushNULL$fflushall" in
11663 undefundef)
11664         $cat <<EOM
11665 I cannot figure out how to flush pending stdio output.
11666 EOM
11667         ;;
11668 esac
11669 $rm -f try.* try$exe_ext
11670
11671 : see what type file positions are declared as in the library
11672 rp="What is the type for file position used by fsetpos()?"
11673 set fpos_t fpostype long stdio.h sys/types.h
11674 eval $typedef_ask
11675
11676 : Store the full pathname to the ar program for use in the C program
11677 : Respect a hint or command line value for full_ar.
11678 case "$full_ar" in
11679 '') full_ar=$ar ;;
11680 esac
11681
11682 : Store the full pathname to the sed program for use in the C program
11683 full_sed=$sed
11684
11685 : see what type gids are declared as in the kernel
11686 echo " "
11687 echo "Looking for the type for group ids returned by getgid()."
11688 set gid_t gidtype xxx stdio.h sys/types.h
11689 eval $typedef
11690 case "$gidtype" in
11691 xxx)
11692         xxx=`./findhdr sys/user.h`
11693         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
11694         case $1 in
11695         unsigned) dflt="$1 $2" ;;
11696         *) dflt="$1" ;;
11697         esac
11698         ;;
11699 *) dflt="$gidtype";;
11700 esac
11701 case "$gidtype" in
11702 gid_t) echo "gid_t found." ;;
11703 *)      rp="What is the type for group ids returned by getgid()?"
11704         . ./myread
11705         gidtype="$ans"
11706         ;;
11707 esac
11708
11709 : see if getgroups exists
11710 set getgroups d_getgrps
11711 eval $inlibc
11712
11713 : see if setgroups exists
11714 set setgroups d_setgrps
11715 eval $inlibc
11716
11717
11718 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
11719 echo " "
11720 case "$d_getgrps$d_setgrps" in
11721 *define*)
11722         case "$groupstype" in
11723         '') dflt="$gidtype" ;;
11724         *)  dflt="$groupstype" ;;
11725         esac
11726         $cat <<EOM
11727 What type of pointer is the second argument to getgroups() and setgroups()?
11728 Usually this is the same as group ids, $gidtype, but not always.
11729
11730 EOM
11731         rp='What type pointer is the second argument to getgroups() and setgroups()?'
11732         . ./myread
11733         groupstype="$ans"
11734         ;;
11735 *)  groupstype="$gidtype";;
11736 esac
11737
11738 : see what type lseek is declared as in the kernel
11739 rp="What is the type used for lseek's offset on this system?"
11740 set off_t lseektype long stdio.h sys/types.h
11741 eval $typedef_ask
11742
11743 echo " "
11744 $echo $n "Checking to see how big your file offsets are...$c" >&4
11745 $cat >try.c <<EOCP
11746 #include <sys/types.h>
11747 #include <stdio.h>
11748 int main()
11749 {
11750         printf("%d\n", sizeof($lseektype));
11751 }
11752 EOCP
11753 set try
11754 if eval $compile_ok; then
11755         lseeksize=`./try`
11756         $echo " $lseeksize bytes." >&4
11757 else
11758         dflt='4'
11759         echo " "
11760         echo "(I can't seem to compile the test program.  Guessing...)"
11761         rp="What is the size of your file offsets (in bytes)?"
11762         . ./myread
11763         lseeksize="$ans"
11764 fi
11765 $rm -f try.c try
11766
11767 echo " "
11768 echo "Checking if your $make program sets \$(MAKE)..." >&4
11769 case "$make_set_make" in
11770 '')
11771         $sed 's/^X //' > testmake.mak << 'EOF'
11772 Xall:
11773 X       @echo 'maketemp="$(MAKE)"'
11774 EOF
11775         case "`$make -f testmake.mak 2>/dev/null`" in
11776         *maketemp=*) make_set_make='#' ;;
11777         *)      make_set_make="MAKE=$make" ;;
11778         esac
11779         $rm -f testmake.mak
11780         ;;
11781 esac
11782 case "$make_set_make" in
11783 '#') echo "Yup, it does.";;
11784 *) echo "Nope, it doesn't.";;
11785 esac
11786
11787 : see what type is used for mode_t
11788 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
11789 set mode_t modetype int stdio.h sys/types.h
11790 eval $typedef_ask
11791
11792 : define a fucntion to check prototypes
11793 $cat > protochk <<EOSH
11794 $startsh
11795 cc="$cc"
11796 optimize="$optimize"
11797 ccflags="$ccflags"
11798 prototype="$prototype"
11799 define="$define"
11800 rm=$rm
11801 EOSH
11802
11803 $cat >> protochk <<'EOSH'
11804
11805 $rm -f try.c
11806 foo="$1"
11807 shift
11808 while test $# -ge 2; do
11809         case "$1" in
11810                 $define) echo "#include <$2>" >> try.c ;;
11811                 literal) echo "$2" >> try.c ;;
11812         esac
11813     shift 2
11814 done
11815 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
11816 cat >> try.c <<'EOCP'
11817 #ifdef CAN_PROTOTYPE
11818 #define _(args) args
11819 #else
11820 #define _(args) ()
11821 #endif
11822 EOCP
11823 echo "$foo" >> try.c
11824 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
11825 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
11826 status=$?
11827 $rm -f try.[co]
11828 exit $status
11829 EOSH
11830 chmod +x protochk
11831 $eunicefix protochk
11832
11833 : see what type is used for size_t
11834 rp="What is the type used for the length parameter for string functions?"
11835 set size_t sizetype 'unsigned int' stdio.h sys/types.h
11836 eval $typedef_ask
11837
11838 : check for type of arguments to gethostbyaddr. 
11839 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
11840         case "$d_gethbyaddr" in
11841         $define)
11842                 $cat <<EOM
11843
11844 Checking to see what type of arguments are accepted by gethostbyaddr().
11845 EOM
11846                 hdrs="$define sys/types.h
11847                         $d_socket sys/socket.h 
11848                         $i_niin netinet/in.h 
11849                         $i_netdb netdb.h
11850                         $i_unistd unistd.h"
11851                 : The first arg can 'char *' or 'void *'
11852                 : The second arg is some of integral type
11853                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
11854                         for yyy in size_t long int; do
11855                                 case "$netdb_host_type" in
11856                                 '')     try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
11857                                         if ./protochk "$try" $hdrs; then
11858                                                 echo "Your system accepts $xxx for the first arg."
11859                                                 echo "...and $yyy for the second arg."
11860                                                 netdb_host_type="$xxx"
11861                                                 netdb_hlen_type="$yyy"
11862                                         fi
11863                                         ;;
11864                                 esac
11865                         done
11866                 done
11867                 : In case none of those worked, prompt the user.
11868                 case "$netdb_host_type" in
11869                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
11870                         dflt='char *'
11871                         . ./myread
11872                         netdb_host_type=$ans
11873                         rp='What is the type for the 2nd argument to gethostbyaddr?'
11874                         dflt="$sizetype"
11875                         . ./myread
11876                         netdb_hlen_type=$ans
11877                         ;;
11878                 esac
11879                 ;;
11880         *)      : no gethostbyaddr, so pick harmless defaults
11881                 netdb_host_type='char *'
11882                 netdb_hlen_type="$sizetype"
11883                 ;;
11884         esac
11885         # Remove the "const" if needed. -- but then we'll have a 
11886         # prototype clash!
11887         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
11888 fi
11889
11890 : check for type of argument to gethostbyname. 
11891 if test "X$netdb_name_type" = X ; then
11892         case "$d_gethbyname" in
11893         $define)
11894                 $cat <<EOM
11895
11896 Checking to see what type of argument is accepted by gethostbyname().
11897 EOM
11898                 hdrs="$define sys/types.h
11899                         $d_socket sys/socket.h 
11900                         $i_niin netinet/in.h 
11901                         $i_netdb netdb.h
11902                         $i_unistd unistd.h"
11903                 for xxx in "const char *" "char *"; do
11904                         case "$netdb_name_type" in
11905                         '')     try="extern struct hostent *gethostbyname($xxx);"
11906                                 if ./protochk "$try" $hdrs; then
11907                                         echo "Your system accepts $xxx."
11908                                         netdb_name_type="$xxx"
11909                                 fi
11910                                 ;;
11911                         esac
11912                 done
11913                 : In case none of those worked, prompt the user.
11914                 case "$netdb_name_type" in
11915                 '')     rp='What is the type for the 1st argument to gethostbyname?'
11916                         dflt='char *'
11917                         . ./myread
11918                         netdb_name_type=$ans
11919                         ;;
11920                 esac
11921                 ;;
11922         *)      : no gethostbyname, so pick harmless default
11923                 netdb_name_type='char *'
11924                 ;;
11925         esac
11926 fi
11927
11928 : check for type of 1st argument to getnetbyaddr. 
11929 if test "X$netdb_net_type" = X ; then
11930         case "$d_getnbyaddr" in
11931         $define)
11932                 $cat <<EOM
11933
11934 Checking to see what type of 1st argument is accepted by getnetbyaddr().
11935 EOM
11936                 hdrs="$define sys/types.h
11937                         $d_socket sys/socket.h 
11938                         $i_niin netinet/in.h 
11939                         $i_netdb netdb.h
11940                         $i_unistd unistd.h"
11941                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
11942                         case "$netdb_net_type" in
11943                         '')     try="extern struct netent *getnetbyaddr($xxx, int);"
11944                                 if ./protochk "$try" $hdrs; then
11945                                         echo "Your system accepts $xxx."
11946                                         netdb_net_type="$xxx"
11947                                 fi
11948                                 ;;
11949                         esac
11950                 done
11951                 : In case none of those worked, prompt the user.
11952                 case "$netdb_net_type" in
11953                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
11954                         dflt='long'
11955                         . ./myread
11956                         netdb_net_type=$ans
11957                         ;;
11958                 esac
11959                 ;;
11960         *)      : no getnetbyaddr, so pick harmless default
11961                 netdb_net_type='long'
11962                 ;;
11963         esac
11964 fi
11965 : locate the preferred pager for this system
11966 case "$pager" in
11967 '')
11968         dflt=''
11969         case "$pg" in
11970         /*) dflt=$pg;;
11971         esac
11972         case "$more" in
11973         /*) dflt=$more;;
11974         esac
11975         case "$less" in
11976         /*) dflt=$less;;
11977         esac
11978         case "$dflt" in
11979         '') dflt=/usr/ucb/more;;
11980         esac
11981         ;;
11982 *) dflt="$pager";;
11983 esac
11984 echo " "
11985 fn=f/
11986 rp='What pager is used on your system?'
11987 . ./getfile
11988 pager="$ans"
11989
11990 : see what type pids are declared as in the kernel
11991 rp="What is the type of process ids on this system?"
11992 set pid_t pidtype int stdio.h sys/types.h
11993 eval $typedef_ask
11994
11995 : Find earliest binary compatible site_perl subdirectory perl can use.
11996 case "$bincompat5005" in
11997 "$define") xs_apiversion='5.005' ;;
11998 *) xs_apiversion=$apiversion ;;   # The current site_perl version.
11999 esac
12000 : Find earliest pure perl site_perl subdirectory perl can use.
12001 : The versioned directories started at 5.005.
12002 pm_apiversion='5.005'
12003
12004 : check for length of pointer
12005 echo " "
12006 case "$ptrsize" in
12007 '')
12008         $echo $n "Checking to see how big your pointers are...$c" >&4
12009         if test "$voidflags" -gt 7; then
12010                 echo '#define VOID_PTR char *' > try.c
12011         else
12012                 echo '#define VOID_PTR void *' > try.c
12013         fi
12014         $cat >>try.c <<'EOCP'
12015 #include <stdio.h>
12016 int main()
12017 {
12018         printf("%d\n", sizeof(VOID_PTR));
12019         exit(0);
12020 }
12021 EOCP
12022         set try
12023         if eval $compile_ok; then
12024                 ptrsize=`./try`
12025                 $echo " $ptrsize bytes." >&4
12026         else
12027                 dflt='4'
12028                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
12029                 rp="What is the size of a pointer (in bytes)?"
12030                 . ./myread
12031                 ptrsize="$ans"
12032         fi
12033         ;;
12034 esac
12035 $rm -f try.c try
12036
12037 : see if ar generates random libraries by itself
12038 echo " "
12039 echo "Checking how to generate random libraries on your machine..." >&4
12040 echo 'int bar1() { return bar2(); }' > bar1.c
12041 echo 'int bar2() { return 2; }' > bar2.c
12042 $cat > foo.c <<'EOP'
12043 int main() { printf("%d\n", bar1()); exit(0); }
12044 EOP
12045 $cc $ccflags -c bar1.c >/dev/null 2>&1
12046 $cc $ccflags -c bar2.c >/dev/null 2>&1
12047 $cc $ccflags -c foo.c >/dev/null 2>&1
12048 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
12049 if $cc $ccflags $ldflags -o foobar foo$_o bar$_a $libs > /dev/null 2>&1 &&
12050         ./foobar >/dev/null 2>&1; then
12051         echo "$ar appears to generate random libraries itself."
12052         orderlib=false
12053         ranlib=":"
12054 elif $ar ts bar$_a >/dev/null 2>&1 &&
12055         $cc $ccflags $ldflags -o foobar foo$_o bar$_a $libs > /dev/null 2>&1 &&
12056         ./foobar >/dev/null 2>&1; then
12057                 echo "a table of contents needs to be added with '$ar ts'."
12058                 orderlib=false
12059                 ranlib="$ar ts"
12060 else
12061         case "$ranlib" in
12062         :) ranlib='';;
12063         '')
12064                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
12065                 $test -f $ranlib || ranlib=''
12066                 ;;
12067         esac
12068         if $test -n "$ranlib"; then
12069                 echo "your system has '$ranlib'; we'll use that."
12070                 orderlib=false
12071         else
12072                 echo "your system doesn't seem to support random libraries"
12073                 echo "so we'll use lorder and tsort to order the libraries."
12074                 orderlib=true
12075                 ranlib=":"
12076         fi
12077 fi
12078 $rm -f foo* bar* 
12079
12080 : check for type of arguments to select. 
12081 case "$selecttype" in
12082 '') case "$d_select" in
12083         $define)
12084                 $cat <<EOM
12085 Checking to see what type of arguments are accepted by select().
12086 EOM
12087                 hdrs="$define sys/types.h
12088                         $i_systime sys/time.h 
12089                         $i_sysselct sys/select.h
12090                         $d_socket sys/socket.h"
12091                 : The first arg can be int, unsigned, or size_t
12092                 : The last arg may or may not be 'const'
12093                 val=''
12094                 : void pointer has been seen but using that
12095                 : breaks the selectminbits test
12096                 for xxx in 'fd_set *' 'int *'; do
12097                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
12098                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
12099                                         case "$val" in
12100                                         '')     try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
12101                                                 if ./protochk "$try" $hdrs; then
12102                                                         echo "Your system accepts $xxx."
12103                                                         val="$xxx"
12104                                                 fi
12105                                                 ;;
12106                                         esac
12107                                 done
12108                         done
12109                 done
12110                 case "$val" in
12111                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
12112                         case "$d_fd_set" in
12113                                 $define) dflt="fd_set *" ;;
12114                                 *)              dflt="int *" ;;
12115                         esac
12116                         . ./myread
12117                         val=$ans
12118                         ;;
12119                 esac
12120                 selecttype="$val"
12121                 ;;
12122         *)      : no select, so pick a harmless default
12123                 selecttype='int *'
12124                 ;;
12125         esac
12126         ;;
12127 esac
12128
12129 : check for the select 'width'
12130 case "$selectminbits" in
12131 '') case "$d_select" in
12132         $define)
12133                 $cat <<EOM
12134
12135 Checking to see on how many bits at a time your select() operates...
12136 EOM
12137                 $cat >try.c <<EOCP
12138 #include <sys/types.h>
12139 #$i_time I_TIME
12140 #$i_systime I_SYS_TIME
12141 #$i_systimek I_SYS_TIME_KERNEL
12142 #ifdef I_TIME
12143 #   include <time.h>
12144 #endif
12145 #ifdef I_SYS_TIME
12146 #   ifdef I_SYS_TIME_KERNEL
12147 #       define KERNEL
12148 #   endif
12149 #   include <sys/time.h>
12150 #   ifdef I_SYS_TIME_KERNEL
12151 #       undef KERNEL
12152 #   endif
12153 #endif
12154 #$i_sysselct I_SYS_SELECT
12155 #ifdef I_SYS_SELECT
12156 #include <sys/select.h>
12157 #endif
12158 #$d_socket HAS_SOCKET
12159 #ifdef HAS_SOCKET
12160 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
12161 #endif
12162 #include <stdio.h>
12163 $selecttype b;
12164 #define S sizeof(*(b))
12165 #define MINBITS 64
12166 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
12167 #define NBITS  (NBYTES * 8)
12168 int main() {
12169     char s[NBYTES];
12170     struct timeval t;
12171     int i;
12172     FILE* fp;
12173     int fd;
12174
12175     fclose(stdin);
12176     fp = fopen("try.c", "r");
12177     if (fp == 0)
12178       exit(1);
12179     fd = fileno(fp);
12180     if (fd < 0)
12181       exit(2);
12182     b = ($selecttype)s;
12183     for (i = 0; i < NBITS; i++)
12184         FD_SET(i, b);
12185     t.tv_sec  = 0;
12186     t.tv_usec = 0;
12187     select(fd + 1, b, 0, 0, &t);
12188     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
12189     printf("%d\n", i + 1);
12190     return 0;
12191 }
12192 EOCP
12193                 set try
12194                 if eval $compile_ok; then
12195                         selectminbits=`./try`
12196                         case "$selectminbits" in
12197                         '')     cat >&4 <<EOM
12198 Cannot figure out on how many bits at a time your select() operates.
12199 I'll play safe and guess it is 32 bits.
12200 EOM
12201                                 selectminbits=32
12202                                 bits="32 bits"
12203                                 ;;
12204                         1)      bits="1 bit" ;;
12205                         *)      bits="$selectminbits bits" ;;
12206                         esac
12207                         echo "Your select() operates on $bits at a time." >&4
12208                 else
12209                         rp='What is the minimum number of bits your select() operates on?'
12210                         case "$byteorder" in
12211                         1234|12345678)  dflt=32 ;;
12212                         *)              dflt=1  ;;
12213                         esac
12214                         . ./myread
12215                         val=$ans
12216                         selectminbits="$val"
12217                 fi
12218                 $rm -f try.* try
12219                 ;;
12220         *)      : no select, so pick a harmless default
12221                 selectminbits='32'
12222                 ;;
12223         esac
12224         ;;
12225 esac
12226
12227 : Trace out the files included by signal.h, then look for SIGxxx names.
12228 : Remove SIGARRAYSIZE used by HPUX.
12229 : Remove SIGSTKSIZE used by Linux.
12230 : Remove SIGSTKSZ used by Posix.
12231 : Remove SIGTYP void lines used by OS2.
12232 xxx=`echo '#include <signal.h>' |
12233         $cppstdin $cppminus $cppflags 2>/dev/null |
12234         $grep '^[       ]*#.*include' | 
12235         $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sort | $uniq`
12236 : Check this list of files to be sure we have parsed the cpp output ok.
12237 : This will also avoid potentially non-existent files, such 
12238 : as ../foo/bar.h
12239 xxxfiles=''
12240 for xx in $xxx /dev/null ; do
12241         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
12242 done
12243 : If we have found no files, at least try signal.h
12244 case "$xxxfiles" in
12245 '')     xxxfiles=`./findhdr signal.h` ;;
12246 esac
12247 xxx=`awk '
12248 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
12249         print substr($2, 4, 20)
12250 }
12251 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
12252         print substr($3, 4, 20)
12253 }' $xxxfiles`
12254 : Append some common names just in case the awk scan failed.
12255 xxx="$xxx ABRT ALRM BUS CHLD CLD CONT DIL EMT FPE HUP ILL INT IO IOT KILL"
12256 xxx="$xxx LOST PHONE PIPE POLL PROF PWR QUIT SEGV STKFLT STOP SYS TERM TRAP"
12257 xxx="$xxx TSTP TTIN TTOU URG USR1 USR2 USR3 USR4 VTALRM"
12258 xxx="$xxx WINCH WIND WINDOW XCPU XFSZ"
12259 : generate a few handy files for later
12260 $cat > signal.c <<'EOCP'
12261 #include <sys/types.h>
12262 #include <signal.h>
12263 #include <stdio.h>
12264 int main() {
12265
12266 /* Strange style to avoid deeply-nested #if/#else/#endif */
12267 #ifndef NSIG
12268 #  ifdef _NSIG
12269 #    define NSIG (_NSIG)
12270 #  endif
12271 #endif
12272
12273 #ifndef NSIG
12274 #  ifdef SIGMAX
12275 #    define NSIG (SIGMAX+1)
12276 #  endif
12277 #endif
12278
12279 #ifndef NSIG
12280 #  ifdef SIG_MAX
12281 #    define NSIG (SIG_MAX+1)
12282 #  endif
12283 #endif
12284
12285 #ifndef NSIG
12286 #  ifdef MAXSIG
12287 #    define NSIG (MAXSIG+1)
12288 #  endif
12289 #endif
12290
12291 #ifndef NSIG
12292 #  ifdef MAX_SIG
12293 #    define NSIG (MAX_SIG+1)
12294 #  endif
12295 #endif
12296
12297 #ifndef NSIG
12298 #  ifdef SIGARRAYSIZE
12299 #    define NSIG (SIGARRAYSIZE+1) /* Not sure of the +1 */
12300 #  endif
12301 #endif
12302
12303 #ifndef NSIG
12304 #  ifdef _sys_nsig
12305 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
12306 #  endif
12307 #endif
12308
12309 /* Default to some arbitrary number that's big enough to get most
12310    of the common signals.
12311 */
12312 #ifndef NSIG
12313 #    define NSIG 50
12314 #endif
12315
12316 printf("NSIG %d\n", NSIG);
12317
12318 #ifndef JUST_NSIG
12319
12320 EOCP
12321
12322 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
12323 {
12324         printf "#ifdef SIG"; printf $1; printf "\n"
12325         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
12326         printf $1; printf ");\n"
12327         printf "#endif\n"
12328 }
12329 END {
12330         printf "#endif /* JUST_NSIG */\n";
12331         printf "}\n";
12332 }
12333 ' >>signal.c
12334 $cat >signal.awk <<'EOP'
12335 BEGIN { ndups = 0 }
12336 $1 ~ /^NSIG$/ { nsig = $2 }
12337 ($1 !~ /^NSIG$/) && (NF == 2) {
12338     if ($2 > maxsig) { maxsig = $2 }
12339     if (sig_name[$2]) {
12340         dup_name[ndups] = $1
12341         dup_num[ndups] = $2
12342         ndups++ 
12343     }
12344     else {
12345         sig_name[$2] = $1
12346         sig_num[$2] = $2
12347     }
12348 }
12349 END { 
12350     if (nsig == 0) {
12351         nsig = maxsig + 1
12352     }
12353     printf("NSIG %d\n", nsig);
12354     for (n = 1; n < nsig; n++) {
12355         if (sig_name[n]) {
12356             printf("%s %d\n", sig_name[n], sig_num[n])
12357         }
12358         else {
12359             printf("NUM%d %d\n", n, n) 
12360         }
12361     }
12362     for (n = 0; n < ndups; n++) {
12363         printf("%s %d\n", dup_name[n], dup_num[n])
12364     }
12365 }
12366 EOP
12367 $cat >signal_cmd <<EOS
12368 $startsh
12369 if $test -s signal.lst; then
12370     echo "Using your existing signal.lst file"
12371         exit 0
12372 fi
12373 xxx="$xxx"
12374 EOS
12375 $cat >>signal_cmd <<'EOS'
12376
12377 set signal
12378 if eval $compile_ok; then
12379         ./signal$_exe | $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
12380 else
12381         echo "(I can't seem be able to compile the whole test program)" >&4
12382         echo "(I'll try it in little pieces.)" >&4
12383         set signal -DJUST_NSIG
12384         if eval $compile_ok; then
12385                 ./signal$_exe > signal.nsg
12386                 $cat signal.nsg
12387         else
12388                 echo "I can't seem to figure out how many signals you have." >&4
12389                 echo "Guessing 50." >&4
12390                 echo 'NSIG 50' > signal.nsg
12391         fi
12392         : Now look at all the signal names, one at a time.
12393         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
12394                 $cat > signal.c <<EOCP
12395 #include <sys/types.h>
12396 #include <signal.h>
12397 #include <stdio.h>
12398 int main() {
12399 printf("$xx %d\n", SIG${xx});
12400 return 0;
12401 }
12402 EOCP
12403                 set signal
12404                 if eval $compile; then
12405                         echo "SIG${xx} found."
12406                         ./signal$_exe  >> signal.ls1
12407                 else
12408                         echo "SIG${xx} NOT found."
12409                 fi
12410         done
12411         if $test -s signal.ls1; then
12412                 $cat signal.nsg signal.ls1 |
12413                         $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
12414         fi
12415
12416 fi
12417 if $test -s signal.lst; then
12418         :
12419 else
12420         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
12421         echo 'kill -l' >signal
12422         set X `csh -f <signal`
12423         $rm -f signal
12424         shift
12425         case $# in
12426         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
12427         esac
12428         echo $@ | $tr ' ' $trnl | \
12429             $awk '{ printf "%s %d\n", $1, ++s; }
12430                   END { printf "NSIG %d\n", ++s }' >signal.lst
12431 fi
12432 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
12433 EOS
12434 chmod a+x signal_cmd
12435 $eunicefix signal_cmd
12436
12437 : generate list of signal names
12438 echo " "
12439 case "$sig_name_init" in
12440 '') doinit=yes ;;
12441 *)  case "$sig_num_init" in
12442     ''|*,*) doinit=yes ;;
12443     esac ;;
12444 esac
12445 case "$doinit" in
12446 yes)
12447         echo "Generating a list of signal names and numbers..." >&4
12448         . ./signal_cmd
12449         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
12450         sig_name=`$awk 'BEGIN { printf "ZERO " }
12451                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
12452         sig_num=`$awk  'BEGIN { printf "0 " }
12453                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
12454         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
12455                              !/^NSIG/   { printf "\"%s\", ", $1 }
12456                              END        { printf "0\n" }' signal.lst`
12457         sig_num_init=`$awk  'BEGIN      { printf "0, " }
12458                              !/^NSIG/   { printf "%d, ", $2}
12459                              END        { printf "0\n"}' signal.lst`
12460         ;;
12461 esac
12462 echo "The following $sig_count signals are available:"
12463 echo " "
12464 echo $sig_name | $awk \
12465 'BEGIN { linelen = 0 }
12466 {
12467         for (i = 1; i <= NF; i++) {
12468                 name = "SIG" $i " "
12469                 linelen = linelen + length(name)
12470                 if (linelen > 70) {
12471                         printf "\n"
12472                         linelen = length(name)
12473                 }
12474                 printf "%s", name
12475         }
12476         printf "\n"
12477 }'
12478 $rm -f signal signal.c signal.awk signal.lst signal_cmd 
12479
12480 : see what type is used for signed size_t
12481 set ssize_t ssizetype int stdio.h sys/types.h
12482 eval $typedef
12483 dflt="$ssizetype"
12484 $cat > ssize.c <<EOM
12485 #include <stdio.h>
12486 #include <sys/types.h>
12487 #define Size_t $sizetype
12488 #define SSize_t $dflt
12489 int main()
12490 {
12491         if (sizeof(Size_t) == sizeof(SSize_t))
12492                 printf("$dflt\n");
12493         else if (sizeof(Size_t) == sizeof(int))
12494                 printf("int\n");
12495         else 
12496                 printf("long\n");
12497         exit(0);
12498 }
12499 EOM
12500 echo " "
12501 set ssize
12502 if eval $compile_ok && ./ssize > /dev/null; then
12503         ssizetype=`./ssize`
12504         echo "I'll be using $ssizetype for functions returning a byte count." >&4
12505 else
12506         $cat >&4 <<EOM
12507 Help! I can't compile and run the ssize_t test program: please enlighten me!
12508 (This is probably a misconfiguration in your system or libraries, and
12509 you really ought to fix it.  Still, I'll try anyway.)
12510
12511 I need a type that is the same size as $sizetype, but is guaranteed to
12512 be signed.  Common values are ssize_t, int and long.
12513
12514 EOM
12515         rp="What signed type is the same size as $sizetype?"
12516         . ./myread
12517         ssizetype="$ans"
12518 fi
12519 $rm -f ssize ssize.*
12520
12521 : see what type of char stdio uses.
12522 echo " "
12523 if $contains 'unsigned.*char.*_ptr;' `./findhdr stdio.h` >/dev/null 2>&1 ; then
12524         echo "Your stdio uses unsigned chars." >&4
12525         stdchar="unsigned char"
12526 else
12527         echo "Your stdio uses signed chars." >&4
12528         stdchar="char"
12529 fi
12530
12531 : see if time exists
12532 echo " "
12533 if test "X$d_time" = X -o X"$timetype" = X; then
12534     if set time val -f d_time; eval $csym; $val; then
12535                 echo 'time() found.' >&4
12536                 val="$define"
12537                 rp="What is the type returned by time() on this system?"
12538                 set time_t timetype long stdio.h sys/types.h
12539                 eval $typedef_ask
12540     else
12541                 echo 'time() not found, hope that will do.' >&4
12542                 val="$undef"
12543                 timetype='int';
12544     fi
12545     set d_time
12546     eval $setvar
12547 fi
12548
12549 : see what type uids are declared as in the kernel
12550 echo " "
12551 echo "Looking for the type for user ids returned by getuid()."
12552 set uid_t uidtype xxx stdio.h sys/types.h
12553 eval $typedef
12554 case "$uidtype" in
12555 xxx)
12556         xxx=`./findhdr sys/user.h`
12557         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
12558         case $1 in
12559         unsigned) dflt="$1 $2" ;;
12560         *) dflt="$1" ;;
12561         esac
12562         ;;
12563 *) dflt="$uidtype";;
12564 esac
12565 case "$uidtype" in
12566 uid_t)  echo "uid_t found." ;;
12567 *)      rp="What is the type for user ids returned by getuid()?"
12568         . ./myread
12569         uidtype="$ans"
12570         ;;
12571 esac
12572
12573 echo " "
12574 case "$uidtype" in
12575 *_t) zzz="$uidtype"     ;;
12576 *)   zzz="uid"          ;;
12577 esac
12578 echo "Checking the sign of $zzz..." >&4
12579 cat > try.c <<EOCP
12580 #include <sys/types.h>
12581 #include <stdio.h>
12582 int main() {
12583         $uidtype foo = -1;
12584         if (foo < 0)
12585                 printf("-1\n");
12586         else
12587                 printf("1\n");
12588 }
12589 EOCP
12590 set try
12591 if eval $compile; then
12592         yyy=`./try`
12593         case "$yyy" in
12594         '')     uidsign=1
12595                 echo "(I can't execute the test program--guessing unsigned.)" >&4
12596                 ;;
12597         *)      uidsign=$yyy
12598                 case "$uidsign" in
12599                  1) echo "Your $zzz is unsigned." ;;
12600                 -1) echo "Your $zzz is signed."   ;;
12601                 esac
12602                 ;;
12603         esac
12604 else
12605         uidsign=1
12606         echo "(I can't compile the test program--guessing unsigned.)" >&4
12607 fi
12608
12609
12610 : see if dbm.h is available
12611 : see if dbmclose exists
12612 set dbmclose d_dbmclose
12613 eval $inlibc
12614
12615 case "$d_dbmclose" in
12616 $define)
12617         set dbm.h i_dbm
12618         eval $inhdr
12619         case "$i_dbm" in
12620         $define)
12621                 val="$undef"
12622                 set i_rpcsvcdbm
12623                 eval $setvar
12624                 ;;
12625         *)      set rpcsvc/dbm.h i_rpcsvcdbm
12626                 eval $inhdr
12627                 ;;
12628         esac
12629         ;;
12630 *)      echo "We won't be including <dbm.h>"
12631         val="$undef"
12632         set i_dbm
12633         eval $setvar
12634         val="$undef"
12635         set i_rpcsvcdbm
12636         eval $setvar
12637         ;;
12638 esac
12639
12640 : see if this is a sys/file.h system
12641 val=''
12642 set sys/file.h val
12643 eval $inhdr
12644
12645 : do we need to include sys/file.h ?
12646 case "$val" in
12647 "$define")
12648         echo " "
12649         if $h_sysfile; then
12650                 val="$define"
12651                 echo "We'll be including <sys/file.h>." >&4
12652         else
12653                 val="$undef"
12654                 echo "We won't be including <sys/file.h>." >&4
12655         fi
12656         ;;
12657 *)
12658         h_sysfile=false
12659         ;;
12660 esac
12661 set i_sysfile
12662 eval $setvar
12663
12664 : see if fcntl.h is there
12665 val=''
12666 set fcntl.h val
12667 eval $inhdr
12668
12669 : see if we can include fcntl.h
12670 case "$val" in
12671 "$define")
12672         echo " "
12673         if $h_fcntl; then
12674                 val="$define"
12675                 echo "We'll be including <fcntl.h>." >&4
12676         else
12677                 val="$undef"
12678                 if $h_sysfile; then
12679         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
12680                 else
12681                         echo "We won't be including <fcntl.h>." >&4
12682                 fi
12683         fi
12684         ;;
12685 *)
12686         h_fcntl=false
12687         val="$undef"
12688         ;;
12689 esac
12690 set i_fcntl
12691 eval $setvar
12692
12693 : see if locale.h is available
12694 set locale.h i_locale
12695 eval $inhdr
12696
12697 : see if mach cthreads are available
12698 if test "X$usethreads" = "X$define"; then
12699         set mach/cthreads.h i_machcthr
12700         eval $inhdr
12701 else
12702         i_machcthr="$undef"
12703 fi
12704
12705
12706
12707 : see if this is a math.h system
12708 set math.h i_math
12709 eval $inhdr
12710
12711 : see if this is a mntent.h system
12712 set mntent.h i_mntent
12713 eval $inhdr
12714
12715 : see if ndbm.h is available
12716 set ndbm.h t_ndbm
12717 eval $inhdr
12718 case "$t_ndbm" in
12719 $define)
12720         : see if dbm_open exists
12721         set dbm_open d_dbm_open
12722         eval $inlibc
12723         case "$d_dbm_open" in
12724         $undef)
12725                 t_ndbm="$undef"
12726                 echo "We won't be including <ndbm.h>"
12727                 ;;
12728         esac
12729         ;;
12730 esac
12731 val="$t_ndbm"
12732 set i_ndbm
12733 eval $setvar
12734
12735 : see if net/errno.h is available
12736 val=''
12737 set net/errno.h val
12738 eval $inhdr
12739
12740 : Unfortunately, it causes problems on some systems.  Arrgh.
12741 case "$val" in
12742 $define)
12743         cat > try.c <<'EOM'
12744 #include <stdio.h>
12745 #include <errno.h>
12746 #include <net/errno.h>
12747 int func()
12748 {
12749         return ENOTSOCK;
12750 }
12751 EOM
12752         if $cc $ccflags -c try.c >/dev/null 2>&1; then
12753                 echo "We'll be including <net/errno.h>." >&4
12754         else
12755                 echo "We won't be including <net/errno.h>." >&4
12756                 val="$undef"
12757         fi
12758         $rm -f try.* try
12759         ;;
12760 esac
12761 set i_neterrno
12762 eval $setvar
12763
12764 : see if netinet/tcp.h is available
12765 set netinet/tcp.h i_netinettcp
12766 eval $inhdr
12767
12768 : see if this is a poll.h system
12769 set poll.h i_poll
12770 eval $inhdr
12771
12772 : get C preprocessor symbols handy
12773 echo " "
12774 $echo $n "Hmm... $c"
12775 echo $al | $tr ' ' $trnl >Cppsym.know
12776 $cat <<EOSS >Cppsym
12777 $startsh
12778 case "\$1" in
12779 -l) list=true
12780         shift
12781         ;;
12782 esac
12783 unknown=''
12784 case "\$list\$#" in
12785 1|2)
12786         for sym do
12787                 if $contains "^\$1$" Cppsym.true >/dev/null 2>&1; then
12788                         exit 0
12789                 elif $contains "^\$1$" Cppsym.know >/dev/null 2>&1; then
12790                         :
12791                 else
12792                         unknown="\$unknown \$sym"
12793                 fi
12794         done
12795         set X \$unknown
12796         shift
12797         ;;
12798 esac
12799 case \$# in
12800 0) exit 1;;
12801 esac
12802 echo \$* | $tr ' ' '$trnl' | $sed -e 's/\(.*\)/\\
12803 #ifdef \1\\
12804 exit 0; _ _ _ _\1\\      \1\\
12805 #endif\\
12806 /' >Cppsym\$\$
12807 echo "exit 1; _ _ _" >>Cppsym\$\$
12808 $cppstdin $cppminus <Cppsym\$\$ | $grep '^exit [01]; _ _'  >Cppsym2\$\$
12809 case "\$list" in
12810 true) $awk 'NF > 5 {print substr(\$6,2,100)}' <Cppsym2\$\$ ;;
12811 *)
12812         sh Cppsym2\$\$
12813         status=\$?
12814         ;;
12815 esac
12816 $rm -f Cppsym\$\$ Cppsym2\$\$
12817 exit \$status
12818 EOSS
12819 chmod +x Cppsym
12820 $eunicefix Cppsym
12821 ./Cppsym -l $al | $sort | $grep -v '^$' >Cppsym.true
12822
12823 : now check the C compiler for additional symbols
12824 postprocess_cc_v=''
12825 case "$osname" in
12826 aix) postprocess_cc_v="|$tr , ' '" ;;
12827 esac
12828 $cat >ccsym <<EOS
12829 $startsh
12830 $cat >tmp.c <<EOF
12831 extern int foo;
12832 EOF
12833 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
12834 do
12835         case "\$i" in
12836         -D*) echo "\$i" | $sed 's/^-D//';;
12837         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A\(.*\)(\(.*\))/\1=\2/';;
12838         esac
12839 done
12840 $rm -f try.c
12841 EOS
12842 postprocess_cc_v=''
12843 chmod +x ccsym
12844 $eunicefix ccsym
12845 ./ccsym > ccsym1.raw
12846 if $test -s ccsym1.raw; then
12847        $sort ccsym1.raw | $uniq >ccsym.raw
12848 else
12849        mv ccsym1.raw ccsym.raw
12850 fi
12851
12852 $awk '/\=/ { print $0; next }
12853         { print $0"=1" }' ccsym.raw >ccsym.list
12854 $awk '{ print $0"=1" }' Cppsym.true >ccsym.true
12855 $comm -13 ccsym.true ccsym.list >ccsym.own
12856 $comm -12 ccsym.true ccsym.list >ccsym.com
12857 $comm -23 ccsym.true ccsym.list >ccsym.cpp
12858 also=''
12859 if $test -z ccsym.raw; then
12860         echo "Your C compiler doesn't seem to define any symbols!" >&4
12861         echo " "
12862         echo "However, your C preprocessor defines the following symbols:"
12863         $cat Cppsym.true
12864         ccsymbols=''
12865         cppsymbols=`$cat Cppsym.true`
12866         cppsymbols=`echo $cppsymbols`
12867         cppccsymbols="$cppsymbols"
12868 else
12869         if $test -s ccsym.com; then
12870                 echo "Your C compiler and pre-processor define these symbols:"
12871                 $sed -e 's/\(.*\)=.*/\1/' ccsym.com
12872                 also='also '
12873                 symbols='ones'
12874                 cppccsymbols=`$cat ccsym.com`
12875                 cppccsymbols=`echo $cppccsymbols`
12876                 $test "$silent" || sleep 1
12877         fi
12878         if $test -s ccsym.cpp; then
12879                 $test "$also" && echo " "
12880                 echo "Your C pre-processor ${also}defines the following symbols:"
12881                 $sed -e 's/\(.*\)=.*/\1/' ccsym.cpp
12882                 also='further '
12883                 cppsymbols=`$cat ccsym.cpp`
12884                 cppsymbols=`echo $cppsymbols`
12885                 $test "$silent" || sleep 1
12886         fi
12887         if $test -s ccsym.own; then
12888                 $test "$also" && echo " "
12889                 echo "Your C compiler ${also}defines the following cpp symbols:"
12890                 $sed -e 's/\(.*\)=1/\1/' ccsym.own
12891                 $sed -e 's/\(.*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
12892                 ccsymbols=`$cat ccsym.own`
12893                 ccsymbols=`echo $ccsymbols`
12894                 $test "$silent" || sleep 1
12895         fi
12896 fi
12897 $rm -f ccsym*
12898
12899 : see if this is a termio system
12900 val="$undef"
12901 val2="$undef"
12902 val3="$undef"
12903 if $test `./findhdr termios.h`; then
12904         set tcsetattr i_termios
12905         eval $inlibc
12906         val3="$i_termios"
12907 fi
12908 echo " "
12909 case "$val3" in
12910 "$define") echo "You have POSIX termios.h... good!" >&4;;
12911 *) if ./Cppsym pyr; then
12912                 case "`/bin/universe`" in
12913                 ucb) if $test `./findhdr sgtty.h`; then
12914                                 val2="$define"
12915                                 echo "<sgtty.h> found." >&4
12916                         else
12917                                 echo "System is pyramid with BSD universe."
12918                                 echo "<sgtty.h> not found--you could have problems." >&4
12919                         fi;;
12920                 *) if $test `./findhdr termio.h`; then
12921                                 val="$define"
12922                                 echo "<termio.h> found." >&4
12923                         else
12924                                 echo "System is pyramid with USG universe."
12925                                 echo "<termio.h> not found--you could have problems." >&4
12926                         fi;;
12927                 esac
12928         elif ./usg; then
12929                 if $test `./findhdr termio.h`; then
12930                         echo "<termio.h> found." >&4
12931                         val="$define"
12932                 elif $test `./findhdr sgtty.h`; then
12933                         echo "<sgtty.h> found." >&4
12934                         val2="$define"
12935                 else
12936 echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
12937                 fi
12938         else
12939                 if $test `./findhdr sgtty.h`; then
12940                         echo "<sgtty.h> found." >&4
12941                         val2="$define"
12942                 elif $test `./findhdr termio.h`; then
12943                         echo "<termio.h> found." >&4
12944                         val="$define"
12945                 else
12946 echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
12947                 fi
12948         fi;;
12949 esac
12950 set i_termio; eval $setvar
12951 val=$val2; set i_sgtty; eval $setvar
12952 val=$val3; set i_termios; eval $setvar
12953
12954 : see if this is a shadow.h system
12955 set shadow.h i_shadow
12956 eval $inhdr
12957
12958 : see if this is a socks.h system
12959 set socks.h i_socks
12960 eval $inhdr
12961
12962 : see if stdarg is available
12963 echo " "
12964 if $test `./findhdr stdarg.h`; then
12965         echo "<stdarg.h> found." >&4
12966         valstd="$define"
12967 else
12968         echo "<stdarg.h> NOT found." >&4
12969         valstd="$undef"
12970 fi
12971
12972 : see if varags is available
12973 echo " "
12974 if $test `./findhdr varargs.h`; then
12975         echo "<varargs.h> found." >&4
12976 else
12977         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
12978 fi
12979
12980 : set up the varargs testing programs
12981 $cat > varargs.c <<EOP
12982 #ifdef I_STDARG
12983 #include <stdarg.h>
12984 #endif
12985 #ifdef I_VARARGS
12986 #include <varargs.h>
12987 #endif
12988
12989 #ifdef I_STDARG
12990 int f(char *p, ...)
12991 #else
12992 int f(va_alist)
12993 va_dcl
12994 #endif
12995 {
12996         va_list ap;
12997 #ifndef I_STDARG
12998         char *p;
12999 #endif
13000 #ifdef I_STDARG
13001         va_start(ap,p);
13002 #else
13003         va_start(ap);
13004         p = va_arg(ap, char *);
13005 #endif
13006         va_end(ap);
13007 }
13008 EOP
13009 $cat > varargs <<EOP
13010 $startsh
13011 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
13012         echo "true"
13013 else
13014         echo "false"
13015 fi
13016 $rm -f varargs$_o
13017 EOP
13018 chmod +x varargs
13019
13020 : now check which varargs header should be included
13021 echo " "
13022 i_varhdr=''
13023 case "$valstd" in
13024 "$define")
13025         if `./varargs I_STDARG`; then
13026                 val='stdarg.h'
13027         elif `./varargs I_VARARGS`; then
13028                 val='varargs.h'
13029         fi
13030         ;;
13031 *)
13032         if `./varargs I_VARARGS`; then
13033                 val='varargs.h'
13034         fi
13035         ;;
13036 esac
13037 case "$val" in
13038 '')
13039 echo "I could not find the definition for va_dcl... You have problems..." >&4
13040         val="$undef"; set i_stdarg; eval $setvar
13041         val="$undef"; set i_varargs; eval $setvar
13042         ;;
13043 *) 
13044         set i_varhdr
13045         eval $setvar
13046         case "$i_varhdr" in
13047         stdarg.h)
13048                 val="$define"; set i_stdarg; eval $setvar
13049                 val="$undef"; set i_varargs; eval $setvar
13050                 ;;
13051         varargs.h)
13052                 val="$undef"; set i_stdarg; eval $setvar
13053                 val="$define"; set i_varargs; eval $setvar
13054                 ;;
13055         esac
13056         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
13057 esac
13058 $rm -f varargs*
13059
13060 : see if stddef is available
13061 set stddef.h i_stddef
13062 eval $inhdr
13063
13064 : see if sys/access.h is available
13065 set sys/access.h i_sysaccess
13066 eval $inhdr
13067
13068 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
13069 set sys/filio.h i_sysfilio
13070 eval $inhdr
13071 echo " "
13072 if $test `./findhdr sys/ioctl.h`; then
13073         val="$define"
13074         echo '<sys/ioctl.h> found.' >&4
13075 else
13076         val="$undef"
13077         if $test $i_sysfilio = "$define"; then
13078             echo '<sys/ioctl.h> NOT found.' >&4
13079         else
13080                 $test $i_sgtty = "$define" && xxx="sgtty.h"
13081                 $test $i_termio = "$define" && xxx="termio.h"
13082                 $test $i_termios = "$define" && xxx="termios.h"
13083 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
13084         fi
13085 fi
13086 set i_sysioctl
13087 eval $setvar
13088
13089 : see if sys/resource.h has to be included
13090 set sys/resource.h i_sysresrc
13091 eval $inhdr
13092
13093 : see if sys/security.h is available
13094 set sys/security.h i_syssecrt
13095 eval $inhdr
13096
13097 : see if this is a sys/statvfs.h system
13098 set sys/statvfs.h i_sysstatvfs
13099 eval $inhdr
13100
13101 : see if this is a sys/un.h system
13102 set sys/un.h i_sysun
13103 eval $inhdr
13104
13105 : see if this is a syswait system
13106 set sys/wait.h i_syswait
13107 eval $inhdr
13108
13109 : see if this is an utime system
13110 set utime.h i_utime
13111 eval $inhdr
13112
13113 : see if this is a values.h system
13114 set values.h i_values
13115 eval $inhdr
13116
13117 : see if this is a vfork system
13118 case "$d_vfork" in
13119 "$define")
13120         set vfork.h i_vfork
13121         eval $inhdr
13122         ;;
13123 *)
13124         i_vfork="$undef"
13125         ;;
13126 esac
13127
13128 : see if gdbm.h is available
13129 set gdbm.h t_gdbm
13130 eval $inhdr
13131 case "$t_gdbm" in
13132 $define)
13133         : see if gdbm_open exists
13134         set gdbm_open d_gdbm_open
13135         eval $inlibc
13136         case "$d_gdbm_open" in
13137         $undef)
13138                 t_gdbm="$undef"
13139                 echo "We won't be including <gdbm.h>"
13140                 ;;
13141         esac
13142         ;;
13143 esac
13144 val="$t_gdbm"
13145 set i_gdbm
13146 eval $setvar
13147
13148 echo " "
13149 echo "Looking for extensions..." >&4
13150 : If we are using the old config.sh, known_extensions may contain
13151 : old or inaccurate or duplicate values.
13152 known_extensions=''
13153 nonxs_extensions=''
13154 : We do not use find because it might not be available.
13155 : We do not just use MANIFEST because the user may have dropped
13156 : some additional extensions into the source tree and expect them
13157 : to be built.
13158
13159 : Function to recursively find available extensions, ignoring DynaLoader
13160 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
13161 find_extensions='
13162     for xxx in *; do
13163        case "$xxx" in
13164            DynaLoader|dynaload) ;;
13165            *)
13166            if $test -f $xxx/$xxx.xs; then
13167                known_extensions="$known_extensions $1$xxx";
13168            elif $test -f $xxx/Makefile.PL; then
13169                nonxs_extensions="$nonxs_extensions $1$xxx";
13170            else
13171                if $test -d $xxx -a $# -lt 10; then
13172                    set $1$xxx/ $*;
13173                    cd $xxx;
13174                    eval $find_extensions;
13175                    cd ..;
13176                    shift;
13177                fi;
13178            fi
13179            ;;
13180        esac;
13181     done'
13182 tdir=`pwd`
13183 cd $rsrc/ext
13184 set X
13185 shift
13186 eval $find_extensions
13187 set X $nonxs_extensions
13188 shift
13189 nonxs_extensions="$*"
13190 set X $known_extensions
13191 shift
13192 known_extensions="$*"
13193 cd $tdir
13194
13195 : Now see which are supported on this system.
13196 avail_ext=''
13197 for xxx in $known_extensions ; do
13198         case "$xxx" in
13199         DB_File|db_file)
13200                 case "$i_db" in
13201                 $define) avail_ext="$avail_ext $xxx" ;;
13202                 esac
13203                 ;;
13204         GDBM_File|gdbm_fil)
13205                 case "$i_gdbm" in 
13206                 $define) avail_ext="$avail_ext $xxx" ;;
13207                 esac
13208                 ;;
13209         NDBM_File|ndbm_fil)
13210                 case "$i_ndbm" in
13211                 $define) avail_ext="$avail_ext $xxx" ;;
13212                 esac
13213                 ;;
13214         ODBM_File|odbm_fil) 
13215                 case "${i_dbm}${i_rpcsvcdbm}" in
13216                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
13217                 esac
13218                 ;;
13219         POSIX|posix)
13220                 case "$useposix" in
13221                 true|define|y) avail_ext="$avail_ext $xxx" ;;
13222                 esac
13223                 ;;
13224         Opcode|opcode)
13225                 case "$useopcode" in
13226                 true|define|y) avail_ext="$avail_ext $xxx" ;;
13227                 esac
13228                 ;;
13229         Socket|socket)
13230                 case "$d_socket" in 
13231                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
13232                 esac
13233                 ;;
13234         Thread|thread)
13235                 case "$usethreads" in 
13236                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
13237                 esac
13238                 ;;
13239         IPC/SysV|ipc/sysv)
13240                 : XXX Do we need a useipcsysv variable here
13241                 case "${d_msg}${d_sem}${d_shm}" in 
13242                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
13243                 esac
13244                 ;;
13245         *)      avail_ext="$avail_ext $xxx"
13246                 ;;
13247         esac
13248 done
13249
13250 set X $avail_ext
13251 shift
13252 avail_ext="$*"
13253
13254 : Now see which nonxs extensions are supported on this system.
13255 : For now assume all are.
13256 nonxs_ext=''
13257 for xxx in $nonxs_extensions ; do
13258         case "$xxx" in
13259         *)      nonxs_ext="$nonxs_ext $xxx"
13260                 ;;
13261         esac
13262 done
13263
13264 set X $nonxs_ext
13265 shift
13266 nonxs_ext="$*"
13267
13268 case $usedl in
13269 $define)
13270         $cat <<EOM
13271 A number of extensions are supplied with $package.  You may choose to
13272 compile these extensions for dynamic loading (the default), compile
13273 them into the $package executable (static loading), or not include
13274 them at all.  Answer "none" to include no extensions.
13275 Note that DynaLoader is always built and need not be mentioned here.
13276
13277 EOM
13278         case "$dynamic_ext" in
13279         '') dflt="$avail_ext" ;;
13280         *)      dflt="$dynamic_ext"
13281                 # Perhaps we are reusing an old out-of-date config.sh.
13282                 case "$hint" in
13283                 previous)
13284                         if test X"$dynamic_ext" != X"$avail_ext"; then
13285                                 $cat <<EOM
13286 NOTICE:  Your previous config.sh list may be incorrect. 
13287 The extensions now available to you are 
13288         ${avail_ext}
13289 but the default list from your previous config.sh is
13290         ${dynamic_ext} 
13291
13292 EOM
13293                         fi
13294                         ;;
13295                 esac
13296                 ;;
13297         esac
13298         case "$dflt" in
13299         '')     dflt=none;;
13300         esac
13301         rp="What extensions do you wish to load dynamically?"
13302         . ./myread
13303         case "$ans" in
13304         none) dynamic_ext=' ' ;;
13305         *) dynamic_ext="$ans" ;;
13306         esac
13307
13308         case "$static_ext" in
13309         '')
13310                 : Exclude those already listed in dynamic linking
13311                 dflt=''
13312                 for xxx in $avail_ext; do
13313                         case " $dynamic_ext " in
13314                         *" $xxx "*) ;;
13315                         *) dflt="$dflt $xxx" ;;
13316                         esac
13317                 done
13318                 set X $dflt
13319                 shift
13320                 dflt="$*"
13321                 ;;
13322         *)  dflt="$static_ext" 
13323                 ;;
13324         esac
13325
13326         case "$dflt" in
13327         '')     dflt=none;;
13328         esac
13329         rp="What extensions do you wish to load statically?"
13330         . ./myread
13331         case "$ans" in
13332         none) static_ext=' ' ;;
13333         *) static_ext="$ans" ;;
13334         esac
13335         ;;
13336 *)
13337         $cat <<EOM
13338 A number of extensions are supplied with $package.  Answer "none" 
13339 to include no extensions. 
13340 Note that DynaLoader is always built and need not be mentioned here.
13341
13342 EOM
13343         case "$static_ext" in
13344         '') dflt="$avail_ext" ;;
13345         *)      dflt="$static_ext"
13346                 # Perhaps we are reusing an old out-of-date config.sh.
13347                 case "$hint" in
13348                 previous)
13349                         if test X"$static_ext" != X"$avail_ext"; then
13350                                 $cat <<EOM
13351 NOTICE:  Your previous config.sh list may be incorrect. 
13352 The extensions now available to you are 
13353         ${avail_ext}
13354 but the default list from your previous config.sh is
13355         ${static_ext} 
13356
13357 EOM
13358                         fi
13359                         ;;
13360                 esac
13361                 ;;
13362         esac
13363         : Exclude those that are not xs extensions
13364         case "$dflt" in
13365         '')     dflt=none;;
13366         esac
13367         rp="What extensions do you wish to include?"
13368         . ./myread
13369         case "$ans" in
13370         none) static_ext=' ' ;;
13371         *) static_ext="$ans" ;;
13372         esac
13373         ;;
13374 esac
13375
13376 set X $dynamic_ext $static_ext $nonxs_ext
13377 shift
13378 extensions="$*"
13379
13380 : Remove build directory name from cppstdin so it can be used from
13381 : either the present location or the final installed location.
13382 echo " "
13383 : Get out of the UU directory to get correct path name.
13384 cd ..
13385 case "$cppstdin" in
13386 `pwd`/cppstdin)
13387         echo "Stripping down cppstdin path name"
13388         cppstdin=cppstdin
13389         ;;
13390 esac
13391 cd UU
13392
13393 : end of configuration questions
13394 echo " "
13395 echo "End of configuration questions."
13396 echo " "
13397
13398 : back to where it started
13399 if test -d ../UU; then
13400         cd ..
13401 fi
13402
13403 : configuration may be patched via a 'config.over' file
13404 if $test -f config.over; then
13405         echo " "
13406         dflt=y
13407         rp='I see a config.over file.  Do you wish to load it?'
13408         . UU/myread
13409         case "$ans" in
13410         n*) echo "OK, I'll ignore it.";;
13411         *)      . ./config.over
13412                 echo "Configuration override changes have been loaded."
13413                 ;;
13414         esac
13415 fi
13416
13417 : in case they want portability, strip down executable paths
13418 case "$d_portable" in
13419 "$define")
13420         echo " "
13421         echo "Stripping down executable paths..." >&4
13422         for file in $loclist $trylist; do
13423                 eval temp=\$$file
13424                 eval $file=`basename $temp`
13425         done
13426         ;;
13427 esac
13428
13429 : create config.sh file
13430 echo " "
13431 echo "Creating config.sh..." >&4
13432 $spitshell <<EOT >config.sh
13433 $startsh
13434 #
13435 # This file was produced by running the Configure script. It holds all the
13436 # definitions figured out by Configure. Should you modify one of these values,
13437 # do not forget to propagate your changes by running "Configure -der". You may
13438 # instead choose to run each of the .SH files by yourself, or "Configure -S".
13439 #
13440
13441 # Package name      : $package
13442 # Source directory  : $src
13443 # Configuration time: $cf_time
13444 # Configured by     : $cf_by
13445 # Target system     : $myuname
13446
13447 Author='$Author'
13448 Date='$Date'
13449 Header='$Header'
13450 Id='$Id'
13451 Locker='$Locker'
13452 Log='$Log'
13453 Mcc='$Mcc'
13454 RCSfile='$RCSfile'
13455 Revision='$Revision'
13456 Source='$Source'
13457 State='$State'
13458 _a='$_a'
13459 _exe='$_exe'
13460 _o='$_o'
13461 afs='$afs'
13462 alignbytes='$alignbytes'
13463 ansi2knr='$ansi2knr'
13464 aphostname='$aphostname'
13465 apiversion='$apiversion'
13466 ar='$ar'
13467 archlib='$archlib'
13468 archlibexp='$archlibexp'
13469 archname64='$archname64'
13470 archname='$archname'
13471 archobjs='$archobjs'
13472 awk='$awk'
13473 baserev='$baserev'
13474 bash='$bash'
13475 bin='$bin'
13476 bincompat5005='$bincompat5005'
13477 binexp='$binexp'
13478 bison='$bison'
13479 byacc='$byacc'
13480 byteorder='$byteorder'
13481 c='$c'
13482 castflags='$castflags'
13483 cat='$cat'
13484 cc='$cc'
13485 cccdlflags='$cccdlflags'
13486 ccdlflags='$ccdlflags'
13487 ccflags='$ccflags'
13488 ccsymbols='$ccsymbols'
13489 cf_by='$cf_by'
13490 cf_email='$cf_email'
13491 cf_time='$cf_time'
13492 chgrp='$chgrp'
13493 chmod='$chmod'
13494 chown='$chown'
13495 clocktype='$clocktype'
13496 comm='$comm'
13497 compress='$compress'
13498 contains='$contains'
13499 cp='$cp'
13500 cpio='$cpio'
13501 cpp='$cpp'
13502 cpp_stuff='$cpp_stuff'
13503 cppccsymbols='$cppccsymbols'
13504 cppflags='$cppflags'
13505 cpplast='$cpplast'
13506 cppminus='$cppminus'
13507 cpprun='$cpprun'
13508 cppstdin='$cppstdin'
13509 cppsymbols='$cppsymbols'
13510 crosscompile='$crosscompile'
13511 cryptlib='$cryptlib'
13512 csh='$csh'
13513 d_Gconvert='$d_Gconvert'
13514 d_PRIEldbl='$d_PRIEldbl'
13515 d_PRIFldbl='$d_PRIFldbl'
13516 d_PRIGldbl='$d_PRIGldbl'
13517 d_PRIX64='$d_PRIX64'
13518 d_PRId64='$d_PRId64'
13519 d_PRIeldbl='$d_PRIeldbl'
13520 d_PRIfldbl='$d_PRIfldbl'
13521 d_PRIgldbl='$d_PRIgldbl'
13522 d_PRIi64='$d_PRIi64'
13523 d_PRIo64='$d_PRIo64'
13524 d_PRIu64='$d_PRIu64'
13525 d_PRIx64='$d_PRIx64'
13526 d_access='$d_access'
13527 d_accessx='$d_accessx'
13528 d_alarm='$d_alarm'
13529 d_archlib='$d_archlib'
13530 d_atolf='$d_atolf'
13531 d_atoll='$d_atoll'
13532 d_attribut='$d_attribut'
13533 d_bcmp='$d_bcmp'
13534 d_bcopy='$d_bcopy'
13535 d_bincompat5005='$d_bincompat5005'
13536 d_bsd='$d_bsd'
13537 d_bsdgetpgrp='$d_bsdgetpgrp'
13538 d_bsdsetpgrp='$d_bsdsetpgrp'
13539 d_bzero='$d_bzero'
13540 d_casti32='$d_casti32'
13541 d_castneg='$d_castneg'
13542 d_charvspr='$d_charvspr'
13543 d_chown='$d_chown'
13544 d_chroot='$d_chroot'
13545 d_chsize='$d_chsize'
13546 d_closedir='$d_closedir'
13547 d_cmsghdr_s='$d_cmsghdr_s'
13548 d_const='$d_const'
13549 d_crypt='$d_crypt'
13550 d_csh='$d_csh'
13551 d_cuserid='$d_cuserid'
13552 d_dbl_dig='$d_dbl_dig'
13553 d_difftime='$d_difftime'
13554 d_dirnamlen='$d_dirnamlen'
13555 d_dlerror='$d_dlerror'
13556 d_dlopen='$d_dlopen'
13557 d_dlsymun='$d_dlsymun'
13558 d_dosuid='$d_dosuid'
13559 d_drand48proto='$d_drand48proto'
13560 d_dup2='$d_dup2'
13561 d_eaccess='$d_eaccess'
13562 d_endgrent='$d_endgrent'
13563 d_endhent='$d_endhent'
13564 d_endnent='$d_endnent'
13565 d_endpent='$d_endpent'
13566 d_endpwent='$d_endpwent'
13567 d_endsent='$d_endsent'
13568 d_endspent='$d_endspent'
13569 d_eofnblk='$d_eofnblk'
13570 d_eunice='$d_eunice'
13571 d_fchmod='$d_fchmod'
13572 d_fchown='$d_fchown'
13573 d_fcntl='$d_fcntl'
13574 d_fd_macros='$d_fd_macros'
13575 d_fd_set='$d_fd_set'
13576 d_fds_bits='$d_fds_bits'
13577 d_fgetpos='$d_fgetpos'
13578 d_flexfnam='$d_flexfnam'
13579 d_flock='$d_flock'
13580 d_fork='$d_fork'
13581 d_fpathconf='$d_fpathconf'
13582 d_fpos64_t='$d_fpos64_t'
13583 d_fseeko='$d_fseeko'
13584 d_fsetpos='$d_fsetpos'
13585 d_fstatfs='$d_fstatfs'
13586 d_fstatvfs='$d_fstatvfs'
13587 d_ftello='$d_ftello'
13588 d_ftime='$d_ftime'
13589 d_getgrent='$d_getgrent'
13590 d_getgrps='$d_getgrps'
13591 d_gethbyaddr='$d_gethbyaddr'
13592 d_gethbyname='$d_gethbyname'
13593 d_gethent='$d_gethent'
13594 d_gethname='$d_gethname'
13595 d_gethostprotos='$d_gethostprotos'
13596 d_getlogin='$d_getlogin'
13597 d_getmntent='$d_getmntent'
13598 d_getnbyaddr='$d_getnbyaddr'
13599 d_getnbyname='$d_getnbyname'
13600 d_getnent='$d_getnent'
13601 d_getnetprotos='$d_getnetprotos'
13602 d_getpbyname='$d_getpbyname'
13603 d_getpbynumber='$d_getpbynumber'
13604 d_getpent='$d_getpent'
13605 d_getpgid='$d_getpgid'
13606 d_getpgrp2='$d_getpgrp2'
13607 d_getpgrp='$d_getpgrp'
13608 d_getppid='$d_getppid'
13609 d_getprior='$d_getprior'
13610 d_getprotoprotos='$d_getprotoprotos'
13611 d_getpwent='$d_getpwent'
13612 d_getsbyname='$d_getsbyname'
13613 d_getsbyport='$d_getsbyport'
13614 d_getsent='$d_getsent'
13615 d_getservprotos='$d_getservprotos'
13616 d_getspent='$d_getspent'
13617 d_getspnam='$d_getspnam'
13618 d_gettimeod='$d_gettimeod'
13619 d_gnulibc='$d_gnulibc'
13620 d_grpasswd='$d_grpasswd'
13621 d_hasmntopt='$d_hasmntopt'
13622 d_htonl='$d_htonl'
13623 d_index='$d_index'
13624 d_inetaton='$d_inetaton'
13625 d_int64t='$d_int64t'
13626 d_iovec_s='$d_iovec_s'
13627 d_isascii='$d_isascii'
13628 d_killpg='$d_killpg'
13629 d_lchown='$d_lchown'
13630 d_ldbl_dig='$d_ldbl_dig'
13631 d_link='$d_link'
13632 d_llseek='$d_llseek'
13633 d_locconv='$d_locconv'
13634 d_lockf='$d_lockf'
13635 d_longdbl='$d_longdbl'
13636 d_longlong='$d_longlong'
13637 d_lstat='$d_lstat'
13638 d_madvise='$d_madvise'
13639 d_mblen='$d_mblen'
13640 d_mbstowcs='$d_mbstowcs'
13641 d_mbtowc='$d_mbtowc'
13642 d_memchr='$d_memchr'
13643 d_memcmp='$d_memcmp'
13644 d_memcpy='$d_memcpy'
13645 d_memmove='$d_memmove'
13646 d_memset='$d_memset'
13647 d_mkdir='$d_mkdir'
13648 d_mkfifo='$d_mkfifo'
13649 d_mktime='$d_mktime'
13650 d_mmap='$d_mmap'
13651 d_mprotect='$d_mprotect'
13652 d_msg='$d_msg'
13653 d_msg_ctrunc='$d_msg_ctrunc'
13654 d_msg_dontroute='$d_msg_dontroute'
13655 d_msg_oob='$d_msg_oob'
13656 d_msg_peek='$d_msg_peek'
13657 d_msg_proxy='$d_msg_proxy'
13658 d_msgctl='$d_msgctl'
13659 d_msgget='$d_msgget'
13660 d_msghdr_s='$d_msghdr_s'
13661 d_msgrcv='$d_msgrcv'
13662 d_msgsnd='$d_msgsnd'
13663 d_msync='$d_msync'
13664 d_munmap='$d_munmap'
13665 d_mymalloc='$d_mymalloc'
13666 d_nice='$d_nice'
13667 d_off64_t='$d_off64_t'
13668 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
13669 d_oldpthreads='$d_oldpthreads'
13670 d_oldsock='$d_oldsock'
13671 d_open3='$d_open3'
13672 d_pathconf='$d_pathconf'
13673 d_pause='$d_pause'
13674 d_phostname='$d_phostname'
13675 d_pipe='$d_pipe'
13676 d_poll='$d_poll'
13677 d_portable='$d_portable'
13678 d_pthread_yield='$d_pthread_yield'
13679 d_pwage='$d_pwage'
13680 d_pwchange='$d_pwchange'
13681 d_pwclass='$d_pwclass'
13682 d_pwcomment='$d_pwcomment'
13683 d_pwexpire='$d_pwexpire'
13684 d_pwgecos='$d_pwgecos'
13685 d_pwpasswd='$d_pwpasswd'
13686 d_pwquota='$d_pwquota'
13687 d_readdir='$d_readdir'
13688 d_readlink='$d_readlink'
13689 d_readv='$d_readv'
13690 d_recvmsg='$d_recvmsg'
13691 d_rename='$d_rename'
13692 d_rewinddir='$d_rewinddir'
13693 d_rmdir='$d_rmdir'
13694 d_safebcpy='$d_safebcpy'
13695 d_safemcpy='$d_safemcpy'
13696 d_sanemcmp='$d_sanemcmp'
13697 d_sched_yield='$d_sched_yield'
13698 d_scm_rights='$d_scm_rights'
13699 d_seekdir='$d_seekdir'
13700 d_select='$d_select'
13701 d_sem='$d_sem'
13702 d_semctl='$d_semctl'
13703 d_semctl_semid_ds='$d_semctl_semid_ds'
13704 d_semctl_semun='$d_semctl_semun'
13705 d_semget='$d_semget'
13706 d_semop='$d_semop'
13707 d_sendmsg='$d_sendmsg'
13708 d_setegid='$d_setegid'
13709 d_seteuid='$d_seteuid'
13710 d_setgrent='$d_setgrent'
13711 d_setgrps='$d_setgrps'
13712 d_sethent='$d_sethent'
13713 d_setlinebuf='$d_setlinebuf'
13714 d_setlocale='$d_setlocale'
13715 d_setnent='$d_setnent'
13716 d_setpent='$d_setpent'
13717 d_setpgid='$d_setpgid'
13718 d_setpgrp2='$d_setpgrp2'
13719 d_setpgrp='$d_setpgrp'
13720 d_setprior='$d_setprior'
13721 d_setpwent='$d_setpwent'
13722 d_setregid='$d_setregid'
13723 d_setresgid='$d_setresgid'
13724 d_setresuid='$d_setresuid'
13725 d_setreuid='$d_setreuid'
13726 d_setrgid='$d_setrgid'
13727 d_setruid='$d_setruid'
13728 d_setsent='$d_setsent'
13729 d_setsid='$d_setsid'
13730 d_setspent='$d_setspent'
13731 d_setvbuf='$d_setvbuf'
13732 d_sfio='$d_sfio'
13733 d_shm='$d_shm'
13734 d_shmat='$d_shmat'
13735 d_shmatprototype='$d_shmatprototype'
13736 d_shmctl='$d_shmctl'
13737 d_shmdt='$d_shmdt'
13738 d_shmget='$d_shmget'
13739 d_sigaction='$d_sigaction'
13740 d_sigsetjmp='$d_sigsetjmp'
13741 d_socket='$d_socket'
13742 d_sockpair='$d_sockpair'
13743 d_sqrtl='$d_sqrtl'
13744 d_statblks='$d_statblks'
13745 d_statfs='$d_statfs'
13746 d_statfsflags='$d_statfsflags'
13747 d_statvfs='$d_statvfs'
13748 d_stdio_cnt_lval='$d_stdio_cnt_lval'
13749 d_stdio_ptr_lval='$d_stdio_ptr_lval'
13750 d_stdio_stream_array='$d_stdio_stream_array'
13751 d_stdiobase='$d_stdiobase'
13752 d_stdstdio='$d_stdstdio'
13753 d_strchr='$d_strchr'
13754 d_strcoll='$d_strcoll'
13755 d_strctcpy='$d_strctcpy'
13756 d_strerrm='$d_strerrm'
13757 d_strerror='$d_strerror'
13758 d_strtod='$d_strtod'
13759 d_strtol='$d_strtol'
13760 d_strtoul='$d_strtoul'
13761 d_strtoull='$d_strtoull'
13762 d_strxfrm='$d_strxfrm'
13763 d_suidsafe='$d_suidsafe'
13764 d_symlink='$d_symlink'
13765 d_syscall='$d_syscall'
13766 d_sysconf='$d_sysconf'
13767 d_sysernlst='$d_sysernlst'
13768 d_syserrlst='$d_syserrlst'
13769 d_system='$d_system'
13770 d_tcgetpgrp='$d_tcgetpgrp'
13771 d_tcsetpgrp='$d_tcsetpgrp'
13772 d_telldir='$d_telldir'
13773 d_telldirproto='$d_telldirproto'
13774 d_time='$d_time'
13775 d_times='$d_times'
13776 d_truncate='$d_truncate'
13777 d_tzname='$d_tzname'
13778 d_umask='$d_umask'
13779 d_uname='$d_uname'
13780 d_union_semun='$d_union_semun'
13781 d_vendorbin='$d_vendorbin'
13782 d_vendorlib='$d_vendorlib'
13783 d_vfork='$d_vfork'
13784 d_void_closedir='$d_void_closedir'
13785 d_voidsig='$d_voidsig'
13786 d_voidtty='$d_voidtty'
13787 d_volatile='$d_volatile'
13788 d_vprintf='$d_vprintf'
13789 d_wait4='$d_wait4'
13790 d_waitpid='$d_waitpid'
13791 d_wcstombs='$d_wcstombs'
13792 d_wctomb='$d_wctomb'
13793 d_writev='$d_writev'
13794 d_xenix='$d_xenix'
13795 date='$date'
13796 db_hashtype='$db_hashtype'
13797 db_prefixtype='$db_prefixtype'
13798 defvoidused='$defvoidused'
13799 direntrytype='$direntrytype'
13800 dlext='$dlext'
13801 dlsrc='$dlsrc'
13802 doublesize='$doublesize'
13803 drand01='$drand01'
13804 dynamic_ext='$dynamic_ext'
13805 eagain='$eagain'
13806 ebcdic='$ebcdic'
13807 echo='$echo'
13808 egrep='$egrep'
13809 emacs='$emacs'
13810 eunicefix='$eunicefix'
13811 exe_ext='$exe_ext'
13812 expr='$expr'
13813 extensions='$extensions'
13814 fflushNULL='$fflushNULL'
13815 fflushall='$fflushall'
13816 find='$find'
13817 firstmakefile='$firstmakefile'
13818 flex='$flex'
13819 fpostype='$fpostype'
13820 freetype='$freetype'
13821 full_ar='$full_ar'
13822 full_csh='$full_csh'
13823 full_sed='$full_sed'
13824 gccversion='$gccversion'
13825 gidtype='$gidtype'
13826 glibpth='$glibpth'
13827 grep='$grep'
13828 groupcat='$groupcat'
13829 groupstype='$groupstype'
13830 gzip='$gzip'
13831 h_fcntl='$h_fcntl'
13832 h_sysfile='$h_sysfile'
13833 hint='$hint'
13834 hostcat='$hostcat'
13835 huge='$huge'
13836 i_arpainet='$i_arpainet'
13837 i_bsdioctl='$i_bsdioctl'
13838 i_db='$i_db'
13839 i_dbm='$i_dbm'
13840 i_dirent='$i_dirent'
13841 i_dld='$i_dld'
13842 i_dlfcn='$i_dlfcn'
13843 i_fcntl='$i_fcntl'
13844 i_float='$i_float'
13845 i_gdbm='$i_gdbm'
13846 i_grp='$i_grp'
13847 i_inttypes='$i_inttypes'
13848 i_limits='$i_limits'
13849 i_locale='$i_locale'
13850 i_machcthr='$i_machcthr'
13851 i_malloc='$i_malloc'
13852 i_math='$i_math'
13853 i_memory='$i_memory'
13854 i_mntent='$i_mntent'
13855 i_ndbm='$i_ndbm'
13856 i_netdb='$i_netdb'
13857 i_neterrno='$i_neterrno'
13858 i_netinettcp='$i_netinettcp'
13859 i_niin='$i_niin'
13860 i_poll='$i_poll'
13861 i_pthread='$i_pthread'
13862 i_pwd='$i_pwd'
13863 i_rpcsvcdbm='$i_rpcsvcdbm'
13864 i_sfio='$i_sfio'
13865 i_sgtty='$i_sgtty'
13866 i_shadow='$i_shadow'
13867 i_socks='$i_socks'
13868 i_stdarg='$i_stdarg'
13869 i_stddef='$i_stddef'
13870 i_stdlib='$i_stdlib'
13871 i_string='$i_string'
13872 i_sysaccess='$i_sysaccess'
13873 i_sysdir='$i_sysdir'
13874 i_sysfile='$i_sysfile'
13875 i_sysfilio='$i_sysfilio'
13876 i_sysin='$i_sysin'
13877 i_sysioctl='$i_sysioctl'
13878 i_sysmman='$i_sysmman'
13879 i_sysmount='$i_sysmount'
13880 i_sysndir='$i_sysndir'
13881 i_sysparam='$i_sysparam'
13882 i_sysresrc='$i_sysresrc'
13883 i_syssecrt='$i_syssecrt'
13884 i_sysselct='$i_sysselct'
13885 i_syssockio='$i_syssockio'
13886 i_sysstat='$i_sysstat'
13887 i_sysstatvfs='$i_sysstatvfs'
13888 i_systime='$i_systime'
13889 i_systimek='$i_systimek'
13890 i_systimes='$i_systimes'
13891 i_systypes='$i_systypes'
13892 i_sysuio='$i_sysuio'
13893 i_sysun='$i_sysun'
13894 i_syswait='$i_syswait'
13895 i_termio='$i_termio'
13896 i_termios='$i_termios'
13897 i_time='$i_time'
13898 i_unistd='$i_unistd'
13899 i_utime='$i_utime'
13900 i_values='$i_values'
13901 i_varargs='$i_varargs'
13902 i_varhdr='$i_varhdr'
13903 i_vfork='$i_vfork'
13904 ignore_versioned_solibs='$ignore_versioned_solibs'
13905 incpath='$incpath'
13906 inews='$inews'
13907 installarchlib='$installarchlib'
13908 installbin='$installbin'
13909 installman1dir='$installman1dir'
13910 installman3dir='$installman3dir'
13911 installprefix='$installprefix'
13912 installprefixexp='$installprefixexp'
13913 installprivlib='$installprivlib'
13914 installscript='$installscript'
13915 installsitearch='$installsitearch'
13916 installsitebin='$installsitebin'
13917 installsitelib='$installsitelib'
13918 installstyle='$installstyle'
13919 installusrbinperl='$installusrbinperl'
13920 installvendorbin='$installvendorbin'
13921 installvendorlib='$installvendorlib'
13922 intsize='$intsize'
13923 known_extensions='$known_extensions'
13924 ksh='$ksh'
13925 large='$large'
13926 ld='$ld'
13927 lddlflags='$lddlflags'
13928 ldflags='$ldflags'
13929 ldlibpthname='$ldlibpthname'
13930 less='$less'
13931 lib_ext='$lib_ext'
13932 libc='$libc'
13933 libperl='$libperl'
13934 libpth='$libpth'
13935 libs='$libs'
13936 libswanted='$libswanted'
13937 line='$line'
13938 lint='$lint'
13939 lkflags='$lkflags'
13940 ln='$ln'
13941 lns='$lns'
13942 locincpth='$locincpth'
13943 loclibpth='$loclibpth'
13944 longdblsize='$longdblsize'
13945 longlongsize='$longlongsize'
13946 longsize='$longsize'
13947 lp='$lp'
13948 lpr='$lpr'
13949 ls='$ls'
13950 lseeksize='$lseeksize'
13951 lseektype='$lseektype'
13952 mail='$mail'
13953 mailx='$mailx'
13954 make='$make'
13955 make_set_make='$make_set_make'
13956 mallocobj='$mallocobj'
13957 mallocsrc='$mallocsrc'
13958 malloctype='$malloctype'
13959 man1dir='$man1dir'
13960 man1direxp='$man1direxp'
13961 man1ext='$man1ext'
13962 man3dir='$man3dir'
13963 man3direxp='$man3direxp'
13964 man3ext='$man3ext'
13965 medium='$medium'
13966 mips='$mips'
13967 mips_type='$mips_type'
13968 mkdir='$mkdir'
13969 mmaptype='$mmaptype'
13970 models='$models'
13971 modetype='$modetype'
13972 more='$more'
13973 multiarch='$multiarch'
13974 mv='$mv'
13975 myarchname='$myarchname'
13976 mydomain='$mydomain'
13977 myhostname='$myhostname'
13978 myuname='$myuname'
13979 n='$n'
13980 netdb_hlen_type='$netdb_hlen_type'
13981 netdb_host_type='$netdb_host_type'
13982 netdb_name_type='$netdb_name_type'
13983 netdb_net_type='$netdb_net_type'
13984 nm='$nm'
13985 nm_opt='$nm_opt'
13986 nm_so_opt='$nm_so_opt'
13987 nonxs_ext='$nonxs_ext'
13988 nroff='$nroff'
13989 o_nonblock='$o_nonblock'
13990 obj_ext='$obj_ext'
13991 old_pthread_create_joinable='$old_pthread_create_joinable'
13992 optimize='$optimize'
13993 orderlib='$orderlib'
13994 osname='$osname'
13995 osvers='$osvers'
13996 package='$package'
13997 pager='$pager'
13998 passcat='$passcat'
13999 patchlevel='$patchlevel'
14000 path_sep='$path_sep'
14001 perl='$perl'
14002 perladmin='$perladmin'
14003 perlpath='$perlpath'
14004 pg='$pg'
14005 phostname='$phostname'
14006 pidtype='$pidtype'
14007 plibpth='$plibpth'
14008 pm_apiversion='$pm_apiversion'
14009 pmake='$pmake'
14010 pr='$pr'
14011 prefix='$prefix'
14012 prefixexp='$prefixexp'
14013 privlib='$privlib'
14014 privlibexp='$privlibexp'
14015 prototype='$prototype'
14016 ptrsize='$ptrsize'
14017 randbits='$randbits'
14018 randfunc='$randfunc'
14019 randseedtype='$randseedtype'
14020 ranlib='$ranlib'
14021 rd_nodata='$rd_nodata'
14022 rm='$rm'
14023 rmail='$rmail'
14024 runnm='$runnm'
14025 sPRIEldbl='$sPRIEldbl'
14026 sPRIFldbl='$sPRIFldbl'
14027 sPRIGldbl='$sPRIGldbl'
14028 sPRIX64='$sPRIX64'
14029 sPRId64='$sPRId64'
14030 sPRIeldbl='$sPRIeldbl'
14031 sPRIfldbl='$sPRIfldbl'
14032 sPRIgldbl='$sPRIgldbl'
14033 sPRIi64='$sPRIi64'
14034 sPRIo64='$sPRIo64'
14035 sPRIu64='$sPRIu64'
14036 sPRIx64='$sPRIx64'
14037 sched_yield='$sched_yield'
14038 scriptdir='$scriptdir'
14039 scriptdirexp='$scriptdirexp'
14040 sed='$sed'
14041 seedfunc='$seedfunc'
14042 selectminbits='$selectminbits'
14043 selecttype='$selecttype'
14044 sendmail='$sendmail'
14045 sh='$sh'
14046 shar='$shar'
14047 sharpbang='$sharpbang'
14048 shmattype='$shmattype'
14049 shortsize='$shortsize'
14050 shrpenv='$shrpenv'
14051 shsharp='$shsharp'
14052 sig_count='$sig_count'
14053 sig_name='$sig_name'
14054 sig_name_init='$sig_name_init'
14055 sig_num='$sig_num'
14056 sig_num_init='$sig_num_init'
14057 signal_t='$signal_t'
14058 sitearch='$sitearch'
14059 sitearchexp='$sitearchexp'
14060 sitebin='$sitebin'
14061 sitebinexp='$sitebinexp'
14062 sitelib='$sitelib'
14063 sitelibexp='$sitelibexp'
14064 siteprefix='$siteprefix'
14065 siteprefixexp='$siteprefixexp'
14066 sizetype='$sizetype'
14067 sleep='$sleep'
14068 smail='$smail'
14069 small='$small'
14070 so='$so'
14071 sockethdr='$sockethdr'
14072 socketlib='$socketlib'
14073 sort='$sort'
14074 spackage='$spackage'
14075 spitshell='$spitshell'
14076 split='$split'
14077 src='$src'
14078 ssizetype='$ssizetype'
14079 startperl='$startperl'
14080 startsh='$startsh'
14081 static_ext='$static_ext'
14082 stdchar='$stdchar'
14083 stdio_base='$stdio_base'
14084 stdio_bufsiz='$stdio_bufsiz'
14085 stdio_cnt='$stdio_cnt'
14086 stdio_filbuf='$stdio_filbuf'
14087 stdio_ptr='$stdio_ptr'
14088 stdio_stream_array='$stdio_stream_array'
14089 strings='$strings'
14090 submit='$submit'
14091 subversion='$subversion'
14092 sysman='$sysman'
14093 tail='$tail'
14094 tar='$tar'
14095 tbl='$tbl'
14096 tee='$tee'
14097 test='$test'
14098 timeincl='$timeincl'
14099 timetype='$timetype'
14100 touch='$touch'
14101 tr='$tr'
14102 trnl='$trnl'
14103 troff='$troff'
14104 uidsign='$uidsign'
14105 uidtype='$uidtype'
14106 uname='$uname'
14107 uniq='$uniq'
14108 use64bits='$use64bits'
14109 usedl='$usedl'
14110 uselargefiles='$uselargefiles'
14111 uselongdouble='$uselongdouble'
14112 usemorebits='$usemorebits'
14113 usemultiplicity='$usemultiplicity'
14114 usemymalloc='$usemymalloc'
14115 usenm='$usenm'
14116 useopcode='$useopcode'
14117 useperlio='$useperlio'
14118 useposix='$useposix'
14119 usesfio='$usesfio'
14120 useshrplib='$useshrplib'
14121 usesocks='$usesocks'
14122 usethreads='$usethreads'
14123 usevendorprefix='$usevendorprefix'
14124 usevfork='$usevfork'
14125 usrinc='$usrinc'
14126 uuname='$uuname'
14127 vendorbin='$vendorbin'
14128 vendorbinexp='$vendorbinexp'
14129 vendorlib='$vendorlib'
14130 vendorlibexp='$vendorlibexp'
14131 vendorprefix='$vendorprefix'
14132 vendorprefixexp='$vendorprefixexp'
14133 version='$version'
14134 vi='$vi'
14135 voidflags='$voidflags'
14136 xlibpth='$xlibpth'
14137 xs_apiversion='$xs_apiversion'
14138 zcat='$zcat'
14139 zip='$zip'
14140 EOT
14141
14142 : Add in command line options if available
14143 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
14144
14145 : add special variables
14146 $test -f $src/patchlevel.h && \
14147 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
14148 echo "CONFIGDOTSH=true" >>config.sh
14149
14150 : propagate old symbols
14151 if $test -f UU/config.sh; then
14152         <UU/config.sh sort | uniq >UU/oldconfig.sh
14153         sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
14154         sort | uniq -u >UU/oldsyms
14155         set X `cat UU/oldsyms`
14156         shift
14157         case $# in
14158         0) ;;
14159         *)
14160                 cat <<EOM
14161 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
14162 EOM
14163                 echo "# Variables propagated from previous config.sh file." >>config.sh
14164                 for sym in `cat UU/oldsyms`; do
14165                         echo "    Propagating $hint variable "'$'"$sym..."
14166                         eval 'tmp="$'"${sym}"'"'
14167                         echo "$tmp" | \
14168                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
14169                 done
14170                 ;;
14171         esac
14172 fi
14173
14174 : Finish up by extracting the .SH files
14175 case "$alldone" in
14176 exit)
14177         $rm -rf UU
14178         echo "Done."
14179         exit 0
14180         ;;
14181 cont)
14182         ;;
14183 '')
14184         dflt=''
14185         nostick=true
14186         $cat <<EOM
14187
14188 If you'd like to make any changes to the config.sh file before I begin
14189 to configure things, do it as a shell escape now (e.g. !vi config.sh).
14190
14191 EOM
14192         rp="Press return or use a shell escape to edit config.sh:"
14193         . UU/myread
14194         nostick=''
14195         case "$ans" in
14196         '') ;;
14197         *) : in case they cannot read
14198                 sh 1>&4 -c "$ans";;
14199         esac
14200         ;;
14201 esac
14202
14203 : if this fails, just run all the .SH files by hand
14204 . ./config.sh
14205
14206 echo " "
14207 exec 1>&4
14208 . ./UU/extract
14209
14210 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
14211         dflt=y
14212         case "$silent" in
14213         true) ;;
14214         *)
14215                 $cat <<EOM
14216
14217 Now you need to generate make dependencies by running "$make depend".
14218 You might prefer to run it in background: "$make depend > makedepend.out &"
14219 It can take a while, so you might not want to run it right now.
14220
14221 EOM
14222                 ;;
14223         esac
14224         rp="Run $make depend now?"
14225         . UU/myread
14226         case "$ans" in
14227         y*)
14228                 $make depend && echo "Now you must run a $make."
14229                 ;;
14230         *)
14231                 echo "You must run '$make depend' then '$make'."
14232                 ;;
14233         esac
14234 elif test -f [Mm]akefile; then
14235         echo " "
14236         echo "Now you must run a $make."
14237 else
14238         echo "Done."
14239 fi
14240
14241 if $test -f Policy.sh; then
14242     $cat <<EOM
14243
14244 If you compile $package on a different machine or from a different object
14245 directory, copy the Policy.sh file from this object directory to the
14246 new one before you run Configure -- this will help you with most of
14247 the policy defaults.
14248
14249 EOM
14250 fi
14251 if $test -f config.msg; then
14252     echo "Hmm.  I also noted the following information while running:"
14253     echo " "
14254     $cat config.msg >&4
14255     $rm -f config.msg
14256 fi
14257 $rm -f kit*isdone ark*isdone
14258 $rm -rf UU
14259
14260 : End of Configure
14261