Continue largefileness separation from quadness;
[p5sagit/p5-mst-13.2.git] / Configure
1 #! /bin/sh
2 #
3 # If these # comments don't work, trim them. Don't worry about any other
4 # shell scripts, Configure will trim # comments from them for you.
5 #
6 # (If you are trying to port this package to a machine without sh,
7 # I would suggest you have a look at the prototypical config_h.SH file
8 # and edit it to reflect your system. Some packages may include samples
9 # of config.h for certain machines, so you might look for one of those.)
10 #
11 # Yes, you may rip this off to use in other distribution packages. This
12 # script belongs to the public domain and cannot be copyrighted.
13 #
14 # (Note: this Configure script was generated automatically. Rather than
15 # working with this copy of Configure, you may wish to get metaconfig.
16 # The dist-3.0 package (which contains metaconfig) was posted in
17 # comp.sources.misc and is available on CPAN under authors/id/RAM so
18 # you may fetch it yourself from your nearest archive site.)
19 #
20
21 # $Id: Head.U,v 3.0.1.9 1997/02/28 15:02:09 ram Exp $
22 #
23 # Generated on Sat Nov 13 17:55:50 EET 1999 [metaconfig 3.0 PL70]
24 # (with additional metaconfig patches by perlbug@perl.com)
25
26 cat >/tmp/c1$$ <<EOF
27 ARGGGHHHH!!!!!
28
29 SCO csh still thinks true is false.  Write to SCO today and tell them that next
30 year Configure ought to "rm /bin/csh" unless they fix their blasted shell. :-)
31
32 (Actually, Configure ought to just patch csh in place.  Hmm.  Hmmmmm.  All
33 we'd have to do is go in and swap the && and || tokens, wherever they are.)
34
35 [End of diatribe. We now return you to your regularly scheduled programming...]
36 EOF
37 cat >/tmp/c2$$ <<EOF
38
39 OOPS!  You naughty creature!  You didn't run Configure with sh!
40 I will attempt to remedy the situation by running sh for you...
41 EOF
42
43 true || cat /tmp/c1$$ /tmp/c2$$
44 true || exec sh $0 $argv:q
45
46 (exit $?0) || cat /tmp/c2$$
47 (exit $?0) || exec sh $0 $argv:q
48 rm -f /tmp/c1$$ /tmp/c2$$
49
50 : compute my invocation name
51 me=$0
52 case "$0" in
53 */*)
54         me=`echo $0 | sed -e 's!.*/\(.*\)!\1!' 2>/dev/null`
55         test "$me" || me=$0
56         ;;
57 esac
58
59 : Proper separator for the PATH environment variable
60 p_=:
61 : On OS/2 this directory should exist if this is not floppy only system :-]
62 if test -d c:/. ; then
63     if test -n "$OS2_SHELL"; then
64                 p_=\;
65                 PATH=`cmd /c "echo %PATH%" | tr '\\\\' / `
66                 OS2_SHELL=`cmd /c "echo %OS2_SHELL%" | tr '\\\\' / | tr '[A-Z]' '[a-z]'`
67         elif test -n "$DJGPP"; then
68                 p_=\;
69         fi
70 fi
71
72 : Proper PATH setting
73 paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin'
74 paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin"
75 paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin"
76 paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin"
77 paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb"
78 paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /usr/ccs/bin"
79 paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib"
80 paths="$paths /sbin /usr/sbin /usr/libexec"
81
82 for p in $paths
83 do
84         case "$p_$PATH$p_" in
85         *$p_$p$p_*) ;;
86         *) test -d $p && PATH=$PATH$p_$p ;;
87         esac
88 done
89
90 PATH=.$p_$PATH
91 export PATH
92
93 : shall we be using ksh?
94 inksh=''
95 needksh=''
96 avoidksh=''
97 newsh=/bin/ksh
98 changesh=''
99 if (PATH=.; alias -x) >/dev/null 2>&1; then
100                 inksh=true
101 fi
102 if test -f /hp-ux -a -f /bin/ksh; then
103         needksh='to avoid sh bug in "here document" expansion'
104 fi
105 if test -d /usr/lpp -a -f /usr/bin/bsh -a -f /usr/bin/uname; then
106         if test X`/usr/bin/uname -v` = X4; then
107                 avoidksh="to avoid AIX 4's /bin/sh"
108                 newsh=/usr/bin/bsh
109         fi
110 fi
111 if test -f /osf_boot -a -f /usr/sbin/setld; then
112         if test X`/usr/bin/uname -s` = XOSF1; then
113                 avoidksh="to avoid Digital UNIX' ksh"
114                 newsh=/bin/sh
115                 unset BIN_SH # if this is 'xpg4' sh will start up ksh
116         fi
117 fi
118 case "$inksh/$needksh" in
119 /[a-z]*)
120                 ENV=''
121                 changesh=true
122                 reason="$needksh"
123         ;;
124 esac
125 case "$inksh/$avoidksh" in
126 true/[a-z]*)
127         changesh=true
128         reason="$avoidksh"
129         ;;
130 esac
131 case "$inksh/$needksh-$avoidksh-" in
132 true/--)
133                 cat <<EOM
134 (I see you are using the Korn shell.  Some ksh's blow up on $me,
135 mainly on older exotic systems.  If yours does, try the Bourne shell instead.)
136 EOM
137         ;;
138 esac
139 case "$changesh" in
140 true)
141         echo "(Feeding myself to $newsh $reason.)"
142         case "$0" in
143         Configure|*/Configure) exec $newsh $0 "$@";;
144         *) exec $newsh Configure "$@";;
145         esac
146         ;;
147 esac
148
149 : if needed set CDPATH to a harmless value that is not chatty
150 : avoid bash 2.02 problems with empty CDPATH.
151 case "$CDPATH" in
152 '')     ;;
153 *)      case "$SHELL" in
154         *bash*) CDPATH='.' ;;
155         *)              CDPATH='' ;;
156         esac
157         ;;
158 esac
159 : Configure runs within the UU subdirectory
160 test -d UU || mkdir UU
161 cd UU && rm -f ./*
162
163 ccsymbols=''
164 cppccsymbols=''
165 cppsymbols=''
166 dynamic_ext=''
167 extensions=''
168 known_extensions=''
169 nonxs_ext=''
170 static_ext=''
171 useopcode=''
172 useposix=''
173 d_bsd=''
174 d_eunice=''
175 d_xenix=''
176 eunicefix=''
177 Mcc=''
178 ar=''
179 awk=''
180 bash=''
181 bison=''
182 byacc=''
183 cat=''
184 chgrp=''
185 chmod=''
186 chown=''
187 comm=''
188 compress=''
189 cp=''
190 cpio=''
191 cpp=''
192 csh=''
193 date=''
194 echo=''
195 egrep=''
196 emacs=''
197 expr=''
198 find=''
199 flex=''
200 grep=''
201 gzip=''
202 inews=''
203 ksh=''
204 less=''
205 line=''
206 lint=''
207 ln=''
208 lp=''
209 lpr=''
210 ls=''
211 mail=''
212 mailx=''
213 make=''
214 mkdir=''
215 more=''
216 mv=''
217 nm=''
218 nroff=''
219 perl=''
220 pg=''
221 pmake=''
222 pr=''
223 rm=''
224 rmail=''
225 sed=''
226 sendmail=''
227 shar=''
228 sleep=''
229 smail=''
230 sort=''
231 submit=''
232 tail=''
233 tar=''
234 tbl=''
235 tee=''
236 test=''
237 touch=''
238 tr=''
239 troff=''
240 uname=''
241 uniq=''
242 uuname=''
243 vi=''
244 zcat=''
245 zip=''
246 full_ar=''
247 full_sed=''
248 libswanted=''
249 hint=''
250 myuname=''
251 osname=''
252 osvers=''
253 Author=''
254 Date=''
255 Header=''
256 Id=''
257 Locker=''
258 Log=''
259 RCSfile=''
260 Revision=''
261 Source=''
262 State=''
263 _a=''
264 _exe=''
265 _o=''
266 archobjs=''
267 exe_ext=''
268 firstmakefile=''
269 lib_ext=''
270 obj_ext=''
271 path_sep=''
272 afs=''
273 alignbytes=''
274 ansi2knr=''
275 archlib=''
276 archlibexp=''
277 d_archlib=''
278 installarchlib=''
279 archname=''
280 myarchname=''
281 d_atolf=''
282 d_atoll=''
283 baserev=''
284 bin=''
285 binexp=''
286 installbin=''
287 bincompat5005=''
288 d_bincompat5005=''
289 byteorder=''
290 cc=''
291 gccversion=''
292 ccflags=''
293 cppflags=''
294 ldflags=''
295 lkflags=''
296 locincpth=''
297 optimize=''
298 cf_email=''
299 cf_by=''
300 cf_time=''
301 charsize=''
302 contains=''
303 cpp_stuff=''
304 cpplast=''
305 cppminus=''
306 cpprun=''
307 cppstdin=''
308 crosscompile=''
309 d_access=''
310 d_accessx=''
311 d_alarm=''
312 d_attribut=''
313 d_bcmp=''
314 d_bcopy=''
315 d_bzero=''
316 d_casti32=''
317 castflags=''
318 d_castneg=''
319 d_chown=''
320 d_chroot=''
321 d_chsize=''
322 d_closedir=''
323 d_void_closedir=''
324 d_const=''
325 cryptlib=''
326 d_crypt=''
327 d_csh=''
328 full_csh=''
329 d_cuserid=''
330 d_dbl_dig=''
331 d_difftime=''
332 d_dlerror=''
333 d_dlopen=''
334 d_dlsymun=''
335 d_dosuid=''
336 d_suidsafe=''
337 d_drand48proto=''
338 d_dup2=''
339 d_eaccess=''
340 d_endgrent=''
341 d_endhent=''
342 d_endnent=''
343 d_endpent=''
344 d_endpwent=''
345 d_endsent=''
346 d_endspent=''
347 d_fchmod=''
348 d_fchown=''
349 d_fcntl=''
350 d_fd_macros=''
351 d_fd_set=''
352 d_fds_bits=''
353 d_fgetpos=''
354 d_flexfnam=''
355 d_flock=''
356 d_fork=''
357 d_fs_data_s=''
358 d_fseeko=''
359 d_fsetpos=''
360 d_fstatfs=''
361 d_ftello=''
362 d_ftime=''
363 d_gettimeod=''
364 d_Gconvert=''
365 d_getgrent=''
366 d_getgrps=''
367 d_gethbyaddr=''
368 d_gethbyname=''
369 d_gethent=''
370 aphostname=''
371 d_gethname=''
372 d_phostname=''
373 d_uname=''
374 d_gethostprotos=''
375 d_getlogin=''
376 d_getmnt=''
377 d_getmntent=''
378 d_getnbyaddr=''
379 d_getnbyname=''
380 d_getnent=''
381 d_getnetprotos=''
382 d_getpent=''
383 d_getpgid=''
384 d_getpgrp2=''
385 d_bsdgetpgrp=''
386 d_getpgrp=''
387 d_getppid=''
388 d_getprior=''
389 d_getpbyname=''
390 d_getpbynumber=''
391 d_getprotoprotos=''
392 d_getpwent=''
393 d_getsent=''
394 d_getservprotos=''
395 d_getspent=''
396 d_getspnam=''
397 d_getsbyname=''
398 d_getsbyport=''
399 d_gnulibc=''
400 d_hasmntopt=''
401 d_htonl=''
402 d_inetaton=''
403 d_int64t=''
404 d_isascii=''
405 d_killpg=''
406 d_lchown=''
407 d_ldbl_dig=''
408 d_link=''
409 d_locconv=''
410 d_lockf=''
411 d_longdbl=''
412 longdblsize=''
413 d_longlong=''
414 longlongsize=''
415 d_lstat=''
416 d_mblen=''
417 d_mbstowcs=''
418 d_mbtowc=''
419 d_memchr=''
420 d_memcmp=''
421 d_memcpy=''
422 d_memmove=''
423 d_memset=''
424 d_mkdir=''
425 d_mkfifo=''
426 d_mktime=''
427 d_msg=''
428 d_msgctl=''
429 d_msgget=''
430 d_msgrcv=''
431 d_msgsnd=''
432 d_nice=''
433 d_open3=''
434 d_fpathconf=''
435 d_pathconf=''
436 d_pause=''
437 d_pipe=''
438 d_poll=''
439 d_portable=''
440 d_old_pthread_create_joinable=''
441 old_pthread_create_joinable=''
442 d_pthread_yield=''
443 d_sched_yield=''
444 sched_yield=''
445 d_readdir=''
446 d_rewinddir=''
447 d_seekdir=''
448 d_telldir=''
449 d_readlink=''
450 d_rename=''
451 d_rmdir=''
452 d_safebcpy=''
453 d_safemcpy=''
454 d_sanemcmp=''
455 d_select=''
456 d_sem=''
457 d_semctl=''
458 d_semget=''
459 d_semop=''
460 d_setegid=''
461 d_seteuid=''
462 d_setgrent=''
463 d_setgrps=''
464 d_sethent=''
465 d_setlinebuf=''
466 d_setlocale=''
467 d_setnent=''
468 d_setpent=''
469 d_setpgid=''
470 d_setpgrp2=''
471 d_bsdsetpgrp=''
472 d_setpgrp=''
473 d_setprior=''
474 d_setpwent=''
475 d_setregid=''
476 d_setresgid=''
477 d_setresuid=''
478 d_setreuid=''
479 d_setrgid=''
480 d_setruid=''
481 d_setsent=''
482 d_setsid=''
483 d_setspent=''
484 d_setvbuf=''
485 d_sfio=''
486 usesfio=''
487 d_shm=''
488 d_shmat=''
489 d_shmatprototype=''
490 shmattype=''
491 d_shmctl=''
492 d_shmdt=''
493 d_shmget=''
494 d_sigaction=''
495 d_sigsetjmp=''
496 d_msg_ctrunc=''
497 d_msg_dontroute=''
498 d_msg_oob=''
499 d_msg_peek=''
500 d_msg_proxy=''
501 d_oldsock=''
502 d_scm_rights=''
503 d_socket=''
504 d_sockpair=''
505 sockethdr=''
506 socketlib=''
507 d_sqrtl=''
508 d_statblks=''
509 d_statfs_f_flags=''
510 d_statfs_s=''
511 d_fstatvfs=''
512 d_statvfs=''
513 d_stdio_cnt_lval=''
514 d_stdio_ptr_lval=''
515 d_stdiobase=''
516 d_stdstdio=''
517 stdio_base=''
518 stdio_bufsiz=''
519 stdio_cnt=''
520 stdio_filbuf=''
521 stdio_ptr=''
522 d_index=''
523 d_strchr=''
524 d_strcoll=''
525 d_strctcpy=''
526 d_strerrm=''
527 d_strerror=''
528 d_sysernlst=''
529 d_syserrlst=''
530 d_strtod=''
531 d_strtol=''
532 d_strtoul=''
533 d_strxfrm=''
534 d_symlink=''
535 d_syscall=''
536 d_sysconf=''
537 d_system=''
538 d_tcgetpgrp=''
539 d_tcsetpgrp=''
540 d_telldirproto=''
541 d_time=''
542 timetype=''
543 clocktype=''
544 d_times=''
545 d_truncate=''
546 d_tzname=''
547 d_umask=''
548 d_semctl_semid_ds=''
549 d_semctl_semun=''
550 d_union_semun=''
551 d_ustat=''
552 d_vfork=''
553 usevfork=''
554 d_voidsig=''
555 signal_t=''
556 d_volatile=''
557 d_charvspr=''
558 d_vprintf=''
559 d_wait4=''
560 d_waitpid=''
561 d_wcstombs=''
562 d_wctomb=''
563 dlext=''
564 cccdlflags=''
565 ccdlflags=''
566 dlsrc=''
567 ld=''
568 lddlflags=''
569 usedl=''
570 doublesize=''
571 ebcdic=''
572 fflushNULL=''
573 fflushall=''
574 fpossize=''
575 fpostype=''
576 gidformat=''
577 gidsign=''
578 gidsize=''
579 gidtype=''
580 groupstype=''
581 h_fcntl=''
582 h_sysfile=''
583 i_arpainet=''
584 db_hashtype=''
585 db_prefixtype=''
586 i_db=''
587 i_dbm=''
588 i_rpcsvcdbm=''
589 d_dirnamlen=''
590 direntrytype=''
591 i_dirent=''
592 i_dld=''
593 i_dlfcn=''
594 i_fcntl=''
595 i_float=''
596 i_gdbm=''
597 d_grpasswd=''
598 i_grp=''
599 i_inttypes=''
600 i_limits=''
601 i_locale=''
602 i_machcthr=''
603 i_malloc=''
604 i_math=''
605 i_memory=''
606 i_mntent=''
607 i_ndbm=''
608 i_netdb=''
609 i_neterrno=''
610 i_netinettcp=''
611 i_niin=''
612 i_sysin=''
613 i_poll=''
614 i_pthread=''
615 d_pwage=''
616 d_pwchange=''
617 d_pwclass=''
618 d_pwcomment=''
619 d_pwexpire=''
620 d_pwgecos=''
621 d_pwpasswd=''
622 d_pwquota=''
623 i_pwd=''
624 i_sfio=''
625 i_shadow=''
626 i_socks=''
627 i_stddef=''
628 i_stdlib=''
629 i_string=''
630 strings=''
631 i_sysaccess=''
632 i_sysdir=''
633 i_sysfile=''
634 d_voidtty=''
635 i_bsdioctl=''
636 i_sysfilio=''
637 i_sysioctl=''
638 i_syssockio=''
639 i_sysmount=''
640 i_sysndir=''
641 i_sysparam=''
642 i_sysresrc=''
643 i_syssecrt=''
644 i_sysselct=''
645 i_sysstat=''
646 i_sysstatfs=''
647 i_sysstatvfs=''
648 i_systimes=''
649 i_systypes=''
650 i_sysuio=''
651 i_sysun=''
652 i_sysvfs=''
653 i_syswait=''
654 i_sgtty=''
655 i_termio=''
656 i_termios=''
657 i_systime=''
658 i_systimek=''
659 i_time=''
660 timeincl=''
661 i_unistd=''
662 i_ustat=''
663 i_utime=''
664 i_values=''
665 i_stdarg=''
666 i_varargs=''
667 i_varhdr=''
668 i_vfork=''
669 installprefix=''
670 installprefixexp=''
671 installstyle=''
672 installusrbinperl=''
673 intsize=''
674 longsize=''
675 shortsize=''
676 d_fpos64_t=''
677 d_off64_t=''
678 libc=''
679 ldlibpthname=''
680 libperl=''
681 shrpenv=''
682 useshrplib=''
683 glibpth=''
684 libpth=''
685 loclibpth=''
686 plibpth=''
687 xlibpth=''
688 ignore_versioned_solibs=''
689 libs=''
690 lns=''
691 d_PRIEldbl=''
692 d_PRIFldbl=''
693 d_PRIGldbl=''
694 d_PRIeldbl=''
695 d_PRIfldbl=''
696 d_PRIgldbl=''
697 sPRIEldbl=''
698 sPRIFldbl=''
699 sPRIGldbl=''
700 sPRIeldbl=''
701 sPRIfldbl=''
702 sPRIgldbl=''
703 lseeksize=''
704 lseektype=''
705 make_set_make=''
706 d_mymalloc=''
707 freetype=''
708 mallocobj=''
709 mallocsrc=''
710 malloctype=''
711 usemymalloc=''
712 installman1dir=''
713 man1dir=''
714 man1direxp=''
715 man1ext=''
716 installman3dir=''
717 man3dir=''
718 man3direxp=''
719 man3ext=''
720 huge=''
721 large=''
722 medium=''
723 models=''
724 small=''
725 split=''
726 modetype=''
727 multiarch=''
728 mydomain=''
729 myhostname=''
730 phostname=''
731 c=''
732 n=''
733 d_eofnblk=''
734 eagain=''
735 o_nonblock=''
736 rd_nodata=''
737 netdb_hlen_type=''
738 netdb_host_type=''
739 netdb_name_type=''
740 netdb_net_type=''
741 groupcat=''
742 hostcat=''
743 passcat=''
744 orderlib=''
745 ranlib=''
746 package=''
747 spackage=''
748 pager=''
749 apiversion=''
750 patchlevel=''
751 subversion=''
752 version=''
753 perladmin=''
754 perlpath=''
755 i16size=''
756 i16type=''
757 i32size=''
758 i32type=''
759 i64size=''
760 i64type=''
761 i8size=''
762 i8type=''
763 ivsize=''
764 ivtype=''
765 nvsize=''
766 nvtype=''
767 u16size=''
768 u16type=''
769 u32size=''
770 u32type=''
771 u64size=''
772 u64type=''
773 u8size=''
774 u8type=''
775 uvsize=''
776 uvtype=''
777 ivdformat=''
778 uvoformat=''
779 uvuformat=''
780 uvxformat=''
781 pidtype=''
782 prefix=''
783 prefixexp=''
784 installprivlib=''
785 privlib=''
786 privlibexp=''
787 prototype=''
788 ptrsize=''
789 d_PRIX64=''
790 d_PRId64=''
791 d_PRIi64=''
792 d_PRIo64=''
793 d_PRIu64=''
794 d_PRIx64=''
795 sPRIX64=''
796 sPRId64=''
797 sPRIi64=''
798 sPRIo64=''
799 sPRIu64=''
800 sPRIx64=''
801 d_quad=''
802 quadkind=''
803 quadtype=''
804 uquadtype=''
805 drand01=''
806 randbits=''
807 randfunc=''
808 randseedtype=''
809 seedfunc=''
810 installscript=''
811 scriptdir=''
812 scriptdirexp=''
813 selectminbits=''
814 selecttype=''
815 sh=''
816 sig_count=''
817 sig_name=''
818 sig_name_init=''
819 sig_num=''
820 sig_num_init=''
821 installsitearch=''
822 sitearch=''
823 sitearchexp=''
824 installsitebin=''
825 sitebin=''
826 sitebinexp=''
827 installsitelib=''
828 sitelib=''
829 sitelibexp=''
830 siteprefix=''
831 siteprefixexp=''
832 sizetype=''
833 so=''
834 sharpbang=''
835 shsharp=''
836 spitshell=''
837 src=''
838 ssizetype=''
839 startperl=''
840 startsh=''
841 stdchar=''
842 d_stdio_stream_array=''
843 stdio_stream_array=''
844 d_strtoull=''
845 sysman=''
846 trnl=''
847 uidformat=''
848 uidsign=''
849 uidsize=''
850 uidtype=''
851 archname64=''
852 use64bits=''
853 uselargefiles=''
854 uselongdouble=''
855 uselonglong=''
856 usemorebits=''
857 usemultiplicity=''
858 nm_opt=''
859 nm_so_opt=''
860 runnm=''
861 usenm=''
862 useperlio=''
863 usesocks=''
864 d_oldpthreads=''
865 usethreads=''
866 incpath=''
867 mips_type=''
868 usrinc=''
869 d_vendorbin=''
870 installvendorbin=''
871 vendorbin=''
872 vendorbinexp=''
873 d_vendorlib=''
874 installvendorlib=''
875 vendorlib=''
876 vendorlibexp=''
877 usevendorprefix=''
878 vendorprefix=''
879 vendorprefixexp=''
880 defvoidused=''
881 voidflags=''
882 pm_apiversion=''
883 xs_apiversion=''
884 CONFIG=''
885
886 define='define'
887 undef='undef'
888 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
889 rmlist=''
890
891 : We must find out about Eunice early
892 eunicefix=':'
893 if test -f /etc/unixtovms; then
894         eunicefix=/etc/unixtovms
895 fi
896 if test -f /etc/unixtovms.exe; then
897         eunicefix=/etc/unixtovms.exe
898 fi
899
900 i_whoami=''
901 : Possible local include directories to search.
902 : Set locincpth to "" in a hint file to defeat local include searches.
903 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
904 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
905 :
906 : no include file wanted by default
907 inclwanted=''
908
909 : list of known cpp symbols, sorted alphabetically
910 al="AMIX BIT_MSF BSD BSD4_3 BSD_NET2 CMU CRAY DGUX DOLPHIN DPX2"
911 al="$al GO32 GOULD_PN HP700 I386 I80960 I960 Lynx M68000 M68K MACH"
912 al="$al MIPSEB MIPSEL MSDOS MTXINU MULTIMAX MVS"
913 al="$al M_COFF M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM"
914 al="$al M_SYS3 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX"
915 al="$al NeXT OCS88 OSF1 PARISC PC532 PORTAR POSIX"
916 al="$al PWB R3000 RES RISC6000 RT Sun386i SVR3 SVR4 SVR5"
917 al="$al SYSTYPE_BSD SYSTYPE_SVR4 SYSTYPE_SYSV Tek4132 Tek4300"
918 al="$al UMAXV USGr4 USGr4_2 UTEK UTS UTek UnicomPBB UnicomPBD Utek"
919 al="$al VMS Xenix286"
920 al="$al _AIX _AIX32 _AIX370 _AIX41 _AM29000 _COFF _CRAY _CX_UX _EPI"
921 al="$al _IBMESA _IBMR2 _M88K _M88KBCS_TARGET _POWER"
922 al="$al _MIPSEB _MIPSEL _M_COFF _M_I86 _M_I86SM _M_SYS3"
923 al="$al _M_SYS5 _M_SYSIII _M_SYSV _M_UNIX _M_XENIX _NLS _PGC_ _R3000"
924 al="$al _SYSTYPE_BSD _SYSTYPE_BSD43 _SYSTYPE_SVR4"
925 al="$al _SYSTYPE_SYSV _SYSV3 _U370 _UNICOS"
926 al="$al __386BSD__ __BIG_ENDIAN __BIG_ENDIAN__ __BSD_4_4__"
927 al="$al __DGUX__ __DPX2__ __H3050R __H3050RX"
928 al="$al __LITTLE_ENDIAN __LITTLE_ENDIAN__ __MACH__"
929 al="$al __MIPSEB __MIPSEB__ __MIPSEL __MIPSEL__"
930 al="$al __Next__ __OSF1__ __PARAGON__ __PGC__ __PWB __STDC__"
931 al="$al __SVR4_2__ __UMAXV__"
932 al="$al ____386BSD____ __alpha __alpha__ __amiga"
933 al="$al __bsd4_2 __bsd4_2__ __bsdi__ __convex__"
934 al="$al __host_mips__"
935 al="$al __hp9000s200 __hp9000s300 __hp9000s400 __hp9000s500"
936 al="$al __hp9000s500 __hp9000s700 __hp9000s800"
937 al="$al __hppa __hpux __hp_osf __i286 __i286__ __i386 __i386__"
938 al="$al __i486 __i486__ __i860 __i860__ __ibmesa __ksr1__ __linux__"
939 al="$al __m68k __m68k__ __m88100__ __m88k __m88k__"
940 al="$al __mc68000 __mc68000__ __mc68020 __mc68020__"
941 al="$al __mc68030 __mc68030__ __mc68040 __mc68040__"
942 al="$al __mc88100 __mc88100__ __mips __mips__"
943 al="$al __motorola__ __osf__ __pa_risc __sparc__ __stdc__"
944 al="$al __sun __sun__ __svr3__ __svr4__ __ultrix __ultrix__"
945 al="$al __unix __unix__ __uxpm__ __uxps__ __vax __vax__"
946 al="$al _host_mips _mips _unix"
947 al="$al a29k aegis aix aixpc alliant alpha am29000 amiga ansi ardent"
948 al="$al apollo ardent att386 att3b"
949 al="$al bsd bsd43 bsd4_2 bsd4_3 bsd4_4 bsdi bull"
950 al="$al cadmus clipper concurrent convex cray ctix"
951 al="$al dmert encore gcos gcx gimpel gould"
952 al="$al hbullx20 hcx host_mips hp200 hp300 hp700 hp800"
953 al="$al hp9000 hp9000s300 hp9000s400 hp9000s500"
954 al="$al hp9000s700 hp9000s800 hp9k8 hppa hpux"
955 al="$al i186 i286 i386 i486 i8086"
956 al="$al i80960 i860 iAPX286 ibm ibm032 ibmrt interdata is68k"
957 al="$al ksr1 linux luna luna88k m68k m88100 m88k"
958 al="$al mc300 mc500 mc68000 mc68010 mc68020 mc68030"
959 al="$al mc68040 mc68060 mc68k mc68k32 mc700"
960 al="$al mc88000 mc88100 merlin mert mips mvs n16"
961 al="$al ncl_el ncl_mr"
962 al="$al news1500 news1700 news1800 news1900 news3700"
963 al="$al news700 news800 news900 ns16000 ns32000"
964 al="$al ns32016 ns32332 ns32k nsc32000 os osf"
965 al="$al parisc pc532 pdp11 plexus posix pyr"
966 al="$al riscix riscos scs sequent sgi sinix sony sony_news"
967 al="$al sonyrisc sparc sparclite spectrum stardent stratos"
968 al="$al sun sun3 sun386 svr4 sysV68 sysV88"
969 al="$al titan tower tower32 tower32_200 tower32_600 tower32_700"
970 al="$al tower32_800 tower32_850 tss u370 u3b u3b2 u3b20 u3b200"
971 al="$al u3b20d u3b5 ultrix unix unixpc unos vax venix vms"
972 al="$al xenix z8000"
973
974 : Trailing extension.  Override this in a hint file, if needed.
975 _exe=''
976 : Extra object files, if any, needed on this platform.
977 archobjs=''
978 groupstype=''
979 : change the next line if compiling for Xenix/286 on Xenix/386
980 xlibpth='/usr/lib/386 /lib/386'
981
982 : Possible local library directories to search.
983 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
984 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
985
986 : general looking path for locating libraries
987 glibpth="/shlib /usr/shlib /lib/pa1.1 /usr/lib/large"
988 glibpth="$glibpth /lib /usr/lib $xlibpth"
989 glibpth="$glibpth /lib/large /usr/lib/small /lib/small"
990 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
991
992 : Private path used by Configure to find libraries.  Its value
993 : is prepended to libpth. This variable takes care of special
994 : machines, like the mips.  Usually, it should be empty.
995 plibpth=''
996
997 : default library list
998 libswanted=''
999 : some systems want to use only the non-versioned libso:s
1000 ignore_versioned_solibs=''
1001 : full support for void wanted by default
1002 defvoidused=15
1003
1004 : set useposix=false in your hint file to disable the POSIX extension.
1005 useposix=true
1006 : set useopcode=false in your hint file to disable the Opcode extension.
1007 useopcode=true
1008 : set usemultiplicity on the Configure command line to enable multiplicity.
1009 : set usesocks on the Configure command line to enable socks.
1010 : set usethreads on the Configure command line to enable threads.
1011 : List of libraries we want.
1012 : If anyone needs -lnet, put it in a hint file.
1013 libswanted='sfio socket inet nsl nm ndbm gdbm dbm db malloc dl'
1014 libswanted="$libswanted dld ld sun m c cposix posix"
1015 libswanted="$libswanted ndir dir crypt sec"
1016 libswanted="$libswanted ucb bsd BSD PW x"
1017 : We probably want to search /usr/shlib before most other libraries.
1018 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1019 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1020 glibpth="/usr/shlib $glibpth"
1021 : Do not use vfork unless overridden by a hint file.
1022 usevfork=false
1023
1024 : Find the basic shell for Bourne shell scripts
1025 case "$sh" in
1026 '')
1027         case "$SYSTYPE" in
1028         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1029         *) xxx='/bin/sh';;
1030         esac
1031         if test -f "$xxx"; then
1032                 sh="$xxx"
1033         else
1034                 : Build up a list and do a single loop so we can 'break' out.
1035                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1036                 for xxx in sh bash ksh pdksh ash; do
1037                         for p in $pth; do
1038                                 try="$try ${p}/${xxx}"
1039                         done
1040                 done
1041                 for xxx in $try; do
1042                         if test -f "$xxx"; then
1043                                 sh="$xxx";
1044                                 break
1045                         elif test -f "$xxx.exe"; then
1046                                 sh="$xxx";
1047                                 break
1048                         fi
1049                 done
1050         fi
1051         ;;
1052 esac
1053
1054 case "$sh" in
1055 '')     cat <<EOM >&2
1056 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
1057
1058 Usually it's in /bin/sh.  How did you even get this far?
1059 Please contact me (Perl Maintainers) at perlbug@perl.com and 
1060 we'll try to straighten this all out.
1061 EOM
1062         exit 1
1063         ;;
1064 esac
1065
1066 : see if sh knows # comments
1067 if `$sh -c '#' >/dev/null 2>&1`; then
1068         shsharp=true
1069         spitshell=cat
1070         xcat=/bin/cat
1071         test -f $xcat || xcat=/usr/bin/cat
1072         echo "#!$xcat" >try
1073         $eunicefix try
1074         chmod +x try
1075         ./try > today
1076         if test -s today; then
1077                 sharpbang='#!'
1078         else
1079                 echo "#! $xcat" > try
1080                 $eunicefix try
1081                 chmod +x try
1082                 ./try > today
1083                 if test -s today; then
1084                         sharpbang='#! '
1085                 else
1086                         sharpbang=': use '
1087                 fi
1088         fi
1089 else
1090         echo " "
1091         echo "Your $sh doesn't grok # comments--I will strip them later on."
1092         shsharp=false
1093         cd ..
1094         echo "exec grep -v '^[  ]*#'" >spitshell
1095         chmod +x spitshell
1096         $eunicefix spitshell
1097         spitshell=`pwd`/spitshell
1098         cd UU
1099         echo "I presume that if # doesn't work, #! won't work either!"
1100         sharpbang=': use '
1101 fi
1102 rm -f try today
1103
1104 : figure out how to guarantee sh startup
1105 case "$startsh" in
1106 '') startsh=${sharpbang}${sh} ;;
1107 *)
1108 esac
1109 cat >try <<EOSS
1110 $startsh
1111 set abc
1112 test "$?abc" != 1
1113 EOSS
1114
1115 chmod +x try
1116 $eunicefix try
1117 if ./try; then
1118         : echo "Yup, it does."
1119 else
1120         echo "Hmm... '$startsh' does not guarantee sh startup..."
1121         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1122 fi
1123 rm -f try
1124
1125
1126 : Save command line options in file UU/cmdline.opt for later use in
1127 : generating config.sh.
1128 cat > cmdline.opt <<EOSH
1129 # Configure command line arguments.
1130 config_arg0='$0'
1131 config_args='$*'
1132 config_argc=$#
1133 EOSH
1134 argn=1
1135 for arg in "$@"; do
1136         cat >>cmdline.opt <<EOSH
1137 config_arg$argn='$arg'
1138 EOSH
1139         argn=`expr $argn + 1`
1140 done
1141
1142 : produce awk script to parse command line options
1143 cat >options.awk <<'EOF'
1144 BEGIN {
1145         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1146
1147         len = length(optstr);
1148         for (i = 1; i <= len; i++) {
1149                 c = substr(optstr, i, 1);
1150                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1151                 if (a == ":") {
1152                         arg[c] = 1;
1153                         i++;
1154                 }
1155                 opt[c] = 1;
1156         }
1157 }
1158 {
1159         expect = 0;
1160         str = $0;
1161         if (substr(str, 1, 1) != "-") {
1162                 printf("'%s'\n", str);
1163                 next;
1164         }
1165         len = length($0);
1166         for (i = 2; i <= len; i++) {
1167                 c = substr(str, i, 1);
1168                 if (!opt[c]) {
1169                         printf("-%s\n", substr(str, i));
1170                         next;
1171                 }
1172                 printf("-%s\n", c);
1173                 if (arg[c]) {
1174                         if (i < len)
1175                                 printf("'%s'\n", substr(str, i + 1));
1176                         else
1177                                 expect = 1;
1178                         next;
1179                 }
1180         }
1181 }
1182 END {
1183         if (expect)
1184                 print "?";
1185 }
1186 EOF
1187
1188 : process the command line options
1189 set X `for arg in "$@"; do echo "X$arg"; done |
1190         sed -e s/X// | awk -f options.awk`
1191 eval "set $*"
1192 shift
1193 rm -f options.awk
1194
1195 : set up default values
1196 fastread=''
1197 reuseval=false
1198 config_sh=''
1199 alldone=''
1200 error=''
1201 silent=''
1202 extractsh=''
1203 override=''
1204 knowitall=''
1205 rm -f optdef.sh posthint.sh
1206 cat >optdef.sh <<EOS
1207 $startsh
1208 EOS
1209
1210
1211 : option parsing
1212 while test $# -gt 0; do
1213         case "$1" in
1214         -d) shift; fastread=yes;;
1215         -e) shift; alldone=cont;;
1216         -f)
1217                 shift
1218                 cd ..
1219                 if test -r "$1"; then
1220                         config_sh="$1"
1221                 else
1222                         echo "$me: cannot read config file $1." >&2
1223                         error=true
1224                 fi
1225                 cd UU
1226                 shift;;
1227         -h) shift; error=true;;
1228         -r) shift; reuseval=true;;
1229         -s) shift; silent=true; realsilent=true;;
1230         -E) shift; alldone=exit;;
1231         -K) shift; knowitall=true;;
1232         -O) shift; override=true;;
1233         -S) shift; silent=true; extractsh=true;;
1234         -D)
1235                 shift
1236                 case "$1" in
1237                 *=)
1238                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1239                         echo "$me: ignoring -D $1" >&2
1240                         ;;
1241                 *=*) echo "$1" | \
1242                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1243                 *) echo "$1='define'" >> optdef.sh;;
1244                 esac
1245                 shift
1246                 ;;
1247         -U)
1248                 shift
1249                 case "$1" in
1250                 *=) echo "$1" >> optdef.sh;;
1251                 *=*)
1252                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1253                         echo "$me: ignoring -U $1" >&2
1254                         ;;
1255                 *) echo "$1='undef'" >> optdef.sh;;
1256                 esac
1257                 shift
1258                 ;;
1259         -A)
1260             shift
1261             xxx=''
1262             yyy="$1"
1263             zzz=''
1264             uuu=undef
1265             case "$yyy" in
1266             *=*) zzz=`echo $yyy|sed 's!=.*!!'`
1267                  case "$zzz" in
1268                  *:*) zzz='' ;;
1269                  *)   xxx=append
1270                       zzz=" "`echo $yyy|sed 's!^[^=]*=!!'` 
1271                       yyy=`echo $yyy|sed 's!=.*!!'` ;;
1272                  esac
1273                  ;;
1274             esac
1275             case "$xxx" in
1276             '')  case "$yyy" in
1277                  *:*) xxx=`echo $yyy|sed 's!:.*!!'`
1278                       yyy=`echo $yyy|sed 's!^[^:]*:!!'`
1279                       zzz=`echo $yyy|sed 's!^[^=]*=!!'`
1280                       yyy=`echo $yyy|sed 's!=.*!!'` ;;
1281                  *)   xxx=`echo $yyy|sed 's!:.*!!'`
1282                       yyy=`echo $yyy|sed 's!^[^:]*:!!'` ;;
1283                  esac
1284                  ;;       
1285             esac
1286             case "$xxx" in
1287             append)
1288                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1289             clear)
1290                 echo "$yyy=''"                  >> posthint.sh ;;
1291             define)
1292                 case "$zzz" in
1293                 '') zzz=define ;;
1294                 esac
1295                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1296             eval)
1297                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1298             prepend)
1299                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1300             undef)
1301                 case "$zzz" in
1302                 '') zzz="$uuu" ;;
1303                 esac
1304                 echo "$yyy=$zzz"                >> posthint.sh ;;
1305             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1306             esac
1307             ;;
1308         -V) echo "$me generated by metaconfig 3.0 PL70." >&2
1309             exit 0;;
1310         --) break;;
1311         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1312         *) break;;
1313         esac
1314 done
1315
1316 case "$error" in
1317 true)
1318         cat >&2 <<EOM
1319 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1320                  [-U symbol] [-U symbol=] [-A command:symbol...]
1321   -d : use defaults for all answers.
1322   -e : go on without questioning past the production of config.sh.
1323   -f : specify an alternate default configuration file.
1324   -h : print this help message and exit (with an error status).
1325   -r : reuse C symbols value if possible (skips costly nm extraction).
1326   -s : silent mode, only echoes questions and essential information.
1327   -D : define symbol to have some value:
1328          -D symbol         symbol gets the value 'define'
1329          -D symbol=value   symbol gets the value 'value'
1330   -E : stop at the end of questions, after having produced config.sh.
1331   -K : do not use unless you know what you are doing.
1332   -O : let -D and -U override definitions from loaded configuration file.
1333   -S : perform variable substitutions on all .SH files (can mix with -f)
1334   -U : undefine symbol:
1335          -U symbol    symbol gets the value 'undef'
1336          -U symbol=   symbol gets completely empty
1337   -A : manipulate symbol after the platform specific hints have been applied:
1338          -A symbol=value                append " "value to symbol
1339          -A append:symbol=value         append value to symbol
1340          -A define:symbol=value         define symbol to have value
1341          -A clear:symbol                define symbol to be ''
1342          -A define:symbol               define symbol to be 'define'
1343          -A eval:symbol=value           define symbol to be eval of value
1344          -A prepend:symbol=value        prepend value to symbol
1345          -A undef:symbol                define symbol to be 'undef'
1346          -A undef:symbol=               define symbol to be ''
1347   -V : print version number and exit (with a zero status).
1348 EOM
1349         exit 1
1350         ;;
1351 esac
1352
1353 : Sanity checks
1354 case "$fastread$alldone" in
1355 yescont|yesexit) ;;
1356 *)
1357         if test ! -t 0; then
1358                 echo "Say 'sh Configure', not 'sh <Configure'"
1359                 exit 1
1360         fi
1361         ;;
1362 esac
1363
1364 exec 4>&1
1365 case "$silent" in
1366 true) exec 1>/dev/null;;
1367 esac
1368
1369 : run the defines and the undefines, if any, but leave the file out there...
1370 touch optdef.sh
1371 . ./optdef.sh
1372 : create the posthint manipulation script and leave the file out there...
1373 touch posthint.sh
1374
1375 : set package name
1376 package=perl5
1377 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1378 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1379 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1380 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1381 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1382 esac
1383
1384 : Some greps do not return status, grrr.
1385 echo "grimblepritz" >grimble
1386 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1387         contains=contains
1388 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1389         contains=grep
1390 else
1391         contains=contains
1392 fi
1393 rm -f grimble
1394 : the following should work in any shell
1395 case "$contains" in
1396 contains*)
1397         echo " "
1398         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1399         cat >contains <<'EOSS'
1400 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1401 EOSS
1402 chmod +x contains
1403 esac
1404
1405 : Find the path to the source tree
1406 case "$src" in
1407 '') case "$0" in
1408     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1409          case "$src" in
1410          /*)    ;;
1411          *)     src=`cd ../$src && pwd` ;;
1412          esac
1413          ;;
1414     *)   src='.';;
1415     esac;;
1416 esac
1417 case "$src" in
1418 '')     src=/
1419         rsrc=/
1420         ;;
1421 /*) rsrc="$src";;
1422 *) rsrc="../$src";;
1423 esac
1424 if test -f $rsrc/Configure && \
1425         $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1426 then
1427    : found it, so we are ok.
1428 else
1429         rsrc=''
1430         for src in . .. ../.. ../../.. ../../../..; do
1431                 if test -f ../$src/Configure && \
1432                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1433                 then
1434                         rsrc=../$src
1435                         break
1436                 fi
1437         done
1438 fi
1439 case "$rsrc" in
1440 '')
1441         cat <<EOM >&4
1442
1443 Sorry, I can't seem to locate the source dir for $package.  Please start
1444 Configure with an explicit path -- i.e. /some/path/Configure.
1445
1446 EOM
1447         exit 1
1448         ;;
1449 ../.)   rsrc='..';;
1450 *)
1451         echo " "
1452         echo "Sources for $package found in \"$src\"." >&4
1453         ;;
1454 esac
1455
1456 : script used to extract .SH files with variable substitutions
1457 cat >extract <<'EOS'
1458 CONFIGDOTSH=true
1459 echo "Doing variable substitutions on .SH files..."
1460 if test -f $src/MANIFEST; then
1461         set x `awk '{print $1}' <$src/MANIFEST | grep '\.SH$'`
1462 else
1463         echo "(Looking for .SH files under the source directory.)"
1464         set x `(cd $src; find . -name "*.SH" -print)`
1465 fi
1466 shift
1467 case $# in
1468 0) set x `(cd $src; echo *.SH)`; shift;;
1469 esac
1470 if test ! -f $src/$1; then
1471         shift
1472 fi
1473 mkdir_p='
1474 name=$1;
1475 create="";
1476 while test $name; do
1477         if test ! -d "$name"; then
1478                 create="$name $create";
1479                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1480                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1481         else
1482                 name="";
1483         fi;
1484 done;
1485 for file in $create; do
1486         mkdir $file;
1487 done
1488 '
1489 for file in $*; do
1490         case "$src" in
1491         ".")
1492                 case "$file" in
1493                 */*)
1494                         dir=`expr X$file : 'X\(.*\)/'`
1495                         file=`expr X$file : 'X.*/\(.*\)'`
1496                         (cd $dir && . ./$file)
1497                         ;;
1498                 *)
1499                         . ./$file
1500                         ;;
1501                 esac
1502                 ;;
1503         *)
1504                 case "$file" in
1505                 */*)
1506                         dir=`expr X$file : 'X\(.*\)/'`
1507                         file=`expr X$file : 'X.*/\(.*\)'`
1508                         (set x $dir; shift; eval $mkdir_p)
1509                         sh <$src/$dir/$file
1510                         ;;
1511                 *)
1512                         sh <$src/$file
1513                         ;;
1514                 esac
1515                 ;;
1516         esac
1517 done
1518 if test -f $src/config_h.SH; then
1519         if test ! -f config.h; then
1520         : oops, they left it out of MANIFEST, probably, so do it anyway.
1521         . $src/config_h.SH
1522         fi
1523 fi
1524 EOS
1525
1526 : extract files and exit if asked to do so
1527 case "$extractsh" in
1528 true)
1529         case "$realsilent" in
1530         true) ;;
1531         *) exec 1>&4;;
1532         esac
1533         case "$config_sh" in
1534         '') config_sh='config.sh';;
1535         esac
1536         echo " "
1537         echo "Fetching answers from $config_sh..."
1538         cd ..
1539         . $config_sh
1540         test "$override" && . ./optdef.sh
1541         echo " "
1542         . UU/extract
1543         rm -rf UU
1544         echo "Done."
1545         exit 0
1546         ;;
1547 esac
1548
1549 : Eunice requires " " instead of "", can you believe it
1550 echo " "
1551 : Here we go...
1552 echo "Beginning of configuration questions for $package."
1553
1554 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1555
1556 : first determine how to suppress newline on echo command
1557 echo " "
1558 echo "Checking echo to see how to suppress newlines..."
1559 (echo "hi there\c" ; echo " ") >.echotmp
1560 if $contains c .echotmp >/dev/null 2>&1 ; then
1561         echo "...using -n."
1562         n='-n'
1563         c=''
1564 else
1565         cat <<'EOM'
1566 ...using \c
1567 EOM
1568         n=''
1569         c='\c'
1570 fi
1571 echo $n "The star should be here-->$c"
1572 echo '*'
1573 rm -f .echotmp
1574
1575 : Now test for existence of everything in MANIFEST
1576 echo " "
1577 if test -f $rsrc/MANIFEST; then
1578         echo "First let's make sure your kit is complete.  Checking..." >&4
1579         awk '$1 !~ /PACK[A-Z]+/ {print $1}' $rsrc/MANIFEST | split -50
1580         rm -f missing
1581         tmppwd=`pwd`
1582         for filelist in x??; do
1583                 (cd $rsrc; ls `cat $tmppwd/$filelist` >/dev/null 2>>$tmppwd/missing)
1584         done
1585         if test -s missing; then
1586                 cat missing >&4
1587                 cat >&4 <<'EOM'
1588
1589 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1590
1591 You have the option of continuing the configuration process, despite the
1592 distinct possibility that your kit is damaged, by typing 'y'es.  If you
1593 do, don't blame me if something goes wrong.  I advise you to type 'n'o
1594 and contact the author (perlbug@perl.com).
1595
1596 EOM
1597                 echo $n "Continue? [n] $c" >&4
1598                 read ans
1599                 case "$ans" in
1600                 y*)
1601                         echo "Continuing..." >&4
1602                         rm -f missing
1603                         ;;
1604                 *)
1605                         echo "ABORTING..." >&4
1606                         kill $$
1607                         ;;
1608                 esac
1609         else
1610                 echo "Looks good..."
1611         fi
1612 else
1613         echo "There is no MANIFEST file.  I hope your kit is complete !"
1614 fi
1615 rm -f missing x??
1616
1617 echo " "
1618 : Find the appropriate value for a newline for tr
1619 if test -n "$DJGPP"; then
1620        trnl='\012'
1621 fi
1622 if test X"$trnl" = X; then
1623         case "`echo foo|tr '\n' x 2>/dev/null`" in
1624         foox) trnl='\n' ;;
1625         esac
1626 fi
1627 if test X"$trnl" = X; then
1628         case "`echo foo|tr '\012' x 2>/dev/null`" in
1629         foox) trnl='\012' ;;
1630         esac
1631 fi
1632 if test X"$trnl" = X; then
1633         cat <<EOM >&2
1634
1635 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
1636
1637 EOM
1638         exit 1
1639 fi
1640
1641 : compute the number of columns on the terminal for proper question formatting
1642 case "$COLUMNS" in
1643 '') COLUMNS='80';;
1644 esac
1645
1646 : set up the echo used in my read
1647 myecho="case \"\$xxxm\" in
1648 '') echo $n \"\$rp $c\" >&4;;
1649 *) case \"\$rp\" in
1650         '') echo $n \"[\$xxxm] $c\";;
1651         *)
1652                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
1653                         echo \"\$rp\" >&4
1654                         echo $n \"[\$xxxm] $c\" >&4
1655                 else
1656                         echo $n \"\$rp [\$xxxm] $c\" >&4
1657                 fi
1658                 ;;
1659         esac;;
1660 esac"
1661
1662 : now set up to do reads with possible shell escape and default assignment
1663 cat <<EOSC >myread
1664 $startsh
1665 xxxm=\$dflt
1666 $myecho
1667 ans='!'
1668 case "\$fastread" in
1669 yes) case "\$dflt" in
1670         '') ;;
1671         *) ans='';
1672                 case "\$silent-\$rp" in
1673                 true-) ;;
1674                 *) echo " " >&4;;
1675                 esac;;
1676         esac;;
1677 *) case "\$silent" in
1678         true) case "\$rp" in
1679                 '') ans='';;
1680                 esac;;
1681         esac;;
1682 esac
1683 while expr "X\$ans" : "X!" >/dev/null; do
1684         read answ
1685         set x \$xxxm
1686         shift
1687         aok=''; eval "ans=\\"\$answ\\"" && aok=y
1688         case  "\$answ" in
1689         "!")
1690                 sh 1>&4
1691                 echo " "
1692                 $myecho
1693                 ;;
1694         !*)
1695                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
1696                 shift
1697                 sh 1>&4 -c "\$*"
1698                 echo " "
1699                 $myecho
1700                 ;;
1701         "\$ans")
1702                 case "\$ans" in
1703                 \\&*)
1704                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
1705                         shift
1706                         case "\$1" in
1707                         -d)
1708                                 fastread=yes
1709                                 echo "(OK, I'll run with -d after this question.)" >&4
1710                                 ;;
1711                         -*)
1712                                 echo "*** Sorry, \$1 not supported yet." >&4
1713                                 ;;
1714                         esac
1715                         $myecho
1716                         ans=!
1717                         ;;
1718                 esac;;
1719         *)
1720                 case "\$aok" in
1721                 y)
1722                         echo "*** Substitution done -- please confirm."
1723                         xxxm="\$ans"
1724                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
1725                         xxxm="\$ans"
1726                         ans=!
1727                         ;;
1728                 *)
1729                         echo "*** Error -- try again."
1730                         ans=!
1731                         ;;
1732                 esac
1733                 $myecho
1734                 ;;
1735         esac
1736         case "\$ans\$xxxm\$nostick" in
1737         '')
1738                 ans=!
1739                 $myecho
1740                 ;;
1741         esac
1742 done
1743 case "\$ans" in
1744 '') ans="\$xxxm";;
1745 esac
1746 EOSC
1747
1748 : create .config dir to save info across Configure sessions
1749 test -d ../.config || mkdir ../.config
1750 cat >../.config/README <<EOF
1751 This directory created by Configure to save information that should
1752 persist across sessions for $package.
1753
1754 You may safely delete it if you wish.
1755 EOF
1756
1757 : general instructions
1758 needman=true
1759 firsttime=true
1760 user=`(logname) 2>/dev/null`
1761 case "$user" in
1762 '') user=`whoami 2>&1`;;
1763 esac
1764 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
1765         firsttime=false
1766         echo " "
1767         rp='Would you like to see the instructions?'
1768         dflt=n
1769         . ./myread
1770         case "$ans" in
1771         [yY]*) ;;
1772         *) needman=false;;
1773         esac
1774 fi
1775 if $needman; then
1776         cat <<EOH
1777
1778 This installation shell script will examine your system and ask you questions
1779 to determine how the perl5 package should be installed. If you get
1780 stuck on a question, you may use a ! shell escape to start a subshell or
1781 execute a command.  Many of the questions will have default answers in square
1782 brackets; typing carriage return will give you the default.
1783
1784 On some of the questions which ask for file or directory names you are allowed
1785 to use the ~name construct to specify the login directory belonging to "name",
1786 even if you don't have a shell which knows about that.  Questions where this is
1787 allowed will be marked "(~name ok)".
1788
1789 EOH
1790         rp=''
1791         dflt='Type carriage return to continue'
1792         . ./myread
1793         cat <<'EOH'
1794
1795 The prompter used in this script allows you to use shell variables and
1796 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
1797 in the default answer, as if the default line was a set of arguments given to a
1798 script shell.  This means you may also use $* to repeat the whole default line,
1799 so you do not have to re-type everything to add something to the default.
1800
1801 Everytime there is a substitution, you will have to confirm.  If there is an
1802 error (e.g. an unmatched backtick), the default answer will remain unchanged
1803 and you will be prompted again.
1804
1805 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
1806 the questions and use the computed defaults (or the previous answers if there
1807 was already a config.sh file). Type 'Configure -h' for a list of options.
1808 You may also start interactively and then answer '& -d' at any prompt to turn
1809 on the non-interactive behaviour for the remainder of the execution.
1810
1811 EOH
1812         . ./myread
1813         cat <<EOH
1814
1815 Much effort has been expended to ensure that this shell script will run on any
1816 Unix system.  If despite that it blows up on yours, your best bet is to edit
1817 Configure and run it again.  If you can't run Configure for some reason,
1818 you'll have to generate a config.sh file by hand.  Whatever problems you
1819 have, let me (perlbug@perl.com) know how I blew it.
1820
1821 This installation script affects things in two ways:
1822
1823 1) it may do direct variable substitutions on some of the files included
1824    in this kit.
1825 2) it builds a config.h file for inclusion in C programs.  You may edit
1826    any of these files as the need arises after running this script.
1827
1828 If you make a mistake on a question, there is no easy way to back up to it
1829 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
1830 files.  Configure will offer to let you do this before it runs the SH files.
1831
1832 EOH
1833         dflt='Type carriage return to continue'
1834         . ./myread
1835         case "$firsttime" in
1836         true) echo $user >>../.config/instruct;;
1837         esac
1838 fi
1839
1840 : find out where common programs are
1841 echo " "
1842 echo "Locating common programs..." >&4
1843 cat <<EOSC >loc
1844 $startsh
1845 case \$# in
1846 0) exit 1;;
1847 esac
1848 thing=\$1
1849 shift
1850 dflt=\$1
1851 shift
1852 for dir in \$*; do
1853         case "\$thing" in
1854         .)
1855         if test -d \$dir/\$thing; then
1856                 echo \$dir
1857                 exit 0
1858         fi
1859         ;;
1860         *)
1861         for thisthing in \$dir/\$thing; do
1862                 : just loop through to pick last item
1863         done
1864         if test -f \$thisthing; then
1865                 echo \$thisthing
1866                 exit 0
1867         elif test -f \$dir/\$thing.exe; then
1868                 if test -n "$DJGPP"; then
1869                         echo \$dir/\$thing.exe
1870                 else
1871                         : on Eunice apparently
1872                         echo \$dir/\$thing
1873                 fi
1874                 exit 0
1875         fi
1876         ;;
1877         esac
1878 done
1879 echo \$dflt
1880 exit 1
1881 EOSC
1882 chmod +x loc
1883 $eunicefix loc
1884 loclist="
1885 awk
1886 cat
1887 comm
1888 cp
1889 echo
1890 expr
1891 grep
1892 ls
1893 make
1894 mkdir
1895 rm
1896 sed
1897 sort
1898 touch
1899 tr
1900 uniq
1901 "
1902 trylist="
1903 Mcc
1904 ar
1905 byacc
1906 cpp
1907 csh
1908 date
1909 egrep
1910 gzip
1911 less
1912 ln
1913 more
1914 nm
1915 nroff
1916 pg
1917 test
1918 uname
1919 zip
1920 "
1921 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1922 pth="$pth /lib /usr/lib"
1923 for file in $loclist; do
1924         eval xxx=\$$file
1925         case "$xxx" in
1926         /*|?:[\\/]*)
1927                 if test -f "$xxx"; then
1928                         : ok
1929                 else
1930                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
1931                         xxx=`./loc $file $file $pth`
1932                 fi
1933                 ;;
1934         '') xxx=`./loc $file $file $pth`;;
1935         *) xxx=`./loc $xxx $xxx $pth`;;
1936         esac
1937         eval $file=$xxx
1938         eval _$file=$xxx
1939         case "$xxx" in
1940         /*)
1941                 echo $file is in $xxx.
1942                 ;;
1943         ?:[\\/]*)
1944                 echo $file is in $xxx.
1945                 ;;
1946         *)
1947                 echo "I don't know where '$file' is, and my life depends on it." >&4
1948                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
1949                 exit 1
1950                 ;;
1951         esac
1952 done
1953 echo " "
1954 echo "Don't worry if any of the following aren't found..."
1955 say=offhand
1956 for file in $trylist; do
1957         eval xxx=\$$file
1958         case "$xxx" in
1959         /*|?:[\\/]*)
1960                 if test -f "$xxx"; then
1961                         : ok
1962                 else
1963                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
1964                         xxx=`./loc $file $file $pth`
1965                 fi
1966                 ;;
1967         '') xxx=`./loc $file $file $pth`;;
1968         *) xxx=`./loc $xxx $xxx $pth`;;
1969         esac
1970         eval $file=$xxx
1971         eval _$file=$xxx
1972         case "$xxx" in
1973         /*)
1974                 echo $file is in $xxx.
1975                 ;;
1976         ?:[\\/]*)
1977                 echo $file is in $xxx.
1978                 ;;
1979         *)
1980                 echo "I don't see $file out there, $say."
1981                 say=either
1982                 ;;
1983         esac
1984 done
1985 case "$egrep" in
1986 egrep)
1987         echo "Substituting grep for egrep."
1988         egrep=$grep
1989         ;;
1990 esac
1991 case "$ln" in
1992 ln)
1993         echo "Substituting cp for ln."
1994         ln=$cp
1995         ;;
1996 esac
1997 case "$test" in
1998 test)
1999         echo "Hopefully test is built into your sh."
2000         ;;
2001 *)
2002         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2003                 echo "Using the test built into your sh."
2004                 test=test
2005                 _test=test
2006         fi
2007         ;;
2008 esac
2009 case "$echo" in
2010 echo)
2011         echo "Hopefully echo is built into your sh."
2012         ;;
2013 '') ;;
2014 *)
2015         echo " "
2016 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2017         $echo $n "hi there$c" >foo1
2018         echo $n "hi there$c" >foo2
2019         if cmp foo1 foo2 >/dev/null 2>&1; then
2020                 echo "They are compatible.  In fact, they may be identical."
2021         else
2022                 case "$n" in
2023                 '-n') n='' c='\c';;
2024                 *) n='-n' c='';;
2025                 esac
2026                 cat <<FOO
2027 They are not compatible!  You are probably running ksh on a non-USG system.
2028 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2029 have echo built in and we may have to run some Bourne shell scripts.  That
2030 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2031
2032 FOO
2033                 $echo $n "The star should be here-->$c"
2034                 $echo "*"
2035         fi
2036         $rm -f foo1 foo2
2037         ;;
2038 esac
2039
2040 : determine whether symbolic links are supported
2041 echo " "
2042 $touch blurfl
2043 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2044         echo "Symbolic links are supported." >&4
2045         lns="$ln -s"
2046 else
2047         echo "Symbolic links are NOT supported." >&4
2048         lns="$ln"
2049 fi
2050 $rm -f blurfl sym
2051
2052 : see whether [:lower:] and [:upper:] are supported character classes
2053 echo " "
2054 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2055 ABYZ)
2056         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2057         up='[:upper:]'
2058         low='[:lower:]'
2059         ;;
2060 *)      # There is a discontinuity in EBCDIC between 'I' and 'J'
2061         # (0xc9 and 0xd1), therefore that is a nice testing point.
2062         if test "X$up" = X -o "X$low" = X; then
2063             case "`echo IJ | $tr '[I-J]' '[i-j]' 2>/dev/null`" in
2064             ij) up='[A-Z]'
2065                 low='[a-z]'
2066                 ;;
2067             esac
2068         fi
2069         if test "X$up" = X -o "X$low" = X; then
2070             case "`echo IJ | $tr I-J i-j 2>/dev/null`" in
2071             ij) up='A-Z'
2072                 low='a-z'
2073                 ;;
2074             esac
2075         fi
2076         if test "X$up" = X -o "X$low" = X; then
2077             case "`echo IJ | od -x 2>/dev/null`" in
2078             *C9D1*|*c9d1*)
2079                 echo "Hey, this might be EBCDIC." >&4
2080                 if test "X$up" = X -o "X$low" = X; then
2081                     case "`echo IJ | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
2082                     ij) up='[A-IJ-RS-Z]'
2083                         low='[a-ij-rs-z]'
2084                         ;;
2085                     esac
2086                 fi
2087                 if test "X$up" = X -o "X$low" = X; then
2088                     case "`echo IJ | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
2089                     ij) up='A-IJ-RS-Z'
2090                         low='a-ij-rs-z'
2091                         ;;
2092                     esac
2093                 fi
2094                 ;;
2095             esac
2096         fi
2097 esac
2098 case "`echo IJ | $tr \"$up\" \"$low\" 2>/dev/null`" in
2099 ij)
2100     echo "Using $up and $low to convert case." >&4
2101     ;;
2102 *)
2103     echo "I don't know how to translate letters from upper to lower case." >&4
2104     echo "Your tr is not acting any way I know of." >&4
2105     exit 1
2106     ;;
2107 esac
2108 : set up the translation script tr, must be called with ./tr of course
2109 cat >tr <<EOSC
2110 $startsh
2111 case "\$1\$2" in
2112 '[A-Z][a-z]') exec $tr '$up' '$low';;
2113 '[a-z][A-Z]') exec $tr '$low' '$up';;
2114 esac
2115 exec $tr "\$@"
2116 EOSC
2117 chmod +x tr
2118 $eunicefix tr
2119
2120 : Try to determine whether config.sh was made on this system
2121 case "$config_sh" in
2122 '')
2123 myuname=`( ($uname -a) 2>/dev/null || hostname) 2>&1`
2124 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
2125 # because the A-Z/a-z are not consecutive.
2126 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
2127         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
2128 newmyuname="$myuname"
2129 dflt=n
2130 case "$knowitall" in
2131 '')
2132         if test -f ../config.sh; then
2133                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
2134                         eval "`grep myuname= ../config.sh`"
2135                 fi
2136                 if test "X$myuname" = "X$newmyuname"; then
2137                         dflt=y
2138                 fi
2139         fi
2140         ;;
2141 *) dflt=y;;
2142 esac
2143
2144 : Get old answers from old config file if Configure was run on the
2145 : same system, otherwise use the hints.
2146 hint=default
2147 cd ..
2148 if test -f config.sh; then
2149         echo " "
2150         rp="I see a config.sh file.  Shall I use it to set the defaults?"
2151         . UU/myread
2152         case "$ans" in
2153         n*|N*) echo "OK, I'll ignore it."; mv config.sh config.sh.old;;
2154         *)  echo "Fetching default answers from your old config.sh file..." >&4
2155                 tmp_n="$n"
2156                 tmp_c="$c"
2157                 tmp_sh="$sh"
2158                 . ./config.sh
2159                 cp config.sh UU
2160                 n="$tmp_n"
2161                 c="$tmp_c"
2162                 : Older versions did not always set $sh.  Catch re-use of such
2163                 : an old config.sh.
2164                 case "$sh" in
2165                 '') sh="$tmp_sh" ;;
2166                 esac
2167                 hint=previous
2168                 ;;
2169         esac
2170 fi
2171 if test ! -f config.sh; then
2172         $cat <<EOM
2173
2174 First time through, eh?  I have some defaults handy for some systems
2175 that need some extra help getting the Configure answers right:
2176
2177 EOM
2178         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
2179         dflt=''
2180         : Half the following guesses are probably wrong... If you have better
2181         : tests or hints, please send them to perlbug@perl.com
2182         : The metaconfig authors would also appreciate a copy...
2183         $test -f /irix && osname=irix
2184         $test -f /xenix && osname=sco_xenix
2185         $test -f /dynix && osname=dynix
2186         $test -f /dnix && osname=dnix
2187         $test -f /lynx.os && osname=lynxos
2188         $test -f /unicos && osname=unicos && osvers=`$uname -r`
2189         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
2190         $test -f /bin/mips && /bin/mips && osname=mips
2191         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
2192                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
2193         $test -d /usr/apollo/bin && osname=apollo
2194         $test -f /etc/saf/_sactab && osname=svr4
2195         $test -d /usr/include/minix && osname=minix
2196         if $test -d /MachTen -o -d /MachTen_Folder; then
2197                 osname=machten
2198                 if $test -x /sbin/version; then
2199                         osvers=`/sbin/version | $awk '{print $2}' |
2200                         $sed -e 's/[A-Za-z]$//'`
2201                 elif $test -x /usr/etc/version; then
2202                         osvers=`/usr/etc/version | $awk '{print $2}' |
2203                         $sed -e 's/[A-Za-z]$//'`
2204                 else
2205                         osvers="$2.$3"
2206                 fi
2207         fi
2208        $test -f /sys/posix.dll &&
2209                $test -f /usr/bin/what &&
2210                set X `/usr/bin/what /sys/posix.dll` &&
2211                $test "$3" = UWIN &&
2212                osname=uwin &&
2213                osvers="$5"
2214         if $test -f $uname; then
2215                 set X $myuname
2216                 shift
2217
2218                 case "$5" in
2219                 fps*) osname=fps ;;
2220                 mips*)
2221                         case "$4" in
2222                         umips) osname=umips ;;
2223                         *) osname=mips ;;
2224                         esac;;
2225                 [23]100) osname=mips ;;
2226                 next*) osname=next ;;
2227                 i386*)
2228                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
2229                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
2230                                 osname='sco'
2231                                 osvers=$tmp
2232                         elif $test -f /etc/kconfig; then
2233                                 osname=isc
2234                                 if test "$lns" = "$ln -s"; then
2235                                         osvers=4
2236                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
2237                                         osvers=3
2238                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
2239                                         osvers=2
2240                                 fi
2241                         fi
2242                         tmp=''
2243                         ;;
2244                 pc*)
2245                         if test -n "$DJGPP"; then
2246                                 osname=dos
2247                                 osvers=djgpp
2248                         fi
2249                         ;;
2250                 esac
2251
2252                 case "$1" in
2253                 aix) osname=aix
2254                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
2255                         case "$tmp" in
2256                         'not found') osvers="$4"."$3" ;;
2257                         '<3240'|'<>3240') osvers=3.2.0 ;;
2258                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
2259                         '=3250'|'>3250') osvers=3.2.5 ;;
2260                         *) osvers=$tmp;;
2261                         esac
2262                         ;;
2263                 *dc.osx) osname=dcosx
2264                         osvers="$3"
2265                         ;;
2266                 dnix) osname=dnix
2267                         osvers="$3"
2268                         ;;
2269                 domainos) osname=apollo
2270                         osvers="$3"
2271                         ;;
2272                 dgux) osname=dgux 
2273                         osvers="$3"
2274                         ;;
2275                 dynixptx*) osname=dynixptx
2276                         osvers=`echo "$4"|sed 's/^v//'`
2277                         ;;
2278                 freebsd) osname=freebsd 
2279                         osvers="$3" ;;
2280                 genix) osname=genix ;;
2281                 hp*) osname=hpux 
2282                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
2283                         ;;
2284                 irix*) osname=irix
2285                         case "$3" in
2286                         4*) osvers=4 ;;
2287                         5*) osvers=5 ;;
2288                         *)      osvers="$3" ;;
2289                         esac
2290                         ;;
2291                 linux) osname=linux
2292                         case "$3" in
2293                         *)      osvers="$3" ;;
2294                         esac
2295                         ;;
2296                 MiNT) osname=mint
2297                         ;;
2298                 netbsd*) osname=netbsd
2299                         osvers="$3"
2300                         ;;
2301                 news-os) osvers="$3"
2302                         case "$3" in
2303                         4*) osname=newsos4 ;;
2304                         *) osname=newsos ;;
2305                         esac
2306                         ;;
2307                 bsd386) osname=bsd386
2308                         osvers=`$uname -r`
2309                         ;;
2310                 POSIX-BC | posix-bc ) osname=posix-bc
2311                         osvers="$3"
2312                         ;;
2313                 powerux | power_ux | powermax_os | powermaxos | \
2314                 powerunix | power_unix) osname=powerux
2315                         osvers="$3"
2316                         ;;
2317                 next*) osname=next ;;
2318                 solaris) osname=solaris
2319                         case "$3" in
2320                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
2321                         *)      osvers="$3" ;;
2322                         esac
2323                         ;;
2324                 sunos) osname=sunos
2325                         case "$3" in
2326                         5*) osname=solaris
2327                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
2328                         *)      osvers="$3" ;;
2329                         esac
2330                         ;;
2331                 titanos) osname=titanos
2332                         case "$3" in
2333                         1*) osvers=1 ;;
2334                         2*) osvers=2 ;;
2335                         3*) osvers=3 ;;
2336                         4*) osvers=4 ;;
2337                         *)      osvers="$3" ;;
2338                         esac
2339                         ;;
2340                 ultrix) osname=ultrix
2341                         osvers="$3"
2342                         ;;
2343                 osf1|mls+)      case "$5" in
2344                                 alpha)
2345                                         osname=dec_osf
2346                                         osvers=`echo "$3" | sed 's/^[xvt]//'`
2347                                         ;;
2348                         hp*)    osname=hp_osf1  ;;
2349                         mips)   osname=mips_osf1 ;;
2350                         esac
2351                         ;;
2352                 unixware) osname=svr5
2353                         osvers="$4"
2354                         ;;
2355                 uts) osname=uts
2356                         osvers="$3"
2357                         ;;
2358                 qnx) osname=qnx
2359                         osvers="$4"
2360                         ;;
2361                 $2) case "$osname" in
2362                         *isc*) ;;
2363                         *freebsd*) ;;
2364                         svr*)
2365                                 : svr4.x or possibly later
2366                                 case "svr$3" in 
2367                                 ${osname}*)
2368                                         osname=svr$3
2369                                         osvers=$4
2370                                         ;;
2371                                 esac
2372                                 case "$osname" in
2373                                 svr4.0)
2374                                         : Check for ESIX
2375                                         if test -f /stand/boot ; then
2376                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
2377                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
2378                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
2379                                                         if test -n "$isesix"; then
2380                                                                 osname=esix4
2381                                                         fi
2382                                                 fi
2383                                         fi
2384                                         ;;
2385                                 esac
2386                                 ;;
2387                         *)      if test -f /etc/systemid; then
2388                                         osname=sco
2389                                         set `echo $3 | $sed 's/\./ /g'` $4
2390                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
2391                                                 osvers=$1.$2.$3
2392                                         elif $test -f $src/hints/sco_$1_$2.sh; then
2393                                                 osvers=$1.$2
2394                                         elif $test -f $src/hints/sco_$1.sh; then
2395                                                 osvers=$1
2396                                         fi
2397                                 else
2398                                         case "$osname" in
2399                                         '') : Still unknown.  Probably a generic Sys V.
2400                                                 osname="sysv"
2401                                                 osvers="$3"
2402                                                 ;;
2403                                         esac
2404                                 fi
2405                                 ;;
2406                         esac
2407                         ;;
2408                 *)      case "$osname" in
2409                         '') : Still unknown.  Probably a generic BSD.
2410                                 osname="$1"
2411                                 osvers="$3"
2412                                 ;;
2413                         esac
2414                         ;;
2415                 esac
2416         else
2417                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
2418                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
2419                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
2420                                 osname=news_os
2421                         fi
2422                         $rm -f UU/kernel.what
2423                 elif test -d c:/.; then
2424                         set X $myuname
2425                         osname=os2
2426                         osvers="$5"
2427                 fi
2428         fi
2429         
2430         : Now look for a hint file osname_osvers, unless one has been
2431         : specified already.
2432         case "$hintfile" in
2433         ''|' ')
2434                 file=`echo "${osname}_${osvers}" | $sed -e 's@\.@_@g' -e 's@_$@@'`
2435                 : Also try without trailing minor version numbers.
2436                 xfile=`echo $file | $sed -e 's@_[^_]*$@@'`
2437                 xxfile=`echo $xfile | $sed -e 's@_[^_]*$@@'`
2438                 xxxfile=`echo $xxfile | $sed -e 's@_[^_]*$@@'`
2439                 xxxxfile=`echo $xxxfile | $sed -e 's@_[^_]*$@@'`
2440                 case "$file" in
2441                 '') dflt=none ;;
2442                 *)  case "$osvers" in
2443                         '') dflt=$file
2444                                 ;;
2445                         *)  if $test -f $src/hints/$file.sh ; then
2446                                         dflt=$file
2447                                 elif $test -f $src/hints/$xfile.sh ; then
2448                                         dflt=$xfile
2449                                 elif $test -f $src/hints/$xxfile.sh ; then
2450                                         dflt=$xxfile
2451                                 elif $test -f $src/hints/$xxxfile.sh ; then
2452                                         dflt=$xxxfile
2453                                 elif $test -f $src/hints/$xxxxfile.sh ; then
2454                                         dflt=$xxxxfile
2455                                 elif $test -f "$src/hints/${osname}.sh" ; then
2456                                         dflt="${osname}"
2457                                 else
2458                                         dflt=none
2459                                 fi
2460                                 ;;
2461                         esac
2462                         ;;
2463                 esac
2464                 if $test -f Policy.sh ; then
2465                         case "$dflt" in
2466                         *Policy*) ;;
2467                         none) dflt="Policy" ;;
2468                         *) dflt="Policy $dflt" ;;
2469                         esac
2470                 fi
2471                 ;;
2472         *)
2473                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
2474                 ;;
2475         esac
2476
2477         if $test -f Policy.sh ; then
2478                 $cat <<EOM
2479
2480 There's also a Policy hint file available, which should make the
2481 site-specific (policy) questions easier to answer.
2482 EOM
2483
2484         fi
2485
2486         $cat <<EOM
2487
2488 You may give one or more space-separated answers, or "none" if appropriate.
2489 A well-behaved OS will have no hints, so answering "none" or just "Policy"
2490 is a good thing.  DO NOT give a wrong version or a wrong OS.
2491
2492 EOM
2493
2494         rp="Which of these apply, if any?"
2495         . UU/myread
2496         tans=$ans
2497         for file in $tans; do
2498                 if $test X$file = XPolicy -a -f Policy.sh; then
2499                         . Policy.sh
2500                         $cat Policy.sh >> UU/config.sh
2501                 elif $test -f $src/hints/$file.sh; then
2502                         . $src/hints/$file.sh
2503                         $cat $src/hints/$file.sh >> UU/config.sh
2504                 elif $test X$tans = X -o X$tans = Xnone ; then
2505                         : nothing
2506                 else
2507                         : Give one chance to correct a possible typo.
2508                         echo "$file.sh does not exist"
2509                         dflt=$file
2510                         rp="hint to use instead?"
2511                         . UU/myread
2512                         for file in $ans; do
2513                                 if $test -f "$src/hints/$file.sh"; then
2514                                         . $src/hints/$file.sh
2515                                         $cat $src/hints/$file.sh >> UU/config.sh
2516                                 elif $test X$ans = X -o X$ans = Xnone ; then
2517                                         : nothing
2518                                 else
2519                                         echo "$file.sh does not exist -- ignored."
2520                                 fi
2521                         done
2522                 fi
2523         done
2524
2525         hint=recommended
2526         : Remember our hint file for later.
2527         if $test -f "$src/hints/$file.sh" ; then
2528                 hintfile="$file"
2529         else
2530                 hintfile=''
2531         fi
2532 fi
2533 cd UU
2534 ;;
2535 *)
2536         echo " "
2537         echo "Fetching default answers from $config_sh..." >&4
2538         tmp_n="$n"
2539         tmp_c="$c"
2540         cd ..
2541         cp $config_sh config.sh 2>/dev/null
2542         chmod +w config.sh
2543         . ./config.sh
2544         cd UU
2545         cp ../config.sh .
2546         n="$tmp_n"
2547         c="$tmp_c"
2548         hint=previous
2549         ;;
2550 esac
2551 test "$override" && . ./optdef.sh
2552 myuname="$newmyuname"
2553
2554 : Restore computed paths
2555 for file in $loclist $trylist; do
2556         eval $file="\$_$file"
2557 done
2558
2559 cat << EOM
2560
2561 Configure uses the operating system name and version to set some defaults.
2562 The default value is probably right if the name rings a bell. Otherwise,
2563 since spelling matters for me, either accept the default or answer "none"
2564 to leave it blank.
2565
2566 EOM
2567 case "$osname" in
2568         ''|' ')
2569                 case "$hintfile" in
2570                 ''|' '|none) dflt=none ;;
2571                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
2572                 esac
2573                 ;;
2574         *) dflt="$osname" ;;
2575 esac
2576 rp="Operating system name?"
2577 . ./myread
2578 case "$ans" in
2579 none)  osname='' ;;
2580 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
2581 esac
2582 echo " "
2583 case "$osvers" in
2584         ''|' ')
2585                 case "$hintfile" in
2586                 ''|' '|none) dflt=none ;;
2587                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
2588                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
2589                         case "$dflt" in
2590                         ''|' ') dflt=none ;;
2591                         esac
2592                         ;;
2593                 esac
2594                 ;;
2595         *) dflt="$osvers" ;;
2596 esac
2597 rp="Operating system version?"
2598 . ./myread
2599 case "$ans" in
2600 none)  osvers='' ;;
2601 *) osvers="$ans" ;;
2602 esac
2603
2604
2605 . ./posthint.sh
2606
2607 : who configured the system
2608 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
2609 cf_by=`(logname) 2>/dev/null`
2610 case "$cf_by" in
2611 "")
2612         cf_by=`(whoami) 2>/dev/null`
2613         case "$cf_by" in
2614         "") cf_by=unknown ;;
2615         esac ;;
2616 esac
2617
2618 : set up the script used to warn in case of inconsistency
2619 cat <<EOS >whoa
2620 $startsh
2621 EOS
2622 cat <<'EOSC' >>whoa
2623 dflt=y
2624 echo " "
2625 echo "*** WHOA THERE!!! ***" >&4
2626 echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
2627 rp="    Keep the $hint value?"
2628 . ./myread
2629 case "$ans" in
2630 y) td=$was; tu=$was;;
2631 esac
2632 EOSC
2633
2634 : function used to set $1 to $val
2635 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
2636 case "$val$was" in
2637 $define$undef) . ./whoa; eval "$var=\$td";;
2638 $undef$define) . ./whoa; eval "$var=\$tu";;
2639 *) eval "$var=$val";;
2640 esac'
2641
2642 cat <<EOM
2643
2644 Perl can be built to take advantage of threads, on some systems.
2645 To do so, Configure must be run with -Dusethreads.
2646
2647 Note that threading is a highly experimental feature, and
2648 some known race conditions still remain.  If you choose to try
2649 it, be very sure to not actually deploy it for production
2650 purposes.  README.threads has more details, and is required
2651 reading if you enable threads.
2652 EOM
2653 case "$usethreads" in
2654 $define|true|[yY]*)     dflt='y';;
2655 *) dflt='n';;
2656 esac
2657 rp='Build a threading Perl?'
2658 . ./myread
2659 case "$ans" in
2660 y|Y)    val="$define" ;;     
2661 *)      val="$undef" ;;
2662 esac
2663 set usethreads
2664 eval $setvar 
2665
2666 case "$d_oldpthreads" in
2667 '')     : Configure tests would be welcome here.  For now, assume undef.
2668         val="$undef" ;;
2669 *)      val="$d_oldpthreads" ;;
2670 esac
2671 set d_oldpthreads
2672 eval $setvar
2673
2674
2675 case "$usethreads" in
2676 "$define"|true|[yY]*)
2677 : Look for a hint-file generated 'call-back-unit'.  If the
2678 : user has specified that a threading perl is to be built,
2679 : we may need to set or change some other defaults.
2680         if $test -f usethreads.cbu; then
2681                 echo "Your platform has some specific hints for threaded builds, using them..."
2682                 . ./usethreads.cbu
2683         else
2684                 $cat <<EOM
2685 (Your platform doesn't have any specific hints for threaded builds.
2686  Assuming POSIX threads, then.)
2687 EOM
2688         fi
2689     ;;
2690 esac
2691
2692 cat <<EOM
2693
2694 Perl can be built so that multiple Perl interpreters can coexist
2695 within the same Perl executable.  To do so, Configure must be run with
2696 -Dusemultiplicity.
2697
2698 Normally you do not need this and you should answer no.
2699
2700 EOM
2701 case "$usemultiplicity" in
2702 $define|true|[yY]*)     dflt='y';;
2703 *) dflt='n';;
2704 esac
2705 rp='Build Perl for multiplicity?'
2706 . ./myread
2707 case "$ans" in
2708 y|Y)    val="$define" ;;     
2709 *)      val="$undef" ;;
2710 esac
2711 set usemultiplicity
2712 eval $setvar 
2713
2714 : determine where manual pages are on this system
2715 echo " "
2716 case "$sysman" in
2717 '') 
2718         syspath='/usr/man/man1 /usr/man/mann /usr/man/manl /usr/man/local/man1'
2719         syspath="$syspath /usr/man/u_man/man1 /usr/share/man/man1"
2720         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
2721         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
2722         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
2723         sysman=`./loc . /usr/man/man1 $syspath`
2724         ;;
2725 esac
2726 if $test -d "$sysman"; then
2727         echo "System manual is in $sysman." >&4
2728 else
2729         echo "Could not find manual pages in source form." >&4
2730 fi
2731
2732 : see what memory models we can support
2733 case "$models" in
2734 '')
2735         $cat >pdp11.c <<'EOP'
2736 int main() {
2737 #ifdef pdp11
2738         exit(0);
2739 #else
2740         exit(1);
2741 #endif
2742 }
2743 EOP
2744         ( cc -o pdp11 pdp11.c ) >/dev/null 2>&1
2745         if $test -f pdp11 && ./pdp11 2>/dev/null; then
2746                 dflt='unsplit split'
2747         else
2748                 tans=`./loc . X /lib/small /lib/large /usr/lib/small /usr/lib/large /lib/medium /usr/lib/medium /lib/huge`
2749                 case "$tans" in
2750                 X) dflt='none';;
2751                 *) if $test -d /lib/small || $test -d /usr/lib/small; then
2752                                 dflt='small'
2753                         else
2754                                 dflt=''
2755                         fi
2756                         if $test -d /lib/medium || $test -d /usr/lib/medium; then
2757                                 dflt="$dflt medium"
2758                         fi
2759                         if $test -d /lib/large || $test -d /usr/lib/large; then
2760                                 dflt="$dflt large"
2761                         fi
2762                         if $test -d /lib/huge || $test -d /usr/lib/huge; then
2763                                 dflt="$dflt huge"
2764                         fi
2765                 esac
2766         fi;;
2767 *) dflt="$models";;
2768 esac
2769 $cat <<EOM
2770  
2771 Some systems have different model sizes.  On most systems they are called
2772 small, medium, large, and huge.  On the PDP11 they are called unsplit and
2773 split.  If your system doesn't support different memory models, say "none".
2774 If you wish to force everything to one memory model, say "none" here and
2775 put the appropriate flags later when it asks you for other cc and ld flags.
2776 Venix systems may wish to put "none" and let the compiler figure things out.
2777 (In the following question multiple model names should be space separated.)
2778
2779 The default for most systems is "none".
2780
2781 EOM
2782 rp="Which memory models are supported?"
2783 . ./myread
2784 models="$ans"
2785
2786 case "$models" in
2787 none)
2788         small=''
2789         medium=''
2790         large=''
2791         huge=''
2792         unsplit=''
2793         split=''
2794         ;;
2795 *split)
2796         case "$split" in
2797         '') if $contains '\-i' $sysman/ld.1 >/dev/null 2>&1 || \
2798                          $contains '\-i' $sysman/cc.1 >/dev/null 2>&1; then
2799                         dflt='-i'
2800                 else
2801                         dflt='none'
2802                 fi;;
2803         *) dflt="$split";;
2804         esac
2805         rp="What flag indicates separate I and D space?"
2806         . ./myread
2807         tans="$ans"
2808         case "$tans" in
2809         none) tans='';;
2810         esac
2811         split="$tans"
2812         unsplit='';;
2813 *large*|*small*|*medium*|*huge*)
2814         case "$models" in
2815         *large*)
2816                 case "$large" in
2817                 '') dflt='-Ml';;
2818                 *) dflt="$large";;
2819                 esac
2820         rp="What flag indicates large model?"
2821         . ./myread
2822         tans="$ans"
2823         case "$tans" in
2824         none) tans='';
2825         esac
2826         large="$tans";;
2827         *) large='';;
2828         esac
2829         case "$models" in
2830         *huge*) case "$huge" in
2831                 '') dflt='-Mh';;
2832                 *) dflt="$huge";;
2833                 esac
2834                 rp="What flag indicates huge model?"
2835                 . ./myread
2836                 tans="$ans"
2837                 case "$tans" in
2838                 none) tans='';
2839                 esac
2840                 huge="$tans";;
2841         *) huge="$large";;
2842         esac
2843         case "$models" in
2844         *medium*) case "$medium" in
2845                 '') dflt='-Mm';;
2846                 *) dflt="$medium";;
2847                 esac
2848                 rp="What flag indicates medium model?"
2849                 . ./myread
2850                 tans="$ans"
2851                 case "$tans" in
2852                 none) tans='';
2853                 esac
2854                 medium="$tans";;
2855         *) medium="$large";;
2856         esac
2857         case "$models" in
2858         *small*) case "$small" in
2859                 '') dflt='none';;
2860                 *) dflt="$small";;
2861                 esac
2862                 rp="What flag indicates small model?"
2863                 . ./myread
2864                 tans="$ans"
2865                 case "$tans" in
2866                 none) tans='';
2867                 esac
2868                 small="$tans";;
2869         *) small='';;
2870         esac
2871         ;;
2872 *)
2873         echo "Unrecognized memory models--you may have to edit Makefile.SH" >&4
2874         ;;
2875 esac
2876 $rm -f pdp11.* pdp11
2877
2878 : make some quick guesses about what we are up against
2879 echo " "
2880 $echo $n "Hmm...  $c"
2881 echo exit 1 >bsd
2882 echo exit 1 >usg
2883 echo exit 1 >v7
2884 echo exit 1 >osf1
2885 echo exit 1 >eunice
2886 echo exit 1 >xenix
2887 echo exit 1 >venix
2888 echo exit 1 >os2
2889 d_bsd="$undef"
2890 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
2891 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
2892 then
2893         echo "Looks kind of like an OSF/1 system, but we'll see..."
2894         echo exit 0 >osf1
2895 elif test `echo abc | tr a-z A-Z` = Abc ; then
2896         xxx=`./loc addbib blurfl $pth`
2897         if $test -f $xxx; then
2898         echo "Looks kind of like a USG system with BSD features, but we'll see..."
2899                 echo exit 0 >bsd
2900                 echo exit 0 >usg
2901         else
2902                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
2903                         echo "Looks kind of like an extended USG system, but we'll see..."
2904                 else
2905                         echo "Looks kind of like a USG system, but we'll see..."
2906                 fi
2907                 echo exit 0 >usg
2908         fi
2909 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
2910         echo "Looks kind of like a BSD system, but we'll see..."
2911         d_bsd="$define"
2912         echo exit 0 >bsd
2913 else
2914         echo "Looks kind of like a Version 7 system, but we'll see..."
2915         echo exit 0 >v7
2916 fi
2917 case "$eunicefix" in
2918 *unixtovms*)
2919         $cat <<'EOI'
2920 There is, however, a strange, musty smell in the air that reminds me of
2921 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
2922 EOI
2923         echo exit 0 >eunice
2924         d_eunice="$define"
2925 : it so happens the Eunice I know will not run shell scripts in Unix format
2926         ;;
2927 *)
2928         echo " "
2929         echo "Congratulations.  You aren't running Eunice."
2930         d_eunice="$undef"
2931         ;;
2932 esac
2933 : Detect OS2.  The p_ variable is set above in the Head.U unit.
2934 case "$p_" in
2935 :) ;;
2936 *)
2937         $cat <<'EOI'
2938 I have the feeling something is not exactly right, however...don't tell me...
2939 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
2940 EOI
2941         echo exit 0 >os2
2942         ;;
2943 esac
2944 if test -f /xenix; then
2945         echo "Actually, this looks more like a XENIX system..."
2946         echo exit 0 >xenix
2947         d_xenix="$define"
2948 else
2949         echo " "
2950         echo "It's not Xenix..."
2951         d_xenix="$undef"
2952 fi
2953 chmod +x xenix
2954 $eunicefix xenix
2955 if test -f /venix; then
2956         echo "Actually, this looks more like a VENIX system..."
2957         echo exit 0 >venix
2958 else
2959         echo " "
2960         if ./xenix; then
2961                 : null
2962         else
2963                 echo "Nor is it Venix..."
2964         fi
2965 fi
2966 chmod +x bsd usg v7 osf1 eunice xenix venix os2
2967 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
2968 $rm -f foo
2969
2970 : see if we need a special compiler
2971 echo " "
2972 if ./usg; then
2973         case "$cc" in
2974         '') case "$Mcc" in
2975                 /*) dflt='Mcc';;
2976                 *) case "$large" in
2977                         -M*) dflt='cc';;
2978                         *)      if $contains '\-M' $sysman/cc.1 >/dev/null 2>&1 ; then
2979                                         if $contains '\-M' $sysman/cpp.1 >/dev/null 2>&1; then
2980                                                 dflt='cc'
2981                                         else
2982                                                 dflt='cc -M'
2983                                         fi
2984                                 else
2985                                         dflt='cc'
2986                                 fi;;
2987                         esac;;
2988                 esac;;
2989         *)  dflt="$cc";;
2990         esac
2991         case "$dflt" in
2992         *M*)    $cat <<'EOM'
2993 On some older systems the default C compiler will not resolve multiple global
2994 references that happen to have the same name.  On some such systems the "Mcc"
2995 command may be used to force these to be resolved.  On other systems a "cc -M"
2996 command is required.  (Note that the -M flag on other systems indicates a
2997 memory model to use!) If you have the Gnu C compiler, you might wish to use
2998 that instead.
2999
3000 EOM
3001         ;;
3002         esac
3003         rp="Use which C compiler?"
3004         . ./myread
3005         cc="$ans"
3006 else
3007         case "$cc" in
3008         '') dflt=cc;;
3009         *) dflt="$cc";;
3010         esac
3011         rp="Use which C compiler?"
3012         . ./myread
3013         cc="$ans"
3014 fi
3015 : Look for a hint-file generated 'call-back-unit'.  Now that the
3016 : user has specified the compiler, we may need to set or change some
3017 : other defaults.
3018 if $test -f cc.cbu; then
3019     . ./cc.cbu
3020 fi
3021 echo " "
3022 echo "Checking for GNU cc in disguise and/or its version number..." >&4
3023 $cat >gccvers.c <<EOM
3024 #include <stdio.h>
3025 int main() {
3026 #ifdef __GNUC__
3027 #ifdef __VERSION__
3028         printf("%s\n", __VERSION__);
3029 #else
3030         printf("%s\n", "1");
3031 #endif
3032 #endif
3033         exit(0);
3034 }
3035 EOM
3036 if $cc -o gccvers gccvers.c; then
3037         gccversion=`./gccvers`
3038         case "$gccversion" in
3039         '') echo "You are not using GNU cc." ;;
3040         *)  echo "You are using GNU cc $gccversion." ;;
3041         esac
3042 else
3043         echo " "
3044         echo "*** WHOA THERE!!! ***" >&4
3045         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
3046         case "$knowitall" in
3047         '')
3048         echo "    You'd better start hunting for one and let me know about it." >&4
3049                 exit 1
3050                 ;;
3051         esac
3052 fi
3053 $rm -f gccvers*
3054 case "$gccversion" in
3055 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
3056 esac
3057
3058
3059 case "$usemorebits" in
3060 "$define"|true|[yY]*)
3061         use64bits="$define"
3062         uselongdouble="$define"
3063         usemorebits="$define"
3064         ;;
3065 *)      usemorebits="$undef"
3066         ;;
3067 esac
3068
3069
3070 cat <<EOM
3071
3072 Perl can be built to understand large files (files larger than 2 gigabytes)
3073 on some systems.  To do so, Configure must be run with -Duselargefiles.
3074
3075 If this doesn't make any sense to you, just accept the default.
3076 EOM
3077 case "$uselargefiles" in
3078 "$define"|true|[yY]*) dflt='y' ;;
3079 *)      dflt='n' ;;
3080 esac
3081 rp='Try to understand large files?'
3082 . ./myread
3083 case "$ans" in
3084 y|Y)    val="$define" ;;
3085 *)      val="$undef"  ;;
3086 esac
3087 set uselargefiles
3088 eval $setvar
3089 case "$uselargefiles" in
3090 "$define") use64bits="$define" ;;
3091 esac
3092
3093 cat <<EOM
3094
3095 Perl can be built to take advantage of explicit 64-bit interfaces,
3096 on some systems.  To do so, Configure must be run with -Duse64bits.
3097
3098 If this doesn't make any sense to you, just accept the default.
3099 EOM
3100 case "$use64bits" in
3101 $define|true|[yY]*)     dflt='y';;
3102 *) dflt='n';;
3103 esac
3104 rp='Try to use explicit 64-bit interfaces, if available?'
3105 . ./myread
3106 case "$ans" in
3107 y|Y) 
3108         val="$define"
3109         ;;     
3110 *)      
3111         val="$undef"
3112         ;;
3113 esac
3114 set use64bits
3115 eval $setvar
3116
3117 case "$archname64" in
3118 '') archname64='' ;;    # not a typo
3119 esac
3120
3121 case "$use64bits" in
3122 "$define"|true|[yY]*)
3123 : Look for a hint-file generated 'call-back-unit'.  If the
3124 : user has specified that a 64 bit perl is to be built,
3125 : we may need to set or change some other defaults.
3126         if $test -f use64bits.cbu; then
3127                 echo "Your platform has some specific hints for 64-bit builds, using them..."
3128                 . ./use64bits.cbu
3129         else
3130                 $cat <<EOM
3131 (Your platform doesn't have any specific hints for 64-bit builds.
3132  This is probably okay, especially if your system is a true 64-bit system.)
3133 EOM
3134                 case "$gccversion" in
3135                 '')     ;;
3136                 *)      $cat <<EOM
3137 But since you seem to be using gcc,
3138 I will now add -DUSE_LONG_LONG to the compilation flags.
3139 EOM
3140                         ccflags="$ccflags -DUSE_LONG_LONG"
3141                         ;;
3142                 esac
3143         fi
3144         ;;
3145 esac
3146
3147 : determine the architecture name
3148 echo " "
3149 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
3150         tarch=`arch`"-$osname"
3151 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
3152         if uname -m > tmparch 2>&1 ; then
3153                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
3154                         -e 's/$/'"-$osname/" tmparch`
3155         else
3156                 tarch="$osname"
3157         fi
3158         $rm -f tmparch
3159 else
3160         tarch="$osname"
3161 fi
3162 case "$myarchname" in
3163 ''|"$tarch") ;;
3164 *)
3165         echo "(Your architecture name used to be $myarchname.)"
3166         archname=''
3167         ;;
3168 esac
3169 myarchname="$tarch"
3170 case "$archname" in
3171 '') dflt="$tarch";;
3172 *) dflt="$archname";;
3173 esac
3174 rp='What is your architecture name'
3175 . ./myread
3176 archname="$ans"
3177 case "$usethreads" in
3178 $define)
3179         echo "Threads selected." >&4
3180         case "$archname" in
3181         *-thread*) echo "...and architecture name already has -thread." >&4
3182                 ;;
3183         *)      archname="$archname-thread"
3184                 echo "...setting architecture name to $archname." >&4
3185                 ;;
3186         esac
3187         ;;
3188 esac
3189 case "$usemultiplicity" in
3190 $define)
3191         echo "Multiplicity selected." >&4
3192         case "$archname" in
3193         *-multi*) echo "...and architecture name already has -multi." >&4
3194                 ;;
3195         *)      archname="$archname-multi"
3196                 echo "...setting architecture name to $archname." >&4
3197                 ;;
3198         esac
3199         ;;
3200 esac
3201 case "$use64bits" in
3202 $define)
3203         echo "Explicit 64-bitness selected." >&4
3204         case "$archname64" in
3205         '')
3206                 ;;
3207         *)
3208                 case "$archname" in
3209                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
3210                         ;;
3211                 *)      archname="$archname-$archname64"
3212                         echo "...setting architecture name to $archname." >&4
3213                         ;;
3214                 esac
3215                 ;;
3216         esac
3217 esac
3218
3219 : decide how portable to be.  Allow command line overrides.
3220 case "$d_portable" in
3221 "$undef") ;;
3222 *)      d_portable="$define" ;;
3223 esac
3224
3225 : set up shell script to do ~ expansion
3226 cat >filexp <<EOSS
3227 $startsh
3228 : expand filename
3229 case "\$1" in
3230  ~/*|~)
3231         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3232         ;;
3233  ~*)
3234         if $test -f /bin/csh; then
3235                 /bin/csh -f -c "glob \$1"
3236                 failed=\$?
3237                 echo ""
3238                 exit \$failed
3239         else
3240                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3241                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3242                 if $test ! -d "\$dir"; then
3243                         me=\`basename \$0\`
3244                         echo "\$me: can't locate home directory for: \$name" >&2
3245                         exit 1
3246                 fi
3247                 case "\$1" in
3248                 */*)
3249                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3250                         ;;
3251                 *)
3252                         echo \$dir
3253                         ;;
3254                 esac
3255         fi
3256         ;;
3257 *)
3258         echo \$1
3259         ;;
3260 esac
3261 EOSS
3262 chmod +x filexp
3263 $eunicefix filexp
3264
3265 : now set up to get a file name
3266 cat <<EOS >getfile
3267 $startsh
3268 EOS
3269 cat <<'EOSC' >>getfile
3270 tilde=''
3271 fullpath=''
3272 already=''
3273 skip=''
3274 none_ok=''
3275 exp_file=''
3276 nopath_ok=''
3277 orig_rp="$rp"
3278 orig_dflt="$dflt"
3279 case "$gfpth" in
3280 '') gfpth='.' ;;
3281 esac
3282
3283 case "$fn" in
3284 *\(*)
3285         expr $fn : '.*(\(.*\)).*' | tr ',' $trnl >getfile.ok
3286         fn=`echo $fn | sed 's/(.*)//'`
3287         ;;
3288 esac
3289
3290 case "$fn" in
3291 *:*)
3292         loc_file=`expr $fn : '.*:\(.*\)'`
3293         fn=`expr $fn : '\(.*\):.*'`
3294         ;;
3295 esac
3296
3297 case "$fn" in
3298 *~*) tilde=true;;
3299 esac
3300 case "$fn" in
3301 */*) fullpath=true;;
3302 esac
3303 case "$fn" in
3304 *+*) skip=true;;
3305 esac
3306 case "$fn" in
3307 *n*) none_ok=true;;
3308 esac
3309 case "$fn" in
3310 *e*) exp_file=true;;
3311 esac
3312 case "$fn" in
3313 *p*) nopath_ok=true;;
3314 esac
3315
3316 case "$fn" in
3317 *f*) type='File';;
3318 *d*) type='Directory';;
3319 *l*) type='Locate';;
3320 esac
3321
3322 what="$type"
3323 case "$what" in
3324 Locate) what='File';;
3325 esac
3326
3327 case "$exp_file" in
3328 '')
3329         case "$d_portable" in
3330         "$define") ;;
3331         *) exp_file=true;;
3332         esac
3333         ;;
3334 esac
3335
3336 cd ..
3337 while test "$type"; do
3338         redo=''
3339         rp="$orig_rp"
3340         dflt="$orig_dflt"
3341         case "$tilde" in
3342         true) rp="$rp (~name ok)";;
3343         esac
3344         . UU/myread
3345         if test -f UU/getfile.ok && \
3346                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3347         then
3348                 value="$ans"
3349                 ansexp="$ans"
3350                 break
3351         fi
3352         case "$ans" in
3353         none)
3354                 value=''
3355                 ansexp=''
3356                 case "$none_ok" in
3357                 true) type='';;
3358                 esac
3359                 ;;
3360         *)
3361                 case "$tilde" in
3362                 '') value="$ans"
3363                         ansexp="$ans";;
3364                 *)
3365                         value=`UU/filexp $ans`
3366                         case $? in
3367                         0)
3368                                 if test "$ans" != "$value"; then
3369                                         echo "(That expands to $value on this system.)"
3370                                 fi
3371                                 ;;
3372                         *) value="$ans";;
3373                         esac
3374                         ansexp="$value"
3375                         case "$exp_file" in
3376                         '') value="$ans";;
3377                         esac
3378                         ;;
3379                 esac
3380                 case "$fullpath" in
3381                 true)
3382                         case "$ansexp" in
3383                         /*) value="$ansexp" ;;
3384                         *)
3385                                 redo=true
3386                                 case "$already" in
3387                                 true)
3388                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
3389                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
3390                                         ;;
3391                                 *)
3392                                 echo "Please give a full path name, starting with slash." >&4
3393                                         case "$tilde" in
3394                                         true)
3395                                 echo "Note that using ~name is ok provided it expands well." >&4
3396                                                 already=true
3397                                                 ;;
3398                                         esac
3399                                 esac
3400                                 ;;
3401                         esac
3402                         ;;
3403                 esac
3404                 case "$redo" in
3405                 '')
3406                         case "$type" in
3407                         File)
3408                                 for fp in $gfpth; do
3409                                         if test "X$fp" = X.; then
3410                                             pf="$ansexp"
3411                                         else    
3412                                             pf="$fp/$ansexp"
3413                                         fi
3414                                         if test -f "$pf"; then
3415                                                 type=''
3416                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3417                                         then
3418                                                 echo "($value is not a plain file, but that's ok.)"
3419                                                 type=''
3420                                         fi
3421                                         if test X"$type" = X; then
3422                                             value="$pf"
3423                                             break
3424                                         fi
3425                                 done
3426                                 ;;
3427                         Directory)
3428                                 for fp in $gfpth; do
3429                                         if test "X$fp" = X.; then
3430                                             pf="$ansexp"
3431                                         else    
3432                                             pf="$fp/$ansexp"
3433                                         fi
3434                                         if test -d "$pf"; then
3435                                                 type=''
3436                                                 value="$pf"
3437                                                 break
3438                                         fi
3439                                 done
3440                                 ;;
3441                         Locate)
3442                                 if test -d "$ansexp"; then
3443                                         echo "(Looking for $loc_file in directory $value.)"
3444                                         value="$value/$loc_file"
3445                                         ansexp="$ansexp/$loc_file"
3446                                 fi
3447                                 if test -f "$ansexp"; then
3448                                         type=''
3449                                 fi
3450                                 case "$nopath_ok" in
3451                                 true)   case "$value" in
3452                                         */*) ;;
3453                                         *)      echo "Assuming $value will be in people's path."
3454                                                 type=''
3455                                                 ;;
3456                                         esac
3457                                         ;;
3458                                 esac
3459                                 ;;
3460                         esac
3461
3462                         case "$skip" in
3463                         true) type='';
3464                         esac
3465
3466                         case "$type" in
3467                         '') ;;
3468                         *)
3469                                 if test "$fastread" = yes; then
3470                                         dflt=y
3471                                 else
3472                                         dflt=n
3473                                 fi
3474                                 rp="$what $value doesn't exist.  Use that name anyway?"
3475                                 . UU/myread
3476                                 dflt=''
3477                                 case "$ans" in
3478                                 y*) type='';;
3479                                 *) echo " ";;
3480                                 esac
3481                                 ;;
3482                         esac
3483                         ;;
3484                 esac
3485                 ;;
3486         esac
3487 done
3488 cd UU
3489 ans="$value"
3490 rp="$orig_rp"
3491 dflt="$orig_dflt"
3492 rm -f getfile.ok
3493 test "X$gfpthkeep" != Xy && gfpth=""
3494 EOSC
3495
3496 : determine root of directory hierarchy where package will be installed.
3497 case "$prefix" in
3498 '')
3499         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
3500         ;;
3501 *)
3502         dflt="$prefix"
3503         ;;
3504 esac
3505 $cat <<EOM
3506
3507 By default, $package will be installed in $dflt/bin, manual pages
3508 under $dflt/man, etc..., i.e. with $dflt as prefix for all
3509 installation directories. Typically this is something like /usr/local.
3510 If you wish to have binaries under /usr/bin but other parts of the
3511 installation under /usr/local, that's ok: you will be prompted
3512 separately for each of the installation directories, the prefix being
3513 only used to set the defaults.
3514
3515 EOM
3516 fn=d~
3517 rp='Installation prefix to use?'
3518 . ./getfile
3519 oldprefix=''
3520 case "$prefix" in
3521 '') ;;
3522 *)
3523         case "$ans" in
3524         "$prefix") ;;
3525         *) oldprefix="$prefix";;
3526         esac
3527         ;;
3528 esac
3529 prefix="$ans"
3530 prefixexp="$ansexp"
3531
3532 : is AFS running?
3533 echo " "
3534 case "$afs" in
3535 $define|true)   afs=true ;;
3536 $undef|false)   afs=false ;;
3537 *)      if test -d /afs; then
3538                 afs=true
3539         else
3540                 afs=false
3541         fi
3542         ;;
3543 esac
3544 if $afs; then
3545         echo "AFS may be running... I'll be extra cautious then..." >&4
3546 else
3547         echo "AFS does not seem to be running..." >&4
3548 fi
3549
3550 : determine installation prefix for where package is to be installed.
3551 if $afs; then 
3552 $cat <<EOM
3553
3554 Since you are running AFS, I need to distinguish the directory in which
3555 files will reside from the directory in which they are installed (and from
3556 which they are presumably copied to the former directory by occult means).
3557
3558 EOM
3559         case "$installprefix" in
3560         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
3561         *) dflt="$installprefix";;
3562         esac
3563 else
3564 $cat <<EOM
3565
3566 In some special cases, particularly when building $package for distribution,
3567 it is convenient to distinguish between the directory in which files should 
3568 be installed from the directory ($prefix) in which they 
3569 will eventually reside.  For most users, these two directories are the same.
3570
3571 EOM
3572         case "$installprefix" in
3573         '') dflt=$prefix ;;
3574         *) dflt=$installprefix;;
3575         esac
3576 fi
3577 fn=d~
3578 rp='What installation prefix should I use for installing files?'
3579 . ./getfile
3580 installprefix="$ans"
3581 installprefixexp="$ansexp"
3582
3583 : set the prefixit variable, to compute a suitable default value
3584 prefixit='case "$3" in
3585 ""|none)
3586         case "$oldprefix" in
3587         "") eval "$1=\"\$$2\"";;
3588         *)
3589                 case "$3" in
3590                 "") eval "$1=";;
3591                 none)
3592                         eval "tp=\"\$$2\"";
3593                         case "$tp" in
3594                         ""|" ") eval "$1=\"\$$2\"";;
3595                         *) eval "$1=";;
3596                         esac;;
3597                 esac;;
3598         esac;;
3599 *)
3600         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
3601         case "$tp" in
3602         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
3603         /*-$oldprefix/*|\~*-$oldprefix/*)
3604                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
3605         *) eval "$1=\"\$$2\"";;
3606         esac;;
3607 esac'
3608
3609 : set the base revision
3610 baserev=5.0
3611
3612 : get the patchlevel
3613 echo " "
3614 echo "Getting the current patchlevel..." >&4
3615 if $test -r $rsrc/patchlevel.h;then
3616         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
3617         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
3618         apiversion=`awk '/define[       ]+PERL_APIVERSION/ {print $3}' $rsrc/patchlevel.h`
3619 else
3620         patchlevel=0
3621         subversion=0
3622         apiversion=0
3623 fi
3624 $echo $n "(You have $package" $c
3625 case "$package" in
3626 "*$baserev")    ;;
3627 *)              $echo $n " $baserev" $c ;;
3628 esac
3629 $echo $n " patchlevel $patchlevel" $c
3630 test 0 -eq "$subversion" || $echo $n " subversion $subversion" $c
3631 echo ".)"
3632
3633 if test 0 -eq "$subversion"; then
3634         version=`LC_ALL=C; export LC_ALL; \
3635                  echo $baserev $patchlevel | \
3636                  $awk '{ printf "%.3f\n", $1 + $2/1000.0 }'`
3637 else
3638         version=`LC_ALL=C; export LC_ALL; \
3639                  echo $baserev $patchlevel $subversion | \
3640                  $awk '{ printf "%.5f\n", $1 + $2/1000.0 + $3/100000.0 }'`
3641 fi
3642
3643 : determine installation style
3644 : For now, try to deduce it from prefix unless it is already set.
3645 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
3646 case "$installstyle" in
3647 '')     case "$prefix" in
3648                 *perl*) dflt='lib';;
3649                 *) dflt='lib/perl5' ;;
3650         esac
3651         ;;
3652 *)      dflt='lib/perl5' ;;
3653 esac
3654 : Probably not worth prompting for this since we prompt for all
3655 : the directories individually, and the prompt would be too long and
3656 : confusing anyway.
3657 installstyle=$dflt
3658
3659 : determine where private library files go
3660 : Usual default is /usr/local/lib/perl5/$version.
3661 : Also allow things like /opt/perl/lib/$version, since 
3662 : /opt/perl/lib/perl5... would be redundant.
3663 : The default "style" setting is made in installstyle.U
3664 case "$installstyle" in
3665 *lib/perl5*) set dflt privlib lib/$package/$version ;;
3666 *)       set dflt privlib lib/$version ;;
3667 esac
3668 eval $prefixit
3669 $cat <<EOM
3670
3671 There are some auxiliary files for $package that need to be put into a
3672 private library directory that is accessible by everyone.
3673
3674 EOM
3675 fn=d~+
3676 rp='Pathname where the private library files will reside?'
3677 . ./getfile
3678 privlib="$ans"
3679 privlibexp="$ansexp"
3680 : Change installation prefix, if necessary.
3681 if $test X"$prefix" != X"$installprefix"; then
3682         installprivlib=`echo $privlibexp | sed "s#^$prefix#$installprefix#"`
3683 else
3684         installprivlib="$privlibexp"
3685 fi
3686
3687 : set the prefixup variable, to restore leading tilda escape
3688 prefixup='case "$prefixexp" in
3689 "$prefix") ;;
3690 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
3691 esac'
3692
3693 : determine where public architecture dependent libraries go
3694 set archlib archlib
3695 eval $prefixit
3696 : privlib default is /usr/local/lib/$package/$version
3697 : archlib default is /usr/local/lib/$package/$version/$archname
3698 : privlib may have an optional trailing /share.
3699 tdflt=`echo $privlib | $sed 's,/share$,,'`
3700 tdflt=$tdflt/$archname
3701 case "$archlib" in
3702 '')     dflt=$tdflt
3703         ;;
3704 *)      dflt="$archlib"
3705     ;;
3706 esac
3707 $cat <<EOM
3708
3709 $spackage contains architecture-dependent library files.  If you are
3710 sharing libraries in a heterogeneous environment, you might store
3711 these files in a separate location.  Otherwise, you can just include
3712 them with the rest of the public library files.
3713
3714 EOM
3715 fn=d+~
3716 rp='Where do you want to put the public architecture-dependent libraries?'
3717 . ./getfile
3718 archlib="$ans"
3719 archlibexp="$ansexp"
3720 if $test X"$archlib" = X"$privlib"; then
3721         d_archlib="$undef"
3722 else
3723         d_archlib="$define"
3724 fi
3725 : Change installation prefix, if necessary.
3726 if $test X"$prefix" != X"$installprefix"; then
3727         installarchlib=`echo $archlibexp | sed "s#^$prefix#$installprefix#"`
3728 else
3729         installarchlib="$archlibexp"
3730 fi
3731
3732
3733 : Binary compatibility with 5.005 is not possible for builds
3734 : with advanced features
3735 case "$usethreads$usemultiplicity" in
3736 *define*)
3737         bincompat5005="$undef"
3738         d_bincompat5005="$undef"
3739         ;;
3740 *)      $cat <<EOM
3741
3742 Perl 5.006 can be compiled for binary compatibility with 5.005.
3743 If you decide to do so, you will be able to continue using most
3744 of the extensions that were compiled for Perl 5.005.
3745
3746 EOM
3747         case "$bincompat5005$d_bincompat5005" in
3748         *"$undef"*) dflt=n ;;
3749         *) dflt=y ;;
3750         esac
3751         rp='Binary compatibility with Perl 5.005?'
3752         . ./myread
3753         case "$ans" in
3754         y*) val="$define" ;;
3755         *)  val="$undef" ;;
3756         esac
3757         set d_bincompat5005
3758         eval $setvar
3759         case "$d_bincompat5005" in
3760         "$define")
3761                 bincompat5005="$define"
3762                 ;;
3763         *)      bincompat5005="$undef"
3764                 d_bincompat5005="$undef"
3765                 ;;
3766         esac
3767         ;;
3768 esac
3769
3770
3771 : see if setuid scripts can be secure
3772 $cat <<EOM
3773
3774 Some kernels have a bug that prevents setuid #! scripts from being
3775 secure.  Some sites have disabled setuid #! scripts because of this.
3776
3777 First let's decide if your kernel supports secure setuid #! scripts.
3778 (If setuid #! scripts would be secure but have been disabled anyway,
3779 don't say that they are secure if asked.)
3780
3781 EOM
3782
3783 val="$undef"
3784 if $test -d /dev/fd; then
3785         echo "#!$ls" >reflect
3786         chmod +x,u+s reflect
3787         ./reflect >flect 2>&1
3788         if $contains "/dev/fd" flect >/dev/null; then
3789                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
3790                 val="$define"
3791         else
3792                 $cat <<EOM
3793 If you are not sure if they are secure, I can check but I'll need a
3794 username and password different from the one you are using right now.
3795 If you don't have such a username or don't want me to test, simply
3796 enter 'none'.
3797
3798 EOM
3799                 rp='Other username to test security of setuid scripts with?'
3800                 dflt='none'
3801                 . ./myread
3802                 case "$ans" in
3803                 n|none)
3804                         case "$d_suidsafe" in
3805                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
3806                                 dflt=n;;
3807                         "$undef")
3808                                 echo "Well, the $hint value is *not* secure." >&4
3809                                 dflt=n;;
3810                         *)      echo "Well, the $hint value *is* secure." >&4
3811                                 dflt=y;;
3812                         esac
3813                         ;;
3814                 *)
3815                         $rm -f reflect flect
3816                         echo "#!$ls" >reflect
3817                         chmod +x,u+s reflect
3818                         echo >flect
3819                         chmod a+w flect
3820                         echo '"su" will (probably) prompt you for '"$ans's password."
3821                         su $ans -c './reflect >flect'
3822                         if $contains "/dev/fd" flect >/dev/null; then
3823                                 echo "Okay, it looks like setuid scripts are secure." >&4
3824                                 dflt=y
3825                         else
3826                                 echo "I don't think setuid scripts are secure." >&4
3827                                 dflt=n
3828                         fi
3829                         ;;
3830                 esac
3831                 rp='Does your kernel have *secure* setuid scripts?'
3832                 . ./myread
3833                 case "$ans" in
3834                 [yY]*)  val="$define";;
3835                 *)      val="$undef";;
3836                 esac
3837         fi
3838 else
3839         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
3840         echo "(That's for file descriptors, not floppy disks.)"
3841         val="$undef"
3842 fi
3843 set d_suidsafe
3844 eval $setvar
3845
3846 $rm -f reflect flect
3847
3848 : now see if they want to do setuid emulation
3849 echo " "
3850 val="$undef"
3851 case "$d_suidsafe" in
3852 "$define")
3853         val="$undef"
3854         echo "No need to emulate SUID scripts since they are secure here." >& 4
3855         ;;
3856 *)
3857         $cat <<EOM
3858 Some systems have disabled setuid scripts, especially systems where
3859 setuid scripts cannot be secure.  On systems where setuid scripts have
3860 been disabled, the setuid/setgid bits on scripts are currently
3861 useless.  It is possible for $package to detect those bits and emulate
3862 setuid/setgid in a secure fashion.  This emulation will only work if
3863 setuid scripts have been disabled in your kernel.
3864
3865 EOM
3866         case "$d_dosuid" in
3867         "$define") dflt=y ;;
3868         *) dflt=n ;;
3869         esac
3870         rp="Do you want to do setuid/setgid emulation?"
3871         . ./myread
3872         case "$ans" in
3873         [yY]*)  val="$define";;
3874         *)      val="$undef";;
3875         esac
3876         ;;
3877 esac
3878 set d_dosuid
3879 eval $setvar
3880
3881 : What should the include directory be ?
3882 echo " "
3883 $echo $n "Hmm...  $c"
3884 dflt='/usr/include'
3885 incpath=''
3886 mips_type=''
3887 if $test -f /bin/mips && /bin/mips; then
3888         echo "Looks like a MIPS system..."
3889         $cat >usr.c <<'EOCP'
3890 #ifdef SYSTYPE_BSD43
3891 /bsd43
3892 #endif
3893 EOCP
3894         if $cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
3895                 dflt='/bsd43/usr/include'
3896                 incpath='/bsd43'
3897                 mips_type='BSD 4.3'
3898         else
3899                 mips_type='System V'
3900         fi
3901         $rm -f usr.c usr.out
3902         echo "and you're compiling with the $mips_type compiler and libraries."
3903         xxx_prompt=y
3904         echo "exit 0" >mips
3905 else
3906         echo "Doesn't look like a MIPS system."
3907         xxx_prompt=n
3908         echo "exit 1" >mips
3909 fi
3910 chmod +x mips
3911 $eunicefix mips
3912 case "$usrinc" in
3913 '') ;;
3914 *) dflt="$usrinc";;
3915 esac
3916 case "$xxx_prompt" in
3917 y)      fn=d/
3918         echo " "
3919         rp='Where are the include files you want to use?'
3920         . ./getfile
3921         usrinc="$ans"
3922         ;;
3923 *)      usrinc="$dflt"
3924         ;;
3925 esac
3926
3927 : see how we invoke the C preprocessor
3928 echo " "
3929 echo "Now, how can we feed standard input to your C preprocessor..." >&4
3930 cat <<'EOT' >testcpp.c
3931 #define ABC abc
3932 #define XYZ xyz
3933 ABC.XYZ
3934 EOT
3935 cd ..
3936 if test ! -f cppstdin; then
3937         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
3938                 # AIX cc -E doesn't show the absolute headerfile
3939                 # locations but we'll cheat by using the -M flag.
3940                 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
3941         else
3942                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
3943         fi
3944 else
3945         echo "Keeping your $hint cppstdin wrapper."
3946 fi
3947 chmod 755 cppstdin
3948 wrapper=`pwd`/cppstdin
3949 ok='false'
3950 cd UU
3951
3952 if $test "X$cppstdin" != "X" && \
3953         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
3954         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3955 then
3956         echo "You used to use $cppstdin $cppminus so we'll use that again."
3957         case "$cpprun" in
3958         '') echo "But let's see if we can live without a wrapper..." ;;
3959         *)
3960                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
3961                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3962                 then
3963                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
3964                         ok='true'
3965                 else
3966                         echo "(However, $cpprun $cpplast does not work, let's see...)"
3967                 fi
3968                 ;;
3969         esac
3970 else
3971         case "$cppstdin" in
3972         '') ;;
3973         *)
3974                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
3975                 ;;
3976         esac
3977 fi
3978
3979 if $ok; then
3980         : nothing
3981 elif echo 'Maybe "'"$cc"' -E" will work...'; \
3982         $cc -E <testcpp.c >testcpp.out 2>&1; \
3983         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3984         echo "Yup, it does."
3985         x_cpp="$cc -E"
3986         x_minus='';
3987 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
3988         $cc -E - <testcpp.c >testcpp.out 2>&1; \
3989         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3990         echo "Yup, it does."
3991         x_cpp="$cc -E"
3992         x_minus='-';
3993 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
3994         $cc -P <testcpp.c >testcpp.out 2>&1; \
3995         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3996         echo "Yipee, that works!"
3997         x_cpp="$cc -P"
3998         x_minus='';
3999 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4000         $cc -P - <testcpp.c >testcpp.out 2>&1; \
4001         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4002         echo "At long last!"
4003         x_cpp="$cc -P"
4004         x_minus='-';
4005 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4006         $cpp <testcpp.c >testcpp.out 2>&1; \
4007         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4008         echo "It works!"
4009         x_cpp="$cpp"
4010         x_minus='';
4011 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4012         $cpp - <testcpp.c >testcpp.out 2>&1; \
4013         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4014         echo "Hooray, it works!  I was beginning to wonder."
4015         x_cpp="$cpp"
4016         x_minus='-';
4017 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
4018         $wrapper <testcpp.c >testcpp.out 2>&1; \
4019         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4020         x_cpp="$wrapper"
4021         x_minus=''
4022         echo "Eureka!"
4023 else
4024         dflt=''
4025         rp="No dice.  I can't find a C preprocessor.  Name one:"
4026         . ./myread
4027         x_cpp="$ans"
4028         x_minus=''
4029         $x_cpp <testcpp.c >testcpp.out 2>&1
4030         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4031                 echo "OK, that will do." >&4
4032         else
4033 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
4034                 exit 1
4035         fi
4036 fi
4037
4038 case "$ok" in
4039 false)
4040         cppstdin="$x_cpp"
4041         cppminus="$x_minus"
4042         cpprun="$x_cpp"
4043         cpplast="$x_minus"
4044         set X $x_cpp
4045         shift
4046         case "$1" in
4047         "$cpp")
4048                 echo "Perhaps can we force $cc -E using a wrapper..."
4049                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4050                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4051                 then
4052                         echo "Yup, we can."
4053                         cppstdin="$wrapper"
4054                         cppminus='';
4055                 else
4056                         echo "Nope, we'll have to live without it..."
4057                 fi
4058                 ;;
4059         esac
4060         case "$cpprun" in
4061         "$wrapper")
4062                 cpprun=''
4063                 cpplast=''
4064                 ;;
4065         esac
4066         ;;
4067 esac
4068
4069 case "$cppstdin" in
4070 "$wrapper"|'cppstdin') ;;
4071 *) $rm -f $wrapper;;
4072 esac
4073 $rm -f testcpp.c testcpp.out
4074
4075 : Set private lib path
4076 case "$plibpth" in
4077 '') if ./mips; then
4078                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
4079         fi;;
4080 esac
4081 case "$libpth" in
4082 ' ') dlist='';;
4083 '') dlist="$loclibpth $plibpth $glibpth";;
4084 *) dlist="$libpth";;
4085 esac
4086
4087 : Now check and see which directories actually exist, avoiding duplicates
4088 libpth=''
4089 for xxx in $dlist
4090 do
4091     if $test -d $xxx; then
4092                 case " $libpth " in
4093                 *" $xxx "*) ;;
4094                 *) libpth="$libpth $xxx";;
4095                 esac
4096     fi
4097 done
4098 $cat <<'EOM'
4099
4100 Some systems have incompatible or broken versions of libraries.  Among
4101 the directories listed in the question below, please remove any you
4102 know not to be holding relevant libraries, and add any that are needed.
4103 Say "none" for none.
4104
4105 EOM
4106 case "$libpth" in
4107 '') dflt='none';;
4108 *)
4109         set X $libpth
4110         shift
4111         dflt=${1+"$@"}
4112         ;;
4113 esac
4114 rp="Directories to use for library searches?"
4115 . ./myread
4116 case "$ans" in
4117 none) libpth=' ';;
4118 *) libpth="$ans";;
4119 esac
4120
4121 : compute shared library extension
4122 case "$so" in
4123 '')
4124         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
4125                 dflt='sl'
4126         else
4127                 dflt='so'
4128         fi
4129         ;;
4130 *) dflt="$so";;
4131 esac
4132 $cat <<EOM
4133
4134 On some systems, shared libraries may be available.  Answer 'none' if
4135 you want to suppress searching of shared libraries for the remaining
4136 of this configuration.
4137
4138 EOM
4139 rp='What is the file extension used for shared libraries?'
4140 . ./myread
4141 so="$ans"
4142
4143 : Define several unixisms.
4144 : Hints files or command line option can be used to override them.
4145 : The convoluted testing is in case hints files set either the old
4146 : or the new name.
4147 case "$_exe" in
4148 '')     case "$exe_ext" in
4149     '') ;;
4150         *)      _exe="$exe_ext" ;;
4151         esac
4152         ;;
4153 esac
4154 case "$_a" in
4155 '')     case "$lib_ext" in
4156     '') _a='.a';;
4157         *)      _a="$lib_ext" ;;
4158         esac
4159         ;;
4160 esac
4161 case "$_o" in
4162 '') case "$obj_ext" in
4163         '')     _o='.o';;
4164         *)      _o="$obj_ext";;
4165         esac
4166         ;;
4167 esac
4168 case "$p_" in
4169 '') case "$path_sep" in
4170         '')     p_=':';;
4171         *)      p_="$path_sep";;
4172         esac
4173         ;;
4174 esac
4175 exe_ext=$_exe
4176 lib_ext=$_a
4177 obj_ext=$_o
4178 path_sep=$p_
4179
4180 : Which makefile gets called first.  This is used by make depend.
4181 case "$firstmakefile" in
4182 '') firstmakefile='makefile';;
4183 esac
4184
4185 cat <<EOM
4186
4187 Perl can be built to use the SOCKS proxy protocol library.  To do so,
4188 Configure must be run with -Dusesocks.
4189
4190 Normally you do not need this and you should answer no.
4191
4192 EOM
4193 case "$usesocks" in
4194 $define|true|[yY]*)     dflt='y';;
4195 *) dflt='n';;
4196 esac
4197 rp='Build Perl for SOCKS?'
4198 . ./myread
4199 case "$ans" in
4200 y|Y)    val="$define" ;;     
4201 *)      val="$undef" ;;
4202 esac
4203 set usesocks
4204 eval $setvar
4205
4206 : Looking for optional libraries
4207 echo " "
4208 echo "Checking for optional libraries..." >&4
4209 case "$libs" in
4210 ' '|'') dflt='';;
4211 *) dflt="$libs";;
4212 esac
4213 case "$libswanted" in
4214 '') libswanted='c_s';;
4215 esac
4216 case "$usesocks" in
4217 $define)
4218         libswanted="$libswanted socks5 socks5_sh"
4219         ;;
4220 esac
4221 for thislib in $libswanted; do
4222         
4223         if xxx=`./loc lib$thislib.$so.[0-9]'*' X $libpth`;
4224                 $test -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
4225                 echo "Found -l$thislib (shared)."
4226                 case " $dflt " in
4227                 *"-l$thislib "*);;
4228                 *) dflt="$dflt -l$thislib";;
4229                 esac
4230         elif xxx=`./loc lib$thislib.$so X $libpth` ; $test -f "$xxx"; then
4231                 echo "Found -l$thislib (shared)."
4232                 case " $dflt " in
4233                 *"-l$thislib "*);;
4234                 *) dflt="$dflt -l$thislib";;
4235                 esac
4236         elif xxx=`./loc lib$thislib$_a X $libpth`; $test -f "$xxx"; then
4237                 echo "Found -l$thislib."
4238                 case " $dflt " in
4239                 *"-l$thislib "*);;
4240                 *) dflt="$dflt -l$thislib";;
4241                 esac
4242         elif xxx=`./loc $thislib$_a X $libpth`; $test -f "$xxx"; then
4243                 echo "Found -l$thislib."
4244                 case " $dflt " in
4245                 *"-l$thislib "*);;
4246                 *) dflt="$dflt -l$thislib";;
4247                 esac
4248         elif xxx=`./loc lib${thislib}_s$_a X $libpth`; $test -f "$xxx"; then
4249                 echo "Found -l${thislib}_s."
4250                 case " $dflt " in
4251                 *"-l$thislib "*);;
4252                 *) dflt="$dflt -l${thislib}_s";;
4253                 esac
4254         elif xxx=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$xxx"; then
4255                 echo "Found -l$thislib."
4256                 case " $dflt " in
4257                 *"-l$thislib "*);;
4258                 *) dflt="$dflt -l$thislib";;
4259                 esac
4260         else
4261                 echo "No -l$thislib."
4262         fi
4263 done
4264 set X $dflt
4265 shift
4266 dflt="$*"
4267 case "$libs" in
4268 '') dflt="$dflt";;
4269 *) dflt="$libs";;
4270 esac
4271 case "$dflt" in
4272 ' '|'') dflt='none';;
4273 esac
4274
4275 $cat <<EOM
4276
4277 In order to compile $package on your machine, a number of libraries
4278 are usually needed.  Include any other special libraries here as well.
4279 Say "none" for none.  The default list is almost always right.
4280 EOM
4281
4282 echo " "
4283 rp="What libraries to use?"
4284 . ./myread
4285 case "$ans" in
4286 none) libs=' ';;
4287 *) libs="$ans";;
4288 esac
4289
4290 : determine optimization, if desired, or use for debug flag also
4291 case "$optimize" in
4292 ' '|$undef) dflt='none';;
4293 '') dflt='-O';;
4294 *) dflt="$optimize";;
4295 esac
4296 $cat <<EOH
4297
4298 By default, $package compiles with the -O flag to use the optimizer.
4299 Alternately, you might want to use the symbolic debugger, which uses
4300 the -g flag (on traditional Unix systems).  Either flag can be
4301 specified here.  To use neither flag, specify the word "none".
4302
4303 EOH
4304 rp="What optimizer/debugger flag should be used?"
4305 . ./myread
4306 optimize="$ans"
4307 case "$optimize" in
4308 'none') optimize=" ";;
4309 esac
4310
4311 dflt=''
4312 : We will not override a previous value, but we might want to
4313 : augment a hint file
4314 case "$hint" in
4315 default|recommended)
4316         case "$gccversion" in
4317         1*) dflt='-fpcc-struct-return' ;;
4318         esac
4319         case "$optimize" in
4320         *-g*) dflt="$dflt -DDEBUGGING";;
4321         esac
4322         case "$gccversion" in
4323         2*) if test -d /etc/conf/kconfig.d &&
4324                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
4325                 then
4326                         dflt="$dflt -posix"
4327                 fi
4328                 ;;
4329         esac
4330         case "$gccversion" in
4331         1*) ;;
4332         2.[0-8]*) ;;
4333         ?*)     echo " "
4334                 echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
4335                 echo 'int main(void) { return 0; }' > gcctest.c
4336                 if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
4337                         echo "Yes, it does." 2>&1
4338                         case "$ccflags" in
4339                         *strict-aliasing*) 
4340                                 echo "Leaving current flags $ccflags alone." 2>&1
4341                                 ;;
4342                         *) dflt="$dflt -fno-strict-aliasing" ;;
4343                         esac
4344                 else
4345                         echo "Nope, it doesn't, but that's ok." 2>&1
4346                 fi
4347                 ;;
4348         esac
4349         ;;
4350 esac
4351
4352 case "$mips_type" in
4353 *BSD*|'') inclwanted="$locincpth $usrinc";;
4354 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
4355 esac
4356 for thisincl in $inclwanted; do
4357         if $test -d $thisincl; then
4358                 if $test x$thisincl != x$usrinc; then
4359                         case "$dflt" in
4360                         *$thisincl*);;
4361                         *) dflt="$dflt -I$thisincl";;
4362                         esac
4363                 fi
4364         fi
4365 done
4366
4367 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
4368         xxx=true;
4369 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
4370         xxx=true;
4371 else
4372         xxx=false;
4373 fi;
4374 if $xxx; then
4375         case "$dflt" in
4376         *$2*);;
4377         *) dflt="$dflt -D$2";;
4378         esac;
4379 fi'
4380
4381 set signal.h LANGUAGE_C; eval $inctest
4382
4383 case "$usesocks" in
4384 $define)
4385         ccflags="$ccflags -DSOCKS"
4386         ;;
4387 esac
4388
4389 case "$hint" in
4390 default|recommended) dflt="$ccflags $dflt" ;;
4391 *) dflt="$ccflags";;
4392 esac
4393
4394 case "$dflt" in
4395 ''|' ') dflt=none;;
4396 esac
4397 $cat <<EOH
4398
4399 Your C compiler may want other flags.  For this question you should include
4400 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
4401 but you should NOT include libraries or ld flags like -lwhatever.  If you
4402 want $package to honor its debug switch, you should include -DDEBUGGING here.
4403 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
4404
4405 To use no flags, specify the word "none".
4406
4407 EOH
4408 set X $dflt
4409 shift
4410 dflt=${1+"$@"}
4411 rp="Any additional cc flags?"
4412 . ./myread
4413 case "$ans" in
4414 none) ccflags='';;
4415 *) ccflags="$ans";;
4416 esac
4417
4418 : the following weeds options from ccflags that are of no interest to cpp
4419 cppflags="$ccflags"
4420 case "$gccversion" in
4421 1*) cppflags="$cppflags -D__GNUC__"
4422 esac
4423 case "$mips_type" in
4424 '');;
4425 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
4426 esac
4427 case "$cppflags" in
4428 '');;
4429 *)
4430         echo " "
4431         echo "Let me guess what the preprocessor flags are..." >&4
4432         set X $cppflags
4433         shift
4434         cppflags=''
4435         $cat >cpp.c <<'EOM'
4436 #define BLURFL foo
4437
4438 BLURFL xx LFRULB
4439 EOM
4440         previous=''
4441         for flag in $*
4442         do
4443                 case "$flag" in
4444                 -*) ftry="$flag";;
4445                 *) ftry="$previous $flag";;
4446                 esac
4447                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
4448                         >cpp1.out 2>/dev/null && \
4449                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
4450                         >cpp2.out 2>/dev/null && \
4451                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
4452                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
4453                 then
4454                         cppflags="$cppflags $ftry"
4455                         previous=''
4456                 else
4457                         previous="$flag"
4458                 fi
4459         done
4460         set X $cppflags
4461         shift
4462         cppflags=${1+"$@"}
4463         case "$cppflags" in
4464         *-*)  echo "They appear to be: $cppflags";;
4465         esac
4466         $rm -f cpp.c cpp?.out
4467         ;;
4468 esac
4469
4470 : flags used in final linking phase
4471 case "$ldflags" in
4472 '') if ./venix; then
4473                 dflt='-i -z'
4474         else
4475                 dflt=''
4476         fi
4477         case "$ccflags" in
4478         *-posix*) dflt="$dflt -posix" ;;
4479         esac
4480         ;;
4481 *) dflt="$ldflags";;
4482 esac
4483
4484 : Try to guess additional flags to pick up local libraries.
4485 for thislibdir in $libpth; do
4486         case " $loclibpth " in
4487         *" $thislibdir "*)
4488                 case "$dflt " in 
4489                 *"-L$thislibdir "*) ;;
4490                 *)  dflt="$dflt -L$thislibdir" ;;
4491                 esac
4492                 ;;
4493         esac
4494 done
4495
4496 case "$dflt" in
4497 '') dflt='none' ;;
4498 esac
4499
4500 $cat <<EOH
4501
4502 Your C linker may need flags.  For this question you should
4503 include -L/whatever and any other flags used by the C linker, but you
4504 should NOT include libraries like -lwhatever.
4505
4506 Make sure you include the appropriate -L/path flags if your C linker
4507 does not normally search all of the directories you specified above,
4508 namely
4509         $libpth
4510 To use no flags, specify the word "none".
4511
4512 EOH
4513
4514 rp="Any additional ld flags (NOT including libraries)?"
4515 . ./myread
4516 case "$ans" in
4517 none) ldflags='';;
4518 *) ldflags="$ans";;
4519 esac
4520 rmlist="$rmlist pdp11"
4521
4522 : coherency check
4523 echo " "
4524 echo "Checking your choice of C compiler and flags for coherency..." >&4
4525 $cat > try.c <<'EOF'
4526 #include <stdio.h>
4527 int main() { printf("Ok\n"); exit(0); }
4528 EOF
4529 set X $cc $optimize $ccflags -o try $ldflags try.c $libs
4530 shift
4531 $cat >try.msg <<'EOM'
4532 I've tried to compile and run the following simple program:
4533
4534 EOM
4535 $cat try.c >> try.msg
4536
4537 $cat >> try.msg <<EOM
4538
4539 I used the command:
4540
4541         $*
4542         ./try
4543
4544 and I got the following output:
4545
4546 EOM
4547 dflt=y
4548 if sh -c "$cc $optimize $ccflags -o try $ldflags try.c $libs" >>try.msg 2>&1; then
4549         if sh -c './try' >>try.msg 2>&1; then
4550                 xxx=`./try`
4551                 case "$xxx" in
4552                 "Ok") dflt=n ;;
4553                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
4554                         case " $libs " in
4555                         *" -lsfio "*)
4556                                 cat >> try.msg <<'EOQS'
4557 If $libs contains -lsfio, and sfio is mis-configured, then it
4558 sometimes (apparently) runs and exits with a 0 status, but with no
4559 output!  It may have to do with sfio's use of _exit vs. exit.
4560
4561 EOQS
4562                                 rp="You have a big problem.  Shall I abort Configure"
4563                                 dflt=y
4564                                 ;;
4565                         esac
4566                         ;;
4567                 esac
4568         else
4569                 echo "The program compiled OK, but exited with status $?." >>try.msg
4570                 rp="You have a problem.  Shall I abort Configure"
4571                 dflt=y
4572         fi
4573 else
4574         echo "I can't compile the test program." >>try.msg
4575         rp="You have a BIG problem.  Shall I abort Configure"
4576         dflt=y
4577 fi
4578 case "$dflt" in
4579 y)
4580         $cat try.msg >&4
4581         case "$knowitall" in
4582         '')
4583                 echo "(The supplied flags or libraries might be incorrect.)"
4584                 ;;
4585         *) dflt=n;;
4586         esac
4587         echo " "
4588         . ./myread
4589         case "$ans" in
4590         n*|N*) ;;
4591         *)      echo "Ok.  Stopping Configure." >&4
4592                 exit 1
4593                 ;;
4594         esac
4595         ;;
4596 n) echo "OK, that should do.";;
4597 esac
4598 $rm -f try try.* core
4599
4600 : determine filename position in cpp output
4601 echo " "
4602 echo "Computing filename position in cpp output for #include directives..." >&4
4603 echo '#include <stdio.h>' > foo.c
4604 $cat >fieldn <<EOF
4605 $startsh
4606 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
4607 $grep '^[       ]*#.*stdio\.h' | \
4608 while read cline; do
4609         pos=1
4610         set \$cline
4611         while $test \$# -gt 0; do
4612                 if $test -r \`echo \$1 | $tr -d '"'\`; then
4613                         echo "\$pos"
4614                         exit 0
4615                 fi
4616                 shift
4617                 pos=\`expr \$pos + 1\`
4618         done
4619 done
4620 EOF
4621 chmod +x fieldn
4622 fieldn=`./fieldn`
4623 $rm -f foo.c fieldn
4624 case $fieldn in
4625 '') pos='???';;
4626 1) pos=first;;
4627 2) pos=second;;
4628 3) pos=third;;
4629 *) pos="${fieldn}th";;
4630 esac
4631 echo "Your cpp writes the filename in the $pos field of the line."
4632
4633 : locate header file
4634 $cat >findhdr <<EOF
4635 $startsh
4636 wanted=\$1
4637 name=''
4638 for usrincdir in $usrinc
4639 do
4640         if test -f \$usrincdir/\$wanted; then
4641                 echo "\$usrincdir/\$wanted"
4642                 exit 0
4643         fi
4644 done
4645 awkprg='{ print \$$fieldn }'
4646 echo "#include <\$wanted>" > foo\$\$.c
4647 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
4648 $grep "^[       ]*#.*\$wanted" | \
4649 while read cline; do
4650         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
4651         case "\$name" in
4652         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
4653         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
4654         *) exit 2;;
4655         esac;
4656 done;
4657 #
4658 # status = 0: grep returned 0 lines, case statement not executed
4659 # status = 1: headerfile found
4660 # status = 2: while loop executed, no headerfile found
4661 #
4662 status=\$?
4663 $rm -f foo\$\$.c;
4664 if test \$status -eq 1; then
4665         exit 0;
4666 fi
4667 exit 1
4668 EOF
4669 chmod +x findhdr
4670
4671 : define an alternate in-header-list? function
4672 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
4673 cont=true; xxf="echo \"<\$1> found.\" >&4";
4674 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
4675 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
4676 esac;
4677 case $# in 4) instead=instead;; *) instead="at last";; esac;
4678 while $test "$cont"; do
4679         xxx=`./findhdr $1`
4680         var=$2; eval "was=\$$2";
4681         if $test "$xxx" && $test -r "$xxx";
4682         then eval $xxf;
4683         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
4684                 cont="";
4685         else eval $xxnf;
4686         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
4687         set $yyy; shift; shift; yyy=$@;
4688         case $# in 0) cont="";;
4689         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
4690                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
4691         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
4692                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
4693         esac;
4694 done;
4695 while $test "$yyy";
4696 do set $yyy; var=$2; eval "was=\$$2";
4697         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
4698         set $yyy; shift; shift; yyy=$@;
4699 done'
4700
4701 : see if this is a malloc.h system
4702 set malloc.h i_malloc
4703 eval $inhdr
4704
4705 : see if stdlib is available
4706 set stdlib.h i_stdlib
4707 eval $inhdr
4708
4709 : determine which malloc to compile in
4710 echo " "
4711 case "$usemymalloc" in
4712 ''|[yY]*|true|$define)  dflt='y' ;;
4713 *)      dflt='n' ;;
4714 esac
4715 rp="Do you wish to attempt to use the malloc that comes with $package?"
4716 . ./myread
4717 usemymalloc="$ans"
4718 case "$ans" in
4719 y*|true)
4720         usemymalloc='y'
4721         mallocsrc='malloc.c'
4722         mallocobj="malloc$_o"
4723         d_mymalloc="$define"
4724         case "$libs" in
4725         *-lmalloc*)
4726                 : Remove malloc from list of libraries to use
4727                 echo "Removing unneeded -lmalloc from library list" >&4
4728                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
4729                 shift
4730                 libs="$*"
4731                 echo "libs = $libs" >&4
4732                 ;;
4733         esac
4734         ;;
4735 *)
4736         usemymalloc='n'
4737         mallocsrc=''
4738         mallocobj=''
4739         d_mymalloc="$undef"
4740         ;;
4741 esac
4742
4743 : compute the return types of malloc and free
4744 echo " "
4745 $cat >malloc.c <<END
4746 #$i_malloc I_MALLOC
4747 #$i_stdlib I_STDLIB
4748 #include <stdio.h>
4749 #include <sys/types.h>
4750 #ifdef I_MALLOC
4751 #include <malloc.h>
4752 #endif
4753 #ifdef I_STDLIB
4754 #include <stdlib.h>
4755 #endif
4756 #ifdef TRY_MALLOC
4757 void *malloc();
4758 #endif
4759 #ifdef TRY_FREE
4760 void free();
4761 #endif
4762 END
4763 case "$malloctype" in
4764 '')
4765         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
4766                 malloctype='void *'
4767         else
4768                 malloctype='char *'
4769         fi
4770         ;;
4771 esac
4772 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
4773
4774 case "$freetype" in
4775 '')
4776         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
4777                 freetype='void'
4778         else
4779                 freetype='int'
4780         fi
4781         ;;
4782 esac
4783 echo "Your system uses $freetype free(), it would seem." >&4
4784 $rm -f malloc.[co]
4785 $cat <<EOM
4786
4787 The installation process will also create a directory for
4788 vendor-supplied add-ons.  Vendors who supply perl with their system
4789 may find it convenient to place all vendor-supplied files in this
4790 directory rather than in the main distribution directory.  This will
4791 ease upgrades between binary-compatible maintenance versions of perl.
4792
4793 Of course you may also use these directories in whatever way you see
4794 fit.  For example, you might use them to access modules shared over a
4795 company-wide network.
4796
4797 The default answer should be fine for most people.
4798 This causes further questions about vendor add-ons to be skipped
4799 and no vendor-specific directories will be configured for perl.
4800
4801 EOM
4802 rp='Do you want to configure vendor-specific add-on directories?'
4803 case "$usevendorprefix" in
4804 define|true|[yY]*) dflt=y ;;
4805 *) dflt=n ;;
4806 esac
4807 . ./myread
4808 case "$ans" in
4809 [yY]*)  fn=d~+
4810         rp='Installation prefix to use for vendor-supplied add-ons?'
4811         case "$vendorprefix" in
4812         '') dflt='' ;;
4813         *)  dflt=$vendorprefix ;;
4814         esac
4815         . ./getfile
4816         oldvendorprefix=''
4817         case "$vendorprefix" in
4818         '') ;;
4819         *)      case "$ans" in
4820                 "$prefix") ;;
4821                 *) oldvendorprefix="$prefix";;
4822                 esac
4823                 ;;
4824         esac
4825         usevendorprefix="$define"
4826         vendorprefix="$ans"
4827         vendorprefixexp="$ansexp"
4828         ;;
4829 *)      usevendorprefix="$undef"
4830         vendorprefix=''
4831         vendorprefixexp=''
4832         ;;
4833 esac
4834
4835 case "$vendorprefix" in
4836 '')     d_vendorlib="$undef"
4837         vendorlib=''
4838         vendorlibexp=''
4839         ;;
4840 *)      d_vendorlib="$define"
4841         : determine where vendor-supplied modules go.
4842         : Usual default is /usr/local/lib/perl5/vendor_perl
4843         prog=`echo $package | $sed 's/-*[0-9.]*$//'`
4844         case "$installstyle" in
4845         *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog ;;
4846         *)           dflt=$vendorprefix/lib/vendor_$prog ;;
4847         esac
4848         fn=d~+
4849         rp='Pathname for the vendor-supplied library files?'
4850         . ./getfile
4851         vendorlib="$ans"
4852         vendorlibexp="$ansexp"
4853         : Change installation prefix, if necessary.
4854         if $test X"$prefix" != X"$installprefix"; then
4855                 installvendorlib=`echo $vendorlibexp | $sed "s#^$prefix#$installprefix#"`
4856         else
4857                 installvendorlib="$vendorlibexp"
4858         fi
4859         ;;
4860 esac
4861
4862 : Cruising for prototypes
4863 echo " "
4864 echo "Checking out function prototypes..." >&4
4865 $cat >prototype.c <<'EOCP'
4866 int main(int argc, char *argv[]) {
4867         exit(0);}
4868 EOCP
4869 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
4870         echo "Your C compiler appears to support function prototypes."
4871         val="$define"
4872 else
4873         echo "Your C compiler doesn't seem to understand function prototypes."
4874         val="$undef"
4875 fi
4876 set prototype
4877 eval $setvar
4878 $rm -f prototype*
4879
4880 case "$prototype" in
4881 "$define") ;;
4882 *)      ansi2knr='ansi2knr'
4883         echo " "
4884         cat <<EOM >&4
4885
4886 $me:  FATAL ERROR:
4887 This version of $package can only be compiled by a compiler that 
4888 understands function prototypes.  Unfortunately, your C compiler 
4889         $cc $ccflags
4890 doesn't seem to understand them.  Sorry about that.
4891
4892 If GNU cc is available for your system, perhaps you could try that instead.  
4893
4894 Eventually, we hope to support building Perl with pre-ANSI compilers.
4895 If you would like to help in that effort, please contact <perlbug@perl.org>.
4896
4897 Aborting Configure now.
4898 EOM
4899         exit 2
4900         ;;
4901 esac
4902
4903 : determine where public executables go
4904 echo " "
4905 set dflt bin bin
4906 eval $prefixit
4907 fn=d~
4908 rp='Pathname where the public executables will reside?'
4909 . ./getfile
4910 if $test "X$ansexp" != "X$binexp"; then
4911         installbin=''
4912 fi
4913 bin="$ans"
4914 binexp="$ansexp"
4915 : Change installation prefix, if necessary.
4916 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
4917 if $test X"$prefix" != X"$installprefix"; then
4918         installbin=`echo $binexp | sed "s#^$prefix#$installprefix#"`
4919 else
4920         installbin="$binexp"
4921 fi
4922
4923 : determine whether to install perl also as /usr/bin/perl
4924
4925 echo " "
4926 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
4927         $cat <<EOM
4928 Many scripts expect to perl to be installed as /usr/bin/perl.
4929 I can install the perl you are about to compile also as /usr/bin/perl
4930 (in addition to $installbin/perl).
4931 EOM
4932         case "$installusrbinperl" in
4933         "$undef"|[nN]*) dflt='n';;
4934         *)              dflt='y';;
4935         esac
4936         rp="Do you want to install perl as /usr/bin/perl?"
4937         . ./myread
4938         case "$ans" in
4939         [yY]*)  val="$define";;
4940         *)      val="$undef" ;;
4941         esac
4942 else
4943         val="$undef"
4944 fi
4945 set installusrbinperl
4946 eval $setvar
4947
4948 : define a shorthand compile call
4949 compile='
4950 mc_file=$1;
4951 shift;
4952 $cc $optimize $ccflags $ldflags -o ${mc_file} $* ${mc_file}.c $libs > /dev/null 2>&1;'
4953 : define a shorthand compile call for compilations that should be ok.
4954 compile_ok='
4955 mc_file=$1;
4956 shift;
4957 $cc $optimize $ccflags $ldflags -o ${mc_file} $* ${mc_file}.c $libs;'
4958
4959 echo " "
4960 echo "Checking for GNU C Library..." >&4
4961 cat >gnulibc.c <<EOM
4962 #include <stdio.h>
4963 int main()
4964 {
4965 #ifdef __GLIBC__
4966     exit(0);
4967 #else
4968     exit(1);
4969 #endif
4970 }
4971 EOM
4972 set gnulibc
4973 if eval $compile_ok && ./gnulibc; then
4974         val="$define"
4975         echo "You are using the GNU C Library"
4976 else
4977         val="$undef"
4978         echo "You are not using the GNU C Library"
4979 fi
4980 $rm -f gnulibc*
4981 set d_gnulibc
4982 eval $setvar
4983
4984 : see if nm is to be used to determine whether a symbol is defined or not
4985 case "$usenm" in
4986 '')
4987         dflt=''
4988         case "$d_gnulibc" in
4989         "$define")
4990                 echo " "
4991                 echo "nm probably won't work on the GNU C Library." >&4
4992                 dflt=n
4993                 ;;
4994         esac
4995         case "$dflt" in
4996         '') 
4997                 if $test "$osname" = aix -a ! -f /lib/syscalls.exp; then
4998                         echo " "
4999                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
5000                         echo "'nm' won't be sufficient on this sytem." >&4
5001                         dflt=n
5002                 fi
5003                 ;;
5004         esac
5005         case "$dflt" in
5006         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
5007                 if $test $dflt -gt 20; then
5008                         dflt=y
5009                 else
5010                         dflt=n
5011                 fi
5012                 ;;
5013         esac
5014         ;;
5015 *)
5016         case "$usenm" in
5017         true|$define) dflt=y;;
5018         *) dflt=n;;
5019         esac
5020         ;;
5021 esac
5022 $cat <<EOM
5023
5024 I can use $nm to extract the symbols from your C libraries. This
5025 is a time consuming task which may generate huge output on the disk (up
5026 to 3 megabytes) but that should make the symbols extraction faster. The
5027 alternative is to skip the 'nm' extraction part and to compile a small
5028 test program instead to determine whether each symbol is present. If
5029 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
5030 this may be the best solution.
5031
5032 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
5033
5034 EOM
5035 rp="Shall I use $nm to extract C symbols from the libraries?"
5036 . ./myread
5037 case "$ans" in
5038 [Nn]*) usenm=false;;
5039 *) usenm=true;;
5040 esac
5041
5042 runnm=$usenm
5043 case "$reuseval" in
5044 true) runnm=false;;
5045 esac
5046
5047 : nm options which may be necessary
5048 case "$nm_opt" in
5049 '') if $test -f /mach_boot; then
5050                 nm_opt=''       # Mach
5051         elif $test -d /usr/ccs/lib; then
5052                 nm_opt='-p'     # Solaris (and SunOS?)
5053         elif $test -f /dgux; then
5054                 nm_opt='-p'     # DG-UX
5055         elif $test -f /lib64/rld; then
5056                 nm_opt='-p'     # 64-bit Irix
5057         else
5058                 nm_opt=''
5059         fi;;
5060 esac
5061
5062 : nm options which may be necessary for shared libraries but illegal
5063 : for archive libraries.  Thank you, Linux.
5064 case "$nm_so_opt" in
5065 '')     case "$myuname" in
5066         *linux*)
5067                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
5068                         nm_so_opt='--dynamic'
5069                 fi
5070                 ;;
5071         esac
5072         ;;
5073 esac
5074
5075 case "$runnm" in
5076 true)
5077 : get list of predefined functions in a handy place
5078 echo " "
5079 case "$libc" in
5080 '') libc=unknown
5081         case "$libs" in
5082         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
5083         esac
5084         ;;
5085 esac
5086 libnames='';
5087 case "$libs" in
5088 '') ;;
5089 *)  for thislib in $libs; do
5090         case "$thislib" in
5091         -lc|-lc_s)
5092                 : Handle C library specially below.
5093                 ;;
5094         -l*)
5095                 thislib=`echo $thislib | $sed -e 's/^-l//'`
5096                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
5097                         :
5098                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
5099                         :
5100                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
5101                         :
5102                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
5103                         :
5104                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
5105                         :
5106                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
5107                         :
5108                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
5109                         :
5110                 else
5111                         try=''
5112                 fi
5113                 libnames="$libnames $try"
5114                 ;;
5115         *) libnames="$libnames $thislib" ;;
5116         esac
5117         done
5118         ;;
5119 esac
5120 xxx=normal
5121 case "$libc" in
5122 unknown)
5123         set /lib/libc.$so
5124         for xxx in $libpth; do
5125                 $test -r $1 || set $xxx/libc.$so
5126                 : The messy sed command sorts on library version numbers.
5127                 $test -r $1 || \
5128                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
5129                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
5130                                 h
5131                                 s/[0-9][0-9]*/0000&/g
5132                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
5133                                 G
5134                                 s/\n/ /' | \
5135                          sort | $sed -e 's/^.* //'`
5136                 eval set \$$#
5137         done
5138         $test -r $1 || set /usr/ccs/lib/libc.$so
5139         $test -r $1 || set /lib/libsys_s$_a
5140         ;;
5141 *)
5142         set blurfl
5143         ;;
5144 esac
5145 if $test -r "$1"; then
5146         echo "Your (shared) C library seems to be in $1."
5147         libc="$1"
5148 elif $test -r /lib/libc && $test -r /lib/clib; then
5149         echo "Your C library seems to be in both /lib/clib and /lib/libc."
5150         xxx=apollo
5151         libc='/lib/clib /lib/libc'
5152         if $test -r /lib/syslib; then
5153                 echo "(Your math library is in /lib/syslib.)"
5154                 libc="$libc /lib/syslib"
5155         fi
5156 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5157         echo "Your C library seems to be in $libc, as you said before."
5158 elif $test -r $incpath/usr/lib/libc$_a; then
5159         libc=$incpath/usr/lib/libc$_a;
5160         echo "Your C library seems to be in $libc.  That's fine."
5161 elif $test -r /lib/libc$_a; then
5162         libc=/lib/libc$_a;
5163         echo "Your C library seems to be in $libc.  You're normal."
5164 else
5165         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
5166                 :
5167         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
5168                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
5169         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
5170                 :
5171         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5172                 :
5173         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5174                 :
5175         else
5176                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
5177         fi
5178         if $test -r "$tans"; then
5179                 echo "Your C library seems to be in $tans, of all places."
5180                 libc=$tans
5181         else
5182                 libc='blurfl'
5183         fi
5184 fi
5185 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5186         dflt="$libc"
5187         cat <<EOM
5188
5189 If the guess above is wrong (which it might be if you're using a strange
5190 compiler, or your machine supports multiple models), you can override it here.
5191
5192 EOM
5193 else
5194         dflt=''
5195         echo $libpth | tr ' ' $trnl | sort | uniq > libpath
5196         cat >&4 <<EOM
5197 I can't seem to find your C library.  I've looked in the following places:
5198
5199 EOM
5200         $sed 's/^/      /' libpath
5201         cat <<EOM
5202
5203 None of these seems to contain your C library. I need to get its name...
5204
5205 EOM
5206 fi
5207 fn=f
5208 rp='Where is your C library?'
5209 . ./getfile
5210 libc="$ans"
5211
5212 echo " "
5213 echo $libc $libnames | tr ' ' $trnl | sort | uniq > libnames
5214 set X `cat libnames`
5215 shift
5216 xxx=files
5217 case $# in 1) xxx=file; esac
5218 echo "Extracting names from the following $xxx for later perusal:" >&4
5219 echo " "
5220 $sed 's/^/      /' libnames >&4
5221 echo " "
5222 $echo $n "This may take a while...$c" >&4
5223
5224 for file in $*; do
5225         case $file in
5226         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
5227         *) $nm $nm_opt $file 2>/dev/null;;
5228         esac
5229 done >libc.tmp
5230
5231 $echo $n ".$c"
5232 $grep fprintf libc.tmp > libc.ptf
5233 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
5234 xrun='eval "<libc.tmp $com >libc.list"; echo "done" >&4'
5235 xxx='[ADTSIW]'
5236 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *_[_.]*//p' -e 's/^.* $xxx  *//p'";\
5237         eval $xscan;\
5238         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5239                 eval $xrun
5240 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
5241         eval $xscan;\
5242         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5243                 eval $xrun
5244 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
5245         eval $xscan;\
5246         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5247                 eval $xrun
5248 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
5249         eval $xscan;\
5250         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5251                 eval $xrun
5252 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
5253         eval $xscan;\
5254         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5255                 eval $xrun
5256 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
5257         eval $xscan;\
5258         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5259                 eval $xrun
5260 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
5261                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
5262         eval $xscan;\
5263         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5264                 eval $xrun
5265 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
5266         eval $xscan;\
5267         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5268                 eval $xrun
5269 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
5270         eval $xscan;\
5271         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5272                 eval $xrun
5273 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
5274         eval $xscan;\
5275         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5276                 eval $xrun
5277 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
5278         eval $xscan;\
5279         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5280                 eval $xrun
5281 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
5282         eval $xscan;\
5283         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5284                 eval $xrun
5285 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
5286         eval $xscan;\
5287         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5288                 eval $xrun
5289 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
5290         eval $xscan;\
5291         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5292                 eval $xrun
5293 else
5294         $nm -p $* 2>/dev/null >libc.tmp
5295         $grep fprintf libc.tmp > libc.ptf
5296         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
5297                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
5298         then
5299                 nm_opt='-p'
5300                 eval $xrun
5301         else
5302                 echo " "
5303                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
5304                 com=''
5305                 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
5306                         for thisname in $libnames $libc; do
5307                                 $ar t $thisname >>libc.tmp
5308                         done
5309                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
5310                         echo "Ok." >&4
5311                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
5312                         # Repeat libc to extract forwarders to DLL entries too
5313                         for thisname in $libnames $libc; do
5314                                 $ar tv $thisname >>libc.tmp
5315                                 # Revision 50 of EMX has bug in $ar.
5316                                 # it will not extract forwarders to DLL entries
5317                                 # Use emximp which will extract exactly them.
5318                                 emximp -o tmp.imp $thisname \
5319                                     2>/dev/null && \
5320                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
5321                                     < tmp.imp >>libc.tmp
5322                                 $rm tmp.imp
5323                         done
5324                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
5325                         echo "Ok." >&4
5326                 else
5327                         echo "$ar didn't seem to work right." >&4
5328                         echo "Maybe this is a Cray...trying bld instead..." >&4
5329                         if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
5330                         then
5331                                 for thisname in $libnames; do
5332                                         bld t $libnames | \
5333                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
5334                                         $ar t $thisname >>libc.tmp
5335                                 done
5336                                 echo "Ok." >&4
5337                         else
5338                                 echo "That didn't work either.  Giving up." >&4
5339                                 exit 1
5340                         fi
5341                 fi
5342         fi
5343 fi
5344 nm_extract="$com"
5345 if $test -f /lib/syscalls.exp; then
5346         echo " "
5347         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
5348         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*$/\1/p' /lib/syscalls.exp >>libc.list
5349 fi
5350 ;;
5351 esac
5352 $rm -f libnames libpath
5353
5354 : see if dld is available
5355 set dld.h i_dld
5356 eval $inhdr
5357
5358 : is a C symbol defined?
5359 csym='tlook=$1;
5360 case "$3" in
5361 -v) tf=libc.tmp; tc=""; tdc="";;
5362 -a) tf=libc.tmp; tc="[0]"; tdc="[]";;
5363 *) tlook="^$1\$"; tf=libc.list; tc="()"; tdc="()";;
5364 esac;
5365 tx=yes;
5366 case "$reuseval-$4" in
5367 true-) ;;
5368 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
5369 esac;
5370 case "$tx" in
5371 yes)
5372         case "$runnm" in
5373         true)
5374                 if $contains $tlook $tf >/dev/null 2>&1;
5375                 then tval=true;
5376                 else tval=false;
5377                 fi;;
5378         *)
5379                 echo "int main() { extern short $1$tdc; printf(\"%hd\", $1$tc); }" > t.c;
5380                 if $cc $optimize $ccflags $ldflags -o t t.c $libs >/dev/null 2>&1;
5381                 then tval=true;
5382                 else tval=false;
5383                 fi;
5384                 $rm -f t t.c;;
5385         esac;;
5386 *)
5387         case "$tval" in
5388         $define) tval=true;;
5389         *) tval=false;;
5390         esac;;
5391 esac;
5392 eval "$2=$tval"'
5393
5394 : define an is-in-libc? function
5395 inlibc='echo " "; td=$define; tu=$undef;
5396 sym=$1; var=$2; eval "was=\$$2";
5397 tx=yes;
5398 case "$reuseval$was" in
5399 true) ;;
5400 true*) tx=no;;
5401 esac;
5402 case "$tx" in
5403 yes)
5404         set $sym tres -f;
5405         eval $csym;
5406         case "$tres" in
5407         true)
5408                 echo "$sym() found." >&4;
5409                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
5410         *)
5411                 echo "$sym() NOT found." >&4;
5412                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
5413         esac;;
5414 *)
5415         case "$was" in
5416         $define) echo "$sym() found." >&4;;
5417         *) echo "$sym() NOT found." >&4;;
5418         esac;;
5419 esac'
5420
5421 : see if dlopen exists
5422 xxx_runnm="$runnm"
5423 runnm=false
5424 set dlopen d_dlopen
5425 eval $inlibc
5426 runnm="$xxx_runnm"
5427
5428 : determine which dynamic loading, if any, to compile in
5429 echo " "
5430 dldir="ext/DynaLoader"
5431 case "$usedl" in
5432 $define|y|true)
5433         dflt='y'
5434         usedl="$define"
5435         ;;
5436 $undef|n|false)
5437         dflt='n'
5438         usedl="$undef"
5439         ;;
5440 *) 
5441         dflt='n'
5442         case "$d_dlopen" in
5443             $define) dflt='y' ;;
5444         esac
5445         case "$i_dld" in
5446             $define) dflt='y' ;;
5447         esac
5448         : Does a dl_xxx.xs file exist for this operating system
5449         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
5450         ;;
5451 esac
5452 rp="Do you wish to use dynamic loading?"
5453 . ./myread
5454 usedl="$ans"
5455 case "$ans" in
5456 y*) usedl="$define"
5457         case "$dlsrc" in
5458         '')
5459                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
5460                         dflt="$dldir/dl_${osname}.xs"
5461                 elif $test "$d_dlopen" = "$define" ; then
5462                         dflt="$dldir/dl_dlopen.xs"
5463                 elif $test "$i_dld" = "$define" ; then
5464                         dflt="$dldir/dl_dld.xs"
5465                 else
5466                         dflt=''
5467                 fi
5468                 ;;
5469         *)      dflt="$dldir/$dlsrc"
5470                 ;;
5471         esac
5472     echo "The following dynamic loading files are available:"
5473         : Can not go over to $dldir because getfile has path hard-coded in.
5474         tdir=`pwd`; cd $rsrc; $ls -C $dldir/dl*.xs; cd $tdir
5475         rp="Source file to use for dynamic loading"
5476         fn="fne"
5477         gfpth="$src"
5478         . ./getfile
5479         usedl="$define"
5480         : emulate basename
5481         dlsrc=`echo $ans | $sed -e 's@.*/\([^/]*\)$@\1@'`
5482
5483         $cat << EOM
5484
5485 Some systems may require passing special flags to $cc -c to
5486 compile modules that will be used to create a shared library.
5487 To use no flags, say "none".
5488
5489 EOM
5490     case "$cccdlflags" in
5491     '') case "$gccversion" in
5492                 '') case "$osname" in
5493                         hpux)   dflt='+z' ;;
5494                         next)   dflt='none' ;;
5495                         irix*)  dflt='-KPIC' ;;
5496                         svr4*|esix*|solaris) dflt='-KPIC' ;;
5497                         sunos)  dflt='-pic' ;;
5498                         *)      dflt='none' ;;
5499                     esac
5500                         ;;
5501                 *)  case "$osname" in
5502                         svr4*|esix*|solaris) dflt='-fPIC' ;;
5503                         *)      dflt='-fpic' ;;
5504                     esac ;;
5505             esac ;;
5506         ' ') dflt='none' ;;
5507     *)  dflt="$cccdlflags" ;;
5508     esac
5509     rp="Any special flags to pass to $cc -c to compile shared library modules?"
5510     . ./myread
5511     case "$ans" in
5512     none) cccdlflags=' ' ;;
5513     *) cccdlflags="$ans" ;;
5514     esac
5515
5516     cat << EOM
5517
5518 Some systems use ld to create libraries that can be dynamically loaded,
5519 while other systems (such as those using ELF) use $cc.
5520
5521 EOM
5522         case "$ld" in
5523         '')     $cat >try.c <<'EOM'
5524 /* Test for whether ELF binaries are produced */
5525 #include <fcntl.h>
5526 #include <stdlib.h>
5527 int main() {
5528         char b[4];
5529         int i = open("a.out",O_RDONLY);
5530         if(i == -1) 
5531                 exit(1); /* fail */
5532         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
5533                 exit(0); /* succeed (yes, it's ELF) */
5534         else
5535                 exit(1); /* fail */
5536 }
5537 EOM
5538                 if $cc $ccflags try.c >/dev/null 2>&1 && ./a.out; then
5539                         cat <<EOM
5540 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
5541 EOM
5542                         dflt="$cc"
5543                 else
5544                         echo "I'll use ld to build dynamic libraries."
5545                         dflt='ld'
5546                 fi
5547                 rm -f try.c a.out
5548                 ;;
5549         *)      dflt="$ld"
5550                 ;;
5551         esac
5552
5553     rp="What command should be used to create dynamic libraries?"
5554     . ./myread
5555         ld="$ans"
5556
5557     cat << EOM
5558
5559 Some systems may require passing special flags to $ld to create a
5560 library that can be dynamically loaded.  If your ld flags include
5561 -L/other/path options to locate libraries outside your loader's normal
5562 search path, you may need to specify those -L options here as well.  To
5563 use no flags, say "none".
5564
5565 EOM
5566     case "$lddlflags" in
5567     '') case "$osname" in
5568                         beos) dflt='-nostart' ;;
5569                         hpux)  dflt='-b' ;;
5570                         linux|irix*)    dflt='-shared' ;;
5571                         next)  dflt='none' ;;
5572                         solaris) dflt='-G' ;;
5573                         sunos) dflt='-assert nodefinitions' ;;
5574                         svr4*|esix*) dflt="-G $ldflags" ;;
5575                 *)     dflt='none' ;;
5576                         esac
5577                         ;;
5578     *) dflt="$lddlflags" ;;
5579     esac
5580
5581         : Try to guess additional flags to pick up local libraries.
5582         : Be careful not to append to a plain 'none'
5583         case "$dflt" in
5584         none) dflt='' ;;
5585         esac
5586         for thisflag in $ldflags; do
5587                 case "$thisflag" in
5588                 -L*)
5589                         case " $dflt " in
5590                         *" $thisflag "*) ;;
5591                         *) dflt="$dflt $thisflag" ;;
5592                         esac
5593                         ;;
5594                 esac
5595         done
5596
5597         case "$dflt" in
5598         ''|' ') dflt='none' ;;
5599         esac
5600
5601     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
5602     . ./myread
5603     case "$ans" in
5604     none) lddlflags=' ' ;;
5605     *) lddlflags="$ans" ;;
5606     esac
5607
5608         cat <<EOM
5609
5610 Some systems may require passing special flags to $cc to indicate that
5611 the resulting executable will use dynamic linking.  To use no flags,
5612 say "none".
5613
5614 EOM
5615     case "$ccdlflags" in
5616     '') case "$osname" in
5617                 hpux)   dflt='-Wl,-E' ;;
5618                 linux)  dflt='-rdynamic' ;;
5619                 next)   dflt='none' ;;
5620                 sunos)  dflt='none' ;;
5621                 *)      dflt='none' ;;
5622             esac ;;
5623     ' ')  dflt='none' ;;
5624     *)  dflt="$ccdlflags" ;;
5625     esac
5626     rp="Any special flags to pass to $cc to use dynamic loading?"
5627     . ./myread
5628     case "$ans" in
5629     none) ccdlflags=' ' ;;
5630     *) ccdlflags="$ans" ;;
5631     esac
5632     ;;
5633 *)  usedl="$undef"
5634         ld='ld'
5635     dlsrc='dl_none.xs'
5636     lddlflags=''
5637     ccdlflags=''
5638     ;;
5639 esac
5640
5641 also=''
5642 case "$usedl" in
5643 $undef)
5644         # No dynamic loading being used, so don't bother even to prompt.
5645         useshrplib='false'
5646         ;;
5647 *)      case "$useshrplib" in
5648         '')     case "$osname" in
5649                 svr4*|dgux|dynixptx|esix|powerux|beos)
5650                         dflt=y
5651                         also='Building a shared libperl is required for dynamic loading to work on your system.'
5652                         ;;
5653                 next*)
5654                         case "$osvers" in
5655                         4*)     dflt=y
5656                                 also='Building a shared libperl is needed for MAB support.'
5657                                 ;;
5658                         *)      dflt=n
5659                                 ;;
5660                         esac
5661                         ;;
5662                 *)      dflt=n
5663                         ;;
5664                 esac
5665                 ;;
5666         $define|true|[Yy]*)
5667                 dflt=y
5668                 ;;
5669         *)      dflt=n
5670                 ;;
5671         esac
5672         $cat << EOM
5673
5674 The perl executable is normally obtained by linking perlmain.c with
5675 libperl${_a}, any static extensions (usually just DynaLoader), and
5676 any other libraries needed on this system (such as -lm, etc.).  Since
5677 your system supports dynamic loading, it is probably possible to build
5678 a shared libperl.$so.  If you will have more than one executable linked
5679 to libperl.$so, this will significantly reduce the size of each
5680 executable, but it may have a noticeable affect on performance.  The
5681 default is probably sensible for your system.
5682 $also
5683
5684 EOM
5685         rp="Build a shared libperl.$so (y/n)"
5686         . ./myread
5687         case "$ans" in
5688         true|$define|[Yy]*)
5689                 useshrplib='true'  ;;
5690         *)      useshrplib='false' ;;
5691         esac
5692         ;;
5693 esac
5694
5695 case "$useshrplib" in
5696 true)
5697         case "$libperl" in
5698         '')
5699                 # Figure out a good name for libperl.so.  Since it gets stored in
5700                 # a version-specific architecture-dependent library, the version
5701                 # number isn't really that important, except for making cc/ld happy.
5702                 #
5703                 # A name such as libperl.so.3.1
5704                 majmin="libperl.$so.$patchlevel.$subversion"
5705                 # A name such as libperl.so.301
5706                 majonly=`echo $patchlevel $subversion |
5707                         $awk '{printf "%d%02d", $1, $2}'`
5708                 majonly=libperl.$so.$majonly
5709                 # I'd prefer to keep the os-specific stuff here to a minimum, and
5710                 # rely on figuring it out from the naming of libc.
5711                 case "${osname}${osvers}" in
5712                 next4*)
5713                         dflt=libperl.5.$so
5714                         # XXX How handle the --version stuff for MAB?
5715                         ;;
5716                 linux*)  # ld won't link with a bare -lperl otherwise.
5717                         dflt=libperl.$so
5718                         ;;
5719                 *)      # Try to guess based on whether libc has major.minor.
5720                         case "$libc" in
5721                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
5722                         *libc.$so.[0-9]*) dflt=$majonly ;;
5723                         *)      dflt=libperl.$so ;;
5724                         esac
5725                         ;;
5726                 esac
5727                 ;;
5728         *)      dflt=$libperl
5729                 ;;
5730         esac
5731         cat << EOM
5732
5733 I need to select a good name for the shared libperl.  If your system uses
5734 library names with major and minor numbers, then you might want something
5735 like $majmin.  Alternatively, if your system uses a single version
5736 number for shared libraries, then you might want to use $majonly.
5737 Or, your system might be quite happy with a simple libperl.$so.
5738
5739 Since the shared libperl will get installed into a version-specific
5740 architecture-dependent directory, the version number of the shared perl
5741 library probably isn't important, so the default should be o.k.
5742
5743 EOM
5744         rp='What name do you want to give to the shared libperl?'
5745         . ./myread
5746         libperl=$ans
5747         echo "Ok, I'll use $libperl"
5748         ;;
5749 *)
5750         libperl="libperl${_a}"
5751         ;;
5752 esac
5753
5754 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
5755 case "$shrpdir" in
5756 '') ;;
5757 *)      $cat >&4 <<EOM
5758 WARNING:  Use of the shrpdir variable for the installation location of
5759 the shared $libperl is not supported.  It was never documented and
5760 will not work in this version.  Let me (perlbug@perl.com)
5761 know of any problems this may cause.
5762
5763 EOM
5764         case "$shrpdir" in
5765         "$archlibexp/CORE")
5766                 $cat >&4 <<EOM
5767 But your current setting of $shrpdir is
5768 the default anyway, so it's harmless.
5769 EOM
5770                 ;;
5771         *)
5772                 $cat >&4 <<EOM
5773 Further, your current attempted setting of $shrpdir
5774 conflicts with the value of $archlibexp/CORE
5775 that installperl will use.
5776 EOM
5777                 ;;
5778         esac
5779         ;;
5780 esac
5781
5782 # How will the perl executable find the installed shared $libperl?
5783 # Add $xxx to ccdlflags.
5784 # If we can't figure out a command-line option, use $shrpenv to
5785 # set env LD_RUN_PATH.  The main perl makefile uses this.
5786 shrpdir=$archlibexp/CORE
5787 xxx=''
5788 tmp_shrpenv=''
5789 if "$useshrplib"; then
5790     case "$osname" in 
5791         aix)
5792                 # We'll set it in Makefile.SH...
5793                 ;;
5794         solaris|netbsd)
5795                 xxx="-R $shrpdir"
5796                 ;;
5797         freebsd)
5798                 xxx="-Wl,-R$shrpdir"
5799                 ;;
5800         linux|irix*|dec_osf)
5801                 xxx="-Wl,-rpath,$shrpdir"
5802                 ;;
5803         next)
5804                 # next doesn't like the default...
5805                 ;;
5806         beos)
5807                 # beos doesn't like the default, either.
5808                 ;;
5809         hpux*)
5810                 # hpux doesn't like the default, either.
5811                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
5812                 ;;
5813         *)
5814                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
5815                 ;;
5816         esac
5817         case "$xxx" in
5818         '') ;;
5819         *)      
5820                 # Only add $xxx if it isn't already in ccdlflags.
5821                 case " $ccdlflags " in
5822                 *" $xxx "*)     ;;
5823                 *)      ccdlflags="$ccdlflags $xxx"
5824                         cat <<EOM >&4
5825
5826 Adding $xxx to the flags
5827 passed to $ld so that the perl executable will find the 
5828 installed shared $libperl.
5829
5830 EOM
5831                         ;;
5832                 esac
5833                 ;;
5834         esac
5835 fi
5836 # Fix ccdlflags in AIX for building external extensions.
5837 # (For building Perl itself bare -bE:perl.exp is needed,
5838 #  Makefile.SH takes care of this.)
5839 case "$osname" in
5840 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
5841 esac
5842 # Respect a hint or command-line value.
5843 case "$shrpenv" in
5844 '') shrpenv="$tmp_shrpenv" ;;
5845 esac
5846 case "$ldlibpthname" in
5847 '')     ldlibpthname=LD_LIBRARY_PATH ;;
5848 none)   ldlibpthname='' ;;
5849 esac
5850
5851 : determine where manual pages go
5852 set man1dir man1dir none
5853 eval $prefixit
5854 $cat <<EOM
5855
5856 $spackage has manual pages available in source form.
5857 EOM
5858 case "$nroff" in
5859 nroff)
5860         echo "However, you don't have nroff, so they're probably useless to you."
5861         case "$man1dir" in
5862         '') man1dir="none";;
5863         esac;;
5864 esac
5865 echo "If you don't want the manual sources installed, answer 'none'."
5866 case "$man1dir" in
5867 ' ') dflt=none
5868         ;;
5869 '')
5870         lookpath="$prefixexp/man/man1 $prefixexp/man/l_man/man1"
5871         lookpath="$lookpath $prefixexp/man/p_man/man1"
5872         lookpath="$lookpath $prefixexp/man/u_man/man1"
5873         lookpath="$lookpath $prefixexp/man/man.1"
5874         case "$sysman" in
5875         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
5876         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
5877         esac
5878         set dflt
5879         eval $prefixup
5880         ;;
5881 *)  dflt="$man1dir"
5882         ;;
5883 esac
5884 echo " "
5885 fn=dn+~
5886 rp="Where do the main $spackage manual pages (source) go?"
5887 . ./getfile
5888 if $test "X$man1direxp" != "X$ansexp"; then
5889         installman1dir=''
5890 fi
5891 man1dir="$ans"
5892 man1direxp="$ansexp"
5893 case "$man1dir" in
5894 '')     man1dir=' '
5895         installman1dir='';;
5896 esac
5897
5898 : Change installation prefix, if necessary.
5899 if $test X"$prefix" != X"$installprefix"; then
5900         installman1dir=`echo $man1direxp | $sed "s#^$prefix#$installprefix#"`
5901 else
5902         installman1dir="$man1direxp"
5903 fi
5904
5905 : What suffix to use on installed man pages
5906
5907 case "$man1dir" in
5908 ' ')
5909         man1ext='0'
5910         ;;
5911 *)
5912         rp="What suffix should be used for the main $spackage man pages?"
5913         case "$man1ext" in
5914         '')     case "$man1dir" in
5915                 *1)  dflt=1 ;;
5916                 *1p) dflt=1p ;;
5917                 *1pm) dflt=1pm ;;
5918                 *l) dflt=l;;
5919                 *n) dflt=n;;
5920                 *o) dflt=o;;
5921                 *p) dflt=p;;
5922                 *C) dflt=C;;
5923                 *L) dflt=L;;
5924                 *L1) dflt=L1;;
5925                 *) dflt=1;;
5926                 esac
5927                 ;;
5928         *)      dflt="$man1ext";;
5929         esac
5930         . ./myread
5931         man1ext="$ans"
5932         ;;
5933 esac
5934
5935 : see if we can have long filenames
5936 echo " "
5937 rmlist="$rmlist /tmp/cf$$"
5938 $test -d /tmp/cf$$ || mkdir /tmp/cf$$
5939 first=123456789abcdef
5940 second=/tmp/cf$$/$first
5941 $rm -f $first $second
5942 if (echo hi >$first) 2>/dev/null; then
5943         if $test -f 123456789abcde; then
5944                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
5945                 val="$undef"
5946         else
5947                 if (echo hi >$second) 2>/dev/null; then
5948                         if $test -f /tmp/cf$$/123456789abcde; then
5949                                 $cat <<'EOM'
5950 That's peculiar... You can have filenames longer than 14 characters, but only
5951 on some of the filesystems.  Maybe you are using NFS.  Anyway, to avoid problems
5952 I shall consider your system cannot support long filenames at all.
5953 EOM
5954                                 val="$undef"
5955                         else
5956                                 echo 'You can have filenames longer than 14 characters.' >&4
5957                                 val="$define"
5958                         fi
5959                 else
5960                         $cat <<'EOM'
5961 How confusing! Some of your filesystems are sane enough to allow filenames
5962 longer than 14 characters but some others like /tmp can't even think about them.
5963 So, for now on, I shall assume your kernel does not allow them at all.
5964 EOM
5965                         val="$undef"
5966                 fi
5967         fi
5968 else
5969         $cat <<'EOM'
5970 You can't have filenames longer than 14 chars.  You can't even think about them!
5971 EOM
5972         val="$undef"
5973 fi 
5974 set d_flexfnam
5975 eval $setvar
5976 $rm -rf /tmp/cf$$ 123456789abcde*
5977
5978 : determine where library module manual pages go
5979 set man3dir man3dir none
5980 eval $prefixit
5981 $cat <<EOM
5982
5983 $spackage has manual pages for many of the library modules.
5984 EOM
5985
5986 case "$nroff" in
5987 nroff)
5988         $cat <<'EOM'
5989 However, you don't have nroff, so they're probably useless to you.
5990 EOM
5991         case "$man3dir" in
5992         '') man3dir="none";;
5993         esac;;
5994 esac
5995
5996 case "$d_flexfnam" in
5997 undef)
5998         $cat <<'EOM'
5999 However, your system can't handle the long file names like File::Basename.3. 
6000 EOM
6001         case "$man3dir" in
6002         '') man3dir="none";;
6003         esac;;
6004 esac
6005
6006 echo "If you don't want the manual sources installed, answer 'none'."
6007 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6008 case "$man3dir" in
6009 '')     dflt=`echo $man1dir | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
6010         if $test -d "$privlib/man/man3"; then
6011                 cat <<EOM >&4
6012
6013 WARNING:  Previous versions of perl installed man3 pages into
6014 $privlib/man/man3.  This version will suggest a 
6015 new default of $dflt.  
6016 EOM
6017                 tdflt=$dflt
6018                 dflt='n'
6019                 rp='Do you wish to preserve the old behavior?(y/n)'
6020                 . ./myread
6021                 case "$ans" in
6022                 y*) dflt="$privlib/man/man3" ;;
6023                 *)  dflt=$tdflt ;;
6024                 esac
6025     fi
6026         ;;
6027 ' ') dflt=none;;
6028 *)      dflt="$man3dir" ;;
6029 esac
6030 echo " "
6031 fn=dn+~
6032 rp="Where do the $package library man pages (source) go?"
6033 . ./getfile
6034 man3dir="$ans"
6035 man3direxp="$ansexp"
6036 case "$man1dir" in
6037 '')     man3dir=' '
6038         installman3dir='';;
6039 esac
6040
6041 : Change installation prefix, if necessary.
6042 if $test X"$prefix" != X"$installprefix"; then
6043         installman3dir=`echo $man3direxp | $sed "s#^$prefix#$installprefix#"`
6044 else
6045         installman3dir="$man3direxp"
6046 fi
6047
6048 : What suffix to use on installed man pages
6049 case "$man3dir" in
6050 ' ')
6051         man3ext='0'
6052         ;;
6053 *)
6054         rp="What suffix should be used for the $package library man pages?"
6055         case "$man3ext" in
6056         '')     case "$man3dir" in
6057                 *3)  dflt=3 ;;
6058                 *3p) dflt=3p ;;
6059                 *3pm) dflt=3pm ;;
6060                 *l) dflt=l;;
6061                 *n) dflt=n;;
6062                 *o) dflt=o;;
6063                 *p) dflt=p;;
6064                 *C) dflt=C;;
6065                 *L) dflt=L;;
6066                 *L3) dflt=L3;;
6067                 *) dflt=3;;
6068                 esac
6069                 ;;
6070         *)      dflt="$man3ext";;
6071         esac
6072         . ./myread
6073         man3ext="$ans"
6074         ;;
6075 esac
6076
6077 : see if we have to deal with yellow pages, now NIS.
6078 if $test -d /usr/etc/yp || $test -d /etc/yp; then
6079         if $test -f /usr/etc/nibindd; then
6080                 echo " "
6081                 echo "I'm fairly confident you're on a NeXT."
6082                 echo " "
6083                 rp='Do you get the hosts file via NetInfo?'
6084                 dflt=y
6085                 case "$hostcat" in
6086                 nidump*) ;;
6087                 '') ;;
6088                 *) dflt=n;;
6089                 esac
6090                 . ./myread
6091                 case "$ans" in
6092                 y*) hostcat='nidump hosts .';;
6093                 *)      case "$hostcat" in
6094                         nidump*) hostcat='';;
6095                         esac
6096                         ;;
6097                 esac
6098         fi
6099         case "$hostcat" in
6100         nidump*) ;;
6101         *)
6102                 case "$hostcat" in
6103                 *ypcat*) dflt=y;;
6104                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
6105                                 dflt=y
6106                         else
6107                                 dflt=n
6108                         fi;;
6109                 *) dflt=n;;
6110                 esac
6111                 echo " "
6112                 rp='Are you getting the hosts file via yellow pages?'
6113                 . ./myread
6114                 case "$ans" in
6115                 y*) hostcat='ypcat hosts';;
6116                 *) hostcat='cat /etc/hosts';;
6117                 esac
6118                 ;;
6119         esac
6120 fi
6121 case "$hostcat" in
6122 '') hostcat='cat /etc/hosts';;
6123 esac
6124 case "$groupcat" in
6125 '') groupcat='cat /etc/group';;
6126 esac
6127 case "$passcat" in
6128 '') passcat='cat /etc/passwd';;
6129 esac
6130
6131 : now get the host name
6132 echo " "
6133 echo "Figuring out host name..." >&4
6134 case "$myhostname" in
6135 '') cont=true
6136         echo 'Maybe "hostname" will work...'
6137         if tans=`sh -c hostname 2>&1` ; then
6138                 myhostname=$tans
6139                 phostname=hostname
6140                 cont=''
6141         fi
6142         ;;
6143 *) cont='';;
6144 esac
6145 if $test "$cont"; then
6146         if ./xenix; then
6147                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
6148                 if tans=`cat /etc/systemid 2>&1` ; then
6149                         myhostname=$tans
6150                         phostname='cat /etc/systemid'
6151                         echo "Whadyaknow.  Xenix always was a bit strange..."
6152                         cont=''
6153                 fi
6154         elif $test -r /etc/systemid; then
6155                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
6156         fi
6157 fi
6158 if $test "$cont"; then
6159         echo 'No, maybe "uuname -l" will work...'
6160         if tans=`sh -c 'uuname -l' 2>&1` ; then
6161                 myhostname=$tans
6162                 phostname='uuname -l'
6163         else
6164                 echo 'Strange.  Maybe "uname -n" will work...'
6165                 if tans=`sh -c 'uname -n' 2>&1` ; then
6166                         myhostname=$tans
6167                         phostname='uname -n'
6168                 else
6169                         echo 'Oh well, maybe I can mine it out of whoami.h...'
6170                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
6171                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
6172                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
6173                         else
6174                                 case "$myhostname" in
6175                                 '') echo "Does this machine have an identity crisis or something?"
6176                                         phostname='';;
6177                                 *)
6178                                         echo "Well, you said $myhostname before..."
6179                                         phostname='echo $myhostname';;
6180                                 esac
6181                         fi
6182                 fi
6183         fi
6184 fi
6185 : you do not want to know about this
6186 set $myhostname
6187 myhostname=$1
6188
6189 : verify guess
6190 if $test "$myhostname" ; then
6191         dflt=y
6192         rp='Your host name appears to be "'$myhostname'".'" Right?"
6193         . ./myread
6194         case "$ans" in
6195         y*) ;;
6196         *) myhostname='';;
6197         esac
6198 fi
6199
6200 : bad guess or no guess
6201 while $test "X$myhostname" = X ; do
6202         dflt=''
6203         rp="Please type the (one word) name of your host:"
6204         . ./myread
6205         myhostname="$ans"
6206 done
6207
6208 : translate upper to lower if necessary
6209 case "$myhostname" in
6210 *[A-Z]*)
6211         echo "(Normalizing case in your host name)"
6212         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
6213         ;;
6214 esac
6215
6216 case "$myhostname" in
6217 *.*)
6218         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
6219         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
6220         echo "(Trimming domain name from host name--host name is now $myhostname)"
6221         ;;
6222 *) case "$mydomain" in
6223         '')
6224                 {
6225                         test "X$hostcat" = "Xypcat hosts" &&
6226                         ypmatch "$myhostname" hosts 2>/dev/null |\
6227                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
6228                         $test -s hosts
6229                 } || {
6230                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
6231                                         /[       ]$myhostname[  . ]/p" > hosts
6232                 }
6233                 tmp_re="[       . ]"
6234                 $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
6235                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
6236                 dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
6237                         hosts | $sort | $uniq | \
6238                         $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
6239                 case `$echo X$dflt` in
6240                 X*\ *)  echo "(Several hosts in /etc/hosts matched hostname)"
6241                         dflt=.
6242                         ;;
6243                 X.) echo "(You do not have fully-qualified names in /etc/hosts)"
6244                         ;;
6245                 esac
6246                 case "$dflt" in
6247                 .)
6248                         tans=`./loc resolv.conf X /etc /usr/etc`
6249                         if $test -f "$tans"; then
6250                                 echo "(Attempting domain name extraction from $tans)"
6251                                 dflt=.`$sed -n -e 's/   / /g' \
6252                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
6253                                   | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
6254                                 case "$dflt" in
6255                                 .) dflt=.`$sed -n -e 's/        / /g' \
6256                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
6257                                      | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
6258                                         ;;
6259                                 esac
6260                         fi
6261                         ;;
6262                 esac
6263                 case "$dflt" in
6264                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
6265                         dflt=.`sh -c domainname 2>/dev/null`
6266                         case "$dflt" in
6267                         '') dflt='.';;
6268                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
6269                         esac
6270                         ;;
6271                 esac
6272                 case "$dflt" in
6273                 .) echo "(Lost all hope -- silly guess then)"
6274                         dflt='.uucp'
6275                         ;;
6276                 esac
6277                 $rm -f hosts
6278                 ;;
6279         *) dflt="$mydomain";;
6280         esac;;
6281 esac
6282 echo " "
6283 rp="What is your domain name?"
6284 . ./myread
6285 tans="$ans"
6286 case "$ans" in
6287 '') ;;
6288 .*) ;;
6289 *) tans=".$tans";;
6290 esac
6291 mydomain="$tans"
6292
6293 : translate upper to lower if necessary
6294 case "$mydomain" in
6295 *[A-Z]*)
6296         echo "(Normalizing case in your domain name)"
6297         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
6298         ;;
6299 esac
6300
6301 : a little sanity check here
6302 case "$phostname" in
6303 '') ;;
6304 *)
6305         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
6306         $myhostname$mydomain|$myhostname) ;;
6307         *)
6308                 case "$phostname" in
6309                 sed*)
6310                         echo "(That doesn't agree with your whoami.h file, by the way.)"
6311                         ;;
6312                 *)
6313                         echo "(That doesn't agree with your $phostname command, by the way.)"
6314                         ;;
6315                 esac
6316         ;;
6317         esac
6318         ;;
6319 esac
6320
6321 $cat <<EOM
6322
6323 I need to get your e-mail address in Internet format if possible, i.e.
6324 something like user@host.domain. Please answer accurately since I have
6325 no easy means to double check it. The default value provided below
6326 is most probably close to the reality but may not be valid from outside
6327 your organization...
6328
6329 EOM
6330 cont=x
6331 while test "$cont"; do
6332         case "$cf_email" in
6333         '') dflt="$cf_by@$myhostname$mydomain";;
6334         *) dflt="$cf_email";;
6335         esac
6336         rp='What is your e-mail address?'
6337         . ./myread
6338         cf_email="$ans"
6339         case "$cf_email" in
6340         *@*.*) cont='' ;;
6341         *)
6342                 rp='Address does not look like an Internet one.  Use it anyway?'
6343                 case "$fastread" in
6344                 yes) dflt=y ;;
6345                 *) dflt=n ;;
6346                 esac
6347                 . ./myread
6348                 case "$ans" in
6349                 y*) cont='' ;;
6350                 *) echo " " ;;
6351                 esac
6352                 ;;
6353         esac
6354 done
6355
6356 $cat <<EOM
6357
6358 If you or somebody else will be maintaining perl at your site, please
6359 fill in the correct e-mail address here so that they may be contacted
6360 if necessary. Currently, the "perlbug" program included with perl
6361 will send mail to this address in addition to perlbug@perl.com. You may
6362 enter "none" for no administrator.
6363
6364 EOM
6365 case "$perladmin" in
6366 '') dflt="$cf_email";;
6367 *) dflt="$perladmin";;
6368 esac
6369 rp='Perl administrator e-mail address'
6370 . ./myread
6371 perladmin="$ans"
6372
6373 : figure out how to guarantee perl startup
6374 case "$startperl" in
6375 '')
6376         case "$sharpbang" in
6377         *!)
6378                 $cat <<EOH
6379
6380 I can use the #! construct to start perl on your system. This will
6381 make startup of perl scripts faster, but may cause problems if you
6382 want to share those scripts and perl is not in a standard place
6383 ($binexp/perl) on all your platforms. The alternative is to force
6384 a shell by starting the script with a single ':' character.
6385
6386 EOH
6387                 dflt="$binexp/perl"
6388                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
6389                 . ./myread
6390                 case "$ans" in
6391                 none)   startperl=": # use perl";;
6392                 *)      startperl="#!$ans"
6393                         if $test 30 -lt `echo "$ans" | wc -c`; then
6394                                 $cat >&4 <<EOM
6395
6396 WARNING:  Some systems limit the #! command to 32 characters.
6397 If you experience difficulty running Perl scripts with #!, try
6398 installing Perl in a directory with a shorter pathname.
6399
6400 EOM
6401                         fi ;;
6402                 esac
6403                 ;;
6404         *) startperl=": # use perl"
6405                 ;;
6406         esac
6407         ;;
6408 esac
6409 echo "I'll use $startperl to start perl scripts."
6410
6411 : figure best path for perl in scripts
6412 case "$perlpath" in
6413 '')
6414         perlpath="$binexp/perl"
6415         case "$startperl" in
6416         *!*) ;;
6417         *)
6418                 $cat <<EOH
6419
6420 I will use the "eval 'exec'" idiom to start Perl on your system.
6421 I can use the full path of your Perl binary for this purpose, but
6422 doing so may cause problems if you want to share those scripts and
6423 Perl is not always in a standard place ($binexp/perl).
6424
6425 EOH
6426                 dflt="$binexp/perl"
6427                 rp="What path shall I use in \"eval 'exec'\"?"
6428                 . ./myread
6429                 perlpath="$ans"
6430                 ;;
6431         esac
6432         ;;
6433 esac
6434 case "$startperl" in
6435 *!*)    ;;
6436 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
6437 esac
6438
6439 : determine where public executable scripts go
6440 set scriptdir scriptdir
6441 eval $prefixit
6442 case "$scriptdir" in
6443 '')
6444         dflt="$bin"
6445         : guess some guesses
6446         $test -d /usr/share/scripts && dflt=/usr/share/scripts
6447         $test -d /usr/share/bin     && dflt=/usr/share/bin
6448         $test -d /usr/local/script  && dflt=/usr/local/script
6449         $test -d /usr/local/scripts && dflt=/usr/local/scripts
6450         $test -d $prefixexp/script  && dflt=$prefixexp/script
6451         set dflt
6452         eval $prefixup
6453         ;;
6454 *)  dflt="$scriptdir"
6455         ;;
6456 esac
6457 $cat <<EOM
6458  
6459 Some installations have a separate directory just for executable scripts so
6460 that they can mount it across multiple architectures but keep the scripts in
6461 one spot.  You might, for example, have a subdirectory of /usr/share for this.
6462 Or you might just lump your scripts in with all your other executables.
6463  
6464 EOM
6465 fn=d~
6466 rp='Where do you keep publicly executable scripts?'
6467 . ./getfile
6468 if $test "X$ansexp" != "X$scriptdirexp"; then
6469         installscript=''
6470 fi
6471 scriptdir="$ans"
6472 scriptdirexp="$ansexp"
6473 : Change installation prefix, if necessary.
6474 if $test X"$prefix" != X"$installprefix"; then
6475         installscript=`echo $scriptdirexp | sed "s#^$prefix#$installprefix#"`
6476 else
6477         installscript="$scriptdirexp"
6478 fi
6479
6480 $cat <<EOM
6481
6482 After $package is installed, you may wish to install various
6483 add-on modules and utilities.  Typically, these add-ons will
6484 be installed under $prefix with the rest
6485 of this package.  However, you may wish to install such add-ons
6486 elsewhere under a different prefix.
6487
6488 If you do not wish to put everything under a single prefix, that's
6489 ok.  You will be prompted for the individual locations; this siteprefix
6490 is only used to suggest the defaults.
6491
6492 The default should be fine for most people.
6493
6494 EOM
6495 fn=d~+
6496 rp='Installation prefix to use for add-on modules and utilities?'
6497 : XXX Here might be another good place for an installstyle setting.
6498 case "$siteprefix" in
6499 '') dflt=$prefix ;;
6500 *)  dflt=$siteprefix ;;
6501 esac
6502 . ./getfile
6503 oldsiteprefix=''
6504 case "$siteprefix" in
6505 '') ;;
6506 *)
6507         case "$ans" in
6508         "$prefix") ;;
6509         *) oldsiteprefix="$prefix";;
6510         esac
6511         ;;
6512 esac
6513 siteprefix="$ans"
6514 siteprefixexp="$ansexp"
6515
6516 : determine where site specific libraries go.
6517 : Usual default is /usr/local/lib/perl5/site_perl
6518 : The default "style" setting is made in installstyle.U
6519 : XXX No longer works with Prefixit stuff.
6520 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6521 case "$installstyle" in
6522 *lib/perl5*) dflt=$siteprefix/lib/site_$prog ;;
6523 *)       dflt=$siteprefix/lib/site_$prog ;;
6524 esac
6525 $cat <<EOM
6526
6527 The installation process will create a directory for
6528 site-specific extensions and modules.  Most users find it convenient
6529 to place all site-specific files in this directory rather than in the
6530 main distribution directory.
6531
6532 EOM
6533 fn=d~+
6534 rp='Pathname for the site-specific library files?'
6535 . ./getfile
6536 sitelib="$ans"
6537 sitelibexp="$ansexp"
6538 : Change installation prefix, if necessary.
6539 if $test X"$prefix" != X"$installprefix"; then
6540         installsitelib=`echo $sitelibexp | sed "s#^$prefix#$installprefix#"`
6541 else
6542         installsitelib="$sitelibexp"
6543 fi
6544
6545 : determine where site specific architecture-dependent libraries go.
6546 : sitelib  default is /usr/local/lib/perl5/site_perl/
6547 : sitearch default is /usr/local/lib/perl5/site_perl/$apiversion/$archname
6548 : sitelib may have an optional trailing /share.
6549 tdflt=`echo $sitelib | $sed 's,/share$,,'`
6550 tdflt="$tdflt/$apiversion/$archname"
6551 set sitearch sitearch none
6552 eval $prefixit
6553 case "$sitearch" in
6554 '')     dflt="$tdflt" ;;
6555 *)      dflt="$sitearch" ;;
6556 esac
6557 $cat <<EOM
6558
6559 The installation process will also create a directory for
6560 architecture-dependent site-specific extensions and modules.
6561
6562 EOM
6563 fn=nd~+
6564 rp='Pathname for the site-specific architecture-dependent library files?'
6565 . ./getfile
6566 sitearch="$ans"
6567 sitearchexp="$ansexp"
6568 : Change installation prefix, if necessary.
6569 if $test X"$prefix" != X"$installprefix"; then
6570         installsitearch=`echo $sitearchexp | sed "s#^$prefix#$installprefix#"`
6571 else
6572         installsitearch="$sitearchexp"
6573 fi
6574
6575 : determine where add-on public executables go
6576 case "$sitebin" in
6577 '')     dflt=$siteprefix/bin ;;
6578 *)      dflt=$sitebin ;;
6579 esac
6580 fn=d~
6581 rp='Pathname where the add-on public executables should be installed?'
6582 . ./getfile
6583 sitebin="$ans"
6584 sitebinexp="$ansexp"
6585 : Change installation prefix, if necessary.
6586 if $test X"$prefix" != X"$installprefix"; then
6587         installsitebin=`echo $sitebinexp | sed "s#^$prefix#$installprefix#"`
6588 else
6589         installsitebin="$sitebinexp"
6590 fi
6591
6592 cat <<EOM
6593
6594 Perl can be built to take advantage of long doubles which
6595 (if available) may give more accuracy and range for floating point numbers.
6596
6597 If this doesn't make any sense to you, just accept the default 'n'.
6598 EOM
6599
6600 case "$ccflags" in
6601 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
6602 esac
6603
6604 case "$uselongdouble" in
6605 $define|true|[yY]*)     dflt='y';;
6606 *) dflt='n';;
6607 esac
6608 rp='Try to use long doubles if available?'
6609 . ./myread
6610 case "$ans" in
6611 y|Y)    val="$define"   ;;
6612 *)      val="$undef"    ;;
6613 esac
6614 set uselongdouble
6615 eval $setvar
6616
6617 case "$uselongdouble" in
6618 true|[yY]*) uselongdouble="$define" ;;
6619 esac
6620
6621 case "$uselongdouble" in
6622 $define)
6623 : Look for a hint-file generated 'call-back-unit'.  If the
6624 : user has specified that long doubles should be used,
6625 : we may need to set or change some other defaults.
6626         if $test -f uselongdouble.cbu; then
6627                 echo "Your platform has some specific hints for long doubles, using them..."
6628                 . ./uselongdouble.cbu
6629         else
6630                 $cat <<EOM
6631 (Your platform doesn't have any specific hints for long doubles.)
6632 EOM
6633         fi
6634         ;;
6635 esac
6636
6637 cat <<EOM
6638
6639 Perl can be built to take advantage of long longs which
6640 (if available) may give more range for integer numbers.
6641
6642 If this doesn't make any sense to you, just accept the default 'n'.
6643 EOM
6644
6645 case "$ccflags" in
6646 *-DUSE_LONG_LONG*) uselonglong="$define" ;;
6647 esac
6648
6649 case "$uselonglong" in
6650 $define|true|[yY]*)     dflt='y';;
6651 *) dflt='n';;
6652 esac
6653 rp='Try to use long longs if available?'
6654 . ./myread
6655 case "$ans" in
6656 y|Y)    val="$define"   ;;
6657 *)      val="$undef"    ;;
6658 esac
6659 set uselonglong
6660 eval $setvar
6661
6662 case "$uselonglong" in
6663 true|[yY]*) uselonglong="$define" ;;
6664 esac
6665
6666 case "$uselonglong" in
6667 $define)
6668 : Look for a hint-file generated 'call-back-unit'.  If the
6669 : user has specified that long longs should be used,
6670 : we may need to set or change some other defaults.
6671         if $test -f uselonglong.cbu; then
6672                 echo "Your platform has some specific hints for long longs, using them..."
6673                 . ./uselonglong.cbu
6674         else
6675                 $cat <<EOM
6676 (Your platform doesn't have any specific hints for long longs.)
6677 EOM
6678         fi
6679         ;;
6680 esac
6681
6682 cat <<EOM
6683
6684 Previous version of $package used the standard IO mechanisms as defined
6685 in <stdio.h>.  Versions 5.003_02 and later of perl allow alternate IO
6686 mechanisms via a "PerlIO" abstraction, but the stdio mechanism is still
6687 the default.  This abstraction layer can use AT&T's sfio (if you already
6688 have sfio installed) or regular stdio.  Using PerlIO with sfio may cause
6689 problems with some extension modules.  Using PerlIO with stdio is safe,
6690 but it is slower than plain stdio and therefore is not the default.
6691
6692 If this doesn't make any sense to you, just accept the default 'n'.
6693 EOM
6694 case "$useperlio" in
6695 $define|true|[yY]*)     dflt='y';;
6696 *) dflt='n';;
6697 esac
6698 rp='Use the experimental PerlIO abstraction layer?'
6699 . ./myread
6700 case "$ans" in
6701 y|Y) 
6702         val="$define"
6703         ;;     
6704 *)      
6705         echo "Ok, doing things the stdio way"
6706         val="$undef"
6707         ;;
6708 esac
6709 set useperlio
6710 eval $setvar 
6711
6712 case "$vendorprefix" in
6713 '')     d_vendorbin="$undef"
6714         vendorbin=''
6715         vendorbinexp=''
6716         ;;
6717 *)      d_vendorbin="$define"
6718         : determine where vendor-supplied executables go.
6719         dflt=$vendorprefix/bin
6720         fn=d~+
6721         rp='Pathname for the vendor-supplied executables directory?'
6722         . ./getfile
6723         vendorbin="$ans"
6724         vendorbinexp="$ansexp"
6725         : Change installation prefix, if necessary.
6726         if $test X"$prefix" != X"$installprefix"; then
6727                 installvendorbin=`echo $vendorbinexp | $sed "s#^$prefix#$installprefix#"`
6728         else
6729                 installvendorbin="$vendorbinexp"
6730         fi
6731         ;;
6732 esac
6733
6734 : Check how to convert floats to strings.
6735 if test "X$d_Gconvert" = X; then
6736         echo " "
6737         echo "Checking for an efficient way to convert floats to strings."
6738         $cat >try.c <<'EOP'
6739 #ifdef TRY_gconvert
6740 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
6741 char *myname = "gconvert";
6742 #endif
6743 #ifdef TRY_gcvt
6744 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
6745 char *myname = "gcvt";
6746 #endif
6747 #ifdef TRY_sprintf
6748 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
6749 char *myname = "sprintf";
6750 #endif
6751
6752 #include <stdio.h>
6753
6754 int
6755 checkit(expect, got)
6756 char *expect;
6757 char *got;
6758 {
6759     if (strcmp(expect, got)) {
6760                 printf("%s oddity:  Expected %s, got %s\n",
6761                         myname, expect, got);
6762                 exit(1);
6763         }
6764 }
6765
6766 int main()
6767
6768         char buf[64]; 
6769         buf[63] = '\0';
6770
6771         /* This must be 1st test on (which?) platform */
6772         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
6773         Gconvert(0.1, 8, 0, buf);
6774         checkit("0.1", buf);
6775
6776         Gconvert(1.0, 8, 0, buf); 
6777         checkit("1", buf);
6778
6779         Gconvert(0.0, 8, 0, buf); 
6780         checkit("0", buf);
6781
6782         Gconvert(-1.0, 8, 0, buf); 
6783         checkit("-1", buf);
6784
6785         /* Some Linux gcvt's give 1.e+5 here. */
6786         Gconvert(100000.0, 8, 0, buf); 
6787         checkit("100000", buf);
6788         
6789         /* Some Linux gcvt's give -1.e+5 here. */
6790         Gconvert(-100000.0, 8, 0, buf); 
6791         checkit("-100000", buf);
6792
6793         exit(0);
6794 }
6795 EOP
6796         case "$d_Gconvert" in
6797         gconvert*) xxx_list='gconvert gcvt sprintf' ;;
6798         gcvt*) xxx_list='gcvt gconvert sprintf' ;;
6799         sprintf*) xxx_list='sprintf gconvert gcvt' ;;
6800         *) xxx_list='gconvert gcvt sprintf' ;;
6801         esac
6802
6803         for xxx_convert in $xxx_list; do
6804                 echo "Trying $xxx_convert"
6805                 $rm -f try try$_o
6806                 set try -DTRY_$xxx_convert
6807                 if eval $compile; then
6808                         echo "$xxx_convert" found. >&4
6809                         if ./try; then
6810                                 echo "I'll use $xxx_convert to convert floats into a string." >&4
6811                                 break;
6812                         else
6813                                 echo "...But $xxx_convert didn't work as I expected."
6814                         fi
6815                 else
6816                         echo "$xxx_convert NOT found." >&4
6817                 fi
6818         done
6819                 
6820         case "$xxx_convert" in
6821         gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
6822         gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
6823         *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
6824         esac
6825 fi
6826
6827 : check for length of double
6828 echo " "
6829 case "$doublesize" in
6830 '')
6831         $echo $n "Checking to see how big your double precision numbers are...$c" >&4
6832         $cat >try.c <<'EOCP'
6833 #include <stdio.h>
6834 int main()
6835 {
6836     printf("%d\n", (int)sizeof(double));
6837     exit(0);
6838 }
6839 EOCP
6840         set try
6841         if eval $compile_ok; then
6842                 doublesize=`./try`
6843                 $echo " $doublesize bytes." >&4
6844         else
6845                 dflt='8'
6846                 echo "(I can't seem to compile the test program.  Guessing...)"
6847                 rp="What is the size of a double precision number (in bytes)?"
6848                 . ./myread
6849                 doublesize="$ans"
6850         fi
6851         ;;
6852 esac
6853 $rm -f try.c try
6854
6855 : check for long doubles
6856 echo " "
6857 $echo $n "Checking to see if your system supports long double..." $c >&4
6858 echo 'int main() { long double x = 7.0; }' > try.c
6859 set try
6860 if eval $compile; then
6861         val="$define"
6862         echo " Yes, it does." >&4
6863 else
6864         val="$undef"
6865         echo " No, it doesn't." >&4
6866 fi
6867 $rm try.*
6868 set d_longdbl
6869 eval $setvar
6870
6871 : check for length of long double
6872 case "${d_longdbl}${longdblsize}" in
6873 $define)
6874         echo " "
6875         $echo $n "Checking to see how big your long doubles are..." $c >&4
6876         $cat >try.c <<'EOCP'
6877 #include <stdio.h>
6878 int main()
6879 {
6880         printf("%d\n", sizeof(long double));
6881 }
6882 EOCP
6883         set try
6884         set try
6885         if eval $compile; then
6886                 longdblsize=`./try$exe_ext`
6887                 $echo " $longdblsize bytes." >&4
6888         else
6889                 dflt='8'
6890                 echo " "
6891                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
6892                 rp="What is the size of a long double (in bytes)?"
6893                 . ./myread
6894                 longdblsize="$ans"
6895         fi
6896         if $test "X$doublesize" = "X$longdblsize"; then
6897                 echo "(That isn't any different from an ordinary double.)"
6898         fi      
6899         ;;
6900 esac
6901 $rm -f try.* try
6902
6903 echo " "
6904
6905 if $test X"$d_longdbl" = X"$define"; then
6906
6907 echo "Checking how to print long doubles..." >&4
6908
6909 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
6910         $cat >try.c <<'EOCP'
6911 #include <sys/types.h>
6912 #include <stdio.h>
6913 int main() {
6914   double d = 123.456;
6915   printf("%.3f\n", d);
6916 }
6917 EOCP
6918         set try
6919         if eval $compile; then
6920                 yyy=`./try$exe_ext`
6921                 case "$yyy" in
6922                 123.456)
6923                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
6924                         sPRIFldbl='"F"'; sPRIGldbl='"G"'; sPRIEldbl='"E"';
6925                         echo "We will use %f."
6926                         ;;
6927                 esac
6928         fi
6929 fi
6930
6931 if $test X"$sPRIfldbl" = X; then
6932         $cat >try.c <<'EOCP'
6933 #include <sys/types.h>
6934 #include <stdio.h>
6935 int main() {
6936   long double d = 123.456;
6937   printf("%.3llf\n", d);
6938 }
6939 EOCP
6940         set try
6941         if eval $compile; then
6942                 yyy=`./try$exe_ext`
6943                 case "$yyy" in
6944                 123.456)
6945                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
6946                         sPRIFldbl='"llF"'; sPRIGldbl='"llG"'; sPRIEldbl='"llE"';
6947                         echo "We will use %llf."
6948                         ;;
6949                 esac
6950         fi
6951 fi
6952
6953 if $test X"$sPRIfldbl" = X; then
6954         $cat >try.c <<'EOCP'
6955 #include <sys/types.h>
6956 #include <stdio.h>
6957 int main() {
6958   long double d = 123.456;
6959   printf("%.3Lf\n", d);
6960 }
6961 EOCP
6962         set try
6963         if eval $compile; then
6964                 yyy=`./try$exe_ext`
6965                 case "$yyy" in
6966                 123.456)
6967                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
6968                         sPRIFldbl='"LF"'; sPRIGldbl='"LG"'; sPRIEldbl='"LE"';
6969                         echo "We will use %Lf."
6970                         ;;
6971                 esac
6972         fi
6973 fi
6974
6975 if $test X"$sPRIfldbl" = X; then
6976         $cat >try.c <<'EOCP'
6977 #include <sys/types.h>
6978 #include <stdio.h>
6979 int main() {
6980   long double d = 123.456;
6981   printf("%.3lf\n", d);
6982 }
6983 EOCP
6984         set try
6985         if eval $compile; then
6986                 yyy=`./try$exe_ext`
6987                 case "$yyy" in
6988                 123.456)
6989                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
6990                         sPRIFldbl='"lF"'; sPRIGldbl='"lG"'; sPRIEldbl='"lE"';
6991                         echo "We will use %lf."
6992                         ;;
6993                 esac
6994         fi
6995 fi
6996
6997 if $test X"$sPRIfldbl" = X; then
6998         echo "Cannot figure out how to print long doubles." >&4
6999 fi
7000
7001 $rm -f try try.*
7002
7003 fi # d_longdbl
7004
7005 case "$sPRIfldbl" in
7006 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef"; 
7007         d_PRIFldbl="$undef"; d_PRIGldbl="$undef"; d_PRIEldbl="$undef"; 
7008         ;;
7009 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define"; 
7010         d_PRIFldbl="$define"; d_PRIGldbl="$define"; d_PRIEldbl="$define"; 
7011         ;;
7012 esac
7013
7014 : Initialize h_fcntl
7015 h_fcntl=false
7016
7017 : Initialize h_sysfile
7018 h_sysfile=false
7019
7020 : access call always available on UNIX
7021 set access d_access
7022 eval $inlibc
7023
7024 : locate the flags for 'access()'
7025 case "$d_access" in
7026 "$define")
7027         echo " "
7028         $cat >access.c <<'EOCP'
7029 #include <sys/types.h>
7030 #ifdef I_FCNTL
7031 #include <fcntl.h>
7032 #endif
7033 #ifdef I_SYS_FILE
7034 #include <sys/file.h>
7035 #endif
7036 #ifdef I_UNISTD
7037 #include <unistd.h>
7038 #endif
7039 int main() {
7040         exit(R_OK);
7041 }
7042 EOCP
7043         : check sys/file.h first, no particular reason here
7044         if $test `./findhdr sys/file.h` && \
7045                 $cc $cppflags -DI_SYS_FILE -o access access.c >/dev/null 2>&1 ; then
7046                 h_sysfile=true;
7047                 echo "<sys/file.h> defines the *_OK access constants." >&4
7048         elif $test `./findhdr fcntl.h` && \
7049                 $cc $cppflags -DI_FCNTL -o access access.c >/dev/null 2>&1 ; then
7050                 h_fcntl=true;
7051                 echo "<fcntl.h> defines the *_OK access constants." >&4
7052         elif $test `./findhdr unistd.h` && \
7053                 $cc $cppflags -DI_UNISTD -o access access.c >/dev/null 2>&1 ; then
7054                 echo "<unistd.h> defines the *_OK access constants." >&4
7055         else
7056                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
7057         fi
7058         ;;
7059 esac
7060 $rm -f access*
7061
7062 : see if accessx exists
7063 set accessx d_accessx
7064 eval $inlibc
7065
7066 : see if alarm exists
7067 set alarm d_alarm
7068 eval $inlibc
7069
7070 : see if atolf exists
7071 set atolf d_atolf
7072 eval $inlibc
7073
7074 : see if atoll exists
7075 set atoll d_atoll
7076 eval $inlibc
7077
7078 : Look for GNU-cc style attribute checking
7079 echo " "
7080 echo "Checking whether your compiler can handle __attribute__ ..." >&4
7081 $cat >attrib.c <<'EOCP'
7082 #include <stdio.h>
7083 void croak (char* pat,...) __attribute__((format(printf,1,2),noreturn));
7084 EOCP
7085 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
7086         if $contains 'warning' attrib.out >/dev/null 2>&1; then
7087                 echo "Your C compiler doesn't fully support __attribute__."
7088                 val="$undef"
7089         else
7090                 echo "Your C compiler supports __attribute__."
7091                 val="$define"
7092         fi
7093 else
7094         echo "Your C compiler doesn't seem to understand __attribute__ at all."
7095         val="$undef"
7096 fi
7097 set d_attribut
7098 eval $setvar
7099 $rm -f attrib*
7100
7101 : see if bcmp exists
7102 set bcmp d_bcmp
7103 eval $inlibc
7104
7105 : see if bcopy exists
7106 set bcopy d_bcopy
7107 eval $inlibc
7108
7109 : see if this is a unistd.h system
7110 set unistd.h i_unistd
7111 eval $inhdr
7112
7113 : see if getpgrp exists
7114 set getpgrp d_getpgrp
7115 eval $inlibc
7116
7117 case "$d_getpgrp" in
7118 "$define")
7119         echo " "
7120         echo "Checking to see which flavor of getpgrp is in use..."
7121         $cat >set.c <<EOP
7122 #$i_unistd I_UNISTD
7123 #include <sys/types.h>
7124 #ifdef I_UNISTD
7125 #  include <unistd.h>
7126 #endif
7127 int main()
7128 {
7129         if (getuid() == 0) {
7130                 printf("(I see you are running Configure as super-user...)\n");
7131                 setuid(1);
7132         }
7133 #ifdef TRY_BSD_PGRP
7134         if (getpgrp(1) == 0)
7135                 exit(0);
7136 #else
7137         if (getpgrp() > 0)
7138                 exit(0);
7139 #endif
7140         exit(1);
7141 }
7142 EOP
7143         if $cc -DTRY_BSD_PGRP $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7144                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
7145                 val="$define"
7146         elif $cc $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7147                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
7148                 val="$undef"
7149         else
7150                 echo "I can't seem to compile and run the test program."
7151                 if ./usg; then
7152                         xxx="a USG one, i.e. you use getpgrp()."
7153                 else
7154                         # SVR4 systems can appear rather BSD-ish.
7155                         case "$i_unistd" in
7156                         $undef)
7157                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
7158                                 val="$define"
7159                                 ;;
7160                         $define)
7161                                 xxx="probably a USG one, i.e. you use getpgrp()."
7162                                 val="$undef"
7163                                 ;;
7164                         esac
7165                 fi
7166                 echo "Assuming your getpgrp is $xxx" >&4
7167         fi
7168         ;;
7169 *) val="$undef";;
7170 esac
7171 set d_bsdgetpgrp
7172 eval $setvar
7173 $rm -f set set.c
7174
7175 : see if setpgrp exists
7176 set setpgrp d_setpgrp
7177 eval $inlibc
7178
7179 case "$d_setpgrp" in
7180 "$define")
7181         echo " "
7182         echo "Checking to see which flavor of setpgrp is in use..."
7183         $cat >set.c <<EOP
7184 #$i_unistd I_UNISTD
7185 #include <sys/types.h>
7186 #ifdef I_UNISTD
7187 #  include <unistd.h>
7188 #endif
7189 int main()
7190 {
7191         if (getuid() == 0) {
7192                 printf("(I see you are running Configure as super-user...)\n");
7193                 setuid(1);
7194         }
7195 #ifdef TRY_BSD_PGRP
7196         if (-1 == setpgrp(1, 1))
7197                 exit(0);
7198 #else
7199         if (setpgrp() != -1)
7200                 exit(0);
7201 #endif
7202         exit(1);
7203 }
7204 EOP
7205         if $cc -DTRY_BSD_PGRP $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7206                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
7207                 val="$define"
7208         elif $cc $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7209                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
7210                 val="$undef"
7211         else
7212                 echo "(I can't seem to compile and run the test program.)"
7213                 if ./usg; then
7214                         xxx="a USG one, i.e. you use setpgrp()."
7215                 else
7216                         # SVR4 systems can appear rather BSD-ish.
7217                         case "$i_unistd" in
7218                         $undef)
7219                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
7220                                 val="$define"
7221                                 ;;
7222                         $define)
7223                                 xxx="probably a USG one, i.e. you use setpgrp()."
7224                                 val="$undef"
7225                                 ;;
7226                         esac
7227                 fi
7228                 echo "Assuming your setpgrp is $xxx" >&4
7229         fi
7230         ;;
7231 *) val="$undef";;
7232 esac
7233 set d_bsdsetpgrp
7234 eval $setvar
7235 $rm -f set set.c
7236 : see if bzero exists
7237 set bzero d_bzero
7238 eval $inlibc
7239
7240 : check for lengths of integral types
7241 echo " "
7242 case "$intsize" in
7243 '')
7244         echo "Checking to see how big your integers are..." >&4
7245         $cat >intsize.c <<'EOCP'
7246 #include <stdio.h>
7247 int main()
7248 {
7249         printf("intsize=%d;\n", (int)sizeof(int));
7250         printf("longsize=%d;\n", (int)sizeof(long));
7251         printf("shortsize=%d;\n", (int)sizeof(short));
7252         exit(0);
7253 }
7254 EOCP
7255         set intsize
7256         if eval $compile_ok && ./intsize > /dev/null; then
7257                 eval `./intsize`
7258                 echo "Your integers are $intsize bytes long."
7259                 echo "Your long integers are $longsize bytes long."
7260                 echo "Your short integers are $shortsize bytes long."
7261         else
7262                 $cat >&4 <<EOM
7263 !
7264 Help! I can't compile and run the intsize test program: please enlighten me!
7265 (This is probably a misconfiguration in your system or libraries, and
7266 you really ought to fix it.  Still, I'll try anyway.)
7267 !
7268 EOM
7269                 dflt=4
7270                 rp="What is the size of an integer (in bytes)?"
7271                 . ./myread
7272                 intsize="$ans"
7273                 dflt=$intsize
7274                 rp="What is the size of a long integer (in bytes)?"
7275                 . ./myread
7276                 longsize="$ans"
7277                 dflt=2
7278                 rp="What is the size of a short integer (in bytes)?"
7279                 . ./myread
7280                 shortsize="$ans"
7281         fi
7282         ;;
7283 esac
7284 $rm -f intsize intsize.*
7285
7286 : see if signal is declared as pointer to function returning int or void
7287 echo " "
7288 xxx=`./findhdr signal.h`
7289 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
7290 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
7291         echo "You have int (*signal())() instead of void." >&4
7292         val="$undef"
7293 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
7294         echo "You have void (*signal())()." >&4
7295         val="$define"
7296 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
7297         echo "You have int (*signal())() instead of void." >&4
7298         val="$undef"
7299 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
7300         echo "You have void (*signal())()." >&4
7301         val="$define"
7302 else
7303         case "$d_voidsig" in
7304         '')
7305         echo "I can't determine whether signal handler returns void or int..." >&4
7306                 dflt=void
7307                 rp="What type does your signal handler return?"
7308                 . ./myread
7309                 case "$ans" in
7310                 v*) val="$define";;
7311                 *) val="$undef";;
7312                 esac;;
7313         "$define")
7314                 echo "As you already told me, signal handler returns void." >&4
7315                 val="$define"
7316                 ;;
7317         *)      echo "As you already told me, signal handler returns int." >&4
7318                 val="$undef"
7319                 ;;
7320         esac
7321 fi
7322 set d_voidsig
7323 eval $setvar
7324 case "$d_voidsig" in
7325 "$define") signal_t="void";;
7326 *) signal_t="int";;
7327 esac
7328 $rm -f $$.tmp
7329
7330 : check for ability to cast large floats to 32-bit ints.
7331 echo " "
7332 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
7333 if $test "$intsize" -ge 4; then
7334         xxx=int
7335 else
7336         xxx=long
7337 fi
7338 $cat >try.c <<EOCP
7339 #include <stdio.h>
7340 #include <sys/types.h>
7341 #include <signal.h>
7342 $signal_t blech(s) int s; { exit(3); }
7343 int main()
7344 {
7345         $xxx i32;
7346         double f, g;
7347         int result = 0;
7348         char str[16];
7349         signal(SIGFPE, blech);
7350
7351         /* Don't let compiler optimize the test away.  Store the number 
7352            in a writable string for gcc to pass to sscanf under HP/UX.
7353         */
7354         sprintf(str, "2147483647");
7355         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
7356         g = 10 * f;
7357         i32  = ($xxx) g;
7358
7359         /* x86 processors will probably give 0x8000 0000, which is a
7360        sign change.  We don't want that.  We want to mimic SPARC
7361            behavior here, which is to preserve the sign and give
7362            back 0x7fff ffff.
7363         */
7364         if (i32 != ($xxx) f)
7365                 result |= 1;
7366         exit(result);
7367 }
7368 EOCP
7369 set try
7370 if eval $compile_ok; then
7371         ./try
7372         yyy=$?
7373 else
7374         echo "(I can't seem to compile the test program--assuming it can't)"
7375         yyy=1
7376 fi
7377 case "$yyy" in
7378 0)      val="$define"
7379         echo "Yup, it can."
7380         ;;
7381 *)      val="$undef"
7382         echo "Nope, it can't."
7383         ;;
7384 esac
7385 set d_casti32
7386 eval $setvar
7387 $rm -f try try.*
7388
7389 : check for ability to cast negative floats to unsigned
7390 echo " "
7391 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
7392 $cat >try.c <<EOCP
7393 #include <stdio.h>
7394 #include <sys/types.h>
7395 #include <signal.h>
7396 $signal_t blech(s) int s; { exit(7); }
7397 $signal_t blech_in_list(s) int s; { exit(4); }
7398 unsigned long dummy_long(p) unsigned long p; { return p; }
7399 unsigned int dummy_int(p) unsigned int p; { return p; }
7400 unsigned short dummy_short(p) unsigned short p; { return p; }
7401 int main()
7402 {
7403         double f;
7404         unsigned long along;
7405         unsigned int aint;
7406         unsigned short ashort;
7407         int result = 0;
7408         char str[16];
7409         
7410         /* Frustrate gcc-2.7.2's optimizer which failed this test with
7411            a direct f = -123. assignment.  gcc-2.8.0 reportedly
7412            optimized the whole file away
7413         */
7414         /* Store the number in a writable string for gcc to pass to 
7415            sscanf under HP/UX.
7416         */
7417         sprintf(str, "-123");
7418         sscanf(str, "%lf", &f);  /* f = -123.; */
7419
7420         signal(SIGFPE, blech);
7421         along = (unsigned long)f;
7422         aint = (unsigned int)f;
7423         ashort = (unsigned short)f;
7424         if (along != (unsigned long)-123)
7425                 result |= 1;
7426         if (aint != (unsigned int)-123)
7427                 result |= 1;
7428         if (ashort != (unsigned short)-123)
7429                 result |= 1;
7430         sprintf(str, "1073741824.");
7431         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
7432         f = f + f;
7433         along = 0;
7434         along = (unsigned long)f;
7435         if (along != 0x80000000)
7436                 result |= 2;
7437         f -= 1.;
7438         along = 0;
7439         along = (unsigned long)f;
7440         if (along != 0x7fffffff)
7441                 result |= 1;
7442         f += 2.;
7443         along = 0;
7444         along = (unsigned long)f;
7445         if (along != 0x80000001)
7446                 result |= 2;
7447         if (result)
7448                 exit(result);
7449         signal(SIGFPE, blech_in_list);
7450         sprintf(str, "123.");
7451         sscanf(str, "%lf", &f);  /* f = 123.; */
7452         along = dummy_long((unsigned long)f);
7453         aint = dummy_int((unsigned int)f);
7454         ashort = dummy_short((unsigned short)f);
7455         if (along != (unsigned long)123)
7456                 result |= 4;
7457         if (aint != (unsigned int)123)
7458                 result |= 4;
7459         if (ashort != (unsigned short)123)
7460                 result |= 4;
7461         exit(result);
7462
7463 }
7464 EOCP
7465 set try
7466 if eval $compile_ok; then
7467         ./try
7468         castflags=$?
7469 else
7470         echo "(I can't seem to compile the test program--assuming it can't)"
7471         castflags=7
7472 fi
7473 case "$castflags" in
7474 0)      val="$define"
7475         echo "Yup, it can."
7476         ;;
7477 *)      val="$undef"
7478         echo "Nope, it can't."
7479         ;;
7480 esac
7481 set d_castneg
7482 eval $setvar
7483 $rm -f try.*
7484
7485 : see if vprintf exists
7486 echo " "
7487 if set vprintf val -f d_vprintf; eval $csym; $val; then
7488         echo 'vprintf() found.' >&4
7489         val="$define"
7490         $cat >vprintf.c <<'EOF'
7491 #include <varargs.h>
7492
7493 int main() { xxx("foo"); }
7494
7495 xxx(va_alist)
7496 va_dcl
7497 {
7498         va_list args;
7499         char buf[10];
7500
7501         va_start(args);
7502         exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
7503 }
7504 EOF
7505         set vprintf
7506         if eval $compile && ./vprintf; then
7507                 echo "Your vsprintf() returns (int)." >&4
7508                 val2="$undef"
7509         else
7510                 echo "Your vsprintf() returns (char*)." >&4
7511                 val2="$define"
7512         fi
7513 else
7514         echo 'vprintf() NOT found.' >&4
7515                 val="$undef"
7516                 val2="$undef"
7517 fi
7518 set d_vprintf
7519 eval $setvar
7520 val=$val2
7521 set d_charvspr
7522 eval $setvar
7523
7524 : see if chown exists
7525 set chown d_chown
7526 eval $inlibc
7527
7528 : see if chroot exists
7529 set chroot d_chroot
7530 eval $inlibc
7531
7532 : see if chsize exists
7533 set chsize d_chsize
7534 eval $inlibc
7535
7536 : check for const keyword
7537 echo " "
7538 echo 'Checking to see if your C compiler knows about "const"...' >&4
7539 $cat >const.c <<'EOCP'
7540 typedef struct spug { int drokk; } spug;
7541 int main()
7542 {
7543         const char *foo;
7544         const spug y;
7545 }
7546 EOCP
7547 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
7548         val="$define"
7549         echo "Yup, it does."
7550 else
7551         val="$undef"
7552         echo "Nope, it doesn't."
7553 fi
7554 set d_const
7555 eval $setvar
7556
7557 : see if crypt exists
7558 echo " "
7559 if set crypt val -f d_crypt; eval $csym; $val; then
7560         echo 'crypt() found.' >&4
7561         val="$define"
7562         cryptlib=''
7563 else
7564         cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
7565         if $test -z "$cryptlib"; then
7566                 cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
7567         else
7568                 cryptlib=-lcrypt
7569         fi
7570         if $test -z "$cryptlib"; then
7571                 cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
7572         else
7573                 cryptlib=-lcrypt
7574         fi
7575         if $test -z "$cryptlib"; then
7576                 cryptlib=`./loc libcrypt$_a "" $libpth`
7577         else
7578                 cryptlib=-lcrypt
7579         fi
7580         if $test -z "$cryptlib"; then
7581                 echo 'crypt() NOT found.' >&4
7582                 val="$undef"
7583         else
7584                 val="$define"
7585         fi
7586 fi
7587 set d_crypt
7588 eval $setvar
7589
7590 : get csh whereabouts
7591 case "$csh" in
7592 'csh') val="$undef" ;;
7593 *) val="$define" ;;
7594 esac
7595 set d_csh
7596 eval $setvar
7597 : Respect a hint or command line value for full_csh.
7598 case "$full_csh" in
7599 '') full_csh=$csh ;;
7600 esac
7601
7602 : see if cuserid exists
7603 set cuserid d_cuserid
7604 eval $inlibc
7605
7606 : see if this is a limits.h system
7607 set limits.h i_limits
7608 eval $inhdr
7609
7610 : see if this is a float.h system
7611 set float.h i_float
7612 eval $inhdr
7613
7614 : See if number of significant digits in a double precision number is known
7615 echo " "
7616 $cat >dbl_dig.c <<EOM
7617 #$i_limits I_LIMITS
7618 #$i_float I_FLOAT
7619 #ifdef I_LIMITS
7620 #include <limits.h>
7621 #endif
7622 #ifdef I_FLOAT
7623 #include <float.h>
7624 #endif
7625 #ifdef DBL_DIG
7626 printf("Contains DBL_DIG");
7627 #endif
7628 EOM
7629 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
7630 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
7631         echo "DBL_DIG found." >&4
7632         val="$define"
7633 else
7634         echo "DBL_DIG NOT found." >&4
7635         val="$undef"
7636 fi
7637 $rm -f dbl_dig.?
7638 set d_dbl_dig
7639 eval $setvar
7640
7641 : see if difftime exists
7642 set difftime d_difftime
7643 eval $inlibc
7644
7645 : see if this is a dirent system
7646 echo " "
7647 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
7648         val="$define"
7649         echo "<dirent.h> found." >&4
7650 else
7651         val="$undef"
7652         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
7653                 echo "<sys/dir.h> found." >&4
7654                 echo " "
7655         else
7656                 xinc=`./findhdr sys/ndir.h`
7657         fi
7658         echo "<dirent.h> NOT found." >&4
7659 fi
7660 set i_dirent
7661 eval $setvar
7662
7663 : Look for type of directory structure.
7664 echo " "
7665 $cppstdin $cppflags $cppminus < "$xinc" > try.c
7666
7667 case "$direntrytype" in
7668 ''|' ')
7669         case "$i_dirent" in
7670         $define) guess1='struct dirent' ;;
7671         *) guess1='struct direct'  ;;
7672         esac
7673         ;;
7674 *)      guess1="$direntrytype"
7675         ;;
7676 esac
7677
7678 case "$guess1" in
7679 'struct dirent') guess2='struct direct' ;;
7680 *) guess2='struct dirent' ;;
7681 esac
7682                 
7683 if $contains "$guess1" try.c >/dev/null 2>&1; then
7684         direntrytype="$guess1"
7685         echo "Your directory entries are $direntrytype." >&4
7686 elif $contains "$guess2" try.c >/dev/null 2>&1; then
7687         direntrytype="$guess2"
7688         echo "Your directory entries seem to be $direntrytype." >&4
7689 else
7690         echo "I don't recognize your system's directory entries." >&4
7691         rp="What type is used for directory entries on this system?"
7692         dflt="$guess1"
7693         . ./myread
7694         direntrytype="$ans"
7695 fi
7696 $rm -f try.c
7697
7698
7699 : see if the directory entry stores field length
7700 echo " "
7701 $cppstdin $cppflags $cppminus < "$xinc" > try.c
7702 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
7703         echo "Good, your directory entry keeps length information in d_namlen." >&4
7704         val="$define"
7705 else
7706         echo "Your directory entry does not know about the d_namlen field." >&4
7707         val="$undef"
7708 fi
7709 set d_dirnamlen
7710 eval $setvar
7711 $rm -f try.c
7712
7713 : see if dlerror exists
7714 xxx_runnm="$runnm"
7715 runnm=false
7716 set dlerror d_dlerror
7717 eval $inlibc
7718 runnm="$xxx_runnm"
7719
7720 : see if dlfcn is available
7721 set dlfcn.h i_dlfcn
7722 eval $inhdr
7723
7724 case "$usedl" in
7725 $define|y|true)
7726         $cat << EOM
7727
7728 On a few systems, the dynamically loaded modules that perl generates and uses
7729 will need a different extension than shared libs. The default will probably
7730 be appropriate.
7731
7732 EOM
7733         case "$dlext" in
7734         '')     dflt="$so" ;;
7735         *)      dflt="$dlext" ;;
7736         esac
7737         rp='What is the extension of dynamically loaded modules'
7738         . ./myread
7739         dlext="$ans"
7740         ;;
7741 *)
7742         dlext="none"
7743         ;;
7744 esac
7745
7746 : Check if dlsym need a leading underscore
7747 echo " "
7748 val="$undef"
7749
7750 case "$dlsrc" in
7751 dl_dlopen.xs)
7752         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
7753         $cat >dyna.c <<'EOM'
7754 fred () { }
7755 EOM
7756
7757 $cat >fred.c<<EOM
7758
7759 #include <stdio.h>
7760 #$i_dlfcn I_DLFCN
7761 #ifdef I_DLFCN
7762 #include <dlfcn.h>      /* the dynamic linker include file for Sunos/Solaris */
7763 #else
7764 #include <sys/types.h>
7765 #include <nlist.h>
7766 #include <link.h>
7767 #endif
7768
7769 extern int fred() ;
7770
7771 int main()
7772 {
7773     void * handle ;
7774     void * symbol ;
7775 #ifndef RTLD_LAZY
7776     int mode = 1 ;
7777 #else
7778     int mode = RTLD_LAZY ;
7779 #endif
7780     handle = dlopen("./dyna.$dlext", mode) ;
7781     if (handle == NULL) {
7782         printf ("1\n") ;
7783         fflush (stdout) ;
7784         exit(0);
7785     }
7786     symbol = dlsym(handle, "fred") ;
7787     if (symbol == NULL) {
7788         /* try putting a leading underscore */
7789         symbol = dlsym(handle, "_fred") ;
7790         if (symbol == NULL) {
7791             printf ("2\n") ;
7792             fflush (stdout) ;
7793             exit(0);
7794         }
7795         printf ("3\n") ;
7796     }
7797     else
7798         printf ("4\n") ;
7799     fflush (stdout) ;
7800     exit(0);
7801 }
7802 EOM
7803         : Call the object file tmp-dyna.o in case dlext=o.
7804         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 && 
7805                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 && 
7806                 $ld $lddlflags -o dyna.$dlext tmp-dyna${_o} > /dev/null 2>&1 && 
7807                 $cc $ccflags -o fred $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1; then
7808                 xxx=`./fred`
7809                 case $xxx in
7810                 1)      echo "Test program failed using dlopen." >&4
7811                         echo "Perhaps you should not use dynamic loading." >&4;;
7812                 2)      echo "Test program failed using dlsym." >&4
7813                         echo "Perhaps you should not use dynamic loading." >&4;;
7814                 3)      echo "dlsym needs a leading underscore" >&4
7815                         val="$define" ;;
7816                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
7817                 esac
7818         else
7819                 echo "I can't compile and run the test program." >&4
7820                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
7821         fi
7822         ;;
7823 esac
7824                 
7825 $rm -f fred fred.? dyna.$dlext dyna.? tmp-dyna.?
7826
7827 set d_dlsymun
7828 eval $setvar
7829
7830 hasproto='varname=$1; func=$2; shift; shift;
7831 while $test $# -ge 2; do
7832         case "$1" in
7833         $define) echo "#include <$2>";;
7834         esac ;
7835     shift 2;
7836 done > try.c;
7837 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
7838 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
7839         echo "$func() prototype found.";
7840         val="$define";
7841 else
7842         echo "$func() prototype NOT found.";
7843         val="$undef";
7844 fi;
7845 set $varname;
7846 eval $setvar;
7847 $rm -f try.c tryout.c'
7848
7849 : see if prototype for drand48 is available
7850 echo " "
7851 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
7852 eval $hasproto
7853
7854 : see if dup2 exists
7855 set dup2 d_dup2
7856 eval $inlibc
7857
7858 : see if eaccess exists
7859 set eaccess d_eaccess
7860 eval $inlibc
7861
7862 : see if endgrent exists
7863 set endgrent d_endgrent
7864 eval $inlibc
7865
7866 : see if endhostent exists
7867 set endhostent d_endhent
7868 eval $inlibc
7869
7870 : see if endnetent exists
7871 set endnetent d_endnent
7872 eval $inlibc
7873
7874 : see if endprotoent exists
7875 set endprotoent d_endpent
7876 eval $inlibc
7877
7878 : see if endpwent exists
7879 set endpwent d_endpwent
7880 eval $inlibc
7881
7882 : see if endservent exists
7883 set endservent d_endsent
7884 eval $inlibc
7885
7886 : see if endspent exists
7887 set endspent d_endspent
7888 eval $inlibc
7889
7890 : Locate the flags for 'open()'
7891 echo " "
7892 $cat >open3.c <<'EOCP'
7893 #include <sys/types.h>
7894 #ifdef I_FCNTL
7895 #include <fcntl.h>
7896 #endif
7897 #ifdef I_SYS_FILE
7898 #include <sys/file.h>
7899 #endif
7900 int main() {
7901         if(O_RDONLY);
7902 #ifdef O_TRUNC
7903         exit(0);
7904 #else
7905         exit(1);
7906 #endif
7907 }
7908 EOCP
7909 : check sys/file.h first to get FREAD on Sun
7910 if $test `./findhdr sys/file.h` && \
7911                 set open3 -DI_SYS_FILE && eval $compile; then
7912         h_sysfile=true;
7913         echo "<sys/file.h> defines the O_* constants..." >&4
7914         if ./open3; then
7915                 echo "and you have the 3 argument form of open()." >&4
7916                 val="$define"
7917         else
7918                 echo "but not the 3 argument form of open().  Oh, well." >&4
7919                 val="$undef"
7920         fi
7921 elif $test `./findhdr fcntl.h` && \
7922                 set open3 -DI_FCNTL && eval $compile; then
7923         h_fcntl=true;
7924         echo "<fcntl.h> defines the O_* constants..." >&4
7925         if ./open3; then
7926                 echo "and you have the 3 argument form of open()." >&4
7927                 val="$define"
7928         else
7929                 echo "but not the 3 argument form of open().  Oh, well." >&4
7930                 val="$undef"
7931         fi
7932 else
7933         val="$undef"
7934         echo "I can't find the O_* constant definitions!  You got problems." >&4
7935 fi
7936 set d_open3
7937 eval $setvar
7938 $rm -f open3*
7939
7940 : see which of string.h or strings.h is needed
7941 echo " "
7942 strings=`./findhdr string.h`
7943 if $test "$strings" && $test -r "$strings"; then
7944         echo "Using <string.h> instead of <strings.h>." >&4
7945         val="$define"
7946 else
7947         val="$undef"
7948         strings=`./findhdr strings.h`
7949         if $test "$strings" && $test -r "$strings"; then
7950                 echo "Using <strings.h> instead of <string.h>." >&4
7951         else
7952                 echo "No string header found -- You'll surely have problems." >&4
7953         fi
7954 fi
7955 set i_string
7956 eval $setvar
7957 case "$i_string" in
7958 "$undef") strings=`./findhdr strings.h`;;
7959 *)        strings=`./findhdr string.h`;;
7960 esac
7961
7962 : check for non-blocking I/O stuff
7963 case "$h_sysfile" in
7964 true) echo "#include <sys/file.h>" > head.c;;
7965 *)
7966         case "$h_fcntl" in
7967         true) echo "#include <fcntl.h>" > head.c;;
7968         *) echo "#include <sys/fcntl.h>" > head.c;;
7969         esac
7970         ;;
7971 esac
7972 echo " "
7973 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
7974 case "$o_nonblock" in
7975 '')
7976         $cat head.c > try.c
7977         $cat >>try.c <<'EOCP'
7978 #include <stdio.h>
7979 int main() {
7980 #ifdef O_NONBLOCK
7981         printf("O_NONBLOCK\n");
7982         exit(0);
7983 #endif
7984 #ifdef O_NDELAY
7985         printf("O_NDELAY\n");
7986         exit(0);
7987 #endif
7988 #ifdef FNDELAY
7989         printf("FNDELAY\n");
7990         exit(0);
7991 #endif
7992         exit(0);
7993 }
7994 EOCP
7995         set try
7996         if eval $compile_ok; then
7997                 o_nonblock=`./try`
7998                 case "$o_nonblock" in
7999                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
8000                 *) echo "Seems like we can use $o_nonblock.";;
8001                 esac
8002         else
8003                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
8004         fi
8005         ;;
8006 *) echo "Using $hint value $o_nonblock.";;
8007 esac
8008 $rm -f try try.* .out core
8009
8010 echo " "
8011 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
8012 case "$eagain" in
8013 '')
8014         $cat head.c > try.c
8015         $cat >>try.c <<EOCP
8016 #include <errno.h>
8017 #include <sys/types.h>
8018 #include <signal.h>
8019 #include <stdio.h> 
8020 #define MY_O_NONBLOCK $o_nonblock
8021 #ifndef errno  /* XXX need better Configure test */
8022 extern int errno;
8023 #endif
8024 #$i_unistd I_UNISTD
8025 #ifdef I_UNISTD
8026 #include <unistd.h>
8027 #endif
8028 #ifdef $i_string
8029 #include <string.h>
8030 #else
8031 #include <strings.h>
8032 #endif
8033 $signal_t blech(x) int x; { exit(3); }
8034 EOCP
8035         $cat >> try.c <<'EOCP'
8036 int main()
8037 {
8038         int pd[2];
8039         int pu[2];
8040         char buf[1];
8041         char string[100];
8042
8043         pipe(pd);       /* Down: child -> parent */
8044         pipe(pu);       /* Up: parent -> child */
8045         if (0 != fork()) {
8046                 int ret;
8047                 close(pd[1]);   /* Parent reads from pd[0] */
8048                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
8049                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
8050                         exit(1);
8051                 signal(SIGALRM, blech);
8052                 alarm(5);
8053                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
8054                         exit(2);
8055                 sprintf(string, "%d\n", ret);
8056                 write(2, string, strlen(string));
8057                 alarm(0);
8058 #ifdef EAGAIN
8059                 if (errno == EAGAIN) {
8060                         printf("EAGAIN\n");
8061                         goto ok;
8062                 }
8063 #endif
8064 #ifdef EWOULDBLOCK
8065                 if (errno == EWOULDBLOCK)
8066                         printf("EWOULDBLOCK\n");
8067 #endif
8068         ok:
8069                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
8070                 sleep(2);                               /* Give it time to close our pipe */
8071                 alarm(5);
8072                 ret = read(pd[0], buf, 1);      /* Should read EOF */
8073                 alarm(0);
8074                 sprintf(string, "%d\n", ret);
8075                 write(3, string, strlen(string));
8076                 exit(0);
8077         }
8078
8079         close(pd[0]);                   /* We write to pd[1] */
8080         close(pu[1]);                   /* We read from pu[0] */
8081         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
8082         close(pd[1]);                   /* Pipe pd is now fully closed! */
8083         exit(0);                                /* Bye bye, thank you for playing! */
8084 }
8085 EOCP
8086         set try
8087         if eval $compile_ok; then
8088                 echo "$startsh" >mtry
8089                 echo "./try >try.out 2>try.ret 3>try.err || exit 4" >>mtry
8090                 chmod +x mtry
8091                 ./mtry >/dev/null 2>&1
8092                 case $? in
8093                 0) eagain=`$cat try.out`;;
8094                 1) echo "Could not perform non-blocking setting!";;
8095                 2) echo "I did a successful read() for something that was not there!";;
8096                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
8097                 *) echo "Something terribly wrong happened during testing.";;
8098                 esac
8099                 rd_nodata=`$cat try.ret`
8100                 echo "A read() system call with no data present returns $rd_nodata."
8101                 case "$rd_nodata" in
8102                 0|-1) ;;
8103                 *)
8104                         echo "(That's peculiar, fixing that to be -1.)"
8105                         rd_nodata=-1
8106                         ;;
8107                 esac
8108                 case "$eagain" in
8109                 '')
8110                         echo "Forcing errno EAGAIN on read() with no data available."
8111                         eagain=EAGAIN
8112                         ;;
8113                 *)
8114                         echo "Your read() sets errno to $eagain when no data is available."
8115                         ;;
8116                 esac
8117                 status=`$cat try.err`
8118                 case "$status" in
8119                 0) echo "And it correctly returns 0 to signal EOF.";;
8120                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
8121                 *) echo "However, your read() returns '$status' on EOF??";;
8122                 esac
8123                 val="$define"
8124                 if test "$status" = "$rd_nodata"; then
8125                         echo "WARNING: you can't distinguish between EOF and no data!"
8126                         val="$undef"
8127                 fi
8128         else
8129                 echo "I can't compile the test program--assuming errno EAGAIN will do."
8130                 eagain=EAGAIN
8131         fi
8132         set d_eofnblk
8133         eval $setvar
8134         ;;
8135 *)
8136         echo "Using $hint value $eagain."
8137         echo "Your read() returns $rd_nodata when no data is present."
8138         case "$d_eofnblk" in
8139         "$define") echo "And you can see EOF because read() returns 0.";;
8140         "$undef") echo "But you can't see EOF status from read() returned value.";;
8141         *)
8142                 echo "(Assuming you can't see EOF status from read anyway.)"
8143                 d_eofnblk=$undef
8144                 ;;
8145         esac
8146         ;;
8147 esac
8148 $rm -f try try.* .out core head.c mtry
8149
8150 : see if fchmod exists
8151 set fchmod d_fchmod
8152 eval $inlibc
8153
8154 : see if fchown exists
8155 set fchown d_fchown
8156 eval $inlibc
8157
8158 : see if this is an fcntl system
8159 set fcntl d_fcntl
8160 eval $inlibc
8161
8162 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
8163 while $test $# -ge 2; do
8164         case "$1" in
8165         $define) echo "#include <$2>";;
8166         esac ;
8167     shift 2;
8168 done > try.c;
8169 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
8170 set try;
8171 if eval $compile; then
8172         val="$define";
8173 else
8174         val="$undef";
8175 fi;
8176 set $varname;
8177 eval $setvar;
8178 $rm -f try.c try.o'
8179
8180 socketlib=''
8181 sockethdr=''
8182 : see whether socket exists
8183 echo " "
8184 $echo $n "Hmm... $c" >&4
8185 if set socket val -f d_socket; eval $csym; $val; then
8186         echo "Looks like you have Berkeley networking support." >&4
8187         d_socket="$define"
8188         if set setsockopt val -f; eval $csym; $val; then
8189                 d_oldsock="$undef"
8190         else
8191                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
8192                 d_oldsock="$define"
8193         fi
8194 else
8195         if $contains socklib libc.list >/dev/null 2>&1; then
8196                 echo "Looks like you have Berkeley networking support." >&4
8197                 d_socket="$define"
8198                 : we will have to assume that it supports the 4.2 BSD interface
8199                 d_oldsock="$undef"
8200         else
8201                 echo "You don't have Berkeley networking in libc$_a..." >&4
8202                 if test "X$d_socket" = "X$define"; then
8203                    echo "...but you seem to believe that you have sockets." >&4
8204                 else
8205                         for net in net socket
8206                         do
8207                                 if test -f /usr/lib/lib$net$_a; then
8208                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
8209                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
8210                                         if $contains socket libc.list >/dev/null 2>&1; then
8211                                                 d_socket="$define"
8212                                                 socketlib="-l$net"
8213                                                 case "$net" in
8214                                                 net)
8215                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
8216                                                         sockethdr="-I/usr/netinclude"
8217                                                         ;;
8218                                                 esac
8219                                                 echo "Found Berkeley sockets interface in lib$net." >& 4 
8220                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
8221                                                         d_oldsock="$undef"
8222                                                 else
8223                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
8224                                                         d_oldsock="$define"
8225                                                 fi
8226                                                 break
8227                                         fi
8228                                 fi
8229                         done
8230                         if test "X$d_socket" != "X$define"; then
8231                            echo "or anywhere else I see." >&4
8232                            d_socket="$undef"
8233                            d_oldsock="$undef"
8234                         fi
8235                 fi
8236         fi
8237 fi
8238
8239 : see if socketpair exists
8240 set socketpair d_sockpair
8241 eval $inlibc
8242
8243
8244 echo " "
8245 echo "Checking the availability of certain socket constants..." >& 4
8246 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
8247         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
8248         $cat >try.c <<EOF
8249 #include <sys/types.h>
8250 #include <sys/socket.h>
8251 int main() {
8252     int i = $ENUM;
8253 }
8254 EOF
8255         val="$undef"
8256         set try; if eval $compile; then
8257                 val="$define"
8258         fi
8259         set d_${enum}; eval $setvar
8260         $rm -f try.c try
8261 done
8262
8263 : see if sys/select.h has to be included
8264 set sys/select.h i_sysselct
8265 eval $inhdr
8266
8267 : see if we should include time.h, sys/time.h, or both
8268 echo " "
8269 if test "X$timeincl" = X; then
8270         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
8271         $echo $n "I'm now running the test program...$c"
8272         $cat >try.c <<'EOCP'
8273 #include <sys/types.h>
8274 #ifdef I_TIME
8275 #include <time.h>
8276 #endif
8277 #ifdef I_SYSTIME
8278 #ifdef SYSTIMEKERNEL
8279 #define KERNEL
8280 #endif
8281 #include <sys/time.h>
8282 #endif
8283 #ifdef I_SYSSELECT
8284 #include <sys/select.h>
8285 #endif
8286 int main()
8287 {
8288         struct tm foo;
8289 #ifdef S_TIMEVAL
8290         struct timeval bar;
8291 #endif
8292 #ifdef S_TIMEZONE
8293         struct timezone tzp;
8294 #endif
8295         if (foo.tm_sec == foo.tm_sec)
8296                 exit(0);
8297 #ifdef S_TIMEVAL
8298         if (bar.tv_sec == bar.tv_sec)
8299                 exit(0);
8300 #endif
8301         exit(1);
8302 }
8303 EOCP
8304         flags=''
8305         for s_timezone in '-DS_TIMEZONE' ''; do
8306         sysselect=''
8307         for s_timeval in '-DS_TIMEVAL' ''; do
8308         for i_systimek in '' '-DSYSTIMEKERNEL'; do
8309         for i_time in '' '-DI_TIME'; do
8310         for i_systime in '-DI_SYSTIME' ''; do
8311                 case "$flags" in
8312                 '') $echo $n ".$c"
8313                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
8314                         if eval $compile; then
8315                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
8316                                 shift
8317                                 flags="$*"
8318                                 echo " "
8319                                 $echo $n "Succeeded with $flags$c"
8320                         fi
8321                         ;;
8322                 esac
8323         done
8324         done
8325         done
8326         done
8327         done
8328         timeincl=''
8329         echo " "
8330         case "$flags" in
8331         *SYSTIMEKERNEL*) i_systimek="$define"
8332                 timeincl=`./findhdr sys/time.h`
8333                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
8334         *) i_systimek="$undef";;
8335         esac
8336         case "$flags" in
8337         *I_TIME*) i_time="$define"
8338                 timeincl=`./findhdr time.h`" $timeincl"
8339                 echo "We'll include <time.h>." >&4;;
8340         *) i_time="$undef";;
8341         esac
8342         case "$flags" in
8343         *I_SYSTIME*) i_systime="$define"
8344                 timeincl=`./findhdr sys/time.h`" $timeincl"
8345                 echo "We'll include <sys/time.h>." >&4;;
8346         *) i_systime="$undef";;
8347         esac
8348         $rm -f try.c try
8349 fi
8350
8351 : check for fd_set items
8352 $cat <<EOM
8353
8354 Checking to see how well your C compiler handles fd_set and friends ...
8355 EOM
8356 $cat >fd_set.c <<EOCP
8357 #$i_systime I_SYS_TIME
8358 #$i_sysselct I_SYS_SELECT
8359 #$d_socket HAS_SOCKET
8360 #include <sys/types.h>
8361 #ifdef HAS_SOCKET
8362 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
8363 #endif
8364 #ifdef I_SYS_TIME
8365 #include <sys/time.h>
8366 #endif
8367 #ifdef I_SYS_SELECT
8368 #include <sys/select.h>
8369 #endif
8370 int main() {
8371         fd_set fds;
8372
8373 #ifdef TRYBITS
8374         if(fds.fds_bits);
8375 #endif
8376
8377 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
8378         exit(0);
8379 #else
8380         exit(1);
8381 #endif
8382 }
8383 EOCP
8384 set fd_set -DTRYBITS
8385 if eval $compile; then
8386         d_fds_bits="$define"
8387         d_fd_set="$define"
8388         echo "Well, your system knows about the normal fd_set typedef..." >&4
8389         if ./fd_set; then
8390                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
8391                 d_fd_macros="$define"
8392         else
8393                 $cat >&4 <<'EOM'
8394 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
8395 EOM
8396                 d_fd_macros="$undef"
8397         fi
8398 else
8399         $cat <<'EOM'
8400 Hmm, your compiler has some difficulty with fd_set.  Checking further...
8401 EOM
8402         set fd_set
8403         if eval $compile; then
8404                 d_fds_bits="$undef"
8405                 d_fd_set="$define"
8406                 echo "Well, your system has some sort of fd_set available..." >&4
8407                 if ./fd_set; then
8408                         echo "and you have the normal fd_set macros." >&4
8409                         d_fd_macros="$define"
8410                 else
8411                         $cat <<'EOM'
8412 but not the normal fd_set macros!  Gross!  More work for me...
8413 EOM
8414                         d_fd_macros="$undef"
8415                 fi
8416         else
8417         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
8418                 d_fd_set="$undef"
8419                 d_fds_bits="$undef"
8420                 d_fd_macros="$undef"
8421         fi
8422 fi
8423 $rm -f fd_set*
8424
8425 : see if fgetpos exists
8426 set fgetpos d_fgetpos
8427 eval $inlibc
8428
8429 : see if flock exists
8430 set flock d_flock
8431 eval $inlibc
8432
8433 : see if fork exists
8434 set fork d_fork
8435 eval $inlibc
8436
8437 : see if pathconf exists
8438 set pathconf d_pathconf
8439 eval $inlibc
8440
8441 : see if fpathconf exists
8442 set fpathconf d_fpathconf
8443 eval $inlibc
8444
8445 : define an is-a-typedef? function
8446 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8447 case "$inclist" in
8448 "") inclist="sys/types.h";;
8449 esac;
8450 eval "varval=\$$var";
8451 case "$varval" in
8452 "")
8453         $rm -f temp.c;
8454         for inc in $inclist; do
8455                 echo "#include <$inc>" >>temp.c;
8456         done;
8457         echo "#ifdef $type" >> temp.c;
8458         echo "printf(\"We have $type\");" >> temp.c;
8459         echo "#endif" >> temp.c;
8460         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8461         if $contains $type temp.E >/dev/null 2>&1; then
8462                 eval "$var=\$type";
8463         else
8464                 eval "$var=\$def";
8465         fi;
8466         $rm -f temp.?;;
8467 *) eval "$var=\$varval";;
8468 esac'
8469
8470 : define an is-a-typedef? function that prompts if the type is not available.
8471 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8472 case "$inclist" in
8473 "") inclist="sys/types.h";;
8474 esac;
8475 eval "varval=\$$var";
8476 case "$varval" in
8477 "")
8478         $rm -f temp.c;
8479         for inc in $inclist; do
8480                 echo "#include <$inc>" >>temp.c;
8481         done;
8482         echo "#ifdef $type" >> temp.c;
8483         echo "printf(\"We have $type\");" >> temp.c;
8484         echo "#endif" >> temp.c;
8485         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8486         echo " " ;
8487         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
8488         if $contains $type temp.E >/dev/null 2>&1; then
8489                 echo "$type found." >&4;
8490                 eval "$var=\$type";
8491         else
8492                 echo "$type NOT found." >&4;
8493                 dflt="$def";
8494                 . ./myread ;
8495                 eval "$var=\$ans";
8496         fi;
8497         $rm -f temp.?;;
8498 *) eval "$var=\$varval";;
8499 esac'
8500
8501 : see what type lseek is declared as in the kernel
8502 rp="What is the type used for lseek's offset on this system?"
8503 set off_t lseektype long stdio.h sys/types.h
8504 eval $typedef_ask
8505
8506 echo " "
8507 $echo $n "Checking to see how big your file offsets are...$c" >&4
8508 $cat >try.c <<EOCP
8509 #include <sys/types.h>
8510 #include <stdio.h>
8511 int main()
8512 {
8513     printf("%d\n", (int)sizeof($lseektype));
8514     return(0); 
8515 }
8516 EOCP
8517 set try
8518 if eval $compile_ok; then
8519         lseeksize=`./try`
8520         $echo " $lseeksize bytes." >&4
8521 else
8522         dflt='4'
8523         echo " "
8524         echo "(I can't seem to compile the test program.  Guessing...)"
8525         rp="What is the size of your file offsets (in bytes)?"
8526         . ./myread
8527         lseeksize="$ans"
8528 fi
8529 $rm -f try.c try
8530
8531 : see what type file positions are declared as in the library
8532 rp="What is the type for file position used by fsetpos()?"
8533 set fpos_t fpostype long stdio.h sys/types.h
8534 eval $typedef_ask
8535
8536 echo " "
8537 case "$fpostype" in
8538 *_t) zzz="$fpostype"    ;;
8539 *)   zzz="fpos_t"       ;;
8540 esac
8541 echo "Checking the size of $zzz..." >&4 
8542 cat > try.c <<EOCP
8543 #include <sys/types.h>
8544 #include <stdio.h>
8545 int main() {
8546     printf("%d\n", (int)sizeof($fpostype));
8547     exit(0);
8548 }
8549 EOCP
8550 set try
8551 if eval $compile_ok; then
8552         yyy=`./try`
8553         case "$yyy" in
8554         '')     fpossize=4
8555                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
8556                 ;;
8557         *)      fpossize=$yyy
8558                 echo "Your $zzz size is $fpossize bytes."
8559                 ;;
8560         esac
8561 else
8562         fpossize=4
8563         echo "(I can't compile the test program--guessing $fpossize.)" >&4
8564 fi
8565
8566
8567
8568 : check for off64_t
8569 echo " "
8570 echo "Checking to see if your system supports off64_t..." >&4
8571 $cat >try.c <<EOCP
8572 #include <sys/types.h>
8573 #include <unistd.h>
8574 int main() { off64_t x = 7; }'
8575 EOCP
8576 set try
8577 if eval $compile; then
8578         val="$define"
8579         echo "Yes, it does."
8580 else
8581         val="$undef"
8582         echo "No, it doesn't."
8583         case "$lseeksize" in
8584         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
8585         esac
8586 fi
8587 $rm -f try.* try
8588 set d_off64_t
8589 eval $setvar
8590
8591 : check for fpos64_t
8592 echo " "
8593 echo "Checking to see if your system supports fpos64_t..." >&4
8594 $cat >try.c <<EOCP
8595 #include <sys/stdio.h>
8596 int main() { fpos64_t x x = 7; }'
8597 EOCP
8598 set try
8599 if eval $compile; then
8600         val="$define"
8601         echo "Yes, it does."
8602 else
8603         val="$undef"
8604         echo "No, it doesn't."
8605         case "$fpossize" in
8606         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
8607         esac
8608 fi
8609 $rm -f try.* try
8610 set d_fpos64_t
8611 eval $setvar
8612
8613 hasstruct='varname=$1; struct=$2; shift; shift;
8614 while $test $# -ge 2; do
8615         case "$1" in
8616         $define) echo "#include <$2>";;
8617         esac ;
8618     shift 2;
8619 done > try.c;
8620 echo "int main () { struct $struct foo; }" >> try.c;
8621 set try;
8622 if eval $compile; then
8623         val="$define";
8624 else
8625         val="$undef";
8626 fi;
8627 set $varname;
8628 eval $setvar;
8629 $rm -f try.c try.o'
8630
8631 : see if this is a sys/param system
8632 set sys/param.h i_sysparam
8633 eval $inhdr
8634
8635 : see if this is a sys/mount.h system
8636 set sys/mount.h i_sysmount
8637 eval $inhdr
8638
8639 : see if sys/types.h has to be included
8640 set sys/types.h i_systypes
8641 eval $inhdr
8642
8643
8644 echo " "
8645 echo "Checking to see if your system supports struct fs_data..." >&4
8646 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
8647 eval $hasstruct
8648 case "$d_fs_data_s" in
8649 "$define")      echo "Yes, it does."   ;;
8650 *)              echo "No, it doesn't." ;;
8651 esac
8652
8653 : see if fseeko exists
8654 set fseeko d_fseeko
8655 eval $inlibc
8656 case "$longsize" in
8657 8) echo "(Your long is 64 bits, so in a pinch you could use fseek.)" ;;
8658 esac
8659
8660 : see if fsetpos exists
8661 set fsetpos d_fsetpos
8662 eval $inlibc
8663
8664
8665 : see if fstatfs exists
8666 set fstatfs d_fstatfs
8667 eval $inlibc
8668
8669
8670 : see if statvfs exists
8671 set statvfs d_statvfs
8672 eval $inlibc
8673
8674 : see if fstatvfs exists
8675 set fstatvfs d_fstatvfs
8676 eval $inlibc
8677
8678
8679 : see if ftello exists
8680 set ftello d_ftello
8681 eval $inlibc
8682 case "$longsize" in
8683 8) echo "(Your long is 64 bits, so in a pinch you could use ftell.)" ;;
8684 esac
8685
8686 : see if getgrent exists
8687 set getgrent d_getgrent
8688 eval $inlibc
8689
8690 : see if gethostbyaddr exists
8691 set gethostbyaddr d_gethbyaddr
8692 eval $inlibc
8693
8694 : see if gethostbyname exists
8695 set gethostbyname d_gethbyname
8696 eval $inlibc
8697
8698 : see if gethostent exists
8699 set gethostent d_gethent
8700 eval $inlibc
8701
8702 : see how we will look up host name
8703 echo " "
8704 call=''
8705 if set gethostname val -f d_gethname; eval $csym; $val; then
8706         echo 'gethostname() found.' >&4
8707         d_gethname="$define"
8708         call=gethostname
8709 fi
8710 if set uname val -f d_uname; eval $csym; $val; then
8711         if ./xenix; then
8712                 $cat <<'EOM'
8713 uname() was found, but you're running xenix, and older versions of xenix
8714 have a broken uname(). If you don't really know whether your xenix is old
8715 enough to have a broken system call, use the default answer.
8716
8717 EOM
8718                 dflt=y
8719                 case "$d_uname" in
8720                 "$define") dflt=n;;
8721                 esac
8722                 rp='Is your uname() broken?'
8723                 . ./myread
8724                 case "$ans" in
8725                 n*) d_uname="$define"; call=uname;;
8726                 esac
8727         else
8728                 echo 'uname() found.' >&4
8729                 d_uname="$define"
8730                 case "$call" in
8731                 '') call=uname ;;
8732                 esac
8733         fi
8734 fi
8735 case "$d_gethname" in
8736 '') d_gethname="$undef";;
8737 esac
8738 case "$d_uname" in
8739 '') d_uname="$undef";;
8740 esac
8741 case "$d_uname$d_gethname" in
8742 *define*)
8743         dflt=n
8744         cat <<EOM
8745  
8746 Every now and then someone has a $call() that lies about the hostname
8747 but can't be fixed for political or economic reasons.  If you wish, I can
8748 pretend $call() isn't there and maybe compute hostname at run-time
8749 thanks to the '$phostname' command.
8750
8751 EOM
8752         rp="Shall I ignore $call() from now on?"
8753         . ./myread
8754         case "$ans" in
8755         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
8756         esac;;
8757 esac
8758 case "$phostname" in
8759 '') aphostname='';;
8760 *) case "$aphostname" in
8761         /*) ;;
8762         *) set X $phostname
8763                 shift
8764                 file=$1
8765                 shift
8766                 file=`./loc $file $file $pth`
8767                 aphostname=`echo $file $*`
8768                 ;;
8769         esac
8770         ;;
8771 esac
8772 case "$d_uname$d_gethname" in
8773 *define*) ;;
8774 *)
8775         case "$phostname" in
8776         '')
8777                 echo "There will be no way for $package to get your hostname." >&4;;
8778         *)
8779         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
8780                 ;;
8781         esac;;
8782 esac
8783 case "$d_phostname" in
8784 '') d_phostname="$undef";;
8785 esac
8786
8787 : see if this is a netdb.h system
8788 set netdb.h i_netdb
8789 eval $inhdr
8790
8791 : see if prototypes for various gethostxxx netdb.h functions are available
8792 echo " "
8793 set d_gethostprotos gethostent $i_netdb netdb.h
8794 eval $hasproto
8795
8796 : see if getlogin exists
8797 set getlogin d_getlogin
8798 eval $inlibc
8799
8800 : see if getmnt exists
8801 set getmnt d_getmnt
8802 eval $inlibc
8803
8804 : see if getmntent exists
8805 set getmntent d_getmntent
8806 eval $inlibc
8807
8808 : see if getnetbyaddr exists
8809 set getnetbyaddr d_getnbyaddr
8810 eval $inlibc
8811
8812 : see if getnetbyname exists
8813 set getnetbyname d_getnbyname
8814 eval $inlibc
8815
8816 : see if getnetent exists
8817 set getnetent d_getnent
8818 eval $inlibc
8819
8820 : see if prototypes for various getnetxxx netdb.h functions are available
8821 echo " "
8822 set d_getnetprotos getnetent $i_netdb netdb.h
8823 eval $hasproto
8824
8825
8826 : see if getprotobyname exists
8827 set getprotobyname d_getpbyname
8828 eval $inlibc
8829
8830 : see if getprotobynumber exists
8831 set getprotobynumber d_getpbynumber
8832 eval $inlibc
8833
8834 : see if getprotoent exists
8835 set getprotoent d_getpent
8836 eval $inlibc
8837
8838 : see if getpgid exists
8839 set getpgid d_getpgid
8840 eval $inlibc
8841
8842 : see if getpgrp2 exists
8843 set getpgrp2 d_getpgrp2
8844 eval $inlibc
8845
8846 : see if getppid exists
8847 set getppid d_getppid
8848 eval $inlibc
8849
8850 : see if getpriority exists
8851 set getpriority d_getprior
8852 eval $inlibc
8853
8854 : see if prototypes for various getprotoxxx netdb.h functions are available
8855 echo " "
8856 set d_getprotoprotos getprotoent $i_netdb netdb.h
8857 eval $hasproto
8858
8859 : see if getpwent exists
8860 set getpwent d_getpwent
8861 eval $inlibc
8862
8863
8864 : see if getservbyname exists
8865 set getservbyname d_getsbyname
8866 eval $inlibc
8867
8868 : see if getservbyport exists
8869 set getservbyport d_getsbyport
8870 eval $inlibc
8871
8872 : see if getservent exists
8873 set getservent d_getsent
8874 eval $inlibc
8875
8876 : see if prototypes for various getservxxx netdb.h functions are available
8877 echo " "
8878 set d_getservprotos getservent $i_netdb netdb.h
8879 eval $hasproto
8880
8881 : see if getspent exists
8882 set getspent d_getspent
8883 eval $inlibc
8884
8885 : see if getspnam exists
8886 set getspnam d_getspnam
8887 eval $inlibc
8888
8889 : see if gettimeofday or ftime exists
8890 set gettimeofday d_gettimeod
8891 eval $inlibc
8892 case "$d_gettimeod" in
8893 "$undef")
8894         set ftime d_ftime 
8895         eval $inlibc
8896         ;;
8897 *)
8898         val="$undef"; set d_ftime; eval $setvar
8899         ;;
8900 esac
8901 case "$d_gettimeod$d_ftime" in
8902 "$undef$undef")
8903         echo " "
8904         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
8905         ;;
8906 esac
8907
8908 : see if this is an grp system
8909 set grp.h i_grp
8910 eval $inhdr
8911
8912 case "$i_grp" in
8913 $define)
8914         xxx=`./findhdr grp.h`
8915         $cppstdin $cppflags $cppminus < $xxx >$$.h
8916
8917         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
8918                 val="$define"
8919         else
8920                 val="$undef"
8921         fi
8922         set d_grpasswd
8923         eval $setvar
8924
8925         $rm -f $$.h
8926         ;;
8927 *)
8928         val="$undef";
8929         set d_grpasswd; eval $setvar
8930         ;;
8931 esac
8932
8933 : see if hasmntopt exists
8934 set hasmntopt d_hasmntopt
8935 eval $inlibc
8936
8937 : see if this is a netinet/in.h or sys/in.h system
8938 set netinet/in.h i_niin sys/in.h i_sysin
8939 eval $inhdr
8940
8941 : see if arpa/inet.h has to be included
8942 set arpa/inet.h i_arpainet
8943 eval $inhdr
8944
8945 : see if htonl --and friends-- exists
8946 val=''
8947 set htonl val
8948 eval $inlibc
8949
8950 : Maybe they are macros.
8951 case "$val" in
8952 $undef)
8953         $cat >htonl.c <<EOM
8954 #include <stdio.h>
8955 #include <sys/types.h>
8956 #$i_niin I_NETINET_IN
8957 #$i_sysin I_SYS_IN
8958 #$i_arpainet I_ARPA_INET
8959 #ifdef I_NETINET_IN
8960 #include <netinet/in.h>
8961 #endif
8962 #ifdef I_SYS_IN
8963 #include <sys/in.h>
8964 #endif
8965 #ifdef I_ARPA_INET
8966 #include <arpa/inet.h>
8967 #endif
8968 #ifdef htonl
8969 printf("Defined as a macro.");
8970 #endif
8971 EOM
8972         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
8973         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
8974                 val="$define"
8975                 echo "But it seems to be defined as a macro." >&4
8976         fi
8977         $rm -f htonl.?
8978         ;;
8979 esac
8980 set d_htonl
8981 eval $setvar
8982
8983 : index or strchr
8984 echo " "
8985 if set index val -f; eval $csym; $val; then
8986         if set strchr val -f d_strchr; eval $csym; $val; then
8987                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
8988                         val="$define"
8989                         vali="$undef"
8990                         echo "strchr() found." >&4
8991                 else
8992                         val="$undef"
8993                         vali="$define"
8994                         echo "index() found." >&4
8995                 fi
8996         else
8997                 val="$undef"
8998                 vali="$define"
8999                 echo "index() found." >&4
9000         fi
9001 else
9002         if set strchr val -f d_strchr; eval $csym; $val; then
9003                 val="$define"
9004                 vali="$undef"
9005                 echo "strchr() found." >&4
9006         else
9007                 echo "No index() or strchr() found!" >&4
9008                 val="$undef"
9009                 vali="$undef"
9010         fi
9011 fi
9012 set d_strchr; eval $setvar
9013 val="$vali"
9014 set d_index; eval $setvar
9015
9016 : check whether inet_aton exists
9017 set inet_aton d_inetaton
9018 eval $inlibc
9019
9020 : see if inttypes.h is available
9021 : we want a real compile instead of Inhdr because some systems
9022 : have an inttypes.h which includes non-existent headers
9023 echo " "
9024 $cat >try.c <<EOCP
9025 #include <inttypes.h>
9026 int main() {
9027         static int32_t foo32 = 0x12345678;
9028 }
9029 EOCP
9030 set try
9031 if eval $compile; then
9032         echo "<inttypes.h> found." >&4
9033         val="$define"
9034 else
9035         echo "<inttypes.h> NOT found." >&4
9036         val="$undef"
9037 fi
9038 $rm -f try.c try
9039 set i_inttypes
9040 eval $setvar
9041
9042 : check for int64_t
9043 echo " "
9044 $echo $n "Checking to see if your system supports int64_t...$c" >&4
9045 $cat >try.c <<EOCP
9046 #include <sys/types.h>
9047 #$i_inttypes I_INTTYPES
9048 #ifdef I_INTTYPES
9049 #include <inttypes.h>
9050 #endif
9051 int main() { int64_t x = 7; }
9052 EOCP
9053 set try
9054 if eval $compile; then
9055         val="$define"
9056         echo " Yes, it does." >&4
9057 else
9058         val="$undef"
9059         echo " No, it doesn't." >&4
9060 fi
9061 $rm -f try try.*
9062 set d_int64t
9063 eval $setvar
9064
9065 : Look for isascii
9066 echo " "
9067 $cat >isascii.c <<'EOCP'
9068 #include <stdio.h>
9069 #include <ctype.h>
9070 int main() {
9071         int c = 'A';
9072         if (isascii(c))
9073                 exit(0);
9074         else
9075                 exit(1);
9076 }
9077 EOCP
9078 set isascii
9079 if eval $compile; then
9080         echo "isascii() found." >&4
9081         val="$define"
9082 else
9083         echo "isascii() NOT found." >&4
9084         val="$undef"
9085 fi
9086 set d_isascii
9087 eval $setvar
9088 $rm -f isascii*
9089
9090 : see if killpg exists
9091 set killpg d_killpg
9092 eval $inlibc
9093
9094 : see if lchown exists
9095 echo " "
9096 $cat > try.c <<'EOCP'
9097 /* System header to define __stub macros and hopefully few prototypes,
9098     which can conflict with char lchown(); below.  */
9099 #include <assert.h>
9100 /* Override any gcc2 internal prototype to avoid an error.  */
9101 /* We use char because int might match the return type of a gcc2
9102    builtin and then its argument prototype would still apply.  */
9103 char lchown();
9104 int main() {
9105     /*  The GNU C library defines this for functions which it implements
9106         to always fail with ENOSYS.  Some functions are actually named
9107         something starting with __ and the normal name is an alias.  */
9108 #if defined (__stub_lchown) || defined (__stub___lchown)
9109 choke me
9110 #else
9111 lchown();
9112 #endif
9113 ; return 0; }
9114 EOCP
9115 set try
9116 if eval $compile; then
9117     $echo "lchown() found." >&4
9118     val="$define"
9119 else
9120     $echo "lchown() NOT found." >&4
9121     val="$undef"
9122 fi
9123 set d_lchown
9124 eval $setvar
9125
9126 : See if number of significant digits in a double precision number is known
9127 echo " "
9128 $cat >ldbl_dig.c <<EOM
9129 #$i_limits I_LIMITS
9130 #$i_float I_FLOAT
9131 #ifdef I_LIMITS
9132 #include <limits.h>
9133 #endif
9134 #ifdef I_FLOAT
9135 #include <float.h>
9136 #endif
9137 #ifdef LDBL_DIG
9138 printf("Contains LDBL_DIG");
9139 #endif
9140 EOM
9141 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
9142 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
9143         echo "LDBL_DIG found." >&4
9144         val="$define"
9145 else
9146         echo "LDBL_DIG NOT found." >&4
9147         val="$undef"
9148 fi
9149 $rm -f ldbl_dig.?
9150 set d_ldbl_dig
9151 eval $setvar
9152
9153 : see if link exists
9154 set link d_link
9155 eval $inlibc
9156
9157 : see if localeconv exists
9158 set localeconv d_locconv
9159 eval $inlibc
9160
9161 : see if lockf exists
9162 set lockf d_lockf
9163 eval $inlibc
9164
9165 : check for long long
9166 echo " "
9167 $echo $n "Checking to see if your system supports long long..." $c >&4
9168 echo 'int main() { long long x = 7; return 0; }' > try.c
9169 set try
9170 if eval $compile; then
9171         val="$define"
9172         echo " Yes, it does." >&4
9173 else
9174         val="$undef"
9175         echo " No, it doesn't." >&4
9176 fi
9177 $rm try.*
9178 set d_longlong
9179 eval $setvar
9180
9181 : check for length of long long
9182 case "${d_longlong}${longlongsize}" in
9183 $define)
9184         echo " "
9185         $echo $n "Checking to see how big your long longs are..." $c >&4
9186         $cat >try.c <<'EOCP'
9187 #include <stdio.h>
9188 int main()
9189 {
9190     printf("%d\n", (int)sizeof(long long));
9191     return(0);
9192 }
9193 EOCP
9194         set try
9195         if eval $compile_ok; then
9196                 longlongsize=`./try$exe_ext`
9197                 $echo " $longlongsize bytes." >&4
9198         else
9199                 dflt='8'
9200                 echo " "
9201                 echo "(I can't seem to compile the test program.  Guessing...)"
9202                 rp="What is the size of a long long (in bytes)?"
9203                 . ./myread
9204                 longlongsize="$ans"
9205         fi
9206         if $test "X$longsize" = "X$longlongsize"; then
9207                 echo "(That isn't any different from an ordinary long.)"
9208         fi      
9209         ;;
9210 esac
9211 $rm -f try.* try
9212
9213 : see if lstat exists
9214 set lstat d_lstat
9215 eval $inlibc
9216
9217 : see if mblen exists
9218 set mblen d_mblen
9219 eval $inlibc
9220
9221 : see if mbstowcs exists
9222 set mbstowcs d_mbstowcs
9223 eval $inlibc
9224
9225 : see if mbtowc exists
9226 set mbtowc d_mbtowc
9227 eval $inlibc
9228
9229 : see if memchr exists
9230 set memchr d_memchr
9231 eval $inlibc
9232
9233 : see if memcmp exists
9234 set memcmp d_memcmp
9235 eval $inlibc
9236
9237 : see if memcpy exists
9238 set memcpy d_memcpy
9239 eval $inlibc
9240
9241 : see if memmove exists
9242 set memmove d_memmove
9243 eval $inlibc
9244
9245 : see if memset exists
9246 set memset d_memset
9247 eval $inlibc
9248
9249 : see if mkdir exists
9250 set mkdir d_mkdir
9251 eval $inlibc
9252
9253 : see if mkfifo exists
9254 set mkfifo d_mkfifo
9255 eval $inlibc
9256
9257 : see if mktime exists
9258 set mktime d_mktime
9259 eval $inlibc
9260
9261 : see if msgctl exists
9262 set msgctl d_msgctl
9263 eval $inlibc
9264
9265 : see if msgget exists
9266 set msgget d_msgget
9267 eval $inlibc
9268
9269 : see if msgsnd exists
9270 set msgsnd d_msgsnd
9271 eval $inlibc
9272
9273 : see if msgrcv exists
9274 set msgrcv d_msgrcv
9275 eval $inlibc
9276
9277 : see how much of the 'msg*(2)' library is present.
9278 h_msg=true
9279 echo " "
9280 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
9281 *"$undef"*) h_msg=false;;
9282 esac
9283 case "$osname" in
9284 freebsd)
9285     case "`ipcs 2>&1`" in
9286     "SVID messages"*"not configured"*)
9287         echo "Your $osname does not have the msg*(2) configured." >&4
9288         h_msg=false
9289         val="$undef"
9290         set msgctl d_msgctl
9291         eval $setvar
9292         set msgget d_msgget
9293         eval $setvar
9294         set msgsnd d_msgsnd
9295         eval $setvar
9296         set msgrcv d_msgrcv
9297         eval $setvar
9298         ;;
9299     esac
9300     ;;
9301 esac
9302 : we could also check for sys/ipc.h ...
9303 if $h_msg && $test `./findhdr sys/msg.h`; then
9304         echo "You have the full msg*(2) library." >&4
9305         val="$define"
9306 else
9307         echo "You don't have the full msg*(2) library." >&4
9308         val="$undef"
9309 fi
9310 set d_msg
9311 eval $setvar
9312
9313 : see if nice exists
9314 set nice d_nice
9315 eval $inlibc
9316
9317 : see if POSIX threads are available
9318 set pthread.h i_pthread
9319 eval $inhdr
9320
9321
9322
9323
9324 : how to create joinable pthreads
9325 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
9326         echo " "
9327         echo "Checking what constant to use for creating joinable pthreads..." >&4 
9328         $cat >try.c <<'EOCP'
9329 #include <pthread.h>
9330 int main() {
9331     int detachstate = JOINABLE;
9332 }
9333 EOCP
9334         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
9335         if eval $compile; then
9336                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
9337                 val="$undef" # Yes, undef.
9338                 set d_old_pthread_create_joinable
9339                 eval $setvar
9340                 val=""
9341                 set old_pthread_create_joinable
9342                 eval $setvar
9343         else
9344                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
9345                 if eval $compile; then
9346                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
9347                         val="$define"
9348                         set d_old_pthread_create_joinable
9349                         eval $setvar
9350                         val=PTHREAD_CREATE_UNDETACHED
9351                         set old_pthread_create_joinable
9352                         eval $setvar
9353                 else            
9354                         set try -DJOINABLE=__UNDETACHED
9355                         if eval $compile; then
9356                                 echo "You seem to use __UNDETACHED." >&4
9357                                 val="$define"
9358                                 set d_old_pthread_create_joinable
9359                                 eval $setvar
9360                                 val=__UNDETACHED
9361                                 set old_pthread_create_joinable
9362                                 eval $setvar
9363                         else
9364                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
9365                                 val="$define"
9366                                 set d_old_pthread_create_joinable
9367                                 eval $setvar
9368                                 val=0
9369                                 set old_pthread_create_joinable
9370                                 eval $setvar
9371                         fi
9372                 fi
9373         fi
9374         $rm -f try try.*
9375 else
9376     d_old_pthread_create_joinable="$undef"
9377     old_pthread_create_joinable=""
9378 fi
9379
9380 : see if pause exists
9381 set pause d_pause
9382 eval $inlibc
9383
9384 : see if pipe exists
9385 set pipe d_pipe
9386 eval $inlibc
9387
9388 : see if poll exists
9389 set poll d_poll
9390 eval $inlibc
9391
9392
9393 : see whether the various POSIXish _yields exist
9394 $cat >try.c <<EOP
9395 #include <pthread.h>
9396 #include <stdio.h>
9397 int main() {
9398 #ifdef SCHED_YIELD
9399         sched_yield();
9400 #else
9401 #ifdef PTHREAD_YIELD
9402         pthread_yield();
9403 #else
9404 #ifdef PTHREAD_YIELD_NULL
9405         pthread_yield(NULL);
9406 #endif
9407 #endif
9408 #endif
9409 }
9410 EOP
9411 : see if sched_yield exists
9412 set try -DSCHED_YIELD
9413 if eval $compile; then
9414     val="$define"
9415     sched_yield='sched_yield()'
9416 else
9417     val="$undef"
9418 fi
9419 case "$usethreads" in
9420 $define)
9421         case "$val" in
9422         $define) echo 'sched_yield() found.' >&4        ;;
9423         *)       echo 'sched_yield() NOT found.' >&4    ;;
9424         esac
9425 esac
9426 set d_sched_yield
9427 eval $setvar
9428
9429 : see if pthread_yield exists
9430 set try -DPTHREAD_YIELD
9431 if eval $compile; then
9432     val="$define"
9433     case "$sched_yield" in
9434     '') sched_yield='pthread_yield()' ;;
9435     esac
9436 else
9437     set try -DPTHREAD_YIELD_NULL
9438     if eval $compile; then
9439         val="$define"
9440         case "$sched_yield" in
9441         '') sched_yield='pthread_yield(NULL)' ;;
9442         esac
9443     else
9444         val="$undef"
9445     fi
9446 fi
9447 case "$usethreads" in
9448 $define)
9449         case "$val" in
9450         $define) echo 'pthread_yield() found.' >&4      ;;
9451         *)       echo 'pthread_yield() NOT found.' >&4  ;;
9452         esac
9453         ;;
9454 esac
9455 set d_pthread_yield
9456 eval $setvar
9457
9458 case "$sched_yield" in
9459 '') sched_yield=undef ;;
9460 esac
9461
9462 $rm -f try try.*
9463
9464 : see if this is a pwd.h system
9465 set pwd.h i_pwd
9466 eval $inhdr
9467
9468 case "$i_pwd" in
9469 $define)
9470         xxx=`./findhdr pwd.h`
9471         $cppstdin $cppflags $cppminus < $xxx >$$.h
9472
9473         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
9474                 val="$define"
9475         else
9476                 val="$undef"
9477         fi
9478         set d_pwquota
9479         eval $setvar
9480
9481         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
9482                 val="$define"
9483         else
9484                 val="$undef"
9485         fi
9486         set d_pwage
9487         eval $setvar
9488
9489         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
9490                 val="$define"
9491         else
9492                 val="$undef"
9493         fi
9494         set d_pwchange
9495         eval $setvar
9496
9497         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
9498                 val="$define"
9499         else
9500                 val="$undef"
9501         fi
9502         set d_pwclass
9503         eval $setvar
9504
9505         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
9506                 val="$define"
9507         else
9508                 val="$undef"
9509         fi
9510         set d_pwexpire
9511         eval $setvar
9512
9513         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
9514                 val="$define"
9515         else
9516                 val="$undef"
9517         fi
9518         set d_pwcomment
9519         eval $setvar
9520
9521         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
9522                 val="$define"
9523         else
9524                 val="$undef"
9525         fi
9526         set d_pwgecos
9527         eval $setvar
9528
9529         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
9530                 val="$define"
9531         else
9532                 val="$undef"
9533         fi
9534         set d_pwpasswd
9535         eval $setvar
9536
9537         $rm -f $$.h
9538         ;;
9539 *)
9540         val="$undef"; 
9541         set d_pwquota; eval $setvar
9542         set d_pwage; eval $setvar
9543         set d_pwchange; eval $setvar
9544         set d_pwclass; eval $setvar
9545         set d_pwexpire; eval $setvar
9546         set d_pwcomment; eval $setvar
9547         set d_pwgecos; eval $setvar
9548         set d_pwpasswd; eval $setvar
9549         ;;
9550 esac
9551
9552
9553 echo " "
9554 echo "Checking which 64-bit integer type we could use..." >&4
9555
9556 case "$intsize" in
9557 8) val=int
9558    set quadtype
9559    eval $setvar
9560    val='"unsigned int"'
9561    set uquadtype
9562    eval $setvar
9563    quadkind=1
9564    ;;
9565 *) case "$longsize" in
9566    8) val=long
9567       set quadtype
9568       eval $setvar
9569       val='"unsigned long"'
9570       set uquadtype
9571       eval $setvar
9572       quadkind=2
9573       ;;
9574    *) case "$uselonglong:$d_longlong:$longlongsize" in
9575       define:define:8)
9576         val='"long long"'
9577         set quadtype
9578         eval $setvar
9579         val='"unsigned long long"'
9580         set uquadtype
9581         eval $setvar
9582         quadkind=3
9583         ;;
9584       *) case "$d_int64t" in
9585          define)
9586            val=int64_t
9587            set quadtype
9588            eval $setvar
9589            val=uint64_t
9590            set uquadtype
9591            eval $setvar
9592            quadkind=4
9593            ;;
9594          esac
9595          ;;
9596       esac
9597       ;;
9598    esac
9599    ;;
9600 esac
9601
9602 case "$quadtype" in
9603 '')     case "$uselonglong:$d_longlong:$longlongsize" in
9604         undef:define:8)
9605            echo "(You would have 'long long', but you are not using it.)" >&4 ;;
9606         *) echo "Alas, no 64-bit integer types in sight." >&4 ;;
9607         esac
9608         d_quad="$undef"
9609         ;;
9610 *)      if test X"$use64bits" = Xdefine -o X"$longsize" = X8; then
9611             verb="will"
9612         else
9613             verb="could"
9614         fi
9615         echo "We $verb use '$quadtype' for 64-bit integers." >&4
9616         d_quad="$define"
9617         ;;
9618 esac
9619
9620 : see if readdir and friends exist
9621 set readdir d_readdir
9622 eval $inlibc
9623 set seekdir d_seekdir
9624 eval $inlibc
9625 set telldir d_telldir
9626 eval $inlibc
9627 set rewinddir d_rewinddir
9628 eval $inlibc
9629
9630 : see if readlink exists
9631 set readlink d_readlink
9632 eval $inlibc
9633
9634 : see if rename exists
9635 set rename d_rename
9636 eval $inlibc
9637
9638 : see if rmdir exists
9639 set rmdir d_rmdir
9640 eval $inlibc
9641
9642 : see if memory.h is available.
9643 val=''
9644 set memory.h val
9645 eval $inhdr
9646
9647 : See if it conflicts with string.h
9648 case "$val" in
9649 $define)
9650         case "$strings" in
9651         '') ;;
9652         *)
9653                 $cppstdin $cppflags $cppminus < $strings > mem.h
9654                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
9655                         echo " "
9656                         echo "We won't be including <memory.h>."
9657                         val="$undef"
9658                 fi
9659                 $rm -f mem.h
9660                 ;;
9661         esac
9662 esac
9663 set i_memory
9664 eval $setvar
9665
9666 : can bcopy handle overlapping blocks?
9667 val="$undef"
9668 case "$d_bcopy" in
9669 "$define")
9670         echo " "
9671         echo "Checking to see if your bcopy() can do overlapping copies..." >&4
9672         $cat >try.c <<EOCP
9673 #$i_memory I_MEMORY
9674 #$i_stdlib I_STDLIB
9675 #$i_string I_STRING
9676 #$i_unistd I_UNISTD
9677 EOCP
9678         $cat >>try.c <<'EOCP'
9679 #include <stdio.h>
9680 #ifdef I_MEMORY
9681 #  include <memory.h>
9682 #endif
9683 #ifdef I_STDLIB
9684 #  include <stdlib.h>
9685 #endif
9686 #ifdef I_STRING
9687 #  include <string.h>
9688 #else
9689 #  include <strings.h>
9690 #endif
9691 #ifdef I_UNISTD
9692 #  include <unistd.h>  /* Needed for NetBSD */
9693 #endif
9694 int main()
9695 {
9696 char buf[128], abc[128];
9697 char *b;
9698 int len;
9699 int off;
9700 int align;
9701
9702 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
9703
9704 for (align = 7; align >= 0; align--) {
9705         for (len = 36; len; len--) {
9706                 b = buf+align;
9707                 bcopy(abc, b, len);
9708                 for (off = 1; off <= len; off++) {
9709                         bcopy(b, b+off, len);
9710                         bcopy(b+off, b, len);
9711                         if (bcmp(b, abc, len))
9712                                 exit(1);
9713                 }
9714         }
9715 }
9716 exit(0);
9717 }
9718 EOCP
9719         set try
9720         if eval $compile_ok; then
9721                 if ./try 2>/dev/null; then
9722                         echo "Yes, it can."
9723                         val="$define"
9724                 else
9725                         echo "It can't, sorry."
9726                         case "$d_memmove" in
9727                         "$define") echo "But that's Ok since you have memmove()." ;;
9728                         esac
9729                 fi
9730         else
9731                 echo "(I can't compile the test program, so we'll assume not...)"
9732                 case "$d_memmove" in
9733                 "$define") echo "But that's Ok since you have memmove()." ;;
9734                 esac
9735         fi
9736         ;;
9737 esac
9738 $rm -f try.* try core
9739 set d_safebcpy
9740 eval $setvar
9741
9742 : can memcpy handle overlapping blocks?
9743 val="$undef"
9744 case "$d_memcpy" in
9745 "$define")
9746         echo " "
9747         echo "Checking to see if your memcpy() can do overlapping copies..." >&4
9748         $cat >try.c <<EOCP
9749 #$i_memory I_MEMORY
9750 #$i_stdlib I_STDLIB
9751 #$i_string I_STRING
9752 #$i_unistd I_UNISTD
9753 EOCP
9754         $cat >>try.c <<'EOCP'
9755 #include <stdio.h>
9756 #ifdef I_MEMORY
9757 #  include <memory.h>
9758 #endif
9759 #ifdef I_STDLIB
9760 #  include <stdlib.h>
9761 #endif
9762 #ifdef I_STRING
9763 #  include <string.h>
9764 #else
9765 #  include <strings.h>
9766 #endif
9767 #ifdef I_UNISTD
9768 #  include <unistd.h>  /* Needed for NetBSD */
9769 #endif
9770 int main()
9771 {
9772 char buf[128], abc[128];
9773 char *b;
9774 int len;
9775 int off;
9776 int align;
9777
9778 /* Copy "abcde..." string to char abc[] so that gcc doesn't
9779    try to store the string in read-only memory. */
9780 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
9781
9782 for (align = 7; align >= 0; align--) {
9783         for (len = 36; len; len--) {
9784                 b = buf+align;
9785                 memcpy(b, abc, len);
9786                 for (off = 1; off <= len; off++) {
9787                         memcpy(b+off, b, len);
9788                         memcpy(b, b+off, len);
9789                         if (memcmp(b, abc, len))
9790                                 exit(1);
9791                 }
9792         }
9793 }
9794 exit(0);
9795 }
9796 EOCP
9797         set try
9798         if eval $compile_ok; then
9799                 if ./try 2>/dev/null; then
9800                         echo "Yes, it can."
9801                         val="$define"
9802                 else
9803                         echo "It can't, sorry."
9804                         case "$d_memmove" in
9805                         "$define") echo "But that's Ok since you have memmove()." ;;
9806                         esac
9807                 fi
9808         else
9809                 echo "(I can't compile the test program, so we'll assume not...)"
9810                 case "$d_memmove" in
9811                 "$define") echo "But that's Ok since you have memmove()." ;;
9812                 esac
9813         fi
9814         ;;
9815 esac
9816 $rm -f try.* try core
9817 set d_safemcpy
9818 eval $setvar
9819
9820 : can memcmp be trusted to compare relative magnitude?
9821 val="$undef"
9822 case "$d_memcmp" in
9823 "$define")
9824         echo " "
9825         echo "Checking if your memcmp() can compare relative magnitude..." >&4
9826         $cat >try.c <<EOCP
9827 #$i_memory I_MEMORY
9828 #$i_stdlib I_STDLIB
9829 #$i_string I_STRING
9830 #$i_unistd I_UNISTD
9831 EOCP
9832         $cat >>try.c <<'EOCP'
9833 #include <stdio.h>
9834 #ifdef I_MEMORY
9835 #  include <memory.h>
9836 #endif
9837 #ifdef I_STDLIB
9838 #  include <stdlib.h>
9839 #endif
9840 #ifdef I_STRING
9841 #  include <string.h>
9842 #else
9843 #  include <strings.h>
9844 #endif
9845 #ifdef I_UNISTD
9846 #  include <unistd.h>  /* Needed for NetBSD */
9847 #endif
9848 int main()
9849 {
9850 char a = -1;
9851 char b = 0;
9852 if ((a < b) && memcmp(&a, &b, 1) < 0)
9853         exit(1);
9854 exit(0);
9855 }
9856 EOCP
9857         set try
9858         if eval $compile_ok; then
9859                 if ./try 2>/dev/null; then
9860                         echo "Yes, it can."
9861                         val="$define"
9862                 else
9863                         echo "No, it can't (it uses signed chars)."
9864                 fi
9865         else
9866                 echo "(I can't compile the test program, so we'll assume not...)"
9867         fi
9868         ;;
9869 esac
9870 $rm -f try.* try core
9871 set d_sanemcmp
9872 eval $setvar
9873
9874 : see if select exists
9875 set select d_select
9876 eval $inlibc
9877
9878 : see if semctl exists
9879 set semctl d_semctl
9880 eval $inlibc
9881
9882 : see if semget exists
9883 set semget d_semget
9884 eval $inlibc
9885
9886 : see if semop exists
9887 set semop d_semop
9888 eval $inlibc
9889
9890 : see how much of the 'sem*(2)' library is present.
9891 h_sem=true
9892 echo " "
9893 case "$d_semctl$d_semget$d_semop" in
9894 *"$undef"*) h_sem=false;;
9895 esac
9896 case "$osname" in
9897 freebsd)
9898     case "`ipcs 2>&1`" in
9899     "SVID messages"*"not configured"*)
9900         echo "Your $osname does not have the sem*(2) configured." >&4
9901         h_sem=false
9902         val="$undef"
9903         set semctl d_semctl
9904         eval $setvar
9905         set semget d_semget
9906         eval $setvar
9907         set semop d_semop
9908         eval $setvar
9909         ;;
9910     esac
9911     ;;
9912 esac
9913 : we could also check for sys/ipc.h ...
9914 if $h_sem && $test `./findhdr sys/sem.h`; then
9915         echo "You have the full sem*(2) library." >&4
9916         val="$define"
9917 else
9918         echo "You don't have the full sem*(2) library." >&4
9919         val="$undef"
9920 fi
9921 set d_sem
9922 eval $setvar
9923
9924 : see whether sys/sem.h defines union semun
9925 echo " "
9926 $cat > try.c <<'END'
9927 #include <sys/types.h>
9928 #include <sys/ipc.h>
9929 #include <sys/sem.h>
9930 int main () { union semun semun; semun.buf = 0; }
9931 END
9932 set try
9933 if eval $compile; then
9934     echo "You have union semun in <sys/sem.h>." >&4
9935     val="$define"
9936 else
9937     echo "You do not have union semun in <sys/sem.h>." >&4
9938     val="$undef"
9939 fi
9940 $rm -f try try.c try.h
9941 set d_union_semun
9942 eval $setvar
9943
9944 : see how to do semctl IPC_STAT
9945 case "$d_sem" in
9946 $define)
9947     : see whether semctl IPC_STAT can use union semun
9948     echo " "
9949     $cat > try.h <<END
9950 #ifndef S_IRUSR
9951 #   ifdef S_IREAD
9952 #       define S_IRUSR S_IREAD
9953 #       define S_IWUSR S_IWRITE
9954 #       define S_IXUSR S_IEXEC
9955 #   else
9956 #       define S_IRUSR 0400
9957 #       define S_IWUSR 0200
9958 #       define S_IXUSR 0100
9959 #   endif
9960 #   define S_IRGRP (S_IRUSR>>3)
9961 #   define S_IWGRP (S_IWUSR>>3)
9962 #   define S_IXGRP (S_IXUSR>>3)
9963 #   define S_IROTH (S_IRUSR>>6)
9964 #   define S_IWOTH (S_IWUSR>>6)
9965 #   define S_IXOTH (S_IXUSR>>6)
9966 #endif
9967 #ifndef S_IRWXU
9968 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
9969 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
9970 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
9971 #endif
9972 END
9973
9974     $cat > try.c <<END
9975 #include <sys/types.h>
9976 #include <sys/ipc.h>
9977 #include <sys/sem.h>
9978 #include <sys/stat.h>
9979 #include <stdio.h>
9980 #include <errno.h>
9981 #include "try.h"
9982 #ifndef errno
9983 extern int errno;
9984 #endif
9985 #$d_union_semun HAS_UNION_SEMUN
9986 int main() {
9987     union semun
9988 #ifndef HAS_UNION_SEMUN
9989     {
9990         int val;
9991         struct semid_ds *buf;
9992         unsigned short *array;
9993     }
9994 #endif
9995     arg;
9996     int sem, st;
9997
9998 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
9999     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
10000     if (sem > -1) {
10001         struct semid_ds argbuf;
10002         arg.buf = &argbuf;
10003 #       ifdef IPC_STAT
10004         st = semctl(sem, 0, IPC_STAT, arg);
10005         if (st == 0)
10006             printf("semun\n");
10007         else
10008 #       endif /* IPC_STAT */
10009             printf("semctl IPC_STAT failed: errno = %d\n", errno);
10010 #       ifdef IPC_RMID
10011         if (semctl(sem, 0, IPC_RMID, arg) != 0)
10012 #       endif /* IPC_RMID */
10013             printf("semctl IPC_RMID failed: errno = %d\n", errno);
10014     } else
10015 #endif /* IPC_PRIVATE && ... */
10016         printf("semget failed: errno = %d\n", errno);
10017   return 0;
10018 }
10019 END
10020     val="$undef"
10021     set try
10022     if eval $compile; then
10023         xxx=`./try`
10024         case "$xxx" in
10025         semun) val="$define" ;;
10026         esac
10027     fi
10028     $rm -f try try.c
10029     set d_semctl_semun
10030     eval $setvar
10031     case "$d_semctl_semun" in
10032     $define)
10033         echo "You can use union semun for semctl IPC_STAT." >&4
10034         also='also'
10035         ;;
10036     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
10037         also=''
10038         ;;
10039     esac
10040
10041     : see whether semctl IPC_STAT can use struct semid_ds pointer
10042     $cat > try.c <<'END'
10043 #include <sys/types.h>
10044 #include <sys/ipc.h>
10045 #include <sys/sem.h>
10046 #include <sys/stat.h>
10047 #include "try.h"
10048 #include <stdio.h>
10049 #include <errno.h>
10050 #ifndef errno
10051 extern int errno;
10052 #endif
10053 int main() {
10054     struct semid_ds arg;
10055     int sem, st;
10056
10057 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
10058     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
10059     if (sem > -1) {
10060 #       ifdef IPC_STAT
10061         st = semctl(sem, 0, IPC_STAT, &arg);
10062         if (st == 0)
10063             printf("semid_ds\n");
10064         else
10065 #       endif /* IPC_STAT */
10066             printf("semctl IPC_STAT failed: errno = %d\n", errno);
10067 #       ifdef IPC_RMID
10068         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
10069 #       endif /* IPC_RMID */
10070             printf("semctl IPC_RMID failed: errno = %d\n", errno);
10071     } else
10072 #endif /* IPC_PRIVATE && ... */
10073         printf("semget failed: errno = %d\n", errno);
10074
10075     return 0;
10076 }
10077 END
10078     val="$undef"
10079     set try
10080     if eval $compile; then
10081         xxx=`./try`
10082         case "$xxx" in
10083         semid_ds) val="$define" ;;
10084         esac
10085     fi
10086     $rm -f try try.c
10087     set d_semctl_semid_ds
10088     eval $setvar
10089     case "$d_semctl_semid_ds" in
10090     $define)
10091         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
10092         ;;
10093     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
10094         ;;
10095     esac
10096     $rm -f try.h
10097     ;;
10098 *)  val="$undef"
10099
10100     # We do not have the full sem*(2) library, so assume we can not
10101     # use either.
10102
10103     set d_semctl_semun
10104     eval $setvar
10105
10106     set d_semctl_semid_ds
10107     eval $setvar
10108     ;;
10109 esac
10110
10111 : see if setegid exists
10112 set setegid d_setegid
10113 eval $inlibc
10114
10115 : see if seteuid exists
10116 set seteuid d_seteuid
10117 eval $inlibc
10118
10119 : see if setgrent exists
10120 set setgrent d_setgrent
10121 eval $inlibc
10122
10123 : see if sethostent exists
10124 set sethostent d_sethent
10125 eval $inlibc
10126
10127 : see if setlinebuf exists
10128 set setlinebuf d_setlinebuf
10129 eval $inlibc
10130
10131 : see if setlocale exists
10132 set setlocale d_setlocale
10133 eval $inlibc
10134
10135 : see if setnetent exists
10136 set setnetent d_setnent
10137 eval $inlibc
10138
10139 : see if setprotoent exists
10140 set setprotoent d_setpent
10141 eval $inlibc
10142
10143 : see if setpgid exists
10144 set setpgid d_setpgid
10145 eval $inlibc
10146
10147 : see if setpgrp2 exists
10148 set setpgrp2 d_setpgrp2
10149 eval $inlibc
10150
10151 : see if setpriority exists
10152 set setpriority d_setprior
10153 eval $inlibc
10154
10155 : see if setpwent exists
10156 set setpwent d_setpwent
10157 eval $inlibc
10158
10159 : see if setregid exists
10160 set setregid d_setregid
10161 eval $inlibc
10162 set setresgid d_setresgid
10163 eval $inlibc
10164
10165 : see if setreuid exists
10166 set setreuid d_setreuid
10167 eval $inlibc
10168 set setresuid d_setresuid
10169 eval $inlibc
10170
10171 : see if setrgid exists
10172 set setrgid d_setrgid
10173 eval $inlibc
10174
10175 : see if setruid exists
10176 set setruid d_setruid
10177 eval $inlibc
10178
10179 : see if setservent exists
10180 set setservent d_setsent
10181 eval $inlibc
10182
10183 : see if setsid exists
10184 set setsid d_setsid
10185 eval $inlibc
10186
10187 : see if setspent exists
10188 set setspent d_setspent
10189 eval $inlibc
10190
10191 : see if setvbuf exists
10192 set setvbuf d_setvbuf
10193 eval $inlibc
10194
10195 : see if sfio.h is available
10196 set sfio.h i_sfio
10197 eval $inhdr
10198
10199
10200 : see if sfio library is available
10201 case "$i_sfio" in
10202 $define)
10203         val=''
10204         set sfreserve val
10205         eval $inlibc
10206         ;;
10207 *)
10208         val="$undef"
10209         ;;
10210 esac
10211 : Ok, but do we want to use it.
10212 case "$val" in
10213 $define)
10214         case "$usesfio" in
10215         true|$define|[yY]*) dflt='y';;
10216         *) dflt='n';;
10217         esac
10218         echo "$package can use the sfio library, but it is experimental."
10219         rp="You seem to have sfio available, do you want to try using it?"
10220         . ./myread
10221         case "$ans" in
10222         y|Y) ;;
10223         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
10224                 val="$undef"
10225                 : Remove sfio from list of libraries to use
10226                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
10227                 shift
10228                 libs="$*"
10229                 echo "libs = $libs" >&4
10230                 ;;
10231         esac
10232         ;;
10233 *)      case "$usesfio" in
10234         true|$define|[yY]*)
10235                 echo "Sorry, cannot find sfio on this machine" >&4
10236                 echo "Ignoring your setting of usesfio=$usesfio" >&4
10237                 ;;
10238         esac
10239         ;;
10240 esac
10241 set d_sfio
10242 eval $setvar
10243 case "$d_sfio" in
10244 $define) usesfio='true';;
10245 *) usesfio='false';;
10246 esac
10247
10248 : see if shmctl exists
10249 set shmctl d_shmctl
10250 eval $inlibc
10251
10252 : see if shmget exists
10253 set shmget d_shmget
10254 eval $inlibc
10255
10256 : see if shmat exists
10257 set shmat d_shmat
10258 eval $inlibc
10259 : see what shmat returns
10260 case "$d_shmat" in
10261 "$define")
10262         $cat >shmat.c <<'END'
10263 #include <sys/shm.h>
10264 void *shmat();
10265 END
10266         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
10267                 shmattype='void *'
10268         else
10269                 shmattype='char *'
10270         fi
10271         echo "and it returns ($shmattype)." >&4
10272         : see if a prototype for shmat is available
10273         xxx=`./findhdr sys/shm.h`
10274         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
10275         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
10276                 val="$define"
10277         else
10278                 val="$undef"
10279         fi
10280         $rm -f shmat.[co]
10281         ;;
10282 *)
10283         val="$undef"
10284         ;;
10285 esac
10286 set d_shmatprototype
10287 eval $setvar
10288
10289 : see if shmdt exists
10290 set shmdt d_shmdt
10291 eval $inlibc
10292
10293 : see how much of the 'shm*(2)' library is present.
10294 h_shm=true
10295 echo " "
10296 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
10297 *"$undef"*) h_shm=false;;
10298 esac
10299 case "$osname" in
10300 freebsd)
10301     case "`ipcs 2>&1`" in
10302     "SVID shared memory"*"not configured"*)
10303         echo "Your $osname does not have the shm*(2) configured." >&4
10304         h_shm=false
10305         val="$undef"
10306         set shmctl d_shmctl
10307         evat $setvar
10308         set shmget d_shmget
10309         evat $setvar
10310         set shmat d_shmat
10311         evat $setvar
10312         set shmdt d_shmdt
10313         evat $setvar
10314         ;;
10315     esac
10316     ;;
10317 esac
10318 : we could also check for sys/ipc.h ...
10319 if $h_shm && $test `./findhdr sys/shm.h`; then
10320         echo "You have the full shm*(2) library." >&4
10321         val="$define"
10322 else
10323         echo "You don't have the full shm*(2) library." >&4
10324         val="$undef"
10325 fi
10326 set d_shm
10327 eval $setvar
10328
10329 echo " "
10330 : see if we have sigaction
10331 if set sigaction val -f d_sigaction; eval $csym; $val; then
10332         echo 'sigaction() found.' >&4
10333         $cat > try.c <<'EOP'
10334 #include <stdio.h>
10335 #include <sys/types.h>
10336 #include <signal.h>
10337 int main()
10338 {
10339     struct sigaction act, oact;
10340     act.sa_flags = 0;
10341     oact.sa_handler = 0;
10342     /* so that act and oact are used */
10343     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
10344 }
10345 EOP
10346         set try
10347         if eval $compile_ok; then
10348                 val="$define"
10349         else
10350                 echo "But you don't seem to have a useable struct sigaction." >&4
10351                 val="$undef"
10352         fi
10353 else
10354         echo 'sigaction NOT found.' >&4
10355         val="$undef"
10356 fi
10357 set d_sigaction; eval $setvar
10358 $rm -f try try$_o try.c
10359
10360 : see if sigsetjmp exists
10361 echo " "
10362 case "$d_sigsetjmp" in
10363 '')
10364         $cat >try.c <<'EOP'
10365 #include <setjmp.h>
10366 sigjmp_buf env;
10367 int set = 1;
10368 int main()
10369 {
10370         if (sigsetjmp(env,1))
10371                 exit(set);
10372         set = 0;
10373         siglongjmp(env, 1);
10374         exit(1);
10375 }
10376 EOP
10377         set try
10378         if eval $compile; then
10379                 if ./try >/dev/null 2>&1; then
10380                         echo "POSIX sigsetjmp found." >&4
10381                         val="$define"
10382                 else
10383                         $cat >&4 <<EOM
10384 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
10385 I'll ignore them.
10386 EOM
10387                         val="$undef"
10388                 fi
10389         else
10390                 echo "sigsetjmp not found." >&4
10391                 val="$undef"
10392         fi
10393         ;;
10394 *) val="$d_sigsetjmp"
10395         case "$d_sigsetjmp" in
10396         $define) echo "POSIX sigsetjmp found." >&4;;
10397         $undef) echo "sigsetjmp not found." >&4;;
10398         esac
10399         ;;
10400 esac
10401 set d_sigsetjmp
10402 eval $setvar
10403 $rm -f try.c try
10404
10405 : see if sqrtl exists
10406 set sqrtl d_sqrtl
10407 eval $inlibc
10408
10409 : see if sys/stat.h is available
10410 set sys/stat.h i_sysstat
10411 eval $inhdr
10412
10413
10414 : see if stat knows about block sizes
10415 echo " "
10416 echo "Checking to see if your struct stat has st_blocks field..." >&4
10417 set d_statblks stat st_blocks $i_sysstat sys/stat.h
10418 eval $hasfield
10419
10420
10421 : see if this is a sys/vfs.h system
10422 set sys/vfs.h i_sysvfs
10423 eval $inhdr
10424
10425
10426 : see if this is a sys/statfs.h system
10427 set sys/statfs.h i_sysstatfs
10428 eval $inhdr
10429
10430
10431 echo " "
10432 echo "Checking to see if your system supports struct statfs..." >&4
10433 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
10434 eval $hasstruct
10435 case "$d_statfs_s" in
10436 "$define")      echo "Yes, it does."   ;;
10437 *)              echo "No, it doesn't." ;;
10438 esac
10439
10440
10441
10442 : see if struct statfs knows about f_flags
10443 case "$d_statfs_s" in
10444 define) 
10445         echo " "
10446         echo "Checking to see if your struct statfs has f_flags field..." >&4
10447         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
10448         eval $hasfield
10449         ;;
10450 *)      val="$undef"
10451         set d_statfs_f_flags
10452         eval $setvar
10453         ;;
10454 esac
10455 case "$d_statfs_f_flags" in
10456 "$define")      echo "Yes, it does."   ;;
10457 *)              echo "No, it doesn't." ;;
10458 esac
10459
10460 : see if _ptr and _cnt from stdio act std
10461 echo " "
10462 if $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
10463         echo "(Looks like you have stdio.h from Linux.)"
10464         case "$stdio_ptr" in
10465         '') stdio_ptr='((fp)->_IO_read_ptr)'
10466                 ptr_lval=$define
10467                 ;;
10468         *)      ptr_lval=$d_stdio_ptr_lval;;
10469         esac
10470         case "$stdio_cnt" in
10471         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
10472                 cnt_lval=$undef
10473                 ;;
10474         *)      cnt_lval=$d_stdio_cnt_lval;;
10475         esac
10476         case "$stdio_base" in
10477         '') stdio_base='((fp)->_IO_read_base)';;
10478         esac
10479         case "$stdio_bufsiz" in
10480         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
10481         esac
10482 else
10483         case "$stdio_ptr" in
10484         '') stdio_ptr='((fp)->_ptr)'
10485                 ptr_lval=$define
10486                 ;;
10487         *)      ptr_lval=$d_stdio_ptr_lval;;
10488         esac
10489         case "$stdio_cnt" in
10490         '') stdio_cnt='((fp)->_cnt)'
10491                 cnt_lval=$define
10492                 ;;
10493         *)      cnt_lval=$d_stdio_cnt_lval;;
10494         esac
10495         case "$stdio_base" in
10496         '') stdio_base='((fp)->_base)';;
10497         esac
10498         case "$stdio_bufsiz" in
10499         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
10500         esac
10501 fi
10502 : test whether _ptr and _cnt really work
10503 echo "Checking how std your stdio is..." >&4
10504 $cat >try.c <<EOP
10505 #include <stdio.h>
10506 #define FILE_ptr(fp)    $stdio_ptr
10507 #define FILE_cnt(fp)    $stdio_cnt
10508 int main() {
10509         FILE *fp = fopen("try.c", "r");
10510         char c = getc(fp);
10511         if (
10512                 18 <= FILE_cnt(fp) &&
10513                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
10514         )
10515                 exit(0);
10516         exit(1);
10517 }
10518 EOP
10519 val="$undef"
10520 set try
10521 if eval $compile; then
10522         if ./try; then
10523                 echo "Your stdio acts pretty std."
10524                 val="$define"
10525         else
10526                 echo "Your stdio isn't very std."
10527         fi
10528 else
10529         echo "Your stdio doesn't appear very std."
10530 fi
10531 $rm -f try.c try
10532 set d_stdstdio
10533 eval $setvar
10534
10535 : Can _ptr be used as an lvalue?
10536 case "$d_stdstdio$ptr_lval" in
10537 $define$define) val=$define ;;
10538 *) val=$undef ;;
10539 esac
10540 set d_stdio_ptr_lval
10541 eval $setvar
10542
10543 : Can _cnt be used as an lvalue?
10544 case "$d_stdstdio$cnt_lval" in
10545 $define$define) val=$define ;;
10546 *) val=$undef ;;
10547 esac
10548 set d_stdio_cnt_lval
10549 eval $setvar
10550
10551 : see if _base is also standard
10552 val="$undef"
10553 case "$d_stdstdio" in
10554 $define)
10555         $cat >try.c <<EOP
10556 #include <stdio.h>
10557 #define FILE_base(fp)   $stdio_base
10558 #define FILE_bufsiz(fp) $stdio_bufsiz
10559 int main() {
10560         FILE *fp = fopen("try.c", "r");
10561         char c = getc(fp);
10562         if (
10563                 19 <= FILE_bufsiz(fp) &&
10564                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
10565         )
10566                 exit(0);
10567         exit(1);
10568 }
10569 EOP
10570         set try
10571         if eval $compile; then
10572                 if ./try; then
10573                         echo "And its _base field acts std."
10574                         val="$define"
10575                 else
10576                         echo "But its _base field isn't std."
10577                 fi
10578         else
10579                 echo "However, it seems to be lacking the _base field."
10580         fi
10581         $rm -f try.c try
10582         ;;
10583 esac
10584 set d_stdiobase
10585 eval $setvar
10586
10587 $cat >&4 <<EOM
10588 Checking how to access stdio streams by file descriptor number...
10589 EOM
10590 case "$stdio_stream_array" in
10591 '')     $cat >try.c <<EOCP
10592 #include <stdio.h>
10593 int main() {
10594   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
10595     printf("yes\n");
10596 }
10597 EOCP
10598         for s in _iob __iob __sF
10599         do
10600                 set try -DSTDIO_STREAM_ARRAY=$s
10601                 if eval $compile; then
10602                         case "`./try$exe_ext`" in
10603                         yes)    stdio_stream_array=$s; break ;;
10604                         esac
10605                 fi
10606         done
10607         $rm -f try.* try$exe_ext
10608 esac
10609 case "$stdio_stream_array" in
10610 '')     $cat >&4 <<EOM
10611 I can't figure out how to access stdio streams by file descriptor number.
10612 EOM
10613         d_stdio_stream_array="$undef"
10614         ;;
10615 *)      $cat >&4 <<EOM
10616 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
10617 EOM
10618         d_stdio_stream_array="$define"
10619         ;;
10620 esac
10621
10622 : see if strcoll exists
10623 set strcoll d_strcoll
10624 eval $inlibc
10625
10626 : check for structure copying
10627 echo " "
10628 echo "Checking to see if your C compiler can copy structs..." >&4
10629 $cat >try.c <<'EOCP'
10630 int main()
10631 {
10632         struct blurfl {
10633                 int dyick;
10634         } foo, bar;
10635
10636         foo = bar;
10637 }
10638 EOCP
10639 if $cc -c try.c >/dev/null 2>&1 ; then
10640         val="$define"
10641         echo "Yup, it can."
10642 else
10643         val="$undef"
10644         echo "Nope, it can't."
10645 fi
10646 set d_strctcpy
10647 eval $setvar
10648 $rm -f try.*
10649
10650 : see if strerror and/or sys_errlist[] exist
10651 echo " "
10652 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
10653     if set strerror val -f d_strerror; eval $csym; $val; then
10654                 echo 'strerror() found.' >&4
10655                 d_strerror="$define"
10656                 d_strerrm='strerror(e)'
10657                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
10658                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
10659                         d_syserrlst="$define"
10660                 else
10661                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
10662                         d_syserrlst="$undef"
10663                 fi
10664     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
10665                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
10666                 echo 'strerror() found in string header.' >&4
10667                 d_strerror="$define"
10668                 d_strerrm='strerror(e)'
10669                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
10670                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
10671                                 d_syserrlst="$define"
10672                 else
10673                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
10674                         d_syserrlst="$undef"
10675                 fi
10676     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
10677                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
10678                 d_strerror="$undef"
10679                 d_syserrlst="$define"
10680                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
10681     else
10682                 echo 'strerror() and sys_errlist[] NOT found.' >&4
10683                 d_strerror="$undef"
10684                 d_syserrlst="$undef"
10685                 d_strerrm='"unknown"'
10686     fi
10687 fi
10688
10689 : see if strtod exists
10690 set strtod d_strtod
10691 eval $inlibc
10692
10693 : see if strtol exists
10694 set strtol d_strtol
10695 eval $inlibc
10696
10697 : see if strtoul exists
10698 set strtoul d_strtoul
10699 eval $inlibc
10700
10701 : see if strtoull exists
10702 set strtoull d_strtoull
10703 eval $inlibc
10704
10705 : see if strxfrm exists
10706 set strxfrm d_strxfrm
10707 eval $inlibc
10708
10709 : see if symlink exists
10710 set symlink d_symlink
10711 eval $inlibc
10712
10713 : see if syscall exists
10714 set syscall d_syscall
10715 eval $inlibc
10716
10717 : see if sysconf exists
10718 set sysconf d_sysconf
10719 eval $inlibc
10720
10721 : see if system exists
10722 set system d_system
10723 eval $inlibc
10724
10725 : see if tcgetpgrp exists
10726 set tcgetpgrp d_tcgetpgrp
10727 eval $inlibc
10728
10729 : see if tcsetpgrp exists
10730 set tcsetpgrp d_tcsetpgrp
10731 eval $inlibc
10732
10733 : see if prototype for telldir is available
10734 echo " "
10735 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
10736 eval $hasproto
10737
10738 : see if this is a sys/times.h system
10739 set sys/times.h i_systimes
10740 eval $inhdr
10741
10742 : see if times exists
10743 echo " "
10744 if set times val -f d_times; eval $csym; $val; then
10745         echo 'times() found.' >&4
10746         d_times="$define"
10747         inc=''
10748         case "$i_systimes" in
10749         "$define") inc='sys/times.h';;
10750         esac
10751         rp="What is the type returned by times() on this system?"
10752         set clock_t clocktype long stdio.h sys/types.h $inc
10753         eval $typedef_ask
10754 else
10755         echo 'times() NOT found, hope that will do.' >&4
10756         d_times="$undef"
10757         clocktype='int'
10758 fi
10759
10760 : see if truncate exists
10761 set truncate d_truncate
10762 eval $inlibc
10763
10764 : see if tzname[] exists
10765 echo " "
10766 if set tzname val -a d_tzname; eval $csym; $val; then
10767         val="$define"
10768         echo 'tzname[] found.' >&4
10769 else
10770         val="$undef"
10771         echo 'tzname[] NOT found.' >&4
10772 fi
10773 set d_tzname
10774 eval $setvar
10775
10776 : see if umask exists
10777 set umask d_umask
10778 eval $inlibc
10779
10780 : see if ustat exists
10781 set ustat d_ustat
10782 eval $inlibc
10783
10784 : backward compatibility for d_hvfork
10785 if test X$d_hvfork != X; then
10786         d_vfork="$d_hvfork"
10787         d_hvfork=''
10788 fi
10789 : see if there is a vfork
10790 val=''
10791 set vfork val
10792 eval $inlibc
10793
10794 : Ok, but do we want to use it. vfork is reportedly unreliable in 
10795 : perl on Solaris 2.x, and probably elsewhere.
10796 case "$val" in
10797 $define)
10798         echo " "
10799         case "$usevfork" in
10800         false) dflt='n';;
10801         *) dflt='y';;
10802         esac
10803         cat <<'EOM'
10804  
10805 Perl can only use a vfork() that doesn't suffer from strict
10806 restrictions on calling functions or modifying global data in
10807 the child.  For example, glibc-2.1 contains such a vfork()
10808 that is unsuitable.  If your system provides a proper fork()
10809 call, chances are that you do NOT want perl to use vfork().
10810
10811 EOM
10812         rp="Do you still want to use vfork()?"
10813         . ./myread
10814         case "$ans" in
10815         y|Y) ;;
10816         *)
10817                 echo "Ok, we won't use vfork()."
10818                 val="$undef"
10819                 ;;
10820         esac
10821         ;;
10822 esac
10823 set d_vfork
10824 eval $setvar
10825 case "$d_vfork" in
10826 $define) usevfork='true';;
10827 *) usevfork='false';;
10828 esac
10829
10830 : see if this is an sysdir system
10831 set sys/dir.h i_sysdir
10832 eval $inhdr
10833
10834 : see if this is an sysndir system
10835 set sys/ndir.h i_sysndir
10836 eval $inhdr
10837
10838 : see if closedir exists
10839 set closedir d_closedir
10840 eval $inlibc
10841
10842 case "$d_closedir" in
10843 "$define")
10844         echo " "
10845         echo "Checking whether closedir() returns a status..." >&4
10846         cat > closedir.c <<EOM
10847 #$i_dirent I_DIRENT             /**/
10848 #$i_sysdir I_SYS_DIR            /**/
10849 #$i_sysndir I_SYS_NDIR          /**/
10850 #$i_systypes I_SYS_TYPES        /**/
10851
10852 #if defined(I_SYS_TYPES)
10853 #include <sys/types.h>
10854 #endif
10855 #if defined(I_DIRENT)
10856 #include <dirent.h>
10857 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
10858 #include <sys/dir.h>
10859 #endif
10860 #else
10861 #ifdef I_SYS_NDIR
10862 #include <sys/ndir.h>
10863 #else
10864 #ifdef I_SYS_DIR
10865 #ifdef hp9000s500
10866 #include <ndir.h>       /* may be wrong in the future */
10867 #else
10868 #include <sys/dir.h>
10869 #endif
10870 #endif
10871 #endif
10872 #endif 
10873 int main() { return closedir(opendir(".")); }
10874 EOM
10875         set closedir
10876         if eval $compile_ok; then
10877                 if ./closedir > /dev/null 2>&1 ; then
10878                         echo "Yes, it does."
10879                         val="$undef"
10880                 else
10881                         echo "No, it doesn't."
10882                         val="$define"
10883                 fi
10884         else
10885                 echo "(I can't seem to compile the test program--assuming it doesn't)"
10886                 val="$define"
10887         fi
10888         ;;
10889 *)
10890         val="$undef";
10891         ;;
10892 esac
10893 set d_void_closedir
10894 eval $setvar
10895 $rm -f closedir*
10896 : check for volatile keyword
10897 echo " "
10898 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
10899 $cat >try.c <<'EOCP'
10900 int main()
10901 {
10902         typedef struct _goo_struct goo_struct;
10903         goo_struct * volatile goo = ((goo_struct *)0);
10904         struct _goo_struct {
10905                 long long_int;
10906                 int reg_int;
10907                 char char_var;
10908         };
10909         typedef unsigned short foo_t;
10910         char *volatile foo;
10911         volatile int bar;
10912         volatile foo_t blech;
10913         foo = foo;
10914 }
10915 EOCP
10916 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
10917         val="$define"
10918         echo "Yup, it does."
10919 else
10920         val="$undef"
10921         echo "Nope, it doesn't."
10922 fi
10923 set d_volatile
10924 eval $setvar
10925 $rm -f try.*
10926
10927 : see if there is a wait4
10928 set wait4 d_wait4
10929 eval $inlibc
10930
10931 : see if waitpid exists
10932 set waitpid d_waitpid
10933 eval $inlibc
10934
10935 : see if wcstombs exists
10936 set wcstombs d_wcstombs
10937 eval $inlibc
10938
10939 : see if wctomb exists
10940 set wctomb d_wctomb
10941 eval $inlibc
10942
10943 : preserve RCS keywords in files with variable substitution, grrr
10944 Date='$Date'
10945 Id='$Id'
10946 Log='$Log'
10947 RCSfile='$RCSfile'
10948 Revision='$Revision'
10949
10950 case "$crosscompile" in
10951 ''|[nN]*) crosscompile="$undef" ;;
10952 esac
10953
10954 case "$osname" in
10955 next|rhapsody) multiarch="$define" ;;
10956 esac
10957 case "$multiarch" in
10958 ''|[nN]*) multiarch="$undef" ;;
10959 esac
10960
10961 : check for alignment requirements
10962 echo " "
10963 case "$crosscompile$multiarch" in
10964 *$define*)
10965         $cat <<EOM
10966 You seem to be either cross-compiling or doing a multiarchitecture build,
10967 skipping the memory alignment check.
10968
10969 EOM
10970         case "$alignbytes" in
10971         '') alignbytes=8 ;;
10972         esac
10973         ;;
10974 *)
10975         case "$alignbytes" in
10976         '') echo "Checking alignment constraints..." >&4
10977                 $cat >try.c <<'EOCP'
10978 #include <stdio.h>
10979 struct foobar {
10980         char foo;
10981         double bar;
10982 } try_algn;
10983 int main()
10984 {
10985     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
10986     return(0);
10987 }
10988 EOCP
10989                 set try
10990                 if eval $compile_ok; then
10991                         dflt=`./try`
10992                 else
10993                         dflt='8'
10994                         echo "(I can't seem to compile the test program...)"
10995                 fi
10996                 ;;
10997         *) dflt="$alignbytes"
10998                 ;;
10999         esac
11000         rp="Doubles must be aligned on a how-many-byte boundary?"
11001         . ./myread
11002         alignbytes="$ans"
11003         $rm -f try.c try
11004         ;;
11005 esac
11006
11007
11008 : check for ordering of bytes in a long
11009 echo " "
11010 case "$crosscompile$multiarch" in
11011 *$define*)
11012         $cat <<EOM
11013 You seem to be either cross-compiling or doing a multiarchitecture build,
11014 skipping the byteorder check.
11015
11016 EOM
11017         byteorder='0xffff'
11018         ;;
11019 *)
11020         case "$byteorder" in
11021         '')
11022                 $cat <<'EOM'
11023 In the following, larger digits indicate more significance.  A big-endian
11024 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
11025 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
11026 machines may have weird orders like 3412.  A Cray will report 87654321,
11027 an Alpha will report 12345678. If the test program works the default is
11028 probably right.
11029 I'm now running the test program...
11030 EOM
11031                 $cat >try.c <<'EOCP'
11032 #include <stdio.h>
11033 int main()
11034 {
11035         int i;
11036         union {
11037                 unsigned long l;
11038                 char c[sizeof(long)];
11039         } u;
11040
11041         if (sizeof(long) > 4)
11042                 u.l = (0x08070605L << 32) | 0x04030201L;
11043         else
11044                 u.l = 0x04030201L;
11045         for (i = 0; i < sizeof(long); i++)
11046                 printf("%c", u.c[i]+'0');
11047         printf("\n");
11048         exit(0);
11049 }
11050 EOCP
11051                 xxx_prompt=y
11052                 set try
11053                 if eval $compile && ./try > /dev/null; then
11054                         dflt=`./try`
11055                         case "$dflt" in
11056                         [1-4][1-4][1-4][1-4]|12345678|87654321)
11057                                 echo "(The test program ran ok.)"
11058                                 echo "byteorder=$dflt"
11059                                 xxx_prompt=n
11060                         ;;
11061                         ????|????????) echo "(The test program ran ok.)" ;;
11062                         *) echo "(The test program didn't run right for some reason.)" ;;
11063                         esac
11064                 else
11065                         dflt='4321'
11066                         cat <<'EOM'
11067 (I can't seem to compile the test program.  Guessing big-endian...)
11068 EOM
11069                 fi
11070                 case "$xxx_prompt" in
11071                 y)
11072                         rp="What is the order of bytes in a long?"
11073                         . ./myread
11074                         byteorder="$ans"
11075                         ;;
11076                 *)      byteorder=$dflt
11077                         ;;
11078                 esac
11079                 ;;
11080         esac
11081         $rm -f try.c try
11082         ;;
11083 esac
11084
11085
11086 : how do we catenate cpp tokens here?
11087 echo " "
11088 echo "Checking to see how your cpp does stuff like catenate tokens..." >&4
11089 $cat >cpp_stuff.c <<'EOCP'
11090 #define RCAT(a,b)a/**/b
11091 #define ACAT(a,b)a ## b
11092 RCAT(Rei,ser)
11093 ACAT(Cir,cus)
11094 EOCP
11095 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
11096 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
11097         echo "Oh!  Smells like ANSI's been here." >&4
11098         echo "We can catify or stringify, separately or together!"
11099         cpp_stuff=42
11100 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
11101         echo "Ah, yes!  The good old days!" >&4
11102         echo "However, in the good old days we don't know how to stringify and"
11103         echo "catify at the same time."
11104         cpp_stuff=1
11105 else
11106         $cat >&4 <<EOM
11107 Hmm, I don't seem to be able to catenate tokens with your cpp.  You're going
11108 to have to edit the values of CAT[2-5] in config.h...
11109 EOM
11110         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
11111 fi
11112 $rm -f cpp_stuff.*
11113
11114 : see if this is a db.h system
11115 set db.h i_db
11116 eval $inhdr
11117
11118 case "$i_db" in
11119 $define)
11120         : Check db version.
11121         echo " "
11122         echo "Checking Berkeley DB version ..." >&4
11123         $cat >try.c <<EOCP
11124 #$d_const HASCONST
11125 #ifndef HASCONST
11126 #define const
11127 #endif
11128 #include <sys/types.h>
11129 #include <stdio.h>
11130 #include <db.h>
11131 int main()
11132 {
11133 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
11134     int Major, Minor, Patch ;
11135     unsigned long Version ;
11136     (void)db_version(&Major, &Minor, &Patch) ;
11137     printf("You have Berkeley DB Version 2 or greater\n");
11138
11139     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
11140                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
11141     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
11142                 Major, Minor, Patch) ;
11143
11144     /* check that db.h & libdb are compatible */
11145     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
11146         printf("db.h and libdb are incompatible\n") ;
11147         exit(3);        
11148     }
11149
11150     printf("db.h and libdb are compatible\n") ;
11151
11152     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
11153                 + DB_VERSION_PATCH ;
11154
11155     /* needs to be >= 2.3.4 */
11156     if (Version < 2003004) {
11157     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
11158         printf("but Perl needs Berkeley DB 2.3.4 or greater\n") ;
11159         exit(2);        
11160     }
11161
11162     exit(0);
11163 #else
11164 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
11165     printf("You have Berkeley DB Version 1\n");
11166     exit(0);    /* DB version < 2: the coast is clear. */
11167 #else
11168     exit(1);    /* <db.h> not Berkeley DB? */
11169 #endif
11170 #endif
11171 }
11172 EOCP
11173         set try
11174         if eval $compile && ./try; then
11175                 echo 'Looks OK.' >&4
11176         else
11177                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
11178                 i_db=$undef
11179                 case " $libs " in
11180                 *"-ldb "*)
11181                         : Remove db from list of libraries to use
11182                         echo "Removing unusable -ldb from library list" >&4
11183                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
11184                         shift
11185                         libs="$*"
11186                         echo "libs = $libs" >&4
11187                         ;;
11188                 esac
11189         fi
11190         $rm -f try.*
11191         ;;
11192 esac
11193
11194 case "$i_db" in
11195 define)
11196         : Check the return type needed for hash 
11197         echo " "
11198         echo "Checking return type needed for hash for Berkeley DB ..." >&4
11199         $cat >try.c <<EOCP
11200 #$d_const HASCONST
11201 #ifndef HASCONST
11202 #define const
11203 #endif
11204 #include <sys/types.h>
11205 #include <db.h>
11206
11207 #ifndef DB_VERSION_MAJOR
11208 u_int32_t hash_cb (ptr, size)
11209 const void *ptr;
11210 size_t size;
11211 {
11212 }
11213 HASHINFO info;
11214 int main()
11215 {
11216         info.hash = hash_cb;
11217 }
11218 #endif
11219 EOCP
11220         if $cc $ccflags -c try.c >try.out 2>&1 ; then
11221                 if $contains warning try.out >>/dev/null 2>&1 ; then
11222                         db_hashtype='int'
11223                 else
11224                         db_hashtype='u_int32_t'
11225                 fi
11226         else
11227                 : XXX Maybe we should just give up here.
11228                 db_hashtype=u_int32_t
11229                 $cat try.out >&4
11230                 echo "Help:  I can't seem to compile the db test program." >&4
11231                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
11232         fi
11233         $rm -f try.*
11234         echo "Your version of Berkeley DB uses $db_hashtype for hash."
11235         ;;
11236 *)      db_hashtype=u_int32_t
11237         ;;
11238 esac
11239 case "$i_db" in
11240 define)
11241         : Check the return type needed for prefix 
11242         echo " "
11243         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
11244         cat >try.c <<EOCP
11245 #$d_const HASCONST
11246 #ifndef HASCONST
11247 #define const
11248 #endif
11249 #include <sys/types.h>
11250 #include <db.h>
11251
11252 #ifndef DB_VERSION_MAJOR
11253 size_t prefix_cb (key1, key2)
11254 const DBT *key1;
11255 const DBT *key2;
11256 {
11257 }
11258 BTREEINFO info;
11259 int main()
11260 {
11261         info.prefix = prefix_cb;
11262 }
11263 #endif
11264 EOCP
11265         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
11266                 if $contains warning try.out >>/dev/null 2>&1 ; then
11267                         db_prefixtype='int'
11268                 else
11269                         db_prefixtype='size_t'
11270                 fi
11271         else
11272                 db_prefixtype='size_t'
11273                 : XXX Maybe we should just give up here.
11274                 $cat try.out >&4
11275                 echo "Help:  I can't seem to compile the db test program." >&4
11276                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
11277         fi
11278         $rm -f try.*
11279         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
11280         ;;
11281 *)      db_prefixtype='size_t'
11282         ;;
11283 esac
11284
11285 : check for void type
11286 echo " "
11287 echo "Checking to see how well your C compiler groks the void type..." >&4
11288 case "$voidflags" in
11289 '')
11290         $cat >try.c <<'EOCP'
11291 #if TRY & 1
11292 void sub() {
11293 #else
11294 sub() {
11295 #endif
11296         extern void moo();      /* function returning void */
11297         void (*goo)();          /* ptr to func returning void */
11298 #if TRY & 8
11299         void *hue;              /* generic ptr */
11300 #endif
11301 #if TRY & 2
11302         void (*foo[10])();
11303 #endif
11304
11305 #if TRY & 4
11306         if(goo == moo) {
11307                 exit(0);
11308         }
11309 #endif
11310         exit(0);
11311 }
11312 int main() { sub(); }
11313 EOCP
11314         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
11315                 voidflags=$defvoidused
11316         echo "Good.  It appears to support void to the level $package wants.">&4
11317                 if $contains warning .out >/dev/null 2>&1; then
11318                         echo "However, you might get some warnings that look like this:"
11319                         $cat .out
11320                 fi
11321         else
11322 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
11323                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
11324                         echo "It supports 1..."
11325                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
11326                                 echo "It also supports 2..."
11327                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
11328                                         voidflags=7
11329                                         echo "And it supports 4 but not 8 definitely."
11330                                 else
11331                                         echo "It doesn't support 4..."
11332                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
11333                                                 voidflags=11
11334                                                 echo "But it supports 8."
11335                                         else
11336                                                 voidflags=3
11337                                                 echo "Neither does it support 8."
11338                                         fi
11339                                 fi
11340                         else
11341                                 echo "It does not support 2..."
11342                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
11343                                         voidflags=13
11344                                         echo "But it supports 4 and 8."
11345                                 else
11346                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
11347                                                 voidflags=5
11348                                                 echo "And it supports 4 but has not heard about 8."
11349                                         else
11350                                                 echo "However it supports 8 but not 4."
11351                                         fi
11352                                 fi
11353                         fi
11354                 else
11355                         echo "There is no support at all for void."
11356                         voidflags=0
11357                 fi
11358         fi
11359 esac
11360 case "$voidflags" in
11361 "$defvoidused") ;;
11362 *)      $cat >&4 <<'EOM'
11363   Support flag bits are:
11364     1: basic void declarations.
11365     2: arrays of pointers to functions returning void.
11366     4: operations between pointers to and addresses of void functions.
11367     8: generic void pointers.
11368 EOM
11369         dflt="$voidflags";
11370         rp="Your void support flags add up to what?"
11371         . ./myread
11372         voidflags="$ans"
11373         ;;
11374 esac
11375 $rm -f try.* .out
11376
11377
11378 : How can we generate normalized random numbers ?
11379 echo " "
11380 echo "Looking for a random number function..." >&4
11381 case "$randfunc" in
11382 '')
11383         if set drand48 val -f; eval $csym; $val; then
11384                 dflt="drand48"
11385                 echo "Good, found drand48()." >&4
11386         elif set random val -f; eval $csym; $val; then
11387                 dflt="random"
11388                 echo "OK, found random()." >&4
11389         else
11390                 dflt="rand"
11391                 echo "Yick, looks like I have to use rand()." >&4
11392         fi
11393         echo " "
11394         ;;
11395 *)
11396         dflt="$randfunc"
11397         ;;
11398 esac
11399 cont=true
11400
11401 case "$ccflags" in
11402 *-Dmy_rand=*|*-Dmy_srand=*)
11403         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
11404         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
11405         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
11406         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
11407         ;;
11408 esac
11409
11410 while $test "$cont"; do
11411         rp="Use which function to generate random numbers?"
11412         . ./myread
11413         if $test "$ans" = "$dflt"; then
11414                 : null
11415         else
11416                 randbits=''
11417         fi
11418         randfunc="$ans"
11419         if set $ans val -f; eval $csym; $val; then
11420                 cont=''
11421         else
11422                 dflt=y
11423                 rp="I cannot find function $ans. Use that name anyway?"
11424                 . ./myread
11425                 dflt=rand
11426                 case "$ans" in
11427                         [yY]*) cont='';;
11428                 esac
11429         fi
11430         case "$cont" in
11431         '')
11432                 case "$randfunc" in
11433                 drand48)
11434                         drand01="drand48()"
11435                         seedfunc="srand48"
11436                         randbits=48
11437                         randseedtype=long
11438                         ;;
11439                 rand|random)
11440                         case "$randbits" in
11441                         '')
11442 echo "Checking to see how many bits your $randfunc() function produces..." >&4
11443                                 $cat >try.c <<EOCP
11444 #$i_unistd I_UNISTD
11445 #$i_stdlib I_STDLIB
11446 #include <stdio.h>
11447 #ifdef I_UNISTD
11448 #  include <unistd.h>
11449 #endif
11450 #ifdef I_STDLIB
11451 #  include <stdlib.h>
11452 #endif
11453 int main()
11454 {
11455         register int i;
11456         register unsigned long tmp;
11457         register unsigned long max = 0L;
11458
11459         for (i = 1000; i; i--) {
11460                 tmp = (unsigned long) $randfunc();
11461                 if (tmp > max) max = tmp;
11462         }
11463         for (i = 0; max; i++)
11464                 max /= 2;
11465         printf("%d\n",i);
11466 }
11467 EOCP
11468                                 set try
11469                                 if eval $compile_ok; then
11470                                         dflt=`try`
11471                                 else
11472                                         dflt='?'
11473                                         echo "(I can't seem to compile the test program...)"
11474                                 fi
11475                                 ;;
11476                         *)
11477                                 dflt="$randbits"
11478                                 ;;
11479                         esac
11480                         rp="How many bits does your $randfunc() function produce?"
11481                         . ./myread
11482                         randbits="$ans"
11483                         $rm -f try.c try
11484                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
11485                         seedfunc="s$randfunc"
11486                         randseedtype=unsigned
11487                         ;;
11488                 *)
11489                         dflt="31"
11490                         rp="How many bits does your $randfunc() function produce?"
11491                         . ./myread
11492                         randbits="$ans"
11493                         seedfunc="s$randfunc"
11494                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
11495                         if set $seedfunc val -f; eval $csym; $val; then
11496                                 echo "(Using $seedfunc() to seed random generator)"
11497                         else
11498                                 echo "(Warning: no $seedfunc() to seed random generator)"
11499                                 seedfunc=rand
11500                         fi
11501                         randseedtype=unsigned
11502                         ;;
11503                 esac
11504                 ;;
11505         esac
11506 done
11507
11508 echo " "
11509 echo "Determining whether or not we are on an EBCDIC system..." >&4
11510 $cat >tebcdic.c <<'EOM'
11511 int main()
11512 {
11513   if ('M'==0xd4) return 0;
11514   return 1;
11515 }
11516 EOM
11517
11518 val=$undef
11519 set tebcdic
11520 if eval $compile_ok; then
11521         if ./tebcdic; then
11522                 echo "You have EBCDIC." >&4
11523                 val="$define"
11524         else
11525                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin." >&4
11526         fi
11527 else
11528         echo "I'm unable to compile the test program." >&4
11529         echo "I'll assume ASCII or some ISO Latin." >&4
11530 fi
11531 $rm -f tebcdic.c tebcdic
11532 set ebcdic
11533 eval $setvar
11534
11535 echo " "
11536 $cat >&4 <<EOM
11537 Checking how to flush all pending stdio output...
11538 EOM
11539 # I only know how to find the first 32 possibly open files on SunOS.
11540 # See also hints/sunos_4_1.sh and util.c  --AD
11541 case "$osname" in
11542 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
11543 esac
11544 $cat >>try.c <<EOCP
11545 #include <stdio.h>
11546 #$i_unistd I_UNISTD
11547 #ifdef I_UNISTD
11548 # include <unistd.h>
11549 #endif
11550 #$d_sysconf HAS_SYSCONF
11551 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
11552 #ifdef HAS_STDIO_STREAM_ARRAY
11553 # define STDIO_STREAM_ARRAY $stdio_stream_array
11554 #endif
11555 int main() {
11556   FILE* p = fopen("try.out", "w");
11557 #ifdef TRY_FPUTC
11558   fputc('x', p);
11559 #else
11560 # ifdef TRY_FPRINTF
11561   fprintf(p, "x");
11562 # endif
11563 #endif
11564 #ifdef TRY_FFLUSH_NULL
11565   fflush(NULL);
11566 #endif
11567 #ifdef TRY_FFLUSH_ALL
11568   {
11569     long open_max = -1;
11570 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
11571     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
11572 # else
11573 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
11574     open_max = sysconf(_SC_OPEN_MAX);
11575 #  else
11576 #   ifdef FOPEN_MAX
11577     open_max = FOPEN_MAX;
11578 #   else
11579 #    ifdef OPEN_MAX
11580     open_max = OPEN_MAX;
11581 #    else
11582 #     ifdef _NFILE
11583     open_max = _NFILE;
11584 #     endif
11585 #    endif
11586 #   endif
11587 #  endif
11588 # endif 
11589 # ifdef HAS_STDIO_STREAM_ARRAY
11590     if (open_max > 0) {
11591       long i;
11592       for (i = 0; i < open_max; i++)
11593             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
11594                 STDIO_STREAM_ARRAY[i]._file < open_max &&
11595                 STDIO_STREAM_ARRAY[i]._flag)
11596                 fflush(&STDIO_STREAM_ARRAY[i]);
11597     }   
11598   }
11599 # endif
11600 #endif
11601   _exit(42);
11602 }
11603 EOCP
11604 : first we have to find out how _not_ to flush
11605 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
11606     output=''
11607     set try -DTRY_FPUTC
11608     if eval $compile; then
11609             $rm -f try.out
11610             ./try$exe_ext 2>/dev/null
11611             if $test ! -s try.out -a "X$?" = X42; then
11612                 output=-DTRY_FPUTC
11613             fi
11614     fi
11615     case "$output" in
11616     '')
11617             set try -DTRY_FPRINTF
11618             $rm -f try.out
11619             if eval $compile; then
11620                     $rm -f try.out
11621                     ./try$exe_ext 2>/dev/null
11622                     if $test ! -s try.out -a "X$?" = X42; then
11623                         output=-DTRY_FPRINTF
11624                     fi
11625             fi
11626         ;;
11627     esac
11628 fi
11629 : check for fflush NULL behaviour
11630 case "$fflushNULL" in
11631 '')     set try -DTRY_FFLUSH_NULL $output
11632         if eval $compile; then
11633                 $rm -f try.out
11634                 ./try$exe_ext 2>/dev/null
11635                 code="$?"
11636                 if $test -s try.out -a "X$code" = X42; then
11637                         fflushNULL="`$cat try.out`"
11638                 else
11639                         if $test "X$code" != X42; then
11640                                 $cat >&4 <<EOM
11641 (If this test failed, don't worry, we'll try another method shortly.)
11642 EOM
11643                         fi
11644                 fi
11645         fi
11646         $rm -f core try.core core.try.*
11647         case "$fflushNULL" in
11648         x)      $cat >&4 <<EOM
11649 Your fflush(NULL) works okay.
11650 EOM
11651                 fflushNULL="$define"
11652                 ;;
11653         '')     $cat >&4 <<EOM
11654 Your fflush(NULL) isn't working (contrary to ANSI C).
11655 EOM
11656                 fflushNULL="$undef"
11657                 ;;
11658         *)      $cat >&4 <<EOM
11659 Cannot figure out whether your fflush(NULL) works or not.
11660 I'm assuming it doesn't (contrary to ANSI C).
11661 EOM
11662                 fflushNULL="$undef"
11663                 ;;
11664         esac
11665         ;;
11666 $define|true|[yY]*)
11667         fflushNULL="$define"
11668         ;;
11669 *)
11670         fflushNULL="$undef"
11671         ;;
11672 esac
11673 : check explicit looping only if NULL did not work
11674 case "$fflushNULL" in
11675 "$undef")
11676         : check for fflush all behaviour
11677         case "$fflushall" in
11678         '')     set try -DTRY_FFLUSH_ALL $output
11679                 if eval $compile; then
11680                         $cat >&4 <<EOM
11681 (Now testing the other method--but note that also this may fail.)
11682 EOM
11683                         $rm -f try.out
11684                         ./try$exe_ext 2>/dev/null
11685                         if $test -s try.out -a "X$?" = X42; then
11686                                 fflushall="`$cat try.out`"
11687                         fi
11688                 fi
11689                 $rm -f core try.core core.try.*
11690                 case "$fflushall" in
11691                 x)      $cat >&4 <<EOM
11692 Whew. Flushing explicitly all the stdio streams works.
11693 EOM
11694                         fflushall="$define"
11695                         ;;
11696                 '')     $cat >&4 <<EOM
11697 Sigh. Flushing explicitly all the stdio streams doesn't work.
11698 EOM
11699                         fflushall="$undef"
11700                         ;;
11701                 *)      $cat >&4 <<EOM
11702 Cannot figure out whether flushing stdio streams explicitly works or not.
11703 I'm assuming it doesn't.
11704 EOM
11705                         fflushall="$undef"
11706                         ;;
11707                 esac
11708                 ;;
11709         "$define"|true|[yY]*)
11710                 fflushall="$define"
11711                 ;;
11712         *)
11713                 fflushall="$undef"
11714                 ;;
11715         esac
11716         ;;
11717 *)      fflushall="$undef"      
11718         ;;
11719 esac
11720 case "$fflushNULL$fflushall" in
11721 undefundef)
11722         $cat <<EOM
11723 I cannot figure out how to flush pending stdio output.
11724 EOM
11725         ;;
11726 esac
11727 $rm -f try.* try$exe_ext
11728
11729 : Store the full pathname to the ar program for use in the C program
11730 : Respect a hint or command line value for full_ar.
11731 case "$full_ar" in
11732 '') full_ar=$ar ;;
11733 esac
11734
11735 : Store the full pathname to the sed program for use in the C program
11736 full_sed=$sed
11737
11738 : see what type gids are declared as in the kernel
11739 echo " "
11740 echo "Looking for the type for group ids returned by getgid()."
11741 set gid_t gidtype xxx stdio.h sys/types.h
11742 eval $typedef
11743 case "$gidtype" in
11744 xxx)
11745         xxx=`./findhdr sys/user.h`
11746         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
11747         case $1 in
11748         unsigned) dflt="$1 $2" ;;
11749         *) dflt="$1" ;;
11750         esac
11751         ;;
11752 *) dflt="$gidtype";;
11753 esac
11754 case "$gidtype" in
11755 gid_t) echo "gid_t found." ;;
11756 *)      rp="What is the type for group ids returned by getgid()?"
11757         . ./myread
11758         gidtype="$ans"
11759         ;;
11760 esac
11761
11762 echo " "
11763 case "$gidtype" in
11764 *_t) zzz="$gidtype"     ;;
11765 *)   zzz="gid"          ;;
11766 esac
11767 echo "Checking the size of $zzz..." >&4 
11768 cat > try.c <<EOCP
11769 #include <sys/types.h>
11770 #include <stdio.h>
11771 int main() {
11772     printf("%d\n", (int)sizeof($gidtype));
11773     exit(0);
11774 }
11775 EOCP
11776 set try
11777 if eval $compile_ok; then
11778         yyy=`./try`
11779         case "$yyy" in
11780         '')     gidsize=4
11781                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
11782                 ;;
11783         *)      gidsize=$yyy
11784                 echo "Your $zzz size is $gidsize bytes."
11785                 ;;
11786         esac
11787 else
11788         gidsize=4
11789         echo "(I can't compile the test program--guessing $gidsize.)" >&4
11790 fi
11791
11792
11793 echo " "
11794 case "$gidtype" in
11795 *_t) zzz="$gidtype"     ;;
11796 *)   zzz="gid"          ;;
11797 esac
11798 echo "Checking the sign of $zzz..." >&4 
11799 cat > try.c <<EOCP
11800 #include <sys/types.h>
11801 #include <stdio.h>
11802 int main() {
11803         $gidtype foo = -1;
11804         if (foo < 0)
11805                 printf("-1\n");
11806         else
11807                 printf("1\n");
11808 }
11809 EOCP
11810 set try
11811 if eval $compile; then
11812         yyy=`./try`
11813         case "$yyy" in
11814         '')     gidsign=1
11815                 echo "(I can't execute the test program--guessing unsigned.)" >&4
11816                 ;;
11817         *)      gidsign=$yyy
11818                 case "$gidsign" in
11819                  1) echo "Your $zzz is unsigned." ;;
11820                 -1) echo "Your $zzz is signed."   ;;
11821                 esac
11822                 ;;
11823         esac
11824 else
11825         gidsign=1
11826         echo "(I can't compile the test program--guessing unsigned.)" >&4
11827 fi
11828
11829
11830 : check for length of character
11831 echo " "
11832 case "$charsize" in
11833 '')
11834         echo "Checking to see how big your characters are (hey, you never know)..." >&4
11835         $cat >try.c <<'EOCP'
11836 #include <stdio.h>
11837 int main()
11838 {
11839     printf("%d\n", (int)sizeof(char));
11840     exit(0);
11841 }
11842 EOCP
11843         set try
11844         if eval $compile_ok; then
11845                 dflt=`./try`
11846         else
11847                 dflt='1'
11848                 echo "(I can't seem to compile the test program.  Guessing...)"
11849         fi
11850         ;;
11851 *)
11852         dflt="$charsize"
11853         ;;
11854 esac
11855 rp="What is the size of a character (in bytes)?"
11856 . ./myread
11857 charsize="$ans"
11858 $rm -f try.c try
11859
11860
11861 echo " "
11862 $echo "Choosing the C types to be used for Perl's internal types..." >&4
11863
11864 case "$use64bits:$d_quad:$quadtype" in
11865 define:define:?*)
11866         ivtype="$quadtype"
11867         uvtype="$uquadtype"
11868         ivsize=8
11869         uvsize=8
11870         ;;
11871 *)      ivtype="long"
11872         uvtype="unsigned long"
11873         ivsize=$longsize
11874         uvsize=$longsize
11875         ;;
11876 esac
11877
11878 case "$uselongdouble:$d_longdbl" in
11879 define:define)
11880         nvtype="long double"
11881         nvsize=$longdblsize
11882         ;;
11883 *)      nvtype=double
11884         nvsize=$doublesize
11885         ;;
11886 esac
11887
11888 echo "(IV will be "$ivtype", $ivsize bytes)"
11889 echo "(UV will be "$uvtype", $uvsize bytes)"
11890 echo "(NV will be "$nvtype", $nvsize bytes)"
11891
11892 $cat >try.c <<EOCP
11893 #$i_inttypes I_INTTYPES
11894 #ifdef I_INTTYPES
11895 #include <inttypes.h>
11896 #endif
11897 #include <stdio.h>
11898 int main() {
11899 #ifdef INT8
11900    int8_t i =  INT8_MAX;
11901   uint8_t u = UINT8_MAX;
11902   printf("int8_t\n");
11903 #endif
11904 #ifdef INT16
11905    int16_t i =  INT16_MAX;
11906   uint16_t i = UINT16_MAX;
11907   printf("int16_t\n");
11908 #endif
11909 #ifdef INT32
11910    int32_t i =  INT32_MAX;
11911   uint32_t u = UINT32_MAX;
11912   printf("int32_t\n");
11913 #endif
11914 }
11915 EOCP
11916
11917 case "$i8type" in
11918 '')     case "$charsize" in
11919         1)      i8type=char
11920                 u8type="unsigned char"
11921                 i8size=$charsize
11922                 u8size=$charsize
11923                 ;;
11924         esac
11925         ;;
11926 esac
11927 case "$i8type" in
11928 '')     set try -DINT8
11929         if eval $compile; then
11930                 case "`./try$exe_ext`" in
11931                 int8_t) i8type=int8_t
11932                         u8type=uint8_t
11933                         i8size=1
11934                         u8size=1
11935                         ;;
11936                 esac
11937         fi
11938         ;;
11939 esac
11940 case "$i8type" in
11941 '')     if $test $charsize -ge 1; then
11942                 i8type=char
11943                 u8type="unsigned char"
11944                 i8size=$charsize
11945                 u8size=$charsize
11946         fi
11947         ;;
11948 esac
11949
11950 case "$i16type" in
11951 '')     case "$shortsize" in
11952         2)      i16type=short
11953                 u16type="unsigned short"
11954                 i16size=$shortsize
11955                 u16size=$shortsize
11956                 ;;
11957         esac
11958         ;;
11959 esac
11960 case "$i16type" in
11961 '')     set try -DINT16
11962         if eval $compile; then
11963                 case "`./try$exe_ext`" in
11964                 int16_t)
11965                         i16type=int16_t
11966                         u16type=uint16_t
11967                         i16size=2
11968                         u16size=2
11969                         ;;
11970                 esac
11971         fi
11972         ;;
11973 esac
11974 case "$i16type" in
11975 '')     if $test $shortsize -ge 2; then
11976                 i16type=short
11977                 u16type="unsigned short"
11978                 i16size=$shortsize
11979                 u16size=$shortsize
11980         fi
11981         ;;
11982 esac
11983
11984 case "$i32type" in
11985 '')     case "$longsize" in
11986         4)      i32type=long
11987                 u32type="unsigned long"
11988                 i32size=$longsize
11989                 u32size=$longsize
11990                 ;;
11991         *)      case "$intsize" in
11992                 4)      i32type=int
11993                         u32type="unsigned int"
11994                         i32size=$intsize
11995                         u32size=$intsize
11996                         ;;
11997                 esac
11998                 ;;
11999         esac
12000         ;;
12001 esac
12002 case "$i32type" in
12003 '')     set try -DINT32
12004         if eval $compile; then
12005                 case "`./try$exe_ext`" in
12006                 int32_t)
12007                         i32type=int32_t
12008                         u32type=uint32_t
12009                         i32size=4
12010                         u32size=4
12011                         ;;
12012                 esac
12013         fi
12014         ;;
12015 esac
12016 case "$i32type" in
12017 '')     if $test $intsize -ge 4; then
12018                 i32type=int
12019                 u32type="unsigned int"
12020                 i32size=$intsize
12021                 u32size=$intsize
12022         fi
12023         ;;
12024 esac
12025
12026 case "$i64type" in
12027 '')     case "$d_quad:$quadtype" in
12028         define:?*)
12029                 i64type="$quadtype"
12030                 u64type="$uquadtype"
12031                 i64size=8
12032                 u64size=8
12033                 ;;
12034         esac
12035         ;;
12036 esac
12037
12038 $rm -f try.* try
12039
12040 echo " "
12041
12042 if $test X"$quadtype" != X; then
12043
12044 echo "Checking how to print 64-bit integers..." >&4
12045
12046 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
12047         $cat >try.c <<'EOCP'
12048 #include <sys/types.h>
12049 #include <stdio.h>
12050 int main() {
12051   int q = 12345678901;
12052   printf("%ld\n", q);
12053 }
12054 EOCP
12055         set try
12056         if eval $compile; then
12057                 yyy=`./try$exe_ext`
12058                 case "$yyy" in
12059                 12345678901)
12060                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
12061                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIX64='"X"';
12062                         echo "We will use %d."
12063                         ;;
12064                 esac
12065         fi
12066 fi
12067
12068 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
12069         $cat >try.c <<'EOCP'
12070 #include <sys/types.h>
12071 #include <stdio.h>
12072 int main() {
12073   long q = 12345678901;
12074   printf("%ld\n", q);
12075 }
12076 EOCP
12077         set try
12078         if eval $compile; then
12079                 yyy=`./try$exe_ext`
12080                 case "$yyy" in
12081                 12345678901)
12082                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
12083                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIX64='"lX"';
12084                         echo "We will use %ld."
12085                         ;;
12086                 esac
12087         fi
12088 fi
12089
12090 if $test X"$sPRId64" = X -a X"$i_inttypes.h" = X"$define" -a X"$quadtype" = Xint64_t; then
12091         $cat >try.c <<'EOCP'
12092 #include <sys/types.h>
12093 #include <inttypes.h>
12094 #include <stdio.h>
12095 int main() {
12096   int64_t q = 12345678901;
12097   printf("%" PRId64 "\n", q);
12098 }
12099 EOCP
12100         set try
12101         if eval $compile; then
12102                 yyy=`./try$exe_ext`
12103                 case "$yyy" in
12104                 12345678901)
12105                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
12106                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIX64=PRIX64;
12107                         echo "We will use the C9X style."
12108                         ;;
12109                 esac
12110         fi
12111 fi
12112
12113 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
12114         $cat >try.c <<'EOCP'
12115 #include <sys/types.h>
12116 #include <stdio.h>
12117 int main() {
12118   long long q = 12345678901LL; /* AIX cc requires the LL prefix. */
12119   printf("%lld\n", q);
12120 }
12121 EOCP
12122         set try
12123         if eval $compile; then
12124                 yyy=`./try$exe_ext`
12125                 case "$yyy" in
12126                 12345678901)
12127                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
12128                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIX64='"llX"';
12129                         echo "We will use the %lld style."
12130                         ;;
12131                 esac
12132         fi
12133 fi
12134
12135 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
12136         $cat >try.c <<EOCP
12137 #include <sys/types.h>
12138 #include <stdio.h>
12139 int main() {
12140   $quadtype q = 12345678901;
12141   printf("%Ld\n", q);
12142 }
12143 EOCP
12144         set try
12145         if eval $compile; then
12146                 yyy=`./try$exe_ext`
12147                 case "$yyy" in
12148                 12345678901)
12149                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
12150                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIX64='"LX"';
12151                         echo "We will use %Ld."
12152                         ;;
12153                 esac
12154         fi
12155 fi
12156
12157 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
12158         $cat >try.c <<EOCP
12159 #include <sys/types.h>
12160 #include <stdio.h>
12161 int main() {
12162   $quadtype q = 12345678901;
12163   printf("%qd\n", q);
12164 }
12165 EOCP
12166         set try
12167         if eval $compile; then
12168                 yyy=`./try$exe_ext`
12169                 case "$yyy" in
12170                 12345678901)
12171                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
12172                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIX64='"qX"';
12173                         echo "We will use %qd."
12174                         ;;
12175                 esac
12176         fi
12177 fi
12178
12179 if $test X"$sPRId64" = X; then
12180         echo "Cannot figure out how to print 64-bit integers." >&4
12181 fi
12182
12183 $rm -f try try.*
12184
12185 fi
12186
12187 case "$sPRId64" in
12188 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef"; 
12189         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIX64="$undef"; 
12190         ;;
12191 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define"; 
12192         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIX64="$define"; 
12193         ;;
12194 esac
12195
12196
12197 echo " "
12198 $echo "Checking the format strings to be used for Perl's internal types..." >&4
12199
12200 if $test X"$ivsize" = X8; then
12201         ivdformat="$sPRId64"
12202         uvuformat="$sPRIu64"
12203         uvoformat="$sPRIo64"
12204         uvxformat="$sPRIx64"
12205 else
12206         if $test X"$ivsize" = X"$longsize"; then
12207                 ivdformat='"ld"'
12208                 uvuformat='"lu"'
12209                 uvoformat='"lo"'
12210                 uvxformat='"lx"'
12211         else
12212                 if $test X"$ivsize" = X"$intsize"; then
12213                         ivdformat='"d"'
12214                         uvuformat='"u"'
12215                         uvoformat='"o"'
12216                         uvxformat='"x"'
12217                 else
12218                         : far out
12219                         if $test X"$ivsize" = X"$shortsize"; then
12220                                 ivdformat='"hd"'
12221                                 uvuformat='"hu"'
12222                                 uvoformat='"ho"'
12223                                 uvxformat='"hx"'
12224                         fi
12225                 fi
12226         fi
12227 fi
12228
12229 case "$ivdformat" in
12230 '') echo "$0: Fatal: failed to find format strings, cannot continue." >& 4
12231     exit 1
12232     ;;
12233 esac
12234
12235
12236 echo " "
12237 $echo "Checking the format string to be used for gids..." >&4
12238
12239 case "$gidsign" in
12240 -1)     if $test X"$gidsize" = X"$ivsize"; then
12241                 gidformat="$ivdformat"
12242         else
12243                 if $test X"$gidsize" = X"$longsize"; then
12244                         gidformat='"ld"'
12245                 else
12246                         if $test X"$gidsize" = X"$intsize"; then
12247                                 gidformat='"d"'
12248                         else
12249                                 if $test X"$gidsize" = X"$shortsize"; then
12250                                         gidformat='"hd"'
12251                                 fi
12252                         fi
12253                 fi
12254         fi
12255         ;;
12256 *)      if $test X"$gidsize" = X"$uvsize"; then
12257                 gidformat="$uvuformat"
12258         else
12259                 if $test X"$gidsize" = X"$longsize"; then
12260                         gidformat='"lu"'
12261                 else
12262                         if $test X"$gidsize" = X"$intsize"; then
12263                                 gidformat='"u"'
12264                         else
12265                                 if $test X"$gidsize" = X"$shortsize"; then
12266                                         gidformat='"hu"'
12267                                 fi
12268                         fi
12269                 fi
12270         fi
12271         ;;
12272 esac
12273
12274 : see if getgroups exists
12275 set getgroups d_getgrps
12276 eval $inlibc
12277
12278 : see if setgroups exists
12279 set setgroups d_setgrps
12280 eval $inlibc
12281
12282
12283 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
12284 echo " "
12285 case "$d_getgrps$d_setgrps" in
12286 *define*)
12287         case "$groupstype" in
12288         '') dflt="$gidtype" ;;
12289         *)  dflt="$groupstype" ;;
12290         esac
12291         $cat <<EOM
12292 What type of pointer is the second argument to getgroups() and setgroups()?
12293 Usually this is the same as group ids, $gidtype, but not always.
12294
12295 EOM
12296         rp='What type pointer is the second argument to getgroups() and setgroups()?'
12297         . ./myread
12298         groupstype="$ans"
12299         ;;
12300 *)  groupstype="$gidtype";;
12301 esac
12302
12303 echo " "
12304 echo "Checking if your $make program sets \$(MAKE)..." >&4
12305 case "$make_set_make" in
12306 '')
12307         $sed 's/^X //' > testmake.mak << 'EOF'
12308 Xall:
12309 X       @echo 'maketemp="$(MAKE)"'
12310 EOF
12311         case "`$make -f testmake.mak 2>/dev/null`" in
12312         *maketemp=*) make_set_make='#' ;;
12313         *)      make_set_make="MAKE=$make" ;;
12314         esac
12315         $rm -f testmake.mak
12316         ;;
12317 esac
12318 case "$make_set_make" in
12319 '#') echo "Yup, it does.";;
12320 *) echo "Nope, it doesn't.";;
12321 esac
12322
12323 : see what type is used for mode_t
12324 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
12325 set mode_t modetype int stdio.h sys/types.h
12326 eval $typedef_ask
12327
12328 : define a fucntion to check prototypes
12329 $cat > protochk <<EOSH
12330 $startsh
12331 cc="$cc"
12332 optimize="$optimize"
12333 ccflags="$ccflags"
12334 prototype="$prototype"
12335 define="$define"
12336 rm=$rm
12337 EOSH
12338
12339 $cat >> protochk <<'EOSH'
12340
12341 $rm -f try.c
12342 foo="$1"
12343 shift
12344 while test $# -ge 2; do
12345         case "$1" in
12346                 $define) echo "#include <$2>" >> try.c ;;
12347                 literal) echo "$2" >> try.c ;;
12348         esac
12349     shift 2
12350 done
12351 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
12352 cat >> try.c <<'EOCP'
12353 #ifdef CAN_PROTOTYPE
12354 #define _(args) args
12355 #else
12356 #define _(args) ()
12357 #endif
12358 EOCP
12359 echo "$foo" >> try.c
12360 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
12361 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
12362 status=$?
12363 $rm -f try.[co]
12364 exit $status
12365 EOSH
12366 chmod +x protochk
12367 $eunicefix protochk
12368
12369 : see what type is used for size_t
12370 rp="What is the type used for the length parameter for string functions?"
12371 set size_t sizetype 'unsigned int' stdio.h sys/types.h
12372 eval $typedef_ask
12373
12374 : check for type of arguments to gethostbyaddr. 
12375 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
12376         case "$d_gethbyaddr" in
12377         $define)
12378                 $cat <<EOM
12379
12380 Checking to see what type of arguments are accepted by gethostbyaddr().
12381 EOM
12382                 hdrs="$define sys/types.h
12383                         $d_socket sys/socket.h 
12384                         $i_niin netinet/in.h 
12385                         $i_netdb netdb.h
12386                         $i_unistd unistd.h"
12387                 : The first arg can 'char *' or 'void *'
12388                 : The second arg is some of integral type
12389                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
12390                         for yyy in size_t long int; do
12391                                 case "$netdb_host_type" in
12392                                 '')     try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
12393                                         if ./protochk "$try" $hdrs; then
12394                                                 echo "Your system accepts $xxx for the first arg."
12395                                                 echo "...and $yyy for the second arg."
12396                                                 netdb_host_type="$xxx"
12397                                                 netdb_hlen_type="$yyy"
12398                                         fi
12399                                         ;;
12400                                 esac
12401                         done
12402                 done
12403                 : In case none of those worked, prompt the user.
12404                 case "$netdb_host_type" in
12405                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
12406                         dflt='char *'
12407                         . ./myread
12408                         netdb_host_type=$ans
12409                         rp='What is the type for the 2nd argument to gethostbyaddr?'
12410                         dflt="$sizetype"
12411                         . ./myread
12412                         netdb_hlen_type=$ans
12413                         ;;
12414                 esac
12415                 ;;
12416         *)      : no gethostbyaddr, so pick harmless defaults
12417                 netdb_host_type='char *'
12418                 netdb_hlen_type="$sizetype"
12419                 ;;
12420         esac
12421         # Remove the "const" if needed. -- but then we'll have a 
12422         # prototype clash!
12423         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
12424 fi
12425
12426 : check for type of argument to gethostbyname. 
12427 if test "X$netdb_name_type" = X ; then
12428         case "$d_gethbyname" in
12429         $define)
12430                 $cat <<EOM
12431
12432 Checking to see what type of argument is accepted by gethostbyname().
12433 EOM
12434                 hdrs="$define sys/types.h
12435                         $d_socket sys/socket.h 
12436                         $i_niin netinet/in.h 
12437                         $i_netdb netdb.h
12438                         $i_unistd unistd.h"
12439                 for xxx in "const char *" "char *"; do
12440                         case "$netdb_name_type" in
12441                         '')     try="extern struct hostent *gethostbyname($xxx);"
12442                                 if ./protochk "$try" $hdrs; then
12443                                         echo "Your system accepts $xxx."
12444                                         netdb_name_type="$xxx"
12445                                 fi
12446                                 ;;
12447                         esac
12448                 done
12449                 : In case none of those worked, prompt the user.
12450                 case "$netdb_name_type" in
12451                 '')     rp='What is the type for the 1st argument to gethostbyname?'
12452                         dflt='char *'
12453                         . ./myread
12454                         netdb_name_type=$ans
12455                         ;;
12456                 esac
12457                 ;;
12458         *)      : no gethostbyname, so pick harmless default
12459                 netdb_name_type='char *'
12460                 ;;
12461         esac
12462 fi
12463
12464 : check for type of 1st argument to getnetbyaddr. 
12465 if test "X$netdb_net_type" = X ; then
12466         case "$d_getnbyaddr" in
12467         $define)
12468                 $cat <<EOM
12469
12470 Checking to see what type of 1st argument is accepted by getnetbyaddr().
12471 EOM
12472                 hdrs="$define sys/types.h
12473                         $d_socket sys/socket.h 
12474                         $i_niin netinet/in.h 
12475                         $i_netdb netdb.h
12476                         $i_unistd unistd.h"
12477                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
12478                         case "$netdb_net_type" in
12479                         '')     try="extern struct netent *getnetbyaddr($xxx, int);"
12480                                 if ./protochk "$try" $hdrs; then
12481                                         echo "Your system accepts $xxx."
12482                                         netdb_net_type="$xxx"
12483                                 fi
12484                                 ;;
12485                         esac
12486                 done
12487                 : In case none of those worked, prompt the user.
12488                 case "$netdb_net_type" in
12489                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
12490                         dflt='long'
12491                         . ./myread
12492                         netdb_net_type=$ans
12493                         ;;
12494                 esac
12495                 ;;
12496         *)      : no getnetbyaddr, so pick harmless default
12497                 netdb_net_type='long'
12498                 ;;
12499         esac
12500 fi
12501 : locate the preferred pager for this system
12502 case "$pager" in
12503 '')
12504         dflt=''
12505         case "$pg" in
12506         /*) dflt=$pg;;
12507         esac
12508         case "$more" in
12509         /*) dflt=$more;;
12510         esac
12511         case "$less" in
12512         /*) dflt=$less;;
12513         esac
12514         case "$dflt" in
12515         '') dflt=/usr/ucb/more;;
12516         esac
12517         ;;
12518 *) dflt="$pager";;
12519 esac
12520 echo " "
12521 fn=f/
12522 rp='What pager is used on your system?'
12523 . ./getfile
12524 pager="$ans"
12525
12526 : see what type pids are declared as in the kernel
12527 rp="What is the type of process ids on this system?"
12528 set pid_t pidtype int stdio.h sys/types.h
12529 eval $typedef_ask
12530
12531 : Find earliest binary compatible site_perl subdirectory perl can use.
12532 case "$bincompat5005" in
12533 "$define") xs_apiversion='5.005' ;;
12534 *) xs_apiversion=$apiversion ;;   # The current site_perl version.
12535 esac
12536 : Find earliest pure perl site_perl subdirectory perl can use.
12537 : The versioned directories started at 5.005.
12538 pm_apiversion='5.005'
12539
12540 : check for length of pointer
12541 echo " "
12542 case "$ptrsize" in
12543 '')
12544         $echo $n "Checking to see how big your pointers are...$c" >&4
12545         if test "$voidflags" -gt 7; then
12546                 echo '#define VOID_PTR char *' > try.c
12547         else
12548                 echo '#define VOID_PTR void *' > try.c
12549         fi
12550         $cat >>try.c <<'EOCP'
12551 #include <stdio.h>
12552 int main()
12553 {
12554     printf("%d\n", (int)sizeof(VOID_PTR));
12555     exit(0);
12556 }
12557 EOCP
12558         set try
12559         if eval $compile_ok; then
12560                 ptrsize=`./try`
12561                 $echo " $ptrsize bytes." >&4
12562         else
12563                 dflt='4'
12564                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
12565                 rp="What is the size of a pointer (in bytes)?"
12566                 . ./myread
12567                 ptrsize="$ans"
12568         fi
12569         ;;
12570 esac
12571 $rm -f try.c try
12572
12573 : see if ar generates random libraries by itself
12574 echo " "
12575 echo "Checking how to generate random libraries on your machine..." >&4
12576 echo 'int bar1() { return bar2(); }' > bar1.c
12577 echo 'int bar2() { return 2; }' > bar2.c
12578 $cat > foo.c <<'EOP'
12579 int main() { printf("%d\n", bar1()); exit(0); }
12580 EOP
12581 $cc $ccflags -c bar1.c >/dev/null 2>&1
12582 $cc $ccflags -c bar2.c >/dev/null 2>&1
12583 $cc $ccflags -c foo.c >/dev/null 2>&1
12584 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
12585 if $cc $ccflags $ldflags -o foobar foo$_o bar$_a $libs > /dev/null 2>&1 &&
12586         ./foobar >/dev/null 2>&1; then
12587         echo "$ar appears to generate random libraries itself."
12588         orderlib=false
12589         ranlib=":"
12590 elif $ar ts bar$_a >/dev/null 2>&1 &&
12591         $cc $ccflags $ldflags -o foobar foo$_o bar$_a $libs > /dev/null 2>&1 &&
12592         ./foobar >/dev/null 2>&1; then
12593                 echo "a table of contents needs to be added with '$ar ts'."
12594                 orderlib=false
12595                 ranlib="$ar ts"
12596 else
12597         case "$ranlib" in
12598         :) ranlib='';;
12599         '')
12600                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
12601                 $test -f $ranlib || ranlib=''
12602                 ;;
12603         esac
12604         if $test -n "$ranlib"; then
12605                 echo "your system has '$ranlib'; we'll use that."
12606                 orderlib=false
12607         else
12608                 echo "your system doesn't seem to support random libraries"
12609                 echo "so we'll use lorder and tsort to order the libraries."
12610                 orderlib=true
12611                 ranlib=":"
12612         fi
12613 fi
12614 $rm -f foo* bar* 
12615
12616 : check for type of arguments to select. 
12617 case "$selecttype" in
12618 '') case "$d_select" in
12619         $define)
12620                 $cat <<EOM
12621 Checking to see what type of arguments are accepted by select().
12622 EOM
12623                 hdrs="$define sys/types.h
12624                         $i_systime sys/time.h 
12625                         $i_sysselct sys/select.h
12626                         $d_socket sys/socket.h"
12627                 : The first arg can be int, unsigned, or size_t
12628                 : The last arg may or may not be 'const'
12629                 val=''
12630                 : void pointer has been seen but using that
12631                 : breaks the selectminbits test
12632                 for xxx in 'fd_set *' 'int *'; do
12633                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
12634                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
12635                                         case "$val" in
12636                                         '')     try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
12637                                                 if ./protochk "$try" $hdrs; then
12638                                                         echo "Your system accepts $xxx."
12639                                                         val="$xxx"
12640                                                 fi
12641                                                 ;;
12642                                         esac
12643                                 done
12644                         done
12645                 done
12646                 case "$val" in
12647                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
12648                         case "$d_fd_set" in
12649                                 $define) dflt="fd_set *" ;;
12650                                 *)              dflt="int *" ;;
12651                         esac
12652                         . ./myread
12653                         val=$ans
12654                         ;;
12655                 esac
12656                 selecttype="$val"
12657                 ;;
12658         *)      : no select, so pick a harmless default
12659                 selecttype='int *'
12660                 ;;
12661         esac
12662         ;;
12663 esac
12664
12665 : check for the select 'width'
12666 case "$selectminbits" in
12667 '') case "$d_select" in
12668         $define)
12669                 $cat <<EOM
12670
12671 Checking to see on how many bits at a time your select() operates...
12672 EOM
12673                 $cat >try.c <<EOCP
12674 #include <sys/types.h>
12675 #$i_time I_TIME
12676 #$i_systime I_SYS_TIME
12677 #$i_systimek I_SYS_TIME_KERNEL
12678 #ifdef I_TIME
12679 #   include <time.h>
12680 #endif
12681 #ifdef I_SYS_TIME
12682 #   ifdef I_SYS_TIME_KERNEL
12683 #       define KERNEL
12684 #   endif
12685 #   include <sys/time.h>
12686 #   ifdef I_SYS_TIME_KERNEL
12687 #       undef KERNEL
12688 #   endif
12689 #endif
12690 #$i_sysselct I_SYS_SELECT
12691 #ifdef I_SYS_SELECT
12692 #include <sys/select.h>
12693 #endif
12694 #$d_socket HAS_SOCKET
12695 #ifdef HAS_SOCKET
12696 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
12697 #endif
12698 #include <stdio.h>
12699 $selecttype b;
12700 #define S sizeof(*(b))
12701 #define MINBITS 64
12702 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
12703 #define NBITS  (NBYTES * 8)
12704 int main() {
12705     char s[NBYTES];
12706     struct timeval t;
12707     int i;
12708     FILE* fp;
12709     int fd;
12710
12711     fclose(stdin);
12712     fp = fopen("try.c", "r");
12713     if (fp == 0)
12714       exit(1);
12715     fd = fileno(fp);
12716     if (fd < 0)
12717       exit(2);
12718     b = ($selecttype)s;
12719     for (i = 0; i < NBITS; i++)
12720         FD_SET(i, b);
12721     t.tv_sec  = 0;
12722     t.tv_usec = 0;
12723     select(fd + 1, b, 0, 0, &t);
12724     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
12725     printf("%d\n", i + 1);
12726     return 0;
12727 }
12728 EOCP
12729                 set try
12730                 if eval $compile_ok; then
12731                         selectminbits=`./try`
12732                         case "$selectminbits" in
12733                         '')     cat >&4 <<EOM
12734 Cannot figure out on how many bits at a time your select() operates.
12735 I'll play safe and guess it is 32 bits.
12736 EOM
12737                                 selectminbits=32
12738                                 bits="32 bits"
12739                                 ;;
12740                         1)      bits="1 bit" ;;
12741                         *)      bits="$selectminbits bits" ;;
12742                         esac
12743                         echo "Your select() operates on $bits at a time." >&4
12744                 else
12745                         rp='What is the minimum number of bits your select() operates on?'
12746                         case "$byteorder" in
12747                         1234|12345678)  dflt=32 ;;
12748                         *)              dflt=1  ;;
12749                         esac
12750                         . ./myread
12751                         val=$ans
12752                         selectminbits="$val"
12753                 fi
12754                 $rm -f try.* try
12755                 ;;
12756         *)      : no select, so pick a harmless default
12757                 selectminbits='32'
12758                 ;;
12759         esac
12760         ;;
12761 esac
12762
12763 : Trace out the files included by signal.h, then look for SIGxxx names.
12764 : Remove SIGARRAYSIZE used by HPUX.
12765 : Remove SIGSTKSIZE used by Linux.
12766 : Remove SIGSTKSZ used by Posix.
12767 : Remove SIGTYP void lines used by OS2.
12768 xxx=`echo '#include <signal.h>' |
12769         $cppstdin $cppminus $cppflags 2>/dev/null |
12770         $grep '^[       ]*#.*include' | 
12771         $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sort | $uniq`
12772 : Check this list of files to be sure we have parsed the cpp output ok.
12773 : This will also avoid potentially non-existent files, such 
12774 : as ../foo/bar.h
12775 xxxfiles=''
12776 for xx in $xxx /dev/null ; do
12777         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
12778 done
12779 : If we have found no files, at least try signal.h
12780 case "$xxxfiles" in
12781 '')     xxxfiles=`./findhdr signal.h` ;;
12782 esac
12783 xxx=`awk '
12784 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
12785         print substr($2, 4, 20)
12786 }
12787 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
12788         print substr($3, 4, 20)
12789 }' $xxxfiles`
12790 : Append some common names just in case the awk scan failed.
12791 xxx="$xxx ABRT ALRM BUS CHLD CLD CONT DIL EMT FPE HUP ILL INT IO IOT KILL"
12792 xxx="$xxx LOST PHONE PIPE POLL PROF PWR QUIT SEGV STKFLT STOP SYS TERM TRAP"
12793 xxx="$xxx TSTP TTIN TTOU URG USR1 USR2 USR3 USR4 VTALRM"
12794 xxx="$xxx WINCH WIND WINDOW XCPU XFSZ"
12795 : generate a few handy files for later
12796 $cat > signal.c <<'EOCP'
12797 #include <sys/types.h>
12798 #include <signal.h>
12799 #include <stdio.h>
12800 int main() {
12801
12802 /* Strange style to avoid deeply-nested #if/#else/#endif */
12803 #ifndef NSIG
12804 #  ifdef _NSIG
12805 #    define NSIG (_NSIG)
12806 #  endif
12807 #endif
12808
12809 #ifndef NSIG
12810 #  ifdef SIGMAX
12811 #    define NSIG (SIGMAX+1)
12812 #  endif
12813 #endif
12814
12815 #ifndef NSIG
12816 #  ifdef SIG_MAX
12817 #    define NSIG (SIG_MAX+1)
12818 #  endif
12819 #endif
12820
12821 #ifndef NSIG
12822 #  ifdef MAXSIG
12823 #    define NSIG (MAXSIG+1)
12824 #  endif
12825 #endif
12826
12827 #ifndef NSIG
12828 #  ifdef MAX_SIG
12829 #    define NSIG (MAX_SIG+1)
12830 #  endif
12831 #endif
12832
12833 #ifndef NSIG
12834 #  ifdef SIGARRAYSIZE
12835 #    define NSIG (SIGARRAYSIZE+1) /* Not sure of the +1 */
12836 #  endif
12837 #endif
12838
12839 #ifndef NSIG
12840 #  ifdef _sys_nsig
12841 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
12842 #  endif
12843 #endif
12844
12845 /* Default to some arbitrary number that's big enough to get most
12846    of the common signals.
12847 */
12848 #ifndef NSIG
12849 #    define NSIG 50
12850 #endif
12851
12852 printf("NSIG %d\n", NSIG);
12853
12854 #ifndef JUST_NSIG
12855
12856 EOCP
12857
12858 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
12859 {
12860         printf "#ifdef SIG"; printf $1; printf "\n"
12861         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
12862         printf $1; printf ");\n"
12863         printf "#endif\n"
12864 }
12865 END {
12866         printf "#endif /* JUST_NSIG */\n";
12867         printf "exit(0);\n}\n";
12868 }
12869 ' >>signal.c
12870 $cat >signal.awk <<'EOP'
12871 BEGIN { ndups = 0 }
12872 $1 ~ /^NSIG$/ { nsig = $2 }
12873 ($1 !~ /^NSIG$/) && (NF == 2) {
12874     if ($2 > maxsig) { maxsig = $2 }
12875     if (sig_name[$2]) {
12876         dup_name[ndups] = $1
12877         dup_num[ndups] = $2
12878         ndups++ 
12879     }
12880     else {
12881         sig_name[$2] = $1
12882         sig_num[$2] = $2
12883     }
12884 }
12885 END { 
12886     if (nsig == 0) {
12887         nsig = maxsig + 1
12888     }
12889     printf("NSIG %d\n", nsig);
12890     for (n = 1; n < nsig; n++) {
12891         if (sig_name[n]) {
12892             printf("%s %d\n", sig_name[n], sig_num[n])
12893         }
12894         else {
12895             printf("NUM%d %d\n", n, n) 
12896         }
12897     }
12898     for (n = 0; n < ndups; n++) {
12899         printf("%s %d\n", dup_name[n], dup_num[n])
12900     }
12901 }
12902 EOP
12903 $cat >signal_cmd <<EOS
12904 $startsh
12905 if $test -s signal.lst; then
12906     echo "Using your existing signal.lst file"
12907         exit 0
12908 fi
12909 xxx="$xxx"
12910 EOS
12911 $cat >>signal_cmd <<'EOS'
12912
12913 set signal
12914 if eval $compile_ok; then
12915         ./signal$_exe | $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
12916 else
12917         echo "(I can't seem be able to compile the whole test program)" >&4
12918         echo "(I'll try it in little pieces.)" >&4
12919         set signal -DJUST_NSIG
12920         if eval $compile_ok; then
12921                 ./signal$_exe > signal.nsg
12922                 $cat signal.nsg
12923         else
12924                 echo "I can't seem to figure out how many signals you have." >&4
12925                 echo "Guessing 50." >&4
12926                 echo 'NSIG 50' > signal.nsg
12927         fi
12928         : Now look at all the signal names, one at a time.
12929         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
12930                 $cat > signal.c <<EOCP
12931 #include <sys/types.h>
12932 #include <signal.h>
12933 #include <stdio.h>
12934 int main() {
12935 printf("$xx %d\n", SIG${xx});
12936 return 0;
12937 }
12938 EOCP
12939                 set signal
12940                 if eval $compile; then
12941                         echo "SIG${xx} found."
12942                         ./signal$_exe  >> signal.ls1
12943                 else
12944                         echo "SIG${xx} NOT found."
12945                 fi
12946         done
12947         if $test -s signal.ls1; then
12948                 $cat signal.nsg signal.ls1 |
12949                         $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
12950         fi
12951
12952 fi
12953 if $test -s signal.lst; then
12954         :
12955 else
12956         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
12957         echo 'kill -l' >signal
12958         set X `csh -f <signal`
12959         $rm -f signal
12960         shift
12961         case $# in
12962         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
12963         esac
12964         echo $@ | $tr ' ' $trnl | \
12965             $awk '{ printf "%s %d\n", $1, ++s; }
12966                   END { printf "NSIG %d\n", ++s }' >signal.lst
12967 fi
12968 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
12969 EOS
12970 chmod a+x signal_cmd
12971 $eunicefix signal_cmd
12972
12973 : generate list of signal names
12974 echo " "
12975 case "$sig_name_init" in
12976 '') doinit=yes ;;
12977 *)  case "$sig_num_init" in
12978     ''|*,*) doinit=yes ;;
12979     esac ;;
12980 esac
12981 case "$doinit" in
12982 yes)
12983         echo "Generating a list of signal names and numbers..." >&4
12984         . ./signal_cmd
12985         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
12986         sig_name=`$awk 'BEGIN { printf "ZERO " }
12987                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
12988         sig_num=`$awk  'BEGIN { printf "0 " }
12989                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
12990         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
12991                              !/^NSIG/   { printf "\"%s\", ", $1 }
12992                              END        { printf "0\n" }' signal.lst`
12993         sig_num_init=`$awk  'BEGIN      { printf "0, " }
12994                              !/^NSIG/   { printf "%d, ", $2}
12995                              END        { printf "0\n"}' signal.lst`
12996         ;;
12997 esac
12998 echo "The following $sig_count signals are available:"
12999 echo " "
13000 echo $sig_name | $awk \
13001 'BEGIN { linelen = 0 }
13002 {
13003         for (i = 1; i <= NF; i++) {
13004                 name = "SIG" $i " "
13005                 linelen = linelen + length(name)
13006                 if (linelen > 70) {
13007                         printf "\n"
13008                         linelen = length(name)
13009                 }
13010                 printf "%s", name
13011         }
13012         printf "\n"
13013 }'
13014 $rm -f signal signal.c signal.awk signal.lst signal_cmd 
13015
13016 : see what type is used for signed size_t
13017 set ssize_t ssizetype int stdio.h sys/types.h
13018 eval $typedef
13019 dflt="$ssizetype"
13020 $cat > ssize.c <<EOM
13021 #include <stdio.h>
13022 #include <sys/types.h>
13023 #define Size_t $sizetype
13024 #define SSize_t $dflt
13025 int main()
13026 {
13027         if (sizeof(Size_t) == sizeof(SSize_t))
13028                 printf("$dflt\n");
13029         else if (sizeof(Size_t) == sizeof(int))
13030                 printf("int\n");
13031         else 
13032                 printf("long\n");
13033         exit(0);
13034 }
13035 EOM
13036 echo " "
13037 set ssize
13038 if eval $compile_ok && ./ssize > /dev/null; then
13039         ssizetype=`./ssize`
13040         echo "I'll be using $ssizetype for functions returning a byte count." >&4
13041 else
13042         $cat >&4 <<EOM
13043 Help! I can't compile and run the ssize_t test program: please enlighten me!
13044 (This is probably a misconfiguration in your system or libraries, and
13045 you really ought to fix it.  Still, I'll try anyway.)
13046
13047 I need a type that is the same size as $sizetype, but is guaranteed to
13048 be signed.  Common values are ssize_t, int and long.
13049
13050 EOM
13051         rp="What signed type is the same size as $sizetype?"
13052         . ./myread
13053         ssizetype="$ans"
13054 fi
13055 $rm -f ssize ssize.*
13056
13057 : see what type of char stdio uses.
13058 echo " "
13059 if $contains 'unsigned.*char.*_ptr;' `./findhdr stdio.h` >/dev/null 2>&1 ; then
13060         echo "Your stdio uses unsigned chars." >&4
13061         stdchar="unsigned char"
13062 else
13063         echo "Your stdio uses signed chars." >&4
13064         stdchar="char"
13065 fi
13066
13067 : see if time exists
13068 echo " "
13069 if test "X$d_time" = X -o X"$timetype" = X; then
13070     if set time val -f d_time; eval $csym; $val; then
13071                 echo 'time() found.' >&4
13072                 val="$define"
13073                 rp="What is the type returned by time() on this system?"
13074                 set time_t timetype long stdio.h sys/types.h
13075                 eval $typedef_ask
13076     else
13077                 echo 'time() not found, hope that will do.' >&4
13078                 val="$undef"
13079                 timetype='int';
13080     fi
13081     set d_time
13082     eval $setvar
13083 fi
13084
13085 : see what type uids are declared as in the kernel
13086 echo " "
13087 echo "Looking for the type for user ids returned by getuid()."
13088 set uid_t uidtype xxx stdio.h sys/types.h
13089 eval $typedef
13090 case "$uidtype" in
13091 xxx)
13092         xxx=`./findhdr sys/user.h`
13093         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
13094         case $1 in
13095         unsigned) dflt="$1 $2" ;;
13096         *) dflt="$1" ;;
13097         esac
13098         ;;
13099 *) dflt="$uidtype";;
13100 esac
13101 case "$uidtype" in
13102 uid_t)  echo "uid_t found." ;;
13103 *)      rp="What is the type for user ids returned by getuid()?"
13104         . ./myread
13105         uidtype="$ans"
13106         ;;
13107 esac
13108
13109 echo " "
13110 case "$uidtype" in
13111 *_t) zzz="$uidtype"     ;;
13112 *)   zzz="uid"          ;;
13113 esac
13114 echo "Checking the size of $zzz..." >&4 
13115 cat > try.c <<EOCP
13116 #include <sys/types.h>
13117 #include <stdio.h>
13118 int main() {
13119     printf("%d\n", (int)sizeof($uidtype));
13120     exit(0);
13121 }
13122 EOCP
13123 set try
13124 if eval $compile_ok; then
13125         yyy=`./try`
13126         case "$yyy" in
13127         '')     uidsize=4
13128                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
13129                 ;;
13130         *)      uidsize=$yyy
13131                 echo "Your $zzz size is $uidsize bytes."
13132                 ;;
13133         esac
13134 else
13135         uidsize=4
13136         echo "(I can't compile the test program--guessing $uidsize.)" >&4
13137 fi
13138
13139 echo " "
13140 case "$uidtype" in
13141 *_t) zzz="$uidtype"     ;;
13142 *)   zzz="uid"          ;;
13143 esac
13144 echo "Checking the sign of $zzz..." >&4
13145 cat > try.c <<EOCP
13146 #include <sys/types.h>
13147 #include <stdio.h>
13148 int main() {
13149         $uidtype foo = -1;
13150         if (foo < 0)
13151                 printf("-1\n");
13152         else
13153                 printf("1\n");
13154 }
13155 EOCP
13156 set try
13157 if eval $compile; then
13158         yyy=`./try`
13159         case "$yyy" in
13160         '')     uidsign=1
13161                 echo "(I can't execute the test program--guessing unsigned.)" >&4
13162                 ;;
13163         *)      uidsign=$yyy
13164                 case "$uidsign" in
13165                  1) echo "Your $zzz is unsigned." ;;
13166                 -1) echo "Your $zzz is signed."   ;;
13167                 esac
13168                 ;;
13169         esac
13170 else
13171         uidsign=1
13172         echo "(I can't compile the test program--guessing unsigned.)" >&4
13173 fi
13174
13175
13176
13177 echo " "
13178 $echo "Checking the format string to be used for uids..." >&4
13179
13180 case "$uidsign" in
13181 -1)     if $test X"$uidsize" = X"$ivsize"; then
13182                 uidformat="$ivdformat"
13183         else
13184                 if $test X"$uidsize" = X"$longsize"; then
13185                         uidformat='"ld"'
13186                 else
13187                         if $test X"$uidsize" = X"$intsize"; then
13188                                 uidformat='"d"'
13189                         else
13190                                 if $test X"$uidsize" = X"$shortsize"; then
13191                                         uidformat='"hd"'
13192                                 fi
13193                         fi
13194                 fi
13195         fi
13196         ;;
13197 *)      if $test X"$uidsize" = X"$uvsize"; then
13198                 uidformat="$uvuformat"
13199         else
13200                 if $test X"$uidsize" = X"$longsize"; then
13201                         uidformat='"lu"'
13202                 else
13203                         if $test X"$uidsize" = X"$intsize"; then
13204                                 uidformat='"u"'
13205                         else
13206                                 if $test X"$uidsize" = X"$shortsize"; then
13207                                         uidformat='"hu"'
13208                                 fi
13209                         fi
13210                 fi
13211         fi
13212         ;;
13213 esac
13214
13215 : see if dbm.h is available
13216 : see if dbmclose exists
13217 set dbmclose d_dbmclose
13218 eval $inlibc
13219
13220 case "$d_dbmclose" in
13221 $define)
13222         set dbm.h i_dbm
13223         eval $inhdr
13224         case "$i_dbm" in
13225         $define)
13226                 val="$undef"
13227                 set i_rpcsvcdbm
13228                 eval $setvar
13229                 ;;
13230         *)      set rpcsvc/dbm.h i_rpcsvcdbm
13231                 eval $inhdr
13232                 ;;
13233         esac
13234         ;;
13235 *)      echo "We won't be including <dbm.h>"
13236         val="$undef"
13237         set i_dbm
13238         eval $setvar
13239         val="$undef"
13240         set i_rpcsvcdbm
13241         eval $setvar
13242         ;;
13243 esac
13244
13245 : see if this is a sys/file.h system
13246 val=''
13247 set sys/file.h val
13248 eval $inhdr
13249
13250 : do we need to include sys/file.h ?
13251 case "$val" in
13252 "$define")
13253         echo " "
13254         if $h_sysfile; then
13255                 val="$define"
13256                 echo "We'll be including <sys/file.h>." >&4
13257         else
13258                 val="$undef"
13259                 echo "We won't be including <sys/file.h>." >&4
13260         fi
13261         ;;
13262 *)
13263         h_sysfile=false
13264         ;;
13265 esac
13266 set i_sysfile
13267 eval $setvar
13268
13269 : see if fcntl.h is there
13270 val=''
13271 set fcntl.h val
13272 eval $inhdr
13273
13274 : see if we can include fcntl.h
13275 case "$val" in
13276 "$define")
13277         echo " "
13278         if $h_fcntl; then
13279                 val="$define"
13280                 echo "We'll be including <fcntl.h>." >&4
13281         else
13282                 val="$undef"
13283                 if $h_sysfile; then
13284         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
13285                 else
13286                         echo "We won't be including <fcntl.h>." >&4
13287                 fi
13288         fi
13289         ;;
13290 *)
13291         h_fcntl=false
13292         val="$undef"
13293         ;;
13294 esac
13295 set i_fcntl
13296 eval $setvar
13297
13298 : see if locale.h is available
13299 set locale.h i_locale
13300 eval $inhdr
13301
13302 : see if mach cthreads are available
13303 if test "X$usethreads" = "X$define"; then
13304         set mach/cthreads.h i_machcthr
13305         eval $inhdr
13306 else
13307         i_machcthr="$undef"
13308 fi
13309
13310
13311
13312 : see if this is a math.h system
13313 set math.h i_math
13314 eval $inhdr
13315
13316 : see if this is a mntent.h system
13317 set mntent.h i_mntent
13318 eval $inhdr
13319
13320 : see if ndbm.h is available
13321 set ndbm.h t_ndbm
13322 eval $inhdr
13323 case "$t_ndbm" in
13324 $define)
13325         : see if dbm_open exists
13326         set dbm_open d_dbm_open
13327         eval $inlibc
13328         case "$d_dbm_open" in
13329         $undef)
13330                 t_ndbm="$undef"
13331                 echo "We won't be including <ndbm.h>"
13332                 ;;
13333         esac
13334         ;;
13335 esac
13336 val="$t_ndbm"
13337 set i_ndbm
13338 eval $setvar
13339
13340 : see if net/errno.h is available
13341 val=''
13342 set net/errno.h val
13343 eval $inhdr
13344
13345 : Unfortunately, it causes problems on some systems.  Arrgh.
13346 case "$val" in
13347 $define)
13348         cat > try.c <<'EOM'
13349 #include <stdio.h>
13350 #include <errno.h>
13351 #include <net/errno.h>
13352 int func()
13353 {
13354         return ENOTSOCK;
13355 }
13356 EOM
13357         if $cc $ccflags -c try.c >/dev/null 2>&1; then
13358                 echo "We'll be including <net/errno.h>." >&4
13359         else
13360                 echo "We won't be including <net/errno.h>." >&4
13361                 val="$undef"
13362         fi
13363         $rm -f try.* try
13364         ;;
13365 esac
13366 set i_neterrno
13367 eval $setvar
13368
13369 : see if netinet/tcp.h is available
13370 set netinet/tcp.h i_netinettcp
13371 eval $inhdr
13372
13373 : see if this is a poll.h system
13374 set poll.h i_poll
13375 eval $inhdr
13376
13377 : get C preprocessor symbols handy
13378 echo " "
13379 $echo $n "Hmm... $c"
13380 echo $al | $tr ' ' $trnl >Cppsym.know
13381 $cat <<EOSS >Cppsym
13382 $startsh
13383 case "\$1" in
13384 -l) list=true
13385         shift
13386         ;;
13387 esac
13388 unknown=''
13389 case "\$list\$#" in
13390 1|2)
13391         for sym do
13392                 if $contains "^\$1$" Cppsym.true >/dev/null 2>&1; then
13393                         exit 0
13394                 elif $contains "^\$1$" Cppsym.know >/dev/null 2>&1; then
13395                         :
13396                 else
13397                         unknown="\$unknown \$sym"
13398                 fi
13399         done
13400         set X \$unknown
13401         shift
13402         ;;
13403 esac
13404 case \$# in
13405 0) exit 1;;
13406 esac
13407 echo \$* | $tr ' ' '$trnl' | $sed -e 's/\(.*\)/\\
13408 #ifdef \1\\
13409 exit 0; _ _ _ _\1\\      \1\\
13410 #endif\\
13411 /' >Cppsym\$\$
13412 echo "exit 1; _ _ _" >>Cppsym\$\$
13413 $cppstdin $cppminus <Cppsym\$\$ | $grep '^exit [01]; _ _'  >Cppsym2\$\$
13414 case "\$list" in
13415 true) $awk 'NF > 5 {print substr(\$6,2,100)}' <Cppsym2\$\$ ;;
13416 *)
13417         sh Cppsym2\$\$
13418         status=\$?
13419         ;;
13420 esac
13421 $rm -f Cppsym\$\$ Cppsym2\$\$
13422 exit \$status
13423 EOSS
13424 chmod +x Cppsym
13425 $eunicefix Cppsym
13426 ./Cppsym -l $al | $sort | $grep -v '^$' >Cppsym.true
13427
13428 : now check the C compiler for additional symbols
13429 postprocess_cc_v=''
13430 case "$osname" in
13431 aix) postprocess_cc_v="|$tr , ' '" ;;
13432 esac
13433 $cat >ccsym <<EOS
13434 $startsh
13435 $cat >tmp.c <<EOF
13436 extern int foo;
13437 EOF
13438 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
13439 do
13440         case "\$i" in
13441         -D*) echo "\$i" | $sed 's/^-D//';;
13442         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A\(.*\)(\(.*\))/\1=\2/';;
13443         esac
13444 done
13445 $rm -f try.c
13446 EOS
13447 postprocess_cc_v=''
13448 chmod +x ccsym
13449 $eunicefix ccsym
13450 ./ccsym > ccsym1.raw
13451 if $test -s ccsym1.raw; then
13452        $sort ccsym1.raw | $uniq >ccsym.raw
13453 else
13454        mv ccsym1.raw ccsym.raw
13455 fi
13456
13457 $awk '/\=/ { print $0; next }
13458         { print $0"=1" }' ccsym.raw >ccsym.list
13459 $awk '{ print $0"=1" }' Cppsym.true >ccsym.true
13460 $comm -13 ccsym.true ccsym.list >ccsym.own
13461 $comm -12 ccsym.true ccsym.list >ccsym.com
13462 $comm -23 ccsym.true ccsym.list >ccsym.cpp
13463 also=''
13464 if $test -z ccsym.raw; then
13465         echo "Your C compiler doesn't seem to define any symbols!" >&4
13466         echo " "
13467         echo "However, your C preprocessor defines the following symbols:"
13468         $cat Cppsym.true
13469         ccsymbols=''
13470         cppsymbols=`$cat Cppsym.true`
13471         cppsymbols=`echo $cppsymbols`
13472         cppccsymbols="$cppsymbols"
13473 else
13474         if $test -s ccsym.com; then
13475                 echo "Your C compiler and pre-processor define these symbols:"
13476                 $sed -e 's/\(.*\)=.*/\1/' ccsym.com
13477                 also='also '
13478                 symbols='ones'
13479                 cppccsymbols=`$cat ccsym.com`
13480                 cppccsymbols=`echo $cppccsymbols`
13481                 $test "$silent" || sleep 1
13482         fi
13483         if $test -s ccsym.cpp; then
13484                 $test "$also" && echo " "
13485                 echo "Your C pre-processor ${also}defines the following symbols:"
13486                 $sed -e 's/\(.*\)=.*/\1/' ccsym.cpp
13487                 also='further '
13488                 cppsymbols=`$cat ccsym.cpp`
13489                 cppsymbols=`echo $cppsymbols`
13490                 $test "$silent" || sleep 1
13491         fi
13492         if $test -s ccsym.own; then
13493                 $test "$also" && echo " "
13494                 echo "Your C compiler ${also}defines the following cpp symbols:"
13495                 $sed -e 's/\(.*\)=1/\1/' ccsym.own
13496                 $sed -e 's/\(.*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
13497                 ccsymbols=`$cat ccsym.own`
13498                 ccsymbols=`echo $ccsymbols`
13499                 $test "$silent" || sleep 1
13500         fi
13501 fi
13502 $rm -f ccsym*
13503
13504 : see if this is a termio system
13505 val="$undef"
13506 val2="$undef"
13507 val3="$undef"
13508 if $test `./findhdr termios.h`; then
13509         set tcsetattr i_termios
13510         eval $inlibc
13511         val3="$i_termios"
13512 fi
13513 echo " "
13514 case "$val3" in
13515 "$define") echo "You have POSIX termios.h... good!" >&4;;
13516 *) if ./Cppsym pyr; then
13517                 case "`/bin/universe`" in
13518                 ucb) if $test `./findhdr sgtty.h`; then
13519                                 val2="$define"
13520                                 echo "<sgtty.h> found." >&4
13521                         else
13522                                 echo "System is pyramid with BSD universe."
13523                                 echo "<sgtty.h> not found--you could have problems." >&4
13524                         fi;;
13525                 *) if $test `./findhdr termio.h`; then
13526                                 val="$define"
13527                                 echo "<termio.h> found." >&4
13528                         else
13529                                 echo "System is pyramid with USG universe."
13530                                 echo "<termio.h> not found--you could have problems." >&4
13531                         fi;;
13532                 esac
13533         elif ./usg; then
13534                 if $test `./findhdr termio.h`; then
13535                         echo "<termio.h> found." >&4
13536                         val="$define"
13537                 elif $test `./findhdr sgtty.h`; then
13538                         echo "<sgtty.h> found." >&4
13539                         val2="$define"
13540                 else
13541 echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
13542                 fi
13543         else
13544                 if $test `./findhdr sgtty.h`; then
13545                         echo "<sgtty.h> found." >&4
13546                         val2="$define"
13547                 elif $test `./findhdr termio.h`; then
13548                         echo "<termio.h> found." >&4
13549                         val="$define"
13550                 else
13551 echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
13552                 fi
13553         fi;;
13554 esac
13555 set i_termio; eval $setvar
13556 val=$val2; set i_sgtty; eval $setvar
13557 val=$val3; set i_termios; eval $setvar
13558
13559 : see if this is a shadow.h system
13560 set shadow.h i_shadow
13561 eval $inhdr
13562
13563 : see if this is a socks.h system
13564 set socks.h i_socks
13565 eval $inhdr
13566
13567 : see if stdarg is available
13568 echo " "
13569 if $test `./findhdr stdarg.h`; then
13570         echo "<stdarg.h> found." >&4
13571         valstd="$define"
13572 else
13573         echo "<stdarg.h> NOT found." >&4
13574         valstd="$undef"
13575 fi
13576
13577 : see if varags is available
13578 echo " "
13579 if $test `./findhdr varargs.h`; then
13580         echo "<varargs.h> found." >&4
13581 else
13582         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
13583 fi
13584
13585 : set up the varargs testing programs
13586 $cat > varargs.c <<EOP
13587 #ifdef I_STDARG
13588 #include <stdarg.h>
13589 #endif
13590 #ifdef I_VARARGS
13591 #include <varargs.h>
13592 #endif
13593
13594 #ifdef I_STDARG
13595 int f(char *p, ...)
13596 #else
13597 int f(va_alist)
13598 va_dcl
13599 #endif
13600 {
13601         va_list ap;
13602 #ifndef I_STDARG
13603         char *p;
13604 #endif
13605 #ifdef I_STDARG
13606         va_start(ap,p);
13607 #else
13608         va_start(ap);
13609         p = va_arg(ap, char *);
13610 #endif
13611         va_end(ap);
13612 }
13613 EOP
13614 $cat > varargs <<EOP
13615 $startsh
13616 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
13617         echo "true"
13618 else
13619         echo "false"
13620 fi
13621 $rm -f varargs$_o
13622 EOP
13623 chmod +x varargs
13624
13625 : now check which varargs header should be included
13626 echo " "
13627 i_varhdr=''
13628 case "$valstd" in
13629 "$define")
13630         if `./varargs I_STDARG`; then
13631                 val='stdarg.h'
13632         elif `./varargs I_VARARGS`; then
13633                 val='varargs.h'
13634         fi
13635         ;;
13636 *)
13637         if `./varargs I_VARARGS`; then
13638                 val='varargs.h'
13639         fi
13640         ;;
13641 esac
13642 case "$val" in
13643 '')
13644 echo "I could not find the definition for va_dcl... You have problems..." >&4
13645         val="$undef"; set i_stdarg; eval $setvar
13646         val="$undef"; set i_varargs; eval $setvar
13647         ;;
13648 *) 
13649         set i_varhdr
13650         eval $setvar
13651         case "$i_varhdr" in
13652         stdarg.h)
13653                 val="$define"; set i_stdarg; eval $setvar
13654                 val="$undef"; set i_varargs; eval $setvar
13655                 ;;
13656         varargs.h)
13657                 val="$undef"; set i_stdarg; eval $setvar
13658                 val="$define"; set i_varargs; eval $setvar
13659                 ;;
13660         esac
13661         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
13662 esac
13663 $rm -f varargs*
13664
13665 : see if stddef is available
13666 set stddef.h i_stddef
13667 eval $inhdr
13668
13669 : see if sys/access.h is available
13670 set sys/access.h i_sysaccess
13671 eval $inhdr
13672
13673 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
13674 set sys/filio.h i_sysfilio
13675 eval $inhdr
13676 echo " "
13677 if $test `./findhdr sys/ioctl.h`; then
13678         val="$define"
13679         echo '<sys/ioctl.h> found.' >&4
13680 else
13681         val="$undef"
13682         if $test $i_sysfilio = "$define"; then
13683             echo '<sys/ioctl.h> NOT found.' >&4
13684         else
13685                 $test $i_sgtty = "$define" && xxx="sgtty.h"
13686                 $test $i_termio = "$define" && xxx="termio.h"
13687                 $test $i_termios = "$define" && xxx="termios.h"
13688 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
13689         fi
13690 fi
13691 set i_sysioctl
13692 eval $setvar
13693
13694 : see if sys/resource.h has to be included
13695 set sys/resource.h i_sysresrc
13696 eval $inhdr
13697
13698 : see if sys/security.h is available
13699 set sys/security.h i_syssecrt
13700 eval $inhdr
13701
13702 : see if this is a sys/statvfs.h system
13703 set sys/statvfs.h i_sysstatvfs
13704 eval $inhdr
13705
13706 : see if this is a sys/uio.h system
13707 set sys/uio.h i_sysuio
13708 eval $inhdr
13709
13710 : see if this is a sys/un.h system
13711 set sys/un.h i_sysun
13712 eval $inhdr
13713
13714 : see if this is a syswait system
13715 set sys/wait.h i_syswait
13716 eval $inhdr
13717
13718 : see if this is a ustat.h system
13719 set ustat.h i_ustat
13720 eval $inhdr
13721
13722 : see if this is an utime system
13723 set utime.h i_utime
13724 eval $inhdr
13725
13726 : see if this is a values.h system
13727 set values.h i_values
13728 eval $inhdr
13729
13730 : see if this is a vfork system
13731 case "$d_vfork" in
13732 "$define")
13733         set vfork.h i_vfork
13734         eval $inhdr
13735         ;;
13736 *)
13737         i_vfork="$undef"
13738         ;;
13739 esac
13740
13741 : see if gdbm.h is available
13742 set gdbm.h t_gdbm
13743 eval $inhdr
13744 case "$t_gdbm" in
13745 $define)
13746         : see if gdbm_open exists
13747         set gdbm_open d_gdbm_open
13748         eval $inlibc
13749         case "$d_gdbm_open" in
13750         $undef)
13751                 t_gdbm="$undef"
13752                 echo "We won't be including <gdbm.h>"
13753                 ;;
13754         esac
13755         ;;
13756 esac
13757 val="$t_gdbm"
13758 set i_gdbm
13759 eval $setvar
13760
13761 echo " "
13762 echo "Looking for extensions..." >&4
13763 : If we are using the old config.sh, known_extensions may contain
13764 : old or inaccurate or duplicate values.
13765 known_extensions=''
13766 nonxs_extensions=''
13767 : We do not use find because it might not be available.
13768 : We do not just use MANIFEST because the user may have dropped
13769 : some additional extensions into the source tree and expect them
13770 : to be built.
13771
13772 : Function to recursively find available extensions, ignoring DynaLoader
13773 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
13774 find_extensions='
13775     for xxx in *; do
13776        case "$xxx" in
13777            DynaLoader|dynaload) ;;
13778            *)
13779            if $test -f $xxx/$xxx.xs; then
13780                known_extensions="$known_extensions $1$xxx";
13781            elif $test -f $xxx/Makefile.PL; then
13782                nonxs_extensions="$nonxs_extensions $1$xxx";
13783            else
13784                if $test -d $xxx -a $# -lt 10; then
13785                    set $1$xxx/ $*;
13786                    cd $xxx;
13787                    eval $find_extensions;
13788                    cd ..;
13789                    shift;
13790                fi;
13791            fi
13792            ;;
13793        esac;
13794     done'
13795 tdir=`pwd`
13796 cd $rsrc/ext
13797 set X
13798 shift
13799 eval $find_extensions
13800 set X $nonxs_extensions
13801 shift
13802 nonxs_extensions="$*"
13803 set X $known_extensions
13804 shift
13805 known_extensions="$*"
13806 cd $tdir
13807
13808 : Now see which are supported on this system.
13809 avail_ext=''
13810 for xxx in $known_extensions ; do
13811         case "$xxx" in
13812         DB_File|db_file)
13813                 case "$i_db" in
13814                 $define) avail_ext="$avail_ext $xxx" ;;
13815                 esac
13816                 ;;
13817         GDBM_File|gdbm_fil)
13818                 case "$i_gdbm" in 
13819                 $define) avail_ext="$avail_ext $xxx" ;;
13820                 esac
13821                 ;;
13822         NDBM_File|ndbm_fil)
13823                 case "$i_ndbm" in
13824                 $define) avail_ext="$avail_ext $xxx" ;;
13825                 esac
13826                 ;;
13827         ODBM_File|odbm_fil) 
13828                 case "${i_dbm}${i_rpcsvcdbm}" in
13829                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
13830                 esac
13831                 ;;
13832         POSIX|posix)
13833                 case "$useposix" in
13834                 true|define|y) avail_ext="$avail_ext $xxx" ;;
13835                 esac
13836                 ;;
13837         Opcode|opcode)
13838                 case "$useopcode" in
13839                 true|define|y) avail_ext="$avail_ext $xxx" ;;
13840                 esac
13841                 ;;
13842         Socket|socket)
13843                 case "$d_socket" in 
13844                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
13845                 esac
13846                 ;;
13847         Thread|thread)
13848                 case "$usethreads" in 
13849                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
13850                 esac
13851                 ;;
13852         IPC/SysV|ipc/sysv)
13853                 : XXX Do we need a useipcsysv variable here
13854                 case "${d_msg}${d_sem}${d_shm}" in 
13855                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
13856                 esac
13857                 ;;
13858         *)      avail_ext="$avail_ext $xxx"
13859                 ;;
13860         esac
13861 done
13862
13863 set X $avail_ext
13864 shift
13865 avail_ext="$*"
13866
13867 : Now see which nonxs extensions are supported on this system.
13868 : For now assume all are.
13869 nonxs_ext=''
13870 for xxx in $nonxs_extensions ; do
13871         case "$xxx" in
13872         *)      nonxs_ext="$nonxs_ext $xxx"
13873                 ;;
13874         esac
13875 done
13876
13877 set X $nonxs_ext
13878 shift
13879 nonxs_ext="$*"
13880
13881 case $usedl in
13882 $define)
13883         $cat <<EOM
13884 A number of extensions are supplied with $package.  You may choose to
13885 compile these extensions for dynamic loading (the default), compile
13886 them into the $package executable (static loading), or not include
13887 them at all.  Answer "none" to include no extensions.
13888 Note that DynaLoader is always built and need not be mentioned here.
13889
13890 EOM
13891         case "$dynamic_ext" in
13892         '') dflt="$avail_ext" ;;
13893         *)      dflt="$dynamic_ext"
13894                 # Perhaps we are reusing an old out-of-date config.sh.
13895                 case "$hint" in
13896                 previous)
13897                         if test X"$dynamic_ext" != X"$avail_ext"; then
13898                                 $cat <<EOM
13899 NOTICE:  Your previous config.sh list may be incorrect. 
13900 The extensions now available to you are 
13901         ${avail_ext}
13902 but the default list from your previous config.sh is
13903         ${dynamic_ext} 
13904
13905 EOM
13906                         fi
13907                         ;;
13908                 esac
13909                 ;;
13910         esac
13911         case "$dflt" in
13912         '')     dflt=none;;
13913         esac
13914         rp="What extensions do you wish to load dynamically?"
13915         . ./myread
13916         case "$ans" in
13917         none) dynamic_ext=' ' ;;
13918         *) dynamic_ext="$ans" ;;
13919         esac
13920
13921         case "$static_ext" in
13922         '')
13923                 : Exclude those already listed in dynamic linking
13924                 dflt=''
13925                 for xxx in $avail_ext; do
13926                         case " $dynamic_ext " in
13927                         *" $xxx "*) ;;
13928                         *) dflt="$dflt $xxx" ;;
13929                         esac
13930                 done
13931                 set X $dflt
13932                 shift
13933                 dflt="$*"
13934                 ;;
13935         *)  dflt="$static_ext" 
13936                 ;;
13937         esac
13938
13939         case "$dflt" in
13940         '')     dflt=none;;
13941         esac
13942         rp="What extensions do you wish to load statically?"
13943         . ./myread
13944         case "$ans" in
13945         none) static_ext=' ' ;;
13946         *) static_ext="$ans" ;;
13947         esac
13948         ;;
13949 *)
13950         $cat <<EOM
13951 A number of extensions are supplied with $package.  Answer "none" 
13952 to include no extensions. 
13953 Note that DynaLoader is always built and need not be mentioned here.
13954
13955 EOM
13956         case "$static_ext" in
13957         '') dflt="$avail_ext" ;;
13958         *)      dflt="$static_ext"
13959                 # Perhaps we are reusing an old out-of-date config.sh.
13960                 case "$hint" in
13961                 previous)
13962                         if test X"$static_ext" != X"$avail_ext"; then
13963                                 $cat <<EOM
13964 NOTICE:  Your previous config.sh list may be incorrect. 
13965 The extensions now available to you are 
13966         ${avail_ext}
13967 but the default list from your previous config.sh is
13968         ${static_ext} 
13969
13970 EOM
13971                         fi
13972                         ;;
13973                 esac
13974                 ;;
13975         esac
13976         : Exclude those that are not xs extensions
13977         case "$dflt" in
13978         '')     dflt=none;;
13979         esac
13980         rp="What extensions do you wish to include?"
13981         . ./myread
13982         case "$ans" in
13983         none) static_ext=' ' ;;
13984         *) static_ext="$ans" ;;
13985         esac
13986         ;;
13987 esac
13988
13989 set X $dynamic_ext $static_ext $nonxs_ext
13990 shift
13991 extensions="$*"
13992
13993 : Remove build directory name from cppstdin so it can be used from
13994 : either the present location or the final installed location.
13995 echo " "
13996 : Get out of the UU directory to get correct path name.
13997 cd ..
13998 case "$cppstdin" in
13999 `pwd`/cppstdin)
14000         echo "Stripping down cppstdin path name"
14001         cppstdin=cppstdin
14002         ;;
14003 esac
14004 cd UU
14005
14006 : end of configuration questions
14007 echo " "
14008 echo "End of configuration questions."
14009 echo " "
14010
14011 : back to where it started
14012 if test -d ../UU; then
14013         cd ..
14014 fi
14015
14016 : configuration may be patched via a 'config.over' file
14017 if $test -f config.over; then
14018         echo " "
14019         dflt=y
14020         rp='I see a config.over file.  Do you wish to load it?'
14021         . UU/myread
14022         case "$ans" in
14023         n*) echo "OK, I'll ignore it.";;
14024         *)      . ./config.over
14025                 echo "Configuration override changes have been loaded."
14026                 ;;
14027         esac
14028 fi
14029
14030 : in case they want portability, strip down executable paths
14031 case "$d_portable" in
14032 "$define")
14033         echo " "
14034         echo "Stripping down executable paths..." >&4
14035         for file in $loclist $trylist; do
14036                 eval temp=\$$file
14037                 eval $file=`basename $temp`
14038         done
14039         ;;
14040 esac
14041
14042 : create config.sh file
14043 echo " "
14044 echo "Creating config.sh..." >&4
14045 $spitshell <<EOT >config.sh
14046 $startsh
14047 #
14048 # This file was produced by running the Configure script. It holds all the
14049 # definitions figured out by Configure. Should you modify one of these values,
14050 # do not forget to propagate your changes by running "Configure -der". You may
14051 # instead choose to run each of the .SH files by yourself, or "Configure -S".
14052 #
14053
14054 # Package name      : $package
14055 # Source directory  : $src
14056 # Configuration time: $cf_time
14057 # Configured by     : $cf_by
14058 # Target system     : $myuname
14059
14060 Author='$Author'
14061 Date='$Date'
14062 Header='$Header'
14063 Id='$Id'
14064 Locker='$Locker'
14065 Log='$Log'
14066 Mcc='$Mcc'
14067 RCSfile='$RCSfile'
14068 Revision='$Revision'
14069 Source='$Source'
14070 State='$State'
14071 _a='$_a'
14072 _exe='$_exe'
14073 _o='$_o'
14074 afs='$afs'
14075 alignbytes='$alignbytes'
14076 ansi2knr='$ansi2knr'
14077 aphostname='$aphostname'
14078 apiversion='$apiversion'
14079 ar='$ar'
14080 archlib='$archlib'
14081 archlibexp='$archlibexp'
14082 archname64='$archname64'
14083 archname='$archname'
14084 archobjs='$archobjs'
14085 awk='$awk'
14086 baserev='$baserev'
14087 bash='$bash'
14088 bin='$bin'
14089 bincompat5005='$bincompat5005'
14090 binexp='$binexp'
14091 bison='$bison'
14092 byacc='$byacc'
14093 byteorder='$byteorder'
14094 c='$c'
14095 castflags='$castflags'
14096 cat='$cat'
14097 cc='$cc'
14098 cccdlflags='$cccdlflags'
14099 ccdlflags='$ccdlflags'
14100 ccflags='$ccflags'
14101 ccsymbols='$ccsymbols'
14102 cf_by='$cf_by'
14103 cf_email='$cf_email'
14104 cf_time='$cf_time'
14105 charsize='$charsize'
14106 chgrp='$chgrp'
14107 chmod='$chmod'
14108 chown='$chown'
14109 clocktype='$clocktype'
14110 comm='$comm'
14111 compress='$compress'
14112 contains='$contains'
14113 cp='$cp'
14114 cpio='$cpio'
14115 cpp='$cpp'
14116 cpp_stuff='$cpp_stuff'
14117 cppccsymbols='$cppccsymbols'
14118 cppflags='$cppflags'
14119 cpplast='$cpplast'
14120 cppminus='$cppminus'
14121 cpprun='$cpprun'
14122 cppstdin='$cppstdin'
14123 cppsymbols='$cppsymbols'
14124 crosscompile='$crosscompile'
14125 cryptlib='$cryptlib'
14126 csh='$csh'
14127 d_Gconvert='$d_Gconvert'
14128 d_PRIEldbl='$d_PRIEldbl'
14129 d_PRIFldbl='$d_PRIFldbl'
14130 d_PRIGldbl='$d_PRIGldbl'
14131 d_PRIX64='$d_PRIX64'
14132 d_PRId64='$d_PRId64'
14133 d_PRIeldbl='$d_PRIeldbl'
14134 d_PRIfldbl='$d_PRIfldbl'
14135 d_PRIgldbl='$d_PRIgldbl'
14136 d_PRIi64='$d_PRIi64'
14137 d_PRIo64='$d_PRIo64'
14138 d_PRIu64='$d_PRIu64'
14139 d_PRIx64='$d_PRIx64'
14140 d_access='$d_access'
14141 d_accessx='$d_accessx'
14142 d_alarm='$d_alarm'
14143 d_archlib='$d_archlib'
14144 d_atolf='$d_atolf'
14145 d_atoll='$d_atoll'
14146 d_attribut='$d_attribut'
14147 d_bcmp='$d_bcmp'
14148 d_bcopy='$d_bcopy'
14149 d_bincompat5005='$d_bincompat5005'
14150 d_bsd='$d_bsd'
14151 d_bsdgetpgrp='$d_bsdgetpgrp'
14152 d_bsdsetpgrp='$d_bsdsetpgrp'
14153 d_bzero='$d_bzero'
14154 d_casti32='$d_casti32'
14155 d_castneg='$d_castneg'
14156 d_charvspr='$d_charvspr'
14157 d_chown='$d_chown'
14158 d_chroot='$d_chroot'
14159 d_chsize='$d_chsize'
14160 d_closedir='$d_closedir'
14161 d_const='$d_const'
14162 d_crypt='$d_crypt'
14163 d_csh='$d_csh'
14164 d_cuserid='$d_cuserid'
14165 d_dbl_dig='$d_dbl_dig'
14166 d_difftime='$d_difftime'
14167 d_dirnamlen='$d_dirnamlen'
14168 d_dlerror='$d_dlerror'
14169 d_dlopen='$d_dlopen'
14170 d_dlsymun='$d_dlsymun'
14171 d_dosuid='$d_dosuid'
14172 d_drand48proto='$d_drand48proto'
14173 d_dup2='$d_dup2'
14174 d_eaccess='$d_eaccess'
14175 d_endgrent='$d_endgrent'
14176 d_endhent='$d_endhent'
14177 d_endnent='$d_endnent'
14178 d_endpent='$d_endpent'
14179 d_endpwent='$d_endpwent'
14180 d_endsent='$d_endsent'
14181 d_endspent='$d_endspent'
14182 d_eofnblk='$d_eofnblk'
14183 d_eunice='$d_eunice'
14184 d_fchmod='$d_fchmod'
14185 d_fchown='$d_fchown'
14186 d_fcntl='$d_fcntl'
14187 d_fd_macros='$d_fd_macros'
14188 d_fd_set='$d_fd_set'
14189 d_fds_bits='$d_fds_bits'
14190 d_fgetpos='$d_fgetpos'
14191 d_flexfnam='$d_flexfnam'
14192 d_flock='$d_flock'
14193 d_fork='$d_fork'
14194 d_fpathconf='$d_fpathconf'
14195 d_fpos64_t='$d_fpos64_t'
14196 d_fs_data_s='$d_fs_data_s'
14197 d_fseeko='$d_fseeko'
14198 d_fsetpos='$d_fsetpos'
14199 d_fstatfs='$d_fstatfs'
14200 d_fstatvfs='$d_fstatvfs'
14201 d_ftello='$d_ftello'
14202 d_ftime='$d_ftime'
14203 d_getgrent='$d_getgrent'
14204 d_getgrps='$d_getgrps'
14205 d_gethbyaddr='$d_gethbyaddr'
14206 d_gethbyname='$d_gethbyname'
14207 d_gethent='$d_gethent'
14208 d_gethname='$d_gethname'
14209 d_gethostprotos='$d_gethostprotos'
14210 d_getlogin='$d_getlogin'
14211 d_getmnt='$d_getmnt'
14212 d_getmntent='$d_getmntent'
14213 d_getnbyaddr='$d_getnbyaddr'
14214 d_getnbyname='$d_getnbyname'
14215 d_getnent='$d_getnent'
14216 d_getnetprotos='$d_getnetprotos'
14217 d_getpbyname='$d_getpbyname'
14218 d_getpbynumber='$d_getpbynumber'
14219 d_getpent='$d_getpent'
14220 d_getpgid='$d_getpgid'
14221 d_getpgrp2='$d_getpgrp2'
14222 d_getpgrp='$d_getpgrp'
14223 d_getppid='$d_getppid'
14224 d_getprior='$d_getprior'
14225 d_getprotoprotos='$d_getprotoprotos'
14226 d_getpwent='$d_getpwent'
14227 d_getsbyname='$d_getsbyname'
14228 d_getsbyport='$d_getsbyport'
14229 d_getsent='$d_getsent'
14230 d_getservprotos='$d_getservprotos'
14231 d_getspent='$d_getspent'
14232 d_getspnam='$d_getspnam'
14233 d_gettimeod='$d_gettimeod'
14234 d_gnulibc='$d_gnulibc'
14235 d_grpasswd='$d_grpasswd'
14236 d_hasmntopt='$d_hasmntopt'
14237 d_htonl='$d_htonl'
14238 d_index='$d_index'
14239 d_inetaton='$d_inetaton'
14240 d_int64t='$d_int64t'
14241 d_isascii='$d_isascii'
14242 d_killpg='$d_killpg'
14243 d_lchown='$d_lchown'
14244 d_ldbl_dig='$d_ldbl_dig'
14245 d_link='$d_link'
14246 d_locconv='$d_locconv'
14247 d_lockf='$d_lockf'
14248 d_longdbl='$d_longdbl'
14249 d_longlong='$d_longlong'
14250 d_lstat='$d_lstat'
14251 d_mblen='$d_mblen'
14252 d_mbstowcs='$d_mbstowcs'
14253 d_mbtowc='$d_mbtowc'
14254 d_memchr='$d_memchr'
14255 d_memcmp='$d_memcmp'
14256 d_memcpy='$d_memcpy'
14257 d_memmove='$d_memmove'
14258 d_memset='$d_memset'
14259 d_mkdir='$d_mkdir'
14260 d_mkfifo='$d_mkfifo'
14261 d_mktime='$d_mktime'
14262 d_msg='$d_msg'
14263 d_msg_ctrunc='$d_msg_ctrunc'
14264 d_msg_dontroute='$d_msg_dontroute'
14265 d_msg_oob='$d_msg_oob'
14266 d_msg_peek='$d_msg_peek'
14267 d_msg_proxy='$d_msg_proxy'
14268 d_msgctl='$d_msgctl'
14269 d_msgget='$d_msgget'
14270 d_msgrcv='$d_msgrcv'
14271 d_msgsnd='$d_msgsnd'
14272 d_mymalloc='$d_mymalloc'
14273 d_nice='$d_nice'
14274 d_off64_t='$d_off64_t'
14275 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
14276 d_oldpthreads='$d_oldpthreads'
14277 d_oldsock='$d_oldsock'
14278 d_open3='$d_open3'
14279 d_pathconf='$d_pathconf'
14280 d_pause='$d_pause'
14281 d_phostname='$d_phostname'
14282 d_pipe='$d_pipe'
14283 d_poll='$d_poll'
14284 d_portable='$d_portable'
14285 d_pthread_yield='$d_pthread_yield'
14286 d_pwage='$d_pwage'
14287 d_pwchange='$d_pwchange'
14288 d_pwclass='$d_pwclass'
14289 d_pwcomment='$d_pwcomment'
14290 d_pwexpire='$d_pwexpire'
14291 d_pwgecos='$d_pwgecos'
14292 d_pwpasswd='$d_pwpasswd'
14293 d_pwquota='$d_pwquota'
14294 d_quad='$d_quad'
14295 d_readdir='$d_readdir'
14296 d_readlink='$d_readlink'
14297 d_rename='$d_rename'
14298 d_rewinddir='$d_rewinddir'
14299 d_rmdir='$d_rmdir'
14300 d_safebcpy='$d_safebcpy'
14301 d_safemcpy='$d_safemcpy'
14302 d_sanemcmp='$d_sanemcmp'
14303 d_sched_yield='$d_sched_yield'
14304 d_scm_rights='$d_scm_rights'
14305 d_seekdir='$d_seekdir'
14306 d_select='$d_select'
14307 d_sem='$d_sem'
14308 d_semctl='$d_semctl'
14309 d_semctl_semid_ds='$d_semctl_semid_ds'
14310 d_semctl_semun='$d_semctl_semun'
14311 d_semget='$d_semget'
14312 d_semop='$d_semop'
14313 d_setegid='$d_setegid'
14314 d_seteuid='$d_seteuid'
14315 d_setgrent='$d_setgrent'
14316 d_setgrps='$d_setgrps'
14317 d_sethent='$d_sethent'
14318 d_setlinebuf='$d_setlinebuf'
14319 d_setlocale='$d_setlocale'
14320 d_setnent='$d_setnent'
14321 d_setpent='$d_setpent'
14322 d_setpgid='$d_setpgid'
14323 d_setpgrp2='$d_setpgrp2'
14324 d_setpgrp='$d_setpgrp'
14325 d_setprior='$d_setprior'
14326 d_setpwent='$d_setpwent'
14327 d_setregid='$d_setregid'
14328 d_setresgid='$d_setresgid'
14329 d_setresuid='$d_setresuid'
14330 d_setreuid='$d_setreuid'
14331 d_setrgid='$d_setrgid'
14332 d_setruid='$d_setruid'
14333 d_setsent='$d_setsent'
14334 d_setsid='$d_setsid'
14335 d_setspent='$d_setspent'
14336 d_setvbuf='$d_setvbuf'
14337 d_sfio='$d_sfio'
14338 d_shm='$d_shm'
14339 d_shmat='$d_shmat'
14340 d_shmatprototype='$d_shmatprototype'
14341 d_shmctl='$d_shmctl'
14342 d_shmdt='$d_shmdt'
14343 d_shmget='$d_shmget'
14344 d_sigaction='$d_sigaction'
14345 d_sigsetjmp='$d_sigsetjmp'
14346 d_socket='$d_socket'
14347 d_sockpair='$d_sockpair'
14348 d_sqrtl='$d_sqrtl'
14349 d_statblks='$d_statblks'
14350 d_statfs_f_flags='$d_statfs_f_flags'
14351 d_statfs_s='$d_statfs_s'
14352 d_statvfs='$d_statvfs'
14353 d_stdio_cnt_lval='$d_stdio_cnt_lval'
14354 d_stdio_ptr_lval='$d_stdio_ptr_lval'
14355 d_stdio_stream_array='$d_stdio_stream_array'
14356 d_stdiobase='$d_stdiobase'
14357 d_stdstdio='$d_stdstdio'
14358 d_strchr='$d_strchr'
14359 d_strcoll='$d_strcoll'
14360 d_strctcpy='$d_strctcpy'
14361 d_strerrm='$d_strerrm'
14362 d_strerror='$d_strerror'
14363 d_strtod='$d_strtod'
14364 d_strtol='$d_strtol'
14365 d_strtoul='$d_strtoul'
14366 d_strtoull='$d_strtoull'
14367 d_strxfrm='$d_strxfrm'
14368 d_suidsafe='$d_suidsafe'
14369 d_symlink='$d_symlink'
14370 d_syscall='$d_syscall'
14371 d_sysconf='$d_sysconf'
14372 d_sysernlst='$d_sysernlst'
14373 d_syserrlst='$d_syserrlst'
14374 d_system='$d_system'
14375 d_tcgetpgrp='$d_tcgetpgrp'
14376 d_tcsetpgrp='$d_tcsetpgrp'
14377 d_telldir='$d_telldir'
14378 d_telldirproto='$d_telldirproto'
14379 d_time='$d_time'
14380 d_times='$d_times'
14381 d_truncate='$d_truncate'
14382 d_tzname='$d_tzname'
14383 d_umask='$d_umask'
14384 d_uname='$d_uname'
14385 d_union_semun='$d_union_semun'
14386 d_ustat='$d_ustat'
14387 d_vendorbin='$d_vendorbin'
14388 d_vendorlib='$d_vendorlib'
14389 d_vfork='$d_vfork'
14390 d_void_closedir='$d_void_closedir'
14391 d_voidsig='$d_voidsig'
14392 d_voidtty='$d_voidtty'
14393 d_volatile='$d_volatile'
14394 d_vprintf='$d_vprintf'
14395 d_wait4='$d_wait4'
14396 d_waitpid='$d_waitpid'
14397 d_wcstombs='$d_wcstombs'
14398 d_wctomb='$d_wctomb'
14399 d_xenix='$d_xenix'
14400 date='$date'
14401 db_hashtype='$db_hashtype'
14402 db_prefixtype='$db_prefixtype'
14403 defvoidused='$defvoidused'
14404 direntrytype='$direntrytype'
14405 dlext='$dlext'
14406 dlsrc='$dlsrc'
14407 doublesize='$doublesize'
14408 drand01='$drand01'
14409 dynamic_ext='$dynamic_ext'
14410 eagain='$eagain'
14411 ebcdic='$ebcdic'
14412 echo='$echo'
14413 egrep='$egrep'
14414 emacs='$emacs'
14415 eunicefix='$eunicefix'
14416 exe_ext='$exe_ext'
14417 expr='$expr'
14418 extensions='$extensions'
14419 fflushNULL='$fflushNULL'
14420 fflushall='$fflushall'
14421 find='$find'
14422 firstmakefile='$firstmakefile'
14423 flex='$flex'
14424 fpossize='$fpossize'
14425 fpostype='$fpostype'
14426 freetype='$freetype'
14427 full_ar='$full_ar'
14428 full_csh='$full_csh'
14429 full_sed='$full_sed'
14430 gccversion='$gccversion'
14431 gidformat='$gidformat'
14432 gidsign='$gidsign'
14433 gidsize='$gidsize'
14434 gidtype='$gidtype'
14435 glibpth='$glibpth'
14436 grep='$grep'
14437 groupcat='$groupcat'
14438 groupstype='$groupstype'
14439 gzip='$gzip'
14440 h_fcntl='$h_fcntl'
14441 h_sysfile='$h_sysfile'
14442 hint='$hint'
14443 hostcat='$hostcat'
14444 huge='$huge'
14445 i16size='$i16size'
14446 i16type='$i16type'
14447 i32size='$i32size'
14448 i32type='$i32type'
14449 i64size='$i64size'
14450 i64type='$i64type'
14451 i8size='$i8size'
14452 i8type='$i8type'
14453 i_arpainet='$i_arpainet'
14454 i_bsdioctl='$i_bsdioctl'
14455 i_db='$i_db'
14456 i_dbm='$i_dbm'
14457 i_dirent='$i_dirent'
14458 i_dld='$i_dld'
14459 i_dlfcn='$i_dlfcn'
14460 i_fcntl='$i_fcntl'
14461 i_float='$i_float'
14462 i_gdbm='$i_gdbm'
14463 i_grp='$i_grp'
14464 i_inttypes='$i_inttypes'
14465 i_limits='$i_limits'
14466 i_locale='$i_locale'
14467 i_machcthr='$i_machcthr'
14468 i_malloc='$i_malloc'
14469 i_math='$i_math'
14470 i_memory='$i_memory'
14471 i_mntent='$i_mntent'
14472 i_ndbm='$i_ndbm'
14473 i_netdb='$i_netdb'
14474 i_neterrno='$i_neterrno'
14475 i_netinettcp='$i_netinettcp'
14476 i_niin='$i_niin'
14477 i_poll='$i_poll'
14478 i_pthread='$i_pthread'
14479 i_pwd='$i_pwd'
14480 i_rpcsvcdbm='$i_rpcsvcdbm'
14481 i_sfio='$i_sfio'
14482 i_sgtty='$i_sgtty'
14483 i_shadow='$i_shadow'
14484 i_socks='$i_socks'
14485 i_stdarg='$i_stdarg'
14486 i_stddef='$i_stddef'
14487 i_stdlib='$i_stdlib'
14488 i_string='$i_string'
14489 i_sysaccess='$i_sysaccess'
14490 i_sysdir='$i_sysdir'
14491 i_sysfile='$i_sysfile'
14492 i_sysfilio='$i_sysfilio'
14493 i_sysin='$i_sysin'
14494 i_sysioctl='$i_sysioctl'
14495 i_sysmount='$i_sysmount'
14496 i_sysndir='$i_sysndir'
14497 i_sysparam='$i_sysparam'
14498 i_sysresrc='$i_sysresrc'
14499 i_syssecrt='$i_syssecrt'
14500 i_sysselct='$i_sysselct'
14501 i_syssockio='$i_syssockio'
14502 i_sysstat='$i_sysstat'
14503 i_sysstatfs='$i_sysstatfs'
14504 i_sysstatvfs='$i_sysstatvfs'
14505 i_systime='$i_systime'
14506 i_systimek='$i_systimek'
14507 i_systimes='$i_systimes'
14508 i_systypes='$i_systypes'
14509 i_sysuio='$i_sysuio'
14510 i_sysun='$i_sysun'
14511 i_sysvfs='$i_sysvfs'
14512 i_syswait='$i_syswait'
14513 i_termio='$i_termio'
14514 i_termios='$i_termios'
14515 i_time='$i_time'
14516 i_unistd='$i_unistd'
14517 i_ustat='$i_ustat'
14518 i_utime='$i_utime'
14519 i_values='$i_values'
14520 i_varargs='$i_varargs'
14521 i_varhdr='$i_varhdr'
14522 i_vfork='$i_vfork'
14523 ignore_versioned_solibs='$ignore_versioned_solibs'
14524 incpath='$incpath'
14525 inews='$inews'
14526 installarchlib='$installarchlib'
14527 installbin='$installbin'
14528 installman1dir='$installman1dir'
14529 installman3dir='$installman3dir'
14530 installprefix='$installprefix'
14531 installprefixexp='$installprefixexp'
14532 installprivlib='$installprivlib'
14533 installscript='$installscript'
14534 installsitearch='$installsitearch'
14535 installsitebin='$installsitebin'
14536 installsitelib='$installsitelib'
14537 installstyle='$installstyle'
14538 installusrbinperl='$installusrbinperl'
14539 installvendorbin='$installvendorbin'
14540 installvendorlib='$installvendorlib'
14541 intsize='$intsize'
14542 ivdformat='$ivdformat'
14543 ivsize='$ivsize'
14544 ivtype='$ivtype'
14545 known_extensions='$known_extensions'
14546 ksh='$ksh'
14547 large='$large'
14548 ld='$ld'
14549 lddlflags='$lddlflags'
14550 ldflags='$ldflags'
14551 ldlibpthname='$ldlibpthname'
14552 less='$less'
14553 lib_ext='$lib_ext'
14554 libc='$libc'
14555 libperl='$libperl'
14556 libpth='$libpth'
14557 libs='$libs'
14558 libswanted='$libswanted'
14559 line='$line'
14560 lint='$lint'
14561 lkflags='$lkflags'
14562 ln='$ln'
14563 lns='$lns'
14564 locincpth='$locincpth'
14565 loclibpth='$loclibpth'
14566 longdblsize='$longdblsize'
14567 longlongsize='$longlongsize'
14568 longsize='$longsize'
14569 lp='$lp'
14570 lpr='$lpr'
14571 ls='$ls'
14572 lseeksize='$lseeksize'
14573 lseektype='$lseektype'
14574 mail='$mail'
14575 mailx='$mailx'
14576 make='$make'
14577 make_set_make='$make_set_make'
14578 mallocobj='$mallocobj'
14579 mallocsrc='$mallocsrc'
14580 malloctype='$malloctype'
14581 man1dir='$man1dir'
14582 man1direxp='$man1direxp'
14583 man1ext='$man1ext'
14584 man3dir='$man3dir'
14585 man3direxp='$man3direxp'
14586 man3ext='$man3ext'
14587 medium='$medium'
14588 mips_type='$mips_type'
14589 mkdir='$mkdir'
14590 models='$models'
14591 modetype='$modetype'
14592 more='$more'
14593 multiarch='$multiarch'
14594 mv='$mv'
14595 myarchname='$myarchname'
14596 mydomain='$mydomain'
14597 myhostname='$myhostname'
14598 myuname='$myuname'
14599 n='$n'
14600 netdb_hlen_type='$netdb_hlen_type'
14601 netdb_host_type='$netdb_host_type'
14602 netdb_name_type='$netdb_name_type'
14603 netdb_net_type='$netdb_net_type'
14604 nm='$nm'
14605 nm_opt='$nm_opt'
14606 nm_so_opt='$nm_so_opt'
14607 nonxs_ext='$nonxs_ext'
14608 nroff='$nroff'
14609 nvsize='$nvsize'
14610 nvtype='$nvtype'
14611 o_nonblock='$o_nonblock'
14612 obj_ext='$obj_ext'
14613 old_pthread_create_joinable='$old_pthread_create_joinable'
14614 optimize='$optimize'
14615 orderlib='$orderlib'
14616 osname='$osname'
14617 osvers='$osvers'
14618 package='$package'
14619 pager='$pager'
14620 passcat='$passcat'
14621 patchlevel='$patchlevel'
14622 path_sep='$path_sep'
14623 perl='$perl'
14624 perladmin='$perladmin'
14625 perlpath='$perlpath'
14626 pg='$pg'
14627 phostname='$phostname'
14628 pidtype='$pidtype'
14629 plibpth='$plibpth'
14630 pm_apiversion='$pm_apiversion'
14631 pmake='$pmake'
14632 pr='$pr'
14633 prefix='$prefix'
14634 prefixexp='$prefixexp'
14635 privlib='$privlib'
14636 privlibexp='$privlibexp'
14637 prototype='$prototype'
14638 ptrsize='$ptrsize'
14639 quadkind='$quadkind'
14640 quadtype='$quadtype'
14641 randbits='$randbits'
14642 randfunc='$randfunc'
14643 randseedtype='$randseedtype'
14644 ranlib='$ranlib'
14645 rd_nodata='$rd_nodata'
14646 rm='$rm'
14647 rmail='$rmail'
14648 runnm='$runnm'
14649 sPRIEldbl='$sPRIEldbl'
14650 sPRIFldbl='$sPRIFldbl'
14651 sPRIGldbl='$sPRIGldbl'
14652 sPRIX64='$sPRIX64'
14653 sPRId64='$sPRId64'
14654 sPRIeldbl='$sPRIeldbl'
14655 sPRIfldbl='$sPRIfldbl'
14656 sPRIgldbl='$sPRIgldbl'
14657 sPRIi64='$sPRIi64'
14658 sPRIo64='$sPRIo64'
14659 sPRIu64='$sPRIu64'
14660 sPRIx64='$sPRIx64'
14661 sched_yield='$sched_yield'
14662 scriptdir='$scriptdir'
14663 scriptdirexp='$scriptdirexp'
14664 sed='$sed'
14665 seedfunc='$seedfunc'
14666 selectminbits='$selectminbits'
14667 selecttype='$selecttype'
14668 sendmail='$sendmail'
14669 sh='$sh'
14670 shar='$shar'
14671 sharpbang='$sharpbang'
14672 shmattype='$shmattype'
14673 shortsize='$shortsize'
14674 shrpenv='$shrpenv'
14675 shsharp='$shsharp'
14676 sig_count='$sig_count'
14677 sig_name='$sig_name'
14678 sig_name_init='$sig_name_init'
14679 sig_num='$sig_num'
14680 sig_num_init='$sig_num_init'
14681 signal_t='$signal_t'
14682 sitearch='$sitearch'
14683 sitearchexp='$sitearchexp'
14684 sitebin='$sitebin'
14685 sitebinexp='$sitebinexp'
14686 sitelib='$sitelib'
14687 sitelibexp='$sitelibexp'
14688 siteprefix='$siteprefix'
14689 siteprefixexp='$siteprefixexp'
14690 sizetype='$sizetype'
14691 sleep='$sleep'
14692 smail='$smail'
14693 small='$small'
14694 so='$so'
14695 sockethdr='$sockethdr'
14696 socketlib='$socketlib'
14697 sort='$sort'
14698 spackage='$spackage'
14699 spitshell='$spitshell'
14700 split='$split'
14701 src='$src'
14702 ssizetype='$ssizetype'
14703 startperl='$startperl'
14704 startsh='$startsh'
14705 static_ext='$static_ext'
14706 stdchar='$stdchar'
14707 stdio_base='$stdio_base'
14708 stdio_bufsiz='$stdio_bufsiz'
14709 stdio_cnt='$stdio_cnt'
14710 stdio_filbuf='$stdio_filbuf'
14711 stdio_ptr='$stdio_ptr'
14712 stdio_stream_array='$stdio_stream_array'
14713 strings='$strings'
14714 submit='$submit'
14715 subversion='$subversion'
14716 sysman='$sysman'
14717 tail='$tail'
14718 tar='$tar'
14719 tbl='$tbl'
14720 tee='$tee'
14721 test='$test'
14722 timeincl='$timeincl'
14723 timetype='$timetype'
14724 touch='$touch'
14725 tr='$tr'
14726 trnl='$trnl'
14727 troff='$troff'
14728 u16size='$u16size'
14729 u16type='$u16type'
14730 u32size='$u32size'
14731 u32type='$u32type'
14732 u64size='$u64size'
14733 u64type='$u64type'
14734 u8size='$u8size'
14735 u8type='$u8type'
14736 uidformat='$uidformat'
14737 uidsign='$uidsign'
14738 uidsize='$uidsize'
14739 uidtype='$uidtype'
14740 uname='$uname'
14741 uniq='$uniq'
14742 uquadtype='$uquadtype'
14743 use64bits='$use64bits'
14744 usedl='$usedl'
14745 uselargefiles='$uselargefiles'
14746 uselongdouble='$uselongdouble'
14747 uselonglong='$uselonglong'
14748 usemorebits='$usemorebits'
14749 usemultiplicity='$usemultiplicity'
14750 usemymalloc='$usemymalloc'
14751 usenm='$usenm'
14752 useopcode='$useopcode'
14753 useperlio='$useperlio'
14754 useposix='$useposix'
14755 usesfio='$usesfio'
14756 useshrplib='$useshrplib'
14757 usesocks='$usesocks'
14758 usethreads='$usethreads'
14759 usevendorprefix='$usevendorprefix'
14760 usevfork='$usevfork'
14761 usrinc='$usrinc'
14762 uuname='$uuname'
14763 uvoformat='$uvoformat'
14764 uvsize='$uvsize'
14765 uvtype='$uvtype'
14766 uvuformat='$uvuformat'
14767 uvxformat='$uvxformat'
14768 vendorbin='$vendorbin'
14769 vendorbinexp='$vendorbinexp'
14770 vendorlib='$vendorlib'
14771 vendorlibexp='$vendorlibexp'
14772 vendorprefix='$vendorprefix'
14773 vendorprefixexp='$vendorprefixexp'
14774 version='$version'
14775 vi='$vi'
14776 voidflags='$voidflags'
14777 xlibpth='$xlibpth'
14778 xs_apiversion='$xs_apiversion'
14779 zcat='$zcat'
14780 zip='$zip'
14781 EOT
14782
14783 : Add in command line options if available
14784 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
14785
14786 : add special variables
14787 $test -f $src/patchlevel.h && \
14788 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
14789 echo "CONFIGDOTSH=true" >>config.sh
14790
14791 : propagate old symbols
14792 if $test -f UU/config.sh; then
14793         <UU/config.sh sort | uniq >UU/oldconfig.sh
14794         sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
14795         sort | uniq -u >UU/oldsyms
14796         set X `cat UU/oldsyms`
14797         shift
14798         case $# in
14799         0) ;;
14800         *)
14801                 cat <<EOM
14802 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
14803 EOM
14804                 echo "# Variables propagated from previous config.sh file." >>config.sh
14805                 for sym in `cat UU/oldsyms`; do
14806                         echo "    Propagating $hint variable "'$'"$sym..."
14807                         eval 'tmp="$'"${sym}"'"'
14808                         echo "$tmp" | \
14809                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
14810                 done
14811                 ;;
14812         esac
14813 fi
14814
14815 : Finish up by extracting the .SH files
14816 case "$alldone" in
14817 exit)
14818         $rm -rf UU
14819         echo "Done."
14820         exit 0
14821         ;;
14822 cont)
14823         ;;
14824 '')
14825         dflt=''
14826         nostick=true
14827         $cat <<EOM
14828
14829 If you'd like to make any changes to the config.sh file before I begin
14830 to configure things, do it as a shell escape now (e.g. !vi config.sh).
14831
14832 EOM
14833         rp="Press return or use a shell escape to edit config.sh:"
14834         . UU/myread
14835         nostick=''
14836         case "$ans" in
14837         '') ;;
14838         *) : in case they cannot read
14839                 sh 1>&4 -c "$ans";;
14840         esac
14841         ;;
14842 esac
14843
14844 : if this fails, just run all the .SH files by hand
14845 . ./config.sh
14846
14847 echo " "
14848 exec 1>&4
14849 . ./UU/extract
14850
14851 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
14852         dflt=y
14853         case "$silent" in
14854         true) ;;
14855         *)
14856                 $cat <<EOM
14857
14858 Now you need to generate make dependencies by running "$make depend".
14859 You might prefer to run it in background: "$make depend > makedepend.out &"
14860 It can take a while, so you might not want to run it right now.
14861
14862 EOM
14863                 ;;
14864         esac
14865         rp="Run $make depend now?"
14866         . UU/myread
14867         case "$ans" in
14868         y*)
14869                 $make depend && echo "Now you must run a $make."
14870                 ;;
14871         *)
14872                 echo "You must run '$make depend' then '$make'."
14873                 ;;
14874         esac
14875 elif test -f [Mm]akefile; then
14876         echo " "
14877         echo "Now you must run a $make."
14878 else
14879         echo "Done."
14880 fi
14881
14882 if $test -f Policy.sh; then
14883     $cat <<EOM
14884
14885 If you compile $package on a different machine or from a different object
14886 directory, copy the Policy.sh file from this object directory to the
14887 new one before you run Configure -- this will help you with most of
14888 the policy defaults.
14889
14890 EOM
14891 fi
14892 if $test -f config.msg; then
14893     echo "Hmm.  I also noted the following information while running:"
14894     echo " "
14895     $cat config.msg >&4
14896     $rm -f config.msg
14897 fi
14898 $rm -f kit*isdone ark*isdone
14899 $rm -rf UU
14900
14901 : End of Configure
14902