5aa906821338390ac3760bdfb818bd8e35e572a5
[p5sagit/p5-mst-13.2.git] / Configure
1 #! /bin/sh
2 #
3 # If these # comments don't work, trim them. Don't worry about any other
4 # shell scripts, Configure will trim # comments from them for you.
5 #
6 # (If you are trying to port this package to a machine without sh,
7 # I would suggest you have a look at the prototypical config_h.SH file
8 # and edit it to reflect your system. Some packages may include samples
9 # of config.h for certain machines, so you might look for one of those.)
10 #
11 # Yes, you may rip this off to use in other distribution packages. This
12 # script belongs to the public domain and cannot be copyrighted.
13 #
14 # (Note: this Configure script was generated automatically. Rather than
15 # working with this copy of Configure, you may wish to get metaconfig.
16 # The dist-3.0 package (which contains metaconfig) was posted in
17 # comp.sources.misc and is available on CPAN under authors/id/RAM so
18 # you may fetch it yourself from your nearest archive site.)
19 #
20
21 # $Id: Head.U,v 3.0.1.9 1997/02/28 15:02:09 ram Exp $
22 #
23 # Generated on Wed Oct 27 14:42:21 EET DST 1999 [metaconfig 3.0 PL70]
24 # (with additional metaconfig patches by perlbug@perl.com)
25
26 cat >/tmp/c1$$ <<EOF
27 ARGGGHHHH!!!!!
28
29 SCO csh still thinks true is false.  Write to SCO today and tell them that next
30 year Configure ought to "rm /bin/csh" unless they fix their blasted shell. :-)
31
32 (Actually, Configure ought to just patch csh in place.  Hmm.  Hmmmmm.  All
33 we'd have to do is go in and swap the && and || tokens, wherever they are.)
34
35 [End of diatribe. We now return you to your regularly scheduled programming...]
36 EOF
37 cat >/tmp/c2$$ <<EOF
38
39 OOPS!  You naughty creature!  You didn't run Configure with sh!
40 I will attempt to remedy the situation by running sh for you...
41 EOF
42
43 true || cat /tmp/c1$$ /tmp/c2$$
44 true || exec sh $0 $argv:q
45
46 (exit $?0) || cat /tmp/c2$$
47 (exit $?0) || exec sh $0 $argv:q
48 rm -f /tmp/c1$$ /tmp/c2$$
49
50 : compute my invocation name
51 me=$0
52 case "$0" in
53 */*)
54         me=`echo $0 | sed -e 's!.*/\(.*\)!\1!' 2>/dev/null`
55         test "$me" || me=$0
56         ;;
57 esac
58
59 : Proper separator for the PATH environment variable
60 p_=:
61 : On OS/2 this directory should exist if this is not floppy only system :-]
62 if test -d c:/. ; then
63     if test -n "$OS2_SHELL"; then
64                 p_=\;
65                 PATH=`cmd /c "echo %PATH%" | tr '\\\\' / `
66                 OS2_SHELL=`cmd /c "echo %OS2_SHELL%" | tr '\\\\' / | tr '[A-Z]' '[a-z]'`
67         elif test -n "$DJGPP"; then
68                 p_=\;
69         fi
70 fi
71
72 : Proper PATH setting
73 paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin'
74 paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin"
75 paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin"
76 paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin"
77 paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb"
78 paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /usr/ccs/bin"
79 paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib"
80 paths="$paths /sbin /usr/sbin /usr/libexec"
81
82 for p in $paths
83 do
84         case "$p_$PATH$p_" in
85         *$p_$p$p_*) ;;
86         *) test -d $p && PATH=$PATH$p_$p ;;
87         esac
88 done
89
90 PATH=.$p_$PATH
91 export PATH
92
93 : shall we be using ksh?
94 inksh=''
95 needksh=''
96 avoidksh=''
97 newsh=/bin/ksh
98 changesh=''
99 if (PATH=.; alias -x) >/dev/null 2>&1; then
100                 inksh=true
101 fi
102 if test -f /hp-ux -a -f /bin/ksh; then
103         needksh='to avoid sh bug in "here document" expansion'
104 fi
105 if test -d /usr/lpp -a -f /usr/bin/bsh -a -f /usr/bin/uname; then
106         if test X`/usr/bin/uname -v` = X4; then
107                 avoidksh="to avoid AIX 4's /bin/sh"
108                 newsh=/usr/bin/bsh
109         fi
110 fi
111 if test -f /osf_boot -a -f /usr/sbin/setld; then
112         if test X`/usr/bin/uname -s` = XOSF1; then
113                 avoidksh="to avoid Digital UNIX' ksh"
114                 newsh=/bin/sh
115                 unset BIN_SH # if this is 'xpg4' sh will start up ksh
116         fi
117 fi
118 case "$inksh/$needksh" in
119 /[a-z]*)
120                 ENV=''
121                 changesh=true
122                 reason="$needksh"
123         ;;
124 esac
125 case "$inksh/$avoidksh" in
126 true/[a-z]*)
127         changesh=true
128         reason="$avoidksh"
129         ;;
130 esac
131 case "$inksh/$needksh-$avoidksh-" in
132 true/--)
133                 cat <<EOM
134 (I see you are using the Korn shell.  Some ksh's blow up on $me,
135 mainly on older exotic systems.  If yours does, try the Bourne shell instead.)
136 EOM
137         ;;
138 esac
139 case "$changesh" in
140 true)
141         echo "(Feeding myself to $newsh $reason.)"
142         case "$0" in
143         Configure|*/Configure) exec $newsh $0 "$@";;
144         *) exec $newsh Configure "$@";;
145         esac
146         ;;
147 esac
148
149 : if needed set CDPATH to a harmless value that is not chatty
150 : avoid bash 2.02 problems with empty CDPATH.
151 case "$CDPATH" in
152 '')     ;;
153 *)      case "$SHELL" in
154         *bash*) CDPATH='.' ;;
155         *)              CDPATH='' ;;
156         esac
157         ;;
158 esac
159 : Configure runs within the UU subdirectory
160 test -d UU || mkdir UU
161 cd UU && rm -f ./*
162
163 ccsymbols=''
164 cppccsymbols=''
165 cppsymbols=''
166 dynamic_ext=''
167 extensions=''
168 known_extensions=''
169 nonxs_ext=''
170 static_ext=''
171 useopcode=''
172 useposix=''
173 d_bsd=''
174 d_eunice=''
175 d_xenix=''
176 eunicefix=''
177 Mcc=''
178 ar=''
179 awk=''
180 bash=''
181 bison=''
182 byacc=''
183 cat=''
184 chgrp=''
185 chmod=''
186 chown=''
187 comm=''
188 compress=''
189 cp=''
190 cpio=''
191 cpp=''
192 csh=''
193 date=''
194 echo=''
195 egrep=''
196 emacs=''
197 expr=''
198 find=''
199 flex=''
200 grep=''
201 gzip=''
202 inews=''
203 ksh=''
204 less=''
205 line=''
206 lint=''
207 ln=''
208 lp=''
209 lpr=''
210 ls=''
211 mail=''
212 mailx=''
213 make=''
214 mkdir=''
215 more=''
216 mv=''
217 nm=''
218 nroff=''
219 perl=''
220 pg=''
221 pmake=''
222 pr=''
223 rm=''
224 rmail=''
225 sed=''
226 sendmail=''
227 shar=''
228 sleep=''
229 smail=''
230 sort=''
231 submit=''
232 tail=''
233 tar=''
234 tbl=''
235 tee=''
236 test=''
237 touch=''
238 tr=''
239 troff=''
240 uname=''
241 uniq=''
242 uuname=''
243 vi=''
244 zcat=''
245 zip=''
246 full_ar=''
247 full_sed=''
248 libswanted=''
249 hint=''
250 myuname=''
251 osname=''
252 osvers=''
253 Author=''
254 Date=''
255 Header=''
256 Id=''
257 Locker=''
258 Log=''
259 RCSfile=''
260 Revision=''
261 Source=''
262 State=''
263 _a=''
264 _exe=''
265 _o=''
266 archobjs=''
267 exe_ext=''
268 firstmakefile=''
269 lib_ext=''
270 obj_ext=''
271 path_sep=''
272 afs=''
273 alignbytes=''
274 ansi2knr=''
275 archlib=''
276 archlibexp=''
277 d_archlib=''
278 installarchlib=''
279 archname=''
280 myarchname=''
281 d_atolf=''
282 d_atoll=''
283 baserev=''
284 bin=''
285 binexp=''
286 installbin=''
287 bincompat5005=''
288 d_bincompat5005=''
289 byteorder=''
290 cc=''
291 gccversion=''
292 ccflags=''
293 cppflags=''
294 ldflags=''
295 lkflags=''
296 locincpth=''
297 optimize=''
298 cf_email=''
299 cf_by=''
300 cf_time=''
301 contains=''
302 cpp_stuff=''
303 cpplast=''
304 cppminus=''
305 cpprun=''
306 cppstdin=''
307 crosscompile=''
308 d_access=''
309 d_accessx=''
310 d_alarm=''
311 d_attribut=''
312 d_bcmp=''
313 d_bcopy=''
314 d_bzero=''
315 d_casti32=''
316 castflags=''
317 d_castneg=''
318 d_chown=''
319 d_chroot=''
320 d_chsize=''
321 d_closedir=''
322 d_void_closedir=''
323 d_const=''
324 cryptlib=''
325 d_crypt=''
326 d_csh=''
327 full_csh=''
328 d_cuserid=''
329 d_dbl_dig=''
330 d_difftime=''
331 d_dlerror=''
332 d_dlopen=''
333 d_dlsymun=''
334 d_dosuid=''
335 d_suidsafe=''
336 d_drand48proto=''
337 d_dup2=''
338 d_eaccess=''
339 d_endgrent=''
340 d_endhent=''
341 d_endnent=''
342 d_endpent=''
343 d_endpwent=''
344 d_endsent=''
345 d_endspent=''
346 d_fchmod=''
347 d_fchown=''
348 d_fcntl=''
349 d_fd_macros=''
350 d_fd_set=''
351 d_fds_bits=''
352 d_fgetpos=''
353 d_flexfnam=''
354 d_flock=''
355 d_fork=''
356 d_fseeko=''
357 d_fsetpos=''
358 d_fstatfs=''
359 d_ftello=''
360 d_ftime=''
361 d_gettimeod=''
362 d_Gconvert=''
363 d_getgrent=''
364 d_getgrps=''
365 d_gethbyaddr=''
366 d_gethbyname=''
367 d_gethent=''
368 aphostname=''
369 d_gethname=''
370 d_phostname=''
371 d_uname=''
372 d_gethostprotos=''
373 d_getlogin=''
374 d_getmntent=''
375 d_getnbyaddr=''
376 d_getnbyname=''
377 d_getnent=''
378 d_getnetprotos=''
379 d_getpent=''
380 d_getpgid=''
381 d_getpgrp2=''
382 d_bsdgetpgrp=''
383 d_getpgrp=''
384 d_getppid=''
385 d_getprior=''
386 d_getpbyname=''
387 d_getpbynumber=''
388 d_getprotoprotos=''
389 d_getpwent=''
390 d_getsent=''
391 d_getservprotos=''
392 d_getspent=''
393 d_getspnam=''
394 d_getsbyname=''
395 d_getsbyport=''
396 d_gnulibc=''
397 d_hasmntopt=''
398 d_htonl=''
399 d_inetaton=''
400 d_isascii=''
401 d_killpg=''
402 d_lchown=''
403 d_ldbl_dig=''
404 d_link=''
405 d_locconv=''
406 d_lockf=''
407 d_longdbl=''
408 longdblsize=''
409 d_longlong=''
410 longlongsize=''
411 d_lstat=''
412 d_madvise=''
413 d_mblen=''
414 d_mbstowcs=''
415 d_mbtowc=''
416 d_memchr=''
417 d_memcmp=''
418 d_memcpy=''
419 d_memmove=''
420 d_memset=''
421 d_mkdir=''
422 d_mkfifo=''
423 d_mktime=''
424 d_mmap=''
425 mmaptype=''
426 d_mprotect=''
427 d_msg=''
428 d_msgctl=''
429 d_msgget=''
430 d_msgrcv=''
431 d_msgsnd=''
432 d_msync=''
433 d_munmap=''
434 d_nice=''
435 d_open3=''
436 d_fpathconf=''
437 d_pathconf=''
438 d_pause=''
439 d_pipe=''
440 d_poll=''
441 d_portable=''
442 d_old_pthread_create_joinable=''
443 old_pthread_create_joinable=''
444 d_pthread_yield=''
445 d_sched_yield=''
446 sched_yield=''
447 d_readdir=''
448 d_rewinddir=''
449 d_seekdir=''
450 d_telldir=''
451 d_readlink=''
452 d_readv=''
453 d_rename=''
454 d_rmdir=''
455 d_safebcpy=''
456 d_safemcpy=''
457 d_sanemcmp=''
458 d_select=''
459 d_sem=''
460 d_semctl=''
461 d_semget=''
462 d_semop=''
463 d_setegid=''
464 d_seteuid=''
465 d_setgrent=''
466 d_setgrps=''
467 d_sethent=''
468 d_setlinebuf=''
469 d_setlocale=''
470 d_setnent=''
471 d_setpent=''
472 d_setpgid=''
473 d_setpgrp2=''
474 d_bsdsetpgrp=''
475 d_setpgrp=''
476 d_setprior=''
477 d_setpwent=''
478 d_setregid=''
479 d_setresgid=''
480 d_setresuid=''
481 d_setreuid=''
482 d_setrgid=''
483 d_setruid=''
484 d_setsent=''
485 d_setsid=''
486 d_setspent=''
487 d_setvbuf=''
488 d_sfio=''
489 usesfio=''
490 d_shm=''
491 d_shmat=''
492 d_shmatprototype=''
493 shmattype=''
494 d_shmctl=''
495 d_shmdt=''
496 d_shmget=''
497 d_sigaction=''
498 d_sigsetjmp=''
499 d_cmsghdr_s=''
500 d_msg_ctrunc=''
501 d_msg_dontroute=''
502 d_msg_oob=''
503 d_msg_peek=''
504 d_msg_proxy=''
505 d_msghdr_s=''
506 d_oldsock=''
507 d_recvmsg=''
508 d_scm_rights=''
509 d_sendmsg=''
510 d_socket=''
511 d_sockpair=''
512 sockethdr=''
513 socketlib=''
514 d_sqrtl=''
515 d_statblks=''
516 d_fs_data_s=''
517 d_statfs=''
518 d_statfs_f_flags=''
519 d_statfs_s=''
520 d_fstatvfs=''
521 d_statvfs=''
522 d_stdio_cnt_lval=''
523 d_stdio_ptr_lval=''
524 d_stdiobase=''
525 d_stdstdio=''
526 stdio_base=''
527 stdio_bufsiz=''
528 stdio_cnt=''
529 stdio_filbuf=''
530 stdio_ptr=''
531 d_index=''
532 d_strchr=''
533 d_strcoll=''
534 d_strctcpy=''
535 d_strerrm=''
536 d_strerror=''
537 d_sysernlst=''
538 d_syserrlst=''
539 d_strtod=''
540 d_strtol=''
541 d_strtoul=''
542 d_strxfrm=''
543 d_symlink=''
544 d_syscall=''
545 d_sysconf=''
546 d_system=''
547 d_tcgetpgrp=''
548 d_tcsetpgrp=''
549 d_telldirproto=''
550 d_time=''
551 timetype=''
552 clocktype=''
553 d_times=''
554 d_truncate=''
555 d_tzname=''
556 d_umask=''
557 d_semctl_semid_ds=''
558 d_semctl_semun=''
559 d_union_semun=''
560 d_ustat=''
561 d_vfork=''
562 usevfork=''
563 d_voidsig=''
564 signal_t=''
565 d_volatile=''
566 d_charvspr=''
567 d_vprintf=''
568 d_wait4=''
569 d_waitpid=''
570 d_wcstombs=''
571 d_wctomb=''
572 d_writev=''
573 dlext=''
574 cccdlflags=''
575 ccdlflags=''
576 dlsrc=''
577 ld=''
578 lddlflags=''
579 usedl=''
580 doublesize=''
581 ebcdic=''
582 fflushNULL=''
583 fflushall=''
584 fpostype=''
585 gidtype=''
586 groupstype=''
587 h_fcntl=''
588 h_sysfile=''
589 i_arpainet=''
590 db_hashtype=''
591 db_prefixtype=''
592 i_db=''
593 i_dbm=''
594 i_rpcsvcdbm=''
595 d_dirnamlen=''
596 direntrytype=''
597 i_dirent=''
598 i_dld=''
599 i_dlfcn=''
600 i_fcntl=''
601 i_float=''
602 i_gdbm=''
603 d_grpasswd=''
604 i_grp=''
605 d_int64t=''
606 i_inttypes=''
607 i_limits=''
608 i_locale=''
609 i_machcthr=''
610 i_malloc=''
611 i_math=''
612 i_memory=''
613 i_mntent=''
614 i_ndbm=''
615 i_netdb=''
616 i_neterrno=''
617 i_netinettcp=''
618 i_niin=''
619 i_sysin=''
620 i_poll=''
621 i_pthread=''
622 d_pwage=''
623 d_pwchange=''
624 d_pwclass=''
625 d_pwcomment=''
626 d_pwexpire=''
627 d_pwgecos=''
628 d_pwpasswd=''
629 d_pwquota=''
630 i_pwd=''
631 i_sfio=''
632 i_shadow=''
633 i_socks=''
634 i_stddef=''
635 i_stdlib=''
636 i_string=''
637 strings=''
638 i_sysaccess=''
639 i_sysdir=''
640 i_sysfile=''
641 d_voidtty=''
642 i_bsdioctl=''
643 i_sysfilio=''
644 i_sysioctl=''
645 i_syssockio=''
646 i_sysmman=''
647 i_sysmount=''
648 i_sysndir=''
649 i_sysparam=''
650 i_sysresrc=''
651 i_syssecrt=''
652 i_sysselct=''
653 i_sysstat=''
654 i_sysstatfs=''
655 i_sysstatvfs=''
656 i_systimes=''
657 i_systypes=''
658 d_iovec_s=''
659 i_sysuio=''
660 i_sysun=''
661 i_sysvfs=''
662 i_syswait=''
663 i_sgtty=''
664 i_termio=''
665 i_termios=''
666 i_systime=''
667 i_systimek=''
668 i_time=''
669 timeincl=''
670 i_unistd=''
671 i_ustat=''
672 i_utime=''
673 i_values=''
674 i_stdarg=''
675 i_varargs=''
676 i_varhdr=''
677 i_vfork=''
678 installprefix=''
679 installprefixexp=''
680 installstyle=''
681 installusrbinperl=''
682 intsize=''
683 longsize=''
684 shortsize=''
685 d_fpos64_t=''
686 d_llseek=''
687 d_off64_t=''
688 libc=''
689 ldlibpthname=''
690 libperl=''
691 shrpenv=''
692 useshrplib=''
693 glibpth=''
694 libpth=''
695 loclibpth=''
696 plibpth=''
697 xlibpth=''
698 ignore_versioned_solibs=''
699 libs=''
700 lns=''
701 d_PRIEldbl=''
702 d_PRIFldbl=''
703 d_PRIGldbl=''
704 d_PRIeldbl=''
705 d_PRIfldbl=''
706 d_PRIgldbl=''
707 sPRIEldbl=''
708 sPRIFldbl=''
709 sPRIGldbl=''
710 sPRIeldbl=''
711 sPRIfldbl=''
712 sPRIgldbl=''
713 lseeksize=''
714 lseektype=''
715 make_set_make=''
716 d_mymalloc=''
717 freetype=''
718 mallocobj=''
719 mallocsrc=''
720 malloctype=''
721 usemymalloc=''
722 installman1dir=''
723 man1dir=''
724 man1direxp=''
725 man1ext=''
726 installman3dir=''
727 man3dir=''
728 man3direxp=''
729 man3ext=''
730 huge=''
731 large=''
732 medium=''
733 models=''
734 small=''
735 split=''
736 modetype=''
737 multiarch=''
738 mydomain=''
739 myhostname=''
740 phostname=''
741 c=''
742 n=''
743 d_eofnblk=''
744 eagain=''
745 o_nonblock=''
746 rd_nodata=''
747 netdb_hlen_type=''
748 netdb_host_type=''
749 netdb_name_type=''
750 netdb_net_type=''
751 groupcat=''
752 hostcat=''
753 passcat=''
754 orderlib=''
755 ranlib=''
756 package=''
757 spackage=''
758 pager=''
759 apiversion=''
760 patchlevel=''
761 subversion=''
762 version=''
763 perladmin=''
764 perlpath=''
765 pidtype=''
766 prefix=''
767 prefixexp=''
768 installprivlib=''
769 privlib=''
770 privlibexp=''
771 prototype=''
772 ptrsize=''
773 d_PRIX64=''
774 d_PRId64=''
775 d_PRIi64=''
776 d_PRIo64=''
777 d_PRIu64=''
778 d_PRIx64=''
779 sPRIX64=''
780 sPRId64=''
781 sPRIi64=''
782 sPRIo64=''
783 sPRIu64=''
784 sPRIx64=''
785 drand01=''
786 randbits=''
787 randfunc=''
788 randseedtype=''
789 seedfunc=''
790 installscript=''
791 scriptdir=''
792 scriptdirexp=''
793 selectminbits=''
794 selecttype=''
795 sh=''
796 sig_count=''
797 sig_name=''
798 sig_name_init=''
799 sig_num=''
800 sig_num_init=''
801 installsitearch=''
802 sitearch=''
803 sitearchexp=''
804 installsitebin=''
805 sitebin=''
806 sitebinexp=''
807 installsitelib=''
808 sitelib=''
809 sitelibexp=''
810 siteprefix=''
811 siteprefixexp=''
812 sizetype=''
813 so=''
814 sharpbang=''
815 shsharp=''
816 spitshell=''
817 src=''
818 ssizetype=''
819 startperl=''
820 startsh=''
821 stdchar=''
822 d_stdio_stream_array=''
823 stdio_stream_array=''
824 d_strtoull=''
825 sysman=''
826 trnl=''
827 uidsign=''
828 uidtype=''
829 archname64=''
830 use64bits=''
831 uselargefiles=''
832 uselongdouble=''
833 usemorebits=''
834 usemultiplicity=''
835 nm_opt=''
836 nm_so_opt=''
837 runnm=''
838 usenm=''
839 useperlio=''
840 usesocks=''
841 d_oldpthreads=''
842 usethreads=''
843 incpath=''
844 mips=''
845 mips_type=''
846 usrinc=''
847 d_vendorbin=''
848 installvendorbin=''
849 vendorbin=''
850 vendorbinexp=''
851 d_vendorlib=''
852 installvendorlib=''
853 vendorlib=''
854 vendorlibexp=''
855 usevendorprefix=''
856 vendorprefix=''
857 vendorprefixexp=''
858 defvoidused=''
859 voidflags=''
860 pm_apiversion=''
861 xs_apiversion=''
862 CONFIG=''
863
864 define='define'
865 undef='undef'
866 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
867 rmlist=''
868
869 : We must find out about Eunice early
870 eunicefix=':'
871 if test -f /etc/unixtovms; then
872         eunicefix=/etc/unixtovms
873 fi
874 if test -f /etc/unixtovms.exe; then
875         eunicefix=/etc/unixtovms.exe
876 fi
877
878 i_whoami=''
879 : Possible local include directories to search.
880 : Set locincpth to "" in a hint file to defeat local include searches.
881 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
882 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
883 :
884 : no include file wanted by default
885 inclwanted=''
886
887 : list of known cpp symbols, sorted alphabetically
888 al="AMIX BIT_MSF BSD BSD4_3 BSD_NET2 CMU CRAY DGUX DOLPHIN DPX2"
889 al="$al GO32 GOULD_PN HP700 I386 I80960 I960 Lynx M68000 M68K MACH"
890 al="$al MIPSEB MIPSEL MSDOS MTXINU MULTIMAX MVS"
891 al="$al M_COFF M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM"
892 al="$al M_SYS3 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX"
893 al="$al NeXT OCS88 OSF1 PARISC PC532 PORTAR POSIX"
894 al="$al PWB R3000 RES RISC6000 RT Sun386i SVR3 SVR4 SVR5"
895 al="$al SYSTYPE_BSD SYSTYPE_SVR4 SYSTYPE_SYSV Tek4132 Tek4300"
896 al="$al UMAXV USGr4 USGr4_2 UTEK UTS UTek UnicomPBB UnicomPBD Utek"
897 al="$al VMS Xenix286"
898 al="$al _AIX _AIX32 _AIX370 _AIX41 _AM29000 _COFF _CRAY _CX_UX _EPI"
899 al="$al _IBMESA _IBMR2 _M88K _M88KBCS_TARGET _POWER"
900 al="$al _MIPSEB _MIPSEL _M_COFF _M_I86 _M_I86SM _M_SYS3"
901 al="$al _M_SYS5 _M_SYSIII _M_SYSV _M_UNIX _M_XENIX _NLS _PGC_ _R3000"
902 al="$al _SYSTYPE_BSD _SYSTYPE_BSD43 _SYSTYPE_SVR4"
903 al="$al _SYSTYPE_SYSV _SYSV3 _U370 _UNICOS"
904 al="$al __386BSD__ __BIG_ENDIAN __BIG_ENDIAN__ __BSD_4_4__"
905 al="$al __DGUX__ __DPX2__ __H3050R __H3050RX"
906 al="$al __LITTLE_ENDIAN __LITTLE_ENDIAN__ __MACH__"
907 al="$al __MIPSEB __MIPSEB__ __MIPSEL __MIPSEL__"
908 al="$al __Next__ __OSF1__ __PARAGON__ __PGC__ __PWB __STDC__"
909 al="$al __SVR4_2__ __UMAXV__"
910 al="$al ____386BSD____ __alpha __alpha__ __amiga"
911 al="$al __bsd4_2 __bsd4_2__ __bsdi__ __convex__"
912 al="$al __host_mips__"
913 al="$al __hp9000s200 __hp9000s300 __hp9000s400 __hp9000s500"
914 al="$al __hp9000s500 __hp9000s700 __hp9000s800"
915 al="$al __hppa __hpux __hp_osf __i286 __i286__ __i386 __i386__"
916 al="$al __i486 __i486__ __i860 __i860__ __ibmesa __ksr1__ __linux__"
917 al="$al __m68k __m68k__ __m88100__ __m88k __m88k__"
918 al="$al __mc68000 __mc68000__ __mc68020 __mc68020__"
919 al="$al __mc68030 __mc68030__ __mc68040 __mc68040__"
920 al="$al __mc88100 __mc88100__ __mips __mips__"
921 al="$al __motorola__ __osf__ __pa_risc __sparc__ __stdc__"
922 al="$al __sun __sun__ __svr3__ __svr4__ __ultrix __ultrix__"
923 al="$al __unix __unix__ __uxpm__ __uxps__ __vax __vax__"
924 al="$al _host_mips _mips _unix"
925 al="$al a29k aegis aix aixpc alliant alpha am29000 amiga ansi ardent"
926 al="$al apollo ardent att386 att3b"
927 al="$al bsd bsd43 bsd4_2 bsd4_3 bsd4_4 bsdi bull"
928 al="$al cadmus clipper concurrent convex cray ctix"
929 al="$al dmert encore gcos gcx gimpel gould"
930 al="$al hbullx20 hcx host_mips hp200 hp300 hp700 hp800"
931 al="$al hp9000 hp9000s300 hp9000s400 hp9000s500"
932 al="$al hp9000s700 hp9000s800 hp9k8 hppa hpux"
933 al="$al i186 i286 i386 i486 i8086"
934 al="$al i80960 i860 iAPX286 ibm ibm032 ibmrt interdata is68k"
935 al="$al ksr1 linux luna luna88k m68k m88100 m88k"
936 al="$al mc300 mc500 mc68000 mc68010 mc68020 mc68030"
937 al="$al mc68040 mc68060 mc68k mc68k32 mc700"
938 al="$al mc88000 mc88100 merlin mert mips mvs n16"
939 al="$al ncl_el ncl_mr"
940 al="$al news1500 news1700 news1800 news1900 news3700"
941 al="$al news700 news800 news900 ns16000 ns32000"
942 al="$al ns32016 ns32332 ns32k nsc32000 os osf"
943 al="$al parisc pc532 pdp11 plexus posix pyr"
944 al="$al riscix riscos scs sequent sgi sinix sony sony_news"
945 al="$al sonyrisc sparc sparclite spectrum stardent stratos"
946 al="$al sun sun3 sun386 svr4 sysV68 sysV88"
947 al="$al titan tower tower32 tower32_200 tower32_600 tower32_700"
948 al="$al tower32_800 tower32_850 tss u370 u3b u3b2 u3b20 u3b200"
949 al="$al u3b20d u3b5 ultrix unix unixpc unos vax venix vms"
950 al="$al xenix z8000"
951
952 : Trailing extension.  Override this in a hint file, if needed.
953 _exe=''
954 : Extra object files, if any, needed on this platform.
955 archobjs=''
956 groupstype=''
957 : change the next line if compiling for Xenix/286 on Xenix/386
958 xlibpth='/usr/lib/386 /lib/386'
959
960 : Possible local library directories to search.
961 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
962 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
963
964 : general looking path for locating libraries
965 glibpth="/shlib /usr/shlib /lib/pa1.1 /usr/lib/large"
966 glibpth="$glibpth /lib /usr/lib $xlibpth"
967 glibpth="$glibpth /lib/large /usr/lib/small /lib/small"
968 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
969
970 : Private path used by Configure to find libraries.  Its value
971 : is prepended to libpth. This variable takes care of special
972 : machines, like the mips.  Usually, it should be empty.
973 plibpth=''
974
975 : default library list
976 libswanted=''
977 : some systems want to use only the non-versioned libso:s
978 ignore_versioned_solibs=''
979 : full support for void wanted by default
980 defvoidused=15
981
982 : set useposix=false in your hint file to disable the POSIX extension.
983 useposix=true
984 : set useopcode=false in your hint file to disable the Opcode extension.
985 useopcode=true
986 : set usemultiplicity on the Configure command line to enable multiplicity.
987 : set usesocks on the Configure command line to enable socks.
988 : set usethreads on the Configure command line to enable threads.
989 : List of libraries we want.
990 : If anyone needs -lnet, put it in a hint file.
991 libswanted='sfio socket inet nsl nm ndbm gdbm dbm db malloc dl'
992 libswanted="$libswanted dld ld sun m c cposix posix"
993 libswanted="$libswanted ndir dir crypt sec"
994 libswanted="$libswanted ucb bsd BSD PW x"
995 : We probably want to search /usr/shlib before most other libraries.
996 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
997 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
998 glibpth="/usr/shlib $glibpth"
999 : Do not use vfork unless overridden by a hint file.
1000 usevfork=false
1001
1002 : Find the basic shell for Bourne shell scripts
1003 case "$sh" in
1004 '')
1005         case "$SYSTYPE" in
1006         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1007         *) xxx='/bin/sh';;
1008         esac
1009         if test -f "$xxx"; then
1010                 sh="$xxx"
1011         else
1012                 : Build up a list and do a single loop so we can 'break' out.
1013                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1014                 for xxx in sh bash ksh pdksh ash; do
1015                         for p in $pth; do
1016                                 try="$try ${p}/${xxx}"
1017                         done
1018                 done
1019                 for xxx in $try; do
1020                         if test -f "$xxx"; then
1021                                 sh="$xxx";
1022                                 break
1023                         elif test -f "$xxx.exe"; then
1024                                 sh="$xxx";
1025                                 break
1026                         fi
1027                 done
1028         fi
1029         ;;
1030 esac
1031
1032 case "$sh" in
1033 '')     cat <<EOM >&2
1034 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
1035
1036 Usually it's in /bin/sh.  How did you even get this far?
1037 Please contact me (Perl Maintainers) at perlbug@perl.com and 
1038 we'll try to straighten this all out.
1039 EOM
1040         exit 1
1041         ;;
1042 esac
1043
1044 : see if sh knows # comments
1045 if `$sh -c '#' >/dev/null 2>&1`; then
1046         shsharp=true
1047         spitshell=cat
1048         xcat=/bin/cat
1049         test -f $xcat || xcat=/usr/bin/cat
1050         echo "#!$xcat" >try
1051         $eunicefix try
1052         chmod +x try
1053         ./try > today
1054         if test -s today; then
1055                 sharpbang='#!'
1056         else
1057                 echo "#! $xcat" > try
1058                 $eunicefix try
1059                 chmod +x try
1060                 ./try > today
1061                 if test -s today; then
1062                         sharpbang='#! '
1063                 else
1064                         sharpbang=': use '
1065                 fi
1066         fi
1067 else
1068         echo " "
1069         echo "Your $sh doesn't grok # comments--I will strip them later on."
1070         shsharp=false
1071         cd ..
1072         echo "exec grep -v '^[  ]*#'" >spitshell
1073         chmod +x spitshell
1074         $eunicefix spitshell
1075         spitshell=`pwd`/spitshell
1076         cd UU
1077         echo "I presume that if # doesn't work, #! won't work either!"
1078         sharpbang=': use '
1079 fi
1080 rm -f try today
1081
1082 : figure out how to guarantee sh startup
1083 case "$startsh" in
1084 '') startsh=${sharpbang}${sh} ;;
1085 *)
1086 esac
1087 cat >try <<EOSS
1088 $startsh
1089 set abc
1090 test "$?abc" != 1
1091 EOSS
1092
1093 chmod +x try
1094 $eunicefix try
1095 if ./try; then
1096         : echo "Yup, it does."
1097 else
1098         echo "Hmm... '$startsh' does not guarantee sh startup..."
1099         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1100 fi
1101 rm -f try
1102
1103
1104 : Save command line options in file UU/cmdline.opt for later use in
1105 : generating config.sh.
1106 cat > cmdline.opt <<EOSH
1107 # Configure command line arguments.
1108 config_arg0='$0'
1109 config_args='$*'
1110 config_argc=$#
1111 EOSH
1112 argn=1
1113 for arg in "$@"; do
1114         cat >>cmdline.opt <<EOSH
1115 config_arg$argn='$arg'
1116 EOSH
1117         argn=`expr $argn + 1`
1118 done
1119
1120 : produce awk script to parse command line options
1121 cat >options.awk <<'EOF'
1122 BEGIN {
1123         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1124
1125         len = length(optstr);
1126         for (i = 1; i <= len; i++) {
1127                 c = substr(optstr, i, 1);
1128                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1129                 if (a == ":") {
1130                         arg[c] = 1;
1131                         i++;
1132                 }
1133                 opt[c] = 1;
1134         }
1135 }
1136 {
1137         expect = 0;
1138         str = $0;
1139         if (substr(str, 1, 1) != "-") {
1140                 printf("'%s'\n", str);
1141                 next;
1142         }
1143         len = length($0);
1144         for (i = 2; i <= len; i++) {
1145                 c = substr(str, i, 1);
1146                 if (!opt[c]) {
1147                         printf("-%s\n", substr(str, i));
1148                         next;
1149                 }
1150                 printf("-%s\n", c);
1151                 if (arg[c]) {
1152                         if (i < len)
1153                                 printf("'%s'\n", substr(str, i + 1));
1154                         else
1155                                 expect = 1;
1156                         next;
1157                 }
1158         }
1159 }
1160 END {
1161         if (expect)
1162                 print "?";
1163 }
1164 EOF
1165
1166 : process the command line options
1167 set X `for arg in "$@"; do echo "X$arg"; done |
1168         sed -e s/X// | awk -f options.awk`
1169 eval "set $*"
1170 shift
1171 rm -f options.awk
1172
1173 : set up default values
1174 fastread=''
1175 reuseval=false
1176 config_sh=''
1177 alldone=''
1178 error=''
1179 silent=''
1180 extractsh=''
1181 override=''
1182 knowitall=''
1183 rm -f optdef.sh posthint.sh
1184 cat >optdef.sh <<EOS
1185 $startsh
1186 EOS
1187
1188
1189 : option parsing
1190 while test $# -gt 0; do
1191         case "$1" in
1192         -d) shift; fastread=yes;;
1193         -e) shift; alldone=cont;;
1194         -f)
1195                 shift
1196                 cd ..
1197                 if test -r "$1"; then
1198                         config_sh="$1"
1199                 else
1200                         echo "$me: cannot read config file $1." >&2
1201                         error=true
1202                 fi
1203                 cd UU
1204                 shift;;
1205         -h) shift; error=true;;
1206         -r) shift; reuseval=true;;
1207         -s) shift; silent=true; realsilent=true;;
1208         -E) shift; alldone=exit;;
1209         -K) shift; knowitall=true;;
1210         -O) shift; override=true;;
1211         -S) shift; silent=true; extractsh=true;;
1212         -D)
1213                 shift
1214                 case "$1" in
1215                 *=)
1216                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1217                         echo "$me: ignoring -D $1" >&2
1218                         ;;
1219                 *=*) echo "$1" | \
1220                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1221                 *) echo "$1='define'" >> optdef.sh;;
1222                 esac
1223                 shift
1224                 ;;
1225         -U)
1226                 shift
1227                 case "$1" in
1228                 *=) echo "$1" >> optdef.sh;;
1229                 *=*)
1230                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1231                         echo "$me: ignoring -U $1" >&2
1232                         ;;
1233                 *) echo "$1='undef'" >> optdef.sh;;
1234                 esac
1235                 shift
1236                 ;;
1237         -A)
1238             shift
1239             xxx=''
1240             yyy="$1"
1241             zzz=''
1242             uuu=undef
1243             case "$yyy" in
1244             *=*) zzz=`echo $yyy|sed 's!=.*!!'`
1245                  case "$zzz" in
1246                  *:*) zzz='' ;;
1247                  *)   xxx=append
1248                       zzz=" "`echo $yyy|sed 's!^[^=]*=!!'` 
1249                       yyy=`echo $yyy|sed 's!=.*!!'` ;;
1250                  esac
1251                  ;;
1252             esac
1253             case "$xxx" in
1254             '')  case "$yyy" in
1255                  *:*) xxx=`echo $yyy|sed 's!:.*!!'`
1256                       yyy=`echo $yyy|sed 's!^[^:]*:!!'`
1257                       zzz=`echo $yyy|sed 's!^[^=]*=!!'`
1258                       yyy=`echo $yyy|sed 's!=.*!!'` ;;
1259                  *)   xxx=`echo $yyy|sed 's!:.*!!'`
1260                       yyy=`echo $yyy|sed 's!^[^:]*:!!'` ;;
1261                  esac
1262                  ;;       
1263             esac
1264             case "$xxx" in
1265             append)
1266                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1267             clear)
1268                 echo "$yyy=''"                  >> posthint.sh ;;
1269             define)
1270                 case "$zzz" in
1271                 '') zzz=define ;;
1272                 esac
1273                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1274             eval)
1275                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1276             prepend)
1277                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1278             undef)
1279                 case "$zzz" in
1280                 '') zzz="$uuu" ;;
1281                 esac
1282                 echo "$yyy=$zzz"                >> posthint.sh ;;
1283             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1284             esac
1285             ;;
1286         -V) echo "$me generated by metaconfig 3.0 PL70." >&2
1287             exit 0;;
1288         --) break;;
1289         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1290         *) break;;
1291         esac
1292 done
1293
1294 case "$error" in
1295 true)
1296         cat >&2 <<EOM
1297 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1298                  [-U symbol] [-U symbol=] [-A command:symbol...]
1299   -d : use defaults for all answers.
1300   -e : go on without questioning past the production of config.sh.
1301   -f : specify an alternate default configuration file.
1302   -h : print this help message and exit (with an error status).
1303   -r : reuse C symbols value if possible (skips costly nm extraction).
1304   -s : silent mode, only echoes questions and essential information.
1305   -D : define symbol to have some value:
1306          -D symbol         symbol gets the value 'define'
1307          -D symbol=value   symbol gets the value 'value'
1308   -E : stop at the end of questions, after having produced config.sh.
1309   -K : do not use unless you know what you are doing.
1310   -O : let -D and -U override definitions from loaded configuration file.
1311   -S : perform variable substitutions on all .SH files (can mix with -f)
1312   -U : undefine symbol:
1313          -U symbol    symbol gets the value 'undef'
1314          -U symbol=   symbol gets completely empty
1315   -A : manipulate symbol after the platform specific hints have been applied:
1316          -A symbol=value                append " "value to symbol
1317          -A append:symbol=value         append value to symbol
1318          -A define:symbol=value         define symbol to have value
1319          -A clear:symbol                define symbol to be ''
1320          -A define:symbol               define symbol to be 'define'
1321          -A eval:symbol=value           define symbol to be eval of value
1322          -A prepend:symbol=value        prepend value to symbol
1323          -A undef:symbol                define symbol to be 'undef'
1324          -A undef:symbol=               define symbol to be ''
1325   -V : print version number and exit (with a zero status).
1326 EOM
1327         exit 1
1328         ;;
1329 esac
1330
1331 : Sanity checks
1332 case "$fastread$alldone" in
1333 yescont|yesexit) ;;
1334 *)
1335         if test ! -t 0; then
1336                 echo "Say 'sh Configure', not 'sh <Configure'"
1337                 exit 1
1338         fi
1339         ;;
1340 esac
1341
1342 exec 4>&1
1343 case "$silent" in
1344 true) exec 1>/dev/null;;
1345 esac
1346
1347 : run the defines and the undefines, if any, but leave the file out there...
1348 touch optdef.sh
1349 . ./optdef.sh
1350 : create the posthint manipulation script and leave the file out there...
1351 touch posthint.sh
1352
1353 : set package name
1354 package=perl5
1355 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1356 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1357 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1358 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1359 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1360 esac
1361
1362 : Some greps do not return status, grrr.
1363 echo "grimblepritz" >grimble
1364 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1365         contains=contains
1366 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1367         contains=grep
1368 else
1369         contains=contains
1370 fi
1371 rm -f grimble
1372 : the following should work in any shell
1373 case "$contains" in
1374 contains*)
1375         echo " "
1376         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1377         cat >contains <<'EOSS'
1378 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1379 EOSS
1380 chmod +x contains
1381 esac
1382
1383 : Find the path to the source tree
1384 case "$src" in
1385 '') case "$0" in
1386     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1387          case "$src" in
1388          /*)    ;;
1389          *)     src=`cd ../$src && pwd` ;;
1390          esac
1391          ;;
1392     *)   src='.';;
1393     esac;;
1394 esac
1395 case "$src" in
1396 '')     src=/
1397         rsrc=/
1398         ;;
1399 /*) rsrc="$src";;
1400 *) rsrc="../$src";;
1401 esac
1402 if test -f $rsrc/Configure && \
1403         $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1404 then
1405    : found it, so we are ok.
1406 else
1407         rsrc=''
1408         for src in . .. ../.. ../../.. ../../../..; do
1409                 if test -f ../$src/Configure && \
1410                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1411                 then
1412                         rsrc=../$src
1413                         break
1414                 fi
1415         done
1416 fi
1417 case "$rsrc" in
1418 '')
1419         cat <<EOM >&4
1420
1421 Sorry, I can't seem to locate the source dir for $package.  Please start
1422 Configure with an explicit path -- i.e. /some/path/Configure.
1423
1424 EOM
1425         exit 1
1426         ;;
1427 ../.)   rsrc='..';;
1428 *)
1429         echo " "
1430         echo "Sources for $package found in \"$src\"." >&4
1431         ;;
1432 esac
1433
1434 : script used to extract .SH files with variable substitutions
1435 cat >extract <<'EOS'
1436 CONFIGDOTSH=true
1437 echo "Doing variable substitutions on .SH files..."
1438 if test -f $src/MANIFEST; then
1439         set x `awk '{print $1}' <$src/MANIFEST | grep '\.SH$'`
1440 else
1441         echo "(Looking for .SH files under the source directory.)"
1442         set x `(cd $src; find . -name "*.SH" -print)`
1443 fi
1444 shift
1445 case $# in
1446 0) set x `(cd $src; echo *.SH)`; shift;;
1447 esac
1448 if test ! -f $src/$1; then
1449         shift
1450 fi
1451 mkdir_p='
1452 name=$1;
1453 create="";
1454 while test $name; do
1455         if test ! -d "$name"; then
1456                 create="$name $create";
1457                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1458                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1459         else
1460                 name="";
1461         fi;
1462 done;
1463 for file in $create; do
1464         mkdir $file;
1465 done
1466 '
1467 for file in $*; do
1468         case "$src" in
1469         ".")
1470                 case "$file" in
1471                 */*)
1472                         dir=`expr X$file : 'X\(.*\)/'`
1473                         file=`expr X$file : 'X.*/\(.*\)'`
1474                         (cd $dir && . ./$file)
1475                         ;;
1476                 *)
1477                         . ./$file
1478                         ;;
1479                 esac
1480                 ;;
1481         *)
1482                 case "$file" in
1483                 */*)
1484                         dir=`expr X$file : 'X\(.*\)/'`
1485                         file=`expr X$file : 'X.*/\(.*\)'`
1486                         (set x $dir; shift; eval $mkdir_p)
1487                         sh <$src/$dir/$file
1488                         ;;
1489                 *)
1490                         sh <$src/$file
1491                         ;;
1492                 esac
1493                 ;;
1494         esac
1495 done
1496 if test -f $src/config_h.SH; then
1497         if test ! -f config.h; then
1498         : oops, they left it out of MANIFEST, probably, so do it anyway.
1499         . $src/config_h.SH
1500         fi
1501 fi
1502 EOS
1503
1504 : extract files and exit if asked to do so
1505 case "$extractsh" in
1506 true)
1507         case "$realsilent" in
1508         true) ;;
1509         *) exec 1>&4;;
1510         esac
1511         case "$config_sh" in
1512         '') config_sh='config.sh';;
1513         esac
1514         echo " "
1515         echo "Fetching answers from $config_sh..."
1516         cd ..
1517         . $config_sh
1518         test "$override" && . ./optdef.sh
1519         echo " "
1520         . UU/extract
1521         rm -rf UU
1522         echo "Done."
1523         exit 0
1524         ;;
1525 esac
1526
1527 : Eunice requires " " instead of "", can you believe it
1528 echo " "
1529 : Here we go...
1530 echo "Beginning of configuration questions for $package."
1531
1532 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1533
1534 : first determine how to suppress newline on echo command
1535 echo " "
1536 echo "Checking echo to see how to suppress newlines..."
1537 (echo "hi there\c" ; echo " ") >.echotmp
1538 if $contains c .echotmp >/dev/null 2>&1 ; then
1539         echo "...using -n."
1540         n='-n'
1541         c=''
1542 else
1543         cat <<'EOM'
1544 ...using \c
1545 EOM
1546         n=''
1547         c='\c'
1548 fi
1549 echo $n "The star should be here-->$c"
1550 echo '*'
1551 rm -f .echotmp
1552
1553 : Now test for existence of everything in MANIFEST
1554 echo " "
1555 if test -f $rsrc/MANIFEST; then
1556         echo "First let's make sure your kit is complete.  Checking..." >&4
1557         awk '$1 !~ /PACK[A-Z]+/ {print $1}' $rsrc/MANIFEST | split -50
1558         rm -f missing
1559         tmppwd=`pwd`
1560         for filelist in x??; do
1561                 (cd $rsrc; ls `cat $tmppwd/$filelist` >/dev/null 2>>$tmppwd/missing)
1562         done
1563         if test -s missing; then
1564                 cat missing >&4
1565                 cat >&4 <<'EOM'
1566
1567 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1568
1569 You have the option of continuing the configuration process, despite the
1570 distinct possibility that your kit is damaged, by typing 'y'es.  If you
1571 do, don't blame me if something goes wrong.  I advise you to type 'n'o
1572 and contact the author (perlbug@perl.com).
1573
1574 EOM
1575                 echo $n "Continue? [n] $c" >&4
1576                 read ans
1577                 case "$ans" in
1578                 y*)
1579                         echo "Continuing..." >&4
1580                         rm -f missing
1581                         ;;
1582                 *)
1583                         echo "ABORTING..." >&4
1584                         kill $$
1585                         ;;
1586                 esac
1587         else
1588                 echo "Looks good..."
1589         fi
1590 else
1591         echo "There is no MANIFEST file.  I hope your kit is complete !"
1592 fi
1593 rm -f missing x??
1594
1595 echo " "
1596 : Find the appropriate value for a newline for tr
1597 if test -n "$DJGPP"; then
1598        trnl='\012'
1599 fi
1600 if test X"$trnl" = X; then
1601         case "`echo foo|tr '\n' x 2>/dev/null`" in
1602         foox) trnl='\n' ;;
1603         esac
1604 fi
1605 if test X"$trnl" = X; then
1606         case "`echo foo|tr '\012' x 2>/dev/null`" in
1607         foox) trnl='\012' ;;
1608         esac
1609 fi
1610 if test X"$trnl" = X; then
1611         cat <<EOM >&2
1612
1613 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
1614
1615 EOM
1616         exit 1
1617 fi
1618
1619 : compute the number of columns on the terminal for proper question formatting
1620 case "$COLUMNS" in
1621 '') COLUMNS='80';;
1622 esac
1623
1624 : set up the echo used in my read
1625 myecho="case \"\$xxxm\" in
1626 '') echo $n \"\$rp $c\" >&4;;
1627 *) case \"\$rp\" in
1628         '') echo $n \"[\$xxxm] $c\";;
1629         *)
1630                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
1631                         echo \"\$rp\" >&4
1632                         echo $n \"[\$xxxm] $c\" >&4
1633                 else
1634                         echo $n \"\$rp [\$xxxm] $c\" >&4
1635                 fi
1636                 ;;
1637         esac;;
1638 esac"
1639
1640 : now set up to do reads with possible shell escape and default assignment
1641 cat <<EOSC >myread
1642 $startsh
1643 xxxm=\$dflt
1644 $myecho
1645 ans='!'
1646 case "\$fastread" in
1647 yes) case "\$dflt" in
1648         '') ;;
1649         *) ans='';
1650                 case "\$silent-\$rp" in
1651                 true-) ;;
1652                 *) echo " " >&4;;
1653                 esac;;
1654         esac;;
1655 *) case "\$silent" in
1656         true) case "\$rp" in
1657                 '') ans='';;
1658                 esac;;
1659         esac;;
1660 esac
1661 while expr "X\$ans" : "X!" >/dev/null; do
1662         read answ
1663         set x \$xxxm
1664         shift
1665         aok=''; eval "ans=\\"\$answ\\"" && aok=y
1666         case  "\$answ" in
1667         "!")
1668                 sh 1>&4
1669                 echo " "
1670                 $myecho
1671                 ;;
1672         !*)
1673                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
1674                 shift
1675                 sh 1>&4 -c "\$*"
1676                 echo " "
1677                 $myecho
1678                 ;;
1679         "\$ans")
1680                 case "\$ans" in
1681                 \\&*)
1682                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
1683                         shift
1684                         case "\$1" in
1685                         -d)
1686                                 fastread=yes
1687                                 echo "(OK, I'll run with -d after this question.)" >&4
1688                                 ;;
1689                         -*)
1690                                 echo "*** Sorry, \$1 not supported yet." >&4
1691                                 ;;
1692                         esac
1693                         $myecho
1694                         ans=!
1695                         ;;
1696                 esac;;
1697         *)
1698                 case "\$aok" in
1699                 y)
1700                         echo "*** Substitution done -- please confirm."
1701                         xxxm="\$ans"
1702                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
1703                         xxxm="\$ans"
1704                         ans=!
1705                         ;;
1706                 *)
1707                         echo "*** Error -- try again."
1708                         ans=!
1709                         ;;
1710                 esac
1711                 $myecho
1712                 ;;
1713         esac
1714         case "\$ans\$xxxm\$nostick" in
1715         '')
1716                 ans=!
1717                 $myecho
1718                 ;;
1719         esac
1720 done
1721 case "\$ans" in
1722 '') ans="\$xxxm";;
1723 esac
1724 EOSC
1725
1726 : create .config dir to save info across Configure sessions
1727 test -d ../.config || mkdir ../.config
1728 cat >../.config/README <<EOF
1729 This directory created by Configure to save information that should
1730 persist across sessions for $package.
1731
1732 You may safely delete it if you wish.
1733 EOF
1734
1735 : general instructions
1736 needman=true
1737 firsttime=true
1738 user=`(logname) 2>/dev/null`
1739 case "$user" in
1740 '') user=`whoami 2>&1`;;
1741 esac
1742 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
1743         firsttime=false
1744         echo " "
1745         rp='Would you like to see the instructions?'
1746         dflt=n
1747         . ./myread
1748         case "$ans" in
1749         [yY]*) ;;
1750         *) needman=false;;
1751         esac
1752 fi
1753 if $needman; then
1754         cat <<EOH
1755
1756 This installation shell script will examine your system and ask you questions
1757 to determine how the perl5 package should be installed. If you get
1758 stuck on a question, you may use a ! shell escape to start a subshell or
1759 execute a command.  Many of the questions will have default answers in square
1760 brackets; typing carriage return will give you the default.
1761
1762 On some of the questions which ask for file or directory names you are allowed
1763 to use the ~name construct to specify the login directory belonging to "name",
1764 even if you don't have a shell which knows about that.  Questions where this is
1765 allowed will be marked "(~name ok)".
1766
1767 EOH
1768         rp=''
1769         dflt='Type carriage return to continue'
1770         . ./myread
1771         cat <<'EOH'
1772
1773 The prompter used in this script allows you to use shell variables and
1774 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
1775 in the default answer, as if the default line was a set of arguments given to a
1776 script shell.  This means you may also use $* to repeat the whole default line,
1777 so you do not have to re-type everything to add something to the default.
1778
1779 Everytime there is a substitution, you will have to confirm.  If there is an
1780 error (e.g. an unmatched backtick), the default answer will remain unchanged
1781 and you will be prompted again.
1782
1783 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
1784 the questions and use the computed defaults (or the previous answers if there
1785 was already a config.sh file). Type 'Configure -h' for a list of options.
1786 You may also start interactively and then answer '& -d' at any prompt to turn
1787 on the non-interactive behaviour for the remainder of the execution.
1788
1789 EOH
1790         . ./myread
1791         cat <<EOH
1792
1793 Much effort has been expended to ensure that this shell script will run on any
1794 Unix system.  If despite that it blows up on yours, your best bet is to edit
1795 Configure and run it again.  If you can't run Configure for some reason,
1796 you'll have to generate a config.sh file by hand.  Whatever problems you
1797 have, let me (perlbug@perl.com) know how I blew it.
1798
1799 This installation script affects things in two ways:
1800
1801 1) it may do direct variable substitutions on some of the files included
1802    in this kit.
1803 2) it builds a config.h file for inclusion in C programs.  You may edit
1804    any of these files as the need arises after running this script.
1805
1806 If you make a mistake on a question, there is no easy way to back up to it
1807 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
1808 files.  Configure will offer to let you do this before it runs the SH files.
1809
1810 EOH
1811         dflt='Type carriage return to continue'
1812         . ./myread
1813         case "$firsttime" in
1814         true) echo $user >>../.config/instruct;;
1815         esac
1816 fi
1817
1818 : find out where common programs are
1819 echo " "
1820 echo "Locating common programs..." >&4
1821 cat <<EOSC >loc
1822 $startsh
1823 case \$# in
1824 0) exit 1;;
1825 esac
1826 thing=\$1
1827 shift
1828 dflt=\$1
1829 shift
1830 for dir in \$*; do
1831         case "\$thing" in
1832         .)
1833         if test -d \$dir/\$thing; then
1834                 echo \$dir
1835                 exit 0
1836         fi
1837         ;;
1838         *)
1839         for thisthing in \$dir/\$thing; do
1840                 : just loop through to pick last item
1841         done
1842         if test -f \$thisthing; then
1843                 echo \$thisthing
1844                 exit 0
1845         elif test -f \$dir/\$thing.exe; then
1846                 if test -n "$DJGPP"; then
1847                         echo \$dir/\$thing.exe
1848                 else
1849                         : on Eunice apparently
1850                         echo \$dir/\$thing
1851                 fi
1852                 exit 0
1853         fi
1854         ;;
1855         esac
1856 done
1857 echo \$dflt
1858 exit 1
1859 EOSC
1860 chmod +x loc
1861 $eunicefix loc
1862 loclist="
1863 awk
1864 cat
1865 comm
1866 cp
1867 echo
1868 expr
1869 grep
1870 ls
1871 make
1872 mkdir
1873 rm
1874 sed
1875 sort
1876 touch
1877 tr
1878 uniq
1879 "
1880 trylist="
1881 Mcc
1882 ar
1883 byacc
1884 cpp
1885 csh
1886 date
1887 egrep
1888 gzip
1889 less
1890 ln
1891 more
1892 nm
1893 nroff
1894 pg
1895 test
1896 uname
1897 zip
1898 "
1899 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1900 pth="$pth /lib /usr/lib"
1901 for file in $loclist; do
1902         eval xxx=\$$file
1903         case "$xxx" in
1904         /*|?:[\\/]*)
1905                 if test -f "$xxx"; then
1906                         : ok
1907                 else
1908                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
1909                         xxx=`./loc $file $file $pth`
1910                 fi
1911                 ;;
1912         '') xxx=`./loc $file $file $pth`;;
1913         *) xxx=`./loc $xxx $xxx $pth`;;
1914         esac
1915         eval $file=$xxx
1916         eval _$file=$xxx
1917         case "$xxx" in
1918         /*)
1919                 echo $file is in $xxx.
1920                 ;;
1921         ?:[\\/]*)
1922                 echo $file is in $xxx.
1923                 ;;
1924         *)
1925                 echo "I don't know where '$file' is, and my life depends on it." >&4
1926                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
1927                 exit 1
1928                 ;;
1929         esac
1930 done
1931 echo " "
1932 echo "Don't worry if any of the following aren't found..."
1933 say=offhand
1934 for file in $trylist; do
1935         eval xxx=\$$file
1936         case "$xxx" in
1937         /*|?:[\\/]*)
1938                 if test -f "$xxx"; then
1939                         : ok
1940                 else
1941                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
1942                         xxx=`./loc $file $file $pth`
1943                 fi
1944                 ;;
1945         '') xxx=`./loc $file $file $pth`;;
1946         *) xxx=`./loc $xxx $xxx $pth`;;
1947         esac
1948         eval $file=$xxx
1949         eval _$file=$xxx
1950         case "$xxx" in
1951         /*)
1952                 echo $file is in $xxx.
1953                 ;;
1954         ?:[\\/]*)
1955                 echo $file is in $xxx.
1956                 ;;
1957         *)
1958                 echo "I don't see $file out there, $say."
1959                 say=either
1960                 ;;
1961         esac
1962 done
1963 case "$egrep" in
1964 egrep)
1965         echo "Substituting grep for egrep."
1966         egrep=$grep
1967         ;;
1968 esac
1969 case "$ln" in
1970 ln)
1971         echo "Substituting cp for ln."
1972         ln=$cp
1973         ;;
1974 esac
1975 case "$test" in
1976 test)
1977         echo "Hopefully test is built into your sh."
1978         ;;
1979 *)
1980         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
1981                 echo "Using the test built into your sh."
1982                 test=test
1983                 _test=test
1984         fi
1985         ;;
1986 esac
1987 case "$echo" in
1988 echo)
1989         echo "Hopefully echo is built into your sh."
1990         ;;
1991 '') ;;
1992 *)
1993         echo " "
1994 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
1995         $echo $n "hi there$c" >foo1
1996         echo $n "hi there$c" >foo2
1997         if cmp foo1 foo2 >/dev/null 2>&1; then
1998                 echo "They are compatible.  In fact, they may be identical."
1999         else
2000                 case "$n" in
2001                 '-n') n='' c='\c';;
2002                 *) n='-n' c='';;
2003                 esac
2004                 cat <<FOO
2005 They are not compatible!  You are probably running ksh on a non-USG system.
2006 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2007 have echo built in and we may have to run some Bourne shell scripts.  That
2008 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2009
2010 FOO
2011                 $echo $n "The star should be here-->$c"
2012                 $echo "*"
2013         fi
2014         $rm -f foo1 foo2
2015         ;;
2016 esac
2017
2018 : determine whether symbolic links are supported
2019 echo " "
2020 $touch blurfl
2021 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2022         echo "Symbolic links are supported." >&4
2023         lns="$ln -s"
2024 else
2025         echo "Symbolic links are NOT supported." >&4
2026         lns="$ln"
2027 fi
2028 $rm -f blurfl sym
2029
2030 : see whether [:lower:] and [:upper:] are supported character classes
2031 echo " "
2032 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2033 ABYZ)
2034         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2035         up='[:upper:]'
2036         low='[:lower:]'
2037         ;;
2038 *)      # There is a discontinuity in EBCDIC between 'I' and 'J'
2039         # (0xc9 and 0xd1), therefore that is a nice testing point.
2040         if test "X$up" = X -o "X$low" = X; then
2041             case "`echo IJ | $tr '[I-J]' '[i-j]' 2>/dev/null`" in
2042             ij) up='[A-Z]'
2043                 low='[a-z]'
2044                 ;;
2045             esac
2046         fi
2047         if test "X$up" = X -o "X$low" = X; then
2048             case "`echo IJ | $tr I-J i-j 2>/dev/null`" in
2049             ij) up='A-Z'
2050                 low='a-z'
2051                 ;;
2052             esac
2053         fi
2054         if test "X$up" = X -o "X$low" = X; then
2055             case "`echo IJ | od -x 2>/dev/null`" in
2056             *C9D1*|*c9d1*)
2057                 echo "Hey, this might be EBCDIC." >&4
2058                 if test "X$up" = X -o "X$low" = X; then
2059                     case "`echo IJ | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
2060                     ij) up='[A-IJ-RS-Z]'
2061                         low='[a-ij-rs-z]'
2062                         ;;
2063                     esac
2064                 fi
2065                 if test "X$up" = X -o "X$low" = X; then
2066                     case "`echo IJ | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
2067                     ij) up='A-IJ-RS-Z'
2068                         low='a-ij-rs-z'
2069                         ;;
2070                     esac
2071                 fi
2072                 ;;
2073             esac
2074         fi
2075 esac
2076 case "`echo IJ | $tr \"$up\" \"$low\" 2>/dev/null`" in
2077 ij)
2078     echo "Using $up and $low to convert case." >&4
2079     ;;
2080 *)
2081     echo "I don't know how to translate letters from upper to lower case." >&4
2082     echo "Your tr is not acting any way I know of." >&4
2083     exit 1
2084     ;;
2085 esac
2086 : set up the translation script tr, must be called with ./tr of course
2087 cat >tr <<EOSC
2088 $startsh
2089 case "\$1\$2" in
2090 '[A-Z][a-z]') exec $tr '$up' '$low';;
2091 '[a-z][A-Z]') exec $tr '$low' '$up';;
2092 esac
2093 exec $tr "\$@"
2094 EOSC
2095 chmod +x tr
2096 $eunicefix tr
2097
2098 : Try to determine whether config.sh was made on this system
2099 case "$config_sh" in
2100 '')
2101 myuname=`( ($uname -a) 2>/dev/null || hostname) 2>&1`
2102 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
2103 # because the A-Z/a-z are not consecutive.
2104 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
2105         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
2106 newmyuname="$myuname"
2107 dflt=n
2108 case "$knowitall" in
2109 '')
2110         if test -f ../config.sh; then
2111                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
2112                         eval "`grep myuname= ../config.sh`"
2113                 fi
2114                 if test "X$myuname" = "X$newmyuname"; then
2115                         dflt=y
2116                 fi
2117         fi
2118         ;;
2119 *) dflt=y;;
2120 esac
2121
2122 : Get old answers from old config file if Configure was run on the
2123 : same system, otherwise use the hints.
2124 hint=default
2125 cd ..
2126 if test -f config.sh; then
2127         echo " "
2128         rp="I see a config.sh file.  Shall I use it to set the defaults?"
2129         . UU/myread
2130         case "$ans" in
2131         n*|N*) echo "OK, I'll ignore it."; mv config.sh config.sh.old;;
2132         *)  echo "Fetching default answers from your old config.sh file..." >&4
2133                 tmp_n="$n"
2134                 tmp_c="$c"
2135                 tmp_sh="$sh"
2136                 . ./config.sh
2137                 cp config.sh UU
2138                 n="$tmp_n"
2139                 c="$tmp_c"
2140                 : Older versions did not always set $sh.  Catch re-use of such
2141                 : an old config.sh.
2142                 case "$sh" in
2143                 '') sh="$tmp_sh" ;;
2144                 esac
2145                 hint=previous
2146                 ;;
2147         esac
2148 fi
2149 if test ! -f config.sh; then
2150         $cat <<EOM
2151
2152 First time through, eh?  I have some defaults handy for some systems
2153 that need some extra help getting the Configure answers right:
2154
2155 EOM
2156         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
2157         dflt=''
2158         : Half the following guesses are probably wrong... If you have better
2159         : tests or hints, please send them to perlbug@perl.com
2160         : The metaconfig authors would also appreciate a copy...
2161         $test -f /irix && osname=irix
2162         $test -f /xenix && osname=sco_xenix
2163         $test -f /dynix && osname=dynix
2164         $test -f /dnix && osname=dnix
2165         $test -f /lynx.os && osname=lynxos
2166         $test -f /unicos && osname=unicos && osvers=`$uname -r`
2167         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
2168         $test -f /bin/mips && /bin/mips && osname=mips
2169         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
2170                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
2171         $test -d /usr/apollo/bin && osname=apollo
2172         $test -f /etc/saf/_sactab && osname=svr4
2173         $test -d /usr/include/minix && osname=minix
2174         if $test -d /MachTen -o -d /MachTen_Folder; then
2175                 osname=machten
2176                 if $test -x /sbin/version; then
2177                         osvers=`/sbin/version | $awk '{print $2}' |
2178                         $sed -e 's/[A-Za-z]$//'`
2179                 elif $test -x /usr/etc/version; then
2180                         osvers=`/usr/etc/version | $awk '{print $2}' |
2181                         $sed -e 's/[A-Za-z]$//'`
2182                 else
2183                         osvers="$2.$3"
2184                 fi
2185         fi
2186        $test -f /sys/posix.dll &&
2187                $test -f /usr/bin/what &&
2188                set X `/usr/bin/what /sys/posix.dll` &&
2189                $test "$3" = UWIN &&
2190                osname=uwin &&
2191                osvers="$5"
2192         if $test -f $uname; then
2193                 set X $myuname
2194                 shift
2195
2196                 case "$5" in
2197                 fps*) osname=fps ;;
2198                 mips*)
2199                         case "$4" in
2200                         umips) osname=umips ;;
2201                         *) osname=mips ;;
2202                         esac;;
2203                 [23]100) osname=mips ;;
2204                 next*) osname=next ;;
2205                 i386*)
2206                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
2207                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
2208                                 osname='sco'
2209                                 osvers=$tmp
2210                         elif $test -f /etc/kconfig; then
2211                                 osname=isc
2212                                 if test "$lns" = "$ln -s"; then
2213                                         osvers=4
2214                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
2215                                         osvers=3
2216                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
2217                                         osvers=2
2218                                 fi
2219                         fi
2220                         tmp=''
2221                         ;;
2222                 pc*)
2223                         if test -n "$DJGPP"; then
2224                                 osname=dos
2225                                 osvers=djgpp
2226                         fi
2227                         ;;
2228                 esac
2229
2230                 case "$1" in
2231                 aix) osname=aix
2232                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
2233                         case "$tmp" in
2234                         'not found') osvers="$4"."$3" ;;
2235                         '<3240'|'<>3240') osvers=3.2.0 ;;
2236                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
2237                         '=3250'|'>3250') osvers=3.2.5 ;;
2238                         *) osvers=$tmp;;
2239                         esac
2240                         ;;
2241                 *dc.osx) osname=dcosx
2242                         osvers="$3"
2243                         ;;
2244                 dnix) osname=dnix
2245                         osvers="$3"
2246                         ;;
2247                 domainos) osname=apollo
2248                         osvers="$3"
2249                         ;;
2250                 dgux) osname=dgux 
2251                         osvers="$3"
2252                         ;;
2253                 dynixptx*) osname=dynixptx
2254                         osvers=`echo "$4"|sed 's/^v//'`
2255                         ;;
2256                 freebsd) osname=freebsd 
2257                         osvers="$3" ;;
2258                 genix) osname=genix ;;
2259                 hp*) osname=hpux 
2260                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
2261                         ;;
2262                 irix*) osname=irix
2263                         case "$3" in
2264                         4*) osvers=4 ;;
2265                         5*) osvers=5 ;;
2266                         *)      osvers="$3" ;;
2267                         esac
2268                         ;;
2269                 linux) osname=linux
2270                         case "$3" in
2271                         *)      osvers="$3" ;;
2272                         esac
2273                         ;;
2274                 MiNT) osname=mint
2275                         ;;
2276                 netbsd*) osname=netbsd
2277                         osvers="$3"
2278                         ;;
2279                 news-os) osvers="$3"
2280                         case "$3" in
2281                         4*) osname=newsos4 ;;
2282                         *) osname=newsos ;;
2283                         esac
2284                         ;;
2285                 bsd386) osname=bsd386
2286                         osvers=`$uname -r`
2287                         ;;
2288                 POSIX-BC | posix-bc ) osname=posix-bc
2289                         osvers="$3"
2290                         ;;
2291                 powerux | power_ux | powermax_os | powermaxos | \
2292                 powerunix | power_unix) osname=powerux
2293                         osvers="$3"
2294                         ;;
2295                 next*) osname=next ;;
2296                 solaris) osname=solaris
2297                         case "$3" in
2298                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
2299                         *)      osvers="$3" ;;
2300                         esac
2301                         ;;
2302                 sunos) osname=sunos
2303                         case "$3" in
2304                         5*) osname=solaris
2305                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
2306                         *)      osvers="$3" ;;
2307                         esac
2308                         ;;
2309                 titanos) osname=titanos
2310                         case "$3" in
2311                         1*) osvers=1 ;;
2312                         2*) osvers=2 ;;
2313                         3*) osvers=3 ;;
2314                         4*) osvers=4 ;;
2315                         *)      osvers="$3" ;;
2316                         esac
2317                         ;;
2318                 ultrix) osname=ultrix
2319                         osvers="$3"
2320                         ;;
2321                 osf1|mls+)      case "$5" in
2322                                 alpha)
2323                                         osname=dec_osf
2324                                         osvers=`echo "$3" | sed 's/^[xvt]//'`
2325                                         ;;
2326                         hp*)    osname=hp_osf1  ;;
2327                         mips)   osname=mips_osf1 ;;
2328                         esac
2329                         ;;
2330                 unixware) osname=svr5
2331                         osvers="$4"
2332                         ;;
2333                 uts) osname=uts
2334                         osvers="$3"
2335                         ;;
2336                 qnx) osname=qnx
2337                         osvers="$4"
2338                         ;;
2339                 $2) case "$osname" in
2340                         *isc*) ;;
2341                         *freebsd*) ;;
2342                         svr*)
2343                                 : svr4.x or possibly later
2344                                 case "svr$3" in 
2345                                 ${osname}*)
2346                                         osname=svr$3
2347                                         osvers=$4
2348                                         ;;
2349                                 esac
2350                                 case "$osname" in
2351                                 svr4.0)
2352                                         : Check for ESIX
2353                                         if test -f /stand/boot ; then
2354                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
2355                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
2356                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
2357                                                         if test -n "$isesix"; then
2358                                                                 osname=esix4
2359                                                         fi
2360                                                 fi
2361                                         fi
2362                                         ;;
2363                                 esac
2364                                 ;;
2365                         *)      if test -f /etc/systemid; then
2366                                         osname=sco
2367                                         set `echo $3 | $sed 's/\./ /g'` $4
2368                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
2369                                                 osvers=$1.$2.$3
2370                                         elif $test -f $src/hints/sco_$1_$2.sh; then
2371                                                 osvers=$1.$2
2372                                         elif $test -f $src/hints/sco_$1.sh; then
2373                                                 osvers=$1
2374                                         fi
2375                                 else
2376                                         case "$osname" in
2377                                         '') : Still unknown.  Probably a generic Sys V.
2378                                                 osname="sysv"
2379                                                 osvers="$3"
2380                                                 ;;
2381                                         esac
2382                                 fi
2383                                 ;;
2384                         esac
2385                         ;;
2386                 *)      case "$osname" in
2387                         '') : Still unknown.  Probably a generic BSD.
2388                                 osname="$1"
2389                                 osvers="$3"
2390                                 ;;
2391                         esac
2392                         ;;
2393                 esac
2394         else
2395                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
2396                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
2397                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
2398                                 osname=news_os
2399                         fi
2400                         $rm -f UU/kernel.what
2401                 elif test -d c:/.; then
2402                         set X $myuname
2403                         osname=os2
2404                         osvers="$5"
2405                 fi
2406         fi
2407         
2408         : Now look for a hint file osname_osvers, unless one has been
2409         : specified already.
2410         case "$hintfile" in
2411         ''|' ')
2412                 file=`echo "${osname}_${osvers}" | $sed -e 's@\.@_@g' -e 's@_$@@'`
2413                 : Also try without trailing minor version numbers.
2414                 xfile=`echo $file | $sed -e 's@_[^_]*$@@'`
2415                 xxfile=`echo $xfile | $sed -e 's@_[^_]*$@@'`
2416                 xxxfile=`echo $xxfile | $sed -e 's@_[^_]*$@@'`
2417                 xxxxfile=`echo $xxxfile | $sed -e 's@_[^_]*$@@'`
2418                 case "$file" in
2419                 '') dflt=none ;;
2420                 *)  case "$osvers" in
2421                         '') dflt=$file
2422                                 ;;
2423                         *)  if $test -f $src/hints/$file.sh ; then
2424                                         dflt=$file
2425                                 elif $test -f $src/hints/$xfile.sh ; then
2426                                         dflt=$xfile
2427                                 elif $test -f $src/hints/$xxfile.sh ; then
2428                                         dflt=$xxfile
2429                                 elif $test -f $src/hints/$xxxfile.sh ; then
2430                                         dflt=$xxxfile
2431                                 elif $test -f $src/hints/$xxxxfile.sh ; then
2432                                         dflt=$xxxxfile
2433                                 elif $test -f "$src/hints/${osname}.sh" ; then
2434                                         dflt="${osname}"
2435                                 else
2436                                         dflt=none
2437                                 fi
2438                                 ;;
2439                         esac
2440                         ;;
2441                 esac
2442                 if $test -f Policy.sh ; then
2443                         case "$dflt" in
2444                         *Policy*) ;;
2445                         none) dflt="Policy" ;;
2446                         *) dflt="Policy $dflt" ;;
2447                         esac
2448                 fi
2449                 ;;
2450         *)
2451                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
2452                 ;;
2453         esac
2454
2455         if $test -f Policy.sh ; then
2456                 $cat <<EOM
2457
2458 There's also a Policy hint file available, which should make the
2459 site-specific (policy) questions easier to answer.
2460 EOM
2461
2462         fi
2463
2464         $cat <<EOM
2465
2466 You may give one or more space-separated answers, or "none" if appropriate.
2467 A well-behaved OS will have no hints, so answering "none" or just "Policy"
2468 is a good thing.  DO NOT give a wrong version or a wrong OS.
2469
2470 EOM
2471
2472         rp="Which of these apply, if any?"
2473         . UU/myread
2474         tans=$ans
2475         for file in $tans; do
2476                 if $test X$file = XPolicy -a -f Policy.sh; then
2477                         . Policy.sh
2478                         $cat Policy.sh >> UU/config.sh
2479                 elif $test -f $src/hints/$file.sh; then
2480                         . $src/hints/$file.sh
2481                         $cat $src/hints/$file.sh >> UU/config.sh
2482                 elif $test X$tans = X -o X$tans = Xnone ; then
2483                         : nothing
2484                 else
2485                         : Give one chance to correct a possible typo.
2486                         echo "$file.sh does not exist"
2487                         dflt=$file
2488                         rp="hint to use instead?"
2489                         . UU/myread
2490                         for file in $ans; do
2491                                 if $test -f "$src/hints/$file.sh"; then
2492                                         . $src/hints/$file.sh
2493                                         $cat $src/hints/$file.sh >> UU/config.sh
2494                                 elif $test X$ans = X -o X$ans = Xnone ; then
2495                                         : nothing
2496                                 else
2497                                         echo "$file.sh does not exist -- ignored."
2498                                 fi
2499                         done
2500                 fi
2501         done
2502
2503         hint=recommended
2504         : Remember our hint file for later.
2505         if $test -f "$src/hints/$file.sh" ; then
2506                 hintfile="$file"
2507         else
2508                 hintfile=''
2509         fi
2510 fi
2511 cd UU
2512 ;;
2513 *)
2514         echo " "
2515         echo "Fetching default answers from $config_sh..." >&4
2516         tmp_n="$n"
2517         tmp_c="$c"
2518         cd ..
2519         cp $config_sh config.sh 2>/dev/null
2520         chmod +w config.sh
2521         . ./config.sh
2522         cd UU
2523         cp ../config.sh .
2524         n="$tmp_n"
2525         c="$tmp_c"
2526         hint=previous
2527         ;;
2528 esac
2529 test "$override" && . ./optdef.sh
2530 myuname="$newmyuname"
2531
2532 : Restore computed paths
2533 for file in $loclist $trylist; do
2534         eval $file="\$_$file"
2535 done
2536
2537 cat << EOM
2538
2539 Configure uses the operating system name and version to set some defaults.
2540 The default value is probably right if the name rings a bell. Otherwise,
2541 since spelling matters for me, either accept the default or answer "none"
2542 to leave it blank.
2543
2544 EOM
2545 case "$osname" in
2546         ''|' ')
2547                 case "$hintfile" in
2548                 ''|' '|none) dflt=none ;;
2549                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
2550                 esac
2551                 ;;
2552         *) dflt="$osname" ;;
2553 esac
2554 rp="Operating system name?"
2555 . ./myread
2556 case "$ans" in
2557 none)  osname='' ;;
2558 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
2559 esac
2560 echo " "
2561 case "$osvers" in
2562         ''|' ')
2563                 case "$hintfile" in
2564                 ''|' '|none) dflt=none ;;
2565                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
2566                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
2567                         case "$dflt" in
2568                         ''|' ') dflt=none ;;
2569                         esac
2570                         ;;
2571                 esac
2572                 ;;
2573         *) dflt="$osvers" ;;
2574 esac
2575 rp="Operating system version?"
2576 . ./myread
2577 case "$ans" in
2578 none)  osvers='' ;;
2579 *) osvers="$ans" ;;
2580 esac
2581
2582
2583 . ./posthint.sh
2584
2585 : who configured the system
2586 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
2587 cf_by=`(logname) 2>/dev/null`
2588 case "$cf_by" in
2589 "")
2590         cf_by=`(whoami) 2>/dev/null`
2591         case "$cf_by" in
2592         "") cf_by=unknown ;;
2593         esac ;;
2594 esac
2595
2596 : set up the script used to warn in case of inconsistency
2597 cat <<EOS >whoa
2598 $startsh
2599 EOS
2600 cat <<'EOSC' >>whoa
2601 dflt=y
2602 echo " "
2603 echo "*** WHOA THERE!!! ***" >&4
2604 echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
2605 rp="    Keep the $hint value?"
2606 . ./myread
2607 case "$ans" in
2608 y) td=$was; tu=$was;;
2609 esac
2610 EOSC
2611
2612 : function used to set $1 to $val
2613 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
2614 case "$val$was" in
2615 $define$undef) . ./whoa; eval "$var=\$td";;
2616 $undef$define) . ./whoa; eval "$var=\$tu";;
2617 *) eval "$var=$val";;
2618 esac'
2619
2620 cat <<EOM
2621
2622 Perl can be built to take advantage of threads, on some systems.
2623 To do so, Configure must be run with -Dusethreads.
2624
2625 Note that threading is a highly experimental feature, and
2626 some known race conditions still remain.  If you choose to try
2627 it, be very sure to not actually deploy it for production
2628 purposes.  README.threads has more details, and is required
2629 reading if you enable threads.
2630 EOM
2631 case "$usethreads" in
2632 $define|true|[yY]*)     dflt='y';;
2633 *) dflt='n';;
2634 esac
2635 rp='Build a threading Perl?'
2636 . ./myread
2637 case "$ans" in
2638 y|Y)    val="$define" ;;     
2639 *)      val="$undef" ;;
2640 esac
2641 set usethreads
2642 eval $setvar 
2643
2644 case "$d_oldpthreads" in
2645 '')     : Configure tests would be welcome here.  For now, assume undef.
2646         val="$undef" ;;
2647 *)      val="$d_oldpthreads" ;;
2648 esac
2649 set d_oldpthreads
2650 eval $setvar
2651
2652
2653 case "$usethreads" in
2654 "$define"|true|[yY]*)
2655 : Look for a hint-file generated 'call-back-unit'.  If the
2656 : user has specified that a threading perl is to be built,
2657 : we may need to set or change some other defaults.
2658         if $test -f usethreads.cbu; then
2659                 echo "Your platform has some specific hints for threaded builds, using them..."
2660                 . ./usethreads.cbu
2661         else
2662                 $cat <<EOM
2663 (Your platform doesn't have any specific hints for threaded builds.
2664  Assuming POSIX threads, then.)
2665 EOM
2666         fi
2667     ;;
2668 esac
2669
2670 cat <<EOM
2671
2672 Perl can be built so that multiple Perl interpreters can coexist
2673 within the same Perl executable.  To do so, Configure must be run with
2674 -Dusemultiplicity.
2675
2676 Normally you do not need this and you should answer no.
2677
2678 EOM
2679 case "$usemultiplicity" in
2680 $define|true|[yY]*)     dflt='y';;
2681 *) dflt='n';;
2682 esac
2683 rp='Build Perl for multiplicity?'
2684 . ./myread
2685 case "$ans" in
2686 y|Y)    val="$define" ;;     
2687 *)      val="$undef" ;;
2688 esac
2689 set usemultiplicity
2690 eval $setvar 
2691
2692 : determine where manual pages are on this system
2693 echo " "
2694 case "$sysman" in
2695 '') 
2696         syspath='/usr/man/man1 /usr/man/mann /usr/man/manl /usr/man/local/man1'
2697         syspath="$syspath /usr/man/u_man/man1 /usr/share/man/man1"
2698         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
2699         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
2700         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
2701         sysman=`./loc . /usr/man/man1 $syspath`
2702         ;;
2703 esac
2704 if $test -d "$sysman"; then
2705         echo "System manual is in $sysman." >&4
2706 else
2707         echo "Could not find manual pages in source form." >&4
2708 fi
2709
2710 : see what memory models we can support
2711 case "$models" in
2712 '')
2713         $cat >pdp11.c <<'EOP'
2714 int main() {
2715 #ifdef pdp11
2716         exit(0);
2717 #else
2718         exit(1);
2719 #endif
2720 }
2721 EOP
2722         ( cc -o pdp11 pdp11.c ) >/dev/null 2>&1
2723         if $test -f pdp11 && ./pdp11 2>/dev/null; then
2724                 dflt='unsplit split'
2725         else
2726                 tans=`./loc . X /lib/small /lib/large /usr/lib/small /usr/lib/large /lib/medium /usr/lib/medium /lib/huge`
2727                 case "$tans" in
2728                 X) dflt='none';;
2729                 *) if $test -d /lib/small || $test -d /usr/lib/small; then
2730                                 dflt='small'
2731                         else
2732                                 dflt=''
2733                         fi
2734                         if $test -d /lib/medium || $test -d /usr/lib/medium; then
2735                                 dflt="$dflt medium"
2736                         fi
2737                         if $test -d /lib/large || $test -d /usr/lib/large; then
2738                                 dflt="$dflt large"
2739                         fi
2740                         if $test -d /lib/huge || $test -d /usr/lib/huge; then
2741                                 dflt="$dflt huge"
2742                         fi
2743                 esac
2744         fi;;
2745 *) dflt="$models";;
2746 esac
2747 $cat <<EOM
2748  
2749 Some systems have different model sizes.  On most systems they are called
2750 small, medium, large, and huge.  On the PDP11 they are called unsplit and
2751 split.  If your system doesn't support different memory models, say "none".
2752 If you wish to force everything to one memory model, say "none" here and
2753 put the appropriate flags later when it asks you for other cc and ld flags.
2754 Venix systems may wish to put "none" and let the compiler figure things out.
2755 (In the following question multiple model names should be space separated.)
2756
2757 The default for most systems is "none".
2758
2759 EOM
2760 rp="Which memory models are supported?"
2761 . ./myread
2762 models="$ans"
2763
2764 case "$models" in
2765 none)
2766         small=''
2767         medium=''
2768         large=''
2769         huge=''
2770         unsplit=''
2771         split=''
2772         ;;
2773 *split)
2774         case "$split" in
2775         '') if $contains '\-i' $sysman/ld.1 >/dev/null 2>&1 || \
2776                          $contains '\-i' $sysman/cc.1 >/dev/null 2>&1; then
2777                         dflt='-i'
2778                 else
2779                         dflt='none'
2780                 fi;;
2781         *) dflt="$split";;
2782         esac
2783         rp="What flag indicates separate I and D space?"
2784         . ./myread
2785         tans="$ans"
2786         case "$tans" in
2787         none) tans='';;
2788         esac
2789         split="$tans"
2790         unsplit='';;
2791 *large*|*small*|*medium*|*huge*)
2792         case "$models" in
2793         *large*)
2794                 case "$large" in
2795                 '') dflt='-Ml';;
2796                 *) dflt="$large";;
2797                 esac
2798         rp="What flag indicates large model?"
2799         . ./myread
2800         tans="$ans"
2801         case "$tans" in
2802         none) tans='';
2803         esac
2804         large="$tans";;
2805         *) large='';;
2806         esac
2807         case "$models" in
2808         *huge*) case "$huge" in
2809                 '') dflt='-Mh';;
2810                 *) dflt="$huge";;
2811                 esac
2812                 rp="What flag indicates huge model?"
2813                 . ./myread
2814                 tans="$ans"
2815                 case "$tans" in
2816                 none) tans='';
2817                 esac
2818                 huge="$tans";;
2819         *) huge="$large";;
2820         esac
2821         case "$models" in
2822         *medium*) case "$medium" in
2823                 '') dflt='-Mm';;
2824                 *) dflt="$medium";;
2825                 esac
2826                 rp="What flag indicates medium model?"
2827                 . ./myread
2828                 tans="$ans"
2829                 case "$tans" in
2830                 none) tans='';
2831                 esac
2832                 medium="$tans";;
2833         *) medium="$large";;
2834         esac
2835         case "$models" in
2836         *small*) case "$small" in
2837                 '') dflt='none';;
2838                 *) dflt="$small";;
2839                 esac
2840                 rp="What flag indicates small model?"
2841                 . ./myread
2842                 tans="$ans"
2843                 case "$tans" in
2844                 none) tans='';
2845                 esac
2846                 small="$tans";;
2847         *) small='';;
2848         esac
2849         ;;
2850 *)
2851         echo "Unrecognized memory models--you may have to edit Makefile.SH" >&4
2852         ;;
2853 esac
2854 $rm -f pdp11.* pdp11
2855
2856 : make some quick guesses about what we are up against
2857 echo " "
2858 $echo $n "Hmm...  $c"
2859 echo exit 1 >bsd
2860 echo exit 1 >usg
2861 echo exit 1 >v7
2862 echo exit 1 >osf1
2863 echo exit 1 >eunice
2864 echo exit 1 >xenix
2865 echo exit 1 >venix
2866 echo exit 1 >os2
2867 d_bsd="$undef"
2868 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
2869 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
2870 then
2871         echo "Looks kind of like an OSF/1 system, but we'll see..."
2872         echo exit 0 >osf1
2873 elif test `echo abc | tr a-z A-Z` = Abc ; then
2874         xxx=`./loc addbib blurfl $pth`
2875         if $test -f $xxx; then
2876         echo "Looks kind of like a USG system with BSD features, but we'll see..."
2877                 echo exit 0 >bsd
2878                 echo exit 0 >usg
2879         else
2880                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
2881                         echo "Looks kind of like an extended USG system, but we'll see..."
2882                 else
2883                         echo "Looks kind of like a USG system, but we'll see..."
2884                 fi
2885                 echo exit 0 >usg
2886         fi
2887 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
2888         echo "Looks kind of like a BSD system, but we'll see..."
2889         d_bsd="$define"
2890         echo exit 0 >bsd
2891 else
2892         echo "Looks kind of like a Version 7 system, but we'll see..."
2893         echo exit 0 >v7
2894 fi
2895 case "$eunicefix" in
2896 *unixtovms*)
2897         $cat <<'EOI'
2898 There is, however, a strange, musty smell in the air that reminds me of
2899 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
2900 EOI
2901         echo exit 0 >eunice
2902         d_eunice="$define"
2903 : it so happens the Eunice I know will not run shell scripts in Unix format
2904         ;;
2905 *)
2906         echo " "
2907         echo "Congratulations.  You aren't running Eunice."
2908         d_eunice="$undef"
2909         ;;
2910 esac
2911 : Detect OS2.  The p_ variable is set above in the Head.U unit.
2912 case "$p_" in
2913 :) ;;
2914 *)
2915         $cat <<'EOI'
2916 I have the feeling something is not exactly right, however...don't tell me...
2917 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
2918 EOI
2919         echo exit 0 >os2
2920         ;;
2921 esac
2922 if test -f /xenix; then
2923         echo "Actually, this looks more like a XENIX system..."
2924         echo exit 0 >xenix
2925         d_xenix="$define"
2926 else
2927         echo " "
2928         echo "It's not Xenix..."
2929         d_xenix="$undef"
2930 fi
2931 chmod +x xenix
2932 $eunicefix xenix
2933 if test -f /venix; then
2934         echo "Actually, this looks more like a VENIX system..."
2935         echo exit 0 >venix
2936 else
2937         echo " "
2938         if ./xenix; then
2939                 : null
2940         else
2941                 echo "Nor is it Venix..."
2942         fi
2943 fi
2944 chmod +x bsd usg v7 osf1 eunice xenix venix os2
2945 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
2946 $rm -f foo
2947
2948 : see if we need a special compiler
2949 echo " "
2950 if ./usg; then
2951         case "$cc" in
2952         '') case "$Mcc" in
2953                 /*) dflt='Mcc';;
2954                 *) case "$large" in
2955                         -M*) dflt='cc';;
2956                         *)      if $contains '\-M' $sysman/cc.1 >/dev/null 2>&1 ; then
2957                                         if $contains '\-M' $sysman/cpp.1 >/dev/null 2>&1; then
2958                                                 dflt='cc'
2959                                         else
2960                                                 dflt='cc -M'
2961                                         fi
2962                                 else
2963                                         dflt='cc'
2964                                 fi;;
2965                         esac;;
2966                 esac;;
2967         *)  dflt="$cc";;
2968         esac
2969         case "$dflt" in
2970         *M*)    $cat <<'EOM'
2971 On some older systems the default C compiler will not resolve multiple global
2972 references that happen to have the same name.  On some such systems the "Mcc"
2973 command may be used to force these to be resolved.  On other systems a "cc -M"
2974 command is required.  (Note that the -M flag on other systems indicates a
2975 memory model to use!) If you have the Gnu C compiler, you might wish to use
2976 that instead.
2977
2978 EOM
2979         ;;
2980         esac
2981         rp="Use which C compiler?"
2982         . ./myread
2983         cc="$ans"
2984 else
2985         case "$cc" in
2986         '') dflt=cc;;
2987         *) dflt="$cc";;
2988         esac
2989         rp="Use which C compiler?"
2990         . ./myread
2991         cc="$ans"
2992 fi
2993 : Look for a hint-file generated 'call-back-unit'.  Now that the
2994 : user has specified the compiler, we may need to set or change some
2995 : other defaults.
2996 if $test -f cc.cbu; then
2997     . ./cc.cbu
2998 fi
2999 echo " "
3000 echo "Checking for GNU cc in disguise and/or its version number..." >&4
3001 $cat >gccvers.c <<EOM
3002 #include <stdio.h>
3003 int main() {
3004 #ifdef __GNUC__
3005 #ifdef __VERSION__
3006         printf("%s\n", __VERSION__);
3007 #else
3008         printf("%s\n", "1");
3009 #endif
3010 #endif
3011         exit(0);
3012 }
3013 EOM
3014 if $cc -o gccvers gccvers.c; then
3015         gccversion=`./gccvers`
3016         case "$gccversion" in
3017         '') echo "You are not using GNU cc." ;;
3018         *)  echo "You are using GNU cc $gccversion." ;;
3019         esac
3020 else
3021         echo " "
3022         echo "*** WHOA THERE!!! ***" >&4
3023         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
3024         case "$knowitall" in
3025         '')
3026         echo "    You'd better start hunting for one and let me know about it." >&4
3027                 exit 1
3028                 ;;
3029         esac
3030 fi
3031 $rm -f gccvers*
3032 case "$gccversion" in
3033 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
3034 esac
3035
3036
3037 case "$usemorebits" in
3038 "$define"|true|[yY]*)
3039         use64bits="$define"
3040         uselongdouble="$define"
3041         usemorebits="$define"
3042         ;;
3043 *)      usemorebits="$undef"
3044         ;;
3045 esac
3046
3047
3048 cat <<EOM
3049
3050 Perl can be built to understand large files (files larger than 2 gigabytes)
3051 on some systems.  To do so, Configure must be run with -Duselargefiles.
3052
3053 If this doesn't make any sense to you, just accept the default.
3054 EOM
3055 case "$uselargefiles" in
3056 "$define"|true|[yY]*) dflt='y' ;;
3057 *)      dflt='n' ;;
3058 esac
3059 rp='Try to understand large files?'
3060 . ./myread
3061 case "$ans" in
3062 y|Y)    val="$define" ;;
3063 *)      val="$undef"  ;;
3064 esac
3065 set uselargefiles
3066 eval $setvar
3067 case "$uselargefiles" in
3068 "$define") use64bits="$define" ;;
3069 esac
3070
3071 cat <<EOM
3072
3073 Perl can be built to take advantage of explicit 64-bit interfaces,
3074 on some systems.  To do so, Configure must be run with -Duse64bits.
3075
3076 If this doesn't make any sense to you, just accept the default.
3077 EOM
3078 case "$use64bits" in
3079 $define|true|[yY]*)     dflt='y';;
3080 *) dflt='n';;
3081 esac
3082 rp='Try to use explicit 64-bit interfaces, if available?'
3083 . ./myread
3084 case "$ans" in
3085 y|Y) 
3086         val="$define"
3087         ;;     
3088 *)      
3089         val="$undef"
3090         ;;
3091 esac
3092 set use64bits
3093 eval $setvar
3094
3095 case "$archname64" in
3096 '') archname64='' ;;    # not a typo
3097 esac
3098
3099 case "$use64bits" in
3100 "$define"|true|[yY]*)
3101 : Look for a hint-file generated 'call-back-unit'.  If the
3102 : user has specified that a 64 bit perl is to be built,
3103 : we may need to set or change some other defaults.
3104         if $test -f use64bits.cbu; then
3105                 echo "Your platform has some specific hints for 64-bit builds, using them..."
3106                 . ./use64bits.cbu
3107         else
3108                 $cat <<EOM
3109 (Your platform doesn't have any specific hints for 64-bit builds.
3110  This is probably okay, especially if your system is a true 64-bit system.)
3111 EOM
3112                 case "$gccversion" in
3113                 '')     ;;
3114                 *)      $cat <<EOM
3115 But since you seem to be using gcc,
3116 I will now add -DUSE_LONG_LONG to the compilation flags.
3117 EOM
3118                         ccflags="$ccflags -DUSE_LONG_LONG"
3119                         ;;
3120                 esac
3121         fi
3122         ;;
3123 esac
3124
3125 : determine the architecture name
3126 echo " "
3127 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
3128         tarch=`arch`"-$osname"
3129 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
3130         if uname -m > tmparch 2>&1 ; then
3131                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
3132                         -e 's/$/'"-$osname/" tmparch`
3133         else
3134                 tarch="$osname"
3135         fi
3136         $rm -f tmparch
3137 else
3138         tarch="$osname"
3139 fi
3140 case "$myarchname" in
3141 ''|"$tarch") ;;
3142 *)
3143         echo "(Your architecture name used to be $myarchname.)"
3144         archname=''
3145         ;;
3146 esac
3147 myarchname="$tarch"
3148 case "$archname" in
3149 '') dflt="$tarch";;
3150 *) dflt="$archname";;
3151 esac
3152 rp='What is your architecture name'
3153 . ./myread
3154 archname="$ans"
3155 case "$usethreads" in
3156 $define)
3157         echo "Threads selected." >&4
3158         case "$archname" in
3159         *-thread*) echo "...and architecture name already has -thread." >&4
3160                 ;;
3161         *)      archname="$archname-thread"
3162                 echo "...setting architecture name to $archname." >&4
3163                 ;;
3164         esac
3165         ;;
3166 esac
3167 case "$usemultiplicity" in
3168 $define)
3169         echo "Multiplicity selected." >&4
3170         case "$archname" in
3171         *-multi*) echo "...and architecture name already has -multi." >&4
3172                 ;;
3173         *)      archname="$archname-multi"
3174                 echo "...setting architecture name to $archname." >&4
3175                 ;;
3176         esac
3177         ;;
3178 esac
3179 case "$use64bits" in
3180 $define)
3181         echo "Explicit 64-bitness selected." >&4
3182         case "$archname64" in
3183         '')
3184                 ;;
3185         *)
3186                 case "$archname" in
3187                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
3188                         ;;
3189                 *)      archname="$archname-$archname64"
3190                         echo "...setting architecture name to $archname." >&4
3191                         ;;
3192                 esac
3193                 ;;
3194         esac
3195 esac
3196
3197 : decide how portable to be.  Allow command line overrides.
3198 case "$d_portable" in
3199 "$undef") ;;
3200 *)      d_portable="$define" ;;
3201 esac
3202
3203 : set up shell script to do ~ expansion
3204 cat >filexp <<EOSS
3205 $startsh
3206 : expand filename
3207 case "\$1" in
3208  ~/*|~)
3209         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3210         ;;
3211  ~*)
3212         if $test -f /bin/csh; then
3213                 /bin/csh -f -c "glob \$1"
3214                 failed=\$?
3215                 echo ""
3216                 exit \$failed
3217         else
3218                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3219                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3220                 if $test ! -d "\$dir"; then
3221                         me=\`basename \$0\`
3222                         echo "\$me: can't locate home directory for: \$name" >&2
3223                         exit 1
3224                 fi
3225                 case "\$1" in
3226                 */*)
3227                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3228                         ;;
3229                 *)
3230                         echo \$dir
3231                         ;;
3232                 esac
3233         fi
3234         ;;
3235 *)
3236         echo \$1
3237         ;;
3238 esac
3239 EOSS
3240 chmod +x filexp
3241 $eunicefix filexp
3242
3243 : now set up to get a file name
3244 cat <<EOS >getfile
3245 $startsh
3246 EOS
3247 cat <<'EOSC' >>getfile
3248 tilde=''
3249 fullpath=''
3250 already=''
3251 skip=''
3252 none_ok=''
3253 exp_file=''
3254 nopath_ok=''
3255 orig_rp="$rp"
3256 orig_dflt="$dflt"
3257 case "$gfpth" in
3258 '') gfpth='.' ;;
3259 esac
3260
3261 case "$fn" in
3262 *\(*)
3263         expr $fn : '.*(\(.*\)).*' | tr ',' $trnl >getfile.ok
3264         fn=`echo $fn | sed 's/(.*)//'`
3265         ;;
3266 esac
3267
3268 case "$fn" in
3269 *:*)
3270         loc_file=`expr $fn : '.*:\(.*\)'`
3271         fn=`expr $fn : '\(.*\):.*'`
3272         ;;
3273 esac
3274
3275 case "$fn" in
3276 *~*) tilde=true;;
3277 esac
3278 case "$fn" in
3279 */*) fullpath=true;;
3280 esac
3281 case "$fn" in
3282 *+*) skip=true;;
3283 esac
3284 case "$fn" in
3285 *n*) none_ok=true;;
3286 esac
3287 case "$fn" in
3288 *e*) exp_file=true;;
3289 esac
3290 case "$fn" in
3291 *p*) nopath_ok=true;;
3292 esac
3293
3294 case "$fn" in
3295 *f*) type='File';;
3296 *d*) type='Directory';;
3297 *l*) type='Locate';;
3298 esac
3299
3300 what="$type"
3301 case "$what" in
3302 Locate) what='File';;
3303 esac
3304
3305 case "$exp_file" in
3306 '')
3307         case "$d_portable" in
3308         "$define") ;;
3309         *) exp_file=true;;
3310         esac
3311         ;;
3312 esac
3313
3314 cd ..
3315 while test "$type"; do
3316         redo=''
3317         rp="$orig_rp"
3318         dflt="$orig_dflt"
3319         case "$tilde" in
3320         true) rp="$rp (~name ok)";;
3321         esac
3322         . UU/myread
3323         if test -f UU/getfile.ok && \
3324                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3325         then
3326                 value="$ans"
3327                 ansexp="$ans"
3328                 break
3329         fi
3330         case "$ans" in
3331         none)
3332                 value=''
3333                 ansexp=''
3334                 case "$none_ok" in
3335                 true) type='';;
3336                 esac
3337                 ;;
3338         *)
3339                 case "$tilde" in
3340                 '') value="$ans"
3341                         ansexp="$ans";;
3342                 *)
3343                         value=`UU/filexp $ans`
3344                         case $? in
3345                         0)
3346                                 if test "$ans" != "$value"; then
3347                                         echo "(That expands to $value on this system.)"
3348                                 fi
3349                                 ;;
3350                         *) value="$ans";;
3351                         esac
3352                         ansexp="$value"
3353                         case "$exp_file" in
3354                         '') value="$ans";;
3355                         esac
3356                         ;;
3357                 esac
3358                 case "$fullpath" in
3359                 true)
3360                         case "$ansexp" in
3361                         /*) value="$ansexp" ;;
3362                         *)
3363                                 redo=true
3364                                 case "$already" in
3365                                 true)
3366                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
3367                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
3368                                         ;;
3369                                 *)
3370                                 echo "Please give a full path name, starting with slash." >&4
3371                                         case "$tilde" in
3372                                         true)
3373                                 echo "Note that using ~name is ok provided it expands well." >&4
3374                                                 already=true
3375                                                 ;;
3376                                         esac
3377                                 esac
3378                                 ;;
3379                         esac
3380                         ;;
3381                 esac
3382                 case "$redo" in
3383                 '')
3384                         case "$type" in
3385                         File)
3386                                 for fp in $gfpth; do
3387                                         if test "X$fp" = X.; then
3388                                             pf="$ansexp"
3389                                         else    
3390                                             pf="$fp/$ansexp"
3391                                         fi
3392                                         if test -f "$pf"; then
3393                                                 type=''
3394                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3395                                         then
3396                                                 echo "($value is not a plain file, but that's ok.)"
3397                                                 type=''
3398                                         fi
3399                                         if test X"$type" = X; then
3400                                             value="$pf"
3401                                             break
3402                                         fi
3403                                 done
3404                                 ;;
3405                         Directory)
3406                                 for fp in $gfpth; do
3407                                         if test "X$fp" = X.; then
3408                                             pf="$ansexp"
3409                                         else    
3410                                             pf="$fp/$ansexp"
3411                                         fi
3412                                         if test -d "$pf"; then
3413                                                 type=''
3414                                                 value="$pf"
3415                                                 break
3416                                         fi
3417                                 done
3418                                 ;;
3419                         Locate)
3420                                 if test -d "$ansexp"; then
3421                                         echo "(Looking for $loc_file in directory $value.)"
3422                                         value="$value/$loc_file"
3423                                         ansexp="$ansexp/$loc_file"
3424                                 fi
3425                                 if test -f "$ansexp"; then
3426                                         type=''
3427                                 fi
3428                                 case "$nopath_ok" in
3429                                 true)   case "$value" in
3430                                         */*) ;;
3431                                         *)      echo "Assuming $value will be in people's path."
3432                                                 type=''
3433                                                 ;;
3434                                         esac
3435                                         ;;
3436                                 esac
3437                                 ;;
3438                         esac
3439
3440                         case "$skip" in
3441                         true) type='';
3442                         esac
3443
3444                         case "$type" in
3445                         '') ;;
3446                         *)
3447                                 if test "$fastread" = yes; then
3448                                         dflt=y
3449                                 else
3450                                         dflt=n
3451                                 fi
3452                                 rp="$what $value doesn't exist.  Use that name anyway?"
3453                                 . UU/myread
3454                                 dflt=''
3455                                 case "$ans" in
3456                                 y*) type='';;
3457                                 *) echo " ";;
3458                                 esac
3459                                 ;;
3460                         esac
3461                         ;;
3462                 esac
3463                 ;;
3464         esac
3465 done
3466 cd UU
3467 ans="$value"
3468 rp="$orig_rp"
3469 dflt="$orig_dflt"
3470 rm -f getfile.ok
3471 test "X$gfpthkeep" != Xy && gfpth=""
3472 EOSC
3473
3474 : determine root of directory hierarchy where package will be installed.
3475 case "$prefix" in
3476 '')
3477         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
3478         ;;
3479 *)
3480         dflt="$prefix"
3481         ;;
3482 esac
3483 $cat <<EOM
3484
3485 By default, $package will be installed in $dflt/bin, manual pages
3486 under $dflt/man, etc..., i.e. with $dflt as prefix for all
3487 installation directories. Typically this is something like /usr/local.
3488 If you wish to have binaries under /usr/bin but other parts of the
3489 installation under /usr/local, that's ok: you will be prompted
3490 separately for each of the installation directories, the prefix being
3491 only used to set the defaults.
3492
3493 EOM
3494 fn=d~
3495 rp='Installation prefix to use?'
3496 . ./getfile
3497 oldprefix=''
3498 case "$prefix" in
3499 '') ;;
3500 *)
3501         case "$ans" in
3502         "$prefix") ;;
3503         *) oldprefix="$prefix";;
3504         esac
3505         ;;
3506 esac
3507 prefix="$ans"
3508 prefixexp="$ansexp"
3509
3510 : is AFS running?
3511 echo " "
3512 case "$afs" in
3513 $define|true)   afs=true ;;
3514 $undef|false)   afs=false ;;
3515 *)      if test -d /afs; then
3516                 afs=true
3517         else
3518                 afs=false
3519         fi
3520         ;;
3521 esac
3522 if $afs; then
3523         echo "AFS may be running... I'll be extra cautious then..." >&4
3524 else
3525         echo "AFS does not seem to be running..." >&4
3526 fi
3527
3528 : determine installation prefix for where package is to be installed.
3529 if $afs; then 
3530 $cat <<EOM
3531
3532 Since you are running AFS, I need to distinguish the directory in which
3533 files will reside from the directory in which they are installed (and from
3534 which they are presumably copied to the former directory by occult means).
3535
3536 EOM
3537         case "$installprefix" in
3538         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
3539         *) dflt="$installprefix";;
3540         esac
3541 else
3542 $cat <<EOM
3543
3544 In some special cases, particularly when building $package for distribution,
3545 it is convenient to distinguish between the directory in which files should 
3546 be installed from the directory ($prefix) in which they 
3547 will eventually reside.  For most users, these two directories are the same.
3548
3549 EOM
3550         case "$installprefix" in
3551         '') dflt=$prefix ;;
3552         *) dflt=$installprefix;;
3553         esac
3554 fi
3555 fn=d~
3556 rp='What installation prefix should I use for installing files?'
3557 . ./getfile
3558 installprefix="$ans"
3559 installprefixexp="$ansexp"
3560
3561 : set the prefixit variable, to compute a suitable default value
3562 prefixit='case "$3" in
3563 ""|none)
3564         case "$oldprefix" in
3565         "") eval "$1=\"\$$2\"";;
3566         *)
3567                 case "$3" in
3568                 "") eval "$1=";;
3569                 none)
3570                         eval "tp=\"\$$2\"";
3571                         case "$tp" in
3572                         ""|" ") eval "$1=\"\$$2\"";;
3573                         *) eval "$1=";;
3574                         esac;;
3575                 esac;;
3576         esac;;
3577 *)
3578         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
3579         case "$tp" in
3580         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
3581         /*-$oldprefix/*|\~*-$oldprefix/*)
3582                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
3583         *) eval "$1=\"\$$2\"";;
3584         esac;;
3585 esac'
3586
3587 : set the base revision
3588 baserev=5.0
3589
3590 : get the patchlevel
3591 echo " "
3592 echo "Getting the current patchlevel..." >&4
3593 if $test -r $rsrc/patchlevel.h;then
3594         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
3595         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
3596         apiversion=`awk '/define[       ]+PERL_APIVERSION/ {print $3}' $rsrc/patchlevel.h`
3597 else
3598         patchlevel=0
3599         subversion=0
3600         apiversion=0
3601 fi
3602 $echo $n "(You have $package" $c
3603 case "$package" in
3604 "*$baserev")    ;;
3605 *)              $echo $n " $baserev" $c ;;
3606 esac
3607 $echo $n " patchlevel $patchlevel" $c
3608 test 0 -eq "$subversion" || $echo $n " subversion $subversion" $c
3609 echo ".)"
3610
3611 if test 0 -eq "$subversion"; then
3612         version=`LC_ALL=C; export LC_ALL; \
3613                  echo $baserev $patchlevel | \
3614                  $awk '{ printf "%.3f\n", $1 + $2/1000.0 }'`
3615 else
3616         version=`LC_ALL=C; export LC_ALL; \
3617                  echo $baserev $patchlevel $subversion | \
3618                  $awk '{ printf "%.5f\n", $1 + $2/1000.0 + $3/100000.0 }'`
3619 fi
3620
3621 : determine installation style
3622 : For now, try to deduce it from prefix unless it is already set.
3623 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
3624 case "$installstyle" in
3625 '')     case "$prefix" in
3626                 *perl*) dflt='lib';;
3627                 *) dflt='lib/perl5' ;;
3628         esac
3629         ;;
3630 *)      dflt='lib/perl5' ;;
3631 esac
3632 : Probably not worth prompting for this since we prompt for all
3633 : the directories individually, and the prompt would be too long and
3634 : confusing anyway.
3635 installstyle=$dflt
3636
3637 : determine where private library files go
3638 : Usual default is /usr/local/lib/perl5/$version.
3639 : Also allow things like /opt/perl/lib/$version, since 
3640 : /opt/perl/lib/perl5... would be redundant.
3641 : The default "style" setting is made in installstyle.U
3642 case "$installstyle" in
3643 *lib/perl5*) set dflt privlib lib/$package/$version ;;
3644 *)       set dflt privlib lib/$version ;;
3645 esac
3646 eval $prefixit
3647 $cat <<EOM
3648
3649 There are some auxiliary files for $package that need to be put into a
3650 private library directory that is accessible by everyone.
3651
3652 EOM
3653 fn=d~+
3654 rp='Pathname where the private library files will reside?'
3655 . ./getfile
3656 privlib="$ans"
3657 privlibexp="$ansexp"
3658 : Change installation prefix, if necessary.
3659 if $test X"$prefix" != X"$installprefix"; then
3660         installprivlib=`echo $privlibexp | sed "s#^$prefix#$installprefix#"`
3661 else
3662         installprivlib="$privlibexp"
3663 fi
3664
3665 : set the prefixup variable, to restore leading tilda escape
3666 prefixup='case "$prefixexp" in
3667 "$prefix") ;;
3668 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
3669 esac'
3670
3671 : determine where public architecture dependent libraries go
3672 set archlib archlib
3673 eval $prefixit
3674 : privlib default is /usr/local/lib/$package/$version
3675 : archlib default is /usr/local/lib/$package/$version/$archname
3676 : privlib may have an optional trailing /share.
3677 tdflt=`echo $privlib | $sed 's,/share$,,'`
3678 tdflt=$tdflt/$archname
3679 case "$archlib" in
3680 '')     dflt=$tdflt
3681         ;;
3682 *)      dflt="$archlib"
3683     ;;
3684 esac
3685 $cat <<EOM
3686
3687 $spackage contains architecture-dependent library files.  If you are
3688 sharing libraries in a heterogeneous environment, you might store
3689 these files in a separate location.  Otherwise, you can just include
3690 them with the rest of the public library files.
3691
3692 EOM
3693 fn=d+~
3694 rp='Where do you want to put the public architecture-dependent libraries?'
3695 . ./getfile
3696 archlib="$ans"
3697 archlibexp="$ansexp"
3698 if $test X"$archlib" = X"$privlib"; then
3699         d_archlib="$undef"
3700 else
3701         d_archlib="$define"
3702 fi
3703 : Change installation prefix, if necessary.
3704 if $test X"$prefix" != X"$installprefix"; then
3705         installarchlib=`echo $archlibexp | sed "s#^$prefix#$installprefix#"`
3706 else
3707         installarchlib="$archlibexp"
3708 fi
3709
3710
3711 : Binary compatibility with 5.005 is not possible for builds
3712 : with advanced features
3713 case "$usethreads$usemultiplicity" in
3714 *define*)
3715         bincompat5005="$undef"
3716         d_bincompat5005="$undef"
3717         ;;
3718 *)      $cat <<EOM
3719
3720 Perl 5.006 can be compiled for binary compatibility with 5.005.
3721 If you decide to do so, you will be able to continue using most
3722 of the extensions that were compiled for Perl 5.005.
3723
3724 EOM
3725         case "$bincompat5005$d_bincompat5005" in
3726         *"$undef"*) dflt=n ;;
3727         *) dflt=y ;;
3728         esac
3729         rp='Binary compatibility with Perl 5.005?'
3730         . ./myread
3731         case "$ans" in
3732         y*) val="$define" ;;
3733         *)  val="$undef" ;;
3734         esac
3735         set d_bincompat5005
3736         eval $setvar
3737         case "$d_bincompat5005" in
3738         "$define")
3739                 bincompat5005="$define"
3740                 ;;
3741         *)      bincompat5005="$undef"
3742                 d_bincompat5005="$undef"
3743                 ;;
3744         esac
3745         ;;
3746 esac
3747
3748
3749 : see if setuid scripts can be secure
3750 $cat <<EOM
3751
3752 Some kernels have a bug that prevents setuid #! scripts from being
3753 secure.  Some sites have disabled setuid #! scripts because of this.
3754
3755 First let's decide if your kernel supports secure setuid #! scripts.
3756 (If setuid #! scripts would be secure but have been disabled anyway,
3757 don't say that they are secure if asked.)
3758
3759 EOM
3760
3761 val="$undef"
3762 if $test -d /dev/fd; then
3763         echo "#!$ls" >reflect
3764         chmod +x,u+s reflect
3765         ./reflect >flect 2>&1
3766         if $contains "/dev/fd" flect >/dev/null; then
3767                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
3768                 val="$define"
3769         else
3770                 $cat <<EOM
3771 If you are not sure if they are secure, I can check but I'll need a
3772 username and password different from the one you are using right now.
3773 If you don't have such a username or don't want me to test, simply
3774 enter 'none'.
3775
3776 EOM
3777                 rp='Other username to test security of setuid scripts with?'
3778                 dflt='none'
3779                 . ./myread
3780                 case "$ans" in
3781                 n|none)
3782                         case "$d_suidsafe" in
3783                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
3784                                 dflt=n;;
3785                         "$undef")
3786                                 echo "Well, the $hint value is *not* secure." >&4
3787                                 dflt=n;;
3788                         *)      echo "Well, the $hint value *is* secure." >&4
3789                                 dflt=y;;
3790                         esac
3791                         ;;
3792                 *)
3793                         $rm -f reflect flect
3794                         echo "#!$ls" >reflect
3795                         chmod +x,u+s reflect
3796                         echo >flect
3797                         chmod a+w flect
3798                         echo '"su" will (probably) prompt you for '"$ans's password."
3799                         su $ans -c './reflect >flect'
3800                         if $contains "/dev/fd" flect >/dev/null; then
3801                                 echo "Okay, it looks like setuid scripts are secure." >&4
3802                                 dflt=y
3803                         else
3804                                 echo "I don't think setuid scripts are secure." >&4
3805                                 dflt=n
3806                         fi
3807                         ;;
3808                 esac
3809                 rp='Does your kernel have *secure* setuid scripts?'
3810                 . ./myread
3811                 case "$ans" in
3812                 [yY]*)  val="$define";;
3813                 *)      val="$undef";;
3814                 esac
3815         fi
3816 else
3817         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
3818         echo "(That's for file descriptors, not floppy disks.)"
3819         val="$undef"
3820 fi
3821 set d_suidsafe
3822 eval $setvar
3823
3824 $rm -f reflect flect
3825
3826 : now see if they want to do setuid emulation
3827 echo " "
3828 val="$undef"
3829 case "$d_suidsafe" in
3830 "$define")
3831         val="$undef"
3832         echo "No need to emulate SUID scripts since they are secure here." >& 4
3833         ;;
3834 *)
3835         $cat <<EOM
3836 Some systems have disabled setuid scripts, especially systems where
3837 setuid scripts cannot be secure.  On systems where setuid scripts have
3838 been disabled, the setuid/setgid bits on scripts are currently
3839 useless.  It is possible for $package to detect those bits and emulate
3840 setuid/setgid in a secure fashion.  This emulation will only work if
3841 setuid scripts have been disabled in your kernel.
3842
3843 EOM
3844         case "$d_dosuid" in
3845         "$define") dflt=y ;;
3846         *) dflt=n ;;
3847         esac
3848         rp="Do you want to do setuid/setgid emulation?"
3849         . ./myread
3850         case "$ans" in
3851         [yY]*)  val="$define";;
3852         *)      val="$undef";;
3853         esac
3854         ;;
3855 esac
3856 set d_dosuid
3857 eval $setvar
3858
3859 : What should the include directory be ?
3860 echo " "
3861 $echo $n "Hmm...  $c"
3862 dflt='/usr/include'
3863 incpath=''
3864 mips_type=''
3865 if $test -f /bin/mips && /bin/mips; then
3866         echo "Looks like a MIPS system..."
3867         $cat >usr.c <<'EOCP'
3868 #ifdef SYSTYPE_BSD43
3869 /bsd43
3870 #endif
3871 EOCP
3872         if $cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
3873                 dflt='/bsd43/usr/include'
3874                 incpath='/bsd43'
3875                 mips_type='BSD 4.3'
3876         else
3877                 mips_type='System V'
3878         fi
3879         $rm -f usr.c usr.out
3880         echo "and you're compiling with the $mips_type compiler and libraries."
3881         xxx_prompt=y
3882         echo "exit 0" >mips
3883 else
3884         echo "Doesn't look like a MIPS system."
3885         xxx_prompt=n
3886         echo "exit 1" >mips
3887 fi
3888 chmod +x mips
3889 $eunicefix mips
3890 case "$usrinc" in
3891 '') ;;
3892 *) dflt="$usrinc";;
3893 esac
3894 case "$xxx_prompt" in
3895 y)      fn=d/
3896         echo " "
3897         rp='Where are the include files you want to use?'
3898         . ./getfile
3899         usrinc="$ans"
3900         ;;
3901 *)      usrinc="$dflt"
3902         ;;
3903 esac
3904
3905 : see how we invoke the C preprocessor
3906 echo " "
3907 echo "Now, how can we feed standard input to your C preprocessor..." >&4
3908 cat <<'EOT' >testcpp.c
3909 #define ABC abc
3910 #define XYZ xyz
3911 ABC.XYZ
3912 EOT
3913 cd ..
3914 if test ! -f cppstdin; then
3915         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
3916                 # AIX cc -E doesn't show the absolute headerfile
3917                 # locations but we'll cheat by using the -M flag.
3918                 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
3919         else
3920                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
3921         fi
3922 else
3923         echo "Keeping your $hint cppstdin wrapper."
3924 fi
3925 chmod 755 cppstdin
3926 wrapper=`pwd`/cppstdin
3927 ok='false'
3928 cd UU
3929
3930 if $test "X$cppstdin" != "X" && \
3931         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
3932         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3933 then
3934         echo "You used to use $cppstdin $cppminus so we'll use that again."
3935         case "$cpprun" in
3936         '') echo "But let's see if we can live without a wrapper..." ;;
3937         *)
3938                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
3939                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3940                 then
3941                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
3942                         ok='true'
3943                 else
3944                         echo "(However, $cpprun $cpplast does not work, let's see...)"
3945                 fi
3946                 ;;
3947         esac
3948 else
3949         case "$cppstdin" in
3950         '') ;;
3951         *)
3952                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
3953                 ;;
3954         esac
3955 fi
3956
3957 if $ok; then
3958         : nothing
3959 elif echo '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"' -E -" will work...'; \
3966         $cc -E - <testcpp.c >testcpp.out 2>&1; \
3967         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3968         echo "Yup, it does."
3969         x_cpp="$cc -E"
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 "Yipee, that works!"
3975         x_cpp="$cc -P"
3976         x_minus='';
3977 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
3978         $cc -P - <testcpp.c >testcpp.out 2>&1; \
3979         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3980         echo "At long last!"
3981         x_cpp="$cc -P"
3982         x_minus='-';
3983 elif echo 'No such luck, 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 "It works!"
3987         x_cpp="$cpp"
3988         x_minus='';
3989 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
3990         $cpp - <testcpp.c >testcpp.out 2>&1; \
3991         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3992         echo "Hooray, it works!  I was beginning to wonder."
3993         x_cpp="$cpp"
3994         x_minus='-';
3995 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
3996         $wrapper <testcpp.c >testcpp.out 2>&1; \
3997         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3998         x_cpp="$wrapper"
3999         x_minus=''
4000         echo "Eureka!"
4001 else
4002         dflt=''
4003         rp="No dice.  I can't find a C preprocessor.  Name one:"
4004         . ./myread
4005         x_cpp="$ans"
4006         x_minus=''
4007         $x_cpp <testcpp.c >testcpp.out 2>&1
4008         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4009                 echo "OK, that will do." >&4
4010         else
4011 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
4012                 exit 1
4013         fi
4014 fi
4015
4016 case "$ok" in
4017 false)
4018         cppstdin="$x_cpp"
4019         cppminus="$x_minus"
4020         cpprun="$x_cpp"
4021         cpplast="$x_minus"
4022         set X $x_cpp
4023         shift
4024         case "$1" in
4025         "$cpp")
4026                 echo "Perhaps can we force $cc -E using a wrapper..."
4027                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4028                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4029                 then
4030                         echo "Yup, we can."
4031                         cppstdin="$wrapper"
4032                         cppminus='';
4033                 else
4034                         echo "Nope, we'll have to live without it..."
4035                 fi
4036                 ;;
4037         esac
4038         case "$cpprun" in
4039         "$wrapper")
4040                 cpprun=''
4041                 cpplast=''
4042                 ;;
4043         esac
4044         ;;
4045 esac
4046
4047 case "$cppstdin" in
4048 "$wrapper"|'cppstdin') ;;
4049 *) $rm -f $wrapper;;
4050 esac
4051 $rm -f testcpp.c testcpp.out
4052
4053 : Set private lib path
4054 case "$plibpth" in
4055 '') if ./mips; then
4056                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
4057         fi;;
4058 esac
4059 case "$libpth" in
4060 ' ') dlist='';;
4061 '') dlist="$loclibpth $plibpth $glibpth";;
4062 *) dlist="$libpth";;
4063 esac
4064
4065 : Now check and see which directories actually exist, avoiding duplicates
4066 libpth=''
4067 for xxx in $dlist
4068 do
4069     if $test -d $xxx; then
4070                 case " $libpth " in
4071                 *" $xxx "*) ;;
4072                 *) libpth="$libpth $xxx";;
4073                 esac
4074     fi
4075 done
4076 $cat <<'EOM'
4077
4078 Some systems have incompatible or broken versions of libraries.  Among
4079 the directories listed in the question below, please remove any you
4080 know not to be holding relevant libraries, and add any that are needed.
4081 Say "none" for none.
4082
4083 EOM
4084 case "$libpth" in
4085 '') dflt='none';;
4086 *)
4087         set X $libpth
4088         shift
4089         dflt=${1+"$@"}
4090         ;;
4091 esac
4092 rp="Directories to use for library searches?"
4093 . ./myread
4094 case "$ans" in
4095 none) libpth=' ';;
4096 *) libpth="$ans";;
4097 esac
4098
4099 : compute shared library extension
4100 case "$so" in
4101 '')
4102         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
4103                 dflt='sl'
4104         else
4105                 dflt='so'
4106         fi
4107         ;;
4108 *) dflt="$so";;
4109 esac
4110 $cat <<EOM
4111
4112 On some systems, shared libraries may be available.  Answer 'none' if
4113 you want to suppress searching of shared libraries for the remaining
4114 of this configuration.
4115
4116 EOM
4117 rp='What is the file extension used for shared libraries?'
4118 . ./myread
4119 so="$ans"
4120
4121 : Define several unixisms.
4122 : Hints files or command line option can be used to override them.
4123 : The convoluted testing is in case hints files set either the old
4124 : or the new name.
4125 case "$_exe" in
4126 '')     case "$exe_ext" in
4127     '') ;;
4128         *)      _exe="$exe_ext" ;;
4129         esac
4130         ;;
4131 esac
4132 case "$_a" in
4133 '')     case "$lib_ext" in
4134     '') _a='.a';;
4135         *)      _a="$lib_ext" ;;
4136         esac
4137         ;;
4138 esac
4139 case "$_o" in
4140 '') case "$obj_ext" in
4141         '')     _o='.o';;
4142         *)      _o="$obj_ext";;
4143         esac
4144         ;;
4145 esac
4146 case "$p_" in
4147 '') case "$path_sep" in
4148         '')     p_=':';;
4149         *)      p_="$path_sep";;
4150         esac
4151         ;;
4152 esac
4153 exe_ext=$_exe
4154 lib_ext=$_a
4155 obj_ext=$_o
4156 path_sep=$p_
4157
4158 : Which makefile gets called first.  This is used by make depend.
4159 case "$firstmakefile" in
4160 '') firstmakefile='makefile';;
4161 esac
4162
4163 cat <<EOM
4164
4165 Perl can be built to use the SOCKS proxy protocol library.  To do so,
4166 Configure must be run with -Dusesocks.
4167
4168 Normally you do not need this and you should answer no.
4169
4170 EOM
4171 case "$usesocks" in
4172 $define|true|[yY]*)     dflt='y';;
4173 *) dflt='n';;
4174 esac
4175 rp='Build Perl for SOCKS?'
4176 . ./myread
4177 case "$ans" in
4178 y|Y)    val="$define" ;;     
4179 *)      val="$undef" ;;
4180 esac
4181 set usesocks
4182 eval $setvar
4183
4184 : Looking for optional libraries
4185 echo " "
4186 echo "Checking for optional libraries..." >&4
4187 case "$libs" in
4188 ' '|'') dflt='';;
4189 *) dflt="$libs";;
4190 esac
4191 case "$libswanted" in
4192 '') libswanted='c_s';;
4193 esac
4194 case "$usesocks" in
4195 $define)
4196         libswanted="$libswanted socks5 socks5_sh"
4197         ;;
4198 esac
4199 for thislib in $libswanted; do
4200         
4201         if xxx=`./loc lib$thislib.$so.[0-9]'*' X $libpth`;
4202                 $test -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; 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.$so X $libpth` ; $test -f "$xxx"; then
4209                 echo "Found -l$thislib (shared)."
4210                 case " $dflt " in
4211                 *"-l$thislib "*);;
4212                 *) dflt="$dflt -l$thislib";;
4213                 esac
4214         elif xxx=`./loc lib$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 $thislib$_a X $libpth`; $test -f "$xxx"; then
4221                 echo "Found -l$thislib."
4222                 case " $dflt " in
4223                 *"-l$thislib "*);;
4224                 *) dflt="$dflt -l$thislib";;
4225                 esac
4226         elif xxx=`./loc lib${thislib}_s$_a X $libpth`; $test -f "$xxx"; then
4227                 echo "Found -l${thislib}_s."
4228                 case " $dflt " in
4229                 *"-l$thislib "*);;
4230                 *) dflt="$dflt -l${thislib}_s";;
4231                 esac
4232         elif xxx=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$xxx"; then
4233                 echo "Found -l$thislib."
4234                 case " $dflt " in
4235                 *"-l$thislib "*);;
4236                 *) dflt="$dflt -l$thislib";;
4237                 esac
4238         else
4239                 echo "No -l$thislib."
4240         fi
4241 done
4242 set X $dflt
4243 shift
4244 dflt="$*"
4245 case "$libs" in
4246 '') dflt="$dflt";;
4247 *) dflt="$libs";;
4248 esac
4249 case "$dflt" in
4250 ' '|'') dflt='none';;
4251 esac
4252
4253 $cat <<EOM
4254
4255 In order to compile $package on your machine, a number of libraries
4256 are usually needed.  Include any other special libraries here as well.
4257 Say "none" for none.  The default list is almost always right.
4258 EOM
4259
4260 echo " "
4261 rp="What libraries to use?"
4262 . ./myread
4263 case "$ans" in
4264 none) libs=' ';;
4265 *) libs="$ans";;
4266 esac
4267
4268 : determine optimization, if desired, or use for debug flag also
4269 case "$optimize" in
4270 ' '|$undef) dflt='none';;
4271 '') dflt='-O';;
4272 *) dflt="$optimize";;
4273 esac
4274 $cat <<EOH
4275
4276 By default, $package compiles with the -O flag to use the optimizer.
4277 Alternately, you might want to use the symbolic debugger, which uses
4278 the -g flag (on traditional Unix systems).  Either flag can be
4279 specified here.  To use neither flag, specify the word "none".
4280
4281 EOH
4282 rp="What optimizer/debugger flag should be used?"
4283 . ./myread
4284 optimize="$ans"
4285 case "$optimize" in
4286 'none') optimize=" ";;
4287 esac
4288
4289 dflt=''
4290 : We will not override a previous value, but we might want to
4291 : augment a hint file
4292 case "$hint" in
4293 default|recommended)
4294         case "$gccversion" in
4295         1*) dflt='-fpcc-struct-return' ;;
4296         esac
4297         case "$optimize" in
4298         *-g*) dflt="$dflt -DDEBUGGING";;
4299         esac
4300         case "$gccversion" in
4301         2*) if test -d /etc/conf/kconfig.d &&
4302                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
4303                 then
4304                         dflt="$dflt -posix"
4305                 fi
4306                 ;;
4307         esac
4308         case "$gccversion" in
4309         1*) ;;
4310         2.[0-8]*) ;;
4311         ?*)     echo " "
4312                 echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
4313                 echo 'int main(void) { return 0; }' > gcctest.c
4314                 if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
4315                         echo "Yes, it does." 2>&1
4316                         case "$ccflags" in
4317                         *strict-aliasing*) 
4318                                 echo "Leaving current flags $ccflags alone." 2>&1
4319                                 ;;
4320                         *) dflt="$dflt -fno-strict-aliasing" ;;
4321                         esac
4322                 else
4323                         echo "Nope, it doesn't, but that's ok." 2>&1
4324                 fi
4325                 ;;
4326         esac
4327         ;;
4328 esac
4329
4330 case "$mips_type" in
4331 *BSD*|'') inclwanted="$locincpth $usrinc";;
4332 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
4333 esac
4334 for thisincl in $inclwanted; do
4335         if $test -d $thisincl; then
4336                 if $test x$thisincl != x$usrinc; then
4337                         case "$dflt" in
4338                         *$thisincl*);;
4339                         *) dflt="$dflt -I$thisincl";;
4340                         esac
4341                 fi
4342         fi
4343 done
4344
4345 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
4346         xxx=true;
4347 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
4348         xxx=true;
4349 else
4350         xxx=false;
4351 fi;
4352 if $xxx; then
4353         case "$dflt" in
4354         *$2*);;
4355         *) dflt="$dflt -D$2";;
4356         esac;
4357 fi'
4358
4359 set signal.h LANGUAGE_C; eval $inctest
4360
4361 case "$usesocks" in
4362 $define)
4363         ccflags="$ccflags -DSOCKS"
4364         ;;
4365 esac
4366
4367 case "$hint" in
4368 default|recommended) dflt="$ccflags $dflt" ;;
4369 *) dflt="$ccflags";;
4370 esac
4371
4372 case "$dflt" in
4373 ''|' ') dflt=none;;
4374 esac
4375 $cat <<EOH
4376
4377 Your C compiler may want other flags.  For this question you should include
4378 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
4379 but you should NOT include libraries or ld flags like -lwhatever.  If you
4380 want $package to honor its debug switch, you should include -DDEBUGGING here.
4381 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
4382
4383 To use no flags, specify the word "none".
4384
4385 EOH
4386 set X $dflt
4387 shift
4388 dflt=${1+"$@"}
4389 rp="Any additional cc flags?"
4390 . ./myread
4391 case "$ans" in
4392 none) ccflags='';;
4393 *) ccflags="$ans";;
4394 esac
4395
4396 : the following weeds options from ccflags that are of no interest to cpp
4397 cppflags="$ccflags"
4398 case "$gccversion" in
4399 1*) cppflags="$cppflags -D__GNUC__"
4400 esac
4401 case "$mips_type" in
4402 '');;
4403 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
4404 esac
4405 case "$cppflags" in
4406 '');;
4407 *)
4408         echo " "
4409         echo "Let me guess what the preprocessor flags are..." >&4
4410         set X $cppflags
4411         shift
4412         cppflags=''
4413         $cat >cpp.c <<'EOM'
4414 #define BLURFL foo
4415
4416 BLURFL xx LFRULB
4417 EOM
4418         previous=''
4419         for flag in $*
4420         do
4421                 case "$flag" in
4422                 -*) ftry="$flag";;
4423                 *) ftry="$previous $flag";;
4424                 esac
4425                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
4426                         >cpp1.out 2>/dev/null && \
4427                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
4428                         >cpp2.out 2>/dev/null && \
4429                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
4430                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
4431                 then
4432                         cppflags="$cppflags $ftry"
4433                         previous=''
4434                 else
4435                         previous="$flag"
4436                 fi
4437         done
4438         set X $cppflags
4439         shift
4440         cppflags=${1+"$@"}
4441         case "$cppflags" in
4442         *-*)  echo "They appear to be: $cppflags";;
4443         esac
4444         $rm -f cpp.c cpp?.out
4445         ;;
4446 esac
4447
4448 : flags used in final linking phase
4449 case "$ldflags" in
4450 '') if ./venix; then
4451                 dflt='-i -z'
4452         else
4453                 dflt=''
4454         fi
4455         case "$ccflags" in
4456         *-posix*) dflt="$dflt -posix" ;;
4457         esac
4458         ;;
4459 *) dflt="$ldflags";;
4460 esac
4461
4462 : Try to guess additional flags to pick up local libraries.
4463 for thislibdir in $libpth; do
4464         case " $loclibpth " in
4465         *" $thislibdir "*)
4466                 case "$dflt " in 
4467                 *"-L$thislibdir "*) ;;
4468                 *)  dflt="$dflt -L$thislibdir" ;;
4469                 esac
4470                 ;;
4471         esac
4472 done
4473
4474 case "$dflt" in
4475 '') dflt='none' ;;
4476 esac
4477
4478 $cat <<EOH
4479
4480 Your C linker may need flags.  For this question you should
4481 include -L/whatever and any other flags used by the C linker, but you
4482 should NOT include libraries like -lwhatever.
4483
4484 Make sure you include the appropriate -L/path flags if your C linker
4485 does not normally search all of the directories you specified above,
4486 namely
4487         $libpth
4488 To use no flags, specify the word "none".
4489
4490 EOH
4491
4492 rp="Any additional ld flags (NOT including libraries)?"
4493 . ./myread
4494 case "$ans" in
4495 none) ldflags='';;
4496 *) ldflags="$ans";;
4497 esac
4498 rmlist="$rmlist pdp11"
4499
4500 : coherency check
4501 echo " "
4502 echo "Checking your choice of C compiler and flags for coherency..." >&4
4503 $cat > try.c <<'EOF'
4504 #include <stdio.h>
4505 int main() { printf("Ok\n"); exit(0); }
4506 EOF
4507 set X $cc $optimize $ccflags -o try $ldflags try.c $libs
4508 shift
4509 $cat >try.msg <<'EOM'
4510 I've tried to compile and run the following simple program:
4511
4512 EOM
4513 $cat try.c >> try.msg
4514
4515 $cat >> try.msg <<EOM
4516
4517 I used the command:
4518
4519         $*
4520         ./try
4521
4522 and I got the following output:
4523
4524 EOM
4525 dflt=y
4526 if sh -c "$cc $optimize $ccflags -o try $ldflags try.c $libs" >>try.msg 2>&1; then
4527         if sh -c './try' >>try.msg 2>&1; then
4528                 xxx=`./try`
4529                 case "$xxx" in
4530                 "Ok") dflt=n ;;
4531                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
4532                         case " $libs " in
4533                         *" -lsfio "*)
4534                                 cat >> try.msg <<'EOQS'
4535 If $libs contains -lsfio, and sfio is mis-configured, then it
4536 sometimes (apparently) runs and exits with a 0 status, but with no
4537 output!  It may have to do with sfio's use of _exit vs. exit.
4538
4539 EOQS
4540                                 rp="You have a big problem.  Shall I abort Configure"
4541                                 dflt=y
4542                                 ;;
4543                         esac
4544                         ;;
4545                 esac
4546         else
4547                 echo "The program compiled OK, but exited with status $?." >>try.msg
4548                 rp="You have a problem.  Shall I abort Configure"
4549                 dflt=y
4550         fi
4551 else
4552         echo "I can't compile the test program." >>try.msg
4553         rp="You have a BIG problem.  Shall I abort Configure"
4554         dflt=y
4555 fi
4556 case "$dflt" in
4557 y)
4558         $cat try.msg >&4
4559         case "$knowitall" in
4560         '')
4561                 echo "(The supplied flags or libraries might be incorrect.)"
4562                 ;;
4563         *) dflt=n;;
4564         esac
4565         echo " "
4566         . ./myread
4567         case "$ans" in
4568         n*|N*) ;;
4569         *)      echo "Ok.  Stopping Configure." >&4
4570                 exit 1
4571                 ;;
4572         esac
4573         ;;
4574 n) echo "OK, that should do.";;
4575 esac
4576 $rm -f try try.* core
4577
4578 : determine filename position in cpp output
4579 echo " "
4580 echo "Computing filename position in cpp output for #include directives..." >&4
4581 echo '#include <stdio.h>' > foo.c
4582 $cat >fieldn <<EOF
4583 $startsh
4584 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
4585 $grep '^[       ]*#.*stdio\.h' | \
4586 while read cline; do
4587         pos=1
4588         set \$cline
4589         while $test \$# -gt 0; do
4590                 if $test -r \`echo \$1 | $tr -d '"'\`; then
4591                         echo "\$pos"
4592                         exit 0
4593                 fi
4594                 shift
4595                 pos=\`expr \$pos + 1\`
4596         done
4597 done
4598 EOF
4599 chmod +x fieldn
4600 fieldn=`./fieldn`
4601 $rm -f foo.c fieldn
4602 case $fieldn in
4603 '') pos='???';;
4604 1) pos=first;;
4605 2) pos=second;;
4606 3) pos=third;;
4607 *) pos="${fieldn}th";;
4608 esac
4609 echo "Your cpp writes the filename in the $pos field of the line."
4610
4611 : locate header file
4612 $cat >findhdr <<EOF
4613 $startsh
4614 wanted=\$1
4615 name=''
4616 for usrincdir in $usrinc
4617 do
4618         if test -f \$usrincdir/\$wanted; then
4619                 echo "\$usrincdir/\$wanted"
4620                 exit 0
4621         fi
4622 done
4623 awkprg='{ print \$$fieldn }'
4624 echo "#include <\$wanted>" > foo\$\$.c
4625 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
4626 $grep "^[       ]*#.*\$wanted" | \
4627 while read cline; do
4628         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
4629         case "\$name" in
4630         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
4631         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
4632         *) exit 2;;
4633         esac;
4634 done;
4635 #
4636 # status = 0: grep returned 0 lines, case statement not executed
4637 # status = 1: headerfile found
4638 # status = 2: while loop executed, no headerfile found
4639 #
4640 status=\$?
4641 $rm -f foo\$\$.c;
4642 if test \$status -eq 1; then
4643         exit 0;
4644 fi
4645 exit 1
4646 EOF
4647 chmod +x findhdr
4648
4649 : define an alternate in-header-list? function
4650 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
4651 cont=true; xxf="echo \"<\$1> found.\" >&4";
4652 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
4653 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
4654 esac;
4655 case $# in 4) instead=instead;; *) instead="at last";; esac;
4656 while $test "$cont"; do
4657         xxx=`./findhdr $1`
4658         var=$2; eval "was=\$$2";
4659         if $test "$xxx" && $test -r "$xxx";
4660         then eval $xxf;
4661         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
4662                 cont="";
4663         else eval $xxnf;
4664         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
4665         set $yyy; shift; shift; yyy=$@;
4666         case $# in 0) cont="";;
4667         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
4668                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
4669         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
4670                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
4671         esac;
4672 done;
4673 while $test "$yyy";
4674 do set $yyy; var=$2; eval "was=\$$2";
4675         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
4676         set $yyy; shift; shift; yyy=$@;
4677 done'
4678
4679 : see if this is a malloc.h system
4680 set malloc.h i_malloc
4681 eval $inhdr
4682
4683 : see if stdlib is available
4684 set stdlib.h i_stdlib
4685 eval $inhdr
4686
4687 : determine which malloc to compile in
4688 echo " "
4689 case "$usemymalloc" in
4690 ''|[yY]*|true|$define)  dflt='y' ;;
4691 *)      dflt='n' ;;
4692 esac
4693 rp="Do you wish to attempt to use the malloc that comes with $package?"
4694 . ./myread
4695 usemymalloc="$ans"
4696 case "$ans" in
4697 y*|true)
4698         usemymalloc='y'
4699         mallocsrc='malloc.c'
4700         mallocobj="malloc$_o"
4701         d_mymalloc="$define"
4702         case "$libs" in
4703         *-lmalloc*)
4704                 : Remove malloc from list of libraries to use
4705                 echo "Removing unneeded -lmalloc from library list" >&4
4706                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
4707                 shift
4708                 libs="$*"
4709                 echo "libs = $libs" >&4
4710                 ;;
4711         esac
4712         ;;
4713 *)
4714         usemymalloc='n'
4715         mallocsrc=''
4716         mallocobj=''
4717         d_mymalloc="$undef"
4718         ;;
4719 esac
4720
4721 : compute the return types of malloc and free
4722 echo " "
4723 $cat >malloc.c <<END
4724 #$i_malloc I_MALLOC
4725 #$i_stdlib I_STDLIB
4726 #include <stdio.h>
4727 #include <sys/types.h>
4728 #ifdef I_MALLOC
4729 #include <malloc.h>
4730 #endif
4731 #ifdef I_STDLIB
4732 #include <stdlib.h>
4733 #endif
4734 #ifdef TRY_MALLOC
4735 void *malloc();
4736 #endif
4737 #ifdef TRY_FREE
4738 void free();
4739 #endif
4740 END
4741 case "$malloctype" in
4742 '')
4743         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
4744                 malloctype='void *'
4745         else
4746                 malloctype='char *'
4747         fi
4748         ;;
4749 esac
4750 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
4751
4752 case "$freetype" in
4753 '')
4754         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
4755                 freetype='void'
4756         else
4757                 freetype='int'
4758         fi
4759         ;;
4760 esac
4761 echo "Your system uses $freetype free(), it would seem." >&4
4762 $rm -f malloc.[co]
4763 $cat <<EOM
4764
4765 The installation process will also create a directory for
4766 vendor-supplied add-ons.  Vendors who supply perl with their system
4767 may find it convenient to place all vendor-supplied files in this
4768 directory rather than in the main distribution directory.  This will
4769 ease upgrades between binary-compatible maintenance versions of perl.
4770
4771 Of course you may also use these directories in whatever way you see
4772 fit.  For example, you might use them to access modules shared over a
4773 company-wide network.
4774
4775 The default answer should be fine for most people.
4776 This causes further questions about vendor add-ons to be skipped
4777 and no vendor-specific directories will be configured for perl.
4778
4779 EOM
4780 rp='Do you want to configure vendor-specific add-on directories?'
4781 case "$usevendorprefix" in
4782 define|true|[yY]*) dflt=y ;;
4783 *) dflt=n ;;
4784 esac
4785 . ./myread
4786 case "$ans" in
4787 [yY]*)  fn=d~+
4788         rp='Installation prefix to use for vendor-supplied add-ons?'
4789         case "$vendorprefix" in
4790         '') dflt='' ;;
4791         *)  dflt=$vendorprefix ;;
4792         esac
4793         . ./getfile
4794         oldvendorprefix=''
4795         case "$vendorprefix" in
4796         '') ;;
4797         *)      case "$ans" in
4798                 "$prefix") ;;
4799                 *) oldvendorprefix="$prefix";;
4800                 esac
4801                 ;;
4802         esac
4803         usevendorprefix="$define"
4804         vendorprefix="$ans"
4805         vendorprefixexp="$ansexp"
4806         ;;
4807 *)      usevendorprefix="$undef"
4808         vendorprefix=''
4809         vendorprefixexp=''
4810         ;;
4811 esac
4812
4813 case "$vendorprefix" in
4814 '')     d_vendorlib="$undef"
4815         vendorlib=''
4816         vendorlibexp=''
4817         ;;
4818 *)      d_vendorlib="$define"
4819         : determine where vendor-supplied modules go.
4820         : Usual default is /usr/local/lib/perl5/vendor_perl
4821         prog=`echo $package | $sed 's/-*[0-9.]*$//'`
4822         case "$installstyle" in
4823         *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog ;;
4824         *)           dflt=$vendorprefix/lib/vendor_$prog ;;
4825         esac
4826         fn=d~+
4827         rp='Pathname for the vendor-supplied library files?'
4828         . ./getfile
4829         vendorlib="$ans"
4830         vendorlibexp="$ansexp"
4831         : Change installation prefix, if necessary.
4832         if $test X"$prefix" != X"$installprefix"; then
4833                 installvendorlib=`echo $vendorlibexp | $sed "s#^$prefix#$installprefix#"`
4834         else
4835                 installvendorlib="$vendorlibexp"
4836         fi
4837         ;;
4838 esac
4839
4840 : Cruising for prototypes
4841 echo " "
4842 echo "Checking out function prototypes..." >&4
4843 $cat >prototype.c <<'EOCP'
4844 int main(int argc, char *argv[]) {
4845         exit(0);}
4846 EOCP
4847 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
4848         echo "Your C compiler appears to support function prototypes."
4849         val="$define"
4850 else
4851         echo "Your C compiler doesn't seem to understand function prototypes."
4852         val="$undef"
4853 fi
4854 set prototype
4855 eval $setvar
4856 $rm -f prototype*
4857
4858 case "$prototype" in
4859 "$define") ;;
4860 *)      ansi2knr='ansi2knr'
4861         echo " "
4862         cat <<EOM >&4
4863
4864 $me:  FATAL ERROR:
4865 This version of $package can only be compiled by a compiler that 
4866 understands function prototypes.  Unfortunately, your C compiler 
4867         $cc $ccflags
4868 doesn't seem to understand them.  Sorry about that.
4869
4870 If GNU cc is available for your system, perhaps you could try that instead.  
4871
4872 Eventually, we hope to support building Perl with pre-ANSI compilers.
4873 If you would like to help in that effort, please contact <perlbug@perl.org>.
4874
4875 Aborting Configure now.
4876 EOM
4877         exit 2
4878         ;;
4879 esac
4880
4881 : determine where public executables go
4882 echo " "
4883 set dflt bin bin
4884 eval $prefixit
4885 fn=d~
4886 rp='Pathname where the public executables will reside?'
4887 . ./getfile
4888 if $test "X$ansexp" != "X$binexp"; then
4889         installbin=''
4890 fi
4891 bin="$ans"
4892 binexp="$ansexp"
4893 : Change installation prefix, if necessary.
4894 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
4895 if $test X"$prefix" != X"$installprefix"; then
4896         installbin=`echo $binexp | sed "s#^$prefix#$installprefix#"`
4897 else
4898         installbin="$binexp"
4899 fi
4900
4901 : determine whether to install perl also as /usr/bin/perl
4902
4903 echo " "
4904 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
4905         $cat <<EOM
4906 Many scripts expect to perl to be installed as /usr/bin/perl.
4907 I can install the perl you are about to compile also as /usr/bin/perl
4908 (in addition to $installbin/perl).
4909 EOM
4910         case "$installusrbinperl" in
4911         "$undef"|[nN]*) dflt='n';;
4912         *)              dflt='y';;
4913         esac
4914         rp="Do you want to install perl as /usr/bin/perl?"
4915         . ./myread
4916         case "$ans" in
4917         [yY]*)  val="$define";;
4918         *)      val="$undef" ;;
4919         esac
4920 else
4921         val="$undef"
4922 fi
4923 set installusrbinperl
4924 eval $setvar
4925
4926 : define a shorthand compile call
4927 compile='
4928 mc_file=$1;
4929 shift;
4930 $cc $optimize $ccflags $ldflags -o ${mc_file} $* ${mc_file}.c $libs > /dev/null 2>&1;'
4931 : define a shorthand compile call for compilations that should be ok.
4932 compile_ok='
4933 mc_file=$1;
4934 shift;
4935 $cc $optimize $ccflags $ldflags -o ${mc_file} $* ${mc_file}.c $libs;'
4936
4937 echo " "
4938 echo "Checking for GNU C Library..." >&4
4939 cat >gnulibc.c <<EOM
4940 #include <stdio.h>
4941 int main()
4942 {
4943 #ifdef __GLIBC__
4944     exit(0);
4945 #else
4946     exit(1);
4947 #endif
4948 }
4949 EOM
4950 set gnulibc
4951 if eval $compile_ok && ./gnulibc; then
4952         val="$define"
4953         echo "You are using the GNU C Library"
4954 else
4955         val="$undef"
4956         echo "You are not using the GNU C Library"
4957 fi
4958 $rm -f gnulibc*
4959 set d_gnulibc
4960 eval $setvar
4961
4962 : see if nm is to be used to determine whether a symbol is defined or not
4963 case "$usenm" in
4964 '')
4965         dflt=''
4966         case "$d_gnulibc" in
4967         "$define")
4968                 echo " "
4969                 echo "nm probably won't work on the GNU C Library." >&4
4970                 dflt=n
4971                 ;;
4972         esac
4973         case "$dflt" in
4974         '') 
4975                 if $test "$osname" = aix -a ! -f /lib/syscalls.exp; then
4976                         echo " "
4977                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
4978                         echo "'nm' won't be sufficient on this sytem." >&4
4979                         dflt=n
4980                 fi
4981                 ;;
4982         esac
4983         case "$dflt" in
4984         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
4985                 if $test $dflt -gt 20; then
4986                         dflt=y
4987                 else
4988                         dflt=n
4989                 fi
4990                 ;;
4991         esac
4992         ;;
4993 *)
4994         case "$usenm" in
4995         true|$define) dflt=y;;
4996         *) dflt=n;;
4997         esac
4998         ;;
4999 esac
5000 $cat <<EOM
5001
5002 I can use $nm to extract the symbols from your C libraries. This
5003 is a time consuming task which may generate huge output on the disk (up
5004 to 3 megabytes) but that should make the symbols extraction faster. The
5005 alternative is to skip the 'nm' extraction part and to compile a small
5006 test program instead to determine whether each symbol is present. If
5007 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
5008 this may be the best solution.
5009
5010 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
5011
5012 EOM
5013 rp="Shall I use $nm to extract C symbols from the libraries?"
5014 . ./myread
5015 case "$ans" in
5016 [Nn]*) usenm=false;;
5017 *) usenm=true;;
5018 esac
5019
5020 runnm=$usenm
5021 case "$reuseval" in
5022 true) runnm=false;;
5023 esac
5024
5025 : nm options which may be necessary
5026 case "$nm_opt" in
5027 '') if $test -f /mach_boot; then
5028                 nm_opt=''       # Mach
5029         elif $test -d /usr/ccs/lib; then
5030                 nm_opt='-p'     # Solaris (and SunOS?)
5031         elif $test -f /dgux; then
5032                 nm_opt='-p'     # DG-UX
5033         elif $test -f /lib64/rld; then
5034                 nm_opt='-p'     # 64-bit Irix
5035         else
5036                 nm_opt=''
5037         fi;;
5038 esac
5039
5040 : nm options which may be necessary for shared libraries but illegal
5041 : for archive libraries.  Thank you, Linux.
5042 case "$nm_so_opt" in
5043 '')     case "$myuname" in
5044         *linux*)
5045                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
5046                         nm_so_opt='--dynamic'
5047                 fi
5048                 ;;
5049         esac
5050         ;;
5051 esac
5052
5053 case "$runnm" in
5054 true)
5055 : get list of predefined functions in a handy place
5056 echo " "
5057 case "$libc" in
5058 '') libc=unknown
5059         case "$libs" in
5060         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
5061         esac
5062         ;;
5063 esac
5064 libnames='';
5065 case "$libs" in
5066 '') ;;
5067 *)  for thislib in $libs; do
5068         case "$thislib" in
5069         -lc|-lc_s)
5070                 : Handle C library specially below.
5071                 ;;
5072         -l*)
5073                 thislib=`echo $thislib | $sed -e 's/^-l//'`
5074                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
5075                         :
5076                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
5077                         :
5078                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
5079                         :
5080                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
5081                         :
5082                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
5083                         :
5084                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
5085                         :
5086                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
5087                         :
5088                 else
5089                         try=''
5090                 fi
5091                 libnames="$libnames $try"
5092                 ;;
5093         *) libnames="$libnames $thislib" ;;
5094         esac
5095         done
5096         ;;
5097 esac
5098 xxx=normal
5099 case "$libc" in
5100 unknown)
5101         set /lib/libc.$so
5102         for xxx in $libpth; do
5103                 $test -r $1 || set $xxx/libc.$so
5104                 : The messy sed command sorts on library version numbers.
5105                 $test -r $1 || \
5106                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
5107                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
5108                                 h
5109                                 s/[0-9][0-9]*/0000&/g
5110                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
5111                                 G
5112                                 s/\n/ /' | \
5113                          sort | $sed -e 's/^.* //'`
5114                 eval set \$$#
5115         done
5116         $test -r $1 || set /usr/ccs/lib/libc.$so
5117         $test -r $1 || set /lib/libsys_s$_a
5118         ;;
5119 *)
5120         set blurfl
5121         ;;
5122 esac
5123 if $test -r "$1"; then
5124         echo "Your (shared) C library seems to be in $1."
5125         libc="$1"
5126 elif $test -r /lib/libc && $test -r /lib/clib; then
5127         echo "Your C library seems to be in both /lib/clib and /lib/libc."
5128         xxx=apollo
5129         libc='/lib/clib /lib/libc'
5130         if $test -r /lib/syslib; then
5131                 echo "(Your math library is in /lib/syslib.)"
5132                 libc="$libc /lib/syslib"
5133         fi
5134 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5135         echo "Your C library seems to be in $libc, as you said before."
5136 elif $test -r $incpath/usr/lib/libc$_a; then
5137         libc=$incpath/usr/lib/libc$_a;
5138         echo "Your C library seems to be in $libc.  That's fine."
5139 elif $test -r /lib/libc$_a; then
5140         libc=/lib/libc$_a;
5141         echo "Your C library seems to be in $libc.  You're normal."
5142 else
5143         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
5144                 :
5145         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
5146                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
5147         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
5148                 :
5149         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5150                 :
5151         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5152                 :
5153         else
5154                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
5155         fi
5156         if $test -r "$tans"; then
5157                 echo "Your C library seems to be in $tans, of all places."
5158                 libc=$tans
5159         else
5160                 libc='blurfl'
5161         fi
5162 fi
5163 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5164         dflt="$libc"
5165         cat <<EOM
5166
5167 If the guess above is wrong (which it might be if you're using a strange
5168 compiler, or your machine supports multiple models), you can override it here.
5169
5170 EOM
5171 else
5172         dflt=''
5173         echo $libpth | tr ' ' $trnl | sort | uniq > libpath
5174         cat >&4 <<EOM
5175 I can't seem to find your C library.  I've looked in the following places:
5176
5177 EOM
5178         $sed 's/^/      /' libpath
5179         cat <<EOM
5180
5181 None of these seems to contain your C library. I need to get its name...
5182
5183 EOM
5184 fi
5185 fn=f
5186 rp='Where is your C library?'
5187 . ./getfile
5188 libc="$ans"
5189
5190 echo " "
5191 echo $libc $libnames | tr ' ' $trnl | sort | uniq > libnames
5192 set X `cat libnames`
5193 shift
5194 xxx=files
5195 case $# in 1) xxx=file; esac
5196 echo "Extracting names from the following $xxx for later perusal:" >&4
5197 echo " "
5198 $sed 's/^/      /' libnames >&4
5199 echo " "
5200 $echo $n "This may take a while...$c" >&4
5201
5202 for file in $*; do
5203         case $file in
5204         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
5205         *) $nm $nm_opt $file 2>/dev/null;;
5206         esac
5207 done >libc.tmp
5208
5209 $echo $n ".$c"
5210 $grep fprintf libc.tmp > libc.ptf
5211 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
5212 xrun='eval "<libc.tmp $com >libc.list"; echo "done" >&4'
5213 xxx='[ADTSIW]'
5214 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *_[_.]*//p' -e 's/^.* $xxx  *//p'";\
5215         eval $xscan;\
5216         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5217                 eval $xrun
5218 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
5219         eval $xscan;\
5220         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5221                 eval $xrun
5222 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
5223         eval $xscan;\
5224         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5225                 eval $xrun
5226 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
5227         eval $xscan;\
5228         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5229                 eval $xrun
5230 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
5231         eval $xscan;\
5232         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5233                 eval $xrun
5234 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
5235         eval $xscan;\
5236         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5237                 eval $xrun
5238 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
5239                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
5240         eval $xscan;\
5241         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5242                 eval $xrun
5243 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
5244         eval $xscan;\
5245         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5246                 eval $xrun
5247 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
5248         eval $xscan;\
5249         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5250                 eval $xrun
5251 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
5252         eval $xscan;\
5253         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5254                 eval $xrun
5255 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
5256         eval $xscan;\
5257         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5258                 eval $xrun
5259 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
5260         eval $xscan;\
5261         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5262                 eval $xrun
5263 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
5264         eval $xscan;\
5265         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5266                 eval $xrun
5267 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
5268         eval $xscan;\
5269         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5270                 eval $xrun
5271 else
5272         $nm -p $* 2>/dev/null >libc.tmp
5273         $grep fprintf libc.tmp > libc.ptf
5274         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
5275                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
5276         then
5277                 nm_opt='-p'
5278                 eval $xrun
5279         else
5280                 echo " "
5281                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
5282                 com=''
5283                 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
5284                         for thisname in $libnames $libc; do
5285                                 $ar t $thisname >>libc.tmp
5286                         done
5287                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
5288                         echo "Ok." >&4
5289                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
5290                         # Repeat libc to extract forwarders to DLL entries too
5291                         for thisname in $libnames $libc; do
5292                                 $ar tv $thisname >>libc.tmp
5293                                 # Revision 50 of EMX has bug in $ar.
5294                                 # it will not extract forwarders to DLL entries
5295                                 # Use emximp which will extract exactly them.
5296                                 emximp -o tmp.imp $thisname \
5297                                     2>/dev/null && \
5298                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
5299                                     < tmp.imp >>libc.tmp
5300                                 $rm tmp.imp
5301                         done
5302                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
5303                         echo "Ok." >&4
5304                 else
5305                         echo "$ar didn't seem to work right." >&4
5306                         echo "Maybe this is a Cray...trying bld instead..." >&4
5307                         if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
5308                         then
5309                                 for thisname in $libnames; do
5310                                         bld t $libnames | \
5311                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
5312                                         $ar t $thisname >>libc.tmp
5313                                 done
5314                                 echo "Ok." >&4
5315                         else
5316                                 echo "That didn't work either.  Giving up." >&4
5317                                 exit 1
5318                         fi
5319                 fi
5320         fi
5321 fi
5322 nm_extract="$com"
5323 if $test -f /lib/syscalls.exp; then
5324         echo " "
5325         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
5326         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*$/\1/p' /lib/syscalls.exp >>libc.list
5327 fi
5328 ;;
5329 esac
5330 $rm -f libnames libpath
5331
5332 : see if dld is available
5333 set dld.h i_dld
5334 eval $inhdr
5335
5336 : is a C symbol defined?
5337 csym='tlook=$1;
5338 case "$3" in
5339 -v) tf=libc.tmp; tc=""; tdc="";;
5340 -a) tf=libc.tmp; tc="[0]"; tdc="[]";;
5341 *) tlook="^$1\$"; tf=libc.list; tc="()"; tdc="()";;
5342 esac;
5343 tx=yes;
5344 case "$reuseval-$4" in
5345 true-) ;;
5346 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
5347 esac;
5348 case "$tx" in
5349 yes)
5350         case "$runnm" in
5351         true)
5352                 if $contains $tlook $tf >/dev/null 2>&1;
5353                 then tval=true;
5354                 else tval=false;
5355                 fi;;
5356         *)
5357                 echo "int main() { extern short $1$tdc; printf(\"%hd\", $1$tc); }" > t.c;
5358                 if $cc $optimize $ccflags $ldflags -o t t.c $libs >/dev/null 2>&1;
5359                 then tval=true;
5360                 else tval=false;
5361                 fi;
5362                 $rm -f t t.c;;
5363         esac;;
5364 *)
5365         case "$tval" in
5366         $define) tval=true;;
5367         *) tval=false;;
5368         esac;;
5369 esac;
5370 eval "$2=$tval"'
5371
5372 : define an is-in-libc? function
5373 inlibc='echo " "; td=$define; tu=$undef;
5374 sym=$1; var=$2; eval "was=\$$2";
5375 tx=yes;
5376 case "$reuseval$was" in
5377 true) ;;
5378 true*) tx=no;;
5379 esac;
5380 case "$tx" in
5381 yes)
5382         set $sym tres -f;
5383         eval $csym;
5384         case "$tres" in
5385         true)
5386                 echo "$sym() found." >&4;
5387                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
5388         *)
5389                 echo "$sym() NOT found." >&4;
5390                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
5391         esac;;
5392 *)
5393         case "$was" in
5394         $define) echo "$sym() found." >&4;;
5395         *) echo "$sym() NOT found." >&4;;
5396         esac;;
5397 esac'
5398
5399 : see if dlopen exists
5400 xxx_runnm="$runnm"
5401 runnm=false
5402 set dlopen d_dlopen
5403 eval $inlibc
5404 runnm="$xxx_runnm"
5405
5406 : determine which dynamic loading, if any, to compile in
5407 echo " "
5408 dldir="ext/DynaLoader"
5409 case "$usedl" in
5410 $define|y|true)
5411         dflt='y'
5412         usedl="$define"
5413         ;;
5414 $undef|n|false)
5415         dflt='n'
5416         usedl="$undef"
5417         ;;
5418 *) 
5419         dflt='n'
5420         case "$d_dlopen" in
5421             $define) dflt='y' ;;
5422         esac
5423         case "$i_dld" in
5424             $define) dflt='y' ;;
5425         esac
5426         : Does a dl_xxx.xs file exist for this operating system
5427         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
5428         ;;
5429 esac
5430 rp="Do you wish to use dynamic loading?"
5431 . ./myread
5432 usedl="$ans"
5433 case "$ans" in
5434 y*) usedl="$define"
5435         case "$dlsrc" in
5436         '')
5437                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
5438                         dflt="$dldir/dl_${osname}.xs"
5439                 elif $test "$d_dlopen" = "$define" ; then
5440                         dflt="$dldir/dl_dlopen.xs"
5441                 elif $test "$i_dld" = "$define" ; then
5442                         dflt="$dldir/dl_dld.xs"
5443                 else
5444                         dflt=''
5445                 fi
5446                 ;;
5447         *)      dflt="$dldir/$dlsrc"
5448                 ;;
5449         esac
5450     echo "The following dynamic loading files are available:"
5451         : Can not go over to $dldir because getfile has path hard-coded in.
5452         tdir=`pwd`; cd $rsrc; $ls -C $dldir/dl*.xs; cd $tdir
5453         rp="Source file to use for dynamic loading"
5454         fn="fne"
5455         gfpth="$src"
5456         . ./getfile
5457         usedl="$define"
5458         : emulate basename
5459         dlsrc=`echo $ans | $sed -e 's@.*/\([^/]*\)$@\1@'`
5460
5461         $cat << EOM
5462
5463 Some systems may require passing special flags to $cc -c to
5464 compile modules that will be used to create a shared library.
5465 To use no flags, say "none".
5466
5467 EOM
5468     case "$cccdlflags" in
5469     '') case "$gccversion" in
5470                 '') case "$osname" in
5471                         hpux)   dflt='+z' ;;
5472                         next)   dflt='none' ;;
5473                         irix*)  dflt='-KPIC' ;;
5474                         svr4*|esix*|solaris) dflt='-KPIC' ;;
5475                         sunos)  dflt='-pic' ;;
5476                         *)      dflt='none' ;;
5477                     esac
5478                         ;;
5479                 *)  case "$osname" in
5480                         svr4*|esix*|solaris) dflt='-fPIC' ;;
5481                         *)      dflt='-fpic' ;;
5482                     esac ;;
5483             esac ;;
5484         ' ') dflt='none' ;;
5485     *)  dflt="$cccdlflags" ;;
5486     esac
5487     rp="Any special flags to pass to $cc -c to compile shared library modules?"
5488     . ./myread
5489     case "$ans" in
5490     none) cccdlflags=' ' ;;
5491     *) cccdlflags="$ans" ;;
5492     esac
5493
5494     cat << EOM
5495
5496 Some systems use ld to create libraries that can be dynamically loaded,
5497 while other systems (such as those using ELF) use $cc.
5498
5499 EOM
5500         case "$ld" in
5501         '')     $cat >try.c <<'EOM'
5502 /* Test for whether ELF binaries are produced */
5503 #include <fcntl.h>
5504 #include <stdlib.h>
5505 int main() {
5506         char b[4];
5507         int i = open("a.out",O_RDONLY);
5508         if(i == -1) 
5509                 exit(1); /* fail */
5510         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
5511                 exit(0); /* succeed (yes, it's ELF) */
5512         else
5513                 exit(1); /* fail */
5514 }
5515 EOM
5516                 if $cc $ccflags try.c >/dev/null 2>&1 && ./a.out; then
5517                         cat <<EOM
5518 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
5519 EOM
5520                         dflt="$cc"
5521                 else
5522                         echo "I'll use ld to build dynamic libraries."
5523                         dflt='ld'
5524                 fi
5525                 rm -f try.c a.out
5526                 ;;
5527         *)      dflt="$ld"
5528                 ;;
5529         esac
5530
5531     rp="What command should be used to create dynamic libraries?"
5532     . ./myread
5533         ld="$ans"
5534
5535     cat << EOM
5536
5537 Some systems may require passing special flags to $ld to create a
5538 library that can be dynamically loaded.  If your ld flags include
5539 -L/other/path options to locate libraries outside your loader's normal
5540 search path, you may need to specify those -L options here as well.  To
5541 use no flags, say "none".
5542
5543 EOM
5544     case "$lddlflags" in
5545     '') case "$osname" in
5546                         beos) dflt='-nostart' ;;
5547                         hpux)  dflt='-b' ;;
5548                         linux|irix*)    dflt='-shared' ;;
5549                         next)  dflt='none' ;;
5550                         solaris) dflt='-G' ;;
5551                         sunos) dflt='-assert nodefinitions' ;;
5552                         svr4*|esix*) dflt="-G $ldflags" ;;
5553                 *)     dflt='none' ;;
5554                         esac
5555                         ;;
5556     *) dflt="$lddlflags" ;;
5557     esac
5558
5559         : Try to guess additional flags to pick up local libraries.
5560         : Be careful not to append to a plain 'none'
5561         case "$dflt" in
5562         none) dflt='' ;;
5563         esac
5564         for thisflag in $ldflags; do
5565                 case "$thisflag" in
5566                 -L*)
5567                         case " $dflt " in
5568                         *" $thisflag "*) ;;
5569                         *) dflt="$dflt $thisflag" ;;
5570                         esac
5571                         ;;
5572                 esac
5573         done
5574
5575         case "$dflt" in
5576         ''|' ') dflt='none' ;;
5577         esac
5578
5579     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
5580     . ./myread
5581     case "$ans" in
5582     none) lddlflags=' ' ;;
5583     *) lddlflags="$ans" ;;
5584     esac
5585
5586         cat <<EOM
5587
5588 Some systems may require passing special flags to $cc to indicate that
5589 the resulting executable will use dynamic linking.  To use no flags,
5590 say "none".
5591
5592 EOM
5593     case "$ccdlflags" in
5594     '') case "$osname" in
5595                 hpux)   dflt='-Wl,-E' ;;
5596                 linux)  dflt='-rdynamic' ;;
5597                 next)   dflt='none' ;;
5598                 sunos)  dflt='none' ;;
5599                 *)      dflt='none' ;;
5600             esac ;;
5601     ' ')  dflt='none' ;;
5602     *)  dflt="$ccdlflags" ;;
5603     esac
5604     rp="Any special flags to pass to $cc to use dynamic loading?"
5605     . ./myread
5606     case "$ans" in
5607     none) ccdlflags=' ' ;;
5608     *) ccdlflags="$ans" ;;
5609     esac
5610     ;;
5611 *)  usedl="$undef"
5612         ld='ld'
5613     dlsrc='dl_none.xs'
5614     lddlflags=''
5615     ccdlflags=''
5616     ;;
5617 esac
5618
5619 also=''
5620 case "$usedl" in
5621 $undef)
5622         # No dynamic loading being used, so don't bother even to prompt.
5623         useshrplib='false'
5624         ;;
5625 *)      case "$useshrplib" in
5626         '')     case "$osname" in
5627                 svr4*|dgux|dynixptx|esix|powerux|beos)
5628                         dflt=y
5629                         also='Building a shared libperl is required for dynamic loading to work on your system.'
5630                         ;;
5631                 next*)
5632                         case "$osvers" in
5633                         4*)     dflt=y
5634                                 also='Building a shared libperl is needed for MAB support.'
5635                                 ;;
5636                         *)      dflt=n
5637                                 ;;
5638                         esac
5639                         ;;
5640                 *)      dflt=n
5641                         ;;
5642                 esac
5643                 ;;
5644         $define|true|[Yy]*)
5645                 dflt=y
5646                 ;;
5647         *)      dflt=n
5648                 ;;
5649         esac
5650         $cat << EOM
5651
5652 The perl executable is normally obtained by linking perlmain.c with
5653 libperl${_a}, any static extensions (usually just DynaLoader), and
5654 any other libraries needed on this system (such as -lm, etc.).  Since
5655 your system supports dynamic loading, it is probably possible to build
5656 a shared libperl.$so.  If you will have more than one executable linked
5657 to libperl.$so, this will significantly reduce the size of each
5658 executable, but it may have a noticeable affect on performance.  The
5659 default is probably sensible for your system.
5660 $also
5661
5662 EOM
5663         rp="Build a shared libperl.$so (y/n)"
5664         . ./myread
5665         case "$ans" in
5666         true|$define|[Yy]*)
5667                 useshrplib='true'  ;;
5668         *)      useshrplib='false' ;;
5669         esac
5670         ;;
5671 esac
5672
5673 case "$useshrplib" in
5674 true)
5675         case "$libperl" in
5676         '')
5677                 # Figure out a good name for libperl.so.  Since it gets stored in
5678                 # a version-specific architecture-dependent library, the version
5679                 # number isn't really that important, except for making cc/ld happy.
5680                 #
5681                 # A name such as libperl.so.3.1
5682                 majmin="libperl.$so.$patchlevel.$subversion"
5683                 # A name such as libperl.so.301
5684                 majonly=`echo $patchlevel $subversion |
5685                         $awk '{printf "%d%02d", $1, $2}'`
5686                 majonly=libperl.$so.$majonly
5687                 # I'd prefer to keep the os-specific stuff here to a minimum, and
5688                 # rely on figuring it out from the naming of libc.
5689                 case "${osname}${osvers}" in
5690                 next4*)
5691                         dflt=libperl.5.$so
5692                         # XXX How handle the --version stuff for MAB?
5693                         ;;
5694                 linux*)  # ld won't link with a bare -lperl otherwise.
5695                         dflt=libperl.$so
5696                         ;;
5697                 *)      # Try to guess based on whether libc has major.minor.
5698                         case "$libc" in
5699                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
5700                         *libc.$so.[0-9]*) dflt=$majonly ;;
5701                         *)      dflt=libperl.$so ;;
5702                         esac
5703                         ;;
5704                 esac
5705                 ;;
5706         *)      dflt=$libperl
5707                 ;;
5708         esac
5709         cat << EOM
5710
5711 I need to select a good name for the shared libperl.  If your system uses
5712 library names with major and minor numbers, then you might want something
5713 like $majmin.  Alternatively, if your system uses a single version
5714 number for shared libraries, then you might want to use $majonly.
5715 Or, your system might be quite happy with a simple libperl.$so.
5716
5717 Since the shared libperl will get installed into a version-specific
5718 architecture-dependent directory, the version number of the shared perl
5719 library probably isn't important, so the default should be o.k.
5720
5721 EOM
5722         rp='What name do you want to give to the shared libperl?'
5723         . ./myread
5724         libperl=$ans
5725         echo "Ok, I'll use $libperl"
5726         ;;
5727 *)
5728         libperl="libperl${_a}"
5729         ;;
5730 esac
5731
5732 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
5733 case "$shrpdir" in
5734 '') ;;
5735 *)      $cat >&4 <<EOM
5736 WARNING:  Use of the shrpdir variable for the installation location of
5737 the shared $libperl is not supported.  It was never documented and
5738 will not work in this version.  Let me (perlbug@perl.com)
5739 know of any problems this may cause.
5740
5741 EOM
5742         case "$shrpdir" in
5743         "$archlibexp/CORE")
5744                 $cat >&4 <<EOM
5745 But your current setting of $shrpdir is
5746 the default anyway, so it's harmless.
5747 EOM
5748                 ;;
5749         *)
5750                 $cat >&4 <<EOM
5751 Further, your current attempted setting of $shrpdir
5752 conflicts with the value of $archlibexp/CORE
5753 that installperl will use.
5754 EOM
5755                 ;;
5756         esac
5757         ;;
5758 esac
5759
5760 # How will the perl executable find the installed shared $libperl?
5761 # Add $xxx to ccdlflags.
5762 # If we can't figure out a command-line option, use $shrpenv to
5763 # set env LD_RUN_PATH.  The main perl makefile uses this.
5764 shrpdir=$archlibexp/CORE
5765 xxx=''
5766 tmp_shrpenv=''
5767 if "$useshrplib"; then
5768     case "$osname" in 
5769         aix)
5770                 # We'll set it in Makefile.SH...
5771                 ;;
5772         solaris|netbsd)
5773                 xxx="-R $shrpdir"
5774                 ;;
5775         freebsd)
5776                 xxx="-Wl,-R$shrpdir"
5777                 ;;
5778         linux|irix*|dec_osf)
5779                 xxx="-Wl,-rpath,$shrpdir"
5780                 ;;
5781         next)
5782                 # next doesn't like the default...
5783                 ;;
5784         beos)
5785                 # beos doesn't like the default, either.
5786                 ;;
5787         hpux*)
5788                 # hpux doesn't like the default, either.
5789                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
5790                 ;;
5791         *)
5792                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
5793                 ;;
5794         esac
5795         case "$xxx" in
5796         '') ;;
5797         *)      
5798                 # Only add $xxx if it isn't already in ccdlflags.
5799                 case " $ccdlflags " in
5800                 *" $xxx "*)     ;;
5801                 *)      ccdlflags="$ccdlflags $xxx"
5802                         cat <<EOM >&4
5803
5804 Adding $xxx to the flags
5805 passed to $ld so that the perl executable will find the 
5806 installed shared $libperl.
5807
5808 EOM
5809                         ;;
5810                 esac
5811                 ;;
5812         esac
5813 fi
5814 # Fix ccdlflags in AIX for building external extensions.
5815 # (For building Perl itself bare -bE:perl.exp is needed,
5816 #  Makefile.SH takes care of this.)
5817 case "$osname" in
5818 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
5819 esac
5820 # Respect a hint or command-line value.
5821 case "$shrpenv" in
5822 '') shrpenv="$tmp_shrpenv" ;;
5823 esac
5824 case "$ldlibpthname" in
5825 '')     ldlibpthname=LD_LIBRARY_PATH ;;
5826 none)   ldlibpthname='' ;;
5827 esac
5828
5829 : determine where manual pages go
5830 set man1dir man1dir none
5831 eval $prefixit
5832 $cat <<EOM
5833
5834 $spackage has manual pages available in source form.
5835 EOM
5836 case "$nroff" in
5837 nroff)
5838         echo "However, you don't have nroff, so they're probably useless to you."
5839         case "$man1dir" in
5840         '') man1dir="none";;
5841         esac;;
5842 esac
5843 echo "If you don't want the manual sources installed, answer 'none'."
5844 case "$man1dir" in
5845 ' ') dflt=none
5846         ;;
5847 '')
5848         lookpath="$prefixexp/man/man1 $prefixexp/man/l_man/man1"
5849         lookpath="$lookpath $prefixexp/man/p_man/man1"
5850         lookpath="$lookpath $prefixexp/man/u_man/man1"
5851         lookpath="$lookpath $prefixexp/man/man.1"
5852         case "$sysman" in
5853         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
5854         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
5855         esac
5856         set dflt
5857         eval $prefixup
5858         ;;
5859 *)  dflt="$man1dir"
5860         ;;
5861 esac
5862 echo " "
5863 fn=dn+~
5864 rp="Where do the main $spackage manual pages (source) go?"
5865 . ./getfile
5866 if $test "X$man1direxp" != "X$ansexp"; then
5867         installman1dir=''
5868 fi
5869 man1dir="$ans"
5870 man1direxp="$ansexp"
5871 case "$man1dir" in
5872 '')     man1dir=' '
5873         installman1dir='';;
5874 esac
5875
5876 : Change installation prefix, if necessary.
5877 if $test X"$prefix" != X"$installprefix"; then
5878         installman1dir=`echo $man1direxp | $sed "s#^$prefix#$installprefix#"`
5879 else
5880         installman1dir="$man1direxp"
5881 fi
5882
5883 : What suffix to use on installed man pages
5884
5885 case "$man1dir" in
5886 ' ')
5887         man1ext='0'
5888         ;;
5889 *)
5890         rp="What suffix should be used for the main $spackage man pages?"
5891         case "$man1ext" in
5892         '')     case "$man1dir" in
5893                 *1)  dflt=1 ;;
5894                 *1p) dflt=1p ;;
5895                 *1pm) dflt=1pm ;;
5896                 *l) dflt=l;;
5897                 *n) dflt=n;;
5898                 *o) dflt=o;;
5899                 *p) dflt=p;;
5900                 *C) dflt=C;;
5901                 *L) dflt=L;;
5902                 *L1) dflt=L1;;
5903                 *) dflt=1;;
5904                 esac
5905                 ;;
5906         *)      dflt="$man1ext";;
5907         esac
5908         . ./myread
5909         man1ext="$ans"
5910         ;;
5911 esac
5912
5913 : see if we can have long filenames
5914 echo " "
5915 rmlist="$rmlist /tmp/cf$$"
5916 $test -d /tmp/cf$$ || mkdir /tmp/cf$$
5917 first=123456789abcdef
5918 second=/tmp/cf$$/$first
5919 $rm -f $first $second
5920 if (echo hi >$first) 2>/dev/null; then
5921         if $test -f 123456789abcde; then
5922                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
5923                 val="$undef"
5924         else
5925                 if (echo hi >$second) 2>/dev/null; then
5926                         if $test -f /tmp/cf$$/123456789abcde; then
5927                                 $cat <<'EOM'
5928 That's peculiar... You can have filenames longer than 14 characters, but only
5929 on some of the filesystems.  Maybe you are using NFS.  Anyway, to avoid problems
5930 I shall consider your system cannot support long filenames at all.
5931 EOM
5932                                 val="$undef"
5933                         else
5934                                 echo 'You can have filenames longer than 14 characters.' >&4
5935                                 val="$define"
5936                         fi
5937                 else
5938                         $cat <<'EOM'
5939 How confusing! Some of your filesystems are sane enough to allow filenames
5940 longer than 14 characters but some others like /tmp can't even think about them.
5941 So, for now on, I shall assume your kernel does not allow them at all.
5942 EOM
5943                         val="$undef"
5944                 fi
5945         fi
5946 else
5947         $cat <<'EOM'
5948 You can't have filenames longer than 14 chars.  You can't even think about them!
5949 EOM
5950         val="$undef"
5951 fi 
5952 set d_flexfnam
5953 eval $setvar
5954 $rm -rf /tmp/cf$$ 123456789abcde*
5955
5956 : determine where library module manual pages go
5957 set man3dir man3dir none
5958 eval $prefixit
5959 $cat <<EOM
5960
5961 $spackage has manual pages for many of the library modules.
5962 EOM
5963
5964 case "$nroff" in
5965 nroff)
5966         $cat <<'EOM'
5967 However, you don't have nroff, so they're probably useless to you.
5968 EOM
5969         case "$man3dir" in
5970         '') man3dir="none";;
5971         esac;;
5972 esac
5973
5974 case "$d_flexfnam" in
5975 undef)
5976         $cat <<'EOM'
5977 However, your system can't handle the long file names like File::Basename.3. 
5978 EOM
5979         case "$man3dir" in
5980         '') man3dir="none";;
5981         esac;;
5982 esac
5983
5984 echo "If you don't want the manual sources installed, answer 'none'."
5985 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
5986 case "$man3dir" in
5987 '')     dflt=`echo $man1dir | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
5988         if $test -d "$privlib/man/man3"; then
5989                 cat <<EOM >&4
5990
5991 WARNING:  Previous versions of perl installed man3 pages into
5992 $privlib/man/man3.  This version will suggest a 
5993 new default of $dflt.  
5994 EOM
5995                 tdflt=$dflt
5996                 dflt='n'
5997                 rp='Do you wish to preserve the old behavior?(y/n)'
5998                 . ./myread
5999                 case "$ans" in
6000                 y*) dflt="$privlib/man/man3" ;;
6001                 *)  dflt=$tdflt ;;
6002                 esac
6003     fi
6004         ;;
6005 ' ') dflt=none;;
6006 *)      dflt="$man3dir" ;;
6007 esac
6008 echo " "
6009 fn=dn+~
6010 rp="Where do the $package library man pages (source) go?"
6011 . ./getfile
6012 man3dir="$ans"
6013 man3direxp="$ansexp"
6014 case "$man1dir" in
6015 '')     man3dir=' '
6016         installman3dir='';;
6017 esac
6018
6019 : Change installation prefix, if necessary.
6020 if $test X"$prefix" != X"$installprefix"; then
6021         installman3dir=`echo $man3direxp | $sed "s#^$prefix#$installprefix#"`
6022 else
6023         installman3dir="$man3direxp"
6024 fi
6025
6026 : What suffix to use on installed man pages
6027 case "$man3dir" in
6028 ' ')
6029         man3ext='0'
6030         ;;
6031 *)
6032         rp="What suffix should be used for the $package library man pages?"
6033         case "$man3ext" in
6034         '')     case "$man3dir" in
6035                 *3)  dflt=3 ;;
6036                 *3p) dflt=3p ;;
6037                 *3pm) dflt=3pm ;;
6038                 *l) dflt=l;;
6039                 *n) dflt=n;;
6040                 *o) dflt=o;;
6041                 *p) dflt=p;;
6042                 *C) dflt=C;;
6043                 *L) dflt=L;;
6044                 *L3) dflt=L3;;
6045                 *) dflt=3;;
6046                 esac
6047                 ;;
6048         *)      dflt="$man3ext";;
6049         esac
6050         . ./myread
6051         man3ext="$ans"
6052         ;;
6053 esac
6054
6055 : see if we have to deal with yellow pages, now NIS.
6056 if $test -d /usr/etc/yp || $test -d /etc/yp; then
6057         if $test -f /usr/etc/nibindd; then
6058                 echo " "
6059                 echo "I'm fairly confident you're on a NeXT."
6060                 echo " "
6061                 rp='Do you get the hosts file via NetInfo?'
6062                 dflt=y
6063                 case "$hostcat" in
6064                 nidump*) ;;
6065                 '') ;;
6066                 *) dflt=n;;
6067                 esac
6068                 . ./myread
6069                 case "$ans" in
6070                 y*) hostcat='nidump hosts .';;
6071                 *)      case "$hostcat" in
6072                         nidump*) hostcat='';;
6073                         esac
6074                         ;;
6075                 esac
6076         fi
6077         case "$hostcat" in
6078         nidump*) ;;
6079         *)
6080                 case "$hostcat" in
6081                 *ypcat*) dflt=y;;
6082                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
6083                                 dflt=y
6084                         else
6085                                 dflt=n
6086                         fi;;
6087                 *) dflt=n;;
6088                 esac
6089                 echo " "
6090                 rp='Are you getting the hosts file via yellow pages?'
6091                 . ./myread
6092                 case "$ans" in
6093                 y*) hostcat='ypcat hosts';;
6094                 *) hostcat='cat /etc/hosts';;
6095                 esac
6096                 ;;
6097         esac
6098 fi
6099 case "$hostcat" in
6100 '') hostcat='cat /etc/hosts';;
6101 esac
6102 case "$groupcat" in
6103 '') groupcat='cat /etc/group';;
6104 esac
6105 case "$passcat" in
6106 '') passcat='cat /etc/passwd';;
6107 esac
6108
6109 : now get the host name
6110 echo " "
6111 echo "Figuring out host name..." >&4
6112 case "$myhostname" in
6113 '') cont=true
6114         echo 'Maybe "hostname" will work...'
6115         if tans=`sh -c hostname 2>&1` ; then
6116                 myhostname=$tans
6117                 phostname=hostname
6118                 cont=''
6119         fi
6120         ;;
6121 *) cont='';;
6122 esac
6123 if $test "$cont"; then
6124         if ./xenix; then
6125                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
6126                 if tans=`cat /etc/systemid 2>&1` ; then
6127                         myhostname=$tans
6128                         phostname='cat /etc/systemid'
6129                         echo "Whadyaknow.  Xenix always was a bit strange..."
6130                         cont=''
6131                 fi
6132         elif $test -r /etc/systemid; then
6133                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
6134         fi
6135 fi
6136 if $test "$cont"; then
6137         echo 'No, maybe "uuname -l" will work...'
6138         if tans=`sh -c 'uuname -l' 2>&1` ; then
6139                 myhostname=$tans
6140                 phostname='uuname -l'
6141         else
6142                 echo 'Strange.  Maybe "uname -n" will work...'
6143                 if tans=`sh -c 'uname -n' 2>&1` ; then
6144                         myhostname=$tans
6145                         phostname='uname -n'
6146                 else
6147                         echo 'Oh well, maybe I can mine it out of whoami.h...'
6148                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
6149                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
6150                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
6151                         else
6152                                 case "$myhostname" in
6153                                 '') echo "Does this machine have an identity crisis or something?"
6154                                         phostname='';;
6155                                 *)
6156                                         echo "Well, you said $myhostname before..."
6157                                         phostname='echo $myhostname';;
6158                                 esac
6159                         fi
6160                 fi
6161         fi
6162 fi
6163 : you do not want to know about this
6164 set $myhostname
6165 myhostname=$1
6166
6167 : verify guess
6168 if $test "$myhostname" ; then
6169         dflt=y
6170         rp='Your host name appears to be "'$myhostname'".'" Right?"
6171         . ./myread
6172         case "$ans" in
6173         y*) ;;
6174         *) myhostname='';;
6175         esac
6176 fi
6177
6178 : bad guess or no guess
6179 while $test "X$myhostname" = X ; do
6180         dflt=''
6181         rp="Please type the (one word) name of your host:"
6182         . ./myread
6183         myhostname="$ans"
6184 done
6185
6186 : translate upper to lower if necessary
6187 case "$myhostname" in
6188 *[A-Z]*)
6189         echo "(Normalizing case in your host name)"
6190         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
6191         ;;
6192 esac
6193
6194 case "$myhostname" in
6195 *.*)
6196         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
6197         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
6198         echo "(Trimming domain name from host name--host name is now $myhostname)"
6199         ;;
6200 *) case "$mydomain" in
6201         '')
6202                 {
6203                         test "X$hostcat" = "Xypcat hosts" &&
6204                         ypmatch "$myhostname" hosts 2>/dev/null |\
6205                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
6206                         $test -s hosts
6207                 } || {
6208                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
6209                                         /[       ]$myhostname[  . ]/p" > hosts
6210                 }
6211                 tmp_re="[       . ]"
6212                 $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
6213                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
6214                 dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
6215                         hosts | $sort | $uniq | \
6216                         $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
6217                 case `$echo X$dflt` in
6218                 X*\ *)  echo "(Several hosts in /etc/hosts matched hostname)"
6219                         dflt=.
6220                         ;;
6221                 X.) echo "(You do not have fully-qualified names in /etc/hosts)"
6222                         ;;
6223                 esac
6224                 case "$dflt" in
6225                 .)
6226                         tans=`./loc resolv.conf X /etc /usr/etc`
6227                         if $test -f "$tans"; then
6228                                 echo "(Attempting domain name extraction from $tans)"
6229                                 dflt=.`$sed -n -e 's/   / /g' \
6230                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
6231                                   | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
6232                                 case "$dflt" in
6233                                 .) dflt=.`$sed -n -e 's/        / /g' \
6234                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
6235                                      | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
6236                                         ;;
6237                                 esac
6238                         fi
6239                         ;;
6240                 esac
6241                 case "$dflt" in
6242                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
6243                         dflt=.`sh -c domainname 2>/dev/null`
6244                         case "$dflt" in
6245                         '') dflt='.';;
6246                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
6247                         esac
6248                         ;;
6249                 esac
6250                 case "$dflt" in
6251                 .) echo "(Lost all hope -- silly guess then)"
6252                         dflt='.uucp'
6253                         ;;
6254                 esac
6255                 $rm -f hosts
6256                 ;;
6257         *) dflt="$mydomain";;
6258         esac;;
6259 esac
6260 echo " "
6261 rp="What is your domain name?"
6262 . ./myread
6263 tans="$ans"
6264 case "$ans" in
6265 '') ;;
6266 .*) ;;
6267 *) tans=".$tans";;
6268 esac
6269 mydomain="$tans"
6270
6271 : translate upper to lower if necessary
6272 case "$mydomain" in
6273 *[A-Z]*)
6274         echo "(Normalizing case in your domain name)"
6275         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
6276         ;;
6277 esac
6278
6279 : a little sanity check here
6280 case "$phostname" in
6281 '') ;;
6282 *)
6283         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
6284         $myhostname$mydomain|$myhostname) ;;
6285         *)
6286                 case "$phostname" in
6287                 sed*)
6288                         echo "(That doesn't agree with your whoami.h file, by the way.)"
6289                         ;;
6290                 *)
6291                         echo "(That doesn't agree with your $phostname command, by the way.)"
6292                         ;;
6293                 esac
6294         ;;
6295         esac
6296         ;;
6297 esac
6298
6299 $cat <<EOM
6300
6301 I need to get your e-mail address in Internet format if possible, i.e.
6302 something like user@host.domain. Please answer accurately since I have
6303 no easy means to double check it. The default value provided below
6304 is most probably close to the reality but may not be valid from outside
6305 your organization...
6306
6307 EOM
6308 cont=x
6309 while test "$cont"; do
6310         case "$cf_email" in
6311         '') dflt="$cf_by@$myhostname$mydomain";;
6312         *) dflt="$cf_email";;
6313         esac
6314         rp='What is your e-mail address?'
6315         . ./myread
6316         cf_email="$ans"
6317         case "$cf_email" in
6318         *@*.*) cont='' ;;
6319         *)
6320                 rp='Address does not look like an Internet one.  Use it anyway?'
6321                 case "$fastread" in
6322                 yes) dflt=y ;;
6323                 *) dflt=n ;;
6324                 esac
6325                 . ./myread
6326                 case "$ans" in
6327                 y*) cont='' ;;
6328                 *) echo " " ;;
6329                 esac
6330                 ;;
6331         esac
6332 done
6333
6334 $cat <<EOM
6335
6336 If you or somebody else will be maintaining perl at your site, please
6337 fill in the correct e-mail address here so that they may be contacted
6338 if necessary. Currently, the "perlbug" program included with perl
6339 will send mail to this address in addition to perlbug@perl.com. You may
6340 enter "none" for no administrator.
6341
6342 EOM
6343 case "$perladmin" in
6344 '') dflt="$cf_email";;
6345 *) dflt="$perladmin";;
6346 esac
6347 rp='Perl administrator e-mail address'
6348 . ./myread
6349 perladmin="$ans"
6350
6351 : figure out how to guarantee perl startup
6352 case "$startperl" in
6353 '')
6354         case "$sharpbang" in
6355         *!)
6356                 $cat <<EOH
6357
6358 I can use the #! construct to start perl on your system. This will
6359 make startup of perl scripts faster, but may cause problems if you
6360 want to share those scripts and perl is not in a standard place
6361 ($binexp/perl) on all your platforms. The alternative is to force
6362 a shell by starting the script with a single ':' character.
6363
6364 EOH
6365                 dflt="$binexp/perl"
6366                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
6367                 . ./myread
6368                 case "$ans" in
6369                 none)   startperl=": # use perl";;
6370                 *)      startperl="#!$ans"
6371                         if $test 30 -lt `echo "$ans" | wc -c`; then
6372                                 $cat >&4 <<EOM
6373
6374 WARNING:  Some systems limit the #! command to 32 characters.
6375 If you experience difficulty running Perl scripts with #!, try
6376 installing Perl in a directory with a shorter pathname.
6377
6378 EOM
6379                         fi ;;
6380                 esac
6381                 ;;
6382         *) startperl=": # use perl"
6383                 ;;
6384         esac
6385         ;;
6386 esac
6387 echo "I'll use $startperl to start perl scripts."
6388
6389 : figure best path for perl in scripts
6390 case "$perlpath" in
6391 '')
6392         perlpath="$binexp/perl"
6393         case "$startperl" in
6394         *!*) ;;
6395         *)
6396                 $cat <<EOH
6397
6398 I will use the "eval 'exec'" idiom to start Perl on your system.
6399 I can use the full path of your Perl binary for this purpose, but
6400 doing so may cause problems if you want to share those scripts and
6401 Perl is not always in a standard place ($binexp/perl).
6402
6403 EOH
6404                 dflt="$binexp/perl"
6405                 rp="What path shall I use in \"eval 'exec'\"?"
6406                 . ./myread
6407                 perlpath="$ans"
6408                 ;;
6409         esac
6410         ;;
6411 esac
6412 case "$startperl" in
6413 *!*)    ;;
6414 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
6415 esac
6416
6417 : determine where public executable scripts go
6418 set scriptdir scriptdir
6419 eval $prefixit
6420 case "$scriptdir" in
6421 '')
6422         dflt="$bin"
6423         : guess some guesses
6424         $test -d /usr/share/scripts && dflt=/usr/share/scripts
6425         $test -d /usr/share/bin     && dflt=/usr/share/bin
6426         $test -d /usr/local/script  && dflt=/usr/local/script
6427         $test -d /usr/local/scripts && dflt=/usr/local/scripts
6428         $test -d $prefixexp/script  && dflt=$prefixexp/script
6429         set dflt
6430         eval $prefixup
6431         ;;
6432 *)  dflt="$scriptdir"
6433         ;;
6434 esac
6435 $cat <<EOM
6436  
6437 Some installations have a separate directory just for executable scripts so
6438 that they can mount it across multiple architectures but keep the scripts in
6439 one spot.  You might, for example, have a subdirectory of /usr/share for this.
6440 Or you might just lump your scripts in with all your other executables.
6441  
6442 EOM
6443 fn=d~
6444 rp='Where do you keep publicly executable scripts?'
6445 . ./getfile
6446 if $test "X$ansexp" != "X$scriptdirexp"; then
6447         installscript=''
6448 fi
6449 scriptdir="$ans"
6450 scriptdirexp="$ansexp"
6451 : Change installation prefix, if necessary.
6452 if $test X"$prefix" != X"$installprefix"; then
6453         installscript=`echo $scriptdirexp | sed "s#^$prefix#$installprefix#"`
6454 else
6455         installscript="$scriptdirexp"
6456 fi
6457
6458 $cat <<EOM
6459
6460 After $package is installed, you may wish to install various
6461 add-on modules and utilities.  Typically, these add-ons will
6462 be installed under $prefix with the rest
6463 of this package.  However, you may wish to install such add-ons
6464 elsewhere under a different prefix.
6465
6466 If you do not wish to put everything under a single prefix, that's
6467 ok.  You will be prompted for the individual locations; this siteprefix
6468 is only used to suggest the defaults.
6469
6470 The default should be fine for most people.
6471
6472 EOM
6473 fn=d~+
6474 rp='Installation prefix to use for add-on modules and utilities?'
6475 : XXX Here might be another good place for an installstyle setting.
6476 case "$siteprefix" in
6477 '') dflt=$prefix ;;
6478 *)  dflt=$siteprefix ;;
6479 esac
6480 . ./getfile
6481 oldsiteprefix=''
6482 case "$siteprefix" in
6483 '') ;;
6484 *)
6485         case "$ans" in
6486         "$prefix") ;;
6487         *) oldsiteprefix="$prefix";;
6488         esac
6489         ;;
6490 esac
6491 siteprefix="$ans"
6492 siteprefixexp="$ansexp"
6493
6494 : determine where site specific libraries go.
6495 : Usual default is /usr/local/lib/perl5/site_perl
6496 : The default "style" setting is made in installstyle.U
6497 : XXX No longer works with Prefixit stuff.
6498 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6499 case "$installstyle" in
6500 *lib/perl5*) dflt=$siteprefix/lib/site_$prog ;;
6501 *)       dflt=$siteprefix/lib/site_$prog ;;
6502 esac
6503 $cat <<EOM
6504
6505 The installation process will create a directory for
6506 site-specific extensions and modules.  Most users find it convenient
6507 to place all site-specific files in this directory rather than in the
6508 main distribution directory.
6509
6510 EOM
6511 fn=d~+
6512 rp='Pathname for the site-specific library files?'
6513 . ./getfile
6514 sitelib="$ans"
6515 sitelibexp="$ansexp"
6516 : Change installation prefix, if necessary.
6517 if $test X"$prefix" != X"$installprefix"; then
6518         installsitelib=`echo $sitelibexp | sed "s#^$prefix#$installprefix#"`
6519 else
6520         installsitelib="$sitelibexp"
6521 fi
6522
6523 : determine where site specific architecture-dependent libraries go.
6524 : sitelib  default is /usr/local/lib/perl5/site_perl/
6525 : sitearch default is /usr/local/lib/perl5/site_perl/$apiversion/$archname
6526 : sitelib may have an optional trailing /share.
6527 tdflt=`echo $sitelib | $sed 's,/share$,,'`
6528 tdflt="$tdflt/$apiversion/$archname"
6529 set sitearch sitearch none
6530 eval $prefixit
6531 case "$sitearch" in
6532 '')     dflt="$tdflt" ;;
6533 *)      dflt="$sitearch" ;;
6534 esac
6535 $cat <<EOM
6536
6537 The installation process will also create a directory for
6538 architecture-dependent site-specific extensions and modules.
6539
6540 EOM
6541 fn=nd~+
6542 rp='Pathname for the site-specific architecture-dependent library files?'
6543 . ./getfile
6544 sitearch="$ans"
6545 sitearchexp="$ansexp"
6546 : Change installation prefix, if necessary.
6547 if $test X"$prefix" != X"$installprefix"; then
6548         installsitearch=`echo $sitearchexp | sed "s#^$prefix#$installprefix#"`
6549 else
6550         installsitearch="$sitearchexp"
6551 fi
6552
6553 : determine where add-on public executables go
6554 case "$sitebin" in
6555 '')     dflt=$siteprefix/bin ;;
6556 *)      dflt=$sitebin ;;
6557 esac
6558 fn=d~
6559 rp='Pathname where the add-on public executables should be installed?'
6560 . ./getfile
6561 sitebin="$ans"
6562 sitebinexp="$ansexp"
6563 : Change installation prefix, if necessary.
6564 if $test X"$prefix" != X"$installprefix"; then
6565         installsitebin=`echo $sitebinexp | sed "s#^$prefix#$installprefix#"`
6566 else
6567         installsitebin="$sitebinexp"
6568 fi
6569
6570 cat <<EOM
6571
6572 Perl can be built to take advantage of long doubles which
6573 (if available) may give more accuracy and range for floating point
6574 numbers.  To do so, Configure must be run with -Duselongdouble.
6575
6576 If this doesn't make any sense to you, just accept the default 'n'.
6577 EOM
6578 case "$uselongdouble" in
6579 $define|true|[yY]*)     dflt='y';;
6580 *) dflt='n';;
6581 esac
6582 rp='Try to use long doubles if available?'
6583 . ./myread
6584 case "$ans" in
6585 y|Y)    val="$define"   ;;
6586 *)      val="$undef"    ;;
6587 esac
6588 set uselongdouble
6589 eval $setvar
6590
6591 case "$uselongdouble" in
6592 "$define"|true|[yY]*)
6593 : Look for a hint-file generated 'call-back-unit'.  If the
6594 : user has specified that long doubles should be used,
6595 : we may need to set or change some other defaults.
6596         if $test -f uselongdouble.cbu; then
6597                 echo "Your platform has some specific hints for long doubles, using them..."
6598                 . ./uselongdouble.cbu
6599         else
6600                 $cat <<EOM
6601 (Your platform doesn't have any specific hints for long doubles.)
6602 EOM
6603         fi
6604         ;;
6605 esac
6606
6607 cat <<EOM
6608
6609 Previous version of $package used the standard IO mechanisms as defined
6610 in <stdio.h>.  Versions 5.003_02 and later of perl allow alternate IO
6611 mechanisms via a "PerlIO" abstraction, but the stdio mechanism is still
6612 the default.  This abstraction layer can use AT&T's sfio (if you already
6613 have sfio installed) or regular stdio.  Using PerlIO with sfio may cause
6614 problems with some extension modules.  Using PerlIO with stdio is safe,
6615 but it is slower than plain stdio and therefore is not the default.
6616
6617 If this doesn't make any sense to you, just accept the default 'n'.
6618 EOM
6619 case "$useperlio" in
6620 $define|true|[yY]*)     dflt='y';;
6621 *) dflt='n';;
6622 esac
6623 rp='Use the experimental PerlIO abstraction layer?'
6624 . ./myread
6625 case "$ans" in
6626 y|Y) 
6627         val="$define"
6628         ;;     
6629 *)      
6630         echo "Ok, doing things the stdio way"
6631         val="$undef"
6632         ;;
6633 esac
6634 set useperlio
6635 eval $setvar 
6636
6637 case "$vendorprefix" in
6638 '')     d_vendorbin="$undef"
6639         vendorbin=''
6640         vendorbinexp=''
6641         ;;
6642 *)      d_vendorbin="$define"
6643         : determine where vendor-supplied executables go.
6644         dflt=$vendorprefix/bin
6645         fn=d~+
6646         rp='Pathname for the vendor-supplied executables directory?'
6647         . ./getfile
6648         vendorbin="$ans"
6649         vendorbinexp="$ansexp"
6650         : Change installation prefix, if necessary.
6651         if $test X"$prefix" != X"$installprefix"; then
6652                 installvendorbin=`echo $vendorbinexp | $sed "s#^$prefix#$installprefix#"`
6653         else
6654                 installvendorbin="$vendorbinexp"
6655         fi
6656         ;;
6657 esac
6658
6659 : Check how to convert floats to strings.
6660 if test "X$d_Gconvert" = X; then
6661         echo " "
6662         echo "Checking for an efficient way to convert floats to strings."
6663         $cat >try.c <<'EOP'
6664 #ifdef TRY_gconvert
6665 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
6666 char *myname = "gconvert";
6667 #endif
6668 #ifdef TRY_gcvt
6669 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
6670 char *myname = "gcvt";
6671 #endif
6672 #ifdef TRY_sprintf
6673 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
6674 char *myname = "sprintf";
6675 #endif
6676
6677 #include <stdio.h>
6678
6679 int
6680 checkit(expect, got)
6681 char *expect;
6682 char *got;
6683 {
6684     if (strcmp(expect, got)) {
6685                 printf("%s oddity:  Expected %s, got %s\n",
6686                         myname, expect, got);
6687                 exit(1);
6688         }
6689 }
6690
6691 int main()
6692
6693         char buf[64]; 
6694         buf[63] = '\0';
6695
6696         /* This must be 1st test on (which?) platform */
6697         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
6698         Gconvert(0.1, 8, 0, buf);
6699         checkit("0.1", buf);
6700
6701         Gconvert(1.0, 8, 0, buf); 
6702         checkit("1", buf);
6703
6704         Gconvert(0.0, 8, 0, buf); 
6705         checkit("0", buf);
6706
6707         Gconvert(-1.0, 8, 0, buf); 
6708         checkit("-1", buf);
6709
6710         /* Some Linux gcvt's give 1.e+5 here. */
6711         Gconvert(100000.0, 8, 0, buf); 
6712         checkit("100000", buf);
6713         
6714         /* Some Linux gcvt's give -1.e+5 here. */
6715         Gconvert(-100000.0, 8, 0, buf); 
6716         checkit("-100000", buf);
6717
6718         exit(0);
6719 }
6720 EOP
6721         case "$d_Gconvert" in
6722         gconvert*) xxx_list='gconvert gcvt sprintf' ;;
6723         gcvt*) xxx_list='gcvt gconvert sprintf' ;;
6724         sprintf*) xxx_list='sprintf gconvert gcvt' ;;
6725         *) xxx_list='gconvert gcvt sprintf' ;;
6726         esac
6727
6728         for xxx_convert in $xxx_list; do
6729                 echo "Trying $xxx_convert"
6730                 $rm -f try try$_o
6731                 set try -DTRY_$xxx_convert
6732                 if eval $compile; then
6733                         echo "$xxx_convert" found. >&4
6734                         if ./try; then
6735                                 echo "I'll use $xxx_convert to convert floats into a string." >&4
6736                                 break;
6737                         else
6738                                 echo "...But $xxx_convert didn't work as I expected."
6739                         fi
6740                 else
6741                         echo "$xxx_convert NOT found." >&4
6742                 fi
6743         done
6744                 
6745         case "$xxx_convert" in
6746         gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
6747         gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
6748         *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
6749         esac
6750 fi
6751
6752 : see if inttypes.h is available
6753 : we want a real compile instead of Inhdr because some systems
6754 : have an inttypes.h which includes non-existent headers
6755 echo " "
6756 $cat >try.c <<EOCP
6757 #include <inttypes.h>
6758 int main() {
6759         static int32_t foo32 = 0x12345678;
6760 }
6761 EOCP
6762 set try
6763 if eval $compile; then
6764         echo "<inttypes.h> found." >&4
6765         val="$define"
6766 else
6767         echo "<inttypes.h> NOT found." >&4
6768         val="$undef"
6769 fi
6770 $rm -f try.c try
6771 set i_inttypes
6772 eval $setvar
6773
6774 : check for int64_t
6775 case "$use64bits" in
6776 "$define" )
6777         echo " "
6778         $echo $n "Checking to see if your system supports int64_t...$c" >&4
6779         $cat >try.c <<EOCP
6780 #include <sys/types.h>
6781 #$i_inttypes I_INTTYPES
6782 #ifdef I_INTTYPES
6783 #include <inttypes.h>
6784 #endif
6785 int64_t foo() { int64_t x; x = 7; return x; }
6786 EOCP
6787         if $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then
6788                 val="$define"
6789                 echo " Yup, it does." >&4
6790         else
6791                 val="$undef"
6792                 echo " Nope, it doesn't." >&4
6793         fi
6794         $rm -f try.*
6795         ;;
6796 *)      val="$undef"
6797         ;;
6798 esac
6799 set d_int64t
6800 eval $setvar
6801
6802
6803 : check for lengths of integral types
6804 echo " "
6805 case "$intsize" in
6806 '')
6807         echo "Checking to see how big your integers are..." >&4
6808         $cat >intsize.c <<'EOCP'
6809 #include <stdio.h>
6810 int main()
6811 {
6812         printf("intsize=%d;\n", sizeof(int));
6813         printf("longsize=%d;\n", sizeof(long));
6814         printf("shortsize=%d;\n", sizeof(short));
6815         exit(0);
6816 }
6817 EOCP
6818         set intsize
6819         if eval $compile_ok && ./intsize > /dev/null; then
6820                 eval `./intsize`
6821                 echo "Your integers are $intsize bytes long."
6822                 echo "Your long integers are $longsize bytes long."
6823                 echo "Your short integers are $shortsize bytes long."
6824         else
6825                 $cat >&4 <<EOM
6826 !
6827 Help! I can't compile and run the intsize test program: please enlighten me!
6828 (This is probably a misconfiguration in your system or libraries, and
6829 you really ought to fix it.  Still, I'll try anyway.)
6830 !
6831 EOM
6832                 dflt=4
6833                 rp="What is the size of an integer (in bytes)?"
6834                 . ./myread
6835                 intsize="$ans"
6836                 dflt=$intsize
6837                 rp="What is the size of a long integer (in bytes)?"
6838                 . ./myread
6839                 longsize="$ans"
6840                 dflt=2
6841                 rp="What is the size of a short integer (in bytes)?"
6842                 . ./myread
6843                 shortsize="$ans"
6844         fi
6845         ;;
6846 esac
6847 $rm -f intsize intsize.*
6848
6849 : check for long long
6850 echo " "
6851 $echo $n "Checking to see if your system supports long long...$c" >&4
6852 echo 'long long foo() { long long x; x = 7; return x; }' > try.c
6853 if $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then
6854         val="$define"
6855         echo " Yup, it does." >&4
6856 else
6857         val="$undef"
6858         echo " Nope, it doesn't." >&4
6859 fi
6860 $rm try.*
6861 set d_longlong
6862 eval $setvar
6863
6864 : check for length of long long
6865 case "${d_longlong}${longlongsize}" in
6866 $define)
6867         echo " "
6868         $echo $n "Checking to see how big your long longs are...$c" >&4
6869         $cat >try.c <<'EOCP'
6870 #include <stdio.h>
6871 int main()
6872 {
6873         printf("%d\n", sizeof(long long));
6874 }
6875 EOCP
6876         set try
6877         if eval $compile_ok; then
6878                 longlongsize=`./try`
6879                 $echo " $longlongsize bytes." >&4
6880         else
6881                 dflt='8'
6882                 echo " "
6883                 echo "(I can't seem to compile the test program.  Guessing...)"
6884                 rp="What is the size of a long long (in bytes)?"
6885                 . ./myread
6886                 longlongsize="$ans"
6887         fi
6888         if $test "X$longsize" = "X$longlongsize"; then
6889                 echo "(That isn't any different from an ordinary long.)"
6890         fi      
6891         ;;
6892 esac
6893 $rm -f try.c try
6894
6895 echo " "
6896
6897 if $test X"$intsize" = X8 -o X"$longsize" = X8 -o X"$d_int64t" = X"$define" -o X"$d_longlong" = X"$define"; then
6898
6899 echo "Checking how to print 64-bit integers..." >&4
6900
6901 if $test X"$sPRId64" = X -a X"$intsize" = X8; then
6902         quad=int
6903         $cat >try.c <<'EOCP'
6904 #include <sys/types.h>
6905 #include <stdio.h>
6906 int main() {
6907   int q = 12345678901;
6908   printf("%ld\n", q);
6909 }
6910 EOCP
6911         set try
6912         if eval $compile; then
6913                 yyy=`./try$exe_ext`
6914                 case "$yyy" in
6915                 12345678901)
6916                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
6917                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIX64='"X"';
6918                         echo "We will use %d."
6919                         ;;
6920                 esac
6921         fi
6922 fi
6923
6924 if $test X"$sPRId64" = X -a X"$longsize" = X8; then
6925         quad=long
6926         $cat >try.c <<'EOCP'
6927 #include <sys/types.h>
6928 #include <stdio.h>
6929 int main() {
6930   long q = 12345678901;
6931   printf("%ld\n", q);
6932 }
6933 EOCP
6934         set try
6935         if eval $compile; then
6936                 yyy=`./try$exe_ext`
6937                 case "$yyy" in
6938                 12345678901)
6939                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
6940                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIX64='"lX"';
6941                         echo "We will use %ld."
6942                         ;;
6943                 esac
6944         fi
6945 fi
6946
6947 if $test X"$sPRId64" = X -a X"$i_inttypes.h" = X"$define" -a X"$d_int64t" = X"$define"; then
6948         quad=int64_t
6949         $cat >try.c <<'EOCP'
6950 #include <sys/types.h>
6951 #include <inttypes.h>
6952 #include <stdio.h>
6953 int main() {
6954   int64_t q = 12345678901;
6955   printf("%" PRId64 "\n", q);
6956 }
6957 EOCP
6958         set try
6959         if eval $compile; then
6960                 yyy=`./try$exe_ext`
6961                 case "$yyy" in
6962                 12345678901)
6963                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
6964                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIX64=PRIX64;
6965                         echo "We will use the C9X style."
6966                         ;;
6967                 esac
6968         fi
6969 fi
6970
6971 if $test X"$sPRId64" = X -a X"$d_longlong" = X"$define" -a X"$longlongsize" = X8; then
6972         quad="long long"
6973         $cat >try.c <<'EOCP'
6974 #include <sys/types.h>
6975 #include <stdio.h>
6976 int main() {
6977   long long q = 12345678901LL; /* AIX cc requires the LL prefix. */
6978   printf("%lld\n", q);
6979 }
6980 EOCP
6981         set try
6982         if eval $compile; then
6983                 yyy=`./try$exe_ext`
6984                 case "$yyy" in
6985                 12345678901)
6986                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
6987                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIX64='"llX"';
6988                         echo "We will use the %lld style."
6989                         ;;
6990                 esac
6991         fi
6992 fi
6993
6994 if $test X"$sPRId64" = X -a X"$quad" != X; then
6995         $cat >try.c <<EOCP
6996 #include <sys/types.h>
6997 #include <stdio.h>
6998 int main() {
6999   $quad q = 12345678901;
7000   printf("%Ld\n", q);
7001 }
7002 EOCP
7003         set try
7004         if eval $compile; then
7005                 yyy=`./try$exe_ext`
7006                 case "$yyy" in
7007                 12345678901)
7008                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
7009                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIX64='"LX"';
7010                         echo "We will use %lld."
7011                         ;;
7012                 esac
7013         fi
7014 fi
7015
7016 if $test X"$sPRId64" = X -a X"$quad" != X; then
7017         $cat >try.c <<EOCP
7018 #include <sys/types.h>
7019 #include <stdio.h>
7020 int main() {
7021   $quad q = 12345678901;
7022   printf("%qd\n", q);
7023 }
7024 EOCP
7025         set try
7026         if eval $compile; then
7027                 yyy=`./try$exe_ext`
7028                 case "$yyy" in
7029                 12345678901)
7030                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
7031                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIX64='"qX"';
7032                         echo "We will use %qd."
7033                         ;;
7034                 esac
7035         fi
7036 fi
7037
7038 if $test X"$sPRId64" = X; then
7039         echo "Cannot figure out how to print 64-bit integers." >&4
7040 fi
7041
7042 $rm -f try try.*
7043
7044 fi # intsize -o longsize -o d_int64t -o d_longlong
7045
7046 case "$sPRId64" in
7047 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef"; 
7048         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIX64="$undef"; 
7049         ;;
7050 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define"; 
7051         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIX64="$define"; 
7052         ;;
7053 esac
7054
7055 : check for length of double
7056 echo " "
7057 case "$doublesize" in
7058 '')
7059         $echo $n "Checking to see how big your double precision numbers are...$c" >&4
7060         $cat >try.c <<'EOCP'
7061 #include <stdio.h>
7062 int main()
7063 {
7064         printf("%d\n", sizeof(double));
7065 }
7066 EOCP
7067         set try
7068         if eval $compile_ok; then
7069                 doublesize=`./try`
7070                 $echo " $doublesize bytes." >&4
7071         else
7072                 dflt='8'
7073                 echo "(I can't seem to compile the test program.  Guessing...)"
7074                 rp="What is the size of a double precision number (in bytes)?"
7075                 . ./myread
7076                 doublesize="$ans"
7077         fi
7078         ;;
7079 esac
7080 $rm -f try.c try
7081
7082 : check for long doubles
7083 echo " "
7084 $echo $n "Checking to see if your system supports long double...$c" >&4
7085 echo 'long double foo() { long double x; x = 7.0; return x; }' > try.c
7086 if $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then
7087         val="$define"
7088         echo " Yup, it does." >&4
7089 else
7090         val="$undef"
7091         echo " Nope, it doesn't." >&4
7092 fi
7093 $rm try.*
7094 set d_longdbl
7095 eval $setvar
7096
7097 : check for length of long double
7098 case "${d_longdbl}${longdblsize}" in
7099 $define)
7100         echo " "
7101         $echo $n "Checking to see how big your long doubles are...$c" >&4
7102         $cat >try.c <<'EOCP'
7103 #include <stdio.h>
7104 int main()
7105 {
7106         printf("%d\n", sizeof(long double));
7107 }
7108 EOCP
7109         set try
7110         if eval $compile; then
7111                 longdblsize=`./try`
7112                 $echo " $longdblsize bytes." >&4
7113         else
7114                 dflt='8'
7115                 echo " "
7116                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
7117                 rp="What is the size of a long double (in bytes)?"
7118                 . ./myread
7119                 longdblsize="$ans"
7120         fi
7121         if $test "X$doublesize" = "X$longdblsize"; then
7122                 echo "(That isn't any different from an ordinary double.)"
7123         fi      
7124         ;;
7125 esac
7126 $rm -f try.c try
7127
7128 echo " "
7129
7130 if $test X"$d_longdbl" = X"$define"; then
7131
7132 echo "Checking how to print long doubles..." >&4
7133
7134 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
7135         $cat >try.c <<'EOCP'
7136 #include <sys/types.h>
7137 #include <stdio.h>
7138 int main() {
7139   double d = 123.456;
7140   printf("%.3f\n", d);
7141 }
7142 EOCP
7143         set try
7144         if eval $compile; then
7145                 yyy=`./try$exe_ext`
7146                 case "$yyy" in
7147                 123.456)
7148                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
7149                         sPRIFldbl='"F"'; sPRIGldbl='"G"'; sPRIEldbl='"E"';
7150                         echo "We will use %f."
7151                         ;;
7152                 esac
7153         fi
7154 fi
7155
7156 if $test X"$sPRIfldbl" = X; then
7157         $cat >try.c <<'EOCP'
7158 #include <sys/types.h>
7159 #include <stdio.h>
7160 int main() {
7161   long double d = 123.456;
7162   printf("%.3llf\n", d);
7163 }
7164 EOCP
7165         set try
7166         if eval $compile; then
7167                 yyy=`./try$exe_ext`
7168                 case "$yyy" in
7169                 123.456)
7170                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
7171                         sPRIFldbl='"llF"'; sPRIGldbl='"llG"'; sPRIEldbl='"llE"';
7172                         echo "We will use %llf."
7173                         ;;
7174                 esac
7175         fi
7176 fi
7177
7178 if $test X"$sPRIfldbl" = X; then
7179         $cat >try.c <<'EOCP'
7180 #include <sys/types.h>
7181 #include <stdio.h>
7182 int main() {
7183   long double d = 123.456;
7184   printf("%.3Lf\n", d);
7185 }
7186 EOCP
7187         set try
7188         if eval $compile; then
7189                 yyy=`./try$exe_ext`
7190                 case "$yyy" in
7191                 123.456)
7192                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
7193                         sPRIFldbl='"LF"'; sPRIGldbl='"LG"'; sPRIEldbl='"LE"';
7194                         echo "We will use %Lf."
7195                         ;;
7196                 esac
7197         fi
7198 fi
7199
7200 if $test X"$sPRIfldbl" = X; then
7201         $cat >try.c <<'EOCP'
7202 #include <sys/types.h>
7203 #include <stdio.h>
7204 int main() {
7205   long double d = 123.456;
7206   printf("%.3lf\n", d);
7207 }
7208 EOCP
7209         set try
7210         if eval $compile; then
7211                 yyy=`./try$exe_ext`
7212                 case "$yyy" in
7213                 123.456)
7214                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
7215                         sPRIFldbl='"lF"'; sPRIGldbl='"lG"'; sPRIEldbl='"lE"';
7216                         echo "We will use %lf."
7217                         ;;
7218                 esac
7219         fi
7220 fi
7221
7222 if $test X"$sPRIfldbl" = X; then
7223         echo "Cannot figure out how to print long doubles." >&4
7224 fi
7225
7226 $rm -f try try.*
7227
7228 fi # d_longdbl
7229
7230 case "$sPRIfldbl" in
7231 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef"; 
7232         d_PRIFldbl="$undef"; d_PRIGldbl="$undef"; d_PRIEldbl="$undef"; 
7233         ;;
7234 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define"; 
7235         d_PRIFldbl="$define"; d_PRIGldbl="$define"; d_PRIEldbl="$define"; 
7236         ;;
7237 esac
7238
7239 : Initialize h_fcntl
7240 h_fcntl=false
7241
7242 : Initialize h_sysfile
7243 h_sysfile=false
7244
7245 : access call always available on UNIX
7246 set access d_access
7247 eval $inlibc
7248
7249 : locate the flags for 'access()'
7250 case "$d_access" in
7251 "$define")
7252         echo " "
7253         $cat >access.c <<'EOCP'
7254 #include <sys/types.h>
7255 #ifdef I_FCNTL
7256 #include <fcntl.h>
7257 #endif
7258 #ifdef I_SYS_FILE
7259 #include <sys/file.h>
7260 #endif
7261 #ifdef I_UNISTD
7262 #include <unistd.h>
7263 #endif
7264 int main() {
7265         exit(R_OK);
7266 }
7267 EOCP
7268         : check sys/file.h first, no particular reason here
7269         if $test `./findhdr sys/file.h` && \
7270                 $cc $cppflags -DI_SYS_FILE -o access access.c >/dev/null 2>&1 ; then
7271                 h_sysfile=true;
7272                 echo "<sys/file.h> defines the *_OK access constants." >&4
7273         elif $test `./findhdr fcntl.h` && \
7274                 $cc $cppflags -DI_FCNTL -o access access.c >/dev/null 2>&1 ; then
7275                 h_fcntl=true;
7276                 echo "<fcntl.h> defines the *_OK access constants." >&4
7277         elif $test `./findhdr unistd.h` && \
7278                 $cc $cppflags -DI_UNISTD -o access access.c >/dev/null 2>&1 ; then
7279                 echo "<unistd.h> defines the *_OK access constants." >&4
7280         else
7281                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
7282         fi
7283         ;;
7284 esac
7285 $rm -f access*
7286
7287 : see if accessx exists
7288 set accessx d_accessx
7289 eval $inlibc
7290
7291 : see if alarm exists
7292 set alarm d_alarm
7293 eval $inlibc
7294
7295 : see if atolf exists
7296 set atolf d_atolf
7297 eval $inlibc
7298
7299 : see if atoll exists
7300 set atoll d_atoll
7301 eval $inlibc
7302
7303 : Look for GNU-cc style attribute checking
7304 echo " "
7305 echo "Checking whether your compiler can handle __attribute__ ..." >&4
7306 $cat >attrib.c <<'EOCP'
7307 #include <stdio.h>
7308 void croak (char* pat,...) __attribute__((format(printf,1,2),noreturn));
7309 EOCP
7310 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
7311         if $contains 'warning' attrib.out >/dev/null 2>&1; then
7312                 echo "Your C compiler doesn't fully support __attribute__."
7313                 val="$undef"
7314         else
7315                 echo "Your C compiler supports __attribute__."
7316                 val="$define"
7317         fi
7318 else
7319         echo "Your C compiler doesn't seem to understand __attribute__ at all."
7320         val="$undef"
7321 fi
7322 set d_attribut
7323 eval $setvar
7324 $rm -f attrib*
7325
7326 : see if bcmp exists
7327 set bcmp d_bcmp
7328 eval $inlibc
7329
7330 : see if bcopy exists
7331 set bcopy d_bcopy
7332 eval $inlibc
7333
7334 : see if this is a unistd.h system
7335 set unistd.h i_unistd
7336 eval $inhdr
7337
7338 : see if getpgrp exists
7339 set getpgrp d_getpgrp
7340 eval $inlibc
7341
7342 case "$d_getpgrp" in
7343 "$define")
7344         echo " "
7345         echo "Checking to see which flavor of getpgrp is in use..."
7346         $cat >set.c <<EOP
7347 #$i_unistd I_UNISTD
7348 #include <sys/types.h>
7349 #ifdef I_UNISTD
7350 #  include <unistd.h>
7351 #endif
7352 int main()
7353 {
7354         if (getuid() == 0) {
7355                 printf("(I see you are running Configure as super-user...)\n");
7356                 setuid(1);
7357         }
7358 #ifdef TRY_BSD_PGRP
7359         if (getpgrp(1) == 0)
7360                 exit(0);
7361 #else
7362         if (getpgrp() > 0)
7363                 exit(0);
7364 #endif
7365         exit(1);
7366 }
7367 EOP
7368         if $cc -DTRY_BSD_PGRP $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7369                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
7370                 val="$define"
7371         elif $cc $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7372                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
7373                 val="$undef"
7374         else
7375                 echo "I can't seem to compile and run the test program."
7376                 if ./usg; then
7377                         xxx="a USG one, i.e. you use getpgrp()."
7378                 else
7379                         # SVR4 systems can appear rather BSD-ish.
7380                         case "$i_unistd" in
7381                         $undef)
7382                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
7383                                 val="$define"
7384                                 ;;
7385                         $define)
7386                                 xxx="probably a USG one, i.e. you use getpgrp()."
7387                                 val="$undef"
7388                                 ;;
7389                         esac
7390                 fi
7391                 echo "Assuming your getpgrp is $xxx" >&4
7392         fi
7393         ;;
7394 *) val="$undef";;
7395 esac
7396 set d_bsdgetpgrp
7397 eval $setvar
7398 $rm -f set set.c
7399
7400 : see if setpgrp exists
7401 set setpgrp d_setpgrp
7402 eval $inlibc
7403
7404 case "$d_setpgrp" in
7405 "$define")
7406         echo " "
7407         echo "Checking to see which flavor of setpgrp is in use..."
7408         $cat >set.c <<EOP
7409 #$i_unistd I_UNISTD
7410 #include <sys/types.h>
7411 #ifdef I_UNISTD
7412 #  include <unistd.h>
7413 #endif
7414 int main()
7415 {
7416         if (getuid() == 0) {
7417                 printf("(I see you are running Configure as super-user...)\n");
7418                 setuid(1);
7419         }
7420 #ifdef TRY_BSD_PGRP
7421         if (-1 == setpgrp(1, 1))
7422                 exit(0);
7423 #else
7424         if (setpgrp() != -1)
7425                 exit(0);
7426 #endif
7427         exit(1);
7428 }
7429 EOP
7430         if $cc -DTRY_BSD_PGRP $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7431                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
7432                 val="$define"
7433         elif $cc $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7434                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
7435                 val="$undef"
7436         else
7437                 echo "(I can't seem to compile and run the test program.)"
7438                 if ./usg; then
7439                         xxx="a USG one, i.e. you use setpgrp()."
7440                 else
7441                         # SVR4 systems can appear rather BSD-ish.
7442                         case "$i_unistd" in
7443                         $undef)
7444                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
7445                                 val="$define"
7446                                 ;;
7447                         $define)
7448                                 xxx="probably a USG one, i.e. you use setpgrp()."
7449                                 val="$undef"
7450                                 ;;
7451                         esac
7452                 fi
7453                 echo "Assuming your setpgrp is $xxx" >&4
7454         fi
7455         ;;
7456 *) val="$undef";;
7457 esac
7458 set d_bsdsetpgrp
7459 eval $setvar
7460 $rm -f set set.c
7461 : see if bzero exists
7462 set bzero d_bzero
7463 eval $inlibc
7464
7465 : see if signal is declared as pointer to function returning int or void
7466 echo " "
7467 xxx=`./findhdr signal.h`
7468 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
7469 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
7470         echo "You have int (*signal())() instead of void." >&4
7471         val="$undef"
7472 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
7473         echo "You have void (*signal())()." >&4
7474         val="$define"
7475 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
7476         echo "You have int (*signal())() instead of void." >&4
7477         val="$undef"
7478 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
7479         echo "You have void (*signal())()." >&4
7480         val="$define"
7481 else
7482         case "$d_voidsig" in
7483         '')
7484         echo "I can't determine whether signal handler returns void or int..." >&4
7485                 dflt=void
7486                 rp="What type does your signal handler return?"
7487                 . ./myread
7488                 case "$ans" in
7489                 v*) val="$define";;
7490                 *) val="$undef";;
7491                 esac;;
7492         "$define")
7493                 echo "As you already told me, signal handler returns void." >&4
7494                 val="$define"
7495                 ;;
7496         *)      echo "As you already told me, signal handler returns int." >&4
7497                 val="$undef"
7498                 ;;
7499         esac
7500 fi
7501 set d_voidsig
7502 eval $setvar
7503 case "$d_voidsig" in
7504 "$define") signal_t="void";;
7505 *) signal_t="int";;
7506 esac
7507 $rm -f $$.tmp
7508
7509 : check for ability to cast large floats to 32-bit ints.
7510 echo " "
7511 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
7512 if $test "$intsize" -ge 4; then
7513         xxx=int
7514 else
7515         xxx=long
7516 fi
7517 $cat >try.c <<EOCP
7518 #include <stdio.h>
7519 #include <sys/types.h>
7520 #include <signal.h>
7521 $signal_t blech(s) int s; { exit(3); }
7522 int main()
7523 {
7524         $xxx i32;
7525         double f, g;
7526         int result = 0;
7527         char str[16];
7528         signal(SIGFPE, blech);
7529
7530         /* Don't let compiler optimize the test away.  Store the number 
7531            in a writable string for gcc to pass to sscanf under HP/UX.
7532         */
7533         sprintf(str, "2147483647");
7534         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
7535         g = 10 * f;
7536         i32  = ($xxx) g;
7537
7538         /* x86 processors will probably give 0x8000 0000, which is a
7539        sign change.  We don't want that.  We want to mimic SPARC
7540            behavior here, which is to preserve the sign and give
7541            back 0x7fff ffff.
7542         */
7543         if (i32 != ($xxx) f)
7544                 result |= 1;
7545         exit(result);
7546 }
7547 EOCP
7548 set try
7549 if eval $compile_ok; then
7550         ./try
7551         yyy=$?
7552 else
7553         echo "(I can't seem to compile the test program--assuming it can't)"
7554         yyy=1
7555 fi
7556 case "$yyy" in
7557 0)      val="$define"
7558         echo "Yup, it can."
7559         ;;
7560 *)      val="$undef"
7561         echo "Nope, it can't."
7562         ;;
7563 esac
7564 set d_casti32
7565 eval $setvar
7566 $rm -f try try.*
7567
7568 : check for ability to cast negative floats to unsigned
7569 echo " "
7570 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
7571 $cat >try.c <<EOCP
7572 #include <stdio.h>
7573 #include <sys/types.h>
7574 #include <signal.h>
7575 $signal_t blech(s) int s; { exit(7); }
7576 $signal_t blech_in_list(s) int s; { exit(4); }
7577 unsigned long dummy_long(p) unsigned long p; { return p; }
7578 unsigned int dummy_int(p) unsigned int p; { return p; }
7579 unsigned short dummy_short(p) unsigned short p; { return p; }
7580 int main()
7581 {
7582         double f;
7583         unsigned long along;
7584         unsigned int aint;
7585         unsigned short ashort;
7586         int result = 0;
7587         char str[16];
7588         
7589         /* Frustrate gcc-2.7.2's optimizer which failed this test with
7590            a direct f = -123. assignment.  gcc-2.8.0 reportedly
7591            optimized the whole file away
7592         */
7593         /* Store the number in a writable string for gcc to pass to 
7594            sscanf under HP/UX.
7595         */
7596         sprintf(str, "-123");
7597         sscanf(str, "%lf", &f);  /* f = -123.; */
7598
7599         signal(SIGFPE, blech);
7600         along = (unsigned long)f;
7601         aint = (unsigned int)f;
7602         ashort = (unsigned short)f;
7603         if (along != (unsigned long)-123)
7604                 result |= 1;
7605         if (aint != (unsigned int)-123)
7606                 result |= 1;
7607         if (ashort != (unsigned short)-123)
7608                 result |= 1;
7609         sprintf(str, "1073741824.");
7610         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
7611         f = f + f;
7612         along = 0;
7613         along = (unsigned long)f;
7614         if (along != 0x80000000)
7615                 result |= 2;
7616         f -= 1.;
7617         along = 0;
7618         along = (unsigned long)f;
7619         if (along != 0x7fffffff)
7620                 result |= 1;
7621         f += 2.;
7622         along = 0;
7623         along = (unsigned long)f;
7624         if (along != 0x80000001)
7625                 result |= 2;
7626         if (result)
7627                 exit(result);
7628         signal(SIGFPE, blech_in_list);
7629         sprintf(str, "123.");
7630         sscanf(str, "%lf", &f);  /* f = 123.; */
7631         along = dummy_long((unsigned long)f);
7632         aint = dummy_int((unsigned int)f);
7633         ashort = dummy_short((unsigned short)f);
7634         if (along != (unsigned long)123)
7635                 result |= 4;
7636         if (aint != (unsigned int)123)
7637                 result |= 4;
7638         if (ashort != (unsigned short)123)
7639                 result |= 4;
7640         exit(result);
7641
7642 }
7643 EOCP
7644 set try
7645 if eval $compile_ok; then
7646         ./try
7647         castflags=$?
7648 else
7649         echo "(I can't seem to compile the test program--assuming it can't)"
7650         castflags=7
7651 fi
7652 case "$castflags" in
7653 0)      val="$define"
7654         echo "Yup, it can."
7655         ;;
7656 *)      val="$undef"
7657         echo "Nope, it can't."
7658         ;;
7659 esac
7660 set d_castneg
7661 eval $setvar
7662 $rm -f try.*
7663
7664 : see if vprintf exists
7665 echo " "
7666 if set vprintf val -f d_vprintf; eval $csym; $val; then
7667         echo 'vprintf() found.' >&4
7668         val="$define"
7669         $cat >vprintf.c <<'EOF'
7670 #include <varargs.h>
7671
7672 int main() { xxx("foo"); }
7673
7674 xxx(va_alist)
7675 va_dcl
7676 {
7677         va_list args;
7678         char buf[10];
7679
7680         va_start(args);
7681         exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
7682 }
7683 EOF
7684         set vprintf
7685         if eval $compile && ./vprintf; then
7686                 echo "Your vsprintf() returns (int)." >&4
7687                 val2="$undef"
7688         else
7689                 echo "Your vsprintf() returns (char*)." >&4
7690                 val2="$define"
7691         fi
7692 else
7693         echo 'vprintf() NOT found.' >&4
7694                 val="$undef"
7695                 val2="$undef"
7696 fi
7697 set d_vprintf
7698 eval $setvar
7699 val=$val2
7700 set d_charvspr
7701 eval $setvar
7702
7703 : see if chown exists
7704 set chown d_chown
7705 eval $inlibc
7706
7707 : see if chroot exists
7708 set chroot d_chroot
7709 eval $inlibc
7710
7711 : see if chsize exists
7712 set chsize d_chsize
7713 eval $inlibc
7714
7715 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
7716 while $test $# -ge 2; do
7717         case "$1" in
7718         $define) echo "#include <$2>";;
7719         esac ;
7720     shift 2;
7721 done > try.c;
7722 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
7723 set try;
7724 if eval $compile; then
7725         val="$define";
7726 else
7727         val="$undef";
7728 fi;
7729 set $varname;
7730 eval $setvar;
7731 $rm -f try.c try.o'
7732
7733 : see if this is a sys/uio.h system
7734 set sys/uio.h i_sysuio
7735 eval $inhdr
7736
7737 echo "Checking to see if your system supports struct iovec..." >&4
7738 set d_iovec_s iovec iov_base $i_sysuio sys/uio.h
7739 eval $hasfield
7740 case "$d_iovec_s" in
7741 "$define")      echo "Yup, it does." >&4
7742                 ;;
7743 *)              echo "Nope, it doesn't." >&4
7744                 ;;
7745 esac
7746
7747 socketlib=''
7748 sockethdr=''
7749 : see whether socket exists
7750 echo " "
7751 $echo $n "Hmm... $c" >&4
7752 if set socket val -f d_socket; eval $csym; $val; then
7753         echo "Looks like you have Berkeley networking support." >&4
7754         d_socket="$define"
7755         if set setsockopt val -f; eval $csym; $val; then
7756                 d_oldsock="$undef"
7757         else
7758                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
7759                 d_oldsock="$define"
7760         fi
7761 else
7762         if $contains socklib libc.list >/dev/null 2>&1; then
7763                 echo "Looks like you have Berkeley networking support." >&4
7764                 d_socket="$define"
7765                 : we will have to assume that it supports the 4.2 BSD interface
7766                 d_oldsock="$undef"
7767         else
7768                 echo "You don't have Berkeley networking in libc$_a..." >&4
7769                 if test "X$d_socket" = "X$define"; then
7770                    echo "...but you seem to believe that you have sockets." >&4
7771                 else
7772                         for net in net socket
7773                         do
7774                                 if test -f /usr/lib/lib$net$_a; then
7775                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
7776                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
7777                                         if $contains socket libc.list >/dev/null 2>&1; then
7778                                                 d_socket="$define"
7779                                                 socketlib="-l$net"
7780                                                 case "$net" in
7781                                                 net)
7782                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
7783                                                         sockethdr="-I/usr/netinclude"
7784                                                         ;;
7785                                                 esac
7786                                                 echo "Found Berkeley sockets interface in lib$net." >& 4 
7787                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
7788                                                         d_oldsock="$undef"
7789                                                 else
7790                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
7791                                                         d_oldsock="$define"
7792                                                 fi
7793                                                 break
7794                                         fi
7795                                 fi
7796                         done
7797                         if test "X$d_socket" != "X$define"; then
7798                            echo "or anywhere else I see." >&4
7799                            d_socket="$undef"
7800                            d_oldsock="$undef"
7801                         fi
7802                 fi
7803         fi
7804 fi
7805
7806 : see if socketpair exists
7807 set socketpair d_sockpair
7808 eval $inlibc
7809
7810
7811 echo " "
7812 echo "Checking the availability of certain socket constants..." >& 4
7813 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
7814         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
7815         $cat >try.c <<EOF
7816 #include <sys/types.h>
7817 #include <sys/socket.h>
7818 int main() {
7819     int i = $ENUM;
7820 }
7821 EOF
7822         val="$undef"
7823         set try; if eval $compile; then
7824                 val="$define"
7825         fi
7826         set d_${enum}; eval $setvar
7827         $rm -f try.c try
7828 done
7829
7830 set sendmsg d_sendmsg
7831 eval $inlibc
7832
7833 set recvmsg d_recvmsg
7834 eval $inlibc
7835
7836 echo " "
7837 $echo $n "Checking to see if your system supports struct msghdr...$c" >&4
7838 set d_msghdr_s msghdr msg_name define sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
7839 eval $hasfield
7840 case "$d_msghdr_s" in
7841 "$define")      echo "Yup, it does." >&4
7842                 ;;
7843 *)              echo "Nope, it doesn't." >&4
7844                 ;;
7845 esac
7846
7847 $echo $n "Checking to see if your system supports struct cmsghdr...$c" >&4
7848 set d_cmsghdr_s cmsghdr cmsg_len define sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
7849 eval $hasfield
7850 case "$d_cmsghdr_s" in
7851 "$define")      echo "Yup, it does." >&4
7852                 ;;
7853 *)              echo "Nope, it doesn't." >&4
7854                 ;;
7855 esac
7856
7857 : check for const keyword
7858 echo " "
7859 echo 'Checking to see if your C compiler knows about "const"...' >&4
7860 $cat >const.c <<'EOCP'
7861 typedef struct spug { int drokk; } spug;
7862 int main()
7863 {
7864         const char *foo;
7865         const spug y;
7866 }
7867 EOCP
7868 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
7869         val="$define"
7870         echo "Yup, it does."
7871 else
7872         val="$undef"
7873         echo "Nope, it doesn't."
7874 fi
7875 set d_const
7876 eval $setvar
7877
7878 : see if crypt exists
7879 echo " "
7880 if set crypt val -f d_crypt; eval $csym; $val; then
7881         echo 'crypt() found.' >&4
7882         val="$define"
7883         cryptlib=''
7884 else
7885         cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
7886         if $test -z "$cryptlib"; then
7887                 cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
7888         else
7889                 cryptlib=-lcrypt
7890         fi
7891         if $test -z "$cryptlib"; then
7892                 cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
7893         else
7894                 cryptlib=-lcrypt
7895         fi
7896         if $test -z "$cryptlib"; then
7897                 cryptlib=`./loc libcrypt$_a "" $libpth`
7898         else
7899                 cryptlib=-lcrypt
7900         fi
7901         if $test -z "$cryptlib"; then
7902                 echo 'crypt() NOT found.' >&4
7903                 val="$undef"
7904         else
7905                 val="$define"
7906         fi
7907 fi
7908 set d_crypt
7909 eval $setvar
7910
7911 : get csh whereabouts
7912 case "$csh" in
7913 'csh') val="$undef" ;;
7914 *) val="$define" ;;
7915 esac
7916 set d_csh
7917 eval $setvar
7918 : Respect a hint or command line value for full_csh.
7919 case "$full_csh" in
7920 '') full_csh=$csh ;;
7921 esac
7922
7923 : see if cuserid exists
7924 set cuserid d_cuserid
7925 eval $inlibc
7926
7927 : see if this is a limits.h system
7928 set limits.h i_limits
7929 eval $inhdr
7930
7931 : see if this is a float.h system
7932 set float.h i_float
7933 eval $inhdr
7934
7935 : See if number of significant digits in a double precision number is known
7936 echo " "
7937 $cat >dbl_dig.c <<EOM
7938 #$i_limits I_LIMITS
7939 #$i_float I_FLOAT
7940 #ifdef I_LIMITS
7941 #include <limits.h>
7942 #endif
7943 #ifdef I_FLOAT
7944 #include <float.h>
7945 #endif
7946 #ifdef DBL_DIG
7947 printf("Contains DBL_DIG");
7948 #endif
7949 EOM
7950 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
7951 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
7952         echo "DBL_DIG found." >&4
7953         val="$define"
7954 else
7955         echo "DBL_DIG NOT found." >&4
7956         val="$undef"
7957 fi
7958 $rm -f dbl_dig.?
7959 set d_dbl_dig
7960 eval $setvar
7961
7962 : see if difftime exists
7963 set difftime d_difftime
7964 eval $inlibc
7965
7966 : see if this is a dirent system
7967 echo " "
7968 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
7969         val="$define"
7970         echo "<dirent.h> found." >&4
7971 else
7972         val="$undef"
7973         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
7974                 echo "<sys/dir.h> found." >&4
7975                 echo " "
7976         else
7977                 xinc=`./findhdr sys/ndir.h`
7978         fi
7979         echo "<dirent.h> NOT found." >&4
7980 fi
7981 set i_dirent
7982 eval $setvar
7983
7984 : Look for type of directory structure.
7985 echo " "
7986 $cppstdin $cppflags $cppminus < "$xinc" > try.c
7987
7988 case "$direntrytype" in
7989 ''|' ')
7990         case "$i_dirent" in
7991         $define) guess1='struct dirent' ;;
7992         *) guess1='struct direct'  ;;
7993         esac
7994         ;;
7995 *)      guess1="$direntrytype"
7996         ;;
7997 esac
7998
7999 case "$guess1" in
8000 'struct dirent') guess2='struct direct' ;;
8001 *) guess2='struct dirent' ;;
8002 esac
8003                 
8004 if $contains "$guess1" try.c >/dev/null 2>&1; then
8005         direntrytype="$guess1"
8006         echo "Your directory entries are $direntrytype." >&4
8007 elif $contains "$guess2" try.c >/dev/null 2>&1; then
8008         direntrytype="$guess2"
8009         echo "Your directory entries seem to be $direntrytype." >&4
8010 else
8011         echo "I don't recognize your system's directory entries." >&4
8012         rp="What type is used for directory entries on this system?"
8013         dflt="$guess1"
8014         . ./myread
8015         direntrytype="$ans"
8016 fi
8017 $rm -f try.c
8018
8019
8020 : see if the directory entry stores field length
8021 echo " "
8022 $cppstdin $cppflags $cppminus < "$xinc" > try.c
8023 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
8024         echo "Good, your directory entry keeps length information in d_namlen." >&4
8025         val="$define"
8026 else
8027         echo "Your directory entry does not know about the d_namlen field." >&4
8028         val="$undef"
8029 fi
8030 set d_dirnamlen
8031 eval $setvar
8032 $rm -f try.c
8033
8034 : see if dlerror exists
8035 xxx_runnm="$runnm"
8036 runnm=false
8037 set dlerror d_dlerror
8038 eval $inlibc
8039 runnm="$xxx_runnm"
8040
8041 : see if dlfcn is available
8042 set dlfcn.h i_dlfcn
8043 eval $inhdr
8044
8045 case "$usedl" in
8046 $define|y|true)
8047         $cat << EOM
8048
8049 On a few systems, the dynamically loaded modules that perl generates and uses
8050 will need a different extension than shared libs. The default will probably
8051 be appropriate.
8052
8053 EOM
8054         case "$dlext" in
8055         '')     dflt="$so" ;;
8056         *)      dflt="$dlext" ;;
8057         esac
8058         rp='What is the extension of dynamically loaded modules'
8059         . ./myread
8060         dlext="$ans"
8061         ;;
8062 *)
8063         dlext="none"
8064         ;;
8065 esac
8066
8067 : Check if dlsym need a leading underscore
8068 echo " "
8069 val="$undef"
8070
8071 case "$dlsrc" in
8072 dl_dlopen.xs)
8073         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
8074         $cat >dyna.c <<'EOM'
8075 fred () { }
8076 EOM
8077
8078 $cat >fred.c<<EOM
8079
8080 #include <stdio.h>
8081 #$i_dlfcn I_DLFCN
8082 #ifdef I_DLFCN
8083 #include <dlfcn.h>      /* the dynamic linker include file for Sunos/Solaris */
8084 #else
8085 #include <sys/types.h>
8086 #include <nlist.h>
8087 #include <link.h>
8088 #endif
8089
8090 extern int fred() ;
8091
8092 int main()
8093 {
8094     void * handle ;
8095     void * symbol ;
8096 #ifndef RTLD_LAZY
8097     int mode = 1 ;
8098 #else
8099     int mode = RTLD_LAZY ;
8100 #endif
8101     handle = dlopen("./dyna.$dlext", mode) ;
8102     if (handle == NULL) {
8103         printf ("1\n") ;
8104         fflush (stdout) ;
8105         exit(0);
8106     }
8107     symbol = dlsym(handle, "fred") ;
8108     if (symbol == NULL) {
8109         /* try putting a leading underscore */
8110         symbol = dlsym(handle, "_fred") ;
8111         if (symbol == NULL) {
8112             printf ("2\n") ;
8113             fflush (stdout) ;
8114             exit(0);
8115         }
8116         printf ("3\n") ;
8117     }
8118     else
8119         printf ("4\n") ;
8120     fflush (stdout) ;
8121     exit(0);
8122 }
8123 EOM
8124         : Call the object file tmp-dyna.o in case dlext=o.
8125         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 && 
8126                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 && 
8127                 $ld $lddlflags -o dyna.$dlext tmp-dyna${_o} > /dev/null 2>&1 && 
8128                 $cc $ccflags -o fred $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1; then
8129                 xxx=`./fred`
8130                 case $xxx in
8131                 1)      echo "Test program failed using dlopen." >&4
8132                         echo "Perhaps you should not use dynamic loading." >&4;;
8133                 2)      echo "Test program failed using dlsym." >&4
8134                         echo "Perhaps you should not use dynamic loading." >&4;;
8135                 3)      echo "dlsym needs a leading underscore" >&4
8136                         val="$define" ;;
8137                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
8138                 esac
8139         else
8140                 echo "I can't compile and run the test program." >&4
8141                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
8142         fi
8143         ;;
8144 esac
8145                 
8146 $rm -f fred fred.? dyna.$dlext dyna.? tmp-dyna.?
8147
8148 set d_dlsymun
8149 eval $setvar
8150
8151 hasproto='varname=$1; func=$2; shift; shift;
8152 while $test $# -ge 2; do
8153         case "$1" in
8154         $define) echo "#include <$2>";;
8155         esac ;
8156     shift 2;
8157 done > try.c;
8158 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
8159 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
8160         echo "$func() prototype found.";
8161         val="$define";
8162 else
8163         echo "$func() prototype NOT found.";
8164         val="$undef";
8165 fi;
8166 set $varname;
8167 eval $setvar;
8168 $rm -f try.c tryout.c'
8169
8170 : see if prototype for drand48 is available
8171 echo " "
8172 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
8173 eval $hasproto
8174
8175 : see if dup2 exists
8176 set dup2 d_dup2
8177 eval $inlibc
8178
8179 : see if eaccess exists
8180 set eaccess d_eaccess
8181 eval $inlibc
8182
8183 : see if endgrent exists
8184 set endgrent d_endgrent
8185 eval $inlibc
8186
8187 : see if endhostent exists
8188 set endhostent d_endhent
8189 eval $inlibc
8190
8191 : see if endnetent exists
8192 set endnetent d_endnent
8193 eval $inlibc
8194
8195 : see if endprotoent exists
8196 set endprotoent d_endpent
8197 eval $inlibc
8198
8199 : see if endpwent exists
8200 set endpwent d_endpwent
8201 eval $inlibc
8202
8203 : see if endservent exists
8204 set endservent d_endsent
8205 eval $inlibc
8206
8207 : see if endspent exists
8208 set endspent d_endspent
8209 eval $inlibc
8210
8211 : Locate the flags for 'open()'
8212 echo " "
8213 $cat >open3.c <<'EOCP'
8214 #include <sys/types.h>
8215 #ifdef I_FCNTL
8216 #include <fcntl.h>
8217 #endif
8218 #ifdef I_SYS_FILE
8219 #include <sys/file.h>
8220 #endif
8221 int main() {
8222         if(O_RDONLY);
8223 #ifdef O_TRUNC
8224         exit(0);
8225 #else
8226         exit(1);
8227 #endif
8228 }
8229 EOCP
8230 : check sys/file.h first to get FREAD on Sun
8231 if $test `./findhdr sys/file.h` && \
8232                 set open3 -DI_SYS_FILE && eval $compile; then
8233         h_sysfile=true;
8234         echo "<sys/file.h> defines the O_* constants..." >&4
8235         if ./open3; then
8236                 echo "and you have the 3 argument form of open()." >&4
8237                 val="$define"
8238         else
8239                 echo "but not the 3 argument form of open().  Oh, well." >&4
8240                 val="$undef"
8241         fi
8242 elif $test `./findhdr fcntl.h` && \
8243                 set open3 -DI_FCNTL && eval $compile; then
8244         h_fcntl=true;
8245         echo "<fcntl.h> defines the O_* constants..." >&4
8246         if ./open3; then
8247                 echo "and you have the 3 argument form of open()." >&4
8248                 val="$define"
8249         else
8250                 echo "but not the 3 argument form of open().  Oh, well." >&4
8251                 val="$undef"
8252         fi
8253 else
8254         val="$undef"
8255         echo "I can't find the O_* constant definitions!  You got problems." >&4
8256 fi
8257 set d_open3
8258 eval $setvar
8259 $rm -f open3*
8260
8261 : check for non-blocking I/O stuff
8262 case "$h_sysfile" in
8263 true) echo "#include <sys/file.h>" > head.c;;
8264 *)
8265         case "$h_fcntl" in
8266         true) echo "#include <fcntl.h>" > head.c;;
8267         *) echo "#include <sys/fcntl.h>" > head.c;;
8268         esac
8269         ;;
8270 esac
8271 echo " "
8272 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
8273 case "$o_nonblock" in
8274 '')
8275         $cat head.c > try.c
8276         $cat >>try.c <<'EOCP'
8277 int main() {
8278 #ifdef O_NONBLOCK
8279         printf("O_NONBLOCK\n");
8280         exit(0);
8281 #endif
8282 #ifdef O_NDELAY
8283         printf("O_NDELAY\n");
8284         exit(0);
8285 #endif
8286 #ifdef FNDELAY
8287         printf("FNDELAY\n");
8288         exit(0);
8289 #endif
8290         exit(0);
8291 }
8292 EOCP
8293         set try
8294         if eval $compile_ok; then
8295                 o_nonblock=`./try`
8296                 case "$o_nonblock" in
8297                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
8298                 *) echo "Seems like we can use $o_nonblock.";;
8299                 esac
8300         else
8301                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
8302         fi
8303         ;;
8304 *) echo "Using $hint value $o_nonblock.";;
8305 esac
8306 $rm -f try try.* .out core
8307
8308 echo " "
8309 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
8310 case "$eagain" in
8311 '')
8312         $cat head.c > try.c
8313         $cat >>try.c <<EOCP
8314 #include <errno.h>
8315 #include <sys/types.h>
8316 #include <signal.h>
8317 #define MY_O_NONBLOCK $o_nonblock
8318 #ifndef errno  /* XXX need better Configure test */
8319 extern int errno;
8320 #endif
8321 $signal_t blech(x) int x; { exit(3); }
8322 EOCP
8323         $cat >> try.c <<'EOCP'
8324 int main()
8325 {
8326         int pd[2];
8327         int pu[2];
8328         char buf[1];
8329         char string[100];
8330
8331         pipe(pd);       /* Down: child -> parent */
8332         pipe(pu);       /* Up: parent -> child */
8333         if (0 != fork()) {
8334                 int ret;
8335                 close(pd[1]);   /* Parent reads from pd[0] */
8336                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
8337                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
8338                         exit(1);
8339                 signal(SIGALRM, blech);
8340                 alarm(5);
8341                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
8342                         exit(2);
8343                 sprintf(string, "%d\n", ret);
8344                 write(2, string, strlen(string));
8345                 alarm(0);
8346 #ifdef EAGAIN
8347                 if (errno == EAGAIN) {
8348                         printf("EAGAIN\n");
8349                         goto ok;
8350                 }
8351 #endif
8352 #ifdef EWOULDBLOCK
8353                 if (errno == EWOULDBLOCK)
8354                         printf("EWOULDBLOCK\n");
8355 #endif
8356         ok:
8357                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
8358                 sleep(2);                               /* Give it time to close our pipe */
8359                 alarm(5);
8360                 ret = read(pd[0], buf, 1);      /* Should read EOF */
8361                 alarm(0);
8362                 sprintf(string, "%d\n", ret);
8363                 write(3, string, strlen(string));
8364                 exit(0);
8365         }
8366
8367         close(pd[0]);                   /* We write to pd[1] */
8368         close(pu[1]);                   /* We read from pu[0] */
8369         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
8370         close(pd[1]);                   /* Pipe pd is now fully closed! */
8371         exit(0);                                /* Bye bye, thank you for playing! */
8372 }
8373 EOCP
8374         set try
8375         if eval $compile_ok; then
8376                 echo "$startsh" >mtry
8377                 echo "./try >try.out 2>try.ret 3>try.err || exit 4" >>mtry
8378                 chmod +x mtry
8379                 ./mtry >/dev/null 2>&1
8380                 case $? in
8381                 0) eagain=`$cat try.out`;;
8382                 1) echo "Could not perform non-blocking setting!";;
8383                 2) echo "I did a successful read() for something that was not there!";;
8384                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
8385                 *) echo "Something terribly wrong happened during testing.";;
8386                 esac
8387                 rd_nodata=`$cat try.ret`
8388                 echo "A read() system call with no data present returns $rd_nodata."
8389                 case "$rd_nodata" in
8390                 0|-1) ;;
8391                 *)
8392                         echo "(That's peculiar, fixing that to be -1.)"
8393                         rd_nodata=-1
8394                         ;;
8395                 esac
8396                 case "$eagain" in
8397                 '')
8398                         echo "Forcing errno EAGAIN on read() with no data available."
8399                         eagain=EAGAIN
8400                         ;;
8401                 *)
8402                         echo "Your read() sets errno to $eagain when no data is available."
8403                         ;;
8404                 esac
8405                 status=`$cat try.err`
8406                 case "$status" in
8407                 0) echo "And it correctly returns 0 to signal EOF.";;
8408                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
8409                 *) echo "However, your read() returns '$status' on EOF??";;
8410                 esac
8411                 val="$define"
8412                 if test "$status" = "$rd_nodata"; then
8413                         echo "WARNING: you can't distinguish between EOF and no data!"
8414                         val="$undef"
8415                 fi
8416         else
8417                 echo "I can't compile the test program--assuming errno EAGAIN will do."
8418                 eagain=EAGAIN
8419         fi
8420         set d_eofnblk
8421         eval $setvar
8422         ;;
8423 *)
8424         echo "Using $hint value $eagain."
8425         echo "Your read() returns $rd_nodata when no data is present."
8426         case "$d_eofnblk" in
8427         "$define") echo "And you can see EOF because read() returns 0.";;
8428         "$undef") echo "But you can't see EOF status from read() returned value.";;
8429         *)
8430                 echo "(Assuming you can't see EOF status from read anyway.)"
8431                 d_eofnblk=$undef
8432                 ;;
8433         esac
8434         ;;
8435 esac
8436 $rm -f try try.* .out core head.c mtry
8437
8438 : see if fchmod exists
8439 set fchmod d_fchmod
8440 eval $inlibc
8441
8442 : see if fchown exists
8443 set fchown d_fchown
8444 eval $inlibc
8445
8446 : see if this is an fcntl system
8447 set fcntl d_fcntl
8448 eval $inlibc
8449
8450 : see if sys/select.h has to be included
8451 set sys/select.h i_sysselct
8452 eval $inhdr
8453
8454 : see if we should include time.h, sys/time.h, or both
8455 echo " "
8456 if test "X$timeincl" = X; then
8457         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
8458         $echo $n "I'm now running the test program...$c"
8459         $cat >try.c <<'EOCP'
8460 #include <sys/types.h>
8461 #ifdef I_TIME
8462 #include <time.h>
8463 #endif
8464 #ifdef I_SYSTIME
8465 #ifdef SYSTIMEKERNEL
8466 #define KERNEL
8467 #endif
8468 #include <sys/time.h>
8469 #endif
8470 #ifdef I_SYSSELECT
8471 #include <sys/select.h>
8472 #endif
8473 int main()
8474 {
8475         struct tm foo;
8476 #ifdef S_TIMEVAL
8477         struct timeval bar;
8478 #endif
8479 #ifdef S_TIMEZONE
8480         struct timezone tzp;
8481 #endif
8482         if (foo.tm_sec == foo.tm_sec)
8483                 exit(0);
8484 #ifdef S_TIMEVAL
8485         if (bar.tv_sec == bar.tv_sec)
8486                 exit(0);
8487 #endif
8488         exit(1);
8489 }
8490 EOCP
8491         flags=''
8492         for s_timezone in '-DS_TIMEZONE' ''; do
8493         sysselect=''
8494         for s_timeval in '-DS_TIMEVAL' ''; do
8495         for i_systimek in '' '-DSYSTIMEKERNEL'; do
8496         for i_time in '' '-DI_TIME'; do
8497         for i_systime in '-DI_SYSTIME' ''; do
8498                 case "$flags" in
8499                 '') $echo $n ".$c"
8500                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
8501                         if eval $compile; then
8502                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
8503                                 shift
8504                                 flags="$*"
8505                                 echo " "
8506                                 $echo $n "Succeeded with $flags$c"
8507                         fi
8508                         ;;
8509                 esac
8510         done
8511         done
8512         done
8513         done
8514         done
8515         timeincl=''
8516         echo " "
8517         case "$flags" in
8518         *SYSTIMEKERNEL*) i_systimek="$define"
8519                 timeincl=`./findhdr sys/time.h`
8520                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
8521         *) i_systimek="$undef";;
8522         esac
8523         case "$flags" in
8524         *I_TIME*) i_time="$define"
8525                 timeincl=`./findhdr time.h`" $timeincl"
8526                 echo "We'll include <time.h>." >&4;;
8527         *) i_time="$undef";;
8528         esac
8529         case "$flags" in
8530         *I_SYSTIME*) i_systime="$define"
8531                 timeincl=`./findhdr sys/time.h`" $timeincl"
8532                 echo "We'll include <sys/time.h>." >&4;;
8533         *) i_systime="$undef";;
8534         esac
8535         $rm -f try.c try
8536 fi
8537
8538 : check for fd_set items
8539 $cat <<EOM
8540
8541 Checking to see how well your C compiler handles fd_set and friends ...
8542 EOM
8543 $cat >fd_set.c <<EOCP
8544 #$i_systime I_SYS_TIME
8545 #$i_sysselct I_SYS_SELECT
8546 #$d_socket HAS_SOCKET
8547 #include <sys/types.h>
8548 #ifdef HAS_SOCKET
8549 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
8550 #endif
8551 #ifdef I_SYS_TIME
8552 #include <sys/time.h>
8553 #endif
8554 #ifdef I_SYS_SELECT
8555 #include <sys/select.h>
8556 #endif
8557 int main() {
8558         fd_set fds;
8559
8560 #ifdef TRYBITS
8561         if(fds.fds_bits);
8562 #endif
8563
8564 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
8565         exit(0);
8566 #else
8567         exit(1);
8568 #endif
8569 }
8570 EOCP
8571 set fd_set -DTRYBITS
8572 if eval $compile; then
8573         d_fds_bits="$define"
8574         d_fd_set="$define"
8575         echo "Well, your system knows about the normal fd_set typedef..." >&4
8576         if ./fd_set; then
8577                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
8578                 d_fd_macros="$define"
8579         else
8580                 $cat >&4 <<'EOM'
8581 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
8582 EOM
8583                 d_fd_macros="$undef"
8584         fi
8585 else
8586         $cat <<'EOM'
8587 Hmm, your compiler has some difficulty with fd_set.  Checking further...
8588 EOM
8589         set fd_set
8590         if eval $compile; then
8591                 d_fds_bits="$undef"
8592                 d_fd_set="$define"
8593                 echo "Well, your system has some sort of fd_set available..." >&4
8594                 if ./fd_set; then
8595                         echo "and you have the normal fd_set macros." >&4
8596                         d_fd_macros="$define"
8597                 else
8598                         $cat <<'EOM'
8599 but not the normal fd_set macros!  Gross!  More work for me...
8600 EOM
8601                         d_fd_macros="$undef"
8602                 fi
8603         else
8604         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
8605                 d_fd_set="$undef"
8606                 d_fds_bits="$undef"
8607                 d_fd_macros="$undef"
8608         fi
8609 fi
8610 $rm -f fd_set*
8611
8612 : see if fgetpos exists
8613 set fgetpos d_fgetpos
8614 eval $inlibc
8615
8616 : see if flock exists
8617 set flock d_flock
8618 eval $inlibc
8619
8620 : see if fork exists
8621 set fork d_fork
8622 eval $inlibc
8623
8624 : see if pathconf exists
8625 set pathconf d_pathconf
8626 eval $inlibc
8627
8628 : see if fpathconf exists
8629 set fpathconf d_fpathconf
8630 eval $inlibc
8631
8632
8633 : see if llseek exists
8634 set llseek d_llseek
8635 eval $inlibc
8636
8637 : check for off64_t
8638 echo " "
8639 $echo $n "Checking to see if your system supports off64_t...$c" >&4
8640 $cat >try.c <<EOCP
8641 #include <sys/types.h>
8642 #include <unistd.h>
8643 off64_t foo() { off64_t x; x = 7; return x; }'
8644 EOCP
8645 if $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then
8646         val="$define"
8647         echo " Yup, it does." >&4
8648 else
8649         val="$undef"
8650         echo " Nope, it doesn't." >&4
8651 fi
8652 $rm -f try.*
8653 set d_off64_t
8654 eval $setvar
8655
8656 : check for fpos64_t
8657 echo " "
8658 $echo $n "Checking to see if your system supports fpos64_t...$c" >&4
8659 $cat >try.c <<EOCP
8660 #include <sys/stdio.h>
8661 fpos64_t foo() { fpos64_t x; x = 7; return x; }'
8662 EOCP
8663 if $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then
8664         val="$define"
8665         echo " Yup, it does." >&4
8666 else
8667         val="$undef"
8668         echo " Nope, it doesn't." >&4
8669 fi
8670 $rm -f try.*
8671 set d_fpos64_t
8672 eval $setvar
8673
8674 hasstruct='varname=$1; struct=$2; shift; shift;
8675 while $test $# -ge 2; do
8676         case "$1" in
8677         $define) echo "#include <$2>";;
8678         esac ;
8679     shift 2;
8680 done > try.c;
8681 echo "int main () { struct $struct foo; }" >> try.c;
8682 set try;
8683 if eval $compile; then
8684         val="$define";
8685 else
8686         val="$undef";
8687 fi;
8688 set $varname;
8689 eval $setvar;
8690 $rm -f try.c try.o'
8691
8692 : see if this is a sys/param system
8693 set sys/param.h i_sysparam
8694 eval $inhdr
8695
8696 : see if this is a sys/mount.h system
8697 set sys/mount.h i_sysmount
8698 eval $inhdr
8699
8700 : see if sys/types.h has to be included
8701 set sys/types.h i_systypes
8702 eval $inhdr
8703
8704 : see if this is a sys/vfs.h system
8705 set sys/vfs.h i_sysvfs
8706 eval $inhdr
8707
8708 : see if this is a sys/statfs.h system
8709 set sys/statfs.h i_sysstatfs
8710 eval $inhdr
8711
8712
8713 : see if statfs exists
8714 set statfs d_statfs
8715 eval $inlibc
8716
8717 echo "Checking to see if your system supports struct statfs..." >&4
8718 set d_statfs_s statfs $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h $i_sysvfs sys/vfs.h $i_sysstatfs sys/statfs.h
8719 eval $hasstruct
8720 case "$d_statfs_s" in
8721 "$define")      echo "Yup, it does."     >&4 ;;
8722 *)              echo "Nope, it doesn't." >&4 ;;
8723 esac
8724
8725 : see if struct statfs knows about f_flags
8726 case "$d_statfs_s" in
8727 define) 
8728         echo "Checking to see if your struct statfs has f_flags field..." >&4
8729         set d_statfs_f_flags statfs f_flags $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h $i_sysvfs sys/vfs.h $i_sysstatfs sys/statfs.h
8730         eval $hasfield
8731         ;;
8732 *)      val="$undef"
8733         set d_statfs_f_flags
8734         eval $setvar
8735         ;;
8736 esac
8737 case "$d_statfs_f_flags" in
8738 "$define")      echo "Yup, it does."     >&4 ;;
8739 *)              echo "Nope, it doesn't." >&4 ;;
8740 esac
8741
8742 echo "Checking to see if your system supports struct fs_data..." >&4
8743 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
8744 eval $hasstruct
8745 case "$d_fs_data_s" in
8746 "$define")      echo "Yup, it does."     >&4 ;;
8747 *)              echo "Nope, it doesn't." >&4 ;;
8748 esac
8749
8750 : see if fseeko exists
8751 set fseeko d_fseeko
8752 eval $inlibc
8753
8754 : see if fsetpos exists
8755 set fsetpos d_fsetpos
8756 eval $inlibc
8757
8758
8759 : see if fstatfs exists
8760 set fstatfs d_fstatfs
8761 eval $inlibc
8762
8763
8764 : see if statvfs exists
8765 set statvfs d_statvfs
8766 eval $inlibc
8767
8768 : see if fstatvfs exists
8769 set fstatvfs d_fstatvfs
8770 eval $inlibc
8771
8772
8773 : see if ftello exists
8774 set ftello d_ftello
8775 eval $inlibc
8776
8777 : see if getgrent exists
8778 set getgrent d_getgrent
8779 eval $inlibc
8780
8781 : see if gethostbyaddr exists
8782 set gethostbyaddr d_gethbyaddr
8783 eval $inlibc
8784
8785 : see if gethostbyname exists
8786 set gethostbyname d_gethbyname
8787 eval $inlibc
8788
8789 : see if gethostent exists
8790 set gethostent d_gethent
8791 eval $inlibc
8792
8793 : see how we will look up host name
8794 echo " "
8795 call=''
8796 if set gethostname val -f d_gethname; eval $csym; $val; then
8797         echo 'gethostname() found.' >&4
8798         d_gethname="$define"
8799         call=gethostname
8800 fi
8801 if set uname val -f d_uname; eval $csym; $val; then
8802         if ./xenix; then
8803                 $cat <<'EOM'
8804 uname() was found, but you're running xenix, and older versions of xenix
8805 have a broken uname(). If you don't really know whether your xenix is old
8806 enough to have a broken system call, use the default answer.
8807
8808 EOM
8809                 dflt=y
8810                 case "$d_uname" in
8811                 "$define") dflt=n;;
8812                 esac
8813                 rp='Is your uname() broken?'
8814                 . ./myread
8815                 case "$ans" in
8816                 n*) d_uname="$define"; call=uname;;
8817                 esac
8818         else
8819                 echo 'uname() found.' >&4
8820                 d_uname="$define"
8821                 case "$call" in
8822                 '') call=uname ;;
8823                 esac
8824         fi
8825 fi
8826 case "$d_gethname" in
8827 '') d_gethname="$undef";;
8828 esac
8829 case "$d_uname" in
8830 '') d_uname="$undef";;
8831 esac
8832 case "$d_uname$d_gethname" in
8833 *define*)
8834         dflt=n
8835         cat <<EOM
8836  
8837 Every now and then someone has a $call() that lies about the hostname
8838 but can't be fixed for political or economic reasons.  If you wish, I can
8839 pretend $call() isn't there and maybe compute hostname at run-time
8840 thanks to the '$phostname' command.
8841
8842 EOM
8843         rp="Shall I ignore $call() from now on?"
8844         . ./myread
8845         case "$ans" in
8846         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
8847         esac;;
8848 esac
8849 case "$phostname" in
8850 '') aphostname='';;
8851 *) case "$aphostname" in
8852         /*) ;;
8853         *) set X $phostname
8854                 shift
8855                 file=$1
8856                 shift
8857                 file=`./loc $file $file $pth`
8858                 aphostname=`echo $file $*`
8859                 ;;
8860         esac
8861         ;;
8862 esac
8863 case "$d_uname$d_gethname" in
8864 *define*) ;;
8865 *)
8866         case "$phostname" in
8867         '')
8868                 echo "There will be no way for $package to get your hostname." >&4;;
8869         *)
8870         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
8871                 ;;
8872         esac;;
8873 esac
8874 case "$d_phostname" in
8875 '') d_phostname="$undef";;
8876 esac
8877
8878 : see if this is a netdb.h system
8879 set netdb.h i_netdb
8880 eval $inhdr
8881
8882 : see if prototypes for various gethostxxx netdb.h functions are available
8883 echo " "
8884 set d_gethostprotos gethostent $i_netdb netdb.h
8885 eval $hasproto
8886
8887 : see if getlogin exists
8888 set getlogin d_getlogin
8889 eval $inlibc
8890
8891 : see if getmntent exists
8892 set getmntent d_getmntent
8893 eval $inlibc
8894
8895 : see if getnetbyaddr exists
8896 set getnetbyaddr d_getnbyaddr
8897 eval $inlibc
8898
8899 : see if getnetbyname exists
8900 set getnetbyname d_getnbyname
8901 eval $inlibc
8902
8903 : see if getnetent exists
8904 set getnetent d_getnent
8905 eval $inlibc
8906
8907 : see if prototypes for various getnetxxx netdb.h functions are available
8908 echo " "
8909 set d_getnetprotos getnetent $i_netdb netdb.h
8910 eval $hasproto
8911
8912
8913 : see if getprotobyname exists
8914 set getprotobyname d_getpbyname
8915 eval $inlibc
8916
8917 : see if getprotobynumber exists
8918 set getprotobynumber d_getpbynumber
8919 eval $inlibc
8920
8921 : see if getprotoent exists
8922 set getprotoent d_getpent
8923 eval $inlibc
8924
8925 : see if getpgid exists
8926 set getpgid d_getpgid
8927 eval $inlibc
8928
8929 : see if getpgrp2 exists
8930 set getpgrp2 d_getpgrp2
8931 eval $inlibc
8932
8933 : see if getppid exists
8934 set getppid d_getppid
8935 eval $inlibc
8936
8937 : see if getpriority exists
8938 set getpriority d_getprior
8939 eval $inlibc
8940
8941 : see if prototypes for various getprotoxxx netdb.h functions are available
8942 echo " "
8943 set d_getprotoprotos getprotoent $i_netdb netdb.h
8944 eval $hasproto
8945
8946 : see if getpwent exists
8947 set getpwent d_getpwent
8948 eval $inlibc
8949
8950
8951 : see if getservbyname exists
8952 set getservbyname d_getsbyname
8953 eval $inlibc
8954
8955 : see if getservbyport exists
8956 set getservbyport d_getsbyport
8957 eval $inlibc
8958
8959 : see if getservent exists
8960 set getservent d_getsent
8961 eval $inlibc
8962
8963 : see if prototypes for various getservxxx netdb.h functions are available
8964 echo " "
8965 set d_getservprotos getservent $i_netdb netdb.h
8966 eval $hasproto
8967
8968 : see if getspent exists
8969 set getspent d_getspent
8970 eval $inlibc
8971
8972 : see if getspnam exists
8973 set getspnam d_getspnam
8974 eval $inlibc
8975
8976 : see if gettimeofday or ftime exists
8977 set gettimeofday d_gettimeod
8978 eval $inlibc
8979 case "$d_gettimeod" in
8980 "$undef")
8981         set ftime d_ftime 
8982         eval $inlibc
8983         ;;
8984 *)
8985         val="$undef"; set d_ftime; eval $setvar
8986         ;;
8987 esac
8988 case "$d_gettimeod$d_ftime" in
8989 "$undef$undef")
8990         echo " "
8991         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
8992         ;;
8993 esac
8994
8995 : see if this is an grp system
8996 set grp.h i_grp
8997 eval $inhdr
8998
8999 case "$i_grp" in
9000 $define)
9001         xxx=`./findhdr grp.h`
9002         $cppstdin $cppflags $cppminus < $xxx >$$.h
9003
9004         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
9005                 val="$define"
9006         else
9007                 val="$undef"
9008         fi
9009         set d_grpasswd
9010         eval $setvar
9011
9012         $rm -f $$.h
9013         ;;
9014 *)
9015         val="$undef";
9016         set d_grpasswd; eval $setvar
9017         ;;
9018 esac
9019
9020 : see if hasmntopt exists
9021 set hasmntopt d_hasmntopt
9022 eval $inlibc
9023
9024 : see if this is a netinet/in.h or sys/in.h system
9025 set netinet/in.h i_niin sys/in.h i_sysin
9026 eval $inhdr
9027
9028 : see if arpa/inet.h has to be included
9029 set arpa/inet.h i_arpainet
9030 eval $inhdr
9031
9032 : see if htonl --and friends-- exists
9033 val=''
9034 set htonl val
9035 eval $inlibc
9036
9037 : Maybe they are macros.
9038 case "$val" in
9039 $undef)
9040         $cat >htonl.c <<EOM
9041 #include <stdio.h>
9042 #include <sys/types.h>
9043 #$i_niin I_NETINET_IN
9044 #$i_sysin I_SYS_IN
9045 #$i_arpainet I_ARPA_INET
9046 #ifdef I_NETINET_IN
9047 #include <netinet/in.h>
9048 #endif
9049 #ifdef I_SYS_IN
9050 #include <sys/in.h>
9051 #endif
9052 #ifdef I_ARPA_INET
9053 #include <arpa/inet.h>
9054 #endif
9055 #ifdef htonl
9056 printf("Defined as a macro.");
9057 #endif
9058 EOM
9059         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
9060         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
9061                 val="$define"
9062                 echo "But it seems to be defined as a macro." >&4
9063         fi
9064         $rm -f htonl.?
9065         ;;
9066 esac
9067 set d_htonl
9068 eval $setvar
9069
9070 : see which of string.h or strings.h is needed
9071 echo " "
9072 strings=`./findhdr string.h`
9073 if $test "$strings" && $test -r "$strings"; then
9074         echo "Using <string.h> instead of <strings.h>." >&4
9075         val="$define"
9076 else
9077         val="$undef"
9078         strings=`./findhdr strings.h`
9079         if $test "$strings" && $test -r "$strings"; then
9080                 echo "Using <strings.h> instead of <string.h>." >&4
9081         else
9082                 echo "No string header found -- You'll surely have problems." >&4
9083         fi
9084 fi
9085 set i_string
9086 eval $setvar
9087 case "$i_string" in
9088 "$undef") strings=`./findhdr strings.h`;;
9089 *)        strings=`./findhdr string.h`;;
9090 esac
9091
9092 : index or strchr
9093 echo " "
9094 if set index val -f; eval $csym; $val; then
9095         if set strchr val -f d_strchr; eval $csym; $val; then
9096                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
9097                         val="$define"
9098                         vali="$undef"
9099                         echo "strchr() found." >&4
9100                 else
9101                         val="$undef"
9102                         vali="$define"
9103                         echo "index() found." >&4
9104                 fi
9105         else
9106                 val="$undef"
9107                 vali="$define"
9108                 echo "index() found." >&4
9109         fi
9110 else
9111         if set strchr val -f d_strchr; eval $csym; $val; then
9112                 val="$define"
9113                 vali="$undef"
9114                 echo "strchr() found." >&4
9115         else
9116                 echo "No index() or strchr() found!" >&4
9117                 val="$undef"
9118                 vali="$undef"
9119         fi
9120 fi
9121 set d_strchr; eval $setvar
9122 val="$vali"
9123 set d_index; eval $setvar
9124
9125 : check whether inet_aton exists
9126 set inet_aton d_inetaton
9127 eval $inlibc
9128
9129 : Look for isascii
9130 echo " "
9131 $cat >isascii.c <<'EOCP'
9132 #include <stdio.h>
9133 #include <ctype.h>
9134 int main() {
9135         int c = 'A';
9136         if (isascii(c))
9137                 exit(0);
9138         else
9139                 exit(1);
9140 }
9141 EOCP
9142 set isascii
9143 if eval $compile; then
9144         echo "isascii() found." >&4
9145         val="$define"
9146 else
9147         echo "isascii() NOT found." >&4
9148         val="$undef"
9149 fi
9150 set d_isascii
9151 eval $setvar
9152 $rm -f isascii*
9153
9154 : see if killpg exists
9155 set killpg d_killpg
9156 eval $inlibc
9157
9158 : see if lchown exists
9159 echo " "
9160 $cat > try.c <<'EOCP'
9161 /* System header to define __stub macros and hopefully few prototypes,
9162     which can conflict with char lchown(); below.  */
9163 #include <assert.h>
9164 /* Override any gcc2 internal prototype to avoid an error.  */
9165 /* We use char because int might match the return type of a gcc2
9166    builtin and then its argument prototype would still apply.  */
9167 char lchown();
9168 int main() {
9169     /*  The GNU C library defines this for functions which it implements
9170         to always fail with ENOSYS.  Some functions are actually named
9171         something starting with __ and the normal name is an alias.  */
9172 #if defined (__stub_lchown) || defined (__stub___lchown)
9173 choke me
9174 #else
9175 lchown();
9176 #endif
9177 ; return 0; }
9178 EOCP
9179 set try
9180 if eval $compile; then
9181     $echo "lchown() found." >&4
9182     val="$define"
9183 else
9184     $echo "lchown() NOT found." >&4
9185     val="$undef"
9186 fi
9187 set d_lchown
9188 eval $setvar
9189
9190 : See if number of significant digits in a double precision number is known
9191 echo " "
9192 $cat >ldbl_dig.c <<EOM
9193 #$i_limits I_LIMITS
9194 #$i_float I_FLOAT
9195 #ifdef I_LIMITS
9196 #include <limits.h>
9197 #endif
9198 #ifdef I_FLOAT
9199 #include <float.h>
9200 #endif
9201 #ifdef LDBL_DIG
9202 printf("Contains LDBL_DIG");
9203 #endif
9204 EOM
9205 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
9206 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
9207         echo "LDBL_DIG found." >&4
9208         val="$define"
9209 else
9210         echo "LDBL_DIG NOT found." >&4
9211         val="$undef"
9212 fi
9213 $rm -f ldbl_dig.?
9214 set d_ldbl_dig
9215 eval $setvar
9216
9217 : see if link exists
9218 set link d_link
9219 eval $inlibc
9220
9221 : see if localeconv exists
9222 set localeconv d_locconv
9223 eval $inlibc
9224
9225 : see if lockf exists
9226 set lockf d_lockf
9227 eval $inlibc
9228
9229 : see if lstat exists
9230 set lstat d_lstat
9231 eval $inlibc
9232
9233 : see if madvise exists
9234 set madvise d_madvise
9235 eval $inlibc
9236
9237 : see if mblen exists
9238 set mblen d_mblen
9239 eval $inlibc
9240
9241 : see if mbstowcs exists
9242 set mbstowcs d_mbstowcs
9243 eval $inlibc
9244
9245 : see if mbtowc exists
9246 set mbtowc d_mbtowc
9247 eval $inlibc
9248
9249 : see if memchr exists
9250 set memchr d_memchr
9251 eval $inlibc
9252
9253 : see if memcmp exists
9254 set memcmp d_memcmp
9255 eval $inlibc
9256
9257 : see if memcpy exists
9258 set memcpy d_memcpy
9259 eval $inlibc
9260
9261 : see if memmove exists
9262 set memmove d_memmove
9263 eval $inlibc
9264
9265 : see if memset exists
9266 set memset d_memset
9267 eval $inlibc
9268
9269 : see if mkdir exists
9270 set mkdir d_mkdir
9271 eval $inlibc
9272
9273 : see if mkfifo exists
9274 set mkfifo d_mkfifo
9275 eval $inlibc
9276
9277 : see if mktime exists
9278 set mktime d_mktime
9279 eval $inlibc
9280
9281 : see if this is a sys/mman.h system
9282 set sys/mman.h i_sysmman
9283 eval $inhdr
9284
9285 : see if mmap exists
9286 set mmap d_mmap
9287 eval $inlibc
9288 : see what shmat returns
9289 : default to something harmless
9290 mmaptype='void *'
9291 case "$i_sysmman$d_mmap" in
9292 "$define$define")
9293         $cat >mmap.c <<'END'
9294 #include <sys/mman.h>
9295 void *mmap();
9296 END
9297         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
9298                 mmaptype='void *'
9299         else
9300                 mmaptype='caddr_t'
9301         fi
9302         echo "and it returns ($mmaptype)." >&4
9303         ;;
9304 esac
9305
9306
9307
9308 : see if mprotect exists
9309 set mprotect d_mprotect
9310 eval $inlibc
9311
9312 : see if msgctl exists
9313 set msgctl d_msgctl
9314 eval $inlibc
9315
9316 : see if msgget exists
9317 set msgget d_msgget
9318 eval $inlibc
9319
9320 : see if msgsnd exists
9321 set msgsnd d_msgsnd
9322 eval $inlibc
9323
9324 : see if msgrcv exists
9325 set msgrcv d_msgrcv
9326 eval $inlibc
9327
9328 : see how much of the 'msg*(2)' library is present.
9329 h_msg=true
9330 echo " "
9331 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
9332 *"$undef"*) h_msg=false;;
9333 esac
9334 case "$osname" in
9335 freebsd)
9336     case "`ipcs 2>&1`" in
9337     "SVID messages"*"not configured"*)
9338         echo "Your $osname does not have the msg*(2) configured." >&4
9339         h_msg=false
9340         val="$undef"
9341         set msgctl d_msgctl
9342         eval $setvar
9343         set msgget d_msgget
9344         eval $setvar
9345         set msgsnd d_msgsnd
9346         eval $setvar
9347         set msgrcv d_msgrcv
9348         eval $setvar
9349         ;;
9350     esac
9351     ;;
9352 esac
9353 : we could also check for sys/ipc.h ...
9354 if $h_msg && $test `./findhdr sys/msg.h`; then
9355         echo "You have the full msg*(2) library." >&4
9356         val="$define"
9357 else
9358         echo "You don't have the full msg*(2) library." >&4
9359         val="$undef"
9360 fi
9361 set d_msg
9362 eval $setvar
9363
9364 : see if msync exists
9365 set msync d_msync
9366 eval $inlibc
9367
9368 : see if munmap exists
9369 set munmap d_munmap
9370 eval $inlibc
9371
9372 : see if nice exists
9373 set nice d_nice
9374 eval $inlibc
9375
9376 : see if POSIX threads are available
9377 set pthread.h i_pthread
9378 eval $inhdr
9379
9380
9381
9382
9383 : how to create joinable pthreads
9384 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
9385         echo " "
9386         echo "Checking what constant to use for creating joinable pthreads..." >&4 
9387         $cat >try.c <<'EOCP'
9388 #include <pthread.h>
9389 int main() {
9390     int detachstate = JOINABLE;
9391 }
9392 EOCP
9393         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
9394         if eval $compile; then
9395                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
9396                 val="$undef" # Yes, undef.
9397                 set d_old_pthread_create_joinable
9398                 eval $setvar
9399                 val=""
9400                 set old_pthread_create_joinable
9401                 eval $setvar
9402         else
9403                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
9404                 if eval $compile; then
9405                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
9406                         val="$define"
9407                         set d_old_pthread_create_joinable
9408                         eval $setvar
9409                         val=PTHREAD_CREATE_UNDETACHED
9410                         set old_pthread_create_joinable
9411                         eval $setvar
9412                 else            
9413                         set try -DJOINABLE=__UNDETACHED
9414                         if eval $compile; then
9415                                 echo "You seem to use __UNDETACHED." >&4
9416                                 val="$define"
9417                                 set d_old_pthread_create_joinable
9418                                 eval $setvar
9419                                 val=__UNDETACHED
9420                                 set old_pthread_create_joinable
9421                                 eval $setvar
9422                         else
9423                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
9424                                 val="$define"
9425                                 set d_old_pthread_create_joinable
9426                                 eval $setvar
9427                                 val=0
9428                                 set old_pthread_create_joinable
9429                                 eval $setvar
9430                         fi
9431                 fi
9432         fi
9433         $rm -f try try.*
9434 else
9435     d_old_pthread_create_joinable="$undef"
9436     old_pthread_create_joinable=""
9437 fi
9438
9439 : see if pause exists
9440 set pause d_pause
9441 eval $inlibc
9442
9443 : see if pipe exists
9444 set pipe d_pipe
9445 eval $inlibc
9446
9447 : see if poll exists
9448 set poll d_poll
9449 eval $inlibc
9450
9451
9452 : see whether the various POSIXish _yields exist
9453 $cat >try.c <<EOP
9454 #include <pthread.h>
9455 #include <stdio.h>
9456 int main() {
9457 #ifdef SCHED_YIELD
9458         sched_yield();
9459 #else
9460 #ifdef PTHREAD_YIELD
9461         pthread_yield();
9462 #else
9463 #ifdef PTHREAD_YIELD_NULL
9464         pthread_yield(NULL);
9465 #endif
9466 #endif
9467 #endif
9468 }
9469 EOP
9470 : see if sched_yield exists
9471 set try -DSCHED_YIELD
9472 if eval $compile; then
9473     val="$define"
9474     sched_yield='sched_yield()'
9475 else
9476     val="$undef"
9477 fi
9478 case "$usethreads" in
9479 $define)
9480         case "$val" in
9481         $define) echo 'sched_yield() found.' >&4        ;;
9482         *)       echo 'sched_yield() NOT found.' >&4    ;;
9483         esac
9484 esac
9485 set d_sched_yield
9486 eval $setvar
9487
9488 : see if pthread_yield exists
9489 set try -DPTHREAD_YIELD
9490 if eval $compile; then
9491     val="$define"
9492     case "$sched_yield" in
9493     '') sched_yield='pthread_yield()' ;;
9494     esac
9495 else
9496     set try -DPTHREAD_YIELD_NULL
9497     if eval $compile; then
9498         val="$define"
9499         case "$sched_yield" in
9500         '') sched_yield='pthread_yield(NULL)' ;;
9501         esac
9502     else
9503         val="$undef"
9504     fi
9505 fi
9506 case "$usethreads" in
9507 $define)
9508         case "$val" in
9509         $define) echo 'pthread_yield() found.' >&4      ;;
9510         *)       echo 'pthread_yield() NOT found.' >&4  ;;
9511         esac
9512         ;;
9513 esac
9514 set d_pthread_yield
9515 eval $setvar
9516
9517 case "$sched_yield" in
9518 '') sched_yield=undef ;;
9519 esac
9520
9521 $rm -f try try.*
9522
9523 : see if this is a pwd.h system
9524 set pwd.h i_pwd
9525 eval $inhdr
9526
9527 case "$i_pwd" in
9528 $define)
9529         xxx=`./findhdr pwd.h`
9530         $cppstdin $cppflags $cppminus < $xxx >$$.h
9531
9532         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
9533                 val="$define"
9534         else
9535                 val="$undef"
9536         fi
9537         set d_pwquota
9538         eval $setvar
9539
9540         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
9541                 val="$define"
9542         else
9543                 val="$undef"
9544         fi
9545         set d_pwage
9546         eval $setvar
9547
9548         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
9549                 val="$define"
9550         else
9551                 val="$undef"
9552         fi
9553         set d_pwchange
9554         eval $setvar
9555
9556         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
9557                 val="$define"
9558         else
9559                 val="$undef"
9560         fi
9561         set d_pwclass
9562         eval $setvar
9563
9564         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
9565                 val="$define"
9566         else
9567                 val="$undef"
9568         fi
9569         set d_pwexpire
9570         eval $setvar
9571
9572         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
9573                 val="$define"
9574         else
9575                 val="$undef"
9576         fi
9577         set d_pwcomment
9578         eval $setvar
9579
9580         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
9581                 val="$define"
9582         else
9583                 val="$undef"
9584         fi
9585         set d_pwgecos
9586         eval $setvar
9587
9588         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
9589                 val="$define"
9590         else
9591                 val="$undef"
9592         fi
9593         set d_pwpasswd
9594         eval $setvar
9595
9596         $rm -f $$.h
9597         ;;
9598 *)
9599         val="$undef"; 
9600         set d_pwquota; eval $setvar
9601         set d_pwage; eval $setvar
9602         set d_pwchange; eval $setvar
9603         set d_pwclass; eval $setvar
9604         set d_pwexpire; eval $setvar
9605         set d_pwcomment; eval $setvar
9606         set d_pwgecos; eval $setvar
9607         set d_pwpasswd; eval $setvar
9608         ;;
9609 esac
9610
9611 : see if readdir and friends exist
9612 set readdir d_readdir
9613 eval $inlibc
9614 set seekdir d_seekdir
9615 eval $inlibc
9616 set telldir d_telldir
9617 eval $inlibc
9618 set rewinddir d_rewinddir
9619 eval $inlibc
9620
9621 : see if readlink exists
9622 set readlink d_readlink
9623 eval $inlibc
9624
9625 : see if readv exists
9626 set readv d_readv
9627 eval $inlibc
9628
9629 : see if rename exists
9630 set rename d_rename
9631 eval $inlibc
9632
9633 : see if rmdir exists
9634 set rmdir d_rmdir
9635 eval $inlibc
9636
9637 : see if memory.h is available.
9638 val=''
9639 set memory.h val
9640 eval $inhdr
9641
9642 : See if it conflicts with string.h
9643 case "$val" in
9644 $define)
9645         case "$strings" in
9646         '') ;;
9647         *)
9648                 $cppstdin $cppflags $cppminus < $strings > mem.h
9649                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
9650                         echo " "
9651                         echo "We won't be including <memory.h>."
9652                         val="$undef"
9653                 fi
9654                 $rm -f mem.h
9655                 ;;
9656         esac
9657 esac
9658 set i_memory
9659 eval $setvar
9660
9661 : can bcopy handle overlapping blocks?
9662 val="$undef"
9663 case "$d_bcopy" in
9664 "$define")
9665         echo " "
9666         echo "Checking to see if your bcopy() can do overlapping copies..." >&4
9667         $cat >try.c <<EOCP
9668 #$i_memory I_MEMORY
9669 #$i_stdlib I_STDLIB
9670 #$i_string I_STRING
9671 #$i_unistd I_UNISTD
9672 EOCP
9673         $cat >>try.c <<'EOCP'
9674 #include <stdio.h>
9675 #ifdef I_MEMORY
9676 #  include <memory.h>
9677 #endif
9678 #ifdef I_STDLIB
9679 #  include <stdlib.h>
9680 #endif
9681 #ifdef I_STRING
9682 #  include <string.h>
9683 #else
9684 #  include <strings.h>
9685 #endif
9686 #ifdef I_UNISTD
9687 #  include <unistd.h>  /* Needed for NetBSD */
9688 #endif
9689 int main()
9690 {
9691 char buf[128], abc[128];
9692 char *b;
9693 int len;
9694 int off;
9695 int align;
9696
9697 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
9698
9699 for (align = 7; align >= 0; align--) {
9700         for (len = 36; len; len--) {
9701                 b = buf+align;
9702                 bcopy(abc, b, len);
9703                 for (off = 1; off <= len; off++) {
9704                         bcopy(b, b+off, len);
9705                         bcopy(b+off, b, len);
9706                         if (bcmp(b, abc, len))
9707                                 exit(1);
9708                 }
9709         }
9710 }
9711 exit(0);
9712 }
9713 EOCP
9714         set try
9715         if eval $compile_ok; then
9716                 if ./try 2>/dev/null; then
9717                         echo "Yes, it can."
9718                         val="$define"
9719                 else
9720                         echo "It can't, sorry."
9721                         case "$d_memmove" in
9722                         "$define") echo "But that's Ok since you have memmove()." ;;
9723                         esac
9724                 fi
9725         else
9726                 echo "(I can't compile the test program, so we'll assume not...)"
9727                 case "$d_memmove" in
9728                 "$define") echo "But that's Ok since you have memmove()." ;;
9729                 esac
9730         fi
9731         ;;
9732 esac
9733 $rm -f try.* try core
9734 set d_safebcpy
9735 eval $setvar
9736
9737 : can memcpy handle overlapping blocks?
9738 val="$undef"
9739 case "$d_memcpy" in
9740 "$define")
9741         echo " "
9742         echo "Checking to see if your memcpy() can do overlapping copies..." >&4
9743         $cat >try.c <<EOCP
9744 #$i_memory I_MEMORY
9745 #$i_stdlib I_STDLIB
9746 #$i_string I_STRING
9747 #$i_unistd I_UNISTD
9748 EOCP
9749         $cat >>try.c <<'EOCP'
9750 #include <stdio.h>
9751 #ifdef I_MEMORY
9752 #  include <memory.h>
9753 #endif
9754 #ifdef I_STDLIB
9755 #  include <stdlib.h>
9756 #endif
9757 #ifdef I_STRING
9758 #  include <string.h>
9759 #else
9760 #  include <strings.h>
9761 #endif
9762 #ifdef I_UNISTD
9763 #  include <unistd.h>  /* Needed for NetBSD */
9764 #endif
9765 int main()
9766 {
9767 char buf[128], abc[128];
9768 char *b;
9769 int len;
9770 int off;
9771 int align;
9772
9773 /* Copy "abcde..." string to char abc[] so that gcc doesn't
9774    try to store the string in read-only memory. */
9775 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
9776
9777 for (align = 7; align >= 0; align--) {
9778         for (len = 36; len; len--) {
9779                 b = buf+align;
9780                 memcpy(b, abc, len);
9781                 for (off = 1; off <= len; off++) {
9782                         memcpy(b+off, b, len);
9783                         memcpy(b, b+off, len);
9784                         if (memcmp(b, abc, len))
9785                                 exit(1);
9786                 }
9787         }
9788 }
9789 exit(0);
9790 }
9791 EOCP
9792         set try
9793         if eval $compile_ok; then
9794                 if ./try 2>/dev/null; then
9795                         echo "Yes, it can."
9796                         val="$define"
9797                 else
9798                         echo "It can't, sorry."
9799                         case "$d_memmove" in
9800                         "$define") echo "But that's Ok since you have memmove()." ;;
9801                         esac
9802                 fi
9803         else
9804                 echo "(I can't compile the test program, so we'll assume not...)"
9805                 case "$d_memmove" in
9806                 "$define") echo "But that's Ok since you have memmove()." ;;
9807                 esac
9808         fi
9809         ;;
9810 esac
9811 $rm -f try.* try core
9812 set d_safemcpy
9813 eval $setvar
9814
9815 : can memcmp be trusted to compare relative magnitude?
9816 val="$undef"
9817 case "$d_memcmp" in
9818 "$define")
9819         echo " "
9820         echo "Checking if your memcmp() can compare relative magnitude..." >&4
9821         $cat >try.c <<EOCP
9822 #$i_memory I_MEMORY
9823 #$i_stdlib I_STDLIB
9824 #$i_string I_STRING
9825 #$i_unistd I_UNISTD
9826 EOCP
9827         $cat >>try.c <<'EOCP'
9828 #include <stdio.h>
9829 #ifdef I_MEMORY
9830 #  include <memory.h>
9831 #endif
9832 #ifdef I_STDLIB
9833 #  include <stdlib.h>
9834 #endif
9835 #ifdef I_STRING
9836 #  include <string.h>
9837 #else
9838 #  include <strings.h>
9839 #endif
9840 #ifdef I_UNISTD
9841 #  include <unistd.h>  /* Needed for NetBSD */
9842 #endif
9843 int main()
9844 {
9845 char a = -1;
9846 char b = 0;
9847 if ((a < b) && memcmp(&a, &b, 1) < 0)
9848         exit(1);
9849 exit(0);
9850 }
9851 EOCP
9852         set try
9853         if eval $compile_ok; then
9854                 if ./try 2>/dev/null; then
9855                         echo "Yes, it can."
9856                         val="$define"
9857                 else
9858                         echo "No, it can't (it uses signed chars)."
9859                 fi
9860         else
9861                 echo "(I can't compile the test program, so we'll assume not...)"
9862         fi
9863         ;;
9864 esac
9865 $rm -f try.* try core
9866 set d_sanemcmp
9867 eval $setvar
9868
9869 : see if select exists
9870 set select d_select
9871 eval $inlibc
9872
9873 : see if semctl exists
9874 set semctl d_semctl
9875 eval $inlibc
9876
9877 : see if semget exists
9878 set semget d_semget
9879 eval $inlibc
9880
9881 : see if semop exists
9882 set semop d_semop
9883 eval $inlibc
9884
9885 : see how much of the 'sem*(2)' library is present.
9886 h_sem=true
9887 echo " "
9888 case "$d_semctl$d_semget$d_semop" in
9889 *"$undef"*) h_sem=false;;
9890 esac
9891 case "$osname" in
9892 freebsd)
9893     case "`ipcs 2>&1`" in
9894     "SVID messages"*"not configured"*)
9895         echo "Your $osname does not have the sem*(2) configured." >&4
9896         h_sem=false
9897         val="$undef"
9898         set semctl d_semctl
9899         eval $setvar
9900         set semget d_semget
9901         eval $setvar
9902         set semop d_semop
9903         eval $setvar
9904         ;;
9905     esac
9906     ;;
9907 esac
9908 : we could also check for sys/ipc.h ...
9909 if $h_sem && $test `./findhdr sys/sem.h`; then
9910         echo "You have the full sem*(2) library." >&4
9911         val="$define"
9912 else
9913         echo "You don't have the full sem*(2) library." >&4
9914         val="$undef"
9915 fi
9916 set d_sem
9917 eval $setvar
9918
9919 : see whether sys/sem.h defines union semun
9920 echo " "
9921 $cat > try.c <<'END'
9922 #include <sys/types.h>
9923 #include <sys/ipc.h>
9924 #include <sys/sem.h>
9925 int main () { union semun semun; semun.buf = 0; }
9926 END
9927 set try
9928 if eval $compile; then
9929     echo "You have union semun in <sys/sem.h>." >&4
9930     val="$define"
9931 else
9932     echo "You do not have union semun in <sys/sem.h>." >&4
9933     val="$undef"
9934 fi
9935 $rm -f try try.c try.h
9936 set d_union_semun
9937 eval $setvar
9938
9939 : see how to do semctl IPC_STAT
9940 case "$d_sem" in
9941 $define)
9942     : see whether semctl IPC_STAT can use union semun
9943     echo " "
9944     $cat > try.h <<END
9945 #ifndef S_IRUSR
9946 #   ifdef S_IREAD
9947 #       define S_IRUSR S_IREAD
9948 #       define S_IWUSR S_IWRITE
9949 #       define S_IXUSR S_IEXEC
9950 #   else
9951 #       define S_IRUSR 0400
9952 #       define S_IWUSR 0200
9953 #       define S_IXUSR 0100
9954 #   endif
9955 #   define S_IRGRP (S_IRUSR>>3)
9956 #   define S_IWGRP (S_IWUSR>>3)
9957 #   define S_IXGRP (S_IXUSR>>3)
9958 #   define S_IROTH (S_IRUSR>>6)
9959 #   define S_IWOTH (S_IWUSR>>6)
9960 #   define S_IXOTH (S_IXUSR>>6)
9961 #endif
9962 #ifndef S_IRWXU
9963 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
9964 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
9965 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
9966 #endif
9967 END
9968
9969     $cat > try.c <<END
9970 #include <sys/types.h>
9971 #include <sys/ipc.h>
9972 #include <sys/sem.h>
9973 #include <sys/stat.h>
9974 #include <stdio.h>
9975 #include <errno.h>
9976 #include "try.h"
9977 #ifndef errno
9978 extern int errno;
9979 #endif
9980 #$d_union_semun HAS_UNION_SEMUN
9981 int main() {
9982     union semun
9983 #ifndef HAS_UNION_SEMUN
9984     {
9985         int val;
9986         struct semid_ds *buf;
9987         unsigned short *array;
9988     }
9989 #endif
9990     arg;
9991     int sem, st;
9992
9993 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
9994     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
9995     if (sem > -1) {
9996         struct semid_ds argbuf;
9997         arg.buf = &argbuf;
9998 #       ifdef IPC_STAT
9999         st = semctl(sem, 0, IPC_STAT, arg);
10000         if (st == 0)
10001             printf("semun\n");
10002         else
10003 #       endif /* IPC_STAT */
10004             printf("semctl IPC_STAT failed: errno = %d\n", errno);
10005 #       ifdef IPC_RMID
10006         if (semctl(sem, 0, IPC_RMID, arg) != 0)
10007 #       endif /* IPC_RMID */
10008             printf("semctl IPC_RMID failed: errno = %d\n", errno);
10009     } else
10010 #endif /* IPC_PRIVATE && ... */
10011         printf("semget failed: errno = %d\n", errno);
10012   return 0;
10013 }
10014 END
10015     val="$undef"
10016     set try
10017     if eval $compile; then
10018         xxx=`./try`
10019         case "$xxx" in
10020         semun) val="$define" ;;
10021         esac
10022     fi
10023     $rm -f try try.c
10024     set d_semctl_semun
10025     eval $setvar
10026     case "$d_semctl_semun" in
10027     $define)
10028         echo "You can use union semun for semctl IPC_STAT." >&4
10029         also='also'
10030         ;;
10031     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
10032         also=''
10033         ;;
10034     esac
10035
10036     : see whether semctl IPC_STAT can use struct semid_ds pointer
10037     $cat > try.c <<'END'
10038 #include <sys/types.h>
10039 #include <sys/ipc.h>
10040 #include <sys/sem.h>
10041 #include <sys/stat.h>
10042 #include "try.h"
10043 #include <stdio.h>
10044 #include <errno.h>
10045 #ifndef errno
10046 extern int errno;
10047 #endif
10048 int main() {
10049     struct semid_ds arg;
10050     int sem, st;
10051
10052 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
10053     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
10054     if (sem > -1) {
10055 #       ifdef IPC_STAT
10056         st = semctl(sem, 0, IPC_STAT, &arg);
10057         if (st == 0)
10058             printf("semid_ds\n");
10059         else
10060 #       endif /* IPC_STAT */
10061             printf("semctl IPC_STAT failed: errno = %d\n", errno);
10062 #       ifdef IPC_RMID
10063         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
10064 #       endif /* IPC_RMID */
10065             printf("semctl IPC_RMID failed: errno = %d\n", errno);
10066     } else
10067 #endif /* IPC_PRIVATE && ... */
10068         printf("semget failed: errno = %d\n", errno);
10069
10070     return 0;
10071 }
10072 END
10073     val="$undef"
10074     set try
10075     if eval $compile; then
10076         xxx=`./try`
10077         case "$xxx" in
10078         semid_ds) val="$define" ;;
10079         esac
10080     fi
10081     $rm -f try try.c
10082     set d_semctl_semid_ds
10083     eval $setvar
10084     case "$d_semctl_semid_ds" in
10085     $define)
10086         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
10087         ;;
10088     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
10089         ;;
10090     esac
10091     $rm -f try.h
10092     ;;
10093 *)  val="$undef"
10094
10095     # We do not have the full sem*(2) library, so assume we can not
10096     # use either.
10097
10098     set d_semctl_semun
10099     eval $setvar
10100
10101     set d_semctl_semid_ds
10102     eval $setvar
10103     ;;
10104 esac
10105
10106 : see if setegid exists
10107 set setegid d_setegid
10108 eval $inlibc
10109
10110 : see if seteuid exists
10111 set seteuid d_seteuid
10112 eval $inlibc
10113
10114 : see if setgrent exists
10115 set setgrent d_setgrent
10116 eval $inlibc
10117
10118 : see if sethostent exists
10119 set sethostent d_sethent
10120 eval $inlibc
10121
10122 : see if setlinebuf exists
10123 set setlinebuf d_setlinebuf
10124 eval $inlibc
10125
10126 : see if setlocale exists
10127 set setlocale d_setlocale
10128 eval $inlibc
10129
10130 : see if setnetent exists
10131 set setnetent d_setnent
10132 eval $inlibc
10133
10134 : see if setprotoent exists
10135 set setprotoent d_setpent
10136 eval $inlibc
10137
10138 : see if setpgid exists
10139 set setpgid d_setpgid
10140 eval $inlibc
10141
10142 : see if setpgrp2 exists
10143 set setpgrp2 d_setpgrp2
10144 eval $inlibc
10145
10146 : see if setpriority exists
10147 set setpriority d_setprior
10148 eval $inlibc
10149
10150 : see if setpwent exists
10151 set setpwent d_setpwent
10152 eval $inlibc
10153
10154 : see if setregid exists
10155 set setregid d_setregid
10156 eval $inlibc
10157 set setresgid d_setresgid
10158 eval $inlibc
10159
10160 : see if setreuid exists
10161 set setreuid d_setreuid
10162 eval $inlibc
10163 set setresuid d_setresuid
10164 eval $inlibc
10165
10166 : see if setrgid exists
10167 set setrgid d_setrgid
10168 eval $inlibc
10169
10170 : see if setruid exists
10171 set setruid d_setruid
10172 eval $inlibc
10173
10174 : see if setservent exists
10175 set setservent d_setsent
10176 eval $inlibc
10177
10178 : see if setsid exists
10179 set setsid d_setsid
10180 eval $inlibc
10181
10182 : see if setspent exists
10183 set setspent d_setspent
10184 eval $inlibc
10185
10186 : see if setvbuf exists
10187 set setvbuf d_setvbuf
10188 eval $inlibc
10189
10190 : see if sfio.h is available
10191 set sfio.h i_sfio
10192 eval $inhdr
10193
10194
10195 : see if sfio library is available
10196 case "$i_sfio" in
10197 $define)
10198         val=''
10199         set sfreserve val
10200         eval $inlibc
10201         ;;
10202 *)
10203         val="$undef"
10204         ;;
10205 esac
10206 : Ok, but do we want to use it.
10207 case "$val" in
10208 $define)
10209         case "$usesfio" in
10210         true|$define|[yY]*) dflt='y';;
10211         *) dflt='n';;
10212         esac
10213         echo "$package can use the sfio library, but it is experimental."
10214         rp="You seem to have sfio available, do you want to try using it?"
10215         . ./myread
10216         case "$ans" in
10217         y|Y) ;;
10218         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
10219                 val="$undef"
10220                 : Remove sfio from list of libraries to use
10221                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
10222                 shift
10223                 libs="$*"
10224                 echo "libs = $libs" >&4
10225                 ;;
10226         esac
10227         ;;
10228 *)      case "$usesfio" in
10229         true|$define|[yY]*)
10230                 echo "Sorry, cannot find sfio on this machine" >&4
10231                 echo "Ignoring your setting of usesfio=$usesfio" >&4
10232                 ;;
10233         esac
10234         ;;
10235 esac
10236 set d_sfio
10237 eval $setvar
10238 case "$d_sfio" in
10239 $define) usesfio='true';;
10240 *) usesfio='false';;
10241 esac
10242
10243 : see if shmctl exists
10244 set shmctl d_shmctl
10245 eval $inlibc
10246
10247 : see if shmget exists
10248 set shmget d_shmget
10249 eval $inlibc
10250
10251 : see if shmat exists
10252 set shmat d_shmat
10253 eval $inlibc
10254 : see what shmat returns
10255 case "$d_shmat" in
10256 "$define")
10257         $cat >shmat.c <<'END'
10258 #include <sys/shm.h>
10259 void *shmat();
10260 END
10261         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
10262                 shmattype='void *'
10263         else
10264                 shmattype='char *'
10265         fi
10266         echo "and it returns ($shmattype)." >&4
10267         : see if a prototype for shmat is available
10268         xxx=`./findhdr sys/shm.h`
10269         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
10270         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
10271                 val="$define"
10272         else
10273                 val="$undef"
10274         fi
10275         $rm -f shmat.[co]
10276         ;;
10277 *)
10278         val="$undef"
10279         ;;
10280 esac
10281 set d_shmatprototype
10282 eval $setvar
10283
10284 : see if shmdt exists
10285 set shmdt d_shmdt
10286 eval $inlibc
10287
10288 : see how much of the 'shm*(2)' library is present.
10289 h_shm=true
10290 echo " "
10291 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
10292 *"$undef"*) h_shm=false;;
10293 esac
10294 case "$osname" in
10295 freebsd)
10296     case "`ipcs 2>&1`" in
10297     "SVID shared memory"*"not configured"*)
10298         echo "Your $osname does not have the shm*(2) configured." >&4
10299         h_shm=false
10300         val="$undef"
10301         set shmctl d_shmctl
10302         evat $setvar
10303         set shmget d_shmget
10304         evat $setvar
10305         set shmat d_shmat
10306         evat $setvar
10307         set shmdt d_shmdt
10308         evat $setvar
10309         ;;
10310     esac
10311     ;;
10312 esac
10313 : we could also check for sys/ipc.h ...
10314 if $h_shm && $test `./findhdr sys/shm.h`; then
10315         echo "You have the full shm*(2) library." >&4
10316         val="$define"
10317 else
10318         echo "You don't have the full shm*(2) library." >&4
10319         val="$undef"
10320 fi
10321 set d_shm
10322 eval $setvar
10323
10324 echo " "
10325 : see if we have sigaction
10326 if set sigaction val -f d_sigaction; eval $csym; $val; then
10327         echo 'sigaction() found.' >&4
10328         $cat > try.c <<'EOP'
10329 #include <stdio.h>
10330 #include <sys/types.h>
10331 #include <signal.h>
10332 int main()
10333 {
10334     struct sigaction act, oact;
10335     act.sa_flags = 0;
10336     oact.sa_handler = 0;
10337 }
10338 EOP
10339         set try
10340         if eval $compile_ok; then
10341                 val="$define"
10342         else
10343                 echo "But you don't seem to have a useable struct sigaction." >&4
10344                 val="$undef"
10345         fi
10346 else
10347         echo 'sigaction NOT found.' >&4
10348         val="$undef"
10349 fi
10350 set d_sigaction; eval $setvar
10351 $rm -f try try$_o try.c
10352
10353 : see if sigsetjmp exists
10354 echo " "
10355 case "$d_sigsetjmp" in
10356 '')
10357         $cat >try.c <<'EOP'
10358 #include <setjmp.h>
10359 sigjmp_buf env;
10360 int set = 1;
10361 int main()
10362 {
10363         if (sigsetjmp(env,1))
10364                 exit(set);
10365         set = 0;
10366         siglongjmp(env, 1);
10367         exit(1);
10368 }
10369 EOP
10370         set try
10371         if eval $compile; then
10372                 if ./try >/dev/null 2>&1; then
10373                         echo "POSIX sigsetjmp found." >&4
10374                         val="$define"
10375                 else
10376                         $cat >&4 <<EOM
10377 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
10378 I'll ignore them.
10379 EOM
10380                         val="$undef"
10381                 fi
10382         else
10383                 echo "sigsetjmp not found." >&4
10384                 val="$undef"
10385         fi
10386         ;;
10387 *) val="$d_sigsetjmp"
10388         case "$d_sigsetjmp" in
10389         $define) echo "POSIX sigsetjmp found." >&4;;
10390         $undef) echo "sigsetjmp not found." >&4;;
10391         esac
10392         ;;
10393 esac
10394 set d_sigsetjmp
10395 eval $setvar
10396 $rm -f try.c try
10397
10398 : see if sqrtl exists
10399 set sqrtl d_sqrtl
10400 eval $inlibc
10401
10402 : see if sys/stat.h is available
10403 set sys/stat.h i_sysstat
10404 eval $inhdr
10405
10406 : see if stat knows about block sizes
10407 echo " "
10408 set d_statblks stat st_blocks $i_sysstat sys/stat.h
10409 eval $hasfield
10410
10411 : see if _ptr and _cnt from stdio act std
10412 echo " "
10413 if $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
10414         echo "(Looks like you have stdio.h from Linux.)"
10415         case "$stdio_ptr" in
10416         '') stdio_ptr='((fp)->_IO_read_ptr)'
10417                 ptr_lval=$define
10418                 ;;
10419         *)      ptr_lval=$d_stdio_ptr_lval;;
10420         esac
10421         case "$stdio_cnt" in
10422         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
10423                 cnt_lval=$undef
10424                 ;;
10425         *)      cnt_lval=$d_stdio_cnt_lval;;
10426         esac
10427         case "$stdio_base" in
10428         '') stdio_base='((fp)->_IO_read_base)';;
10429         esac
10430         case "$stdio_bufsiz" in
10431         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
10432         esac
10433 else
10434         case "$stdio_ptr" in
10435         '') stdio_ptr='((fp)->_ptr)'
10436                 ptr_lval=$define
10437                 ;;
10438         *)      ptr_lval=$d_stdio_ptr_lval;;
10439         esac
10440         case "$stdio_cnt" in
10441         '') stdio_cnt='((fp)->_cnt)'
10442                 cnt_lval=$define
10443                 ;;
10444         *)      cnt_lval=$d_stdio_cnt_lval;;
10445         esac
10446         case "$stdio_base" in
10447         '') stdio_base='((fp)->_base)';;
10448         esac
10449         case "$stdio_bufsiz" in
10450         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
10451         esac
10452 fi
10453 : test whether _ptr and _cnt really work
10454 echo "Checking how std your stdio is..." >&4
10455 $cat >try.c <<EOP
10456 #include <stdio.h>
10457 #define FILE_ptr(fp)    $stdio_ptr
10458 #define FILE_cnt(fp)    $stdio_cnt
10459 int main() {
10460         FILE *fp = fopen("try.c", "r");
10461         char c = getc(fp);
10462         if (
10463                 18 <= FILE_cnt(fp) &&
10464                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
10465         )
10466                 exit(0);
10467         exit(1);
10468 }
10469 EOP
10470 val="$undef"
10471 set try
10472 if eval $compile; then
10473         if ./try; then
10474                 echo "Your stdio acts pretty std."
10475                 val="$define"
10476         else
10477                 echo "Your stdio isn't very std."
10478         fi
10479 else
10480         echo "Your stdio doesn't appear very std."
10481 fi
10482 $rm -f try.c try
10483 set d_stdstdio
10484 eval $setvar
10485
10486 : Can _ptr be used as an lvalue?
10487 case "$d_stdstdio$ptr_lval" in
10488 $define$define) val=$define ;;
10489 *) val=$undef ;;
10490 esac
10491 set d_stdio_ptr_lval
10492 eval $setvar
10493
10494 : Can _cnt be used as an lvalue?
10495 case "$d_stdstdio$cnt_lval" in
10496 $define$define) val=$define ;;
10497 *) val=$undef ;;
10498 esac
10499 set d_stdio_cnt_lval
10500 eval $setvar
10501
10502 : see if _base is also standard
10503 val="$undef"
10504 case "$d_stdstdio" in
10505 $define)
10506         $cat >try.c <<EOP
10507 #include <stdio.h>
10508 #define FILE_base(fp)   $stdio_base
10509 #define FILE_bufsiz(fp) $stdio_bufsiz
10510 int main() {
10511         FILE *fp = fopen("try.c", "r");
10512         char c = getc(fp);
10513         if (
10514                 19 <= FILE_bufsiz(fp) &&
10515                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
10516         )
10517                 exit(0);
10518         exit(1);
10519 }
10520 EOP
10521         set try
10522         if eval $compile; then
10523                 if ./try; then
10524                         echo "And its _base field acts std."
10525                         val="$define"
10526                 else
10527                         echo "But its _base field isn't std."
10528                 fi
10529         else
10530                 echo "However, it seems to be lacking the _base field."
10531         fi
10532         $rm -f try.c try
10533         ;;
10534 esac
10535 set d_stdiobase
10536 eval $setvar
10537
10538 $cat >&4 <<EOM
10539 Checking how to access stdio streams by file descriptor number...
10540 EOM
10541 case "$stdio_stream_array" in
10542 '')     $cat >try.c <<EOCP
10543 #include <stdio.h>
10544 int main() {
10545   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
10546     printf("yes\n");
10547 }
10548 EOCP
10549         for s in _iob __iob __sF
10550         do
10551                 set try -DSTDIO_STREAM_ARRAY=$s
10552                 if eval $compile; then
10553                         case "`./try$exe_ext`" in
10554                         yes)    stdio_stream_array=$s; break ;;
10555                         esac
10556                 fi
10557         done
10558         $rm -f try.* try$exe_ext
10559 esac
10560 case "$stdio_stream_array" in
10561 '')     $cat >&4 <<EOM
10562 I can't figure out how to access stdio streams by file descriptor number.
10563 EOM
10564         d_stdio_stream_array="$undef"
10565         ;;
10566 *)      $cat >&4 <<EOM
10567 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
10568 EOM
10569         d_stdio_stream_array="$define"
10570         ;;
10571 esac
10572
10573 : see if strcoll exists
10574 set strcoll d_strcoll
10575 eval $inlibc
10576
10577 : check for structure copying
10578 echo " "
10579 echo "Checking to see if your C compiler can copy structs..." >&4
10580 $cat >try.c <<'EOCP'
10581 int main()
10582 {
10583         struct blurfl {
10584                 int dyick;
10585         } foo, bar;
10586
10587         foo = bar;
10588 }
10589 EOCP
10590 if $cc -c try.c >/dev/null 2>&1 ; then
10591         val="$define"
10592         echo "Yup, it can."
10593 else
10594         val="$undef"
10595         echo "Nope, it can't."
10596 fi
10597 set d_strctcpy
10598 eval $setvar
10599 $rm -f try.*
10600
10601 : see if strerror and/or sys_errlist[] exist
10602 echo " "
10603 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
10604     if set strerror val -f d_strerror; eval $csym; $val; then
10605                 echo 'strerror() found.' >&4
10606                 d_strerror="$define"
10607                 d_strerrm='strerror(e)'
10608                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
10609                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
10610                         d_syserrlst="$define"
10611                 else
10612                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
10613                         d_syserrlst="$undef"
10614                 fi
10615     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
10616                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
10617                 echo 'strerror() found in string header.' >&4
10618                 d_strerror="$define"
10619                 d_strerrm='strerror(e)'
10620                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
10621                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
10622                                 d_syserrlst="$define"
10623                 else
10624                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
10625                         d_syserrlst="$undef"
10626                 fi
10627     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
10628                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
10629                 d_strerror="$undef"
10630                 d_syserrlst="$define"
10631                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
10632     else
10633                 echo 'strerror() and sys_errlist[] NOT found.' >&4
10634                 d_strerror="$undef"
10635                 d_syserrlst="$undef"
10636                 d_strerrm='"unknown"'
10637     fi
10638 fi
10639
10640 : see if strtod exists
10641 set strtod d_strtod
10642 eval $inlibc
10643
10644 : see if strtol exists
10645 set strtol d_strtol
10646 eval $inlibc
10647
10648 : see if strtoul exists
10649 set strtoul d_strtoul
10650 eval $inlibc
10651
10652 : see if strtoull exists
10653 set strtoull d_strtoull
10654 eval $inlibc
10655
10656 : see if strxfrm exists
10657 set strxfrm d_strxfrm
10658 eval $inlibc
10659
10660 : see if symlink exists
10661 set symlink d_symlink
10662 eval $inlibc
10663
10664 : see if syscall exists
10665 set syscall d_syscall
10666 eval $inlibc
10667
10668 : see if sysconf exists
10669 set sysconf d_sysconf
10670 eval $inlibc
10671
10672 : see if system exists
10673 set system d_system
10674 eval $inlibc
10675
10676 : see if tcgetpgrp exists
10677 set tcgetpgrp d_tcgetpgrp
10678 eval $inlibc
10679
10680 : see if tcsetpgrp exists
10681 set tcsetpgrp d_tcsetpgrp
10682 eval $inlibc
10683
10684 : see if prototype for telldir is available
10685 echo " "
10686 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
10687 eval $hasproto
10688
10689 : define an is-a-typedef? function
10690 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
10691 case "$inclist" in
10692 "") inclist="sys/types.h";;
10693 esac;
10694 eval "varval=\$$var";
10695 case "$varval" in
10696 "")
10697         $rm -f temp.c;
10698         for inc in $inclist; do
10699                 echo "#include <$inc>" >>temp.c;
10700         done;
10701         echo "#ifdef $type" >> temp.c;
10702         echo "printf(\"We have $type\");" >> temp.c;
10703         echo "#endif" >> temp.c;
10704         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
10705         if $contains $type temp.E >/dev/null 2>&1; then
10706                 eval "$var=\$type";
10707         else
10708                 eval "$var=\$def";
10709         fi;
10710         $rm -f temp.?;;
10711 *) eval "$var=\$varval";;
10712 esac'
10713
10714 : define an is-a-typedef? function that prompts if the type is not available.
10715 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
10716 case "$inclist" in
10717 "") inclist="sys/types.h";;
10718 esac;
10719 eval "varval=\$$var";
10720 case "$varval" in
10721 "")
10722         $rm -f temp.c;
10723         for inc in $inclist; do
10724                 echo "#include <$inc>" >>temp.c;
10725         done;
10726         echo "#ifdef $type" >> temp.c;
10727         echo "printf(\"We have $type\");" >> temp.c;
10728         echo "#endif" >> temp.c;
10729         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
10730         echo " " ;
10731         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
10732         if $contains $type temp.E >/dev/null 2>&1; then
10733                 echo "$type found." >&4;
10734                 eval "$var=\$type";
10735         else
10736                 echo "$type NOT found." >&4;
10737                 dflt="$def";
10738                 . ./myread ;
10739                 eval "$var=\$ans";
10740         fi;
10741         $rm -f temp.?;;
10742 *) eval "$var=\$varval";;
10743 esac'
10744
10745 : see if this is a sys/times.h system
10746 set sys/times.h i_systimes
10747 eval $inhdr
10748
10749 : see if times exists
10750 echo " "
10751 if set times val -f d_times; eval $csym; $val; then
10752         echo 'times() found.' >&4
10753         d_times="$define"
10754         inc=''
10755         case "$i_systimes" in
10756         "$define") inc='sys/times.h';;
10757         esac
10758         rp="What is the type returned by times() on this system?"
10759         set clock_t clocktype long stdio.h sys/types.h $inc
10760         eval $typedef_ask
10761 else
10762         echo 'times() NOT found, hope that will do.' >&4
10763         d_times="$undef"
10764         clocktype='int'
10765 fi
10766
10767 : see if truncate exists
10768 set truncate d_truncate
10769 eval $inlibc
10770
10771 : see if tzname[] exists
10772 echo " "
10773 if set tzname val -a d_tzname; eval $csym; $val; then
10774         val="$define"
10775         echo 'tzname[] found.' >&4
10776 else
10777         val="$undef"
10778         echo 'tzname[] NOT found.' >&4
10779 fi
10780 set d_tzname
10781 eval $setvar
10782
10783 : see if umask exists
10784 set umask d_umask
10785 eval $inlibc
10786
10787 : see if ustat exists
10788 set ustat d_ustat
10789 eval $inlibc
10790
10791 : backward compatibility for d_hvfork
10792 if test X$d_hvfork != X; then
10793         d_vfork="$d_hvfork"
10794         d_hvfork=''
10795 fi
10796 : see if there is a vfork
10797 val=''
10798 set vfork val
10799 eval $inlibc
10800
10801 : Ok, but do we want to use it. vfork is reportedly unreliable in 
10802 : perl on Solaris 2.x, and probably elsewhere.
10803 case "$val" in
10804 $define)
10805         echo " "
10806         case "$usevfork" in
10807         false) dflt='n';;
10808         *) dflt='y';;
10809         esac
10810         cat <<'EOM'
10811  
10812 Perl can only use a vfork() that doesn't suffer from strict
10813 restrictions on calling functions or modifying global data in
10814 the child.  For example, glibc-2.1 contains such a vfork()
10815 that is unsuitable.  If your system provides a proper fork()
10816 call, chances are that you do NOT want perl to use vfork().
10817
10818 EOM
10819         rp="Do you still want to use vfork()?"
10820         . ./myread
10821         case "$ans" in
10822         y|Y) ;;
10823         *)
10824                 echo "Ok, we won't use vfork()."
10825                 val="$undef"
10826                 ;;
10827         esac
10828         ;;
10829 esac
10830 set d_vfork
10831 eval $setvar
10832 case "$d_vfork" in
10833 $define) usevfork='true';;
10834 *) usevfork='false';;
10835 esac
10836
10837 : see if this is an sysdir system
10838 set sys/dir.h i_sysdir
10839 eval $inhdr
10840
10841 : see if this is an sysndir system
10842 set sys/ndir.h i_sysndir
10843 eval $inhdr
10844
10845 : see if closedir exists
10846 set closedir d_closedir
10847 eval $inlibc
10848
10849 case "$d_closedir" in
10850 "$define")
10851         echo " "
10852         echo "Checking whether closedir() returns a status..." >&4
10853         cat > closedir.c <<EOM
10854 #$i_dirent I_DIRENT             /**/
10855 #$i_sysdir I_SYS_DIR            /**/
10856 #$i_sysndir I_SYS_NDIR          /**/
10857 #$i_systypes I_SYS_TYPES        /**/
10858
10859 #if defined(I_SYS_TYPES)
10860 #include <sys/types.h>
10861 #endif
10862 #if defined(I_DIRENT)
10863 #include <dirent.h>
10864 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
10865 #include <sys/dir.h>
10866 #endif
10867 #else
10868 #ifdef I_SYS_NDIR
10869 #include <sys/ndir.h>
10870 #else
10871 #ifdef I_SYS_DIR
10872 #ifdef hp9000s500
10873 #include <ndir.h>       /* may be wrong in the future */
10874 #else
10875 #include <sys/dir.h>
10876 #endif
10877 #endif
10878 #endif
10879 #endif 
10880 int main() { return closedir(opendir(".")); }
10881 EOM
10882         set closedir
10883         if eval $compile_ok; then
10884                 if ./closedir > /dev/null 2>&1 ; then
10885                         echo "Yes, it does."
10886                         val="$undef"
10887                 else
10888                         echo "No, it doesn't."
10889                         val="$define"
10890                 fi
10891         else
10892                 echo "(I can't seem to compile the test program--assuming it doesn't)"
10893                 val="$define"
10894         fi
10895         ;;
10896 *)
10897         val="$undef";
10898         ;;
10899 esac
10900 set d_void_closedir
10901 eval $setvar
10902 $rm -f closedir*
10903 : check for volatile keyword
10904 echo " "
10905 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
10906 $cat >try.c <<'EOCP'
10907 int main()
10908 {
10909         typedef struct _goo_struct goo_struct;
10910         goo_struct * volatile goo = ((goo_struct *)0);
10911         struct _goo_struct {
10912                 long long_int;
10913                 int reg_int;
10914                 char char_var;
10915         };
10916         typedef unsigned short foo_t;
10917         char *volatile foo;
10918         volatile int bar;
10919         volatile foo_t blech;
10920         foo = foo;
10921 }
10922 EOCP
10923 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
10924         val="$define"
10925         echo "Yup, it does."
10926 else
10927         val="$undef"
10928         echo "Nope, it doesn't."
10929 fi
10930 set d_volatile
10931 eval $setvar
10932 $rm -f try.*
10933
10934 : see if there is a wait4
10935 set wait4 d_wait4
10936 eval $inlibc
10937
10938 : see if waitpid exists
10939 set waitpid d_waitpid
10940 eval $inlibc
10941
10942 : see if wcstombs exists
10943 set wcstombs d_wcstombs
10944 eval $inlibc
10945
10946 : see if wctomb exists
10947 set wctomb d_wctomb
10948 eval $inlibc
10949
10950 : see if writev exists
10951 set writev d_writev
10952 eval $inlibc
10953
10954 : preserve RCS keywords in files with variable substitution, grrr
10955 Date='$Date'
10956 Id='$Id'
10957 Log='$Log'
10958 RCSfile='$RCSfile'
10959 Revision='$Revision'
10960
10961 case "$crosscompile" in
10962 ''|[nN]*) crosscompile="$undef" ;;
10963 esac
10964
10965 case "$osname" in
10966 next|rhapsody) multiarch="$define" ;;
10967 esac
10968 case "$multiarch" in
10969 ''|[nN]*) multiarch="$undef" ;;
10970 esac
10971
10972 : check for alignment requirements
10973 echo " "
10974 case "$crosscompile$multiarch" in
10975 *$define*)
10976         $cat <<EOM
10977 You seem to be either cross-compiling or doing a multiarchitecture build,
10978 skipping the memory alignment check.
10979
10980 EOM
10981         case "$alignbytes" in
10982         '') alignbytes=8 ;;
10983         esac
10984         ;;
10985 *)
10986         case "$alignbytes" in
10987         '') echo "Checking alignment constraints..." >&4
10988                 $cat >try.c <<'EOCP'
10989 struct foobar {
10990         char foo;
10991         double bar;
10992 } try_algn;
10993 int main()
10994 {
10995         printf("%d\n", (char *)&try_algn.bar - (char *)&try_algn.foo);
10996 }
10997 EOCP
10998                 set try
10999                 if eval $compile_ok; then
11000                         dflt=`./try`
11001                 else
11002                         dflt='8'
11003                         echo "(I can't seem to compile the test program...)"
11004                 fi
11005                 ;;
11006         *) dflt="$alignbytes"
11007                 ;;
11008         esac
11009         rp="Doubles must be aligned on a how-many-byte boundary?"
11010         . ./myread
11011         alignbytes="$ans"
11012         $rm -f try.c try
11013         ;;
11014 esac
11015
11016
11017 : check for ordering of bytes in a long
11018 echo " "
11019 case "$crosscompile$multiarch" in
11020 *$define*)
11021         $cat <<EOM
11022 You seem to be either cross-compiling or doing a multiarchitecture build,
11023 skipping the byteorder check.
11024
11025 EOM
11026         byteorder='0xffff'
11027         ;;
11028 *)
11029         case "$byteorder" in
11030         '')
11031                 $cat <<'EOM'
11032 In the following, larger digits indicate more significance.  A big-endian
11033 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
11034 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
11035 machines may have weird orders like 3412.  A Cray will report 87654321,
11036 an Alpha will report 12345678. If the test program works the default is
11037 probably right.
11038 I'm now running the test program...
11039 EOM
11040                 $cat >try.c <<'EOCP'
11041 #include <stdio.h>
11042 int main()
11043 {
11044         int i;
11045         union {
11046                 unsigned long l;
11047                 char c[sizeof(long)];
11048         } u;
11049
11050         if (sizeof(long) > 4)
11051                 u.l = (0x08070605L << 32) | 0x04030201L;
11052         else
11053                 u.l = 0x04030201L;
11054         for (i = 0; i < sizeof(long); i++)
11055                 printf("%c", u.c[i]+'0');
11056         printf("\n");
11057         exit(0);
11058 }
11059 EOCP
11060                 xxx_prompt=y
11061                 set try
11062                 if eval $compile && ./try > /dev/null; then
11063                         dflt=`./try`
11064                         case "$dflt" in
11065                         [1-4][1-4][1-4][1-4]|12345678|87654321)
11066                                 echo "(The test program ran ok.)"
11067                                 echo "byteorder=$dflt"
11068                                 xxx_prompt=n
11069                         ;;
11070                         ????|????????) echo "(The test program ran ok.)" ;;
11071                         *) echo "(The test program didn't run right for some reason.)" ;;
11072                         esac
11073                 else
11074                         dflt='4321'
11075                         cat <<'EOM'
11076 (I can't seem to compile the test program.  Guessing big-endian...)
11077 EOM
11078                 fi
11079                 case "$xxx_prompt" in
11080                 y)
11081                         rp="What is the order of bytes in a long?"
11082                         . ./myread
11083                         byteorder="$ans"
11084                         ;;
11085                 *)      byteorder=$dflt
11086                         ;;
11087                 esac
11088                 ;;
11089         esac
11090         $rm -f try.c try
11091         ;;
11092 esac
11093
11094
11095 : how do we catenate cpp tokens here?
11096 echo " "
11097 echo "Checking to see how your cpp does stuff like catenate tokens..." >&4
11098 $cat >cpp_stuff.c <<'EOCP'
11099 #define RCAT(a,b)a/**/b
11100 #define ACAT(a,b)a ## b
11101 RCAT(Rei,ser)
11102 ACAT(Cir,cus)
11103 EOCP
11104 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
11105 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
11106         echo "Oh!  Smells like ANSI's been here." >&4
11107         echo "We can catify or stringify, separately or together!"
11108         cpp_stuff=42
11109 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
11110         echo "Ah, yes!  The good old days!" >&4
11111         echo "However, in the good old days we don't know how to stringify and"
11112         echo "catify at the same time."
11113         cpp_stuff=1
11114 else
11115         $cat >&4 <<EOM
11116 Hmm, I don't seem to be able to catenate tokens with your cpp.  You're going
11117 to have to edit the values of CAT[2-5] in config.h...
11118 EOM
11119         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
11120 fi
11121 $rm -f cpp_stuff.*
11122
11123 : see if this is a db.h system
11124 set db.h i_db
11125 eval $inhdr
11126
11127 case "$i_db" in
11128 $define)
11129         : Check db version.
11130         echo " "
11131         echo "Checking Berkeley DB version ..." >&4
11132         $cat >try.c <<EOCP
11133 #$d_const HASCONST
11134 #ifndef HASCONST
11135 #define const
11136 #endif
11137 #include <sys/types.h>
11138 #include <stdio.h>
11139 #include <db.h>
11140 int main()
11141 {
11142 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
11143     int Major, Minor, Patch ;
11144     unsigned long Version ;
11145     (void)db_version(&Major, &Minor, &Patch) ;
11146     printf("You have Berkeley DB Version 2 or greater\n");
11147
11148     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
11149                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
11150     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
11151                 Major, Minor, Patch) ;
11152
11153     /* check that db.h & libdb are compatible */
11154     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
11155         printf("db.h and libdb are incompatible\n") ;
11156         exit(3);        
11157     }
11158
11159     printf("db.h and libdb are compatible\n") ;
11160
11161     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
11162                 + DB_VERSION_PATCH ;
11163
11164     /* needs to be >= 2.3.4 */
11165     if (Version < 2003004) {
11166     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
11167         printf("but Perl needs Berkeley DB 2.3.4 or greater\n") ;
11168         exit(2);        
11169     }
11170
11171     exit(0);
11172 #else
11173 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
11174     printf("You have Berkeley DB Version 1\n");
11175     exit(0);    /* DB version < 2: the coast is clear. */
11176 #else
11177     exit(1);    /* <db.h> not Berkeley DB? */
11178 #endif
11179 #endif
11180 }
11181 EOCP
11182         set try
11183         if eval $compile && ./try; then
11184                 echo 'Looks OK.' >&4
11185         else
11186                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
11187                 i_db=$undef
11188                 case " $libs " in
11189                 *"-ldb "*)
11190                         : Remove db from list of libraries to use
11191                         echo "Removing unusable -ldb from library list" >&4
11192                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
11193                         shift
11194                         libs="$*"
11195                         echo "libs = $libs" >&4
11196                         ;;
11197                 esac
11198         fi
11199         $rm -f try.*
11200         ;;
11201 esac
11202
11203 case "$i_db" in
11204 define)
11205         : Check the return type needed for hash 
11206         echo " "
11207         echo "Checking return type needed for hash for Berkeley DB ..." >&4
11208         $cat >try.c <<EOCP
11209 #$d_const HASCONST
11210 #ifndef HASCONST
11211 #define const
11212 #endif
11213 #include <sys/types.h>
11214 #include <db.h>
11215
11216 #ifndef DB_VERSION_MAJOR
11217 u_int32_t hash_cb (ptr, size)
11218 const void *ptr;
11219 size_t size;
11220 {
11221 }
11222 HASHINFO info;
11223 int main()
11224 {
11225         info.hash = hash_cb;
11226 }
11227 #endif
11228 EOCP
11229         if $cc $ccflags -c try.c >try.out 2>&1 ; then
11230                 if $contains warning try.out >>/dev/null 2>&1 ; then
11231                         db_hashtype='int'
11232                 else
11233                         db_hashtype='u_int32_t'
11234                 fi
11235         else
11236                 : XXX Maybe we should just give up here.
11237                 db_hashtype=u_int32_t
11238                 $cat try.out >&4
11239                 echo "Help:  I can't seem to compile the db test program." >&4
11240                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
11241         fi
11242         $rm -f try.*
11243         echo "Your version of Berkeley DB uses $db_hashtype for hash."
11244         ;;
11245 *)      db_hashtype=u_int32_t
11246         ;;
11247 esac
11248 case "$i_db" in
11249 define)
11250         : Check the return type needed for prefix 
11251         echo " "
11252         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
11253         cat >try.c <<EOCP
11254 #$d_const HASCONST
11255 #ifndef HASCONST
11256 #define const
11257 #endif
11258 #include <sys/types.h>
11259 #include <db.h>
11260
11261 #ifndef DB_VERSION_MAJOR
11262 size_t prefix_cb (key1, key2)
11263 const DBT *key1;
11264 const DBT *key2;
11265 {
11266 }
11267 BTREEINFO info;
11268 int main()
11269 {
11270         info.prefix = prefix_cb;
11271 }
11272 #endif
11273 EOCP
11274         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
11275                 if $contains warning try.out >>/dev/null 2>&1 ; then
11276                         db_prefixtype='int'
11277                 else
11278                         db_prefixtype='size_t'
11279                 fi
11280         else
11281                 db_prefixtype='size_t'
11282                 : XXX Maybe we should just give up here.
11283                 $cat try.out >&4
11284                 echo "Help:  I can't seem to compile the db test program." >&4
11285                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
11286         fi
11287         $rm -f try.*
11288         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
11289         ;;
11290 *)      db_prefixtype='size_t'
11291         ;;
11292 esac
11293
11294 : check for void type
11295 echo " "
11296 echo "Checking to see how well your C compiler groks the void type..." >&4
11297 case "$voidflags" in
11298 '')
11299         $cat >try.c <<'EOCP'
11300 #if TRY & 1
11301 void sub() {
11302 #else
11303 sub() {
11304 #endif
11305         extern void moo();      /* function returning void */
11306         void (*goo)();          /* ptr to func returning void */
11307 #if TRY & 8
11308         void *hue;              /* generic ptr */
11309 #endif
11310 #if TRY & 2
11311         void (*foo[10])();
11312 #endif
11313
11314 #if TRY & 4
11315         if(goo == moo) {
11316                 exit(0);
11317         }
11318 #endif
11319         exit(0);
11320 }
11321 int main() { sub(); }
11322 EOCP
11323         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
11324                 voidflags=$defvoidused
11325         echo "Good.  It appears to support void to the level $package wants.">&4
11326                 if $contains warning .out >/dev/null 2>&1; then
11327                         echo "However, you might get some warnings that look like this:"
11328                         $cat .out
11329                 fi
11330         else
11331 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
11332                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
11333                         echo "It supports 1..."
11334                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
11335                                 echo "It also supports 2..."
11336                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
11337                                         voidflags=7
11338                                         echo "And it supports 4 but not 8 definitely."
11339                                 else
11340                                         echo "It doesn't support 4..."
11341                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
11342                                                 voidflags=11
11343                                                 echo "But it supports 8."
11344                                         else
11345                                                 voidflags=3
11346                                                 echo "Neither does it support 8."
11347                                         fi
11348                                 fi
11349                         else
11350                                 echo "It does not support 2..."
11351                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
11352                                         voidflags=13
11353                                         echo "But it supports 4 and 8."
11354                                 else
11355                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
11356                                                 voidflags=5
11357                                                 echo "And it supports 4 but has not heard about 8."
11358                                         else
11359                                                 echo "However it supports 8 but not 4."
11360                                         fi
11361                                 fi
11362                         fi
11363                 else
11364                         echo "There is no support at all for void."
11365                         voidflags=0
11366                 fi
11367         fi
11368 esac
11369 case "$voidflags" in
11370 "$defvoidused") ;;
11371 *)      $cat >&4 <<'EOM'
11372   Support flag bits are:
11373     1: basic void declarations.
11374     2: arrays of pointers to functions returning void.
11375     4: operations between pointers to and addresses of void functions.
11376     8: generic void pointers.
11377 EOM
11378         dflt="$voidflags";
11379         rp="Your void support flags add up to what?"
11380         . ./myread
11381         voidflags="$ans"
11382         ;;
11383 esac
11384 $rm -f try.* .out
11385
11386
11387 : How can we generate normalized random numbers ?
11388 echo " "
11389 echo "Looking for a random number function..." >&4
11390 case "$randfunc" in
11391 '')
11392         if set drand48 val -f; eval $csym; $val; then
11393                 dflt="drand48"
11394                 echo "Good, found drand48()." >&4
11395         elif set random val -f; eval $csym; $val; then
11396                 dflt="random"
11397                 echo "OK, found random()." >&4
11398         else
11399                 dflt="rand"
11400                 echo "Yick, looks like I have to use rand()." >&4
11401         fi
11402         echo " "
11403         ;;
11404 *)
11405         dflt="$randfunc"
11406         ;;
11407 esac
11408 cont=true
11409
11410 case "$ccflags" in
11411 *-Dmy_rand=*|*-Dmy_srand=*)
11412         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
11413         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
11414         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
11415         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
11416         ;;
11417 esac
11418
11419 while $test "$cont"; do
11420         rp="Use which function to generate random numbers?"
11421         . ./myread
11422         if $test "$ans" = "$dflt"; then
11423                 : null
11424         else
11425                 randbits=''
11426         fi
11427         randfunc="$ans"
11428         if set $ans val -f; eval $csym; $val; then
11429                 cont=''
11430         else
11431                 dflt=y
11432                 rp="I cannot find function $ans. Use that name anyway?"
11433                 . ./myread
11434                 dflt=rand
11435                 case "$ans" in
11436                         [yY]*) cont='';;
11437                 esac
11438         fi
11439         case "$cont" in
11440         '')
11441                 case "$randfunc" in
11442                 drand48)
11443                         drand01="drand48()"
11444                         seedfunc="srand48"
11445                         randbits=48
11446                         randseedtype=long
11447                         ;;
11448                 rand|random)
11449                         case "$randbits" in
11450                         '')
11451 echo "Checking to see how many bits your $randfunc() function produces..." >&4
11452                                 $cat >try.c <<EOCP
11453 #$i_unistd I_UNISTD
11454 #$i_stdlib I_STDLIB
11455 #include <stdio.h>
11456 #ifdef I_UNISTD
11457 #  include <unistd.h>
11458 #endif
11459 #ifdef I_STDLIB
11460 #  include <stdlib.h>
11461 #endif
11462 int main()
11463 {
11464         register int i;
11465         register unsigned long tmp;
11466         register unsigned long max = 0L;
11467
11468         for (i = 1000; i; i--) {
11469                 tmp = (unsigned long) $randfunc();
11470                 if (tmp > max) max = tmp;
11471         }
11472         for (i = 0; max; i++)
11473                 max /= 2;
11474         printf("%d\n",i);
11475 }
11476 EOCP
11477                                 set try
11478                                 if eval $compile_ok; then
11479                                         dflt=`try`
11480                                 else
11481                                         dflt='?'
11482                                         echo "(I can't seem to compile the test program...)"
11483                                 fi
11484                                 ;;
11485                         *)
11486                                 dflt="$randbits"
11487                                 ;;
11488                         esac
11489                         rp="How many bits does your $randfunc() function produce?"
11490                         . ./myread
11491                         randbits="$ans"
11492                         $rm -f try.c try
11493                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
11494                         seedfunc="s$randfunc"
11495                         randseedtype=unsigned
11496                         ;;
11497                 *)
11498                         dflt="31"
11499                         rp="How many bits does your $randfunc() function produce?"
11500                         . ./myread
11501                         randbits="$ans"
11502                         seedfunc="s$randfunc"
11503                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
11504                         if set $seedfunc val -f; eval $csym; $val; then
11505                                 echo "(Using $seedfunc() to seed random generator)"
11506                         else
11507                                 echo "(Warning: no $seedfunc() to seed random generator)"
11508                                 seedfunc=rand
11509                         fi
11510                         randseedtype=unsigned
11511                         ;;
11512                 esac
11513                 ;;
11514         esac
11515 done
11516
11517 echo " "
11518 echo "Determining whether or not we are on an EBCDIC system..." >&4
11519 $cat >tebcdic.c <<'EOM'
11520 int main()
11521 {
11522   if ('M'==0xd4) return 0;
11523   return 1;
11524 }
11525 EOM
11526
11527 val=$undef
11528 set tebcdic
11529 if eval $compile_ok; then
11530         if ./tebcdic; then
11531                 echo "You have EBCDIC." >&4
11532                 val="$define"
11533         else
11534                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin." >&4
11535         fi
11536 else
11537         echo "I'm unable to compile the test program." >&4
11538         echo "I'll assume ASCII or some ISO Latin." >&4
11539 fi
11540 $rm -f tebcdic.c tebcdic
11541 set ebcdic
11542 eval $setvar
11543
11544 echo " "
11545 $cat >&4 <<EOM
11546 Checking how to flush all pending stdio output...
11547 EOM
11548 # I only know how to find the first 32 possibly open files on SunOS.
11549 # See also hints/sunos_4_1.sh and util.c  --AD
11550 case "$osname" in
11551 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
11552 esac
11553 $cat >>try.c <<EOCP
11554 #include <stdio.h>
11555 #$i_unistd I_UNISTD
11556 #ifdef I_UNISTD
11557 # include <unistd.h>
11558 #endif
11559 #$d_sysconf HAS_SYSCONF
11560 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
11561 #ifdef HAS_STDIO_STREAM_ARRAY
11562 # define STDIO_STREAM_ARRAY $stdio_stream_array
11563 #endif
11564 int main() {
11565   FILE* p = fopen("try.out", "w");
11566 #ifdef TRY_FPUTC
11567   fputc('x', p);
11568 #else
11569 # ifdef TRY_FPRINTF
11570   fprintf(p, "x");
11571 # endif
11572 #endif
11573 #ifdef TRY_FFLUSH_NULL
11574   fflush(NULL);
11575 #endif
11576 #ifdef TRY_FFLUSH_ALL
11577   {
11578     long open_max = -1;
11579 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
11580     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
11581 # else
11582 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
11583     open_max = sysconf(_SC_OPEN_MAX);
11584 #  else
11585 #   ifdef FOPEN_MAX
11586     open_max = FOPEN_MAX;
11587 #   else
11588 #    ifdef OPEN_MAX
11589     open_max = OPEN_MAX;
11590 #    else
11591 #     ifdef _NFILE
11592     open_max = _NFILE;
11593 #     endif
11594 #    endif
11595 #   endif
11596 #  endif
11597 # endif 
11598 # ifdef HAS_STDIO_STREAM_ARRAY
11599     if (open_max > 0) {
11600       long i;
11601       for (i = 0; i < open_max; i++)
11602             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
11603                 STDIO_STREAM_ARRAY[i]._file < open_max &&
11604                 STDIO_STREAM_ARRAY[i]._flag)
11605                 fflush(&STDIO_STREAM_ARRAY[i]);
11606     }   
11607   }
11608 # endif
11609 #endif
11610   _exit(42);
11611 }
11612 EOCP
11613 : first we have to find out how _not_ to flush
11614 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
11615     output=''
11616     set try -DTRY_FPUTC
11617     if eval $compile; then
11618             $rm -f try.out
11619             ./try$exe_ext 2>/dev/null
11620             if $test ! -s try.out -a "X$?" = X42; then
11621                 output=-DTRY_FPUTC
11622             fi
11623     fi
11624     case "$output" in
11625     '')
11626             set try -DTRY_FPRINTF
11627             $rm -f try.out
11628             if eval $compile; then
11629                     $rm -f try.out
11630                     ./try$exe_ext 2>/dev/null
11631                     if $test ! -s try.out -a "X$?" = X42; then
11632                         output=-DTRY_FPRINTF
11633                     fi
11634             fi
11635         ;;
11636     esac
11637 fi
11638 : check for fflush NULL behaviour
11639 case "$fflushNULL" in
11640 '')     set try -DTRY_FFLUSH_NULL $output
11641         if eval $compile; then
11642                 $rm -f try.out
11643                 ./try$exe_ext 2>/dev/null
11644                 code="$?"
11645                 if $test -s try.out -a "X$code" = X42; then
11646                         fflushNULL="`$cat try.out`"
11647                 else
11648                         if $test "X$code" != X42; then
11649                                 $cat >&4 <<EOM
11650 (If this test failed, don't worry, we'll try another method shortly.)
11651 EOM
11652                         fi
11653                 fi
11654         fi
11655         $rm -f core try.core core.try.*
11656         case "$fflushNULL" in
11657         x)      $cat >&4 <<EOM
11658 Your fflush(NULL) works okay.
11659 EOM
11660                 fflushNULL="$define"
11661                 ;;
11662         '')     $cat >&4 <<EOM
11663 Your fflush(NULL) isn't working (contrary to ANSI C).
11664 EOM
11665                 fflushNULL="$undef"
11666                 ;;
11667         *)      $cat >&4 <<EOM
11668 Cannot figure out whether your fflush(NULL) works or not.
11669 I'm assuming it doesn't (contrary to ANSI C).
11670 EOM
11671                 fflushNULL="$undef"
11672                 ;;
11673         esac
11674         ;;
11675 $define|true|[yY]*)
11676         fflushNULL="$define"
11677         ;;
11678 *)
11679         fflushNULL="$undef"
11680         ;;
11681 esac
11682 : check explicit looping only if NULL did not work
11683 case "$fflushNULL" in
11684 "$undef")
11685         : check for fflush all behaviour
11686         case "$fflushall" in
11687         '')     set try -DTRY_FFLUSH_ALL $output
11688                 if eval $compile; then
11689                         $cat >&4 <<EOM
11690 (Now testing the other method--but note that also this may fail.)
11691 EOM
11692                         $rm -f try.out
11693                         ./try$exe_ext 2>/dev/null
11694                         if $test -s try.out -a "X$?" = X42; then
11695                                 fflushall="`$cat try.out`"
11696                         fi
11697                 fi
11698                 $rm -f core try.core core.try.*
11699                 case "$fflushall" in
11700                 x)      $cat >&4 <<EOM
11701 Whew. Flushing explicitly all the stdio streams works.
11702 EOM
11703                         fflushall="$define"
11704                         ;;
11705                 '')     $cat >&4 <<EOM
11706 Sigh. Flushing explicitly all the stdio streams doesn't work.
11707 EOM
11708                         fflushall="$undef"
11709                         ;;
11710                 *)      $cat >&4 <<EOM
11711 Cannot figure out whether flushing stdio streams explicitly works or not.
11712 I'm assuming it doesn't.
11713 EOM
11714                         fflushall="$undef"
11715                         ;;
11716                 esac
11717                 ;;
11718         "$define"|true|[yY]*)
11719                 fflushall="$define"
11720                 ;;
11721         *)
11722                 fflushall="$undef"
11723                 ;;
11724         esac
11725         ;;
11726 *)      fflushall="$undef"      
11727         ;;
11728 esac
11729 case "$fflushNULL$fflushall" in
11730 undefundef)
11731         $cat <<EOM
11732 I cannot figure out how to flush pending stdio output.
11733 EOM
11734         ;;
11735 esac
11736 $rm -f try.* try$exe_ext
11737
11738 : see what type file positions are declared as in the library
11739 rp="What is the type for file position used by fsetpos()?"
11740 set fpos_t fpostype long stdio.h sys/types.h
11741 eval $typedef_ask
11742
11743 : Store the full pathname to the ar program for use in the C program
11744 : Respect a hint or command line value for full_ar.
11745 case "$full_ar" in
11746 '') full_ar=$ar ;;
11747 esac
11748
11749 : Store the full pathname to the sed program for use in the C program
11750 full_sed=$sed
11751
11752 : see what type gids are declared as in the kernel
11753 echo " "
11754 echo "Looking for the type for group ids returned by getgid()."
11755 set gid_t gidtype xxx stdio.h sys/types.h
11756 eval $typedef
11757 case "$gidtype" in
11758 xxx)
11759         xxx=`./findhdr sys/user.h`
11760         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
11761         case $1 in
11762         unsigned) dflt="$1 $2" ;;
11763         *) dflt="$1" ;;
11764         esac
11765         ;;
11766 *) dflt="$gidtype";;
11767 esac
11768 case "$gidtype" in
11769 gid_t) echo "gid_t found." ;;
11770 *)      rp="What is the type for group ids returned by getgid()?"
11771         . ./myread
11772         gidtype="$ans"
11773         ;;
11774 esac
11775
11776 : see if getgroups exists
11777 set getgroups d_getgrps
11778 eval $inlibc
11779
11780 : see if setgroups exists
11781 set setgroups d_setgrps
11782 eval $inlibc
11783
11784
11785 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
11786 echo " "
11787 case "$d_getgrps$d_setgrps" in
11788 *define*)
11789         case "$groupstype" in
11790         '') dflt="$gidtype" ;;
11791         *)  dflt="$groupstype" ;;
11792         esac
11793         $cat <<EOM
11794 What type of pointer is the second argument to getgroups() and setgroups()?
11795 Usually this is the same as group ids, $gidtype, but not always.
11796
11797 EOM
11798         rp='What type pointer is the second argument to getgroups() and setgroups()?'
11799         . ./myread
11800         groupstype="$ans"
11801         ;;
11802 *)  groupstype="$gidtype";;
11803 esac
11804
11805 : see what type lseek is declared as in the kernel
11806 rp="What is the type used for lseek's offset on this system?"
11807 set off_t lseektype long stdio.h sys/types.h
11808 eval $typedef_ask
11809
11810 echo " "
11811 $echo $n "Checking to see how big your file offsets are...$c" >&4
11812 $cat >try.c <<EOCP
11813 #include <sys/types.h>
11814 #include <stdio.h>
11815 int main()
11816 {
11817         printf("%d\n", sizeof($lseektype));
11818 }
11819 EOCP
11820 set try
11821 if eval $compile_ok; then
11822         lseeksize=`./try`
11823         $echo " $lseeksize bytes." >&4
11824 else
11825         dflt='4'
11826         echo " "
11827         echo "(I can't seem to compile the test program.  Guessing...)"
11828         rp="What is the size of your file offsets (in bytes)?"
11829         . ./myread
11830         lseeksize="$ans"
11831 fi
11832 $rm -f try.c try
11833
11834 echo " "
11835 echo "Checking if your $make program sets \$(MAKE)..." >&4
11836 case "$make_set_make" in
11837 '')
11838         $sed 's/^X //' > testmake.mak << 'EOF'
11839 Xall:
11840 X       @echo 'maketemp="$(MAKE)"'
11841 EOF
11842         case "`$make -f testmake.mak 2>/dev/null`" in
11843         *maketemp=*) make_set_make='#' ;;
11844         *)      make_set_make="MAKE=$make" ;;
11845         esac
11846         $rm -f testmake.mak
11847         ;;
11848 esac
11849 case "$make_set_make" in
11850 '#') echo "Yup, it does.";;
11851 *) echo "Nope, it doesn't.";;
11852 esac
11853
11854 : see what type is used for mode_t
11855 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
11856 set mode_t modetype int stdio.h sys/types.h
11857 eval $typedef_ask
11858
11859 : define a fucntion to check prototypes
11860 $cat > protochk <<EOSH
11861 $startsh
11862 cc="$cc"
11863 optimize="$optimize"
11864 ccflags="$ccflags"
11865 prototype="$prototype"
11866 define="$define"
11867 rm=$rm
11868 EOSH
11869
11870 $cat >> protochk <<'EOSH'
11871
11872 $rm -f try.c
11873 foo="$1"
11874 shift
11875 while test $# -ge 2; do
11876         case "$1" in
11877                 $define) echo "#include <$2>" >> try.c ;;
11878                 literal) echo "$2" >> try.c ;;
11879         esac
11880     shift 2
11881 done
11882 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
11883 cat >> try.c <<'EOCP'
11884 #ifdef CAN_PROTOTYPE
11885 #define _(args) args
11886 #else
11887 #define _(args) ()
11888 #endif
11889 EOCP
11890 echo "$foo" >> try.c
11891 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
11892 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
11893 status=$?
11894 $rm -f try.[co]
11895 exit $status
11896 EOSH
11897 chmod +x protochk
11898 $eunicefix protochk
11899
11900 : see what type is used for size_t
11901 rp="What is the type used for the length parameter for string functions?"
11902 set size_t sizetype 'unsigned int' stdio.h sys/types.h
11903 eval $typedef_ask
11904
11905 : check for type of arguments to gethostbyaddr. 
11906 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
11907         case "$d_gethbyaddr" in
11908         $define)
11909                 $cat <<EOM
11910
11911 Checking to see what type of arguments are accepted by gethostbyaddr().
11912 EOM
11913                 hdrs="$define sys/types.h
11914                         $d_socket sys/socket.h 
11915                         $i_niin netinet/in.h 
11916                         $i_netdb netdb.h
11917                         $i_unistd unistd.h"
11918                 : The first arg can 'char *' or 'void *'
11919                 : The second arg is some of integral type
11920                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
11921                         for yyy in size_t long int; do
11922                                 case "$netdb_host_type" in
11923                                 '')     try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
11924                                         if ./protochk "$try" $hdrs; then
11925                                                 echo "Your system accepts $xxx for the first arg."
11926                                                 echo "...and $yyy for the second arg."
11927                                                 netdb_host_type="$xxx"
11928                                                 netdb_hlen_type="$yyy"
11929                                         fi
11930                                         ;;
11931                                 esac
11932                         done
11933                 done
11934                 : In case none of those worked, prompt the user.
11935                 case "$netdb_host_type" in
11936                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
11937                         dflt='char *'
11938                         . ./myread
11939                         netdb_host_type=$ans
11940                         rp='What is the type for the 2nd argument to gethostbyaddr?'
11941                         dflt="$sizetype"
11942                         . ./myread
11943                         netdb_hlen_type=$ans
11944                         ;;
11945                 esac
11946                 ;;
11947         *)      : no gethostbyaddr, so pick harmless defaults
11948                 netdb_host_type='char *'
11949                 netdb_hlen_type="$sizetype"
11950                 ;;
11951         esac
11952         # Remove the "const" if needed. -- but then we'll have a 
11953         # prototype clash!
11954         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
11955 fi
11956
11957 : check for type of argument to gethostbyname. 
11958 if test "X$netdb_name_type" = X ; then
11959         case "$d_gethbyname" in
11960         $define)
11961                 $cat <<EOM
11962
11963 Checking to see what type of argument is accepted by gethostbyname().
11964 EOM
11965                 hdrs="$define sys/types.h
11966                         $d_socket sys/socket.h 
11967                         $i_niin netinet/in.h 
11968                         $i_netdb netdb.h
11969                         $i_unistd unistd.h"
11970                 for xxx in "const char *" "char *"; do
11971                         case "$netdb_name_type" in
11972                         '')     try="extern struct hostent *gethostbyname($xxx);"
11973                                 if ./protochk "$try" $hdrs; then
11974                                         echo "Your system accepts $xxx."
11975                                         netdb_name_type="$xxx"
11976                                 fi
11977                                 ;;
11978                         esac
11979                 done
11980                 : In case none of those worked, prompt the user.
11981                 case "$netdb_name_type" in
11982                 '')     rp='What is the type for the 1st argument to gethostbyname?'
11983                         dflt='char *'
11984                         . ./myread
11985                         netdb_name_type=$ans
11986                         ;;
11987                 esac
11988                 ;;
11989         *)      : no gethostbyname, so pick harmless default
11990                 netdb_name_type='char *'
11991                 ;;
11992         esac
11993 fi
11994
11995 : check for type of 1st argument to getnetbyaddr. 
11996 if test "X$netdb_net_type" = X ; then
11997         case "$d_getnbyaddr" in
11998         $define)
11999                 $cat <<EOM
12000
12001 Checking to see what type of 1st argument is accepted by getnetbyaddr().
12002 EOM
12003                 hdrs="$define sys/types.h
12004                         $d_socket sys/socket.h 
12005                         $i_niin netinet/in.h 
12006                         $i_netdb netdb.h
12007                         $i_unistd unistd.h"
12008                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
12009                         case "$netdb_net_type" in
12010                         '')     try="extern struct netent *getnetbyaddr($xxx, int);"
12011                                 if ./protochk "$try" $hdrs; then
12012                                         echo "Your system accepts $xxx."
12013                                         netdb_net_type="$xxx"
12014                                 fi
12015                                 ;;
12016                         esac
12017                 done
12018                 : In case none of those worked, prompt the user.
12019                 case "$netdb_net_type" in
12020                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
12021                         dflt='long'
12022                         . ./myread
12023                         netdb_net_type=$ans
12024                         ;;
12025                 esac
12026                 ;;
12027         *)      : no getnetbyaddr, so pick harmless default
12028                 netdb_net_type='long'
12029                 ;;
12030         esac
12031 fi
12032 : locate the preferred pager for this system
12033 case "$pager" in
12034 '')
12035         dflt=''
12036         case "$pg" in
12037         /*) dflt=$pg;;
12038         esac
12039         case "$more" in
12040         /*) dflt=$more;;
12041         esac
12042         case "$less" in
12043         /*) dflt=$less;;
12044         esac
12045         case "$dflt" in
12046         '') dflt=/usr/ucb/more;;
12047         esac
12048         ;;
12049 *) dflt="$pager";;
12050 esac
12051 echo " "
12052 fn=f/
12053 rp='What pager is used on your system?'
12054 . ./getfile
12055 pager="$ans"
12056
12057 : see what type pids are declared as in the kernel
12058 rp="What is the type of process ids on this system?"
12059 set pid_t pidtype int stdio.h sys/types.h
12060 eval $typedef_ask
12061
12062 : Find earliest binary compatible site_perl subdirectory perl can use.
12063 case "$bincompat5005" in
12064 "$define") xs_apiversion='5.005' ;;
12065 *) xs_apiversion=$apiversion ;;   # The current site_perl version.
12066 esac
12067 : Find earliest pure perl site_perl subdirectory perl can use.
12068 : The versioned directories started at 5.005.
12069 pm_apiversion='5.005'
12070
12071 : check for length of pointer
12072 echo " "
12073 case "$ptrsize" in
12074 '')
12075         $echo $n "Checking to see how big your pointers are...$c" >&4
12076         if test "$voidflags" -gt 7; then
12077                 echo '#define VOID_PTR char *' > try.c
12078         else
12079                 echo '#define VOID_PTR void *' > try.c
12080         fi
12081         $cat >>try.c <<'EOCP'
12082 #include <stdio.h>
12083 int main()
12084 {
12085         printf("%d\n", sizeof(VOID_PTR));
12086         exit(0);
12087 }
12088 EOCP
12089         set try
12090         if eval $compile_ok; then
12091                 ptrsize=`./try`
12092                 $echo " $ptrsize bytes." >&4
12093         else
12094                 dflt='4'
12095                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
12096                 rp="What is the size of a pointer (in bytes)?"
12097                 . ./myread
12098                 ptrsize="$ans"
12099         fi
12100         ;;
12101 esac
12102 $rm -f try.c try
12103
12104 : see if ar generates random libraries by itself
12105 echo " "
12106 echo "Checking how to generate random libraries on your machine..." >&4
12107 echo 'int bar1() { return bar2(); }' > bar1.c
12108 echo 'int bar2() { return 2; }' > bar2.c
12109 $cat > foo.c <<'EOP'
12110 int main() { printf("%d\n", bar1()); exit(0); }
12111 EOP
12112 $cc $ccflags -c bar1.c >/dev/null 2>&1
12113 $cc $ccflags -c bar2.c >/dev/null 2>&1
12114 $cc $ccflags -c foo.c >/dev/null 2>&1
12115 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
12116 if $cc $ccflags $ldflags -o foobar foo$_o bar$_a $libs > /dev/null 2>&1 &&
12117         ./foobar >/dev/null 2>&1; then
12118         echo "$ar appears to generate random libraries itself."
12119         orderlib=false
12120         ranlib=":"
12121 elif $ar ts bar$_a >/dev/null 2>&1 &&
12122         $cc $ccflags $ldflags -o foobar foo$_o bar$_a $libs > /dev/null 2>&1 &&
12123         ./foobar >/dev/null 2>&1; then
12124                 echo "a table of contents needs to be added with '$ar ts'."
12125                 orderlib=false
12126                 ranlib="$ar ts"
12127 else
12128         case "$ranlib" in
12129         :) ranlib='';;
12130         '')
12131                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
12132                 $test -f $ranlib || ranlib=''
12133                 ;;
12134         esac
12135         if $test -n "$ranlib"; then
12136                 echo "your system has '$ranlib'; we'll use that."
12137                 orderlib=false
12138         else
12139                 echo "your system doesn't seem to support random libraries"
12140                 echo "so we'll use lorder and tsort to order the libraries."
12141                 orderlib=true
12142                 ranlib=":"
12143         fi
12144 fi
12145 $rm -f foo* bar* 
12146
12147 : check for type of arguments to select. 
12148 case "$selecttype" in
12149 '') case "$d_select" in
12150         $define)
12151                 $cat <<EOM
12152 Checking to see what type of arguments are accepted by select().
12153 EOM
12154                 hdrs="$define sys/types.h
12155                         $i_systime sys/time.h 
12156                         $i_sysselct sys/select.h
12157                         $d_socket sys/socket.h"
12158                 : The first arg can be int, unsigned, or size_t
12159                 : The last arg may or may not be 'const'
12160                 val=''
12161                 : void pointer has been seen but using that
12162                 : breaks the selectminbits test
12163                 for xxx in 'fd_set *' 'int *'; do
12164                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
12165                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
12166                                         case "$val" in
12167                                         '')     try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
12168                                                 if ./protochk "$try" $hdrs; then
12169                                                         echo "Your system accepts $xxx."
12170                                                         val="$xxx"
12171                                                 fi
12172                                                 ;;
12173                                         esac
12174                                 done
12175                         done
12176                 done
12177                 case "$val" in
12178                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
12179                         case "$d_fd_set" in
12180                                 $define) dflt="fd_set *" ;;
12181                                 *)              dflt="int *" ;;
12182                         esac
12183                         . ./myread
12184                         val=$ans
12185                         ;;
12186                 esac
12187                 selecttype="$val"
12188                 ;;
12189         *)      : no select, so pick a harmless default
12190                 selecttype='int *'
12191                 ;;
12192         esac
12193         ;;
12194 esac
12195
12196 : check for the select 'width'
12197 case "$selectminbits" in
12198 '') case "$d_select" in
12199         $define)
12200                 $cat <<EOM
12201
12202 Checking to see on how many bits at a time your select() operates...
12203 EOM
12204                 $cat >try.c <<EOCP
12205 #include <sys/types.h>
12206 #$i_time I_TIME
12207 #$i_systime I_SYS_TIME
12208 #$i_systimek I_SYS_TIME_KERNEL
12209 #ifdef I_TIME
12210 #   include <time.h>
12211 #endif
12212 #ifdef I_SYS_TIME
12213 #   ifdef I_SYS_TIME_KERNEL
12214 #       define KERNEL
12215 #   endif
12216 #   include <sys/time.h>
12217 #   ifdef I_SYS_TIME_KERNEL
12218 #       undef KERNEL
12219 #   endif
12220 #endif
12221 #$i_sysselct I_SYS_SELECT
12222 #ifdef I_SYS_SELECT
12223 #include <sys/select.h>
12224 #endif
12225 #$d_socket HAS_SOCKET
12226 #ifdef HAS_SOCKET
12227 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
12228 #endif
12229 #include <stdio.h>
12230 $selecttype b;
12231 #define S sizeof(*(b))
12232 #define MINBITS 64
12233 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
12234 #define NBITS  (NBYTES * 8)
12235 int main() {
12236     char s[NBYTES];
12237     struct timeval t;
12238     int i;
12239     FILE* fp;
12240     int fd;
12241
12242     fclose(stdin);
12243     fp = fopen("try.c", "r");
12244     if (fp == 0)
12245       exit(1);
12246     fd = fileno(fp);
12247     if (fd < 0)
12248       exit(2);
12249     b = ($selecttype)s;
12250     for (i = 0; i < NBITS; i++)
12251         FD_SET(i, b);
12252     t.tv_sec  = 0;
12253     t.tv_usec = 0;
12254     select(fd + 1, b, 0, 0, &t);
12255     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
12256     printf("%d\n", i + 1);
12257     return 0;
12258 }
12259 EOCP
12260                 set try
12261                 if eval $compile_ok; then
12262                         selectminbits=`./try`
12263                         case "$selectminbits" in
12264                         '')     cat >&4 <<EOM
12265 Cannot figure out on how many bits at a time your select() operates.
12266 I'll play safe and guess it is 32 bits.
12267 EOM
12268                                 selectminbits=32
12269                                 bits="32 bits"
12270                                 ;;
12271                         1)      bits="1 bit" ;;
12272                         *)      bits="$selectminbits bits" ;;
12273                         esac
12274                         echo "Your select() operates on $bits at a time." >&4
12275                 else
12276                         rp='What is the minimum number of bits your select() operates on?'
12277                         case "$byteorder" in
12278                         1234|12345678)  dflt=32 ;;
12279                         *)              dflt=1  ;;
12280                         esac
12281                         . ./myread
12282                         val=$ans
12283                         selectminbits="$val"
12284                 fi
12285                 $rm -f try.* try
12286                 ;;
12287         *)      : no select, so pick a harmless default
12288                 selectminbits='32'
12289                 ;;
12290         esac
12291         ;;
12292 esac
12293
12294 : Trace out the files included by signal.h, then look for SIGxxx names.
12295 : Remove SIGARRAYSIZE used by HPUX.
12296 : Remove SIGSTKSIZE used by Linux.
12297 : Remove SIGSTKSZ used by Posix.
12298 : Remove SIGTYP void lines used by OS2.
12299 xxx=`echo '#include <signal.h>' |
12300         $cppstdin $cppminus $cppflags 2>/dev/null |
12301         $grep '^[       ]*#.*include' | 
12302         $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sort | $uniq`
12303 : Check this list of files to be sure we have parsed the cpp output ok.
12304 : This will also avoid potentially non-existent files, such 
12305 : as ../foo/bar.h
12306 xxxfiles=''
12307 for xx in $xxx /dev/null ; do
12308         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
12309 done
12310 : If we have found no files, at least try signal.h
12311 case "$xxxfiles" in
12312 '')     xxxfiles=`./findhdr signal.h` ;;
12313 esac
12314 xxx=`awk '
12315 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
12316         print substr($2, 4, 20)
12317 }
12318 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
12319         print substr($3, 4, 20)
12320 }' $xxxfiles`
12321 : Append some common names just in case the awk scan failed.
12322 xxx="$xxx ABRT ALRM BUS CHLD CLD CONT DIL EMT FPE HUP ILL INT IO IOT KILL"
12323 xxx="$xxx LOST PHONE PIPE POLL PROF PWR QUIT SEGV STKFLT STOP SYS TERM TRAP"
12324 xxx="$xxx TSTP TTIN TTOU URG USR1 USR2 USR3 USR4 VTALRM"
12325 xxx="$xxx WINCH WIND WINDOW XCPU XFSZ"
12326 : generate a few handy files for later
12327 $cat > signal.c <<'EOCP'
12328 #include <sys/types.h>
12329 #include <signal.h>
12330 #include <stdio.h>
12331 int main() {
12332
12333 /* Strange style to avoid deeply-nested #if/#else/#endif */
12334 #ifndef NSIG
12335 #  ifdef _NSIG
12336 #    define NSIG (_NSIG)
12337 #  endif
12338 #endif
12339
12340 #ifndef NSIG
12341 #  ifdef SIGMAX
12342 #    define NSIG (SIGMAX+1)
12343 #  endif
12344 #endif
12345
12346 #ifndef NSIG
12347 #  ifdef SIG_MAX
12348 #    define NSIG (SIG_MAX+1)
12349 #  endif
12350 #endif
12351
12352 #ifndef NSIG
12353 #  ifdef MAXSIG
12354 #    define NSIG (MAXSIG+1)
12355 #  endif
12356 #endif
12357
12358 #ifndef NSIG
12359 #  ifdef MAX_SIG
12360 #    define NSIG (MAX_SIG+1)
12361 #  endif
12362 #endif
12363
12364 #ifndef NSIG
12365 #  ifdef SIGARRAYSIZE
12366 #    define NSIG (SIGARRAYSIZE+1) /* Not sure of the +1 */
12367 #  endif
12368 #endif
12369
12370 #ifndef NSIG
12371 #  ifdef _sys_nsig
12372 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
12373 #  endif
12374 #endif
12375
12376 /* Default to some arbitrary number that's big enough to get most
12377    of the common signals.
12378 */
12379 #ifndef NSIG
12380 #    define NSIG 50
12381 #endif
12382
12383 printf("NSIG %d\n", NSIG);
12384
12385 #ifndef JUST_NSIG
12386
12387 EOCP
12388
12389 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
12390 {
12391         printf "#ifdef SIG"; printf $1; printf "\n"
12392         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
12393         printf $1; printf ");\n"
12394         printf "#endif\n"
12395 }
12396 END {
12397         printf "#endif /* JUST_NSIG */\n";
12398         printf "}\n";
12399 }
12400 ' >>signal.c
12401 $cat >signal.awk <<'EOP'
12402 BEGIN { ndups = 0 }
12403 $1 ~ /^NSIG$/ { nsig = $2 }
12404 ($1 !~ /^NSIG$/) && (NF == 2) {
12405     if ($2 > maxsig) { maxsig = $2 }
12406     if (sig_name[$2]) {
12407         dup_name[ndups] = $1
12408         dup_num[ndups] = $2
12409         ndups++ 
12410     }
12411     else {
12412         sig_name[$2] = $1
12413         sig_num[$2] = $2
12414     }
12415 }
12416 END { 
12417     if (nsig == 0) {
12418         nsig = maxsig + 1
12419     }
12420     printf("NSIG %d\n", nsig);
12421     for (n = 1; n < nsig; n++) {
12422         if (sig_name[n]) {
12423             printf("%s %d\n", sig_name[n], sig_num[n])
12424         }
12425         else {
12426             printf("NUM%d %d\n", n, n) 
12427         }
12428     }
12429     for (n = 0; n < ndups; n++) {
12430         printf("%s %d\n", dup_name[n], dup_num[n])
12431     }
12432 }
12433 EOP
12434 $cat >signal_cmd <<EOS
12435 $startsh
12436 if $test -s signal.lst; then
12437     echo "Using your existing signal.lst file"
12438         exit 0
12439 fi
12440 xxx="$xxx"
12441 EOS
12442 $cat >>signal_cmd <<'EOS'
12443
12444 set signal
12445 if eval $compile_ok; then
12446         ./signal$_exe | $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
12447 else
12448         echo "(I can't seem be able to compile the whole test program)" >&4
12449         echo "(I'll try it in little pieces.)" >&4
12450         set signal -DJUST_NSIG
12451         if eval $compile_ok; then
12452                 ./signal$_exe > signal.nsg
12453                 $cat signal.nsg
12454         else
12455                 echo "I can't seem to figure out how many signals you have." >&4
12456                 echo "Guessing 50." >&4
12457                 echo 'NSIG 50' > signal.nsg
12458         fi
12459         : Now look at all the signal names, one at a time.
12460         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
12461                 $cat > signal.c <<EOCP
12462 #include <sys/types.h>
12463 #include <signal.h>
12464 #include <stdio.h>
12465 int main() {
12466 printf("$xx %d\n", SIG${xx});
12467 return 0;
12468 }
12469 EOCP
12470                 set signal
12471                 if eval $compile; then
12472                         echo "SIG${xx} found."
12473                         ./signal$_exe  >> signal.ls1
12474                 else
12475                         echo "SIG${xx} NOT found."
12476                 fi
12477         done
12478         if $test -s signal.ls1; then
12479                 $cat signal.nsg signal.ls1 |
12480                         $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
12481         fi
12482
12483 fi
12484 if $test -s signal.lst; then
12485         :
12486 else
12487         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
12488         echo 'kill -l' >signal
12489         set X `csh -f <signal`
12490         $rm -f signal
12491         shift
12492         case $# in
12493         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
12494         esac
12495         echo $@ | $tr ' ' $trnl | \
12496             $awk '{ printf "%s %d\n", $1, ++s; }
12497                   END { printf "NSIG %d\n", ++s }' >signal.lst
12498 fi
12499 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
12500 EOS
12501 chmod a+x signal_cmd
12502 $eunicefix signal_cmd
12503
12504 : generate list of signal names
12505 echo " "
12506 case "$sig_name_init" in
12507 '') doinit=yes ;;
12508 *)  case "$sig_num_init" in
12509     ''|*,*) doinit=yes ;;
12510     esac ;;
12511 esac
12512 case "$doinit" in
12513 yes)
12514         echo "Generating a list of signal names and numbers..." >&4
12515         . ./signal_cmd
12516         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
12517         sig_name=`$awk 'BEGIN { printf "ZERO " }
12518                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
12519         sig_num=`$awk  'BEGIN { printf "0 " }
12520                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
12521         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
12522                              !/^NSIG/   { printf "\"%s\", ", $1 }
12523                              END        { printf "0\n" }' signal.lst`
12524         sig_num_init=`$awk  'BEGIN      { printf "0, " }
12525                              !/^NSIG/   { printf "%d, ", $2}
12526                              END        { printf "0\n"}' signal.lst`
12527         ;;
12528 esac
12529 echo "The following $sig_count signals are available:"
12530 echo " "
12531 echo $sig_name | $awk \
12532 'BEGIN { linelen = 0 }
12533 {
12534         for (i = 1; i <= NF; i++) {
12535                 name = "SIG" $i " "
12536                 linelen = linelen + length(name)
12537                 if (linelen > 70) {
12538                         printf "\n"
12539                         linelen = length(name)
12540                 }
12541                 printf "%s", name
12542         }
12543         printf "\n"
12544 }'
12545 $rm -f signal signal.c signal.awk signal.lst signal_cmd 
12546
12547 : see what type is used for signed size_t
12548 set ssize_t ssizetype int stdio.h sys/types.h
12549 eval $typedef
12550 dflt="$ssizetype"
12551 $cat > ssize.c <<EOM
12552 #include <stdio.h>
12553 #include <sys/types.h>
12554 #define Size_t $sizetype
12555 #define SSize_t $dflt
12556 int main()
12557 {
12558         if (sizeof(Size_t) == sizeof(SSize_t))
12559                 printf("$dflt\n");
12560         else if (sizeof(Size_t) == sizeof(int))
12561                 printf("int\n");
12562         else 
12563                 printf("long\n");
12564         exit(0);
12565 }
12566 EOM
12567 echo " "
12568 set ssize
12569 if eval $compile_ok && ./ssize > /dev/null; then
12570         ssizetype=`./ssize`
12571         echo "I'll be using $ssizetype for functions returning a byte count." >&4
12572 else
12573         $cat >&4 <<EOM
12574 Help! I can't compile and run the ssize_t test program: please enlighten me!
12575 (This is probably a misconfiguration in your system or libraries, and
12576 you really ought to fix it.  Still, I'll try anyway.)
12577
12578 I need a type that is the same size as $sizetype, but is guaranteed to
12579 be signed.  Common values are ssize_t, int and long.
12580
12581 EOM
12582         rp="What signed type is the same size as $sizetype?"
12583         . ./myread
12584         ssizetype="$ans"
12585 fi
12586 $rm -f ssize ssize.*
12587
12588 : see what type of char stdio uses.
12589 echo " "
12590 if $contains 'unsigned.*char.*_ptr;' `./findhdr stdio.h` >/dev/null 2>&1 ; then
12591         echo "Your stdio uses unsigned chars." >&4
12592         stdchar="unsigned char"
12593 else
12594         echo "Your stdio uses signed chars." >&4
12595         stdchar="char"
12596 fi
12597
12598 : see if time exists
12599 echo " "
12600 if test "X$d_time" = X -o X"$timetype" = X; then
12601     if set time val -f d_time; eval $csym; $val; then
12602                 echo 'time() found.' >&4
12603                 val="$define"
12604                 rp="What is the type returned by time() on this system?"
12605                 set time_t timetype long stdio.h sys/types.h
12606                 eval $typedef_ask
12607     else
12608                 echo 'time() not found, hope that will do.' >&4
12609                 val="$undef"
12610                 timetype='int';
12611     fi
12612     set d_time
12613     eval $setvar
12614 fi
12615
12616 : see what type uids are declared as in the kernel
12617 echo " "
12618 echo "Looking for the type for user ids returned by getuid()."
12619 set uid_t uidtype xxx stdio.h sys/types.h
12620 eval $typedef
12621 case "$uidtype" in
12622 xxx)
12623         xxx=`./findhdr sys/user.h`
12624         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
12625         case $1 in
12626         unsigned) dflt="$1 $2" ;;
12627         *) dflt="$1" ;;
12628         esac
12629         ;;
12630 *) dflt="$uidtype";;
12631 esac
12632 case "$uidtype" in
12633 uid_t)  echo "uid_t found." ;;
12634 *)      rp="What is the type for user ids returned by getuid()?"
12635         . ./myread
12636         uidtype="$ans"
12637         ;;
12638 esac
12639
12640 echo " "
12641 case "$uidtype" in
12642 *_t) zzz="$uidtype"     ;;
12643 *)   zzz="uid"          ;;
12644 esac
12645 echo "Checking the sign of $zzz..." >&4
12646 cat > try.c <<EOCP
12647 #include <sys/types.h>
12648 #include <stdio.h>
12649 int main() {
12650         $uidtype foo = -1;
12651         if (foo < 0)
12652                 printf("-1\n");
12653         else
12654                 printf("1\n");
12655 }
12656 EOCP
12657 set try
12658 if eval $compile; then
12659         yyy=`./try`
12660         case "$yyy" in
12661         '')     uidsign=1
12662                 echo "(I can't execute the test program--guessing unsigned.)" >&4
12663                 ;;
12664         *)      uidsign=$yyy
12665                 case "$uidsign" in
12666                  1) echo "Your $zzz is unsigned." ;;
12667                 -1) echo "Your $zzz is signed."   ;;
12668                 esac
12669                 ;;
12670         esac
12671 else
12672         uidsign=1
12673         echo "(I can't compile the test program--guessing unsigned.)" >&4
12674 fi
12675
12676
12677 : see if dbm.h is available
12678 : see if dbmclose exists
12679 set dbmclose d_dbmclose
12680 eval $inlibc
12681
12682 case "$d_dbmclose" in
12683 $define)
12684         set dbm.h i_dbm
12685         eval $inhdr
12686         case "$i_dbm" in
12687         $define)
12688                 val="$undef"
12689                 set i_rpcsvcdbm
12690                 eval $setvar
12691                 ;;
12692         *)      set rpcsvc/dbm.h i_rpcsvcdbm
12693                 eval $inhdr
12694                 ;;
12695         esac
12696         ;;
12697 *)      echo "We won't be including <dbm.h>"
12698         val="$undef"
12699         set i_dbm
12700         eval $setvar
12701         val="$undef"
12702         set i_rpcsvcdbm
12703         eval $setvar
12704         ;;
12705 esac
12706
12707 : see if this is a sys/file.h system
12708 val=''
12709 set sys/file.h val
12710 eval $inhdr
12711
12712 : do we need to include sys/file.h ?
12713 case "$val" in
12714 "$define")
12715         echo " "
12716         if $h_sysfile; then
12717                 val="$define"
12718                 echo "We'll be including <sys/file.h>." >&4
12719         else
12720                 val="$undef"
12721                 echo "We won't be including <sys/file.h>." >&4
12722         fi
12723         ;;
12724 *)
12725         h_sysfile=false
12726         ;;
12727 esac
12728 set i_sysfile
12729 eval $setvar
12730
12731 : see if fcntl.h is there
12732 val=''
12733 set fcntl.h val
12734 eval $inhdr
12735
12736 : see if we can include fcntl.h
12737 case "$val" in
12738 "$define")
12739         echo " "
12740         if $h_fcntl; then
12741                 val="$define"
12742                 echo "We'll be including <fcntl.h>." >&4
12743         else
12744                 val="$undef"
12745                 if $h_sysfile; then
12746         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
12747                 else
12748                         echo "We won't be including <fcntl.h>." >&4
12749                 fi
12750         fi
12751         ;;
12752 *)
12753         h_fcntl=false
12754         val="$undef"
12755         ;;
12756 esac
12757 set i_fcntl
12758 eval $setvar
12759
12760 : see if locale.h is available
12761 set locale.h i_locale
12762 eval $inhdr
12763
12764 : see if mach cthreads are available
12765 if test "X$usethreads" = "X$define"; then
12766         set mach/cthreads.h i_machcthr
12767         eval $inhdr
12768 else
12769         i_machcthr="$undef"
12770 fi
12771
12772
12773
12774 : see if this is a math.h system
12775 set math.h i_math
12776 eval $inhdr
12777
12778 : see if this is a mntent.h system
12779 set mntent.h i_mntent
12780 eval $inhdr
12781
12782 : see if ndbm.h is available
12783 set ndbm.h t_ndbm
12784 eval $inhdr
12785 case "$t_ndbm" in
12786 $define)
12787         : see if dbm_open exists
12788         set dbm_open d_dbm_open
12789         eval $inlibc
12790         case "$d_dbm_open" in
12791         $undef)
12792                 t_ndbm="$undef"
12793                 echo "We won't be including <ndbm.h>"
12794                 ;;
12795         esac
12796         ;;
12797 esac
12798 val="$t_ndbm"
12799 set i_ndbm
12800 eval $setvar
12801
12802 : see if net/errno.h is available
12803 val=''
12804 set net/errno.h val
12805 eval $inhdr
12806
12807 : Unfortunately, it causes problems on some systems.  Arrgh.
12808 case "$val" in
12809 $define)
12810         cat > try.c <<'EOM'
12811 #include <stdio.h>
12812 #include <errno.h>
12813 #include <net/errno.h>
12814 int func()
12815 {
12816         return ENOTSOCK;
12817 }
12818 EOM
12819         if $cc $ccflags -c try.c >/dev/null 2>&1; then
12820                 echo "We'll be including <net/errno.h>." >&4
12821         else
12822                 echo "We won't be including <net/errno.h>." >&4
12823                 val="$undef"
12824         fi
12825         $rm -f try.* try
12826         ;;
12827 esac
12828 set i_neterrno
12829 eval $setvar
12830
12831 : see if netinet/tcp.h is available
12832 set netinet/tcp.h i_netinettcp
12833 eval $inhdr
12834
12835 : see if this is a poll.h system
12836 set poll.h i_poll
12837 eval $inhdr
12838
12839 : get C preprocessor symbols handy
12840 echo " "
12841 $echo $n "Hmm... $c"
12842 echo $al | $tr ' ' $trnl >Cppsym.know
12843 $cat <<EOSS >Cppsym
12844 $startsh
12845 case "\$1" in
12846 -l) list=true
12847         shift
12848         ;;
12849 esac
12850 unknown=''
12851 case "\$list\$#" in
12852 1|2)
12853         for sym do
12854                 if $contains "^\$1$" Cppsym.true >/dev/null 2>&1; then
12855                         exit 0
12856                 elif $contains "^\$1$" Cppsym.know >/dev/null 2>&1; then
12857                         :
12858                 else
12859                         unknown="\$unknown \$sym"
12860                 fi
12861         done
12862         set X \$unknown
12863         shift
12864         ;;
12865 esac
12866 case \$# in
12867 0) exit 1;;
12868 esac
12869 echo \$* | $tr ' ' '$trnl' | $sed -e 's/\(.*\)/\\
12870 #ifdef \1\\
12871 exit 0; _ _ _ _\1\\      \1\\
12872 #endif\\
12873 /' >Cppsym\$\$
12874 echo "exit 1; _ _ _" >>Cppsym\$\$
12875 $cppstdin $cppminus <Cppsym\$\$ | $grep '^exit [01]; _ _'  >Cppsym2\$\$
12876 case "\$list" in
12877 true) $awk 'NF > 5 {print substr(\$6,2,100)}' <Cppsym2\$\$ ;;
12878 *)
12879         sh Cppsym2\$\$
12880         status=\$?
12881         ;;
12882 esac
12883 $rm -f Cppsym\$\$ Cppsym2\$\$
12884 exit \$status
12885 EOSS
12886 chmod +x Cppsym
12887 $eunicefix Cppsym
12888 ./Cppsym -l $al | $sort | $grep -v '^$' >Cppsym.true
12889
12890 : now check the C compiler for additional symbols
12891 postprocess_cc_v=''
12892 case "$osname" in
12893 aix) postprocess_cc_v="|$tr , ' '" ;;
12894 esac
12895 $cat >ccsym <<EOS
12896 $startsh
12897 $cat >tmp.c <<EOF
12898 extern int foo;
12899 EOF
12900 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
12901 do
12902         case "\$i" in
12903         -D*) echo "\$i" | $sed 's/^-D//';;
12904         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A\(.*\)(\(.*\))/\1=\2/';;
12905         esac
12906 done
12907 $rm -f try.c
12908 EOS
12909 postprocess_cc_v=''
12910 chmod +x ccsym
12911 $eunicefix ccsym
12912 ./ccsym > ccsym1.raw
12913 if $test -s ccsym1.raw; then
12914        $sort ccsym1.raw | $uniq >ccsym.raw
12915 else
12916        mv ccsym1.raw ccsym.raw
12917 fi
12918
12919 $awk '/\=/ { print $0; next }
12920         { print $0"=1" }' ccsym.raw >ccsym.list
12921 $awk '{ print $0"=1" }' Cppsym.true >ccsym.true
12922 $comm -13 ccsym.true ccsym.list >ccsym.own
12923 $comm -12 ccsym.true ccsym.list >ccsym.com
12924 $comm -23 ccsym.true ccsym.list >ccsym.cpp
12925 also=''
12926 if $test -z ccsym.raw; then
12927         echo "Your C compiler doesn't seem to define any symbols!" >&4
12928         echo " "
12929         echo "However, your C preprocessor defines the following symbols:"
12930         $cat Cppsym.true
12931         ccsymbols=''
12932         cppsymbols=`$cat Cppsym.true`
12933         cppsymbols=`echo $cppsymbols`
12934         cppccsymbols="$cppsymbols"
12935 else
12936         if $test -s ccsym.com; then
12937                 echo "Your C compiler and pre-processor define these symbols:"
12938                 $sed -e 's/\(.*\)=.*/\1/' ccsym.com
12939                 also='also '
12940                 symbols='ones'
12941                 cppccsymbols=`$cat ccsym.com`
12942                 cppccsymbols=`echo $cppccsymbols`
12943                 $test "$silent" || sleep 1
12944         fi
12945         if $test -s ccsym.cpp; then
12946                 $test "$also" && echo " "
12947                 echo "Your C pre-processor ${also}defines the following symbols:"
12948                 $sed -e 's/\(.*\)=.*/\1/' ccsym.cpp
12949                 also='further '
12950                 cppsymbols=`$cat ccsym.cpp`
12951                 cppsymbols=`echo $cppsymbols`
12952                 $test "$silent" || sleep 1
12953         fi
12954         if $test -s ccsym.own; then
12955                 $test "$also" && echo " "
12956                 echo "Your C compiler ${also}defines the following cpp symbols:"
12957                 $sed -e 's/\(.*\)=1/\1/' ccsym.own
12958                 $sed -e 's/\(.*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
12959                 ccsymbols=`$cat ccsym.own`
12960                 ccsymbols=`echo $ccsymbols`
12961                 $test "$silent" || sleep 1
12962         fi
12963 fi
12964 $rm -f ccsym*
12965
12966 : see if this is a termio system
12967 val="$undef"
12968 val2="$undef"
12969 val3="$undef"
12970 if $test `./findhdr termios.h`; then
12971         set tcsetattr i_termios
12972         eval $inlibc
12973         val3="$i_termios"
12974 fi
12975 echo " "
12976 case "$val3" in
12977 "$define") echo "You have POSIX termios.h... good!" >&4;;
12978 *) if ./Cppsym pyr; then
12979                 case "`/bin/universe`" in
12980                 ucb) if $test `./findhdr sgtty.h`; then
12981                                 val2="$define"
12982                                 echo "<sgtty.h> found." >&4
12983                         else
12984                                 echo "System is pyramid with BSD universe."
12985                                 echo "<sgtty.h> not found--you could have problems." >&4
12986                         fi;;
12987                 *) if $test `./findhdr termio.h`; then
12988                                 val="$define"
12989                                 echo "<termio.h> found." >&4
12990                         else
12991                                 echo "System is pyramid with USG universe."
12992                                 echo "<termio.h> not found--you could have problems." >&4
12993                         fi;;
12994                 esac
12995         elif ./usg; then
12996                 if $test `./findhdr termio.h`; then
12997                         echo "<termio.h> found." >&4
12998                         val="$define"
12999                 elif $test `./findhdr sgtty.h`; then
13000                         echo "<sgtty.h> found." >&4
13001                         val2="$define"
13002                 else
13003 echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
13004                 fi
13005         else
13006                 if $test `./findhdr sgtty.h`; then
13007                         echo "<sgtty.h> found." >&4
13008                         val2="$define"
13009                 elif $test `./findhdr termio.h`; then
13010                         echo "<termio.h> found." >&4
13011                         val="$define"
13012                 else
13013 echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
13014                 fi
13015         fi;;
13016 esac
13017 set i_termio; eval $setvar
13018 val=$val2; set i_sgtty; eval $setvar
13019 val=$val3; set i_termios; eval $setvar
13020
13021 : see if this is a shadow.h system
13022 set shadow.h i_shadow
13023 eval $inhdr
13024
13025 : see if this is a socks.h system
13026 set socks.h i_socks
13027 eval $inhdr
13028
13029 : see if stdarg is available
13030 echo " "
13031 if $test `./findhdr stdarg.h`; then
13032         echo "<stdarg.h> found." >&4
13033         valstd="$define"
13034 else
13035         echo "<stdarg.h> NOT found." >&4
13036         valstd="$undef"
13037 fi
13038
13039 : see if varags is available
13040 echo " "
13041 if $test `./findhdr varargs.h`; then
13042         echo "<varargs.h> found." >&4
13043 else
13044         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
13045 fi
13046
13047 : set up the varargs testing programs
13048 $cat > varargs.c <<EOP
13049 #ifdef I_STDARG
13050 #include <stdarg.h>
13051 #endif
13052 #ifdef I_VARARGS
13053 #include <varargs.h>
13054 #endif
13055
13056 #ifdef I_STDARG
13057 int f(char *p, ...)
13058 #else
13059 int f(va_alist)
13060 va_dcl
13061 #endif
13062 {
13063         va_list ap;
13064 #ifndef I_STDARG
13065         char *p;
13066 #endif
13067 #ifdef I_STDARG
13068         va_start(ap,p);
13069 #else
13070         va_start(ap);
13071         p = va_arg(ap, char *);
13072 #endif
13073         va_end(ap);
13074 }
13075 EOP
13076 $cat > varargs <<EOP
13077 $startsh
13078 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
13079         echo "true"
13080 else
13081         echo "false"
13082 fi
13083 $rm -f varargs$_o
13084 EOP
13085 chmod +x varargs
13086
13087 : now check which varargs header should be included
13088 echo " "
13089 i_varhdr=''
13090 case "$valstd" in
13091 "$define")
13092         if `./varargs I_STDARG`; then
13093                 val='stdarg.h'
13094         elif `./varargs I_VARARGS`; then
13095                 val='varargs.h'
13096         fi
13097         ;;
13098 *)
13099         if `./varargs I_VARARGS`; then
13100                 val='varargs.h'
13101         fi
13102         ;;
13103 esac
13104 case "$val" in
13105 '')
13106 echo "I could not find the definition for va_dcl... You have problems..." >&4
13107         val="$undef"; set i_stdarg; eval $setvar
13108         val="$undef"; set i_varargs; eval $setvar
13109         ;;
13110 *) 
13111         set i_varhdr
13112         eval $setvar
13113         case "$i_varhdr" in
13114         stdarg.h)
13115                 val="$define"; set i_stdarg; eval $setvar
13116                 val="$undef"; set i_varargs; eval $setvar
13117                 ;;
13118         varargs.h)
13119                 val="$undef"; set i_stdarg; eval $setvar
13120                 val="$define"; set i_varargs; eval $setvar
13121                 ;;
13122         esac
13123         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
13124 esac
13125 $rm -f varargs*
13126
13127 : see if stddef is available
13128 set stddef.h i_stddef
13129 eval $inhdr
13130
13131 : see if sys/access.h is available
13132 set sys/access.h i_sysaccess
13133 eval $inhdr
13134
13135 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
13136 set sys/filio.h i_sysfilio
13137 eval $inhdr
13138 echo " "
13139 if $test `./findhdr sys/ioctl.h`; then
13140         val="$define"
13141         echo '<sys/ioctl.h> found.' >&4
13142 else
13143         val="$undef"
13144         if $test $i_sysfilio = "$define"; then
13145             echo '<sys/ioctl.h> NOT found.' >&4
13146         else
13147                 $test $i_sgtty = "$define" && xxx="sgtty.h"
13148                 $test $i_termio = "$define" && xxx="termio.h"
13149                 $test $i_termios = "$define" && xxx="termios.h"
13150 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
13151         fi
13152 fi
13153 set i_sysioctl
13154 eval $setvar
13155
13156 : see if sys/resource.h has to be included
13157 set sys/resource.h i_sysresrc
13158 eval $inhdr
13159
13160 : see if sys/security.h is available
13161 set sys/security.h i_syssecrt
13162 eval $inhdr
13163
13164 : see if this is a sys/statvfs.h system
13165 set sys/statvfs.h i_sysstatvfs
13166 eval $inhdr
13167
13168 : see if this is a sys/un.h system
13169 set sys/un.h i_sysun
13170 eval $inhdr
13171
13172 : see if this is a syswait system
13173 set sys/wait.h i_syswait
13174 eval $inhdr
13175
13176 : see if this is a ustat.h system
13177 set ustat.h i_ustat
13178 eval $inhdr
13179
13180 : see if this is an utime system
13181 set utime.h i_utime
13182 eval $inhdr
13183
13184 : see if this is a values.h system
13185 set values.h i_values
13186 eval $inhdr
13187
13188 : see if this is a vfork system
13189 case "$d_vfork" in
13190 "$define")
13191         set vfork.h i_vfork
13192         eval $inhdr
13193         ;;
13194 *)
13195         i_vfork="$undef"
13196         ;;
13197 esac
13198
13199 : see if gdbm.h is available
13200 set gdbm.h t_gdbm
13201 eval $inhdr
13202 case "$t_gdbm" in
13203 $define)
13204         : see if gdbm_open exists
13205         set gdbm_open d_gdbm_open
13206         eval $inlibc
13207         case "$d_gdbm_open" in
13208         $undef)
13209                 t_gdbm="$undef"
13210                 echo "We won't be including <gdbm.h>"
13211                 ;;
13212         esac
13213         ;;
13214 esac
13215 val="$t_gdbm"
13216 set i_gdbm
13217 eval $setvar
13218
13219 echo " "
13220 echo "Looking for extensions..." >&4
13221 : If we are using the old config.sh, known_extensions may contain
13222 : old or inaccurate or duplicate values.
13223 known_extensions=''
13224 nonxs_extensions=''
13225 : We do not use find because it might not be available.
13226 : We do not just use MANIFEST because the user may have dropped
13227 : some additional extensions into the source tree and expect them
13228 : to be built.
13229
13230 : Function to recursively find available extensions, ignoring DynaLoader
13231 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
13232 find_extensions='
13233     for xxx in *; do
13234        case "$xxx" in
13235            DynaLoader|dynaload) ;;
13236            *)
13237            if $test -f $xxx/$xxx.xs; then
13238                known_extensions="$known_extensions $1$xxx";
13239            elif $test -f $xxx/Makefile.PL; then
13240                nonxs_extensions="$nonxs_extensions $1$xxx";
13241            else
13242                if $test -d $xxx -a $# -lt 10; then
13243                    set $1$xxx/ $*;
13244                    cd $xxx;
13245                    eval $find_extensions;
13246                    cd ..;
13247                    shift;
13248                fi;
13249            fi
13250            ;;
13251        esac;
13252     done'
13253 tdir=`pwd`
13254 cd $rsrc/ext
13255 set X
13256 shift
13257 eval $find_extensions
13258 set X $nonxs_extensions
13259 shift
13260 nonxs_extensions="$*"
13261 set X $known_extensions
13262 shift
13263 known_extensions="$*"
13264 cd $tdir
13265
13266 : Now see which are supported on this system.
13267 avail_ext=''
13268 for xxx in $known_extensions ; do
13269         case "$xxx" in
13270         DB_File|db_file)
13271                 case "$i_db" in
13272                 $define) avail_ext="$avail_ext $xxx" ;;
13273                 esac
13274                 ;;
13275         GDBM_File|gdbm_fil)
13276                 case "$i_gdbm" in 
13277                 $define) avail_ext="$avail_ext $xxx" ;;
13278                 esac
13279                 ;;
13280         NDBM_File|ndbm_fil)
13281                 case "$i_ndbm" in
13282                 $define) avail_ext="$avail_ext $xxx" ;;
13283                 esac
13284                 ;;
13285         ODBM_File|odbm_fil) 
13286                 case "${i_dbm}${i_rpcsvcdbm}" in
13287                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
13288                 esac
13289                 ;;
13290         POSIX|posix)
13291                 case "$useposix" in
13292                 true|define|y) avail_ext="$avail_ext $xxx" ;;
13293                 esac
13294                 ;;
13295         Opcode|opcode)
13296                 case "$useopcode" in
13297                 true|define|y) avail_ext="$avail_ext $xxx" ;;
13298                 esac
13299                 ;;
13300         Socket|socket)
13301                 case "$d_socket" in 
13302                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
13303                 esac
13304                 ;;
13305         Thread|thread)
13306                 case "$usethreads" in 
13307                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
13308                 esac
13309                 ;;
13310         IPC/SysV|ipc/sysv)
13311                 : XXX Do we need a useipcsysv variable here
13312                 case "${d_msg}${d_sem}${d_shm}" in 
13313                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
13314                 esac
13315                 ;;
13316         *)      avail_ext="$avail_ext $xxx"
13317                 ;;
13318         esac
13319 done
13320
13321 set X $avail_ext
13322 shift
13323 avail_ext="$*"
13324
13325 : Now see which nonxs extensions are supported on this system.
13326 : For now assume all are.
13327 nonxs_ext=''
13328 for xxx in $nonxs_extensions ; do
13329         case "$xxx" in
13330         *)      nonxs_ext="$nonxs_ext $xxx"
13331                 ;;
13332         esac
13333 done
13334
13335 set X $nonxs_ext
13336 shift
13337 nonxs_ext="$*"
13338
13339 case $usedl in
13340 $define)
13341         $cat <<EOM
13342 A number of extensions are supplied with $package.  You may choose to
13343 compile these extensions for dynamic loading (the default), compile
13344 them into the $package executable (static loading), or not include
13345 them at all.  Answer "none" to include no extensions.
13346 Note that DynaLoader is always built and need not be mentioned here.
13347
13348 EOM
13349         case "$dynamic_ext" in
13350         '') dflt="$avail_ext" ;;
13351         *)      dflt="$dynamic_ext"
13352                 # Perhaps we are reusing an old out-of-date config.sh.
13353                 case "$hint" in
13354                 previous)
13355                         if test X"$dynamic_ext" != X"$avail_ext"; then
13356                                 $cat <<EOM
13357 NOTICE:  Your previous config.sh list may be incorrect. 
13358 The extensions now available to you are 
13359         ${avail_ext}
13360 but the default list from your previous config.sh is
13361         ${dynamic_ext} 
13362
13363 EOM
13364                         fi
13365                         ;;
13366                 esac
13367                 ;;
13368         esac
13369         case "$dflt" in
13370         '')     dflt=none;;
13371         esac
13372         rp="What extensions do you wish to load dynamically?"
13373         . ./myread
13374         case "$ans" in
13375         none) dynamic_ext=' ' ;;
13376         *) dynamic_ext="$ans" ;;
13377         esac
13378
13379         case "$static_ext" in
13380         '')
13381                 : Exclude those already listed in dynamic linking
13382                 dflt=''
13383                 for xxx in $avail_ext; do
13384                         case " $dynamic_ext " in
13385                         *" $xxx "*) ;;
13386                         *) dflt="$dflt $xxx" ;;
13387                         esac
13388                 done
13389                 set X $dflt
13390                 shift
13391                 dflt="$*"
13392                 ;;
13393         *)  dflt="$static_ext" 
13394                 ;;
13395         esac
13396
13397         case "$dflt" in
13398         '')     dflt=none;;
13399         esac
13400         rp="What extensions do you wish to load statically?"
13401         . ./myread
13402         case "$ans" in
13403         none) static_ext=' ' ;;
13404         *) static_ext="$ans" ;;
13405         esac
13406         ;;
13407 *)
13408         $cat <<EOM
13409 A number of extensions are supplied with $package.  Answer "none" 
13410 to include no extensions. 
13411 Note that DynaLoader is always built and need not be mentioned here.
13412
13413 EOM
13414         case "$static_ext" in
13415         '') dflt="$avail_ext" ;;
13416         *)      dflt="$static_ext"
13417                 # Perhaps we are reusing an old out-of-date config.sh.
13418                 case "$hint" in
13419                 previous)
13420                         if test X"$static_ext" != X"$avail_ext"; then
13421                                 $cat <<EOM
13422 NOTICE:  Your previous config.sh list may be incorrect. 
13423 The extensions now available to you are 
13424         ${avail_ext}
13425 but the default list from your previous config.sh is
13426         ${static_ext} 
13427
13428 EOM
13429                         fi
13430                         ;;
13431                 esac
13432                 ;;
13433         esac
13434         : Exclude those that are not xs extensions
13435         case "$dflt" in
13436         '')     dflt=none;;
13437         esac
13438         rp="What extensions do you wish to include?"
13439         . ./myread
13440         case "$ans" in
13441         none) static_ext=' ' ;;
13442         *) static_ext="$ans" ;;
13443         esac
13444         ;;
13445 esac
13446
13447 set X $dynamic_ext $static_ext $nonxs_ext
13448 shift
13449 extensions="$*"
13450
13451 : Remove build directory name from cppstdin so it can be used from
13452 : either the present location or the final installed location.
13453 echo " "
13454 : Get out of the UU directory to get correct path name.
13455 cd ..
13456 case "$cppstdin" in
13457 `pwd`/cppstdin)
13458         echo "Stripping down cppstdin path name"
13459         cppstdin=cppstdin
13460         ;;
13461 esac
13462 cd UU
13463
13464 : end of configuration questions
13465 echo " "
13466 echo "End of configuration questions."
13467 echo " "
13468
13469 : back to where it started
13470 if test -d ../UU; then
13471         cd ..
13472 fi
13473
13474 : configuration may be patched via a 'config.over' file
13475 if $test -f config.over; then
13476         echo " "
13477         dflt=y
13478         rp='I see a config.over file.  Do you wish to load it?'
13479         . UU/myread
13480         case "$ans" in
13481         n*) echo "OK, I'll ignore it.";;
13482         *)      . ./config.over
13483                 echo "Configuration override changes have been loaded."
13484                 ;;
13485         esac
13486 fi
13487
13488 : in case they want portability, strip down executable paths
13489 case "$d_portable" in
13490 "$define")
13491         echo " "
13492         echo "Stripping down executable paths..." >&4
13493         for file in $loclist $trylist; do
13494                 eval temp=\$$file
13495                 eval $file=`basename $temp`
13496         done
13497         ;;
13498 esac
13499
13500 : create config.sh file
13501 echo " "
13502 echo "Creating config.sh..." >&4
13503 $spitshell <<EOT >config.sh
13504 $startsh
13505 #
13506 # This file was produced by running the Configure script. It holds all the
13507 # definitions figured out by Configure. Should you modify one of these values,
13508 # do not forget to propagate your changes by running "Configure -der". You may
13509 # instead choose to run each of the .SH files by yourself, or "Configure -S".
13510 #
13511
13512 # Package name      : $package
13513 # Source directory  : $src
13514 # Configuration time: $cf_time
13515 # Configured by     : $cf_by
13516 # Target system     : $myuname
13517
13518 Author='$Author'
13519 Date='$Date'
13520 Header='$Header'
13521 Id='$Id'
13522 Locker='$Locker'
13523 Log='$Log'
13524 Mcc='$Mcc'
13525 RCSfile='$RCSfile'
13526 Revision='$Revision'
13527 Source='$Source'
13528 State='$State'
13529 _a='$_a'
13530 _exe='$_exe'
13531 _o='$_o'
13532 afs='$afs'
13533 alignbytes='$alignbytes'
13534 ansi2knr='$ansi2knr'
13535 aphostname='$aphostname'
13536 apiversion='$apiversion'
13537 ar='$ar'
13538 archlib='$archlib'
13539 archlibexp='$archlibexp'
13540 archname64='$archname64'
13541 archname='$archname'
13542 archobjs='$archobjs'
13543 awk='$awk'
13544 baserev='$baserev'
13545 bash='$bash'
13546 bin='$bin'
13547 bincompat5005='$bincompat5005'
13548 binexp='$binexp'
13549 bison='$bison'
13550 byacc='$byacc'
13551 byteorder='$byteorder'
13552 c='$c'
13553 castflags='$castflags'
13554 cat='$cat'
13555 cc='$cc'
13556 cccdlflags='$cccdlflags'
13557 ccdlflags='$ccdlflags'
13558 ccflags='$ccflags'
13559 ccsymbols='$ccsymbols'
13560 cf_by='$cf_by'
13561 cf_email='$cf_email'
13562 cf_time='$cf_time'
13563 chgrp='$chgrp'
13564 chmod='$chmod'
13565 chown='$chown'
13566 clocktype='$clocktype'
13567 comm='$comm'
13568 compress='$compress'
13569 contains='$contains'
13570 cp='$cp'
13571 cpio='$cpio'
13572 cpp='$cpp'
13573 cpp_stuff='$cpp_stuff'
13574 cppccsymbols='$cppccsymbols'
13575 cppflags='$cppflags'
13576 cpplast='$cpplast'
13577 cppminus='$cppminus'
13578 cpprun='$cpprun'
13579 cppstdin='$cppstdin'
13580 cppsymbols='$cppsymbols'
13581 crosscompile='$crosscompile'
13582 cryptlib='$cryptlib'
13583 csh='$csh'
13584 d_Gconvert='$d_Gconvert'
13585 d_PRIEldbl='$d_PRIEldbl'
13586 d_PRIFldbl='$d_PRIFldbl'
13587 d_PRIGldbl='$d_PRIGldbl'
13588 d_PRIX64='$d_PRIX64'
13589 d_PRId64='$d_PRId64'
13590 d_PRIeldbl='$d_PRIeldbl'
13591 d_PRIfldbl='$d_PRIfldbl'
13592 d_PRIgldbl='$d_PRIgldbl'
13593 d_PRIi64='$d_PRIi64'
13594 d_PRIo64='$d_PRIo64'
13595 d_PRIu64='$d_PRIu64'
13596 d_PRIx64='$d_PRIx64'
13597 d_access='$d_access'
13598 d_accessx='$d_accessx'
13599 d_alarm='$d_alarm'
13600 d_archlib='$d_archlib'
13601 d_atolf='$d_atolf'
13602 d_atoll='$d_atoll'
13603 d_attribut='$d_attribut'
13604 d_bcmp='$d_bcmp'
13605 d_bcopy='$d_bcopy'
13606 d_bincompat5005='$d_bincompat5005'
13607 d_bsd='$d_bsd'
13608 d_bsdgetpgrp='$d_bsdgetpgrp'
13609 d_bsdsetpgrp='$d_bsdsetpgrp'
13610 d_bzero='$d_bzero'
13611 d_casti32='$d_casti32'
13612 d_castneg='$d_castneg'
13613 d_charvspr='$d_charvspr'
13614 d_chown='$d_chown'
13615 d_chroot='$d_chroot'
13616 d_chsize='$d_chsize'
13617 d_closedir='$d_closedir'
13618 d_cmsghdr_s='$d_cmsghdr_s'
13619 d_const='$d_const'
13620 d_crypt='$d_crypt'
13621 d_csh='$d_csh'
13622 d_cuserid='$d_cuserid'
13623 d_dbl_dig='$d_dbl_dig'
13624 d_difftime='$d_difftime'
13625 d_dirnamlen='$d_dirnamlen'
13626 d_dlerror='$d_dlerror'
13627 d_dlopen='$d_dlopen'
13628 d_dlsymun='$d_dlsymun'
13629 d_dosuid='$d_dosuid'
13630 d_drand48proto='$d_drand48proto'
13631 d_dup2='$d_dup2'
13632 d_eaccess='$d_eaccess'
13633 d_endgrent='$d_endgrent'
13634 d_endhent='$d_endhent'
13635 d_endnent='$d_endnent'
13636 d_endpent='$d_endpent'
13637 d_endpwent='$d_endpwent'
13638 d_endsent='$d_endsent'
13639 d_endspent='$d_endspent'
13640 d_eofnblk='$d_eofnblk'
13641 d_eunice='$d_eunice'
13642 d_fchmod='$d_fchmod'
13643 d_fchown='$d_fchown'
13644 d_fcntl='$d_fcntl'
13645 d_fd_macros='$d_fd_macros'
13646 d_fd_set='$d_fd_set'
13647 d_fds_bits='$d_fds_bits'
13648 d_fgetpos='$d_fgetpos'
13649 d_flexfnam='$d_flexfnam'
13650 d_flock='$d_flock'
13651 d_fork='$d_fork'
13652 d_fpathconf='$d_fpathconf'
13653 d_fpos64_t='$d_fpos64_t'
13654 d_fs_data_s='$d_fs_data_s'
13655 d_fseeko='$d_fseeko'
13656 d_fsetpos='$d_fsetpos'
13657 d_fstatfs='$d_fstatfs'
13658 d_fstatvfs='$d_fstatvfs'
13659 d_ftello='$d_ftello'
13660 d_ftime='$d_ftime'
13661 d_getgrent='$d_getgrent'
13662 d_getgrps='$d_getgrps'
13663 d_gethbyaddr='$d_gethbyaddr'
13664 d_gethbyname='$d_gethbyname'
13665 d_gethent='$d_gethent'
13666 d_gethname='$d_gethname'
13667 d_gethostprotos='$d_gethostprotos'
13668 d_getlogin='$d_getlogin'
13669 d_getmntent='$d_getmntent'
13670 d_getnbyaddr='$d_getnbyaddr'
13671 d_getnbyname='$d_getnbyname'
13672 d_getnent='$d_getnent'
13673 d_getnetprotos='$d_getnetprotos'
13674 d_getpbyname='$d_getpbyname'
13675 d_getpbynumber='$d_getpbynumber'
13676 d_getpent='$d_getpent'
13677 d_getpgid='$d_getpgid'
13678 d_getpgrp2='$d_getpgrp2'
13679 d_getpgrp='$d_getpgrp'
13680 d_getppid='$d_getppid'
13681 d_getprior='$d_getprior'
13682 d_getprotoprotos='$d_getprotoprotos'
13683 d_getpwent='$d_getpwent'
13684 d_getsbyname='$d_getsbyname'
13685 d_getsbyport='$d_getsbyport'
13686 d_getsent='$d_getsent'
13687 d_getservprotos='$d_getservprotos'
13688 d_getspent='$d_getspent'
13689 d_getspnam='$d_getspnam'
13690 d_gettimeod='$d_gettimeod'
13691 d_gnulibc='$d_gnulibc'
13692 d_grpasswd='$d_grpasswd'
13693 d_hasmntopt='$d_hasmntopt'
13694 d_htonl='$d_htonl'
13695 d_index='$d_index'
13696 d_inetaton='$d_inetaton'
13697 d_int64t='$d_int64t'
13698 d_iovec_s='$d_iovec_s'
13699 d_isascii='$d_isascii'
13700 d_killpg='$d_killpg'
13701 d_lchown='$d_lchown'
13702 d_ldbl_dig='$d_ldbl_dig'
13703 d_link='$d_link'
13704 d_llseek='$d_llseek'
13705 d_locconv='$d_locconv'
13706 d_lockf='$d_lockf'
13707 d_longdbl='$d_longdbl'
13708 d_longlong='$d_longlong'
13709 d_lstat='$d_lstat'
13710 d_madvise='$d_madvise'
13711 d_mblen='$d_mblen'
13712 d_mbstowcs='$d_mbstowcs'
13713 d_mbtowc='$d_mbtowc'
13714 d_memchr='$d_memchr'
13715 d_memcmp='$d_memcmp'
13716 d_memcpy='$d_memcpy'
13717 d_memmove='$d_memmove'
13718 d_memset='$d_memset'
13719 d_mkdir='$d_mkdir'
13720 d_mkfifo='$d_mkfifo'
13721 d_mktime='$d_mktime'
13722 d_mmap='$d_mmap'
13723 d_mprotect='$d_mprotect'
13724 d_msg='$d_msg'
13725 d_msg_ctrunc='$d_msg_ctrunc'
13726 d_msg_dontroute='$d_msg_dontroute'
13727 d_msg_oob='$d_msg_oob'
13728 d_msg_peek='$d_msg_peek'
13729 d_msg_proxy='$d_msg_proxy'
13730 d_msgctl='$d_msgctl'
13731 d_msgget='$d_msgget'
13732 d_msghdr_s='$d_msghdr_s'
13733 d_msgrcv='$d_msgrcv'
13734 d_msgsnd='$d_msgsnd'
13735 d_msync='$d_msync'
13736 d_munmap='$d_munmap'
13737 d_mymalloc='$d_mymalloc'
13738 d_nice='$d_nice'
13739 d_off64_t='$d_off64_t'
13740 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
13741 d_oldpthreads='$d_oldpthreads'
13742 d_oldsock='$d_oldsock'
13743 d_open3='$d_open3'
13744 d_pathconf='$d_pathconf'
13745 d_pause='$d_pause'
13746 d_phostname='$d_phostname'
13747 d_pipe='$d_pipe'
13748 d_poll='$d_poll'
13749 d_portable='$d_portable'
13750 d_pthread_yield='$d_pthread_yield'
13751 d_pwage='$d_pwage'
13752 d_pwchange='$d_pwchange'
13753 d_pwclass='$d_pwclass'
13754 d_pwcomment='$d_pwcomment'
13755 d_pwexpire='$d_pwexpire'
13756 d_pwgecos='$d_pwgecos'
13757 d_pwpasswd='$d_pwpasswd'
13758 d_pwquota='$d_pwquota'
13759 d_readdir='$d_readdir'
13760 d_readlink='$d_readlink'
13761 d_readv='$d_readv'
13762 d_recvmsg='$d_recvmsg'
13763 d_rename='$d_rename'
13764 d_rewinddir='$d_rewinddir'
13765 d_rmdir='$d_rmdir'
13766 d_safebcpy='$d_safebcpy'
13767 d_safemcpy='$d_safemcpy'
13768 d_sanemcmp='$d_sanemcmp'
13769 d_sched_yield='$d_sched_yield'
13770 d_scm_rights='$d_scm_rights'
13771 d_seekdir='$d_seekdir'
13772 d_select='$d_select'
13773 d_sem='$d_sem'
13774 d_semctl='$d_semctl'
13775 d_semctl_semid_ds='$d_semctl_semid_ds'
13776 d_semctl_semun='$d_semctl_semun'
13777 d_semget='$d_semget'
13778 d_semop='$d_semop'
13779 d_sendmsg='$d_sendmsg'
13780 d_setegid='$d_setegid'
13781 d_seteuid='$d_seteuid'
13782 d_setgrent='$d_setgrent'
13783 d_setgrps='$d_setgrps'
13784 d_sethent='$d_sethent'
13785 d_setlinebuf='$d_setlinebuf'
13786 d_setlocale='$d_setlocale'
13787 d_setnent='$d_setnent'
13788 d_setpent='$d_setpent'
13789 d_setpgid='$d_setpgid'
13790 d_setpgrp2='$d_setpgrp2'
13791 d_setpgrp='$d_setpgrp'
13792 d_setprior='$d_setprior'
13793 d_setpwent='$d_setpwent'
13794 d_setregid='$d_setregid'
13795 d_setresgid='$d_setresgid'
13796 d_setresuid='$d_setresuid'
13797 d_setreuid='$d_setreuid'
13798 d_setrgid='$d_setrgid'
13799 d_setruid='$d_setruid'
13800 d_setsent='$d_setsent'
13801 d_setsid='$d_setsid'
13802 d_setspent='$d_setspent'
13803 d_setvbuf='$d_setvbuf'
13804 d_sfio='$d_sfio'
13805 d_shm='$d_shm'
13806 d_shmat='$d_shmat'
13807 d_shmatprototype='$d_shmatprototype'
13808 d_shmctl='$d_shmctl'
13809 d_shmdt='$d_shmdt'
13810 d_shmget='$d_shmget'
13811 d_sigaction='$d_sigaction'
13812 d_sigsetjmp='$d_sigsetjmp'
13813 d_socket='$d_socket'
13814 d_sockpair='$d_sockpair'
13815 d_sqrtl='$d_sqrtl'
13816 d_statblks='$d_statblks'
13817 d_statfs='$d_statfs'
13818 d_statfs_f_flags='$d_statfs_f_flags'
13819 d_statfs_s='$d_statfs_s'
13820 d_statvfs='$d_statvfs'
13821 d_stdio_cnt_lval='$d_stdio_cnt_lval'
13822 d_stdio_ptr_lval='$d_stdio_ptr_lval'
13823 d_stdio_stream_array='$d_stdio_stream_array'
13824 d_stdiobase='$d_stdiobase'
13825 d_stdstdio='$d_stdstdio'
13826 d_strchr='$d_strchr'
13827 d_strcoll='$d_strcoll'
13828 d_strctcpy='$d_strctcpy'
13829 d_strerrm='$d_strerrm'
13830 d_strerror='$d_strerror'
13831 d_strtod='$d_strtod'
13832 d_strtol='$d_strtol'
13833 d_strtoul='$d_strtoul'
13834 d_strtoull='$d_strtoull'
13835 d_strxfrm='$d_strxfrm'
13836 d_suidsafe='$d_suidsafe'
13837 d_symlink='$d_symlink'
13838 d_syscall='$d_syscall'
13839 d_sysconf='$d_sysconf'
13840 d_sysernlst='$d_sysernlst'
13841 d_syserrlst='$d_syserrlst'
13842 d_system='$d_system'
13843 d_tcgetpgrp='$d_tcgetpgrp'
13844 d_tcsetpgrp='$d_tcsetpgrp'
13845 d_telldir='$d_telldir'
13846 d_telldirproto='$d_telldirproto'
13847 d_time='$d_time'
13848 d_times='$d_times'
13849 d_truncate='$d_truncate'
13850 d_tzname='$d_tzname'
13851 d_umask='$d_umask'
13852 d_uname='$d_uname'
13853 d_union_semun='$d_union_semun'
13854 d_ustat='$d_ustat'
13855 d_vendorbin='$d_vendorbin'
13856 d_vendorlib='$d_vendorlib'
13857 d_vfork='$d_vfork'
13858 d_void_closedir='$d_void_closedir'
13859 d_voidsig='$d_voidsig'
13860 d_voidtty='$d_voidtty'
13861 d_volatile='$d_volatile'
13862 d_vprintf='$d_vprintf'
13863 d_wait4='$d_wait4'
13864 d_waitpid='$d_waitpid'
13865 d_wcstombs='$d_wcstombs'
13866 d_wctomb='$d_wctomb'
13867 d_writev='$d_writev'
13868 d_xenix='$d_xenix'
13869 date='$date'
13870 db_hashtype='$db_hashtype'
13871 db_prefixtype='$db_prefixtype'
13872 defvoidused='$defvoidused'
13873 direntrytype='$direntrytype'
13874 dlext='$dlext'
13875 dlsrc='$dlsrc'
13876 doublesize='$doublesize'
13877 drand01='$drand01'
13878 dynamic_ext='$dynamic_ext'
13879 eagain='$eagain'
13880 ebcdic='$ebcdic'
13881 echo='$echo'
13882 egrep='$egrep'
13883 emacs='$emacs'
13884 eunicefix='$eunicefix'
13885 exe_ext='$exe_ext'
13886 expr='$expr'
13887 extensions='$extensions'
13888 fflushNULL='$fflushNULL'
13889 fflushall='$fflushall'
13890 find='$find'
13891 firstmakefile='$firstmakefile'
13892 flex='$flex'
13893 fpostype='$fpostype'
13894 freetype='$freetype'
13895 full_ar='$full_ar'
13896 full_csh='$full_csh'
13897 full_sed='$full_sed'
13898 gccversion='$gccversion'
13899 gidtype='$gidtype'
13900 glibpth='$glibpth'
13901 grep='$grep'
13902 groupcat='$groupcat'
13903 groupstype='$groupstype'
13904 gzip='$gzip'
13905 h_fcntl='$h_fcntl'
13906 h_sysfile='$h_sysfile'
13907 hint='$hint'
13908 hostcat='$hostcat'
13909 huge='$huge'
13910 i_arpainet='$i_arpainet'
13911 i_bsdioctl='$i_bsdioctl'
13912 i_db='$i_db'
13913 i_dbm='$i_dbm'
13914 i_dirent='$i_dirent'
13915 i_dld='$i_dld'
13916 i_dlfcn='$i_dlfcn'
13917 i_fcntl='$i_fcntl'
13918 i_float='$i_float'
13919 i_gdbm='$i_gdbm'
13920 i_grp='$i_grp'
13921 i_inttypes='$i_inttypes'
13922 i_limits='$i_limits'
13923 i_locale='$i_locale'
13924 i_machcthr='$i_machcthr'
13925 i_malloc='$i_malloc'
13926 i_math='$i_math'
13927 i_memory='$i_memory'
13928 i_mntent='$i_mntent'
13929 i_ndbm='$i_ndbm'
13930 i_netdb='$i_netdb'
13931 i_neterrno='$i_neterrno'
13932 i_netinettcp='$i_netinettcp'
13933 i_niin='$i_niin'
13934 i_poll='$i_poll'
13935 i_pthread='$i_pthread'
13936 i_pwd='$i_pwd'
13937 i_rpcsvcdbm='$i_rpcsvcdbm'
13938 i_sfio='$i_sfio'
13939 i_sgtty='$i_sgtty'
13940 i_shadow='$i_shadow'
13941 i_socks='$i_socks'
13942 i_stdarg='$i_stdarg'
13943 i_stddef='$i_stddef'
13944 i_stdlib='$i_stdlib'
13945 i_string='$i_string'
13946 i_sysaccess='$i_sysaccess'
13947 i_sysdir='$i_sysdir'
13948 i_sysfile='$i_sysfile'
13949 i_sysfilio='$i_sysfilio'
13950 i_sysin='$i_sysin'
13951 i_sysioctl='$i_sysioctl'
13952 i_sysmman='$i_sysmman'
13953 i_sysmount='$i_sysmount'
13954 i_sysndir='$i_sysndir'
13955 i_sysparam='$i_sysparam'
13956 i_sysresrc='$i_sysresrc'
13957 i_syssecrt='$i_syssecrt'
13958 i_sysselct='$i_sysselct'
13959 i_syssockio='$i_syssockio'
13960 i_sysstat='$i_sysstat'
13961 i_sysstatfs='$i_sysstatfs'
13962 i_sysstatvfs='$i_sysstatvfs'
13963 i_systime='$i_systime'
13964 i_systimek='$i_systimek'
13965 i_systimes='$i_systimes'
13966 i_systypes='$i_systypes'
13967 i_sysuio='$i_sysuio'
13968 i_sysun='$i_sysun'
13969 i_sysvfs='$i_sysvfs'
13970 i_syswait='$i_syswait'
13971 i_termio='$i_termio'
13972 i_termios='$i_termios'
13973 i_time='$i_time'
13974 i_unistd='$i_unistd'
13975 i_ustat='$i_ustat'
13976 i_utime='$i_utime'
13977 i_values='$i_values'
13978 i_varargs='$i_varargs'
13979 i_varhdr='$i_varhdr'
13980 i_vfork='$i_vfork'
13981 ignore_versioned_solibs='$ignore_versioned_solibs'
13982 incpath='$incpath'
13983 inews='$inews'
13984 installarchlib='$installarchlib'
13985 installbin='$installbin'
13986 installman1dir='$installman1dir'
13987 installman3dir='$installman3dir'
13988 installprefix='$installprefix'
13989 installprefixexp='$installprefixexp'
13990 installprivlib='$installprivlib'
13991 installscript='$installscript'
13992 installsitearch='$installsitearch'
13993 installsitebin='$installsitebin'
13994 installsitelib='$installsitelib'
13995 installstyle='$installstyle'
13996 installusrbinperl='$installusrbinperl'
13997 installvendorbin='$installvendorbin'
13998 installvendorlib='$installvendorlib'
13999 intsize='$intsize'
14000 known_extensions='$known_extensions'
14001 ksh='$ksh'
14002 large='$large'
14003 ld='$ld'
14004 lddlflags='$lddlflags'
14005 ldflags='$ldflags'
14006 ldlibpthname='$ldlibpthname'
14007 less='$less'
14008 lib_ext='$lib_ext'
14009 libc='$libc'
14010 libperl='$libperl'
14011 libpth='$libpth'
14012 libs='$libs'
14013 libswanted='$libswanted'
14014 line='$line'
14015 lint='$lint'
14016 lkflags='$lkflags'
14017 ln='$ln'
14018 lns='$lns'
14019 locincpth='$locincpth'
14020 loclibpth='$loclibpth'
14021 longdblsize='$longdblsize'
14022 longlongsize='$longlongsize'
14023 longsize='$longsize'
14024 lp='$lp'
14025 lpr='$lpr'
14026 ls='$ls'
14027 lseeksize='$lseeksize'
14028 lseektype='$lseektype'
14029 mail='$mail'
14030 mailx='$mailx'
14031 make='$make'
14032 make_set_make='$make_set_make'
14033 mallocobj='$mallocobj'
14034 mallocsrc='$mallocsrc'
14035 malloctype='$malloctype'
14036 man1dir='$man1dir'
14037 man1direxp='$man1direxp'
14038 man1ext='$man1ext'
14039 man3dir='$man3dir'
14040 man3direxp='$man3direxp'
14041 man3ext='$man3ext'
14042 medium='$medium'
14043 mips='$mips'
14044 mips_type='$mips_type'
14045 mkdir='$mkdir'
14046 mmaptype='$mmaptype'
14047 models='$models'
14048 modetype='$modetype'
14049 more='$more'
14050 multiarch='$multiarch'
14051 mv='$mv'
14052 myarchname='$myarchname'
14053 mydomain='$mydomain'
14054 myhostname='$myhostname'
14055 myuname='$myuname'
14056 n='$n'
14057 netdb_hlen_type='$netdb_hlen_type'
14058 netdb_host_type='$netdb_host_type'
14059 netdb_name_type='$netdb_name_type'
14060 netdb_net_type='$netdb_net_type'
14061 nm='$nm'
14062 nm_opt='$nm_opt'
14063 nm_so_opt='$nm_so_opt'
14064 nonxs_ext='$nonxs_ext'
14065 nroff='$nroff'
14066 o_nonblock='$o_nonblock'
14067 obj_ext='$obj_ext'
14068 old_pthread_create_joinable='$old_pthread_create_joinable'
14069 optimize='$optimize'
14070 orderlib='$orderlib'
14071 osname='$osname'
14072 osvers='$osvers'
14073 package='$package'
14074 pager='$pager'
14075 passcat='$passcat'
14076 patchlevel='$patchlevel'
14077 path_sep='$path_sep'
14078 perl='$perl'
14079 perladmin='$perladmin'
14080 perlpath='$perlpath'
14081 pg='$pg'
14082 phostname='$phostname'
14083 pidtype='$pidtype'
14084 plibpth='$plibpth'
14085 pm_apiversion='$pm_apiversion'
14086 pmake='$pmake'
14087 pr='$pr'
14088 prefix='$prefix'
14089 prefixexp='$prefixexp'
14090 privlib='$privlib'
14091 privlibexp='$privlibexp'
14092 prototype='$prototype'
14093 ptrsize='$ptrsize'
14094 randbits='$randbits'
14095 randfunc='$randfunc'
14096 randseedtype='$randseedtype'
14097 ranlib='$ranlib'
14098 rd_nodata='$rd_nodata'
14099 rm='$rm'
14100 rmail='$rmail'
14101 runnm='$runnm'
14102 sPRIEldbl='$sPRIEldbl'
14103 sPRIFldbl='$sPRIFldbl'
14104 sPRIGldbl='$sPRIGldbl'
14105 sPRIX64='$sPRIX64'
14106 sPRId64='$sPRId64'
14107 sPRIeldbl='$sPRIeldbl'
14108 sPRIfldbl='$sPRIfldbl'
14109 sPRIgldbl='$sPRIgldbl'
14110 sPRIi64='$sPRIi64'
14111 sPRIo64='$sPRIo64'
14112 sPRIu64='$sPRIu64'
14113 sPRIx64='$sPRIx64'
14114 sched_yield='$sched_yield'
14115 scriptdir='$scriptdir'
14116 scriptdirexp='$scriptdirexp'
14117 sed='$sed'
14118 seedfunc='$seedfunc'
14119 selectminbits='$selectminbits'
14120 selecttype='$selecttype'
14121 sendmail='$sendmail'
14122 sh='$sh'
14123 shar='$shar'
14124 sharpbang='$sharpbang'
14125 shmattype='$shmattype'
14126 shortsize='$shortsize'
14127 shrpenv='$shrpenv'
14128 shsharp='$shsharp'
14129 sig_count='$sig_count'
14130 sig_name='$sig_name'
14131 sig_name_init='$sig_name_init'
14132 sig_num='$sig_num'
14133 sig_num_init='$sig_num_init'
14134 signal_t='$signal_t'
14135 sitearch='$sitearch'
14136 sitearchexp='$sitearchexp'
14137 sitebin='$sitebin'
14138 sitebinexp='$sitebinexp'
14139 sitelib='$sitelib'
14140 sitelibexp='$sitelibexp'
14141 siteprefix='$siteprefix'
14142 siteprefixexp='$siteprefixexp'
14143 sizetype='$sizetype'
14144 sleep='$sleep'
14145 smail='$smail'
14146 small='$small'
14147 so='$so'
14148 sockethdr='$sockethdr'
14149 socketlib='$socketlib'
14150 sort='$sort'
14151 spackage='$spackage'
14152 spitshell='$spitshell'
14153 split='$split'
14154 src='$src'
14155 ssizetype='$ssizetype'
14156 startperl='$startperl'
14157 startsh='$startsh'
14158 static_ext='$static_ext'
14159 stdchar='$stdchar'
14160 stdio_base='$stdio_base'
14161 stdio_bufsiz='$stdio_bufsiz'
14162 stdio_cnt='$stdio_cnt'
14163 stdio_filbuf='$stdio_filbuf'
14164 stdio_ptr='$stdio_ptr'
14165 stdio_stream_array='$stdio_stream_array'
14166 strings='$strings'
14167 submit='$submit'
14168 subversion='$subversion'
14169 sysman='$sysman'
14170 tail='$tail'
14171 tar='$tar'
14172 tbl='$tbl'
14173 tee='$tee'
14174 test='$test'
14175 timeincl='$timeincl'
14176 timetype='$timetype'
14177 touch='$touch'
14178 tr='$tr'
14179 trnl='$trnl'
14180 troff='$troff'
14181 uidsign='$uidsign'
14182 uidtype='$uidtype'
14183 uname='$uname'
14184 uniq='$uniq'
14185 use64bits='$use64bits'
14186 usedl='$usedl'
14187 uselargefiles='$uselargefiles'
14188 uselongdouble='$uselongdouble'
14189 usemorebits='$usemorebits'
14190 usemultiplicity='$usemultiplicity'
14191 usemymalloc='$usemymalloc'
14192 usenm='$usenm'
14193 useopcode='$useopcode'
14194 useperlio='$useperlio'
14195 useposix='$useposix'
14196 usesfio='$usesfio'
14197 useshrplib='$useshrplib'
14198 usesocks='$usesocks'
14199 usethreads='$usethreads'
14200 usevendorprefix='$usevendorprefix'
14201 usevfork='$usevfork'
14202 usrinc='$usrinc'
14203 uuname='$uuname'
14204 vendorbin='$vendorbin'
14205 vendorbinexp='$vendorbinexp'
14206 vendorlib='$vendorlib'
14207 vendorlibexp='$vendorlibexp'
14208 vendorprefix='$vendorprefix'
14209 vendorprefixexp='$vendorprefixexp'
14210 version='$version'
14211 vi='$vi'
14212 voidflags='$voidflags'
14213 xlibpth='$xlibpth'
14214 xs_apiversion='$xs_apiversion'
14215 zcat='$zcat'
14216 zip='$zip'
14217 EOT
14218
14219 : Add in command line options if available
14220 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
14221
14222 : add special variables
14223 $test -f $src/patchlevel.h && \
14224 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
14225 echo "CONFIGDOTSH=true" >>config.sh
14226
14227 : propagate old symbols
14228 if $test -f UU/config.sh; then
14229         <UU/config.sh sort | uniq >UU/oldconfig.sh
14230         sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
14231         sort | uniq -u >UU/oldsyms
14232         set X `cat UU/oldsyms`
14233         shift
14234         case $# in
14235         0) ;;
14236         *)
14237                 cat <<EOM
14238 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
14239 EOM
14240                 echo "# Variables propagated from previous config.sh file." >>config.sh
14241                 for sym in `cat UU/oldsyms`; do
14242                         echo "    Propagating $hint variable "'$'"$sym..."
14243                         eval 'tmp="$'"${sym}"'"'
14244                         echo "$tmp" | \
14245                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
14246                 done
14247                 ;;
14248         esac
14249 fi
14250
14251 : Finish up by extracting the .SH files
14252 case "$alldone" in
14253 exit)
14254         $rm -rf UU
14255         echo "Done."
14256         exit 0
14257         ;;
14258 cont)
14259         ;;
14260 '')
14261         dflt=''
14262         nostick=true
14263         $cat <<EOM
14264
14265 If you'd like to make any changes to the config.sh file before I begin
14266 to configure things, do it as a shell escape now (e.g. !vi config.sh).
14267
14268 EOM
14269         rp="Press return or use a shell escape to edit config.sh:"
14270         . UU/myread
14271         nostick=''
14272         case "$ans" in
14273         '') ;;
14274         *) : in case they cannot read
14275                 sh 1>&4 -c "$ans";;
14276         esac
14277         ;;
14278 esac
14279
14280 : if this fails, just run all the .SH files by hand
14281 . ./config.sh
14282
14283 echo " "
14284 exec 1>&4
14285 . ./UU/extract
14286
14287 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
14288         dflt=y
14289         case "$silent" in
14290         true) ;;
14291         *)
14292                 $cat <<EOM
14293
14294 Now you need to generate make dependencies by running "$make depend".
14295 You might prefer to run it in background: "$make depend > makedepend.out &"
14296 It can take a while, so you might not want to run it right now.
14297
14298 EOM
14299                 ;;
14300         esac
14301         rp="Run $make depend now?"
14302         . UU/myread
14303         case "$ans" in
14304         y*)
14305                 $make depend && echo "Now you must run a $make."
14306                 ;;
14307         *)
14308                 echo "You must run '$make depend' then '$make'."
14309                 ;;
14310         esac
14311 elif test -f [Mm]akefile; then
14312         echo " "
14313         echo "Now you must run a $make."
14314 else
14315         echo "Done."
14316 fi
14317
14318 if $test -f Policy.sh; then
14319     $cat <<EOM
14320
14321 If you compile $package on a different machine or from a different object
14322 directory, copy the Policy.sh file from this object directory to the
14323 new one before you run Configure -- this will help you with most of
14324 the policy defaults.
14325
14326 EOM
14327 fi
14328 if $test -f config.msg; then
14329     echo "Hmm.  I also noted the following information while running:"
14330     echo " "
14331     $cat config.msg >&4
14332     $rm -f config.msg
14333 fi
14334 $rm -f kit*isdone ark*isdone
14335 $rm -rf UU
14336
14337 : End of Configure
14338