5b3b6d5e62574fb7be501b745f3468a151e8f432
[p5sagit/p5-mst-13.2.git] / Configure
1 #! /bin/sh
2 #
3 # If these # comments don't work, trim them. Don't worry about any other
4 # shell scripts, Configure will trim # comments from them for you.
5 #
6 # (If you are trying to port this package to a machine without sh,
7 # I would suggest you have a look at the prototypical config_h.SH file
8 # and edit it to reflect your system. Some packages may include samples
9 # of config.h for certain machines, so you might look for one of those.)
10 #
11 # Yes, you may rip this off to use in other distribution packages. This
12 # script belongs to the public domain and cannot be copyrighted.
13 #
14 # (Note: this Configure script was generated automatically. Rather than
15 # working with this copy of Configure, you may wish to get metaconfig.
16 # The dist-3.0 package (which contains metaconfig) was posted in
17 # comp.sources.misc and is available on CPAN under authors/id/RAM so
18 # you may fetch it yourself from your nearest archive site.)
19 #
20
21 # $Id: Head.U,v 3.0.1.9 1997/02/28 15:02:09 ram Exp $
22 #
23 # Generated on Fri Jan  7 16:14:30 EST 2000 [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 use5005threads=''
866 useithreads=''
867 usethreads=''
868 incpath=''
869 mips_type=''
870 usrinc=''
871 d_vendorbin=''
872 installvendorbin=''
873 vendorbin=''
874 vendorbinexp=''
875 d_vendorlib=''
876 installvendorlib=''
877 vendorlib=''
878 vendorlibexp=''
879 usevendorprefix=''
880 vendorprefix=''
881 vendorprefixexp=''
882 defvoidused=''
883 voidflags=''
884 pm_apiversion=''
885 xs_apiversion=''
886 CONFIG=''
887
888 define='define'
889 undef='undef'
890 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
891 rmlist=''
892
893 : We must find out about Eunice early
894 eunicefix=':'
895 if test -f /etc/unixtovms; then
896         eunicefix=/etc/unixtovms
897 fi
898 if test -f /etc/unixtovms.exe; then
899         eunicefix=/etc/unixtovms.exe
900 fi
901
902 i_whoami=''
903 : Possible local include directories to search.
904 : Set locincpth to "" in a hint file to defeat local include searches.
905 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
906 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
907 :
908 : no include file wanted by default
909 inclwanted=''
910
911 : list of known cpp symbols, sorted alphabetically
912 al="AMIX BIT_MSF BSD BSD4_3 BSD_NET2 CMU CRAY DGUX DOLPHIN DPX2"
913 al="$al GO32 GOULD_PN HP700 I386 I80960 I960 Lynx M68000 M68K MACH"
914 al="$al MIPSEB MIPSEL MSDOS MTXINU MULTIMAX MVS"
915 al="$al M_COFF M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM"
916 al="$al M_SYS3 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX"
917 al="$al NeXT OCS88 OSF1 PARISC PC532 PORTAR POSIX"
918 al="$al PWB R3000 RES RISC6000 RT Sun386i SVR3 SVR4 SVR5"
919 al="$al SYSTYPE_BSD SYSTYPE_SVR4 SYSTYPE_SYSV Tek4132 Tek4300"
920 al="$al UMAXV USGr4 USGr4_2 UTEK UTS UTek UnicomPBB UnicomPBD Utek"
921 al="$al VMS Xenix286"
922 al="$al _AIX _AIX32 _AIX370 _AIX41 _AM29000 _COFF _CRAY _CX_UX _EPI"
923 al="$al _IBMESA _IBMR2 _M88K _M88KBCS_TARGET _POWER"
924 al="$al _MIPSEB _MIPSEL _M_COFF _M_I86 _M_I86SM _M_SYS3"
925 al="$al _M_SYS5 _M_SYSIII _M_SYSV _M_UNIX _M_XENIX _NLS _PGC_ _R3000"
926 al="$al _SYSTYPE_BSD _SYSTYPE_BSD43 _SYSTYPE_SVR4"
927 al="$al _SYSTYPE_SYSV _SYSV3 _U370 _UNICOS"
928 al="$al __386BSD__ __BIG_ENDIAN __BIG_ENDIAN__ __BSD_4_4__"
929 al="$al __DGUX__ __DPX2__ __H3050R __H3050RX"
930 al="$al __LITTLE_ENDIAN __LITTLE_ENDIAN__ __MACH__"
931 al="$al __MIPSEB __MIPSEB__ __MIPSEL __MIPSEL__"
932 al="$al __Next__ __OSF1__ __PARAGON__ __PGC__ __PWB __STDC__"
933 al="$al __SVR4_2__ __UMAXV__"
934 al="$al ____386BSD____ __alpha __alpha__ __amiga"
935 al="$al __bsd4_2 __bsd4_2__ __bsdi__ __convex__"
936 al="$al __host_mips__"
937 al="$al __hp9000s200 __hp9000s300 __hp9000s400 __hp9000s500"
938 al="$al __hp9000s500 __hp9000s700 __hp9000s800"
939 al="$al __hppa __hpux __hp_osf __i286 __i286__ __i386 __i386__"
940 al="$al __i486 __i486__ __i860 __i860__ __ibmesa __ksr1__ __linux__"
941 al="$al __m68k __m68k__ __m88100__ __m88k __m88k__"
942 al="$al __mc68000 __mc68000__ __mc68020 __mc68020__"
943 al="$al __mc68030 __mc68030__ __mc68040 __mc68040__"
944 al="$al __mc88100 __mc88100__ __mips __mips__"
945 al="$al __motorola__ __osf__ __pa_risc __sparc__ __stdc__"
946 al="$al __sun __sun__ __svr3__ __svr4__ __ultrix __ultrix__"
947 al="$al __unix __unix__ __uxpm__ __uxps__ __vax __vax__"
948 al="$al _host_mips _mips _unix"
949 al="$al a29k aegis aix aixpc alliant alpha am29000 amiga ansi ardent"
950 al="$al apollo ardent att386 att3b"
951 al="$al bsd bsd43 bsd4_2 bsd4_3 bsd4_4 bsdi bull"
952 al="$al cadmus clipper concurrent convex cray ctix"
953 al="$al dmert encore gcos gcx gimpel gould"
954 al="$al hbullx20 hcx host_mips hp200 hp300 hp700 hp800"
955 al="$al hp9000 hp9000s300 hp9000s400 hp9000s500"
956 al="$al hp9000s700 hp9000s800 hp9k8 hppa hpux"
957 al="$al i186 i286 i386 i486 i8086"
958 al="$al i80960 i860 iAPX286 ibm ibm032 ibmrt interdata is68k"
959 al="$al ksr1 linux luna luna88k m68k m88100 m88k"
960 al="$al mc300 mc500 mc68000 mc68010 mc68020 mc68030"
961 al="$al mc68040 mc68060 mc68k mc68k32 mc700"
962 al="$al mc88000 mc88100 merlin mert mips mvs n16"
963 al="$al ncl_el ncl_mr"
964 al="$al news1500 news1700 news1800 news1900 news3700"
965 al="$al news700 news800 news900 ns16000 ns32000"
966 al="$al ns32016 ns32332 ns32k nsc32000 os osf"
967 al="$al parisc pc532 pdp11 plexus posix pyr"
968 al="$al riscix riscos scs sequent sgi sinix sony sony_news"
969 al="$al sonyrisc sparc sparclite spectrum stardent stratos"
970 al="$al sun sun3 sun386 svr4 sysV68 sysV88"
971 al="$al titan tower tower32 tower32_200 tower32_600 tower32_700"
972 al="$al tower32_800 tower32_850 tss u370 u3b u3b2 u3b20 u3b200"
973 al="$al u3b20d u3b5 ultrix unix unixpc unos vax venix vms"
974 al="$al xenix z8000"
975
976 : Trailing extension.  Override this in a hint file, if needed.
977 _exe=''
978 : Extra object files, if any, needed on this platform.
979 archobjs=''
980 groupstype=''
981 : change the next line if compiling for Xenix/286 on Xenix/386
982 xlibpth='/usr/lib/386 /lib/386'
983
984 : Possible local library directories to search.
985 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
986 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
987
988 : general looking path for locating libraries
989 glibpth="/shlib /usr/shlib /lib/pa1.1 /usr/lib/large"
990 glibpth="$glibpth /lib /usr/lib $xlibpth"
991 glibpth="$glibpth /lib/large /usr/lib/small /lib/small"
992 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
993
994 : Private path used by Configure to find libraries.  Its value
995 : is prepended to libpth. This variable takes care of special
996 : machines, like the mips.  Usually, it should be empty.
997 plibpth=''
998
999 : default library list
1000 libswanted=''
1001 : some systems want to use only the non-versioned libso:s
1002 ignore_versioned_solibs=''
1003 : full support for void wanted by default
1004 defvoidused=15
1005
1006 : set useposix=false in your hint file to disable the POSIX extension.
1007 useposix=true
1008 : set useopcode=false in your hint file to disable the Opcode extension.
1009 useopcode=true
1010 : set usemultiplicity on the Configure command line to enable multiplicity.
1011 : set usesocks on the Configure command line to enable socks.
1012 : set usethreads on the Configure command line to enable threads.
1013 : List of libraries we want.
1014 : If anyone needs -lnet, put it in a hint file.
1015 libswanted='sfio socket inet nsl nm ndbm gdbm dbm db malloc dl'
1016 libswanted="$libswanted dld ld sun m c cposix posix"
1017 libswanted="$libswanted ndir dir crypt sec"
1018 libswanted="$libswanted ucb bsd BSD PW x"
1019 : We probably want to search /usr/shlib before most other libraries.
1020 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1021 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1022 glibpth="/usr/shlib $glibpth"
1023 : Do not use vfork unless overridden by a hint file.
1024 usevfork=false
1025
1026 : Find the basic shell for Bourne shell scripts
1027 case "$sh" in
1028 '')
1029         case "$SYSTYPE" in
1030         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1031         *) xxx='/bin/sh';;
1032         esac
1033         if test -f "$xxx"; then
1034                 sh="$xxx"
1035         else
1036                 : Build up a list and do a single loop so we can 'break' out.
1037                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1038                 for xxx in sh bash ksh pdksh ash; do
1039                         for p in $pth; do
1040                                 try="$try ${p}/${xxx}"
1041                         done
1042                 done
1043                 for xxx in $try; do
1044                         if test -f "$xxx"; then
1045                                 sh="$xxx";
1046                                 break
1047                         elif test -f "$xxx.exe"; then
1048                                 sh="$xxx";
1049                                 break
1050                         fi
1051                 done
1052         fi
1053         ;;
1054 esac
1055
1056 case "$sh" in
1057 '')     cat <<EOM >&2
1058 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
1059
1060 Usually it's in /bin/sh.  How did you even get this far?
1061 Please contact me (Perl Maintainers) at perlbug@perl.com and 
1062 we'll try to straighten this all out.
1063 EOM
1064         exit 1
1065         ;;
1066 esac
1067
1068 : see if sh knows # comments
1069 if `$sh -c '#' >/dev/null 2>&1`; then
1070         shsharp=true
1071         spitshell=cat
1072         xcat=/bin/cat
1073         test -f $xcat || xcat=/usr/bin/cat
1074         echo "#!$xcat" >try
1075         $eunicefix try
1076         chmod +x try
1077         ./try > today
1078         if test -s today; then
1079                 sharpbang='#!'
1080         else
1081                 echo "#! $xcat" > try
1082                 $eunicefix try
1083                 chmod +x try
1084                 ./try > today
1085                 if test -s today; then
1086                         sharpbang='#! '
1087                 else
1088                         sharpbang=': use '
1089                 fi
1090         fi
1091 else
1092         echo " "
1093         echo "Your $sh doesn't grok # comments--I will strip them later on."
1094         shsharp=false
1095         cd ..
1096         echo "exec grep -v '^[  ]*#'" >spitshell
1097         chmod +x spitshell
1098         $eunicefix spitshell
1099         spitshell=`pwd`/spitshell
1100         cd UU
1101         echo "I presume that if # doesn't work, #! won't work either!"
1102         sharpbang=': use '
1103 fi
1104 rm -f try today
1105
1106 : figure out how to guarantee sh startup
1107 case "$startsh" in
1108 '') startsh=${sharpbang}${sh} ;;
1109 *)
1110 esac
1111 cat >try <<EOSS
1112 $startsh
1113 set abc
1114 test "$?abc" != 1
1115 EOSS
1116
1117 chmod +x try
1118 $eunicefix try
1119 if ./try; then
1120         : echo "Yup, it does."
1121 else
1122         echo "Hmm... '$startsh' does not guarantee sh startup..."
1123         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1124 fi
1125 rm -f try
1126
1127
1128 : Save command line options in file UU/cmdline.opt for later use in
1129 : generating config.sh.
1130 cat > cmdline.opt <<EOSH
1131 # Configure command line arguments.
1132 config_arg0='$0'
1133 config_args='$*'
1134 config_argc=$#
1135 EOSH
1136 argn=1
1137 for arg in "$@"; do
1138         cat >>cmdline.opt <<EOSH
1139 config_arg$argn='$arg'
1140 EOSH
1141         argn=`expr $argn + 1`
1142 done
1143
1144 : produce awk script to parse command line options
1145 cat >options.awk <<'EOF'
1146 BEGIN {
1147         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1148
1149         len = length(optstr);
1150         for (i = 1; i <= len; i++) {
1151                 c = substr(optstr, i, 1);
1152                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1153                 if (a == ":") {
1154                         arg[c] = 1;
1155                         i++;
1156                 }
1157                 opt[c] = 1;
1158         }
1159 }
1160 {
1161         expect = 0;
1162         str = $0;
1163         if (substr(str, 1, 1) != "-") {
1164                 printf("'%s'\n", str);
1165                 next;
1166         }
1167         len = length($0);
1168         for (i = 2; i <= len; i++) {
1169                 c = substr(str, i, 1);
1170                 if (!opt[c]) {
1171                         printf("-%s\n", substr(str, i));
1172                         next;
1173                 }
1174                 printf("-%s\n", c);
1175                 if (arg[c]) {
1176                         if (i < len)
1177                                 printf("'%s'\n", substr(str, i + 1));
1178                         else
1179                                 expect = 1;
1180                         next;
1181                 }
1182         }
1183 }
1184 END {
1185         if (expect)
1186                 print "?";
1187 }
1188 EOF
1189
1190 : process the command line options
1191 set X `for arg in "$@"; do echo "X$arg"; done |
1192         sed -e s/X// | awk -f options.awk`
1193 eval "set $*"
1194 shift
1195 rm -f options.awk
1196
1197 : set up default values
1198 fastread=''
1199 reuseval=false
1200 config_sh=''
1201 alldone=''
1202 error=''
1203 silent=''
1204 extractsh=''
1205 override=''
1206 knowitall=''
1207 rm -f optdef.sh posthint.sh
1208 cat >optdef.sh <<EOS
1209 $startsh
1210 EOS
1211
1212
1213 : option parsing
1214 while test $# -gt 0; do
1215         case "$1" in
1216         -d) shift; fastread=yes;;
1217         -e) shift; alldone=cont;;
1218         -f)
1219                 shift
1220                 cd ..
1221                 if test -r "$1"; then
1222                         config_sh="$1"
1223                 else
1224                         echo "$me: cannot read config file $1." >&2
1225                         error=true
1226                 fi
1227                 cd UU
1228                 shift;;
1229         -h) shift; error=true;;
1230         -r) shift; reuseval=true;;
1231         -s) shift; silent=true; realsilent=true;;
1232         -E) shift; alldone=exit;;
1233         -K) shift; knowitall=true;;
1234         -O) shift; override=true;;
1235         -S) shift; silent=true; extractsh=true;;
1236         -D)
1237                 shift
1238                 case "$1" in
1239                 *=)
1240                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1241                         echo "$me: ignoring -D $1" >&2
1242                         ;;
1243                 *=*) echo "$1" | \
1244                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1245                 *) echo "$1='define'" >> optdef.sh;;
1246                 esac
1247                 shift
1248                 ;;
1249         -U)
1250                 shift
1251                 case "$1" in
1252                 *=) echo "$1" >> optdef.sh;;
1253                 *=*)
1254                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1255                         echo "$me: ignoring -U $1" >&2
1256                         ;;
1257                 *) echo "$1='undef'" >> optdef.sh;;
1258                 esac
1259                 shift
1260                 ;;
1261         -A)
1262             shift
1263             xxx=''
1264             yyy="$1"
1265             zzz=''
1266             uuu=undef
1267             case "$yyy" in
1268             *=*) zzz=`echo $yyy|sed 's!=.*!!'`
1269                  case "$zzz" in
1270                  *:*) zzz='' ;;
1271                  *)   xxx=append
1272                       zzz=" "`echo $yyy|sed 's!^[^=]*=!!'` 
1273                       yyy=`echo $yyy|sed 's!=.*!!'` ;;
1274                  esac
1275                  ;;
1276             esac
1277             case "$xxx" in
1278             '')  case "$yyy" in
1279                  *:*) xxx=`echo $yyy|sed 's!:.*!!'`
1280                       yyy=`echo $yyy|sed 's!^[^:]*:!!'`
1281                       zzz=`echo $yyy|sed 's!^[^=]*=!!'`
1282                       yyy=`echo $yyy|sed 's!=.*!!'` ;;
1283                  *)   xxx=`echo $yyy|sed 's!:.*!!'`
1284                       yyy=`echo $yyy|sed 's!^[^:]*:!!'` ;;
1285                  esac
1286                  ;;       
1287             esac
1288             case "$xxx" in
1289             append)
1290                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1291             clear)
1292                 echo "$yyy=''"                  >> posthint.sh ;;
1293             define)
1294                 case "$zzz" in
1295                 '') zzz=define ;;
1296                 esac
1297                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1298             eval)
1299                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1300             prepend)
1301                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1302             undef)
1303                 case "$zzz" in
1304                 '') zzz="$uuu" ;;
1305                 esac
1306                 echo "$yyy=$zzz"                >> posthint.sh ;;
1307             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1308             esac
1309             ;;
1310         -V) echo "$me generated by metaconfig 3.0 PL70." >&2
1311             exit 0;;
1312         --) break;;
1313         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1314         *) break;;
1315         esac
1316 done
1317
1318 case "$error" in
1319 true)
1320         cat >&2 <<EOM
1321 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1322                  [-U symbol] [-U symbol=] [-A command:symbol...]
1323   -d : use defaults for all answers.
1324   -e : go on without questioning past the production of config.sh.
1325   -f : specify an alternate default configuration file.
1326   -h : print this help message and exit (with an error status).
1327   -r : reuse C symbols value if possible (skips costly nm extraction).
1328   -s : silent mode, only echoes questions and essential information.
1329   -D : define symbol to have some value:
1330          -D symbol         symbol gets the value 'define'
1331          -D symbol=value   symbol gets the value 'value'
1332   -E : stop at the end of questions, after having produced config.sh.
1333   -K : do not use unless you know what you are doing.
1334   -O : let -D and -U override definitions from loaded configuration file.
1335   -S : perform variable substitutions on all .SH files (can mix with -f)
1336   -U : undefine symbol:
1337          -U symbol    symbol gets the value 'undef'
1338          -U symbol=   symbol gets completely empty
1339   -A : manipulate symbol after the platform specific hints have been applied:
1340          -A symbol=value                append " "value to symbol
1341          -A append:symbol=value         append value to symbol
1342          -A define:symbol=value         define symbol to have value
1343          -A clear:symbol                define symbol to be ''
1344          -A define:symbol               define symbol to be 'define'
1345          -A eval:symbol=value           define symbol to be eval of value
1346          -A prepend:symbol=value        prepend value to symbol
1347          -A undef:symbol                define symbol to be 'undef'
1348          -A undef:symbol=               define symbol to be ''
1349   -V : print version number and exit (with a zero status).
1350 EOM
1351         exit 1
1352         ;;
1353 esac
1354
1355 : Sanity checks
1356 case "$fastread$alldone" in
1357 yescont|yesexit) ;;
1358 *)
1359         if test ! -t 0; then
1360                 echo "Say 'sh Configure', not 'sh <Configure'"
1361                 exit 1
1362         fi
1363         ;;
1364 esac
1365
1366 exec 4>&1
1367 case "$silent" in
1368 true) exec 1>/dev/null;;
1369 esac
1370
1371 : run the defines and the undefines, if any, but leave the file out there...
1372 touch optdef.sh
1373 . ./optdef.sh
1374 : create the posthint manipulation script and leave the file out there...
1375 touch posthint.sh
1376
1377 : set package name
1378 package=perl5
1379 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1380 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1381 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1382 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1383 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1384 esac
1385
1386 : Some greps do not return status, grrr.
1387 echo "grimblepritz" >grimble
1388 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1389         contains=contains
1390 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1391         contains=grep
1392 else
1393         contains=contains
1394 fi
1395 rm -f grimble
1396 : the following should work in any shell
1397 case "$contains" in
1398 contains*)
1399         echo " "
1400         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1401         cat >contains <<'EOSS'
1402 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1403 EOSS
1404 chmod +x contains
1405 esac
1406
1407 : Find the path to the source tree
1408 case "$src" in
1409 '') case "$0" in
1410     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1411          case "$src" in
1412          /*)    ;;
1413          *)     src=`cd ../$src && pwd` ;;
1414          esac
1415          ;;
1416     *)   src='.';;
1417     esac;;
1418 esac
1419 case "$src" in
1420 '')     src=/
1421         rsrc=/
1422         ;;
1423 /*) rsrc="$src";;
1424 *) rsrc="../$src";;
1425 esac
1426 if test -f $rsrc/Configure && \
1427         $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1428 then
1429    : found it, so we are ok.
1430 else
1431         rsrc=''
1432         for src in . .. ../.. ../../.. ../../../..; do
1433                 if test -f ../$src/Configure && \
1434                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1435                 then
1436                         rsrc=../$src
1437                         break
1438                 fi
1439         done
1440 fi
1441 case "$rsrc" in
1442 '')
1443         cat <<EOM >&4
1444
1445 Sorry, I can't seem to locate the source dir for $package.  Please start
1446 Configure with an explicit path -- i.e. /some/path/Configure.
1447
1448 EOM
1449         exit 1
1450         ;;
1451 ../.)   rsrc='..';;
1452 *)
1453         echo " "
1454         echo "Sources for $package found in \"$src\"." >&4
1455         ;;
1456 esac
1457
1458 : script used to extract .SH files with variable substitutions
1459 cat >extract <<'EOS'
1460 CONFIGDOTSH=true
1461 echo "Doing variable substitutions on .SH files..."
1462 if test -f $src/MANIFEST; then
1463         set x `awk '{print $1}' <$src/MANIFEST | grep '\.SH$'`
1464 else
1465         echo "(Looking for .SH files under the source directory.)"
1466         set x `(cd $src; find . -name "*.SH" -print)`
1467 fi
1468 shift
1469 case $# in
1470 0) set x `(cd $src; echo *.SH)`; shift;;
1471 esac
1472 if test ! -f $src/$1; then
1473         shift
1474 fi
1475 mkdir_p='
1476 name=$1;
1477 create="";
1478 while test $name; do
1479         if test ! -d "$name"; then
1480                 create="$name $create";
1481                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1482                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1483         else
1484                 name="";
1485         fi;
1486 done;
1487 for file in $create; do
1488         mkdir $file;
1489 done
1490 '
1491 for file in $*; do
1492         case "$src" in
1493         ".")
1494                 case "$file" in
1495                 */*)
1496                         dir=`expr X$file : 'X\(.*\)/'`
1497                         file=`expr X$file : 'X.*/\(.*\)'`
1498                         (cd $dir && . ./$file)
1499                         ;;
1500                 *)
1501                         . ./$file
1502                         ;;
1503                 esac
1504                 ;;
1505         *)
1506                 case "$file" in
1507                 */*)
1508                         dir=`expr X$file : 'X\(.*\)/'`
1509                         file=`expr X$file : 'X.*/\(.*\)'`
1510                         (set x $dir; shift; eval $mkdir_p)
1511                         sh <$src/$dir/$file
1512                         ;;
1513                 *)
1514                         sh <$src/$file
1515                         ;;
1516                 esac
1517                 ;;
1518         esac
1519 done
1520 if test -f $src/config_h.SH; then
1521         if test ! -f config.h; then
1522         : oops, they left it out of MANIFEST, probably, so do it anyway.
1523         . $src/config_h.SH
1524         fi
1525 fi
1526 EOS
1527
1528 : extract files and exit if asked to do so
1529 case "$extractsh" in
1530 true)
1531         case "$realsilent" in
1532         true) ;;
1533         *) exec 1>&4;;
1534         esac
1535         case "$config_sh" in
1536         '') config_sh='config.sh';;
1537         esac
1538         echo " "
1539         echo "Fetching answers from $config_sh..."
1540         cd ..
1541         . $config_sh
1542         test "$override" && . ./optdef.sh
1543         echo " "
1544         . UU/extract
1545         rm -rf UU
1546         echo "Done."
1547         exit 0
1548         ;;
1549 esac
1550
1551 : Eunice requires " " instead of "", can you believe it
1552 echo " "
1553 : Here we go...
1554 echo "Beginning of configuration questions for $package."
1555
1556 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1557
1558 : first determine how to suppress newline on echo command
1559 echo " "
1560 echo "Checking echo to see how to suppress newlines..."
1561 (echo "hi there\c" ; echo " ") >.echotmp
1562 if $contains c .echotmp >/dev/null 2>&1 ; then
1563         echo "...using -n."
1564         n='-n'
1565         c=''
1566 else
1567         cat <<'EOM'
1568 ...using \c
1569 EOM
1570         n=''
1571         c='\c'
1572 fi
1573 echo $n "The star should be here-->$c"
1574 echo '*'
1575 rm -f .echotmp
1576
1577 : Now test for existence of everything in MANIFEST
1578 echo " "
1579 if test -f $rsrc/MANIFEST; then
1580         echo "First let's make sure your kit is complete.  Checking..." >&4
1581         awk '$1 !~ /PACK[A-Z]+/ {print $1}' $rsrc/MANIFEST | split -50
1582         rm -f missing
1583         tmppwd=`pwd`
1584         for filelist in x??; do
1585                 (cd $rsrc; ls `cat $tmppwd/$filelist` >/dev/null 2>>$tmppwd/missing)
1586         done
1587         if test -s missing; then
1588                 cat missing >&4
1589                 cat >&4 <<'EOM'
1590
1591 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1592
1593 You have the option of continuing the configuration process, despite the
1594 distinct possibility that your kit is damaged, by typing 'y'es.  If you
1595 do, don't blame me if something goes wrong.  I advise you to type 'n'o
1596 and contact the author (perlbug@perl.com).
1597
1598 EOM
1599                 echo $n "Continue? [n] $c" >&4
1600                 read ans
1601                 case "$ans" in
1602                 y*)
1603                         echo "Continuing..." >&4
1604                         rm -f missing
1605                         ;;
1606                 *)
1607                         echo "ABORTING..." >&4
1608                         kill $$
1609                         ;;
1610                 esac
1611         else
1612                 echo "Looks good..."
1613         fi
1614 else
1615         echo "There is no MANIFEST file.  I hope your kit is complete !"
1616 fi
1617 rm -f missing x??
1618
1619 echo " "
1620 : Find the appropriate value for a newline for tr
1621 if test -n "$DJGPP"; then
1622        trnl='\012'
1623 fi
1624 if test X"$trnl" = X; then
1625         case "`echo foo|tr '\n' x 2>/dev/null`" in
1626         foox) trnl='\n' ;;
1627         esac
1628 fi
1629 if test X"$trnl" = X; then
1630         case "`echo foo|tr '\012' x 2>/dev/null`" in
1631         foox) trnl='\012' ;;
1632         esac
1633 fi
1634 if test X"$trnl" = X; then
1635         cat <<EOM >&2
1636
1637 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
1638
1639 EOM
1640         exit 1
1641 fi
1642
1643 : compute the number of columns on the terminal for proper question formatting
1644 case "$COLUMNS" in
1645 '') COLUMNS='80';;
1646 esac
1647
1648 : set up the echo used in my read
1649 myecho="case \"\$xxxm\" in
1650 '') echo $n \"\$rp $c\" >&4;;
1651 *) case \"\$rp\" in
1652         '') echo $n \"[\$xxxm] $c\";;
1653         *)
1654                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
1655                         echo \"\$rp\" >&4
1656                         echo $n \"[\$xxxm] $c\" >&4
1657                 else
1658                         echo $n \"\$rp [\$xxxm] $c\" >&4
1659                 fi
1660                 ;;
1661         esac;;
1662 esac"
1663
1664 : now set up to do reads with possible shell escape and default assignment
1665 cat <<EOSC >myread
1666 $startsh
1667 xxxm=\$dflt
1668 $myecho
1669 ans='!'
1670 case "\$fastread" in
1671 yes) case "\$dflt" in
1672         '') ;;
1673         *) ans='';
1674                 case "\$silent-\$rp" in
1675                 true-) ;;
1676                 *) echo " " >&4;;
1677                 esac;;
1678         esac;;
1679 *) case "\$silent" in
1680         true) case "\$rp" in
1681                 '') ans='';;
1682                 esac;;
1683         esac;;
1684 esac
1685 while expr "X\$ans" : "X!" >/dev/null; do
1686         read answ
1687         set x \$xxxm
1688         shift
1689         aok=''; eval "ans=\\"\$answ\\"" && aok=y
1690         case  "\$answ" in
1691         "!")
1692                 sh 1>&4
1693                 echo " "
1694                 $myecho
1695                 ;;
1696         !*)
1697                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
1698                 shift
1699                 sh 1>&4 -c "\$*"
1700                 echo " "
1701                 $myecho
1702                 ;;
1703         "\$ans")
1704                 case "\$ans" in
1705                 \\&*)
1706                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
1707                         shift
1708                         case "\$1" in
1709                         -d)
1710                                 fastread=yes
1711                                 echo "(OK, I'll run with -d after this question.)" >&4
1712                                 ;;
1713                         -*)
1714                                 echo "*** Sorry, \$1 not supported yet." >&4
1715                                 ;;
1716                         esac
1717                         $myecho
1718                         ans=!
1719                         ;;
1720                 esac;;
1721         *)
1722                 case "\$aok" in
1723                 y)
1724                         echo "*** Substitution done -- please confirm."
1725                         xxxm="\$ans"
1726                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
1727                         xxxm="\$ans"
1728                         ans=!
1729                         ;;
1730                 *)
1731                         echo "*** Error -- try again."
1732                         ans=!
1733                         ;;
1734                 esac
1735                 $myecho
1736                 ;;
1737         esac
1738         case "\$ans\$xxxm\$nostick" in
1739         '')
1740                 ans=!
1741                 $myecho
1742                 ;;
1743         esac
1744 done
1745 case "\$ans" in
1746 '') ans="\$xxxm";;
1747 esac
1748 EOSC
1749
1750 : create .config dir to save info across Configure sessions
1751 test -d ../.config || mkdir ../.config
1752 cat >../.config/README <<EOF
1753 This directory created by Configure to save information that should
1754 persist across sessions for $package.
1755
1756 You may safely delete it if you wish.
1757 EOF
1758
1759 : general instructions
1760 needman=true
1761 firsttime=true
1762 user=`(logname) 2>/dev/null`
1763 case "$user" in
1764 '') user=`whoami 2>&1`;;
1765 esac
1766 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
1767         firsttime=false
1768         echo " "
1769         rp='Would you like to see the instructions?'
1770         dflt=n
1771         . ./myread
1772         case "$ans" in
1773         [yY]*) ;;
1774         *) needman=false;;
1775         esac
1776 fi
1777 if $needman; then
1778         cat <<EOH
1779
1780 This installation shell script will examine your system and ask you questions
1781 to determine how the perl5 package should be installed. If you get
1782 stuck on a question, you may use a ! shell escape to start a subshell or
1783 execute a command.  Many of the questions will have default answers in square
1784 brackets; typing carriage return will give you the default.
1785
1786 On some of the questions which ask for file or directory names you are allowed
1787 to use the ~name construct to specify the login directory belonging to "name",
1788 even if you don't have a shell which knows about that.  Questions where this is
1789 allowed will be marked "(~name ok)".
1790
1791 EOH
1792         rp=''
1793         dflt='Type carriage return to continue'
1794         . ./myread
1795         cat <<'EOH'
1796
1797 The prompter used in this script allows you to use shell variables and
1798 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
1799 in the default answer, as if the default line was a set of arguments given to a
1800 script shell.  This means you may also use $* to repeat the whole default line,
1801 so you do not have to re-type everything to add something to the default.
1802
1803 Everytime there is a substitution, you will have to confirm.  If there is an
1804 error (e.g. an unmatched backtick), the default answer will remain unchanged
1805 and you will be prompted again.
1806
1807 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
1808 the questions and use the computed defaults (or the previous answers if there
1809 was already a config.sh file). Type 'Configure -h' for a list of options.
1810 You may also start interactively and then answer '& -d' at any prompt to turn
1811 on the non-interactive behaviour for the remainder of the execution.
1812
1813 EOH
1814         . ./myread
1815         cat <<EOH
1816
1817 Much effort has been expended to ensure that this shell script will run on any
1818 Unix system.  If despite that it blows up on yours, your best bet is to edit
1819 Configure and run it again.  If you can't run Configure for some reason,
1820 you'll have to generate a config.sh file by hand.  Whatever problems you
1821 have, let me (perlbug@perl.com) know how I blew it.
1822
1823 This installation script affects things in two ways:
1824
1825 1) it may do direct variable substitutions on some of the files included
1826    in this kit.
1827 2) it builds a config.h file for inclusion in C programs.  You may edit
1828    any of these files as the need arises after running this script.
1829
1830 If you make a mistake on a question, there is no easy way to back up to it
1831 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
1832 files.  Configure will offer to let you do this before it runs the SH files.
1833
1834 EOH
1835         dflt='Type carriage return to continue'
1836         . ./myread
1837         case "$firsttime" in
1838         true) echo $user >>../.config/instruct;;
1839         esac
1840 fi
1841
1842 : find out where common programs are
1843 echo " "
1844 echo "Locating common programs..." >&4
1845 cat <<EOSC >loc
1846 $startsh
1847 case \$# in
1848 0) exit 1;;
1849 esac
1850 thing=\$1
1851 shift
1852 dflt=\$1
1853 shift
1854 for dir in \$*; do
1855         case "\$thing" in
1856         .)
1857         if test -d \$dir/\$thing; then
1858                 echo \$dir
1859                 exit 0
1860         fi
1861         ;;
1862         *)
1863         for thisthing in \$dir/\$thing; do
1864                 : just loop through to pick last item
1865         done
1866         if test -f \$thisthing; then
1867                 echo \$thisthing
1868                 exit 0
1869         elif test -f \$dir/\$thing.exe; then
1870                 if test -n "$DJGPP"; then
1871                         echo \$dir/\$thing.exe
1872                 else
1873                         : on Eunice apparently
1874                         echo \$dir/\$thing
1875                 fi
1876                 exit 0
1877         fi
1878         ;;
1879         esac
1880 done
1881 echo \$dflt
1882 exit 1
1883 EOSC
1884 chmod +x loc
1885 $eunicefix loc
1886 loclist="
1887 awk
1888 cat
1889 comm
1890 cp
1891 echo
1892 expr
1893 find
1894 grep
1895 ls
1896 make
1897 mkdir
1898 rm
1899 sed
1900 sort
1901 touch
1902 tr
1903 uniq
1904 "
1905 trylist="
1906 Mcc
1907 ar
1908 byacc
1909 cpp
1910 csh
1911 date
1912 egrep
1913 gzip
1914 less
1915 line
1916 ln
1917 more
1918 nm
1919 nroff
1920 perl
1921 pg
1922 sendmail
1923 test
1924 uname
1925 zip
1926 "
1927 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1928 pth="$pth /lib /usr/lib"
1929 for file in $loclist; do
1930         eval xxx=\$$file
1931         case "$xxx" in
1932         /*|?:[\\/]*)
1933                 if test -f "$xxx"; then
1934                         : ok
1935                 else
1936                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
1937                         xxx=`./loc $file $file $pth`
1938                 fi
1939                 ;;
1940         '') xxx=`./loc $file $file $pth`;;
1941         *) xxx=`./loc $xxx $xxx $pth`;;
1942         esac
1943         eval $file=$xxx
1944         eval _$file=$xxx
1945         case "$xxx" in
1946         /*)
1947                 echo $file is in $xxx.
1948                 ;;
1949         ?:[\\/]*)
1950                 echo $file is in $xxx.
1951                 ;;
1952         *)
1953                 echo "I don't know where '$file' is, and my life depends on it." >&4
1954                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
1955                 exit 1
1956                 ;;
1957         esac
1958 done
1959 echo " "
1960 echo "Don't worry if any of the following aren't found..."
1961 say=offhand
1962 for file in $trylist; do
1963         eval xxx=\$$file
1964         case "$xxx" in
1965         /*|?:[\\/]*)
1966                 if test -f "$xxx"; then
1967                         : ok
1968                 else
1969                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
1970                         xxx=`./loc $file $file $pth`
1971                 fi
1972                 ;;
1973         '') xxx=`./loc $file $file $pth`;;
1974         *) xxx=`./loc $xxx $xxx $pth`;;
1975         esac
1976         eval $file=$xxx
1977         eval _$file=$xxx
1978         case "$xxx" in
1979         /*)
1980                 echo $file is in $xxx.
1981                 ;;
1982         ?:[\\/]*)
1983                 echo $file is in $xxx.
1984                 ;;
1985         *)
1986                 echo "I don't see $file out there, $say."
1987                 say=either
1988                 ;;
1989         esac
1990 done
1991 case "$egrep" in
1992 egrep)
1993         echo "Substituting grep for egrep."
1994         egrep=$grep
1995         ;;
1996 esac
1997 case "$ln" in
1998 ln)
1999         echo "Substituting cp for ln."
2000         ln=$cp
2001         ;;
2002 esac
2003 case "$test" in
2004 test)
2005         echo "Hopefully test is built into your sh."
2006         ;;
2007 *)
2008         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2009                 echo "Using the test built into your sh."
2010                 test=test
2011                 _test=test
2012         fi
2013         ;;
2014 esac
2015 case "$echo" in
2016 echo)
2017         echo "Hopefully echo is built into your sh."
2018         ;;
2019 '') ;;
2020 *)
2021         echo " "
2022 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2023         $echo $n "hi there$c" >foo1
2024         echo $n "hi there$c" >foo2
2025         if cmp foo1 foo2 >/dev/null 2>&1; then
2026                 echo "They are compatible.  In fact, they may be identical."
2027         else
2028                 case "$n" in
2029                 '-n') n='' c='\c';;
2030                 *) n='-n' c='';;
2031                 esac
2032                 cat <<FOO
2033 They are not compatible!  You are probably running ksh on a non-USG system.
2034 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2035 have echo built in and we may have to run some Bourne shell scripts.  That
2036 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2037
2038 FOO
2039                 $echo $n "The star should be here-->$c"
2040                 $echo "*"
2041         fi
2042         $rm -f foo1 foo2
2043         ;;
2044 esac
2045
2046 : determine whether symbolic links are supported
2047 echo " "
2048 $touch blurfl
2049 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2050         echo "Symbolic links are supported." >&4
2051         lns="$ln -s"
2052 else
2053         echo "Symbolic links are NOT supported." >&4
2054         lns="$ln"
2055 fi
2056 $rm -f blurfl sym
2057
2058 : see whether [:lower:] and [:upper:] are supported character classes
2059 echo " "
2060 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2061 ABYZ)
2062         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2063         up='[:upper:]'
2064         low='[:lower:]'
2065         ;;
2066 *)      # There is a discontinuity in EBCDIC between 'I' and 'J'
2067         # (0xc9 and 0xd1), therefore that is a nice testing point.
2068         if test "X$up" = X -o "X$low" = X; then
2069             case "`echo IJ | $tr '[I-J]' '[i-j]' 2>/dev/null`" in
2070             ij) up='[A-Z]'
2071                 low='[a-z]'
2072                 ;;
2073             esac
2074         fi
2075         if test "X$up" = X -o "X$low" = X; then
2076             case "`echo IJ | $tr I-J i-j 2>/dev/null`" in
2077             ij) up='A-Z'
2078                 low='a-z'
2079                 ;;
2080             esac
2081         fi
2082         if test "X$up" = X -o "X$low" = X; then
2083             case "`echo IJ | od -x 2>/dev/null`" in
2084             *C9D1*|*c9d1*)
2085                 echo "Hey, this might be EBCDIC." >&4
2086                 if test "X$up" = X -o "X$low" = X; then
2087                     case "`echo IJ | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
2088                     ij) up='[A-IJ-RS-Z]'
2089                         low='[a-ij-rs-z]'
2090                         ;;
2091                     esac
2092                 fi
2093                 if test "X$up" = X -o "X$low" = X; then
2094                     case "`echo IJ | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
2095                     ij) up='A-IJ-RS-Z'
2096                         low='a-ij-rs-z'
2097                         ;;
2098                     esac
2099                 fi
2100                 ;;
2101             esac
2102         fi
2103 esac
2104 case "`echo IJ | $tr \"$up\" \"$low\" 2>/dev/null`" in
2105 ij)
2106     echo "Using $up and $low to convert case." >&4
2107     ;;
2108 *)
2109     echo "I don't know how to translate letters from upper to lower case." >&4
2110     echo "Your tr is not acting any way I know of." >&4
2111     exit 1
2112     ;;
2113 esac
2114 : set up the translation script tr, must be called with ./tr of course
2115 cat >tr <<EOSC
2116 $startsh
2117 case "\$1\$2" in
2118 '[A-Z][a-z]') exec $tr '$up' '$low';;
2119 '[a-z][A-Z]') exec $tr '$low' '$up';;
2120 esac
2121 exec $tr "\$@"
2122 EOSC
2123 chmod +x tr
2124 $eunicefix tr
2125
2126 : Try to determine whether config.sh was made on this system
2127 case "$config_sh" in
2128 '')
2129 myuname=`( ($uname -a) 2>/dev/null || hostname) 2>&1`
2130 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
2131 # because the A-Z/a-z are not consecutive.
2132 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
2133         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
2134 newmyuname="$myuname"
2135 dflt=n
2136 case "$knowitall" in
2137 '')
2138         if test -f ../config.sh; then
2139                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
2140                         eval "`grep myuname= ../config.sh`"
2141                 fi
2142                 if test "X$myuname" = "X$newmyuname"; then
2143                         dflt=y
2144                 fi
2145         fi
2146         ;;
2147 *) dflt=y;;
2148 esac
2149
2150 : Get old answers from old config file if Configure was run on the
2151 : same system, otherwise use the hints.
2152 hint=default
2153 cd ..
2154 if test -f config.sh; then
2155         echo " "
2156         rp="I see a config.sh file.  Shall I use it to set the defaults?"
2157         . UU/myread
2158         case "$ans" in
2159         n*|N*) echo "OK, I'll ignore it."; mv config.sh config.sh.old;;
2160         *)  echo "Fetching default answers from your old config.sh file..." >&4
2161                 tmp_n="$n"
2162                 tmp_c="$c"
2163                 tmp_sh="$sh"
2164                 . ./config.sh
2165                 cp config.sh UU
2166                 n="$tmp_n"
2167                 c="$tmp_c"
2168                 : Older versions did not always set $sh.  Catch re-use of such
2169                 : an old config.sh.
2170                 case "$sh" in
2171                 '') sh="$tmp_sh" ;;
2172                 esac
2173                 hint=previous
2174                 ;;
2175         esac
2176 fi
2177 if test ! -f config.sh; then
2178         $cat <<EOM
2179
2180 First time through, eh?  I have some defaults handy for some systems
2181 that need some extra help getting the Configure answers right:
2182
2183 EOM
2184         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
2185         dflt=''
2186         : Half the following guesses are probably wrong... If you have better
2187         : tests or hints, please send them to perlbug@perl.com
2188         : The metaconfig authors would also appreciate a copy...
2189         $test -f /irix && osname=irix
2190         $test -f /xenix && osname=sco_xenix
2191         $test -f /dynix && osname=dynix
2192         $test -f /dnix && osname=dnix
2193         $test -f /lynx.os && osname=lynxos
2194         $test -f /unicos && osname=unicos && osvers=`$uname -r`
2195         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
2196         $test -f /bin/mips && /bin/mips && osname=mips
2197         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
2198                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
2199         $test -d /usr/apollo/bin && osname=apollo
2200         $test -f /etc/saf/_sactab && osname=svr4
2201         $test -d /usr/include/minix && osname=minix
2202         if $test -d /MachTen -o -d /MachTen_Folder; then
2203                 osname=machten
2204                 if $test -x /sbin/version; then
2205                         osvers=`/sbin/version | $awk '{print $2}' |
2206                         $sed -e 's/[A-Za-z]$//'`
2207                 elif $test -x /usr/etc/version; then
2208                         osvers=`/usr/etc/version | $awk '{print $2}' |
2209                         $sed -e 's/[A-Za-z]$//'`
2210                 else
2211                         osvers="$2.$3"
2212                 fi
2213         fi
2214
2215         $test -f /sys/posix.dll &&
2216                 $test -f /usr/bin/what &&
2217                 set X `/usr/bin/what /sys/posix.dll` &&
2218                 $test "$3" = UWIN &&
2219                 osname=uwin &&
2220                 osvers="$5"
2221
2222         if $test -f $uname; then
2223                 set X $myuname
2224                 shift
2225
2226                 case "$5" in
2227                 fps*) osname=fps ;;
2228                 mips*)
2229                         case "$4" in
2230                         umips) osname=umips ;;
2231                         *) osname=mips ;;
2232                         esac;;
2233                 [23]100) osname=mips ;;
2234                 next*) osname=next ;;
2235                 i386*)
2236                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
2237                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
2238                                 osname='sco'
2239                                 osvers=$tmp
2240                         elif $test -f /etc/kconfig; then
2241                                 osname=isc
2242                                 if test "$lns" = "$ln -s"; then
2243                                         osvers=4
2244                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
2245                                         osvers=3
2246                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
2247                                         osvers=2
2248                                 fi
2249                         fi
2250                         tmp=''
2251                         ;;
2252                 pc*)
2253                         if test -n "$DJGPP"; then
2254                                 osname=dos
2255                                 osvers=djgpp
2256                         fi
2257                         ;;
2258                 esac
2259
2260                 case "$1" in
2261                 aix) osname=aix
2262                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
2263                         case "$tmp" in
2264                         'not found') osvers="$4"."$3" ;;
2265                         '<3240'|'<>3240') osvers=3.2.0 ;;
2266                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
2267                         '=3250'|'>3250') osvers=3.2.5 ;;
2268                         *) osvers=$tmp;;
2269                         esac
2270                         ;;
2271                 bsd386) osname=bsd386
2272                         osvers=`$uname -r`
2273                         ;;
2274                 cygwin*) osname=cygwin
2275                         osvers="$3"
2276                         ;;
2277                 *dc.osx) osname=dcosx
2278                         osvers="$3"
2279                         ;;
2280                 dnix) osname=dnix
2281                         osvers="$3"
2282                         ;;
2283                 domainos) osname=apollo
2284                         osvers="$3"
2285                         ;;
2286                 dgux) osname=dgux 
2287                         osvers="$3"
2288                         ;;
2289                 dynixptx*) osname=dynixptx
2290                         osvers=`echo "$4"|sed 's/^v//'`
2291                         ;;
2292                 freebsd) osname=freebsd 
2293                         osvers="$3" ;;
2294                 genix) osname=genix ;;
2295                 hp*) osname=hpux 
2296                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
2297                         ;;
2298                 irix*) osname=irix
2299                         case "$3" in
2300                         4*) osvers=4 ;;
2301                         5*) osvers=5 ;;
2302                         *)      osvers="$3" ;;
2303                         esac
2304                         ;;
2305                 linux) osname=linux
2306                         case "$3" in
2307                         *)      osvers="$3" ;;
2308                         esac
2309                         ;;
2310                 MiNT) osname=mint
2311                         ;;
2312                 netbsd*) osname=netbsd
2313                         osvers="$3"
2314                         ;;
2315                 news-os) osvers="$3"
2316                         case "$3" in
2317                         4*) osname=newsos4 ;;
2318                         *) osname=newsos ;;
2319                         esac
2320                         ;;
2321                 next*) osname=next ;;
2322                 POSIX-BC | posix-bc ) osname=posix-bc
2323                         osvers="$3"
2324                         ;;
2325                 powerux | power_ux | powermax_os | powermaxos | \
2326                 powerunix | power_unix) osname=powerux
2327                         osvers="$3"
2328                         ;;
2329                 qnx) osname=qnx
2330                         osvers="$4"
2331                         ;;
2332                 solaris) osname=solaris
2333                         case "$3" in
2334                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
2335                         *)      osvers="$3" ;;
2336                         esac
2337                         ;;
2338                 sunos) osname=sunos
2339                         case "$3" in
2340                         5*) osname=solaris
2341                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
2342                         *)      osvers="$3" ;;
2343                         esac
2344                         ;;
2345                 titanos) osname=titanos
2346                         case "$3" in
2347                         1*) osvers=1 ;;
2348                         2*) osvers=2 ;;
2349                         3*) osvers=3 ;;
2350                         4*) osvers=4 ;;
2351                         *)      osvers="$3" ;;
2352                         esac
2353                         ;;
2354                 ultrix) osname=ultrix
2355                         osvers="$3"
2356                         ;;
2357                 osf1|mls+)      case "$5" in
2358                                 alpha)
2359                                         osname=dec_osf
2360                                         osvers=`echo "$3" | sed 's/^[xvt]//'`
2361                                         ;;
2362                         hp*)    osname=hp_osf1  ;;
2363                         mips)   osname=mips_osf1 ;;
2364                         esac
2365                         ;;
2366                 unixware) osname=svr5
2367                         osvers="$4"
2368                         ;;
2369                 uts) osname=uts
2370                         osvers="$3"
2371                         ;;
2372                 $2) case "$osname" in
2373                         *isc*) ;;
2374                         *freebsd*) ;;
2375                         svr*)
2376                                 : svr4.x or possibly later
2377                                 case "svr$3" in 
2378                                 ${osname}*)
2379                                         osname=svr$3
2380                                         osvers=$4
2381                                         ;;
2382                                 esac
2383                                 case "$osname" in
2384                                 svr4.0)
2385                                         : Check for ESIX
2386                                         if test -f /stand/boot ; then
2387                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
2388                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
2389                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
2390                                                         if test -n "$isesix"; then
2391                                                                 osname=esix4
2392                                                         fi
2393                                                 fi
2394                                         fi
2395                                         ;;
2396                                 esac
2397                                 ;;
2398                         *)      if test -f /etc/systemid; then
2399                                         osname=sco
2400                                         set `echo $3 | $sed 's/\./ /g'` $4
2401                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
2402                                                 osvers=$1.$2.$3
2403                                         elif $test -f $src/hints/sco_$1_$2.sh; then
2404                                                 osvers=$1.$2
2405                                         elif $test -f $src/hints/sco_$1.sh; then
2406                                                 osvers=$1
2407                                         fi
2408                                 else
2409                                         case "$osname" in
2410                                         '') : Still unknown.  Probably a generic Sys V.
2411                                                 osname="sysv"
2412                                                 osvers="$3"
2413                                                 ;;
2414                                         esac
2415                                 fi
2416                                 ;;
2417                         esac
2418                         ;;
2419                 *)      case "$osname" in
2420                         '') : Still unknown.  Probably a generic BSD.
2421                                 osname="$1"
2422                                 osvers="$3"
2423                                 ;;
2424                         esac
2425                         ;;
2426                 esac
2427         else
2428                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
2429                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
2430                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
2431                                 osname=news_os
2432                         fi
2433                         $rm -f UU/kernel.what
2434                 elif test -d c:/.; then
2435                         set X $myuname
2436                         osname=os2
2437                         osvers="$5"
2438                 fi
2439         fi
2440         
2441         : Now look for a hint file osname_osvers, unless one has been
2442         : specified already.
2443         case "$hintfile" in
2444         ''|' ')
2445                 file=`echo "${osname}_${osvers}" | $sed -e 's@\.@_@g' -e 's@_$@@'`
2446                 : Also try without trailing minor version numbers.
2447                 xfile=`echo $file | $sed -e 's@_[^_]*$@@'`
2448                 xxfile=`echo $xfile | $sed -e 's@_[^_]*$@@'`
2449                 xxxfile=`echo $xxfile | $sed -e 's@_[^_]*$@@'`
2450                 xxxxfile=`echo $xxxfile | $sed -e 's@_[^_]*$@@'`
2451                 case "$file" in
2452                 '') dflt=none ;;
2453                 *)  case "$osvers" in
2454                         '') dflt=$file
2455                                 ;;
2456                         *)  if $test -f $src/hints/$file.sh ; then
2457                                         dflt=$file
2458                                 elif $test -f $src/hints/$xfile.sh ; then
2459                                         dflt=$xfile
2460                                 elif $test -f $src/hints/$xxfile.sh ; then
2461                                         dflt=$xxfile
2462                                 elif $test -f $src/hints/$xxxfile.sh ; then
2463                                         dflt=$xxxfile
2464                                 elif $test -f $src/hints/$xxxxfile.sh ; then
2465                                         dflt=$xxxxfile
2466                                 elif $test -f "$src/hints/${osname}.sh" ; then
2467                                         dflt="${osname}"
2468                                 else
2469                                         dflt=none
2470                                 fi
2471                                 ;;
2472                         esac
2473                         ;;
2474                 esac
2475                 if $test -f Policy.sh ; then
2476                         case "$dflt" in
2477                         *Policy*) ;;
2478                         none) dflt="Policy" ;;
2479                         *) dflt="Policy $dflt" ;;
2480                         esac
2481                 fi
2482                 ;;
2483         *)
2484                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
2485                 ;;
2486         esac
2487
2488         if $test -f Policy.sh ; then
2489                 $cat <<EOM
2490
2491 There's also a Policy hint file available, which should make the
2492 site-specific (policy) questions easier to answer.
2493 EOM
2494
2495         fi
2496
2497         $cat <<EOM
2498
2499 You may give one or more space-separated answers, or "none" if appropriate.
2500 A well-behaved OS will have no hints, so answering "none" or just "Policy"
2501 is a good thing.  DO NOT give a wrong version or a wrong OS.
2502
2503 EOM
2504
2505         rp="Which of these apply, if any?"
2506         . UU/myread
2507         tans=$ans
2508         for file in $tans; do
2509                 if $test X$file = XPolicy -a -f Policy.sh; then
2510                         . Policy.sh
2511                         $cat Policy.sh >> UU/config.sh
2512                 elif $test -f $src/hints/$file.sh; then
2513                         . $src/hints/$file.sh
2514                         $cat $src/hints/$file.sh >> UU/config.sh
2515                 elif $test X$tans = X -o X$tans = Xnone ; then
2516                         : nothing
2517                 else
2518                         : Give one chance to correct a possible typo.
2519                         echo "$file.sh does not exist"
2520                         dflt=$file
2521                         rp="hint to use instead?"
2522                         . UU/myread
2523                         for file in $ans; do
2524                                 if $test -f "$src/hints/$file.sh"; then
2525                                         . $src/hints/$file.sh
2526                                         $cat $src/hints/$file.sh >> UU/config.sh
2527                                 elif $test X$ans = X -o X$ans = Xnone ; then
2528                                         : nothing
2529                                 else
2530                                         echo "$file.sh does not exist -- ignored."
2531                                 fi
2532                         done
2533                 fi
2534         done
2535
2536         hint=recommended
2537         : Remember our hint file for later.
2538         if $test -f "$src/hints/$file.sh" ; then
2539                 hintfile="$file"
2540         else
2541                 hintfile=''
2542         fi
2543 fi
2544 cd UU
2545 ;;
2546 *)
2547         echo " "
2548         echo "Fetching default answers from $config_sh..." >&4
2549         tmp_n="$n"
2550         tmp_c="$c"
2551         cd ..
2552         cp $config_sh config.sh 2>/dev/null
2553         chmod +w config.sh
2554         . ./config.sh
2555         cd UU
2556         cp ../config.sh .
2557         n="$tmp_n"
2558         c="$tmp_c"
2559         hint=previous
2560         ;;
2561 esac
2562 test "$override" && . ./optdef.sh
2563 myuname="$newmyuname"
2564
2565 : Restore computed paths
2566 for file in $loclist $trylist; do
2567         eval $file="\$_$file"
2568 done
2569
2570 cat << EOM
2571
2572 Configure uses the operating system name and version to set some defaults.
2573 The default value is probably right if the name rings a bell. Otherwise,
2574 since spelling matters for me, either accept the default or answer "none"
2575 to leave it blank.
2576
2577 EOM
2578 case "$osname" in
2579         ''|' ')
2580                 case "$hintfile" in
2581                 ''|' '|none) dflt=none ;;
2582                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
2583                 esac
2584                 ;;
2585         *) dflt="$osname" ;;
2586 esac
2587 rp="Operating system name?"
2588 . ./myread
2589 case "$ans" in
2590 none)  osname='' ;;
2591 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
2592 esac
2593 echo " "
2594 case "$osvers" in
2595         ''|' ')
2596                 case "$hintfile" in
2597                 ''|' '|none) dflt=none ;;
2598                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
2599                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
2600                         case "$dflt" in
2601                         ''|' ') dflt=none ;;
2602                         esac
2603                         ;;
2604                 esac
2605                 ;;
2606         *) dflt="$osvers" ;;
2607 esac
2608 rp="Operating system version?"
2609 . ./myread
2610 case "$ans" in
2611 none)  osvers='' ;;
2612 *) osvers="$ans" ;;
2613 esac
2614
2615
2616 . ./posthint.sh
2617
2618 : who configured the system
2619 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
2620 cf_by=`(logname) 2>/dev/null`
2621 case "$cf_by" in
2622 "")
2623         cf_by=`(whoami) 2>/dev/null`
2624         case "$cf_by" in
2625         "") cf_by=unknown ;;
2626         esac ;;
2627 esac
2628
2629 : set up the script used to warn in case of inconsistency
2630 cat <<EOS >whoa
2631 $startsh
2632 EOS
2633 cat <<'EOSC' >>whoa
2634 dflt=y
2635 echo " "
2636 echo "*** WHOA THERE!!! ***" >&4
2637 echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
2638 rp="    Keep the $hint value?"
2639 . ./myread
2640 case "$ans" in
2641 y) td=$was; tu=$was;;
2642 esac
2643 EOSC
2644
2645 : function used to set $1 to $val
2646 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
2647 case "$val$was" in
2648 $define$undef) . ./whoa; eval "$var=\$td";;
2649 $undef$define) . ./whoa; eval "$var=\$tu";;
2650 *) eval "$var=$val";;
2651 esac'
2652
2653 cat <<EOM
2654
2655 Perl can be built to take advantage of threads, on some systems.
2656 To do so, Configure must be run with -Dusethreads.
2657
2658 Note that threading is a highly experimental feature, and
2659 some known race conditions still remain.  If you choose to try
2660 it, be very sure to not actually deploy it for production
2661 purposes.  README.threads has more details, and is required
2662 reading if you enable threads.
2663 EOM
2664 case "$usethreads" in
2665 $define|true|[yY]*)     dflt='y';;
2666 *) dflt='n';;
2667 esac
2668 rp='Build a threading Perl?'
2669 . ./myread
2670 case "$ans" in
2671 y|Y)    val="$define" ;;
2672 *)      val="$undef" ;;
2673 esac
2674 set usethreads
2675 eval $setvar
2676
2677 case "$usethreads" in
2678 $define)
2679         $cat <<EOM
2680
2681 As of 5.5.64, Perl has two different internal threading implementations,
2682 the 5.005 version (5005threads) and an interpreter-based version
2683 (ithreads) that has one interpreter per thread.  Both are very 
2684 experimental.  This arrangement exists to help developers work out
2685 which one is better.
2686 EOM
2687         : Default to ithreads unless overridden on command line or with
2688         : old config.sh
2689         dflt='y'
2690         case "$use5005threads" in
2691                 $define|true|[yY]*) dflt='n';;
2692         esac
2693         case "$useithreads" in
2694                 $undef|false|[nN]*) dflt='n';;
2695         esac
2696         rp='Use interpreter-based ithreads?'
2697         . ./myread
2698         case "$ans" in
2699         y|Y)    val="$define" ;;
2700         *)      val="$undef" ;;
2701         esac
2702         set useithreads
2703         eval $setvar
2704         : Now set use5005threads to the opposite value.
2705         case "$useithreads" in
2706         $define) val="$undef" ;;
2707         *) val="$define" ;;
2708         esac
2709         set use5005threads
2710         eval $setvar
2711         ;;
2712 *)
2713         useithreads="$undef"
2714         use5005threads="$undef"
2715         ;;
2716 esac
2717
2718 case "$d_oldpthreads" in
2719 '')     : Configure tests would be welcome here.  For now, assume undef.
2720         val="$undef" ;;
2721 *)      val="$d_oldpthreads" ;;
2722 esac
2723 set d_oldpthreads
2724 eval $setvar
2725
2726
2727 case "$usethreads" in
2728 "$define"|true|[yY]*)
2729 : Look for a hint-file generated 'call-back-unit'.  If the
2730 : user has specified that a threading perl is to be built,
2731 : we may need to set or change some other defaults.
2732         if $test -f usethreads.cbu; then
2733                 echo "Your platform has some specific hints for threaded builds, using them..."
2734                 . ./usethreads.cbu
2735         else
2736                 $cat <<EOM
2737 (Your platform doesn't have any specific hints for threaded builds.
2738  Assuming POSIX threads, then.)
2739 EOM
2740         fi
2741         ;;
2742 esac
2743
2744 cat <<EOM
2745
2746 Perl can be built so that multiple Perl interpreters can coexist
2747 within the same Perl executable.  To do so, Configure must be run with
2748 -Dusemultiplicity.
2749
2750 Normally you do not need this and you should answer no.
2751
2752 EOM
2753 case "$usemultiplicity" in
2754 $define|true|[yY]*)     dflt='y';;
2755 *) dflt='n';;
2756 esac
2757 rp='Build Perl for multiplicity?'
2758 . ./myread
2759 case "$ans" in
2760 y|Y)    val="$define" ;;     
2761 *)      val="$undef" ;;
2762 esac
2763 set usemultiplicity
2764 eval $setvar 
2765
2766 : determine where manual pages are on this system
2767 echo " "
2768 case "$sysman" in
2769 '') 
2770         syspath='/usr/man/man1 /usr/man/mann /usr/man/manl /usr/man/local/man1'
2771         syspath="$syspath /usr/man/u_man/man1 /usr/share/man/man1"
2772         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
2773         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
2774         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
2775         sysman=`./loc . /usr/man/man1 $syspath`
2776         ;;
2777 esac
2778 if $test -d "$sysman"; then
2779         echo "System manual is in $sysman." >&4
2780 else
2781         echo "Could not find manual pages in source form." >&4
2782 fi
2783
2784 : see what memory models we can support
2785 case "$models" in
2786 '')
2787         $cat >pdp11.c <<'EOP'
2788 int main() {
2789 #ifdef pdp11
2790         exit(0);
2791 #else
2792         exit(1);
2793 #endif
2794 }
2795 EOP
2796         ( cc -o pdp11 pdp11.c ) >/dev/null 2>&1
2797         if $test -f pdp11 && ./pdp11 2>/dev/null; then
2798                 dflt='unsplit split'
2799         else
2800                 tans=`./loc . X /lib/small /lib/large /usr/lib/small /usr/lib/large /lib/medium /usr/lib/medium /lib/huge`
2801                 case "$tans" in
2802                 X) dflt='none';;
2803                 *) if $test -d /lib/small || $test -d /usr/lib/small; then
2804                                 dflt='small'
2805                         else
2806                                 dflt=''
2807                         fi
2808                         if $test -d /lib/medium || $test -d /usr/lib/medium; then
2809                                 dflt="$dflt medium"
2810                         fi
2811                         if $test -d /lib/large || $test -d /usr/lib/large; then
2812                                 dflt="$dflt large"
2813                         fi
2814                         if $test -d /lib/huge || $test -d /usr/lib/huge; then
2815                                 dflt="$dflt huge"
2816                         fi
2817                 esac
2818         fi;;
2819 *) dflt="$models";;
2820 esac
2821 $cat <<EOM
2822  
2823 Some systems have different model sizes.  On most systems they are called
2824 small, medium, large, and huge.  On the PDP11 they are called unsplit and
2825 split.  If your system doesn't support different memory models, say "none".
2826 If you wish to force everything to one memory model, say "none" here and
2827 put the appropriate flags later when it asks you for other cc and ld flags.
2828 Venix systems may wish to put "none" and let the compiler figure things out.
2829 (In the following question multiple model names should be space separated.)
2830
2831 The default for most systems is "none".
2832
2833 EOM
2834 rp="Which memory models are supported?"
2835 . ./myread
2836 models="$ans"
2837
2838 case "$models" in
2839 none)
2840         small=''
2841         medium=''
2842         large=''
2843         huge=''
2844         unsplit=''
2845         split=''
2846         ;;
2847 *split)
2848         case "$split" in
2849         '') if $contains '\-i' $sysman/ld.1 >/dev/null 2>&1 || \
2850                          $contains '\-i' $sysman/cc.1 >/dev/null 2>&1; then
2851                         dflt='-i'
2852                 else
2853                         dflt='none'
2854                 fi;;
2855         *) dflt="$split";;
2856         esac
2857         rp="What flag indicates separate I and D space?"
2858         . ./myread
2859         tans="$ans"
2860         case "$tans" in
2861         none) tans='';;
2862         esac
2863         split="$tans"
2864         unsplit='';;
2865 *large*|*small*|*medium*|*huge*)
2866         case "$models" in
2867         *large*)
2868                 case "$large" in
2869                 '') dflt='-Ml';;
2870                 *) dflt="$large";;
2871                 esac
2872         rp="What flag indicates large model?"
2873         . ./myread
2874         tans="$ans"
2875         case "$tans" in
2876         none) tans='';
2877         esac
2878         large="$tans";;
2879         *) large='';;
2880         esac
2881         case "$models" in
2882         *huge*) case "$huge" in
2883                 '') dflt='-Mh';;
2884                 *) dflt="$huge";;
2885                 esac
2886                 rp="What flag indicates huge model?"
2887                 . ./myread
2888                 tans="$ans"
2889                 case "$tans" in
2890                 none) tans='';
2891                 esac
2892                 huge="$tans";;
2893         *) huge="$large";;
2894         esac
2895         case "$models" in
2896         *medium*) case "$medium" in
2897                 '') dflt='-Mm';;
2898                 *) dflt="$medium";;
2899                 esac
2900                 rp="What flag indicates medium model?"
2901                 . ./myread
2902                 tans="$ans"
2903                 case "$tans" in
2904                 none) tans='';
2905                 esac
2906                 medium="$tans";;
2907         *) medium="$large";;
2908         esac
2909         case "$models" in
2910         *small*) case "$small" in
2911                 '') dflt='none';;
2912                 *) dflt="$small";;
2913                 esac
2914                 rp="What flag indicates small model?"
2915                 . ./myread
2916                 tans="$ans"
2917                 case "$tans" in
2918                 none) tans='';
2919                 esac
2920                 small="$tans";;
2921         *) small='';;
2922         esac
2923         ;;
2924 *)
2925         echo "Unrecognized memory models--you may have to edit Makefile.SH" >&4
2926         ;;
2927 esac
2928 $rm -f pdp11.* pdp11
2929
2930 : make some quick guesses about what we are up against
2931 echo " "
2932 $echo $n "Hmm...  $c"
2933 echo exit 1 >bsd
2934 echo exit 1 >usg
2935 echo exit 1 >v7
2936 echo exit 1 >osf1
2937 echo exit 1 >eunice
2938 echo exit 1 >xenix
2939 echo exit 1 >venix
2940 echo exit 1 >os2
2941 d_bsd="$undef"
2942 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
2943 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
2944 then
2945         echo "Looks kind of like an OSF/1 system, but we'll see..."
2946         echo exit 0 >osf1
2947 elif test `echo abc | tr a-z A-Z` = Abc ; then
2948         xxx=`./loc addbib blurfl $pth`
2949         if $test -f $xxx; then
2950         echo "Looks kind of like a USG system with BSD features, but we'll see..."
2951                 echo exit 0 >bsd
2952                 echo exit 0 >usg
2953         else
2954                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
2955                         echo "Looks kind of like an extended USG system, but we'll see..."
2956                 else
2957                         echo "Looks kind of like a USG system, but we'll see..."
2958                 fi
2959                 echo exit 0 >usg
2960         fi
2961 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
2962         echo "Looks kind of like a BSD system, but we'll see..."
2963         d_bsd="$define"
2964         echo exit 0 >bsd
2965 else
2966         echo "Looks kind of like a Version 7 system, but we'll see..."
2967         echo exit 0 >v7
2968 fi
2969 case "$eunicefix" in
2970 *unixtovms*)
2971         $cat <<'EOI'
2972 There is, however, a strange, musty smell in the air that reminds me of
2973 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
2974 EOI
2975         echo exit 0 >eunice
2976         d_eunice="$define"
2977 : it so happens the Eunice I know will not run shell scripts in Unix format
2978         ;;
2979 *)
2980         echo " "
2981         echo "Congratulations.  You aren't running Eunice."
2982         d_eunice="$undef"
2983         ;;
2984 esac
2985 : Detect OS2.  The p_ variable is set above in the Head.U unit.
2986 case "$p_" in
2987 :) ;;
2988 *)
2989         $cat <<'EOI'
2990 I have the feeling something is not exactly right, however...don't tell me...
2991 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
2992 EOI
2993         echo exit 0 >os2
2994         ;;
2995 esac
2996 if test -f /xenix; then
2997         echo "Actually, this looks more like a XENIX system..."
2998         echo exit 0 >xenix
2999         d_xenix="$define"
3000 else
3001         echo " "
3002         echo "It's not Xenix..."
3003         d_xenix="$undef"
3004 fi
3005 chmod +x xenix
3006 $eunicefix xenix
3007 if test -f /venix; then
3008         echo "Actually, this looks more like a VENIX system..."
3009         echo exit 0 >venix
3010 else
3011         echo " "
3012         if ./xenix; then
3013                 : null
3014         else
3015                 echo "Nor is it Venix..."
3016         fi
3017 fi
3018 chmod +x bsd usg v7 osf1 eunice xenix venix os2
3019 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
3020 $rm -f foo
3021
3022 : see if we need a special compiler
3023 echo " "
3024 if ./usg; then
3025         case "$cc" in
3026         '') case "$Mcc" in
3027                 /*) dflt='Mcc';;
3028                 *) case "$large" in
3029                         -M*) dflt='cc';;
3030                         *)      if $contains '\-M' $sysman/cc.1 >/dev/null 2>&1 ; then
3031                                         if $contains '\-M' $sysman/cpp.1 >/dev/null 2>&1; then
3032                                                 dflt='cc'
3033                                         else
3034                                                 dflt='cc -M'
3035                                         fi
3036                                 else
3037                                         dflt='cc'
3038                                 fi;;
3039                         esac;;
3040                 esac;;
3041         *)  dflt="$cc";;
3042         esac
3043         case "$dflt" in
3044         *M*)    $cat <<'EOM'
3045 On some older systems the default C compiler will not resolve multiple global
3046 references that happen to have the same name.  On some such systems the "Mcc"
3047 command may be used to force these to be resolved.  On other systems a "cc -M"
3048 command is required.  (Note that the -M flag on other systems indicates a
3049 memory model to use!) If you have the Gnu C compiler, you might wish to use
3050 that instead.
3051
3052 EOM
3053         ;;
3054         esac
3055         rp="Use which C compiler?"
3056         . ./myread
3057         cc="$ans"
3058 else
3059         case "$cc" in
3060         '') dflt=cc;;
3061         *) dflt="$cc";;
3062         esac
3063         rp="Use which C compiler?"
3064         . ./myread
3065         cc="$ans"
3066 fi
3067 : Look for a hint-file generated 'call-back-unit'.  Now that the
3068 : user has specified the compiler, we may need to set or change some
3069 : other defaults.
3070 if $test -f cc.cbu; then
3071     . ./cc.cbu
3072 fi
3073 echo " "
3074 echo "Checking for GNU cc in disguise and/or its version number..." >&4
3075 $cat >gccvers.c <<EOM
3076 #include <stdio.h>
3077 int main() {
3078 #ifdef __GNUC__
3079 #ifdef __VERSION__
3080         printf("%s\n", __VERSION__);
3081 #else
3082         printf("%s\n", "1");
3083 #endif
3084 #endif
3085         exit(0);
3086 }
3087 EOM
3088 if $cc -o gccvers gccvers.c; then
3089         gccversion=`./gccvers`
3090         case "$gccversion" in
3091         '') echo "You are not using GNU cc." ;;
3092         *)  echo "You are using GNU cc $gccversion." ;;
3093         esac
3094 else
3095         echo " "
3096         echo "*** WHOA THERE!!! ***" >&4
3097         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
3098         case "$knowitall" in
3099         '')
3100         echo "    You'd better start hunting for one and let me know about it." >&4
3101                 exit 1
3102                 ;;
3103         esac
3104 fi
3105 $rm -f gccvers*
3106 case "$gccversion" in
3107 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
3108 esac
3109
3110 : see how we invoke the C preprocessor
3111 echo " "
3112 echo "Now, how can we feed standard input to your C preprocessor..." >&4
3113 cat <<'EOT' >testcpp.c
3114 #define ABC abc
3115 #define XYZ xyz
3116 ABC.XYZ
3117 EOT
3118 cd ..
3119 if test ! -f cppstdin; then
3120         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
3121                 # AIX cc -E doesn't show the absolute headerfile
3122                 # locations but we'll cheat by using the -M flag.
3123                 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
3124         else
3125                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
3126         fi
3127 else
3128         echo "Keeping your $hint cppstdin wrapper."
3129 fi
3130 chmod 755 cppstdin
3131 wrapper=`pwd`/cppstdin
3132 ok='false'
3133 cd UU
3134
3135 if $test "X$cppstdin" != "X" && \
3136         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
3137         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3138 then
3139         echo "You used to use $cppstdin $cppminus so we'll use that again."
3140         case "$cpprun" in
3141         '') echo "But let's see if we can live without a wrapper..." ;;
3142         *)
3143                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
3144                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3145                 then
3146                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
3147                         ok='true'
3148                 else
3149                         echo "(However, $cpprun $cpplast does not work, let's see...)"
3150                 fi
3151                 ;;
3152         esac
3153 else
3154         case "$cppstdin" in
3155         '') ;;
3156         *)
3157                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
3158                 ;;
3159         esac
3160 fi
3161
3162 if $ok; then
3163         : nothing
3164 elif echo 'Maybe "'"$cc"' -E" will work...'; \
3165         $cc -E <testcpp.c >testcpp.out 2>&1; \
3166         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3167         echo "Yup, it does."
3168         x_cpp="$cc -E"
3169         x_minus='';
3170 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
3171         $cc -E - <testcpp.c >testcpp.out 2>&1; \
3172         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3173         echo "Yup, it does."
3174         x_cpp="$cc -E"
3175         x_minus='-';
3176 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
3177         $cc -P <testcpp.c >testcpp.out 2>&1; \
3178         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3179         echo "Yipee, that works!"
3180         x_cpp="$cc -P"
3181         x_minus='';
3182 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
3183         $cc -P - <testcpp.c >testcpp.out 2>&1; \
3184         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3185         echo "At long last!"
3186         x_cpp="$cc -P"
3187         x_minus='-';
3188 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
3189         $cpp <testcpp.c >testcpp.out 2>&1; \
3190         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3191         echo "It works!"
3192         x_cpp="$cpp"
3193         x_minus='';
3194 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
3195         $cpp - <testcpp.c >testcpp.out 2>&1; \
3196         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3197         echo "Hooray, it works!  I was beginning to wonder."
3198         x_cpp="$cpp"
3199         x_minus='-';
3200 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
3201         $wrapper <testcpp.c >testcpp.out 2>&1; \
3202         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3203         x_cpp="$wrapper"
3204         x_minus=''
3205         echo "Eureka!"
3206 else
3207         dflt=''
3208         rp="No dice.  I can't find a C preprocessor.  Name one:"
3209         . ./myread
3210         x_cpp="$ans"
3211         x_minus=''
3212         $x_cpp <testcpp.c >testcpp.out 2>&1
3213         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3214                 echo "OK, that will do." >&4
3215         else
3216 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
3217                 exit 1
3218         fi
3219 fi
3220
3221 case "$ok" in
3222 false)
3223         cppstdin="$x_cpp"
3224         cppminus="$x_minus"
3225         cpprun="$x_cpp"
3226         cpplast="$x_minus"
3227         set X $x_cpp
3228         shift
3229         case "$1" in
3230         "$cpp")
3231                 echo "Perhaps can we force $cc -E using a wrapper..."
3232                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
3233                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3234                 then
3235                         echo "Yup, we can."
3236                         cppstdin="$wrapper"
3237                         cppminus='';
3238                 else
3239                         echo "Nope, we'll have to live without it..."
3240                 fi
3241                 ;;
3242         esac
3243         case "$cpprun" in
3244         "$wrapper")
3245                 cpprun=''
3246                 cpplast=''
3247                 ;;
3248         esac
3249         ;;
3250 esac
3251
3252 case "$cppstdin" in
3253 "$wrapper"|'cppstdin') ;;
3254 *) $rm -f $wrapper;;
3255 esac
3256 $rm -f testcpp.c testcpp.out
3257
3258 : decide how portable to be.  Allow command line overrides.
3259 case "$d_portable" in
3260 "$undef") ;;
3261 *)      d_portable="$define" ;;
3262 esac
3263
3264 : set up shell script to do ~ expansion
3265 cat >filexp <<EOSS
3266 $startsh
3267 : expand filename
3268 case "\$1" in
3269  ~/*|~)
3270         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3271         ;;
3272  ~*)
3273         if $test -f /bin/csh; then
3274                 /bin/csh -f -c "glob \$1"
3275                 failed=\$?
3276                 echo ""
3277                 exit \$failed
3278         else
3279                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3280                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3281                 if $test ! -d "\$dir"; then
3282                         me=\`basename \$0\`
3283                         echo "\$me: can't locate home directory for: \$name" >&2
3284                         exit 1
3285                 fi
3286                 case "\$1" in
3287                 */*)
3288                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3289                         ;;
3290                 *)
3291                         echo \$dir
3292                         ;;
3293                 esac
3294         fi
3295         ;;
3296 *)
3297         echo \$1
3298         ;;
3299 esac
3300 EOSS
3301 chmod +x filexp
3302 $eunicefix filexp
3303
3304 : now set up to get a file name
3305 cat <<EOS >getfile
3306 $startsh
3307 EOS
3308 cat <<'EOSC' >>getfile
3309 tilde=''
3310 fullpath=''
3311 already=''
3312 skip=''
3313 none_ok=''
3314 exp_file=''
3315 nopath_ok=''
3316 orig_rp="$rp"
3317 orig_dflt="$dflt"
3318 case "$gfpth" in
3319 '') gfpth='.' ;;
3320 esac
3321
3322 case "$fn" in
3323 *\(*)
3324         expr $fn : '.*(\(.*\)).*' | tr ',' $trnl >getfile.ok
3325         fn=`echo $fn | sed 's/(.*)//'`
3326         ;;
3327 esac
3328
3329 case "$fn" in
3330 *:*)
3331         loc_file=`expr $fn : '.*:\(.*\)'`
3332         fn=`expr $fn : '\(.*\):.*'`
3333         ;;
3334 esac
3335
3336 case "$fn" in
3337 *~*) tilde=true;;
3338 esac
3339 case "$fn" in
3340 */*) fullpath=true;;
3341 esac
3342 case "$fn" in
3343 *+*) skip=true;;
3344 esac
3345 case "$fn" in
3346 *n*) none_ok=true;;
3347 esac
3348 case "$fn" in
3349 *e*) exp_file=true;;
3350 esac
3351 case "$fn" in
3352 *p*) nopath_ok=true;;
3353 esac
3354
3355 case "$fn" in
3356 *f*) type='File';;
3357 *d*) type='Directory';;
3358 *l*) type='Locate';;
3359 esac
3360
3361 what="$type"
3362 case "$what" in
3363 Locate) what='File';;
3364 esac
3365
3366 case "$exp_file" in
3367 '')
3368         case "$d_portable" in
3369         "$define") ;;
3370         *) exp_file=true;;
3371         esac
3372         ;;
3373 esac
3374
3375 cd ..
3376 while test "$type"; do
3377         redo=''
3378         rp="$orig_rp"
3379         dflt="$orig_dflt"
3380         case "$tilde" in
3381         true) rp="$rp (~name ok)";;
3382         esac
3383         . UU/myread
3384         if test -f UU/getfile.ok && \
3385                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3386         then
3387                 value="$ans"
3388                 ansexp="$ans"
3389                 break
3390         fi
3391         case "$ans" in
3392         none)
3393                 value=''
3394                 ansexp=''
3395                 case "$none_ok" in
3396                 true) type='';;
3397                 esac
3398                 ;;
3399         *)
3400                 case "$tilde" in
3401                 '') value="$ans"
3402                         ansexp="$ans";;
3403                 *)
3404                         value=`UU/filexp $ans`
3405                         case $? in
3406                         0)
3407                                 if test "$ans" != "$value"; then
3408                                         echo "(That expands to $value on this system.)"
3409                                 fi
3410                                 ;;
3411                         *) value="$ans";;
3412                         esac
3413                         ansexp="$value"
3414                         case "$exp_file" in
3415                         '') value="$ans";;
3416                         esac
3417                         ;;
3418                 esac
3419                 case "$fullpath" in
3420                 true)
3421                         case "$ansexp" in
3422                         /*) value="$ansexp" ;;
3423                         *)
3424                                 redo=true
3425                                 case "$already" in
3426                                 true)
3427                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
3428                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
3429                                         ;;
3430                                 *)
3431                                 echo "Please give a full path name, starting with slash." >&4
3432                                         case "$tilde" in
3433                                         true)
3434                                 echo "Note that using ~name is ok provided it expands well." >&4
3435                                                 already=true
3436                                                 ;;
3437                                         esac
3438                                 esac
3439                                 ;;
3440                         esac
3441                         ;;
3442                 esac
3443                 case "$redo" in
3444                 '')
3445                         case "$type" in
3446                         File)
3447                                 for fp in $gfpth; do
3448                                         if test "X$fp" = X.; then
3449                                             pf="$ansexp"
3450                                         else    
3451                                             pf="$fp/$ansexp"
3452                                         fi
3453                                         if test -f "$pf"; then
3454                                                 type=''
3455                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3456                                         then
3457                                                 echo "($value is not a plain file, but that's ok.)"
3458                                                 type=''
3459                                         fi
3460                                         if test X"$type" = X; then
3461                                             value="$pf"
3462                                             break
3463                                         fi
3464                                 done
3465                                 ;;
3466                         Directory)
3467                                 for fp in $gfpth; do
3468                                         if test "X$fp" = X.; then
3469                                             pf="$ansexp"
3470                                         else    
3471                                             pf="$fp/$ansexp"
3472                                         fi
3473                                         if test -d "$pf"; then
3474                                                 type=''
3475                                                 value="$pf"
3476                                                 break
3477                                         fi
3478                                 done
3479                                 ;;
3480                         Locate)
3481                                 if test -d "$ansexp"; then
3482                                         echo "(Looking for $loc_file in directory $value.)"
3483                                         value="$value/$loc_file"
3484                                         ansexp="$ansexp/$loc_file"
3485                                 fi
3486                                 if test -f "$ansexp"; then
3487                                         type=''
3488                                 fi
3489                                 case "$nopath_ok" in
3490                                 true)   case "$value" in
3491                                         */*) ;;
3492                                         *)      echo "Assuming $value will be in people's path."
3493                                                 type=''
3494                                                 ;;
3495                                         esac
3496                                         ;;
3497                                 esac
3498                                 ;;
3499                         esac
3500
3501                         case "$skip" in
3502                         true) type='';
3503                         esac
3504
3505                         case "$type" in
3506                         '') ;;
3507                         *)
3508                                 if test "$fastread" = yes; then
3509                                         dflt=y
3510                                 else
3511                                         dflt=n
3512                                 fi
3513                                 rp="$what $value doesn't exist.  Use that name anyway?"
3514                                 . UU/myread
3515                                 dflt=''
3516                                 case "$ans" in
3517                                 y*) type='';;
3518                                 *) echo " ";;
3519                                 esac
3520                                 ;;
3521                         esac
3522                         ;;
3523                 esac
3524                 ;;
3525         esac
3526 done
3527 cd UU
3528 ans="$value"
3529 rp="$orig_rp"
3530 dflt="$orig_dflt"
3531 rm -f getfile.ok
3532 test "X$gfpthkeep" != Xy && gfpth=""
3533 EOSC
3534
3535 : What should the include directory be ?
3536 echo " "
3537 $echo $n "Hmm...  $c"
3538 dflt='/usr/include'
3539 incpath=''
3540 mips_type=''
3541 if $test -f /bin/mips && /bin/mips; then
3542         echo "Looks like a MIPS system..."
3543         $cat >usr.c <<'EOCP'
3544 #ifdef SYSTYPE_BSD43
3545 /bsd43
3546 #endif
3547 EOCP
3548         if $cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
3549                 dflt='/bsd43/usr/include'
3550                 incpath='/bsd43'
3551                 mips_type='BSD 4.3'
3552         else
3553                 mips_type='System V'
3554         fi
3555         $rm -f usr.c usr.out
3556         echo "and you're compiling with the $mips_type compiler and libraries."
3557         xxx_prompt=y
3558         echo "exit 0" >mips
3559 else
3560         echo "Doesn't look like a MIPS system."
3561         xxx_prompt=n
3562         echo "exit 1" >mips
3563 fi
3564 chmod +x mips
3565 $eunicefix mips
3566 case "$usrinc" in
3567 '') ;;
3568 *) dflt="$usrinc";;
3569 esac
3570 case "$xxx_prompt" in
3571 y)      fn=d/
3572         echo " "
3573         rp='Where are the include files you want to use?'
3574         . ./getfile
3575         usrinc="$ans"
3576         ;;
3577 *)      usrinc="$dflt"
3578         ;;
3579 esac
3580
3581 : Set private lib path
3582 case "$plibpth" in
3583 '') if ./mips; then
3584                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
3585         fi;;
3586 esac
3587 case "$libpth" in
3588 ' ') dlist='';;
3589 '') dlist="$loclibpth $plibpth $glibpth";;
3590 *) dlist="$libpth";;
3591 esac
3592
3593 : Now check and see which directories actually exist, avoiding duplicates
3594 libpth=''
3595 for xxx in $dlist
3596 do
3597     if $test -d $xxx; then
3598                 case " $libpth " in
3599                 *" $xxx "*) ;;
3600                 *) libpth="$libpth $xxx";;
3601                 esac
3602     fi
3603 done
3604 $cat <<'EOM'
3605
3606 Some systems have incompatible or broken versions of libraries.  Among
3607 the directories listed in the question below, please remove any you
3608 know not to be holding relevant libraries, and add any that are needed.
3609 Say "none" for none.
3610
3611 EOM
3612 case "$libpth" in
3613 '') dflt='none';;
3614 *)
3615         set X $libpth
3616         shift
3617         dflt=${1+"$@"}
3618         ;;
3619 esac
3620 rp="Directories to use for library searches?"
3621 . ./myread
3622 case "$ans" in
3623 none) libpth=' ';;
3624 *) libpth="$ans";;
3625 esac
3626
3627 : compute shared library extension
3628 case "$so" in
3629 '')
3630         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
3631                 dflt='sl'
3632         else
3633                 dflt='so'
3634         fi
3635         ;;
3636 *) dflt="$so";;
3637 esac
3638 $cat <<EOM
3639
3640 On some systems, shared libraries may be available.  Answer 'none' if
3641 you want to suppress searching of shared libraries for the remaining
3642 of this configuration.
3643
3644 EOM
3645 rp='What is the file extension used for shared libraries?'
3646 . ./myread
3647 so="$ans"
3648
3649 : Define several unixisms.
3650 : Hints files or command line option can be used to override them.
3651 : The convoluted testing is in case hints files set either the old
3652 : or the new name.
3653 case "$_exe" in
3654 '')     case "$exe_ext" in
3655     '') ;;
3656         *)      _exe="$exe_ext" ;;
3657         esac
3658         ;;
3659 esac
3660 case "$_a" in
3661 '')     case "$lib_ext" in
3662     '') _a='.a';;
3663         *)      _a="$lib_ext" ;;
3664         esac
3665         ;;
3666 esac
3667 case "$_o" in
3668 '') case "$obj_ext" in
3669         '')     _o='.o';;
3670         *)      _o="$obj_ext";;
3671         esac
3672         ;;
3673 esac
3674 case "$p_" in
3675 '') case "$path_sep" in
3676         '')     p_=':';;
3677         *)      p_="$path_sep";;
3678         esac
3679         ;;
3680 esac
3681 exe_ext=$_exe
3682 lib_ext=$_a
3683 obj_ext=$_o
3684 path_sep=$p_
3685
3686 : Which makefile gets called first.  This is used by make depend.
3687 case "$firstmakefile" in
3688 '') firstmakefile='makefile';;
3689 esac
3690
3691 cat <<EOM
3692
3693 Perl can be built to use the SOCKS proxy protocol library.  To do so,
3694 Configure must be run with -Dusesocks.
3695
3696 Normally you do not need this and you should answer no.
3697
3698 EOM
3699 case "$usesocks" in
3700 $define|true|[yY]*)     dflt='y';;
3701 *) dflt='n';;
3702 esac
3703 rp='Build Perl for SOCKS?'
3704 . ./myread
3705 case "$ans" in
3706 y|Y)    val="$define" ;;     
3707 *)      val="$undef" ;;
3708 esac
3709 set usesocks
3710 eval $setvar
3711
3712 : Looking for optional libraries
3713 echo " "
3714 echo "Checking for optional libraries..." >&4
3715 case "$libs" in
3716 ' '|'') dflt='';;
3717 *) dflt="$libs";;
3718 esac
3719 case "$libswanted" in
3720 '') libswanted='c_s';;
3721 esac
3722 case "$usesocks" in
3723 $define)
3724         libswanted="$libswanted socks5 socks5_sh"
3725         ;;
3726 esac
3727 for thislib in $libswanted; do
3728         
3729         if xxx=`./loc lib$thislib.$so.[0-9]'*' X $libpth`;
3730                 $test -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
3731                 echo "Found -l$thislib (shared)."
3732                 case " $dflt " in
3733                 *"-l$thislib "*);;
3734                 *) dflt="$dflt -l$thislib";;
3735                 esac
3736         elif xxx=`./loc lib$thislib.$so X $libpth` ; $test -f "$xxx"; then
3737                 echo "Found -l$thislib (shared)."
3738                 case " $dflt " in
3739                 *"-l$thislib "*);;
3740                 *) dflt="$dflt -l$thislib";;
3741                 esac
3742         elif xxx=`./loc lib$thislib$_a X $libpth`; $test -f "$xxx"; then
3743                 echo "Found -l$thislib."
3744                 case " $dflt " in
3745                 *"-l$thislib "*);;
3746                 *) dflt="$dflt -l$thislib";;
3747                 esac
3748         elif xxx=`./loc $thislib$_a X $libpth`; $test -f "$xxx"; then
3749                 echo "Found -l$thislib."
3750                 case " $dflt " in
3751                 *"-l$thislib "*);;
3752                 *) dflt="$dflt -l$thislib";;
3753                 esac
3754         elif xxx=`./loc lib${thislib}_s$_a X $libpth`; $test -f "$xxx"; then
3755                 echo "Found -l${thislib}_s."
3756                 case " $dflt " in
3757                 *"-l$thislib "*);;
3758                 *) dflt="$dflt -l${thislib}_s";;
3759                 esac
3760         elif xxx=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$xxx"; then
3761                 echo "Found -l$thislib."
3762                 case " $dflt " in
3763                 *"-l$thislib "*);;
3764                 *) dflt="$dflt -l$thislib";;
3765                 esac
3766         else
3767                 echo "No -l$thislib."
3768         fi
3769 done
3770 set X $dflt
3771 shift
3772 dflt="$*"
3773 case "$libs" in
3774 '') dflt="$dflt";;
3775 *) dflt="$libs";;
3776 esac
3777 case "$dflt" in
3778 ' '|'') dflt='none';;
3779 esac
3780
3781 $cat <<EOM
3782
3783 In order to compile $package on your machine, a number of libraries
3784 are usually needed.  Include any other special libraries here as well.
3785 Say "none" for none.  The default list is almost always right.
3786 EOM
3787
3788 echo " "
3789 rp="What libraries to use?"
3790 . ./myread
3791 case "$ans" in
3792 none) libs=' ';;
3793 *) libs="$ans";;
3794 esac
3795
3796 : determine optimization, if desired, or use for debug flag also
3797 case "$optimize" in
3798 ' '|$undef) dflt='none';;
3799 '') dflt='-O';;
3800 *) dflt="$optimize";;
3801 esac
3802 $cat <<EOH
3803
3804 By default, $package compiles with the -O flag to use the optimizer.
3805 Alternately, you might want to use the symbolic debugger, which uses
3806 the -g flag (on traditional Unix systems).  Either flag can be
3807 specified here.  To use neither flag, specify the word "none".
3808
3809 EOH
3810 rp="What optimizer/debugger flag should be used?"
3811 . ./myread
3812 optimize="$ans"
3813 case "$optimize" in
3814 'none') optimize=" ";;
3815 esac
3816
3817 dflt=''
3818 : We will not override a previous value, but we might want to
3819 : augment a hint file
3820 case "$hint" in
3821 default|recommended)
3822         case "$gccversion" in
3823         1*) dflt='-fpcc-struct-return' ;;
3824         esac
3825         case "$optimize" in
3826         *-g*) dflt="$dflt -DDEBUGGING";;
3827         esac
3828         case "$gccversion" in
3829         2*) if test -d /etc/conf/kconfig.d &&
3830                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
3831                 then
3832                         dflt="$dflt -posix"
3833                 fi
3834                 ;;
3835         esac
3836         case "$gccversion" in
3837         1*) ;;
3838         2.[0-8]*) ;;
3839         ?*)     echo " "
3840                 echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
3841                 echo 'int main(void) { return 0; }' > gcctest.c
3842                 if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
3843                         echo "Yes, it does." 2>&1
3844                         case "$ccflags" in
3845                         *strict-aliasing*) 
3846                                 echo "Leaving current flags $ccflags alone." 2>&1
3847                                 ;;
3848                         *) dflt="$dflt -fno-strict-aliasing" ;;
3849                         esac
3850                 else
3851                         echo "Nope, it doesn't, but that's ok." 2>&1
3852                 fi
3853                 ;;
3854         esac
3855         ;;
3856 esac
3857
3858 case "$mips_type" in
3859 *BSD*|'') inclwanted="$locincpth $usrinc";;
3860 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
3861 esac
3862 for thisincl in $inclwanted; do
3863         if $test -d $thisincl; then
3864                 if $test x$thisincl != x$usrinc; then
3865                         case "$dflt" in
3866                         *$thisincl*);;
3867                         *) dflt="$dflt -I$thisincl";;
3868                         esac
3869                 fi
3870         fi
3871 done
3872
3873 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
3874         xxx=true;
3875 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
3876         xxx=true;
3877 else
3878         xxx=false;
3879 fi;
3880 if $xxx; then
3881         case "$dflt" in
3882         *$2*);;
3883         *) dflt="$dflt -D$2";;
3884         esac;
3885 fi'
3886
3887 set signal.h LANGUAGE_C; eval $inctest
3888
3889 case "$usesocks" in
3890 $define)
3891         ccflags="$ccflags -DSOCKS"
3892         ;;
3893 esac
3894
3895 case "$hint" in
3896 default|recommended) dflt="$ccflags $dflt" ;;
3897 *) dflt="$ccflags";;
3898 esac
3899
3900 case "$dflt" in
3901 ''|' ') dflt=none;;
3902 esac
3903 $cat <<EOH
3904
3905 Your C compiler may want other flags.  For this question you should include
3906 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
3907 but you should NOT include libraries or ld flags like -lwhatever.  If you
3908 want $package to honor its debug switch, you should include -DDEBUGGING here.
3909 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
3910
3911 To use no flags, specify the word "none".
3912
3913 EOH
3914 set X $dflt
3915 shift
3916 dflt=${1+"$@"}
3917 rp="Any additional cc flags?"
3918 . ./myread
3919 case "$ans" in
3920 none) ccflags='';;
3921 *) ccflags="$ans";;
3922 esac
3923
3924 : the following weeds options from ccflags that are of no interest to cpp
3925 cppflags="$ccflags"
3926 case "$gccversion" in
3927 1*) cppflags="$cppflags -D__GNUC__"
3928 esac
3929 case "$mips_type" in
3930 '');;
3931 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
3932 esac
3933 case "$cppflags" in
3934 '');;
3935 *)
3936         echo " "
3937         echo "Let me guess what the preprocessor flags are..." >&4
3938         set X $cppflags
3939         shift
3940         cppflags=''
3941         $cat >cpp.c <<'EOM'
3942 #define BLURFL foo
3943
3944 BLURFL xx LFRULB
3945 EOM
3946         previous=''
3947         for flag in $*
3948         do
3949                 case "$flag" in
3950                 -*) ftry="$flag";;
3951                 *) ftry="$previous $flag";;
3952                 esac
3953                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
3954                         >cpp1.out 2>/dev/null && \
3955                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
3956                         >cpp2.out 2>/dev/null && \
3957                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
3958                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
3959                 then
3960                         cppflags="$cppflags $ftry"
3961                         previous=''
3962                 else
3963                         previous="$flag"
3964                 fi
3965         done
3966         set X $cppflags
3967         shift
3968         cppflags=${1+"$@"}
3969         case "$cppflags" in
3970         *-*)  echo "They appear to be: $cppflags";;
3971         esac
3972         $rm -f cpp.c cpp?.out
3973         ;;
3974 esac
3975
3976 : flags used in final linking phase
3977 case "$ldflags" in
3978 '') if ./venix; then
3979                 dflt='-i -z'
3980         else
3981                 dflt=''
3982         fi
3983         case "$ccflags" in
3984         *-posix*) dflt="$dflt -posix" ;;
3985         esac
3986         ;;
3987 *) dflt="$ldflags";;
3988 esac
3989
3990 : Try to guess additional flags to pick up local libraries.
3991 for thislibdir in $libpth; do
3992         case " $loclibpth " in
3993         *" $thislibdir "*)
3994                 case "$dflt " in 
3995                 *"-L$thislibdir "*) ;;
3996                 *)  dflt="$dflt -L$thislibdir" ;;
3997                 esac
3998                 ;;
3999         esac
4000 done
4001
4002 case "$dflt" in
4003 '') dflt='none' ;;
4004 esac
4005
4006 $cat <<EOH
4007
4008 Your C linker may need flags.  For this question you should
4009 include -L/whatever and any other flags used by the C linker, but you
4010 should NOT include libraries like -lwhatever.
4011
4012 Make sure you include the appropriate -L/path flags if your C linker
4013 does not normally search all of the directories you specified above,
4014 namely
4015         $libpth
4016 To use no flags, specify the word "none".
4017
4018 EOH
4019
4020 rp="Any additional ld flags (NOT including libraries)?"
4021 . ./myread
4022 case "$ans" in
4023 none) ldflags='';;
4024 *) ldflags="$ans";;
4025 esac
4026 rmlist="$rmlist pdp11"
4027
4028 : coherency check
4029 echo " "
4030 echo "Checking your choice of C compiler and flags for coherency..." >&4
4031 $cat > try.c <<'EOF'
4032 #include <stdio.h>
4033 int main() { printf("Ok\n"); exit(0); }
4034 EOF
4035 set X $cc $optimize $ccflags -o try $ldflags try.c $libs
4036 shift
4037 $cat >try.msg <<'EOM'
4038 I've tried to compile and run the following simple program:
4039
4040 EOM
4041 $cat try.c >> try.msg
4042
4043 $cat >> try.msg <<EOM
4044
4045 I used the command:
4046
4047         $*
4048         ./try
4049
4050 and I got the following output:
4051
4052 EOM
4053 dflt=y
4054 if sh -c "$cc $optimize $ccflags -o try $ldflags try.c $libs" >>try.msg 2>&1; then
4055         if sh -c './try' >>try.msg 2>&1; then
4056                 xxx=`./try`
4057                 case "$xxx" in
4058                 "Ok") dflt=n ;;
4059                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
4060                         case " $libs " in
4061                         *" -lsfio "*)
4062                                 cat >> try.msg <<'EOQS'
4063 If $libs contains -lsfio, and sfio is mis-configured, then it
4064 sometimes (apparently) runs and exits with a 0 status, but with no
4065 output!  It may have to do with sfio's use of _exit vs. exit.
4066
4067 EOQS
4068                                 rp="You have a big problem.  Shall I abort Configure"
4069                                 dflt=y
4070                                 ;;
4071                         esac
4072                         ;;
4073                 esac
4074         else
4075                 echo "The program compiled OK, but exited with status $?." >>try.msg
4076                 rp="You have a problem.  Shall I abort Configure"
4077                 dflt=y
4078         fi
4079 else
4080         echo "I can't compile the test program." >>try.msg
4081         rp="You have a BIG problem.  Shall I abort Configure"
4082         dflt=y
4083 fi
4084 case "$dflt" in
4085 y)
4086         $cat try.msg >&4
4087         case "$knowitall" in
4088         '')
4089                 echo "(The supplied flags or libraries might be incorrect.)"
4090                 ;;
4091         *) dflt=n;;
4092         esac
4093         echo " "
4094         . ./myread
4095         case "$ans" in
4096         n*|N*) ;;
4097         *)      echo "Ok.  Stopping Configure." >&4
4098                 exit 1
4099                 ;;
4100         esac
4101         ;;
4102 n) echo "OK, that should do.";;
4103 esac
4104 $rm -f try try.* core
4105
4106 : define an is-a-typedef? function
4107 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
4108 case "$inclist" in
4109 "") inclist="sys/types.h";;
4110 esac;
4111 eval "varval=\$$var";
4112 case "$varval" in
4113 "")
4114         $rm -f temp.c;
4115         for inc in $inclist; do
4116                 echo "#include <$inc>" >>temp.c;
4117         done;
4118         echo "#ifdef $type" >> temp.c;
4119         echo "printf(\"We have $type\");" >> temp.c;
4120         echo "#endif" >> temp.c;
4121         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
4122         if $contains $type temp.E >/dev/null 2>&1; then
4123                 eval "$var=\$type";
4124         else
4125                 eval "$var=\$def";
4126         fi;
4127         $rm -f temp.?;;
4128 *) eval "$var=\$varval";;
4129 esac'
4130
4131 : define an is-a-typedef? function that prompts if the type is not available.
4132 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
4133 case "$inclist" in
4134 "") inclist="sys/types.h";;
4135 esac;
4136 eval "varval=\$$var";
4137 case "$varval" in
4138 "")
4139         $rm -f temp.c;
4140         for inc in $inclist; do
4141                 echo "#include <$inc>" >>temp.c;
4142         done;
4143         echo "#ifdef $type" >> temp.c;
4144         echo "printf(\"We have $type\");" >> temp.c;
4145         echo "#endif" >> temp.c;
4146         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
4147         echo " " ;
4148         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
4149         if $contains $type temp.E >/dev/null 2>&1; then
4150                 echo "$type found." >&4;
4151                 eval "$var=\$type";
4152         else
4153                 echo "$type NOT found." >&4;
4154                 dflt="$def";
4155                 . ./myread ;
4156                 eval "$var=\$ans";
4157         fi;
4158         $rm -f temp.?;;
4159 *) eval "$var=\$varval";;
4160 esac'
4161
4162 : define a shorthand compile call
4163 compile='
4164 mc_file=$1;
4165 shift;
4166 $cc $optimize $ccflags $ldflags -o ${mc_file} $* ${mc_file}.c $libs > /dev/null 2>&1;'
4167 : define a shorthand compile call for compilations that should be ok.
4168 compile_ok='
4169 mc_file=$1;
4170 shift;
4171 $cc $optimize $ccflags $ldflags -o ${mc_file} $* ${mc_file}.c $libs;'
4172
4173 : check for lengths of integral types
4174 echo " "
4175 case "$intsize" in
4176 '')
4177         echo "Checking to see how big your integers are..." >&4
4178         $cat >intsize.c <<'EOCP'
4179 #include <stdio.h>
4180 int main()
4181 {
4182         printf("intsize=%d;\n", (int)sizeof(int));
4183         printf("longsize=%d;\n", (int)sizeof(long));
4184         printf("shortsize=%d;\n", (int)sizeof(short));
4185         exit(0);
4186 }
4187 EOCP
4188         set intsize
4189         if eval $compile_ok && ./intsize > /dev/null; then
4190                 eval `./intsize`
4191                 echo "Your integers are $intsize bytes long."
4192                 echo "Your long integers are $longsize bytes long."
4193                 echo "Your short integers are $shortsize bytes long."
4194         else
4195                 $cat >&4 <<EOM
4196 !
4197 Help! I can't compile and run the intsize test program: please enlighten me!
4198 (This is probably a misconfiguration in your system or libraries, and
4199 you really ought to fix it.  Still, I'll try anyway.)
4200 !
4201 EOM
4202                 dflt=4
4203                 rp="What is the size of an integer (in bytes)?"
4204                 . ./myread
4205                 intsize="$ans"
4206                 dflt=$intsize
4207                 rp="What is the size of a long integer (in bytes)?"
4208                 . ./myread
4209                 longsize="$ans"
4210                 dflt=2
4211                 rp="What is the size of a short integer (in bytes)?"
4212                 . ./myread
4213                 shortsize="$ans"
4214         fi
4215         ;;
4216 esac
4217 $rm -f intsize intsize.*
4218
4219 : see what type lseek is declared as in the kernel
4220 rp="What is the type used for lseek's offset on this system?"
4221 set off_t lseektype long stdio.h sys/types.h
4222 eval $typedef_ask
4223
4224 echo " "
4225 $echo $n "Checking to see how big your file offsets are...$c" >&4
4226 $cat >try.c <<EOCP
4227 #include <sys/types.h>
4228 #include <stdio.h>
4229 int main()
4230 {
4231     printf("%d\n", (int)sizeof($lseektype));
4232     return(0); 
4233 }
4234 EOCP
4235 set try
4236 if eval $compile_ok; then
4237         lseeksize=`./try`
4238         $echo " $lseeksize bytes." >&4
4239 else
4240         dflt=$longsize
4241         echo " "
4242         echo "(I can't seem to compile the test program.  Guessing...)"
4243         rp="What is the size of your file offsets (in bytes)?"
4244         . ./myread
4245         lseeksize="$ans"
4246 fi
4247 $rm -f try.c try
4248
4249 : see what type file positions are declared as in the library
4250 rp="What is the type for file position used by fsetpos()?"
4251 set fpos_t fpostype long stdio.h sys/types.h
4252 eval $typedef_ask
4253
4254 echo " "
4255 case "$fpostype" in
4256 *_t) zzz="$fpostype"    ;;
4257 *)   zzz="fpos_t"       ;;
4258 esac
4259 $echo $n "Checking the size of $zzz...$c" >&4 
4260 cat > try.c <<EOCP
4261 #include <sys/types.h>
4262 #include <stdio.h>
4263 int main() {
4264     printf("%d\n", (int)sizeof($fpostype));
4265     exit(0);
4266 }
4267 EOCP
4268 set try
4269 if eval $compile_ok; then
4270         yyy=`./try`
4271         case "$yyy" in
4272         '')     fpossize=4
4273                 echo " "
4274                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
4275                 ;;
4276         *)      fpossize=$yyy
4277                 echo " $fpossize bytes."
4278                 ;;
4279         esac
4280 else
4281         dflt="$longsize"
4282         echo " "
4283         echo "(I can't compile the test program.  Guessing...)" >&4
4284         rp="What is the size of your file positions (in bytes)?"
4285         . ./myread
4286         fpossize="$ans"
4287 fi
4288
4289
4290
4291 case "$lseeksize:$fpossize" in
4292 8:8) cat <<EOM
4293
4294 You can have files larger than 2 gigabytes.
4295 EOM
4296    val="$define" ;;
4297 *) cat <<EOM
4298
4299 Perl can be built to understand large files (files larger than 2 gigabytes)
4300 on some systems.  To do so, Configure must be run with -Duselargefiles.
4301
4302 If this doesn't make any sense to you, just accept the default 'y'.
4303 EOM
4304    case "$uselargefiles" in
4305    "$undef"|false|[nN]*) dflt='n' ;;
4306    *)   dflt='y' ;;
4307    esac
4308    rp='Try to understand large files, if available?'
4309    . ./myread
4310    case "$ans" in
4311    y|Y)         val="$define" ;;
4312    *)           val="$undef"  ;;
4313    esac
4314    ;;
4315 esac
4316 set uselargefiles
4317 eval $setvar
4318 case "$uselargefiles" in
4319 "$define")
4320 : Look for a hint-file generated 'call-back-unit'.  If the
4321 : user has specified that a large files perl is to be built,
4322 : we may need to set or change some other defaults.
4323         if $test -f uselfs.cbu; then
4324                 echo "Your platform has some specific hints for large file builds, using them..."
4325                 . ./uselfs.cbu
4326                 echo " "
4327                 $echo $n "Rechecking to see how big your file offsets are...$c" >&4
4328                 $cat >try.c <<EOCP
4329 #include <sys/types.h>
4330 #include <stdio.h>
4331 int main()
4332 {
4333     printf("%d\n", (int)sizeof($lseektype));
4334     return(0); 
4335 }
4336 EOCP
4337                 set try
4338                 if eval $compile_ok; then
4339                         lseeksize=`./try`
4340                         $echo " $lseeksize bytes." >&4
4341                 else
4342                         dflt="$lseeksize"
4343                         echo " "
4344                         echo "(I can't seem to compile the test program.  Guessing...)"
4345                         rp="What is the size of your file offsets (in bytes)?"
4346                         . ./myread
4347                         lseeksize="$ans"
4348                 fi
4349                 case "$fpostype" in
4350                 *_t) zzz="$fpostype"    ;;
4351                 *)   zzz="fpos_t"       ;;
4352                 esac
4353                 $echo $n "Rechecking the size of $zzz...$c" >&4 
4354                 $cat > try.c <<EOCP
4355 #include <sys/types.h>
4356 #include <stdio.h>
4357 int main() {
4358     printf("%d\n", (int)sizeof($fpostype));
4359     exit(0);
4360 }
4361 EOCP
4362                 set try
4363                 if eval $compile_ok; then
4364                         yyy=`./try`
4365                         dflt="$lseeksize"
4366                         case "$yyy" in
4367                         '')     echo " "
4368                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
4369                                 ;;
4370                         *)      fpossize=$yyy
4371                                 echo " $fpossize bytes."
4372                                 ;;
4373                         esac
4374                 else
4375                         dflt="$fpossize"
4376                         echo " "
4377                         echo "(I can't compile the test program.  Guessing...)" >&4
4378                         rp="What is the size of your file positions (in bytes)?"
4379                         . ./myread
4380                         fpossize="$ans"
4381                 fi
4382                 $rm -f try.c try
4383         fi
4384         ;;
4385 esac
4386
4387
4388 case "$usemorebits" in
4389 "$define"|true|[yY]*)
4390         use64bits="$define"
4391         uselongdouble="$define"
4392         usemorebits="$define"
4393         ;;
4394 *)      usemorebits="$undef"
4395         ;;
4396 esac
4397
4398
4399 case "$intsize:$longsize" in
4400 8:*|*:8) cat <<EOM
4401
4402 You have natively 64-bit integers.
4403 EOM
4404    val="$define" ;;
4405 *) cat <<EOM
4406
4407 Perl can be built to take advantage of 64-bit integer types
4408 on some systems.  To do so, Configure must be run with -Duse64bits.
4409
4410 If this doesn't make any sense to you, just accept the default.
4411 EOM
4412   case "$use64bits" in
4413   $define|true|[yY]*)   dflt='y';;
4414   *) dflt='n';;
4415   esac
4416   rp='Try to use 64-bit integers, if available?'
4417   . ./myread
4418   case "$ans" in
4419   y|Y) val="$define" ;;
4420   *)   val="$undef"  ;;
4421   esac
4422   ;;
4423 esac
4424 set use64bits
4425 eval $setvar
4426
4427 case "$archname64" in
4428 '') archname64='' ;;    # not a typo
4429 esac
4430
4431 case "$use64bits" in
4432 "$define"|true|[yY]*)
4433 : Look for a hint-file generated 'call-back-unit'.  If the
4434 : user has specified that a 64-bit perl is to be built,
4435 : we may need to set or change some other defaults.
4436         if $test -f use64bits.cbu; then
4437                 echo "Your platform has some specific hints for 64-bit builds, using them..."
4438                 . ./use64bits.cbu
4439         else
4440                 $cat <<EOM
4441 (Your platform doesn't have any specific hints for 64-bit builds.)
4442 EOM
4443                 case "$intsize:$longsize" in
4444 8:*|*:8) cat <<EOM
4445 (This is probably okay, as your system is a natively 64-bit system.)
4446 EOM
4447                   ;;
4448                 esac
4449                 case "$gccversion" in
4450                 '')     ;;
4451                 *)      case "$ccflags" in
4452                         *-DUSE_LONG_LONG*) ;;
4453                         *) $cat <<EOM
4454 But since you seem to be using gcc, I will now add -DUSE_LONG_LONG
4455 to the compilation flags.
4456 EOM
4457                            ccflags="$ccflags -DUSE_LONG_LONG"
4458                            ;;
4459                         esac
4460                         ;;
4461                 esac
4462         fi
4463         ;;
4464 esac
4465
4466 : determine the architecture name
4467 echo " "
4468 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
4469         tarch=`arch`"-$osname"
4470 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
4471         if uname -m > tmparch 2>&1 ; then
4472                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
4473                         -e 's/$/'"-$osname/" tmparch`
4474         else
4475                 tarch="$osname"
4476         fi
4477         $rm -f tmparch
4478 else
4479         tarch="$osname"
4480 fi
4481 case "$myarchname" in
4482 ''|"$tarch") ;;
4483 *)
4484         echo "(Your architecture name used to be $myarchname.)"
4485         archname=''
4486         ;;
4487 esac
4488 myarchname="$tarch"
4489 case "$archname" in
4490 '') dflt="$tarch";;
4491 *) dflt="$archname";;
4492 esac
4493 rp='What is your architecture name'
4494 . ./myread
4495 archname="$ans"
4496 case "$usethreads" in
4497 $define)
4498         echo "Threads selected." >&4
4499         case "$archname" in
4500         *-thread*) echo "...and architecture name already has -thread." >&4
4501                 ;;
4502         *)      archname="$archname-thread"
4503                 echo "...setting architecture name to $archname." >&4
4504                 ;;
4505         esac
4506         ;;
4507 esac
4508 case "$usemultiplicity" in
4509 $define)
4510         echo "Multiplicity selected." >&4
4511         case "$archname" in
4512         *-multi*) echo "...and architecture name already has -multi." >&4
4513                 ;;
4514         *)      archname="$archname-multi"
4515                 echo "...setting architecture name to $archname." >&4
4516                 ;;
4517         esac
4518         ;;
4519 esac
4520 case "$use64bits" in
4521 $define)
4522         case "$archname64" in
4523         '')
4524                 ;;
4525         *)
4526                 case "$archname" in
4527                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
4528                         ;;
4529                 *)      archname="$archname-$archname64"
4530                         echo "...setting architecture name to $archname." >&4
4531                         ;;
4532                 esac
4533                 ;;
4534         esac
4535 esac
4536
4537 : determine root of directory hierarchy where package will be installed.
4538 case "$prefix" in
4539 '')
4540         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
4541         ;;
4542 *)
4543         dflt="$prefix"
4544         ;;
4545 esac
4546 $cat <<EOM
4547
4548 By default, $package will be installed in $dflt/bin, manual pages
4549 under $dflt/man, etc..., i.e. with $dflt as prefix for all
4550 installation directories. Typically this is something like /usr/local.
4551 If you wish to have binaries under /usr/bin but other parts of the
4552 installation under /usr/local, that's ok: you will be prompted
4553 separately for each of the installation directories, the prefix being
4554 only used to set the defaults.
4555
4556 EOM
4557 fn=d~
4558 rp='Installation prefix to use?'
4559 . ./getfile
4560 oldprefix=''
4561 case "$prefix" in
4562 '') ;;
4563 *)
4564         case "$ans" in
4565         "$prefix") ;;
4566         *) oldprefix="$prefix";;
4567         esac
4568         ;;
4569 esac
4570 prefix="$ans"
4571 prefixexp="$ansexp"
4572
4573 : is AFS running?
4574 echo " "
4575 case "$afs" in
4576 $define|true)   afs=true ;;
4577 $undef|false)   afs=false ;;
4578 *)      if test -d /afs; then
4579                 afs=true
4580         else
4581                 afs=false
4582         fi
4583         ;;
4584 esac
4585 if $afs; then
4586         echo "AFS may be running... I'll be extra cautious then..." >&4
4587 else
4588         echo "AFS does not seem to be running..." >&4
4589 fi
4590
4591 : determine installation prefix for where package is to be installed.
4592 if $afs; then 
4593 $cat <<EOM
4594
4595 Since you are running AFS, I need to distinguish the directory in which
4596 files will reside from the directory in which they are installed (and from
4597 which they are presumably copied to the former directory by occult means).
4598
4599 EOM
4600         case "$installprefix" in
4601         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
4602         *) dflt="$installprefix";;
4603         esac
4604 else
4605 $cat <<EOM
4606
4607 In some special cases, particularly when building $package for distribution,
4608 it is convenient to distinguish between the directory in which files should 
4609 be installed from the directory ($prefix) in which they 
4610 will eventually reside.  For most users, these two directories are the same.
4611
4612 EOM
4613         case "$installprefix" in
4614         '') dflt=$prefix ;;
4615         *) dflt=$installprefix;;
4616         esac
4617 fi
4618 fn=d~
4619 rp='What installation prefix should I use for installing files?'
4620 . ./getfile
4621 installprefix="$ans"
4622 installprefixexp="$ansexp"
4623
4624 : set the prefixit variable, to compute a suitable default value
4625 prefixit='case "$3" in
4626 ""|none)
4627         case "$oldprefix" in
4628         "") eval "$1=\"\$$2\"";;
4629         *)
4630                 case "$3" in
4631                 "") eval "$1=";;
4632                 none)
4633                         eval "tp=\"\$$2\"";
4634                         case "$tp" in
4635                         ""|" ") eval "$1=\"\$$2\"";;
4636                         *) eval "$1=";;
4637                         esac;;
4638                 esac;;
4639         esac;;
4640 *)
4641         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
4642         case "$tp" in
4643         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
4644         /*-$oldprefix/*|\~*-$oldprefix/*)
4645                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
4646         *) eval "$1=\"\$$2\"";;
4647         esac;;
4648 esac'
4649
4650 : set the base revision
4651 baserev=5.0
4652
4653 : get the patchlevel
4654 echo " "
4655 echo "Getting the current patchlevel..." >&4
4656 if $test -r $rsrc/patchlevel.h;then
4657         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
4658         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4659         apiversion=`awk '/define[       ]+PERL_APIVERSION/ {print $3}' $rsrc/patchlevel.h`
4660 else
4661         patchlevel=0
4662         subversion=0
4663         apiversion=0
4664 fi
4665 $echo $n "(You have $package" $c
4666 case "$package" in
4667 "*$baserev")    ;;
4668 *)              $echo $n " $baserev" $c ;;
4669 esac
4670 $echo $n " patchlevel $patchlevel" $c
4671 test 0 -eq "$subversion" || $echo $n " subversion $subversion" $c
4672 echo ".)"
4673
4674 version=`LC_ALL=C; export LC_ALL; \
4675          echo $baserev $patchlevel $subversion | \
4676          $awk '{ printf "%.6f\n", $1 + $2/1000.0 + $3/1000000.0 }' | \
4677          sed -e 's/0*$//'`
4678
4679 : determine installation style
4680 : For now, try to deduce it from prefix unless it is already set.
4681 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
4682 case "$installstyle" in
4683 '')     case "$prefix" in
4684                 *perl*) dflt='lib';;
4685                 *) dflt='lib/perl5' ;;
4686         esac
4687         ;;
4688 *)      dflt='lib/perl5' ;;
4689 esac
4690 : Probably not worth prompting for this since we prompt for all
4691 : the directories individually, and the prompt would be too long and
4692 : confusing anyway.
4693 installstyle=$dflt
4694
4695 : determine where private library files go
4696 : Usual default is /usr/local/lib/perl5/$version.
4697 : Also allow things like /opt/perl/lib/$version, since 
4698 : /opt/perl/lib/perl5... would be redundant.
4699 : The default "style" setting is made in installstyle.U
4700 case "$installstyle" in
4701 *lib/perl5*) set dflt privlib lib/$package/$version ;;
4702 *)       set dflt privlib lib/$version ;;
4703 esac
4704 eval $prefixit
4705 $cat <<EOM
4706
4707 There are some auxiliary files for $package that need to be put into a
4708 private library directory that is accessible by everyone.
4709
4710 EOM
4711 fn=d~+
4712 rp='Pathname where the private library files will reside?'
4713 . ./getfile
4714 privlib="$ans"
4715 privlibexp="$ansexp"
4716 : Change installation prefix, if necessary.
4717 if $test X"$prefix" != X"$installprefix"; then
4718         installprivlib=`echo $privlibexp | sed "s#^$prefix#$installprefix#"`
4719 else
4720         installprivlib="$privlibexp"
4721 fi
4722
4723 : set the prefixup variable, to restore leading tilda escape
4724 prefixup='case "$prefixexp" in
4725 "$prefix") ;;
4726 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
4727 esac'
4728
4729 : determine where public architecture dependent libraries go
4730 set archlib archlib
4731 eval $prefixit
4732 : privlib default is /usr/local/lib/$package/$version
4733 : archlib default is /usr/local/lib/$package/$version/$archname
4734 : privlib may have an optional trailing /share.
4735 tdflt=`echo $privlib | $sed 's,/share$,,'`
4736 tdflt=$tdflt/$archname
4737 case "$archlib" in
4738 '')     dflt=$tdflt
4739         ;;
4740 *)      dflt="$archlib"
4741     ;;
4742 esac
4743 $cat <<EOM
4744
4745 $spackage contains architecture-dependent library files.  If you are
4746 sharing libraries in a heterogeneous environment, you might store
4747 these files in a separate location.  Otherwise, you can just include
4748 them with the rest of the public library files.
4749
4750 EOM
4751 fn=d+~
4752 rp='Where do you want to put the public architecture-dependent libraries?'
4753 . ./getfile
4754 archlib="$ans"
4755 archlibexp="$ansexp"
4756 if $test X"$archlib" = X"$privlib"; then
4757         d_archlib="$undef"
4758 else
4759         d_archlib="$define"
4760 fi
4761 : Change installation prefix, if necessary.
4762 if $test X"$prefix" != X"$installprefix"; then
4763         installarchlib=`echo $archlibexp | sed "s#^$prefix#$installprefix#"`
4764 else
4765         installarchlib="$archlibexp"
4766 fi
4767
4768
4769 : Binary compatibility with 5.005 is not possible for builds
4770 : with advanced features
4771 case "$usethreads$usemultiplicity" in
4772 *define*)
4773         bincompat5005="$undef"
4774         d_bincompat5005="$undef"
4775         ;;
4776 *)      $cat <<EOM
4777
4778 Perl 5.006 can be compiled for binary compatibility with 5.005.
4779 If you decide to do so, you will be able to continue using most
4780 of the extensions that were compiled for Perl 5.005.
4781
4782 EOM
4783         case "$bincompat5005$d_bincompat5005" in
4784         *"$undef"*) dflt=n ;;
4785         *) dflt=y ;;
4786         esac
4787         rp='Binary compatibility with Perl 5.005?'
4788         . ./myread
4789         case "$ans" in
4790         y*) val="$define" ;;
4791         *)  val="$undef" ;;
4792         esac
4793         set d_bincompat5005
4794         eval $setvar
4795         case "$d_bincompat5005" in
4796         "$define")
4797                 bincompat5005="$define"
4798                 ;;
4799         *)      bincompat5005="$undef"
4800                 d_bincompat5005="$undef"
4801                 ;;
4802         esac
4803         ;;
4804 esac
4805
4806
4807 : see if setuid scripts can be secure
4808 $cat <<EOM
4809
4810 Some kernels have a bug that prevents setuid #! scripts from being
4811 secure.  Some sites have disabled setuid #! scripts because of this.
4812
4813 First let's decide if your kernel supports secure setuid #! scripts.
4814 (If setuid #! scripts would be secure but have been disabled anyway,
4815 don't say that they are secure if asked.)
4816
4817 EOM
4818
4819 val="$undef"
4820 if $test -d /dev/fd; then
4821         echo "#!$ls" >reflect
4822         chmod +x,u+s reflect
4823         ./reflect >flect 2>&1
4824         if $contains "/dev/fd" flect >/dev/null; then
4825                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
4826                 val="$define"
4827         else
4828                 $cat <<EOM
4829 If you are not sure if they are secure, I can check but I'll need a
4830 username and password different from the one you are using right now.
4831 If you don't have such a username or don't want me to test, simply
4832 enter 'none'.
4833
4834 EOM
4835                 rp='Other username to test security of setuid scripts with?'
4836                 dflt='none'
4837                 . ./myread
4838                 case "$ans" in
4839                 n|none)
4840                         case "$d_suidsafe" in
4841                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
4842                                 dflt=n;;
4843                         "$undef")
4844                                 echo "Well, the $hint value is *not* secure." >&4
4845                                 dflt=n;;
4846                         *)      echo "Well, the $hint value *is* secure." >&4
4847                                 dflt=y;;
4848                         esac
4849                         ;;
4850                 *)
4851                         $rm -f reflect flect
4852                         echo "#!$ls" >reflect
4853                         chmod +x,u+s reflect
4854                         echo >flect
4855                         chmod a+w flect
4856                         echo '"su" will (probably) prompt you for '"$ans's password."
4857                         su $ans -c './reflect >flect'
4858                         if $contains "/dev/fd" flect >/dev/null; then
4859                                 echo "Okay, it looks like setuid scripts are secure." >&4
4860                                 dflt=y
4861                         else
4862                                 echo "I don't think setuid scripts are secure." >&4
4863                                 dflt=n
4864                         fi
4865                         ;;
4866                 esac
4867                 rp='Does your kernel have *secure* setuid scripts?'
4868                 . ./myread
4869                 case "$ans" in
4870                 [yY]*)  val="$define";;
4871                 *)      val="$undef";;
4872                 esac
4873         fi
4874 else
4875         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
4876         echo "(That's for file descriptors, not floppy disks.)"
4877         val="$undef"
4878 fi
4879 set d_suidsafe
4880 eval $setvar
4881
4882 $rm -f reflect flect
4883
4884 : now see if they want to do setuid emulation
4885 echo " "
4886 val="$undef"
4887 case "$d_suidsafe" in
4888 "$define")
4889         val="$undef"
4890         echo "No need to emulate SUID scripts since they are secure here." >& 4
4891         ;;
4892 *)
4893         $cat <<EOM
4894 Some systems have disabled setuid scripts, especially systems where
4895 setuid scripts cannot be secure.  On systems where setuid scripts have
4896 been disabled, the setuid/setgid bits on scripts are currently
4897 useless.  It is possible for $package to detect those bits and emulate
4898 setuid/setgid in a secure fashion.  This emulation will only work if
4899 setuid scripts have been disabled in your kernel.
4900
4901 EOM
4902         case "$d_dosuid" in
4903         "$define") dflt=y ;;
4904         *) dflt=n ;;
4905         esac
4906         rp="Do you want to do setuid/setgid emulation?"
4907         . ./myread
4908         case "$ans" in
4909         [yY]*)  val="$define";;
4910         *)      val="$undef";;
4911         esac
4912         ;;
4913 esac
4914 set d_dosuid
4915 eval $setvar
4916
4917 : determine filename position in cpp output
4918 echo " "
4919 echo "Computing filename position in cpp output for #include directives..." >&4
4920 echo '#include <stdio.h>' > foo.c
4921 $cat >fieldn <<EOF
4922 $startsh
4923 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
4924 $grep '^[       ]*#.*stdio\.h' | \
4925 while read cline; do
4926         pos=1
4927         set \$cline
4928         while $test \$# -gt 0; do
4929                 if $test -r \`echo \$1 | $tr -d '"'\`; then
4930                         echo "\$pos"
4931                         exit 0
4932                 fi
4933                 shift
4934                 pos=\`expr \$pos + 1\`
4935         done
4936 done
4937 EOF
4938 chmod +x fieldn
4939 fieldn=`./fieldn`
4940 $rm -f foo.c fieldn
4941 case $fieldn in
4942 '') pos='???';;
4943 1) pos=first;;
4944 2) pos=second;;
4945 3) pos=third;;
4946 *) pos="${fieldn}th";;
4947 esac
4948 echo "Your cpp writes the filename in the $pos field of the line."
4949
4950 : locate header file
4951 $cat >findhdr <<EOF
4952 $startsh
4953 wanted=\$1
4954 name=''
4955 for usrincdir in $usrinc
4956 do
4957         if test -f \$usrincdir/\$wanted; then
4958                 echo "\$usrincdir/\$wanted"
4959                 exit 0
4960         fi
4961 done
4962 awkprg='{ print \$$fieldn }'
4963 echo "#include <\$wanted>" > foo\$\$.c
4964 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
4965 $grep "^[       ]*#.*\$wanted" | \
4966 while read cline; do
4967         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
4968         case "\$name" in
4969         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
4970         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
4971         *) exit 2;;
4972         esac;
4973 done;
4974 #
4975 # status = 0: grep returned 0 lines, case statement not executed
4976 # status = 1: headerfile found
4977 # status = 2: while loop executed, no headerfile found
4978 #
4979 status=\$?
4980 $rm -f foo\$\$.c;
4981 if test \$status -eq 1; then
4982         exit 0;
4983 fi
4984 exit 1
4985 EOF
4986 chmod +x findhdr
4987
4988 : define an alternate in-header-list? function
4989 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
4990 cont=true; xxf="echo \"<\$1> found.\" >&4";
4991 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
4992 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
4993 esac;
4994 case $# in 4) instead=instead;; *) instead="at last";; esac;
4995 while $test "$cont"; do
4996         xxx=`./findhdr $1`
4997         var=$2; eval "was=\$$2";
4998         if $test "$xxx" && $test -r "$xxx";
4999         then eval $xxf;
5000         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5001                 cont="";
5002         else eval $xxnf;
5003         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5004         set $yyy; shift; shift; yyy=$@;
5005         case $# in 0) cont="";;
5006         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5007                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5008         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5009                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5010         esac;
5011 done;
5012 while $test "$yyy";
5013 do set $yyy; var=$2; eval "was=\$$2";
5014         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5015         set $yyy; shift; shift; yyy=$@;
5016 done'
5017
5018 : see if this is a malloc.h system
5019 set malloc.h i_malloc
5020 eval $inhdr
5021
5022 : see if stdlib is available
5023 set stdlib.h i_stdlib
5024 eval $inhdr
5025
5026 : determine which malloc to compile in
5027 echo " "
5028 case "$usemymalloc" in
5029 ''|[yY]*|true|$define)  dflt='y' ;;
5030 *)      dflt='n' ;;
5031 esac
5032 rp="Do you wish to attempt to use the malloc that comes with $package?"
5033 . ./myread
5034 usemymalloc="$ans"
5035 case "$ans" in
5036 y*|true)
5037         usemymalloc='y'
5038         mallocsrc='malloc.c'
5039         mallocobj="malloc$_o"
5040         d_mymalloc="$define"
5041         case "$libs" in
5042         *-lmalloc*)
5043                 : Remove malloc from list of libraries to use
5044                 echo "Removing unneeded -lmalloc from library list" >&4
5045                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
5046                 shift
5047                 libs="$*"
5048                 echo "libs = $libs" >&4
5049                 ;;
5050         esac
5051         ;;
5052 *)
5053         usemymalloc='n'
5054         mallocsrc=''
5055         mallocobj=''
5056         d_mymalloc="$undef"
5057         ;;
5058 esac
5059
5060 : compute the return types of malloc and free
5061 echo " "
5062 $cat >malloc.c <<END
5063 #$i_malloc I_MALLOC
5064 #$i_stdlib I_STDLIB
5065 #include <stdio.h>
5066 #include <sys/types.h>
5067 #ifdef I_MALLOC
5068 #include <malloc.h>
5069 #endif
5070 #ifdef I_STDLIB
5071 #include <stdlib.h>
5072 #endif
5073 #ifdef TRY_MALLOC
5074 void *malloc();
5075 #endif
5076 #ifdef TRY_FREE
5077 void free();
5078 #endif
5079 END
5080 case "$malloctype" in
5081 '')
5082         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
5083                 malloctype='void *'
5084         else
5085                 malloctype='char *'
5086         fi
5087         ;;
5088 esac
5089 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
5090
5091 case "$freetype" in
5092 '')
5093         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
5094                 freetype='void'
5095         else
5096                 freetype='int'
5097         fi
5098         ;;
5099 esac
5100 echo "Your system uses $freetype free(), it would seem." >&4
5101 $rm -f malloc.[co]
5102 $cat <<EOM
5103
5104 The installation process will also create a directory for
5105 vendor-supplied add-ons.  Vendors who supply perl with their system
5106 may find it convenient to place all vendor-supplied files in this
5107 directory rather than in the main distribution directory.  This will
5108 ease upgrades between binary-compatible maintenance versions of perl.
5109
5110 Of course you may also use these directories in whatever way you see
5111 fit.  For example, you might use them to access modules shared over a
5112 company-wide network.
5113
5114 The default answer should be fine for most people.
5115 This causes further questions about vendor add-ons to be skipped
5116 and no vendor-specific directories will be configured for perl.
5117
5118 EOM
5119 rp='Do you want to configure vendor-specific add-on directories?'
5120 case "$usevendorprefix" in
5121 define|true|[yY]*) dflt=y ;;
5122 *) dflt=n ;;
5123 esac
5124 . ./myread
5125 case "$ans" in
5126 [yY]*)  fn=d~+
5127         rp='Installation prefix to use for vendor-supplied add-ons?'
5128         case "$vendorprefix" in
5129         '') dflt='' ;;
5130         *)  dflt=$vendorprefix ;;
5131         esac
5132         . ./getfile
5133         oldvendorprefix=''
5134         case "$vendorprefix" in
5135         '') ;;
5136         *)      case "$ans" in
5137                 "$prefix") ;;
5138                 *) oldvendorprefix="$prefix";;
5139                 esac
5140                 ;;
5141         esac
5142         usevendorprefix="$define"
5143         vendorprefix="$ans"
5144         vendorprefixexp="$ansexp"
5145         ;;
5146 *)      usevendorprefix="$undef"
5147         vendorprefix=''
5148         vendorprefixexp=''
5149         ;;
5150 esac
5151
5152 case "$vendorprefix" in
5153 '')     d_vendorlib="$undef"
5154         vendorlib=''
5155         vendorlibexp=''
5156         ;;
5157 *)      d_vendorlib="$define"
5158         : determine where vendor-supplied modules go.
5159         : Usual default is /usr/local/lib/perl5/vendor_perl
5160         prog=`echo $package | $sed 's/-*[0-9.]*$//'`
5161         case "$installstyle" in
5162         *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog ;;
5163         *)           dflt=$vendorprefix/lib/vendor_$prog ;;
5164         esac
5165         fn=d~+
5166         rp='Pathname for the vendor-supplied library files?'
5167         . ./getfile
5168         vendorlib="$ans"
5169         vendorlibexp="$ansexp"
5170         : Change installation prefix, if necessary.
5171         if $test X"$prefix" != X"$installprefix"; then
5172                 installvendorlib=`echo $vendorlibexp | $sed "s#^$prefix#$installprefix#"`
5173         else
5174                 installvendorlib="$vendorlibexp"
5175         fi
5176         ;;
5177 esac
5178
5179 : Cruising for prototypes
5180 echo " "
5181 echo "Checking out function prototypes..." >&4
5182 $cat >prototype.c <<'EOCP'
5183 int main(int argc, char *argv[]) {
5184         exit(0);}
5185 EOCP
5186 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
5187         echo "Your C compiler appears to support function prototypes."
5188         val="$define"
5189 else
5190         echo "Your C compiler doesn't seem to understand function prototypes."
5191         val="$undef"
5192 fi
5193 set prototype
5194 eval $setvar
5195 $rm -f prototype*
5196
5197 case "$prototype" in
5198 "$define") ;;
5199 *)      ansi2knr='ansi2knr'
5200         echo " "
5201         cat <<EOM >&4
5202
5203 $me:  FATAL ERROR:
5204 This version of $package can only be compiled by a compiler that 
5205 understands function prototypes.  Unfortunately, your C compiler 
5206         $cc $ccflags
5207 doesn't seem to understand them.  Sorry about that.
5208
5209 If GNU cc is available for your system, perhaps you could try that instead.  
5210
5211 Eventually, we hope to support building Perl with pre-ANSI compilers.
5212 If you would like to help in that effort, please contact <perlbug@perl.org>.
5213
5214 Aborting Configure now.
5215 EOM
5216         exit 2
5217         ;;
5218 esac
5219
5220 : determine where public executables go
5221 echo " "
5222 set dflt bin bin
5223 eval $prefixit
5224 fn=d~
5225 rp='Pathname where the public executables will reside?'
5226 . ./getfile
5227 if $test "X$ansexp" != "X$binexp"; then
5228         installbin=''
5229 fi
5230 bin="$ans"
5231 binexp="$ansexp"
5232 : Change installation prefix, if necessary.
5233 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
5234 if $test X"$prefix" != X"$installprefix"; then
5235         installbin=`echo $binexp | sed "s#^$prefix#$installprefix#"`
5236 else
5237         installbin="$binexp"
5238 fi
5239
5240 : determine whether to install perl also as /usr/bin/perl
5241
5242 echo " "
5243 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
5244         $cat <<EOM
5245 Many scripts expect to perl to be installed as /usr/bin/perl.
5246 I can install the perl you are about to compile also as /usr/bin/perl
5247 (in addition to $installbin/perl).
5248 EOM
5249         case "$installusrbinperl" in
5250         "$undef"|[nN]*) dflt='n';;
5251         *)              dflt='y';;
5252         esac
5253         rp="Do you want to install perl as /usr/bin/perl?"
5254         . ./myread
5255         case "$ans" in
5256         [yY]*)  val="$define";;
5257         *)      val="$undef" ;;
5258         esac
5259 else
5260         val="$undef"
5261 fi
5262 set installusrbinperl
5263 eval $setvar
5264
5265 echo " "
5266 echo "Checking for GNU C Library..." >&4
5267 cat >gnulibc.c <<EOM
5268 #include <stdio.h>
5269 int main()
5270 {
5271 #ifdef __GLIBC__
5272     exit(0);
5273 #else
5274     exit(1);
5275 #endif
5276 }
5277 EOM
5278 set gnulibc
5279 if eval $compile_ok && ./gnulibc; then
5280         val="$define"
5281         echo "You are using the GNU C Library"
5282 else
5283         val="$undef"
5284         echo "You are not using the GNU C Library"
5285 fi
5286 $rm -f gnulibc*
5287 set d_gnulibc
5288 eval $setvar
5289
5290 : see if nm is to be used to determine whether a symbol is defined or not
5291 case "$usenm" in
5292 '')
5293         dflt=''
5294         case "$d_gnulibc" in
5295         "$define")
5296                 echo " "
5297                 echo "nm probably won't work on the GNU C Library." >&4
5298                 dflt=n
5299                 ;;
5300         esac
5301         case "$dflt" in
5302         '') 
5303                 if $test "$osname" = aix -a ! -f /lib/syscalls.exp; then
5304                         echo " "
5305                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
5306                         echo "'nm' won't be sufficient on this sytem." >&4
5307                         dflt=n
5308                 fi
5309                 ;;
5310         esac
5311         case "$dflt" in
5312         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
5313                 if $test $dflt -gt 20; then
5314                         dflt=y
5315                 else
5316                         dflt=n
5317                 fi
5318                 ;;
5319         esac
5320         ;;
5321 *)
5322         case "$usenm" in
5323         true|$define) dflt=y;;
5324         *) dflt=n;;
5325         esac
5326         ;;
5327 esac
5328 $cat <<EOM
5329
5330 I can use $nm to extract the symbols from your C libraries. This
5331 is a time consuming task which may generate huge output on the disk (up
5332 to 3 megabytes) but that should make the symbols extraction faster. The
5333 alternative is to skip the 'nm' extraction part and to compile a small
5334 test program instead to determine whether each symbol is present. If
5335 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
5336 this may be the best solution.
5337
5338 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
5339
5340 EOM
5341 rp="Shall I use $nm to extract C symbols from the libraries?"
5342 . ./myread
5343 case "$ans" in
5344 [Nn]*) usenm=false;;
5345 *) usenm=true;;
5346 esac
5347
5348 runnm=$usenm
5349 case "$reuseval" in
5350 true) runnm=false;;
5351 esac
5352
5353 : nm options which may be necessary
5354 case "$nm_opt" in
5355 '') if $test -f /mach_boot; then
5356                 nm_opt=''       # Mach
5357         elif $test -d /usr/ccs/lib; then
5358                 nm_opt='-p'     # Solaris (and SunOS?)
5359         elif $test -f /dgux; then
5360                 nm_opt='-p'     # DG-UX
5361         elif $test -f /lib64/rld; then
5362                 nm_opt='-p'     # 64-bit Irix
5363         else
5364                 nm_opt=''
5365         fi;;
5366 esac
5367
5368 : nm options which may be necessary for shared libraries but illegal
5369 : for archive libraries.  Thank you, Linux.
5370 case "$nm_so_opt" in
5371 '')     case "$myuname" in
5372         *linux*)
5373                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
5374                         nm_so_opt='--dynamic'
5375                 fi
5376                 ;;
5377         esac
5378         ;;
5379 esac
5380
5381 case "$runnm" in
5382 true)
5383 : get list of predefined functions in a handy place
5384 echo " "
5385 case "$libc" in
5386 '') libc=unknown
5387         case "$libs" in
5388         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
5389         esac
5390         ;;
5391 esac
5392 libnames='';
5393 case "$libs" in
5394 '') ;;
5395 *)  for thislib in $libs; do
5396         case "$thislib" in
5397         -lc|-lc_s)
5398                 : Handle C library specially below.
5399                 ;;
5400         -l*)
5401                 thislib=`echo $thislib | $sed -e 's/^-l//'`
5402                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
5403                         :
5404                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
5405                         :
5406                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
5407                         :
5408                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
5409                         :
5410                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
5411                         :
5412                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
5413                         :
5414                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
5415                         :
5416                 else
5417                         try=''
5418                 fi
5419                 libnames="$libnames $try"
5420                 ;;
5421         *) libnames="$libnames $thislib" ;;
5422         esac
5423         done
5424         ;;
5425 esac
5426 xxx=normal
5427 case "$libc" in
5428 unknown)
5429         set /lib/libc.$so
5430         for xxx in $libpth; do
5431                 $test -r $1 || set $xxx/libc.$so
5432                 : The messy sed command sorts on library version numbers.
5433                 $test -r $1 || \
5434                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
5435                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
5436                                 h
5437                                 s/[0-9][0-9]*/0000&/g
5438                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
5439                                 G
5440                                 s/\n/ /' | \
5441                          sort | $sed -e 's/^.* //'`
5442                 eval set \$$#
5443         done
5444         $test -r $1 || set /usr/ccs/lib/libc.$so
5445         $test -r $1 || set /lib/libsys_s$_a
5446         ;;
5447 *)
5448         set blurfl
5449         ;;
5450 esac
5451 if $test -r "$1"; then
5452         echo "Your (shared) C library seems to be in $1."
5453         libc="$1"
5454 elif $test -r /lib/libc && $test -r /lib/clib; then
5455         echo "Your C library seems to be in both /lib/clib and /lib/libc."
5456         xxx=apollo
5457         libc='/lib/clib /lib/libc'
5458         if $test -r /lib/syslib; then
5459                 echo "(Your math library is in /lib/syslib.)"
5460                 libc="$libc /lib/syslib"
5461         fi
5462 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5463         echo "Your C library seems to be in $libc, as you said before."
5464 elif $test -r $incpath/usr/lib/libc$_a; then
5465         libc=$incpath/usr/lib/libc$_a;
5466         echo "Your C library seems to be in $libc.  That's fine."
5467 elif $test -r /lib/libc$_a; then
5468         libc=/lib/libc$_a;
5469         echo "Your C library seems to be in $libc.  You're normal."
5470 else
5471         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
5472                 :
5473         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
5474                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
5475         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
5476                 :
5477         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5478                 :
5479         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5480                 :
5481         else
5482                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
5483         fi
5484         if $test -r "$tans"; then
5485                 echo "Your C library seems to be in $tans, of all places."
5486                 libc=$tans
5487         else
5488                 libc='blurfl'
5489         fi
5490 fi
5491 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5492         dflt="$libc"
5493         cat <<EOM
5494
5495 If the guess above is wrong (which it might be if you're using a strange
5496 compiler, or your machine supports multiple models), you can override it here.
5497
5498 EOM
5499 else
5500         dflt=''
5501         echo $libpth | tr ' ' $trnl | sort | uniq > libpath
5502         cat >&4 <<EOM
5503 I can't seem to find your C library.  I've looked in the following places:
5504
5505 EOM
5506         $sed 's/^/      /' libpath
5507         cat <<EOM
5508
5509 None of these seems to contain your C library. I need to get its name...
5510
5511 EOM
5512 fi
5513 fn=f
5514 rp='Where is your C library?'
5515 . ./getfile
5516 libc="$ans"
5517
5518 echo " "
5519 echo $libc $libnames | tr ' ' $trnl | sort | uniq > libnames
5520 set X `cat libnames`
5521 shift
5522 xxx=files
5523 case $# in 1) xxx=file; esac
5524 echo "Extracting names from the following $xxx for later perusal:" >&4
5525 echo " "
5526 $sed 's/^/      /' libnames >&4
5527 echo " "
5528 $echo $n "This may take a while...$c" >&4
5529
5530 for file in $*; do
5531         case $file in
5532         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
5533         *) $nm $nm_opt $file 2>/dev/null;;
5534         esac
5535 done >libc.tmp
5536
5537 $echo $n ".$c"
5538 $grep fprintf libc.tmp > libc.ptf
5539 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
5540 xrun='eval "<libc.tmp $com >libc.list"; echo "done" >&4'
5541 xxx='[ADTSIW]'
5542 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *_[_.]*//p' -e 's/^.* $xxx  *//p'";\
5543         eval $xscan;\
5544         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5545                 eval $xrun
5546 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
5547         eval $xscan;\
5548         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5549                 eval $xrun
5550 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
5551         eval $xscan;\
5552         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5553                 eval $xrun
5554 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
5555         eval $xscan;\
5556         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5557                 eval $xrun
5558 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
5559         eval $xscan;\
5560         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5561                 eval $xrun
5562 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
5563         eval $xscan;\
5564         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5565                 eval $xrun
5566 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
5567                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
5568         eval $xscan;\
5569         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5570                 eval $xrun
5571 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
5572         eval $xscan;\
5573         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5574                 eval $xrun
5575 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
5576         eval $xscan;\
5577         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5578                 eval $xrun
5579 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
5580         eval $xscan;\
5581         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5582                 eval $xrun
5583 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
5584         eval $xscan;\
5585         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5586                 eval $xrun
5587 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
5588         eval $xscan;\
5589         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5590                 eval $xrun
5591 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
5592         eval $xscan;\
5593         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5594                 eval $xrun
5595 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
5596         eval $xscan;\
5597         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5598                 eval $xrun
5599 else
5600         $nm -p $* 2>/dev/null >libc.tmp
5601         $grep fprintf libc.tmp > libc.ptf
5602         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
5603                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
5604         then
5605                 nm_opt='-p'
5606                 eval $xrun
5607         else
5608                 echo " "
5609                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
5610                 com=''
5611                 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
5612                         for thisname in $libnames $libc; do
5613                                 $ar t $thisname >>libc.tmp
5614                         done
5615                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
5616                         echo "Ok." >&4
5617                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
5618                         # Repeat libc to extract forwarders to DLL entries too
5619                         for thisname in $libnames $libc; do
5620                                 $ar tv $thisname >>libc.tmp
5621                                 # Revision 50 of EMX has bug in $ar.
5622                                 # it will not extract forwarders to DLL entries
5623                                 # Use emximp which will extract exactly them.
5624                                 emximp -o tmp.imp $thisname \
5625                                     2>/dev/null && \
5626                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
5627                                     < tmp.imp >>libc.tmp
5628                                 $rm tmp.imp
5629                         done
5630                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
5631                         echo "Ok." >&4
5632                 else
5633                         echo "$ar didn't seem to work right." >&4
5634                         echo "Maybe this is a Cray...trying bld instead..." >&4
5635                         if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
5636                         then
5637                                 for thisname in $libnames; do
5638                                         bld t $libnames | \
5639                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
5640                                         $ar t $thisname >>libc.tmp
5641                                 done
5642                                 echo "Ok." >&4
5643                         else
5644                                 echo "That didn't work either.  Giving up." >&4
5645                                 exit 1
5646                         fi
5647                 fi
5648         fi
5649 fi
5650 nm_extract="$com"
5651 if $test -f /lib/syscalls.exp; then
5652         echo " "
5653         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
5654         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*$/\1/p' /lib/syscalls.exp >>libc.list
5655 fi
5656 ;;
5657 esac
5658 $rm -f libnames libpath
5659
5660 : see if dld is available
5661 set dld.h i_dld
5662 eval $inhdr
5663
5664 : is a C symbol defined?
5665 csym='tlook=$1;
5666 case "$3" in
5667 -v) tf=libc.tmp; tc=""; tdc="";;
5668 -a) tf=libc.tmp; tc="[0]"; tdc="[]";;
5669 *) tlook="^$1\$"; tf=libc.list; tc="()"; tdc="()";;
5670 esac;
5671 tx=yes;
5672 case "$reuseval-$4" in
5673 true-) ;;
5674 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
5675 esac;
5676 case "$tx" in
5677 yes)
5678         case "$runnm" in
5679         true)
5680                 if $contains $tlook $tf >/dev/null 2>&1;
5681                 then tval=true;
5682                 else tval=false;
5683                 fi;;
5684         *)
5685                 echo "int main() { extern short $1$tdc; printf(\"%hd\", $1$tc); }" > t.c;
5686                 if $cc $optimize $ccflags $ldflags -o t t.c $libs >/dev/null 2>&1;
5687                 then tval=true;
5688                 else tval=false;
5689                 fi;
5690                 $rm -f t t.c;;
5691         esac;;
5692 *)
5693         case "$tval" in
5694         $define) tval=true;;
5695         *) tval=false;;
5696         esac;;
5697 esac;
5698 eval "$2=$tval"'
5699
5700 : define an is-in-libc? function
5701 inlibc='echo " "; td=$define; tu=$undef;
5702 sym=$1; var=$2; eval "was=\$$2";
5703 tx=yes;
5704 case "$reuseval$was" in
5705 true) ;;
5706 true*) tx=no;;
5707 esac;
5708 case "$tx" in
5709 yes)
5710         set $sym tres -f;
5711         eval $csym;
5712         case "$tres" in
5713         true)
5714                 echo "$sym() found." >&4;
5715                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
5716         *)
5717                 echo "$sym() NOT found." >&4;
5718                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
5719         esac;;
5720 *)
5721         case "$was" in
5722         $define) echo "$sym() found." >&4;;
5723         *) echo "$sym() NOT found." >&4;;
5724         esac;;
5725 esac'
5726
5727 : see if dlopen exists
5728 xxx_runnm="$runnm"
5729 runnm=false
5730 set dlopen d_dlopen
5731 eval $inlibc
5732 runnm="$xxx_runnm"
5733
5734 : determine which dynamic loading, if any, to compile in
5735 echo " "
5736 dldir="ext/DynaLoader"
5737 case "$usedl" in
5738 $define|y|true)
5739         dflt='y'
5740         usedl="$define"
5741         ;;
5742 $undef|n|false)
5743         dflt='n'
5744         usedl="$undef"
5745         ;;
5746 *) 
5747         dflt='n'
5748         case "$d_dlopen" in
5749             $define) dflt='y' ;;
5750         esac
5751         case "$i_dld" in
5752             $define) dflt='y' ;;
5753         esac
5754         : Does a dl_xxx.xs file exist for this operating system
5755         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
5756         ;;
5757 esac
5758 rp="Do you wish to use dynamic loading?"
5759 . ./myread
5760 usedl="$ans"
5761 case "$ans" in
5762 y*) usedl="$define"
5763         case "$dlsrc" in
5764         '')
5765                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
5766                         dflt="$dldir/dl_${osname}.xs"
5767                 elif $test "$d_dlopen" = "$define" ; then
5768                         dflt="$dldir/dl_dlopen.xs"
5769                 elif $test "$i_dld" = "$define" ; then
5770                         dflt="$dldir/dl_dld.xs"
5771                 else
5772                         dflt=''
5773                 fi
5774                 ;;
5775         *)      dflt="$dldir/$dlsrc"
5776                 ;;
5777         esac
5778     echo "The following dynamic loading files are available:"
5779         : Can not go over to $dldir because getfile has path hard-coded in.
5780         tdir=`pwd`; cd $rsrc; $ls -C $dldir/dl*.xs; cd $tdir
5781         rp="Source file to use for dynamic loading"
5782         fn="fne"
5783         gfpth="$src"
5784         . ./getfile
5785         usedl="$define"
5786         : emulate basename
5787         dlsrc=`echo $ans | $sed -e 's@.*/\([^/]*\)$@\1@'`
5788
5789         $cat << EOM
5790
5791 Some systems may require passing special flags to $cc -c to
5792 compile modules that will be used to create a shared library.
5793 To use no flags, say "none".
5794
5795 EOM
5796     case "$cccdlflags" in
5797     '') case "$gccversion" in
5798                 '') case "$osname" in
5799                         hpux)   dflt='+z' ;;
5800                         next)   dflt='none' ;;
5801                         irix*)  dflt='-KPIC' ;;
5802                         svr4*|esix*|solaris) dflt='-KPIC' ;;
5803                         sunos)  dflt='-pic' ;;
5804                         *)      dflt='none' ;;
5805                     esac
5806                         ;;
5807                 *)  case "$osname" in
5808                         svr4*|esix*|solaris) dflt='-fPIC' ;;
5809                         *)      dflt='-fpic' ;;
5810                     esac ;;
5811             esac ;;
5812         ' ') dflt='none' ;;
5813     *)  dflt="$cccdlflags" ;;
5814     esac
5815     rp="Any special flags to pass to $cc -c to compile shared library modules?"
5816     . ./myread
5817     case "$ans" in
5818     none) cccdlflags=' ' ;;
5819     *) cccdlflags="$ans" ;;
5820     esac
5821
5822     cat << EOM
5823
5824 Some systems use ld to create libraries that can be dynamically loaded,
5825 while other systems (such as those using ELF) use $cc.
5826
5827 EOM
5828         case "$ld" in
5829         '')     $cat >try.c <<'EOM'
5830 /* Test for whether ELF binaries are produced */
5831 #include <fcntl.h>
5832 #include <stdlib.h>
5833 int main() {
5834         char b[4];
5835         int i = open("a.out",O_RDONLY);
5836         if(i == -1) 
5837                 exit(1); /* fail */
5838         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
5839                 exit(0); /* succeed (yes, it's ELF) */
5840         else
5841                 exit(1); /* fail */
5842 }
5843 EOM
5844                 if $cc $ccflags try.c >/dev/null 2>&1 && ./a.out; then
5845                         cat <<EOM
5846 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
5847 EOM
5848                         dflt="$cc"
5849                 else
5850                         echo "I'll use ld to build dynamic libraries."
5851                         dflt='ld'
5852                 fi
5853                 rm -f try.c a.out
5854                 ;;
5855         *)      dflt="$ld"
5856                 ;;
5857         esac
5858
5859     rp="What command should be used to create dynamic libraries?"
5860     . ./myread
5861         ld="$ans"
5862
5863     cat << EOM
5864
5865 Some systems may require passing special flags to $ld to create a
5866 library that can be dynamically loaded.  If your ld flags include
5867 -L/other/path options to locate libraries outside your loader's normal
5868 search path, you may need to specify those -L options here as well.  To
5869 use no flags, say "none".
5870
5871 EOM
5872     case "$lddlflags" in
5873     '') case "$osname" in
5874                         beos) dflt='-nostart' ;;
5875                         hpux)  dflt='-b' ;;
5876                         linux|irix*)    dflt='-shared' ;;
5877                         next)  dflt='none' ;;
5878                         solaris) dflt='-G' ;;
5879                         sunos) dflt='-assert nodefinitions' ;;
5880                         svr4*|esix*) dflt="-G $ldflags" ;;
5881                 *)     dflt='none' ;;
5882                         esac
5883                         ;;
5884     *) dflt="$lddlflags" ;;
5885     esac
5886
5887         : Try to guess additional flags to pick up local libraries.
5888         : Be careful not to append to a plain 'none'
5889         case "$dflt" in
5890         none) dflt='' ;;
5891         esac
5892         for thisflag in $ldflags; do
5893                 case "$thisflag" in
5894                 -L*)
5895                         case " $dflt " in
5896                         *" $thisflag "*) ;;
5897                         *) dflt="$dflt $thisflag" ;;
5898                         esac
5899                         ;;
5900                 esac
5901         done
5902
5903         case "$dflt" in
5904         ''|' ') dflt='none' ;;
5905         esac
5906
5907     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
5908     . ./myread
5909     case "$ans" in
5910     none) lddlflags=' ' ;;
5911     *) lddlflags="$ans" ;;
5912     esac
5913
5914         cat <<EOM
5915
5916 Some systems may require passing special flags to $cc to indicate that
5917 the resulting executable will use dynamic linking.  To use no flags,
5918 say "none".
5919
5920 EOM
5921     case "$ccdlflags" in
5922     '') case "$osname" in
5923                 hpux)   dflt='-Wl,-E' ;;
5924                 linux)  dflt='-rdynamic' ;;
5925                 next)   dflt='none' ;;
5926                 sunos)  dflt='none' ;;
5927                 *)      dflt='none' ;;
5928             esac ;;
5929     ' ')  dflt='none' ;;
5930     *)  dflt="$ccdlflags" ;;
5931     esac
5932     rp="Any special flags to pass to $cc to use dynamic loading?"
5933     . ./myread
5934     case "$ans" in
5935     none) ccdlflags=' ' ;;
5936     *) ccdlflags="$ans" ;;
5937     esac
5938     ;;
5939 *)  usedl="$undef"
5940         ld='ld'
5941     dlsrc='dl_none.xs'
5942     lddlflags=''
5943     ccdlflags=''
5944     ;;
5945 esac
5946
5947 also=''
5948 case "$usedl" in
5949 $undef)
5950         # No dynamic loading being used, so don't bother even to prompt.
5951         useshrplib='false'
5952         ;;
5953 *)      case "$useshrplib" in
5954         '')     case "$osname" in
5955                 svr4*|dgux|dynixptx|esix|powerux|beos|cygwin*)
5956                         dflt=y
5957                         also='Building a shared libperl is required for dynamic loading to work on your system.'
5958                         ;;
5959                 next*)
5960                         case "$osvers" in
5961                         4*)     dflt=y
5962                                 also='Building a shared libperl is needed for MAB support.'
5963                                 ;;
5964                         *)      dflt=n
5965                                 ;;
5966                         esac
5967                         ;;
5968                 *)      dflt=n
5969                         ;;
5970                 esac
5971                 ;;
5972         $define|true|[Yy]*)
5973                 dflt=y
5974                 ;;
5975         *)      dflt=n
5976                 ;;
5977         esac
5978         $cat << EOM
5979
5980 The perl executable is normally obtained by linking perlmain.c with
5981 libperl${_a}, any static extensions (usually just DynaLoader), and
5982 any other libraries needed on this system (such as -lm, etc.).  Since
5983 your system supports dynamic loading, it is probably possible to build
5984 a shared libperl.$so.  If you will have more than one executable linked
5985 to libperl.$so, this will significantly reduce the size of each
5986 executable, but it may have a noticeable affect on performance.  The
5987 default is probably sensible for your system.
5988 $also
5989
5990 EOM
5991         rp="Build a shared libperl.$so (y/n)"
5992         . ./myread
5993         case "$ans" in
5994         true|$define|[Yy]*)
5995                 useshrplib='true'  ;;
5996         *)      useshrplib='false' ;;
5997         esac
5998         ;;
5999 esac
6000
6001 case "$useshrplib" in
6002 true)
6003         case "$libperl" in
6004         '')
6005                 # Figure out a good name for libperl.so.  Since it gets stored in
6006                 # a version-specific architecture-dependent library, the version
6007                 # number isn't really that important, except for making cc/ld happy.
6008                 #
6009                 # A name such as libperl.so.3.1
6010                 majmin="libperl.$so.$patchlevel.$subversion"
6011                 # A name such as libperl.so.301
6012                 majonly=`echo $patchlevel $subversion |
6013                         $awk '{printf "%d%02d", $1, $2}'`
6014                 majonly=libperl.$so.$majonly
6015                 # I'd prefer to keep the os-specific stuff here to a minimum, and
6016                 # rely on figuring it out from the naming of libc.
6017                 case "${osname}${osvers}" in
6018                 next4*)
6019                         dflt=libperl.5.$so
6020                         # XXX How handle the --version stuff for MAB?
6021                         ;;
6022                 linux*)  # ld won't link with a bare -lperl otherwise.
6023                         dflt=libperl.$so
6024                         ;;
6025                 cygwin*) # include version
6026                         dflt=`echo libperl$version | sed -e 's/\./_/g'`$lib_ext
6027                         ;;
6028                 *)      # Try to guess based on whether libc has major.minor.
6029                         case "$libc" in
6030                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
6031                         *libc.$so.[0-9]*) dflt=$majonly ;;
6032                         *)      dflt=libperl.$so ;;
6033                         esac
6034                         ;;
6035                 esac
6036                 ;;
6037         *)      dflt=$libperl
6038                 ;;
6039         esac
6040         cat << EOM
6041
6042 I need to select a good name for the shared libperl.  If your system uses
6043 library names with major and minor numbers, then you might want something
6044 like $majmin.  Alternatively, if your system uses a single version
6045 number for shared libraries, then you might want to use $majonly.
6046 Or, your system might be quite happy with a simple libperl.$so.
6047
6048 Since the shared libperl will get installed into a version-specific
6049 architecture-dependent directory, the version number of the shared perl
6050 library probably isn't important, so the default should be o.k.
6051
6052 EOM
6053         rp='What name do you want to give to the shared libperl?'
6054         . ./myread
6055         libperl=$ans
6056         echo "Ok, I'll use $libperl"
6057         ;;
6058 *)
6059         libperl="libperl${_a}"
6060         ;;
6061 esac
6062
6063 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
6064 case "$shrpdir" in
6065 '') ;;
6066 *)      $cat >&4 <<EOM
6067 WARNING:  Use of the shrpdir variable for the installation location of
6068 the shared $libperl is not supported.  It was never documented and
6069 will not work in this version.  Let me (perlbug@perl.com)
6070 know of any problems this may cause.
6071
6072 EOM
6073         case "$shrpdir" in
6074         "$archlibexp/CORE")
6075                 $cat >&4 <<EOM
6076 But your current setting of $shrpdir is
6077 the default anyway, so it's harmless.
6078 EOM
6079                 ;;
6080         *)
6081                 $cat >&4 <<EOM
6082 Further, your current attempted setting of $shrpdir
6083 conflicts with the value of $archlibexp/CORE
6084 that installperl will use.
6085 EOM
6086                 ;;
6087         esac
6088         ;;
6089 esac
6090
6091 # How will the perl executable find the installed shared $libperl?
6092 # Add $xxx to ccdlflags.
6093 # If we can't figure out a command-line option, use $shrpenv to
6094 # set env LD_RUN_PATH.  The main perl makefile uses this.
6095 shrpdir=$archlibexp/CORE
6096 xxx=''
6097 tmp_shrpenv=''
6098 if "$useshrplib"; then
6099     case "$osname" in 
6100         aix)
6101                 # We'll set it in Makefile.SH...
6102                 ;;
6103         solaris|netbsd)
6104                 xxx="-R $shrpdir"
6105                 ;;
6106         freebsd)
6107                 xxx="-Wl,-R$shrpdir"
6108                 ;;
6109         linux|irix*|dec_osf)
6110                 xxx="-Wl,-rpath,$shrpdir"
6111                 ;;
6112         next)
6113                 # next doesn't like the default...
6114                 ;;
6115         beos)
6116                 # beos doesn't like the default, either.
6117                 ;;
6118         hpux*)
6119                 # hpux doesn't like the default, either.
6120                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
6121                 ;;
6122         *)
6123                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
6124                 ;;
6125         esac
6126         case "$xxx" in
6127         '') ;;
6128         *)      
6129                 # Only add $xxx if it isn't already in ccdlflags.
6130                 case " $ccdlflags " in
6131                 *" $xxx "*)     ;;
6132                 *)      ccdlflags="$ccdlflags $xxx"
6133                         cat <<EOM >&4
6134
6135 Adding $xxx to the flags
6136 passed to $ld so that the perl executable will find the 
6137 installed shared $libperl.
6138
6139 EOM
6140                         ;;
6141                 esac
6142                 ;;
6143         esac
6144 fi
6145 # Fix ccdlflags in AIX for building external extensions.
6146 # (For building Perl itself bare -bE:perl.exp is needed,
6147 #  Makefile.SH takes care of this.)
6148 case "$osname" in
6149 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
6150 esac
6151 # Respect a hint or command-line value.
6152 case "$shrpenv" in
6153 '') shrpenv="$tmp_shrpenv" ;;
6154 esac
6155 case "$ldlibpthname" in
6156 '')     ldlibpthname=LD_LIBRARY_PATH ;;
6157 none)   ldlibpthname='' ;;
6158 esac
6159
6160 : determine where manual pages go
6161 set man1dir man1dir none
6162 eval $prefixit
6163 $cat <<EOM
6164
6165 $spackage has manual pages available in source form.
6166 EOM
6167 case "$nroff" in
6168 nroff)
6169         echo "However, you don't have nroff, so they're probably useless to you."
6170         case "$man1dir" in
6171         '') man1dir="none";;
6172         esac;;
6173 esac
6174 echo "If you don't want the manual sources installed, answer 'none'."
6175 case "$man1dir" in
6176 ' ') dflt=none
6177         ;;
6178 '')
6179         lookpath="$prefixexp/man/man1 $prefixexp/man/l_man/man1"
6180         lookpath="$lookpath $prefixexp/man/p_man/man1"
6181         lookpath="$lookpath $prefixexp/man/u_man/man1"
6182         lookpath="$lookpath $prefixexp/man/man.1"
6183         case "$sysman" in
6184         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
6185         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
6186         esac
6187         set dflt
6188         eval $prefixup
6189         ;;
6190 *)  dflt="$man1dir"
6191         ;;
6192 esac
6193 echo " "
6194 fn=dn+~
6195 rp="Where do the main $spackage manual pages (source) go?"
6196 . ./getfile
6197 if $test "X$man1direxp" != "X$ansexp"; then
6198         installman1dir=''
6199 fi
6200 man1dir="$ans"
6201 man1direxp="$ansexp"
6202 case "$man1dir" in
6203 '')     man1dir=' '
6204         installman1dir='';;
6205 esac
6206
6207 : Change installation prefix, if necessary.
6208 if $test X"$prefix" != X"$installprefix"; then
6209         installman1dir=`echo $man1direxp | $sed "s#^$prefix#$installprefix#"`
6210 else
6211         installman1dir="$man1direxp"
6212 fi
6213
6214 : What suffix to use on installed man pages
6215
6216 case "$man1dir" in
6217 ' ')
6218         man1ext='0'
6219         ;;
6220 *)
6221         rp="What suffix should be used for the main $spackage man pages?"
6222         case "$man1ext" in
6223         '')     case "$man1dir" in
6224                 *1)  dflt=1 ;;
6225                 *1p) dflt=1p ;;
6226                 *1pm) dflt=1pm ;;
6227                 *l) dflt=l;;
6228                 *n) dflt=n;;
6229                 *o) dflt=o;;
6230                 *p) dflt=p;;
6231                 *C) dflt=C;;
6232                 *L) dflt=L;;
6233                 *L1) dflt=L1;;
6234                 *) dflt=1;;
6235                 esac
6236                 ;;
6237         *)      dflt="$man1ext";;
6238         esac
6239         . ./myread
6240         man1ext="$ans"
6241         ;;
6242 esac
6243
6244 : see if we can have long filenames
6245 echo " "
6246 rmlist="$rmlist /tmp/cf$$"
6247 $test -d /tmp/cf$$ || mkdir /tmp/cf$$
6248 first=123456789abcdef
6249 second=/tmp/cf$$/$first
6250 $rm -f $first $second
6251 if (echo hi >$first) 2>/dev/null; then
6252         if $test -f 123456789abcde; then
6253                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
6254                 val="$undef"
6255         else
6256                 if (echo hi >$second) 2>/dev/null; then
6257                         if $test -f /tmp/cf$$/123456789abcde; then
6258                                 $cat <<'EOM'
6259 That's peculiar... You can have filenames longer than 14 characters, but only
6260 on some of the filesystems.  Maybe you are using NFS.  Anyway, to avoid problems
6261 I shall consider your system cannot support long filenames at all.
6262 EOM
6263                                 val="$undef"
6264                         else
6265                                 echo 'You can have filenames longer than 14 characters.' >&4
6266                                 val="$define"
6267                         fi
6268                 else
6269                         $cat <<'EOM'
6270 How confusing! Some of your filesystems are sane enough to allow filenames
6271 longer than 14 characters but some others like /tmp can't even think about them.
6272 So, for now on, I shall assume your kernel does not allow them at all.
6273 EOM
6274                         val="$undef"
6275                 fi
6276         fi
6277 else
6278         $cat <<'EOM'
6279 You can't have filenames longer than 14 chars.  You can't even think about them!
6280 EOM
6281         val="$undef"
6282 fi 
6283 set d_flexfnam
6284 eval $setvar
6285 $rm -rf /tmp/cf$$ 123456789abcde*
6286
6287 : determine where library module manual pages go
6288 set man3dir man3dir none
6289 eval $prefixit
6290 $cat <<EOM
6291
6292 $spackage has manual pages for many of the library modules.
6293 EOM
6294
6295 case "$nroff" in
6296 nroff)
6297         $cat <<'EOM'
6298 However, you don't have nroff, so they're probably useless to you.
6299 EOM
6300         case "$man3dir" in
6301         '') man3dir="none";;
6302         esac;;
6303 esac
6304
6305 case "$d_flexfnam" in
6306 undef)
6307         $cat <<'EOM'
6308 However, your system can't handle the long file names like File::Basename.3. 
6309 EOM
6310         case "$man3dir" in
6311         '') man3dir="none";;
6312         esac;;
6313 esac
6314
6315 echo "If you don't want the manual sources installed, answer 'none'."
6316 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6317 case "$man3dir" in
6318 '')     dflt=`echo $man1dir | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
6319         if $test -d "$privlib/man/man3"; then
6320                 cat <<EOM >&4
6321
6322 WARNING:  Previous versions of perl installed man3 pages into
6323 $privlib/man/man3.  This version will suggest a 
6324 new default of $dflt.  
6325 EOM
6326                 tdflt=$dflt
6327                 dflt='n'
6328                 rp='Do you wish to preserve the old behavior?(y/n)'
6329                 . ./myread
6330                 case "$ans" in
6331                 y*) dflt="$privlib/man/man3" ;;
6332                 *)  dflt=$tdflt ;;
6333                 esac
6334     fi
6335         ;;
6336 ' ') dflt=none;;
6337 *)      dflt="$man3dir" ;;
6338 esac
6339 echo " "
6340 fn=dn+~
6341 rp="Where do the $package library man pages (source) go?"
6342 . ./getfile
6343 man3dir="$ans"
6344 man3direxp="$ansexp"
6345 case "$man1dir" in
6346 '')     man3dir=' '
6347         installman3dir='';;
6348 esac
6349
6350 : Change installation prefix, if necessary.
6351 if $test X"$prefix" != X"$installprefix"; then
6352         installman3dir=`echo $man3direxp | $sed "s#^$prefix#$installprefix#"`
6353 else
6354         installman3dir="$man3direxp"
6355 fi
6356
6357 : What suffix to use on installed man pages
6358 case "$man3dir" in
6359 ' ')
6360         man3ext='0'
6361         ;;
6362 *)
6363         rp="What suffix should be used for the $package library man pages?"
6364         case "$man3ext" in
6365         '')     case "$man3dir" in
6366                 *3)  dflt=3 ;;
6367                 *3p) dflt=3p ;;
6368                 *3pm) dflt=3pm ;;
6369                 *l) dflt=l;;
6370                 *n) dflt=n;;
6371                 *o) dflt=o;;
6372                 *p) dflt=p;;
6373                 *C) dflt=C;;
6374                 *L) dflt=L;;
6375                 *L3) dflt=L3;;
6376                 *) dflt=3;;
6377                 esac
6378                 ;;
6379         *)      dflt="$man3ext";;
6380         esac
6381         . ./myread
6382         man3ext="$ans"
6383         ;;
6384 esac
6385
6386 : see if we have to deal with yellow pages, now NIS.
6387 if $test -d /usr/etc/yp || $test -d /etc/yp; then
6388         if $test -f /usr/etc/nibindd; then
6389                 echo " "
6390                 echo "I'm fairly confident you're on a NeXT."
6391                 echo " "
6392                 rp='Do you get the hosts file via NetInfo?'
6393                 dflt=y
6394                 case "$hostcat" in
6395                 nidump*) ;;
6396                 '') ;;
6397                 *) dflt=n;;
6398                 esac
6399                 . ./myread
6400                 case "$ans" in
6401                 y*) hostcat='nidump hosts .';;
6402                 *)      case "$hostcat" in
6403                         nidump*) hostcat='';;
6404                         esac
6405                         ;;
6406                 esac
6407         fi
6408         case "$hostcat" in
6409         nidump*) ;;
6410         *)
6411                 case "$hostcat" in
6412                 *ypcat*) dflt=y;;
6413                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
6414                                 dflt=y
6415                         else
6416                                 dflt=n
6417                         fi;;
6418                 *) dflt=n;;
6419                 esac
6420                 echo " "
6421                 rp='Are you getting the hosts file via yellow pages?'
6422                 . ./myread
6423                 case "$ans" in
6424                 y*) hostcat='ypcat hosts';;
6425                 *) hostcat='cat /etc/hosts';;
6426                 esac
6427                 ;;
6428         esac
6429 fi
6430 case "$hostcat" in
6431 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
6432 esac
6433 case "$groupcat" in
6434 '') test -f /etc/group && groupcat='cat /etc/group';;
6435 esac
6436 case "$passcat" in
6437 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
6438 esac
6439
6440 : now get the host name
6441 echo " "
6442 echo "Figuring out host name..." >&4
6443 case "$myhostname" in
6444 '') cont=true
6445         echo 'Maybe "hostname" will work...'
6446         if tans=`sh -c hostname 2>&1` ; then
6447                 myhostname=$tans
6448                 phostname=hostname
6449                 cont=''
6450         fi
6451         ;;
6452 *) cont='';;
6453 esac
6454 if $test "$cont"; then
6455         if ./xenix; then
6456                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
6457                 if tans=`cat /etc/systemid 2>&1` ; then
6458                         myhostname=$tans
6459                         phostname='cat /etc/systemid'
6460                         echo "Whadyaknow.  Xenix always was a bit strange..."
6461                         cont=''
6462                 fi
6463         elif $test -r /etc/systemid; then
6464                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
6465         fi
6466 fi
6467 if $test "$cont"; then
6468         echo 'No, maybe "uuname -l" will work...'
6469         if tans=`sh -c 'uuname -l' 2>&1` ; then
6470                 myhostname=$tans
6471                 phostname='uuname -l'
6472         else
6473                 echo 'Strange.  Maybe "uname -n" will work...'
6474                 if tans=`sh -c 'uname -n' 2>&1` ; then
6475                         myhostname=$tans
6476                         phostname='uname -n'
6477                 else
6478                         echo 'Oh well, maybe I can mine it out of whoami.h...'
6479                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
6480                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
6481                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
6482                         else
6483                                 case "$myhostname" in
6484                                 '') echo "Does this machine have an identity crisis or something?"
6485                                         phostname='';;
6486                                 *)
6487                                         echo "Well, you said $myhostname before..."
6488                                         phostname='echo $myhostname';;
6489                                 esac
6490                         fi
6491                 fi
6492         fi
6493 fi
6494 : you do not want to know about this
6495 set $myhostname
6496 myhostname=$1
6497
6498 : verify guess
6499 if $test "$myhostname" ; then
6500         dflt=y
6501         rp='Your host name appears to be "'$myhostname'".'" Right?"
6502         . ./myread
6503         case "$ans" in
6504         y*) ;;
6505         *) myhostname='';;
6506         esac
6507 fi
6508
6509 : bad guess or no guess
6510 while $test "X$myhostname" = X ; do
6511         dflt=''
6512         rp="Please type the (one word) name of your host:"
6513         . ./myread
6514         myhostname="$ans"
6515 done
6516
6517 : translate upper to lower if necessary
6518 case "$myhostname" in
6519 *[A-Z]*)
6520         echo "(Normalizing case in your host name)"
6521         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
6522         ;;
6523 esac
6524
6525 case "$myhostname" in
6526 *.*)
6527         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
6528         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
6529         echo "(Trimming domain name from host name--host name is now $myhostname)"
6530         ;;
6531 *) case "$mydomain" in
6532         '')
6533                 {
6534                         test "X$hostcat" = "Xypcat hosts" &&
6535                         ypmatch "$myhostname" hosts 2>/dev/null |\
6536                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
6537                         $test -s hosts
6538                 } || {
6539                         test "X$hostcat" != "X" &&
6540                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
6541                                         /[       ]$myhostname[  . ]/p" > hosts
6542                 }
6543                 tmp_re="[       . ]"
6544                 $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
6545                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
6546                 dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
6547                         hosts | $sort | $uniq | \
6548                         $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
6549                 case `$echo X$dflt` in
6550                 X*\ *)  echo "(Several hosts in /etc/hosts matched hostname)"
6551                         dflt=.
6552                         ;;
6553                 X.) echo "(You do not have fully-qualified names in /etc/hosts)"
6554                         ;;
6555                 esac
6556                 case "$dflt" in
6557                 .)
6558                         tans=`./loc resolv.conf X /etc /usr/etc`
6559                         if $test -f "$tans"; then
6560                                 echo "(Attempting domain name extraction from $tans)"
6561                                 dflt=.`$sed -n -e 's/   / /g' \
6562                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
6563                                   | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
6564                                 case "$dflt" in
6565                                 .) dflt=.`$sed -n -e 's/        / /g' \
6566                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
6567                                      | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
6568                                         ;;
6569                                 esac
6570                         fi
6571                         ;;
6572                 esac
6573                 case "$dflt" in
6574                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
6575                         dflt=.`sh -c domainname 2>/dev/null`
6576                         case "$dflt" in
6577                         '') dflt='.';;
6578                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
6579                         esac
6580                         ;;
6581                 esac
6582                 case "$dflt" in
6583                 .) echo "(Lost all hope -- silly guess then)"
6584                         dflt='.uucp'
6585                         ;;
6586                 esac
6587                 $rm -f hosts
6588                 ;;
6589         *) dflt="$mydomain";;
6590         esac;;
6591 esac
6592 echo " "
6593 rp="What is your domain name?"
6594 . ./myread
6595 tans="$ans"
6596 case "$ans" in
6597 '') ;;
6598 .*) ;;
6599 *) tans=".$tans";;
6600 esac
6601 mydomain="$tans"
6602
6603 : translate upper to lower if necessary
6604 case "$mydomain" in
6605 *[A-Z]*)
6606         echo "(Normalizing case in your domain name)"
6607         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
6608         ;;
6609 esac
6610
6611 : a little sanity check here
6612 case "$phostname" in
6613 '') ;;
6614 *)
6615         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
6616         $myhostname$mydomain|$myhostname) ;;
6617         *)
6618                 case "$phostname" in
6619                 sed*)
6620                         echo "(That doesn't agree with your whoami.h file, by the way.)"
6621                         ;;
6622                 *)
6623                         echo "(That doesn't agree with your $phostname command, by the way.)"
6624                         ;;
6625                 esac
6626         ;;
6627         esac
6628         ;;
6629 esac
6630
6631 $cat <<EOM
6632
6633 I need to get your e-mail address in Internet format if possible, i.e.
6634 something like user@host.domain. Please answer accurately since I have
6635 no easy means to double check it. The default value provided below
6636 is most probably close to the reality but may not be valid from outside
6637 your organization...
6638
6639 EOM
6640 cont=x
6641 while test "$cont"; do
6642         case "$cf_email" in
6643         '') dflt="$cf_by@$myhostname$mydomain";;
6644         *) dflt="$cf_email";;
6645         esac
6646         rp='What is your e-mail address?'
6647         . ./myread
6648         cf_email="$ans"
6649         case "$cf_email" in
6650         *@*.*) cont='' ;;
6651         *)
6652                 rp='Address does not look like an Internet one.  Use it anyway?'
6653                 case "$fastread" in
6654                 yes) dflt=y ;;
6655                 *) dflt=n ;;
6656                 esac
6657                 . ./myread
6658                 case "$ans" in
6659                 y*) cont='' ;;
6660                 *) echo " " ;;
6661                 esac
6662                 ;;
6663         esac
6664 done
6665
6666 $cat <<EOM
6667
6668 If you or somebody else will be maintaining perl at your site, please
6669 fill in the correct e-mail address here so that they may be contacted
6670 if necessary. Currently, the "perlbug" program included with perl
6671 will send mail to this address in addition to perlbug@perl.com. You may
6672 enter "none" for no administrator.
6673
6674 EOM
6675 case "$perladmin" in
6676 '') dflt="$cf_email";;
6677 *) dflt="$perladmin";;
6678 esac
6679 rp='Perl administrator e-mail address'
6680 . ./myread
6681 perladmin="$ans"
6682
6683 : figure out how to guarantee perl startup
6684 case "$startperl" in
6685 '')
6686         case "$sharpbang" in
6687         *!)
6688                 $cat <<EOH
6689
6690 I can use the #! construct to start perl on your system. This will
6691 make startup of perl scripts faster, but may cause problems if you
6692 want to share those scripts and perl is not in a standard place
6693 ($binexp/perl) on all your platforms. The alternative is to force
6694 a shell by starting the script with a single ':' character.
6695
6696 EOH
6697                 dflt="$binexp/perl"
6698                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
6699                 . ./myread
6700                 case "$ans" in
6701                 none)   startperl=": # use perl";;
6702                 *)      startperl="#!$ans"
6703                         if $test 30 -lt `echo "$ans" | wc -c`; then
6704                                 $cat >&4 <<EOM
6705
6706 WARNING:  Some systems limit the #! command to 32 characters.
6707 If you experience difficulty running Perl scripts with #!, try
6708 installing Perl in a directory with a shorter pathname.
6709
6710 EOM
6711                         fi ;;
6712                 esac
6713                 ;;
6714         *) startperl=": # use perl"
6715                 ;;
6716         esac
6717         ;;
6718 esac
6719 echo "I'll use $startperl to start perl scripts."
6720
6721 : figure best path for perl in scripts
6722 case "$perlpath" in
6723 '')
6724         perlpath="$binexp/perl"
6725         case "$startperl" in
6726         *!*) ;;
6727         *)
6728                 $cat <<EOH
6729
6730 I will use the "eval 'exec'" idiom to start Perl on your system.
6731 I can use the full path of your Perl binary for this purpose, but
6732 doing so may cause problems if you want to share those scripts and
6733 Perl is not always in a standard place ($binexp/perl).
6734
6735 EOH
6736                 dflt="$binexp/perl"
6737                 rp="What path shall I use in \"eval 'exec'\"?"
6738                 . ./myread
6739                 perlpath="$ans"
6740                 ;;
6741         esac
6742         ;;
6743 esac
6744 case "$startperl" in
6745 *!*)    ;;
6746 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
6747 esac
6748
6749 : determine where public executable scripts go
6750 set scriptdir scriptdir
6751 eval $prefixit
6752 case "$scriptdir" in
6753 '')
6754         dflt="$bin"
6755         : guess some guesses
6756         $test -d /usr/share/scripts && dflt=/usr/share/scripts
6757         $test -d /usr/share/bin     && dflt=/usr/share/bin
6758         $test -d /usr/local/script  && dflt=/usr/local/script
6759         $test -d /usr/local/scripts && dflt=/usr/local/scripts
6760         $test -d $prefixexp/script  && dflt=$prefixexp/script
6761         set dflt
6762         eval $prefixup
6763         ;;
6764 *)  dflt="$scriptdir"
6765         ;;
6766 esac
6767 $cat <<EOM
6768  
6769 Some installations have a separate directory just for executable scripts so
6770 that they can mount it across multiple architectures but keep the scripts in
6771 one spot.  You might, for example, have a subdirectory of /usr/share for this.
6772 Or you might just lump your scripts in with all your other executables.
6773  
6774 EOM
6775 fn=d~
6776 rp='Where do you keep publicly executable scripts?'
6777 . ./getfile
6778 if $test "X$ansexp" != "X$scriptdirexp"; then
6779         installscript=''
6780 fi
6781 scriptdir="$ans"
6782 scriptdirexp="$ansexp"
6783 : Change installation prefix, if necessary.
6784 if $test X"$prefix" != X"$installprefix"; then
6785         installscript=`echo $scriptdirexp | sed "s#^$prefix#$installprefix#"`
6786 else
6787         installscript="$scriptdirexp"
6788 fi
6789
6790 $cat <<EOM
6791
6792 After $package is installed, you may wish to install various
6793 add-on modules and utilities.  Typically, these add-ons will
6794 be installed under $prefix with the rest
6795 of this package.  However, you may wish to install such add-ons
6796 elsewhere under a different prefix.
6797
6798 If you do not wish to put everything under a single prefix, that's
6799 ok.  You will be prompted for the individual locations; this siteprefix
6800 is only used to suggest the defaults.
6801
6802 The default should be fine for most people.
6803
6804 EOM
6805 fn=d~+
6806 rp='Installation prefix to use for add-on modules and utilities?'
6807 : XXX Here might be another good place for an installstyle setting.
6808 case "$siteprefix" in
6809 '') dflt=$prefix ;;
6810 *)  dflt=$siteprefix ;;
6811 esac
6812 . ./getfile
6813 oldsiteprefix=''
6814 case "$siteprefix" in
6815 '') ;;
6816 *)
6817         case "$ans" in
6818         "$prefix") ;;
6819         *) oldsiteprefix="$prefix";;
6820         esac
6821         ;;
6822 esac
6823 siteprefix="$ans"
6824 siteprefixexp="$ansexp"
6825
6826 : determine where site specific libraries go.
6827 : Usual default is /usr/local/lib/perl5/site_perl
6828 : The default "style" setting is made in installstyle.U
6829 : XXX No longer works with Prefixit stuff.
6830 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6831 case "$installstyle" in
6832 *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog ;;
6833 *)       dflt=$siteprefix/lib/site_$prog ;;
6834 esac
6835 $cat <<EOM
6836
6837 The installation process will create a directory for
6838 site-specific extensions and modules.  Most users find it convenient
6839 to place all site-specific files in this directory rather than in the
6840 main distribution directory.
6841
6842 EOM
6843 fn=d~+
6844 rp='Pathname for the site-specific library files?'
6845 . ./getfile
6846 sitelib="$ans"
6847 sitelibexp="$ansexp"
6848 : Change installation prefix, if necessary.
6849 if $test X"$prefix" != X"$installprefix"; then
6850         installsitelib=`echo $sitelibexp | sed "s#^$prefix#$installprefix#"`
6851 else
6852         installsitelib="$sitelibexp"
6853 fi
6854
6855 : determine where site specific architecture-dependent libraries go.
6856 : sitelib  default is /usr/local/lib/perl5/site_perl/
6857 : sitearch default is /usr/local/lib/perl5/site_perl/$apiversion/$archname
6858 : sitelib may have an optional trailing /share.
6859 tdflt=`echo $sitelib | $sed 's,/share$,,'`
6860 tdflt="$tdflt/$apiversion/$archname"
6861 set sitearch sitearch none
6862 eval $prefixit
6863 case "$sitearch" in
6864 '')     dflt="$tdflt" ;;
6865 *)      dflt="$sitearch" ;;
6866 esac
6867 $cat <<EOM
6868
6869 The installation process will also create a directory for
6870 architecture-dependent site-specific extensions and modules.
6871
6872 EOM
6873 fn=nd~+
6874 rp='Pathname for the site-specific architecture-dependent library files?'
6875 . ./getfile
6876 sitearch="$ans"
6877 sitearchexp="$ansexp"
6878 : Change installation prefix, if necessary.
6879 if $test X"$prefix" != X"$installprefix"; then
6880         installsitearch=`echo $sitearchexp | sed "s#^$prefix#$installprefix#"`
6881 else
6882         installsitearch="$sitearchexp"
6883 fi
6884
6885 : determine where add-on public executables go
6886 case "$sitebin" in
6887 '')     dflt=$siteprefix/bin ;;
6888 *)      dflt=$sitebin ;;
6889 esac
6890 fn=d~
6891 rp='Pathname where the add-on public executables should be installed?'
6892 . ./getfile
6893 sitebin="$ans"
6894 sitebinexp="$ansexp"
6895 : Change installation prefix, if necessary.
6896 if $test X"$prefix" != X"$installprefix"; then
6897         installsitebin=`echo $sitebinexp | sed "s#^$prefix#$installprefix#"`
6898 else
6899         installsitebin="$sitebinexp"
6900 fi
6901
6902 cat <<EOM
6903
6904 Perl can be built to take advantage of long doubles which
6905 (if available) may give more accuracy and range for floating point numbers.
6906
6907 If this doesn't make any sense to you, just accept the default 'n'.
6908 EOM
6909
6910 case "$ccflags" in
6911 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
6912 esac
6913
6914 case "$uselongdouble" in
6915 $define|true|[yY]*)     dflt='y';;
6916 *) dflt='n';;
6917 esac
6918 rp='Try to use long doubles if available?'
6919 . ./myread
6920 case "$ans" in
6921 y|Y)    val="$define"   ;;
6922 *)      val="$undef"    ;;
6923 esac
6924 set uselongdouble
6925 eval $setvar
6926
6927 case "$uselongdouble" in
6928 true|[yY]*) uselongdouble="$define" ;;
6929 esac
6930
6931 case "$uselongdouble" in
6932 $define)
6933 : Look for a hint-file generated 'call-back-unit'.  If the
6934 : user has specified that long doubles should be used,
6935 : we may need to set or change some other defaults.
6936         if $test -f uselongdouble.cbu; then
6937                 echo "Your platform has some specific hints for long doubles, using them..."
6938                 . ./uselongdouble.cbu
6939         else
6940                 $cat <<EOM
6941 (Your platform doesn't have any specific hints for long doubles.)
6942 EOM
6943         fi
6944         ;;
6945 esac
6946
6947 cat <<EOM
6948
6949 Perl can be built to take advantage of long longs which
6950 (if available) may give more range for integer numbers.
6951
6952 If this doesn't make any sense to you, just accept the default 'n'.
6953 EOM
6954
6955 case "$ccflags" in
6956 *-DUSE_LONG_LONG*) uselonglong="$define" ;;
6957 esac
6958
6959 case "$uselonglong" in
6960 $define|true|[yY]*)     dflt='y';;
6961 *) dflt='n';;
6962 esac
6963 rp='Try to use long longs if available?'
6964 . ./myread
6965 case "$ans" in
6966 y|Y)    val="$define"   ;;
6967 *)      val="$undef"    ;;
6968 esac
6969 set uselonglong
6970 eval $setvar
6971
6972 case "$uselonglong" in
6973 true|[yY]*) uselonglong="$define" ;;
6974 esac
6975
6976 case "$uselonglong" in
6977 $define)
6978 : Look for a hint-file generated 'call-back-unit'.  If the
6979 : user has specified that long longs should be used,
6980 : we may need to set or change some other defaults.
6981         if $test -f uselonglong.cbu; then
6982                 echo "Your platform has some specific hints for long longs, using them..."
6983                 . ./uselonglong.cbu
6984         else
6985                 $cat <<EOM
6986 (Your platform doesn't have any specific hints for long longs.)
6987 EOM
6988         fi
6989         ;;
6990 esac
6991
6992 cat <<EOM
6993
6994 Previous version of $package used the standard IO mechanisms as defined
6995 in <stdio.h>.  Versions 5.003_02 and later of perl allow alternate IO
6996 mechanisms via a "PerlIO" abstraction, but the stdio mechanism is still
6997 the default.  This abstraction layer can use AT&T's sfio (if you already
6998 have sfio installed) or regular stdio.  Using PerlIO with sfio may cause
6999 problems with some extension modules.  Using PerlIO with stdio is safe,
7000 but it is slower than plain stdio and therefore is not the default.
7001
7002 If this doesn't make any sense to you, just accept the default 'n'.
7003 EOM
7004 case "$useperlio" in
7005 $define|true|[yY]*)     dflt='y';;
7006 *) dflt='n';;
7007 esac
7008 rp='Use the experimental PerlIO abstraction layer?'
7009 . ./myread
7010 case "$ans" in
7011 y|Y) 
7012         val="$define"
7013         ;;     
7014 *)      
7015         echo "Ok, doing things the stdio way"
7016         val="$undef"
7017         ;;
7018 esac
7019 set useperlio
7020 eval $setvar 
7021
7022 case "$vendorprefix" in
7023 '')     d_vendorbin="$undef"
7024         vendorbin=''
7025         vendorbinexp=''
7026         ;;
7027 *)      d_vendorbin="$define"
7028         : determine where vendor-supplied executables go.
7029         dflt=$vendorprefix/bin
7030         fn=d~+
7031         rp='Pathname for the vendor-supplied executables directory?'
7032         . ./getfile
7033         vendorbin="$ans"
7034         vendorbinexp="$ansexp"
7035         : Change installation prefix, if necessary.
7036         if $test X"$prefix" != X"$installprefix"; then
7037                 installvendorbin=`echo $vendorbinexp | $sed "s#^$prefix#$installprefix#"`
7038         else
7039                 installvendorbin="$vendorbinexp"
7040         fi
7041         ;;
7042 esac
7043
7044 : Check how to convert floats to strings.
7045 if test "X$d_Gconvert" = X; then
7046         echo " "
7047         echo "Checking for an efficient way to convert floats to strings."
7048         $cat >try.c <<'EOP'
7049 #ifdef TRY_gconvert
7050 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
7051 char *myname = "gconvert";
7052 #endif
7053 #ifdef TRY_gcvt
7054 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
7055 char *myname = "gcvt";
7056 #endif
7057 #ifdef TRY_sprintf
7058 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
7059 char *myname = "sprintf";
7060 #endif
7061
7062 #include <stdio.h>
7063
7064 int
7065 checkit(expect, got)
7066 char *expect;
7067 char *got;
7068 {
7069     if (strcmp(expect, got)) {
7070                 printf("%s oddity:  Expected %s, got %s\n",
7071                         myname, expect, got);
7072                 exit(1);
7073         }
7074 }
7075
7076 int main()
7077
7078         char buf[64]; 
7079         buf[63] = '\0';
7080
7081         /* This must be 1st test on (which?) platform */
7082         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
7083         Gconvert(0.1, 8, 0, buf);
7084         checkit("0.1", buf);
7085
7086         Gconvert(1.0, 8, 0, buf); 
7087         checkit("1", buf);
7088
7089         Gconvert(0.0, 8, 0, buf); 
7090         checkit("0", buf);
7091
7092         Gconvert(-1.0, 8, 0, buf); 
7093         checkit("-1", buf);
7094
7095         /* Some Linux gcvt's give 1.e+5 here. */
7096         Gconvert(100000.0, 8, 0, buf); 
7097         checkit("100000", buf);
7098         
7099         /* Some Linux gcvt's give -1.e+5 here. */
7100         Gconvert(-100000.0, 8, 0, buf); 
7101         checkit("-100000", buf);
7102
7103         exit(0);
7104 }
7105 EOP
7106         case "$d_Gconvert" in
7107         gconvert*) xxx_list='gconvert gcvt sprintf' ;;
7108         gcvt*) xxx_list='gcvt gconvert sprintf' ;;
7109         sprintf*) xxx_list='sprintf gconvert gcvt' ;;
7110         *) xxx_list='gconvert gcvt sprintf' ;;
7111         esac
7112
7113         for xxx_convert in $xxx_list; do
7114                 echo "Trying $xxx_convert"
7115                 $rm -f try try$_o
7116                 set try -DTRY_$xxx_convert
7117                 if eval $compile; then
7118                         echo "$xxx_convert" found. >&4
7119                         if ./try; then
7120                                 echo "I'll use $xxx_convert to convert floats into a string." >&4
7121                                 break;
7122                         else
7123                                 echo "...But $xxx_convert didn't work as I expected."
7124                         fi
7125                 else
7126                         echo "$xxx_convert NOT found." >&4
7127                 fi
7128         done
7129                 
7130         case "$xxx_convert" in
7131         gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
7132         gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
7133         *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
7134         esac
7135 fi
7136
7137 : check for length of double
7138 echo " "
7139 case "$doublesize" in
7140 '')
7141         $echo $n "Checking to see how big your double precision numbers are...$c" >&4
7142         $cat >try.c <<'EOCP'
7143 #include <stdio.h>
7144 int main()
7145 {
7146     printf("%d\n", (int)sizeof(double));
7147     exit(0);
7148 }
7149 EOCP
7150         set try
7151         if eval $compile_ok; then
7152                 doublesize=`./try`
7153                 $echo " $doublesize bytes." >&4
7154         else
7155                 dflt='8'
7156                 echo "(I can't seem to compile the test program.  Guessing...)"
7157                 rp="What is the size of a double precision number (in bytes)?"
7158                 . ./myread
7159                 doublesize="$ans"
7160         fi
7161         ;;
7162 esac
7163 $rm -f try.c try
7164
7165 : check for long doubles
7166 echo " "
7167 $echo $n "Checking to see if your system supports long double..." $c >&4
7168 echo 'int main() { long double x = 7.0; }' > try.c
7169 set try
7170 if eval $compile; then
7171         val="$define"
7172         echo " Yes, it does." >&4
7173 else
7174         val="$undef"
7175         echo " No, it doesn't." >&4
7176 fi
7177 $rm try.*
7178 set d_longdbl
7179 eval $setvar
7180
7181 : check for length of long double
7182 case "${d_longdbl}${longdblsize}" in
7183 $define)
7184         echo " "
7185         $echo $n "Checking to see how big your long doubles are..." $c >&4
7186         $cat >try.c <<'EOCP'
7187 #include <stdio.h>
7188 int main()
7189 {
7190         printf("%d\n", sizeof(long double));
7191 }
7192 EOCP
7193         set try
7194         set try
7195         if eval $compile; then
7196                 longdblsize=`./try$exe_ext`
7197                 $echo " $longdblsize bytes." >&4
7198         else
7199                 dflt='8'
7200                 echo " "
7201                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
7202                 rp="What is the size of a long double (in bytes)?"
7203                 . ./myread
7204                 longdblsize="$ans"
7205         fi
7206         if $test "X$doublesize" = "X$longdblsize"; then
7207                 echo "(That isn't any different from an ordinary double.)"
7208         fi      
7209         ;;
7210 esac
7211 $rm -f try.* try
7212
7213 echo " "
7214
7215 if $test X"$d_longdbl" = X"$define"; then
7216
7217 echo "Checking how to print long doubles..." >&4
7218
7219 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
7220         $cat >try.c <<'EOCP'
7221 #include <sys/types.h>
7222 #include <stdio.h>
7223 int main() {
7224   double d = 123.456;
7225   printf("%.3f\n", d);
7226 }
7227 EOCP
7228         set try
7229         if eval $compile; then
7230                 yyy=`./try$exe_ext`
7231                 case "$yyy" in
7232                 123.456)
7233                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
7234                         sPRIFldbl='"F"'; sPRIGldbl='"G"'; sPRIEldbl='"E"';
7235                         echo "We will use %f."
7236                         ;;
7237                 esac
7238         fi
7239 fi
7240
7241 if $test X"$sPRIfldbl" = X; then
7242         $cat >try.c <<'EOCP'
7243 #include <sys/types.h>
7244 #include <stdio.h>
7245 int main() {
7246   long double d = 123.456;
7247   printf("%.3llf\n", d);
7248 }
7249 EOCP
7250         set try
7251         if eval $compile; then
7252                 yyy=`./try$exe_ext`
7253                 case "$yyy" in
7254                 123.456)
7255                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
7256                         sPRIFldbl='"llF"'; sPRIGldbl='"llG"'; sPRIEldbl='"llE"';
7257                         echo "We will use %llf."
7258                         ;;
7259                 esac
7260         fi
7261 fi
7262
7263 if $test X"$sPRIfldbl" = X; then
7264         $cat >try.c <<'EOCP'
7265 #include <sys/types.h>
7266 #include <stdio.h>
7267 int main() {
7268   long double d = 123.456;
7269   printf("%.3Lf\n", d);
7270 }
7271 EOCP
7272         set try
7273         if eval $compile; then
7274                 yyy=`./try$exe_ext`
7275                 case "$yyy" in
7276                 123.456)
7277                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
7278                         sPRIFldbl='"LF"'; sPRIGldbl='"LG"'; sPRIEldbl='"LE"';
7279                         echo "We will use %Lf."
7280                         ;;
7281                 esac
7282         fi
7283 fi
7284
7285 if $test X"$sPRIfldbl" = X; then
7286         $cat >try.c <<'EOCP'
7287 #include <sys/types.h>
7288 #include <stdio.h>
7289 int main() {
7290   long double d = 123.456;
7291   printf("%.3lf\n", d);
7292 }
7293 EOCP
7294         set try
7295         if eval $compile; then
7296                 yyy=`./try$exe_ext`
7297                 case "$yyy" in
7298                 123.456)
7299                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
7300                         sPRIFldbl='"lF"'; sPRIGldbl='"lG"'; sPRIEldbl='"lE"';
7301                         echo "We will use %lf."
7302                         ;;
7303                 esac
7304         fi
7305 fi
7306
7307 if $test X"$sPRIfldbl" = X; then
7308         echo "Cannot figure out how to print long doubles." >&4
7309 fi
7310
7311 $rm -f try try.*
7312
7313 fi # d_longdbl
7314
7315 case "$sPRIfldbl" in
7316 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef"; 
7317         d_PRIFldbl="$undef"; d_PRIGldbl="$undef"; d_PRIEldbl="$undef"; 
7318         ;;
7319 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define"; 
7320         d_PRIFldbl="$define"; d_PRIGldbl="$define"; d_PRIEldbl="$define"; 
7321         ;;
7322 esac
7323
7324 : Initialize h_fcntl
7325 h_fcntl=false
7326
7327 : Initialize h_sysfile
7328 h_sysfile=false
7329
7330 : access call always available on UNIX
7331 set access d_access
7332 eval $inlibc
7333
7334 : locate the flags for 'access()'
7335 case "$d_access" in
7336 "$define")
7337         echo " "
7338         $cat >access.c <<'EOCP'
7339 #include <sys/types.h>
7340 #ifdef I_FCNTL
7341 #include <fcntl.h>
7342 #endif
7343 #ifdef I_SYS_FILE
7344 #include <sys/file.h>
7345 #endif
7346 #ifdef I_UNISTD
7347 #include <unistd.h>
7348 #endif
7349 int main() {
7350         exit(R_OK);
7351 }
7352 EOCP
7353         : check sys/file.h first, no particular reason here
7354         if $test `./findhdr sys/file.h` && \
7355                 $cc $cppflags -DI_SYS_FILE -o access access.c >/dev/null 2>&1 ; then
7356                 h_sysfile=true;
7357                 echo "<sys/file.h> defines the *_OK access constants." >&4
7358         elif $test `./findhdr fcntl.h` && \
7359                 $cc $cppflags -DI_FCNTL -o access access.c >/dev/null 2>&1 ; then
7360                 h_fcntl=true;
7361                 echo "<fcntl.h> defines the *_OK access constants." >&4
7362         elif $test `./findhdr unistd.h` && \
7363                 $cc $cppflags -DI_UNISTD -o access access.c >/dev/null 2>&1 ; then
7364                 echo "<unistd.h> defines the *_OK access constants." >&4
7365         else
7366                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
7367         fi
7368         ;;
7369 esac
7370 $rm -f access*
7371
7372 : see if accessx exists
7373 set accessx d_accessx
7374 eval $inlibc
7375
7376 : see if alarm exists
7377 set alarm d_alarm
7378 eval $inlibc
7379
7380 : see if atolf exists
7381 set atolf d_atolf
7382 eval $inlibc
7383
7384 : see if atoll exists
7385 set atoll d_atoll
7386 eval $inlibc
7387
7388 : Look for GNU-cc style attribute checking
7389 echo " "
7390 echo "Checking whether your compiler can handle __attribute__ ..." >&4
7391 $cat >attrib.c <<'EOCP'
7392 #include <stdio.h>
7393 void croak (char* pat,...) __attribute__((format(printf,1,2),noreturn));
7394 EOCP
7395 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
7396         if $contains 'warning' attrib.out >/dev/null 2>&1; then
7397                 echo "Your C compiler doesn't fully support __attribute__."
7398                 val="$undef"
7399         else
7400                 echo "Your C compiler supports __attribute__."
7401                 val="$define"
7402         fi
7403 else
7404         echo "Your C compiler doesn't seem to understand __attribute__ at all."
7405         val="$undef"
7406 fi
7407 set d_attribut
7408 eval $setvar
7409 $rm -f attrib*
7410
7411 : see if bcmp exists
7412 set bcmp d_bcmp
7413 eval $inlibc
7414
7415 : see if bcopy exists
7416 set bcopy d_bcopy
7417 eval $inlibc
7418
7419 : see if this is a unistd.h system
7420 set unistd.h i_unistd
7421 eval $inhdr
7422
7423 : see if getpgrp exists
7424 set getpgrp d_getpgrp
7425 eval $inlibc
7426
7427 case "$d_getpgrp" in
7428 "$define")
7429         echo " "
7430         echo "Checking to see which flavor of getpgrp is in use..."
7431         $cat >set.c <<EOP
7432 #$i_unistd I_UNISTD
7433 #include <sys/types.h>
7434 #ifdef I_UNISTD
7435 #  include <unistd.h>
7436 #endif
7437 int main()
7438 {
7439         if (getuid() == 0) {
7440                 printf("(I see you are running Configure as super-user...)\n");
7441                 setuid(1);
7442         }
7443 #ifdef TRY_BSD_PGRP
7444         if (getpgrp(1) == 0)
7445                 exit(0);
7446 #else
7447         if (getpgrp() > 0)
7448                 exit(0);
7449 #endif
7450         exit(1);
7451 }
7452 EOP
7453         if $cc -DTRY_BSD_PGRP $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7454                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
7455                 val="$define"
7456         elif $cc $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7457                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
7458                 val="$undef"
7459         else
7460                 echo "I can't seem to compile and run the test program."
7461                 if ./usg; then
7462                         xxx="a USG one, i.e. you use getpgrp()."
7463                 else
7464                         # SVR4 systems can appear rather BSD-ish.
7465                         case "$i_unistd" in
7466                         $undef)
7467                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
7468                                 val="$define"
7469                                 ;;
7470                         $define)
7471                                 xxx="probably a USG one, i.e. you use getpgrp()."
7472                                 val="$undef"
7473                                 ;;
7474                         esac
7475                 fi
7476                 echo "Assuming your getpgrp is $xxx" >&4
7477         fi
7478         ;;
7479 *) val="$undef";;
7480 esac
7481 set d_bsdgetpgrp
7482 eval $setvar
7483 $rm -f set set.c
7484
7485 : see if setpgrp exists
7486 set setpgrp d_setpgrp
7487 eval $inlibc
7488
7489 case "$d_setpgrp" in
7490 "$define")
7491         echo " "
7492         echo "Checking to see which flavor of setpgrp is in use..."
7493         $cat >set.c <<EOP
7494 #$i_unistd I_UNISTD
7495 #include <sys/types.h>
7496 #ifdef I_UNISTD
7497 #  include <unistd.h>
7498 #endif
7499 int main()
7500 {
7501         if (getuid() == 0) {
7502                 printf("(I see you are running Configure as super-user...)\n");
7503                 setuid(1);
7504         }
7505 #ifdef TRY_BSD_PGRP
7506         if (-1 == setpgrp(1, 1))
7507                 exit(0);
7508 #else
7509         if (setpgrp() != -1)
7510                 exit(0);
7511 #endif
7512         exit(1);
7513 }
7514 EOP
7515         if $cc -DTRY_BSD_PGRP $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7516                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
7517                 val="$define"
7518         elif $cc $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7519                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
7520                 val="$undef"
7521         else
7522                 echo "(I can't seem to compile and run the test program.)"
7523                 if ./usg; then
7524                         xxx="a USG one, i.e. you use setpgrp()."
7525                 else
7526                         # SVR4 systems can appear rather BSD-ish.
7527                         case "$i_unistd" in
7528                         $undef)
7529                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
7530                                 val="$define"
7531                                 ;;
7532                         $define)
7533                                 xxx="probably a USG one, i.e. you use setpgrp()."
7534                                 val="$undef"
7535                                 ;;
7536                         esac
7537                 fi
7538                 echo "Assuming your setpgrp is $xxx" >&4
7539         fi
7540         ;;
7541 *) val="$undef";;
7542 esac
7543 set d_bsdsetpgrp
7544 eval $setvar
7545 $rm -f set set.c
7546 : see if bzero exists
7547 set bzero d_bzero
7548 eval $inlibc
7549
7550 : see if signal is declared as pointer to function returning int or void
7551 echo " "
7552 xxx=`./findhdr signal.h`
7553 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
7554 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
7555         echo "You have int (*signal())() instead of void." >&4
7556         val="$undef"
7557 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
7558         echo "You have void (*signal())()." >&4
7559         val="$define"
7560 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
7561         echo "You have int (*signal())() instead of void." >&4
7562         val="$undef"
7563 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
7564         echo "You have void (*signal())()." >&4
7565         val="$define"
7566 else
7567         case "$d_voidsig" in
7568         '')
7569         echo "I can't determine whether signal handler returns void or int..." >&4
7570                 dflt=void
7571                 rp="What type does your signal handler return?"
7572                 . ./myread
7573                 case "$ans" in
7574                 v*) val="$define";;
7575                 *) val="$undef";;
7576                 esac;;
7577         "$define")
7578                 echo "As you already told me, signal handler returns void." >&4
7579                 val="$define"
7580                 ;;
7581         *)      echo "As you already told me, signal handler returns int." >&4
7582                 val="$undef"
7583                 ;;
7584         esac
7585 fi
7586 set d_voidsig
7587 eval $setvar
7588 case "$d_voidsig" in
7589 "$define") signal_t="void";;
7590 *) signal_t="int";;
7591 esac
7592 $rm -f $$.tmp
7593
7594 : check for ability to cast large floats to 32-bit ints.
7595 echo " "
7596 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
7597 if $test "$intsize" -ge 4; then
7598         xxx=int
7599 else
7600         xxx=long
7601 fi
7602 $cat >try.c <<EOCP
7603 #include <stdio.h>
7604 #include <sys/types.h>
7605 #include <signal.h>
7606 $signal_t blech(s) int s; { exit(3); }
7607 int main()
7608 {
7609         $xxx i32;
7610         double f, g;
7611         int result = 0;
7612         char str[16];
7613         signal(SIGFPE, blech);
7614
7615         /* Don't let compiler optimize the test away.  Store the number 
7616            in a writable string for gcc to pass to sscanf under HP/UX.
7617         */
7618         sprintf(str, "2147483647");
7619         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
7620         g = 10 * f;
7621         i32  = ($xxx) g;
7622
7623         /* x86 processors will probably give 0x8000 0000, which is a
7624        sign change.  We don't want that.  We want to mimic SPARC
7625            behavior here, which is to preserve the sign and give
7626            back 0x7fff ffff.
7627         */
7628         if (i32 != ($xxx) f)
7629                 result |= 1;
7630         exit(result);
7631 }
7632 EOCP
7633 set try
7634 if eval $compile_ok; then
7635         ./try
7636         yyy=$?
7637 else
7638         echo "(I can't seem to compile the test program--assuming it can't)"
7639         yyy=1
7640 fi
7641 case "$yyy" in
7642 0)      val="$define"
7643         echo "Yup, it can."
7644         ;;
7645 *)      val="$undef"
7646         echo "Nope, it can't."
7647         ;;
7648 esac
7649 set d_casti32
7650 eval $setvar
7651 $rm -f try try.*
7652
7653 : check for ability to cast negative floats to unsigned
7654 echo " "
7655 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
7656 $cat >try.c <<EOCP
7657 #include <stdio.h>
7658 #include <sys/types.h>
7659 #include <signal.h>
7660 $signal_t blech(s) int s; { exit(7); }
7661 $signal_t blech_in_list(s) int s; { exit(4); }
7662 unsigned long dummy_long(p) unsigned long p; { return p; }
7663 unsigned int dummy_int(p) unsigned int p; { return p; }
7664 unsigned short dummy_short(p) unsigned short p; { return p; }
7665 int main()
7666 {
7667         double f;
7668         unsigned long along;
7669         unsigned int aint;
7670         unsigned short ashort;
7671         int result = 0;
7672         char str[16];
7673         
7674         /* Frustrate gcc-2.7.2's optimizer which failed this test with
7675            a direct f = -123. assignment.  gcc-2.8.0 reportedly
7676            optimized the whole file away
7677         */
7678         /* Store the number in a writable string for gcc to pass to 
7679            sscanf under HP/UX.
7680         */
7681         sprintf(str, "-123");
7682         sscanf(str, "%lf", &f);  /* f = -123.; */
7683
7684         signal(SIGFPE, blech);
7685         along = (unsigned long)f;
7686         aint = (unsigned int)f;
7687         ashort = (unsigned short)f;
7688         if (along != (unsigned long)-123)
7689                 result |= 1;
7690         if (aint != (unsigned int)-123)
7691                 result |= 1;
7692         if (ashort != (unsigned short)-123)
7693                 result |= 1;
7694         sprintf(str, "1073741824.");
7695         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
7696         f = f + f;
7697         along = 0;
7698         along = (unsigned long)f;
7699         if (along != 0x80000000)
7700                 result |= 2;
7701         f -= 1.;
7702         along = 0;
7703         along = (unsigned long)f;
7704         if (along != 0x7fffffff)
7705                 result |= 1;
7706         f += 2.;
7707         along = 0;
7708         along = (unsigned long)f;
7709         if (along != 0x80000001)
7710                 result |= 2;
7711         if (result)
7712                 exit(result);
7713         signal(SIGFPE, blech_in_list);
7714         sprintf(str, "123.");
7715         sscanf(str, "%lf", &f);  /* f = 123.; */
7716         along = dummy_long((unsigned long)f);
7717         aint = dummy_int((unsigned int)f);
7718         ashort = dummy_short((unsigned short)f);
7719         if (along != (unsigned long)123)
7720                 result |= 4;
7721         if (aint != (unsigned int)123)
7722                 result |= 4;
7723         if (ashort != (unsigned short)123)
7724                 result |= 4;
7725         exit(result);
7726
7727 }
7728 EOCP
7729 set try
7730 if eval $compile_ok; then
7731         ./try
7732         castflags=$?
7733 else
7734         echo "(I can't seem to compile the test program--assuming it can't)"
7735         castflags=7
7736 fi
7737 case "$castflags" in
7738 0)      val="$define"
7739         echo "Yup, it can."
7740         ;;
7741 *)      val="$undef"
7742         echo "Nope, it can't."
7743         ;;
7744 esac
7745 set d_castneg
7746 eval $setvar
7747 $rm -f try.*
7748
7749 : see if vprintf exists
7750 echo " "
7751 if set vprintf val -f d_vprintf; eval $csym; $val; then
7752         echo 'vprintf() found.' >&4
7753         val="$define"
7754         $cat >vprintf.c <<'EOF'
7755 #include <varargs.h>
7756
7757 int main() { xxx("foo"); }
7758
7759 xxx(va_alist)
7760 va_dcl
7761 {
7762         va_list args;
7763         char buf[10];
7764
7765         va_start(args);
7766         exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
7767 }
7768 EOF
7769         set vprintf
7770         if eval $compile && ./vprintf; then
7771                 echo "Your vsprintf() returns (int)." >&4
7772                 val2="$undef"
7773         else
7774                 echo "Your vsprintf() returns (char*)." >&4
7775                 val2="$define"
7776         fi
7777 else
7778         echo 'vprintf() NOT found.' >&4
7779                 val="$undef"
7780                 val2="$undef"
7781 fi
7782 set d_vprintf
7783 eval $setvar
7784 val=$val2
7785 set d_charvspr
7786 eval $setvar
7787
7788 : see if chown exists
7789 set chown d_chown
7790 eval $inlibc
7791
7792 : see if chroot exists
7793 set chroot d_chroot
7794 eval $inlibc
7795
7796 : see if chsize exists
7797 set chsize d_chsize
7798 eval $inlibc
7799
7800 : check for const keyword
7801 echo " "
7802 echo 'Checking to see if your C compiler knows about "const"...' >&4
7803 $cat >const.c <<'EOCP'
7804 typedef struct spug { int drokk; } spug;
7805 int main()
7806 {
7807         const char *foo;
7808         const spug y;
7809 }
7810 EOCP
7811 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
7812         val="$define"
7813         echo "Yup, it does."
7814 else
7815         val="$undef"
7816         echo "Nope, it doesn't."
7817 fi
7818 set d_const
7819 eval $setvar
7820
7821 : see if crypt exists
7822 echo " "
7823 if set crypt val -f d_crypt; eval $csym; $val; then
7824         echo 'crypt() found.' >&4
7825         val="$define"
7826         cryptlib=''
7827 else
7828         cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
7829         if $test -z "$cryptlib"; then
7830                 cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
7831         else
7832                 cryptlib=-lcrypt
7833         fi
7834         if $test -z "$cryptlib"; then
7835                 cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
7836         else
7837                 cryptlib=-lcrypt
7838         fi
7839         if $test -z "$cryptlib"; then
7840                 cryptlib=`./loc libcrypt$_a "" $libpth`
7841         else
7842                 cryptlib=-lcrypt
7843         fi
7844         if $test -z "$cryptlib"; then
7845                 echo 'crypt() NOT found.' >&4
7846                 val="$undef"
7847         else
7848                 val="$define"
7849         fi
7850 fi
7851 set d_crypt
7852 eval $setvar
7853
7854 : get csh whereabouts
7855 case "$csh" in
7856 'csh') val="$undef" ;;
7857 *) val="$define" ;;
7858 esac
7859 set d_csh
7860 eval $setvar
7861 : Respect a hint or command line value for full_csh.
7862 case "$full_csh" in
7863 '') full_csh=$csh ;;
7864 esac
7865
7866 : see if cuserid exists
7867 set cuserid d_cuserid
7868 eval $inlibc
7869
7870 : see if this is a limits.h system
7871 set limits.h i_limits
7872 eval $inhdr
7873
7874 : see if this is a float.h system
7875 set float.h i_float
7876 eval $inhdr
7877
7878 : See if number of significant digits in a double precision number is known
7879 echo " "
7880 $cat >dbl_dig.c <<EOM
7881 #$i_limits I_LIMITS
7882 #$i_float I_FLOAT
7883 #ifdef I_LIMITS
7884 #include <limits.h>
7885 #endif
7886 #ifdef I_FLOAT
7887 #include <float.h>
7888 #endif
7889 #ifdef DBL_DIG
7890 printf("Contains DBL_DIG");
7891 #endif
7892 EOM
7893 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
7894 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
7895         echo "DBL_DIG found." >&4
7896         val="$define"
7897 else
7898         echo "DBL_DIG NOT found." >&4
7899         val="$undef"
7900 fi
7901 $rm -f dbl_dig.?
7902 set d_dbl_dig
7903 eval $setvar
7904
7905 : see if difftime exists
7906 set difftime d_difftime
7907 eval $inlibc
7908
7909 : see if this is a dirent system
7910 echo " "
7911 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
7912         val="$define"
7913         echo "<dirent.h> found." >&4
7914 else
7915         val="$undef"
7916         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
7917                 echo "<sys/dir.h> found." >&4
7918                 echo " "
7919         else
7920                 xinc=`./findhdr sys/ndir.h`
7921         fi
7922         echo "<dirent.h> NOT found." >&4
7923 fi
7924 set i_dirent
7925 eval $setvar
7926
7927 : Look for type of directory structure.
7928 echo " "
7929 $cppstdin $cppflags $cppminus < "$xinc" > try.c
7930
7931 case "$direntrytype" in
7932 ''|' ')
7933         case "$i_dirent" in
7934         $define) guess1='struct dirent' ;;
7935         *) guess1='struct direct'  ;;
7936         esac
7937         ;;
7938 *)      guess1="$direntrytype"
7939         ;;
7940 esac
7941
7942 case "$guess1" in
7943 'struct dirent') guess2='struct direct' ;;
7944 *) guess2='struct dirent' ;;
7945 esac
7946                 
7947 if $contains "$guess1" try.c >/dev/null 2>&1; then
7948         direntrytype="$guess1"
7949         echo "Your directory entries are $direntrytype." >&4
7950 elif $contains "$guess2" try.c >/dev/null 2>&1; then
7951         direntrytype="$guess2"
7952         echo "Your directory entries seem to be $direntrytype." >&4
7953 else
7954         echo "I don't recognize your system's directory entries." >&4
7955         rp="What type is used for directory entries on this system?"
7956         dflt="$guess1"
7957         . ./myread
7958         direntrytype="$ans"
7959 fi
7960 $rm -f try.c
7961
7962
7963 : see if the directory entry stores field length
7964 echo " "
7965 $cppstdin $cppflags $cppminus < "$xinc" > try.c
7966 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
7967         echo "Good, your directory entry keeps length information in d_namlen." >&4
7968         val="$define"
7969 else
7970         echo "Your directory entry does not know about the d_namlen field." >&4
7971         val="$undef"
7972 fi
7973 set d_dirnamlen
7974 eval $setvar
7975 $rm -f try.c
7976
7977 : see if dlerror exists
7978 xxx_runnm="$runnm"
7979 runnm=false
7980 set dlerror d_dlerror
7981 eval $inlibc
7982 runnm="$xxx_runnm"
7983
7984 : see if dlfcn is available
7985 set dlfcn.h i_dlfcn
7986 eval $inhdr
7987
7988 case "$usedl" in
7989 $define|y|true)
7990         $cat << EOM
7991
7992 On a few systems, the dynamically loaded modules that perl generates and uses
7993 will need a different extension than shared libs. The default will probably
7994 be appropriate.
7995
7996 EOM
7997         case "$dlext" in
7998         '')     dflt="$so" ;;
7999         *)      dflt="$dlext" ;;
8000         esac
8001         rp='What is the extension of dynamically loaded modules'
8002         . ./myread
8003         dlext="$ans"
8004         ;;
8005 *)
8006         dlext="none"
8007         ;;
8008 esac
8009
8010 : Check if dlsym need a leading underscore
8011 echo " "
8012 val="$undef"
8013
8014 case "$dlsrc" in
8015 dl_dlopen.xs)
8016         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
8017         $cat >dyna.c <<'EOM'
8018 fred () { }
8019 EOM
8020
8021 $cat >fred.c<<EOM
8022
8023 #include <stdio.h>
8024 #$i_dlfcn I_DLFCN
8025 #ifdef I_DLFCN
8026 #include <dlfcn.h>      /* the dynamic linker include file for Sunos/Solaris */
8027 #else
8028 #include <sys/types.h>
8029 #include <nlist.h>
8030 #include <link.h>
8031 #endif
8032
8033 extern int fred() ;
8034
8035 int main()
8036 {
8037     void * handle ;
8038     void * symbol ;
8039 #ifndef RTLD_LAZY
8040     int mode = 1 ;
8041 #else
8042     int mode = RTLD_LAZY ;
8043 #endif
8044     handle = dlopen("./dyna.$dlext", mode) ;
8045     if (handle == NULL) {
8046         printf ("1\n") ;
8047         fflush (stdout) ;
8048         exit(0);
8049     }
8050     symbol = dlsym(handle, "fred") ;
8051     if (symbol == NULL) {
8052         /* try putting a leading underscore */
8053         symbol = dlsym(handle, "_fred") ;
8054         if (symbol == NULL) {
8055             printf ("2\n") ;
8056             fflush (stdout) ;
8057             exit(0);
8058         }
8059         printf ("3\n") ;
8060     }
8061     else
8062         printf ("4\n") ;
8063     fflush (stdout) ;
8064     exit(0);
8065 }
8066 EOM
8067         : Call the object file tmp-dyna.o in case dlext=o.
8068         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 && 
8069                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 && 
8070                 $ld $lddlflags -o dyna.$dlext tmp-dyna${_o} > /dev/null 2>&1 && 
8071                 $cc $ccflags -o fred $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1; then
8072                 xxx=`./fred`
8073                 case $xxx in
8074                 1)      echo "Test program failed using dlopen." >&4
8075                         echo "Perhaps you should not use dynamic loading." >&4;;
8076                 2)      echo "Test program failed using dlsym." >&4
8077                         echo "Perhaps you should not use dynamic loading." >&4;;
8078                 3)      echo "dlsym needs a leading underscore" >&4
8079                         val="$define" ;;
8080                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
8081                 esac
8082         else
8083                 echo "I can't compile and run the test program." >&4
8084                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
8085         fi
8086         ;;
8087 esac
8088                 
8089 $rm -f fred fred.? dyna.$dlext dyna.? tmp-dyna.?
8090
8091 set d_dlsymun
8092 eval $setvar
8093
8094 hasproto='varname=$1; func=$2; shift; shift;
8095 while $test $# -ge 2; do
8096         case "$1" in
8097         $define) echo "#include <$2>";;
8098         esac ;
8099     shift 2;
8100 done > try.c;
8101 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
8102 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
8103         echo "$func() prototype found.";
8104         val="$define";
8105 else
8106         echo "$func() prototype NOT found.";
8107         val="$undef";
8108 fi;
8109 set $varname;
8110 eval $setvar;
8111 $rm -f try.c tryout.c'
8112
8113 : see if prototype for drand48 is available
8114 echo " "
8115 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
8116 eval $hasproto
8117
8118 : see if dup2 exists
8119 set dup2 d_dup2
8120 eval $inlibc
8121
8122 : see if eaccess exists
8123 set eaccess d_eaccess
8124 eval $inlibc
8125
8126 : see if endgrent exists
8127 set endgrent d_endgrent
8128 eval $inlibc
8129
8130 : see if endhostent exists
8131 set endhostent d_endhent
8132 eval $inlibc
8133
8134 : see if endnetent exists
8135 set endnetent d_endnent
8136 eval $inlibc
8137
8138 : see if endprotoent exists
8139 set endprotoent d_endpent
8140 eval $inlibc
8141
8142 : see if endpwent exists
8143 set endpwent d_endpwent
8144 eval $inlibc
8145
8146 : see if endservent exists
8147 set endservent d_endsent
8148 eval $inlibc
8149
8150 : see if endspent exists
8151 set endspent d_endspent
8152 eval $inlibc
8153
8154 : Locate the flags for 'open()'
8155 echo " "
8156 $cat >open3.c <<'EOCP'
8157 #include <sys/types.h>
8158 #ifdef I_FCNTL
8159 #include <fcntl.h>
8160 #endif
8161 #ifdef I_SYS_FILE
8162 #include <sys/file.h>
8163 #endif
8164 int main() {
8165         if(O_RDONLY);
8166 #ifdef O_TRUNC
8167         exit(0);
8168 #else
8169         exit(1);
8170 #endif
8171 }
8172 EOCP
8173 : check sys/file.h first to get FREAD on Sun
8174 if $test `./findhdr sys/file.h` && \
8175                 set open3 -DI_SYS_FILE && eval $compile; then
8176         h_sysfile=true;
8177         echo "<sys/file.h> defines the O_* constants..." >&4
8178         if ./open3; then
8179                 echo "and you have the 3 argument form of open()." >&4
8180                 val="$define"
8181         else
8182                 echo "but not the 3 argument form of open().  Oh, well." >&4
8183                 val="$undef"
8184         fi
8185 elif $test `./findhdr fcntl.h` && \
8186                 set open3 -DI_FCNTL && eval $compile; then
8187         h_fcntl=true;
8188         echo "<fcntl.h> defines the O_* constants..." >&4
8189         if ./open3; then
8190                 echo "and you have the 3 argument form of open()." >&4
8191                 val="$define"
8192         else
8193                 echo "but not the 3 argument form of open().  Oh, well." >&4
8194                 val="$undef"
8195         fi
8196 else
8197         val="$undef"
8198         echo "I can't find the O_* constant definitions!  You got problems." >&4
8199 fi
8200 set d_open3
8201 eval $setvar
8202 $rm -f open3*
8203
8204 : see which of string.h or strings.h is needed
8205 echo " "
8206 strings=`./findhdr string.h`
8207 if $test "$strings" && $test -r "$strings"; then
8208         echo "Using <string.h> instead of <strings.h>." >&4
8209         val="$define"
8210 else
8211         val="$undef"
8212         strings=`./findhdr strings.h`
8213         if $test "$strings" && $test -r "$strings"; then
8214                 echo "Using <strings.h> instead of <string.h>." >&4
8215         else
8216                 echo "No string header found -- You'll surely have problems." >&4
8217         fi
8218 fi
8219 set i_string
8220 eval $setvar
8221 case "$i_string" in
8222 "$undef") strings=`./findhdr strings.h`;;
8223 *)        strings=`./findhdr string.h`;;
8224 esac
8225
8226 : check for non-blocking I/O stuff
8227 case "$h_sysfile" in
8228 true) echo "#include <sys/file.h>" > head.c;;
8229 *)
8230         case "$h_fcntl" in
8231         true) echo "#include <fcntl.h>" > head.c;;
8232         *) echo "#include <sys/fcntl.h>" > head.c;;
8233         esac
8234         ;;
8235 esac
8236 echo " "
8237 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
8238 case "$o_nonblock" in
8239 '')
8240         $cat head.c > try.c
8241         $cat >>try.c <<'EOCP'
8242 #include <stdio.h>
8243 int main() {
8244 #ifdef O_NONBLOCK
8245         printf("O_NONBLOCK\n");
8246         exit(0);
8247 #endif
8248 #ifdef O_NDELAY
8249         printf("O_NDELAY\n");
8250         exit(0);
8251 #endif
8252 #ifdef FNDELAY
8253         printf("FNDELAY\n");
8254         exit(0);
8255 #endif
8256         exit(0);
8257 }
8258 EOCP
8259         set try
8260         if eval $compile_ok; then
8261                 o_nonblock=`./try`
8262                 case "$o_nonblock" in
8263                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
8264                 *) echo "Seems like we can use $o_nonblock.";;
8265                 esac
8266         else
8267                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
8268         fi
8269         ;;
8270 *) echo "Using $hint value $o_nonblock.";;
8271 esac
8272 $rm -f try try.* .out core
8273
8274 echo " "
8275 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
8276 case "$eagain" in
8277 '')
8278         $cat head.c > try.c
8279         $cat >>try.c <<EOCP
8280 #include <errno.h>
8281 #include <sys/types.h>
8282 #include <signal.h>
8283 #include <stdio.h> 
8284 #define MY_O_NONBLOCK $o_nonblock
8285 #ifndef errno  /* XXX need better Configure test */
8286 extern int errno;
8287 #endif
8288 #$i_unistd I_UNISTD
8289 #ifdef I_UNISTD
8290 #include <unistd.h>
8291 #endif
8292 #ifdef $i_string
8293 #include <string.h>
8294 #else
8295 #include <strings.h>
8296 #endif
8297 $signal_t blech(x) int x; { exit(3); }
8298 EOCP
8299         $cat >> try.c <<'EOCP'
8300 int main()
8301 {
8302         int pd[2];
8303         int pu[2];
8304         char buf[1];
8305         char string[100];
8306
8307         pipe(pd);       /* Down: child -> parent */
8308         pipe(pu);       /* Up: parent -> child */
8309         if (0 != fork()) {
8310                 int ret;
8311                 close(pd[1]);   /* Parent reads from pd[0] */
8312                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
8313                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
8314                         exit(1);
8315                 signal(SIGALRM, blech);
8316                 alarm(5);
8317                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
8318                         exit(2);
8319                 sprintf(string, "%d\n", ret);
8320                 write(2, string, strlen(string));
8321                 alarm(0);
8322 #ifdef EAGAIN
8323                 if (errno == EAGAIN) {
8324                         printf("EAGAIN\n");
8325                         goto ok;
8326                 }
8327 #endif
8328 #ifdef EWOULDBLOCK
8329                 if (errno == EWOULDBLOCK)
8330                         printf("EWOULDBLOCK\n");
8331 #endif
8332         ok:
8333                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
8334                 sleep(2);                               /* Give it time to close our pipe */
8335                 alarm(5);
8336                 ret = read(pd[0], buf, 1);      /* Should read EOF */
8337                 alarm(0);
8338                 sprintf(string, "%d\n", ret);
8339                 write(3, string, strlen(string));
8340                 exit(0);
8341         }
8342
8343         close(pd[0]);                   /* We write to pd[1] */
8344         close(pu[1]);                   /* We read from pu[0] */
8345         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
8346         close(pd[1]);                   /* Pipe pd is now fully closed! */
8347         exit(0);                                /* Bye bye, thank you for playing! */
8348 }
8349 EOCP
8350         set try
8351         if eval $compile_ok; then
8352                 echo "$startsh" >mtry
8353                 echo "./try >try.out 2>try.ret 3>try.err || exit 4" >>mtry
8354                 chmod +x mtry
8355                 ./mtry >/dev/null 2>&1
8356                 case $? in
8357                 0) eagain=`$cat try.out`;;
8358                 1) echo "Could not perform non-blocking setting!";;
8359                 2) echo "I did a successful read() for something that was not there!";;
8360                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
8361                 *) echo "Something terribly wrong happened during testing.";;
8362                 esac
8363                 rd_nodata=`$cat try.ret`
8364                 echo "A read() system call with no data present returns $rd_nodata."
8365                 case "$rd_nodata" in
8366                 0|-1) ;;
8367                 *)
8368                         echo "(That's peculiar, fixing that to be -1.)"
8369                         rd_nodata=-1
8370                         ;;
8371                 esac
8372                 case "$eagain" in
8373                 '')
8374                         echo "Forcing errno EAGAIN on read() with no data available."
8375                         eagain=EAGAIN
8376                         ;;
8377                 *)
8378                         echo "Your read() sets errno to $eagain when no data is available."
8379                         ;;
8380                 esac
8381                 status=`$cat try.err`
8382                 case "$status" in
8383                 0) echo "And it correctly returns 0 to signal EOF.";;
8384                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
8385                 *) echo "However, your read() returns '$status' on EOF??";;
8386                 esac
8387                 val="$define"
8388                 if test "$status" = "$rd_nodata"; then
8389                         echo "WARNING: you can't distinguish between EOF and no data!"
8390                         val="$undef"
8391                 fi
8392         else
8393                 echo "I can't compile the test program--assuming errno EAGAIN will do."
8394                 eagain=EAGAIN
8395         fi
8396         set d_eofnblk
8397         eval $setvar
8398         ;;
8399 *)
8400         echo "Using $hint value $eagain."
8401         echo "Your read() returns $rd_nodata when no data is present."
8402         case "$d_eofnblk" in
8403         "$define") echo "And you can see EOF because read() returns 0.";;
8404         "$undef") echo "But you can't see EOF status from read() returned value.";;
8405         *)
8406                 echo "(Assuming you can't see EOF status from read anyway.)"
8407                 d_eofnblk=$undef
8408                 ;;
8409         esac
8410         ;;
8411 esac
8412 $rm -f try try.* .out core head.c mtry
8413
8414 : see if fchmod exists
8415 set fchmod d_fchmod
8416 eval $inlibc
8417
8418 : see if fchown exists
8419 set fchown d_fchown
8420 eval $inlibc
8421
8422 : see if this is an fcntl system
8423 set fcntl d_fcntl
8424 eval $inlibc
8425
8426 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
8427 while $test $# -ge 2; do
8428         case "$1" in
8429         $define) echo "#include <$2>";;
8430         esac ;
8431     shift 2;
8432 done > try.c;
8433 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
8434 set try;
8435 if eval $compile; then
8436         val="$define";
8437 else
8438         val="$undef";
8439 fi;
8440 set $varname;
8441 eval $setvar;
8442 $rm -f try.c try.o'
8443
8444 socketlib=''
8445 sockethdr=''
8446 : see whether socket exists
8447 echo " "
8448 $echo $n "Hmm... $c" >&4
8449 if set socket val -f d_socket; eval $csym; $val; then
8450         echo "Looks like you have Berkeley networking support." >&4
8451         d_socket="$define"
8452         if set setsockopt val -f; eval $csym; $val; then
8453                 d_oldsock="$undef"
8454         else
8455                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
8456                 d_oldsock="$define"
8457         fi
8458 else
8459         if $contains socklib libc.list >/dev/null 2>&1; then
8460                 echo "Looks like you have Berkeley networking support." >&4
8461                 d_socket="$define"
8462                 : we will have to assume that it supports the 4.2 BSD interface
8463                 d_oldsock="$undef"
8464         else
8465                 echo "You don't have Berkeley networking in libc$_a..." >&4
8466                 if test "X$d_socket" = "X$define"; then
8467                    echo "...but you seem to believe that you have sockets." >&4
8468                 else
8469                         for net in net socket
8470                         do
8471                                 if test -f /usr/lib/lib$net$_a; then
8472                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
8473                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
8474                                         if $contains socket libc.list >/dev/null 2>&1; then
8475                                                 d_socket="$define"
8476                                                 socketlib="-l$net"
8477                                                 case "$net" in
8478                                                 net)
8479                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
8480                                                         sockethdr="-I/usr/netinclude"
8481                                                         ;;
8482                                                 esac
8483                                                 echo "Found Berkeley sockets interface in lib$net." >& 4 
8484                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
8485                                                         d_oldsock="$undef"
8486                                                 else
8487                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
8488                                                         d_oldsock="$define"
8489                                                 fi
8490                                                 break
8491                                         fi
8492                                 fi
8493                         done
8494                         if test "X$d_socket" != "X$define"; then
8495                            echo "or anywhere else I see." >&4
8496                            d_socket="$undef"
8497                            d_oldsock="$undef"
8498                         fi
8499                 fi
8500         fi
8501 fi
8502
8503 : see if socketpair exists
8504 set socketpair d_sockpair
8505 eval $inlibc
8506
8507
8508 echo " "
8509 echo "Checking the availability of certain socket constants..." >& 4
8510 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
8511         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
8512         $cat >try.c <<EOF
8513 #include <sys/types.h>
8514 #include <sys/socket.h>
8515 int main() {
8516     int i = $ENUM;
8517 }
8518 EOF
8519         val="$undef"
8520         set try; if eval $compile; then
8521                 val="$define"
8522         fi
8523         set d_${enum}; eval $setvar
8524         $rm -f try.c try
8525 done
8526
8527 : see if sys/select.h has to be included
8528 set sys/select.h i_sysselct
8529 eval $inhdr
8530
8531 : see if we should include time.h, sys/time.h, or both
8532 echo " "
8533 if test "X$timeincl" = X; then
8534         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
8535         $echo $n "I'm now running the test program...$c"
8536         $cat >try.c <<'EOCP'
8537 #include <sys/types.h>
8538 #ifdef I_TIME
8539 #include <time.h>
8540 #endif
8541 #ifdef I_SYSTIME
8542 #ifdef SYSTIMEKERNEL
8543 #define KERNEL
8544 #endif
8545 #include <sys/time.h>
8546 #endif
8547 #ifdef I_SYSSELECT
8548 #include <sys/select.h>
8549 #endif
8550 int main()
8551 {
8552         struct tm foo;
8553 #ifdef S_TIMEVAL
8554         struct timeval bar;
8555 #endif
8556 #ifdef S_TIMEZONE
8557         struct timezone tzp;
8558 #endif
8559         if (foo.tm_sec == foo.tm_sec)
8560                 exit(0);
8561 #ifdef S_TIMEVAL
8562         if (bar.tv_sec == bar.tv_sec)
8563                 exit(0);
8564 #endif
8565         exit(1);
8566 }
8567 EOCP
8568         flags=''
8569         for s_timezone in '-DS_TIMEZONE' ''; do
8570         sysselect=''
8571         for s_timeval in '-DS_TIMEVAL' ''; do
8572         for i_systimek in '' '-DSYSTIMEKERNEL'; do
8573         for i_time in '' '-DI_TIME'; do
8574         for i_systime in '-DI_SYSTIME' ''; do
8575                 case "$flags" in
8576                 '') $echo $n ".$c"
8577                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
8578                         if eval $compile; then
8579                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
8580                                 shift
8581                                 flags="$*"
8582                                 echo " "
8583                                 $echo $n "Succeeded with $flags$c"
8584                         fi
8585                         ;;
8586                 esac
8587         done
8588         done
8589         done
8590         done
8591         done
8592         timeincl=''
8593         echo " "
8594         case "$flags" in
8595         *SYSTIMEKERNEL*) i_systimek="$define"
8596                 timeincl=`./findhdr sys/time.h`
8597                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
8598         *) i_systimek="$undef";;
8599         esac
8600         case "$flags" in
8601         *I_TIME*) i_time="$define"
8602                 timeincl=`./findhdr time.h`" $timeincl"
8603                 echo "We'll include <time.h>." >&4;;
8604         *) i_time="$undef";;
8605         esac
8606         case "$flags" in
8607         *I_SYSTIME*) i_systime="$define"
8608                 timeincl=`./findhdr sys/time.h`" $timeincl"
8609                 echo "We'll include <sys/time.h>." >&4;;
8610         *) i_systime="$undef";;
8611         esac
8612         $rm -f try.c try
8613 fi
8614
8615 : check for fd_set items
8616 $cat <<EOM
8617
8618 Checking to see how well your C compiler handles fd_set and friends ...
8619 EOM
8620 $cat >fd_set.c <<EOCP
8621 #$i_systime I_SYS_TIME
8622 #$i_sysselct I_SYS_SELECT
8623 #$d_socket HAS_SOCKET
8624 #include <sys/types.h>
8625 #ifdef HAS_SOCKET
8626 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
8627 #endif
8628 #ifdef I_SYS_TIME
8629 #include <sys/time.h>
8630 #endif
8631 #ifdef I_SYS_SELECT
8632 #include <sys/select.h>
8633 #endif
8634 int main() {
8635         fd_set fds;
8636
8637 #ifdef TRYBITS
8638         if(fds.fds_bits);
8639 #endif
8640
8641 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
8642         exit(0);
8643 #else
8644         exit(1);
8645 #endif
8646 }
8647 EOCP
8648 set fd_set -DTRYBITS
8649 if eval $compile; then
8650         d_fds_bits="$define"
8651         d_fd_set="$define"
8652         echo "Well, your system knows about the normal fd_set typedef..." >&4
8653         if ./fd_set; then
8654                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
8655                 d_fd_macros="$define"
8656         else
8657                 $cat >&4 <<'EOM'
8658 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
8659 EOM
8660                 d_fd_macros="$undef"
8661         fi
8662 else
8663         $cat <<'EOM'
8664 Hmm, your compiler has some difficulty with fd_set.  Checking further...
8665 EOM
8666         set fd_set
8667         if eval $compile; then
8668                 d_fds_bits="$undef"
8669                 d_fd_set="$define"
8670                 echo "Well, your system has some sort of fd_set available..." >&4
8671                 if ./fd_set; then
8672                         echo "and you have the normal fd_set macros." >&4
8673                         d_fd_macros="$define"
8674                 else
8675                         $cat <<'EOM'
8676 but not the normal fd_set macros!  Gross!  More work for me...
8677 EOM
8678                         d_fd_macros="$undef"
8679                 fi
8680         else
8681         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
8682                 d_fd_set="$undef"
8683                 d_fds_bits="$undef"
8684                 d_fd_macros="$undef"
8685         fi
8686 fi
8687 $rm -f fd_set*
8688
8689 : see if fgetpos exists
8690 set fgetpos d_fgetpos
8691 eval $inlibc
8692
8693 : see if flock exists
8694 set flock d_flock
8695 eval $inlibc
8696
8697 : see if fork exists
8698 set fork d_fork
8699 eval $inlibc
8700
8701 : see if pathconf exists
8702 set pathconf d_pathconf
8703 eval $inlibc
8704
8705 : see if fpathconf exists
8706 set fpathconf d_fpathconf
8707 eval $inlibc
8708
8709
8710 : check for off64_t
8711 echo " "
8712 echo "Checking to see if your system supports off64_t..." >&4
8713 $cat >try.c <<EOCP
8714 #include <sys/types.h>
8715 #include <unistd.h>
8716 int main() { off64_t x = 7; }'
8717 EOCP
8718 set try
8719 if eval $compile; then
8720         val="$define"
8721         echo "Yes, it does."
8722 else
8723         val="$undef"
8724         echo "No, it doesn't."
8725         case "$lseeksize" in
8726         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
8727         esac
8728 fi
8729 $rm -f try.* try
8730 set d_off64_t
8731 eval $setvar
8732
8733 : check for fpos64_t
8734 echo " "
8735 echo "Checking to see if your system supports fpos64_t..." >&4
8736 $cat >try.c <<EOCP
8737 #include <sys/stdio.h>
8738 int main() { fpos64_t x x = 7; }'
8739 EOCP
8740 set try
8741 if eval $compile; then
8742         val="$define"
8743         echo "Yes, it does."
8744 else
8745         val="$undef"
8746         echo "No, it doesn't."
8747         case "$fpossize" in
8748         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
8749         esac
8750 fi
8751 $rm -f try.* try
8752 set d_fpos64_t
8753 eval $setvar
8754
8755 hasstruct='varname=$1; struct=$2; shift; shift;
8756 while $test $# -ge 2; do
8757         case "$1" in
8758         $define) echo "#include <$2>";;
8759         esac ;
8760     shift 2;
8761 done > try.c;
8762 echo "int main () { struct $struct foo; }" >> try.c;
8763 set try;
8764 if eval $compile; then
8765         val="$define";
8766 else
8767         val="$undef";
8768 fi;
8769 set $varname;
8770 eval $setvar;
8771 $rm -f try.c try.o'
8772
8773 : see if this is a sys/param system
8774 set sys/param.h i_sysparam
8775 eval $inhdr
8776
8777 : see if this is a sys/mount.h system
8778 set sys/mount.h i_sysmount
8779 eval $inhdr
8780
8781 : see if sys/types.h has to be included
8782 set sys/types.h i_systypes
8783 eval $inhdr
8784
8785
8786 echo " "
8787 echo "Checking to see if your system supports struct fs_data..." >&4
8788 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
8789 eval $hasstruct
8790 case "$d_fs_data_s" in
8791 "$define")      echo "Yes, it does."   ;;
8792 *)              echo "No, it doesn't." ;;
8793 esac
8794
8795 : see if fseeko exists
8796 set fseeko d_fseeko
8797 eval $inlibc
8798 case "$longsize" in
8799 8) echo "(Your long is 64 bits, so in a pinch you could use fseek.)" ;;
8800 esac
8801
8802 : see if fsetpos exists
8803 set fsetpos d_fsetpos
8804 eval $inlibc
8805
8806
8807 : see if fstatfs exists
8808 set fstatfs d_fstatfs
8809 eval $inlibc
8810
8811
8812 : see if statvfs exists
8813 set statvfs d_statvfs
8814 eval $inlibc
8815
8816 : see if fstatvfs exists
8817 set fstatvfs d_fstatvfs
8818 eval $inlibc
8819
8820
8821 : see if ftello exists
8822 set ftello d_ftello
8823 eval $inlibc
8824 case "$longsize" in
8825 8) echo "(Your long is 64 bits, so in a pinch you could use ftell.)" ;;
8826 esac
8827
8828 : see if getgrent exists
8829 set getgrent d_getgrent
8830 eval $inlibc
8831
8832 : see if gethostbyaddr exists
8833 set gethostbyaddr d_gethbyaddr
8834 eval $inlibc
8835
8836 : see if gethostbyname exists
8837 set gethostbyname d_gethbyname
8838 eval $inlibc
8839
8840 : see if gethostent exists
8841 set gethostent d_gethent
8842 eval $inlibc
8843
8844 : see how we will look up host name
8845 echo " "
8846 call=''
8847 if set gethostname val -f d_gethname; eval $csym; $val; then
8848         echo 'gethostname() found.' >&4
8849         d_gethname="$define"
8850         call=gethostname
8851 fi
8852 if set uname val -f d_uname; eval $csym; $val; then
8853         if ./xenix; then
8854                 $cat <<'EOM'
8855 uname() was found, but you're running xenix, and older versions of xenix
8856 have a broken uname(). If you don't really know whether your xenix is old
8857 enough to have a broken system call, use the default answer.
8858
8859 EOM
8860                 dflt=y
8861                 case "$d_uname" in
8862                 "$define") dflt=n;;
8863                 esac
8864                 rp='Is your uname() broken?'
8865                 . ./myread
8866                 case "$ans" in
8867                 n*) d_uname="$define"; call=uname;;
8868                 esac
8869         else
8870                 echo 'uname() found.' >&4
8871                 d_uname="$define"
8872                 case "$call" in
8873                 '') call=uname ;;
8874                 esac
8875         fi
8876 fi
8877 case "$d_gethname" in
8878 '') d_gethname="$undef";;
8879 esac
8880 case "$d_uname" in
8881 '') d_uname="$undef";;
8882 esac
8883 case "$d_uname$d_gethname" in
8884 *define*)
8885         dflt=n
8886         cat <<EOM
8887  
8888 Every now and then someone has a $call() that lies about the hostname
8889 but can't be fixed for political or economic reasons.  If you wish, I can
8890 pretend $call() isn't there and maybe compute hostname at run-time
8891 thanks to the '$phostname' command.
8892
8893 EOM
8894         rp="Shall I ignore $call() from now on?"
8895         . ./myread
8896         case "$ans" in
8897         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
8898         esac;;
8899 esac
8900 case "$phostname" in
8901 '') aphostname='';;
8902 *) case "$aphostname" in
8903         /*) ;;
8904         *) set X $phostname
8905                 shift
8906                 file=$1
8907                 shift
8908                 file=`./loc $file $file $pth`
8909                 aphostname=`echo $file $*`
8910                 ;;
8911         esac
8912         ;;
8913 esac
8914 case "$d_uname$d_gethname" in
8915 *define*) ;;
8916 *)
8917         case "$phostname" in
8918         '')
8919                 echo "There will be no way for $package to get your hostname." >&4;;
8920         *)
8921         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
8922                 ;;
8923         esac;;
8924 esac
8925 case "$d_phostname" in
8926 '') d_phostname="$undef";;
8927 esac
8928
8929 : see if this is a netdb.h system
8930 set netdb.h i_netdb
8931 eval $inhdr
8932
8933 : see if prototypes for various gethostxxx netdb.h functions are available
8934 echo " "
8935 set d_gethostprotos gethostent $i_netdb netdb.h
8936 eval $hasproto
8937
8938 : see if getlogin exists
8939 set getlogin d_getlogin
8940 eval $inlibc
8941
8942 : see if getmnt exists
8943 set getmnt d_getmnt
8944 eval $inlibc
8945
8946 : see if getmntent exists
8947 set getmntent d_getmntent
8948 eval $inlibc
8949
8950 : see if getnetbyaddr exists
8951 set getnetbyaddr d_getnbyaddr
8952 eval $inlibc
8953
8954 : see if getnetbyname exists
8955 set getnetbyname d_getnbyname
8956 eval $inlibc
8957
8958 : see if getnetent exists
8959 set getnetent d_getnent
8960 eval $inlibc
8961
8962 : see if prototypes for various getnetxxx netdb.h functions are available
8963 echo " "
8964 set d_getnetprotos getnetent $i_netdb netdb.h
8965 eval $hasproto
8966
8967
8968 : see if getprotobyname exists
8969 set getprotobyname d_getpbyname
8970 eval $inlibc
8971
8972 : see if getprotobynumber exists
8973 set getprotobynumber d_getpbynumber
8974 eval $inlibc
8975
8976 : see if getprotoent exists
8977 set getprotoent d_getpent
8978 eval $inlibc
8979
8980 : see if getpgid exists
8981 set getpgid d_getpgid
8982 eval $inlibc
8983
8984 : see if getpgrp2 exists
8985 set getpgrp2 d_getpgrp2
8986 eval $inlibc
8987
8988 : see if getppid exists
8989 set getppid d_getppid
8990 eval $inlibc
8991
8992 : see if getpriority exists
8993 set getpriority d_getprior
8994 eval $inlibc
8995
8996 : see if prototypes for various getprotoxxx netdb.h functions are available
8997 echo " "
8998 set d_getprotoprotos getprotoent $i_netdb netdb.h
8999 eval $hasproto
9000
9001 : see if getpwent exists
9002 set getpwent d_getpwent
9003 eval $inlibc
9004
9005
9006 : see if getservbyname exists
9007 set getservbyname d_getsbyname
9008 eval $inlibc
9009
9010 : see if getservbyport exists
9011 set getservbyport d_getsbyport
9012 eval $inlibc
9013
9014 : see if getservent exists
9015 set getservent d_getsent
9016 eval $inlibc
9017
9018 : see if prototypes for various getservxxx netdb.h functions are available
9019 echo " "
9020 set d_getservprotos getservent $i_netdb netdb.h
9021 eval $hasproto
9022
9023 : see if getspent exists
9024 set getspent d_getspent
9025 eval $inlibc
9026
9027 : see if getspnam exists
9028 set getspnam d_getspnam
9029 eval $inlibc
9030
9031 : see if gettimeofday or ftime exists
9032 set gettimeofday d_gettimeod
9033 eval $inlibc
9034 case "$d_gettimeod" in
9035 "$undef")
9036         set ftime d_ftime 
9037         eval $inlibc
9038         ;;
9039 *)
9040         val="$undef"; set d_ftime; eval $setvar
9041         ;;
9042 esac
9043 case "$d_gettimeod$d_ftime" in
9044 "$undef$undef")
9045         echo " "
9046         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
9047         ;;
9048 esac
9049
9050 : see if this is an grp system
9051 set grp.h i_grp
9052 eval $inhdr
9053
9054 case "$i_grp" in
9055 $define)
9056         xxx=`./findhdr grp.h`
9057         $cppstdin $cppflags $cppminus < $xxx >$$.h
9058
9059         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
9060                 val="$define"
9061         else
9062                 val="$undef"
9063         fi
9064         set d_grpasswd
9065         eval $setvar
9066
9067         $rm -f $$.h
9068         ;;
9069 *)
9070         val="$undef";
9071         set d_grpasswd; eval $setvar
9072         ;;
9073 esac
9074
9075 : see if hasmntopt exists
9076 set hasmntopt d_hasmntopt
9077 eval $inlibc
9078
9079 : see if this is a netinet/in.h or sys/in.h system
9080 set netinet/in.h i_niin sys/in.h i_sysin
9081 eval $inhdr
9082
9083 : see if arpa/inet.h has to be included
9084 set arpa/inet.h i_arpainet
9085 eval $inhdr
9086
9087 : see if htonl --and friends-- exists
9088 val=''
9089 set htonl val
9090 eval $inlibc
9091
9092 : Maybe they are macros.
9093 case "$val" in
9094 $undef)
9095         $cat >htonl.c <<EOM
9096 #include <stdio.h>
9097 #include <sys/types.h>
9098 #$i_niin I_NETINET_IN
9099 #$i_sysin I_SYS_IN
9100 #$i_arpainet I_ARPA_INET
9101 #ifdef I_NETINET_IN
9102 #include <netinet/in.h>
9103 #endif
9104 #ifdef I_SYS_IN
9105 #include <sys/in.h>
9106 #endif
9107 #ifdef I_ARPA_INET
9108 #include <arpa/inet.h>
9109 #endif
9110 #ifdef htonl
9111 printf("Defined as a macro.");
9112 #endif
9113 EOM
9114         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
9115         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
9116                 val="$define"
9117                 echo "But it seems to be defined as a macro." >&4
9118         fi
9119         $rm -f htonl.?
9120         ;;
9121 esac
9122 set d_htonl
9123 eval $setvar
9124
9125 : index or strchr
9126 echo " "
9127 if set index val -f; eval $csym; $val; then
9128         if set strchr val -f d_strchr; eval $csym; $val; then
9129                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
9130                         val="$define"
9131                         vali="$undef"
9132                         echo "strchr() found." >&4
9133                 else
9134                         val="$undef"
9135                         vali="$define"
9136                         echo "index() found." >&4
9137                 fi
9138         else
9139                 val="$undef"
9140                 vali="$define"
9141                 echo "index() found." >&4
9142         fi
9143 else
9144         if set strchr val -f d_strchr; eval $csym; $val; then
9145                 val="$define"
9146                 vali="$undef"
9147                 echo "strchr() found." >&4
9148         else
9149                 echo "No index() or strchr() found!" >&4
9150                 val="$undef"
9151                 vali="$undef"
9152         fi
9153 fi
9154 set d_strchr; eval $setvar
9155 val="$vali"
9156 set d_index; eval $setvar
9157
9158 : check whether inet_aton exists
9159 set inet_aton d_inetaton
9160 eval $inlibc
9161
9162 : see if inttypes.h is available
9163 : we want a real compile instead of Inhdr because some systems
9164 : have an inttypes.h which includes non-existent headers
9165 echo " "
9166 $cat >try.c <<EOCP
9167 #include <inttypes.h>
9168 int main() {
9169         static int32_t foo32 = 0x12345678;
9170 }
9171 EOCP
9172 set try
9173 if eval $compile; then
9174         echo "<inttypes.h> found." >&4
9175         val="$define"
9176 else
9177         echo "<inttypes.h> NOT found." >&4
9178         val="$undef"
9179 fi
9180 $rm -f try.c try
9181 set i_inttypes
9182 eval $setvar
9183
9184 : check for int64_t
9185 echo " "
9186 $echo $n "Checking to see if your system supports int64_t...$c" >&4
9187 $cat >try.c <<EOCP
9188 #include <sys/types.h>
9189 #$i_inttypes I_INTTYPES
9190 #ifdef I_INTTYPES
9191 #include <inttypes.h>
9192 #endif
9193 int main() { int64_t x = 7; }
9194 EOCP
9195 set try
9196 if eval $compile; then
9197         val="$define"
9198         echo " Yes, it does." >&4
9199 else
9200         val="$undef"
9201         echo " No, it doesn't." >&4
9202 fi
9203 $rm -f try try.*
9204 set d_int64t
9205 eval $setvar
9206
9207 : Look for isascii
9208 echo " "
9209 $cat >isascii.c <<'EOCP'
9210 #include <stdio.h>
9211 #include <ctype.h>
9212 int main() {
9213         int c = 'A';
9214         if (isascii(c))
9215                 exit(0);
9216         else
9217                 exit(1);
9218 }
9219 EOCP
9220 set isascii
9221 if eval $compile; then
9222         echo "isascii() found." >&4
9223         val="$define"
9224 else
9225         echo "isascii() NOT found." >&4
9226         val="$undef"
9227 fi
9228 set d_isascii
9229 eval $setvar
9230 $rm -f isascii*
9231
9232 : see if killpg exists
9233 set killpg d_killpg
9234 eval $inlibc
9235
9236 : see if lchown exists
9237 echo " "
9238 $cat > try.c <<'EOCP'
9239 /* System header to define __stub macros and hopefully few prototypes,
9240     which can conflict with char lchown(); below.  */
9241 #include <assert.h>
9242 /* Override any gcc2 internal prototype to avoid an error.  */
9243 /* We use char because int might match the return type of a gcc2
9244    builtin and then its argument prototype would still apply.  */
9245 char lchown();
9246 int main() {
9247     /*  The GNU C library defines this for functions which it implements
9248         to always fail with ENOSYS.  Some functions are actually named
9249         something starting with __ and the normal name is an alias.  */
9250 #if defined (__stub_lchown) || defined (__stub___lchown)
9251 choke me
9252 #else
9253 lchown();
9254 #endif
9255 ; return 0; }
9256 EOCP
9257 set try
9258 if eval $compile; then
9259     $echo "lchown() found." >&4
9260     val="$define"
9261 else
9262     $echo "lchown() NOT found." >&4
9263     val="$undef"
9264 fi
9265 set d_lchown
9266 eval $setvar
9267
9268 : See if number of significant digits in a double precision number is known
9269 echo " "
9270 $cat >ldbl_dig.c <<EOM
9271 #$i_limits I_LIMITS
9272 #$i_float I_FLOAT
9273 #ifdef I_LIMITS
9274 #include <limits.h>
9275 #endif
9276 #ifdef I_FLOAT
9277 #include <float.h>
9278 #endif
9279 #ifdef LDBL_DIG
9280 printf("Contains LDBL_DIG");
9281 #endif
9282 EOM
9283 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
9284 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
9285         echo "LDBL_DIG found." >&4
9286         val="$define"
9287 else
9288         echo "LDBL_DIG NOT found." >&4
9289         val="$undef"
9290 fi
9291 $rm -f ldbl_dig.?
9292 set d_ldbl_dig
9293 eval $setvar
9294
9295 : see if link exists
9296 set link d_link
9297 eval $inlibc
9298
9299 : see if localeconv exists
9300 set localeconv d_locconv
9301 eval $inlibc
9302
9303 : see if lockf exists
9304 set lockf d_lockf
9305 eval $inlibc
9306
9307 : check for long long
9308 echo " "
9309 $echo $n "Checking to see if your system supports long long..." $c >&4
9310 echo 'int main() { long long x = 7; return 0; }' > try.c
9311 set try
9312 if eval $compile; then
9313         val="$define"
9314         echo " Yes, it does." >&4
9315 else
9316         val="$undef"
9317         echo " No, it doesn't." >&4
9318 fi
9319 $rm try.*
9320 set d_longlong
9321 eval $setvar
9322
9323 : check for length of long long
9324 case "${d_longlong}${longlongsize}" in
9325 $define)
9326         echo " "
9327         $echo $n "Checking to see how big your long longs are..." $c >&4
9328         $cat >try.c <<'EOCP'
9329 #include <stdio.h>
9330 int main()
9331 {
9332     printf("%d\n", (int)sizeof(long long));
9333     return(0);
9334 }
9335 EOCP
9336         set try
9337         if eval $compile_ok; then
9338                 longlongsize=`./try$exe_ext`
9339                 $echo " $longlongsize bytes." >&4
9340         else
9341                 dflt='8'
9342                 echo " "
9343                 echo "(I can't seem to compile the test program.  Guessing...)"
9344                 rp="What is the size of a long long (in bytes)?"
9345                 . ./myread
9346                 longlongsize="$ans"
9347         fi
9348         if $test "X$longsize" = "X$longlongsize"; then
9349                 echo "(That isn't any different from an ordinary long.)"
9350         fi      
9351         ;;
9352 esac
9353 $rm -f try.* try
9354
9355 : see if lstat exists
9356 set lstat d_lstat
9357 eval $inlibc
9358
9359 : see if mblen exists
9360 set mblen d_mblen
9361 eval $inlibc
9362
9363 : see if mbstowcs exists
9364 set mbstowcs d_mbstowcs
9365 eval $inlibc
9366
9367 : see if mbtowc exists
9368 set mbtowc d_mbtowc
9369 eval $inlibc
9370
9371 : see if memchr exists
9372 set memchr d_memchr
9373 eval $inlibc
9374
9375 : see if memcmp exists
9376 set memcmp d_memcmp
9377 eval $inlibc
9378
9379 : see if memcpy exists
9380 set memcpy d_memcpy
9381 eval $inlibc
9382
9383 : see if memmove exists
9384 set memmove d_memmove
9385 eval $inlibc
9386
9387 : see if memset exists
9388 set memset d_memset
9389 eval $inlibc
9390
9391 : see if mkdir exists
9392 set mkdir d_mkdir
9393 eval $inlibc
9394
9395 : see if mkfifo exists
9396 set mkfifo d_mkfifo
9397 eval $inlibc
9398
9399 : see if mktime exists
9400 set mktime d_mktime
9401 eval $inlibc
9402
9403 : see if msgctl exists
9404 set msgctl d_msgctl
9405 eval $inlibc
9406
9407 : see if msgget exists
9408 set msgget d_msgget
9409 eval $inlibc
9410
9411 : see if msgsnd exists
9412 set msgsnd d_msgsnd
9413 eval $inlibc
9414
9415 : see if msgrcv exists
9416 set msgrcv d_msgrcv
9417 eval $inlibc
9418
9419 : see how much of the 'msg*(2)' library is present.
9420 h_msg=true
9421 echo " "
9422 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
9423 *"$undef"*) h_msg=false;;
9424 esac
9425 case "$osname" in
9426 freebsd)
9427     case "`ipcs 2>&1`" in
9428     "SVID messages"*"not configured"*)
9429         echo "Your $osname does not have the msg*(2) configured." >&4
9430         h_msg=false
9431         val="$undef"
9432         set msgctl d_msgctl
9433         eval $setvar
9434         set msgget d_msgget
9435         eval $setvar
9436         set msgsnd d_msgsnd
9437         eval $setvar
9438         set msgrcv d_msgrcv
9439         eval $setvar
9440         ;;
9441     esac
9442     ;;
9443 esac
9444 : we could also check for sys/ipc.h ...
9445 if $h_msg && $test `./findhdr sys/msg.h`; then
9446         echo "You have the full msg*(2) library." >&4
9447         val="$define"
9448 else
9449         echo "You don't have the full msg*(2) library." >&4
9450         val="$undef"
9451 fi
9452 set d_msg
9453 eval $setvar
9454
9455 : see if nice exists
9456 set nice d_nice
9457 eval $inlibc
9458
9459 : see if POSIX threads are available
9460 set pthread.h i_pthread
9461 eval $inhdr
9462
9463
9464
9465
9466 : how to create joinable pthreads
9467 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
9468         echo " "
9469         echo "Checking what constant to use for creating joinable pthreads..." >&4 
9470         $cat >try.c <<'EOCP'
9471 #include <pthread.h>
9472 int main() {
9473     int detachstate = JOINABLE;
9474 }
9475 EOCP
9476         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
9477         if eval $compile; then
9478                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
9479                 val="$undef" # Yes, undef.
9480                 set d_old_pthread_create_joinable
9481                 eval $setvar
9482                 val=""
9483                 set old_pthread_create_joinable
9484                 eval $setvar
9485         else
9486                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
9487                 if eval $compile; then
9488                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
9489                         val="$define"
9490                         set d_old_pthread_create_joinable
9491                         eval $setvar
9492                         val=PTHREAD_CREATE_UNDETACHED
9493                         set old_pthread_create_joinable
9494                         eval $setvar
9495                 else            
9496                         set try -DJOINABLE=__UNDETACHED
9497                         if eval $compile; then
9498                                 echo "You seem to use __UNDETACHED." >&4
9499                                 val="$define"
9500                                 set d_old_pthread_create_joinable
9501                                 eval $setvar
9502                                 val=__UNDETACHED
9503                                 set old_pthread_create_joinable
9504                                 eval $setvar
9505                         else
9506                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
9507                                 val="$define"
9508                                 set d_old_pthread_create_joinable
9509                                 eval $setvar
9510                                 val=0
9511                                 set old_pthread_create_joinable
9512                                 eval $setvar
9513                         fi
9514                 fi
9515         fi
9516         $rm -f try try.*
9517 else
9518     d_old_pthread_create_joinable="$undef"
9519     old_pthread_create_joinable=""
9520 fi
9521
9522 : see if pause exists
9523 set pause d_pause
9524 eval $inlibc
9525
9526 : see if pipe exists
9527 set pipe d_pipe
9528 eval $inlibc
9529
9530 : see if poll exists
9531 set poll d_poll
9532 eval $inlibc
9533
9534
9535 : see whether the various POSIXish _yields exist
9536 $cat >try.c <<EOP
9537 #include <pthread.h>
9538 #include <stdio.h>
9539 int main() {
9540 #ifdef SCHED_YIELD
9541         sched_yield();
9542 #else
9543 #ifdef PTHREAD_YIELD
9544         pthread_yield();
9545 #else
9546 #ifdef PTHREAD_YIELD_NULL
9547         pthread_yield(NULL);
9548 #endif
9549 #endif
9550 #endif
9551 }
9552 EOP
9553 : see if sched_yield exists
9554 set try -DSCHED_YIELD
9555 if eval $compile; then
9556     val="$define"
9557     sched_yield='sched_yield()'
9558 else
9559     val="$undef"
9560 fi
9561 case "$usethreads" in
9562 $define)
9563         case "$val" in
9564         $define) echo 'sched_yield() found.' >&4        ;;
9565         *)       echo 'sched_yield() NOT found.' >&4    ;;
9566         esac
9567 esac
9568 set d_sched_yield
9569 eval $setvar
9570
9571 : see if pthread_yield exists
9572 set try -DPTHREAD_YIELD
9573 if eval $compile; then
9574     val="$define"
9575     case "$sched_yield" in
9576     '') sched_yield='pthread_yield()' ;;
9577     esac
9578 else
9579     set try -DPTHREAD_YIELD_NULL
9580     if eval $compile; then
9581         val="$define"
9582         case "$sched_yield" in
9583         '') sched_yield='pthread_yield(NULL)' ;;
9584         esac
9585     else
9586         val="$undef"
9587     fi
9588 fi
9589 case "$usethreads" in
9590 $define)
9591         case "$val" in
9592         $define) echo 'pthread_yield() found.' >&4      ;;
9593         *)       echo 'pthread_yield() NOT found.' >&4  ;;
9594         esac
9595         ;;
9596 esac
9597 set d_pthread_yield
9598 eval $setvar
9599
9600 case "$sched_yield" in
9601 '') sched_yield=undef ;;
9602 esac
9603
9604 $rm -f try try.*
9605
9606 : see if this is a pwd.h system
9607 set pwd.h i_pwd
9608 eval $inhdr
9609
9610 case "$i_pwd" in
9611 $define)
9612         xxx=`./findhdr pwd.h`
9613         $cppstdin $cppflags $cppminus < $xxx >$$.h
9614
9615         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
9616                 val="$define"
9617         else
9618                 val="$undef"
9619         fi
9620         set d_pwquota
9621         eval $setvar
9622
9623         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
9624                 val="$define"
9625         else
9626                 val="$undef"
9627         fi
9628         set d_pwage
9629         eval $setvar
9630
9631         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
9632                 val="$define"
9633         else
9634                 val="$undef"
9635         fi
9636         set d_pwchange
9637         eval $setvar
9638
9639         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
9640                 val="$define"
9641         else
9642                 val="$undef"
9643         fi
9644         set d_pwclass
9645         eval $setvar
9646
9647         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
9648                 val="$define"
9649         else
9650                 val="$undef"
9651         fi
9652         set d_pwexpire
9653         eval $setvar
9654
9655         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
9656                 val="$define"
9657         else
9658                 val="$undef"
9659         fi
9660         set d_pwcomment
9661         eval $setvar
9662
9663         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
9664                 val="$define"
9665         else
9666                 val="$undef"
9667         fi
9668         set d_pwgecos
9669         eval $setvar
9670
9671         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
9672                 val="$define"
9673         else
9674                 val="$undef"
9675         fi
9676         set d_pwpasswd
9677         eval $setvar
9678
9679         $rm -f $$.h
9680         ;;
9681 *)
9682         val="$undef"; 
9683         set d_pwquota; eval $setvar
9684         set d_pwage; eval $setvar
9685         set d_pwchange; eval $setvar
9686         set d_pwclass; eval $setvar
9687         set d_pwexpire; eval $setvar
9688         set d_pwcomment; eval $setvar
9689         set d_pwgecos; eval $setvar
9690         set d_pwpasswd; eval $setvar
9691         ;;
9692 esac
9693
9694
9695 echo " "
9696 echo "Checking which 64-bit integer type we could use..." >&4
9697
9698 case "$intsize" in
9699 8) val=int
9700    set quadtype
9701    eval $setvar
9702    val='"unsigned int"'
9703    set uquadtype
9704    eval $setvar
9705    quadkind=1
9706    ;;
9707 *) case "$longsize" in
9708    8) val=long
9709       set quadtype
9710       eval $setvar
9711       val='"unsigned long"'
9712       set uquadtype
9713       eval $setvar
9714       quadkind=2
9715       ;;
9716    *) case "$uselonglong:$d_longlong:$longlongsize" in
9717       define:define:8)
9718         val='"long long"'
9719         set quadtype
9720         eval $setvar
9721         val='"unsigned long long"'
9722         set uquadtype
9723         eval $setvar
9724         quadkind=3
9725         ;;
9726       *) case "$d_int64t" in
9727          define)
9728            val=int64_t
9729            set quadtype
9730            eval $setvar
9731            val=uint64_t
9732            set uquadtype
9733            eval $setvar
9734            quadkind=4
9735            ;;
9736          esac
9737          ;;
9738       esac
9739       ;;
9740    esac
9741    ;;
9742 esac
9743
9744 case "$quadtype" in
9745 '')     case "$uselonglong:$d_longlong:$longlongsize" in
9746         undef:define:8)
9747            echo "(You would have 'long long', but you are not using it.)" >&4 ;;
9748         *) echo "Alas, no 64-bit integer types in sight." >&4 ;;
9749         esac
9750         d_quad="$undef"
9751         ;;
9752 *)      if test X"$use64bits" = Xdefine -o X"$longsize" = X8; then
9753             verb="will"
9754         else
9755             verb="could"
9756         fi
9757         echo "We $verb use '$quadtype' for 64-bit integers." >&4
9758         d_quad="$define"
9759         ;;
9760 esac
9761
9762 : see if readdir and friends exist
9763 set readdir d_readdir
9764 eval $inlibc
9765 set seekdir d_seekdir
9766 eval $inlibc
9767 set telldir d_telldir
9768 eval $inlibc
9769 set rewinddir d_rewinddir
9770 eval $inlibc
9771
9772 : see if readlink exists
9773 set readlink d_readlink
9774 eval $inlibc
9775
9776 : see if rename exists
9777 set rename d_rename
9778 eval $inlibc
9779
9780 : see if rmdir exists
9781 set rmdir d_rmdir
9782 eval $inlibc
9783
9784 : see if memory.h is available.
9785 val=''
9786 set memory.h val
9787 eval $inhdr
9788
9789 : See if it conflicts with string.h
9790 case "$val" in
9791 $define)
9792         case "$strings" in
9793         '') ;;
9794         *)
9795                 $cppstdin $cppflags $cppminus < $strings > mem.h
9796                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
9797                         echo " "
9798                         echo "We won't be including <memory.h>."
9799                         val="$undef"
9800                 fi
9801                 $rm -f mem.h
9802                 ;;
9803         esac
9804 esac
9805 set i_memory
9806 eval $setvar
9807
9808 : can bcopy handle overlapping blocks?
9809 val="$undef"
9810 case "$d_bcopy" in
9811 "$define")
9812         echo " "
9813         echo "Checking to see if your bcopy() can do overlapping copies..." >&4
9814         $cat >try.c <<EOCP
9815 #$i_memory I_MEMORY
9816 #$i_stdlib I_STDLIB
9817 #$i_string I_STRING
9818 #$i_unistd I_UNISTD
9819 EOCP
9820         $cat >>try.c <<'EOCP'
9821 #include <stdio.h>
9822 #ifdef I_MEMORY
9823 #  include <memory.h>
9824 #endif
9825 #ifdef I_STDLIB
9826 #  include <stdlib.h>
9827 #endif
9828 #ifdef I_STRING
9829 #  include <string.h>
9830 #else
9831 #  include <strings.h>
9832 #endif
9833 #ifdef I_UNISTD
9834 #  include <unistd.h>  /* Needed for NetBSD */
9835 #endif
9836 int main()
9837 {
9838 char buf[128], abc[128];
9839 char *b;
9840 int len;
9841 int off;
9842 int align;
9843
9844 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
9845
9846 for (align = 7; align >= 0; align--) {
9847         for (len = 36; len; len--) {
9848                 b = buf+align;
9849                 bcopy(abc, b, len);
9850                 for (off = 1; off <= len; off++) {
9851                         bcopy(b, b+off, len);
9852                         bcopy(b+off, b, len);
9853                         if (bcmp(b, abc, len))
9854                                 exit(1);
9855                 }
9856         }
9857 }
9858 exit(0);
9859 }
9860 EOCP
9861         set try
9862         if eval $compile_ok; then
9863                 if ./try 2>/dev/null; then
9864                         echo "Yes, it can."
9865                         val="$define"
9866                 else
9867                         echo "It can't, sorry."
9868                         case "$d_memmove" in
9869                         "$define") echo "But that's Ok since you have memmove()." ;;
9870                         esac
9871                 fi
9872         else
9873                 echo "(I can't compile the test program, so we'll assume not...)"
9874                 case "$d_memmove" in
9875                 "$define") echo "But that's Ok since you have memmove()." ;;
9876                 esac
9877         fi
9878         ;;
9879 esac
9880 $rm -f try.* try core
9881 set d_safebcpy
9882 eval $setvar
9883
9884 : can memcpy handle overlapping blocks?
9885 val="$undef"
9886 case "$d_memcpy" in
9887 "$define")
9888         echo " "
9889         echo "Checking to see if your memcpy() can do overlapping copies..." >&4
9890         $cat >try.c <<EOCP
9891 #$i_memory I_MEMORY
9892 #$i_stdlib I_STDLIB
9893 #$i_string I_STRING
9894 #$i_unistd I_UNISTD
9895 EOCP
9896         $cat >>try.c <<'EOCP'
9897 #include <stdio.h>
9898 #ifdef I_MEMORY
9899 #  include <memory.h>
9900 #endif
9901 #ifdef I_STDLIB
9902 #  include <stdlib.h>
9903 #endif
9904 #ifdef I_STRING
9905 #  include <string.h>
9906 #else
9907 #  include <strings.h>
9908 #endif
9909 #ifdef I_UNISTD
9910 #  include <unistd.h>  /* Needed for NetBSD */
9911 #endif
9912 int main()
9913 {
9914 char buf[128], abc[128];
9915 char *b;
9916 int len;
9917 int off;
9918 int align;
9919
9920 /* Copy "abcde..." string to char abc[] so that gcc doesn't
9921    try to store the string in read-only memory. */
9922 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
9923
9924 for (align = 7; align >= 0; align--) {
9925         for (len = 36; len; len--) {
9926                 b = buf+align;
9927                 memcpy(b, abc, len);
9928                 for (off = 1; off <= len; off++) {
9929                         memcpy(b+off, b, len);
9930                         memcpy(b, b+off, len);
9931                         if (memcmp(b, abc, len))
9932                                 exit(1);
9933                 }
9934         }
9935 }
9936 exit(0);
9937 }
9938 EOCP
9939         set try
9940         if eval $compile_ok; then
9941                 if ./try 2>/dev/null; then
9942                         echo "Yes, it can."
9943                         val="$define"
9944                 else
9945                         echo "It can't, sorry."
9946                         case "$d_memmove" in
9947                         "$define") echo "But that's Ok since you have memmove()." ;;
9948                         esac
9949                 fi
9950         else
9951                 echo "(I can't compile the test program, so we'll assume not...)"
9952                 case "$d_memmove" in
9953                 "$define") echo "But that's Ok since you have memmove()." ;;
9954                 esac
9955         fi
9956         ;;
9957 esac
9958 $rm -f try.* try core
9959 set d_safemcpy
9960 eval $setvar
9961
9962 : can memcmp be trusted to compare relative magnitude?
9963 val="$undef"
9964 case "$d_memcmp" in
9965 "$define")
9966         echo " "
9967         echo "Checking if your memcmp() can compare relative magnitude..." >&4
9968         $cat >try.c <<EOCP
9969 #$i_memory I_MEMORY
9970 #$i_stdlib I_STDLIB
9971 #$i_string I_STRING
9972 #$i_unistd I_UNISTD
9973 EOCP
9974         $cat >>try.c <<'EOCP'
9975 #include <stdio.h>
9976 #ifdef I_MEMORY
9977 #  include <memory.h>
9978 #endif
9979 #ifdef I_STDLIB
9980 #  include <stdlib.h>
9981 #endif
9982 #ifdef I_STRING
9983 #  include <string.h>
9984 #else
9985 #  include <strings.h>
9986 #endif
9987 #ifdef I_UNISTD
9988 #  include <unistd.h>  /* Needed for NetBSD */
9989 #endif
9990 int main()
9991 {
9992 char a = -1;
9993 char b = 0;
9994 if ((a < b) && memcmp(&a, &b, 1) < 0)
9995         exit(1);
9996 exit(0);
9997 }
9998 EOCP
9999         set try
10000         if eval $compile_ok; then
10001                 if ./try 2>/dev/null; then
10002                         echo "Yes, it can."
10003                         val="$define"
10004                 else
10005                         echo "No, it can't (it uses signed chars)."
10006                 fi
10007         else
10008                 echo "(I can't compile the test program, so we'll assume not...)"
10009         fi
10010         ;;
10011 esac
10012 $rm -f try.* try core
10013 set d_sanemcmp
10014 eval $setvar
10015
10016 : see if select exists
10017 set select d_select
10018 eval $inlibc
10019
10020 : see if semctl exists
10021 set semctl d_semctl
10022 eval $inlibc
10023
10024 : see if semget exists
10025 set semget d_semget
10026 eval $inlibc
10027
10028 : see if semop exists
10029 set semop d_semop
10030 eval $inlibc
10031
10032 : see how much of the 'sem*(2)' library is present.
10033 h_sem=true
10034 echo " "
10035 case "$d_semctl$d_semget$d_semop" in
10036 *"$undef"*) h_sem=false;;
10037 esac
10038 case "$osname" in
10039 freebsd)
10040     case "`ipcs 2>&1`" in
10041     "SVID messages"*"not configured"*)
10042         echo "Your $osname does not have the sem*(2) configured." >&4
10043         h_sem=false
10044         val="$undef"
10045         set semctl d_semctl
10046         eval $setvar
10047         set semget d_semget
10048         eval $setvar
10049         set semop d_semop
10050         eval $setvar
10051         ;;
10052     esac
10053     ;;
10054 esac
10055 : we could also check for sys/ipc.h ...
10056 if $h_sem && $test `./findhdr sys/sem.h`; then
10057         echo "You have the full sem*(2) library." >&4
10058         val="$define"
10059 else
10060         echo "You don't have the full sem*(2) library." >&4
10061         val="$undef"
10062 fi
10063 set d_sem
10064 eval $setvar
10065
10066 : see whether sys/sem.h defines union semun
10067 echo " "
10068 $cat > try.c <<'END'
10069 #include <sys/types.h>
10070 #include <sys/ipc.h>
10071 #include <sys/sem.h>
10072 int main () { union semun semun; semun.buf = 0; }
10073 END
10074 set try
10075 if eval $compile; then
10076     echo "You have union semun in <sys/sem.h>." >&4
10077     val="$define"
10078 else
10079     echo "You do not have union semun in <sys/sem.h>." >&4
10080     val="$undef"
10081 fi
10082 $rm -f try try.c try.h
10083 set d_union_semun
10084 eval $setvar
10085
10086 : see how to do semctl IPC_STAT
10087 case "$d_sem" in
10088 $define)
10089     : see whether semctl IPC_STAT can use union semun
10090     echo " "
10091     $cat > try.h <<END
10092 #ifndef S_IRUSR
10093 #   ifdef S_IREAD
10094 #       define S_IRUSR S_IREAD
10095 #       define S_IWUSR S_IWRITE
10096 #       define S_IXUSR S_IEXEC
10097 #   else
10098 #       define S_IRUSR 0400
10099 #       define S_IWUSR 0200
10100 #       define S_IXUSR 0100
10101 #   endif
10102 #   define S_IRGRP (S_IRUSR>>3)
10103 #   define S_IWGRP (S_IWUSR>>3)
10104 #   define S_IXGRP (S_IXUSR>>3)
10105 #   define S_IROTH (S_IRUSR>>6)
10106 #   define S_IWOTH (S_IWUSR>>6)
10107 #   define S_IXOTH (S_IXUSR>>6)
10108 #endif
10109 #ifndef S_IRWXU
10110 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
10111 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
10112 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
10113 #endif
10114 END
10115
10116     $cat > try.c <<END
10117 #include <sys/types.h>
10118 #include <sys/ipc.h>
10119 #include <sys/sem.h>
10120 #include <sys/stat.h>
10121 #include <stdio.h>
10122 #include <errno.h>
10123 #include "try.h"
10124 #ifndef errno
10125 extern int errno;
10126 #endif
10127 #$d_union_semun HAS_UNION_SEMUN
10128 int main() {
10129     union semun
10130 #ifndef HAS_UNION_SEMUN
10131     {
10132         int val;
10133         struct semid_ds *buf;
10134         unsigned short *array;
10135     }
10136 #endif
10137     arg;
10138     int sem, st;
10139
10140 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
10141     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
10142     if (sem > -1) {
10143         struct semid_ds argbuf;
10144         arg.buf = &argbuf;
10145 #       ifdef IPC_STAT
10146         st = semctl(sem, 0, IPC_STAT, arg);
10147         if (st == 0)
10148             printf("semun\n");
10149         else
10150 #       endif /* IPC_STAT */
10151             printf("semctl IPC_STAT failed: errno = %d\n", errno);
10152 #       ifdef IPC_RMID
10153         if (semctl(sem, 0, IPC_RMID, arg) != 0)
10154 #       endif /* IPC_RMID */
10155             printf("semctl IPC_RMID failed: errno = %d\n", errno);
10156     } else
10157 #endif /* IPC_PRIVATE && ... */
10158         printf("semget failed: errno = %d\n", errno);
10159   return 0;
10160 }
10161 END
10162     val="$undef"
10163     set try
10164     if eval $compile; then
10165         xxx=`./try`
10166         case "$xxx" in
10167         semun) val="$define" ;;
10168         esac
10169     fi
10170     $rm -f try try.c
10171     set d_semctl_semun
10172     eval $setvar
10173     case "$d_semctl_semun" in
10174     $define)
10175         echo "You can use union semun for semctl IPC_STAT." >&4
10176         also='also'
10177         ;;
10178     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
10179         also=''
10180         ;;
10181     esac
10182
10183     : see whether semctl IPC_STAT can use struct semid_ds pointer
10184     $cat > try.c <<'END'
10185 #include <sys/types.h>
10186 #include <sys/ipc.h>
10187 #include <sys/sem.h>
10188 #include <sys/stat.h>
10189 #include "try.h"
10190 #include <stdio.h>
10191 #include <errno.h>
10192 #ifndef errno
10193 extern int errno;
10194 #endif
10195 int main() {
10196     struct semid_ds arg;
10197     int sem, st;
10198
10199 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
10200     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
10201     if (sem > -1) {
10202 #       ifdef IPC_STAT
10203         st = semctl(sem, 0, IPC_STAT, &arg);
10204         if (st == 0)
10205             printf("semid_ds\n");
10206         else
10207 #       endif /* IPC_STAT */
10208             printf("semctl IPC_STAT failed: errno = %d\n", errno);
10209 #       ifdef IPC_RMID
10210         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
10211 #       endif /* IPC_RMID */
10212             printf("semctl IPC_RMID failed: errno = %d\n", errno);
10213     } else
10214 #endif /* IPC_PRIVATE && ... */
10215         printf("semget failed: errno = %d\n", errno);
10216
10217     return 0;
10218 }
10219 END
10220     val="$undef"
10221     set try
10222     if eval $compile; then
10223         xxx=`./try`
10224         case "$xxx" in
10225         semid_ds) val="$define" ;;
10226         esac
10227     fi
10228     $rm -f try try.c
10229     set d_semctl_semid_ds
10230     eval $setvar
10231     case "$d_semctl_semid_ds" in
10232     $define)
10233         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
10234         ;;
10235     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
10236         ;;
10237     esac
10238     $rm -f try.h
10239     ;;
10240 *)  val="$undef"
10241
10242     # We do not have the full sem*(2) library, so assume we can not
10243     # use either.
10244
10245     set d_semctl_semun
10246     eval $setvar
10247
10248     set d_semctl_semid_ds
10249     eval $setvar
10250     ;;
10251 esac
10252
10253 : see if setegid exists
10254 set setegid d_setegid
10255 eval $inlibc
10256
10257 : see if seteuid exists
10258 set seteuid d_seteuid
10259 eval $inlibc
10260
10261 : see if setgrent exists
10262 set setgrent d_setgrent
10263 eval $inlibc
10264
10265 : see if sethostent exists
10266 set sethostent d_sethent
10267 eval $inlibc
10268
10269 : see if setlinebuf exists
10270 set setlinebuf d_setlinebuf
10271 eval $inlibc
10272
10273 : see if setlocale exists
10274 set setlocale d_setlocale
10275 eval $inlibc
10276
10277 : see if setnetent exists
10278 set setnetent d_setnent
10279 eval $inlibc
10280
10281 : see if setprotoent exists
10282 set setprotoent d_setpent
10283 eval $inlibc
10284
10285 : see if setpgid exists
10286 set setpgid d_setpgid
10287 eval $inlibc
10288
10289 : see if setpgrp2 exists
10290 set setpgrp2 d_setpgrp2
10291 eval $inlibc
10292
10293 : see if setpriority exists
10294 set setpriority d_setprior
10295 eval $inlibc
10296
10297 : see if setpwent exists
10298 set setpwent d_setpwent
10299 eval $inlibc
10300
10301 : see if setregid exists
10302 set setregid d_setregid
10303 eval $inlibc
10304 set setresgid d_setresgid
10305 eval $inlibc
10306
10307 : see if setreuid exists
10308 set setreuid d_setreuid
10309 eval $inlibc
10310 set setresuid d_setresuid
10311 eval $inlibc
10312
10313 : see if setrgid exists
10314 set setrgid d_setrgid
10315 eval $inlibc
10316
10317 : see if setruid exists
10318 set setruid d_setruid
10319 eval $inlibc
10320
10321 : see if setservent exists
10322 set setservent d_setsent
10323 eval $inlibc
10324
10325 : see if setsid exists
10326 set setsid d_setsid
10327 eval $inlibc
10328
10329 : see if setspent exists
10330 set setspent d_setspent
10331 eval $inlibc
10332
10333 : see if setvbuf exists
10334 set setvbuf d_setvbuf
10335 eval $inlibc
10336
10337 : see if sfio.h is available
10338 set sfio.h i_sfio
10339 eval $inhdr
10340
10341
10342 : see if sfio library is available
10343 case "$i_sfio" in
10344 $define)
10345         val=''
10346         set sfreserve val
10347         eval $inlibc
10348         ;;
10349 *)
10350         val="$undef"
10351         ;;
10352 esac
10353 : Ok, but do we want to use it.
10354 case "$val" in
10355 $define)
10356         case "$usesfio" in
10357         true|$define|[yY]*) dflt='y';;
10358         *) dflt='n';;
10359         esac
10360         echo "$package can use the sfio library, but it is experimental."
10361         rp="You seem to have sfio available, do you want to try using it?"
10362         . ./myread
10363         case "$ans" in
10364         y|Y) ;;
10365         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
10366                 val="$undef"
10367                 : Remove sfio from list of libraries to use
10368                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
10369                 shift
10370                 libs="$*"
10371                 echo "libs = $libs" >&4
10372                 ;;
10373         esac
10374         ;;
10375 *)      case "$usesfio" in
10376         true|$define|[yY]*)
10377                 echo "Sorry, cannot find sfio on this machine" >&4
10378                 echo "Ignoring your setting of usesfio=$usesfio" >&4
10379                 ;;
10380         esac
10381         ;;
10382 esac
10383 set d_sfio
10384 eval $setvar
10385 case "$d_sfio" in
10386 $define) usesfio='true';;
10387 *) usesfio='false';;
10388 esac
10389
10390 : see if shmctl exists
10391 set shmctl d_shmctl
10392 eval $inlibc
10393
10394 : see if shmget exists
10395 set shmget d_shmget
10396 eval $inlibc
10397
10398 : see if shmat exists
10399 set shmat d_shmat
10400 eval $inlibc
10401 : see what shmat returns
10402 case "$d_shmat" in
10403 "$define")
10404         $cat >shmat.c <<'END'
10405 #include <sys/shm.h>
10406 void *shmat();
10407 END
10408         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
10409                 shmattype='void *'
10410         else
10411                 shmattype='char *'
10412         fi
10413         echo "and it returns ($shmattype)." >&4
10414         : see if a prototype for shmat is available
10415         xxx=`./findhdr sys/shm.h`
10416         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
10417         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
10418                 val="$define"
10419         else
10420                 val="$undef"
10421         fi
10422         $rm -f shmat.[co]
10423         ;;
10424 *)
10425         val="$undef"
10426         ;;
10427 esac
10428 set d_shmatprototype
10429 eval $setvar
10430
10431 : see if shmdt exists
10432 set shmdt d_shmdt
10433 eval $inlibc
10434
10435 : see how much of the 'shm*(2)' library is present.
10436 h_shm=true
10437 echo " "
10438 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
10439 *"$undef"*) h_shm=false;;
10440 esac
10441 case "$osname" in
10442 freebsd)
10443     case "`ipcs 2>&1`" in
10444     "SVID shared memory"*"not configured"*)
10445         echo "Your $osname does not have the shm*(2) configured." >&4
10446         h_shm=false
10447         val="$undef"
10448         set shmctl d_shmctl
10449         evat $setvar
10450         set shmget d_shmget
10451         evat $setvar
10452         set shmat d_shmat
10453         evat $setvar
10454         set shmdt d_shmdt
10455         evat $setvar
10456         ;;
10457     esac
10458     ;;
10459 esac
10460 : we could also check for sys/ipc.h ...
10461 if $h_shm && $test `./findhdr sys/shm.h`; then
10462         echo "You have the full shm*(2) library." >&4
10463         val="$define"
10464 else
10465         echo "You don't have the full shm*(2) library." >&4
10466         val="$undef"
10467 fi
10468 set d_shm
10469 eval $setvar
10470
10471 echo " "
10472 : see if we have sigaction
10473 if set sigaction val -f d_sigaction; eval $csym; $val; then
10474         echo 'sigaction() found.' >&4
10475         $cat > try.c <<'EOP'
10476 #include <stdio.h>
10477 #include <sys/types.h>
10478 #include <signal.h>
10479 int main()
10480 {
10481     struct sigaction act, oact;
10482     act.sa_flags = 0;
10483     oact.sa_handler = 0;
10484     /* so that act and oact are used */
10485     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
10486 }
10487 EOP
10488         set try
10489         if eval $compile_ok; then
10490                 val="$define"
10491         else
10492                 echo "But you don't seem to have a useable struct sigaction." >&4
10493                 val="$undef"
10494         fi
10495 else
10496         echo 'sigaction NOT found.' >&4
10497         val="$undef"
10498 fi
10499 set d_sigaction; eval $setvar
10500 $rm -f try try$_o try.c
10501
10502 : see if sigsetjmp exists
10503 echo " "
10504 case "$d_sigsetjmp" in
10505 '')
10506         $cat >try.c <<'EOP'
10507 #include <setjmp.h>
10508 sigjmp_buf env;
10509 int set = 1;
10510 int main()
10511 {
10512         if (sigsetjmp(env,1))
10513                 exit(set);
10514         set = 0;
10515         siglongjmp(env, 1);
10516         exit(1);
10517 }
10518 EOP
10519         set try
10520         if eval $compile; then
10521                 if ./try >/dev/null 2>&1; then
10522                         echo "POSIX sigsetjmp found." >&4
10523                         val="$define"
10524                 else
10525                         $cat >&4 <<EOM
10526 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
10527 I'll ignore them.
10528 EOM
10529                         val="$undef"
10530                 fi
10531         else
10532                 echo "sigsetjmp not found." >&4
10533                 val="$undef"
10534         fi
10535         ;;
10536 *) val="$d_sigsetjmp"
10537         case "$d_sigsetjmp" in
10538         $define) echo "POSIX sigsetjmp found." >&4;;
10539         $undef) echo "sigsetjmp not found." >&4;;
10540         esac
10541         ;;
10542 esac
10543 set d_sigsetjmp
10544 eval $setvar
10545 $rm -f try.c try
10546
10547 : see if sqrtl exists
10548 set sqrtl d_sqrtl
10549 eval $inlibc
10550
10551 : see if sys/stat.h is available
10552 set sys/stat.h i_sysstat
10553 eval $inhdr
10554
10555
10556 : see if stat knows about block sizes
10557 echo " "
10558 echo "Checking to see if your struct stat has st_blocks field..." >&4
10559 set d_statblks stat st_blocks $i_sysstat sys/stat.h
10560 eval $hasfield
10561
10562
10563 : see if this is a sys/vfs.h system
10564 set sys/vfs.h i_sysvfs
10565 eval $inhdr
10566
10567
10568 : see if this is a sys/statfs.h system
10569 set sys/statfs.h i_sysstatfs
10570 eval $inhdr
10571
10572
10573 echo " "
10574 echo "Checking to see if your system supports struct statfs..." >&4
10575 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
10576 eval $hasstruct
10577 case "$d_statfs_s" in
10578 "$define")      echo "Yes, it does."   ;;
10579 *)              echo "No, it doesn't." ;;
10580 esac
10581
10582
10583
10584 : see if struct statfs knows about f_flags
10585 case "$d_statfs_s" in
10586 define) 
10587         echo " "
10588         echo "Checking to see if your struct statfs has f_flags field..." >&4
10589         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
10590         eval $hasfield
10591         ;;
10592 *)      val="$undef"
10593         set d_statfs_f_flags
10594         eval $setvar
10595         ;;
10596 esac
10597 case "$d_statfs_f_flags" in
10598 "$define")      echo "Yes, it does."   ;;
10599 *)              echo "No, it doesn't." ;;
10600 esac
10601
10602 : see if _ptr and _cnt from stdio act std
10603 echo " "
10604 if $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
10605         echo "(Looks like you have stdio.h from Linux.)"
10606         case "$stdio_ptr" in
10607         '') stdio_ptr='((fp)->_IO_read_ptr)'
10608                 ptr_lval=$define
10609                 ;;
10610         *)      ptr_lval=$d_stdio_ptr_lval;;
10611         esac
10612         case "$stdio_cnt" in
10613         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
10614                 cnt_lval=$undef
10615                 ;;
10616         *)      cnt_lval=$d_stdio_cnt_lval;;
10617         esac
10618         case "$stdio_base" in
10619         '') stdio_base='((fp)->_IO_read_base)';;
10620         esac
10621         case "$stdio_bufsiz" in
10622         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
10623         esac
10624 else
10625         case "$stdio_ptr" in
10626         '') stdio_ptr='((fp)->_ptr)'
10627                 ptr_lval=$define
10628                 ;;
10629         *)      ptr_lval=$d_stdio_ptr_lval;;
10630         esac
10631         case "$stdio_cnt" in
10632         '') stdio_cnt='((fp)->_cnt)'
10633                 cnt_lval=$define
10634                 ;;
10635         *)      cnt_lval=$d_stdio_cnt_lval;;
10636         esac
10637         case "$stdio_base" in
10638         '') stdio_base='((fp)->_base)';;
10639         esac
10640         case "$stdio_bufsiz" in
10641         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
10642         esac
10643 fi
10644 : test whether _ptr and _cnt really work
10645 echo "Checking how std your stdio is..." >&4
10646 $cat >try.c <<EOP
10647 #include <stdio.h>
10648 #define FILE_ptr(fp)    $stdio_ptr
10649 #define FILE_cnt(fp)    $stdio_cnt
10650 int main() {
10651         FILE *fp = fopen("try.c", "r");
10652         char c = getc(fp);
10653         if (
10654                 18 <= FILE_cnt(fp) &&
10655                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
10656         )
10657                 exit(0);
10658         exit(1);
10659 }
10660 EOP
10661 val="$undef"
10662 set try
10663 if eval $compile; then
10664         if ./try; then
10665                 echo "Your stdio acts pretty std."
10666                 val="$define"
10667         else
10668                 echo "Your stdio isn't very std."
10669         fi
10670 else
10671         echo "Your stdio doesn't appear very std."
10672 fi
10673 $rm -f try.c try
10674 set d_stdstdio
10675 eval $setvar
10676
10677 : Can _ptr be used as an lvalue?
10678 case "$d_stdstdio$ptr_lval" in
10679 $define$define) val=$define ;;
10680 *) val=$undef ;;
10681 esac
10682 set d_stdio_ptr_lval
10683 eval $setvar
10684
10685 : Can _cnt be used as an lvalue?
10686 case "$d_stdstdio$cnt_lval" in
10687 $define$define) val=$define ;;
10688 *) val=$undef ;;
10689 esac
10690 set d_stdio_cnt_lval
10691 eval $setvar
10692
10693 : see if _base is also standard
10694 val="$undef"
10695 case "$d_stdstdio" in
10696 $define)
10697         $cat >try.c <<EOP
10698 #include <stdio.h>
10699 #define FILE_base(fp)   $stdio_base
10700 #define FILE_bufsiz(fp) $stdio_bufsiz
10701 int main() {
10702         FILE *fp = fopen("try.c", "r");
10703         char c = getc(fp);
10704         if (
10705                 19 <= FILE_bufsiz(fp) &&
10706                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
10707         )
10708                 exit(0);
10709         exit(1);
10710 }
10711 EOP
10712         set try
10713         if eval $compile; then
10714                 if ./try; then
10715                         echo "And its _base field acts std."
10716                         val="$define"
10717                 else
10718                         echo "But its _base field isn't std."
10719                 fi
10720         else
10721                 echo "However, it seems to be lacking the _base field."
10722         fi
10723         $rm -f try.c try
10724         ;;
10725 esac
10726 set d_stdiobase
10727 eval $setvar
10728
10729 $cat >&4 <<EOM
10730 Checking how to access stdio streams by file descriptor number...
10731 EOM
10732 case "$stdio_stream_array" in
10733 '')     $cat >try.c <<EOCP
10734 #include <stdio.h>
10735 int main() {
10736   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
10737     printf("yes\n");
10738 }
10739 EOCP
10740         for s in _iob __iob __sF
10741         do
10742                 set try -DSTDIO_STREAM_ARRAY=$s
10743                 if eval $compile; then
10744                         case "`./try$exe_ext`" in
10745                         yes)    stdio_stream_array=$s; break ;;
10746                         esac
10747                 fi
10748         done
10749         $rm -f try.* try$exe_ext
10750 esac
10751 case "$stdio_stream_array" in
10752 '')     $cat >&4 <<EOM
10753 I can't figure out how to access stdio streams by file descriptor number.
10754 EOM
10755         d_stdio_stream_array="$undef"
10756         ;;
10757 *)      $cat >&4 <<EOM
10758 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
10759 EOM
10760         d_stdio_stream_array="$define"
10761         ;;
10762 esac
10763
10764 : see if strcoll exists
10765 set strcoll d_strcoll
10766 eval $inlibc
10767
10768 : check for structure copying
10769 echo " "
10770 echo "Checking to see if your C compiler can copy structs..." >&4
10771 $cat >try.c <<'EOCP'
10772 int main()
10773 {
10774         struct blurfl {
10775                 int dyick;
10776         } foo, bar;
10777
10778         foo = bar;
10779 }
10780 EOCP
10781 if $cc -c try.c >/dev/null 2>&1 ; then
10782         val="$define"
10783         echo "Yup, it can."
10784 else
10785         val="$undef"
10786         echo "Nope, it can't."
10787 fi
10788 set d_strctcpy
10789 eval $setvar
10790 $rm -f try.*
10791
10792 : see if strerror and/or sys_errlist[] exist
10793 echo " "
10794 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
10795     if set strerror val -f d_strerror; eval $csym; $val; then
10796                 echo 'strerror() found.' >&4
10797                 d_strerror="$define"
10798                 d_strerrm='strerror(e)'
10799                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
10800                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
10801                         d_syserrlst="$define"
10802                 else
10803                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
10804                         d_syserrlst="$undef"
10805                 fi
10806     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
10807                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
10808                 echo 'strerror() found in string header.' >&4
10809                 d_strerror="$define"
10810                 d_strerrm='strerror(e)'
10811                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
10812                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
10813                                 d_syserrlst="$define"
10814                 else
10815                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
10816                         d_syserrlst="$undef"
10817                 fi
10818     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
10819                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
10820                 d_strerror="$undef"
10821                 d_syserrlst="$define"
10822                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
10823     else
10824                 echo 'strerror() and sys_errlist[] NOT found.' >&4
10825                 d_strerror="$undef"
10826                 d_syserrlst="$undef"
10827                 d_strerrm='"unknown"'
10828     fi
10829 fi
10830
10831 : see if strtod exists
10832 set strtod d_strtod
10833 eval $inlibc
10834
10835 : see if strtol exists
10836 set strtol d_strtol
10837 eval $inlibc
10838
10839 : see if strtoul exists
10840 set strtoul d_strtoul
10841 eval $inlibc
10842
10843 : see if strtoull exists
10844 set strtoull d_strtoull
10845 eval $inlibc
10846
10847 : see if strxfrm exists
10848 set strxfrm d_strxfrm
10849 eval $inlibc
10850
10851 : see if symlink exists
10852 set symlink d_symlink
10853 eval $inlibc
10854
10855 : see if syscall exists
10856 set syscall d_syscall
10857 eval $inlibc
10858
10859 : see if sysconf exists
10860 set sysconf d_sysconf
10861 eval $inlibc
10862
10863 : see if system exists
10864 set system d_system
10865 eval $inlibc
10866
10867 : see if tcgetpgrp exists
10868 set tcgetpgrp d_tcgetpgrp
10869 eval $inlibc
10870
10871 : see if tcsetpgrp exists
10872 set tcsetpgrp d_tcsetpgrp
10873 eval $inlibc
10874
10875 : see if prototype for telldir is available
10876 echo " "
10877 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
10878 eval $hasproto
10879
10880 : see if this is a sys/times.h system
10881 set sys/times.h i_systimes
10882 eval $inhdr
10883
10884 : see if times exists
10885 echo " "
10886 if set times val -f d_times; eval $csym; $val; then
10887         echo 'times() found.' >&4
10888         d_times="$define"
10889         inc=''
10890         case "$i_systimes" in
10891         "$define") inc='sys/times.h';;
10892         esac
10893         rp="What is the type returned by times() on this system?"
10894         set clock_t clocktype long stdio.h sys/types.h $inc
10895         eval $typedef_ask
10896 else
10897         echo 'times() NOT found, hope that will do.' >&4
10898         d_times="$undef"
10899         clocktype='int'
10900 fi
10901
10902 : see if truncate exists
10903 set truncate d_truncate
10904 eval $inlibc
10905
10906 : see if tzname[] exists
10907 echo " "
10908 if set tzname val -a d_tzname; eval $csym; $val; then
10909         val="$define"
10910         echo 'tzname[] found.' >&4
10911 else
10912         val="$undef"
10913         echo 'tzname[] NOT found.' >&4
10914 fi
10915 set d_tzname
10916 eval $setvar
10917
10918 : see if umask exists
10919 set umask d_umask
10920 eval $inlibc
10921
10922 : see if ustat exists
10923 set ustat d_ustat
10924 eval $inlibc
10925
10926 : backward compatibility for d_hvfork
10927 if test X$d_hvfork != X; then
10928         d_vfork="$d_hvfork"
10929         d_hvfork=''
10930 fi
10931 : see if there is a vfork
10932 val=''
10933 set vfork val
10934 eval $inlibc
10935
10936 : Ok, but do we want to use it. vfork is reportedly unreliable in 
10937 : perl on Solaris 2.x, and probably elsewhere.
10938 case "$val" in
10939 $define)
10940         echo " "
10941         case "$usevfork" in
10942         false) dflt='n';;
10943         *) dflt='y';;
10944         esac
10945         cat <<'EOM'
10946  
10947 Perl can only use a vfork() that doesn't suffer from strict
10948 restrictions on calling functions or modifying global data in
10949 the child.  For example, glibc-2.1 contains such a vfork()
10950 that is unsuitable.  If your system provides a proper fork()
10951 call, chances are that you do NOT want perl to use vfork().
10952
10953 EOM
10954         rp="Do you still want to use vfork()?"
10955         . ./myread
10956         case "$ans" in
10957         y|Y) ;;
10958         *)
10959                 echo "Ok, we won't use vfork()."
10960                 val="$undef"
10961                 ;;
10962         esac
10963         ;;
10964 esac
10965 set d_vfork
10966 eval $setvar
10967 case "$d_vfork" in
10968 $define) usevfork='true';;
10969 *) usevfork='false';;
10970 esac
10971
10972 : see if this is an sysdir system
10973 set sys/dir.h i_sysdir
10974 eval $inhdr
10975
10976 : see if this is an sysndir system
10977 set sys/ndir.h i_sysndir
10978 eval $inhdr
10979
10980 : see if closedir exists
10981 set closedir d_closedir
10982 eval $inlibc
10983
10984 case "$d_closedir" in
10985 "$define")
10986         echo " "
10987         echo "Checking whether closedir() returns a status..." >&4
10988         cat > closedir.c <<EOM
10989 #$i_dirent I_DIRENT             /**/
10990 #$i_sysdir I_SYS_DIR            /**/
10991 #$i_sysndir I_SYS_NDIR          /**/
10992 #$i_systypes I_SYS_TYPES        /**/
10993
10994 #if defined(I_SYS_TYPES)
10995 #include <sys/types.h>
10996 #endif
10997 #if defined(I_DIRENT)
10998 #include <dirent.h>
10999 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
11000 #include <sys/dir.h>
11001 #endif
11002 #else
11003 #ifdef I_SYS_NDIR
11004 #include <sys/ndir.h>
11005 #else
11006 #ifdef I_SYS_DIR
11007 #ifdef hp9000s500
11008 #include <ndir.h>       /* may be wrong in the future */
11009 #else
11010 #include <sys/dir.h>
11011 #endif
11012 #endif
11013 #endif
11014 #endif 
11015 int main() { return closedir(opendir(".")); }
11016 EOM
11017         set closedir
11018         if eval $compile_ok; then
11019                 if ./closedir > /dev/null 2>&1 ; then
11020                         echo "Yes, it does."
11021                         val="$undef"
11022                 else
11023                         echo "No, it doesn't."
11024                         val="$define"
11025                 fi
11026         else
11027                 echo "(I can't seem to compile the test program--assuming it doesn't)"
11028                 val="$define"
11029         fi
11030         ;;
11031 *)
11032         val="$undef";
11033         ;;
11034 esac
11035 set d_void_closedir
11036 eval $setvar
11037 $rm -f closedir*
11038 : check for volatile keyword
11039 echo " "
11040 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
11041 $cat >try.c <<'EOCP'
11042 int main()
11043 {
11044         typedef struct _goo_struct goo_struct;
11045         goo_struct * volatile goo = ((goo_struct *)0);
11046         struct _goo_struct {
11047                 long long_int;
11048                 int reg_int;
11049                 char char_var;
11050         };
11051         typedef unsigned short foo_t;
11052         char *volatile foo;
11053         volatile int bar;
11054         volatile foo_t blech;
11055         foo = foo;
11056 }
11057 EOCP
11058 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
11059         val="$define"
11060         echo "Yup, it does."
11061 else
11062         val="$undef"
11063         echo "Nope, it doesn't."
11064 fi
11065 set d_volatile
11066 eval $setvar
11067 $rm -f try.*
11068
11069 : see if there is a wait4
11070 set wait4 d_wait4
11071 eval $inlibc
11072
11073 : see if waitpid exists
11074 set waitpid d_waitpid
11075 eval $inlibc
11076
11077 : see if wcstombs exists
11078 set wcstombs d_wcstombs
11079 eval $inlibc
11080
11081 : see if wctomb exists
11082 set wctomb d_wctomb
11083 eval $inlibc
11084
11085 : preserve RCS keywords in files with variable substitution, grrr
11086 Date='$Date'
11087 Id='$Id'
11088 Log='$Log'
11089 RCSfile='$RCSfile'
11090 Revision='$Revision'
11091
11092 case "$crosscompile" in
11093 ''|[nN]*) crosscompile="$undef" ;;
11094 esac
11095
11096 case "$osname" in
11097 next|rhapsody) multiarch="$define" ;;
11098 esac
11099 case "$multiarch" in
11100 ''|[nN]*) multiarch="$undef" ;;
11101 esac
11102
11103 : check for alignment requirements
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 memory alignment check.
11110
11111 EOM
11112         case "$alignbytes" in
11113         '') alignbytes=8 ;;
11114         esac
11115         ;;
11116 *)
11117         case "$alignbytes" in
11118         '') echo "Checking alignment constraints..." >&4
11119                 $cat >try.c <<'EOCP'
11120 #include <stdio.h>
11121 struct foobar {
11122         char foo;
11123         double bar;
11124 } try_algn;
11125 int main()
11126 {
11127     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
11128     return(0);
11129 }
11130 EOCP
11131                 set try
11132                 if eval $compile_ok; then
11133                         dflt=`./try`
11134                 else
11135                         dflt='8'
11136                         echo "(I can't seem to compile the test program...)"
11137                 fi
11138                 ;;
11139         *) dflt="$alignbytes"
11140                 ;;
11141         esac
11142         rp="Doubles must be aligned on a how-many-byte boundary?"
11143         . ./myread
11144         alignbytes="$ans"
11145         $rm -f try.c try
11146         ;;
11147 esac
11148
11149
11150 : check for ordering of bytes in a long
11151 echo " "
11152 case "$crosscompile$multiarch" in
11153 *$define*)
11154         $cat <<EOM
11155 You seem to be either cross-compiling or doing a multiarchitecture build,
11156 skipping the byteorder check.
11157
11158 EOM
11159         byteorder='0xffff'
11160         ;;
11161 *)
11162         case "$byteorder" in
11163         '')
11164                 $cat <<'EOM'
11165 In the following, larger digits indicate more significance.  A big-endian
11166 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
11167 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
11168 machines may have weird orders like 3412.  A Cray will report 87654321,
11169 an Alpha will report 12345678. If the test program works the default is
11170 probably right.
11171 I'm now running the test program...
11172 EOM
11173                 $cat >try.c <<'EOCP'
11174 #include <stdio.h>
11175 int main()
11176 {
11177         int i;
11178         union {
11179                 unsigned long l;
11180                 char c[sizeof(long)];
11181         } u;
11182
11183         if (sizeof(long) > 4)
11184                 u.l = (0x08070605L << 32) | 0x04030201L;
11185         else
11186                 u.l = 0x04030201L;
11187         for (i = 0; i < sizeof(long); i++)
11188                 printf("%c", u.c[i]+'0');
11189         printf("\n");
11190         exit(0);
11191 }
11192 EOCP
11193                 xxx_prompt=y
11194                 set try
11195                 if eval $compile && ./try > /dev/null; then
11196                         dflt=`./try`
11197                         case "$dflt" in
11198                         [1-4][1-4][1-4][1-4]|12345678|87654321)
11199                                 echo "(The test program ran ok.)"
11200                                 echo "byteorder=$dflt"
11201                                 xxx_prompt=n
11202                         ;;
11203                         ????|????????) echo "(The test program ran ok.)" ;;
11204                         *) echo "(The test program didn't run right for some reason.)" ;;
11205                         esac
11206                 else
11207                         dflt='4321'
11208                         cat <<'EOM'
11209 (I can't seem to compile the test program.  Guessing big-endian...)
11210 EOM
11211                 fi
11212                 case "$xxx_prompt" in
11213                 y)
11214                         rp="What is the order of bytes in a long?"
11215                         . ./myread
11216                         byteorder="$ans"
11217                         ;;
11218                 *)      byteorder=$dflt
11219                         ;;
11220                 esac
11221                 ;;
11222         esac
11223         $rm -f try.c try
11224         ;;
11225 esac
11226
11227
11228 : how do we catenate cpp tokens here?
11229 echo " "
11230 echo "Checking to see how your cpp does stuff like catenate tokens..." >&4
11231 $cat >cpp_stuff.c <<'EOCP'
11232 #define RCAT(a,b)a/**/b
11233 #define ACAT(a,b)a ## b
11234 RCAT(Rei,ser)
11235 ACAT(Cir,cus)
11236 EOCP
11237 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
11238 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
11239         echo "Oh!  Smells like ANSI's been here." >&4
11240         echo "We can catify or stringify, separately or together!"
11241         cpp_stuff=42
11242 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
11243         echo "Ah, yes!  The good old days!" >&4
11244         echo "However, in the good old days we don't know how to stringify and"
11245         echo "catify at the same time."
11246         cpp_stuff=1
11247 else
11248         $cat >&4 <<EOM
11249 Hmm, I don't seem to be able to catenate tokens with your cpp.  You're going
11250 to have to edit the values of CAT[2-5] in config.h...
11251 EOM
11252         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
11253 fi
11254 $rm -f cpp_stuff.*
11255
11256 : see if this is a db.h system
11257 set db.h i_db
11258 eval $inhdr
11259
11260 case "$i_db" in
11261 $define)
11262         : Check db version.
11263         echo " "
11264         echo "Checking Berkeley DB version ..." >&4
11265         $cat >try.c <<EOCP
11266 #$d_const HASCONST
11267 #ifndef HASCONST
11268 #define const
11269 #endif
11270 #include <sys/types.h>
11271 #include <stdio.h>
11272 #include <db.h>
11273 int main()
11274 {
11275 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
11276     int Major, Minor, Patch ;
11277     unsigned long Version ;
11278     (void)db_version(&Major, &Minor, &Patch) ;
11279     printf("You have Berkeley DB Version 2 or greater\n");
11280
11281     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
11282                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
11283     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
11284                 Major, Minor, Patch) ;
11285
11286     /* check that db.h & libdb are compatible */
11287     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
11288         printf("db.h and libdb are incompatible\n") ;
11289         exit(3);        
11290     }
11291
11292     printf("db.h and libdb are compatible\n") ;
11293
11294     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
11295                 + DB_VERSION_PATCH ;
11296
11297     /* needs to be >= 2.3.4 */
11298     if (Version < 2003004) {
11299     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
11300         printf("but Perl needs Berkeley DB 2.3.4 or greater\n") ;
11301         exit(2);        
11302     }
11303
11304     exit(0);
11305 #else
11306 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
11307     printf("You have Berkeley DB Version 1\n");
11308     exit(0);    /* DB version < 2: the coast is clear. */
11309 #else
11310     exit(1);    /* <db.h> not Berkeley DB? */
11311 #endif
11312 #endif
11313 }
11314 EOCP
11315         set try
11316         if eval $compile_ok && ./try; then
11317                 echo 'Looks OK.' >&4
11318         else
11319                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
11320                 i_db=$undef
11321                 case " $libs " in
11322                 *"-ldb "*)
11323                         : Remove db from list of libraries to use
11324                         echo "Removing unusable -ldb from library list" >&4
11325                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
11326                         shift
11327                         libs="$*"
11328                         echo "libs = $libs" >&4
11329                         ;;
11330                 esac
11331         fi
11332         $rm -f try.*
11333         ;;
11334 esac
11335
11336 case "$i_db" in
11337 define)
11338         : Check the return type needed for hash 
11339         echo " "
11340         echo "Checking return type needed for hash for Berkeley DB ..." >&4
11341         $cat >try.c <<EOCP
11342 #$d_const HASCONST
11343 #ifndef HASCONST
11344 #define const
11345 #endif
11346 #include <sys/types.h>
11347 #include <db.h>
11348
11349 #ifndef DB_VERSION_MAJOR
11350 u_int32_t hash_cb (ptr, size)
11351 const void *ptr;
11352 size_t size;
11353 {
11354 }
11355 HASHINFO info;
11356 int main()
11357 {
11358         info.hash = hash_cb;
11359 }
11360 #endif
11361 EOCP
11362         if $cc $ccflags -c try.c >try.out 2>&1 ; then
11363                 if $contains warning try.out >>/dev/null 2>&1 ; then
11364                         db_hashtype='int'
11365                 else
11366                         db_hashtype='u_int32_t'
11367                 fi
11368         else
11369                 : XXX Maybe we should just give up here.
11370                 db_hashtype=u_int32_t
11371                 $cat try.out >&4
11372                 echo "Help:  I can't seem to compile the db test program." >&4
11373                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
11374         fi
11375         $rm -f try.*
11376         echo "Your version of Berkeley DB uses $db_hashtype for hash."
11377         ;;
11378 *)      db_hashtype=u_int32_t
11379         ;;
11380 esac
11381 case "$i_db" in
11382 define)
11383         : Check the return type needed for prefix 
11384         echo " "
11385         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
11386         cat >try.c <<EOCP
11387 #$d_const HASCONST
11388 #ifndef HASCONST
11389 #define const
11390 #endif
11391 #include <sys/types.h>
11392 #include <db.h>
11393
11394 #ifndef DB_VERSION_MAJOR
11395 size_t prefix_cb (key1, key2)
11396 const DBT *key1;
11397 const DBT *key2;
11398 {
11399 }
11400 BTREEINFO info;
11401 int main()
11402 {
11403         info.prefix = prefix_cb;
11404 }
11405 #endif
11406 EOCP
11407         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
11408                 if $contains warning try.out >>/dev/null 2>&1 ; then
11409                         db_prefixtype='int'
11410                 else
11411                         db_prefixtype='size_t'
11412                 fi
11413         else
11414                 db_prefixtype='size_t'
11415                 : XXX Maybe we should just give up here.
11416                 $cat try.out >&4
11417                 echo "Help:  I can't seem to compile the db test program." >&4
11418                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
11419         fi
11420         $rm -f try.*
11421         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
11422         ;;
11423 *)      db_prefixtype='size_t'
11424         ;;
11425 esac
11426
11427 : check for void type
11428 echo " "
11429 echo "Checking to see how well your C compiler groks the void type..." >&4
11430 case "$voidflags" in
11431 '')
11432         $cat >try.c <<'EOCP'
11433 #if TRY & 1
11434 void sub() {
11435 #else
11436 sub() {
11437 #endif
11438         extern void moo();      /* function returning void */
11439         void (*goo)();          /* ptr to func returning void */
11440 #if TRY & 8
11441         void *hue;              /* generic ptr */
11442 #endif
11443 #if TRY & 2
11444         void (*foo[10])();
11445 #endif
11446
11447 #if TRY & 4
11448         if(goo == moo) {
11449                 exit(0);
11450         }
11451 #endif
11452         exit(0);
11453 }
11454 int main() { sub(); }
11455 EOCP
11456         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
11457                 voidflags=$defvoidused
11458         echo "Good.  It appears to support void to the level $package wants.">&4
11459                 if $contains warning .out >/dev/null 2>&1; then
11460                         echo "However, you might get some warnings that look like this:"
11461                         $cat .out
11462                 fi
11463         else
11464 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
11465                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
11466                         echo "It supports 1..."
11467                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
11468                                 echo "It also supports 2..."
11469                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
11470                                         voidflags=7
11471                                         echo "And it supports 4 but not 8 definitely."
11472                                 else
11473                                         echo "It doesn't support 4..."
11474                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
11475                                                 voidflags=11
11476                                                 echo "But it supports 8."
11477                                         else
11478                                                 voidflags=3
11479                                                 echo "Neither does it support 8."
11480                                         fi
11481                                 fi
11482                         else
11483                                 echo "It does not support 2..."
11484                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
11485                                         voidflags=13
11486                                         echo "But it supports 4 and 8."
11487                                 else
11488                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
11489                                                 voidflags=5
11490                                                 echo "And it supports 4 but has not heard about 8."
11491                                         else
11492                                                 echo "However it supports 8 but not 4."
11493                                         fi
11494                                 fi
11495                         fi
11496                 else
11497                         echo "There is no support at all for void."
11498                         voidflags=0
11499                 fi
11500         fi
11501 esac
11502 case "$voidflags" in
11503 "$defvoidused") ;;
11504 *)      $cat >&4 <<'EOM'
11505   Support flag bits are:
11506     1: basic void declarations.
11507     2: arrays of pointers to functions returning void.
11508     4: operations between pointers to and addresses of void functions.
11509     8: generic void pointers.
11510 EOM
11511         dflt="$voidflags";
11512         rp="Your void support flags add up to what?"
11513         . ./myread
11514         voidflags="$ans"
11515         ;;
11516 esac
11517 $rm -f try.* .out
11518
11519
11520 : How can we generate normalized random numbers ?
11521 echo " "
11522 echo "Looking for a random number function..." >&4
11523 case "$randfunc" in
11524 '')
11525         if set drand48 val -f; eval $csym; $val; then
11526                 dflt="drand48"
11527                 echo "Good, found drand48()." >&4
11528         elif set random val -f; eval $csym; $val; then
11529                 dflt="random"
11530                 echo "OK, found random()." >&4
11531         else
11532                 dflt="rand"
11533                 echo "Yick, looks like I have to use rand()." >&4
11534         fi
11535         echo " "
11536         ;;
11537 *)
11538         dflt="$randfunc"
11539         ;;
11540 esac
11541 cont=true
11542
11543 case "$ccflags" in
11544 *-Dmy_rand=*|*-Dmy_srand=*)
11545         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
11546         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
11547         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
11548         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
11549         ;;
11550 esac
11551
11552 while $test "$cont"; do
11553         rp="Use which function to generate random numbers?"
11554         . ./myread
11555         if $test "$ans" = "$dflt"; then
11556                 : null
11557         else
11558                 randbits=''
11559         fi
11560         randfunc="$ans"
11561         if set $ans val -f; eval $csym; $val; then
11562                 cont=''
11563         else
11564                 dflt=y
11565                 rp="I cannot find function $ans. Use that name anyway?"
11566                 . ./myread
11567                 dflt=rand
11568                 case "$ans" in
11569                         [yY]*) cont='';;
11570                 esac
11571         fi
11572         case "$cont" in
11573         '')
11574                 case "$randfunc" in
11575                 drand48)
11576                         drand01="drand48()"
11577                         seedfunc="srand48"
11578                         randbits=48
11579                         randseedtype=long
11580                         ;;
11581                 rand|random)
11582                         case "$randbits" in
11583                         '')
11584 echo "Checking to see how many bits your $randfunc() function produces..." >&4
11585                                 $cat >try.c <<EOCP
11586 #$i_unistd I_UNISTD
11587 #$i_stdlib I_STDLIB
11588 #include <stdio.h>
11589 #ifdef I_UNISTD
11590 #  include <unistd.h>
11591 #endif
11592 #ifdef I_STDLIB
11593 #  include <stdlib.h>
11594 #endif
11595 int main()
11596 {
11597         register int i;
11598         register unsigned long tmp;
11599         register unsigned long max = 0L;
11600
11601         for (i = 1000; i; i--) {
11602                 tmp = (unsigned long) $randfunc();
11603                 if (tmp > max) max = tmp;
11604         }
11605         for (i = 0; max; i++)
11606                 max /= 2;
11607         printf("%d\n",i);
11608 }
11609 EOCP
11610                                 set try
11611                                 if eval $compile_ok; then
11612                                         dflt=`try`
11613                                 else
11614                                         dflt='?'
11615                                         echo "(I can't seem to compile the test program...)"
11616                                 fi
11617                                 ;;
11618                         *)
11619                                 dflt="$randbits"
11620                                 ;;
11621                         esac
11622                         rp="How many bits does your $randfunc() function produce?"
11623                         . ./myread
11624                         randbits="$ans"
11625                         $rm -f try.c try
11626                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
11627                         seedfunc="s$randfunc"
11628                         randseedtype=unsigned
11629                         ;;
11630                 *)
11631                         dflt="31"
11632                         rp="How many bits does your $randfunc() function produce?"
11633                         . ./myread
11634                         randbits="$ans"
11635                         seedfunc="s$randfunc"
11636                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
11637                         if set $seedfunc val -f; eval $csym; $val; then
11638                                 echo "(Using $seedfunc() to seed random generator)"
11639                         else
11640                                 echo "(Warning: no $seedfunc() to seed random generator)"
11641                                 seedfunc=rand
11642                         fi
11643                         randseedtype=unsigned
11644                         ;;
11645                 esac
11646                 ;;
11647         esac
11648 done
11649
11650 echo " "
11651 echo "Determining whether or not we are on an EBCDIC system..." >&4
11652 $cat >tebcdic.c <<'EOM'
11653 int main()
11654 {
11655   if ('M'==0xd4) return 0;
11656   return 1;
11657 }
11658 EOM
11659
11660 val=$undef
11661 set tebcdic
11662 if eval $compile_ok; then
11663         if ./tebcdic; then
11664                 echo "You have EBCDIC." >&4
11665                 val="$define"
11666         else
11667                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin." >&4
11668         fi
11669 else
11670         echo "I'm unable to compile the test program." >&4
11671         echo "I'll assume ASCII or some ISO Latin." >&4
11672 fi
11673 $rm -f tebcdic.c tebcdic
11674 set ebcdic
11675 eval $setvar
11676
11677 echo " "
11678 $cat >&4 <<EOM
11679 Checking how to flush all pending stdio output...
11680 EOM
11681 # I only know how to find the first 32 possibly open files on SunOS.
11682 # See also hints/sunos_4_1.sh and util.c  --AD
11683 case "$osname" in
11684 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
11685 esac
11686 $cat >>try.c <<EOCP
11687 #include <stdio.h>
11688 #$i_unistd I_UNISTD
11689 #ifdef I_UNISTD
11690 # include <unistd.h>
11691 #endif
11692 #$d_sysconf HAS_SYSCONF
11693 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
11694 #ifdef HAS_STDIO_STREAM_ARRAY
11695 # define STDIO_STREAM_ARRAY $stdio_stream_array
11696 #endif
11697 int main() {
11698   FILE* p = fopen("try.out", "w");
11699 #ifdef TRY_FPUTC
11700   fputc('x', p);
11701 #else
11702 # ifdef TRY_FPRINTF
11703   fprintf(p, "x");
11704 # endif
11705 #endif
11706 #ifdef TRY_FFLUSH_NULL
11707   fflush(NULL);
11708 #endif
11709 #ifdef TRY_FFLUSH_ALL
11710   {
11711     long open_max = -1;
11712 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
11713     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
11714 # else
11715 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
11716     open_max = sysconf(_SC_OPEN_MAX);
11717 #  else
11718 #   ifdef FOPEN_MAX
11719     open_max = FOPEN_MAX;
11720 #   else
11721 #    ifdef OPEN_MAX
11722     open_max = OPEN_MAX;
11723 #    else
11724 #     ifdef _NFILE
11725     open_max = _NFILE;
11726 #     endif
11727 #    endif
11728 #   endif
11729 #  endif
11730 # endif 
11731 # ifdef HAS_STDIO_STREAM_ARRAY
11732     if (open_max > 0) {
11733       long i;
11734       for (i = 0; i < open_max; i++)
11735             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
11736                 STDIO_STREAM_ARRAY[i]._file < open_max &&
11737                 STDIO_STREAM_ARRAY[i]._flag)
11738                 fflush(&STDIO_STREAM_ARRAY[i]);
11739     }   
11740   }
11741 # endif
11742 #endif
11743   _exit(42);
11744 }
11745 EOCP
11746 : first we have to find out how _not_ to flush
11747 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
11748     output=''
11749     set try -DTRY_FPUTC
11750     if eval $compile; then
11751             $rm -f try.out
11752             ./try$exe_ext 2>/dev/null
11753             if $test ! -s try.out -a "X$?" = X42; then
11754                 output=-DTRY_FPUTC
11755             fi
11756     fi
11757     case "$output" in
11758     '')
11759             set try -DTRY_FPRINTF
11760             $rm -f try.out
11761             if eval $compile; then
11762                     $rm -f try.out
11763                     ./try$exe_ext 2>/dev/null
11764                     if $test ! -s try.out -a "X$?" = X42; then
11765                         output=-DTRY_FPRINTF
11766                     fi
11767             fi
11768         ;;
11769     esac
11770 fi
11771 : check for fflush NULL behaviour
11772 case "$fflushNULL" in
11773 '')     set try -DTRY_FFLUSH_NULL $output
11774         if eval $compile; then
11775                 $rm -f try.out
11776                 ./try$exe_ext 2>/dev/null
11777                 code="$?"
11778                 if $test -s try.out -a "X$code" = X42; then
11779                         fflushNULL="`$cat try.out`"
11780                 else
11781                         if $test "X$code" != X42; then
11782                                 $cat >&4 <<EOM
11783 (If this test failed, don't worry, we'll try another method shortly.)
11784 EOM
11785                         fi
11786                 fi
11787         fi
11788         $rm -f core try.core core.try.*
11789         case "$fflushNULL" in
11790         x)      $cat >&4 <<EOM
11791 Your fflush(NULL) works okay.
11792 EOM
11793                 fflushNULL="$define"
11794                 ;;
11795         '')     $cat >&4 <<EOM
11796 Your fflush(NULL) isn't working (contrary to ANSI C).
11797 EOM
11798                 fflushNULL="$undef"
11799                 ;;
11800         *)      $cat >&4 <<EOM
11801 Cannot figure out whether your fflush(NULL) works or not.
11802 I'm assuming it doesn't (contrary to ANSI C).
11803 EOM
11804                 fflushNULL="$undef"
11805                 ;;
11806         esac
11807         ;;
11808 $define|true|[yY]*)
11809         fflushNULL="$define"
11810         ;;
11811 *)
11812         fflushNULL="$undef"
11813         ;;
11814 esac
11815 : check explicit looping only if NULL did not work
11816 case "$fflushNULL" in
11817 "$undef")
11818         : check for fflush all behaviour
11819         case "$fflushall" in
11820         '')     set try -DTRY_FFLUSH_ALL $output
11821                 if eval $compile; then
11822                         $cat >&4 <<EOM
11823 (Now testing the other method--but note that also this may fail.)
11824 EOM
11825                         $rm -f try.out
11826                         ./try$exe_ext 2>/dev/null
11827                         if $test -s try.out -a "X$?" = X42; then
11828                                 fflushall="`$cat try.out`"
11829                         fi
11830                 fi
11831                 $rm -f core try.core core.try.*
11832                 case "$fflushall" in
11833                 x)      $cat >&4 <<EOM
11834 Whew. Flushing explicitly all the stdio streams works.
11835 EOM
11836                         fflushall="$define"
11837                         ;;
11838                 '')     $cat >&4 <<EOM
11839 Sigh. Flushing explicitly all the stdio streams doesn't work.
11840 EOM
11841                         fflushall="$undef"
11842                         ;;
11843                 *)      $cat >&4 <<EOM
11844 Cannot figure out whether flushing stdio streams explicitly works or not.
11845 I'm assuming it doesn't.
11846 EOM
11847                         fflushall="$undef"
11848                         ;;
11849                 esac
11850                 ;;
11851         "$define"|true|[yY]*)
11852                 fflushall="$define"
11853                 ;;
11854         *)
11855                 fflushall="$undef"
11856                 ;;
11857         esac
11858         ;;
11859 *)      fflushall="$undef"      
11860         ;;
11861 esac
11862 case "$fflushNULL$fflushall" in
11863 undefundef)
11864         $cat <<EOM
11865 I cannot figure out how to flush pending stdio output.
11866 EOM
11867         ;;
11868 esac
11869 $rm -f try.* try$exe_ext
11870
11871 : Store the full pathname to the ar program for use in the C program
11872 : Respect a hint or command line value for full_ar.
11873 case "$full_ar" in
11874 '') full_ar=$ar ;;
11875 esac
11876
11877 : Store the full pathname to the sed program for use in the C program
11878 full_sed=$sed
11879
11880 : see what type gids are declared as in the kernel
11881 echo " "
11882 echo "Looking for the type for group ids returned by getgid()."
11883 set gid_t gidtype xxx stdio.h sys/types.h
11884 eval $typedef
11885 case "$gidtype" in
11886 xxx)
11887         xxx=`./findhdr sys/user.h`
11888         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
11889         case $1 in
11890         unsigned) dflt="$1 $2" ;;
11891         *) dflt="$1" ;;
11892         esac
11893         ;;
11894 *) dflt="$gidtype";;
11895 esac
11896 case "$gidtype" in
11897 gid_t) echo "gid_t found." ;;
11898 *)      rp="What is the type for group ids returned by getgid()?"
11899         . ./myread
11900         gidtype="$ans"
11901         ;;
11902 esac
11903
11904 echo " "
11905 case "$gidtype" in
11906 *_t) zzz="$gidtype"     ;;
11907 *)   zzz="gid"          ;;
11908 esac
11909 echo "Checking the size of $zzz..." >&4 
11910 cat > try.c <<EOCP
11911 #include <sys/types.h>
11912 #include <stdio.h>
11913 int main() {
11914     printf("%d\n", (int)sizeof($gidtype));
11915     exit(0);
11916 }
11917 EOCP
11918 set try
11919 if eval $compile_ok; then
11920         yyy=`./try`
11921         case "$yyy" in
11922         '')     gidsize=4
11923                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
11924                 ;;
11925         *)      gidsize=$yyy
11926                 echo "Your $zzz size is $gidsize bytes."
11927                 ;;
11928         esac
11929 else
11930         gidsize=4
11931         echo "(I can't compile the test program--guessing $gidsize.)" >&4
11932 fi
11933
11934
11935 echo " "
11936 case "$gidtype" in
11937 *_t) zzz="$gidtype"     ;;
11938 *)   zzz="gid"          ;;
11939 esac
11940 echo "Checking the sign of $zzz..." >&4 
11941 cat > try.c <<EOCP
11942 #include <sys/types.h>
11943 #include <stdio.h>
11944 int main() {
11945         $gidtype foo = -1;
11946         if (foo < 0)
11947                 printf("-1\n");
11948         else
11949                 printf("1\n");
11950 }
11951 EOCP
11952 set try
11953 if eval $compile; then
11954         yyy=`./try`
11955         case "$yyy" in
11956         '')     gidsign=1
11957                 echo "(I can't execute the test program--guessing unsigned.)" >&4
11958                 ;;
11959         *)      gidsign=$yyy
11960                 case "$gidsign" in
11961                  1) echo "Your $zzz is unsigned." ;;
11962                 -1) echo "Your $zzz is signed."   ;;
11963                 esac
11964                 ;;
11965         esac
11966 else
11967         gidsign=1
11968         echo "(I can't compile the test program--guessing unsigned.)" >&4
11969 fi
11970
11971
11972 : check for length of character
11973 echo " "
11974 case "$charsize" in
11975 '')
11976         echo "Checking to see how big your characters are (hey, you never know)..." >&4
11977         $cat >try.c <<'EOCP'
11978 #include <stdio.h>
11979 int main()
11980 {
11981     printf("%d\n", (int)sizeof(char));
11982     exit(0);
11983 }
11984 EOCP
11985         set try
11986         if eval $compile_ok; then
11987                 dflt=`./try`
11988         else
11989                 dflt='1'
11990                 echo "(I can't seem to compile the test program.  Guessing...)"
11991         fi
11992         ;;
11993 *)
11994         dflt="$charsize"
11995         ;;
11996 esac
11997 rp="What is the size of a character (in bytes)?"
11998 . ./myread
11999 charsize="$ans"
12000 $rm -f try.c try
12001
12002
12003 echo " "
12004 $echo "Choosing the C types to be used for Perl's internal types..." >&4
12005
12006 case "$use64bits:$d_quad:$quadtype" in
12007 define:define:?*)
12008         ivtype="$quadtype"
12009         uvtype="$uquadtype"
12010         ivsize=8
12011         uvsize=8
12012         ;;
12013 *)      ivtype="long"
12014         uvtype="unsigned long"
12015         ivsize=$longsize
12016         uvsize=$longsize
12017         ;;
12018 esac
12019
12020 case "$uselongdouble:$d_longdbl" in
12021 define:define)
12022         nvtype="long double"
12023         nvsize=$longdblsize
12024         ;;
12025 *)      nvtype=double
12026         nvsize=$doublesize
12027         ;;
12028 esac
12029
12030 echo "(IV will be "$ivtype", $ivsize bytes)"
12031 echo "(UV will be "$uvtype", $uvsize bytes)"
12032 echo "(NV will be "$nvtype", $nvsize bytes)"
12033
12034 $cat >try.c <<EOCP
12035 #$i_inttypes I_INTTYPES
12036 #ifdef I_INTTYPES
12037 #include <inttypes.h>
12038 #endif
12039 #include <stdio.h>
12040 int main() {
12041 #ifdef INT8
12042    int8_t i =  INT8_MAX;
12043   uint8_t u = UINT8_MAX;
12044   printf("int8_t\n");
12045 #endif
12046 #ifdef INT16
12047    int16_t i =  INT16_MAX;
12048   uint16_t i = UINT16_MAX;
12049   printf("int16_t\n");
12050 #endif
12051 #ifdef INT32
12052    int32_t i =  INT32_MAX;
12053   uint32_t u = UINT32_MAX;
12054   printf("int32_t\n");
12055 #endif
12056 }
12057 EOCP
12058
12059 case "$i8type" in
12060 '')     case "$charsize" in
12061         1)      i8type=char
12062                 u8type="unsigned char"
12063                 i8size=$charsize
12064                 u8size=$charsize
12065                 ;;
12066         esac
12067         ;;
12068 esac
12069 case "$i8type" in
12070 '')     set try -DINT8
12071         if eval $compile; then
12072                 case "`./try$exe_ext`" in
12073                 int8_t) i8type=int8_t
12074                         u8type=uint8_t
12075                         i8size=1
12076                         u8size=1
12077                         ;;
12078                 esac
12079         fi
12080         ;;
12081 esac
12082 case "$i8type" in
12083 '')     if $test $charsize -ge 1; then
12084                 i8type=char
12085                 u8type="unsigned char"
12086                 i8size=$charsize
12087                 u8size=$charsize
12088         fi
12089         ;;
12090 esac
12091
12092 case "$i16type" in
12093 '')     case "$shortsize" in
12094         2)      i16type=short
12095                 u16type="unsigned short"
12096                 i16size=$shortsize
12097                 u16size=$shortsize
12098                 ;;
12099         esac
12100         ;;
12101 esac
12102 case "$i16type" in
12103 '')     set try -DINT16
12104         if eval $compile; then
12105                 case "`./try$exe_ext`" in
12106                 int16_t)
12107                         i16type=int16_t
12108                         u16type=uint16_t
12109                         i16size=2
12110                         u16size=2
12111                         ;;
12112                 esac
12113         fi
12114         ;;
12115 esac
12116 case "$i16type" in
12117 '')     if $test $shortsize -ge 2; then
12118                 i16type=short
12119                 u16type="unsigned short"
12120                 i16size=$shortsize
12121                 u16size=$shortsize
12122         fi
12123         ;;
12124 esac
12125
12126 case "$i32type" in
12127 '')     case "$longsize" in
12128         4)      i32type=long
12129                 u32type="unsigned long"
12130                 i32size=$longsize
12131                 u32size=$longsize
12132                 ;;
12133         *)      case "$intsize" in
12134                 4)      i32type=int
12135                         u32type="unsigned int"
12136                         i32size=$intsize
12137                         u32size=$intsize
12138                         ;;
12139                 esac
12140                 ;;
12141         esac
12142         ;;
12143 esac
12144 case "$i32type" in
12145 '')     set try -DINT32
12146         if eval $compile; then
12147                 case "`./try$exe_ext`" in
12148                 int32_t)
12149                         i32type=int32_t
12150                         u32type=uint32_t
12151                         i32size=4
12152                         u32size=4
12153                         ;;
12154                 esac
12155         fi
12156         ;;
12157 esac
12158 case "$i32type" in
12159 '')     if $test $intsize -ge 4; then
12160                 i32type=int
12161                 u32type="unsigned int"
12162                 i32size=$intsize
12163                 u32size=$intsize
12164         fi
12165         ;;
12166 esac
12167
12168 case "$i64type" in
12169 '')     case "$d_quad:$quadtype" in
12170         define:?*)
12171                 i64type="$quadtype"
12172                 u64type="$uquadtype"
12173                 i64size=8
12174                 u64size=8
12175                 ;;
12176         esac
12177         ;;
12178 esac
12179
12180 $rm -f try.* try
12181
12182 echo " "
12183
12184 if $test X"$quadtype" != X; then
12185
12186 echo "Checking how to print 64-bit integers..." >&4
12187
12188 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
12189         $cat >try.c <<'EOCP'
12190 #include <sys/types.h>
12191 #include <stdio.h>
12192 int main() {
12193   int q = 12345678901;
12194   printf("%ld\n", q);
12195 }
12196 EOCP
12197         set try
12198         if eval $compile; then
12199                 yyy=`./try$exe_ext`
12200                 case "$yyy" in
12201                 12345678901)
12202                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
12203                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIX64='"X"';
12204                         echo "We will use %d."
12205                         ;;
12206                 esac
12207         fi
12208 fi
12209
12210 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
12211         $cat >try.c <<'EOCP'
12212 #include <sys/types.h>
12213 #include <stdio.h>
12214 int main() {
12215   long q = 12345678901;
12216   printf("%ld\n", q);
12217 }
12218 EOCP
12219         set try
12220         if eval $compile; then
12221                 yyy=`./try$exe_ext`
12222                 case "$yyy" in
12223                 12345678901)
12224                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
12225                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIX64='"lX"';
12226                         echo "We will use %ld."
12227                         ;;
12228                 esac
12229         fi
12230 fi
12231
12232 if $test X"$sPRId64" = X -a X"$i_inttypes.h" = X"$define" -a X"$quadtype" = Xint64_t; then
12233         $cat >try.c <<'EOCP'
12234 #include <sys/types.h>
12235 #include <inttypes.h>
12236 #include <stdio.h>
12237 int main() {
12238   int64_t q = 12345678901;
12239   printf("%" PRId64 "\n", q);
12240 }
12241 EOCP
12242         set try
12243         if eval $compile; then
12244                 yyy=`./try$exe_ext`
12245                 case "$yyy" in
12246                 12345678901)
12247                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
12248                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIX64=PRIX64;
12249                         echo "We will use the C9X style."
12250                         ;;
12251                 esac
12252         fi
12253 fi
12254
12255 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
12256         $cat >try.c <<'EOCP'
12257 #include <sys/types.h>
12258 #include <stdio.h>
12259 int main() {
12260   long long q = 12345678901LL; /* AIX cc requires the LL prefix. */
12261   printf("%lld\n", q);
12262 }
12263 EOCP
12264         set try
12265         if eval $compile; then
12266                 yyy=`./try$exe_ext`
12267                 case "$yyy" in
12268                 12345678901)
12269                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
12270                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIX64='"llX"';
12271                         echo "We will use the %lld style."
12272                         ;;
12273                 esac
12274         fi
12275 fi
12276
12277 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
12278         $cat >try.c <<EOCP
12279 #include <sys/types.h>
12280 #include <stdio.h>
12281 int main() {
12282   $quadtype q = 12345678901;
12283   printf("%Ld\n", q);
12284 }
12285 EOCP
12286         set try
12287         if eval $compile; then
12288                 yyy=`./try$exe_ext`
12289                 case "$yyy" in
12290                 12345678901)
12291                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
12292                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIX64='"LX"';
12293                         echo "We will use %Ld."
12294                         ;;
12295                 esac
12296         fi
12297 fi
12298
12299 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
12300         $cat >try.c <<EOCP
12301 #include <sys/types.h>
12302 #include <stdio.h>
12303 int main() {
12304   $quadtype q = 12345678901;
12305   printf("%qd\n", q);
12306 }
12307 EOCP
12308         set try
12309         if eval $compile; then
12310                 yyy=`./try$exe_ext`
12311                 case "$yyy" in
12312                 12345678901)
12313                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
12314                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIX64='"qX"';
12315                         echo "We will use %qd."
12316                         ;;
12317                 esac
12318         fi
12319 fi
12320
12321 if $test X"$sPRId64" = X; then
12322         echo "Cannot figure out how to print 64-bit integers." >&4
12323 fi
12324
12325 $rm -f try try.*
12326
12327 fi
12328
12329 case "$sPRId64" in
12330 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef"; 
12331         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIX64="$undef"; 
12332         ;;
12333 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define"; 
12334         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIX64="$define"; 
12335         ;;
12336 esac
12337
12338
12339 echo " "
12340 $echo "Checking the format strings to be used for Perl's internal types..." >&4
12341
12342 if $test X"$ivsize" = X8; then
12343         ivdformat="$sPRId64"
12344         uvuformat="$sPRIu64"
12345         uvoformat="$sPRIo64"
12346         uvxformat="$sPRIx64"
12347 else
12348         if $test X"$ivsize" = X"$longsize"; then
12349                 ivdformat='"ld"'
12350                 uvuformat='"lu"'
12351                 uvoformat='"lo"'
12352                 uvxformat='"lx"'
12353         else
12354                 if $test X"$ivsize" = X"$intsize"; then
12355                         ivdformat='"d"'
12356                         uvuformat='"u"'
12357                         uvoformat='"o"'
12358                         uvxformat='"x"'
12359                 else
12360                         : far out
12361                         if $test X"$ivsize" = X"$shortsize"; then
12362                                 ivdformat='"hd"'
12363                                 uvuformat='"hu"'
12364                                 uvoformat='"ho"'
12365                                 uvxformat='"hx"'
12366                         fi
12367                 fi
12368         fi
12369 fi
12370
12371 case "$ivdformat" in
12372 '') echo "$0: Fatal: failed to find format strings, cannot continue." >& 4
12373     exit 1
12374     ;;
12375 esac
12376
12377
12378 echo " "
12379 $echo "Checking the format string to be used for gids..." >&4
12380
12381 case "$gidsign" in
12382 -1)     if $test X"$gidsize" = X"$ivsize"; then
12383                 gidformat="$ivdformat"
12384         else
12385                 if $test X"$gidsize" = X"$longsize"; then
12386                         gidformat='"ld"'
12387                 else
12388                         if $test X"$gidsize" = X"$intsize"; then
12389                                 gidformat='"d"'
12390                         else
12391                                 if $test X"$gidsize" = X"$shortsize"; then
12392                                         gidformat='"hd"'
12393                                 fi
12394                         fi
12395                 fi
12396         fi
12397         ;;
12398 *)      if $test X"$gidsize" = X"$uvsize"; then
12399                 gidformat="$uvuformat"
12400         else
12401                 if $test X"$gidsize" = X"$longsize"; then
12402                         gidformat='"lu"'
12403                 else
12404                         if $test X"$gidsize" = X"$intsize"; then
12405                                 gidformat='"u"'
12406                         else
12407                                 if $test X"$gidsize" = X"$shortsize"; then
12408                                         gidformat='"hu"'
12409                                 fi
12410                         fi
12411                 fi
12412         fi
12413         ;;
12414 esac
12415
12416 : see if getgroups exists
12417 set getgroups d_getgrps
12418 eval $inlibc
12419
12420 : see if setgroups exists
12421 set setgroups d_setgrps
12422 eval $inlibc
12423
12424
12425 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
12426 echo " "
12427 case "$d_getgrps$d_setgrps" in
12428 *define*)
12429         case "$groupstype" in
12430         '') dflt="$gidtype" ;;
12431         *)  dflt="$groupstype" ;;
12432         esac
12433         $cat <<EOM
12434 What type of pointer is the second argument to getgroups() and setgroups()?
12435 Usually this is the same as group ids, $gidtype, but not always.
12436
12437 EOM
12438         rp='What type pointer is the second argument to getgroups() and setgroups()?'
12439         . ./myread
12440         groupstype="$ans"
12441         ;;
12442 *)  groupstype="$gidtype";;
12443 esac
12444
12445 echo " "
12446 echo "Checking if your $make program sets \$(MAKE)..." >&4
12447 case "$make_set_make" in
12448 '')
12449         $sed 's/^X //' > testmake.mak << 'EOF'
12450 Xall:
12451 X       @echo 'maketemp="$(MAKE)"'
12452 EOF
12453         case "`$make -f testmake.mak 2>/dev/null`" in
12454         *maketemp=*) make_set_make='#' ;;
12455         *)      make_set_make="MAKE=$make" ;;
12456         esac
12457         $rm -f testmake.mak
12458         ;;
12459 esac
12460 case "$make_set_make" in
12461 '#') echo "Yup, it does.";;
12462 *) echo "Nope, it doesn't.";;
12463 esac
12464
12465 : see what type is used for mode_t
12466 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
12467 set mode_t modetype int stdio.h sys/types.h
12468 eval $typedef_ask
12469
12470 : define a fucntion to check prototypes
12471 $cat > protochk <<EOSH
12472 $startsh
12473 cc="$cc"
12474 optimize="$optimize"
12475 ccflags="$ccflags"
12476 prototype="$prototype"
12477 define="$define"
12478 rm=$rm
12479 EOSH
12480
12481 $cat >> protochk <<'EOSH'
12482
12483 $rm -f try.c
12484 foo="$1"
12485 shift
12486 while test $# -ge 2; do
12487         case "$1" in
12488                 $define) echo "#include <$2>" >> try.c ;;
12489                 literal) echo "$2" >> try.c ;;
12490         esac
12491     shift 2
12492 done
12493 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
12494 cat >> try.c <<'EOCP'
12495 #ifdef CAN_PROTOTYPE
12496 #define _(args) args
12497 #else
12498 #define _(args) ()
12499 #endif
12500 EOCP
12501 echo "$foo" >> try.c
12502 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
12503 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
12504 status=$?
12505 $rm -f try.[co]
12506 exit $status
12507 EOSH
12508 chmod +x protochk
12509 $eunicefix protochk
12510
12511 : see what type is used for size_t
12512 rp="What is the type used for the length parameter for string functions?"
12513 set size_t sizetype 'unsigned int' stdio.h sys/types.h
12514 eval $typedef_ask
12515
12516 : check for type of arguments to gethostbyaddr. 
12517 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
12518         case "$d_gethbyaddr" in
12519         $define)
12520                 $cat <<EOM
12521
12522 Checking to see what type of arguments are accepted by gethostbyaddr().
12523 EOM
12524                 hdrs="$define sys/types.h
12525                         $d_socket sys/socket.h 
12526                         $i_niin netinet/in.h 
12527                         $i_netdb netdb.h
12528                         $i_unistd unistd.h"
12529                 : The first arg can 'char *' or 'void *'
12530                 : The second arg is some of integral type
12531                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
12532                         for yyy in size_t long int; do
12533                                 case "$netdb_host_type" in
12534                                 '')     try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
12535                                         if ./protochk "$try" $hdrs; then
12536                                                 echo "Your system accepts $xxx for the first arg."
12537                                                 echo "...and $yyy for the second arg."
12538                                                 netdb_host_type="$xxx"
12539                                                 netdb_hlen_type="$yyy"
12540                                         fi
12541                                         ;;
12542                                 esac
12543                         done
12544                 done
12545                 : In case none of those worked, prompt the user.
12546                 case "$netdb_host_type" in
12547                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
12548                         dflt='char *'
12549                         . ./myread
12550                         netdb_host_type=$ans
12551                         rp='What is the type for the 2nd argument to gethostbyaddr?'
12552                         dflt="$sizetype"
12553                         . ./myread
12554                         netdb_hlen_type=$ans
12555                         ;;
12556                 esac
12557                 ;;
12558         *)      : no gethostbyaddr, so pick harmless defaults
12559                 netdb_host_type='char *'
12560                 netdb_hlen_type="$sizetype"
12561                 ;;
12562         esac
12563         # Remove the "const" if needed. -- but then we'll have a 
12564         # prototype clash!
12565         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
12566 fi
12567
12568 : check for type of argument to gethostbyname. 
12569 if test "X$netdb_name_type" = X ; then
12570         case "$d_gethbyname" in
12571         $define)
12572                 $cat <<EOM
12573
12574 Checking to see what type of argument is accepted by gethostbyname().
12575 EOM
12576                 hdrs="$define sys/types.h
12577                         $d_socket sys/socket.h 
12578                         $i_niin netinet/in.h 
12579                         $i_netdb netdb.h
12580                         $i_unistd unistd.h"
12581                 for xxx in "const char *" "char *"; do
12582                         case "$netdb_name_type" in
12583                         '')     try="extern struct hostent *gethostbyname($xxx);"
12584                                 if ./protochk "$try" $hdrs; then
12585                                         echo "Your system accepts $xxx."
12586                                         netdb_name_type="$xxx"
12587                                 fi
12588                                 ;;
12589                         esac
12590                 done
12591                 : In case none of those worked, prompt the user.
12592                 case "$netdb_name_type" in
12593                 '')     rp='What is the type for the 1st argument to gethostbyname?'
12594                         dflt='char *'
12595                         . ./myread
12596                         netdb_name_type=$ans
12597                         ;;
12598                 esac
12599                 ;;
12600         *)      : no gethostbyname, so pick harmless default
12601                 netdb_name_type='char *'
12602                 ;;
12603         esac
12604 fi
12605
12606 : check for type of 1st argument to getnetbyaddr. 
12607 if test "X$netdb_net_type" = X ; then
12608         case "$d_getnbyaddr" in
12609         $define)
12610                 $cat <<EOM
12611
12612 Checking to see what type of 1st argument is accepted by getnetbyaddr().
12613 EOM
12614                 hdrs="$define sys/types.h
12615                         $d_socket sys/socket.h 
12616                         $i_niin netinet/in.h 
12617                         $i_netdb netdb.h
12618                         $i_unistd unistd.h"
12619                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
12620                         case "$netdb_net_type" in
12621                         '')     try="extern struct netent *getnetbyaddr($xxx, int);"
12622                                 if ./protochk "$try" $hdrs; then
12623                                         echo "Your system accepts $xxx."
12624                                         netdb_net_type="$xxx"
12625                                 fi
12626                                 ;;
12627                         esac
12628                 done
12629                 : In case none of those worked, prompt the user.
12630                 case "$netdb_net_type" in
12631                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
12632                         dflt='long'
12633                         . ./myread
12634                         netdb_net_type=$ans
12635                         ;;
12636                 esac
12637                 ;;
12638         *)      : no getnetbyaddr, so pick harmless default
12639                 netdb_net_type='long'
12640                 ;;
12641         esac
12642 fi
12643 : locate the preferred pager for this system
12644 case "$pager" in
12645 '')
12646         dflt=''
12647         case "$pg" in
12648         /*) dflt=$pg;;
12649         esac
12650         case "$more" in
12651         /*) dflt=$more;;
12652         esac
12653         case "$less" in
12654         /*) dflt=$less;;
12655         esac
12656         case "$dflt" in
12657         '') dflt=/usr/ucb/more;;
12658         esac
12659         ;;
12660 *) dflt="$pager";;
12661 esac
12662 echo " "
12663 fn=f/
12664 rp='What pager is used on your system?'
12665 . ./getfile
12666 pager="$ans"
12667
12668 : see what type pids are declared as in the kernel
12669 rp="What is the type of process ids on this system?"
12670 set pid_t pidtype int stdio.h sys/types.h
12671 eval $typedef_ask
12672
12673 : Find earliest binary compatible site_perl subdirectory perl can use.
12674 case "$bincompat5005" in
12675 "$define") xs_apiversion='5.005' ;;
12676 *) xs_apiversion=$apiversion ;;   # The current site_perl version.
12677 esac
12678 : Find earliest pure perl site_perl subdirectory perl can use.
12679 : The versioned directories started at 5.005.
12680 pm_apiversion='5.005'
12681
12682 : check for length of pointer
12683 echo " "
12684 case "$ptrsize" in
12685 '')
12686         $echo $n "Checking to see how big your pointers are...$c" >&4
12687         if test "$voidflags" -gt 7; then
12688                 echo '#define VOID_PTR char *' > try.c
12689         else
12690                 echo '#define VOID_PTR void *' > try.c
12691         fi
12692         $cat >>try.c <<'EOCP'
12693 #include <stdio.h>
12694 int main()
12695 {
12696     printf("%d\n", (int)sizeof(VOID_PTR));
12697     exit(0);
12698 }
12699 EOCP
12700         set try
12701         if eval $compile_ok; then
12702                 ptrsize=`./try`
12703                 $echo " $ptrsize bytes." >&4
12704         else
12705                 dflt='4'
12706                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
12707                 rp="What is the size of a pointer (in bytes)?"
12708                 . ./myread
12709                 ptrsize="$ans"
12710         fi
12711         ;;
12712 esac
12713 $rm -f try.c try
12714
12715 : see if ar generates random libraries by itself
12716 echo " "
12717 echo "Checking how to generate random libraries on your machine..." >&4
12718 echo 'int bar1() { return bar2(); }' > bar1.c
12719 echo 'int bar2() { return 2; }' > bar2.c
12720 $cat > foo.c <<'EOP'
12721 int main() { printf("%d\n", bar1()); exit(0); }
12722 EOP
12723 $cc $ccflags -c bar1.c >/dev/null 2>&1
12724 $cc $ccflags -c bar2.c >/dev/null 2>&1
12725 $cc $ccflags -c foo.c >/dev/null 2>&1
12726 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
12727 if $cc $ccflags $ldflags -o foobar foo$_o bar$_a $libs > /dev/null 2>&1 &&
12728         ./foobar >/dev/null 2>&1; then
12729         echo "$ar appears to generate random libraries itself."
12730         orderlib=false
12731         ranlib=":"
12732 elif $ar ts bar$_a >/dev/null 2>&1 &&
12733         $cc $ccflags $ldflags -o foobar foo$_o bar$_a $libs > /dev/null 2>&1 &&
12734         ./foobar >/dev/null 2>&1; then
12735                 echo "a table of contents needs to be added with '$ar ts'."
12736                 orderlib=false
12737                 ranlib="$ar ts"
12738 else
12739         case "$ranlib" in
12740         :) ranlib='';;
12741         '')
12742                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
12743                 $test -f $ranlib || ranlib=''
12744                 ;;
12745         esac
12746         if $test -n "$ranlib"; then
12747                 echo "your system has '$ranlib'; we'll use that."
12748                 orderlib=false
12749         else
12750                 echo "your system doesn't seem to support random libraries"
12751                 echo "so we'll use lorder and tsort to order the libraries."
12752                 orderlib=true
12753                 ranlib=":"
12754         fi
12755 fi
12756 $rm -f foo* bar* 
12757
12758 : check for type of arguments to select. 
12759 case "$selecttype" in
12760 '') case "$d_select" in
12761         $define)
12762                 $cat <<EOM
12763 Checking to see what type of arguments are accepted by select().
12764 EOM
12765                 hdrs="$define sys/types.h
12766                         $i_systime sys/time.h 
12767                         $i_sysselct sys/select.h
12768                         $d_socket sys/socket.h"
12769                 : The first arg can be int, unsigned, or size_t
12770                 : The last arg may or may not be 'const'
12771                 val=''
12772                 : void pointer has been seen but using that
12773                 : breaks the selectminbits test
12774                 for xxx in 'fd_set *' 'int *'; do
12775                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
12776                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
12777                                         case "$val" in
12778                                         '')     try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
12779                                                 if ./protochk "$try" $hdrs; then
12780                                                         echo "Your system accepts $xxx."
12781                                                         val="$xxx"
12782                                                 fi
12783                                                 ;;
12784                                         esac
12785                                 done
12786                         done
12787                 done
12788                 case "$val" in
12789                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
12790                         case "$d_fd_set" in
12791                                 $define) dflt="fd_set *" ;;
12792                                 *)              dflt="int *" ;;
12793                         esac
12794                         . ./myread
12795                         val=$ans
12796                         ;;
12797                 esac
12798                 selecttype="$val"
12799                 ;;
12800         *)      : no select, so pick a harmless default
12801                 selecttype='int *'
12802                 ;;
12803         esac
12804         ;;
12805 esac
12806
12807 : check for the select 'width'
12808 case "$selectminbits" in
12809 '') case "$d_select" in
12810         $define)
12811                 $cat <<EOM
12812
12813 Checking to see on how many bits at a time your select() operates...
12814 EOM
12815                 $cat >try.c <<EOCP
12816 #include <sys/types.h>
12817 #$i_time I_TIME
12818 #$i_systime I_SYS_TIME
12819 #$i_systimek I_SYS_TIME_KERNEL
12820 #ifdef I_TIME
12821 #   include <time.h>
12822 #endif
12823 #ifdef I_SYS_TIME
12824 #   ifdef I_SYS_TIME_KERNEL
12825 #       define KERNEL
12826 #   endif
12827 #   include <sys/time.h>
12828 #   ifdef I_SYS_TIME_KERNEL
12829 #       undef KERNEL
12830 #   endif
12831 #endif
12832 #$i_sysselct I_SYS_SELECT
12833 #ifdef I_SYS_SELECT
12834 #include <sys/select.h>
12835 #endif
12836 #$d_socket HAS_SOCKET
12837 #ifdef HAS_SOCKET
12838 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
12839 #endif
12840 #include <stdio.h>
12841 $selecttype b;
12842 #define S sizeof(*(b))
12843 #define MINBITS 64
12844 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
12845 #define NBITS  (NBYTES * 8)
12846 int main() {
12847     char s[NBYTES];
12848     struct timeval t;
12849     int i;
12850     FILE* fp;
12851     int fd;
12852
12853     fclose(stdin);
12854     fp = fopen("try.c", "r");
12855     if (fp == 0)
12856       exit(1);
12857     fd = fileno(fp);
12858     if (fd < 0)
12859       exit(2);
12860     b = ($selecttype)s;
12861     for (i = 0; i < NBITS; i++)
12862         FD_SET(i, b);
12863     t.tv_sec  = 0;
12864     t.tv_usec = 0;
12865     select(fd + 1, b, 0, 0, &t);
12866     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
12867     printf("%d\n", i + 1);
12868     return 0;
12869 }
12870 EOCP
12871                 set try
12872                 if eval $compile_ok; then
12873                         selectminbits=`./try`
12874                         case "$selectminbits" in
12875                         '')     cat >&4 <<EOM
12876 Cannot figure out on how many bits at a time your select() operates.
12877 I'll play safe and guess it is 32 bits.
12878 EOM
12879                                 selectminbits=32
12880                                 bits="32 bits"
12881                                 ;;
12882                         1)      bits="1 bit" ;;
12883                         *)      bits="$selectminbits bits" ;;
12884                         esac
12885                         echo "Your select() operates on $bits at a time." >&4
12886                 else
12887                         rp='What is the minimum number of bits your select() operates on?'
12888                         case "$byteorder" in
12889                         1234|12345678)  dflt=32 ;;
12890                         *)              dflt=1  ;;
12891                         esac
12892                         . ./myread
12893                         val=$ans
12894                         selectminbits="$val"
12895                 fi
12896                 $rm -f try.* try
12897                 ;;
12898         *)      : no select, so pick a harmless default
12899                 selectminbits='32'
12900                 ;;
12901         esac
12902         ;;
12903 esac
12904
12905 : Trace out the files included by signal.h, then look for SIGxxx names.
12906 : Remove SIGARRAYSIZE used by HPUX.
12907 : Remove SIGSTKSIZE used by Linux.
12908 : Remove SIGSTKSZ used by Posix.
12909 : Remove SIGTYP void lines used by OS2.
12910 : Some cpps, like os390, dont give the file name anywhere
12911 if [ "X$fieldn" = X ]; then
12912         : Just make some guesses.  We check them later.
12913         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
12914 else
12915         xxx=`echo '#include <signal.h>' |
12916         $cppstdin $cppminus $cppflags 2>/dev/null |
12917         $grep '^[       ]*#.*include' | 
12918         $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sort | $uniq`
12919 fi
12920 : Check this list of files to be sure we have parsed the cpp output ok.
12921 : This will also avoid potentially non-existent files, such 
12922 : as ../foo/bar.h
12923 xxxfiles=''
12924 for xx in $xxx /dev/null ; do
12925         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
12926 done
12927 : If we have found no files, at least try signal.h
12928 case "$xxxfiles" in
12929 '')     xxxfiles=`./findhdr signal.h` ;;
12930 esac
12931 xxx=`awk '
12932 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
12933         print substr($2, 4, 20)
12934 }
12935 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
12936         print substr($3, 4, 20)
12937 }' $xxxfiles`
12938 : Append some common names just in case the awk scan failed.
12939 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
12940 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
12941 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
12942 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
12943 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
12944
12945 : generate a few handy files for later
12946 $cat > signal.c <<'EOCP'
12947 #include <sys/types.h>
12948 #include <signal.h>
12949 #include <stdio.h>
12950 int main() {
12951
12952 /* Strange style to avoid deeply-nested #if/#else/#endif */
12953 #ifndef NSIG
12954 #  ifdef _NSIG
12955 #    define NSIG (_NSIG)
12956 #  endif
12957 #endif
12958
12959 #ifndef NSIG
12960 #  ifdef SIGMAX
12961 #    define NSIG (SIGMAX+1)
12962 #  endif
12963 #endif
12964
12965 #ifndef NSIG
12966 #  ifdef SIG_MAX
12967 #    define NSIG (SIG_MAX+1)
12968 #  endif
12969 #endif
12970
12971 #ifndef NSIG
12972 #  ifdef MAXSIG
12973 #    define NSIG (MAXSIG+1)
12974 #  endif
12975 #endif
12976
12977 #ifndef NSIG
12978 #  ifdef MAX_SIG
12979 #    define NSIG (MAX_SIG+1)
12980 #  endif
12981 #endif
12982
12983 #ifndef NSIG
12984 #  ifdef SIGARRAYSIZE
12985 #    define NSIG (SIGARRAYSIZE+1) /* Not sure of the +1 */
12986 #  endif
12987 #endif
12988
12989 #ifndef NSIG
12990 #  ifdef _sys_nsig
12991 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
12992 #  endif
12993 #endif
12994
12995 /* Default to some arbitrary number that's big enough to get most
12996    of the common signals.
12997 */
12998 #ifndef NSIG
12999 #    define NSIG 50
13000 #endif
13001
13002 printf("NSIG %d\n", NSIG);
13003
13004 #ifndef JUST_NSIG
13005
13006 EOCP
13007
13008 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
13009 {
13010         printf "#ifdef SIG"; printf $1; printf "\n"
13011         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
13012         printf $1; printf ");\n"
13013         printf "#endif\n"
13014 }
13015 END {
13016         printf "#endif /* JUST_NSIG */\n";
13017         printf "exit(0);\n}\n";
13018 }
13019 ' >>signal.c
13020 $cat >signal.awk <<'EOP'
13021 BEGIN { ndups = 0 }
13022 $1 ~ /^NSIG$/ { nsig = $2 }
13023 ($1 !~ /^NSIG$/) && (NF == 2) {
13024     if ($2 > maxsig) { maxsig = $2 }
13025     if (sig_name[$2]) {
13026         dup_name[ndups] = $1
13027         dup_num[ndups] = $2
13028         ndups++ 
13029     }
13030     else {
13031         sig_name[$2] = $1
13032         sig_num[$2] = $2
13033     }
13034 }
13035 END { 
13036     if (nsig == 0) {
13037         nsig = maxsig + 1
13038     }
13039     printf("NSIG %d\n", nsig);
13040     for (n = 1; n < nsig; n++) {
13041         if (sig_name[n]) {
13042             printf("%s %d\n", sig_name[n], sig_num[n])
13043         }
13044         else {
13045             printf("NUM%d %d\n", n, n) 
13046         }
13047     }
13048     for (n = 0; n < ndups; n++) {
13049         printf("%s %d\n", dup_name[n], dup_num[n])
13050     }
13051 }
13052 EOP
13053 $cat >signal_cmd <<EOS
13054 $startsh
13055 if $test -s signal.lst; then
13056     echo "Using your existing signal.lst file"
13057         exit 0
13058 fi
13059 xxx="$xxx"
13060 EOS
13061 $cat >>signal_cmd <<'EOS'
13062
13063 set signal
13064 if eval $compile_ok; then
13065         ./signal$_exe | $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
13066 else
13067         echo "(I can't seem be able to compile the whole test program)" >&4
13068         echo "(I'll try it in little pieces.)" >&4
13069         set signal -DJUST_NSIG
13070         if eval $compile_ok; then
13071                 ./signal$_exe > signal.nsg
13072                 $cat signal.nsg
13073         else
13074                 echo "I can't seem to figure out how many signals you have." >&4
13075                 echo "Guessing 50." >&4
13076                 echo 'NSIG 50' > signal.nsg
13077         fi
13078         : Now look at all the signal names, one at a time.
13079         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
13080                 $cat > signal.c <<EOCP
13081 #include <sys/types.h>
13082 #include <signal.h>
13083 #include <stdio.h>
13084 int main() {
13085 printf("$xx %d\n", SIG${xx});
13086 return 0;
13087 }
13088 EOCP
13089                 set signal
13090                 if eval $compile; then
13091                         echo "SIG${xx} found."
13092                         ./signal$_exe  >> signal.ls1
13093                 else
13094                         echo "SIG${xx} NOT found."
13095                 fi
13096         done
13097         if $test -s signal.ls1; then
13098                 $cat signal.nsg signal.ls1 |
13099                         $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
13100         fi
13101
13102 fi
13103 if $test -s signal.lst; then
13104         :
13105 else
13106         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
13107         echo 'kill -l' >signal
13108         set X `csh -f <signal`
13109         $rm -f signal
13110         shift
13111         case $# in
13112         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
13113         esac
13114         echo $@ | $tr ' ' $trnl | \
13115             $awk '{ printf "%s %d\n", $1, ++s; }
13116                   END { printf "NSIG %d\n", ++s }' >signal.lst
13117 fi
13118 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
13119 EOS
13120 chmod a+x signal_cmd
13121 $eunicefix signal_cmd
13122
13123 : generate list of signal names
13124 echo " "
13125 case "$sig_name_init" in
13126 '') doinit=yes ;;
13127 *)  case "$sig_num_init" in
13128     ''|*,*) doinit=yes ;;
13129     esac ;;
13130 esac
13131 case "$doinit" in
13132 yes)
13133         echo "Generating a list of signal names and numbers..." >&4
13134         . ./signal_cmd
13135         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
13136         sig_name=`$awk 'BEGIN { printf "ZERO " }
13137                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
13138         sig_num=`$awk  'BEGIN { printf "0 " }
13139                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
13140         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
13141                              !/^NSIG/   { printf "\"%s\", ", $1 }
13142                              END        { printf "0\n" }' signal.lst`
13143         sig_num_init=`$awk  'BEGIN      { printf "0, " }
13144                              !/^NSIG/   { printf "%d, ", $2}
13145                              END        { printf "0\n"}' signal.lst`
13146         ;;
13147 esac
13148 echo "The following $sig_count signals are available:"
13149 echo " "
13150 echo $sig_name | $awk \
13151 'BEGIN { linelen = 0 }
13152 {
13153         for (i = 1; i <= NF; i++) {
13154                 name = "SIG" $i " "
13155                 linelen = linelen + length(name)
13156                 if (linelen > 70) {
13157                         printf "\n"
13158                         linelen = length(name)
13159                 }
13160                 printf "%s", name
13161         }
13162         printf "\n"
13163 }'
13164 $rm -f signal signal.c signal.awk signal.lst signal_cmd 
13165
13166 : see what type is used for signed size_t
13167 set ssize_t ssizetype int stdio.h sys/types.h
13168 eval $typedef
13169 dflt="$ssizetype"
13170 $cat > ssize.c <<EOM
13171 #include <stdio.h>
13172 #include <sys/types.h>
13173 #define Size_t $sizetype
13174 #define SSize_t $dflt
13175 int main()
13176 {
13177         if (sizeof(Size_t) == sizeof(SSize_t))
13178                 printf("$dflt\n");
13179         else if (sizeof(Size_t) == sizeof(int))
13180                 printf("int\n");
13181         else 
13182                 printf("long\n");
13183         exit(0);
13184 }
13185 EOM
13186 echo " "
13187 set ssize
13188 if eval $compile_ok && ./ssize > /dev/null; then
13189         ssizetype=`./ssize`
13190         echo "I'll be using $ssizetype for functions returning a byte count." >&4
13191 else
13192         $cat >&4 <<EOM
13193 Help! I can't compile and run the ssize_t test program: please enlighten me!
13194 (This is probably a misconfiguration in your system or libraries, and
13195 you really ought to fix it.  Still, I'll try anyway.)
13196
13197 I need a type that is the same size as $sizetype, but is guaranteed to
13198 be signed.  Common values are ssize_t, int and long.
13199
13200 EOM
13201         rp="What signed type is the same size as $sizetype?"
13202         . ./myread
13203         ssizetype="$ans"
13204 fi
13205 $rm -f ssize ssize.*
13206
13207 : see what type of char stdio uses.
13208 echo " "
13209 if $contains 'unsigned.*char.*_ptr;' `./findhdr stdio.h` >/dev/null 2>&1 ; then
13210         echo "Your stdio uses unsigned chars." >&4
13211         stdchar="unsigned char"
13212 else
13213         echo "Your stdio uses signed chars." >&4
13214         stdchar="char"
13215 fi
13216
13217 : see if time exists
13218 echo " "
13219 if test "X$d_time" = X -o X"$timetype" = X; then
13220     if set time val -f d_time; eval $csym; $val; then
13221                 echo 'time() found.' >&4
13222                 val="$define"
13223                 rp="What is the type returned by time() on this system?"
13224                 set time_t timetype long stdio.h sys/types.h
13225                 eval $typedef_ask
13226     else
13227                 echo 'time() not found, hope that will do.' >&4
13228                 val="$undef"
13229                 timetype='int';
13230     fi
13231     set d_time
13232     eval $setvar
13233 fi
13234
13235 : see what type uids are declared as in the kernel
13236 echo " "
13237 echo "Looking for the type for user ids returned by getuid()."
13238 set uid_t uidtype xxx stdio.h sys/types.h
13239 eval $typedef
13240 case "$uidtype" in
13241 xxx)
13242         xxx=`./findhdr sys/user.h`
13243         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
13244         case $1 in
13245         unsigned) dflt="$1 $2" ;;
13246         *) dflt="$1" ;;
13247         esac
13248         ;;
13249 *) dflt="$uidtype";;
13250 esac
13251 case "$uidtype" in
13252 uid_t)  echo "uid_t found." ;;
13253 *)      rp="What is the type for user ids returned by getuid()?"
13254         . ./myread
13255         uidtype="$ans"
13256         ;;
13257 esac
13258
13259 echo " "
13260 case "$uidtype" in
13261 *_t) zzz="$uidtype"     ;;
13262 *)   zzz="uid"          ;;
13263 esac
13264 echo "Checking the size of $zzz..." >&4 
13265 cat > try.c <<EOCP
13266 #include <sys/types.h>
13267 #include <stdio.h>
13268 int main() {
13269     printf("%d\n", (int)sizeof($uidtype));
13270     exit(0);
13271 }
13272 EOCP
13273 set try
13274 if eval $compile_ok; then
13275         yyy=`./try`
13276         case "$yyy" in
13277         '')     uidsize=4
13278                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
13279                 ;;
13280         *)      uidsize=$yyy
13281                 echo "Your $zzz size is $uidsize bytes."
13282                 ;;
13283         esac
13284 else
13285         uidsize=4
13286         echo "(I can't compile the test program--guessing $uidsize.)" >&4
13287 fi
13288
13289 echo " "
13290 case "$uidtype" in
13291 *_t) zzz="$uidtype"     ;;
13292 *)   zzz="uid"          ;;
13293 esac
13294 echo "Checking the sign of $zzz..." >&4
13295 cat > try.c <<EOCP
13296 #include <sys/types.h>
13297 #include <stdio.h>
13298 int main() {
13299         $uidtype foo = -1;
13300         if (foo < 0)
13301                 printf("-1\n");
13302         else
13303                 printf("1\n");
13304 }
13305 EOCP
13306 set try
13307 if eval $compile; then
13308         yyy=`./try`
13309         case "$yyy" in
13310         '')     uidsign=1
13311                 echo "(I can't execute the test program--guessing unsigned.)" >&4
13312                 ;;
13313         *)      uidsign=$yyy
13314                 case "$uidsign" in
13315                  1) echo "Your $zzz is unsigned." ;;
13316                 -1) echo "Your $zzz is signed."   ;;
13317                 esac
13318                 ;;
13319         esac
13320 else
13321         uidsign=1
13322         echo "(I can't compile the test program--guessing unsigned.)" >&4
13323 fi
13324
13325
13326
13327 echo " "
13328 $echo "Checking the format string to be used for uids..." >&4
13329
13330 case "$uidsign" in
13331 -1)     if $test X"$uidsize" = X"$ivsize"; then
13332                 uidformat="$ivdformat"
13333         else
13334                 if $test X"$uidsize" = X"$longsize"; then
13335                         uidformat='"ld"'
13336                 else
13337                         if $test X"$uidsize" = X"$intsize"; then
13338                                 uidformat='"d"'
13339                         else
13340                                 if $test X"$uidsize" = X"$shortsize"; then
13341                                         uidformat='"hd"'
13342                                 fi
13343                         fi
13344                 fi
13345         fi
13346         ;;
13347 *)      if $test X"$uidsize" = X"$uvsize"; then
13348                 uidformat="$uvuformat"
13349         else
13350                 if $test X"$uidsize" = X"$longsize"; then
13351                         uidformat='"lu"'
13352                 else
13353                         if $test X"$uidsize" = X"$intsize"; then
13354                                 uidformat='"u"'
13355                         else
13356                                 if $test X"$uidsize" = X"$shortsize"; then
13357                                         uidformat='"hu"'
13358                                 fi
13359                         fi
13360                 fi
13361         fi
13362         ;;
13363 esac
13364
13365 : see if dbm.h is available
13366 : see if dbmclose exists
13367 set dbmclose d_dbmclose
13368 eval $inlibc
13369
13370 case "$d_dbmclose" in
13371 $define)
13372         set dbm.h i_dbm
13373         eval $inhdr
13374         case "$i_dbm" in
13375         $define)
13376                 val="$undef"
13377                 set i_rpcsvcdbm
13378                 eval $setvar
13379                 ;;
13380         *)      set rpcsvc/dbm.h i_rpcsvcdbm
13381                 eval $inhdr
13382                 ;;
13383         esac
13384         ;;
13385 *)      echo "We won't be including <dbm.h>"
13386         val="$undef"
13387         set i_dbm
13388         eval $setvar
13389         val="$undef"
13390         set i_rpcsvcdbm
13391         eval $setvar
13392         ;;
13393 esac
13394
13395 : see if this is a sys/file.h system
13396 val=''
13397 set sys/file.h val
13398 eval $inhdr
13399
13400 : do we need to include sys/file.h ?
13401 case "$val" in
13402 "$define")
13403         echo " "
13404         if $h_sysfile; then
13405                 val="$define"
13406                 echo "We'll be including <sys/file.h>." >&4
13407         else
13408                 val="$undef"
13409                 echo "We won't be including <sys/file.h>." >&4
13410         fi
13411         ;;
13412 *)
13413         h_sysfile=false
13414         ;;
13415 esac
13416 set i_sysfile
13417 eval $setvar
13418
13419 : see if fcntl.h is there
13420 val=''
13421 set fcntl.h val
13422 eval $inhdr
13423
13424 : see if we can include fcntl.h
13425 case "$val" in
13426 "$define")
13427         echo " "
13428         if $h_fcntl; then
13429                 val="$define"
13430                 echo "We'll be including <fcntl.h>." >&4
13431         else
13432                 val="$undef"
13433                 if $h_sysfile; then
13434         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
13435                 else
13436                         echo "We won't be including <fcntl.h>." >&4
13437                 fi
13438         fi
13439         ;;
13440 *)
13441         h_fcntl=false
13442         val="$undef"
13443         ;;
13444 esac
13445 set i_fcntl
13446 eval $setvar
13447
13448 : see if locale.h is available
13449 set locale.h i_locale
13450 eval $inhdr
13451
13452 : see if mach cthreads are available
13453 if test "X$usethreads" = "X$define"; then
13454         set mach/cthreads.h i_machcthr
13455         eval $inhdr
13456 else
13457         i_machcthr="$undef"
13458 fi
13459
13460
13461
13462 : see if this is a math.h system
13463 set math.h i_math
13464 eval $inhdr
13465
13466 : see if this is a mntent.h system
13467 set mntent.h i_mntent
13468 eval $inhdr
13469
13470 : see if ndbm.h is available
13471 set ndbm.h t_ndbm
13472 eval $inhdr
13473 case "$t_ndbm" in
13474 $define)
13475         : see if dbm_open exists
13476         set dbm_open d_dbm_open
13477         eval $inlibc
13478         case "$d_dbm_open" in
13479         $undef)
13480                 t_ndbm="$undef"
13481                 echo "We won't be including <ndbm.h>"
13482                 ;;
13483         esac
13484         ;;
13485 esac
13486 val="$t_ndbm"
13487 set i_ndbm
13488 eval $setvar
13489
13490 : see if net/errno.h is available
13491 val=''
13492 set net/errno.h val
13493 eval $inhdr
13494
13495 : Unfortunately, it causes problems on some systems.  Arrgh.
13496 case "$val" in
13497 $define)
13498         cat > try.c <<'EOM'
13499 #include <stdio.h>
13500 #include <errno.h>
13501 #include <net/errno.h>
13502 int func()
13503 {
13504         return ENOTSOCK;
13505 }
13506 EOM
13507         if $cc $ccflags -c try.c >/dev/null 2>&1; then
13508                 echo "We'll be including <net/errno.h>." >&4
13509         else
13510                 echo "We won't be including <net/errno.h>." >&4
13511                 val="$undef"
13512         fi
13513         $rm -f try.* try
13514         ;;
13515 esac
13516 set i_neterrno
13517 eval $setvar
13518
13519 : see if netinet/tcp.h is available
13520 set netinet/tcp.h i_netinettcp
13521 eval $inhdr
13522
13523 : see if this is a poll.h system
13524 set poll.h i_poll
13525 eval $inhdr
13526
13527 : get C preprocessor symbols handy
13528 echo " "
13529 $echo $n "Hmm... $c"
13530 echo $al | $tr ' ' $trnl >Cppsym.know
13531 $cat <<EOSS >Cppsym
13532 $startsh
13533 case "\$1" in
13534 -l) list=true
13535         shift
13536         ;;
13537 esac
13538 unknown=''
13539 case "\$list\$#" in
13540 1|2)
13541         for sym do
13542                 if $contains "^\$1$" Cppsym.true >/dev/null 2>&1; then
13543                         exit 0
13544                 elif $contains "^\$1$" Cppsym.know >/dev/null 2>&1; then
13545                         :
13546                 else
13547                         unknown="\$unknown \$sym"
13548                 fi
13549         done
13550         set X \$unknown
13551         shift
13552         ;;
13553 esac
13554 case \$# in
13555 0) exit 1;;
13556 esac
13557 echo \$* | $tr ' ' '$trnl' | $sed -e 's/\(.*\)/\\
13558 #ifdef \1\\
13559 exit 0; _ _ _ _\1\\      \1\\
13560 #endif\\
13561 /' >Cppsym\$\$
13562 echo "exit 1; _ _ _" >>Cppsym\$\$
13563 $cppstdin $cppminus <Cppsym\$\$ | $grep '^exit [01]; _ _'  >Cppsym2\$\$
13564 case "\$list" in
13565 true) $awk 'NF > 5 {print substr(\$6,2,100)}' <Cppsym2\$\$ ;;
13566 *)
13567         sh Cppsym2\$\$
13568         status=\$?
13569         ;;
13570 esac
13571 $rm -f Cppsym\$\$ Cppsym2\$\$
13572 exit \$status
13573 EOSS
13574 chmod +x Cppsym
13575 $eunicefix Cppsym
13576 ./Cppsym -l $al | $sort | $grep -v '^$' >Cppsym.true
13577
13578 : now check the C compiler for additional symbols
13579 postprocess_cc_v=''
13580 case "$osname" in
13581 aix) postprocess_cc_v="|$tr , ' '" ;;
13582 esac
13583 $cat >ccsym <<EOS
13584 $startsh
13585 $cat >tmp.c <<EOF
13586 extern int foo;
13587 EOF
13588 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
13589 do
13590         case "\$i" in
13591         -D*) echo "\$i" | $sed 's/^-D//';;
13592         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A\(.*\)(\(.*\))/\1=\2/';;
13593         esac
13594 done
13595 $rm -f try.c
13596 EOS
13597 postprocess_cc_v=''
13598 chmod +x ccsym
13599 $eunicefix ccsym
13600 ./ccsym > ccsym1.raw
13601 if $test -s ccsym1.raw; then
13602        $sort ccsym1.raw | $uniq >ccsym.raw
13603 else
13604        mv ccsym1.raw ccsym.raw
13605 fi
13606
13607 $awk '/\=/ { print $0; next }
13608         { print $0"=1" }' ccsym.raw >ccsym.list
13609 $awk '{ print $0"=1" }' Cppsym.true >ccsym.true
13610 $comm -13 ccsym.true ccsym.list >ccsym.own
13611 $comm -12 ccsym.true ccsym.list >ccsym.com
13612 $comm -23 ccsym.true ccsym.list >ccsym.cpp
13613 also=''
13614 if $test -z ccsym.raw; then
13615         echo "Your C compiler doesn't seem to define any symbols!" >&4
13616         echo " "
13617         echo "However, your C preprocessor defines the following symbols:"
13618         $cat Cppsym.true
13619         ccsymbols=''
13620         cppsymbols=`$cat Cppsym.true`
13621         cppsymbols=`echo $cppsymbols`
13622         cppccsymbols="$cppsymbols"
13623 else
13624         if $test -s ccsym.com; then
13625                 echo "Your C compiler and pre-processor define these symbols:"
13626                 $sed -e 's/\(.*\)=.*/\1/' ccsym.com
13627                 also='also '
13628                 symbols='ones'
13629                 cppccsymbols=`$cat ccsym.com`
13630                 cppccsymbols=`echo $cppccsymbols`
13631                 $test "$silent" || sleep 1
13632         fi
13633         if $test -s ccsym.cpp; then
13634                 $test "$also" && echo " "
13635                 echo "Your C pre-processor ${also}defines the following symbols:"
13636                 $sed -e 's/\(.*\)=.*/\1/' ccsym.cpp
13637                 also='further '
13638                 cppsymbols=`$cat ccsym.cpp`
13639                 cppsymbols=`echo $cppsymbols`
13640                 $test "$silent" || sleep 1
13641         fi
13642         if $test -s ccsym.own; then
13643                 $test "$also" && echo " "
13644                 echo "Your C compiler ${also}defines the following cpp symbols:"
13645                 $sed -e 's/\(.*\)=1/\1/' ccsym.own
13646                 $sed -e 's/\(.*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
13647                 ccsymbols=`$cat ccsym.own`
13648                 ccsymbols=`echo $ccsymbols`
13649                 $test "$silent" || sleep 1
13650         fi
13651 fi
13652 $rm -f ccsym*
13653
13654 : see if this is a termio system
13655 val="$undef"
13656 val2="$undef"
13657 val3="$undef"
13658 if $test `./findhdr termios.h`; then
13659         set tcsetattr i_termios
13660         eval $inlibc
13661         val3="$i_termios"
13662 fi
13663 echo " "
13664 case "$val3" in
13665 "$define") echo "You have POSIX termios.h... good!" >&4;;
13666 *) if ./Cppsym pyr; then
13667                 case "`/bin/universe`" in
13668                 ucb) if $test `./findhdr sgtty.h`; then
13669                                 val2="$define"
13670                                 echo "<sgtty.h> found." >&4
13671                         else
13672                                 echo "System is pyramid with BSD universe."
13673                                 echo "<sgtty.h> not found--you could have problems." >&4
13674                         fi;;
13675                 *) if $test `./findhdr termio.h`; then
13676                                 val="$define"
13677                                 echo "<termio.h> found." >&4
13678                         else
13679                                 echo "System is pyramid with USG universe."
13680                                 echo "<termio.h> not found--you could have problems." >&4
13681                         fi;;
13682                 esac
13683         elif ./usg; then
13684                 if $test `./findhdr termio.h`; then
13685                         echo "<termio.h> found." >&4
13686                         val="$define"
13687                 elif $test `./findhdr sgtty.h`; then
13688                         echo "<sgtty.h> found." >&4
13689                         val2="$define"
13690                 else
13691 echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
13692                 fi
13693         else
13694                 if $test `./findhdr sgtty.h`; then
13695                         echo "<sgtty.h> found." >&4
13696                         val2="$define"
13697                 elif $test `./findhdr termio.h`; then
13698                         echo "<termio.h> found." >&4
13699                         val="$define"
13700                 else
13701 echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
13702                 fi
13703         fi;;
13704 esac
13705 set i_termio; eval $setvar
13706 val=$val2; set i_sgtty; eval $setvar
13707 val=$val3; set i_termios; eval $setvar
13708
13709 : see if this is a shadow.h system
13710 set shadow.h i_shadow
13711 eval $inhdr
13712
13713 : see if this is a socks.h system
13714 set socks.h i_socks
13715 eval $inhdr
13716
13717 : see if stdarg is available
13718 echo " "
13719 if $test `./findhdr stdarg.h`; then
13720         echo "<stdarg.h> found." >&4
13721         valstd="$define"
13722 else
13723         echo "<stdarg.h> NOT found." >&4
13724         valstd="$undef"
13725 fi
13726
13727 : see if varags is available
13728 echo " "
13729 if $test `./findhdr varargs.h`; then
13730         echo "<varargs.h> found." >&4
13731 else
13732         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
13733 fi
13734
13735 : set up the varargs testing programs
13736 $cat > varargs.c <<EOP
13737 #ifdef I_STDARG
13738 #include <stdarg.h>
13739 #endif
13740 #ifdef I_VARARGS
13741 #include <varargs.h>
13742 #endif
13743
13744 #ifdef I_STDARG
13745 int f(char *p, ...)
13746 #else
13747 int f(va_alist)
13748 va_dcl
13749 #endif
13750 {
13751         va_list ap;
13752 #ifndef I_STDARG
13753         char *p;
13754 #endif
13755 #ifdef I_STDARG
13756         va_start(ap,p);
13757 #else
13758         va_start(ap);
13759         p = va_arg(ap, char *);
13760 #endif
13761         va_end(ap);
13762 }
13763 EOP
13764 $cat > varargs <<EOP
13765 $startsh
13766 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
13767         echo "true"
13768 else
13769         echo "false"
13770 fi
13771 $rm -f varargs$_o
13772 EOP
13773 chmod +x varargs
13774
13775 : now check which varargs header should be included
13776 echo " "
13777 i_varhdr=''
13778 case "$valstd" in
13779 "$define")
13780         if `./varargs I_STDARG`; then
13781                 val='stdarg.h'
13782         elif `./varargs I_VARARGS`; then
13783                 val='varargs.h'
13784         fi
13785         ;;
13786 *)
13787         if `./varargs I_VARARGS`; then
13788                 val='varargs.h'
13789         fi
13790         ;;
13791 esac
13792 case "$val" in
13793 '')
13794 echo "I could not find the definition for va_dcl... You have problems..." >&4
13795         val="$undef"; set i_stdarg; eval $setvar
13796         val="$undef"; set i_varargs; eval $setvar
13797         ;;
13798 *) 
13799         set i_varhdr
13800         eval $setvar
13801         case "$i_varhdr" in
13802         stdarg.h)
13803                 val="$define"; set i_stdarg; eval $setvar
13804                 val="$undef"; set i_varargs; eval $setvar
13805                 ;;
13806         varargs.h)
13807                 val="$undef"; set i_stdarg; eval $setvar
13808                 val="$define"; set i_varargs; eval $setvar
13809                 ;;
13810         esac
13811         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
13812 esac
13813 $rm -f varargs*
13814
13815 : see if stddef is available
13816 set stddef.h i_stddef
13817 eval $inhdr
13818
13819 : see if sys/access.h is available
13820 set sys/access.h i_sysaccess
13821 eval $inhdr
13822
13823 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
13824 set sys/filio.h i_sysfilio
13825 eval $inhdr
13826 echo " "
13827 if $test `./findhdr sys/ioctl.h`; then
13828         val="$define"
13829         echo '<sys/ioctl.h> found.' >&4
13830 else
13831         val="$undef"
13832         if $test $i_sysfilio = "$define"; then
13833             echo '<sys/ioctl.h> NOT found.' >&4
13834         else
13835                 $test $i_sgtty = "$define" && xxx="sgtty.h"
13836                 $test $i_termio = "$define" && xxx="termio.h"
13837                 $test $i_termios = "$define" && xxx="termios.h"
13838 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
13839         fi
13840 fi
13841 set i_sysioctl
13842 eval $setvar
13843
13844 : see if sys/resource.h has to be included
13845 set sys/resource.h i_sysresrc
13846 eval $inhdr
13847
13848 : see if sys/security.h is available
13849 set sys/security.h i_syssecrt
13850 eval $inhdr
13851
13852 : see if this is a sys/statvfs.h system
13853 set sys/statvfs.h i_sysstatvfs
13854 eval $inhdr
13855
13856 : see if this is a sys/uio.h system
13857 set sys/uio.h i_sysuio
13858 eval $inhdr
13859
13860 : see if this is a sys/un.h system
13861 set sys/un.h i_sysun
13862 eval $inhdr
13863
13864 : see if this is a syswait system
13865 set sys/wait.h i_syswait
13866 eval $inhdr
13867
13868 : see if this is a ustat.h system
13869 set ustat.h i_ustat
13870 eval $inhdr
13871
13872 : see if this is an utime system
13873 set utime.h i_utime
13874 eval $inhdr
13875
13876 : see if this is a values.h system
13877 set values.h i_values
13878 eval $inhdr
13879
13880 : see if this is a vfork system
13881 case "$d_vfork" in
13882 "$define")
13883         set vfork.h i_vfork
13884         eval $inhdr
13885         ;;
13886 *)
13887         i_vfork="$undef"
13888         ;;
13889 esac
13890
13891 : see if gdbm.h is available
13892 set gdbm.h t_gdbm
13893 eval $inhdr
13894 case "$t_gdbm" in
13895 $define)
13896         : see if gdbm_open exists
13897         set gdbm_open d_gdbm_open
13898         eval $inlibc
13899         case "$d_gdbm_open" in
13900         $undef)
13901                 t_gdbm="$undef"
13902                 echo "We won't be including <gdbm.h>"
13903                 ;;
13904         esac
13905         ;;
13906 esac
13907 val="$t_gdbm"
13908 set i_gdbm
13909 eval $setvar
13910
13911 echo " "
13912 echo "Looking for extensions..." >&4
13913 : If we are using the old config.sh, known_extensions may contain
13914 : old or inaccurate or duplicate values.
13915 known_extensions=''
13916 nonxs_extensions=''
13917 : We do not use find because it might not be available.
13918 : We do not just use MANIFEST because the user may have dropped
13919 : some additional extensions into the source tree and expect them
13920 : to be built.
13921
13922 : Function to recursively find available extensions, ignoring DynaLoader
13923 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
13924 find_extensions='
13925     for xxx in *; do
13926        case "$xxx" in
13927            DynaLoader|dynaload) ;;
13928            *)
13929            if $test -f $xxx/$xxx.xs; then
13930                known_extensions="$known_extensions $1$xxx";
13931            elif $test -f $xxx/Makefile.PL; then
13932                nonxs_extensions="$nonxs_extensions $1$xxx";
13933            else
13934                if $test -d $xxx -a $# -lt 10; then
13935                    set $1$xxx/ $*;
13936                    cd $xxx;
13937                    eval $find_extensions;
13938                    cd ..;
13939                    shift;
13940                fi;
13941            fi
13942            ;;
13943        esac;
13944     done'
13945 tdir=`pwd`
13946 cd $rsrc/ext
13947 set X
13948 shift
13949 eval $find_extensions
13950 set X $nonxs_extensions
13951 shift
13952 nonxs_extensions="$*"
13953 set X $known_extensions
13954 shift
13955 known_extensions="$*"
13956 cd $tdir
13957
13958 : Now see which are supported on this system.
13959 avail_ext=''
13960 for xxx in $known_extensions ; do
13961         case "$xxx" in
13962         DB_File|db_file)
13963                 case "$i_db" in
13964                 $define) avail_ext="$avail_ext $xxx" ;;
13965                 esac
13966                 ;;
13967         GDBM_File|gdbm_fil)
13968                 case "$i_gdbm" in 
13969                 $define) avail_ext="$avail_ext $xxx" ;;
13970                 esac
13971                 ;;
13972         NDBM_File|ndbm_fil)
13973                 case "$i_ndbm" in
13974                 $define) avail_ext="$avail_ext $xxx" ;;
13975                 esac
13976                 ;;
13977         ODBM_File|odbm_fil) 
13978                 case "${i_dbm}${i_rpcsvcdbm}" in
13979                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
13980                 esac
13981                 ;;
13982         POSIX|posix)
13983                 case "$useposix" in
13984                 true|define|y) avail_ext="$avail_ext $xxx" ;;
13985                 esac
13986                 ;;
13987         Opcode|opcode)
13988                 case "$useopcode" in
13989                 true|define|y) avail_ext="$avail_ext $xxx" ;;
13990                 esac
13991                 ;;
13992         Socket|socket)
13993                 case "$d_socket" in 
13994                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
13995                 esac
13996                 ;;
13997         Thread|thread)
13998                 case "$usethreads" in 
13999                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
14000                 esac
14001                 ;;
14002         IPC/SysV|ipc/sysv)
14003                 : XXX Do we need a useipcsysv variable here
14004                 case "${d_msg}${d_sem}${d_shm}" in 
14005                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
14006                 esac
14007                 ;;
14008         *)      avail_ext="$avail_ext $xxx"
14009                 ;;
14010         esac
14011 done
14012
14013 set X $avail_ext
14014 shift
14015 avail_ext="$*"
14016
14017 : Now see which nonxs extensions are supported on this system.
14018 : For now assume all are.
14019 nonxs_ext=''
14020 for xxx in $nonxs_extensions ; do
14021         case "$xxx" in
14022         *)      nonxs_ext="$nonxs_ext $xxx"
14023                 ;;
14024         esac
14025 done
14026
14027 set X $nonxs_ext
14028 shift
14029 nonxs_ext="$*"
14030
14031 case $usedl in
14032 $define)
14033         $cat <<EOM
14034 A number of extensions are supplied with $package.  You may choose to
14035 compile these extensions for dynamic loading (the default), compile
14036 them into the $package executable (static loading), or not include
14037 them at all.  Answer "none" to include no extensions.
14038 Note that DynaLoader is always built and need not be mentioned here.
14039
14040 EOM
14041         case "$dynamic_ext" in
14042         '') dflt="$avail_ext" ;;
14043         *)      dflt="$dynamic_ext"
14044                 # Perhaps we are reusing an old out-of-date config.sh.
14045                 case "$hint" in
14046                 previous)
14047                         if test X"$dynamic_ext" != X"$avail_ext"; then
14048                                 $cat <<EOM
14049 NOTICE:  Your previous config.sh list may be incorrect. 
14050 The extensions now available to you are 
14051         ${avail_ext}
14052 but the default list from your previous config.sh is
14053         ${dynamic_ext} 
14054
14055 EOM
14056                         fi
14057                         ;;
14058                 esac
14059                 ;;
14060         esac
14061         case "$dflt" in
14062         '')     dflt=none;;
14063         esac
14064         rp="What extensions do you wish to load dynamically?"
14065         . ./myread
14066         case "$ans" in
14067         none) dynamic_ext=' ' ;;
14068         *) dynamic_ext="$ans" ;;
14069         esac
14070
14071         case "$static_ext" in
14072         '')
14073                 : Exclude those already listed in dynamic linking
14074                 dflt=''
14075                 for xxx in $avail_ext; do
14076                         case " $dynamic_ext " in
14077                         *" $xxx "*) ;;
14078                         *) dflt="$dflt $xxx" ;;
14079                         esac
14080                 done
14081                 set X $dflt
14082                 shift
14083                 dflt="$*"
14084                 ;;
14085         *)  dflt="$static_ext" 
14086                 ;;
14087         esac
14088
14089         case "$dflt" in
14090         '')     dflt=none;;
14091         esac
14092         rp="What extensions do you wish to load statically?"
14093         . ./myread
14094         case "$ans" in
14095         none) static_ext=' ' ;;
14096         *) static_ext="$ans" ;;
14097         esac
14098         ;;
14099 *)
14100         $cat <<EOM
14101 A number of extensions are supplied with $package.  Answer "none" 
14102 to include no extensions. 
14103 Note that DynaLoader is always built and need not be mentioned here.
14104
14105 EOM
14106         case "$static_ext" in
14107         '') dflt="$avail_ext" ;;
14108         *)      dflt="$static_ext"
14109                 # Perhaps we are reusing an old out-of-date config.sh.
14110                 case "$hint" in
14111                 previous)
14112                         if test X"$static_ext" != X"$avail_ext"; then
14113                                 $cat <<EOM
14114 NOTICE:  Your previous config.sh list may be incorrect. 
14115 The extensions now available to you are 
14116         ${avail_ext}
14117 but the default list from your previous config.sh is
14118         ${static_ext} 
14119
14120 EOM
14121                         fi
14122                         ;;
14123                 esac
14124                 ;;
14125         esac
14126         : Exclude those that are not xs extensions
14127         case "$dflt" in
14128         '')     dflt=none;;
14129         esac
14130         rp="What extensions do you wish to include?"
14131         . ./myread
14132         case "$ans" in
14133         none) static_ext=' ' ;;
14134         *) static_ext="$ans" ;;
14135         esac
14136         ;;
14137 esac
14138
14139 set X $dynamic_ext $static_ext $nonxs_ext
14140 shift
14141 extensions="$*"
14142
14143 : Remove build directory name from cppstdin so it can be used from
14144 : either the present location or the final installed location.
14145 echo " "
14146 : Get out of the UU directory to get correct path name.
14147 cd ..
14148 case "$cppstdin" in
14149 `pwd`/cppstdin)
14150         echo "Stripping down cppstdin path name"
14151         cppstdin=cppstdin
14152         ;;
14153 esac
14154 cd UU
14155
14156 : end of configuration questions
14157 echo " "
14158 echo "End of configuration questions."
14159 echo " "
14160
14161 : back to where it started
14162 if test -d ../UU; then
14163         cd ..
14164 fi
14165
14166 : configuration may be patched via a 'config.over' file
14167 if $test -f config.over; then
14168         echo " "
14169         dflt=y
14170         rp='I see a config.over file.  Do you wish to load it?'
14171         . UU/myread
14172         case "$ans" in
14173         n*) echo "OK, I'll ignore it.";;
14174         *)      . ./config.over
14175                 echo "Configuration override changes have been loaded."
14176                 ;;
14177         esac
14178 fi
14179
14180 : in case they want portability, strip down executable paths
14181 case "$d_portable" in
14182 "$define")
14183         echo " "
14184         echo "Stripping down executable paths..." >&4
14185         for file in $loclist $trylist; do
14186                 eval temp=\$$file
14187                 eval $file=`basename $temp`
14188         done
14189         ;;
14190 esac
14191
14192 : create config.sh file
14193 echo " "
14194 echo "Creating config.sh..." >&4
14195 $spitshell <<EOT >config.sh
14196 $startsh
14197 #
14198 # This file was produced by running the Configure script. It holds all the
14199 # definitions figured out by Configure. Should you modify one of these values,
14200 # do not forget to propagate your changes by running "Configure -der". You may
14201 # instead choose to run each of the .SH files by yourself, or "Configure -S".
14202 #
14203
14204 # Package name      : $package
14205 # Source directory  : $src
14206 # Configuration time: $cf_time
14207 # Configured by     : $cf_by
14208 # Target system     : $myuname
14209
14210 Author='$Author'
14211 Date='$Date'
14212 Header='$Header'
14213 Id='$Id'
14214 Locker='$Locker'
14215 Log='$Log'
14216 Mcc='$Mcc'
14217 RCSfile='$RCSfile'
14218 Revision='$Revision'
14219 Source='$Source'
14220 State='$State'
14221 _a='$_a'
14222 _exe='$_exe'
14223 _o='$_o'
14224 afs='$afs'
14225 alignbytes='$alignbytes'
14226 ansi2knr='$ansi2knr'
14227 aphostname='$aphostname'
14228 apiversion='$apiversion'
14229 ar='$ar'
14230 archlib='$archlib'
14231 archlibexp='$archlibexp'
14232 archname64='$archname64'
14233 archname='$archname'
14234 archobjs='$archobjs'
14235 awk='$awk'
14236 baserev='$baserev'
14237 bash='$bash'
14238 bin='$bin'
14239 bincompat5005='$bincompat5005'
14240 binexp='$binexp'
14241 bison='$bison'
14242 byacc='$byacc'
14243 byteorder='$byteorder'
14244 c='$c'
14245 castflags='$castflags'
14246 cat='$cat'
14247 cc='$cc'
14248 cccdlflags='$cccdlflags'
14249 ccdlflags='$ccdlflags'
14250 ccflags='$ccflags'
14251 ccsymbols='$ccsymbols'
14252 cf_by='$cf_by'
14253 cf_email='$cf_email'
14254 cf_time='$cf_time'
14255 charsize='$charsize'
14256 chgrp='$chgrp'
14257 chmod='$chmod'
14258 chown='$chown'
14259 clocktype='$clocktype'
14260 comm='$comm'
14261 compress='$compress'
14262 contains='$contains'
14263 cp='$cp'
14264 cpio='$cpio'
14265 cpp='$cpp'
14266 cpp_stuff='$cpp_stuff'
14267 cppccsymbols='$cppccsymbols'
14268 cppflags='$cppflags'
14269 cpplast='$cpplast'
14270 cppminus='$cppminus'
14271 cpprun='$cpprun'
14272 cppstdin='$cppstdin'
14273 cppsymbols='$cppsymbols'
14274 crosscompile='$crosscompile'
14275 cryptlib='$cryptlib'
14276 csh='$csh'
14277 d_Gconvert='$d_Gconvert'
14278 d_PRIEldbl='$d_PRIEldbl'
14279 d_PRIFldbl='$d_PRIFldbl'
14280 d_PRIGldbl='$d_PRIGldbl'
14281 d_PRIX64='$d_PRIX64'
14282 d_PRId64='$d_PRId64'
14283 d_PRIeldbl='$d_PRIeldbl'
14284 d_PRIfldbl='$d_PRIfldbl'
14285 d_PRIgldbl='$d_PRIgldbl'
14286 d_PRIi64='$d_PRIi64'
14287 d_PRIo64='$d_PRIo64'
14288 d_PRIu64='$d_PRIu64'
14289 d_PRIx64='$d_PRIx64'
14290 d_access='$d_access'
14291 d_accessx='$d_accessx'
14292 d_alarm='$d_alarm'
14293 d_archlib='$d_archlib'
14294 d_atolf='$d_atolf'
14295 d_atoll='$d_atoll'
14296 d_attribut='$d_attribut'
14297 d_bcmp='$d_bcmp'
14298 d_bcopy='$d_bcopy'
14299 d_bincompat5005='$d_bincompat5005'
14300 d_bsd='$d_bsd'
14301 d_bsdgetpgrp='$d_bsdgetpgrp'
14302 d_bsdsetpgrp='$d_bsdsetpgrp'
14303 d_bzero='$d_bzero'
14304 d_casti32='$d_casti32'
14305 d_castneg='$d_castneg'
14306 d_charvspr='$d_charvspr'
14307 d_chown='$d_chown'
14308 d_chroot='$d_chroot'
14309 d_chsize='$d_chsize'
14310 d_closedir='$d_closedir'
14311 d_const='$d_const'
14312 d_crypt='$d_crypt'
14313 d_csh='$d_csh'
14314 d_cuserid='$d_cuserid'
14315 d_dbl_dig='$d_dbl_dig'
14316 d_difftime='$d_difftime'
14317 d_dirnamlen='$d_dirnamlen'
14318 d_dlerror='$d_dlerror'
14319 d_dlopen='$d_dlopen'
14320 d_dlsymun='$d_dlsymun'
14321 d_dosuid='$d_dosuid'
14322 d_drand48proto='$d_drand48proto'
14323 d_dup2='$d_dup2'
14324 d_eaccess='$d_eaccess'
14325 d_endgrent='$d_endgrent'
14326 d_endhent='$d_endhent'
14327 d_endnent='$d_endnent'
14328 d_endpent='$d_endpent'
14329 d_endpwent='$d_endpwent'
14330 d_endsent='$d_endsent'
14331 d_endspent='$d_endspent'
14332 d_eofnblk='$d_eofnblk'
14333 d_eunice='$d_eunice'
14334 d_fchmod='$d_fchmod'
14335 d_fchown='$d_fchown'
14336 d_fcntl='$d_fcntl'
14337 d_fd_macros='$d_fd_macros'
14338 d_fd_set='$d_fd_set'
14339 d_fds_bits='$d_fds_bits'
14340 d_fgetpos='$d_fgetpos'
14341 d_flexfnam='$d_flexfnam'
14342 d_flock='$d_flock'
14343 d_fork='$d_fork'
14344 d_fpathconf='$d_fpathconf'
14345 d_fpos64_t='$d_fpos64_t'
14346 d_fs_data_s='$d_fs_data_s'
14347 d_fseeko='$d_fseeko'
14348 d_fsetpos='$d_fsetpos'
14349 d_fstatfs='$d_fstatfs'
14350 d_fstatvfs='$d_fstatvfs'
14351 d_ftello='$d_ftello'
14352 d_ftime='$d_ftime'
14353 d_getgrent='$d_getgrent'
14354 d_getgrps='$d_getgrps'
14355 d_gethbyaddr='$d_gethbyaddr'
14356 d_gethbyname='$d_gethbyname'
14357 d_gethent='$d_gethent'
14358 d_gethname='$d_gethname'
14359 d_gethostprotos='$d_gethostprotos'
14360 d_getlogin='$d_getlogin'
14361 d_getmnt='$d_getmnt'
14362 d_getmntent='$d_getmntent'
14363 d_getnbyaddr='$d_getnbyaddr'
14364 d_getnbyname='$d_getnbyname'
14365 d_getnent='$d_getnent'
14366 d_getnetprotos='$d_getnetprotos'
14367 d_getpbyname='$d_getpbyname'
14368 d_getpbynumber='$d_getpbynumber'
14369 d_getpent='$d_getpent'
14370 d_getpgid='$d_getpgid'
14371 d_getpgrp2='$d_getpgrp2'
14372 d_getpgrp='$d_getpgrp'
14373 d_getppid='$d_getppid'
14374 d_getprior='$d_getprior'
14375 d_getprotoprotos='$d_getprotoprotos'
14376 d_getpwent='$d_getpwent'
14377 d_getsbyname='$d_getsbyname'
14378 d_getsbyport='$d_getsbyport'
14379 d_getsent='$d_getsent'
14380 d_getservprotos='$d_getservprotos'
14381 d_getspent='$d_getspent'
14382 d_getspnam='$d_getspnam'
14383 d_gettimeod='$d_gettimeod'
14384 d_gnulibc='$d_gnulibc'
14385 d_grpasswd='$d_grpasswd'
14386 d_hasmntopt='$d_hasmntopt'
14387 d_htonl='$d_htonl'
14388 d_index='$d_index'
14389 d_inetaton='$d_inetaton'
14390 d_int64t='$d_int64t'
14391 d_isascii='$d_isascii'
14392 d_killpg='$d_killpg'
14393 d_lchown='$d_lchown'
14394 d_ldbl_dig='$d_ldbl_dig'
14395 d_link='$d_link'
14396 d_locconv='$d_locconv'
14397 d_lockf='$d_lockf'
14398 d_longdbl='$d_longdbl'
14399 d_longlong='$d_longlong'
14400 d_lstat='$d_lstat'
14401 d_mblen='$d_mblen'
14402 d_mbstowcs='$d_mbstowcs'
14403 d_mbtowc='$d_mbtowc'
14404 d_memchr='$d_memchr'
14405 d_memcmp='$d_memcmp'
14406 d_memcpy='$d_memcpy'
14407 d_memmove='$d_memmove'
14408 d_memset='$d_memset'
14409 d_mkdir='$d_mkdir'
14410 d_mkfifo='$d_mkfifo'
14411 d_mktime='$d_mktime'
14412 d_msg='$d_msg'
14413 d_msg_ctrunc='$d_msg_ctrunc'
14414 d_msg_dontroute='$d_msg_dontroute'
14415 d_msg_oob='$d_msg_oob'
14416 d_msg_peek='$d_msg_peek'
14417 d_msg_proxy='$d_msg_proxy'
14418 d_msgctl='$d_msgctl'
14419 d_msgget='$d_msgget'
14420 d_msgrcv='$d_msgrcv'
14421 d_msgsnd='$d_msgsnd'
14422 d_mymalloc='$d_mymalloc'
14423 d_nice='$d_nice'
14424 d_off64_t='$d_off64_t'
14425 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
14426 d_oldpthreads='$d_oldpthreads'
14427 d_oldsock='$d_oldsock'
14428 d_open3='$d_open3'
14429 d_pathconf='$d_pathconf'
14430 d_pause='$d_pause'
14431 d_phostname='$d_phostname'
14432 d_pipe='$d_pipe'
14433 d_poll='$d_poll'
14434 d_portable='$d_portable'
14435 d_pthread_yield='$d_pthread_yield'
14436 d_pwage='$d_pwage'
14437 d_pwchange='$d_pwchange'
14438 d_pwclass='$d_pwclass'
14439 d_pwcomment='$d_pwcomment'
14440 d_pwexpire='$d_pwexpire'
14441 d_pwgecos='$d_pwgecos'
14442 d_pwpasswd='$d_pwpasswd'
14443 d_pwquota='$d_pwquota'
14444 d_quad='$d_quad'
14445 d_readdir='$d_readdir'
14446 d_readlink='$d_readlink'
14447 d_rename='$d_rename'
14448 d_rewinddir='$d_rewinddir'
14449 d_rmdir='$d_rmdir'
14450 d_safebcpy='$d_safebcpy'
14451 d_safemcpy='$d_safemcpy'
14452 d_sanemcmp='$d_sanemcmp'
14453 d_sched_yield='$d_sched_yield'
14454 d_scm_rights='$d_scm_rights'
14455 d_seekdir='$d_seekdir'
14456 d_select='$d_select'
14457 d_sem='$d_sem'
14458 d_semctl='$d_semctl'
14459 d_semctl_semid_ds='$d_semctl_semid_ds'
14460 d_semctl_semun='$d_semctl_semun'
14461 d_semget='$d_semget'
14462 d_semop='$d_semop'
14463 d_setegid='$d_setegid'
14464 d_seteuid='$d_seteuid'
14465 d_setgrent='$d_setgrent'
14466 d_setgrps='$d_setgrps'
14467 d_sethent='$d_sethent'
14468 d_setlinebuf='$d_setlinebuf'
14469 d_setlocale='$d_setlocale'
14470 d_setnent='$d_setnent'
14471 d_setpent='$d_setpent'
14472 d_setpgid='$d_setpgid'
14473 d_setpgrp2='$d_setpgrp2'
14474 d_setpgrp='$d_setpgrp'
14475 d_setprior='$d_setprior'
14476 d_setpwent='$d_setpwent'
14477 d_setregid='$d_setregid'
14478 d_setresgid='$d_setresgid'
14479 d_setresuid='$d_setresuid'
14480 d_setreuid='$d_setreuid'
14481 d_setrgid='$d_setrgid'
14482 d_setruid='$d_setruid'
14483 d_setsent='$d_setsent'
14484 d_setsid='$d_setsid'
14485 d_setspent='$d_setspent'
14486 d_setvbuf='$d_setvbuf'
14487 d_sfio='$d_sfio'
14488 d_shm='$d_shm'
14489 d_shmat='$d_shmat'
14490 d_shmatprototype='$d_shmatprototype'
14491 d_shmctl='$d_shmctl'
14492 d_shmdt='$d_shmdt'
14493 d_shmget='$d_shmget'
14494 d_sigaction='$d_sigaction'
14495 d_sigsetjmp='$d_sigsetjmp'
14496 d_socket='$d_socket'
14497 d_sockpair='$d_sockpair'
14498 d_sqrtl='$d_sqrtl'
14499 d_statblks='$d_statblks'
14500 d_statfs_f_flags='$d_statfs_f_flags'
14501 d_statfs_s='$d_statfs_s'
14502 d_statvfs='$d_statvfs'
14503 d_stdio_cnt_lval='$d_stdio_cnt_lval'
14504 d_stdio_ptr_lval='$d_stdio_ptr_lval'
14505 d_stdio_stream_array='$d_stdio_stream_array'
14506 d_stdiobase='$d_stdiobase'
14507 d_stdstdio='$d_stdstdio'
14508 d_strchr='$d_strchr'
14509 d_strcoll='$d_strcoll'
14510 d_strctcpy='$d_strctcpy'
14511 d_strerrm='$d_strerrm'
14512 d_strerror='$d_strerror'
14513 d_strtod='$d_strtod'
14514 d_strtol='$d_strtol'
14515 d_strtoul='$d_strtoul'
14516 d_strtoull='$d_strtoull'
14517 d_strxfrm='$d_strxfrm'
14518 d_suidsafe='$d_suidsafe'
14519 d_symlink='$d_symlink'
14520 d_syscall='$d_syscall'
14521 d_sysconf='$d_sysconf'
14522 d_sysernlst='$d_sysernlst'
14523 d_syserrlst='$d_syserrlst'
14524 d_system='$d_system'
14525 d_tcgetpgrp='$d_tcgetpgrp'
14526 d_tcsetpgrp='$d_tcsetpgrp'
14527 d_telldir='$d_telldir'
14528 d_telldirproto='$d_telldirproto'
14529 d_time='$d_time'
14530 d_times='$d_times'
14531 d_truncate='$d_truncate'
14532 d_tzname='$d_tzname'
14533 d_umask='$d_umask'
14534 d_uname='$d_uname'
14535 d_union_semun='$d_union_semun'
14536 d_ustat='$d_ustat'
14537 d_vendorbin='$d_vendorbin'
14538 d_vendorlib='$d_vendorlib'
14539 d_vfork='$d_vfork'
14540 d_void_closedir='$d_void_closedir'
14541 d_voidsig='$d_voidsig'
14542 d_voidtty='$d_voidtty'
14543 d_volatile='$d_volatile'
14544 d_vprintf='$d_vprintf'
14545 d_wait4='$d_wait4'
14546 d_waitpid='$d_waitpid'
14547 d_wcstombs='$d_wcstombs'
14548 d_wctomb='$d_wctomb'
14549 d_xenix='$d_xenix'
14550 date='$date'
14551 db_hashtype='$db_hashtype'
14552 db_prefixtype='$db_prefixtype'
14553 defvoidused='$defvoidused'
14554 direntrytype='$direntrytype'
14555 dlext='$dlext'
14556 dlsrc='$dlsrc'
14557 doublesize='$doublesize'
14558 drand01='$drand01'
14559 dynamic_ext='$dynamic_ext'
14560 eagain='$eagain'
14561 ebcdic='$ebcdic'
14562 echo='$echo'
14563 egrep='$egrep'
14564 emacs='$emacs'
14565 eunicefix='$eunicefix'
14566 exe_ext='$exe_ext'
14567 expr='$expr'
14568 extensions='$extensions'
14569 fflushNULL='$fflushNULL'
14570 fflushall='$fflushall'
14571 find='$find'
14572 firstmakefile='$firstmakefile'
14573 flex='$flex'
14574 fpossize='$fpossize'
14575 fpostype='$fpostype'
14576 freetype='$freetype'
14577 full_ar='$full_ar'
14578 full_csh='$full_csh'
14579 full_sed='$full_sed'
14580 gccversion='$gccversion'
14581 gidformat='$gidformat'
14582 gidsign='$gidsign'
14583 gidsize='$gidsize'
14584 gidtype='$gidtype'
14585 glibpth='$glibpth'
14586 grep='$grep'
14587 groupcat='$groupcat'
14588 groupstype='$groupstype'
14589 gzip='$gzip'
14590 h_fcntl='$h_fcntl'
14591 h_sysfile='$h_sysfile'
14592 hint='$hint'
14593 hostcat='$hostcat'
14594 huge='$huge'
14595 i16size='$i16size'
14596 i16type='$i16type'
14597 i32size='$i32size'
14598 i32type='$i32type'
14599 i64size='$i64size'
14600 i64type='$i64type'
14601 i8size='$i8size'
14602 i8type='$i8type'
14603 i_arpainet='$i_arpainet'
14604 i_bsdioctl='$i_bsdioctl'
14605 i_db='$i_db'
14606 i_dbm='$i_dbm'
14607 i_dirent='$i_dirent'
14608 i_dld='$i_dld'
14609 i_dlfcn='$i_dlfcn'
14610 i_fcntl='$i_fcntl'
14611 i_float='$i_float'
14612 i_gdbm='$i_gdbm'
14613 i_grp='$i_grp'
14614 i_inttypes='$i_inttypes'
14615 i_limits='$i_limits'
14616 i_locale='$i_locale'
14617 i_machcthr='$i_machcthr'
14618 i_malloc='$i_malloc'
14619 i_math='$i_math'
14620 i_memory='$i_memory'
14621 i_mntent='$i_mntent'
14622 i_ndbm='$i_ndbm'
14623 i_netdb='$i_netdb'
14624 i_neterrno='$i_neterrno'
14625 i_netinettcp='$i_netinettcp'
14626 i_niin='$i_niin'
14627 i_poll='$i_poll'
14628 i_pthread='$i_pthread'
14629 i_pwd='$i_pwd'
14630 i_rpcsvcdbm='$i_rpcsvcdbm'
14631 i_sfio='$i_sfio'
14632 i_sgtty='$i_sgtty'
14633 i_shadow='$i_shadow'
14634 i_socks='$i_socks'
14635 i_stdarg='$i_stdarg'
14636 i_stddef='$i_stddef'
14637 i_stdlib='$i_stdlib'
14638 i_string='$i_string'
14639 i_sysaccess='$i_sysaccess'
14640 i_sysdir='$i_sysdir'
14641 i_sysfile='$i_sysfile'
14642 i_sysfilio='$i_sysfilio'
14643 i_sysin='$i_sysin'
14644 i_sysioctl='$i_sysioctl'
14645 i_sysmount='$i_sysmount'
14646 i_sysndir='$i_sysndir'
14647 i_sysparam='$i_sysparam'
14648 i_sysresrc='$i_sysresrc'
14649 i_syssecrt='$i_syssecrt'
14650 i_sysselct='$i_sysselct'
14651 i_syssockio='$i_syssockio'
14652 i_sysstat='$i_sysstat'
14653 i_sysstatfs='$i_sysstatfs'
14654 i_sysstatvfs='$i_sysstatvfs'
14655 i_systime='$i_systime'
14656 i_systimek='$i_systimek'
14657 i_systimes='$i_systimes'
14658 i_systypes='$i_systypes'
14659 i_sysuio='$i_sysuio'
14660 i_sysun='$i_sysun'
14661 i_sysvfs='$i_sysvfs'
14662 i_syswait='$i_syswait'
14663 i_termio='$i_termio'
14664 i_termios='$i_termios'
14665 i_time='$i_time'
14666 i_unistd='$i_unistd'
14667 i_ustat='$i_ustat'
14668 i_utime='$i_utime'
14669 i_values='$i_values'
14670 i_varargs='$i_varargs'
14671 i_varhdr='$i_varhdr'
14672 i_vfork='$i_vfork'
14673 ignore_versioned_solibs='$ignore_versioned_solibs'
14674 incpath='$incpath'
14675 inews='$inews'
14676 installarchlib='$installarchlib'
14677 installbin='$installbin'
14678 installman1dir='$installman1dir'
14679 installman3dir='$installman3dir'
14680 installprefix='$installprefix'
14681 installprefixexp='$installprefixexp'
14682 installprivlib='$installprivlib'
14683 installscript='$installscript'
14684 installsitearch='$installsitearch'
14685 installsitebin='$installsitebin'
14686 installsitelib='$installsitelib'
14687 installstyle='$installstyle'
14688 installusrbinperl='$installusrbinperl'
14689 installvendorbin='$installvendorbin'
14690 installvendorlib='$installvendorlib'
14691 intsize='$intsize'
14692 ivdformat='$ivdformat'
14693 ivsize='$ivsize'
14694 ivtype='$ivtype'
14695 known_extensions='$known_extensions'
14696 ksh='$ksh'
14697 large='$large'
14698 ld='$ld'
14699 lddlflags='$lddlflags'
14700 ldflags='$ldflags'
14701 ldlibpthname='$ldlibpthname'
14702 less='$less'
14703 lib_ext='$lib_ext'
14704 libc='$libc'
14705 libperl='$libperl'
14706 libpth='$libpth'
14707 libs='$libs'
14708 libswanted='$libswanted'
14709 line='$line'
14710 lint='$lint'
14711 lkflags='$lkflags'
14712 ln='$ln'
14713 lns='$lns'
14714 locincpth='$locincpth'
14715 loclibpth='$loclibpth'
14716 longdblsize='$longdblsize'
14717 longlongsize='$longlongsize'
14718 longsize='$longsize'
14719 lp='$lp'
14720 lpr='$lpr'
14721 ls='$ls'
14722 lseeksize='$lseeksize'
14723 lseektype='$lseektype'
14724 mail='$mail'
14725 mailx='$mailx'
14726 make='$make'
14727 make_set_make='$make_set_make'
14728 mallocobj='$mallocobj'
14729 mallocsrc='$mallocsrc'
14730 malloctype='$malloctype'
14731 man1dir='$man1dir'
14732 man1direxp='$man1direxp'
14733 man1ext='$man1ext'
14734 man3dir='$man3dir'
14735 man3direxp='$man3direxp'
14736 man3ext='$man3ext'
14737 medium='$medium'
14738 mips_type='$mips_type'
14739 mkdir='$mkdir'
14740 models='$models'
14741 modetype='$modetype'
14742 more='$more'
14743 multiarch='$multiarch'
14744 mv='$mv'
14745 myarchname='$myarchname'
14746 mydomain='$mydomain'
14747 myhostname='$myhostname'
14748 myuname='$myuname'
14749 n='$n'
14750 netdb_hlen_type='$netdb_hlen_type'
14751 netdb_host_type='$netdb_host_type'
14752 netdb_name_type='$netdb_name_type'
14753 netdb_net_type='$netdb_net_type'
14754 nm='$nm'
14755 nm_opt='$nm_opt'
14756 nm_so_opt='$nm_so_opt'
14757 nonxs_ext='$nonxs_ext'
14758 nroff='$nroff'
14759 nvsize='$nvsize'
14760 nvtype='$nvtype'
14761 o_nonblock='$o_nonblock'
14762 obj_ext='$obj_ext'
14763 old_pthread_create_joinable='$old_pthread_create_joinable'
14764 optimize='$optimize'
14765 orderlib='$orderlib'
14766 osname='$osname'
14767 osvers='$osvers'
14768 package='$package'
14769 pager='$pager'
14770 passcat='$passcat'
14771 patchlevel='$patchlevel'
14772 path_sep='$path_sep'
14773 perl='$perl'
14774 perladmin='$perladmin'
14775 perlpath='$perlpath'
14776 pg='$pg'
14777 phostname='$phostname'
14778 pidtype='$pidtype'
14779 plibpth='$plibpth'
14780 pm_apiversion='$pm_apiversion'
14781 pmake='$pmake'
14782 pr='$pr'
14783 prefix='$prefix'
14784 prefixexp='$prefixexp'
14785 privlib='$privlib'
14786 privlibexp='$privlibexp'
14787 prototype='$prototype'
14788 ptrsize='$ptrsize'
14789 quadkind='$quadkind'
14790 quadtype='$quadtype'
14791 randbits='$randbits'
14792 randfunc='$randfunc'
14793 randseedtype='$randseedtype'
14794 ranlib='$ranlib'
14795 rd_nodata='$rd_nodata'
14796 rm='$rm'
14797 rmail='$rmail'
14798 runnm='$runnm'
14799 sPRIEldbl='$sPRIEldbl'
14800 sPRIFldbl='$sPRIFldbl'
14801 sPRIGldbl='$sPRIGldbl'
14802 sPRIX64='$sPRIX64'
14803 sPRId64='$sPRId64'
14804 sPRIeldbl='$sPRIeldbl'
14805 sPRIfldbl='$sPRIfldbl'
14806 sPRIgldbl='$sPRIgldbl'
14807 sPRIi64='$sPRIi64'
14808 sPRIo64='$sPRIo64'
14809 sPRIu64='$sPRIu64'
14810 sPRIx64='$sPRIx64'
14811 sched_yield='$sched_yield'
14812 scriptdir='$scriptdir'
14813 scriptdirexp='$scriptdirexp'
14814 sed='$sed'
14815 seedfunc='$seedfunc'
14816 selectminbits='$selectminbits'
14817 selecttype='$selecttype'
14818 sendmail='$sendmail'
14819 sh='$sh'
14820 shar='$shar'
14821 sharpbang='$sharpbang'
14822 shmattype='$shmattype'
14823 shortsize='$shortsize'
14824 shrpenv='$shrpenv'
14825 shsharp='$shsharp'
14826 sig_count='$sig_count'
14827 sig_name='$sig_name'
14828 sig_name_init='$sig_name_init'
14829 sig_num='$sig_num'
14830 sig_num_init='$sig_num_init'
14831 signal_t='$signal_t'
14832 sitearch='$sitearch'
14833 sitearchexp='$sitearchexp'
14834 sitebin='$sitebin'
14835 sitebinexp='$sitebinexp'
14836 sitelib='$sitelib'
14837 sitelibexp='$sitelibexp'
14838 siteprefix='$siteprefix'
14839 siteprefixexp='$siteprefixexp'
14840 sizetype='$sizetype'
14841 sleep='$sleep'
14842 smail='$smail'
14843 small='$small'
14844 so='$so'
14845 sockethdr='$sockethdr'
14846 socketlib='$socketlib'
14847 sort='$sort'
14848 spackage='$spackage'
14849 spitshell='$spitshell'
14850 split='$split'
14851 src='$src'
14852 ssizetype='$ssizetype'
14853 startperl='$startperl'
14854 startsh='$startsh'
14855 static_ext='$static_ext'
14856 stdchar='$stdchar'
14857 stdio_base='$stdio_base'
14858 stdio_bufsiz='$stdio_bufsiz'
14859 stdio_cnt='$stdio_cnt'
14860 stdio_filbuf='$stdio_filbuf'
14861 stdio_ptr='$stdio_ptr'
14862 stdio_stream_array='$stdio_stream_array'
14863 strings='$strings'
14864 submit='$submit'
14865 subversion='$subversion'
14866 sysman='$sysman'
14867 tail='$tail'
14868 tar='$tar'
14869 tbl='$tbl'
14870 tee='$tee'
14871 test='$test'
14872 timeincl='$timeincl'
14873 timetype='$timetype'
14874 touch='$touch'
14875 tr='$tr'
14876 trnl='$trnl'
14877 troff='$troff'
14878 u16size='$u16size'
14879 u16type='$u16type'
14880 u32size='$u32size'
14881 u32type='$u32type'
14882 u64size='$u64size'
14883 u64type='$u64type'
14884 u8size='$u8size'
14885 u8type='$u8type'
14886 uidformat='$uidformat'
14887 uidsign='$uidsign'
14888 uidsize='$uidsize'
14889 uidtype='$uidtype'
14890 uname='$uname'
14891 uniq='$uniq'
14892 uquadtype='$uquadtype'
14893 use5005threads='$use5005threads'
14894 use64bits='$use64bits'
14895 usedl='$usedl'
14896 useithreads='$useithreads'
14897 uselargefiles='$uselargefiles'
14898 uselongdouble='$uselongdouble'
14899 uselonglong='$uselonglong'
14900 usemorebits='$usemorebits'
14901 usemultiplicity='$usemultiplicity'
14902 usemymalloc='$usemymalloc'
14903 usenm='$usenm'
14904 useopcode='$useopcode'
14905 useperlio='$useperlio'
14906 useposix='$useposix'
14907 usesfio='$usesfio'
14908 useshrplib='$useshrplib'
14909 usesocks='$usesocks'
14910 usethreads='$usethreads'
14911 usevendorprefix='$usevendorprefix'
14912 usevfork='$usevfork'
14913 usrinc='$usrinc'
14914 uuname='$uuname'
14915 uvoformat='$uvoformat'
14916 uvsize='$uvsize'
14917 uvtype='$uvtype'
14918 uvuformat='$uvuformat'
14919 uvxformat='$uvxformat'
14920 vendorbin='$vendorbin'
14921 vendorbinexp='$vendorbinexp'
14922 vendorlib='$vendorlib'
14923 vendorlibexp='$vendorlibexp'
14924 vendorprefix='$vendorprefix'
14925 vendorprefixexp='$vendorprefixexp'
14926 version='$version'
14927 vi='$vi'
14928 voidflags='$voidflags'
14929 xlibpth='$xlibpth'
14930 xs_apiversion='$xs_apiversion'
14931 zcat='$zcat'
14932 zip='$zip'
14933 EOT
14934
14935 : Add in command line options if available
14936 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
14937
14938 : add special variables
14939 $test -f $src/patchlevel.h && \
14940 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
14941 echo "CONFIGDOTSH=true" >>config.sh
14942
14943 : propagate old symbols
14944 if $test -f UU/config.sh; then
14945         <UU/config.sh sort | uniq >UU/oldconfig.sh
14946         sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
14947         sort | uniq -u >UU/oldsyms
14948         set X `cat UU/oldsyms`
14949         shift
14950         case $# in
14951         0) ;;
14952         *)
14953                 cat <<EOM
14954 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
14955 EOM
14956                 echo "# Variables propagated from previous config.sh file." >>config.sh
14957                 for sym in `cat UU/oldsyms`; do
14958                         echo "    Propagating $hint variable "'$'"$sym..."
14959                         eval 'tmp="$'"${sym}"'"'
14960                         echo "$tmp" | \
14961                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
14962                 done
14963                 ;;
14964         esac
14965 fi
14966
14967 : Finish up by extracting the .SH files
14968 case "$alldone" in
14969 exit)
14970         $rm -rf UU
14971         echo "Done."
14972         exit 0
14973         ;;
14974 cont)
14975         ;;
14976 '')
14977         dflt=''
14978         nostick=true
14979         $cat <<EOM
14980
14981 If you'd like to make any changes to the config.sh file before I begin
14982 to configure things, do it as a shell escape now (e.g. !vi config.sh).
14983
14984 EOM
14985         rp="Press return or use a shell escape to edit config.sh:"
14986         . UU/myread
14987         nostick=''
14988         case "$ans" in
14989         '') ;;
14990         *) : in case they cannot read
14991                 sh 1>&4 -c "$ans";;
14992         esac
14993         ;;
14994 esac
14995
14996 : if this fails, just run all the .SH files by hand
14997 . ./config.sh
14998
14999 echo " "
15000 exec 1>&4
15001 . ./UU/extract
15002
15003 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
15004         dflt=y
15005         case "$silent" in
15006         true) ;;
15007         *)
15008                 $cat <<EOM
15009
15010 Now you need to generate make dependencies by running "$make depend".
15011 You might prefer to run it in background: "$make depend > makedepend.out &"
15012 It can take a while, so you might not want to run it right now.
15013
15014 EOM
15015                 ;;
15016         esac
15017         rp="Run $make depend now?"
15018         . UU/myread
15019         case "$ans" in
15020         y*)
15021                 $make depend && echo "Now you must run a $make."
15022                 ;;
15023         *)
15024                 echo "You must run '$make depend' then '$make'."
15025                 ;;
15026         esac
15027 elif test -f [Mm]akefile; then
15028         echo " "
15029         echo "Now you must run a $make."
15030 else
15031         echo "Done."
15032 fi
15033
15034 if $test -f Policy.sh; then
15035     $cat <<EOM
15036
15037 If you compile $package on a different machine or from a different object
15038 directory, copy the Policy.sh file from this object directory to the
15039 new one before you run Configure -- this will help you with most of
15040 the policy defaults.
15041
15042 EOM
15043 fi
15044 if $test -f config.msg; then
15045     echo "Hmm.  I also noted the following information while running:"
15046     echo " "
15047     $cat config.msg >&4
15048     $rm -f config.msg
15049 fi
15050 $rm -f kit*isdone ark*isdone
15051 $rm -rf UU
15052
15053 : End of Configure
15054