More verbose debugging.
[p5sagit/p5-mst-13.2.git] / Configure
1 #! /bin/sh
2 #
3 # If these # comments don't work, trim them. Don't worry about any other
4 # shell scripts, Configure will trim # comments from them for you.
5 #
6 # (If you are trying to port this package to a machine without sh,
7 # I would suggest you have a look at the prototypical config_h.SH file
8 # and edit it to reflect your system. Some packages may include samples
9 # of config.h for certain machines, so you might look for one of those.)
10 #
11 # Yes, you may rip this off to use in other distribution packages. This
12 # script belongs to the public domain and cannot be copyrighted.
13 #
14 # (Note: this Configure script was generated automatically. Rather than
15 # working with this copy of Configure, you may wish to get metaconfig.
16 # The dist-3.0 package (which contains metaconfig) was posted in
17 # comp.sources.misc and is available on CPAN under authors/id/RAM so
18 # you may fetch it yourself from your nearest archive site.)
19 #
20
21 # $Id: Head.U,v 3.0.1.9 1997/02/28 15:02:09 ram Exp $
22 #
23 # Generated on Sat Jun  2 17:25:04 EET DST 2001 [metaconfig 3.0 PL70]
24 # (with additional metaconfig patches by perlbug@perl.org)
25
26 cat >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 >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 c1$$ c2$$
44 true || exec sh $0 $argv:q
45
46 (exit $?0) || cat c2$$
47 (exit $?0) || exec sh $0 $argv:q
48 rm -f c1$$ 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 perllibs=''
169 dynamic_ext=''
170 extensions=''
171 known_extensions=''
172 nonxs_ext=''
173 static_ext=''
174 useopcode=''
175 useposix=''
176 d_bsd=''
177 d_eunice=''
178 d_xenix=''
179 eunicefix=''
180 Mcc=''
181 ar=''
182 awk=''
183 bash=''
184 bison=''
185 byacc=''
186 cat=''
187 chgrp=''
188 chmod=''
189 chown=''
190 comm=''
191 compress=''
192 cp=''
193 cpio=''
194 cpp=''
195 csh=''
196 date=''
197 echo=''
198 egrep=''
199 emacs=''
200 expr=''
201 find=''
202 flex=''
203 grep=''
204 gzip=''
205 inews=''
206 ksh=''
207 less=''
208 line=''
209 lint=''
210 ln=''
211 lp=''
212 lpr=''
213 ls=''
214 mail=''
215 mailx=''
216 make=''
217 mkdir=''
218 more=''
219 mv=''
220 nm=''
221 nroff=''
222 perl=''
223 pg=''
224 pmake=''
225 pr=''
226 rm=''
227 rmail=''
228 sed=''
229 sendmail=''
230 shar=''
231 sleep=''
232 smail=''
233 sort=''
234 submit=''
235 tail=''
236 tar=''
237 tbl=''
238 tee=''
239 test=''
240 touch=''
241 tr=''
242 troff=''
243 uname=''
244 uniq=''
245 uuname=''
246 vi=''
247 zcat=''
248 zip=''
249 full_ar=''
250 full_sed=''
251 libswanted=''
252 hint=''
253 myuname=''
254 osname=''
255 osvers=''
256 Author=''
257 Date=''
258 Header=''
259 Id=''
260 Locker=''
261 Log=''
262 RCSfile=''
263 Revision=''
264 Source=''
265 State=''
266 _a=''
267 _exe=''
268 _o=''
269 archobjs=''
270 exe_ext=''
271 firstmakefile=''
272 lib_ext=''
273 obj_ext=''
274 path_sep=''
275 afs=''
276 afsroot=''
277 alignbytes=''
278 ansi2knr=''
279 archlib=''
280 archlibexp=''
281 d_archlib=''
282 installarchlib=''
283 archname=''
284 myarchname=''
285 d_atolf=''
286 d_atoll=''
287 baserev=''
288 bin=''
289 binexp=''
290 installbin=''
291 bincompat5005=''
292 d_bincompat5005=''
293 byteorder=''
294 cc=''
295 ccflags=''
296 cppflags=''
297 ldflags=''
298 lkflags=''
299 locincpth=''
300 optimize=''
301 cf_email=''
302 cf_by=''
303 cf_time=''
304 charsize=''
305 contains=''
306 cpp_stuff=''
307 cpplast=''
308 cppminus=''
309 cpprun=''
310 cppstdin=''
311 crosscompile=''
312 d__fwalk=''
313 d_access=''
314 d_accessx=''
315 d_alarm=''
316 d_attribut=''
317 d_bcmp=''
318 d_bcopy=''
319 d_bzero=''
320 d_casti32=''
321 castflags=''
322 d_castneg=''
323 d_chown=''
324 d_chroot=''
325 d_chsize=''
326 d_closedir=''
327 d_void_closedir=''
328 d_cmsghdr_s=''
329 d_const=''
330 cryptlib=''
331 d_crypt=''
332 d_csh=''
333 full_csh=''
334 d_cuserid=''
335 d_dbl_dig=''
336 d_difftime=''
337 d_dlerror=''
338 d_dlopen=''
339 d_dlsymun=''
340 d_dosuid=''
341 d_suidsafe=''
342 d_drand48proto=''
343 d_dup2=''
344 d_eaccess=''
345 d_endgrent=''
346 d_endhent=''
347 d_endnent=''
348 d_endpent=''
349 d_endpwent=''
350 d_endsent=''
351 d_fchmod=''
352 d_fchown=''
353 d_fcntl=''
354 d_fcntl_can_lock=''
355 d_fd_macros=''
356 d_fd_set=''
357 d_fds_bits=''
358 d_fgetpos=''
359 d_flexfnam=''
360 d_flock=''
361 d_fork=''
362 d_fpos64_t=''
363 d_frexpl=''
364 d_fs_data_s=''
365 d_fseeko=''
366 d_fsetpos=''
367 d_fstatfs=''
368 d_fsync=''
369 d_ftello=''
370 d_ftime=''
371 d_gettimeod=''
372 d_Gconvert=''
373 d_getcwd=''
374 d_getespwnam=''
375 d_getfsstat=''
376 d_getgrent=''
377 d_getgrps=''
378 d_gethbyaddr=''
379 d_gethbyname=''
380 d_gethent=''
381 aphostname=''
382 d_gethname=''
383 d_phostname=''
384 d_uname=''
385 d_gethostprotos=''
386 d_getitimer=''
387 d_getlogin=''
388 d_getmnt=''
389 d_getmntent=''
390 d_getnbyaddr=''
391 d_getnbyname=''
392 d_getnent=''
393 d_getnetprotos=''
394 d_getpagsz=''
395 d_getpent=''
396 d_getpgid=''
397 d_getpgrp2=''
398 d_bsdgetpgrp=''
399 d_getpgrp=''
400 d_getppid=''
401 d_getprior=''
402 d_getpbyname=''
403 d_getpbynumber=''
404 d_getprotoprotos=''
405 d_getprpwnam=''
406 d_getpwent=''
407 d_getsent=''
408 d_getservprotos=''
409 d_getspnam=''
410 d_getsbyname=''
411 d_getsbyport=''
412 d_gnulibc=''
413 d_hasmntopt=''
414 d_htonl=''
415 d_iconv=''
416 d_inetaton=''
417 d_int64_t=''
418 d_isascii=''
419 d_isnan=''
420 d_isnanl=''
421 d_killpg=''
422 d_lchown=''
423 d_ldbl_dig=''
424 d_link=''
425 d_locconv=''
426 d_lockf=''
427 d_longdbl=''
428 longdblsize=''
429 d_longlong=''
430 longlongsize=''
431 d_lseekproto=''
432 d_lstat=''
433 d_madvise=''
434 d_mblen=''
435 d_mbstowcs=''
436 d_mbtowc=''
437 d_memchr=''
438 d_memcmp=''
439 d_memcpy=''
440 d_memmove=''
441 d_memset=''
442 d_mkdir=''
443 d_mkdtemp=''
444 d_mkfifo=''
445 d_mkstemp=''
446 d_mkstemps=''
447 d_mktime=''
448 d_mmap=''
449 mmaptype=''
450 d_modfl=''
451 d_mprotect=''
452 d_msg=''
453 d_msgctl=''
454 d_msgget=''
455 d_msghdr_s=''
456 d_msgrcv=''
457 d_msgsnd=''
458 d_msync=''
459 d_munmap=''
460 d_nice=''
461 d_off64_t=''
462 d_open3=''
463 d_fpathconf=''
464 d_pathconf=''
465 d_pause=''
466 d_pipe=''
467 d_poll=''
468 d_portable=''
469 d_old_pthread_create_joinable=''
470 old_pthread_create_joinable=''
471 d_pthread_yield=''
472 d_sched_yield=''
473 sched_yield=''
474 d_qgcvt=''
475 d_readdir=''
476 d_rewinddir=''
477 d_seekdir=''
478 d_telldir=''
479 d_readlink=''
480 d_readv=''
481 d_realpath=''
482 d_recvmsg=''
483 d_rename=''
484 d_rmdir=''
485 d_safebcpy=''
486 d_safemcpy=''
487 d_sanemcmp=''
488 d_sbrkproto=''
489 d_select=''
490 d_sem=''
491 d_semctl=''
492 d_semget=''
493 d_semop=''
494 d_sendmsg=''
495 d_setegid=''
496 d_seteuid=''
497 d_setgrent=''
498 d_setgrps=''
499 d_sethent=''
500 d_setitimer=''
501 d_setlinebuf=''
502 d_setlocale=''
503 d_setnent=''
504 d_setpent=''
505 d_setpgid=''
506 d_setpgrp2=''
507 d_bsdsetpgrp=''
508 d_setpgrp=''
509 d_setprior=''
510 d_setproctitle=''
511 d_setpwent=''
512 d_setregid=''
513 d_setresgid=''
514 d_setresuid=''
515 d_setreuid=''
516 d_setrgid=''
517 d_setruid=''
518 d_setsent=''
519 d_setsid=''
520 d_setvbuf=''
521 d_sfio=''
522 usesfio=''
523 d_shm=''
524 d_shmat=''
525 d_shmatprototype=''
526 shmattype=''
527 d_shmctl=''
528 d_shmdt=''
529 d_shmget=''
530 d_sigaction=''
531 d_sigprocmask=''
532 d_sigsetjmp=''
533 d_sockatmark=''
534 d_msg_ctrunc=''
535 d_msg_dontroute=''
536 d_msg_oob=''
537 d_msg_peek=''
538 d_msg_proxy=''
539 d_oldsock=''
540 d_scm_rights=''
541 d_socket=''
542 d_sockpair=''
543 sockethdr=''
544 socketlib=''
545 d_socklen_t=''
546 d_socks5_init=''
547 d_sqrtl=''
548 d_sresuproto=''
549 d_statblks=''
550 d_statfs_f_flags=''
551 d_statfs_s=''
552 d_fstatvfs=''
553 d_statvfs=''
554 d_stdio_cnt_lval=''
555 d_stdio_ptr_lval=''
556 d_stdio_ptr_lval_nochange_cnt=''
557 d_stdio_ptr_lval_sets_cnt=''
558 d_stdiobase=''
559 d_stdstdio=''
560 stdio_base=''
561 stdio_bufsiz=''
562 stdio_cnt=''
563 stdio_filbuf=''
564 stdio_ptr=''
565 d_index=''
566 d_strchr=''
567 d_strcoll=''
568 d_strctcpy=''
569 d_strerrm=''
570 d_strerror=''
571 d_sysernlst=''
572 d_syserrlst=''
573 d_strftime=''
574 d_strtod=''
575 d_strtol=''
576 d_strtold=''
577 d_strtoll=''
578 d_strtoq=''
579 d_strtoul=''
580 d_strtoull=''
581 d_strtouq=''
582 d_strxfrm=''
583 d_symlink=''
584 d_syscall=''
585 d_sysconf=''
586 d_system=''
587 d_tcgetpgrp=''
588 d_tcsetpgrp=''
589 d_telldirproto=''
590 d_time=''
591 timetype=''
592 clocktype=''
593 d_times=''
594 d_truncate=''
595 d_tzname=''
596 d_u32align=''
597 d_ualarm=''
598 d_umask=''
599 d_semctl_semid_ds=''
600 d_semctl_semun=''
601 d_union_semun=''
602 d_usleep=''
603 d_ustat=''
604 d_vfork=''
605 usevfork=''
606 d_voidsig=''
607 signal_t=''
608 d_volatile=''
609 d_charvspr=''
610 d_vprintf=''
611 d_wait4=''
612 d_waitpid=''
613 d_wcstombs=''
614 d_wctomb=''
615 d_writev=''
616 dlext=''
617 cccdlflags=''
618 ccdlflags=''
619 dlsrc=''
620 ld=''
621 lddlflags=''
622 usedl=''
623 doublesize=''
624 ebcdic=''
625 fflushNULL=''
626 fflushall=''
627 fpossize=''
628 fpostype=''
629 gccosandvers=''
630 gccversion=''
631 gidformat=''
632 gidsign=''
633 gidsize=''
634 gidtype=''
635 groupstype=''
636 h_fcntl=''
637 h_sysfile=''
638 i_arpainet=''
639 db_hashtype=''
640 db_prefixtype=''
641 db_version_major=''
642 db_version_minor=''
643 db_version_patch=''
644 i_db=''
645 i_dbm=''
646 i_rpcsvcdbm=''
647 d_dirnamlen=''
648 direntrytype=''
649 i_dirent=''
650 i_dld=''
651 i_dlfcn=''
652 i_fcntl=''
653 i_float=''
654 i_gdbm=''
655 d_grpasswd=''
656 i_grp=''
657 i_iconv=''
658 i_ieeefp=''
659 i_inttypes=''
660 i_libutil=''
661 i_limits=''
662 i_locale=''
663 i_machcthr=''
664 i_malloc=''
665 i_math=''
666 i_memory=''
667 i_mntent=''
668 i_ndbm=''
669 i_netdb=''
670 i_neterrno=''
671 i_netinettcp=''
672 i_niin=''
673 i_sysin=''
674 i_poll=''
675 i_prot=''
676 i_pthread=''
677 d_pwage=''
678 d_pwchange=''
679 d_pwclass=''
680 d_pwcomment=''
681 d_pwexpire=''
682 d_pwgecos=''
683 d_pwpasswd=''
684 d_pwquota=''
685 i_pwd=''
686 i_sfio=''
687 i_shadow=''
688 i_socks=''
689 i_stddef=''
690 i_stdlib=''
691 i_string=''
692 strings=''
693 i_sunmath=''
694 i_sysaccess=''
695 i_sysdir=''
696 i_sysfile=''
697 d_voidtty=''
698 i_bsdioctl=''
699 i_sysfilio=''
700 i_sysioctl=''
701 i_syssockio=''
702 i_syslog=''
703 i_sysmman=''
704 i_sysmode=''
705 i_sysmount=''
706 i_sysndir=''
707 i_sysparam=''
708 i_sysresrc=''
709 i_syssecrt=''
710 i_sysselct=''
711 i_sysstat=''
712 i_sysstatfs=''
713 i_sysstatvfs=''
714 i_systimes=''
715 i_systypes=''
716 i_sysuio=''
717 i_sysun=''
718 i_sysutsname=''
719 i_sysvfs=''
720 i_syswait=''
721 i_sgtty=''
722 i_termio=''
723 i_termios=''
724 i_systime=''
725 i_systimek=''
726 i_time=''
727 timeincl=''
728 i_unistd=''
729 i_ustat=''
730 i_utime=''
731 i_values=''
732 i_stdarg=''
733 i_varargs=''
734 i_varhdr=''
735 i_vfork=''
736 inc_version_list=''
737 inc_version_list_init=''
738 installprefix=''
739 installprefixexp=''
740 installstyle=''
741 installusrbinperl=''
742 intsize=''
743 longsize=''
744 shortsize=''
745 issymlink=''
746 libc=''
747 ldlibpthname=''
748 libperl=''
749 shrpenv=''
750 useshrplib=''
751 glibpth=''
752 libpth=''
753 loclibpth=''
754 plibpth=''
755 xlibpth=''
756 ignore_versioned_solibs=''
757 libs=''
758 libsdirs=''
759 libsfiles=''
760 libsfound=''
761 libspath=''
762 lns=''
763 d_PRIEUldbl=''
764 d_PRIFUldbl=''
765 d_PRIGUldbl=''
766 d_PRIeldbl=''
767 d_PRIfldbl=''
768 d_PRIgldbl=''
769 d_SCNfldbl=''
770 sPRIEUldbl=''
771 sPRIFUldbl=''
772 sPRIGUldbl=''
773 sPRIeldbl=''
774 sPRIfldbl=''
775 sPRIgldbl=''
776 sSCNfldbl=''
777 lseeksize=''
778 lseektype=''
779 make_set_make=''
780 d_mymalloc=''
781 freetype=''
782 mallocobj=''
783 mallocsrc=''
784 malloctype=''
785 usemymalloc=''
786 installman1dir=''
787 man1dir=''
788 man1direxp=''
789 man1ext=''
790 installman3dir=''
791 man3dir=''
792 man3direxp=''
793 man3ext=''
794 modetype=''
795 multiarch=''
796 mydomain=''
797 myhostname=''
798 phostname=''
799 c=''
800 n=''
801 d_eofnblk=''
802 eagain=''
803 o_nonblock=''
804 rd_nodata=''
805 need_va_copy=''
806 netdb_hlen_type=''
807 netdb_host_type=''
808 netdb_name_type=''
809 netdb_net_type=''
810 groupcat=''
811 hostcat=''
812 passcat=''
813 orderlib=''
814 ranlib=''
815 d_perl_otherlibdirs=''
816 otherlibdirs=''
817 package=''
818 spackage=''
819 pager=''
820 api_revision=''
821 api_subversion=''
822 api_version=''
823 api_versionstring=''
824 patchlevel=''
825 perl_patchlevel=''
826 revision=''
827 subversion=''
828 version=''
829 perl5=''
830 perladmin=''
831 perlpath=''
832 d_nv_preserves_uv=''
833 d_nv_preserves_uv_bits=''
834 i16size=''
835 i16type=''
836 i32size=''
837 i32type=''
838 i64size=''
839 i64type=''
840 i8size=''
841 i8type=''
842 ivsize=''
843 ivtype=''
844 nvsize=''
845 nvtype=''
846 u16size=''
847 u16type=''
848 u32size=''
849 u32type=''
850 u64size=''
851 u64type=''
852 u8size=''
853 u8type=''
854 uvsize=''
855 uvtype=''
856 ivdformat=''
857 nvEUformat=''
858 nvFUformat=''
859 nvGUformat=''
860 nveformat=''
861 nvfformat=''
862 nvgformat=''
863 uvXUformat=''
864 uvoformat=''
865 uvuformat=''
866 uvxformat=''
867 pidtype=''
868 prefix=''
869 prefixexp=''
870 installprivlib=''
871 privlib=''
872 privlibexp=''
873 prototype=''
874 ptrsize=''
875 d_PRIXU64=''
876 d_PRId64=''
877 d_PRIi64=''
878 d_PRIo64=''
879 d_PRIu64=''
880 d_PRIx64=''
881 sPRIXU64=''
882 sPRId64=''
883 sPRIi64=''
884 sPRIo64=''
885 sPRIu64=''
886 sPRIx64=''
887 d_quad=''
888 quadkind=''
889 quadtype=''
890 uquadtype=''
891 drand01=''
892 randbits=''
893 randfunc=''
894 randseedtype=''
895 seedfunc=''
896 installscript=''
897 scriptdir=''
898 scriptdirexp=''
899 selectminbits=''
900 selecttype=''
901 sh=''
902 sig_count=''
903 sig_name=''
904 sig_name_init=''
905 sig_num=''
906 sig_num_init=''
907 sig_size=''
908 installsitearch=''
909 sitearch=''
910 sitearchexp=''
911 installsitebin=''
912 sitebin=''
913 sitebinexp=''
914 installsitelib=''
915 sitelib=''
916 sitelib_stem=''
917 sitelibexp=''
918 siteprefix=''
919 siteprefixexp=''
920 sizesize=''
921 sizetype=''
922 so=''
923 socksizetype=''
924 sharpbang=''
925 shsharp=''
926 spitshell=''
927 src=''
928 ssizetype=''
929 startperl=''
930 startsh=''
931 stdchar=''
932 d_stdio_stream_array=''
933 stdio_stream_array=''
934 sysman=''
935 trnl=''
936 uidformat=''
937 uidsign=''
938 uidsize=''
939 uidtype=''
940 archname64=''
941 use64bitall=''
942 use64bitint=''
943 ccflags_uselargefiles=''
944 ldflags_uselargefiles=''
945 libswanted_uselargefiles=''
946 uselargefiles=''
947 uselongdouble=''
948 usemorebits=''
949 usemultiplicity=''
950 nm_opt=''
951 nm_so_opt=''
952 runnm=''
953 usenm=''
954 useperlio=''
955 usesocks=''
956 d_oldpthreads=''
957 use5005threads=''
958 useithreads=''
959 usethreads=''
960 incpath=''
961 mips_type=''
962 usrinc=''
963 d_vendorarch=''
964 installvendorarch=''
965 vendorarch=''
966 vendorarchexp=''
967 d_vendorbin=''
968 installvendorbin=''
969 vendorbin=''
970 vendorbinexp=''
971 d_vendorlib=''
972 installvendorlib=''
973 vendorlib=''
974 vendorlib_stem=''
975 vendorlibexp=''
976 usevendorprefix=''
977 vendorprefix=''
978 vendorprefixexp=''
979 versiononly=''
980 defvoidused=''
981 voidflags=''
982 pm_apiversion=''
983 xs_apiversion=''
984 yacc=''
985 yaccflags=''
986 CONFIG=''
987
988 define='define'
989 undef='undef'
990 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
991 rmlist=''
992
993 : We must find out about Eunice early
994 eunicefix=':'
995 if test -f /etc/unixtovms; then
996         eunicefix=/etc/unixtovms
997 fi
998 if test -f /etc/unixtovms.exe; then
999         eunicefix=/etc/unixtovms.exe
1000 fi
1001
1002 i_whoami=''
1003 ccname=''
1004 ccversion=''
1005 perllibs=''
1006 : set useposix=false in your hint file to disable the POSIX extension.
1007 useposix=true
1008 : set useopcode=false in your hint file to disable the Opcode extension.
1009 useopcode=true
1010 : Trailing extension.  Override this in a hint file, if needed.
1011 _exe=''
1012 : Extra object files, if any, needed on this platform.
1013 archobjs=''
1014 archname=''
1015 : Possible local include directories to search.
1016 : Set locincpth to "" in a hint file to defeat local include searches.
1017 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1018 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1019 :
1020 : no include file wanted by default
1021 inclwanted=''
1022
1023 groupstype=''
1024 : change the next line if compiling for Xenix/286 on Xenix/386
1025 xlibpth='/usr/lib/386 /lib/386'
1026 : Possible local library directories to search.
1027 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1028 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1029
1030 : general looking path for locating libraries
1031 glibpth="/lib /usr/lib $xlibpth"
1032 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1033 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1034 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
1035
1036 : Private path used by Configure to find libraries.  Its value
1037 : is prepended to libpth. This variable takes care of special
1038 : machines, like the mips.  Usually, it should be empty.
1039 plibpth=''
1040
1041 : default library list
1042 libswanted=''
1043 : some systems want to use only the non-versioned libso:s
1044 ignore_versioned_solibs=''
1045 archname64=''
1046 ccflags_uselargefiles=''
1047 ldflags_uselargefiles=''
1048 libswanted_uselargefiles=''
1049 : set usemultiplicity on the Configure command line to enable multiplicity.
1050 : set usesocks on the Configure command line to enable socks.
1051 : set usethreads on the Configure command line to enable threads.
1052 : full support for void wanted by default
1053 defvoidused=15
1054
1055 : List of libraries we want.
1056 : If anyone needs -lnet, put it in a hint file.
1057 libswanted='sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl'
1058 libswanted="$libswanted dld ld sun m c cposix posix"
1059 libswanted="$libswanted ndir dir crypt sec"
1060 libswanted="$libswanted ucb bsd BSD PW x iconv util"
1061 : We probably want to search /usr/shlib before most other libraries.
1062 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1063 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1064 glibpth="/usr/shlib $glibpth"
1065 : Do not use vfork unless overridden by a hint file.
1066 usevfork=false
1067
1068 : Find the basic shell for Bourne shell scripts
1069 case "$sh" in
1070 '')
1071         case "$SYSTYPE" in
1072         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1073         *) xxx='/bin/sh';;
1074         esac
1075         if test -f "$xxx"; then
1076                 sh="$xxx"
1077         else
1078                 : Build up a list and do a single loop so we can 'break' out.
1079                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1080                 for xxx in sh bash ksh pdksh ash; do
1081                         for p in $pth; do
1082                                 try="$try ${p}/${xxx}"
1083                         done
1084                 done
1085                 for xxx in $try; do
1086                         if test -f "$xxx"; then
1087                                 sh="$xxx";
1088                                 break
1089                         elif test -f "$xxx.exe"; then
1090                                 sh="$xxx";
1091                                 break
1092                         fi
1093                 done
1094         fi
1095         ;;
1096 esac
1097
1098 case "$sh" in
1099 '')     cat <<EOM >&2
1100 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
1101
1102 Usually it's in /bin/sh.  How did you even get this far?
1103 Please contact me (Perl Maintainers) at perlbug@perl.org and 
1104 we'll try to straighten this all out.
1105 EOM
1106         exit 1
1107         ;;
1108 esac
1109
1110 : see if sh knows # comments
1111 if `$sh -c '#' >/dev/null 2>&1`; then
1112         shsharp=true
1113         spitshell=cat
1114         xcat=/bin/cat
1115         test -f $xcat || xcat=/usr/bin/cat
1116         echo "#!$xcat" >try
1117         $eunicefix try
1118         chmod +x try
1119         ./try > today
1120         if test -s today; then
1121                 sharpbang='#!'
1122         else
1123                 echo "#! $xcat" > try
1124                 $eunicefix try
1125                 chmod +x try
1126                 ./try > today
1127                 if test -s today; then
1128                         sharpbang='#! '
1129                 else
1130                         sharpbang=': use '
1131                 fi
1132         fi
1133 else
1134         echo " "
1135         echo "Your $sh doesn't grok # comments--I will strip them later on."
1136         shsharp=false
1137         cd ..
1138         echo "exec grep -v '^[  ]*#'" >spitshell
1139         chmod +x spitshell
1140         $eunicefix spitshell
1141         spitshell=`pwd`/spitshell
1142         cd UU
1143         echo "I presume that if # doesn't work, #! won't work either!"
1144         sharpbang=': use '
1145 fi
1146 rm -f try today
1147
1148 : figure out how to guarantee sh startup
1149 case "$startsh" in
1150 '') startsh=${sharpbang}${sh} ;;
1151 *)
1152 esac
1153 cat >try <<EOSS
1154 $startsh
1155 set abc
1156 test "$?abc" != 1
1157 EOSS
1158
1159 chmod +x try
1160 $eunicefix try
1161 if ./try; then
1162         : echo "Yup, it does."
1163 else
1164         echo "Hmm... '$startsh' does not guarantee sh startup..."
1165         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1166 fi
1167 rm -f try
1168
1169
1170 : Save command line options in file UU/cmdline.opt for later use in
1171 : generating config.sh.
1172 cat > cmdline.opt <<EOSH
1173 # Configure command line arguments.
1174 config_arg0='$0'
1175 config_args='$*'
1176 config_argc=$#
1177 EOSH
1178 argn=1
1179 for arg in "$@"; do
1180         cat >>cmdline.opt <<EOSH
1181 config_arg$argn='$arg'
1182 EOSH
1183         argn=`expr $argn + 1`
1184 done
1185
1186 : produce awk script to parse command line options
1187 cat >options.awk <<'EOF'
1188 BEGIN {
1189         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1190
1191         len = length(optstr);
1192         for (i = 1; i <= len; i++) {
1193                 c = substr(optstr, i, 1);
1194                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1195                 if (a == ":") {
1196                         arg[c] = 1;
1197                         i++;
1198                 }
1199                 opt[c] = 1;
1200         }
1201 }
1202 {
1203         expect = 0;
1204         str = $0;
1205         if (substr(str, 1, 1) != "-") {
1206                 printf("'%s'\n", str);
1207                 next;
1208         }
1209         len = length($0);
1210         for (i = 2; i <= len; i++) {
1211                 c = substr(str, i, 1);
1212                 if (!opt[c]) {
1213                         printf("-%s\n", substr(str, i));
1214                         next;
1215                 }
1216                 printf("-%s\n", c);
1217                 if (arg[c]) {
1218                         if (i < len)
1219                                 printf("'%s'\n", substr(str, i + 1));
1220                         else
1221                                 expect = 1;
1222                         next;
1223                 }
1224         }
1225 }
1226 END {
1227         if (expect)
1228                 print "?";
1229 }
1230 EOF
1231
1232 : process the command line options
1233 set X `for arg in "$@"; do echo "X$arg"; done |
1234         sed -e s/X// | awk -f options.awk`
1235 eval "set $*"
1236 shift
1237 rm -f options.awk
1238
1239 : set up default values
1240 fastread=''
1241 reuseval=false
1242 config_sh=''
1243 alldone=''
1244 error=''
1245 silent=''
1246 extractsh=''
1247 override=''
1248 knowitall=''
1249 rm -f optdef.sh posthint.sh
1250 cat >optdef.sh <<EOS
1251 $startsh
1252 EOS
1253
1254
1255 : option parsing
1256 while test $# -gt 0; do
1257         case "$1" in
1258         -d) shift; fastread=yes;;
1259         -e) shift; alldone=cont;;
1260         -f)
1261                 shift
1262                 cd ..
1263                 if test -r "$1"; then
1264                         config_sh="$1"
1265                 else
1266                         echo "$me: cannot read config file $1." >&2
1267                         error=true
1268                 fi
1269                 cd UU
1270                 shift;;
1271         -h) shift; error=true;;
1272         -r) shift; reuseval=true;;
1273         -s) shift; silent=true; realsilent=true;;
1274         -E) shift; alldone=exit;;
1275         -K) shift; knowitall=true;;
1276         -O) shift; override=true;;
1277         -S) shift; silent=true; extractsh=true;;
1278         -D)
1279                 shift
1280                 case "$1" in
1281                 *=)
1282                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1283                         echo "$me: ignoring -D $1" >&2
1284                         ;;
1285                 *=*) echo "$1" | \
1286                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1287                 *) echo "$1='define'" >> optdef.sh;;
1288                 esac
1289                 shift
1290                 ;;
1291         -U)
1292                 shift
1293                 case "$1" in
1294                 *=) echo "$1" >> optdef.sh;;
1295                 *=*)
1296                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1297                         echo "$me: ignoring -U $1" >&2
1298                         ;;
1299                 *) echo "$1='undef'" >> optdef.sh;;
1300                 esac
1301                 shift
1302                 ;;
1303         -A)
1304             shift
1305             xxx=''
1306             yyy="$1"
1307             zzz=''
1308             uuu=undef
1309             case "$yyy" in
1310             *=*) zzz=`echo $yyy|sed 's!=.*!!'`
1311                  case "$zzz" in
1312                  *:*) zzz='' ;;
1313                  *)   xxx=append
1314                       zzz=" "`echo $yyy|sed 's!^[^=]*=!!'` 
1315                       yyy=`echo $yyy|sed 's!=.*!!'` ;;
1316                  esac
1317                  ;;
1318             esac
1319             case "$xxx" in
1320             '')  case "$yyy" in
1321                  *:*) xxx=`echo $yyy|sed 's!:.*!!'`
1322                       yyy=`echo $yyy|sed 's!^[^:]*:!!'`
1323                       zzz=`echo $yyy|sed 's!^[^=]*=!!'`
1324                       yyy=`echo $yyy|sed 's!=.*!!'` ;;
1325                  *)   xxx=`echo $yyy|sed 's!:.*!!'`
1326                       yyy=`echo $yyy|sed 's!^[^:]*:!!'` ;;
1327                  esac
1328                  ;;       
1329             esac
1330             case "$xxx" in
1331             append)
1332                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1333             clear)
1334                 echo "$yyy=''"                  >> posthint.sh ;;
1335             define)
1336                 case "$zzz" in
1337                 '') zzz=define ;;
1338                 esac
1339                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1340             eval)
1341                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1342             prepend)
1343                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1344             undef)
1345                 case "$zzz" in
1346                 '') zzz="$uuu" ;;
1347                 esac
1348                 echo "$yyy=$zzz"                >> posthint.sh ;;
1349             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1350             esac
1351             shift
1352             ;;
1353         -V) echo "$me generated by metaconfig 3.0 PL70." >&2
1354             exit 0;;
1355         --) break;;
1356         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1357         *) break;;
1358         esac
1359 done
1360
1361 case "$error" in
1362 true)
1363         cat >&2 <<EOM
1364 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1365                  [-U symbol] [-U symbol=] [-A command:symbol...]
1366   -d : use defaults for all answers.
1367   -e : go on without questioning past the production of config.sh.
1368   -f : specify an alternate default configuration file.
1369   -h : print this help message and exit (with an error status).
1370   -r : reuse C symbols value if possible (skips costly nm extraction).
1371   -s : silent mode, only echoes questions and essential information.
1372   -D : define symbol to have some value:
1373          -D symbol         symbol gets the value 'define'
1374          -D symbol=value   symbol gets the value 'value'
1375   -E : stop at the end of questions, after having produced config.sh.
1376   -K : do not use unless you know what you are doing.
1377   -O : let -D and -U override definitions from loaded configuration file.
1378   -S : perform variable substitutions on all .SH files (can mix with -f)
1379   -U : undefine symbol:
1380          -U symbol    symbol gets the value 'undef'
1381          -U symbol=   symbol gets completely empty
1382   -A : manipulate symbol after the platform specific hints have been applied:
1383          -A symbol=value                append " "value to symbol
1384          -A append:symbol=value         append value to symbol
1385          -A define:symbol=value         define symbol to have value
1386          -A clear:symbol                define symbol to be ''
1387          -A define:symbol               define symbol to be 'define'
1388          -A eval:symbol=value           define symbol to be eval of value
1389          -A prepend:symbol=value        prepend value to symbol
1390          -A undef:symbol                define symbol to be 'undef'
1391          -A undef:symbol=               define symbol to be ''
1392   -V : print version number and exit (with a zero status).
1393 EOM
1394         exit 1
1395         ;;
1396 esac
1397
1398 : Sanity checks
1399 case "$fastread$alldone" in
1400 yescont|yesexit) ;;
1401 *)
1402         case "$extractsh" in
1403         true) ;;
1404         *)
1405                 if test ! -t 0; then
1406                         echo "Say 'sh Configure', not 'sh <Configure'"
1407                         exit 1
1408                 fi
1409                 ;;
1410         esac
1411         ;;
1412 esac
1413
1414 exec 4>&1
1415 case "$silent" in
1416 true) exec 1>/dev/null;;
1417 esac
1418
1419 : run the defines and the undefines, if any, but leave the file out there...
1420 touch optdef.sh
1421 . ./optdef.sh
1422 : create the posthint manipulation script and leave the file out there...
1423 touch posthint.sh
1424
1425 : set package name
1426 package=perl5
1427 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1428 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1429 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1430 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1431 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1432 esac
1433
1434 : Some greps do not return status, grrr.
1435 echo "grimblepritz" >grimble
1436 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1437         contains=contains
1438 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1439         contains=grep
1440 else
1441         contains=contains
1442 fi
1443 rm -f grimble
1444 : the following should work in any shell
1445 case "$contains" in
1446 contains*)
1447         echo " "
1448         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1449         cat >contains <<'EOSS'
1450 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1451 EOSS
1452 chmod +x contains
1453 esac
1454
1455 : Find the path to the source tree
1456 case "$src" in
1457 '') case "$0" in
1458     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1459          case "$src" in
1460          /*)    ;;
1461          .)     ;;
1462          *)     src=`cd ../$src && pwd` ;;
1463          esac
1464          ;;
1465     *)   src='.';;
1466     esac;;
1467 esac
1468 case "$src" in
1469 '')     src=/
1470         rsrc=/
1471         ;;
1472 /*) rsrc="$src";;
1473 *) rsrc="../$src";;
1474 esac
1475 if test -f $rsrc/Configure && \
1476         $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1477 then
1478    : found it, so we are ok.
1479 else
1480         rsrc=''
1481         for src in . .. ../.. ../../.. ../../../..; do
1482                 if test -f ../$src/Configure && \
1483                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1484                 then
1485                         rsrc=../$src
1486                         break
1487                 fi
1488         done
1489 fi
1490 case "$rsrc" in
1491 '')
1492         cat <<EOM >&4
1493
1494 Sorry, I can't seem to locate the source dir for $package.  Please start
1495 Configure with an explicit path -- i.e. /some/path/Configure.
1496
1497 EOM
1498         exit 1
1499         ;;
1500 ../.)   rsrc='..';;
1501 *)
1502         echo " "
1503         echo "Sources for $package found in \"$src\"." >&4
1504         ;;
1505 esac
1506
1507 : script used to extract .SH files with variable substitutions
1508 cat >extract <<'EOS'
1509 PERL_CONFIG_SH=true
1510 echo "Doing variable substitutions on .SH files..."
1511 if test -f $src/MANIFEST; then
1512         set x `awk '{print $1}' <$src/MANIFEST | grep '\.SH$'`
1513 else
1514         echo "(Looking for .SH files under the source directory.)"
1515         set x `(cd $src; find . -name "*.SH" -print)`
1516 fi
1517 shift
1518 case $# in
1519 0) set x `(cd $src; echo *.SH)`; shift;;
1520 esac
1521 if test ! -f $src/$1; then
1522         shift
1523 fi
1524 mkdir_p='
1525 name=$1;
1526 create="";
1527 while test $name; do
1528         if test ! -d "$name"; then
1529                 create="$name $create";
1530                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1531                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1532         else
1533                 name="";
1534         fi;
1535 done;
1536 for file in $create; do
1537         mkdir $file;
1538 done
1539 '
1540 for file in $*; do
1541         case "$src" in
1542         ".")
1543                 case "$file" in
1544                 */*)
1545                         dir=`expr X$file : 'X\(.*\)/'`
1546                         file=`expr X$file : 'X.*/\(.*\)'`
1547                         (cd $dir && . ./$file)
1548                         ;;
1549                 *)
1550                         . ./$file
1551                         ;;
1552                 esac
1553                 ;;
1554         *)
1555                 case "$file" in
1556                 */*)
1557                         dir=`expr X$file : 'X\(.*\)/'`
1558                         file=`expr X$file : 'X.*/\(.*\)'`
1559                         (set x $dir; shift; eval $mkdir_p)
1560                         sh <$src/$dir/$file
1561                         ;;
1562                 *)
1563                         sh <$src/$file
1564                         ;;
1565                 esac
1566                 ;;
1567         esac
1568 done
1569 if test -f $src/config_h.SH; then
1570         if test ! -f config.h; then
1571         : oops, they left it out of MANIFEST, probably, so do it anyway.
1572         . $src/config_h.SH
1573         fi
1574 fi
1575 EOS
1576
1577 : extract files and exit if asked to do so
1578 case "$extractsh" in
1579 true)
1580         case "$realsilent" in
1581         true) ;;
1582         *) exec 1>&4;;
1583         esac
1584         case "$config_sh" in
1585         '') config_sh='config.sh';;
1586         esac
1587         echo " "
1588         echo "Fetching answers from $config_sh..."
1589         cd ..
1590         . $config_sh
1591         test "$override" && . ./optdef.sh
1592         echo " "
1593         . UU/extract
1594         rm -rf UU
1595         echo "Done."
1596         exit 0
1597         ;;
1598 esac
1599
1600 : Eunice requires " " instead of "", can you believe it
1601 echo " "
1602 : Here we go...
1603 echo "Beginning of configuration questions for $package."
1604
1605 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1606
1607 : first determine how to suppress newline on echo command
1608 echo " "
1609 echo "Checking echo to see how to suppress newlines..."
1610 (echo "hi there\c" ; echo " ") >.echotmp
1611 if $contains c .echotmp >/dev/null 2>&1 ; then
1612         echo "...using -n."
1613         n='-n'
1614         c=''
1615 else
1616         cat <<'EOM'
1617 ...using \c
1618 EOM
1619         n=''
1620         c='\c'
1621 fi
1622 echo $n "The star should be here-->$c"
1623 echo '*'
1624 rm -f .echotmp
1625
1626 : Now test for existence of everything in MANIFEST
1627 echo " "
1628 if test -f $rsrc/MANIFEST; then
1629         echo "First let's make sure your kit is complete.  Checking..." >&4
1630         awk '$1 !~ /PACK[A-Z]+/ {print $1}' $rsrc/MANIFEST | split -50
1631         rm -f missing
1632         tmppwd=`pwd`
1633         for filelist in x??; do
1634                 (cd $rsrc; ls `cat $tmppwd/$filelist` >/dev/null 2>>$tmppwd/missing)
1635         done
1636         if test -s missing; then
1637                 cat missing >&4
1638                 cat >&4 <<'EOM'
1639
1640 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1641
1642 You have the option of continuing the configuration process, despite the
1643 distinct possibility that your kit is damaged, by typing 'y'es.  If you
1644 do, don't blame me if something goes wrong.  I advise you to type 'n'o
1645 and contact the author (perlbug@perl.org).
1646
1647 EOM
1648                 echo $n "Continue? [n] $c" >&4
1649                 read ans
1650                 case "$ans" in
1651                 y*)
1652                         echo "Continuing..." >&4
1653                         rm -f missing
1654                         ;;
1655                 *)
1656                         echo "ABORTING..." >&4
1657                         kill $$
1658                         ;;
1659                 esac
1660         else
1661                 echo "Looks good..."
1662         fi
1663 else
1664         echo "There is no MANIFEST file.  I hope your kit is complete !"
1665 fi
1666 rm -f missing x??
1667
1668 echo " "
1669 : Find the appropriate value for a newline for tr
1670 if test -n "$DJGPP"; then
1671        trnl='\012'
1672 fi
1673 if test X"$trnl" = X; then
1674         case "`echo foo|tr '\n' x 2>/dev/null`" in
1675         foox) trnl='\n' ;;
1676         esac
1677 fi
1678 if test X"$trnl" = X; then
1679         case "`echo foo|tr '\012' x 2>/dev/null`" in
1680         foox) trnl='\012' ;;
1681         esac
1682 fi
1683 if test X"$trnl" = X; then
1684         cat <<EOM >&2
1685
1686 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
1687
1688 EOM
1689         exit 1
1690 fi
1691
1692 : compute the number of columns on the terminal for proper question formatting
1693 case "$COLUMNS" in
1694 '') COLUMNS='80';;
1695 esac
1696
1697 : set up the echo used in my read
1698 myecho="case \"\$xxxm\" in
1699 '') echo $n \"\$rp $c\" >&4;;
1700 *) case \"\$rp\" in
1701         '') echo $n \"[\$xxxm] $c\";;
1702         *)
1703                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
1704                         echo \"\$rp\" >&4
1705                         echo $n \"[\$xxxm] $c\" >&4
1706                 else
1707                         echo $n \"\$rp [\$xxxm] $c\" >&4
1708                 fi
1709                 ;;
1710         esac;;
1711 esac"
1712
1713 : now set up to do reads with possible shell escape and default assignment
1714 cat <<EOSC >myread
1715 $startsh
1716 xxxm=\$dflt
1717 $myecho
1718 ans='!'
1719 case "\$fastread" in
1720 yes) case "\$dflt" in
1721         '') ;;
1722         *) ans='';
1723                 case "\$silent-\$rp" in
1724                 true-) ;;
1725                 *) echo " " >&4;;
1726                 esac;;
1727         esac;;
1728 *) case "\$silent" in
1729         true) case "\$rp" in
1730                 '') ans='';;
1731                 esac;;
1732         esac;;
1733 esac
1734 while expr "X\$ans" : "X!" >/dev/null; do
1735         read answ
1736         set x \$xxxm
1737         shift
1738         aok=''; eval "ans=\\"\$answ\\"" && aok=y
1739         case  "\$answ" in
1740         "!")
1741                 sh 1>&4
1742                 echo " "
1743                 $myecho
1744                 ;;
1745         !*)
1746                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
1747                 shift
1748                 sh 1>&4 -c "\$*"
1749                 echo " "
1750                 $myecho
1751                 ;;
1752         "\$ans")
1753                 case "\$ans" in
1754                 \\&*)
1755                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
1756                         shift
1757                         case "\$1" in
1758                         -d)
1759                                 fastread=yes
1760                                 echo "(OK, I'll run with -d after this question.)" >&4
1761                                 ;;
1762                         -*)
1763                                 echo "*** Sorry, \$1 not supported yet." >&4
1764                                 ;;
1765                         esac
1766                         $myecho
1767                         ans=!
1768                         ;;
1769                 esac;;
1770         *)
1771                 case "\$aok" in
1772                 y)
1773                         echo "*** Substitution done -- please confirm."
1774                         xxxm="\$ans"
1775                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
1776                         xxxm="\$ans"
1777                         ans=!
1778                         ;;
1779                 *)
1780                         echo "*** Error -- try again."
1781                         ans=!
1782                         ;;
1783                 esac
1784                 $myecho
1785                 ;;
1786         esac
1787         case "\$ans\$xxxm\$nostick" in
1788         '')
1789                 ans=!
1790                 $myecho
1791                 ;;
1792         esac
1793 done
1794 case "\$ans" in
1795 '') ans="\$xxxm";;
1796 esac
1797 EOSC
1798
1799 : create .config dir to save info across Configure sessions
1800 test -d ../.config || mkdir ../.config
1801 cat >../.config/README <<EOF
1802 This directory created by Configure to save information that should
1803 persist across sessions for $package.
1804
1805 You may safely delete it if you wish.
1806 EOF
1807
1808 xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
1809 case "$usedevel" in
1810 $define|true|[yY]*) ;;
1811 *) case "$xversion" in
1812    *[13579])
1813         cat >&4 <<EOH
1814 *** WHOA THERE!!! ***
1815
1816     This is an UNSTABLE DEVELOPMENT release.
1817     The version of this $package distribution is $xversion, that is, odd,
1818     (as opposed to even) and that signifies a development release.
1819     If you want a maintenance release, you want an even-numbered version.
1820
1821     Do ***NOT*** install this into production use.
1822     Data corruption and crashes are possible.
1823
1824     It is most seriously suggested that you do not continue any further
1825     unless you want to help in developing and debugging Perl.
1826
1827     If you *still* want to build perl, you can answer 'y' now,
1828     or pass -Dusedevel to Configure.
1829
1830 EOH
1831         rp='Do you really want to continue?'
1832         dflt='n'
1833         . ./myread
1834         case "$ans" in
1835         [yY]) echo >&4 "Okay, continuing."
1836               usedevel="$define" ;;
1837         *) echo >&4 "Okay, bye."
1838            exit 1
1839            ;;
1840         esac
1841         ;;
1842     esac
1843     ;;
1844 esac
1845 case "$usedevel" in
1846 $define|true|[yY]*)
1847         case "$versiononly" in
1848         '') versiononly="$define" ;;
1849         esac
1850         case "$installusrbinperl" in
1851         '') installusrbinperl="$undef" ;;
1852         esac
1853         ;;
1854 esac
1855
1856 : general instructions
1857 needman=true
1858 firsttime=true
1859 user=`(logname) 2>/dev/null`
1860 case "$user" in
1861 '') user=`whoami 2>&1`;;
1862 esac
1863 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
1864         firsttime=false
1865         echo " "
1866         rp='Would you like to see the instructions?'
1867         dflt=n
1868         . ./myread
1869         case "$ans" in
1870         [yY]*) ;;
1871         *) needman=false;;
1872         esac
1873 fi
1874 if $needman; then
1875         cat <<EOH
1876
1877 This installation shell script will examine your system and ask you questions
1878 to determine how the perl5 package should be installed. If you get
1879 stuck on a question, you may use a ! shell escape to start a subshell or
1880 execute a command.  Many of the questions will have default answers in square
1881 brackets; typing carriage return will give you the default.
1882
1883 On some of the questions which ask for file or directory names you are allowed
1884 to use the ~name construct to specify the login directory belonging to "name",
1885 even if you don't have a shell which knows about that.  Questions where this is
1886 allowed will be marked "(~name ok)".
1887
1888 EOH
1889         rp=''
1890         dflt='Type carriage return to continue'
1891         . ./myread
1892         cat <<'EOH'
1893
1894 The prompter used in this script allows you to use shell variables and
1895 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
1896 in the default answer, as if the default line was a set of arguments given to a
1897 script shell.  This means you may also use $* to repeat the whole default line,
1898 so you do not have to re-type everything to add something to the default.
1899
1900 Everytime there is a substitution, you will have to confirm.  If there is an
1901 error (e.g. an unmatched backtick), the default answer will remain unchanged
1902 and you will be prompted again.
1903
1904 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
1905 the questions and use the computed defaults (or the previous answers if there
1906 was already a config.sh file). Type 'Configure -h' for a list of options.
1907 You may also start interactively and then answer '& -d' at any prompt to turn
1908 on the non-interactive behaviour for the remainder of the execution.
1909
1910 EOH
1911         . ./myread
1912         cat <<EOH
1913
1914 Much effort has been expended to ensure that this shell script will run on any
1915 Unix system.  If despite that it blows up on yours, your best bet is to edit
1916 Configure and run it again.  If you can't run Configure for some reason,
1917 you'll have to generate a config.sh file by hand.  Whatever problems you
1918 have, let me (perlbug@perl.org) know how I blew it.
1919
1920 This installation script affects things in two ways:
1921
1922 1) it may do direct variable substitutions on some of the files included
1923    in this kit.
1924 2) it builds a config.h file for inclusion in C programs.  You may edit
1925    any of these files as the need arises after running this script.
1926
1927 If you make a mistake on a question, there is no easy way to back up to it
1928 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
1929 files.  Configure will offer to let you do this before it runs the SH files.
1930
1931 EOH
1932         dflt='Type carriage return to continue'
1933         . ./myread
1934         case "$firsttime" in
1935         true) echo $user >>../.config/instruct;;
1936         esac
1937 fi
1938
1939 : find out where common programs are
1940 echo " "
1941 echo "Locating common programs..." >&4
1942 cat <<EOSC >loc
1943 $startsh
1944 case \$# in
1945 0) exit 1;;
1946 esac
1947 thing=\$1
1948 shift
1949 dflt=\$1
1950 shift
1951 for dir in \$*; do
1952         case "\$thing" in
1953         .)
1954         if test -d \$dir/\$thing; then
1955                 echo \$dir
1956                 exit 0
1957         fi
1958         ;;
1959         *)
1960         for thisthing in \$dir/\$thing; do
1961                 : just loop through to pick last item
1962         done
1963         if test -f \$thisthing; then
1964                 echo \$thisthing
1965                 exit 0
1966         elif test -f \$dir/\$thing.exe; then
1967                 if test -n "$DJGPP"; then
1968                         echo \$dir/\$thing.exe
1969                 else
1970                         : on Eunice apparently
1971                         echo \$dir/\$thing
1972                 fi
1973                 exit 0
1974         fi
1975         ;;
1976         esac
1977 done
1978 echo \$dflt
1979 exit 1
1980 EOSC
1981 chmod +x loc
1982 $eunicefix loc
1983 loclist="
1984 awk
1985 cat
1986 comm
1987 cp
1988 echo
1989 expr
1990 grep
1991 ls
1992 make
1993 mkdir
1994 rm
1995 sed
1996 sort
1997 touch
1998 tr
1999 uniq
2000 "
2001 trylist="
2002 Mcc
2003 ar
2004 bison
2005 byacc
2006 cpp
2007 csh
2008 date
2009 egrep
2010 gzip
2011 less
2012 ln
2013 more
2014 nm
2015 nroff
2016 pg
2017 test
2018 uname
2019 zip
2020 "
2021 pth=`echo $PATH | sed -e "s/$p_/ /g"`
2022 pth="$pth /lib /usr/lib"
2023 for file in $loclist; do
2024         eval xxx=\$$file
2025         case "$xxx" in
2026         /*|?:[\\/]*)
2027                 if test -f "$xxx"; then
2028                         : ok
2029                 else
2030                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2031                         xxx=`./loc $file $file $pth`
2032                 fi
2033                 ;;
2034         '') xxx=`./loc $file $file $pth`;;
2035         *) xxx=`./loc $xxx $xxx $pth`;;
2036         esac
2037         eval $file=$xxx
2038         eval _$file=$xxx
2039         case "$xxx" in
2040         /*)
2041                 echo $file is in $xxx.
2042                 ;;
2043         ?:[\\/]*)
2044                 echo $file is in $xxx.
2045                 ;;
2046         *)
2047                 echo "I don't know where '$file' is, and my life depends on it." >&4
2048                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2049                 exit 1
2050                 ;;
2051         esac
2052 done
2053 echo " "
2054 echo "Don't worry if any of the following aren't found..."
2055 say=offhand
2056 for file in $trylist; do
2057         eval xxx=\$$file
2058         case "$xxx" in
2059         /*|?:[\\/]*)
2060                 if test -f "$xxx"; then
2061                         : ok
2062                 else
2063                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2064                         xxx=`./loc $file $file $pth`
2065                 fi
2066                 ;;
2067         '') xxx=`./loc $file $file $pth`;;
2068         *) xxx=`./loc $xxx $xxx $pth`;;
2069         esac
2070         eval $file=$xxx
2071         eval _$file=$xxx
2072         case "$xxx" in
2073         /*)
2074                 echo $file is in $xxx.
2075                 ;;
2076         ?:[\\/]*)
2077                 echo $file is in $xxx.
2078                 ;;
2079         *)
2080                 echo "I don't see $file out there, $say."
2081                 say=either
2082                 ;;
2083         esac
2084 done
2085 case "$egrep" in
2086 egrep)
2087         echo "Substituting grep for egrep."
2088         egrep=$grep
2089         ;;
2090 esac
2091 case "$ln" in
2092 ln)
2093         echo "Substituting cp for ln."
2094         ln=$cp
2095         ;;
2096 esac
2097 case "$test" in
2098 test)
2099         echo "Hopefully test is built into your sh."
2100         ;;
2101 *)
2102         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2103                 echo "Using the test built into your sh."
2104                 test=test
2105                 _test=test
2106         fi
2107         ;;
2108 esac
2109 case "$echo" in
2110 echo)
2111         echo "Hopefully echo is built into your sh."
2112         ;;
2113 '') ;;
2114 *)
2115         echo " "
2116 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2117         $echo $n "hi there$c" >foo1
2118         echo $n "hi there$c" >foo2
2119         if cmp foo1 foo2 >/dev/null 2>&1; then
2120                 echo "They are compatible.  In fact, they may be identical."
2121         else
2122                 case "$n" in
2123                 '-n') n='' c='\c';;
2124                 *) n='-n' c='';;
2125                 esac
2126                 cat <<FOO
2127 They are not compatible!  You are probably running ksh on a non-USG system.
2128 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2129 have echo built in and we may have to run some Bourne shell scripts.  That
2130 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2131
2132 FOO
2133                 $echo $n "The star should be here-->$c"
2134                 $echo "*"
2135         fi
2136         $rm -f foo1 foo2
2137         ;;
2138 esac
2139
2140 cat <<EOS >checkcc
2141 $startsh
2142 EOS
2143 cat <<'EOSC' >>checkcc
2144 case "$cc" in
2145 '') ;;
2146 *)  $rm -f try try.*
2147     $cat >try.c <<EOM
2148 int main(int argc, char *argv[]) {
2149   return 0;
2150 }
2151 EOM
2152     if $cc -o try $ccflags $ldflags try.c; then
2153        :
2154     else
2155         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2156         despair=yes
2157         trygcc=yes
2158         case "$cc" in
2159         *gcc*) trygcc=no ;;
2160         esac
2161         case "`$cc -v -c try.c 2>&1`" in
2162         *gcc*) trygcc=no ;;
2163         esac
2164         if $test X"$trygcc" = Xyes; then
2165             if gcc -o try -c try.c; then
2166                 echo " "
2167                 echo "You seem to have a working gcc, though." >&4
2168                 rp="Would you like to use it?"
2169                 dflt=y
2170                 if $test -f myread; then
2171                     . ./myread
2172                 else
2173                     if $test -f UU/myread; then
2174                         . ./UU/myread
2175                     else
2176                         echo "Cannot find myread, sorry.  Aborting." >&2
2177                         exit 1
2178                     fi
2179                 fi  
2180                 case "$ans" in
2181                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no ;;
2182                 esac
2183             fi
2184         fi
2185         if $test X"$despair" = Xyes; then
2186             $cat >&4 <<EOM
2187 You need to find a working C compiler.
2188 Either (purchase and) install the C compiler supplied by your OS vendor,
2189 or for a free C compiler try http://gcc.gnu.org/
2190 I cannot continue any further, aborting.
2191 EOM
2192             exit 1
2193         fi
2194     fi
2195     $rm -f try try.*
2196     ;;
2197 esac
2198 EOSC
2199
2200 : determine whether symbolic links are supported
2201 echo " "
2202 $touch blurfl
2203 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2204         echo "Symbolic links are supported." >&4
2205         lns="$ln -s"
2206 else
2207         echo "Symbolic links are NOT supported." >&4
2208         lns="$ln"
2209 fi
2210 $rm -f blurfl sym
2211
2212 : determine whether symbolic links are supported
2213 echo " "
2214 case "$lns" in
2215 *"ln -s")
2216         echo "Checking how to test for symbolic links..." >&4
2217         $lns blurfl sym
2218         if $test "X$issymlink" = X; then
2219                 sh -c "PATH= test -h sym" >/dev/null 2>&1
2220                 if test $? = 0; then
2221                         issymlink="test -h"
2222                 fi              
2223         fi
2224         if $test "X$issymlink" = X; then
2225                 if  $test -h >/dev/null 2>&1; then
2226                         issymlink="$test -h"
2227                         echo "Your builtin 'test -h' may be broken, I'm using external '$test -h'." >&4
2228                 fi              
2229         fi
2230         if $test "X$issymlink" = X; then
2231                 if $test -L sym 2>/dev/null; then
2232                         issymlink="$test -L"
2233                 fi
2234         fi
2235         if $test "X$issymlink" != X; then
2236                 echo "You can test for symbolic links with '$issymlink'." >&4
2237         else
2238                 echo "I do not know how you can test for symbolic links." >&4
2239         fi
2240         $rm -f blurfl sym
2241         ;;
2242 *)      echo "No symbolic links, so not testing for their testing..." >&4
2243         ;;
2244 esac
2245 echo " "
2246
2247
2248 case "$mksymlinks" in
2249 $define|true|[yY]*)
2250         case "$src" in
2251         ''|'.') echo "Cannot create symlinks in the original directory." >&4
2252                 exit 1
2253                 ;;
2254         *)      case "$lns:$issymlink" in
2255                 *"ln -s:"*"test -"?)
2256                         echo "Creating the symbolic links..." >&4
2257                         echo "(First creating the subdirectories...)" >&4
2258                         cd ..
2259                         awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
2260                                 read directory
2261                                 test -z "$directory" && break
2262                                 mkdir -p $directory
2263                         done
2264                         # Sanity check 1.
2265                         if test ! -d t/base; then
2266                                 echo "Failed to create the subdirectories.  Aborting." >&4
2267                                 exit 1
2268                         fi
2269                         echo "(Then creating the symlinks...)" >&4
2270                         awk '{print $1}' $src/MANIFEST | while true; do
2271                                 read filename
2272                                 test -z "$filename" && break
2273                                 if test -f $filename; then
2274                                         if $issymlink $filename; then
2275                                                 rm -f $filename
2276                                         fi
2277                                 fi
2278                                 if test -f $filename; then
2279                                         echo "$filename already exists, not symlinking."
2280                                 else
2281                                         ln -s $src/$filename $filename
2282                                 fi
2283                         done
2284                         # Sanity check 2.
2285                         if test ! -f t/base/commonsense.t; then
2286                                 echo "Failed to create the symlinks.  Aborting." >&4
2287                                 exit 1
2288                         fi
2289                         cd UU
2290                         ;;
2291                 *)      echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2292                         ;;
2293                 esac
2294                 ;;
2295         esac
2296         ;;
2297 esac
2298
2299 : see whether [:lower:] and [:upper:] are supported character classes
2300 echo " "
2301 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2302 ABYZ)
2303         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2304         up='[:upper:]'
2305         low='[:lower:]'
2306         ;;
2307 *)      # There is a discontinuity in EBCDIC between 'I' and 'J'
2308         # (0xc9 and 0xd1), therefore that is a nice testing point.
2309         if test "X$up" = X -o "X$low" = X; then
2310             case "`echo IJ | $tr '[I-J]' '[i-j]' 2>/dev/null`" in
2311             ij) up='[A-Z]'
2312                 low='[a-z]'
2313                 ;;
2314             esac
2315         fi
2316         if test "X$up" = X -o "X$low" = X; then
2317             case "`echo IJ | $tr I-J i-j 2>/dev/null`" in
2318             ij) up='A-Z'
2319                 low='a-z'
2320                 ;;
2321             esac
2322         fi
2323         if test "X$up" = X -o "X$low" = X; then
2324             case "`echo IJ | od -x 2>/dev/null`" in
2325             *C9D1*|*c9d1*)
2326                 echo "Hey, this might be EBCDIC." >&4
2327                 if test "X$up" = X -o "X$low" = X; then
2328                     case "`echo IJ | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
2329                     ij) up='[A-IJ-RS-Z]'
2330                         low='[a-ij-rs-z]'
2331                         ;;
2332                     esac
2333                 fi
2334                 if test "X$up" = X -o "X$low" = X; then
2335                     case "`echo IJ | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
2336                     ij) up='A-IJ-RS-Z'
2337                         low='a-ij-rs-z'
2338                         ;;
2339                     esac
2340                 fi
2341                 ;;
2342             esac
2343         fi
2344 esac
2345 case "`echo IJ | $tr \"$up\" \"$low\" 2>/dev/null`" in
2346 ij)
2347     echo "Using $up and $low to convert case." >&4
2348     ;;
2349 *)
2350     echo "I don't know how to translate letters from upper to lower case." >&4
2351     echo "Your tr is not acting any way I know of." >&4
2352     exit 1
2353     ;;
2354 esac
2355 : set up the translation script tr, must be called with ./tr of course
2356 cat >tr <<EOSC
2357 $startsh
2358 case "\$1\$2" in
2359 '[A-Z][a-z]') exec $tr '$up' '$low';;
2360 '[a-z][A-Z]') exec $tr '$low' '$up';;
2361 esac
2362 exec $tr "\$@"
2363 EOSC
2364 chmod +x tr
2365 $eunicefix tr
2366
2367 : Try to determine whether config.sh was made on this system
2368 case "$config_sh" in
2369 '')
2370 myuname=`$uname -a 2>/dev/null`
2371 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
2372 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
2373 # because the A-Z/a-z are not consecutive.
2374 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
2375         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
2376 newmyuname="$myuname"
2377 dflt=n
2378 case "$knowitall" in
2379 '')
2380         if test -f ../config.sh; then
2381                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
2382                         eval "`grep myuname= ../config.sh`"
2383                 fi
2384                 if test "X$myuname" = "X$newmyuname"; then
2385                         dflt=y
2386                 fi
2387         fi
2388         ;;
2389 *) dflt=y;;
2390 esac
2391
2392 : Get old answers from old config file if Configure was run on the
2393 : same system, otherwise use the hints.
2394 hint=default
2395 cd ..
2396 if test -f config.sh; then
2397         echo " "
2398         rp="I see a config.sh file.  Shall I use it to set the defaults?"
2399         . UU/myread
2400         case "$ans" in
2401         n*|N*) echo "OK, I'll ignore it."
2402                 mv config.sh config.sh.old
2403                 myuname="$newmyuname"
2404                 ;;
2405         *)  echo "Fetching default answers from your old config.sh file..." >&4
2406                 tmp_n="$n"
2407                 tmp_c="$c"
2408                 tmp_sh="$sh"
2409                 . ./config.sh
2410                 cp config.sh UU
2411                 n="$tmp_n"
2412                 c="$tmp_c"
2413                 : Older versions did not always set $sh.  Catch re-use of such
2414                 : an old config.sh.
2415                 case "$sh" in
2416                 '') sh="$tmp_sh" ;;
2417                 esac
2418                 hint=previous
2419                 ;;
2420         esac
2421 fi
2422 . ./UU/checkcc
2423 if test ! -f config.sh; then
2424         $cat <<EOM
2425
2426 First time through, eh?  I have some defaults handy for some systems
2427 that need some extra help getting the Configure answers right:
2428
2429 EOM
2430         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
2431         dflt=''
2432         : Half the following guesses are probably wrong... If you have better
2433         : tests or hints, please send them to perlbug@perl.org
2434         : The metaconfig authors would also appreciate a copy...
2435         $test -f /irix && osname=irix
2436         $test -f /xenix && osname=sco_xenix
2437         $test -f /dynix && osname=dynix
2438         $test -f /dnix && osname=dnix
2439         $test -f /lynx.os && osname=lynxos
2440         $test -f /unicos && osname=unicos && osvers=`$uname -r`
2441         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
2442         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
2443         $test -f /bin/mips && /bin/mips && osname=mips
2444         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
2445                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
2446         $test -d /usr/apollo/bin && osname=apollo
2447         $test -f /etc/saf/_sactab && osname=svr4
2448         $test -d /usr/include/minix && osname=minix
2449         if $test -d /MachTen -o -d /MachTen_Folder; then
2450                 osname=machten
2451                 if $test -x /sbin/version; then
2452                         osvers=`/sbin/version | $awk '{print $2}' |
2453                         $sed -e 's/[A-Za-z]$//'`
2454                 elif $test -x /usr/etc/version; then
2455                         osvers=`/usr/etc/version | $awk '{print $2}' |
2456                         $sed -e 's/[A-Za-z]$//'`
2457                 else
2458                         osvers="$2.$3"
2459                 fi
2460         fi
2461
2462         $test -f /sys/posix.dll &&
2463                 $test -f /usr/bin/what &&
2464                 set X `/usr/bin/what /sys/posix.dll` &&
2465                 $test "$3" = UWIN &&
2466                 osname=uwin &&
2467                 osvers="$5"
2468
2469         if $test -f $uname; then
2470                 set X $myuname
2471                 shift
2472
2473                 case "$5" in
2474                 fps*) osname=fps ;;
2475                 mips*)
2476                         case "$4" in
2477                         umips) osname=umips ;;
2478                         *) osname=mips ;;
2479                         esac;;
2480                 [23]100) osname=mips ;;
2481                 next*) osname=next ;;
2482                 i386*)
2483                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
2484                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
2485                                 osname='sco'
2486                                 osvers=$tmp
2487                         elif $test -f /etc/kconfig; then
2488                                 osname=isc
2489                                 if test "$lns" = "$ln -s"; then
2490                                         osvers=4
2491                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
2492                                         osvers=3
2493                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
2494                                         osvers=2
2495                                 fi
2496                         fi
2497                         tmp=''
2498                         ;;
2499                 pc*)
2500                         if test -n "$DJGPP"; then
2501                                 osname=dos
2502                                 osvers=djgpp
2503                         fi
2504                         ;;
2505                 esac
2506
2507                 case "$1" in
2508                 aix) osname=aix
2509                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
2510                         case "$tmp" in
2511                         'not found') osvers="$4"."$3" ;;
2512                         '<3240'|'<>3240') osvers=3.2.0 ;;
2513                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
2514                         '=3250'|'>3250') osvers=3.2.5 ;;
2515                         *) osvers=$tmp;;
2516                         esac
2517                         ;;
2518                 bsd386) osname=bsd386
2519                         osvers=`$uname -r`
2520                         ;;
2521                 cygwin*) osname=cygwin
2522                         osvers="$3"
2523                         ;;
2524                 *dc.osx) osname=dcosx
2525                         osvers="$3"
2526                         ;;
2527                 dnix) osname=dnix
2528                         osvers="$3"
2529                         ;;
2530                 domainos) osname=apollo
2531                         osvers="$3"
2532                         ;;
2533                 dgux) osname=dgux 
2534                         osvers="$3"
2535                         ;;
2536                 dynixptx*) osname=dynixptx
2537                         osvers=`echo "$4"|sed 's/^v//'`
2538                         ;;
2539                 freebsd) osname=freebsd 
2540                         osvers="$3" ;;
2541                 genix) osname=genix ;;
2542                 hp*) osname=hpux 
2543                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
2544                         ;;
2545                 irix*) osname=irix
2546                         case "$3" in
2547                         4*) osvers=4 ;;
2548                         5*) osvers=5 ;;
2549                         *)      osvers="$3" ;;
2550                         esac
2551                         ;;
2552                 linux) osname=linux
2553                         case "$3" in
2554                         *)      osvers="$3" ;;
2555                         esac
2556                         ;;
2557                 MiNT) osname=mint
2558                         ;;
2559                 netbsd*) osname=netbsd
2560                         osvers="$3"
2561                         ;;
2562                 news-os) osvers="$3"
2563                         case "$3" in
2564                         4*) osname=newsos4 ;;
2565                         *) osname=newsos ;;
2566                         esac
2567                         ;;
2568                 next*) osname=next ;;
2569                 nonstop-ux) osname=nonstopux ;;
2570                 POSIX-BC | posix-bc ) osname=posix-bc
2571                         osvers="$3"
2572                         ;;
2573                 powerux | power_ux | powermax_os | powermaxos | \
2574                 powerunix | power_unix) osname=powerux
2575                         osvers="$3"
2576                         ;;
2577                 qnx) osname=qnx
2578                         osvers="$4"
2579                         ;;
2580                 solaris) osname=solaris
2581                         case "$3" in
2582                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
2583                         *)      osvers="$3" ;;
2584                         esac
2585                         ;;
2586                 sunos) osname=sunos
2587                         case "$3" in
2588                         5*) osname=solaris
2589                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
2590                         *)      osvers="$3" ;;
2591                         esac
2592                         ;;
2593                 titanos) osname=titanos
2594                         case "$3" in
2595                         1*) osvers=1 ;;
2596                         2*) osvers=2 ;;
2597                         3*) osvers=3 ;;
2598                         4*) osvers=4 ;;
2599                         *)      osvers="$3" ;;
2600                         esac
2601                         ;;
2602                 ultrix) osname=ultrix
2603                         osvers="$3"
2604                         ;;
2605                 osf1|mls+)      case "$5" in
2606                                 alpha)
2607                                         osname=dec_osf
2608                                         osvers=`sizer -v | awk '{print $3}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
2609                                         case "$osvers" in
2610                                         [1-9].[0-9]*) ;;
2611                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
2612                                         esac
2613                                         ;;
2614                         hp*)    osname=hp_osf1  ;;
2615                         mips)   osname=mips_osf1 ;;
2616                         esac
2617                         ;;
2618                 unixware) osname=svr5
2619                         osvers="$4"
2620                         ;;
2621                 uts) osname=uts
2622                         osvers="$3"
2623                         ;;
2624                 $2) case "$osname" in
2625                         *isc*) ;;
2626                         *freebsd*) ;;
2627                         svr*)
2628                                 : svr4.x or possibly later
2629                                 case "svr$3" in 
2630                                 ${osname}*)
2631                                         osname=svr$3
2632                                         osvers=$4
2633                                         ;;
2634                                 esac
2635                                 case "$osname" in
2636                                 svr4.0)
2637                                         : Check for ESIX
2638                                         if test -f /stand/boot ; then
2639                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
2640                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
2641                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
2642                                                         if test -n "$isesix"; then
2643                                                                 osname=esix4
2644                                                         fi
2645                                                 fi
2646                                         fi
2647                                         ;;
2648                                 esac
2649                                 ;;
2650                         *)      if test -f /etc/systemid; then
2651                                         osname=sco
2652                                         set `echo $3 | $sed 's/\./ /g'` $4
2653                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
2654                                                 osvers=$1.$2.$3
2655                                         elif $test -f $src/hints/sco_$1_$2.sh; then
2656                                                 osvers=$1.$2
2657                                         elif $test -f $src/hints/sco_$1.sh; then
2658                                                 osvers=$1
2659                                         fi
2660                                 else
2661                                         case "$osname" in
2662                                         '') : Still unknown.  Probably a generic Sys V.
2663                                                 osname="sysv"
2664                                                 osvers="$3"
2665                                                 ;;
2666                                         esac
2667                                 fi
2668                                 ;;
2669                         esac
2670                         ;;
2671                 *)      case "$osname" in
2672                         '') : Still unknown.  Probably a generic BSD.
2673                                 osname="$1"
2674                                 osvers="$3"
2675                                 ;;
2676                         esac
2677                         ;;
2678                 esac
2679         else
2680                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
2681                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
2682                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
2683                                 osname=news_os
2684                         fi
2685                         $rm -f UU/kernel.what
2686                 elif test -d c:/.; then
2687                         set X $myuname
2688                         osname=os2
2689                         osvers="$5"
2690                 fi
2691         fi
2692         
2693         : Now look for a hint file osname_osvers, unless one has been
2694         : specified already.
2695         case "$hintfile" in
2696         ''|' ')
2697                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
2698                 : Also try without trailing minor version numbers.
2699                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
2700                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
2701                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
2702                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
2703                 case "$file" in
2704                 '') dflt=none ;;
2705                 *)  case "$osvers" in
2706                         '') dflt=$file
2707                                 ;;
2708                         *)  if $test -f $src/hints/$file.sh ; then
2709                                         dflt=$file
2710                                 elif $test -f $src/hints/$xfile.sh ; then
2711                                         dflt=$xfile
2712                                 elif $test -f $src/hints/$xxfile.sh ; then
2713                                         dflt=$xxfile
2714                                 elif $test -f $src/hints/$xxxfile.sh ; then
2715                                         dflt=$xxxfile
2716                                 elif $test -f $src/hints/$xxxxfile.sh ; then
2717                                         dflt=$xxxxfile
2718                                 elif $test -f "$src/hints/${osname}.sh" ; then
2719                                         dflt="${osname}"
2720                                 else
2721                                         dflt=none
2722                                 fi
2723                                 ;;
2724                         esac
2725                         ;;
2726                 esac
2727                 if $test -f Policy.sh ; then
2728                         case "$dflt" in
2729                         *Policy*) ;;
2730                         none) dflt="Policy" ;;
2731                         *) dflt="Policy $dflt" ;;
2732                         esac
2733                 fi
2734                 ;;
2735         *)
2736                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
2737                 ;;
2738         esac
2739
2740         if $test -f Policy.sh ; then
2741                 $cat <<EOM
2742
2743 There's also a Policy hint file available, which should make the
2744 site-specific (policy) questions easier to answer.
2745 EOM
2746
2747         fi
2748
2749         $cat <<EOM
2750
2751 You may give one or more space-separated answers, or "none" if appropriate.
2752 A well-behaved OS will have no hints, so answering "none" or just "Policy"
2753 is a good thing.  DO NOT give a wrong version or a wrong OS.
2754
2755 EOM
2756
2757         rp="Which of these apply, if any?"
2758         . UU/myread
2759         tans=$ans
2760         for file in $tans; do
2761                 if $test X$file = XPolicy -a -f Policy.sh; then
2762                         . Policy.sh
2763                         $cat Policy.sh >> UU/config.sh
2764                 elif $test -f $src/hints/$file.sh; then
2765                         . $src/hints/$file.sh
2766                         $cat $src/hints/$file.sh >> UU/config.sh
2767                 elif $test X$tans = X -o X$tans = Xnone ; then
2768                         : nothing
2769                 else
2770                         : Give one chance to correct a possible typo.
2771                         echo "$file.sh does not exist"
2772                         dflt=$file
2773                         rp="hint to use instead?"
2774                         . UU/myread
2775                         for file in $ans; do
2776                                 if $test -f "$src/hints/$file.sh"; then
2777                                         . $src/hints/$file.sh
2778                                         $cat $src/hints/$file.sh >> UU/config.sh
2779                                 elif $test X$ans = X -o X$ans = Xnone ; then
2780                                         : nothing
2781                                 else
2782                                         echo "$file.sh does not exist -- ignored."
2783                                 fi
2784                         done
2785                 fi
2786         done
2787
2788         hint=recommended
2789         : Remember our hint file for later.
2790         if $test -f "$src/hints/$file.sh" ; then
2791                 hintfile="$file"
2792         else
2793                 hintfile=''
2794         fi
2795 fi
2796 cd UU
2797 ;;
2798 *)
2799         echo " "
2800         echo "Fetching default answers from $config_sh..." >&4
2801         tmp_n="$n"
2802         tmp_c="$c"
2803         cd ..
2804         cp $config_sh config.sh 2>/dev/null
2805         chmod +w config.sh
2806         . ./config.sh
2807         cd UU
2808         cp ../config.sh .
2809         n="$tmp_n"
2810         c="$tmp_c"
2811         hint=previous
2812         ;;
2813 esac
2814 test "$override" && . ./optdef.sh
2815
2816 : Restore computed paths
2817 for file in $loclist $trylist; do
2818         eval $file="\$_$file"
2819 done
2820
2821 cat << EOM
2822
2823 Configure uses the operating system name and version to set some defaults.
2824 The default value is probably right if the name rings a bell. Otherwise,
2825 since spelling matters for me, either accept the default or answer "none"
2826 to leave it blank.
2827
2828 EOM
2829 case "$osname" in
2830         ''|' ')
2831                 case "$hintfile" in
2832                 ''|' '|none) dflt=none ;;
2833                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
2834                 esac
2835                 ;;
2836         *) dflt="$osname" ;;
2837 esac
2838 rp="Operating system name?"
2839 . ./myread
2840 case "$ans" in
2841 none)  osname='' ;;
2842 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
2843 esac
2844 echo " "
2845 case "$osvers" in
2846         ''|' ')
2847                 case "$hintfile" in
2848                 ''|' '|none) dflt=none ;;
2849                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
2850                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
2851                         case "$dflt" in
2852                         ''|' ') dflt=none ;;
2853                         esac
2854                         ;;
2855                 esac
2856                 ;;
2857         *) dflt="$osvers" ;;
2858 esac
2859 rp="Operating system version?"
2860 . ./myread
2861 case "$ans" in
2862 none)  osvers='' ;;
2863 *) osvers="$ans" ;;
2864 esac
2865
2866
2867 . ./posthint.sh
2868
2869 : who configured the system
2870 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
2871 cf_by=`(logname) 2>/dev/null`
2872 case "$cf_by" in
2873 "")
2874         cf_by=`(whoami) 2>/dev/null`
2875         case "$cf_by" in
2876         "") cf_by=unknown ;;
2877         esac ;;
2878 esac
2879
2880 : set up the script used to warn in case of inconsistency
2881 cat <<EOS >whoa
2882 $startsh
2883 EOS
2884 cat <<'EOSC' >>whoa
2885 dflt=y
2886 echo " "
2887 echo "*** WHOA THERE!!! ***" >&4
2888 echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
2889 rp="    Keep the $hint value?"
2890 . ./myread
2891 case "$ans" in
2892 y) td=$was; tu=$was;;
2893 esac
2894 EOSC
2895
2896 : function used to set $1 to $val
2897 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
2898 case "$val$was" in
2899 $define$undef) . ./whoa; eval "$var=\$td";;
2900 $undef$define) . ./whoa; eval "$var=\$tu";;
2901 *) eval "$var=$val";;
2902 esac'
2903
2904 case "$usethreads" in
2905 $define|true|[yY]*)     dflt='y';;
2906 *) dflt='n';;
2907 esac
2908 cat <<EOM
2909
2910 Perl can be built to take advantage of threads on some systems.
2911 To do so, Configure can be run with -Dusethreads.
2912
2913 Note that threading is a highly experimental feature, and
2914 some known race conditions still remain.  If you choose to try
2915 it, be very sure to not actually deploy it for production
2916 purposes.  README.threads has more details, and is required
2917 reading if you enable threads.
2918
2919 If this doesn't make any sense to you, just accept the default '$dflt'.
2920 EOM
2921 rp='Build a threading Perl?'
2922 . ./myread
2923 case "$ans" in
2924 y|Y)    val="$define" ;;
2925 *)      val="$undef" ;;
2926 esac
2927 set usethreads
2928 eval $setvar
2929
2930 case "$usethreads" in
2931 $define)
2932         $cat <<EOM
2933
2934 As of 5.5.640, Perl has two different internal threading implementations,
2935 the 5.005 version (5005threads) and an interpreter-based version
2936 (ithreads) that has one interpreter per thread.  Both are very 
2937 experimental.  This arrangement exists to help developers work out
2938 which one is better.
2939
2940 If you're a casual user, you probably don't want interpreter-threads
2941 at this time.  There doesn't yet exist a way to create threads from
2942 within Perl in this model, i.e., "use Thread;" will NOT work.
2943 EOM
2944         : Default to ithreads unless overridden on command line or with
2945         : old config.sh
2946         dflt='y'
2947         case "$use5005threads" in
2948                 $define|true|[yY]*) dflt='n';;
2949         esac
2950         case "$useithreads" in
2951                 $undef|false|[nN]*) dflt='n';;
2952         esac
2953         rp='Use interpreter-based ithreads?'
2954         . ./myread
2955         case "$ans" in
2956         y|Y)    val="$define" ;;
2957         *)      val="$undef" ;;
2958         esac
2959         set useithreads
2960         eval $setvar
2961         : Now set use5005threads to the opposite value.
2962         case "$useithreads" in
2963         $define) val="$undef" ;;
2964         *) val="$define" ;;
2965         esac
2966         set use5005threads
2967         eval $setvar
2968         ;;
2969 *)
2970         useithreads="$undef"
2971         use5005threads="$undef"
2972         ;;
2973 esac
2974
2975 case "$useithreads$use5005threads" in
2976 "$define$define")
2977         $cat >&4 <<EOM
2978
2979 You cannot have both the ithreads and the 5.005 threads enabled
2980 at the same time.  Disabling the 5.005 threads since they are
2981 much less stable than the ithreads.
2982
2983 EOM
2984         use5005threads="$undef"
2985         ;;
2986 esac
2987
2988 case "$d_oldpthreads" in
2989 '')     : Configure tests would be welcome here.  For now, assume undef.
2990         val="$undef" ;;
2991 *)      val="$d_oldpthreads" ;;
2992 esac
2993 set d_oldpthreads
2994 eval $setvar
2995
2996
2997 case "$usethreads" in
2998 "$define"|true|[yY]*)
2999 : Look for a hint-file generated 'call-back-unit'.  If the
3000 : user has specified that a threading perl is to be built,
3001 : we may need to set or change some other defaults.
3002         if $test -f usethreads.cbu; then
3003                 echo "Your platform has some specific hints for threaded builds, using them..."
3004                 . ./usethreads.cbu
3005         else
3006                 $cat <<EOM
3007 (Your platform doesn't have any specific hints for threaded builds.
3008  Assuming POSIX threads, then.)
3009 EOM
3010         fi
3011         ;;
3012 esac
3013
3014 cat <<EOM
3015
3016 Perl can be built so that multiple Perl interpreters can coexist
3017 within the same Perl executable.
3018 EOM
3019
3020 case "$useithreads" in
3021 $define)
3022         cat <<EOM
3023 This multiple interpreter support is required for interpreter-based threads.
3024 EOM
3025         val="$define"
3026         ;;
3027 *)      case "$usemultiplicity" in
3028         $define|true|[yY]*)     dflt='y';;
3029         *) dflt='n';;
3030         esac
3031         echo " "
3032         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
3033         rp='Build Perl for multiplicity?'
3034         . ./myread
3035         case "$ans" in
3036         y|Y)    val="$define" ;;
3037         *)      val="$undef" ;;
3038         esac
3039         ;;
3040 esac
3041 set usemultiplicity
3042 eval $setvar
3043
3044 : make some quick guesses about what we are up against
3045 echo " "
3046 $echo $n "Hmm...  $c"
3047 echo exit 1 >bsd
3048 echo exit 1 >usg
3049 echo exit 1 >v7
3050 echo exit 1 >osf1
3051 echo exit 1 >eunice
3052 echo exit 1 >xenix
3053 echo exit 1 >venix
3054 echo exit 1 >os2
3055 d_bsd="$undef"
3056 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
3057 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
3058 then
3059         echo "Looks kind of like an OSF/1 system, but we'll see..."
3060         echo exit 0 >osf1
3061 elif test `echo abc | $tr a-z A-Z` = Abc ; then
3062         xxx=`./loc addbib blurfl $pth`
3063         if $test -f $xxx; then
3064         echo "Looks kind of like a USG system with BSD features, but we'll see..."
3065                 echo exit 0 >bsd
3066                 echo exit 0 >usg
3067         else
3068                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
3069                         echo "Looks kind of like an extended USG system, but we'll see..."
3070                 else
3071                         echo "Looks kind of like a USG system, but we'll see..."
3072                 fi
3073                 echo exit 0 >usg
3074         fi
3075 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
3076         echo "Looks kind of like a BSD system, but we'll see..."
3077         d_bsd="$define"
3078         echo exit 0 >bsd
3079 else
3080         echo "Looks kind of like a Version 7 system, but we'll see..."
3081         echo exit 0 >v7
3082 fi
3083 case "$eunicefix" in
3084 *unixtovms*)
3085         $cat <<'EOI'
3086 There is, however, a strange, musty smell in the air that reminds me of
3087 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
3088 EOI
3089         echo exit 0 >eunice
3090         d_eunice="$define"
3091 : it so happens the Eunice I know will not run shell scripts in Unix format
3092         ;;
3093 *)
3094         echo " "
3095         echo "Congratulations.  You aren't running Eunice."
3096         d_eunice="$undef"
3097         ;;
3098 esac
3099 : Detect OS2.  The p_ variable is set above in the Head.U unit.
3100 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
3101 : semicolon as a patch separator
3102 case "$p_" in
3103 :) ;;
3104 *)
3105         $cat <<'EOI'
3106 I have the feeling something is not exactly right, however...don't tell me...
3107 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
3108 (Or you may be running DOS with DJGPP.)
3109 EOI
3110         echo exit 0 >os2
3111         ;;
3112 esac
3113 if test -f /xenix; then
3114         echo "Actually, this looks more like a XENIX system..."
3115         echo exit 0 >xenix
3116         d_xenix="$define"
3117 else
3118         echo " "
3119         echo "It's not Xenix..."
3120         d_xenix="$undef"
3121 fi
3122 chmod +x xenix
3123 $eunicefix xenix
3124 if test -f /venix; then
3125         echo "Actually, this looks more like a VENIX system..."
3126         echo exit 0 >venix
3127 else
3128         echo " "
3129         if ./xenix; then
3130                 : null
3131         else
3132                 echo "Nor is it Venix..."
3133         fi
3134 fi
3135 chmod +x bsd usg v7 osf1 eunice xenix venix os2
3136 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
3137 $rm -f foo
3138
3139 case "$cc" in
3140 '') dflt=cc;;
3141 *) dflt="$cc";;
3142 esac
3143 rp="Use which C compiler?"
3144 . ./myread
3145 cc="$ans"
3146 : Look for a hint-file generated 'call-back-unit'.  Now that the
3147 : user has specified the compiler, we may need to set or change some
3148 : other defaults.
3149 if $test -f cc.cbu; then
3150     . ./cc.cbu
3151 fi
3152 . ./checkcc
3153
3154 echo " "
3155 echo "Checking for GNU cc in disguise and/or its version number..." >&4
3156 $cat >gccvers.c <<EOM
3157 #include <stdio.h>
3158 int main() {
3159 #ifdef __GNUC__
3160 #ifdef __VERSION__
3161         printf("%s\n", __VERSION__);
3162 #else
3163         printf("%s\n", "1");
3164 #endif
3165 #endif
3166         exit(0);
3167 }
3168 EOM
3169 if $cc -o gccvers $ccflags $ldflags gccvers.c; then
3170         gccversion=`./gccvers`
3171         case "$gccversion" in
3172         '') echo "You are not using GNU cc." ;;
3173         *)  echo "You are using GNU cc $gccversion."
3174             ccname=gcc  
3175             ;;
3176         esac
3177 else
3178         echo " "
3179         echo "*** WHOA THERE!!! ***" >&4
3180         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
3181         case "$knowitall" in
3182         '')
3183         echo "    You'd better start hunting for one and let me know about it." >&4
3184                 exit 1
3185                 ;;
3186         esac
3187 fi
3188 $rm -f gccvers*
3189 case "$gccversion" in
3190 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
3191 esac
3192 case "$gccversion" in
3193 '') gccosandvers='' ;;
3194 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
3195    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
3196    gccshortvers=''
3197    case "$gccosandvers" in
3198    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
3199    $osname$osvers) ;; # looking good
3200    $osname*) cat <<EOM >&4
3201
3202 *** WHOA THERE!!! ***
3203
3204     Your gcc has not been compiled for the exact release of
3205     your operating system ($gccosandvers versus $osname$osvers).
3206
3207     In general it is a good idea to keep gcc synchronized with
3208     the operating system because otherwise serious problems
3209     may ensue when trying to compile software, like Perl.
3210
3211     I'm trying to be optimistic here, though, and will continue.
3212     If later during the configuration and build icky compilation
3213     problems appear (headerfile conflicts being the most common
3214     manifestation), I suggest reinstalling the gcc to match
3215     your operating system release.
3216
3217 EOM
3218       ;;
3219    *) gccosandvers='' ;; # failed to parse, better be silent
3220    esac
3221    ;;
3222 esac
3223 case "$ccname" in
3224 '') ccname="$cc" ;;
3225 esac
3226
3227 case "$gccversion" in
3228 '') ;;
3229 *)  case "$ccflags" in
3230     *-Wall*) ;;
3231     *) ccflags="$ccflags -Wall" ;;
3232     esac
3233     ;;
3234 esac
3235
3236 : see how we invoke the C preprocessor
3237 echo " "
3238 echo "Now, how can we feed standard input to your C preprocessor..." >&4
3239 cat <<'EOT' >testcpp.c
3240 #define ABC abc
3241 #define XYZ xyz
3242 ABC.XYZ
3243 EOT
3244 cd ..
3245 if test ! -f cppstdin; then
3246         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
3247                 # AIX cc -E doesn't show the absolute headerfile
3248                 # locations but we'll cheat by using the -M flag.
3249                 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
3250         else
3251                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
3252         fi
3253 else
3254         echo "Keeping your $hint cppstdin wrapper."
3255 fi
3256 chmod 755 cppstdin
3257 wrapper=`pwd`/cppstdin
3258 ok='false'
3259 cd UU
3260
3261 if $test "X$cppstdin" != "X" && \
3262         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
3263         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3264 then
3265         echo "You used to use $cppstdin $cppminus so we'll use that again."
3266         case "$cpprun" in
3267         '') echo "But let's see if we can live without a wrapper..." ;;
3268         *)
3269                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
3270                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3271                 then
3272                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
3273                         ok='true'
3274                 else
3275                         echo "(However, $cpprun $cpplast does not work, let's see...)"
3276                 fi
3277                 ;;
3278         esac
3279 else
3280         case "$cppstdin" in
3281         '') ;;
3282         *)
3283                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
3284                 ;;
3285         esac
3286 fi
3287
3288 if $ok; then
3289         : nothing
3290 elif echo 'Maybe "'"$cc"' -E" will work...'; \
3291         $cc -E <testcpp.c >testcpp.out 2>&1; \
3292         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3293         echo "Yup, it does."
3294         x_cpp="$cc -E"
3295         x_minus='';
3296 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
3297         $cc -E - <testcpp.c >testcpp.out 2>&1; \
3298         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3299         echo "Yup, it does."
3300         x_cpp="$cc -E"
3301         x_minus='-';
3302 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
3303         $cc -P <testcpp.c >testcpp.out 2>&1; \
3304         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3305         echo "Yipee, that works!"
3306         x_cpp="$cc -P"
3307         x_minus='';
3308 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
3309         $cc -P - <testcpp.c >testcpp.out 2>&1; \
3310         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3311         echo "At long last!"
3312         x_cpp="$cc -P"
3313         x_minus='-';
3314 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
3315         $cpp <testcpp.c >testcpp.out 2>&1; \
3316         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3317         echo "It works!"
3318         x_cpp="$cpp"
3319         x_minus='';
3320 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
3321         $cpp - <testcpp.c >testcpp.out 2>&1; \
3322         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3323         echo "Hooray, it works!  I was beginning to wonder."
3324         x_cpp="$cpp"
3325         x_minus='-';
3326 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
3327         $wrapper <testcpp.c >testcpp.out 2>&1; \
3328         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3329         x_cpp="$wrapper"
3330         x_minus=''
3331         echo "Eureka!"
3332 else
3333         dflt=''
3334         rp="No dice.  I can't find a C preprocessor.  Name one:"
3335         . ./myread
3336         x_cpp="$ans"
3337         x_minus=''
3338         $x_cpp <testcpp.c >testcpp.out 2>&1
3339         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3340                 echo "OK, that will do." >&4
3341         else
3342 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
3343                 exit 1
3344         fi
3345 fi
3346
3347 case "$ok" in
3348 false)
3349         cppstdin="$x_cpp"
3350         cppminus="$x_minus"
3351         cpprun="$x_cpp"
3352         cpplast="$x_minus"
3353         set X $x_cpp
3354         shift
3355         case "$1" in
3356         "$cpp")
3357                 echo "Perhaps can we force $cc -E using a wrapper..."
3358                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
3359                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3360                 then
3361                         echo "Yup, we can."
3362                         cppstdin="$wrapper"
3363                         cppminus='';
3364                 else
3365                         echo "Nope, we'll have to live without it..."
3366                 fi
3367                 ;;
3368         esac
3369         case "$cpprun" in
3370         "$wrapper")
3371                 cpprun=''
3372                 cpplast=''
3373                 ;;
3374         esac
3375         ;;
3376 esac
3377
3378 case "$cppstdin" in
3379 "$wrapper"|'cppstdin') ;;
3380 *) $rm -f $wrapper;;
3381 esac
3382 $rm -f testcpp.c testcpp.out
3383
3384 : decide how portable to be.  Allow command line overrides.
3385 case "$d_portable" in
3386 "$undef") ;;
3387 *)      d_portable="$define" ;;
3388 esac
3389
3390 : set up shell script to do ~ expansion
3391 cat >filexp <<EOSS
3392 $startsh
3393 : expand filename
3394 case "\$1" in
3395  ~/*|~)
3396         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3397         ;;
3398  ~*)
3399         if $test -f /bin/csh; then
3400                 /bin/csh -f -c "glob \$1"
3401                 failed=\$?
3402                 echo ""
3403                 exit \$failed
3404         else
3405                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3406                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3407                 if $test ! -d "\$dir"; then
3408                         me=\`basename \$0\`
3409                         echo "\$me: can't locate home directory for: \$name" >&2
3410                         exit 1
3411                 fi
3412                 case "\$1" in
3413                 */*)
3414                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3415                         ;;
3416                 *)
3417                         echo \$dir
3418                         ;;
3419                 esac
3420         fi
3421         ;;
3422 *)
3423         echo \$1
3424         ;;
3425 esac
3426 EOSS
3427 chmod +x filexp
3428 $eunicefix filexp
3429
3430 : now set up to get a file name
3431 cat <<EOS >getfile
3432 $startsh
3433 EOS
3434 cat <<'EOSC' >>getfile
3435 tilde=''
3436 fullpath=''
3437 already=''
3438 skip=''
3439 none_ok=''
3440 exp_file=''
3441 nopath_ok=''
3442 orig_rp="$rp"
3443 orig_dflt="$dflt"
3444 case "$gfpth" in
3445 '') gfpth='.' ;;
3446 esac
3447
3448 case "$fn" in
3449 *\(*)
3450         expr $fn : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3451         fn=`echo $fn | sed 's/(.*)//'`
3452         ;;
3453 esac
3454
3455 case "$fn" in
3456 *:*)
3457         loc_file=`expr $fn : '.*:\(.*\)'`
3458         fn=`expr $fn : '\(.*\):.*'`
3459         ;;
3460 esac
3461
3462 case "$fn" in
3463 *~*) tilde=true;;
3464 esac
3465 case "$fn" in
3466 */*) fullpath=true;;
3467 esac
3468 case "$fn" in
3469 *+*) skip=true;;
3470 esac
3471 case "$fn" in
3472 *n*) none_ok=true;;
3473 esac
3474 case "$fn" in
3475 *e*) exp_file=true;;
3476 esac
3477 case "$fn" in
3478 *p*) nopath_ok=true;;
3479 esac
3480
3481 case "$fn" in
3482 *f*) type='File';;
3483 *d*) type='Directory';;
3484 *l*) type='Locate';;
3485 esac
3486
3487 what="$type"
3488 case "$what" in
3489 Locate) what='File';;
3490 esac
3491
3492 case "$exp_file" in
3493 '')
3494         case "$d_portable" in
3495         "$define") ;;
3496         *) exp_file=true;;
3497         esac
3498         ;;
3499 esac
3500
3501 cd ..
3502 while test "$type"; do
3503         redo=''
3504         rp="$orig_rp"
3505         dflt="$orig_dflt"
3506         case "$tilde" in
3507         true) rp="$rp (~name ok)";;
3508         esac
3509         . UU/myread
3510         if test -f UU/getfile.ok && \
3511                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3512         then
3513                 value="$ans"
3514                 ansexp="$ans"
3515                 break
3516         fi
3517         case "$ans" in
3518         none)
3519                 value=''
3520                 ansexp=''
3521                 case "$none_ok" in
3522                 true) type='';;
3523                 esac
3524                 ;;
3525         *)
3526                 case "$tilde" in
3527                 '') value="$ans"
3528                         ansexp="$ans";;
3529                 *)
3530                         value=`UU/filexp $ans`
3531                         case $? in
3532                         0)
3533                                 if test "$ans" != "$value"; then
3534                                         echo "(That expands to $value on this system.)"
3535                                 fi
3536                                 ;;
3537                         *) value="$ans";;
3538                         esac
3539                         ansexp="$value"
3540                         case "$exp_file" in
3541                         '') value="$ans";;
3542                         esac
3543                         ;;
3544                 esac
3545                 case "$fullpath" in
3546                 true)
3547                         case "$ansexp" in
3548                         /*) value="$ansexp" ;;
3549                         [a-zA-Z]:/*) value="$ansexp" ;;
3550                         *)
3551                                 redo=true
3552                                 case "$already" in
3553                                 true)
3554                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
3555                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
3556                                         ;;
3557                                 *)
3558                                 echo "Please give a full path name, starting with slash." >&4
3559                                         case "$tilde" in
3560                                         true)
3561                                 echo "Note that using ~name is ok provided it expands well." >&4
3562                                                 already=true
3563                                                 ;;
3564                                         esac
3565                                 esac
3566                                 ;;
3567                         esac
3568                         ;;
3569                 esac
3570                 case "$redo" in
3571                 '')
3572                         case "$type" in
3573                         File)
3574                                 for fp in $gfpth; do
3575                                         if test "X$fp" = X.; then
3576                                             pf="$ansexp"
3577                                         else    
3578                                             pf="$fp/$ansexp"
3579                                         fi
3580                                         if test -f "$pf"; then
3581                                                 type=''
3582                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3583                                         then
3584                                                 echo "($value is not a plain file, but that's ok.)"
3585                                                 type=''
3586                                         fi
3587                                         if test X"$type" = X; then
3588                                             value="$pf"
3589                                             break
3590                                         fi
3591                                 done
3592                                 ;;
3593                         Directory)
3594                                 for fp in $gfpth; do
3595                                         if test "X$fp" = X.; then
3596                                             dir="$ans"
3597                                             direxp="$ansexp"
3598                                         else    
3599                                             dir="$fp/$ansexp"
3600                                             direxp="$fp/$ansexp"
3601                                         fi
3602                                         if test -d "$direxp"; then
3603                                                 type=''
3604                                                 value="$dir"
3605                                                 break
3606                                         fi
3607                                 done
3608                                 ;;
3609                         Locate)
3610                                 if test -d "$ansexp"; then
3611                                         echo "(Looking for $loc_file in directory $value.)"
3612                                         value="$value/$loc_file"
3613                                         ansexp="$ansexp/$loc_file"
3614                                 fi
3615                                 if test -f "$ansexp"; then
3616                                         type=''
3617                                 fi
3618                                 case "$nopath_ok" in
3619                                 true)   case "$value" in
3620                                         */*) ;;
3621                                         *)      echo "Assuming $value will be in people's path."
3622                                                 type=''
3623                                                 ;;
3624                                         esac
3625                                         ;;
3626                                 esac
3627                                 ;;
3628                         esac
3629
3630                         case "$skip" in
3631                         true) type='';
3632                         esac
3633
3634                         case "$type" in
3635                         '') ;;
3636                         *)
3637                                 if test "$fastread" = yes; then
3638                                         dflt=y
3639                                 else
3640                                         dflt=n
3641                                 fi
3642                                 rp="$what $value doesn't exist.  Use that name anyway?"
3643                                 . UU/myread
3644                                 dflt=''
3645                                 case "$ans" in
3646                                 y*) type='';;
3647                                 *) echo " ";;
3648                                 esac
3649                                 ;;
3650                         esac
3651                         ;;
3652                 esac
3653                 ;;
3654         esac
3655 done
3656 cd UU
3657 ans="$value"
3658 rp="$orig_rp"
3659 dflt="$orig_dflt"
3660 rm -f getfile.ok
3661 test "X$gfpthkeep" != Xy && gfpth=""
3662 EOSC
3663
3664 : What should the include directory be ?
3665 echo " "
3666 $echo $n "Hmm...  $c"
3667 dflt='/usr/include'
3668 incpath=''
3669 mips_type=''
3670 if $test -f /bin/mips && /bin/mips; then
3671         echo "Looks like a MIPS system..."
3672         $cat >usr.c <<'EOCP'
3673 #ifdef SYSTYPE_BSD43
3674 /bsd43
3675 #endif
3676 EOCP
3677         if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
3678                 dflt='/bsd43/usr/include'
3679                 incpath='/bsd43'
3680                 mips_type='BSD 4.3'
3681         else
3682                 mips_type='System V'
3683         fi
3684         $rm -f usr.c usr.out
3685         echo "and you're compiling with the $mips_type compiler and libraries."
3686         xxx_prompt=y
3687         echo "exit 0" >mips
3688 else
3689         echo "Doesn't look like a MIPS system."
3690         xxx_prompt=n
3691         echo "exit 1" >mips
3692 fi
3693 chmod +x mips
3694 $eunicefix mips
3695 case "$usrinc" in
3696 '') ;;
3697 *) dflt="$usrinc";;
3698 esac
3699 case "$xxx_prompt" in
3700 y)      fn=d/
3701         echo " "
3702         rp='Where are the include files you want to use?'
3703         . ./getfile
3704         usrinc="$ans"
3705         ;;
3706 *)      usrinc="$dflt"
3707         ;;
3708 esac
3709
3710 : Set private lib path
3711 case "$plibpth" in
3712 '') if ./mips; then
3713                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
3714         fi;;
3715 esac
3716 case "$libpth" in
3717 ' ') dlist='';;
3718 '') dlist="$loclibpth $plibpth $glibpth";;
3719 *) dlist="$libpth";;
3720 esac
3721
3722 : Now check and see which directories actually exist, avoiding duplicates
3723 libpth=''
3724 for xxx in $dlist
3725 do
3726     if $test -d $xxx; then
3727                 case " $libpth " in
3728                 *" $xxx "*) ;;
3729                 *) libpth="$libpth $xxx";;
3730                 esac
3731     fi
3732 done
3733 $cat <<'EOM'
3734
3735 Some systems have incompatible or broken versions of libraries.  Among
3736 the directories listed in the question below, please remove any you
3737 know not to be holding relevant libraries, and add any that are needed.
3738 Say "none" for none.
3739
3740 EOM
3741 case "$libpth" in
3742 '') dflt='none';;
3743 *)
3744         set X $libpth
3745         shift
3746         dflt=${1+"$@"}
3747         ;;
3748 esac
3749 rp="Directories to use for library searches?"
3750 . ./myread
3751 case "$ans" in
3752 none) libpth=' ';;
3753 *) libpth="$ans";;
3754 esac
3755
3756 : compute shared library extension
3757 case "$so" in
3758 '')
3759         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
3760                 dflt='sl'
3761         else
3762                 dflt='so'
3763         fi
3764         ;;
3765 *) dflt="$so";;
3766 esac
3767 $cat <<EOM
3768
3769 On some systems, shared libraries may be available.  Answer 'none' if
3770 you want to suppress searching of shared libraries for the remainder
3771 of this configuration.
3772
3773 EOM
3774 rp='What is the file extension used for shared libraries?'
3775 . ./myread
3776 so="$ans"
3777
3778 : Define several unixisms.
3779 : Hints files or command line option can be used to override them.
3780 : The convoluted testing is in case hints files set either the old
3781 : or the new name.
3782 case "$_exe" in
3783 '')     case "$exe_ext" in
3784     '') ;;
3785         *)      _exe="$exe_ext" ;;
3786         esac
3787         ;;
3788 esac
3789 case "$_a" in
3790 '')     case "$lib_ext" in
3791     '') _a='.a';;
3792         *)      _a="$lib_ext" ;;
3793         esac
3794         ;;
3795 esac
3796 case "$_o" in
3797 '') case "$obj_ext" in
3798         '')     _o='.o';;
3799         *)      _o="$obj_ext";;
3800         esac
3801         ;;
3802 esac
3803 case "$p_" in
3804 '') case "$path_sep" in
3805         '')     p_=':';;
3806         *)      p_="$path_sep";;
3807         esac
3808         ;;
3809 esac
3810 exe_ext=$_exe
3811 lib_ext=$_a
3812 obj_ext=$_o
3813 path_sep=$p_
3814
3815 : Which makefile gets called first.  This is used by make depend.
3816 case "$firstmakefile" in
3817 '') firstmakefile='makefile';;
3818 esac
3819
3820 case "$usesocks" in
3821 $define|true|[yY]*)     dflt='y';;
3822 *) dflt='n';;
3823 esac
3824 cat <<EOM
3825
3826 Perl can be built to use the SOCKS proxy protocol library.  To do so,
3827 Configure must be run with -Dusesocks.  If you use SOCKS you also need
3828 to use the PerlIO abstraction layer, this will be implicitly selected.
3829
3830 If this doesn't make any sense to you, just accept the default '$dflt'.
3831 EOM
3832 rp='Build Perl for SOCKS?'
3833 . ./myread
3834 case "$ans" in
3835 y|Y)    val="$define" ;;     
3836 *)      val="$undef" ;;
3837 esac
3838 set usesocks
3839 eval $setvar
3840
3841 case "$usesocks" in
3842 $define|true|[yY]*) useperlio="$define";;
3843 esac
3844
3845 : Looking for optional libraries
3846 echo " "
3847 echo "Checking for optional libraries..." >&4
3848 case "$libs" in
3849 ' '|'') dflt='';;
3850 *) dflt="$libs";;
3851 esac
3852 case "$libswanted" in
3853 '') libswanted='c_s';;
3854 esac
3855 case "$usesocks" in
3856 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
3857 esac
3858 libsfound=''
3859 libsfiles=''
3860 libsdirs=''
3861 libspath=''
3862 for thisdir in $libpth $xlibpth; do
3863   test -d $thisdir && libspath="$libspath $thisdir"
3864 done
3865 for thislib in $libswanted; do
3866         for thisdir in $libspath; do
3867             xxx=''
3868             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
3869                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|tail -1`
3870                 $test -f "$xxx" && eval $libscheck
3871                 $test -f "$xxx" && libstyle=shared
3872             fi
3873             if test ! -f "$xxx"; then
3874                 xxx=$thisdir/lib$thislib.$so
3875                 $test -f "$xxx" && eval $libscheck
3876                 $test -f "$xxx" && libstyle=shared
3877             fi  
3878             if test ! -f "$xxx"; then
3879                 xxx=$thisdir/lib$thislib$_a
3880                 $test -f "$xxx" && eval $libscheck
3881                 $test -f "$xxx" && libstyle=static
3882             fi
3883             if test ! -f "$xxx"; then
3884                 xxx=$thisdir/$thislib$_a
3885                 $test -f "$xxx" && eval $libscheck
3886                 $test -f "$xxx" && libstyle=static
3887             fi
3888             if test ! -f "$xxx"; then
3889                 xxx=$thisdir/lib${thislib}_s$_a
3890                 $test -f "$xxx" && eval $libscheck
3891                 $test -f "$xxx" && libstyle=static
3892                 $test -f "$xxx" && thislib=${thislib}_s
3893             fi
3894             if test ! -f "$xxx"; then
3895                 xxx=$thisdir/Slib$thislib$_a
3896                 $test -f "$xxx" && eval $libscheck
3897                 $test -f "$xxx" && libstyle=static
3898             fi
3899             if $test -f "$xxx"; then
3900                 case "$libstyle" in
3901                 shared) echo "Found -l$thislib (shared)." ;;
3902                 static) echo "Found -l$thislib." ;;
3903                 *)      echo "Found -l$thislib ($libstyle)." ;;
3904                 esac
3905                 case " $dflt " in
3906                 *"-l$thislib "*);;
3907                 *) dflt="$dflt -l$thislib"
3908                    libsfound="$libsfound $xxx"
3909                    yyy=`basename $xxx`
3910                    libsfiles="$libsfiles $yyy"
3911                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
3912                    case " $libsdirs " in
3913                    *" $yyy "*) ;;
3914                    *) libsdirs="$libsdirs $yyy" ;;
3915                    esac
3916                    ;;
3917                 esac
3918                 break
3919             fi  
3920         done
3921         if $test ! -f "$xxx"; then
3922             echo "No -l$thislib."
3923         fi
3924 done
3925 set X $dflt
3926 shift
3927 dflt="$*"
3928 case "$libs" in
3929 '') dflt="$dflt";;
3930 *) dflt="$libs";;
3931 esac
3932 case "$dflt" in
3933 ' '|'') dflt='none';;
3934 esac
3935
3936 $cat <<EOM
3937
3938 In order to compile $package on your machine, a number of libraries
3939 are usually needed.  Include any other special libraries here as well.
3940 Say "none" for none.  The default list is almost always right.
3941 EOM
3942
3943 echo " "
3944 rp="What libraries to use?"
3945 . ./myread
3946 case "$ans" in
3947 none) libs=' ';;
3948 *) libs="$ans";;
3949 esac
3950
3951 : determine optimization, if desired, or use for debug flag also
3952 case "$optimize" in
3953 ' '|$undef) dflt='none';;
3954 '') dflt='-O';;
3955 *) dflt="$optimize";;
3956 esac
3957 $cat <<EOH
3958
3959 By default, $package compiles with the -O flag to use the optimizer.
3960 Alternately, you might want to use the symbolic debugger, which uses
3961 the -g flag (on traditional Unix systems).  Either flag can be
3962 specified here.  To use neither flag, specify the word "none".
3963
3964 EOH
3965 rp="What optimizer/debugger flag should be used?"
3966 . ./myread
3967 optimize="$ans"
3968 case "$optimize" in
3969 'none') optimize=" ";;
3970 esac
3971
3972 dflt=''
3973 : We will not override a previous value, but we might want to
3974 : augment a hint file
3975 case "$hint" in
3976 default|recommended)
3977         case "$gccversion" in
3978         1*) dflt='-fpcc-struct-return' ;;
3979         esac
3980         case "$optimize" in
3981         *-g*) dflt="$dflt -DDEBUGGING";;
3982         esac
3983         case "$gccversion" in
3984         2*) if test -d /etc/conf/kconfig.d &&
3985                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
3986                 then
3987                         dflt="$dflt -posix"
3988                 fi
3989                 ;;
3990         esac
3991         case "$gccversion" in
3992         1*) ;;
3993         2.[0-8]*) ;;
3994         ?*)     echo " "
3995                 echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
3996                 echo 'int main(void) { return 0; }' > gcctest.c
3997                 if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
3998                         echo "Yes, it does." 2>&1
3999                         case "$ccflags" in
4000                         *strict-aliasing*) 
4001                                 echo "Leaving current flags $ccflags alone." 2>&1
4002                                 ;;
4003                         *) dflt="$dflt -fno-strict-aliasing" ;;
4004                         esac
4005                 else
4006                         echo "Nope, it doesn't, but that's ok." 2>&1
4007                 fi
4008                 ;;
4009         esac
4010         ;;
4011 esac
4012
4013 case "$mips_type" in
4014 *BSD*|'') inclwanted="$locincpth $usrinc";;
4015 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
4016 esac
4017 for thisincl in $inclwanted; do
4018         if $test -d $thisincl; then
4019                 if $test x$thisincl != x$usrinc; then
4020                         case "$dflt" in
4021                         *" -I$thisincl "*);;
4022                         *) dflt="$dflt -I$thisincl ";;
4023                         esac
4024                 fi
4025         fi
4026 done
4027
4028 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
4029         xxx=true;
4030 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
4031         xxx=true;
4032 else
4033         xxx=false;
4034 fi;
4035 if $xxx; then
4036         case "$dflt" in
4037         *$2*);;
4038         *) dflt="$dflt -D$2";;
4039         esac;
4040 fi'
4041
4042 set signal.h LANGUAGE_C; eval $inctest
4043
4044 case "$usesocks" in
4045 $define)
4046         ccflags="$ccflags -DSOCKS"
4047         ;;
4048 esac
4049
4050 case "$hint" in
4051 default|recommended) dflt="$ccflags $dflt" ;;
4052 *) dflt="$ccflags";;
4053 esac
4054
4055 case "$dflt" in
4056 ''|' ') dflt=none;;
4057 esac
4058
4059 $cat <<EOH
4060
4061 Your C compiler may want other flags.  For this question you should include
4062 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
4063 but you should NOT include libraries or ld flags like -lwhatever.  If you
4064 want $package to honor its debug switch, you should include -DDEBUGGING here.
4065 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
4066
4067 To use no flags, specify the word "none".
4068
4069 EOH
4070 set X $dflt
4071 shift
4072 dflt=${1+"$@"}
4073 rp="Any additional cc flags?"
4074 . ./myread
4075 case "$ans" in
4076 none) ccflags='';;
4077 *) ccflags="$ans";;
4078 esac
4079
4080 : the following weeds options from ccflags that are of no interest to cpp
4081 case "$cppflags" in
4082 '') cppflags="$ccflags" ;;
4083 *)  cppflags="$cppflags $ccflags" ;;
4084 esac
4085 case "$gccversion" in
4086 1*) cppflags="$cppflags -D__GNUC__"
4087 esac
4088 case "$mips_type" in
4089 '');;
4090 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
4091 esac
4092 case "$cppflags" in
4093 '');;
4094 *)
4095         echo " "
4096         echo "Let me guess what the preprocessor flags are..." >&4
4097         set X $cppflags
4098         shift
4099         cppflags=''
4100         $cat >cpp.c <<'EOM'
4101 #define BLURFL foo
4102
4103 BLURFL xx LFRULB
4104 EOM
4105         previous=''
4106         for flag in $*
4107         do
4108                 case "$flag" in
4109                 -*) ftry="$flag";;
4110                 *) ftry="$previous $flag";;
4111                 esac
4112                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
4113                         >cpp1.out 2>/dev/null && \
4114                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
4115                         >cpp2.out 2>/dev/null && \
4116                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
4117                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
4118                 then
4119                         cppflags="$cppflags $ftry"
4120                         previous=''
4121                 else
4122                         previous="$flag"
4123                 fi
4124         done
4125         set X $cppflags
4126         shift
4127         cppflags=${1+"$@"}
4128         case "$cppflags" in
4129         *-*)  echo "They appear to be: $cppflags";;
4130         esac
4131         $rm -f cpp.c cpp?.out
4132         ;;
4133 esac
4134
4135 : flags used in final linking phase
4136 case "$ldflags" in
4137 '') if ./venix; then
4138                 dflt='-i -z'
4139         else
4140                 dflt=''
4141         fi
4142         case "$ccflags" in
4143         *-posix*) dflt="$dflt -posix" ;;
4144         esac
4145         ;;
4146 *) dflt="$ldflags";;
4147 esac
4148
4149 : Try to guess additional flags to pick up local libraries.
4150 for thislibdir in $libpth; do
4151         case " $loclibpth " in
4152         *" $thislibdir "*)
4153                 case "$dflt " in 
4154                 *"-L$thislibdir "*) ;;
4155                 *)  dflt="$dflt -L$thislibdir" ;;
4156                 esac
4157                 ;;
4158         esac
4159 done
4160
4161 case "$dflt" in
4162 '') dflt='none' ;;
4163 esac
4164
4165 $cat <<EOH
4166
4167 Your C linker may need flags.  For this question you should
4168 include -L/whatever and any other flags used by the C linker, but you
4169 should NOT include libraries like -lwhatever.
4170
4171 Make sure you include the appropriate -L/path flags if your C linker
4172 does not normally search all of the directories you specified above,
4173 namely
4174         $libpth
4175 To use no flags, specify the word "none".
4176
4177 EOH
4178
4179 rp="Any additional ld flags (NOT including libraries)?"
4180 . ./myread
4181 case "$ans" in
4182 none) ldflags='';;
4183 *) ldflags="$ans";;
4184 esac
4185 rmlist="$rmlist pdp11"
4186
4187 : coherency check
4188 echo " "
4189 echo "Checking your choice of C compiler and flags for coherency..." >&4
4190 $cat > try.c <<'EOF'
4191 #include <stdio.h>
4192 int main() { printf("Ok\n"); exit(0); }
4193 EOF
4194 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
4195 shift
4196 $cat >try.msg <<'EOM'
4197 I've tried to compile and run the following simple program:
4198
4199 EOM
4200 $cat try.c >> try.msg
4201
4202 $cat >> try.msg <<EOM
4203
4204 I used the command:
4205
4206         $*
4207         ./try
4208
4209 and I got the following output:
4210
4211 EOM
4212 dflt=y
4213 if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
4214         if $sh -c './try' >>try.msg 2>&1; then
4215                 xxx=`./try`
4216                 case "$xxx" in
4217                 "Ok") dflt=n ;;
4218                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
4219                         case " $libs " in
4220                         *" -lsfio "*)
4221                                 cat >> try.msg <<'EOQS'
4222 If $libs contains -lsfio, and sfio is mis-configured, then it
4223 sometimes (apparently) runs and exits with a 0 status, but with no
4224 output!  It may have to do with sfio's use of _exit vs. exit.
4225
4226 EOQS
4227                                 rp="You have a big problem.  Shall I abort Configure"
4228                                 dflt=y
4229                                 ;;
4230                         esac
4231                         ;;
4232                 esac
4233         else
4234                 echo "The program compiled OK, but exited with status $?." >>try.msg
4235                 rp="You have a problem.  Shall I abort Configure"
4236                 dflt=y
4237         fi
4238 else
4239         echo "I can't compile the test program." >>try.msg
4240         rp="You have a BIG problem.  Shall I abort Configure"
4241         dflt=y
4242 fi
4243 case "$dflt" in
4244 y)
4245         $cat try.msg >&4
4246         case "$knowitall" in
4247         '')
4248                 echo "(The supplied flags or libraries might be incorrect.)"
4249                 ;;
4250         *) dflt=n;;
4251         esac
4252         echo " "
4253         . ./myread
4254         case "$ans" in
4255         n*|N*) ;;
4256         *)      echo "Ok.  Stopping Configure." >&4
4257                 exit 1
4258                 ;;
4259         esac
4260         ;;
4261 n) echo "OK, that should do.";;
4262 esac
4263 $rm -f try try.* core
4264
4265 : define an is-a-typedef? function
4266 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
4267 case "$inclist" in
4268 "") inclist="sys/types.h";;
4269 esac;
4270 eval "varval=\$$var";
4271 case "$varval" in
4272 "")
4273         $rm -f temp.c;
4274         for inc in $inclist; do
4275                 echo "#include <$inc>" >>temp.c;
4276         done;
4277         echo "#ifdef $type" >> temp.c;
4278         echo "printf(\"We have $type\");" >> temp.c;
4279         echo "#endif" >> temp.c;
4280         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
4281         if $contains $type temp.E >/dev/null 2>&1; then
4282                 eval "$var=\$type";
4283         else
4284                 eval "$var=\$def";
4285         fi;
4286         $rm -f temp.?;;
4287 *) eval "$var=\$varval";;
4288 esac'
4289
4290 : define an is-a-typedef? function that prompts if the type is not available.
4291 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
4292 case "$inclist" in
4293 "") inclist="sys/types.h";;
4294 esac;
4295 eval "varval=\$$var";
4296 case "$varval" in
4297 "")
4298         $rm -f temp.c;
4299         for inc in $inclist; do
4300                 echo "#include <$inc>" >>temp.c;
4301         done;
4302         echo "#ifdef $type" >> temp.c;
4303         echo "printf(\"We have $type\");" >> temp.c;
4304         echo "#endif" >> temp.c;
4305         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
4306         echo " " ;
4307         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
4308         if $contains $type temp.E >/dev/null 2>&1; then
4309                 echo "$type found." >&4;
4310                 eval "$var=\$type";
4311         else
4312                 echo "$type NOT found." >&4;
4313                 dflt="$def";
4314                 . ./myread ;
4315                 eval "$var=\$ans";
4316         fi;
4317         $rm -f temp.?;;
4318 *) eval "$var=\$varval";;
4319 esac'
4320
4321 : define a shorthand compile call
4322 compile='
4323 mc_file=$1;
4324 shift;
4325 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
4326 : define a shorthand compile call for compilations that should be ok.
4327 compile_ok='
4328 mc_file=$1;
4329 shift;
4330 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
4331
4332 : check for lengths of integral types
4333 echo " "
4334 case "$intsize" in
4335 '')
4336         echo "Checking to see how big your integers are..." >&4
4337         $cat >intsize.c <<'EOCP'
4338 #include <stdio.h>
4339 int main()
4340 {
4341         printf("intsize=%d;\n", (int)sizeof(int));
4342         printf("longsize=%d;\n", (int)sizeof(long));
4343         printf("shortsize=%d;\n", (int)sizeof(short));
4344         exit(0);
4345 }
4346 EOCP
4347         set intsize
4348         if eval $compile_ok && ./intsize > /dev/null; then
4349                 eval `./intsize`
4350                 echo "Your integers are $intsize bytes long."
4351                 echo "Your long integers are $longsize bytes long."
4352                 echo "Your short integers are $shortsize bytes long."
4353         else
4354                 $cat >&4 <<EOM
4355 !
4356 Help! I can't compile and run the intsize test program: please enlighten me!
4357 (This is probably a misconfiguration in your system or libraries, and
4358 you really ought to fix it.  Still, I'll try anyway.)
4359 !
4360 EOM
4361                 dflt=4
4362                 rp="What is the size of an integer (in bytes)?"
4363                 . ./myread
4364                 intsize="$ans"
4365                 dflt=$intsize
4366                 rp="What is the size of a long integer (in bytes)?"
4367                 . ./myread
4368                 longsize="$ans"
4369                 dflt=2
4370                 rp="What is the size of a short integer (in bytes)?"
4371                 . ./myread
4372                 shortsize="$ans"
4373         fi
4374         ;;
4375 esac
4376 $rm -f intsize intsize.*
4377
4378 : see what type lseek is declared as in the kernel
4379 rp="What is the type used for lseek's offset on this system?"
4380 set off_t lseektype long stdio.h sys/types.h
4381 eval $typedef_ask
4382
4383 echo " "
4384 echo "Checking to see how big your file offsets are..." >&4
4385 $cat >try.c <<EOCP
4386 #include <sys/types.h>
4387 #include <stdio.h>
4388 int main()
4389 {
4390     printf("%d\n", (int)sizeof($lseektype));
4391     return(0); 
4392 }
4393 EOCP
4394 set try
4395 if eval $compile_ok; then
4396         lseeksize=`./try`
4397         echo "Your file offsets are $lseeksize bytes long."
4398 else
4399         dflt=$longsize
4400         echo " "
4401         echo "(I can't seem to compile the test program.  Guessing...)"
4402         rp="What is the size of your file offsets (in bytes)?"
4403         . ./myread
4404         lseeksize="$ans"
4405 fi
4406 $rm -f try.c try
4407
4408 : see what type file positions are declared as in the library
4409 rp="What is the type for file position used by fsetpos()?"
4410 set fpos_t fpostype long stdio.h sys/types.h
4411 eval $typedef_ask
4412
4413 echo " "
4414 case "$fpostype" in
4415 *_t) zzz="$fpostype"    ;;
4416 *)   zzz="fpos_t"       ;;
4417 esac
4418 echo "Checking the size of $zzz..." >&4 
4419 cat > try.c <<EOCP
4420 #include <sys/types.h>
4421 #include <stdio.h>
4422 int main() {
4423     printf("%d\n", (int)sizeof($fpostype));
4424     exit(0);
4425 }
4426 EOCP
4427 set try
4428 if eval $compile_ok; then
4429         yyy=`./try`
4430         case "$yyy" in
4431         '')     fpossize=4
4432                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
4433                 ;;
4434         *)      fpossize=$yyy
4435                 echo "Your $zzz is $fpossize bytes long."
4436                 ;;
4437         esac
4438 else
4439         dflt="$longsize"
4440         echo " " >&4
4441         echo "(I can't compile the test program.  Guessing...)" >&4
4442         rp="What is the size of your file positions (in bytes)?"
4443         . ./myread
4444         fpossize="$ans"
4445 fi
4446
4447
4448
4449 # Backward compatibility (uselfs is deprecated).
4450 case "$uselfs" in
4451 "$define"|true|[yY]*)
4452         cat <<EOM >&4
4453
4454 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
4455 EOM
4456         uselargefiles="$define"
4457         ;;
4458 esac                          
4459
4460 case "$lseeksize:$fpossize" in
4461 8:8) cat <<EOM
4462
4463 You can have files larger than 2 gigabytes.
4464 EOM
4465    val="$define" ;;
4466 *)    case "$uselargefiles" in
4467    "$undef"|false|[nN]*) dflt='n' ;;
4468    *)   dflt='y' ;;
4469    esac
4470    cat <<EOM
4471
4472 Perl can be built to understand large files (files larger than 2 gigabytes)
4473 on some systems.  To do so, Configure can be run with -Duselargefiles.
4474
4475 If this doesn't make any sense to you, just accept the default '$dflt'.
4476 EOM
4477    rp='Try to understand large files, if available?'
4478    . ./myread
4479    case "$ans" in
4480    y|Y)         val="$define" ;;
4481    *)           val="$undef"  ;;
4482    esac
4483    ;;
4484 esac
4485 set uselargefiles
4486 eval $setvar
4487 case "$uselargefiles" in
4488 "$define")
4489 : Look for a hint-file generated 'call-back-unit'.  If the
4490 : user has specified that a large files perl is to be built,
4491 : we may need to set or change some other defaults.
4492         if $test -f uselargefiles.cbu; then
4493                 echo "Your platform has some specific hints for large file builds, using them..."
4494                 . ./uselargefiles.cbu
4495                 echo " "
4496                 echo "Rechecking to see how big your file offsets are..." >&4
4497                 $cat >try.c <<EOCP
4498 #include <sys/types.h>
4499 #include <stdio.h>
4500 int main()
4501 {
4502     printf("%d\n", (int)sizeof($lseektype));
4503     return(0); 
4504 }
4505 EOCP
4506                 set try
4507                 if eval $compile_ok; then
4508                         lseeksize=`./try`
4509                         $echo "Your file offsets are now $lseeksize bytes long."
4510                 else
4511                         dflt="$lseeksize"
4512                         echo " "
4513                         echo "(I can't seem to compile the test program.  Guessing...)"
4514                         rp="What is the size of your file offsets (in bytes)?"
4515                         . ./myread
4516                         lseeksize="$ans"
4517                 fi
4518                 case "$fpostype" in
4519                 *_t) zzz="$fpostype"    ;;
4520                 *)   zzz="fpos_t"       ;;
4521                 esac
4522                 $echo $n "Rechecking the size of $zzz...$c" >&4 
4523                 $cat > try.c <<EOCP
4524 #include <sys/types.h>
4525 #include <stdio.h>
4526 int main() {
4527     printf("%d\n", (int)sizeof($fpostype));
4528     exit(0);
4529 }
4530 EOCP
4531                 set try
4532                 if eval $compile_ok; then
4533                         yyy=`./try`
4534                         dflt="$lseeksize"
4535                         case "$yyy" in
4536                         '')     echo " "
4537                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
4538                                 ;;
4539                         *)      fpossize=$yyy
4540                                 echo " $fpossize bytes." >&4
4541                                 ;;
4542                         esac
4543                 else
4544                         dflt="$fpossize"
4545                         echo " "
4546                         echo "(I can't compile the test program.  Guessing...)" >&4
4547                         rp="What is the size of your file positions (in bytes)?"
4548                         . ./myread
4549                         fpossize="$ans"
4550                 fi
4551                 $rm -f try.c try
4552         fi
4553         ;;
4554 esac
4555
4556
4557 case "$usemorebits" in
4558 "$define"|true|[yY]*)
4559         use64bitint="$define"
4560         uselongdouble="$define"
4561         usemorebits="$define"
4562         ;;
4563 *)      usemorebits="$undef"
4564         ;;
4565 esac
4566
4567 : check for void type
4568 echo " "
4569 echo "Checking to see how well your C compiler groks the void type..." >&4
4570 case "$voidflags" in
4571 '')
4572         $cat >try.c <<'EOCP'
4573 #if TRY & 1
4574 void sub() {
4575 #else
4576 sub() {
4577 #endif
4578         extern void moo();      /* function returning void */
4579         void (*goo)();          /* ptr to func returning void */
4580 #if TRY & 8
4581         void *hue;              /* generic ptr */
4582 #endif
4583 #if TRY & 2
4584         void (*foo[10])();
4585 #endif
4586
4587 #if TRY & 4
4588         if(goo == moo) {
4589                 exit(0);
4590         }
4591 #endif
4592         exit(0);
4593 }
4594 int main() { sub(); }
4595 EOCP
4596         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
4597                 voidflags=$defvoidused
4598         echo "Good.  It appears to support void to the level $package wants.">&4
4599                 if $contains warning .out >/dev/null 2>&1; then
4600                         echo "However, you might get some warnings that look like this:"
4601                         $cat .out
4602                 fi
4603         else
4604 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
4605                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
4606                         echo "It supports 1..."
4607                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
4608                                 echo "It also supports 2..."
4609                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
4610                                         voidflags=7
4611                                         echo "And it supports 4 but not 8 definitely."
4612                                 else
4613                                         echo "It doesn't support 4..."
4614                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
4615                                                 voidflags=11
4616                                                 echo "But it supports 8."
4617                                         else
4618                                                 voidflags=3
4619                                                 echo "Neither does it support 8."
4620                                         fi
4621                                 fi
4622                         else
4623                                 echo "It does not support 2..."
4624                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
4625                                         voidflags=13
4626                                         echo "But it supports 4 and 8."
4627                                 else
4628                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
4629                                                 voidflags=5
4630                                                 echo "And it supports 4 but has not heard about 8."
4631                                         else
4632                                                 echo "However it supports 8 but not 4."
4633                                         fi
4634                                 fi
4635                         fi
4636                 else
4637                         echo "There is no support at all for void."
4638                         voidflags=0
4639                 fi
4640         fi
4641 esac
4642 case "$voidflags" in
4643 "$defvoidused") ;;
4644 *)      $cat >&4 <<'EOM'
4645   Support flag bits are:
4646     1: basic void declarations.
4647     2: arrays of pointers to functions returning void.
4648     4: operations between pointers to and addresses of void functions.
4649     8: generic void pointers.
4650 EOM
4651         dflt="$voidflags";
4652         rp="Your void support flags add up to what?"
4653         . ./myread
4654         voidflags="$ans"
4655         ;;
4656 esac
4657 $rm -f try.* .out
4658
4659 : check for length of pointer
4660 echo " "
4661 case "$ptrsize" in
4662 '')
4663         echo "Checking to see how big your pointers are..." >&4
4664         if test "$voidflags" -gt 7; then
4665                 echo '#define VOID_PTR char *' > try.c
4666         else
4667                 echo '#define VOID_PTR void *' > try.c
4668         fi
4669         $cat >>try.c <<'EOCP'
4670 #include <stdio.h>
4671 int main()
4672 {
4673     printf("%d\n", (int)sizeof(VOID_PTR));
4674     exit(0);
4675 }
4676 EOCP
4677         set try
4678         if eval $compile_ok; then
4679                 ptrsize=`./try`
4680                 echo "Your pointers are $ptrsize bytes long."
4681         else
4682                 dflt='4'
4683                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
4684                 rp="What is the size of a pointer (in bytes)?"
4685                 . ./myread
4686                 ptrsize="$ans"
4687         fi
4688         ;;
4689 esac
4690 $rm -f try.c try
4691
4692 : check for long long
4693 echo " "
4694 echo "Checking to see if you have long long..." >&4
4695 echo 'int main() { long long x = 7; return 0; }' > try.c
4696 set try
4697 if eval $compile; then
4698         val="$define"
4699         echo "You have long long."
4700 else
4701         val="$undef"
4702         echo "You do not have long long."
4703 fi
4704 $rm try.*
4705 set d_longlong
4706 eval $setvar
4707
4708 : check for length of long long
4709 case "${d_longlong}${longlongsize}" in
4710 $define)
4711         echo " "
4712         echo "Checking to see how big your long longs are..." >&4
4713         $cat >try.c <<'EOCP'
4714 #include <stdio.h>
4715 int main()
4716 {
4717     printf("%d\n", (int)sizeof(long long));
4718     return(0);
4719 }
4720 EOCP
4721         set try
4722         if eval $compile_ok; then
4723                 longlongsize=`./try$exe_ext`
4724                 echo "Your long longs are $longlongsize bytes long."
4725         else
4726                 dflt='8'
4727                 echo " "
4728                 echo "(I can't seem to compile the test program.  Guessing...)"
4729                 rp="What is the size of a long long (in bytes)?"
4730                 . ./myread
4731                 longlongsize="$ans"
4732         fi
4733         if $test "X$longsize" = "X$longlongsize"; then
4734                 echo "(That isn't any different from an ordinary long.)"
4735         fi      
4736         ;;
4737 esac
4738 $rm -f try.* try
4739
4740 : determine filename position in cpp output
4741 echo " "
4742 echo "Computing filename position in cpp output for #include directives..." >&4
4743 echo '#include <stdio.h>' > foo.c
4744 $cat >fieldn <<EOF
4745 $startsh
4746 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
4747 $grep '^[       ]*#.*stdio\.h' | \
4748 while read cline; do
4749         pos=1
4750         set \$cline
4751         while $test \$# -gt 0; do
4752                 if $test -r \`echo \$1 | $tr -d '"'\`; then
4753                         echo "\$pos"
4754                         exit 0
4755                 fi
4756                 shift
4757                 pos=\`expr \$pos + 1\`
4758         done
4759 done
4760 EOF
4761 chmod +x fieldn
4762 fieldn=`./fieldn`
4763 $rm -f foo.c fieldn
4764 case $fieldn in
4765 '') pos='???';;
4766 1) pos=first;;
4767 2) pos=second;;
4768 3) pos=third;;
4769 *) pos="${fieldn}th";;
4770 esac
4771 echo "Your cpp writes the filename in the $pos field of the line."
4772
4773 : locate header file
4774 $cat >findhdr <<EOF
4775 $startsh
4776 wanted=\$1
4777 name=''
4778 for usrincdir in $usrinc
4779 do
4780         if test -f \$usrincdir/\$wanted; then
4781                 echo "\$usrincdir/\$wanted"
4782                 exit 0
4783         fi
4784 done
4785 awkprg='{ print \$$fieldn }'
4786 echo "#include <\$wanted>" > foo\$\$.c
4787 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
4788 $grep "^[       ]*#.*\$wanted" | \
4789 while read cline; do
4790         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
4791         case "\$name" in
4792         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
4793         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
4794         *) exit 2;;
4795         esac;
4796 done;
4797 #
4798 # status = 0: grep returned 0 lines, case statement not executed
4799 # status = 1: headerfile found
4800 # status = 2: while loop executed, no headerfile found
4801 #
4802 status=\$?
4803 $rm -f foo\$\$.c;
4804 if test \$status -eq 1; then
4805         exit 0;
4806 fi
4807 exit 1
4808 EOF
4809 chmod +x findhdr
4810
4811 : define an alternate in-header-list? function
4812 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
4813 cont=true; xxf="echo \"<\$1> found.\" >&4";
4814 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
4815 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
4816 esac;
4817 case $# in 4) instead=instead;; *) instead="at last";; esac;
4818 while $test "$cont"; do
4819         xxx=`./findhdr $1`
4820         var=$2; eval "was=\$$2";
4821         if $test "$xxx" && $test -r "$xxx";
4822         then eval $xxf;
4823         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
4824                 cont="";
4825         else eval $xxnf;
4826         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
4827         set $yyy; shift; shift; yyy=$@;
4828         case $# in 0) cont="";;
4829         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
4830                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
4831         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
4832                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
4833         esac;
4834 done;
4835 while $test "$yyy";
4836 do set $yyy; var=$2; eval "was=\$$2";
4837         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
4838         set $yyy; shift; shift; yyy=$@;
4839 done'
4840
4841 : see if inttypes.h is available
4842 : we want a real compile instead of Inhdr because some systems
4843 : have an inttypes.h which includes non-existent headers
4844 echo " "
4845 $cat >try.c <<EOCP
4846 #include <inttypes.h>
4847 int main() {
4848         static int32_t foo32 = 0x12345678;
4849 }
4850 EOCP
4851 set try
4852 if eval $compile; then
4853         echo "<inttypes.h> found." >&4
4854         val="$define"
4855 else
4856         echo "<inttypes.h> NOT found." >&4
4857         val="$undef"
4858 fi
4859 $rm -f try.c try
4860 set i_inttypes
4861 eval $setvar
4862
4863 : check for int64_t
4864 echo " "
4865 echo "Checking to see if you have int64_t..." >&4
4866 $cat >try.c <<EOCP
4867 #include <sys/types.h>
4868 #$i_inttypes I_INTTYPES
4869 #ifdef I_INTTYPES
4870 #include <inttypes.h>
4871 #endif
4872 int main() { int64_t x = 7; }
4873 EOCP
4874 set try
4875 if eval $compile; then
4876         val="$define"
4877         echo "You have int64_t."
4878 else
4879         val="$undef"
4880         echo "You do not have int64_t."
4881 fi
4882 $rm -f try try.*
4883 set d_int64_t
4884 eval $setvar
4885
4886
4887 echo " "
4888 echo "Checking which 64-bit integer type we could use..." >&4
4889
4890 case "$intsize" in
4891 8) val=int
4892    set quadtype
4893    eval $setvar
4894    val='"unsigned int"'
4895    set uquadtype
4896    eval $setvar
4897    quadkind=1
4898    ;;
4899 *) case "$longsize" in
4900    8) val=long
4901       set quadtype
4902       eval $setvar
4903       val='"unsigned long"'
4904       set uquadtype
4905       eval $setvar
4906       quadkind=2
4907       ;;
4908    *) case "$d_longlong:$longlongsize" in
4909       define:8)
4910         val='"long long"'
4911         set quadtype
4912         eval $setvar
4913         val='"unsigned long long"'
4914         set uquadtype
4915         eval $setvar
4916         quadkind=3
4917         ;;
4918       *) case "$d_int64_t" in
4919          define)
4920            val=int64_t
4921            set quadtype
4922            eval $setvar
4923            val=uint64_t
4924            set uquadtype
4925            eval $setvar
4926            quadkind=4
4927            ;;
4928          esac
4929          ;;
4930       esac
4931       ;;
4932    esac
4933    ;;
4934 esac
4935
4936 case "$quadtype" in
4937 '')     echo "Alas, no 64-bit integer types in sight." >&4
4938         d_quad="$undef"
4939         ;;
4940 *)      echo "We could use '$quadtype' for 64-bit integers." >&4
4941         d_quad="$define"
4942         ;;
4943 esac
4944
4945
4946 case "$uselonglong" in
4947 "$define"|true|[yY]*)
4948         cat <<EOM >&4
4949
4950 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
4951 EOM
4952         use64bitint="$define"
4953         ;;
4954 esac                          
4955 case "$use64bits" in
4956 "$define"|true|[yY]*)
4957         cat <<EOM >&4
4958
4959 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
4960 EOM
4961         use64bitint="$define"
4962         ;;
4963 esac                          
4964 case "$use64bitints" in
4965 "$define"|true|[yY]*)
4966         cat <<EOM >&4
4967
4968 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
4969 EOM
4970         use64bitint="$define"
4971         ;;
4972 esac                          
4973 case "$use64bitsint" in
4974 "$define"|true|[yY]*)
4975         cat <<EOM >&4
4976
4977 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
4978 EOM
4979         use64bitint="$define"
4980         ;;
4981 esac                          
4982 case "$uselonglongs" in
4983 "$define"|true|[yY]*)
4984         cat <<EOM >&4
4985
4986 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
4987 EOM
4988         use64bitint="$define"
4989         ;;
4990 esac                          
4991 case "$use64bitsall" in
4992 "$define"|true|[yY]*)
4993         cat <<EOM >&4
4994
4995 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
4996 EOM
4997         use64bitall="$define"
4998         ;;
4999 esac                          
5000
5001 case "$ccflags" in
5002 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
5003 esac
5004 case "$use64bitall" in
5005 "$define"|true|[yY]*) use64bitint="$define" ;;
5006 esac
5007
5008 case "$longsize" in
5009 8) cat <<EOM
5010
5011 You have natively 64-bit long integers.
5012 EOM
5013    val="$define"
5014    ;;
5015 *) case "$use64bitint" in
5016    "$define"|true|[yY]*) dflt='y';;
5017    *) dflt='n';;
5018    esac
5019    case "$d_quad" in
5020    "$define") ;;
5021    *) dflt='n' ;;
5022    esac
5023    cat <<EOM
5024
5025 Perl can be built to take advantage of 64-bit integer types
5026 on some systems.  To do so, Configure can be run with -Duse64bitint.
5027 Choosing this option will most probably introduce binary incompatibilities.
5028
5029 If this doesn't make any sense to you, just accept the default '$dflt'.
5030 (The default has been chosen based on your configuration.)
5031 EOM
5032    rp='Try to use 64-bit integers, if available?'
5033    . ./myread
5034    case "$ans" in
5035    [yY]*) val="$define" ;;
5036    *)     val="$undef"  ;;
5037    esac
5038    ;;
5039 esac
5040 set use64bitint
5041 eval $setvar
5042
5043 case "$use64bitall" in
5044 "$define"|true|[yY]*) dflt='y' ;;
5045 *) case "$longsize" in
5046    8) dflt='y' ;;
5047    *) dflt='n' ;;
5048    esac
5049    ;;
5050 esac    
5051 cat <<EOM
5052
5053 You may also choose to try maximal 64-bitness.  It means using as much
5054 64-bitness as possible on the platform.  This in turn means even more
5055 binary incompatibilities.  On the other hand, your platform may not
5056 have any more 64-bitness available than what you already have chosen.
5057
5058 If this doesn't make any sense to you, just accept the default '$dflt'.
5059 (The default has been chosen based on your configuration.)
5060 EOM
5061 rp='Try to use maximal 64-bit support, if available?'
5062 . ./myread
5063 case "$ans" in
5064 [yY]*) val="$define" ;;
5065 *)     val="$undef"  ;;
5066 esac
5067 set use64bitall
5068 eval $setvar
5069 case "$use64bitall" in
5070 "$define")
5071         case "$use64bitint" in
5072         "$undef")
5073                 cat <<EOM
5074
5075 Since you have chosen a maximally 64-bit build, I'm also turning on
5076 the use of 64-bit integers.
5077 EOM
5078                 use64bitint="$define" ;;
5079         esac
5080         ;;
5081 esac
5082
5083 case "$use64bitall" in
5084 "$define"|true|[yY]*)
5085         case "$ptrsize" in
5086         4)      cat <<EOM >&4
5087
5088 *** You have chosen a maximally 64-bit build, but your pointers
5089 *** are only 4 bytes wide, disabling maximal 64-bitness.
5090
5091 EOM
5092                 use64bitall="$undef"
5093                 case "$use64bitint" in
5094                 "$define"|true|[yY]*) ;;
5095                 *)      cat <<EOM >&4
5096
5097 *** Downgrading from maximal 64-bitness to using 64-bit integers.
5098
5099 EOM
5100                         use64bitint="$define"
5101                         ;;
5102                 esac
5103                 ;;
5104         esac
5105         ;;
5106 esac
5107
5108 case "$use64bitint" in
5109 "$define"|true|[yY]*)
5110 : Look for a hint-file generated 'call-back-unit'.  If the
5111 : user has specified that a 64-bit perl is to be built,
5112 : we may need to set or change some other defaults.
5113         if $test -f use64bitint.cbu; then
5114                 echo "Your platform has some specific hints for 64-bit integers, using them..."
5115                 . ./use64bitint.cbu
5116         fi
5117         case "$longsize" in
5118         4) case "$archname64" in
5119            '') archname64=64int ;;
5120            esac
5121            ;;
5122         esac
5123         ;;
5124 esac
5125
5126 case "$use64bitall" in
5127 "$define"|true|[yY]*)
5128 : Look for a hint-file generated 'call-back-unit'.  If the
5129 : user has specified that a maximally 64-bit perl is to be built,
5130 : we may need to set or change some other defaults.
5131         if $test -f use64bitall.cbu; then
5132                 echo "Your platform has some specific hints for 64-bit builds, using them..."
5133                 . ./use64bitall.cbu
5134         fi
5135         case "$longsize" in
5136         4) case "$archname64" in
5137            ''|64int) archname64=64all ;;
5138            esac
5139            ;;
5140         esac
5141         ;;
5142 esac
5143
5144 echo " "
5145 echo "Checking for GNU C Library..." >&4
5146 cat >gnulibc.c <<EOM
5147 #include <stdio.h>
5148 int main()
5149 {
5150 #ifdef __GLIBC__
5151     exit(0);
5152 #else
5153     exit(1);
5154 #endif
5155 }
5156 EOM
5157 set gnulibc
5158 if eval $compile_ok && ./gnulibc; then
5159         val="$define"
5160         echo "You are using the GNU C Library"
5161 else
5162         val="$undef"
5163         echo "You are not using the GNU C Library"
5164 fi
5165 $rm -f gnulibc*
5166 set d_gnulibc
5167 eval $setvar
5168
5169 : see if nm is to be used to determine whether a symbol is defined or not
5170 case "$usenm" in
5171 '')
5172         dflt=''
5173         case "$d_gnulibc" in
5174         "$define")
5175                 echo " "
5176                 echo "nm probably won't work on the GNU C Library." >&4
5177                 dflt=n
5178                 ;;
5179         esac
5180         case "$dflt" in
5181         '') 
5182                 if $test "$osname" = aix -a ! -f /lib/syscalls.exp; then
5183                         echo " "
5184                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
5185                         echo "'nm' won't be sufficient on this sytem." >&4
5186                         dflt=n
5187                 fi
5188                 ;;
5189         esac
5190         case "$dflt" in
5191         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
5192                 if $test $dflt -gt 20; then
5193                         dflt=y
5194                 else
5195                         dflt=n
5196                 fi
5197                 ;;
5198         esac
5199         ;;
5200 *)
5201         case "$usenm" in
5202         true|$define) dflt=y;;
5203         *) dflt=n;;
5204         esac
5205         ;;
5206 esac
5207 $cat <<EOM
5208
5209 I can use $nm to extract the symbols from your C libraries. This
5210 is a time consuming task which may generate huge output on the disk (up
5211 to 3 megabytes) but that should make the symbols extraction faster. The
5212 alternative is to skip the 'nm' extraction part and to compile a small
5213 test program instead to determine whether each symbol is present. If
5214 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
5215 this may be the best solution.
5216
5217 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
5218
5219 EOM
5220 rp="Shall I use $nm to extract C symbols from the libraries?"
5221 . ./myread
5222 case "$ans" in
5223 [Nn]*) usenm=false;;
5224 *) usenm=true;;
5225 esac
5226
5227 runnm=$usenm
5228 case "$reuseval" in
5229 true) runnm=false;;
5230 esac
5231
5232 : nm options which may be necessary
5233 case "$nm_opt" in
5234 '') if $test -f /mach_boot; then
5235                 nm_opt=''       # Mach
5236         elif $test -d /usr/ccs/lib; then
5237                 nm_opt='-p'     # Solaris (and SunOS?)
5238         elif $test -f /dgux; then
5239                 nm_opt='-p'     # DG-UX
5240         elif $test -f /lib64/rld; then
5241                 nm_opt='-p'     # 64-bit Irix
5242         else
5243                 nm_opt=''
5244         fi;;
5245 esac
5246
5247 : nm options which may be necessary for shared libraries but illegal
5248 : for archive libraries.  Thank you, Linux.
5249 case "$nm_so_opt" in
5250 '')     case "$myuname" in
5251         *linux*)
5252                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
5253                         nm_so_opt='--dynamic'
5254                 fi
5255                 ;;
5256         esac
5257         ;;
5258 esac
5259
5260 case "$runnm" in
5261 true)
5262 : get list of predefined functions in a handy place
5263 echo " "
5264 case "$libc" in
5265 '') libc=unknown
5266         case "$libs" in
5267         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
5268         esac
5269         ;;
5270 esac
5271 libnames='';
5272 case "$libs" in
5273 '') ;;
5274 *)  for thislib in $libs; do
5275         case "$thislib" in
5276         -lc|-lc_s)
5277                 : Handle C library specially below.
5278                 ;;
5279         -l*)
5280                 thislib=`echo $thislib | $sed -e 's/^-l//'`
5281                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
5282                         :
5283                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
5284                         :
5285                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
5286                         :
5287                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
5288                         :
5289                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
5290                         :
5291                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
5292                         :
5293                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
5294                         :
5295                 else
5296                         try=''
5297                 fi
5298                 libnames="$libnames $try"
5299                 ;;
5300         *) libnames="$libnames $thislib" ;;
5301         esac
5302         done
5303         ;;
5304 esac
5305 xxx=normal
5306 case "$libc" in
5307 unknown)
5308         set /lib/libc.$so
5309         for xxx in $libpth; do
5310                 $test -r $1 || set $xxx/libc.$so
5311                 : The messy sed command sorts on library version numbers.
5312                 $test -r $1 || \
5313                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
5314                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
5315                                 h
5316                                 s/[0-9][0-9]*/0000&/g
5317                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
5318                                 G
5319                                 s/\n/ /' | \
5320                          $sort | $sed -e 's/^.* //'`
5321                 eval set \$$#
5322         done
5323         $test -r $1 || set /usr/ccs/lib/libc.$so
5324         $test -r $1 || set /lib/libsys_s$_a
5325         ;;
5326 *)
5327         set blurfl
5328         ;;
5329 esac
5330 if $test -r "$1"; then
5331         echo "Your (shared) C library seems to be in $1."
5332         libc="$1"
5333 elif $test -r /lib/libc && $test -r /lib/clib; then
5334         echo "Your C library seems to be in both /lib/clib and /lib/libc."
5335         xxx=apollo
5336         libc='/lib/clib /lib/libc'
5337         if $test -r /lib/syslib; then
5338                 echo "(Your math library is in /lib/syslib.)"
5339                 libc="$libc /lib/syslib"
5340         fi
5341 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5342         echo "Your C library seems to be in $libc, as you said before."
5343 elif $test -r $incpath/usr/lib/libc$_a; then
5344         libc=$incpath/usr/lib/libc$_a;
5345         echo "Your C library seems to be in $libc.  That's fine."
5346 elif $test -r /lib/libc$_a; then
5347         libc=/lib/libc$_a;
5348         echo "Your C library seems to be in $libc.  You're normal."
5349 else
5350         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
5351                 :
5352         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
5353                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
5354         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
5355                 :
5356         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5357                 :
5358         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5359                 :
5360         else
5361                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
5362         fi
5363         if $test -r "$tans"; then
5364                 echo "Your C library seems to be in $tans, of all places."
5365                 libc=$tans
5366         else
5367                 libc='blurfl'
5368         fi
5369 fi
5370 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5371         dflt="$libc"
5372         cat <<EOM
5373
5374 If the guess above is wrong (which it might be if you're using a strange
5375 compiler, or your machine supports multiple models), you can override it here.
5376
5377 EOM
5378 else
5379         dflt=''
5380         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
5381         cat >&4 <<EOM
5382 I can't seem to find your C library.  I've looked in the following places:
5383
5384 EOM
5385         $sed 's/^/      /' libpath
5386         cat <<EOM
5387
5388 None of these seems to contain your C library. I need to get its name...
5389
5390 EOM
5391 fi
5392 fn=f
5393 rp='Where is your C library?'
5394 . ./getfile
5395 libc="$ans"
5396
5397 echo " "
5398 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
5399 set X `cat libnames`
5400 shift
5401 xxx=files
5402 case $# in 1) xxx=file; esac
5403 echo "Extracting names from the following $xxx for later perusal:" >&4
5404 echo " "
5405 $sed 's/^/      /' libnames >&4
5406 echo " "
5407 $echo $n "This may take a while...$c" >&4
5408
5409 for file in $*; do
5410         case $file in
5411         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
5412         *) $nm $nm_opt $file 2>/dev/null;;
5413         esac
5414 done >libc.tmp
5415
5416 $echo $n ".$c"
5417 $grep fprintf libc.tmp > libc.ptf
5418 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
5419 xrun='eval "<libc.tmp $com >libc.list"; echo "done" >&4'
5420 xxx='[ADTSIW]'
5421 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *_[_.]*//p' -e 's/^.* $xxx  *//p'";\
5422         eval $xscan;\
5423         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5424                 eval $xrun
5425 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
5426         eval $xscan;\
5427         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5428                 eval $xrun
5429 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
5430         eval $xscan;\
5431         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5432                 eval $xrun
5433 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
5434         eval $xscan;\
5435         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5436                 eval $xrun
5437 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
5438         eval $xscan;\
5439         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5440                 eval $xrun
5441 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
5442         eval $xscan;\
5443         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5444                 eval $xrun
5445 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
5446                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
5447         eval $xscan;\
5448         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5449                 eval $xrun
5450 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
5451         eval $xscan;\
5452         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5453                 eval $xrun
5454 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
5455         eval $xscan;\
5456         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5457                 eval $xrun
5458 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
5459         eval $xscan;\
5460         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5461                 eval $xrun
5462 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
5463         eval $xscan;\
5464         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5465                 eval $xrun
5466 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
5467         eval $xscan;\
5468         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5469                 eval $xrun
5470 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
5471         eval $xscan;\
5472         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5473                 eval $xrun
5474 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
5475         eval $xscan;\
5476         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5477                 eval $xrun
5478 else
5479         $nm -p $* 2>/dev/null >libc.tmp
5480         $grep fprintf libc.tmp > libc.ptf
5481         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
5482                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
5483         then
5484                 nm_opt='-p'
5485                 eval $xrun
5486         else
5487                 echo " "
5488                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
5489                 com=''
5490                 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
5491                         for thisname in $libnames $libc; do
5492                                 $ar t $thisname >>libc.tmp
5493                         done
5494                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
5495                         echo "Ok." >&4
5496                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
5497                         # Repeat libc to extract forwarders to DLL entries too
5498                         for thisname in $libnames $libc; do
5499                                 $ar tv $thisname >>libc.tmp
5500                                 # Revision 50 of EMX has bug in $ar.
5501                                 # it will not extract forwarders to DLL entries
5502                                 # Use emximp which will extract exactly them.
5503                                 emximp -o tmp.imp $thisname \
5504                                     2>/dev/null && \
5505                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
5506                                     < tmp.imp >>libc.tmp
5507                                 $rm tmp.imp
5508                         done
5509                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
5510                         echo "Ok." >&4
5511                 else
5512                         echo "$ar didn't seem to work right." >&4
5513                         echo "Maybe this is a Cray...trying bld instead..." >&4
5514                         if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
5515                         then
5516                                 for thisname in $libnames; do
5517                                         bld t $libnames | \
5518                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
5519                                         $ar t $thisname >>libc.tmp
5520                                 done
5521                                 echo "Ok." >&4
5522                         else
5523                                 echo "That didn't work either.  Giving up." >&4
5524                                 exit 1
5525                         fi
5526                 fi
5527         fi
5528 fi
5529 nm_extract="$com"
5530 if $test -f /lib/syscalls.exp; then
5531         echo " "
5532         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
5533         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*$/\1/p' /lib/syscalls.exp >>libc.list
5534 fi
5535 ;;
5536 esac
5537 $rm -f libnames libpath
5538
5539 : is a C symbol defined?
5540 csym='tlook=$1;
5541 case "$3" in
5542 -v) tf=libc.tmp; tc=""; tdc="";;
5543 -a) tf=libc.tmp; tc="[0]"; tdc="[]";;
5544 *) tlook="^$1\$"; tf=libc.list; tc="()"; tdc="()";;
5545 esac;
5546 tx=yes;
5547 case "$reuseval-$4" in
5548 true-) ;;
5549 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
5550 esac;
5551 case "$tx" in
5552 yes)
5553         case "$runnm" in
5554         true)
5555                 if $contains $tlook $tf >/dev/null 2>&1;
5556                 then tval=true;
5557                 else tval=false;
5558                 fi;;
5559         *)
5560                 echo "int main() { extern short $1$tdc; printf(\"%hd\", $1$tc); }" > t.c;
5561                 if $cc -o t $optimize $ccflags $ldflags t.c $libs >/dev/null 2>&1;
5562                 then tval=true;
5563                 else tval=false;
5564                 fi;
5565                 $rm -f t t.c;;
5566         esac;;
5567 *)
5568         case "$tval" in
5569         $define) tval=true;;
5570         *) tval=false;;
5571         esac;;
5572 esac;
5573 eval "$2=$tval"'
5574
5575 : define an is-in-libc? function
5576 inlibc='echo " "; td=$define; tu=$undef;
5577 sym=$1; var=$2; eval "was=\$$2";
5578 tx=yes;
5579 case "$reuseval$was" in
5580 true) ;;
5581 true*) tx=no;;
5582 esac;
5583 case "$tx" in
5584 yes)
5585         set $sym tres -f;
5586         eval $csym;
5587         case "$tres" in
5588         true)
5589                 echo "$sym() found." >&4;
5590                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
5591         *)
5592                 echo "$sym() NOT found." >&4;
5593                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
5594         esac;;
5595 *)
5596         case "$was" in
5597         $define) echo "$sym() found." >&4;;
5598         *) echo "$sym() NOT found." >&4;;
5599         esac;;
5600 esac'
5601
5602 : see if sqrtl exists
5603 set sqrtl d_sqrtl
5604 eval $inlibc
5605
5606 case "$ccflags" in
5607 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
5608 esac
5609
5610 case "$uselongdouble" in
5611 $define|true|[yY]*)     dflt='y';;
5612 *) dflt='n';;
5613 esac
5614 cat <<EOM
5615
5616 Perl can be built to take advantage of long doubles which
5617 (if available) may give more accuracy and range for floating point numbers.
5618
5619 If this doesn't make any sense to you, just accept the default '$dflt'.
5620 EOM
5621 rp='Try to use long doubles if available?'
5622 . ./myread
5623 case "$ans" in
5624 y|Y)    val="$define"   ;;
5625 *)      val="$undef"    ;;
5626 esac
5627 set uselongdouble
5628 eval $setvar
5629
5630 case "$uselongdouble" in
5631 true|[yY]*) uselongdouble="$define" ;;
5632 esac
5633
5634 case "$uselongdouble" in
5635 $define)
5636 : Look for a hint-file generated 'call-back-unit'.  If the
5637 : user has specified that long doubles should be used,
5638 : we may need to set or change some other defaults.
5639         if $test -f uselongdouble.cbu; then
5640                 echo "Your platform has some specific hints for long doubles, using them..."
5641                 . ./uselongdouble.cbu
5642         else
5643                 $cat <<EOM
5644 (Your platform doesn't have any specific hints for long doubles.)
5645 EOM
5646         fi
5647         ;;
5648 esac
5649
5650 case "$uselongdouble:$d_sqrtl" in
5651 $define:$undef)
5652                 $cat <<EOM >&4
5653
5654 *** You requested the use of long doubles but you do not seem to have
5655 *** the mathematic functions for long doubles.  I'm disabling the use
5656 *** of long doubles.
5657
5658 EOM
5659         uselongdouble=$undef
5660         ;;
5661 esac
5662
5663 : check for length of double
5664 echo " "
5665 case "$doublesize" in
5666 '')
5667         echo "Checking to see how big your double precision numbers are..." >&4
5668         $cat >try.c <<'EOCP'
5669 #include <stdio.h>
5670 int main()
5671 {
5672     printf("%d\n", (int)sizeof(double));
5673     exit(0);
5674 }
5675 EOCP
5676         set try
5677         if eval $compile_ok; then
5678                 doublesize=`./try`
5679                 echo "Your double is $doublesize bytes long."
5680         else
5681                 dflt='8'
5682                 echo "(I can't seem to compile the test program.  Guessing...)"
5683                 rp="What is the size of a double precision number (in bytes)?"
5684                 . ./myread
5685                 doublesize="$ans"
5686         fi
5687         ;;
5688 esac
5689 $rm -f try.c try
5690
5691 : check for long doubles
5692 echo " "
5693 echo "Checking to see if you have long double..." >&4
5694 echo 'int main() { long double x = 7.0; }' > try.c
5695 set try
5696 if eval $compile; then
5697         val="$define"
5698         echo "You have long double."
5699 else
5700         val="$undef"
5701         echo "You do not have long double."
5702 fi
5703 $rm try.*
5704 set d_longdbl
5705 eval $setvar
5706
5707 : check for length of long double
5708 case "${d_longdbl}${longdblsize}" in
5709 $define)
5710         echo " "
5711         echo "Checking to see how big your long doubles are..." >&4
5712         $cat >try.c <<'EOCP'
5713 #include <stdio.h>
5714 int main()
5715 {
5716         printf("%d\n", sizeof(long double));
5717 }
5718 EOCP
5719         set try
5720         set try
5721         if eval $compile; then
5722                 longdblsize=`./try$exe_ext`
5723                 echo "Your long doubles are $longdblsize bytes long."
5724         else
5725                 dflt='8'
5726                 echo " "
5727                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
5728                 rp="What is the size of a long double (in bytes)?"
5729                 . ./myread
5730                 longdblsize="$ans"
5731         fi
5732         if $test "X$doublesize" = "X$longdblsize"; then
5733                 echo "(That isn't any different from an ordinary double.)"
5734         fi      
5735         ;;
5736 esac
5737 $rm -f try.* try
5738
5739 case "$useperlio" in
5740 $define|true|[yY]*|'')  dflt='y';;
5741 *) dflt='n';;
5742 esac
5743 cat <<EOM
5744
5745 Previous version of $package used the standard IO mechanisms as
5746 defined in <stdio.h>.  Versions 5.003_02 and later of $package allow
5747 alternate IO mechanisms via the PerlIO abstraction layer, but the
5748 stdio mechanism is still available if needed.  The abstraction layer
5749 can use AT&T's sfio (if you already have sfio installed) or regular stdio.
5750 Using PerlIO with sfio may cause problems with some extension modules.
5751
5752 If this doesn't make any sense to you, just accept the default '$dflt'.
5753 EOM
5754 rp='Use the PerlIO abstraction layer?'
5755 . ./myread
5756 case "$ans" in
5757 y|Y) 
5758         val="$define"
5759         ;;
5760 *)      
5761         echo "Ok, doing things the stdio way."
5762         val="$undef"
5763         ;;
5764 esac
5765 set useperlio
5766 eval $setvar 
5767
5768 case "$usesocks" in
5769 $define|true|[yY]*)
5770         case "$useperlio" in
5771         $define|true|[yY]*) ;;
5772         *)      cat >&4 <<EOM
5773
5774 You are using the SOCKS proxy protocol library which means that you
5775 should also use the PerlIO layer.  You may be headed for trouble.
5776
5777 EOM
5778                 ;;
5779         esac
5780         ;;
5781 esac
5782
5783         
5784 : determine the architecture name
5785 echo " "
5786 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
5787         tarch=`arch`"-$osname"
5788 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
5789         if uname -m > tmparch 2>&1 ; then
5790                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
5791                         -e 's/$/'"-$osname/" tmparch`
5792         else
5793                 tarch="$osname"
5794         fi
5795         $rm -f tmparch
5796 else
5797         tarch="$osname"
5798 fi
5799 case "$myarchname" in
5800 ''|"$tarch") ;;
5801 *)
5802         echo "(Your architecture name used to be $myarchname.)"
5803         archname=''
5804         ;;
5805 esac
5806 myarchname="$tarch"
5807 case "$archname" in
5808 '') dflt="$tarch";;
5809 *) dflt="$archname";;
5810 esac
5811 rp='What is your architecture name'
5812 . ./myread
5813 archname="$ans"
5814 case "$usethreads" in
5815 $define)
5816         echo "Threads selected." >&4
5817         case "$archname" in
5818         *-thread*) echo "...and architecture name already has -thread." >&4
5819                 ;;
5820         *)      archname="$archname-thread"
5821                 echo "...setting architecture name to $archname." >&4
5822                 ;;
5823         esac
5824         ;;
5825 esac
5826 case "$usemultiplicity" in
5827 $define)
5828         echo "Multiplicity selected." >&4
5829         case "$archname" in
5830         *-multi*) echo "...and architecture name already has -multi." >&4
5831                 ;;
5832         *)      archname="$archname-multi"
5833                 echo "...setting architecture name to $archname." >&4
5834                 ;;
5835         esac
5836         ;;
5837 esac
5838 case "$use64bitint$use64bitall" in
5839 *"$define"*)
5840         case "$archname64" in
5841         '')
5842                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
5843                 ;;
5844         *)
5845                 case "$use64bitint" in
5846                 "$define") echo "64 bit integers selected." >&4 ;;
5847                 esac
5848                 case "$use64bitall" in
5849                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
5850                 esac
5851                 case "$archname" in
5852                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
5853                         ;;
5854                 *)      archname="$archname-$archname64"
5855                         echo "...setting architecture name to $archname." >&4
5856                         ;;
5857                 esac
5858                 ;;
5859         esac
5860 esac
5861 case "$uselongdouble" in
5862 $define)
5863         echo "Long doubles selected." >&4
5864         case "$longdblsize" in
5865         $doublesize)
5866                 "...but long doubles are equal to doubles, not changing architecture name." >&4
5867                 ;;
5868         *)
5869                 case "$archname" in
5870                 *-ld*) echo "...and architecture name already has -ld." >&4
5871                         ;;
5872                 *)      archname="$archname-ld"
5873                         echo "...setting architecture name to $archname." >&4
5874                         ;;
5875                 esac
5876                 ;;
5877         esac
5878         ;;
5879 esac
5880 case "$useperlio" in
5881 $define)
5882         echo "Perlio selected." >&4
5883         ;;
5884 *)
5885         echo "Perlio not selected, using stdio." >&4
5886         case "$archname" in
5887         *-stdio*) echo "...and architecture name already has -stdio." >&4
5888                 ;;
5889         *)      archname="$archname-stdio"
5890                 echo "...setting architecture name to $archname." >&4
5891                 ;;
5892         esac
5893         ;;
5894 esac
5895
5896 : determine root of directory hierarchy where package will be installed.
5897 case "$prefix" in
5898 '')
5899         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
5900         ;;
5901 *)
5902         dflt="$prefix"
5903         ;;
5904 esac
5905 $cat <<EOM
5906
5907 By default, $package will be installed in $dflt/bin, manual pages
5908 under $dflt/man, etc..., i.e. with $dflt as prefix for all
5909 installation directories. Typically this is something like /usr/local.
5910 If you wish to have binaries under /usr/bin but other parts of the
5911 installation under /usr/local, that's ok: you will be prompted
5912 separately for each of the installation directories, the prefix being
5913 only used to set the defaults.
5914
5915 EOM
5916 fn=d~
5917 rp='Installation prefix to use?'
5918 . ./getfile
5919 oldprefix=''
5920 case "$prefix" in
5921 '') ;;
5922 *)
5923         case "$ans" in
5924         "$prefix") ;;
5925         *) oldprefix="$prefix";;
5926         esac
5927         ;;
5928 esac
5929 prefix="$ans"
5930 prefixexp="$ansexp"
5931
5932 case "$afsroot" in
5933 '')     afsroot=/afs ;;
5934 *)      afsroot=$afsroot ;;
5935 esac
5936
5937 : is AFS running?
5938 echo " "
5939 case "$afs" in
5940 $define|true)   afs=true ;;
5941 $undef|false)   afs=false ;;
5942 *)      if test -d $afsroot; then
5943                 afs=true
5944         else
5945                 afs=false
5946         fi
5947         ;;
5948 esac
5949 if $afs; then
5950         echo "AFS may be running... I'll be extra cautious then..." >&4
5951 else
5952         echo "AFS does not seem to be running..." >&4
5953 fi
5954
5955 : determine installation prefix for where package is to be installed.
5956 if $afs; then 
5957 $cat <<EOM
5958
5959 Since you are running AFS, I need to distinguish the directory in which
5960 files will reside from the directory in which they are installed (and from
5961 which they are presumably copied to the former directory by occult means).
5962
5963 EOM
5964         case "$installprefix" in
5965         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
5966         *) dflt="$installprefix";;
5967         esac
5968 else
5969 $cat <<EOM
5970
5971 In some special cases, particularly when building $package for distribution,
5972 it is convenient to distinguish between the directory in which files should 
5973 be installed from the directory ($prefix) in which they 
5974 will eventually reside.  For most users, these two directories are the same.
5975
5976 EOM
5977         case "$installprefix" in
5978         '') dflt=$prefix ;;
5979         *) dflt=$installprefix;;
5980         esac
5981 fi
5982 fn=d~
5983 rp='What installation prefix should I use for installing files?'
5984 . ./getfile
5985 installprefix="$ans"
5986 installprefixexp="$ansexp"
5987
5988 : set the prefixit variable, to compute a suitable default value
5989 prefixit='case "$3" in
5990 ""|none)
5991         case "$oldprefix" in
5992         "") eval "$1=\"\$$2\"";;
5993         *)
5994                 case "$3" in
5995                 "") eval "$1=";;
5996                 none)
5997                         eval "tp=\"\$$2\"";
5998                         case "$tp" in
5999                         ""|" ") eval "$1=\"\$$2\"";;
6000                         *) eval "$1=";;
6001                         esac;;
6002                 esac;;
6003         esac;;
6004 *)
6005         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
6006         case "$tp" in
6007         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
6008         /*-$oldprefix/*|\~*-$oldprefix/*)
6009                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
6010         *) eval "$1=\"\$$2\"";;
6011         esac;;
6012 esac'
6013
6014
6015 : get the patchlevel
6016 echo " "
6017 echo "Getting the current patchlevel..." >&4
6018 if $test -r $rsrc/patchlevel.h;then
6019         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
6020         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
6021         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
6022         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
6023         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
6024         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
6025        perl_patchlevel=`grep ',"DEVEL[0-9][0-9]*"' $rsrc/patchlevel.h|sed 's/[^0-9]//g'`
6026 else
6027         revision=0
6028         patchlevel=0
6029         subversion=0
6030         api_revision=0
6031         api_version=0
6032         api_subversion=0
6033         perl_patchlevel=0
6034         $echo "(You do not have patchlevel.h.  Eek.)"
6035 fi
6036 if $test -r $rsrc/.patch ; then  
6037         if $test "`cat $rsrc/.patch`" -gt "$perl_patchlevel" ; then
6038                 perl_patchlevel=`cat $rsrc/.patch`
6039         fi
6040 fi
6041 case "$perl_patchlevel" in
6042 0)  ;;
6043 '') $echo "(You have $package version $patchlevel subversion $subversion.)" ;;
6044 *)  $echo "(You have $package version $patchlevel subversion $subversion patchlevel $perl_patchlevel.)" ;;
6045 esac
6046 case "$osname" in
6047 dos|vms)
6048         : XXX Should be a Configure test for double-dots in filenames.
6049         version=`echo $revision $patchlevel $subversion | \
6050                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
6051         api_versionstring=`echo $api_revision $api_version $api_subversion | \
6052                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
6053         ;;
6054 *)
6055         version=`echo $revision $patchlevel $subversion | \
6056                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
6057         api_versionstring=`echo $api_revision $api_version $api_subversion | \
6058                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
6059         ;;
6060 esac
6061 : Special case the 5.005_xx maintenance series, which used 5.005
6062 : without any subversion label as a subdirectory in $sitelib
6063 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
6064         api_versionstring='5.005'
6065 fi
6066
6067 : determine installation style
6068 : For now, try to deduce it from prefix unless it is already set.
6069 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
6070 case "$installstyle" in
6071 '')     case "$prefix" in
6072                 *perl*) dflt='lib';;
6073                 *) dflt='lib/perl5' ;;
6074         esac
6075         ;;
6076 *)      dflt="$installstyle" ;;
6077 esac
6078 : Probably not worth prompting for this since we prompt for all
6079 : the directories individually, and the prompt would be too long and
6080 : confusing anyway.
6081 installstyle=$dflt
6082
6083 : determine where private library files go
6084 : Usual default is /usr/local/lib/perl5/$version.
6085 : Also allow things like /opt/perl/lib/$version, since 
6086 : /opt/perl/lib/perl5... would be redundant.
6087 : The default "style" setting is made in installstyle.U
6088 case "$installstyle" in
6089 *lib/perl5*) set dflt privlib lib/$package/$version ;;
6090 *)       set dflt privlib lib/$version ;;
6091 esac
6092 eval $prefixit
6093 $cat <<EOM
6094
6095 There are some auxiliary files for $package that need to be put into a
6096 private library directory that is accessible by everyone.
6097
6098 EOM
6099 fn=d~+
6100 rp='Pathname where the private library files will reside?'
6101 . ./getfile
6102 privlib="$ans"
6103 privlibexp="$ansexp"
6104 : Change installation prefix, if necessary.
6105 if $test X"$prefix" != X"$installprefix"; then
6106         installprivlib=`echo $privlibexp | sed "s#^$prefix#$installprefix#"`
6107 else
6108         installprivlib="$privlibexp"
6109 fi
6110
6111 : set the prefixup variable, to restore leading tilda escape
6112 prefixup='case "$prefixexp" in
6113 "$prefix") ;;
6114 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
6115 esac'
6116
6117 : determine where public architecture dependent libraries go
6118 set archlib archlib
6119 eval $prefixit
6120 : privlib default is /usr/local/lib/$package/$version
6121 : archlib default is /usr/local/lib/$package/$version/$archname
6122 : privlib may have an optional trailing /share.
6123 tdflt=`echo $privlib | $sed 's,/share$,,'`
6124 tdflt=$tdflt/$archname
6125 case "$archlib" in
6126 '')     dflt=$tdflt
6127         ;;
6128 *)      dflt="$archlib"
6129     ;;
6130 esac
6131 $cat <<EOM
6132
6133 $spackage contains architecture-dependent library files.  If you are
6134 sharing libraries in a heterogeneous environment, you might store
6135 these files in a separate location.  Otherwise, you can just include
6136 them with the rest of the public library files.
6137
6138 EOM
6139 fn=d+~
6140 rp='Where do you want to put the public architecture-dependent libraries?'
6141 . ./getfile
6142 archlib="$ans"
6143 archlibexp="$ansexp"
6144 if $test X"$archlib" = X"$privlib"; then
6145         d_archlib="$undef"
6146 else
6147         d_archlib="$define"
6148 fi
6149 : Change installation prefix, if necessary.
6150 if $test X"$prefix" != X"$installprefix"; then
6151         installarchlib=`echo $archlibexp | sed "s#^$prefix#$installprefix#"`
6152 else
6153         installarchlib="$archlibexp"
6154 fi
6155
6156
6157 : Binary compatibility with 5.005 is not possible for builds
6158 : with advanced features
6159 case "$usethreads$usemultiplicity" in
6160 *define*)
6161         bincompat5005="$undef"
6162         d_bincompat5005="$undef"
6163         ;;
6164 *)      $cat <<EOM
6165
6166 This version of Perl can be compiled for binary compatibility with 5.005.
6167 If you decide to do so, you will be able to continue using most of the
6168 extensions that were compiled for Perl 5.005.
6169
6170 EOM
6171         case "$bincompat5005$d_bincompat5005" in
6172         *"$undef"*) dflt=n ;;
6173         *) dflt=y ;;
6174         esac
6175         rp='Binary compatibility with Perl 5.005?'
6176         . ./myread
6177         case "$ans" in
6178         y*) val="$define" ;;
6179         *)  val="$undef" ;;
6180         esac
6181         set d_bincompat5005
6182         eval $setvar
6183         case "$d_bincompat5005" in
6184         "$define")
6185                 bincompat5005="$define"
6186                 ;;
6187         *)      bincompat5005="$undef"
6188                 d_bincompat5005="$undef"
6189                 ;;
6190         esac
6191         ;;
6192 esac
6193
6194
6195 : see if setuid scripts can be secure
6196 $cat <<EOM
6197
6198 Some kernels have a bug that prevents setuid #! scripts from being
6199 secure.  Some sites have disabled setuid #! scripts because of this.
6200
6201 First let's decide if your kernel supports secure setuid #! scripts.
6202 (If setuid #! scripts would be secure but have been disabled anyway,
6203 don't say that they are secure if asked.)
6204
6205 EOM
6206
6207 val="$undef"
6208 if $test -d /dev/fd; then
6209         echo "#!$ls" >reflect
6210         chmod +x,u+s reflect
6211         ./reflect >flect 2>&1
6212         if $contains "/dev/fd" flect >/dev/null; then
6213                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
6214                 val="$define"
6215         else
6216                 $cat <<EOM
6217 If you are not sure if they are secure, I can check but I'll need a
6218 username and password different from the one you are using right now.
6219 If you don't have such a username or don't want me to test, simply
6220 enter 'none'.
6221
6222 EOM
6223                 rp='Other username to test security of setuid scripts with?'
6224                 dflt='none'
6225                 . ./myread
6226                 case "$ans" in
6227                 n|none)
6228                         case "$d_suidsafe" in
6229                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
6230                                 dflt=n;;
6231                         "$undef")
6232                                 echo "Well, the $hint value is *not* secure." >&4
6233                                 dflt=n;;
6234                         *)      echo "Well, the $hint value *is* secure." >&4
6235                                 dflt=y;;
6236                         esac
6237                         ;;
6238                 *)
6239                         $rm -f reflect flect
6240                         echo "#!$ls" >reflect
6241                         chmod +x,u+s reflect
6242                         echo >flect
6243                         chmod a+w flect
6244                         echo '"su" will (probably) prompt you for '"$ans's password."
6245                         su $ans -c './reflect >flect'
6246                         if $contains "/dev/fd" flect >/dev/null; then
6247                                 echo "Okay, it looks like setuid scripts are secure." >&4
6248                                 dflt=y
6249                         else
6250                                 echo "I don't think setuid scripts are secure." >&4
6251                                 dflt=n
6252                         fi
6253                         ;;
6254                 esac
6255                 rp='Does your kernel have *secure* setuid scripts?'
6256                 . ./myread
6257                 case "$ans" in
6258                 [yY]*)  val="$define";;
6259                 *)      val="$undef";;
6260                 esac
6261         fi
6262 else
6263         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
6264         echo "(That's for file descriptors, not floppy disks.)"
6265         val="$undef"
6266 fi
6267 set d_suidsafe
6268 eval $setvar
6269
6270 $rm -f reflect flect
6271
6272 : now see if they want to do setuid emulation
6273 echo " "
6274 val="$undef"
6275 case "$d_suidsafe" in
6276 "$define")
6277         val="$undef"
6278         echo "No need to emulate SUID scripts since they are secure here." >& 4
6279         ;;
6280 *)
6281         $cat <<EOM
6282 Some systems have disabled setuid scripts, especially systems where
6283 setuid scripts cannot be secure.  On systems where setuid scripts have
6284 been disabled, the setuid/setgid bits on scripts are currently
6285 useless.  It is possible for $package to detect those bits and emulate
6286 setuid/setgid in a secure fashion.  This emulation will only work if
6287 setuid scripts have been disabled in your kernel.
6288
6289 EOM
6290         case "$d_dosuid" in
6291         "$define") dflt=y ;;
6292         *) dflt=n ;;
6293         esac
6294         rp="Do you want to do setuid/setgid emulation?"
6295         . ./myread
6296         case "$ans" in
6297         [yY]*)  val="$define";;
6298         *)      val="$undef";;
6299         esac
6300         ;;
6301 esac
6302 set d_dosuid
6303 eval $setvar
6304
6305 : see if this is a malloc.h system
6306 set malloc.h i_malloc
6307 eval $inhdr
6308
6309 : see if stdlib is available
6310 set stdlib.h i_stdlib
6311 eval $inhdr
6312
6313 : determine which malloc to compile in
6314 echo " "
6315 case "$usemymalloc" in
6316 [yY]*|true|$define)     dflt='y' ;;
6317 [nN]*|false|$undef)     dflt='n' ;;
6318 *)      case "$ptrsize" in
6319         4) dflt='y' ;;
6320         *) dflt='n' ;;
6321         esac
6322         ;;
6323 esac
6324 rp="Do you wish to attempt to use the malloc that comes with $package?"
6325 . ./myread
6326 usemymalloc="$ans"
6327 case "$ans" in
6328 y*|true)
6329         usemymalloc='y'
6330         mallocsrc='malloc.c'
6331         mallocobj="malloc$_o"
6332         d_mymalloc="$define"
6333         case "$libs" in
6334         *-lmalloc*)
6335                 : Remove malloc from list of libraries to use
6336                 echo "Removing unneeded -lmalloc from library list" >&4
6337                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
6338                 shift
6339                 libs="$*"
6340                 echo "libs = $libs" >&4
6341                 ;;
6342         esac
6343         ;;
6344 *)
6345         usemymalloc='n'
6346         mallocsrc=''
6347         mallocobj=''
6348         d_mymalloc="$undef"
6349         ;;
6350 esac
6351
6352 : compute the return types of malloc and free
6353 echo " "
6354 $cat >malloc.c <<END
6355 #$i_malloc I_MALLOC
6356 #$i_stdlib I_STDLIB
6357 #include <stdio.h>
6358 #include <sys/types.h>
6359 #ifdef I_MALLOC
6360 #include <malloc.h>
6361 #endif
6362 #ifdef I_STDLIB
6363 #include <stdlib.h>
6364 #endif
6365 #ifdef TRY_MALLOC
6366 void *malloc();
6367 #endif
6368 #ifdef TRY_FREE
6369 void free();
6370 #endif
6371 END
6372 case "$malloctype" in
6373 '')
6374         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
6375                 malloctype='void *'
6376         else
6377                 malloctype='char *'
6378         fi
6379         ;;
6380 esac
6381 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
6382
6383 case "$freetype" in
6384 '')
6385         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
6386                 freetype='void'
6387         else
6388                 freetype='int'
6389         fi
6390         ;;
6391 esac
6392 echo "Your system uses $freetype free(), it would seem." >&4
6393 $rm -f malloc.[co]
6394 $cat <<EOM
6395
6396 After $package is installed, you may wish to install various
6397 add-on modules and utilities.  Typically, these add-ons will
6398 be installed under $prefix with the rest
6399 of this package.  However, you may wish to install such add-ons
6400 elsewhere under a different prefix.
6401
6402 If you do not wish to put everything under a single prefix, that's
6403 ok.  You will be prompted for the individual locations; this siteprefix
6404 is only used to suggest the defaults.
6405
6406 The default should be fine for most people.
6407
6408 EOM
6409 fn=d~+
6410 rp='Installation prefix to use for add-on modules and utilities?'
6411 : XXX Here might be another good place for an installstyle setting.
6412 case "$siteprefix" in
6413 '') dflt=$prefix ;;
6414 *)  dflt=$siteprefix ;;
6415 esac
6416 . ./getfile
6417 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6418 oldsiteprefix=''
6419 case "$siteprefix" in
6420 '') ;;
6421 *)      case "$ans" in
6422         "$prefix") ;;
6423         *) oldsiteprefix="$prefix";;
6424         esac
6425         ;;
6426 esac
6427 siteprefix="$ans"
6428 siteprefixexp="$ansexp"
6429
6430 : determine where site specific libraries go.
6431 : Usual default is /usr/local/lib/perl5/site_perl/$version
6432 : The default "style" setting is made in installstyle.U
6433 : XXX No longer works with Prefixit stuff.
6434 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6435 case "$sitelib" in
6436 '') case "$installstyle" in
6437         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
6438         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
6439         esac
6440         ;;
6441 *)      dflt="$sitelib"
6442         ;;
6443 esac
6444 $cat <<EOM
6445
6446 The installation process will create a directory for
6447 site-specific extensions and modules.  Most users find it convenient
6448 to place all site-specific files in this directory rather than in the
6449 main distribution directory.
6450
6451 EOM
6452 fn=d~+
6453 rp='Pathname for the site-specific library files?'
6454 . ./getfile
6455 sitelib="$ans"
6456 sitelibexp="$ansexp"
6457 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
6458 : Change installation prefix, if necessary.
6459 if $test X"$prefix" != X"$installprefix"; then
6460         installsitelib=`echo $sitelibexp | $sed "s#^$prefix#$installprefix#"`
6461 else
6462         installsitelib="$sitelibexp"
6463 fi
6464
6465 : determine where site specific architecture-dependent libraries go.
6466 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
6467 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
6468 : sitelib may have an optional trailing /share.
6469 case "$sitearch" in
6470 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
6471         dflt="$dflt/$archname"
6472         ;;
6473 *)      dflt="$sitearch"
6474         ;;
6475 esac
6476 set sitearch sitearch none
6477 eval $prefixit
6478 $cat <<EOM
6479
6480 The installation process will also create a directory for
6481 architecture-dependent site-specific extensions and modules.
6482
6483 EOM
6484 fn=d~+
6485 rp='Pathname for the site-specific architecture-dependent library files?'
6486 . ./getfile
6487 sitearch="$ans"
6488 sitearchexp="$ansexp"
6489 : Change installation prefix, if necessary.
6490 if $test X"$prefix" != X"$installprefix"; then
6491         installsitearch=`echo $sitearchexp | sed "s#^$prefix#$installprefix#"`
6492 else
6493         installsitearch="$sitearchexp"
6494 fi
6495
6496 $cat <<EOM
6497
6498 The installation process will also create a directory for
6499 vendor-supplied add-ons.  Vendors who supply perl with their system
6500 may find it convenient to place all vendor-supplied files in this
6501 directory rather than in the main distribution directory.  This will
6502 ease upgrades between binary-compatible maintenance versions of perl.
6503
6504 Of course you may also use these directories in whatever way you see
6505 fit.  For example, you might use them to access modules shared over a
6506 company-wide network.
6507
6508 The default answer should be fine for most people.
6509 This causes further questions about vendor add-ons to be skipped
6510 and no vendor-specific directories will be configured for perl.
6511
6512 EOM
6513 rp='Do you want to configure vendor-specific add-on directories?'
6514 case "$usevendorprefix" in
6515 define|true|[yY]*) dflt=y ;;
6516 *)      : User may have set vendorprefix directly on Configure command line.
6517         case "$vendorprefix" in
6518         ''|' ') dflt=n ;;
6519         *)      dflt=y ;;
6520         esac
6521         ;;
6522 esac
6523 . ./myread
6524 case "$ans" in
6525 [yY]*)  fn=d~+
6526         rp='Installation prefix to use for vendor-supplied add-ons?'
6527         case "$vendorprefix" in
6528         '') dflt='' ;;
6529         *)  dflt=$vendorprefix ;;
6530         esac
6531         . ./getfile
6532         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6533         oldvendorprefix=''
6534         case "$vendorprefix" in
6535         '') ;;
6536         *)      case "$ans" in
6537                 "$prefix") ;;
6538                 *) oldvendorprefix="$prefix";;
6539                 esac
6540                 ;;
6541         esac
6542         usevendorprefix="$define"
6543         vendorprefix="$ans"
6544         vendorprefixexp="$ansexp"
6545         ;;
6546 *)      usevendorprefix="$undef"
6547         vendorprefix=''
6548         vendorprefixexp=''
6549         ;;
6550 esac
6551
6552 case "$vendorprefix" in
6553 '')     d_vendorlib="$undef"
6554         vendorlib=''
6555         vendorlibexp=''
6556         ;;
6557 *)      d_vendorlib="$define"
6558         : determine where vendor-supplied modules go.
6559         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
6560         case "$vendorlib" in
6561         '')
6562                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6563                 case "$installstyle" in
6564                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
6565                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
6566                 esac
6567                 ;;
6568         *)      dflt="$vendorlib"
6569                 ;;
6570         esac
6571         fn=d~+
6572         rp='Pathname for the vendor-supplied library files?'
6573         . ./getfile
6574         vendorlib="$ans"
6575         vendorlibexp="$ansexp"
6576         ;;
6577 esac
6578 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
6579 : Change installation prefix, if necessary.
6580 if $test X"$prefix" != X"$installprefix"; then
6581         installvendorlib=`echo $vendorlibexp | $sed "s#^$prefix#$installprefix#"`
6582 else
6583         installvendorlib="$vendorlibexp"
6584 fi
6585
6586 case "$vendorprefix" in
6587 '')     d_vendorarch="$undef"
6588         vendorarch=''
6589         vendorarchexp=''
6590         ;;
6591 *)      d_vendorarch="$define"
6592         : determine where vendor-supplied architecture-dependent libraries go.
6593         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
6594         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
6595         : vendorlib may have an optional trailing /share.
6596         case "$vendorarch" in
6597         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
6598                 dflt="$dflt/$archname"
6599                 ;;
6600         *)      dflt="$vendorarch" ;;
6601         esac
6602         fn=d~+
6603         rp='Pathname for vendor-supplied architecture-dependent files?'
6604         . ./getfile
6605         vendorarch="$ans"
6606         vendorarchexp="$ansexp"
6607         ;;
6608 esac
6609 : Change installation prefix, if necessary.
6610 if $test X"$prefix" != X"$installprefix"; then
6611         installvendorarch=`echo $vendorarchexp | sed "s#^$prefix#$installprefix#"`
6612 else
6613         installvendorarch="$vendorarchexp"
6614 fi
6615
6616 : Final catch-all directories to search
6617 $cat <<EOM
6618
6619 Lastly, you can have perl look in other directories for extensions and
6620 modules in addition to those already specified.
6621 These directories will be searched after 
6622         $sitearch 
6623         $sitelib 
6624 EOM
6625 test X"$vendorlib" != "X" && echo '     ' $vendorlib
6626 test X"$vendorarch" != "X" && echo '    ' $vendorarch
6627 echo ' '
6628 case "$otherlibdirs" in
6629 ''|' ') dflt='none' ;;
6630 *)      dflt="$otherlibdirs" ;;
6631 esac
6632 $cat <<EOM
6633 Enter a colon-separated set of extra paths to include in perl's @INC
6634 search path, or enter 'none' for no extra paths.
6635
6636 EOM
6637
6638 rp='Colon-separated list of additional directories for perl to search?'
6639 . ./myread
6640 case "$ans" in
6641 ' '|''|none)    otherlibdirs=' ' ;;     
6642 *)      otherlibdirs="$ans" ;;
6643 esac
6644 case "$otherlibdirs" in
6645 ' ') val=$undef ;;
6646 *)      val=$define ;;
6647 esac
6648 set d_perl_otherlibdirs
6649 eval $setvar
6650
6651 : Cruising for prototypes
6652 echo " "
6653 echo "Checking out function prototypes..." >&4
6654 $cat >prototype.c <<'EOCP'
6655 int main(int argc, char *argv[]) {
6656         exit(0);}
6657 EOCP
6658 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
6659         echo "Your C compiler appears to support function prototypes."
6660         val="$define"
6661 else
6662         echo "Your C compiler doesn't seem to understand function prototypes."
6663         val="$undef"
6664 fi
6665 set prototype
6666 eval $setvar
6667 $rm -f prototype*
6668
6669 case "$prototype" in
6670 "$define") ;;
6671 *)      ansi2knr='ansi2knr'
6672         echo " "
6673         cat <<EOM >&4
6674
6675 $me:  FATAL ERROR:
6676 This version of $package can only be compiled by a compiler that 
6677 understands function prototypes.  Unfortunately, your C compiler 
6678         $cc $ccflags
6679 doesn't seem to understand them.  Sorry about that.
6680
6681 If GNU cc is available for your system, perhaps you could try that instead.  
6682
6683 Eventually, we hope to support building Perl with pre-ANSI compilers.
6684 If you would like to help in that effort, please contact <perlbug@perl.org>.
6685
6686 Aborting Configure now.
6687 EOM
6688         exit 2
6689         ;;
6690 esac
6691
6692 : determine where public executables go
6693 echo " "
6694 set dflt bin bin
6695 eval $prefixit
6696 fn=d~
6697 rp='Pathname where the public executables will reside?'
6698 . ./getfile
6699 if $test "X$ansexp" != "X$binexp"; then
6700         installbin=''
6701 fi
6702 bin="$ans"
6703 binexp="$ansexp"
6704 : Change installation prefix, if necessary.
6705 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
6706 if $test X"$prefix" != X"$installprefix"; then
6707         installbin=`echo $binexp | sed "s#^$prefix#$installprefix#"`
6708 else
6709         installbin="$binexp"
6710 fi
6711
6712 : Find perl5.005 or later.
6713 echo "Looking for a previously installed perl5.005 or later... "
6714 case "$perl5" in
6715 '')     for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
6716                 : Check if this perl is recent and can load a simple module
6717                 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6718                         perl5=$tdir/perl
6719                         break;
6720                 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6721                         perl5=$tdir/perl5
6722                         break;
6723                 fi
6724         done
6725         ;;
6726 *)      perl5="$perl5"
6727         ;;
6728 esac
6729 case "$perl5" in
6730 '')     echo "None found.  That's ok.";;
6731 *)      echo "Using $perl5." ;;
6732 esac
6733
6734 : Determine list of previous versions to include in @INC
6735 $cat > getverlist <<EOPL
6736 #!$perl5 -w
6737 use File::Basename;
6738 \$api_versionstring = "$api_versionstring";
6739 \$version = "$version";
6740 \$stem = "$sitelib_stem";
6741 \$archname = "$archname";
6742 EOPL
6743         $cat >> getverlist <<'EOPL'
6744 # Can't have leading @ because metaconfig interprets it as a command!
6745 ;@inc_version_list=();
6746 # XXX Redo to do opendir/readdir? 
6747 if (-d $stem) {
6748     chdir($stem);
6749     ;@candidates = glob("5.*");
6750 }
6751 else {
6752     ;@candidates = ();
6753 }
6754
6755 # XXX ToDo:  These comparisons must be reworked when two-digit
6756 # subversions come along, so that 5.7.10 compares as greater than
6757 # 5.7.3!  By that time, hope that 5.6.x is sufficiently
6758 # widespread that we can use the built-in version vectors rather
6759 # than reinventing them here.  For 5.6.0, however, we must
6760 # assume this script will likely be run by 5.005_0x.  --AD 1/2000.
6761 foreach $d (@candidates) {
6762     if ($d lt $version) {
6763         if ($d ge $api_versionstring) {
6764             unshift(@inc_version_list, grep { -d } "$d/$archname", $d);
6765         }
6766         elsif ($d ge "5.005") {
6767             unshift(@inc_version_list, grep { -d } $d);
6768         }
6769     }
6770     else {
6771         # Skip newer version.  I.e. don't look in
6772         # 5.7.0 if we're installing 5.6.1.
6773     }
6774 }
6775
6776 if (@inc_version_list) {
6777     print join(' ', @inc_version_list);
6778 }
6779 else {
6780     # Blank space to preserve value for next Configure run.
6781     print " ";
6782 }
6783 EOPL
6784 chmod +x getverlist
6785 case "$inc_version_list" in
6786 '')     if test -x "$perl5$exe_ext"; then
6787                 dflt=`$perl5 getverlist`
6788         else
6789                 dflt='none'
6790         fi
6791         ;;
6792 $undef) dflt='none' ;;
6793 *)  eval dflt=\"$inc_version_list\" ;;
6794 esac
6795 case "$dflt" in
6796 ''|' ') dflt=none ;;
6797 esac
6798 case "$dflt" in
6799 5.005) case "$bincompat5005" in
6800        $define|true|[yY]*) ;;
6801        *) dflt=none ;;
6802        esac
6803        ;;
6804 esac
6805 $cat <<'EOM'
6806
6807 In order to ease the process of upgrading, this version of perl 
6808 can be configured to use modules built and installed with earlier 
6809 versions of perl that were installed under $prefix.  Specify here
6810 the list of earlier versions that this version of perl should check.
6811 If Configure detected no earlier versions of perl installed under
6812 $prefix, then the list will be empty.  Answer 'none' to tell perl
6813 to not search earlier versions.
6814
6815 The default should almost always be sensible, so if you're not sure,
6816 just accept the default.
6817 EOM
6818
6819 rp='List of earlier versions to include in @INC?'
6820 . ./myread
6821 case "$ans" in
6822 [Nn]one|''|' ') inc_version_list=' ' ;;
6823 *) inc_version_list="$ans" ;;
6824 esac
6825 case "$inc_version_list" in
6826 ''|' ') 
6827         inc_version_list_init='0';;
6828 *)      inc_version_list_init=`echo $inc_version_list |
6829                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
6830         ;;
6831 esac
6832 $rm -f getverlist
6833
6834 : determine whether to install perl also as /usr/bin/perl
6835
6836 echo " "
6837 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
6838         $cat <<EOM
6839 Many scripts expect perl to be installed as /usr/bin/perl.
6840 I can install the perl you are about to compile also as /usr/bin/perl
6841 (in addition to $installbin/perl).
6842 EOM
6843         case "$installusrbinperl" in
6844         "$undef"|[nN]*) dflt='n';;
6845         *)              dflt='y';;
6846         esac
6847         rp="Do you want to install perl as /usr/bin/perl?"
6848         . ./myread
6849         case "$ans" in
6850         [yY]*)  val="$define";;
6851         *)      val="$undef" ;;
6852         esac
6853 else
6854         val="$undef"
6855 fi
6856 set installusrbinperl
6857 eval $setvar
6858
6859 : see if dld is available
6860 set dld.h i_dld
6861 eval $inhdr
6862
6863 : see if dlopen exists
6864 xxx_runnm="$runnm"
6865 runnm=false
6866 set dlopen d_dlopen
6867 eval $inlibc
6868 runnm="$xxx_runnm"
6869
6870 : determine which dynamic loading, if any, to compile in
6871 echo " "
6872 dldir="ext/DynaLoader"
6873 case "$usedl" in
6874 $define|y|true)
6875         dflt='y'
6876         usedl="$define"
6877         ;;
6878 $undef|n|false)
6879         dflt='n'
6880         usedl="$undef"
6881         ;;
6882 *) 
6883         dflt='n'
6884         case "$d_dlopen" in
6885             $define) dflt='y' ;;
6886         esac
6887         case "$i_dld" in
6888             $define) dflt='y' ;;
6889         esac
6890         : Does a dl_xxx.xs file exist for this operating system
6891         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
6892         ;;
6893 esac
6894 rp="Do you wish to use dynamic loading?"
6895 . ./myread
6896 usedl="$ans"
6897 case "$ans" in
6898 y*) usedl="$define"
6899         case "$dlsrc" in
6900         '')
6901                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
6902                         dflt="$dldir/dl_${osname}.xs"
6903                 elif $test "$d_dlopen" = "$define" ; then
6904                         dflt="$dldir/dl_dlopen.xs"
6905                 elif $test "$i_dld" = "$define" ; then
6906                         dflt="$dldir/dl_dld.xs"
6907                 else
6908                         dflt=''
6909                 fi
6910                 ;;
6911         *)      dflt="$dldir/$dlsrc"
6912                 ;;
6913         esac
6914     echo "The following dynamic loading files are available:"
6915         : Can not go over to $dldir because getfile has path hard-coded in.
6916         tdir=`pwd`; cd $rsrc; $ls -C $dldir/dl*.xs; cd $tdir
6917         rp="Source file to use for dynamic loading"
6918         fn="fne"
6919         gfpth="$src"
6920         . ./getfile
6921         usedl="$define"
6922         : emulate basename
6923         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
6924
6925         $cat << EOM
6926
6927 Some systems may require passing special flags to $cc -c to
6928 compile modules that will be used to create a shared library.
6929 To use no flags, say "none".
6930
6931 EOM
6932     case "$cccdlflags" in
6933     '') case "$gccversion" in
6934                 '') case "$osname" in
6935                         hpux)   dflt='+z' ;;
6936                         next)   dflt='none' ;;
6937                         irix*)  dflt='-KPIC' ;;
6938                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
6939                         sunos)  dflt='-pic' ;;
6940                         *)      dflt='none' ;;
6941                     esac
6942                         ;;
6943                 *)  case "$osname" in
6944                         svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
6945                         *)      dflt='-fpic' ;;
6946                     esac ;;
6947             esac ;;
6948         ' ') dflt='none' ;;
6949     *)  dflt="$cccdlflags" ;;
6950     esac
6951     rp="Any special flags to pass to $cc -c to compile shared library modules?"
6952     . ./myread
6953     case "$ans" in
6954     none) cccdlflags=' ' ;;
6955     *) cccdlflags="$ans" ;;
6956     esac
6957
6958     cat << EOM
6959
6960 Some systems use ld to create libraries that can be dynamically loaded,
6961 while other systems (such as those using ELF) use $cc.
6962
6963 EOM
6964         case "$ld" in
6965         '')     $cat >try.c <<'EOM'
6966 /* Test for whether ELF binaries are produced */
6967 #include <fcntl.h>
6968 #include <stdlib.h>
6969 int main() {
6970         char b[4];
6971         int i = open("a.out",O_RDONLY);
6972         if(i == -1) 
6973                 exit(1); /* fail */
6974         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
6975                 exit(0); /* succeed (yes, it's ELF) */
6976         else
6977                 exit(1); /* fail */
6978 }
6979 EOM
6980                 if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && ./a.out; then
6981                         cat <<EOM
6982 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
6983 EOM
6984                         dflt="$cc"
6985                 else
6986                         echo "I'll use ld to build dynamic libraries."
6987                         dflt='ld'
6988                 fi
6989                 rm -f try.c a.out
6990                 ;;
6991         *)      dflt="$ld"
6992                 ;;
6993         esac
6994
6995     rp="What command should be used to create dynamic libraries?"
6996     . ./myread
6997         ld="$ans"
6998
6999     cat << EOM
7000
7001 Some systems may require passing special flags to $ld to create a
7002 library that can be dynamically loaded.  If your ld flags include
7003 -L/other/path options to locate libraries outside your loader's normal
7004 search path, you may need to specify those -L options here as well.  To
7005 use no flags, say "none".
7006
7007 EOM
7008     case "$lddlflags" in
7009     '') case "$osname" in
7010                         beos) dflt='-nostart' ;;
7011                         hpux) dflt='-b';
7012                               case "$gccversion" in
7013                               '') dflt="$dflt +vnocompatwarnings" ;;
7014                               esac
7015                               ;;        
7016                         linux|irix*)    dflt='-shared' ;;
7017                         next)  dflt='none' ;;
7018                         solaris) dflt='-G' ;;
7019                         sunos) dflt='-assert nodefinitions' ;;
7020                         svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
7021                 *)     dflt='none' ;;
7022                         esac
7023                         ;;
7024     *) dflt="$lddlflags" ;;
7025     esac
7026
7027         : Try to guess additional flags to pick up local libraries.
7028         : Be careful not to append to a plain 'none'
7029         case "$dflt" in
7030         none) dflt='' ;;
7031         esac
7032         for thisflag in $ldflags; do
7033                 case "$thisflag" in
7034                 -L*|-R*)
7035                         case " $dflt " in
7036                         *" $thisflag "*) ;;
7037                         *) dflt="$dflt $thisflag" ;;
7038                         esac
7039                         ;;
7040                 esac
7041         done
7042
7043         case "$dflt" in
7044         ''|' ') dflt='none' ;;
7045         esac
7046
7047     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
7048     . ./myread
7049     case "$ans" in
7050     none) lddlflags=' ' ;;
7051     *) lddlflags="$ans" ;;
7052     esac
7053
7054         cat <<EOM
7055
7056 Some systems may require passing special flags to $cc to indicate that
7057 the resulting executable will use dynamic linking.  To use no flags,
7058 say "none".
7059
7060 EOM
7061     case "$ccdlflags" in
7062     '') case "$osname" in
7063                 hpux)   dflt='-Wl,-E' ;;
7064                 linux)  dflt='-rdynamic' ;;
7065                 next)   dflt='none' ;;
7066                 sunos)  dflt='none' ;;
7067                 *)      dflt='none' ;;
7068             esac ;;
7069     ' ')  dflt='none' ;;
7070     *)  dflt="$ccdlflags" ;;
7071     esac
7072     rp="Any special flags to pass to $cc to use dynamic linking?"
7073     . ./myread
7074     case "$ans" in
7075     none) ccdlflags=' ' ;;
7076     *) ccdlflags="$ans" ;;
7077     esac
7078     ;;
7079 *)  usedl="$undef"
7080         ld='ld'
7081     dlsrc='dl_none.xs'
7082     lddlflags=''
7083     ccdlflags=''
7084     ;;
7085 esac
7086
7087 also=''
7088 case "$usedl" in
7089 $undef)
7090         # No dynamic loading being used, so don't bother even to prompt.
7091         useshrplib='false'
7092         ;;
7093 *)      case "$useshrplib" in
7094         '')     case "$osname" in
7095                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|beos|cygwin*)
7096                         dflt=y
7097                         also='Building a shared libperl is required for dynamic loading to work on your system.'
7098                         ;;
7099                 next*)
7100                         case "$osvers" in
7101                         4*)     dflt=y
7102                                 also='Building a shared libperl is needed for MAB support.'
7103                                 ;;
7104                         *)      dflt=n
7105                                 ;;
7106                         esac
7107                         ;;
7108                 *)      dflt=n
7109                         ;;
7110                 esac
7111                 ;;
7112         $define|true|[Yy]*)
7113                 dflt=y
7114                 ;;
7115         *)      dflt=n
7116                 ;;
7117         esac
7118         $cat << EOM
7119
7120 The perl executable is normally obtained by linking perlmain.c with
7121 libperl${_a}, any static extensions (usually just DynaLoader), and
7122 any other libraries needed on this system (such as -lm, etc.).  Since
7123 your system supports dynamic loading, it is probably possible to build
7124 a shared libperl.$so.  If you will have more than one executable linked
7125 to libperl.$so, this will significantly reduce the size of each
7126 executable, but it may have a noticeable affect on performance.  The
7127 default is probably sensible for your system.
7128 $also
7129
7130 EOM
7131         rp="Build a shared libperl.$so (y/n)"
7132         . ./myread
7133         case "$ans" in
7134         true|$define|[Yy]*)
7135                 useshrplib='true'  ;;
7136         *)      useshrplib='false' ;;
7137         esac
7138         ;;
7139 esac
7140
7141 case "$useshrplib" in
7142 true)
7143         case "$libperl" in
7144         '')
7145                 # Figure out a good name for libperl.so.  Since it gets stored in
7146                 # a version-specific architecture-dependent library, the version
7147                 # number isn't really that important, except for making cc/ld happy.
7148                 #
7149                 # A name such as libperl.so.3.1
7150                 majmin="libperl.$so.$patchlevel.$subversion"
7151                 # A name such as libperl.so.301
7152                 majonly=`echo $patchlevel $subversion |
7153                         $awk '{printf "%d%02d", $1, $2}'`
7154                 majonly=libperl.$so.$majonly
7155                 # I'd prefer to keep the os-specific stuff here to a minimum, and
7156                 # rely on figuring it out from the naming of libc.
7157                 case "${osname}${osvers}" in
7158                 next4*)
7159                         dflt=libperl.5.$so
7160                         # XXX How handle the --version stuff for MAB?
7161                         ;;
7162                 linux*)  # ld won't link with a bare -lperl otherwise.
7163                         dflt=libperl.$so
7164                         ;;
7165                 cygwin*) # include version
7166                         dflt=`echo libperl$version | sed -e 's/\./_/g'`$lib_ext
7167                         ;;
7168                 *)      # Try to guess based on whether libc has major.minor.
7169                         case "$libc" in
7170                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
7171                         *libc.$so.[0-9]*) dflt=$majonly ;;
7172                         *)      dflt=libperl.$so ;;
7173                         esac
7174                         ;;
7175                 esac
7176                 ;;
7177         *)      dflt=$libperl
7178                 ;;
7179         esac
7180         cat << EOM
7181
7182 I need to select a good name for the shared libperl.  If your system uses
7183 library names with major and minor numbers, then you might want something
7184 like $majmin.  Alternatively, if your system uses a single version
7185 number for shared libraries, then you might want to use $majonly.
7186 Or, your system might be quite happy with a simple libperl.$so.
7187
7188 Since the shared libperl will get installed into a version-specific
7189 architecture-dependent directory, the version number of the shared perl
7190 library probably isn't important, so the default should be o.k.
7191
7192 EOM
7193         rp='What name do you want to give to the shared libperl?'
7194         . ./myread
7195         libperl=$ans
7196         echo "Ok, I'll use $libperl"
7197         ;;
7198 *)
7199         libperl="libperl${_a}"
7200         ;;
7201 esac
7202
7203 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
7204 case "$shrpdir" in
7205 '') ;;
7206 *)      $cat >&4 <<EOM
7207 WARNING:  Use of the shrpdir variable for the installation location of
7208 the shared $libperl is not supported.  It was never documented and
7209 will not work in this version.  Let me (perlbug@perl.org)
7210 know of any problems this may cause.
7211
7212 EOM
7213         case "$shrpdir" in
7214         "$archlibexp/CORE")
7215                 $cat >&4 <<EOM
7216 But your current setting of $shrpdir is
7217 the default anyway, so it's harmless.
7218 EOM
7219                 ;;
7220         *)
7221                 $cat >&4 <<EOM
7222 Further, your current attempted setting of $shrpdir
7223 conflicts with the value of $archlibexp/CORE
7224 that installperl will use.
7225 EOM
7226                 ;;
7227         esac
7228         ;;
7229 esac
7230
7231 # How will the perl executable find the installed shared $libperl?
7232 # Add $xxx to ccdlflags.
7233 # If we can't figure out a command-line option, use $shrpenv to
7234 # set env LD_RUN_PATH.  The main perl makefile uses this.
7235 shrpdir=$archlibexp/CORE
7236 xxx=''
7237 tmp_shrpenv=''
7238 if "$useshrplib"; then
7239     case "$osname" in 
7240         aix)
7241                 # We'll set it in Makefile.SH...
7242                 ;;
7243         solaris|netbsd)
7244                 xxx="-R $shrpdir"
7245                 ;;
7246         freebsd)
7247                 xxx="-Wl,-R$shrpdir"
7248                 ;;
7249         linux|irix*|dec_osf)
7250                 xxx="-Wl,-rpath,$shrpdir"
7251                 ;;
7252         next)
7253                 # next doesn't like the default...
7254                 ;;
7255         beos)
7256                 # beos doesn't like the default, either.
7257                 ;;
7258         hpux*)
7259                 # hpux doesn't like the default, either.
7260                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
7261                 ;;
7262         *)
7263                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
7264                 ;;
7265         esac
7266         case "$xxx" in
7267         '') ;;
7268         *)      
7269                 # Only add $xxx if it isn't already in ccdlflags.
7270                 case " $ccdlflags " in
7271                 *" $xxx "*)     ;;
7272                 *)      ccdlflags="$ccdlflags $xxx"
7273                         cat <<EOM >&4
7274
7275 Adding $xxx to the flags
7276 passed to $ld so that the perl executable will find the 
7277 installed shared $libperl.
7278
7279 EOM
7280                         ;;
7281                 esac
7282                 ;;
7283         esac
7284 fi
7285 # Fix ccdlflags in AIX for building external extensions.
7286 # (For building Perl itself bare -bE:perl.exp is needed,
7287 #  Makefile.SH takes care of this.)
7288 case "$osname" in
7289 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
7290 esac
7291 # Respect a hint or command-line value.
7292 case "$shrpenv" in
7293 '') shrpenv="$tmp_shrpenv" ;;
7294 esac
7295 case "$ldlibpthname" in
7296 '')     ldlibpthname=LD_LIBRARY_PATH ;;
7297 none)   ldlibpthname='' ;;
7298 esac
7299
7300 : determine where manual pages are on this system
7301 echo " "
7302 case "$sysman" in
7303 '') 
7304         syspath='/usr/man/man1 /usr/man/mann /usr/man/manl /usr/man/local/man1'
7305         syspath="$syspath /usr/man/u_man/man1 /usr/share/man/man1"
7306         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
7307         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
7308         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
7309         sysman=`./loc . /usr/man/man1 $syspath`
7310         ;;
7311 esac
7312 if $test -d "$sysman"; then
7313         echo "System manual is in $sysman." >&4
7314 else
7315         echo "Could not find manual pages in source form." >&4
7316 fi
7317
7318 : determine where manual pages go
7319 set man1dir man1dir none
7320 eval $prefixit
7321 $cat <<EOM
7322
7323 $spackage has manual pages available in source form.
7324 EOM
7325 case "$nroff" in
7326 nroff)
7327         echo "However, you don't have nroff, so they're probably useless to you."
7328         case "$man1dir" in
7329         '') man1dir="none";;
7330         esac;;
7331 esac
7332 echo "If you don't want the manual sources installed, answer 'none'."
7333 case "$man1dir" in
7334 ' ') dflt=none
7335         ;;
7336 '')
7337         lookpath="$prefixexp/man/man1 $prefixexp/man/l_man/man1"
7338         lookpath="$lookpath $prefixexp/man/p_man/man1"
7339         lookpath="$lookpath $prefixexp/man/u_man/man1"
7340         lookpath="$lookpath $prefixexp/man/man.1"
7341         case "$sysman" in
7342         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
7343         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
7344         esac
7345         set dflt
7346         eval $prefixup
7347         ;;
7348 *)  dflt="$man1dir"
7349         ;;
7350 esac
7351 echo " "
7352 fn=dn+~
7353 rp="Where do the main $spackage manual pages (source) go?"
7354 . ./getfile
7355 if $test "X$man1direxp" != "X$ansexp"; then
7356         installman1dir=''
7357 fi
7358 man1dir="$ans"
7359 man1direxp="$ansexp"
7360 case "$man1dir" in
7361 '')     man1dir=' '
7362         installman1dir='';;
7363 esac
7364
7365 : Change installation prefix, if necessary.
7366 if $test X"$prefix" != X"$installprefix"; then
7367         installman1dir=`echo $man1direxp | $sed "s#^$prefix#$installprefix#"`
7368 else
7369         installman1dir="$man1direxp"
7370 fi
7371
7372 : What suffix to use on installed man pages
7373
7374 case "$man1dir" in
7375 ' ')
7376         man1ext='0'
7377         ;;
7378 *)
7379         rp="What suffix should be used for the main $spackage man pages?"
7380         case "$man1ext" in
7381         '')     case "$man1dir" in
7382                 *1)  dflt=1 ;;
7383                 *1p) dflt=1p ;;
7384                 *1pm) dflt=1pm ;;
7385                 *l) dflt=l;;
7386                 *n) dflt=n;;
7387                 *o) dflt=o;;
7388                 *p) dflt=p;;
7389                 *C) dflt=C;;
7390                 *L) dflt=L;;
7391                 *L1) dflt=L1;;
7392                 *) dflt=1;;
7393                 esac
7394                 ;;
7395         *)      dflt="$man1ext";;
7396         esac
7397         . ./myread
7398         man1ext="$ans"
7399         ;;
7400 esac
7401
7402 : see if we can have long filenames
7403 echo " "
7404 first=123456789abcdef
7405 $rm -f $first
7406 if (echo hi >$first) 2>/dev/null; then
7407         if $test -f 123456789abcde; then
7408                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
7409                 val="$undef"
7410         else
7411                 echo 'You can have filenames longer than 14 characters.'>&4
7412                 val="$define"
7413         fi
7414 else
7415         $cat <<'EOM'
7416 You can't have filenames longer than 14 chars.
7417 You can't even think about them!
7418 EOM
7419         val="$undef"
7420 fi 
7421 set d_flexfnam
7422 eval $setvar
7423 $rm -rf 123456789abcde*
7424
7425 : determine where library module manual pages go
7426 set man3dir man3dir none
7427 eval $prefixit
7428 $cat <<EOM
7429
7430 $spackage has manual pages for many of the library modules.
7431 EOM
7432
7433 case "$nroff" in
7434 nroff)
7435         $cat <<'EOM'
7436 However, you don't have nroff, so they're probably useless to you.
7437 EOM
7438         case "$man3dir" in
7439         '') man3dir="none";;
7440         esac;;
7441 esac
7442
7443 case "$d_flexfnam" in
7444 undef)
7445         $cat <<'EOM'
7446 However, your system can't handle the long file names like File::Basename.3. 
7447 EOM
7448         case "$man3dir" in
7449         '') man3dir="none";;
7450         esac;;
7451 esac
7452
7453 echo "If you don't want the manual sources installed, answer 'none'."
7454 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
7455 case "$man3dir" in
7456 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
7457         if $test -d "$privlib/man/man3"; then
7458                 cat <<EOM >&4
7459
7460 WARNING:  Previous versions of perl installed man3 pages into
7461 $privlib/man/man3.  This version will suggest a 
7462 new default of $dflt.  
7463 EOM
7464                 tdflt=$dflt
7465                 dflt='n'
7466                 rp='Do you wish to preserve the old behavior?(y/n)'
7467                 . ./myread
7468                 case "$ans" in
7469                 y*) dflt="$privlib/man/man3" ;;
7470                 *)  dflt=$tdflt ;;
7471                 esac
7472     fi
7473         ;;
7474 *)      dflt="$man3dir" ;;
7475 esac
7476 case "$dflt" in
7477 ' ') dflt=none ;;
7478 esac
7479 echo " "
7480 fn=dn+~
7481 rp="Where do the $package library man pages (source) go?"
7482 . ./getfile
7483 man3dir="$ans"
7484 man3direxp="$ansexp"
7485 case "$man3dir" in
7486 '')     man3dir=' '
7487         installman3dir='';;
7488 esac
7489
7490 : Change installation prefix, if necessary.
7491 if $test X"$prefix" != X"$installprefix"; then
7492         installman3dir=`echo $man3direxp | $sed "s#^$prefix#$installprefix#"`
7493 else
7494         installman3dir="$man3direxp"
7495 fi
7496
7497 : What suffix to use on installed man pages
7498 case "$man3dir" in
7499 ' ')
7500         man3ext='0'
7501         ;;
7502 *)
7503         rp="What suffix should be used for the $package library man pages?"
7504         case "$man3ext" in
7505         '')     case "$man3dir" in
7506                 *3)  dflt=3 ;;
7507                 *3p) dflt=3p ;;
7508                 *3pm) dflt=3pm ;;
7509                 *l) dflt=l;;
7510                 *n) dflt=n;;
7511                 *o) dflt=o;;
7512                 *p) dflt=p;;
7513                 *C) dflt=C;;
7514                 *L) dflt=L;;
7515                 *L3) dflt=L3;;
7516                 *) dflt=3;;
7517                 esac
7518                 ;;
7519         *)      dflt="$man3ext";;
7520         esac
7521         . ./myread
7522         man3ext="$ans"
7523         ;;
7524 esac
7525
7526 : see if we have to deal with yellow pages, now NIS.
7527 if $test -d /usr/etc/yp || $test -d /etc/yp; then
7528         if $test -f /usr/etc/nibindd; then
7529                 echo " "
7530                 echo "I'm fairly confident you're on a NeXT."
7531                 echo " "
7532                 rp='Do you get the hosts file via NetInfo?'
7533                 dflt=y
7534                 case "$hostcat" in
7535                 nidump*) ;;
7536                 '') ;;
7537                 *) dflt=n;;
7538                 esac
7539                 . ./myread
7540                 case "$ans" in
7541                 y*) hostcat='nidump hosts .';;
7542                 *)      case "$hostcat" in
7543                         nidump*) hostcat='';;
7544                         esac
7545                         ;;
7546                 esac
7547         fi
7548         case "$hostcat" in
7549         nidump*) ;;
7550         *)
7551                 case "$hostcat" in
7552                 *ypcat*) dflt=y;;
7553                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
7554                                 dflt=y
7555                         else
7556                                 dflt=n
7557                         fi;;
7558                 *) dflt=n;;
7559                 esac
7560                 echo " "
7561                 rp='Are you getting the hosts file via yellow pages?'
7562                 . ./myread
7563                 case "$ans" in
7564                 y*) hostcat='ypcat hosts';;
7565                 *) hostcat='cat /etc/hosts';;
7566                 esac
7567                 ;;
7568         esac
7569 fi
7570 case "$hostcat" in
7571 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
7572 esac
7573 case "$groupcat" in
7574 '') test -f /etc/group && groupcat='cat /etc/group';;
7575 esac
7576 case "$passcat" in
7577 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
7578 esac
7579
7580 : now get the host name
7581 echo " "
7582 echo "Figuring out host name..." >&4
7583 case "$myhostname" in
7584 '') cont=true
7585         echo 'Maybe "hostname" will work...'
7586         if tans=`sh -c hostname 2>&1` ; then
7587                 myhostname=$tans
7588                 phostname=hostname
7589                 cont=''
7590         fi
7591         ;;
7592 *) cont='';;
7593 esac
7594 if $test "$cont"; then
7595         if ./xenix; then
7596                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
7597                 if tans=`cat /etc/systemid 2>&1` ; then
7598                         myhostname=$tans
7599                         phostname='cat /etc/systemid'
7600                         echo "Whadyaknow.  Xenix always was a bit strange..."
7601                         cont=''
7602                 fi
7603         elif $test -r /etc/systemid; then
7604                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
7605         fi
7606 fi
7607 if $test "$cont"; then
7608         echo 'No, maybe "uuname -l" will work...'
7609         if tans=`sh -c 'uuname -l' 2>&1` ; then
7610                 myhostname=$tans
7611                 phostname='uuname -l'
7612         else
7613                 echo 'Strange.  Maybe "uname -n" will work...'
7614                 if tans=`sh -c 'uname -n' 2>&1` ; then
7615                         myhostname=$tans
7616                         phostname='uname -n'
7617                 else
7618                         echo 'Oh well, maybe I can mine it out of whoami.h...'
7619                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
7620                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
7621                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
7622                         else
7623                                 case "$myhostname" in
7624                                 '') echo "Does this machine have an identity crisis or something?"
7625                                         phostname='';;
7626                                 *)
7627                                         echo "Well, you said $myhostname before..."
7628                                         phostname='echo $myhostname';;
7629                                 esac
7630                         fi
7631                 fi
7632         fi
7633 fi
7634 : you do not want to know about this
7635 set $myhostname
7636 myhostname=$1
7637
7638 : verify guess
7639 if $test "$myhostname" ; then
7640         dflt=y
7641         rp='Your host name appears to be "'$myhostname'".'" Right?"
7642         . ./myread
7643         case "$ans" in
7644         y*) ;;
7645         *) myhostname='';;
7646         esac
7647 fi
7648
7649 : bad guess or no guess
7650 while $test "X$myhostname" = X ; do
7651         dflt=''
7652         rp="Please type the (one word) name of your host:"
7653         . ./myread
7654         myhostname="$ans"
7655 done
7656
7657 : translate upper to lower if necessary
7658 case "$myhostname" in
7659 *[A-Z]*)
7660         echo "(Normalizing case in your host name)"
7661         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
7662         ;;
7663 esac
7664
7665 case "$myhostname" in
7666 *.*)
7667         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
7668         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
7669         echo "(Trimming domain name from host name--host name is now $myhostname)"
7670         ;;
7671 *) case "$mydomain" in
7672         '')
7673                 {
7674                         test "X$hostcat" = "Xypcat hosts" &&
7675                         ypmatch "$myhostname" hosts 2>/dev/null |\
7676                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
7677                         $test -s hosts
7678                 } || {
7679                         test "X$hostcat" != "X" &&
7680                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
7681                                         /[       ]$myhostname[  . ]/p" > hosts
7682                 }
7683                 tmp_re="[       . ]"
7684                 if $test -f hosts; then
7685                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
7686                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
7687                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
7688                                 hosts | $sort | $uniq | \
7689                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
7690                         case `$echo X$dflt` in
7691                         X*\ *)  echo "(Several hosts in the database matched hostname)"
7692                                 dflt=.
7693                                 ;;
7694                         X.) echo "(You do not have fully-qualified names in the hosts database)"
7695                                 ;;
7696                         esac
7697                 else
7698                         echo "(I cannot locate a hosts database anywhere)"
7699                         dflt=.
7700                 fi
7701                 case "$dflt" in
7702                 .)
7703                         tans=`./loc resolv.conf X /etc /usr/etc`
7704                         if $test -f "$tans"; then
7705                                 echo "(Attempting domain name extraction from $tans)"
7706                                 dflt=.`$sed -n -e 's/   / /g' \
7707                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
7708                                   | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
7709                                 case "$dflt" in
7710                                 .) dflt=.`$sed -n -e 's/        / /g' \
7711                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
7712                                      | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
7713                                         ;;
7714                                 esac
7715                         fi
7716                         ;;
7717                 esac
7718                 case "$dflt" in
7719                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
7720                         dflt=.`sh -c domainname 2>/dev/null`
7721                         case "$dflt" in
7722                         '') dflt='.';;
7723                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
7724                         esac
7725                         ;;
7726                 esac
7727                 case "$dflt$osname" in
7728                 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
7729                         dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
7730                         ;;
7731                 esac
7732                 case "$dflt" in
7733                 .) echo "(Lost all hope -- silly guess then)"
7734                         dflt='.uucp'
7735                         ;;
7736                 esac
7737                 $rm -f hosts
7738                 ;;
7739         *) dflt="$mydomain";;
7740         esac;;
7741 esac
7742 echo " "
7743 rp="What is your domain name?"
7744 . ./myread
7745 tans="$ans"
7746 case "$ans" in
7747 '') ;;
7748 .*) ;;
7749 *) tans=".$tans";;
7750 esac
7751 mydomain="$tans"
7752
7753 : translate upper to lower if necessary
7754 case "$mydomain" in
7755 *[A-Z]*)
7756         echo "(Normalizing case in your domain name)"
7757         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
7758         ;;
7759 esac
7760
7761 : a little sanity check here
7762 case "$phostname" in
7763 '') ;;
7764 *)
7765         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
7766         $myhostname$mydomain|$myhostname) ;;
7767         *)
7768                 case "$phostname" in
7769                 sed*)
7770                         echo "(That doesn't agree with your whoami.h file, by the way.)"
7771                         ;;
7772                 *)
7773                         echo "(That doesn't agree with your $phostname command, by the way.)"
7774                         ;;
7775                 esac
7776         ;;
7777         esac
7778         ;;
7779 esac
7780
7781 $cat <<EOM
7782
7783 I need to get your e-mail address in Internet format if possible, i.e.
7784 something like user@host.domain. Please answer accurately since I have
7785 no easy means to double check it. The default value provided below
7786 is most probably close to reality but may not be valid from outside
7787 your organization...
7788
7789 EOM
7790 cont=x
7791 while test "$cont"; do
7792         case "$cf_email" in
7793         '') dflt="$cf_by@$myhostname$mydomain";;
7794         *) dflt="$cf_email";;
7795         esac
7796         rp='What is your e-mail address?'
7797         . ./myread
7798         cf_email="$ans"
7799         case "$cf_email" in
7800         *@*.*) cont='' ;;
7801         *)
7802                 rp='Address does not look like an Internet one.  Use it anyway?'
7803                 case "$fastread" in
7804                 yes) dflt=y ;;
7805                 *) dflt=n ;;
7806                 esac
7807                 . ./myread
7808                 case "$ans" in
7809                 y*) cont='' ;;
7810                 *) echo " " ;;
7811                 esac
7812                 ;;
7813         esac
7814 done
7815
7816 $cat <<EOM
7817
7818 If you or somebody else will be maintaining perl at your site, please
7819 fill in the correct e-mail address here so that they may be contacted
7820 if necessary. Currently, the "perlbug" program included with perl
7821 will send mail to this address in addition to perlbug@perl.org. You may
7822 enter "none" for no administrator.
7823
7824 EOM
7825 case "$perladmin" in
7826 '') dflt="$cf_email";;
7827 *) dflt="$perladmin";;
7828 esac
7829 rp='Perl administrator e-mail address'
7830 . ./myread
7831 perladmin="$ans"
7832
7833 : determine whether to only install version-specific parts.
7834 echo " "
7835 $cat <<EOM
7836 Do you want to install only the version-specific parts of the perl
7837 distribution?  Usually you do *not* want to do this.
7838 EOM
7839 case "$versiononly" in
7840 "$define"|[Yy]*|true) dflt='y' ;;
7841 *) dflt='n';
7842 esac
7843 rp="Do you want to install only the version-specific parts of perl?"
7844 . ./myread
7845 case "$ans" in
7846 [yY]*)  val="$define";;
7847 *)      val="$undef" ;;
7848 esac
7849 set versiononly
7850 eval $setvar
7851
7852 : figure out how to guarantee perl startup
7853 case "$startperl" in
7854 '')
7855         case "$sharpbang" in
7856         *!)
7857                 $cat <<EOH
7858
7859 I can use the #! construct to start perl on your system. This will
7860 make startup of perl scripts faster, but may cause problems if you
7861 want to share those scripts and perl is not in a standard place
7862 ($binexp/perl) on all your platforms. The alternative is to force
7863 a shell by starting the script with a single ':' character.
7864
7865 EOH
7866                 case "$versiononly" in
7867                 "$define")      dflt="$binexp/perl$version";;  
7868                 *)              dflt="$binexp/perl";;
7869                 esac
7870                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
7871                 . ./myread
7872                 case "$ans" in
7873                 none)   startperl=": # use perl";;
7874                 *)      startperl="#!$ans"
7875                         if $test 30 -lt `echo "$ans" | wc -c`; then
7876                                 $cat >&4 <<EOM
7877
7878 WARNING:  Some systems limit the #! command to 32 characters.
7879 If you experience difficulty running Perl scripts with #!, try
7880 installing Perl in a directory with a shorter pathname.
7881
7882 EOM
7883                         fi ;;
7884                 esac
7885                 ;;
7886         *) startperl=": # use perl"
7887                 ;;
7888         esac
7889         ;;
7890 esac
7891 echo "I'll use $startperl to start perl scripts."
7892
7893 : figure best path for perl in scripts
7894 case "$perlpath" in
7895 '')
7896         perlpath="$binexp/perl"
7897         case "$startperl" in
7898         *!*) ;;
7899         *)
7900                 $cat <<EOH
7901
7902 I will use the "eval 'exec'" idiom to start Perl on your system.
7903 I can use the full path of your Perl binary for this purpose, but
7904 doing so may cause problems if you want to share those scripts and
7905 Perl is not always in a standard place ($binexp/perl).
7906
7907 EOH
7908                 dflt="$binexp/perl"
7909                 rp="What path shall I use in \"eval 'exec'\"?"
7910                 . ./myread
7911                 perlpath="$ans"
7912                 ;;
7913         esac
7914         ;;
7915 esac
7916 case "$startperl" in
7917 *!*)    ;;
7918 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
7919 esac
7920
7921 : determine where public executable scripts go
7922 set scriptdir scriptdir
7923 eval $prefixit
7924 case "$scriptdir" in
7925 '')
7926         dflt="$bin"
7927         : guess some guesses
7928         $test -d /usr/share/scripts && dflt=/usr/share/scripts
7929         $test -d /usr/share/bin     && dflt=/usr/share/bin
7930         $test -d /usr/local/script  && dflt=/usr/local/script
7931         $test -d /usr/local/scripts && dflt=/usr/local/scripts
7932         $test -d $prefixexp/script  && dflt=$prefixexp/script
7933         set dflt
7934         eval $prefixup
7935         ;;
7936 *)  dflt="$scriptdir"
7937         ;;
7938 esac
7939 $cat <<EOM
7940  
7941 Some installations have a separate directory just for executable scripts so
7942 that they can mount it across multiple architectures but keep the scripts in
7943 one spot.  You might, for example, have a subdirectory of /usr/share for this.
7944 Or you might just lump your scripts in with all your other executables.
7945  
7946 EOM
7947 fn=d~
7948 rp='Where do you keep publicly executable scripts?'
7949 . ./getfile
7950 if $test "X$ansexp" != "X$scriptdirexp"; then
7951         installscript=''
7952 fi
7953 scriptdir="$ans"
7954 scriptdirexp="$ansexp"
7955 : Change installation prefix, if necessary.
7956 if $test X"$prefix" != X"$installprefix"; then
7957         installscript=`echo $scriptdirexp | sed "s#^$prefix#$installprefix#"`
7958 else
7959         installscript="$scriptdirexp"
7960 fi
7961
7962 : determine where add-on public executables go
7963 case "$sitebin" in
7964 '')     dflt=$siteprefix/bin ;;
7965 *)      dflt=$sitebin ;;
7966 esac
7967 fn=d~
7968 rp='Pathname where the add-on public executables should be installed?'
7969 . ./getfile
7970 sitebin="$ans"
7971 sitebinexp="$ansexp"
7972 : Change installation prefix, if necessary.
7973 if $test X"$prefix" != X"$installprefix"; then
7974         installsitebin=`echo $sitebinexp | sed "s#^$prefix#$installprefix#"`
7975 else
7976         installsitebin="$sitebinexp"
7977 fi
7978
7979 case "$vendorprefix" in
7980 '')     d_vendorbin="$undef"
7981         vendorbin=''
7982         vendorbinexp=''
7983         ;;
7984 *)      d_vendorbin="$define"
7985         : determine where vendor-supplied executables go.
7986         case "$vendorbin" in
7987         '') dflt=$vendorprefix/bin ;;
7988         *)      dflt="$vendorbin" ;;
7989         esac
7990         fn=d~+
7991         rp='Pathname for the vendor-supplied executables directory?'
7992         . ./getfile
7993         vendorbin="$ans"
7994         vendorbinexp="$ansexp"
7995         ;;
7996 esac
7997 : Change installation prefix, if necessary.
7998 if $test X"$prefix" != X"$installprefix"; then
7999         installvendorbin=`echo $vendorbinexp | $sed "s#^$prefix#$installprefix#"`
8000 else
8001         installvendorbin="$vendorbinexp"
8002 fi
8003
8004 : see if qgcvt exists
8005 set qgcvt d_qgcvt
8006 eval $inlibc
8007
8008 echo " "
8009
8010 if $test X"$d_longdbl" = X"$define"; then
8011
8012 echo "Checking how to print long doubles..." >&4
8013
8014 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
8015         $cat >try.c <<'EOCP'
8016 #include <sys/types.h>
8017 #include <stdio.h>
8018 int main() {
8019   double d = 123.456;
8020   printf("%.3f\n", d);
8021 }
8022 EOCP
8023         set try
8024         if eval $compile; then
8025                 yyy=`./try$exe_ext`
8026                 case "$yyy" in
8027                 123.456)
8028                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
8029                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
8030                         echo "We will use %f."
8031                         ;;
8032                 esac
8033         fi
8034 fi
8035
8036 if $test X"$sPRIfldbl" = X; then
8037         $cat >try.c <<'EOCP'
8038 #include <sys/types.h>
8039 #include <stdio.h>
8040 int main() {
8041   long double d = 123.456;
8042   printf("%.3llf\n", d);
8043 }
8044 EOCP
8045         set try
8046         if eval $compile; then
8047                 yyy=`./try$exe_ext`
8048                 case "$yyy" in
8049                 123.456)
8050                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
8051                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
8052                         echo "We will use %llf."
8053                         ;;
8054                 esac
8055         fi
8056 fi
8057
8058 if $test X"$sPRIfldbl" = X; then
8059         $cat >try.c <<'EOCP'
8060 #include <sys/types.h>
8061 #include <stdio.h>
8062 int main() {
8063   long double d = 123.456;
8064   printf("%.3Lf\n", d);
8065 }
8066 EOCP
8067         set try
8068         if eval $compile; then
8069                 yyy=`./try$exe_ext`
8070                 case "$yyy" in
8071                 123.456)
8072                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
8073                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
8074                         echo "We will use %Lf."
8075                         ;;
8076                 esac
8077         fi
8078 fi
8079
8080 if $test X"$sPRIfldbl" = X; then
8081         $cat >try.c <<'EOCP'
8082 #include <sys/types.h>
8083 #include <stdio.h>
8084 int main() {
8085   long double d = 123.456;
8086   printf("%.3lf\n", d);
8087 }
8088 EOCP
8089         set try
8090         if eval $compile; then
8091                 yyy=`./try$exe_ext`
8092                 case "$yyy" in
8093                 123.456)
8094                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
8095                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
8096                         echo "We will use %lf."
8097                         ;;
8098                 esac
8099         fi
8100 fi
8101
8102 if $test X"$sPRIfldbl" = X; then
8103         echo "Cannot figure out how to print long doubles." >&4
8104 else
8105         sSCNfldbl=$sPRIfldbl    # expect consistency
8106 fi
8107
8108 $rm -f try try.*
8109
8110 fi # d_longdbl
8111
8112 case "$sPRIfldbl" in
8113 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef"; 
8114         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef"; 
8115         d_SCNfldbl="$undef";
8116         ;;
8117 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define"; 
8118         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define"; 
8119         d_SCNfldbl="$define";
8120         ;;
8121 esac
8122
8123 : Check how to convert floats to strings.
8124 echo " "
8125 echo "Checking for an efficient way to convert floats to strings."
8126 echo " " > try.c
8127 case "$uselongdouble" in
8128 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
8129 esac
8130 case "$d_longdbl" in
8131 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
8132 esac
8133 case "$d_PRIgldbl" in
8134 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
8135 esac
8136 $cat >>try.c <<EOP
8137 #ifdef TRY_gconvert
8138 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
8139 char *myname = "gconvert";
8140 #endif
8141 #ifdef TRY_gcvt
8142 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
8143 char *myname = "gcvt";
8144 #endif
8145 #ifdef TRY_qgcvt
8146 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
8147 char *myname = "qgcvt";
8148 #define DOUBLETYPE long double
8149 #endif
8150 #ifdef TRY_sprintf
8151 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE) && defined(HAS_PRIgldbl)
8152 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
8153 #else
8154 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
8155 #endif
8156 char *myname = "sprintf";
8157 #endif
8158
8159 #ifndef DOUBLETYPE
8160 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
8161 #define DOUBLETYPE long double
8162 #else
8163 #define DOUBLETYPE double
8164 #endif
8165 #endif
8166
8167 #include <stdio.h>
8168
8169 #define I_STDLIB $i_stdlib
8170 #ifdef I_STDLIB
8171 #include <stdlib.h>
8172 #endif
8173
8174 int
8175 checkit(expect, got)
8176 char *expect;
8177 char *got;
8178 {
8179     if (strcmp(expect, got)) {
8180                 printf("%s oddity:  Expected %s, got %s\n",
8181                         myname, expect, got);
8182                 exit(1);
8183         }
8184 }
8185
8186 int main()
8187
8188         char buf[64]; 
8189         buf[63] = '\0';
8190
8191         /* This must be 1st test on (which?) platform */
8192         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
8193         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
8194         checkit("0.1", buf);
8195
8196         Gconvert((DOUBLETYPE)1.0, 8, 0, buf); 
8197         checkit("1", buf);
8198
8199         Gconvert((DOUBLETYPE)1.1, 8, 0, buf); 
8200         checkit("1.1", buf);
8201
8202         Gconvert((DOUBLETYPE)1.01, 8, 0, buf); 
8203         checkit("1.01", buf);
8204
8205         Gconvert((DOUBLETYPE)1.001, 8, 0, buf); 
8206         checkit("1.001", buf);
8207
8208         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf); 
8209         checkit("1.0001", buf);
8210
8211         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf); 
8212         checkit("1.00001", buf);
8213
8214         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf); 
8215         checkit("1.000001", buf);
8216
8217         Gconvert((DOUBLETYPE)0.0, 8, 0, buf); 
8218         checkit("0", buf);
8219
8220         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf); 
8221         checkit("-1", buf);
8222
8223         /* Some Linux gcvt's give 1.e+5 here. */
8224         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf); 
8225         checkit("100000", buf);
8226         
8227         /* Some Linux gcvt's give -1.e+5 here. */
8228         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf); 
8229         checkit("-100000", buf);
8230
8231         Gconvert((DOUBLETYPE)123.456, 8, 0, buf); 
8232         checkit("123.456", buf);
8233
8234         exit(0);
8235 }
8236 EOP
8237 case "$d_Gconvert" in
8238 gconvert*) xxx_list='gconvert gcvt sprintf' ;;
8239 gcvt*) xxx_list='gcvt gconvert sprintf' ;;
8240 sprintf*) xxx_list='sprintf gconvert gcvt' ;;
8241 *) xxx_list='gconvert gcvt sprintf' ;;
8242 esac
8243
8244 case "$d_longdbl$uselongdouble$d_PRIgldbl" in
8245 "$define$define$define")
8246     # for long doubles prefer first qgcvt, then sprintf
8247     xxx_list="`echo $xxx_list|sed s/sprintf//`" 
8248     xxx_list="sprintf $xxx_list"
8249     case "$d_qgcvt" in
8250     "$define") xxx_list="qgcvt $xxx_list" ;;
8251     esac
8252     ;;
8253 esac
8254
8255 for xxx_convert in $xxx_list; do
8256         echo "Trying $xxx_convert..."
8257         $rm -f try try$_o
8258         set try -DTRY_$xxx_convert
8259         if eval $compile; then
8260                 echo "$xxx_convert() found." >&4
8261                 if ./try; then
8262                         echo "I'll use $xxx_convert to convert floats into a string." >&4
8263                         break;
8264                 else
8265                         echo "...But $xxx_convert didn't work as I expected."
8266                 fi
8267         else
8268                 echo "$xxx_convert NOT found." >&4
8269         fi
8270 done
8271         
8272 case "$xxx_convert" in
8273 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
8274 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
8275 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
8276 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
8277    "$define$define$define")
8278       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
8279    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
8280    esac
8281    ;;  
8282 esac
8283
8284 : see if _fwalk exists
8285 set fwalk d__fwalk
8286 eval $inlibc
8287
8288 : Initialize h_fcntl
8289 h_fcntl=false
8290
8291 : Initialize h_sysfile
8292 h_sysfile=false
8293
8294 : access call always available on UNIX
8295 set access d_access
8296 eval $inlibc
8297
8298 : locate the flags for 'access()'
8299 case "$d_access" in
8300 "$define")
8301         echo " "
8302         $cat >access.c <<'EOCP'
8303 #include <sys/types.h>
8304 #ifdef I_FCNTL
8305 #include <fcntl.h>
8306 #endif
8307 #ifdef I_SYS_FILE
8308 #include <sys/file.h>
8309 #endif
8310 #ifdef I_UNISTD
8311 #include <unistd.h>
8312 #endif
8313 int main() {
8314         exit(R_OK);
8315 }
8316 EOCP
8317         : check sys/file.h first, no particular reason here
8318         if $test `./findhdr sys/file.h` && \
8319                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
8320                 h_sysfile=true;
8321                 echo "<sys/file.h> defines the *_OK access constants." >&4
8322         elif $test `./findhdr fcntl.h` && \
8323                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
8324                 h_fcntl=true;
8325                 echo "<fcntl.h> defines the *_OK access constants." >&4
8326         elif $test `./findhdr unistd.h` && \
8327                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
8328                 echo "<unistd.h> defines the *_OK access constants." >&4
8329         else
8330                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
8331         fi
8332         ;;
8333 esac
8334 $rm -f access*
8335
8336 : see if accessx exists
8337 set accessx d_accessx
8338 eval $inlibc
8339
8340 : see if alarm exists
8341 set alarm d_alarm
8342 eval $inlibc
8343
8344 : see if atolf exists
8345 set atolf d_atolf
8346 eval $inlibc
8347
8348 : see if atoll exists
8349 set atoll d_atoll
8350 eval $inlibc
8351
8352 : Look for GNU-cc style attribute checking
8353 echo " "
8354 echo "Checking whether your compiler can handle __attribute__ ..." >&4
8355 $cat >attrib.c <<'EOCP'
8356 #include <stdio.h>
8357 void croak (char* pat,...) __attribute__((format(printf,1,2),noreturn));
8358 EOCP
8359 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
8360         if $contains 'warning' attrib.out >/dev/null 2>&1; then
8361                 echo "Your C compiler doesn't fully support __attribute__."
8362                 val="$undef"
8363         else
8364                 echo "Your C compiler supports __attribute__."
8365                 val="$define"
8366         fi
8367 else
8368         echo "Your C compiler doesn't seem to understand __attribute__ at all."
8369         val="$undef"
8370 fi
8371 set d_attribut
8372 eval $setvar
8373 $rm -f attrib*
8374
8375 : see if bcmp exists
8376 set bcmp d_bcmp
8377 eval $inlibc
8378
8379 : see if bcopy exists
8380 set bcopy d_bcopy
8381 eval $inlibc
8382
8383 : see if this is a unistd.h system
8384 set unistd.h i_unistd
8385 eval $inhdr
8386
8387 : see if getpgrp exists
8388 set getpgrp d_getpgrp
8389 eval $inlibc
8390
8391 case "$d_getpgrp" in
8392 "$define")
8393         echo " "
8394         echo "Checking to see which flavor of getpgrp is in use..."
8395         $cat >set.c <<EOP
8396 #$i_unistd I_UNISTD
8397 #include <sys/types.h>
8398 #ifdef I_UNISTD
8399 #  include <unistd.h>
8400 #endif
8401 int main()
8402 {
8403         if (getuid() == 0) {
8404                 printf("(I see you are running Configure as super-user...)\n");
8405                 setuid(1);
8406         }
8407 #ifdef TRY_BSD_PGRP
8408         if (getpgrp(1) == 0)
8409                 exit(0);
8410 #else
8411         if (getpgrp() > 0)
8412                 exit(0);
8413 #endif
8414         exit(1);
8415 }
8416 EOP
8417         if $cc -o set -DTRY_BSD_PGRP $ccflags $ldflags set.c $libs >/dev/null 2>&1 && ./set; then
8418                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
8419                 val="$define"
8420         elif $cc -o set $ccflags $ldflags set.c $libs >/dev/null 2>&1 && ./set; then
8421                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
8422                 val="$undef"
8423         else
8424                 echo "I can't seem to compile and run the test program."
8425                 if ./usg; then
8426                         xxx="a USG one, i.e. you use getpgrp()."
8427                 else
8428                         # SVR4 systems can appear rather BSD-ish.
8429                         case "$i_unistd" in
8430                         $undef)
8431                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
8432                                 val="$define"
8433                                 ;;
8434                         $define)
8435                                 xxx="probably a USG one, i.e. you use getpgrp()."
8436                                 val="$undef"
8437                                 ;;
8438                         esac
8439                 fi
8440                 echo "Assuming your getpgrp is $xxx" >&4
8441         fi
8442         ;;
8443 *) val="$undef";;
8444 esac
8445 set d_bsdgetpgrp
8446 eval $setvar
8447 $rm -f set set.c
8448
8449 : see if setpgrp exists
8450 set setpgrp d_setpgrp
8451 eval $inlibc
8452
8453 case "$d_setpgrp" in
8454 "$define")
8455         echo " "
8456         echo "Checking to see which flavor of setpgrp is in use..."
8457         $cat >set.c <<EOP
8458 #$i_unistd I_UNISTD
8459 #include <sys/types.h>
8460 #ifdef I_UNISTD
8461 #  include <unistd.h>
8462 #endif
8463 int main()
8464 {
8465         if (getuid() == 0) {
8466                 printf("(I see you are running Configure as super-user...)\n");
8467                 setuid(1);
8468         }
8469 #ifdef TRY_BSD_PGRP
8470         if (-1 == setpgrp(1, 1))
8471                 exit(0);
8472 #else
8473         if (setpgrp() != -1)
8474                 exit(0);
8475 #endif
8476         exit(1);
8477 }
8478 EOP
8479         if $cc -o set -DTRY_BSD_PGRP $ccflags $ldflags set.c $libs >/dev/null 2>&1 && ./set; then
8480                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
8481                 val="$define"
8482         elif $cc -o set $ccflags $ldflags set.c $libs >/dev/null 2>&1 && ./set; then
8483                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
8484                 val="$undef"
8485         else
8486                 echo "(I can't seem to compile and run the test program.)"
8487                 if ./usg; then
8488                         xxx="a USG one, i.e. you use setpgrp()."
8489                 else
8490                         # SVR4 systems can appear rather BSD-ish.
8491                         case "$i_unistd" in
8492                         $undef)
8493                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
8494                                 val="$define"
8495                                 ;;
8496                         $define)
8497                                 xxx="probably a USG one, i.e. you use setpgrp()."
8498                                 val="$undef"
8499                                 ;;
8500                         esac
8501                 fi
8502                 echo "Assuming your setpgrp is $xxx" >&4
8503         fi
8504         ;;
8505 *) val="$undef";;
8506 esac
8507 set d_bsdsetpgrp
8508 eval $setvar
8509 $rm -f set set.c
8510 : see if bzero exists
8511 set bzero d_bzero
8512 eval $inlibc
8513
8514 : see if signal is declared as pointer to function returning int or void
8515 echo " "
8516 xxx=`./findhdr signal.h`
8517 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
8518 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
8519         echo "You have int (*signal())() instead of void." >&4
8520         val="$undef"
8521 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
8522         echo "You have void (*signal())()." >&4
8523         val="$define"
8524 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
8525         echo "You have int (*signal())() instead of void." >&4
8526         val="$undef"
8527 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
8528         echo "You have void (*signal())()." >&4
8529         val="$define"
8530 else
8531         case "$d_voidsig" in
8532         '')
8533         echo "I can't determine whether signal handler returns void or int..." >&4
8534                 dflt=void
8535                 rp="What type does your signal handler return?"
8536                 . ./myread
8537                 case "$ans" in
8538                 v*) val="$define";;
8539                 *) val="$undef";;
8540                 esac;;
8541         "$define")
8542                 echo "As you already told me, signal handler returns void." >&4
8543                 val="$define"
8544                 ;;
8545         *)      echo "As you already told me, signal handler returns int." >&4
8546                 val="$undef"
8547                 ;;
8548         esac
8549 fi
8550 set d_voidsig
8551 eval $setvar
8552 case "$d_voidsig" in
8553 "$define") signal_t="void";;
8554 *) signal_t="int";;
8555 esac
8556 $rm -f $$.tmp
8557
8558 : check for ability to cast large floats to 32-bit ints.
8559 echo " "
8560 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
8561 if $test "$intsize" -ge 4; then
8562         xxx=int
8563 else
8564         xxx=long
8565 fi
8566 $cat >try.c <<EOCP
8567 #include <stdio.h>
8568 #include <sys/types.h>
8569 #include <signal.h>
8570 $signal_t blech(s) int s; { exit(3); }
8571 int main()
8572 {
8573         $xxx i32;
8574         double f, g;
8575         int result = 0;
8576         char str[16];
8577         signal(SIGFPE, blech);
8578
8579         /* Don't let compiler optimize the test away.  Store the number 
8580            in a writable string for gcc to pass to sscanf under HP/UX.
8581         */
8582         sprintf(str, "2147483647");
8583         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
8584         g = 10 * f;
8585         i32  = ($xxx) g;
8586
8587         /* x86 processors will probably give 0x8000 0000, which is a
8588        sign change.  We don't want that.  We want to mimic SPARC
8589            behavior here, which is to preserve the sign and give
8590            back 0x7fff ffff.
8591         */
8592         if (i32 != ($xxx) f)
8593                 result |= 1;
8594         exit(result);
8595 }
8596 EOCP
8597 set try
8598 if eval $compile_ok; then
8599         ./try
8600         yyy=$?
8601 else
8602         echo "(I can't seem to compile the test program--assuming it can't)"
8603         yyy=1
8604 fi
8605 case "$yyy" in
8606 0)      val="$define"
8607         echo "Yup, it can."
8608         ;;
8609 *)      val="$undef"
8610         echo "Nope, it can't."
8611         ;;
8612 esac
8613 set d_casti32
8614 eval $setvar
8615 $rm -f try try.*
8616
8617 : check for ability to cast negative floats to unsigned
8618 echo " "
8619 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
8620 $cat >try.c <<EOCP
8621 #include <stdio.h>
8622 #include <sys/types.h>
8623 #include <signal.h>
8624 $signal_t blech(s) int s; { exit(7); }
8625 $signal_t blech_in_list(s) int s; { exit(4); }
8626 unsigned long dummy_long(p) unsigned long p; { return p; }
8627 unsigned int dummy_int(p) unsigned int p; { return p; }
8628 unsigned short dummy_short(p) unsigned short p; { return p; }
8629 int main()
8630 {
8631         double f;
8632         unsigned long along;
8633         unsigned int aint;
8634         unsigned short ashort;
8635         int result = 0;
8636         char str[16];
8637         
8638         /* Frustrate gcc-2.7.2's optimizer which failed this test with
8639            a direct f = -123. assignment.  gcc-2.8.0 reportedly
8640            optimized the whole file away
8641         */
8642         /* Store the number in a writable string for gcc to pass to 
8643            sscanf under HP/UX.
8644         */
8645         sprintf(str, "-123");
8646         sscanf(str, "%lf", &f);  /* f = -123.; */
8647
8648         signal(SIGFPE, blech);
8649         along = (unsigned long)f;
8650         aint = (unsigned int)f;
8651         ashort = (unsigned short)f;
8652         if (along != (unsigned long)-123)
8653                 result |= 1;
8654         if (aint != (unsigned int)-123)
8655                 result |= 1;
8656         if (ashort != (unsigned short)-123)
8657                 result |= 1;
8658         sprintf(str, "1073741824.");
8659         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
8660         f = f + f;
8661         along = 0;
8662         along = (unsigned long)f;
8663         if (along != 0x80000000)
8664                 result |= 2;
8665         f -= 1.;
8666         along = 0;
8667         along = (unsigned long)f;
8668         if (along != 0x7fffffff)
8669                 result |= 1;
8670         f += 2.;
8671         along = 0;
8672         along = (unsigned long)f;
8673         if (along != 0x80000001)
8674                 result |= 2;
8675         if (result)
8676                 exit(result);
8677         signal(SIGFPE, blech_in_list);
8678         sprintf(str, "123.");
8679         sscanf(str, "%lf", &f);  /* f = 123.; */
8680         along = dummy_long((unsigned long)f);
8681         aint = dummy_int((unsigned int)f);
8682         ashort = dummy_short((unsigned short)f);
8683         if (along != (unsigned long)123)
8684                 result |= 4;
8685         if (aint != (unsigned int)123)
8686                 result |= 4;
8687         if (ashort != (unsigned short)123)
8688                 result |= 4;
8689         exit(result);
8690
8691 }
8692 EOCP
8693 set try
8694 if eval $compile_ok; then
8695         ./try
8696         castflags=$?
8697 else
8698         echo "(I can't seem to compile the test program--assuming it can't)"
8699         castflags=7
8700 fi
8701 case "$castflags" in
8702 0)      val="$define"
8703         echo "Yup, it can."
8704         ;;
8705 *)      val="$undef"
8706         echo "Nope, it can't."
8707         ;;
8708 esac
8709 set d_castneg
8710 eval $setvar
8711 $rm -f try.*
8712
8713 : see if vprintf exists
8714 echo " "
8715 if set vprintf val -f d_vprintf; eval $csym; $val; then
8716         echo 'vprintf() found.' >&4
8717         val="$define"
8718         $cat >vprintf.c <<'EOF'
8719 #include <varargs.h>
8720
8721 int main() { xxx("foo"); }
8722
8723 xxx(va_alist)
8724 va_dcl
8725 {
8726         va_list args;
8727         char buf[10];
8728
8729         va_start(args);
8730         exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
8731 }
8732 EOF
8733         set vprintf
8734         if eval $compile && ./vprintf; then
8735                 echo "Your vsprintf() returns (int)." >&4
8736                 val2="$undef"
8737         else
8738                 echo "Your vsprintf() returns (char*)." >&4
8739                 val2="$define"
8740         fi
8741 else
8742         echo 'vprintf() NOT found.' >&4
8743                 val="$undef"
8744                 val2="$undef"
8745 fi
8746 set d_vprintf
8747 eval $setvar
8748 val=$val2
8749 set d_charvspr
8750 eval $setvar
8751
8752 : see if chown exists
8753 set chown d_chown
8754 eval $inlibc
8755
8756 : see if chroot exists
8757 set chroot d_chroot
8758 eval $inlibc
8759
8760 : see if chsize exists
8761 set chsize d_chsize
8762 eval $inlibc
8763
8764 hasstruct='varname=$1; struct=$2; shift; shift;
8765 while $test $# -ge 2; do
8766         case "$1" in
8767         $define) echo "#include <$2>";;
8768         esac ;
8769     shift 2;
8770 done > try.c;
8771 echo "int main () { struct $struct foo; }" >> try.c;
8772 set try;
8773 if eval $compile; then
8774         val="$define";
8775 else
8776         val="$undef";
8777 fi;
8778 set $varname;
8779 eval $setvar;
8780 $rm -f try.c try.o'
8781
8782 : see if sys/types.h has to be included
8783 set sys/types.h i_systypes
8784 eval $inhdr
8785
8786 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
8787 while $test $# -ge 2; do
8788         case "$1" in
8789         $define) echo "#include <$2>";;
8790         esac ;
8791     shift 2;
8792 done > try.c;
8793 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
8794 set try;
8795 if eval $compile; then
8796         val="$define";
8797 else
8798         val="$undef";
8799 fi;
8800 set $varname;
8801 eval $setvar;
8802 $rm -f try.c try.o'
8803
8804 socketlib=''
8805 sockethdr=''
8806 : see whether socket exists
8807 echo " "
8808 $echo $n "Hmm... $c" >&4
8809 if set socket val -f d_socket; eval $csym; $val; then
8810         echo "Looks like you have Berkeley networking support." >&4
8811         d_socket="$define"
8812         if set setsockopt val -f; eval $csym; $val; then
8813                 d_oldsock="$undef"
8814         else
8815                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
8816                 d_oldsock="$define"
8817         fi
8818 else
8819         if $contains socklib libc.list >/dev/null 2>&1; then
8820                 echo "Looks like you have Berkeley networking support." >&4
8821                 d_socket="$define"
8822                 : we will have to assume that it supports the 4.2 BSD interface
8823                 d_oldsock="$undef"
8824         else
8825                 echo "You don't have Berkeley networking in libc$_a..." >&4
8826                 if test "X$d_socket" = "X$define"; then
8827                    echo "...but you seem to believe that you have sockets." >&4
8828                 else
8829                         for net in net socket
8830                         do
8831                                 if test -f /usr/lib/lib$net$_a; then
8832                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
8833                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
8834                                         if $contains socket libc.list >/dev/null 2>&1; then
8835                                                 d_socket="$define"
8836                                                 socketlib="-l$net"
8837                                                 case "$net" in
8838                                                 net)
8839                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
8840                                                         sockethdr="-I/usr/netinclude"
8841                                                         ;;
8842                                                 esac
8843                                                 echo "Found Berkeley sockets interface in lib$net." >& 4 
8844                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
8845                                                         d_oldsock="$undef"
8846                                                 else
8847                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
8848                                                         d_oldsock="$define"
8849                                                 fi
8850                                                 break
8851                                         fi
8852                                 fi
8853                         done
8854                         if test "X$d_socket" != "X$define"; then
8855                            echo "or anywhere else I see." >&4
8856                            d_socket="$undef"
8857                            d_oldsock="$undef"
8858                         fi
8859                 fi
8860         fi
8861 fi
8862
8863 : see if socketpair exists
8864 set socketpair d_sockpair
8865 eval $inlibc
8866
8867
8868 echo " "
8869 echo "Checking the availability of certain socket constants..." >& 4
8870 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
8871         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
8872         $cat >try.c <<EOF
8873 #include <sys/types.h>
8874 #include <sys/socket.h>
8875 int main() {
8876     int i = $ENUM;
8877 }
8878 EOF
8879         val="$undef"
8880         set try; if eval $compile; then
8881                 val="$define"
8882         fi
8883         set d_${enum}; eval $setvar
8884         $rm -f try.c try
8885 done
8886
8887 : see if this is a sys/uio.h system
8888 set sys/uio.h i_sysuio
8889 eval $inhdr
8890
8891
8892 echo " "
8893 echo "Checking to see if your system supports struct cmsghdr..." >&4
8894 set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
8895 eval $hasstruct
8896 case "$d_cmsghdr_s" in
8897 "$define")      echo "Yes, it does."   ;;
8898 *)              echo "No, it doesn't." ;;
8899 esac
8900
8901
8902 : check for const keyword
8903 echo " "
8904 echo 'Checking to see if your C compiler knows about "const"...' >&4
8905 $cat >const.c <<'EOCP'
8906 typedef struct spug { int drokk; } spug;
8907 int main()
8908 {
8909         const char *foo;
8910         const spug y;
8911 }
8912 EOCP
8913 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
8914         val="$define"
8915         echo "Yup, it does."
8916 else
8917         val="$undef"
8918         echo "Nope, it doesn't."
8919 fi
8920 set d_const
8921 eval $setvar
8922
8923 : see if crypt exists
8924 echo " "
8925 if set crypt val -f d_crypt; eval $csym; $val; then
8926         echo 'crypt() found.' >&4
8927         val="$define"
8928         cryptlib=''
8929 else
8930         cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
8931         if $test -z "$cryptlib"; then
8932                 cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
8933         else
8934                 cryptlib=-lcrypt
8935         fi
8936         if $test -z "$cryptlib"; then
8937                 cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
8938         else
8939                 cryptlib=-lcrypt
8940         fi
8941         if $test -z "$cryptlib"; then
8942                 cryptlib=`./loc libcrypt$_a "" $libpth`
8943         else
8944                 cryptlib=-lcrypt
8945         fi
8946         if $test -z "$cryptlib"; then
8947                 echo 'crypt() NOT found.' >&4
8948                 val="$undef"
8949         else
8950                 val="$define"
8951         fi
8952 fi
8953 set d_crypt
8954 eval $setvar
8955
8956 : get csh whereabouts
8957 case "$csh" in
8958 'csh') val="$undef" ;;
8959 *) val="$define" ;;
8960 esac
8961 set d_csh
8962 eval $setvar
8963 : Respect a hint or command line value for full_csh.
8964 case "$full_csh" in
8965 '') full_csh=$csh ;;
8966 esac
8967
8968 : see if cuserid exists
8969 set cuserid d_cuserid
8970 eval $inlibc
8971
8972 : see if this is a limits.h system
8973 set limits.h i_limits
8974 eval $inhdr
8975
8976 : see if this is a float.h system
8977 set float.h i_float
8978 eval $inhdr
8979
8980 : See if number of significant digits in a double precision number is known
8981 echo " "
8982 $cat >dbl_dig.c <<EOM
8983 #$i_limits I_LIMITS
8984 #$i_float I_FLOAT
8985 #ifdef I_LIMITS
8986 #include <limits.h>
8987 #endif
8988 #ifdef I_FLOAT
8989 #include <float.h>
8990 #endif
8991 #ifdef DBL_DIG
8992 printf("Contains DBL_DIG");
8993 #endif
8994 EOM
8995 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
8996 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
8997         echo "DBL_DIG found." >&4
8998         val="$define"
8999 else
9000         echo "DBL_DIG NOT found." >&4
9001         val="$undef"
9002 fi
9003 $rm -f dbl_dig.?
9004 set d_dbl_dig
9005 eval $setvar
9006
9007 : see if difftime exists
9008 set difftime d_difftime
9009 eval $inlibc
9010
9011 : see if this is a dirent system
9012 echo " "
9013 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
9014         val="$define"
9015         echo "<dirent.h> found." >&4
9016 else
9017         val="$undef"
9018         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
9019                 echo "<sys/dir.h> found." >&4
9020                 echo " "
9021         else
9022                 xinc=`./findhdr sys/ndir.h`
9023         fi
9024         echo "<dirent.h> NOT found." >&4
9025 fi
9026 set i_dirent
9027 eval $setvar
9028
9029 : Look for type of directory structure.
9030 echo " "
9031 $cppstdin $cppflags $cppminus < "$xinc" > try.c
9032
9033 case "$direntrytype" in
9034 ''|' ')
9035         case "$i_dirent" in
9036         $define) guess1='struct dirent' ;;
9037         *) guess1='struct direct'  ;;
9038         esac
9039         ;;
9040 *)      guess1="$direntrytype"
9041         ;;
9042 esac
9043
9044 case "$guess1" in
9045 'struct dirent') guess2='struct direct' ;;
9046 *) guess2='struct dirent' ;;
9047 esac
9048                 
9049 if $contains "$guess1" try.c >/dev/null 2>&1; then
9050         direntrytype="$guess1"
9051         echo "Your directory entries are $direntrytype." >&4
9052 elif $contains "$guess2" try.c >/dev/null 2>&1; then
9053         direntrytype="$guess2"
9054         echo "Your directory entries seem to be $direntrytype." >&4
9055 else
9056         echo "I don't recognize your system's directory entries." >&4
9057         rp="What type is used for directory entries on this system?"
9058         dflt="$guess1"
9059         . ./myread
9060         direntrytype="$ans"
9061 fi
9062 $rm -f try.c
9063
9064
9065 : see if the directory entry stores field length
9066 echo " "
9067 $cppstdin $cppflags $cppminus < "$xinc" > try.c
9068 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
9069         echo "Good, your directory entry keeps length information in d_namlen." >&4
9070         val="$define"
9071 else
9072         echo "Your directory entry does not know about the d_namlen field." >&4
9073         val="$undef"
9074 fi
9075 set d_dirnamlen
9076 eval $setvar
9077 $rm -f try.c
9078
9079 : see if dlerror exists
9080 xxx_runnm="$runnm"
9081 runnm=false
9082 set dlerror d_dlerror
9083 eval $inlibc
9084 runnm="$xxx_runnm"
9085
9086 : see if dlfcn is available
9087 set dlfcn.h i_dlfcn
9088 eval $inhdr
9089
9090 case "$usedl" in
9091 $define|y|true)
9092         $cat << EOM
9093
9094 On a few systems, the dynamically loaded modules that perl generates and uses
9095 will need a different extension than shared libs. The default will probably
9096 be appropriate.
9097
9098 EOM
9099         case "$dlext" in
9100         '')     dflt="$so" ;;
9101         *)      dflt="$dlext" ;;
9102         esac
9103         rp='What is the extension of dynamically loaded modules'
9104         . ./myread
9105         dlext="$ans"
9106         ;;
9107 *)
9108         dlext="none"
9109         ;;
9110 esac
9111
9112 : Check if dlsym need a leading underscore
9113 echo " "
9114 val="$undef"
9115
9116 case "$dlsrc" in
9117 dl_dlopen.xs)
9118         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
9119         $cat >dyna.c <<'EOM'
9120 fred () { }
9121 EOM
9122
9123 $cat >fred.c<<EOM
9124
9125 #include <stdio.h>
9126 #$i_dlfcn I_DLFCN
9127 #ifdef I_DLFCN
9128 #include <dlfcn.h>      /* the dynamic linker include file for Sunos/Solaris */
9129 #else
9130 #include <sys/types.h>
9131 #include <nlist.h>
9132 #include <link.h>
9133 #endif
9134
9135 extern int fred() ;
9136
9137 int main()
9138 {
9139     void * handle ;
9140     void * symbol ;
9141 #ifndef RTLD_LAZY
9142     int mode = 1 ;
9143 #else
9144     int mode = RTLD_LAZY ;
9145 #endif
9146     handle = dlopen("./dyna.$dlext", mode) ;
9147     if (handle == NULL) {
9148         printf ("1\n") ;
9149         fflush (stdout) ;
9150         exit(0);
9151     }
9152     symbol = dlsym(handle, "fred") ;
9153     if (symbol == NULL) {
9154         /* try putting a leading underscore */
9155         symbol = dlsym(handle, "_fred") ;
9156         if (symbol == NULL) {
9157             printf ("2\n") ;
9158             fflush (stdout) ;
9159             exit(0);
9160         }
9161         printf ("3\n") ;
9162     }
9163     else
9164         printf ("4\n") ;
9165     fflush (stdout) ;
9166     exit(0);
9167 }
9168 EOM
9169         : Call the object file tmp-dyna.o in case dlext=o.
9170         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 && 
9171                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 && 
9172                 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 && 
9173                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1; then
9174                 xxx=`./fred`
9175                 case $xxx in
9176                 1)      echo "Test program failed using dlopen." >&4
9177                         echo "Perhaps you should not use dynamic loading." >&4;;
9178                 2)      echo "Test program failed using dlsym." >&4
9179                         echo "Perhaps you should not use dynamic loading." >&4;;
9180                 3)      echo "dlsym needs a leading underscore" >&4
9181                         val="$define" ;;
9182                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
9183                 esac
9184         else
9185                 echo "I can't compile and run the test program." >&4
9186                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
9187         fi
9188         ;;
9189 esac
9190                 
9191 $rm -f fred fred.? dyna.$dlext dyna.? tmp-dyna.?
9192
9193 set d_dlsymun
9194 eval $setvar
9195
9196 hasproto='varname=$1; func=$2; shift; shift;
9197 while $test $# -ge 2; do
9198         case "$1" in
9199         $define) echo "#include <$2>";;
9200         esac ;
9201     shift 2;
9202 done > try.c;
9203 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
9204 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
9205         echo "$func() prototype found.";
9206         val="$define";
9207 else
9208         echo "$func() prototype NOT found.";
9209         val="$undef";
9210 fi;
9211 set $varname;
9212 eval $setvar;
9213 $rm -f try.c tryout.c'
9214
9215 : see if prototype for drand48 is available
9216 echo " "
9217 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
9218 eval $hasproto
9219
9220 : see if dup2 exists
9221 set dup2 d_dup2
9222 eval $inlibc
9223
9224 : see if eaccess exists
9225 set eaccess d_eaccess
9226 eval $inlibc
9227
9228 : see if endgrent exists
9229 set endgrent d_endgrent
9230 eval $inlibc
9231
9232 : see if endhostent exists
9233 set endhostent d_endhent
9234 eval $inlibc
9235
9236 : see if endnetent exists
9237 set endnetent d_endnent
9238 eval $inlibc
9239
9240 : see if endprotoent exists
9241 set endprotoent d_endpent
9242 eval $inlibc
9243
9244 : see if endpwent exists
9245 set endpwent d_endpwent
9246 eval $inlibc
9247
9248 : see if endservent exists
9249 set endservent d_endsent
9250 eval $inlibc
9251
9252 : Locate the flags for 'open()'
9253 echo " "
9254 $cat >open3.c <<'EOCP'
9255 #include <sys/types.h>
9256 #ifdef I_FCNTL
9257 #include <fcntl.h>
9258 #endif
9259 #ifdef I_SYS_FILE
9260 #include <sys/file.h>
9261 #endif
9262 int main() {
9263         if(O_RDONLY);
9264 #ifdef O_TRUNC
9265         exit(0);
9266 #else
9267         exit(1);
9268 #endif
9269 }
9270 EOCP
9271 : check sys/file.h first to get FREAD on Sun
9272 if $test `./findhdr sys/file.h` && \
9273                 set open3 -DI_SYS_FILE && eval $compile; then
9274         h_sysfile=true;
9275         echo "<sys/file.h> defines the O_* constants..." >&4
9276         if ./open3; then
9277                 echo "and you have the 3 argument form of open()." >&4
9278                 val="$define"
9279         else
9280                 echo "but not the 3 argument form of open().  Oh, well." >&4
9281                 val="$undef"
9282         fi
9283 elif $test `./findhdr fcntl.h` && \
9284                 set open3 -DI_FCNTL && eval $compile; then
9285         h_fcntl=true;
9286         echo "<fcntl.h> defines the O_* constants..." >&4
9287         if ./open3; then
9288                 echo "and you have the 3 argument form of open()." >&4
9289                 val="$define"
9290         else
9291                 echo "but not the 3 argument form of open().  Oh, well." >&4
9292                 val="$undef"
9293         fi
9294 else
9295         val="$undef"
9296         echo "I can't find the O_* constant definitions!  You got problems." >&4
9297 fi
9298 set d_open3
9299 eval $setvar
9300 $rm -f open3*
9301
9302 : see which of string.h or strings.h is needed
9303 echo " "
9304 strings=`./findhdr string.h`
9305 if $test "$strings" && $test -r "$strings"; then
9306         echo "Using <string.h> instead of <strings.h>." >&4
9307         val="$define"
9308 else
9309         val="$undef"
9310         strings=`./findhdr strings.h`
9311         if $test "$strings" && $test -r "$strings"; then
9312                 echo "Using <strings.h> instead of <string.h>." >&4
9313         else
9314                 echo "No string header found -- You'll surely have problems." >&4
9315         fi
9316 fi
9317 set i_string
9318 eval $setvar
9319 case "$i_string" in
9320 "$undef") strings=`./findhdr strings.h`;;
9321 *)        strings=`./findhdr string.h`;;
9322 esac
9323
9324 : check for non-blocking I/O stuff
9325 case "$h_sysfile" in
9326 true) echo "#include <sys/file.h>" > head.c;;
9327 *)
9328        case "$h_fcntl" in
9329        true) echo "#include <fcntl.h>" > head.c;;
9330        *) echo "#include <sys/fcntl.h>" > head.c;;
9331        esac
9332        ;;
9333 esac
9334 echo " "
9335 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
9336 case "$o_nonblock" in
9337 '')
9338         $cat head.c > try.c
9339         $cat >>try.c <<'EOCP'
9340 #include <stdio.h>
9341 int main() {
9342 #ifdef O_NONBLOCK
9343         printf("O_NONBLOCK\n");
9344         exit(0);
9345 #endif
9346 #ifdef O_NDELAY
9347         printf("O_NDELAY\n");
9348         exit(0);
9349 #endif
9350 #ifdef FNDELAY
9351         printf("FNDELAY\n");
9352         exit(0);
9353 #endif
9354         exit(0);
9355 }
9356 EOCP
9357         set try
9358         if eval $compile_ok; then
9359                 o_nonblock=`./try`
9360                 case "$o_nonblock" in
9361                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
9362                 *) echo "Seems like we can use $o_nonblock.";;
9363                 esac
9364         else
9365                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
9366         fi
9367         ;;
9368 *) echo "Using $hint value $o_nonblock.";;
9369 esac
9370 $rm -f try try.* .out core
9371
9372 echo " "
9373 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
9374 case "$eagain" in
9375 '')
9376         $cat head.c > try.c
9377         $cat >>try.c <<EOCP
9378 #include <errno.h>
9379 #include <sys/types.h>
9380 #include <signal.h>
9381 #include <stdio.h> 
9382 #define MY_O_NONBLOCK $o_nonblock
9383 #ifndef errno  /* XXX need better Configure test */
9384 extern int errno;
9385 #endif
9386 #$i_unistd I_UNISTD
9387 #ifdef I_UNISTD
9388 #include <unistd.h>
9389 #endif
9390 #$i_string I_STRING
9391 #ifdef I_STRING
9392 #include <string.h>
9393 #else
9394 #include <strings.h>
9395 #endif
9396 $signal_t blech(x) int x; { exit(3); }
9397 EOCP
9398         $cat >> try.c <<'EOCP'
9399 int main()
9400 {
9401         int pd[2];
9402         int pu[2];
9403         char buf[1];
9404         char string[100];
9405
9406         pipe(pd);       /* Down: child -> parent */
9407         pipe(pu);       /* Up: parent -> child */
9408         if (0 != fork()) {
9409                 int ret;
9410                 close(pd[1]);   /* Parent reads from pd[0] */
9411                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
9412 #ifdef F_SETFL
9413                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
9414                         exit(1);
9415 #else
9416                 exit(4);
9417 #endif
9418                 signal(SIGALRM, blech);
9419                 alarm(5);
9420                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
9421                         exit(2);
9422                 sprintf(string, "%d\n", ret);
9423                 write(2, string, strlen(string));
9424                 alarm(0);
9425 #ifdef EAGAIN
9426                 if (errno == EAGAIN) {
9427                         printf("EAGAIN\n");
9428                         goto ok;
9429                 }
9430 #endif
9431 #ifdef EWOULDBLOCK
9432                 if (errno == EWOULDBLOCK)
9433                         printf("EWOULDBLOCK\n");
9434 #endif
9435         ok:
9436                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
9437                 sleep(2);                               /* Give it time to close our pipe */
9438                 alarm(5);
9439                 ret = read(pd[0], buf, 1);      /* Should read EOF */
9440                 alarm(0);
9441                 sprintf(string, "%d\n", ret);
9442                 write(3, string, strlen(string));
9443                 exit(0);
9444         }
9445
9446         close(pd[0]);                   /* We write to pd[1] */
9447         close(pu[1]);                   /* We read from pu[0] */
9448         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
9449         close(pd[1]);                   /* Pipe pd is now fully closed! */
9450         exit(0);                                /* Bye bye, thank you for playing! */
9451 }
9452 EOCP
9453         set try
9454         if eval $compile_ok; then
9455                 echo "$startsh" >mtry
9456                 echo "./try >try.out 2>try.ret 3>try.err || exit 4" >>mtry
9457                 chmod +x mtry
9458                 ./mtry >/dev/null 2>&1
9459                 case $? in
9460                 0) eagain=`$cat try.out`;;
9461                 1) echo "Could not perform non-blocking setting!";;
9462                 2) echo "I did a successful read() for something that was not there!";;
9463                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
9464                 4) echo "Could not find F_SETFL!";;
9465                 *) echo "Something terribly wrong happened during testing.";;
9466                 esac
9467                 rd_nodata=`$cat try.ret`
9468                 echo "A read() system call with no data present returns $rd_nodata."
9469                 case "$rd_nodata" in
9470                 0|-1) ;;
9471                 *)
9472                         echo "(That's peculiar, fixing that to be -1.)"
9473                         rd_nodata=-1
9474                         ;;
9475                 esac
9476                 case "$eagain" in
9477                 '')
9478                         echo "Forcing errno EAGAIN on read() with no data available."
9479                         eagain=EAGAIN
9480                         ;;
9481                 *)
9482                         echo "Your read() sets errno to $eagain when no data is available."
9483                         ;;
9484                 esac
9485                 status=`$cat try.err`
9486                 case "$status" in
9487                 0) echo "And it correctly returns 0 to signal EOF.";;
9488                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
9489                 *) echo "However, your read() returns '$status' on EOF??";;
9490                 esac
9491                 val="$define"
9492                 if test "$status" = "$rd_nodata"; then
9493                         echo "WARNING: you can't distinguish between EOF and no data!"
9494                         val="$undef"
9495                 fi
9496         else
9497                 echo "I can't compile the test program--assuming errno EAGAIN will do."
9498                 eagain=EAGAIN
9499         fi
9500         set d_eofnblk
9501         eval $setvar
9502         ;;
9503 *)
9504         echo "Using $hint value $eagain."
9505         echo "Your read() returns $rd_nodata when no data is present."
9506         case "$d_eofnblk" in
9507         "$define") echo "And you can see EOF because read() returns 0.";;
9508         "$undef") echo "But you can't see EOF status from read() returned value.";;
9509         *)
9510                 echo "(Assuming you can't see EOF status from read anyway.)"
9511                 d_eofnblk=$undef
9512                 ;;
9513         esac
9514         ;;
9515 esac
9516 $rm -f try try.* .out core head.c mtry
9517
9518 : see if fchmod exists
9519 set fchmod d_fchmod
9520 eval $inlibc
9521
9522 : see if fchown exists
9523 set fchown d_fchown
9524 eval $inlibc
9525
9526 : see if this is an fcntl system
9527 set fcntl d_fcntl
9528 eval $inlibc
9529
9530 echo " "
9531 : See if fcntl-based locking works.
9532 $cat >try.c <<'EOCP'
9533 #include <stdlib.h>
9534 #include <unistd.h>
9535 #include <fcntl.h>
9536 int main() {
9537 #if defined(F_SETLK) && defined(F_SETLKW)
9538      struct flock flock;
9539      int retval, fd;
9540      fd = open("try.c", O_RDONLY);
9541      flock.l_type = F_RDLCK;
9542      flock.l_whence = SEEK_SET;
9543      flock.l_start = flock.l_len = 0;
9544      retval = fcntl(fd, F_SETLK, &flock);
9545      close(fd);
9546      (retval < 0 ? exit(2) : exit(0));
9547 #else
9548      exit(2);
9549 #endif
9550 }
9551 EOCP
9552 echo "Checking if fcntl-based file locking works... "
9553 case "$d_fcntl" in
9554 "$define")
9555         set try
9556         if eval $compile_ok; then
9557                 if ./try; then
9558                         echo "Yes, it seems to work."
9559                         val="$define"
9560                 else
9561                         echo "Nope, it didn't work."
9562                         val="$undef"
9563                 fi
9564         else
9565                 echo "I'm unable to compile the test program, so I'll assume not."
9566                 val="$undef"
9567         fi
9568         ;;
9569 *) val="$undef";
9570         echo "Nope, since you don't even have fcntl()."
9571         ;;
9572 esac
9573 set d_fcntl_can_lock
9574 eval $setvar
9575 $rm -f try*
9576
9577
9578 : see if sys/select.h has to be included
9579 set sys/select.h i_sysselct
9580 eval $inhdr
9581
9582 : see if we should include time.h, sys/time.h, or both
9583 echo " "
9584 if test "X$timeincl" = X; then
9585         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
9586         $echo $n "I'm now running the test program...$c"
9587         $cat >try.c <<'EOCP'
9588 #include <sys/types.h>
9589 #ifdef I_TIME
9590 #include <time.h>
9591 #endif
9592 #ifdef I_SYSTIME
9593 #ifdef SYSTIMEKERNEL
9594 #define KERNEL
9595 #endif
9596 #include <sys/time.h>
9597 #endif
9598 #ifdef I_SYSSELECT
9599 #include <sys/select.h>
9600 #endif
9601 int main()
9602 {
9603         struct tm foo;
9604 #ifdef S_TIMEVAL
9605         struct timeval bar;
9606 #endif
9607 #ifdef S_TIMEZONE
9608         struct timezone tzp;
9609 #endif
9610         if (foo.tm_sec == foo.tm_sec)
9611                 exit(0);
9612 #ifdef S_TIMEVAL
9613         if (bar.tv_sec == bar.tv_sec)
9614                 exit(0);
9615 #endif
9616         exit(1);
9617 }
9618 EOCP
9619         flags=''
9620         for s_timezone in '-DS_TIMEZONE' ''; do
9621         sysselect=''
9622         for s_timeval in '-DS_TIMEVAL' ''; do
9623         for i_systimek in '' '-DSYSTIMEKERNEL'; do
9624         for i_time in '' '-DI_TIME'; do
9625         for i_systime in '-DI_SYSTIME' ''; do
9626                 case "$flags" in
9627                 '') $echo $n ".$c"
9628                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
9629                         if eval $compile; then
9630                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
9631                                 shift
9632                                 flags="$*"
9633                                 echo " "
9634                                 $echo $n "Succeeded with $flags$c"
9635                         fi
9636                         ;;
9637                 esac
9638         done
9639         done
9640         done
9641         done
9642         done
9643         timeincl=''
9644         echo " "
9645         case "$flags" in
9646         *SYSTIMEKERNEL*) i_systimek="$define"
9647                 timeincl=`./findhdr sys/time.h`
9648                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
9649         *) i_systimek="$undef";;
9650         esac
9651         case "$flags" in
9652         *I_TIME*) i_time="$define"
9653                 timeincl=`./findhdr time.h`" $timeincl"
9654                 echo "We'll include <time.h>." >&4;;
9655         *) i_time="$undef";;
9656         esac
9657         case "$flags" in
9658         *I_SYSTIME*) i_systime="$define"
9659                 timeincl=`./findhdr sys/time.h`" $timeincl"
9660                 echo "We'll include <sys/time.h>." >&4;;
9661         *) i_systime="$undef";;
9662         esac
9663         $rm -f try.c try
9664 fi
9665
9666 : check for fd_set items
9667 $cat <<EOM
9668
9669 Checking to see how well your C compiler handles fd_set and friends ...
9670 EOM
9671 $cat >fd_set.c <<EOCP
9672 #$i_systime I_SYS_TIME
9673 #$i_sysselct I_SYS_SELECT
9674 #$d_socket HAS_SOCKET
9675 #include <sys/types.h>
9676 #ifdef HAS_SOCKET
9677 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
9678 #endif
9679 #ifdef I_SYS_TIME
9680 #include <sys/time.h>
9681 #endif
9682 #ifdef I_SYS_SELECT
9683 #include <sys/select.h>
9684 #endif
9685 int main() {
9686         fd_set fds;
9687
9688 #ifdef TRYBITS
9689         if(fds.fds_bits);
9690 #endif
9691
9692 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
9693         exit(0);
9694 #else
9695         exit(1);
9696 #endif
9697 }
9698 EOCP
9699 set fd_set -DTRYBITS
9700 if eval $compile; then
9701         d_fds_bits="$define"
9702         d_fd_set="$define"
9703         echo "Well, your system knows about the normal fd_set typedef..." >&4
9704         if ./fd_set; then
9705                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
9706                 d_fd_macros="$define"
9707         else
9708                 $cat >&4 <<'EOM'
9709 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
9710 EOM
9711                 d_fd_macros="$undef"
9712         fi
9713 else
9714         $cat <<'EOM'
9715 Hmm, your compiler has some difficulty with fd_set.  Checking further...
9716 EOM
9717         set fd_set
9718         if eval $compile; then
9719                 d_fds_bits="$undef"
9720                 d_fd_set="$define"
9721                 echo "Well, your system has some sort of fd_set available..." >&4
9722                 if ./fd_set; then
9723                         echo "and you have the normal fd_set macros." >&4
9724                         d_fd_macros="$define"
9725                 else
9726                         $cat <<'EOM'
9727 but not the normal fd_set macros!  Gross!  More work for me...
9728 EOM
9729                         d_fd_macros="$undef"
9730                 fi
9731         else
9732         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
9733                 d_fd_set="$undef"
9734                 d_fds_bits="$undef"
9735                 d_fd_macros="$undef"
9736         fi
9737 fi
9738 $rm -f fd_set*
9739
9740 : see if fgetpos exists
9741 set fgetpos d_fgetpos
9742 eval $inlibc
9743
9744 : see if flock exists
9745 set flock d_flock
9746 eval $inlibc
9747
9748 : see if fork exists
9749 set fork d_fork
9750 eval $inlibc
9751
9752 : see if pathconf exists
9753 set pathconf d_pathconf
9754 eval $inlibc
9755
9756 : see if fpathconf exists
9757 set fpathconf d_fpathconf
9758 eval $inlibc
9759
9760
9761 : check for fpos64_t
9762 echo " "
9763 echo "Checking to see if you have fpos64_t..." >&4
9764 $cat >try.c <<EOCP
9765 #include <stdio.h>
9766 int main() { fpos64_t x = 7; }
9767 EOCP
9768 set try
9769 if eval $compile; then
9770         val="$define"
9771         echo "You have fpos64_t."
9772 else
9773         val="$undef"
9774         echo "You do not have fpos64_t."
9775         case "$fpossize" in
9776         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
9777         esac
9778 fi
9779 $rm -f try.* try
9780 set d_fpos64_t
9781 eval $setvar
9782
9783 : see if frexpl exists
9784 set frexpl d_frexpl
9785 eval $inlibc
9786
9787 : see if this is a sys/param system
9788 set sys/param.h i_sysparam
9789 eval $inhdr
9790
9791 : see if this is a sys/mount.h system
9792 set sys/mount.h i_sysmount
9793 eval $inhdr
9794
9795
9796 echo " "
9797 echo "Checking to see if your system supports struct fs_data..." >&4
9798 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
9799 eval $hasstruct
9800 case "$d_fs_data_s" in
9801 "$define")      echo "Yes, it does."   ;;
9802 *)              echo "No, it doesn't." ;;
9803 esac
9804
9805 : see if fseeko exists
9806 set fseeko d_fseeko
9807 eval $inlibc
9808 case "$longsize" in
9809 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
9810 esac
9811
9812 : see if fsetpos exists
9813 set fsetpos d_fsetpos
9814 eval $inlibc
9815
9816
9817 : see if fstatfs exists
9818 set fstatfs d_fstatfs
9819 eval $inlibc
9820
9821
9822 : see if statvfs exists
9823 set statvfs d_statvfs
9824 eval $inlibc
9825
9826 : see if fstatvfs exists
9827 set fstatvfs d_fstatvfs
9828 eval $inlibc
9829
9830
9831 : see if fsync exists
9832 set fsync d_fsync
9833 eval $inlibc
9834
9835 : see if ftello exists
9836 set ftello d_ftello
9837 eval $inlibc
9838 case "$longsize" in
9839 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
9840 esac
9841
9842 : see if getcwd exists
9843 set getcwd d_getcwd
9844 eval $inlibc
9845
9846 : see if getespwnam exists
9847 set getespwnam d_getespwnam
9848 eval $inlibc
9849
9850
9851 : see if getfsstat exists
9852 set getfsstat d_getfsstat
9853 eval $inlibc
9854
9855 : see if getgrent exists
9856 set getgrent d_getgrent
9857 eval $inlibc
9858
9859 : see if gethostbyaddr exists
9860 set gethostbyaddr d_gethbyaddr
9861 eval $inlibc
9862
9863 : see if gethostbyname exists
9864 set gethostbyname d_gethbyname
9865 eval $inlibc
9866
9867 : see if gethostent exists
9868 set gethostent d_gethent
9869 eval $inlibc
9870
9871 : see how we will look up host name
9872 echo " "
9873 call=''
9874 if set gethostname val -f d_gethname; eval $csym; $val; then
9875         echo 'gethostname() found.' >&4
9876         d_gethname="$define"
9877         call=gethostname
9878 fi
9879 if set uname val -f d_uname; eval $csym; $val; then
9880         if ./xenix; then
9881                 $cat <<'EOM'
9882 uname() was found, but you're running xenix, and older versions of xenix
9883 have a broken uname(). If you don't really know whether your xenix is old
9884 enough to have a broken system call, use the default answer.
9885
9886 EOM
9887                 dflt=y
9888                 case "$d_uname" in
9889                 "$define") dflt=n;;
9890                 esac
9891                 rp='Is your uname() broken?'
9892                 . ./myread
9893                 case "$ans" in
9894                 n*) d_uname="$define"; call=uname;;
9895                 esac
9896         else
9897                 echo 'uname() found.' >&4
9898                 d_uname="$define"
9899                 case "$call" in
9900                 '') call=uname ;;
9901                 esac
9902         fi
9903 fi
9904 case "$d_gethname" in
9905 '') d_gethname="$undef";;
9906 esac
9907 case "$d_uname" in
9908 '') d_uname="$undef";;
9909 esac
9910 case "$d_uname$d_gethname" in
9911 *define*)
9912         dflt=n
9913         cat <<EOM
9914  
9915 Every now and then someone has a $call() that lies about the hostname
9916 but can't be fixed for political or economic reasons.  If you wish, I can
9917 pretend $call() isn't there and maybe compute hostname at run-time
9918 thanks to the '$phostname' command.
9919
9920 EOM
9921         rp="Shall I ignore $call() from now on?"
9922         . ./myread
9923         case "$ans" in
9924         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
9925         esac;;
9926 esac
9927 case "$phostname" in
9928 '') aphostname='';;
9929 *) case "$aphostname" in
9930         /*) ;;
9931         *) set X $phostname
9932                 shift
9933                 file=$1
9934                 shift
9935                 file=`./loc $file $file $pth`
9936                 aphostname=`echo $file $*`
9937                 ;;
9938         esac
9939         ;;
9940 esac
9941 case "$d_uname$d_gethname" in
9942 *define*) ;;
9943 *)
9944         case "$phostname" in
9945         '')
9946                 echo "There will be no way for $package to get your hostname." >&4;;
9947         *)
9948         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
9949                 ;;
9950         esac;;
9951 esac
9952 case "$d_phostname" in
9953 '') d_phostname="$undef";;
9954 esac
9955
9956 : see if this is a netdb.h system
9957 set netdb.h i_netdb
9958 eval $inhdr
9959
9960 : see if prototypes for various gethostxxx netdb.h functions are available
9961 echo " "
9962 set d_gethostprotos gethostent $i_netdb netdb.h
9963 eval $hasproto
9964
9965 : see if getitimer exists
9966 set getitimer d_getitimer
9967 eval $inlibc
9968
9969 : see if getlogin exists
9970 set getlogin d_getlogin
9971 eval $inlibc
9972
9973 : see if getmnt exists
9974 set getmnt d_getmnt
9975 eval $inlibc
9976
9977 : see if getmntent exists
9978 set getmntent d_getmntent
9979 eval $inlibc
9980
9981 : see if getnetbyaddr exists
9982 set getnetbyaddr d_getnbyaddr
9983 eval $inlibc
9984
9985 : see if getnetbyname exists
9986 set getnetbyname d_getnbyname
9987 eval $inlibc
9988
9989 : see if getnetent exists
9990 set getnetent d_getnent
9991 eval $inlibc
9992
9993 : see if prototypes for various getnetxxx netdb.h functions are available
9994 echo " "
9995 set d_getnetprotos getnetent $i_netdb netdb.h
9996 eval $hasproto
9997
9998 : see if getpagesize exists
9999 set getpagesize d_getpagsz
10000 eval $inlibc
10001
10002
10003 : see if getprotobyname exists
10004 set getprotobyname d_getpbyname
10005 eval $inlibc
10006
10007 : see if getprotobynumber exists
10008 set getprotobynumber d_getpbynumber
10009 eval $inlibc
10010
10011 : see if getprotoent exists
10012 set getprotoent d_getpent
10013 eval $inlibc
10014
10015 : see if getpgid exists
10016 set getpgid d_getpgid
10017 eval $inlibc
10018
10019 : see if getpgrp2 exists
10020 set getpgrp2 d_getpgrp2
10021 eval $inlibc
10022
10023 : see if getppid exists
10024 set getppid d_getppid
10025 eval $inlibc
10026
10027 : see if getpriority exists
10028 set getpriority d_getprior
10029 eval $inlibc
10030
10031 : see if prototypes for various getprotoxxx netdb.h functions are available
10032 echo " "
10033 set d_getprotoprotos getprotoent $i_netdb netdb.h
10034 eval $hasproto
10035
10036 : see if getprpwnam exists
10037 set getprpwnam d_getprpwnam
10038 eval $inlibc
10039
10040 : see if getpwent exists
10041 set getpwent d_getpwent
10042 eval $inlibc
10043
10044
10045 : see if getservbyname exists
10046 set getservbyname d_getsbyname
10047 eval $inlibc
10048
10049 : see if getservbyport exists
10050 set getservbyport d_getsbyport
10051 eval $inlibc
10052
10053 : see if getservent exists
10054 set getservent d_getsent
10055 eval $inlibc
10056
10057 : see if prototypes for various getservxxx netdb.h functions are available
10058 echo " "
10059 set d_getservprotos getservent $i_netdb netdb.h
10060 eval $hasproto
10061
10062 : see if getspnam exists
10063 set getspnam d_getspnam
10064 eval $inlibc
10065
10066 : see if gettimeofday or ftime exists
10067 set gettimeofday d_gettimeod
10068 eval $inlibc
10069 case "$d_gettimeod" in
10070 "$undef")
10071         set ftime d_ftime 
10072         eval $inlibc
10073         ;;
10074 *)
10075         val="$undef"; set d_ftime; eval $setvar
10076         ;;
10077 esac
10078 case "$d_gettimeod$d_ftime" in
10079 "$undef$undef")
10080         echo " "
10081         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
10082         ;;
10083 esac
10084
10085 : see if this is an grp system
10086 set grp.h i_grp
10087 eval $inhdr
10088
10089 case "$i_grp" in
10090 $define)
10091         xxx=`./findhdr grp.h`
10092         $cppstdin $cppflags $cppminus < $xxx >$$.h
10093
10094         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
10095                 val="$define"
10096         else
10097                 val="$undef"
10098         fi
10099         set d_grpasswd
10100         eval $setvar
10101
10102         $rm -f $$.h
10103         ;;
10104 *)
10105         val="$undef";
10106         set d_grpasswd; eval $setvar
10107         ;;
10108 esac
10109
10110 : see if hasmntopt exists
10111 set hasmntopt d_hasmntopt
10112 eval $inlibc
10113
10114 : see if this is a netinet/in.h or sys/in.h system
10115 set netinet/in.h i_niin sys/in.h i_sysin
10116 eval $inhdr
10117
10118 : see if arpa/inet.h has to be included
10119 set arpa/inet.h i_arpainet
10120 eval $inhdr
10121
10122 : see if htonl --and friends-- exists
10123 val=''
10124 set htonl val
10125 eval $inlibc
10126
10127 : Maybe they are macros.
10128 case "$val" in
10129 $undef)
10130         $cat >htonl.c <<EOM
10131 #include <stdio.h>
10132 #include <sys/types.h>
10133 #$i_niin I_NETINET_IN
10134 #$i_sysin I_SYS_IN
10135 #$i_arpainet I_ARPA_INET
10136 #ifdef I_NETINET_IN
10137 #include <netinet/in.h>
10138 #endif
10139 #ifdef I_SYS_IN
10140 #include <sys/in.h>
10141 #endif
10142 #ifdef I_ARPA_INET
10143 #include <arpa/inet.h>
10144 #endif
10145 #ifdef htonl
10146 printf("Defined as a macro.");
10147 #endif
10148 EOM
10149         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
10150         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
10151                 val="$define"
10152                 echo "But it seems to be defined as a macro." >&4
10153         fi
10154         $rm -f htonl.?
10155         ;;
10156 esac
10157 set d_htonl
10158 eval $setvar
10159
10160 : see if iconv exists
10161 set iconv d_iconv
10162 eval $inlibc
10163
10164 : index or strchr
10165 echo " "
10166 if set index val -f; eval $csym; $val; then
10167         if set strchr val -f d_strchr; eval $csym; $val; then
10168                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
10169                         val="$define"
10170                         vali="$undef"
10171                         echo "strchr() found." >&4
10172                 else
10173                         val="$undef"
10174                         vali="$define"
10175                         echo "index() found." >&4
10176                 fi
10177         else
10178                 val="$undef"
10179                 vali="$define"
10180                 echo "index() found." >&4
10181         fi
10182 else
10183         if set strchr val -f d_strchr; eval $csym; $val; then
10184                 val="$define"
10185                 vali="$undef"
10186                 echo "strchr() found." >&4
10187         else
10188                 echo "No index() or strchr() found!" >&4
10189                 val="$undef"
10190                 vali="$undef"
10191         fi
10192 fi
10193 set d_strchr; eval $setvar
10194 val="$vali"
10195 set d_index; eval $setvar
10196
10197 : check whether inet_aton exists
10198 set inet_aton d_inetaton
10199 eval $inlibc
10200
10201 : Look for isascii
10202 echo " "
10203 $cat >isascii.c <<'EOCP'
10204 #include <stdio.h>
10205 #include <ctype.h>
10206 int main() {
10207         int c = 'A';
10208         if (isascii(c))
10209                 exit(0);
10210         else
10211                 exit(1);
10212 }
10213 EOCP
10214 set isascii
10215 if eval $compile; then
10216         echo "isascii() found." >&4
10217         val="$define"
10218 else
10219         echo "isascii() NOT found." >&4
10220         val="$undef"
10221 fi
10222 set d_isascii
10223 eval $setvar
10224 $rm -f isascii*
10225
10226 : see if isnan exists
10227 set isnan d_isnan
10228 eval $inlibc
10229
10230 : see if isnanl exists
10231 set isnanl d_isnanl
10232 eval $inlibc
10233
10234 : see if killpg exists
10235 set killpg d_killpg
10236 eval $inlibc
10237
10238 : see if lchown exists
10239 echo " "
10240 $cat > try.c <<'EOCP'
10241 /* System header to define __stub macros and hopefully few prototypes,
10242     which can conflict with char lchown(); below.  */
10243 #include <assert.h>
10244 /* Override any gcc2 internal prototype to avoid an error.  */
10245 /* We use char because int might match the return type of a gcc2
10246    builtin and then its argument prototype would still apply.  */
10247 char lchown();
10248 int main() {
10249     /*  The GNU C library defines this for functions which it implements
10250         to always fail with ENOSYS.  Some functions are actually named
10251         something starting with __ and the normal name is an alias.  */
10252 #if defined (__stub_lchown) || defined (__stub___lchown)
10253 choke me
10254 #else
10255 lchown();
10256 #endif
10257 ; return 0; }
10258 EOCP
10259 set try
10260 if eval $compile; then
10261     $echo "lchown() found." >&4
10262     val="$define"
10263 else
10264     $echo "lchown() NOT found." >&4
10265     val="$undef"
10266 fi
10267 set d_lchown
10268 eval $setvar
10269
10270 : See if number of significant digits in a double precision number is known
10271 echo " "
10272 $cat >ldbl_dig.c <<EOM
10273 #$i_limits I_LIMITS
10274 #$i_float I_FLOAT
10275 #ifdef I_LIMITS
10276 #include <limits.h>
10277 #endif
10278 #ifdef I_FLOAT
10279 #include <float.h>
10280 #endif
10281 #ifdef LDBL_DIG
10282 printf("Contains LDBL_DIG");
10283 #endif
10284 EOM
10285 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
10286 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
10287         echo "LDBL_DIG found." >&4
10288         val="$define"
10289 else
10290         echo "LDBL_DIG NOT found." >&4
10291         val="$undef"
10292 fi
10293 $rm -f ldbl_dig.?
10294 set d_ldbl_dig
10295 eval $setvar
10296
10297 : see if link exists
10298 set link d_link
10299 eval $inlibc
10300
10301 : see if localeconv exists
10302 set localeconv d_locconv
10303 eval $inlibc
10304
10305 : see if lockf exists
10306 set lockf d_lockf
10307 eval $inlibc
10308
10309 : see if prototype for lseek is available
10310 echo " "
10311 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
10312 eval $hasproto
10313
10314 : see if lstat exists
10315 set lstat d_lstat
10316 eval $inlibc
10317
10318 : see if madvise exists
10319 set madvise d_madvise
10320 eval $inlibc
10321
10322 : see if mblen exists
10323 set mblen d_mblen
10324 eval $inlibc
10325
10326 : see if mbstowcs exists
10327 set mbstowcs d_mbstowcs
10328 eval $inlibc
10329
10330 : see if mbtowc exists
10331 set mbtowc d_mbtowc
10332 eval $inlibc
10333
10334 : see if memchr exists
10335 set memchr d_memchr
10336 eval $inlibc
10337
10338 : see if memcmp exists
10339 set memcmp d_memcmp
10340 eval $inlibc
10341
10342 : see if memcpy exists
10343 set memcpy d_memcpy
10344 eval $inlibc
10345
10346 : see if memmove exists
10347 set memmove d_memmove
10348 eval $inlibc
10349
10350 : see if memset exists
10351 set memset d_memset
10352 eval $inlibc
10353
10354 : see if mkdir exists
10355 set mkdir d_mkdir
10356 eval $inlibc
10357
10358 : see if mkdtemp exists
10359 set mkdtemp d_mkdtemp
10360 eval $inlibc
10361
10362 : see if mkfifo exists
10363 set mkfifo d_mkfifo
10364 eval $inlibc
10365
10366 : see if mkstemp exists
10367 set mkstemp d_mkstemp
10368 eval $inlibc
10369
10370 : see if mkstemps exists
10371 set mkstemps d_mkstemps
10372 eval $inlibc
10373
10374 : see if mktime exists
10375 set mktime d_mktime
10376 eval $inlibc
10377
10378 : see if this is a sys/mman.h system
10379 set sys/mman.h i_sysmman
10380 eval $inhdr
10381
10382 : see if mmap exists
10383 set mmap d_mmap
10384 eval $inlibc
10385 : see what shmat returns
10386 : default to something harmless
10387 mmaptype='void *'
10388 case "$i_sysmman$d_mmap" in
10389 "$define$define")
10390         $cat >mmap.c <<'END'
10391 #include <sys/mman.h>
10392 void *mmap();
10393 END
10394         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
10395                 mmaptype='void *'
10396         else
10397                 mmaptype='caddr_t'
10398         fi
10399         echo "and it returns ($mmaptype)." >&4
10400         ;;
10401 esac
10402
10403
10404
10405 : see if modfl exists
10406 set modfl d_modfl
10407 eval $inlibc
10408
10409 : see if mprotect exists
10410 set mprotect d_mprotect
10411 eval $inlibc
10412
10413 : see if msgctl exists
10414 set msgctl d_msgctl
10415 eval $inlibc
10416
10417 : see if msgget exists
10418 set msgget d_msgget
10419 eval $inlibc
10420
10421 : see if msgsnd exists
10422 set msgsnd d_msgsnd
10423 eval $inlibc
10424
10425 : see if msgrcv exists
10426 set msgrcv d_msgrcv
10427 eval $inlibc
10428
10429 : see how much of the 'msg*(2)' library is present.
10430 h_msg=true
10431 echo " "
10432 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
10433 *"$undef"*) h_msg=false;;
10434 esac
10435 case "$osname" in
10436 freebsd)
10437     case "`ipcs 2>&1`" in
10438     "SVID messages"*"not configured"*)
10439         echo "Your $osname does not have the msg*(2) configured." >&4
10440         h_msg=false
10441         val="$undef"
10442         set msgctl d_msgctl
10443         eval $setvar
10444         set msgget d_msgget
10445         eval $setvar
10446         set msgsnd d_msgsnd
10447         eval $setvar
10448         set msgrcv d_msgrcv
10449         eval $setvar
10450         ;;
10451     esac
10452     ;;
10453 esac
10454 : we could also check for sys/ipc.h ...
10455 if $h_msg && $test `./findhdr sys/msg.h`; then
10456         echo "You have the full msg*(2) library." >&4
10457         val="$define"
10458 else
10459         echo "You don't have the full msg*(2) library." >&4
10460         val="$undef"
10461 fi
10462 set d_msg
10463 eval $setvar
10464
10465
10466 echo " "
10467 echo "Checking to see if your system supports struct msghdr..." >&4
10468 set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
10469 eval $hasstruct
10470 case "$d_msghdr_s" in
10471 "$define")      echo "Yes, it does."   ;;
10472 *)              echo "No, it doesn't." ;;
10473 esac
10474
10475
10476 : see if msync exists
10477 set msync d_msync
10478 eval $inlibc
10479
10480 : see if munmap exists
10481 set munmap d_munmap
10482 eval $inlibc
10483
10484 : see if nice exists
10485 set nice d_nice
10486 eval $inlibc
10487
10488 : check for length of character
10489 echo " "
10490 case "$charsize" in
10491 '')
10492         echo "Checking to see how big your characters are (hey, you never know)..." >&4
10493         $cat >try.c <<'EOCP'
10494 #include <stdio.h>
10495 int main()
10496 {
10497     printf("%d\n", (int)sizeof(char));
10498     exit(0);
10499 }
10500 EOCP
10501         set try
10502         if eval $compile_ok; then
10503                 dflt=`./try`
10504         else
10505                 dflt='1'
10506                 echo "(I can't seem to compile the test program.  Guessing...)"
10507         fi
10508         ;;
10509 *)
10510         dflt="$charsize"
10511         ;;
10512 esac
10513 rp="What is the size of a character (in bytes)?"
10514 . ./myread
10515 charsize="$ans"
10516 $rm -f try.c try
10517
10518 : check for volatile keyword
10519 echo " "
10520 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
10521 $cat >try.c <<'EOCP'
10522 int main()
10523 {
10524         typedef struct _goo_struct goo_struct;
10525         goo_struct * volatile goo = ((goo_struct *)0);
10526         struct _goo_struct {
10527                 long long_int;
10528                 int reg_int;
10529                 char char_var;
10530         };
10531         typedef unsigned short foo_t;
10532         char *volatile foo;
10533         volatile int bar;
10534         volatile foo_t blech;
10535         foo = foo;
10536 }
10537 EOCP
10538 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
10539         val="$define"
10540         echo "Yup, it does."
10541 else
10542         val="$undef"
10543         echo "Nope, it doesn't."
10544 fi
10545 set d_volatile
10546 eval $setvar
10547 $rm -f try.*
10548
10549
10550 echo " "
10551 $echo "Choosing the C types to be used for Perl's internal types..." >&4
10552
10553 case "$use64bitint:$d_quad:$quadtype" in
10554 define:define:?*)
10555         ivtype="$quadtype"
10556         uvtype="$uquadtype"
10557         ivsize=8
10558         uvsize=8
10559         ;;
10560 *)      ivtype="long"
10561         uvtype="unsigned long"
10562         ivsize=$longsize
10563         uvsize=$longsize
10564         ;;
10565 esac
10566
10567 case "$uselongdouble:$d_longdbl" in
10568 define:define)
10569         nvtype="long double"
10570         nvsize=$longdblsize
10571         ;;
10572 *)      nvtype=double
10573         nvsize=$doublesize
10574         ;;
10575 esac
10576
10577 $echo "(IV will be "$ivtype", $ivsize bytes)"
10578 $echo "(UV will be "$uvtype", $uvsize bytes)"
10579 $echo "(NV will be "$nvtype", $nvsize bytes)"
10580
10581 $cat >try.c <<EOCP
10582 #$i_inttypes I_INTTYPES
10583 #ifdef I_INTTYPES
10584 #include <inttypes.h>
10585 #endif
10586 #include <stdio.h>
10587 int main() {
10588 #ifdef INT8
10589    int8_t i =  INT8_MAX;
10590   uint8_t u = UINT8_MAX;
10591   printf("int8_t\n");
10592 #endif
10593 #ifdef INT16
10594    int16_t i =  INT16_MAX;
10595   uint16_t i = UINT16_MAX;
10596   printf("int16_t\n");
10597 #endif
10598 #ifdef INT32
10599    int32_t i =  INT32_MAX;
10600   uint32_t u = UINT32_MAX;
10601   printf("int32_t\n");
10602 #endif
10603 }
10604 EOCP
10605
10606 case "$i8type" in
10607 '')     case "$charsize" in
10608         1)      i8type=char
10609                 u8type="unsigned char"
10610                 i8size=$charsize
10611                 u8size=$charsize
10612                 ;;
10613         esac
10614         ;;
10615 esac
10616 case "$i8type" in
10617 '')     set try -DINT8
10618         if eval $compile; then
10619                 case "`./try$exe_ext`" in
10620                 int8_t) i8type=int8_t
10621                         u8type=uint8_t
10622                         i8size=1
10623                         u8size=1
10624                         ;;
10625                 esac
10626         fi
10627         ;;
10628 esac
10629 case "$i8type" in
10630 '')     if $test $charsize -ge 1; then
10631                 i8type=char
10632                 u8type="unsigned char"
10633                 i8size=$charsize
10634                 u8size=$charsize
10635         fi
10636         ;;
10637 esac
10638
10639 case "$i16type" in
10640 '')     case "$shortsize" in
10641         2)      i16type=short
10642                 u16type="unsigned short"
10643                 i16size=$shortsize
10644                 u16size=$shortsize
10645                 ;;
10646         esac
10647         ;;
10648 esac
10649 case "$i16type" in
10650 '')     set try -DINT16
10651         if eval $compile; then
10652                 case "`./try$exe_ext`" in
10653                 int16_t)
10654                         i16type=int16_t
10655                         u16type=uint16_t
10656                         i16size=2
10657                         u16size=2
10658                         ;;
10659                 esac
10660         fi
10661         ;;
10662 esac
10663 case "$i16type" in
10664 '')     if $test $shortsize -ge 2; then
10665                 i16type=short
10666                 u16type="unsigned short"
10667                 i16size=$shortsize
10668                 u16size=$shortsize
10669         fi
10670         ;;
10671 esac
10672
10673 case "$i32type" in
10674 '')     case "$longsize" in
10675         4)      i32type=long
10676                 u32type="unsigned long"
10677                 i32size=$longsize
10678                 u32size=$longsize
10679                 ;;
10680         *)      case "$intsize" in
10681                 4)      i32type=int
10682                         u32type="unsigned int"
10683                         i32size=$intsize
10684                         u32size=$intsize
10685                         ;;
10686                 esac
10687                 ;;
10688         esac
10689         ;;
10690 esac
10691 case "$i32type" in
10692 '')     set try -DINT32
10693         if eval $compile; then
10694                 case "`./try$exe_ext`" in
10695                 int32_t)
10696                         i32type=int32_t
10697                         u32type=uint32_t
10698                         i32size=4
10699                         u32size=4
10700                         ;;
10701                 esac
10702         fi
10703         ;;
10704 esac
10705 case "$i32type" in
10706 '')     if $test $intsize -ge 4; then
10707                 i32type=int
10708                 u32type="unsigned int"
10709                 i32size=$intsize
10710                 u32size=$intsize
10711         fi
10712         ;;
10713 esac
10714
10715 case "$i64type" in
10716 '')     case "$d_quad:$quadtype" in
10717         define:?*)
10718                 i64type="$quadtype"
10719                 u64type="$uquadtype"
10720                 i64size=8
10721                 u64size=8
10722                 ;;
10723         esac
10724         ;;
10725 esac
10726
10727 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
10728 : volatile so that the compiler has to store it out to memory.
10729 if test X"$d_volatile" = X"$define"; then
10730         volatile=volatile
10731 fi
10732 $cat <<EOP >try.c
10733 #include <stdio.h>
10734 #include <sys/types.h>
10735 #include <signal.h>
10736 #ifdef SIGFPE
10737 $volatile int bletched = 0;
10738 $signal_t blech(s) int s; { bletched = 1; }
10739 #endif
10740 int main() {
10741     $uvtype u = 0;
10742     $nvtype d;
10743     int     n = 8 * $uvsize;
10744     int     i;
10745 #ifdef SIGFPE
10746     signal(SIGFPE, blech);
10747 #endif
10748
10749     for (i = 0; i < n; i++) {
10750       u = u << 1 | ($uvtype)1;
10751       d = ($nvtype)u;
10752       if (($uvtype)d != u)
10753         break;
10754       if (d <= 0)
10755         break;
10756       d = ($nvtype)(u - 1);
10757       if (($uvtype)d != (u - 1))
10758         break;
10759 #ifdef SIGFPE
10760       if (bletched) {
10761         break;
10762 #endif
10763       } 
10764     }
10765     printf("%d\n", ((i == n) ? -n : i));
10766     exit(0);
10767 }
10768 EOP
10769 set try
10770
10771 d_nv_preserves_uv="$undef"
10772 if eval $compile; then
10773         d_nv_preserves_uv_bits="`./try$exe_ext`"
10774 fi
10775 case "$d_nv_preserves_uv_bits" in
10776 \-[1-9]*)       
10777         d_nv_preserves_uv_bits=`expr 0 - $d_nv_preserves_uv_bits`
10778         $echo "Your NVs can preserve all $d_nv_preserves_uv_bits bits of your UVs."  2>&1
10779         d_nv_preserves_uv="$define"
10780         ;;
10781 [1-9]*) $echo "Your NVs can preserve only $d_nv_preserves_uv_bits bits of your UVs."  2>&1
10782         d_nv_preserves_uv="$undef" ;;
10783 *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
10784         d_nv_preserves_uv_bits="$undef" ;;
10785 esac
10786
10787 $rm -f try.* try
10788
10789
10790 : check for off64_t
10791 echo " "
10792 echo "Checking to see if you have off64_t..." >&4
10793 $cat >try.c <<EOCP
10794 #include <sys/types.h>
10795 #include <unistd.h>
10796 int main() { off64_t x = 7; }
10797 EOCP
10798 set try
10799 if eval $compile; then
10800         val="$define"
10801         echo "You have off64_t."
10802 else
10803         val="$undef"
10804         echo "You do not have off64_t."
10805         case "$lseeksize" in
10806         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
10807         esac
10808 fi
10809 $rm -f try.* try
10810 set d_off64_t
10811 eval $setvar
10812
10813 : see if POSIX threads are available
10814 set pthread.h i_pthread
10815 eval $inhdr
10816
10817
10818
10819
10820 : how to create joinable pthreads
10821 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
10822         echo " "
10823         echo "Checking what constant to use for creating joinable pthreads..." >&4 
10824         $cat >try.c <<'EOCP'
10825 #include <pthread.h>
10826 int main() {
10827     int detachstate = JOINABLE;
10828 }
10829 EOCP
10830         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
10831         if eval $compile; then
10832                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
10833                 val="$undef" # Yes, undef.
10834                 set d_old_pthread_create_joinable
10835                 eval $setvar
10836                 val=""
10837                 set old_pthread_create_joinable
10838                 eval $setvar
10839         else
10840                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
10841                 if eval $compile; then
10842                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
10843                         val="$define"
10844                         set d_old_pthread_create_joinable
10845                         eval $setvar
10846                         val=PTHREAD_CREATE_UNDETACHED
10847                         set old_pthread_create_joinable
10848                         eval $setvar
10849                 else            
10850                         set try -DJOINABLE=__UNDETACHED
10851                         if eval $compile; then
10852                                 echo "You seem to use __UNDETACHED." >&4
10853                                 val="$define"
10854                                 set d_old_pthread_create_joinable
10855                                 eval $setvar
10856                                 val=__UNDETACHED
10857                                 set old_pthread_create_joinable
10858                                 eval $setvar
10859                         else
10860                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
10861                                 val="$define"
10862                                 set d_old_pthread_create_joinable
10863                                 eval $setvar
10864                                 val=0
10865                                 set old_pthread_create_joinable
10866                                 eval $setvar
10867                         fi
10868                 fi
10869         fi
10870         $rm -f try try.*
10871 else
10872     d_old_pthread_create_joinable="$undef"
10873     old_pthread_create_joinable=""
10874 fi
10875
10876 : see if pause exists
10877 set pause d_pause
10878 eval $inlibc
10879
10880 : see if pipe exists
10881 set pipe d_pipe
10882 eval $inlibc
10883
10884 : see if poll exists
10885 set poll d_poll
10886 eval $inlibc
10887
10888
10889 : see whether the various POSIXish _yields exist
10890 $cat >try.c <<EOP
10891 #include <pthread.h>
10892 #include <stdio.h>
10893 int main() {
10894 #ifdef SCHED_YIELD
10895         sched_yield();
10896 #else
10897 #ifdef PTHREAD_YIELD
10898         pthread_yield();
10899 #else
10900 #ifdef PTHREAD_YIELD_NULL
10901         pthread_yield(NULL);
10902 #endif
10903 #endif
10904 #endif
10905 }
10906 EOP
10907 : see if sched_yield exists
10908 set try -DSCHED_YIELD
10909 if eval $compile; then
10910     val="$define"
10911     sched_yield='sched_yield()'
10912 else
10913     val="$undef"
10914 fi
10915 case "$usethreads" in
10916 $define)
10917         case "$val" in
10918         $define) echo 'sched_yield() found.' >&4        ;;
10919         *)       echo 'sched_yield() NOT found.' >&4    ;;
10920         esac
10921 esac
10922 set d_sched_yield
10923 eval $setvar
10924
10925 : see if pthread_yield exists
10926 set try -DPTHREAD_YIELD
10927 if eval $compile; then
10928     val="$define"
10929     case "$sched_yield" in
10930     '') sched_yield='pthread_yield()' ;;
10931     esac
10932 else
10933     set try -DPTHREAD_YIELD_NULL
10934     if eval $compile; then
10935         val="$define"
10936         case "$sched_yield" in
10937         '') sched_yield='pthread_yield(NULL)' ;;
10938         esac
10939     else
10940         val="$undef"
10941     fi
10942 fi
10943 case "$usethreads" in
10944 $define)
10945         case "$val" in
10946         $define) echo 'pthread_yield() found.' >&4      ;;
10947         *)       echo 'pthread_yield() NOT found.' >&4  ;;
10948         esac
10949         ;;
10950 esac
10951 set d_pthread_yield
10952 eval $setvar
10953
10954 case "$sched_yield" in
10955 '') sched_yield=undef ;;
10956 esac
10957
10958 $rm -f try try.*
10959
10960 : see if this is a pwd.h system
10961 set pwd.h i_pwd
10962 eval $inhdr
10963
10964 case "$i_pwd" in
10965 $define)
10966         xxx=`./findhdr pwd.h`
10967         $cppstdin $cppflags $cppminus < $xxx >$$.h
10968
10969         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
10970                 val="$define"
10971         else
10972                 val="$undef"
10973         fi
10974         set d_pwquota
10975         eval $setvar
10976
10977         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
10978                 val="$define"
10979         else
10980                 val="$undef"
10981         fi
10982         set d_pwage
10983         eval $setvar
10984
10985         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
10986                 val="$define"
10987         else
10988                 val="$undef"
10989         fi
10990         set d_pwchange
10991         eval $setvar
10992
10993         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
10994                 val="$define"
10995         else
10996                 val="$undef"
10997         fi
10998         set d_pwclass
10999         eval $setvar
11000
11001         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
11002                 val="$define"
11003         else
11004                 val="$undef"
11005         fi
11006         set d_pwexpire
11007         eval $setvar
11008
11009         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
11010                 val="$define"
11011         else
11012                 val="$undef"
11013         fi
11014         set d_pwcomment
11015         eval $setvar
11016
11017         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
11018                 val="$define"
11019         else
11020                 val="$undef"
11021         fi
11022         set d_pwgecos
11023         eval $setvar
11024
11025         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
11026                 val="$define"
11027         else
11028                 val="$undef"
11029         fi
11030         set d_pwpasswd
11031         eval $setvar
11032
11033         $rm -f $$.h
11034         ;;
11035 *)
11036         val="$undef"; 
11037         set d_pwquota; eval $setvar
11038         set d_pwage; eval $setvar
11039         set d_pwchange; eval $setvar
11040         set d_pwclass; eval $setvar
11041         set d_pwexpire; eval $setvar
11042         set d_pwcomment; eval $setvar
11043         set d_pwgecos; eval $setvar
11044         set d_pwpasswd; eval $setvar
11045         ;;
11046 esac
11047
11048 : see if readdir and friends exist
11049 set readdir d_readdir
11050 eval $inlibc
11051 set seekdir d_seekdir
11052 eval $inlibc
11053 set telldir d_telldir
11054 eval $inlibc
11055 set rewinddir d_rewinddir
11056 eval $inlibc
11057
11058 : see if readlink exists
11059 set readlink d_readlink
11060 eval $inlibc
11061
11062 : see if readv exists
11063 set readv d_readv
11064 eval $inlibc
11065
11066 : see if realpath exists
11067 set realpath d_realpath
11068 eval $inlibc
11069
11070 : see if recvmsg exists
11071 set recvmsg d_recvmsg
11072 eval $inlibc
11073
11074 : see if rename exists
11075 set rename d_rename
11076 eval $inlibc
11077
11078 : see if rmdir exists
11079 set rmdir d_rmdir
11080 eval $inlibc
11081
11082 : see if memory.h is available.
11083 val=''
11084 set memory.h val
11085 eval $inhdr
11086
11087 : See if it conflicts with string.h
11088 case "$val" in
11089 $define)
11090         case "$strings" in
11091         '') ;;
11092         *)
11093                 $cppstdin $cppflags $cppminus < $strings > mem.h
11094                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
11095                         echo " "
11096                         echo "We won't be including <memory.h>."
11097                         val="$undef"
11098                 fi
11099                 $rm -f mem.h
11100                 ;;
11101         esac
11102 esac
11103 set i_memory
11104 eval $setvar
11105
11106 : can bcopy handle overlapping blocks?
11107 val="$undef"
11108 case "$d_bcopy" in
11109 "$define")
11110         echo " "
11111         echo "Checking to see if your bcopy() can do overlapping copies..." >&4
11112         $cat >try.c <<EOCP
11113 #$i_memory I_MEMORY
11114 #$i_stdlib I_STDLIB
11115 #$i_string I_STRING
11116 #$i_unistd I_UNISTD
11117 EOCP
11118         $cat >>try.c <<'EOCP'
11119 #include <stdio.h>
11120 #ifdef I_MEMORY
11121 #  include <memory.h>
11122 #endif
11123 #ifdef I_STDLIB
11124 #  include <stdlib.h>
11125 #endif
11126 #ifdef I_STRING
11127 #  include <string.h>
11128 #else
11129 #  include <strings.h>
11130 #endif
11131 #ifdef I_UNISTD
11132 #  include <unistd.h>  /* Needed for NetBSD */
11133 #endif
11134 int main()
11135 {
11136 char buf[128], abc[128];
11137 char *b;
11138 int len;
11139 int off;
11140 int align;
11141
11142 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
11143
11144 for (align = 7; align >= 0; align--) {
11145         for (len = 36; len; len--) {
11146                 b = buf+align;
11147                 bcopy(abc, b, len);
11148                 for (off = 1; off <= len; off++) {
11149                         bcopy(b, b+off, len);
11150                         bcopy(b+off, b, len);
11151                         if (bcmp(b, abc, len))
11152                                 exit(1);
11153                 }
11154         }
11155 }
11156 exit(0);
11157 }
11158 EOCP
11159         set try
11160         if eval $compile_ok; then
11161                 if ./try 2>/dev/null; then
11162                         echo "Yes, it can."
11163                         val="$define"
11164                 else
11165                         echo "It can't, sorry."
11166                         case "$d_memmove" in
11167                         "$define") echo "But that's Ok since you have memmove()." ;;
11168                         esac
11169                 fi
11170         else
11171                 echo "(I can't compile the test program, so we'll assume not...)"
11172                 case "$d_memmove" in
11173                 "$define") echo "But that's Ok since you have memmove()." ;;
11174                 esac
11175         fi
11176         ;;
11177 esac
11178 $rm -f try.* try core
11179 set d_safebcpy
11180 eval $setvar
11181
11182 : can memcpy handle overlapping blocks?
11183 val="$undef"
11184 case "$d_memcpy" in
11185 "$define")
11186         echo " "
11187         echo "Checking to see if your memcpy() can do overlapping copies..." >&4
11188         $cat >try.c <<EOCP
11189 #$i_memory I_MEMORY
11190 #$i_stdlib I_STDLIB
11191 #$i_string I_STRING
11192 #$i_unistd I_UNISTD
11193 EOCP
11194         $cat >>try.c <<'EOCP'
11195 #include <stdio.h>
11196 #ifdef I_MEMORY
11197 #  include <memory.h>
11198 #endif
11199 #ifdef I_STDLIB
11200 #  include <stdlib.h>
11201 #endif
11202 #ifdef I_STRING
11203 #  include <string.h>
11204 #else
11205 #  include <strings.h>
11206 #endif
11207 #ifdef I_UNISTD
11208 #  include <unistd.h>  /* Needed for NetBSD */
11209 #endif
11210 int main()
11211 {
11212 char buf[128], abc[128];
11213 char *b;
11214 int len;
11215 int off;
11216 int align;
11217
11218 /* Copy "abcde..." string to char abc[] so that gcc doesn't
11219    try to store the string in read-only memory. */
11220 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
11221
11222 for (align = 7; align >= 0; align--) {
11223         for (len = 36; len; len--) {
11224                 b = buf+align;
11225                 memcpy(b, abc, len);
11226                 for (off = 1; off <= len; off++) {
11227                         memcpy(b+off, b, len);
11228                         memcpy(b, b+off, len);
11229                         if (memcmp(b, abc, len))
11230                                 exit(1);
11231                 }
11232         }
11233 }
11234 exit(0);
11235 }
11236 EOCP
11237         set try
11238         if eval $compile_ok; then
11239                 if ./try 2>/dev/null; then
11240                         echo "Yes, it can."
11241                         val="$define"
11242                 else
11243                         echo "It can't, sorry."
11244                         case "$d_memmove" in
11245                         "$define") echo "But that's Ok since you have memmove()." ;;
11246                         esac
11247                 fi
11248         else
11249                 echo "(I can't compile the test program, so we'll assume not...)"
11250                 case "$d_memmove" in
11251                 "$define") echo "But that's Ok since you have memmove()." ;;
11252                 esac
11253         fi
11254         ;;
11255 esac
11256 $rm -f try.* try core
11257 set d_safemcpy
11258 eval $setvar
11259
11260 : can memcmp be trusted to compare relative magnitude?
11261 val="$undef"
11262 case "$d_memcmp" in
11263 "$define")
11264         echo " "
11265         echo "Checking if your memcmp() can compare relative magnitude..." >&4
11266         $cat >try.c <<EOCP
11267 #$i_memory I_MEMORY
11268 #$i_stdlib I_STDLIB
11269 #$i_string I_STRING
11270 #$i_unistd I_UNISTD
11271 EOCP
11272         $cat >>try.c <<'EOCP'
11273 #include <stdio.h>
11274 #ifdef I_MEMORY
11275 #  include <memory.h>
11276 #endif
11277 #ifdef I_STDLIB
11278 #  include <stdlib.h>
11279 #endif
11280 #ifdef I_STRING
11281 #  include <string.h>
11282 #else
11283 #  include <strings.h>
11284 #endif
11285 #ifdef I_UNISTD
11286 #  include <unistd.h>  /* Needed for NetBSD */
11287 #endif
11288 int main()
11289 {
11290 char a = -1;
11291 char b = 0;
11292 if ((a < b) && memcmp(&a, &b, 1) < 0)
11293         exit(1);
11294 exit(0);
11295 }
11296 EOCP
11297         set try
11298         if eval $compile_ok; then
11299                 if ./try 2>/dev/null; then
11300                         echo "Yes, it can."
11301                         val="$define"
11302                 else
11303                         echo "No, it can't (it uses signed chars)."
11304                 fi
11305         else
11306                 echo "(I can't compile the test program, so we'll assume not...)"
11307         fi
11308         ;;
11309 esac
11310 $rm -f try.* try core
11311 set d_sanemcmp
11312 eval $setvar
11313
11314 : see if prototype for sbrk is available
11315 echo " "
11316 set d_sbrkproto sbrk $i_unistd unistd.h
11317 eval $hasproto
11318
11319 : see if select exists
11320 set select d_select
11321 eval $inlibc
11322
11323 : see if semctl exists
11324 set semctl d_semctl
11325 eval $inlibc
11326
11327 : see if semget exists
11328 set semget d_semget
11329 eval $inlibc
11330
11331 : see if semop exists
11332 set semop d_semop
11333 eval $inlibc
11334
11335 : see how much of the 'sem*(2)' library is present.
11336 h_sem=true
11337 echo " "
11338 case "$d_semctl$d_semget$d_semop" in
11339 *"$undef"*) h_sem=false;;
11340 esac
11341 case "$osname" in
11342 freebsd)
11343     case "`ipcs 2>&1`" in
11344     "SVID messages"*"not configured"*)
11345         echo "Your $osname does not have the sem*(2) configured." >&4
11346         h_sem=false
11347         val="$undef"
11348         set semctl d_semctl
11349         eval $setvar
11350         set semget d_semget
11351         eval $setvar
11352         set semop d_semop
11353         eval $setvar
11354         ;;
11355     esac
11356     ;;
11357 esac
11358 : we could also check for sys/ipc.h ...
11359 if $h_sem && $test `./findhdr sys/sem.h`; then
11360         echo "You have the full sem*(2) library." >&4
11361         val="$define"
11362 else
11363         echo "You don't have the full sem*(2) library." >&4
11364         val="$undef"
11365 fi
11366 set d_sem
11367 eval $setvar
11368
11369 : see whether sys/sem.h defines union semun
11370 echo " "
11371 $cat > try.c <<'END'
11372 #include <sys/types.h>
11373 #include <sys/ipc.h>
11374 #include <sys/sem.h>
11375 int main () { union semun semun; semun.buf = 0; }
11376 END
11377 set try
11378 if eval $compile; then
11379     echo "You have union semun in <sys/sem.h>." >&4
11380     val="$define"
11381 else
11382     echo "You do not have union semun in <sys/sem.h>." >&4
11383     val="$undef"
11384 fi
11385 $rm -f try try.c try.h
11386 set d_union_semun
11387 eval $setvar
11388
11389 : see how to do semctl IPC_STAT
11390 case "$d_sem" in
11391 $define)
11392     : see whether semctl IPC_STAT can use union semun
11393     echo " "
11394     $cat > try.h <<END
11395 #ifndef S_IRUSR
11396 #   ifdef S_IREAD
11397 #       define S_IRUSR S_IREAD
11398 #       define S_IWUSR S_IWRITE
11399 #       define S_IXUSR S_IEXEC
11400 #   else
11401 #       define S_IRUSR 0400
11402 #       define S_IWUSR 0200
11403 #       define S_IXUSR 0100
11404 #   endif
11405 #   define S_IRGRP (S_IRUSR>>3)
11406 #   define S_IWGRP (S_IWUSR>>3)
11407 #   define S_IXGRP (S_IXUSR>>3)
11408 #   define S_IROTH (S_IRUSR>>6)
11409 #   define S_IWOTH (S_IWUSR>>6)
11410 #   define S_IXOTH (S_IXUSR>>6)
11411 #endif
11412 #ifndef S_IRWXU
11413 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
11414 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
11415 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
11416 #endif
11417 END
11418
11419     $cat > try.c <<END
11420 #include <sys/types.h>
11421 #include <sys/ipc.h>
11422 #include <sys/sem.h>
11423 #include <sys/stat.h>
11424 #include <stdio.h>
11425 #include <errno.h>
11426 #include "try.h"
11427 #ifndef errno
11428 extern int errno;
11429 #endif
11430 #$d_union_semun HAS_UNION_SEMUN
11431 int main() {
11432     union semun
11433 #ifndef HAS_UNION_SEMUN
11434     {
11435         int val;
11436         struct semid_ds *buf;
11437         unsigned short *array;
11438     }
11439 #endif
11440     arg;
11441     int sem, st;
11442
11443 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
11444     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
11445     if (sem > -1) {
11446         struct semid_ds argbuf;
11447         arg.buf = &argbuf;
11448 #       ifdef IPC_STAT
11449         st = semctl(sem, 0, IPC_STAT, arg);
11450         if (st == 0)
11451             printf("semun\n");
11452         else
11453 #       endif /* IPC_STAT */
11454             printf("semctl IPC_STAT failed: errno = %d\n", errno);
11455 #       ifdef IPC_RMID
11456         if (semctl(sem, 0, IPC_RMID, arg) != 0)
11457 #       endif /* IPC_RMID */
11458             printf("semctl IPC_RMID failed: errno = %d\n", errno);
11459     } else
11460 #endif /* IPC_PRIVATE && ... */
11461         printf("semget failed: errno = %d\n", errno);
11462   return 0;
11463 }
11464 END
11465     val="$undef"
11466     set try
11467     if eval $compile; then
11468         xxx=`./try`
11469         case "$xxx" in
11470         semun) val="$define" ;;
11471         esac
11472     fi
11473     $rm -f try try.c
11474     set d_semctl_semun
11475     eval $setvar
11476     case "$d_semctl_semun" in
11477     $define)
11478         echo "You can use union semun for semctl IPC_STAT." >&4
11479         also='also'
11480         ;;
11481     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
11482         also=''
11483         ;;
11484     esac
11485
11486     : see whether semctl IPC_STAT can use struct semid_ds pointer
11487     $cat > try.c <<'END'
11488 #include <sys/types.h>
11489 #include <sys/ipc.h>
11490 #include <sys/sem.h>
11491 #include <sys/stat.h>
11492 #include "try.h"
11493 #include <stdio.h>
11494 #include <errno.h>
11495 #ifndef errno
11496 extern int errno;
11497 #endif
11498 int main() {
11499     struct semid_ds arg;
11500     int sem, st;
11501
11502 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
11503     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
11504     if (sem > -1) {
11505 #       ifdef IPC_STAT
11506         st = semctl(sem, 0, IPC_STAT, &arg);
11507         if (st == 0)
11508             printf("semid_ds\n");
11509         else
11510 #       endif /* IPC_STAT */
11511             printf("semctl IPC_STAT failed: errno = %d\n", errno);
11512 #       ifdef IPC_RMID
11513         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
11514 #       endif /* IPC_RMID */
11515             printf("semctl IPC_RMID failed: errno = %d\n", errno);
11516     } else
11517 #endif /* IPC_PRIVATE && ... */
11518         printf("semget failed: errno = %d\n", errno);
11519
11520     return 0;
11521 }
11522 END
11523     val="$undef"
11524     set try
11525     if eval $compile; then
11526         xxx=`./try`
11527         case "$xxx" in
11528         semid_ds) val="$define" ;;
11529         esac
11530     fi
11531     $rm -f try try.c
11532     set d_semctl_semid_ds
11533     eval $setvar
11534     case "$d_semctl_semid_ds" in
11535     $define)
11536         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
11537         ;;
11538     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
11539         ;;
11540     esac
11541     $rm -f try.h
11542     ;;
11543 *)  val="$undef"
11544
11545     # We do not have the full sem*(2) library, so assume we can not
11546     # use either.
11547
11548     set d_semctl_semun
11549     eval $setvar
11550
11551     set d_semctl_semid_ds
11552     eval $setvar
11553     ;;
11554 esac
11555
11556 : see if sendmsg exists
11557 set sendmsg d_sendmsg
11558 eval $inlibc
11559
11560 : see if setegid exists
11561 set setegid d_setegid
11562 eval $inlibc
11563
11564 : see if seteuid exists
11565 set seteuid d_seteuid
11566 eval $inlibc
11567
11568 : see if setgrent exists
11569 set setgrent d_setgrent
11570 eval $inlibc
11571
11572 : see if sethostent exists
11573 set sethostent d_sethent
11574 eval $inlibc
11575
11576 : see if setitimer exists
11577 set setitimer d_setitimer
11578 eval $inlibc
11579
11580 : see if setlinebuf exists
11581 set setlinebuf d_setlinebuf
11582 eval $inlibc
11583
11584 : see if setlocale exists
11585 set setlocale d_setlocale
11586 eval $inlibc
11587
11588 : see if setnetent exists
11589 set setnetent d_setnent
11590 eval $inlibc
11591
11592 : see if setprotoent exists
11593 set setprotoent d_setpent
11594 eval $inlibc
11595
11596 : see if setpgid exists
11597 set setpgid d_setpgid
11598 eval $inlibc
11599
11600 : see if setpgrp2 exists
11601 set setpgrp2 d_setpgrp2
11602 eval $inlibc
11603
11604 : see if setpriority exists
11605 set setpriority d_setprior
11606 eval $inlibc
11607
11608 : see if setproctitle exists
11609 set setproctitle d_setproctitle
11610 eval $inlibc
11611
11612 : see if setpwent exists
11613 set setpwent d_setpwent
11614 eval $inlibc
11615
11616 : see if setregid exists
11617 set setregid d_setregid
11618 eval $inlibc
11619 set setresgid d_setresgid
11620 eval $inlibc
11621
11622 : see if setreuid exists
11623 set setreuid d_setreuid
11624 eval $inlibc
11625 set setresuid d_setresuid
11626 eval $inlibc
11627
11628 : see if setrgid exists
11629 set setrgid d_setrgid
11630 eval $inlibc
11631
11632 : see if setruid exists
11633 set setruid d_setruid
11634 eval $inlibc
11635
11636 : see if setservent exists
11637 set setservent d_setsent
11638 eval $inlibc
11639
11640 : see if setsid exists
11641 set setsid d_setsid
11642 eval $inlibc
11643
11644 : see if setvbuf exists
11645 set setvbuf d_setvbuf
11646 eval $inlibc
11647
11648 : see if sfio.h is available
11649 set sfio.h i_sfio
11650 eval $inhdr
11651
11652
11653 : see if sfio library is available
11654 case "$i_sfio" in
11655 $define)
11656         val=''
11657         set sfreserve val
11658         eval $inlibc
11659         ;;
11660 *)
11661         val="$undef"
11662         ;;
11663 esac
11664 : Ok, but do we want to use it.
11665 case "$val" in
11666 $define)
11667         case "$usesfio" in
11668         true|$define|[yY]*) dflt='y';;
11669         *) dflt='n';;
11670         esac
11671         echo "$package can use the sfio library, but it is experimental."
11672         case "$useperlio" in
11673         "$undef")
11674             echo "For sfio also the PerlIO abstraction layer is needed."
11675             echo "Earlier you said you wouldn't want that."
11676             ;;
11677         esac
11678         rp="You seem to have sfio available, do you want to try using it?"
11679         . ./myread
11680         case "$ans" in
11681         y|Y)    echo "Ok, turning on both sfio and PerlIO, then."
11682                 useperlio="$define"
11683                 val="$define"
11684                 ;;
11685         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
11686                 val="$undef"
11687                 ;;
11688         esac
11689         ;;
11690 *)      case "$usesfio" in
11691         true|$define|[yY]*)
11692                 echo "Sorry, cannot find sfio on this machine." >&4
11693                 echo "Ignoring your setting of usesfio=$usesfio." >&4
11694                 val="$undef"
11695                 ;;
11696         esac
11697         ;;
11698 esac
11699 set d_sfio
11700 eval $setvar
11701 case "$d_sfio" in
11702 $define) usesfio='true';;
11703 *) usesfio='false';;
11704 esac
11705 case "$d_sfio" in
11706 $define) ;;
11707 *)      : Remove sfio from list of libraries to use
11708         set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
11709         shift
11710         libs="$*"
11711         echo "libs = $libs" >&4
11712 ;;
11713 esac
11714
11715
11716 : see if shmctl exists
11717 set shmctl d_shmctl
11718 eval $inlibc
11719
11720 : see if shmget exists
11721 set shmget d_shmget
11722 eval $inlibc
11723
11724 : see if shmat exists
11725 set shmat d_shmat
11726 eval $inlibc
11727 : see what shmat returns
11728 case "$d_shmat" in
11729 "$define")
11730         $cat >shmat.c <<'END'
11731 #include <sys/shm.h>
11732 void *shmat();
11733 END
11734         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
11735                 shmattype='void *'
11736         else
11737                 shmattype='char *'
11738         fi
11739         echo "and it returns ($shmattype)." >&4
11740         : see if a prototype for shmat is available
11741         xxx=`./findhdr sys/shm.h`
11742         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
11743         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
11744                 val="$define"
11745         else
11746                 val="$undef"
11747         fi
11748         $rm -f shmat.[co]
11749         ;;
11750 *)
11751         val="$undef"
11752         ;;
11753 esac
11754 set d_shmatprototype
11755 eval $setvar
11756
11757 : see if shmdt exists
11758 set shmdt d_shmdt
11759 eval $inlibc
11760
11761 : see how much of the 'shm*(2)' library is present.
11762 h_shm=true
11763 echo " "
11764 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
11765 *"$undef"*) h_shm=false;;
11766 esac
11767 case "$osname" in
11768 freebsd)
11769     case "`ipcs 2>&1`" in
11770     "SVID shared memory"*"not configured"*)
11771         echo "Your $osname does not have the shm*(2) configured." >&4
11772         h_shm=false
11773         val="$undef"
11774         set shmctl d_shmctl
11775         evat $setvar
11776         set shmget d_shmget
11777         evat $setvar
11778         set shmat d_shmat
11779         evat $setvar
11780         set shmdt d_shmdt
11781         evat $setvar
11782         ;;
11783     esac
11784     ;;
11785 esac
11786 : we could also check for sys/ipc.h ...
11787 if $h_shm && $test `./findhdr sys/shm.h`; then
11788         echo "You have the full shm*(2) library." >&4
11789         val="$define"
11790 else
11791         echo "You don't have the full shm*(2) library." >&4
11792         val="$undef"
11793 fi
11794 set d_shm
11795 eval $setvar
11796
11797 echo " "
11798 : see if we have sigaction
11799 if set sigaction val -f d_sigaction; eval $csym; $val; then
11800         echo 'sigaction() found.' >&4
11801         $cat > try.c <<'EOP'
11802 #include <stdio.h>
11803 #include <sys/types.h>
11804 #include <signal.h>
11805 int main()
11806 {
11807     struct sigaction act, oact;
11808     act.sa_flags = 0;
11809     oact.sa_handler = 0;
11810     /* so that act and oact are used */
11811     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
11812 }
11813 EOP
11814         set try
11815         if eval $compile_ok; then
11816                 val="$define"
11817         else
11818                 echo "But you don't seem to have a useable struct sigaction." >&4
11819                 val="$undef"
11820         fi
11821 else
11822         echo 'sigaction NOT found.' >&4
11823         val="$undef"
11824 fi
11825 set d_sigaction; eval $setvar
11826 $rm -f try try$_o try.c
11827
11828 : see if sigprocmask exists
11829 set sigprocmask d_sigprocmask
11830 eval $inlibc
11831
11832 : see if sigsetjmp exists
11833 echo " "
11834 case "$d_sigsetjmp" in
11835 '')
11836         $cat >try.c <<'EOP'
11837 #include <setjmp.h>
11838 sigjmp_buf env;
11839 int set = 1;
11840 int main()
11841 {
11842         if (sigsetjmp(env,1))
11843                 exit(set);
11844         set = 0;
11845         siglongjmp(env, 1);
11846         exit(1);
11847 }
11848 EOP
11849         set try
11850         if eval $compile; then
11851                 if ./try >/dev/null 2>&1; then
11852                         echo "POSIX sigsetjmp found." >&4
11853                         val="$define"
11854                 else
11855                         $cat >&4 <<EOM
11856 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
11857 I'll ignore them.
11858 EOM
11859                         val="$undef"
11860                 fi
11861         else
11862                 echo "sigsetjmp not found." >&4
11863                 val="$undef"
11864         fi
11865         ;;
11866 *) val="$d_sigsetjmp"
11867         case "$d_sigsetjmp" in
11868         $define) echo "POSIX sigsetjmp found." >&4;;
11869         $undef) echo "sigsetjmp not found." >&4;;
11870         esac
11871         ;;
11872 esac
11873 set d_sigsetjmp
11874 eval $setvar
11875 $rm -f try.c try
11876
11877 : see if sockatmark exists
11878 set sockatmark d_sockatmark
11879 eval $inlibc
11880
11881 : see if socks5_init exists
11882 set socks5_init d_socks5_init
11883 eval $inlibc
11884
11885 : see if prototype for setresuid is available
11886 echo " "
11887 set d_sresuproto setresuid $i_unistd unistd.h
11888 eval $hasproto
11889
11890 : see if sys/stat.h is available
11891 set sys/stat.h i_sysstat
11892 eval $inhdr
11893
11894
11895 : see if stat knows about block sizes
11896 echo " "
11897 echo "Checking to see if your struct stat has st_blocks field..." >&4
11898 set d_statblks stat st_blocks $i_sysstat sys/stat.h
11899 eval $hasfield
11900
11901
11902 : see if this is a sys/vfs.h system
11903 set sys/vfs.h i_sysvfs
11904 eval $inhdr
11905
11906
11907 : see if this is a sys/statfs.h system
11908 set sys/statfs.h i_sysstatfs
11909 eval $inhdr
11910
11911
11912 echo " "
11913 echo "Checking to see if your system supports struct statfs..." >&4
11914 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
11915 eval $hasstruct
11916 case "$d_statfs_s" in
11917 "$define")      echo "Yes, it does."   ;;
11918 *)              echo "No, it doesn't." ;;
11919 esac
11920
11921
11922
11923 : see if struct statfs knows about f_flags
11924 case "$d_statfs_s" in
11925 define) 
11926         echo " "
11927         echo "Checking to see if your struct statfs has f_flags field..." >&4
11928         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
11929         eval $hasfield
11930         ;;
11931 *)      val="$undef"
11932         set d_statfs_f_flags
11933         eval $setvar
11934         ;;
11935 esac
11936 case "$d_statfs_f_flags" in
11937 "$define")      echo "Yes, it does."   ;;
11938 *)              echo "No, it doesn't." ;;
11939 esac
11940
11941 : see if _ptr and _cnt from stdio act std
11942 echo " "
11943
11944 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
11945         echo "(Looks like you have stdio.h from BSD.)"
11946         case "$stdio_ptr" in
11947         '') stdio_ptr='((fp)->_p)'
11948                 ptr_lval=$define
11949                 ;;
11950         *)      ptr_lval=$d_stdio_ptr_lval;;
11951         esac
11952         case "$stdio_cnt" in
11953         '') stdio_cnt='((fp)->_r)'
11954                 cnt_lval=$define
11955                 ;;
11956         *)      cnt_lval=$d_stdio_cnt_lval;;
11957         esac
11958         case "$stdio_base" in
11959         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
11960         esac
11961         case "$stdio_bufsiz" in
11962         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
11963         esac
11964 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
11965         echo "(Looks like you have stdio.h from Linux.)"
11966         case "$stdio_ptr" in
11967         '') stdio_ptr='((fp)->_IO_read_ptr)'
11968                 ptr_lval=$define
11969                 ;;
11970         *)      ptr_lval=$d_stdio_ptr_lval;;
11971         esac
11972         case "$stdio_cnt" in
11973         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
11974                 cnt_lval=$undef
11975                 ;;
11976         *)      cnt_lval=$d_stdio_cnt_lval;;
11977         esac
11978         case "$stdio_base" in
11979         '') stdio_base='((fp)->_IO_read_base)';;
11980         esac
11981         case "$stdio_bufsiz" in
11982         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
11983         esac
11984 else
11985         case "$stdio_ptr" in
11986         '') stdio_ptr='((fp)->_ptr)'
11987                 ptr_lval=$define
11988                 ;;
11989         *)      ptr_lval=$d_stdio_ptr_lval;;
11990         esac
11991         case "$stdio_cnt" in
11992         '') stdio_cnt='((fp)->_cnt)'
11993                 cnt_lval=$define
11994                 ;;
11995         *)      cnt_lval=$d_stdio_cnt_lval;;
11996         esac
11997         case "$stdio_base" in
11998         '') stdio_base='((fp)->_base)';;
11999         esac
12000         case "$stdio_bufsiz" in
12001         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
12002         esac
12003 fi
12004
12005 : test whether _ptr and _cnt really work
12006 echo "Checking how std your stdio is..." >&4
12007 $cat >try.c <<EOP
12008 #include <stdio.h>
12009 #define FILE_ptr(fp)    $stdio_ptr
12010 #define FILE_cnt(fp)    $stdio_cnt
12011 int main() {
12012         FILE *fp = fopen("try.c", "r");
12013         char c = getc(fp);
12014         if (
12015                 18 <= FILE_cnt(fp) &&
12016                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12017         )
12018                 exit(0);
12019         exit(1);
12020 }
12021 EOP
12022 val="$undef"
12023 set try
12024 if eval $compile; then
12025         if ./try; then
12026                 echo "Your stdio acts pretty std."
12027                 val="$define"
12028         else
12029                 echo "Your stdio isn't very std."
12030         fi
12031 else
12032         echo "Your stdio doesn't appear very std."
12033 fi
12034 $rm -f try.c try
12035 set d_stdstdio
12036 eval $setvar
12037
12038 : Can _ptr be used as an lvalue?
12039 case "$d_stdstdio$ptr_lval" in
12040 $define$define) val=$define ;;
12041 *) val=$undef ;;
12042 esac
12043 set d_stdio_ptr_lval
12044 eval $setvar
12045
12046 : Can _cnt be used as an lvalue?
12047 case "$d_stdstdio$cnt_lval" in
12048 $define$define) val=$define ;;
12049 *) val=$undef ;;
12050 esac
12051 set d_stdio_cnt_lval
12052 eval $setvar
12053
12054
12055 : test whether setting _ptr sets _cnt as a side effect
12056 d_stdio_ptr_lval_sets_cnt="$undef"
12057 d_stdio_ptr_lval_nochange_cnt="$undef"
12058 case "$d_stdio_ptr_lval$d_stdstdio" in
12059 $define$define)
12060         echo "Checking to see what happens if we set the stdio ptr..." >&4
12061 $cat >try.c <<EOP
12062 #include <stdio.h>
12063 /* Can we scream? */
12064 /* Eat dust sed :-) */
12065 /* In the buffer space, no one can hear you scream. */
12066 #define FILE_ptr(fp)    $stdio_ptr
12067 #define FILE_cnt(fp)    $stdio_cnt
12068 #include <sys/types.h>
12069 int main() {
12070         FILE *fp = fopen("try.c", "r");
12071         int c;
12072         char *ptr;
12073         size_t cnt;
12074         if (!fp) {
12075             puts("Fail even to read");
12076             exit(1);
12077         }
12078         c = getc(fp); /* Read away the first # */
12079         if (c == EOF) {
12080             puts("Fail even to read");
12081             exit(1);
12082         }
12083         if (!(
12084                 18 <= FILE_cnt(fp) &&
12085                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12086         )) {
12087                 puts("Fail even to read");
12088                 exit (1);
12089         }
12090         ptr = (char*) FILE_ptr(fp);
12091         cnt = (size_t)FILE_cnt(fp);
12092
12093         FILE_ptr(fp) += 42;
12094
12095         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
12096                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
12097                 exit (1);
12098         }
12099         if (FILE_cnt(fp) <= 20) {
12100                 printf ("Fail (<20 chars to test)");
12101                 exit (1);
12102         }
12103         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
12104                 puts("Fail compare");
12105                 exit (1);
12106         }
12107         if (cnt == FILE_cnt(fp)) {
12108                 puts("Pass_unchanged");
12109                 exit (0);
12110         }       
12111         if (FILE_cnt(fp) == (cnt - 42)) {
12112                 puts("Pass_changed");
12113                 exit (0);
12114         }
12115         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
12116         return 1;
12117
12118 }
12119 EOP
12120         set try
12121         if eval $compile; then
12122                 case `./try$exe_ext` in
12123                 Pass_changed)
12124                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
12125                         d_stdio_ptr_lval_sets_cnt="$define" ;;
12126                 Pass_unchanged)
12127                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
12128                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
12129                 Fail*)
12130                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
12131                 *)
12132                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
12133         esac
12134         else
12135                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
12136         fi
12137         $rm -f try.c try
12138         ;;
12139 esac
12140
12141 : see if _base is also standard
12142 val="$undef"
12143 case "$d_stdstdio" in
12144 $define)
12145         $cat >try.c <<EOP
12146 #include <stdio.h>
12147 #define FILE_base(fp)   $stdio_base
12148 #define FILE_bufsiz(fp) $stdio_bufsiz
12149 int main() {
12150         FILE *fp = fopen("try.c", "r");
12151         char c = getc(fp);
12152         if (
12153                 19 <= FILE_bufsiz(fp) &&
12154                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
12155         )
12156                 exit(0);
12157         exit(1);
12158 }
12159 EOP
12160         set try
12161         if eval $compile; then
12162                 if ./try; then
12163                         echo "And its _base field acts std."
12164                         val="$define"
12165                 else
12166                         echo "But its _base field isn't std."
12167                 fi
12168         else
12169                 echo "However, it seems to be lacking the _base field."
12170         fi
12171         $rm -f try.c try
12172         ;;
12173 esac
12174 set d_stdiobase
12175 eval $setvar
12176
12177 $cat >&4 <<EOM
12178 Checking how to access stdio streams by file descriptor number...
12179 EOM
12180 case "$stdio_stream_array" in
12181 '')     $cat >try.c <<EOCP
12182 #include <stdio.h>
12183 int main() {
12184   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
12185     printf("yes\n");
12186 }
12187 EOCP
12188         for s in _iob __iob __sF
12189         do
12190                 set try -DSTDIO_STREAM_ARRAY=$s
12191                 if eval $compile; then
12192                         case "`./try$exe_ext`" in
12193                         yes)    stdio_stream_array=$s; break ;;
12194                         esac
12195                 fi
12196         done
12197         $rm -f try.* try$exe_ext
12198 esac
12199 case "$stdio_stream_array" in
12200 '')     $cat >&4 <<EOM
12201 I can't figure out how to access stdio streams by file descriptor number.
12202 EOM
12203         d_stdio_stream_array="$undef"
12204         ;;
12205 *)      $cat >&4 <<EOM
12206 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
12207 EOM
12208         d_stdio_stream_array="$define"
12209         ;;
12210 esac
12211
12212 : see if strcoll exists
12213 set strcoll d_strcoll
12214 eval $inlibc
12215
12216 : check for structure copying
12217 echo " "
12218 echo "Checking to see if your C compiler can copy structs..." >&4
12219 $cat >try.c <<'EOCP'
12220 int main()
12221 {
12222         struct blurfl {
12223                 int dyick;
12224         } foo, bar;
12225
12226         foo = bar;
12227 }
12228 EOCP
12229 if $cc -c try.c >/dev/null 2>&1 ; then
12230         val="$define"
12231         echo "Yup, it can."
12232 else
12233         val="$undef"
12234         echo "Nope, it can't."
12235 fi
12236 set d_strctcpy
12237 eval $setvar
12238 $rm -f try.*
12239
12240 : see if strerror and/or sys_errlist[] exist
12241 echo " "
12242 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
12243     if set strerror val -f d_strerror; eval $csym; $val; then
12244                 echo 'strerror() found.' >&4
12245                 d_strerror="$define"
12246                 d_strerrm='strerror(e)'
12247                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
12248                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
12249                         d_syserrlst="$define"
12250                 else
12251                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
12252                         d_syserrlst="$undef"
12253                 fi
12254     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
12255                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
12256                 echo 'strerror() found in string header.' >&4
12257                 d_strerror="$define"
12258                 d_strerrm='strerror(e)'
12259                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
12260                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
12261                                 d_syserrlst="$define"
12262                 else
12263                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
12264                         d_syserrlst="$undef"
12265                 fi
12266     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
12267                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
12268                 d_strerror="$undef"
12269                 d_syserrlst="$define"
12270                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
12271     else
12272                 echo 'strerror() and sys_errlist[] NOT found.' >&4
12273                 d_strerror="$undef"
12274                 d_syserrlst="$undef"
12275                 d_strerrm='"unknown"'
12276     fi
12277 fi
12278
12279 : see if strftime exists
12280 set strftime d_strftime
12281 eval $inlibc
12282
12283 : see if strtod exists
12284 set strtod d_strtod
12285 eval $inlibc
12286
12287 : see if strtol exists
12288 set strtol d_strtol
12289 eval $inlibc
12290
12291 : see if strtold exists
12292 set strtold d_strtold
12293 eval $inlibc
12294
12295 : see if strtoll exists
12296 set strtoll d_strtoll
12297 eval $inlibc
12298
12299 case "$d_longlong-$d_strtoll" in
12300 "$define-$define")
12301         $cat <<EOM
12302 Checking whether your strtoll() works okay...
12303 EOM
12304         $cat >try.c <<'EOCP'
12305 #include <errno.h>
12306 #ifdef __hpux
12307 #define strtoll __strtoll
12308 #endif
12309 #ifdef __EMX__
12310 #define strtoll _strtoll
12311 #endif
12312 #include <stdio.h>
12313 extern long long int strtoll(char *s, char **, int); 
12314 static int bad = 0;
12315 int check(char *s, long long ell, int een) {
12316         long long gll;
12317         errno = 0;
12318         gll = strtoll(s, 0, 10);
12319         if (!((gll == ell) && (errno == een)))
12320                 bad++;
12321 }
12322 int main() {
12323         check(" 1",                                      1LL, 0);
12324         check(" 0",                                      0LL, 0);
12325         check("-1",                                     -1LL, 0);
12326         check("-9223372036854775808", -9223372036854775808LL, 0);
12327         check("-9223372036854775808", -9223372036854775808LL, 0);
12328         check(" 9223372036854775807",  9223372036854775807LL, 0);
12329         check("-9223372036854775808", -9223372036854775808LL, 0);
12330         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
12331         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
12332         if (!bad)
12333                 printf("ok\n");
12334 }
12335 EOCP
12336         set try
12337         if eval $compile; then
12338                 yyy=`./try`
12339                 case "$yyy" in
12340                 ok) echo "Your strtoll() seems to be working okay." ;;
12341                 *) cat <<EOM >&4
12342 Your strtoll() doesn't seem to be working okay.
12343 EOM
12344                    d_strtoll="$undef"
12345                    ;;
12346                 esac
12347         else
12348                 echo "(I can't seem to compile the test program--assuming it doesn't)"
12349                 d_strtoll="$undef"
12350         fi
12351         ;;
12352 esac
12353
12354 : see if strtoq exists
12355 set strtoq d_strtoq
12356 eval $inlibc
12357
12358 : see if strtoul exists
12359 set strtoul d_strtoul
12360 eval $inlibc
12361
12362 case "$d_strtoul" in
12363 "$define")
12364         $cat <<EOM
12365 Checking whether your strtoul() works okay...
12366 EOM
12367         $cat >try.c <<'EOCP'
12368 #include <errno.h>
12369 #include <stdio.h>
12370 extern unsigned long int strtoul(char *s, char **, int); 
12371 static int bad = 0;
12372 void check(char *s, unsigned long eul, int een) {
12373         unsigned long gul;
12374         errno = 0;
12375         gul = strtoul(s, 0, 10);
12376         if (!((gul == eul) && (errno == een)))
12377                 bad++;
12378 }
12379 int main() {
12380         check(" 1", 1L, 0);
12381         check(" 0", 0L, 0);
12382 EOCP
12383         case "$longsize" in
12384         8)
12385             $cat >>try.c <<'EOCP'
12386         check("18446744073709551615", 18446744073709551615UL, 0);
12387         check("18446744073709551616", 18446744073709551615UL, ERANGE);
12388 #if 0 /* strtoul() for /^-/ strings is undefined. */
12389         check("-1", 18446744073709551615UL, 0);
12390         check("-18446744073709551614", 2, 0);
12391         check("-18446744073709551615", 1, 0);
12392         check("-18446744073709551616", 18446744073709551615UL, ERANGE);
12393         check("-18446744073709551617", 18446744073709551615UL, ERANGE);
12394 #endif
12395 EOCP
12396                 ;;
12397         4)
12398                     $cat >>try.c <<'EOCP'
12399         check("4294967295", 4294967295UL, 0);
12400         check("4294967296", 4294967295UL, ERANGE);
12401 #if 0 /* strtoul() for /^-/ strings is undefined. */
12402         check("-1", 4294967295UL, 0);
12403         check("-4294967294", 2, 0);
12404         check("-4294967295", 1, 0);
12405         check("-4294967296", 4294967295UL, ERANGE);
12406         check("-4294967297", 4294967295UL, ERANGE);
12407 #endif
12408 EOCP
12409                 ;;
12410         *)
12411 : Should we write these tests to be more portable by sprintf-ing
12412 : ~0 and then manipulating that char string as input for strtol?
12413                 ;;
12414         esac
12415         $cat >>try.c <<'EOCP'
12416         if (!bad)
12417                 printf("ok\n");
12418         return 0;
12419 }
12420 EOCP
12421         set try
12422         if eval $compile; then
12423                 case "`./try`" in
12424                 ok) echo "Your strtoul() seems to be working okay." ;;
12425                 *) cat <<EOM >&4
12426 Your strtoul() doesn't seem to be working okay.
12427 EOM
12428                    d_strtoul="$undef"
12429                    ;;
12430                 esac
12431         fi
12432         ;;
12433 esac
12434
12435 : see if strtoull exists
12436 set strtoull d_strtoull
12437 eval $inlibc
12438
12439 case "$d_longlong-$d_strtoull" in
12440 "$define-$define")
12441         $cat <<EOM
12442 Checking whether your strtoull() works okay...
12443 EOM
12444         $cat >try.c <<'EOCP'
12445 #include <errno.h>
12446 #ifdef __hpux
12447 #define strtoull __strtoull
12448 #endif
12449 #include <stdio.h>
12450 extern unsigned long long int strtoull(char *s, char **, int); 
12451 static int bad = 0;
12452 int check(char *s, long long eull, int een) {
12453         long long gull;
12454         errno = 0;
12455         gull = strtoull(s, 0, 10);
12456         if (!((gull == eull) && (errno == een)))
12457                 bad++;
12458 }
12459 int main() {
12460         check(" 1",                                        1LL, 0);
12461         check(" 0",                                        0LL, 0);
12462         check("18446744073709551615",  18446744073709551615ULL, 0);
12463         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
12464 #if 0 /* strtoull() for /^-/ strings is undefined. */
12465         check("-1",                    18446744073709551615ULL, 0);
12466         check("-18446744073709551614",                     2LL, 0);
12467         check("-18446744073709551615",                     1LL, 0);
12468         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
12469         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
12470 #endif
12471         if (!bad)
12472                 printf("ok\n");
12473 }
12474 EOCP
12475         set try
12476         if eval $compile; then
12477                 case "`./try`" in
12478                 ok) echo "Your strtoull() seems to be working okay." ;;
12479                 *) cat <<EOM >&4
12480 Your strtoull() doesn't seem to be working okay.
12481 EOM
12482                    d_strtoull="$undef"
12483                    ;;
12484                 esac
12485         fi
12486         ;;
12487 esac
12488
12489 : see if strtouq exists
12490 set strtouq d_strtouq
12491 eval $inlibc
12492
12493 case "$d_strtouq" in
12494 "$define")
12495         $cat <<EOM
12496 Checking whether your strtouq() works okay...
12497 EOM
12498         $cat >try.c <<'EOCP'
12499 #include <errno.h>
12500 #include <stdio.h>
12501 extern unsigned long long int strtouq(char *s, char **, int); 
12502 static int bad = 0;
12503 void check(char *s, unsigned long long eull, int een) {
12504         unsigned long long gull;
12505         errno = 0;
12506         gull = strtouq(s, 0, 10);
12507         if (!((gull == eull) && (errno == een)))
12508                 bad++;
12509 }
12510 int main() {
12511         check(" 1",                                        1LL, 0);
12512         check(" 0",                                        0LL, 0);
12513         check("18446744073709551615",  18446744073709551615ULL, 0);
12514         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
12515 #if 0 /* strtouq() for /^-/ strings is undefined. */
12516         check("-1",                    18446744073709551615ULL, 0);
12517         check("-18446744073709551614",                     2LL, 0);
12518         check("-18446744073709551615",                     1LL, 0);
12519         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
12520         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
12521 #endif
12522         if (!bad)
12523                 printf("ok\n");
12524         return 0;
12525 }
12526 EOCP
12527         set try
12528         if eval $compile; then
12529                 case "`./try`" in
12530                 ok) echo "Your strtouq() seems to be working okay." ;;
12531                 *) cat <<EOM >&4
12532 Your strtouq() doesn't seem to be working okay.
12533 EOM
12534                    d_strtouq="$undef"
12535                    ;;
12536                 esac
12537         fi
12538         ;;
12539 esac
12540
12541 : see if strxfrm exists
12542 set strxfrm d_strxfrm
12543 eval $inlibc
12544
12545 : see if symlink exists
12546 set symlink d_symlink
12547 eval $inlibc
12548
12549 : see if syscall exists
12550 set syscall d_syscall
12551 eval $inlibc
12552
12553 : see if sysconf exists
12554 set sysconf d_sysconf
12555 eval $inlibc
12556
12557 : see if system exists
12558 set system d_system
12559 eval $inlibc
12560
12561 : see if tcgetpgrp exists
12562 set tcgetpgrp d_tcgetpgrp
12563 eval $inlibc
12564
12565 : see if tcsetpgrp exists
12566 set tcsetpgrp d_tcsetpgrp
12567 eval $inlibc
12568
12569 : see if prototype for telldir is available
12570 echo " "
12571 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
12572 eval $hasproto
12573
12574 : see if this is a sys/times.h system
12575 set sys/times.h i_systimes
12576 eval $inhdr
12577
12578 : see if times exists
12579 echo " "
12580 if set times val -f d_times; eval $csym; $val; then
12581         echo 'times() found.' >&4
12582         d_times="$define"
12583         inc=''
12584         case "$i_systimes" in
12585         "$define") inc='sys/times.h';;
12586         esac
12587         rp="What is the type returned by times() on this system?"
12588         set clock_t clocktype long stdio.h sys/types.h $inc
12589         eval $typedef_ask
12590 else
12591         echo 'times() NOT found, hope that will do.' >&4
12592         d_times="$undef"
12593         clocktype='int'
12594 fi
12595
12596 : see if truncate exists
12597 set truncate d_truncate
12598 eval $inlibc
12599
12600 : see if tzname[] exists
12601 echo " "
12602 if set tzname val -a d_tzname; eval $csym; $val; then
12603         val="$define"
12604         echo 'tzname[] found.' >&4
12605 else
12606         val="$undef"
12607         echo 'tzname[] NOT found.' >&4
12608 fi
12609 set d_tzname
12610 eval $setvar
12611
12612 case "$crosscompile" in
12613 ''|[nN]*) crosscompile="$undef" ;;
12614 esac
12615
12616 case "$osname" in
12617 next|rhapsody|darwin) multiarch="$define" ;;
12618 esac
12619 case "$multiarch" in
12620 ''|[nN]*) multiarch="$undef" ;;
12621 esac
12622
12623 : check for ordering of bytes in a long
12624 echo " "
12625 case "$crosscompile$multiarch" in
12626 *$define*)
12627         $cat <<EOM
12628 You seem to be either cross-compiling or doing a multiarchitecture build,
12629 skipping the byteorder check.
12630
12631 EOM
12632         byteorder='0xffff'
12633         ;;
12634 *)
12635         case "$byteorder" in
12636         '')
12637                 $cat <<'EOM'
12638 In the following, larger digits indicate more significance.  A big-endian
12639 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
12640 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
12641 machines may have weird orders like 3412.  A Cray will report 87654321,
12642 an Alpha will report 12345678. If the test program works the default is
12643 probably right.
12644 I'm now running the test program...
12645 EOM
12646                 $cat >try.c <<'EOCP'
12647 #include <stdio.h>
12648 int main()
12649 {
12650         int i;
12651         union {
12652                 unsigned long l;
12653                 char c[sizeof(long)];
12654         } u;
12655
12656         if (sizeof(long) > 4)
12657                 u.l = (0x08070605L << 32) | 0x04030201L;
12658         else
12659                 u.l = 0x04030201L;
12660         for (i = 0; i < sizeof(long); i++)
12661                 printf("%c", u.c[i]+'0');
12662         printf("\n");
12663         exit(0);
12664 }
12665 EOCP
12666                 xxx_prompt=y
12667                 set try
12668                 if eval $compile && ./try > /dev/null; then
12669                         dflt=`./try`
12670                         case "$dflt" in
12671                         [1-4][1-4][1-4][1-4]|12345678|87654321)
12672                                 echo "(The test program ran ok.)"
12673                                 echo "byteorder=$dflt"
12674                                 xxx_prompt=n
12675                         ;;
12676                         ????|????????) echo "(The test program ran ok.)" ;;
12677                         *) echo "(The test program didn't run right for some reason.)" ;;
12678                         esac
12679                 else
12680                         dflt='4321'
12681                         cat <<'EOM'
12682 (I can't seem to compile the test program.  Guessing big-endian...)
12683 EOM
12684                 fi
12685                 case "$xxx_prompt" in
12686                 y)
12687                         rp="What is the order of bytes in a long?"
12688                         . ./myread
12689                         byteorder="$ans"
12690                         ;;
12691                 *)      byteorder=$dflt
12692                         ;;
12693                 esac
12694                 ;;
12695         esac
12696         $rm -f try.c try
12697         ;;
12698 esac
12699
12700
12701 $cat <<EOM
12702
12703 Checking to see whether you can access character data unalignedly...
12704 EOM
12705 $cat >try.c <<EOCP
12706 #include <stdio.h>
12707 #define U32 $u32type
12708 #define BYTEORDER $byteorder
12709 int main() {
12710 #if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
12711     U8 buf[] = "\0\0\0\1\0\0\0\0";
12712     U32 *up;
12713     int i;
12714
12715     if (sizeof(U32) != 4) {
12716         printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
12717         exit(1);
12718     }
12719
12720     fflush(stdout);
12721
12722     for (i = 0; i < 4; i++) {
12723         up = (U32*)(buf + i);
12724         if (! ((*up == 1 << (8*i)) ||   /* big-endian */
12725                (*up == 1 << (8*(3-i)))  /* little-endian */
12726               )
12727            )
12728         {
12729             printf("read failed (%x)\n", *up);
12730             exit(2);
12731         }
12732     }
12733
12734     /* write test */
12735     for (i = 0; i < 4; i++) {
12736         up = (U32*)(buf + i);
12737         *up = 0xBeef;
12738         if (*up != 0xBeef) {
12739             printf("write failed (%x)\n", *up);
12740             exit(3);
12741         }
12742     }
12743
12744     exit(0);
12745 #else
12746     printf("1\n");
12747     exit(1);
12748 #endif
12749     return 0;
12750 }
12751 EOCP
12752 set try
12753 if eval $compile_ok; then
12754         echo "(This test may dump core.)" >&4
12755         ./try >&2 >/dev/null
12756         case "$?" in
12757         0)      cat >&4 <<EOM
12758 You can access character data pretty unalignedly.
12759 EOM
12760                 d_u32align="$undef"
12761                 ;;
12762         *)      cat >&4 <<EOM
12763 It seems that you must access character data in an aligned manner.
12764 EOM
12765                 d_u32align="$define"
12766                 ;;
12767         esac
12768         $rm -f core core.try.* try.core
12769 else
12770         rp='Can you access character data at unaligned addresses?'
12771         dflt='n'
12772         . ./myread
12773         case "$ans" in
12774         [yY]*)  d_u32align="$undef"  ;;
12775         *)      d_u32align="$define" ;;
12776         esac
12777 fi
12778
12779 : see if ualarm exists
12780 set ualarm d_ualarm
12781 eval $inlibc
12782
12783 : see if umask exists
12784 set umask d_umask
12785 eval $inlibc
12786
12787 : see if usleep exists
12788 set usleep d_usleep
12789 eval $inlibc
12790
12791 : see if ustat exists
12792 set ustat d_ustat
12793 eval $inlibc
12794
12795 : backward compatibility for d_hvfork
12796 if test X$d_hvfork != X; then
12797         d_vfork="$d_hvfork"
12798         d_hvfork=''
12799 fi
12800 : see if there is a vfork
12801 val=''
12802 set vfork val
12803 eval $inlibc
12804
12805 : Ok, but do we want to use it. vfork is reportedly unreliable in 
12806 : perl on Solaris 2.x, and probably elsewhere.
12807 case "$val" in
12808 $define)
12809         echo " "
12810         case "$usevfork" in
12811         false) dflt='n';;
12812         *) dflt='y';;
12813         esac
12814         cat <<'EOM'
12815  
12816 Perl can only use a vfork() that doesn't suffer from strict
12817 restrictions on calling functions or modifying global data in
12818 the child.  For example, glibc-2.1 contains such a vfork()
12819 that is unsuitable.  If your system provides a proper fork()
12820 call, chances are that you do NOT want perl to use vfork().
12821
12822 EOM
12823         rp="Do you still want to use vfork()?"
12824         . ./myread
12825         case "$ans" in
12826         y|Y) ;;
12827         *)
12828                 echo "Ok, we won't use vfork()."
12829                 val="$undef"
12830                 ;;
12831         esac
12832         ;;
12833 esac
12834 set d_vfork
12835 eval $setvar
12836 case "$d_vfork" in
12837 $define) usevfork='true';;
12838 *) usevfork='false';;
12839 esac
12840
12841 : see if this is an sysdir system
12842 set sys/dir.h i_sysdir
12843 eval $inhdr
12844
12845 : see if this is an sysndir system
12846 set sys/ndir.h i_sysndir
12847 eval $inhdr
12848
12849 : see if closedir exists
12850 set closedir d_closedir
12851 eval $inlibc
12852
12853 case "$d_closedir" in
12854 "$define")
12855         echo " "
12856         echo "Checking whether closedir() returns a status..." >&4
12857         cat > closedir.c <<EOM
12858 #$i_dirent I_DIRENT             /**/
12859 #$i_sysdir I_SYS_DIR            /**/
12860 #$i_sysndir I_SYS_NDIR          /**/
12861 #$i_systypes I_SYS_TYPES        /**/
12862
12863 #if defined(I_SYS_TYPES)
12864 #include <sys/types.h>
12865 #endif
12866 #if defined(I_DIRENT)
12867 #include <dirent.h>
12868 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
12869 #include <sys/dir.h>
12870 #endif
12871 #else
12872 #ifdef I_SYS_NDIR
12873 #include <sys/ndir.h>
12874 #else
12875 #ifdef I_SYS_DIR
12876 #ifdef hp9000s500
12877 #include <ndir.h>       /* may be wrong in the future */
12878 #else
12879 #include <sys/dir.h>
12880 #endif
12881 #endif
12882 #endif
12883 #endif 
12884 int main() { return closedir(opendir(".")); }
12885 EOM
12886         set closedir
12887         if eval $compile_ok; then
12888                 if ./closedir > /dev/null 2>&1 ; then
12889                         echo "Yes, it does."
12890                         val="$undef"
12891                 else
12892                         echo "No, it doesn't."
12893                         val="$define"
12894                 fi
12895         else
12896                 echo "(I can't seem to compile the test program--assuming it doesn't)"
12897                 val="$define"
12898         fi
12899         ;;
12900 *)
12901         val="$undef";
12902         ;;
12903 esac
12904 set d_void_closedir
12905 eval $setvar
12906 $rm -f closedir*
12907 : see if there is a wait4
12908 set wait4 d_wait4
12909 eval $inlibc
12910
12911 : see if waitpid exists
12912 set waitpid d_waitpid
12913 eval $inlibc
12914
12915 : see if wcstombs exists
12916 set wcstombs d_wcstombs
12917 eval $inlibc
12918
12919 : see if wctomb exists
12920 set wctomb d_wctomb
12921 eval $inlibc
12922
12923 : see if writev exists
12924 set writev d_writev
12925 eval $inlibc
12926
12927 : preserve RCS keywords in files with variable substitution, grrr
12928 Date='$Date'
12929 Id='$Id'
12930 Log='$Log'
12931 RCSfile='$RCSfile'
12932 Revision='$Revision'
12933
12934 : check for alignment requirements
12935 echo " "
12936 case "$crosscompile$multiarch" in
12937 *$define*)
12938         $cat <<EOM
12939 You seem to be either cross-compiling or doing a multiarchitecture build,
12940 skipping the memory alignment check.
12941
12942 EOM
12943         case "$alignbytes" in
12944         '') alignbytes=8 ;;
12945         esac
12946         ;;
12947 *)
12948         case "$alignbytes" in
12949         '') echo "Checking alignment constraints..." >&4
12950                 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
12951                         $cat >try.c <<'EOCP'
12952 typedef long double NV;
12953 EOCP
12954                 else
12955                         $cat >try.c <<'EOCP'
12956 typedef double NV;
12957 EOCP
12958                 fi
12959                 $cat >>try.c <<'EOCP'
12960 #include <stdio.h>
12961 struct foobar {
12962         char foo;
12963         NV bar;
12964 } try_algn;
12965 int main()
12966 {
12967     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
12968     return(0);
12969 }
12970 EOCP
12971                 set try
12972                 if eval $compile_ok; then
12973                         dflt=`./try`
12974                 else
12975                         dflt='8'
12976                         echo "(I can't seem to compile the test program...)"
12977                 fi
12978                 ;;
12979         *) dflt="$alignbytes"
12980                 ;;
12981         esac
12982         rp="Doubles must be aligned on a how-many-byte boundary?"
12983         . ./myread
12984         alignbytes="$ans"
12985         $rm -f try.c try
12986         ;;
12987 esac
12988
12989
12990 : set the base revision
12991 baserev=5.0
12992
12993 : how do we catenate cpp tokens here?
12994 echo " "
12995 echo "Checking to see how your cpp does stuff like catenate tokens..." >&4
12996 $cat >cpp_stuff.c <<'EOCP'
12997 #define RCAT(a,b)a/**/b
12998 #define ACAT(a,b)a ## b
12999 RCAT(Rei,ser)
13000 ACAT(Cir,cus)
13001 EOCP
13002 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
13003 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
13004         echo "Oh!  Smells like ANSI's been here." >&4
13005         echo "We can catify or stringify, separately or together!"
13006         cpp_stuff=42
13007 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
13008         echo "Ah, yes!  The good old days!" >&4
13009         echo "However, in the good old days we don't know how to stringify and"
13010         echo "catify at the same time."
13011         cpp_stuff=1
13012 else
13013         $cat >&4 <<EOM
13014 Hmm, I don't seem to be able to catenate tokens with your cpp.  You're going
13015 to have to edit the values of CAT[2-5] in config.h...
13016 EOM
13017         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
13018 fi
13019 $rm -f cpp_stuff.*
13020
13021 : see if this is a db.h system
13022 set db.h i_db
13023 eval $inhdr
13024
13025 case "$i_db" in
13026 $define)
13027         : Check db version.
13028         echo " "
13029         echo "Checking Berkeley DB version ..." >&4
13030         $cat >try.c <<EOCP
13031 #$d_const HASCONST
13032 #ifndef HASCONST
13033 #define const
13034 #endif
13035 #include <sys/types.h>
13036 #include <stdio.h>
13037 #include <db.h>
13038 int main(int argc, char *argv[])
13039 {
13040 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
13041     int Major, Minor, Patch ;
13042     unsigned long Version ;
13043     (void)db_version(&Major, &Minor, &Patch) ;
13044     if (argc == 2) {
13045         printf("%d %d %d %d %d %d\n",
13046                DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
13047                Major, Minor, Patch);
13048         exit(0);
13049     }
13050     printf("You have Berkeley DB Version 2 or greater.\n");
13051
13052     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
13053                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
13054     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
13055                 Major, Minor, Patch) ;
13056
13057     /* check that db.h & libdb are compatible */
13058     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
13059         printf("db.h and libdb are incompatible.\n") ;
13060         exit(3);        
13061     }
13062
13063     printf("db.h and libdb are compatible.\n") ;
13064
13065     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
13066                 + DB_VERSION_PATCH ;
13067
13068     /* needs to be >= 2.3.4 */
13069     if (Version < 2003004) {
13070     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
13071         printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
13072         exit(2);        
13073     }
13074
13075     exit(0);
13076 #else
13077 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
13078     if (argc == 2) {
13079         printf("1 0 0\n");
13080         exit(0);
13081     }
13082     printf("You have Berkeley DB Version 1.\n");
13083     exit(0);    /* DB version < 2: the coast is clear. */
13084 #else
13085     exit(1);    /* <db.h> not Berkeley DB? */
13086 #endif
13087 #endif
13088 }
13089 EOCP
13090         set try
13091         if eval $compile_ok && ./try; then
13092                 echo 'Looks OK.' >&4
13093                 set `./try 1`
13094                 db_version_major=$1
13095                 db_version_minor=$2
13096                 db_version_patch=$3
13097         else
13098                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
13099                 i_db=$undef
13100                 case " $libs " in
13101                 *"-ldb "*)
13102                         : Remove db from list of libraries to use
13103                         echo "Removing unusable -ldb from library list" >&4
13104                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
13105                         shift
13106                         libs="$*"
13107                         echo "libs = $libs" >&4
13108                         ;;
13109                 esac
13110         fi
13111         $rm -f try.*
13112         ;;
13113 esac
13114
13115 case "$i_db" in
13116 define)
13117         : Check the return type needed for hash 
13118         echo " "
13119         echo "Checking return type needed for hash for Berkeley DB ..." >&4
13120         $cat >try.c <<EOCP
13121 #$d_const HASCONST
13122 #ifndef HASCONST
13123 #define const
13124 #endif
13125 #include <sys/types.h>
13126 #include <db.h>
13127
13128 #ifndef DB_VERSION_MAJOR
13129 u_int32_t hash_cb (ptr, size)
13130 const void *ptr;
13131 size_t size;
13132 {
13133 }
13134 HASHINFO info;
13135 int main()
13136 {
13137         info.hash = hash_cb;
13138 }
13139 #endif
13140 EOCP
13141         if $cc $ccflags -c try.c >try.out 2>&1 ; then
13142                 if $contains warning try.out >>/dev/null 2>&1 ; then
13143                         db_hashtype='int'
13144                 else
13145                         db_hashtype='u_int32_t'
13146                 fi
13147         else
13148                 : XXX Maybe we should just give up here.
13149                 db_hashtype=u_int32_t
13150                 $cat try.out >&4
13151                 echo "Help:  I can't seem to compile the db test program." >&4
13152                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
13153         fi
13154         $rm -f try.*
13155         echo "Your version of Berkeley DB uses $db_hashtype for hash."
13156         ;;
13157 *)      db_hashtype=u_int32_t
13158         ;;
13159 esac
13160 case "$i_db" in
13161 define)
13162         : Check the return type needed for prefix 
13163         echo " "
13164         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
13165         cat >try.c <<EOCP
13166 #$d_const HASCONST
13167 #ifndef HASCONST
13168 #define const
13169 #endif
13170 #include <sys/types.h>
13171 #include <db.h>
13172
13173 #ifndef DB_VERSION_MAJOR
13174 size_t prefix_cb (key1, key2)
13175 const DBT *key1;
13176 const DBT *key2;
13177 {
13178 }
13179 BTREEINFO info;
13180 int main()
13181 {
13182         info.prefix = prefix_cb;
13183 }
13184 #endif
13185 EOCP
13186         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
13187                 if $contains warning try.out >>/dev/null 2>&1 ; then
13188                         db_prefixtype='int'
13189                 else
13190                         db_prefixtype='size_t'
13191                 fi
13192         else
13193                 db_prefixtype='size_t'
13194                 : XXX Maybe we should just give up here.
13195                 $cat try.out >&4
13196                 echo "Help:  I can't seem to compile the db test program." >&4
13197                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
13198         fi
13199         $rm -f try.*
13200         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
13201         ;;
13202 *)      db_prefixtype='size_t'
13203         ;;
13204 esac
13205
13206
13207 : How can we generate normalized random numbers ?
13208 echo " "
13209 echo "Looking for a random number function..." >&4
13210 case "$randfunc" in
13211 '')
13212         if set drand48 val -f; eval $csym; $val; then
13213                 dflt="drand48"
13214                 echo "Good, found drand48()." >&4
13215         elif set random val -f; eval $csym; $val; then
13216                 dflt="random"
13217                 echo "OK, found random()." >&4
13218         else
13219                 dflt="rand"
13220                 echo "Yick, looks like I have to use rand()." >&4
13221         fi
13222         echo " "
13223         ;;
13224 *)
13225         dflt="$randfunc"
13226         ;;
13227 esac
13228 cont=true
13229
13230 case "$ccflags" in
13231 *-Dmy_rand=*|*-Dmy_srand=*)
13232         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
13233         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
13234         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
13235         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
13236         ;;
13237 esac
13238
13239 while $test "$cont"; do
13240         rp="Use which function to generate random numbers?"
13241         . ./myread
13242         if $test "$ans" = "$dflt"; then
13243                 : null
13244         else
13245                 randbits=''
13246         fi
13247         randfunc="$ans"
13248         if set $ans val -f; eval $csym; $val; then
13249                 cont=''
13250         else
13251                 dflt=y
13252                 rp="I cannot find function $ans. Use that name anyway?"
13253                 . ./myread
13254                 dflt=rand
13255                 case "$ans" in
13256                         [yY]*) cont='';;
13257                 esac
13258         fi
13259         case "$cont" in
13260         '')
13261                 case "$randfunc" in
13262                 drand48)
13263                         drand01="drand48()"
13264                         seedfunc="srand48"
13265                         randbits=48
13266                         randseedtype=long
13267                         ;;
13268                 rand|random)
13269                         case "$randbits" in
13270                         '')
13271 echo "Checking to see how many bits your $randfunc() function produces..." >&4
13272                                 $cat >try.c <<EOCP
13273 #$i_unistd I_UNISTD
13274 #$i_stdlib I_STDLIB
13275 #include <stdio.h>
13276 #ifdef I_UNISTD
13277 #  include <unistd.h>
13278 #endif
13279 #ifdef I_STDLIB
13280 #  include <stdlib.h>
13281 #endif
13282 int main()
13283 {
13284         register int i;
13285         register unsigned long tmp;
13286         register unsigned long max = 0L;
13287
13288         for (i = 1000; i; i--) {
13289                 tmp = (unsigned long) $randfunc();
13290                 if (tmp > max) max = tmp;
13291         }
13292         for (i = 0; max; i++)
13293                 max /= 2;
13294         printf("%d\n",i);
13295 }
13296 EOCP
13297                                 set try
13298                                 if eval $compile_ok; then
13299                                         dflt=`try`
13300                                 else
13301                                         dflt='?'
13302                                         echo "(I can't seem to compile the test program...)"
13303                                 fi
13304                                 ;;
13305                         *)
13306                                 dflt="$randbits"
13307                                 ;;
13308                         esac
13309                         rp="How many bits does your $randfunc() function produce?"
13310                         . ./myread
13311                         randbits="$ans"
13312                         $rm -f try.c try
13313                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
13314                         seedfunc="s$randfunc"
13315                         randseedtype=unsigned
13316                         ;;
13317                 *)
13318                         dflt="31"
13319                         rp="How many bits does your $randfunc() function produce?"
13320                         . ./myread
13321                         randbits="$ans"
13322                         seedfunc="s$randfunc"
13323                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
13324                         if set $seedfunc val -f; eval $csym; $val; then
13325                                 echo "(Using $seedfunc() to seed random generator)"
13326                         else
13327                                 echo "(Warning: no $seedfunc() to seed random generator)"
13328                                 seedfunc=rand
13329                         fi
13330                         randseedtype=unsigned
13331                         ;;
13332                 esac
13333                 ;;
13334         esac
13335 done
13336
13337 echo " "
13338 echo "Determining whether or not we are on an EBCDIC system..." >&4
13339 $cat >tebcdic.c <<'EOM'
13340 int main()
13341 {
13342   if ('M'==0xd4) return 0;
13343   return 1;
13344 }
13345 EOM
13346
13347 val=$undef
13348 set tebcdic
13349 if eval $compile_ok; then
13350         if ./tebcdic; then
13351                 echo "You seem to speak EBCDIC." >&4
13352                 val="$define"
13353         else
13354                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF8." >&4
13355         fi
13356 else
13357         echo "I'm unable to compile the test program." >&4
13358         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
13359 fi
13360 $rm -f tebcdic.c tebcdic
13361 set ebcdic
13362 eval $setvar
13363
13364 echo " "
13365 $cat >&4 <<EOM
13366 Checking how to flush all pending stdio output...
13367 EOM
13368 # I only know how to find the first 32 possibly open files on SunOS.
13369 # See also hints/sunos_4_1.sh and util.c  --AD
13370 case "$osname" in
13371 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
13372 esac
13373 $cat >>try.c <<EOCP
13374 #include <stdio.h>
13375 #$i_unistd I_UNISTD
13376 #ifdef I_UNISTD
13377 # include <unistd.h>
13378 #endif
13379 #$d_sysconf HAS_SYSCONF
13380 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
13381 #ifdef HAS_STDIO_STREAM_ARRAY
13382 # define STDIO_STREAM_ARRAY $stdio_stream_array
13383 #endif
13384 int main() {
13385   FILE* p = fopen("try.out", "w");
13386 #ifdef TRY_FPUTC
13387   fputc('x', p);
13388 #else
13389 # ifdef TRY_FPRINTF
13390   fprintf(p, "x");
13391 # endif
13392 #endif
13393 #ifdef TRY_FFLUSH_NULL
13394   fflush(NULL);
13395 #endif
13396 #ifdef TRY_FFLUSH_ALL
13397   {
13398     long open_max = -1;
13399 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
13400     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
13401 # else
13402 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
13403     open_max = sysconf(_SC_OPEN_MAX);
13404 #  else
13405 #   ifdef FOPEN_MAX
13406     open_max = FOPEN_MAX;
13407 #   else
13408 #    ifdef OPEN_MAX
13409     open_max = OPEN_MAX;
13410 #    else
13411 #     ifdef _NFILE
13412     open_max = _NFILE;
13413 #     endif
13414 #    endif
13415 #   endif
13416 #  endif
13417 # endif 
13418 # ifdef HAS_STDIO_STREAM_ARRAY
13419     if (open_max > 0) {
13420       long i;
13421       for (i = 0; i < open_max; i++)
13422             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
13423                 STDIO_STREAM_ARRAY[i]._file < open_max &&
13424                 STDIO_STREAM_ARRAY[i]._flag)
13425                 fflush(&STDIO_STREAM_ARRAY[i]);
13426     }   
13427   }
13428 # endif
13429 #endif
13430   _exit(42);
13431 }
13432 EOCP
13433 : first we have to find out how _not_ to flush
13434 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
13435     output=''
13436     set try -DTRY_FPUTC
13437     if eval $compile; then
13438             $rm -f try.out
13439             ./try$exe_ext 2>/dev/null
13440             if $test ! -s try.out -a "X$?" = X42; then
13441                 output=-DTRY_FPUTC
13442             fi
13443     fi
13444     case "$output" in
13445     '')
13446             set try -DTRY_FPRINTF
13447             $rm -f try.out
13448             if eval $compile; then
13449                     $rm -f try.out
13450                     ./try$exe_ext 2>/dev/null
13451                     if $test ! -s try.out -a "X$?" = X42; then
13452                         output=-DTRY_FPRINTF
13453                     fi
13454             fi
13455         ;;
13456     esac
13457 fi
13458 : check for fflush NULL behaviour
13459 case "$fflushNULL" in
13460 '')     set try -DTRY_FFLUSH_NULL $output
13461         if eval $compile; then
13462                 $rm -f try.out
13463                 ./try$exe_ext 2>/dev/null
13464                 code="$?"
13465                 if $test -s try.out -a "X$code" = X42; then
13466                         fflushNULL="`$cat try.out`"
13467                 else
13468                         if $test "X$code" != X42; then
13469                                 $cat >&4 <<EOM
13470 (If this test failed, don't worry, we'll try another method shortly.)
13471 EOM
13472                         fi
13473                 fi
13474         fi
13475         $rm -f core try.core core.try.*
13476         case "$fflushNULL" in
13477         x)      $cat >&4 <<EOM
13478 Your fflush(NULL) works okay for output streams.
13479 Let's see if it clobbers input pipes...
13480 EOM
13481 # As of mid-March 2000 all versions of Solaris appear to have a stdio
13482 # bug that improperly flushes the input end of pipes.  So we avoid the
13483 # autoflush on fork/system/exec support for now. :-(
13484 $cat >tryp.c <<EOCP
13485 #include <stdio.h>
13486 int
13487 main(int argc, char **argv)
13488 {
13489     char buf[1024];
13490     int i;
13491     char *bp = buf;
13492     while (1) {
13493         while ((i = getc(stdin)) != -1
13494                && (*bp++ = i) != '\n'
13495                && bp < &buf[1024])
13496         /* DO NOTHING */ ;
13497         *bp = '\0';
13498         fprintf(stdout, "%s", buf);
13499         fflush(NULL);
13500         if (i == -1)
13501             return 0;
13502         bp = buf;
13503     }
13504 }
13505 EOCP
13506                 fflushNULL="$define"
13507                 set tryp
13508                 if eval $compile; then
13509                     $rm -f tryp.out
13510                     $cat tryp.c | ./tryp$exe_ext 2>/dev/null > tryp.out
13511                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
13512                        $cat >&4 <<EOM
13513 fflush(NULL) seems to behave okay with input streams.
13514 EOM
13515                         fflushNULL="$define"
13516                     else
13517                         $cat >&4 <<EOM
13518 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
13519 EOM
13520                         fflushNULL="$undef"
13521                     fi
13522                 fi
13523                 $rm -f core tryp.c tryp.core core.tryp.*
13524                 ;;
13525         '')     $cat >&4 <<EOM
13526 Your fflush(NULL) isn't working (contrary to ANSI C).
13527 EOM
13528                 fflushNULL="$undef"
13529                 ;;
13530         *)      $cat >&4 <<EOM
13531 Cannot figure out whether your fflush(NULL) works or not.
13532 I'm assuming it doesn't (contrary to ANSI C).
13533 EOM
13534                 fflushNULL="$undef"
13535                 ;;
13536         esac
13537         ;;
13538 $define|true|[yY]*)
13539         fflushNULL="$define"
13540         ;;
13541 *)
13542         fflushNULL="$undef"
13543         ;;
13544 esac
13545 : check explicit looping only if NULL did not work, and if the pipe
13546 : bug does not show up on an explicit flush too
13547 case "$fflushNULL" in
13548 "$undef")
13549         $cat >tryp.c <<EOCP
13550 #include <stdio.h>
13551 int
13552 main(int argc, char **argv)
13553 {
13554     char buf[1024];
13555     int i;
13556     char *bp = buf;
13557     while (1) {
13558         while ((i = getc(stdin)) != -1
13559                && (*bp++ = i) != '\n'
13560                && bp < &buf[1024])
13561         /* DO NOTHING */ ;
13562         *bp = '\0';
13563         fprintf(stdout, "%s", buf);
13564         fflush(stdin);
13565         if (i == -1)
13566             return 0;
13567         bp = buf;
13568     }
13569 }
13570 EOCP
13571         set tryp
13572         if eval $compile; then
13573             $rm -f tryp.out
13574             $cat tryp.c | ./tryp$exe_ext 2>/dev/null > tryp.out
13575             if cmp tryp.c tryp.out >/dev/null 2>&1; then
13576                $cat >&4 <<EOM
13577 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
13578 EOM
13579                 : now check for fflushall behaviour
13580                 case "$fflushall" in
13581                 '')     set try -DTRY_FFLUSH_ALL $output
13582                         if eval $compile; then
13583                                 $cat >&4 <<EOM
13584 (Now testing the other method--but note that this also may fail.)
13585 EOM
13586                                 $rm -f try.out
13587                                 ./try$exe_ext 2>/dev/null
13588                                 if $test -s try.out -a "X$?" = X42; then
13589                                         fflushall="`$cat try.out`"
13590                                 fi
13591                         fi
13592                         $rm -f core try.core core.try.*
13593                         case "$fflushall" in
13594                         x)      $cat >&4 <<EOM
13595 Whew. Flushing explicitly all the stdio streams works.
13596 EOM
13597                                 fflushall="$define"
13598                                 ;;
13599                         '')     $cat >&4 <<EOM
13600 Sigh. Flushing explicitly all the stdio streams doesn't work.
13601 EOM
13602                                 fflushall="$undef"
13603                                 ;;
13604                         *)      $cat >&4 <<EOM
13605 Cannot figure out whether flushing stdio streams explicitly works or not.
13606 I'm assuming it doesn't.
13607 EOM
13608                                 fflushall="$undef"
13609                                 ;;
13610                         esac
13611                         ;;
13612                 "$define"|true|[yY]*)
13613                         fflushall="$define"
13614                         ;;
13615                 *)
13616                         fflushall="$undef"
13617                         ;;
13618                 esac
13619             else
13620                 $cat >&4 <<EOM
13621 All is futile.  Even fflush(stdin) clobbers input pipes!
13622 EOM
13623                 fflushall="$undef"
13624             fi
13625         else
13626             fflushall="$undef"
13627         fi
13628         $rm -f core tryp.c tryp.core core.tryp.*
13629         ;;
13630 *)      fflushall="$undef"
13631         ;;
13632 esac
13633
13634 case "$fflushNULL$fflushall" in
13635 undefundef)
13636         $cat <<EOM
13637 OK, I give up.  I cannot figure out how to flush pending stdio output.
13638 We won't be flushing handles at all before fork/exec/popen.
13639 EOM
13640         ;;
13641 esac
13642 $rm -f try.* try$exe_ext
13643
13644 : Store the full pathname to the ar program for use in the C program
13645 : Respect a hint or command line value for full_ar.
13646 case "$full_ar" in
13647 '') full_ar=$ar ;;
13648 esac
13649
13650 : Store the full pathname to the sed program for use in the C program
13651 full_sed=$sed
13652
13653 : see what type gids are declared as in the kernel
13654 echo " "
13655 echo "Looking for the type for group ids returned by getgid()."
13656 set gid_t gidtype xxx stdio.h sys/types.h
13657 eval $typedef
13658 case "$gidtype" in
13659 xxx)
13660         xxx=`./findhdr sys/user.h`
13661         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
13662         case $1 in
13663         unsigned) dflt="$1 $2" ;;
13664         *) dflt="$1" ;;
13665         esac
13666         ;;
13667 *) dflt="$gidtype";;
13668 esac
13669 case "$gidtype" in
13670 gid_t) echo "gid_t found." ;;
13671 *)      rp="What is the type for group ids returned by getgid()?"
13672         . ./myread
13673         gidtype="$ans"
13674         ;;
13675 esac
13676
13677 echo " "
13678 case "$gidtype" in
13679 *_t) zzz="$gidtype"     ;;
13680 *)   zzz="gid"          ;;
13681 esac
13682 echo "Checking the size of $zzz..." >&4 
13683 cat > try.c <<EOCP
13684 #include <sys/types.h>
13685 #include <stdio.h>
13686 int main() {
13687     printf("%d\n", (int)sizeof($gidtype));
13688     exit(0);
13689 }
13690 EOCP
13691 set try
13692 if eval $compile_ok; then
13693         yyy=`./try`
13694         case "$yyy" in
13695         '')     gidsize=4
13696                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
13697                 ;;
13698         *)      gidsize=$yyy
13699                 echo "Your $zzz is $gidsize bytes long."
13700                 ;;
13701         esac
13702 else
13703         gidsize=4
13704         echo "(I can't compile the test program--guessing $gidsize.)" >&4
13705 fi
13706
13707
13708 echo " "
13709 case "$gidtype" in
13710 *_t) zzz="$gidtype"     ;;
13711 *)   zzz="gid"          ;;
13712 esac
13713 echo "Checking the sign of $zzz..." >&4 
13714 cat > try.c <<EOCP
13715 #include <sys/types.h>
13716 #include <stdio.h>
13717 int main() {
13718         $gidtype foo = -1;
13719         if (foo < 0)
13720                 printf("-1\n");
13721         else
13722                 printf("1\n");
13723 }
13724 EOCP
13725 set try
13726 if eval $compile; then
13727         yyy=`./try`
13728         case "$yyy" in
13729         '')     gidsign=1
13730                 echo "(I can't execute the test program--guessing unsigned.)" >&4
13731                 ;;
13732         *)      gidsign=$yyy
13733                 case "$gidsign" in
13734                  1) echo "Your $zzz is unsigned." ;;
13735                 -1) echo "Your $zzz is signed."   ;;
13736                 esac
13737                 ;;
13738         esac
13739 else
13740         gidsign=1
13741         echo "(I can't compile the test program--guessing unsigned.)" >&4
13742 fi
13743
13744
13745 echo " "
13746
13747 if $test X"$quadtype" != X; then
13748
13749 echo "Checking how to print 64-bit integers..." >&4
13750
13751 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
13752         $cat >try.c <<'EOCP'
13753 #include <sys/types.h>
13754 #include <stdio.h>
13755 int main() {
13756   int q = 12345678901;
13757   printf("%ld\n", q);
13758 }
13759 EOCP
13760         set try
13761         if eval $compile; then
13762                 yyy=`./try$exe_ext`
13763                 case "$yyy" in
13764                 12345678901)
13765                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
13766                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
13767                         echo "We will use %d."
13768                         ;;
13769                 esac
13770         fi
13771 fi
13772
13773 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
13774         $cat >try.c <<'EOCP'
13775 #include <sys/types.h>
13776 #include <stdio.h>
13777 int main() {
13778   long q = 12345678901;
13779   printf("%ld\n", q);
13780 }
13781 EOCP
13782         set try
13783         if eval $compile; then
13784                 yyy=`./try$exe_ext`
13785                 case "$yyy" in
13786                 12345678901)
13787                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
13788                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
13789                         echo "We will use %ld."
13790                         ;;
13791                 esac
13792         fi
13793 fi
13794
13795 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
13796         $cat >try.c <<'EOCP'
13797 #include <sys/types.h>
13798 #include <inttypes.h>
13799 #include <stdio.h>
13800 int main() {
13801   int64_t q = 12345678901;
13802   printf("%" PRId64 "\n", q);
13803 }
13804 EOCP
13805         set try
13806         if eval $compile; then
13807                 yyy=`./try$exe_ext`
13808                 case "$yyy" in
13809                 12345678901)
13810                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
13811                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
13812                         echo "We will use the C9X style."
13813                         ;;
13814                 esac
13815         fi
13816 fi
13817
13818 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
13819         $cat >try.c <<'EOCP'
13820 #include <sys/types.h>
13821 #include <stdio.h>
13822 int main() {
13823   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
13824   printf("%lld\n", q);
13825 }
13826 EOCP
13827         set try
13828         if eval $compile; then
13829                 yyy=`./try$exe_ext`
13830                 case "$yyy" in
13831                 12345678901)
13832                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
13833                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
13834                         echo "We will use the %lld style."
13835                         ;;
13836                 esac
13837         fi
13838 fi
13839
13840 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
13841         $cat >try.c <<EOCP
13842 #include <sys/types.h>
13843 #include <stdio.h>
13844 int main() {
13845   $quadtype q = 12345678901;
13846   printf("%Ld\n", q);
13847 }
13848 EOCP
13849         set try
13850         if eval $compile; then
13851                 yyy=`./try$exe_ext`
13852                 case "$yyy" in
13853                 12345678901)
13854                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
13855                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
13856                         echo "We will use %Ld."
13857                         ;;
13858                 esac
13859         fi
13860 fi
13861
13862 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
13863         $cat >try.c <<EOCP
13864 #include <sys/types.h>
13865 #include <stdio.h>
13866 int main() {
13867   $quadtype q = 12345678901;
13868   printf("%qd\n", q);
13869 }
13870 EOCP
13871         set try
13872         if eval $compile; then
13873                 yyy=`./try$exe_ext`
13874                 case "$yyy" in
13875                 12345678901)
13876                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
13877                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
13878                         echo "We will use %qd."
13879                         ;;
13880                 esac
13881         fi
13882 fi
13883
13884 if $test X"$sPRId64" = X; then
13885         echo "Cannot figure out how to print 64-bit integers." >&4
13886 fi
13887
13888 $rm -f try try.*
13889
13890 fi
13891
13892 case "$sPRId64" in
13893 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef"; 
13894         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef"; 
13895         ;;
13896 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define"; 
13897         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define"; 
13898         ;;
13899 esac
13900
13901
13902 echo " "
13903 $echo "Checking the format strings to be used for Perl's internal types..." >&4
13904
13905 if $test X"$ivsize" = X8; then
13906         ivdformat="$sPRId64"
13907         uvuformat="$sPRIu64"
13908         uvoformat="$sPRIo64"
13909         uvxformat="$sPRIx64"
13910         uvXUformat="$sPRIXU64"
13911 else
13912         if $test X"$ivsize" = X"$longsize"; then
13913                 ivdformat='"ld"'
13914                 uvuformat='"lu"'
13915                 uvoformat='"lo"'
13916                 uvxformat='"lx"'
13917                 uvXUformat='"lX"'
13918         else
13919                 if $test X"$ivsize" = X"$intsize"; then
13920                         ivdformat='"d"'
13921                         uvuformat='"u"'
13922                         uvoformat='"o"'
13923                         uvxformat='"x"'
13924                         uvXUformat='"X"'
13925                 else
13926                         : far out
13927                         if $test X"$ivsize" = X"$shortsize"; then
13928                                 ivdformat='"hd"'
13929                                 uvuformat='"hu"'
13930                                 uvoformat='"ho"'
13931                                 uvxformat='"hx"'
13932                                 uvXUformat='"hX"'
13933                         fi
13934                 fi
13935         fi
13936 fi
13937
13938 if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
13939         nveformat="$sPRIeldbl"
13940         nvfformat="$sPRIfldbl"
13941         nvgformat="$sPRIgldbl"
13942         nvEUformat="$sPRIEUldbl"
13943         nvFUformat="$sPRIFUldbl"
13944         nvGUformat="$sPRIGUldbl"
13945 else
13946         nveformat='"e"'
13947         nvfformat='"f"'
13948         nvgformat='"g"'
13949         nvEUformat='"E"'
13950         nvFUformat='"F"'
13951         nvGUformat='"G"'
13952 fi
13953
13954 case "$ivdformat" in
13955 '') echo "$0: Fatal: failed to find format strings, cannot continue." >& 4
13956     exit 1
13957     ;;
13958 esac
13959
13960
13961 echo " "
13962 $echo "Checking the format string to be used for gids..." >&4
13963
13964 case "$gidsign" in
13965 -1)     if $test X"$gidsize" = X"$ivsize"; then
13966                 gidformat="$ivdformat"
13967         else
13968                 if $test X"$gidsize" = X"$longsize"; then
13969                         gidformat='"ld"'
13970                 else
13971                         if $test X"$gidsize" = X"$intsize"; then
13972                                 gidformat='"d"'
13973                         else
13974                                 if $test X"$gidsize" = X"$shortsize"; then
13975                                         gidformat='"hd"'
13976                                 fi
13977                         fi
13978                 fi
13979         fi
13980         ;;
13981 *)      if $test X"$gidsize" = X"$uvsize"; then
13982                 gidformat="$uvuformat"
13983         else
13984                 if $test X"$gidsize" = X"$longsize"; then
13985                         gidformat='"lu"'
13986                 else
13987                         if $test X"$gidsize" = X"$intsize"; then
13988                                 gidformat='"u"'
13989                         else
13990                                 if $test X"$gidsize" = X"$shortsize"; then
13991                                         gidformat='"hu"'
13992                                 fi
13993                         fi
13994                 fi
13995         fi
13996         ;;
13997 esac
13998
13999 : see if getgroups exists
14000 set getgroups d_getgrps
14001 eval $inlibc
14002
14003 : see if setgroups exists
14004 set setgroups d_setgrps
14005 eval $inlibc
14006
14007
14008 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
14009 echo " "
14010 case "$d_getgrps$d_setgrps" in
14011 *define*)
14012         case "$groupstype" in
14013         '') dflt="$gidtype" ;;
14014         *)  dflt="$groupstype" ;;
14015         esac
14016         $cat <<EOM
14017 What type of pointer is the second argument to getgroups() and setgroups()?
14018 Usually this is the same as group ids, $gidtype, but not always.
14019
14020 EOM
14021         rp='What type pointer is the second argument to getgroups() and setgroups()?'
14022         . ./myread
14023         groupstype="$ans"
14024         ;;
14025 *)  groupstype="$gidtype";;
14026 esac
14027
14028 echo " "
14029 echo "Checking if your $make program sets \$(MAKE)..." >&4
14030 case "$make_set_make" in
14031 '')
14032         $sed 's/^X //' > testmake.mak << 'EOF'
14033 Xall:
14034 X       @echo 'maketemp="$(MAKE)"'
14035 EOF
14036         case "`$make -f testmake.mak 2>/dev/null`" in
14037         *maketemp=*) make_set_make='#' ;;
14038         *)      make_set_make="MAKE=$make" ;;
14039         esac
14040         $rm -f testmake.mak
14041         ;;
14042 esac
14043 case "$make_set_make" in
14044 '#') echo "Yup, it does.";;
14045 *) echo "Nope, it doesn't.";;
14046 esac
14047
14048 : see what type is used for mode_t
14049 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
14050 set mode_t modetype int stdio.h sys/types.h
14051 eval $typedef_ask
14052
14053 : see if stdarg is available
14054 echo " "
14055 if $test `./findhdr stdarg.h`; then
14056         echo "<stdarg.h> found." >&4
14057         valstd="$define"
14058 else
14059         echo "<stdarg.h> NOT found." >&4
14060         valstd="$undef"
14061 fi
14062
14063 : see if varags is available
14064 echo " "
14065 if $test `./findhdr varargs.h`; then
14066         echo "<varargs.h> found." >&4
14067 else
14068         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
14069 fi
14070
14071 : set up the varargs testing programs
14072 $cat > varargs.c <<EOP
14073 #ifdef I_STDARG
14074 #include <stdarg.h>
14075 #endif
14076 #ifdef I_VARARGS
14077 #include <varargs.h>
14078 #endif
14079
14080 #ifdef I_STDARG
14081 int f(char *p, ...)
14082 #else
14083 int f(va_alist)
14084 va_dcl
14085 #endif
14086 {
14087         va_list ap;
14088 #ifndef I_STDARG
14089         char *p;
14090 #endif
14091 #ifdef I_STDARG
14092         va_start(ap,p);
14093 #else
14094         va_start(ap);
14095         p = va_arg(ap, char *);
14096 #endif
14097         va_end(ap);
14098 }
14099 EOP
14100 $cat > varargs <<EOP
14101 $startsh
14102 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
14103         echo "true"
14104 else
14105         echo "false"
14106 fi
14107 $rm -f varargs$_o
14108 EOP
14109 chmod +x varargs
14110
14111 : now check which varargs header should be included
14112 echo " "
14113 i_varhdr=''
14114 case "$valstd" in
14115 "$define")
14116         if `./varargs I_STDARG`; then
14117                 val='stdarg.h'
14118         elif `./varargs I_VARARGS`; then
14119                 val='varargs.h'
14120         fi
14121         ;;
14122 *)
14123         if `./varargs I_VARARGS`; then
14124                 val='varargs.h'
14125         fi
14126         ;;
14127 esac
14128 case "$val" in
14129 '')
14130 echo "I could not find the definition for va_dcl... You have problems..." >&4
14131         val="$undef"; set i_stdarg; eval $setvar
14132         val="$undef"; set i_varargs; eval $setvar
14133         ;;
14134 *) 
14135         set i_varhdr
14136         eval $setvar
14137         case "$i_varhdr" in
14138         stdarg.h)
14139                 val="$define"; set i_stdarg; eval $setvar
14140                 val="$undef"; set i_varargs; eval $setvar
14141                 ;;
14142         varargs.h)
14143                 val="$undef"; set i_stdarg; eval $setvar
14144                 val="$define"; set i_varargs; eval $setvar
14145                 ;;
14146         esac
14147         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
14148 esac
14149 $rm -f varargs*
14150
14151 : see if we need va_copy
14152 echo " "
14153 case "$i_stdarg" in
14154 "$define")
14155         $cat >try.c <<EOCP
14156 #include <stdarg.h>
14157 #include <stdio.h>
14158 #$i_stdlib I_STDLIB
14159 #ifdef I_STDLIB
14160 #include <stdlib.h>
14161 #endif
14162 #include <signal.h>
14163
14164 int
14165 ivfprintf(FILE *f, const char *fmt, va_list *valp)
14166 {
14167   return vfprintf(f, fmt, *valp);
14168 }
14169  
14170 int    
14171 myvfprintf(FILE *f, const  char *fmt, va_list val)
14172 {
14173   return ivfprintf(f, fmt, &val);
14174 }
14175       
14176 int
14177 myprintf(char *fmt, ...) 
14178 {
14179   va_list val;
14180   va_start(val, fmt);
14181   return myvfprintf(stdout, fmt, val); 
14182 }         
14183
14184 int
14185 main(int ac, char **av)
14186 {
14187   signal(SIGSEGV, exit);
14188
14189   myprintf("%s%cs all right, then\n", "that", '\'');                            
14190   exit(0);      
14191 }
14192 EOCP
14193         set try
14194         if eval $compile && ./try 2>&1 >/dev/null; then
14195                 case "`./try`" in
14196                 "that's all right, then")
14197                         okay=yes
14198                         ;;
14199                 esac
14200         fi
14201         case "$okay" in
14202         yes)    echo "It seems that you don't need va_copy()." >&4
14203                 need_va_copy="$undef"
14204                 ;;
14205         *)      echo "It seems that va_copy() or similar will be needed." >&4
14206                 need_va_copy="$define"
14207                 ;;
14208         esac
14209         $rm -f try.* core core.* *.core *.core.*
14210         ;;
14211 *)      echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
14212         ;;
14213 esac
14214
14215 : define a fucntion to check prototypes
14216 $cat > protochk <<EOSH
14217 $startsh
14218 cc="$cc"
14219 optimize="$optimize"
14220 ccflags="$ccflags"
14221 prototype="$prototype"
14222 define="$define"
14223 rm=$rm
14224 EOSH
14225
14226 $cat >> protochk <<'EOSH'
14227
14228 $rm -f try.c
14229 foo="$1"
14230 shift
14231 while test $# -ge 2; do
14232         case "$1" in
14233                 $define) echo "#include <$2>" >> try.c ;;
14234                 literal) echo "$2" >> try.c ;;
14235         esac
14236     shift 2
14237 done
14238 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
14239 cat >> try.c <<'EOCP'
14240 #ifdef CAN_PROTOTYPE
14241 #define _(args) args
14242 #else
14243 #define _(args) ()
14244 #endif
14245 EOCP
14246 echo "$foo" >> try.c
14247 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
14248 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
14249 status=$?
14250 $rm -f try.[co]
14251 exit $status
14252 EOSH
14253 chmod +x protochk
14254 $eunicefix protochk
14255
14256 : see what type is used for size_t
14257 rp="What is the type used for the length parameter for string functions?"
14258 set size_t sizetype 'unsigned int' stdio.h sys/types.h
14259 eval $typedef_ask
14260
14261 : check for type of arguments to gethostbyaddr. 
14262 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
14263         case "$d_gethbyaddr" in
14264         $define)
14265                 $cat <<EOM
14266
14267 Checking to see what type of arguments are accepted by gethostbyaddr().
14268 EOM
14269                 hdrs="$define sys/types.h
14270                         $d_socket sys/socket.h 
14271                         $i_niin netinet/in.h 
14272                         $i_netdb netdb.h
14273                         $i_unistd unistd.h"
14274                 : The first arg can 'char *' or 'void *'
14275                 : The second arg is some of integral type
14276                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
14277                         for yyy in size_t long int; do
14278                                 case "$netdb_host_type" in
14279                                 '')     try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
14280                                         if ./protochk "$try" $hdrs; then
14281                                                 echo "Your system accepts $xxx for the first arg."
14282                                                 echo "...and $yyy for the second arg."
14283                                                 netdb_host_type="$xxx"
14284                                                 netdb_hlen_type="$yyy"
14285                                         fi
14286                                         ;;
14287                                 esac
14288                         done
14289                 done
14290                 : In case none of those worked, prompt the user.
14291                 case "$netdb_host_type" in
14292                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
14293                         dflt='char *'
14294                         . ./myread
14295                         netdb_host_type=$ans
14296                         rp='What is the type for the 2nd argument to gethostbyaddr?'
14297                         dflt="$sizetype"
14298                         . ./myread
14299                         netdb_hlen_type=$ans
14300                         ;;
14301                 esac
14302                 ;;
14303         *)      : no gethostbyaddr, so pick harmless defaults
14304                 netdb_host_type='char *'
14305                 netdb_hlen_type="$sizetype"
14306                 ;;
14307         esac
14308         # Remove the "const" if needed. -- but then we'll have a 
14309         # prototype clash!
14310         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
14311 fi
14312
14313 : check for type of argument to gethostbyname. 
14314 if test "X$netdb_name_type" = X ; then
14315         case "$d_gethbyname" in
14316         $define)
14317                 $cat <<EOM
14318
14319 Checking to see what type of argument is accepted by gethostbyname().
14320 EOM
14321                 hdrs="$define sys/types.h
14322                         $d_socket sys/socket.h 
14323                         $i_niin netinet/in.h 
14324                         $i_netdb netdb.h
14325                         $i_unistd unistd.h"
14326                 for xxx in "const char *" "char *"; do
14327                         case "$netdb_name_type" in
14328                         '')     try="extern struct hostent *gethostbyname($xxx);"
14329                                 if ./protochk "$try" $hdrs; then
14330                                         echo "Your system accepts $xxx."
14331                                         netdb_name_type="$xxx"
14332                                 fi
14333                                 ;;
14334                         esac
14335                 done
14336                 : In case none of those worked, prompt the user.
14337                 case "$netdb_name_type" in
14338                 '')     rp='What is the type for the 1st argument to gethostbyname?'
14339                         dflt='char *'
14340                         . ./myread
14341                         netdb_name_type=$ans
14342                         ;;
14343                 esac
14344                 ;;
14345         *)      : no gethostbyname, so pick harmless default
14346                 netdb_name_type='char *'
14347                 ;;
14348         esac
14349 fi
14350
14351 : check for type of 1st argument to getnetbyaddr. 
14352 if test "X$netdb_net_type" = X ; then
14353         case "$d_getnbyaddr" in
14354         $define)
14355                 $cat <<EOM
14356
14357 Checking to see what type of 1st argument is accepted by getnetbyaddr().
14358 EOM
14359                 hdrs="$define sys/types.h
14360                         $d_socket sys/socket.h 
14361                         $i_niin netinet/in.h 
14362                         $i_netdb netdb.h
14363                         $i_unistd unistd.h"
14364                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
14365                         case "$netdb_net_type" in
14366                         '')     try="extern struct netent *getnetbyaddr($xxx, int);"
14367                                 if ./protochk "$try" $hdrs; then
14368                                         echo "Your system accepts $xxx."
14369                                         netdb_net_type="$xxx"
14370                                 fi
14371                                 ;;
14372                         esac
14373                 done
14374                 : In case none of those worked, prompt the user.
14375                 case "$netdb_net_type" in
14376                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
14377                         dflt='long'
14378                         . ./myread
14379                         netdb_net_type=$ans
14380                         ;;
14381                 esac
14382                 ;;
14383         *)      : no getnetbyaddr, so pick harmless default
14384                 netdb_net_type='long'
14385                 ;;
14386         esac
14387 fi
14388 : locate the preferred pager for this system
14389 case "$pager" in
14390 '')
14391         dflt=''
14392         case "$pg" in
14393         /*) dflt=$pg;;
14394         [a-zA-Z]:/*) dflt=$pg;;
14395         esac
14396         case "$more" in
14397         /*) dflt=$more;;
14398         [a-zA-Z]:/*) dflt=$more;;
14399         esac
14400         case "$less" in
14401         /*) dflt=$less;;
14402         [a-zA-Z]:/*) dflt=$less;;
14403         esac
14404         case "$dflt" in
14405         '') dflt=/usr/ucb/more;;
14406         esac
14407         ;;
14408 *) dflt="$pager";;
14409 esac
14410 echo " "
14411 fn=f/
14412 rp='What pager is used on your system?'
14413 . ./getfile
14414 pager="$ans"
14415
14416 : see what type pids are declared as in the kernel
14417 rp="What is the type of process ids on this system?"
14418 set pid_t pidtype int stdio.h sys/types.h
14419 eval $typedef_ask
14420
14421 : Find earliest binary compatible site_perl subdirectory perl can use.
14422 case "$bincompat5005" in
14423 "$define") xs_apiversion='5.005' ;;
14424 *) xs_apiversion=$version ;;   # The current site_perl version.
14425 esac
14426 : Find earliest pure perl site_perl subdirectory perl can use.
14427 : The versioned directories started at 5.005.
14428 pm_apiversion='5.005'
14429
14430 : see if ar generates random libraries by itself
14431 echo " "
14432 echo "Checking how to generate random libraries on your machine..." >&4
14433 echo 'int bar1() { return bar2(); }' > bar1.c
14434 echo 'int bar2() { return 2; }' > bar2.c
14435 $cat > foo.c <<'EOP'
14436 int main() { printf("%d\n", bar1()); exit(0); }
14437 EOP
14438 $cc $ccflags -c bar1.c >/dev/null 2>&1
14439 $cc $ccflags -c bar2.c >/dev/null 2>&1
14440 $cc $ccflags -c foo.c >/dev/null 2>&1
14441 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
14442 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
14443         ./foobar >/dev/null 2>&1; then
14444         echo "$ar appears to generate random libraries itself."
14445         orderlib=false
14446         ranlib=":"
14447 elif $ar ts bar$_a >/dev/null 2>&1 &&
14448         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
14449         ./foobar >/dev/null 2>&1; then
14450                 echo "a table of contents needs to be added with '$ar ts'."
14451                 orderlib=false
14452                 ranlib="$ar ts"
14453 else
14454         case "$ranlib" in
14455         :) ranlib='';;
14456         '')
14457                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
14458                 $test -f $ranlib || ranlib=''
14459                 ;;
14460         esac
14461         if $test -n "$ranlib"; then
14462                 echo "your system has '$ranlib'; we'll use that."
14463                 orderlib=false
14464         else
14465                 echo "your system doesn't seem to support random libraries"
14466                 echo "so we'll use lorder and tsort to order the libraries."
14467                 orderlib=true
14468                 ranlib=":"
14469         fi
14470 fi
14471 $rm -f foo* bar* 
14472
14473 : check for type of arguments to select. 
14474 case "$selecttype" in
14475 '') case "$d_select" in
14476         $define)
14477                 echo " "
14478                 $cat <<EOM
14479 Checking to see what type of arguments are accepted by select().
14480 EOM
14481                 hdrs="$define sys/types.h
14482                         $i_systime sys/time.h 
14483                         $i_sysselct sys/select.h
14484                         $d_socket sys/socket.h"
14485                 : The first arg can be int, unsigned, or size_t
14486                 : The last arg may or may not be 'const'
14487                 val=''
14488                 : void pointer has been seen but using that
14489                 : breaks the selectminbits test
14490                 for xxx in 'fd_set *' 'int *'; do
14491                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
14492                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
14493                                         case "$val" in
14494                                         '')     try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
14495                                                 if ./protochk "$try" $hdrs; then
14496                                                         echo "Your system accepts $xxx."
14497                                                         val="$xxx"
14498                                                 fi
14499                                                 ;;
14500                                         esac
14501                                 done
14502                         done
14503                 done
14504                 case "$val" in
14505                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
14506                         case "$d_fd_set" in
14507                                 $define) dflt="fd_set *" ;;
14508                                 *)              dflt="int *" ;;
14509                         esac
14510                         . ./myread
14511                         val=$ans
14512                         ;;
14513                 esac
14514                 selecttype="$val"
14515                 ;;
14516         *)      : no select, so pick a harmless default
14517                 selecttype='int *'
14518                 ;;
14519         esac
14520         ;;
14521 esac
14522
14523 : check for the select 'width'
14524 case "$selectminbits" in
14525 '') case "$d_select" in
14526         $define)
14527                 $cat <<EOM
14528
14529 Checking to see on how many bits at a time your select() operates...
14530 EOM
14531                 $cat >try.c <<EOCP
14532 #include <sys/types.h>
14533 #$i_time I_TIME
14534 #$i_systime I_SYS_TIME
14535 #$i_systimek I_SYS_TIME_KERNEL
14536 #ifdef I_TIME
14537 #   include <time.h>
14538 #endif
14539 #ifdef I_SYS_TIME
14540 #   ifdef I_SYS_TIME_KERNEL
14541 #       define KERNEL
14542 #   endif
14543 #   include <sys/time.h>
14544 #   ifdef I_SYS_TIME_KERNEL
14545 #       undef KERNEL
14546 #   endif
14547 #endif
14548 #$i_sysselct I_SYS_SELECT
14549 #ifdef I_SYS_SELECT
14550 #include <sys/select.h>
14551 #endif
14552 #$d_socket HAS_SOCKET
14553 #ifdef HAS_SOCKET
14554 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
14555 #endif
14556 #include <stdio.h>
14557 $selecttype b;
14558 #define S sizeof(*(b))
14559 #define MINBITS 64
14560 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
14561 #define NBITS  (NBYTES * 8)
14562 int main() {
14563     char s[NBYTES];
14564     struct timeval t;
14565     int i;
14566     FILE* fp;
14567     int fd;
14568
14569     fclose(stdin);
14570     fp = fopen("try.c", "r");
14571     if (fp == 0)
14572       exit(1);
14573     fd = fileno(fp);
14574     if (fd < 0)
14575       exit(2);
14576     b = ($selecttype)s;
14577     for (i = 0; i < NBITS; i++)
14578         FD_SET(i, b);
14579     t.tv_sec  = 0;
14580     t.tv_usec = 0;
14581     select(fd + 1, b, 0, 0, &t);
14582     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
14583     printf("%d\n", i + 1);
14584     return 0;
14585 }
14586 EOCP
14587                 set try
14588                 if eval $compile_ok; then
14589                         selectminbits=`./try`
14590                         case "$selectminbits" in
14591                         '')     cat >&4 <<EOM
14592 Cannot figure out on how many bits at a time your select() operates.
14593 I'll play safe and guess it is 32 bits.
14594 EOM
14595                                 selectminbits=32
14596                                 bits="32 bits"
14597                                 ;;
14598                         1)      bits="1 bit" ;;
14599                         *)      bits="$selectminbits bits" ;;
14600                         esac
14601                         echo "Your select() operates on $bits at a time." >&4
14602                 else
14603                         rp='What is the minimum number of bits your select() operates on?'
14604                         case "$byteorder" in
14605                         1234|12345678)  dflt=32 ;;
14606                         *)              dflt=1  ;;
14607                         esac
14608                         . ./myread
14609                         val=$ans
14610                         selectminbits="$val"
14611                 fi
14612                 $rm -f try.* try
14613                 ;;
14614         *)      : no select, so pick a harmless default
14615                 selectminbits='32'
14616                 ;;
14617         esac
14618         ;;
14619 esac
14620
14621 : Trace out the files included by signal.h, then look for SIGxxx names.
14622 : Remove SIGARRAYSIZE used by HPUX.
14623 : Remove SIGSTKSIZE used by Linux.
14624 : Remove SIGSTKSZ used by Posix.
14625 : Remove SIGTYP void lines used by OS2.
14626 : Some cpps, like os390, dont give the file name anywhere
14627 if [ "X$fieldn" = X ]; then
14628         : Just make some guesses.  We check them later.
14629         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
14630 else
14631         xxx=`echo '#include <signal.h>' |
14632         $cppstdin $cppminus $cppflags 2>/dev/null |
14633         $grep '^[       ]*#.*include' | 
14634         $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
14635 fi
14636 : Check this list of files to be sure we have parsed the cpp output ok.
14637 : This will also avoid potentially non-existent files, such 
14638 : as ../foo/bar.h
14639 xxxfiles=''
14640 for xx in $xxx /dev/null ; do
14641         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
14642 done
14643 : If we have found no files, at least try signal.h
14644 case "$xxxfiles" in
14645 '')     xxxfiles=`./findhdr signal.h` ;;
14646 esac
14647 xxx=`awk '
14648 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
14649         print substr($2, 4, 20)
14650 }
14651 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
14652         print substr($3, 4, 20)
14653 }' $xxxfiles`
14654 : Append some common names just in case the awk scan failed.
14655 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
14656 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
14657 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
14658 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
14659 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
14660
14661 : generate a few handy files for later
14662 $cat > signal.c <<'EOCP'
14663 #include <sys/types.h>
14664 #include <signal.h>
14665 #include <stdio.h>
14666 int main() {
14667
14668 /* Strange style to avoid deeply-nested #if/#else/#endif */
14669 #ifndef NSIG
14670 #  ifdef _NSIG
14671 #    define NSIG (_NSIG)
14672 #  endif
14673 #endif
14674
14675 #ifndef NSIG
14676 #  ifdef SIGMAX
14677 #    define NSIG (SIGMAX+1)
14678 #  endif
14679 #endif
14680
14681 #ifndef NSIG
14682 #  ifdef SIG_MAX
14683 #    define NSIG (SIG_MAX+1)
14684 #  endif
14685 #endif
14686
14687 #ifndef NSIG
14688 #  ifdef MAXSIG
14689 #    define NSIG (MAXSIG+1)
14690 #  endif
14691 #endif
14692
14693 #ifndef NSIG
14694 #  ifdef MAX_SIG
14695 #    define NSIG (MAX_SIG+1)
14696 #  endif
14697 #endif
14698
14699 #ifndef NSIG
14700 #  ifdef SIGARRAYSIZE
14701 #    define NSIG (SIGARRAYSIZE+1) /* Not sure of the +1 */
14702 #  endif
14703 #endif
14704
14705 #ifndef NSIG
14706 #  ifdef _sys_nsig
14707 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
14708 #  endif
14709 #endif
14710
14711 /* Default to some arbitrary number that's big enough to get most
14712    of the common signals.
14713 */
14714 #ifndef NSIG
14715 #    define NSIG 50
14716 #endif
14717
14718 printf("NSIG %d\n", NSIG);
14719
14720 #ifndef JUST_NSIG
14721
14722 EOCP
14723
14724 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
14725 {
14726         printf "#ifdef SIG"; printf $1; printf "\n"
14727         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
14728         printf $1; printf ");\n"
14729         printf "#endif\n"
14730 }
14731 END {
14732         printf "#endif /* JUST_NSIG */\n";
14733         printf "exit(0);\n}\n";
14734 }
14735 ' >>signal.c
14736 $cat >signal.awk <<'EOP'
14737 BEGIN { ndups = 0 }
14738 $1 ~ /^NSIG$/ { nsig = $2 }
14739 ($1 !~ /^NSIG$/) && (NF == 2) {
14740     if ($2 > maxsig) { maxsig = $2 }
14741     if (sig_name[$2]) {
14742         dup_name[ndups] = $1
14743         dup_num[ndups] = $2
14744         ndups++ 
14745     }
14746     else {
14747         sig_name[$2] = $1
14748         sig_num[$2] = $2
14749     }
14750 }
14751 END { 
14752     if (nsig == 0) {
14753         nsig = maxsig + 1
14754     }
14755     printf("NSIG %d\n", nsig);
14756     for (n = 1; n < nsig; n++) {
14757         if (sig_name[n]) {
14758             printf("%s %d\n", sig_name[n], sig_num[n])
14759         }
14760         else {
14761             printf("NUM%d %d\n", n, n) 
14762         }
14763     }
14764     for (n = 0; n < ndups; n++) {
14765         printf("%s %d\n", dup_name[n], dup_num[n])
14766     }
14767 }
14768 EOP
14769 $cat >signal_cmd <<EOS
14770 $startsh
14771 if $test -s signal.lst; then
14772     echo "Using your existing signal.lst file"
14773         exit 0
14774 fi
14775 xxx="$xxx"
14776 EOS
14777 $cat >>signal_cmd <<'EOS'
14778
14779 set signal
14780 if eval $compile_ok; then
14781         ./signal$_exe | $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
14782 else
14783         echo "(I can't seem be able to compile the whole test program)" >&4
14784         echo "(I'll try it in little pieces.)" >&4
14785         set signal -DJUST_NSIG
14786         if eval $compile_ok; then
14787                 ./signal$_exe > signal.nsg
14788                 $cat signal.nsg
14789         else
14790                 echo "I can't seem to figure out how many signals you have." >&4
14791                 echo "Guessing 50." >&4
14792                 echo 'NSIG 50' > signal.nsg
14793         fi
14794         : Now look at all the signal names, one at a time.
14795         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
14796                 $cat > signal.c <<EOCP
14797 #include <sys/types.h>
14798 #include <signal.h>
14799 #include <stdio.h>
14800 int main() {
14801 printf("$xx %d\n", SIG${xx});
14802 return 0;
14803 }
14804 EOCP
14805                 set signal
14806                 if eval $compile; then
14807                         echo "SIG${xx} found."
14808                         ./signal$_exe  >> signal.ls1
14809                 else
14810                         echo "SIG${xx} NOT found."
14811                 fi
14812         done
14813         if $test -s signal.ls1; then
14814                 $cat signal.nsg signal.ls1 |
14815                         $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
14816         fi
14817
14818 fi
14819 if $test -s signal.lst; then
14820         :
14821 else
14822         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
14823         echo 'kill -l' >signal
14824         set X `csh -f <signal`
14825         $rm -f signal
14826         shift
14827         case $# in
14828         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
14829         esac
14830         echo $@ | $tr ' ' $trnl | \
14831             $awk '{ printf "%s %d\n", $1, ++s; }
14832                   END { printf "NSIG %d\n", ++s }' >signal.lst
14833 fi
14834 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
14835 EOS
14836 chmod a+x signal_cmd
14837 $eunicefix signal_cmd
14838
14839 : generate list of signal names
14840 echo " "
14841 case "$sig_name_init" in
14842 '') doinit=yes ;;
14843 *)  case "$sig_num_init" in
14844     ''|*,*) doinit=yes ;;
14845     esac ;;
14846 esac
14847 case "$doinit" in
14848 yes)
14849         echo "Generating a list of signal names and numbers..." >&4
14850         . ./signal_cmd
14851         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
14852         sig_name=`$awk 'BEGIN { printf "ZERO " }
14853                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
14854         sig_num=`$awk  'BEGIN { printf "0 " }
14855                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
14856         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
14857                              !/^NSIG/   { printf "\"%s\", ", $1 }
14858                              END        { printf "0\n" }' signal.lst`
14859         sig_num_init=`$awk  'BEGIN      { printf "0, " }
14860                              !/^NSIG/   { printf "%d, ", $2}
14861                              END        { printf "0\n"}' signal.lst`
14862         ;;
14863 esac
14864 echo "The following $sig_count signals are available:"
14865 echo " "
14866 echo $sig_name | $awk \
14867 'BEGIN { linelen = 0 }
14868 {
14869         for (i = 1; i <= NF; i++) {
14870                 name = "SIG" $i " "
14871                 linelen = linelen + length(name)
14872                 if (linelen > 70) {
14873                         printf "\n"
14874                         linelen = length(name)
14875                 }
14876                 printf "%s", name
14877         }
14878         printf "\n"
14879 }'
14880 sig_size=`echo $sig_name | awk '{print NF}'`
14881 $rm -f signal signal.c signal.awk signal.lst signal_cmd 
14882
14883 echo " "
14884 case "$sizetype" in
14885 *_t) zzz="$sizetype"    ;;
14886 *)   zzz="filesize"     ;;
14887 esac
14888 echo "Checking the size of $zzz..." >&4 
14889 cat > try.c <<EOCP
14890 #include <sys/types.h>
14891 #include <stdio.h>
14892 int main() {
14893     printf("%d\n", (int)sizeof($sizetype));
14894     exit(0);
14895 }
14896 EOCP
14897 set try
14898 if eval $compile_ok; then
14899         yyy=`./try`
14900         case "$yyy" in
14901         '')     sizesize=4
14902                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
14903                 ;;
14904         *)      sizesize=$yyy
14905                 echo "Your $zzz size is $sizesize bytes."
14906                 ;;
14907         esac
14908 else
14909         sizesize=4
14910         echo "(I can't compile the test program--guessing $sizesize.)" >&4
14911 fi
14912
14913
14914 : check for socklen_t
14915 echo " "
14916 echo "Checking to see if you have socklen_t..." >&4
14917 $cat >try.c <<EOCP
14918 #include <sys/types.h>
14919 #$d_socket HAS_SOCKET
14920 #ifdef HAS_SOCKET
14921 #include <sys/socket.h>
14922 #endif
14923 int main() { socklen_t x = 16; }
14924 EOCP
14925 set try
14926 if eval $compile; then
14927         val="$define"
14928         echo "You have socklen_t."
14929 else
14930         val="$undef"
14931         echo "You do not have socklen_t."
14932         case "$sizetype" in
14933         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
14934         esac
14935 fi
14936 $rm -f try try.*
14937 set d_socklen_t
14938 eval $setvar
14939
14940 : see if this is a socks.h system
14941 set socks.h i_socks
14942 eval $inhdr
14943
14944 : check for type of the size argument to socket calls
14945 case "$d_socket" in
14946 "$define")
14947         $cat <<EOM
14948
14949 Checking to see what type is the last argument of accept().
14950 EOM
14951         yyy=''
14952         case "$d_socklen_t" in
14953         "$define") yyy="$yyy socklen_t"
14954         esac
14955         yyy="$yyy $sizetype int long unsigned"
14956         for xxx in $yyy; do
14957                 case "$socksizetype" in
14958                 '')     try="extern int accept(int, struct sockaddr *, $xxx *);"
14959                         case "$usesocks" in
14960                         "$define")
14961                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
14962                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
14963                                         socksizetype="$xxx"
14964                                 fi
14965                                 ;;
14966                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
14967                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
14968                                         socksizetype="$xxx"
14969                                 fi
14970                                 ;;
14971                         esac
14972                         ;;
14973                 esac
14974         done
14975 : In case none of those worked, prompt the user.
14976         case "$socksizetype" in
14977         '')     rp='What is the type for socket address structure sizes?'
14978                 dflt='int'
14979                 . ./myread
14980                 socksizetype=$ans
14981                 ;;
14982         esac
14983         ;;
14984 *)      : no sockets, so pick relatively harmless default
14985         socksizetype='int'
14986         ;;
14987 esac
14988
14989 : see what type is used for signed size_t
14990 set ssize_t ssizetype int stdio.h sys/types.h
14991 eval $typedef
14992 dflt="$ssizetype"
14993 $cat > ssize.c <<EOM
14994 #include <stdio.h>
14995 #include <sys/types.h>
14996 #define Size_t $sizetype
14997 #define SSize_t $dflt
14998 int main()
14999 {
15000         if (sizeof(Size_t) == sizeof(SSize_t))
15001                 printf("$dflt\n");
15002         else if (sizeof(Size_t) == sizeof(int))
15003                 printf("int\n");
15004         else 
15005                 printf("long\n");
15006         exit(0);
15007 }
15008 EOM
15009 echo " "
15010 set ssize
15011 if eval $compile_ok && ./ssize > /dev/null; then
15012         ssizetype=`./ssize`
15013         echo "I'll be using $ssizetype for functions returning a byte count." >&4
15014 else
15015         $cat >&4 <<EOM
15016 Help! I can't compile and run the ssize_t test program: please enlighten me!
15017 (This is probably a misconfiguration in your system or libraries, and
15018 you really ought to fix it.  Still, I'll try anyway.)
15019
15020 I need a type that is the same size as $sizetype, but is guaranteed to
15021 be signed.  Common values are ssize_t, int and long.
15022
15023 EOM
15024         rp="What signed type is the same size as $sizetype?"
15025         . ./myread
15026         ssizetype="$ans"
15027 fi
15028 $rm -f ssize ssize.*
15029
15030 : see what type of char stdio uses.
15031 echo " "
15032 echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
15033 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
15034         echo "Your stdio uses unsigned chars." >&4
15035         stdchar="unsigned char"
15036 else
15037         echo "Your stdio uses signed chars." >&4
15038         stdchar="char"
15039 fi
15040 $rm -f stdioh
15041
15042
15043
15044 : see if time exists
15045 echo " "
15046 if test "X$d_time" = X -o X"$timetype" = X; then
15047     if set time val -f d_time; eval $csym; $val; then
15048                 echo 'time() found.' >&4
15049                 val="$define"
15050                 rp="What is the type returned by time() on this system?"
15051                 set time_t timetype long stdio.h sys/types.h
15052                 eval $typedef_ask
15053     else
15054                 echo 'time() not found, hope that will do.' >&4
15055                 val="$undef"
15056                 timetype='int';
15057     fi
15058     set d_time
15059     eval $setvar
15060 fi
15061
15062 : see what type uids are declared as in the kernel
15063 echo " "
15064 echo "Looking for the type for user ids returned by getuid()."
15065 set uid_t uidtype xxx stdio.h sys/types.h
15066 eval $typedef
15067 case "$uidtype" in
15068 xxx)
15069         xxx=`./findhdr sys/user.h`
15070         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
15071         case $1 in
15072         unsigned) dflt="$1 $2" ;;
15073         *) dflt="$1" ;;
15074         esac
15075         ;;
15076 *) dflt="$uidtype";;
15077 esac
15078 case "$uidtype" in
15079 uid_t)  echo "uid_t found." ;;
15080 *)      rp="What is the type for user ids returned by getuid()?"
15081         . ./myread
15082         uidtype="$ans"
15083         ;;
15084 esac
15085
15086 echo " "
15087 case "$uidtype" in
15088 *_t) zzz="$uidtype"     ;;
15089 *)   zzz="uid"          ;;
15090 esac
15091 echo "Checking the size of $zzz..." >&4 
15092 cat > try.c <<EOCP
15093 #include <sys/types.h>
15094 #include <stdio.h>
15095 int main() {
15096     printf("%d\n", (int)sizeof($uidtype));
15097     exit(0);
15098 }
15099 EOCP
15100 set try
15101 if eval $compile_ok; then
15102         yyy=`./try`
15103         case "$yyy" in
15104         '')     uidsize=4
15105                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
15106                 ;;
15107         *)      uidsize=$yyy
15108                 echo "Your $zzz is $uidsize bytes long."
15109                 ;;
15110         esac
15111 else
15112         uidsize=4
15113         echo "(I can't compile the test program--guessing $uidsize.)" >&4
15114 fi
15115
15116 echo " "
15117 case "$uidtype" in
15118 *_t) zzz="$uidtype"     ;;
15119 *)   zzz="uid"          ;;
15120 esac
15121 echo "Checking the sign of $zzz..." >&4
15122 cat > try.c <<EOCP
15123 #include <sys/types.h>
15124 #include <stdio.h>
15125 int main() {
15126         $uidtype foo = -1;
15127         if (foo < 0)
15128                 printf("-1\n");
15129         else
15130                 printf("1\n");
15131 }
15132 EOCP
15133 set try
15134 if eval $compile; then
15135         yyy=`./try`
15136         case "$yyy" in
15137         '')     uidsign=1
15138                 echo "(I can't execute the test program--guessing unsigned.)" >&4
15139                 ;;
15140         *)      uidsign=$yyy
15141                 case "$uidsign" in
15142                  1) echo "Your $zzz is unsigned." ;;
15143                 -1) echo "Your $zzz is signed."   ;;
15144                 esac
15145                 ;;
15146         esac
15147 else
15148         uidsign=1
15149         echo "(I can't compile the test program--guessing unsigned.)" >&4
15150 fi
15151
15152
15153
15154 echo " "
15155 $echo "Checking the format string to be used for uids..." >&4
15156
15157 case "$uidsign" in
15158 -1)     if $test X"$uidsize" = X"$ivsize"; then
15159                 uidformat="$ivdformat"
15160         else
15161                 if $test X"$uidsize" = X"$longsize"; then
15162                         uidformat='"ld"'
15163                 else
15164                         if $test X"$uidsize" = X"$intsize"; then
15165                                 uidformat='"d"'
15166                         else
15167                                 if $test X"$uidsize" = X"$shortsize"; then
15168                                         uidformat='"hd"'
15169                                 fi
15170                         fi
15171                 fi
15172         fi
15173         ;;
15174 *)      if $test X"$uidsize" = X"$uvsize"; then
15175                 uidformat="$uvuformat"
15176         else
15177                 if $test X"$uidsize" = X"$longsize"; then
15178                         uidformat='"lu"'
15179                 else
15180                         if $test X"$uidsize" = X"$intsize"; then
15181                                 uidformat='"u"'
15182                         else
15183                                 if $test X"$uidsize" = X"$shortsize"; then
15184                                         uidformat='"hu"'
15185                                 fi
15186                         fi
15187                 fi
15188         fi
15189         ;;
15190 esac
15191
15192 : determine compiler compiler
15193 case "$yacc" in
15194 '')
15195         dflt=yacc;;
15196 *)
15197         dflt="$yacc";;
15198 esac
15199 echo " "
15200 comp='yacc'
15201 if $test -f "$byacc"; then
15202         dflt="$byacc"
15203         comp="byacc or $comp"
15204 fi
15205 if $test -f "$bison"; then
15206         comp="$comp or bison -y"
15207 fi
15208 rp="Which compiler compiler ($comp) shall I use?"
15209 . ./myread
15210 yacc="$ans"
15211 case "$yacc" in
15212 *bis*)
15213         case "$yacc" in
15214         *-y*) ;;
15215         *)
15216                 yacc="$yacc -y"
15217                 echo "(Adding -y option to bison to get yacc-compatible behaviour.)"
15218                 ;;
15219         esac
15220         ;;
15221 esac
15222
15223 : see if dbm.h is available
15224 : see if dbmclose exists
15225 set dbmclose d_dbmclose
15226 eval $inlibc
15227
15228 case "$d_dbmclose" in
15229 $define)
15230         set dbm.h i_dbm
15231         eval $inhdr
15232         case "$i_dbm" in
15233         $define)
15234                 val="$undef"
15235                 set i_rpcsvcdbm
15236                 eval $setvar
15237                 ;;
15238         *)      set rpcsvc/dbm.h i_rpcsvcdbm
15239                 eval $inhdr
15240                 ;;
15241         esac
15242         ;;
15243 *)      echo "We won't be including <dbm.h>"
15244         val="$undef"
15245         set i_dbm
15246         eval $setvar
15247         val="$undef"
15248         set i_rpcsvcdbm
15249         eval $setvar
15250         ;;
15251 esac
15252
15253 : see if this is a sys/file.h system
15254 val=''
15255 set sys/file.h val
15256 eval $inhdr
15257
15258 : do we need to include sys/file.h ?
15259 case "$val" in
15260 "$define")
15261         echo " "
15262         if $h_sysfile; then
15263                 val="$define"
15264                 echo "We'll be including <sys/file.h>." >&4
15265         else
15266                 val="$undef"
15267                 echo "We won't be including <sys/file.h>." >&4
15268         fi
15269         ;;
15270 *)
15271         h_sysfile=false
15272         ;;
15273 esac
15274 set i_sysfile
15275 eval $setvar
15276
15277 : see if fcntl.h is there
15278 val=''
15279 set fcntl.h val
15280 eval $inhdr
15281
15282 : see if we can include fcntl.h
15283 case "$val" in
15284 "$define")
15285         echo " "
15286         if $h_fcntl; then
15287                 val="$define"
15288                 echo "We'll be including <fcntl.h>." >&4
15289         else
15290                 val="$undef"
15291                 if $h_sysfile; then
15292         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
15293                 else
15294                         echo "We won't be including <fcntl.h>." >&4
15295                 fi
15296         fi
15297         ;;
15298 *)
15299         h_fcntl=false
15300         val="$undef"
15301         ;;
15302 esac
15303 set i_fcntl
15304 eval $setvar
15305
15306 : see if this is a iconv.h system
15307 set iconv.h i_iconv
15308 eval $inhdr
15309
15310 : see if this is a ieeefp.h system
15311 set ieeefp.h i_ieeefp
15312 eval $inhdr
15313
15314 : see if this is a libutil.h system
15315 set libutil.h i_libutil
15316 eval $inhdr
15317
15318 : see if locale.h is available
15319 set locale.h i_locale
15320 eval $inhdr
15321
15322 : see if mach cthreads are available
15323 if test "X$usethreads" = "X$define"; then
15324         set mach/cthreads.h i_machcthr
15325         eval $inhdr
15326 else
15327         i_machcthr="$undef"
15328 fi
15329
15330
15331
15332 : see if this is a math.h system
15333 set math.h i_math
15334 eval $inhdr
15335
15336 : see if this is a mntent.h system
15337 set mntent.h i_mntent
15338 eval $inhdr
15339
15340 : see if ndbm.h is available
15341 set ndbm.h t_ndbm
15342 eval $inhdr
15343 case "$t_ndbm" in
15344 $define)
15345         : see if dbm_open exists
15346         set dbm_open d_dbm_open
15347         eval $inlibc
15348         case "$d_dbm_open" in
15349         $undef)
15350                 t_ndbm="$undef"
15351                 echo "We won't be including <ndbm.h>"
15352                 ;;
15353         esac
15354         ;;
15355 esac
15356 val="$t_ndbm"
15357 set i_ndbm
15358 eval $setvar
15359
15360 : see if net/errno.h is available
15361 val=''
15362 set net/errno.h val
15363 eval $inhdr
15364
15365 : Unfortunately, it causes problems on some systems.  Arrgh.
15366 case "$val" in
15367 $define)
15368         cat > try.c <<'EOM'
15369 #include <stdio.h>
15370 #include <errno.h>
15371 #include <net/errno.h>
15372 int func()
15373 {
15374         return ENOTSOCK;
15375 }
15376 EOM
15377         if $cc $ccflags -c try.c >/dev/null 2>&1; then
15378                 echo "We'll be including <net/errno.h>." >&4
15379         else
15380                 echo "We won't be including <net/errno.h>." >&4
15381                 val="$undef"
15382         fi
15383         $rm -f try.* try
15384         ;;
15385 esac
15386 set i_neterrno
15387 eval $setvar
15388
15389 : see if netinet/tcp.h is available
15390 set netinet/tcp.h i_netinettcp
15391 eval $inhdr
15392
15393 : see if this is a poll.h system
15394 set poll.h i_poll
15395 eval $inhdr
15396
15397 : see if this is a prot.h system
15398 set prot.h i_prot
15399 eval $inhdr
15400
15401 echo " "
15402 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4 
15403 $cat <<'EOSH' > Cppsym.know
15404 a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
15405 AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
15406 alliant alpha am29000 AM29000 AMD64 amiga AMIGAOS AMIX
15407 ansi ANSI_C_SOURCE apollo ardent ARM32 atarist att386 att3b
15408 BeOS BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
15409 BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
15410 bull c cadmus clipper CMU COFF COMPILER_VERSION
15411 concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
15412 CYGWIN DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
15413 Dynix DynixPTX ELF encore EPI EXTENSIONS FILE_OFFSET_BITS
15414 FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
15415 GNU_SOURCE GNUC GNUC_MINOR GO32 gould GOULD_PN
15416 H3050R H3050RX hbullx20 hcx host_mips
15417 hp200 hp300 hp700 HP700 hp800 hp9000
15418 hp9000s200 hp9000s300 hp9000s400 hp9000s500
15419 hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
15420 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
15421 IA64 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
15422 INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
15423 LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
15424 LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
15425 Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
15426 LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
15427 M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
15428 M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
15429 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
15430 MATH_HAS_NO_SIDE_EFFECTS
15431 mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
15432 mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
15433 mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
15434 MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
15435 mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
15436 NetBSD news1500 news1700 news1800 news1900 news3700
15437 news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
15438 ns32016 ns32332 ns32k nsc32000
15439 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
15440 pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
15441 pc532 pdp11 PGC PIC plexus PORTAR posix
15442 POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
15443 POSIX_C_SOURCE POSIX_SOURCE POWER
15444 PROTOTYPES PWB pyr QNX R3000 REENTRANT RES Rhapsody RISC6000
15445 riscix riscos RT S390 SA110 scs SCO sequent sgi SGI_SOURCE SH3 sinix
15446 SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
15447 sony sony_news sonyrisc sparc sparclite spectrum
15448 stardent stdc STDC_EXT stratos sun sun3 sun386
15449 Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
15450 SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
15451 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
15452 sysV68 sysV88 Tek4132 Tek4300 titan
15453 TM3200 TM5400 TM5600
15454 tower tower32 tower32_200 tower32_600 tower32_700
15455 tower32_800 tower32_850 tss
15456 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
15457 ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
15458 unix UNIX95 UNIX99 unixpc unos USGr4 USGr4_2
15459 Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms xenix Xenix286
15460 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
15461 XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
15462 z8000
15463 EOSH
15464 # Maybe put other stuff here too.
15465 cat <<EOSH >>Cppsym.know
15466 $osname
15467 EOSH
15468 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
15469 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
15470 $cat Cppsym.know > Cppsym.c
15471 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
15472 $rm -f Cppsym.a Cppsym.b Cppsym.c
15473 cat <<EOSH > Cppsym
15474 $startsh
15475 if $test \$# -gt 0; then
15476     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
15477     if $test -s Cppsym.got; then
15478         $rm -f Cppsym.got
15479         exit 0
15480     fi
15481     $rm -f Cppsym.got
15482     exit 1
15483 else
15484     $tr " " "$trnl" | ./Cppsym.try
15485     exit 0
15486 fi
15487 EOSH
15488 chmod +x Cppsym
15489 $eunicefix Cppsym
15490 cat <<EOSH > Cppsym.try
15491 $startsh
15492 cat <<'EOCP' > try.c
15493 #include <stdio.h>
15494 int main() {
15495 EOCP
15496 $awk \\
15497 EOSH
15498 cat <<'EOSH' >> Cppsym.try
15499 'length($1) > 0 {
15500     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
15501     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
15502     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
15503     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
15504 }'       >> try.c
15505 echo '}' >> try.c
15506 EOSH
15507 cat <<EOSH >> Cppsym.try
15508 ccflags="$ccflags"
15509 case "$osname-$gccversion" in
15510 irix-) ccflags="\$ccflags -woff 1178" ;;
15511 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
15512 esac
15513 $cc -o try $optimize \$ccflags $ldflags try.c $libs && ./try$exe_ext
15514 EOSH
15515 chmod +x Cppsym.try
15516 $eunicefix Cppsym.try
15517 ./Cppsym < Cppsym.know > Cppsym.true
15518 : now check the C compiler for additional symbols
15519 postprocess_cc_v=''
15520 case "$osname" in
15521 aix) postprocess_cc_v="|$tr , ' '" ;;
15522 esac
15523 $cat >ccsym <<EOS
15524 $startsh
15525 $cat >tmp.c <<EOF
15526 extern int foo;
15527 EOF
15528 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
15529 do
15530         case "\$i" in
15531         -D*) echo "\$i" | $sed 's/^-D//';;
15532         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A\(.*\)(\(.*\))/\1=\2/';;
15533         esac
15534 done
15535 $rm -f try.c
15536 EOS
15537 postprocess_cc_v=''
15538 chmod +x ccsym
15539 $eunicefix ccsym
15540 ./ccsym > ccsym1.raw
15541 if $test -s ccsym1.raw; then
15542        $sort ccsym1.raw | $uniq >ccsym.raw
15543 else
15544        mv ccsym1.raw ccsym.raw
15545 fi
15546
15547 $awk '/\=/ { print $0; next }
15548         { print $0"=1" }' ccsym.raw >ccsym.list
15549 $awk '/\=/ { print $0; next }
15550         { print $0"=1" }' Cppsym.true >ccsym.true
15551 $comm -13 ccsym.true ccsym.list >ccsym.own
15552 $comm -12 ccsym.true ccsym.list >ccsym.com
15553 $comm -23 ccsym.true ccsym.list >ccsym.cpp
15554 also=''
15555 if $test -z ccsym.raw; then
15556         echo "Your C compiler doesn't seem to define any symbols!" >&4
15557         echo " "
15558         echo "However, your C preprocessor defines the following symbols:"
15559         $cat Cppsym.true
15560         ccsymbols=''
15561         cppsymbols=`$cat Cppsym.true`
15562         cppsymbols=`echo $cppsymbols`
15563         cppccsymbols="$cppsymbols"
15564 else
15565         if $test -s ccsym.com; then
15566                 echo "Your C compiler and pre-processor define these symbols:"
15567                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
15568                 also='also '
15569                 symbols='ones'
15570                 cppccsymbols=`$cat ccsym.com`
15571                 cppccsymbols=`echo $cppccsymbols`
15572                 $test "$silent" || sleep 1
15573         fi
15574         if $test -s ccsym.cpp; then
15575                 $test "$also" && echo " "
15576                 echo "Your C pre-processor ${also}defines the following symbols:"
15577                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
15578                 also='further '
15579                 cppsymbols=`$cat ccsym.cpp`
15580                 cppsymbols=`echo $cppsymbols`
15581                 $test "$silent" || sleep 1
15582         fi
15583         if $test -s ccsym.own; then
15584                 $test "$also" && echo " "
15585                 echo "Your C compiler ${also}defines the following cpp symbols:"
15586                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
15587                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
15588                 ccsymbols=`$cat ccsym.own`
15589                 ccsymbols=`echo $ccsymbols`
15590                 $test "$silent" || sleep 1
15591         fi
15592 fi
15593 $rm -f ccsym* Cppsym.*
15594
15595 : see if this is a termio system
15596 val="$undef"
15597 val2="$undef"
15598 val3="$undef"
15599 if $test `./findhdr termios.h`; then
15600         set tcsetattr i_termios
15601         eval $inlibc
15602         val3="$i_termios"
15603 fi
15604 echo " "
15605 case "$val3" in
15606 "$define") echo "You have POSIX termios.h... good!" >&4;;
15607 *) if ./Cppsym pyr; then
15608                 case "`/bin/universe`" in
15609                 ucb) if $test `./findhdr sgtty.h`; then
15610                                 val2="$define"
15611                                 echo "<sgtty.h> found." >&4
15612                         else
15613                                 echo "System is pyramid with BSD universe."
15614                                 echo "<sgtty.h> not found--you could have problems." >&4
15615                         fi;;
15616                 *) if $test `./findhdr termio.h`; then
15617                                 val="$define"
15618                                 echo "<termio.h> found." >&4
15619                         else
15620                                 echo "System is pyramid with USG universe."
15621                                 echo "<termio.h> not found--you could have problems." >&4
15622                         fi;;
15623                 esac
15624         elif ./usg; then
15625                 if $test `./findhdr termio.h`; then
15626                         echo "<termio.h> found." >&4
15627                         val="$define"
15628                 elif $test `./findhdr sgtty.h`; then
15629                         echo "<sgtty.h> found." >&4
15630                         val2="$define"
15631                 else
15632 echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
15633                 fi
15634         else
15635                 if $test `./findhdr sgtty.h`; then
15636                         echo "<sgtty.h> found." >&4
15637                         val2="$define"
15638                 elif $test `./findhdr termio.h`; then
15639                         echo "<termio.h> found." >&4
15640                         val="$define"
15641                 else
15642 echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
15643                 fi
15644         fi;;
15645 esac
15646 set i_termio; eval $setvar
15647 val=$val2; set i_sgtty; eval $setvar
15648 val=$val3; set i_termios; eval $setvar
15649
15650 : see if this is a shadow.h system
15651 set shadow.h i_shadow
15652 eval $inhdr
15653
15654 : see if stddef is available
15655 set stddef.h i_stddef
15656 eval $inhdr
15657
15658 : see if this is a sunmath.h system
15659 set sunmath.h i_sunmath
15660 eval $inhdr
15661
15662 : see if sys/access.h is available
15663 set sys/access.h i_sysaccess
15664 eval $inhdr
15665
15666 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
15667 set sys/filio.h i_sysfilio
15668 eval $inhdr
15669 echo " "
15670 if $test `./findhdr sys/ioctl.h`; then
15671         val="$define"
15672         echo '<sys/ioctl.h> found.' >&4
15673 else
15674         val="$undef"
15675         if $test $i_sysfilio = "$define"; then
15676             echo '<sys/ioctl.h> NOT found.' >&4
15677         else
15678                 $test $i_sgtty = "$define" && xxx="sgtty.h"
15679                 $test $i_termio = "$define" && xxx="termio.h"
15680                 $test $i_termios = "$define" && xxx="termios.h"
15681 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
15682         fi
15683 fi
15684 set i_sysioctl
15685 eval $setvar
15686
15687 : see if socket ioctl defs are in sys/sockio.h
15688 echo " "
15689 xxx=`./findhdr sys/sockio.h`
15690 if $test "$xxx"; then
15691         if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
15692                 val="$define"
15693                 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
15694         else
15695                 val="$undef"
15696                 echo "No socket ioctls found in <sys/sockio.h>." >&4
15697         fi
15698 else
15699         val="$undef"
15700         $cat <<EOM
15701 <sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
15702 EOM
15703 fi
15704 set i_syssockio
15705 eval $setvar
15706
15707
15708 : see if this is a syslog.h system
15709 set syslog.h i_syslog
15710 eval $inhdr
15711
15712
15713 : see if this is a sys/mode.h system
15714 set sys/mode.h i_sysmode
15715 eval $inhdr
15716
15717 : see if sys/resource.h has to be included
15718 set sys/resource.h i_sysresrc
15719 eval $inhdr
15720
15721 : see if sys/security.h is available
15722 set sys/security.h i_syssecrt
15723 eval $inhdr
15724
15725 : see if this is a sys/statvfs.h system
15726 set sys/statvfs.h i_sysstatvfs
15727 eval $inhdr
15728
15729 : see if this is a sys/un.h system
15730 set sys/un.h i_sysun
15731 eval $inhdr
15732
15733
15734 : see if this is a sys/utsname.h system
15735 set sys/utsname.h i_sysutsname
15736 eval $inhdr
15737
15738 : see if this is a syswait system
15739 set sys/wait.h i_syswait
15740 eval $inhdr
15741
15742 : see if this is a ustat.h system
15743 set ustat.h i_ustat
15744 eval $inhdr
15745
15746 : see if this is an utime system
15747 set utime.h i_utime
15748 eval $inhdr
15749
15750 : see if this is a values.h system
15751 set values.h i_values
15752 eval $inhdr
15753
15754 : see if this is a vfork system
15755 case "$d_vfork" in
15756 "$define")
15757         set vfork.h i_vfork
15758         eval $inhdr
15759         ;;
15760 *)
15761         i_vfork="$undef"
15762         ;;
15763 esac
15764
15765 : see if gdbm.h is available
15766 set gdbm.h t_gdbm
15767 eval $inhdr
15768 case "$t_gdbm" in
15769 $define)
15770         : see if gdbm_open exists
15771         set gdbm_open d_gdbm_open
15772         eval $inlibc
15773         case "$d_gdbm_open" in
15774         $undef)
15775                 t_gdbm="$undef"
15776                 echo "We won't be including <gdbm.h>"
15777                 ;;
15778         esac
15779         ;;
15780 esac
15781 val="$t_gdbm"
15782 set i_gdbm
15783 eval $setvar
15784
15785 echo " "
15786 echo "Looking for extensions..." >&4
15787 : If we are using the old config.sh, known_extensions may contain
15788 : old or inaccurate or duplicate values.
15789 known_extensions=''
15790 nonxs_extensions=''
15791 : We do not use find because it might not be available.
15792 : We do not just use MANIFEST because the user may have dropped
15793 : some additional extensions into the source tree and expect them
15794 : to be built.
15795
15796 : Function to recursively find available extensions, ignoring DynaLoader
15797 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
15798 find_extensions='
15799     for xxx in *; do
15800        case "$xxx" in
15801            DynaLoader|dynaload) ;;
15802            *)
15803            if $test -f $xxx/$xxx.xs; then
15804                known_extensions="$known_extensions $1$xxx";
15805            elif $test -f $xxx/Makefile.PL; then
15806                nonxs_extensions="$nonxs_extensions $1$xxx";
15807            else
15808                if $test -d $xxx -a $# -lt 10; then
15809                    set $1$xxx/ $*;
15810                    cd $xxx;
15811                    eval $find_extensions;
15812                    cd ..;
15813                    shift;
15814                fi;
15815            fi
15816            ;;
15817        esac;
15818     done'
15819 tdir=`pwd`
15820 cd $rsrc/ext
15821 set X
15822 shift
15823 eval $find_extensions
15824 set X $nonxs_extensions
15825 shift
15826 nonxs_extensions="$*"
15827 set X $known_extensions
15828 shift
15829 known_extensions="$*"
15830 cd $tdir
15831
15832 : Now see which are supported on this system.
15833 avail_ext=''
15834 for xxx in $known_extensions ; do
15835         case "$xxx" in
15836         DB_File|db_file)
15837                 case "$i_db" in
15838                 $define) avail_ext="$avail_ext $xxx" ;;
15839                 esac
15840                 ;;
15841         GDBM_File|gdbm_fil)
15842                 case "$i_gdbm" in 
15843                 $define) avail_ext="$avail_ext $xxx" ;;
15844                 esac
15845                 ;;
15846         NDBM_File|ndbm_fil)
15847                 case "$i_ndbm" in
15848                 $define)
15849                     case "$osname-$use64bitint" in
15850                     hpux-define)
15851                         case "$libs" in
15852                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
15853                         esac
15854                         ;;
15855                     *) avail_ext="$avail_ext $xxx" ;;
15856                     esac
15857                     ;;
15858                 esac
15859                 ;;
15860         ODBM_File|odbm_fil) 
15861                 case "${i_dbm}${i_rpcsvcdbm}" in
15862                 *"${define}"*)
15863                     case "$osname-$use64bitint" in
15864                     hpux-define)
15865                         case "$libs" in
15866                         *-ldbm*) avail_ext="$avail_ext $xxx" ;;
15867                         esac
15868                         ;;
15869                     *) avail_ext="$avail_ext $xxx" ;;
15870                     esac
15871                     ;;
15872                 esac
15873                 ;;
15874         POSIX|posix)
15875                 case "$useposix" in
15876                 true|define|y) avail_ext="$avail_ext $xxx" ;;
15877                 esac
15878                 ;;
15879         Opcode|opcode)
15880                 case "$useopcode" in
15881                 true|define|y) avail_ext="$avail_ext $xxx" ;;
15882                 esac
15883                 ;;
15884         Socket|socket)
15885                 case "$d_socket" in 
15886                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
15887                 esac
15888                 ;;
15889         Sys/Syslog|sys/syslog)
15890                 : XXX syslog requires socket
15891                 case "$d_socket" in 
15892                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
15893                 esac
15894                 ;;
15895         Thread|thread)
15896                 case "$usethreads" in 
15897                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
15898                 esac
15899                 ;;
15900         IPC/SysV|ipc/sysv)
15901                 : XXX Do we need a useipcsysv variable here
15902                 case "${d_msg}${d_sem}${d_shm}" in 
15903                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
15904                 esac
15905                 ;;
15906         *)      avail_ext="$avail_ext $xxx"
15907                 ;;
15908         esac
15909 done
15910
15911 set X $avail_ext
15912 shift
15913 avail_ext="$*"
15914
15915 : Now see which nonxs extensions are supported on this system.
15916 : For now assume all are.
15917 nonxs_ext=''
15918 for xxx in $nonxs_extensions ; do
15919         case "$xxx" in
15920         *)      nonxs_ext="$nonxs_ext $xxx"
15921                 ;;
15922         esac
15923 done
15924
15925 set X $nonxs_ext
15926 shift
15927 nonxs_ext="$*"
15928
15929 case $usedl in
15930 $define)
15931         $cat <<EOM
15932 A number of extensions are supplied with $package.  You may choose to
15933 compile these extensions for dynamic loading (the default), compile
15934 them into the $package executable (static loading), or not include
15935 them at all.  Answer "none" to include no extensions.
15936 Note that DynaLoader is always built and need not be mentioned here.
15937
15938 EOM
15939         case "$dynamic_ext" in
15940         '') dflt="$avail_ext" ;;
15941         *)      dflt="$dynamic_ext"
15942                 # Perhaps we are reusing an old out-of-date config.sh.
15943                 case "$hint" in
15944                 previous)
15945                         if test X"$dynamic_ext" != X"$avail_ext"; then
15946                                 $cat <<EOM
15947 NOTICE:  Your previous config.sh list may be incorrect. 
15948 The extensions now available to you are 
15949         ${avail_ext}
15950 but the default list from your previous config.sh is
15951         ${dynamic_ext} 
15952
15953 EOM
15954                         fi
15955                         ;;
15956                 esac
15957                 ;;
15958         esac
15959         case "$dflt" in
15960         '')     dflt=none;;
15961         esac
15962         rp="What extensions do you wish to load dynamically?"
15963         . ./myread
15964         case "$ans" in
15965         none) dynamic_ext=' ' ;;
15966         *) dynamic_ext="$ans" ;;
15967         esac
15968
15969         case "$static_ext" in
15970         '')
15971                 : Exclude those already listed in dynamic linking
15972                 dflt=''
15973                 for xxx in $avail_ext; do
15974                         case " $dynamic_ext " in
15975                         *" $xxx "*) ;;
15976                         *) dflt="$dflt $xxx" ;;
15977                         esac
15978                 done
15979                 set X $dflt
15980                 shift
15981                 dflt="$*"
15982                 ;;
15983         *)  dflt="$static_ext" 
15984                 ;;
15985         esac
15986
15987         case "$dflt" in
15988         '')     dflt=none;;
15989         esac
15990         rp="What extensions do you wish to load statically?"
15991         . ./myread
15992         case "$ans" in
15993         none) static_ext=' ' ;;
15994         *) static_ext="$ans" ;;
15995         esac
15996         ;;
15997 *)
15998         $cat <<EOM
15999 A number of extensions are supplied with $package.  Answer "none" 
16000 to include no extensions. 
16001 Note that DynaLoader is always built and need not be mentioned here.
16002
16003 EOM
16004         case "$static_ext" in
16005         '') dflt="$avail_ext" ;;
16006         *)      dflt="$static_ext"
16007                 # Perhaps we are reusing an old out-of-date config.sh.
16008                 case "$hint" in
16009                 previous)
16010                         if test X"$static_ext" != X"$avail_ext"; then
16011                                 $cat <<EOM
16012 NOTICE:  Your previous config.sh list may be incorrect. 
16013 The extensions now available to you are 
16014         ${avail_ext}
16015 but the default list from your previous config.sh is
16016         ${static_ext} 
16017
16018 EOM
16019                         fi
16020                         ;;
16021                 esac
16022                 ;;
16023         esac
16024         : Exclude those that are not xs extensions
16025         case "$dflt" in
16026         '')     dflt=none;;
16027         esac
16028         rp="What extensions do you wish to include?"
16029         . ./myread
16030         case "$ans" in
16031         none) static_ext=' ' ;;
16032         *) static_ext="$ans" ;;
16033         esac
16034         ;;
16035 esac
16036
16037 set X $dynamic_ext $static_ext $nonxs_ext
16038 shift
16039 extensions="$*"
16040
16041 : Remove libraries needed only for extensions
16042 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
16043 : The exception is SunOS 4.x, which needs them.
16044 case "${osname}X${osvers}" in
16045 sunos*X4*)
16046     perllibs="$libs"
16047     ;;
16048 *) case "$usedl" in
16049     $define|true|[yY]*)
16050             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'` 
16051             shift
16052             perllibs="$*"
16053             ;;
16054     *)  perllibs="$libs"
16055             ;;
16056     esac
16057     ;;
16058 esac
16059
16060 : Remove build directory name from cppstdin so it can be used from
16061 : either the present location or the final installed location.
16062 echo " "
16063 : Get out of the UU directory to get correct path name.
16064 cd ..
16065 case "$cppstdin" in
16066 `pwd`/cppstdin)
16067         echo "Stripping down cppstdin path name"
16068         cppstdin=cppstdin
16069         ;;
16070 esac
16071 cd UU
16072
16073 : end of configuration questions
16074 echo " "
16075 echo "End of configuration questions."
16076 echo " "
16077
16078 : back to where it started
16079 if test -d ../UU; then
16080         cd ..
16081 fi
16082
16083 : configuration may be patched via a 'config.over' file
16084 if $test -f config.over; then
16085         echo " "
16086         dflt=y
16087         rp='I see a config.over file.  Do you wish to load it?'
16088         . UU/myread
16089         case "$ans" in
16090         n*) echo "OK, I'll ignore it.";;
16091         *)      . ./config.over
16092                 echo "Configuration override changes have been loaded."
16093                 ;;
16094         esac
16095 fi
16096
16097 : in case they want portability, strip down executable paths
16098 case "$d_portable" in
16099 "$define")
16100         echo " "
16101         echo "Stripping down executable paths..." >&4
16102         for file in $loclist $trylist; do
16103                 eval temp=\$$file
16104                 eval $file=`basename $temp`
16105         done
16106         ;;
16107 esac
16108
16109 : create config.sh file
16110 echo " "
16111 echo "Creating config.sh..." >&4
16112 $spitshell <<EOT >config.sh
16113 $startsh
16114 #
16115 # This file was produced by running the Configure script. It holds all the
16116 # definitions figured out by Configure. Should you modify one of these values,
16117 # do not forget to propagate your changes by running "Configure -der". You may
16118 # instead choose to run each of the .SH files by yourself, or "Configure -S".
16119 #
16120
16121 # Package name      : $package
16122 # Source directory  : $src
16123 # Configuration time: $cf_time
16124 # Configured by     : $cf_by
16125 # Target system     : $myuname
16126
16127 Author='$Author'
16128 Date='$Date'
16129 Header='$Header'
16130 Id='$Id'
16131 Locker='$Locker'
16132 Log='$Log'
16133 Mcc='$Mcc'
16134 RCSfile='$RCSfile'
16135 Revision='$Revision'
16136 Source='$Source'
16137 State='$State'
16138 _a='$_a'
16139 _exe='$_exe'
16140 _o='$_o'
16141 afs='$afs'
16142 afsroot='$afsroot'
16143 alignbytes='$alignbytes'
16144 ansi2knr='$ansi2knr'
16145 aphostname='$aphostname'
16146 api_revision='$api_revision'
16147 api_subversion='$api_subversion'
16148 api_version='$api_version'
16149 api_versionstring='$api_versionstring'
16150 ar='$ar'
16151 archlib='$archlib'
16152 archlibexp='$archlibexp'
16153 archname64='$archname64'
16154 archname='$archname'
16155 archobjs='$archobjs'
16156 awk='$awk'
16157 baserev='$baserev'
16158 bash='$bash'
16159 bin='$bin'
16160 bincompat5005='$bincompat5005'
16161 binexp='$binexp'
16162 bison='$bison'
16163 byacc='$byacc'
16164 byteorder='$byteorder'
16165 c='$c'
16166 castflags='$castflags'
16167 cat='$cat'
16168 cc='$cc'
16169 cccdlflags='$cccdlflags'
16170 ccdlflags='$ccdlflags'
16171 ccflags='$ccflags'
16172 ccflags_uselargefiles='$ccflags_uselargefiles'
16173 ccname='$ccname'
16174 ccsymbols='$ccsymbols'
16175 ccversion='$ccversion'
16176 cf_by='$cf_by'
16177 cf_email='$cf_email'
16178 cf_time='$cf_time'
16179 charsize='$charsize'
16180 chgrp='$chgrp'
16181 chmod='$chmod'
16182 chown='$chown'
16183 clocktype='$clocktype'
16184 comm='$comm'
16185 compress='$compress'
16186 contains='$contains'
16187 cp='$cp'
16188 cpio='$cpio'
16189 cpp='$cpp'
16190 cpp_stuff='$cpp_stuff'
16191 cppccsymbols='$cppccsymbols'
16192 cppflags='$cppflags'
16193 cpplast='$cpplast'
16194 cppminus='$cppminus'
16195 cpprun='$cpprun'
16196 cppstdin='$cppstdin'
16197 cppsymbols='$cppsymbols'
16198 crosscompile='$crosscompile'
16199 cryptlib='$cryptlib'
16200 csh='$csh'
16201 d_Gconvert='$d_Gconvert'
16202 d_PRIEUldbl='$d_PRIEUldbl'
16203 d_PRIFUldbl='$d_PRIFUldbl'
16204 d_PRIGUldbl='$d_PRIGUldbl'
16205 d_PRIXU64='$d_PRIXU64'
16206 d_PRId64='$d_PRId64'
16207 d_PRIeldbl='$d_PRIeldbl'
16208 d_PRIfldbl='$d_PRIfldbl'
16209 d_PRIgldbl='$d_PRIgldbl'
16210 d_PRIi64='$d_PRIi64'
16211 d_PRIo64='$d_PRIo64'
16212 d_PRIu64='$d_PRIu64'
16213 d_PRIx64='$d_PRIx64'
16214 d_SCNfldbl='$d_SCNfldbl'
16215 d__fwalk='$d__fwalk'
16216 d_access='$d_access'
16217 d_accessx='$d_accessx'
16218 d_alarm='$d_alarm'
16219 d_archlib='$d_archlib'
16220 d_atolf='$d_atolf'
16221 d_atoll='$d_atoll'
16222 d_attribut='$d_attribut'
16223 d_bcmp='$d_bcmp'
16224 d_bcopy='$d_bcopy'
16225 d_bincompat5005='$d_bincompat5005'
16226 d_bsd='$d_bsd'
16227 d_bsdgetpgrp='$d_bsdgetpgrp'
16228 d_bsdsetpgrp='$d_bsdsetpgrp'
16229 d_bzero='$d_bzero'
16230 d_casti32='$d_casti32'
16231 d_castneg='$d_castneg'
16232 d_charvspr='$d_charvspr'
16233 d_chown='$d_chown'
16234 d_chroot='$d_chroot'
16235 d_chsize='$d_chsize'
16236 d_closedir='$d_closedir'
16237 d_cmsghdr_s='$d_cmsghdr_s'
16238 d_const='$d_const'
16239 d_crypt='$d_crypt'
16240 d_csh='$d_csh'
16241 d_cuserid='$d_cuserid'
16242 d_dbl_dig='$d_dbl_dig'
16243 d_difftime='$d_difftime'
16244 d_dirnamlen='$d_dirnamlen'
16245 d_dlerror='$d_dlerror'
16246 d_dlopen='$d_dlopen'
16247 d_dlsymun='$d_dlsymun'
16248 d_dosuid='$d_dosuid'
16249 d_drand48proto='$d_drand48proto'
16250 d_dup2='$d_dup2'
16251 d_eaccess='$d_eaccess'
16252 d_endgrent='$d_endgrent'
16253 d_endhent='$d_endhent'
16254 d_endnent='$d_endnent'
16255 d_endpent='$d_endpent'
16256 d_endpwent='$d_endpwent'
16257 d_endsent='$d_endsent'
16258 d_eofnblk='$d_eofnblk'
16259 d_eunice='$d_eunice'
16260 d_fchmod='$d_fchmod'
16261 d_fchown='$d_fchown'
16262 d_fcntl='$d_fcntl'
16263 d_fcntl_can_lock='$d_fcntl_can_lock'
16264 d_fd_macros='$d_fd_macros'
16265 d_fd_set='$d_fd_set'
16266 d_fds_bits='$d_fds_bits'
16267 d_fgetpos='$d_fgetpos'
16268 d_flexfnam='$d_flexfnam'
16269 d_flock='$d_flock'
16270 d_fork='$d_fork'
16271 d_fpathconf='$d_fpathconf'
16272 d_fpos64_t='$d_fpos64_t'
16273 d_frexpl='$d_frexpl'
16274 d_fs_data_s='$d_fs_data_s'
16275 d_fseeko='$d_fseeko'
16276 d_fsetpos='$d_fsetpos'
16277 d_fstatfs='$d_fstatfs'
16278 d_fstatvfs='$d_fstatvfs'
16279 d_fsync='$d_fsync'
16280 d_ftello='$d_ftello'
16281 d_ftime='$d_ftime'
16282 d_getcwd='$d_getcwd'
16283 d_getespwnam='$d_getespwnam'
16284 d_getfsstat='$d_getfsstat'
16285 d_getgrent='$d_getgrent'
16286 d_getgrps='$d_getgrps'
16287 d_gethbyaddr='$d_gethbyaddr'
16288 d_gethbyname='$d_gethbyname'
16289 d_gethent='$d_gethent'
16290 d_gethname='$d_gethname'
16291 d_gethostprotos='$d_gethostprotos'
16292 d_getitimer='$d_getitimer'
16293 d_getlogin='$d_getlogin'
16294 d_getmnt='$d_getmnt'
16295 d_getmntent='$d_getmntent'
16296 d_getnbyaddr='$d_getnbyaddr'
16297 d_getnbyname='$d_getnbyname'
16298 d_getnent='$d_getnent'
16299 d_getnetprotos='$d_getnetprotos'
16300 d_getpagsz='$d_getpagsz'
16301 d_getpbyname='$d_getpbyname'
16302 d_getpbynumber='$d_getpbynumber'
16303 d_getpent='$d_getpent'
16304 d_getpgid='$d_getpgid'
16305 d_getpgrp2='$d_getpgrp2'
16306 d_getpgrp='$d_getpgrp'
16307 d_getppid='$d_getppid'
16308 d_getprior='$d_getprior'
16309 d_getprotoprotos='$d_getprotoprotos'
16310 d_getprpwnam='$d_getprpwnam'
16311 d_getpwent='$d_getpwent'
16312 d_getsbyname='$d_getsbyname'
16313 d_getsbyport='$d_getsbyport'
16314 d_getsent='$d_getsent'
16315 d_getservprotos='$d_getservprotos'
16316 d_getspnam='$d_getspnam'
16317 d_gettimeod='$d_gettimeod'
16318 d_gnulibc='$d_gnulibc'
16319 d_grpasswd='$d_grpasswd'
16320 d_hasmntopt='$d_hasmntopt'
16321 d_htonl='$d_htonl'
16322 d_iconv='$d_iconv'
16323 d_index='$d_index'
16324 d_inetaton='$d_inetaton'
16325 d_int64_t='$d_int64_t'
16326 d_isascii='$d_isascii'
16327 d_isnan='$d_isnan'
16328 d_isnanl='$d_isnanl'
16329 d_killpg='$d_killpg'
16330 d_lchown='$d_lchown'
16331 d_ldbl_dig='$d_ldbl_dig'
16332 d_link='$d_link'
16333 d_locconv='$d_locconv'
16334 d_lockf='$d_lockf'
16335 d_longdbl='$d_longdbl'
16336 d_longlong='$d_longlong'
16337 d_lseekproto='$d_lseekproto'
16338 d_lstat='$d_lstat'
16339 d_madvise='$d_madvise'
16340 d_mblen='$d_mblen'
16341 d_mbstowcs='$d_mbstowcs'
16342 d_mbtowc='$d_mbtowc'
16343 d_memchr='$d_memchr'
16344 d_memcmp='$d_memcmp'
16345 d_memcpy='$d_memcpy'
16346 d_memmove='$d_memmove'
16347 d_memset='$d_memset'
16348 d_mkdir='$d_mkdir'
16349 d_mkdtemp='$d_mkdtemp'
16350 d_mkfifo='$d_mkfifo'
16351 d_mkstemp='$d_mkstemp'
16352 d_mkstemps='$d_mkstemps'
16353 d_mktime='$d_mktime'
16354 d_mmap='$d_mmap'
16355 d_modfl='$d_modfl'
16356 d_mprotect='$d_mprotect'
16357 d_msg='$d_msg'
16358 d_msg_ctrunc='$d_msg_ctrunc'
16359 d_msg_dontroute='$d_msg_dontroute'
16360 d_msg_oob='$d_msg_oob'
16361 d_msg_peek='$d_msg_peek'
16362 d_msg_proxy='$d_msg_proxy'
16363 d_msgctl='$d_msgctl'
16364 d_msgget='$d_msgget'
16365 d_msghdr_s='$d_msghdr_s'
16366 d_msgrcv='$d_msgrcv'
16367 d_msgsnd='$d_msgsnd'
16368 d_msync='$d_msync'
16369 d_munmap='$d_munmap'
16370 d_mymalloc='$d_mymalloc'
16371 d_nice='$d_nice'
16372 d_nv_preserves_uv='$d_nv_preserves_uv'
16373 d_nv_preserves_uv_bits='$d_nv_preserves_uv_bits'
16374 d_off64_t='$d_off64_t'
16375 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
16376 d_oldpthreads='$d_oldpthreads'
16377 d_oldsock='$d_oldsock'
16378 d_open3='$d_open3'
16379 d_pathconf='$d_pathconf'
16380 d_pause='$d_pause'
16381 d_perl_otherlibdirs='$d_perl_otherlibdirs'
16382 d_phostname='$d_phostname'
16383 d_pipe='$d_pipe'
16384 d_poll='$d_poll'
16385 d_portable='$d_portable'
16386 d_pthread_yield='$d_pthread_yield'
16387 d_pwage='$d_pwage'
16388 d_pwchange='$d_pwchange'
16389 d_pwclass='$d_pwclass'
16390 d_pwcomment='$d_pwcomment'
16391 d_pwexpire='$d_pwexpire'
16392 d_pwgecos='$d_pwgecos'
16393 d_pwpasswd='$d_pwpasswd'
16394 d_pwquota='$d_pwquota'
16395 d_qgcvt='$d_qgcvt'
16396 d_quad='$d_quad'
16397 d_readdir='$d_readdir'
16398 d_readlink='$d_readlink'
16399 d_readv='$d_readv'
16400 d_realpath='$d_realpath'
16401 d_recvmsg='$d_recvmsg'
16402 d_rename='$d_rename'
16403 d_rewinddir='$d_rewinddir'
16404 d_rmdir='$d_rmdir'
16405 d_safebcpy='$d_safebcpy'
16406 d_safemcpy='$d_safemcpy'
16407 d_sanemcmp='$d_sanemcmp'
16408 d_sbrkproto='$d_sbrkproto'
16409 d_sched_yield='$d_sched_yield'
16410 d_scm_rights='$d_scm_rights'
16411 d_seekdir='$d_seekdir'
16412 d_select='$d_select'
16413 d_sem='$d_sem'
16414 d_semctl='$d_semctl'
16415 d_semctl_semid_ds='$d_semctl_semid_ds'
16416 d_semctl_semun='$d_semctl_semun'
16417 d_semget='$d_semget'
16418 d_semop='$d_semop'
16419 d_sendmsg='$d_sendmsg'
16420 d_setegid='$d_setegid'
16421 d_seteuid='$d_seteuid'
16422 d_setgrent='$d_setgrent'
16423 d_setgrps='$d_setgrps'
16424 d_sethent='$d_sethent'
16425 d_setitimer='$d_setitimer'
16426 d_setlinebuf='$d_setlinebuf'
16427 d_setlocale='$d_setlocale'
16428 d_setnent='$d_setnent'
16429 d_setpent='$d_setpent'
16430 d_setpgid='$d_setpgid'
16431 d_setpgrp2='$d_setpgrp2'
16432 d_setpgrp='$d_setpgrp'
16433 d_setprior='$d_setprior'
16434 d_setproctitle='$d_setproctitle'
16435 d_setpwent='$d_setpwent'
16436 d_setregid='$d_setregid'
16437 d_setresgid='$d_setresgid'
16438 d_setresuid='$d_setresuid'
16439 d_setreuid='$d_setreuid'
16440 d_setrgid='$d_setrgid'
16441 d_setruid='$d_setruid'
16442 d_setsent='$d_setsent'
16443 d_setsid='$d_setsid'
16444 d_setvbuf='$d_setvbuf'
16445 d_sfio='$d_sfio'
16446 d_shm='$d_shm'
16447 d_shmat='$d_shmat'
16448 d_shmatprototype='$d_shmatprototype'
16449 d_shmctl='$d_shmctl'
16450 d_shmdt='$d_shmdt'
16451 d_shmget='$d_shmget'
16452 d_sigaction='$d_sigaction'
16453 d_sigprocmask='$d_sigprocmask'
16454 d_sigsetjmp='$d_sigsetjmp'
16455 d_sockatmark='$d_sockatmark'
16456 d_socket='$d_socket'
16457 d_socklen_t='$d_socklen_t'
16458 d_sockpair='$d_sockpair'
16459 d_socks5_init='$d_socks5_init'
16460 d_sqrtl='$d_sqrtl'
16461 d_sresuproto='$d_sresuproto'
16462 d_statblks='$d_statblks'
16463 d_statfs_f_flags='$d_statfs_f_flags'
16464 d_statfs_s='$d_statfs_s'
16465 d_statvfs='$d_statvfs'
16466 d_stdio_cnt_lval='$d_stdio_cnt_lval'
16467 d_stdio_ptr_lval='$d_stdio_ptr_lval'
16468 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
16469 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
16470 d_stdio_stream_array='$d_stdio_stream_array'
16471 d_stdiobase='$d_stdiobase'
16472 d_stdstdio='$d_stdstdio'
16473 d_strchr='$d_strchr'
16474 d_strcoll='$d_strcoll'
16475 d_strctcpy='$d_strctcpy'
16476 d_strerrm='$d_strerrm'
16477 d_strerror='$d_strerror'
16478 d_strftime='$d_strftime'
16479 d_strtod='$d_strtod'
16480 d_strtol='$d_strtol'
16481 d_strtold='$d_strtold'
16482 d_strtoll='$d_strtoll'
16483 d_strtoq='$d_strtoq'
16484 d_strtoul='$d_strtoul'
16485 d_strtoull='$d_strtoull'
16486 d_strtouq='$d_strtouq'
16487 d_strxfrm='$d_strxfrm'
16488 d_suidsafe='$d_suidsafe'
16489 d_symlink='$d_symlink'
16490 d_syscall='$d_syscall'
16491 d_sysconf='$d_sysconf'
16492 d_sysernlst='$d_sysernlst'
16493 d_syserrlst='$d_syserrlst'
16494 d_system='$d_system'
16495 d_tcgetpgrp='$d_tcgetpgrp'
16496 d_tcsetpgrp='$d_tcsetpgrp'
16497 d_telldir='$d_telldir'
16498 d_telldirproto='$d_telldirproto'
16499 d_time='$d_time'
16500 d_times='$d_times'
16501 d_truncate='$d_truncate'
16502 d_tzname='$d_tzname'
16503 d_u32align='$d_u32align'
16504 d_ualarm='$d_ualarm'
16505 d_umask='$d_umask'
16506 d_uname='$d_uname'
16507 d_union_semun='$d_union_semun'
16508 d_usleep='$d_usleep'
16509 d_ustat='$d_ustat'
16510 d_vendorarch='$d_vendorarch'
16511 d_vendorbin='$d_vendorbin'
16512 d_vendorlib='$d_vendorlib'
16513 d_vfork='$d_vfork'
16514 d_void_closedir='$d_void_closedir'
16515 d_voidsig='$d_voidsig'
16516 d_voidtty='$d_voidtty'
16517 d_volatile='$d_volatile'
16518 d_vprintf='$d_vprintf'
16519 d_wait4='$d_wait4'
16520 d_waitpid='$d_waitpid'
16521 d_wcstombs='$d_wcstombs'
16522 d_wctomb='$d_wctomb'
16523 d_writev='$d_writev'
16524 d_xenix='$d_xenix'
16525 date='$date'
16526 db_hashtype='$db_hashtype'
16527 db_prefixtype='$db_prefixtype'
16528 db_version_major='$db_version_major'
16529 db_version_minor='$db_version_minor'
16530 db_version_patch='$db_version_patch'
16531 defvoidused='$defvoidused'
16532 direntrytype='$direntrytype'
16533 dlext='$dlext'
16534 dlsrc='$dlsrc'
16535 doublesize='$doublesize'
16536 drand01='$drand01'
16537 dynamic_ext='$dynamic_ext'
16538 eagain='$eagain'
16539 ebcdic='$ebcdic'
16540 echo='$echo'
16541 egrep='$egrep'
16542 emacs='$emacs'
16543 eunicefix='$eunicefix'
16544 exe_ext='$exe_ext'
16545 expr='$expr'
16546 extensions='$extensions'
16547 fflushNULL='$fflushNULL'
16548 fflushall='$fflushall'
16549 find='$find'
16550 firstmakefile='$firstmakefile'
16551 flex='$flex'
16552 fpossize='$fpossize'
16553 fpostype='$fpostype'
16554 freetype='$freetype'
16555 full_ar='$full_ar'
16556 full_csh='$full_csh'
16557 full_sed='$full_sed'
16558 gccosandvers='$gccosandvers'
16559 gccversion='$gccversion'
16560 gidformat='$gidformat'
16561 gidsign='$gidsign'
16562 gidsize='$gidsize'
16563 gidtype='$gidtype'
16564 glibpth='$glibpth'
16565 grep='$grep'
16566 groupcat='$groupcat'
16567 groupstype='$groupstype'
16568 gzip='$gzip'
16569 h_fcntl='$h_fcntl'
16570 h_sysfile='$h_sysfile'
16571 hint='$hint'
16572 hostcat='$hostcat'
16573 i16size='$i16size'
16574 i16type='$i16type'
16575 i32size='$i32size'
16576 i32type='$i32type'
16577 i64size='$i64size'
16578 i64type='$i64type'
16579 i8size='$i8size'
16580 i8type='$i8type'
16581 i_arpainet='$i_arpainet'
16582 i_bsdioctl='$i_bsdioctl'
16583 i_db='$i_db'
16584 i_dbm='$i_dbm'
16585 i_dirent='$i_dirent'
16586 i_dld='$i_dld'
16587 i_dlfcn='$i_dlfcn'
16588 i_fcntl='$i_fcntl'
16589 i_float='$i_float'
16590 i_gdbm='$i_gdbm'
16591 i_grp='$i_grp'
16592 i_iconv='$i_iconv'
16593 i_ieeefp='$i_ieeefp'
16594 i_inttypes='$i_inttypes'
16595 i_libutil='$i_libutil'
16596 i_limits='$i_limits'
16597 i_locale='$i_locale'
16598 i_machcthr='$i_machcthr'
16599 i_malloc='$i_malloc'
16600 i_math='$i_math'
16601 i_memory='$i_memory'
16602 i_mntent='$i_mntent'
16603 i_ndbm='$i_ndbm'
16604 i_netdb='$i_netdb'
16605 i_neterrno='$i_neterrno'
16606 i_netinettcp='$i_netinettcp'
16607 i_niin='$i_niin'
16608 i_poll='$i_poll'
16609 i_prot='$i_prot'
16610 i_pthread='$i_pthread'
16611 i_pwd='$i_pwd'
16612 i_rpcsvcdbm='$i_rpcsvcdbm'
16613 i_sfio='$i_sfio'
16614 i_sgtty='$i_sgtty'
16615 i_shadow='$i_shadow'
16616 i_socks='$i_socks'
16617 i_stdarg='$i_stdarg'
16618 i_stddef='$i_stddef'
16619 i_stdlib='$i_stdlib'
16620 i_string='$i_string'
16621 i_sunmath='$i_sunmath'
16622 i_sysaccess='$i_sysaccess'
16623 i_sysdir='$i_sysdir'
16624 i_sysfile='$i_sysfile'
16625 i_sysfilio='$i_sysfilio'
16626 i_sysin='$i_sysin'
16627 i_sysioctl='$i_sysioctl'
16628 i_syslog='$i_syslog'
16629 i_sysmman='$i_sysmman'
16630 i_sysmode='$i_sysmode'
16631 i_sysmount='$i_sysmount'
16632 i_sysndir='$i_sysndir'
16633 i_sysparam='$i_sysparam'
16634 i_sysresrc='$i_sysresrc'
16635 i_syssecrt='$i_syssecrt'
16636 i_sysselct='$i_sysselct'
16637 i_syssockio='$i_syssockio'
16638 i_sysstat='$i_sysstat'
16639 i_sysstatfs='$i_sysstatfs'
16640 i_sysstatvfs='$i_sysstatvfs'
16641 i_systime='$i_systime'
16642 i_systimek='$i_systimek'
16643 i_systimes='$i_systimes'
16644 i_systypes='$i_systypes'
16645 i_sysuio='$i_sysuio'
16646 i_sysun='$i_sysun'
16647 i_sysutsname='$i_sysutsname'
16648 i_sysvfs='$i_sysvfs'
16649 i_syswait='$i_syswait'
16650 i_termio='$i_termio'
16651 i_termios='$i_termios'
16652 i_time='$i_time'
16653 i_unistd='$i_unistd'
16654 i_ustat='$i_ustat'
16655 i_utime='$i_utime'
16656 i_values='$i_values'
16657 i_varargs='$i_varargs'
16658 i_varhdr='$i_varhdr'
16659 i_vfork='$i_vfork'
16660 ignore_versioned_solibs='$ignore_versioned_solibs'
16661 inc_version_list='$inc_version_list'
16662 inc_version_list_init='$inc_version_list_init'
16663 incpath='$incpath'
16664 inews='$inews'
16665 installarchlib='$installarchlib'
16666 installbin='$installbin'
16667 installman1dir='$installman1dir'
16668 installman3dir='$installman3dir'
16669 installprefix='$installprefix'
16670 installprefixexp='$installprefixexp'
16671 installprivlib='$installprivlib'
16672 installscript='$installscript'
16673 installsitearch='$installsitearch'
16674 installsitebin='$installsitebin'
16675 installsitelib='$installsitelib'
16676 installstyle='$installstyle'
16677 installusrbinperl='$installusrbinperl'
16678 installvendorarch='$installvendorarch'
16679 installvendorbin='$installvendorbin'
16680 installvendorlib='$installvendorlib'
16681 intsize='$intsize'
16682 issymlink='$issymlink'
16683 ivdformat='$ivdformat'
16684 ivsize='$ivsize'
16685 ivtype='$ivtype'
16686 known_extensions='$known_extensions'
16687 ksh='$ksh'
16688 ld='$ld'
16689 lddlflags='$lddlflags'
16690 ldflags='$ldflags'
16691 ldflags_uselargefiles='$ldflags_uselargefiles'
16692 ldlibpthname='$ldlibpthname'
16693 less='$less'
16694 lib_ext='$lib_ext'
16695 libc='$libc'
16696 libperl='$libperl'
16697 libpth='$libpth'
16698 libs='$libs'
16699 libsdirs='$libsdirs'
16700 libsfiles='$libsfiles'
16701 libsfound='$libsfound'
16702 libspath='$libspath'
16703 libswanted='$libswanted'
16704 libswanted_uselargefiles='$libswanted_uselargefiles'
16705 line='$line'
16706 lint='$lint'
16707 lkflags='$lkflags'
16708 ln='$ln'
16709 lns='$lns'
16710 locincpth='$locincpth'
16711 loclibpth='$loclibpth'
16712 longdblsize='$longdblsize'
16713 longlongsize='$longlongsize'
16714 longsize='$longsize'
16715 lp='$lp'
16716 lpr='$lpr'
16717 ls='$ls'
16718 lseeksize='$lseeksize'
16719 lseektype='$lseektype'
16720 mail='$mail'
16721 mailx='$mailx'
16722 make='$make'
16723 make_set_make='$make_set_make'
16724 mallocobj='$mallocobj'
16725 mallocsrc='$mallocsrc'
16726 malloctype='$malloctype'
16727 man1dir='$man1dir'
16728 man1direxp='$man1direxp'
16729 man1ext='$man1ext'
16730 man3dir='$man3dir'
16731 man3direxp='$man3direxp'
16732 man3ext='$man3ext'
16733 mips_type='$mips_type'
16734 mkdir='$mkdir'
16735 mmaptype='$mmaptype'
16736 modetype='$modetype'
16737 more='$more'
16738 multiarch='$multiarch'
16739 mv='$mv'
16740 myarchname='$myarchname'
16741 mydomain='$mydomain'
16742 myhostname='$myhostname'
16743 myuname='$myuname'
16744 n='$n'
16745 need_va_copy='$need_va_copy'
16746 netdb_hlen_type='$netdb_hlen_type'
16747 netdb_host_type='$netdb_host_type'
16748 netdb_name_type='$netdb_name_type'
16749 netdb_net_type='$netdb_net_type'
16750 nm='$nm'
16751 nm_opt='$nm_opt'
16752 nm_so_opt='$nm_so_opt'
16753 nonxs_ext='$nonxs_ext'
16754 nroff='$nroff'
16755 nvEUformat='$nvEUformat'
16756 nvFUformat='$nvFUformat'
16757 nvGUformat='$nvGUformat'
16758 nveformat='$nveformat'
16759 nvfformat='$nvfformat'
16760 nvgformat='$nvgformat'
16761 nvsize='$nvsize'
16762 nvtype='$nvtype'
16763 o_nonblock='$o_nonblock'
16764 obj_ext='$obj_ext'
16765 old_pthread_create_joinable='$old_pthread_create_joinable'
16766 optimize='$optimize'
16767 orderlib='$orderlib'
16768 osname='$osname'
16769 osvers='$osvers'
16770 otherlibdirs='$otherlibdirs'
16771 package='$package'
16772 pager='$pager'
16773 passcat='$passcat'
16774 patchlevel='$patchlevel'
16775 path_sep='$path_sep'
16776 perl5='$perl5'
16777 perl='$perl'
16778 perl_patchlevel='$perl_patchlevel'
16779 perladmin='$perladmin'
16780 perllibs='$perllibs'
16781 perlpath='$perlpath'
16782 pg='$pg'
16783 phostname='$phostname'
16784 pidtype='$pidtype'
16785 plibpth='$plibpth'
16786 pm_apiversion='$pm_apiversion'
16787 pmake='$pmake'
16788 pr='$pr'
16789 prefix='$prefix'
16790 prefixexp='$prefixexp'
16791 privlib='$privlib'
16792 privlibexp='$privlibexp'
16793 prototype='$prototype'
16794 ptrsize='$ptrsize'
16795 quadkind='$quadkind'
16796 quadtype='$quadtype'
16797 randbits='$randbits'
16798 randfunc='$randfunc'
16799 randseedtype='$randseedtype'
16800 ranlib='$ranlib'
16801 rd_nodata='$rd_nodata'
16802 revision='$revision'
16803 rm='$rm'
16804 rmail='$rmail'
16805 runnm='$runnm'
16806 sPRIEUldbl='$sPRIEUldbl'
16807 sPRIFUldbl='$sPRIFUldbl'
16808 sPRIGUldbl='$sPRIGUldbl'
16809 sPRIXU64='$sPRIXU64'
16810 sPRId64='$sPRId64'
16811 sPRIeldbl='$sPRIeldbl'
16812 sPRIfldbl='$sPRIfldbl'
16813 sPRIgldbl='$sPRIgldbl'
16814 sPRIi64='$sPRIi64'
16815 sPRIo64='$sPRIo64'
16816 sPRIu64='$sPRIu64'
16817 sPRIx64='$sPRIx64'
16818 sSCNfldbl='$sSCNfldbl'
16819 sched_yield='$sched_yield'
16820 scriptdir='$scriptdir'
16821 scriptdirexp='$scriptdirexp'
16822 sed='$sed'
16823 seedfunc='$seedfunc'
16824 selectminbits='$selectminbits'
16825 selecttype='$selecttype'
16826 sendmail='$sendmail'
16827 sh='$sh'
16828 shar='$shar'
16829 sharpbang='$sharpbang'
16830 shmattype='$shmattype'
16831 shortsize='$shortsize'
16832 shrpenv='$shrpenv'
16833 shsharp='$shsharp'
16834 sig_count='$sig_count'
16835 sig_name='$sig_name'
16836 sig_name_init='$sig_name_init'
16837 sig_num='$sig_num'
16838 sig_num_init='$sig_num_init'
16839 sig_size='$sig_size'
16840 signal_t='$signal_t'
16841 sitearch='$sitearch'
16842 sitearchexp='$sitearchexp'
16843 sitebin='$sitebin'
16844 sitebinexp='$sitebinexp'
16845 sitelib='$sitelib'
16846 sitelib_stem='$sitelib_stem'
16847 sitelibexp='$sitelibexp'
16848 siteprefix='$siteprefix'
16849 siteprefixexp='$siteprefixexp'
16850 sizesize='$sizesize'
16851 sizetype='$sizetype'
16852 sleep='$sleep'
16853 smail='$smail'
16854 so='$so'
16855 sockethdr='$sockethdr'
16856 socketlib='$socketlib'
16857 socksizetype='$socksizetype'
16858 sort='$sort'
16859 spackage='$spackage'
16860 spitshell='$spitshell'
16861 src='$src'
16862 ssizetype='$ssizetype'
16863 startperl='$startperl'
16864 startsh='$startsh'
16865 static_ext='$static_ext'
16866 stdchar='$stdchar'
16867 stdio_base='$stdio_base'
16868 stdio_bufsiz='$stdio_bufsiz'
16869 stdio_cnt='$stdio_cnt'
16870 stdio_filbuf='$stdio_filbuf'
16871 stdio_ptr='$stdio_ptr'
16872 stdio_stream_array='$stdio_stream_array'
16873 strings='$strings'
16874 submit='$submit'
16875 subversion='$subversion'
16876 sysman='$sysman'
16877 tail='$tail'
16878 tar='$tar'
16879 tbl='$tbl'
16880 tee='$tee'
16881 test='$test'
16882 timeincl='$timeincl'
16883 timetype='$timetype'
16884 touch='$touch'
16885 tr='$tr'
16886 trnl='$trnl'
16887 troff='$troff'
16888 u16size='$u16size'
16889 u16type='$u16type'
16890 u32size='$u32size'
16891 u32type='$u32type'
16892 u64size='$u64size'
16893 u64type='$u64type'
16894 u8size='$u8size'
16895 u8type='$u8type'
16896 uidformat='$uidformat'
16897 uidsign='$uidsign'
16898 uidsize='$uidsize'
16899 uidtype='$uidtype'
16900 uname='$uname'
16901 uniq='$uniq'
16902 uquadtype='$uquadtype'
16903 use5005threads='$use5005threads'
16904 use64bitall='$use64bitall'
16905 use64bitint='$use64bitint'
16906 usedl='$usedl'
16907 useithreads='$useithreads'
16908 uselargefiles='$uselargefiles'
16909 uselongdouble='$uselongdouble'
16910 usemorebits='$usemorebits'
16911 usemultiplicity='$usemultiplicity'
16912 usemymalloc='$usemymalloc'
16913 usenm='$usenm'
16914 useopcode='$useopcode'
16915 useperlio='$useperlio'
16916 useposix='$useposix'
16917 usesfio='$usesfio'
16918 useshrplib='$useshrplib'
16919 usesocks='$usesocks'
16920 usethreads='$usethreads'
16921 usevendorprefix='$usevendorprefix'
16922 usevfork='$usevfork'
16923 usrinc='$usrinc'
16924 uuname='$uuname'
16925 uvXUformat='$uvXUformat'
16926 uvoformat='$uvoformat'
16927 uvsize='$uvsize'
16928 uvtype='$uvtype'
16929 uvuformat='$uvuformat'
16930 uvxformat='$uvxformat'
16931 vendorarch='$vendorarch'
16932 vendorarchexp='$vendorarchexp'
16933 vendorbin='$vendorbin'
16934 vendorbinexp='$vendorbinexp'
16935 vendorlib='$vendorlib'
16936 vendorlib_stem='$vendorlib_stem'
16937 vendorlibexp='$vendorlibexp'
16938 vendorprefix='$vendorprefix'
16939 vendorprefixexp='$vendorprefixexp'
16940 version='$version'
16941 versiononly='$versiononly'
16942 vi='$vi'
16943 voidflags='$voidflags'
16944 xlibpth='$xlibpth'
16945 xs_apiversion='$xs_apiversion'
16946 yacc='$yacc'
16947 yaccflags='$yaccflags'
16948 zcat='$zcat'
16949 zip='$zip'
16950 EOT
16951
16952 : Add in command line options if available
16953 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
16954
16955 : add special variables
16956 $test -f $src/patchlevel.h && \
16957 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
16958 echo "PERL_PATCHLEVEL=$perl_patchlevel" >>config.sh
16959 echo "PERL_CONFIG_SH=true" >>config.sh
16960
16961 : propagate old symbols
16962 if $test -f UU/config.sh; then
16963         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
16964         sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
16965         $sort | $uniq -u >UU/oldsyms
16966         set X `cat UU/oldsyms`
16967         shift
16968         case $# in
16969         0) ;;
16970         *)
16971                 cat <<EOM
16972 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
16973 EOM
16974                 echo "# Variables propagated from previous config.sh file." >>config.sh
16975                 for sym in `cat UU/oldsyms`; do
16976                         echo "    Propagating $hint variable "'$'"$sym..."
16977                         eval 'tmp="$'"${sym}"'"'
16978                         echo "$tmp" | \
16979                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
16980                 done
16981                 ;;
16982         esac
16983 fi
16984
16985 : Finish up by extracting the .SH files
16986 case "$alldone" in
16987 exit)
16988         $rm -rf UU
16989         echo "Done."
16990         exit 0
16991         ;;
16992 cont)
16993         ;;
16994 '')
16995         dflt=''
16996         nostick=true
16997         $cat <<EOM
16998
16999 If you'd like to make any changes to the config.sh file before I begin
17000 to configure things, do it as a shell escape now (e.g. !vi config.sh).
17001
17002 EOM
17003         rp="Press return or use a shell escape to edit config.sh:"
17004         . UU/myread
17005         nostick=''
17006         case "$ans" in
17007         '') ;;
17008         *) : in case they cannot read
17009                 sh 1>&4 -c "$ans";;
17010         esac
17011         ;;
17012 esac
17013
17014 : if this fails, just run all the .SH files by hand
17015 . ./config.sh
17016
17017 echo " "
17018 exec 1>&4
17019 . ./UU/extract
17020
17021 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
17022         dflt=y
17023         case "$silent" in
17024         true) ;;
17025         *)
17026                 $cat <<EOM
17027
17028 Now you need to generate make dependencies by running "$make depend".
17029 You might prefer to run it in background: "$make depend > makedepend.out &"
17030 It can take a while, so you might not want to run it right now.
17031
17032 EOM
17033                 ;;
17034         esac
17035         rp="Run $make depend now?"
17036         . UU/myread
17037         case "$ans" in
17038         y*)
17039                 $make depend && echo "Now you must run '$make'."
17040                 ;;
17041         *)
17042                 echo "You must run '$make depend' then '$make'."
17043                 ;;
17044         esac
17045 elif test -f [Mm]akefile; then
17046         echo " "
17047         echo "Now you must run a $make."
17048 else
17049         echo "Done."
17050 fi
17051
17052 if $test -f Policy.sh; then
17053     $cat <<EOM
17054
17055 If you compile $package on a different machine or from a different object
17056 directory, copy the Policy.sh file from this object directory to the
17057 new one before you run Configure -- this will help you with most of
17058 the policy defaults.
17059
17060 EOM
17061 fi
17062 if $test -f config.msg; then
17063     echo "Hmm.  I also noted the following information while running:"
17064     echo " "
17065     $cat config.msg >&4
17066     $rm -f config.msg
17067 fi
17068 $rm -f kit*isdone ark*isdone
17069 $rm -rf UU
17070
17071 : End of Configure
17072