8324d422c16b87ba31d73ee23b70099345993be4
[p5sagit/p5-mst-13.2.git] / Configure
1 #! /bin/sh
2 #
3 # If these # comments don't work, trim them. Don't worry about any other
4 # shell scripts, Configure will trim # comments from them for you.
5 #
6 # (If you are trying to port this package to a machine without sh,
7 # I would suggest you have a look at the prototypical config_h.SH file
8 # and edit it to reflect your system. Some packages may include samples
9 # of config.h for certain machines, so you might look for one of those.)
10 #
11 # Yes, you may rip this off to use in other distribution packages. This
12 # script belongs to the public domain and cannot be copyrighted.
13 #
14 # (Note: this Configure script was generated automatically. Rather than
15 # working with this copy of Configure, you may wish to get metaconfig.
16 # The dist-3.0 package (which contains metaconfig) was posted in
17 # comp.sources.misc and is available on CPAN under authors/id/RAM so
18 # you may fetch it yourself from your nearest archive site.)
19 #
20
21 # $Id: Head.U,v 3.0.1.9 1997/02/28 15:02:09 ram Exp $
22 #
23 # Generated on Fri Sep  8 23:42:12 EET DST 2000 [metaconfig 3.0 PL70]
24 # (with additional metaconfig patches by perlbug@perl.org)
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 ccname=''
164 ccversion=''
165 ccsymbols=''
166 cppccsymbols=''
167 cppsymbols=''
168 dynamic_ext=''
169 extensions=''
170 known_extensions=''
171 nonxs_ext=''
172 static_ext=''
173 useopcode=''
174 useposix=''
175 d_bsd=''
176 d_eunice=''
177 d_xenix=''
178 eunicefix=''
179 Mcc=''
180 ar=''
181 awk=''
182 bash=''
183 bison=''
184 byacc=''
185 cat=''
186 chgrp=''
187 chmod=''
188 chown=''
189 comm=''
190 compress=''
191 cp=''
192 cpio=''
193 cpp=''
194 csh=''
195 date=''
196 echo=''
197 egrep=''
198 emacs=''
199 expr=''
200 find=''
201 flex=''
202 grep=''
203 gzip=''
204 inews=''
205 ksh=''
206 less=''
207 line=''
208 lint=''
209 ln=''
210 lp=''
211 lpr=''
212 ls=''
213 mail=''
214 mailx=''
215 make=''
216 mkdir=''
217 more=''
218 mv=''
219 nm=''
220 nroff=''
221 perl=''
222 pg=''
223 pmake=''
224 pr=''
225 rm=''
226 rmail=''
227 sed=''
228 sendmail=''
229 shar=''
230 sleep=''
231 smail=''
232 sort=''
233 submit=''
234 tail=''
235 tar=''
236 tbl=''
237 tee=''
238 test=''
239 touch=''
240 tr=''
241 troff=''
242 uname=''
243 uniq=''
244 uuname=''
245 vi=''
246 zcat=''
247 zip=''
248 full_ar=''
249 full_sed=''
250 libswanted=''
251 hint=''
252 myuname=''
253 osname=''
254 osvers=''
255 Author=''
256 Date=''
257 Header=''
258 Id=''
259 Locker=''
260 Log=''
261 RCSfile=''
262 Revision=''
263 Source=''
264 State=''
265 _a=''
266 _exe=''
267 _o=''
268 archobjs=''
269 exe_ext=''
270 firstmakefile=''
271 lib_ext=''
272 obj_ext=''
273 path_sep=''
274 afs=''
275 alignbytes=''
276 ansi2knr=''
277 archlib=''
278 archlibexp=''
279 d_archlib=''
280 installarchlib=''
281 archname=''
282 myarchname=''
283 d_atolf=''
284 d_atoll=''
285 baserev=''
286 bin=''
287 binexp=''
288 installbin=''
289 bincompat5005=''
290 d_bincompat5005=''
291 byteorder=''
292 cc=''
293 ccflags=''
294 cppflags=''
295 ldflags=''
296 lkflags=''
297 locincpth=''
298 optimize=''
299 cf_email=''
300 cf_by=''
301 cf_time=''
302 charsize=''
303 contains=''
304 cpp_stuff=''
305 cpplast=''
306 cppminus=''
307 cpprun=''
308 cppstdin=''
309 crosscompile=''
310 d_access=''
311 d_accessx=''
312 d_alarm=''
313 d_attribut=''
314 d_bcmp=''
315 d_bcopy=''
316 d_bzero=''
317 d_casti32=''
318 castflags=''
319 d_castneg=''
320 d_chown=''
321 d_chroot=''
322 d_chsize=''
323 d_closedir=''
324 d_void_closedir=''
325 d_const=''
326 cryptlib=''
327 d_crypt=''
328 d_csh=''
329 full_csh=''
330 d_cuserid=''
331 d_dbl_dig=''
332 d_difftime=''
333 d_dlerror=''
334 d_dlopen=''
335 d_dlsymun=''
336 d_dosuid=''
337 d_suidsafe=''
338 d_drand48proto=''
339 d_dup2=''
340 d_eaccess=''
341 d_endgrent=''
342 d_endhent=''
343 d_endnent=''
344 d_endpent=''
345 d_endpwent=''
346 d_endsent=''
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_fpos64_t=''
358 d_frexpl=''
359 d_fs_data_s=''
360 d_fseeko=''
361 d_fsetpos=''
362 d_fstatfs=''
363 d_ftello=''
364 d_ftime=''
365 d_gettimeod=''
366 d_Gconvert=''
367 d_getcwd=''
368 d_getespwnam=''
369 d_getfsstat=''
370 d_getgrent=''
371 d_getgrps=''
372 d_gethbyaddr=''
373 d_gethbyname=''
374 d_gethent=''
375 aphostname=''
376 d_gethname=''
377 d_phostname=''
378 d_uname=''
379 d_gethostprotos=''
380 d_getlogin=''
381 d_getmnt=''
382 d_getmntent=''
383 d_getnbyaddr=''
384 d_getnbyname=''
385 d_getnent=''
386 d_getnetprotos=''
387 d_getpent=''
388 d_getpgid=''
389 d_getpgrp2=''
390 d_bsdgetpgrp=''
391 d_getpgrp=''
392 d_getppid=''
393 d_getprior=''
394 d_getpbyname=''
395 d_getpbynumber=''
396 d_getprotoprotos=''
397 d_getprpwnam=''
398 d_getpwent=''
399 d_getsent=''
400 d_getservprotos=''
401 d_getspnam=''
402 d_getsbyname=''
403 d_getsbyport=''
404 d_gnulibc=''
405 d_hasmntopt=''
406 d_htonl=''
407 d_iconv=''
408 d_inetaton=''
409 d_int64_t=''
410 d_isascii=''
411 d_isnan=''
412 d_isnanl=''
413 d_killpg=''
414 d_lchown=''
415 d_ldbl_dig=''
416 d_link=''
417 d_locconv=''
418 d_lockf=''
419 d_longdbl=''
420 longdblsize=''
421 d_longlong=''
422 longlongsize=''
423 d_lseekproto=''
424 d_lstat=''
425 d_madvise=''
426 d_mblen=''
427 d_mbstowcs=''
428 d_mbtowc=''
429 d_memchr=''
430 d_memcmp=''
431 d_memcpy=''
432 d_memmove=''
433 d_memset=''
434 d_mkdir=''
435 d_mkdtemp=''
436 d_mkfifo=''
437 d_mkstemp=''
438 d_mkstemps=''
439 d_mktime=''
440 d_mmap=''
441 mmaptype=''
442 d_modfl=''
443 d_mprotect=''
444 d_msg=''
445 d_msgctl=''
446 d_msgget=''
447 d_msgrcv=''
448 d_msgsnd=''
449 d_msync=''
450 d_munmap=''
451 d_nice=''
452 d_off64_t=''
453 d_open3=''
454 d_fpathconf=''
455 d_pathconf=''
456 d_pause=''
457 d_pipe=''
458 d_poll=''
459 d_portable=''
460 d_old_pthread_create_joinable=''
461 old_pthread_create_joinable=''
462 d_pthread_yield=''
463 d_sched_yield=''
464 sched_yield=''
465 d_qgcvt=''
466 d_readdir=''
467 d_rewinddir=''
468 d_seekdir=''
469 d_telldir=''
470 d_readlink=''
471 d_rename=''
472 d_rmdir=''
473 d_safebcpy=''
474 d_safemcpy=''
475 d_sanemcmp=''
476 d_select=''
477 d_sem=''
478 d_semctl=''
479 d_semget=''
480 d_semop=''
481 d_setegid=''
482 d_seteuid=''
483 d_setgrent=''
484 d_setgrps=''
485 d_sethent=''
486 d_setlinebuf=''
487 d_setlocale=''
488 d_setnent=''
489 d_setpent=''
490 d_setpgid=''
491 d_setpgrp2=''
492 d_bsdsetpgrp=''
493 d_setpgrp=''
494 d_setprior=''
495 d_setproctitle=''
496 d_setpwent=''
497 d_setregid=''
498 d_setresgid=''
499 d_setresuid=''
500 d_setreuid=''
501 d_setrgid=''
502 d_setruid=''
503 d_setsent=''
504 d_setsid=''
505 d_setvbuf=''
506 d_sfio=''
507 usesfio=''
508 d_shm=''
509 d_shmat=''
510 d_shmatprototype=''
511 shmattype=''
512 d_shmctl=''
513 d_shmdt=''
514 d_shmget=''
515 d_sigaction=''
516 d_sigsetjmp=''
517 d_msg_ctrunc=''
518 d_msg_dontroute=''
519 d_msg_oob=''
520 d_msg_peek=''
521 d_msg_proxy=''
522 d_oldsock=''
523 d_scm_rights=''
524 d_socket=''
525 d_sockpair=''
526 sockethdr=''
527 socketlib=''
528 d_socklen_t=''
529 d_socks5_init=''
530 d_sqrtl=''
531 d_statblks=''
532 d_statfs_f_flags=''
533 d_statfs_s=''
534 d_fstatvfs=''
535 d_statvfs=''
536 d_stdio_cnt_lval=''
537 d_stdio_ptr_lval=''
538 d_stdiobase=''
539 d_stdstdio=''
540 stdio_base=''
541 stdio_bufsiz=''
542 stdio_cnt=''
543 stdio_filbuf=''
544 stdio_ptr=''
545 d_index=''
546 d_strchr=''
547 d_strcoll=''
548 d_strctcpy=''
549 d_strerrm=''
550 d_strerror=''
551 d_sysernlst=''
552 d_syserrlst=''
553 d_strtod=''
554 d_strtol=''
555 d_strtold=''
556 d_strtoll=''
557 d_strtoul=''
558 d_strtoull=''
559 d_strtouq=''
560 d_strxfrm=''
561 d_symlink=''
562 d_syscall=''
563 d_sysconf=''
564 d_system=''
565 d_tcgetpgrp=''
566 d_tcsetpgrp=''
567 d_telldirproto=''
568 d_time=''
569 timetype=''
570 clocktype=''
571 d_times=''
572 d_truncate=''
573 d_tzname=''
574 d_umask=''
575 d_semctl_semid_ds=''
576 d_semctl_semun=''
577 d_union_semun=''
578 d_ustat=''
579 d_vfork=''
580 usevfork=''
581 d_voidsig=''
582 signal_t=''
583 d_volatile=''
584 d_charvspr=''
585 d_vprintf=''
586 d_wait4=''
587 d_waitpid=''
588 d_wcstombs=''
589 d_wctomb=''
590 dlext=''
591 cccdlflags=''
592 ccdlflags=''
593 dlsrc=''
594 ld=''
595 lddlflags=''
596 usedl=''
597 doublesize=''
598 ebcdic=''
599 fflushNULL=''
600 fflushall=''
601 fpossize=''
602 fpostype=''
603 gccosandvers=''
604 gccversion=''
605 gidformat=''
606 gidsign=''
607 gidsize=''
608 gidtype=''
609 groupstype=''
610 h_fcntl=''
611 h_sysfile=''
612 i_arpainet=''
613 db_hashtype=''
614 db_prefixtype=''
615 i_db=''
616 i_dbm=''
617 i_rpcsvcdbm=''
618 d_dirnamlen=''
619 direntrytype=''
620 i_dirent=''
621 i_dld=''
622 i_dlfcn=''
623 i_fcntl=''
624 i_float=''
625 i_gdbm=''
626 d_grpasswd=''
627 i_grp=''
628 i_iconv=''
629 i_ieeefp=''
630 i_inttypes=''
631 i_libutil=''
632 i_limits=''
633 i_locale=''
634 i_machcthr=''
635 i_malloc=''
636 i_math=''
637 i_memory=''
638 i_mntent=''
639 i_ndbm=''
640 i_netdb=''
641 i_neterrno=''
642 i_netinettcp=''
643 i_niin=''
644 i_sysin=''
645 i_poll=''
646 i_prot=''
647 i_pthread=''
648 d_pwage=''
649 d_pwchange=''
650 d_pwclass=''
651 d_pwcomment=''
652 d_pwexpire=''
653 d_pwgecos=''
654 d_pwpasswd=''
655 d_pwquota=''
656 i_pwd=''
657 i_sfio=''
658 i_shadow=''
659 i_socks=''
660 i_stddef=''
661 i_stdlib=''
662 i_string=''
663 strings=''
664 i_sunmath=''
665 i_sysaccess=''
666 i_sysdir=''
667 i_sysfile=''
668 d_voidtty=''
669 i_bsdioctl=''
670 i_sysfilio=''
671 i_sysioctl=''
672 i_syssockio=''
673 i_syslog=''
674 i_sysmman=''
675 i_sysmode=''
676 i_sysmount=''
677 i_sysndir=''
678 i_sysparam=''
679 i_sysresrc=''
680 i_syssecrt=''
681 i_sysselct=''
682 i_sysstat=''
683 i_sysstatfs=''
684 i_sysstatvfs=''
685 i_systimes=''
686 i_systypes=''
687 i_sysuio=''
688 i_sysun=''
689 i_sysutsname=''
690 i_sysvfs=''
691 i_syswait=''
692 i_sgtty=''
693 i_termio=''
694 i_termios=''
695 i_systime=''
696 i_systimek=''
697 i_time=''
698 timeincl=''
699 i_unistd=''
700 i_ustat=''
701 i_utime=''
702 i_values=''
703 i_stdarg=''
704 i_varargs=''
705 i_varhdr=''
706 i_vfork=''
707 inc_version_list=''
708 inc_version_list_init=''
709 installprefix=''
710 installprefixexp=''
711 installstyle=''
712 installusrbinperl=''
713 intsize=''
714 longsize=''
715 shortsize=''
716 libc=''
717 ldlibpthname=''
718 libperl=''
719 shrpenv=''
720 useshrplib=''
721 glibpth=''
722 libpth=''
723 loclibpth=''
724 plibpth=''
725 xlibpth=''
726 ignore_versioned_solibs=''
727 libs=''
728 libsdirs=''
729 libsfiles=''
730 libsfound=''
731 libspath=''
732 lns=''
733 d_PRIEUldbl=''
734 d_PRIFUldbl=''
735 d_PRIGUldbl=''
736 d_PRIeldbl=''
737 d_PRIfldbl=''
738 d_PRIgldbl=''
739 d_SCNfldbl=''
740 sPRIEUldbl=''
741 sPRIFUldbl=''
742 sPRIGUldbl=''
743 sPRIeldbl=''
744 sPRIfldbl=''
745 sPRIgldbl=''
746 sSCNfldbl=''
747 lseeksize=''
748 lseektype=''
749 make_set_make=''
750 d_mymalloc=''
751 freetype=''
752 mallocobj=''
753 mallocsrc=''
754 malloctype=''
755 usemymalloc=''
756 installman1dir=''
757 man1dir=''
758 man1direxp=''
759 man1ext=''
760 installman3dir=''
761 man3dir=''
762 man3direxp=''
763 man3ext=''
764 modetype=''
765 multiarch=''
766 mydomain=''
767 myhostname=''
768 phostname=''
769 c=''
770 n=''
771 d_eofnblk=''
772 eagain=''
773 o_nonblock=''
774 rd_nodata=''
775 netdb_hlen_type=''
776 netdb_host_type=''
777 netdb_name_type=''
778 netdb_net_type=''
779 groupcat=''
780 hostcat=''
781 passcat=''
782 orderlib=''
783 ranlib=''
784 d_perl_otherlibdirs=''
785 otherlibdirs=''
786 package=''
787 spackage=''
788 pager=''
789 api_revision=''
790 api_subversion=''
791 api_version=''
792 api_versionstring=''
793 patchlevel=''
794 revision=''
795 subversion=''
796 version=''
797 perl5=''
798 perladmin=''
799 perlpath=''
800 d_nv_preserves_uv=''
801 d_nv_preserves_uv_bits=''
802 i16size=''
803 i16type=''
804 i32size=''
805 i32type=''
806 i64size=''
807 i64type=''
808 i8size=''
809 i8type=''
810 ivsize=''
811 ivtype=''
812 nvsize=''
813 nvtype=''
814 u16size=''
815 u16type=''
816 u32size=''
817 u32type=''
818 u64size=''
819 u64type=''
820 u8size=''
821 u8type=''
822 uvsize=''
823 uvtype=''
824 ivdformat=''
825 nvEUformat=''
826 nvFUformat=''
827 nvGUformat=''
828 nveformat=''
829 nvfformat=''
830 nvgformat=''
831 uvXUformat=''
832 uvoformat=''
833 uvuformat=''
834 uvxformat=''
835 pidtype=''
836 prefix=''
837 prefixexp=''
838 installprivlib=''
839 privlib=''
840 privlibexp=''
841 prototype=''
842 ptrsize=''
843 d_PRIXU64=''
844 d_PRId64=''
845 d_PRIi64=''
846 d_PRIo64=''
847 d_PRIu64=''
848 d_PRIx64=''
849 sPRIXU64=''
850 sPRId64=''
851 sPRIi64=''
852 sPRIo64=''
853 sPRIu64=''
854 sPRIx64=''
855 d_quad=''
856 quadkind=''
857 quadtype=''
858 uquadtype=''
859 drand01=''
860 randbits=''
861 randfunc=''
862 randseedtype=''
863 seedfunc=''
864 installscript=''
865 scriptdir=''
866 scriptdirexp=''
867 selectminbits=''
868 selecttype=''
869 sh=''
870 sig_count=''
871 sig_name=''
872 sig_name_init=''
873 sig_num=''
874 sig_num_init=''
875 installsitearch=''
876 sitearch=''
877 sitearchexp=''
878 installsitebin=''
879 sitebin=''
880 sitebinexp=''
881 installsitelib=''
882 sitelib=''
883 sitelib_stem=''
884 sitelibexp=''
885 siteprefix=''
886 siteprefixexp=''
887 sizesize=''
888 sizetype=''
889 so=''
890 socksizetype=''
891 sharpbang=''
892 shsharp=''
893 spitshell=''
894 src=''
895 ssizetype=''
896 startperl=''
897 startsh=''
898 stdchar=''
899 d_stdio_stream_array=''
900 stdio_stream_array=''
901 sysman=''
902 trnl=''
903 uidformat=''
904 uidsign=''
905 uidsize=''
906 uidtype=''
907 archname64=''
908 use64bitall=''
909 use64bitint=''
910 ccflags_uselargefiles=''
911 ldflags_uselargefiles=''
912 libswanted_uselargefiles=''
913 uselargefiles=''
914 uselongdouble=''
915 usemorebits=''
916 usemultiplicity=''
917 nm_opt=''
918 nm_so_opt=''
919 runnm=''
920 usenm=''
921 useperlio=''
922 usesocks=''
923 d_oldpthreads=''
924 use5005threads=''
925 useithreads=''
926 usethreads=''
927 incpath=''
928 mips_type=''
929 usrinc=''
930 d_vendorarch=''
931 installvendorarch=''
932 vendorarch=''
933 vendorarchexp=''
934 d_vendorbin=''
935 installvendorbin=''
936 vendorbin=''
937 vendorbinexp=''
938 d_vendorlib=''
939 installvendorlib=''
940 vendorlib=''
941 vendorlib_stem=''
942 vendorlibexp=''
943 usevendorprefix=''
944 vendorprefix=''
945 vendorprefixexp=''
946 defvoidused=''
947 voidflags=''
948 pm_apiversion=''
949 xs_apiversion=''
950 CONFIG=''
951
952 define='define'
953 undef='undef'
954 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
955 rmlist=''
956
957 : We must find out about Eunice early
958 eunicefix=':'
959 if test -f /etc/unixtovms; then
960         eunicefix=/etc/unixtovms
961 fi
962 if test -f /etc/unixtovms.exe; then
963         eunicefix=/etc/unixtovms.exe
964 fi
965
966 i_whoami=''
967 ccname=''
968 ccversion=''
969 : set useposix=false in your hint file to disable the POSIX extension.
970 useposix=true
971 : set useopcode=false in your hint file to disable the Opcode extension.
972 useopcode=true
973 : Trailing extension.  Override this in a hint file, if needed.
974 _exe=''
975 : Extra object files, if any, needed on this platform.
976 archobjs=''
977 archname=''
978 : Possible local include directories to search.
979 : Set locincpth to "" in a hint file to defeat local include searches.
980 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
981 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
982 :
983 : no include file wanted by default
984 inclwanted=''
985
986 groupstype=''
987 : change the next line if compiling for Xenix/286 on Xenix/386
988 xlibpth='/usr/lib/386 /lib/386'
989 : Possible local library directories to search.
990 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
991 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
992
993 : general looking path for locating libraries
994 glibpth="/lib /usr/lib $xlibpth"
995 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
996 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
997 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
998
999 : Private path used by Configure to find libraries.  Its value
1000 : is prepended to libpth. This variable takes care of special
1001 : machines, like the mips.  Usually, it should be empty.
1002 plibpth=''
1003
1004 : default library list
1005 libswanted=''
1006 : some systems want to use only the non-versioned libso:s
1007 ignore_versioned_solibs=''
1008 archname64=''
1009 ccflags_uselargefiles=''
1010 ldflags_uselargefiles=''
1011 libswanted_uselargefiles=''
1012 : set usemultiplicity on the Configure command line to enable multiplicity.
1013 : set usesocks on the Configure command line to enable socks.
1014 : set usethreads on the Configure command line to enable threads.
1015 : full support for void wanted by default
1016 defvoidused=15
1017
1018 : List of libraries we want.
1019 : If anyone needs -lnet, put it in a hint file.
1020 libswanted='sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl'
1021 libswanted="$libswanted dld ld sun m c cposix posix"
1022 libswanted="$libswanted ndir dir crypt sec"
1023 libswanted="$libswanted ucb bsd BSD PW x iconv util"
1024 : We probably want to search /usr/shlib before most other libraries.
1025 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1026 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1027 glibpth="/usr/shlib $glibpth"
1028 : Do not use vfork unless overridden by a hint file.
1029 usevfork=false
1030
1031 : Find the basic shell for Bourne shell scripts
1032 case "$sh" in
1033 '')
1034         case "$SYSTYPE" in
1035         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1036         *) xxx='/bin/sh';;
1037         esac
1038         if test -f "$xxx"; then
1039                 sh="$xxx"
1040         else
1041                 : Build up a list and do a single loop so we can 'break' out.
1042                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1043                 for xxx in sh bash ksh pdksh ash; do
1044                         for p in $pth; do
1045                                 try="$try ${p}/${xxx}"
1046                         done
1047                 done
1048                 for xxx in $try; do
1049                         if test -f "$xxx"; then
1050                                 sh="$xxx";
1051                                 break
1052                         elif test -f "$xxx.exe"; then
1053                                 sh="$xxx";
1054                                 break
1055                         fi
1056                 done
1057         fi
1058         ;;
1059 esac
1060
1061 case "$sh" in
1062 '')     cat <<EOM >&2
1063 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
1064
1065 Usually it's in /bin/sh.  How did you even get this far?
1066 Please contact me (Perl Maintainers) at perlbug@perl.org and 
1067 we'll try to straighten this all out.
1068 EOM
1069         exit 1
1070         ;;
1071 esac
1072
1073 : see if sh knows # comments
1074 if `$sh -c '#' >/dev/null 2>&1`; then
1075         shsharp=true
1076         spitshell=cat
1077         xcat=/bin/cat
1078         test -f $xcat || xcat=/usr/bin/cat
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                 echo "#! $xcat" > try
1087                 $eunicefix try
1088                 chmod +x try
1089                 ./try > today
1090                 if test -s today; then
1091                         sharpbang='#! '
1092                 else
1093                         sharpbang=': use '
1094                 fi
1095         fi
1096 else
1097         echo " "
1098         echo "Your $sh doesn't grok # comments--I will strip them later on."
1099         shsharp=false
1100         cd ..
1101         echo "exec grep -v '^[  ]*#'" >spitshell
1102         chmod +x spitshell
1103         $eunicefix spitshell
1104         spitshell=`pwd`/spitshell
1105         cd UU
1106         echo "I presume that if # doesn't work, #! won't work either!"
1107         sharpbang=': use '
1108 fi
1109 rm -f try today
1110
1111 : figure out how to guarantee sh startup
1112 case "$startsh" in
1113 '') startsh=${sharpbang}${sh} ;;
1114 *)
1115 esac
1116 cat >try <<EOSS
1117 $startsh
1118 set abc
1119 test "$?abc" != 1
1120 EOSS
1121
1122 chmod +x try
1123 $eunicefix try
1124 if ./try; then
1125         : echo "Yup, it does."
1126 else
1127         echo "Hmm... '$startsh' does not guarantee sh startup..."
1128         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1129 fi
1130 rm -f try
1131
1132
1133 : Save command line options in file UU/cmdline.opt for later use in
1134 : generating config.sh.
1135 cat > cmdline.opt <<EOSH
1136 # Configure command line arguments.
1137 config_arg0='$0'
1138 config_args='$*'
1139 config_argc=$#
1140 EOSH
1141 argn=1
1142 for arg in "$@"; do
1143         cat >>cmdline.opt <<EOSH
1144 config_arg$argn='$arg'
1145 EOSH
1146         argn=`expr $argn + 1`
1147 done
1148
1149 : produce awk script to parse command line options
1150 cat >options.awk <<'EOF'
1151 BEGIN {
1152         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1153
1154         len = length(optstr);
1155         for (i = 1; i <= len; i++) {
1156                 c = substr(optstr, i, 1);
1157                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1158                 if (a == ":") {
1159                         arg[c] = 1;
1160                         i++;
1161                 }
1162                 opt[c] = 1;
1163         }
1164 }
1165 {
1166         expect = 0;
1167         str = $0;
1168         if (substr(str, 1, 1) != "-") {
1169                 printf("'%s'\n", str);
1170                 next;
1171         }
1172         len = length($0);
1173         for (i = 2; i <= len; i++) {
1174                 c = substr(str, i, 1);
1175                 if (!opt[c]) {
1176                         printf("-%s\n", substr(str, i));
1177                         next;
1178                 }
1179                 printf("-%s\n", c);
1180                 if (arg[c]) {
1181                         if (i < len)
1182                                 printf("'%s'\n", substr(str, i + 1));
1183                         else
1184                                 expect = 1;
1185                         next;
1186                 }
1187         }
1188 }
1189 END {
1190         if (expect)
1191                 print "?";
1192 }
1193 EOF
1194
1195 : process the command line options
1196 set X `for arg in "$@"; do echo "X$arg"; done |
1197         sed -e s/X// | awk -f options.awk`
1198 eval "set $*"
1199 shift
1200 rm -f options.awk
1201
1202 : set up default values
1203 fastread=''
1204 reuseval=false
1205 config_sh=''
1206 alldone=''
1207 error=''
1208 silent=''
1209 extractsh=''
1210 override=''
1211 knowitall=''
1212 rm -f optdef.sh posthint.sh
1213 cat >optdef.sh <<EOS
1214 $startsh
1215 EOS
1216
1217
1218 : option parsing
1219 while test $# -gt 0; do
1220         case "$1" in
1221         -d) shift; fastread=yes;;
1222         -e) shift; alldone=cont;;
1223         -f)
1224                 shift
1225                 cd ..
1226                 if test -r "$1"; then
1227                         config_sh="$1"
1228                 else
1229                         echo "$me: cannot read config file $1." >&2
1230                         error=true
1231                 fi
1232                 cd UU
1233                 shift;;
1234         -h) shift; error=true;;
1235         -r) shift; reuseval=true;;
1236         -s) shift; silent=true; realsilent=true;;
1237         -E) shift; alldone=exit;;
1238         -K) shift; knowitall=true;;
1239         -O) shift; override=true;;
1240         -S) shift; silent=true; extractsh=true;;
1241         -D)
1242                 shift
1243                 case "$1" in
1244                 *=)
1245                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1246                         echo "$me: ignoring -D $1" >&2
1247                         ;;
1248                 *=*) echo "$1" | \
1249                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1250                 *) echo "$1='define'" >> optdef.sh;;
1251                 esac
1252                 shift
1253                 ;;
1254         -U)
1255                 shift
1256                 case "$1" in
1257                 *=) echo "$1" >> optdef.sh;;
1258                 *=*)
1259                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1260                         echo "$me: ignoring -U $1" >&2
1261                         ;;
1262                 *) echo "$1='undef'" >> optdef.sh;;
1263                 esac
1264                 shift
1265                 ;;
1266         -A)
1267             shift
1268             xxx=''
1269             yyy="$1"
1270             zzz=''
1271             uuu=undef
1272             case "$yyy" in
1273             *=*) zzz=`echo $yyy|sed 's!=.*!!'`
1274                  case "$zzz" in
1275                  *:*) zzz='' ;;
1276                  *)   xxx=append
1277                       zzz=" "`echo $yyy|sed 's!^[^=]*=!!'` 
1278                       yyy=`echo $yyy|sed 's!=.*!!'` ;;
1279                  esac
1280                  ;;
1281             esac
1282             case "$xxx" in
1283             '')  case "$yyy" in
1284                  *:*) xxx=`echo $yyy|sed 's!:.*!!'`
1285                       yyy=`echo $yyy|sed 's!^[^:]*:!!'`
1286                       zzz=`echo $yyy|sed 's!^[^=]*=!!'`
1287                       yyy=`echo $yyy|sed 's!=.*!!'` ;;
1288                  *)   xxx=`echo $yyy|sed 's!:.*!!'`
1289                       yyy=`echo $yyy|sed 's!^[^:]*:!!'` ;;
1290                  esac
1291                  ;;       
1292             esac
1293             case "$xxx" in
1294             append)
1295                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1296             clear)
1297                 echo "$yyy=''"                  >> posthint.sh ;;
1298             define)
1299                 case "$zzz" in
1300                 '') zzz=define ;;
1301                 esac
1302                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1303             eval)
1304                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1305             prepend)
1306                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1307             undef)
1308                 case "$zzz" in
1309                 '') zzz="$uuu" ;;
1310                 esac
1311                 echo "$yyy=$zzz"                >> posthint.sh ;;
1312             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1313             esac
1314             shift
1315             ;;
1316         -V) echo "$me generated by metaconfig 3.0 PL70." >&2
1317             exit 0;;
1318         --) break;;
1319         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1320         *) break;;
1321         esac
1322 done
1323
1324 case "$error" in
1325 true)
1326         cat >&2 <<EOM
1327 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1328                  [-U symbol] [-U symbol=] [-A command:symbol...]
1329   -d : use defaults for all answers.
1330   -e : go on without questioning past the production of config.sh.
1331   -f : specify an alternate default configuration file.
1332   -h : print this help message and exit (with an error status).
1333   -r : reuse C symbols value if possible (skips costly nm extraction).
1334   -s : silent mode, only echoes questions and essential information.
1335   -D : define symbol to have some value:
1336          -D symbol         symbol gets the value 'define'
1337          -D symbol=value   symbol gets the value 'value'
1338   -E : stop at the end of questions, after having produced config.sh.
1339   -K : do not use unless you know what you are doing.
1340   -O : let -D and -U override definitions from loaded configuration file.
1341   -S : perform variable substitutions on all .SH files (can mix with -f)
1342   -U : undefine symbol:
1343          -U symbol    symbol gets the value 'undef'
1344          -U symbol=   symbol gets completely empty
1345   -A : manipulate symbol after the platform specific hints have been applied:
1346          -A symbol=value                append " "value to symbol
1347          -A append:symbol=value         append value to symbol
1348          -A define:symbol=value         define symbol to have value
1349          -A clear:symbol                define symbol to be ''
1350          -A define:symbol               define symbol to be 'define'
1351          -A eval:symbol=value           define symbol to be eval of value
1352          -A prepend:symbol=value        prepend value to symbol
1353          -A undef:symbol                define symbol to be 'undef'
1354          -A undef:symbol=               define symbol to be ''
1355   -V : print version number and exit (with a zero status).
1356 EOM
1357         exit 1
1358         ;;
1359 esac
1360
1361 : Sanity checks
1362 case "$fastread$alldone" in
1363 yescont|yesexit) ;;
1364 *)
1365         case "$extractsh" in
1366         true) ;;
1367         *)
1368                 if test ! -t 0; then
1369                         echo "Say 'sh Configure', not 'sh <Configure'"
1370                         exit 1
1371                 fi
1372                 ;;
1373         esac
1374         ;;
1375 esac
1376
1377 exec 4>&1
1378 case "$silent" in
1379 true) exec 1>/dev/null;;
1380 esac
1381
1382 : run the defines and the undefines, if any, but leave the file out there...
1383 touch optdef.sh
1384 . ./optdef.sh
1385 : create the posthint manipulation script and leave the file out there...
1386 touch posthint.sh
1387
1388 : set package name
1389 package=perl5
1390 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1391 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1392 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1393 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1394 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1395 esac
1396
1397 : Some greps do not return status, grrr.
1398 echo "grimblepritz" >grimble
1399 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1400         contains=contains
1401 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1402         contains=grep
1403 else
1404         contains=contains
1405 fi
1406 rm -f grimble
1407 : the following should work in any shell
1408 case "$contains" in
1409 contains*)
1410         echo " "
1411         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1412         cat >contains <<'EOSS'
1413 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1414 EOSS
1415 chmod +x contains
1416 esac
1417
1418 : Find the path to the source tree
1419 case "$src" in
1420 '') case "$0" in
1421     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1422          case "$src" in
1423          /*)    ;;
1424          *)     src=`cd ../$src && pwd` ;;
1425          esac
1426          ;;
1427     *)   src='.';;
1428     esac;;
1429 esac
1430 case "$src" in
1431 '')     src=/
1432         rsrc=/
1433         ;;
1434 /*) rsrc="$src";;
1435 *) rsrc="../$src";;
1436 esac
1437 if test -f $rsrc/Configure && \
1438         $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1439 then
1440    : found it, so we are ok.
1441 else
1442         rsrc=''
1443         for src in . .. ../.. ../../.. ../../../..; do
1444                 if test -f ../$src/Configure && \
1445                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1446                 then
1447                         rsrc=../$src
1448                         break
1449                 fi
1450         done
1451 fi
1452 case "$rsrc" in
1453 '')
1454         cat <<EOM >&4
1455
1456 Sorry, I can't seem to locate the source dir for $package.  Please start
1457 Configure with an explicit path -- i.e. /some/path/Configure.
1458
1459 EOM
1460         exit 1
1461         ;;
1462 ../.)   rsrc='..';;
1463 *)
1464         echo " "
1465         echo "Sources for $package found in \"$src\"." >&4
1466         ;;
1467 esac
1468
1469 : script used to extract .SH files with variable substitutions
1470 cat >extract <<'EOS'
1471 CONFIGDOTSH=true
1472 echo "Doing variable substitutions on .SH files..."
1473 if test -f $src/MANIFEST; then
1474         set x `awk '{print $1}' <$src/MANIFEST | grep '\.SH$'`
1475 else
1476         echo "(Looking for .SH files under the source directory.)"
1477         set x `(cd $src; find . -name "*.SH" -print)`
1478 fi
1479 shift
1480 case $# in
1481 0) set x `(cd $src; echo *.SH)`; shift;;
1482 esac
1483 if test ! -f $src/$1; then
1484         shift
1485 fi
1486 mkdir_p='
1487 name=$1;
1488 create="";
1489 while test $name; do
1490         if test ! -d "$name"; then
1491                 create="$name $create";
1492                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1493                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1494         else
1495                 name="";
1496         fi;
1497 done;
1498 for file in $create; do
1499         mkdir $file;
1500 done
1501 '
1502 for file in $*; do
1503         case "$src" in
1504         ".")
1505                 case "$file" in
1506                 */*)
1507                         dir=`expr X$file : 'X\(.*\)/'`
1508                         file=`expr X$file : 'X.*/\(.*\)'`
1509                         (cd $dir && . ./$file)
1510                         ;;
1511                 *)
1512                         . ./$file
1513                         ;;
1514                 esac
1515                 ;;
1516         *)
1517                 case "$file" in
1518                 */*)
1519                         dir=`expr X$file : 'X\(.*\)/'`
1520                         file=`expr X$file : 'X.*/\(.*\)'`
1521                         (set x $dir; shift; eval $mkdir_p)
1522                         sh <$src/$dir/$file
1523                         ;;
1524                 *)
1525                         sh <$src/$file
1526                         ;;
1527                 esac
1528                 ;;
1529         esac
1530 done
1531 if test -f $src/config_h.SH; then
1532         if test ! -f config.h; then
1533         : oops, they left it out of MANIFEST, probably, so do it anyway.
1534         . $src/config_h.SH
1535         fi
1536 fi
1537 EOS
1538
1539 : extract files and exit if asked to do so
1540 case "$extractsh" in
1541 true)
1542         case "$realsilent" in
1543         true) ;;
1544         *) exec 1>&4;;
1545         esac
1546         case "$config_sh" in
1547         '') config_sh='config.sh';;
1548         esac
1549         echo " "
1550         echo "Fetching answers from $config_sh..."
1551         cd ..
1552         . $config_sh
1553         test "$override" && . ./optdef.sh
1554         echo " "
1555         . UU/extract
1556         rm -rf UU
1557         echo "Done."
1558         exit 0
1559         ;;
1560 esac
1561
1562 : Eunice requires " " instead of "", can you believe it
1563 echo " "
1564 : Here we go...
1565 echo "Beginning of configuration questions for $package."
1566
1567 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1568
1569 : first determine how to suppress newline on echo command
1570 echo " "
1571 echo "Checking echo to see how to suppress newlines..."
1572 (echo "hi there\c" ; echo " ") >.echotmp
1573 if $contains c .echotmp >/dev/null 2>&1 ; then
1574         echo "...using -n."
1575         n='-n'
1576         c=''
1577 else
1578         cat <<'EOM'
1579 ...using \c
1580 EOM
1581         n=''
1582         c='\c'
1583 fi
1584 echo $n "The star should be here-->$c"
1585 echo '*'
1586 rm -f .echotmp
1587
1588 : Now test for existence of everything in MANIFEST
1589 echo " "
1590 if test -f $rsrc/MANIFEST; then
1591         echo "First let's make sure your kit is complete.  Checking..." >&4
1592         awk '$1 !~ /PACK[A-Z]+/ {print $1}' $rsrc/MANIFEST | split -50
1593         rm -f missing
1594         tmppwd=`pwd`
1595         for filelist in x??; do
1596                 (cd $rsrc; ls `cat $tmppwd/$filelist` >/dev/null 2>>$tmppwd/missing)
1597         done
1598         if test -s missing; then
1599                 cat missing >&4
1600                 cat >&4 <<'EOM'
1601
1602 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1603
1604 You have the option of continuing the configuration process, despite the
1605 distinct possibility that your kit is damaged, by typing 'y'es.  If you
1606 do, don't blame me if something goes wrong.  I advise you to type 'n'o
1607 and contact the author (perlbug@perl.org).
1608
1609 EOM
1610                 echo $n "Continue? [n] $c" >&4
1611                 read ans
1612                 case "$ans" in
1613                 y*)
1614                         echo "Continuing..." >&4
1615                         rm -f missing
1616                         ;;
1617                 *)
1618                         echo "ABORTING..." >&4
1619                         kill $$
1620                         ;;
1621                 esac
1622         else
1623                 echo "Looks good..."
1624         fi
1625 else
1626         echo "There is no MANIFEST file.  I hope your kit is complete !"
1627 fi
1628 rm -f missing x??
1629
1630 echo " "
1631 : Find the appropriate value for a newline for tr
1632 if test -n "$DJGPP"; then
1633        trnl='\012'
1634 fi
1635 if test X"$trnl" = X; then
1636         case "`echo foo|tr '\n' x 2>/dev/null`" in
1637         foox) trnl='\n' ;;
1638         esac
1639 fi
1640 if test X"$trnl" = X; then
1641         case "`echo foo|tr '\012' x 2>/dev/null`" in
1642         foox) trnl='\012' ;;
1643         esac
1644 fi
1645 if test X"$trnl" = X; then
1646         cat <<EOM >&2
1647
1648 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
1649
1650 EOM
1651         exit 1
1652 fi
1653
1654 : compute the number of columns on the terminal for proper question formatting
1655 case "$COLUMNS" in
1656 '') COLUMNS='80';;
1657 esac
1658
1659 : set up the echo used in my read
1660 myecho="case \"\$xxxm\" in
1661 '') echo $n \"\$rp $c\" >&4;;
1662 *) case \"\$rp\" in
1663         '') echo $n \"[\$xxxm] $c\";;
1664         *)
1665                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
1666                         echo \"\$rp\" >&4
1667                         echo $n \"[\$xxxm] $c\" >&4
1668                 else
1669                         echo $n \"\$rp [\$xxxm] $c\" >&4
1670                 fi
1671                 ;;
1672         esac;;
1673 esac"
1674
1675 : now set up to do reads with possible shell escape and default assignment
1676 cat <<EOSC >myread
1677 $startsh
1678 xxxm=\$dflt
1679 $myecho
1680 ans='!'
1681 case "\$fastread" in
1682 yes) case "\$dflt" in
1683         '') ;;
1684         *) ans='';
1685                 case "\$silent-\$rp" in
1686                 true-) ;;
1687                 *) echo " " >&4;;
1688                 esac;;
1689         esac;;
1690 *) case "\$silent" in
1691         true) case "\$rp" in
1692                 '') ans='';;
1693                 esac;;
1694         esac;;
1695 esac
1696 while expr "X\$ans" : "X!" >/dev/null; do
1697         read answ
1698         set x \$xxxm
1699         shift
1700         aok=''; eval "ans=\\"\$answ\\"" && aok=y
1701         case  "\$answ" in
1702         "!")
1703                 sh 1>&4
1704                 echo " "
1705                 $myecho
1706                 ;;
1707         !*)
1708                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
1709                 shift
1710                 sh 1>&4 -c "\$*"
1711                 echo " "
1712                 $myecho
1713                 ;;
1714         "\$ans")
1715                 case "\$ans" in
1716                 \\&*)
1717                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
1718                         shift
1719                         case "\$1" in
1720                         -d)
1721                                 fastread=yes
1722                                 echo "(OK, I'll run with -d after this question.)" >&4
1723                                 ;;
1724                         -*)
1725                                 echo "*** Sorry, \$1 not supported yet." >&4
1726                                 ;;
1727                         esac
1728                         $myecho
1729                         ans=!
1730                         ;;
1731                 esac;;
1732         *)
1733                 case "\$aok" in
1734                 y)
1735                         echo "*** Substitution done -- please confirm."
1736                         xxxm="\$ans"
1737                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
1738                         xxxm="\$ans"
1739                         ans=!
1740                         ;;
1741                 *)
1742                         echo "*** Error -- try again."
1743                         ans=!
1744                         ;;
1745                 esac
1746                 $myecho
1747                 ;;
1748         esac
1749         case "\$ans\$xxxm\$nostick" in
1750         '')
1751                 ans=!
1752                 $myecho
1753                 ;;
1754         esac
1755 done
1756 case "\$ans" in
1757 '') ans="\$xxxm";;
1758 esac
1759 EOSC
1760
1761 : create .config dir to save info across Configure sessions
1762 test -d ../.config || mkdir ../.config
1763 cat >../.config/README <<EOF
1764 This directory created by Configure to save information that should
1765 persist across sessions for $package.
1766
1767 You may safely delete it if you wish.
1768 EOF
1769
1770 xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
1771 case "$usedevel" in
1772 $define|true|[yY]*) ;;
1773 *) case "$xversion" in
1774    *[13579])
1775         cat >&4 <<EOH
1776 *** WHOA THERE!!! ***
1777
1778     This is an UNSTABLE DEVELOPMENT release.
1779     The version of this $package distribution is $xversion, that is, odd,
1780     (as opposed to even) and that signifies a development release.
1781     If you want a maintenance release, you want an even-numbered version.
1782
1783     Do ***NOT*** install this into production use.
1784     Data corruption and crashes are possible.
1785
1786     It is most seriously suggested that you do not continue any further
1787     unless you want to help in developing and debugging Perl.
1788
1789 EOH
1790         rp='Do you really want to continue?'
1791         dflt='n'
1792         . ./myread
1793         case "$ans" in
1794         [yY]) echo >&4 "Okay, continuing." ;;
1795         *) echo >&4 "Okay, bye."
1796            exit 1
1797            ;;
1798         esac
1799         ;;
1800     esac
1801     ;;
1802 esac
1803
1804 : general instructions
1805 needman=true
1806 firsttime=true
1807 user=`(logname) 2>/dev/null`
1808 case "$user" in
1809 '') user=`whoami 2>&1`;;
1810 esac
1811 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
1812         firsttime=false
1813         echo " "
1814         rp='Would you like to see the instructions?'
1815         dflt=n
1816         . ./myread
1817         case "$ans" in
1818         [yY]*) ;;
1819         *) needman=false;;
1820         esac
1821 fi
1822 if $needman; then
1823         cat <<EOH
1824
1825 This installation shell script will examine your system and ask you questions
1826 to determine how the perl5 package should be installed. If you get
1827 stuck on a question, you may use a ! shell escape to start a subshell or
1828 execute a command.  Many of the questions will have default answers in square
1829 brackets; typing carriage return will give you the default.
1830
1831 On some of the questions which ask for file or directory names you are allowed
1832 to use the ~name construct to specify the login directory belonging to "name",
1833 even if you don't have a shell which knows about that.  Questions where this is
1834 allowed will be marked "(~name ok)".
1835
1836 EOH
1837         rp=''
1838         dflt='Type carriage return to continue'
1839         . ./myread
1840         cat <<'EOH'
1841
1842 The prompter used in this script allows you to use shell variables and
1843 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
1844 in the default answer, as if the default line was a set of arguments given to a
1845 script shell.  This means you may also use $* to repeat the whole default line,
1846 so you do not have to re-type everything to add something to the default.
1847
1848 Everytime there is a substitution, you will have to confirm.  If there is an
1849 error (e.g. an unmatched backtick), the default answer will remain unchanged
1850 and you will be prompted again.
1851
1852 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
1853 the questions and use the computed defaults (or the previous answers if there
1854 was already a config.sh file). Type 'Configure -h' for a list of options.
1855 You may also start interactively and then answer '& -d' at any prompt to turn
1856 on the non-interactive behaviour for the remainder of the execution.
1857
1858 EOH
1859         . ./myread
1860         cat <<EOH
1861
1862 Much effort has been expended to ensure that this shell script will run on any
1863 Unix system.  If despite that it blows up on yours, your best bet is to edit
1864 Configure and run it again.  If you can't run Configure for some reason,
1865 you'll have to generate a config.sh file by hand.  Whatever problems you
1866 have, let me (perlbug@perl.org) know how I blew it.
1867
1868 This installation script affects things in two ways:
1869
1870 1) it may do direct variable substitutions on some of the files included
1871    in this kit.
1872 2) it builds a config.h file for inclusion in C programs.  You may edit
1873    any of these files as the need arises after running this script.
1874
1875 If you make a mistake on a question, there is no easy way to back up to it
1876 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
1877 files.  Configure will offer to let you do this before it runs the SH files.
1878
1879 EOH
1880         dflt='Type carriage return to continue'
1881         . ./myread
1882         case "$firsttime" in
1883         true) echo $user >>../.config/instruct;;
1884         esac
1885 fi
1886
1887 : find out where common programs are
1888 echo " "
1889 echo "Locating common programs..." >&4
1890 cat <<EOSC >loc
1891 $startsh
1892 case \$# in
1893 0) exit 1;;
1894 esac
1895 thing=\$1
1896 shift
1897 dflt=\$1
1898 shift
1899 for dir in \$*; do
1900         case "\$thing" in
1901         .)
1902         if test -d \$dir/\$thing; then
1903                 echo \$dir
1904                 exit 0
1905         fi
1906         ;;
1907         *)
1908         for thisthing in \$dir/\$thing; do
1909                 : just loop through to pick last item
1910         done
1911         if test -f \$thisthing; then
1912                 echo \$thisthing
1913                 exit 0
1914         elif test -f \$dir/\$thing.exe; then
1915                 if test -n "$DJGPP"; then
1916                         echo \$dir/\$thing.exe
1917                 else
1918                         : on Eunice apparently
1919                         echo \$dir/\$thing
1920                 fi
1921                 exit 0
1922         fi
1923         ;;
1924         esac
1925 done
1926 echo \$dflt
1927 exit 1
1928 EOSC
1929 chmod +x loc
1930 $eunicefix loc
1931 loclist="
1932 awk
1933 cat
1934 comm
1935 cp
1936 echo
1937 expr
1938 grep
1939 ls
1940 make
1941 mkdir
1942 rm
1943 sed
1944 sort
1945 touch
1946 tr
1947 uniq
1948 "
1949 trylist="
1950 Mcc
1951 ar
1952 byacc
1953 cpp
1954 csh
1955 date
1956 egrep
1957 gzip
1958 less
1959 ln
1960 more
1961 nm
1962 nroff
1963 pg
1964 test
1965 uname
1966 zip
1967 "
1968 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1969 pth="$pth /lib /usr/lib"
1970 for file in $loclist; do
1971         eval xxx=\$$file
1972         case "$xxx" in
1973         /*|?:[\\/]*)
1974                 if test -f "$xxx"; then
1975                         : ok
1976                 else
1977                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
1978                         xxx=`./loc $file $file $pth`
1979                 fi
1980                 ;;
1981         '') xxx=`./loc $file $file $pth`;;
1982         *) xxx=`./loc $xxx $xxx $pth`;;
1983         esac
1984         eval $file=$xxx
1985         eval _$file=$xxx
1986         case "$xxx" in
1987         /*)
1988                 echo $file is in $xxx.
1989                 ;;
1990         ?:[\\/]*)
1991                 echo $file is in $xxx.
1992                 ;;
1993         *)
1994                 echo "I don't know where '$file' is, and my life depends on it." >&4
1995                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
1996                 exit 1
1997                 ;;
1998         esac
1999 done
2000 echo " "
2001 echo "Don't worry if any of the following aren't found..."
2002 say=offhand
2003 for file in $trylist; do
2004         eval xxx=\$$file
2005         case "$xxx" in
2006         /*|?:[\\/]*)
2007                 if test -f "$xxx"; then
2008                         : ok
2009                 else
2010                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2011                         xxx=`./loc $file $file $pth`
2012                 fi
2013                 ;;
2014         '') xxx=`./loc $file $file $pth`;;
2015         *) xxx=`./loc $xxx $xxx $pth`;;
2016         esac
2017         eval $file=$xxx
2018         eval _$file=$xxx
2019         case "$xxx" in
2020         /*)
2021                 echo $file is in $xxx.
2022                 ;;
2023         ?:[\\/]*)
2024                 echo $file is in $xxx.
2025                 ;;
2026         *)
2027                 echo "I don't see $file out there, $say."
2028                 say=either
2029                 ;;
2030         esac
2031 done
2032 case "$egrep" in
2033 egrep)
2034         echo "Substituting grep for egrep."
2035         egrep=$grep
2036         ;;
2037 esac
2038 case "$ln" in
2039 ln)
2040         echo "Substituting cp for ln."
2041         ln=$cp
2042         ;;
2043 esac
2044 case "$test" in
2045 test)
2046         echo "Hopefully test is built into your sh."
2047         ;;
2048 *)
2049         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2050                 echo "Using the test built into your sh."
2051                 test=test
2052                 _test=test
2053         fi
2054         ;;
2055 esac
2056 case "$echo" in
2057 echo)
2058         echo "Hopefully echo is built into your sh."
2059         ;;
2060 '') ;;
2061 *)
2062         echo " "
2063 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2064         $echo $n "hi there$c" >foo1
2065         echo $n "hi there$c" >foo2
2066         if cmp foo1 foo2 >/dev/null 2>&1; then
2067                 echo "They are compatible.  In fact, they may be identical."
2068         else
2069                 case "$n" in
2070                 '-n') n='' c='\c';;
2071                 *) n='-n' c='';;
2072                 esac
2073                 cat <<FOO
2074 They are not compatible!  You are probably running ksh on a non-USG system.
2075 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2076 have echo built in and we may have to run some Bourne shell scripts.  That
2077 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2078
2079 FOO
2080                 $echo $n "The star should be here-->$c"
2081                 $echo "*"
2082         fi
2083         $rm -f foo1 foo2
2084         ;;
2085 esac
2086
2087 cat <<EOS >checkcc
2088 $startsh
2089 EOS
2090 cat <<'EOSC' >>checkcc
2091 case "$cc" in
2092 '') ;;
2093 *)  $rm -f try try.*
2094     $cat >try.c <<EOM
2095 int main(int argc, char *argv[]) {
2096   return 0;
2097 }
2098 EOM
2099     if $cc -o try try.c; then
2100        :
2101     else
2102         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2103         despair=yes
2104         trygcc=yes
2105         case "$cc" in
2106         *gcc*) trygcc=no ;;
2107         esac
2108         case "`$cc -v -c try.c 2>&1`" in
2109         *gcc*) trygcc=no ;;
2110         esac
2111         if $test X"$trygcc" = Xyes; then
2112             if gcc -o try -c try.c; then
2113                 echo " "
2114                 echo "You seem to have a working gcc, though." >&4
2115                 rp="Would you like to use it?"
2116                 dflt=y
2117                 if $test -f myread; then
2118                     . ./myread
2119                 else
2120                     if $test -f UU/myread; then
2121                         . ./UU/myread
2122                     else
2123                         echo "Cannot find myread, sorry.  Aborting." >&2
2124                         exit 1
2125                     fi
2126                 fi  
2127                 case "$ans" in
2128                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no ;;
2129                 esac
2130             fi
2131         fi
2132         if $test X"$despair" = Xyes; then
2133             echo "You need to find a working C compiler." >&4
2134             echo "I cannot continue any further, aborting." >&4
2135             exit 1
2136         fi
2137     fi
2138     $rm -f try try.*
2139     ;;
2140 esac
2141 EOSC
2142
2143 : determine whether symbolic links are supported
2144 echo " "
2145 $touch blurfl
2146 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2147         echo "Symbolic links are supported." >&4
2148         lns="$ln -s"
2149 else
2150         echo "Symbolic links are NOT supported." >&4
2151         lns="$ln"
2152 fi
2153 $rm -f blurfl sym
2154
2155 : see whether [:lower:] and [:upper:] are supported character classes
2156 echo " "
2157 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2158 ABYZ)
2159         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2160         up='[:upper:]'
2161         low='[:lower:]'
2162         ;;
2163 *)      # There is a discontinuity in EBCDIC between 'I' and 'J'
2164         # (0xc9 and 0xd1), therefore that is a nice testing point.
2165         if test "X$up" = X -o "X$low" = X; then
2166             case "`echo IJ | $tr '[I-J]' '[i-j]' 2>/dev/null`" in
2167             ij) up='[A-Z]'
2168                 low='[a-z]'
2169                 ;;
2170             esac
2171         fi
2172         if test "X$up" = X -o "X$low" = X; then
2173             case "`echo IJ | $tr I-J i-j 2>/dev/null`" in
2174             ij) up='A-Z'
2175                 low='a-z'
2176                 ;;
2177             esac
2178         fi
2179         if test "X$up" = X -o "X$low" = X; then
2180             case "`echo IJ | od -x 2>/dev/null`" in
2181             *C9D1*|*c9d1*)
2182                 echo "Hey, this might be EBCDIC." >&4
2183                 if test "X$up" = X -o "X$low" = X; then
2184                     case "`echo IJ | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
2185                     ij) up='[A-IJ-RS-Z]'
2186                         low='[a-ij-rs-z]'
2187                         ;;
2188                     esac
2189                 fi
2190                 if test "X$up" = X -o "X$low" = X; then
2191                     case "`echo IJ | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
2192                     ij) up='A-IJ-RS-Z'
2193                         low='a-ij-rs-z'
2194                         ;;
2195                     esac
2196                 fi
2197                 ;;
2198             esac
2199         fi
2200 esac
2201 case "`echo IJ | $tr \"$up\" \"$low\" 2>/dev/null`" in
2202 ij)
2203     echo "Using $up and $low to convert case." >&4
2204     ;;
2205 *)
2206     echo "I don't know how to translate letters from upper to lower case." >&4
2207     echo "Your tr is not acting any way I know of." >&4
2208     exit 1
2209     ;;
2210 esac
2211 : set up the translation script tr, must be called with ./tr of course
2212 cat >tr <<EOSC
2213 $startsh
2214 case "\$1\$2" in
2215 '[A-Z][a-z]') exec $tr '$up' '$low';;
2216 '[a-z][A-Z]') exec $tr '$low' '$up';;
2217 esac
2218 exec $tr "\$@"
2219 EOSC
2220 chmod +x tr
2221 $eunicefix tr
2222
2223 : Try to determine whether config.sh was made on this system
2224 case "$config_sh" in
2225 '')
2226 myuname=`$uname -a 2>/dev/null`
2227 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
2228 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
2229 # because the A-Z/a-z are not consecutive.
2230 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
2231         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
2232 newmyuname="$myuname"
2233 dflt=n
2234 case "$knowitall" in
2235 '')
2236         if test -f ../config.sh; then
2237                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
2238                         eval "`grep myuname= ../config.sh`"
2239                 fi
2240                 if test "X$myuname" = "X$newmyuname"; then
2241                         dflt=y
2242                 fi
2243         fi
2244         ;;
2245 *) dflt=y;;
2246 esac
2247
2248 : Get old answers from old config file if Configure was run on the
2249 : same system, otherwise use the hints.
2250 hint=default
2251 cd ..
2252 if test -f config.sh; then
2253         echo " "
2254         rp="I see a config.sh file.  Shall I use it to set the defaults?"
2255         . UU/myread
2256         case "$ans" in
2257         n*|N*) echo "OK, I'll ignore it."; mv config.sh config.sh.old;;
2258         *)  echo "Fetching default answers from your old config.sh file..." >&4
2259                 tmp_n="$n"
2260                 tmp_c="$c"
2261                 tmp_sh="$sh"
2262                 . ./config.sh
2263                 cp config.sh UU
2264                 n="$tmp_n"
2265                 c="$tmp_c"
2266                 : Older versions did not always set $sh.  Catch re-use of such
2267                 : an old config.sh.
2268                 case "$sh" in
2269                 '') sh="$tmp_sh" ;;
2270                 esac
2271                 hint=previous
2272                 ;;
2273         esac
2274 fi
2275 . ./UU/checkcc
2276 if test ! -f config.sh; then
2277         $cat <<EOM
2278
2279 First time through, eh?  I have some defaults handy for some systems
2280 that need some extra help getting the Configure answers right:
2281
2282 EOM
2283         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
2284         dflt=''
2285         : Half the following guesses are probably wrong... If you have better
2286         : tests or hints, please send them to perlbug@perl.org
2287         : The metaconfig authors would also appreciate a copy...
2288         $test -f /irix && osname=irix
2289         $test -f /xenix && osname=sco_xenix
2290         $test -f /dynix && osname=dynix
2291         $test -f /dnix && osname=dnix
2292         $test -f /lynx.os && osname=lynxos
2293         $test -f /unicos && osname=unicos && osvers=`$uname -r`
2294         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
2295         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
2296         $test -f /bin/mips && /bin/mips && osname=mips
2297         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
2298                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
2299         $test -d /usr/apollo/bin && osname=apollo
2300         $test -f /etc/saf/_sactab && osname=svr4
2301         $test -d /usr/include/minix && osname=minix
2302         if $test -d /MachTen -o -d /MachTen_Folder; then
2303                 osname=machten
2304                 if $test -x /sbin/version; then
2305                         osvers=`/sbin/version | $awk '{print $2}' |
2306                         $sed -e 's/[A-Za-z]$//'`
2307                 elif $test -x /usr/etc/version; then
2308                         osvers=`/usr/etc/version | $awk '{print $2}' |
2309                         $sed -e 's/[A-Za-z]$//'`
2310                 else
2311                         osvers="$2.$3"
2312                 fi
2313         fi
2314
2315         $test -f /sys/posix.dll &&
2316                 $test -f /usr/bin/what &&
2317                 set X `/usr/bin/what /sys/posix.dll` &&
2318                 $test "$3" = UWIN &&
2319                 osname=uwin &&
2320                 osvers="$5"
2321
2322         if $test -f $uname; then
2323                 set X $myuname
2324                 shift
2325
2326                 case "$5" in
2327                 fps*) osname=fps ;;
2328                 mips*)
2329                         case "$4" in
2330                         umips) osname=umips ;;
2331                         *) osname=mips ;;
2332                         esac;;
2333                 [23]100) osname=mips ;;
2334                 next*) osname=next ;;
2335                 i386*)
2336                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
2337                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
2338                                 osname='sco'
2339                                 osvers=$tmp
2340                         elif $test -f /etc/kconfig; then
2341                                 osname=isc
2342                                 if test "$lns" = "$ln -s"; then
2343                                         osvers=4
2344                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
2345                                         osvers=3
2346                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
2347                                         osvers=2
2348                                 fi
2349                         fi
2350                         tmp=''
2351                         ;;
2352                 pc*)
2353                         if test -n "$DJGPP"; then
2354                                 osname=dos
2355                                 osvers=djgpp
2356                         fi
2357                         ;;
2358                 esac
2359
2360                 case "$1" in
2361                 aix) osname=aix
2362                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
2363                         case "$tmp" in
2364                         'not found') osvers="$4"."$3" ;;
2365                         '<3240'|'<>3240') osvers=3.2.0 ;;
2366                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
2367                         '=3250'|'>3250') osvers=3.2.5 ;;
2368                         *) osvers=$tmp;;
2369                         esac
2370                         ;;
2371                 bsd386) osname=bsd386
2372                         osvers=`$uname -r`
2373                         ;;
2374                 cygwin*) osname=cygwin
2375                         osvers="$3"
2376                         ;;
2377                 *dc.osx) osname=dcosx
2378                         osvers="$3"
2379                         ;;
2380                 dnix) osname=dnix
2381                         osvers="$3"
2382                         ;;
2383                 domainos) osname=apollo
2384                         osvers="$3"
2385                         ;;
2386                 dgux) osname=dgux 
2387                         osvers="$3"
2388                         ;;
2389                 dynixptx*) osname=dynixptx
2390                         osvers=`echo "$4"|sed 's/^v//'`
2391                         ;;
2392                 freebsd) osname=freebsd 
2393                         osvers="$3" ;;
2394                 genix) osname=genix ;;
2395                 hp*) osname=hpux 
2396                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
2397                         ;;
2398                 irix*) osname=irix
2399                         case "$3" in
2400                         4*) osvers=4 ;;
2401                         5*) osvers=5 ;;
2402                         *)      osvers="$3" ;;
2403                         esac
2404                         ;;
2405                 linux) osname=linux
2406                         case "$3" in
2407                         *)      osvers="$3" ;;
2408                         esac
2409                         ;;
2410                 MiNT) osname=mint
2411                         ;;
2412                 netbsd*) osname=netbsd
2413                         osvers="$3"
2414                         ;;
2415                 news-os) osvers="$3"
2416                         case "$3" in
2417                         4*) osname=newsos4 ;;
2418                         *) osname=newsos ;;
2419                         esac
2420                         ;;
2421                 next*) osname=next ;;
2422                 POSIX-BC | posix-bc ) osname=posix-bc
2423                         osvers="$3"
2424                         ;;
2425                 powerux | power_ux | powermax_os | powermaxos | \
2426                 powerunix | power_unix) osname=powerux
2427                         osvers="$3"
2428                         ;;
2429                 qnx) osname=qnx
2430                         osvers="$4"
2431                         ;;
2432                 solaris) osname=solaris
2433                         case "$3" in
2434                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
2435                         *)      osvers="$3" ;;
2436                         esac
2437                         ;;
2438                 sunos) osname=sunos
2439                         case "$3" in
2440                         5*) osname=solaris
2441                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
2442                         *)      osvers="$3" ;;
2443                         esac
2444                         ;;
2445                 titanos) osname=titanos
2446                         case "$3" in
2447                         1*) osvers=1 ;;
2448                         2*) osvers=2 ;;
2449                         3*) osvers=3 ;;
2450                         4*) osvers=4 ;;
2451                         *)      osvers="$3" ;;
2452                         esac
2453                         ;;
2454                 ultrix) osname=ultrix
2455                         osvers="$3"
2456                         ;;
2457                 osf1|mls+)      case "$5" in
2458                                 alpha)
2459                                         osname=dec_osf
2460                                         osvers=`sizer -v | awk '{print $3}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
2461                                         case "$osvers" in
2462                                         [1-9].[0-9]*) ;;
2463                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
2464                                         esac
2465                                         ;;
2466                         hp*)    osname=hp_osf1  ;;
2467                         mips)   osname=mips_osf1 ;;
2468                         esac
2469                         ;;
2470                 unixware) osname=svr5
2471                         osvers="$4"
2472                         ;;
2473                 uts) osname=uts
2474                         osvers="$3"
2475                         ;;
2476                 $2) case "$osname" in
2477                         *isc*) ;;
2478                         *freebsd*) ;;
2479                         svr*)
2480                                 : svr4.x or possibly later
2481                                 case "svr$3" in 
2482                                 ${osname}*)
2483                                         osname=svr$3
2484                                         osvers=$4
2485                                         ;;
2486                                 esac
2487                                 case "$osname" in
2488                                 svr4.0)
2489                                         : Check for ESIX
2490                                         if test -f /stand/boot ; then
2491                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
2492                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
2493                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
2494                                                         if test -n "$isesix"; then
2495                                                                 osname=esix4
2496                                                         fi
2497                                                 fi
2498                                         fi
2499                                         ;;
2500                                 esac
2501                                 ;;
2502                         *)      if test -f /etc/systemid; then
2503                                         osname=sco
2504                                         set `echo $3 | $sed 's/\./ /g'` $4
2505                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
2506                                                 osvers=$1.$2.$3
2507                                         elif $test -f $src/hints/sco_$1_$2.sh; then
2508                                                 osvers=$1.$2
2509                                         elif $test -f $src/hints/sco_$1.sh; then
2510                                                 osvers=$1
2511                                         fi
2512                                 else
2513                                         case "$osname" in
2514                                         '') : Still unknown.  Probably a generic Sys V.
2515                                                 osname="sysv"
2516                                                 osvers="$3"
2517                                                 ;;
2518                                         esac
2519                                 fi
2520                                 ;;
2521                         esac
2522                         ;;
2523                 *)      case "$osname" in
2524                         '') : Still unknown.  Probably a generic BSD.
2525                                 osname="$1"
2526                                 osvers="$3"
2527                                 ;;
2528                         esac
2529                         ;;
2530                 esac
2531         else
2532                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
2533                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
2534                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
2535                                 osname=news_os
2536                         fi
2537                         $rm -f UU/kernel.what
2538                 elif test -d c:/.; then
2539                         set X $myuname
2540                         osname=os2
2541                         osvers="$5"
2542                 fi
2543         fi
2544         
2545         : Now look for a hint file osname_osvers, unless one has been
2546         : specified already.
2547         case "$hintfile" in
2548         ''|' ')
2549                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
2550                 : Also try without trailing minor version numbers.
2551                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
2552                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
2553                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
2554                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
2555                 case "$file" in
2556                 '') dflt=none ;;
2557                 *)  case "$osvers" in
2558                         '') dflt=$file
2559                                 ;;
2560                         *)  if $test -f $src/hints/$file.sh ; then
2561                                         dflt=$file
2562                                 elif $test -f $src/hints/$xfile.sh ; then
2563                                         dflt=$xfile
2564                                 elif $test -f $src/hints/$xxfile.sh ; then
2565                                         dflt=$xxfile
2566                                 elif $test -f $src/hints/$xxxfile.sh ; then
2567                                         dflt=$xxxfile
2568                                 elif $test -f $src/hints/$xxxxfile.sh ; then
2569                                         dflt=$xxxxfile
2570                                 elif $test -f "$src/hints/${osname}.sh" ; then
2571                                         dflt="${osname}"
2572                                 else
2573                                         dflt=none
2574                                 fi
2575                                 ;;
2576                         esac
2577                         ;;
2578                 esac
2579                 if $test -f Policy.sh ; then
2580                         case "$dflt" in
2581                         *Policy*) ;;
2582                         none) dflt="Policy" ;;
2583                         *) dflt="Policy $dflt" ;;
2584                         esac
2585                 fi
2586                 ;;
2587         *)
2588                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
2589                 ;;
2590         esac
2591
2592         if $test -f Policy.sh ; then
2593                 $cat <<EOM
2594
2595 There's also a Policy hint file available, which should make the
2596 site-specific (policy) questions easier to answer.
2597 EOM
2598
2599         fi
2600
2601         $cat <<EOM
2602
2603 You may give one or more space-separated answers, or "none" if appropriate.
2604 A well-behaved OS will have no hints, so answering "none" or just "Policy"
2605 is a good thing.  DO NOT give a wrong version or a wrong OS.
2606
2607 EOM
2608
2609         rp="Which of these apply, if any?"
2610         . UU/myread
2611         tans=$ans
2612         for file in $tans; do
2613                 if $test X$file = XPolicy -a -f Policy.sh; then
2614                         . Policy.sh
2615                         $cat Policy.sh >> UU/config.sh
2616                 elif $test -f $src/hints/$file.sh; then
2617                         . $src/hints/$file.sh
2618                         $cat $src/hints/$file.sh >> UU/config.sh
2619                 elif $test X$tans = X -o X$tans = Xnone ; then
2620                         : nothing
2621                 else
2622                         : Give one chance to correct a possible typo.
2623                         echo "$file.sh does not exist"
2624                         dflt=$file
2625                         rp="hint to use instead?"
2626                         . UU/myread
2627                         for file in $ans; do
2628                                 if $test -f "$src/hints/$file.sh"; then
2629                                         . $src/hints/$file.sh
2630                                         $cat $src/hints/$file.sh >> UU/config.sh
2631                                 elif $test X$ans = X -o X$ans = Xnone ; then
2632                                         : nothing
2633                                 else
2634                                         echo "$file.sh does not exist -- ignored."
2635                                 fi
2636                         done
2637                 fi
2638         done
2639
2640         hint=recommended
2641         : Remember our hint file for later.
2642         if $test -f "$src/hints/$file.sh" ; then
2643                 hintfile="$file"
2644         else
2645                 hintfile=''
2646         fi
2647 fi
2648 cd UU
2649 ;;
2650 *)
2651         echo " "
2652         echo "Fetching default answers from $config_sh..." >&4
2653         tmp_n="$n"
2654         tmp_c="$c"
2655         cd ..
2656         cp $config_sh config.sh 2>/dev/null
2657         chmod +w config.sh
2658         . ./config.sh
2659         cd UU
2660         cp ../config.sh .
2661         n="$tmp_n"
2662         c="$tmp_c"
2663         hint=previous
2664         ;;
2665 esac
2666 test "$override" && . ./optdef.sh
2667 myuname="$newmyuname"
2668
2669 : Restore computed paths
2670 for file in $loclist $trylist; do
2671         eval $file="\$_$file"
2672 done
2673
2674 cat << EOM
2675
2676 Configure uses the operating system name and version to set some defaults.
2677 The default value is probably right if the name rings a bell. Otherwise,
2678 since spelling matters for me, either accept the default or answer "none"
2679 to leave it blank.
2680
2681 EOM
2682 case "$osname" in
2683         ''|' ')
2684                 case "$hintfile" in
2685                 ''|' '|none) dflt=none ;;
2686                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
2687                 esac
2688                 ;;
2689         *) dflt="$osname" ;;
2690 esac
2691 rp="Operating system name?"
2692 . ./myread
2693 case "$ans" in
2694 none)  osname='' ;;
2695 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
2696 esac
2697 echo " "
2698 case "$osvers" in
2699         ''|' ')
2700                 case "$hintfile" in
2701                 ''|' '|none) dflt=none ;;
2702                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
2703                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
2704                         case "$dflt" in
2705                         ''|' ') dflt=none ;;
2706                         esac
2707                         ;;
2708                 esac
2709                 ;;
2710         *) dflt="$osvers" ;;
2711 esac
2712 rp="Operating system version?"
2713 . ./myread
2714 case "$ans" in
2715 none)  osvers='' ;;
2716 *) osvers="$ans" ;;
2717 esac
2718
2719
2720 . ./posthint.sh
2721
2722 : who configured the system
2723 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
2724 cf_by=`(logname) 2>/dev/null`
2725 case "$cf_by" in
2726 "")
2727         cf_by=`(whoami) 2>/dev/null`
2728         case "$cf_by" in
2729         "") cf_by=unknown ;;
2730         esac ;;
2731 esac
2732
2733 : set up the script used to warn in case of inconsistency
2734 cat <<EOS >whoa
2735 $startsh
2736 EOS
2737 cat <<'EOSC' >>whoa
2738 dflt=y
2739 echo " "
2740 echo "*** WHOA THERE!!! ***" >&4
2741 echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
2742 rp="    Keep the $hint value?"
2743 . ./myread
2744 case "$ans" in
2745 y) td=$was; tu=$was;;
2746 esac
2747 EOSC
2748
2749 : function used to set $1 to $val
2750 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
2751 case "$val$was" in
2752 $define$undef) . ./whoa; eval "$var=\$td";;
2753 $undef$define) . ./whoa; eval "$var=\$tu";;
2754 *) eval "$var=$val";;
2755 esac'
2756
2757 case "$usethreads" in
2758 $define|true|[yY]*)     dflt='y';;
2759 *) dflt='n';;
2760 esac
2761 cat <<EOM
2762
2763 Perl can be built to take advantage of threads on some systems.
2764 To do so, Configure can be run with -Dusethreads.
2765
2766 Note that threading is a highly experimental feature, and
2767 some known race conditions still remain.  If you choose to try
2768 it, be very sure to not actually deploy it for production
2769 purposes.  README.threads has more details, and is required
2770 reading if you enable threads.
2771
2772 If this doesn't make any sense to you, just accept the default '$dflt'.
2773 EOM
2774 rp='Build a threading Perl?'
2775 . ./myread
2776 case "$ans" in
2777 y|Y)    val="$define" ;;
2778 *)      val="$undef" ;;
2779 esac
2780 set usethreads
2781 eval $setvar
2782
2783 case "$usethreads" in
2784 $define)
2785         $cat <<EOM
2786
2787 As of 5.5.640, Perl has two different internal threading implementations,
2788 the 5.005 version (5005threads) and an interpreter-based version
2789 (ithreads) that has one interpreter per thread.  Both are very 
2790 experimental.  This arrangement exists to help developers work out
2791 which one is better.
2792
2793 If you're a casual user, you probably don't want interpreter-threads
2794 at this time.  There doesn't yet exist a way to create threads from
2795 within Perl in this model, i.e., "use Thread;" will NOT work.
2796 EOM
2797         : Default to ithreads unless overridden on command line or with
2798         : old config.sh
2799         dflt='y'
2800         case "$use5005threads" in
2801                 $define|true|[yY]*) dflt='n';;
2802         esac
2803         case "$useithreads" in
2804                 $undef|false|[nN]*) dflt='n';;
2805         esac
2806         rp='Use interpreter-based ithreads?'
2807         . ./myread
2808         case "$ans" in
2809         y|Y)    val="$define" ;;
2810         *)      val="$undef" ;;
2811         esac
2812         set useithreads
2813         eval $setvar
2814         : Now set use5005threads to the opposite value.
2815         case "$useithreads" in
2816         $define) val="$undef" ;;
2817         *) val="$define" ;;
2818         esac
2819         set use5005threads
2820         eval $setvar
2821         ;;
2822 *)
2823         useithreads="$undef"
2824         use5005threads="$undef"
2825         ;;
2826 esac
2827
2828 case "$d_oldpthreads" in
2829 '')     : Configure tests would be welcome here.  For now, assume undef.
2830         val="$undef" ;;
2831 *)      val="$d_oldpthreads" ;;
2832 esac
2833 set d_oldpthreads
2834 eval $setvar
2835
2836
2837 case "$usethreads" in
2838 "$define"|true|[yY]*)
2839 : Look for a hint-file generated 'call-back-unit'.  If the
2840 : user has specified that a threading perl is to be built,
2841 : we may need to set or change some other defaults.
2842         if $test -f usethreads.cbu; then
2843                 echo "Your platform has some specific hints for threaded builds, using them..."
2844                 . ./usethreads.cbu
2845         else
2846                 $cat <<EOM
2847 (Your platform doesn't have any specific hints for threaded builds.
2848  Assuming POSIX threads, then.)
2849 EOM
2850         fi
2851         ;;
2852 esac
2853
2854 cat <<EOM
2855
2856 Perl can be built so that multiple Perl interpreters can coexist
2857 within the same Perl executable.
2858 EOM
2859
2860 case "$useithreads" in
2861 $define)
2862         cat <<EOM
2863 This multiple interpreter support is required for interpreter-based threads.
2864 EOM
2865         val="$define"
2866         ;;
2867 *)      case "$usemultiplicity" in
2868         $define|true|[yY]*)     dflt='y';;
2869         *) dflt='n';;
2870         esac
2871         echo " "
2872         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
2873         rp='Build Perl for multiplicity?'
2874         . ./myread
2875         case "$ans" in
2876         y|Y)    val="$define" ;;
2877         *)      val="$undef" ;;
2878         esac
2879         ;;
2880 esac
2881 set usemultiplicity
2882 eval $setvar
2883
2884 : make some quick guesses about what we are up against
2885 echo " "
2886 $echo $n "Hmm...  $c"
2887 echo exit 1 >bsd
2888 echo exit 1 >usg
2889 echo exit 1 >v7
2890 echo exit 1 >osf1
2891 echo exit 1 >eunice
2892 echo exit 1 >xenix
2893 echo exit 1 >venix
2894 echo exit 1 >os2
2895 d_bsd="$undef"
2896 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
2897 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
2898 then
2899         echo "Looks kind of like an OSF/1 system, but we'll see..."
2900         echo exit 0 >osf1
2901 elif test `echo abc | tr a-z A-Z` = Abc ; then
2902         xxx=`./loc addbib blurfl $pth`
2903         if $test -f $xxx; then
2904         echo "Looks kind of like a USG system with BSD features, but we'll see..."
2905                 echo exit 0 >bsd
2906                 echo exit 0 >usg
2907         else
2908                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
2909                         echo "Looks kind of like an extended USG system, but we'll see..."
2910                 else
2911                         echo "Looks kind of like a USG system, but we'll see..."
2912                 fi
2913                 echo exit 0 >usg
2914         fi
2915 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
2916         echo "Looks kind of like a BSD system, but we'll see..."
2917         d_bsd="$define"
2918         echo exit 0 >bsd
2919 else
2920         echo "Looks kind of like a Version 7 system, but we'll see..."
2921         echo exit 0 >v7
2922 fi
2923 case "$eunicefix" in
2924 *unixtovms*)
2925         $cat <<'EOI'
2926 There is, however, a strange, musty smell in the air that reminds me of
2927 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
2928 EOI
2929         echo exit 0 >eunice
2930         d_eunice="$define"
2931 : it so happens the Eunice I know will not run shell scripts in Unix format
2932         ;;
2933 *)
2934         echo " "
2935         echo "Congratulations.  You aren't running Eunice."
2936         d_eunice="$undef"
2937         ;;
2938 esac
2939 : Detect OS2.  The p_ variable is set above in the Head.U unit.
2940 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
2941 : semicolon as a patch separator
2942 case "$p_" in
2943 :) ;;
2944 *)
2945         $cat <<'EOI'
2946 I have the feeling something is not exactly right, however...don't tell me...
2947 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
2948 (Or you may be running DOS with DJGPP.)
2949 EOI
2950         echo exit 0 >os2
2951         ;;
2952 esac
2953 if test -f /xenix; then
2954         echo "Actually, this looks more like a XENIX system..."
2955         echo exit 0 >xenix
2956         d_xenix="$define"
2957 else
2958         echo " "
2959         echo "It's not Xenix..."
2960         d_xenix="$undef"
2961 fi
2962 chmod +x xenix
2963 $eunicefix xenix
2964 if test -f /venix; then
2965         echo "Actually, this looks more like a VENIX system..."
2966         echo exit 0 >venix
2967 else
2968         echo " "
2969         if ./xenix; then
2970                 : null
2971         else
2972                 echo "Nor is it Venix..."
2973         fi
2974 fi
2975 chmod +x bsd usg v7 osf1 eunice xenix venix os2
2976 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
2977 $rm -f foo
2978
2979 case "$cc" in
2980 '') dflt=cc;;
2981 *) dflt="$cc";;
2982 esac
2983 rp="Use which C compiler?"
2984 . ./myread
2985 cc="$ans"
2986 : Look for a hint-file generated 'call-back-unit'.  Now that the
2987 : user has specified the compiler, we may need to set or change some
2988 : other defaults.
2989 if $test -f cc.cbu; then
2990     . ./cc.cbu
2991 fi
2992 . ./checkcc
2993
2994 echo " "
2995 echo "Checking for GNU cc in disguise and/or its version number..." >&4
2996 $cat >gccvers.c <<EOM
2997 #include <stdio.h>
2998 int main() {
2999 #ifdef __GNUC__
3000 #ifdef __VERSION__
3001         printf("%s\n", __VERSION__);
3002 #else
3003         printf("%s\n", "1");
3004 #endif
3005 #endif
3006         exit(0);
3007 }
3008 EOM
3009 if $cc $ldflags -o gccvers gccvers.c; then
3010         gccversion=`./gccvers`
3011         case "$gccversion" in
3012         '') echo "You are not using GNU cc." ;;
3013         *)  echo "You are using GNU cc $gccversion."
3014             ccname=gcc  
3015             ;;
3016         esac
3017 else
3018         echo " "
3019         echo "*** WHOA THERE!!! ***" >&4
3020         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
3021         case "$knowitall" in
3022         '')
3023         echo "    You'd better start hunting for one and let me know about it." >&4
3024                 exit 1
3025                 ;;
3026         esac
3027 fi
3028 $rm -f gccvers*
3029 case "$gccversion" in
3030 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
3031 esac
3032 case "$gccversion" in
3033 '') gccosandvers='' ;;
3034 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
3035    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
3036    gccshortvers=''
3037    case "$gccosandvers" in
3038    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
3039    $osname$osvers) ;; # looking good
3040    $osname*) cat <<EOM >&4
3041
3042 *** WHOA THERE!!! ***
3043
3044     Your gcc has not been compiled for the exact release of
3045     your operating system ($gccosandvers versus $osname$osvers).
3046
3047     In general it is a good idea to keep gcc synchronized with
3048     the operating system because otherwise serious problems
3049     may ensue when trying to compile software, like Perl.
3050
3051     I'm trying to be optimistic here, though, and will continue.
3052     If later during the configuration and build icky compilation
3053     problems appear (headerfile conflicts being the most common
3054     manifestation), I suggest reinstalling the gcc to match
3055     your operating system release.
3056
3057 EOM
3058       ;;
3059    *) gccosandvers='' ;; # failed to parse, better be silent
3060    esac
3061    ;;
3062 esac
3063 case "$ccname" in
3064 '') ccname="$cc" ;;
3065 esac
3066
3067 : see how we invoke the C preprocessor
3068 echo " "
3069 echo "Now, how can we feed standard input to your C preprocessor..." >&4
3070 cat <<'EOT' >testcpp.c
3071 #define ABC abc
3072 #define XYZ xyz
3073 ABC.XYZ
3074 EOT
3075 cd ..
3076 if test ! -f cppstdin; then
3077         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
3078                 # AIX cc -E doesn't show the absolute headerfile
3079                 # locations but we'll cheat by using the -M flag.
3080                 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
3081         else
3082                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
3083         fi
3084 else
3085         echo "Keeping your $hint cppstdin wrapper."
3086 fi
3087 chmod 755 cppstdin
3088 wrapper=`pwd`/cppstdin
3089 ok='false'
3090 cd UU
3091
3092 if $test "X$cppstdin" != "X" && \
3093         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
3094         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3095 then
3096         echo "You used to use $cppstdin $cppminus so we'll use that again."
3097         case "$cpprun" in
3098         '') echo "But let's see if we can live without a wrapper..." ;;
3099         *)
3100                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
3101                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3102                 then
3103                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
3104                         ok='true'
3105                 else
3106                         echo "(However, $cpprun $cpplast does not work, let's see...)"
3107                 fi
3108                 ;;
3109         esac
3110 else
3111         case "$cppstdin" in
3112         '') ;;
3113         *)
3114                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
3115                 ;;
3116         esac
3117 fi
3118
3119 if $ok; then
3120         : nothing
3121 elif echo 'Maybe "'"$cc"' -E" will work...'; \
3122         $cc -E <testcpp.c >testcpp.out 2>&1; \
3123         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3124         echo "Yup, it does."
3125         x_cpp="$cc -E"
3126         x_minus='';
3127 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
3128         $cc -E - <testcpp.c >testcpp.out 2>&1; \
3129         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3130         echo "Yup, it does."
3131         x_cpp="$cc -E"
3132         x_minus='-';
3133 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
3134         $cc -P <testcpp.c >testcpp.out 2>&1; \
3135         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3136         echo "Yipee, that works!"
3137         x_cpp="$cc -P"
3138         x_minus='';
3139 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
3140         $cc -P - <testcpp.c >testcpp.out 2>&1; \
3141         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3142         echo "At long last!"
3143         x_cpp="$cc -P"
3144         x_minus='-';
3145 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
3146         $cpp <testcpp.c >testcpp.out 2>&1; \
3147         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3148         echo "It works!"
3149         x_cpp="$cpp"
3150         x_minus='';
3151 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
3152         $cpp - <testcpp.c >testcpp.out 2>&1; \
3153         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3154         echo "Hooray, it works!  I was beginning to wonder."
3155         x_cpp="$cpp"
3156         x_minus='-';
3157 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
3158         $wrapper <testcpp.c >testcpp.out 2>&1; \
3159         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3160         x_cpp="$wrapper"
3161         x_minus=''
3162         echo "Eureka!"
3163 else
3164         dflt=''
3165         rp="No dice.  I can't find a C preprocessor.  Name one:"
3166         . ./myread
3167         x_cpp="$ans"
3168         x_minus=''
3169         $x_cpp <testcpp.c >testcpp.out 2>&1
3170         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3171                 echo "OK, that will do." >&4
3172         else
3173 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
3174                 exit 1
3175         fi
3176 fi
3177
3178 case "$ok" in
3179 false)
3180         cppstdin="$x_cpp"
3181         cppminus="$x_minus"
3182         cpprun="$x_cpp"
3183         cpplast="$x_minus"
3184         set X $x_cpp
3185         shift
3186         case "$1" in
3187         "$cpp")
3188                 echo "Perhaps can we force $cc -E using a wrapper..."
3189                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
3190                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3191                 then
3192                         echo "Yup, we can."
3193                         cppstdin="$wrapper"
3194                         cppminus='';
3195                 else
3196                         echo "Nope, we'll have to live without it..."
3197                 fi
3198                 ;;
3199         esac
3200         case "$cpprun" in
3201         "$wrapper")
3202                 cpprun=''
3203                 cpplast=''
3204                 ;;
3205         esac
3206         ;;
3207 esac
3208
3209 case "$cppstdin" in
3210 "$wrapper"|'cppstdin') ;;
3211 *) $rm -f $wrapper;;
3212 esac
3213 $rm -f testcpp.c testcpp.out
3214
3215 : decide how portable to be.  Allow command line overrides.
3216 case "$d_portable" in
3217 "$undef") ;;
3218 *)      d_portable="$define" ;;
3219 esac
3220
3221 : set up shell script to do ~ expansion
3222 cat >filexp <<EOSS
3223 $startsh
3224 : expand filename
3225 case "\$1" in
3226  ~/*|~)
3227         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3228         ;;
3229  ~*)
3230         if $test -f /bin/csh; then
3231                 /bin/csh -f -c "glob \$1"
3232                 failed=\$?
3233                 echo ""
3234                 exit \$failed
3235         else
3236                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3237                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3238                 if $test ! -d "\$dir"; then
3239                         me=\`basename \$0\`
3240                         echo "\$me: can't locate home directory for: \$name" >&2
3241                         exit 1
3242                 fi
3243                 case "\$1" in
3244                 */*)
3245                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3246                         ;;
3247                 *)
3248                         echo \$dir
3249                         ;;
3250                 esac
3251         fi
3252         ;;
3253 *)
3254         echo \$1
3255         ;;
3256 esac
3257 EOSS
3258 chmod +x filexp
3259 $eunicefix filexp
3260
3261 : now set up to get a file name
3262 cat <<EOS >getfile
3263 $startsh
3264 EOS
3265 cat <<'EOSC' >>getfile
3266 tilde=''
3267 fullpath=''
3268 already=''
3269 skip=''
3270 none_ok=''
3271 exp_file=''
3272 nopath_ok=''
3273 orig_rp="$rp"
3274 orig_dflt="$dflt"
3275 case "$gfpth" in
3276 '') gfpth='.' ;;
3277 esac
3278
3279 case "$fn" in
3280 *\(*)
3281         expr $fn : '.*(\(.*\)).*' | tr ',' $trnl >getfile.ok
3282         fn=`echo $fn | sed 's/(.*)//'`
3283         ;;
3284 esac
3285
3286 case "$fn" in
3287 *:*)
3288         loc_file=`expr $fn : '.*:\(.*\)'`
3289         fn=`expr $fn : '\(.*\):.*'`
3290         ;;
3291 esac
3292
3293 case "$fn" in
3294 *~*) tilde=true;;
3295 esac
3296 case "$fn" in
3297 */*) fullpath=true;;
3298 esac
3299 case "$fn" in
3300 *+*) skip=true;;
3301 esac
3302 case "$fn" in
3303 *n*) none_ok=true;;
3304 esac
3305 case "$fn" in
3306 *e*) exp_file=true;;
3307 esac
3308 case "$fn" in
3309 *p*) nopath_ok=true;;
3310 esac
3311
3312 case "$fn" in
3313 *f*) type='File';;
3314 *d*) type='Directory';;
3315 *l*) type='Locate';;
3316 esac
3317
3318 what="$type"
3319 case "$what" in
3320 Locate) what='File';;
3321 esac
3322
3323 case "$exp_file" in
3324 '')
3325         case "$d_portable" in
3326         "$define") ;;
3327         *) exp_file=true;;
3328         esac
3329         ;;
3330 esac
3331
3332 cd ..
3333 while test "$type"; do
3334         redo=''
3335         rp="$orig_rp"
3336         dflt="$orig_dflt"
3337         case "$tilde" in
3338         true) rp="$rp (~name ok)";;
3339         esac
3340         . UU/myread
3341         if test -f UU/getfile.ok && \
3342                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3343         then
3344                 value="$ans"
3345                 ansexp="$ans"
3346                 break
3347         fi
3348         case "$ans" in
3349         none)
3350                 value=''
3351                 ansexp=''
3352                 case "$none_ok" in
3353                 true) type='';;
3354                 esac
3355                 ;;
3356         *)
3357                 case "$tilde" in
3358                 '') value="$ans"
3359                         ansexp="$ans";;
3360                 *)
3361                         value=`UU/filexp $ans`
3362                         case $? in
3363                         0)
3364                                 if test "$ans" != "$value"; then
3365                                         echo "(That expands to $value on this system.)"
3366                                 fi
3367                                 ;;
3368                         *) value="$ans";;
3369                         esac
3370                         ansexp="$value"
3371                         case "$exp_file" in
3372                         '') value="$ans";;
3373                         esac
3374                         ;;
3375                 esac
3376                 case "$fullpath" in
3377                 true)
3378                         case "$ansexp" in
3379                         /*) value="$ansexp" ;;
3380                         [a-zA-Z]:/*) value="$ansexp" ;;
3381                         *)
3382                                 redo=true
3383                                 case "$already" in
3384                                 true)
3385                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
3386                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
3387                                         ;;
3388                                 *)
3389                                 echo "Please give a full path name, starting with slash." >&4
3390                                         case "$tilde" in
3391                                         true)
3392                                 echo "Note that using ~name is ok provided it expands well." >&4
3393                                                 already=true
3394                                                 ;;
3395                                         esac
3396                                 esac
3397                                 ;;
3398                         esac
3399                         ;;
3400                 esac
3401                 case "$redo" in
3402                 '')
3403                         case "$type" in
3404                         File)
3405                                 for fp in $gfpth; do
3406                                         if test "X$fp" = X.; then
3407                                             pf="$ansexp"
3408                                         else    
3409                                             pf="$fp/$ansexp"
3410                                         fi
3411                                         if test -f "$pf"; then
3412                                                 type=''
3413                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3414                                         then
3415                                                 echo "($value is not a plain file, but that's ok.)"
3416                                                 type=''
3417                                         fi
3418                                         if test X"$type" = X; then
3419                                             value="$pf"
3420                                             break
3421                                         fi
3422                                 done
3423                                 ;;
3424                         Directory)
3425                                 for fp in $gfpth; do
3426                                         if test "X$fp" = X.; then
3427                                             dir="$ans"
3428                                             direxp="$ansexp"
3429                                         else    
3430                                             dir="$fp/$ansexp"
3431                                             direxp="$fp/$ansexp"
3432                                         fi
3433                                         if test -d "$direxp"; then
3434                                                 type=''
3435                                                 value="$dir"
3436                                                 break
3437                                         fi
3438                                 done
3439                                 ;;
3440                         Locate)
3441                                 if test -d "$ansexp"; then
3442                                         echo "(Looking for $loc_file in directory $value.)"
3443                                         value="$value/$loc_file"
3444                                         ansexp="$ansexp/$loc_file"
3445                                 fi
3446                                 if test -f "$ansexp"; then
3447                                         type=''
3448                                 fi
3449                                 case "$nopath_ok" in
3450                                 true)   case "$value" in
3451                                         */*) ;;
3452                                         *)      echo "Assuming $value will be in people's path."
3453                                                 type=''
3454                                                 ;;
3455                                         esac
3456                                         ;;
3457                                 esac
3458                                 ;;
3459                         esac
3460
3461                         case "$skip" in
3462                         true) type='';
3463                         esac
3464
3465                         case "$type" in
3466                         '') ;;
3467                         *)
3468                                 if test "$fastread" = yes; then
3469                                         dflt=y
3470                                 else
3471                                         dflt=n
3472                                 fi
3473                                 rp="$what $value doesn't exist.  Use that name anyway?"
3474                                 . UU/myread
3475                                 dflt=''
3476                                 case "$ans" in
3477                                 y*) type='';;
3478                                 *) echo " ";;
3479                                 esac
3480                                 ;;
3481                         esac
3482                         ;;
3483                 esac
3484                 ;;
3485         esac
3486 done
3487 cd UU
3488 ans="$value"
3489 rp="$orig_rp"
3490 dflt="$orig_dflt"
3491 rm -f getfile.ok
3492 test "X$gfpthkeep" != Xy && gfpth=""
3493 EOSC
3494
3495 : What should the include directory be ?
3496 echo " "
3497 $echo $n "Hmm...  $c"
3498 dflt='/usr/include'
3499 incpath=''
3500 mips_type=''
3501 if $test -f /bin/mips && /bin/mips; then
3502         echo "Looks like a MIPS system..."
3503         $cat >usr.c <<'EOCP'
3504 #ifdef SYSTYPE_BSD43
3505 /bsd43
3506 #endif
3507 EOCP
3508         if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
3509                 dflt='/bsd43/usr/include'
3510                 incpath='/bsd43'
3511                 mips_type='BSD 4.3'
3512         else
3513                 mips_type='System V'
3514         fi
3515         $rm -f usr.c usr.out
3516         echo "and you're compiling with the $mips_type compiler and libraries."
3517         xxx_prompt=y
3518         echo "exit 0" >mips
3519 else
3520         echo "Doesn't look like a MIPS system."
3521         xxx_prompt=n
3522         echo "exit 1" >mips
3523 fi
3524 chmod +x mips
3525 $eunicefix mips
3526 case "$usrinc" in
3527 '') ;;
3528 *) dflt="$usrinc";;
3529 esac
3530 case "$xxx_prompt" in
3531 y)      fn=d/
3532         echo " "
3533         rp='Where are the include files you want to use?'
3534         . ./getfile
3535         usrinc="$ans"
3536         ;;
3537 *)      usrinc="$dflt"
3538         ;;
3539 esac
3540
3541 : Set private lib path
3542 case "$plibpth" in
3543 '') if ./mips; then
3544                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
3545         fi;;
3546 esac
3547 case "$libpth" in
3548 ' ') dlist='';;
3549 '') dlist="$loclibpth $plibpth $glibpth";;
3550 *) dlist="$libpth";;
3551 esac
3552
3553 : Now check and see which directories actually exist, avoiding duplicates
3554 libpth=''
3555 for xxx in $dlist
3556 do
3557     if $test -d $xxx; then
3558                 case " $libpth " in
3559                 *" $xxx "*) ;;
3560                 *) libpth="$libpth $xxx";;
3561                 esac
3562     fi
3563 done
3564 $cat <<'EOM'
3565
3566 Some systems have incompatible or broken versions of libraries.  Among
3567 the directories listed in the question below, please remove any you
3568 know not to be holding relevant libraries, and add any that are needed.
3569 Say "none" for none.
3570
3571 EOM
3572 case "$libpth" in
3573 '') dflt='none';;
3574 *)
3575         set X $libpth
3576         shift
3577         dflt=${1+"$@"}
3578         ;;
3579 esac
3580 rp="Directories to use for library searches?"
3581 . ./myread
3582 case "$ans" in
3583 none) libpth=' ';;
3584 *) libpth="$ans";;
3585 esac
3586
3587 : compute shared library extension
3588 case "$so" in
3589 '')
3590         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
3591                 dflt='sl'
3592         else
3593                 dflt='so'
3594         fi
3595         ;;
3596 *) dflt="$so";;
3597 esac
3598 $cat <<EOM
3599
3600 On some systems, shared libraries may be available.  Answer 'none' if
3601 you want to suppress searching of shared libraries for the remainder
3602 of this configuration.
3603
3604 EOM
3605 rp='What is the file extension used for shared libraries?'
3606 . ./myread
3607 so="$ans"
3608
3609 : Define several unixisms.
3610 : Hints files or command line option can be used to override them.
3611 : The convoluted testing is in case hints files set either the old
3612 : or the new name.
3613 case "$_exe" in
3614 '')     case "$exe_ext" in
3615     '') ;;
3616         *)      _exe="$exe_ext" ;;
3617         esac
3618         ;;
3619 esac
3620 case "$_a" in
3621 '')     case "$lib_ext" in
3622     '') _a='.a';;
3623         *)      _a="$lib_ext" ;;
3624         esac
3625         ;;
3626 esac
3627 case "$_o" in
3628 '') case "$obj_ext" in
3629         '')     _o='.o';;
3630         *)      _o="$obj_ext";;
3631         esac
3632         ;;
3633 esac
3634 case "$p_" in
3635 '') case "$path_sep" in
3636         '')     p_=':';;
3637         *)      p_="$path_sep";;
3638         esac
3639         ;;
3640 esac
3641 exe_ext=$_exe
3642 lib_ext=$_a
3643 obj_ext=$_o
3644 path_sep=$p_
3645
3646 : Which makefile gets called first.  This is used by make depend.
3647 case "$firstmakefile" in
3648 '') firstmakefile='makefile';;
3649 esac
3650
3651 case "$usesocks" in
3652 $define|true|[yY]*)     dflt='y';;
3653 *) dflt='n';;
3654 esac
3655 cat <<EOM
3656
3657 Perl can be built to use the SOCKS proxy protocol library.  To do so,
3658 Configure must be run with -Dusesocks.
3659
3660 If this doesn't make any sense to you, just accept the default '$dflt'.
3661 EOM
3662 rp='Build Perl for SOCKS?'
3663 . ./myread
3664 case "$ans" in
3665 y|Y)    val="$define" ;;     
3666 *)      val="$undef" ;;
3667 esac
3668 set usesocks
3669 eval $setvar
3670
3671 : Looking for optional libraries
3672 echo " "
3673 echo "Checking for optional libraries..." >&4
3674 case "$libs" in
3675 ' '|'') dflt='';;
3676 *) dflt="$libs";;
3677 esac
3678 case "$libswanted" in
3679 '') libswanted='c_s';;
3680 esac
3681 case "$usesocks" in
3682 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
3683 esac
3684 libsfound=''
3685 libsfiles=''
3686 libsdirs=''
3687 libspath=''
3688 for thisdir in $libpth $xlibpth; do
3689   test -d $thisdir && libspath="$libspath $thisdir"
3690 done
3691 for thislib in $libswanted; do
3692         for thisdir in $libspath; do
3693             xxx=''
3694             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
3695                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|tail -1`
3696                 $test -f "$xxx" && eval $libscheck
3697                 $test -f "$xxx" && libstyle=shared
3698             fi
3699             if test ! -f "$xxx"; then
3700                 xxx=$thisdir/lib$thislib.$so
3701                 $test -f "$xxx" && eval $libscheck
3702                 $test -f "$xxx" && libstyle=shared
3703             fi  
3704             if test ! -f "$xxx"; then
3705                 xxx=$thisdir/lib$thislib$_a
3706                 $test -f "$xxx" && eval $libscheck
3707                 $test -f "$xxx" && libstyle=static
3708             fi
3709             if test ! -f "$xxx"; then
3710                 xxx=$thisdir/$thislib$_a
3711                 $test -f "$xxx" && eval $libscheck
3712                 $test -f "$xxx" && libstyle=static
3713             fi
3714             if test ! -f "$xxx"; then
3715                 xxx=$thisdir/lib${thislib}_s$_a
3716                 $test -f "$xxx" && eval $libscheck
3717                 $test -f "$xxx" && libstyle=static
3718                 $test -f "$xxx" && thislib=${thislib}_s
3719             fi
3720             if test ! -f "$xxx"; then
3721                 xxx=$thisdir/Slib$thislib$_a
3722                 $test -f "$xxx" && eval $libscheck
3723                 $test -f "$xxx" && libstyle=static
3724             fi
3725             if $test -f "$xxx"; then
3726                 case "$libstyle" in
3727                 shared) echo "Found -l$thislib (shared)." ;;
3728                 static) echo "Found -l$thislib." ;;
3729                 *)      echo "Found -l$thislib ($libstyle)." ;;
3730                 esac
3731                 case " $dflt " in
3732                 *"-l$thislib "*);;
3733                 *) dflt="$dflt -l$thislib"
3734                    libsfound="$libsfound $xxx"
3735                    yyy=`basename $xxx`
3736                    libsfiles="$libsfiles $yyy"
3737                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
3738                    case " $libsdirs " in
3739                    *" $yyy "*) ;;
3740                    *) libsdirs="$libsdirs $yyy" ;;
3741                    esac
3742                    ;;
3743                 esac
3744                 break
3745             fi  
3746         done
3747         if $test ! -f "$xxx"; then
3748             echo "No -l$thislib."
3749         fi
3750 done
3751 set X $dflt
3752 shift
3753 dflt="$*"
3754 case "$libs" in
3755 '') dflt="$dflt";;
3756 *) dflt="$libs";;
3757 esac
3758 case "$dflt" in
3759 ' '|'') dflt='none';;
3760 esac
3761
3762 $cat <<EOM
3763
3764 In order to compile $package on your machine, a number of libraries
3765 are usually needed.  Include any other special libraries here as well.
3766 Say "none" for none.  The default list is almost always right.
3767 EOM
3768
3769 echo " "
3770 rp="What libraries to use?"
3771 . ./myread
3772 case "$ans" in
3773 none) libs=' ';;
3774 *) libs="$ans";;
3775 esac
3776
3777 : determine optimization, if desired, or use for debug flag also
3778 case "$optimize" in
3779 ' '|$undef) dflt='none';;
3780 '') dflt='-O';;
3781 *) dflt="$optimize";;
3782 esac
3783 $cat <<EOH
3784
3785 By default, $package compiles with the -O flag to use the optimizer.
3786 Alternately, you might want to use the symbolic debugger, which uses
3787 the -g flag (on traditional Unix systems).  Either flag can be
3788 specified here.  To use neither flag, specify the word "none".
3789
3790 EOH
3791 rp="What optimizer/debugger flag should be used?"
3792 . ./myread
3793 optimize="$ans"
3794 case "$optimize" in
3795 'none') optimize=" ";;
3796 esac
3797
3798 dflt=''
3799 : We will not override a previous value, but we might want to
3800 : augment a hint file
3801 case "$hint" in
3802 default|recommended)
3803         case "$gccversion" in
3804         1*) dflt='-fpcc-struct-return' ;;
3805         esac
3806         case "$optimize" in
3807         *-g*) dflt="$dflt -DDEBUGGING";;
3808         esac
3809         case "$gccversion" in
3810         2*) if test -d /etc/conf/kconfig.d &&
3811                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
3812                 then
3813                         dflt="$dflt -posix"
3814                 fi
3815                 ;;
3816         esac
3817         case "$gccversion" in
3818         1*) ;;
3819         2.[0-8]*) ;;
3820         ?*)     echo " "
3821                 echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
3822                 echo 'int main(void) { return 0; }' > gcctest.c
3823                 if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
3824                         echo "Yes, it does." 2>&1
3825                         case "$ccflags" in
3826                         *strict-aliasing*) 
3827                                 echo "Leaving current flags $ccflags alone." 2>&1
3828                                 ;;
3829                         *) dflt="$dflt -fno-strict-aliasing" ;;
3830                         esac
3831                 else
3832                         echo "Nope, it doesn't, but that's ok." 2>&1
3833                 fi
3834                 ;;
3835         esac
3836         ;;
3837 esac
3838
3839 case "$mips_type" in
3840 *BSD*|'') inclwanted="$locincpth $usrinc";;
3841 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
3842 esac
3843 for thisincl in $inclwanted; do
3844         if $test -d $thisincl; then
3845                 if $test x$thisincl != x$usrinc; then
3846                         case "$dflt" in
3847                         *" -I$thisincl "*);;
3848                         *) dflt="$dflt -I$thisincl ";;
3849                         esac
3850                 fi
3851         fi
3852 done
3853
3854 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
3855         xxx=true;
3856 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
3857         xxx=true;
3858 else
3859         xxx=false;
3860 fi;
3861 if $xxx; then
3862         case "$dflt" in
3863         *$2*);;
3864         *) dflt="$dflt -D$2";;
3865         esac;
3866 fi'
3867
3868 set signal.h LANGUAGE_C; eval $inctest
3869
3870 case "$usesocks" in
3871 $define)
3872         ccflags="$ccflags -DSOCKS"
3873         ;;
3874 esac
3875
3876 case "$hint" in
3877 default|recommended) dflt="$ccflags $dflt" ;;
3878 *) dflt="$ccflags";;
3879 esac
3880
3881 case "$dflt" in
3882 ''|' ') dflt=none;;
3883 esac
3884
3885 $cat <<EOH
3886
3887 Your C compiler may want other flags.  For this question you should include
3888 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
3889 but you should NOT include libraries or ld flags like -lwhatever.  If you
3890 want $package to honor its debug switch, you should include -DDEBUGGING here.
3891 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
3892
3893 To use no flags, specify the word "none".
3894
3895 EOH
3896 set X $dflt
3897 shift
3898 dflt=${1+"$@"}
3899 rp="Any additional cc flags?"
3900 . ./myread
3901 case "$ans" in
3902 none) ccflags='';;
3903 *) ccflags="$ans";;
3904 esac
3905
3906 : the following weeds options from ccflags that are of no interest to cpp
3907 cppflags="$ccflags"
3908 case "$gccversion" in
3909 1*) cppflags="$cppflags -D__GNUC__"
3910 esac
3911 case "$mips_type" in
3912 '');;
3913 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
3914 esac
3915 case "$cppflags" in
3916 '');;
3917 *)
3918         echo " "
3919         echo "Let me guess what the preprocessor flags are..." >&4
3920         set X $cppflags
3921         shift
3922         cppflags=''
3923         $cat >cpp.c <<'EOM'
3924 #define BLURFL foo
3925
3926 BLURFL xx LFRULB
3927 EOM
3928         previous=''
3929         for flag in $*
3930         do
3931                 case "$flag" in
3932                 -*) ftry="$flag";;
3933                 *) ftry="$previous $flag";;
3934                 esac
3935                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
3936                         >cpp1.out 2>/dev/null && \
3937                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
3938                         >cpp2.out 2>/dev/null && \
3939                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
3940                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
3941                 then
3942                         cppflags="$cppflags $ftry"
3943                         previous=''
3944                 else
3945                         previous="$flag"
3946                 fi
3947         done
3948         set X $cppflags
3949         shift
3950         cppflags=${1+"$@"}
3951         case "$cppflags" in
3952         *-*)  echo "They appear to be: $cppflags";;
3953         esac
3954         $rm -f cpp.c cpp?.out
3955         ;;
3956 esac
3957
3958 : flags used in final linking phase
3959 case "$ldflags" in
3960 '') if ./venix; then
3961                 dflt='-i -z'
3962         else
3963                 dflt=''
3964         fi
3965         case "$ccflags" in
3966         *-posix*) dflt="$dflt -posix" ;;
3967         esac
3968         ;;
3969 *) dflt="$ldflags";;
3970 esac
3971
3972 : Try to guess additional flags to pick up local libraries.
3973 for thislibdir in $libpth; do
3974         case " $loclibpth " in
3975         *" $thislibdir "*)
3976                 case "$dflt " in 
3977                 *"-L$thislibdir "*) ;;
3978                 *)  dflt="$dflt -L$thislibdir" ;;
3979                 esac
3980                 ;;
3981         esac
3982 done
3983
3984 case "$dflt" in
3985 '') dflt='none' ;;
3986 esac
3987
3988 $cat <<EOH
3989
3990 Your C linker may need flags.  For this question you should
3991 include -L/whatever and any other flags used by the C linker, but you
3992 should NOT include libraries like -lwhatever.
3993
3994 Make sure you include the appropriate -L/path flags if your C linker
3995 does not normally search all of the directories you specified above,
3996 namely
3997         $libpth
3998 To use no flags, specify the word "none".
3999
4000 EOH
4001
4002 rp="Any additional ld flags (NOT including libraries)?"
4003 . ./myread
4004 case "$ans" in
4005 none) ldflags='';;
4006 *) ldflags="$ans";;
4007 esac
4008 rmlist="$rmlist pdp11"
4009
4010 : coherency check
4011 echo " "
4012 echo "Checking your choice of C compiler and flags for coherency..." >&4
4013 $cat > try.c <<'EOF'
4014 #include <stdio.h>
4015 int main() { printf("Ok\n"); exit(0); }
4016 EOF
4017 set X $cc $optimize $ccflags -o try $ldflags try.c $libs
4018 shift
4019 $cat >try.msg <<'EOM'
4020 I've tried to compile and run the following simple program:
4021
4022 EOM
4023 $cat try.c >> try.msg
4024
4025 $cat >> try.msg <<EOM
4026
4027 I used the command:
4028
4029         $*
4030         ./try
4031
4032 and I got the following output:
4033
4034 EOM
4035 dflt=y
4036 if sh -c "$cc $optimize $ccflags -o try $ldflags try.c $libs" >>try.msg 2>&1; then
4037         if sh -c './try' >>try.msg 2>&1; then
4038                 xxx=`./try`
4039                 case "$xxx" in
4040                 "Ok") dflt=n ;;
4041                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
4042                         case " $libs " in
4043                         *" -lsfio "*)
4044                                 cat >> try.msg <<'EOQS'
4045 If $libs contains -lsfio, and sfio is mis-configured, then it
4046 sometimes (apparently) runs and exits with a 0 status, but with no
4047 output!  It may have to do with sfio's use of _exit vs. exit.
4048
4049 EOQS
4050                                 rp="You have a big problem.  Shall I abort Configure"
4051                                 dflt=y
4052                                 ;;
4053                         esac
4054                         ;;
4055                 esac
4056         else
4057                 echo "The program compiled OK, but exited with status $?." >>try.msg
4058                 rp="You have a problem.  Shall I abort Configure"
4059                 dflt=y
4060         fi
4061 else
4062         echo "I can't compile the test program." >>try.msg
4063         rp="You have a BIG problem.  Shall I abort Configure"
4064         dflt=y
4065 fi
4066 case "$dflt" in
4067 y)
4068         $cat try.msg >&4
4069         case "$knowitall" in
4070         '')
4071                 echo "(The supplied flags or libraries might be incorrect.)"
4072                 ;;
4073         *) dflt=n;;
4074         esac
4075         echo " "
4076         . ./myread
4077         case "$ans" in
4078         n*|N*) ;;
4079         *)      echo "Ok.  Stopping Configure." >&4
4080                 exit 1
4081                 ;;
4082         esac
4083         ;;
4084 n) echo "OK, that should do.";;
4085 esac
4086 $rm -f try try.* core
4087
4088 : define an is-a-typedef? function
4089 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
4090 case "$inclist" in
4091 "") inclist="sys/types.h";;
4092 esac;
4093 eval "varval=\$$var";
4094 case "$varval" in
4095 "")
4096         $rm -f temp.c;
4097         for inc in $inclist; do
4098                 echo "#include <$inc>" >>temp.c;
4099         done;
4100         echo "#ifdef $type" >> temp.c;
4101         echo "printf(\"We have $type\");" >> temp.c;
4102         echo "#endif" >> temp.c;
4103         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
4104         if $contains $type temp.E >/dev/null 2>&1; then
4105                 eval "$var=\$type";
4106         else
4107                 eval "$var=\$def";
4108         fi;
4109         $rm -f temp.?;;
4110 *) eval "$var=\$varval";;
4111 esac'
4112
4113 : define an is-a-typedef? function that prompts if the type is not available.
4114 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
4115 case "$inclist" in
4116 "") inclist="sys/types.h";;
4117 esac;
4118 eval "varval=\$$var";
4119 case "$varval" in
4120 "")
4121         $rm -f temp.c;
4122         for inc in $inclist; do
4123                 echo "#include <$inc>" >>temp.c;
4124         done;
4125         echo "#ifdef $type" >> temp.c;
4126         echo "printf(\"We have $type\");" >> temp.c;
4127         echo "#endif" >> temp.c;
4128         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
4129         echo " " ;
4130         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
4131         if $contains $type temp.E >/dev/null 2>&1; then
4132                 echo "$type found." >&4;
4133                 eval "$var=\$type";
4134         else
4135                 echo "$type NOT found." >&4;
4136                 dflt="$def";
4137                 . ./myread ;
4138                 eval "$var=\$ans";
4139         fi;
4140         $rm -f temp.?;;
4141 *) eval "$var=\$varval";;
4142 esac'
4143
4144 : define a shorthand compile call
4145 compile='
4146 mc_file=$1;
4147 shift;
4148 $cc $optimize $ccflags $ldflags -o ${mc_file} $* ${mc_file}.c $libs > /dev/null 2>&1;'
4149 : define a shorthand compile call for compilations that should be ok.
4150 compile_ok='
4151 mc_file=$1;
4152 shift;
4153 $cc $optimize $ccflags $ldflags -o ${mc_file} $* ${mc_file}.c $libs;'
4154
4155 : check for lengths of integral types
4156 echo " "
4157 case "$intsize" in
4158 '')
4159         echo "Checking to see how big your integers are..." >&4
4160         $cat >intsize.c <<'EOCP'
4161 #include <stdio.h>
4162 int main()
4163 {
4164         printf("intsize=%d;\n", (int)sizeof(int));
4165         printf("longsize=%d;\n", (int)sizeof(long));
4166         printf("shortsize=%d;\n", (int)sizeof(short));
4167         exit(0);
4168 }
4169 EOCP
4170         set intsize
4171         if eval $compile_ok && ./intsize > /dev/null; then
4172                 eval `./intsize`
4173                 echo "Your integers are $intsize bytes long."
4174                 echo "Your long integers are $longsize bytes long."
4175                 echo "Your short integers are $shortsize bytes long."
4176         else
4177                 $cat >&4 <<EOM
4178 !
4179 Help! I can't compile and run the intsize test program: please enlighten me!
4180 (This is probably a misconfiguration in your system or libraries, and
4181 you really ought to fix it.  Still, I'll try anyway.)
4182 !
4183 EOM
4184                 dflt=4
4185                 rp="What is the size of an integer (in bytes)?"
4186                 . ./myread
4187                 intsize="$ans"
4188                 dflt=$intsize
4189                 rp="What is the size of a long integer (in bytes)?"
4190                 . ./myread
4191                 longsize="$ans"
4192                 dflt=2
4193                 rp="What is the size of a short integer (in bytes)?"
4194                 . ./myread
4195                 shortsize="$ans"
4196         fi
4197         ;;
4198 esac
4199 $rm -f intsize intsize.*
4200
4201 : see what type lseek is declared as in the kernel
4202 rp="What is the type used for lseek's offset on this system?"
4203 set off_t lseektype long stdio.h sys/types.h
4204 eval $typedef_ask
4205
4206 echo " "
4207 echo "Checking to see how big your file offsets are..." >&4
4208 $cat >try.c <<EOCP
4209 #include <sys/types.h>
4210 #include <stdio.h>
4211 int main()
4212 {
4213     printf("%d\n", (int)sizeof($lseektype));
4214     return(0); 
4215 }
4216 EOCP
4217 set try
4218 if eval $compile_ok; then
4219         lseeksize=`./try`
4220         echo "Your file offsets are $lseeksize bytes long."
4221 else
4222         dflt=$longsize
4223         echo " "
4224         echo "(I can't seem to compile the test program.  Guessing...)"
4225         rp="What is the size of your file offsets (in bytes)?"
4226         . ./myread
4227         lseeksize="$ans"
4228 fi
4229 $rm -f try.c try
4230
4231 : see what type file positions are declared as in the library
4232 rp="What is the type for file position used by fsetpos()?"
4233 set fpos_t fpostype long stdio.h sys/types.h
4234 eval $typedef_ask
4235
4236 echo " "
4237 case "$fpostype" in
4238 *_t) zzz="$fpostype"    ;;
4239 *)   zzz="fpos_t"       ;;
4240 esac
4241 echo "Checking the size of $zzz..." >&4 
4242 cat > try.c <<EOCP
4243 #include <sys/types.h>
4244 #include <stdio.h>
4245 int main() {
4246     printf("%d\n", (int)sizeof($fpostype));
4247     exit(0);
4248 }
4249 EOCP
4250 set try
4251 if eval $compile_ok; then
4252         yyy=`./try`
4253         case "$yyy" in
4254         '')     fpossize=4
4255                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
4256                 ;;
4257         *)      fpossize=$yyy
4258                 echo "Your $zzz is $fpossize bytes long."
4259                 ;;
4260         esac
4261 else
4262         dflt="$longsize"
4263         echo " " >&4
4264         echo "(I can't compile the test program.  Guessing...)" >&4
4265         rp="What is the size of your file positions (in bytes)?"
4266         . ./myread
4267         fpossize="$ans"
4268 fi
4269
4270
4271
4272 # Backward compatibility (uselfs is deprecated).
4273 case "$uselfs" in
4274 "$define"|true|[yY]*)
4275         cat <<EOM >&4
4276
4277 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
4278 EOM
4279         uselargefiles="$define"
4280         ;;
4281 esac                          
4282
4283 case "$lseeksize:$fpossize" in
4284 8:8) cat <<EOM
4285
4286 You can have files larger than 2 gigabytes.
4287 EOM
4288    val="$define" ;;
4289 *)    case "$uselargefiles" in
4290    "$undef"|false|[nN]*) dflt='n' ;;
4291    *)   dflt='y' ;;
4292    esac
4293    cat <<EOM
4294
4295 Perl can be built to understand large files (files larger than 2 gigabytes)
4296 on some systems.  To do so, Configure can be run with -Duselargefiles.
4297
4298 If this doesn't make any sense to you, just accept the default '$dflt'.
4299 EOM
4300    rp='Try to understand large files, if available?'
4301    . ./myread
4302    case "$ans" in
4303    y|Y)         val="$define" ;;
4304    *)           val="$undef"  ;;
4305    esac
4306    ;;
4307 esac
4308 set uselargefiles
4309 eval $setvar
4310 case "$uselargefiles" in
4311 "$define")
4312 : Look for a hint-file generated 'call-back-unit'.  If the
4313 : user has specified that a large files perl is to be built,
4314 : we may need to set or change some other defaults.
4315         if $test -f uselargefiles.cbu; then
4316                 echo "Your platform has some specific hints for large file builds, using them..."
4317                 . ./uselargefiles.cbu
4318                 echo " "
4319                 echo "Rechecking to see how big your file offsets are..." >&4
4320                 $cat >try.c <<EOCP
4321 #include <sys/types.h>
4322 #include <stdio.h>
4323 int main()
4324 {
4325     printf("%d\n", (int)sizeof($lseektype));
4326     return(0); 
4327 }
4328 EOCP
4329                 set try
4330                 if eval $compile_ok; then
4331                         lseeksize=`./try`
4332                         $echo "Your file offsets are now $lseeksize bytes long."
4333                 else
4334                         dflt="$lseeksize"
4335                         echo " "
4336                         echo "(I can't seem to compile the test program.  Guessing...)"
4337                         rp="What is the size of your file offsets (in bytes)?"
4338                         . ./myread
4339                         lseeksize="$ans"
4340                 fi
4341                 case "$fpostype" in
4342                 *_t) zzz="$fpostype"    ;;
4343                 *)   zzz="fpos_t"       ;;
4344                 esac
4345                 $echo $n "Rechecking the size of $zzz...$c" >&4 
4346                 $cat > try.c <<EOCP
4347 #include <sys/types.h>
4348 #include <stdio.h>
4349 int main() {
4350     printf("%d\n", (int)sizeof($fpostype));
4351     exit(0);
4352 }
4353 EOCP
4354                 set try
4355                 if eval $compile_ok; then
4356                         yyy=`./try`
4357                         dflt="$lseeksize"
4358                         case "$yyy" in
4359                         '')     echo " "
4360                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
4361                                 ;;
4362                         *)      fpossize=$yyy
4363                                 echo " $fpossize bytes." >&4
4364                                 ;;
4365                         esac
4366                 else
4367                         dflt="$fpossize"
4368                         echo " "
4369                         echo "(I can't compile the test program.  Guessing...)" >&4
4370                         rp="What is the size of your file positions (in bytes)?"
4371                         . ./myread
4372                         fpossize="$ans"
4373                 fi
4374                 $rm -f try.c try
4375         fi
4376         ;;
4377 esac
4378
4379
4380 case "$usemorebits" in
4381 "$define"|true|[yY]*)
4382         use64bitint="$define"
4383         uselongdouble="$define"
4384         usemorebits="$define"
4385         ;;
4386 *)      usemorebits="$undef"
4387         ;;
4388 esac
4389
4390
4391 case "$uselonglong" in
4392 "$define"|true|[yY]*)
4393         cat <<EOM >&4
4394
4395 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
4396 EOM
4397         use64bitint="$define"
4398         ;;
4399 esac                          
4400 case "$use64bits" in
4401 "$define"|true|[yY]*)
4402         cat <<EOM >&4
4403
4404 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
4405 EOM
4406         use64bitint="$define"
4407         ;;
4408 esac                          
4409 case "$use64bitints" in
4410 "$define"|true|[yY]*)
4411         cat <<EOM >&4
4412
4413 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
4414 EOM
4415         use64bitint="$define"
4416         ;;
4417 esac                          
4418 case "$use64bitsint" in
4419 "$define"|true|[yY]*)
4420         cat <<EOM >&4
4421
4422 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
4423 EOM
4424         use64bitint="$define"
4425         ;;
4426 esac                          
4427 case "$uselonglongs" in
4428 "$define"|true|[yY]*)
4429         cat <<EOM >&4
4430
4431 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
4432 EOM
4433         use64bitint="$define"
4434         ;;
4435 esac                          
4436 case "$use64bitsall" in
4437 "$define"|true|[yY]*)
4438         cat <<EOM >&4
4439
4440 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
4441 EOM
4442         use64bitall="$define"
4443         ;;
4444 esac                          
4445
4446 case "$ccflags" in
4447 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
4448 esac
4449 case "$use64bitall" in
4450 "$define"|true|[yY]*) use64bitint="$define" ;;
4451 esac
4452
4453 case "$longsize" in
4454 8) cat <<EOM
4455
4456 You have natively 64-bit long integers.
4457 EOM
4458    val="$define"
4459    ;;
4460 *) case "$use64bitint" in
4461    "$define"|true|[yY]*) dflt='y';;
4462    *) dflt='n';;
4463    esac
4464    cat <<EOM
4465
4466 Perl can be built to take advantage of 64-bit integer types
4467 on some systems.  To do so, Configure can be run with -Duse64bitint.
4468 Choosing this option will most probably introduce binary incompatibilities.
4469
4470 If this doesn't make any sense to you, just accept the default '$dflt'.
4471 EOM
4472    rp='Try to use 64-bit integers, if available?'
4473    . ./myread
4474    case "$ans" in
4475    [yY]*) val="$define" ;;
4476    *)     val="$undef"  ;;
4477    esac
4478    ;;
4479 esac
4480 set use64bitint
4481 eval $setvar
4482
4483 case "$use64bitall" in
4484 "$define"|true|[yY]*) dflt='y' ;;
4485 *) case "$longsize" in
4486    8) dflt='y' ;;
4487    *) dflt='n' ;;
4488    esac
4489    ;;
4490 esac    
4491 cat <<EOM
4492
4493 You may also choose to try maximal 64-bitness.  It means using as much
4494 64-bitness as possible on the platform.  This in turn means even more
4495 binary incompatibilities.  On the other hand, your platform may not
4496 have any more 64-bitness available than what you already have chosen.
4497
4498 If this doesn't make any sense to you, just accept the default '$dflt'.
4499 EOM
4500 rp='Try to use maximal 64-bit support, if available?'
4501 . ./myread
4502 case "$ans" in
4503 [yY]*) val="$define" ;;
4504 *)     val="$undef"  ;;
4505 esac
4506 set use64bitall
4507 eval $setvar
4508 case "$use64bitall" in
4509 "$define")
4510         case "$use64bitint" in
4511         "$undef")
4512                 cat <<EOM
4513
4514 Since you have chosen a maximally 64-bit build, I'm also turning on
4515 the use of 64-bit integers.
4516 EOM
4517                 use64bitint="$define" ;;
4518         esac
4519         ;;
4520 esac
4521
4522 case "$use64bitint" in
4523 "$define"|true|[yY]*)
4524 : Look for a hint-file generated 'call-back-unit'.  If the
4525 : user has specified that a 64-bit perl is to be built,
4526 : we may need to set or change some other defaults.
4527         if $test -f use64bitint.cbu; then
4528                 echo "Your platform has some specific hints for 64-bit integers, using them..."
4529                 . ./use64bitint.cbu
4530         fi
4531         case "$longsize" in
4532         4) case "$archname64" in
4533            '') archname64=64int ;;
4534            esac
4535            ;;
4536         esac
4537         ;;
4538 esac
4539
4540 case "$use64bitall" in
4541 "$define"|true|[yY]*)
4542 : Look for a hint-file generated 'call-back-unit'.  If the
4543 : user has specified that a maximally 64-bit perl is to be built,
4544 : we may need to set or change some other defaults.
4545         if $test -f use64bitall.cbu; then
4546                 echo "Your platform has some specific hints for 64-bit builds, using them..."
4547                 . ./use64bitall.cbu
4548         fi
4549         case "$longsize" in
4550         4) case "$archname64" in
4551            ''|64int) archname64=64all ;;
4552            esac
4553            ;;
4554         esac
4555         ;;
4556 esac
4557
4558 echo " "
4559 echo "Checking for GNU C Library..." >&4
4560 cat >gnulibc.c <<EOM
4561 #include <stdio.h>
4562 int main()
4563 {
4564 #ifdef __GLIBC__
4565     exit(0);
4566 #else
4567     exit(1);
4568 #endif
4569 }
4570 EOM
4571 set gnulibc
4572 if eval $compile_ok && ./gnulibc; then
4573         val="$define"
4574         echo "You are using the GNU C Library"
4575 else
4576         val="$undef"
4577         echo "You are not using the GNU C Library"
4578 fi
4579 $rm -f gnulibc*
4580 set d_gnulibc
4581 eval $setvar
4582
4583 : see if nm is to be used to determine whether a symbol is defined or not
4584 case "$usenm" in
4585 '')
4586         dflt=''
4587         case "$d_gnulibc" in
4588         "$define")
4589                 echo " "
4590                 echo "nm probably won't work on the GNU C Library." >&4
4591                 dflt=n
4592                 ;;
4593         esac
4594         case "$dflt" in
4595         '') 
4596                 if $test "$osname" = aix -a ! -f /lib/syscalls.exp; then
4597                         echo " "
4598                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
4599                         echo "'nm' won't be sufficient on this sytem." >&4
4600                         dflt=n
4601                 fi
4602                 ;;
4603         esac
4604         case "$dflt" in
4605         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
4606                 if $test $dflt -gt 20; then
4607                         dflt=y
4608                 else
4609                         dflt=n
4610                 fi
4611                 ;;
4612         esac
4613         ;;
4614 *)
4615         case "$usenm" in
4616         true|$define) dflt=y;;
4617         *) dflt=n;;
4618         esac
4619         ;;
4620 esac
4621 $cat <<EOM
4622
4623 I can use $nm to extract the symbols from your C libraries. This
4624 is a time consuming task which may generate huge output on the disk (up
4625 to 3 megabytes) but that should make the symbols extraction faster. The
4626 alternative is to skip the 'nm' extraction part and to compile a small
4627 test program instead to determine whether each symbol is present. If
4628 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
4629 this may be the best solution.
4630
4631 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
4632
4633 EOM
4634 rp="Shall I use $nm to extract C symbols from the libraries?"
4635 . ./myread
4636 case "$ans" in
4637 [Nn]*) usenm=false;;
4638 *) usenm=true;;
4639 esac
4640
4641 runnm=$usenm
4642 case "$reuseval" in
4643 true) runnm=false;;
4644 esac
4645
4646 : nm options which may be necessary
4647 case "$nm_opt" in
4648 '') if $test -f /mach_boot; then
4649                 nm_opt=''       # Mach
4650         elif $test -d /usr/ccs/lib; then
4651                 nm_opt='-p'     # Solaris (and SunOS?)
4652         elif $test -f /dgux; then
4653                 nm_opt='-p'     # DG-UX
4654         elif $test -f /lib64/rld; then
4655                 nm_opt='-p'     # 64-bit Irix
4656         else
4657                 nm_opt=''
4658         fi;;
4659 esac
4660
4661 : nm options which may be necessary for shared libraries but illegal
4662 : for archive libraries.  Thank you, Linux.
4663 case "$nm_so_opt" in
4664 '')     case "$myuname" in
4665         *linux*)
4666                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
4667                         nm_so_opt='--dynamic'
4668                 fi
4669                 ;;
4670         esac
4671         ;;
4672 esac
4673
4674 case "$runnm" in
4675 true)
4676 : get list of predefined functions in a handy place
4677 echo " "
4678 case "$libc" in
4679 '') libc=unknown
4680         case "$libs" in
4681         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
4682         esac
4683         ;;
4684 esac
4685 libnames='';
4686 case "$libs" in
4687 '') ;;
4688 *)  for thislib in $libs; do
4689         case "$thislib" in
4690         -lc|-lc_s)
4691                 : Handle C library specially below.
4692                 ;;
4693         -l*)
4694                 thislib=`echo $thislib | $sed -e 's/^-l//'`
4695                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
4696                         :
4697                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
4698                         :
4699                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
4700                         :
4701                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
4702                         :
4703                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
4704                         :
4705                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
4706                         :
4707                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
4708                         :
4709                 else
4710                         try=''
4711                 fi
4712                 libnames="$libnames $try"
4713                 ;;
4714         *) libnames="$libnames $thislib" ;;
4715         esac
4716         done
4717         ;;
4718 esac
4719 xxx=normal
4720 case "$libc" in
4721 unknown)
4722         set /lib/libc.$so
4723         for xxx in $libpth; do
4724                 $test -r $1 || set $xxx/libc.$so
4725                 : The messy sed command sorts on library version numbers.
4726                 $test -r $1 || \
4727                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
4728                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
4729                                 h
4730                                 s/[0-9][0-9]*/0000&/g
4731                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
4732                                 G
4733                                 s/\n/ /' | \
4734                          sort | $sed -e 's/^.* //'`
4735                 eval set \$$#
4736         done
4737         $test -r $1 || set /usr/ccs/lib/libc.$so
4738         $test -r $1 || set /lib/libsys_s$_a
4739         ;;
4740 *)
4741         set blurfl
4742         ;;
4743 esac
4744 if $test -r "$1"; then
4745         echo "Your (shared) C library seems to be in $1."
4746         libc="$1"
4747 elif $test -r /lib/libc && $test -r /lib/clib; then
4748         echo "Your C library seems to be in both /lib/clib and /lib/libc."
4749         xxx=apollo
4750         libc='/lib/clib /lib/libc'
4751         if $test -r /lib/syslib; then
4752                 echo "(Your math library is in /lib/syslib.)"
4753                 libc="$libc /lib/syslib"
4754         fi
4755 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
4756         echo "Your C library seems to be in $libc, as you said before."
4757 elif $test -r $incpath/usr/lib/libc$_a; then
4758         libc=$incpath/usr/lib/libc$_a;
4759         echo "Your C library seems to be in $libc.  That's fine."
4760 elif $test -r /lib/libc$_a; then
4761         libc=/lib/libc$_a;
4762         echo "Your C library seems to be in $libc.  You're normal."
4763 else
4764         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
4765                 :
4766         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
4767                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
4768         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
4769                 :
4770         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
4771                 :
4772         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
4773                 :
4774         else
4775                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
4776         fi
4777         if $test -r "$tans"; then
4778                 echo "Your C library seems to be in $tans, of all places."
4779                 libc=$tans
4780         else
4781                 libc='blurfl'
4782         fi
4783 fi
4784 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
4785         dflt="$libc"
4786         cat <<EOM
4787
4788 If the guess above is wrong (which it might be if you're using a strange
4789 compiler, or your machine supports multiple models), you can override it here.
4790
4791 EOM
4792 else
4793         dflt=''
4794         echo $libpth | tr ' ' $trnl | sort | uniq > libpath
4795         cat >&4 <<EOM
4796 I can't seem to find your C library.  I've looked in the following places:
4797
4798 EOM
4799         $sed 's/^/      /' libpath
4800         cat <<EOM
4801
4802 None of these seems to contain your C library. I need to get its name...
4803
4804 EOM
4805 fi
4806 fn=f
4807 rp='Where is your C library?'
4808 . ./getfile
4809 libc="$ans"
4810
4811 echo " "
4812 echo $libc $libnames | tr ' ' $trnl | sort | uniq > libnames
4813 set X `cat libnames`
4814 shift
4815 xxx=files
4816 case $# in 1) xxx=file; esac
4817 echo "Extracting names from the following $xxx for later perusal:" >&4
4818 echo " "
4819 $sed 's/^/      /' libnames >&4
4820 echo " "
4821 $echo $n "This may take a while...$c" >&4
4822
4823 for file in $*; do
4824         case $file in
4825         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
4826         *) $nm $nm_opt $file 2>/dev/null;;
4827         esac
4828 done >libc.tmp
4829
4830 $echo $n ".$c"
4831 $grep fprintf libc.tmp > libc.ptf
4832 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
4833 xrun='eval "<libc.tmp $com >libc.list"; echo "done" >&4'
4834 xxx='[ADTSIW]'
4835 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *_[_.]*//p' -e 's/^.* $xxx  *//p'";\
4836         eval $xscan;\
4837         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4838                 eval $xrun
4839 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
4840         eval $xscan;\
4841         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4842                 eval $xrun
4843 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
4844         eval $xscan;\
4845         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4846                 eval $xrun
4847 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
4848         eval $xscan;\
4849         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4850                 eval $xrun
4851 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
4852         eval $xscan;\
4853         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4854                 eval $xrun
4855 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
4856         eval $xscan;\
4857         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4858                 eval $xrun
4859 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
4860                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
4861         eval $xscan;\
4862         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4863                 eval $xrun
4864 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
4865         eval $xscan;\
4866         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4867                 eval $xrun
4868 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
4869         eval $xscan;\
4870         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4871                 eval $xrun
4872 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
4873         eval $xscan;\
4874         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4875                 eval $xrun
4876 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
4877         eval $xscan;\
4878         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4879                 eval $xrun
4880 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
4881         eval $xscan;\
4882         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4883                 eval $xrun
4884 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
4885         eval $xscan;\
4886         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4887                 eval $xrun
4888 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
4889         eval $xscan;\
4890         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4891                 eval $xrun
4892 else
4893         $nm -p $* 2>/dev/null >libc.tmp
4894         $grep fprintf libc.tmp > libc.ptf
4895         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
4896                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
4897         then
4898                 nm_opt='-p'
4899                 eval $xrun
4900         else
4901                 echo " "
4902                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
4903                 com=''
4904                 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
4905                         for thisname in $libnames $libc; do
4906                                 $ar t $thisname >>libc.tmp
4907                         done
4908                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
4909                         echo "Ok." >&4
4910                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
4911                         # Repeat libc to extract forwarders to DLL entries too
4912                         for thisname in $libnames $libc; do
4913                                 $ar tv $thisname >>libc.tmp
4914                                 # Revision 50 of EMX has bug in $ar.
4915                                 # it will not extract forwarders to DLL entries
4916                                 # Use emximp which will extract exactly them.
4917                                 emximp -o tmp.imp $thisname \
4918                                     2>/dev/null && \
4919                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
4920                                     < tmp.imp >>libc.tmp
4921                                 $rm tmp.imp
4922                         done
4923                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
4924                         echo "Ok." >&4
4925                 else
4926                         echo "$ar didn't seem to work right." >&4
4927                         echo "Maybe this is a Cray...trying bld instead..." >&4
4928                         if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
4929                         then
4930                                 for thisname in $libnames; do
4931                                         bld t $libnames | \
4932                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
4933                                         $ar t $thisname >>libc.tmp
4934                                 done
4935                                 echo "Ok." >&4
4936                         else
4937                                 echo "That didn't work either.  Giving up." >&4
4938                                 exit 1
4939                         fi
4940                 fi
4941         fi
4942 fi
4943 nm_extract="$com"
4944 if $test -f /lib/syscalls.exp; then
4945         echo " "
4946         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
4947         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*$/\1/p' /lib/syscalls.exp >>libc.list
4948 fi
4949 ;;
4950 esac
4951 $rm -f libnames libpath
4952
4953 : is a C symbol defined?
4954 csym='tlook=$1;
4955 case "$3" in
4956 -v) tf=libc.tmp; tc=""; tdc="";;
4957 -a) tf=libc.tmp; tc="[0]"; tdc="[]";;
4958 *) tlook="^$1\$"; tf=libc.list; tc="()"; tdc="()";;
4959 esac;
4960 tx=yes;
4961 case "$reuseval-$4" in
4962 true-) ;;
4963 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
4964 esac;
4965 case "$tx" in
4966 yes)
4967         case "$runnm" in
4968         true)
4969                 if $contains $tlook $tf >/dev/null 2>&1;
4970                 then tval=true;
4971                 else tval=false;
4972                 fi;;
4973         *)
4974                 echo "int main() { extern short $1$tdc; printf(\"%hd\", $1$tc); }" > t.c;
4975                 if $cc $optimize $ccflags $ldflags -o t t.c $libs >/dev/null 2>&1;
4976                 then tval=true;
4977                 else tval=false;
4978                 fi;
4979                 $rm -f t t.c;;
4980         esac;;
4981 *)
4982         case "$tval" in
4983         $define) tval=true;;
4984         *) tval=false;;
4985         esac;;
4986 esac;
4987 eval "$2=$tval"'
4988
4989 : define an is-in-libc? function
4990 inlibc='echo " "; td=$define; tu=$undef;
4991 sym=$1; var=$2; eval "was=\$$2";
4992 tx=yes;
4993 case "$reuseval$was" in
4994 true) ;;
4995 true*) tx=no;;
4996 esac;
4997 case "$tx" in
4998 yes)
4999         set $sym tres -f;
5000         eval $csym;
5001         case "$tres" in
5002         true)
5003                 echo "$sym() found." >&4;
5004                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
5005         *)
5006                 echo "$sym() NOT found." >&4;
5007                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
5008         esac;;
5009 *)
5010         case "$was" in
5011         $define) echo "$sym() found." >&4;;
5012         *) echo "$sym() NOT found." >&4;;
5013         esac;;
5014 esac'
5015
5016 : see if sqrtl exists
5017 set sqrtl d_sqrtl
5018 eval $inlibc
5019
5020 case "$ccflags" in
5021 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
5022 esac
5023
5024 case "$uselongdouble" in
5025 $define|true|[yY]*)     dflt='y';;
5026 *) dflt='n';;
5027 esac
5028 cat <<EOM
5029
5030 Perl can be built to take advantage of long doubles which
5031 (if available) may give more accuracy and range for floating point numbers.
5032
5033 If this doesn't make any sense to you, just accept the default '$dflt'.
5034 EOM
5035 rp='Try to use long doubles if available?'
5036 . ./myread
5037 case "$ans" in
5038 y|Y)    val="$define"   ;;
5039 *)      val="$undef"    ;;
5040 esac
5041 set uselongdouble
5042 eval $setvar
5043
5044 case "$uselongdouble" in
5045 true|[yY]*) uselongdouble="$define" ;;
5046 esac
5047
5048 case "$uselongdouble" in
5049 $define)
5050 : Look for a hint-file generated 'call-back-unit'.  If the
5051 : user has specified that long doubles should be used,
5052 : we may need to set or change some other defaults.
5053         if $test -f uselongdouble.cbu; then
5054                 echo "Your platform has some specific hints for long doubles, using them..."
5055                 . ./uselongdouble.cbu
5056         else
5057                 $cat <<EOM
5058 (Your platform doesn't have any specific hints for long doubles.)
5059 EOM
5060         fi
5061         ;;
5062 esac
5063
5064 case "$uselongdouble:$d_sqrtl" in
5065 $define:$undef)
5066                 $cat <<EOM >&4
5067
5068 *** You requested the use of long doubles but you do not seem to have
5069 *** the mathematic functions for long doubles.  I'm disabling the use
5070 *** of long doubles.
5071
5072 EOM
5073         uselongdouble=$undef
5074         ;;
5075 esac
5076
5077 : check for length of double
5078 echo " "
5079 case "$doublesize" in
5080 '')
5081         echo "Checking to see how big your double precision numbers are..." >&4
5082         $cat >try.c <<'EOCP'
5083 #include <stdio.h>
5084 int main()
5085 {
5086     printf("%d\n", (int)sizeof(double));
5087     exit(0);
5088 }
5089 EOCP
5090         set try
5091         if eval $compile_ok; then
5092                 doublesize=`./try`
5093                 echo "Your double is $doublesize bytes long."
5094         else
5095                 dflt='8'
5096                 echo "(I can't seem to compile the test program.  Guessing...)"
5097                 rp="What is the size of a double precision number (in bytes)?"
5098                 . ./myread
5099                 doublesize="$ans"
5100         fi
5101         ;;
5102 esac
5103 $rm -f try.c try
5104
5105 : check for long doubles
5106 echo " "
5107 echo "Checking to see if you have long double..." >&4
5108 echo 'int main() { long double x = 7.0; }' > try.c
5109 set try
5110 if eval $compile; then
5111         val="$define"
5112         echo "You have long double."
5113 else
5114         val="$undef"
5115         echo "You do not have long double."
5116 fi
5117 $rm try.*
5118 set d_longdbl
5119 eval $setvar
5120
5121 : check for length of long double
5122 case "${d_longdbl}${longdblsize}" in
5123 $define)
5124         echo " "
5125         echo "Checking to see how big your long doubles are..." >&4
5126         $cat >try.c <<'EOCP'
5127 #include <stdio.h>
5128 int main()
5129 {
5130         printf("%d\n", sizeof(long double));
5131 }
5132 EOCP
5133         set try
5134         set try
5135         if eval $compile; then
5136                 longdblsize=`./try$exe_ext`
5137                 echo "Your long doubles are $longdblsize bytes long."
5138         else
5139                 dflt='8'
5140                 echo " "
5141                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
5142                 rp="What is the size of a long double (in bytes)?"
5143                 . ./myread
5144                 longdblsize="$ans"
5145         fi
5146         if $test "X$doublesize" = "X$longdblsize"; then
5147                 echo "(That isn't any different from an ordinary double.)"
5148         fi      
5149         ;;
5150 esac
5151 $rm -f try.* try
5152
5153 : determine the architecture name
5154 echo " "
5155 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
5156         tarch=`arch`"-$osname"
5157 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
5158         if uname -m > tmparch 2>&1 ; then
5159                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
5160                         -e 's/$/'"-$osname/" tmparch`
5161         else
5162                 tarch="$osname"
5163         fi
5164         $rm -f tmparch
5165 else
5166         tarch="$osname"
5167 fi
5168 case "$myarchname" in
5169 ''|"$tarch") ;;
5170 *)
5171         echo "(Your architecture name used to be $myarchname.)"
5172         archname=''
5173         ;;
5174 esac
5175 myarchname="$tarch"
5176 case "$archname" in
5177 '') dflt="$tarch";;
5178 *) dflt="$archname";;
5179 esac
5180 rp='What is your architecture name'
5181 . ./myread
5182 archname="$ans"
5183 case "$usethreads" in
5184 $define)
5185         echo "Threads selected." >&4
5186         case "$archname" in
5187         *-thread*) echo "...and architecture name already has -thread." >&4
5188                 ;;
5189         *)      archname="$archname-thread"
5190                 echo "...setting architecture name to $archname." >&4
5191                 ;;
5192         esac
5193         ;;
5194 esac
5195 case "$usemultiplicity" in
5196 $define)
5197         echo "Multiplicity selected." >&4
5198         case "$archname" in
5199         *-multi*) echo "...and architecture name already has -multi." >&4
5200                 ;;
5201         *)      archname="$archname-multi"
5202                 echo "...setting architecture name to $archname." >&4
5203                 ;;
5204         esac
5205         ;;
5206 esac
5207 case "$use64bitint$use64bitall" in
5208 *"$define"*)
5209         case "$archname64" in
5210         '')
5211                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
5212                 ;;
5213         *)
5214                 case "$use64bitint" in
5215                 "$define") echo "64 bit integers selected." >&4 ;;
5216                 esac
5217                 case "$use64bitall" in
5218                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
5219                 esac
5220                 case "$archname" in
5221                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
5222                         ;;
5223                 *)      archname="$archname-$archname64"
5224                         echo "...setting architecture name to $archname." >&4
5225                         ;;
5226                 esac
5227                 ;;
5228         esac
5229 esac
5230 case "$uselongdouble" in
5231 $define)
5232         echo "Long doubles selected." >&4
5233         case "$longdblsize" in
5234         $doublesize)
5235                 "...but long doubles are equal to doubles, not changing architecture name." >&4
5236                 ;;
5237         *)
5238                 case "$archname" in
5239                 *-ld*) echo "...and architecture name already has -ld." >&4
5240                         ;;
5241                 *)      archname="$archname-ld"
5242                         echo "...setting architecture name to $archname." >&4
5243                         ;;
5244                 esac
5245                 ;;
5246         esac
5247         ;;
5248 esac
5249
5250 : determine root of directory hierarchy where package will be installed.
5251 case "$prefix" in
5252 '')
5253         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
5254         ;;
5255 *)
5256         dflt="$prefix"
5257         ;;
5258 esac
5259 $cat <<EOM
5260
5261 By default, $package will be installed in $dflt/bin, manual pages
5262 under $dflt/man, etc..., i.e. with $dflt as prefix for all
5263 installation directories. Typically this is something like /usr/local.
5264 If you wish to have binaries under /usr/bin but other parts of the
5265 installation under /usr/local, that's ok: you will be prompted
5266 separately for each of the installation directories, the prefix being
5267 only used to set the defaults.
5268
5269 EOM
5270 fn=d~
5271 rp='Installation prefix to use?'
5272 . ./getfile
5273 oldprefix=''
5274 case "$prefix" in
5275 '') ;;
5276 *)
5277         case "$ans" in
5278         "$prefix") ;;
5279         *) oldprefix="$prefix";;
5280         esac
5281         ;;
5282 esac
5283 prefix="$ans"
5284 prefixexp="$ansexp"
5285
5286 : is AFS running?
5287 echo " "
5288 case "$afs" in
5289 $define|true)   afs=true ;;
5290 $undef|false)   afs=false ;;
5291 *)      if test -d /afs; then
5292                 afs=true
5293         else
5294                 afs=false
5295         fi
5296         ;;
5297 esac
5298 if $afs; then
5299         echo "AFS may be running... I'll be extra cautious then..." >&4
5300 else
5301         echo "AFS does not seem to be running..." >&4
5302 fi
5303
5304 : determine installation prefix for where package is to be installed.
5305 if $afs; then 
5306 $cat <<EOM
5307
5308 Since you are running AFS, I need to distinguish the directory in which
5309 files will reside from the directory in which they are installed (and from
5310 which they are presumably copied to the former directory by occult means).
5311
5312 EOM
5313         case "$installprefix" in
5314         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
5315         *) dflt="$installprefix";;
5316         esac
5317 else
5318 $cat <<EOM
5319
5320 In some special cases, particularly when building $package for distribution,
5321 it is convenient to distinguish between the directory in which files should 
5322 be installed from the directory ($prefix) in which they 
5323 will eventually reside.  For most users, these two directories are the same.
5324
5325 EOM
5326         case "$installprefix" in
5327         '') dflt=$prefix ;;
5328         *) dflt=$installprefix;;
5329         esac
5330 fi
5331 fn=d~
5332 rp='What installation prefix should I use for installing files?'
5333 . ./getfile
5334 installprefix="$ans"
5335 installprefixexp="$ansexp"
5336
5337 : set the prefixit variable, to compute a suitable default value
5338 prefixit='case "$3" in
5339 ""|none)
5340         case "$oldprefix" in
5341         "") eval "$1=\"\$$2\"";;
5342         *)
5343                 case "$3" in
5344                 "") eval "$1=";;
5345                 none)
5346                         eval "tp=\"\$$2\"";
5347                         case "$tp" in
5348                         ""|" ") eval "$1=\"\$$2\"";;
5349                         *) eval "$1=";;
5350                         esac;;
5351                 esac;;
5352         esac;;
5353 *)
5354         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
5355         case "$tp" in
5356         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
5357         /*-$oldprefix/*|\~*-$oldprefix/*)
5358                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
5359         *) eval "$1=\"\$$2\"";;
5360         esac;;
5361 esac'
5362
5363
5364 : get the patchlevel
5365 echo " "
5366 echo "Getting the current patchlevel..." >&4
5367 if $test -r $rsrc/patchlevel.h;then
5368         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
5369         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
5370         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
5371         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
5372         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
5373         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
5374 else
5375         revision=0
5376         patchlevel=0
5377         subversion=0
5378         api_revision=0
5379         api_version=0
5380         api_subversion=0
5381 fi
5382 $echo "(You have $package version $patchlevel subversion $subversion.)"
5383 case "$osname" in
5384 dos|vms)
5385         : XXX Should be a Configure test for double-dots in filenames.
5386         version=`echo $revision $patchlevel $subversion | \
5387                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
5388         api_versionstring=`echo $api_revision $api_version $api_subversion | \
5389                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
5390         ;;
5391 *)
5392         version=`echo $revision $patchlevel $subversion | \
5393                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
5394         api_versionstring=`echo $api_revision $api_version $api_subversion | \
5395                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
5396         ;;
5397 esac
5398 : Special case the 5.005_xx maintenance series, which used 5.005
5399 : without any subversion label as a subdirectory in $sitelib
5400 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
5401         api_versionstring='5.005'
5402 fi
5403
5404 : determine installation style
5405 : For now, try to deduce it from prefix unless it is already set.
5406 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
5407 case "$installstyle" in
5408 '')     case "$prefix" in
5409                 *perl*) dflt='lib';;
5410                 *) dflt='lib/perl5' ;;
5411         esac
5412         ;;
5413 *)      dflt="$installstyle" ;;
5414 esac
5415 : Probably not worth prompting for this since we prompt for all
5416 : the directories individually, and the prompt would be too long and
5417 : confusing anyway.
5418 installstyle=$dflt
5419
5420 : determine where private library files go
5421 : Usual default is /usr/local/lib/perl5/$version.
5422 : Also allow things like /opt/perl/lib/$version, since 
5423 : /opt/perl/lib/perl5... would be redundant.
5424 : The default "style" setting is made in installstyle.U
5425 case "$installstyle" in
5426 *lib/perl5*) set dflt privlib lib/$package/$version ;;
5427 *)       set dflt privlib lib/$version ;;
5428 esac
5429 eval $prefixit
5430 $cat <<EOM
5431
5432 There are some auxiliary files for $package that need to be put into a
5433 private library directory that is accessible by everyone.
5434
5435 EOM
5436 fn=d~+
5437 rp='Pathname where the private library files will reside?'
5438 . ./getfile
5439 privlib="$ans"
5440 privlibexp="$ansexp"
5441 : Change installation prefix, if necessary.
5442 if $test X"$prefix" != X"$installprefix"; then
5443         installprivlib=`echo $privlibexp | sed "s#^$prefix#$installprefix#"`
5444 else
5445         installprivlib="$privlibexp"
5446 fi
5447
5448 : set the prefixup variable, to restore leading tilda escape
5449 prefixup='case "$prefixexp" in
5450 "$prefix") ;;
5451 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
5452 esac'
5453
5454 : determine where public architecture dependent libraries go
5455 set archlib archlib
5456 eval $prefixit
5457 : privlib default is /usr/local/lib/$package/$version
5458 : archlib default is /usr/local/lib/$package/$version/$archname
5459 : privlib may have an optional trailing /share.
5460 tdflt=`echo $privlib | $sed 's,/share$,,'`
5461 tdflt=$tdflt/$archname
5462 case "$archlib" in
5463 '')     dflt=$tdflt
5464         ;;
5465 *)      dflt="$archlib"
5466     ;;
5467 esac
5468 $cat <<EOM
5469
5470 $spackage contains architecture-dependent library files.  If you are
5471 sharing libraries in a heterogeneous environment, you might store
5472 these files in a separate location.  Otherwise, you can just include
5473 them with the rest of the public library files.
5474
5475 EOM
5476 fn=d+~
5477 rp='Where do you want to put the public architecture-dependent libraries?'
5478 . ./getfile
5479 archlib="$ans"
5480 archlibexp="$ansexp"
5481 if $test X"$archlib" = X"$privlib"; then
5482         d_archlib="$undef"
5483 else
5484         d_archlib="$define"
5485 fi
5486 : Change installation prefix, if necessary.
5487 if $test X"$prefix" != X"$installprefix"; then
5488         installarchlib=`echo $archlibexp | sed "s#^$prefix#$installprefix#"`
5489 else
5490         installarchlib="$archlibexp"
5491 fi
5492
5493
5494 : Binary compatibility with 5.005 is not possible for builds
5495 : with advanced features
5496 case "$usethreads$usemultiplicity" in
5497 *define*)
5498         bincompat5005="$undef"
5499         d_bincompat5005="$undef"
5500         ;;
5501 *)      $cat <<EOM
5502
5503 This version of Perl can be compiled for binary compatibility with 5.005.
5504 If you decide to do so, you will be able to continue using most of the
5505 extensions that were compiled for Perl 5.005.
5506
5507 EOM
5508         case "$bincompat5005$d_bincompat5005" in
5509         *"$undef"*) dflt=n ;;
5510         *) dflt=y ;;
5511         esac
5512         rp='Binary compatibility with Perl 5.005?'
5513         . ./myread
5514         case "$ans" in
5515         y*) val="$define" ;;
5516         *)  val="$undef" ;;
5517         esac
5518         set d_bincompat5005
5519         eval $setvar
5520         case "$d_bincompat5005" in
5521         "$define")
5522                 bincompat5005="$define"
5523                 ;;
5524         *)      bincompat5005="$undef"
5525                 d_bincompat5005="$undef"
5526                 ;;
5527         esac
5528         ;;
5529 esac
5530
5531
5532 : see if setuid scripts can be secure
5533 $cat <<EOM
5534
5535 Some kernels have a bug that prevents setuid #! scripts from being
5536 secure.  Some sites have disabled setuid #! scripts because of this.
5537
5538 First let's decide if your kernel supports secure setuid #! scripts.
5539 (If setuid #! scripts would be secure but have been disabled anyway,
5540 don't say that they are secure if asked.)
5541
5542 EOM
5543
5544 val="$undef"
5545 if $test -d /dev/fd; then
5546         echo "#!$ls" >reflect
5547         chmod +x,u+s reflect
5548         ./reflect >flect 2>&1
5549         if $contains "/dev/fd" flect >/dev/null; then
5550                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
5551                 val="$define"
5552         else
5553                 $cat <<EOM
5554 If you are not sure if they are secure, I can check but I'll need a
5555 username and password different from the one you are using right now.
5556 If you don't have such a username or don't want me to test, simply
5557 enter 'none'.
5558
5559 EOM
5560                 rp='Other username to test security of setuid scripts with?'
5561                 dflt='none'
5562                 . ./myread
5563                 case "$ans" in
5564                 n|none)
5565                         case "$d_suidsafe" in
5566                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
5567                                 dflt=n;;
5568                         "$undef")
5569                                 echo "Well, the $hint value is *not* secure." >&4
5570                                 dflt=n;;
5571                         *)      echo "Well, the $hint value *is* secure." >&4
5572                                 dflt=y;;
5573                         esac
5574                         ;;
5575                 *)
5576                         $rm -f reflect flect
5577                         echo "#!$ls" >reflect
5578                         chmod +x,u+s reflect
5579                         echo >flect
5580                         chmod a+w flect
5581                         echo '"su" will (probably) prompt you for '"$ans's password."
5582                         su $ans -c './reflect >flect'
5583                         if $contains "/dev/fd" flect >/dev/null; then
5584                                 echo "Okay, it looks like setuid scripts are secure." >&4
5585                                 dflt=y
5586                         else
5587                                 echo "I don't think setuid scripts are secure." >&4
5588                                 dflt=n
5589                         fi
5590                         ;;
5591                 esac
5592                 rp='Does your kernel have *secure* setuid scripts?'
5593                 . ./myread
5594                 case "$ans" in
5595                 [yY]*)  val="$define";;
5596                 *)      val="$undef";;
5597                 esac
5598         fi
5599 else
5600         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
5601         echo "(That's for file descriptors, not floppy disks.)"
5602         val="$undef"
5603 fi
5604 set d_suidsafe
5605 eval $setvar
5606
5607 $rm -f reflect flect
5608
5609 : now see if they want to do setuid emulation
5610 echo " "
5611 val="$undef"
5612 case "$d_suidsafe" in
5613 "$define")
5614         val="$undef"
5615         echo "No need to emulate SUID scripts since they are secure here." >& 4
5616         ;;
5617 *)
5618         $cat <<EOM
5619 Some systems have disabled setuid scripts, especially systems where
5620 setuid scripts cannot be secure.  On systems where setuid scripts have
5621 been disabled, the setuid/setgid bits on scripts are currently
5622 useless.  It is possible for $package to detect those bits and emulate
5623 setuid/setgid in a secure fashion.  This emulation will only work if
5624 setuid scripts have been disabled in your kernel.
5625
5626 EOM
5627         case "$d_dosuid" in
5628         "$define") dflt=y ;;
5629         *) dflt=n ;;
5630         esac
5631         rp="Do you want to do setuid/setgid emulation?"
5632         . ./myread
5633         case "$ans" in
5634         [yY]*)  val="$define";;
5635         *)      val="$undef";;
5636         esac
5637         ;;
5638 esac
5639 set d_dosuid
5640 eval $setvar
5641
5642 : determine filename position in cpp output
5643 echo " "
5644 echo "Computing filename position in cpp output for #include directives..." >&4
5645 echo '#include <stdio.h>' > foo.c
5646 $cat >fieldn <<EOF
5647 $startsh
5648 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5649 $grep '^[       ]*#.*stdio\.h' | \
5650 while read cline; do
5651         pos=1
5652         set \$cline
5653         while $test \$# -gt 0; do
5654                 if $test -r \`echo \$1 | $tr -d '"'\`; then
5655                         echo "\$pos"
5656                         exit 0
5657                 fi
5658                 shift
5659                 pos=\`expr \$pos + 1\`
5660         done
5661 done
5662 EOF
5663 chmod +x fieldn
5664 fieldn=`./fieldn`
5665 $rm -f foo.c fieldn
5666 case $fieldn in
5667 '') pos='???';;
5668 1) pos=first;;
5669 2) pos=second;;
5670 3) pos=third;;
5671 *) pos="${fieldn}th";;
5672 esac
5673 echo "Your cpp writes the filename in the $pos field of the line."
5674
5675 : locate header file
5676 $cat >findhdr <<EOF
5677 $startsh
5678 wanted=\$1
5679 name=''
5680 for usrincdir in $usrinc
5681 do
5682         if test -f \$usrincdir/\$wanted; then
5683                 echo "\$usrincdir/\$wanted"
5684                 exit 0
5685         fi
5686 done
5687 awkprg='{ print \$$fieldn }'
5688 echo "#include <\$wanted>" > foo\$\$.c
5689 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5690 $grep "^[       ]*#.*\$wanted" | \
5691 while read cline; do
5692         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5693         case "\$name" in
5694         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5695         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5696         *) exit 2;;
5697         esac;
5698 done;
5699 #
5700 # status = 0: grep returned 0 lines, case statement not executed
5701 # status = 1: headerfile found
5702 # status = 2: while loop executed, no headerfile found
5703 #
5704 status=\$?
5705 $rm -f foo\$\$.c;
5706 if test \$status -eq 1; then
5707         exit 0;
5708 fi
5709 exit 1
5710 EOF
5711 chmod +x findhdr
5712
5713 : define an alternate in-header-list? function
5714 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5715 cont=true; xxf="echo \"<\$1> found.\" >&4";
5716 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5717 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5718 esac;
5719 case $# in 4) instead=instead;; *) instead="at last";; esac;
5720 while $test "$cont"; do
5721         xxx=`./findhdr $1`
5722         var=$2; eval "was=\$$2";
5723         if $test "$xxx" && $test -r "$xxx";
5724         then eval $xxf;
5725         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5726                 cont="";
5727         else eval $xxnf;
5728         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5729         set $yyy; shift; shift; yyy=$@;
5730         case $# in 0) cont="";;
5731         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5732                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5733         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5734                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5735         esac;
5736 done;
5737 while $test "$yyy";
5738 do set $yyy; var=$2; eval "was=\$$2";
5739         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5740         set $yyy; shift; shift; yyy=$@;
5741 done'
5742
5743 : see if this is a malloc.h system
5744 set malloc.h i_malloc
5745 eval $inhdr
5746
5747 : see if stdlib is available
5748 set stdlib.h i_stdlib
5749 eval $inhdr
5750
5751 : determine which malloc to compile in
5752 echo " "
5753 case "$usemymalloc" in
5754 ''|[yY]*|true|$define)  dflt='y' ;;
5755 *)      dflt='n' ;;
5756 esac
5757 rp="Do you wish to attempt to use the malloc that comes with $package?"
5758 . ./myread
5759 usemymalloc="$ans"
5760 case "$ans" in
5761 y*|true)
5762         usemymalloc='y'
5763         mallocsrc='malloc.c'
5764         mallocobj="malloc$_o"
5765         d_mymalloc="$define"
5766         case "$libs" in
5767         *-lmalloc*)
5768                 : Remove malloc from list of libraries to use
5769                 echo "Removing unneeded -lmalloc from library list" >&4
5770                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
5771                 shift
5772                 libs="$*"
5773                 echo "libs = $libs" >&4
5774                 ;;
5775         esac
5776         ;;
5777 *)
5778         usemymalloc='n'
5779         mallocsrc=''
5780         mallocobj=''
5781         d_mymalloc="$undef"
5782         ;;
5783 esac
5784
5785 : compute the return types of malloc and free
5786 echo " "
5787 $cat >malloc.c <<END
5788 #$i_malloc I_MALLOC
5789 #$i_stdlib I_STDLIB
5790 #include <stdio.h>
5791 #include <sys/types.h>
5792 #ifdef I_MALLOC
5793 #include <malloc.h>
5794 #endif
5795 #ifdef I_STDLIB
5796 #include <stdlib.h>
5797 #endif
5798 #ifdef TRY_MALLOC
5799 void *malloc();
5800 #endif
5801 #ifdef TRY_FREE
5802 void free();
5803 #endif
5804 END
5805 case "$malloctype" in
5806 '')
5807         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
5808                 malloctype='void *'
5809         else
5810                 malloctype='char *'
5811         fi
5812         ;;
5813 esac
5814 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
5815
5816 case "$freetype" in
5817 '')
5818         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
5819                 freetype='void'
5820         else
5821                 freetype='int'
5822         fi
5823         ;;
5824 esac
5825 echo "Your system uses $freetype free(), it would seem." >&4
5826 $rm -f malloc.[co]
5827 $cat <<EOM
5828
5829 After $package is installed, you may wish to install various
5830 add-on modules and utilities.  Typically, these add-ons will
5831 be installed under $prefix with the rest
5832 of this package.  However, you may wish to install such add-ons
5833 elsewhere under a different prefix.
5834
5835 If you do not wish to put everything under a single prefix, that's
5836 ok.  You will be prompted for the individual locations; this siteprefix
5837 is only used to suggest the defaults.
5838
5839 The default should be fine for most people.
5840
5841 EOM
5842 fn=d~+
5843 rp='Installation prefix to use for add-on modules and utilities?'
5844 : XXX Here might be another good place for an installstyle setting.
5845 case "$siteprefix" in
5846 '') dflt=$prefix ;;
5847 *)  dflt=$siteprefix ;;
5848 esac
5849 . ./getfile
5850 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
5851 oldsiteprefix=''
5852 case "$siteprefix" in
5853 '') ;;
5854 *)      case "$ans" in
5855         "$prefix") ;;
5856         *) oldsiteprefix="$prefix";;
5857         esac
5858         ;;
5859 esac
5860 siteprefix="$ans"
5861 siteprefixexp="$ansexp"
5862
5863 : determine where site specific libraries go.
5864 : Usual default is /usr/local/lib/perl5/site_perl/$version
5865 : The default "style" setting is made in installstyle.U
5866 : XXX No longer works with Prefixit stuff.
5867 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
5868 case "$sitelib" in
5869 '') case "$installstyle" in
5870         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
5871         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
5872         esac
5873         ;;
5874 *)      dflt="$sitelib"
5875         ;;
5876 esac
5877 $cat <<EOM
5878
5879 The installation process will create a directory for
5880 site-specific extensions and modules.  Most users find it convenient
5881 to place all site-specific files in this directory rather than in the
5882 main distribution directory.
5883
5884 EOM
5885 fn=d~+
5886 rp='Pathname for the site-specific library files?'
5887 . ./getfile
5888 sitelib="$ans"
5889 sitelibexp="$ansexp"
5890 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
5891 : Change installation prefix, if necessary.
5892 if $test X"$prefix" != X"$installprefix"; then
5893         installsitelib=`echo $sitelibexp | $sed "s#^$prefix#$installprefix#"`
5894 else
5895         installsitelib="$sitelibexp"
5896 fi
5897
5898 : determine where site specific architecture-dependent libraries go.
5899 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
5900 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
5901 : sitelib may have an optional trailing /share.
5902 case "$sitearch" in
5903 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
5904         dflt="$dflt/$archname"
5905         ;;
5906 *)      dflt="$sitearch"
5907         ;;
5908 esac
5909 set sitearch sitearch none
5910 eval $prefixit
5911 $cat <<EOM
5912
5913 The installation process will also create a directory for
5914 architecture-dependent site-specific extensions and modules.
5915
5916 EOM
5917 fn=d~+
5918 rp='Pathname for the site-specific architecture-dependent library files?'
5919 . ./getfile
5920 sitearch="$ans"
5921 sitearchexp="$ansexp"
5922 : Change installation prefix, if necessary.
5923 if $test X"$prefix" != X"$installprefix"; then
5924         installsitearch=`echo $sitearchexp | sed "s#^$prefix#$installprefix#"`
5925 else
5926         installsitearch="$sitearchexp"
5927 fi
5928
5929 $cat <<EOM
5930
5931 The installation process will also create a directory for
5932 vendor-supplied add-ons.  Vendors who supply perl with their system
5933 may find it convenient to place all vendor-supplied files in this
5934 directory rather than in the main distribution directory.  This will
5935 ease upgrades between binary-compatible maintenance versions of perl.
5936
5937 Of course you may also use these directories in whatever way you see
5938 fit.  For example, you might use them to access modules shared over a
5939 company-wide network.
5940
5941 The default answer should be fine for most people.
5942 This causes further questions about vendor add-ons to be skipped
5943 and no vendor-specific directories will be configured for perl.
5944
5945 EOM
5946 rp='Do you want to configure vendor-specific add-on directories?'
5947 case "$usevendorprefix" in
5948 define|true|[yY]*) dflt=y ;;
5949 *)      : User may have set vendorprefix directly on Configure command line.
5950         case "$vendorprefix" in
5951         ''|' ') dflt=n ;;
5952         *)      dflt=y ;;
5953         esac
5954         ;;
5955 esac
5956 . ./myread
5957 case "$ans" in
5958 [yY]*)  fn=d~+
5959         rp='Installation prefix to use for vendor-supplied add-ons?'
5960         case "$vendorprefix" in
5961         '') dflt='' ;;
5962         *)  dflt=$vendorprefix ;;
5963         esac
5964         . ./getfile
5965         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
5966         oldvendorprefix=''
5967         case "$vendorprefix" in
5968         '') ;;
5969         *)      case "$ans" in
5970                 "$prefix") ;;
5971                 *) oldvendorprefix="$prefix";;
5972                 esac
5973                 ;;
5974         esac
5975         usevendorprefix="$define"
5976         vendorprefix="$ans"
5977         vendorprefixexp="$ansexp"
5978         ;;
5979 *)      usevendorprefix="$undef"
5980         vendorprefix=''
5981         vendorprefixexp=''
5982         ;;
5983 esac
5984
5985 case "$vendorprefix" in
5986 '')     d_vendorlib="$undef"
5987         vendorlib=''
5988         vendorlibexp=''
5989         ;;
5990 *)      d_vendorlib="$define"
5991         : determine where vendor-supplied modules go.
5992         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
5993         case "$vendorlib" in
5994         '')
5995                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
5996                 case "$installstyle" in
5997                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
5998                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
5999                 esac
6000                 ;;
6001         *)      dflt="$vendorlib"
6002                 ;;
6003         esac
6004         fn=d~+
6005         rp='Pathname for the vendor-supplied library files?'
6006         . ./getfile
6007         vendorlib="$ans"
6008         vendorlibexp="$ansexp"
6009         ;;
6010 esac
6011 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
6012 : Change installation prefix, if necessary.
6013 if $test X"$prefix" != X"$installprefix"; then
6014         installvendorlib=`echo $vendorlibexp | $sed "s#^$prefix#$installprefix#"`
6015 else
6016         installvendorlib="$vendorlibexp"
6017 fi
6018
6019 case "$vendorprefix" in
6020 '')     d_vendorarch="$undef"
6021         vendorarch=''
6022         vendorarchexp=''
6023         ;;
6024 *)      d_vendorarch="$define"
6025         : determine where vendor-supplied architecture-dependent libraries go.
6026         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
6027         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
6028         : vendorlib may have an optional trailing /share.
6029         case "$vendorarch" in
6030         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
6031                 dflt="$dflt/$archname"
6032                 ;;
6033         *)      dflt="$vendorarch" ;;
6034         esac
6035         fn=d~+
6036         rp='Pathname for vendor-supplied architecture-dependent files?'
6037         . ./getfile
6038         vendorarch="$ans"
6039         vendorarchexp="$ansexp"
6040         ;;
6041 esac
6042 : Change installation prefix, if necessary.
6043 if $test X"$prefix" != X"$installprefix"; then
6044         installvendorarch=`echo $vendorarchexp | sed "s#^$prefix#$installprefix#"`
6045 else
6046         installvendorarch="$vendorarchexp"
6047 fi
6048
6049 : Final catch-all directories to search
6050 $cat <<EOM
6051
6052 Lastly, you can have perl look in other directories for extensions and
6053 modules in addition to those already specified.
6054 These directories will be searched after 
6055         $sitearch 
6056         $sitelib 
6057 EOM
6058 test X"$vendorlib" != "X" && echo '     ' $vendorlib
6059 test X"$vendorarch" != "X" && echo '    ' $vendorarch
6060 echo ' '
6061 case "$otherlibdirs" in
6062 ''|' ') dflt='none' ;;
6063 *)      dflt="$otherlibdirs" ;;
6064 esac
6065 $cat <<EOM
6066 Enter a colon-separated set of extra paths to include in perl's @INC
6067 search path, or enter 'none' for no extra paths.
6068
6069 EOM
6070
6071 rp='Colon-separated list of additional directories for perl to search?'
6072 . ./myread
6073 case "$ans" in
6074 ' '|''|none)    otherlibdirs=' ' ;;     
6075 *)      otherlibdirs="$ans" ;;
6076 esac
6077 case "$otherlibdirs" in
6078 ' ') val=$undef ;;
6079 *)      val=$define ;;
6080 esac
6081 set d_perl_otherlibdirs
6082 eval $setvar
6083
6084 : Cruising for prototypes
6085 echo " "
6086 echo "Checking out function prototypes..." >&4
6087 $cat >prototype.c <<'EOCP'
6088 int main(int argc, char *argv[]) {
6089         exit(0);}
6090 EOCP
6091 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
6092         echo "Your C compiler appears to support function prototypes."
6093         val="$define"
6094 else
6095         echo "Your C compiler doesn't seem to understand function prototypes."
6096         val="$undef"
6097 fi
6098 set prototype
6099 eval $setvar
6100 $rm -f prototype*
6101
6102 case "$prototype" in
6103 "$define") ;;
6104 *)      ansi2knr='ansi2knr'
6105         echo " "
6106         cat <<EOM >&4
6107
6108 $me:  FATAL ERROR:
6109 This version of $package can only be compiled by a compiler that 
6110 understands function prototypes.  Unfortunately, your C compiler 
6111         $cc $ccflags
6112 doesn't seem to understand them.  Sorry about that.
6113
6114 If GNU cc is available for your system, perhaps you could try that instead.  
6115
6116 Eventually, we hope to support building Perl with pre-ANSI compilers.
6117 If you would like to help in that effort, please contact <perlbug@perl.org>.
6118
6119 Aborting Configure now.
6120 EOM
6121         exit 2
6122         ;;
6123 esac
6124
6125 : determine where public executables go
6126 echo " "
6127 set dflt bin bin
6128 eval $prefixit
6129 fn=d~
6130 rp='Pathname where the public executables will reside?'
6131 . ./getfile
6132 if $test "X$ansexp" != "X$binexp"; then
6133         installbin=''
6134 fi
6135 bin="$ans"
6136 binexp="$ansexp"
6137 : Change installation prefix, if necessary.
6138 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
6139 if $test X"$prefix" != X"$installprefix"; then
6140         installbin=`echo $binexp | sed "s#^$prefix#$installprefix#"`
6141 else
6142         installbin="$binexp"
6143 fi
6144
6145 : Find perl5.005 or later.
6146 echo "Looking for a previously installed perl5.005 or later... "
6147 case "$perl5" in
6148 '')     for tdir in `echo "$binexp:$PATH" | $sed "s/$path_sep/ /g"`; do
6149                 : Check if this perl is recent and can load a simple module
6150                 if $test -x $tdir/perl && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6151                         perl5=$tdir/perl
6152                         break;
6153                 elif $test -x $tdir/perl5 && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6154                         perl5=$tdir/perl
6155                         break;
6156                 fi
6157         done
6158         ;;
6159 *)      perl5="$perl5"
6160         ;;
6161 esac
6162 case "$perl5" in
6163 '')     echo "None found.  That's ok.";;
6164 *)      echo "Using $perl5." ;;
6165 esac
6166
6167 : Determine list of previous versions to include in @INC
6168 $cat > getverlist <<EOPL
6169 #!$perl5 -w
6170 use File::Basename;
6171 \$api_versionstring = "$api_versionstring";
6172 \$version = "$version";
6173 \$stem = "$sitelib_stem";
6174 \$archname = "$archname";
6175 EOPL
6176         $cat >> getverlist <<'EOPL'
6177 # Can't have leading @ because metaconfig interprets it as a command!
6178 ;@inc_version_list=();
6179 # XXX Redo to do opendir/readdir? 
6180 if (-d $stem) {
6181     chdir($stem);
6182     ;@candidates = glob("5.*");
6183 }
6184 else {
6185     ;@candidates = ();
6186 }
6187
6188 # XXX ToDo:  These comparisons must be reworked when two-digit
6189 # subversions come along, so that 5.7.10 compares as greater than
6190 # 5.7.3!  By that time, hope that 5.6.x is sufficiently
6191 # widespread that we can use the built-in version vectors rather
6192 # than reinventing them here.  For 5.6.0, however, we must
6193 # assume this script will likely be run by 5.005_0x.  --AD 1/2000.
6194 foreach $d (@candidates) {
6195     if ($d lt $version) {
6196         if ($d ge $api_versionstring) {
6197             unshift(@inc_version_list, grep { -d } "$d/$archname", $d);
6198         }
6199         elsif ($d ge "5.005") {
6200             unshift(@inc_version_list, grep { -d } $d);
6201         }
6202     }
6203     else {
6204         # Skip newer version.  I.e. don't look in
6205         # 5.7.0 if we're installing 5.6.1.
6206     }
6207 }
6208
6209 if (@inc_version_list) {
6210     print join(' ', @inc_version_list);
6211 }
6212 else {
6213     # Blank space to preserve value for next Configure run.
6214     print " ";
6215 }
6216 EOPL
6217 chmod +x getverlist
6218 case "$inc_version_list" in
6219 '')     if test -x "$perl5"; then
6220                 dflt=`$perl5 getverlist`
6221         else
6222                 dflt='none'
6223         fi
6224         ;;
6225 $undef) dflt='none' ;;
6226 *)  dflt="$inc_version_list" ;;
6227 esac
6228 case "$dflt" in
6229 ''|' ') dflt=none ;;
6230 esac
6231 case "$dflt" in
6232 5.005) case "$bincompat5005" in
6233        $define|true|[yY]*) ;;
6234        *) dflt=none ;;
6235        esac
6236        ;;
6237 esac
6238 $cat <<'EOM'
6239
6240 In order to ease the process of upgrading, this version of perl 
6241 can be configured to use modules built and installed with earlier 
6242 versions of perl that were installed under $prefix.  Specify here
6243 the list of earlier versions that this version of perl should check.
6244 If Configure detected no earlier versions of perl installed under
6245 $prefix, then the list will be empty.  Answer 'none' to tell perl
6246 to not search earlier versions.
6247
6248 The default should almost always be sensible, so if you're not sure,
6249 just accept the default.
6250 EOM
6251
6252 rp='List of earlier versions to include in @INC?'
6253 . ./myread
6254 case "$ans" in
6255 [Nn]one|''|' ') inc_version_list=' ' ;;
6256 *) inc_version_list="$ans" ;;
6257 esac
6258 case "$inc_version_list" in
6259 ''|' ') 
6260         inc_version_list_init='0';;
6261 *)      inc_version_list_init=`echo $inc_version_list |
6262                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
6263         ;;
6264 esac
6265 $rm -f getverlist
6266
6267 : determine whether to install perl also as /usr/bin/perl
6268
6269 echo " "
6270 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
6271         $cat <<EOM
6272 Many scripts expect perl to be installed as /usr/bin/perl.
6273 I can install the perl you are about to compile also as /usr/bin/perl
6274 (in addition to $installbin/perl).
6275 EOM
6276         case "$installusrbinperl" in
6277         "$undef"|[nN]*) dflt='n';;
6278         *)              dflt='y';;
6279         esac
6280         rp="Do you want to install perl as /usr/bin/perl?"
6281         . ./myread
6282         case "$ans" in
6283         [yY]*)  val="$define";;
6284         *)      val="$undef" ;;
6285         esac
6286 else
6287         val="$undef"
6288 fi
6289 set installusrbinperl
6290 eval $setvar
6291
6292 : see if dld is available
6293 set dld.h i_dld
6294 eval $inhdr
6295
6296 : see if dlopen exists
6297 xxx_runnm="$runnm"
6298 runnm=false
6299 set dlopen d_dlopen
6300 eval $inlibc
6301 runnm="$xxx_runnm"
6302
6303 : determine which dynamic loading, if any, to compile in
6304 echo " "
6305 dldir="ext/DynaLoader"
6306 case "$usedl" in
6307 $define|y|true)
6308         dflt='y'
6309         usedl="$define"
6310         ;;
6311 $undef|n|false)
6312         dflt='n'
6313         usedl="$undef"
6314         ;;
6315 *) 
6316         dflt='n'
6317         case "$d_dlopen" in
6318             $define) dflt='y' ;;
6319         esac
6320         case "$i_dld" in
6321             $define) dflt='y' ;;
6322         esac
6323         : Does a dl_xxx.xs file exist for this operating system
6324         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
6325         ;;
6326 esac
6327 rp="Do you wish to use dynamic loading?"
6328 . ./myread
6329 usedl="$ans"
6330 case "$ans" in
6331 y*) usedl="$define"
6332         case "$dlsrc" in
6333         '')
6334                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
6335                         dflt="$dldir/dl_${osname}.xs"
6336                 elif $test "$d_dlopen" = "$define" ; then
6337                         dflt="$dldir/dl_dlopen.xs"
6338                 elif $test "$i_dld" = "$define" ; then
6339                         dflt="$dldir/dl_dld.xs"
6340                 else
6341                         dflt=''
6342                 fi
6343                 ;;
6344         *)      dflt="$dldir/$dlsrc"
6345                 ;;
6346         esac
6347     echo "The following dynamic loading files are available:"
6348         : Can not go over to $dldir because getfile has path hard-coded in.
6349         tdir=`pwd`; cd $rsrc; $ls -C $dldir/dl*.xs; cd $tdir
6350         rp="Source file to use for dynamic loading"
6351         fn="fne"
6352         gfpth="$src"
6353         . ./getfile
6354         usedl="$define"
6355         : emulate basename
6356         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
6357
6358         $cat << EOM
6359
6360 Some systems may require passing special flags to $cc -c to
6361 compile modules that will be used to create a shared library.
6362 To use no flags, say "none".
6363
6364 EOM
6365     case "$cccdlflags" in
6366     '') case "$gccversion" in
6367                 '') case "$osname" in
6368                         hpux)   dflt='+z' ;;
6369                         next)   dflt='none' ;;
6370                         irix*)  dflt='-KPIC' ;;
6371                         svr4*|esix*|solaris) dflt='-KPIC' ;;
6372                         sunos)  dflt='-pic' ;;
6373                         *)      dflt='none' ;;
6374                     esac
6375                         ;;
6376                 *)  case "$osname" in
6377                         svr4*|esix*|solaris) dflt='-fPIC' ;;
6378                         *)      dflt='-fpic' ;;
6379                     esac ;;
6380             esac ;;
6381         ' ') dflt='none' ;;
6382     *)  dflt="$cccdlflags" ;;
6383     esac
6384     rp="Any special flags to pass to $cc -c to compile shared library modules?"
6385     . ./myread
6386     case "$ans" in
6387     none) cccdlflags=' ' ;;
6388     *) cccdlflags="$ans" ;;
6389     esac
6390
6391     cat << EOM
6392
6393 Some systems use ld to create libraries that can be dynamically loaded,
6394 while other systems (such as those using ELF) use $cc.
6395
6396 EOM
6397         case "$ld" in
6398         '')     $cat >try.c <<'EOM'
6399 /* Test for whether ELF binaries are produced */
6400 #include <fcntl.h>
6401 #include <stdlib.h>
6402 int main() {
6403         char b[4];
6404         int i = open("a.out",O_RDONLY);
6405         if(i == -1) 
6406                 exit(1); /* fail */
6407         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
6408                 exit(0); /* succeed (yes, it's ELF) */
6409         else
6410                 exit(1); /* fail */
6411 }
6412 EOM
6413                 if $cc $ccflags try.c >/dev/null 2>&1 && ./a.out; then
6414                         cat <<EOM
6415 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
6416 EOM
6417                         dflt="$cc"
6418                 else
6419                         echo "I'll use ld to build dynamic libraries."
6420                         dflt='ld'
6421                 fi
6422                 rm -f try.c a.out
6423                 ;;
6424         *)      dflt="$ld"
6425                 ;;
6426         esac
6427
6428     rp="What command should be used to create dynamic libraries?"
6429     . ./myread
6430         ld="$ans"
6431
6432     cat << EOM
6433
6434 Some systems may require passing special flags to $ld to create a
6435 library that can be dynamically loaded.  If your ld flags include
6436 -L/other/path options to locate libraries outside your loader's normal
6437 search path, you may need to specify those -L options here as well.  To
6438 use no flags, say "none".
6439
6440 EOM
6441     case "$lddlflags" in
6442     '') case "$osname" in
6443                         beos) dflt='-nostart' ;;
6444                         hpux) dflt='-b';
6445                               case "$gccversion" in
6446                               '') dflt="$dflt +vnocompatwarnings" ;;
6447                               esac
6448                               ;;        
6449                         linux|irix*)    dflt='-shared' ;;
6450                         next)  dflt='none' ;;
6451                         solaris) dflt='-G' ;;
6452                         sunos) dflt='-assert nodefinitions' ;;
6453                         svr4*|esix*) dflt="-G $ldflags" ;;
6454                 *)     dflt='none' ;;
6455                         esac
6456                         ;;
6457     *) dflt="$lddlflags" ;;
6458     esac
6459
6460         : Try to guess additional flags to pick up local libraries.
6461         : Be careful not to append to a plain 'none'
6462         case "$dflt" in
6463         none) dflt='' ;;
6464         esac
6465         for thisflag in $ldflags; do
6466                 case "$thisflag" in
6467                 -L*|-R*)
6468                         case " $dflt " in
6469                         *" $thisflag "*) ;;
6470                         *) dflt="$dflt $thisflag" ;;
6471                         esac
6472                         ;;
6473                 esac
6474         done
6475
6476         case "$dflt" in
6477         ''|' ') dflt='none' ;;
6478         esac
6479
6480     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
6481     . ./myread
6482     case "$ans" in
6483     none) lddlflags=' ' ;;
6484     *) lddlflags="$ans" ;;
6485     esac
6486
6487         cat <<EOM
6488
6489 Some systems may require passing special flags to $cc to indicate that
6490 the resulting executable will use dynamic linking.  To use no flags,
6491 say "none".
6492
6493 EOM
6494     case "$ccdlflags" in
6495     '') case "$osname" in
6496                 hpux)   dflt='-Wl,-E' ;;
6497                 linux)  dflt='-rdynamic' ;;
6498                 next)   dflt='none' ;;
6499                 sunos)  dflt='none' ;;
6500                 *)      dflt='none' ;;
6501             esac ;;
6502     ' ')  dflt='none' ;;
6503     *)  dflt="$ccdlflags" ;;
6504     esac
6505     rp="Any special flags to pass to $cc to use dynamic linking?"
6506     . ./myread
6507     case "$ans" in
6508     none) ccdlflags=' ' ;;
6509     *) ccdlflags="$ans" ;;
6510     esac
6511     ;;
6512 *)  usedl="$undef"
6513         ld='ld'
6514     dlsrc='dl_none.xs'
6515     lddlflags=''
6516     ccdlflags=''
6517     ;;
6518 esac
6519
6520 also=''
6521 case "$usedl" in
6522 $undef)
6523         # No dynamic loading being used, so don't bother even to prompt.
6524         useshrplib='false'
6525         ;;
6526 *)      case "$useshrplib" in
6527         '')     case "$osname" in
6528                 svr4*|dgux|dynixptx|esix|powerux|beos|cygwin*)
6529                         dflt=y
6530                         also='Building a shared libperl is required for dynamic loading to work on your system.'
6531                         ;;
6532                 next*)
6533                         case "$osvers" in
6534                         4*)     dflt=y
6535                                 also='Building a shared libperl is needed for MAB support.'
6536                                 ;;
6537                         *)      dflt=n
6538                                 ;;
6539                         esac
6540                         ;;
6541                 *)      dflt=n
6542                         ;;
6543                 esac
6544                 ;;
6545         $define|true|[Yy]*)
6546                 dflt=y
6547                 ;;
6548         *)      dflt=n
6549                 ;;
6550         esac
6551         $cat << EOM
6552
6553 The perl executable is normally obtained by linking perlmain.c with
6554 libperl${_a}, any static extensions (usually just DynaLoader), and
6555 any other libraries needed on this system (such as -lm, etc.).  Since
6556 your system supports dynamic loading, it is probably possible to build
6557 a shared libperl.$so.  If you will have more than one executable linked
6558 to libperl.$so, this will significantly reduce the size of each
6559 executable, but it may have a noticeable affect on performance.  The
6560 default is probably sensible for your system.
6561 $also
6562
6563 EOM
6564         rp="Build a shared libperl.$so (y/n)"
6565         . ./myread
6566         case "$ans" in
6567         true|$define|[Yy]*)
6568                 useshrplib='true'  ;;
6569         *)      useshrplib='false' ;;
6570         esac
6571         ;;
6572 esac
6573
6574 case "$useshrplib" in
6575 true)
6576         case "$libperl" in
6577         '')
6578                 # Figure out a good name for libperl.so.  Since it gets stored in
6579                 # a version-specific architecture-dependent library, the version
6580                 # number isn't really that important, except for making cc/ld happy.
6581                 #
6582                 # A name such as libperl.so.3.1
6583                 majmin="libperl.$so.$patchlevel.$subversion"
6584                 # A name such as libperl.so.301
6585                 majonly=`echo $patchlevel $subversion |
6586                         $awk '{printf "%d%02d", $1, $2}'`
6587                 majonly=libperl.$so.$majonly
6588                 # I'd prefer to keep the os-specific stuff here to a minimum, and
6589                 # rely on figuring it out from the naming of libc.
6590                 case "${osname}${osvers}" in
6591                 next4*)
6592                         dflt=libperl.5.$so
6593                         # XXX How handle the --version stuff for MAB?
6594                         ;;
6595                 linux*)  # ld won't link with a bare -lperl otherwise.
6596                         dflt=libperl.$so
6597                         ;;
6598                 cygwin*) # include version
6599                         dflt=`echo libperl$version | sed -e 's/\./_/g'`$lib_ext
6600                         ;;
6601                 *)      # Try to guess based on whether libc has major.minor.
6602                         case "$libc" in
6603                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
6604                         *libc.$so.[0-9]*) dflt=$majonly ;;
6605                         *)      dflt=libperl.$so ;;
6606                         esac
6607                         ;;
6608                 esac
6609                 ;;
6610         *)      dflt=$libperl
6611                 ;;
6612         esac
6613         cat << EOM
6614
6615 I need to select a good name for the shared libperl.  If your system uses
6616 library names with major and minor numbers, then you might want something
6617 like $majmin.  Alternatively, if your system uses a single version
6618 number for shared libraries, then you might want to use $majonly.
6619 Or, your system might be quite happy with a simple libperl.$so.
6620
6621 Since the shared libperl will get installed into a version-specific
6622 architecture-dependent directory, the version number of the shared perl
6623 library probably isn't important, so the default should be o.k.
6624
6625 EOM
6626         rp='What name do you want to give to the shared libperl?'
6627         . ./myread
6628         libperl=$ans
6629         echo "Ok, I'll use $libperl"
6630         ;;
6631 *)
6632         libperl="libperl${_a}"
6633         ;;
6634 esac
6635
6636 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
6637 case "$shrpdir" in
6638 '') ;;
6639 *)      $cat >&4 <<EOM
6640 WARNING:  Use of the shrpdir variable for the installation location of
6641 the shared $libperl is not supported.  It was never documented and
6642 will not work in this version.  Let me (perlbug@perl.org)
6643 know of any problems this may cause.
6644
6645 EOM
6646         case "$shrpdir" in
6647         "$archlibexp/CORE")
6648                 $cat >&4 <<EOM
6649 But your current setting of $shrpdir is
6650 the default anyway, so it's harmless.
6651 EOM
6652                 ;;
6653         *)
6654                 $cat >&4 <<EOM
6655 Further, your current attempted setting of $shrpdir
6656 conflicts with the value of $archlibexp/CORE
6657 that installperl will use.
6658 EOM
6659                 ;;
6660         esac
6661         ;;
6662 esac
6663
6664 # How will the perl executable find the installed shared $libperl?
6665 # Add $xxx to ccdlflags.
6666 # If we can't figure out a command-line option, use $shrpenv to
6667 # set env LD_RUN_PATH.  The main perl makefile uses this.
6668 shrpdir=$archlibexp/CORE
6669 xxx=''
6670 tmp_shrpenv=''
6671 if "$useshrplib"; then
6672     case "$osname" in 
6673         aix)
6674                 # We'll set it in Makefile.SH...
6675                 ;;
6676         solaris|netbsd)
6677                 xxx="-R $shrpdir"
6678                 ;;
6679         freebsd)
6680                 xxx="-Wl,-R$shrpdir"
6681                 ;;
6682         linux|irix*|dec_osf)
6683                 xxx="-Wl,-rpath,$shrpdir"
6684                 ;;
6685         next)
6686                 # next doesn't like the default...
6687                 ;;
6688         beos)
6689                 # beos doesn't like the default, either.
6690                 ;;
6691         hpux*)
6692                 # hpux doesn't like the default, either.
6693                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
6694                 ;;
6695         *)
6696                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
6697                 ;;
6698         esac
6699         case "$xxx" in
6700         '') ;;
6701         *)      
6702                 # Only add $xxx if it isn't already in ccdlflags.
6703                 case " $ccdlflags " in
6704                 *" $xxx "*)     ;;
6705                 *)      ccdlflags="$ccdlflags $xxx"
6706                         cat <<EOM >&4
6707
6708 Adding $xxx to the flags
6709 passed to $ld so that the perl executable will find the 
6710 installed shared $libperl.
6711
6712 EOM
6713                         ;;
6714                 esac
6715                 ;;
6716         esac
6717 fi
6718 # Fix ccdlflags in AIX for building external extensions.
6719 # (For building Perl itself bare -bE:perl.exp is needed,
6720 #  Makefile.SH takes care of this.)
6721 case "$osname" in
6722 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
6723 esac
6724 # Respect a hint or command-line value.
6725 case "$shrpenv" in
6726 '') shrpenv="$tmp_shrpenv" ;;
6727 esac
6728 case "$ldlibpthname" in
6729 '')     ldlibpthname=LD_LIBRARY_PATH ;;
6730 none)   ldlibpthname='' ;;
6731 esac
6732
6733 : determine where manual pages are on this system
6734 echo " "
6735 case "$sysman" in
6736 '') 
6737         syspath='/usr/man/man1 /usr/man/mann /usr/man/manl /usr/man/local/man1'
6738         syspath="$syspath /usr/man/u_man/man1 /usr/share/man/man1"
6739         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
6740         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
6741         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
6742         sysman=`./loc . /usr/man/man1 $syspath`
6743         ;;
6744 esac
6745 if $test -d "$sysman"; then
6746         echo "System manual is in $sysman." >&4
6747 else
6748         echo "Could not find manual pages in source form." >&4
6749 fi
6750
6751 : determine where manual pages go
6752 set man1dir man1dir none
6753 eval $prefixit
6754 $cat <<EOM
6755
6756 $spackage has manual pages available in source form.
6757 EOM
6758 case "$nroff" in
6759 nroff)
6760         echo "However, you don't have nroff, so they're probably useless to you."
6761         case "$man1dir" in
6762         '') man1dir="none";;
6763         esac;;
6764 esac
6765 echo "If you don't want the manual sources installed, answer 'none'."
6766 case "$man1dir" in
6767 ' ') dflt=none
6768         ;;
6769 '')
6770         lookpath="$prefixexp/man/man1 $prefixexp/man/l_man/man1"
6771         lookpath="$lookpath $prefixexp/man/p_man/man1"
6772         lookpath="$lookpath $prefixexp/man/u_man/man1"
6773         lookpath="$lookpath $prefixexp/man/man.1"
6774         case "$sysman" in
6775         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
6776         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
6777         esac
6778         set dflt
6779         eval $prefixup
6780         ;;
6781 *)  dflt="$man1dir"
6782         ;;
6783 esac
6784 echo " "
6785 fn=dn+~
6786 rp="Where do the main $spackage manual pages (source) go?"
6787 . ./getfile
6788 if $test "X$man1direxp" != "X$ansexp"; then
6789         installman1dir=''
6790 fi
6791 man1dir="$ans"
6792 man1direxp="$ansexp"
6793 case "$man1dir" in
6794 '')     man1dir=' '
6795         installman1dir='';;
6796 esac
6797
6798 : Change installation prefix, if necessary.
6799 if $test X"$prefix" != X"$installprefix"; then
6800         installman1dir=`echo $man1direxp | $sed "s#^$prefix#$installprefix#"`
6801 else
6802         installman1dir="$man1direxp"
6803 fi
6804
6805 : What suffix to use on installed man pages
6806
6807 case "$man1dir" in
6808 ' ')
6809         man1ext='0'
6810         ;;
6811 *)
6812         rp="What suffix should be used for the main $spackage man pages?"
6813         case "$man1ext" in
6814         '')     case "$man1dir" in
6815                 *1)  dflt=1 ;;
6816                 *1p) dflt=1p ;;
6817                 *1pm) dflt=1pm ;;
6818                 *l) dflt=l;;
6819                 *n) dflt=n;;
6820                 *o) dflt=o;;
6821                 *p) dflt=p;;
6822                 *C) dflt=C;;
6823                 *L) dflt=L;;
6824                 *L1) dflt=L1;;
6825                 *) dflt=1;;
6826                 esac
6827                 ;;
6828         *)      dflt="$man1ext";;
6829         esac
6830         . ./myread
6831         man1ext="$ans"
6832         ;;
6833 esac
6834
6835 : see if we can have long filenames
6836 echo " "
6837 first=123456789abcdef
6838 $rm -f $first
6839 if (echo hi >$first) 2>/dev/null; then
6840         if $test -f 123456789abcde; then
6841                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
6842                 val="$undef"
6843         else
6844                 echo 'You can have filenames longer than 14 characters.'>&4
6845                 val="$define"
6846         fi
6847 else
6848         $cat <<'EOM'
6849 You can't have filenames longer than 14 chars.
6850 You can't even think about them!
6851 EOM
6852         val="$undef"
6853 fi 
6854 set d_flexfnam
6855 eval $setvar
6856 $rm -rf 123456789abcde*
6857
6858 : determine where library module manual pages go
6859 set man3dir man3dir none
6860 eval $prefixit
6861 $cat <<EOM
6862
6863 $spackage has manual pages for many of the library modules.
6864 EOM
6865
6866 case "$nroff" in
6867 nroff)
6868         $cat <<'EOM'
6869 However, you don't have nroff, so they're probably useless to you.
6870 EOM
6871         case "$man3dir" in
6872         '') man3dir="none";;
6873         esac;;
6874 esac
6875
6876 case "$d_flexfnam" in
6877 undef)
6878         $cat <<'EOM'
6879 However, your system can't handle the long file names like File::Basename.3. 
6880 EOM
6881         case "$man3dir" in
6882         '') man3dir="none";;
6883         esac;;
6884 esac
6885
6886 echo "If you don't want the manual sources installed, answer 'none'."
6887 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6888 case "$man3dir" in
6889 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
6890         if $test -d "$privlib/man/man3"; then
6891                 cat <<EOM >&4
6892
6893 WARNING:  Previous versions of perl installed man3 pages into
6894 $privlib/man/man3.  This version will suggest a 
6895 new default of $dflt.  
6896 EOM
6897                 tdflt=$dflt
6898                 dflt='n'
6899                 rp='Do you wish to preserve the old behavior?(y/n)'
6900                 . ./myread
6901                 case "$ans" in
6902                 y*) dflt="$privlib/man/man3" ;;
6903                 *)  dflt=$tdflt ;;
6904                 esac
6905     fi
6906         ;;
6907 *)      dflt="$man3dir" ;;
6908 esac
6909 case "$dflt" in
6910 ' ') dflt=none ;;
6911 esac
6912 echo " "
6913 fn=dn+~
6914 rp="Where do the $package library man pages (source) go?"
6915 . ./getfile
6916 man3dir="$ans"
6917 man3direxp="$ansexp"
6918 case "$man3dir" in
6919 '')     man3dir=' '
6920         installman3dir='';;
6921 esac
6922
6923 : Change installation prefix, if necessary.
6924 if $test X"$prefix" != X"$installprefix"; then
6925         installman3dir=`echo $man3direxp | $sed "s#^$prefix#$installprefix#"`
6926 else
6927         installman3dir="$man3direxp"
6928 fi
6929
6930 : What suffix to use on installed man pages
6931 case "$man3dir" in
6932 ' ')
6933         man3ext='0'
6934         ;;
6935 *)
6936         rp="What suffix should be used for the $package library man pages?"
6937         case "$man3ext" in
6938         '')     case "$man3dir" in
6939                 *3)  dflt=3 ;;
6940                 *3p) dflt=3p ;;
6941                 *3pm) dflt=3pm ;;
6942                 *l) dflt=l;;
6943                 *n) dflt=n;;
6944                 *o) dflt=o;;
6945                 *p) dflt=p;;
6946                 *C) dflt=C;;
6947                 *L) dflt=L;;
6948                 *L3) dflt=L3;;
6949                 *) dflt=3;;
6950                 esac
6951                 ;;
6952         *)      dflt="$man3ext";;
6953         esac
6954         . ./myread
6955         man3ext="$ans"
6956         ;;
6957 esac
6958
6959 : see if we have to deal with yellow pages, now NIS.
6960 if $test -d /usr/etc/yp || $test -d /etc/yp; then
6961         if $test -f /usr/etc/nibindd; then
6962                 echo " "
6963                 echo "I'm fairly confident you're on a NeXT."
6964                 echo " "
6965                 rp='Do you get the hosts file via NetInfo?'
6966                 dflt=y
6967                 case "$hostcat" in
6968                 nidump*) ;;
6969                 '') ;;
6970                 *) dflt=n;;
6971                 esac
6972                 . ./myread
6973                 case "$ans" in
6974                 y*) hostcat='nidump hosts .';;
6975                 *)      case "$hostcat" in
6976                         nidump*) hostcat='';;
6977                         esac
6978                         ;;
6979                 esac
6980         fi
6981         case "$hostcat" in
6982         nidump*) ;;
6983         *)
6984                 case "$hostcat" in
6985                 *ypcat*) dflt=y;;
6986                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
6987                                 dflt=y
6988                         else
6989                                 dflt=n
6990                         fi;;
6991                 *) dflt=n;;
6992                 esac
6993                 echo " "
6994                 rp='Are you getting the hosts file via yellow pages?'
6995                 . ./myread
6996                 case "$ans" in
6997                 y*) hostcat='ypcat hosts';;
6998                 *) hostcat='cat /etc/hosts';;
6999                 esac
7000                 ;;
7001         esac
7002 fi
7003 case "$hostcat" in
7004 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
7005 esac
7006 case "$groupcat" in
7007 '') test -f /etc/group && groupcat='cat /etc/group';;
7008 esac
7009 case "$passcat" in
7010 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
7011 esac
7012
7013 : now get the host name
7014 echo " "
7015 echo "Figuring out host name..." >&4
7016 case "$myhostname" in
7017 '') cont=true
7018         echo 'Maybe "hostname" will work...'
7019         if tans=`sh -c hostname 2>&1` ; then
7020                 myhostname=$tans
7021                 phostname=hostname
7022                 cont=''
7023         fi
7024         ;;
7025 *) cont='';;
7026 esac
7027 if $test "$cont"; then
7028         if ./xenix; then
7029                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
7030                 if tans=`cat /etc/systemid 2>&1` ; then
7031                         myhostname=$tans
7032                         phostname='cat /etc/systemid'
7033                         echo "Whadyaknow.  Xenix always was a bit strange..."
7034                         cont=''
7035                 fi
7036         elif $test -r /etc/systemid; then
7037                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
7038         fi
7039 fi
7040 if $test "$cont"; then
7041         echo 'No, maybe "uuname -l" will work...'
7042         if tans=`sh -c 'uuname -l' 2>&1` ; then
7043                 myhostname=$tans
7044                 phostname='uuname -l'
7045         else
7046                 echo 'Strange.  Maybe "uname -n" will work...'
7047                 if tans=`sh -c 'uname -n' 2>&1` ; then
7048                         myhostname=$tans
7049                         phostname='uname -n'
7050                 else
7051                         echo 'Oh well, maybe I can mine it out of whoami.h...'
7052                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
7053                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
7054                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
7055                         else
7056                                 case "$myhostname" in
7057                                 '') echo "Does this machine have an identity crisis or something?"
7058                                         phostname='';;
7059                                 *)
7060                                         echo "Well, you said $myhostname before..."
7061                                         phostname='echo $myhostname';;
7062                                 esac
7063                         fi
7064                 fi
7065         fi
7066 fi
7067 : you do not want to know about this
7068 set $myhostname
7069 myhostname=$1
7070
7071 : verify guess
7072 if $test "$myhostname" ; then
7073         dflt=y
7074         rp='Your host name appears to be "'$myhostname'".'" Right?"
7075         . ./myread
7076         case "$ans" in
7077         y*) ;;
7078         *) myhostname='';;
7079         esac
7080 fi
7081
7082 : bad guess or no guess
7083 while $test "X$myhostname" = X ; do
7084         dflt=''
7085         rp="Please type the (one word) name of your host:"
7086         . ./myread
7087         myhostname="$ans"
7088 done
7089
7090 : translate upper to lower if necessary
7091 case "$myhostname" in
7092 *[A-Z]*)
7093         echo "(Normalizing case in your host name)"
7094         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
7095         ;;
7096 esac
7097
7098 case "$myhostname" in
7099 *.*)
7100         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
7101         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
7102         echo "(Trimming domain name from host name--host name is now $myhostname)"
7103         ;;
7104 *) case "$mydomain" in
7105         '')
7106                 {
7107                         test "X$hostcat" = "Xypcat hosts" &&
7108                         ypmatch "$myhostname" hosts 2>/dev/null |\
7109                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
7110                         $test -s hosts
7111                 } || {
7112                         test "X$hostcat" != "X" &&
7113                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
7114                                         /[       ]$myhostname[  . ]/p" > hosts
7115                 }
7116                 tmp_re="[       . ]"
7117                 $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
7118                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
7119                 dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
7120                         hosts | $sort | $uniq | \
7121                         $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
7122                 case `$echo X$dflt` in
7123                 X*\ *)  echo "(Several hosts in /etc/hosts matched hostname)"
7124                         dflt=.
7125                         ;;
7126                 X.) echo "(You do not have fully-qualified names in /etc/hosts)"
7127                         ;;
7128                 esac
7129                 case "$dflt" in
7130                 .)
7131                         tans=`./loc resolv.conf X /etc /usr/etc`
7132                         if $test -f "$tans"; then
7133                                 echo "(Attempting domain name extraction from $tans)"
7134                                 dflt=.`$sed -n -e 's/   / /g' \
7135                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
7136                                   | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
7137                                 case "$dflt" in
7138                                 .) dflt=.`$sed -n -e 's/        / /g' \
7139                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
7140                                      | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
7141                                         ;;
7142                                 esac
7143                         fi
7144                         ;;
7145                 esac
7146                 case "$dflt" in
7147                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
7148                         dflt=.`sh -c domainname 2>/dev/null`
7149                         case "$dflt" in
7150                         '') dflt='.';;
7151                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
7152                         esac
7153                         ;;
7154                 esac
7155                 case "$dflt" in
7156                 .) echo "(Lost all hope -- silly guess then)"
7157                         dflt='.uucp'
7158                         ;;
7159                 esac
7160                 $rm -f hosts
7161                 ;;
7162         *) dflt="$mydomain";;
7163         esac;;
7164 esac
7165 echo " "
7166 rp="What is your domain name?"
7167 . ./myread
7168 tans="$ans"
7169 case "$ans" in
7170 '') ;;
7171 .*) ;;
7172 *) tans=".$tans";;
7173 esac
7174 mydomain="$tans"
7175
7176 : translate upper to lower if necessary
7177 case "$mydomain" in
7178 *[A-Z]*)
7179         echo "(Normalizing case in your domain name)"
7180         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
7181         ;;
7182 esac
7183
7184 : a little sanity check here
7185 case "$phostname" in
7186 '') ;;
7187 *)
7188         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
7189         $myhostname$mydomain|$myhostname) ;;
7190         *)
7191                 case "$phostname" in
7192                 sed*)
7193                         echo "(That doesn't agree with your whoami.h file, by the way.)"
7194                         ;;
7195                 *)
7196                         echo "(That doesn't agree with your $phostname command, by the way.)"
7197                         ;;
7198                 esac
7199         ;;
7200         esac
7201         ;;
7202 esac
7203
7204 $cat <<EOM
7205
7206 I need to get your e-mail address in Internet format if possible, i.e.
7207 something like user@host.domain. Please answer accurately since I have
7208 no easy means to double check it. The default value provided below
7209 is most probably close to reality but may not be valid from outside
7210 your organization...
7211
7212 EOM
7213 cont=x
7214 while test "$cont"; do
7215         case "$cf_email" in
7216         '') dflt="$cf_by@$myhostname$mydomain";;
7217         *) dflt="$cf_email";;
7218         esac
7219         rp='What is your e-mail address?'
7220         . ./myread
7221         cf_email="$ans"
7222         case "$cf_email" in
7223         *@*.*) cont='' ;;
7224         *)
7225                 rp='Address does not look like an Internet one.  Use it anyway?'
7226                 case "$fastread" in
7227                 yes) dflt=y ;;
7228                 *) dflt=n ;;
7229                 esac
7230                 . ./myread
7231                 case "$ans" in
7232                 y*) cont='' ;;
7233                 *) echo " " ;;
7234                 esac
7235                 ;;
7236         esac
7237 done
7238
7239 $cat <<EOM
7240
7241 If you or somebody else will be maintaining perl at your site, please
7242 fill in the correct e-mail address here so that they may be contacted
7243 if necessary. Currently, the "perlbug" program included with perl
7244 will send mail to this address in addition to perlbug@perl.org. You may
7245 enter "none" for no administrator.
7246
7247 EOM
7248 case "$perladmin" in
7249 '') dflt="$cf_email";;
7250 *) dflt="$perladmin";;
7251 esac
7252 rp='Perl administrator e-mail address'
7253 . ./myread
7254 perladmin="$ans"
7255
7256 : figure out how to guarantee perl startup
7257 case "$startperl" in
7258 '')
7259         case "$sharpbang" in
7260         *!)
7261                 $cat <<EOH
7262
7263 I can use the #! construct to start perl on your system. This will
7264 make startup of perl scripts faster, but may cause problems if you
7265 want to share those scripts and perl is not in a standard place
7266 ($binexp/perl) on all your platforms. The alternative is to force
7267 a shell by starting the script with a single ':' character.
7268
7269 EOH
7270                 dflt="$binexp/perl"
7271                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
7272                 . ./myread
7273                 case "$ans" in
7274                 none)   startperl=": # use perl";;
7275                 *)      startperl="#!$ans"
7276                         if $test 30 -lt `echo "$ans" | wc -c`; then
7277                                 $cat >&4 <<EOM
7278
7279 WARNING:  Some systems limit the #! command to 32 characters.
7280 If you experience difficulty running Perl scripts with #!, try
7281 installing Perl in a directory with a shorter pathname.
7282
7283 EOM
7284                         fi ;;
7285                 esac
7286                 ;;
7287         *) startperl=": # use perl"
7288                 ;;
7289         esac
7290         ;;
7291 esac
7292 echo "I'll use $startperl to start perl scripts."
7293
7294 : figure best path for perl in scripts
7295 case "$perlpath" in
7296 '')
7297         perlpath="$binexp/perl"
7298         case "$startperl" in
7299         *!*) ;;
7300         *)
7301                 $cat <<EOH
7302
7303 I will use the "eval 'exec'" idiom to start Perl on your system.
7304 I can use the full path of your Perl binary for this purpose, but
7305 doing so may cause problems if you want to share those scripts and
7306 Perl is not always in a standard place ($binexp/perl).
7307
7308 EOH
7309                 dflt="$binexp/perl"
7310                 rp="What path shall I use in \"eval 'exec'\"?"
7311                 . ./myread
7312                 perlpath="$ans"
7313                 ;;
7314         esac
7315         ;;
7316 esac
7317 case "$startperl" in
7318 *!*)    ;;
7319 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
7320 esac
7321
7322 : determine where public executable scripts go
7323 set scriptdir scriptdir
7324 eval $prefixit
7325 case "$scriptdir" in
7326 '')
7327         dflt="$bin"
7328         : guess some guesses
7329         $test -d /usr/share/scripts && dflt=/usr/share/scripts
7330         $test -d /usr/share/bin     && dflt=/usr/share/bin
7331         $test -d /usr/local/script  && dflt=/usr/local/script
7332         $test -d /usr/local/scripts && dflt=/usr/local/scripts
7333         $test -d $prefixexp/script  && dflt=$prefixexp/script
7334         set dflt
7335         eval $prefixup
7336         ;;
7337 *)  dflt="$scriptdir"
7338         ;;
7339 esac
7340 $cat <<EOM
7341  
7342 Some installations have a separate directory just for executable scripts so
7343 that they can mount it across multiple architectures but keep the scripts in
7344 one spot.  You might, for example, have a subdirectory of /usr/share for this.
7345 Or you might just lump your scripts in with all your other executables.
7346  
7347 EOM
7348 fn=d~
7349 rp='Where do you keep publicly executable scripts?'
7350 . ./getfile
7351 if $test "X$ansexp" != "X$scriptdirexp"; then
7352         installscript=''
7353 fi
7354 scriptdir="$ans"
7355 scriptdirexp="$ansexp"
7356 : Change installation prefix, if necessary.
7357 if $test X"$prefix" != X"$installprefix"; then
7358         installscript=`echo $scriptdirexp | sed "s#^$prefix#$installprefix#"`
7359 else
7360         installscript="$scriptdirexp"
7361 fi
7362
7363 : determine where add-on public executables go
7364 case "$sitebin" in
7365 '')     dflt=$siteprefix/bin ;;
7366 *)      dflt=$sitebin ;;
7367 esac
7368 fn=d~
7369 rp='Pathname where the add-on public executables should be installed?'
7370 . ./getfile
7371 sitebin="$ans"
7372 sitebinexp="$ansexp"
7373 : Change installation prefix, if necessary.
7374 if $test X"$prefix" != X"$installprefix"; then
7375         installsitebin=`echo $sitebinexp | sed "s#^$prefix#$installprefix#"`
7376 else
7377         installsitebin="$sitebinexp"
7378 fi
7379
7380 case "$useperlio" in
7381 $define|true|[yY]*)     dflt='y';;
7382 *) dflt='n';;
7383 esac
7384 cat <<EOM
7385
7386 Previous version of $package used the standard IO mechanisms as defined
7387 in <stdio.h>.  Versions 5.003_02 and later of perl allow alternate IO
7388 mechanisms via a "PerlIO" abstraction, but the stdio mechanism is still
7389 the default.  This abstraction layer can use AT&T's sfio (if you already
7390 have sfio installed) or regular stdio.  Using PerlIO with sfio may cause
7391 problems with some extension modules.  Using PerlIO with stdio is safe,
7392 but it is slower than plain stdio and therefore is not the default.
7393
7394 If this doesn't make any sense to you, just accept the default '$dflt'.
7395 EOM
7396 rp='Use the experimental PerlIO abstraction layer?'
7397 . ./myread
7398 case "$ans" in
7399 y|Y) 
7400         val="$define"
7401         ;;     
7402 *)      
7403         echo "Ok, doing things the stdio way"
7404         val="$undef"
7405         ;;
7406 esac
7407 set useperlio
7408 eval $setvar 
7409
7410 case "$vendorprefix" in
7411 '')     d_vendorbin="$undef"
7412         vendorbin=''
7413         vendorbinexp=''
7414         ;;
7415 *)      d_vendorbin="$define"
7416         : determine where vendor-supplied executables go.
7417         case "$vendorbin" in
7418         '') dflt=$vendorprefix/bin ;;
7419         *)      dflt="$vendorbin" ;;
7420         esac
7421         fn=d~+
7422         rp='Pathname for the vendor-supplied executables directory?'
7423         . ./getfile
7424         vendorbin="$ans"
7425         vendorbinexp="$ansexp"
7426         ;;
7427 esac
7428 : Change installation prefix, if necessary.
7429 if $test X"$prefix" != X"$installprefix"; then
7430         installvendorbin=`echo $vendorbinexp | $sed "s#^$prefix#$installprefix#"`
7431 else
7432         installvendorbin="$vendorbinexp"
7433 fi
7434
7435 : see if qgcvt exists
7436 set qgcvt d_qgcvt
7437 eval $inlibc
7438
7439 echo " "
7440
7441 if $test X"$d_longdbl" = X"$define"; then
7442
7443 echo "Checking how to print long doubles..." >&4
7444
7445 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
7446         $cat >try.c <<'EOCP'
7447 #include <sys/types.h>
7448 #include <stdio.h>
7449 int main() {
7450   double d = 123.456;
7451   printf("%.3f\n", d);
7452 }
7453 EOCP
7454         set try
7455         if eval $compile; then
7456                 yyy=`./try$exe_ext`
7457                 case "$yyy" in
7458                 123.456)
7459                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
7460                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
7461                         echo "We will use %f."
7462                         ;;
7463                 esac
7464         fi
7465 fi
7466
7467 if $test X"$sPRIfldbl" = X; then
7468         $cat >try.c <<'EOCP'
7469 #include <sys/types.h>
7470 #include <stdio.h>
7471 int main() {
7472   long double d = 123.456;
7473   printf("%.3llf\n", d);
7474 }
7475 EOCP
7476         set try
7477         if eval $compile; then
7478                 yyy=`./try$exe_ext`
7479                 case "$yyy" in
7480                 123.456)
7481                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
7482                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
7483                         echo "We will use %llf."
7484                         ;;
7485                 esac
7486         fi
7487 fi
7488
7489 if $test X"$sPRIfldbl" = X; then
7490         $cat >try.c <<'EOCP'
7491 #include <sys/types.h>
7492 #include <stdio.h>
7493 int main() {
7494   long double d = 123.456;
7495   printf("%.3Lf\n", d);
7496 }
7497 EOCP
7498         set try
7499         if eval $compile; then
7500                 yyy=`./try$exe_ext`
7501                 case "$yyy" in
7502                 123.456)
7503                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
7504                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
7505                         echo "We will use %Lf."
7506                         ;;
7507                 esac
7508         fi
7509 fi
7510
7511 if $test X"$sPRIfldbl" = X; then
7512         $cat >try.c <<'EOCP'
7513 #include <sys/types.h>
7514 #include <stdio.h>
7515 int main() {
7516   long double d = 123.456;
7517   printf("%.3lf\n", d);
7518 }
7519 EOCP
7520         set try
7521         if eval $compile; then
7522                 yyy=`./try$exe_ext`
7523                 case "$yyy" in
7524                 123.456)
7525                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
7526                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
7527                         echo "We will use %lf."
7528                         ;;
7529                 esac
7530         fi
7531 fi
7532
7533 if $test X"$sPRIfldbl" = X; then
7534         echo "Cannot figure out how to print long doubles." >&4
7535 else
7536         sSCNfldbl=$sPRIfldbl    # expect consistency
7537 fi
7538
7539 $rm -f try try.*
7540
7541 fi # d_longdbl
7542
7543 case "$sPRIfldbl" in
7544 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef"; 
7545         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef"; 
7546         d_SCNfldbl="$undef";
7547         ;;
7548 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define"; 
7549         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define"; 
7550         d_SCNfldbl="$define";
7551         ;;
7552 esac
7553
7554 : Check how to convert floats to strings.
7555 echo " "
7556 echo "Checking for an efficient way to convert floats to strings."
7557 echo " " > try.c
7558 case "$uselongdouble" in
7559 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
7560 esac
7561 case "$d_longdbl" in
7562 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
7563 esac
7564 case "$d_PRIgldbl" in
7565 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
7566 esac
7567 $cat >>try.c <<EOP
7568 #ifdef TRY_gconvert
7569 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
7570 char *myname = "gconvert";
7571 #endif
7572 #ifdef TRY_gcvt
7573 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
7574 char *myname = "gcvt";
7575 #endif
7576 #ifdef TRY_qgcvt
7577 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
7578 char *myname = "qgcvt";
7579 #define DOUBLETYPE long double
7580 #endif
7581 #ifdef TRY_sprintf
7582 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE) && defined(HAS_PRIgldbl)
7583 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
7584 #else
7585 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
7586 #endif
7587 char *myname = "sprintf";
7588 #endif
7589
7590 #ifndef DOUBLETYPE
7591 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
7592 #define DOUBLETYPE long double
7593 #else
7594 #define DOUBLETYPE double
7595 #endif
7596 #endif
7597
7598 #include <stdio.h>
7599
7600 #define I_STDLIB $i_stdlib
7601 #ifdef I_STDLIB
7602 #include <stdlib.h>
7603 #endif
7604
7605 int
7606 checkit(expect, got)
7607 char *expect;
7608 char *got;
7609 {
7610     if (strcmp(expect, got)) {
7611                 printf("%s oddity:  Expected %s, got %s\n",
7612                         myname, expect, got);
7613                 exit(1);
7614         }
7615 }
7616
7617 int main()
7618
7619         char buf[64]; 
7620         buf[63] = '\0';
7621
7622         /* This must be 1st test on (which?) platform */
7623         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
7624         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
7625         checkit("0.1", buf);
7626
7627         Gconvert((DOUBLETYPE)1.0, 8, 0, buf); 
7628         checkit("1", buf);
7629
7630         Gconvert((DOUBLETYPE)1.1, 8, 0, buf); 
7631         checkit("1.1", buf);
7632
7633         Gconvert((DOUBLETYPE)1.01, 8, 0, buf); 
7634         checkit("1.01", buf);
7635
7636         Gconvert((DOUBLETYPE)1.001, 8, 0, buf); 
7637         checkit("1.001", buf);
7638
7639         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf); 
7640         checkit("1.0001", buf);
7641
7642         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf); 
7643         checkit("1.00001", buf);
7644
7645         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf); 
7646         checkit("1.000001", buf);
7647
7648         Gconvert((DOUBLETYPE)0.0, 8, 0, buf); 
7649         checkit("0", buf);
7650
7651         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf); 
7652         checkit("-1", buf);
7653
7654         /* Some Linux gcvt's give 1.e+5 here. */
7655         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf); 
7656         checkit("100000", buf);
7657         
7658         /* Some Linux gcvt's give -1.e+5 here. */
7659         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf); 
7660         checkit("-100000", buf);
7661
7662         Gconvert((DOUBLETYPE)123.456, 8, 0, buf); 
7663         checkit("123.456", buf);
7664
7665         exit(0);
7666 }
7667 EOP
7668 case "$d_Gconvert" in
7669 gconvert*) xxx_list='gconvert gcvt sprintf' ;;
7670 gcvt*) xxx_list='gcvt gconvert sprintf' ;;
7671 sprintf*) xxx_list='sprintf gconvert gcvt' ;;
7672 *) xxx_list='gconvert gcvt sprintf' ;;
7673 esac
7674
7675 case "$d_longdbl$uselongdouble$d_PRIgldbl" in
7676 "$define$define$define")
7677     # for long doubles prefer first qgcvt, then sprintf
7678     xxx_list="`echo $xxx_list|sed s/sprintf//`" 
7679     xxx_list="sprintf $xxx_list"
7680     case "$d_qgcvt" in
7681     "$define") xxx_list="qgcvt $xxx_list" ;;
7682     esac
7683     ;;
7684 esac
7685
7686 for xxx_convert in $xxx_list; do
7687         echo "Trying $xxx_convert..."
7688         $rm -f try try$_o
7689         set try -DTRY_$xxx_convert
7690         if eval $compile; then
7691                 echo "$xxx_convert() found." >&4
7692                 if ./try; then
7693                         echo "I'll use $xxx_convert to convert floats into a string." >&4
7694                         break;
7695                 else
7696                         echo "...But $xxx_convert didn't work as I expected."
7697                 fi
7698         else
7699                 echo "$xxx_convert NOT found." >&4
7700         fi
7701 done
7702         
7703 case "$xxx_convert" in
7704 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
7705 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
7706 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
7707 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
7708    "$define$define$define")
7709       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
7710    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
7711    esac
7712    ;;  
7713 esac
7714
7715 : Initialize h_fcntl
7716 h_fcntl=false
7717
7718 : Initialize h_sysfile
7719 h_sysfile=false
7720
7721 : access call always available on UNIX
7722 set access d_access
7723 eval $inlibc
7724
7725 : locate the flags for 'access()'
7726 case "$d_access" in
7727 "$define")
7728         echo " "
7729         $cat >access.c <<'EOCP'
7730 #include <sys/types.h>
7731 #ifdef I_FCNTL
7732 #include <fcntl.h>
7733 #endif
7734 #ifdef I_SYS_FILE
7735 #include <sys/file.h>
7736 #endif
7737 #ifdef I_UNISTD
7738 #include <unistd.h>
7739 #endif
7740 int main() {
7741         exit(R_OK);
7742 }
7743 EOCP
7744         : check sys/file.h first, no particular reason here
7745         if $test `./findhdr sys/file.h` && \
7746                 $cc $cppflags -DI_SYS_FILE -o access access.c >/dev/null 2>&1 ; then
7747                 h_sysfile=true;
7748                 echo "<sys/file.h> defines the *_OK access constants." >&4
7749         elif $test `./findhdr fcntl.h` && \
7750                 $cc $cppflags -DI_FCNTL -o access access.c >/dev/null 2>&1 ; then
7751                 h_fcntl=true;
7752                 echo "<fcntl.h> defines the *_OK access constants." >&4
7753         elif $test `./findhdr unistd.h` && \
7754                 $cc $cppflags -DI_UNISTD -o access access.c >/dev/null 2>&1 ; then
7755                 echo "<unistd.h> defines the *_OK access constants." >&4
7756         else
7757                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
7758         fi
7759         ;;
7760 esac
7761 $rm -f access*
7762
7763 : see if accessx exists
7764 set accessx d_accessx
7765 eval $inlibc
7766
7767 : see if alarm exists
7768 set alarm d_alarm
7769 eval $inlibc
7770
7771 : see if atolf exists
7772 set atolf d_atolf
7773 eval $inlibc
7774
7775 : see if atoll exists
7776 set atoll d_atoll
7777 eval $inlibc
7778
7779 : Look for GNU-cc style attribute checking
7780 echo " "
7781 echo "Checking whether your compiler can handle __attribute__ ..." >&4
7782 $cat >attrib.c <<'EOCP'
7783 #include <stdio.h>
7784 void croak (char* pat,...) __attribute__((format(printf,1,2),noreturn));
7785 EOCP
7786 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
7787         if $contains 'warning' attrib.out >/dev/null 2>&1; then
7788                 echo "Your C compiler doesn't fully support __attribute__."
7789                 val="$undef"
7790         else
7791                 echo "Your C compiler supports __attribute__."
7792                 val="$define"
7793         fi
7794 else
7795         echo "Your C compiler doesn't seem to understand __attribute__ at all."
7796         val="$undef"
7797 fi
7798 set d_attribut
7799 eval $setvar
7800 $rm -f attrib*
7801
7802 : see if bcmp exists
7803 set bcmp d_bcmp
7804 eval $inlibc
7805
7806 : see if bcopy exists
7807 set bcopy d_bcopy
7808 eval $inlibc
7809
7810 : see if this is a unistd.h system
7811 set unistd.h i_unistd
7812 eval $inhdr
7813
7814 : see if getpgrp exists
7815 set getpgrp d_getpgrp
7816 eval $inlibc
7817
7818 case "$d_getpgrp" in
7819 "$define")
7820         echo " "
7821         echo "Checking to see which flavor of getpgrp is in use..."
7822         $cat >set.c <<EOP
7823 #$i_unistd I_UNISTD
7824 #include <sys/types.h>
7825 #ifdef I_UNISTD
7826 #  include <unistd.h>
7827 #endif
7828 int main()
7829 {
7830         if (getuid() == 0) {
7831                 printf("(I see you are running Configure as super-user...)\n");
7832                 setuid(1);
7833         }
7834 #ifdef TRY_BSD_PGRP
7835         if (getpgrp(1) == 0)
7836                 exit(0);
7837 #else
7838         if (getpgrp() > 0)
7839                 exit(0);
7840 #endif
7841         exit(1);
7842 }
7843 EOP
7844         if $cc -DTRY_BSD_PGRP $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7845                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
7846                 val="$define"
7847         elif $cc $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7848                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
7849                 val="$undef"
7850         else
7851                 echo "I can't seem to compile and run the test program."
7852                 if ./usg; then
7853                         xxx="a USG one, i.e. you use getpgrp()."
7854                 else
7855                         # SVR4 systems can appear rather BSD-ish.
7856                         case "$i_unistd" in
7857                         $undef)
7858                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
7859                                 val="$define"
7860                                 ;;
7861                         $define)
7862                                 xxx="probably a USG one, i.e. you use getpgrp()."
7863                                 val="$undef"
7864                                 ;;
7865                         esac
7866                 fi
7867                 echo "Assuming your getpgrp is $xxx" >&4
7868         fi
7869         ;;
7870 *) val="$undef";;
7871 esac
7872 set d_bsdgetpgrp
7873 eval $setvar
7874 $rm -f set set.c
7875
7876 : see if setpgrp exists
7877 set setpgrp d_setpgrp
7878 eval $inlibc
7879
7880 case "$d_setpgrp" in
7881 "$define")
7882         echo " "
7883         echo "Checking to see which flavor of setpgrp is in use..."
7884         $cat >set.c <<EOP
7885 #$i_unistd I_UNISTD
7886 #include <sys/types.h>
7887 #ifdef I_UNISTD
7888 #  include <unistd.h>
7889 #endif
7890 int main()
7891 {
7892         if (getuid() == 0) {
7893                 printf("(I see you are running Configure as super-user...)\n");
7894                 setuid(1);
7895         }
7896 #ifdef TRY_BSD_PGRP
7897         if (-1 == setpgrp(1, 1))
7898                 exit(0);
7899 #else
7900         if (setpgrp() != -1)
7901                 exit(0);
7902 #endif
7903         exit(1);
7904 }
7905 EOP
7906         if $cc -DTRY_BSD_PGRP $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7907                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
7908                 val="$define"
7909         elif $cc $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7910                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
7911                 val="$undef"
7912         else
7913                 echo "(I can't seem to compile and run the test program.)"
7914                 if ./usg; then
7915                         xxx="a USG one, i.e. you use setpgrp()."
7916                 else
7917                         # SVR4 systems can appear rather BSD-ish.
7918                         case "$i_unistd" in
7919                         $undef)
7920                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
7921                                 val="$define"
7922                                 ;;
7923                         $define)
7924                                 xxx="probably a USG one, i.e. you use setpgrp()."
7925                                 val="$undef"
7926                                 ;;
7927                         esac
7928                 fi
7929                 echo "Assuming your setpgrp is $xxx" >&4
7930         fi
7931         ;;
7932 *) val="$undef";;
7933 esac
7934 set d_bsdsetpgrp
7935 eval $setvar
7936 $rm -f set set.c
7937 : see if bzero exists
7938 set bzero d_bzero
7939 eval $inlibc
7940
7941 : see if signal is declared as pointer to function returning int or void
7942 echo " "
7943 xxx=`./findhdr signal.h`
7944 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
7945 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
7946         echo "You have int (*signal())() instead of void." >&4
7947         val="$undef"
7948 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
7949         echo "You have void (*signal())()." >&4
7950         val="$define"
7951 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
7952         echo "You have int (*signal())() instead of void." >&4
7953         val="$undef"
7954 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
7955         echo "You have void (*signal())()." >&4
7956         val="$define"
7957 else
7958         case "$d_voidsig" in
7959         '')
7960         echo "I can't determine whether signal handler returns void or int..." >&4
7961                 dflt=void
7962                 rp="What type does your signal handler return?"
7963                 . ./myread
7964                 case "$ans" in
7965                 v*) val="$define";;
7966                 *) val="$undef";;
7967                 esac;;
7968         "$define")
7969                 echo "As you already told me, signal handler returns void." >&4
7970                 val="$define"
7971                 ;;
7972         *)      echo "As you already told me, signal handler returns int." >&4
7973                 val="$undef"
7974                 ;;
7975         esac
7976 fi
7977 set d_voidsig
7978 eval $setvar
7979 case "$d_voidsig" in
7980 "$define") signal_t="void";;
7981 *) signal_t="int";;
7982 esac
7983 $rm -f $$.tmp
7984
7985 : check for ability to cast large floats to 32-bit ints.
7986 echo " "
7987 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
7988 if $test "$intsize" -ge 4; then
7989         xxx=int
7990 else
7991         xxx=long
7992 fi
7993 $cat >try.c <<EOCP
7994 #include <stdio.h>
7995 #include <sys/types.h>
7996 #include <signal.h>
7997 $signal_t blech(s) int s; { exit(3); }
7998 int main()
7999 {
8000         $xxx i32;
8001         double f, g;
8002         int result = 0;
8003         char str[16];
8004         signal(SIGFPE, blech);
8005
8006         /* Don't let compiler optimize the test away.  Store the number 
8007            in a writable string for gcc to pass to sscanf under HP/UX.
8008         */
8009         sprintf(str, "2147483647");
8010         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
8011         g = 10 * f;
8012         i32  = ($xxx) g;
8013
8014         /* x86 processors will probably give 0x8000 0000, which is a
8015        sign change.  We don't want that.  We want to mimic SPARC
8016            behavior here, which is to preserve the sign and give
8017            back 0x7fff ffff.
8018         */
8019         if (i32 != ($xxx) f)
8020                 result |= 1;
8021         exit(result);
8022 }
8023 EOCP
8024 set try
8025 if eval $compile_ok; then
8026         ./try
8027         yyy=$?
8028 else
8029         echo "(I can't seem to compile the test program--assuming it can't)"
8030         yyy=1
8031 fi
8032 case "$yyy" in
8033 0)      val="$define"
8034         echo "Yup, it can."
8035         ;;
8036 *)      val="$undef"
8037         echo "Nope, it can't."
8038         ;;
8039 esac
8040 set d_casti32
8041 eval $setvar
8042 $rm -f try try.*
8043
8044 : check for ability to cast negative floats to unsigned
8045 echo " "
8046 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
8047 $cat >try.c <<EOCP
8048 #include <stdio.h>
8049 #include <sys/types.h>
8050 #include <signal.h>
8051 $signal_t blech(s) int s; { exit(7); }
8052 $signal_t blech_in_list(s) int s; { exit(4); }
8053 unsigned long dummy_long(p) unsigned long p; { return p; }
8054 unsigned int dummy_int(p) unsigned int p; { return p; }
8055 unsigned short dummy_short(p) unsigned short p; { return p; }
8056 int main()
8057 {
8058         double f;
8059         unsigned long along;
8060         unsigned int aint;
8061         unsigned short ashort;
8062         int result = 0;
8063         char str[16];
8064         
8065         /* Frustrate gcc-2.7.2's optimizer which failed this test with
8066            a direct f = -123. assignment.  gcc-2.8.0 reportedly
8067            optimized the whole file away
8068         */
8069         /* Store the number in a writable string for gcc to pass to 
8070            sscanf under HP/UX.
8071         */
8072         sprintf(str, "-123");
8073         sscanf(str, "%lf", &f);  /* f = -123.; */
8074
8075         signal(SIGFPE, blech);
8076         along = (unsigned long)f;
8077         aint = (unsigned int)f;
8078         ashort = (unsigned short)f;
8079         if (along != (unsigned long)-123)
8080                 result |= 1;
8081         if (aint != (unsigned int)-123)
8082                 result |= 1;
8083         if (ashort != (unsigned short)-123)
8084                 result |= 1;
8085         sprintf(str, "1073741824.");
8086         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
8087         f = f + f;
8088         along = 0;
8089         along = (unsigned long)f;
8090         if (along != 0x80000000)
8091                 result |= 2;
8092         f -= 1.;
8093         along = 0;
8094         along = (unsigned long)f;
8095         if (along != 0x7fffffff)
8096                 result |= 1;
8097         f += 2.;
8098         along = 0;
8099         along = (unsigned long)f;
8100         if (along != 0x80000001)
8101                 result |= 2;
8102         if (result)
8103                 exit(result);
8104         signal(SIGFPE, blech_in_list);
8105         sprintf(str, "123.");
8106         sscanf(str, "%lf", &f);  /* f = 123.; */
8107         along = dummy_long((unsigned long)f);
8108         aint = dummy_int((unsigned int)f);
8109         ashort = dummy_short((unsigned short)f);
8110         if (along != (unsigned long)123)
8111                 result |= 4;
8112         if (aint != (unsigned int)123)
8113                 result |= 4;
8114         if (ashort != (unsigned short)123)
8115                 result |= 4;
8116         exit(result);
8117
8118 }
8119 EOCP
8120 set try
8121 if eval $compile_ok; then
8122         ./try
8123         castflags=$?
8124 else
8125         echo "(I can't seem to compile the test program--assuming it can't)"
8126         castflags=7
8127 fi
8128 case "$castflags" in
8129 0)      val="$define"
8130         echo "Yup, it can."
8131         ;;
8132 *)      val="$undef"
8133         echo "Nope, it can't."
8134         ;;
8135 esac
8136 set d_castneg
8137 eval $setvar
8138 $rm -f try.*
8139
8140 : see if vprintf exists
8141 echo " "
8142 if set vprintf val -f d_vprintf; eval $csym; $val; then
8143         echo 'vprintf() found.' >&4
8144         val="$define"
8145         $cat >vprintf.c <<'EOF'
8146 #include <varargs.h>
8147
8148 int main() { xxx("foo"); }
8149
8150 xxx(va_alist)
8151 va_dcl
8152 {
8153         va_list args;
8154         char buf[10];
8155
8156         va_start(args);
8157         exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
8158 }
8159 EOF
8160         set vprintf
8161         if eval $compile && ./vprintf; then
8162                 echo "Your vsprintf() returns (int)." >&4
8163                 val2="$undef"
8164         else
8165                 echo "Your vsprintf() returns (char*)." >&4
8166                 val2="$define"
8167         fi
8168 else
8169         echo 'vprintf() NOT found.' >&4
8170                 val="$undef"
8171                 val2="$undef"
8172 fi
8173 set d_vprintf
8174 eval $setvar
8175 val=$val2
8176 set d_charvspr
8177 eval $setvar
8178
8179 : see if chown exists
8180 set chown d_chown
8181 eval $inlibc
8182
8183 : see if chroot exists
8184 set chroot d_chroot
8185 eval $inlibc
8186
8187 : see if chsize exists
8188 set chsize d_chsize
8189 eval $inlibc
8190
8191 : check for const keyword
8192 echo " "
8193 echo 'Checking to see if your C compiler knows about "const"...' >&4
8194 $cat >const.c <<'EOCP'
8195 typedef struct spug { int drokk; } spug;
8196 int main()
8197 {
8198         const char *foo;
8199         const spug y;
8200 }
8201 EOCP
8202 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
8203         val="$define"
8204         echo "Yup, it does."
8205 else
8206         val="$undef"
8207         echo "Nope, it doesn't."
8208 fi
8209 set d_const
8210 eval $setvar
8211
8212 : see if crypt exists
8213 echo " "
8214 if set crypt val -f d_crypt; eval $csym; $val; then
8215         echo 'crypt() found.' >&4
8216         val="$define"
8217         cryptlib=''
8218 else
8219         cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
8220         if $test -z "$cryptlib"; then
8221                 cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
8222         else
8223                 cryptlib=-lcrypt
8224         fi
8225         if $test -z "$cryptlib"; then
8226                 cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
8227         else
8228                 cryptlib=-lcrypt
8229         fi
8230         if $test -z "$cryptlib"; then
8231                 cryptlib=`./loc libcrypt$_a "" $libpth`
8232         else
8233                 cryptlib=-lcrypt
8234         fi
8235         if $test -z "$cryptlib"; then
8236                 echo 'crypt() NOT found.' >&4
8237                 val="$undef"
8238         else
8239                 val="$define"
8240         fi
8241 fi
8242 set d_crypt
8243 eval $setvar
8244
8245 : get csh whereabouts
8246 case "$csh" in
8247 'csh') val="$undef" ;;
8248 *) val="$define" ;;
8249 esac
8250 set d_csh
8251 eval $setvar
8252 : Respect a hint or command line value for full_csh.
8253 case "$full_csh" in
8254 '') full_csh=$csh ;;
8255 esac
8256
8257 : see if cuserid exists
8258 set cuserid d_cuserid
8259 eval $inlibc
8260
8261 : see if this is a limits.h system
8262 set limits.h i_limits
8263 eval $inhdr
8264
8265 : see if this is a float.h system
8266 set float.h i_float
8267 eval $inhdr
8268
8269 : See if number of significant digits in a double precision number is known
8270 echo " "
8271 $cat >dbl_dig.c <<EOM
8272 #$i_limits I_LIMITS
8273 #$i_float I_FLOAT
8274 #ifdef I_LIMITS
8275 #include <limits.h>
8276 #endif
8277 #ifdef I_FLOAT
8278 #include <float.h>
8279 #endif
8280 #ifdef DBL_DIG
8281 printf("Contains DBL_DIG");
8282 #endif
8283 EOM
8284 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
8285 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
8286         echo "DBL_DIG found." >&4
8287         val="$define"
8288 else
8289         echo "DBL_DIG NOT found." >&4
8290         val="$undef"
8291 fi
8292 $rm -f dbl_dig.?
8293 set d_dbl_dig
8294 eval $setvar
8295
8296 : see if difftime exists
8297 set difftime d_difftime
8298 eval $inlibc
8299
8300 : see if this is a dirent system
8301 echo " "
8302 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
8303         val="$define"
8304         echo "<dirent.h> found." >&4
8305 else
8306         val="$undef"
8307         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
8308                 echo "<sys/dir.h> found." >&4
8309                 echo " "
8310         else
8311                 xinc=`./findhdr sys/ndir.h`
8312         fi
8313         echo "<dirent.h> NOT found." >&4
8314 fi
8315 set i_dirent
8316 eval $setvar
8317
8318 : Look for type of directory structure.
8319 echo " "
8320 $cppstdin $cppflags $cppminus < "$xinc" > try.c
8321
8322 case "$direntrytype" in
8323 ''|' ')
8324         case "$i_dirent" in
8325         $define) guess1='struct dirent' ;;
8326         *) guess1='struct direct'  ;;
8327         esac
8328         ;;
8329 *)      guess1="$direntrytype"
8330         ;;
8331 esac
8332
8333 case "$guess1" in
8334 'struct dirent') guess2='struct direct' ;;
8335 *) guess2='struct dirent' ;;
8336 esac
8337                 
8338 if $contains "$guess1" try.c >/dev/null 2>&1; then
8339         direntrytype="$guess1"
8340         echo "Your directory entries are $direntrytype." >&4
8341 elif $contains "$guess2" try.c >/dev/null 2>&1; then
8342         direntrytype="$guess2"
8343         echo "Your directory entries seem to be $direntrytype." >&4
8344 else
8345         echo "I don't recognize your system's directory entries." >&4
8346         rp="What type is used for directory entries on this system?"
8347         dflt="$guess1"
8348         . ./myread
8349         direntrytype="$ans"
8350 fi
8351 $rm -f try.c
8352
8353
8354 : see if the directory entry stores field length
8355 echo " "
8356 $cppstdin $cppflags $cppminus < "$xinc" > try.c
8357 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
8358         echo "Good, your directory entry keeps length information in d_namlen." >&4
8359         val="$define"
8360 else
8361         echo "Your directory entry does not know about the d_namlen field." >&4
8362         val="$undef"
8363 fi
8364 set d_dirnamlen
8365 eval $setvar
8366 $rm -f try.c
8367
8368 : see if dlerror exists
8369 xxx_runnm="$runnm"
8370 runnm=false
8371 set dlerror d_dlerror
8372 eval $inlibc
8373 runnm="$xxx_runnm"
8374
8375 : see if dlfcn is available
8376 set dlfcn.h i_dlfcn
8377 eval $inhdr
8378
8379 case "$usedl" in
8380 $define|y|true)
8381         $cat << EOM
8382
8383 On a few systems, the dynamically loaded modules that perl generates and uses
8384 will need a different extension than shared libs. The default will probably
8385 be appropriate.
8386
8387 EOM
8388         case "$dlext" in
8389         '')     dflt="$so" ;;
8390         *)      dflt="$dlext" ;;
8391         esac
8392         rp='What is the extension of dynamically loaded modules'
8393         . ./myread
8394         dlext="$ans"
8395         ;;
8396 *)
8397         dlext="none"
8398         ;;
8399 esac
8400
8401 : Check if dlsym need a leading underscore
8402 echo " "
8403 val="$undef"
8404
8405 case "$dlsrc" in
8406 dl_dlopen.xs)
8407         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
8408         $cat >dyna.c <<'EOM'
8409 fred () { }
8410 EOM
8411
8412 $cat >fred.c<<EOM
8413
8414 #include <stdio.h>
8415 #$i_dlfcn I_DLFCN
8416 #ifdef I_DLFCN
8417 #include <dlfcn.h>      /* the dynamic linker include file for Sunos/Solaris */
8418 #else
8419 #include <sys/types.h>
8420 #include <nlist.h>
8421 #include <link.h>
8422 #endif
8423
8424 extern int fred() ;
8425
8426 int main()
8427 {
8428     void * handle ;
8429     void * symbol ;
8430 #ifndef RTLD_LAZY
8431     int mode = 1 ;
8432 #else
8433     int mode = RTLD_LAZY ;
8434 #endif
8435     handle = dlopen("./dyna.$dlext", mode) ;
8436     if (handle == NULL) {
8437         printf ("1\n") ;
8438         fflush (stdout) ;
8439         exit(0);
8440     }
8441     symbol = dlsym(handle, "fred") ;
8442     if (symbol == NULL) {
8443         /* try putting a leading underscore */
8444         symbol = dlsym(handle, "_fred") ;
8445         if (symbol == NULL) {
8446             printf ("2\n") ;
8447             fflush (stdout) ;
8448             exit(0);
8449         }
8450         printf ("3\n") ;
8451     }
8452     else
8453         printf ("4\n") ;
8454     fflush (stdout) ;
8455     exit(0);
8456 }
8457 EOM
8458         : Call the object file tmp-dyna.o in case dlext=o.
8459         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 && 
8460                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 && 
8461                 $ld $lddlflags -o dyna.$dlext tmp-dyna${_o} > /dev/null 2>&1 && 
8462                 $cc $ccflags -o fred $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1; then
8463                 xxx=`./fred`
8464                 case $xxx in
8465                 1)      echo "Test program failed using dlopen." >&4
8466                         echo "Perhaps you should not use dynamic loading." >&4;;
8467                 2)      echo "Test program failed using dlsym." >&4
8468                         echo "Perhaps you should not use dynamic loading." >&4;;
8469                 3)      echo "dlsym needs a leading underscore" >&4
8470                         val="$define" ;;
8471                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
8472                 esac
8473         else
8474                 echo "I can't compile and run the test program." >&4
8475                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
8476         fi
8477         ;;
8478 esac
8479                 
8480 $rm -f fred fred.? dyna.$dlext dyna.? tmp-dyna.?
8481
8482 set d_dlsymun
8483 eval $setvar
8484
8485 hasproto='varname=$1; func=$2; shift; shift;
8486 while $test $# -ge 2; do
8487         case "$1" in
8488         $define) echo "#include <$2>";;
8489         esac ;
8490     shift 2;
8491 done > try.c;
8492 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
8493 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
8494         echo "$func() prototype found.";
8495         val="$define";
8496 else
8497         echo "$func() prototype NOT found.";
8498         val="$undef";
8499 fi;
8500 set $varname;
8501 eval $setvar;
8502 $rm -f try.c tryout.c'
8503
8504 : see if prototype for drand48 is available
8505 echo " "
8506 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
8507 eval $hasproto
8508
8509 : see if dup2 exists
8510 set dup2 d_dup2
8511 eval $inlibc
8512
8513 : see if eaccess exists
8514 set eaccess d_eaccess
8515 eval $inlibc
8516
8517 : see if endgrent exists
8518 set endgrent d_endgrent
8519 eval $inlibc
8520
8521 : see if endhostent exists
8522 set endhostent d_endhent
8523 eval $inlibc
8524
8525 : see if endnetent exists
8526 set endnetent d_endnent
8527 eval $inlibc
8528
8529 : see if endprotoent exists
8530 set endprotoent d_endpent
8531 eval $inlibc
8532
8533 : see if endpwent exists
8534 set endpwent d_endpwent
8535 eval $inlibc
8536
8537 : see if endservent exists
8538 set endservent d_endsent
8539 eval $inlibc
8540
8541 : Locate the flags for 'open()'
8542 echo " "
8543 $cat >open3.c <<'EOCP'
8544 #include <sys/types.h>
8545 #ifdef I_FCNTL
8546 #include <fcntl.h>
8547 #endif
8548 #ifdef I_SYS_FILE
8549 #include <sys/file.h>
8550 #endif
8551 int main() {
8552         if(O_RDONLY);
8553 #ifdef O_TRUNC
8554         exit(0);
8555 #else
8556         exit(1);
8557 #endif
8558 }
8559 EOCP
8560 : check sys/file.h first to get FREAD on Sun
8561 if $test `./findhdr sys/file.h` && \
8562                 set open3 -DI_SYS_FILE && eval $compile; then
8563         h_sysfile=true;
8564         echo "<sys/file.h> defines the O_* constants..." >&4
8565         if ./open3; then
8566                 echo "and you have the 3 argument form of open()." >&4
8567                 val="$define"
8568         else
8569                 echo "but not the 3 argument form of open().  Oh, well." >&4
8570                 val="$undef"
8571         fi
8572 elif $test `./findhdr fcntl.h` && \
8573                 set open3 -DI_FCNTL && eval $compile; then
8574         h_fcntl=true;
8575         echo "<fcntl.h> defines the O_* constants..." >&4
8576         if ./open3; then
8577                 echo "and you have the 3 argument form of open()." >&4
8578                 val="$define"
8579         else
8580                 echo "but not the 3 argument form of open().  Oh, well." >&4
8581                 val="$undef"
8582         fi
8583 else
8584         val="$undef"
8585         echo "I can't find the O_* constant definitions!  You got problems." >&4
8586 fi
8587 set d_open3
8588 eval $setvar
8589 $rm -f open3*
8590
8591 : see which of string.h or strings.h is needed
8592 echo " "
8593 strings=`./findhdr string.h`
8594 if $test "$strings" && $test -r "$strings"; then
8595         echo "Using <string.h> instead of <strings.h>." >&4
8596         val="$define"
8597 else
8598         val="$undef"
8599         strings=`./findhdr strings.h`
8600         if $test "$strings" && $test -r "$strings"; then
8601                 echo "Using <strings.h> instead of <string.h>." >&4
8602         else
8603                 echo "No string header found -- You'll surely have problems." >&4
8604         fi
8605 fi
8606 set i_string
8607 eval $setvar
8608 case "$i_string" in
8609 "$undef") strings=`./findhdr strings.h`;;
8610 *)        strings=`./findhdr string.h`;;
8611 esac
8612
8613 : check for non-blocking I/O stuff
8614 case "$h_sysfile" in
8615 true) echo "#include <sys/file.h>" > head.c;;
8616 *)
8617         case "$h_fcntl" in
8618         true) echo "#include <fcntl.h>" > head.c;;
8619         *) echo "#include <sys/fcntl.h>" > head.c;;
8620         esac
8621         ;;
8622 esac
8623 echo " "
8624 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
8625 case "$o_nonblock" in
8626 '')
8627         $cat head.c > try.c
8628         $cat >>try.c <<'EOCP'
8629 #include <stdio.h>
8630 int main() {
8631 #ifdef O_NONBLOCK
8632         printf("O_NONBLOCK\n");
8633         exit(0);
8634 #endif
8635 #ifdef O_NDELAY
8636         printf("O_NDELAY\n");
8637         exit(0);
8638 #endif
8639 #ifdef FNDELAY
8640         printf("FNDELAY\n");
8641         exit(0);
8642 #endif
8643         exit(0);
8644 }
8645 EOCP
8646         set try
8647         if eval $compile_ok; then
8648                 o_nonblock=`./try`
8649                 case "$o_nonblock" in
8650                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
8651                 *) echo "Seems like we can use $o_nonblock.";;
8652                 esac
8653         else
8654                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
8655         fi
8656         ;;
8657 *) echo "Using $hint value $o_nonblock.";;
8658 esac
8659 $rm -f try try.* .out core
8660
8661 echo " "
8662 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
8663 case "$eagain" in
8664 '')
8665         $cat head.c > try.c
8666         $cat >>try.c <<EOCP
8667 #include <errno.h>
8668 #include <sys/types.h>
8669 #include <signal.h>
8670 #include <stdio.h> 
8671 #define MY_O_NONBLOCK $o_nonblock
8672 #ifndef errno  /* XXX need better Configure test */
8673 extern int errno;
8674 #endif
8675 #$i_unistd I_UNISTD
8676 #ifdef I_UNISTD
8677 #include <unistd.h>
8678 #endif
8679 #$i_string I_STRING
8680 #ifdef I_STRING
8681 #include <string.h>
8682 #else
8683 #include <strings.h>
8684 #endif
8685 $signal_t blech(x) int x; { exit(3); }
8686 EOCP
8687         $cat >> try.c <<'EOCP'
8688 int main()
8689 {
8690         int pd[2];
8691         int pu[2];
8692         char buf[1];
8693         char string[100];
8694
8695         pipe(pd);       /* Down: child -> parent */
8696         pipe(pu);       /* Up: parent -> child */
8697         if (0 != fork()) {
8698                 int ret;
8699                 close(pd[1]);   /* Parent reads from pd[0] */
8700                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
8701                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
8702                         exit(1);
8703                 signal(SIGALRM, blech);
8704                 alarm(5);
8705                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
8706                         exit(2);
8707                 sprintf(string, "%d\n", ret);
8708                 write(2, string, strlen(string));
8709                 alarm(0);
8710 #ifdef EAGAIN
8711                 if (errno == EAGAIN) {
8712                         printf("EAGAIN\n");
8713                         goto ok;
8714                 }
8715 #endif
8716 #ifdef EWOULDBLOCK
8717                 if (errno == EWOULDBLOCK)
8718                         printf("EWOULDBLOCK\n");
8719 #endif
8720         ok:
8721                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
8722                 sleep(2);                               /* Give it time to close our pipe */
8723                 alarm(5);
8724                 ret = read(pd[0], buf, 1);      /* Should read EOF */
8725                 alarm(0);
8726                 sprintf(string, "%d\n", ret);
8727                 write(3, string, strlen(string));
8728                 exit(0);
8729         }
8730
8731         close(pd[0]);                   /* We write to pd[1] */
8732         close(pu[1]);                   /* We read from pu[0] */
8733         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
8734         close(pd[1]);                   /* Pipe pd is now fully closed! */
8735         exit(0);                                /* Bye bye, thank you for playing! */
8736 }
8737 EOCP
8738         set try
8739         if eval $compile_ok; then
8740                 echo "$startsh" >mtry
8741                 echo "./try >try.out 2>try.ret 3>try.err || exit 4" >>mtry
8742                 chmod +x mtry
8743                 ./mtry >/dev/null 2>&1
8744                 case $? in
8745                 0) eagain=`$cat try.out`;;
8746                 1) echo "Could not perform non-blocking setting!";;
8747                 2) echo "I did a successful read() for something that was not there!";;
8748                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
8749                 *) echo "Something terribly wrong happened during testing.";;
8750                 esac
8751                 rd_nodata=`$cat try.ret`
8752                 echo "A read() system call with no data present returns $rd_nodata."
8753                 case "$rd_nodata" in
8754                 0|-1) ;;
8755                 *)
8756                         echo "(That's peculiar, fixing that to be -1.)"
8757                         rd_nodata=-1
8758                         ;;
8759                 esac
8760                 case "$eagain" in
8761                 '')
8762                         echo "Forcing errno EAGAIN on read() with no data available."
8763                         eagain=EAGAIN
8764                         ;;
8765                 *)
8766                         echo "Your read() sets errno to $eagain when no data is available."
8767                         ;;
8768                 esac
8769                 status=`$cat try.err`
8770                 case "$status" in
8771                 0) echo "And it correctly returns 0 to signal EOF.";;
8772                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
8773                 *) echo "However, your read() returns '$status' on EOF??";;
8774                 esac
8775                 val="$define"
8776                 if test "$status" = "$rd_nodata"; then
8777                         echo "WARNING: you can't distinguish between EOF and no data!"
8778                         val="$undef"
8779                 fi
8780         else
8781                 echo "I can't compile the test program--assuming errno EAGAIN will do."
8782                 eagain=EAGAIN
8783         fi
8784         set d_eofnblk
8785         eval $setvar
8786         ;;
8787 *)
8788         echo "Using $hint value $eagain."
8789         echo "Your read() returns $rd_nodata when no data is present."
8790         case "$d_eofnblk" in
8791         "$define") echo "And you can see EOF because read() returns 0.";;
8792         "$undef") echo "But you can't see EOF status from read() returned value.";;
8793         *)
8794                 echo "(Assuming you can't see EOF status from read anyway.)"
8795                 d_eofnblk=$undef
8796                 ;;
8797         esac
8798         ;;
8799 esac
8800 $rm -f try try.* .out core head.c mtry
8801
8802 : see if fchmod exists
8803 set fchmod d_fchmod
8804 eval $inlibc
8805
8806 : see if fchown exists
8807 set fchown d_fchown
8808 eval $inlibc
8809
8810 : see if this is an fcntl system
8811 set fcntl d_fcntl
8812 eval $inlibc
8813
8814 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
8815 while $test $# -ge 2; do
8816         case "$1" in
8817         $define) echo "#include <$2>";;
8818         esac ;
8819     shift 2;
8820 done > try.c;
8821 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
8822 set try;
8823 if eval $compile; then
8824         val="$define";
8825 else
8826         val="$undef";
8827 fi;
8828 set $varname;
8829 eval $setvar;
8830 $rm -f try.c try.o'
8831
8832 socketlib=''
8833 sockethdr=''
8834 : see whether socket exists
8835 echo " "
8836 $echo $n "Hmm... $c" >&4
8837 if set socket val -f d_socket; eval $csym; $val; then
8838         echo "Looks like you have Berkeley networking support." >&4
8839         d_socket="$define"
8840         if set setsockopt val -f; eval $csym; $val; then
8841                 d_oldsock="$undef"
8842         else
8843                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
8844                 d_oldsock="$define"
8845         fi
8846 else
8847         if $contains socklib libc.list >/dev/null 2>&1; then
8848                 echo "Looks like you have Berkeley networking support." >&4
8849                 d_socket="$define"
8850                 : we will have to assume that it supports the 4.2 BSD interface
8851                 d_oldsock="$undef"
8852         else
8853                 echo "You don't have Berkeley networking in libc$_a..." >&4
8854                 if test "X$d_socket" = "X$define"; then
8855                    echo "...but you seem to believe that you have sockets." >&4
8856                 else
8857                         for net in net socket
8858                         do
8859                                 if test -f /usr/lib/lib$net$_a; then
8860                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
8861                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
8862                                         if $contains socket libc.list >/dev/null 2>&1; then
8863                                                 d_socket="$define"
8864                                                 socketlib="-l$net"
8865                                                 case "$net" in
8866                                                 net)
8867                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
8868                                                         sockethdr="-I/usr/netinclude"
8869                                                         ;;
8870                                                 esac
8871                                                 echo "Found Berkeley sockets interface in lib$net." >& 4 
8872                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
8873                                                         d_oldsock="$undef"
8874                                                 else
8875                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
8876                                                         d_oldsock="$define"
8877                                                 fi
8878                                                 break
8879                                         fi
8880                                 fi
8881                         done
8882                         if test "X$d_socket" != "X$define"; then
8883                            echo "or anywhere else I see." >&4
8884                            d_socket="$undef"
8885                            d_oldsock="$undef"
8886                         fi
8887                 fi
8888         fi
8889 fi
8890
8891 : see if socketpair exists
8892 set socketpair d_sockpair
8893 eval $inlibc
8894
8895
8896 echo " "
8897 echo "Checking the availability of certain socket constants..." >& 4
8898 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
8899         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
8900         $cat >try.c <<EOF
8901 #include <sys/types.h>
8902 #include <sys/socket.h>
8903 int main() {
8904     int i = $ENUM;
8905 }
8906 EOF
8907         val="$undef"
8908         set try; if eval $compile; then
8909                 val="$define"
8910         fi
8911         set d_${enum}; eval $setvar
8912         $rm -f try.c try
8913 done
8914
8915 : see if sys/select.h has to be included
8916 set sys/select.h i_sysselct
8917 eval $inhdr
8918
8919 : see if we should include time.h, sys/time.h, or both
8920 echo " "
8921 if test "X$timeincl" = X; then
8922         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
8923         $echo $n "I'm now running the test program...$c"
8924         $cat >try.c <<'EOCP'
8925 #include <sys/types.h>
8926 #ifdef I_TIME
8927 #include <time.h>
8928 #endif
8929 #ifdef I_SYSTIME
8930 #ifdef SYSTIMEKERNEL
8931 #define KERNEL
8932 #endif
8933 #include <sys/time.h>
8934 #endif
8935 #ifdef I_SYSSELECT
8936 #include <sys/select.h>
8937 #endif
8938 int main()
8939 {
8940         struct tm foo;
8941 #ifdef S_TIMEVAL
8942         struct timeval bar;
8943 #endif
8944 #ifdef S_TIMEZONE
8945         struct timezone tzp;
8946 #endif
8947         if (foo.tm_sec == foo.tm_sec)
8948                 exit(0);
8949 #ifdef S_TIMEVAL
8950         if (bar.tv_sec == bar.tv_sec)
8951                 exit(0);
8952 #endif
8953         exit(1);
8954 }
8955 EOCP
8956         flags=''
8957         for s_timezone in '-DS_TIMEZONE' ''; do
8958         sysselect=''
8959         for s_timeval in '-DS_TIMEVAL' ''; do
8960         for i_systimek in '' '-DSYSTIMEKERNEL'; do
8961         for i_time in '' '-DI_TIME'; do
8962         for i_systime in '-DI_SYSTIME' ''; do
8963                 case "$flags" in
8964                 '') $echo $n ".$c"
8965                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
8966                         if eval $compile; then
8967                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
8968                                 shift
8969                                 flags="$*"
8970                                 echo " "
8971                                 $echo $n "Succeeded with $flags$c"
8972                         fi
8973                         ;;
8974                 esac
8975         done
8976         done
8977         done
8978         done
8979         done
8980         timeincl=''
8981         echo " "
8982         case "$flags" in
8983         *SYSTIMEKERNEL*) i_systimek="$define"
8984                 timeincl=`./findhdr sys/time.h`
8985                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
8986         *) i_systimek="$undef";;
8987         esac
8988         case "$flags" in
8989         *I_TIME*) i_time="$define"
8990                 timeincl=`./findhdr time.h`" $timeincl"
8991                 echo "We'll include <time.h>." >&4;;
8992         *) i_time="$undef";;
8993         esac
8994         case "$flags" in
8995         *I_SYSTIME*) i_systime="$define"
8996                 timeincl=`./findhdr sys/time.h`" $timeincl"
8997                 echo "We'll include <sys/time.h>." >&4;;
8998         *) i_systime="$undef";;
8999         esac
9000         $rm -f try.c try
9001 fi
9002
9003 : check for fd_set items
9004 $cat <<EOM
9005
9006 Checking to see how well your C compiler handles fd_set and friends ...
9007 EOM
9008 $cat >fd_set.c <<EOCP
9009 #$i_systime I_SYS_TIME
9010 #$i_sysselct I_SYS_SELECT
9011 #$d_socket HAS_SOCKET
9012 #include <sys/types.h>
9013 #ifdef HAS_SOCKET
9014 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
9015 #endif
9016 #ifdef I_SYS_TIME
9017 #include <sys/time.h>
9018 #endif
9019 #ifdef I_SYS_SELECT
9020 #include <sys/select.h>
9021 #endif
9022 int main() {
9023         fd_set fds;
9024
9025 #ifdef TRYBITS
9026         if(fds.fds_bits);
9027 #endif
9028
9029 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
9030         exit(0);
9031 #else
9032         exit(1);
9033 #endif
9034 }
9035 EOCP
9036 set fd_set -DTRYBITS
9037 if eval $compile; then
9038         d_fds_bits="$define"
9039         d_fd_set="$define"
9040         echo "Well, your system knows about the normal fd_set typedef..." >&4
9041         if ./fd_set; then
9042                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
9043                 d_fd_macros="$define"
9044         else
9045                 $cat >&4 <<'EOM'
9046 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
9047 EOM
9048                 d_fd_macros="$undef"
9049         fi
9050 else
9051         $cat <<'EOM'
9052 Hmm, your compiler has some difficulty with fd_set.  Checking further...
9053 EOM
9054         set fd_set
9055         if eval $compile; then
9056                 d_fds_bits="$undef"
9057                 d_fd_set="$define"
9058                 echo "Well, your system has some sort of fd_set available..." >&4
9059                 if ./fd_set; then
9060                         echo "and you have the normal fd_set macros." >&4
9061                         d_fd_macros="$define"
9062                 else
9063                         $cat <<'EOM'
9064 but not the normal fd_set macros!  Gross!  More work for me...
9065 EOM
9066                         d_fd_macros="$undef"
9067                 fi
9068         else
9069         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
9070                 d_fd_set="$undef"
9071                 d_fds_bits="$undef"
9072                 d_fd_macros="$undef"
9073         fi
9074 fi
9075 $rm -f fd_set*
9076
9077 : see if fgetpos exists
9078 set fgetpos d_fgetpos
9079 eval $inlibc
9080
9081 : see if flock exists
9082 set flock d_flock
9083 eval $inlibc
9084
9085 : see if fork exists
9086 set fork d_fork
9087 eval $inlibc
9088
9089 : see if pathconf exists
9090 set pathconf d_pathconf
9091 eval $inlibc
9092
9093 : see if fpathconf exists
9094 set fpathconf d_fpathconf
9095 eval $inlibc
9096
9097
9098 : check for fpos64_t
9099 echo " "
9100 echo "Checking to see if you have fpos64_t..." >&4
9101 $cat >try.c <<EOCP
9102 #include <stdio.h>
9103 int main() { fpos64_t x = 7; }
9104 EOCP
9105 set try
9106 if eval $compile; then
9107         val="$define"
9108         echo "You have fpos64_t."
9109 else
9110         val="$undef"
9111         echo "You do not have fpos64_t."
9112         case "$fpossize" in
9113         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
9114         esac
9115 fi
9116 $rm -f try.* try
9117 set d_fpos64_t
9118 eval $setvar
9119
9120 : see if frexpl exists
9121 set frexpl d_frexpl
9122 eval $inlibc
9123
9124 hasstruct='varname=$1; struct=$2; shift; shift;
9125 while $test $# -ge 2; do
9126         case "$1" in
9127         $define) echo "#include <$2>";;
9128         esac ;
9129     shift 2;
9130 done > try.c;
9131 echo "int main () { struct $struct foo; }" >> try.c;
9132 set try;
9133 if eval $compile; then
9134         val="$define";
9135 else
9136         val="$undef";
9137 fi;
9138 set $varname;
9139 eval $setvar;
9140 $rm -f try.c try.o'
9141
9142 : see if this is a sys/param system
9143 set sys/param.h i_sysparam
9144 eval $inhdr
9145
9146 : see if this is a sys/mount.h system
9147 set sys/mount.h i_sysmount
9148 eval $inhdr
9149
9150 : see if sys/types.h has to be included
9151 set sys/types.h i_systypes
9152 eval $inhdr
9153
9154
9155 echo " "
9156 echo "Checking to see if your system supports struct fs_data..." >&4
9157 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
9158 eval $hasstruct
9159 case "$d_fs_data_s" in
9160 "$define")      echo "Yes, it does."   ;;
9161 *)              echo "No, it doesn't." ;;
9162 esac
9163
9164 : see if fseeko exists
9165 set fseeko d_fseeko
9166 eval $inlibc
9167 case "$longsize" in
9168 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
9169 esac
9170
9171 : see if fsetpos exists
9172 set fsetpos d_fsetpos
9173 eval $inlibc
9174
9175
9176 : see if fstatfs exists
9177 set fstatfs d_fstatfs
9178 eval $inlibc
9179
9180
9181 : see if statvfs exists
9182 set statvfs d_statvfs
9183 eval $inlibc
9184
9185 : see if fstatvfs exists
9186 set fstatvfs d_fstatvfs
9187 eval $inlibc
9188
9189
9190 : see if ftello exists
9191 set ftello d_ftello
9192 eval $inlibc
9193 case "$longsize" in
9194 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
9195 esac
9196
9197 : see if getcwd exists
9198 set getcwd d_getcwd
9199 eval $inlibc
9200
9201 : see if getespwnam exists
9202 set getespwnam d_getespwnam
9203 eval $inlibc
9204
9205
9206 : see if getfsstat exists
9207 set getfsstat d_getfsstat
9208 eval $inlibc
9209
9210 : see if getgrent exists
9211 set getgrent d_getgrent
9212 eval $inlibc
9213
9214 : see if gethostbyaddr exists
9215 set gethostbyaddr d_gethbyaddr
9216 eval $inlibc
9217
9218 : see if gethostbyname exists
9219 set gethostbyname d_gethbyname
9220 eval $inlibc
9221
9222 : see if gethostent exists
9223 set gethostent d_gethent
9224 eval $inlibc
9225
9226 : see how we will look up host name
9227 echo " "
9228 call=''
9229 if set gethostname val -f d_gethname; eval $csym; $val; then
9230         echo 'gethostname() found.' >&4
9231         d_gethname="$define"
9232         call=gethostname
9233 fi
9234 if set uname val -f d_uname; eval $csym; $val; then
9235         if ./xenix; then
9236                 $cat <<'EOM'
9237 uname() was found, but you're running xenix, and older versions of xenix
9238 have a broken uname(). If you don't really know whether your xenix is old
9239 enough to have a broken system call, use the default answer.
9240
9241 EOM
9242                 dflt=y
9243                 case "$d_uname" in
9244                 "$define") dflt=n;;
9245                 esac
9246                 rp='Is your uname() broken?'
9247                 . ./myread
9248                 case "$ans" in
9249                 n*) d_uname="$define"; call=uname;;
9250                 esac
9251         else
9252                 echo 'uname() found.' >&4
9253                 d_uname="$define"
9254                 case "$call" in
9255                 '') call=uname ;;
9256                 esac
9257         fi
9258 fi
9259 case "$d_gethname" in
9260 '') d_gethname="$undef";;
9261 esac
9262 case "$d_uname" in
9263 '') d_uname="$undef";;
9264 esac
9265 case "$d_uname$d_gethname" in
9266 *define*)
9267         dflt=n
9268         cat <<EOM
9269  
9270 Every now and then someone has a $call() that lies about the hostname
9271 but can't be fixed for political or economic reasons.  If you wish, I can
9272 pretend $call() isn't there and maybe compute hostname at run-time
9273 thanks to the '$phostname' command.
9274
9275 EOM
9276         rp="Shall I ignore $call() from now on?"
9277         . ./myread
9278         case "$ans" in
9279         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
9280         esac;;
9281 esac
9282 case "$phostname" in
9283 '') aphostname='';;
9284 *) case "$aphostname" in
9285         /*) ;;
9286         *) set X $phostname
9287                 shift
9288                 file=$1
9289                 shift
9290                 file=`./loc $file $file $pth`
9291                 aphostname=`echo $file $*`
9292                 ;;
9293         esac
9294         ;;
9295 esac
9296 case "$d_uname$d_gethname" in
9297 *define*) ;;
9298 *)
9299         case "$phostname" in
9300         '')
9301                 echo "There will be no way for $package to get your hostname." >&4;;
9302         *)
9303         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
9304                 ;;
9305         esac;;
9306 esac
9307 case "$d_phostname" in
9308 '') d_phostname="$undef";;
9309 esac
9310
9311 : see if this is a netdb.h system
9312 set netdb.h i_netdb
9313 eval $inhdr
9314
9315 : see if prototypes for various gethostxxx netdb.h functions are available
9316 echo " "
9317 set d_gethostprotos gethostent $i_netdb netdb.h
9318 eval $hasproto
9319
9320 : see if getlogin exists
9321 set getlogin d_getlogin
9322 eval $inlibc
9323
9324 : see if getmnt exists
9325 set getmnt d_getmnt
9326 eval $inlibc
9327
9328 : see if getmntent exists
9329 set getmntent d_getmntent
9330 eval $inlibc
9331
9332 : see if getnetbyaddr exists
9333 set getnetbyaddr d_getnbyaddr
9334 eval $inlibc
9335
9336 : see if getnetbyname exists
9337 set getnetbyname d_getnbyname
9338 eval $inlibc
9339
9340 : see if getnetent exists
9341 set getnetent d_getnent
9342 eval $inlibc
9343
9344 : see if prototypes for various getnetxxx netdb.h functions are available
9345 echo " "
9346 set d_getnetprotos getnetent $i_netdb netdb.h
9347 eval $hasproto
9348
9349
9350 : see if getprotobyname exists
9351 set getprotobyname d_getpbyname
9352 eval $inlibc
9353
9354 : see if getprotobynumber exists
9355 set getprotobynumber d_getpbynumber
9356 eval $inlibc
9357
9358 : see if getprotoent exists
9359 set getprotoent d_getpent
9360 eval $inlibc
9361
9362 : see if getpgid exists
9363 set getpgid d_getpgid
9364 eval $inlibc
9365
9366 : see if getpgrp2 exists
9367 set getpgrp2 d_getpgrp2
9368 eval $inlibc
9369
9370 : see if getppid exists
9371 set getppid d_getppid
9372 eval $inlibc
9373
9374 : see if getpriority exists
9375 set getpriority d_getprior
9376 eval $inlibc
9377
9378 : see if prototypes for various getprotoxxx netdb.h functions are available
9379 echo " "
9380 set d_getprotoprotos getprotoent $i_netdb netdb.h
9381 eval $hasproto
9382
9383 : see if getprpwnam exists
9384 set getprpwnam d_getprpwnam
9385 eval $inlibc
9386
9387 : see if getpwent exists
9388 set getpwent d_getpwent
9389 eval $inlibc
9390
9391
9392 : see if getservbyname exists
9393 set getservbyname d_getsbyname
9394 eval $inlibc
9395
9396 : see if getservbyport exists
9397 set getservbyport d_getsbyport
9398 eval $inlibc
9399
9400 : see if getservent exists
9401 set getservent d_getsent
9402 eval $inlibc
9403
9404 : see if prototypes for various getservxxx netdb.h functions are available
9405 echo " "
9406 set d_getservprotos getservent $i_netdb netdb.h
9407 eval $hasproto
9408
9409 : see if getspnam exists
9410 set getspnam d_getspnam
9411 eval $inlibc
9412
9413 : see if gettimeofday or ftime exists
9414 set gettimeofday d_gettimeod
9415 eval $inlibc
9416 case "$d_gettimeod" in
9417 "$undef")
9418         set ftime d_ftime 
9419         eval $inlibc
9420         ;;
9421 *)
9422         val="$undef"; set d_ftime; eval $setvar
9423         ;;
9424 esac
9425 case "$d_gettimeod$d_ftime" in
9426 "$undef$undef")
9427         echo " "
9428         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
9429         ;;
9430 esac
9431
9432 : see if this is an grp system
9433 set grp.h i_grp
9434 eval $inhdr
9435
9436 case "$i_grp" in
9437 $define)
9438         xxx=`./findhdr grp.h`
9439         $cppstdin $cppflags $cppminus < $xxx >$$.h
9440
9441         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
9442                 val="$define"
9443         else
9444                 val="$undef"
9445         fi
9446         set d_grpasswd
9447         eval $setvar
9448
9449         $rm -f $$.h
9450         ;;
9451 *)
9452         val="$undef";
9453         set d_grpasswd; eval $setvar
9454         ;;
9455 esac
9456
9457 : see if hasmntopt exists
9458 set hasmntopt d_hasmntopt
9459 eval $inlibc
9460
9461 : see if this is a netinet/in.h or sys/in.h system
9462 set netinet/in.h i_niin sys/in.h i_sysin
9463 eval $inhdr
9464
9465 : see if arpa/inet.h has to be included
9466 set arpa/inet.h i_arpainet
9467 eval $inhdr
9468
9469 : see if htonl --and friends-- exists
9470 val=''
9471 set htonl val
9472 eval $inlibc
9473
9474 : Maybe they are macros.
9475 case "$val" in
9476 $undef)
9477         $cat >htonl.c <<EOM
9478 #include <stdio.h>
9479 #include <sys/types.h>
9480 #$i_niin I_NETINET_IN
9481 #$i_sysin I_SYS_IN
9482 #$i_arpainet I_ARPA_INET
9483 #ifdef I_NETINET_IN
9484 #include <netinet/in.h>
9485 #endif
9486 #ifdef I_SYS_IN
9487 #include <sys/in.h>
9488 #endif
9489 #ifdef I_ARPA_INET
9490 #include <arpa/inet.h>
9491 #endif
9492 #ifdef htonl
9493 printf("Defined as a macro.");
9494 #endif
9495 EOM
9496         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
9497         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
9498                 val="$define"
9499                 echo "But it seems to be defined as a macro." >&4
9500         fi
9501         $rm -f htonl.?
9502         ;;
9503 esac
9504 set d_htonl
9505 eval $setvar
9506
9507 : see if iconv exists
9508 set iconv d_iconv
9509 eval $inlibc
9510
9511 : index or strchr
9512 echo " "
9513 if set index val -f; eval $csym; $val; then
9514         if set strchr val -f d_strchr; eval $csym; $val; then
9515                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
9516                         val="$define"
9517                         vali="$undef"
9518                         echo "strchr() found." >&4
9519                 else
9520                         val="$undef"
9521                         vali="$define"
9522                         echo "index() found." >&4
9523                 fi
9524         else
9525                 val="$undef"
9526                 vali="$define"
9527                 echo "index() found." >&4
9528         fi
9529 else
9530         if set strchr val -f d_strchr; eval $csym; $val; then
9531                 val="$define"
9532                 vali="$undef"
9533                 echo "strchr() found." >&4
9534         else
9535                 echo "No index() or strchr() found!" >&4
9536                 val="$undef"
9537                 vali="$undef"
9538         fi
9539 fi
9540 set d_strchr; eval $setvar
9541 val="$vali"
9542 set d_index; eval $setvar
9543
9544 : check whether inet_aton exists
9545 set inet_aton d_inetaton
9546 eval $inlibc
9547
9548 : see if inttypes.h is available
9549 : we want a real compile instead of Inhdr because some systems
9550 : have an inttypes.h which includes non-existent headers
9551 echo " "
9552 $cat >try.c <<EOCP
9553 #include <inttypes.h>
9554 int main() {
9555         static int32_t foo32 = 0x12345678;
9556 }
9557 EOCP
9558 set try
9559 if eval $compile; then
9560         echo "<inttypes.h> found." >&4
9561         val="$define"
9562 else
9563         echo "<inttypes.h> NOT found." >&4
9564         val="$undef"
9565 fi
9566 $rm -f try.c try
9567 set i_inttypes
9568 eval $setvar
9569
9570 : check for int64_t
9571 echo " "
9572 echo "Checking to see if you have int64_t..." >&4
9573 $cat >try.c <<EOCP
9574 #include <sys/types.h>
9575 #$i_inttypes I_INTTYPES
9576 #ifdef I_INTTYPES
9577 #include <inttypes.h>
9578 #endif
9579 int main() { int64_t x = 7; }
9580 EOCP
9581 set try
9582 if eval $compile; then
9583         val="$define"
9584         echo "You have int64_t."
9585 else
9586         val="$undef"
9587         echo "You do not have int64_t."
9588 fi
9589 $rm -f try try.*
9590 set d_int64_t
9591 eval $setvar
9592
9593 : Look for isascii
9594 echo " "
9595 $cat >isascii.c <<'EOCP'
9596 #include <stdio.h>
9597 #include <ctype.h>
9598 int main() {
9599         int c = 'A';
9600         if (isascii(c))
9601                 exit(0);
9602         else
9603                 exit(1);
9604 }
9605 EOCP
9606 set isascii
9607 if eval $compile; then
9608         echo "isascii() found." >&4
9609         val="$define"
9610 else
9611         echo "isascii() NOT found." >&4
9612         val="$undef"
9613 fi
9614 set d_isascii
9615 eval $setvar
9616 $rm -f isascii*
9617
9618 : see if isnan exists
9619 set isnan d_isnan
9620 eval $inlibc
9621
9622 : see if isnanl exists
9623 set isnanl d_isnanl
9624 eval $inlibc
9625
9626 : see if killpg exists
9627 set killpg d_killpg
9628 eval $inlibc
9629
9630 : see if lchown exists
9631 echo " "
9632 $cat > try.c <<'EOCP'
9633 /* System header to define __stub macros and hopefully few prototypes,
9634     which can conflict with char lchown(); below.  */
9635 #include <assert.h>
9636 /* Override any gcc2 internal prototype to avoid an error.  */
9637 /* We use char because int might match the return type of a gcc2
9638    builtin and then its argument prototype would still apply.  */
9639 char lchown();
9640 int main() {
9641     /*  The GNU C library defines this for functions which it implements
9642         to always fail with ENOSYS.  Some functions are actually named
9643         something starting with __ and the normal name is an alias.  */
9644 #if defined (__stub_lchown) || defined (__stub___lchown)
9645 choke me
9646 #else
9647 lchown();
9648 #endif
9649 ; return 0; }
9650 EOCP
9651 set try
9652 if eval $compile; then
9653     $echo "lchown() found." >&4
9654     val="$define"
9655 else
9656     $echo "lchown() NOT found." >&4
9657     val="$undef"
9658 fi
9659 set d_lchown
9660 eval $setvar
9661
9662 : See if number of significant digits in a double precision number is known
9663 echo " "
9664 $cat >ldbl_dig.c <<EOM
9665 #$i_limits I_LIMITS
9666 #$i_float I_FLOAT
9667 #ifdef I_LIMITS
9668 #include <limits.h>
9669 #endif
9670 #ifdef I_FLOAT
9671 #include <float.h>
9672 #endif
9673 #ifdef LDBL_DIG
9674 printf("Contains LDBL_DIG");
9675 #endif
9676 EOM
9677 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
9678 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
9679         echo "LDBL_DIG found." >&4
9680         val="$define"
9681 else
9682         echo "LDBL_DIG NOT found." >&4
9683         val="$undef"
9684 fi
9685 $rm -f ldbl_dig.?
9686 set d_ldbl_dig
9687 eval $setvar
9688
9689 : see if link exists
9690 set link d_link
9691 eval $inlibc
9692
9693 : see if localeconv exists
9694 set localeconv d_locconv
9695 eval $inlibc
9696
9697 : see if lockf exists
9698 set lockf d_lockf
9699 eval $inlibc
9700
9701 : check for long long
9702 echo " "
9703 echo "Checking to see if you have long long..." >&4
9704 echo 'int main() { long long x = 7; return 0; }' > try.c
9705 set try
9706 if eval $compile; then
9707         val="$define"
9708         echo "You have long long."
9709 else
9710         val="$undef"
9711         echo "You do not have long long."
9712 fi
9713 $rm try.*
9714 set d_longlong
9715 eval $setvar
9716
9717 : check for length of long long
9718 case "${d_longlong}${longlongsize}" in
9719 $define)
9720         echo " "
9721         echo "Checking to see how big your long longs are..." >&4
9722         $cat >try.c <<'EOCP'
9723 #include <stdio.h>
9724 int main()
9725 {
9726     printf("%d\n", (int)sizeof(long long));
9727     return(0);
9728 }
9729 EOCP
9730         set try
9731         if eval $compile_ok; then
9732                 longlongsize=`./try$exe_ext`
9733                 echo "Your long longs are $longlongsize bytes long."
9734         else
9735                 dflt='8'
9736                 echo " "
9737                 echo "(I can't seem to compile the test program.  Guessing...)"
9738                 rp="What is the size of a long long (in bytes)?"
9739                 . ./myread
9740                 longlongsize="$ans"
9741         fi
9742         if $test "X$longsize" = "X$longlongsize"; then
9743                 echo "(That isn't any different from an ordinary long.)"
9744         fi      
9745         ;;
9746 esac
9747 $rm -f try.* try
9748
9749 : see if prototype for lseek is available
9750 echo " "
9751 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
9752 eval $hasproto
9753
9754 : see if lstat exists
9755 set lstat d_lstat
9756 eval $inlibc
9757
9758 : see if madvise exists
9759 set madvise d_madvise
9760 eval $inlibc
9761
9762 : see if mblen exists
9763 set mblen d_mblen
9764 eval $inlibc
9765
9766 : see if mbstowcs exists
9767 set mbstowcs d_mbstowcs
9768 eval $inlibc
9769
9770 : see if mbtowc exists
9771 set mbtowc d_mbtowc
9772 eval $inlibc
9773
9774 : see if memchr exists
9775 set memchr d_memchr
9776 eval $inlibc
9777
9778 : see if memcmp exists
9779 set memcmp d_memcmp
9780 eval $inlibc
9781
9782 : see if memcpy exists
9783 set memcpy d_memcpy
9784 eval $inlibc
9785
9786 : see if memmove exists
9787 set memmove d_memmove
9788 eval $inlibc
9789
9790 : see if memset exists
9791 set memset d_memset
9792 eval $inlibc
9793
9794 : see if mkdir exists
9795 set mkdir d_mkdir
9796 eval $inlibc
9797
9798 : see if mkdtemp exists
9799 set mkdtemp d_mkdtemp
9800 eval $inlibc
9801
9802 : see if mkfifo exists
9803 set mkfifo d_mkfifo
9804 eval $inlibc
9805
9806 : see if mkstemp exists
9807 set mkstemp d_mkstemp
9808 eval $inlibc
9809
9810 : see if mkstemps exists
9811 set mkstemps d_mkstemps
9812 eval $inlibc
9813
9814 : see if mktime exists
9815 set mktime d_mktime
9816 eval $inlibc
9817
9818 : see if this is a sys/mman.h system
9819 set sys/mman.h i_sysmman
9820 eval $inhdr
9821
9822 : see if mmap exists
9823 set mmap d_mmap
9824 eval $inlibc
9825 : see what shmat returns
9826 : default to something harmless
9827 mmaptype='void *'
9828 case "$i_sysmman$d_mmap" in
9829 "$define$define")
9830         $cat >mmap.c <<'END'
9831 #include <sys/mman.h>
9832 void *mmap();
9833 END
9834         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
9835                 mmaptype='void *'
9836         else
9837                 mmaptype='caddr_t'
9838         fi
9839         echo "and it returns ($mmaptype)." >&4
9840         ;;
9841 esac
9842
9843
9844
9845 : see if modfl exists
9846 set modfl d_modfl
9847 eval $inlibc
9848
9849 : see if mprotect exists
9850 set mprotect d_mprotect
9851 eval $inlibc
9852
9853 : see if msgctl exists
9854 set msgctl d_msgctl
9855 eval $inlibc
9856
9857 : see if msgget exists
9858 set msgget d_msgget
9859 eval $inlibc
9860
9861 : see if msgsnd exists
9862 set msgsnd d_msgsnd
9863 eval $inlibc
9864
9865 : see if msgrcv exists
9866 set msgrcv d_msgrcv
9867 eval $inlibc
9868
9869 : see how much of the 'msg*(2)' library is present.
9870 h_msg=true
9871 echo " "
9872 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
9873 *"$undef"*) h_msg=false;;
9874 esac
9875 case "$osname" in
9876 freebsd)
9877     case "`ipcs 2>&1`" in
9878     "SVID messages"*"not configured"*)
9879         echo "Your $osname does not have the msg*(2) configured." >&4
9880         h_msg=false
9881         val="$undef"
9882         set msgctl d_msgctl
9883         eval $setvar
9884         set msgget d_msgget
9885         eval $setvar
9886         set msgsnd d_msgsnd
9887         eval $setvar
9888         set msgrcv d_msgrcv
9889         eval $setvar
9890         ;;
9891     esac
9892     ;;
9893 esac
9894 : we could also check for sys/ipc.h ...
9895 if $h_msg && $test `./findhdr sys/msg.h`; then
9896         echo "You have the full msg*(2) library." >&4
9897         val="$define"
9898 else
9899         echo "You don't have the full msg*(2) library." >&4
9900         val="$undef"
9901 fi
9902 set d_msg
9903 eval $setvar
9904
9905 : see if msync exists
9906 set msync d_msync
9907 eval $inlibc
9908
9909 : see if munmap exists
9910 set munmap d_munmap
9911 eval $inlibc
9912
9913 : see if nice exists
9914 set nice d_nice
9915 eval $inlibc
9916
9917
9918 echo " "
9919 echo "Checking which 64-bit integer type we could use..." >&4
9920
9921 case "$intsize" in
9922 8) val=int
9923    set quadtype
9924    eval $setvar
9925    val='"unsigned int"'
9926    set uquadtype
9927    eval $setvar
9928    quadkind=1
9929    ;;
9930 *) case "$longsize" in
9931    8) val=long
9932       set quadtype
9933       eval $setvar
9934       val='"unsigned long"'
9935       set uquadtype
9936       eval $setvar
9937       quadkind=2
9938       ;;
9939    *) case "$d_longlong:$longlongsize" in
9940       define:8)
9941         val='"long long"'
9942         set quadtype
9943         eval $setvar
9944         val='"unsigned long long"'
9945         set uquadtype
9946         eval $setvar
9947         quadkind=3
9948         ;;
9949       *) case "$d_int64_t" in
9950          define)
9951            val=int64_t
9952            set quadtype
9953            eval $setvar
9954            val=uint64_t
9955            set uquadtype
9956            eval $setvar
9957            quadkind=4
9958            ;;
9959          esac
9960          ;;
9961       esac
9962       ;;
9963    esac
9964    ;;
9965 esac
9966
9967 case "$quadtype" in
9968 '')     echo "Alas, no 64-bit integer types in sight." >&4
9969         d_quad="$undef"
9970         ;;
9971 *)      if test X"$use64bitint" = Xdefine -o X"$longsize" = X8; then
9972             verb="will"
9973         else
9974             verb="could"
9975         fi
9976         echo "We $verb use '$quadtype' for 64-bit integers." >&4
9977         d_quad="$define"
9978         ;;
9979 esac
9980
9981 : check for length of character
9982 echo " "
9983 case "$charsize" in
9984 '')
9985         echo "Checking to see how big your characters are (hey, you never know)..." >&4
9986         $cat >try.c <<'EOCP'
9987 #include <stdio.h>
9988 int main()
9989 {
9990     printf("%d\n", (int)sizeof(char));
9991     exit(0);
9992 }
9993 EOCP
9994         set try
9995         if eval $compile_ok; then
9996                 dflt=`./try`
9997         else
9998                 dflt='1'
9999                 echo "(I can't seem to compile the test program.  Guessing...)"
10000         fi
10001         ;;
10002 *)
10003         dflt="$charsize"
10004         ;;
10005 esac
10006 rp="What is the size of a character (in bytes)?"
10007 . ./myread
10008 charsize="$ans"
10009 $rm -f try.c try
10010
10011
10012 echo " "
10013 $echo "Choosing the C types to be used for Perl's internal types..." >&4
10014
10015 case "$use64bitint:$d_quad:$quadtype" in
10016 define:define:?*)
10017         ivtype="$quadtype"
10018         uvtype="$uquadtype"
10019         ivsize=8
10020         uvsize=8
10021         ;;
10022 *)      ivtype="long"
10023         uvtype="unsigned long"
10024         ivsize=$longsize
10025         uvsize=$longsize
10026         ;;
10027 esac
10028
10029 case "$uselongdouble:$d_longdbl" in
10030 define:define)
10031         nvtype="long double"
10032         nvsize=$longdblsize
10033         ;;
10034 *)      nvtype=double
10035         nvsize=$doublesize
10036         ;;
10037 esac
10038
10039 $echo "(IV will be "$ivtype", $ivsize bytes)"
10040 $echo "(UV will be "$uvtype", $uvsize bytes)"
10041 $echo "(NV will be "$nvtype", $nvsize bytes)"
10042
10043 $cat >try.c <<EOCP
10044 #$i_inttypes I_INTTYPES
10045 #ifdef I_INTTYPES
10046 #include <inttypes.h>
10047 #endif
10048 #include <stdio.h>
10049 int main() {
10050 #ifdef INT8
10051    int8_t i =  INT8_MAX;
10052   uint8_t u = UINT8_MAX;
10053   printf("int8_t\n");
10054 #endif
10055 #ifdef INT16
10056    int16_t i =  INT16_MAX;
10057   uint16_t i = UINT16_MAX;
10058   printf("int16_t\n");
10059 #endif
10060 #ifdef INT32
10061    int32_t i =  INT32_MAX;
10062   uint32_t u = UINT32_MAX;
10063   printf("int32_t\n");
10064 #endif
10065 }
10066 EOCP
10067
10068 case "$i8type" in
10069 '')     case "$charsize" in
10070         1)      i8type=char
10071                 u8type="unsigned char"
10072                 i8size=$charsize
10073                 u8size=$charsize
10074                 ;;
10075         esac
10076         ;;
10077 esac
10078 case "$i8type" in
10079 '')     set try -DINT8
10080         if eval $compile; then
10081                 case "`./try$exe_ext`" in
10082                 int8_t) i8type=int8_t
10083                         u8type=uint8_t
10084                         i8size=1
10085                         u8size=1
10086                         ;;
10087                 esac
10088         fi
10089         ;;
10090 esac
10091 case "$i8type" in
10092 '')     if $test $charsize -ge 1; then
10093                 i8type=char
10094                 u8type="unsigned char"
10095                 i8size=$charsize
10096                 u8size=$charsize
10097         fi
10098         ;;
10099 esac
10100
10101 case "$i16type" in
10102 '')     case "$shortsize" in
10103         2)      i16type=short
10104                 u16type="unsigned short"
10105                 i16size=$shortsize
10106                 u16size=$shortsize
10107                 ;;
10108         esac
10109         ;;
10110 esac
10111 case "$i16type" in
10112 '')     set try -DINT16
10113         if eval $compile; then
10114                 case "`./try$exe_ext`" in
10115                 int16_t)
10116                         i16type=int16_t
10117                         u16type=uint16_t
10118                         i16size=2
10119                         u16size=2
10120                         ;;
10121                 esac
10122         fi
10123         ;;
10124 esac
10125 case "$i16type" in
10126 '')     if $test $shortsize -ge 2; then
10127                 i16type=short
10128                 u16type="unsigned short"
10129                 i16size=$shortsize
10130                 u16size=$shortsize
10131         fi
10132         ;;
10133 esac
10134
10135 case "$i32type" in
10136 '')     case "$longsize" in
10137         4)      i32type=long
10138                 u32type="unsigned long"
10139                 i32size=$longsize
10140                 u32size=$longsize
10141                 ;;
10142         *)      case "$intsize" in
10143                 4)      i32type=int
10144                         u32type="unsigned int"
10145                         i32size=$intsize
10146                         u32size=$intsize
10147                         ;;
10148                 esac
10149                 ;;
10150         esac
10151         ;;
10152 esac
10153 case "$i32type" in
10154 '')     set try -DINT32
10155         if eval $compile; then
10156                 case "`./try$exe_ext`" in
10157                 int32_t)
10158                         i32type=int32_t
10159                         u32type=uint32_t
10160                         i32size=4
10161                         u32size=4
10162                         ;;
10163                 esac
10164         fi
10165         ;;
10166 esac
10167 case "$i32type" in
10168 '')     if $test $intsize -ge 4; then
10169                 i32type=int
10170                 u32type="unsigned int"
10171                 i32size=$intsize
10172                 u32size=$intsize
10173         fi
10174         ;;
10175 esac
10176
10177 case "$i64type" in
10178 '')     case "$d_quad:$quadtype" in
10179         define:?*)
10180                 i64type="$quadtype"
10181                 u64type="$uquadtype"
10182                 i64size=8
10183                 u64size=8
10184                 ;;
10185         esac
10186         ;;
10187 esac
10188
10189 $echo "Checking whether your NVs can preserve your UVs..." >&4
10190 $cat <<EOP >try.c
10191 #include <stdio.h>
10192 int main() {
10193     $uvtype k = ($uvtype)~0, l;
10194     $nvtype d;
10195     l = k;
10196     d = ($nvtype)l;
10197     l = ($uvtype)d;
10198     if (l == k)
10199        printf("preserve\n");
10200     exit(0);
10201 }
10202 EOP
10203 set try
10204 if eval $compile; then
10205         case "`./try$exe_ext`" in
10206         preserve) d_nv_preserves_uv="$define" ;;
10207         esac
10208 fi      
10209 case "$d_nv_preserves_uv" in
10210 $define) $echo "Yes, they can."  2>&1 ;;
10211 *)       $echo "No, they can't." 2>&1
10212          d_nv_preserves_uv="$undef"
10213          ;;
10214 esac
10215
10216 $rm -f try.* try
10217
10218 case "$d_nv_preserves_uv" in
10219 "$define") d_nv_preserves_uv_bits=`expr $uvsize \* 8` ;;
10220 *)      $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
10221         $cat <<EOP >try.c
10222 #include <stdio.h>
10223 int main() {
10224     $uvtype u = 0;
10225     int     n = 8 * $uvsize;
10226     int     i;
10227     for (i = 0; i < n; i++) {
10228       u = u << 1 | ($uvtype)1;
10229       if (($uvtype)($nvtype)u != u)
10230         break;
10231     }
10232     printf("%d\n", i);
10233     exit(0);
10234 }
10235 EOP
10236         set try
10237         if eval $compile; then
10238                 d_nv_preserves_uv_bits="`./try$exe_ext`"
10239         fi
10240         case "$d_nv_preserves_uv_bits" in
10241         [1-9]*) $echo "Your NVs can preserve $d_nv_preserves_uv_bits bits of your UVs."  2>&1 ;;
10242         *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
10243                 d_nv_preserves_uv_bits="$undef"
10244                 ;;
10245         esac
10246         $rm -f try.* try
10247         ;;
10248 esac
10249
10250
10251 : check for off64_t
10252 echo " "
10253 echo "Checking to see if you have off64_t..." >&4
10254 $cat >try.c <<EOCP
10255 #include <sys/types.h>
10256 #include <unistd.h>
10257 int main() { off64_t x = 7; }
10258 EOCP
10259 set try
10260 if eval $compile; then
10261         val="$define"
10262         echo "You have off64_t."
10263 else
10264         val="$undef"
10265         echo "You do not have off64_t."
10266         case "$lseeksize" in
10267         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
10268         esac
10269 fi
10270 $rm -f try.* try
10271 set d_off64_t
10272 eval $setvar
10273
10274 : see if POSIX threads are available
10275 set pthread.h i_pthread
10276 eval $inhdr
10277
10278
10279
10280
10281 : how to create joinable pthreads
10282 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
10283         echo " "
10284         echo "Checking what constant to use for creating joinable pthreads..." >&4 
10285         $cat >try.c <<'EOCP'
10286 #include <pthread.h>
10287 int main() {
10288     int detachstate = JOINABLE;
10289 }
10290 EOCP
10291         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
10292         if eval $compile; then
10293                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
10294                 val="$undef" # Yes, undef.
10295                 set d_old_pthread_create_joinable
10296                 eval $setvar
10297                 val=""
10298                 set old_pthread_create_joinable
10299                 eval $setvar
10300         else
10301                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
10302                 if eval $compile; then
10303                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
10304                         val="$define"
10305                         set d_old_pthread_create_joinable
10306                         eval $setvar
10307                         val=PTHREAD_CREATE_UNDETACHED
10308                         set old_pthread_create_joinable
10309                         eval $setvar
10310                 else            
10311                         set try -DJOINABLE=__UNDETACHED
10312                         if eval $compile; then
10313                                 echo "You seem to use __UNDETACHED." >&4
10314                                 val="$define"
10315                                 set d_old_pthread_create_joinable
10316                                 eval $setvar
10317                                 val=__UNDETACHED
10318                                 set old_pthread_create_joinable
10319                                 eval $setvar
10320                         else
10321                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
10322                                 val="$define"
10323                                 set d_old_pthread_create_joinable
10324                                 eval $setvar
10325                                 val=0
10326                                 set old_pthread_create_joinable
10327                                 eval $setvar
10328                         fi
10329                 fi
10330         fi
10331         $rm -f try try.*
10332 else
10333     d_old_pthread_create_joinable="$undef"
10334     old_pthread_create_joinable=""
10335 fi
10336
10337 : see if pause exists
10338 set pause d_pause
10339 eval $inlibc
10340
10341 : see if pipe exists
10342 set pipe d_pipe
10343 eval $inlibc
10344
10345 : see if poll exists
10346 set poll d_poll
10347 eval $inlibc
10348
10349
10350 : see whether the various POSIXish _yields exist
10351 $cat >try.c <<EOP
10352 #include <pthread.h>
10353 #include <stdio.h>
10354 int main() {
10355 #ifdef SCHED_YIELD
10356         sched_yield();
10357 #else
10358 #ifdef PTHREAD_YIELD
10359         pthread_yield();
10360 #else
10361 #ifdef PTHREAD_YIELD_NULL
10362         pthread_yield(NULL);
10363 #endif
10364 #endif
10365 #endif
10366 }
10367 EOP
10368 : see if sched_yield exists
10369 set try -DSCHED_YIELD
10370 if eval $compile; then
10371     val="$define"
10372     sched_yield='sched_yield()'
10373 else
10374     val="$undef"
10375 fi
10376 case "$usethreads" in
10377 $define)
10378         case "$val" in
10379         $define) echo 'sched_yield() found.' >&4        ;;
10380         *)       echo 'sched_yield() NOT found.' >&4    ;;
10381         esac
10382 esac
10383 set d_sched_yield
10384 eval $setvar
10385
10386 : see if pthread_yield exists
10387 set try -DPTHREAD_YIELD
10388 if eval $compile; then
10389     val="$define"
10390     case "$sched_yield" in
10391     '') sched_yield='pthread_yield()' ;;
10392     esac
10393 else
10394     set try -DPTHREAD_YIELD_NULL
10395     if eval $compile; then
10396         val="$define"
10397         case "$sched_yield" in
10398         '') sched_yield='pthread_yield(NULL)' ;;
10399         esac
10400     else
10401         val="$undef"
10402     fi
10403 fi
10404 case "$usethreads" in
10405 $define)
10406         case "$val" in
10407         $define) echo 'pthread_yield() found.' >&4      ;;
10408         *)       echo 'pthread_yield() NOT found.' >&4  ;;
10409         esac
10410         ;;
10411 esac
10412 set d_pthread_yield
10413 eval $setvar
10414
10415 case "$sched_yield" in
10416 '') sched_yield=undef ;;
10417 esac
10418
10419 $rm -f try try.*
10420
10421 : see if this is a pwd.h system
10422 set pwd.h i_pwd
10423 eval $inhdr
10424
10425 case "$i_pwd" in
10426 $define)
10427         xxx=`./findhdr pwd.h`
10428         $cppstdin $cppflags $cppminus < $xxx >$$.h
10429
10430         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
10431                 val="$define"
10432         else
10433                 val="$undef"
10434         fi
10435         set d_pwquota
10436         eval $setvar
10437
10438         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
10439                 val="$define"
10440         else
10441                 val="$undef"
10442         fi
10443         set d_pwage
10444         eval $setvar
10445
10446         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
10447                 val="$define"
10448         else
10449                 val="$undef"
10450         fi
10451         set d_pwchange
10452         eval $setvar
10453
10454         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
10455                 val="$define"
10456         else
10457                 val="$undef"
10458         fi
10459         set d_pwclass
10460         eval $setvar
10461
10462         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
10463                 val="$define"
10464         else
10465                 val="$undef"
10466         fi
10467         set d_pwexpire
10468         eval $setvar
10469
10470         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
10471                 val="$define"
10472         else
10473                 val="$undef"
10474         fi
10475         set d_pwcomment
10476         eval $setvar
10477
10478         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
10479                 val="$define"
10480         else
10481                 val="$undef"
10482         fi
10483         set d_pwgecos
10484         eval $setvar
10485
10486         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
10487                 val="$define"
10488         else
10489                 val="$undef"
10490         fi
10491         set d_pwpasswd
10492         eval $setvar
10493
10494         $rm -f $$.h
10495         ;;
10496 *)
10497         val="$undef"; 
10498         set d_pwquota; eval $setvar
10499         set d_pwage; eval $setvar
10500         set d_pwchange; eval $setvar
10501         set d_pwclass; eval $setvar
10502         set d_pwexpire; eval $setvar
10503         set d_pwcomment; eval $setvar
10504         set d_pwgecos; eval $setvar
10505         set d_pwpasswd; eval $setvar
10506         ;;
10507 esac
10508
10509 : see if readdir and friends exist
10510 set readdir d_readdir
10511 eval $inlibc
10512 set seekdir d_seekdir
10513 eval $inlibc
10514 set telldir d_telldir
10515 eval $inlibc
10516 set rewinddir d_rewinddir
10517 eval $inlibc
10518
10519 : see if readlink exists
10520 set readlink d_readlink
10521 eval $inlibc
10522
10523 : see if rename exists
10524 set rename d_rename
10525 eval $inlibc
10526
10527 : see if rmdir exists
10528 set rmdir d_rmdir
10529 eval $inlibc
10530
10531 : see if memory.h is available.
10532 val=''
10533 set memory.h val
10534 eval $inhdr
10535
10536 : See if it conflicts with string.h
10537 case "$val" in
10538 $define)
10539         case "$strings" in
10540         '') ;;
10541         *)
10542                 $cppstdin $cppflags $cppminus < $strings > mem.h
10543                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
10544                         echo " "
10545                         echo "We won't be including <memory.h>."
10546                         val="$undef"
10547                 fi
10548                 $rm -f mem.h
10549                 ;;
10550         esac
10551 esac
10552 set i_memory
10553 eval $setvar
10554
10555 : can bcopy handle overlapping blocks?
10556 val="$undef"
10557 case "$d_bcopy" in
10558 "$define")
10559         echo " "
10560         echo "Checking to see if your bcopy() can do overlapping copies..." >&4
10561         $cat >try.c <<EOCP
10562 #$i_memory I_MEMORY
10563 #$i_stdlib I_STDLIB
10564 #$i_string I_STRING
10565 #$i_unistd I_UNISTD
10566 EOCP
10567         $cat >>try.c <<'EOCP'
10568 #include <stdio.h>
10569 #ifdef I_MEMORY
10570 #  include <memory.h>
10571 #endif
10572 #ifdef I_STDLIB
10573 #  include <stdlib.h>
10574 #endif
10575 #ifdef I_STRING
10576 #  include <string.h>
10577 #else
10578 #  include <strings.h>
10579 #endif
10580 #ifdef I_UNISTD
10581 #  include <unistd.h>  /* Needed for NetBSD */
10582 #endif
10583 int main()
10584 {
10585 char buf[128], abc[128];
10586 char *b;
10587 int len;
10588 int off;
10589 int align;
10590
10591 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
10592
10593 for (align = 7; align >= 0; align--) {
10594         for (len = 36; len; len--) {
10595                 b = buf+align;
10596                 bcopy(abc, b, len);
10597                 for (off = 1; off <= len; off++) {
10598                         bcopy(b, b+off, len);
10599                         bcopy(b+off, b, len);
10600                         if (bcmp(b, abc, len))
10601                                 exit(1);
10602                 }
10603         }
10604 }
10605 exit(0);
10606 }
10607 EOCP
10608         set try
10609         if eval $compile_ok; then
10610                 if ./try 2>/dev/null; then
10611                         echo "Yes, it can."
10612                         val="$define"
10613                 else
10614                         echo "It can't, sorry."
10615                         case "$d_memmove" in
10616                         "$define") echo "But that's Ok since you have memmove()." ;;
10617                         esac
10618                 fi
10619         else
10620                 echo "(I can't compile the test program, so we'll assume not...)"
10621                 case "$d_memmove" in
10622                 "$define") echo "But that's Ok since you have memmove()." ;;
10623                 esac
10624         fi
10625         ;;
10626 esac
10627 $rm -f try.* try core
10628 set d_safebcpy
10629 eval $setvar
10630
10631 : can memcpy handle overlapping blocks?
10632 val="$undef"
10633 case "$d_memcpy" in
10634 "$define")
10635         echo " "
10636         echo "Checking to see if your memcpy() can do overlapping copies..." >&4
10637         $cat >try.c <<EOCP
10638 #$i_memory I_MEMORY
10639 #$i_stdlib I_STDLIB
10640 #$i_string I_STRING
10641 #$i_unistd I_UNISTD
10642 EOCP
10643         $cat >>try.c <<'EOCP'
10644 #include <stdio.h>
10645 #ifdef I_MEMORY
10646 #  include <memory.h>
10647 #endif
10648 #ifdef I_STDLIB
10649 #  include <stdlib.h>
10650 #endif
10651 #ifdef I_STRING
10652 #  include <string.h>
10653 #else
10654 #  include <strings.h>
10655 #endif
10656 #ifdef I_UNISTD
10657 #  include <unistd.h>  /* Needed for NetBSD */
10658 #endif
10659 int main()
10660 {
10661 char buf[128], abc[128];
10662 char *b;
10663 int len;
10664 int off;
10665 int align;
10666
10667 /* Copy "abcde..." string to char abc[] so that gcc doesn't
10668    try to store the string in read-only memory. */
10669 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
10670
10671 for (align = 7; align >= 0; align--) {
10672         for (len = 36; len; len--) {
10673                 b = buf+align;
10674                 memcpy(b, abc, len);
10675                 for (off = 1; off <= len; off++) {
10676                         memcpy(b+off, b, len);
10677                         memcpy(b, b+off, len);
10678                         if (memcmp(b, abc, len))
10679                                 exit(1);
10680                 }
10681         }
10682 }
10683 exit(0);
10684 }
10685 EOCP
10686         set try
10687         if eval $compile_ok; then
10688                 if ./try 2>/dev/null; then
10689                         echo "Yes, it can."
10690                         val="$define"
10691                 else
10692                         echo "It can't, sorry."
10693                         case "$d_memmove" in
10694                         "$define") echo "But that's Ok since you have memmove()." ;;
10695                         esac
10696                 fi
10697         else
10698                 echo "(I can't compile the test program, so we'll assume not...)"
10699                 case "$d_memmove" in
10700                 "$define") echo "But that's Ok since you have memmove()." ;;
10701                 esac
10702         fi
10703         ;;
10704 esac
10705 $rm -f try.* try core
10706 set d_safemcpy
10707 eval $setvar
10708
10709 : can memcmp be trusted to compare relative magnitude?
10710 val="$undef"
10711 case "$d_memcmp" in
10712 "$define")
10713         echo " "
10714         echo "Checking if your memcmp() can compare relative magnitude..." >&4
10715         $cat >try.c <<EOCP
10716 #$i_memory I_MEMORY
10717 #$i_stdlib I_STDLIB
10718 #$i_string I_STRING
10719 #$i_unistd I_UNISTD
10720 EOCP
10721         $cat >>try.c <<'EOCP'
10722 #include <stdio.h>
10723 #ifdef I_MEMORY
10724 #  include <memory.h>
10725 #endif
10726 #ifdef I_STDLIB
10727 #  include <stdlib.h>
10728 #endif
10729 #ifdef I_STRING
10730 #  include <string.h>
10731 #else
10732 #  include <strings.h>
10733 #endif
10734 #ifdef I_UNISTD
10735 #  include <unistd.h>  /* Needed for NetBSD */
10736 #endif
10737 int main()
10738 {
10739 char a = -1;
10740 char b = 0;
10741 if ((a < b) && memcmp(&a, &b, 1) < 0)
10742         exit(1);
10743 exit(0);
10744 }
10745 EOCP
10746         set try
10747         if eval $compile_ok; then
10748                 if ./try 2>/dev/null; then
10749                         echo "Yes, it can."
10750                         val="$define"
10751                 else
10752                         echo "No, it can't (it uses signed chars)."
10753                 fi
10754         else
10755                 echo "(I can't compile the test program, so we'll assume not...)"
10756         fi
10757         ;;
10758 esac
10759 $rm -f try.* try core
10760 set d_sanemcmp
10761 eval $setvar
10762
10763 : see if select exists
10764 set select d_select
10765 eval $inlibc
10766
10767 : see if semctl exists
10768 set semctl d_semctl
10769 eval $inlibc
10770
10771 : see if semget exists
10772 set semget d_semget
10773 eval $inlibc
10774
10775 : see if semop exists
10776 set semop d_semop
10777 eval $inlibc
10778
10779 : see how much of the 'sem*(2)' library is present.
10780 h_sem=true
10781 echo " "
10782 case "$d_semctl$d_semget$d_semop" in
10783 *"$undef"*) h_sem=false;;
10784 esac
10785 case "$osname" in
10786 freebsd)
10787     case "`ipcs 2>&1`" in
10788     "SVID messages"*"not configured"*)
10789         echo "Your $osname does not have the sem*(2) configured." >&4
10790         h_sem=false
10791         val="$undef"
10792         set semctl d_semctl
10793         eval $setvar
10794         set semget d_semget
10795         eval $setvar
10796         set semop d_semop
10797         eval $setvar
10798         ;;
10799     esac
10800     ;;
10801 esac
10802 : we could also check for sys/ipc.h ...
10803 if $h_sem && $test `./findhdr sys/sem.h`; then
10804         echo "You have the full sem*(2) library." >&4
10805         val="$define"
10806 else
10807         echo "You don't have the full sem*(2) library." >&4
10808         val="$undef"
10809 fi
10810 set d_sem
10811 eval $setvar
10812
10813 : see whether sys/sem.h defines union semun
10814 echo " "
10815 $cat > try.c <<'END'
10816 #include <sys/types.h>
10817 #include <sys/ipc.h>
10818 #include <sys/sem.h>
10819 int main () { union semun semun; semun.buf = 0; }
10820 END
10821 set try
10822 if eval $compile; then
10823     echo "You have union semun in <sys/sem.h>." >&4
10824     val="$define"
10825 else
10826     echo "You do not have union semun in <sys/sem.h>." >&4
10827     val="$undef"
10828 fi
10829 $rm -f try try.c try.h
10830 set d_union_semun
10831 eval $setvar
10832
10833 : see how to do semctl IPC_STAT
10834 case "$d_sem" in
10835 $define)
10836     : see whether semctl IPC_STAT can use union semun
10837     echo " "
10838     $cat > try.h <<END
10839 #ifndef S_IRUSR
10840 #   ifdef S_IREAD
10841 #       define S_IRUSR S_IREAD
10842 #       define S_IWUSR S_IWRITE
10843 #       define S_IXUSR S_IEXEC
10844 #   else
10845 #       define S_IRUSR 0400
10846 #       define S_IWUSR 0200
10847 #       define S_IXUSR 0100
10848 #   endif
10849 #   define S_IRGRP (S_IRUSR>>3)
10850 #   define S_IWGRP (S_IWUSR>>3)
10851 #   define S_IXGRP (S_IXUSR>>3)
10852 #   define S_IROTH (S_IRUSR>>6)
10853 #   define S_IWOTH (S_IWUSR>>6)
10854 #   define S_IXOTH (S_IXUSR>>6)
10855 #endif
10856 #ifndef S_IRWXU
10857 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
10858 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
10859 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
10860 #endif
10861 END
10862
10863     $cat > try.c <<END
10864 #include <sys/types.h>
10865 #include <sys/ipc.h>
10866 #include <sys/sem.h>
10867 #include <sys/stat.h>
10868 #include <stdio.h>
10869 #include <errno.h>
10870 #include "try.h"
10871 #ifndef errno
10872 extern int errno;
10873 #endif
10874 #$d_union_semun HAS_UNION_SEMUN
10875 int main() {
10876     union semun
10877 #ifndef HAS_UNION_SEMUN
10878     {
10879         int val;
10880         struct semid_ds *buf;
10881         unsigned short *array;
10882     }
10883 #endif
10884     arg;
10885     int sem, st;
10886
10887 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
10888     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
10889     if (sem > -1) {
10890         struct semid_ds argbuf;
10891         arg.buf = &argbuf;
10892 #       ifdef IPC_STAT
10893         st = semctl(sem, 0, IPC_STAT, arg);
10894         if (st == 0)
10895             printf("semun\n");
10896         else
10897 #       endif /* IPC_STAT */
10898             printf("semctl IPC_STAT failed: errno = %d\n", errno);
10899 #       ifdef IPC_RMID
10900         if (semctl(sem, 0, IPC_RMID, arg) != 0)
10901 #       endif /* IPC_RMID */
10902             printf("semctl IPC_RMID failed: errno = %d\n", errno);
10903     } else
10904 #endif /* IPC_PRIVATE && ... */
10905         printf("semget failed: errno = %d\n", errno);
10906   return 0;
10907 }
10908 END
10909     val="$undef"
10910     set try
10911     if eval $compile; then
10912         xxx=`./try`
10913         case "$xxx" in
10914         semun) val="$define" ;;
10915         esac
10916     fi
10917     $rm -f try try.c
10918     set d_semctl_semun
10919     eval $setvar
10920     case "$d_semctl_semun" in
10921     $define)
10922         echo "You can use union semun for semctl IPC_STAT." >&4
10923         also='also'
10924         ;;
10925     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
10926         also=''
10927         ;;
10928     esac
10929
10930     : see whether semctl IPC_STAT can use struct semid_ds pointer
10931     $cat > try.c <<'END'
10932 #include <sys/types.h>
10933 #include <sys/ipc.h>
10934 #include <sys/sem.h>
10935 #include <sys/stat.h>
10936 #include "try.h"
10937 #include <stdio.h>
10938 #include <errno.h>
10939 #ifndef errno
10940 extern int errno;
10941 #endif
10942 int main() {
10943     struct semid_ds arg;
10944     int sem, st;
10945
10946 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
10947     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
10948     if (sem > -1) {
10949 #       ifdef IPC_STAT
10950         st = semctl(sem, 0, IPC_STAT, &arg);
10951         if (st == 0)
10952             printf("semid_ds\n");
10953         else
10954 #       endif /* IPC_STAT */
10955             printf("semctl IPC_STAT failed: errno = %d\n", errno);
10956 #       ifdef IPC_RMID
10957         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
10958 #       endif /* IPC_RMID */
10959             printf("semctl IPC_RMID failed: errno = %d\n", errno);
10960     } else
10961 #endif /* IPC_PRIVATE && ... */
10962         printf("semget failed: errno = %d\n", errno);
10963
10964     return 0;
10965 }
10966 END
10967     val="$undef"
10968     set try
10969     if eval $compile; then
10970         xxx=`./try`
10971         case "$xxx" in
10972         semid_ds) val="$define" ;;
10973         esac
10974     fi
10975     $rm -f try try.c
10976     set d_semctl_semid_ds
10977     eval $setvar
10978     case "$d_semctl_semid_ds" in
10979     $define)
10980         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
10981         ;;
10982     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
10983         ;;
10984     esac
10985     $rm -f try.h
10986     ;;
10987 *)  val="$undef"
10988
10989     # We do not have the full sem*(2) library, so assume we can not
10990     # use either.
10991
10992     set d_semctl_semun
10993     eval $setvar
10994
10995     set d_semctl_semid_ds
10996     eval $setvar
10997     ;;
10998 esac
10999
11000 : see if setegid exists
11001 set setegid d_setegid
11002 eval $inlibc
11003
11004 : see if seteuid exists
11005 set seteuid d_seteuid
11006 eval $inlibc
11007
11008 : see if setgrent exists
11009 set setgrent d_setgrent
11010 eval $inlibc
11011
11012 : see if sethostent exists
11013 set sethostent d_sethent
11014 eval $inlibc
11015
11016 : see if setlinebuf exists
11017 set setlinebuf d_setlinebuf
11018 eval $inlibc
11019
11020 : see if setlocale exists
11021 set setlocale d_setlocale
11022 eval $inlibc
11023
11024 : see if setnetent exists
11025 set setnetent d_setnent
11026 eval $inlibc
11027
11028 : see if setprotoent exists
11029 set setprotoent d_setpent
11030 eval $inlibc
11031
11032 : see if setpgid exists
11033 set setpgid d_setpgid
11034 eval $inlibc
11035
11036 : see if setpgrp2 exists
11037 set setpgrp2 d_setpgrp2
11038 eval $inlibc
11039
11040 : see if setpriority exists
11041 set setpriority d_setprior
11042 eval $inlibc
11043
11044 : see if setproctitle exists
11045 set setproctitle d_setproctitle
11046 eval $inlibc
11047
11048 : see if setpwent exists
11049 set setpwent d_setpwent
11050 eval $inlibc
11051
11052 : see if setregid exists
11053 set setregid d_setregid
11054 eval $inlibc
11055 set setresgid d_setresgid
11056 eval $inlibc
11057
11058 : see if setreuid exists
11059 set setreuid d_setreuid
11060 eval $inlibc
11061 set setresuid d_setresuid
11062 eval $inlibc
11063
11064 : see if setrgid exists
11065 set setrgid d_setrgid
11066 eval $inlibc
11067
11068 : see if setruid exists
11069 set setruid d_setruid
11070 eval $inlibc
11071
11072 : see if setservent exists
11073 set setservent d_setsent
11074 eval $inlibc
11075
11076 : see if setsid exists
11077 set setsid d_setsid
11078 eval $inlibc
11079
11080 : see if setvbuf exists
11081 set setvbuf d_setvbuf
11082 eval $inlibc
11083
11084 : see if sfio.h is available
11085 set sfio.h i_sfio
11086 eval $inhdr
11087
11088
11089 : see if sfio library is available
11090 case "$i_sfio" in
11091 $define)
11092         val=''
11093         set sfreserve val
11094         eval $inlibc
11095         ;;
11096 *)
11097         val="$undef"
11098         ;;
11099 esac
11100 : Ok, but do we want to use it.
11101 case "$val" in
11102 $define)
11103         case "$usesfio" in
11104         true|$define|[yY]*) dflt='y';;
11105         *) dflt='n';;
11106         esac
11107         echo "$package can use the sfio library, but it is experimental."
11108         case "$useperlio" in
11109         "$undef")
11110             echo "For sfio also the PerlIO abstraction layer is needed."
11111             echo "Earlier you said you wouldn't want that."
11112             ;;
11113         esac
11114         rp="You seem to have sfio available, do you want to try using it?"
11115         . ./myread
11116         case "$ans" in
11117         y|Y)    echo "Ok, turning on both sfio and PerlIO, then."
11118                 useperlio="$define"
11119                 val="$define"
11120                 ;;
11121         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
11122                 val="$undef"
11123                 : Remove sfio from list of libraries to use
11124                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
11125                 shift
11126                 libs="$*"
11127                 echo "libs = $libs" >&4
11128                 ;;
11129         esac
11130         ;;
11131 *)      case "$usesfio" in
11132         true|$define|[yY]*)
11133                 echo "Sorry, cannot find sfio on this machine." >&4
11134                 echo "Ignoring your setting of usesfio=$usesfio." >&4
11135                 val="$undef"
11136                 ;;
11137         esac
11138         ;;
11139 esac
11140 set d_sfio
11141 eval $setvar
11142 case "$d_sfio" in
11143 $define) usesfio='true';;
11144 *) usesfio='false';;
11145 esac
11146
11147 : see if shmctl exists
11148 set shmctl d_shmctl
11149 eval $inlibc
11150
11151 : see if shmget exists
11152 set shmget d_shmget
11153 eval $inlibc
11154
11155 : see if shmat exists
11156 set shmat d_shmat
11157 eval $inlibc
11158 : see what shmat returns
11159 case "$d_shmat" in
11160 "$define")
11161         $cat >shmat.c <<'END'
11162 #include <sys/shm.h>
11163 void *shmat();
11164 END
11165         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
11166                 shmattype='void *'
11167         else
11168                 shmattype='char *'
11169         fi
11170         echo "and it returns ($shmattype)." >&4
11171         : see if a prototype for shmat is available
11172         xxx=`./findhdr sys/shm.h`
11173         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
11174         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
11175                 val="$define"
11176         else
11177                 val="$undef"
11178         fi
11179         $rm -f shmat.[co]
11180         ;;
11181 *)
11182         val="$undef"
11183         ;;
11184 esac
11185 set d_shmatprototype
11186 eval $setvar
11187
11188 : see if shmdt exists
11189 set shmdt d_shmdt
11190 eval $inlibc
11191
11192 : see how much of the 'shm*(2)' library is present.
11193 h_shm=true
11194 echo " "
11195 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
11196 *"$undef"*) h_shm=false;;
11197 esac
11198 case "$osname" in
11199 freebsd)
11200     case "`ipcs 2>&1`" in
11201     "SVID shared memory"*"not configured"*)
11202         echo "Your $osname does not have the shm*(2) configured." >&4
11203         h_shm=false
11204         val="$undef"
11205         set shmctl d_shmctl
11206         evat $setvar
11207         set shmget d_shmget
11208         evat $setvar
11209         set shmat d_shmat
11210         evat $setvar
11211         set shmdt d_shmdt
11212         evat $setvar
11213         ;;
11214     esac
11215     ;;
11216 esac
11217 : we could also check for sys/ipc.h ...
11218 if $h_shm && $test `./findhdr sys/shm.h`; then
11219         echo "You have the full shm*(2) library." >&4
11220         val="$define"
11221 else
11222         echo "You don't have the full shm*(2) library." >&4
11223         val="$undef"
11224 fi
11225 set d_shm
11226 eval $setvar
11227
11228 echo " "
11229 : see if we have sigaction
11230 if set sigaction val -f d_sigaction; eval $csym; $val; then
11231         echo 'sigaction() found.' >&4
11232         $cat > try.c <<'EOP'
11233 #include <stdio.h>
11234 #include <sys/types.h>
11235 #include <signal.h>
11236 int main()
11237 {
11238     struct sigaction act, oact;
11239     act.sa_flags = 0;
11240     oact.sa_handler = 0;
11241     /* so that act and oact are used */
11242     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
11243 }
11244 EOP
11245         set try
11246         if eval $compile_ok; then
11247                 val="$define"
11248         else
11249                 echo "But you don't seem to have a useable struct sigaction." >&4
11250                 val="$undef"
11251         fi
11252 else
11253         echo 'sigaction NOT found.' >&4
11254         val="$undef"
11255 fi
11256 set d_sigaction; eval $setvar
11257 $rm -f try try$_o try.c
11258
11259 : see if sigsetjmp exists
11260 echo " "
11261 case "$d_sigsetjmp" in
11262 '')
11263         $cat >try.c <<'EOP'
11264 #include <setjmp.h>
11265 sigjmp_buf env;
11266 int set = 1;
11267 int main()
11268 {
11269         if (sigsetjmp(env,1))
11270                 exit(set);
11271         set = 0;
11272         siglongjmp(env, 1);
11273         exit(1);
11274 }
11275 EOP
11276         set try
11277         if eval $compile; then
11278                 if ./try >/dev/null 2>&1; then
11279                         echo "POSIX sigsetjmp found." >&4
11280                         val="$define"
11281                 else
11282                         $cat >&4 <<EOM
11283 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
11284 I'll ignore them.
11285 EOM
11286                         val="$undef"
11287                 fi
11288         else
11289                 echo "sigsetjmp not found." >&4
11290                 val="$undef"
11291         fi
11292         ;;
11293 *) val="$d_sigsetjmp"
11294         case "$d_sigsetjmp" in
11295         $define) echo "POSIX sigsetjmp found." >&4;;
11296         $undef) echo "sigsetjmp not found." >&4;;
11297         esac
11298         ;;
11299 esac
11300 set d_sigsetjmp
11301 eval $setvar
11302 $rm -f try.c try
11303
11304 : see if socks5_init exists
11305 set socks5_init d_socks5_init
11306 eval $inlibc
11307
11308 : see if sys/stat.h is available
11309 set sys/stat.h i_sysstat
11310 eval $inhdr
11311
11312
11313 : see if stat knows about block sizes
11314 echo " "
11315 echo "Checking to see if your struct stat has st_blocks field..." >&4
11316 set d_statblks stat st_blocks $i_sysstat sys/stat.h
11317 eval $hasfield
11318
11319
11320 : see if this is a sys/vfs.h system
11321 set sys/vfs.h i_sysvfs
11322 eval $inhdr
11323
11324
11325 : see if this is a sys/statfs.h system
11326 set sys/statfs.h i_sysstatfs
11327 eval $inhdr
11328
11329
11330 echo " "
11331 echo "Checking to see if your system supports struct statfs..." >&4
11332 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
11333 eval $hasstruct
11334 case "$d_statfs_s" in
11335 "$define")      echo "Yes, it does."   ;;
11336 *)              echo "No, it doesn't." ;;
11337 esac
11338
11339
11340
11341 : see if struct statfs knows about f_flags
11342 case "$d_statfs_s" in
11343 define) 
11344         echo " "
11345         echo "Checking to see if your struct statfs has f_flags field..." >&4
11346         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
11347         eval $hasfield
11348         ;;
11349 *)      val="$undef"
11350         set d_statfs_f_flags
11351         eval $setvar
11352         ;;
11353 esac
11354 case "$d_statfs_f_flags" in
11355 "$define")      echo "Yes, it does."   ;;
11356 *)              echo "No, it doesn't." ;;
11357 esac
11358
11359 : see if _ptr and _cnt from stdio act std
11360 echo " "
11361 if $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
11362         echo "(Looks like you have stdio.h from Linux.)"
11363         case "$stdio_ptr" in
11364         '') stdio_ptr='((fp)->_IO_read_ptr)'
11365                 ptr_lval=$define
11366                 ;;
11367         *)      ptr_lval=$d_stdio_ptr_lval;;
11368         esac
11369         case "$stdio_cnt" in
11370         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
11371                 cnt_lval=$undef
11372                 ;;
11373         *)      cnt_lval=$d_stdio_cnt_lval;;
11374         esac
11375         case "$stdio_base" in
11376         '') stdio_base='((fp)->_IO_read_base)';;
11377         esac
11378         case "$stdio_bufsiz" in
11379         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
11380         esac
11381 else
11382         case "$stdio_ptr" in
11383         '') stdio_ptr='((fp)->_ptr)'
11384                 ptr_lval=$define
11385                 ;;
11386         *)      ptr_lval=$d_stdio_ptr_lval;;
11387         esac
11388         case "$stdio_cnt" in
11389         '') stdio_cnt='((fp)->_cnt)'
11390                 cnt_lval=$define
11391                 ;;
11392         *)      cnt_lval=$d_stdio_cnt_lval;;
11393         esac
11394         case "$stdio_base" in
11395         '') stdio_base='((fp)->_base)';;
11396         esac
11397         case "$stdio_bufsiz" in
11398         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
11399         esac
11400 fi
11401 : test whether _ptr and _cnt really work
11402 echo "Checking how std your stdio is..." >&4
11403 $cat >try.c <<EOP
11404 #include <stdio.h>
11405 #define FILE_ptr(fp)    $stdio_ptr
11406 #define FILE_cnt(fp)    $stdio_cnt
11407 int main() {
11408         FILE *fp = fopen("try.c", "r");
11409         char c = getc(fp);
11410         if (
11411                 18 <= FILE_cnt(fp) &&
11412                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
11413         )
11414                 exit(0);
11415         exit(1);
11416 }
11417 EOP
11418 val="$undef"
11419 set try
11420 if eval $compile; then
11421         if ./try; then
11422                 echo "Your stdio acts pretty std."
11423                 val="$define"
11424         else
11425                 echo "Your stdio isn't very std."
11426         fi
11427 else
11428         echo "Your stdio doesn't appear very std."
11429 fi
11430 $rm -f try.c try
11431 set d_stdstdio
11432 eval $setvar
11433
11434 : Can _ptr be used as an lvalue?
11435 case "$d_stdstdio$ptr_lval" in
11436 $define$define) val=$define ;;
11437 *) val=$undef ;;
11438 esac
11439 set d_stdio_ptr_lval
11440 eval $setvar
11441
11442 : Can _cnt be used as an lvalue?
11443 case "$d_stdstdio$cnt_lval" in
11444 $define$define) val=$define ;;
11445 *) val=$undef ;;
11446 esac
11447 set d_stdio_cnt_lval
11448 eval $setvar
11449
11450 : see if _base is also standard
11451 val="$undef"
11452 case "$d_stdstdio" in
11453 $define)
11454         $cat >try.c <<EOP
11455 #include <stdio.h>
11456 #define FILE_base(fp)   $stdio_base
11457 #define FILE_bufsiz(fp) $stdio_bufsiz
11458 int main() {
11459         FILE *fp = fopen("try.c", "r");
11460         char c = getc(fp);
11461         if (
11462                 19 <= FILE_bufsiz(fp) &&
11463                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
11464         )
11465                 exit(0);
11466         exit(1);
11467 }
11468 EOP
11469         set try
11470         if eval $compile; then
11471                 if ./try; then
11472                         echo "And its _base field acts std."
11473                         val="$define"
11474                 else
11475                         echo "But its _base field isn't std."
11476                 fi
11477         else
11478                 echo "However, it seems to be lacking the _base field."
11479         fi
11480         $rm -f try.c try
11481         ;;
11482 esac
11483 set d_stdiobase
11484 eval $setvar
11485
11486 $cat >&4 <<EOM
11487 Checking how to access stdio streams by file descriptor number...
11488 EOM
11489 case "$stdio_stream_array" in
11490 '')     $cat >try.c <<EOCP
11491 #include <stdio.h>
11492 int main() {
11493   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
11494     printf("yes\n");
11495 }
11496 EOCP
11497         for s in _iob __iob __sF
11498         do
11499                 set try -DSTDIO_STREAM_ARRAY=$s
11500                 if eval $compile; then
11501                         case "`./try$exe_ext`" in
11502                         yes)    stdio_stream_array=$s; break ;;
11503                         esac
11504                 fi
11505         done
11506         $rm -f try.* try$exe_ext
11507 esac
11508 case "$stdio_stream_array" in
11509 '')     $cat >&4 <<EOM
11510 I can't figure out how to access stdio streams by file descriptor number.
11511 EOM
11512         d_stdio_stream_array="$undef"
11513         ;;
11514 *)      $cat >&4 <<EOM
11515 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
11516 EOM
11517         d_stdio_stream_array="$define"
11518         ;;
11519 esac
11520
11521 : see if strcoll exists
11522 set strcoll d_strcoll
11523 eval $inlibc
11524
11525 : check for structure copying
11526 echo " "
11527 echo "Checking to see if your C compiler can copy structs..." >&4
11528 $cat >try.c <<'EOCP'
11529 int main()
11530 {
11531         struct blurfl {
11532                 int dyick;
11533         } foo, bar;
11534
11535         foo = bar;
11536 }
11537 EOCP
11538 if $cc -c try.c >/dev/null 2>&1 ; then
11539         val="$define"
11540         echo "Yup, it can."
11541 else
11542         val="$undef"
11543         echo "Nope, it can't."
11544 fi
11545 set d_strctcpy
11546 eval $setvar
11547 $rm -f try.*
11548
11549 : see if strerror and/or sys_errlist[] exist
11550 echo " "
11551 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
11552     if set strerror val -f d_strerror; eval $csym; $val; then
11553                 echo 'strerror() found.' >&4
11554                 d_strerror="$define"
11555                 d_strerrm='strerror(e)'
11556                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
11557                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
11558                         d_syserrlst="$define"
11559                 else
11560                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
11561                         d_syserrlst="$undef"
11562                 fi
11563     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
11564                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
11565                 echo 'strerror() found in string header.' >&4
11566                 d_strerror="$define"
11567                 d_strerrm='strerror(e)'
11568                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
11569                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
11570                                 d_syserrlst="$define"
11571                 else
11572                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
11573                         d_syserrlst="$undef"
11574                 fi
11575     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
11576                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
11577                 d_strerror="$undef"
11578                 d_syserrlst="$define"
11579                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
11580     else
11581                 echo 'strerror() and sys_errlist[] NOT found.' >&4
11582                 d_strerror="$undef"
11583                 d_syserrlst="$undef"
11584                 d_strerrm='"unknown"'
11585     fi
11586 fi
11587
11588 : see if strtod exists
11589 set strtod d_strtod
11590 eval $inlibc
11591
11592 : see if strtol exists
11593 set strtol d_strtol
11594 eval $inlibc
11595
11596 : see if strtold exists
11597 set strtold d_strtold
11598 eval $inlibc
11599
11600 : see if strtoll exists
11601 set strtoll d_strtoll
11602 eval $inlibc
11603
11604 case "$d_longlong-$d_strtoll" in
11605 "$define-$define")
11606         $cat <<EOM
11607 Checking whether your strtoll() works okay...
11608 EOM
11609         $cat >try.c <<'EOCP'
11610 #include <errno.h>
11611 #ifdef __hpux
11612 #define strtoll __strtoll
11613 #endif
11614 #include <stdio.h>
11615 extern long long int strtoll(char *s, char **, int); 
11616 static int bad = 0;
11617 int check(char *s, long long ell, int een) {
11618         long long gll;
11619         errno = 0;
11620         gll = strtoll(s, 0, 10);
11621         if (!((gll == ell) && (errno == een)))
11622                 bad++;
11623 }
11624 int main() {
11625         check(" 1",                                      1LL, 0);
11626         check(" 0",                                      0LL, 0);
11627         check("-1",                                     -1LL, 0);
11628         check("-9223372036854775808", -9223372036854775808LL, 0);
11629         check("-9223372036854775808", -9223372036854775808LL, 0);
11630         check(" 9223372036854775807",  9223372036854775807LL, 0);
11631         check("-9223372036854775808", -9223372036854775808LL, 0);
11632         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
11633         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
11634         if (!bad)
11635                 printf("ok\n");
11636 }
11637 EOCP
11638         set try
11639         if eval $compile; then
11640                 case "`./try`" in
11641                 ok) echo "Your strtoll() seems to be working okay." ;;
11642                 *) cat <<EOM >&4
11643 Your strtoll() doesn't seem to be working okay.
11644 EOM
11645                    d_strtoll="$undef"
11646                    ;;
11647                 esac
11648         fi
11649         ;;
11650 esac
11651
11652 : see if strtoul exists
11653 set strtoul d_strtoul
11654 eval $inlibc
11655
11656 : see if strtoull exists
11657 set strtoull d_strtoull
11658 eval $inlibc
11659
11660 case "$d_longlong-$d_strtoull" in
11661 "$define-$define")
11662         $cat <<EOM
11663 Checking whether your strtoull() works okay...
11664 EOM
11665         $cat >try.c <<'EOCP'
11666 #include <errno.h>
11667 #ifdef __hpux
11668 #define strtoull __strtoull
11669 #endif
11670 #include <stdio.h>
11671 extern unsigned long long int strtoull(char *s, char **, int); 
11672 static int bad = 0;
11673 int check(char *s, long long eull, int een) {
11674         long long gull;
11675         errno = 0;
11676         gull = strtoull(s, 0, 10);
11677         if (!((gull == eull) && (errno == een)))
11678                 bad++;
11679 }
11680 int main() {
11681         check(" 1",                                       1LL, 0);
11682         check(" 0",                                       0LL, 0);
11683         check("18446744073709551615", 18446744073709551615ULL, 0);
11684         check("18446744073709551616", 18446744073709551615ULL, ERANGE);
11685         if (!bad)
11686                 printf("ok\n");
11687 }
11688 EOCP
11689         set try
11690         if eval $compile; then
11691                 case "`./try`" in
11692                 ok) echo "Your strtoull() seems to be working okay." ;;
11693                 *) cat <<EOM >&4
11694 Your strtoull() doesn't seem to be working okay.
11695 EOM
11696                    d_strtoull="$undef"
11697                    ;;
11698                 esac
11699         fi
11700         ;;
11701 esac
11702
11703 : see if strtouq exists
11704 set strtouq d_strtouq
11705 eval $inlibc
11706
11707 : see if strxfrm exists
11708 set strxfrm d_strxfrm
11709 eval $inlibc
11710
11711 : see if symlink exists
11712 set symlink d_symlink
11713 eval $inlibc
11714
11715 : see if syscall exists
11716 set syscall d_syscall
11717 eval $inlibc
11718
11719 : see if sysconf exists
11720 set sysconf d_sysconf
11721 eval $inlibc
11722
11723 : see if system exists
11724 set system d_system
11725 eval $inlibc
11726
11727 : see if tcgetpgrp exists
11728 set tcgetpgrp d_tcgetpgrp
11729 eval $inlibc
11730
11731 : see if tcsetpgrp exists
11732 set tcsetpgrp d_tcsetpgrp
11733 eval $inlibc
11734
11735 : see if prototype for telldir is available
11736 echo " "
11737 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
11738 eval $hasproto
11739
11740 : see if this is a sys/times.h system
11741 set sys/times.h i_systimes
11742 eval $inhdr
11743
11744 : see if times exists
11745 echo " "
11746 if set times val -f d_times; eval $csym; $val; then
11747         echo 'times() found.' >&4
11748         d_times="$define"
11749         inc=''
11750         case "$i_systimes" in
11751         "$define") inc='sys/times.h';;
11752         esac
11753         rp="What is the type returned by times() on this system?"
11754         set clock_t clocktype long stdio.h sys/types.h $inc
11755         eval $typedef_ask
11756 else
11757         echo 'times() NOT found, hope that will do.' >&4
11758         d_times="$undef"
11759         clocktype='int'
11760 fi
11761
11762 : see if truncate exists
11763 set truncate d_truncate
11764 eval $inlibc
11765
11766 : see if tzname[] exists
11767 echo " "
11768 if set tzname val -a d_tzname; eval $csym; $val; then
11769         val="$define"
11770         echo 'tzname[] found.' >&4
11771 else
11772         val="$undef"
11773         echo 'tzname[] NOT found.' >&4
11774 fi
11775 set d_tzname
11776 eval $setvar
11777
11778 : see if umask exists
11779 set umask d_umask
11780 eval $inlibc
11781
11782 : see if ustat exists
11783 set ustat d_ustat
11784 eval $inlibc
11785
11786 : backward compatibility for d_hvfork
11787 if test X$d_hvfork != X; then
11788         d_vfork="$d_hvfork"
11789         d_hvfork=''
11790 fi
11791 : see if there is a vfork
11792 val=''
11793 set vfork val
11794 eval $inlibc
11795
11796 : Ok, but do we want to use it. vfork is reportedly unreliable in 
11797 : perl on Solaris 2.x, and probably elsewhere.
11798 case "$val" in
11799 $define)
11800         echo " "
11801         case "$usevfork" in
11802         false) dflt='n';;
11803         *) dflt='y';;
11804         esac
11805         cat <<'EOM'
11806  
11807 Perl can only use a vfork() that doesn't suffer from strict
11808 restrictions on calling functions or modifying global data in
11809 the child.  For example, glibc-2.1 contains such a vfork()
11810 that is unsuitable.  If your system provides a proper fork()
11811 call, chances are that you do NOT want perl to use vfork().
11812
11813 EOM
11814         rp="Do you still want to use vfork()?"
11815         . ./myread
11816         case "$ans" in
11817         y|Y) ;;
11818         *)
11819                 echo "Ok, we won't use vfork()."
11820                 val="$undef"
11821                 ;;
11822         esac
11823         ;;
11824 esac
11825 set d_vfork
11826 eval $setvar
11827 case "$d_vfork" in
11828 $define) usevfork='true';;
11829 *) usevfork='false';;
11830 esac
11831
11832 : see if this is an sysdir system
11833 set sys/dir.h i_sysdir
11834 eval $inhdr
11835
11836 : see if this is an sysndir system
11837 set sys/ndir.h i_sysndir
11838 eval $inhdr
11839
11840 : see if closedir exists
11841 set closedir d_closedir
11842 eval $inlibc
11843
11844 case "$d_closedir" in
11845 "$define")
11846         echo " "
11847         echo "Checking whether closedir() returns a status..." >&4
11848         cat > closedir.c <<EOM
11849 #$i_dirent I_DIRENT             /**/
11850 #$i_sysdir I_SYS_DIR            /**/
11851 #$i_sysndir I_SYS_NDIR          /**/
11852 #$i_systypes I_SYS_TYPES        /**/
11853
11854 #if defined(I_SYS_TYPES)
11855 #include <sys/types.h>
11856 #endif
11857 #if defined(I_DIRENT)
11858 #include <dirent.h>
11859 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
11860 #include <sys/dir.h>
11861 #endif
11862 #else
11863 #ifdef I_SYS_NDIR
11864 #include <sys/ndir.h>
11865 #else
11866 #ifdef I_SYS_DIR
11867 #ifdef hp9000s500
11868 #include <ndir.h>       /* may be wrong in the future */
11869 #else
11870 #include <sys/dir.h>
11871 #endif
11872 #endif
11873 #endif
11874 #endif 
11875 int main() { return closedir(opendir(".")); }
11876 EOM
11877         set closedir
11878         if eval $compile_ok; then
11879                 if ./closedir > /dev/null 2>&1 ; then
11880                         echo "Yes, it does."
11881                         val="$undef"
11882                 else
11883                         echo "No, it doesn't."
11884                         val="$define"
11885                 fi
11886         else
11887                 echo "(I can't seem to compile the test program--assuming it doesn't)"
11888                 val="$define"
11889         fi
11890         ;;
11891 *)
11892         val="$undef";
11893         ;;
11894 esac
11895 set d_void_closedir
11896 eval $setvar
11897 $rm -f closedir*
11898 : check for volatile keyword
11899 echo " "
11900 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
11901 $cat >try.c <<'EOCP'
11902 int main()
11903 {
11904         typedef struct _goo_struct goo_struct;
11905         goo_struct * volatile goo = ((goo_struct *)0);
11906         struct _goo_struct {
11907                 long long_int;
11908                 int reg_int;
11909                 char char_var;
11910         };
11911         typedef unsigned short foo_t;
11912         char *volatile foo;
11913         volatile int bar;
11914         volatile foo_t blech;
11915         foo = foo;
11916 }
11917 EOCP
11918 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
11919         val="$define"
11920         echo "Yup, it does."
11921 else
11922         val="$undef"
11923         echo "Nope, it doesn't."
11924 fi
11925 set d_volatile
11926 eval $setvar
11927 $rm -f try.*
11928
11929 : see if there is a wait4
11930 set wait4 d_wait4
11931 eval $inlibc
11932
11933 : see if waitpid exists
11934 set waitpid d_waitpid
11935 eval $inlibc
11936
11937 : see if wcstombs exists
11938 set wcstombs d_wcstombs
11939 eval $inlibc
11940
11941 : see if wctomb exists
11942 set wctomb d_wctomb
11943 eval $inlibc
11944
11945 : preserve RCS keywords in files with variable substitution, grrr
11946 Date='$Date'
11947 Id='$Id'
11948 Log='$Log'
11949 RCSfile='$RCSfile'
11950 Revision='$Revision'
11951
11952 case "$crosscompile" in
11953 ''|[nN]*) crosscompile="$undef" ;;
11954 esac
11955
11956 case "$osname" in
11957 next|rhapsody|darwin) multiarch="$define" ;;
11958 esac
11959 case "$multiarch" in
11960 ''|[nN]*) multiarch="$undef" ;;
11961 esac
11962
11963 : check for alignment requirements
11964 echo " "
11965 case "$crosscompile$multiarch" in
11966 *$define*)
11967         $cat <<EOM
11968 You seem to be either cross-compiling or doing a multiarchitecture build,
11969 skipping the memory alignment check.
11970
11971 EOM
11972         case "$alignbytes" in
11973         '') alignbytes=8 ;;
11974         esac
11975         ;;
11976 *)
11977         case "$alignbytes" in
11978         '') echo "Checking alignment constraints..." >&4
11979                 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
11980                         $cat >try.c <<'EOCP'
11981 typedef long double NV;
11982 EOCP
11983                 else
11984                         $cat >try.c <<'EOCP'
11985 typedef double NV;
11986 EOCP
11987                 fi
11988                 $cat >>try.c <<'EOCP'
11989 #include <stdio.h>
11990 struct foobar {
11991         char foo;
11992         NV bar;
11993 } try_algn;
11994 int main()
11995 {
11996     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
11997     return(0);
11998 }
11999 EOCP
12000                 set try
12001                 if eval $compile_ok; then
12002                         dflt=`./try`
12003                 else
12004                         dflt='8'
12005                         echo "(I can't seem to compile the test program...)"
12006                 fi
12007                 ;;
12008         *) dflt="$alignbytes"
12009                 ;;
12010         esac
12011         rp="Doubles must be aligned on a how-many-byte boundary?"
12012         . ./myread
12013         alignbytes="$ans"
12014         $rm -f try.c try
12015         ;;
12016 esac
12017
12018
12019 : set the base revision
12020 baserev=5.0
12021
12022 : check for ordering of bytes in a long
12023 echo " "
12024 case "$crosscompile$multiarch" in
12025 *$define*)
12026         $cat <<EOM
12027 You seem to be either cross-compiling or doing a multiarchitecture build,
12028 skipping the byteorder check.
12029
12030 EOM
12031         byteorder='0xffff'
12032         ;;
12033 *)
12034         case "$byteorder" in
12035         '')
12036                 $cat <<'EOM'
12037 In the following, larger digits indicate more significance.  A big-endian
12038 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
12039 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
12040 machines may have weird orders like 3412.  A Cray will report 87654321,
12041 an Alpha will report 12345678. If the test program works the default is
12042 probably right.
12043 I'm now running the test program...
12044 EOM
12045                 $cat >try.c <<'EOCP'
12046 #include <stdio.h>
12047 int main()
12048 {
12049         int i;
12050         union {
12051                 unsigned long l;
12052                 char c[sizeof(long)];
12053         } u;
12054
12055         if (sizeof(long) > 4)
12056                 u.l = (0x08070605L << 32) | 0x04030201L;
12057         else
12058                 u.l = 0x04030201L;
12059         for (i = 0; i < sizeof(long); i++)
12060                 printf("%c", u.c[i]+'0');
12061         printf("\n");
12062         exit(0);
12063 }
12064 EOCP
12065                 xxx_prompt=y
12066                 set try
12067                 if eval $compile && ./try > /dev/null; then
12068                         dflt=`./try`
12069                         case "$dflt" in
12070                         [1-4][1-4][1-4][1-4]|12345678|87654321)
12071                                 echo "(The test program ran ok.)"
12072                                 echo "byteorder=$dflt"
12073                                 xxx_prompt=n
12074                         ;;
12075                         ????|????????) echo "(The test program ran ok.)" ;;
12076                         *) echo "(The test program didn't run right for some reason.)" ;;
12077                         esac
12078                 else
12079                         dflt='4321'
12080                         cat <<'EOM'
12081 (I can't seem to compile the test program.  Guessing big-endian...)
12082 EOM
12083                 fi
12084                 case "$xxx_prompt" in
12085                 y)
12086                         rp="What is the order of bytes in a long?"
12087                         . ./myread
12088                         byteorder="$ans"
12089                         ;;
12090                 *)      byteorder=$dflt
12091                         ;;
12092                 esac
12093                 ;;
12094         esac
12095         $rm -f try.c try
12096         ;;
12097 esac
12098
12099
12100 : how do we catenate cpp tokens here?
12101 echo " "
12102 echo "Checking to see how your cpp does stuff like catenate tokens..." >&4
12103 $cat >cpp_stuff.c <<'EOCP'
12104 #define RCAT(a,b)a/**/b
12105 #define ACAT(a,b)a ## b
12106 RCAT(Rei,ser)
12107 ACAT(Cir,cus)
12108 EOCP
12109 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
12110 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
12111         echo "Oh!  Smells like ANSI's been here." >&4
12112         echo "We can catify or stringify, separately or together!"
12113         cpp_stuff=42
12114 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
12115         echo "Ah, yes!  The good old days!" >&4
12116         echo "However, in the good old days we don't know how to stringify and"
12117         echo "catify at the same time."
12118         cpp_stuff=1
12119 else
12120         $cat >&4 <<EOM
12121 Hmm, I don't seem to be able to catenate tokens with your cpp.  You're going
12122 to have to edit the values of CAT[2-5] in config.h...
12123 EOM
12124         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
12125 fi
12126 $rm -f cpp_stuff.*
12127
12128 : see if this is a db.h system
12129 set db.h i_db
12130 eval $inhdr
12131
12132 case "$i_db" in
12133 $define)
12134         : Check db version.
12135         echo " "
12136         echo "Checking Berkeley DB version ..." >&4
12137         $cat >try.c <<EOCP
12138 #$d_const HASCONST
12139 #ifndef HASCONST
12140 #define const
12141 #endif
12142 #include <sys/types.h>
12143 #include <stdio.h>
12144 #include <db.h>
12145 int main()
12146 {
12147 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
12148     int Major, Minor, Patch ;
12149     unsigned long Version ;
12150     (void)db_version(&Major, &Minor, &Patch) ;
12151     printf("You have Berkeley DB Version 2 or greater\n");
12152
12153     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
12154                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
12155     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
12156                 Major, Minor, Patch) ;
12157
12158     /* check that db.h & libdb are compatible */
12159     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
12160         printf("db.h and libdb are incompatible\n") ;
12161         exit(3);        
12162     }
12163
12164     printf("db.h and libdb are compatible\n") ;
12165
12166     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
12167                 + DB_VERSION_PATCH ;
12168
12169     /* needs to be >= 2.3.4 */
12170     if (Version < 2003004) {
12171     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
12172         printf("but Perl needs Berkeley DB 2.3.4 or greater\n") ;
12173         exit(2);        
12174     }
12175
12176     exit(0);
12177 #else
12178 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
12179     printf("You have Berkeley DB Version 1\n");
12180     exit(0);    /* DB version < 2: the coast is clear. */
12181 #else
12182     exit(1);    /* <db.h> not Berkeley DB? */
12183 #endif
12184 #endif
12185 }
12186 EOCP
12187         set try
12188         if eval $compile_ok && ./try; then
12189                 echo 'Looks OK.' >&4
12190         else
12191                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
12192                 i_db=$undef
12193                 case " $libs " in
12194                 *"-ldb "*)
12195                         : Remove db from list of libraries to use
12196                         echo "Removing unusable -ldb from library list" >&4
12197                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
12198                         shift
12199                         libs="$*"
12200                         echo "libs = $libs" >&4
12201                         ;;
12202                 esac
12203         fi
12204         $rm -f try.*
12205         ;;
12206 esac
12207
12208 case "$i_db" in
12209 define)
12210         : Check the return type needed for hash 
12211         echo " "
12212         echo "Checking return type needed for hash for Berkeley DB ..." >&4
12213         $cat >try.c <<EOCP
12214 #$d_const HASCONST
12215 #ifndef HASCONST
12216 #define const
12217 #endif
12218 #include <sys/types.h>
12219 #include <db.h>
12220
12221 #ifndef DB_VERSION_MAJOR
12222 u_int32_t hash_cb (ptr, size)
12223 const void *ptr;
12224 size_t size;
12225 {
12226 }
12227 HASHINFO info;
12228 int main()
12229 {
12230         info.hash = hash_cb;
12231 }
12232 #endif
12233 EOCP
12234         if $cc $ccflags -c try.c >try.out 2>&1 ; then
12235                 if $contains warning try.out >>/dev/null 2>&1 ; then
12236                         db_hashtype='int'
12237                 else
12238                         db_hashtype='u_int32_t'
12239                 fi
12240         else
12241                 : XXX Maybe we should just give up here.
12242                 db_hashtype=u_int32_t
12243                 $cat try.out >&4
12244                 echo "Help:  I can't seem to compile the db test program." >&4
12245                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
12246         fi
12247         $rm -f try.*
12248         echo "Your version of Berkeley DB uses $db_hashtype for hash."
12249         ;;
12250 *)      db_hashtype=u_int32_t
12251         ;;
12252 esac
12253 case "$i_db" in
12254 define)
12255         : Check the return type needed for prefix 
12256         echo " "
12257         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
12258         cat >try.c <<EOCP
12259 #$d_const HASCONST
12260 #ifndef HASCONST
12261 #define const
12262 #endif
12263 #include <sys/types.h>
12264 #include <db.h>
12265
12266 #ifndef DB_VERSION_MAJOR
12267 size_t prefix_cb (key1, key2)
12268 const DBT *key1;
12269 const DBT *key2;
12270 {
12271 }
12272 BTREEINFO info;
12273 int main()
12274 {
12275         info.prefix = prefix_cb;
12276 }
12277 #endif
12278 EOCP
12279         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
12280                 if $contains warning try.out >>/dev/null 2>&1 ; then
12281                         db_prefixtype='int'
12282                 else
12283                         db_prefixtype='size_t'
12284                 fi
12285         else
12286                 db_prefixtype='size_t'
12287                 : XXX Maybe we should just give up here.
12288                 $cat try.out >&4
12289                 echo "Help:  I can't seem to compile the db test program." >&4
12290                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
12291         fi
12292         $rm -f try.*
12293         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
12294         ;;
12295 *)      db_prefixtype='size_t'
12296         ;;
12297 esac
12298
12299 : check for void type
12300 echo " "
12301 echo "Checking to see how well your C compiler groks the void type..." >&4
12302 case "$voidflags" in
12303 '')
12304         $cat >try.c <<'EOCP'
12305 #if TRY & 1
12306 void sub() {
12307 #else
12308 sub() {
12309 #endif
12310         extern void moo();      /* function returning void */
12311         void (*goo)();          /* ptr to func returning void */
12312 #if TRY & 8
12313         void *hue;              /* generic ptr */
12314 #endif
12315 #if TRY & 2
12316         void (*foo[10])();
12317 #endif
12318
12319 #if TRY & 4
12320         if(goo == moo) {
12321                 exit(0);
12322         }
12323 #endif
12324         exit(0);
12325 }
12326 int main() { sub(); }
12327 EOCP
12328         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
12329                 voidflags=$defvoidused
12330         echo "Good.  It appears to support void to the level $package wants.">&4
12331                 if $contains warning .out >/dev/null 2>&1; then
12332                         echo "However, you might get some warnings that look like this:"
12333                         $cat .out
12334                 fi
12335         else
12336 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
12337                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
12338                         echo "It supports 1..."
12339                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
12340                                 echo "It also supports 2..."
12341                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
12342                                         voidflags=7
12343                                         echo "And it supports 4 but not 8 definitely."
12344                                 else
12345                                         echo "It doesn't support 4..."
12346                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
12347                                                 voidflags=11
12348                                                 echo "But it supports 8."
12349                                         else
12350                                                 voidflags=3
12351                                                 echo "Neither does it support 8."
12352                                         fi
12353                                 fi
12354                         else
12355                                 echo "It does not support 2..."
12356                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
12357                                         voidflags=13
12358                                         echo "But it supports 4 and 8."
12359                                 else
12360                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
12361                                                 voidflags=5
12362                                                 echo "And it supports 4 but has not heard about 8."
12363                                         else
12364                                                 echo "However it supports 8 but not 4."
12365                                         fi
12366                                 fi
12367                         fi
12368                 else
12369                         echo "There is no support at all for void."
12370                         voidflags=0
12371                 fi
12372         fi
12373 esac
12374 case "$voidflags" in
12375 "$defvoidused") ;;
12376 *)      $cat >&4 <<'EOM'
12377   Support flag bits are:
12378     1: basic void declarations.
12379     2: arrays of pointers to functions returning void.
12380     4: operations between pointers to and addresses of void functions.
12381     8: generic void pointers.
12382 EOM
12383         dflt="$voidflags";
12384         rp="Your void support flags add up to what?"
12385         . ./myread
12386         voidflags="$ans"
12387         ;;
12388 esac
12389 $rm -f try.* .out
12390
12391
12392 : How can we generate normalized random numbers ?
12393 echo " "
12394 echo "Looking for a random number function..." >&4
12395 case "$randfunc" in
12396 '')
12397         if set drand48 val -f; eval $csym; $val; then
12398                 dflt="drand48"
12399                 echo "Good, found drand48()." >&4
12400         elif set random val -f; eval $csym; $val; then
12401                 dflt="random"
12402                 echo "OK, found random()." >&4
12403         else
12404                 dflt="rand"
12405                 echo "Yick, looks like I have to use rand()." >&4
12406         fi
12407         echo " "
12408         ;;
12409 *)
12410         dflt="$randfunc"
12411         ;;
12412 esac
12413 cont=true
12414
12415 case "$ccflags" in
12416 *-Dmy_rand=*|*-Dmy_srand=*)
12417         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
12418         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
12419         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
12420         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
12421         ;;
12422 esac
12423
12424 while $test "$cont"; do
12425         rp="Use which function to generate random numbers?"
12426         . ./myread
12427         if $test "$ans" = "$dflt"; then
12428                 : null
12429         else
12430                 randbits=''
12431         fi
12432         randfunc="$ans"
12433         if set $ans val -f; eval $csym; $val; then
12434                 cont=''
12435         else
12436                 dflt=y
12437                 rp="I cannot find function $ans. Use that name anyway?"
12438                 . ./myread
12439                 dflt=rand
12440                 case "$ans" in
12441                         [yY]*) cont='';;
12442                 esac
12443         fi
12444         case "$cont" in
12445         '')
12446                 case "$randfunc" in
12447                 drand48)
12448                         drand01="drand48()"
12449                         seedfunc="srand48"
12450                         randbits=48
12451                         randseedtype=long
12452                         ;;
12453                 rand|random)
12454                         case "$randbits" in
12455                         '')
12456 echo "Checking to see how many bits your $randfunc() function produces..." >&4
12457                                 $cat >try.c <<EOCP
12458 #$i_unistd I_UNISTD
12459 #$i_stdlib I_STDLIB
12460 #include <stdio.h>
12461 #ifdef I_UNISTD
12462 #  include <unistd.h>
12463 #endif
12464 #ifdef I_STDLIB
12465 #  include <stdlib.h>
12466 #endif
12467 int main()
12468 {
12469         register int i;
12470         register unsigned long tmp;
12471         register unsigned long max = 0L;
12472
12473         for (i = 1000; i; i--) {
12474                 tmp = (unsigned long) $randfunc();
12475                 if (tmp > max) max = tmp;
12476         }
12477         for (i = 0; max; i++)
12478                 max /= 2;
12479         printf("%d\n",i);
12480 }
12481 EOCP
12482                                 set try
12483                                 if eval $compile_ok; then
12484                                         dflt=`try`
12485                                 else
12486                                         dflt='?'
12487                                         echo "(I can't seem to compile the test program...)"
12488                                 fi
12489                                 ;;
12490                         *)
12491                                 dflt="$randbits"
12492                                 ;;
12493                         esac
12494                         rp="How many bits does your $randfunc() function produce?"
12495                         . ./myread
12496                         randbits="$ans"
12497                         $rm -f try.c try
12498                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
12499                         seedfunc="s$randfunc"
12500                         randseedtype=unsigned
12501                         ;;
12502                 *)
12503                         dflt="31"
12504                         rp="How many bits does your $randfunc() function produce?"
12505                         . ./myread
12506                         randbits="$ans"
12507                         seedfunc="s$randfunc"
12508                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
12509                         if set $seedfunc val -f; eval $csym; $val; then
12510                                 echo "(Using $seedfunc() to seed random generator)"
12511                         else
12512                                 echo "(Warning: no $seedfunc() to seed random generator)"
12513                                 seedfunc=rand
12514                         fi
12515                         randseedtype=unsigned
12516                         ;;
12517                 esac
12518                 ;;
12519         esac
12520 done
12521
12522 echo " "
12523 echo "Determining whether or not we are on an EBCDIC system..." >&4
12524 $cat >tebcdic.c <<'EOM'
12525 int main()
12526 {
12527   if ('M'==0xd4) return 0;
12528   return 1;
12529 }
12530 EOM
12531
12532 val=$undef
12533 set tebcdic
12534 if eval $compile_ok; then
12535         if ./tebcdic; then
12536                 echo "You seem to speak EBCDIC." >&4
12537                 val="$define"
12538         else
12539                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF8." >&4
12540         fi
12541 else
12542         echo "I'm unable to compile the test program." >&4
12543         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
12544 fi
12545 $rm -f tebcdic.c tebcdic
12546 set ebcdic
12547 eval $setvar
12548
12549 echo " "
12550 $cat >&4 <<EOM
12551 Checking how to flush all pending stdio output...
12552 EOM
12553 # I only know how to find the first 32 possibly open files on SunOS.
12554 # See also hints/sunos_4_1.sh and util.c  --AD
12555 case "$osname" in
12556 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
12557 esac
12558 $cat >>try.c <<EOCP
12559 #include <stdio.h>
12560 #$i_unistd I_UNISTD
12561 #ifdef I_UNISTD
12562 # include <unistd.h>
12563 #endif
12564 #$d_sysconf HAS_SYSCONF
12565 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
12566 #ifdef HAS_STDIO_STREAM_ARRAY
12567 # define STDIO_STREAM_ARRAY $stdio_stream_array
12568 #endif
12569 int main() {
12570   FILE* p = fopen("try.out", "w");
12571 #ifdef TRY_FPUTC
12572   fputc('x', p);
12573 #else
12574 # ifdef TRY_FPRINTF
12575   fprintf(p, "x");
12576 # endif
12577 #endif
12578 #ifdef TRY_FFLUSH_NULL
12579   fflush(NULL);
12580 #endif
12581 #ifdef TRY_FFLUSH_ALL
12582   {
12583     long open_max = -1;
12584 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
12585     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
12586 # else
12587 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
12588     open_max = sysconf(_SC_OPEN_MAX);
12589 #  else
12590 #   ifdef FOPEN_MAX
12591     open_max = FOPEN_MAX;
12592 #   else
12593 #    ifdef OPEN_MAX
12594     open_max = OPEN_MAX;
12595 #    else
12596 #     ifdef _NFILE
12597     open_max = _NFILE;
12598 #     endif
12599 #    endif
12600 #   endif
12601 #  endif
12602 # endif 
12603 # ifdef HAS_STDIO_STREAM_ARRAY
12604     if (open_max > 0) {
12605       long i;
12606       for (i = 0; i < open_max; i++)
12607             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
12608                 STDIO_STREAM_ARRAY[i]._file < open_max &&
12609                 STDIO_STREAM_ARRAY[i]._flag)
12610                 fflush(&STDIO_STREAM_ARRAY[i]);
12611     }   
12612   }
12613 # endif
12614 #endif
12615   _exit(42);
12616 }
12617 EOCP
12618 : first we have to find out how _not_ to flush
12619 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
12620     output=''
12621     set try -DTRY_FPUTC
12622     if eval $compile; then
12623             $rm -f try.out
12624             ./try$exe_ext 2>/dev/null
12625             if $test ! -s try.out -a "X$?" = X42; then
12626                 output=-DTRY_FPUTC
12627             fi
12628     fi
12629     case "$output" in
12630     '')
12631             set try -DTRY_FPRINTF
12632             $rm -f try.out
12633             if eval $compile; then
12634                     $rm -f try.out
12635                     ./try$exe_ext 2>/dev/null
12636                     if $test ! -s try.out -a "X$?" = X42; then
12637                         output=-DTRY_FPRINTF
12638                     fi
12639             fi
12640         ;;
12641     esac
12642 fi
12643 : check for fflush NULL behaviour
12644 case "$fflushNULL" in
12645 '')     set try -DTRY_FFLUSH_NULL $output
12646         if eval $compile; then
12647                 $rm -f try.out
12648                 ./try$exe_ext 2>/dev/null
12649                 code="$?"
12650                 if $test -s try.out -a "X$code" = X42; then
12651                         fflushNULL="`$cat try.out`"
12652                 else
12653                         if $test "X$code" != X42; then
12654                                 $cat >&4 <<EOM
12655 (If this test failed, don't worry, we'll try another method shortly.)
12656 EOM
12657                         fi
12658                 fi
12659         fi
12660         $rm -f core try.core core.try.*
12661         case "$fflushNULL" in
12662         x)      $cat >&4 <<EOM
12663 Your fflush(NULL) works okay for output streams.
12664 Let's see if it clobbers input pipes...
12665 EOM
12666 # As of mid-March 2000 all versions of Solaris appear to have a stdio
12667 # bug that improperly flushes the input end of pipes.  So we avoid the
12668 # autoflush on fork/system/exec support for now. :-(
12669 $cat >tryp.c <<EOCP
12670 #include <stdio.h>
12671 int
12672 main(int argc, char **argv)
12673 {
12674     char buf[1024];
12675     int i;
12676     char *bp = buf;
12677     while (1) {
12678         while ((i = getc(stdin)) != -1
12679                && (*bp++ = i) != '\n'
12680                && bp < &buf[1024])
12681         /* DO NOTHING */ ;
12682         *bp = '\0';
12683         fprintf(stdout, "%s", buf);
12684         fflush(NULL);
12685         if (i == -1)
12686             return 0;
12687         bp = buf;
12688     }
12689 }
12690 EOCP
12691                 fflushNULL="$define"
12692                 set tryp
12693                 if eval $compile; then
12694                     $rm -f tryp.out
12695                     $cat tryp.c | ./tryp$exe_ext 2>/dev/null > tryp.out
12696                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
12697                        $cat >&4 <<EOM
12698 fflush(NULL) seems to behave okay with input streams.
12699 EOM
12700                         fflushNULL="$define"
12701                     else
12702                         $cat >&4 <<EOM
12703 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
12704 EOM
12705                         fflushNULL="$undef"
12706                     fi
12707                 fi
12708                 $rm -f core tryp.c tryp.core core.tryp.*
12709                 ;;
12710         '')     $cat >&4 <<EOM
12711 Your fflush(NULL) isn't working (contrary to ANSI C).
12712 EOM
12713                 fflushNULL="$undef"
12714                 ;;
12715         *)      $cat >&4 <<EOM
12716 Cannot figure out whether your fflush(NULL) works or not.
12717 I'm assuming it doesn't (contrary to ANSI C).
12718 EOM
12719                 fflushNULL="$undef"
12720                 ;;
12721         esac
12722         ;;
12723 $define|true|[yY]*)
12724         fflushNULL="$define"
12725         ;;
12726 *)
12727         fflushNULL="$undef"
12728         ;;
12729 esac
12730 : check explicit looping only if NULL did not work, and if the pipe
12731 : bug does not show up on an explicit flush too
12732 case "$fflushNULL" in
12733 "$undef")
12734         $cat >tryp.c <<EOCP
12735 #include <stdio.h>
12736 int
12737 main(int argc, char **argv)
12738 {
12739     char buf[1024];
12740     int i;
12741     char *bp = buf;
12742     while (1) {
12743         while ((i = getc(stdin)) != -1
12744                && (*bp++ = i) != '\n'
12745                && bp < &buf[1024])
12746         /* DO NOTHING */ ;
12747         *bp = '\0';
12748         fprintf(stdout, "%s", buf);
12749         fflush(stdin);
12750         if (i == -1)
12751             return 0;
12752         bp = buf;
12753     }
12754 }
12755 EOCP
12756         set tryp
12757         if eval $compile; then
12758             $rm -f tryp.out
12759             $cat tryp.c | ./tryp$exe_ext 2>/dev/null > tryp.out
12760             if cmp tryp.c tryp.out >/dev/null 2>&1; then
12761                $cat >&4 <<EOM
12762 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
12763 EOM
12764                 : now check for fflushall behaviour
12765                 case "$fflushall" in
12766                 '')     set try -DTRY_FFLUSH_ALL $output
12767                         if eval $compile; then
12768                                 $cat >&4 <<EOM
12769 (Now testing the other method--but note that this also may fail.)
12770 EOM
12771                                 $rm -f try.out
12772                                 ./try$exe_ext 2>/dev/null
12773                                 if $test -s try.out -a "X$?" = X42; then
12774                                         fflushall="`$cat try.out`"
12775                                 fi
12776                         fi
12777                         $rm -f core try.core core.try.*
12778                         case "$fflushall" in
12779                         x)      $cat >&4 <<EOM
12780 Whew. Flushing explicitly all the stdio streams works.
12781 EOM
12782                                 fflushall="$define"
12783                                 ;;
12784                         '')     $cat >&4 <<EOM
12785 Sigh. Flushing explicitly all the stdio streams doesn't work.
12786 EOM
12787                                 fflushall="$undef"
12788                                 ;;
12789                         *)      $cat >&4 <<EOM
12790 Cannot figure out whether flushing stdio streams explicitly works or not.
12791 I'm assuming it doesn't.
12792 EOM
12793                                 fflushall="$undef"
12794                                 ;;
12795                         esac
12796                         ;;
12797                 "$define"|true|[yY]*)
12798                         fflushall="$define"
12799                         ;;
12800                 *)
12801                         fflushall="$undef"
12802                         ;;
12803                 esac
12804             else
12805                 $cat >&4 <<EOM
12806 All is futile.  Even fflush(stdin) clobbers input pipes!
12807 EOM
12808                 fflushall="$undef"
12809             fi
12810         else
12811             fflushall="$undef"
12812         fi
12813         $rm -f core tryp.c tryp.core core.tryp.*
12814         ;;
12815 *)      fflushall="$undef"
12816         ;;
12817 esac
12818
12819 case "$fflushNULL$fflushall" in
12820 undefundef)
12821         $cat <<EOM
12822 OK, I give up.  I cannot figure out how to flush pending stdio output.
12823 We won't be flushing handles at all before fork/exec/popen.
12824 EOM
12825         ;;
12826 esac
12827 $rm -f try.* try$exe_ext
12828
12829 : Store the full pathname to the ar program for use in the C program
12830 : Respect a hint or command line value for full_ar.
12831 case "$full_ar" in
12832 '') full_ar=$ar ;;
12833 esac
12834
12835 : Store the full pathname to the sed program for use in the C program
12836 full_sed=$sed
12837
12838 : see what type gids are declared as in the kernel
12839 echo " "
12840 echo "Looking for the type for group ids returned by getgid()."
12841 set gid_t gidtype xxx stdio.h sys/types.h
12842 eval $typedef
12843 case "$gidtype" in
12844 xxx)
12845         xxx=`./findhdr sys/user.h`
12846         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
12847         case $1 in
12848         unsigned) dflt="$1 $2" ;;
12849         *) dflt="$1" ;;
12850         esac
12851         ;;
12852 *) dflt="$gidtype";;
12853 esac
12854 case "$gidtype" in
12855 gid_t) echo "gid_t found." ;;
12856 *)      rp="What is the type for group ids returned by getgid()?"
12857         . ./myread
12858         gidtype="$ans"
12859         ;;
12860 esac
12861
12862 echo " "
12863 case "$gidtype" in
12864 *_t) zzz="$gidtype"     ;;
12865 *)   zzz="gid"          ;;
12866 esac
12867 echo "Checking the size of $zzz..." >&4 
12868 cat > try.c <<EOCP
12869 #include <sys/types.h>
12870 #include <stdio.h>
12871 int main() {
12872     printf("%d\n", (int)sizeof($gidtype));
12873     exit(0);
12874 }
12875 EOCP
12876 set try
12877 if eval $compile_ok; then
12878         yyy=`./try`
12879         case "$yyy" in
12880         '')     gidsize=4
12881                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
12882                 ;;
12883         *)      gidsize=$yyy
12884                 echo "Your $zzz is $gidsize bytes long."
12885                 ;;
12886         esac
12887 else
12888         gidsize=4
12889         echo "(I can't compile the test program--guessing $gidsize.)" >&4
12890 fi
12891
12892
12893 echo " "
12894 case "$gidtype" in
12895 *_t) zzz="$gidtype"     ;;
12896 *)   zzz="gid"          ;;
12897 esac
12898 echo "Checking the sign of $zzz..." >&4 
12899 cat > try.c <<EOCP
12900 #include <sys/types.h>
12901 #include <stdio.h>
12902 int main() {
12903         $gidtype foo = -1;
12904         if (foo < 0)
12905                 printf("-1\n");
12906         else
12907                 printf("1\n");
12908 }
12909 EOCP
12910 set try
12911 if eval $compile; then
12912         yyy=`./try`
12913         case "$yyy" in
12914         '')     gidsign=1
12915                 echo "(I can't execute the test program--guessing unsigned.)" >&4
12916                 ;;
12917         *)      gidsign=$yyy
12918                 case "$gidsign" in
12919                  1) echo "Your $zzz is unsigned." ;;
12920                 -1) echo "Your $zzz is signed."   ;;
12921                 esac
12922                 ;;
12923         esac
12924 else
12925         gidsign=1
12926         echo "(I can't compile the test program--guessing unsigned.)" >&4
12927 fi
12928
12929
12930 echo " "
12931
12932 if $test X"$quadtype" != X; then
12933
12934 echo "Checking how to print 64-bit integers..." >&4
12935
12936 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
12937         $cat >try.c <<'EOCP'
12938 #include <sys/types.h>
12939 #include <stdio.h>
12940 int main() {
12941   int q = 12345678901;
12942   printf("%ld\n", q);
12943 }
12944 EOCP
12945         set try
12946         if eval $compile; then
12947                 yyy=`./try$exe_ext`
12948                 case "$yyy" in
12949                 12345678901)
12950                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
12951                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
12952                         echo "We will use %d."
12953                         ;;
12954                 esac
12955         fi
12956 fi
12957
12958 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
12959         $cat >try.c <<'EOCP'
12960 #include <sys/types.h>
12961 #include <stdio.h>
12962 int main() {
12963   long q = 12345678901;
12964   printf("%ld\n", q);
12965 }
12966 EOCP
12967         set try
12968         if eval $compile; then
12969                 yyy=`./try$exe_ext`
12970                 case "$yyy" in
12971                 12345678901)
12972                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
12973                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
12974                         echo "We will use %ld."
12975                         ;;
12976                 esac
12977         fi
12978 fi
12979
12980 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
12981         $cat >try.c <<'EOCP'
12982 #include <sys/types.h>
12983 #include <inttypes.h>
12984 #include <stdio.h>
12985 int main() {
12986   int64_t q = 12345678901;
12987   printf("%" PRId64 "\n", q);
12988 }
12989 EOCP
12990         set try
12991         if eval $compile; then
12992                 yyy=`./try$exe_ext`
12993                 case "$yyy" in
12994                 12345678901)
12995                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
12996                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
12997                         echo "We will use the C9X style."
12998                         ;;
12999                 esac
13000         fi
13001 fi
13002
13003 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
13004         $cat >try.c <<'EOCP'
13005 #include <sys/types.h>
13006 #include <stdio.h>
13007 int main() {
13008   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
13009   printf("%lld\n", q);
13010 }
13011 EOCP
13012         set try
13013         if eval $compile; then
13014                 yyy=`./try$exe_ext`
13015                 case "$yyy" in
13016                 12345678901)
13017                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
13018                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
13019                         echo "We will use the %lld style."
13020                         ;;
13021                 esac
13022         fi
13023 fi
13024
13025 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
13026         $cat >try.c <<EOCP
13027 #include <sys/types.h>
13028 #include <stdio.h>
13029 int main() {
13030   $quadtype q = 12345678901;
13031   printf("%Ld\n", q);
13032 }
13033 EOCP
13034         set try
13035         if eval $compile; then
13036                 yyy=`./try$exe_ext`
13037                 case "$yyy" in
13038                 12345678901)
13039                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
13040                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
13041                         echo "We will use %Ld."
13042                         ;;
13043                 esac
13044         fi
13045 fi
13046
13047 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
13048         $cat >try.c <<EOCP
13049 #include <sys/types.h>
13050 #include <stdio.h>
13051 int main() {
13052   $quadtype q = 12345678901;
13053   printf("%qd\n", q);
13054 }
13055 EOCP
13056         set try
13057         if eval $compile; then
13058                 yyy=`./try$exe_ext`
13059                 case "$yyy" in
13060                 12345678901)
13061                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
13062                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
13063                         echo "We will use %qd."
13064                         ;;
13065                 esac
13066         fi
13067 fi
13068
13069 if $test X"$sPRId64" = X; then
13070         echo "Cannot figure out how to print 64-bit integers." >&4
13071 fi
13072
13073 $rm -f try try.*
13074
13075 fi
13076
13077 case "$sPRId64" in
13078 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef"; 
13079         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef"; 
13080         ;;
13081 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define"; 
13082         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define"; 
13083         ;;
13084 esac
13085
13086
13087 echo " "
13088 $echo "Checking the format strings to be used for Perl's internal types..." >&4
13089
13090 if $test X"$ivsize" = X8; then
13091         ivdformat="$sPRId64"
13092         uvuformat="$sPRIu64"
13093         uvoformat="$sPRIo64"
13094         uvxformat="$sPRIx64"
13095         uvXUformat="$sPRIXU64"
13096 else
13097         if $test X"$ivsize" = X"$longsize"; then
13098                 ivdformat='"ld"'
13099                 uvuformat='"lu"'
13100                 uvoformat='"lo"'
13101                 uvxformat='"lx"'
13102                 uvXUformat='"lX"'
13103         else
13104                 if $test X"$ivsize" = X"$intsize"; then
13105                         ivdformat='"d"'
13106                         uvuformat='"u"'
13107                         uvoformat='"o"'
13108                         uvxformat='"x"'
13109                         uvXUformat='"X"'
13110                 else
13111                         : far out
13112                         if $test X"$ivsize" = X"$shortsize"; then
13113                                 ivdformat='"hd"'
13114                                 uvuformat='"hu"'
13115                                 uvoformat='"ho"'
13116                                 uvxformat='"hx"'
13117                                 uvXUformat='"hX"'
13118                         fi
13119                 fi
13120         fi
13121 fi
13122
13123 if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
13124         nveformat="$sPRIeldbl"
13125         nvfformat="$sPRIfldbl"
13126         nvgformat="$sPRIgldbl"
13127         nvEUformat="$sPRIEUldbl"
13128         nvFUformat="$sPRIFUldbl"
13129         nvGUformat="$sPRIGUldbl"
13130 else
13131         nveformat='"e"'
13132         nvfformat='"f"'
13133         nvgformat='"g"'
13134         nvEUformat='"E"'
13135         nvFUformat='"F"'
13136         nvGUformat='"G"'
13137 fi
13138
13139 case "$ivdformat" in
13140 '') echo "$0: Fatal: failed to find format strings, cannot continue." >& 4
13141     exit 1
13142     ;;
13143 esac
13144
13145
13146 echo " "
13147 $echo "Checking the format string to be used for gids..." >&4
13148
13149 case "$gidsign" in
13150 -1)     if $test X"$gidsize" = X"$ivsize"; then
13151                 gidformat="$ivdformat"
13152         else
13153                 if $test X"$gidsize" = X"$longsize"; then
13154                         gidformat='"ld"'
13155                 else
13156                         if $test X"$gidsize" = X"$intsize"; then
13157                                 gidformat='"d"'
13158                         else
13159                                 if $test X"$gidsize" = X"$shortsize"; then
13160                                         gidformat='"hd"'
13161                                 fi
13162                         fi
13163                 fi
13164         fi
13165         ;;
13166 *)      if $test X"$gidsize" = X"$uvsize"; then
13167                 gidformat="$uvuformat"
13168         else
13169                 if $test X"$gidsize" = X"$longsize"; then
13170                         gidformat='"lu"'
13171                 else
13172                         if $test X"$gidsize" = X"$intsize"; then
13173                                 gidformat='"u"'
13174                         else
13175                                 if $test X"$gidsize" = X"$shortsize"; then
13176                                         gidformat='"hu"'
13177                                 fi
13178                         fi
13179                 fi
13180         fi
13181         ;;
13182 esac
13183
13184 : see if getgroups exists
13185 set getgroups d_getgrps
13186 eval $inlibc
13187
13188 : see if setgroups exists
13189 set setgroups d_setgrps
13190 eval $inlibc
13191
13192
13193 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
13194 echo " "
13195 case "$d_getgrps$d_setgrps" in
13196 *define*)
13197         case "$groupstype" in
13198         '') dflt="$gidtype" ;;
13199         *)  dflt="$groupstype" ;;
13200         esac
13201         $cat <<EOM
13202 What type of pointer is the second argument to getgroups() and setgroups()?
13203 Usually this is the same as group ids, $gidtype, but not always.
13204
13205 EOM
13206         rp='What type pointer is the second argument to getgroups() and setgroups()?'
13207         . ./myread
13208         groupstype="$ans"
13209         ;;
13210 *)  groupstype="$gidtype";;
13211 esac
13212
13213 echo " "
13214 echo "Checking if your $make program sets \$(MAKE)..." >&4
13215 case "$make_set_make" in
13216 '')
13217         $sed 's/^X //' > testmake.mak << 'EOF'
13218 Xall:
13219 X       @echo 'maketemp="$(MAKE)"'
13220 EOF
13221         case "`$make -f testmake.mak 2>/dev/null`" in
13222         *maketemp=*) make_set_make='#' ;;
13223         *)      make_set_make="MAKE=$make" ;;
13224         esac
13225         $rm -f testmake.mak
13226         ;;
13227 esac
13228 case "$make_set_make" in
13229 '#') echo "Yup, it does.";;
13230 *) echo "Nope, it doesn't.";;
13231 esac
13232
13233 : see what type is used for mode_t
13234 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
13235 set mode_t modetype int stdio.h sys/types.h
13236 eval $typedef_ask
13237
13238 : define a fucntion to check prototypes
13239 $cat > protochk <<EOSH
13240 $startsh
13241 cc="$cc"
13242 optimize="$optimize"
13243 ccflags="$ccflags"
13244 prototype="$prototype"
13245 define="$define"
13246 rm=$rm
13247 EOSH
13248
13249 $cat >> protochk <<'EOSH'
13250
13251 $rm -f try.c
13252 foo="$1"
13253 shift
13254 while test $# -ge 2; do
13255         case "$1" in
13256                 $define) echo "#include <$2>" >> try.c ;;
13257                 literal) echo "$2" >> try.c ;;
13258         esac
13259     shift 2
13260 done
13261 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
13262 cat >> try.c <<'EOCP'
13263 #ifdef CAN_PROTOTYPE
13264 #define _(args) args
13265 #else
13266 #define _(args) ()
13267 #endif
13268 EOCP
13269 echo "$foo" >> try.c
13270 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
13271 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
13272 status=$?
13273 $rm -f try.[co]
13274 exit $status
13275 EOSH
13276 chmod +x protochk
13277 $eunicefix protochk
13278
13279 : see what type is used for size_t
13280 rp="What is the type used for the length parameter for string functions?"
13281 set size_t sizetype 'unsigned int' stdio.h sys/types.h
13282 eval $typedef_ask
13283
13284 : check for type of arguments to gethostbyaddr. 
13285 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
13286         case "$d_gethbyaddr" in
13287         $define)
13288                 $cat <<EOM
13289
13290 Checking to see what type of arguments are accepted by gethostbyaddr().
13291 EOM
13292                 hdrs="$define sys/types.h
13293                         $d_socket sys/socket.h 
13294                         $i_niin netinet/in.h 
13295                         $i_netdb netdb.h
13296                         $i_unistd unistd.h"
13297                 : The first arg can 'char *' or 'void *'
13298                 : The second arg is some of integral type
13299                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
13300                         for yyy in size_t long int; do
13301                                 case "$netdb_host_type" in
13302                                 '')     try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
13303                                         if ./protochk "$try" $hdrs; then
13304                                                 echo "Your system accepts $xxx for the first arg."
13305                                                 echo "...and $yyy for the second arg."
13306                                                 netdb_host_type="$xxx"
13307                                                 netdb_hlen_type="$yyy"
13308                                         fi
13309                                         ;;
13310                                 esac
13311                         done
13312                 done
13313                 : In case none of those worked, prompt the user.
13314                 case "$netdb_host_type" in
13315                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
13316                         dflt='char *'
13317                         . ./myread
13318                         netdb_host_type=$ans
13319                         rp='What is the type for the 2nd argument to gethostbyaddr?'
13320                         dflt="$sizetype"
13321                         . ./myread
13322                         netdb_hlen_type=$ans
13323                         ;;
13324                 esac
13325                 ;;
13326         *)      : no gethostbyaddr, so pick harmless defaults
13327                 netdb_host_type='char *'
13328                 netdb_hlen_type="$sizetype"
13329                 ;;
13330         esac
13331         # Remove the "const" if needed. -- but then we'll have a 
13332         # prototype clash!
13333         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
13334 fi
13335
13336 : check for type of argument to gethostbyname. 
13337 if test "X$netdb_name_type" = X ; then
13338         case "$d_gethbyname" in
13339         $define)
13340                 $cat <<EOM
13341
13342 Checking to see what type of argument is accepted by gethostbyname().
13343 EOM
13344                 hdrs="$define sys/types.h
13345                         $d_socket sys/socket.h 
13346                         $i_niin netinet/in.h 
13347                         $i_netdb netdb.h
13348                         $i_unistd unistd.h"
13349                 for xxx in "const char *" "char *"; do
13350                         case "$netdb_name_type" in
13351                         '')     try="extern struct hostent *gethostbyname($xxx);"
13352                                 if ./protochk "$try" $hdrs; then
13353                                         echo "Your system accepts $xxx."
13354                                         netdb_name_type="$xxx"
13355                                 fi
13356                                 ;;
13357                         esac
13358                 done
13359                 : In case none of those worked, prompt the user.
13360                 case "$netdb_name_type" in
13361                 '')     rp='What is the type for the 1st argument to gethostbyname?'
13362                         dflt='char *'
13363                         . ./myread
13364                         netdb_name_type=$ans
13365                         ;;
13366                 esac
13367                 ;;
13368         *)      : no gethostbyname, so pick harmless default
13369                 netdb_name_type='char *'
13370                 ;;
13371         esac
13372 fi
13373
13374 : check for type of 1st argument to getnetbyaddr. 
13375 if test "X$netdb_net_type" = X ; then
13376         case "$d_getnbyaddr" in
13377         $define)
13378                 $cat <<EOM
13379
13380 Checking to see what type of 1st argument is accepted by getnetbyaddr().
13381 EOM
13382                 hdrs="$define sys/types.h
13383                         $d_socket sys/socket.h 
13384                         $i_niin netinet/in.h 
13385                         $i_netdb netdb.h
13386                         $i_unistd unistd.h"
13387                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
13388                         case "$netdb_net_type" in
13389                         '')     try="extern struct netent *getnetbyaddr($xxx, int);"
13390                                 if ./protochk "$try" $hdrs; then
13391                                         echo "Your system accepts $xxx."
13392                                         netdb_net_type="$xxx"
13393                                 fi
13394                                 ;;
13395                         esac
13396                 done
13397                 : In case none of those worked, prompt the user.
13398                 case "$netdb_net_type" in
13399                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
13400                         dflt='long'
13401                         . ./myread
13402                         netdb_net_type=$ans
13403                         ;;
13404                 esac
13405                 ;;
13406         *)      : no getnetbyaddr, so pick harmless default
13407                 netdb_net_type='long'
13408                 ;;
13409         esac
13410 fi
13411 : locate the preferred pager for this system
13412 case "$pager" in
13413 '')
13414         dflt=''
13415         case "$pg" in
13416         /*) dflt=$pg;;
13417         [a-zA-Z]:/*) dflt=$pg;;
13418         esac
13419         case "$more" in
13420         /*) dflt=$more;;
13421         [a-zA-Z]:/*) dflt=$more;;
13422         esac
13423         case "$less" in
13424         /*) dflt=$less;;
13425         [a-zA-Z]:/*) dflt=$less;;
13426         esac
13427         case "$dflt" in
13428         '') dflt=/usr/ucb/more;;
13429         esac
13430         ;;
13431 *) dflt="$pager";;
13432 esac
13433 echo " "
13434 fn=f/
13435 rp='What pager is used on your system?'
13436 . ./getfile
13437 pager="$ans"
13438
13439 : see what type pids are declared as in the kernel
13440 rp="What is the type of process ids on this system?"
13441 set pid_t pidtype int stdio.h sys/types.h
13442 eval $typedef_ask
13443
13444 : Find earliest binary compatible site_perl subdirectory perl can use.
13445 case "$bincompat5005" in
13446 "$define") xs_apiversion='5.005' ;;
13447 *) xs_apiversion=$version ;;   # The current site_perl version.
13448 esac
13449 : Find earliest pure perl site_perl subdirectory perl can use.
13450 : The versioned directories started at 5.005.
13451 pm_apiversion='5.005'
13452
13453 : check for length of pointer
13454 echo " "
13455 case "$ptrsize" in
13456 '')
13457         echo "Checking to see how big your pointers are..." >&4
13458         if test "$voidflags" -gt 7; then
13459                 echo '#define VOID_PTR char *' > try.c
13460         else
13461                 echo '#define VOID_PTR void *' > try.c
13462         fi
13463         $cat >>try.c <<'EOCP'
13464 #include <stdio.h>
13465 int main()
13466 {
13467     printf("%d\n", (int)sizeof(VOID_PTR));
13468     exit(0);
13469 }
13470 EOCP
13471         set try
13472         if eval $compile_ok; then
13473                 ptrsize=`./try`
13474                 echo "Your pointers are $ptrsize bytes long."
13475         else
13476                 dflt='4'
13477                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
13478                 rp="What is the size of a pointer (in bytes)?"
13479                 . ./myread
13480                 ptrsize="$ans"
13481         fi
13482         ;;
13483 esac
13484 $rm -f try.c try
13485
13486 : see if ar generates random libraries by itself
13487 echo " "
13488 echo "Checking how to generate random libraries on your machine..." >&4
13489 echo 'int bar1() { return bar2(); }' > bar1.c
13490 echo 'int bar2() { return 2; }' > bar2.c
13491 $cat > foo.c <<'EOP'
13492 int main() { printf("%d\n", bar1()); exit(0); }
13493 EOP
13494 $cc $ccflags -c bar1.c >/dev/null 2>&1
13495 $cc $ccflags -c bar2.c >/dev/null 2>&1
13496 $cc $ccflags -c foo.c >/dev/null 2>&1
13497 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
13498 if $cc $ccflags $ldflags -o foobar foo$_o bar$_a $libs > /dev/null 2>&1 &&
13499         ./foobar >/dev/null 2>&1; then
13500         echo "$ar appears to generate random libraries itself."
13501         orderlib=false
13502         ranlib=":"
13503 elif $ar ts bar$_a >/dev/null 2>&1 &&
13504         $cc $ccflags $ldflags -o foobar foo$_o bar$_a $libs > /dev/null 2>&1 &&
13505         ./foobar >/dev/null 2>&1; then
13506                 echo "a table of contents needs to be added with '$ar ts'."
13507                 orderlib=false
13508                 ranlib="$ar ts"
13509 else
13510         case "$ranlib" in
13511         :) ranlib='';;
13512         '')
13513                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
13514                 $test -f $ranlib || ranlib=''
13515                 ;;
13516         esac
13517         if $test -n "$ranlib"; then
13518                 echo "your system has '$ranlib'; we'll use that."
13519                 orderlib=false
13520         else
13521                 echo "your system doesn't seem to support random libraries"
13522                 echo "so we'll use lorder and tsort to order the libraries."
13523                 orderlib=true
13524                 ranlib=":"
13525         fi
13526 fi
13527 $rm -f foo* bar* 
13528
13529 : check for type of arguments to select. 
13530 case "$selecttype" in
13531 '') case "$d_select" in
13532         $define)
13533                 echo " "
13534                 $cat <<EOM
13535 Checking to see what type of arguments are accepted by select().
13536 EOM
13537                 hdrs="$define sys/types.h
13538                         $i_systime sys/time.h 
13539                         $i_sysselct sys/select.h
13540                         $d_socket sys/socket.h"
13541                 : The first arg can be int, unsigned, or size_t
13542                 : The last arg may or may not be 'const'
13543                 val=''
13544                 : void pointer has been seen but using that
13545                 : breaks the selectminbits test
13546                 for xxx in 'fd_set *' 'int *'; do
13547                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
13548                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
13549                                         case "$val" in
13550                                         '')     try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
13551                                                 if ./protochk "$try" $hdrs; then
13552                                                         echo "Your system accepts $xxx."
13553                                                         val="$xxx"
13554                                                 fi
13555                                                 ;;
13556                                         esac
13557                                 done
13558                         done
13559                 done
13560                 case "$val" in
13561                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
13562                         case "$d_fd_set" in
13563                                 $define) dflt="fd_set *" ;;
13564                                 *)              dflt="int *" ;;
13565                         esac
13566                         . ./myread
13567                         val=$ans
13568                         ;;
13569                 esac
13570                 selecttype="$val"
13571                 ;;
13572         *)      : no select, so pick a harmless default
13573                 selecttype='int *'
13574                 ;;
13575         esac
13576         ;;
13577 esac
13578
13579 : check for the select 'width'
13580 case "$selectminbits" in
13581 '') case "$d_select" in
13582         $define)
13583                 $cat <<EOM
13584
13585 Checking to see on how many bits at a time your select() operates...
13586 EOM
13587                 $cat >try.c <<EOCP
13588 #include <sys/types.h>
13589 #$i_time I_TIME
13590 #$i_systime I_SYS_TIME
13591 #$i_systimek I_SYS_TIME_KERNEL
13592 #ifdef I_TIME
13593 #   include <time.h>
13594 #endif
13595 #ifdef I_SYS_TIME
13596 #   ifdef I_SYS_TIME_KERNEL
13597 #       define KERNEL
13598 #   endif
13599 #   include <sys/time.h>
13600 #   ifdef I_SYS_TIME_KERNEL
13601 #       undef KERNEL
13602 #   endif
13603 #endif
13604 #$i_sysselct I_SYS_SELECT
13605 #ifdef I_SYS_SELECT
13606 #include <sys/select.h>
13607 #endif
13608 #$d_socket HAS_SOCKET
13609 #ifdef HAS_SOCKET
13610 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
13611 #endif
13612 #include <stdio.h>
13613 $selecttype b;
13614 #define S sizeof(*(b))
13615 #define MINBITS 64
13616 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
13617 #define NBITS  (NBYTES * 8)
13618 int main() {
13619     char s[NBYTES];
13620     struct timeval t;
13621     int i;
13622     FILE* fp;
13623     int fd;
13624
13625     fclose(stdin);
13626     fp = fopen("try.c", "r");
13627     if (fp == 0)
13628       exit(1);
13629     fd = fileno(fp);
13630     if (fd < 0)
13631       exit(2);
13632     b = ($selecttype)s;
13633     for (i = 0; i < NBITS; i++)
13634         FD_SET(i, b);
13635     t.tv_sec  = 0;
13636     t.tv_usec = 0;
13637     select(fd + 1, b, 0, 0, &t);
13638     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
13639     printf("%d\n", i + 1);
13640     return 0;
13641 }
13642 EOCP
13643                 set try
13644                 if eval $compile_ok; then
13645                         selectminbits=`./try`
13646                         case "$selectminbits" in
13647                         '')     cat >&4 <<EOM
13648 Cannot figure out on how many bits at a time your select() operates.
13649 I'll play safe and guess it is 32 bits.
13650 EOM
13651                                 selectminbits=32
13652                                 bits="32 bits"
13653                                 ;;
13654                         1)      bits="1 bit" ;;
13655                         *)      bits="$selectminbits bits" ;;
13656                         esac
13657                         echo "Your select() operates on $bits at a time." >&4
13658                 else
13659                         rp='What is the minimum number of bits your select() operates on?'
13660                         case "$byteorder" in
13661                         1234|12345678)  dflt=32 ;;
13662                         *)              dflt=1  ;;
13663                         esac
13664                         . ./myread
13665                         val=$ans
13666                         selectminbits="$val"
13667                 fi
13668                 $rm -f try.* try
13669                 ;;
13670         *)      : no select, so pick a harmless default
13671                 selectminbits='32'
13672                 ;;
13673         esac
13674         ;;
13675 esac
13676
13677 : Trace out the files included by signal.h, then look for SIGxxx names.
13678 : Remove SIGARRAYSIZE used by HPUX.
13679 : Remove SIGSTKSIZE used by Linux.
13680 : Remove SIGSTKSZ used by Posix.
13681 : Remove SIGTYP void lines used by OS2.
13682 : Some cpps, like os390, dont give the file name anywhere
13683 if [ "X$fieldn" = X ]; then
13684         : Just make some guesses.  We check them later.
13685         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
13686 else
13687         xxx=`echo '#include <signal.h>' |
13688         $cppstdin $cppminus $cppflags 2>/dev/null |
13689         $grep '^[       ]*#.*include' | 
13690         $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sort | $uniq`
13691 fi
13692 : Check this list of files to be sure we have parsed the cpp output ok.
13693 : This will also avoid potentially non-existent files, such 
13694 : as ../foo/bar.h
13695 xxxfiles=''
13696 for xx in $xxx /dev/null ; do
13697         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
13698 done
13699 : If we have found no files, at least try signal.h
13700 case "$xxxfiles" in
13701 '')     xxxfiles=`./findhdr signal.h` ;;
13702 esac
13703 xxx=`awk '
13704 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
13705         print substr($2, 4, 20)
13706 }
13707 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
13708         print substr($3, 4, 20)
13709 }' $xxxfiles`
13710 : Append some common names just in case the awk scan failed.
13711 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
13712 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
13713 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
13714 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
13715 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
13716
13717 : generate a few handy files for later
13718 $cat > signal.c <<'EOCP'
13719 #include <sys/types.h>
13720 #include <signal.h>
13721 #include <stdio.h>
13722 int main() {
13723
13724 /* Strange style to avoid deeply-nested #if/#else/#endif */
13725 #ifndef NSIG
13726 #  ifdef _NSIG
13727 #    define NSIG (_NSIG)
13728 #  endif
13729 #endif
13730
13731 #ifndef NSIG
13732 #  ifdef SIGMAX
13733 #    define NSIG (SIGMAX+1)
13734 #  endif
13735 #endif
13736
13737 #ifndef NSIG
13738 #  ifdef SIG_MAX
13739 #    define NSIG (SIG_MAX+1)
13740 #  endif
13741 #endif
13742
13743 #ifndef NSIG
13744 #  ifdef MAXSIG
13745 #    define NSIG (MAXSIG+1)
13746 #  endif
13747 #endif
13748
13749 #ifndef NSIG
13750 #  ifdef MAX_SIG
13751 #    define NSIG (MAX_SIG+1)
13752 #  endif
13753 #endif
13754
13755 #ifndef NSIG
13756 #  ifdef SIGARRAYSIZE
13757 #    define NSIG (SIGARRAYSIZE+1) /* Not sure of the +1 */
13758 #  endif
13759 #endif
13760
13761 #ifndef NSIG
13762 #  ifdef _sys_nsig
13763 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
13764 #  endif
13765 #endif
13766
13767 /* Default to some arbitrary number that's big enough to get most
13768    of the common signals.
13769 */
13770 #ifndef NSIG
13771 #    define NSIG 50
13772 #endif
13773
13774 printf("NSIG %d\n", NSIG);
13775
13776 #ifndef JUST_NSIG
13777
13778 EOCP
13779
13780 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
13781 {
13782         printf "#ifdef SIG"; printf $1; printf "\n"
13783         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
13784         printf $1; printf ");\n"
13785         printf "#endif\n"
13786 }
13787 END {
13788         printf "#endif /* JUST_NSIG */\n";
13789         printf "exit(0);\n}\n";
13790 }
13791 ' >>signal.c
13792 $cat >signal.awk <<'EOP'
13793 BEGIN { ndups = 0 }
13794 $1 ~ /^NSIG$/ { nsig = $2 }
13795 ($1 !~ /^NSIG$/) && (NF == 2) {
13796     if ($2 > maxsig) { maxsig = $2 }
13797     if (sig_name[$2]) {
13798         dup_name[ndups] = $1
13799         dup_num[ndups] = $2
13800         ndups++ 
13801     }
13802     else {
13803         sig_name[$2] = $1
13804         sig_num[$2] = $2
13805     }
13806 }
13807 END { 
13808     if (nsig == 0) {
13809         nsig = maxsig + 1
13810     }
13811     printf("NSIG %d\n", nsig);
13812     for (n = 1; n < nsig; n++) {
13813         if (sig_name[n]) {
13814             printf("%s %d\n", sig_name[n], sig_num[n])
13815         }
13816         else {
13817             printf("NUM%d %d\n", n, n) 
13818         }
13819     }
13820     for (n = 0; n < ndups; n++) {
13821         printf("%s %d\n", dup_name[n], dup_num[n])
13822     }
13823 }
13824 EOP
13825 $cat >signal_cmd <<EOS
13826 $startsh
13827 if $test -s signal.lst; then
13828     echo "Using your existing signal.lst file"
13829         exit 0
13830 fi
13831 xxx="$xxx"
13832 EOS
13833 $cat >>signal_cmd <<'EOS'
13834
13835 set signal
13836 if eval $compile_ok; then
13837         ./signal$_exe | $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
13838 else
13839         echo "(I can't seem be able to compile the whole test program)" >&4
13840         echo "(I'll try it in little pieces.)" >&4
13841         set signal -DJUST_NSIG
13842         if eval $compile_ok; then
13843                 ./signal$_exe > signal.nsg
13844                 $cat signal.nsg
13845         else
13846                 echo "I can't seem to figure out how many signals you have." >&4
13847                 echo "Guessing 50." >&4
13848                 echo 'NSIG 50' > signal.nsg
13849         fi
13850         : Now look at all the signal names, one at a time.
13851         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
13852                 $cat > signal.c <<EOCP
13853 #include <sys/types.h>
13854 #include <signal.h>
13855 #include <stdio.h>
13856 int main() {
13857 printf("$xx %d\n", SIG${xx});
13858 return 0;
13859 }
13860 EOCP
13861                 set signal
13862                 if eval $compile; then
13863                         echo "SIG${xx} found."
13864                         ./signal$_exe  >> signal.ls1
13865                 else
13866                         echo "SIG${xx} NOT found."
13867                 fi
13868         done
13869         if $test -s signal.ls1; then
13870                 $cat signal.nsg signal.ls1 |
13871                         $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
13872         fi
13873
13874 fi
13875 if $test -s signal.lst; then
13876         :
13877 else
13878         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
13879         echo 'kill -l' >signal
13880         set X `csh -f <signal`
13881         $rm -f signal
13882         shift
13883         case $# in
13884         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
13885         esac
13886         echo $@ | $tr ' ' $trnl | \
13887             $awk '{ printf "%s %d\n", $1, ++s; }
13888                   END { printf "NSIG %d\n", ++s }' >signal.lst
13889 fi
13890 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
13891 EOS
13892 chmod a+x signal_cmd
13893 $eunicefix signal_cmd
13894
13895 : generate list of signal names
13896 echo " "
13897 case "$sig_name_init" in
13898 '') doinit=yes ;;
13899 *)  case "$sig_num_init" in
13900     ''|*,*) doinit=yes ;;
13901     esac ;;
13902 esac
13903 case "$doinit" in
13904 yes)
13905         echo "Generating a list of signal names and numbers..." >&4
13906         . ./signal_cmd
13907         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
13908         sig_name=`$awk 'BEGIN { printf "ZERO " }
13909                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
13910         sig_num=`$awk  'BEGIN { printf "0 " }
13911                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
13912         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
13913                              !/^NSIG/   { printf "\"%s\", ", $1 }
13914                              END        { printf "0\n" }' signal.lst`
13915         sig_num_init=`$awk  'BEGIN      { printf "0, " }
13916                              !/^NSIG/   { printf "%d, ", $2}
13917                              END        { printf "0\n"}' signal.lst`
13918         ;;
13919 esac
13920 echo "The following $sig_count signals are available:"
13921 echo " "
13922 echo $sig_name | $awk \
13923 'BEGIN { linelen = 0 }
13924 {
13925         for (i = 1; i <= NF; i++) {
13926                 name = "SIG" $i " "
13927                 linelen = linelen + length(name)
13928                 if (linelen > 70) {
13929                         printf "\n"
13930                         linelen = length(name)
13931                 }
13932                 printf "%s", name
13933         }
13934         printf "\n"
13935 }'
13936 $rm -f signal signal.c signal.awk signal.lst signal_cmd 
13937
13938 echo " "
13939 case "$sizetype" in
13940 *_t) zzz="$sizetype"    ;;
13941 *)   zzz="filesize"     ;;
13942 esac
13943 echo "Checking the size of $zzz..." >&4 
13944 cat > try.c <<EOCP
13945 #include <sys/types.h>
13946 #include <stdio.h>
13947 int main() {
13948     printf("%d\n", (int)sizeof($sizetype));
13949     exit(0);
13950 }
13951 EOCP
13952 set try
13953 if eval $compile_ok; then
13954         yyy=`./try`
13955         case "$yyy" in
13956         '')     sizesize=4
13957                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
13958                 ;;
13959         *)      sizesize=$yyy
13960                 echo "Your $zzz size is $sizesize bytes."
13961                 ;;
13962         esac
13963 else
13964         sizesize=4
13965         echo "(I can't compile the test program--guessing $sizesize.)" >&4
13966 fi
13967
13968
13969 : check for socklen_t
13970 echo " "
13971 echo "Checking to see if you have socklen_t..." >&4
13972 $cat >try.c <<EOCP
13973 #include <sys/types.h>
13974 #$d_socket HAS_SOCKET
13975 #ifdef HAS_SOCKET
13976 #include <sys/socket.h>
13977 #endif
13978 int main() { socklen_t x = 16; }
13979 EOCP
13980 set try
13981 if eval $compile; then
13982         val="$define"
13983         echo "You have socklen_t."
13984 else
13985         val="$undef"
13986         echo "You do not have socklen_t."
13987         case "$sizetype" in
13988         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
13989         esac
13990 fi
13991 $rm -f try try.*
13992 set d_socklen_t
13993 eval $setvar
13994
13995 : check for type of the size argument to socket calls
13996 case "$d_socket" in
13997 "$define")
13998         $cat <<EOM
13999
14000 Checking to see what type is the last argument of accept().
14001 EOM
14002         hdrs="$define sys/types.h $d_socket sys/socket.h" 
14003         yyy=''
14004         case "$d_socklen_t" in
14005         "$define") yyy="$yyy socklen_t"
14006         esac
14007         yyy="$yyy $sizetype int long unsigned"
14008         for xxx in $yyy; do
14009                 case "$socksizetype" in
14010                 '')     try="extern int accept(int, struct sockaddr *, $xxx *);"
14011                         if ./protochk "$try" $hdrs; then
14012                                 echo "Your system accepts '$xxx *' for the last argument of accept()."
14013                                 socksizetype="$xxx"
14014                         fi
14015                         ;;
14016                 esac
14017         done
14018 : In case none of those worked, prompt the user.
14019         case "$socksizetype" in
14020         '')     rp='What is the type for socket address structure sizes?'
14021                 dflt='int'
14022                 . ./myread
14023                 socksizetype=$ans
14024                 ;;
14025         esac
14026         ;;
14027 *)      : no sockets, so pick relatively harmless default
14028         socksizetype='int'
14029         ;;
14030 esac
14031
14032 : see what type is used for signed size_t
14033 set ssize_t ssizetype int stdio.h sys/types.h
14034 eval $typedef
14035 dflt="$ssizetype"
14036 $cat > ssize.c <<EOM
14037 #include <stdio.h>
14038 #include <sys/types.h>
14039 #define Size_t $sizetype
14040 #define SSize_t $dflt
14041 int main()
14042 {
14043         if (sizeof(Size_t) == sizeof(SSize_t))
14044                 printf("$dflt\n");
14045         else if (sizeof(Size_t) == sizeof(int))
14046                 printf("int\n");
14047         else 
14048                 printf("long\n");
14049         exit(0);
14050 }
14051 EOM
14052 echo " "
14053 set ssize
14054 if eval $compile_ok && ./ssize > /dev/null; then
14055         ssizetype=`./ssize`
14056         echo "I'll be using $ssizetype for functions returning a byte count." >&4
14057 else
14058         $cat >&4 <<EOM
14059 Help! I can't compile and run the ssize_t test program: please enlighten me!
14060 (This is probably a misconfiguration in your system or libraries, and
14061 you really ought to fix it.  Still, I'll try anyway.)
14062
14063 I need a type that is the same size as $sizetype, but is guaranteed to
14064 be signed.  Common values are ssize_t, int and long.
14065
14066 EOM
14067         rp="What signed type is the same size as $sizetype?"
14068         . ./myread
14069         ssizetype="$ans"
14070 fi
14071 $rm -f ssize ssize.*
14072
14073 : see what type of char stdio uses.
14074 echo " "
14075 if $contains 'unsigned.*char.*_ptr;' `./findhdr stdio.h` >/dev/null 2>&1 ; then
14076         echo "Your stdio uses unsigned chars." >&4
14077         stdchar="unsigned char"
14078 else
14079         echo "Your stdio uses signed chars." >&4
14080         stdchar="char"
14081 fi
14082
14083 : see if time exists
14084 echo " "
14085 if test "X$d_time" = X -o X"$timetype" = X; then
14086     if set time val -f d_time; eval $csym; $val; then
14087                 echo 'time() found.' >&4
14088                 val="$define"
14089                 rp="What is the type returned by time() on this system?"
14090                 set time_t timetype long stdio.h sys/types.h
14091                 eval $typedef_ask
14092     else
14093                 echo 'time() not found, hope that will do.' >&4
14094                 val="$undef"
14095                 timetype='int';
14096     fi
14097     set d_time
14098     eval $setvar
14099 fi
14100
14101 : see what type uids are declared as in the kernel
14102 echo " "
14103 echo "Looking for the type for user ids returned by getuid()."
14104 set uid_t uidtype xxx stdio.h sys/types.h
14105 eval $typedef
14106 case "$uidtype" in
14107 xxx)
14108         xxx=`./findhdr sys/user.h`
14109         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
14110         case $1 in
14111         unsigned) dflt="$1 $2" ;;
14112         *) dflt="$1" ;;
14113         esac
14114         ;;
14115 *) dflt="$uidtype";;
14116 esac
14117 case "$uidtype" in
14118 uid_t)  echo "uid_t found." ;;
14119 *)      rp="What is the type for user ids returned by getuid()?"
14120         . ./myread
14121         uidtype="$ans"
14122         ;;
14123 esac
14124
14125 echo " "
14126 case "$uidtype" in
14127 *_t) zzz="$uidtype"     ;;
14128 *)   zzz="uid"          ;;
14129 esac
14130 echo "Checking the size of $zzz..." >&4 
14131 cat > try.c <<EOCP
14132 #include <sys/types.h>
14133 #include <stdio.h>
14134 int main() {
14135     printf("%d\n", (int)sizeof($uidtype));
14136     exit(0);
14137 }
14138 EOCP
14139 set try
14140 if eval $compile_ok; then
14141         yyy=`./try`
14142         case "$yyy" in
14143         '')     uidsize=4
14144                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
14145                 ;;
14146         *)      uidsize=$yyy
14147                 echo "Your $zzz is $uidsize bytes long."
14148                 ;;
14149         esac
14150 else
14151         uidsize=4
14152         echo "(I can't compile the test program--guessing $uidsize.)" >&4
14153 fi
14154
14155 echo " "
14156 case "$uidtype" in
14157 *_t) zzz="$uidtype"     ;;
14158 *)   zzz="uid"          ;;
14159 esac
14160 echo "Checking the sign of $zzz..." >&4
14161 cat > try.c <<EOCP
14162 #include <sys/types.h>
14163 #include <stdio.h>
14164 int main() {
14165         $uidtype foo = -1;
14166         if (foo < 0)
14167                 printf("-1\n");
14168         else
14169                 printf("1\n");
14170 }
14171 EOCP
14172 set try
14173 if eval $compile; then
14174         yyy=`./try`
14175         case "$yyy" in
14176         '')     uidsign=1
14177                 echo "(I can't execute the test program--guessing unsigned.)" >&4
14178                 ;;
14179         *)      uidsign=$yyy
14180                 case "$uidsign" in
14181                  1) echo "Your $zzz is unsigned." ;;
14182                 -1) echo "Your $zzz is signed."   ;;
14183                 esac
14184                 ;;
14185         esac
14186 else
14187         uidsign=1
14188         echo "(I can't compile the test program--guessing unsigned.)" >&4
14189 fi
14190
14191
14192
14193 echo " "
14194 $echo "Checking the format string to be used for uids..." >&4
14195
14196 case "$uidsign" in
14197 -1)     if $test X"$uidsize" = X"$ivsize"; then
14198                 uidformat="$ivdformat"
14199         else
14200                 if $test X"$uidsize" = X"$longsize"; then
14201                         uidformat='"ld"'
14202                 else
14203                         if $test X"$uidsize" = X"$intsize"; then
14204                                 uidformat='"d"'
14205                         else
14206                                 if $test X"$uidsize" = X"$shortsize"; then
14207                                         uidformat='"hd"'
14208                                 fi
14209                         fi
14210                 fi
14211         fi
14212         ;;
14213 *)      if $test X"$uidsize" = X"$uvsize"; then
14214                 uidformat="$uvuformat"
14215         else
14216                 if $test X"$uidsize" = X"$longsize"; then
14217                         uidformat='"lu"'
14218                 else
14219                         if $test X"$uidsize" = X"$intsize"; then
14220                                 uidformat='"u"'
14221                         else
14222                                 if $test X"$uidsize" = X"$shortsize"; then
14223                                         uidformat='"hu"'
14224                                 fi
14225                         fi
14226                 fi
14227         fi
14228         ;;
14229 esac
14230
14231 : see if dbm.h is available
14232 : see if dbmclose exists
14233 set dbmclose d_dbmclose
14234 eval $inlibc
14235
14236 case "$d_dbmclose" in
14237 $define)
14238         set dbm.h i_dbm
14239         eval $inhdr
14240         case "$i_dbm" in
14241         $define)
14242                 val="$undef"
14243                 set i_rpcsvcdbm
14244                 eval $setvar
14245                 ;;
14246         *)      set rpcsvc/dbm.h i_rpcsvcdbm
14247                 eval $inhdr
14248                 ;;
14249         esac
14250         ;;
14251 *)      echo "We won't be including <dbm.h>"
14252         val="$undef"
14253         set i_dbm
14254         eval $setvar
14255         val="$undef"
14256         set i_rpcsvcdbm
14257         eval $setvar
14258         ;;
14259 esac
14260
14261 : see if this is a sys/file.h system
14262 val=''
14263 set sys/file.h val
14264 eval $inhdr
14265
14266 : do we need to include sys/file.h ?
14267 case "$val" in
14268 "$define")
14269         echo " "
14270         if $h_sysfile; then
14271                 val="$define"
14272                 echo "We'll be including <sys/file.h>." >&4
14273         else
14274                 val="$undef"
14275                 echo "We won't be including <sys/file.h>." >&4
14276         fi
14277         ;;
14278 *)
14279         h_sysfile=false
14280         ;;
14281 esac
14282 set i_sysfile
14283 eval $setvar
14284
14285 : see if fcntl.h is there
14286 val=''
14287 set fcntl.h val
14288 eval $inhdr
14289
14290 : see if we can include fcntl.h
14291 case "$val" in
14292 "$define")
14293         echo " "
14294         if $h_fcntl; then
14295                 val="$define"
14296                 echo "We'll be including <fcntl.h>." >&4
14297         else
14298                 val="$undef"
14299                 if $h_sysfile; then
14300         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
14301                 else
14302                         echo "We won't be including <fcntl.h>." >&4
14303                 fi
14304         fi
14305         ;;
14306 *)
14307         h_fcntl=false
14308         val="$undef"
14309         ;;
14310 esac
14311 set i_fcntl
14312 eval $setvar
14313
14314 : see if this is a iconv.h system
14315 set iconv.h i_iconv
14316 eval $inhdr
14317
14318 : see if this is a ieeefp.h system
14319 set ieeefp.h i_ieeefp
14320 eval $inhdr
14321
14322 : see if this is a libutil.h system
14323 set libutil.h i_libutil
14324 eval $inhdr
14325
14326 : see if locale.h is available
14327 set locale.h i_locale
14328 eval $inhdr
14329
14330 : see if mach cthreads are available
14331 if test "X$usethreads" = "X$define"; then
14332         set mach/cthreads.h i_machcthr
14333         eval $inhdr
14334 else
14335         i_machcthr="$undef"
14336 fi
14337
14338
14339
14340 : see if this is a math.h system
14341 set math.h i_math
14342 eval $inhdr
14343
14344 : see if this is a mntent.h system
14345 set mntent.h i_mntent
14346 eval $inhdr
14347
14348 : see if ndbm.h is available
14349 set ndbm.h t_ndbm
14350 eval $inhdr
14351 case "$t_ndbm" in
14352 $define)
14353         : see if dbm_open exists
14354         set dbm_open d_dbm_open
14355         eval $inlibc
14356         case "$d_dbm_open" in
14357         $undef)
14358                 t_ndbm="$undef"
14359                 echo "We won't be including <ndbm.h>"
14360                 ;;
14361         esac
14362         ;;
14363 esac
14364 val="$t_ndbm"
14365 set i_ndbm
14366 eval $setvar
14367
14368 : see if net/errno.h is available
14369 val=''
14370 set net/errno.h val
14371 eval $inhdr
14372
14373 : Unfortunately, it causes problems on some systems.  Arrgh.
14374 case "$val" in
14375 $define)
14376         cat > try.c <<'EOM'
14377 #include <stdio.h>
14378 #include <errno.h>
14379 #include <net/errno.h>
14380 int func()
14381 {
14382         return ENOTSOCK;
14383 }
14384 EOM
14385         if $cc $ccflags -c try.c >/dev/null 2>&1; then
14386                 echo "We'll be including <net/errno.h>." >&4
14387         else
14388                 echo "We won't be including <net/errno.h>." >&4
14389                 val="$undef"
14390         fi
14391         $rm -f try.* try
14392         ;;
14393 esac
14394 set i_neterrno
14395 eval $setvar
14396
14397 : see if netinet/tcp.h is available
14398 set netinet/tcp.h i_netinettcp
14399 eval $inhdr
14400
14401 : see if this is a poll.h system
14402 set poll.h i_poll
14403 eval $inhdr
14404
14405 : see if this is a prot.h system
14406 set prot.h i_prot
14407 eval $inhdr
14408
14409 echo " "
14410 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4 
14411 $cat <<'EOSH' > Cppsym.know
14412 a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
14413 AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
14414 alliant alpha am29000 AM29000 amiga AMIGAOS AMIX
14415 ansi ANSI_C_SOURCE apollo ardent atarist att386 att3b BeOS
14416 BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
14417 BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
14418 bull c cadmus clipper CMU COFF COMPILER_VERSION
14419 concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
14420 CYGWIN DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
14421 Dynix DynixPTX ELF encore EPI EXTENSIONS FILE_OFFSET_BITS
14422 FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
14423 GNU_SOURCE GNUC GNUC_MINOR GO32 gould GOULD_PN
14424 H3050R H3050RX hbullx20 hcx host_mips
14425 hp200 hp300 hp700 HP700 hp800 hp9000
14426 hp9000s200 hp9000s300 hp9000s400 hp9000s500
14427 hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
14428 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
14429 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
14430 INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
14431 LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
14432 LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
14433 Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
14434 LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
14435 M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
14436 M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
14437 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
14438 MATH_HAS_NO_SIDE_EFFECTS
14439 mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
14440 mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
14441 mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
14442 MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
14443 mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
14444 NetBSD news1500 news1700 news1800 news1900 news3700
14445 news700 news800 news900 NeXT NLS ns16000 ns32000
14446 ns32016 ns32332 ns32k nsc32000
14447 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
14448 pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
14449 pc532 pdp11 PGC PIC plexus PORTAR posix
14450 POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
14451 POSIX_C_SOURCE POSIX_SOURCE POWER
14452 PROTOTYPES PWB pyr QNX R3000 REENTRANT RES Rhapsody RISC6000
14453 riscix riscos RT scs SCO sequent sgi SGI_SOURCE sinix
14454 SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
14455 sony sony_news sonyrisc sparc sparclite spectrum
14456 stardent stdc STDC_EXT stratos sun sun3 sun386
14457 Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
14458 SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
14459 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
14460 sysV68 sysV88 Tek4132 Tek4300 titan
14461 tower tower32 tower32_200 tower32_600 tower32_700
14462 tower32_800 tower32_850 tss
14463 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
14464 ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
14465 unix UNIX95 UNIX99 unixpc unos USGr4 USGr4_2
14466 Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms xenix Xenix286
14467 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
14468 XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
14469 z8000
14470 EOSH
14471 # Maybe put other stuff here too.
14472 cat <<EOSH >>Cppsym.know
14473 $osname
14474 EOSH
14475 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
14476 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
14477 $cat Cppsym.know > Cppsym.c
14478 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | sort | uniq > Cppsym.know
14479 $rm -f Cppsym.a Cppsym.b Cppsym.c
14480 cat <<EOSH > Cppsym
14481 $startsh
14482 if $test \$# -gt 0; then
14483     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
14484     if $test -s Cppsym.got; then
14485         $rm -f Cppsym.got
14486         exit 0
14487     fi
14488     $rm -f Cppsym.got
14489     exit 1
14490 else
14491     $tr " " "$trnl" | ./Cppsym.try
14492     exit 0
14493 fi
14494 EOSH
14495 chmod +x Cppsym
14496 $eunicefix Cppsym
14497 cat <<EOSH > Cppsym.try
14498 $startsh
14499 cat <<'EOCP' > try.c
14500 #include <stdio.h>
14501 int main() {
14502 EOCP
14503 $awk \\
14504 EOSH
14505 cat <<'EOSH' >> Cppsym.try
14506 'length($1) > 0 {
14507     printf "#ifdef %s\n#if %s+0\nprintf(\"%s=%%ld\\n\", %s);\n#else\nprintf(\"%s\\n\");\n#endif\n#endif\n", $1, $1, $1, $1, $1
14508     printf "#ifdef _%s\n#if _%s+0\nprintf(\"_%s=%%ld\\n\", _%s);\n#else\nprintf(\"_%s\\n\");\n#endif\n#endif\n", $1, $1, $1, $1, $1
14509     printf "#ifdef __%s\n#if __%s+0\nprintf(\"__%s=%%ld\\n\", __%s);\n#else\nprintf(\"__%s\\n\");\n#endif\n#endif\n", $1, $1, $1, $1, $1
14510     printf "#ifdef __%s__\n#if __%s__+0\nprintf(\"__%s__=%%ld\\n\", __%s__);\n#else\nprintf(\"__%s__\\n\");\n#endif\n#endif\n", $1, $1, $1, $1, $1
14511 }'       >> try.c
14512 echo '}' >> try.c
14513 EOSH
14514 cat <<EOSH >> Cppsym.try
14515 ccflags="$ccflags"
14516 case "$osname-$gccversion" in
14517 irix-) ccflags="\$ccflags -woff 1178" ;;
14518 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
14519 esac
14520 $cc $optimize \$ccflags $ldflags -o try try.c $libs && ./try$exe_ext
14521 EOSH
14522 chmod +x Cppsym.try
14523 $eunicefix Cppsym.try
14524 ./Cppsym < Cppsym.know > Cppsym.true
14525 : now check the C compiler for additional symbols
14526 postprocess_cc_v=''
14527 case "$osname" in
14528 aix) postprocess_cc_v="|$tr , ' '" ;;
14529 esac
14530 $cat >ccsym <<EOS
14531 $startsh
14532 $cat >tmp.c <<EOF
14533 extern int foo;
14534 EOF
14535 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
14536 do
14537         case "\$i" in
14538         -D*) echo "\$i" | $sed 's/^-D//';;
14539         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A\(.*\)(\(.*\))/\1=\2/';;
14540         esac
14541 done
14542 $rm -f try.c
14543 EOS
14544 postprocess_cc_v=''
14545 chmod +x ccsym
14546 $eunicefix ccsym
14547 ./ccsym > ccsym1.raw
14548 if $test -s ccsym1.raw; then
14549        $sort ccsym1.raw | $uniq >ccsym.raw
14550 else
14551        mv ccsym1.raw ccsym.raw
14552 fi
14553
14554 $awk '/\=/ { print $0; next }
14555         { print $0"=1" }' ccsym.raw >ccsym.list
14556 $awk '/\=/ { print $0; next }
14557         { print $0"=1" }' Cppsym.true >ccsym.true
14558 $comm -13 ccsym.true ccsym.list >ccsym.own
14559 $comm -12 ccsym.true ccsym.list >ccsym.com
14560 $comm -23 ccsym.true ccsym.list >ccsym.cpp
14561 also=''
14562 if $test -z ccsym.raw; then
14563         echo "Your C compiler doesn't seem to define any symbols!" >&4
14564         echo " "
14565         echo "However, your C preprocessor defines the following symbols:"
14566         $cat Cppsym.true
14567         ccsymbols=''
14568         cppsymbols=`$cat Cppsym.true`
14569         cppsymbols=`echo $cppsymbols`
14570         cppccsymbols="$cppsymbols"
14571 else
14572         if $test -s ccsym.com; then
14573                 echo "Your C compiler and pre-processor define these symbols:"
14574                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
14575                 also='also '
14576                 symbols='ones'
14577                 cppccsymbols=`$cat ccsym.com`
14578                 cppccsymbols=`echo $cppccsymbols`
14579                 $test "$silent" || sleep 1
14580         fi
14581         if $test -s ccsym.cpp; then
14582                 $test "$also" && echo " "
14583                 echo "Your C pre-processor ${also}defines the following symbols:"
14584                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
14585                 also='further '
14586                 cppsymbols=`$cat ccsym.cpp`
14587                 cppsymbols=`echo $cppsymbols`
14588                 $test "$silent" || sleep 1
14589         fi
14590         if $test -s ccsym.own; then
14591                 $test "$also" && echo " "
14592                 echo "Your C compiler ${also}defines the following cpp symbols:"
14593                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
14594                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
14595                 ccsymbols=`$cat ccsym.own`
14596                 ccsymbols=`echo $ccsymbols`
14597                 $test "$silent" || sleep 1
14598         fi
14599 fi
14600 $rm -f ccsym* Cppsym.*
14601
14602 : see if this is a termio system
14603 val="$undef"
14604 val2="$undef"
14605 val3="$undef"
14606 if $test `./findhdr termios.h`; then
14607         set tcsetattr i_termios
14608         eval $inlibc
14609         val3="$i_termios"
14610 fi
14611 echo " "
14612 case "$val3" in
14613 "$define") echo "You have POSIX termios.h... good!" >&4;;
14614 *) if ./Cppsym pyr; then
14615                 case "`/bin/universe`" in
14616                 ucb) if $test `./findhdr sgtty.h`; then
14617                                 val2="$define"
14618                                 echo "<sgtty.h> found." >&4
14619                         else
14620                                 echo "System is pyramid with BSD universe."
14621                                 echo "<sgtty.h> not found--you could have problems." >&4
14622                         fi;;
14623                 *) if $test `./findhdr termio.h`; then
14624                                 val="$define"
14625                                 echo "<termio.h> found." >&4
14626                         else
14627                                 echo "System is pyramid with USG universe."
14628                                 echo "<termio.h> not found--you could have problems." >&4
14629                         fi;;
14630                 esac
14631         elif ./usg; then
14632                 if $test `./findhdr termio.h`; then
14633                         echo "<termio.h> found." >&4
14634                         val="$define"
14635                 elif $test `./findhdr sgtty.h`; then
14636                         echo "<sgtty.h> found." >&4
14637                         val2="$define"
14638                 else
14639 echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
14640                 fi
14641         else
14642                 if $test `./findhdr sgtty.h`; then
14643                         echo "<sgtty.h> found." >&4
14644                         val2="$define"
14645                 elif $test `./findhdr termio.h`; then
14646                         echo "<termio.h> found." >&4
14647                         val="$define"
14648                 else
14649 echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
14650                 fi
14651         fi;;
14652 esac
14653 set i_termio; eval $setvar
14654 val=$val2; set i_sgtty; eval $setvar
14655 val=$val3; set i_termios; eval $setvar
14656
14657 : see if this is a shadow.h system
14658 set shadow.h i_shadow
14659 eval $inhdr
14660
14661 : see if this is a socks.h system
14662 set socks.h i_socks
14663 eval $inhdr
14664
14665 : see if stdarg is available
14666 echo " "
14667 if $test `./findhdr stdarg.h`; then
14668         echo "<stdarg.h> found." >&4
14669         valstd="$define"
14670 else
14671         echo "<stdarg.h> NOT found." >&4
14672         valstd="$undef"
14673 fi
14674
14675 : see if varags is available
14676 echo " "
14677 if $test `./findhdr varargs.h`; then
14678         echo "<varargs.h> found." >&4
14679 else
14680         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
14681 fi
14682
14683 : set up the varargs testing programs
14684 $cat > varargs.c <<EOP
14685 #ifdef I_STDARG
14686 #include <stdarg.h>
14687 #endif
14688 #ifdef I_VARARGS
14689 #include <varargs.h>
14690 #endif
14691
14692 #ifdef I_STDARG
14693 int f(char *p, ...)
14694 #else
14695 int f(va_alist)
14696 va_dcl
14697 #endif
14698 {
14699         va_list ap;
14700 #ifndef I_STDARG
14701         char *p;
14702 #endif
14703 #ifdef I_STDARG
14704         va_start(ap,p);
14705 #else
14706         va_start(ap);
14707         p = va_arg(ap, char *);
14708 #endif
14709         va_end(ap);
14710 }
14711 EOP
14712 $cat > varargs <<EOP
14713 $startsh
14714 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
14715         echo "true"
14716 else
14717         echo "false"
14718 fi
14719 $rm -f varargs$_o
14720 EOP
14721 chmod +x varargs
14722
14723 : now check which varargs header should be included
14724 echo " "
14725 i_varhdr=''
14726 case "$valstd" in
14727 "$define")
14728         if `./varargs I_STDARG`; then
14729                 val='stdarg.h'
14730         elif `./varargs I_VARARGS`; then
14731                 val='varargs.h'
14732         fi
14733         ;;
14734 *)
14735         if `./varargs I_VARARGS`; then
14736                 val='varargs.h'
14737         fi
14738         ;;
14739 esac
14740 case "$val" in
14741 '')
14742 echo "I could not find the definition for va_dcl... You have problems..." >&4
14743         val="$undef"; set i_stdarg; eval $setvar
14744         val="$undef"; set i_varargs; eval $setvar
14745         ;;
14746 *) 
14747         set i_varhdr
14748         eval $setvar
14749         case "$i_varhdr" in
14750         stdarg.h)
14751                 val="$define"; set i_stdarg; eval $setvar
14752                 val="$undef"; set i_varargs; eval $setvar
14753                 ;;
14754         varargs.h)
14755                 val="$undef"; set i_stdarg; eval $setvar
14756                 val="$define"; set i_varargs; eval $setvar
14757                 ;;
14758         esac
14759         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
14760 esac
14761 $rm -f varargs*
14762
14763 : see if stddef is available
14764 set stddef.h i_stddef
14765 eval $inhdr
14766
14767 : see if this is a sunmath.h system
14768 set sunmath.h i_sunmath
14769 eval $inhdr
14770
14771 : see if sys/access.h is available
14772 set sys/access.h i_sysaccess
14773 eval $inhdr
14774
14775 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
14776 set sys/filio.h i_sysfilio
14777 eval $inhdr
14778 echo " "
14779 if $test `./findhdr sys/ioctl.h`; then
14780         val="$define"
14781         echo '<sys/ioctl.h> found.' >&4
14782 else
14783         val="$undef"
14784         if $test $i_sysfilio = "$define"; then
14785             echo '<sys/ioctl.h> NOT found.' >&4
14786         else
14787                 $test $i_sgtty = "$define" && xxx="sgtty.h"
14788                 $test $i_termio = "$define" && xxx="termio.h"
14789                 $test $i_termios = "$define" && xxx="termios.h"
14790 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
14791         fi
14792 fi
14793 set i_sysioctl
14794 eval $setvar
14795
14796
14797 : see if this is a syslog.h system
14798 set syslog.h i_syslog
14799 eval $inhdr
14800
14801
14802 : see if this is a sys/mode.h system
14803 set sys/mode.h i_sysmode
14804 eval $inhdr
14805
14806 : see if sys/resource.h has to be included
14807 set sys/resource.h i_sysresrc
14808 eval $inhdr
14809
14810 : see if sys/security.h is available
14811 set sys/security.h i_syssecrt
14812 eval $inhdr
14813
14814 : see if this is a sys/statvfs.h system
14815 set sys/statvfs.h i_sysstatvfs
14816 eval $inhdr
14817
14818 : see if this is a sys/uio.h system
14819 set sys/uio.h i_sysuio
14820 eval $inhdr
14821
14822 : see if this is a sys/un.h system
14823 set sys/un.h i_sysun
14824 eval $inhdr
14825
14826
14827 : see if this is a sys/utsname.h system
14828 set sys/utsname.h i_sysutsname
14829 eval $inhdr
14830
14831 : see if this is a syswait system
14832 set sys/wait.h i_syswait
14833 eval $inhdr
14834
14835 : see if this is a ustat.h system
14836 set ustat.h i_ustat
14837 eval $inhdr
14838
14839 : see if this is an utime system
14840 set utime.h i_utime
14841 eval $inhdr
14842
14843 : see if this is a values.h system
14844 set values.h i_values
14845 eval $inhdr
14846
14847 : see if this is a vfork system
14848 case "$d_vfork" in
14849 "$define")
14850         set vfork.h i_vfork
14851         eval $inhdr
14852         ;;
14853 *)
14854         i_vfork="$undef"
14855         ;;
14856 esac
14857
14858 : see if gdbm.h is available
14859 set gdbm.h t_gdbm
14860 eval $inhdr
14861 case "$t_gdbm" in
14862 $define)
14863         : see if gdbm_open exists
14864         set gdbm_open d_gdbm_open
14865         eval $inlibc
14866         case "$d_gdbm_open" in
14867         $undef)
14868                 t_gdbm="$undef"
14869                 echo "We won't be including <gdbm.h>"
14870                 ;;
14871         esac
14872         ;;
14873 esac
14874 val="$t_gdbm"
14875 set i_gdbm
14876 eval $setvar
14877
14878 echo " "
14879 echo "Looking for extensions..." >&4
14880 : If we are using the old config.sh, known_extensions may contain
14881 : old or inaccurate or duplicate values.
14882 known_extensions=''
14883 nonxs_extensions=''
14884 : We do not use find because it might not be available.
14885 : We do not just use MANIFEST because the user may have dropped
14886 : some additional extensions into the source tree and expect them
14887 : to be built.
14888
14889 : Function to recursively find available extensions, ignoring DynaLoader
14890 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
14891 find_extensions='
14892     for xxx in *; do
14893        case "$xxx" in
14894            DynaLoader|dynaload) ;;
14895            *)
14896            if $test -f $xxx/$xxx.xs; then
14897                known_extensions="$known_extensions $1$xxx";
14898            elif $test -f $xxx/Makefile.PL; then
14899                nonxs_extensions="$nonxs_extensions $1$xxx";
14900            else
14901                if $test -d $xxx -a $# -lt 10; then
14902                    set $1$xxx/ $*;
14903                    cd $xxx;
14904                    eval $find_extensions;
14905                    cd ..;
14906                    shift;
14907                fi;
14908            fi
14909            ;;
14910        esac;
14911     done'
14912 tdir=`pwd`
14913 cd $rsrc/ext
14914 set X
14915 shift
14916 eval $find_extensions
14917 set X $nonxs_extensions
14918 shift
14919 nonxs_extensions="$*"
14920 set X $known_extensions
14921 shift
14922 known_extensions="$*"
14923 cd $tdir
14924
14925 : Now see which are supported on this system.
14926 avail_ext=''
14927 for xxx in $known_extensions ; do
14928         case "$xxx" in
14929         DB_File|db_file)
14930                 case "$i_db" in
14931                 $define) avail_ext="$avail_ext $xxx" ;;
14932                 esac
14933                 ;;
14934         GDBM_File|gdbm_fil)
14935                 case "$i_gdbm" in 
14936                 $define) avail_ext="$avail_ext $xxx" ;;
14937                 esac
14938                 ;;
14939         NDBM_File|ndbm_fil)
14940                 case "$i_ndbm" in
14941                 $define)
14942                     case "$osname-$use64bitint" in
14943                     hpux-define)
14944                         case "$libs" in
14945                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
14946                         esac
14947                         ;;
14948                     *) avail_ext="$avail_ext $xxx" ;;
14949                     esac
14950                     ;;
14951                 esac
14952                 ;;
14953         ODBM_File|odbm_fil) 
14954                 case "${i_dbm}${i_rpcsvcdbm}" in
14955                 *"${define}"*)
14956                     case "$osname-$use64bitint" in
14957                     hpux-define)
14958                         case "$libs" in
14959                         *-ldbm*) avail_ext="$avail_ext $xxx" ;;
14960                         esac
14961                         ;;
14962                     *) avail_ext="$avail_ext $xxx" ;;
14963                     esac
14964                     ;;
14965                 esac
14966                 ;;
14967         POSIX|posix)
14968                 case "$useposix" in
14969                 true|define|y) avail_ext="$avail_ext $xxx" ;;
14970                 esac
14971                 ;;
14972         Opcode|opcode)
14973                 case "$useopcode" in
14974                 true|define|y) avail_ext="$avail_ext $xxx" ;;
14975                 esac
14976                 ;;
14977         Socket|socket)
14978                 case "$d_socket" in 
14979                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
14980                 esac
14981                 ;;
14982         Sys/Syslog|sys/syslog)
14983                 : XXX syslog requires socket
14984                 case "$d_socket" in 
14985                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
14986                 esac
14987                 ;;
14988         Thread|thread)
14989                 case "$usethreads" in 
14990                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
14991                 esac
14992                 ;;
14993         IPC/SysV|ipc/sysv)
14994                 : XXX Do we need a useipcsysv variable here
14995                 case "${d_msg}${d_sem}${d_shm}" in 
14996                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
14997                 esac
14998                 ;;
14999         *)      avail_ext="$avail_ext $xxx"
15000                 ;;
15001         esac
15002 done
15003
15004 set X $avail_ext
15005 shift
15006 avail_ext="$*"
15007
15008 : Now see which nonxs extensions are supported on this system.
15009 : For now assume all are.
15010 nonxs_ext=''
15011 for xxx in $nonxs_extensions ; do
15012         case "$xxx" in
15013         *)      nonxs_ext="$nonxs_ext $xxx"
15014                 ;;
15015         esac
15016 done
15017
15018 set X $nonxs_ext
15019 shift
15020 nonxs_ext="$*"
15021
15022 case $usedl in
15023 $define)
15024         $cat <<EOM
15025 A number of extensions are supplied with $package.  You may choose to
15026 compile these extensions for dynamic loading (the default), compile
15027 them into the $package executable (static loading), or not include
15028 them at all.  Answer "none" to include no extensions.
15029 Note that DynaLoader is always built and need not be mentioned here.
15030
15031 EOM
15032         case "$dynamic_ext" in
15033         '') dflt="$avail_ext" ;;
15034         *)      dflt="$dynamic_ext"
15035                 # Perhaps we are reusing an old out-of-date config.sh.
15036                 case "$hint" in
15037                 previous)
15038                         if test X"$dynamic_ext" != X"$avail_ext"; then
15039                                 $cat <<EOM
15040 NOTICE:  Your previous config.sh list may be incorrect. 
15041 The extensions now available to you are 
15042         ${avail_ext}
15043 but the default list from your previous config.sh is
15044         ${dynamic_ext} 
15045
15046 EOM
15047                         fi
15048                         ;;
15049                 esac
15050                 ;;
15051         esac
15052         case "$dflt" in
15053         '')     dflt=none;;
15054         esac
15055         rp="What extensions do you wish to load dynamically?"
15056         . ./myread
15057         case "$ans" in
15058         none) dynamic_ext=' ' ;;
15059         *) dynamic_ext="$ans" ;;
15060         esac
15061
15062         case "$static_ext" in
15063         '')
15064                 : Exclude those already listed in dynamic linking
15065                 dflt=''
15066                 for xxx in $avail_ext; do
15067                         case " $dynamic_ext " in
15068                         *" $xxx "*) ;;
15069                         *) dflt="$dflt $xxx" ;;
15070                         esac
15071                 done
15072                 set X $dflt
15073                 shift
15074                 dflt="$*"
15075                 ;;
15076         *)  dflt="$static_ext" 
15077                 ;;
15078         esac
15079
15080         case "$dflt" in
15081         '')     dflt=none;;
15082         esac
15083         rp="What extensions do you wish to load statically?"
15084         . ./myread
15085         case "$ans" in
15086         none) static_ext=' ' ;;
15087         *) static_ext="$ans" ;;
15088         esac
15089         ;;
15090 *)
15091         $cat <<EOM
15092 A number of extensions are supplied with $package.  Answer "none" 
15093 to include no extensions. 
15094 Note that DynaLoader is always built and need not be mentioned here.
15095
15096 EOM
15097         case "$static_ext" in
15098         '') dflt="$avail_ext" ;;
15099         *)      dflt="$static_ext"
15100                 # Perhaps we are reusing an old out-of-date config.sh.
15101                 case "$hint" in
15102                 previous)
15103                         if test X"$static_ext" != X"$avail_ext"; then
15104                                 $cat <<EOM
15105 NOTICE:  Your previous config.sh list may be incorrect. 
15106 The extensions now available to you are 
15107         ${avail_ext}
15108 but the default list from your previous config.sh is
15109         ${static_ext} 
15110
15111 EOM
15112                         fi
15113                         ;;
15114                 esac
15115                 ;;
15116         esac
15117         : Exclude those that are not xs extensions
15118         case "$dflt" in
15119         '')     dflt=none;;
15120         esac
15121         rp="What extensions do you wish to include?"
15122         . ./myread
15123         case "$ans" in
15124         none) static_ext=' ' ;;
15125         *) static_ext="$ans" ;;
15126         esac
15127         ;;
15128 esac
15129
15130 set X $dynamic_ext $static_ext $nonxs_ext
15131 shift
15132 extensions="$*"
15133
15134 : Remove build directory name from cppstdin so it can be used from
15135 : either the present location or the final installed location.
15136 echo " "
15137 : Get out of the UU directory to get correct path name.
15138 cd ..
15139 case "$cppstdin" in
15140 `pwd`/cppstdin)
15141         echo "Stripping down cppstdin path name"
15142         cppstdin=cppstdin
15143         ;;
15144 esac
15145 cd UU
15146
15147 : end of configuration questions
15148 echo " "
15149 echo "End of configuration questions."
15150 echo " "
15151
15152 : back to where it started
15153 if test -d ../UU; then
15154         cd ..
15155 fi
15156
15157 : configuration may be patched via a 'config.over' file
15158 if $test -f config.over; then
15159         echo " "
15160         dflt=y
15161         rp='I see a config.over file.  Do you wish to load it?'
15162         . UU/myread
15163         case "$ans" in
15164         n*) echo "OK, I'll ignore it.";;
15165         *)      . ./config.over
15166                 echo "Configuration override changes have been loaded."
15167                 ;;
15168         esac
15169 fi
15170
15171 : in case they want portability, strip down executable paths
15172 case "$d_portable" in
15173 "$define")
15174         echo " "
15175         echo "Stripping down executable paths..." >&4
15176         for file in $loclist $trylist; do
15177                 eval temp=\$$file
15178                 eval $file=`basename $temp`
15179         done
15180         ;;
15181 esac
15182
15183 : create config.sh file
15184 echo " "
15185 echo "Creating config.sh..." >&4
15186 $spitshell <<EOT >config.sh
15187 $startsh
15188 #
15189 # This file was produced by running the Configure script. It holds all the
15190 # definitions figured out by Configure. Should you modify one of these values,
15191 # do not forget to propagate your changes by running "Configure -der". You may
15192 # instead choose to run each of the .SH files by yourself, or "Configure -S".
15193 #
15194
15195 # Package name      : $package
15196 # Source directory  : $src
15197 # Configuration time: $cf_time
15198 # Configured by     : $cf_by
15199 # Target system     : $myuname
15200
15201 Author='$Author'
15202 Date='$Date'
15203 Header='$Header'
15204 Id='$Id'
15205 Locker='$Locker'
15206 Log='$Log'
15207 Mcc='$Mcc'
15208 RCSfile='$RCSfile'
15209 Revision='$Revision'
15210 Source='$Source'
15211 State='$State'
15212 _a='$_a'
15213 _exe='$_exe'
15214 _o='$_o'
15215 afs='$afs'
15216 alignbytes='$alignbytes'
15217 ansi2knr='$ansi2knr'
15218 aphostname='$aphostname'
15219 api_revision='$api_revision'
15220 api_subversion='$api_subversion'
15221 api_version='$api_version'
15222 api_versionstring='$api_versionstring'
15223 ar='$ar'
15224 archlib='$archlib'
15225 archlibexp='$archlibexp'
15226 archname64='$archname64'
15227 archname='$archname'
15228 archobjs='$archobjs'
15229 awk='$awk'
15230 baserev='$baserev'
15231 bash='$bash'
15232 bin='$bin'
15233 bincompat5005='$bincompat5005'
15234 binexp='$binexp'
15235 bison='$bison'
15236 byacc='$byacc'
15237 byteorder='$byteorder'
15238 c='$c'
15239 castflags='$castflags'
15240 cat='$cat'
15241 cc='$cc'
15242 cccdlflags='$cccdlflags'
15243 ccdlflags='$ccdlflags'
15244 ccflags='$ccflags'
15245 ccflags_uselargefiles='$ccflags_uselargefiles'
15246 ccname='$ccname'
15247 ccsymbols='$ccsymbols'
15248 ccversion='$ccversion'
15249 cf_by='$cf_by'
15250 cf_email='$cf_email'
15251 cf_time='$cf_time'
15252 charsize='$charsize'
15253 chgrp='$chgrp'
15254 chmod='$chmod'
15255 chown='$chown'
15256 clocktype='$clocktype'
15257 comm='$comm'
15258 compress='$compress'
15259 contains='$contains'
15260 cp='$cp'
15261 cpio='$cpio'
15262 cpp='$cpp'
15263 cpp_stuff='$cpp_stuff'
15264 cppccsymbols='$cppccsymbols'
15265 cppflags='$cppflags'
15266 cpplast='$cpplast'
15267 cppminus='$cppminus'
15268 cpprun='$cpprun'
15269 cppstdin='$cppstdin'
15270 cppsymbols='$cppsymbols'
15271 crosscompile='$crosscompile'
15272 cryptlib='$cryptlib'
15273 csh='$csh'
15274 d_Gconvert='$d_Gconvert'
15275 d_PRIEUldbl='$d_PRIEUldbl'
15276 d_PRIFUldbl='$d_PRIFUldbl'
15277 d_PRIGUldbl='$d_PRIGUldbl'
15278 d_PRIXU64='$d_PRIXU64'
15279 d_PRId64='$d_PRId64'
15280 d_PRIeldbl='$d_PRIeldbl'
15281 d_PRIfldbl='$d_PRIfldbl'
15282 d_PRIgldbl='$d_PRIgldbl'
15283 d_PRIi64='$d_PRIi64'
15284 d_PRIo64='$d_PRIo64'
15285 d_PRIu64='$d_PRIu64'
15286 d_PRIx64='$d_PRIx64'
15287 d_SCNfldbl='$d_SCNfldbl'
15288 d_access='$d_access'
15289 d_accessx='$d_accessx'
15290 d_alarm='$d_alarm'
15291 d_archlib='$d_archlib'
15292 d_atolf='$d_atolf'
15293 d_atoll='$d_atoll'
15294 d_attribut='$d_attribut'
15295 d_bcmp='$d_bcmp'
15296 d_bcopy='$d_bcopy'
15297 d_bincompat5005='$d_bincompat5005'
15298 d_bsd='$d_bsd'
15299 d_bsdgetpgrp='$d_bsdgetpgrp'
15300 d_bsdsetpgrp='$d_bsdsetpgrp'
15301 d_bzero='$d_bzero'
15302 d_casti32='$d_casti32'
15303 d_castneg='$d_castneg'
15304 d_charvspr='$d_charvspr'
15305 d_chown='$d_chown'
15306 d_chroot='$d_chroot'
15307 d_chsize='$d_chsize'
15308 d_closedir='$d_closedir'
15309 d_const='$d_const'
15310 d_crypt='$d_crypt'
15311 d_csh='$d_csh'
15312 d_cuserid='$d_cuserid'
15313 d_dbl_dig='$d_dbl_dig'
15314 d_difftime='$d_difftime'
15315 d_dirnamlen='$d_dirnamlen'
15316 d_dlerror='$d_dlerror'
15317 d_dlopen='$d_dlopen'
15318 d_dlsymun='$d_dlsymun'
15319 d_dosuid='$d_dosuid'
15320 d_drand48proto='$d_drand48proto'
15321 d_dup2='$d_dup2'
15322 d_eaccess='$d_eaccess'
15323 d_endgrent='$d_endgrent'
15324 d_endhent='$d_endhent'
15325 d_endnent='$d_endnent'
15326 d_endpent='$d_endpent'
15327 d_endpwent='$d_endpwent'
15328 d_endsent='$d_endsent'
15329 d_eofnblk='$d_eofnblk'
15330 d_eunice='$d_eunice'
15331 d_fchmod='$d_fchmod'
15332 d_fchown='$d_fchown'
15333 d_fcntl='$d_fcntl'
15334 d_fd_macros='$d_fd_macros'
15335 d_fd_set='$d_fd_set'
15336 d_fds_bits='$d_fds_bits'
15337 d_fgetpos='$d_fgetpos'
15338 d_flexfnam='$d_flexfnam'
15339 d_flock='$d_flock'
15340 d_fork='$d_fork'
15341 d_fpathconf='$d_fpathconf'
15342 d_fpos64_t='$d_fpos64_t'
15343 d_frexpl='$d_frexpl'
15344 d_fs_data_s='$d_fs_data_s'
15345 d_fseeko='$d_fseeko'
15346 d_fsetpos='$d_fsetpos'
15347 d_fstatfs='$d_fstatfs'
15348 d_fstatvfs='$d_fstatvfs'
15349 d_ftello='$d_ftello'
15350 d_ftime='$d_ftime'
15351 d_getcwd='$d_getcwd'
15352 d_getespwnam='$d_getespwnam'
15353 d_getfsstat='$d_getfsstat'
15354 d_getgrent='$d_getgrent'
15355 d_getgrps='$d_getgrps'
15356 d_gethbyaddr='$d_gethbyaddr'
15357 d_gethbyname='$d_gethbyname'
15358 d_gethent='$d_gethent'
15359 d_gethname='$d_gethname'
15360 d_gethostprotos='$d_gethostprotos'
15361 d_getlogin='$d_getlogin'
15362 d_getmnt='$d_getmnt'
15363 d_getmntent='$d_getmntent'
15364 d_getnbyaddr='$d_getnbyaddr'
15365 d_getnbyname='$d_getnbyname'
15366 d_getnent='$d_getnent'
15367 d_getnetprotos='$d_getnetprotos'
15368 d_getpbyname='$d_getpbyname'
15369 d_getpbynumber='$d_getpbynumber'
15370 d_getpent='$d_getpent'
15371 d_getpgid='$d_getpgid'
15372 d_getpgrp2='$d_getpgrp2'
15373 d_getpgrp='$d_getpgrp'
15374 d_getppid='$d_getppid'
15375 d_getprior='$d_getprior'
15376 d_getprotoprotos='$d_getprotoprotos'
15377 d_getprpwnam='$d_getprpwnam'
15378 d_getpwent='$d_getpwent'
15379 d_getsbyname='$d_getsbyname'
15380 d_getsbyport='$d_getsbyport'
15381 d_getsent='$d_getsent'
15382 d_getservprotos='$d_getservprotos'
15383 d_getspnam='$d_getspnam'
15384 d_gettimeod='$d_gettimeod'
15385 d_gnulibc='$d_gnulibc'
15386 d_grpasswd='$d_grpasswd'
15387 d_hasmntopt='$d_hasmntopt'
15388 d_htonl='$d_htonl'
15389 d_iconv='$d_iconv'
15390 d_index='$d_index'
15391 d_inetaton='$d_inetaton'
15392 d_int64_t='$d_int64_t'
15393 d_isascii='$d_isascii'
15394 d_isnan='$d_isnan'
15395 d_isnanl='$d_isnanl'
15396 d_killpg='$d_killpg'
15397 d_lchown='$d_lchown'
15398 d_ldbl_dig='$d_ldbl_dig'
15399 d_link='$d_link'
15400 d_locconv='$d_locconv'
15401 d_lockf='$d_lockf'
15402 d_longdbl='$d_longdbl'
15403 d_longlong='$d_longlong'
15404 d_lseekproto='$d_lseekproto'
15405 d_lstat='$d_lstat'
15406 d_madvise='$d_madvise'
15407 d_mblen='$d_mblen'
15408 d_mbstowcs='$d_mbstowcs'
15409 d_mbtowc='$d_mbtowc'
15410 d_memchr='$d_memchr'
15411 d_memcmp='$d_memcmp'
15412 d_memcpy='$d_memcpy'
15413 d_memmove='$d_memmove'
15414 d_memset='$d_memset'
15415 d_mkdir='$d_mkdir'
15416 d_mkdtemp='$d_mkdtemp'
15417 d_mkfifo='$d_mkfifo'
15418 d_mkstemp='$d_mkstemp'
15419 d_mkstemps='$d_mkstemps'
15420 d_mktime='$d_mktime'
15421 d_mmap='$d_mmap'
15422 d_modfl='$d_modfl'
15423 d_mprotect='$d_mprotect'
15424 d_msg='$d_msg'
15425 d_msg_ctrunc='$d_msg_ctrunc'
15426 d_msg_dontroute='$d_msg_dontroute'
15427 d_msg_oob='$d_msg_oob'
15428 d_msg_peek='$d_msg_peek'
15429 d_msg_proxy='$d_msg_proxy'
15430 d_msgctl='$d_msgctl'
15431 d_msgget='$d_msgget'
15432 d_msgrcv='$d_msgrcv'
15433 d_msgsnd='$d_msgsnd'
15434 d_msync='$d_msync'
15435 d_munmap='$d_munmap'
15436 d_mymalloc='$d_mymalloc'
15437 d_nice='$d_nice'
15438 d_nv_preserves_uv='$d_nv_preserves_uv'
15439 d_nv_preserves_uv_bits='$d_nv_preserves_uv_bits'
15440 d_off64_t='$d_off64_t'
15441 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
15442 d_oldpthreads='$d_oldpthreads'
15443 d_oldsock='$d_oldsock'
15444 d_open3='$d_open3'
15445 d_pathconf='$d_pathconf'
15446 d_pause='$d_pause'
15447 d_perl_otherlibdirs='$d_perl_otherlibdirs'
15448 d_phostname='$d_phostname'
15449 d_pipe='$d_pipe'
15450 d_poll='$d_poll'
15451 d_portable='$d_portable'
15452 d_pthread_yield='$d_pthread_yield'
15453 d_pwage='$d_pwage'
15454 d_pwchange='$d_pwchange'
15455 d_pwclass='$d_pwclass'
15456 d_pwcomment='$d_pwcomment'
15457 d_pwexpire='$d_pwexpire'
15458 d_pwgecos='$d_pwgecos'
15459 d_pwpasswd='$d_pwpasswd'
15460 d_pwquota='$d_pwquota'
15461 d_qgcvt='$d_qgcvt'
15462 d_quad='$d_quad'
15463 d_readdir='$d_readdir'
15464 d_readlink='$d_readlink'
15465 d_rename='$d_rename'
15466 d_rewinddir='$d_rewinddir'
15467 d_rmdir='$d_rmdir'
15468 d_safebcpy='$d_safebcpy'
15469 d_safemcpy='$d_safemcpy'
15470 d_sanemcmp='$d_sanemcmp'
15471 d_sched_yield='$d_sched_yield'
15472 d_scm_rights='$d_scm_rights'
15473 d_seekdir='$d_seekdir'
15474 d_select='$d_select'
15475 d_sem='$d_sem'
15476 d_semctl='$d_semctl'
15477 d_semctl_semid_ds='$d_semctl_semid_ds'
15478 d_semctl_semun='$d_semctl_semun'
15479 d_semget='$d_semget'
15480 d_semop='$d_semop'
15481 d_setegid='$d_setegid'
15482 d_seteuid='$d_seteuid'
15483 d_setgrent='$d_setgrent'
15484 d_setgrps='$d_setgrps'
15485 d_sethent='$d_sethent'
15486 d_setlinebuf='$d_setlinebuf'
15487 d_setlocale='$d_setlocale'
15488 d_setnent='$d_setnent'
15489 d_setpent='$d_setpent'
15490 d_setpgid='$d_setpgid'
15491 d_setpgrp2='$d_setpgrp2'
15492 d_setpgrp='$d_setpgrp'
15493 d_setprior='$d_setprior'
15494 d_setproctitle='$d_setproctitle'
15495 d_setpwent='$d_setpwent'
15496 d_setregid='$d_setregid'
15497 d_setresgid='$d_setresgid'
15498 d_setresuid='$d_setresuid'
15499 d_setreuid='$d_setreuid'
15500 d_setrgid='$d_setrgid'
15501 d_setruid='$d_setruid'
15502 d_setsent='$d_setsent'
15503 d_setsid='$d_setsid'
15504 d_setvbuf='$d_setvbuf'
15505 d_sfio='$d_sfio'
15506 d_shm='$d_shm'
15507 d_shmat='$d_shmat'
15508 d_shmatprototype='$d_shmatprototype'
15509 d_shmctl='$d_shmctl'
15510 d_shmdt='$d_shmdt'
15511 d_shmget='$d_shmget'
15512 d_sigaction='$d_sigaction'
15513 d_sigsetjmp='$d_sigsetjmp'
15514 d_socket='$d_socket'
15515 d_socklen_t='$d_socklen_t'
15516 d_sockpair='$d_sockpair'
15517 d_socks5_init='$d_socks5_init'
15518 d_sqrtl='$d_sqrtl'
15519 d_statblks='$d_statblks'
15520 d_statfs_f_flags='$d_statfs_f_flags'
15521 d_statfs_s='$d_statfs_s'
15522 d_statvfs='$d_statvfs'
15523 d_stdio_cnt_lval='$d_stdio_cnt_lval'
15524 d_stdio_ptr_lval='$d_stdio_ptr_lval'
15525 d_stdio_stream_array='$d_stdio_stream_array'
15526 d_stdiobase='$d_stdiobase'
15527 d_stdstdio='$d_stdstdio'
15528 d_strchr='$d_strchr'
15529 d_strcoll='$d_strcoll'
15530 d_strctcpy='$d_strctcpy'
15531 d_strerrm='$d_strerrm'
15532 d_strerror='$d_strerror'
15533 d_strtod='$d_strtod'
15534 d_strtol='$d_strtol'
15535 d_strtold='$d_strtold'
15536 d_strtoll='$d_strtoll'
15537 d_strtoul='$d_strtoul'
15538 d_strtoull='$d_strtoull'
15539 d_strtouq='$d_strtouq'
15540 d_strxfrm='$d_strxfrm'
15541 d_suidsafe='$d_suidsafe'
15542 d_symlink='$d_symlink'
15543 d_syscall='$d_syscall'
15544 d_sysconf='$d_sysconf'
15545 d_sysernlst='$d_sysernlst'
15546 d_syserrlst='$d_syserrlst'
15547 d_system='$d_system'
15548 d_tcgetpgrp='$d_tcgetpgrp'
15549 d_tcsetpgrp='$d_tcsetpgrp'
15550 d_telldir='$d_telldir'
15551 d_telldirproto='$d_telldirproto'
15552 d_time='$d_time'
15553 d_times='$d_times'
15554 d_truncate='$d_truncate'
15555 d_tzname='$d_tzname'
15556 d_umask='$d_umask'
15557 d_uname='$d_uname'
15558 d_union_semun='$d_union_semun'
15559 d_ustat='$d_ustat'
15560 d_vendorarch='$d_vendorarch'
15561 d_vendorbin='$d_vendorbin'
15562 d_vendorlib='$d_vendorlib'
15563 d_vfork='$d_vfork'
15564 d_void_closedir='$d_void_closedir'
15565 d_voidsig='$d_voidsig'
15566 d_voidtty='$d_voidtty'
15567 d_volatile='$d_volatile'
15568 d_vprintf='$d_vprintf'
15569 d_wait4='$d_wait4'
15570 d_waitpid='$d_waitpid'
15571 d_wcstombs='$d_wcstombs'
15572 d_wctomb='$d_wctomb'
15573 d_xenix='$d_xenix'
15574 date='$date'
15575 db_hashtype='$db_hashtype'
15576 db_prefixtype='$db_prefixtype'
15577 defvoidused='$defvoidused'
15578 direntrytype='$direntrytype'
15579 dlext='$dlext'
15580 dlsrc='$dlsrc'
15581 doublesize='$doublesize'
15582 drand01='$drand01'
15583 dynamic_ext='$dynamic_ext'
15584 eagain='$eagain'
15585 ebcdic='$ebcdic'
15586 echo='$echo'
15587 egrep='$egrep'
15588 emacs='$emacs'
15589 eunicefix='$eunicefix'
15590 exe_ext='$exe_ext'
15591 expr='$expr'
15592 extensions='$extensions'
15593 fflushNULL='$fflushNULL'
15594 fflushall='$fflushall'
15595 find='$find'
15596 firstmakefile='$firstmakefile'
15597 flex='$flex'
15598 fpossize='$fpossize'
15599 fpostype='$fpostype'
15600 freetype='$freetype'
15601 full_ar='$full_ar'
15602 full_csh='$full_csh'
15603 full_sed='$full_sed'
15604 gccosandvers='$gccosandvers'
15605 gccversion='$gccversion'
15606 gidformat='$gidformat'
15607 gidsign='$gidsign'
15608 gidsize='$gidsize'
15609 gidtype='$gidtype'
15610 glibpth='$glibpth'
15611 grep='$grep'
15612 groupcat='$groupcat'
15613 groupstype='$groupstype'
15614 gzip='$gzip'
15615 h_fcntl='$h_fcntl'
15616 h_sysfile='$h_sysfile'
15617 hint='$hint'
15618 hostcat='$hostcat'
15619 i16size='$i16size'
15620 i16type='$i16type'
15621 i32size='$i32size'
15622 i32type='$i32type'
15623 i64size='$i64size'
15624 i64type='$i64type'
15625 i8size='$i8size'
15626 i8type='$i8type'
15627 i_arpainet='$i_arpainet'
15628 i_bsdioctl='$i_bsdioctl'
15629 i_db='$i_db'
15630 i_dbm='$i_dbm'
15631 i_dirent='$i_dirent'
15632 i_dld='$i_dld'
15633 i_dlfcn='$i_dlfcn'
15634 i_fcntl='$i_fcntl'
15635 i_float='$i_float'
15636 i_gdbm='$i_gdbm'
15637 i_grp='$i_grp'
15638 i_iconv='$i_iconv'
15639 i_ieeefp='$i_ieeefp'
15640 i_inttypes='$i_inttypes'
15641 i_libutil='$i_libutil'
15642 i_limits='$i_limits'
15643 i_locale='$i_locale'
15644 i_machcthr='$i_machcthr'
15645 i_malloc='$i_malloc'
15646 i_math='$i_math'
15647 i_memory='$i_memory'
15648 i_mntent='$i_mntent'
15649 i_ndbm='$i_ndbm'
15650 i_netdb='$i_netdb'
15651 i_neterrno='$i_neterrno'
15652 i_netinettcp='$i_netinettcp'
15653 i_niin='$i_niin'
15654 i_poll='$i_poll'
15655 i_prot='$i_prot'
15656 i_pthread='$i_pthread'
15657 i_pwd='$i_pwd'
15658 i_rpcsvcdbm='$i_rpcsvcdbm'
15659 i_sfio='$i_sfio'
15660 i_sgtty='$i_sgtty'
15661 i_shadow='$i_shadow'
15662 i_socks='$i_socks'
15663 i_stdarg='$i_stdarg'
15664 i_stddef='$i_stddef'
15665 i_stdlib='$i_stdlib'
15666 i_string='$i_string'
15667 i_sunmath='$i_sunmath'
15668 i_sysaccess='$i_sysaccess'
15669 i_sysdir='$i_sysdir'
15670 i_sysfile='$i_sysfile'
15671 i_sysfilio='$i_sysfilio'
15672 i_sysin='$i_sysin'
15673 i_sysioctl='$i_sysioctl'
15674 i_syslog='$i_syslog'
15675 i_sysmman='$i_sysmman'
15676 i_sysmode='$i_sysmode'
15677 i_sysmount='$i_sysmount'
15678 i_sysndir='$i_sysndir'
15679 i_sysparam='$i_sysparam'
15680 i_sysresrc='$i_sysresrc'
15681 i_syssecrt='$i_syssecrt'
15682 i_sysselct='$i_sysselct'
15683 i_syssockio='$i_syssockio'
15684 i_sysstat='$i_sysstat'
15685 i_sysstatfs='$i_sysstatfs'
15686 i_sysstatvfs='$i_sysstatvfs'
15687 i_systime='$i_systime'
15688 i_systimek='$i_systimek'
15689 i_systimes='$i_systimes'
15690 i_systypes='$i_systypes'
15691 i_sysuio='$i_sysuio'
15692 i_sysun='$i_sysun'
15693 i_sysutsname='$i_sysutsname'
15694 i_sysvfs='$i_sysvfs'
15695 i_syswait='$i_syswait'
15696 i_termio='$i_termio'
15697 i_termios='$i_termios'
15698 i_time='$i_time'
15699 i_unistd='$i_unistd'
15700 i_ustat='$i_ustat'
15701 i_utime='$i_utime'
15702 i_values='$i_values'
15703 i_varargs='$i_varargs'
15704 i_varhdr='$i_varhdr'
15705 i_vfork='$i_vfork'
15706 ignore_versioned_solibs='$ignore_versioned_solibs'
15707 inc_version_list='$inc_version_list'
15708 inc_version_list_init='$inc_version_list_init'
15709 incpath='$incpath'
15710 inews='$inews'
15711 installarchlib='$installarchlib'
15712 installbin='$installbin'
15713 installman1dir='$installman1dir'
15714 installman3dir='$installman3dir'
15715 installprefix='$installprefix'
15716 installprefixexp='$installprefixexp'
15717 installprivlib='$installprivlib'
15718 installscript='$installscript'
15719 installsitearch='$installsitearch'
15720 installsitebin='$installsitebin'
15721 installsitelib='$installsitelib'
15722 installstyle='$installstyle'
15723 installusrbinperl='$installusrbinperl'
15724 installvendorarch='$installvendorarch'
15725 installvendorbin='$installvendorbin'
15726 installvendorlib='$installvendorlib'
15727 intsize='$intsize'
15728 ivdformat='$ivdformat'
15729 ivsize='$ivsize'
15730 ivtype='$ivtype'
15731 known_extensions='$known_extensions'
15732 ksh='$ksh'
15733 ld='$ld'
15734 lddlflags='$lddlflags'
15735 ldflags='$ldflags'
15736 ldflags_uselargefiles='$ldflags_uselargefiles'
15737 ldlibpthname='$ldlibpthname'
15738 less='$less'
15739 lib_ext='$lib_ext'
15740 libc='$libc'
15741 libperl='$libperl'
15742 libpth='$libpth'
15743 libs='$libs'
15744 libsdirs='$libsdirs'
15745 libsfiles='$libsfiles'
15746 libsfound='$libsfound'
15747 libspath='$libspath'
15748 libswanted='$libswanted'
15749 libswanted_uselargefiles='$libswanted_uselargefiles'
15750 line='$line'
15751 lint='$lint'
15752 lkflags='$lkflags'
15753 ln='$ln'
15754 lns='$lns'
15755 locincpth='$locincpth'
15756 loclibpth='$loclibpth'
15757 longdblsize='$longdblsize'
15758 longlongsize='$longlongsize'
15759 longsize='$longsize'
15760 lp='$lp'
15761 lpr='$lpr'
15762 ls='$ls'
15763 lseeksize='$lseeksize'
15764 lseektype='$lseektype'
15765 mail='$mail'
15766 mailx='$mailx'
15767 make='$make'
15768 make_set_make='$make_set_make'
15769 mallocobj='$mallocobj'
15770 mallocsrc='$mallocsrc'
15771 malloctype='$malloctype'
15772 man1dir='$man1dir'
15773 man1direxp='$man1direxp'
15774 man1ext='$man1ext'
15775 man3dir='$man3dir'
15776 man3direxp='$man3direxp'
15777 man3ext='$man3ext'
15778 mips_type='$mips_type'
15779 mkdir='$mkdir'
15780 mmaptype='$mmaptype'
15781 modetype='$modetype'
15782 more='$more'
15783 multiarch='$multiarch'
15784 mv='$mv'
15785 myarchname='$myarchname'
15786 mydomain='$mydomain'
15787 myhostname='$myhostname'
15788 myuname='$myuname'
15789 n='$n'
15790 netdb_hlen_type='$netdb_hlen_type'
15791 netdb_host_type='$netdb_host_type'
15792 netdb_name_type='$netdb_name_type'
15793 netdb_net_type='$netdb_net_type'
15794 nm='$nm'
15795 nm_opt='$nm_opt'
15796 nm_so_opt='$nm_so_opt'
15797 nonxs_ext='$nonxs_ext'
15798 nroff='$nroff'
15799 nvEUformat='$nvEUformat'
15800 nvFUformat='$nvFUformat'
15801 nvGUformat='$nvGUformat'
15802 nveformat='$nveformat'
15803 nvfformat='$nvfformat'
15804 nvgformat='$nvgformat'
15805 nvsize='$nvsize'
15806 nvtype='$nvtype'
15807 o_nonblock='$o_nonblock'
15808 obj_ext='$obj_ext'
15809 old_pthread_create_joinable='$old_pthread_create_joinable'
15810 optimize='$optimize'
15811 orderlib='$orderlib'
15812 osname='$osname'
15813 osvers='$osvers'
15814 otherlibdirs='$otherlibdirs'
15815 package='$package'
15816 pager='$pager'
15817 passcat='$passcat'
15818 patchlevel='$patchlevel'
15819 path_sep='$path_sep'
15820 perl5='$perl5'
15821 perl='$perl'
15822 perladmin='$perladmin'
15823 perlpath='$perlpath'
15824 pg='$pg'
15825 phostname='$phostname'
15826 pidtype='$pidtype'
15827 plibpth='$plibpth'
15828 pm_apiversion='$pm_apiversion'
15829 pmake='$pmake'
15830 pr='$pr'
15831 prefix='$prefix'
15832 prefixexp='$prefixexp'
15833 privlib='$privlib'
15834 privlibexp='$privlibexp'
15835 prototype='$prototype'
15836 ptrsize='$ptrsize'
15837 quadkind='$quadkind'
15838 quadtype='$quadtype'
15839 randbits='$randbits'
15840 randfunc='$randfunc'
15841 randseedtype='$randseedtype'
15842 ranlib='$ranlib'
15843 rd_nodata='$rd_nodata'
15844 revision='$revision'
15845 rm='$rm'
15846 rmail='$rmail'
15847 runnm='$runnm'
15848 sPRIEUldbl='$sPRIEUldbl'
15849 sPRIFUldbl='$sPRIFUldbl'
15850 sPRIGUldbl='$sPRIGUldbl'
15851 sPRIXU64='$sPRIXU64'
15852 sPRId64='$sPRId64'
15853 sPRIeldbl='$sPRIeldbl'
15854 sPRIfldbl='$sPRIfldbl'
15855 sPRIgldbl='$sPRIgldbl'
15856 sPRIi64='$sPRIi64'
15857 sPRIo64='$sPRIo64'
15858 sPRIu64='$sPRIu64'
15859 sPRIx64='$sPRIx64'
15860 sSCNfldbl='$sSCNfldbl'
15861 sched_yield='$sched_yield'
15862 scriptdir='$scriptdir'
15863 scriptdirexp='$scriptdirexp'
15864 sed='$sed'
15865 seedfunc='$seedfunc'
15866 selectminbits='$selectminbits'
15867 selecttype='$selecttype'
15868 sendmail='$sendmail'
15869 sh='$sh'
15870 shar='$shar'
15871 sharpbang='$sharpbang'
15872 shmattype='$shmattype'
15873 shortsize='$shortsize'
15874 shrpenv='$shrpenv'
15875 shsharp='$shsharp'
15876 sig_count='$sig_count'
15877 sig_name='$sig_name'
15878 sig_name_init='$sig_name_init'
15879 sig_num='$sig_num'
15880 sig_num_init='$sig_num_init'
15881 signal_t='$signal_t'
15882 sitearch='$sitearch'
15883 sitearchexp='$sitearchexp'
15884 sitebin='$sitebin'
15885 sitebinexp='$sitebinexp'
15886 sitelib='$sitelib'
15887 sitelib_stem='$sitelib_stem'
15888 sitelibexp='$sitelibexp'
15889 siteprefix='$siteprefix'
15890 siteprefixexp='$siteprefixexp'
15891 sizesize='$sizesize'
15892 sizetype='$sizetype'
15893 sleep='$sleep'
15894 smail='$smail'
15895 so='$so'
15896 sockethdr='$sockethdr'
15897 socketlib='$socketlib'
15898 socksizetype='$socksizetype'
15899 sort='$sort'
15900 spackage='$spackage'
15901 spitshell='$spitshell'
15902 src='$src'
15903 ssizetype='$ssizetype'
15904 startperl='$startperl'
15905 startsh='$startsh'
15906 static_ext='$static_ext'
15907 stdchar='$stdchar'
15908 stdio_base='$stdio_base'
15909 stdio_bufsiz='$stdio_bufsiz'
15910 stdio_cnt='$stdio_cnt'
15911 stdio_filbuf='$stdio_filbuf'
15912 stdio_ptr='$stdio_ptr'
15913 stdio_stream_array='$stdio_stream_array'
15914 strings='$strings'
15915 submit='$submit'
15916 subversion='$subversion'
15917 sysman='$sysman'
15918 tail='$tail'
15919 tar='$tar'
15920 tbl='$tbl'
15921 tee='$tee'
15922 test='$test'
15923 timeincl='$timeincl'
15924 timetype='$timetype'
15925 touch='$touch'
15926 tr='$tr'
15927 trnl='$trnl'
15928 troff='$troff'
15929 u16size='$u16size'
15930 u16type='$u16type'
15931 u32size='$u32size'
15932 u32type='$u32type'
15933 u64size='$u64size'
15934 u64type='$u64type'
15935 u8size='$u8size'
15936 u8type='$u8type'
15937 uidformat='$uidformat'
15938 uidsign='$uidsign'
15939 uidsize='$uidsize'
15940 uidtype='$uidtype'
15941 uname='$uname'
15942 uniq='$uniq'
15943 uquadtype='$uquadtype'
15944 use5005threads='$use5005threads'
15945 use64bitall='$use64bitall'
15946 use64bitint='$use64bitint'
15947 usedl='$usedl'
15948 useithreads='$useithreads'
15949 uselargefiles='$uselargefiles'
15950 uselongdouble='$uselongdouble'
15951 usemorebits='$usemorebits'
15952 usemultiplicity='$usemultiplicity'
15953 usemymalloc='$usemymalloc'
15954 usenm='$usenm'
15955 useopcode='$useopcode'
15956 useperlio='$useperlio'
15957 useposix='$useposix'
15958 usesfio='$usesfio'
15959 useshrplib='$useshrplib'
15960 usesocks='$usesocks'
15961 usethreads='$usethreads'
15962 usevendorprefix='$usevendorprefix'
15963 usevfork='$usevfork'
15964 usrinc='$usrinc'
15965 uuname='$uuname'
15966 uvXUformat='$uvXUformat'
15967 uvoformat='$uvoformat'
15968 uvsize='$uvsize'
15969 uvtype='$uvtype'
15970 uvuformat='$uvuformat'
15971 uvxformat='$uvxformat'
15972 vendorarch='$vendorarch'
15973 vendorarchexp='$vendorarchexp'
15974 vendorbin='$vendorbin'
15975 vendorbinexp='$vendorbinexp'
15976 vendorlib='$vendorlib'
15977 vendorlib_stem='$vendorlib_stem'
15978 vendorlibexp='$vendorlibexp'
15979 vendorprefix='$vendorprefix'
15980 vendorprefixexp='$vendorprefixexp'
15981 version='$version'
15982 vi='$vi'
15983 voidflags='$voidflags'
15984 xlibpth='$xlibpth'
15985 xs_apiversion='$xs_apiversion'
15986 zcat='$zcat'
15987 zip='$zip'
15988 EOT
15989
15990 : Add in command line options if available
15991 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
15992
15993 : add special variables
15994 $test -f $src/patchlevel.h && \
15995 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
15996 echo "CONFIGDOTSH=true" >>config.sh
15997
15998 : propagate old symbols
15999 if $test -f UU/config.sh; then
16000         <UU/config.sh sort | uniq >UU/oldconfig.sh
16001         sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
16002         sort | uniq -u >UU/oldsyms
16003         set X `cat UU/oldsyms`
16004         shift
16005         case $# in
16006         0) ;;
16007         *)
16008                 cat <<EOM
16009 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
16010 EOM
16011                 echo "# Variables propagated from previous config.sh file." >>config.sh
16012                 for sym in `cat UU/oldsyms`; do
16013                         echo "    Propagating $hint variable "'$'"$sym..."
16014                         eval 'tmp="$'"${sym}"'"'
16015                         echo "$tmp" | \
16016                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
16017                 done
16018                 ;;
16019         esac
16020 fi
16021
16022 : Finish up by extracting the .SH files
16023 case "$alldone" in
16024 exit)
16025         $rm -rf UU
16026         echo "Done."
16027         exit 0
16028         ;;
16029 cont)
16030         ;;
16031 '')
16032         dflt=''
16033         nostick=true
16034         $cat <<EOM
16035
16036 If you'd like to make any changes to the config.sh file before I begin
16037 to configure things, do it as a shell escape now (e.g. !vi config.sh).
16038
16039 EOM
16040         rp="Press return or use a shell escape to edit config.sh:"
16041         . UU/myread
16042         nostick=''
16043         case "$ans" in
16044         '') ;;
16045         *) : in case they cannot read
16046                 sh 1>&4 -c "$ans";;
16047         esac
16048         ;;
16049 esac
16050
16051 : if this fails, just run all the .SH files by hand
16052 . ./config.sh
16053
16054 echo " "
16055 exec 1>&4
16056 . ./UU/extract
16057
16058 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
16059         dflt=y
16060         case "$silent" in
16061         true) ;;
16062         *)
16063                 $cat <<EOM
16064
16065 Now you need to generate make dependencies by running "$make depend".
16066 You might prefer to run it in background: "$make depend > makedepend.out &"
16067 It can take a while, so you might not want to run it right now.
16068
16069 EOM
16070                 ;;
16071         esac
16072         rp="Run $make depend now?"
16073         . UU/myread
16074         case "$ans" in
16075         y*)
16076                 $make depend && echo "Now you must run '$make'."
16077                 ;;
16078         *)
16079                 echo "You must run '$make depend' then '$make'."
16080                 ;;
16081         esac
16082 elif test -f [Mm]akefile; then
16083         echo " "
16084         echo "Now you must run a $make."
16085 else
16086         echo "Done."
16087 fi
16088
16089 if $test -f Policy.sh; then
16090     $cat <<EOM
16091
16092 If you compile $package on a different machine or from a different object
16093 directory, copy the Policy.sh file from this object directory to the
16094 new one before you run Configure -- this will help you with most of
16095 the policy defaults.
16096
16097 EOM
16098 fi
16099 if $test -f config.msg; then
16100     echo "Hmm.  I also noted the following information while running:"
16101     echo " "
16102     $cat config.msg >&4
16103     $rm -f config.msg
16104 fi
16105 $rm -f kit*isdone ark*isdone
16106 $rm -rf UU
16107
16108 : End of Configure
16109