add workaround for dlopen() bug on OpenBSD (relative paths that
[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 Dec 22 14:18:58 EST 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 charsize=''
302 contains=''
303 cpp_stuff=''
304 cpplast=''
305 cppminus=''
306 cpprun=''
307 cppstdin=''
308 crosscompile=''
309 d_access=''
310 d_accessx=''
311 d_alarm=''
312 d_attribut=''
313 d_bcmp=''
314 d_bcopy=''
315 d_bzero=''
316 d_casti32=''
317 castflags=''
318 d_castneg=''
319 d_chown=''
320 d_chroot=''
321 d_chsize=''
322 d_closedir=''
323 d_void_closedir=''
324 d_const=''
325 cryptlib=''
326 d_crypt=''
327 d_csh=''
328 full_csh=''
329 d_cuserid=''
330 d_dbl_dig=''
331 d_difftime=''
332 d_dlerror=''
333 d_dlopen=''
334 d_dlsymun=''
335 d_dosuid=''
336 d_suidsafe=''
337 d_drand48proto=''
338 d_dup2=''
339 d_eaccess=''
340 d_endgrent=''
341 d_endhent=''
342 d_endnent=''
343 d_endpent=''
344 d_endpwent=''
345 d_endsent=''
346 d_endspent=''
347 d_fchmod=''
348 d_fchown=''
349 d_fcntl=''
350 d_fd_macros=''
351 d_fd_set=''
352 d_fds_bits=''
353 d_fgetpos=''
354 d_flexfnam=''
355 d_flock=''
356 d_fork=''
357 d_fs_data_s=''
358 d_fseeko=''
359 d_fsetpos=''
360 d_fstatfs=''
361 d_ftello=''
362 d_ftime=''
363 d_gettimeod=''
364 d_Gconvert=''
365 d_getgrent=''
366 d_getgrps=''
367 d_gethbyaddr=''
368 d_gethbyname=''
369 d_gethent=''
370 aphostname=''
371 d_gethname=''
372 d_phostname=''
373 d_uname=''
374 d_gethostprotos=''
375 d_getlogin=''
376 d_getmnt=''
377 d_getmntent=''
378 d_getnbyaddr=''
379 d_getnbyname=''
380 d_getnent=''
381 d_getnetprotos=''
382 d_getpent=''
383 d_getpgid=''
384 d_getpgrp2=''
385 d_bsdgetpgrp=''
386 d_getpgrp=''
387 d_getppid=''
388 d_getprior=''
389 d_getpbyname=''
390 d_getpbynumber=''
391 d_getprotoprotos=''
392 d_getpwent=''
393 d_getsent=''
394 d_getservprotos=''
395 d_getspent=''
396 d_getspnam=''
397 d_getsbyname=''
398 d_getsbyport=''
399 d_gnulibc=''
400 d_hasmntopt=''
401 d_htonl=''
402 d_inetaton=''
403 d_int64t=''
404 d_isascii=''
405 d_killpg=''
406 d_lchown=''
407 d_ldbl_dig=''
408 d_link=''
409 d_locconv=''
410 d_lockf=''
411 d_longdbl=''
412 longdblsize=''
413 d_longlong=''
414 longlongsize=''
415 d_lstat=''
416 d_mblen=''
417 d_mbstowcs=''
418 d_mbtowc=''
419 d_memchr=''
420 d_memcmp=''
421 d_memcpy=''
422 d_memmove=''
423 d_memset=''
424 d_mkdir=''
425 d_mkfifo=''
426 d_mktime=''
427 d_msg=''
428 d_msgctl=''
429 d_msgget=''
430 d_msgrcv=''
431 d_msgsnd=''
432 d_nice=''
433 d_open3=''
434 d_fpathconf=''
435 d_pathconf=''
436 d_pause=''
437 d_pipe=''
438 d_poll=''
439 d_portable=''
440 d_old_pthread_create_joinable=''
441 old_pthread_create_joinable=''
442 d_pthread_yield=''
443 d_sched_yield=''
444 sched_yield=''
445 d_readdir=''
446 d_rewinddir=''
447 d_seekdir=''
448 d_telldir=''
449 d_readlink=''
450 d_rename=''
451 d_rmdir=''
452 d_safebcpy=''
453 d_safemcpy=''
454 d_sanemcmp=''
455 d_select=''
456 d_sem=''
457 d_semctl=''
458 d_semget=''
459 d_semop=''
460 d_setegid=''
461 d_seteuid=''
462 d_setgrent=''
463 d_setgrps=''
464 d_sethent=''
465 d_setlinebuf=''
466 d_setlocale=''
467 d_setnent=''
468 d_setpent=''
469 d_setpgid=''
470 d_setpgrp2=''
471 d_bsdsetpgrp=''
472 d_setpgrp=''
473 d_setprior=''
474 d_setpwent=''
475 d_setregid=''
476 d_setresgid=''
477 d_setresuid=''
478 d_setreuid=''
479 d_setrgid=''
480 d_setruid=''
481 d_setsent=''
482 d_setsid=''
483 d_setspent=''
484 d_setvbuf=''
485 d_sfio=''
486 usesfio=''
487 d_shm=''
488 d_shmat=''
489 d_shmatprototype=''
490 shmattype=''
491 d_shmctl=''
492 d_shmdt=''
493 d_shmget=''
494 d_sigaction=''
495 d_sigsetjmp=''
496 d_msg_ctrunc=''
497 d_msg_dontroute=''
498 d_msg_oob=''
499 d_msg_peek=''
500 d_msg_proxy=''
501 d_oldsock=''
502 d_scm_rights=''
503 d_socket=''
504 d_sockpair=''
505 sockethdr=''
506 socketlib=''
507 d_sqrtl=''
508 d_statblks=''
509 d_statfs_f_flags=''
510 d_statfs_s=''
511 d_fstatvfs=''
512 d_statvfs=''
513 d_stdio_cnt_lval=''
514 d_stdio_ptr_lval=''
515 d_stdiobase=''
516 d_stdstdio=''
517 stdio_base=''
518 stdio_bufsiz=''
519 stdio_cnt=''
520 stdio_filbuf=''
521 stdio_ptr=''
522 d_index=''
523 d_strchr=''
524 d_strcoll=''
525 d_strctcpy=''
526 d_strerrm=''
527 d_strerror=''
528 d_sysernlst=''
529 d_syserrlst=''
530 d_strtod=''
531 d_strtol=''
532 d_strtoul=''
533 d_strxfrm=''
534 d_symlink=''
535 d_syscall=''
536 d_sysconf=''
537 d_system=''
538 d_tcgetpgrp=''
539 d_tcsetpgrp=''
540 d_telldirproto=''
541 d_time=''
542 timetype=''
543 clocktype=''
544 d_times=''
545 d_truncate=''
546 d_tzname=''
547 d_umask=''
548 d_semctl_semid_ds=''
549 d_semctl_semun=''
550 d_union_semun=''
551 d_ustat=''
552 d_vfork=''
553 usevfork=''
554 d_voidsig=''
555 signal_t=''
556 d_volatile=''
557 d_charvspr=''
558 d_vprintf=''
559 d_wait4=''
560 d_waitpid=''
561 d_wcstombs=''
562 d_wctomb=''
563 dlext=''
564 cccdlflags=''
565 ccdlflags=''
566 dlsrc=''
567 ld=''
568 lddlflags=''
569 usedl=''
570 doublesize=''
571 ebcdic=''
572 fflushNULL=''
573 fflushall=''
574 fpossize=''
575 fpostype=''
576 gidformat=''
577 gidsign=''
578 gidsize=''
579 gidtype=''
580 groupstype=''
581 h_fcntl=''
582 h_sysfile=''
583 i_arpainet=''
584 db_hashtype=''
585 db_prefixtype=''
586 i_db=''
587 i_dbm=''
588 i_rpcsvcdbm=''
589 d_dirnamlen=''
590 direntrytype=''
591 i_dirent=''
592 i_dld=''
593 i_dlfcn=''
594 i_fcntl=''
595 i_float=''
596 i_gdbm=''
597 d_grpasswd=''
598 i_grp=''
599 i_inttypes=''
600 i_limits=''
601 i_locale=''
602 i_machcthr=''
603 i_malloc=''
604 i_math=''
605 i_memory=''
606 i_mntent=''
607 i_ndbm=''
608 i_netdb=''
609 i_neterrno=''
610 i_netinettcp=''
611 i_niin=''
612 i_sysin=''
613 i_poll=''
614 i_pthread=''
615 d_pwage=''
616 d_pwchange=''
617 d_pwclass=''
618 d_pwcomment=''
619 d_pwexpire=''
620 d_pwgecos=''
621 d_pwpasswd=''
622 d_pwquota=''
623 i_pwd=''
624 i_sfio=''
625 i_shadow=''
626 i_socks=''
627 i_stddef=''
628 i_stdlib=''
629 i_string=''
630 strings=''
631 i_sysaccess=''
632 i_sysdir=''
633 i_sysfile=''
634 d_voidtty=''
635 i_bsdioctl=''
636 i_sysfilio=''
637 i_sysioctl=''
638 i_syssockio=''
639 i_sysmount=''
640 i_sysndir=''
641 i_sysparam=''
642 i_sysresrc=''
643 i_syssecrt=''
644 i_sysselct=''
645 i_sysstat=''
646 i_sysstatfs=''
647 i_sysstatvfs=''
648 i_systimes=''
649 i_systypes=''
650 i_sysuio=''
651 i_sysun=''
652 i_sysvfs=''
653 i_syswait=''
654 i_sgtty=''
655 i_termio=''
656 i_termios=''
657 i_systime=''
658 i_systimek=''
659 i_time=''
660 timeincl=''
661 i_unistd=''
662 i_ustat=''
663 i_utime=''
664 i_values=''
665 i_stdarg=''
666 i_varargs=''
667 i_varhdr=''
668 i_vfork=''
669 installprefix=''
670 installprefixexp=''
671 installstyle=''
672 installusrbinperl=''
673 intsize=''
674 longsize=''
675 shortsize=''
676 d_fpos64_t=''
677 d_off64_t=''
678 libc=''
679 ldlibpthname=''
680 libperl=''
681 shrpenv=''
682 useshrplib=''
683 glibpth=''
684 libpth=''
685 loclibpth=''
686 plibpth=''
687 xlibpth=''
688 ignore_versioned_solibs=''
689 libs=''
690 lns=''
691 d_PRIEldbl=''
692 d_PRIFldbl=''
693 d_PRIGldbl=''
694 d_PRIeldbl=''
695 d_PRIfldbl=''
696 d_PRIgldbl=''
697 sPRIEldbl=''
698 sPRIFldbl=''
699 sPRIGldbl=''
700 sPRIeldbl=''
701 sPRIfldbl=''
702 sPRIgldbl=''
703 lseeksize=''
704 lseektype=''
705 make_set_make=''
706 d_mymalloc=''
707 freetype=''
708 mallocobj=''
709 mallocsrc=''
710 malloctype=''
711 usemymalloc=''
712 installman1dir=''
713 man1dir=''
714 man1direxp=''
715 man1ext=''
716 installman3dir=''
717 man3dir=''
718 man3direxp=''
719 man3ext=''
720 huge=''
721 large=''
722 medium=''
723 models=''
724 small=''
725 split=''
726 modetype=''
727 multiarch=''
728 mydomain=''
729 myhostname=''
730 phostname=''
731 c=''
732 n=''
733 d_eofnblk=''
734 eagain=''
735 o_nonblock=''
736 rd_nodata=''
737 netdb_hlen_type=''
738 netdb_host_type=''
739 netdb_name_type=''
740 netdb_net_type=''
741 groupcat=''
742 hostcat=''
743 passcat=''
744 orderlib=''
745 ranlib=''
746 package=''
747 spackage=''
748 pager=''
749 apiversion=''
750 patchlevel=''
751 subversion=''
752 version=''
753 perladmin=''
754 perlpath=''
755 i16size=''
756 i16type=''
757 i32size=''
758 i32type=''
759 i64size=''
760 i64type=''
761 i8size=''
762 i8type=''
763 ivsize=''
764 ivtype=''
765 nvsize=''
766 nvtype=''
767 u16size=''
768 u16type=''
769 u32size=''
770 u32type=''
771 u64size=''
772 u64type=''
773 u8size=''
774 u8type=''
775 uvsize=''
776 uvtype=''
777 ivdformat=''
778 uvoformat=''
779 uvuformat=''
780 uvxformat=''
781 pidtype=''
782 prefix=''
783 prefixexp=''
784 installprivlib=''
785 privlib=''
786 privlibexp=''
787 prototype=''
788 ptrsize=''
789 d_PRIX64=''
790 d_PRId64=''
791 d_PRIi64=''
792 d_PRIo64=''
793 d_PRIu64=''
794 d_PRIx64=''
795 sPRIX64=''
796 sPRId64=''
797 sPRIi64=''
798 sPRIo64=''
799 sPRIu64=''
800 sPRIx64=''
801 d_quad=''
802 quadkind=''
803 quadtype=''
804 uquadtype=''
805 drand01=''
806 randbits=''
807 randfunc=''
808 randseedtype=''
809 seedfunc=''
810 installscript=''
811 scriptdir=''
812 scriptdirexp=''
813 selectminbits=''
814 selecttype=''
815 sh=''
816 sig_count=''
817 sig_name=''
818 sig_name_init=''
819 sig_num=''
820 sig_num_init=''
821 installsitearch=''
822 sitearch=''
823 sitearchexp=''
824 installsitebin=''
825 sitebin=''
826 sitebinexp=''
827 installsitelib=''
828 sitelib=''
829 sitelibexp=''
830 siteprefix=''
831 siteprefixexp=''
832 sizetype=''
833 so=''
834 sharpbang=''
835 shsharp=''
836 spitshell=''
837 src=''
838 ssizetype=''
839 startperl=''
840 startsh=''
841 stdchar=''
842 d_stdio_stream_array=''
843 stdio_stream_array=''
844 d_strtoull=''
845 sysman=''
846 trnl=''
847 uidformat=''
848 uidsign=''
849 uidsize=''
850 uidtype=''
851 archname64=''
852 use64bits=''
853 uselargefiles=''
854 uselongdouble=''
855 uselonglong=''
856 usemorebits=''
857 usemultiplicity=''
858 nm_opt=''
859 nm_so_opt=''
860 runnm=''
861 usenm=''
862 useperlio=''
863 usesocks=''
864 d_oldpthreads=''
865 usethreads=''
866 incpath=''
867 mips_type=''
868 usrinc=''
869 d_vendorbin=''
870 installvendorbin=''
871 vendorbin=''
872 vendorbinexp=''
873 d_vendorlib=''
874 installvendorlib=''
875 vendorlib=''
876 vendorlibexp=''
877 usevendorprefix=''
878 vendorprefix=''
879 vendorprefixexp=''
880 defvoidused=''
881 voidflags=''
882 pm_apiversion=''
883 xs_apiversion=''
884 CONFIG=''
885
886 define='define'
887 undef='undef'
888 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
889 rmlist=''
890
891 : We must find out about Eunice early
892 eunicefix=':'
893 if test -f /etc/unixtovms; then
894         eunicefix=/etc/unixtovms
895 fi
896 if test -f /etc/unixtovms.exe; then
897         eunicefix=/etc/unixtovms.exe
898 fi
899
900 i_whoami=''
901 : Possible local include directories to search.
902 : Set locincpth to "" in a hint file to defeat local include searches.
903 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
904 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
905 :
906 : no include file wanted by default
907 inclwanted=''
908
909 : list of known cpp symbols, sorted alphabetically
910 al="AMIX BIT_MSF BSD BSD4_3 BSD_NET2 CMU CRAY DGUX DOLPHIN DPX2"
911 al="$al GO32 GOULD_PN HP700 I386 I80960 I960 Lynx M68000 M68K MACH"
912 al="$al MIPSEB MIPSEL MSDOS MTXINU MULTIMAX MVS"
913 al="$al M_COFF M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM"
914 al="$al M_SYS3 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX"
915 al="$al NeXT OCS88 OSF1 PARISC PC532 PORTAR POSIX"
916 al="$al PWB R3000 RES RISC6000 RT Sun386i SVR3 SVR4 SVR5"
917 al="$al SYSTYPE_BSD SYSTYPE_SVR4 SYSTYPE_SYSV Tek4132 Tek4300"
918 al="$al UMAXV USGr4 USGr4_2 UTEK UTS UTek UnicomPBB UnicomPBD Utek"
919 al="$al VMS Xenix286"
920 al="$al _AIX _AIX32 _AIX370 _AIX41 _AM29000 _COFF _CRAY _CX_UX _EPI"
921 al="$al _IBMESA _IBMR2 _M88K _M88KBCS_TARGET _POWER"
922 al="$al _MIPSEB _MIPSEL _M_COFF _M_I86 _M_I86SM _M_SYS3"
923 al="$al _M_SYS5 _M_SYSIII _M_SYSV _M_UNIX _M_XENIX _NLS _PGC_ _R3000"
924 al="$al _SYSTYPE_BSD _SYSTYPE_BSD43 _SYSTYPE_SVR4"
925 al="$al _SYSTYPE_SYSV _SYSV3 _U370 _UNICOS"
926 al="$al __386BSD__ __BIG_ENDIAN __BIG_ENDIAN__ __BSD_4_4__"
927 al="$al __DGUX__ __DPX2__ __H3050R __H3050RX"
928 al="$al __LITTLE_ENDIAN __LITTLE_ENDIAN__ __MACH__"
929 al="$al __MIPSEB __MIPSEB__ __MIPSEL __MIPSEL__"
930 al="$al __Next__ __OSF1__ __PARAGON__ __PGC__ __PWB __STDC__"
931 al="$al __SVR4_2__ __UMAXV__"
932 al="$al ____386BSD____ __alpha __alpha__ __amiga"
933 al="$al __bsd4_2 __bsd4_2__ __bsdi__ __convex__"
934 al="$al __host_mips__"
935 al="$al __hp9000s200 __hp9000s300 __hp9000s400 __hp9000s500"
936 al="$al __hp9000s500 __hp9000s700 __hp9000s800"
937 al="$al __hppa __hpux __hp_osf __i286 __i286__ __i386 __i386__"
938 al="$al __i486 __i486__ __i860 __i860__ __ibmesa __ksr1__ __linux__"
939 al="$al __m68k __m68k__ __m88100__ __m88k __m88k__"
940 al="$al __mc68000 __mc68000__ __mc68020 __mc68020__"
941 al="$al __mc68030 __mc68030__ __mc68040 __mc68040__"
942 al="$al __mc88100 __mc88100__ __mips __mips__"
943 al="$al __motorola__ __osf__ __pa_risc __sparc__ __stdc__"
944 al="$al __sun __sun__ __svr3__ __svr4__ __ultrix __ultrix__"
945 al="$al __unix __unix__ __uxpm__ __uxps__ __vax __vax__"
946 al="$al _host_mips _mips _unix"
947 al="$al a29k aegis aix aixpc alliant alpha am29000 amiga ansi ardent"
948 al="$al apollo ardent att386 att3b"
949 al="$al bsd bsd43 bsd4_2 bsd4_3 bsd4_4 bsdi bull"
950 al="$al cadmus clipper concurrent convex cray ctix"
951 al="$al dmert encore gcos gcx gimpel gould"
952 al="$al hbullx20 hcx host_mips hp200 hp300 hp700 hp800"
953 al="$al hp9000 hp9000s300 hp9000s400 hp9000s500"
954 al="$al hp9000s700 hp9000s800 hp9k8 hppa hpux"
955 al="$al i186 i286 i386 i486 i8086"
956 al="$al i80960 i860 iAPX286 ibm ibm032 ibmrt interdata is68k"
957 al="$al ksr1 linux luna luna88k m68k m88100 m88k"
958 al="$al mc300 mc500 mc68000 mc68010 mc68020 mc68030"
959 al="$al mc68040 mc68060 mc68k mc68k32 mc700"
960 al="$al mc88000 mc88100 merlin mert mips mvs n16"
961 al="$al ncl_el ncl_mr"
962 al="$al news1500 news1700 news1800 news1900 news3700"
963 al="$al news700 news800 news900 ns16000 ns32000"
964 al="$al ns32016 ns32332 ns32k nsc32000 os osf"
965 al="$al parisc pc532 pdp11 plexus posix pyr"
966 al="$al riscix riscos scs sequent sgi sinix sony sony_news"
967 al="$al sonyrisc sparc sparclite spectrum stardent stratos"
968 al="$al sun sun3 sun386 svr4 sysV68 sysV88"
969 al="$al titan tower tower32 tower32_200 tower32_600 tower32_700"
970 al="$al tower32_800 tower32_850 tss u370 u3b u3b2 u3b20 u3b200"
971 al="$al u3b20d u3b5 ultrix unix unixpc unos vax venix vms"
972 al="$al xenix z8000"
973
974 : Trailing extension.  Override this in a hint file, if needed.
975 _exe=''
976 : Extra object files, if any, needed on this platform.
977 archobjs=''
978 groupstype=''
979 : change the next line if compiling for Xenix/286 on Xenix/386
980 xlibpth='/usr/lib/386 /lib/386'
981
982 : Possible local library directories to search.
983 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
984 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
985
986 : general looking path for locating libraries
987 glibpth="/shlib /usr/shlib /lib/pa1.1 /usr/lib/large"
988 glibpth="$glibpth /lib /usr/lib $xlibpth"
989 glibpth="$glibpth /lib/large /usr/lib/small /lib/small"
990 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
991
992 : Private path used by Configure to find libraries.  Its value
993 : is prepended to libpth. This variable takes care of special
994 : machines, like the mips.  Usually, it should be empty.
995 plibpth=''
996
997 : default library list
998 libswanted=''
999 : some systems want to use only the non-versioned libso:s
1000 ignore_versioned_solibs=''
1001 : full support for void wanted by default
1002 defvoidused=15
1003
1004 : set useposix=false in your hint file to disable the POSIX extension.
1005 useposix=true
1006 : set useopcode=false in your hint file to disable the Opcode extension.
1007 useopcode=true
1008 : set usemultiplicity on the Configure command line to enable multiplicity.
1009 : set usesocks on the Configure command line to enable socks.
1010 : set usethreads on the Configure command line to enable threads.
1011 : List of libraries we want.
1012 : If anyone needs -lnet, put it in a hint file.
1013 libswanted='sfio socket inet nsl nm ndbm gdbm dbm db malloc dl'
1014 libswanted="$libswanted dld ld sun m c cposix posix"
1015 libswanted="$libswanted ndir dir crypt sec"
1016 libswanted="$libswanted ucb bsd BSD PW x"
1017 : We probably want to search /usr/shlib before most other libraries.
1018 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1019 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1020 glibpth="/usr/shlib $glibpth"
1021 : Do not use vfork unless overridden by a hint file.
1022 usevfork=false
1023
1024 : Find the basic shell for Bourne shell scripts
1025 case "$sh" in
1026 '')
1027         case "$SYSTYPE" in
1028         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1029         *) xxx='/bin/sh';;
1030         esac
1031         if test -f "$xxx"; then
1032                 sh="$xxx"
1033         else
1034                 : Build up a list and do a single loop so we can 'break' out.
1035                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1036                 for xxx in sh bash ksh pdksh ash; do
1037                         for p in $pth; do
1038                                 try="$try ${p}/${xxx}"
1039                         done
1040                 done
1041                 for xxx in $try; do
1042                         if test -f "$xxx"; then
1043                                 sh="$xxx";
1044                                 break
1045                         elif test -f "$xxx.exe"; then
1046                                 sh="$xxx";
1047                                 break
1048                         fi
1049                 done
1050         fi
1051         ;;
1052 esac
1053
1054 case "$sh" in
1055 '')     cat <<EOM >&2
1056 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
1057
1058 Usually it's in /bin/sh.  How did you even get this far?
1059 Please contact me (Perl Maintainers) at perlbug@perl.com and 
1060 we'll try to straighten this all out.
1061 EOM
1062         exit 1
1063         ;;
1064 esac
1065
1066 : see if sh knows # comments
1067 if `$sh -c '#' >/dev/null 2>&1`; then
1068         shsharp=true
1069         spitshell=cat
1070         xcat=/bin/cat
1071         test -f $xcat || xcat=/usr/bin/cat
1072         echo "#!$xcat" >try
1073         $eunicefix try
1074         chmod +x try
1075         ./try > today
1076         if test -s today; then
1077                 sharpbang='#!'
1078         else
1079                 echo "#! $xcat" > try
1080                 $eunicefix try
1081                 chmod +x try
1082                 ./try > today
1083                 if test -s today; then
1084                         sharpbang='#! '
1085                 else
1086                         sharpbang=': use '
1087                 fi
1088         fi
1089 else
1090         echo " "
1091         echo "Your $sh doesn't grok # comments--I will strip them later on."
1092         shsharp=false
1093         cd ..
1094         echo "exec grep -v '^[  ]*#'" >spitshell
1095         chmod +x spitshell
1096         $eunicefix spitshell
1097         spitshell=`pwd`/spitshell
1098         cd UU
1099         echo "I presume that if # doesn't work, #! won't work either!"
1100         sharpbang=': use '
1101 fi
1102 rm -f try today
1103
1104 : figure out how to guarantee sh startup
1105 case "$startsh" in
1106 '') startsh=${sharpbang}${sh} ;;
1107 *)
1108 esac
1109 cat >try <<EOSS
1110 $startsh
1111 set abc
1112 test "$?abc" != 1
1113 EOSS
1114
1115 chmod +x try
1116 $eunicefix try
1117 if ./try; then
1118         : echo "Yup, it does."
1119 else
1120         echo "Hmm... '$startsh' does not guarantee sh startup..."
1121         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1122 fi
1123 rm -f try
1124
1125
1126 : Save command line options in file UU/cmdline.opt for later use in
1127 : generating config.sh.
1128 cat > cmdline.opt <<EOSH
1129 # Configure command line arguments.
1130 config_arg0='$0'
1131 config_args='$*'
1132 config_argc=$#
1133 EOSH
1134 argn=1
1135 for arg in "$@"; do
1136         cat >>cmdline.opt <<EOSH
1137 config_arg$argn='$arg'
1138 EOSH
1139         argn=`expr $argn + 1`
1140 done
1141
1142 : produce awk script to parse command line options
1143 cat >options.awk <<'EOF'
1144 BEGIN {
1145         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1146
1147         len = length(optstr);
1148         for (i = 1; i <= len; i++) {
1149                 c = substr(optstr, i, 1);
1150                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1151                 if (a == ":") {
1152                         arg[c] = 1;
1153                         i++;
1154                 }
1155                 opt[c] = 1;
1156         }
1157 }
1158 {
1159         expect = 0;
1160         str = $0;
1161         if (substr(str, 1, 1) != "-") {
1162                 printf("'%s'\n", str);
1163                 next;
1164         }
1165         len = length($0);
1166         for (i = 2; i <= len; i++) {
1167                 c = substr(str, i, 1);
1168                 if (!opt[c]) {
1169                         printf("-%s\n", substr(str, i));
1170                         next;
1171                 }
1172                 printf("-%s\n", c);
1173                 if (arg[c]) {
1174                         if (i < len)
1175                                 printf("'%s'\n", substr(str, i + 1));
1176                         else
1177                                 expect = 1;
1178                         next;
1179                 }
1180         }
1181 }
1182 END {
1183         if (expect)
1184                 print "?";
1185 }
1186 EOF
1187
1188 : process the command line options
1189 set X `for arg in "$@"; do echo "X$arg"; done |
1190         sed -e s/X// | awk -f options.awk`
1191 eval "set $*"
1192 shift
1193 rm -f options.awk
1194
1195 : set up default values
1196 fastread=''
1197 reuseval=false
1198 config_sh=''
1199 alldone=''
1200 error=''
1201 silent=''
1202 extractsh=''
1203 override=''
1204 knowitall=''
1205 rm -f optdef.sh posthint.sh
1206 cat >optdef.sh <<EOS
1207 $startsh
1208 EOS
1209
1210
1211 : option parsing
1212 while test $# -gt 0; do
1213         case "$1" in
1214         -d) shift; fastread=yes;;
1215         -e) shift; alldone=cont;;
1216         -f)
1217                 shift
1218                 cd ..
1219                 if test -r "$1"; then
1220                         config_sh="$1"
1221                 else
1222                         echo "$me: cannot read config file $1." >&2
1223                         error=true
1224                 fi
1225                 cd UU
1226                 shift;;
1227         -h) shift; error=true;;
1228         -r) shift; reuseval=true;;
1229         -s) shift; silent=true; realsilent=true;;
1230         -E) shift; alldone=exit;;
1231         -K) shift; knowitall=true;;
1232         -O) shift; override=true;;
1233         -S) shift; silent=true; extractsh=true;;
1234         -D)
1235                 shift
1236                 case "$1" in
1237                 *=)
1238                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1239                         echo "$me: ignoring -D $1" >&2
1240                         ;;
1241                 *=*) echo "$1" | \
1242                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1243                 *) echo "$1='define'" >> optdef.sh;;
1244                 esac
1245                 shift
1246                 ;;
1247         -U)
1248                 shift
1249                 case "$1" in
1250                 *=) echo "$1" >> optdef.sh;;
1251                 *=*)
1252                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1253                         echo "$me: ignoring -U $1" >&2
1254                         ;;
1255                 *) echo "$1='undef'" >> optdef.sh;;
1256                 esac
1257                 shift
1258                 ;;
1259         -A)
1260             shift
1261             xxx=''
1262             yyy="$1"
1263             zzz=''
1264             uuu=undef
1265             case "$yyy" in
1266             *=*) zzz=`echo $yyy|sed 's!=.*!!'`
1267                  case "$zzz" in
1268                  *:*) zzz='' ;;
1269                  *)   xxx=append
1270                       zzz=" "`echo $yyy|sed 's!^[^=]*=!!'` 
1271                       yyy=`echo $yyy|sed 's!=.*!!'` ;;
1272                  esac
1273                  ;;
1274             esac
1275             case "$xxx" in
1276             '')  case "$yyy" in
1277                  *:*) xxx=`echo $yyy|sed 's!:.*!!'`
1278                       yyy=`echo $yyy|sed 's!^[^:]*:!!'`
1279                       zzz=`echo $yyy|sed 's!^[^=]*=!!'`
1280                       yyy=`echo $yyy|sed 's!=.*!!'` ;;
1281                  *)   xxx=`echo $yyy|sed 's!:.*!!'`
1282                       yyy=`echo $yyy|sed 's!^[^:]*:!!'` ;;
1283                  esac
1284                  ;;       
1285             esac
1286             case "$xxx" in
1287             append)
1288                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1289             clear)
1290                 echo "$yyy=''"                  >> posthint.sh ;;
1291             define)
1292                 case "$zzz" in
1293                 '') zzz=define ;;
1294                 esac
1295                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1296             eval)
1297                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1298             prepend)
1299                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1300             undef)
1301                 case "$zzz" in
1302                 '') zzz="$uuu" ;;
1303                 esac
1304                 echo "$yyy=$zzz"                >> posthint.sh ;;
1305             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1306             esac
1307             ;;
1308         -V) echo "$me generated by metaconfig 3.0 PL70." >&2
1309             exit 0;;
1310         --) break;;
1311         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1312         *) break;;
1313         esac
1314 done
1315
1316 case "$error" in
1317 true)
1318         cat >&2 <<EOM
1319 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1320                  [-U symbol] [-U symbol=] [-A command:symbol...]
1321   -d : use defaults for all answers.
1322   -e : go on without questioning past the production of config.sh.
1323   -f : specify an alternate default configuration file.
1324   -h : print this help message and exit (with an error status).
1325   -r : reuse C symbols value if possible (skips costly nm extraction).
1326   -s : silent mode, only echoes questions and essential information.
1327   -D : define symbol to have some value:
1328          -D symbol         symbol gets the value 'define'
1329          -D symbol=value   symbol gets the value 'value'
1330   -E : stop at the end of questions, after having produced config.sh.
1331   -K : do not use unless you know what you are doing.
1332   -O : let -D and -U override definitions from loaded configuration file.
1333   -S : perform variable substitutions on all .SH files (can mix with -f)
1334   -U : undefine symbol:
1335          -U symbol    symbol gets the value 'undef'
1336          -U symbol=   symbol gets completely empty
1337   -A : manipulate symbol after the platform specific hints have been applied:
1338          -A symbol=value                append " "value to symbol
1339          -A append:symbol=value         append value to symbol
1340          -A define:symbol=value         define symbol to have value
1341          -A clear:symbol                define symbol to be ''
1342          -A define:symbol               define symbol to be 'define'
1343          -A eval:symbol=value           define symbol to be eval of value
1344          -A prepend:symbol=value        prepend value to symbol
1345          -A undef:symbol                define symbol to be 'undef'
1346          -A undef:symbol=               define symbol to be ''
1347   -V : print version number and exit (with a zero status).
1348 EOM
1349         exit 1
1350         ;;
1351 esac
1352
1353 : Sanity checks
1354 case "$fastread$alldone" in
1355 yescont|yesexit) ;;
1356 *)
1357         if test ! -t 0; then
1358                 echo "Say 'sh Configure', not 'sh <Configure'"
1359                 exit 1
1360         fi
1361         ;;
1362 esac
1363
1364 exec 4>&1
1365 case "$silent" in
1366 true) exec 1>/dev/null;;
1367 esac
1368
1369 : run the defines and the undefines, if any, but leave the file out there...
1370 touch optdef.sh
1371 . ./optdef.sh
1372 : create the posthint manipulation script and leave the file out there...
1373 touch posthint.sh
1374
1375 : set package name
1376 package=perl5
1377 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1378 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1379 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1380 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1381 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1382 esac
1383
1384 : Some greps do not return status, grrr.
1385 echo "grimblepritz" >grimble
1386 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1387         contains=contains
1388 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1389         contains=grep
1390 else
1391         contains=contains
1392 fi
1393 rm -f grimble
1394 : the following should work in any shell
1395 case "$contains" in
1396 contains*)
1397         echo " "
1398         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1399         cat >contains <<'EOSS'
1400 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1401 EOSS
1402 chmod +x contains
1403 esac
1404
1405 : Find the path to the source tree
1406 case "$src" in
1407 '') case "$0" in
1408     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1409          case "$src" in
1410          /*)    ;;
1411          *)     src=`cd ../$src && pwd` ;;
1412          esac
1413          ;;
1414     *)   src='.';;
1415     esac;;
1416 esac
1417 case "$src" in
1418 '')     src=/
1419         rsrc=/
1420         ;;
1421 /*) rsrc="$src";;
1422 *) rsrc="../$src";;
1423 esac
1424 if test -f $rsrc/Configure && \
1425         $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1426 then
1427    : found it, so we are ok.
1428 else
1429         rsrc=''
1430         for src in . .. ../.. ../../.. ../../../..; do
1431                 if test -f ../$src/Configure && \
1432                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1433                 then
1434                         rsrc=../$src
1435                         break
1436                 fi
1437         done
1438 fi
1439 case "$rsrc" in
1440 '')
1441         cat <<EOM >&4
1442
1443 Sorry, I can't seem to locate the source dir for $package.  Please start
1444 Configure with an explicit path -- i.e. /some/path/Configure.
1445
1446 EOM
1447         exit 1
1448         ;;
1449 ../.)   rsrc='..';;
1450 *)
1451         echo " "
1452         echo "Sources for $package found in \"$src\"." >&4
1453         ;;
1454 esac
1455
1456 : script used to extract .SH files with variable substitutions
1457 cat >extract <<'EOS'
1458 CONFIGDOTSH=true
1459 echo "Doing variable substitutions on .SH files..."
1460 if test -f $src/MANIFEST; then
1461         set x `awk '{print $1}' <$src/MANIFEST | grep '\.SH$'`
1462 else
1463         echo "(Looking for .SH files under the source directory.)"
1464         set x `(cd $src; find . -name "*.SH" -print)`
1465 fi
1466 shift
1467 case $# in
1468 0) set x `(cd $src; echo *.SH)`; shift;;
1469 esac
1470 if test ! -f $src/$1; then
1471         shift
1472 fi
1473 mkdir_p='
1474 name=$1;
1475 create="";
1476 while test $name; do
1477         if test ! -d "$name"; then
1478                 create="$name $create";
1479                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1480                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1481         else
1482                 name="";
1483         fi;
1484 done;
1485 for file in $create; do
1486         mkdir $file;
1487 done
1488 '
1489 for file in $*; do
1490         case "$src" in
1491         ".")
1492                 case "$file" in
1493                 */*)
1494                         dir=`expr X$file : 'X\(.*\)/'`
1495                         file=`expr X$file : 'X.*/\(.*\)'`
1496                         (cd $dir && . ./$file)
1497                         ;;
1498                 *)
1499                         . ./$file
1500                         ;;
1501                 esac
1502                 ;;
1503         *)
1504                 case "$file" in
1505                 */*)
1506                         dir=`expr X$file : 'X\(.*\)/'`
1507                         file=`expr X$file : 'X.*/\(.*\)'`
1508                         (set x $dir; shift; eval $mkdir_p)
1509                         sh <$src/$dir/$file
1510                         ;;
1511                 *)
1512                         sh <$src/$file
1513                         ;;
1514                 esac
1515                 ;;
1516         esac
1517 done
1518 if test -f $src/config_h.SH; then
1519         if test ! -f config.h; then
1520         : oops, they left it out of MANIFEST, probably, so do it anyway.
1521         . $src/config_h.SH
1522         fi
1523 fi
1524 EOS
1525
1526 : extract files and exit if asked to do so
1527 case "$extractsh" in
1528 true)
1529         case "$realsilent" in
1530         true) ;;
1531         *) exec 1>&4;;
1532         esac
1533         case "$config_sh" in
1534         '') config_sh='config.sh';;
1535         esac
1536         echo " "
1537         echo "Fetching answers from $config_sh..."
1538         cd ..
1539         . $config_sh
1540         test "$override" && . ./optdef.sh
1541         echo " "
1542         . UU/extract
1543         rm -rf UU
1544         echo "Done."
1545         exit 0
1546         ;;
1547 esac
1548
1549 : Eunice requires " " instead of "", can you believe it
1550 echo " "
1551 : Here we go...
1552 echo "Beginning of configuration questions for $package."
1553
1554 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1555
1556 : first determine how to suppress newline on echo command
1557 echo " "
1558 echo "Checking echo to see how to suppress newlines..."
1559 (echo "hi there\c" ; echo " ") >.echotmp
1560 if $contains c .echotmp >/dev/null 2>&1 ; then
1561         echo "...using -n."
1562         n='-n'
1563         c=''
1564 else
1565         cat <<'EOM'
1566 ...using \c
1567 EOM
1568         n=''
1569         c='\c'
1570 fi
1571 echo $n "The star should be here-->$c"
1572 echo '*'
1573 rm -f .echotmp
1574
1575 : Now test for existence of everything in MANIFEST
1576 echo " "
1577 if test -f $rsrc/MANIFEST; then
1578         echo "First let's make sure your kit is complete.  Checking..." >&4
1579         awk '$1 !~ /PACK[A-Z]+/ {print $1}' $rsrc/MANIFEST | split -50
1580         rm -f missing
1581         tmppwd=`pwd`
1582         for filelist in x??; do
1583                 (cd $rsrc; ls `cat $tmppwd/$filelist` >/dev/null 2>>$tmppwd/missing)
1584         done
1585         if test -s missing; then
1586                 cat missing >&4
1587                 cat >&4 <<'EOM'
1588
1589 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1590
1591 You have the option of continuing the configuration process, despite the
1592 distinct possibility that your kit is damaged, by typing 'y'es.  If you
1593 do, don't blame me if something goes wrong.  I advise you to type 'n'o
1594 and contact the author (perlbug@perl.com).
1595
1596 EOM
1597                 echo $n "Continue? [n] $c" >&4
1598                 read ans
1599                 case "$ans" in
1600                 y*)
1601                         echo "Continuing..." >&4
1602                         rm -f missing
1603                         ;;
1604                 *)
1605                         echo "ABORTING..." >&4
1606                         kill $$
1607                         ;;
1608                 esac
1609         else
1610                 echo "Looks good..."
1611         fi
1612 else
1613         echo "There is no MANIFEST file.  I hope your kit is complete !"
1614 fi
1615 rm -f missing x??
1616
1617 echo " "
1618 : Find the appropriate value for a newline for tr
1619 if test -n "$DJGPP"; then
1620        trnl='\012'
1621 fi
1622 if test X"$trnl" = X; then
1623         case "`echo foo|tr '\n' x 2>/dev/null`" in
1624         foox) trnl='\n' ;;
1625         esac
1626 fi
1627 if test X"$trnl" = X; then
1628         case "`echo foo|tr '\012' x 2>/dev/null`" in
1629         foox) trnl='\012' ;;
1630         esac
1631 fi
1632 if test X"$trnl" = X; then
1633         cat <<EOM >&2
1634
1635 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
1636
1637 EOM
1638         exit 1
1639 fi
1640
1641 : compute the number of columns on the terminal for proper question formatting
1642 case "$COLUMNS" in
1643 '') COLUMNS='80';;
1644 esac
1645
1646 : set up the echo used in my read
1647 myecho="case \"\$xxxm\" in
1648 '') echo $n \"\$rp $c\" >&4;;
1649 *) case \"\$rp\" in
1650         '') echo $n \"[\$xxxm] $c\";;
1651         *)
1652                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
1653                         echo \"\$rp\" >&4
1654                         echo $n \"[\$xxxm] $c\" >&4
1655                 else
1656                         echo $n \"\$rp [\$xxxm] $c\" >&4
1657                 fi
1658                 ;;
1659         esac;;
1660 esac"
1661
1662 : now set up to do reads with possible shell escape and default assignment
1663 cat <<EOSC >myread
1664 $startsh
1665 xxxm=\$dflt
1666 $myecho
1667 ans='!'
1668 case "\$fastread" in
1669 yes) case "\$dflt" in
1670         '') ;;
1671         *) ans='';
1672                 case "\$silent-\$rp" in
1673                 true-) ;;
1674                 *) echo " " >&4;;
1675                 esac;;
1676         esac;;
1677 *) case "\$silent" in
1678         true) case "\$rp" in
1679                 '') ans='';;
1680                 esac;;
1681         esac;;
1682 esac
1683 while expr "X\$ans" : "X!" >/dev/null; do
1684         read answ
1685         set x \$xxxm
1686         shift
1687         aok=''; eval "ans=\\"\$answ\\"" && aok=y
1688         case  "\$answ" in
1689         "!")
1690                 sh 1>&4
1691                 echo " "
1692                 $myecho
1693                 ;;
1694         !*)
1695                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
1696                 shift
1697                 sh 1>&4 -c "\$*"
1698                 echo " "
1699                 $myecho
1700                 ;;
1701         "\$ans")
1702                 case "\$ans" in
1703                 \\&*)
1704                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
1705                         shift
1706                         case "\$1" in
1707                         -d)
1708                                 fastread=yes
1709                                 echo "(OK, I'll run with -d after this question.)" >&4
1710                                 ;;
1711                         -*)
1712                                 echo "*** Sorry, \$1 not supported yet." >&4
1713                                 ;;
1714                         esac
1715                         $myecho
1716                         ans=!
1717                         ;;
1718                 esac;;
1719         *)
1720                 case "\$aok" in
1721                 y)
1722                         echo "*** Substitution done -- please confirm."
1723                         xxxm="\$ans"
1724                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
1725                         xxxm="\$ans"
1726                         ans=!
1727                         ;;
1728                 *)
1729                         echo "*** Error -- try again."
1730                         ans=!
1731                         ;;
1732                 esac
1733                 $myecho
1734                 ;;
1735         esac
1736         case "\$ans\$xxxm\$nostick" in
1737         '')
1738                 ans=!
1739                 $myecho
1740                 ;;
1741         esac
1742 done
1743 case "\$ans" in
1744 '') ans="\$xxxm";;
1745 esac
1746 EOSC
1747
1748 : create .config dir to save info across Configure sessions
1749 test -d ../.config || mkdir ../.config
1750 cat >../.config/README <<EOF
1751 This directory created by Configure to save information that should
1752 persist across sessions for $package.
1753
1754 You may safely delete it if you wish.
1755 EOF
1756
1757 : general instructions
1758 needman=true
1759 firsttime=true
1760 user=`(logname) 2>/dev/null`
1761 case "$user" in
1762 '') user=`whoami 2>&1`;;
1763 esac
1764 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
1765         firsttime=false
1766         echo " "
1767         rp='Would you like to see the instructions?'
1768         dflt=n
1769         . ./myread
1770         case "$ans" in
1771         [yY]*) ;;
1772         *) needman=false;;
1773         esac
1774 fi
1775 if $needman; then
1776         cat <<EOH
1777
1778 This installation shell script will examine your system and ask you questions
1779 to determine how the perl5 package should be installed. If you get
1780 stuck on a question, you may use a ! shell escape to start a subshell or
1781 execute a command.  Many of the questions will have default answers in square
1782 brackets; typing carriage return will give you the default.
1783
1784 On some of the questions which ask for file or directory names you are allowed
1785 to use the ~name construct to specify the login directory belonging to "name",
1786 even if you don't have a shell which knows about that.  Questions where this is
1787 allowed will be marked "(~name ok)".
1788
1789 EOH
1790         rp=''
1791         dflt='Type carriage return to continue'
1792         . ./myread
1793         cat <<'EOH'
1794
1795 The prompter used in this script allows you to use shell variables and
1796 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
1797 in the default answer, as if the default line was a set of arguments given to a
1798 script shell.  This means you may also use $* to repeat the whole default line,
1799 so you do not have to re-type everything to add something to the default.
1800
1801 Everytime there is a substitution, you will have to confirm.  If there is an
1802 error (e.g. an unmatched backtick), the default answer will remain unchanged
1803 and you will be prompted again.
1804
1805 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
1806 the questions and use the computed defaults (or the previous answers if there
1807 was already a config.sh file). Type 'Configure -h' for a list of options.
1808 You may also start interactively and then answer '& -d' at any prompt to turn
1809 on the non-interactive behaviour for the remainder of the execution.
1810
1811 EOH
1812         . ./myread
1813         cat <<EOH
1814
1815 Much effort has been expended to ensure that this shell script will run on any
1816 Unix system.  If despite that it blows up on yours, your best bet is to edit
1817 Configure and run it again.  If you can't run Configure for some reason,
1818 you'll have to generate a config.sh file by hand.  Whatever problems you
1819 have, let me (perlbug@perl.com) know how I blew it.
1820
1821 This installation script affects things in two ways:
1822
1823 1) it may do direct variable substitutions on some of the files included
1824    in this kit.
1825 2) it builds a config.h file for inclusion in C programs.  You may edit
1826    any of these files as the need arises after running this script.
1827
1828 If you make a mistake on a question, there is no easy way to back up to it
1829 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
1830 files.  Configure will offer to let you do this before it runs the SH files.
1831
1832 EOH
1833         dflt='Type carriage return to continue'
1834         . ./myread
1835         case "$firsttime" in
1836         true) echo $user >>../.config/instruct;;
1837         esac
1838 fi
1839
1840 : find out where common programs are
1841 echo " "
1842 echo "Locating common programs..." >&4
1843 cat <<EOSC >loc
1844 $startsh
1845 case \$# in
1846 0) exit 1;;
1847 esac
1848 thing=\$1
1849 shift
1850 dflt=\$1
1851 shift
1852 for dir in \$*; do
1853         case "\$thing" in
1854         .)
1855         if test -d \$dir/\$thing; then
1856                 echo \$dir
1857                 exit 0
1858         fi
1859         ;;
1860         *)
1861         for thisthing in \$dir/\$thing; do
1862                 : just loop through to pick last item
1863         done
1864         if test -f \$thisthing; then
1865                 echo \$thisthing
1866                 exit 0
1867         elif test -f \$dir/\$thing.exe; then
1868                 if test -n "$DJGPP"; then
1869                         echo \$dir/\$thing.exe
1870                 else
1871                         : on Eunice apparently
1872                         echo \$dir/\$thing
1873                 fi
1874                 exit 0
1875         fi
1876         ;;
1877         esac
1878 done
1879 echo \$dflt
1880 exit 1
1881 EOSC
1882 chmod +x loc
1883 $eunicefix loc
1884 loclist="
1885 awk
1886 cat
1887 comm
1888 cp
1889 echo
1890 expr
1891 grep
1892 ls
1893 make
1894 mkdir
1895 rm
1896 sed
1897 sort
1898 touch
1899 tr
1900 uniq
1901 "
1902 trylist="
1903 Mcc
1904 ar
1905 byacc
1906 cpp
1907 csh
1908 date
1909 egrep
1910 gzip
1911 less
1912 ln
1913 more
1914 nm
1915 nroff
1916 pg
1917 test
1918 uname
1919 zip
1920 "
1921 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1922 pth="$pth /lib /usr/lib"
1923 for file in $loclist; do
1924         eval xxx=\$$file
1925         case "$xxx" in
1926         /*|?:[\\/]*)
1927                 if test -f "$xxx"; then
1928                         : ok
1929                 else
1930                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
1931                         xxx=`./loc $file $file $pth`
1932                 fi
1933                 ;;
1934         '') xxx=`./loc $file $file $pth`;;
1935         *) xxx=`./loc $xxx $xxx $pth`;;
1936         esac
1937         eval $file=$xxx
1938         eval _$file=$xxx
1939         case "$xxx" in
1940         /*)
1941                 echo $file is in $xxx.
1942                 ;;
1943         ?:[\\/]*)
1944                 echo $file is in $xxx.
1945                 ;;
1946         *)
1947                 echo "I don't know where '$file' is, and my life depends on it." >&4
1948                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
1949                 exit 1
1950                 ;;
1951         esac
1952 done
1953 echo " "
1954 echo "Don't worry if any of the following aren't found..."
1955 say=offhand
1956 for file in $trylist; do
1957         eval xxx=\$$file
1958         case "$xxx" in
1959         /*|?:[\\/]*)
1960                 if test -f "$xxx"; then
1961                         : ok
1962                 else
1963                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
1964                         xxx=`./loc $file $file $pth`
1965                 fi
1966                 ;;
1967         '') xxx=`./loc $file $file $pth`;;
1968         *) xxx=`./loc $xxx $xxx $pth`;;
1969         esac
1970         eval $file=$xxx
1971         eval _$file=$xxx
1972         case "$xxx" in
1973         /*)
1974                 echo $file is in $xxx.
1975                 ;;
1976         ?:[\\/]*)
1977                 echo $file is in $xxx.
1978                 ;;
1979         *)
1980                 echo "I don't see $file out there, $say."
1981                 say=either
1982                 ;;
1983         esac
1984 done
1985 case "$egrep" in
1986 egrep)
1987         echo "Substituting grep for egrep."
1988         egrep=$grep
1989         ;;
1990 esac
1991 case "$ln" in
1992 ln)
1993         echo "Substituting cp for ln."
1994         ln=$cp
1995         ;;
1996 esac
1997 case "$test" in
1998 test)
1999         echo "Hopefully test is built into your sh."
2000         ;;
2001 *)
2002         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2003                 echo "Using the test built into your sh."
2004                 test=test
2005                 _test=test
2006         fi
2007         ;;
2008 esac
2009 case "$echo" in
2010 echo)
2011         echo "Hopefully echo is built into your sh."
2012         ;;
2013 '') ;;
2014 *)
2015         echo " "
2016 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2017         $echo $n "hi there$c" >foo1
2018         echo $n "hi there$c" >foo2
2019         if cmp foo1 foo2 >/dev/null 2>&1; then
2020                 echo "They are compatible.  In fact, they may be identical."
2021         else
2022                 case "$n" in
2023                 '-n') n='' c='\c';;
2024                 *) n='-n' c='';;
2025                 esac
2026                 cat <<FOO
2027 They are not compatible!  You are probably running ksh on a non-USG system.
2028 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2029 have echo built in and we may have to run some Bourne shell scripts.  That
2030 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2031
2032 FOO
2033                 $echo $n "The star should be here-->$c"
2034                 $echo "*"
2035         fi
2036         $rm -f foo1 foo2
2037         ;;
2038 esac
2039
2040 : determine whether symbolic links are supported
2041 echo " "
2042 $touch blurfl
2043 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2044         echo "Symbolic links are supported." >&4
2045         lns="$ln -s"
2046 else
2047         echo "Symbolic links are NOT supported." >&4
2048         lns="$ln"
2049 fi
2050 $rm -f blurfl sym
2051
2052 : see whether [:lower:] and [:upper:] are supported character classes
2053 echo " "
2054 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2055 ABYZ)
2056         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2057         up='[:upper:]'
2058         low='[:lower:]'
2059         ;;
2060 *)      # There is a discontinuity in EBCDIC between 'I' and 'J'
2061         # (0xc9 and 0xd1), therefore that is a nice testing point.
2062         if test "X$up" = X -o "X$low" = X; then
2063             case "`echo IJ | $tr '[I-J]' '[i-j]' 2>/dev/null`" in
2064             ij) up='[A-Z]'
2065                 low='[a-z]'
2066                 ;;
2067             esac
2068         fi
2069         if test "X$up" = X -o "X$low" = X; then
2070             case "`echo IJ | $tr I-J i-j 2>/dev/null`" in
2071             ij) up='A-Z'
2072                 low='a-z'
2073                 ;;
2074             esac
2075         fi
2076         if test "X$up" = X -o "X$low" = X; then
2077             case "`echo IJ | od -x 2>/dev/null`" in
2078             *C9D1*|*c9d1*)
2079                 echo "Hey, this might be EBCDIC." >&4
2080                 if test "X$up" = X -o "X$low" = X; then
2081                     case "`echo IJ | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
2082                     ij) up='[A-IJ-RS-Z]'
2083                         low='[a-ij-rs-z]'
2084                         ;;
2085                     esac
2086                 fi
2087                 if test "X$up" = X -o "X$low" = X; then
2088                     case "`echo IJ | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
2089                     ij) up='A-IJ-RS-Z'
2090                         low='a-ij-rs-z'
2091                         ;;
2092                     esac
2093                 fi
2094                 ;;
2095             esac
2096         fi
2097 esac
2098 case "`echo IJ | $tr \"$up\" \"$low\" 2>/dev/null`" in
2099 ij)
2100     echo "Using $up and $low to convert case." >&4
2101     ;;
2102 *)
2103     echo "I don't know how to translate letters from upper to lower case." >&4
2104     echo "Your tr is not acting any way I know of." >&4
2105     exit 1
2106     ;;
2107 esac
2108 : set up the translation script tr, must be called with ./tr of course
2109 cat >tr <<EOSC
2110 $startsh
2111 case "\$1\$2" in
2112 '[A-Z][a-z]') exec $tr '$up' '$low';;
2113 '[a-z][A-Z]') exec $tr '$low' '$up';;
2114 esac
2115 exec $tr "\$@"
2116 EOSC
2117 chmod +x tr
2118 $eunicefix tr
2119
2120 : Try to determine whether config.sh was made on this system
2121 case "$config_sh" in
2122 '')
2123 myuname=`( ($uname -a) 2>/dev/null || hostname) 2>&1`
2124 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
2125 # because the A-Z/a-z are not consecutive.
2126 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
2127         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
2128 newmyuname="$myuname"
2129 dflt=n
2130 case "$knowitall" in
2131 '')
2132         if test -f ../config.sh; then
2133                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
2134                         eval "`grep myuname= ../config.sh`"
2135                 fi
2136                 if test "X$myuname" = "X$newmyuname"; then
2137                         dflt=y
2138                 fi
2139         fi
2140         ;;
2141 *) dflt=y;;
2142 esac
2143
2144 : Get old answers from old config file if Configure was run on the
2145 : same system, otherwise use the hints.
2146 hint=default
2147 cd ..
2148 if test -f config.sh; then
2149         echo " "
2150         rp="I see a config.sh file.  Shall I use it to set the defaults?"
2151         . UU/myread
2152         case "$ans" in
2153         n*|N*) echo "OK, I'll ignore it."; mv config.sh config.sh.old;;
2154         *)  echo "Fetching default answers from your old config.sh file..." >&4
2155                 tmp_n="$n"
2156                 tmp_c="$c"
2157                 tmp_sh="$sh"
2158                 . ./config.sh
2159                 cp config.sh UU
2160                 n="$tmp_n"
2161                 c="$tmp_c"
2162                 : Older versions did not always set $sh.  Catch re-use of such
2163                 : an old config.sh.
2164                 case "$sh" in
2165                 '') sh="$tmp_sh" ;;
2166                 esac
2167                 hint=previous
2168                 ;;
2169         esac
2170 fi
2171 if test ! -f config.sh; then
2172         $cat <<EOM
2173
2174 First time through, eh?  I have some defaults handy for some systems
2175 that need some extra help getting the Configure answers right:
2176
2177 EOM
2178         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
2179         dflt=''
2180         : Half the following guesses are probably wrong... If you have better
2181         : tests or hints, please send them to perlbug@perl.com
2182         : The metaconfig authors would also appreciate a copy...
2183         $test -f /irix && osname=irix
2184         $test -f /xenix && osname=sco_xenix
2185         $test -f /dynix && osname=dynix
2186         $test -f /dnix && osname=dnix
2187         $test -f /lynx.os && osname=lynxos
2188         $test -f /unicos && osname=unicos && osvers=`$uname -r`
2189         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
2190         $test -f /bin/mips && /bin/mips && osname=mips
2191         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
2192                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
2193         $test -d /usr/apollo/bin && osname=apollo
2194         $test -f /etc/saf/_sactab && osname=svr4
2195         $test -d /usr/include/minix && osname=minix
2196         if $test -d /MachTen -o -d /MachTen_Folder; then
2197                 osname=machten
2198                 if $test -x /sbin/version; then
2199                         osvers=`/sbin/version | $awk '{print $2}' |
2200                         $sed -e 's/[A-Za-z]$//'`
2201                 elif $test -x /usr/etc/version; then
2202                         osvers=`/usr/etc/version | $awk '{print $2}' |
2203                         $sed -e 's/[A-Za-z]$//'`
2204                 else
2205                         osvers="$2.$3"
2206                 fi
2207         fi
2208        $test -f /sys/posix.dll &&
2209                $test -f /usr/bin/what &&
2210                set X `/usr/bin/what /sys/posix.dll` &&
2211                $test "$3" = UWIN &&
2212                osname=uwin &&
2213                osvers="$5"
2214         if $test -f $uname; then
2215                 set X $myuname
2216                 shift
2217
2218                 case "$5" in
2219                 fps*) osname=fps ;;
2220                 mips*)
2221                         case "$4" in
2222                         umips) osname=umips ;;
2223                         *) osname=mips ;;
2224                         esac;;
2225                 [23]100) osname=mips ;;
2226                 next*) osname=next ;;
2227                 i386*)
2228                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
2229                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
2230                                 osname='sco'
2231                                 osvers=$tmp
2232                         elif $test -f /etc/kconfig; then
2233                                 osname=isc
2234                                 if test "$lns" = "$ln -s"; then
2235                                         osvers=4
2236                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
2237                                         osvers=3
2238                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
2239                                         osvers=2
2240                                 fi
2241                         fi
2242                         tmp=''
2243                         ;;
2244                 pc*)
2245                         if test -n "$DJGPP"; then
2246                                 osname=dos
2247                                 osvers=djgpp
2248                         fi
2249                         ;;
2250                 esac
2251
2252                 case "$1" in
2253                 aix) osname=aix
2254                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
2255                         case "$tmp" in
2256                         'not found') osvers="$4"."$3" ;;
2257                         '<3240'|'<>3240') osvers=3.2.0 ;;
2258                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
2259                         '=3250'|'>3250') osvers=3.2.5 ;;
2260                         *) osvers=$tmp;;
2261                         esac
2262                         ;;
2263                 *dc.osx) osname=dcosx
2264                         osvers="$3"
2265                         ;;
2266                 dnix) osname=dnix
2267                         osvers="$3"
2268                         ;;
2269                 domainos) osname=apollo
2270                         osvers="$3"
2271                         ;;
2272                 dgux) osname=dgux 
2273                         osvers="$3"
2274                         ;;
2275                 dynixptx*) osname=dynixptx
2276                         osvers=`echo "$4"|sed 's/^v//'`
2277                         ;;
2278                 freebsd) osname=freebsd 
2279                         osvers="$3" ;;
2280                 genix) osname=genix ;;
2281                 hp*) osname=hpux 
2282                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
2283                         ;;
2284                 irix*) osname=irix
2285                         case "$3" in
2286                         4*) osvers=4 ;;
2287                         5*) osvers=5 ;;
2288                         *)      osvers="$3" ;;
2289                         esac
2290                         ;;
2291                 linux) osname=linux
2292                         case "$3" in
2293                         *)      osvers="$3" ;;
2294                         esac
2295                         ;;
2296                 MiNT) osname=mint
2297                         ;;
2298                 netbsd*) osname=netbsd
2299                         osvers="$3"
2300                         ;;
2301                 news-os) osvers="$3"
2302                         case "$3" in
2303                         4*) osname=newsos4 ;;
2304                         *) osname=newsos ;;
2305                         esac
2306                         ;;
2307                 bsd386) osname=bsd386
2308                         osvers=`$uname -r`
2309                         ;;
2310                 POSIX-BC | posix-bc ) osname=posix-bc
2311                         osvers="$3"
2312                         ;;
2313                 powerux | power_ux | powermax_os | powermaxos | \
2314                 powerunix | power_unix) osname=powerux
2315                         osvers="$3"
2316                         ;;
2317                 next*) osname=next ;;
2318                 solaris) osname=solaris
2319                         case "$3" in
2320                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
2321                         *)      osvers="$3" ;;
2322                         esac
2323                         ;;
2324                 sunos) osname=sunos
2325                         case "$3" in
2326                         5*) osname=solaris
2327                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
2328                         *)      osvers="$3" ;;
2329                         esac
2330                         ;;
2331                 titanos) osname=titanos
2332                         case "$3" in
2333                         1*) osvers=1 ;;
2334                         2*) osvers=2 ;;
2335                         3*) osvers=3 ;;
2336                         4*) osvers=4 ;;
2337                         *)      osvers="$3" ;;
2338                         esac
2339                         ;;
2340                 ultrix) osname=ultrix
2341                         osvers="$3"
2342                         ;;
2343                 osf1|mls+)      case "$5" in
2344                                 alpha)
2345                                         osname=dec_osf
2346                                         osvers=`echo "$3" | sed 's/^[xvt]//'`
2347                                         ;;
2348                         hp*)    osname=hp_osf1  ;;
2349                         mips)   osname=mips_osf1 ;;
2350                         esac
2351                         ;;
2352                 unixware) osname=svr5
2353                         osvers="$4"
2354                         ;;
2355                 uts) osname=uts
2356                         osvers="$3"
2357                         ;;
2358                 qnx) osname=qnx
2359                         osvers="$4"
2360                         ;;
2361                 cygwin*) osname=cygwin
2362                         osvers="$3"
2363                         ;;
2364                 $2) case "$osname" in
2365                         *isc*) ;;
2366                         *freebsd*) ;;
2367                         svr*)
2368                                 : svr4.x or possibly later
2369                                 case "svr$3" in 
2370                                 ${osname}*)
2371                                         osname=svr$3
2372                                         osvers=$4
2373                                         ;;
2374                                 esac
2375                                 case "$osname" in
2376                                 svr4.0)
2377                                         : Check for ESIX
2378                                         if test -f /stand/boot ; then
2379                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
2380                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
2381                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
2382                                                         if test -n "$isesix"; then
2383                                                                 osname=esix4
2384                                                         fi
2385                                                 fi
2386                                         fi
2387                                         ;;
2388                                 esac
2389                                 ;;
2390                         *)      if test -f /etc/systemid; then
2391                                         osname=sco
2392                                         set `echo $3 | $sed 's/\./ /g'` $4
2393                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
2394                                                 osvers=$1.$2.$3
2395                                         elif $test -f $src/hints/sco_$1_$2.sh; then
2396                                                 osvers=$1.$2
2397                                         elif $test -f $src/hints/sco_$1.sh; then
2398                                                 osvers=$1
2399                                         fi
2400                                 else
2401                                         case "$osname" in
2402                                         '') : Still unknown.  Probably a generic Sys V.
2403                                                 osname="sysv"
2404                                                 osvers="$3"
2405                                                 ;;
2406                                         esac
2407                                 fi
2408                                 ;;
2409                         esac
2410                         ;;
2411                 *)      case "$osname" in
2412                         '') : Still unknown.  Probably a generic BSD.
2413                                 osname="$1"
2414                                 osvers="$3"
2415                                 ;;
2416                         esac
2417                         ;;
2418                 esac
2419         else
2420                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
2421                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
2422                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
2423                                 osname=news_os
2424                         fi
2425                         $rm -f UU/kernel.what
2426                 elif test -d c:/.; then
2427                         set X $myuname
2428                         osname=os2
2429                         osvers="$5"
2430                 fi
2431         fi
2432         
2433         : Now look for a hint file osname_osvers, unless one has been
2434         : specified already.
2435         case "$hintfile" in
2436         ''|' ')
2437                 file=`echo "${osname}_${osvers}" | $sed -e 's@\.@_@g' -e 's@_$@@'`
2438                 : Also try without trailing minor version numbers.
2439                 xfile=`echo $file | $sed -e 's@_[^_]*$@@'`
2440                 xxfile=`echo $xfile | $sed -e 's@_[^_]*$@@'`
2441                 xxxfile=`echo $xxfile | $sed -e 's@_[^_]*$@@'`
2442                 xxxxfile=`echo $xxxfile | $sed -e 's@_[^_]*$@@'`
2443                 case "$file" in
2444                 '') dflt=none ;;
2445                 *)  case "$osvers" in
2446                         '') dflt=$file
2447                                 ;;
2448                         *)  if $test -f $src/hints/$file.sh ; then
2449                                         dflt=$file
2450                                 elif $test -f $src/hints/$xfile.sh ; then
2451                                         dflt=$xfile
2452                                 elif $test -f $src/hints/$xxfile.sh ; then
2453                                         dflt=$xxfile
2454                                 elif $test -f $src/hints/$xxxfile.sh ; then
2455                                         dflt=$xxxfile
2456                                 elif $test -f $src/hints/$xxxxfile.sh ; then
2457                                         dflt=$xxxxfile
2458                                 elif $test -f "$src/hints/${osname}.sh" ; then
2459                                         dflt="${osname}"
2460                                 else
2461                                         dflt=none
2462                                 fi
2463                                 ;;
2464                         esac
2465                         ;;
2466                 esac
2467                 if $test -f Policy.sh ; then
2468                         case "$dflt" in
2469                         *Policy*) ;;
2470                         none) dflt="Policy" ;;
2471                         *) dflt="Policy $dflt" ;;
2472                         esac
2473                 fi
2474                 ;;
2475         *)
2476                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
2477                 ;;
2478         esac
2479
2480         if $test -f Policy.sh ; then
2481                 $cat <<EOM
2482
2483 There's also a Policy hint file available, which should make the
2484 site-specific (policy) questions easier to answer.
2485 EOM
2486
2487         fi
2488
2489         $cat <<EOM
2490
2491 You may give one or more space-separated answers, or "none" if appropriate.
2492 A well-behaved OS will have no hints, so answering "none" or just "Policy"
2493 is a good thing.  DO NOT give a wrong version or a wrong OS.
2494
2495 EOM
2496
2497         rp="Which of these apply, if any?"
2498         . UU/myread
2499         tans=$ans
2500         for file in $tans; do
2501                 if $test X$file = XPolicy -a -f Policy.sh; then
2502                         . Policy.sh
2503                         $cat Policy.sh >> UU/config.sh
2504                 elif $test -f $src/hints/$file.sh; then
2505                         . $src/hints/$file.sh
2506                         $cat $src/hints/$file.sh >> UU/config.sh
2507                 elif $test X$tans = X -o X$tans = Xnone ; then
2508                         : nothing
2509                 else
2510                         : Give one chance to correct a possible typo.
2511                         echo "$file.sh does not exist"
2512                         dflt=$file
2513                         rp="hint to use instead?"
2514                         . UU/myread
2515                         for file in $ans; do
2516                                 if $test -f "$src/hints/$file.sh"; then
2517                                         . $src/hints/$file.sh
2518                                         $cat $src/hints/$file.sh >> UU/config.sh
2519                                 elif $test X$ans = X -o X$ans = Xnone ; then
2520                                         : nothing
2521                                 else
2522                                         echo "$file.sh does not exist -- ignored."
2523                                 fi
2524                         done
2525                 fi
2526         done
2527
2528         hint=recommended
2529         : Remember our hint file for later.
2530         if $test -f "$src/hints/$file.sh" ; then
2531                 hintfile="$file"
2532         else
2533                 hintfile=''
2534         fi
2535 fi
2536 cd UU
2537 ;;
2538 *)
2539         echo " "
2540         echo "Fetching default answers from $config_sh..." >&4
2541         tmp_n="$n"
2542         tmp_c="$c"
2543         cd ..
2544         cp $config_sh config.sh 2>/dev/null
2545         chmod +w config.sh
2546         . ./config.sh
2547         cd UU
2548         cp ../config.sh .
2549         n="$tmp_n"
2550         c="$tmp_c"
2551         hint=previous
2552         ;;
2553 esac
2554 test "$override" && . ./optdef.sh
2555 myuname="$newmyuname"
2556
2557 : Restore computed paths
2558 for file in $loclist $trylist; do
2559         eval $file="\$_$file"
2560 done
2561
2562 cat << EOM
2563
2564 Configure uses the operating system name and version to set some defaults.
2565 The default value is probably right if the name rings a bell. Otherwise,
2566 since spelling matters for me, either accept the default or answer "none"
2567 to leave it blank.
2568
2569 EOM
2570 case "$osname" in
2571         ''|' ')
2572                 case "$hintfile" in
2573                 ''|' '|none) dflt=none ;;
2574                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
2575                 esac
2576                 ;;
2577         *) dflt="$osname" ;;
2578 esac
2579 rp="Operating system name?"
2580 . ./myread
2581 case "$ans" in
2582 none)  osname='' ;;
2583 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
2584 esac
2585 echo " "
2586 case "$osvers" in
2587         ''|' ')
2588                 case "$hintfile" in
2589                 ''|' '|none) dflt=none ;;
2590                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
2591                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
2592                         case "$dflt" in
2593                         ''|' ') dflt=none ;;
2594                         esac
2595                         ;;
2596                 esac
2597                 ;;
2598         *) dflt="$osvers" ;;
2599 esac
2600 rp="Operating system version?"
2601 . ./myread
2602 case "$ans" in
2603 none)  osvers='' ;;
2604 *) osvers="$ans" ;;
2605 esac
2606
2607
2608 . ./posthint.sh
2609
2610 : who configured the system
2611 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
2612 cf_by=`(logname) 2>/dev/null`
2613 case "$cf_by" in
2614 "")
2615         cf_by=`(whoami) 2>/dev/null`
2616         case "$cf_by" in
2617         "") cf_by=unknown ;;
2618         esac ;;
2619 esac
2620
2621 : set up the script used to warn in case of inconsistency
2622 cat <<EOS >whoa
2623 $startsh
2624 EOS
2625 cat <<'EOSC' >>whoa
2626 dflt=y
2627 echo " "
2628 echo "*** WHOA THERE!!! ***" >&4
2629 echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
2630 rp="    Keep the $hint value?"
2631 . ./myread
2632 case "$ans" in
2633 y) td=$was; tu=$was;;
2634 esac
2635 EOSC
2636
2637 : function used to set $1 to $val
2638 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
2639 case "$val$was" in
2640 $define$undef) . ./whoa; eval "$var=\$td";;
2641 $undef$define) . ./whoa; eval "$var=\$tu";;
2642 *) eval "$var=$val";;
2643 esac'
2644
2645 cat <<EOM
2646
2647 Perl can be built to take advantage of threads, on some systems.
2648 To do so, Configure must be run with -Dusethreads.
2649
2650 Note that threading is a highly experimental feature, and
2651 some known race conditions still remain.  If you choose to try
2652 it, be very sure to not actually deploy it for production
2653 purposes.  README.threads has more details, and is required
2654 reading if you enable threads.
2655 EOM
2656 case "$usethreads" in
2657 $define|true|[yY]*)     dflt='y';;
2658 *) dflt='n';;
2659 esac
2660 rp='Build a threading Perl?'
2661 . ./myread
2662 case "$ans" in
2663 y|Y)    val="$define" ;;     
2664 *)      val="$undef" ;;
2665 esac
2666 set usethreads
2667 eval $setvar 
2668
2669 case "$d_oldpthreads" in
2670 '')     : Configure tests would be welcome here.  For now, assume undef.
2671         val="$undef" ;;
2672 *)      val="$d_oldpthreads" ;;
2673 esac
2674 set d_oldpthreads
2675 eval $setvar
2676
2677
2678 case "$usethreads" in
2679 "$define"|true|[yY]*)
2680 : Look for a hint-file generated 'call-back-unit'.  If the
2681 : user has specified that a threading perl is to be built,
2682 : we may need to set or change some other defaults.
2683         if $test -f usethreads.cbu; then
2684                 echo "Your platform has some specific hints for threaded builds, using them..."
2685                 . ./usethreads.cbu
2686         else
2687                 $cat <<EOM
2688 (Your platform doesn't have any specific hints for threaded builds.
2689  Assuming POSIX threads, then.)
2690 EOM
2691         fi
2692     ;;
2693 esac
2694
2695 cat <<EOM
2696
2697 Perl can be built so that multiple Perl interpreters can coexist
2698 within the same Perl executable.  To do so, Configure must be run with
2699 -Dusemultiplicity.
2700
2701 Normally you do not need this and you should answer no.
2702
2703 EOM
2704 case "$usemultiplicity" in
2705 $define|true|[yY]*)     dflt='y';;
2706 *) dflt='n';;
2707 esac
2708 rp='Build Perl for multiplicity?'
2709 . ./myread
2710 case "$ans" in
2711 y|Y)    val="$define" ;;     
2712 *)      val="$undef" ;;
2713 esac
2714 set usemultiplicity
2715 eval $setvar 
2716
2717 : determine where manual pages are on this system
2718 echo " "
2719 case "$sysman" in
2720 '') 
2721         syspath='/usr/man/man1 /usr/man/mann /usr/man/manl /usr/man/local/man1'
2722         syspath="$syspath /usr/man/u_man/man1 /usr/share/man/man1"
2723         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
2724         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
2725         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
2726         sysman=`./loc . /usr/man/man1 $syspath`
2727         ;;
2728 esac
2729 if $test -d "$sysman"; then
2730         echo "System manual is in $sysman." >&4
2731 else
2732         echo "Could not find manual pages in source form." >&4
2733 fi
2734
2735 : see what memory models we can support
2736 case "$models" in
2737 '')
2738         $cat >pdp11.c <<'EOP'
2739 int main() {
2740 #ifdef pdp11
2741         exit(0);
2742 #else
2743         exit(1);
2744 #endif
2745 }
2746 EOP
2747         ( cc -o pdp11 pdp11.c ) >/dev/null 2>&1
2748         if $test -f pdp11 && ./pdp11 2>/dev/null; then
2749                 dflt='unsplit split'
2750         else
2751                 tans=`./loc . X /lib/small /lib/large /usr/lib/small /usr/lib/large /lib/medium /usr/lib/medium /lib/huge`
2752                 case "$tans" in
2753                 X) dflt='none';;
2754                 *) if $test -d /lib/small || $test -d /usr/lib/small; then
2755                                 dflt='small'
2756                         else
2757                                 dflt=''
2758                         fi
2759                         if $test -d /lib/medium || $test -d /usr/lib/medium; then
2760                                 dflt="$dflt medium"
2761                         fi
2762                         if $test -d /lib/large || $test -d /usr/lib/large; then
2763                                 dflt="$dflt large"
2764                         fi
2765                         if $test -d /lib/huge || $test -d /usr/lib/huge; then
2766                                 dflt="$dflt huge"
2767                         fi
2768                 esac
2769         fi;;
2770 *) dflt="$models";;
2771 esac
2772 $cat <<EOM
2773  
2774 Some systems have different model sizes.  On most systems they are called
2775 small, medium, large, and huge.  On the PDP11 they are called unsplit and
2776 split.  If your system doesn't support different memory models, say "none".
2777 If you wish to force everything to one memory model, say "none" here and
2778 put the appropriate flags later when it asks you for other cc and ld flags.
2779 Venix systems may wish to put "none" and let the compiler figure things out.
2780 (In the following question multiple model names should be space separated.)
2781
2782 The default for most systems is "none".
2783
2784 EOM
2785 rp="Which memory models are supported?"
2786 . ./myread
2787 models="$ans"
2788
2789 case "$models" in
2790 none)
2791         small=''
2792         medium=''
2793         large=''
2794         huge=''
2795         unsplit=''
2796         split=''
2797         ;;
2798 *split)
2799         case "$split" in
2800         '') if $contains '\-i' $sysman/ld.1 >/dev/null 2>&1 || \
2801                          $contains '\-i' $sysman/cc.1 >/dev/null 2>&1; then
2802                         dflt='-i'
2803                 else
2804                         dflt='none'
2805                 fi;;
2806         *) dflt="$split";;
2807         esac
2808         rp="What flag indicates separate I and D space?"
2809         . ./myread
2810         tans="$ans"
2811         case "$tans" in
2812         none) tans='';;
2813         esac
2814         split="$tans"
2815         unsplit='';;
2816 *large*|*small*|*medium*|*huge*)
2817         case "$models" in
2818         *large*)
2819                 case "$large" in
2820                 '') dflt='-Ml';;
2821                 *) dflt="$large";;
2822                 esac
2823         rp="What flag indicates large model?"
2824         . ./myread
2825         tans="$ans"
2826         case "$tans" in
2827         none) tans='';
2828         esac
2829         large="$tans";;
2830         *) large='';;
2831         esac
2832         case "$models" in
2833         *huge*) case "$huge" in
2834                 '') dflt='-Mh';;
2835                 *) dflt="$huge";;
2836                 esac
2837                 rp="What flag indicates huge model?"
2838                 . ./myread
2839                 tans="$ans"
2840                 case "$tans" in
2841                 none) tans='';
2842                 esac
2843                 huge="$tans";;
2844         *) huge="$large";;
2845         esac
2846         case "$models" in
2847         *medium*) case "$medium" in
2848                 '') dflt='-Mm';;
2849                 *) dflt="$medium";;
2850                 esac
2851                 rp="What flag indicates medium model?"
2852                 . ./myread
2853                 tans="$ans"
2854                 case "$tans" in
2855                 none) tans='';
2856                 esac
2857                 medium="$tans";;
2858         *) medium="$large";;
2859         esac
2860         case "$models" in
2861         *small*) case "$small" in
2862                 '') dflt='none';;
2863                 *) dflt="$small";;
2864                 esac
2865                 rp="What flag indicates small model?"
2866                 . ./myread
2867                 tans="$ans"
2868                 case "$tans" in
2869                 none) tans='';
2870                 esac
2871                 small="$tans";;
2872         *) small='';;
2873         esac
2874         ;;
2875 *)
2876         echo "Unrecognized memory models--you may have to edit Makefile.SH" >&4
2877         ;;
2878 esac
2879 $rm -f pdp11.* pdp11
2880
2881 : make some quick guesses about what we are up against
2882 echo " "
2883 $echo $n "Hmm...  $c"
2884 echo exit 1 >bsd
2885 echo exit 1 >usg
2886 echo exit 1 >v7
2887 echo exit 1 >osf1
2888 echo exit 1 >eunice
2889 echo exit 1 >xenix
2890 echo exit 1 >venix
2891 echo exit 1 >os2
2892 d_bsd="$undef"
2893 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
2894 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
2895 then
2896         echo "Looks kind of like an OSF/1 system, but we'll see..."
2897         echo exit 0 >osf1
2898 elif test `echo abc | tr a-z A-Z` = Abc ; then
2899         xxx=`./loc addbib blurfl $pth`
2900         if $test -f $xxx; then
2901         echo "Looks kind of like a USG system with BSD features, but we'll see..."
2902                 echo exit 0 >bsd
2903                 echo exit 0 >usg
2904         else
2905                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
2906                         echo "Looks kind of like an extended USG system, but we'll see..."
2907                 else
2908                         echo "Looks kind of like a USG system, but we'll see..."
2909                 fi
2910                 echo exit 0 >usg
2911         fi
2912 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
2913         echo "Looks kind of like a BSD system, but we'll see..."
2914         d_bsd="$define"
2915         echo exit 0 >bsd
2916 else
2917         echo "Looks kind of like a Version 7 system, but we'll see..."
2918         echo exit 0 >v7
2919 fi
2920 case "$eunicefix" in
2921 *unixtovms*)
2922         $cat <<'EOI'
2923 There is, however, a strange, musty smell in the air that reminds me of
2924 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
2925 EOI
2926         echo exit 0 >eunice
2927         d_eunice="$define"
2928 : it so happens the Eunice I know will not run shell scripts in Unix format
2929         ;;
2930 *)
2931         echo " "
2932         echo "Congratulations.  You aren't running Eunice."
2933         d_eunice="$undef"
2934         ;;
2935 esac
2936 : Detect OS2.  The p_ variable is set above in the Head.U unit.
2937 case "$p_" in
2938 :) ;;
2939 *)
2940         $cat <<'EOI'
2941 I have the feeling something is not exactly right, however...don't tell me...
2942 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
2943 EOI
2944         echo exit 0 >os2
2945         ;;
2946 esac
2947 if test -f /xenix; then
2948         echo "Actually, this looks more like a XENIX system..."
2949         echo exit 0 >xenix
2950         d_xenix="$define"
2951 else
2952         echo " "
2953         echo "It's not Xenix..."
2954         d_xenix="$undef"
2955 fi
2956 chmod +x xenix
2957 $eunicefix xenix
2958 if test -f /venix; then
2959         echo "Actually, this looks more like a VENIX system..."
2960         echo exit 0 >venix
2961 else
2962         echo " "
2963         if ./xenix; then
2964                 : null
2965         else
2966                 echo "Nor is it Venix..."
2967         fi
2968 fi
2969 chmod +x bsd usg v7 osf1 eunice xenix venix os2
2970 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
2971 $rm -f foo
2972
2973 : see if we need a special compiler
2974 echo " "
2975 if ./usg; then
2976         case "$cc" in
2977         '') case "$Mcc" in
2978                 /*) dflt='Mcc';;
2979                 *) case "$large" in
2980                         -M*) dflt='cc';;
2981                         *)      if $contains '\-M' $sysman/cc.1 >/dev/null 2>&1 ; then
2982                                         if $contains '\-M' $sysman/cpp.1 >/dev/null 2>&1; then
2983                                                 dflt='cc'
2984                                         else
2985                                                 dflt='cc -M'
2986                                         fi
2987                                 else
2988                                         dflt='cc'
2989                                 fi;;
2990                         esac;;
2991                 esac;;
2992         *)  dflt="$cc";;
2993         esac
2994         case "$dflt" in
2995         *M*)    $cat <<'EOM'
2996 On some older systems the default C compiler will not resolve multiple global
2997 references that happen to have the same name.  On some such systems the "Mcc"
2998 command may be used to force these to be resolved.  On other systems a "cc -M"
2999 command is required.  (Note that the -M flag on other systems indicates a
3000 memory model to use!) If you have the Gnu C compiler, you might wish to use
3001 that instead.
3002
3003 EOM
3004         ;;
3005         esac
3006         rp="Use which C compiler?"
3007         . ./myread
3008         cc="$ans"
3009 else
3010         case "$cc" in
3011         '') dflt=cc;;
3012         *) dflt="$cc";;
3013         esac
3014         rp="Use which C compiler?"
3015         . ./myread
3016         cc="$ans"
3017 fi
3018 : Look for a hint-file generated 'call-back-unit'.  Now that the
3019 : user has specified the compiler, we may need to set or change some
3020 : other defaults.
3021 if $test -f cc.cbu; then
3022     . ./cc.cbu
3023 fi
3024 echo " "
3025 echo "Checking for GNU cc in disguise and/or its version number..." >&4
3026 $cat >gccvers.c <<EOM
3027 #include <stdio.h>
3028 int main() {
3029 #ifdef __GNUC__
3030 #ifdef __VERSION__
3031         printf("%s\n", __VERSION__);
3032 #else
3033         printf("%s\n", "1");
3034 #endif
3035 #endif
3036         exit(0);
3037 }
3038 EOM
3039 if $cc -o gccvers gccvers.c; then
3040         gccversion=`./gccvers`
3041         case "$gccversion" in
3042         '') echo "You are not using GNU cc." ;;
3043         *)  echo "You are using GNU cc $gccversion." ;;
3044         esac
3045 else
3046         echo " "
3047         echo "*** WHOA THERE!!! ***" >&4
3048         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
3049         case "$knowitall" in
3050         '')
3051         echo "    You'd better start hunting for one and let me know about it." >&4
3052                 exit 1
3053                 ;;
3054         esac
3055 fi
3056 $rm -f gccvers*
3057 case "$gccversion" in
3058 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
3059 esac
3060
3061 : see how we invoke the C preprocessor
3062 echo " "
3063 echo "Now, how can we feed standard input to your C preprocessor..." >&4
3064 cat <<'EOT' >testcpp.c
3065 #define ABC abc
3066 #define XYZ xyz
3067 ABC.XYZ
3068 EOT
3069 cd ..
3070 if test ! -f cppstdin; then
3071         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
3072                 # AIX cc -E doesn't show the absolute headerfile
3073                 # locations but we'll cheat by using the -M flag.
3074                 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
3075         else
3076                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
3077         fi
3078 else
3079         echo "Keeping your $hint cppstdin wrapper."
3080 fi
3081 chmod 755 cppstdin
3082 wrapper=`pwd`/cppstdin
3083 ok='false'
3084 cd UU
3085
3086 if $test "X$cppstdin" != "X" && \
3087         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
3088         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3089 then
3090         echo "You used to use $cppstdin $cppminus so we'll use that again."
3091         case "$cpprun" in
3092         '') echo "But let's see if we can live without a wrapper..." ;;
3093         *)
3094                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
3095                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3096                 then
3097                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
3098                         ok='true'
3099                 else
3100                         echo "(However, $cpprun $cpplast does not work, let's see...)"
3101                 fi
3102                 ;;
3103         esac
3104 else
3105         case "$cppstdin" in
3106         '') ;;
3107         *)
3108                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
3109                 ;;
3110         esac
3111 fi
3112
3113 if $ok; then
3114         : nothing
3115 elif echo 'Maybe "'"$cc"' -E" will work...'; \
3116         $cc -E <testcpp.c >testcpp.out 2>&1; \
3117         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3118         echo "Yup, it does."
3119         x_cpp="$cc -E"
3120         x_minus='';
3121 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
3122         $cc -E - <testcpp.c >testcpp.out 2>&1; \
3123         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3124         echo "Yup, it does."
3125         x_cpp="$cc -E"
3126         x_minus='-';
3127 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
3128         $cc -P <testcpp.c >testcpp.out 2>&1; \
3129         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3130         echo "Yipee, that works!"
3131         x_cpp="$cc -P"
3132         x_minus='';
3133 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
3134         $cc -P - <testcpp.c >testcpp.out 2>&1; \
3135         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3136         echo "At long last!"
3137         x_cpp="$cc -P"
3138         x_minus='-';
3139 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
3140         $cpp <testcpp.c >testcpp.out 2>&1; \
3141         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3142         echo "It works!"
3143         x_cpp="$cpp"
3144         x_minus='';
3145 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
3146         $cpp - <testcpp.c >testcpp.out 2>&1; \
3147         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3148         echo "Hooray, it works!  I was beginning to wonder."
3149         x_cpp="$cpp"
3150         x_minus='-';
3151 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
3152         $wrapper <testcpp.c >testcpp.out 2>&1; \
3153         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3154         x_cpp="$wrapper"
3155         x_minus=''
3156         echo "Eureka!"
3157 else
3158         dflt=''
3159         rp="No dice.  I can't find a C preprocessor.  Name one:"
3160         . ./myread
3161         x_cpp="$ans"
3162         x_minus=''
3163         $x_cpp <testcpp.c >testcpp.out 2>&1
3164         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3165                 echo "OK, that will do." >&4
3166         else
3167 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
3168                 exit 1
3169         fi
3170 fi
3171
3172 case "$ok" in
3173 false)
3174         cppstdin="$x_cpp"
3175         cppminus="$x_minus"
3176         cpprun="$x_cpp"
3177         cpplast="$x_minus"
3178         set X $x_cpp
3179         shift
3180         case "$1" in
3181         "$cpp")
3182                 echo "Perhaps can we force $cc -E using a wrapper..."
3183                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
3184                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3185                 then
3186                         echo "Yup, we can."
3187                         cppstdin="$wrapper"
3188                         cppminus='';
3189                 else
3190                         echo "Nope, we'll have to live without it..."
3191                 fi
3192                 ;;
3193         esac
3194         case "$cpprun" in
3195         "$wrapper")
3196                 cpprun=''
3197                 cpplast=''
3198                 ;;
3199         esac
3200         ;;
3201 esac
3202
3203 case "$cppstdin" in
3204 "$wrapper"|'cppstdin') ;;
3205 *) $rm -f $wrapper;;
3206 esac
3207 $rm -f testcpp.c testcpp.out
3208
3209 : decide how portable to be.  Allow command line overrides.
3210 case "$d_portable" in
3211 "$undef") ;;
3212 *)      d_portable="$define" ;;
3213 esac
3214
3215 : set up shell script to do ~ expansion
3216 cat >filexp <<EOSS
3217 $startsh
3218 : expand filename
3219 case "\$1" in
3220  ~/*|~)
3221         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3222         ;;
3223  ~*)
3224         if $test -f /bin/csh; then
3225                 /bin/csh -f -c "glob \$1"
3226                 failed=\$?
3227                 echo ""
3228                 exit \$failed
3229         else
3230                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3231                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3232                 if $test ! -d "\$dir"; then
3233                         me=\`basename \$0\`
3234                         echo "\$me: can't locate home directory for: \$name" >&2
3235                         exit 1
3236                 fi
3237                 case "\$1" in
3238                 */*)
3239                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3240                         ;;
3241                 *)
3242                         echo \$dir
3243                         ;;
3244                 esac
3245         fi
3246         ;;
3247 *)
3248         echo \$1
3249         ;;
3250 esac
3251 EOSS
3252 chmod +x filexp
3253 $eunicefix filexp
3254
3255 : now set up to get a file name
3256 cat <<EOS >getfile
3257 $startsh
3258 EOS
3259 cat <<'EOSC' >>getfile
3260 tilde=''
3261 fullpath=''
3262 already=''
3263 skip=''
3264 none_ok=''
3265 exp_file=''
3266 nopath_ok=''
3267 orig_rp="$rp"
3268 orig_dflt="$dflt"
3269 case "$gfpth" in
3270 '') gfpth='.' ;;
3271 esac
3272
3273 case "$fn" in
3274 *\(*)
3275         expr $fn : '.*(\(.*\)).*' | tr ',' $trnl >getfile.ok
3276         fn=`echo $fn | sed 's/(.*)//'`
3277         ;;
3278 esac
3279
3280 case "$fn" in
3281 *:*)
3282         loc_file=`expr $fn : '.*:\(.*\)'`
3283         fn=`expr $fn : '\(.*\):.*'`
3284         ;;
3285 esac
3286
3287 case "$fn" in
3288 *~*) tilde=true;;
3289 esac
3290 case "$fn" in
3291 */*) fullpath=true;;
3292 esac
3293 case "$fn" in
3294 *+*) skip=true;;
3295 esac
3296 case "$fn" in
3297 *n*) none_ok=true;;
3298 esac
3299 case "$fn" in
3300 *e*) exp_file=true;;
3301 esac
3302 case "$fn" in
3303 *p*) nopath_ok=true;;
3304 esac
3305
3306 case "$fn" in
3307 *f*) type='File';;
3308 *d*) type='Directory';;
3309 *l*) type='Locate';;
3310 esac
3311
3312 what="$type"
3313 case "$what" in
3314 Locate) what='File';;
3315 esac
3316
3317 case "$exp_file" in
3318 '')
3319         case "$d_portable" in
3320         "$define") ;;
3321         *) exp_file=true;;
3322         esac
3323         ;;
3324 esac
3325
3326 cd ..
3327 while test "$type"; do
3328         redo=''
3329         rp="$orig_rp"
3330         dflt="$orig_dflt"
3331         case "$tilde" in
3332         true) rp="$rp (~name ok)";;
3333         esac
3334         . UU/myread
3335         if test -f UU/getfile.ok && \
3336                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3337         then
3338                 value="$ans"
3339                 ansexp="$ans"
3340                 break
3341         fi
3342         case "$ans" in
3343         none)
3344                 value=''
3345                 ansexp=''
3346                 case "$none_ok" in
3347                 true) type='';;
3348                 esac
3349                 ;;
3350         *)
3351                 case "$tilde" in
3352                 '') value="$ans"
3353                         ansexp="$ans";;
3354                 *)
3355                         value=`UU/filexp $ans`
3356                         case $? in
3357                         0)
3358                                 if test "$ans" != "$value"; then
3359                                         echo "(That expands to $value on this system.)"
3360                                 fi
3361                                 ;;
3362                         *) value="$ans";;
3363                         esac
3364                         ansexp="$value"
3365                         case "$exp_file" in
3366                         '') value="$ans";;
3367                         esac
3368                         ;;
3369                 esac
3370                 case "$fullpath" in
3371                 true)
3372                         case "$ansexp" in
3373                         /*) value="$ansexp" ;;
3374                         *)
3375                                 redo=true
3376                                 case "$already" in
3377                                 true)
3378                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
3379                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
3380                                         ;;
3381                                 *)
3382                                 echo "Please give a full path name, starting with slash." >&4
3383                                         case "$tilde" in
3384                                         true)
3385                                 echo "Note that using ~name is ok provided it expands well." >&4
3386                                                 already=true
3387                                                 ;;
3388                                         esac
3389                                 esac
3390                                 ;;
3391                         esac
3392                         ;;
3393                 esac
3394                 case "$redo" in
3395                 '')
3396                         case "$type" in
3397                         File)
3398                                 for fp in $gfpth; do
3399                                         if test "X$fp" = X.; then
3400                                             pf="$ansexp"
3401                                         else    
3402                                             pf="$fp/$ansexp"
3403                                         fi
3404                                         if test -f "$pf"; then
3405                                                 type=''
3406                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3407                                         then
3408                                                 echo "($value is not a plain file, but that's ok.)"
3409                                                 type=''
3410                                         fi
3411                                         if test X"$type" = X; then
3412                                             value="$pf"
3413                                             break
3414                                         fi
3415                                 done
3416                                 ;;
3417                         Directory)
3418                                 for fp in $gfpth; do
3419                                         if test "X$fp" = X.; then
3420                                             pf="$ansexp"
3421                                         else    
3422                                             pf="$fp/$ansexp"
3423                                         fi
3424                                         if test -d "$pf"; then
3425                                                 type=''
3426                                                 value="$pf"
3427                                                 break
3428                                         fi
3429                                 done
3430                                 ;;
3431                         Locate)
3432                                 if test -d "$ansexp"; then
3433                                         echo "(Looking for $loc_file in directory $value.)"
3434                                         value="$value/$loc_file"
3435                                         ansexp="$ansexp/$loc_file"
3436                                 fi
3437                                 if test -f "$ansexp"; then
3438                                         type=''
3439                                 fi
3440                                 case "$nopath_ok" in
3441                                 true)   case "$value" in
3442                                         */*) ;;
3443                                         *)      echo "Assuming $value will be in people's path."
3444                                                 type=''
3445                                                 ;;
3446                                         esac
3447                                         ;;
3448                                 esac
3449                                 ;;
3450                         esac
3451
3452                         case "$skip" in
3453                         true) type='';
3454                         esac
3455
3456                         case "$type" in
3457                         '') ;;
3458                         *)
3459                                 if test "$fastread" = yes; then
3460                                         dflt=y
3461                                 else
3462                                         dflt=n
3463                                 fi
3464                                 rp="$what $value doesn't exist.  Use that name anyway?"
3465                                 . UU/myread
3466                                 dflt=''
3467                                 case "$ans" in
3468                                 y*) type='';;
3469                                 *) echo " ";;
3470                                 esac
3471                                 ;;
3472                         esac
3473                         ;;
3474                 esac
3475                 ;;
3476         esac
3477 done
3478 cd UU
3479 ans="$value"
3480 rp="$orig_rp"
3481 dflt="$orig_dflt"
3482 rm -f getfile.ok
3483 test "X$gfpthkeep" != Xy && gfpth=""
3484 EOSC
3485
3486 : What should the include directory be ?
3487 echo " "
3488 $echo $n "Hmm...  $c"
3489 dflt='/usr/include'
3490 incpath=''
3491 mips_type=''
3492 if $test -f /bin/mips && /bin/mips; then
3493         echo "Looks like a MIPS system..."
3494         $cat >usr.c <<'EOCP'
3495 #ifdef SYSTYPE_BSD43
3496 /bsd43
3497 #endif
3498 EOCP
3499         if $cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
3500                 dflt='/bsd43/usr/include'
3501                 incpath='/bsd43'
3502                 mips_type='BSD 4.3'
3503         else
3504                 mips_type='System V'
3505         fi
3506         $rm -f usr.c usr.out
3507         echo "and you're compiling with the $mips_type compiler and libraries."
3508         xxx_prompt=y
3509         echo "exit 0" >mips
3510 else
3511         echo "Doesn't look like a MIPS system."
3512         xxx_prompt=n
3513         echo "exit 1" >mips
3514 fi
3515 chmod +x mips
3516 $eunicefix mips
3517 case "$usrinc" in
3518 '') ;;
3519 *) dflt="$usrinc";;
3520 esac
3521 case "$xxx_prompt" in
3522 y)      fn=d/
3523         echo " "
3524         rp='Where are the include files you want to use?'
3525         . ./getfile
3526         usrinc="$ans"
3527         ;;
3528 *)      usrinc="$dflt"
3529         ;;
3530 esac
3531
3532 : Set private lib path
3533 case "$plibpth" in
3534 '') if ./mips; then
3535                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
3536         fi;;
3537 esac
3538 case "$libpth" in
3539 ' ') dlist='';;
3540 '') dlist="$loclibpth $plibpth $glibpth";;
3541 *) dlist="$libpth";;
3542 esac
3543
3544 : Now check and see which directories actually exist, avoiding duplicates
3545 libpth=''
3546 for xxx in $dlist
3547 do
3548     if $test -d $xxx; then
3549                 case " $libpth " in
3550                 *" $xxx "*) ;;
3551                 *) libpth="$libpth $xxx";;
3552                 esac
3553     fi
3554 done
3555 $cat <<'EOM'
3556
3557 Some systems have incompatible or broken versions of libraries.  Among
3558 the directories listed in the question below, please remove any you
3559 know not to be holding relevant libraries, and add any that are needed.
3560 Say "none" for none.
3561
3562 EOM
3563 case "$libpth" in
3564 '') dflt='none';;
3565 *)
3566         set X $libpth
3567         shift
3568         dflt=${1+"$@"}
3569         ;;
3570 esac
3571 rp="Directories to use for library searches?"
3572 . ./myread
3573 case "$ans" in
3574 none) libpth=' ';;
3575 *) libpth="$ans";;
3576 esac
3577
3578 : compute shared library extension
3579 case "$so" in
3580 '')
3581         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
3582                 dflt='sl'
3583         else
3584                 dflt='so'
3585         fi
3586         ;;
3587 *) dflt="$so";;
3588 esac
3589 $cat <<EOM
3590
3591 On some systems, shared libraries may be available.  Answer 'none' if
3592 you want to suppress searching of shared libraries for the remaining
3593 of this configuration.
3594
3595 EOM
3596 rp='What is the file extension used for shared libraries?'
3597 . ./myread
3598 so="$ans"
3599
3600 : Define several unixisms.
3601 : Hints files or command line option can be used to override them.
3602 : The convoluted testing is in case hints files set either the old
3603 : or the new name.
3604 case "$_exe" in
3605 '')     case "$exe_ext" in
3606     '') ;;
3607         *)      _exe="$exe_ext" ;;
3608         esac
3609         ;;
3610 esac
3611 case "$_a" in
3612 '')     case "$lib_ext" in
3613     '') _a='.a';;
3614         *)      _a="$lib_ext" ;;
3615         esac
3616         ;;
3617 esac
3618 case "$_o" in
3619 '') case "$obj_ext" in
3620         '')     _o='.o';;
3621         *)      _o="$obj_ext";;
3622         esac
3623         ;;
3624 esac
3625 case "$p_" in
3626 '') case "$path_sep" in
3627         '')     p_=':';;
3628         *)      p_="$path_sep";;
3629         esac
3630         ;;
3631 esac
3632 exe_ext=$_exe
3633 lib_ext=$_a
3634 obj_ext=$_o
3635 path_sep=$p_
3636
3637 : Which makefile gets called first.  This is used by make depend.
3638 case "$firstmakefile" in
3639 '') firstmakefile='makefile';;
3640 esac
3641
3642 cat <<EOM
3643
3644 Perl can be built to use the SOCKS proxy protocol library.  To do so,
3645 Configure must be run with -Dusesocks.
3646
3647 Normally you do not need this and you should answer no.
3648
3649 EOM
3650 case "$usesocks" in
3651 $define|true|[yY]*)     dflt='y';;
3652 *) dflt='n';;
3653 esac
3654 rp='Build Perl for SOCKS?'
3655 . ./myread
3656 case "$ans" in
3657 y|Y)    val="$define" ;;     
3658 *)      val="$undef" ;;
3659 esac
3660 set usesocks
3661 eval $setvar
3662
3663 : Looking for optional libraries
3664 echo " "
3665 echo "Checking for optional libraries..." >&4
3666 case "$libs" in
3667 ' '|'') dflt='';;
3668 *) dflt="$libs";;
3669 esac
3670 case "$libswanted" in
3671 '') libswanted='c_s';;
3672 esac
3673 case "$usesocks" in
3674 $define)
3675         libswanted="$libswanted socks5 socks5_sh"
3676         ;;
3677 esac
3678 for thislib in $libswanted; do
3679         
3680         if xxx=`./loc lib$thislib.$so.[0-9]'*' X $libpth`;
3681                 $test -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
3682                 echo "Found -l$thislib (shared)."
3683                 case " $dflt " in
3684                 *"-l$thislib "*);;
3685                 *) dflt="$dflt -l$thislib";;
3686                 esac
3687         elif xxx=`./loc lib$thislib.$so X $libpth` ; $test -f "$xxx"; then
3688                 echo "Found -l$thislib (shared)."
3689                 case " $dflt " in
3690                 *"-l$thislib "*);;
3691                 *) dflt="$dflt -l$thislib";;
3692                 esac
3693         elif xxx=`./loc lib$thislib$_a X $libpth`; $test -f "$xxx"; then
3694                 echo "Found -l$thislib."
3695                 case " $dflt " in
3696                 *"-l$thislib "*);;
3697                 *) dflt="$dflt -l$thislib";;
3698                 esac
3699         elif xxx=`./loc $thislib$_a X $libpth`; $test -f "$xxx"; then
3700                 echo "Found -l$thislib."
3701                 case " $dflt " in
3702                 *"-l$thislib "*);;
3703                 *) dflt="$dflt -l$thislib";;
3704                 esac
3705         elif xxx=`./loc lib${thislib}_s$_a X $libpth`; $test -f "$xxx"; then
3706                 echo "Found -l${thislib}_s."
3707                 case " $dflt " in
3708                 *"-l$thislib "*);;
3709                 *) dflt="$dflt -l${thislib}_s";;
3710                 esac
3711         elif xxx=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$xxx"; then
3712                 echo "Found -l$thislib."
3713                 case " $dflt " in
3714                 *"-l$thislib "*);;
3715                 *) dflt="$dflt -l$thislib";;
3716                 esac
3717         else
3718                 echo "No -l$thislib."
3719         fi
3720 done
3721 set X $dflt
3722 shift
3723 dflt="$*"
3724 case "$libs" in
3725 '') dflt="$dflt";;
3726 *) dflt="$libs";;
3727 esac
3728 case "$dflt" in
3729 ' '|'') dflt='none';;
3730 esac
3731
3732 $cat <<EOM
3733
3734 In order to compile $package on your machine, a number of libraries
3735 are usually needed.  Include any other special libraries here as well.
3736 Say "none" for none.  The default list is almost always right.
3737 EOM
3738
3739 echo " "
3740 rp="What libraries to use?"
3741 . ./myread
3742 case "$ans" in
3743 none) libs=' ';;
3744 *) libs="$ans";;
3745 esac
3746
3747 : determine optimization, if desired, or use for debug flag also
3748 case "$optimize" in
3749 ' '|$undef) dflt='none';;
3750 '') dflt='-O';;
3751 *) dflt="$optimize";;
3752 esac
3753 $cat <<EOH
3754
3755 By default, $package compiles with the -O flag to use the optimizer.
3756 Alternately, you might want to use the symbolic debugger, which uses
3757 the -g flag (on traditional Unix systems).  Either flag can be
3758 specified here.  To use neither flag, specify the word "none".
3759
3760 EOH
3761 rp="What optimizer/debugger flag should be used?"
3762 . ./myread
3763 optimize="$ans"
3764 case "$optimize" in
3765 'none') optimize=" ";;
3766 esac
3767
3768 dflt=''
3769 : We will not override a previous value, but we might want to
3770 : augment a hint file
3771 case "$hint" in
3772 default|recommended)
3773         case "$gccversion" in
3774         1*) dflt='-fpcc-struct-return' ;;
3775         esac
3776         case "$optimize" in
3777         *-g*) dflt="$dflt -DDEBUGGING";;
3778         esac
3779         case "$gccversion" in
3780         2*) if test -d /etc/conf/kconfig.d &&
3781                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
3782                 then
3783                         dflt="$dflt -posix"
3784                 fi
3785                 ;;
3786         esac
3787         case "$gccversion" in
3788         1*) ;;
3789         2.[0-8]*) ;;
3790         ?*)     echo " "
3791                 echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
3792                 echo 'int main(void) { return 0; }' > gcctest.c
3793                 if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
3794                         echo "Yes, it does." 2>&1
3795                         case "$ccflags" in
3796                         *strict-aliasing*) 
3797                                 echo "Leaving current flags $ccflags alone." 2>&1
3798                                 ;;
3799                         *) dflt="$dflt -fno-strict-aliasing" ;;
3800                         esac
3801                 else
3802                         echo "Nope, it doesn't, but that's ok." 2>&1
3803                 fi
3804                 ;;
3805         esac
3806         ;;
3807 esac
3808
3809 case "$mips_type" in
3810 *BSD*|'') inclwanted="$locincpth $usrinc";;
3811 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
3812 esac
3813 for thisincl in $inclwanted; do
3814         if $test -d $thisincl; then
3815                 if $test x$thisincl != x$usrinc; then
3816                         case "$dflt" in
3817                         *$thisincl*);;
3818                         *) dflt="$dflt -I$thisincl";;
3819                         esac
3820                 fi
3821         fi
3822 done
3823
3824 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
3825         xxx=true;
3826 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
3827         xxx=true;
3828 else
3829         xxx=false;
3830 fi;
3831 if $xxx; then
3832         case "$dflt" in
3833         *$2*);;
3834         *) dflt="$dflt -D$2";;
3835         esac;
3836 fi'
3837
3838 set signal.h LANGUAGE_C; eval $inctest
3839
3840 case "$usesocks" in
3841 $define)
3842         ccflags="$ccflags -DSOCKS"
3843         ;;
3844 esac
3845
3846 case "$hint" in
3847 default|recommended) dflt="$ccflags $dflt" ;;
3848 *) dflt="$ccflags";;
3849 esac
3850
3851 case "$dflt" in
3852 ''|' ') dflt=none;;
3853 esac
3854 $cat <<EOH
3855
3856 Your C compiler may want other flags.  For this question you should include
3857 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
3858 but you should NOT include libraries or ld flags like -lwhatever.  If you
3859 want $package to honor its debug switch, you should include -DDEBUGGING here.
3860 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
3861
3862 To use no flags, specify the word "none".
3863
3864 EOH
3865 set X $dflt
3866 shift
3867 dflt=${1+"$@"}
3868 rp="Any additional cc flags?"
3869 . ./myread
3870 case "$ans" in
3871 none) ccflags='';;
3872 *) ccflags="$ans";;
3873 esac
3874
3875 : the following weeds options from ccflags that are of no interest to cpp
3876 cppflags="$ccflags"
3877 case "$gccversion" in
3878 1*) cppflags="$cppflags -D__GNUC__"
3879 esac
3880 case "$mips_type" in
3881 '');;
3882 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
3883 esac
3884 case "$cppflags" in
3885 '');;
3886 *)
3887         echo " "
3888         echo "Let me guess what the preprocessor flags are..." >&4
3889         set X $cppflags
3890         shift
3891         cppflags=''
3892         $cat >cpp.c <<'EOM'
3893 #define BLURFL foo
3894
3895 BLURFL xx LFRULB
3896 EOM
3897         previous=''
3898         for flag in $*
3899         do
3900                 case "$flag" in
3901                 -*) ftry="$flag";;
3902                 *) ftry="$previous $flag";;
3903                 esac
3904                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
3905                         >cpp1.out 2>/dev/null && \
3906                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
3907                         >cpp2.out 2>/dev/null && \
3908                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
3909                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
3910                 then
3911                         cppflags="$cppflags $ftry"
3912                         previous=''
3913                 else
3914                         previous="$flag"
3915                 fi
3916         done
3917         set X $cppflags
3918         shift
3919         cppflags=${1+"$@"}
3920         case "$cppflags" in
3921         *-*)  echo "They appear to be: $cppflags";;
3922         esac
3923         $rm -f cpp.c cpp?.out
3924         ;;
3925 esac
3926
3927 : flags used in final linking phase
3928 case "$ldflags" in
3929 '') if ./venix; then
3930                 dflt='-i -z'
3931         else
3932                 dflt=''
3933         fi
3934         case "$ccflags" in
3935         *-posix*) dflt="$dflt -posix" ;;
3936         esac
3937         ;;
3938 *) dflt="$ldflags";;
3939 esac
3940
3941 : Try to guess additional flags to pick up local libraries.
3942 for thislibdir in $libpth; do
3943         case " $loclibpth " in
3944         *" $thislibdir "*)
3945                 case "$dflt " in 
3946                 *"-L$thislibdir "*) ;;
3947                 *)  dflt="$dflt -L$thislibdir" ;;
3948                 esac
3949                 ;;
3950         esac
3951 done
3952
3953 case "$dflt" in
3954 '') dflt='none' ;;
3955 esac
3956
3957 $cat <<EOH
3958
3959 Your C linker may need flags.  For this question you should
3960 include -L/whatever and any other flags used by the C linker, but you
3961 should NOT include libraries like -lwhatever.
3962
3963 Make sure you include the appropriate -L/path flags if your C linker
3964 does not normally search all of the directories you specified above,
3965 namely
3966         $libpth
3967 To use no flags, specify the word "none".
3968
3969 EOH
3970
3971 rp="Any additional ld flags (NOT including libraries)?"
3972 . ./myread
3973 case "$ans" in
3974 none) ldflags='';;
3975 *) ldflags="$ans";;
3976 esac
3977 rmlist="$rmlist pdp11"
3978
3979 : coherency check
3980 echo " "
3981 echo "Checking your choice of C compiler and flags for coherency..." >&4
3982 $cat > try.c <<'EOF'
3983 #include <stdio.h>
3984 int main() { printf("Ok\n"); exit(0); }
3985 EOF
3986 set X $cc $optimize $ccflags -o try $ldflags try.c $libs
3987 shift
3988 $cat >try.msg <<'EOM'
3989 I've tried to compile and run the following simple program:
3990
3991 EOM
3992 $cat try.c >> try.msg
3993
3994 $cat >> try.msg <<EOM
3995
3996 I used the command:
3997
3998         $*
3999         ./try
4000
4001 and I got the following output:
4002
4003 EOM
4004 dflt=y
4005 if sh -c "$cc $optimize $ccflags -o try $ldflags try.c $libs" >>try.msg 2>&1; then
4006         if sh -c './try' >>try.msg 2>&1; then
4007                 xxx=`./try`
4008                 case "$xxx" in
4009                 "Ok") dflt=n ;;
4010                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
4011                         case " $libs " in
4012                         *" -lsfio "*)
4013                                 cat >> try.msg <<'EOQS'
4014 If $libs contains -lsfio, and sfio is mis-configured, then it
4015 sometimes (apparently) runs and exits with a 0 status, but with no
4016 output!  It may have to do with sfio's use of _exit vs. exit.
4017
4018 EOQS
4019                                 rp="You have a big problem.  Shall I abort Configure"
4020                                 dflt=y
4021                                 ;;
4022                         esac
4023                         ;;
4024                 esac
4025         else
4026                 echo "The program compiled OK, but exited with status $?." >>try.msg
4027                 rp="You have a problem.  Shall I abort Configure"
4028                 dflt=y
4029         fi
4030 else
4031         echo "I can't compile the test program." >>try.msg
4032         rp="You have a BIG problem.  Shall I abort Configure"
4033         dflt=y
4034 fi
4035 case "$dflt" in
4036 y)
4037         $cat try.msg >&4
4038         case "$knowitall" in
4039         '')
4040                 echo "(The supplied flags or libraries might be incorrect.)"
4041                 ;;
4042         *) dflt=n;;
4043         esac
4044         echo " "
4045         . ./myread
4046         case "$ans" in
4047         n*|N*) ;;
4048         *)      echo "Ok.  Stopping Configure." >&4
4049                 exit 1
4050                 ;;
4051         esac
4052         ;;
4053 n) echo "OK, that should do.";;
4054 esac
4055 $rm -f try try.* core
4056
4057 : define an is-a-typedef? function
4058 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
4059 case "$inclist" in
4060 "") inclist="sys/types.h";;
4061 esac;
4062 eval "varval=\$$var";
4063 case "$varval" in
4064 "")
4065         $rm -f temp.c;
4066         for inc in $inclist; do
4067                 echo "#include <$inc>" >>temp.c;
4068         done;
4069         echo "#ifdef $type" >> temp.c;
4070         echo "printf(\"We have $type\");" >> temp.c;
4071         echo "#endif" >> temp.c;
4072         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
4073         if $contains $type temp.E >/dev/null 2>&1; then
4074                 eval "$var=\$type";
4075         else
4076                 eval "$var=\$def";
4077         fi;
4078         $rm -f temp.?;;
4079 *) eval "$var=\$varval";;
4080 esac'
4081
4082 : define an is-a-typedef? function that prompts if the type is not available.
4083 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
4084 case "$inclist" in
4085 "") inclist="sys/types.h";;
4086 esac;
4087 eval "varval=\$$var";
4088 case "$varval" in
4089 "")
4090         $rm -f temp.c;
4091         for inc in $inclist; do
4092                 echo "#include <$inc>" >>temp.c;
4093         done;
4094         echo "#ifdef $type" >> temp.c;
4095         echo "printf(\"We have $type\");" >> temp.c;
4096         echo "#endif" >> temp.c;
4097         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
4098         echo " " ;
4099         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
4100         if $contains $type temp.E >/dev/null 2>&1; then
4101                 echo "$type found." >&4;
4102                 eval "$var=\$type";
4103         else
4104                 echo "$type NOT found." >&4;
4105                 dflt="$def";
4106                 . ./myread ;
4107                 eval "$var=\$ans";
4108         fi;
4109         $rm -f temp.?;;
4110 *) eval "$var=\$varval";;
4111 esac'
4112
4113 : define a shorthand compile call
4114 compile='
4115 mc_file=$1;
4116 shift;
4117 $cc $optimize $ccflags $ldflags -o ${mc_file} $* ${mc_file}.c $libs > /dev/null 2>&1;'
4118 : define a shorthand compile call for compilations that should be ok.
4119 compile_ok='
4120 mc_file=$1;
4121 shift;
4122 $cc $optimize $ccflags $ldflags -o ${mc_file} $* ${mc_file}.c $libs;'
4123
4124 : check for lengths of integral types
4125 echo " "
4126 case "$intsize" in
4127 '')
4128         echo "Checking to see how big your integers are..." >&4
4129         $cat >intsize.c <<'EOCP'
4130 #include <stdio.h>
4131 int main()
4132 {
4133         printf("intsize=%d;\n", (int)sizeof(int));
4134         printf("longsize=%d;\n", (int)sizeof(long));
4135         printf("shortsize=%d;\n", (int)sizeof(short));
4136         exit(0);
4137 }
4138 EOCP
4139         set intsize
4140         if eval $compile_ok && ./intsize > /dev/null; then
4141                 eval `./intsize`
4142                 echo "Your integers are $intsize bytes long."
4143                 echo "Your long integers are $longsize bytes long."
4144                 echo "Your short integers are $shortsize bytes long."
4145         else
4146                 $cat >&4 <<EOM
4147 !
4148 Help! I can't compile and run the intsize test program: please enlighten me!
4149 (This is probably a misconfiguration in your system or libraries, and
4150 you really ought to fix it.  Still, I'll try anyway.)
4151 !
4152 EOM
4153                 dflt=4
4154                 rp="What is the size of an integer (in bytes)?"
4155                 . ./myread
4156                 intsize="$ans"
4157                 dflt=$intsize
4158                 rp="What is the size of a long integer (in bytes)?"
4159                 . ./myread
4160                 longsize="$ans"
4161                 dflt=2
4162                 rp="What is the size of a short integer (in bytes)?"
4163                 . ./myread
4164                 shortsize="$ans"
4165         fi
4166         ;;
4167 esac
4168 $rm -f intsize intsize.*
4169
4170 : see what type lseek is declared as in the kernel
4171 rp="What is the type used for lseek's offset on this system?"
4172 set off_t lseektype long stdio.h sys/types.h
4173 eval $typedef_ask
4174
4175 echo " "
4176 $echo $n "Checking to see how big your file offsets are...$c" >&4
4177 $cat >try.c <<EOCP
4178 #include <sys/types.h>
4179 #include <stdio.h>
4180 int main()
4181 {
4182     printf("%d\n", (int)sizeof($lseektype));
4183     return(0); 
4184 }
4185 EOCP
4186 set try
4187 if eval $compile_ok; then
4188         lseeksize=`./try`
4189         $echo " $lseeksize bytes." >&4
4190 else
4191         dflt=$longsize
4192         echo " "
4193         echo "(I can't seem to compile the test program.  Guessing...)"
4194         rp="What is the size of your file offsets (in bytes)?"
4195         . ./myread
4196         lseeksize="$ans"
4197 fi
4198 $rm -f try.c try
4199
4200 : see what type file positions are declared as in the library
4201 rp="What is the type for file position used by fsetpos()?"
4202 set fpos_t fpostype long stdio.h sys/types.h
4203 eval $typedef_ask
4204
4205 echo " "
4206 case "$fpostype" in
4207 *_t) zzz="$fpostype"    ;;
4208 *)   zzz="fpos_t"       ;;
4209 esac
4210 $echo $n "Checking the size of $zzz...$c" >&4 
4211 cat > try.c <<EOCP
4212 #include <sys/types.h>
4213 #include <stdio.h>
4214 int main() {
4215     printf("%d\n", (int)sizeof($fpostype));
4216     exit(0);
4217 }
4218 EOCP
4219 set try
4220 if eval $compile_ok; then
4221         yyy=`./try`
4222         case "$yyy" in
4223         '')     fpossize=4
4224                 echo " "
4225                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
4226                 ;;
4227         *)      fpossize=$yyy
4228                 echo " $fpossize bytes."
4229                 ;;
4230         esac
4231 else
4232         dflt="$longsize"
4233         echo " "
4234         echo "(I can't compile the test program.  Guessing...)" >&4
4235         rp="What is the size of your file positions (in bytes)?"
4236         . ./myread
4237         fpossize="$ans"
4238 fi
4239
4240
4241
4242 case "$lseeksize:$fpossize" in
4243 8:8) cat <<EOM
4244
4245 You can have files larger than 2 gigabytes.
4246 EOM
4247    val="$define" ;;
4248 *) cat <<EOM
4249
4250 Perl can be built to understand large files (files larger than 2 gigabytes)
4251 on some systems.  To do so, Configure must be run with -Duselargefiles.
4252
4253 If this doesn't make any sense to you, just accept the default 'y'.
4254 EOM
4255    case "$uselargefiles" in
4256    "$undef"|false|[nN]*) dflt='n' ;;
4257    *)   dflt='y' ;;
4258    esac
4259    rp='Try to understand large files, if available?'
4260    . ./myread
4261    case "$ans" in
4262    y|Y)         val="$define" ;;
4263    *)           val="$undef"  ;;
4264    esac
4265    ;;
4266 esac
4267 set uselargefiles
4268 eval $setvar
4269 case "$uselargefiles" in
4270 "$define")
4271 : Look for a hint-file generated 'call-back-unit'.  If the
4272 : user has specified that a large files perl is to be built,
4273 : we may need to set or change some other defaults.
4274         if $test -f uselfs.cbu; then
4275                 echo "Your platform has some specific hints for large file builds, using them..."
4276                 . ./uselfs.cbu
4277                 echo " "
4278                 $echo $n "Rechecking to see how big your file offsets are...$c" >&4
4279                 $cat >try.c <<EOCP
4280 #include <sys/types.h>
4281 #include <stdio.h>
4282 int main()
4283 {
4284     printf("%d\n", (int)sizeof($lseektype));
4285     return(0); 
4286 }
4287 EOCP
4288                 set try
4289                 if eval $compile_ok; then
4290                         lseeksize=`./try`
4291                         $echo " $lseeksize bytes." >&4
4292                 else
4293                         dflt="$lseeksize"
4294                         echo " "
4295                         echo "(I can't seem to compile the test program.  Guessing...)"
4296                         rp="What is the size of your file offsets (in bytes)?"
4297                         . ./myread
4298                         lseeksize="$ans"
4299                 fi
4300                 case "$fpostype" in
4301                 *_t) zzz="$fpostype"    ;;
4302                 *)   zzz="fpos_t"       ;;
4303                 esac
4304                 $echo $n "Rechecking the size of $zzz...$c" >&4 
4305                 $cat > try.c <<EOCP
4306 #include <sys/types.h>
4307 #include <stdio.h>
4308 int main() {
4309     printf("%d\n", (int)sizeof($fpostype));
4310     exit(0);
4311 }
4312 EOCP
4313                 set try
4314                 if eval $compile_ok; then
4315                         yyy=`./try`
4316                         dflt="$lseeksize"
4317                         case "$yyy" in
4318                         '')     echo " "
4319                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
4320                                 ;;
4321                         *)      fpossize=$yyy
4322                                 echo " $fpossize bytes."
4323                                 ;;
4324                         esac
4325                 else
4326                         dflt="$fpossize"
4327                         echo " "
4328                         echo "(I can't compile the test program.  Guessing...)" >&4
4329                         rp="What is the size of your file positions (in bytes)?"
4330                         . ./myread
4331                         fpossize="$ans"
4332                 fi
4333                 $rm -f try.c try
4334         fi
4335         ;;
4336 esac
4337
4338
4339 case "$usemorebits" in
4340 "$define"|true|[yY]*)
4341         use64bits="$define"
4342         uselongdouble="$define"
4343         usemorebits="$define"
4344         ;;
4345 *)      usemorebits="$undef"
4346         ;;
4347 esac
4348
4349
4350 case "$intsize:$longsize" in
4351 8:*|*:8) cat <<EOM
4352
4353 You have natively 64-bit integers.
4354 EOM
4355    val="$define" ;;
4356 *) cat <<EOM
4357
4358 Perl can be built to take advantage of 64-bit integer types
4359 on some systems.  To do so, Configure must be run with -Duse64bits.
4360
4361 If this doesn't make any sense to you, just accept the default.
4362 EOM
4363   case "$use64bits" in
4364   $define|true|[yY]*)   dflt='y';;
4365   *) dflt='n';;
4366   esac
4367   rp='Try to use 64-bit integers, if available?'
4368   . ./myread
4369   case "$ans" in
4370   y|Y) val="$define" ;;
4371   *)   val="$undef"  ;;
4372   esac
4373   ;;
4374 esac
4375 set use64bits
4376 eval $setvar
4377
4378 case "$archname64" in
4379 '') archname64='' ;;    # not a typo
4380 esac
4381
4382 case "$use64bits" in
4383 "$define"|true|[yY]*)
4384 : Look for a hint-file generated 'call-back-unit'.  If the
4385 : user has specified that a 64-bit perl is to be built,
4386 : we may need to set or change some other defaults.
4387         if $test -f use64bits.cbu; then
4388                 echo "Your platform has some specific hints for 64-bit builds, using them..."
4389                 . ./use64bits.cbu
4390         else
4391                 $cat <<EOM
4392 (Your platform doesn't have any specific hints for 64-bit builds.)
4393 EOM
4394                 case "$intsize:$longsize" in
4395 8:*|*:8) cat <<EOM
4396 (This is probably okay, as your system is a natively 64-bit system.)
4397 EOM
4398                   ;;
4399                 esac
4400                 case "$gccversion" in
4401                 '')     ;;
4402                 *)      case "$ccflags" in
4403                         *-DUSE_LONG_LONG*) ;;
4404                         *) $cat <<EOM
4405 But since you seem to be using gcc, I will now add -DUSE_LONG_LONG
4406 to the compilation flags.
4407 EOM
4408                            ccflags="$ccflags -DUSE_LONG_LONG"
4409                            ;;
4410                         esac
4411                         ;;
4412                 esac
4413         fi
4414         ;;
4415 esac
4416
4417 : determine the architecture name
4418 echo " "
4419 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
4420         tarch=`arch`"-$osname"
4421 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
4422         if uname -m > tmparch 2>&1 ; then
4423                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
4424                         -e 's/$/'"-$osname/" tmparch`
4425         else
4426                 tarch="$osname"
4427         fi
4428         $rm -f tmparch
4429 else
4430         tarch="$osname"
4431 fi
4432 case "$myarchname" in
4433 ''|"$tarch") ;;
4434 *)
4435         echo "(Your architecture name used to be $myarchname.)"
4436         archname=''
4437         ;;
4438 esac
4439 myarchname="$tarch"
4440 case "$archname" in
4441 '') dflt="$tarch";;
4442 *) dflt="$archname";;
4443 esac
4444 rp='What is your architecture name'
4445 . ./myread
4446 archname="$ans"
4447 case "$usethreads" in
4448 $define)
4449         echo "Threads selected." >&4
4450         case "$archname" in
4451         *-thread*) echo "...and architecture name already has -thread." >&4
4452                 ;;
4453         *)      archname="$archname-thread"
4454                 echo "...setting architecture name to $archname." >&4
4455                 ;;
4456         esac
4457         ;;
4458 esac
4459 case "$usemultiplicity" in
4460 $define)
4461         echo "Multiplicity selected." >&4
4462         case "$archname" in
4463         *-multi*) echo "...and architecture name already has -multi." >&4
4464                 ;;
4465         *)      archname="$archname-multi"
4466                 echo "...setting architecture name to $archname." >&4
4467                 ;;
4468         esac
4469         ;;
4470 esac
4471 case "$use64bits" in
4472 $define)
4473         case "$archname64" in
4474         '')
4475                 ;;
4476         *)
4477                 case "$archname" in
4478                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
4479                         ;;
4480                 *)      archname="$archname-$archname64"
4481                         echo "...setting architecture name to $archname." >&4
4482                         ;;
4483                 esac
4484                 ;;
4485         esac
4486 esac
4487
4488 : determine root of directory hierarchy where package will be installed.
4489 case "$prefix" in
4490 '')
4491         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
4492         ;;
4493 *)
4494         dflt="$prefix"
4495         ;;
4496 esac
4497 $cat <<EOM
4498
4499 By default, $package will be installed in $dflt/bin, manual pages
4500 under $dflt/man, etc..., i.e. with $dflt as prefix for all
4501 installation directories. Typically this is something like /usr/local.
4502 If you wish to have binaries under /usr/bin but other parts of the
4503 installation under /usr/local, that's ok: you will be prompted
4504 separately for each of the installation directories, the prefix being
4505 only used to set the defaults.
4506
4507 EOM
4508 fn=d~
4509 rp='Installation prefix to use?'
4510 . ./getfile
4511 oldprefix=''
4512 case "$prefix" in
4513 '') ;;
4514 *)
4515         case "$ans" in
4516         "$prefix") ;;
4517         *) oldprefix="$prefix";;
4518         esac
4519         ;;
4520 esac
4521 prefix="$ans"
4522 prefixexp="$ansexp"
4523
4524 : is AFS running?
4525 echo " "
4526 case "$afs" in
4527 $define|true)   afs=true ;;
4528 $undef|false)   afs=false ;;
4529 *)      if test -d /afs; then
4530                 afs=true
4531         else
4532                 afs=false
4533         fi
4534         ;;
4535 esac
4536 if $afs; then
4537         echo "AFS may be running... I'll be extra cautious then..." >&4
4538 else
4539         echo "AFS does not seem to be running..." >&4
4540 fi
4541
4542 : determine installation prefix for where package is to be installed.
4543 if $afs; then 
4544 $cat <<EOM
4545
4546 Since you are running AFS, I need to distinguish the directory in which
4547 files will reside from the directory in which they are installed (and from
4548 which they are presumably copied to the former directory by occult means).
4549
4550 EOM
4551         case "$installprefix" in
4552         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
4553         *) dflt="$installprefix";;
4554         esac
4555 else
4556 $cat <<EOM
4557
4558 In some special cases, particularly when building $package for distribution,
4559 it is convenient to distinguish between the directory in which files should 
4560 be installed from the directory ($prefix) in which they 
4561 will eventually reside.  For most users, these two directories are the same.
4562
4563 EOM
4564         case "$installprefix" in
4565         '') dflt=$prefix ;;
4566         *) dflt=$installprefix;;
4567         esac
4568 fi
4569 fn=d~
4570 rp='What installation prefix should I use for installing files?'
4571 . ./getfile
4572 installprefix="$ans"
4573 installprefixexp="$ansexp"
4574
4575 : set the prefixit variable, to compute a suitable default value
4576 prefixit='case "$3" in
4577 ""|none)
4578         case "$oldprefix" in
4579         "") eval "$1=\"\$$2\"";;
4580         *)
4581                 case "$3" in
4582                 "") eval "$1=";;
4583                 none)
4584                         eval "tp=\"\$$2\"";
4585                         case "$tp" in
4586                         ""|" ") eval "$1=\"\$$2\"";;
4587                         *) eval "$1=";;
4588                         esac;;
4589                 esac;;
4590         esac;;
4591 *)
4592         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
4593         case "$tp" in
4594         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
4595         /*-$oldprefix/*|\~*-$oldprefix/*)
4596                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
4597         *) eval "$1=\"\$$2\"";;
4598         esac;;
4599 esac'
4600
4601 : set the base revision
4602 baserev=5.0
4603
4604 : get the patchlevel
4605 echo " "
4606 echo "Getting the current patchlevel..." >&4
4607 if $test -r $rsrc/patchlevel.h;then
4608         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
4609         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4610         apiversion=`awk '/define[       ]+PERL_APIVERSION/ {print $3}' $rsrc/patchlevel.h`
4611 else
4612         patchlevel=0
4613         subversion=0
4614         apiversion=0
4615 fi
4616 $echo $n "(You have $package" $c
4617 case "$package" in
4618 "*$baserev")    ;;
4619 *)              $echo $n " $baserev" $c ;;
4620 esac
4621 $echo $n " patchlevel $patchlevel" $c
4622 test 0 -eq "$subversion" || $echo $n " subversion $subversion" $c
4623 echo ".)"
4624
4625 if test 0 -eq "$subversion"; then
4626         version=`LC_ALL=C; export LC_ALL; \
4627                  echo $baserev $patchlevel | \
4628                  $awk '{ printf "%.3f\n", $1 + $2/1000.0 }'`
4629 else
4630         version=`LC_ALL=C; export LC_ALL; \
4631                  echo $baserev $patchlevel $subversion | \
4632                  $awk '{ printf "%.5f\n", $1 + $2/1000.0 + $3/100000.0 }'`
4633 fi
4634
4635 : determine installation style
4636 : For now, try to deduce it from prefix unless it is already set.
4637 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
4638 case "$installstyle" in
4639 '')     case "$prefix" in
4640                 *perl*) dflt='lib';;
4641                 *) dflt='lib/perl5' ;;
4642         esac
4643         ;;
4644 *)      dflt='lib/perl5' ;;
4645 esac
4646 : Probably not worth prompting for this since we prompt for all
4647 : the directories individually, and the prompt would be too long and
4648 : confusing anyway.
4649 installstyle=$dflt
4650
4651 : determine where private library files go
4652 : Usual default is /usr/local/lib/perl5/$version.
4653 : Also allow things like /opt/perl/lib/$version, since 
4654 : /opt/perl/lib/perl5... would be redundant.
4655 : The default "style" setting is made in installstyle.U
4656 case "$installstyle" in
4657 *lib/perl5*) set dflt privlib lib/$package/$version ;;
4658 *)       set dflt privlib lib/$version ;;
4659 esac
4660 eval $prefixit
4661 $cat <<EOM
4662
4663 There are some auxiliary files for $package that need to be put into a
4664 private library directory that is accessible by everyone.
4665
4666 EOM
4667 fn=d~+
4668 rp='Pathname where the private library files will reside?'
4669 . ./getfile
4670 privlib="$ans"
4671 privlibexp="$ansexp"
4672 : Change installation prefix, if necessary.
4673 if $test X"$prefix" != X"$installprefix"; then
4674         installprivlib=`echo $privlibexp | sed "s#^$prefix#$installprefix#"`
4675 else
4676         installprivlib="$privlibexp"
4677 fi
4678
4679 : set the prefixup variable, to restore leading tilda escape
4680 prefixup='case "$prefixexp" in
4681 "$prefix") ;;
4682 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
4683 esac'
4684
4685 : determine where public architecture dependent libraries go
4686 set archlib archlib
4687 eval $prefixit
4688 : privlib default is /usr/local/lib/$package/$version
4689 : archlib default is /usr/local/lib/$package/$version/$archname
4690 : privlib may have an optional trailing /share.
4691 tdflt=`echo $privlib | $sed 's,/share$,,'`
4692 tdflt=$tdflt/$archname
4693 case "$archlib" in
4694 '')     dflt=$tdflt
4695         ;;
4696 *)      dflt="$archlib"
4697     ;;
4698 esac
4699 $cat <<EOM
4700
4701 $spackage contains architecture-dependent library files.  If you are
4702 sharing libraries in a heterogeneous environment, you might store
4703 these files in a separate location.  Otherwise, you can just include
4704 them with the rest of the public library files.
4705
4706 EOM
4707 fn=d+~
4708 rp='Where do you want to put the public architecture-dependent libraries?'
4709 . ./getfile
4710 archlib="$ans"
4711 archlibexp="$ansexp"
4712 if $test X"$archlib" = X"$privlib"; then
4713         d_archlib="$undef"
4714 else
4715         d_archlib="$define"
4716 fi
4717 : Change installation prefix, if necessary.
4718 if $test X"$prefix" != X"$installprefix"; then
4719         installarchlib=`echo $archlibexp | sed "s#^$prefix#$installprefix#"`
4720 else
4721         installarchlib="$archlibexp"
4722 fi
4723
4724
4725 : Binary compatibility with 5.005 is not possible for builds
4726 : with advanced features
4727 case "$usethreads$usemultiplicity" in
4728 *define*)
4729         bincompat5005="$undef"
4730         d_bincompat5005="$undef"
4731         ;;
4732 *)      $cat <<EOM
4733
4734 Perl 5.006 can be compiled for binary compatibility with 5.005.
4735 If you decide to do so, you will be able to continue using most
4736 of the extensions that were compiled for Perl 5.005.
4737
4738 EOM
4739         case "$bincompat5005$d_bincompat5005" in
4740         *"$undef"*) dflt=n ;;
4741         *) dflt=y ;;
4742         esac
4743         rp='Binary compatibility with Perl 5.005?'
4744         . ./myread
4745         case "$ans" in
4746         y*) val="$define" ;;
4747         *)  val="$undef" ;;
4748         esac
4749         set d_bincompat5005
4750         eval $setvar
4751         case "$d_bincompat5005" in
4752         "$define")
4753                 bincompat5005="$define"
4754                 ;;
4755         *)      bincompat5005="$undef"
4756                 d_bincompat5005="$undef"
4757                 ;;
4758         esac
4759         ;;
4760 esac
4761
4762
4763 : see if setuid scripts can be secure
4764 $cat <<EOM
4765
4766 Some kernels have a bug that prevents setuid #! scripts from being
4767 secure.  Some sites have disabled setuid #! scripts because of this.
4768
4769 First let's decide if your kernel supports secure setuid #! scripts.
4770 (If setuid #! scripts would be secure but have been disabled anyway,
4771 don't say that they are secure if asked.)
4772
4773 EOM
4774
4775 val="$undef"
4776 if $test -d /dev/fd; then
4777         echo "#!$ls" >reflect
4778         chmod +x,u+s reflect
4779         ./reflect >flect 2>&1
4780         if $contains "/dev/fd" flect >/dev/null; then
4781                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
4782                 val="$define"
4783         else
4784                 $cat <<EOM
4785 If you are not sure if they are secure, I can check but I'll need a
4786 username and password different from the one you are using right now.
4787 If you don't have such a username or don't want me to test, simply
4788 enter 'none'.
4789
4790 EOM
4791                 rp='Other username to test security of setuid scripts with?'
4792                 dflt='none'
4793                 . ./myread
4794                 case "$ans" in
4795                 n|none)
4796                         case "$d_suidsafe" in
4797                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
4798                                 dflt=n;;
4799                         "$undef")
4800                                 echo "Well, the $hint value is *not* secure." >&4
4801                                 dflt=n;;
4802                         *)      echo "Well, the $hint value *is* secure." >&4
4803                                 dflt=y;;
4804                         esac
4805                         ;;
4806                 *)
4807                         $rm -f reflect flect
4808                         echo "#!$ls" >reflect
4809                         chmod +x,u+s reflect
4810                         echo >flect
4811                         chmod a+w flect
4812                         echo '"su" will (probably) prompt you for '"$ans's password."
4813                         su $ans -c './reflect >flect'
4814                         if $contains "/dev/fd" flect >/dev/null; then
4815                                 echo "Okay, it looks like setuid scripts are secure." >&4
4816                                 dflt=y
4817                         else
4818                                 echo "I don't think setuid scripts are secure." >&4
4819                                 dflt=n
4820                         fi
4821                         ;;
4822                 esac
4823                 rp='Does your kernel have *secure* setuid scripts?'
4824                 . ./myread
4825                 case "$ans" in
4826                 [yY]*)  val="$define";;
4827                 *)      val="$undef";;
4828                 esac
4829         fi
4830 else
4831         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
4832         echo "(That's for file descriptors, not floppy disks.)"
4833         val="$undef"
4834 fi
4835 set d_suidsafe
4836 eval $setvar
4837
4838 $rm -f reflect flect
4839
4840 : now see if they want to do setuid emulation
4841 echo " "
4842 val="$undef"
4843 case "$d_suidsafe" in
4844 "$define")
4845         val="$undef"
4846         echo "No need to emulate SUID scripts since they are secure here." >& 4
4847         ;;
4848 *)
4849         $cat <<EOM
4850 Some systems have disabled setuid scripts, especially systems where
4851 setuid scripts cannot be secure.  On systems where setuid scripts have
4852 been disabled, the setuid/setgid bits on scripts are currently
4853 useless.  It is possible for $package to detect those bits and emulate
4854 setuid/setgid in a secure fashion.  This emulation will only work if
4855 setuid scripts have been disabled in your kernel.
4856
4857 EOM
4858         case "$d_dosuid" in
4859         "$define") dflt=y ;;
4860         *) dflt=n ;;
4861         esac
4862         rp="Do you want to do setuid/setgid emulation?"
4863         . ./myread
4864         case "$ans" in
4865         [yY]*)  val="$define";;
4866         *)      val="$undef";;
4867         esac
4868         ;;
4869 esac
4870 set d_dosuid
4871 eval $setvar
4872
4873 : determine filename position in cpp output
4874 echo " "
4875 echo "Computing filename position in cpp output for #include directives..." >&4
4876 echo '#include <stdio.h>' > foo.c
4877 $cat >fieldn <<EOF
4878 $startsh
4879 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
4880 $grep '^[       ]*#.*stdio\.h' | \
4881 while read cline; do
4882         pos=1
4883         set \$cline
4884         while $test \$# -gt 0; do
4885                 if $test -r \`echo \$1 | $tr -d '"'\`; then
4886                         echo "\$pos"
4887                         exit 0
4888                 fi
4889                 shift
4890                 pos=\`expr \$pos + 1\`
4891         done
4892 done
4893 EOF
4894 chmod +x fieldn
4895 fieldn=`./fieldn`
4896 $rm -f foo.c fieldn
4897 case $fieldn in
4898 '') pos='???';;
4899 1) pos=first;;
4900 2) pos=second;;
4901 3) pos=third;;
4902 *) pos="${fieldn}th";;
4903 esac
4904 echo "Your cpp writes the filename in the $pos field of the line."
4905
4906 : locate header file
4907 $cat >findhdr <<EOF
4908 $startsh
4909 wanted=\$1
4910 name=''
4911 for usrincdir in $usrinc
4912 do
4913         if test -f \$usrincdir/\$wanted; then
4914                 echo "\$usrincdir/\$wanted"
4915                 exit 0
4916         fi
4917 done
4918 awkprg='{ print \$$fieldn }'
4919 echo "#include <\$wanted>" > foo\$\$.c
4920 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
4921 $grep "^[       ]*#.*\$wanted" | \
4922 while read cline; do
4923         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
4924         case "\$name" in
4925         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
4926         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
4927         *) exit 2;;
4928         esac;
4929 done;
4930 #
4931 # status = 0: grep returned 0 lines, case statement not executed
4932 # status = 1: headerfile found
4933 # status = 2: while loop executed, no headerfile found
4934 #
4935 status=\$?
4936 $rm -f foo\$\$.c;
4937 if test \$status -eq 1; then
4938         exit 0;
4939 fi
4940 exit 1
4941 EOF
4942 chmod +x findhdr
4943
4944 : define an alternate in-header-list? function
4945 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
4946 cont=true; xxf="echo \"<\$1> found.\" >&4";
4947 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
4948 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
4949 esac;
4950 case $# in 4) instead=instead;; *) instead="at last";; esac;
4951 while $test "$cont"; do
4952         xxx=`./findhdr $1`
4953         var=$2; eval "was=\$$2";
4954         if $test "$xxx" && $test -r "$xxx";
4955         then eval $xxf;
4956         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
4957                 cont="";
4958         else eval $xxnf;
4959         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
4960         set $yyy; shift; shift; yyy=$@;
4961         case $# in 0) cont="";;
4962         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
4963                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
4964         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
4965                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
4966         esac;
4967 done;
4968 while $test "$yyy";
4969 do set $yyy; var=$2; eval "was=\$$2";
4970         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
4971         set $yyy; shift; shift; yyy=$@;
4972 done'
4973
4974 : see if this is a malloc.h system
4975 set malloc.h i_malloc
4976 eval $inhdr
4977
4978 : see if stdlib is available
4979 set stdlib.h i_stdlib
4980 eval $inhdr
4981
4982 : determine which malloc to compile in
4983 echo " "
4984 case "$usemymalloc" in
4985 ''|[yY]*|true|$define)  dflt='y' ;;
4986 *)      dflt='n' ;;
4987 esac
4988 rp="Do you wish to attempt to use the malloc that comes with $package?"
4989 . ./myread
4990 usemymalloc="$ans"
4991 case "$ans" in
4992 y*|true)
4993         usemymalloc='y'
4994         mallocsrc='malloc.c'
4995         mallocobj="malloc$_o"
4996         d_mymalloc="$define"
4997         case "$libs" in
4998         *-lmalloc*)
4999                 : Remove malloc from list of libraries to use
5000                 echo "Removing unneeded -lmalloc from library list" >&4
5001                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
5002                 shift
5003                 libs="$*"
5004                 echo "libs = $libs" >&4
5005                 ;;
5006         esac
5007         ;;
5008 *)
5009         usemymalloc='n'
5010         mallocsrc=''
5011         mallocobj=''
5012         d_mymalloc="$undef"
5013         ;;
5014 esac
5015
5016 : compute the return types of malloc and free
5017 echo " "
5018 $cat >malloc.c <<END
5019 #$i_malloc I_MALLOC
5020 #$i_stdlib I_STDLIB
5021 #include <stdio.h>
5022 #include <sys/types.h>
5023 #ifdef I_MALLOC
5024 #include <malloc.h>
5025 #endif
5026 #ifdef I_STDLIB
5027 #include <stdlib.h>
5028 #endif
5029 #ifdef TRY_MALLOC
5030 void *malloc();
5031 #endif
5032 #ifdef TRY_FREE
5033 void free();
5034 #endif
5035 END
5036 case "$malloctype" in
5037 '')
5038         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
5039                 malloctype='void *'
5040         else
5041                 malloctype='char *'
5042         fi
5043         ;;
5044 esac
5045 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
5046
5047 case "$freetype" in
5048 '')
5049         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
5050                 freetype='void'
5051         else
5052                 freetype='int'
5053         fi
5054         ;;
5055 esac
5056 echo "Your system uses $freetype free(), it would seem." >&4
5057 $rm -f malloc.[co]
5058 $cat <<EOM
5059
5060 The installation process will also create a directory for
5061 vendor-supplied add-ons.  Vendors who supply perl with their system
5062 may find it convenient to place all vendor-supplied files in this
5063 directory rather than in the main distribution directory.  This will
5064 ease upgrades between binary-compatible maintenance versions of perl.
5065
5066 Of course you may also use these directories in whatever way you see
5067 fit.  For example, you might use them to access modules shared over a
5068 company-wide network.
5069
5070 The default answer should be fine for most people.
5071 This causes further questions about vendor add-ons to be skipped
5072 and no vendor-specific directories will be configured for perl.
5073
5074 EOM
5075 rp='Do you want to configure vendor-specific add-on directories?'
5076 case "$usevendorprefix" in
5077 define|true|[yY]*) dflt=y ;;
5078 *) dflt=n ;;
5079 esac
5080 . ./myread
5081 case "$ans" in
5082 [yY]*)  fn=d~+
5083         rp='Installation prefix to use for vendor-supplied add-ons?'
5084         case "$vendorprefix" in
5085         '') dflt='' ;;
5086         *)  dflt=$vendorprefix ;;
5087         esac
5088         . ./getfile
5089         oldvendorprefix=''
5090         case "$vendorprefix" in
5091         '') ;;
5092         *)      case "$ans" in
5093                 "$prefix") ;;
5094                 *) oldvendorprefix="$prefix";;
5095                 esac
5096                 ;;
5097         esac
5098         usevendorprefix="$define"
5099         vendorprefix="$ans"
5100         vendorprefixexp="$ansexp"
5101         ;;
5102 *)      usevendorprefix="$undef"
5103         vendorprefix=''
5104         vendorprefixexp=''
5105         ;;
5106 esac
5107
5108 case "$vendorprefix" in
5109 '')     d_vendorlib="$undef"
5110         vendorlib=''
5111         vendorlibexp=''
5112         ;;
5113 *)      d_vendorlib="$define"
5114         : determine where vendor-supplied modules go.
5115         : Usual default is /usr/local/lib/perl5/vendor_perl
5116         prog=`echo $package | $sed 's/-*[0-9.]*$//'`
5117         case "$installstyle" in
5118         *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog ;;
5119         *)           dflt=$vendorprefix/lib/vendor_$prog ;;
5120         esac
5121         fn=d~+
5122         rp='Pathname for the vendor-supplied library files?'
5123         . ./getfile
5124         vendorlib="$ans"
5125         vendorlibexp="$ansexp"
5126         : Change installation prefix, if necessary.
5127         if $test X"$prefix" != X"$installprefix"; then
5128                 installvendorlib=`echo $vendorlibexp | $sed "s#^$prefix#$installprefix#"`
5129         else
5130                 installvendorlib="$vendorlibexp"
5131         fi
5132         ;;
5133 esac
5134
5135 : Cruising for prototypes
5136 echo " "
5137 echo "Checking out function prototypes..." >&4
5138 $cat >prototype.c <<'EOCP'
5139 int main(int argc, char *argv[]) {
5140         exit(0);}
5141 EOCP
5142 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
5143         echo "Your C compiler appears to support function prototypes."
5144         val="$define"
5145 else
5146         echo "Your C compiler doesn't seem to understand function prototypes."
5147         val="$undef"
5148 fi
5149 set prototype
5150 eval $setvar
5151 $rm -f prototype*
5152
5153 case "$prototype" in
5154 "$define") ;;
5155 *)      ansi2knr='ansi2knr'
5156         echo " "
5157         cat <<EOM >&4
5158
5159 $me:  FATAL ERROR:
5160 This version of $package can only be compiled by a compiler that 
5161 understands function prototypes.  Unfortunately, your C compiler 
5162         $cc $ccflags
5163 doesn't seem to understand them.  Sorry about that.
5164
5165 If GNU cc is available for your system, perhaps you could try that instead.  
5166
5167 Eventually, we hope to support building Perl with pre-ANSI compilers.
5168 If you would like to help in that effort, please contact <perlbug@perl.org>.
5169
5170 Aborting Configure now.
5171 EOM
5172         exit 2
5173         ;;
5174 esac
5175
5176 : determine where public executables go
5177 echo " "
5178 set dflt bin bin
5179 eval $prefixit
5180 fn=d~
5181 rp='Pathname where the public executables will reside?'
5182 . ./getfile
5183 if $test "X$ansexp" != "X$binexp"; then
5184         installbin=''
5185 fi
5186 bin="$ans"
5187 binexp="$ansexp"
5188 : Change installation prefix, if necessary.
5189 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
5190 if $test X"$prefix" != X"$installprefix"; then
5191         installbin=`echo $binexp | sed "s#^$prefix#$installprefix#"`
5192 else
5193         installbin="$binexp"
5194 fi
5195
5196 : determine whether to install perl also as /usr/bin/perl
5197
5198 echo " "
5199 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
5200         $cat <<EOM
5201 Many scripts expect to perl to be installed as /usr/bin/perl.
5202 I can install the perl you are about to compile also as /usr/bin/perl
5203 (in addition to $installbin/perl).
5204 EOM
5205         case "$installusrbinperl" in
5206         "$undef"|[nN]*) dflt='n';;
5207         *)              dflt='y';;
5208         esac
5209         rp="Do you want to install perl as /usr/bin/perl?"
5210         . ./myread
5211         case "$ans" in
5212         [yY]*)  val="$define";;
5213         *)      val="$undef" ;;
5214         esac
5215 else
5216         val="$undef"
5217 fi
5218 set installusrbinperl
5219 eval $setvar
5220
5221 echo " "
5222 echo "Checking for GNU C Library..." >&4
5223 cat >gnulibc.c <<EOM
5224 #include <stdio.h>
5225 int main()
5226 {
5227 #ifdef __GLIBC__
5228     exit(0);
5229 #else
5230     exit(1);
5231 #endif
5232 }
5233 EOM
5234 set gnulibc
5235 if eval $compile_ok && ./gnulibc; then
5236         val="$define"
5237         echo "You are using the GNU C Library"
5238 else
5239         val="$undef"
5240         echo "You are not using the GNU C Library"
5241 fi
5242 $rm -f gnulibc*
5243 set d_gnulibc
5244 eval $setvar
5245
5246 : see if nm is to be used to determine whether a symbol is defined or not
5247 case "$usenm" in
5248 '')
5249         dflt=''
5250         case "$d_gnulibc" in
5251         "$define")
5252                 echo " "
5253                 echo "nm probably won't work on the GNU C Library." >&4
5254                 dflt=n
5255                 ;;
5256         esac
5257         case "$dflt" in
5258         '') 
5259                 if $test "$osname" = aix -a ! -f /lib/syscalls.exp; then
5260                         echo " "
5261                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
5262                         echo "'nm' won't be sufficient on this sytem." >&4
5263                         dflt=n
5264                 fi
5265                 ;;
5266         esac
5267         case "$dflt" in
5268         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
5269                 if $test $dflt -gt 20; then
5270                         dflt=y
5271                 else
5272                         dflt=n
5273                 fi
5274                 ;;
5275         esac
5276         ;;
5277 *)
5278         case "$usenm" in
5279         true|$define) dflt=y;;
5280         *) dflt=n;;
5281         esac
5282         ;;
5283 esac
5284 $cat <<EOM
5285
5286 I can use $nm to extract the symbols from your C libraries. This
5287 is a time consuming task which may generate huge output on the disk (up
5288 to 3 megabytes) but that should make the symbols extraction faster. The
5289 alternative is to skip the 'nm' extraction part and to compile a small
5290 test program instead to determine whether each symbol is present. If
5291 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
5292 this may be the best solution.
5293
5294 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
5295
5296 EOM
5297 rp="Shall I use $nm to extract C symbols from the libraries?"
5298 . ./myread
5299 case "$ans" in
5300 [Nn]*) usenm=false;;
5301 *) usenm=true;;
5302 esac
5303
5304 runnm=$usenm
5305 case "$reuseval" in
5306 true) runnm=false;;
5307 esac
5308
5309 : nm options which may be necessary
5310 case "$nm_opt" in
5311 '') if $test -f /mach_boot; then
5312                 nm_opt=''       # Mach
5313         elif $test -d /usr/ccs/lib; then
5314                 nm_opt='-p'     # Solaris (and SunOS?)
5315         elif $test -f /dgux; then
5316                 nm_opt='-p'     # DG-UX
5317         elif $test -f /lib64/rld; then
5318                 nm_opt='-p'     # 64-bit Irix
5319         else
5320                 nm_opt=''
5321         fi;;
5322 esac
5323
5324 : nm options which may be necessary for shared libraries but illegal
5325 : for archive libraries.  Thank you, Linux.
5326 case "$nm_so_opt" in
5327 '')     case "$myuname" in
5328         *linux*)
5329                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
5330                         nm_so_opt='--dynamic'
5331                 fi
5332                 ;;
5333         esac
5334         ;;
5335 esac
5336
5337 case "$runnm" in
5338 true)
5339 : get list of predefined functions in a handy place
5340 echo " "
5341 case "$libc" in
5342 '') libc=unknown
5343         case "$libs" in
5344         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
5345         esac
5346         ;;
5347 esac
5348 libnames='';
5349 case "$libs" in
5350 '') ;;
5351 *)  for thislib in $libs; do
5352         case "$thislib" in
5353         -lc|-lc_s)
5354                 : Handle C library specially below.
5355                 ;;
5356         -l*)
5357                 thislib=`echo $thislib | $sed -e 's/^-l//'`
5358                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
5359                         :
5360                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
5361                         :
5362                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
5363                         :
5364                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
5365                         :
5366                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
5367                         :
5368                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
5369                         :
5370                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
5371                         :
5372                 else
5373                         try=''
5374                 fi
5375                 libnames="$libnames $try"
5376                 ;;
5377         *) libnames="$libnames $thislib" ;;
5378         esac
5379         done
5380         ;;
5381 esac
5382 xxx=normal
5383 case "$libc" in
5384 unknown)
5385         set /lib/libc.$so
5386         for xxx in $libpth; do
5387                 $test -r $1 || set $xxx/libc.$so
5388                 : The messy sed command sorts on library version numbers.
5389                 $test -r $1 || \
5390                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
5391                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
5392                                 h
5393                                 s/[0-9][0-9]*/0000&/g
5394                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
5395                                 G
5396                                 s/\n/ /' | \
5397                          sort | $sed -e 's/^.* //'`
5398                 eval set \$$#
5399         done
5400         $test -r $1 || set /usr/ccs/lib/libc.$so
5401         $test -r $1 || set /lib/libsys_s$_a
5402         ;;
5403 *)
5404         set blurfl
5405         ;;
5406 esac
5407 if $test -r "$1"; then
5408         echo "Your (shared) C library seems to be in $1."
5409         libc="$1"
5410 elif $test -r /lib/libc && $test -r /lib/clib; then
5411         echo "Your C library seems to be in both /lib/clib and /lib/libc."
5412         xxx=apollo
5413         libc='/lib/clib /lib/libc'
5414         if $test -r /lib/syslib; then
5415                 echo "(Your math library is in /lib/syslib.)"
5416                 libc="$libc /lib/syslib"
5417         fi
5418 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5419         echo "Your C library seems to be in $libc, as you said before."
5420 elif $test -r $incpath/usr/lib/libc$_a; then
5421         libc=$incpath/usr/lib/libc$_a;
5422         echo "Your C library seems to be in $libc.  That's fine."
5423 elif $test -r /lib/libc$_a; then
5424         libc=/lib/libc$_a;
5425         echo "Your C library seems to be in $libc.  You're normal."
5426 else
5427         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
5428                 :
5429         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
5430                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
5431         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
5432                 :
5433         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5434                 :
5435         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5436                 :
5437         else
5438                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
5439         fi
5440         if $test -r "$tans"; then
5441                 echo "Your C library seems to be in $tans, of all places."
5442                 libc=$tans
5443         else
5444                 libc='blurfl'
5445         fi
5446 fi
5447 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5448         dflt="$libc"
5449         cat <<EOM
5450
5451 If the guess above is wrong (which it might be if you're using a strange
5452 compiler, or your machine supports multiple models), you can override it here.
5453
5454 EOM
5455 else
5456         dflt=''
5457         echo $libpth | tr ' ' $trnl | sort | uniq > libpath
5458         cat >&4 <<EOM
5459 I can't seem to find your C library.  I've looked in the following places:
5460
5461 EOM
5462         $sed 's/^/      /' libpath
5463         cat <<EOM
5464
5465 None of these seems to contain your C library. I need to get its name...
5466
5467 EOM
5468 fi
5469 fn=f
5470 rp='Where is your C library?'
5471 . ./getfile
5472 libc="$ans"
5473
5474 echo " "
5475 echo $libc $libnames | tr ' ' $trnl | sort | uniq > libnames
5476 set X `cat libnames`
5477 shift
5478 xxx=files
5479 case $# in 1) xxx=file; esac
5480 echo "Extracting names from the following $xxx for later perusal:" >&4
5481 echo " "
5482 $sed 's/^/      /' libnames >&4
5483 echo " "
5484 $echo $n "This may take a while...$c" >&4
5485
5486 for file in $*; do
5487         case $file in
5488         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
5489         *) $nm $nm_opt $file 2>/dev/null;;
5490         esac
5491 done >libc.tmp
5492
5493 $echo $n ".$c"
5494 $grep fprintf libc.tmp > libc.ptf
5495 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
5496 xrun='eval "<libc.tmp $com >libc.list"; echo "done" >&4'
5497 xxx='[ADTSIW]'
5498 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *_[_.]*//p' -e 's/^.* $xxx  *//p'";\
5499         eval $xscan;\
5500         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5501                 eval $xrun
5502 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
5503         eval $xscan;\
5504         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5505                 eval $xrun
5506 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
5507         eval $xscan;\
5508         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5509                 eval $xrun
5510 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
5511         eval $xscan;\
5512         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5513                 eval $xrun
5514 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
5515         eval $xscan;\
5516         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5517                 eval $xrun
5518 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
5519         eval $xscan;\
5520         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5521                 eval $xrun
5522 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
5523                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
5524         eval $xscan;\
5525         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5526                 eval $xrun
5527 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
5528         eval $xscan;\
5529         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5530                 eval $xrun
5531 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
5532         eval $xscan;\
5533         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5534                 eval $xrun
5535 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
5536         eval $xscan;\
5537         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5538                 eval $xrun
5539 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
5540         eval $xscan;\
5541         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5542                 eval $xrun
5543 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
5544         eval $xscan;\
5545         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5546                 eval $xrun
5547 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
5548         eval $xscan;\
5549         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5550                 eval $xrun
5551 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
5552         eval $xscan;\
5553         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5554                 eval $xrun
5555 else
5556         $nm -p $* 2>/dev/null >libc.tmp
5557         $grep fprintf libc.tmp > libc.ptf
5558         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
5559                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
5560         then
5561                 nm_opt='-p'
5562                 eval $xrun
5563         else
5564                 echo " "
5565                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
5566                 com=''
5567                 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
5568                         for thisname in $libnames $libc; do
5569                                 $ar t $thisname >>libc.tmp
5570                         done
5571                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
5572                         echo "Ok." >&4
5573                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
5574                         # Repeat libc to extract forwarders to DLL entries too
5575                         for thisname in $libnames $libc; do
5576                                 $ar tv $thisname >>libc.tmp
5577                                 # Revision 50 of EMX has bug in $ar.
5578                                 # it will not extract forwarders to DLL entries
5579                                 # Use emximp which will extract exactly them.
5580                                 emximp -o tmp.imp $thisname \
5581                                     2>/dev/null && \
5582                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
5583                                     < tmp.imp >>libc.tmp
5584                                 $rm tmp.imp
5585                         done
5586                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
5587                         echo "Ok." >&4
5588                 else
5589                         echo "$ar didn't seem to work right." >&4
5590                         echo "Maybe this is a Cray...trying bld instead..." >&4
5591                         if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
5592                         then
5593                                 for thisname in $libnames; do
5594                                         bld t $libnames | \
5595                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
5596                                         $ar t $thisname >>libc.tmp
5597                                 done
5598                                 echo "Ok." >&4
5599                         else
5600                                 echo "That didn't work either.  Giving up." >&4
5601                                 exit 1
5602                         fi
5603                 fi
5604         fi
5605 fi
5606 nm_extract="$com"
5607 if $test -f /lib/syscalls.exp; then
5608         echo " "
5609         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
5610         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*$/\1/p' /lib/syscalls.exp >>libc.list
5611 fi
5612 ;;
5613 esac
5614 $rm -f libnames libpath
5615
5616 : see if dld is available
5617 set dld.h i_dld
5618 eval $inhdr
5619
5620 : is a C symbol defined?
5621 csym='tlook=$1;
5622 case "$3" in
5623 -v) tf=libc.tmp; tc=""; tdc="";;
5624 -a) tf=libc.tmp; tc="[0]"; tdc="[]";;
5625 *) tlook="^$1\$"; tf=libc.list; tc="()"; tdc="()";;
5626 esac;
5627 tx=yes;
5628 case "$reuseval-$4" in
5629 true-) ;;
5630 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
5631 esac;
5632 case "$tx" in
5633 yes)
5634         case "$runnm" in
5635         true)
5636                 if $contains $tlook $tf >/dev/null 2>&1;
5637                 then tval=true;
5638                 else tval=false;
5639                 fi;;
5640         *)
5641                 echo "int main() { extern short $1$tdc; printf(\"%hd\", $1$tc); }" > t.c;
5642                 if $cc $optimize $ccflags $ldflags -o t t.c $libs >/dev/null 2>&1;
5643                 then tval=true;
5644                 else tval=false;
5645                 fi;
5646                 $rm -f t t.c;;
5647         esac;;
5648 *)
5649         case "$tval" in
5650         $define) tval=true;;
5651         *) tval=false;;
5652         esac;;
5653 esac;
5654 eval "$2=$tval"'
5655
5656 : define an is-in-libc? function
5657 inlibc='echo " "; td=$define; tu=$undef;
5658 sym=$1; var=$2; eval "was=\$$2";
5659 tx=yes;
5660 case "$reuseval$was" in
5661 true) ;;
5662 true*) tx=no;;
5663 esac;
5664 case "$tx" in
5665 yes)
5666         set $sym tres -f;
5667         eval $csym;
5668         case "$tres" in
5669         true)
5670                 echo "$sym() found." >&4;
5671                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
5672         *)
5673                 echo "$sym() NOT found." >&4;
5674                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
5675         esac;;
5676 *)
5677         case "$was" in
5678         $define) echo "$sym() found." >&4;;
5679         *) echo "$sym() NOT found." >&4;;
5680         esac;;
5681 esac'
5682
5683 : see if dlopen exists
5684 xxx_runnm="$runnm"
5685 runnm=false
5686 set dlopen d_dlopen
5687 eval $inlibc
5688 runnm="$xxx_runnm"
5689
5690 : determine which dynamic loading, if any, to compile in
5691 echo " "
5692 dldir="ext/DynaLoader"
5693 case "$usedl" in
5694 $define|y|true)
5695         dflt='y'
5696         usedl="$define"
5697         ;;
5698 $undef|n|false)
5699         dflt='n'
5700         usedl="$undef"
5701         ;;
5702 *) 
5703         dflt='n'
5704         case "$d_dlopen" in
5705             $define) dflt='y' ;;
5706         esac
5707         case "$i_dld" in
5708             $define) dflt='y' ;;
5709         esac
5710         : Does a dl_xxx.xs file exist for this operating system
5711         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
5712         ;;
5713 esac
5714 rp="Do you wish to use dynamic loading?"
5715 . ./myread
5716 usedl="$ans"
5717 case "$ans" in
5718 y*) usedl="$define"
5719         case "$dlsrc" in
5720         '')
5721                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
5722                         dflt="$dldir/dl_${osname}.xs"
5723                 elif $test "$d_dlopen" = "$define" ; then
5724                         dflt="$dldir/dl_dlopen.xs"
5725                 elif $test "$i_dld" = "$define" ; then
5726                         dflt="$dldir/dl_dld.xs"
5727                 else
5728                         dflt=''
5729                 fi
5730                 ;;
5731         *)      dflt="$dldir/$dlsrc"
5732                 ;;
5733         esac
5734     echo "The following dynamic loading files are available:"
5735         : Can not go over to $dldir because getfile has path hard-coded in.
5736         tdir=`pwd`; cd $rsrc; $ls -C $dldir/dl*.xs; cd $tdir
5737         rp="Source file to use for dynamic loading"
5738         fn="fne"
5739         gfpth="$src"
5740         . ./getfile
5741         usedl="$define"
5742         : emulate basename
5743         dlsrc=`echo $ans | $sed -e 's@.*/\([^/]*\)$@\1@'`
5744
5745         $cat << EOM
5746
5747 Some systems may require passing special flags to $cc -c to
5748 compile modules that will be used to create a shared library.
5749 To use no flags, say "none".
5750
5751 EOM
5752     case "$cccdlflags" in
5753     '') case "$gccversion" in
5754                 '') case "$osname" in
5755                         hpux)   dflt='+z' ;;
5756                         next)   dflt='none' ;;
5757                         irix*)  dflt='-KPIC' ;;
5758                         svr4*|esix*|solaris) dflt='-KPIC' ;;
5759                         sunos)  dflt='-pic' ;;
5760                         *)      dflt='none' ;;
5761                     esac
5762                         ;;
5763                 *)  case "$osname" in
5764                         svr4*|esix*|solaris) dflt='-fPIC' ;;
5765                         *)      dflt='-fpic' ;;
5766                     esac ;;
5767             esac ;;
5768         ' ') dflt='none' ;;
5769     *)  dflt="$cccdlflags" ;;
5770     esac
5771     rp="Any special flags to pass to $cc -c to compile shared library modules?"
5772     . ./myread
5773     case "$ans" in
5774     none) cccdlflags=' ' ;;
5775     *) cccdlflags="$ans" ;;
5776     esac
5777
5778     cat << EOM
5779
5780 Some systems use ld to create libraries that can be dynamically loaded,
5781 while other systems (such as those using ELF) use $cc.
5782
5783 EOM
5784         case "$ld" in
5785         '')     $cat >try.c <<'EOM'
5786 /* Test for whether ELF binaries are produced */
5787 #include <fcntl.h>
5788 #include <stdlib.h>
5789 int main() {
5790         char b[4];
5791         int i = open("a.out",O_RDONLY);
5792         if(i == -1) 
5793                 exit(1); /* fail */
5794         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
5795                 exit(0); /* succeed (yes, it's ELF) */
5796         else
5797                 exit(1); /* fail */
5798 }
5799 EOM
5800                 if $cc $ccflags try.c >/dev/null 2>&1 && ./a.out; then
5801                         cat <<EOM
5802 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
5803 EOM
5804                         dflt="$cc"
5805                 else
5806                         echo "I'll use ld to build dynamic libraries."
5807                         dflt='ld'
5808                 fi
5809                 rm -f try.c a.out
5810                 ;;
5811         *)      dflt="$ld"
5812                 ;;
5813         esac
5814
5815     rp="What command should be used to create dynamic libraries?"
5816     . ./myread
5817         ld="$ans"
5818
5819     cat << EOM
5820
5821 Some systems may require passing special flags to $ld to create a
5822 library that can be dynamically loaded.  If your ld flags include
5823 -L/other/path options to locate libraries outside your loader's normal
5824 search path, you may need to specify those -L options here as well.  To
5825 use no flags, say "none".
5826
5827 EOM
5828     case "$lddlflags" in
5829     '') case "$osname" in
5830                         beos) dflt='-nostart' ;;
5831                         hpux)  dflt='-b' ;;
5832                         linux|irix*)    dflt='-shared' ;;
5833                         next)  dflt='none' ;;
5834                         solaris) dflt='-G' ;;
5835                         sunos) dflt='-assert nodefinitions' ;;
5836                         svr4*|esix*) dflt="-G $ldflags" ;;
5837                 *)     dflt='none' ;;
5838                         esac
5839                         ;;
5840     *) dflt="$lddlflags" ;;
5841     esac
5842
5843         : Try to guess additional flags to pick up local libraries.
5844         : Be careful not to append to a plain 'none'
5845         case "$dflt" in
5846         none) dflt='' ;;
5847         esac
5848         for thisflag in $ldflags; do
5849                 case "$thisflag" in
5850                 -L*)
5851                         case " $dflt " in
5852                         *" $thisflag "*) ;;
5853                         *) dflt="$dflt $thisflag" ;;
5854                         esac
5855                         ;;
5856                 esac
5857         done
5858
5859         case "$dflt" in
5860         ''|' ') dflt='none' ;;
5861         esac
5862
5863     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
5864     . ./myread
5865     case "$ans" in
5866     none) lddlflags=' ' ;;
5867     *) lddlflags="$ans" ;;
5868     esac
5869
5870         cat <<EOM
5871
5872 Some systems may require passing special flags to $cc to indicate that
5873 the resulting executable will use dynamic linking.  To use no flags,
5874 say "none".
5875
5876 EOM
5877     case "$ccdlflags" in
5878     '') case "$osname" in
5879                 hpux)   dflt='-Wl,-E' ;;
5880                 linux)  dflt='-rdynamic' ;;
5881                 next)   dflt='none' ;;
5882                 sunos)  dflt='none' ;;
5883                 *)      dflt='none' ;;
5884             esac ;;
5885     ' ')  dflt='none' ;;
5886     *)  dflt="$ccdlflags" ;;
5887     esac
5888     rp="Any special flags to pass to $cc to use dynamic loading?"
5889     . ./myread
5890     case "$ans" in
5891     none) ccdlflags=' ' ;;
5892     *) ccdlflags="$ans" ;;
5893     esac
5894     ;;
5895 *)  usedl="$undef"
5896         ld='ld'
5897     dlsrc='dl_none.xs'
5898     lddlflags=''
5899     ccdlflags=''
5900     ;;
5901 esac
5902
5903 also=''
5904 case "$usedl" in
5905 $undef)
5906         # No dynamic loading being used, so don't bother even to prompt.
5907         useshrplib='false'
5908         ;;
5909 *)      case "$useshrplib" in
5910         '')     case "$osname" in
5911                 svr4*|dgux|dynixptx|esix|powerux|beos)
5912                         dflt=y
5913                         also='Building a shared libperl is required for dynamic loading to work on your system.'
5914                         ;;
5915                 next*)
5916                         case "$osvers" in
5917                         4*)     dflt=y
5918                                 also='Building a shared libperl is needed for MAB support.'
5919                                 ;;
5920                         *)      dflt=n
5921                                 ;;
5922                         esac
5923                         ;;
5924                 *)      dflt=n
5925                         ;;
5926                 esac
5927                 ;;
5928         $define|true|[Yy]*)
5929                 dflt=y
5930                 ;;
5931         *)      dflt=n
5932                 ;;
5933         esac
5934         $cat << EOM
5935
5936 The perl executable is normally obtained by linking perlmain.c with
5937 libperl${_a}, any static extensions (usually just DynaLoader), and
5938 any other libraries needed on this system (such as -lm, etc.).  Since
5939 your system supports dynamic loading, it is probably possible to build
5940 a shared libperl.$so.  If you will have more than one executable linked
5941 to libperl.$so, this will significantly reduce the size of each
5942 executable, but it may have a noticeable affect on performance.  The
5943 default is probably sensible for your system.
5944 $also
5945
5946 EOM
5947         rp="Build a shared libperl.$so (y/n)"
5948         . ./myread
5949         case "$ans" in
5950         true|$define|[Yy]*)
5951                 useshrplib='true'  ;;
5952         *)      useshrplib='false' ;;
5953         esac
5954         ;;
5955 esac
5956
5957 case "$useshrplib" in
5958 true)
5959         case "$libperl" in
5960         '')
5961                 # Figure out a good name for libperl.so.  Since it gets stored in
5962                 # a version-specific architecture-dependent library, the version
5963                 # number isn't really that important, except for making cc/ld happy.
5964                 #
5965                 # A name such as libperl.so.3.1
5966                 majmin="libperl.$so.$patchlevel.$subversion"
5967                 # A name such as libperl.so.301
5968                 majonly=`echo $patchlevel $subversion |
5969                         $awk '{printf "%d%02d", $1, $2}'`
5970                 majonly=libperl.$so.$majonly
5971                 # I'd prefer to keep the os-specific stuff here to a minimum, and
5972                 # rely on figuring it out from the naming of libc.
5973                 case "${osname}${osvers}" in
5974                 next4*)
5975                         dflt=libperl.5.$so
5976                         # XXX How handle the --version stuff for MAB?
5977                         ;;
5978                 linux*)  # ld won't link with a bare -lperl otherwise.
5979                         dflt=libperl.$so
5980                         ;;
5981                 *)      # Try to guess based on whether libc has major.minor.
5982                         case "$libc" in
5983                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
5984                         *libc.$so.[0-9]*) dflt=$majonly ;;
5985                         *)      dflt=libperl.$so ;;
5986                         esac
5987                         ;;
5988                 esac
5989                 ;;
5990         *)      dflt=$libperl
5991                 ;;
5992         esac
5993         cat << EOM
5994
5995 I need to select a good name for the shared libperl.  If your system uses
5996 library names with major and minor numbers, then you might want something
5997 like $majmin.  Alternatively, if your system uses a single version
5998 number for shared libraries, then you might want to use $majonly.
5999 Or, your system might be quite happy with a simple libperl.$so.
6000
6001 Since the shared libperl will get installed into a version-specific
6002 architecture-dependent directory, the version number of the shared perl
6003 library probably isn't important, so the default should be o.k.
6004
6005 EOM
6006         rp='What name do you want to give to the shared libperl?'
6007         . ./myread
6008         libperl=$ans
6009         echo "Ok, I'll use $libperl"
6010         ;;
6011 *)
6012         libperl="libperl${_a}"
6013         ;;
6014 esac
6015
6016 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
6017 case "$shrpdir" in
6018 '') ;;
6019 *)      $cat >&4 <<EOM
6020 WARNING:  Use of the shrpdir variable for the installation location of
6021 the shared $libperl is not supported.  It was never documented and
6022 will not work in this version.  Let me (perlbug@perl.com)
6023 know of any problems this may cause.
6024
6025 EOM
6026         case "$shrpdir" in
6027         "$archlibexp/CORE")
6028                 $cat >&4 <<EOM
6029 But your current setting of $shrpdir is
6030 the default anyway, so it's harmless.
6031 EOM
6032                 ;;
6033         *)
6034                 $cat >&4 <<EOM
6035 Further, your current attempted setting of $shrpdir
6036 conflicts with the value of $archlibexp/CORE
6037 that installperl will use.
6038 EOM
6039                 ;;
6040         esac
6041         ;;
6042 esac
6043
6044 # How will the perl executable find the installed shared $libperl?
6045 # Add $xxx to ccdlflags.
6046 # If we can't figure out a command-line option, use $shrpenv to
6047 # set env LD_RUN_PATH.  The main perl makefile uses this.
6048 shrpdir=$archlibexp/CORE
6049 xxx=''
6050 tmp_shrpenv=''
6051 if "$useshrplib"; then
6052     case "$osname" in 
6053         aix)
6054                 # We'll set it in Makefile.SH...
6055                 ;;
6056         solaris|netbsd)
6057                 xxx="-R $shrpdir"
6058                 ;;
6059         freebsd)
6060                 xxx="-Wl,-R$shrpdir"
6061                 ;;
6062         linux|irix*|dec_osf)
6063                 xxx="-Wl,-rpath,$shrpdir"
6064                 ;;
6065         next)
6066                 # next doesn't like the default...
6067                 ;;
6068         beos)
6069                 # beos doesn't like the default, either.
6070                 ;;
6071         hpux*)
6072                 # hpux doesn't like the default, either.
6073                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
6074                 ;;
6075         *)
6076                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
6077                 ;;
6078         esac
6079         case "$xxx" in
6080         '') ;;
6081         *)      
6082                 # Only add $xxx if it isn't already in ccdlflags.
6083                 case " $ccdlflags " in
6084                 *" $xxx "*)     ;;
6085                 *)      ccdlflags="$ccdlflags $xxx"
6086                         cat <<EOM >&4
6087
6088 Adding $xxx to the flags
6089 passed to $ld so that the perl executable will find the 
6090 installed shared $libperl.
6091
6092 EOM
6093                         ;;
6094                 esac
6095                 ;;
6096         esac
6097 fi
6098 # Fix ccdlflags in AIX for building external extensions.
6099 # (For building Perl itself bare -bE:perl.exp is needed,
6100 #  Makefile.SH takes care of this.)
6101 case "$osname" in
6102 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
6103 esac
6104 # Respect a hint or command-line value.
6105 case "$shrpenv" in
6106 '') shrpenv="$tmp_shrpenv" ;;
6107 esac
6108 case "$ldlibpthname" in
6109 '')     ldlibpthname=LD_LIBRARY_PATH ;;
6110 none)   ldlibpthname='' ;;
6111 esac
6112
6113 : determine where manual pages go
6114 set man1dir man1dir none
6115 eval $prefixit
6116 $cat <<EOM
6117
6118 $spackage has manual pages available in source form.
6119 EOM
6120 case "$nroff" in
6121 nroff)
6122         echo "However, you don't have nroff, so they're probably useless to you."
6123         case "$man1dir" in
6124         '') man1dir="none";;
6125         esac;;
6126 esac
6127 echo "If you don't want the manual sources installed, answer 'none'."
6128 case "$man1dir" in
6129 ' ') dflt=none
6130         ;;
6131 '')
6132         lookpath="$prefixexp/man/man1 $prefixexp/man/l_man/man1"
6133         lookpath="$lookpath $prefixexp/man/p_man/man1"
6134         lookpath="$lookpath $prefixexp/man/u_man/man1"
6135         lookpath="$lookpath $prefixexp/man/man.1"
6136         case "$sysman" in
6137         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
6138         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
6139         esac
6140         set dflt
6141         eval $prefixup
6142         ;;
6143 *)  dflt="$man1dir"
6144         ;;
6145 esac
6146 echo " "
6147 fn=dn+~
6148 rp="Where do the main $spackage manual pages (source) go?"
6149 . ./getfile
6150 if $test "X$man1direxp" != "X$ansexp"; then
6151         installman1dir=''
6152 fi
6153 man1dir="$ans"
6154 man1direxp="$ansexp"
6155 case "$man1dir" in
6156 '')     man1dir=' '
6157         installman1dir='';;
6158 esac
6159
6160 : Change installation prefix, if necessary.
6161 if $test X"$prefix" != X"$installprefix"; then
6162         installman1dir=`echo $man1direxp | $sed "s#^$prefix#$installprefix#"`
6163 else
6164         installman1dir="$man1direxp"
6165 fi
6166
6167 : What suffix to use on installed man pages
6168
6169 case "$man1dir" in
6170 ' ')
6171         man1ext='0'
6172         ;;
6173 *)
6174         rp="What suffix should be used for the main $spackage man pages?"
6175         case "$man1ext" in
6176         '')     case "$man1dir" in
6177                 *1)  dflt=1 ;;
6178                 *1p) dflt=1p ;;
6179                 *1pm) dflt=1pm ;;
6180                 *l) dflt=l;;
6181                 *n) dflt=n;;
6182                 *o) dflt=o;;
6183                 *p) dflt=p;;
6184                 *C) dflt=C;;
6185                 *L) dflt=L;;
6186                 *L1) dflt=L1;;
6187                 *) dflt=1;;
6188                 esac
6189                 ;;
6190         *)      dflt="$man1ext";;
6191         esac
6192         . ./myread
6193         man1ext="$ans"
6194         ;;
6195 esac
6196
6197 : see if we can have long filenames
6198 echo " "
6199 rmlist="$rmlist /tmp/cf$$"
6200 $test -d /tmp/cf$$ || mkdir /tmp/cf$$
6201 first=123456789abcdef
6202 second=/tmp/cf$$/$first
6203 $rm -f $first $second
6204 if (echo hi >$first) 2>/dev/null; then
6205         if $test -f 123456789abcde; then
6206                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
6207                 val="$undef"
6208         else
6209                 if (echo hi >$second) 2>/dev/null; then
6210                         if $test -f /tmp/cf$$/123456789abcde; then
6211                                 $cat <<'EOM'
6212 That's peculiar... You can have filenames longer than 14 characters, but only
6213 on some of the filesystems.  Maybe you are using NFS.  Anyway, to avoid problems
6214 I shall consider your system cannot support long filenames at all.
6215 EOM
6216                                 val="$undef"
6217                         else
6218                                 echo 'You can have filenames longer than 14 characters.' >&4
6219                                 val="$define"
6220                         fi
6221                 else
6222                         $cat <<'EOM'
6223 How confusing! Some of your filesystems are sane enough to allow filenames
6224 longer than 14 characters but some others like /tmp can't even think about them.
6225 So, for now on, I shall assume your kernel does not allow them at all.
6226 EOM
6227                         val="$undef"
6228                 fi
6229         fi
6230 else
6231         $cat <<'EOM'
6232 You can't have filenames longer than 14 chars.  You can't even think about them!
6233 EOM
6234         val="$undef"
6235 fi 
6236 set d_flexfnam
6237 eval $setvar
6238 $rm -rf /tmp/cf$$ 123456789abcde*
6239
6240 : determine where library module manual pages go
6241 set man3dir man3dir none
6242 eval $prefixit
6243 $cat <<EOM
6244
6245 $spackage has manual pages for many of the library modules.
6246 EOM
6247
6248 case "$nroff" in
6249 nroff)
6250         $cat <<'EOM'
6251 However, you don't have nroff, so they're probably useless to you.
6252 EOM
6253         case "$man3dir" in
6254         '') man3dir="none";;
6255         esac;;
6256 esac
6257
6258 case "$d_flexfnam" in
6259 undef)
6260         $cat <<'EOM'
6261 However, your system can't handle the long file names like File::Basename.3. 
6262 EOM
6263         case "$man3dir" in
6264         '') man3dir="none";;
6265         esac;;
6266 esac
6267
6268 echo "If you don't want the manual sources installed, answer 'none'."
6269 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6270 case "$man3dir" in
6271 '')     dflt=`echo $man1dir | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
6272         if $test -d "$privlib/man/man3"; then
6273                 cat <<EOM >&4
6274
6275 WARNING:  Previous versions of perl installed man3 pages into
6276 $privlib/man/man3.  This version will suggest a 
6277 new default of $dflt.  
6278 EOM
6279                 tdflt=$dflt
6280                 dflt='n'
6281                 rp='Do you wish to preserve the old behavior?(y/n)'
6282                 . ./myread
6283                 case "$ans" in
6284                 y*) dflt="$privlib/man/man3" ;;
6285                 *)  dflt=$tdflt ;;
6286                 esac
6287     fi
6288         ;;
6289 ' ') dflt=none;;
6290 *)      dflt="$man3dir" ;;
6291 esac
6292 echo " "
6293 fn=dn+~
6294 rp="Where do the $package library man pages (source) go?"
6295 . ./getfile
6296 man3dir="$ans"
6297 man3direxp="$ansexp"
6298 case "$man1dir" in
6299 '')     man3dir=' '
6300         installman3dir='';;
6301 esac
6302
6303 : Change installation prefix, if necessary.
6304 if $test X"$prefix" != X"$installprefix"; then
6305         installman3dir=`echo $man3direxp | $sed "s#^$prefix#$installprefix#"`
6306 else
6307         installman3dir="$man3direxp"
6308 fi
6309
6310 : What suffix to use on installed man pages
6311 case "$man3dir" in
6312 ' ')
6313         man3ext='0'
6314         ;;
6315 *)
6316         rp="What suffix should be used for the $package library man pages?"
6317         case "$man3ext" in
6318         '')     case "$man3dir" in
6319                 *3)  dflt=3 ;;
6320                 *3p) dflt=3p ;;
6321                 *3pm) dflt=3pm ;;
6322                 *l) dflt=l;;
6323                 *n) dflt=n;;
6324                 *o) dflt=o;;
6325                 *p) dflt=p;;
6326                 *C) dflt=C;;
6327                 *L) dflt=L;;
6328                 *L3) dflt=L3;;
6329                 *) dflt=3;;
6330                 esac
6331                 ;;
6332         *)      dflt="$man3ext";;
6333         esac
6334         . ./myread
6335         man3ext="$ans"
6336         ;;
6337 esac
6338
6339 : see if we have to deal with yellow pages, now NIS.
6340 if $test -d /usr/etc/yp || $test -d /etc/yp; then
6341         if $test -f /usr/etc/nibindd; then
6342                 echo " "
6343                 echo "I'm fairly confident you're on a NeXT."
6344                 echo " "
6345                 rp='Do you get the hosts file via NetInfo?'
6346                 dflt=y
6347                 case "$hostcat" in
6348                 nidump*) ;;
6349                 '') ;;
6350                 *) dflt=n;;
6351                 esac
6352                 . ./myread
6353                 case "$ans" in
6354                 y*) hostcat='nidump hosts .';;
6355                 *)      case "$hostcat" in
6356                         nidump*) hostcat='';;
6357                         esac
6358                         ;;
6359                 esac
6360         fi
6361         case "$hostcat" in
6362         nidump*) ;;
6363         *)
6364                 case "$hostcat" in
6365                 *ypcat*) dflt=y;;
6366                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
6367                                 dflt=y
6368                         else
6369                                 dflt=n
6370                         fi;;
6371                 *) dflt=n;;
6372                 esac
6373                 echo " "
6374                 rp='Are you getting the hosts file via yellow pages?'
6375                 . ./myread
6376                 case "$ans" in
6377                 y*) hostcat='ypcat hosts';;
6378                 *) hostcat='cat /etc/hosts';;
6379                 esac
6380                 ;;
6381         esac
6382 fi
6383 case "$hostcat" in
6384 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
6385 esac
6386 case "$groupcat" in
6387 '') test -f /etc/group && groupcat='cat /etc/group';;
6388 esac
6389 case "$passcat" in
6390 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
6391 esac
6392
6393 : now get the host name
6394 echo " "
6395 echo "Figuring out host name..." >&4
6396 case "$myhostname" in
6397 '') cont=true
6398         echo 'Maybe "hostname" will work...'
6399         if tans=`sh -c hostname 2>&1` ; then
6400                 myhostname=$tans
6401                 phostname=hostname
6402                 cont=''
6403         fi
6404         ;;
6405 *) cont='';;
6406 esac
6407 if $test "$cont"; then
6408         if ./xenix; then
6409                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
6410                 if tans=`cat /etc/systemid 2>&1` ; then
6411                         myhostname=$tans
6412                         phostname='cat /etc/systemid'
6413                         echo "Whadyaknow.  Xenix always was a bit strange..."
6414                         cont=''
6415                 fi
6416         elif $test -r /etc/systemid; then
6417                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
6418         fi
6419 fi
6420 if $test "$cont"; then
6421         echo 'No, maybe "uuname -l" will work...'
6422         if tans=`sh -c 'uuname -l' 2>&1` ; then
6423                 myhostname=$tans
6424                 phostname='uuname -l'
6425         else
6426                 echo 'Strange.  Maybe "uname -n" will work...'
6427                 if tans=`sh -c 'uname -n' 2>&1` ; then
6428                         myhostname=$tans
6429                         phostname='uname -n'
6430                 else
6431                         echo 'Oh well, maybe I can mine it out of whoami.h...'
6432                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
6433                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
6434                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
6435                         else
6436                                 case "$myhostname" in
6437                                 '') echo "Does this machine have an identity crisis or something?"
6438                                         phostname='';;
6439                                 *)
6440                                         echo "Well, you said $myhostname before..."
6441                                         phostname='echo $myhostname';;
6442                                 esac
6443                         fi
6444                 fi
6445         fi
6446 fi
6447 : you do not want to know about this
6448 set $myhostname
6449 myhostname=$1
6450
6451 : verify guess
6452 if $test "$myhostname" ; then
6453         dflt=y
6454         rp='Your host name appears to be "'$myhostname'".'" Right?"
6455         . ./myread
6456         case "$ans" in
6457         y*) ;;
6458         *) myhostname='';;
6459         esac
6460 fi
6461
6462 : bad guess or no guess
6463 while $test "X$myhostname" = X ; do
6464         dflt=''
6465         rp="Please type the (one word) name of your host:"
6466         . ./myread
6467         myhostname="$ans"
6468 done
6469
6470 : translate upper to lower if necessary
6471 case "$myhostname" in
6472 *[A-Z]*)
6473         echo "(Normalizing case in your host name)"
6474         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
6475         ;;
6476 esac
6477
6478 case "$myhostname" in
6479 *.*)
6480         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
6481         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
6482         echo "(Trimming domain name from host name--host name is now $myhostname)"
6483         ;;
6484 *) case "$mydomain" in
6485         '')
6486                 {
6487                         test "X$hostcat" = "Xypcat hosts" &&
6488                         ypmatch "$myhostname" hosts 2>/dev/null |\
6489                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
6490                         $test -s hosts
6491                 } || {
6492                         test "X$hostcat" != "X" &&
6493                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
6494                                         /[       ]$myhostname[  . ]/p" > hosts
6495                 }
6496                 tmp_re="[       . ]"
6497                 $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
6498                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
6499                 dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
6500                         hosts | $sort | $uniq | \
6501                         $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
6502                 case `$echo X$dflt` in
6503                 X*\ *)  echo "(Several hosts in /etc/hosts matched hostname)"
6504                         dflt=.
6505                         ;;
6506                 X.) echo "(You do not have fully-qualified names in /etc/hosts)"
6507                         ;;
6508                 esac
6509                 case "$dflt" in
6510                 .)
6511                         tans=`./loc resolv.conf X /etc /usr/etc`
6512                         if $test -f "$tans"; then
6513                                 echo "(Attempting domain name extraction from $tans)"
6514                                 dflt=.`$sed -n -e 's/   / /g' \
6515                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
6516                                   | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
6517                                 case "$dflt" in
6518                                 .) dflt=.`$sed -n -e 's/        / /g' \
6519                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
6520                                      | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
6521                                         ;;
6522                                 esac
6523                         fi
6524                         ;;
6525                 esac
6526                 case "$dflt" in
6527                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
6528                         dflt=.`sh -c domainname 2>/dev/null`
6529                         case "$dflt" in
6530                         '') dflt='.';;
6531                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
6532                         esac
6533                         ;;
6534                 esac
6535                 case "$dflt" in
6536                 .) echo "(Lost all hope -- silly guess then)"
6537                         dflt='.uucp'
6538                         ;;
6539                 esac
6540                 $rm -f hosts
6541                 ;;
6542         *) dflt="$mydomain";;
6543         esac;;
6544 esac
6545 echo " "
6546 rp="What is your domain name?"
6547 . ./myread
6548 tans="$ans"
6549 case "$ans" in
6550 '') ;;
6551 .*) ;;
6552 *) tans=".$tans";;
6553 esac
6554 mydomain="$tans"
6555
6556 : translate upper to lower if necessary
6557 case "$mydomain" in
6558 *[A-Z]*)
6559         echo "(Normalizing case in your domain name)"
6560         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
6561         ;;
6562 esac
6563
6564 : a little sanity check here
6565 case "$phostname" in
6566 '') ;;
6567 *)
6568         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
6569         $myhostname$mydomain|$myhostname) ;;
6570         *)
6571                 case "$phostname" in
6572                 sed*)
6573                         echo "(That doesn't agree with your whoami.h file, by the way.)"
6574                         ;;
6575                 *)
6576                         echo "(That doesn't agree with your $phostname command, by the way.)"
6577                         ;;
6578                 esac
6579         ;;
6580         esac
6581         ;;
6582 esac
6583
6584 $cat <<EOM
6585
6586 I need to get your e-mail address in Internet format if possible, i.e.
6587 something like user@host.domain. Please answer accurately since I have
6588 no easy means to double check it. The default value provided below
6589 is most probably close to the reality but may not be valid from outside
6590 your organization...
6591
6592 EOM
6593 cont=x
6594 while test "$cont"; do
6595         case "$cf_email" in
6596         '') dflt="$cf_by@$myhostname$mydomain";;
6597         *) dflt="$cf_email";;
6598         esac
6599         rp='What is your e-mail address?'
6600         . ./myread
6601         cf_email="$ans"
6602         case "$cf_email" in
6603         *@*.*) cont='' ;;
6604         *)
6605                 rp='Address does not look like an Internet one.  Use it anyway?'
6606                 case "$fastread" in
6607                 yes) dflt=y ;;
6608                 *) dflt=n ;;
6609                 esac
6610                 . ./myread
6611                 case "$ans" in
6612                 y*) cont='' ;;
6613                 *) echo " " ;;
6614                 esac
6615                 ;;
6616         esac
6617 done
6618
6619 $cat <<EOM
6620
6621 If you or somebody else will be maintaining perl at your site, please
6622 fill in the correct e-mail address here so that they may be contacted
6623 if necessary. Currently, the "perlbug" program included with perl
6624 will send mail to this address in addition to perlbug@perl.com. You may
6625 enter "none" for no administrator.
6626
6627 EOM
6628 case "$perladmin" in
6629 '') dflt="$cf_email";;
6630 *) dflt="$perladmin";;
6631 esac
6632 rp='Perl administrator e-mail address'
6633 . ./myread
6634 perladmin="$ans"
6635
6636 : figure out how to guarantee perl startup
6637 case "$startperl" in
6638 '')
6639         case "$sharpbang" in
6640         *!)
6641                 $cat <<EOH
6642
6643 I can use the #! construct to start perl on your system. This will
6644 make startup of perl scripts faster, but may cause problems if you
6645 want to share those scripts and perl is not in a standard place
6646 ($binexp/perl) on all your platforms. The alternative is to force
6647 a shell by starting the script with a single ':' character.
6648
6649 EOH
6650                 dflt="$binexp/perl"
6651                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
6652                 . ./myread
6653                 case "$ans" in
6654                 none)   startperl=": # use perl";;
6655                 *)      startperl="#!$ans"
6656                         if $test 30 -lt `echo "$ans" | wc -c`; then
6657                                 $cat >&4 <<EOM
6658
6659 WARNING:  Some systems limit the #! command to 32 characters.
6660 If you experience difficulty running Perl scripts with #!, try
6661 installing Perl in a directory with a shorter pathname.
6662
6663 EOM
6664                         fi ;;
6665                 esac
6666                 ;;
6667         *) startperl=": # use perl"
6668                 ;;
6669         esac
6670         ;;
6671 esac
6672 echo "I'll use $startperl to start perl scripts."
6673
6674 : figure best path for perl in scripts
6675 case "$perlpath" in
6676 '')
6677         perlpath="$binexp/perl"
6678         case "$startperl" in
6679         *!*) ;;
6680         *)
6681                 $cat <<EOH
6682
6683 I will use the "eval 'exec'" idiom to start Perl on your system.
6684 I can use the full path of your Perl binary for this purpose, but
6685 doing so may cause problems if you want to share those scripts and
6686 Perl is not always in a standard place ($binexp/perl).
6687
6688 EOH
6689                 dflt="$binexp/perl"
6690                 rp="What path shall I use in \"eval 'exec'\"?"
6691                 . ./myread
6692                 perlpath="$ans"
6693                 ;;
6694         esac
6695         ;;
6696 esac
6697 case "$startperl" in
6698 *!*)    ;;
6699 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
6700 esac
6701
6702 : determine where public executable scripts go
6703 set scriptdir scriptdir
6704 eval $prefixit
6705 case "$scriptdir" in
6706 '')
6707         dflt="$bin"
6708         : guess some guesses
6709         $test -d /usr/share/scripts && dflt=/usr/share/scripts
6710         $test -d /usr/share/bin     && dflt=/usr/share/bin
6711         $test -d /usr/local/script  && dflt=/usr/local/script
6712         $test -d /usr/local/scripts && dflt=/usr/local/scripts
6713         $test -d $prefixexp/script  && dflt=$prefixexp/script
6714         set dflt
6715         eval $prefixup
6716         ;;
6717 *)  dflt="$scriptdir"
6718         ;;
6719 esac
6720 $cat <<EOM
6721  
6722 Some installations have a separate directory just for executable scripts so
6723 that they can mount it across multiple architectures but keep the scripts in
6724 one spot.  You might, for example, have a subdirectory of /usr/share for this.
6725 Or you might just lump your scripts in with all your other executables.
6726  
6727 EOM
6728 fn=d~
6729 rp='Where do you keep publicly executable scripts?'
6730 . ./getfile
6731 if $test "X$ansexp" != "X$scriptdirexp"; then
6732         installscript=''
6733 fi
6734 scriptdir="$ans"
6735 scriptdirexp="$ansexp"
6736 : Change installation prefix, if necessary.
6737 if $test X"$prefix" != X"$installprefix"; then
6738         installscript=`echo $scriptdirexp | sed "s#^$prefix#$installprefix#"`
6739 else
6740         installscript="$scriptdirexp"
6741 fi
6742
6743 $cat <<EOM
6744
6745 After $package is installed, you may wish to install various
6746 add-on modules and utilities.  Typically, these add-ons will
6747 be installed under $prefix with the rest
6748 of this package.  However, you may wish to install such add-ons
6749 elsewhere under a different prefix.
6750
6751 If you do not wish to put everything under a single prefix, that's
6752 ok.  You will be prompted for the individual locations; this siteprefix
6753 is only used to suggest the defaults.
6754
6755 The default should be fine for most people.
6756
6757 EOM
6758 fn=d~+
6759 rp='Installation prefix to use for add-on modules and utilities?'
6760 : XXX Here might be another good place for an installstyle setting.
6761 case "$siteprefix" in
6762 '') dflt=$prefix ;;
6763 *)  dflt=$siteprefix ;;
6764 esac
6765 . ./getfile
6766 oldsiteprefix=''
6767 case "$siteprefix" in
6768 '') ;;
6769 *)
6770         case "$ans" in
6771         "$prefix") ;;
6772         *) oldsiteprefix="$prefix";;
6773         esac
6774         ;;
6775 esac
6776 siteprefix="$ans"
6777 siteprefixexp="$ansexp"
6778
6779 : determine where site specific libraries go.
6780 : Usual default is /usr/local/lib/perl5/site_perl
6781 : The default "style" setting is made in installstyle.U
6782 : XXX No longer works with Prefixit stuff.
6783 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6784 case "$installstyle" in
6785 *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog ;;
6786 *)       dflt=$siteprefix/lib/site_$prog ;;
6787 esac
6788 $cat <<EOM
6789
6790 The installation process will create a directory for
6791 site-specific extensions and modules.  Most users find it convenient
6792 to place all site-specific files in this directory rather than in the
6793 main distribution directory.
6794
6795 EOM
6796 fn=d~+
6797 rp='Pathname for the site-specific library files?'
6798 . ./getfile
6799 sitelib="$ans"
6800 sitelibexp="$ansexp"
6801 : Change installation prefix, if necessary.
6802 if $test X"$prefix" != X"$installprefix"; then
6803         installsitelib=`echo $sitelibexp | sed "s#^$prefix#$installprefix#"`
6804 else
6805         installsitelib="$sitelibexp"
6806 fi
6807
6808 : determine where site specific architecture-dependent libraries go.
6809 : sitelib  default is /usr/local/lib/perl5/site_perl/
6810 : sitearch default is /usr/local/lib/perl5/site_perl/$apiversion/$archname
6811 : sitelib may have an optional trailing /share.
6812 tdflt=`echo $sitelib | $sed 's,/share$,,'`
6813 tdflt="$tdflt/$apiversion/$archname"
6814 set sitearch sitearch none
6815 eval $prefixit
6816 case "$sitearch" in
6817 '')     dflt="$tdflt" ;;
6818 *)      dflt="$sitearch" ;;
6819 esac
6820 $cat <<EOM
6821
6822 The installation process will also create a directory for
6823 architecture-dependent site-specific extensions and modules.
6824
6825 EOM
6826 fn=nd~+
6827 rp='Pathname for the site-specific architecture-dependent library files?'
6828 . ./getfile
6829 sitearch="$ans"
6830 sitearchexp="$ansexp"
6831 : Change installation prefix, if necessary.
6832 if $test X"$prefix" != X"$installprefix"; then
6833         installsitearch=`echo $sitearchexp | sed "s#^$prefix#$installprefix#"`
6834 else
6835         installsitearch="$sitearchexp"
6836 fi
6837
6838 : determine where add-on public executables go
6839 case "$sitebin" in
6840 '')     dflt=$siteprefix/bin ;;
6841 *)      dflt=$sitebin ;;
6842 esac
6843 fn=d~
6844 rp='Pathname where the add-on public executables should be installed?'
6845 . ./getfile
6846 sitebin="$ans"
6847 sitebinexp="$ansexp"
6848 : Change installation prefix, if necessary.
6849 if $test X"$prefix" != X"$installprefix"; then
6850         installsitebin=`echo $sitebinexp | sed "s#^$prefix#$installprefix#"`
6851 else
6852         installsitebin="$sitebinexp"
6853 fi
6854
6855 cat <<EOM
6856
6857 Perl can be built to take advantage of long doubles which
6858 (if available) may give more accuracy and range for floating point numbers.
6859
6860 If this doesn't make any sense to you, just accept the default 'n'.
6861 EOM
6862
6863 case "$ccflags" in
6864 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
6865 esac
6866
6867 case "$uselongdouble" in
6868 $define|true|[yY]*)     dflt='y';;
6869 *) dflt='n';;
6870 esac
6871 rp='Try to use long doubles if available?'
6872 . ./myread
6873 case "$ans" in
6874 y|Y)    val="$define"   ;;
6875 *)      val="$undef"    ;;
6876 esac
6877 set uselongdouble
6878 eval $setvar
6879
6880 case "$uselongdouble" in
6881 true|[yY]*) uselongdouble="$define" ;;
6882 esac
6883
6884 case "$uselongdouble" in
6885 $define)
6886 : Look for a hint-file generated 'call-back-unit'.  If the
6887 : user has specified that long doubles should be used,
6888 : we may need to set or change some other defaults.
6889         if $test -f uselongdouble.cbu; then
6890                 echo "Your platform has some specific hints for long doubles, using them..."
6891                 . ./uselongdouble.cbu
6892         else
6893                 $cat <<EOM
6894 (Your platform doesn't have any specific hints for long doubles.)
6895 EOM
6896         fi
6897         ;;
6898 esac
6899
6900 cat <<EOM
6901
6902 Perl can be built to take advantage of long longs which
6903 (if available) may give more range for integer numbers.
6904
6905 If this doesn't make any sense to you, just accept the default 'n'.
6906 EOM
6907
6908 case "$ccflags" in
6909 *-DUSE_LONG_LONG*) uselonglong="$define" ;;
6910 esac
6911
6912 case "$uselonglong" in
6913 $define|true|[yY]*)     dflt='y';;
6914 *) dflt='n';;
6915 esac
6916 rp='Try to use long longs if available?'
6917 . ./myread
6918 case "$ans" in
6919 y|Y)    val="$define"   ;;
6920 *)      val="$undef"    ;;
6921 esac
6922 set uselonglong
6923 eval $setvar
6924
6925 case "$uselonglong" in
6926 true|[yY]*) uselonglong="$define" ;;
6927 esac
6928
6929 case "$uselonglong" in
6930 $define)
6931 : Look for a hint-file generated 'call-back-unit'.  If the
6932 : user has specified that long longs should be used,
6933 : we may need to set or change some other defaults.
6934         if $test -f uselonglong.cbu; then
6935                 echo "Your platform has some specific hints for long longs, using them..."
6936                 . ./uselonglong.cbu
6937         else
6938                 $cat <<EOM
6939 (Your platform doesn't have any specific hints for long longs.)
6940 EOM
6941         fi
6942         ;;
6943 esac
6944
6945 cat <<EOM
6946
6947 Previous version of $package used the standard IO mechanisms as defined
6948 in <stdio.h>.  Versions 5.003_02 and later of perl allow alternate IO
6949 mechanisms via a "PerlIO" abstraction, but the stdio mechanism is still
6950 the default.  This abstraction layer can use AT&T's sfio (if you already
6951 have sfio installed) or regular stdio.  Using PerlIO with sfio may cause
6952 problems with some extension modules.  Using PerlIO with stdio is safe,
6953 but it is slower than plain stdio and therefore is not the default.
6954
6955 If this doesn't make any sense to you, just accept the default 'n'.
6956 EOM
6957 case "$useperlio" in
6958 $define|true|[yY]*)     dflt='y';;
6959 *) dflt='n';;
6960 esac
6961 rp='Use the experimental PerlIO abstraction layer?'
6962 . ./myread
6963 case "$ans" in
6964 y|Y) 
6965         val="$define"
6966         ;;     
6967 *)      
6968         echo "Ok, doing things the stdio way"
6969         val="$undef"
6970         ;;
6971 esac
6972 set useperlio
6973 eval $setvar 
6974
6975 case "$vendorprefix" in
6976 '')     d_vendorbin="$undef"
6977         vendorbin=''
6978         vendorbinexp=''
6979         ;;
6980 *)      d_vendorbin="$define"
6981         : determine where vendor-supplied executables go.
6982         dflt=$vendorprefix/bin
6983         fn=d~+
6984         rp='Pathname for the vendor-supplied executables directory?'
6985         . ./getfile
6986         vendorbin="$ans"
6987         vendorbinexp="$ansexp"
6988         : Change installation prefix, if necessary.
6989         if $test X"$prefix" != X"$installprefix"; then
6990                 installvendorbin=`echo $vendorbinexp | $sed "s#^$prefix#$installprefix#"`
6991         else
6992                 installvendorbin="$vendorbinexp"
6993         fi
6994         ;;
6995 esac
6996
6997 : Check how to convert floats to strings.
6998 if test "X$d_Gconvert" = X; then
6999         echo " "
7000         echo "Checking for an efficient way to convert floats to strings."
7001         $cat >try.c <<'EOP'
7002 #ifdef TRY_gconvert
7003 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
7004 char *myname = "gconvert";
7005 #endif
7006 #ifdef TRY_gcvt
7007 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
7008 char *myname = "gcvt";
7009 #endif
7010 #ifdef TRY_sprintf
7011 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
7012 char *myname = "sprintf";
7013 #endif
7014
7015 #include <stdio.h>
7016
7017 int
7018 checkit(expect, got)
7019 char *expect;
7020 char *got;
7021 {
7022     if (strcmp(expect, got)) {
7023                 printf("%s oddity:  Expected %s, got %s\n",
7024                         myname, expect, got);
7025                 exit(1);
7026         }
7027 }
7028
7029 int main()
7030
7031         char buf[64]; 
7032         buf[63] = '\0';
7033
7034         /* This must be 1st test on (which?) platform */
7035         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
7036         Gconvert(0.1, 8, 0, buf);
7037         checkit("0.1", buf);
7038
7039         Gconvert(1.0, 8, 0, buf); 
7040         checkit("1", buf);
7041
7042         Gconvert(0.0, 8, 0, buf); 
7043         checkit("0", buf);
7044
7045         Gconvert(-1.0, 8, 0, buf); 
7046         checkit("-1", buf);
7047
7048         /* Some Linux gcvt's give 1.e+5 here. */
7049         Gconvert(100000.0, 8, 0, buf); 
7050         checkit("100000", buf);
7051         
7052         /* Some Linux gcvt's give -1.e+5 here. */
7053         Gconvert(-100000.0, 8, 0, buf); 
7054         checkit("-100000", buf);
7055
7056         exit(0);
7057 }
7058 EOP
7059         case "$d_Gconvert" in
7060         gconvert*) xxx_list='gconvert gcvt sprintf' ;;
7061         gcvt*) xxx_list='gcvt gconvert sprintf' ;;
7062         sprintf*) xxx_list='sprintf gconvert gcvt' ;;
7063         *) xxx_list='gconvert gcvt sprintf' ;;
7064         esac
7065
7066         for xxx_convert in $xxx_list; do
7067                 echo "Trying $xxx_convert"
7068                 $rm -f try try$_o
7069                 set try -DTRY_$xxx_convert
7070                 if eval $compile; then
7071                         echo "$xxx_convert" found. >&4
7072                         if ./try; then
7073                                 echo "I'll use $xxx_convert to convert floats into a string." >&4
7074                                 break;
7075                         else
7076                                 echo "...But $xxx_convert didn't work as I expected."
7077                         fi
7078                 else
7079                         echo "$xxx_convert NOT found." >&4
7080                 fi
7081         done
7082                 
7083         case "$xxx_convert" in
7084         gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
7085         gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
7086         *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
7087         esac
7088 fi
7089
7090 : check for length of double
7091 echo " "
7092 case "$doublesize" in
7093 '')
7094         $echo $n "Checking to see how big your double precision numbers are...$c" >&4
7095         $cat >try.c <<'EOCP'
7096 #include <stdio.h>
7097 int main()
7098 {
7099     printf("%d\n", (int)sizeof(double));
7100     exit(0);
7101 }
7102 EOCP
7103         set try
7104         if eval $compile_ok; then
7105                 doublesize=`./try`
7106                 $echo " $doublesize bytes." >&4
7107         else
7108                 dflt='8'
7109                 echo "(I can't seem to compile the test program.  Guessing...)"
7110                 rp="What is the size of a double precision number (in bytes)?"
7111                 . ./myread
7112                 doublesize="$ans"
7113         fi
7114         ;;
7115 esac
7116 $rm -f try.c try
7117
7118 : check for long doubles
7119 echo " "
7120 $echo $n "Checking to see if your system supports long double..." $c >&4
7121 echo 'int main() { long double x = 7.0; }' > try.c
7122 set try
7123 if eval $compile; then
7124         val="$define"
7125         echo " Yes, it does." >&4
7126 else
7127         val="$undef"
7128         echo " No, it doesn't." >&4
7129 fi
7130 $rm try.*
7131 set d_longdbl
7132 eval $setvar
7133
7134 : check for length of long double
7135 case "${d_longdbl}${longdblsize}" in
7136 $define)
7137         echo " "
7138         $echo $n "Checking to see how big your long doubles are..." $c >&4
7139         $cat >try.c <<'EOCP'
7140 #include <stdio.h>
7141 int main()
7142 {
7143         printf("%d\n", sizeof(long double));
7144 }
7145 EOCP
7146         set try
7147         set try
7148         if eval $compile; then
7149                 longdblsize=`./try$exe_ext`
7150                 $echo " $longdblsize bytes." >&4
7151         else
7152                 dflt='8'
7153                 echo " "
7154                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
7155                 rp="What is the size of a long double (in bytes)?"
7156                 . ./myread
7157                 longdblsize="$ans"
7158         fi
7159         if $test "X$doublesize" = "X$longdblsize"; then
7160                 echo "(That isn't any different from an ordinary double.)"
7161         fi      
7162         ;;
7163 esac
7164 $rm -f try.* try
7165
7166 echo " "
7167
7168 if $test X"$d_longdbl" = X"$define"; then
7169
7170 echo "Checking how to print long doubles..." >&4
7171
7172 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
7173         $cat >try.c <<'EOCP'
7174 #include <sys/types.h>
7175 #include <stdio.h>
7176 int main() {
7177   double d = 123.456;
7178   printf("%.3f\n", d);
7179 }
7180 EOCP
7181         set try
7182         if eval $compile; then
7183                 yyy=`./try$exe_ext`
7184                 case "$yyy" in
7185                 123.456)
7186                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
7187                         sPRIFldbl='"F"'; sPRIGldbl='"G"'; sPRIEldbl='"E"';
7188                         echo "We will use %f."
7189                         ;;
7190                 esac
7191         fi
7192 fi
7193
7194 if $test X"$sPRIfldbl" = X; then
7195         $cat >try.c <<'EOCP'
7196 #include <sys/types.h>
7197 #include <stdio.h>
7198 int main() {
7199   long double d = 123.456;
7200   printf("%.3llf\n", d);
7201 }
7202 EOCP
7203         set try
7204         if eval $compile; then
7205                 yyy=`./try$exe_ext`
7206                 case "$yyy" in
7207                 123.456)
7208                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
7209                         sPRIFldbl='"llF"'; sPRIGldbl='"llG"'; sPRIEldbl='"llE"';
7210                         echo "We will use %llf."
7211                         ;;
7212                 esac
7213         fi
7214 fi
7215
7216 if $test X"$sPRIfldbl" = X; then
7217         $cat >try.c <<'EOCP'
7218 #include <sys/types.h>
7219 #include <stdio.h>
7220 int main() {
7221   long double d = 123.456;
7222   printf("%.3Lf\n", d);
7223 }
7224 EOCP
7225         set try
7226         if eval $compile; then
7227                 yyy=`./try$exe_ext`
7228                 case "$yyy" in
7229                 123.456)
7230                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
7231                         sPRIFldbl='"LF"'; sPRIGldbl='"LG"'; sPRIEldbl='"LE"';
7232                         echo "We will use %Lf."
7233                         ;;
7234                 esac
7235         fi
7236 fi
7237
7238 if $test X"$sPRIfldbl" = X; then
7239         $cat >try.c <<'EOCP'
7240 #include <sys/types.h>
7241 #include <stdio.h>
7242 int main() {
7243   long double d = 123.456;
7244   printf("%.3lf\n", d);
7245 }
7246 EOCP
7247         set try
7248         if eval $compile; then
7249                 yyy=`./try$exe_ext`
7250                 case "$yyy" in
7251                 123.456)
7252                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
7253                         sPRIFldbl='"lF"'; sPRIGldbl='"lG"'; sPRIEldbl='"lE"';
7254                         echo "We will use %lf."
7255                         ;;
7256                 esac
7257         fi
7258 fi
7259
7260 if $test X"$sPRIfldbl" = X; then
7261         echo "Cannot figure out how to print long doubles." >&4
7262 fi
7263
7264 $rm -f try try.*
7265
7266 fi # d_longdbl
7267
7268 case "$sPRIfldbl" in
7269 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef"; 
7270         d_PRIFldbl="$undef"; d_PRIGldbl="$undef"; d_PRIEldbl="$undef"; 
7271         ;;
7272 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define"; 
7273         d_PRIFldbl="$define"; d_PRIGldbl="$define"; d_PRIEldbl="$define"; 
7274         ;;
7275 esac
7276
7277 : Initialize h_fcntl
7278 h_fcntl=false
7279
7280 : Initialize h_sysfile
7281 h_sysfile=false
7282
7283 : access call always available on UNIX
7284 set access d_access
7285 eval $inlibc
7286
7287 : locate the flags for 'access()'
7288 case "$d_access" in
7289 "$define")
7290         echo " "
7291         $cat >access.c <<'EOCP'
7292 #include <sys/types.h>
7293 #ifdef I_FCNTL
7294 #include <fcntl.h>
7295 #endif
7296 #ifdef I_SYS_FILE
7297 #include <sys/file.h>
7298 #endif
7299 #ifdef I_UNISTD
7300 #include <unistd.h>
7301 #endif
7302 int main() {
7303         exit(R_OK);
7304 }
7305 EOCP
7306         : check sys/file.h first, no particular reason here
7307         if $test `./findhdr sys/file.h` && \
7308                 $cc $cppflags -DI_SYS_FILE -o access access.c >/dev/null 2>&1 ; then
7309                 h_sysfile=true;
7310                 echo "<sys/file.h> defines the *_OK access constants." >&4
7311         elif $test `./findhdr fcntl.h` && \
7312                 $cc $cppflags -DI_FCNTL -o access access.c >/dev/null 2>&1 ; then
7313                 h_fcntl=true;
7314                 echo "<fcntl.h> defines the *_OK access constants." >&4
7315         elif $test `./findhdr unistd.h` && \
7316                 $cc $cppflags -DI_UNISTD -o access access.c >/dev/null 2>&1 ; then
7317                 echo "<unistd.h> defines the *_OK access constants." >&4
7318         else
7319                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
7320         fi
7321         ;;
7322 esac
7323 $rm -f access*
7324
7325 : see if accessx exists
7326 set accessx d_accessx
7327 eval $inlibc
7328
7329 : see if alarm exists
7330 set alarm d_alarm
7331 eval $inlibc
7332
7333 : see if atolf exists
7334 set atolf d_atolf
7335 eval $inlibc
7336
7337 : see if atoll exists
7338 set atoll d_atoll
7339 eval $inlibc
7340
7341 : Look for GNU-cc style attribute checking
7342 echo " "
7343 echo "Checking whether your compiler can handle __attribute__ ..." >&4
7344 $cat >attrib.c <<'EOCP'
7345 #include <stdio.h>
7346 void croak (char* pat,...) __attribute__((format(printf,1,2),noreturn));
7347 EOCP
7348 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
7349         if $contains 'warning' attrib.out >/dev/null 2>&1; then
7350                 echo "Your C compiler doesn't fully support __attribute__."
7351                 val="$undef"
7352         else
7353                 echo "Your C compiler supports __attribute__."
7354                 val="$define"
7355         fi
7356 else
7357         echo "Your C compiler doesn't seem to understand __attribute__ at all."
7358         val="$undef"
7359 fi
7360 set d_attribut
7361 eval $setvar
7362 $rm -f attrib*
7363
7364 : see if bcmp exists
7365 set bcmp d_bcmp
7366 eval $inlibc
7367
7368 : see if bcopy exists
7369 set bcopy d_bcopy
7370 eval $inlibc
7371
7372 : see if this is a unistd.h system
7373 set unistd.h i_unistd
7374 eval $inhdr
7375
7376 : see if getpgrp exists
7377 set getpgrp d_getpgrp
7378 eval $inlibc
7379
7380 case "$d_getpgrp" in
7381 "$define")
7382         echo " "
7383         echo "Checking to see which flavor of getpgrp is in use..."
7384         $cat >set.c <<EOP
7385 #$i_unistd I_UNISTD
7386 #include <sys/types.h>
7387 #ifdef I_UNISTD
7388 #  include <unistd.h>
7389 #endif
7390 int main()
7391 {
7392         if (getuid() == 0) {
7393                 printf("(I see you are running Configure as super-user...)\n");
7394                 setuid(1);
7395         }
7396 #ifdef TRY_BSD_PGRP
7397         if (getpgrp(1) == 0)
7398                 exit(0);
7399 #else
7400         if (getpgrp() > 0)
7401                 exit(0);
7402 #endif
7403         exit(1);
7404 }
7405 EOP
7406         if $cc -DTRY_BSD_PGRP $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7407                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
7408                 val="$define"
7409         elif $cc $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7410                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
7411                 val="$undef"
7412         else
7413                 echo "I can't seem to compile and run the test program."
7414                 if ./usg; then
7415                         xxx="a USG one, i.e. you use getpgrp()."
7416                 else
7417                         # SVR4 systems can appear rather BSD-ish.
7418                         case "$i_unistd" in
7419                         $undef)
7420                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
7421                                 val="$define"
7422                                 ;;
7423                         $define)
7424                                 xxx="probably a USG one, i.e. you use getpgrp()."
7425                                 val="$undef"
7426                                 ;;
7427                         esac
7428                 fi
7429                 echo "Assuming your getpgrp is $xxx" >&4
7430         fi
7431         ;;
7432 *) val="$undef";;
7433 esac
7434 set d_bsdgetpgrp
7435 eval $setvar
7436 $rm -f set set.c
7437
7438 : see if setpgrp exists
7439 set setpgrp d_setpgrp
7440 eval $inlibc
7441
7442 case "$d_setpgrp" in
7443 "$define")
7444         echo " "
7445         echo "Checking to see which flavor of setpgrp is in use..."
7446         $cat >set.c <<EOP
7447 #$i_unistd I_UNISTD
7448 #include <sys/types.h>
7449 #ifdef I_UNISTD
7450 #  include <unistd.h>
7451 #endif
7452 int main()
7453 {
7454         if (getuid() == 0) {
7455                 printf("(I see you are running Configure as super-user...)\n");
7456                 setuid(1);
7457         }
7458 #ifdef TRY_BSD_PGRP
7459         if (-1 == setpgrp(1, 1))
7460                 exit(0);
7461 #else
7462         if (setpgrp() != -1)
7463                 exit(0);
7464 #endif
7465         exit(1);
7466 }
7467 EOP
7468         if $cc -DTRY_BSD_PGRP $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7469                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
7470                 val="$define"
7471         elif $cc $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7472                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
7473                 val="$undef"
7474         else
7475                 echo "(I can't seem to compile and run the test program.)"
7476                 if ./usg; then
7477                         xxx="a USG one, i.e. you use setpgrp()."
7478                 else
7479                         # SVR4 systems can appear rather BSD-ish.
7480                         case "$i_unistd" in
7481                         $undef)
7482                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
7483                                 val="$define"
7484                                 ;;
7485                         $define)
7486                                 xxx="probably a USG one, i.e. you use setpgrp()."
7487                                 val="$undef"
7488                                 ;;
7489                         esac
7490                 fi
7491                 echo "Assuming your setpgrp is $xxx" >&4
7492         fi
7493         ;;
7494 *) val="$undef";;
7495 esac
7496 set d_bsdsetpgrp
7497 eval $setvar
7498 $rm -f set set.c
7499 : see if bzero exists
7500 set bzero d_bzero
7501 eval $inlibc
7502
7503 : see if signal is declared as pointer to function returning int or void
7504 echo " "
7505 xxx=`./findhdr signal.h`
7506 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
7507 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
7508         echo "You have int (*signal())() instead of void." >&4
7509         val="$undef"
7510 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
7511         echo "You have void (*signal())()." >&4
7512         val="$define"
7513 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
7514         echo "You have int (*signal())() instead of void." >&4
7515         val="$undef"
7516 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
7517         echo "You have void (*signal())()." >&4
7518         val="$define"
7519 else
7520         case "$d_voidsig" in
7521         '')
7522         echo "I can't determine whether signal handler returns void or int..." >&4
7523                 dflt=void
7524                 rp="What type does your signal handler return?"
7525                 . ./myread
7526                 case "$ans" in
7527                 v*) val="$define";;
7528                 *) val="$undef";;
7529                 esac;;
7530         "$define")
7531                 echo "As you already told me, signal handler returns void." >&4
7532                 val="$define"
7533                 ;;
7534         *)      echo "As you already told me, signal handler returns int." >&4
7535                 val="$undef"
7536                 ;;
7537         esac
7538 fi
7539 set d_voidsig
7540 eval $setvar
7541 case "$d_voidsig" in
7542 "$define") signal_t="void";;
7543 *) signal_t="int";;
7544 esac
7545 $rm -f $$.tmp
7546
7547 : check for ability to cast large floats to 32-bit ints.
7548 echo " "
7549 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
7550 if $test "$intsize" -ge 4; then
7551         xxx=int
7552 else
7553         xxx=long
7554 fi
7555 $cat >try.c <<EOCP
7556 #include <stdio.h>
7557 #include <sys/types.h>
7558 #include <signal.h>
7559 $signal_t blech(s) int s; { exit(3); }
7560 int main()
7561 {
7562         $xxx i32;
7563         double f, g;
7564         int result = 0;
7565         char str[16];
7566         signal(SIGFPE, blech);
7567
7568         /* Don't let compiler optimize the test away.  Store the number 
7569            in a writable string for gcc to pass to sscanf under HP/UX.
7570         */
7571         sprintf(str, "2147483647");
7572         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
7573         g = 10 * f;
7574         i32  = ($xxx) g;
7575
7576         /* x86 processors will probably give 0x8000 0000, which is a
7577        sign change.  We don't want that.  We want to mimic SPARC
7578            behavior here, which is to preserve the sign and give
7579            back 0x7fff ffff.
7580         */
7581         if (i32 != ($xxx) f)
7582                 result |= 1;
7583         exit(result);
7584 }
7585 EOCP
7586 set try
7587 if eval $compile_ok; then
7588         ./try
7589         yyy=$?
7590 else
7591         echo "(I can't seem to compile the test program--assuming it can't)"
7592         yyy=1
7593 fi
7594 case "$yyy" in
7595 0)      val="$define"
7596         echo "Yup, it can."
7597         ;;
7598 *)      val="$undef"
7599         echo "Nope, it can't."
7600         ;;
7601 esac
7602 set d_casti32
7603 eval $setvar
7604 $rm -f try try.*
7605
7606 : check for ability to cast negative floats to unsigned
7607 echo " "
7608 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
7609 $cat >try.c <<EOCP
7610 #include <stdio.h>
7611 #include <sys/types.h>
7612 #include <signal.h>
7613 $signal_t blech(s) int s; { exit(7); }
7614 $signal_t blech_in_list(s) int s; { exit(4); }
7615 unsigned long dummy_long(p) unsigned long p; { return p; }
7616 unsigned int dummy_int(p) unsigned int p; { return p; }
7617 unsigned short dummy_short(p) unsigned short p; { return p; }
7618 int main()
7619 {
7620         double f;
7621         unsigned long along;
7622         unsigned int aint;
7623         unsigned short ashort;
7624         int result = 0;
7625         char str[16];
7626         
7627         /* Frustrate gcc-2.7.2's optimizer which failed this test with
7628            a direct f = -123. assignment.  gcc-2.8.0 reportedly
7629            optimized the whole file away
7630         */
7631         /* Store the number in a writable string for gcc to pass to 
7632            sscanf under HP/UX.
7633         */
7634         sprintf(str, "-123");
7635         sscanf(str, "%lf", &f);  /* f = -123.; */
7636
7637         signal(SIGFPE, blech);
7638         along = (unsigned long)f;
7639         aint = (unsigned int)f;
7640         ashort = (unsigned short)f;
7641         if (along != (unsigned long)-123)
7642                 result |= 1;
7643         if (aint != (unsigned int)-123)
7644                 result |= 1;
7645         if (ashort != (unsigned short)-123)
7646                 result |= 1;
7647         sprintf(str, "1073741824.");
7648         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
7649         f = f + f;
7650         along = 0;
7651         along = (unsigned long)f;
7652         if (along != 0x80000000)
7653                 result |= 2;
7654         f -= 1.;
7655         along = 0;
7656         along = (unsigned long)f;
7657         if (along != 0x7fffffff)
7658                 result |= 1;
7659         f += 2.;
7660         along = 0;
7661         along = (unsigned long)f;
7662         if (along != 0x80000001)
7663                 result |= 2;
7664         if (result)
7665                 exit(result);
7666         signal(SIGFPE, blech_in_list);
7667         sprintf(str, "123.");
7668         sscanf(str, "%lf", &f);  /* f = 123.; */
7669         along = dummy_long((unsigned long)f);
7670         aint = dummy_int((unsigned int)f);
7671         ashort = dummy_short((unsigned short)f);
7672         if (along != (unsigned long)123)
7673                 result |= 4;
7674         if (aint != (unsigned int)123)
7675                 result |= 4;
7676         if (ashort != (unsigned short)123)
7677                 result |= 4;
7678         exit(result);
7679
7680 }
7681 EOCP
7682 set try
7683 if eval $compile_ok; then
7684         ./try
7685         castflags=$?
7686 else
7687         echo "(I can't seem to compile the test program--assuming it can't)"
7688         castflags=7
7689 fi
7690 case "$castflags" in
7691 0)      val="$define"
7692         echo "Yup, it can."
7693         ;;
7694 *)      val="$undef"
7695         echo "Nope, it can't."
7696         ;;
7697 esac
7698 set d_castneg
7699 eval $setvar
7700 $rm -f try.*
7701
7702 : see if vprintf exists
7703 echo " "
7704 if set vprintf val -f d_vprintf; eval $csym; $val; then
7705         echo 'vprintf() found.' >&4
7706         val="$define"
7707         $cat >vprintf.c <<'EOF'
7708 #include <varargs.h>
7709
7710 int main() { xxx("foo"); }
7711
7712 xxx(va_alist)
7713 va_dcl
7714 {
7715         va_list args;
7716         char buf[10];
7717
7718         va_start(args);
7719         exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
7720 }
7721 EOF
7722         set vprintf
7723         if eval $compile && ./vprintf; then
7724                 echo "Your vsprintf() returns (int)." >&4
7725                 val2="$undef"
7726         else
7727                 echo "Your vsprintf() returns (char*)." >&4
7728                 val2="$define"
7729         fi
7730 else
7731         echo 'vprintf() NOT found.' >&4
7732                 val="$undef"
7733                 val2="$undef"
7734 fi
7735 set d_vprintf
7736 eval $setvar
7737 val=$val2
7738 set d_charvspr
7739 eval $setvar
7740
7741 : see if chown exists
7742 set chown d_chown
7743 eval $inlibc
7744
7745 : see if chroot exists
7746 set chroot d_chroot
7747 eval $inlibc
7748
7749 : see if chsize exists
7750 set chsize d_chsize
7751 eval $inlibc
7752
7753 : check for const keyword
7754 echo " "
7755 echo 'Checking to see if your C compiler knows about "const"...' >&4
7756 $cat >const.c <<'EOCP'
7757 typedef struct spug { int drokk; } spug;
7758 int main()
7759 {
7760         const char *foo;
7761         const spug y;
7762 }
7763 EOCP
7764 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
7765         val="$define"
7766         echo "Yup, it does."
7767 else
7768         val="$undef"
7769         echo "Nope, it doesn't."
7770 fi
7771 set d_const
7772 eval $setvar
7773
7774 : see if crypt exists
7775 echo " "
7776 if set crypt val -f d_crypt; eval $csym; $val; then
7777         echo 'crypt() found.' >&4
7778         val="$define"
7779         cryptlib=''
7780 else
7781         cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
7782         if $test -z "$cryptlib"; then
7783                 cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
7784         else
7785                 cryptlib=-lcrypt
7786         fi
7787         if $test -z "$cryptlib"; then
7788                 cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
7789         else
7790                 cryptlib=-lcrypt
7791         fi
7792         if $test -z "$cryptlib"; then
7793                 cryptlib=`./loc libcrypt$_a "" $libpth`
7794         else
7795                 cryptlib=-lcrypt
7796         fi
7797         if $test -z "$cryptlib"; then
7798                 echo 'crypt() NOT found.' >&4
7799                 val="$undef"
7800         else
7801                 val="$define"
7802         fi
7803 fi
7804 set d_crypt
7805 eval $setvar
7806
7807 : get csh whereabouts
7808 case "$csh" in
7809 'csh') val="$undef" ;;
7810 *) val="$define" ;;
7811 esac
7812 set d_csh
7813 eval $setvar
7814 : Respect a hint or command line value for full_csh.
7815 case "$full_csh" in
7816 '') full_csh=$csh ;;
7817 esac
7818
7819 : see if cuserid exists
7820 set cuserid d_cuserid
7821 eval $inlibc
7822
7823 : see if this is a limits.h system
7824 set limits.h i_limits
7825 eval $inhdr
7826
7827 : see if this is a float.h system
7828 set float.h i_float
7829 eval $inhdr
7830
7831 : See if number of significant digits in a double precision number is known
7832 echo " "
7833 $cat >dbl_dig.c <<EOM
7834 #$i_limits I_LIMITS
7835 #$i_float I_FLOAT
7836 #ifdef I_LIMITS
7837 #include <limits.h>
7838 #endif
7839 #ifdef I_FLOAT
7840 #include <float.h>
7841 #endif
7842 #ifdef DBL_DIG
7843 printf("Contains DBL_DIG");
7844 #endif
7845 EOM
7846 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
7847 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
7848         echo "DBL_DIG found." >&4
7849         val="$define"
7850 else
7851         echo "DBL_DIG NOT found." >&4
7852         val="$undef"
7853 fi
7854 $rm -f dbl_dig.?
7855 set d_dbl_dig
7856 eval $setvar
7857
7858 : see if difftime exists
7859 set difftime d_difftime
7860 eval $inlibc
7861
7862 : see if this is a dirent system
7863 echo " "
7864 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
7865         val="$define"
7866         echo "<dirent.h> found." >&4
7867 else
7868         val="$undef"
7869         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
7870                 echo "<sys/dir.h> found." >&4
7871                 echo " "
7872         else
7873                 xinc=`./findhdr sys/ndir.h`
7874         fi
7875         echo "<dirent.h> NOT found." >&4
7876 fi
7877 set i_dirent
7878 eval $setvar
7879
7880 : Look for type of directory structure.
7881 echo " "
7882 $cppstdin $cppflags $cppminus < "$xinc" > try.c
7883
7884 case "$direntrytype" in
7885 ''|' ')
7886         case "$i_dirent" in
7887         $define) guess1='struct dirent' ;;
7888         *) guess1='struct direct'  ;;
7889         esac
7890         ;;
7891 *)      guess1="$direntrytype"
7892         ;;
7893 esac
7894
7895 case "$guess1" in
7896 'struct dirent') guess2='struct direct' ;;
7897 *) guess2='struct dirent' ;;
7898 esac
7899                 
7900 if $contains "$guess1" try.c >/dev/null 2>&1; then
7901         direntrytype="$guess1"
7902         echo "Your directory entries are $direntrytype." >&4
7903 elif $contains "$guess2" try.c >/dev/null 2>&1; then
7904         direntrytype="$guess2"
7905         echo "Your directory entries seem to be $direntrytype." >&4
7906 else
7907         echo "I don't recognize your system's directory entries." >&4
7908         rp="What type is used for directory entries on this system?"
7909         dflt="$guess1"
7910         . ./myread
7911         direntrytype="$ans"
7912 fi
7913 $rm -f try.c
7914
7915
7916 : see if the directory entry stores field length
7917 echo " "
7918 $cppstdin $cppflags $cppminus < "$xinc" > try.c
7919 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
7920         echo "Good, your directory entry keeps length information in d_namlen." >&4
7921         val="$define"
7922 else
7923         echo "Your directory entry does not know about the d_namlen field." >&4
7924         val="$undef"
7925 fi
7926 set d_dirnamlen
7927 eval $setvar
7928 $rm -f try.c
7929
7930 : see if dlerror exists
7931 xxx_runnm="$runnm"
7932 runnm=false
7933 set dlerror d_dlerror
7934 eval $inlibc
7935 runnm="$xxx_runnm"
7936
7937 : see if dlfcn is available
7938 set dlfcn.h i_dlfcn
7939 eval $inhdr
7940
7941 case "$usedl" in
7942 $define|y|true)
7943         $cat << EOM
7944
7945 On a few systems, the dynamically loaded modules that perl generates and uses
7946 will need a different extension than shared libs. The default will probably
7947 be appropriate.
7948
7949 EOM
7950         case "$dlext" in
7951         '')     dflt="$so" ;;
7952         *)      dflt="$dlext" ;;
7953         esac
7954         rp='What is the extension of dynamically loaded modules'
7955         . ./myread
7956         dlext="$ans"
7957         ;;
7958 *)
7959         dlext="none"
7960         ;;
7961 esac
7962
7963 : Check if dlsym need a leading underscore
7964 echo " "
7965 val="$undef"
7966
7967 case "$dlsrc" in
7968 dl_dlopen.xs)
7969         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
7970         $cat >dyna.c <<'EOM'
7971 fred () { }
7972 EOM
7973
7974 $cat >fred.c<<EOM
7975
7976 #include <stdio.h>
7977 #$i_dlfcn I_DLFCN
7978 #ifdef I_DLFCN
7979 #include <dlfcn.h>      /* the dynamic linker include file for Sunos/Solaris */
7980 #else
7981 #include <sys/types.h>
7982 #include <nlist.h>
7983 #include <link.h>
7984 #endif
7985
7986 extern int fred() ;
7987
7988 int main()
7989 {
7990     void * handle ;
7991     void * symbol ;
7992 #ifndef RTLD_LAZY
7993     int mode = 1 ;
7994 #else
7995     int mode = RTLD_LAZY ;
7996 #endif
7997     handle = dlopen("./dyna.$dlext", mode) ;
7998     if (handle == NULL) {
7999         printf ("1\n") ;
8000         fflush (stdout) ;
8001         exit(0);
8002     }
8003     symbol = dlsym(handle, "fred") ;
8004     if (symbol == NULL) {
8005         /* try putting a leading underscore */
8006         symbol = dlsym(handle, "_fred") ;
8007         if (symbol == NULL) {
8008             printf ("2\n") ;
8009             fflush (stdout) ;
8010             exit(0);
8011         }
8012         printf ("3\n") ;
8013     }
8014     else
8015         printf ("4\n") ;
8016     fflush (stdout) ;
8017     exit(0);
8018 }
8019 EOM
8020         : Call the object file tmp-dyna.o in case dlext=o.
8021         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 && 
8022                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 && 
8023                 $ld $lddlflags -o dyna.$dlext tmp-dyna${_o} > /dev/null 2>&1 && 
8024                 $cc $ccflags -o fred $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1; then
8025                 xxx=`./fred`
8026                 case $xxx in
8027                 1)      echo "Test program failed using dlopen." >&4
8028                         echo "Perhaps you should not use dynamic loading." >&4;;
8029                 2)      echo "Test program failed using dlsym." >&4
8030                         echo "Perhaps you should not use dynamic loading." >&4;;
8031                 3)      echo "dlsym needs a leading underscore" >&4
8032                         val="$define" ;;
8033                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
8034                 esac
8035         else
8036                 echo "I can't compile and run the test program." >&4
8037                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
8038         fi
8039         ;;
8040 esac
8041                 
8042 $rm -f fred fred.? dyna.$dlext dyna.? tmp-dyna.?
8043
8044 set d_dlsymun
8045 eval $setvar
8046
8047 hasproto='varname=$1; func=$2; shift; shift;
8048 while $test $# -ge 2; do
8049         case "$1" in
8050         $define) echo "#include <$2>";;
8051         esac ;
8052     shift 2;
8053 done > try.c;
8054 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
8055 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
8056         echo "$func() prototype found.";
8057         val="$define";
8058 else
8059         echo "$func() prototype NOT found.";
8060         val="$undef";
8061 fi;
8062 set $varname;
8063 eval $setvar;
8064 $rm -f try.c tryout.c'
8065
8066 : see if prototype for drand48 is available
8067 echo " "
8068 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
8069 eval $hasproto
8070
8071 : see if dup2 exists
8072 set dup2 d_dup2
8073 eval $inlibc
8074
8075 : see if eaccess exists
8076 set eaccess d_eaccess
8077 eval $inlibc
8078
8079 : see if endgrent exists
8080 set endgrent d_endgrent
8081 eval $inlibc
8082
8083 : see if endhostent exists
8084 set endhostent d_endhent
8085 eval $inlibc
8086
8087 : see if endnetent exists
8088 set endnetent d_endnent
8089 eval $inlibc
8090
8091 : see if endprotoent exists
8092 set endprotoent d_endpent
8093 eval $inlibc
8094
8095 : see if endpwent exists
8096 set endpwent d_endpwent
8097 eval $inlibc
8098
8099 : see if endservent exists
8100 set endservent d_endsent
8101 eval $inlibc
8102
8103 : see if endspent exists
8104 set endspent d_endspent
8105 eval $inlibc
8106
8107 : Locate the flags for 'open()'
8108 echo " "
8109 $cat >open3.c <<'EOCP'
8110 #include <sys/types.h>
8111 #ifdef I_FCNTL
8112 #include <fcntl.h>
8113 #endif
8114 #ifdef I_SYS_FILE
8115 #include <sys/file.h>
8116 #endif
8117 int main() {
8118         if(O_RDONLY);
8119 #ifdef O_TRUNC
8120         exit(0);
8121 #else
8122         exit(1);
8123 #endif
8124 }
8125 EOCP
8126 : check sys/file.h first to get FREAD on Sun
8127 if $test `./findhdr sys/file.h` && \
8128                 set open3 -DI_SYS_FILE && eval $compile; then
8129         h_sysfile=true;
8130         echo "<sys/file.h> defines the O_* constants..." >&4
8131         if ./open3; then
8132                 echo "and you have the 3 argument form of open()." >&4
8133                 val="$define"
8134         else
8135                 echo "but not the 3 argument form of open().  Oh, well." >&4
8136                 val="$undef"
8137         fi
8138 elif $test `./findhdr fcntl.h` && \
8139                 set open3 -DI_FCNTL && eval $compile; then
8140         h_fcntl=true;
8141         echo "<fcntl.h> defines the O_* constants..." >&4
8142         if ./open3; then
8143                 echo "and you have the 3 argument form of open()." >&4
8144                 val="$define"
8145         else
8146                 echo "but not the 3 argument form of open().  Oh, well." >&4
8147                 val="$undef"
8148         fi
8149 else
8150         val="$undef"
8151         echo "I can't find the O_* constant definitions!  You got problems." >&4
8152 fi
8153 set d_open3
8154 eval $setvar
8155 $rm -f open3*
8156
8157 : see which of string.h or strings.h is needed
8158 echo " "
8159 strings=`./findhdr string.h`
8160 if $test "$strings" && $test -r "$strings"; then
8161         echo "Using <string.h> instead of <strings.h>." >&4
8162         val="$define"
8163 else
8164         val="$undef"
8165         strings=`./findhdr strings.h`
8166         if $test "$strings" && $test -r "$strings"; then
8167                 echo "Using <strings.h> instead of <string.h>." >&4
8168         else
8169                 echo "No string header found -- You'll surely have problems." >&4
8170         fi
8171 fi
8172 set i_string
8173 eval $setvar
8174 case "$i_string" in
8175 "$undef") strings=`./findhdr strings.h`;;
8176 *)        strings=`./findhdr string.h`;;
8177 esac
8178
8179 : check for non-blocking I/O stuff
8180 case "$h_sysfile" in
8181 true) echo "#include <sys/file.h>" > head.c;;
8182 *)
8183         case "$h_fcntl" in
8184         true) echo "#include <fcntl.h>" > head.c;;
8185         *) echo "#include <sys/fcntl.h>" > head.c;;
8186         esac
8187         ;;
8188 esac
8189 echo " "
8190 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
8191 case "$o_nonblock" in
8192 '')
8193         $cat head.c > try.c
8194         $cat >>try.c <<'EOCP'
8195 #include <stdio.h>
8196 int main() {
8197 #ifdef O_NONBLOCK
8198         printf("O_NONBLOCK\n");
8199         exit(0);
8200 #endif
8201 #ifdef O_NDELAY
8202         printf("O_NDELAY\n");
8203         exit(0);
8204 #endif
8205 #ifdef FNDELAY
8206         printf("FNDELAY\n");
8207         exit(0);
8208 #endif
8209         exit(0);
8210 }
8211 EOCP
8212         set try
8213         if eval $compile_ok; then
8214                 o_nonblock=`./try`
8215                 case "$o_nonblock" in
8216                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
8217                 *) echo "Seems like we can use $o_nonblock.";;
8218                 esac
8219         else
8220                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
8221         fi
8222         ;;
8223 *) echo "Using $hint value $o_nonblock.";;
8224 esac
8225 $rm -f try try.* .out core
8226
8227 echo " "
8228 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
8229 case "$eagain" in
8230 '')
8231         $cat head.c > try.c
8232         $cat >>try.c <<EOCP
8233 #include <errno.h>
8234 #include <sys/types.h>
8235 #include <signal.h>
8236 #include <stdio.h> 
8237 #define MY_O_NONBLOCK $o_nonblock
8238 #ifndef errno  /* XXX need better Configure test */
8239 extern int errno;
8240 #endif
8241 #$i_unistd I_UNISTD
8242 #ifdef I_UNISTD
8243 #include <unistd.h>
8244 #endif
8245 #ifdef $i_string
8246 #include <string.h>
8247 #else
8248 #include <strings.h>
8249 #endif
8250 $signal_t blech(x) int x; { exit(3); }
8251 EOCP
8252         $cat >> try.c <<'EOCP'
8253 int main()
8254 {
8255         int pd[2];
8256         int pu[2];
8257         char buf[1];
8258         char string[100];
8259
8260         pipe(pd);       /* Down: child -> parent */
8261         pipe(pu);       /* Up: parent -> child */
8262         if (0 != fork()) {
8263                 int ret;
8264                 close(pd[1]);   /* Parent reads from pd[0] */
8265                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
8266                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
8267                         exit(1);
8268                 signal(SIGALRM, blech);
8269                 alarm(5);
8270                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
8271                         exit(2);
8272                 sprintf(string, "%d\n", ret);
8273                 write(2, string, strlen(string));
8274                 alarm(0);
8275 #ifdef EAGAIN
8276                 if (errno == EAGAIN) {
8277                         printf("EAGAIN\n");
8278                         goto ok;
8279                 }
8280 #endif
8281 #ifdef EWOULDBLOCK
8282                 if (errno == EWOULDBLOCK)
8283                         printf("EWOULDBLOCK\n");
8284 #endif
8285         ok:
8286                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
8287                 sleep(2);                               /* Give it time to close our pipe */
8288                 alarm(5);
8289                 ret = read(pd[0], buf, 1);      /* Should read EOF */
8290                 alarm(0);
8291                 sprintf(string, "%d\n", ret);
8292                 write(3, string, strlen(string));
8293                 exit(0);
8294         }
8295
8296         close(pd[0]);                   /* We write to pd[1] */
8297         close(pu[1]);                   /* We read from pu[0] */
8298         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
8299         close(pd[1]);                   /* Pipe pd is now fully closed! */
8300         exit(0);                                /* Bye bye, thank you for playing! */
8301 }
8302 EOCP
8303         set try
8304         if eval $compile_ok; then
8305                 echo "$startsh" >mtry
8306                 echo "./try >try.out 2>try.ret 3>try.err || exit 4" >>mtry
8307                 chmod +x mtry
8308                 ./mtry >/dev/null 2>&1
8309                 case $? in
8310                 0) eagain=`$cat try.out`;;
8311                 1) echo "Could not perform non-blocking setting!";;
8312                 2) echo "I did a successful read() for something that was not there!";;
8313                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
8314                 *) echo "Something terribly wrong happened during testing.";;
8315                 esac
8316                 rd_nodata=`$cat try.ret`
8317                 echo "A read() system call with no data present returns $rd_nodata."
8318                 case "$rd_nodata" in
8319                 0|-1) ;;
8320                 *)
8321                         echo "(That's peculiar, fixing that to be -1.)"
8322                         rd_nodata=-1
8323                         ;;
8324                 esac
8325                 case "$eagain" in
8326                 '')
8327                         echo "Forcing errno EAGAIN on read() with no data available."
8328                         eagain=EAGAIN
8329                         ;;
8330                 *)
8331                         echo "Your read() sets errno to $eagain when no data is available."
8332                         ;;
8333                 esac
8334                 status=`$cat try.err`
8335                 case "$status" in
8336                 0) echo "And it correctly returns 0 to signal EOF.";;
8337                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
8338                 *) echo "However, your read() returns '$status' on EOF??";;
8339                 esac
8340                 val="$define"
8341                 if test "$status" = "$rd_nodata"; then
8342                         echo "WARNING: you can't distinguish between EOF and no data!"
8343                         val="$undef"
8344                 fi
8345         else
8346                 echo "I can't compile the test program--assuming errno EAGAIN will do."
8347                 eagain=EAGAIN
8348         fi
8349         set d_eofnblk
8350         eval $setvar
8351         ;;
8352 *)
8353         echo "Using $hint value $eagain."
8354         echo "Your read() returns $rd_nodata when no data is present."
8355         case "$d_eofnblk" in
8356         "$define") echo "And you can see EOF because read() returns 0.";;
8357         "$undef") echo "But you can't see EOF status from read() returned value.";;
8358         *)
8359                 echo "(Assuming you can't see EOF status from read anyway.)"
8360                 d_eofnblk=$undef
8361                 ;;
8362         esac
8363         ;;
8364 esac
8365 $rm -f try try.* .out core head.c mtry
8366
8367 : see if fchmod exists
8368 set fchmod d_fchmod
8369 eval $inlibc
8370
8371 : see if fchown exists
8372 set fchown d_fchown
8373 eval $inlibc
8374
8375 : see if this is an fcntl system
8376 set fcntl d_fcntl
8377 eval $inlibc
8378
8379 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
8380 while $test $# -ge 2; do
8381         case "$1" in
8382         $define) echo "#include <$2>";;
8383         esac ;
8384     shift 2;
8385 done > try.c;
8386 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
8387 set try;
8388 if eval $compile; then
8389         val="$define";
8390 else
8391         val="$undef";
8392 fi;
8393 set $varname;
8394 eval $setvar;
8395 $rm -f try.c try.o'
8396
8397 socketlib=''
8398 sockethdr=''
8399 : see whether socket exists
8400 echo " "
8401 $echo $n "Hmm... $c" >&4
8402 if set socket val -f d_socket; eval $csym; $val; then
8403         echo "Looks like you have Berkeley networking support." >&4
8404         d_socket="$define"
8405         if set setsockopt val -f; eval $csym; $val; then
8406                 d_oldsock="$undef"
8407         else
8408                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
8409                 d_oldsock="$define"
8410         fi
8411 else
8412         if $contains socklib libc.list >/dev/null 2>&1; then
8413                 echo "Looks like you have Berkeley networking support." >&4
8414                 d_socket="$define"
8415                 : we will have to assume that it supports the 4.2 BSD interface
8416                 d_oldsock="$undef"
8417         else
8418                 echo "You don't have Berkeley networking in libc$_a..." >&4
8419                 if test "X$d_socket" = "X$define"; then
8420                    echo "...but you seem to believe that you have sockets." >&4
8421                 else
8422                         for net in net socket
8423                         do
8424                                 if test -f /usr/lib/lib$net$_a; then
8425                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
8426                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
8427                                         if $contains socket libc.list >/dev/null 2>&1; then
8428                                                 d_socket="$define"
8429                                                 socketlib="-l$net"
8430                                                 case "$net" in
8431                                                 net)
8432                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
8433                                                         sockethdr="-I/usr/netinclude"
8434                                                         ;;
8435                                                 esac
8436                                                 echo "Found Berkeley sockets interface in lib$net." >& 4 
8437                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
8438                                                         d_oldsock="$undef"
8439                                                 else
8440                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
8441                                                         d_oldsock="$define"
8442                                                 fi
8443                                                 break
8444                                         fi
8445                                 fi
8446                         done
8447                         if test "X$d_socket" != "X$define"; then
8448                            echo "or anywhere else I see." >&4
8449                            d_socket="$undef"
8450                            d_oldsock="$undef"
8451                         fi
8452                 fi
8453         fi
8454 fi
8455
8456 : see if socketpair exists
8457 set socketpair d_sockpair
8458 eval $inlibc
8459
8460
8461 echo " "
8462 echo "Checking the availability of certain socket constants..." >& 4
8463 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
8464         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
8465         $cat >try.c <<EOF
8466 #include <sys/types.h>
8467 #include <sys/socket.h>
8468 int main() {
8469     int i = $ENUM;
8470 }
8471 EOF
8472         val="$undef"
8473         set try; if eval $compile; then
8474                 val="$define"
8475         fi
8476         set d_${enum}; eval $setvar
8477         $rm -f try.c try
8478 done
8479
8480 : see if sys/select.h has to be included
8481 set sys/select.h i_sysselct
8482 eval $inhdr
8483
8484 : see if we should include time.h, sys/time.h, or both
8485 echo " "
8486 if test "X$timeincl" = X; then
8487         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
8488         $echo $n "I'm now running the test program...$c"
8489         $cat >try.c <<'EOCP'
8490 #include <sys/types.h>
8491 #ifdef I_TIME
8492 #include <time.h>
8493 #endif
8494 #ifdef I_SYSTIME
8495 #ifdef SYSTIMEKERNEL
8496 #define KERNEL
8497 #endif
8498 #include <sys/time.h>
8499 #endif
8500 #ifdef I_SYSSELECT
8501 #include <sys/select.h>
8502 #endif
8503 int main()
8504 {
8505         struct tm foo;
8506 #ifdef S_TIMEVAL
8507         struct timeval bar;
8508 #endif
8509 #ifdef S_TIMEZONE
8510         struct timezone tzp;
8511 #endif
8512         if (foo.tm_sec == foo.tm_sec)
8513                 exit(0);
8514 #ifdef S_TIMEVAL
8515         if (bar.tv_sec == bar.tv_sec)
8516                 exit(0);
8517 #endif
8518         exit(1);
8519 }
8520 EOCP
8521         flags=''
8522         for s_timezone in '-DS_TIMEZONE' ''; do
8523         sysselect=''
8524         for s_timeval in '-DS_TIMEVAL' ''; do
8525         for i_systimek in '' '-DSYSTIMEKERNEL'; do
8526         for i_time in '' '-DI_TIME'; do
8527         for i_systime in '-DI_SYSTIME' ''; do
8528                 case "$flags" in
8529                 '') $echo $n ".$c"
8530                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
8531                         if eval $compile; then
8532                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
8533                                 shift
8534                                 flags="$*"
8535                                 echo " "
8536                                 $echo $n "Succeeded with $flags$c"
8537                         fi
8538                         ;;
8539                 esac
8540         done
8541         done
8542         done
8543         done
8544         done
8545         timeincl=''
8546         echo " "
8547         case "$flags" in
8548         *SYSTIMEKERNEL*) i_systimek="$define"
8549                 timeincl=`./findhdr sys/time.h`
8550                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
8551         *) i_systimek="$undef";;
8552         esac
8553         case "$flags" in
8554         *I_TIME*) i_time="$define"
8555                 timeincl=`./findhdr time.h`" $timeincl"
8556                 echo "We'll include <time.h>." >&4;;
8557         *) i_time="$undef";;
8558         esac
8559         case "$flags" in
8560         *I_SYSTIME*) i_systime="$define"
8561                 timeincl=`./findhdr sys/time.h`" $timeincl"
8562                 echo "We'll include <sys/time.h>." >&4;;
8563         *) i_systime="$undef";;
8564         esac
8565         $rm -f try.c try
8566 fi
8567
8568 : check for fd_set items
8569 $cat <<EOM
8570
8571 Checking to see how well your C compiler handles fd_set and friends ...
8572 EOM
8573 $cat >fd_set.c <<EOCP
8574 #$i_systime I_SYS_TIME
8575 #$i_sysselct I_SYS_SELECT
8576 #$d_socket HAS_SOCKET
8577 #include <sys/types.h>
8578 #ifdef HAS_SOCKET
8579 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
8580 #endif
8581 #ifdef I_SYS_TIME
8582 #include <sys/time.h>
8583 #endif
8584 #ifdef I_SYS_SELECT
8585 #include <sys/select.h>
8586 #endif
8587 int main() {
8588         fd_set fds;
8589
8590 #ifdef TRYBITS
8591         if(fds.fds_bits);
8592 #endif
8593
8594 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
8595         exit(0);
8596 #else
8597         exit(1);
8598 #endif
8599 }
8600 EOCP
8601 set fd_set -DTRYBITS
8602 if eval $compile; then
8603         d_fds_bits="$define"
8604         d_fd_set="$define"
8605         echo "Well, your system knows about the normal fd_set typedef..." >&4
8606         if ./fd_set; then
8607                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
8608                 d_fd_macros="$define"
8609         else
8610                 $cat >&4 <<'EOM'
8611 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
8612 EOM
8613                 d_fd_macros="$undef"
8614         fi
8615 else
8616         $cat <<'EOM'
8617 Hmm, your compiler has some difficulty with fd_set.  Checking further...
8618 EOM
8619         set fd_set
8620         if eval $compile; then
8621                 d_fds_bits="$undef"
8622                 d_fd_set="$define"
8623                 echo "Well, your system has some sort of fd_set available..." >&4
8624                 if ./fd_set; then
8625                         echo "and you have the normal fd_set macros." >&4
8626                         d_fd_macros="$define"
8627                 else
8628                         $cat <<'EOM'
8629 but not the normal fd_set macros!  Gross!  More work for me...
8630 EOM
8631                         d_fd_macros="$undef"
8632                 fi
8633         else
8634         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
8635                 d_fd_set="$undef"
8636                 d_fds_bits="$undef"
8637                 d_fd_macros="$undef"
8638         fi
8639 fi
8640 $rm -f fd_set*
8641
8642 : see if fgetpos exists
8643 set fgetpos d_fgetpos
8644 eval $inlibc
8645
8646 : see if flock exists
8647 set flock d_flock
8648 eval $inlibc
8649
8650 : see if fork exists
8651 set fork d_fork
8652 eval $inlibc
8653
8654 : see if pathconf exists
8655 set pathconf d_pathconf
8656 eval $inlibc
8657
8658 : see if fpathconf exists
8659 set fpathconf d_fpathconf
8660 eval $inlibc
8661
8662
8663 : check for off64_t
8664 echo " "
8665 echo "Checking to see if your system supports off64_t..." >&4
8666 $cat >try.c <<EOCP
8667 #include <sys/types.h>
8668 #include <unistd.h>
8669 int main() { off64_t x = 7; }'
8670 EOCP
8671 set try
8672 if eval $compile; then
8673         val="$define"
8674         echo "Yes, it does."
8675 else
8676         val="$undef"
8677         echo "No, it doesn't."
8678         case "$lseeksize" in
8679         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
8680         esac
8681 fi
8682 $rm -f try.* try
8683 set d_off64_t
8684 eval $setvar
8685
8686 : check for fpos64_t
8687 echo " "
8688 echo "Checking to see if your system supports fpos64_t..." >&4
8689 $cat >try.c <<EOCP
8690 #include <sys/stdio.h>
8691 int main() { fpos64_t x x = 7; }'
8692 EOCP
8693 set try
8694 if eval $compile; then
8695         val="$define"
8696         echo "Yes, it does."
8697 else
8698         val="$undef"
8699         echo "No, it doesn't."
8700         case "$fpossize" in
8701         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
8702         esac
8703 fi
8704 $rm -f try.* try
8705 set d_fpos64_t
8706 eval $setvar
8707
8708 hasstruct='varname=$1; struct=$2; shift; shift;
8709 while $test $# -ge 2; do
8710         case "$1" in
8711         $define) echo "#include <$2>";;
8712         esac ;
8713     shift 2;
8714 done > try.c;
8715 echo "int main () { struct $struct foo; }" >> try.c;
8716 set try;
8717 if eval $compile; then
8718         val="$define";
8719 else
8720         val="$undef";
8721 fi;
8722 set $varname;
8723 eval $setvar;
8724 $rm -f try.c try.o'
8725
8726 : see if this is a sys/param system
8727 set sys/param.h i_sysparam
8728 eval $inhdr
8729
8730 : see if this is a sys/mount.h system
8731 set sys/mount.h i_sysmount
8732 eval $inhdr
8733
8734 : see if sys/types.h has to be included
8735 set sys/types.h i_systypes
8736 eval $inhdr
8737
8738
8739 echo " "
8740 echo "Checking to see if your system supports struct fs_data..." >&4
8741 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
8742 eval $hasstruct
8743 case "$d_fs_data_s" in
8744 "$define")      echo "Yes, it does."   ;;
8745 *)              echo "No, it doesn't." ;;
8746 esac
8747
8748 : see if fseeko exists
8749 set fseeko d_fseeko
8750 eval $inlibc
8751 case "$longsize" in
8752 8) echo "(Your long is 64 bits, so in a pinch you could use fseek.)" ;;
8753 esac
8754
8755 : see if fsetpos exists
8756 set fsetpos d_fsetpos
8757 eval $inlibc
8758
8759
8760 : see if fstatfs exists
8761 set fstatfs d_fstatfs
8762 eval $inlibc
8763
8764
8765 : see if statvfs exists
8766 set statvfs d_statvfs
8767 eval $inlibc
8768
8769 : see if fstatvfs exists
8770 set fstatvfs d_fstatvfs
8771 eval $inlibc
8772
8773
8774 : see if ftello exists
8775 set ftello d_ftello
8776 eval $inlibc
8777 case "$longsize" in
8778 8) echo "(Your long is 64 bits, so in a pinch you could use ftell.)" ;;
8779 esac
8780
8781 : see if getgrent exists
8782 set getgrent d_getgrent
8783 eval $inlibc
8784
8785 : see if gethostbyaddr exists
8786 set gethostbyaddr d_gethbyaddr
8787 eval $inlibc
8788
8789 : see if gethostbyname exists
8790 set gethostbyname d_gethbyname
8791 eval $inlibc
8792
8793 : see if gethostent exists
8794 set gethostent d_gethent
8795 eval $inlibc
8796
8797 : see how we will look up host name
8798 echo " "
8799 call=''
8800 if set gethostname val -f d_gethname; eval $csym; $val; then
8801         echo 'gethostname() found.' >&4
8802         d_gethname="$define"
8803         call=gethostname
8804 fi
8805 if set uname val -f d_uname; eval $csym; $val; then
8806         if ./xenix; then
8807                 $cat <<'EOM'
8808 uname() was found, but you're running xenix, and older versions of xenix
8809 have a broken uname(). If you don't really know whether your xenix is old
8810 enough to have a broken system call, use the default answer.
8811
8812 EOM
8813                 dflt=y
8814                 case "$d_uname" in
8815                 "$define") dflt=n;;
8816                 esac
8817                 rp='Is your uname() broken?'
8818                 . ./myread
8819                 case "$ans" in
8820                 n*) d_uname="$define"; call=uname;;
8821                 esac
8822         else
8823                 echo 'uname() found.' >&4
8824                 d_uname="$define"
8825                 case "$call" in
8826                 '') call=uname ;;
8827                 esac
8828         fi
8829 fi
8830 case "$d_gethname" in
8831 '') d_gethname="$undef";;
8832 esac
8833 case "$d_uname" in
8834 '') d_uname="$undef";;
8835 esac
8836 case "$d_uname$d_gethname" in
8837 *define*)
8838         dflt=n
8839         cat <<EOM
8840  
8841 Every now and then someone has a $call() that lies about the hostname
8842 but can't be fixed for political or economic reasons.  If you wish, I can
8843 pretend $call() isn't there and maybe compute hostname at run-time
8844 thanks to the '$phostname' command.
8845
8846 EOM
8847         rp="Shall I ignore $call() from now on?"
8848         . ./myread
8849         case "$ans" in
8850         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
8851         esac;;
8852 esac
8853 case "$phostname" in
8854 '') aphostname='';;
8855 *) case "$aphostname" in
8856         /*) ;;
8857         *) set X $phostname
8858                 shift
8859                 file=$1
8860                 shift
8861                 file=`./loc $file $file $pth`
8862                 aphostname=`echo $file $*`
8863                 ;;
8864         esac
8865         ;;
8866 esac
8867 case "$d_uname$d_gethname" in
8868 *define*) ;;
8869 *)
8870         case "$phostname" in
8871         '')
8872                 echo "There will be no way for $package to get your hostname." >&4;;
8873         *)
8874         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
8875                 ;;
8876         esac;;
8877 esac
8878 case "$d_phostname" in
8879 '') d_phostname="$undef";;
8880 esac
8881
8882 : see if this is a netdb.h system
8883 set netdb.h i_netdb
8884 eval $inhdr
8885
8886 : see if prototypes for various gethostxxx netdb.h functions are available
8887 echo " "
8888 set d_gethostprotos gethostent $i_netdb netdb.h
8889 eval $hasproto
8890
8891 : see if getlogin exists
8892 set getlogin d_getlogin
8893 eval $inlibc
8894
8895 : see if getmnt exists
8896 set getmnt d_getmnt
8897 eval $inlibc
8898
8899 : see if getmntent exists
8900 set getmntent d_getmntent
8901 eval $inlibc
8902
8903 : see if getnetbyaddr exists
8904 set getnetbyaddr d_getnbyaddr
8905 eval $inlibc
8906
8907 : see if getnetbyname exists
8908 set getnetbyname d_getnbyname
8909 eval $inlibc
8910
8911 : see if getnetent exists
8912 set getnetent d_getnent
8913 eval $inlibc
8914
8915 : see if prototypes for various getnetxxx netdb.h functions are available
8916 echo " "
8917 set d_getnetprotos getnetent $i_netdb netdb.h
8918 eval $hasproto
8919
8920
8921 : see if getprotobyname exists
8922 set getprotobyname d_getpbyname
8923 eval $inlibc
8924
8925 : see if getprotobynumber exists
8926 set getprotobynumber d_getpbynumber
8927 eval $inlibc
8928
8929 : see if getprotoent exists
8930 set getprotoent d_getpent
8931 eval $inlibc
8932
8933 : see if getpgid exists
8934 set getpgid d_getpgid
8935 eval $inlibc
8936
8937 : see if getpgrp2 exists
8938 set getpgrp2 d_getpgrp2
8939 eval $inlibc
8940
8941 : see if getppid exists
8942 set getppid d_getppid
8943 eval $inlibc
8944
8945 : see if getpriority exists
8946 set getpriority d_getprior
8947 eval $inlibc
8948
8949 : see if prototypes for various getprotoxxx netdb.h functions are available
8950 echo " "
8951 set d_getprotoprotos getprotoent $i_netdb netdb.h
8952 eval $hasproto
8953
8954 : see if getpwent exists
8955 set getpwent d_getpwent
8956 eval $inlibc
8957
8958
8959 : see if getservbyname exists
8960 set getservbyname d_getsbyname
8961 eval $inlibc
8962
8963 : see if getservbyport exists
8964 set getservbyport d_getsbyport
8965 eval $inlibc
8966
8967 : see if getservent exists
8968 set getservent d_getsent
8969 eval $inlibc
8970
8971 : see if prototypes for various getservxxx netdb.h functions are available
8972 echo " "
8973 set d_getservprotos getservent $i_netdb netdb.h
8974 eval $hasproto
8975
8976 : see if getspent exists
8977 set getspent d_getspent
8978 eval $inlibc
8979
8980 : see if getspnam exists
8981 set getspnam d_getspnam
8982 eval $inlibc
8983
8984 : see if gettimeofday or ftime exists
8985 set gettimeofday d_gettimeod
8986 eval $inlibc
8987 case "$d_gettimeod" in
8988 "$undef")
8989         set ftime d_ftime 
8990         eval $inlibc
8991         ;;
8992 *)
8993         val="$undef"; set d_ftime; eval $setvar
8994         ;;
8995 esac
8996 case "$d_gettimeod$d_ftime" in
8997 "$undef$undef")
8998         echo " "
8999         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
9000         ;;
9001 esac
9002
9003 : see if this is an grp system
9004 set grp.h i_grp
9005 eval $inhdr
9006
9007 case "$i_grp" in
9008 $define)
9009         xxx=`./findhdr grp.h`
9010         $cppstdin $cppflags $cppminus < $xxx >$$.h
9011
9012         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
9013                 val="$define"
9014         else
9015                 val="$undef"
9016         fi
9017         set d_grpasswd
9018         eval $setvar
9019
9020         $rm -f $$.h
9021         ;;
9022 *)
9023         val="$undef";
9024         set d_grpasswd; eval $setvar
9025         ;;
9026 esac
9027
9028 : see if hasmntopt exists
9029 set hasmntopt d_hasmntopt
9030 eval $inlibc
9031
9032 : see if this is a netinet/in.h or sys/in.h system
9033 set netinet/in.h i_niin sys/in.h i_sysin
9034 eval $inhdr
9035
9036 : see if arpa/inet.h has to be included
9037 set arpa/inet.h i_arpainet
9038 eval $inhdr
9039
9040 : see if htonl --and friends-- exists
9041 val=''
9042 set htonl val
9043 eval $inlibc
9044
9045 : Maybe they are macros.
9046 case "$val" in
9047 $undef)
9048         $cat >htonl.c <<EOM
9049 #include <stdio.h>
9050 #include <sys/types.h>
9051 #$i_niin I_NETINET_IN
9052 #$i_sysin I_SYS_IN
9053 #$i_arpainet I_ARPA_INET
9054 #ifdef I_NETINET_IN
9055 #include <netinet/in.h>
9056 #endif
9057 #ifdef I_SYS_IN
9058 #include <sys/in.h>
9059 #endif
9060 #ifdef I_ARPA_INET
9061 #include <arpa/inet.h>
9062 #endif
9063 #ifdef htonl
9064 printf("Defined as a macro.");
9065 #endif
9066 EOM
9067         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
9068         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
9069                 val="$define"
9070                 echo "But it seems to be defined as a macro." >&4
9071         fi
9072         $rm -f htonl.?
9073         ;;
9074 esac
9075 set d_htonl
9076 eval $setvar
9077
9078 : index or strchr
9079 echo " "
9080 if set index val -f; eval $csym; $val; then
9081         if set strchr val -f d_strchr; eval $csym; $val; then
9082                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
9083                         val="$define"
9084                         vali="$undef"
9085                         echo "strchr() found." >&4
9086                 else
9087                         val="$undef"
9088                         vali="$define"
9089                         echo "index() found." >&4
9090                 fi
9091         else
9092                 val="$undef"
9093                 vali="$define"
9094                 echo "index() found." >&4
9095         fi
9096 else
9097         if set strchr val -f d_strchr; eval $csym; $val; then
9098                 val="$define"
9099                 vali="$undef"
9100                 echo "strchr() found." >&4
9101         else
9102                 echo "No index() or strchr() found!" >&4
9103                 val="$undef"
9104                 vali="$undef"
9105         fi
9106 fi
9107 set d_strchr; eval $setvar
9108 val="$vali"
9109 set d_index; eval $setvar
9110
9111 : check whether inet_aton exists
9112 set inet_aton d_inetaton
9113 eval $inlibc
9114
9115 : see if inttypes.h is available
9116 : we want a real compile instead of Inhdr because some systems
9117 : have an inttypes.h which includes non-existent headers
9118 echo " "
9119 $cat >try.c <<EOCP
9120 #include <inttypes.h>
9121 int main() {
9122         static int32_t foo32 = 0x12345678;
9123 }
9124 EOCP
9125 set try
9126 if eval $compile; then
9127         echo "<inttypes.h> found." >&4
9128         val="$define"
9129 else
9130         echo "<inttypes.h> NOT found." >&4
9131         val="$undef"
9132 fi
9133 $rm -f try.c try
9134 set i_inttypes
9135 eval $setvar
9136
9137 : check for int64_t
9138 echo " "
9139 $echo $n "Checking to see if your system supports int64_t...$c" >&4
9140 $cat >try.c <<EOCP
9141 #include <sys/types.h>
9142 #$i_inttypes I_INTTYPES
9143 #ifdef I_INTTYPES
9144 #include <inttypes.h>
9145 #endif
9146 int main() { int64_t x = 7; }
9147 EOCP
9148 set try
9149 if eval $compile; then
9150         val="$define"
9151         echo " Yes, it does." >&4
9152 else
9153         val="$undef"
9154         echo " No, it doesn't." >&4
9155 fi
9156 $rm -f try try.*
9157 set d_int64t
9158 eval $setvar
9159
9160 : Look for isascii
9161 echo " "
9162 $cat >isascii.c <<'EOCP'
9163 #include <stdio.h>
9164 #include <ctype.h>
9165 int main() {
9166         int c = 'A';
9167         if (isascii(c))
9168                 exit(0);
9169         else
9170                 exit(1);
9171 }
9172 EOCP
9173 set isascii
9174 if eval $compile; then
9175         echo "isascii() found." >&4
9176         val="$define"
9177 else
9178         echo "isascii() NOT found." >&4
9179         val="$undef"
9180 fi
9181 set d_isascii
9182 eval $setvar
9183 $rm -f isascii*
9184
9185 : see if killpg exists
9186 set killpg d_killpg
9187 eval $inlibc
9188
9189 : see if lchown exists
9190 echo " "
9191 $cat > try.c <<'EOCP'
9192 /* System header to define __stub macros and hopefully few prototypes,
9193     which can conflict with char lchown(); below.  */
9194 #include <assert.h>
9195 /* Override any gcc2 internal prototype to avoid an error.  */
9196 /* We use char because int might match the return type of a gcc2
9197    builtin and then its argument prototype would still apply.  */
9198 char lchown();
9199 int main() {
9200     /*  The GNU C library defines this for functions which it implements
9201         to always fail with ENOSYS.  Some functions are actually named
9202         something starting with __ and the normal name is an alias.  */
9203 #if defined (__stub_lchown) || defined (__stub___lchown)
9204 choke me
9205 #else
9206 lchown();
9207 #endif
9208 ; return 0; }
9209 EOCP
9210 set try
9211 if eval $compile; then
9212     $echo "lchown() found." >&4
9213     val="$define"
9214 else
9215     $echo "lchown() NOT found." >&4
9216     val="$undef"
9217 fi
9218 set d_lchown
9219 eval $setvar
9220
9221 : See if number of significant digits in a double precision number is known
9222 echo " "
9223 $cat >ldbl_dig.c <<EOM
9224 #$i_limits I_LIMITS
9225 #$i_float I_FLOAT
9226 #ifdef I_LIMITS
9227 #include <limits.h>
9228 #endif
9229 #ifdef I_FLOAT
9230 #include <float.h>
9231 #endif
9232 #ifdef LDBL_DIG
9233 printf("Contains LDBL_DIG");
9234 #endif
9235 EOM
9236 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
9237 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
9238         echo "LDBL_DIG found." >&4
9239         val="$define"
9240 else
9241         echo "LDBL_DIG NOT found." >&4
9242         val="$undef"
9243 fi
9244 $rm -f ldbl_dig.?
9245 set d_ldbl_dig
9246 eval $setvar
9247
9248 : see if link exists
9249 set link d_link
9250 eval $inlibc
9251
9252 : see if localeconv exists
9253 set localeconv d_locconv
9254 eval $inlibc
9255
9256 : see if lockf exists
9257 set lockf d_lockf
9258 eval $inlibc
9259
9260 : check for long long
9261 echo " "
9262 $echo $n "Checking to see if your system supports long long..." $c >&4
9263 echo 'int main() { long long x = 7; return 0; }' > try.c
9264 set try
9265 if eval $compile; then
9266         val="$define"
9267         echo " Yes, it does." >&4
9268 else
9269         val="$undef"
9270         echo " No, it doesn't." >&4
9271 fi
9272 $rm try.*
9273 set d_longlong
9274 eval $setvar
9275
9276 : check for length of long long
9277 case "${d_longlong}${longlongsize}" in
9278 $define)
9279         echo " "
9280         $echo $n "Checking to see how big your long longs are..." $c >&4
9281         $cat >try.c <<'EOCP'
9282 #include <stdio.h>
9283 int main()
9284 {
9285     printf("%d\n", (int)sizeof(long long));
9286     return(0);
9287 }
9288 EOCP
9289         set try
9290         if eval $compile_ok; then
9291                 longlongsize=`./try$exe_ext`
9292                 $echo " $longlongsize bytes." >&4
9293         else
9294                 dflt='8'
9295                 echo " "
9296                 echo "(I can't seem to compile the test program.  Guessing...)"
9297                 rp="What is the size of a long long (in bytes)?"
9298                 . ./myread
9299                 longlongsize="$ans"
9300         fi
9301         if $test "X$longsize" = "X$longlongsize"; then
9302                 echo "(That isn't any different from an ordinary long.)"
9303         fi      
9304         ;;
9305 esac
9306 $rm -f try.* try
9307
9308 : see if lstat exists
9309 set lstat d_lstat
9310 eval $inlibc
9311
9312 : see if mblen exists
9313 set mblen d_mblen
9314 eval $inlibc
9315
9316 : see if mbstowcs exists
9317 set mbstowcs d_mbstowcs
9318 eval $inlibc
9319
9320 : see if mbtowc exists
9321 set mbtowc d_mbtowc
9322 eval $inlibc
9323
9324 : see if memchr exists
9325 set memchr d_memchr
9326 eval $inlibc
9327
9328 : see if memcmp exists
9329 set memcmp d_memcmp
9330 eval $inlibc
9331
9332 : see if memcpy exists
9333 set memcpy d_memcpy
9334 eval $inlibc
9335
9336 : see if memmove exists
9337 set memmove d_memmove
9338 eval $inlibc
9339
9340 : see if memset exists
9341 set memset d_memset
9342 eval $inlibc
9343
9344 : see if mkdir exists
9345 set mkdir d_mkdir
9346 eval $inlibc
9347
9348 : see if mkfifo exists
9349 set mkfifo d_mkfifo
9350 eval $inlibc
9351
9352 : see if mktime exists
9353 set mktime d_mktime
9354 eval $inlibc
9355
9356 : see if msgctl exists
9357 set msgctl d_msgctl
9358 eval $inlibc
9359
9360 : see if msgget exists
9361 set msgget d_msgget
9362 eval $inlibc
9363
9364 : see if msgsnd exists
9365 set msgsnd d_msgsnd
9366 eval $inlibc
9367
9368 : see if msgrcv exists
9369 set msgrcv d_msgrcv
9370 eval $inlibc
9371
9372 : see how much of the 'msg*(2)' library is present.
9373 h_msg=true
9374 echo " "
9375 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
9376 *"$undef"*) h_msg=false;;
9377 esac
9378 case "$osname" in
9379 freebsd)
9380     case "`ipcs 2>&1`" in
9381     "SVID messages"*"not configured"*)
9382         echo "Your $osname does not have the msg*(2) configured." >&4
9383         h_msg=false
9384         val="$undef"
9385         set msgctl d_msgctl
9386         eval $setvar
9387         set msgget d_msgget
9388         eval $setvar
9389         set msgsnd d_msgsnd
9390         eval $setvar
9391         set msgrcv d_msgrcv
9392         eval $setvar
9393         ;;
9394     esac
9395     ;;
9396 esac
9397 : we could also check for sys/ipc.h ...
9398 if $h_msg && $test `./findhdr sys/msg.h`; then
9399         echo "You have the full msg*(2) library." >&4
9400         val="$define"
9401 else
9402         echo "You don't have the full msg*(2) library." >&4
9403         val="$undef"
9404 fi
9405 set d_msg
9406 eval $setvar
9407
9408 : see if nice exists
9409 set nice d_nice
9410 eval $inlibc
9411
9412 : see if POSIX threads are available
9413 set pthread.h i_pthread
9414 eval $inhdr
9415
9416
9417
9418
9419 : how to create joinable pthreads
9420 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
9421         echo " "
9422         echo "Checking what constant to use for creating joinable pthreads..." >&4 
9423         $cat >try.c <<'EOCP'
9424 #include <pthread.h>
9425 int main() {
9426     int detachstate = JOINABLE;
9427 }
9428 EOCP
9429         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
9430         if eval $compile; then
9431                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
9432                 val="$undef" # Yes, undef.
9433                 set d_old_pthread_create_joinable
9434                 eval $setvar
9435                 val=""
9436                 set old_pthread_create_joinable
9437                 eval $setvar
9438         else
9439                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
9440                 if eval $compile; then
9441                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
9442                         val="$define"
9443                         set d_old_pthread_create_joinable
9444                         eval $setvar
9445                         val=PTHREAD_CREATE_UNDETACHED
9446                         set old_pthread_create_joinable
9447                         eval $setvar
9448                 else            
9449                         set try -DJOINABLE=__UNDETACHED
9450                         if eval $compile; then
9451                                 echo "You seem to use __UNDETACHED." >&4
9452                                 val="$define"
9453                                 set d_old_pthread_create_joinable
9454                                 eval $setvar
9455                                 val=__UNDETACHED
9456                                 set old_pthread_create_joinable
9457                                 eval $setvar
9458                         else
9459                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
9460                                 val="$define"
9461                                 set d_old_pthread_create_joinable
9462                                 eval $setvar
9463                                 val=0
9464                                 set old_pthread_create_joinable
9465                                 eval $setvar
9466                         fi
9467                 fi
9468         fi
9469         $rm -f try try.*
9470 else
9471     d_old_pthread_create_joinable="$undef"
9472     old_pthread_create_joinable=""
9473 fi
9474
9475 : see if pause exists
9476 set pause d_pause
9477 eval $inlibc
9478
9479 : see if pipe exists
9480 set pipe d_pipe
9481 eval $inlibc
9482
9483 : see if poll exists
9484 set poll d_poll
9485 eval $inlibc
9486
9487
9488 : see whether the various POSIXish _yields exist
9489 $cat >try.c <<EOP
9490 #include <pthread.h>
9491 #include <stdio.h>
9492 int main() {
9493 #ifdef SCHED_YIELD
9494         sched_yield();
9495 #else
9496 #ifdef PTHREAD_YIELD
9497         pthread_yield();
9498 #else
9499 #ifdef PTHREAD_YIELD_NULL
9500         pthread_yield(NULL);
9501 #endif
9502 #endif
9503 #endif
9504 }
9505 EOP
9506 : see if sched_yield exists
9507 set try -DSCHED_YIELD
9508 if eval $compile; then
9509     val="$define"
9510     sched_yield='sched_yield()'
9511 else
9512     val="$undef"
9513 fi
9514 case "$usethreads" in
9515 $define)
9516         case "$val" in
9517         $define) echo 'sched_yield() found.' >&4        ;;
9518         *)       echo 'sched_yield() NOT found.' >&4    ;;
9519         esac
9520 esac
9521 set d_sched_yield
9522 eval $setvar
9523
9524 : see if pthread_yield exists
9525 set try -DPTHREAD_YIELD
9526 if eval $compile; then
9527     val="$define"
9528     case "$sched_yield" in
9529     '') sched_yield='pthread_yield()' ;;
9530     esac
9531 else
9532     set try -DPTHREAD_YIELD_NULL
9533     if eval $compile; then
9534         val="$define"
9535         case "$sched_yield" in
9536         '') sched_yield='pthread_yield(NULL)' ;;
9537         esac
9538     else
9539         val="$undef"
9540     fi
9541 fi
9542 case "$usethreads" in
9543 $define)
9544         case "$val" in
9545         $define) echo 'pthread_yield() found.' >&4      ;;
9546         *)       echo 'pthread_yield() NOT found.' >&4  ;;
9547         esac
9548         ;;
9549 esac
9550 set d_pthread_yield
9551 eval $setvar
9552
9553 case "$sched_yield" in
9554 '') sched_yield=undef ;;
9555 esac
9556
9557 $rm -f try try.*
9558
9559 : see if this is a pwd.h system
9560 set pwd.h i_pwd
9561 eval $inhdr
9562
9563 case "$i_pwd" in
9564 $define)
9565         xxx=`./findhdr pwd.h`
9566         $cppstdin $cppflags $cppminus < $xxx >$$.h
9567
9568         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
9569                 val="$define"
9570         else
9571                 val="$undef"
9572         fi
9573         set d_pwquota
9574         eval $setvar
9575
9576         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
9577                 val="$define"
9578         else
9579                 val="$undef"
9580         fi
9581         set d_pwage
9582         eval $setvar
9583
9584         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
9585                 val="$define"
9586         else
9587                 val="$undef"
9588         fi
9589         set d_pwchange
9590         eval $setvar
9591
9592         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
9593                 val="$define"
9594         else
9595                 val="$undef"
9596         fi
9597         set d_pwclass
9598         eval $setvar
9599
9600         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
9601                 val="$define"
9602         else
9603                 val="$undef"
9604         fi
9605         set d_pwexpire
9606         eval $setvar
9607
9608         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
9609                 val="$define"
9610         else
9611                 val="$undef"
9612         fi
9613         set d_pwcomment
9614         eval $setvar
9615
9616         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
9617                 val="$define"
9618         else
9619                 val="$undef"
9620         fi
9621         set d_pwgecos
9622         eval $setvar
9623
9624         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
9625                 val="$define"
9626         else
9627                 val="$undef"
9628         fi
9629         set d_pwpasswd
9630         eval $setvar
9631
9632         $rm -f $$.h
9633         ;;
9634 *)
9635         val="$undef"; 
9636         set d_pwquota; eval $setvar
9637         set d_pwage; eval $setvar
9638         set d_pwchange; eval $setvar
9639         set d_pwclass; eval $setvar
9640         set d_pwexpire; eval $setvar
9641         set d_pwcomment; eval $setvar
9642         set d_pwgecos; eval $setvar
9643         set d_pwpasswd; eval $setvar
9644         ;;
9645 esac
9646
9647
9648 echo " "
9649 echo "Checking which 64-bit integer type we could use..." >&4
9650
9651 case "$intsize" in
9652 8) val=int
9653    set quadtype
9654    eval $setvar
9655    val='"unsigned int"'
9656    set uquadtype
9657    eval $setvar
9658    quadkind=1
9659    ;;
9660 *) case "$longsize" in
9661    8) val=long
9662       set quadtype
9663       eval $setvar
9664       val='"unsigned long"'
9665       set uquadtype
9666       eval $setvar
9667       quadkind=2
9668       ;;
9669    *) case "$uselonglong:$d_longlong:$longlongsize" in
9670       define:define:8)
9671         val='"long long"'
9672         set quadtype
9673         eval $setvar
9674         val='"unsigned long long"'
9675         set uquadtype
9676         eval $setvar
9677         quadkind=3
9678         ;;
9679       *) case "$d_int64t" in
9680          define)
9681            val=int64_t
9682            set quadtype
9683            eval $setvar
9684            val=uint64_t
9685            set uquadtype
9686            eval $setvar
9687            quadkind=4
9688            ;;
9689          esac
9690          ;;
9691       esac
9692       ;;
9693    esac
9694    ;;
9695 esac
9696
9697 case "$quadtype" in
9698 '')     case "$uselonglong:$d_longlong:$longlongsize" in
9699         undef:define:8)
9700            echo "(You would have 'long long', but you are not using it.)" >&4 ;;
9701         *) echo "Alas, no 64-bit integer types in sight." >&4 ;;
9702         esac
9703         d_quad="$undef"
9704         ;;
9705 *)      if test X"$use64bits" = Xdefine -o X"$longsize" = X8; then
9706             verb="will"
9707         else
9708             verb="could"
9709         fi
9710         echo "We $verb use '$quadtype' for 64-bit integers." >&4
9711         d_quad="$define"
9712         ;;
9713 esac
9714
9715 : see if readdir and friends exist
9716 set readdir d_readdir
9717 eval $inlibc
9718 set seekdir d_seekdir
9719 eval $inlibc
9720 set telldir d_telldir
9721 eval $inlibc
9722 set rewinddir d_rewinddir
9723 eval $inlibc
9724
9725 : see if readlink exists
9726 set readlink d_readlink
9727 eval $inlibc
9728
9729 : see if rename exists
9730 set rename d_rename
9731 eval $inlibc
9732
9733 : see if rmdir exists
9734 set rmdir d_rmdir
9735 eval $inlibc
9736
9737 : see if memory.h is available.
9738 val=''
9739 set memory.h val
9740 eval $inhdr
9741
9742 : See if it conflicts with string.h
9743 case "$val" in
9744 $define)
9745         case "$strings" in
9746         '') ;;
9747         *)
9748                 $cppstdin $cppflags $cppminus < $strings > mem.h
9749                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
9750                         echo " "
9751                         echo "We won't be including <memory.h>."
9752                         val="$undef"
9753                 fi
9754                 $rm -f mem.h
9755                 ;;
9756         esac
9757 esac
9758 set i_memory
9759 eval $setvar
9760
9761 : can bcopy handle overlapping blocks?
9762 val="$undef"
9763 case "$d_bcopy" in
9764 "$define")
9765         echo " "
9766         echo "Checking to see if your bcopy() can do overlapping copies..." >&4
9767         $cat >try.c <<EOCP
9768 #$i_memory I_MEMORY
9769 #$i_stdlib I_STDLIB
9770 #$i_string I_STRING
9771 #$i_unistd I_UNISTD
9772 EOCP
9773         $cat >>try.c <<'EOCP'
9774 #include <stdio.h>
9775 #ifdef I_MEMORY
9776 #  include <memory.h>
9777 #endif
9778 #ifdef I_STDLIB
9779 #  include <stdlib.h>
9780 #endif
9781 #ifdef I_STRING
9782 #  include <string.h>
9783 #else
9784 #  include <strings.h>
9785 #endif
9786 #ifdef I_UNISTD
9787 #  include <unistd.h>  /* Needed for NetBSD */
9788 #endif
9789 int main()
9790 {
9791 char buf[128], abc[128];
9792 char *b;
9793 int len;
9794 int off;
9795 int align;
9796
9797 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
9798
9799 for (align = 7; align >= 0; align--) {
9800         for (len = 36; len; len--) {
9801                 b = buf+align;
9802                 bcopy(abc, b, len);
9803                 for (off = 1; off <= len; off++) {
9804                         bcopy(b, b+off, len);
9805                         bcopy(b+off, b, len);
9806                         if (bcmp(b, abc, len))
9807                                 exit(1);
9808                 }
9809         }
9810 }
9811 exit(0);
9812 }
9813 EOCP
9814         set try
9815         if eval $compile_ok; then
9816                 if ./try 2>/dev/null; then
9817                         echo "Yes, it can."
9818                         val="$define"
9819                 else
9820                         echo "It can't, sorry."
9821                         case "$d_memmove" in
9822                         "$define") echo "But that's Ok since you have memmove()." ;;
9823                         esac
9824                 fi
9825         else
9826                 echo "(I can't compile the test program, so we'll assume not...)"
9827                 case "$d_memmove" in
9828                 "$define") echo "But that's Ok since you have memmove()." ;;
9829                 esac
9830         fi
9831         ;;
9832 esac
9833 $rm -f try.* try core
9834 set d_safebcpy
9835 eval $setvar
9836
9837 : can memcpy handle overlapping blocks?
9838 val="$undef"
9839 case "$d_memcpy" in
9840 "$define")
9841         echo " "
9842         echo "Checking to see if your memcpy() can do overlapping copies..." >&4
9843         $cat >try.c <<EOCP
9844 #$i_memory I_MEMORY
9845 #$i_stdlib I_STDLIB
9846 #$i_string I_STRING
9847 #$i_unistd I_UNISTD
9848 EOCP
9849         $cat >>try.c <<'EOCP'
9850 #include <stdio.h>
9851 #ifdef I_MEMORY
9852 #  include <memory.h>
9853 #endif
9854 #ifdef I_STDLIB
9855 #  include <stdlib.h>
9856 #endif
9857 #ifdef I_STRING
9858 #  include <string.h>
9859 #else
9860 #  include <strings.h>
9861 #endif
9862 #ifdef I_UNISTD
9863 #  include <unistd.h>  /* Needed for NetBSD */
9864 #endif
9865 int main()
9866 {
9867 char buf[128], abc[128];
9868 char *b;
9869 int len;
9870 int off;
9871 int align;
9872
9873 /* Copy "abcde..." string to char abc[] so that gcc doesn't
9874    try to store the string in read-only memory. */
9875 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
9876
9877 for (align = 7; align >= 0; align--) {
9878         for (len = 36; len; len--) {
9879                 b = buf+align;
9880                 memcpy(b, abc, len);
9881                 for (off = 1; off <= len; off++) {
9882                         memcpy(b+off, b, len);
9883                         memcpy(b, b+off, len);
9884                         if (memcmp(b, abc, len))
9885                                 exit(1);
9886                 }
9887         }
9888 }
9889 exit(0);
9890 }
9891 EOCP
9892         set try
9893         if eval $compile_ok; then
9894                 if ./try 2>/dev/null; then
9895                         echo "Yes, it can."
9896                         val="$define"
9897                 else
9898                         echo "It can't, sorry."
9899                         case "$d_memmove" in
9900                         "$define") echo "But that's Ok since you have memmove()." ;;
9901                         esac
9902                 fi
9903         else
9904                 echo "(I can't compile the test program, so we'll assume not...)"
9905                 case "$d_memmove" in
9906                 "$define") echo "But that's Ok since you have memmove()." ;;
9907                 esac
9908         fi
9909         ;;
9910 esac
9911 $rm -f try.* try core
9912 set d_safemcpy
9913 eval $setvar
9914
9915 : can memcmp be trusted to compare relative magnitude?
9916 val="$undef"
9917 case "$d_memcmp" in
9918 "$define")
9919         echo " "
9920         echo "Checking if your memcmp() can compare relative magnitude..." >&4
9921         $cat >try.c <<EOCP
9922 #$i_memory I_MEMORY
9923 #$i_stdlib I_STDLIB
9924 #$i_string I_STRING
9925 #$i_unistd I_UNISTD
9926 EOCP
9927         $cat >>try.c <<'EOCP'
9928 #include <stdio.h>
9929 #ifdef I_MEMORY
9930 #  include <memory.h>
9931 #endif
9932 #ifdef I_STDLIB
9933 #  include <stdlib.h>
9934 #endif
9935 #ifdef I_STRING
9936 #  include <string.h>
9937 #else
9938 #  include <strings.h>
9939 #endif
9940 #ifdef I_UNISTD
9941 #  include <unistd.h>  /* Needed for NetBSD */
9942 #endif
9943 int main()
9944 {
9945 char a = -1;
9946 char b = 0;
9947 if ((a < b) && memcmp(&a, &b, 1) < 0)
9948         exit(1);
9949 exit(0);
9950 }
9951 EOCP
9952         set try
9953         if eval $compile_ok; then
9954                 if ./try 2>/dev/null; then
9955                         echo "Yes, it can."
9956                         val="$define"
9957                 else
9958                         echo "No, it can't (it uses signed chars)."
9959                 fi
9960         else
9961                 echo "(I can't compile the test program, so we'll assume not...)"
9962         fi
9963         ;;
9964 esac
9965 $rm -f try.* try core
9966 set d_sanemcmp
9967 eval $setvar
9968
9969 : see if select exists
9970 set select d_select
9971 eval $inlibc
9972
9973 : see if semctl exists
9974 set semctl d_semctl
9975 eval $inlibc
9976
9977 : see if semget exists
9978 set semget d_semget
9979 eval $inlibc
9980
9981 : see if semop exists
9982 set semop d_semop
9983 eval $inlibc
9984
9985 : see how much of the 'sem*(2)' library is present.
9986 h_sem=true
9987 echo " "
9988 case "$d_semctl$d_semget$d_semop" in
9989 *"$undef"*) h_sem=false;;
9990 esac
9991 case "$osname" in
9992 freebsd)
9993     case "`ipcs 2>&1`" in
9994     "SVID messages"*"not configured"*)
9995         echo "Your $osname does not have the sem*(2) configured." >&4
9996         h_sem=false
9997         val="$undef"
9998         set semctl d_semctl
9999         eval $setvar
10000         set semget d_semget
10001         eval $setvar
10002         set semop d_semop
10003         eval $setvar
10004         ;;
10005     esac
10006     ;;
10007 esac
10008 : we could also check for sys/ipc.h ...
10009 if $h_sem && $test `./findhdr sys/sem.h`; then
10010         echo "You have the full sem*(2) library." >&4
10011         val="$define"
10012 else
10013         echo "You don't have the full sem*(2) library." >&4
10014         val="$undef"
10015 fi
10016 set d_sem
10017 eval $setvar
10018
10019 : see whether sys/sem.h defines union semun
10020 echo " "
10021 $cat > try.c <<'END'
10022 #include <sys/types.h>
10023 #include <sys/ipc.h>
10024 #include <sys/sem.h>
10025 int main () { union semun semun; semun.buf = 0; }
10026 END
10027 set try
10028 if eval $compile; then
10029     echo "You have union semun in <sys/sem.h>." >&4
10030     val="$define"
10031 else
10032     echo "You do not have union semun in <sys/sem.h>." >&4
10033     val="$undef"
10034 fi
10035 $rm -f try try.c try.h
10036 set d_union_semun
10037 eval $setvar
10038
10039 : see how to do semctl IPC_STAT
10040 case "$d_sem" in
10041 $define)
10042     : see whether semctl IPC_STAT can use union semun
10043     echo " "
10044     $cat > try.h <<END
10045 #ifndef S_IRUSR
10046 #   ifdef S_IREAD
10047 #       define S_IRUSR S_IREAD
10048 #       define S_IWUSR S_IWRITE
10049 #       define S_IXUSR S_IEXEC
10050 #   else
10051 #       define S_IRUSR 0400
10052 #       define S_IWUSR 0200
10053 #       define S_IXUSR 0100
10054 #   endif
10055 #   define S_IRGRP (S_IRUSR>>3)
10056 #   define S_IWGRP (S_IWUSR>>3)
10057 #   define S_IXGRP (S_IXUSR>>3)
10058 #   define S_IROTH (S_IRUSR>>6)
10059 #   define S_IWOTH (S_IWUSR>>6)
10060 #   define S_IXOTH (S_IXUSR>>6)
10061 #endif
10062 #ifndef S_IRWXU
10063 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
10064 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
10065 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
10066 #endif
10067 END
10068
10069     $cat > try.c <<END
10070 #include <sys/types.h>
10071 #include <sys/ipc.h>
10072 #include <sys/sem.h>
10073 #include <sys/stat.h>
10074 #include <stdio.h>
10075 #include <errno.h>
10076 #include "try.h"
10077 #ifndef errno
10078 extern int errno;
10079 #endif
10080 #$d_union_semun HAS_UNION_SEMUN
10081 int main() {
10082     union semun
10083 #ifndef HAS_UNION_SEMUN
10084     {
10085         int val;
10086         struct semid_ds *buf;
10087         unsigned short *array;
10088     }
10089 #endif
10090     arg;
10091     int sem, st;
10092
10093 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
10094     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
10095     if (sem > -1) {
10096         struct semid_ds argbuf;
10097         arg.buf = &argbuf;
10098 #       ifdef IPC_STAT
10099         st = semctl(sem, 0, IPC_STAT, arg);
10100         if (st == 0)
10101             printf("semun\n");
10102         else
10103 #       endif /* IPC_STAT */
10104             printf("semctl IPC_STAT failed: errno = %d\n", errno);
10105 #       ifdef IPC_RMID
10106         if (semctl(sem, 0, IPC_RMID, arg) != 0)
10107 #       endif /* IPC_RMID */
10108             printf("semctl IPC_RMID failed: errno = %d\n", errno);
10109     } else
10110 #endif /* IPC_PRIVATE && ... */
10111         printf("semget failed: errno = %d\n", errno);
10112   return 0;
10113 }
10114 END
10115     val="$undef"
10116     set try
10117     if eval $compile; then
10118         xxx=`./try`
10119         case "$xxx" in
10120         semun) val="$define" ;;
10121         esac
10122     fi
10123     $rm -f try try.c
10124     set d_semctl_semun
10125     eval $setvar
10126     case "$d_semctl_semun" in
10127     $define)
10128         echo "You can use union semun for semctl IPC_STAT." >&4
10129         also='also'
10130         ;;
10131     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
10132         also=''
10133         ;;
10134     esac
10135
10136     : see whether semctl IPC_STAT can use struct semid_ds pointer
10137     $cat > try.c <<'END'
10138 #include <sys/types.h>
10139 #include <sys/ipc.h>
10140 #include <sys/sem.h>
10141 #include <sys/stat.h>
10142 #include "try.h"
10143 #include <stdio.h>
10144 #include <errno.h>
10145 #ifndef errno
10146 extern int errno;
10147 #endif
10148 int main() {
10149     struct semid_ds arg;
10150     int sem, st;
10151
10152 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
10153     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
10154     if (sem > -1) {
10155 #       ifdef IPC_STAT
10156         st = semctl(sem, 0, IPC_STAT, &arg);
10157         if (st == 0)
10158             printf("semid_ds\n");
10159         else
10160 #       endif /* IPC_STAT */
10161             printf("semctl IPC_STAT failed: errno = %d\n", errno);
10162 #       ifdef IPC_RMID
10163         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
10164 #       endif /* IPC_RMID */
10165             printf("semctl IPC_RMID failed: errno = %d\n", errno);
10166     } else
10167 #endif /* IPC_PRIVATE && ... */
10168         printf("semget failed: errno = %d\n", errno);
10169
10170     return 0;
10171 }
10172 END
10173     val="$undef"
10174     set try
10175     if eval $compile; then
10176         xxx=`./try`
10177         case "$xxx" in
10178         semid_ds) val="$define" ;;
10179         esac
10180     fi
10181     $rm -f try try.c
10182     set d_semctl_semid_ds
10183     eval $setvar
10184     case "$d_semctl_semid_ds" in
10185     $define)
10186         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
10187         ;;
10188     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
10189         ;;
10190     esac
10191     $rm -f try.h
10192     ;;
10193 *)  val="$undef"
10194
10195     # We do not have the full sem*(2) library, so assume we can not
10196     # use either.
10197
10198     set d_semctl_semun
10199     eval $setvar
10200
10201     set d_semctl_semid_ds
10202     eval $setvar
10203     ;;
10204 esac
10205
10206 : see if setegid exists
10207 set setegid d_setegid
10208 eval $inlibc
10209
10210 : see if seteuid exists
10211 set seteuid d_seteuid
10212 eval $inlibc
10213
10214 : see if setgrent exists
10215 set setgrent d_setgrent
10216 eval $inlibc
10217
10218 : see if sethostent exists
10219 set sethostent d_sethent
10220 eval $inlibc
10221
10222 : see if setlinebuf exists
10223 set setlinebuf d_setlinebuf
10224 eval $inlibc
10225
10226 : see if setlocale exists
10227 set setlocale d_setlocale
10228 eval $inlibc
10229
10230 : see if setnetent exists
10231 set setnetent d_setnent
10232 eval $inlibc
10233
10234 : see if setprotoent exists
10235 set setprotoent d_setpent
10236 eval $inlibc
10237
10238 : see if setpgid exists
10239 set setpgid d_setpgid
10240 eval $inlibc
10241
10242 : see if setpgrp2 exists
10243 set setpgrp2 d_setpgrp2
10244 eval $inlibc
10245
10246 : see if setpriority exists
10247 set setpriority d_setprior
10248 eval $inlibc
10249
10250 : see if setpwent exists
10251 set setpwent d_setpwent
10252 eval $inlibc
10253
10254 : see if setregid exists
10255 set setregid d_setregid
10256 eval $inlibc
10257 set setresgid d_setresgid
10258 eval $inlibc
10259
10260 : see if setreuid exists
10261 set setreuid d_setreuid
10262 eval $inlibc
10263 set setresuid d_setresuid
10264 eval $inlibc
10265
10266 : see if setrgid exists
10267 set setrgid d_setrgid
10268 eval $inlibc
10269
10270 : see if setruid exists
10271 set setruid d_setruid
10272 eval $inlibc
10273
10274 : see if setservent exists
10275 set setservent d_setsent
10276 eval $inlibc
10277
10278 : see if setsid exists
10279 set setsid d_setsid
10280 eval $inlibc
10281
10282 : see if setspent exists
10283 set setspent d_setspent
10284 eval $inlibc
10285
10286 : see if setvbuf exists
10287 set setvbuf d_setvbuf
10288 eval $inlibc
10289
10290 : see if sfio.h is available
10291 set sfio.h i_sfio
10292 eval $inhdr
10293
10294
10295 : see if sfio library is available
10296 case "$i_sfio" in
10297 $define)
10298         val=''
10299         set sfreserve val
10300         eval $inlibc
10301         ;;
10302 *)
10303         val="$undef"
10304         ;;
10305 esac
10306 : Ok, but do we want to use it.
10307 case "$val" in
10308 $define)
10309         case "$usesfio" in
10310         true|$define|[yY]*) dflt='y';;
10311         *) dflt='n';;
10312         esac
10313         echo "$package can use the sfio library, but it is experimental."
10314         rp="You seem to have sfio available, do you want to try using it?"
10315         . ./myread
10316         case "$ans" in
10317         y|Y) ;;
10318         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
10319                 val="$undef"
10320                 : Remove sfio from list of libraries to use
10321                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
10322                 shift
10323                 libs="$*"
10324                 echo "libs = $libs" >&4
10325                 ;;
10326         esac
10327         ;;
10328 *)      case "$usesfio" in
10329         true|$define|[yY]*)
10330                 echo "Sorry, cannot find sfio on this machine" >&4
10331                 echo "Ignoring your setting of usesfio=$usesfio" >&4
10332                 ;;
10333         esac
10334         ;;
10335 esac
10336 set d_sfio
10337 eval $setvar
10338 case "$d_sfio" in
10339 $define) usesfio='true';;
10340 *) usesfio='false';;
10341 esac
10342
10343 : see if shmctl exists
10344 set shmctl d_shmctl
10345 eval $inlibc
10346
10347 : see if shmget exists
10348 set shmget d_shmget
10349 eval $inlibc
10350
10351 : see if shmat exists
10352 set shmat d_shmat
10353 eval $inlibc
10354 : see what shmat returns
10355 case "$d_shmat" in
10356 "$define")
10357         $cat >shmat.c <<'END'
10358 #include <sys/shm.h>
10359 void *shmat();
10360 END
10361         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
10362                 shmattype='void *'
10363         else
10364                 shmattype='char *'
10365         fi
10366         echo "and it returns ($shmattype)." >&4
10367         : see if a prototype for shmat is available
10368         xxx=`./findhdr sys/shm.h`
10369         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
10370         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
10371                 val="$define"
10372         else
10373                 val="$undef"
10374         fi
10375         $rm -f shmat.[co]
10376         ;;
10377 *)
10378         val="$undef"
10379         ;;
10380 esac
10381 set d_shmatprototype
10382 eval $setvar
10383
10384 : see if shmdt exists
10385 set shmdt d_shmdt
10386 eval $inlibc
10387
10388 : see how much of the 'shm*(2)' library is present.
10389 h_shm=true
10390 echo " "
10391 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
10392 *"$undef"*) h_shm=false;;
10393 esac
10394 case "$osname" in
10395 freebsd)
10396     case "`ipcs 2>&1`" in
10397     "SVID shared memory"*"not configured"*)
10398         echo "Your $osname does not have the shm*(2) configured." >&4
10399         h_shm=false
10400         val="$undef"
10401         set shmctl d_shmctl
10402         evat $setvar
10403         set shmget d_shmget
10404         evat $setvar
10405         set shmat d_shmat
10406         evat $setvar
10407         set shmdt d_shmdt
10408         evat $setvar
10409         ;;
10410     esac
10411     ;;
10412 esac
10413 : we could also check for sys/ipc.h ...
10414 if $h_shm && $test `./findhdr sys/shm.h`; then
10415         echo "You have the full shm*(2) library." >&4
10416         val="$define"
10417 else
10418         echo "You don't have the full shm*(2) library." >&4
10419         val="$undef"
10420 fi
10421 set d_shm
10422 eval $setvar
10423
10424 echo " "
10425 : see if we have sigaction
10426 if set sigaction val -f d_sigaction; eval $csym; $val; then
10427         echo 'sigaction() found.' >&4
10428         $cat > try.c <<'EOP'
10429 #include <stdio.h>
10430 #include <sys/types.h>
10431 #include <signal.h>
10432 int main()
10433 {
10434     struct sigaction act, oact;
10435     act.sa_flags = 0;
10436     oact.sa_handler = 0;
10437     /* so that act and oact are used */
10438     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
10439 }
10440 EOP
10441         set try
10442         if eval $compile_ok; then
10443                 val="$define"
10444         else
10445                 echo "But you don't seem to have a useable struct sigaction." >&4
10446                 val="$undef"
10447         fi
10448 else
10449         echo 'sigaction NOT found.' >&4
10450         val="$undef"
10451 fi
10452 set d_sigaction; eval $setvar
10453 $rm -f try try$_o try.c
10454
10455 : see if sigsetjmp exists
10456 echo " "
10457 case "$d_sigsetjmp" in
10458 '')
10459         $cat >try.c <<'EOP'
10460 #include <setjmp.h>
10461 sigjmp_buf env;
10462 int set = 1;
10463 int main()
10464 {
10465         if (sigsetjmp(env,1))
10466                 exit(set);
10467         set = 0;
10468         siglongjmp(env, 1);
10469         exit(1);
10470 }
10471 EOP
10472         set try
10473         if eval $compile; then
10474                 if ./try >/dev/null 2>&1; then
10475                         echo "POSIX sigsetjmp found." >&4
10476                         val="$define"
10477                 else
10478                         $cat >&4 <<EOM
10479 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
10480 I'll ignore them.
10481 EOM
10482                         val="$undef"
10483                 fi
10484         else
10485                 echo "sigsetjmp not found." >&4
10486                 val="$undef"
10487         fi
10488         ;;
10489 *) val="$d_sigsetjmp"
10490         case "$d_sigsetjmp" in
10491         $define) echo "POSIX sigsetjmp found." >&4;;
10492         $undef) echo "sigsetjmp not found." >&4;;
10493         esac
10494         ;;
10495 esac
10496 set d_sigsetjmp
10497 eval $setvar
10498 $rm -f try.c try
10499
10500 : see if sqrtl exists
10501 set sqrtl d_sqrtl
10502 eval $inlibc
10503
10504 : see if sys/stat.h is available
10505 set sys/stat.h i_sysstat
10506 eval $inhdr
10507
10508
10509 : see if stat knows about block sizes
10510 echo " "
10511 echo "Checking to see if your struct stat has st_blocks field..." >&4
10512 set d_statblks stat st_blocks $i_sysstat sys/stat.h
10513 eval $hasfield
10514
10515
10516 : see if this is a sys/vfs.h system
10517 set sys/vfs.h i_sysvfs
10518 eval $inhdr
10519
10520
10521 : see if this is a sys/statfs.h system
10522 set sys/statfs.h i_sysstatfs
10523 eval $inhdr
10524
10525
10526 echo " "
10527 echo "Checking to see if your system supports struct statfs..." >&4
10528 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
10529 eval $hasstruct
10530 case "$d_statfs_s" in
10531 "$define")      echo "Yes, it does."   ;;
10532 *)              echo "No, it doesn't." ;;
10533 esac
10534
10535
10536
10537 : see if struct statfs knows about f_flags
10538 case "$d_statfs_s" in
10539 define) 
10540         echo " "
10541         echo "Checking to see if your struct statfs has f_flags field..." >&4
10542         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
10543         eval $hasfield
10544         ;;
10545 *)      val="$undef"
10546         set d_statfs_f_flags
10547         eval $setvar
10548         ;;
10549 esac
10550 case "$d_statfs_f_flags" in
10551 "$define")      echo "Yes, it does."   ;;
10552 *)              echo "No, it doesn't." ;;
10553 esac
10554
10555 : see if _ptr and _cnt from stdio act std
10556 echo " "
10557 if $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
10558         echo "(Looks like you have stdio.h from Linux.)"
10559         case "$stdio_ptr" in
10560         '') stdio_ptr='((fp)->_IO_read_ptr)'
10561                 ptr_lval=$define
10562                 ;;
10563         *)      ptr_lval=$d_stdio_ptr_lval;;
10564         esac
10565         case "$stdio_cnt" in
10566         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
10567                 cnt_lval=$undef
10568                 ;;
10569         *)      cnt_lval=$d_stdio_cnt_lval;;
10570         esac
10571         case "$stdio_base" in
10572         '') stdio_base='((fp)->_IO_read_base)';;
10573         esac
10574         case "$stdio_bufsiz" in
10575         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
10576         esac
10577 else
10578         case "$stdio_ptr" in
10579         '') stdio_ptr='((fp)->_ptr)'
10580                 ptr_lval=$define
10581                 ;;
10582         *)      ptr_lval=$d_stdio_ptr_lval;;
10583         esac
10584         case "$stdio_cnt" in
10585         '') stdio_cnt='((fp)->_cnt)'
10586                 cnt_lval=$define
10587                 ;;
10588         *)      cnt_lval=$d_stdio_cnt_lval;;
10589         esac
10590         case "$stdio_base" in
10591         '') stdio_base='((fp)->_base)';;
10592         esac
10593         case "$stdio_bufsiz" in
10594         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
10595         esac
10596 fi
10597 : test whether _ptr and _cnt really work
10598 echo "Checking how std your stdio is..." >&4
10599 $cat >try.c <<EOP
10600 #include <stdio.h>
10601 #define FILE_ptr(fp)    $stdio_ptr
10602 #define FILE_cnt(fp)    $stdio_cnt
10603 int main() {
10604         FILE *fp = fopen("try.c", "r");
10605         char c = getc(fp);
10606         if (
10607                 18 <= FILE_cnt(fp) &&
10608                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
10609         )
10610                 exit(0);
10611         exit(1);
10612 }
10613 EOP
10614 val="$undef"
10615 set try
10616 if eval $compile; then
10617         if ./try; then
10618                 echo "Your stdio acts pretty std."
10619                 val="$define"
10620         else
10621                 echo "Your stdio isn't very std."
10622         fi
10623 else
10624         echo "Your stdio doesn't appear very std."
10625 fi
10626 $rm -f try.c try
10627 set d_stdstdio
10628 eval $setvar
10629
10630 : Can _ptr be used as an lvalue?
10631 case "$d_stdstdio$ptr_lval" in
10632 $define$define) val=$define ;;
10633 *) val=$undef ;;
10634 esac
10635 set d_stdio_ptr_lval
10636 eval $setvar
10637
10638 : Can _cnt be used as an lvalue?
10639 case "$d_stdstdio$cnt_lval" in
10640 $define$define) val=$define ;;
10641 *) val=$undef ;;
10642 esac
10643 set d_stdio_cnt_lval
10644 eval $setvar
10645
10646 : see if _base is also standard
10647 val="$undef"
10648 case "$d_stdstdio" in
10649 $define)
10650         $cat >try.c <<EOP
10651 #include <stdio.h>
10652 #define FILE_base(fp)   $stdio_base
10653 #define FILE_bufsiz(fp) $stdio_bufsiz
10654 int main() {
10655         FILE *fp = fopen("try.c", "r");
10656         char c = getc(fp);
10657         if (
10658                 19 <= FILE_bufsiz(fp) &&
10659                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
10660         )
10661                 exit(0);
10662         exit(1);
10663 }
10664 EOP
10665         set try
10666         if eval $compile; then
10667                 if ./try; then
10668                         echo "And its _base field acts std."
10669                         val="$define"
10670                 else
10671                         echo "But its _base field isn't std."
10672                 fi
10673         else
10674                 echo "However, it seems to be lacking the _base field."
10675         fi
10676         $rm -f try.c try
10677         ;;
10678 esac
10679 set d_stdiobase
10680 eval $setvar
10681
10682 $cat >&4 <<EOM
10683 Checking how to access stdio streams by file descriptor number...
10684 EOM
10685 case "$stdio_stream_array" in
10686 '')     $cat >try.c <<EOCP
10687 #include <stdio.h>
10688 int main() {
10689   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
10690     printf("yes\n");
10691 }
10692 EOCP
10693         for s in _iob __iob __sF
10694         do
10695                 set try -DSTDIO_STREAM_ARRAY=$s
10696                 if eval $compile; then
10697                         case "`./try$exe_ext`" in
10698                         yes)    stdio_stream_array=$s; break ;;
10699                         esac
10700                 fi
10701         done
10702         $rm -f try.* try$exe_ext
10703 esac
10704 case "$stdio_stream_array" in
10705 '')     $cat >&4 <<EOM
10706 I can't figure out how to access stdio streams by file descriptor number.
10707 EOM
10708         d_stdio_stream_array="$undef"
10709         ;;
10710 *)      $cat >&4 <<EOM
10711 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
10712 EOM
10713         d_stdio_stream_array="$define"
10714         ;;
10715 esac
10716
10717 : see if strcoll exists
10718 set strcoll d_strcoll
10719 eval $inlibc
10720
10721 : check for structure copying
10722 echo " "
10723 echo "Checking to see if your C compiler can copy structs..." >&4
10724 $cat >try.c <<'EOCP'
10725 int main()
10726 {
10727         struct blurfl {
10728                 int dyick;
10729         } foo, bar;
10730
10731         foo = bar;
10732 }
10733 EOCP
10734 if $cc -c try.c >/dev/null 2>&1 ; then
10735         val="$define"
10736         echo "Yup, it can."
10737 else
10738         val="$undef"
10739         echo "Nope, it can't."
10740 fi
10741 set d_strctcpy
10742 eval $setvar
10743 $rm -f try.*
10744
10745 : see if strerror and/or sys_errlist[] exist
10746 echo " "
10747 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
10748     if set strerror val -f d_strerror; eval $csym; $val; then
10749                 echo 'strerror() found.' >&4
10750                 d_strerror="$define"
10751                 d_strerrm='strerror(e)'
10752                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
10753                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
10754                         d_syserrlst="$define"
10755                 else
10756                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
10757                         d_syserrlst="$undef"
10758                 fi
10759     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
10760                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
10761                 echo 'strerror() found in string header.' >&4
10762                 d_strerror="$define"
10763                 d_strerrm='strerror(e)'
10764                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
10765                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
10766                                 d_syserrlst="$define"
10767                 else
10768                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
10769                         d_syserrlst="$undef"
10770                 fi
10771     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
10772                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
10773                 d_strerror="$undef"
10774                 d_syserrlst="$define"
10775                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
10776     else
10777                 echo 'strerror() and sys_errlist[] NOT found.' >&4
10778                 d_strerror="$undef"
10779                 d_syserrlst="$undef"
10780                 d_strerrm='"unknown"'
10781     fi
10782 fi
10783
10784 : see if strtod exists
10785 set strtod d_strtod
10786 eval $inlibc
10787
10788 : see if strtol exists
10789 set strtol d_strtol
10790 eval $inlibc
10791
10792 : see if strtoul exists
10793 set strtoul d_strtoul
10794 eval $inlibc
10795
10796 : see if strtoull exists
10797 set strtoull d_strtoull
10798 eval $inlibc
10799
10800 : see if strxfrm exists
10801 set strxfrm d_strxfrm
10802 eval $inlibc
10803
10804 : see if symlink exists
10805 set symlink d_symlink
10806 eval $inlibc
10807
10808 : see if syscall exists
10809 set syscall d_syscall
10810 eval $inlibc
10811
10812 : see if sysconf exists
10813 set sysconf d_sysconf
10814 eval $inlibc
10815
10816 : see if system exists
10817 set system d_system
10818 eval $inlibc
10819
10820 : see if tcgetpgrp exists
10821 set tcgetpgrp d_tcgetpgrp
10822 eval $inlibc
10823
10824 : see if tcsetpgrp exists
10825 set tcsetpgrp d_tcsetpgrp
10826 eval $inlibc
10827
10828 : see if prototype for telldir is available
10829 echo " "
10830 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
10831 eval $hasproto
10832
10833 : see if this is a sys/times.h system
10834 set sys/times.h i_systimes
10835 eval $inhdr
10836
10837 : see if times exists
10838 echo " "
10839 if set times val -f d_times; eval $csym; $val; then
10840         echo 'times() found.' >&4
10841         d_times="$define"
10842         inc=''
10843         case "$i_systimes" in
10844         "$define") inc='sys/times.h';;
10845         esac
10846         rp="What is the type returned by times() on this system?"
10847         set clock_t clocktype long stdio.h sys/types.h $inc
10848         eval $typedef_ask
10849 else
10850         echo 'times() NOT found, hope that will do.' >&4
10851         d_times="$undef"
10852         clocktype='int'
10853 fi
10854
10855 : see if truncate exists
10856 set truncate d_truncate
10857 eval $inlibc
10858
10859 : see if tzname[] exists
10860 echo " "
10861 if set tzname val -a d_tzname; eval $csym; $val; then
10862         val="$define"
10863         echo 'tzname[] found.' >&4
10864 else
10865         val="$undef"
10866         echo 'tzname[] NOT found.' >&4
10867 fi
10868 set d_tzname
10869 eval $setvar
10870
10871 : see if umask exists
10872 set umask d_umask
10873 eval $inlibc
10874
10875 : see if ustat exists
10876 set ustat d_ustat
10877 eval $inlibc
10878
10879 : backward compatibility for d_hvfork
10880 if test X$d_hvfork != X; then
10881         d_vfork="$d_hvfork"
10882         d_hvfork=''
10883 fi
10884 : see if there is a vfork
10885 val=''
10886 set vfork val
10887 eval $inlibc
10888
10889 : Ok, but do we want to use it. vfork is reportedly unreliable in 
10890 : perl on Solaris 2.x, and probably elsewhere.
10891 case "$val" in
10892 $define)
10893         echo " "
10894         case "$usevfork" in
10895         false) dflt='n';;
10896         *) dflt='y';;
10897         esac
10898         cat <<'EOM'
10899  
10900 Perl can only use a vfork() that doesn't suffer from strict
10901 restrictions on calling functions or modifying global data in
10902 the child.  For example, glibc-2.1 contains such a vfork()
10903 that is unsuitable.  If your system provides a proper fork()
10904 call, chances are that you do NOT want perl to use vfork().
10905
10906 EOM
10907         rp="Do you still want to use vfork()?"
10908         . ./myread
10909         case "$ans" in
10910         y|Y) ;;
10911         *)
10912                 echo "Ok, we won't use vfork()."
10913                 val="$undef"
10914                 ;;
10915         esac
10916         ;;
10917 esac
10918 set d_vfork
10919 eval $setvar
10920 case "$d_vfork" in
10921 $define) usevfork='true';;
10922 *) usevfork='false';;
10923 esac
10924
10925 : see if this is an sysdir system
10926 set sys/dir.h i_sysdir
10927 eval $inhdr
10928
10929 : see if this is an sysndir system
10930 set sys/ndir.h i_sysndir
10931 eval $inhdr
10932
10933 : see if closedir exists
10934 set closedir d_closedir
10935 eval $inlibc
10936
10937 case "$d_closedir" in
10938 "$define")
10939         echo " "
10940         echo "Checking whether closedir() returns a status..." >&4
10941         cat > closedir.c <<EOM
10942 #$i_dirent I_DIRENT             /**/
10943 #$i_sysdir I_SYS_DIR            /**/
10944 #$i_sysndir I_SYS_NDIR          /**/
10945 #$i_systypes I_SYS_TYPES        /**/
10946
10947 #if defined(I_SYS_TYPES)
10948 #include <sys/types.h>
10949 #endif
10950 #if defined(I_DIRENT)
10951 #include <dirent.h>
10952 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
10953 #include <sys/dir.h>
10954 #endif
10955 #else
10956 #ifdef I_SYS_NDIR
10957 #include <sys/ndir.h>
10958 #else
10959 #ifdef I_SYS_DIR
10960 #ifdef hp9000s500
10961 #include <ndir.h>       /* may be wrong in the future */
10962 #else
10963 #include <sys/dir.h>
10964 #endif
10965 #endif
10966 #endif
10967 #endif 
10968 int main() { return closedir(opendir(".")); }
10969 EOM
10970         set closedir
10971         if eval $compile_ok; then
10972                 if ./closedir > /dev/null 2>&1 ; then
10973                         echo "Yes, it does."
10974                         val="$undef"
10975                 else
10976                         echo "No, it doesn't."
10977                         val="$define"
10978                 fi
10979         else
10980                 echo "(I can't seem to compile the test program--assuming it doesn't)"
10981                 val="$define"
10982         fi
10983         ;;
10984 *)
10985         val="$undef";
10986         ;;
10987 esac
10988 set d_void_closedir
10989 eval $setvar
10990 $rm -f closedir*
10991 : check for volatile keyword
10992 echo " "
10993 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
10994 $cat >try.c <<'EOCP'
10995 int main()
10996 {
10997         typedef struct _goo_struct goo_struct;
10998         goo_struct * volatile goo = ((goo_struct *)0);
10999         struct _goo_struct {
11000                 long long_int;
11001                 int reg_int;
11002                 char char_var;
11003         };
11004         typedef unsigned short foo_t;
11005         char *volatile foo;
11006         volatile int bar;
11007         volatile foo_t blech;
11008         foo = foo;
11009 }
11010 EOCP
11011 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
11012         val="$define"
11013         echo "Yup, it does."
11014 else
11015         val="$undef"
11016         echo "Nope, it doesn't."
11017 fi
11018 set d_volatile
11019 eval $setvar
11020 $rm -f try.*
11021
11022 : see if there is a wait4
11023 set wait4 d_wait4
11024 eval $inlibc
11025
11026 : see if waitpid exists
11027 set waitpid d_waitpid
11028 eval $inlibc
11029
11030 : see if wcstombs exists
11031 set wcstombs d_wcstombs
11032 eval $inlibc
11033
11034 : see if wctomb exists
11035 set wctomb d_wctomb
11036 eval $inlibc
11037
11038 : preserve RCS keywords in files with variable substitution, grrr
11039 Date='$Date'
11040 Id='$Id'
11041 Log='$Log'
11042 RCSfile='$RCSfile'
11043 Revision='$Revision'
11044
11045 case "$crosscompile" in
11046 ''|[nN]*) crosscompile="$undef" ;;
11047 esac
11048
11049 case "$osname" in
11050 next|rhapsody) multiarch="$define" ;;
11051 esac
11052 case "$multiarch" in
11053 ''|[nN]*) multiarch="$undef" ;;
11054 esac
11055
11056 : check for alignment requirements
11057 echo " "
11058 case "$crosscompile$multiarch" in
11059 *$define*)
11060         $cat <<EOM
11061 You seem to be either cross-compiling or doing a multiarchitecture build,
11062 skipping the memory alignment check.
11063
11064 EOM
11065         case "$alignbytes" in
11066         '') alignbytes=8 ;;
11067         esac
11068         ;;
11069 *)
11070         case "$alignbytes" in
11071         '') echo "Checking alignment constraints..." >&4
11072                 $cat >try.c <<'EOCP'
11073 #include <stdio.h>
11074 struct foobar {
11075         char foo;
11076         double bar;
11077 } try_algn;
11078 int main()
11079 {
11080     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
11081     return(0);
11082 }
11083 EOCP
11084                 set try
11085                 if eval $compile_ok; then
11086                         dflt=`./try`
11087                 else
11088                         dflt='8'
11089                         echo "(I can't seem to compile the test program...)"
11090                 fi
11091                 ;;
11092         *) dflt="$alignbytes"
11093                 ;;
11094         esac
11095         rp="Doubles must be aligned on a how-many-byte boundary?"
11096         . ./myread
11097         alignbytes="$ans"
11098         $rm -f try.c try
11099         ;;
11100 esac
11101
11102
11103 : check for ordering of bytes in a long
11104 echo " "
11105 case "$crosscompile$multiarch" in
11106 *$define*)
11107         $cat <<EOM
11108 You seem to be either cross-compiling or doing a multiarchitecture build,
11109 skipping the byteorder check.
11110
11111 EOM
11112         byteorder='0xffff'
11113         ;;
11114 *)
11115         case "$byteorder" in
11116         '')
11117                 $cat <<'EOM'
11118 In the following, larger digits indicate more significance.  A big-endian
11119 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
11120 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
11121 machines may have weird orders like 3412.  A Cray will report 87654321,
11122 an Alpha will report 12345678. If the test program works the default is
11123 probably right.
11124 I'm now running the test program...
11125 EOM
11126                 $cat >try.c <<'EOCP'
11127 #include <stdio.h>
11128 int main()
11129 {
11130         int i;
11131         union {
11132                 unsigned long l;
11133                 char c[sizeof(long)];
11134         } u;
11135
11136         if (sizeof(long) > 4)
11137                 u.l = (0x08070605L << 32) | 0x04030201L;
11138         else
11139                 u.l = 0x04030201L;
11140         for (i = 0; i < sizeof(long); i++)
11141                 printf("%c", u.c[i]+'0');
11142         printf("\n");
11143         exit(0);
11144 }
11145 EOCP
11146                 xxx_prompt=y
11147                 set try
11148                 if eval $compile && ./try > /dev/null; then
11149                         dflt=`./try`
11150                         case "$dflt" in
11151                         [1-4][1-4][1-4][1-4]|12345678|87654321)
11152                                 echo "(The test program ran ok.)"
11153                                 echo "byteorder=$dflt"
11154                                 xxx_prompt=n
11155                         ;;
11156                         ????|????????) echo "(The test program ran ok.)" ;;
11157                         *) echo "(The test program didn't run right for some reason.)" ;;
11158                         esac
11159                 else
11160                         dflt='4321'
11161                         cat <<'EOM'
11162 (I can't seem to compile the test program.  Guessing big-endian...)
11163 EOM
11164                 fi
11165                 case "$xxx_prompt" in
11166                 y)
11167                         rp="What is the order of bytes in a long?"
11168                         . ./myread
11169                         byteorder="$ans"
11170                         ;;
11171                 *)      byteorder=$dflt
11172                         ;;
11173                 esac
11174                 ;;
11175         esac
11176         $rm -f try.c try
11177         ;;
11178 esac
11179
11180
11181 : how do we catenate cpp tokens here?
11182 echo " "
11183 echo "Checking to see how your cpp does stuff like catenate tokens..." >&4
11184 $cat >cpp_stuff.c <<'EOCP'
11185 #define RCAT(a,b)a/**/b
11186 #define ACAT(a,b)a ## b
11187 RCAT(Rei,ser)
11188 ACAT(Cir,cus)
11189 EOCP
11190 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
11191 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
11192         echo "Oh!  Smells like ANSI's been here." >&4
11193         echo "We can catify or stringify, separately or together!"
11194         cpp_stuff=42
11195 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
11196         echo "Ah, yes!  The good old days!" >&4
11197         echo "However, in the good old days we don't know how to stringify and"
11198         echo "catify at the same time."
11199         cpp_stuff=1
11200 else
11201         $cat >&4 <<EOM
11202 Hmm, I don't seem to be able to catenate tokens with your cpp.  You're going
11203 to have to edit the values of CAT[2-5] in config.h...
11204 EOM
11205         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
11206 fi
11207 $rm -f cpp_stuff.*
11208
11209 : see if this is a db.h system
11210 set db.h i_db
11211 eval $inhdr
11212
11213 case "$i_db" in
11214 $define)
11215         : Check db version.
11216         echo " "
11217         echo "Checking Berkeley DB version ..." >&4
11218         $cat >try.c <<EOCP
11219 #$d_const HASCONST
11220 #ifndef HASCONST
11221 #define const
11222 #endif
11223 #include <sys/types.h>
11224 #include <stdio.h>
11225 #include <db.h>
11226 int main()
11227 {
11228 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
11229     int Major, Minor, Patch ;
11230     unsigned long Version ;
11231     (void)db_version(&Major, &Minor, &Patch) ;
11232     printf("You have Berkeley DB Version 2 or greater\n");
11233
11234     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
11235                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
11236     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
11237                 Major, Minor, Patch) ;
11238
11239     /* check that db.h & libdb are compatible */
11240     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
11241         printf("db.h and libdb are incompatible\n") ;
11242         exit(3);        
11243     }
11244
11245     printf("db.h and libdb are compatible\n") ;
11246
11247     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
11248                 + DB_VERSION_PATCH ;
11249
11250     /* needs to be >= 2.3.4 */
11251     if (Version < 2003004) {
11252     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
11253         printf("but Perl needs Berkeley DB 2.3.4 or greater\n") ;
11254         exit(2);        
11255     }
11256
11257     exit(0);
11258 #else
11259 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
11260     printf("You have Berkeley DB Version 1\n");
11261     exit(0);    /* DB version < 2: the coast is clear. */
11262 #else
11263     exit(1);    /* <db.h> not Berkeley DB? */
11264 #endif
11265 #endif
11266 }
11267 EOCP
11268         set try
11269         if eval $compile_ok && ./try; then
11270                 echo 'Looks OK.' >&4
11271         else
11272                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
11273                 i_db=$undef
11274                 case " $libs " in
11275                 *"-ldb "*)
11276                         : Remove db from list of libraries to use
11277                         echo "Removing unusable -ldb from library list" >&4
11278                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
11279                         shift
11280                         libs="$*"
11281                         echo "libs = $libs" >&4
11282                         ;;
11283                 esac
11284         fi
11285         $rm -f try.*
11286         ;;
11287 esac
11288
11289 case "$i_db" in
11290 define)
11291         : Check the return type needed for hash 
11292         echo " "
11293         echo "Checking return type needed for hash for Berkeley DB ..." >&4
11294         $cat >try.c <<EOCP
11295 #$d_const HASCONST
11296 #ifndef HASCONST
11297 #define const
11298 #endif
11299 #include <sys/types.h>
11300 #include <db.h>
11301
11302 #ifndef DB_VERSION_MAJOR
11303 u_int32_t hash_cb (ptr, size)
11304 const void *ptr;
11305 size_t size;
11306 {
11307 }
11308 HASHINFO info;
11309 int main()
11310 {
11311         info.hash = hash_cb;
11312 }
11313 #endif
11314 EOCP
11315         if $cc $ccflags -c try.c >try.out 2>&1 ; then
11316                 if $contains warning try.out >>/dev/null 2>&1 ; then
11317                         db_hashtype='int'
11318                 else
11319                         db_hashtype='u_int32_t'
11320                 fi
11321         else
11322                 : XXX Maybe we should just give up here.
11323                 db_hashtype=u_int32_t
11324                 $cat try.out >&4
11325                 echo "Help:  I can't seem to compile the db test program." >&4
11326                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
11327         fi
11328         $rm -f try.*
11329         echo "Your version of Berkeley DB uses $db_hashtype for hash."
11330         ;;
11331 *)      db_hashtype=u_int32_t
11332         ;;
11333 esac
11334 case "$i_db" in
11335 define)
11336         : Check the return type needed for prefix 
11337         echo " "
11338         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
11339         cat >try.c <<EOCP
11340 #$d_const HASCONST
11341 #ifndef HASCONST
11342 #define const
11343 #endif
11344 #include <sys/types.h>
11345 #include <db.h>
11346
11347 #ifndef DB_VERSION_MAJOR
11348 size_t prefix_cb (key1, key2)
11349 const DBT *key1;
11350 const DBT *key2;
11351 {
11352 }
11353 BTREEINFO info;
11354 int main()
11355 {
11356         info.prefix = prefix_cb;
11357 }
11358 #endif
11359 EOCP
11360         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
11361                 if $contains warning try.out >>/dev/null 2>&1 ; then
11362                         db_prefixtype='int'
11363                 else
11364                         db_prefixtype='size_t'
11365                 fi
11366         else
11367                 db_prefixtype='size_t'
11368                 : XXX Maybe we should just give up here.
11369                 $cat try.out >&4
11370                 echo "Help:  I can't seem to compile the db test program." >&4
11371                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
11372         fi
11373         $rm -f try.*
11374         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
11375         ;;
11376 *)      db_prefixtype='size_t'
11377         ;;
11378 esac
11379
11380 : check for void type
11381 echo " "
11382 echo "Checking to see how well your C compiler groks the void type..." >&4
11383 case "$voidflags" in
11384 '')
11385         $cat >try.c <<'EOCP'
11386 #if TRY & 1
11387 void sub() {
11388 #else
11389 sub() {
11390 #endif
11391         extern void moo();      /* function returning void */
11392         void (*goo)();          /* ptr to func returning void */
11393 #if TRY & 8
11394         void *hue;              /* generic ptr */
11395 #endif
11396 #if TRY & 2
11397         void (*foo[10])();
11398 #endif
11399
11400 #if TRY & 4
11401         if(goo == moo) {
11402                 exit(0);
11403         }
11404 #endif
11405         exit(0);
11406 }
11407 int main() { sub(); }
11408 EOCP
11409         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
11410                 voidflags=$defvoidused
11411         echo "Good.  It appears to support void to the level $package wants.">&4
11412                 if $contains warning .out >/dev/null 2>&1; then
11413                         echo "However, you might get some warnings that look like this:"
11414                         $cat .out
11415                 fi
11416         else
11417 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
11418                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
11419                         echo "It supports 1..."
11420                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
11421                                 echo "It also supports 2..."
11422                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
11423                                         voidflags=7
11424                                         echo "And it supports 4 but not 8 definitely."
11425                                 else
11426                                         echo "It doesn't support 4..."
11427                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
11428                                                 voidflags=11
11429                                                 echo "But it supports 8."
11430                                         else
11431                                                 voidflags=3
11432                                                 echo "Neither does it support 8."
11433                                         fi
11434                                 fi
11435                         else
11436                                 echo "It does not support 2..."
11437                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
11438                                         voidflags=13
11439                                         echo "But it supports 4 and 8."
11440                                 else
11441                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
11442                                                 voidflags=5
11443                                                 echo "And it supports 4 but has not heard about 8."
11444                                         else
11445                                                 echo "However it supports 8 but not 4."
11446                                         fi
11447                                 fi
11448                         fi
11449                 else
11450                         echo "There is no support at all for void."
11451                         voidflags=0
11452                 fi
11453         fi
11454 esac
11455 case "$voidflags" in
11456 "$defvoidused") ;;
11457 *)      $cat >&4 <<'EOM'
11458   Support flag bits are:
11459     1: basic void declarations.
11460     2: arrays of pointers to functions returning void.
11461     4: operations between pointers to and addresses of void functions.
11462     8: generic void pointers.
11463 EOM
11464         dflt="$voidflags";
11465         rp="Your void support flags add up to what?"
11466         . ./myread
11467         voidflags="$ans"
11468         ;;
11469 esac
11470 $rm -f try.* .out
11471
11472
11473 : How can we generate normalized random numbers ?
11474 echo " "
11475 echo "Looking for a random number function..." >&4
11476 case "$randfunc" in
11477 '')
11478         if set drand48 val -f; eval $csym; $val; then
11479                 dflt="drand48"
11480                 echo "Good, found drand48()." >&4
11481         elif set random val -f; eval $csym; $val; then
11482                 dflt="random"
11483                 echo "OK, found random()." >&4
11484         else
11485                 dflt="rand"
11486                 echo "Yick, looks like I have to use rand()." >&4
11487         fi
11488         echo " "
11489         ;;
11490 *)
11491         dflt="$randfunc"
11492         ;;
11493 esac
11494 cont=true
11495
11496 case "$ccflags" in
11497 *-Dmy_rand=*|*-Dmy_srand=*)
11498         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
11499         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
11500         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
11501         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
11502         ;;
11503 esac
11504
11505 while $test "$cont"; do
11506         rp="Use which function to generate random numbers?"
11507         . ./myread
11508         if $test "$ans" = "$dflt"; then
11509                 : null
11510         else
11511                 randbits=''
11512         fi
11513         randfunc="$ans"
11514         if set $ans val -f; eval $csym; $val; then
11515                 cont=''
11516         else
11517                 dflt=y
11518                 rp="I cannot find function $ans. Use that name anyway?"
11519                 . ./myread
11520                 dflt=rand
11521                 case "$ans" in
11522                         [yY]*) cont='';;
11523                 esac
11524         fi
11525         case "$cont" in
11526         '')
11527                 case "$randfunc" in
11528                 drand48)
11529                         drand01="drand48()"
11530                         seedfunc="srand48"
11531                         randbits=48
11532                         randseedtype=long
11533                         ;;
11534                 rand|random)
11535                         case "$randbits" in
11536                         '')
11537 echo "Checking to see how many bits your $randfunc() function produces..." >&4
11538                                 $cat >try.c <<EOCP
11539 #$i_unistd I_UNISTD
11540 #$i_stdlib I_STDLIB
11541 #include <stdio.h>
11542 #ifdef I_UNISTD
11543 #  include <unistd.h>
11544 #endif
11545 #ifdef I_STDLIB
11546 #  include <stdlib.h>
11547 #endif
11548 int main()
11549 {
11550         register int i;
11551         register unsigned long tmp;
11552         register unsigned long max = 0L;
11553
11554         for (i = 1000; i; i--) {
11555                 tmp = (unsigned long) $randfunc();
11556                 if (tmp > max) max = tmp;
11557         }
11558         for (i = 0; max; i++)
11559                 max /= 2;
11560         printf("%d\n",i);
11561 }
11562 EOCP
11563                                 set try
11564                                 if eval $compile_ok; then
11565                                         dflt=`try`
11566                                 else
11567                                         dflt='?'
11568                                         echo "(I can't seem to compile the test program...)"
11569                                 fi
11570                                 ;;
11571                         *)
11572                                 dflt="$randbits"
11573                                 ;;
11574                         esac
11575                         rp="How many bits does your $randfunc() function produce?"
11576                         . ./myread
11577                         randbits="$ans"
11578                         $rm -f try.c try
11579                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
11580                         seedfunc="s$randfunc"
11581                         randseedtype=unsigned
11582                         ;;
11583                 *)
11584                         dflt="31"
11585                         rp="How many bits does your $randfunc() function produce?"
11586                         . ./myread
11587                         randbits="$ans"
11588                         seedfunc="s$randfunc"
11589                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
11590                         if set $seedfunc val -f; eval $csym; $val; then
11591                                 echo "(Using $seedfunc() to seed random generator)"
11592                         else
11593                                 echo "(Warning: no $seedfunc() to seed random generator)"
11594                                 seedfunc=rand
11595                         fi
11596                         randseedtype=unsigned
11597                         ;;
11598                 esac
11599                 ;;
11600         esac
11601 done
11602
11603 echo " "
11604 echo "Determining whether or not we are on an EBCDIC system..." >&4
11605 $cat >tebcdic.c <<'EOM'
11606 int main()
11607 {
11608   if ('M'==0xd4) return 0;
11609   return 1;
11610 }
11611 EOM
11612
11613 val=$undef
11614 set tebcdic
11615 if eval $compile_ok; then
11616         if ./tebcdic; then
11617                 echo "You have EBCDIC." >&4
11618                 val="$define"
11619         else
11620                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin." >&4
11621         fi
11622 else
11623         echo "I'm unable to compile the test program." >&4
11624         echo "I'll assume ASCII or some ISO Latin." >&4
11625 fi
11626 $rm -f tebcdic.c tebcdic
11627 set ebcdic
11628 eval $setvar
11629
11630 echo " "
11631 $cat >&4 <<EOM
11632 Checking how to flush all pending stdio output...
11633 EOM
11634 # I only know how to find the first 32 possibly open files on SunOS.
11635 # See also hints/sunos_4_1.sh and util.c  --AD
11636 case "$osname" in
11637 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
11638 esac
11639 $cat >>try.c <<EOCP
11640 #include <stdio.h>
11641 #$i_unistd I_UNISTD
11642 #ifdef I_UNISTD
11643 # include <unistd.h>
11644 #endif
11645 #$d_sysconf HAS_SYSCONF
11646 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
11647 #ifdef HAS_STDIO_STREAM_ARRAY
11648 # define STDIO_STREAM_ARRAY $stdio_stream_array
11649 #endif
11650 int main() {
11651   FILE* p = fopen("try.out", "w");
11652 #ifdef TRY_FPUTC
11653   fputc('x', p);
11654 #else
11655 # ifdef TRY_FPRINTF
11656   fprintf(p, "x");
11657 # endif
11658 #endif
11659 #ifdef TRY_FFLUSH_NULL
11660   fflush(NULL);
11661 #endif
11662 #ifdef TRY_FFLUSH_ALL
11663   {
11664     long open_max = -1;
11665 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
11666     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
11667 # else
11668 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
11669     open_max = sysconf(_SC_OPEN_MAX);
11670 #  else
11671 #   ifdef FOPEN_MAX
11672     open_max = FOPEN_MAX;
11673 #   else
11674 #    ifdef OPEN_MAX
11675     open_max = OPEN_MAX;
11676 #    else
11677 #     ifdef _NFILE
11678     open_max = _NFILE;
11679 #     endif
11680 #    endif
11681 #   endif
11682 #  endif
11683 # endif 
11684 # ifdef HAS_STDIO_STREAM_ARRAY
11685     if (open_max > 0) {
11686       long i;
11687       for (i = 0; i < open_max; i++)
11688             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
11689                 STDIO_STREAM_ARRAY[i]._file < open_max &&
11690                 STDIO_STREAM_ARRAY[i]._flag)
11691                 fflush(&STDIO_STREAM_ARRAY[i]);
11692     }   
11693   }
11694 # endif
11695 #endif
11696   _exit(42);
11697 }
11698 EOCP
11699 : first we have to find out how _not_ to flush
11700 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
11701     output=''
11702     set try -DTRY_FPUTC
11703     if eval $compile; then
11704             $rm -f try.out
11705             ./try$exe_ext 2>/dev/null
11706             if $test ! -s try.out -a "X$?" = X42; then
11707                 output=-DTRY_FPUTC
11708             fi
11709     fi
11710     case "$output" in
11711     '')
11712             set try -DTRY_FPRINTF
11713             $rm -f try.out
11714             if eval $compile; then
11715                     $rm -f try.out
11716                     ./try$exe_ext 2>/dev/null
11717                     if $test ! -s try.out -a "X$?" = X42; then
11718                         output=-DTRY_FPRINTF
11719                     fi
11720             fi
11721         ;;
11722     esac
11723 fi
11724 : check for fflush NULL behaviour
11725 case "$fflushNULL" in
11726 '')     set try -DTRY_FFLUSH_NULL $output
11727         if eval $compile; then
11728                 $rm -f try.out
11729                 ./try$exe_ext 2>/dev/null
11730                 code="$?"
11731                 if $test -s try.out -a "X$code" = X42; then
11732                         fflushNULL="`$cat try.out`"
11733                 else
11734                         if $test "X$code" != X42; then
11735                                 $cat >&4 <<EOM
11736 (If this test failed, don't worry, we'll try another method shortly.)
11737 EOM
11738                         fi
11739                 fi
11740         fi
11741         $rm -f core try.core core.try.*
11742         case "$fflushNULL" in
11743         x)      $cat >&4 <<EOM
11744 Your fflush(NULL) works okay.
11745 EOM
11746                 fflushNULL="$define"
11747                 ;;
11748         '')     $cat >&4 <<EOM
11749 Your fflush(NULL) isn't working (contrary to ANSI C).
11750 EOM
11751                 fflushNULL="$undef"
11752                 ;;
11753         *)      $cat >&4 <<EOM
11754 Cannot figure out whether your fflush(NULL) works or not.
11755 I'm assuming it doesn't (contrary to ANSI C).
11756 EOM
11757                 fflushNULL="$undef"
11758                 ;;
11759         esac
11760         ;;
11761 $define|true|[yY]*)
11762         fflushNULL="$define"
11763         ;;
11764 *)
11765         fflushNULL="$undef"
11766         ;;
11767 esac
11768 : check explicit looping only if NULL did not work
11769 case "$fflushNULL" in
11770 "$undef")
11771         : check for fflush all behaviour
11772         case "$fflushall" in
11773         '')     set try -DTRY_FFLUSH_ALL $output
11774                 if eval $compile; then
11775                         $cat >&4 <<EOM
11776 (Now testing the other method--but note that also this may fail.)
11777 EOM
11778                         $rm -f try.out
11779                         ./try$exe_ext 2>/dev/null
11780                         if $test -s try.out -a "X$?" = X42; then
11781                                 fflushall="`$cat try.out`"
11782                         fi
11783                 fi
11784                 $rm -f core try.core core.try.*
11785                 case "$fflushall" in
11786                 x)      $cat >&4 <<EOM
11787 Whew. Flushing explicitly all the stdio streams works.
11788 EOM
11789                         fflushall="$define"
11790                         ;;
11791                 '')     $cat >&4 <<EOM
11792 Sigh. Flushing explicitly all the stdio streams doesn't work.
11793 EOM
11794                         fflushall="$undef"
11795                         ;;
11796                 *)      $cat >&4 <<EOM
11797 Cannot figure out whether flushing stdio streams explicitly works or not.
11798 I'm assuming it doesn't.
11799 EOM
11800                         fflushall="$undef"
11801                         ;;
11802                 esac
11803                 ;;
11804         "$define"|true|[yY]*)
11805                 fflushall="$define"
11806                 ;;
11807         *)
11808                 fflushall="$undef"
11809                 ;;
11810         esac
11811         ;;
11812 *)      fflushall="$undef"      
11813         ;;
11814 esac
11815 case "$fflushNULL$fflushall" in
11816 undefundef)
11817         $cat <<EOM
11818 I cannot figure out how to flush pending stdio output.
11819 EOM
11820         ;;
11821 esac
11822 $rm -f try.* try$exe_ext
11823
11824 : Store the full pathname to the ar program for use in the C program
11825 : Respect a hint or command line value for full_ar.
11826 case "$full_ar" in
11827 '') full_ar=$ar ;;
11828 esac
11829
11830 : Store the full pathname to the sed program for use in the C program
11831 full_sed=$sed
11832
11833 : see what type gids are declared as in the kernel
11834 echo " "
11835 echo "Looking for the type for group ids returned by getgid()."
11836 set gid_t gidtype xxx stdio.h sys/types.h
11837 eval $typedef
11838 case "$gidtype" in
11839 xxx)
11840         xxx=`./findhdr sys/user.h`
11841         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
11842         case $1 in
11843         unsigned) dflt="$1 $2" ;;
11844         *) dflt="$1" ;;
11845         esac
11846         ;;
11847 *) dflt="$gidtype";;
11848 esac
11849 case "$gidtype" in
11850 gid_t) echo "gid_t found." ;;
11851 *)      rp="What is the type for group ids returned by getgid()?"
11852         . ./myread
11853         gidtype="$ans"
11854         ;;
11855 esac
11856
11857 echo " "
11858 case "$gidtype" in
11859 *_t) zzz="$gidtype"     ;;
11860 *)   zzz="gid"          ;;
11861 esac
11862 echo "Checking the size of $zzz..." >&4 
11863 cat > try.c <<EOCP
11864 #include <sys/types.h>
11865 #include <stdio.h>
11866 int main() {
11867     printf("%d\n", (int)sizeof($gidtype));
11868     exit(0);
11869 }
11870 EOCP
11871 set try
11872 if eval $compile_ok; then
11873         yyy=`./try`
11874         case "$yyy" in
11875         '')     gidsize=4
11876                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
11877                 ;;
11878         *)      gidsize=$yyy
11879                 echo "Your $zzz size is $gidsize bytes."
11880                 ;;
11881         esac
11882 else
11883         gidsize=4
11884         echo "(I can't compile the test program--guessing $gidsize.)" >&4
11885 fi
11886
11887
11888 echo " "
11889 case "$gidtype" in
11890 *_t) zzz="$gidtype"     ;;
11891 *)   zzz="gid"          ;;
11892 esac
11893 echo "Checking the sign of $zzz..." >&4 
11894 cat > try.c <<EOCP
11895 #include <sys/types.h>
11896 #include <stdio.h>
11897 int main() {
11898         $gidtype foo = -1;
11899         if (foo < 0)
11900                 printf("-1\n");
11901         else
11902                 printf("1\n");
11903 }
11904 EOCP
11905 set try
11906 if eval $compile; then
11907         yyy=`./try`
11908         case "$yyy" in
11909         '')     gidsign=1
11910                 echo "(I can't execute the test program--guessing unsigned.)" >&4
11911                 ;;
11912         *)      gidsign=$yyy
11913                 case "$gidsign" in
11914                  1) echo "Your $zzz is unsigned." ;;
11915                 -1) echo "Your $zzz is signed."   ;;
11916                 esac
11917                 ;;
11918         esac
11919 else
11920         gidsign=1
11921         echo "(I can't compile the test program--guessing unsigned.)" >&4
11922 fi
11923
11924
11925 : check for length of character
11926 echo " "
11927 case "$charsize" in
11928 '')
11929         echo "Checking to see how big your characters are (hey, you never know)..." >&4
11930         $cat >try.c <<'EOCP'
11931 #include <stdio.h>
11932 int main()
11933 {
11934     printf("%d\n", (int)sizeof(char));
11935     exit(0);
11936 }
11937 EOCP
11938         set try
11939         if eval $compile_ok; then
11940                 dflt=`./try`
11941         else
11942                 dflt='1'
11943                 echo "(I can't seem to compile the test program.  Guessing...)"
11944         fi
11945         ;;
11946 *)
11947         dflt="$charsize"
11948         ;;
11949 esac
11950 rp="What is the size of a character (in bytes)?"
11951 . ./myread
11952 charsize="$ans"
11953 $rm -f try.c try
11954
11955
11956 echo " "
11957 $echo "Choosing the C types to be used for Perl's internal types..." >&4
11958
11959 case "$use64bits:$d_quad:$quadtype" in
11960 define:define:?*)
11961         ivtype="$quadtype"
11962         uvtype="$uquadtype"
11963         ivsize=8
11964         uvsize=8
11965         ;;
11966 *)      ivtype="long"
11967         uvtype="unsigned long"
11968         ivsize=$longsize
11969         uvsize=$longsize
11970         ;;
11971 esac
11972
11973 case "$uselongdouble:$d_longdbl" in
11974 define:define)
11975         nvtype="long double"
11976         nvsize=$longdblsize
11977         ;;
11978 *)      nvtype=double
11979         nvsize=$doublesize
11980         ;;
11981 esac
11982
11983 echo "(IV will be "$ivtype", $ivsize bytes)"
11984 echo "(UV will be "$uvtype", $uvsize bytes)"
11985 echo "(NV will be "$nvtype", $nvsize bytes)"
11986
11987 $cat >try.c <<EOCP
11988 #$i_inttypes I_INTTYPES
11989 #ifdef I_INTTYPES
11990 #include <inttypes.h>
11991 #endif
11992 #include <stdio.h>
11993 int main() {
11994 #ifdef INT8
11995    int8_t i =  INT8_MAX;
11996   uint8_t u = UINT8_MAX;
11997   printf("int8_t\n");
11998 #endif
11999 #ifdef INT16
12000    int16_t i =  INT16_MAX;
12001   uint16_t i = UINT16_MAX;
12002   printf("int16_t\n");
12003 #endif
12004 #ifdef INT32
12005    int32_t i =  INT32_MAX;
12006   uint32_t u = UINT32_MAX;
12007   printf("int32_t\n");
12008 #endif
12009 }
12010 EOCP
12011
12012 case "$i8type" in
12013 '')     case "$charsize" in
12014         1)      i8type=char
12015                 u8type="unsigned char"
12016                 i8size=$charsize
12017                 u8size=$charsize
12018                 ;;
12019         esac
12020         ;;
12021 esac
12022 case "$i8type" in
12023 '')     set try -DINT8
12024         if eval $compile; then
12025                 case "`./try$exe_ext`" in
12026                 int8_t) i8type=int8_t
12027                         u8type=uint8_t
12028                         i8size=1
12029                         u8size=1
12030                         ;;
12031                 esac
12032         fi
12033         ;;
12034 esac
12035 case "$i8type" in
12036 '')     if $test $charsize -ge 1; then
12037                 i8type=char
12038                 u8type="unsigned char"
12039                 i8size=$charsize
12040                 u8size=$charsize
12041         fi
12042         ;;
12043 esac
12044
12045 case "$i16type" in
12046 '')     case "$shortsize" in
12047         2)      i16type=short
12048                 u16type="unsigned short"
12049                 i16size=$shortsize
12050                 u16size=$shortsize
12051                 ;;
12052         esac
12053         ;;
12054 esac
12055 case "$i16type" in
12056 '')     set try -DINT16
12057         if eval $compile; then
12058                 case "`./try$exe_ext`" in
12059                 int16_t)
12060                         i16type=int16_t
12061                         u16type=uint16_t
12062                         i16size=2
12063                         u16size=2
12064                         ;;
12065                 esac
12066         fi
12067         ;;
12068 esac
12069 case "$i16type" in
12070 '')     if $test $shortsize -ge 2; then
12071                 i16type=short
12072                 u16type="unsigned short"
12073                 i16size=$shortsize
12074                 u16size=$shortsize
12075         fi
12076         ;;
12077 esac
12078
12079 case "$i32type" in
12080 '')     case "$longsize" in
12081         4)      i32type=long
12082                 u32type="unsigned long"
12083                 i32size=$longsize
12084                 u32size=$longsize
12085                 ;;
12086         *)      case "$intsize" in
12087                 4)      i32type=int
12088                         u32type="unsigned int"
12089                         i32size=$intsize
12090                         u32size=$intsize
12091                         ;;
12092                 esac
12093                 ;;
12094         esac
12095         ;;
12096 esac
12097 case "$i32type" in
12098 '')     set try -DINT32
12099         if eval $compile; then
12100                 case "`./try$exe_ext`" in
12101                 int32_t)
12102                         i32type=int32_t
12103                         u32type=uint32_t
12104                         i32size=4
12105                         u32size=4
12106                         ;;
12107                 esac
12108         fi
12109         ;;
12110 esac
12111 case "$i32type" in
12112 '')     if $test $intsize -ge 4; then
12113                 i32type=int
12114                 u32type="unsigned int"
12115                 i32size=$intsize
12116                 u32size=$intsize
12117         fi
12118         ;;
12119 esac
12120
12121 case "$i64type" in
12122 '')     case "$d_quad:$quadtype" in
12123         define:?*)
12124                 i64type="$quadtype"
12125                 u64type="$uquadtype"
12126                 i64size=8
12127                 u64size=8
12128                 ;;
12129         esac
12130         ;;
12131 esac
12132
12133 $rm -f try.* try
12134
12135 echo " "
12136
12137 if $test X"$quadtype" != X; then
12138
12139 echo "Checking how to print 64-bit integers..." >&4
12140
12141 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
12142         $cat >try.c <<'EOCP'
12143 #include <sys/types.h>
12144 #include <stdio.h>
12145 int main() {
12146   int q = 12345678901;
12147   printf("%ld\n", q);
12148 }
12149 EOCP
12150         set try
12151         if eval $compile; then
12152                 yyy=`./try$exe_ext`
12153                 case "$yyy" in
12154                 12345678901)
12155                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
12156                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIX64='"X"';
12157                         echo "We will use %d."
12158                         ;;
12159                 esac
12160         fi
12161 fi
12162
12163 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
12164         $cat >try.c <<'EOCP'
12165 #include <sys/types.h>
12166 #include <stdio.h>
12167 int main() {
12168   long q = 12345678901;
12169   printf("%ld\n", q);
12170 }
12171 EOCP
12172         set try
12173         if eval $compile; then
12174                 yyy=`./try$exe_ext`
12175                 case "$yyy" in
12176                 12345678901)
12177                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
12178                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIX64='"lX"';
12179                         echo "We will use %ld."
12180                         ;;
12181                 esac
12182         fi
12183 fi
12184
12185 if $test X"$sPRId64" = X -a X"$i_inttypes.h" = X"$define" -a X"$quadtype" = Xint64_t; then
12186         $cat >try.c <<'EOCP'
12187 #include <sys/types.h>
12188 #include <inttypes.h>
12189 #include <stdio.h>
12190 int main() {
12191   int64_t q = 12345678901;
12192   printf("%" PRId64 "\n", q);
12193 }
12194 EOCP
12195         set try
12196         if eval $compile; then
12197                 yyy=`./try$exe_ext`
12198                 case "$yyy" in
12199                 12345678901)
12200                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
12201                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIX64=PRIX64;
12202                         echo "We will use the C9X style."
12203                         ;;
12204                 esac
12205         fi
12206 fi
12207
12208 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
12209         $cat >try.c <<'EOCP'
12210 #include <sys/types.h>
12211 #include <stdio.h>
12212 int main() {
12213   long long q = 12345678901LL; /* AIX cc requires the LL prefix. */
12214   printf("%lld\n", q);
12215 }
12216 EOCP
12217         set try
12218         if eval $compile; then
12219                 yyy=`./try$exe_ext`
12220                 case "$yyy" in
12221                 12345678901)
12222                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
12223                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIX64='"llX"';
12224                         echo "We will use the %lld style."
12225                         ;;
12226                 esac
12227         fi
12228 fi
12229
12230 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
12231         $cat >try.c <<EOCP
12232 #include <sys/types.h>
12233 #include <stdio.h>
12234 int main() {
12235   $quadtype q = 12345678901;
12236   printf("%Ld\n", q);
12237 }
12238 EOCP
12239         set try
12240         if eval $compile; then
12241                 yyy=`./try$exe_ext`
12242                 case "$yyy" in
12243                 12345678901)
12244                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
12245                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIX64='"LX"';
12246                         echo "We will use %Ld."
12247                         ;;
12248                 esac
12249         fi
12250 fi
12251
12252 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
12253         $cat >try.c <<EOCP
12254 #include <sys/types.h>
12255 #include <stdio.h>
12256 int main() {
12257   $quadtype q = 12345678901;
12258   printf("%qd\n", q);
12259 }
12260 EOCP
12261         set try
12262         if eval $compile; then
12263                 yyy=`./try$exe_ext`
12264                 case "$yyy" in
12265                 12345678901)
12266                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
12267                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIX64='"qX"';
12268                         echo "We will use %qd."
12269                         ;;
12270                 esac
12271         fi
12272 fi
12273
12274 if $test X"$sPRId64" = X; then
12275         echo "Cannot figure out how to print 64-bit integers." >&4
12276 fi
12277
12278 $rm -f try try.*
12279
12280 fi
12281
12282 case "$sPRId64" in
12283 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef"; 
12284         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIX64="$undef"; 
12285         ;;
12286 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define"; 
12287         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIX64="$define"; 
12288         ;;
12289 esac
12290
12291
12292 echo " "
12293 $echo "Checking the format strings to be used for Perl's internal types..." >&4
12294
12295 if $test X"$ivsize" = X8; then
12296         ivdformat="$sPRId64"
12297         uvuformat="$sPRIu64"
12298         uvoformat="$sPRIo64"
12299         uvxformat="$sPRIx64"
12300 else
12301         if $test X"$ivsize" = X"$longsize"; then
12302                 ivdformat='"ld"'
12303                 uvuformat='"lu"'
12304                 uvoformat='"lo"'
12305                 uvxformat='"lx"'
12306         else
12307                 if $test X"$ivsize" = X"$intsize"; then
12308                         ivdformat='"d"'
12309                         uvuformat='"u"'
12310                         uvoformat='"o"'
12311                         uvxformat='"x"'
12312                 else
12313                         : far out
12314                         if $test X"$ivsize" = X"$shortsize"; then
12315                                 ivdformat='"hd"'
12316                                 uvuformat='"hu"'
12317                                 uvoformat='"ho"'
12318                                 uvxformat='"hx"'
12319                         fi
12320                 fi
12321         fi
12322 fi
12323
12324 case "$ivdformat" in
12325 '') echo "$0: Fatal: failed to find format strings, cannot continue." >& 4
12326     exit 1
12327     ;;
12328 esac
12329
12330
12331 echo " "
12332 $echo "Checking the format string to be used for gids..." >&4
12333
12334 case "$gidsign" in
12335 -1)     if $test X"$gidsize" = X"$ivsize"; then
12336                 gidformat="$ivdformat"
12337         else
12338                 if $test X"$gidsize" = X"$longsize"; then
12339                         gidformat='"ld"'
12340                 else
12341                         if $test X"$gidsize" = X"$intsize"; then
12342                                 gidformat='"d"'
12343                         else
12344                                 if $test X"$gidsize" = X"$shortsize"; then
12345                                         gidformat='"hd"'
12346                                 fi
12347                         fi
12348                 fi
12349         fi
12350         ;;
12351 *)      if $test X"$gidsize" = X"$uvsize"; then
12352                 gidformat="$uvuformat"
12353         else
12354                 if $test X"$gidsize" = X"$longsize"; then
12355                         gidformat='"lu"'
12356                 else
12357                         if $test X"$gidsize" = X"$intsize"; then
12358                                 gidformat='"u"'
12359                         else
12360                                 if $test X"$gidsize" = X"$shortsize"; then
12361                                         gidformat='"hu"'
12362                                 fi
12363                         fi
12364                 fi
12365         fi
12366         ;;
12367 esac
12368
12369 : see if getgroups exists
12370 set getgroups d_getgrps
12371 eval $inlibc
12372
12373 : see if setgroups exists
12374 set setgroups d_setgrps
12375 eval $inlibc
12376
12377
12378 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
12379 echo " "
12380 case "$d_getgrps$d_setgrps" in
12381 *define*)
12382         case "$groupstype" in
12383         '') dflt="$gidtype" ;;
12384         *)  dflt="$groupstype" ;;
12385         esac
12386         $cat <<EOM
12387 What type of pointer is the second argument to getgroups() and setgroups()?
12388 Usually this is the same as group ids, $gidtype, but not always.
12389
12390 EOM
12391         rp='What type pointer is the second argument to getgroups() and setgroups()?'
12392         . ./myread
12393         groupstype="$ans"
12394         ;;
12395 *)  groupstype="$gidtype";;
12396 esac
12397
12398 echo " "
12399 echo "Checking if your $make program sets \$(MAKE)..." >&4
12400 case "$make_set_make" in
12401 '')
12402         $sed 's/^X //' > testmake.mak << 'EOF'
12403 Xall:
12404 X       @echo 'maketemp="$(MAKE)"'
12405 EOF
12406         case "`$make -f testmake.mak 2>/dev/null`" in
12407         *maketemp=*) make_set_make='#' ;;
12408         *)      make_set_make="MAKE=$make" ;;
12409         esac
12410         $rm -f testmake.mak
12411         ;;
12412 esac
12413 case "$make_set_make" in
12414 '#') echo "Yup, it does.";;
12415 *) echo "Nope, it doesn't.";;
12416 esac
12417
12418 : see what type is used for mode_t
12419 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
12420 set mode_t modetype int stdio.h sys/types.h
12421 eval $typedef_ask
12422
12423 : define a fucntion to check prototypes
12424 $cat > protochk <<EOSH
12425 $startsh
12426 cc="$cc"
12427 optimize="$optimize"
12428 ccflags="$ccflags"
12429 prototype="$prototype"
12430 define="$define"
12431 rm=$rm
12432 EOSH
12433
12434 $cat >> protochk <<'EOSH'
12435
12436 $rm -f try.c
12437 foo="$1"
12438 shift
12439 while test $# -ge 2; do
12440         case "$1" in
12441                 $define) echo "#include <$2>" >> try.c ;;
12442                 literal) echo "$2" >> try.c ;;
12443         esac
12444     shift 2
12445 done
12446 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
12447 cat >> try.c <<'EOCP'
12448 #ifdef CAN_PROTOTYPE
12449 #define _(args) args
12450 #else
12451 #define _(args) ()
12452 #endif
12453 EOCP
12454 echo "$foo" >> try.c
12455 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
12456 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
12457 status=$?
12458 $rm -f try.[co]
12459 exit $status
12460 EOSH
12461 chmod +x protochk
12462 $eunicefix protochk
12463
12464 : see what type is used for size_t
12465 rp="What is the type used for the length parameter for string functions?"
12466 set size_t sizetype 'unsigned int' stdio.h sys/types.h
12467 eval $typedef_ask
12468
12469 : check for type of arguments to gethostbyaddr. 
12470 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
12471         case "$d_gethbyaddr" in
12472         $define)
12473                 $cat <<EOM
12474
12475 Checking to see what type of arguments are accepted by gethostbyaddr().
12476 EOM
12477                 hdrs="$define sys/types.h
12478                         $d_socket sys/socket.h 
12479                         $i_niin netinet/in.h 
12480                         $i_netdb netdb.h
12481                         $i_unistd unistd.h"
12482                 : The first arg can 'char *' or 'void *'
12483                 : The second arg is some of integral type
12484                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
12485                         for yyy in size_t long int; do
12486                                 case "$netdb_host_type" in
12487                                 '')     try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
12488                                         if ./protochk "$try" $hdrs; then
12489                                                 echo "Your system accepts $xxx for the first arg."
12490                                                 echo "...and $yyy for the second arg."
12491                                                 netdb_host_type="$xxx"
12492                                                 netdb_hlen_type="$yyy"
12493                                         fi
12494                                         ;;
12495                                 esac
12496                         done
12497                 done
12498                 : In case none of those worked, prompt the user.
12499                 case "$netdb_host_type" in
12500                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
12501                         dflt='char *'
12502                         . ./myread
12503                         netdb_host_type=$ans
12504                         rp='What is the type for the 2nd argument to gethostbyaddr?'
12505                         dflt="$sizetype"
12506                         . ./myread
12507                         netdb_hlen_type=$ans
12508                         ;;
12509                 esac
12510                 ;;
12511         *)      : no gethostbyaddr, so pick harmless defaults
12512                 netdb_host_type='char *'
12513                 netdb_hlen_type="$sizetype"
12514                 ;;
12515         esac
12516         # Remove the "const" if needed. -- but then we'll have a 
12517         # prototype clash!
12518         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
12519 fi
12520
12521 : check for type of argument to gethostbyname. 
12522 if test "X$netdb_name_type" = X ; then
12523         case "$d_gethbyname" in
12524         $define)
12525                 $cat <<EOM
12526
12527 Checking to see what type of argument is accepted by gethostbyname().
12528 EOM
12529                 hdrs="$define sys/types.h
12530                         $d_socket sys/socket.h 
12531                         $i_niin netinet/in.h 
12532                         $i_netdb netdb.h
12533                         $i_unistd unistd.h"
12534                 for xxx in "const char *" "char *"; do
12535                         case "$netdb_name_type" in
12536                         '')     try="extern struct hostent *gethostbyname($xxx);"
12537                                 if ./protochk "$try" $hdrs; then
12538                                         echo "Your system accepts $xxx."
12539                                         netdb_name_type="$xxx"
12540                                 fi
12541                                 ;;
12542                         esac
12543                 done
12544                 : In case none of those worked, prompt the user.
12545                 case "$netdb_name_type" in
12546                 '')     rp='What is the type for the 1st argument to gethostbyname?'
12547                         dflt='char *'
12548                         . ./myread
12549                         netdb_name_type=$ans
12550                         ;;
12551                 esac
12552                 ;;
12553         *)      : no gethostbyname, so pick harmless default
12554                 netdb_name_type='char *'
12555                 ;;
12556         esac
12557 fi
12558
12559 : check for type of 1st argument to getnetbyaddr. 
12560 if test "X$netdb_net_type" = X ; then
12561         case "$d_getnbyaddr" in
12562         $define)
12563                 $cat <<EOM
12564
12565 Checking to see what type of 1st argument is accepted by getnetbyaddr().
12566 EOM
12567                 hdrs="$define sys/types.h
12568                         $d_socket sys/socket.h 
12569                         $i_niin netinet/in.h 
12570                         $i_netdb netdb.h
12571                         $i_unistd unistd.h"
12572                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
12573                         case "$netdb_net_type" in
12574                         '')     try="extern struct netent *getnetbyaddr($xxx, int);"
12575                                 if ./protochk "$try" $hdrs; then
12576                                         echo "Your system accepts $xxx."
12577                                         netdb_net_type="$xxx"
12578                                 fi
12579                                 ;;
12580                         esac
12581                 done
12582                 : In case none of those worked, prompt the user.
12583                 case "$netdb_net_type" in
12584                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
12585                         dflt='long'
12586                         . ./myread
12587                         netdb_net_type=$ans
12588                         ;;
12589                 esac
12590                 ;;
12591         *)      : no getnetbyaddr, so pick harmless default
12592                 netdb_net_type='long'
12593                 ;;
12594         esac
12595 fi
12596 : locate the preferred pager for this system
12597 case "$pager" in
12598 '')
12599         dflt=''
12600         case "$pg" in
12601         /*) dflt=$pg;;
12602         esac
12603         case "$more" in
12604         /*) dflt=$more;;
12605         esac
12606         case "$less" in
12607         /*) dflt=$less;;
12608         esac
12609         case "$dflt" in
12610         '') dflt=/usr/ucb/more;;
12611         esac
12612         ;;
12613 *) dflt="$pager";;
12614 esac
12615 echo " "
12616 fn=f/
12617 rp='What pager is used on your system?'
12618 . ./getfile
12619 pager="$ans"
12620
12621 : see what type pids are declared as in the kernel
12622 rp="What is the type of process ids on this system?"
12623 set pid_t pidtype int stdio.h sys/types.h
12624 eval $typedef_ask
12625
12626 : Find earliest binary compatible site_perl subdirectory perl can use.
12627 case "$bincompat5005" in
12628 "$define") xs_apiversion='5.005' ;;
12629 *) xs_apiversion=$apiversion ;;   # The current site_perl version.
12630 esac
12631 : Find earliest pure perl site_perl subdirectory perl can use.
12632 : The versioned directories started at 5.005.
12633 pm_apiversion='5.005'
12634
12635 : check for length of pointer
12636 echo " "
12637 case "$ptrsize" in
12638 '')
12639         $echo $n "Checking to see how big your pointers are...$c" >&4
12640         if test "$voidflags" -gt 7; then
12641                 echo '#define VOID_PTR char *' > try.c
12642         else
12643                 echo '#define VOID_PTR void *' > try.c
12644         fi
12645         $cat >>try.c <<'EOCP'
12646 #include <stdio.h>
12647 int main()
12648 {
12649     printf("%d\n", (int)sizeof(VOID_PTR));
12650     exit(0);
12651 }
12652 EOCP
12653         set try
12654         if eval $compile_ok; then
12655                 ptrsize=`./try`
12656                 $echo " $ptrsize bytes." >&4
12657         else
12658                 dflt='4'
12659                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
12660                 rp="What is the size of a pointer (in bytes)?"
12661                 . ./myread
12662                 ptrsize="$ans"
12663         fi
12664         ;;
12665 esac
12666 $rm -f try.c try
12667
12668 : see if ar generates random libraries by itself
12669 echo " "
12670 echo "Checking how to generate random libraries on your machine..." >&4
12671 echo 'int bar1() { return bar2(); }' > bar1.c
12672 echo 'int bar2() { return 2; }' > bar2.c
12673 $cat > foo.c <<'EOP'
12674 int main() { printf("%d\n", bar1()); exit(0); }
12675 EOP
12676 $cc $ccflags -c bar1.c >/dev/null 2>&1
12677 $cc $ccflags -c bar2.c >/dev/null 2>&1
12678 $cc $ccflags -c foo.c >/dev/null 2>&1
12679 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
12680 if $cc $ccflags $ldflags -o foobar foo$_o bar$_a $libs > /dev/null 2>&1 &&
12681         ./foobar >/dev/null 2>&1; then
12682         echo "$ar appears to generate random libraries itself."
12683         orderlib=false
12684         ranlib=":"
12685 elif $ar ts bar$_a >/dev/null 2>&1 &&
12686         $cc $ccflags $ldflags -o foobar foo$_o bar$_a $libs > /dev/null 2>&1 &&
12687         ./foobar >/dev/null 2>&1; then
12688                 echo "a table of contents needs to be added with '$ar ts'."
12689                 orderlib=false
12690                 ranlib="$ar ts"
12691 else
12692         case "$ranlib" in
12693         :) ranlib='';;
12694         '')
12695                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
12696                 $test -f $ranlib || ranlib=''
12697                 ;;
12698         esac
12699         if $test -n "$ranlib"; then
12700                 echo "your system has '$ranlib'; we'll use that."
12701                 orderlib=false
12702         else
12703                 echo "your system doesn't seem to support random libraries"
12704                 echo "so we'll use lorder and tsort to order the libraries."
12705                 orderlib=true
12706                 ranlib=":"
12707         fi
12708 fi
12709 $rm -f foo* bar* 
12710
12711 : check for type of arguments to select. 
12712 case "$selecttype" in
12713 '') case "$d_select" in
12714         $define)
12715                 $cat <<EOM
12716 Checking to see what type of arguments are accepted by select().
12717 EOM
12718                 hdrs="$define sys/types.h
12719                         $i_systime sys/time.h 
12720                         $i_sysselct sys/select.h
12721                         $d_socket sys/socket.h"
12722                 : The first arg can be int, unsigned, or size_t
12723                 : The last arg may or may not be 'const'
12724                 val=''
12725                 : void pointer has been seen but using that
12726                 : breaks the selectminbits test
12727                 for xxx in 'fd_set *' 'int *'; do
12728                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
12729                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
12730                                         case "$val" in
12731                                         '')     try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
12732                                                 if ./protochk "$try" $hdrs; then
12733                                                         echo "Your system accepts $xxx."
12734                                                         val="$xxx"
12735                                                 fi
12736                                                 ;;
12737                                         esac
12738                                 done
12739                         done
12740                 done
12741                 case "$val" in
12742                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
12743                         case "$d_fd_set" in
12744                                 $define) dflt="fd_set *" ;;
12745                                 *)              dflt="int *" ;;
12746                         esac
12747                         . ./myread
12748                         val=$ans
12749                         ;;
12750                 esac
12751                 selecttype="$val"
12752                 ;;
12753         *)      : no select, so pick a harmless default
12754                 selecttype='int *'
12755                 ;;
12756         esac
12757         ;;
12758 esac
12759
12760 : check for the select 'width'
12761 case "$selectminbits" in
12762 '') case "$d_select" in
12763         $define)
12764                 $cat <<EOM
12765
12766 Checking to see on how many bits at a time your select() operates...
12767 EOM
12768                 $cat >try.c <<EOCP
12769 #include <sys/types.h>
12770 #$i_time I_TIME
12771 #$i_systime I_SYS_TIME
12772 #$i_systimek I_SYS_TIME_KERNEL
12773 #ifdef I_TIME
12774 #   include <time.h>
12775 #endif
12776 #ifdef I_SYS_TIME
12777 #   ifdef I_SYS_TIME_KERNEL
12778 #       define KERNEL
12779 #   endif
12780 #   include <sys/time.h>
12781 #   ifdef I_SYS_TIME_KERNEL
12782 #       undef KERNEL
12783 #   endif
12784 #endif
12785 #$i_sysselct I_SYS_SELECT
12786 #ifdef I_SYS_SELECT
12787 #include <sys/select.h>
12788 #endif
12789 #$d_socket HAS_SOCKET
12790 #ifdef HAS_SOCKET
12791 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
12792 #endif
12793 #include <stdio.h>
12794 $selecttype b;
12795 #define S sizeof(*(b))
12796 #define MINBITS 64
12797 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
12798 #define NBITS  (NBYTES * 8)
12799 int main() {
12800     char s[NBYTES];
12801     struct timeval t;
12802     int i;
12803     FILE* fp;
12804     int fd;
12805
12806     fclose(stdin);
12807     fp = fopen("try.c", "r");
12808     if (fp == 0)
12809       exit(1);
12810     fd = fileno(fp);
12811     if (fd < 0)
12812       exit(2);
12813     b = ($selecttype)s;
12814     for (i = 0; i < NBITS; i++)
12815         FD_SET(i, b);
12816     t.tv_sec  = 0;
12817     t.tv_usec = 0;
12818     select(fd + 1, b, 0, 0, &t);
12819     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
12820     printf("%d\n", i + 1);
12821     return 0;
12822 }
12823 EOCP
12824                 set try
12825                 if eval $compile_ok; then
12826                         selectminbits=`./try`
12827                         case "$selectminbits" in
12828                         '')     cat >&4 <<EOM
12829 Cannot figure out on how many bits at a time your select() operates.
12830 I'll play safe and guess it is 32 bits.
12831 EOM
12832                                 selectminbits=32
12833                                 bits="32 bits"
12834                                 ;;
12835                         1)      bits="1 bit" ;;
12836                         *)      bits="$selectminbits bits" ;;
12837                         esac
12838                         echo "Your select() operates on $bits at a time." >&4
12839                 else
12840                         rp='What is the minimum number of bits your select() operates on?'
12841                         case "$byteorder" in
12842                         1234|12345678)  dflt=32 ;;
12843                         *)              dflt=1  ;;
12844                         esac
12845                         . ./myread
12846                         val=$ans
12847                         selectminbits="$val"
12848                 fi
12849                 $rm -f try.* try
12850                 ;;
12851         *)      : no select, so pick a harmless default
12852                 selectminbits='32'
12853                 ;;
12854         esac
12855         ;;
12856 esac
12857
12858 : Trace out the files included by signal.h, then look for SIGxxx names.
12859 : Remove SIGARRAYSIZE used by HPUX.
12860 : Remove SIGSTKSIZE used by Linux.
12861 : Remove SIGSTKSZ used by Posix.
12862 : Remove SIGTYP void lines used by OS2.
12863 : Some cpps, like os390, dont give the file name anywhere
12864 if [ "X$fieldn" = X ]; then
12865         : Just make some guesses.  We check them later.
12866         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
12867 else
12868         xxx=`echo '#include <signal.h>' |
12869         $cppstdin $cppminus $cppflags 2>/dev/null |
12870         $grep '^[       ]*#.*include' | 
12871         $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sort | $uniq`
12872 fi
12873 : Check this list of files to be sure we have parsed the cpp output ok.
12874 : This will also avoid potentially non-existent files, such 
12875 : as ../foo/bar.h
12876 xxxfiles=''
12877 for xx in $xxx /dev/null ; do
12878         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
12879 done
12880 : If we have found no files, at least try signal.h
12881 case "$xxxfiles" in
12882 '')     xxxfiles=`./findhdr signal.h` ;;
12883 esac
12884 xxx=`awk '
12885 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
12886         print substr($2, 4, 20)
12887 }
12888 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
12889         print substr($3, 4, 20)
12890 }' $xxxfiles`
12891 : Append some common names just in case the awk scan failed.
12892 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
12893 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
12894 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
12895 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
12896 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
12897
12898 : generate a few handy files for later
12899 $cat > signal.c <<'EOCP'
12900 #include <sys/types.h>
12901 #include <signal.h>
12902 #include <stdio.h>
12903 int main() {
12904
12905 /* Strange style to avoid deeply-nested #if/#else/#endif */
12906 #ifndef NSIG
12907 #  ifdef _NSIG
12908 #    define NSIG (_NSIG)
12909 #  endif
12910 #endif
12911
12912 #ifndef NSIG
12913 #  ifdef SIGMAX
12914 #    define NSIG (SIGMAX+1)
12915 #  endif
12916 #endif
12917
12918 #ifndef NSIG
12919 #  ifdef SIG_MAX
12920 #    define NSIG (SIG_MAX+1)
12921 #  endif
12922 #endif
12923
12924 #ifndef NSIG
12925 #  ifdef MAXSIG
12926 #    define NSIG (MAXSIG+1)
12927 #  endif
12928 #endif
12929
12930 #ifndef NSIG
12931 #  ifdef MAX_SIG
12932 #    define NSIG (MAX_SIG+1)
12933 #  endif
12934 #endif
12935
12936 #ifndef NSIG
12937 #  ifdef SIGARRAYSIZE
12938 #    define NSIG (SIGARRAYSIZE+1) /* Not sure of the +1 */
12939 #  endif
12940 #endif
12941
12942 #ifndef NSIG
12943 #  ifdef _sys_nsig
12944 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
12945 #  endif
12946 #endif
12947
12948 /* Default to some arbitrary number that's big enough to get most
12949    of the common signals.
12950 */
12951 #ifndef NSIG
12952 #    define NSIG 50
12953 #endif
12954
12955 printf("NSIG %d\n", NSIG);
12956
12957 #ifndef JUST_NSIG
12958
12959 EOCP
12960
12961 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
12962 {
12963         printf "#ifdef SIG"; printf $1; printf "\n"
12964         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
12965         printf $1; printf ");\n"
12966         printf "#endif\n"
12967 }
12968 END {
12969         printf "#endif /* JUST_NSIG */\n";
12970         printf "exit(0);\n}\n";
12971 }
12972 ' >>signal.c
12973 $cat >signal.awk <<'EOP'
12974 BEGIN { ndups = 0 }
12975 $1 ~ /^NSIG$/ { nsig = $2 }
12976 ($1 !~ /^NSIG$/) && (NF == 2) {
12977     if ($2 > maxsig) { maxsig = $2 }
12978     if (sig_name[$2]) {
12979         dup_name[ndups] = $1
12980         dup_num[ndups] = $2
12981         ndups++ 
12982     }
12983     else {
12984         sig_name[$2] = $1
12985         sig_num[$2] = $2
12986     }
12987 }
12988 END { 
12989     if (nsig == 0) {
12990         nsig = maxsig + 1
12991     }
12992     printf("NSIG %d\n", nsig);
12993     for (n = 1; n < nsig; n++) {
12994         if (sig_name[n]) {
12995             printf("%s %d\n", sig_name[n], sig_num[n])
12996         }
12997         else {
12998             printf("NUM%d %d\n", n, n) 
12999         }
13000     }
13001     for (n = 0; n < ndups; n++) {
13002         printf("%s %d\n", dup_name[n], dup_num[n])
13003     }
13004 }
13005 EOP
13006 $cat >signal_cmd <<EOS
13007 $startsh
13008 if $test -s signal.lst; then
13009     echo "Using your existing signal.lst file"
13010         exit 0
13011 fi
13012 xxx="$xxx"
13013 EOS
13014 $cat >>signal_cmd <<'EOS'
13015
13016 set signal
13017 if eval $compile_ok; then
13018         ./signal$_exe | $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
13019 else
13020         echo "(I can't seem be able to compile the whole test program)" >&4
13021         echo "(I'll try it in little pieces.)" >&4
13022         set signal -DJUST_NSIG
13023         if eval $compile_ok; then
13024                 ./signal$_exe > signal.nsg
13025                 $cat signal.nsg
13026         else
13027                 echo "I can't seem to figure out how many signals you have." >&4
13028                 echo "Guessing 50." >&4
13029                 echo 'NSIG 50' > signal.nsg
13030         fi
13031         : Now look at all the signal names, one at a time.
13032         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
13033                 $cat > signal.c <<EOCP
13034 #include <sys/types.h>
13035 #include <signal.h>
13036 #include <stdio.h>
13037 int main() {
13038 printf("$xx %d\n", SIG${xx});
13039 return 0;
13040 }
13041 EOCP
13042                 set signal
13043                 if eval $compile; then
13044                         echo "SIG${xx} found."
13045                         ./signal$_exe  >> signal.ls1
13046                 else
13047                         echo "SIG${xx} NOT found."
13048                 fi
13049         done
13050         if $test -s signal.ls1; then
13051                 $cat signal.nsg signal.ls1 |
13052                         $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
13053         fi
13054
13055 fi
13056 if $test -s signal.lst; then
13057         :
13058 else
13059         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
13060         echo 'kill -l' >signal
13061         set X `csh -f <signal`
13062         $rm -f signal
13063         shift
13064         case $# in
13065         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
13066         esac
13067         echo $@ | $tr ' ' $trnl | \
13068             $awk '{ printf "%s %d\n", $1, ++s; }
13069                   END { printf "NSIG %d\n", ++s }' >signal.lst
13070 fi
13071 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
13072 EOS
13073 chmod a+x signal_cmd
13074 $eunicefix signal_cmd
13075
13076 : generate list of signal names
13077 echo " "
13078 case "$sig_name_init" in
13079 '') doinit=yes ;;
13080 *)  case "$sig_num_init" in
13081     ''|*,*) doinit=yes ;;
13082     esac ;;
13083 esac
13084 case "$doinit" in
13085 yes)
13086         echo "Generating a list of signal names and numbers..." >&4
13087         . ./signal_cmd
13088         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
13089         sig_name=`$awk 'BEGIN { printf "ZERO " }
13090                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
13091         sig_num=`$awk  'BEGIN { printf "0 " }
13092                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
13093         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
13094                              !/^NSIG/   { printf "\"%s\", ", $1 }
13095                              END        { printf "0\n" }' signal.lst`
13096         sig_num_init=`$awk  'BEGIN      { printf "0, " }
13097                              !/^NSIG/   { printf "%d, ", $2}
13098                              END        { printf "0\n"}' signal.lst`
13099         ;;
13100 esac
13101 echo "The following $sig_count signals are available:"
13102 echo " "
13103 echo $sig_name | $awk \
13104 'BEGIN { linelen = 0 }
13105 {
13106         for (i = 1; i <= NF; i++) {
13107                 name = "SIG" $i " "
13108                 linelen = linelen + length(name)
13109                 if (linelen > 70) {
13110                         printf "\n"
13111                         linelen = length(name)
13112                 }
13113                 printf "%s", name
13114         }
13115         printf "\n"
13116 }'
13117 $rm -f signal signal.c signal.awk signal.lst signal_cmd 
13118
13119 : see what type is used for signed size_t
13120 set ssize_t ssizetype int stdio.h sys/types.h
13121 eval $typedef
13122 dflt="$ssizetype"
13123 $cat > ssize.c <<EOM
13124 #include <stdio.h>
13125 #include <sys/types.h>
13126 #define Size_t $sizetype
13127 #define SSize_t $dflt
13128 int main()
13129 {
13130         if (sizeof(Size_t) == sizeof(SSize_t))
13131                 printf("$dflt\n");
13132         else if (sizeof(Size_t) == sizeof(int))
13133                 printf("int\n");
13134         else 
13135                 printf("long\n");
13136         exit(0);
13137 }
13138 EOM
13139 echo " "
13140 set ssize
13141 if eval $compile_ok && ./ssize > /dev/null; then
13142         ssizetype=`./ssize`
13143         echo "I'll be using $ssizetype for functions returning a byte count." >&4
13144 else
13145         $cat >&4 <<EOM
13146 Help! I can't compile and run the ssize_t test program: please enlighten me!
13147 (This is probably a misconfiguration in your system or libraries, and
13148 you really ought to fix it.  Still, I'll try anyway.)
13149
13150 I need a type that is the same size as $sizetype, but is guaranteed to
13151 be signed.  Common values are ssize_t, int and long.
13152
13153 EOM
13154         rp="What signed type is the same size as $sizetype?"
13155         . ./myread
13156         ssizetype="$ans"
13157 fi
13158 $rm -f ssize ssize.*
13159
13160 : see what type of char stdio uses.
13161 echo " "
13162 if $contains 'unsigned.*char.*_ptr;' `./findhdr stdio.h` >/dev/null 2>&1 ; then
13163         echo "Your stdio uses unsigned chars." >&4
13164         stdchar="unsigned char"
13165 else
13166         echo "Your stdio uses signed chars." >&4
13167         stdchar="char"
13168 fi
13169
13170 : see if time exists
13171 echo " "
13172 if test "X$d_time" = X -o X"$timetype" = X; then
13173     if set time val -f d_time; eval $csym; $val; then
13174                 echo 'time() found.' >&4
13175                 val="$define"
13176                 rp="What is the type returned by time() on this system?"
13177                 set time_t timetype long stdio.h sys/types.h
13178                 eval $typedef_ask
13179     else
13180                 echo 'time() not found, hope that will do.' >&4
13181                 val="$undef"
13182                 timetype='int';
13183     fi
13184     set d_time
13185     eval $setvar
13186 fi
13187
13188 : see what type uids are declared as in the kernel
13189 echo " "
13190 echo "Looking for the type for user ids returned by getuid()."
13191 set uid_t uidtype xxx stdio.h sys/types.h
13192 eval $typedef
13193 case "$uidtype" in
13194 xxx)
13195         xxx=`./findhdr sys/user.h`
13196         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
13197         case $1 in
13198         unsigned) dflt="$1 $2" ;;
13199         *) dflt="$1" ;;
13200         esac
13201         ;;
13202 *) dflt="$uidtype";;
13203 esac
13204 case "$uidtype" in
13205 uid_t)  echo "uid_t found." ;;
13206 *)      rp="What is the type for user ids returned by getuid()?"
13207         . ./myread
13208         uidtype="$ans"
13209         ;;
13210 esac
13211
13212 echo " "
13213 case "$uidtype" in
13214 *_t) zzz="$uidtype"     ;;
13215 *)   zzz="uid"          ;;
13216 esac
13217 echo "Checking the size of $zzz..." >&4 
13218 cat > try.c <<EOCP
13219 #include <sys/types.h>
13220 #include <stdio.h>
13221 int main() {
13222     printf("%d\n", (int)sizeof($uidtype));
13223     exit(0);
13224 }
13225 EOCP
13226 set try
13227 if eval $compile_ok; then
13228         yyy=`./try`
13229         case "$yyy" in
13230         '')     uidsize=4
13231                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
13232                 ;;
13233         *)      uidsize=$yyy
13234                 echo "Your $zzz size is $uidsize bytes."
13235                 ;;
13236         esac
13237 else
13238         uidsize=4
13239         echo "(I can't compile the test program--guessing $uidsize.)" >&4
13240 fi
13241
13242 echo " "
13243 case "$uidtype" in
13244 *_t) zzz="$uidtype"     ;;
13245 *)   zzz="uid"          ;;
13246 esac
13247 echo "Checking the sign of $zzz..." >&4
13248 cat > try.c <<EOCP
13249 #include <sys/types.h>
13250 #include <stdio.h>
13251 int main() {
13252         $uidtype foo = -1;
13253         if (foo < 0)
13254                 printf("-1\n");
13255         else
13256                 printf("1\n");
13257 }
13258 EOCP
13259 set try
13260 if eval $compile; then
13261         yyy=`./try`
13262         case "$yyy" in
13263         '')     uidsign=1
13264                 echo "(I can't execute the test program--guessing unsigned.)" >&4
13265                 ;;
13266         *)      uidsign=$yyy
13267                 case "$uidsign" in
13268                  1) echo "Your $zzz is unsigned." ;;
13269                 -1) echo "Your $zzz is signed."   ;;
13270                 esac
13271                 ;;
13272         esac
13273 else
13274         uidsign=1
13275         echo "(I can't compile the test program--guessing unsigned.)" >&4
13276 fi
13277
13278
13279
13280 echo " "
13281 $echo "Checking the format string to be used for uids..." >&4
13282
13283 case "$uidsign" in
13284 -1)     if $test X"$uidsize" = X"$ivsize"; then
13285                 uidformat="$ivdformat"
13286         else
13287                 if $test X"$uidsize" = X"$longsize"; then
13288                         uidformat='"ld"'
13289                 else
13290                         if $test X"$uidsize" = X"$intsize"; then
13291                                 uidformat='"d"'
13292                         else
13293                                 if $test X"$uidsize" = X"$shortsize"; then
13294                                         uidformat='"hd"'
13295                                 fi
13296                         fi
13297                 fi
13298         fi
13299         ;;
13300 *)      if $test X"$uidsize" = X"$uvsize"; then
13301                 uidformat="$uvuformat"
13302         else
13303                 if $test X"$uidsize" = X"$longsize"; then
13304                         uidformat='"lu"'
13305                 else
13306                         if $test X"$uidsize" = X"$intsize"; then
13307                                 uidformat='"u"'
13308                         else
13309                                 if $test X"$uidsize" = X"$shortsize"; then
13310                                         uidformat='"hu"'
13311                                 fi
13312                         fi
13313                 fi
13314         fi
13315         ;;
13316 esac
13317
13318 : see if dbm.h is available
13319 : see if dbmclose exists
13320 set dbmclose d_dbmclose
13321 eval $inlibc
13322
13323 case "$d_dbmclose" in
13324 $define)
13325         set dbm.h i_dbm
13326         eval $inhdr
13327         case "$i_dbm" in
13328         $define)
13329                 val="$undef"
13330                 set i_rpcsvcdbm
13331                 eval $setvar
13332                 ;;
13333         *)      set rpcsvc/dbm.h i_rpcsvcdbm
13334                 eval $inhdr
13335                 ;;
13336         esac
13337         ;;
13338 *)      echo "We won't be including <dbm.h>"
13339         val="$undef"
13340         set i_dbm
13341         eval $setvar
13342         val="$undef"
13343         set i_rpcsvcdbm
13344         eval $setvar
13345         ;;
13346 esac
13347
13348 : see if this is a sys/file.h system
13349 val=''
13350 set sys/file.h val
13351 eval $inhdr
13352
13353 : do we need to include sys/file.h ?
13354 case "$val" in
13355 "$define")
13356         echo " "
13357         if $h_sysfile; then
13358                 val="$define"
13359                 echo "We'll be including <sys/file.h>." >&4
13360         else
13361                 val="$undef"
13362                 echo "We won't be including <sys/file.h>." >&4
13363         fi
13364         ;;
13365 *)
13366         h_sysfile=false
13367         ;;
13368 esac
13369 set i_sysfile
13370 eval $setvar
13371
13372 : see if fcntl.h is there
13373 val=''
13374 set fcntl.h val
13375 eval $inhdr
13376
13377 : see if we can include fcntl.h
13378 case "$val" in
13379 "$define")
13380         echo " "
13381         if $h_fcntl; then
13382                 val="$define"
13383                 echo "We'll be including <fcntl.h>." >&4
13384         else
13385                 val="$undef"
13386                 if $h_sysfile; then
13387         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
13388                 else
13389                         echo "We won't be including <fcntl.h>." >&4
13390                 fi
13391         fi
13392         ;;
13393 *)
13394         h_fcntl=false
13395         val="$undef"
13396         ;;
13397 esac
13398 set i_fcntl
13399 eval $setvar
13400
13401 : see if locale.h is available
13402 set locale.h i_locale
13403 eval $inhdr
13404
13405 : see if mach cthreads are available
13406 if test "X$usethreads" = "X$define"; then
13407         set mach/cthreads.h i_machcthr
13408         eval $inhdr
13409 else
13410         i_machcthr="$undef"
13411 fi
13412
13413
13414
13415 : see if this is a math.h system
13416 set math.h i_math
13417 eval $inhdr
13418
13419 : see if this is a mntent.h system
13420 set mntent.h i_mntent
13421 eval $inhdr
13422
13423 : see if ndbm.h is available
13424 set ndbm.h t_ndbm
13425 eval $inhdr
13426 case "$t_ndbm" in
13427 $define)
13428         : see if dbm_open exists
13429         set dbm_open d_dbm_open
13430         eval $inlibc
13431         case "$d_dbm_open" in
13432         $undef)
13433                 t_ndbm="$undef"
13434                 echo "We won't be including <ndbm.h>"
13435                 ;;
13436         esac
13437         ;;
13438 esac
13439 val="$t_ndbm"
13440 set i_ndbm
13441 eval $setvar
13442
13443 : see if net/errno.h is available
13444 val=''
13445 set net/errno.h val
13446 eval $inhdr
13447
13448 : Unfortunately, it causes problems on some systems.  Arrgh.
13449 case "$val" in
13450 $define)
13451         cat > try.c <<'EOM'
13452 #include <stdio.h>
13453 #include <errno.h>
13454 #include <net/errno.h>
13455 int func()
13456 {
13457         return ENOTSOCK;
13458 }
13459 EOM
13460         if $cc $ccflags -c try.c >/dev/null 2>&1; then
13461                 echo "We'll be including <net/errno.h>." >&4
13462         else
13463                 echo "We won't be including <net/errno.h>." >&4
13464                 val="$undef"
13465         fi
13466         $rm -f try.* try
13467         ;;
13468 esac
13469 set i_neterrno
13470 eval $setvar
13471
13472 : see if netinet/tcp.h is available
13473 set netinet/tcp.h i_netinettcp
13474 eval $inhdr
13475
13476 : see if this is a poll.h system
13477 set poll.h i_poll
13478 eval $inhdr
13479
13480 : get C preprocessor symbols handy
13481 echo " "
13482 $echo $n "Hmm... $c"
13483 echo $al | $tr ' ' $trnl >Cppsym.know
13484 $cat <<EOSS >Cppsym
13485 $startsh
13486 case "\$1" in
13487 -l) list=true
13488         shift
13489         ;;
13490 esac
13491 unknown=''
13492 case "\$list\$#" in
13493 1|2)
13494         for sym do
13495                 if $contains "^\$1$" Cppsym.true >/dev/null 2>&1; then
13496                         exit 0
13497                 elif $contains "^\$1$" Cppsym.know >/dev/null 2>&1; then
13498                         :
13499                 else
13500                         unknown="\$unknown \$sym"
13501                 fi
13502         done
13503         set X \$unknown
13504         shift
13505         ;;
13506 esac
13507 case \$# in
13508 0) exit 1;;
13509 esac
13510 echo \$* | $tr ' ' '$trnl' | $sed -e 's/\(.*\)/\\
13511 #ifdef \1\\
13512 exit 0; _ _ _ _\1\\      \1\\
13513 #endif\\
13514 /' >Cppsym\$\$
13515 echo "exit 1; _ _ _" >>Cppsym\$\$
13516 $cppstdin $cppminus <Cppsym\$\$ | $grep '^exit [01]; _ _'  >Cppsym2\$\$
13517 case "\$list" in
13518 true) $awk 'NF > 5 {print substr(\$6,2,100)}' <Cppsym2\$\$ ;;
13519 *)
13520         sh Cppsym2\$\$
13521         status=\$?
13522         ;;
13523 esac
13524 $rm -f Cppsym\$\$ Cppsym2\$\$
13525 exit \$status
13526 EOSS
13527 chmod +x Cppsym
13528 $eunicefix Cppsym
13529 ./Cppsym -l $al | $sort | $grep -v '^$' >Cppsym.true
13530
13531 : now check the C compiler for additional symbols
13532 postprocess_cc_v=''
13533 case "$osname" in
13534 aix) postprocess_cc_v="|$tr , ' '" ;;
13535 esac
13536 $cat >ccsym <<EOS
13537 $startsh
13538 $cat >tmp.c <<EOF
13539 extern int foo;
13540 EOF
13541 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
13542 do
13543         case "\$i" in
13544         -D*) echo "\$i" | $sed 's/^-D//';;
13545         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A\(.*\)(\(.*\))/\1=\2/';;
13546         esac
13547 done
13548 $rm -f try.c
13549 EOS
13550 postprocess_cc_v=''
13551 chmod +x ccsym
13552 $eunicefix ccsym
13553 ./ccsym > ccsym1.raw
13554 if $test -s ccsym1.raw; then
13555        $sort ccsym1.raw | $uniq >ccsym.raw
13556 else
13557        mv ccsym1.raw ccsym.raw
13558 fi
13559
13560 $awk '/\=/ { print $0; next }
13561         { print $0"=1" }' ccsym.raw >ccsym.list
13562 $awk '{ print $0"=1" }' Cppsym.true >ccsym.true
13563 $comm -13 ccsym.true ccsym.list >ccsym.own
13564 $comm -12 ccsym.true ccsym.list >ccsym.com
13565 $comm -23 ccsym.true ccsym.list >ccsym.cpp
13566 also=''
13567 if $test -z ccsym.raw; then
13568         echo "Your C compiler doesn't seem to define any symbols!" >&4
13569         echo " "
13570         echo "However, your C preprocessor defines the following symbols:"
13571         $cat Cppsym.true
13572         ccsymbols=''
13573         cppsymbols=`$cat Cppsym.true`
13574         cppsymbols=`echo $cppsymbols`
13575         cppccsymbols="$cppsymbols"
13576 else
13577         if $test -s ccsym.com; then
13578                 echo "Your C compiler and pre-processor define these symbols:"
13579                 $sed -e 's/\(.*\)=.*/\1/' ccsym.com
13580                 also='also '
13581                 symbols='ones'
13582                 cppccsymbols=`$cat ccsym.com`
13583                 cppccsymbols=`echo $cppccsymbols`
13584                 $test "$silent" || sleep 1
13585         fi
13586         if $test -s ccsym.cpp; then
13587                 $test "$also" && echo " "
13588                 echo "Your C pre-processor ${also}defines the following symbols:"
13589                 $sed -e 's/\(.*\)=.*/\1/' ccsym.cpp
13590                 also='further '
13591                 cppsymbols=`$cat ccsym.cpp`
13592                 cppsymbols=`echo $cppsymbols`
13593                 $test "$silent" || sleep 1
13594         fi
13595         if $test -s ccsym.own; then
13596                 $test "$also" && echo " "
13597                 echo "Your C compiler ${also}defines the following cpp symbols:"
13598                 $sed -e 's/\(.*\)=1/\1/' ccsym.own
13599                 $sed -e 's/\(.*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
13600                 ccsymbols=`$cat ccsym.own`
13601                 ccsymbols=`echo $ccsymbols`
13602                 $test "$silent" || sleep 1
13603         fi
13604 fi
13605 $rm -f ccsym*
13606
13607 : see if this is a termio system
13608 val="$undef"
13609 val2="$undef"
13610 val3="$undef"
13611 if $test `./findhdr termios.h`; then
13612         set tcsetattr i_termios
13613         eval $inlibc
13614         val3="$i_termios"
13615 fi
13616 echo " "
13617 case "$val3" in
13618 "$define") echo "You have POSIX termios.h... good!" >&4;;
13619 *) if ./Cppsym pyr; then
13620                 case "`/bin/universe`" in
13621                 ucb) if $test `./findhdr sgtty.h`; then
13622                                 val2="$define"
13623                                 echo "<sgtty.h> found." >&4
13624                         else
13625                                 echo "System is pyramid with BSD universe."
13626                                 echo "<sgtty.h> not found--you could have problems." >&4
13627                         fi;;
13628                 *) if $test `./findhdr termio.h`; then
13629                                 val="$define"
13630                                 echo "<termio.h> found." >&4
13631                         else
13632                                 echo "System is pyramid with USG universe."
13633                                 echo "<termio.h> not found--you could have problems." >&4
13634                         fi;;
13635                 esac
13636         elif ./usg; then
13637                 if $test `./findhdr termio.h`; then
13638                         echo "<termio.h> found." >&4
13639                         val="$define"
13640                 elif $test `./findhdr sgtty.h`; then
13641                         echo "<sgtty.h> found." >&4
13642                         val2="$define"
13643                 else
13644 echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
13645                 fi
13646         else
13647                 if $test `./findhdr sgtty.h`; then
13648                         echo "<sgtty.h> found." >&4
13649                         val2="$define"
13650                 elif $test `./findhdr termio.h`; then
13651                         echo "<termio.h> found." >&4
13652                         val="$define"
13653                 else
13654 echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
13655                 fi
13656         fi;;
13657 esac
13658 set i_termio; eval $setvar
13659 val=$val2; set i_sgtty; eval $setvar
13660 val=$val3; set i_termios; eval $setvar
13661
13662 : see if this is a shadow.h system
13663 set shadow.h i_shadow
13664 eval $inhdr
13665
13666 : see if this is a socks.h system
13667 set socks.h i_socks
13668 eval $inhdr
13669
13670 : see if stdarg is available
13671 echo " "
13672 if $test `./findhdr stdarg.h`; then
13673         echo "<stdarg.h> found." >&4
13674         valstd="$define"
13675 else
13676         echo "<stdarg.h> NOT found." >&4
13677         valstd="$undef"
13678 fi
13679
13680 : see if varags is available
13681 echo " "
13682 if $test `./findhdr varargs.h`; then
13683         echo "<varargs.h> found." >&4
13684 else
13685         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
13686 fi
13687
13688 : set up the varargs testing programs
13689 $cat > varargs.c <<EOP
13690 #ifdef I_STDARG
13691 #include <stdarg.h>
13692 #endif
13693 #ifdef I_VARARGS
13694 #include <varargs.h>
13695 #endif
13696
13697 #ifdef I_STDARG
13698 int f(char *p, ...)
13699 #else
13700 int f(va_alist)
13701 va_dcl
13702 #endif
13703 {
13704         va_list ap;
13705 #ifndef I_STDARG
13706         char *p;
13707 #endif
13708 #ifdef I_STDARG
13709         va_start(ap,p);
13710 #else
13711         va_start(ap);
13712         p = va_arg(ap, char *);
13713 #endif
13714         va_end(ap);
13715 }
13716 EOP
13717 $cat > varargs <<EOP
13718 $startsh
13719 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
13720         echo "true"
13721 else
13722         echo "false"
13723 fi
13724 $rm -f varargs$_o
13725 EOP
13726 chmod +x varargs
13727
13728 : now check which varargs header should be included
13729 echo " "
13730 i_varhdr=''
13731 case "$valstd" in
13732 "$define")
13733         if `./varargs I_STDARG`; then
13734                 val='stdarg.h'
13735         elif `./varargs I_VARARGS`; then
13736                 val='varargs.h'
13737         fi
13738         ;;
13739 *)
13740         if `./varargs I_VARARGS`; then
13741                 val='varargs.h'
13742         fi
13743         ;;
13744 esac
13745 case "$val" in
13746 '')
13747 echo "I could not find the definition for va_dcl... You have problems..." >&4
13748         val="$undef"; set i_stdarg; eval $setvar
13749         val="$undef"; set i_varargs; eval $setvar
13750         ;;
13751 *) 
13752         set i_varhdr
13753         eval $setvar
13754         case "$i_varhdr" in
13755         stdarg.h)
13756                 val="$define"; set i_stdarg; eval $setvar
13757                 val="$undef"; set i_varargs; eval $setvar
13758                 ;;
13759         varargs.h)
13760                 val="$undef"; set i_stdarg; eval $setvar
13761                 val="$define"; set i_varargs; eval $setvar
13762                 ;;
13763         esac
13764         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
13765 esac
13766 $rm -f varargs*
13767
13768 : see if stddef is available
13769 set stddef.h i_stddef
13770 eval $inhdr
13771
13772 : see if sys/access.h is available
13773 set sys/access.h i_sysaccess
13774 eval $inhdr
13775
13776 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
13777 set sys/filio.h i_sysfilio
13778 eval $inhdr
13779 echo " "
13780 if $test `./findhdr sys/ioctl.h`; then
13781         val="$define"
13782         echo '<sys/ioctl.h> found.' >&4
13783 else
13784         val="$undef"
13785         if $test $i_sysfilio = "$define"; then
13786             echo '<sys/ioctl.h> NOT found.' >&4
13787         else
13788                 $test $i_sgtty = "$define" && xxx="sgtty.h"
13789                 $test $i_termio = "$define" && xxx="termio.h"
13790                 $test $i_termios = "$define" && xxx="termios.h"
13791 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
13792         fi
13793 fi
13794 set i_sysioctl
13795 eval $setvar
13796
13797 : see if sys/resource.h has to be included
13798 set sys/resource.h i_sysresrc
13799 eval $inhdr
13800
13801 : see if sys/security.h is available
13802 set sys/security.h i_syssecrt
13803 eval $inhdr
13804
13805 : see if this is a sys/statvfs.h system
13806 set sys/statvfs.h i_sysstatvfs
13807 eval $inhdr
13808
13809 : see if this is a sys/uio.h system
13810 set sys/uio.h i_sysuio
13811 eval $inhdr
13812
13813 : see if this is a sys/un.h system
13814 set sys/un.h i_sysun
13815 eval $inhdr
13816
13817 : see if this is a syswait system
13818 set sys/wait.h i_syswait
13819 eval $inhdr
13820
13821 : see if this is a ustat.h system
13822 set ustat.h i_ustat
13823 eval $inhdr
13824
13825 : see if this is an utime system
13826 set utime.h i_utime
13827 eval $inhdr
13828
13829 : see if this is a values.h system
13830 set values.h i_values
13831 eval $inhdr
13832
13833 : see if this is a vfork system
13834 case "$d_vfork" in
13835 "$define")
13836         set vfork.h i_vfork
13837         eval $inhdr
13838         ;;
13839 *)
13840         i_vfork="$undef"
13841         ;;
13842 esac
13843
13844 : see if gdbm.h is available
13845 set gdbm.h t_gdbm
13846 eval $inhdr
13847 case "$t_gdbm" in
13848 $define)
13849         : see if gdbm_open exists
13850         set gdbm_open d_gdbm_open
13851         eval $inlibc
13852         case "$d_gdbm_open" in
13853         $undef)
13854                 t_gdbm="$undef"
13855                 echo "We won't be including <gdbm.h>"
13856                 ;;
13857         esac
13858         ;;
13859 esac
13860 val="$t_gdbm"
13861 set i_gdbm
13862 eval $setvar
13863
13864 echo " "
13865 echo "Looking for extensions..." >&4
13866 : If we are using the old config.sh, known_extensions may contain
13867 : old or inaccurate or duplicate values.
13868 known_extensions=''
13869 nonxs_extensions=''
13870 : We do not use find because it might not be available.
13871 : We do not just use MANIFEST because the user may have dropped
13872 : some additional extensions into the source tree and expect them
13873 : to be built.
13874
13875 : Function to recursively find available extensions, ignoring DynaLoader
13876 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
13877 find_extensions='
13878     for xxx in *; do
13879        case "$xxx" in
13880            DynaLoader|dynaload) ;;
13881            *)
13882            if $test -f $xxx/$xxx.xs; then
13883                known_extensions="$known_extensions $1$xxx";
13884            elif $test -f $xxx/Makefile.PL; then
13885                nonxs_extensions="$nonxs_extensions $1$xxx";
13886            else
13887                if $test -d $xxx -a $# -lt 10; then
13888                    set $1$xxx/ $*;
13889                    cd $xxx;
13890                    eval $find_extensions;
13891                    cd ..;
13892                    shift;
13893                fi;
13894            fi
13895            ;;
13896        esac;
13897     done'
13898 tdir=`pwd`
13899 cd $rsrc/ext
13900 set X
13901 shift
13902 eval $find_extensions
13903 set X $nonxs_extensions
13904 shift
13905 nonxs_extensions="$*"
13906 set X $known_extensions
13907 shift
13908 known_extensions="$*"
13909 cd $tdir
13910
13911 : Now see which are supported on this system.
13912 avail_ext=''
13913 for xxx in $known_extensions ; do
13914         case "$xxx" in
13915         DB_File|db_file)
13916                 case "$i_db" in
13917                 $define) avail_ext="$avail_ext $xxx" ;;
13918                 esac
13919                 ;;
13920         GDBM_File|gdbm_fil)
13921                 case "$i_gdbm" in 
13922                 $define) avail_ext="$avail_ext $xxx" ;;
13923                 esac
13924                 ;;
13925         NDBM_File|ndbm_fil)
13926                 case "$i_ndbm" in
13927                 $define) avail_ext="$avail_ext $xxx" ;;
13928                 esac
13929                 ;;
13930         ODBM_File|odbm_fil) 
13931                 case "${i_dbm}${i_rpcsvcdbm}" in
13932                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
13933                 esac
13934                 ;;
13935         POSIX|posix)
13936                 case "$useposix" in
13937                 true|define|y) avail_ext="$avail_ext $xxx" ;;
13938                 esac
13939                 ;;
13940         Opcode|opcode)
13941                 case "$useopcode" in
13942                 true|define|y) avail_ext="$avail_ext $xxx" ;;
13943                 esac
13944                 ;;
13945         Socket|socket)
13946                 case "$d_socket" in 
13947                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
13948                 esac
13949                 ;;
13950         Thread|thread)
13951                 case "$usethreads" in 
13952                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
13953                 esac
13954                 ;;
13955         IPC/SysV|ipc/sysv)
13956                 : XXX Do we need a useipcsysv variable here
13957                 case "${d_msg}${d_sem}${d_shm}" in 
13958                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
13959                 esac
13960                 ;;
13961         *)      avail_ext="$avail_ext $xxx"
13962                 ;;
13963         esac
13964 done
13965
13966 set X $avail_ext
13967 shift
13968 avail_ext="$*"
13969
13970 : Now see which nonxs extensions are supported on this system.
13971 : For now assume all are.
13972 nonxs_ext=''
13973 for xxx in $nonxs_extensions ; do
13974         case "$xxx" in
13975         *)      nonxs_ext="$nonxs_ext $xxx"
13976                 ;;
13977         esac
13978 done
13979
13980 set X $nonxs_ext
13981 shift
13982 nonxs_ext="$*"
13983
13984 case $usedl in
13985 $define)
13986         $cat <<EOM
13987 A number of extensions are supplied with $package.  You may choose to
13988 compile these extensions for dynamic loading (the default), compile
13989 them into the $package executable (static loading), or not include
13990 them at all.  Answer "none" to include no extensions.
13991 Note that DynaLoader is always built and need not be mentioned here.
13992
13993 EOM
13994         case "$dynamic_ext" in
13995         '') dflt="$avail_ext" ;;
13996         *)      dflt="$dynamic_ext"
13997                 # Perhaps we are reusing an old out-of-date config.sh.
13998                 case "$hint" in
13999                 previous)
14000                         if test X"$dynamic_ext" != X"$avail_ext"; then
14001                                 $cat <<EOM
14002 NOTICE:  Your previous config.sh list may be incorrect. 
14003 The extensions now available to you are 
14004         ${avail_ext}
14005 but the default list from your previous config.sh is
14006         ${dynamic_ext} 
14007
14008 EOM
14009                         fi
14010                         ;;
14011                 esac
14012                 ;;
14013         esac
14014         case "$dflt" in
14015         '')     dflt=none;;
14016         esac
14017         rp="What extensions do you wish to load dynamically?"
14018         . ./myread
14019         case "$ans" in
14020         none) dynamic_ext=' ' ;;
14021         *) dynamic_ext="$ans" ;;
14022         esac
14023
14024         case "$static_ext" in
14025         '')
14026                 : Exclude those already listed in dynamic linking
14027                 dflt=''
14028                 for xxx in $avail_ext; do
14029                         case " $dynamic_ext " in
14030                         *" $xxx "*) ;;
14031                         *) dflt="$dflt $xxx" ;;
14032                         esac
14033                 done
14034                 set X $dflt
14035                 shift
14036                 dflt="$*"
14037                 ;;
14038         *)  dflt="$static_ext" 
14039                 ;;
14040         esac
14041
14042         case "$dflt" in
14043         '')     dflt=none;;
14044         esac
14045         rp="What extensions do you wish to load statically?"
14046         . ./myread
14047         case "$ans" in
14048         none) static_ext=' ' ;;
14049         *) static_ext="$ans" ;;
14050         esac
14051         ;;
14052 *)
14053         $cat <<EOM
14054 A number of extensions are supplied with $package.  Answer "none" 
14055 to include no extensions. 
14056 Note that DynaLoader is always built and need not be mentioned here.
14057
14058 EOM
14059         case "$static_ext" in
14060         '') dflt="$avail_ext" ;;
14061         *)      dflt="$static_ext"
14062                 # Perhaps we are reusing an old out-of-date config.sh.
14063                 case "$hint" in
14064                 previous)
14065                         if test X"$static_ext" != X"$avail_ext"; then
14066                                 $cat <<EOM
14067 NOTICE:  Your previous config.sh list may be incorrect. 
14068 The extensions now available to you are 
14069         ${avail_ext}
14070 but the default list from your previous config.sh is
14071         ${static_ext} 
14072
14073 EOM
14074                         fi
14075                         ;;
14076                 esac
14077                 ;;
14078         esac
14079         : Exclude those that are not xs extensions
14080         case "$dflt" in
14081         '')     dflt=none;;
14082         esac
14083         rp="What extensions do you wish to include?"
14084         . ./myread
14085         case "$ans" in
14086         none) static_ext=' ' ;;
14087         *) static_ext="$ans" ;;
14088         esac
14089         ;;
14090 esac
14091
14092 set X $dynamic_ext $static_ext $nonxs_ext
14093 shift
14094 extensions="$*"
14095
14096 : Remove build directory name from cppstdin so it can be used from
14097 : either the present location or the final installed location.
14098 echo " "
14099 : Get out of the UU directory to get correct path name.
14100 cd ..
14101 case "$cppstdin" in
14102 `pwd`/cppstdin)
14103         echo "Stripping down cppstdin path name"
14104         cppstdin=cppstdin
14105         ;;
14106 esac
14107 cd UU
14108
14109 : end of configuration questions
14110 echo " "
14111 echo "End of configuration questions."
14112 echo " "
14113
14114 : back to where it started
14115 if test -d ../UU; then
14116         cd ..
14117 fi
14118
14119 : configuration may be patched via a 'config.over' file
14120 if $test -f config.over; then
14121         echo " "
14122         dflt=y
14123         rp='I see a config.over file.  Do you wish to load it?'
14124         . UU/myread
14125         case "$ans" in
14126         n*) echo "OK, I'll ignore it.";;
14127         *)      . ./config.over
14128                 echo "Configuration override changes have been loaded."
14129                 ;;
14130         esac
14131 fi
14132
14133 : in case they want portability, strip down executable paths
14134 case "$d_portable" in
14135 "$define")
14136         echo " "
14137         echo "Stripping down executable paths..." >&4
14138         for file in $loclist $trylist; do
14139                 eval temp=\$$file
14140                 eval $file=`basename $temp`
14141         done
14142         ;;
14143 esac
14144
14145 : create config.sh file
14146 echo " "
14147 echo "Creating config.sh..." >&4
14148 $spitshell <<EOT >config.sh
14149 $startsh
14150 #
14151 # This file was produced by running the Configure script. It holds all the
14152 # definitions figured out by Configure. Should you modify one of these values,
14153 # do not forget to propagate your changes by running "Configure -der". You may
14154 # instead choose to run each of the .SH files by yourself, or "Configure -S".
14155 #
14156
14157 # Package name      : $package
14158 # Source directory  : $src
14159 # Configuration time: $cf_time
14160 # Configured by     : $cf_by
14161 # Target system     : $myuname
14162
14163 Author='$Author'
14164 Date='$Date'
14165 Header='$Header'
14166 Id='$Id'
14167 Locker='$Locker'
14168 Log='$Log'
14169 Mcc='$Mcc'
14170 RCSfile='$RCSfile'
14171 Revision='$Revision'
14172 Source='$Source'
14173 State='$State'
14174 _a='$_a'
14175 _exe='$_exe'
14176 _o='$_o'
14177 afs='$afs'
14178 alignbytes='$alignbytes'
14179 ansi2knr='$ansi2knr'
14180 aphostname='$aphostname'
14181 apiversion='$apiversion'
14182 ar='$ar'
14183 archlib='$archlib'
14184 archlibexp='$archlibexp'
14185 archname64='$archname64'
14186 archname='$archname'
14187 archobjs='$archobjs'
14188 awk='$awk'
14189 baserev='$baserev'
14190 bash='$bash'
14191 bin='$bin'
14192 bincompat5005='$bincompat5005'
14193 binexp='$binexp'
14194 bison='$bison'
14195 byacc='$byacc'
14196 byteorder='$byteorder'
14197 c='$c'
14198 castflags='$castflags'
14199 cat='$cat'
14200 cc='$cc'
14201 cccdlflags='$cccdlflags'
14202 ccdlflags='$ccdlflags'
14203 ccflags='$ccflags'
14204 ccsymbols='$ccsymbols'
14205 cf_by='$cf_by'
14206 cf_email='$cf_email'
14207 cf_time='$cf_time'
14208 charsize='$charsize'
14209 chgrp='$chgrp'
14210 chmod='$chmod'
14211 chown='$chown'
14212 clocktype='$clocktype'
14213 comm='$comm'
14214 compress='$compress'
14215 contains='$contains'
14216 cp='$cp'
14217 cpio='$cpio'
14218 cpp='$cpp'
14219 cpp_stuff='$cpp_stuff'
14220 cppccsymbols='$cppccsymbols'
14221 cppflags='$cppflags'
14222 cpplast='$cpplast'
14223 cppminus='$cppminus'
14224 cpprun='$cpprun'
14225 cppstdin='$cppstdin'
14226 cppsymbols='$cppsymbols'
14227 crosscompile='$crosscompile'
14228 cryptlib='$cryptlib'
14229 csh='$csh'
14230 d_Gconvert='$d_Gconvert'
14231 d_PRIEldbl='$d_PRIEldbl'
14232 d_PRIFldbl='$d_PRIFldbl'
14233 d_PRIGldbl='$d_PRIGldbl'
14234 d_PRIX64='$d_PRIX64'
14235 d_PRId64='$d_PRId64'
14236 d_PRIeldbl='$d_PRIeldbl'
14237 d_PRIfldbl='$d_PRIfldbl'
14238 d_PRIgldbl='$d_PRIgldbl'
14239 d_PRIi64='$d_PRIi64'
14240 d_PRIo64='$d_PRIo64'
14241 d_PRIu64='$d_PRIu64'
14242 d_PRIx64='$d_PRIx64'
14243 d_access='$d_access'
14244 d_accessx='$d_accessx'
14245 d_alarm='$d_alarm'
14246 d_archlib='$d_archlib'
14247 d_atolf='$d_atolf'
14248 d_atoll='$d_atoll'
14249 d_attribut='$d_attribut'
14250 d_bcmp='$d_bcmp'
14251 d_bcopy='$d_bcopy'
14252 d_bincompat5005='$d_bincompat5005'
14253 d_bsd='$d_bsd'
14254 d_bsdgetpgrp='$d_bsdgetpgrp'
14255 d_bsdsetpgrp='$d_bsdsetpgrp'
14256 d_bzero='$d_bzero'
14257 d_casti32='$d_casti32'
14258 d_castneg='$d_castneg'
14259 d_charvspr='$d_charvspr'
14260 d_chown='$d_chown'
14261 d_chroot='$d_chroot'
14262 d_chsize='$d_chsize'
14263 d_closedir='$d_closedir'
14264 d_const='$d_const'
14265 d_crypt='$d_crypt'
14266 d_csh='$d_csh'
14267 d_cuserid='$d_cuserid'
14268 d_dbl_dig='$d_dbl_dig'
14269 d_difftime='$d_difftime'
14270 d_dirnamlen='$d_dirnamlen'
14271 d_dlerror='$d_dlerror'
14272 d_dlopen='$d_dlopen'
14273 d_dlsymun='$d_dlsymun'
14274 d_dosuid='$d_dosuid'
14275 d_drand48proto='$d_drand48proto'
14276 d_dup2='$d_dup2'
14277 d_eaccess='$d_eaccess'
14278 d_endgrent='$d_endgrent'
14279 d_endhent='$d_endhent'
14280 d_endnent='$d_endnent'
14281 d_endpent='$d_endpent'
14282 d_endpwent='$d_endpwent'
14283 d_endsent='$d_endsent'
14284 d_endspent='$d_endspent'
14285 d_eofnblk='$d_eofnblk'
14286 d_eunice='$d_eunice'
14287 d_fchmod='$d_fchmod'
14288 d_fchown='$d_fchown'
14289 d_fcntl='$d_fcntl'
14290 d_fd_macros='$d_fd_macros'
14291 d_fd_set='$d_fd_set'
14292 d_fds_bits='$d_fds_bits'
14293 d_fgetpos='$d_fgetpos'
14294 d_flexfnam='$d_flexfnam'
14295 d_flock='$d_flock'
14296 d_fork='$d_fork'
14297 d_fpathconf='$d_fpathconf'
14298 d_fpos64_t='$d_fpos64_t'
14299 d_fs_data_s='$d_fs_data_s'
14300 d_fseeko='$d_fseeko'
14301 d_fsetpos='$d_fsetpos'
14302 d_fstatfs='$d_fstatfs'
14303 d_fstatvfs='$d_fstatvfs'
14304 d_ftello='$d_ftello'
14305 d_ftime='$d_ftime'
14306 d_getgrent='$d_getgrent'
14307 d_getgrps='$d_getgrps'
14308 d_gethbyaddr='$d_gethbyaddr'
14309 d_gethbyname='$d_gethbyname'
14310 d_gethent='$d_gethent'
14311 d_gethname='$d_gethname'
14312 d_gethostprotos='$d_gethostprotos'
14313 d_getlogin='$d_getlogin'
14314 d_getmnt='$d_getmnt'
14315 d_getmntent='$d_getmntent'
14316 d_getnbyaddr='$d_getnbyaddr'
14317 d_getnbyname='$d_getnbyname'
14318 d_getnent='$d_getnent'
14319 d_getnetprotos='$d_getnetprotos'
14320 d_getpbyname='$d_getpbyname'
14321 d_getpbynumber='$d_getpbynumber'
14322 d_getpent='$d_getpent'
14323 d_getpgid='$d_getpgid'
14324 d_getpgrp2='$d_getpgrp2'
14325 d_getpgrp='$d_getpgrp'
14326 d_getppid='$d_getppid'
14327 d_getprior='$d_getprior'
14328 d_getprotoprotos='$d_getprotoprotos'
14329 d_getpwent='$d_getpwent'
14330 d_getsbyname='$d_getsbyname'
14331 d_getsbyport='$d_getsbyport'
14332 d_getsent='$d_getsent'
14333 d_getservprotos='$d_getservprotos'
14334 d_getspent='$d_getspent'
14335 d_getspnam='$d_getspnam'
14336 d_gettimeod='$d_gettimeod'
14337 d_gnulibc='$d_gnulibc'
14338 d_grpasswd='$d_grpasswd'
14339 d_hasmntopt='$d_hasmntopt'
14340 d_htonl='$d_htonl'
14341 d_index='$d_index'
14342 d_inetaton='$d_inetaton'
14343 d_int64t='$d_int64t'
14344 d_isascii='$d_isascii'
14345 d_killpg='$d_killpg'
14346 d_lchown='$d_lchown'
14347 d_ldbl_dig='$d_ldbl_dig'
14348 d_link='$d_link'
14349 d_locconv='$d_locconv'
14350 d_lockf='$d_lockf'
14351 d_longdbl='$d_longdbl'
14352 d_longlong='$d_longlong'
14353 d_lstat='$d_lstat'
14354 d_mblen='$d_mblen'
14355 d_mbstowcs='$d_mbstowcs'
14356 d_mbtowc='$d_mbtowc'
14357 d_memchr='$d_memchr'
14358 d_memcmp='$d_memcmp'
14359 d_memcpy='$d_memcpy'
14360 d_memmove='$d_memmove'
14361 d_memset='$d_memset'
14362 d_mkdir='$d_mkdir'
14363 d_mkfifo='$d_mkfifo'
14364 d_mktime='$d_mktime'
14365 d_msg='$d_msg'
14366 d_msg_ctrunc='$d_msg_ctrunc'
14367 d_msg_dontroute='$d_msg_dontroute'
14368 d_msg_oob='$d_msg_oob'
14369 d_msg_peek='$d_msg_peek'
14370 d_msg_proxy='$d_msg_proxy'
14371 d_msgctl='$d_msgctl'
14372 d_msgget='$d_msgget'
14373 d_msgrcv='$d_msgrcv'
14374 d_msgsnd='$d_msgsnd'
14375 d_mymalloc='$d_mymalloc'
14376 d_nice='$d_nice'
14377 d_off64_t='$d_off64_t'
14378 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
14379 d_oldpthreads='$d_oldpthreads'
14380 d_oldsock='$d_oldsock'
14381 d_open3='$d_open3'
14382 d_pathconf='$d_pathconf'
14383 d_pause='$d_pause'
14384 d_phostname='$d_phostname'
14385 d_pipe='$d_pipe'
14386 d_poll='$d_poll'
14387 d_portable='$d_portable'
14388 d_pthread_yield='$d_pthread_yield'
14389 d_pwage='$d_pwage'
14390 d_pwchange='$d_pwchange'
14391 d_pwclass='$d_pwclass'
14392 d_pwcomment='$d_pwcomment'
14393 d_pwexpire='$d_pwexpire'
14394 d_pwgecos='$d_pwgecos'
14395 d_pwpasswd='$d_pwpasswd'
14396 d_pwquota='$d_pwquota'
14397 d_quad='$d_quad'
14398 d_readdir='$d_readdir'
14399 d_readlink='$d_readlink'
14400 d_rename='$d_rename'
14401 d_rewinddir='$d_rewinddir'
14402 d_rmdir='$d_rmdir'
14403 d_safebcpy='$d_safebcpy'
14404 d_safemcpy='$d_safemcpy'
14405 d_sanemcmp='$d_sanemcmp'
14406 d_sched_yield='$d_sched_yield'
14407 d_scm_rights='$d_scm_rights'
14408 d_seekdir='$d_seekdir'
14409 d_select='$d_select'
14410 d_sem='$d_sem'
14411 d_semctl='$d_semctl'
14412 d_semctl_semid_ds='$d_semctl_semid_ds'
14413 d_semctl_semun='$d_semctl_semun'
14414 d_semget='$d_semget'
14415 d_semop='$d_semop'
14416 d_setegid='$d_setegid'
14417 d_seteuid='$d_seteuid'
14418 d_setgrent='$d_setgrent'
14419 d_setgrps='$d_setgrps'
14420 d_sethent='$d_sethent'
14421 d_setlinebuf='$d_setlinebuf'
14422 d_setlocale='$d_setlocale'
14423 d_setnent='$d_setnent'
14424 d_setpent='$d_setpent'
14425 d_setpgid='$d_setpgid'
14426 d_setpgrp2='$d_setpgrp2'
14427 d_setpgrp='$d_setpgrp'
14428 d_setprior='$d_setprior'
14429 d_setpwent='$d_setpwent'
14430 d_setregid='$d_setregid'
14431 d_setresgid='$d_setresgid'
14432 d_setresuid='$d_setresuid'
14433 d_setreuid='$d_setreuid'
14434 d_setrgid='$d_setrgid'
14435 d_setruid='$d_setruid'
14436 d_setsent='$d_setsent'
14437 d_setsid='$d_setsid'
14438 d_setspent='$d_setspent'
14439 d_setvbuf='$d_setvbuf'
14440 d_sfio='$d_sfio'
14441 d_shm='$d_shm'
14442 d_shmat='$d_shmat'
14443 d_shmatprototype='$d_shmatprototype'
14444 d_shmctl='$d_shmctl'
14445 d_shmdt='$d_shmdt'
14446 d_shmget='$d_shmget'
14447 d_sigaction='$d_sigaction'
14448 d_sigsetjmp='$d_sigsetjmp'
14449 d_socket='$d_socket'
14450 d_sockpair='$d_sockpair'
14451 d_sqrtl='$d_sqrtl'
14452 d_statblks='$d_statblks'
14453 d_statfs_f_flags='$d_statfs_f_flags'
14454 d_statfs_s='$d_statfs_s'
14455 d_statvfs='$d_statvfs'
14456 d_stdio_cnt_lval='$d_stdio_cnt_lval'
14457 d_stdio_ptr_lval='$d_stdio_ptr_lval'
14458 d_stdio_stream_array='$d_stdio_stream_array'
14459 d_stdiobase='$d_stdiobase'
14460 d_stdstdio='$d_stdstdio'
14461 d_strchr='$d_strchr'
14462 d_strcoll='$d_strcoll'
14463 d_strctcpy='$d_strctcpy'
14464 d_strerrm='$d_strerrm'
14465 d_strerror='$d_strerror'
14466 d_strtod='$d_strtod'
14467 d_strtol='$d_strtol'
14468 d_strtoul='$d_strtoul'
14469 d_strtoull='$d_strtoull'
14470 d_strxfrm='$d_strxfrm'
14471 d_suidsafe='$d_suidsafe'
14472 d_symlink='$d_symlink'
14473 d_syscall='$d_syscall'
14474 d_sysconf='$d_sysconf'
14475 d_sysernlst='$d_sysernlst'
14476 d_syserrlst='$d_syserrlst'
14477 d_system='$d_system'
14478 d_tcgetpgrp='$d_tcgetpgrp'
14479 d_tcsetpgrp='$d_tcsetpgrp'
14480 d_telldir='$d_telldir'
14481 d_telldirproto='$d_telldirproto'
14482 d_time='$d_time'
14483 d_times='$d_times'
14484 d_truncate='$d_truncate'
14485 d_tzname='$d_tzname'
14486 d_umask='$d_umask'
14487 d_uname='$d_uname'
14488 d_union_semun='$d_union_semun'
14489 d_ustat='$d_ustat'
14490 d_vendorbin='$d_vendorbin'
14491 d_vendorlib='$d_vendorlib'
14492 d_vfork='$d_vfork'
14493 d_void_closedir='$d_void_closedir'
14494 d_voidsig='$d_voidsig'
14495 d_voidtty='$d_voidtty'
14496 d_volatile='$d_volatile'
14497 d_vprintf='$d_vprintf'
14498 d_wait4='$d_wait4'
14499 d_waitpid='$d_waitpid'
14500 d_wcstombs='$d_wcstombs'
14501 d_wctomb='$d_wctomb'
14502 d_xenix='$d_xenix'
14503 date='$date'
14504 db_hashtype='$db_hashtype'
14505 db_prefixtype='$db_prefixtype'
14506 defvoidused='$defvoidused'
14507 direntrytype='$direntrytype'
14508 dlext='$dlext'
14509 dlsrc='$dlsrc'
14510 doublesize='$doublesize'
14511 drand01='$drand01'
14512 dynamic_ext='$dynamic_ext'
14513 eagain='$eagain'
14514 ebcdic='$ebcdic'
14515 echo='$echo'
14516 egrep='$egrep'
14517 emacs='$emacs'
14518 eunicefix='$eunicefix'
14519 exe_ext='$exe_ext'
14520 expr='$expr'
14521 extensions='$extensions'
14522 fflushNULL='$fflushNULL'
14523 fflushall='$fflushall'
14524 find='$find'
14525 firstmakefile='$firstmakefile'
14526 flex='$flex'
14527 fpossize='$fpossize'
14528 fpostype='$fpostype'
14529 freetype='$freetype'
14530 full_ar='$full_ar'
14531 full_csh='$full_csh'
14532 full_sed='$full_sed'
14533 gccversion='$gccversion'
14534 gidformat='$gidformat'
14535 gidsign='$gidsign'
14536 gidsize='$gidsize'
14537 gidtype='$gidtype'
14538 glibpth='$glibpth'
14539 grep='$grep'
14540 groupcat='$groupcat'
14541 groupstype='$groupstype'
14542 gzip='$gzip'
14543 h_fcntl='$h_fcntl'
14544 h_sysfile='$h_sysfile'
14545 hint='$hint'
14546 hostcat='$hostcat'
14547 huge='$huge'
14548 i16size='$i16size'
14549 i16type='$i16type'
14550 i32size='$i32size'
14551 i32type='$i32type'
14552 i64size='$i64size'
14553 i64type='$i64type'
14554 i8size='$i8size'
14555 i8type='$i8type'
14556 i_arpainet='$i_arpainet'
14557 i_bsdioctl='$i_bsdioctl'
14558 i_db='$i_db'
14559 i_dbm='$i_dbm'
14560 i_dirent='$i_dirent'
14561 i_dld='$i_dld'
14562 i_dlfcn='$i_dlfcn'
14563 i_fcntl='$i_fcntl'
14564 i_float='$i_float'
14565 i_gdbm='$i_gdbm'
14566 i_grp='$i_grp'
14567 i_inttypes='$i_inttypes'
14568 i_limits='$i_limits'
14569 i_locale='$i_locale'
14570 i_machcthr='$i_machcthr'
14571 i_malloc='$i_malloc'
14572 i_math='$i_math'
14573 i_memory='$i_memory'
14574 i_mntent='$i_mntent'
14575 i_ndbm='$i_ndbm'
14576 i_netdb='$i_netdb'
14577 i_neterrno='$i_neterrno'
14578 i_netinettcp='$i_netinettcp'
14579 i_niin='$i_niin'
14580 i_poll='$i_poll'
14581 i_pthread='$i_pthread'
14582 i_pwd='$i_pwd'
14583 i_rpcsvcdbm='$i_rpcsvcdbm'
14584 i_sfio='$i_sfio'
14585 i_sgtty='$i_sgtty'
14586 i_shadow='$i_shadow'
14587 i_socks='$i_socks'
14588 i_stdarg='$i_stdarg'
14589 i_stddef='$i_stddef'
14590 i_stdlib='$i_stdlib'
14591 i_string='$i_string'
14592 i_sysaccess='$i_sysaccess'
14593 i_sysdir='$i_sysdir'
14594 i_sysfile='$i_sysfile'
14595 i_sysfilio='$i_sysfilio'
14596 i_sysin='$i_sysin'
14597 i_sysioctl='$i_sysioctl'
14598 i_sysmount='$i_sysmount'
14599 i_sysndir='$i_sysndir'
14600 i_sysparam='$i_sysparam'
14601 i_sysresrc='$i_sysresrc'
14602 i_syssecrt='$i_syssecrt'
14603 i_sysselct='$i_sysselct'
14604 i_syssockio='$i_syssockio'
14605 i_sysstat='$i_sysstat'
14606 i_sysstatfs='$i_sysstatfs'
14607 i_sysstatvfs='$i_sysstatvfs'
14608 i_systime='$i_systime'
14609 i_systimek='$i_systimek'
14610 i_systimes='$i_systimes'
14611 i_systypes='$i_systypes'
14612 i_sysuio='$i_sysuio'
14613 i_sysun='$i_sysun'
14614 i_sysvfs='$i_sysvfs'
14615 i_syswait='$i_syswait'
14616 i_termio='$i_termio'
14617 i_termios='$i_termios'
14618 i_time='$i_time'
14619 i_unistd='$i_unistd'
14620 i_ustat='$i_ustat'
14621 i_utime='$i_utime'
14622 i_values='$i_values'
14623 i_varargs='$i_varargs'
14624 i_varhdr='$i_varhdr'
14625 i_vfork='$i_vfork'
14626 ignore_versioned_solibs='$ignore_versioned_solibs'
14627 incpath='$incpath'
14628 inews='$inews'
14629 installarchlib='$installarchlib'
14630 installbin='$installbin'
14631 installman1dir='$installman1dir'
14632 installman3dir='$installman3dir'
14633 installprefix='$installprefix'
14634 installprefixexp='$installprefixexp'
14635 installprivlib='$installprivlib'
14636 installscript='$installscript'
14637 installsitearch='$installsitearch'
14638 installsitebin='$installsitebin'
14639 installsitelib='$installsitelib'
14640 installstyle='$installstyle'
14641 installusrbinperl='$installusrbinperl'
14642 installvendorbin='$installvendorbin'
14643 installvendorlib='$installvendorlib'
14644 intsize='$intsize'
14645 ivdformat='$ivdformat'
14646 ivsize='$ivsize'
14647 ivtype='$ivtype'
14648 known_extensions='$known_extensions'
14649 ksh='$ksh'
14650 large='$large'
14651 ld='$ld'
14652 lddlflags='$lddlflags'
14653 ldflags='$ldflags'
14654 ldlibpthname='$ldlibpthname'
14655 less='$less'
14656 lib_ext='$lib_ext'
14657 libc='$libc'
14658 libperl='$libperl'
14659 libpth='$libpth'
14660 libs='$libs'
14661 libswanted='$libswanted'
14662 line='$line'
14663 lint='$lint'
14664 lkflags='$lkflags'
14665 ln='$ln'
14666 lns='$lns'
14667 locincpth='$locincpth'
14668 loclibpth='$loclibpth'
14669 longdblsize='$longdblsize'
14670 longlongsize='$longlongsize'
14671 longsize='$longsize'
14672 lp='$lp'
14673 lpr='$lpr'
14674 ls='$ls'
14675 lseeksize='$lseeksize'
14676 lseektype='$lseektype'
14677 mail='$mail'
14678 mailx='$mailx'
14679 make='$make'
14680 make_set_make='$make_set_make'
14681 mallocobj='$mallocobj'
14682 mallocsrc='$mallocsrc'
14683 malloctype='$malloctype'
14684 man1dir='$man1dir'
14685 man1direxp='$man1direxp'
14686 man1ext='$man1ext'
14687 man3dir='$man3dir'
14688 man3direxp='$man3direxp'
14689 man3ext='$man3ext'
14690 medium='$medium'
14691 mips_type='$mips_type'
14692 mkdir='$mkdir'
14693 models='$models'
14694 modetype='$modetype'
14695 more='$more'
14696 multiarch='$multiarch'
14697 mv='$mv'
14698 myarchname='$myarchname'
14699 mydomain='$mydomain'
14700 myhostname='$myhostname'
14701 myuname='$myuname'
14702 n='$n'
14703 netdb_hlen_type='$netdb_hlen_type'
14704 netdb_host_type='$netdb_host_type'
14705 netdb_name_type='$netdb_name_type'
14706 netdb_net_type='$netdb_net_type'
14707 nm='$nm'
14708 nm_opt='$nm_opt'
14709 nm_so_opt='$nm_so_opt'
14710 nonxs_ext='$nonxs_ext'
14711 nroff='$nroff'
14712 nvsize='$nvsize'
14713 nvtype='$nvtype'
14714 o_nonblock='$o_nonblock'
14715 obj_ext='$obj_ext'
14716 old_pthread_create_joinable='$old_pthread_create_joinable'
14717 optimize='$optimize'
14718 orderlib='$orderlib'
14719 osname='$osname'
14720 osvers='$osvers'
14721 package='$package'
14722 pager='$pager'
14723 passcat='$passcat'
14724 patchlevel='$patchlevel'
14725 path_sep='$path_sep'
14726 perl='$perl'
14727 perladmin='$perladmin'
14728 perlpath='$perlpath'
14729 pg='$pg'
14730 phostname='$phostname'
14731 pidtype='$pidtype'
14732 plibpth='$plibpth'
14733 pm_apiversion='$pm_apiversion'
14734 pmake='$pmake'
14735 pr='$pr'
14736 prefix='$prefix'
14737 prefixexp='$prefixexp'
14738 privlib='$privlib'
14739 privlibexp='$privlibexp'
14740 prototype='$prototype'
14741 ptrsize='$ptrsize'
14742 quadkind='$quadkind'
14743 quadtype='$quadtype'
14744 randbits='$randbits'
14745 randfunc='$randfunc'
14746 randseedtype='$randseedtype'
14747 ranlib='$ranlib'
14748 rd_nodata='$rd_nodata'
14749 rm='$rm'
14750 rmail='$rmail'
14751 runnm='$runnm'
14752 sPRIEldbl='$sPRIEldbl'
14753 sPRIFldbl='$sPRIFldbl'
14754 sPRIGldbl='$sPRIGldbl'
14755 sPRIX64='$sPRIX64'
14756 sPRId64='$sPRId64'
14757 sPRIeldbl='$sPRIeldbl'
14758 sPRIfldbl='$sPRIfldbl'
14759 sPRIgldbl='$sPRIgldbl'
14760 sPRIi64='$sPRIi64'
14761 sPRIo64='$sPRIo64'
14762 sPRIu64='$sPRIu64'
14763 sPRIx64='$sPRIx64'
14764 sched_yield='$sched_yield'
14765 scriptdir='$scriptdir'
14766 scriptdirexp='$scriptdirexp'
14767 sed='$sed'
14768 seedfunc='$seedfunc'
14769 selectminbits='$selectminbits'
14770 selecttype='$selecttype'
14771 sendmail='$sendmail'
14772 sh='$sh'
14773 shar='$shar'
14774 sharpbang='$sharpbang'
14775 shmattype='$shmattype'
14776 shortsize='$shortsize'
14777 shrpenv='$shrpenv'
14778 shsharp='$shsharp'
14779 sig_count='$sig_count'
14780 sig_name='$sig_name'
14781 sig_name_init='$sig_name_init'
14782 sig_num='$sig_num'
14783 sig_num_init='$sig_num_init'
14784 signal_t='$signal_t'
14785 sitearch='$sitearch'
14786 sitearchexp='$sitearchexp'
14787 sitebin='$sitebin'
14788 sitebinexp='$sitebinexp'
14789 sitelib='$sitelib'
14790 sitelibexp='$sitelibexp'
14791 siteprefix='$siteprefix'
14792 siteprefixexp='$siteprefixexp'
14793 sizetype='$sizetype'
14794 sleep='$sleep'
14795 smail='$smail'
14796 small='$small'
14797 so='$so'
14798 sockethdr='$sockethdr'
14799 socketlib='$socketlib'
14800 sort='$sort'
14801 spackage='$spackage'
14802 spitshell='$spitshell'
14803 split='$split'
14804 src='$src'
14805 ssizetype='$ssizetype'
14806 startperl='$startperl'
14807 startsh='$startsh'
14808 static_ext='$static_ext'
14809 stdchar='$stdchar'
14810 stdio_base='$stdio_base'
14811 stdio_bufsiz='$stdio_bufsiz'
14812 stdio_cnt='$stdio_cnt'
14813 stdio_filbuf='$stdio_filbuf'
14814 stdio_ptr='$stdio_ptr'
14815 stdio_stream_array='$stdio_stream_array'
14816 strings='$strings'
14817 submit='$submit'
14818 subversion='$subversion'
14819 sysman='$sysman'
14820 tail='$tail'
14821 tar='$tar'
14822 tbl='$tbl'
14823 tee='$tee'
14824 test='$test'
14825 timeincl='$timeincl'
14826 timetype='$timetype'
14827 touch='$touch'
14828 tr='$tr'
14829 trnl='$trnl'
14830 troff='$troff'
14831 u16size='$u16size'
14832 u16type='$u16type'
14833 u32size='$u32size'
14834 u32type='$u32type'
14835 u64size='$u64size'
14836 u64type='$u64type'
14837 u8size='$u8size'
14838 u8type='$u8type'
14839 uidformat='$uidformat'
14840 uidsign='$uidsign'
14841 uidsize='$uidsize'
14842 uidtype='$uidtype'
14843 uname='$uname'
14844 uniq='$uniq'
14845 uquadtype='$uquadtype'
14846 use64bits='$use64bits'
14847 usedl='$usedl'
14848 uselargefiles='$uselargefiles'
14849 uselongdouble='$uselongdouble'
14850 uselonglong='$uselonglong'
14851 usemorebits='$usemorebits'
14852 usemultiplicity='$usemultiplicity'
14853 usemymalloc='$usemymalloc'
14854 usenm='$usenm'
14855 useopcode='$useopcode'
14856 useperlio='$useperlio'
14857 useposix='$useposix'
14858 usesfio='$usesfio'
14859 useshrplib='$useshrplib'
14860 usesocks='$usesocks'
14861 usethreads='$usethreads'
14862 usevendorprefix='$usevendorprefix'
14863 usevfork='$usevfork'
14864 usrinc='$usrinc'
14865 uuname='$uuname'
14866 uvoformat='$uvoformat'
14867 uvsize='$uvsize'
14868 uvtype='$uvtype'
14869 uvuformat='$uvuformat'
14870 uvxformat='$uvxformat'
14871 vendorbin='$vendorbin'
14872 vendorbinexp='$vendorbinexp'
14873 vendorlib='$vendorlib'
14874 vendorlibexp='$vendorlibexp'
14875 vendorprefix='$vendorprefix'
14876 vendorprefixexp='$vendorprefixexp'
14877 version='$version'
14878 vi='$vi'
14879 voidflags='$voidflags'
14880 xlibpth='$xlibpth'
14881 xs_apiversion='$xs_apiversion'
14882 zcat='$zcat'
14883 zip='$zip'
14884 EOT
14885
14886 : Add in command line options if available
14887 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
14888
14889 : add special variables
14890 $test -f $src/patchlevel.h && \
14891 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
14892 echo "CONFIGDOTSH=true" >>config.sh
14893
14894 : propagate old symbols
14895 if $test -f UU/config.sh; then
14896         <UU/config.sh sort | uniq >UU/oldconfig.sh
14897         sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
14898         sort | uniq -u >UU/oldsyms
14899         set X `cat UU/oldsyms`
14900         shift
14901         case $# in
14902         0) ;;
14903         *)
14904                 cat <<EOM
14905 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
14906 EOM
14907                 echo "# Variables propagated from previous config.sh file." >>config.sh
14908                 for sym in `cat UU/oldsyms`; do
14909                         echo "    Propagating $hint variable "'$'"$sym..."
14910                         eval 'tmp="$'"${sym}"'"'
14911                         echo "$tmp" | \
14912                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
14913                 done
14914                 ;;
14915         esac
14916 fi
14917
14918 : Finish up by extracting the .SH files
14919 case "$alldone" in
14920 exit)
14921         $rm -rf UU
14922         echo "Done."
14923         exit 0
14924         ;;
14925 cont)
14926         ;;
14927 '')
14928         dflt=''
14929         nostick=true
14930         $cat <<EOM
14931
14932 If you'd like to make any changes to the config.sh file before I begin
14933 to configure things, do it as a shell escape now (e.g. !vi config.sh).
14934
14935 EOM
14936         rp="Press return or use a shell escape to edit config.sh:"
14937         . UU/myread
14938         nostick=''
14939         case "$ans" in
14940         '') ;;
14941         *) : in case they cannot read
14942                 sh 1>&4 -c "$ans";;
14943         esac
14944         ;;
14945 esac
14946
14947 : if this fails, just run all the .SH files by hand
14948 . ./config.sh
14949
14950 echo " "
14951 exec 1>&4
14952 . ./UU/extract
14953
14954 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
14955         dflt=y
14956         case "$silent" in
14957         true) ;;
14958         *)
14959                 $cat <<EOM
14960
14961 Now you need to generate make dependencies by running "$make depend".
14962 You might prefer to run it in background: "$make depend > makedepend.out &"
14963 It can take a while, so you might not want to run it right now.
14964
14965 EOM
14966                 ;;
14967         esac
14968         rp="Run $make depend now?"
14969         . UU/myread
14970         case "$ans" in
14971         y*)
14972                 $make depend && echo "Now you must run a $make."
14973                 ;;
14974         *)
14975                 echo "You must run '$make depend' then '$make'."
14976                 ;;
14977         esac
14978 elif test -f [Mm]akefile; then
14979         echo " "
14980         echo "Now you must run a $make."
14981 else
14982         echo "Done."
14983 fi
14984
14985 if $test -f Policy.sh; then
14986     $cat <<EOM
14987
14988 If you compile $package on a different machine or from a different object
14989 directory, copy the Policy.sh file from this object directory to the
14990 new one before you run Configure -- this will help you with most of
14991 the policy defaults.
14992
14993 EOM
14994 fi
14995 if $test -f config.msg; then
14996     echo "Hmm.  I also noted the following information while running:"
14997     echo " "
14998     $cat config.msg >&4
14999     $rm -f config.msg
15000 fi
15001 $rm -f kit*isdone ark*isdone
15002 $rm -rf UU
15003
15004 : End of Configure
15005