Minor tweaks:
[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 Thu Nov 16 03:18:20 EET 2000 [metaconfig 3.0 PL70]
24 # (with additional metaconfig patches by perlbug@perl.org)
25
26 cat >/tmp/c1$$ <<EOF
27 ARGGGHHHH!!!!!
28
29 SCO csh still thinks true is false.  Write to SCO today and tell them that next
30 year Configure ought to "rm /bin/csh" unless they fix their blasted shell. :-)
31
32 (Actually, Configure ought to just patch csh in place.  Hmm.  Hmmmmm.  All
33 we'd have to do is go in and swap the && and || tokens, wherever they are.)
34
35 [End of diatribe. We now return you to your regularly scheduled programming...]
36 EOF
37 cat >/tmp/c2$$ <<EOF
38
39 OOPS!  You naughty creature!  You didn't run Configure with sh!
40 I will attempt to remedy the situation by running sh for you...
41 EOF
42
43 true || cat /tmp/c1$$ /tmp/c2$$
44 true || exec sh $0 $argv:q
45
46 (exit $?0) || cat /tmp/c2$$
47 (exit $?0) || exec sh $0 $argv:q
48 rm -f /tmp/c1$$ /tmp/c2$$
49
50 : compute my invocation name
51 me=$0
52 case "$0" in
53 */*)
54         me=`echo $0 | sed -e 's!.*/\(.*\)!\1!' 2>/dev/null`
55         test "$me" || me=$0
56         ;;
57 esac
58
59 : Proper separator for the PATH environment variable
60 p_=:
61 : On OS/2 this directory should exist if this is not floppy only system :-]
62 if test -d c:/. ; then
63     if test -n "$OS2_SHELL"; then
64                 p_=\;
65                 PATH=`cmd /c "echo %PATH%" | tr '\\\\' / `
66                 OS2_SHELL=`cmd /c "echo %OS2_SHELL%" | tr '\\\\' / | tr '[A-Z]' '[a-z]'`
67         elif test -n "$DJGPP"; then
68                 p_=\;
69         fi
70 fi
71
72 : Proper PATH setting
73 paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin'
74 paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin"
75 paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin"
76 paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin"
77 paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb"
78 paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /usr/ccs/bin"
79 paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib"
80 paths="$paths /sbin /usr/sbin /usr/libexec"
81
82 for p in $paths
83 do
84         case "$p_$PATH$p_" in
85         *$p_$p$p_*) ;;
86         *) test -d $p && PATH=$PATH$p_$p ;;
87         esac
88 done
89
90 PATH=.$p_$PATH
91 export PATH
92
93 : shall we be using ksh?
94 inksh=''
95 needksh=''
96 avoidksh=''
97 newsh=/bin/ksh
98 changesh=''
99 if (PATH=.; alias -x) >/dev/null 2>&1; then
100                 inksh=true
101 fi
102 if test -f /hp-ux -a -f /bin/ksh; then
103         needksh='to avoid sh bug in "here document" expansion'
104 fi
105 if test -d /usr/lpp -a -f /usr/bin/bsh -a -f /usr/bin/uname; then
106         if test X`/usr/bin/uname -v` = X4; then
107                 avoidksh="to avoid AIX 4's /bin/sh"
108                 newsh=/usr/bin/bsh
109         fi
110 fi
111 if test -f /osf_boot -a -f /usr/sbin/setld; then
112         if test X`/usr/bin/uname -s` = XOSF1; then
113                 avoidksh="to avoid Digital UNIX' ksh"
114                 newsh=/bin/sh
115                 unset BIN_SH # if this is 'xpg4' sh will start up ksh
116         fi
117 fi
118 case "$inksh/$needksh" in
119 /[a-z]*)
120                 ENV=''
121                 changesh=true
122                 reason="$needksh"
123         ;;
124 esac
125 case "$inksh/$avoidksh" in
126 true/[a-z]*)
127         changesh=true
128         reason="$avoidksh"
129         ;;
130 esac
131 case "$inksh/$needksh-$avoidksh-" in
132 true/--)
133                 cat <<EOM
134 (I see you are using the Korn shell.  Some ksh's blow up on $me,
135 mainly on older exotic systems.  If yours does, try the Bourne shell instead.)
136 EOM
137         ;;
138 esac
139 case "$changesh" in
140 true)
141         echo "(Feeding myself to $newsh $reason.)"
142         case "$0" in
143         Configure|*/Configure) exec $newsh $0 "$@";;
144         *) exec $newsh Configure "$@";;
145         esac
146         ;;
147 esac
148
149 : if needed set CDPATH to a harmless value that is not chatty
150 : avoid bash 2.02 problems with empty CDPATH.
151 case "$CDPATH" in
152 '')     ;;
153 *)      case "$SHELL" in
154         *bash*) CDPATH='.' ;;
155         *)              CDPATH='' ;;
156         esac
157         ;;
158 esac
159 : Configure runs within the UU subdirectory
160 test -d UU || mkdir UU
161 cd UU && rm -f ./*
162
163 ccname=''
164 ccversion=''
165 ccsymbols=''
166 cppccsymbols=''
167 cppsymbols=''
168 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 alignbytes=''
277 ansi2knr=''
278 archlib=''
279 archlibexp=''
280 d_archlib=''
281 installarchlib=''
282 archname=''
283 myarchname=''
284 d_atolf=''
285 d_atoll=''
286 baserev=''
287 bin=''
288 binexp=''
289 installbin=''
290 bincompat5005=''
291 d_bincompat5005=''
292 byteorder=''
293 cc=''
294 ccflags=''
295 cppflags=''
296 ldflags=''
297 lkflags=''
298 locincpth=''
299 optimize=''
300 cf_email=''
301 cf_by=''
302 cf_time=''
303 charsize=''
304 contains=''
305 cpp_stuff=''
306 cpplast=''
307 cppminus=''
308 cpprun=''
309 cppstdin=''
310 crosscompile=''
311 d__fwalk=''
312 d_access=''
313 d_accessx=''
314 d_alarm=''
315 d_attribut=''
316 d_bcmp=''
317 d_bcopy=''
318 d_bzero=''
319 d_casti32=''
320 castflags=''
321 d_castneg=''
322 d_chown=''
323 d_chroot=''
324 d_chsize=''
325 d_closedir=''
326 d_void_closedir=''
327 d_const=''
328 cryptlib=''
329 d_crypt=''
330 d_csh=''
331 full_csh=''
332 d_cuserid=''
333 d_dbl_dig=''
334 d_difftime=''
335 d_dlerror=''
336 d_dlopen=''
337 d_dlsymun=''
338 d_dosuid=''
339 d_suidsafe=''
340 d_drand48proto=''
341 d_dup2=''
342 d_eaccess=''
343 d_endgrent=''
344 d_endhent=''
345 d_endnent=''
346 d_endpent=''
347 d_endpwent=''
348 d_endsent=''
349 d_fchmod=''
350 d_fchown=''
351 d_fcntl=''
352 d_fcntl_can_lock=''
353 d_fd_macros=''
354 d_fd_set=''
355 d_fds_bits=''
356 d_fgetpos=''
357 d_flexfnam=''
358 d_flock=''
359 d_fork=''
360 d_fpos64_t=''
361 d_frexpl=''
362 d_fs_data_s=''
363 d_fseeko=''
364 d_fsetpos=''
365 d_fstatfs=''
366 d_fsync=''
367 d_ftello=''
368 d_ftime=''
369 d_gettimeod=''
370 d_Gconvert=''
371 d_getcwd=''
372 d_getespwnam=''
373 d_getfsstat=''
374 d_getgrent=''
375 d_getgrps=''
376 d_gethbyaddr=''
377 d_gethbyname=''
378 d_gethent=''
379 aphostname=''
380 d_gethname=''
381 d_phostname=''
382 d_uname=''
383 d_gethostprotos=''
384 d_getlogin=''
385 d_getmnt=''
386 d_getmntent=''
387 d_getnbyaddr=''
388 d_getnbyname=''
389 d_getnent=''
390 d_getnetprotos=''
391 d_getpagsz=''
392 d_getpent=''
393 d_getpgid=''
394 d_getpgrp2=''
395 d_bsdgetpgrp=''
396 d_getpgrp=''
397 d_getppid=''
398 d_getprior=''
399 d_getpbyname=''
400 d_getpbynumber=''
401 d_getprotoprotos=''
402 d_getprpwnam=''
403 d_getpwent=''
404 d_getsent=''
405 d_getservprotos=''
406 d_getspnam=''
407 d_getsbyname=''
408 d_getsbyport=''
409 d_gnulibc=''
410 d_hasmntopt=''
411 d_htonl=''
412 d_iconv=''
413 d_inetaton=''
414 d_int64_t=''
415 d_isascii=''
416 d_isnan=''
417 d_isnanl=''
418 d_killpg=''
419 d_lchown=''
420 d_ldbl_dig=''
421 d_link=''
422 d_locconv=''
423 d_lockf=''
424 d_longdbl=''
425 longdblsize=''
426 d_longlong=''
427 longlongsize=''
428 d_lseekproto=''
429 d_lstat=''
430 d_madvise=''
431 d_mblen=''
432 d_mbstowcs=''
433 d_mbtowc=''
434 d_memchr=''
435 d_memcmp=''
436 d_memcpy=''
437 d_memmove=''
438 d_memset=''
439 d_mkdir=''
440 d_mkdtemp=''
441 d_mkfifo=''
442 d_mkstemp=''
443 d_mkstemps=''
444 d_mktime=''
445 d_mmap=''
446 mmaptype=''
447 d_modfl=''
448 d_mprotect=''
449 d_msg=''
450 d_msgctl=''
451 d_msgget=''
452 d_msgrcv=''
453 d_msgsnd=''
454 d_msync=''
455 d_munmap=''
456 d_nice=''
457 d_off64_t=''
458 d_open3=''
459 d_fpathconf=''
460 d_pathconf=''
461 d_pause=''
462 d_pipe=''
463 d_poll=''
464 d_portable=''
465 d_old_pthread_create_joinable=''
466 old_pthread_create_joinable=''
467 d_pthread_yield=''
468 d_sched_yield=''
469 sched_yield=''
470 d_qgcvt=''
471 d_readdir=''
472 d_rewinddir=''
473 d_seekdir=''
474 d_telldir=''
475 d_readlink=''
476 d_rename=''
477 d_rmdir=''
478 d_safebcpy=''
479 d_safemcpy=''
480 d_sanemcmp=''
481 d_select=''
482 d_sem=''
483 d_semctl=''
484 d_semget=''
485 d_semop=''
486 d_setegid=''
487 d_seteuid=''
488 d_setgrent=''
489 d_setgrps=''
490 d_sethent=''
491 d_setlinebuf=''
492 d_setlocale=''
493 d_setnent=''
494 d_setpent=''
495 d_setpgid=''
496 d_setpgrp2=''
497 d_bsdsetpgrp=''
498 d_setpgrp=''
499 d_setprior=''
500 d_setproctitle=''
501 d_setpwent=''
502 d_setregid=''
503 d_setresgid=''
504 d_setresuid=''
505 d_setreuid=''
506 d_setrgid=''
507 d_setruid=''
508 d_setsent=''
509 d_setsid=''
510 d_setvbuf=''
511 d_sfio=''
512 usesfio=''
513 d_shm=''
514 d_shmat=''
515 d_shmatprototype=''
516 shmattype=''
517 d_shmctl=''
518 d_shmdt=''
519 d_shmget=''
520 d_sigaction=''
521 d_sigsetjmp=''
522 d_msg_ctrunc=''
523 d_msg_dontroute=''
524 d_msg_oob=''
525 d_msg_peek=''
526 d_msg_proxy=''
527 d_oldsock=''
528 d_scm_rights=''
529 d_socket=''
530 d_sockpair=''
531 sockethdr=''
532 socketlib=''
533 d_socklen_t=''
534 d_socks5_init=''
535 d_sqrtl=''
536 d_statblks=''
537 d_statfs_f_flags=''
538 d_statfs_s=''
539 d_fstatvfs=''
540 d_statvfs=''
541 d_stdio_cnt_lval=''
542 d_stdio_ptr_lval=''
543 d_stdio_ptr_lval_nochange_cnt=''
544 d_stdio_ptr_lval_sets_cnt=''
545 d_stdiobase=''
546 d_stdstdio=''
547 stdio_base=''
548 stdio_bufsiz=''
549 stdio_cnt=''
550 stdio_filbuf=''
551 stdio_ptr=''
552 d_index=''
553 d_strchr=''
554 d_strcoll=''
555 d_strctcpy=''
556 d_strerrm=''
557 d_strerror=''
558 d_sysernlst=''
559 d_syserrlst=''
560 d_strtod=''
561 d_strtol=''
562 d_strtold=''
563 d_strtoll=''
564 d_strtoul=''
565 d_strtoull=''
566 d_strtouq=''
567 d_strxfrm=''
568 d_symlink=''
569 d_syscall=''
570 d_sysconf=''
571 d_system=''
572 d_tcgetpgrp=''
573 d_tcsetpgrp=''
574 d_telldirproto=''
575 d_time=''
576 timetype=''
577 clocktype=''
578 d_times=''
579 d_truncate=''
580 d_tzname=''
581 d_umask=''
582 d_semctl_semid_ds=''
583 d_semctl_semun=''
584 d_union_semun=''
585 d_ustat=''
586 d_vfork=''
587 usevfork=''
588 d_voidsig=''
589 signal_t=''
590 d_volatile=''
591 d_charvspr=''
592 d_vprintf=''
593 d_wait4=''
594 d_waitpid=''
595 d_wcstombs=''
596 d_wctomb=''
597 dlext=''
598 cccdlflags=''
599 ccdlflags=''
600 dlsrc=''
601 ld=''
602 lddlflags=''
603 usedl=''
604 doublesize=''
605 ebcdic=''
606 fflushNULL=''
607 fflushall=''
608 fpossize=''
609 fpostype=''
610 gccosandvers=''
611 gccversion=''
612 gidformat=''
613 gidsign=''
614 gidsize=''
615 gidtype=''
616 groupstype=''
617 h_fcntl=''
618 h_sysfile=''
619 i_arpainet=''
620 db_hashtype=''
621 db_prefixtype=''
622 i_db=''
623 i_dbm=''
624 i_rpcsvcdbm=''
625 d_dirnamlen=''
626 direntrytype=''
627 i_dirent=''
628 i_dld=''
629 i_dlfcn=''
630 i_fcntl=''
631 i_float=''
632 i_gdbm=''
633 d_grpasswd=''
634 i_grp=''
635 i_iconv=''
636 i_ieeefp=''
637 i_inttypes=''
638 i_libutil=''
639 i_limits=''
640 i_locale=''
641 i_machcthr=''
642 i_malloc=''
643 i_math=''
644 i_memory=''
645 i_mntent=''
646 i_ndbm=''
647 i_netdb=''
648 i_neterrno=''
649 i_netinettcp=''
650 i_niin=''
651 i_sysin=''
652 i_poll=''
653 i_prot=''
654 i_pthread=''
655 d_pwage=''
656 d_pwchange=''
657 d_pwclass=''
658 d_pwcomment=''
659 d_pwexpire=''
660 d_pwgecos=''
661 d_pwpasswd=''
662 d_pwquota=''
663 i_pwd=''
664 i_sfio=''
665 i_shadow=''
666 i_socks=''
667 i_stddef=''
668 i_stdlib=''
669 i_string=''
670 strings=''
671 i_sunmath=''
672 i_sysaccess=''
673 i_sysdir=''
674 i_sysfile=''
675 d_voidtty=''
676 i_bsdioctl=''
677 i_sysfilio=''
678 i_sysioctl=''
679 i_syssockio=''
680 i_syslog=''
681 i_sysmman=''
682 i_sysmode=''
683 i_sysmount=''
684 i_sysndir=''
685 i_sysparam=''
686 i_sysresrc=''
687 i_syssecrt=''
688 i_sysselct=''
689 i_sysstat=''
690 i_sysstatfs=''
691 i_sysstatvfs=''
692 i_systimes=''
693 i_systypes=''
694 i_sysuio=''
695 i_sysun=''
696 i_sysutsname=''
697 i_sysvfs=''
698 i_syswait=''
699 i_sgtty=''
700 i_termio=''
701 i_termios=''
702 i_systime=''
703 i_systimek=''
704 i_time=''
705 timeincl=''
706 i_unistd=''
707 i_ustat=''
708 i_utime=''
709 i_values=''
710 i_stdarg=''
711 i_varargs=''
712 i_varhdr=''
713 i_vfork=''
714 inc_version_list=''
715 inc_version_list_init=''
716 installprefix=''
717 installprefixexp=''
718 installstyle=''
719 installusrbinperl=''
720 intsize=''
721 longsize=''
722 shortsize=''
723 libc=''
724 ldlibpthname=''
725 libperl=''
726 shrpenv=''
727 useshrplib=''
728 glibpth=''
729 libpth=''
730 loclibpth=''
731 plibpth=''
732 xlibpth=''
733 ignore_versioned_solibs=''
734 libs=''
735 libsdirs=''
736 libsfiles=''
737 libsfound=''
738 libspath=''
739 lns=''
740 d_PRIEUldbl=''
741 d_PRIFUldbl=''
742 d_PRIGUldbl=''
743 d_PRIeldbl=''
744 d_PRIfldbl=''
745 d_PRIgldbl=''
746 d_SCNfldbl=''
747 sPRIEUldbl=''
748 sPRIFUldbl=''
749 sPRIGUldbl=''
750 sPRIeldbl=''
751 sPRIfldbl=''
752 sPRIgldbl=''
753 sSCNfldbl=''
754 lseeksize=''
755 lseektype=''
756 make_set_make=''
757 d_mymalloc=''
758 freetype=''
759 mallocobj=''
760 mallocsrc=''
761 malloctype=''
762 usemymalloc=''
763 installman1dir=''
764 man1dir=''
765 man1direxp=''
766 man1ext=''
767 installman3dir=''
768 man3dir=''
769 man3direxp=''
770 man3ext=''
771 modetype=''
772 multiarch=''
773 mydomain=''
774 myhostname=''
775 phostname=''
776 c=''
777 n=''
778 d_eofnblk=''
779 eagain=''
780 o_nonblock=''
781 rd_nodata=''
782 netdb_hlen_type=''
783 netdb_host_type=''
784 netdb_name_type=''
785 netdb_net_type=''
786 groupcat=''
787 hostcat=''
788 passcat=''
789 orderlib=''
790 ranlib=''
791 d_perl_otherlibdirs=''
792 otherlibdirs=''
793 package=''
794 spackage=''
795 pager=''
796 api_revision=''
797 api_subversion=''
798 api_version=''
799 api_versionstring=''
800 patchlevel=''
801 revision=''
802 subversion=''
803 version=''
804 perl5=''
805 perladmin=''
806 perlpath=''
807 d_nv_preserves_uv=''
808 d_nv_preserves_uv_bits=''
809 i16size=''
810 i16type=''
811 i32size=''
812 i32type=''
813 i64size=''
814 i64type=''
815 i8size=''
816 i8type=''
817 ivsize=''
818 ivtype=''
819 nvsize=''
820 nvtype=''
821 u16size=''
822 u16type=''
823 u32size=''
824 u32type=''
825 u64size=''
826 u64type=''
827 u8size=''
828 u8type=''
829 uvsize=''
830 uvtype=''
831 ivdformat=''
832 nvEUformat=''
833 nvFUformat=''
834 nvGUformat=''
835 nveformat=''
836 nvfformat=''
837 nvgformat=''
838 uvXUformat=''
839 uvoformat=''
840 uvuformat=''
841 uvxformat=''
842 pidtype=''
843 prefix=''
844 prefixexp=''
845 installprivlib=''
846 privlib=''
847 privlibexp=''
848 prototype=''
849 ptrsize=''
850 d_PRIXU64=''
851 d_PRId64=''
852 d_PRIi64=''
853 d_PRIo64=''
854 d_PRIu64=''
855 d_PRIx64=''
856 sPRIXU64=''
857 sPRId64=''
858 sPRIi64=''
859 sPRIo64=''
860 sPRIu64=''
861 sPRIx64=''
862 d_quad=''
863 quadkind=''
864 quadtype=''
865 uquadtype=''
866 drand01=''
867 randbits=''
868 randfunc=''
869 randseedtype=''
870 seedfunc=''
871 installscript=''
872 scriptdir=''
873 scriptdirexp=''
874 selectminbits=''
875 selecttype=''
876 sh=''
877 sig_count=''
878 sig_name=''
879 sig_name_init=''
880 sig_num=''
881 sig_num_init=''
882 installsitearch=''
883 sitearch=''
884 sitearchexp=''
885 installsitebin=''
886 sitebin=''
887 sitebinexp=''
888 installsitelib=''
889 sitelib=''
890 sitelib_stem=''
891 sitelibexp=''
892 siteprefix=''
893 siteprefixexp=''
894 sizesize=''
895 sizetype=''
896 so=''
897 socksizetype=''
898 sharpbang=''
899 shsharp=''
900 spitshell=''
901 src=''
902 ssizetype=''
903 startperl=''
904 startsh=''
905 stdchar=''
906 d_stdio_stream_array=''
907 stdio_stream_array=''
908 sysman=''
909 trnl=''
910 uidformat=''
911 uidsign=''
912 uidsize=''
913 uidtype=''
914 archname64=''
915 use64bitall=''
916 use64bitint=''
917 ccflags_uselargefiles=''
918 ldflags_uselargefiles=''
919 libswanted_uselargefiles=''
920 uselargefiles=''
921 uselongdouble=''
922 usemorebits=''
923 usemultiplicity=''
924 nm_opt=''
925 nm_so_opt=''
926 runnm=''
927 usenm=''
928 useperlio=''
929 usesocks=''
930 d_oldpthreads=''
931 use5005threads=''
932 useithreads=''
933 usethreads=''
934 incpath=''
935 mips_type=''
936 usrinc=''
937 d_vendorarch=''
938 installvendorarch=''
939 vendorarch=''
940 vendorarchexp=''
941 d_vendorbin=''
942 installvendorbin=''
943 vendorbin=''
944 vendorbinexp=''
945 d_vendorlib=''
946 installvendorlib=''
947 vendorlib=''
948 vendorlib_stem=''
949 vendorlibexp=''
950 usevendorprefix=''
951 vendorprefix=''
952 vendorprefixexp=''
953 versiononly=''
954 defvoidused=''
955 voidflags=''
956 pm_apiversion=''
957 xs_apiversion=''
958 CONFIG=''
959
960 define='define'
961 undef='undef'
962 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
963 rmlist=''
964
965 : We must find out about Eunice early
966 eunicefix=':'
967 if test -f /etc/unixtovms; then
968         eunicefix=/etc/unixtovms
969 fi
970 if test -f /etc/unixtovms.exe; then
971         eunicefix=/etc/unixtovms.exe
972 fi
973
974 i_whoami=''
975 ccname=''
976 ccversion=''
977 perllibs=''
978 : set useposix=false in your hint file to disable the POSIX extension.
979 useposix=true
980 : set useopcode=false in your hint file to disable the Opcode extension.
981 useopcode=true
982 : Trailing extension.  Override this in a hint file, if needed.
983 _exe=''
984 : Extra object files, if any, needed on this platform.
985 archobjs=''
986 archname=''
987 : Possible local include directories to search.
988 : Set locincpth to "" in a hint file to defeat local include searches.
989 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
990 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
991 :
992 : no include file wanted by default
993 inclwanted=''
994
995 groupstype=''
996 : change the next line if compiling for Xenix/286 on Xenix/386
997 xlibpth='/usr/lib/386 /lib/386'
998 : Possible local library directories to search.
999 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1000 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1001
1002 : general looking path for locating libraries
1003 glibpth="/lib /usr/lib $xlibpth"
1004 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1005 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1006 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
1007
1008 : Private path used by Configure to find libraries.  Its value
1009 : is prepended to libpth. This variable takes care of special
1010 : machines, like the mips.  Usually, it should be empty.
1011 plibpth=''
1012
1013 : default library list
1014 libswanted=''
1015 : some systems want to use only the non-versioned libso:s
1016 ignore_versioned_solibs=''
1017 archname64=''
1018 ccflags_uselargefiles=''
1019 ldflags_uselargefiles=''
1020 libswanted_uselargefiles=''
1021 : set usemultiplicity on the Configure command line to enable multiplicity.
1022 : set usesocks on the Configure command line to enable socks.
1023 : set usethreads on the Configure command line to enable threads.
1024 : full support for void wanted by default
1025 defvoidused=15
1026
1027 : List of libraries we want.
1028 : If anyone needs -lnet, put it in a hint file.
1029 libswanted='sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl'
1030 libswanted="$libswanted dld ld sun m c cposix posix"
1031 libswanted="$libswanted ndir dir crypt sec"
1032 libswanted="$libswanted ucb bsd BSD PW x iconv util"
1033 : We probably want to search /usr/shlib before most other libraries.
1034 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1035 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1036 glibpth="/usr/shlib $glibpth"
1037 : Do not use vfork unless overridden by a hint file.
1038 usevfork=false
1039
1040 : Find the basic shell for Bourne shell scripts
1041 case "$sh" in
1042 '')
1043         case "$SYSTYPE" in
1044         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1045         *) xxx='/bin/sh';;
1046         esac
1047         if test -f "$xxx"; then
1048                 sh="$xxx"
1049         else
1050                 : Build up a list and do a single loop so we can 'break' out.
1051                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1052                 for xxx in sh bash ksh pdksh ash; do
1053                         for p in $pth; do
1054                                 try="$try ${p}/${xxx}"
1055                         done
1056                 done
1057                 for xxx in $try; do
1058                         if test -f "$xxx"; then
1059                                 sh="$xxx";
1060                                 break
1061                         elif test -f "$xxx.exe"; then
1062                                 sh="$xxx";
1063                                 break
1064                         fi
1065                 done
1066         fi
1067         ;;
1068 esac
1069
1070 case "$sh" in
1071 '')     cat <<EOM >&2
1072 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
1073
1074 Usually it's in /bin/sh.  How did you even get this far?
1075 Please contact me (Perl Maintainers) at perlbug@perl.org and 
1076 we'll try to straighten this all out.
1077 EOM
1078         exit 1
1079         ;;
1080 esac
1081
1082 : see if sh knows # comments
1083 if `$sh -c '#' >/dev/null 2>&1`; then
1084         shsharp=true
1085         spitshell=cat
1086         xcat=/bin/cat
1087         test -f $xcat || xcat=/usr/bin/cat
1088         echo "#!$xcat" >try
1089         $eunicefix try
1090         chmod +x try
1091         ./try > today
1092         if test -s today; then
1093                 sharpbang='#!'
1094         else
1095                 echo "#! $xcat" > try
1096                 $eunicefix try
1097                 chmod +x try
1098                 ./try > today
1099                 if test -s today; then
1100                         sharpbang='#! '
1101                 else
1102                         sharpbang=': use '
1103                 fi
1104         fi
1105 else
1106         echo " "
1107         echo "Your $sh doesn't grok # comments--I will strip them later on."
1108         shsharp=false
1109         cd ..
1110         echo "exec grep -v '^[  ]*#'" >spitshell
1111         chmod +x spitshell
1112         $eunicefix spitshell
1113         spitshell=`pwd`/spitshell
1114         cd UU
1115         echo "I presume that if # doesn't work, #! won't work either!"
1116         sharpbang=': use '
1117 fi
1118 rm -f try today
1119
1120 : figure out how to guarantee sh startup
1121 case "$startsh" in
1122 '') startsh=${sharpbang}${sh} ;;
1123 *)
1124 esac
1125 cat >try <<EOSS
1126 $startsh
1127 set abc
1128 test "$?abc" != 1
1129 EOSS
1130
1131 chmod +x try
1132 $eunicefix try
1133 if ./try; then
1134         : echo "Yup, it does."
1135 else
1136         echo "Hmm... '$startsh' does not guarantee sh startup..."
1137         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1138 fi
1139 rm -f try
1140
1141
1142 : Save command line options in file UU/cmdline.opt for later use in
1143 : generating config.sh.
1144 cat > cmdline.opt <<EOSH
1145 # Configure command line arguments.
1146 config_arg0='$0'
1147 config_args='$*'
1148 config_argc=$#
1149 EOSH
1150 argn=1
1151 for arg in "$@"; do
1152         cat >>cmdline.opt <<EOSH
1153 config_arg$argn='$arg'
1154 EOSH
1155         argn=`expr $argn + 1`
1156 done
1157
1158 : produce awk script to parse command line options
1159 cat >options.awk <<'EOF'
1160 BEGIN {
1161         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1162
1163         len = length(optstr);
1164         for (i = 1; i <= len; i++) {
1165                 c = substr(optstr, i, 1);
1166                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1167                 if (a == ":") {
1168                         arg[c] = 1;
1169                         i++;
1170                 }
1171                 opt[c] = 1;
1172         }
1173 }
1174 {
1175         expect = 0;
1176         str = $0;
1177         if (substr(str, 1, 1) != "-") {
1178                 printf("'%s'\n", str);
1179                 next;
1180         }
1181         len = length($0);
1182         for (i = 2; i <= len; i++) {
1183                 c = substr(str, i, 1);
1184                 if (!opt[c]) {
1185                         printf("-%s\n", substr(str, i));
1186                         next;
1187                 }
1188                 printf("-%s\n", c);
1189                 if (arg[c]) {
1190                         if (i < len)
1191                                 printf("'%s'\n", substr(str, i + 1));
1192                         else
1193                                 expect = 1;
1194                         next;
1195                 }
1196         }
1197 }
1198 END {
1199         if (expect)
1200                 print "?";
1201 }
1202 EOF
1203
1204 : process the command line options
1205 set X `for arg in "$@"; do echo "X$arg"; done |
1206         sed -e s/X// | awk -f options.awk`
1207 eval "set $*"
1208 shift
1209 rm -f options.awk
1210
1211 : set up default values
1212 fastread=''
1213 reuseval=false
1214 config_sh=''
1215 alldone=''
1216 error=''
1217 silent=''
1218 extractsh=''
1219 override=''
1220 knowitall=''
1221 rm -f optdef.sh posthint.sh
1222 cat >optdef.sh <<EOS
1223 $startsh
1224 EOS
1225
1226
1227 : option parsing
1228 while test $# -gt 0; do
1229         case "$1" in
1230         -d) shift; fastread=yes;;
1231         -e) shift; alldone=cont;;
1232         -f)
1233                 shift
1234                 cd ..
1235                 if test -r "$1"; then
1236                         config_sh="$1"
1237                 else
1238                         echo "$me: cannot read config file $1." >&2
1239                         error=true
1240                 fi
1241                 cd UU
1242                 shift;;
1243         -h) shift; error=true;;
1244         -r) shift; reuseval=true;;
1245         -s) shift; silent=true; realsilent=true;;
1246         -E) shift; alldone=exit;;
1247         -K) shift; knowitall=true;;
1248         -O) shift; override=true;;
1249         -S) shift; silent=true; extractsh=true;;
1250         -D)
1251                 shift
1252                 case "$1" in
1253                 *=)
1254                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1255                         echo "$me: ignoring -D $1" >&2
1256                         ;;
1257                 *=*) echo "$1" | \
1258                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1259                 *) echo "$1='define'" >> optdef.sh;;
1260                 esac
1261                 shift
1262                 ;;
1263         -U)
1264                 shift
1265                 case "$1" in
1266                 *=) echo "$1" >> optdef.sh;;
1267                 *=*)
1268                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1269                         echo "$me: ignoring -U $1" >&2
1270                         ;;
1271                 *) echo "$1='undef'" >> optdef.sh;;
1272                 esac
1273                 shift
1274                 ;;
1275         -A)
1276             shift
1277             xxx=''
1278             yyy="$1"
1279             zzz=''
1280             uuu=undef
1281             case "$yyy" in
1282             *=*) zzz=`echo $yyy|sed 's!=.*!!'`
1283                  case "$zzz" in
1284                  *:*) zzz='' ;;
1285                  *)   xxx=append
1286                       zzz=" "`echo $yyy|sed 's!^[^=]*=!!'` 
1287                       yyy=`echo $yyy|sed 's!=.*!!'` ;;
1288                  esac
1289                  ;;
1290             esac
1291             case "$xxx" in
1292             '')  case "$yyy" in
1293                  *:*) xxx=`echo $yyy|sed 's!:.*!!'`
1294                       yyy=`echo $yyy|sed 's!^[^:]*:!!'`
1295                       zzz=`echo $yyy|sed 's!^[^=]*=!!'`
1296                       yyy=`echo $yyy|sed 's!=.*!!'` ;;
1297                  *)   xxx=`echo $yyy|sed 's!:.*!!'`
1298                       yyy=`echo $yyy|sed 's!^[^:]*:!!'` ;;
1299                  esac
1300                  ;;       
1301             esac
1302             case "$xxx" in
1303             append)
1304                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1305             clear)
1306                 echo "$yyy=''"                  >> posthint.sh ;;
1307             define)
1308                 case "$zzz" in
1309                 '') zzz=define ;;
1310                 esac
1311                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1312             eval)
1313                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1314             prepend)
1315                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1316             undef)
1317                 case "$zzz" in
1318                 '') zzz="$uuu" ;;
1319                 esac
1320                 echo "$yyy=$zzz"                >> posthint.sh ;;
1321             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1322             esac
1323             shift
1324             ;;
1325         -V) echo "$me generated by metaconfig 3.0 PL70." >&2
1326             exit 0;;
1327         --) break;;
1328         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1329         *) break;;
1330         esac
1331 done
1332
1333 case "$error" in
1334 true)
1335         cat >&2 <<EOM
1336 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1337                  [-U symbol] [-U symbol=] [-A command:symbol...]
1338   -d : use defaults for all answers.
1339   -e : go on without questioning past the production of config.sh.
1340   -f : specify an alternate default configuration file.
1341   -h : print this help message and exit (with an error status).
1342   -r : reuse C symbols value if possible (skips costly nm extraction).
1343   -s : silent mode, only echoes questions and essential information.
1344   -D : define symbol to have some value:
1345          -D symbol         symbol gets the value 'define'
1346          -D symbol=value   symbol gets the value 'value'
1347   -E : stop at the end of questions, after having produced config.sh.
1348   -K : do not use unless you know what you are doing.
1349   -O : let -D and -U override definitions from loaded configuration file.
1350   -S : perform variable substitutions on all .SH files (can mix with -f)
1351   -U : undefine symbol:
1352          -U symbol    symbol gets the value 'undef'
1353          -U symbol=   symbol gets completely empty
1354   -A : manipulate symbol after the platform specific hints have been applied:
1355          -A symbol=value                append " "value to symbol
1356          -A append:symbol=value         append value to symbol
1357          -A define:symbol=value         define symbol to have value
1358          -A clear:symbol                define symbol to be ''
1359          -A define:symbol               define symbol to be 'define'
1360          -A eval:symbol=value           define symbol to be eval of value
1361          -A prepend:symbol=value        prepend value to symbol
1362          -A undef:symbol                define symbol to be 'undef'
1363          -A undef:symbol=               define symbol to be ''
1364   -V : print version number and exit (with a zero status).
1365 EOM
1366         exit 1
1367         ;;
1368 esac
1369
1370 : Sanity checks
1371 case "$fastread$alldone" in
1372 yescont|yesexit) ;;
1373 *)
1374         case "$extractsh" in
1375         true) ;;
1376         *)
1377                 if test ! -t 0; then
1378                         echo "Say 'sh Configure', not 'sh <Configure'"
1379                         exit 1
1380                 fi
1381                 ;;
1382         esac
1383         ;;
1384 esac
1385
1386 exec 4>&1
1387 case "$silent" in
1388 true) exec 1>/dev/null;;
1389 esac
1390
1391 : run the defines and the undefines, if any, but leave the file out there...
1392 touch optdef.sh
1393 . ./optdef.sh
1394 : create the posthint manipulation script and leave the file out there...
1395 touch posthint.sh
1396
1397 : set package name
1398 package=perl5
1399 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1400 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1401 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1402 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1403 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1404 esac
1405
1406 : Some greps do not return status, grrr.
1407 echo "grimblepritz" >grimble
1408 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1409         contains=contains
1410 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1411         contains=grep
1412 else
1413         contains=contains
1414 fi
1415 rm -f grimble
1416 : the following should work in any shell
1417 case "$contains" in
1418 contains*)
1419         echo " "
1420         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1421         cat >contains <<'EOSS'
1422 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1423 EOSS
1424 chmod +x contains
1425 esac
1426
1427 : Find the path to the source tree
1428 case "$src" in
1429 '') case "$0" in
1430     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1431          case "$src" in
1432          /*)    ;;
1433          *)     src=`cd ../$src && pwd` ;;
1434          esac
1435          ;;
1436     *)   src='.';;
1437     esac;;
1438 esac
1439 case "$src" in
1440 '')     src=/
1441         rsrc=/
1442         ;;
1443 /*) rsrc="$src";;
1444 *) rsrc="../$src";;
1445 esac
1446 if test -f $rsrc/Configure && \
1447         $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1448 then
1449    : found it, so we are ok.
1450 else
1451         rsrc=''
1452         for src in . .. ../.. ../../.. ../../../..; do
1453                 if test -f ../$src/Configure && \
1454                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1455                 then
1456                         rsrc=../$src
1457                         break
1458                 fi
1459         done
1460 fi
1461 case "$rsrc" in
1462 '')
1463         cat <<EOM >&4
1464
1465 Sorry, I can't seem to locate the source dir for $package.  Please start
1466 Configure with an explicit path -- i.e. /some/path/Configure.
1467
1468 EOM
1469         exit 1
1470         ;;
1471 ../.)   rsrc='..';;
1472 *)
1473         echo " "
1474         echo "Sources for $package found in \"$src\"." >&4
1475         ;;
1476 esac
1477
1478 : script used to extract .SH files with variable substitutions
1479 cat >extract <<'EOS'
1480 CONFIGDOTSH=true
1481 echo "Doing variable substitutions on .SH files..."
1482 if test -f $src/MANIFEST; then
1483         set x `awk '{print $1}' <$src/MANIFEST | grep '\.SH$'`
1484 else
1485         echo "(Looking for .SH files under the source directory.)"
1486         set x `(cd $src; find . -name "*.SH" -print)`
1487 fi
1488 shift
1489 case $# in
1490 0) set x `(cd $src; echo *.SH)`; shift;;
1491 esac
1492 if test ! -f $src/$1; then
1493         shift
1494 fi
1495 mkdir_p='
1496 name=$1;
1497 create="";
1498 while test $name; do
1499         if test ! -d "$name"; then
1500                 create="$name $create";
1501                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1502                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1503         else
1504                 name="";
1505         fi;
1506 done;
1507 for file in $create; do
1508         mkdir $file;
1509 done
1510 '
1511 for file in $*; do
1512         case "$src" in
1513         ".")
1514                 case "$file" in
1515                 */*)
1516                         dir=`expr X$file : 'X\(.*\)/'`
1517                         file=`expr X$file : 'X.*/\(.*\)'`
1518                         (cd $dir && . ./$file)
1519                         ;;
1520                 *)
1521                         . ./$file
1522                         ;;
1523                 esac
1524                 ;;
1525         *)
1526                 case "$file" in
1527                 */*)
1528                         dir=`expr X$file : 'X\(.*\)/'`
1529                         file=`expr X$file : 'X.*/\(.*\)'`
1530                         (set x $dir; shift; eval $mkdir_p)
1531                         sh <$src/$dir/$file
1532                         ;;
1533                 *)
1534                         sh <$src/$file
1535                         ;;
1536                 esac
1537                 ;;
1538         esac
1539 done
1540 if test -f $src/config_h.SH; then
1541         if test ! -f config.h; then
1542         : oops, they left it out of MANIFEST, probably, so do it anyway.
1543         . $src/config_h.SH
1544         fi
1545 fi
1546 EOS
1547
1548 : extract files and exit if asked to do so
1549 case "$extractsh" in
1550 true)
1551         case "$realsilent" in
1552         true) ;;
1553         *) exec 1>&4;;
1554         esac
1555         case "$config_sh" in
1556         '') config_sh='config.sh';;
1557         esac
1558         echo " "
1559         echo "Fetching answers from $config_sh..."
1560         cd ..
1561         . $config_sh
1562         test "$override" && . ./optdef.sh
1563         echo " "
1564         . UU/extract
1565         rm -rf UU
1566         echo "Done."
1567         exit 0
1568         ;;
1569 esac
1570
1571 : Eunice requires " " instead of "", can you believe it
1572 echo " "
1573 : Here we go...
1574 echo "Beginning of configuration questions for $package."
1575
1576 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1577
1578 : first determine how to suppress newline on echo command
1579 echo " "
1580 echo "Checking echo to see how to suppress newlines..."
1581 (echo "hi there\c" ; echo " ") >.echotmp
1582 if $contains c .echotmp >/dev/null 2>&1 ; then
1583         echo "...using -n."
1584         n='-n'
1585         c=''
1586 else
1587         cat <<'EOM'
1588 ...using \c
1589 EOM
1590         n=''
1591         c='\c'
1592 fi
1593 echo $n "The star should be here-->$c"
1594 echo '*'
1595 rm -f .echotmp
1596
1597 : Now test for existence of everything in MANIFEST
1598 echo " "
1599 if test -f $rsrc/MANIFEST; then
1600         echo "First let's make sure your kit is complete.  Checking..." >&4
1601         awk '$1 !~ /PACK[A-Z]+/ {print $1}' $rsrc/MANIFEST | split -50
1602         rm -f missing
1603         tmppwd=`pwd`
1604         for filelist in x??; do
1605                 (cd $rsrc; ls `cat $tmppwd/$filelist` >/dev/null 2>>$tmppwd/missing)
1606         done
1607         if test -s missing; then
1608                 cat missing >&4
1609                 cat >&4 <<'EOM'
1610
1611 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1612
1613 You have the option of continuing the configuration process, despite the
1614 distinct possibility that your kit is damaged, by typing 'y'es.  If you
1615 do, don't blame me if something goes wrong.  I advise you to type 'n'o
1616 and contact the author (perlbug@perl.org).
1617
1618 EOM
1619                 echo $n "Continue? [n] $c" >&4
1620                 read ans
1621                 case "$ans" in
1622                 y*)
1623                         echo "Continuing..." >&4
1624                         rm -f missing
1625                         ;;
1626                 *)
1627                         echo "ABORTING..." >&4
1628                         kill $$
1629                         ;;
1630                 esac
1631         else
1632                 echo "Looks good..."
1633         fi
1634 else
1635         echo "There is no MANIFEST file.  I hope your kit is complete !"
1636 fi
1637 rm -f missing x??
1638
1639 echo " "
1640 : Find the appropriate value for a newline for tr
1641 if test -n "$DJGPP"; then
1642        trnl='\012'
1643 fi
1644 if test X"$trnl" = X; then
1645         case "`echo foo|tr '\n' x 2>/dev/null`" in
1646         foox) trnl='\n' ;;
1647         esac
1648 fi
1649 if test X"$trnl" = X; then
1650         case "`echo foo|tr '\012' x 2>/dev/null`" in
1651         foox) trnl='\012' ;;
1652         esac
1653 fi
1654 if test X"$trnl" = X; then
1655         cat <<EOM >&2
1656
1657 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
1658
1659 EOM
1660         exit 1
1661 fi
1662
1663 : compute the number of columns on the terminal for proper question formatting
1664 case "$COLUMNS" in
1665 '') COLUMNS='80';;
1666 esac
1667
1668 : set up the echo used in my read
1669 myecho="case \"\$xxxm\" in
1670 '') echo $n \"\$rp $c\" >&4;;
1671 *) case \"\$rp\" in
1672         '') echo $n \"[\$xxxm] $c\";;
1673         *)
1674                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
1675                         echo \"\$rp\" >&4
1676                         echo $n \"[\$xxxm] $c\" >&4
1677                 else
1678                         echo $n \"\$rp [\$xxxm] $c\" >&4
1679                 fi
1680                 ;;
1681         esac;;
1682 esac"
1683
1684 : now set up to do reads with possible shell escape and default assignment
1685 cat <<EOSC >myread
1686 $startsh
1687 xxxm=\$dflt
1688 $myecho
1689 ans='!'
1690 case "\$fastread" in
1691 yes) case "\$dflt" in
1692         '') ;;
1693         *) ans='';
1694                 case "\$silent-\$rp" in
1695                 true-) ;;
1696                 *) echo " " >&4;;
1697                 esac;;
1698         esac;;
1699 *) case "\$silent" in
1700         true) case "\$rp" in
1701                 '') ans='';;
1702                 esac;;
1703         esac;;
1704 esac
1705 while expr "X\$ans" : "X!" >/dev/null; do
1706         read answ
1707         set x \$xxxm
1708         shift
1709         aok=''; eval "ans=\\"\$answ\\"" && aok=y
1710         case  "\$answ" in
1711         "!")
1712                 sh 1>&4
1713                 echo " "
1714                 $myecho
1715                 ;;
1716         !*)
1717                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
1718                 shift
1719                 sh 1>&4 -c "\$*"
1720                 echo " "
1721                 $myecho
1722                 ;;
1723         "\$ans")
1724                 case "\$ans" in
1725                 \\&*)
1726                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
1727                         shift
1728                         case "\$1" in
1729                         -d)
1730                                 fastread=yes
1731                                 echo "(OK, I'll run with -d after this question.)" >&4
1732                                 ;;
1733                         -*)
1734                                 echo "*** Sorry, \$1 not supported yet." >&4
1735                                 ;;
1736                         esac
1737                         $myecho
1738                         ans=!
1739                         ;;
1740                 esac;;
1741         *)
1742                 case "\$aok" in
1743                 y)
1744                         echo "*** Substitution done -- please confirm."
1745                         xxxm="\$ans"
1746                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
1747                         xxxm="\$ans"
1748                         ans=!
1749                         ;;
1750                 *)
1751                         echo "*** Error -- try again."
1752                         ans=!
1753                         ;;
1754                 esac
1755                 $myecho
1756                 ;;
1757         esac
1758         case "\$ans\$xxxm\$nostick" in
1759         '')
1760                 ans=!
1761                 $myecho
1762                 ;;
1763         esac
1764 done
1765 case "\$ans" in
1766 '') ans="\$xxxm";;
1767 esac
1768 EOSC
1769
1770 : create .config dir to save info across Configure sessions
1771 test -d ../.config || mkdir ../.config
1772 cat >../.config/README <<EOF
1773 This directory created by Configure to save information that should
1774 persist across sessions for $package.
1775
1776 You may safely delete it if you wish.
1777 EOF
1778
1779 xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
1780 case "$usedevel" in
1781 $define|true|[yY]*) ;;
1782 *) case "$xversion" in
1783    *[13579])
1784         cat >&4 <<EOH
1785 *** WHOA THERE!!! ***
1786
1787     This is an UNSTABLE DEVELOPMENT release.
1788     The version of this $package distribution is $xversion, that is, odd,
1789     (as opposed to even) and that signifies a development release.
1790     If you want a maintenance release, you want an even-numbered version.
1791
1792     Do ***NOT*** install this into production use.
1793     Data corruption and crashes are possible.
1794
1795     It is most seriously suggested that you do not continue any further
1796     unless you want to help in developing and debugging Perl.
1797
1798 EOH
1799         rp='Do you really want to continue?'
1800         dflt='n'
1801         . ./myread
1802         case "$ans" in
1803         [yY]) echo >&4 "Okay, continuing." ;;
1804         *) echo >&4 "Okay, bye."
1805            exit 1
1806            ;;
1807         esac
1808         ;;
1809     esac
1810     ;;
1811 esac
1812
1813 : general instructions
1814 needman=true
1815 firsttime=true
1816 user=`(logname) 2>/dev/null`
1817 case "$user" in
1818 '') user=`whoami 2>&1`;;
1819 esac
1820 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
1821         firsttime=false
1822         echo " "
1823         rp='Would you like to see the instructions?'
1824         dflt=n
1825         . ./myread
1826         case "$ans" in
1827         [yY]*) ;;
1828         *) needman=false;;
1829         esac
1830 fi
1831 if $needman; then
1832         cat <<EOH
1833
1834 This installation shell script will examine your system and ask you questions
1835 to determine how the perl5 package should be installed. If you get
1836 stuck on a question, you may use a ! shell escape to start a subshell or
1837 execute a command.  Many of the questions will have default answers in square
1838 brackets; typing carriage return will give you the default.
1839
1840 On some of the questions which ask for file or directory names you are allowed
1841 to use the ~name construct to specify the login directory belonging to "name",
1842 even if you don't have a shell which knows about that.  Questions where this is
1843 allowed will be marked "(~name ok)".
1844
1845 EOH
1846         rp=''
1847         dflt='Type carriage return to continue'
1848         . ./myread
1849         cat <<'EOH'
1850
1851 The prompter used in this script allows you to use shell variables and
1852 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
1853 in the default answer, as if the default line was a set of arguments given to a
1854 script shell.  This means you may also use $* to repeat the whole default line,
1855 so you do not have to re-type everything to add something to the default.
1856
1857 Everytime there is a substitution, you will have to confirm.  If there is an
1858 error (e.g. an unmatched backtick), the default answer will remain unchanged
1859 and you will be prompted again.
1860
1861 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
1862 the questions and use the computed defaults (or the previous answers if there
1863 was already a config.sh file). Type 'Configure -h' for a list of options.
1864 You may also start interactively and then answer '& -d' at any prompt to turn
1865 on the non-interactive behaviour for the remainder of the execution.
1866
1867 EOH
1868         . ./myread
1869         cat <<EOH
1870
1871 Much effort has been expended to ensure that this shell script will run on any
1872 Unix system.  If despite that it blows up on yours, your best bet is to edit
1873 Configure and run it again.  If you can't run Configure for some reason,
1874 you'll have to generate a config.sh file by hand.  Whatever problems you
1875 have, let me (perlbug@perl.org) know how I blew it.
1876
1877 This installation script affects things in two ways:
1878
1879 1) it may do direct variable substitutions on some of the files included
1880    in this kit.
1881 2) it builds a config.h file for inclusion in C programs.  You may edit
1882    any of these files as the need arises after running this script.
1883
1884 If you make a mistake on a question, there is no easy way to back up to it
1885 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
1886 files.  Configure will offer to let you do this before it runs the SH files.
1887
1888 EOH
1889         dflt='Type carriage return to continue'
1890         . ./myread
1891         case "$firsttime" in
1892         true) echo $user >>../.config/instruct;;
1893         esac
1894 fi
1895
1896 : find out where common programs are
1897 echo " "
1898 echo "Locating common programs..." >&4
1899 cat <<EOSC >loc
1900 $startsh
1901 case \$# in
1902 0) exit 1;;
1903 esac
1904 thing=\$1
1905 shift
1906 dflt=\$1
1907 shift
1908 for dir in \$*; do
1909         case "\$thing" in
1910         .)
1911         if test -d \$dir/\$thing; then
1912                 echo \$dir
1913                 exit 0
1914         fi
1915         ;;
1916         *)
1917         for thisthing in \$dir/\$thing; do
1918                 : just loop through to pick last item
1919         done
1920         if test -f \$thisthing; then
1921                 echo \$thisthing
1922                 exit 0
1923         elif test -f \$dir/\$thing.exe; then
1924                 if test -n "$DJGPP"; then
1925                         echo \$dir/\$thing.exe
1926                 else
1927                         : on Eunice apparently
1928                         echo \$dir/\$thing
1929                 fi
1930                 exit 0
1931         fi
1932         ;;
1933         esac
1934 done
1935 echo \$dflt
1936 exit 1
1937 EOSC
1938 chmod +x loc
1939 $eunicefix loc
1940 loclist="
1941 awk
1942 cat
1943 comm
1944 cp
1945 echo
1946 expr
1947 grep
1948 ls
1949 make
1950 mkdir
1951 rm
1952 sed
1953 sort
1954 touch
1955 tr
1956 uniq
1957 "
1958 trylist="
1959 Mcc
1960 ar
1961 byacc
1962 cpp
1963 csh
1964 date
1965 egrep
1966 gzip
1967 less
1968 ln
1969 more
1970 nm
1971 nroff
1972 pg
1973 test
1974 uname
1975 zip
1976 "
1977 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1978 pth="$pth /lib /usr/lib"
1979 for file in $loclist; do
1980         eval xxx=\$$file
1981         case "$xxx" in
1982         /*|?:[\\/]*)
1983                 if test -f "$xxx"; then
1984                         : ok
1985                 else
1986                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
1987                         xxx=`./loc $file $file $pth`
1988                 fi
1989                 ;;
1990         '') xxx=`./loc $file $file $pth`;;
1991         *) xxx=`./loc $xxx $xxx $pth`;;
1992         esac
1993         eval $file=$xxx
1994         eval _$file=$xxx
1995         case "$xxx" in
1996         /*)
1997                 echo $file is in $xxx.
1998                 ;;
1999         ?:[\\/]*)
2000                 echo $file is in $xxx.
2001                 ;;
2002         *)
2003                 echo "I don't know where '$file' is, and my life depends on it." >&4
2004                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2005                 exit 1
2006                 ;;
2007         esac
2008 done
2009 echo " "
2010 echo "Don't worry if any of the following aren't found..."
2011 say=offhand
2012 for file in $trylist; do
2013         eval xxx=\$$file
2014         case "$xxx" in
2015         /*|?:[\\/]*)
2016                 if test -f "$xxx"; then
2017                         : ok
2018                 else
2019                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2020                         xxx=`./loc $file $file $pth`
2021                 fi
2022                 ;;
2023         '') xxx=`./loc $file $file $pth`;;
2024         *) xxx=`./loc $xxx $xxx $pth`;;
2025         esac
2026         eval $file=$xxx
2027         eval _$file=$xxx
2028         case "$xxx" in
2029         /*)
2030                 echo $file is in $xxx.
2031                 ;;
2032         ?:[\\/]*)
2033                 echo $file is in $xxx.
2034                 ;;
2035         *)
2036                 echo "I don't see $file out there, $say."
2037                 say=either
2038                 ;;
2039         esac
2040 done
2041 case "$egrep" in
2042 egrep)
2043         echo "Substituting grep for egrep."
2044         egrep=$grep
2045         ;;
2046 esac
2047 case "$ln" in
2048 ln)
2049         echo "Substituting cp for ln."
2050         ln=$cp
2051         ;;
2052 esac
2053 case "$test" in
2054 test)
2055         echo "Hopefully test is built into your sh."
2056         ;;
2057 *)
2058         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2059                 echo "Using the test built into your sh."
2060                 test=test
2061                 _test=test
2062         fi
2063         ;;
2064 esac
2065 case "$echo" in
2066 echo)
2067         echo "Hopefully echo is built into your sh."
2068         ;;
2069 '') ;;
2070 *)
2071         echo " "
2072 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2073         $echo $n "hi there$c" >foo1
2074         echo $n "hi there$c" >foo2
2075         if cmp foo1 foo2 >/dev/null 2>&1; then
2076                 echo "They are compatible.  In fact, they may be identical."
2077         else
2078                 case "$n" in
2079                 '-n') n='' c='\c';;
2080                 *) n='-n' c='';;
2081                 esac
2082                 cat <<FOO
2083 They are not compatible!  You are probably running ksh on a non-USG system.
2084 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2085 have echo built in and we may have to run some Bourne shell scripts.  That
2086 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2087
2088 FOO
2089                 $echo $n "The star should be here-->$c"
2090                 $echo "*"
2091         fi
2092         $rm -f foo1 foo2
2093         ;;
2094 esac
2095
2096 cat <<EOS >checkcc
2097 $startsh
2098 EOS
2099 cat <<'EOSC' >>checkcc
2100 case "$cc" in
2101 '') ;;
2102 *)  $rm -f try try.*
2103     $cat >try.c <<EOM
2104 int main(int argc, char *argv[]) {
2105   return 0;
2106 }
2107 EOM
2108     if $cc -o try $ccflags try.c; then
2109        :
2110     else
2111         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2112         despair=yes
2113         trygcc=yes
2114         case "$cc" in
2115         *gcc*) trygcc=no ;;
2116         esac
2117         case "`$cc -v -c try.c 2>&1`" in
2118         *gcc*) trygcc=no ;;
2119         esac
2120         if $test X"$trygcc" = Xyes; then
2121             if gcc -o try -c try.c; then
2122                 echo " "
2123                 echo "You seem to have a working gcc, though." >&4
2124                 rp="Would you like to use it?"
2125                 dflt=y
2126                 if $test -f myread; then
2127                     . ./myread
2128                 else
2129                     if $test -f UU/myread; then
2130                         . ./UU/myread
2131                     else
2132                         echo "Cannot find myread, sorry.  Aborting." >&2
2133                         exit 1
2134                     fi
2135                 fi  
2136                 case "$ans" in
2137                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no ;;
2138                 esac
2139             fi
2140         fi
2141         if $test X"$despair" = Xyes; then
2142             $cat >&4 <<EOM
2143 You need to find a working C compiler.
2144 Either (purchase and) install the C compiler supplied by your OS vendor,
2145 or for a free C compiler try http://gcc.gnu.org/
2146 I cannot continue any further, aborting.
2147 EOM
2148             exit 1
2149         fi
2150     fi
2151     $rm -f try try.*
2152     ;;
2153 esac
2154 EOSC
2155
2156 : determine whether symbolic links are supported
2157 echo " "
2158 $touch blurfl
2159 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2160         echo "Symbolic links are supported." >&4
2161         lns="$ln -s"
2162 else
2163         echo "Symbolic links are NOT supported." >&4
2164         lns="$ln"
2165 fi
2166 $rm -f blurfl sym
2167
2168 : see whether [:lower:] and [:upper:] are supported character classes
2169 echo " "
2170 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2171 ABYZ)
2172         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2173         up='[:upper:]'
2174         low='[:lower:]'
2175         ;;
2176 *)      # There is a discontinuity in EBCDIC between 'I' and 'J'
2177         # (0xc9 and 0xd1), therefore that is a nice testing point.
2178         if test "X$up" = X -o "X$low" = X; then
2179             case "`echo IJ | $tr '[I-J]' '[i-j]' 2>/dev/null`" in
2180             ij) up='[A-Z]'
2181                 low='[a-z]'
2182                 ;;
2183             esac
2184         fi
2185         if test "X$up" = X -o "X$low" = X; then
2186             case "`echo IJ | $tr I-J i-j 2>/dev/null`" in
2187             ij) up='A-Z'
2188                 low='a-z'
2189                 ;;
2190             esac
2191         fi
2192         if test "X$up" = X -o "X$low" = X; then
2193             case "`echo IJ | od -x 2>/dev/null`" in
2194             *C9D1*|*c9d1*)
2195                 echo "Hey, this might be EBCDIC." >&4
2196                 if test "X$up" = X -o "X$low" = X; then
2197                     case "`echo IJ | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
2198                     ij) up='[A-IJ-RS-Z]'
2199                         low='[a-ij-rs-z]'
2200                         ;;
2201                     esac
2202                 fi
2203                 if test "X$up" = X -o "X$low" = X; then
2204                     case "`echo IJ | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
2205                     ij) up='A-IJ-RS-Z'
2206                         low='a-ij-rs-z'
2207                         ;;
2208                     esac
2209                 fi
2210                 ;;
2211             esac
2212         fi
2213 esac
2214 case "`echo IJ | $tr \"$up\" \"$low\" 2>/dev/null`" in
2215 ij)
2216     echo "Using $up and $low to convert case." >&4
2217     ;;
2218 *)
2219     echo "I don't know how to translate letters from upper to lower case." >&4
2220     echo "Your tr is not acting any way I know of." >&4
2221     exit 1
2222     ;;
2223 esac
2224 : set up the translation script tr, must be called with ./tr of course
2225 cat >tr <<EOSC
2226 $startsh
2227 case "\$1\$2" in
2228 '[A-Z][a-z]') exec $tr '$up' '$low';;
2229 '[a-z][A-Z]') exec $tr '$low' '$up';;
2230 esac
2231 exec $tr "\$@"
2232 EOSC
2233 chmod +x tr
2234 $eunicefix tr
2235
2236 : Try to determine whether config.sh was made on this system
2237 case "$config_sh" in
2238 '')
2239 myuname=`$uname -a 2>/dev/null`
2240 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
2241 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
2242 # because the A-Z/a-z are not consecutive.
2243 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
2244         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
2245 newmyuname="$myuname"
2246 dflt=n
2247 case "$knowitall" in
2248 '')
2249         if test -f ../config.sh; then
2250                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
2251                         eval "`grep myuname= ../config.sh`"
2252                 fi
2253                 if test "X$myuname" = "X$newmyuname"; then
2254                         dflt=y
2255                 fi
2256         fi
2257         ;;
2258 *) dflt=y;;
2259 esac
2260
2261 : Get old answers from old config file if Configure was run on the
2262 : same system, otherwise use the hints.
2263 hint=default
2264 cd ..
2265 if test -f config.sh; then
2266         echo " "
2267         rp="I see a config.sh file.  Shall I use it to set the defaults?"
2268         . UU/myread
2269         case "$ans" in
2270         n*|N*) echo "OK, I'll ignore it."
2271                 mv config.sh config.sh.old
2272                 myuname="$newmyuname"
2273                 ;;
2274         *)  echo "Fetching default answers from your old config.sh file..." >&4
2275                 tmp_n="$n"
2276                 tmp_c="$c"
2277                 tmp_sh="$sh"
2278                 . ./config.sh
2279                 cp config.sh UU
2280                 n="$tmp_n"
2281                 c="$tmp_c"
2282                 : Older versions did not always set $sh.  Catch re-use of such
2283                 : an old config.sh.
2284                 case "$sh" in
2285                 '') sh="$tmp_sh" ;;
2286                 esac
2287                 hint=previous
2288                 ;;
2289         esac
2290 fi
2291 . ./UU/checkcc
2292 if test ! -f config.sh; then
2293         $cat <<EOM
2294
2295 First time through, eh?  I have some defaults handy for some systems
2296 that need some extra help getting the Configure answers right:
2297
2298 EOM
2299         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
2300         dflt=''
2301         : Half the following guesses are probably wrong... If you have better
2302         : tests or hints, please send them to perlbug@perl.org
2303         : The metaconfig authors would also appreciate a copy...
2304         $test -f /irix && osname=irix
2305         $test -f /xenix && osname=sco_xenix
2306         $test -f /dynix && osname=dynix
2307         $test -f /dnix && osname=dnix
2308         $test -f /lynx.os && osname=lynxos
2309         $test -f /unicos && osname=unicos && osvers=`$uname -r`
2310         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
2311         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
2312         $test -f /bin/mips && /bin/mips && osname=mips
2313         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
2314                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
2315         $test -d /usr/apollo/bin && osname=apollo
2316         $test -f /etc/saf/_sactab && osname=svr4
2317         $test -d /usr/include/minix && osname=minix
2318         if $test -d /MachTen -o -d /MachTen_Folder; then
2319                 osname=machten
2320                 if $test -x /sbin/version; then
2321                         osvers=`/sbin/version | $awk '{print $2}' |
2322                         $sed -e 's/[A-Za-z]$//'`
2323                 elif $test -x /usr/etc/version; then
2324                         osvers=`/usr/etc/version | $awk '{print $2}' |
2325                         $sed -e 's/[A-Za-z]$//'`
2326                 else
2327                         osvers="$2.$3"
2328                 fi
2329         fi
2330
2331         $test -f /sys/posix.dll &&
2332                 $test -f /usr/bin/what &&
2333                 set X `/usr/bin/what /sys/posix.dll` &&
2334                 $test "$3" = UWIN &&
2335                 osname=uwin &&
2336                 osvers="$5"
2337
2338         if $test -f $uname; then
2339                 set X $myuname
2340                 shift
2341
2342                 case "$5" in
2343                 fps*) osname=fps ;;
2344                 mips*)
2345                         case "$4" in
2346                         umips) osname=umips ;;
2347                         *) osname=mips ;;
2348                         esac;;
2349                 [23]100) osname=mips ;;
2350                 next*) osname=next ;;
2351                 i386*)
2352                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
2353                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
2354                                 osname='sco'
2355                                 osvers=$tmp
2356                         elif $test -f /etc/kconfig; then
2357                                 osname=isc
2358                                 if test "$lns" = "$ln -s"; then
2359                                         osvers=4
2360                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
2361                                         osvers=3
2362                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
2363                                         osvers=2
2364                                 fi
2365                         fi
2366                         tmp=''
2367                         ;;
2368                 pc*)
2369                         if test -n "$DJGPP"; then
2370                                 osname=dos
2371                                 osvers=djgpp
2372                         fi
2373                         ;;
2374                 esac
2375
2376                 case "$1" in
2377                 aix) osname=aix
2378                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
2379                         case "$tmp" in
2380                         'not found') osvers="$4"."$3" ;;
2381                         '<3240'|'<>3240') osvers=3.2.0 ;;
2382                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
2383                         '=3250'|'>3250') osvers=3.2.5 ;;
2384                         *) osvers=$tmp;;
2385                         esac
2386                         ;;
2387                 bsd386) osname=bsd386
2388                         osvers=`$uname -r`
2389                         ;;
2390                 cygwin*) osname=cygwin
2391                         osvers="$3"
2392                         ;;
2393                 *dc.osx) osname=dcosx
2394                         osvers="$3"
2395                         ;;
2396                 dnix) osname=dnix
2397                         osvers="$3"
2398                         ;;
2399                 domainos) osname=apollo
2400                         osvers="$3"
2401                         ;;
2402                 dgux) osname=dgux 
2403                         osvers="$3"
2404                         ;;
2405                 dynixptx*) osname=dynixptx
2406                         osvers=`echo "$4"|sed 's/^v//'`
2407                         ;;
2408                 freebsd) osname=freebsd 
2409                         osvers="$3" ;;
2410                 genix) osname=genix ;;
2411                 hp*) osname=hpux 
2412                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
2413                         ;;
2414                 irix*) osname=irix
2415                         case "$3" in
2416                         4*) osvers=4 ;;
2417                         5*) osvers=5 ;;
2418                         *)      osvers="$3" ;;
2419                         esac
2420                         ;;
2421                 linux) osname=linux
2422                         case "$3" in
2423                         *)      osvers="$3" ;;
2424                         esac
2425                         ;;
2426                 MiNT) osname=mint
2427                         ;;
2428                 netbsd*) osname=netbsd
2429                         osvers="$3"
2430                         ;;
2431                 news-os) osvers="$3"
2432                         case "$3" in
2433                         4*) osname=newsos4 ;;
2434                         *) osname=newsos ;;
2435                         esac
2436                         ;;
2437                 next*) osname=next ;;
2438                 nonstop-ux) osname=nonstopux ;;
2439                 POSIX-BC | posix-bc ) osname=posix-bc
2440                         osvers="$3"
2441                         ;;
2442                 powerux | power_ux | powermax_os | powermaxos | \
2443                 powerunix | power_unix) osname=powerux
2444                         osvers="$3"
2445                         ;;
2446                 qnx) osname=qnx
2447                         osvers="$4"
2448                         ;;
2449                 solaris) osname=solaris
2450                         case "$3" in
2451                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
2452                         *)      osvers="$3" ;;
2453                         esac
2454                         ;;
2455                 sunos) osname=sunos
2456                         case "$3" in
2457                         5*) osname=solaris
2458                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
2459                         *)      osvers="$3" ;;
2460                         esac
2461                         ;;
2462                 titanos) osname=titanos
2463                         case "$3" in
2464                         1*) osvers=1 ;;
2465                         2*) osvers=2 ;;
2466                         3*) osvers=3 ;;
2467                         4*) osvers=4 ;;
2468                         *)      osvers="$3" ;;
2469                         esac
2470                         ;;
2471                 ultrix) osname=ultrix
2472                         osvers="$3"
2473                         ;;
2474                 osf1|mls+)      case "$5" in
2475                                 alpha)
2476                                         osname=dec_osf
2477                                         osvers=`sizer -v | awk '{print $3}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
2478                                         case "$osvers" in
2479                                         [1-9].[0-9]*) ;;
2480                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
2481                                         esac
2482                                         ;;
2483                         hp*)    osname=hp_osf1  ;;
2484                         mips)   osname=mips_osf1 ;;
2485                         esac
2486                         ;;
2487                 unixware) osname=svr5
2488                         osvers="$4"
2489                         ;;
2490                 uts) osname=uts
2491                         osvers="$3"
2492                         ;;
2493                 $2) case "$osname" in
2494                         *isc*) ;;
2495                         *freebsd*) ;;
2496                         svr*)
2497                                 : svr4.x or possibly later
2498                                 case "svr$3" in 
2499                                 ${osname}*)
2500                                         osname=svr$3
2501                                         osvers=$4
2502                                         ;;
2503                                 esac
2504                                 case "$osname" in
2505                                 svr4.0)
2506                                         : Check for ESIX
2507                                         if test -f /stand/boot ; then
2508                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
2509                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
2510                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
2511                                                         if test -n "$isesix"; then
2512                                                                 osname=esix4
2513                                                         fi
2514                                                 fi
2515                                         fi
2516                                         ;;
2517                                 esac
2518                                 ;;
2519                         *)      if test -f /etc/systemid; then
2520                                         osname=sco
2521                                         set `echo $3 | $sed 's/\./ /g'` $4
2522                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
2523                                                 osvers=$1.$2.$3
2524                                         elif $test -f $src/hints/sco_$1_$2.sh; then
2525                                                 osvers=$1.$2
2526                                         elif $test -f $src/hints/sco_$1.sh; then
2527                                                 osvers=$1
2528                                         fi
2529                                 else
2530                                         case "$osname" in
2531                                         '') : Still unknown.  Probably a generic Sys V.
2532                                                 osname="sysv"
2533                                                 osvers="$3"
2534                                                 ;;
2535                                         esac
2536                                 fi
2537                                 ;;
2538                         esac
2539                         ;;
2540                 *)      case "$osname" in
2541                         '') : Still unknown.  Probably a generic BSD.
2542                                 osname="$1"
2543                                 osvers="$3"
2544                                 ;;
2545                         esac
2546                         ;;
2547                 esac
2548         else
2549                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
2550                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
2551                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
2552                                 osname=news_os
2553                         fi
2554                         $rm -f UU/kernel.what
2555                 elif test -d c:/.; then
2556                         set X $myuname
2557                         osname=os2
2558                         osvers="$5"
2559                 fi
2560         fi
2561         
2562         : Now look for a hint file osname_osvers, unless one has been
2563         : specified already.
2564         case "$hintfile" in
2565         ''|' ')
2566                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
2567                 : Also try without trailing minor version numbers.
2568                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
2569                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
2570                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
2571                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
2572                 case "$file" in
2573                 '') dflt=none ;;
2574                 *)  case "$osvers" in
2575                         '') dflt=$file
2576                                 ;;
2577                         *)  if $test -f $src/hints/$file.sh ; then
2578                                         dflt=$file
2579                                 elif $test -f $src/hints/$xfile.sh ; then
2580                                         dflt=$xfile
2581                                 elif $test -f $src/hints/$xxfile.sh ; then
2582                                         dflt=$xxfile
2583                                 elif $test -f $src/hints/$xxxfile.sh ; then
2584                                         dflt=$xxxfile
2585                                 elif $test -f $src/hints/$xxxxfile.sh ; then
2586                                         dflt=$xxxxfile
2587                                 elif $test -f "$src/hints/${osname}.sh" ; then
2588                                         dflt="${osname}"
2589                                 else
2590                                         dflt=none
2591                                 fi
2592                                 ;;
2593                         esac
2594                         ;;
2595                 esac
2596                 if $test -f Policy.sh ; then
2597                         case "$dflt" in
2598                         *Policy*) ;;
2599                         none) dflt="Policy" ;;
2600                         *) dflt="Policy $dflt" ;;
2601                         esac
2602                 fi
2603                 ;;
2604         *)
2605                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
2606                 ;;
2607         esac
2608
2609         if $test -f Policy.sh ; then
2610                 $cat <<EOM
2611
2612 There's also a Policy hint file available, which should make the
2613 site-specific (policy) questions easier to answer.
2614 EOM
2615
2616         fi
2617
2618         $cat <<EOM
2619
2620 You may give one or more space-separated answers, or "none" if appropriate.
2621 A well-behaved OS will have no hints, so answering "none" or just "Policy"
2622 is a good thing.  DO NOT give a wrong version or a wrong OS.
2623
2624 EOM
2625
2626         rp="Which of these apply, if any?"
2627         . UU/myread
2628         tans=$ans
2629         for file in $tans; do
2630                 if $test X$file = XPolicy -a -f Policy.sh; then
2631                         . Policy.sh
2632                         $cat Policy.sh >> UU/config.sh
2633                 elif $test -f $src/hints/$file.sh; then
2634                         . $src/hints/$file.sh
2635                         $cat $src/hints/$file.sh >> UU/config.sh
2636                 elif $test X$tans = X -o X$tans = Xnone ; then
2637                         : nothing
2638                 else
2639                         : Give one chance to correct a possible typo.
2640                         echo "$file.sh does not exist"
2641                         dflt=$file
2642                         rp="hint to use instead?"
2643                         . UU/myread
2644                         for file in $ans; do
2645                                 if $test -f "$src/hints/$file.sh"; then
2646                                         . $src/hints/$file.sh
2647                                         $cat $src/hints/$file.sh >> UU/config.sh
2648                                 elif $test X$ans = X -o X$ans = Xnone ; then
2649                                         : nothing
2650                                 else
2651                                         echo "$file.sh does not exist -- ignored."
2652                                 fi
2653                         done
2654                 fi
2655         done
2656
2657         hint=recommended
2658         : Remember our hint file for later.
2659         if $test -f "$src/hints/$file.sh" ; then
2660                 hintfile="$file"
2661         else
2662                 hintfile=''
2663         fi
2664 fi
2665 cd UU
2666 ;;
2667 *)
2668         echo " "
2669         echo "Fetching default answers from $config_sh..." >&4
2670         tmp_n="$n"
2671         tmp_c="$c"
2672         cd ..
2673         cp $config_sh config.sh 2>/dev/null
2674         chmod +w config.sh
2675         . ./config.sh
2676         cd UU
2677         cp ../config.sh .
2678         n="$tmp_n"
2679         c="$tmp_c"
2680         hint=previous
2681         ;;
2682 esac
2683 test "$override" && . ./optdef.sh
2684
2685 : Restore computed paths
2686 for file in $loclist $trylist; do
2687         eval $file="\$_$file"
2688 done
2689
2690 cat << EOM
2691
2692 Configure uses the operating system name and version to set some defaults.
2693 The default value is probably right if the name rings a bell. Otherwise,
2694 since spelling matters for me, either accept the default or answer "none"
2695 to leave it blank.
2696
2697 EOM
2698 case "$osname" in
2699         ''|' ')
2700                 case "$hintfile" in
2701                 ''|' '|none) dflt=none ;;
2702                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
2703                 esac
2704                 ;;
2705         *) dflt="$osname" ;;
2706 esac
2707 rp="Operating system name?"
2708 . ./myread
2709 case "$ans" in
2710 none)  osname='' ;;
2711 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
2712 esac
2713 echo " "
2714 case "$osvers" in
2715         ''|' ')
2716                 case "$hintfile" in
2717                 ''|' '|none) dflt=none ;;
2718                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
2719                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
2720                         case "$dflt" in
2721                         ''|' ') dflt=none ;;
2722                         esac
2723                         ;;
2724                 esac
2725                 ;;
2726         *) dflt="$osvers" ;;
2727 esac
2728 rp="Operating system version?"
2729 . ./myread
2730 case "$ans" in
2731 none)  osvers='' ;;
2732 *) osvers="$ans" ;;
2733 esac
2734
2735
2736 . ./posthint.sh
2737
2738 : who configured the system
2739 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
2740 cf_by=`(logname) 2>/dev/null`
2741 case "$cf_by" in
2742 "")
2743         cf_by=`(whoami) 2>/dev/null`
2744         case "$cf_by" in
2745         "") cf_by=unknown ;;
2746         esac ;;
2747 esac
2748
2749 : set up the script used to warn in case of inconsistency
2750 cat <<EOS >whoa
2751 $startsh
2752 EOS
2753 cat <<'EOSC' >>whoa
2754 dflt=y
2755 echo " "
2756 echo "*** WHOA THERE!!! ***" >&4
2757 echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
2758 rp="    Keep the $hint value?"
2759 . ./myread
2760 case "$ans" in
2761 y) td=$was; tu=$was;;
2762 esac
2763 EOSC
2764
2765 : function used to set $1 to $val
2766 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
2767 case "$val$was" in
2768 $define$undef) . ./whoa; eval "$var=\$td";;
2769 $undef$define) . ./whoa; eval "$var=\$tu";;
2770 *) eval "$var=$val";;
2771 esac'
2772
2773 case "$usethreads" in
2774 $define|true|[yY]*)     dflt='y';;
2775 *) dflt='n';;
2776 esac
2777 cat <<EOM
2778
2779 Perl can be built to take advantage of threads on some systems.
2780 To do so, Configure can be run with -Dusethreads.
2781
2782 Note that threading is a highly experimental feature, and
2783 some known race conditions still remain.  If you choose to try
2784 it, be very sure to not actually deploy it for production
2785 purposes.  README.threads has more details, and is required
2786 reading if you enable threads.
2787
2788 If this doesn't make any sense to you, just accept the default '$dflt'.
2789 EOM
2790 rp='Build a threading Perl?'
2791 . ./myread
2792 case "$ans" in
2793 y|Y)    val="$define" ;;
2794 *)      val="$undef" ;;
2795 esac
2796 set usethreads
2797 eval $setvar
2798
2799 case "$usethreads" in
2800 $define)
2801         $cat <<EOM
2802
2803 As of 5.5.640, Perl has two different internal threading implementations,
2804 the 5.005 version (5005threads) and an interpreter-based version
2805 (ithreads) that has one interpreter per thread.  Both are very 
2806 experimental.  This arrangement exists to help developers work out
2807 which one is better.
2808
2809 If you're a casual user, you probably don't want interpreter-threads
2810 at this time.  There doesn't yet exist a way to create threads from
2811 within Perl in this model, i.e., "use Thread;" will NOT work.
2812 EOM
2813         : Default to ithreads unless overridden on command line or with
2814         : old config.sh
2815         dflt='y'
2816         case "$use5005threads" in
2817                 $define|true|[yY]*) dflt='n';;
2818         esac
2819         case "$useithreads" in
2820                 $undef|false|[nN]*) dflt='n';;
2821         esac
2822         rp='Use interpreter-based ithreads?'
2823         . ./myread
2824         case "$ans" in
2825         y|Y)    val="$define" ;;
2826         *)      val="$undef" ;;
2827         esac
2828         set useithreads
2829         eval $setvar
2830         : Now set use5005threads to the opposite value.
2831         case "$useithreads" in
2832         $define) val="$undef" ;;
2833         *) val="$define" ;;
2834         esac
2835         set use5005threads
2836         eval $setvar
2837         ;;
2838 *)
2839         useithreads="$undef"
2840         use5005threads="$undef"
2841         ;;
2842 esac
2843
2844 case "$d_oldpthreads" in
2845 '')     : Configure tests would be welcome here.  For now, assume undef.
2846         val="$undef" ;;
2847 *)      val="$d_oldpthreads" ;;
2848 esac
2849 set d_oldpthreads
2850 eval $setvar
2851
2852
2853 case "$usethreads" in
2854 "$define"|true|[yY]*)
2855 : Look for a hint-file generated 'call-back-unit'.  If the
2856 : user has specified that a threading perl is to be built,
2857 : we may need to set or change some other defaults.
2858         if $test -f usethreads.cbu; then
2859                 echo "Your platform has some specific hints for threaded builds, using them..."
2860                 . ./usethreads.cbu
2861         else
2862                 $cat <<EOM
2863 (Your platform doesn't have any specific hints for threaded builds.
2864  Assuming POSIX threads, then.)
2865 EOM
2866         fi
2867         ;;
2868 esac
2869
2870 cat <<EOM
2871
2872 Perl can be built so that multiple Perl interpreters can coexist
2873 within the same Perl executable.
2874 EOM
2875
2876 case "$useithreads" in
2877 $define)
2878         cat <<EOM
2879 This multiple interpreter support is required for interpreter-based threads.
2880 EOM
2881         val="$define"
2882         ;;
2883 *)      case "$usemultiplicity" in
2884         $define|true|[yY]*)     dflt='y';;
2885         *) dflt='n';;
2886         esac
2887         echo " "
2888         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
2889         rp='Build Perl for multiplicity?'
2890         . ./myread
2891         case "$ans" in
2892         y|Y)    val="$define" ;;
2893         *)      val="$undef" ;;
2894         esac
2895         ;;
2896 esac
2897 set usemultiplicity
2898 eval $setvar
2899
2900 : make some quick guesses about what we are up against
2901 echo " "
2902 $echo $n "Hmm...  $c"
2903 echo exit 1 >bsd
2904 echo exit 1 >usg
2905 echo exit 1 >v7
2906 echo exit 1 >osf1
2907 echo exit 1 >eunice
2908 echo exit 1 >xenix
2909 echo exit 1 >venix
2910 echo exit 1 >os2
2911 d_bsd="$undef"
2912 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
2913 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
2914 then
2915         echo "Looks kind of like an OSF/1 system, but we'll see..."
2916         echo exit 0 >osf1
2917 elif test `echo abc | $tr a-z A-Z` = Abc ; then
2918         xxx=`./loc addbib blurfl $pth`
2919         if $test -f $xxx; then
2920         echo "Looks kind of like a USG system with BSD features, but we'll see..."
2921                 echo exit 0 >bsd
2922                 echo exit 0 >usg
2923         else
2924                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
2925                         echo "Looks kind of like an extended USG system, but we'll see..."
2926                 else
2927                         echo "Looks kind of like a USG system, but we'll see..."
2928                 fi
2929                 echo exit 0 >usg
2930         fi
2931 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
2932         echo "Looks kind of like a BSD system, but we'll see..."
2933         d_bsd="$define"
2934         echo exit 0 >bsd
2935 else
2936         echo "Looks kind of like a Version 7 system, but we'll see..."
2937         echo exit 0 >v7
2938 fi
2939 case "$eunicefix" in
2940 *unixtovms*)
2941         $cat <<'EOI'
2942 There is, however, a strange, musty smell in the air that reminds me of
2943 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
2944 EOI
2945         echo exit 0 >eunice
2946         d_eunice="$define"
2947 : it so happens the Eunice I know will not run shell scripts in Unix format
2948         ;;
2949 *)
2950         echo " "
2951         echo "Congratulations.  You aren't running Eunice."
2952         d_eunice="$undef"
2953         ;;
2954 esac
2955 : Detect OS2.  The p_ variable is set above in the Head.U unit.
2956 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
2957 : semicolon as a patch separator
2958 case "$p_" in
2959 :) ;;
2960 *)
2961         $cat <<'EOI'
2962 I have the feeling something is not exactly right, however...don't tell me...
2963 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
2964 (Or you may be running DOS with DJGPP.)
2965 EOI
2966         echo exit 0 >os2
2967         ;;
2968 esac
2969 if test -f /xenix; then
2970         echo "Actually, this looks more like a XENIX system..."
2971         echo exit 0 >xenix
2972         d_xenix="$define"
2973 else
2974         echo " "
2975         echo "It's not Xenix..."
2976         d_xenix="$undef"
2977 fi
2978 chmod +x xenix
2979 $eunicefix xenix
2980 if test -f /venix; then
2981         echo "Actually, this looks more like a VENIX system..."
2982         echo exit 0 >venix
2983 else
2984         echo " "
2985         if ./xenix; then
2986                 : null
2987         else
2988                 echo "Nor is it Venix..."
2989         fi
2990 fi
2991 chmod +x bsd usg v7 osf1 eunice xenix venix os2
2992 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
2993 $rm -f foo
2994
2995 case "$cc" in
2996 '') dflt=cc;;
2997 *) dflt="$cc";;
2998 esac
2999 rp="Use which C compiler?"
3000 . ./myread
3001 cc="$ans"
3002 : Look for a hint-file generated 'call-back-unit'.  Now that the
3003 : user has specified the compiler, we may need to set or change some
3004 : other defaults.
3005 if $test -f cc.cbu; then
3006     . ./cc.cbu
3007 fi
3008 . ./checkcc
3009
3010 echo " "
3011 echo "Checking for GNU cc in disguise and/or its version number..." >&4
3012 $cat >gccvers.c <<EOM
3013 #include <stdio.h>
3014 int main() {
3015 #ifdef __GNUC__
3016 #ifdef __VERSION__
3017         printf("%s\n", __VERSION__);
3018 #else
3019         printf("%s\n", "1");
3020 #endif
3021 #endif
3022         exit(0);
3023 }
3024 EOM
3025 if $cc -o gccvers $ldflags gccvers.c; then
3026         gccversion=`./gccvers`
3027         case "$gccversion" in
3028         '') echo "You are not using GNU cc." ;;
3029         *)  echo "You are using GNU cc $gccversion."
3030             ccname=gcc  
3031             ;;
3032         esac
3033 else
3034         echo " "
3035         echo "*** WHOA THERE!!! ***" >&4
3036         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
3037         case "$knowitall" in
3038         '')
3039         echo "    You'd better start hunting for one and let me know about it." >&4
3040                 exit 1
3041                 ;;
3042         esac
3043 fi
3044 $rm -f gccvers*
3045 case "$gccversion" in
3046 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
3047 esac
3048 case "$gccversion" in
3049 '') gccosandvers='' ;;
3050 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
3051    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
3052    gccshortvers=''
3053    case "$gccosandvers" in
3054    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
3055    $osname$osvers) ;; # looking good
3056    $osname*) cat <<EOM >&4
3057
3058 *** WHOA THERE!!! ***
3059
3060     Your gcc has not been compiled for the exact release of
3061     your operating system ($gccosandvers versus $osname$osvers).
3062
3063     In general it is a good idea to keep gcc synchronized with
3064     the operating system because otherwise serious problems
3065     may ensue when trying to compile software, like Perl.
3066
3067     I'm trying to be optimistic here, though, and will continue.
3068     If later during the configuration and build icky compilation
3069     problems appear (headerfile conflicts being the most common
3070     manifestation), I suggest reinstalling the gcc to match
3071     your operating system release.
3072
3073 EOM
3074       ;;
3075    *) gccosandvers='' ;; # failed to parse, better be silent
3076    esac
3077    ;;
3078 esac
3079 case "$ccname" in
3080 '') ccname="$cc" ;;
3081 esac
3082
3083 : see how we invoke the C preprocessor
3084 echo " "
3085 echo "Now, how can we feed standard input to your C preprocessor..." >&4
3086 cat <<'EOT' >testcpp.c
3087 #define ABC abc
3088 #define XYZ xyz
3089 ABC.XYZ
3090 EOT
3091 cd ..
3092 if test ! -f cppstdin; then
3093         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
3094                 # AIX cc -E doesn't show the absolute headerfile
3095                 # locations but we'll cheat by using the -M flag.
3096                 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
3097         else
3098                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
3099         fi
3100 else
3101         echo "Keeping your $hint cppstdin wrapper."
3102 fi
3103 chmod 755 cppstdin
3104 wrapper=`pwd`/cppstdin
3105 ok='false'
3106 cd UU
3107
3108 if $test "X$cppstdin" != "X" && \
3109         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
3110         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3111 then
3112         echo "You used to use $cppstdin $cppminus so we'll use that again."
3113         case "$cpprun" in
3114         '') echo "But let's see if we can live without a wrapper..." ;;
3115         *)
3116                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
3117                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3118                 then
3119                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
3120                         ok='true'
3121                 else
3122                         echo "(However, $cpprun $cpplast does not work, let's see...)"
3123                 fi
3124                 ;;
3125         esac
3126 else
3127         case "$cppstdin" in
3128         '') ;;
3129         *)
3130                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
3131                 ;;
3132         esac
3133 fi
3134
3135 if $ok; then
3136         : nothing
3137 elif echo 'Maybe "'"$cc"' -E" will work...'; \
3138         $cc -E <testcpp.c >testcpp.out 2>&1; \
3139         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3140         echo "Yup, it does."
3141         x_cpp="$cc -E"
3142         x_minus='';
3143 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
3144         $cc -E - <testcpp.c >testcpp.out 2>&1; \
3145         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3146         echo "Yup, it does."
3147         x_cpp="$cc -E"
3148         x_minus='-';
3149 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
3150         $cc -P <testcpp.c >testcpp.out 2>&1; \
3151         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3152         echo "Yipee, that works!"
3153         x_cpp="$cc -P"
3154         x_minus='';
3155 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
3156         $cc -P - <testcpp.c >testcpp.out 2>&1; \
3157         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3158         echo "At long last!"
3159         x_cpp="$cc -P"
3160         x_minus='-';
3161 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
3162         $cpp <testcpp.c >testcpp.out 2>&1; \
3163         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3164         echo "It works!"
3165         x_cpp="$cpp"
3166         x_minus='';
3167 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
3168         $cpp - <testcpp.c >testcpp.out 2>&1; \
3169         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3170         echo "Hooray, it works!  I was beginning to wonder."
3171         x_cpp="$cpp"
3172         x_minus='-';
3173 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
3174         $wrapper <testcpp.c >testcpp.out 2>&1; \
3175         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3176         x_cpp="$wrapper"
3177         x_minus=''
3178         echo "Eureka!"
3179 else
3180         dflt=''
3181         rp="No dice.  I can't find a C preprocessor.  Name one:"
3182         . ./myread
3183         x_cpp="$ans"
3184         x_minus=''
3185         $x_cpp <testcpp.c >testcpp.out 2>&1
3186         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3187                 echo "OK, that will do." >&4
3188         else
3189 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
3190                 exit 1
3191         fi
3192 fi
3193
3194 case "$ok" in
3195 false)
3196         cppstdin="$x_cpp"
3197         cppminus="$x_minus"
3198         cpprun="$x_cpp"
3199         cpplast="$x_minus"
3200         set X $x_cpp
3201         shift
3202         case "$1" in
3203         "$cpp")
3204                 echo "Perhaps can we force $cc -E using a wrapper..."
3205                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
3206                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3207                 then
3208                         echo "Yup, we can."
3209                         cppstdin="$wrapper"
3210                         cppminus='';
3211                 else
3212                         echo "Nope, we'll have to live without it..."
3213                 fi
3214                 ;;
3215         esac
3216         case "$cpprun" in
3217         "$wrapper")
3218                 cpprun=''
3219                 cpplast=''
3220                 ;;
3221         esac
3222         ;;
3223 esac
3224
3225 case "$cppstdin" in
3226 "$wrapper"|'cppstdin') ;;
3227 *) $rm -f $wrapper;;
3228 esac
3229 $rm -f testcpp.c testcpp.out
3230
3231 : decide how portable to be.  Allow command line overrides.
3232 case "$d_portable" in
3233 "$undef") ;;
3234 *)      d_portable="$define" ;;
3235 esac
3236
3237 : set up shell script to do ~ expansion
3238 cat >filexp <<EOSS
3239 $startsh
3240 : expand filename
3241 case "\$1" in
3242  ~/*|~)
3243         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3244         ;;
3245  ~*)
3246         if $test -f /bin/csh; then
3247                 /bin/csh -f -c "glob \$1"
3248                 failed=\$?
3249                 echo ""
3250                 exit \$failed
3251         else
3252                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3253                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3254                 if $test ! -d "\$dir"; then
3255                         me=\`basename \$0\`
3256                         echo "\$me: can't locate home directory for: \$name" >&2
3257                         exit 1
3258                 fi
3259                 case "\$1" in
3260                 */*)
3261                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3262                         ;;
3263                 *)
3264                         echo \$dir
3265                         ;;
3266                 esac
3267         fi
3268         ;;
3269 *)
3270         echo \$1
3271         ;;
3272 esac
3273 EOSS
3274 chmod +x filexp
3275 $eunicefix filexp
3276
3277 : now set up to get a file name
3278 cat <<EOS >getfile
3279 $startsh
3280 EOS
3281 cat <<'EOSC' >>getfile
3282 tilde=''
3283 fullpath=''
3284 already=''
3285 skip=''
3286 none_ok=''
3287 exp_file=''
3288 nopath_ok=''
3289 orig_rp="$rp"
3290 orig_dflt="$dflt"
3291 case "$gfpth" in
3292 '') gfpth='.' ;;
3293 esac
3294
3295 case "$fn" in
3296 *\(*)
3297         expr $fn : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3298         fn=`echo $fn | sed 's/(.*)//'`
3299         ;;
3300 esac
3301
3302 case "$fn" in
3303 *:*)
3304         loc_file=`expr $fn : '.*:\(.*\)'`
3305         fn=`expr $fn : '\(.*\):.*'`
3306         ;;
3307 esac
3308
3309 case "$fn" in
3310 *~*) tilde=true;;
3311 esac
3312 case "$fn" in
3313 */*) fullpath=true;;
3314 esac
3315 case "$fn" in
3316 *+*) skip=true;;
3317 esac
3318 case "$fn" in
3319 *n*) none_ok=true;;
3320 esac
3321 case "$fn" in
3322 *e*) exp_file=true;;
3323 esac
3324 case "$fn" in
3325 *p*) nopath_ok=true;;
3326 esac
3327
3328 case "$fn" in
3329 *f*) type='File';;
3330 *d*) type='Directory';;
3331 *l*) type='Locate';;
3332 esac
3333
3334 what="$type"
3335 case "$what" in
3336 Locate) what='File';;
3337 esac
3338
3339 case "$exp_file" in
3340 '')
3341         case "$d_portable" in
3342         "$define") ;;
3343         *) exp_file=true;;
3344         esac
3345         ;;
3346 esac
3347
3348 cd ..
3349 while test "$type"; do
3350         redo=''
3351         rp="$orig_rp"
3352         dflt="$orig_dflt"
3353         case "$tilde" in
3354         true) rp="$rp (~name ok)";;
3355         esac
3356         . UU/myread
3357         if test -f UU/getfile.ok && \
3358                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3359         then
3360                 value="$ans"
3361                 ansexp="$ans"
3362                 break
3363         fi
3364         case "$ans" in
3365         none)
3366                 value=''
3367                 ansexp=''
3368                 case "$none_ok" in
3369                 true) type='';;
3370                 esac
3371                 ;;
3372         *)
3373                 case "$tilde" in
3374                 '') value="$ans"
3375                         ansexp="$ans";;
3376                 *)
3377                         value=`UU/filexp $ans`
3378                         case $? in
3379                         0)
3380                                 if test "$ans" != "$value"; then
3381                                         echo "(That expands to $value on this system.)"
3382                                 fi
3383                                 ;;
3384                         *) value="$ans";;
3385                         esac
3386                         ansexp="$value"
3387                         case "$exp_file" in
3388                         '') value="$ans";;
3389                         esac
3390                         ;;
3391                 esac
3392                 case "$fullpath" in
3393                 true)
3394                         case "$ansexp" in
3395                         /*) value="$ansexp" ;;
3396                         [a-zA-Z]:/*) value="$ansexp" ;;
3397                         *)
3398                                 redo=true
3399                                 case "$already" in
3400                                 true)
3401                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
3402                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
3403                                         ;;
3404                                 *)
3405                                 echo "Please give a full path name, starting with slash." >&4
3406                                         case "$tilde" in
3407                                         true)
3408                                 echo "Note that using ~name is ok provided it expands well." >&4
3409                                                 already=true
3410                                                 ;;
3411                                         esac
3412                                 esac
3413                                 ;;
3414                         esac
3415                         ;;
3416                 esac
3417                 case "$redo" in
3418                 '')
3419                         case "$type" in
3420                         File)
3421                                 for fp in $gfpth; do
3422                                         if test "X$fp" = X.; then
3423                                             pf="$ansexp"
3424                                         else    
3425                                             pf="$fp/$ansexp"
3426                                         fi
3427                                         if test -f "$pf"; then
3428                                                 type=''
3429                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3430                                         then
3431                                                 echo "($value is not a plain file, but that's ok.)"
3432                                                 type=''
3433                                         fi
3434                                         if test X"$type" = X; then
3435                                             value="$pf"
3436                                             break
3437                                         fi
3438                                 done
3439                                 ;;
3440                         Directory)
3441                                 for fp in $gfpth; do
3442                                         if test "X$fp" = X.; then
3443                                             dir="$ans"
3444                                             direxp="$ansexp"
3445                                         else    
3446                                             dir="$fp/$ansexp"
3447                                             direxp="$fp/$ansexp"
3448                                         fi
3449                                         if test -d "$direxp"; then
3450                                                 type=''
3451                                                 value="$dir"
3452                                                 break
3453                                         fi
3454                                 done
3455                                 ;;
3456                         Locate)
3457                                 if test -d "$ansexp"; then
3458                                         echo "(Looking for $loc_file in directory $value.)"
3459                                         value="$value/$loc_file"
3460                                         ansexp="$ansexp/$loc_file"
3461                                 fi
3462                                 if test -f "$ansexp"; then
3463                                         type=''
3464                                 fi
3465                                 case "$nopath_ok" in
3466                                 true)   case "$value" in
3467                                         */*) ;;
3468                                         *)      echo "Assuming $value will be in people's path."
3469                                                 type=''
3470                                                 ;;
3471                                         esac
3472                                         ;;
3473                                 esac
3474                                 ;;
3475                         esac
3476
3477                         case "$skip" in
3478                         true) type='';
3479                         esac
3480
3481                         case "$type" in
3482                         '') ;;
3483                         *)
3484                                 if test "$fastread" = yes; then
3485                                         dflt=y
3486                                 else
3487                                         dflt=n
3488                                 fi
3489                                 rp="$what $value doesn't exist.  Use that name anyway?"
3490                                 . UU/myread
3491                                 dflt=''
3492                                 case "$ans" in
3493                                 y*) type='';;
3494                                 *) echo " ";;
3495                                 esac
3496                                 ;;
3497                         esac
3498                         ;;
3499                 esac
3500                 ;;
3501         esac
3502 done
3503 cd UU
3504 ans="$value"
3505 rp="$orig_rp"
3506 dflt="$orig_dflt"
3507 rm -f getfile.ok
3508 test "X$gfpthkeep" != Xy && gfpth=""
3509 EOSC
3510
3511 : What should the include directory be ?
3512 echo " "
3513 $echo $n "Hmm...  $c"
3514 dflt='/usr/include'
3515 incpath=''
3516 mips_type=''
3517 if $test -f /bin/mips && /bin/mips; then
3518         echo "Looks like a MIPS system..."
3519         $cat >usr.c <<'EOCP'
3520 #ifdef SYSTYPE_BSD43
3521 /bsd43
3522 #endif
3523 EOCP
3524         if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
3525                 dflt='/bsd43/usr/include'
3526                 incpath='/bsd43'
3527                 mips_type='BSD 4.3'
3528         else
3529                 mips_type='System V'
3530         fi
3531         $rm -f usr.c usr.out
3532         echo "and you're compiling with the $mips_type compiler and libraries."
3533         xxx_prompt=y
3534         echo "exit 0" >mips
3535 else
3536         echo "Doesn't look like a MIPS system."
3537         xxx_prompt=n
3538         echo "exit 1" >mips
3539 fi
3540 chmod +x mips
3541 $eunicefix mips
3542 case "$usrinc" in
3543 '') ;;
3544 *) dflt="$usrinc";;
3545 esac
3546 case "$xxx_prompt" in
3547 y)      fn=d/
3548         echo " "
3549         rp='Where are the include files you want to use?'
3550         . ./getfile
3551         usrinc="$ans"
3552         ;;
3553 *)      usrinc="$dflt"
3554         ;;
3555 esac
3556
3557 : Set private lib path
3558 case "$plibpth" in
3559 '') if ./mips; then
3560                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
3561         fi;;
3562 esac
3563 case "$libpth" in
3564 ' ') dlist='';;
3565 '') dlist="$loclibpth $plibpth $glibpth";;
3566 *) dlist="$libpth";;
3567 esac
3568
3569 : Now check and see which directories actually exist, avoiding duplicates
3570 libpth=''
3571 for xxx in $dlist
3572 do
3573     if $test -d $xxx; then
3574                 case " $libpth " in
3575                 *" $xxx "*) ;;
3576                 *) libpth="$libpth $xxx";;
3577                 esac
3578     fi
3579 done
3580 $cat <<'EOM'
3581
3582 Some systems have incompatible or broken versions of libraries.  Among
3583 the directories listed in the question below, please remove any you
3584 know not to be holding relevant libraries, and add any that are needed.
3585 Say "none" for none.
3586
3587 EOM
3588 case "$libpth" in
3589 '') dflt='none';;
3590 *)
3591         set X $libpth
3592         shift
3593         dflt=${1+"$@"}
3594         ;;
3595 esac
3596 rp="Directories to use for library searches?"
3597 . ./myread
3598 case "$ans" in
3599 none) libpth=' ';;
3600 *) libpth="$ans";;
3601 esac
3602
3603 : compute shared library extension
3604 case "$so" in
3605 '')
3606         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
3607                 dflt='sl'
3608         else
3609                 dflt='so'
3610         fi
3611         ;;
3612 *) dflt="$so";;
3613 esac
3614 $cat <<EOM
3615
3616 On some systems, shared libraries may be available.  Answer 'none' if
3617 you want to suppress searching of shared libraries for the remainder
3618 of this configuration.
3619
3620 EOM
3621 rp='What is the file extension used for shared libraries?'
3622 . ./myread
3623 so="$ans"
3624
3625 : Define several unixisms.
3626 : Hints files or command line option can be used to override them.
3627 : The convoluted testing is in case hints files set either the old
3628 : or the new name.
3629 case "$_exe" in
3630 '')     case "$exe_ext" in
3631     '') ;;
3632         *)      _exe="$exe_ext" ;;
3633         esac
3634         ;;
3635 esac
3636 case "$_a" in
3637 '')     case "$lib_ext" in
3638     '') _a='.a';;
3639         *)      _a="$lib_ext" ;;
3640         esac
3641         ;;
3642 esac
3643 case "$_o" in
3644 '') case "$obj_ext" in
3645         '')     _o='.o';;
3646         *)      _o="$obj_ext";;
3647         esac
3648         ;;
3649 esac
3650 case "$p_" in
3651 '') case "$path_sep" in
3652         '')     p_=':';;
3653         *)      p_="$path_sep";;
3654         esac
3655         ;;
3656 esac
3657 exe_ext=$_exe
3658 lib_ext=$_a
3659 obj_ext=$_o
3660 path_sep=$p_
3661
3662 : Which makefile gets called first.  This is used by make depend.
3663 case "$firstmakefile" in
3664 '') firstmakefile='makefile';;
3665 esac
3666
3667 case "$usesocks" in
3668 $define|true|[yY]*)     dflt='y';;
3669 *) dflt='n';;
3670 esac
3671 cat <<EOM
3672
3673 Perl can be built to use the SOCKS proxy protocol library.  To do so,
3674 Configure must be run with -Dusesocks.
3675
3676 If this doesn't make any sense to you, just accept the default '$dflt'.
3677 EOM
3678 rp='Build Perl for SOCKS?'
3679 . ./myread
3680 case "$ans" in
3681 y|Y)    val="$define" ;;     
3682 *)      val="$undef" ;;
3683 esac
3684 set usesocks
3685 eval $setvar
3686
3687 : Looking for optional libraries
3688 echo " "
3689 echo "Checking for optional libraries..." >&4
3690 case "$libs" in
3691 ' '|'') dflt='';;
3692 *) dflt="$libs";;
3693 esac
3694 case "$libswanted" in
3695 '') libswanted='c_s';;
3696 esac
3697 case "$usesocks" in
3698 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
3699 esac
3700 libsfound=''
3701 libsfiles=''
3702 libsdirs=''
3703 libspath=''
3704 for thisdir in $libpth $xlibpth; do
3705   test -d $thisdir && libspath="$libspath $thisdir"
3706 done
3707 for thislib in $libswanted; do
3708         for thisdir in $libspath; do
3709             xxx=''
3710             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
3711                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|tail -1`
3712                 $test -f "$xxx" && eval $libscheck
3713                 $test -f "$xxx" && libstyle=shared
3714             fi
3715             if test ! -f "$xxx"; then
3716                 xxx=$thisdir/lib$thislib.$so
3717                 $test -f "$xxx" && eval $libscheck
3718                 $test -f "$xxx" && libstyle=shared
3719             fi  
3720             if test ! -f "$xxx"; then
3721                 xxx=$thisdir/lib$thislib$_a
3722                 $test -f "$xxx" && eval $libscheck
3723                 $test -f "$xxx" && libstyle=static
3724             fi
3725             if test ! -f "$xxx"; then
3726                 xxx=$thisdir/$thislib$_a
3727                 $test -f "$xxx" && eval $libscheck
3728                 $test -f "$xxx" && libstyle=static
3729             fi
3730             if test ! -f "$xxx"; then
3731                 xxx=$thisdir/lib${thislib}_s$_a
3732                 $test -f "$xxx" && eval $libscheck
3733                 $test -f "$xxx" && libstyle=static
3734                 $test -f "$xxx" && thislib=${thislib}_s
3735             fi
3736             if test ! -f "$xxx"; then
3737                 xxx=$thisdir/Slib$thislib$_a
3738                 $test -f "$xxx" && eval $libscheck
3739                 $test -f "$xxx" && libstyle=static
3740             fi
3741             if $test -f "$xxx"; then
3742                 case "$libstyle" in
3743                 shared) echo "Found -l$thislib (shared)." ;;
3744                 static) echo "Found -l$thislib." ;;
3745                 *)      echo "Found -l$thislib ($libstyle)." ;;
3746                 esac
3747                 case " $dflt " in
3748                 *"-l$thislib "*);;
3749                 *) dflt="$dflt -l$thislib"
3750                    libsfound="$libsfound $xxx"
3751                    yyy=`basename $xxx`
3752                    libsfiles="$libsfiles $yyy"
3753                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
3754                    case " $libsdirs " in
3755                    *" $yyy "*) ;;
3756                    *) libsdirs="$libsdirs $yyy" ;;
3757                    esac
3758                    ;;
3759                 esac
3760                 break
3761             fi  
3762         done
3763         if $test ! -f "$xxx"; then
3764             echo "No -l$thislib."
3765         fi
3766 done
3767 set X $dflt
3768 shift
3769 dflt="$*"
3770 case "$libs" in
3771 '') dflt="$dflt";;
3772 *) dflt="$libs";;
3773 esac
3774 case "$dflt" in
3775 ' '|'') dflt='none';;
3776 esac
3777
3778 $cat <<EOM
3779
3780 In order to compile $package on your machine, a number of libraries
3781 are usually needed.  Include any other special libraries here as well.
3782 Say "none" for none.  The default list is almost always right.
3783 EOM
3784
3785 echo " "
3786 rp="What libraries to use?"
3787 . ./myread
3788 case "$ans" in
3789 none) libs=' ';;
3790 *) libs="$ans";;
3791 esac
3792
3793 : determine optimization, if desired, or use for debug flag also
3794 case "$optimize" in
3795 ' '|$undef) dflt='none';;
3796 '') dflt='-O';;
3797 *) dflt="$optimize";;
3798 esac
3799 $cat <<EOH
3800
3801 By default, $package compiles with the -O flag to use the optimizer.
3802 Alternately, you might want to use the symbolic debugger, which uses
3803 the -g flag (on traditional Unix systems).  Either flag can be
3804 specified here.  To use neither flag, specify the word "none".
3805
3806 EOH
3807 rp="What optimizer/debugger flag should be used?"
3808 . ./myread
3809 optimize="$ans"
3810 case "$optimize" in
3811 'none') optimize=" ";;
3812 esac
3813
3814 dflt=''
3815 : We will not override a previous value, but we might want to
3816 : augment a hint file
3817 case "$hint" in
3818 default|recommended)
3819         case "$gccversion" in
3820         1*) dflt='-fpcc-struct-return' ;;
3821         esac
3822         case "$optimize" in
3823         *-g*) dflt="$dflt -DDEBUGGING";;
3824         esac
3825         case "$gccversion" in
3826         2*) if test -d /etc/conf/kconfig.d &&
3827                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
3828                 then
3829                         dflt="$dflt -posix"
3830                 fi
3831                 ;;
3832         esac
3833         case "$gccversion" in
3834         1*) ;;
3835         2.[0-8]*) ;;
3836         ?*)     echo " "
3837                 echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
3838                 echo 'int main(void) { return 0; }' > gcctest.c
3839                 if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
3840                         echo "Yes, it does." 2>&1
3841                         case "$ccflags" in
3842                         *strict-aliasing*) 
3843                                 echo "Leaving current flags $ccflags alone." 2>&1
3844                                 ;;
3845                         *) dflt="$dflt -fno-strict-aliasing" ;;
3846                         esac
3847                 else
3848                         echo "Nope, it doesn't, but that's ok." 2>&1
3849                 fi
3850                 ;;
3851         esac
3852         ;;
3853 esac
3854
3855 case "$mips_type" in
3856 *BSD*|'') inclwanted="$locincpth $usrinc";;
3857 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
3858 esac
3859 for thisincl in $inclwanted; do
3860         if $test -d $thisincl; then
3861                 if $test x$thisincl != x$usrinc; then
3862                         case "$dflt" in
3863                         *" -I$thisincl "*);;
3864                         *) dflt="$dflt -I$thisincl ";;
3865                         esac
3866                 fi
3867         fi
3868 done
3869
3870 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
3871         xxx=true;
3872 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
3873         xxx=true;
3874 else
3875         xxx=false;
3876 fi;
3877 if $xxx; then
3878         case "$dflt" in
3879         *$2*);;
3880         *) dflt="$dflt -D$2";;
3881         esac;
3882 fi'
3883
3884 set signal.h LANGUAGE_C; eval $inctest
3885
3886 case "$usesocks" in
3887 $define)
3888         ccflags="$ccflags -DSOCKS"
3889         ;;
3890 esac
3891
3892 case "$hint" in
3893 default|recommended) dflt="$ccflags $dflt" ;;
3894 *) dflt="$ccflags";;
3895 esac
3896
3897 case "$dflt" in
3898 ''|' ') dflt=none;;
3899 esac
3900
3901 $cat <<EOH
3902
3903 Your C compiler may want other flags.  For this question you should include
3904 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
3905 but you should NOT include libraries or ld flags like -lwhatever.  If you
3906 want $package to honor its debug switch, you should include -DDEBUGGING here.
3907 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
3908
3909 To use no flags, specify the word "none".
3910
3911 EOH
3912 set X $dflt
3913 shift
3914 dflt=${1+"$@"}
3915 rp="Any additional cc flags?"
3916 . ./myread
3917 case "$ans" in
3918 none) ccflags='';;
3919 *) ccflags="$ans";;
3920 esac
3921
3922 : the following weeds options from ccflags that are of no interest to cpp
3923 cppflags="$ccflags"
3924 case "$gccversion" in
3925 1*) cppflags="$cppflags -D__GNUC__"
3926 esac
3927 case "$mips_type" in
3928 '');;
3929 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
3930 esac
3931 case "$cppflags" in
3932 '');;
3933 *)
3934         echo " "
3935         echo "Let me guess what the preprocessor flags are..." >&4
3936         set X $cppflags
3937         shift
3938         cppflags=''
3939         $cat >cpp.c <<'EOM'
3940 #define BLURFL foo
3941
3942 BLURFL xx LFRULB
3943 EOM
3944         previous=''
3945         for flag in $*
3946         do
3947                 case "$flag" in
3948                 -*) ftry="$flag";;
3949                 *) ftry="$previous $flag";;
3950                 esac
3951                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
3952                         >cpp1.out 2>/dev/null && \
3953                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
3954                         >cpp2.out 2>/dev/null && \
3955                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
3956                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
3957                 then
3958                         cppflags="$cppflags $ftry"
3959                         previous=''
3960                 else
3961                         previous="$flag"
3962                 fi
3963         done
3964         set X $cppflags
3965         shift
3966         cppflags=${1+"$@"}
3967         case "$cppflags" in
3968         *-*)  echo "They appear to be: $cppflags";;
3969         esac
3970         $rm -f cpp.c cpp?.out
3971         ;;
3972 esac
3973
3974 : flags used in final linking phase
3975 case "$ldflags" in
3976 '') if ./venix; then
3977                 dflt='-i -z'
3978         else
3979                 dflt=''
3980         fi
3981         case "$ccflags" in
3982         *-posix*) dflt="$dflt -posix" ;;
3983         esac
3984         ;;
3985 *) dflt="$ldflags";;
3986 esac
3987
3988 : Try to guess additional flags to pick up local libraries.
3989 for thislibdir in $libpth; do
3990         case " $loclibpth " in
3991         *" $thislibdir "*)
3992                 case "$dflt " in 
3993                 *"-L$thislibdir "*) ;;
3994                 *)  dflt="$dflt -L$thislibdir" ;;
3995                 esac
3996                 ;;
3997         esac
3998 done
3999
4000 case "$dflt" in
4001 '') dflt='none' ;;
4002 esac
4003
4004 $cat <<EOH
4005
4006 Your C linker may need flags.  For this question you should
4007 include -L/whatever and any other flags used by the C linker, but you
4008 should NOT include libraries like -lwhatever.
4009
4010 Make sure you include the appropriate -L/path flags if your C linker
4011 does not normally search all of the directories you specified above,
4012 namely
4013         $libpth
4014 To use no flags, specify the word "none".
4015
4016 EOH
4017
4018 rp="Any additional ld flags (NOT including libraries)?"
4019 . ./myread
4020 case "$ans" in
4021 none) ldflags='';;
4022 *) ldflags="$ans";;
4023 esac
4024 rmlist="$rmlist pdp11"
4025
4026 : coherency check
4027 echo " "
4028 echo "Checking your choice of C compiler and flags for coherency..." >&4
4029 $cat > try.c <<'EOF'
4030 #include <stdio.h>
4031 int main() { printf("Ok\n"); exit(0); }
4032 EOF
4033 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
4034 shift
4035 $cat >try.msg <<'EOM'
4036 I've tried to compile and run the following simple program:
4037
4038 EOM
4039 $cat try.c >> try.msg
4040
4041 $cat >> try.msg <<EOM
4042
4043 I used the command:
4044
4045         $*
4046         ./try
4047
4048 and I got the following output:
4049
4050 EOM
4051 dflt=y
4052 if sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
4053         if sh -c './try' >>try.msg 2>&1; then
4054                 xxx=`./try`
4055                 case "$xxx" in
4056                 "Ok") dflt=n ;;
4057                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
4058                         case " $libs " in
4059                         *" -lsfio "*)
4060                                 cat >> try.msg <<'EOQS'
4061 If $libs contains -lsfio, and sfio is mis-configured, then it
4062 sometimes (apparently) runs and exits with a 0 status, but with no
4063 output!  It may have to do with sfio's use of _exit vs. exit.
4064
4065 EOQS
4066                                 rp="You have a big problem.  Shall I abort Configure"
4067                                 dflt=y
4068                                 ;;
4069                         esac
4070                         ;;
4071                 esac
4072         else
4073                 echo "The program compiled OK, but exited with status $?." >>try.msg
4074                 rp="You have a problem.  Shall I abort Configure"
4075                 dflt=y
4076         fi
4077 else
4078         echo "I can't compile the test program." >>try.msg
4079         rp="You have a BIG problem.  Shall I abort Configure"
4080         dflt=y
4081 fi
4082 case "$dflt" in
4083 y)
4084         $cat try.msg >&4
4085         case "$knowitall" in
4086         '')
4087                 echo "(The supplied flags or libraries might be incorrect.)"
4088                 ;;
4089         *) dflt=n;;
4090         esac
4091         echo " "
4092         . ./myread
4093         case "$ans" in
4094         n*|N*) ;;
4095         *)      echo "Ok.  Stopping Configure." >&4
4096                 exit 1
4097                 ;;
4098         esac
4099         ;;
4100 n) echo "OK, that should do.";;
4101 esac
4102 $rm -f try try.* core
4103
4104 : define an is-a-typedef? function
4105 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
4106 case "$inclist" in
4107 "") inclist="sys/types.h";;
4108 esac;
4109 eval "varval=\$$var";
4110 case "$varval" in
4111 "")
4112         $rm -f temp.c;
4113         for inc in $inclist; do
4114                 echo "#include <$inc>" >>temp.c;
4115         done;
4116         echo "#ifdef $type" >> temp.c;
4117         echo "printf(\"We have $type\");" >> temp.c;
4118         echo "#endif" >> temp.c;
4119         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
4120         if $contains $type temp.E >/dev/null 2>&1; then
4121                 eval "$var=\$type";
4122         else
4123                 eval "$var=\$def";
4124         fi;
4125         $rm -f temp.?;;
4126 *) eval "$var=\$varval";;
4127 esac'
4128
4129 : define an is-a-typedef? function that prompts if the type is not available.
4130 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
4131 case "$inclist" in
4132 "") inclist="sys/types.h";;
4133 esac;
4134 eval "varval=\$$var";
4135 case "$varval" in
4136 "")
4137         $rm -f temp.c;
4138         for inc in $inclist; do
4139                 echo "#include <$inc>" >>temp.c;
4140         done;
4141         echo "#ifdef $type" >> temp.c;
4142         echo "printf(\"We have $type\");" >> temp.c;
4143         echo "#endif" >> temp.c;
4144         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
4145         echo " " ;
4146         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
4147         if $contains $type temp.E >/dev/null 2>&1; then
4148                 echo "$type found." >&4;
4149                 eval "$var=\$type";
4150         else
4151                 echo "$type NOT found." >&4;
4152                 dflt="$def";
4153                 . ./myread ;
4154                 eval "$var=\$ans";
4155         fi;
4156         $rm -f temp.?;;
4157 *) eval "$var=\$varval";;
4158 esac'
4159
4160 : define a shorthand compile call
4161 compile='
4162 mc_file=$1;
4163 shift;
4164 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
4165 : define a shorthand compile call for compilations that should be ok.
4166 compile_ok='
4167 mc_file=$1;
4168 shift;
4169 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
4170
4171 : check for lengths of integral types
4172 echo " "
4173 case "$intsize" in
4174 '')
4175         echo "Checking to see how big your integers are..." >&4
4176         $cat >intsize.c <<'EOCP'
4177 #include <stdio.h>
4178 int main()
4179 {
4180         printf("intsize=%d;\n", (int)sizeof(int));
4181         printf("longsize=%d;\n", (int)sizeof(long));
4182         printf("shortsize=%d;\n", (int)sizeof(short));
4183         exit(0);
4184 }
4185 EOCP
4186         set intsize
4187         if eval $compile_ok && ./intsize > /dev/null; then
4188                 eval `./intsize`
4189                 echo "Your integers are $intsize bytes long."
4190                 echo "Your long integers are $longsize bytes long."
4191                 echo "Your short integers are $shortsize bytes long."
4192         else
4193                 $cat >&4 <<EOM
4194 !
4195 Help! I can't compile and run the intsize test program: please enlighten me!
4196 (This is probably a misconfiguration in your system or libraries, and
4197 you really ought to fix it.  Still, I'll try anyway.)
4198 !
4199 EOM
4200                 dflt=4
4201                 rp="What is the size of an integer (in bytes)?"
4202                 . ./myread
4203                 intsize="$ans"
4204                 dflt=$intsize
4205                 rp="What is the size of a long integer (in bytes)?"
4206                 . ./myread
4207                 longsize="$ans"
4208                 dflt=2
4209                 rp="What is the size of a short integer (in bytes)?"
4210                 . ./myread
4211                 shortsize="$ans"
4212         fi
4213         ;;
4214 esac
4215 $rm -f intsize intsize.*
4216
4217 : see what type lseek is declared as in the kernel
4218 rp="What is the type used for lseek's offset on this system?"
4219 set off_t lseektype long stdio.h sys/types.h
4220 eval $typedef_ask
4221
4222 echo " "
4223 echo "Checking to see how big your file offsets are..." >&4
4224 $cat >try.c <<EOCP
4225 #include <sys/types.h>
4226 #include <stdio.h>
4227 int main()
4228 {
4229     printf("%d\n", (int)sizeof($lseektype));
4230     return(0); 
4231 }
4232 EOCP
4233 set try
4234 if eval $compile_ok; then
4235         lseeksize=`./try`
4236         echo "Your file offsets are $lseeksize bytes long."
4237 else
4238         dflt=$longsize
4239         echo " "
4240         echo "(I can't seem to compile the test program.  Guessing...)"
4241         rp="What is the size of your file offsets (in bytes)?"
4242         . ./myread
4243         lseeksize="$ans"
4244 fi
4245 $rm -f try.c try
4246
4247 : see what type file positions are declared as in the library
4248 rp="What is the type for file position used by fsetpos()?"
4249 set fpos_t fpostype long stdio.h sys/types.h
4250 eval $typedef_ask
4251
4252 echo " "
4253 case "$fpostype" in
4254 *_t) zzz="$fpostype"    ;;
4255 *)   zzz="fpos_t"       ;;
4256 esac
4257 echo "Checking the size of $zzz..." >&4 
4258 cat > try.c <<EOCP
4259 #include <sys/types.h>
4260 #include <stdio.h>
4261 int main() {
4262     printf("%d\n", (int)sizeof($fpostype));
4263     exit(0);
4264 }
4265 EOCP
4266 set try
4267 if eval $compile_ok; then
4268         yyy=`./try`
4269         case "$yyy" in
4270         '')     fpossize=4
4271                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
4272                 ;;
4273         *)      fpossize=$yyy
4274                 echo "Your $zzz is $fpossize bytes long."
4275                 ;;
4276         esac
4277 else
4278         dflt="$longsize"
4279         echo " " >&4
4280         echo "(I can't compile the test program.  Guessing...)" >&4
4281         rp="What is the size of your file positions (in bytes)?"
4282         . ./myread
4283         fpossize="$ans"
4284 fi
4285
4286
4287
4288 # Backward compatibility (uselfs is deprecated).
4289 case "$uselfs" in
4290 "$define"|true|[yY]*)
4291         cat <<EOM >&4
4292
4293 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
4294 EOM
4295         uselargefiles="$define"
4296         ;;
4297 esac                          
4298
4299 case "$lseeksize:$fpossize" in
4300 8:8) cat <<EOM
4301
4302 You can have files larger than 2 gigabytes.
4303 EOM
4304    val="$define" ;;
4305 *)    case "$uselargefiles" in
4306    "$undef"|false|[nN]*) dflt='n' ;;
4307    *)   dflt='y' ;;
4308    esac
4309    cat <<EOM
4310
4311 Perl can be built to understand large files (files larger than 2 gigabytes)
4312 on some systems.  To do so, Configure can be run with -Duselargefiles.
4313
4314 If this doesn't make any sense to you, just accept the default '$dflt'.
4315 EOM
4316    rp='Try to understand large files, if available?'
4317    . ./myread
4318    case "$ans" in
4319    y|Y)         val="$define" ;;
4320    *)           val="$undef"  ;;
4321    esac
4322    ;;
4323 esac
4324 set uselargefiles
4325 eval $setvar
4326 case "$uselargefiles" in
4327 "$define")
4328 : Look for a hint-file generated 'call-back-unit'.  If the
4329 : user has specified that a large files perl is to be built,
4330 : we may need to set or change some other defaults.
4331         if $test -f uselargefiles.cbu; then
4332                 echo "Your platform has some specific hints for large file builds, using them..."
4333                 . ./uselargefiles.cbu
4334                 echo " "
4335                 echo "Rechecking to see how big your file offsets are..." >&4
4336                 $cat >try.c <<EOCP
4337 #include <sys/types.h>
4338 #include <stdio.h>
4339 int main()
4340 {
4341     printf("%d\n", (int)sizeof($lseektype));
4342     return(0); 
4343 }
4344 EOCP
4345                 set try
4346                 if eval $compile_ok; then
4347                         lseeksize=`./try`
4348                         $echo "Your file offsets are now $lseeksize bytes long."
4349                 else
4350                         dflt="$lseeksize"
4351                         echo " "
4352                         echo "(I can't seem to compile the test program.  Guessing...)"
4353                         rp="What is the size of your file offsets (in bytes)?"
4354                         . ./myread
4355                         lseeksize="$ans"
4356                 fi
4357                 case "$fpostype" in
4358                 *_t) zzz="$fpostype"    ;;
4359                 *)   zzz="fpos_t"       ;;
4360                 esac
4361                 $echo $n "Rechecking the size of $zzz...$c" >&4 
4362                 $cat > try.c <<EOCP
4363 #include <sys/types.h>
4364 #include <stdio.h>
4365 int main() {
4366     printf("%d\n", (int)sizeof($fpostype));
4367     exit(0);
4368 }
4369 EOCP
4370                 set try
4371                 if eval $compile_ok; then
4372                         yyy=`./try`
4373                         dflt="$lseeksize"
4374                         case "$yyy" in
4375                         '')     echo " "
4376                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
4377                                 ;;
4378                         *)      fpossize=$yyy
4379                                 echo " $fpossize bytes." >&4
4380                                 ;;
4381                         esac
4382                 else
4383                         dflt="$fpossize"
4384                         echo " "
4385                         echo "(I can't compile the test program.  Guessing...)" >&4
4386                         rp="What is the size of your file positions (in bytes)?"
4387                         . ./myread
4388                         fpossize="$ans"
4389                 fi
4390                 $rm -f try.c try
4391         fi
4392         ;;
4393 esac
4394
4395
4396 case "$usemorebits" in
4397 "$define"|true|[yY]*)
4398         use64bitint="$define"
4399         uselongdouble="$define"
4400         usemorebits="$define"
4401         ;;
4402 *)      usemorebits="$undef"
4403         ;;
4404 esac
4405
4406
4407 case "$uselonglong" in
4408 "$define"|true|[yY]*)
4409         cat <<EOM >&4
4410
4411 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
4412 EOM
4413         use64bitint="$define"
4414         ;;
4415 esac                          
4416 case "$use64bits" in
4417 "$define"|true|[yY]*)
4418         cat <<EOM >&4
4419
4420 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
4421 EOM
4422         use64bitint="$define"
4423         ;;
4424 esac                          
4425 case "$use64bitints" in
4426 "$define"|true|[yY]*)
4427         cat <<EOM >&4
4428
4429 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
4430 EOM
4431         use64bitint="$define"
4432         ;;
4433 esac                          
4434 case "$use64bitsint" in
4435 "$define"|true|[yY]*)
4436         cat <<EOM >&4
4437
4438 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
4439 EOM
4440         use64bitint="$define"
4441         ;;
4442 esac                          
4443 case "$uselonglongs" in
4444 "$define"|true|[yY]*)
4445         cat <<EOM >&4
4446
4447 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
4448 EOM
4449         use64bitint="$define"
4450         ;;
4451 esac                          
4452 case "$use64bitsall" in
4453 "$define"|true|[yY]*)
4454         cat <<EOM >&4
4455
4456 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
4457 EOM
4458         use64bitall="$define"
4459         ;;
4460 esac                          
4461
4462 case "$ccflags" in
4463 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
4464 esac
4465 case "$use64bitall" in
4466 "$define"|true|[yY]*) use64bitint="$define" ;;
4467 esac
4468
4469 case "$longsize" in
4470 8) cat <<EOM
4471
4472 You have natively 64-bit long integers.
4473 EOM
4474    val="$define"
4475    ;;
4476 *) case "$use64bitint" in
4477    "$define"|true|[yY]*) dflt='y';;
4478    *) dflt='n';;
4479    esac
4480    cat <<EOM
4481
4482 Perl can be built to take advantage of 64-bit integer types
4483 on some systems.  To do so, Configure can be run with -Duse64bitint.
4484 Choosing this option will most probably introduce binary incompatibilities.
4485
4486 If this doesn't make any sense to you, just accept the default '$dflt'.
4487 EOM
4488    rp='Try to use 64-bit integers, if available?'
4489    . ./myread
4490    case "$ans" in
4491    [yY]*) val="$define" ;;
4492    *)     val="$undef"  ;;
4493    esac
4494    ;;
4495 esac
4496 set use64bitint
4497 eval $setvar
4498
4499 case "$use64bitall" in
4500 "$define"|true|[yY]*) dflt='y' ;;
4501 *) case "$longsize" in
4502    8) dflt='y' ;;
4503    *) dflt='n' ;;
4504    esac
4505    ;;
4506 esac    
4507 cat <<EOM
4508
4509 You may also choose to try maximal 64-bitness.  It means using as much
4510 64-bitness as possible on the platform.  This in turn means even more
4511 binary incompatibilities.  On the other hand, your platform may not
4512 have any more 64-bitness available than what you already have chosen.
4513
4514 If this doesn't make any sense to you, just accept the default '$dflt'.
4515 EOM
4516 rp='Try to use maximal 64-bit support, if available?'
4517 . ./myread
4518 case "$ans" in
4519 [yY]*) val="$define" ;;
4520 *)     val="$undef"  ;;
4521 esac
4522 set use64bitall
4523 eval $setvar
4524 case "$use64bitall" in
4525 "$define")
4526         case "$use64bitint" in
4527         "$undef")
4528                 cat <<EOM
4529
4530 Since you have chosen a maximally 64-bit build, I'm also turning on
4531 the use of 64-bit integers.
4532 EOM
4533                 use64bitint="$define" ;;
4534         esac
4535         ;;
4536 esac
4537
4538 case "$use64bitint" in
4539 "$define"|true|[yY]*)
4540 : Look for a hint-file generated 'call-back-unit'.  If the
4541 : user has specified that a 64-bit perl is to be built,
4542 : we may need to set or change some other defaults.
4543         if $test -f use64bitint.cbu; then
4544                 echo "Your platform has some specific hints for 64-bit integers, using them..."
4545                 . ./use64bitint.cbu
4546         fi
4547         case "$longsize" in
4548         4) case "$archname64" in
4549            '') archname64=64int ;;
4550            esac
4551            ;;
4552         esac
4553         ;;
4554 esac
4555
4556 case "$use64bitall" in
4557 "$define"|true|[yY]*)
4558 : Look for a hint-file generated 'call-back-unit'.  If the
4559 : user has specified that a maximally 64-bit perl is to be built,
4560 : we may need to set or change some other defaults.
4561         if $test -f use64bitall.cbu; then
4562                 echo "Your platform has some specific hints for 64-bit builds, using them..."
4563                 . ./use64bitall.cbu
4564         fi
4565         case "$longsize" in
4566         4) case "$archname64" in
4567            ''|64int) archname64=64all ;;
4568            esac
4569            ;;
4570         esac
4571         ;;
4572 esac
4573
4574 echo " "
4575 echo "Checking for GNU C Library..." >&4
4576 cat >gnulibc.c <<EOM
4577 #include <stdio.h>
4578 int main()
4579 {
4580 #ifdef __GLIBC__
4581     exit(0);
4582 #else
4583     exit(1);
4584 #endif
4585 }
4586 EOM
4587 set gnulibc
4588 if eval $compile_ok && ./gnulibc; then
4589         val="$define"
4590         echo "You are using the GNU C Library"
4591 else
4592         val="$undef"
4593         echo "You are not using the GNU C Library"
4594 fi
4595 $rm -f gnulibc*
4596 set d_gnulibc
4597 eval $setvar
4598
4599 : see if nm is to be used to determine whether a symbol is defined or not
4600 case "$usenm" in
4601 '')
4602         dflt=''
4603         case "$d_gnulibc" in
4604         "$define")
4605                 echo " "
4606                 echo "nm probably won't work on the GNU C Library." >&4
4607                 dflt=n
4608                 ;;
4609         esac
4610         case "$dflt" in
4611         '') 
4612                 if $test "$osname" = aix -a ! -f /lib/syscalls.exp; then
4613                         echo " "
4614                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
4615                         echo "'nm' won't be sufficient on this sytem." >&4
4616                         dflt=n
4617                 fi
4618                 ;;
4619         esac
4620         case "$dflt" in
4621         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
4622                 if $test $dflt -gt 20; then
4623                         dflt=y
4624                 else
4625                         dflt=n
4626                 fi
4627                 ;;
4628         esac
4629         ;;
4630 *)
4631         case "$usenm" in
4632         true|$define) dflt=y;;
4633         *) dflt=n;;
4634         esac
4635         ;;
4636 esac
4637 $cat <<EOM
4638
4639 I can use $nm to extract the symbols from your C libraries. This
4640 is a time consuming task which may generate huge output on the disk (up
4641 to 3 megabytes) but that should make the symbols extraction faster. The
4642 alternative is to skip the 'nm' extraction part and to compile a small
4643 test program instead to determine whether each symbol is present. If
4644 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
4645 this may be the best solution.
4646
4647 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
4648
4649 EOM
4650 rp="Shall I use $nm to extract C symbols from the libraries?"
4651 . ./myread
4652 case "$ans" in
4653 [Nn]*) usenm=false;;
4654 *) usenm=true;;
4655 esac
4656
4657 runnm=$usenm
4658 case "$reuseval" in
4659 true) runnm=false;;
4660 esac
4661
4662 : nm options which may be necessary
4663 case "$nm_opt" in
4664 '') if $test -f /mach_boot; then
4665                 nm_opt=''       # Mach
4666         elif $test -d /usr/ccs/lib; then
4667                 nm_opt='-p'     # Solaris (and SunOS?)
4668         elif $test -f /dgux; then
4669                 nm_opt='-p'     # DG-UX
4670         elif $test -f /lib64/rld; then
4671                 nm_opt='-p'     # 64-bit Irix
4672         else
4673                 nm_opt=''
4674         fi;;
4675 esac
4676
4677 : nm options which may be necessary for shared libraries but illegal
4678 : for archive libraries.  Thank you, Linux.
4679 case "$nm_so_opt" in
4680 '')     case "$myuname" in
4681         *linux*)
4682                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
4683                         nm_so_opt='--dynamic'
4684                 fi
4685                 ;;
4686         esac
4687         ;;
4688 esac
4689
4690 case "$runnm" in
4691 true)
4692 : get list of predefined functions in a handy place
4693 echo " "
4694 case "$libc" in
4695 '') libc=unknown
4696         case "$libs" in
4697         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
4698         esac
4699         ;;
4700 esac
4701 libnames='';
4702 case "$libs" in
4703 '') ;;
4704 *)  for thislib in $libs; do
4705         case "$thislib" in
4706         -lc|-lc_s)
4707                 : Handle C library specially below.
4708                 ;;
4709         -l*)
4710                 thislib=`echo $thislib | $sed -e 's/^-l//'`
4711                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
4712                         :
4713                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
4714                         :
4715                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
4716                         :
4717                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
4718                         :
4719                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
4720                         :
4721                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
4722                         :
4723                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
4724                         :
4725                 else
4726                         try=''
4727                 fi
4728                 libnames="$libnames $try"
4729                 ;;
4730         *) libnames="$libnames $thislib" ;;
4731         esac
4732         done
4733         ;;
4734 esac
4735 xxx=normal
4736 case "$libc" in
4737 unknown)
4738         set /lib/libc.$so
4739         for xxx in $libpth; do
4740                 $test -r $1 || set $xxx/libc.$so
4741                 : The messy sed command sorts on library version numbers.
4742                 $test -r $1 || \
4743                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
4744                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
4745                                 h
4746                                 s/[0-9][0-9]*/0000&/g
4747                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
4748                                 G
4749                                 s/\n/ /' | \
4750                          $sort | $sed -e 's/^.* //'`
4751                 eval set \$$#
4752         done
4753         $test -r $1 || set /usr/ccs/lib/libc.$so
4754         $test -r $1 || set /lib/libsys_s$_a
4755         ;;
4756 *)
4757         set blurfl
4758         ;;
4759 esac
4760 if $test -r "$1"; then
4761         echo "Your (shared) C library seems to be in $1."
4762         libc="$1"
4763 elif $test -r /lib/libc && $test -r /lib/clib; then
4764         echo "Your C library seems to be in both /lib/clib and /lib/libc."
4765         xxx=apollo
4766         libc='/lib/clib /lib/libc'
4767         if $test -r /lib/syslib; then
4768                 echo "(Your math library is in /lib/syslib.)"
4769                 libc="$libc /lib/syslib"
4770         fi
4771 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
4772         echo "Your C library seems to be in $libc, as you said before."
4773 elif $test -r $incpath/usr/lib/libc$_a; then
4774         libc=$incpath/usr/lib/libc$_a;
4775         echo "Your C library seems to be in $libc.  That's fine."
4776 elif $test -r /lib/libc$_a; then
4777         libc=/lib/libc$_a;
4778         echo "Your C library seems to be in $libc.  You're normal."
4779 else
4780         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
4781                 :
4782         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
4783                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
4784         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
4785                 :
4786         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
4787                 :
4788         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
4789                 :
4790         else
4791                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
4792         fi
4793         if $test -r "$tans"; then
4794                 echo "Your C library seems to be in $tans, of all places."
4795                 libc=$tans
4796         else
4797                 libc='blurfl'
4798         fi
4799 fi
4800 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
4801         dflt="$libc"
4802         cat <<EOM
4803
4804 If the guess above is wrong (which it might be if you're using a strange
4805 compiler, or your machine supports multiple models), you can override it here.
4806
4807 EOM
4808 else
4809         dflt=''
4810         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
4811         cat >&4 <<EOM
4812 I can't seem to find your C library.  I've looked in the following places:
4813
4814 EOM
4815         $sed 's/^/      /' libpath
4816         cat <<EOM
4817
4818 None of these seems to contain your C library. I need to get its name...
4819
4820 EOM
4821 fi
4822 fn=f
4823 rp='Where is your C library?'
4824 . ./getfile
4825 libc="$ans"
4826
4827 echo " "
4828 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
4829 set X `cat libnames`
4830 shift
4831 xxx=files
4832 case $# in 1) xxx=file; esac
4833 echo "Extracting names from the following $xxx for later perusal:" >&4
4834 echo " "
4835 $sed 's/^/      /' libnames >&4
4836 echo " "
4837 $echo $n "This may take a while...$c" >&4
4838
4839 for file in $*; do
4840         case $file in
4841         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
4842         *) $nm $nm_opt $file 2>/dev/null;;
4843         esac
4844 done >libc.tmp
4845
4846 $echo $n ".$c"
4847 $grep fprintf libc.tmp > libc.ptf
4848 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
4849 xrun='eval "<libc.tmp $com >libc.list"; echo "done" >&4'
4850 xxx='[ADTSIW]'
4851 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *_[_.]*//p' -e 's/^.* $xxx  *//p'";\
4852         eval $xscan;\
4853         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4854                 eval $xrun
4855 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
4856         eval $xscan;\
4857         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4858                 eval $xrun
4859 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
4860         eval $xscan;\
4861         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4862                 eval $xrun
4863 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
4864         eval $xscan;\
4865         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4866                 eval $xrun
4867 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
4868         eval $xscan;\
4869         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4870                 eval $xrun
4871 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
4872         eval $xscan;\
4873         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4874                 eval $xrun
4875 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
4876                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
4877         eval $xscan;\
4878         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4879                 eval $xrun
4880 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
4881         eval $xscan;\
4882         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4883                 eval $xrun
4884 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
4885         eval $xscan;\
4886         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4887                 eval $xrun
4888 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
4889         eval $xscan;\
4890         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4891                 eval $xrun
4892 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
4893         eval $xscan;\
4894         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4895                 eval $xrun
4896 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
4897         eval $xscan;\
4898         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4899                 eval $xrun
4900 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
4901         eval $xscan;\
4902         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4903                 eval $xrun
4904 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
4905         eval $xscan;\
4906         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4907                 eval $xrun
4908 else
4909         $nm -p $* 2>/dev/null >libc.tmp
4910         $grep fprintf libc.tmp > libc.ptf
4911         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
4912                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
4913         then
4914                 nm_opt='-p'
4915                 eval $xrun
4916         else
4917                 echo " "
4918                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
4919                 com=''
4920                 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
4921                         for thisname in $libnames $libc; do
4922                                 $ar t $thisname >>libc.tmp
4923                         done
4924                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
4925                         echo "Ok." >&4
4926                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
4927                         # Repeat libc to extract forwarders to DLL entries too
4928                         for thisname in $libnames $libc; do
4929                                 $ar tv $thisname >>libc.tmp
4930                                 # Revision 50 of EMX has bug in $ar.
4931                                 # it will not extract forwarders to DLL entries
4932                                 # Use emximp which will extract exactly them.
4933                                 emximp -o tmp.imp $thisname \
4934                                     2>/dev/null && \
4935                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
4936                                     < tmp.imp >>libc.tmp
4937                                 $rm tmp.imp
4938                         done
4939                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
4940                         echo "Ok." >&4
4941                 else
4942                         echo "$ar didn't seem to work right." >&4
4943                         echo "Maybe this is a Cray...trying bld instead..." >&4
4944                         if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
4945                         then
4946                                 for thisname in $libnames; do
4947                                         bld t $libnames | \
4948                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
4949                                         $ar t $thisname >>libc.tmp
4950                                 done
4951                                 echo "Ok." >&4
4952                         else
4953                                 echo "That didn't work either.  Giving up." >&4
4954                                 exit 1
4955                         fi
4956                 fi
4957         fi
4958 fi
4959 nm_extract="$com"
4960 if $test -f /lib/syscalls.exp; then
4961         echo " "
4962         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
4963         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*$/\1/p' /lib/syscalls.exp >>libc.list
4964 fi
4965 ;;
4966 esac
4967 $rm -f libnames libpath
4968
4969 : is a C symbol defined?
4970 csym='tlook=$1;
4971 case "$3" in
4972 -v) tf=libc.tmp; tc=""; tdc="";;
4973 -a) tf=libc.tmp; tc="[0]"; tdc="[]";;
4974 *) tlook="^$1\$"; tf=libc.list; tc="()"; tdc="()";;
4975 esac;
4976 tx=yes;
4977 case "$reuseval-$4" in
4978 true-) ;;
4979 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
4980 esac;
4981 case "$tx" in
4982 yes)
4983         case "$runnm" in
4984         true)
4985                 if $contains $tlook $tf >/dev/null 2>&1;
4986                 then tval=true;
4987                 else tval=false;
4988                 fi;;
4989         *)
4990                 echo "int main() { extern short $1$tdc; printf(\"%hd\", $1$tc); }" > t.c;
4991                 if $cc -o t $optimize $ccflags $ldflags t.c $libs >/dev/null 2>&1;
4992                 then tval=true;
4993                 else tval=false;
4994                 fi;
4995                 $rm -f t t.c;;
4996         esac;;
4997 *)
4998         case "$tval" in
4999         $define) tval=true;;
5000         *) tval=false;;
5001         esac;;
5002 esac;
5003 eval "$2=$tval"'
5004
5005 : define an is-in-libc? function
5006 inlibc='echo " "; td=$define; tu=$undef;
5007 sym=$1; var=$2; eval "was=\$$2";
5008 tx=yes;
5009 case "$reuseval$was" in
5010 true) ;;
5011 true*) tx=no;;
5012 esac;
5013 case "$tx" in
5014 yes)
5015         set $sym tres -f;
5016         eval $csym;
5017         case "$tres" in
5018         true)
5019                 echo "$sym() found." >&4;
5020                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
5021         *)
5022                 echo "$sym() NOT found." >&4;
5023                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
5024         esac;;
5025 *)
5026         case "$was" in
5027         $define) echo "$sym() found." >&4;;
5028         *) echo "$sym() NOT found." >&4;;
5029         esac;;
5030 esac'
5031
5032 : see if sqrtl exists
5033 set sqrtl d_sqrtl
5034 eval $inlibc
5035
5036 case "$ccflags" in
5037 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
5038 esac
5039
5040 case "$uselongdouble" in
5041 $define|true|[yY]*)     dflt='y';;
5042 *) dflt='n';;
5043 esac
5044 cat <<EOM
5045
5046 Perl can be built to take advantage of long doubles which
5047 (if available) may give more accuracy and range for floating point numbers.
5048
5049 If this doesn't make any sense to you, just accept the default '$dflt'.
5050 EOM
5051 rp='Try to use long doubles if available?'
5052 . ./myread
5053 case "$ans" in
5054 y|Y)    val="$define"   ;;
5055 *)      val="$undef"    ;;
5056 esac
5057 set uselongdouble
5058 eval $setvar
5059
5060 case "$uselongdouble" in
5061 true|[yY]*) uselongdouble="$define" ;;
5062 esac
5063
5064 case "$uselongdouble" in
5065 $define)
5066 : Look for a hint-file generated 'call-back-unit'.  If the
5067 : user has specified that long doubles should be used,
5068 : we may need to set or change some other defaults.
5069         if $test -f uselongdouble.cbu; then
5070                 echo "Your platform has some specific hints for long doubles, using them..."
5071                 . ./uselongdouble.cbu
5072         else
5073                 $cat <<EOM
5074 (Your platform doesn't have any specific hints for long doubles.)
5075 EOM
5076         fi
5077         ;;
5078 esac
5079
5080 case "$uselongdouble:$d_sqrtl" in
5081 $define:$undef)
5082                 $cat <<EOM >&4
5083
5084 *** You requested the use of long doubles but you do not seem to have
5085 *** the mathematic functions for long doubles.  I'm disabling the use
5086 *** of long doubles.
5087
5088 EOM
5089         uselongdouble=$undef
5090         ;;
5091 esac
5092
5093 : check for length of double
5094 echo " "
5095 case "$doublesize" in
5096 '')
5097         echo "Checking to see how big your double precision numbers are..." >&4
5098         $cat >try.c <<'EOCP'
5099 #include <stdio.h>
5100 int main()
5101 {
5102     printf("%d\n", (int)sizeof(double));
5103     exit(0);
5104 }
5105 EOCP
5106         set try
5107         if eval $compile_ok; then
5108                 doublesize=`./try`
5109                 echo "Your double is $doublesize bytes long."
5110         else
5111                 dflt='8'
5112                 echo "(I can't seem to compile the test program.  Guessing...)"
5113                 rp="What is the size of a double precision number (in bytes)?"
5114                 . ./myread
5115                 doublesize="$ans"
5116         fi
5117         ;;
5118 esac
5119 $rm -f try.c try
5120
5121 : check for long doubles
5122 echo " "
5123 echo "Checking to see if you have long double..." >&4
5124 echo 'int main() { long double x = 7.0; }' > try.c
5125 set try
5126 if eval $compile; then
5127         val="$define"
5128         echo "You have long double."
5129 else
5130         val="$undef"
5131         echo "You do not have long double."
5132 fi
5133 $rm try.*
5134 set d_longdbl
5135 eval $setvar
5136
5137 : check for length of long double
5138 case "${d_longdbl}${longdblsize}" in
5139 $define)
5140         echo " "
5141         echo "Checking to see how big your long doubles are..." >&4
5142         $cat >try.c <<'EOCP'
5143 #include <stdio.h>
5144 int main()
5145 {
5146         printf("%d\n", sizeof(long double));
5147 }
5148 EOCP
5149         set try
5150         set try
5151         if eval $compile; then
5152                 longdblsize=`./try$exe_ext`
5153                 echo "Your long doubles are $longdblsize bytes long."
5154         else
5155                 dflt='8'
5156                 echo " "
5157                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
5158                 rp="What is the size of a long double (in bytes)?"
5159                 . ./myread
5160                 longdblsize="$ans"
5161         fi
5162         if $test "X$doublesize" = "X$longdblsize"; then
5163                 echo "(That isn't any different from an ordinary double.)"
5164         fi      
5165         ;;
5166 esac
5167 $rm -f try.* try
5168
5169 : determine the architecture name
5170 echo " "
5171 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
5172         tarch=`arch`"-$osname"
5173 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
5174         if uname -m > tmparch 2>&1 ; then
5175                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
5176                         -e 's/$/'"-$osname/" tmparch`
5177         else
5178                 tarch="$osname"
5179         fi
5180         $rm -f tmparch
5181 else
5182         tarch="$osname"
5183 fi
5184 case "$myarchname" in
5185 ''|"$tarch") ;;
5186 *)
5187         echo "(Your architecture name used to be $myarchname.)"
5188         archname=''
5189         ;;
5190 esac
5191 myarchname="$tarch"
5192 case "$archname" in
5193 '') dflt="$tarch";;
5194 *) dflt="$archname";;
5195 esac
5196 rp='What is your architecture name'
5197 . ./myread
5198 archname="$ans"
5199 case "$usethreads" in
5200 $define)
5201         echo "Threads selected." >&4
5202         case "$archname" in
5203         *-thread*) echo "...and architecture name already has -thread." >&4
5204                 ;;
5205         *)      archname="$archname-thread"
5206                 echo "...setting architecture name to $archname." >&4
5207                 ;;
5208         esac
5209         ;;
5210 esac
5211 case "$usemultiplicity" in
5212 $define)
5213         echo "Multiplicity selected." >&4
5214         case "$archname" in
5215         *-multi*) echo "...and architecture name already has -multi." >&4
5216                 ;;
5217         *)      archname="$archname-multi"
5218                 echo "...setting architecture name to $archname." >&4
5219                 ;;
5220         esac
5221         ;;
5222 esac
5223 case "$use64bitint$use64bitall" in
5224 *"$define"*)
5225         case "$archname64" in
5226         '')
5227                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
5228                 ;;
5229         *)
5230                 case "$use64bitint" in
5231                 "$define") echo "64 bit integers selected." >&4 ;;
5232                 esac
5233                 case "$use64bitall" in
5234                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
5235                 esac
5236                 case "$archname" in
5237                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
5238                         ;;
5239                 *)      archname="$archname-$archname64"
5240                         echo "...setting architecture name to $archname." >&4
5241                         ;;
5242                 esac
5243                 ;;
5244         esac
5245 esac
5246 case "$uselongdouble" in
5247 $define)
5248         echo "Long doubles selected." >&4
5249         case "$longdblsize" in
5250         $doublesize)
5251                 "...but long doubles are equal to doubles, not changing architecture name." >&4
5252                 ;;
5253         *)
5254                 case "$archname" in
5255                 *-ld*) echo "...and architecture name already has -ld." >&4
5256                         ;;
5257                 *)      archname="$archname-ld"
5258                         echo "...setting architecture name to $archname." >&4
5259                         ;;
5260                 esac
5261                 ;;
5262         esac
5263         ;;
5264 esac
5265
5266 : determine root of directory hierarchy where package will be installed.
5267 case "$prefix" in
5268 '')
5269         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
5270         ;;
5271 *)
5272         dflt="$prefix"
5273         ;;
5274 esac
5275 $cat <<EOM
5276
5277 By default, $package will be installed in $dflt/bin, manual pages
5278 under $dflt/man, etc..., i.e. with $dflt as prefix for all
5279 installation directories. Typically this is something like /usr/local.
5280 If you wish to have binaries under /usr/bin but other parts of the
5281 installation under /usr/local, that's ok: you will be prompted
5282 separately for each of the installation directories, the prefix being
5283 only used to set the defaults.
5284
5285 EOM
5286 fn=d~
5287 rp='Installation prefix to use?'
5288 . ./getfile
5289 oldprefix=''
5290 case "$prefix" in
5291 '') ;;
5292 *)
5293         case "$ans" in
5294         "$prefix") ;;
5295         *) oldprefix="$prefix";;
5296         esac
5297         ;;
5298 esac
5299 prefix="$ans"
5300 prefixexp="$ansexp"
5301
5302 : is AFS running?
5303 echo " "
5304 case "$afs" in
5305 $define|true)   afs=true ;;
5306 $undef|false)   afs=false ;;
5307 *)      if test -d /afs; then
5308                 afs=true
5309         else
5310                 afs=false
5311         fi
5312         ;;
5313 esac
5314 if $afs; then
5315         echo "AFS may be running... I'll be extra cautious then..." >&4
5316 else
5317         echo "AFS does not seem to be running..." >&4
5318 fi
5319
5320 : determine installation prefix for where package is to be installed.
5321 if $afs; then 
5322 $cat <<EOM
5323
5324 Since you are running AFS, I need to distinguish the directory in which
5325 files will reside from the directory in which they are installed (and from
5326 which they are presumably copied to the former directory by occult means).
5327
5328 EOM
5329         case "$installprefix" in
5330         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
5331         *) dflt="$installprefix";;
5332         esac
5333 else
5334 $cat <<EOM
5335
5336 In some special cases, particularly when building $package for distribution,
5337 it is convenient to distinguish between the directory in which files should 
5338 be installed from the directory ($prefix) in which they 
5339 will eventually reside.  For most users, these two directories are the same.
5340
5341 EOM
5342         case "$installprefix" in
5343         '') dflt=$prefix ;;
5344         *) dflt=$installprefix;;
5345         esac
5346 fi
5347 fn=d~
5348 rp='What installation prefix should I use for installing files?'
5349 . ./getfile
5350 installprefix="$ans"
5351 installprefixexp="$ansexp"
5352
5353 : set the prefixit variable, to compute a suitable default value
5354 prefixit='case "$3" in
5355 ""|none)
5356         case "$oldprefix" in
5357         "") eval "$1=\"\$$2\"";;
5358         *)
5359                 case "$3" in
5360                 "") eval "$1=";;
5361                 none)
5362                         eval "tp=\"\$$2\"";
5363                         case "$tp" in
5364                         ""|" ") eval "$1=\"\$$2\"";;
5365                         *) eval "$1=";;
5366                         esac;;
5367                 esac;;
5368         esac;;
5369 *)
5370         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
5371         case "$tp" in
5372         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
5373         /*-$oldprefix/*|\~*-$oldprefix/*)
5374                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
5375         *) eval "$1=\"\$$2\"";;
5376         esac;;
5377 esac'
5378
5379
5380 : get the patchlevel
5381 echo " "
5382 echo "Getting the current patchlevel..." >&4
5383 if $test -r $rsrc/patchlevel.h;then
5384         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
5385         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
5386         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
5387         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
5388         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
5389         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
5390 else
5391         revision=0
5392         patchlevel=0
5393         subversion=0
5394         api_revision=0
5395         api_version=0
5396         api_subversion=0
5397 fi
5398 $echo "(You have $package version $patchlevel subversion $subversion.)"
5399 case "$osname" in
5400 dos|vms)
5401         : XXX Should be a Configure test for double-dots in filenames.
5402         version=`echo $revision $patchlevel $subversion | \
5403                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
5404         api_versionstring=`echo $api_revision $api_version $api_subversion | \
5405                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
5406         ;;
5407 *)
5408         version=`echo $revision $patchlevel $subversion | \
5409                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
5410         api_versionstring=`echo $api_revision $api_version $api_subversion | \
5411                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
5412         ;;
5413 esac
5414 : Special case the 5.005_xx maintenance series, which used 5.005
5415 : without any subversion label as a subdirectory in $sitelib
5416 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
5417         api_versionstring='5.005'
5418 fi
5419
5420 : determine installation style
5421 : For now, try to deduce it from prefix unless it is already set.
5422 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
5423 case "$installstyle" in
5424 '')     case "$prefix" in
5425                 *perl*) dflt='lib';;
5426                 *) dflt='lib/perl5' ;;
5427         esac
5428         ;;
5429 *)      dflt="$installstyle" ;;
5430 esac
5431 : Probably not worth prompting for this since we prompt for all
5432 : the directories individually, and the prompt would be too long and
5433 : confusing anyway.
5434 installstyle=$dflt
5435
5436 : determine where private library files go
5437 : Usual default is /usr/local/lib/perl5/$version.
5438 : Also allow things like /opt/perl/lib/$version, since 
5439 : /opt/perl/lib/perl5... would be redundant.
5440 : The default "style" setting is made in installstyle.U
5441 case "$installstyle" in
5442 *lib/perl5*) set dflt privlib lib/$package/$version ;;
5443 *)       set dflt privlib lib/$version ;;
5444 esac
5445 eval $prefixit
5446 $cat <<EOM
5447
5448 There are some auxiliary files for $package that need to be put into a
5449 private library directory that is accessible by everyone.
5450
5451 EOM
5452 fn=d~+
5453 rp='Pathname where the private library files will reside?'
5454 . ./getfile
5455 privlib="$ans"
5456 privlibexp="$ansexp"
5457 : Change installation prefix, if necessary.
5458 if $test X"$prefix" != X"$installprefix"; then
5459         installprivlib=`echo $privlibexp | sed "s#^$prefix#$installprefix#"`
5460 else
5461         installprivlib="$privlibexp"
5462 fi
5463
5464 : set the prefixup variable, to restore leading tilda escape
5465 prefixup='case "$prefixexp" in
5466 "$prefix") ;;
5467 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
5468 esac'
5469
5470 : determine where public architecture dependent libraries go
5471 set archlib archlib
5472 eval $prefixit
5473 : privlib default is /usr/local/lib/$package/$version
5474 : archlib default is /usr/local/lib/$package/$version/$archname
5475 : privlib may have an optional trailing /share.
5476 tdflt=`echo $privlib | $sed 's,/share$,,'`
5477 tdflt=$tdflt/$archname
5478 case "$archlib" in
5479 '')     dflt=$tdflt
5480         ;;
5481 *)      dflt="$archlib"
5482     ;;
5483 esac
5484 $cat <<EOM
5485
5486 $spackage contains architecture-dependent library files.  If you are
5487 sharing libraries in a heterogeneous environment, you might store
5488 these files in a separate location.  Otherwise, you can just include
5489 them with the rest of the public library files.
5490
5491 EOM
5492 fn=d+~
5493 rp='Where do you want to put the public architecture-dependent libraries?'
5494 . ./getfile
5495 archlib="$ans"
5496 archlibexp="$ansexp"
5497 if $test X"$archlib" = X"$privlib"; then
5498         d_archlib="$undef"
5499 else
5500         d_archlib="$define"
5501 fi
5502 : Change installation prefix, if necessary.
5503 if $test X"$prefix" != X"$installprefix"; then
5504         installarchlib=`echo $archlibexp | sed "s#^$prefix#$installprefix#"`
5505 else
5506         installarchlib="$archlibexp"
5507 fi
5508
5509
5510 : Binary compatibility with 5.005 is not possible for builds
5511 : with advanced features
5512 case "$usethreads$usemultiplicity" in
5513 *define*)
5514         bincompat5005="$undef"
5515         d_bincompat5005="$undef"
5516         ;;
5517 *)      $cat <<EOM
5518
5519 This version of Perl can be compiled for binary compatibility with 5.005.
5520 If you decide to do so, you will be able to continue using most of the
5521 extensions that were compiled for Perl 5.005.
5522
5523 EOM
5524         case "$bincompat5005$d_bincompat5005" in
5525         *"$undef"*) dflt=n ;;
5526         *) dflt=y ;;
5527         esac
5528         rp='Binary compatibility with Perl 5.005?'
5529         . ./myread
5530         case "$ans" in
5531         y*) val="$define" ;;
5532         *)  val="$undef" ;;
5533         esac
5534         set d_bincompat5005
5535         eval $setvar
5536         case "$d_bincompat5005" in
5537         "$define")
5538                 bincompat5005="$define"
5539                 ;;
5540         *)      bincompat5005="$undef"
5541                 d_bincompat5005="$undef"
5542                 ;;
5543         esac
5544         ;;
5545 esac
5546
5547
5548 : see if setuid scripts can be secure
5549 $cat <<EOM
5550
5551 Some kernels have a bug that prevents setuid #! scripts from being
5552 secure.  Some sites have disabled setuid #! scripts because of this.
5553
5554 First let's decide if your kernel supports secure setuid #! scripts.
5555 (If setuid #! scripts would be secure but have been disabled anyway,
5556 don't say that they are secure if asked.)
5557
5558 EOM
5559
5560 val="$undef"
5561 if $test -d /dev/fd; then
5562         echo "#!$ls" >reflect
5563         chmod +x,u+s reflect
5564         ./reflect >flect 2>&1
5565         if $contains "/dev/fd" flect >/dev/null; then
5566                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
5567                 val="$define"
5568         else
5569                 $cat <<EOM
5570 If you are not sure if they are secure, I can check but I'll need a
5571 username and password different from the one you are using right now.
5572 If you don't have such a username or don't want me to test, simply
5573 enter 'none'.
5574
5575 EOM
5576                 rp='Other username to test security of setuid scripts with?'
5577                 dflt='none'
5578                 . ./myread
5579                 case "$ans" in
5580                 n|none)
5581                         case "$d_suidsafe" in
5582                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
5583                                 dflt=n;;
5584                         "$undef")
5585                                 echo "Well, the $hint value is *not* secure." >&4
5586                                 dflt=n;;
5587                         *)      echo "Well, the $hint value *is* secure." >&4
5588                                 dflt=y;;
5589                         esac
5590                         ;;
5591                 *)
5592                         $rm -f reflect flect
5593                         echo "#!$ls" >reflect
5594                         chmod +x,u+s reflect
5595                         echo >flect
5596                         chmod a+w flect
5597                         echo '"su" will (probably) prompt you for '"$ans's password."
5598                         su $ans -c './reflect >flect'
5599                         if $contains "/dev/fd" flect >/dev/null; then
5600                                 echo "Okay, it looks like setuid scripts are secure." >&4
5601                                 dflt=y
5602                         else
5603                                 echo "I don't think setuid scripts are secure." >&4
5604                                 dflt=n
5605                         fi
5606                         ;;
5607                 esac
5608                 rp='Does your kernel have *secure* setuid scripts?'
5609                 . ./myread
5610                 case "$ans" in
5611                 [yY]*)  val="$define";;
5612                 *)      val="$undef";;
5613                 esac
5614         fi
5615 else
5616         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
5617         echo "(That's for file descriptors, not floppy disks.)"
5618         val="$undef"
5619 fi
5620 set d_suidsafe
5621 eval $setvar
5622
5623 $rm -f reflect flect
5624
5625 : now see if they want to do setuid emulation
5626 echo " "
5627 val="$undef"
5628 case "$d_suidsafe" in
5629 "$define")
5630         val="$undef"
5631         echo "No need to emulate SUID scripts since they are secure here." >& 4
5632         ;;
5633 *)
5634         $cat <<EOM
5635 Some systems have disabled setuid scripts, especially systems where
5636 setuid scripts cannot be secure.  On systems where setuid scripts have
5637 been disabled, the setuid/setgid bits on scripts are currently
5638 useless.  It is possible for $package to detect those bits and emulate
5639 setuid/setgid in a secure fashion.  This emulation will only work if
5640 setuid scripts have been disabled in your kernel.
5641
5642 EOM
5643         case "$d_dosuid" in
5644         "$define") dflt=y ;;
5645         *) dflt=n ;;
5646         esac
5647         rp="Do you want to do setuid/setgid emulation?"
5648         . ./myread
5649         case "$ans" in
5650         [yY]*)  val="$define";;
5651         *)      val="$undef";;
5652         esac
5653         ;;
5654 esac
5655 set d_dosuid
5656 eval $setvar
5657
5658 : determine filename position in cpp output
5659 echo " "
5660 echo "Computing filename position in cpp output for #include directives..." >&4
5661 echo '#include <stdio.h>' > foo.c
5662 $cat >fieldn <<EOF
5663 $startsh
5664 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5665 $grep '^[       ]*#.*stdio\.h' | \
5666 while read cline; do
5667         pos=1
5668         set \$cline
5669         while $test \$# -gt 0; do
5670                 if $test -r \`echo \$1 | $tr -d '"'\`; then
5671                         echo "\$pos"
5672                         exit 0
5673                 fi
5674                 shift
5675                 pos=\`expr \$pos + 1\`
5676         done
5677 done
5678 EOF
5679 chmod +x fieldn
5680 fieldn=`./fieldn`
5681 $rm -f foo.c fieldn
5682 case $fieldn in
5683 '') pos='???';;
5684 1) pos=first;;
5685 2) pos=second;;
5686 3) pos=third;;
5687 *) pos="${fieldn}th";;
5688 esac
5689 echo "Your cpp writes the filename in the $pos field of the line."
5690
5691 : locate header file
5692 $cat >findhdr <<EOF
5693 $startsh
5694 wanted=\$1
5695 name=''
5696 for usrincdir in $usrinc
5697 do
5698         if test -f \$usrincdir/\$wanted; then
5699                 echo "\$usrincdir/\$wanted"
5700                 exit 0
5701         fi
5702 done
5703 awkprg='{ print \$$fieldn }'
5704 echo "#include <\$wanted>" > foo\$\$.c
5705 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5706 $grep "^[       ]*#.*\$wanted" | \
5707 while read cline; do
5708         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5709         case "\$name" in
5710         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5711         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5712         *) exit 2;;
5713         esac;
5714 done;
5715 #
5716 # status = 0: grep returned 0 lines, case statement not executed
5717 # status = 1: headerfile found
5718 # status = 2: while loop executed, no headerfile found
5719 #
5720 status=\$?
5721 $rm -f foo\$\$.c;
5722 if test \$status -eq 1; then
5723         exit 0;
5724 fi
5725 exit 1
5726 EOF
5727 chmod +x findhdr
5728
5729 : define an alternate in-header-list? function
5730 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5731 cont=true; xxf="echo \"<\$1> found.\" >&4";
5732 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5733 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5734 esac;
5735 case $# in 4) instead=instead;; *) instead="at last";; esac;
5736 while $test "$cont"; do
5737         xxx=`./findhdr $1`
5738         var=$2; eval "was=\$$2";
5739         if $test "$xxx" && $test -r "$xxx";
5740         then eval $xxf;
5741         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5742                 cont="";
5743         else eval $xxnf;
5744         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5745         set $yyy; shift; shift; yyy=$@;
5746         case $# in 0) cont="";;
5747         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5748                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5749         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5750                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5751         esac;
5752 done;
5753 while $test "$yyy";
5754 do set $yyy; var=$2; eval "was=\$$2";
5755         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5756         set $yyy; shift; shift; yyy=$@;
5757 done'
5758
5759 : see if this is a malloc.h system
5760 set malloc.h i_malloc
5761 eval $inhdr
5762
5763 : see if stdlib is available
5764 set stdlib.h i_stdlib
5765 eval $inhdr
5766
5767 : determine which malloc to compile in
5768 echo " "
5769 case "$usemymalloc" in
5770 ''|[yY]*|true|$define)  dflt='y' ;;
5771 *)      dflt='n' ;;
5772 esac
5773 rp="Do you wish to attempt to use the malloc that comes with $package?"
5774 . ./myread
5775 usemymalloc="$ans"
5776 case "$ans" in
5777 y*|true)
5778         usemymalloc='y'
5779         mallocsrc='malloc.c'
5780         mallocobj="malloc$_o"
5781         d_mymalloc="$define"
5782         case "$libs" in
5783         *-lmalloc*)
5784                 : Remove malloc from list of libraries to use
5785                 echo "Removing unneeded -lmalloc from library list" >&4
5786                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
5787                 shift
5788                 libs="$*"
5789                 echo "libs = $libs" >&4
5790                 ;;
5791         esac
5792         ;;
5793 *)
5794         usemymalloc='n'
5795         mallocsrc=''
5796         mallocobj=''
5797         d_mymalloc="$undef"
5798         ;;
5799 esac
5800
5801 : compute the return types of malloc and free
5802 echo " "
5803 $cat >malloc.c <<END
5804 #$i_malloc I_MALLOC
5805 #$i_stdlib I_STDLIB
5806 #include <stdio.h>
5807 #include <sys/types.h>
5808 #ifdef I_MALLOC
5809 #include <malloc.h>
5810 #endif
5811 #ifdef I_STDLIB
5812 #include <stdlib.h>
5813 #endif
5814 #ifdef TRY_MALLOC
5815 void *malloc();
5816 #endif
5817 #ifdef TRY_FREE
5818 void free();
5819 #endif
5820 END
5821 case "$malloctype" in
5822 '')
5823         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
5824                 malloctype='void *'
5825         else
5826                 malloctype='char *'
5827         fi
5828         ;;
5829 esac
5830 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
5831
5832 case "$freetype" in
5833 '')
5834         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
5835                 freetype='void'
5836         else
5837                 freetype='int'
5838         fi
5839         ;;
5840 esac
5841 echo "Your system uses $freetype free(), it would seem." >&4
5842 $rm -f malloc.[co]
5843 $cat <<EOM
5844
5845 After $package is installed, you may wish to install various
5846 add-on modules and utilities.  Typically, these add-ons will
5847 be installed under $prefix with the rest
5848 of this package.  However, you may wish to install such add-ons
5849 elsewhere under a different prefix.
5850
5851 If you do not wish to put everything under a single prefix, that's
5852 ok.  You will be prompted for the individual locations; this siteprefix
5853 is only used to suggest the defaults.
5854
5855 The default should be fine for most people.
5856
5857 EOM
5858 fn=d~+
5859 rp='Installation prefix to use for add-on modules and utilities?'
5860 : XXX Here might be another good place for an installstyle setting.
5861 case "$siteprefix" in
5862 '') dflt=$prefix ;;
5863 *)  dflt=$siteprefix ;;
5864 esac
5865 . ./getfile
5866 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
5867 oldsiteprefix=''
5868 case "$siteprefix" in
5869 '') ;;
5870 *)      case "$ans" in
5871         "$prefix") ;;
5872         *) oldsiteprefix="$prefix";;
5873         esac
5874         ;;
5875 esac
5876 siteprefix="$ans"
5877 siteprefixexp="$ansexp"
5878
5879 : determine where site specific libraries go.
5880 : Usual default is /usr/local/lib/perl5/site_perl/$version
5881 : The default "style" setting is made in installstyle.U
5882 : XXX No longer works with Prefixit stuff.
5883 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
5884 case "$sitelib" in
5885 '') case "$installstyle" in
5886         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
5887         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
5888         esac
5889         ;;
5890 *)      dflt="$sitelib"
5891         ;;
5892 esac
5893 $cat <<EOM
5894
5895 The installation process will create a directory for
5896 site-specific extensions and modules.  Most users find it convenient
5897 to place all site-specific files in this directory rather than in the
5898 main distribution directory.
5899
5900 EOM
5901 fn=d~+
5902 rp='Pathname for the site-specific library files?'
5903 . ./getfile
5904 sitelib="$ans"
5905 sitelibexp="$ansexp"
5906 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
5907 : Change installation prefix, if necessary.
5908 if $test X"$prefix" != X"$installprefix"; then
5909         installsitelib=`echo $sitelibexp | $sed "s#^$prefix#$installprefix#"`
5910 else
5911         installsitelib="$sitelibexp"
5912 fi
5913
5914 : determine where site specific architecture-dependent libraries go.
5915 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
5916 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
5917 : sitelib may have an optional trailing /share.
5918 case "$sitearch" in
5919 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
5920         dflt="$dflt/$archname"
5921         ;;
5922 *)      dflt="$sitearch"
5923         ;;
5924 esac
5925 set sitearch sitearch none
5926 eval $prefixit
5927 $cat <<EOM
5928
5929 The installation process will also create a directory for
5930 architecture-dependent site-specific extensions and modules.
5931
5932 EOM
5933 fn=d~+
5934 rp='Pathname for the site-specific architecture-dependent library files?'
5935 . ./getfile
5936 sitearch="$ans"
5937 sitearchexp="$ansexp"
5938 : Change installation prefix, if necessary.
5939 if $test X"$prefix" != X"$installprefix"; then
5940         installsitearch=`echo $sitearchexp | sed "s#^$prefix#$installprefix#"`
5941 else
5942         installsitearch="$sitearchexp"
5943 fi
5944
5945 $cat <<EOM
5946
5947 The installation process will also create a directory for
5948 vendor-supplied add-ons.  Vendors who supply perl with their system
5949 may find it convenient to place all vendor-supplied files in this
5950 directory rather than in the main distribution directory.  This will
5951 ease upgrades between binary-compatible maintenance versions of perl.
5952
5953 Of course you may also use these directories in whatever way you see
5954 fit.  For example, you might use them to access modules shared over a
5955 company-wide network.
5956
5957 The default answer should be fine for most people.
5958 This causes further questions about vendor add-ons to be skipped
5959 and no vendor-specific directories will be configured for perl.
5960
5961 EOM
5962 rp='Do you want to configure vendor-specific add-on directories?'
5963 case "$usevendorprefix" in
5964 define|true|[yY]*) dflt=y ;;
5965 *)      : User may have set vendorprefix directly on Configure command line.
5966         case "$vendorprefix" in
5967         ''|' ') dflt=n ;;
5968         *)      dflt=y ;;
5969         esac
5970         ;;
5971 esac
5972 . ./myread
5973 case "$ans" in
5974 [yY]*)  fn=d~+
5975         rp='Installation prefix to use for vendor-supplied add-ons?'
5976         case "$vendorprefix" in
5977         '') dflt='' ;;
5978         *)  dflt=$vendorprefix ;;
5979         esac
5980         . ./getfile
5981         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
5982         oldvendorprefix=''
5983         case "$vendorprefix" in
5984         '') ;;
5985         *)      case "$ans" in
5986                 "$prefix") ;;
5987                 *) oldvendorprefix="$prefix";;
5988                 esac
5989                 ;;
5990         esac
5991         usevendorprefix="$define"
5992         vendorprefix="$ans"
5993         vendorprefixexp="$ansexp"
5994         ;;
5995 *)      usevendorprefix="$undef"
5996         vendorprefix=''
5997         vendorprefixexp=''
5998         ;;
5999 esac
6000
6001 case "$vendorprefix" in
6002 '')     d_vendorlib="$undef"
6003         vendorlib=''
6004         vendorlibexp=''
6005         ;;
6006 *)      d_vendorlib="$define"
6007         : determine where vendor-supplied modules go.
6008         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
6009         case "$vendorlib" in
6010         '')
6011                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6012                 case "$installstyle" in
6013                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
6014                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
6015                 esac
6016                 ;;
6017         *)      dflt="$vendorlib"
6018                 ;;
6019         esac
6020         fn=d~+
6021         rp='Pathname for the vendor-supplied library files?'
6022         . ./getfile
6023         vendorlib="$ans"
6024         vendorlibexp="$ansexp"
6025         ;;
6026 esac
6027 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
6028 : Change installation prefix, if necessary.
6029 if $test X"$prefix" != X"$installprefix"; then
6030         installvendorlib=`echo $vendorlibexp | $sed "s#^$prefix#$installprefix#"`
6031 else
6032         installvendorlib="$vendorlibexp"
6033 fi
6034
6035 case "$vendorprefix" in
6036 '')     d_vendorarch="$undef"
6037         vendorarch=''
6038         vendorarchexp=''
6039         ;;
6040 *)      d_vendorarch="$define"
6041         : determine where vendor-supplied architecture-dependent libraries go.
6042         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
6043         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
6044         : vendorlib may have an optional trailing /share.
6045         case "$vendorarch" in
6046         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
6047                 dflt="$dflt/$archname"
6048                 ;;
6049         *)      dflt="$vendorarch" ;;
6050         esac
6051         fn=d~+
6052         rp='Pathname for vendor-supplied architecture-dependent files?'
6053         . ./getfile
6054         vendorarch="$ans"
6055         vendorarchexp="$ansexp"
6056         ;;
6057 esac
6058 : Change installation prefix, if necessary.
6059 if $test X"$prefix" != X"$installprefix"; then
6060         installvendorarch=`echo $vendorarchexp | sed "s#^$prefix#$installprefix#"`
6061 else
6062         installvendorarch="$vendorarchexp"
6063 fi
6064
6065 : Final catch-all directories to search
6066 $cat <<EOM
6067
6068 Lastly, you can have perl look in other directories for extensions and
6069 modules in addition to those already specified.
6070 These directories will be searched after 
6071         $sitearch 
6072         $sitelib 
6073 EOM
6074 test X"$vendorlib" != "X" && echo '     ' $vendorlib
6075 test X"$vendorarch" != "X" && echo '    ' $vendorarch
6076 echo ' '
6077 case "$otherlibdirs" in
6078 ''|' ') dflt='none' ;;
6079 *)      dflt="$otherlibdirs" ;;
6080 esac
6081 $cat <<EOM
6082 Enter a colon-separated set of extra paths to include in perl's @INC
6083 search path, or enter 'none' for no extra paths.
6084
6085 EOM
6086
6087 rp='Colon-separated list of additional directories for perl to search?'
6088 . ./myread
6089 case "$ans" in
6090 ' '|''|none)    otherlibdirs=' ' ;;     
6091 *)      otherlibdirs="$ans" ;;
6092 esac
6093 case "$otherlibdirs" in
6094 ' ') val=$undef ;;
6095 *)      val=$define ;;
6096 esac
6097 set d_perl_otherlibdirs
6098 eval $setvar
6099
6100 : Cruising for prototypes
6101 echo " "
6102 echo "Checking out function prototypes..." >&4
6103 $cat >prototype.c <<'EOCP'
6104 int main(int argc, char *argv[]) {
6105         exit(0);}
6106 EOCP
6107 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
6108         echo "Your C compiler appears to support function prototypes."
6109         val="$define"
6110 else
6111         echo "Your C compiler doesn't seem to understand function prototypes."
6112         val="$undef"
6113 fi
6114 set prototype
6115 eval $setvar
6116 $rm -f prototype*
6117
6118 case "$prototype" in
6119 "$define") ;;
6120 *)      ansi2knr='ansi2knr'
6121         echo " "
6122         cat <<EOM >&4
6123
6124 $me:  FATAL ERROR:
6125 This version of $package can only be compiled by a compiler that 
6126 understands function prototypes.  Unfortunately, your C compiler 
6127         $cc $ccflags
6128 doesn't seem to understand them.  Sorry about that.
6129
6130 If GNU cc is available for your system, perhaps you could try that instead.  
6131
6132 Eventually, we hope to support building Perl with pre-ANSI compilers.
6133 If you would like to help in that effort, please contact <perlbug@perl.org>.
6134
6135 Aborting Configure now.
6136 EOM
6137         exit 2
6138         ;;
6139 esac
6140
6141 : determine where public executables go
6142 echo " "
6143 set dflt bin bin
6144 eval $prefixit
6145 fn=d~
6146 rp='Pathname where the public executables will reside?'
6147 . ./getfile
6148 if $test "X$ansexp" != "X$binexp"; then
6149         installbin=''
6150 fi
6151 bin="$ans"
6152 binexp="$ansexp"
6153 : Change installation prefix, if necessary.
6154 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
6155 if $test X"$prefix" != X"$installprefix"; then
6156         installbin=`echo $binexp | sed "s#^$prefix#$installprefix#"`
6157 else
6158         installbin="$binexp"
6159 fi
6160
6161 : Find perl5.005 or later.
6162 echo "Looking for a previously installed perl5.005 or later... "
6163 case "$perl5" in
6164 '')     for tdir in `echo "$binexp:$PATH" | $sed "s/$path_sep/ /g"`; do
6165                 : Check if this perl is recent and can load a simple module
6166                 if $test -x $tdir/perl && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6167                         perl5=$tdir/perl
6168                         break;
6169                 elif $test -x $tdir/perl5 && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6170                         perl5=$tdir/perl
6171                         break;
6172                 fi
6173         done
6174         ;;
6175 *)      perl5="$perl5"
6176         ;;
6177 esac
6178 case "$perl5" in
6179 '')     echo "None found.  That's ok.";;
6180 *)      echo "Using $perl5." ;;
6181 esac
6182
6183 : Determine list of previous versions to include in @INC
6184 $cat > getverlist <<EOPL
6185 #!$perl5 -w
6186 use File::Basename;
6187 \$api_versionstring = "$api_versionstring";
6188 \$version = "$version";
6189 \$stem = "$sitelib_stem";
6190 \$archname = "$archname";
6191 EOPL
6192         $cat >> getverlist <<'EOPL'
6193 # Can't have leading @ because metaconfig interprets it as a command!
6194 ;@inc_version_list=();
6195 # XXX Redo to do opendir/readdir? 
6196 if (-d $stem) {
6197     chdir($stem);
6198     ;@candidates = glob("5.*");
6199 }
6200 else {
6201     ;@candidates = ();
6202 }
6203
6204 # XXX ToDo:  These comparisons must be reworked when two-digit
6205 # subversions come along, so that 5.7.10 compares as greater than
6206 # 5.7.3!  By that time, hope that 5.6.x is sufficiently
6207 # widespread that we can use the built-in version vectors rather
6208 # than reinventing them here.  For 5.6.0, however, we must
6209 # assume this script will likely be run by 5.005_0x.  --AD 1/2000.
6210 foreach $d (@candidates) {
6211     if ($d lt $version) {
6212         if ($d ge $api_versionstring) {
6213             unshift(@inc_version_list, grep { -d } "$d/$archname", $d);
6214         }
6215         elsif ($d ge "5.005") {
6216             unshift(@inc_version_list, grep { -d } $d);
6217         }
6218     }
6219     else {
6220         # Skip newer version.  I.e. don't look in
6221         # 5.7.0 if we're installing 5.6.1.
6222     }
6223 }
6224
6225 if (@inc_version_list) {
6226     print join(' ', @inc_version_list);
6227 }
6228 else {
6229     # Blank space to preserve value for next Configure run.
6230     print " ";
6231 }
6232 EOPL
6233 chmod +x getverlist
6234 case "$inc_version_list" in
6235 '')     if test -x "$perl5"; then
6236                 dflt=`$perl5 getverlist`
6237         else
6238                 dflt='none'
6239         fi
6240         ;;
6241 $undef) dflt='none' ;;
6242 *)  dflt="$inc_version_list" ;;
6243 esac
6244 case "$dflt" in
6245 ''|' ') dflt=none ;;
6246 esac
6247 case "$dflt" in
6248 5.005) case "$bincompat5005" in
6249        $define|true|[yY]*) ;;
6250        *) dflt=none ;;
6251        esac
6252        ;;
6253 esac
6254 $cat <<'EOM'
6255
6256 In order to ease the process of upgrading, this version of perl 
6257 can be configured to use modules built and installed with earlier 
6258 versions of perl that were installed under $prefix.  Specify here
6259 the list of earlier versions that this version of perl should check.
6260 If Configure detected no earlier versions of perl installed under
6261 $prefix, then the list will be empty.  Answer 'none' to tell perl
6262 to not search earlier versions.
6263
6264 The default should almost always be sensible, so if you're not sure,
6265 just accept the default.
6266 EOM
6267
6268 rp='List of earlier versions to include in @INC?'
6269 . ./myread
6270 case "$ans" in
6271 [Nn]one|''|' ') inc_version_list=' ' ;;
6272 *) inc_version_list="$ans" ;;
6273 esac
6274 case "$inc_version_list" in
6275 ''|' ') 
6276         inc_version_list_init='0';;
6277 *)      inc_version_list_init=`echo $inc_version_list |
6278                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
6279         ;;
6280 esac
6281 $rm -f getverlist
6282
6283 : determine whether to install perl also as /usr/bin/perl
6284
6285 echo " "
6286 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
6287         $cat <<EOM
6288 Many scripts expect perl to be installed as /usr/bin/perl.
6289 I can install the perl you are about to compile also as /usr/bin/perl
6290 (in addition to $installbin/perl).
6291 EOM
6292         case "$installusrbinperl" in
6293         "$undef"|[nN]*) dflt='n';;
6294         *)              dflt='y';;
6295         esac
6296         rp="Do you want to install perl as /usr/bin/perl?"
6297         . ./myread
6298         case "$ans" in
6299         [yY]*)  val="$define";;
6300         *)      val="$undef" ;;
6301         esac
6302 else
6303         val="$undef"
6304 fi
6305 set installusrbinperl
6306 eval $setvar
6307
6308 : see if dld is available
6309 set dld.h i_dld
6310 eval $inhdr
6311
6312 : see if dlopen exists
6313 xxx_runnm="$runnm"
6314 runnm=false
6315 set dlopen d_dlopen
6316 eval $inlibc
6317 runnm="$xxx_runnm"
6318
6319 : determine which dynamic loading, if any, to compile in
6320 echo " "
6321 dldir="ext/DynaLoader"
6322 case "$usedl" in
6323 $define|y|true)
6324         dflt='y'
6325         usedl="$define"
6326         ;;
6327 $undef|n|false)
6328         dflt='n'
6329         usedl="$undef"
6330         ;;
6331 *) 
6332         dflt='n'
6333         case "$d_dlopen" in
6334             $define) dflt='y' ;;
6335         esac
6336         case "$i_dld" in
6337             $define) dflt='y' ;;
6338         esac
6339         : Does a dl_xxx.xs file exist for this operating system
6340         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
6341         ;;
6342 esac
6343 rp="Do you wish to use dynamic loading?"
6344 . ./myread
6345 usedl="$ans"
6346 case "$ans" in
6347 y*) usedl="$define"
6348         case "$dlsrc" in
6349         '')
6350                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
6351                         dflt="$dldir/dl_${osname}.xs"
6352                 elif $test "$d_dlopen" = "$define" ; then
6353                         dflt="$dldir/dl_dlopen.xs"
6354                 elif $test "$i_dld" = "$define" ; then
6355                         dflt="$dldir/dl_dld.xs"
6356                 else
6357                         dflt=''
6358                 fi
6359                 ;;
6360         *)      dflt="$dldir/$dlsrc"
6361                 ;;
6362         esac
6363     echo "The following dynamic loading files are available:"
6364         : Can not go over to $dldir because getfile has path hard-coded in.
6365         tdir=`pwd`; cd $rsrc; $ls -C $dldir/dl*.xs; cd $tdir
6366         rp="Source file to use for dynamic loading"
6367         fn="fne"
6368         gfpth="$src"
6369         . ./getfile
6370         usedl="$define"
6371         : emulate basename
6372         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
6373
6374         $cat << EOM
6375
6376 Some systems may require passing special flags to $cc -c to
6377 compile modules that will be used to create a shared library.
6378 To use no flags, say "none".
6379
6380 EOM
6381     case "$cccdlflags" in
6382     '') case "$gccversion" in
6383                 '') case "$osname" in
6384                         hpux)   dflt='+z' ;;
6385                         next)   dflt='none' ;;
6386                         irix*)  dflt='-KPIC' ;;
6387                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
6388                         sunos)  dflt='-pic' ;;
6389                         *)      dflt='none' ;;
6390                     esac
6391                         ;;
6392                 *)  case "$osname" in
6393                         svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
6394                         *)      dflt='-fpic' ;;
6395                     esac ;;
6396             esac ;;
6397         ' ') dflt='none' ;;
6398     *)  dflt="$cccdlflags" ;;
6399     esac
6400     rp="Any special flags to pass to $cc -c to compile shared library modules?"
6401     . ./myread
6402     case "$ans" in
6403     none) cccdlflags=' ' ;;
6404     *) cccdlflags="$ans" ;;
6405     esac
6406
6407     cat << EOM
6408
6409 Some systems use ld to create libraries that can be dynamically loaded,
6410 while other systems (such as those using ELF) use $cc.
6411
6412 EOM
6413         case "$ld" in
6414         '')     $cat >try.c <<'EOM'
6415 /* Test for whether ELF binaries are produced */
6416 #include <fcntl.h>
6417 #include <stdlib.h>
6418 int main() {
6419         char b[4];
6420         int i = open("a.out",O_RDONLY);
6421         if(i == -1) 
6422                 exit(1); /* fail */
6423         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
6424                 exit(0); /* succeed (yes, it's ELF) */
6425         else
6426                 exit(1); /* fail */
6427 }
6428 EOM
6429                 if $cc $ccflags try.c >/dev/null 2>&1 && ./a.out; then
6430                         cat <<EOM
6431 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
6432 EOM
6433                         dflt="$cc"
6434                 else
6435                         echo "I'll use ld to build dynamic libraries."
6436                         dflt='ld'
6437                 fi
6438                 rm -f try.c a.out
6439                 ;;
6440         *)      dflt="$ld"
6441                 ;;
6442         esac
6443
6444     rp="What command should be used to create dynamic libraries?"
6445     . ./myread
6446         ld="$ans"
6447
6448     cat << EOM
6449
6450 Some systems may require passing special flags to $ld to create a
6451 library that can be dynamically loaded.  If your ld flags include
6452 -L/other/path options to locate libraries outside your loader's normal
6453 search path, you may need to specify those -L options here as well.  To
6454 use no flags, say "none".
6455
6456 EOM
6457     case "$lddlflags" in
6458     '') case "$osname" in
6459                         beos) dflt='-nostart' ;;
6460                         hpux) dflt='-b';
6461                               case "$gccversion" in
6462                               '') dflt="$dflt +vnocompatwarnings" ;;
6463                               esac
6464                               ;;        
6465                         linux|irix*)    dflt='-shared' ;;
6466                         next)  dflt='none' ;;
6467                         solaris) dflt='-G' ;;
6468                         sunos) dflt='-assert nodefinitions' ;;
6469                         svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
6470                 *)     dflt='none' ;;
6471                         esac
6472                         ;;
6473     *) dflt="$lddlflags" ;;
6474     esac
6475
6476         : Try to guess additional flags to pick up local libraries.
6477         : Be careful not to append to a plain 'none'
6478         case "$dflt" in
6479         none) dflt='' ;;
6480         esac
6481         for thisflag in $ldflags; do
6482                 case "$thisflag" in
6483                 -L*|-R*)
6484                         case " $dflt " in
6485                         *" $thisflag "*) ;;
6486                         *) dflt="$dflt $thisflag" ;;
6487                         esac
6488                         ;;
6489                 esac
6490         done
6491
6492         case "$dflt" in
6493         ''|' ') dflt='none' ;;
6494         esac
6495
6496     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
6497     . ./myread
6498     case "$ans" in
6499     none) lddlflags=' ' ;;
6500     *) lddlflags="$ans" ;;
6501     esac
6502
6503         cat <<EOM
6504
6505 Some systems may require passing special flags to $cc to indicate that
6506 the resulting executable will use dynamic linking.  To use no flags,
6507 say "none".
6508
6509 EOM
6510     case "$ccdlflags" in
6511     '') case "$osname" in
6512                 hpux)   dflt='-Wl,-E' ;;
6513                 linux)  dflt='-rdynamic' ;;
6514                 next)   dflt='none' ;;
6515                 sunos)  dflt='none' ;;
6516                 *)      dflt='none' ;;
6517             esac ;;
6518     ' ')  dflt='none' ;;
6519     *)  dflt="$ccdlflags" ;;
6520     esac
6521     rp="Any special flags to pass to $cc to use dynamic linking?"
6522     . ./myread
6523     case "$ans" in
6524     none) ccdlflags=' ' ;;
6525     *) ccdlflags="$ans" ;;
6526     esac
6527     ;;
6528 *)  usedl="$undef"
6529         ld='ld'
6530     dlsrc='dl_none.xs'
6531     lddlflags=''
6532     ccdlflags=''
6533     ;;
6534 esac
6535
6536 also=''
6537 case "$usedl" in
6538 $undef)
6539         # No dynamic loading being used, so don't bother even to prompt.
6540         useshrplib='false'
6541         ;;
6542 *)      case "$useshrplib" in
6543         '')     case "$osname" in
6544                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|beos|cygwin*)
6545                         dflt=y
6546                         also='Building a shared libperl is required for dynamic loading to work on your system.'
6547                         ;;
6548                 next*)
6549                         case "$osvers" in
6550                         4*)     dflt=y
6551                                 also='Building a shared libperl is needed for MAB support.'
6552                                 ;;
6553                         *)      dflt=n
6554                                 ;;
6555                         esac
6556                         ;;
6557                 *)      dflt=n
6558                         ;;
6559                 esac
6560                 ;;
6561         $define|true|[Yy]*)
6562                 dflt=y
6563                 ;;
6564         *)      dflt=n
6565                 ;;
6566         esac
6567         $cat << EOM
6568
6569 The perl executable is normally obtained by linking perlmain.c with
6570 libperl${_a}, any static extensions (usually just DynaLoader), and
6571 any other libraries needed on this system (such as -lm, etc.).  Since
6572 your system supports dynamic loading, it is probably possible to build
6573 a shared libperl.$so.  If you will have more than one executable linked
6574 to libperl.$so, this will significantly reduce the size of each
6575 executable, but it may have a noticeable affect on performance.  The
6576 default is probably sensible for your system.
6577 $also
6578
6579 EOM
6580         rp="Build a shared libperl.$so (y/n)"
6581         . ./myread
6582         case "$ans" in
6583         true|$define|[Yy]*)
6584                 useshrplib='true'  ;;
6585         *)      useshrplib='false' ;;
6586         esac
6587         ;;
6588 esac
6589
6590 case "$useshrplib" in
6591 true)
6592         case "$libperl" in
6593         '')
6594                 # Figure out a good name for libperl.so.  Since it gets stored in
6595                 # a version-specific architecture-dependent library, the version
6596                 # number isn't really that important, except for making cc/ld happy.
6597                 #
6598                 # A name such as libperl.so.3.1
6599                 majmin="libperl.$so.$patchlevel.$subversion"
6600                 # A name such as libperl.so.301
6601                 majonly=`echo $patchlevel $subversion |
6602                         $awk '{printf "%d%02d", $1, $2}'`
6603                 majonly=libperl.$so.$majonly
6604                 # I'd prefer to keep the os-specific stuff here to a minimum, and
6605                 # rely on figuring it out from the naming of libc.
6606                 case "${osname}${osvers}" in
6607                 next4*)
6608                         dflt=libperl.5.$so
6609                         # XXX How handle the --version stuff for MAB?
6610                         ;;
6611                 linux*)  # ld won't link with a bare -lperl otherwise.
6612                         dflt=libperl.$so
6613                         ;;
6614                 cygwin*) # include version
6615                         dflt=`echo libperl$version | sed -e 's/\./_/g'`$lib_ext
6616                         ;;
6617                 *)      # Try to guess based on whether libc has major.minor.
6618                         case "$libc" in
6619                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
6620                         *libc.$so.[0-9]*) dflt=$majonly ;;
6621                         *)      dflt=libperl.$so ;;
6622                         esac
6623                         ;;
6624                 esac
6625                 ;;
6626         *)      dflt=$libperl
6627                 ;;
6628         esac
6629         cat << EOM
6630
6631 I need to select a good name for the shared libperl.  If your system uses
6632 library names with major and minor numbers, then you might want something
6633 like $majmin.  Alternatively, if your system uses a single version
6634 number for shared libraries, then you might want to use $majonly.
6635 Or, your system might be quite happy with a simple libperl.$so.
6636
6637 Since the shared libperl will get installed into a version-specific
6638 architecture-dependent directory, the version number of the shared perl
6639 library probably isn't important, so the default should be o.k.
6640
6641 EOM
6642         rp='What name do you want to give to the shared libperl?'
6643         . ./myread
6644         libperl=$ans
6645         echo "Ok, I'll use $libperl"
6646         ;;
6647 *)
6648         libperl="libperl${_a}"
6649         ;;
6650 esac
6651
6652 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
6653 case "$shrpdir" in
6654 '') ;;
6655 *)      $cat >&4 <<EOM
6656 WARNING:  Use of the shrpdir variable for the installation location of
6657 the shared $libperl is not supported.  It was never documented and
6658 will not work in this version.  Let me (perlbug@perl.org)
6659 know of any problems this may cause.
6660
6661 EOM
6662         case "$shrpdir" in
6663         "$archlibexp/CORE")
6664                 $cat >&4 <<EOM
6665 But your current setting of $shrpdir is
6666 the default anyway, so it's harmless.
6667 EOM
6668                 ;;
6669         *)
6670                 $cat >&4 <<EOM
6671 Further, your current attempted setting of $shrpdir
6672 conflicts with the value of $archlibexp/CORE
6673 that installperl will use.
6674 EOM
6675                 ;;
6676         esac
6677         ;;
6678 esac
6679
6680 # How will the perl executable find the installed shared $libperl?
6681 # Add $xxx to ccdlflags.
6682 # If we can't figure out a command-line option, use $shrpenv to
6683 # set env LD_RUN_PATH.  The main perl makefile uses this.
6684 shrpdir=$archlibexp/CORE
6685 xxx=''
6686 tmp_shrpenv=''
6687 if "$useshrplib"; then
6688     case "$osname" in 
6689         aix)
6690                 # We'll set it in Makefile.SH...
6691                 ;;
6692         solaris|netbsd)
6693                 xxx="-R $shrpdir"
6694                 ;;
6695         freebsd)
6696                 xxx="-Wl,-R$shrpdir"
6697                 ;;
6698         linux|irix*|dec_osf)
6699                 xxx="-Wl,-rpath,$shrpdir"
6700                 ;;
6701         next)
6702                 # next doesn't like the default...
6703                 ;;
6704         beos)
6705                 # beos doesn't like the default, either.
6706                 ;;
6707         hpux*)
6708                 # hpux doesn't like the default, either.
6709                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
6710                 ;;
6711         *)
6712                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
6713                 ;;
6714         esac
6715         case "$xxx" in
6716         '') ;;
6717         *)      
6718                 # Only add $xxx if it isn't already in ccdlflags.
6719                 case " $ccdlflags " in
6720                 *" $xxx "*)     ;;
6721                 *)      ccdlflags="$ccdlflags $xxx"
6722                         cat <<EOM >&4
6723
6724 Adding $xxx to the flags
6725 passed to $ld so that the perl executable will find the 
6726 installed shared $libperl.
6727
6728 EOM
6729                         ;;
6730                 esac
6731                 ;;
6732         esac
6733 fi
6734 # Fix ccdlflags in AIX for building external extensions.
6735 # (For building Perl itself bare -bE:perl.exp is needed,
6736 #  Makefile.SH takes care of this.)
6737 case "$osname" in
6738 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
6739 esac
6740 # Respect a hint or command-line value.
6741 case "$shrpenv" in
6742 '') shrpenv="$tmp_shrpenv" ;;
6743 esac
6744 case "$ldlibpthname" in
6745 '')     ldlibpthname=LD_LIBRARY_PATH ;;
6746 none)   ldlibpthname='' ;;
6747 esac
6748
6749 : determine where manual pages are on this system
6750 echo " "
6751 case "$sysman" in
6752 '') 
6753         syspath='/usr/man/man1 /usr/man/mann /usr/man/manl /usr/man/local/man1'
6754         syspath="$syspath /usr/man/u_man/man1 /usr/share/man/man1"
6755         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
6756         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
6757         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
6758         sysman=`./loc . /usr/man/man1 $syspath`
6759         ;;
6760 esac
6761 if $test -d "$sysman"; then
6762         echo "System manual is in $sysman." >&4
6763 else
6764         echo "Could not find manual pages in source form." >&4
6765 fi
6766
6767 : determine where manual pages go
6768 set man1dir man1dir none
6769 eval $prefixit
6770 $cat <<EOM
6771
6772 $spackage has manual pages available in source form.
6773 EOM
6774 case "$nroff" in
6775 nroff)
6776         echo "However, you don't have nroff, so they're probably useless to you."
6777         case "$man1dir" in
6778         '') man1dir="none";;
6779         esac;;
6780 esac
6781 echo "If you don't want the manual sources installed, answer 'none'."
6782 case "$man1dir" in
6783 ' ') dflt=none
6784         ;;
6785 '')
6786         lookpath="$prefixexp/man/man1 $prefixexp/man/l_man/man1"
6787         lookpath="$lookpath $prefixexp/man/p_man/man1"
6788         lookpath="$lookpath $prefixexp/man/u_man/man1"
6789         lookpath="$lookpath $prefixexp/man/man.1"
6790         case "$sysman" in
6791         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
6792         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
6793         esac
6794         set dflt
6795         eval $prefixup
6796         ;;
6797 *)  dflt="$man1dir"
6798         ;;
6799 esac
6800 echo " "
6801 fn=dn+~
6802 rp="Where do the main $spackage manual pages (source) go?"
6803 . ./getfile
6804 if $test "X$man1direxp" != "X$ansexp"; then
6805         installman1dir=''
6806 fi
6807 man1dir="$ans"
6808 man1direxp="$ansexp"
6809 case "$man1dir" in
6810 '')     man1dir=' '
6811         installman1dir='';;
6812 esac
6813
6814 : Change installation prefix, if necessary.
6815 if $test X"$prefix" != X"$installprefix"; then
6816         installman1dir=`echo $man1direxp | $sed "s#^$prefix#$installprefix#"`
6817 else
6818         installman1dir="$man1direxp"
6819 fi
6820
6821 : What suffix to use on installed man pages
6822
6823 case "$man1dir" in
6824 ' ')
6825         man1ext='0'
6826         ;;
6827 *)
6828         rp="What suffix should be used for the main $spackage man pages?"
6829         case "$man1ext" in
6830         '')     case "$man1dir" in
6831                 *1)  dflt=1 ;;
6832                 *1p) dflt=1p ;;
6833                 *1pm) dflt=1pm ;;
6834                 *l) dflt=l;;
6835                 *n) dflt=n;;
6836                 *o) dflt=o;;
6837                 *p) dflt=p;;
6838                 *C) dflt=C;;
6839                 *L) dflt=L;;
6840                 *L1) dflt=L1;;
6841                 *) dflt=1;;
6842                 esac
6843                 ;;
6844         *)      dflt="$man1ext";;
6845         esac
6846         . ./myread
6847         man1ext="$ans"
6848         ;;
6849 esac
6850
6851 : see if we can have long filenames
6852 echo " "
6853 first=123456789abcdef
6854 $rm -f $first
6855 if (echo hi >$first) 2>/dev/null; then
6856         if $test -f 123456789abcde; then
6857                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
6858                 val="$undef"
6859         else
6860                 echo 'You can have filenames longer than 14 characters.'>&4
6861                 val="$define"
6862         fi
6863 else
6864         $cat <<'EOM'
6865 You can't have filenames longer than 14 chars.
6866 You can't even think about them!
6867 EOM
6868         val="$undef"
6869 fi 
6870 set d_flexfnam
6871 eval $setvar
6872 $rm -rf 123456789abcde*
6873
6874 : determine where library module manual pages go
6875 set man3dir man3dir none
6876 eval $prefixit
6877 $cat <<EOM
6878
6879 $spackage has manual pages for many of the library modules.
6880 EOM
6881
6882 case "$nroff" in
6883 nroff)
6884         $cat <<'EOM'
6885 However, you don't have nroff, so they're probably useless to you.
6886 EOM
6887         case "$man3dir" in
6888         '') man3dir="none";;
6889         esac;;
6890 esac
6891
6892 case "$d_flexfnam" in
6893 undef)
6894         $cat <<'EOM'
6895 However, your system can't handle the long file names like File::Basename.3. 
6896 EOM
6897         case "$man3dir" in
6898         '') man3dir="none";;
6899         esac;;
6900 esac
6901
6902 echo "If you don't want the manual sources installed, answer 'none'."
6903 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6904 case "$man3dir" in
6905 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
6906         if $test -d "$privlib/man/man3"; then
6907                 cat <<EOM >&4
6908
6909 WARNING:  Previous versions of perl installed man3 pages into
6910 $privlib/man/man3.  This version will suggest a 
6911 new default of $dflt.  
6912 EOM
6913                 tdflt=$dflt
6914                 dflt='n'
6915                 rp='Do you wish to preserve the old behavior?(y/n)'
6916                 . ./myread
6917                 case "$ans" in
6918                 y*) dflt="$privlib/man/man3" ;;
6919                 *)  dflt=$tdflt ;;
6920                 esac
6921     fi
6922         ;;
6923 *)      dflt="$man3dir" ;;
6924 esac
6925 case "$dflt" in
6926 ' ') dflt=none ;;
6927 esac
6928 echo " "
6929 fn=dn+~
6930 rp="Where do the $package library man pages (source) go?"
6931 . ./getfile
6932 man3dir="$ans"
6933 man3direxp="$ansexp"
6934 case "$man3dir" in
6935 '')     man3dir=' '
6936         installman3dir='';;
6937 esac
6938
6939 : Change installation prefix, if necessary.
6940 if $test X"$prefix" != X"$installprefix"; then
6941         installman3dir=`echo $man3direxp | $sed "s#^$prefix#$installprefix#"`
6942 else
6943         installman3dir="$man3direxp"
6944 fi
6945
6946 : What suffix to use on installed man pages
6947 case "$man3dir" in
6948 ' ')
6949         man3ext='0'
6950         ;;
6951 *)
6952         rp="What suffix should be used for the $package library man pages?"
6953         case "$man3ext" in
6954         '')     case "$man3dir" in
6955                 *3)  dflt=3 ;;
6956                 *3p) dflt=3p ;;
6957                 *3pm) dflt=3pm ;;
6958                 *l) dflt=l;;
6959                 *n) dflt=n;;
6960                 *o) dflt=o;;
6961                 *p) dflt=p;;
6962                 *C) dflt=C;;
6963                 *L) dflt=L;;
6964                 *L3) dflt=L3;;
6965                 *) dflt=3;;
6966                 esac
6967                 ;;
6968         *)      dflt="$man3ext";;
6969         esac
6970         . ./myread
6971         man3ext="$ans"
6972         ;;
6973 esac
6974
6975 : see if we have to deal with yellow pages, now NIS.
6976 if $test -d /usr/etc/yp || $test -d /etc/yp; then
6977         if $test -f /usr/etc/nibindd; then
6978                 echo " "
6979                 echo "I'm fairly confident you're on a NeXT."
6980                 echo " "
6981                 rp='Do you get the hosts file via NetInfo?'
6982                 dflt=y
6983                 case "$hostcat" in
6984                 nidump*) ;;
6985                 '') ;;
6986                 *) dflt=n;;
6987                 esac
6988                 . ./myread
6989                 case "$ans" in
6990                 y*) hostcat='nidump hosts .';;
6991                 *)      case "$hostcat" in
6992                         nidump*) hostcat='';;
6993                         esac
6994                         ;;
6995                 esac
6996         fi
6997         case "$hostcat" in
6998         nidump*) ;;
6999         *)
7000                 case "$hostcat" in
7001                 *ypcat*) dflt=y;;
7002                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
7003                                 dflt=y
7004                         else
7005                                 dflt=n
7006                         fi;;
7007                 *) dflt=n;;
7008                 esac
7009                 echo " "
7010                 rp='Are you getting the hosts file via yellow pages?'
7011                 . ./myread
7012                 case "$ans" in
7013                 y*) hostcat='ypcat hosts';;
7014                 *) hostcat='cat /etc/hosts';;
7015                 esac
7016                 ;;
7017         esac
7018 fi
7019 case "$hostcat" in
7020 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
7021 esac
7022 case "$groupcat" in
7023 '') test -f /etc/group && groupcat='cat /etc/group';;
7024 esac
7025 case "$passcat" in
7026 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
7027 esac
7028
7029 : now get the host name
7030 echo " "
7031 echo "Figuring out host name..." >&4
7032 case "$myhostname" in
7033 '') cont=true
7034         echo 'Maybe "hostname" will work...'
7035         if tans=`sh -c hostname 2>&1` ; then
7036                 myhostname=$tans
7037                 phostname=hostname
7038                 cont=''
7039         fi
7040         ;;
7041 *) cont='';;
7042 esac
7043 if $test "$cont"; then
7044         if ./xenix; then
7045                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
7046                 if tans=`cat /etc/systemid 2>&1` ; then
7047                         myhostname=$tans
7048                         phostname='cat /etc/systemid'
7049                         echo "Whadyaknow.  Xenix always was a bit strange..."
7050                         cont=''
7051                 fi
7052         elif $test -r /etc/systemid; then
7053                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
7054         fi
7055 fi
7056 if $test "$cont"; then
7057         echo 'No, maybe "uuname -l" will work...'
7058         if tans=`sh -c 'uuname -l' 2>&1` ; then
7059                 myhostname=$tans
7060                 phostname='uuname -l'
7061         else
7062                 echo 'Strange.  Maybe "uname -n" will work...'
7063                 if tans=`sh -c 'uname -n' 2>&1` ; then
7064                         myhostname=$tans
7065                         phostname='uname -n'
7066                 else
7067                         echo 'Oh well, maybe I can mine it out of whoami.h...'
7068                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
7069                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
7070                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
7071                         else
7072                                 case "$myhostname" in
7073                                 '') echo "Does this machine have an identity crisis or something?"
7074                                         phostname='';;
7075                                 *)
7076                                         echo "Well, you said $myhostname before..."
7077                                         phostname='echo $myhostname';;
7078                                 esac
7079                         fi
7080                 fi
7081         fi
7082 fi
7083 : you do not want to know about this
7084 set $myhostname
7085 myhostname=$1
7086
7087 : verify guess
7088 if $test "$myhostname" ; then
7089         dflt=y
7090         rp='Your host name appears to be "'$myhostname'".'" Right?"
7091         . ./myread
7092         case "$ans" in
7093         y*) ;;
7094         *) myhostname='';;
7095         esac
7096 fi
7097
7098 : bad guess or no guess
7099 while $test "X$myhostname" = X ; do
7100         dflt=''
7101         rp="Please type the (one word) name of your host:"
7102         . ./myread
7103         myhostname="$ans"
7104 done
7105
7106 : translate upper to lower if necessary
7107 case "$myhostname" in
7108 *[A-Z]*)
7109         echo "(Normalizing case in your host name)"
7110         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
7111         ;;
7112 esac
7113
7114 case "$myhostname" in
7115 *.*)
7116         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
7117         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
7118         echo "(Trimming domain name from host name--host name is now $myhostname)"
7119         ;;
7120 *) case "$mydomain" in
7121         '')
7122                 {
7123                         test "X$hostcat" = "Xypcat hosts" &&
7124                         ypmatch "$myhostname" hosts 2>/dev/null |\
7125                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
7126                         $test -s hosts
7127                 } || {
7128                         test "X$hostcat" != "X" &&
7129                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
7130                                         /[       ]$myhostname[  . ]/p" > hosts
7131                 }
7132                 tmp_re="[       . ]"
7133                 if $test -f hosts; then
7134                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
7135                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
7136                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
7137                                 hosts | $sort | $uniq | \
7138                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
7139                         case `$echo X$dflt` in
7140                         X*\ *)  echo "(Several hosts in the database matched hostname)"
7141                                 dflt=.
7142                                 ;;
7143                         X.) echo "(You do not have fully-qualified names in the hosts database)"
7144                                 ;;
7145                         esac
7146                 else
7147                         echo "(I cannot locate a hosts database anywhere)"
7148                         dflt=.
7149                 fi
7150                 case "$dflt" in
7151                 .)
7152                         tans=`./loc resolv.conf X /etc /usr/etc`
7153                         if $test -f "$tans"; then
7154                                 echo "(Attempting domain name extraction from $tans)"
7155                                 dflt=.`$sed -n -e 's/   / /g' \
7156                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
7157                                   | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
7158                                 case "$dflt" in
7159                                 .) dflt=.`$sed -n -e 's/        / /g' \
7160                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
7161                                      | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
7162                                         ;;
7163                                 esac
7164                         fi
7165                         ;;
7166                 esac
7167                 case "$dflt" in
7168                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
7169                         dflt=.`sh -c domainname 2>/dev/null`
7170                         case "$dflt" in
7171                         '') dflt='.';;
7172                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
7173                         esac
7174                         ;;
7175                 esac
7176                 case "$dflt" in
7177                 .) echo "(Lost all hope -- silly guess then)"
7178                         dflt='.uucp'
7179                         ;;
7180                 esac
7181                 $rm -f hosts
7182                 ;;
7183         *) dflt="$mydomain";;
7184         esac;;
7185 esac
7186 echo " "
7187 rp="What is your domain name?"
7188 . ./myread
7189 tans="$ans"
7190 case "$ans" in
7191 '') ;;
7192 .*) ;;
7193 *) tans=".$tans";;
7194 esac
7195 mydomain="$tans"
7196
7197 : translate upper to lower if necessary
7198 case "$mydomain" in
7199 *[A-Z]*)
7200         echo "(Normalizing case in your domain name)"
7201         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
7202         ;;
7203 esac
7204
7205 : a little sanity check here
7206 case "$phostname" in
7207 '') ;;
7208 *)
7209         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
7210         $myhostname$mydomain|$myhostname) ;;
7211         *)
7212                 case "$phostname" in
7213                 sed*)
7214                         echo "(That doesn't agree with your whoami.h file, by the way.)"
7215                         ;;
7216                 *)
7217                         echo "(That doesn't agree with your $phostname command, by the way.)"
7218                         ;;
7219                 esac
7220         ;;
7221         esac
7222         ;;
7223 esac
7224
7225 $cat <<EOM
7226
7227 I need to get your e-mail address in Internet format if possible, i.e.
7228 something like user@host.domain. Please answer accurately since I have
7229 no easy means to double check it. The default value provided below
7230 is most probably close to reality but may not be valid from outside
7231 your organization...
7232
7233 EOM
7234 cont=x
7235 while test "$cont"; do
7236         case "$cf_email" in
7237         '') dflt="$cf_by@$myhostname$mydomain";;
7238         *) dflt="$cf_email";;
7239         esac
7240         rp='What is your e-mail address?'
7241         . ./myread
7242         cf_email="$ans"
7243         case "$cf_email" in
7244         *@*.*) cont='' ;;
7245         *)
7246                 rp='Address does not look like an Internet one.  Use it anyway?'
7247                 case "$fastread" in
7248                 yes) dflt=y ;;
7249                 *) dflt=n ;;
7250                 esac
7251                 . ./myread
7252                 case "$ans" in
7253                 y*) cont='' ;;
7254                 *) echo " " ;;
7255                 esac
7256                 ;;
7257         esac
7258 done
7259
7260 $cat <<EOM
7261
7262 If you or somebody else will be maintaining perl at your site, please
7263 fill in the correct e-mail address here so that they may be contacted
7264 if necessary. Currently, the "perlbug" program included with perl
7265 will send mail to this address in addition to perlbug@perl.org. You may
7266 enter "none" for no administrator.
7267
7268 EOM
7269 case "$perladmin" in
7270 '') dflt="$cf_email";;
7271 *) dflt="$perladmin";;
7272 esac
7273 rp='Perl administrator e-mail address'
7274 . ./myread
7275 perladmin="$ans"
7276
7277 : determine whether to only install version-specific parts.
7278 echo " "
7279 $cat <<EOM
7280 Do you want to install only the version-specific parts of the perl
7281 distribution?  Usually you do *not* want to do this.
7282 EOM
7283 case "$versiononly" in
7284 "$define"|[Yy]*|true) dflt='y' ;;
7285 *) dflt='n';
7286 esac
7287 rp="Do you want to install only the version-specific parts of perl?"
7288 . ./myread
7289 case "$ans" in
7290 [yY]*)  val="$define";;
7291 *)      val="$undef" ;;
7292 esac
7293 set versiononly
7294 eval $setvar
7295
7296 : figure out how to guarantee perl startup
7297 case "$startperl" in
7298 '')
7299         case "$sharpbang" in
7300         *!)
7301                 $cat <<EOH
7302
7303 I can use the #! construct to start perl on your system. This will
7304 make startup of perl scripts faster, but may cause problems if you
7305 want to share those scripts and perl is not in a standard place
7306 ($binexp/perl) on all your platforms. The alternative is to force
7307 a shell by starting the script with a single ':' character.
7308
7309 EOH
7310                 case "$versiononly" in
7311                 "$define")      dflt="$binexp/perl$version";;  
7312                 *)              dflt="$binexp/perl";;
7313                 esac
7314                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
7315                 . ./myread
7316                 case "$ans" in
7317                 none)   startperl=": # use perl";;
7318                 *)      startperl="#!$ans"
7319                         if $test 30 -lt `echo "$ans" | wc -c`; then
7320                                 $cat >&4 <<EOM
7321
7322 WARNING:  Some systems limit the #! command to 32 characters.
7323 If you experience difficulty running Perl scripts with #!, try
7324 installing Perl in a directory with a shorter pathname.
7325
7326 EOM
7327                         fi ;;
7328                 esac
7329                 ;;
7330         *) startperl=": # use perl"
7331                 ;;
7332         esac
7333         ;;
7334 esac
7335 echo "I'll use $startperl to start perl scripts."
7336
7337 : figure best path for perl in scripts
7338 case "$perlpath" in
7339 '')
7340         perlpath="$binexp/perl"
7341         case "$startperl" in
7342         *!*) ;;
7343         *)
7344                 $cat <<EOH
7345
7346 I will use the "eval 'exec'" idiom to start Perl on your system.
7347 I can use the full path of your Perl binary for this purpose, but
7348 doing so may cause problems if you want to share those scripts and
7349 Perl is not always in a standard place ($binexp/perl).
7350
7351 EOH
7352                 dflt="$binexp/perl"
7353                 rp="What path shall I use in \"eval 'exec'\"?"
7354                 . ./myread
7355                 perlpath="$ans"
7356                 ;;
7357         esac
7358         ;;
7359 esac
7360 case "$startperl" in
7361 *!*)    ;;
7362 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
7363 esac
7364
7365 : determine where public executable scripts go
7366 set scriptdir scriptdir
7367 eval $prefixit
7368 case "$scriptdir" in
7369 '')
7370         dflt="$bin"
7371         : guess some guesses
7372         $test -d /usr/share/scripts && dflt=/usr/share/scripts
7373         $test -d /usr/share/bin     && dflt=/usr/share/bin
7374         $test -d /usr/local/script  && dflt=/usr/local/script
7375         $test -d /usr/local/scripts && dflt=/usr/local/scripts
7376         $test -d $prefixexp/script  && dflt=$prefixexp/script
7377         set dflt
7378         eval $prefixup
7379         ;;
7380 *)  dflt="$scriptdir"
7381         ;;
7382 esac
7383 $cat <<EOM
7384  
7385 Some installations have a separate directory just for executable scripts so
7386 that they can mount it across multiple architectures but keep the scripts in
7387 one spot.  You might, for example, have a subdirectory of /usr/share for this.
7388 Or you might just lump your scripts in with all your other executables.
7389  
7390 EOM
7391 fn=d~
7392 rp='Where do you keep publicly executable scripts?'
7393 . ./getfile
7394 if $test "X$ansexp" != "X$scriptdirexp"; then
7395         installscript=''
7396 fi
7397 scriptdir="$ans"
7398 scriptdirexp="$ansexp"
7399 : Change installation prefix, if necessary.
7400 if $test X"$prefix" != X"$installprefix"; then
7401         installscript=`echo $scriptdirexp | sed "s#^$prefix#$installprefix#"`
7402 else
7403         installscript="$scriptdirexp"
7404 fi
7405
7406 : determine where add-on public executables go
7407 case "$sitebin" in
7408 '')     dflt=$siteprefix/bin ;;
7409 *)      dflt=$sitebin ;;
7410 esac
7411 fn=d~
7412 rp='Pathname where the add-on public executables should be installed?'
7413 . ./getfile
7414 sitebin="$ans"
7415 sitebinexp="$ansexp"
7416 : Change installation prefix, if necessary.
7417 if $test X"$prefix" != X"$installprefix"; then
7418         installsitebin=`echo $sitebinexp | sed "s#^$prefix#$installprefix#"`
7419 else
7420         installsitebin="$sitebinexp"
7421 fi
7422
7423 case "$useperlio" in
7424 $define|true|[yY]*)     dflt='y';;
7425 *) dflt='n';;
7426 esac
7427 cat <<EOM
7428
7429 Previous version of $package used the standard IO mechanisms as defined
7430 in <stdio.h>.  Versions 5.003_02 and later of perl allow alternate IO
7431 mechanisms via a "PerlIO" abstraction, but the stdio mechanism is still
7432 the default.  This abstraction layer can use AT&T's sfio (if you already
7433 have sfio installed) or regular stdio.  Using PerlIO with sfio may cause
7434 problems with some extension modules.  Using PerlIO with stdio is safe,
7435 but it is slower than plain stdio and therefore is not the default.
7436
7437 If this doesn't make any sense to you, just accept the default '$dflt'.
7438 EOM
7439 rp='Use the experimental PerlIO abstraction layer?'
7440 . ./myread
7441 case "$ans" in
7442 y|Y) 
7443         val="$define"
7444         ;;     
7445 *)      
7446         echo "Ok, doing things the stdio way"
7447         val="$undef"
7448         ;;
7449 esac
7450 set useperlio
7451 eval $setvar 
7452
7453 case "$vendorprefix" in
7454 '')     d_vendorbin="$undef"
7455         vendorbin=''
7456         vendorbinexp=''
7457         ;;
7458 *)      d_vendorbin="$define"
7459         : determine where vendor-supplied executables go.
7460         case "$vendorbin" in
7461         '') dflt=$vendorprefix/bin ;;
7462         *)      dflt="$vendorbin" ;;
7463         esac
7464         fn=d~+
7465         rp='Pathname for the vendor-supplied executables directory?'
7466         . ./getfile
7467         vendorbin="$ans"
7468         vendorbinexp="$ansexp"
7469         ;;
7470 esac
7471 : Change installation prefix, if necessary.
7472 if $test X"$prefix" != X"$installprefix"; then
7473         installvendorbin=`echo $vendorbinexp | $sed "s#^$prefix#$installprefix#"`
7474 else
7475         installvendorbin="$vendorbinexp"
7476 fi
7477
7478 : see if qgcvt exists
7479 set qgcvt d_qgcvt
7480 eval $inlibc
7481
7482 echo " "
7483
7484 if $test X"$d_longdbl" = X"$define"; then
7485
7486 echo "Checking how to print long doubles..." >&4
7487
7488 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
7489         $cat >try.c <<'EOCP'
7490 #include <sys/types.h>
7491 #include <stdio.h>
7492 int main() {
7493   double d = 123.456;
7494   printf("%.3f\n", d);
7495 }
7496 EOCP
7497         set try
7498         if eval $compile; then
7499                 yyy=`./try$exe_ext`
7500                 case "$yyy" in
7501                 123.456)
7502                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
7503                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
7504                         echo "We will use %f."
7505                         ;;
7506                 esac
7507         fi
7508 fi
7509
7510 if $test X"$sPRIfldbl" = X; then
7511         $cat >try.c <<'EOCP'
7512 #include <sys/types.h>
7513 #include <stdio.h>
7514 int main() {
7515   long double d = 123.456;
7516   printf("%.3llf\n", d);
7517 }
7518 EOCP
7519         set try
7520         if eval $compile; then
7521                 yyy=`./try$exe_ext`
7522                 case "$yyy" in
7523                 123.456)
7524                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
7525                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
7526                         echo "We will use %llf."
7527                         ;;
7528                 esac
7529         fi
7530 fi
7531
7532 if $test X"$sPRIfldbl" = X; then
7533         $cat >try.c <<'EOCP'
7534 #include <sys/types.h>
7535 #include <stdio.h>
7536 int main() {
7537   long double d = 123.456;
7538   printf("%.3Lf\n", d);
7539 }
7540 EOCP
7541         set try
7542         if eval $compile; then
7543                 yyy=`./try$exe_ext`
7544                 case "$yyy" in
7545                 123.456)
7546                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
7547                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
7548                         echo "We will use %Lf."
7549                         ;;
7550                 esac
7551         fi
7552 fi
7553
7554 if $test X"$sPRIfldbl" = X; then
7555         $cat >try.c <<'EOCP'
7556 #include <sys/types.h>
7557 #include <stdio.h>
7558 int main() {
7559   long double d = 123.456;
7560   printf("%.3lf\n", d);
7561 }
7562 EOCP
7563         set try
7564         if eval $compile; then
7565                 yyy=`./try$exe_ext`
7566                 case "$yyy" in
7567                 123.456)
7568                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
7569                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
7570                         echo "We will use %lf."
7571                         ;;
7572                 esac
7573         fi
7574 fi
7575
7576 if $test X"$sPRIfldbl" = X; then
7577         echo "Cannot figure out how to print long doubles." >&4
7578 else
7579         sSCNfldbl=$sPRIfldbl    # expect consistency
7580 fi
7581
7582 $rm -f try try.*
7583
7584 fi # d_longdbl
7585
7586 case "$sPRIfldbl" in
7587 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef"; 
7588         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef"; 
7589         d_SCNfldbl="$undef";
7590         ;;
7591 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define"; 
7592         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define"; 
7593         d_SCNfldbl="$define";
7594         ;;
7595 esac
7596
7597 : Check how to convert floats to strings.
7598 echo " "
7599 echo "Checking for an efficient way to convert floats to strings."
7600 echo " " > try.c
7601 case "$uselongdouble" in
7602 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
7603 esac
7604 case "$d_longdbl" in
7605 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
7606 esac
7607 case "$d_PRIgldbl" in
7608 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
7609 esac
7610 $cat >>try.c <<EOP
7611 #ifdef TRY_gconvert
7612 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
7613 char *myname = "gconvert";
7614 #endif
7615 #ifdef TRY_gcvt
7616 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
7617 char *myname = "gcvt";
7618 #endif
7619 #ifdef TRY_qgcvt
7620 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
7621 char *myname = "qgcvt";
7622 #define DOUBLETYPE long double
7623 #endif
7624 #ifdef TRY_sprintf
7625 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE) && defined(HAS_PRIgldbl)
7626 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
7627 #else
7628 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
7629 #endif
7630 char *myname = "sprintf";
7631 #endif
7632
7633 #ifndef DOUBLETYPE
7634 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
7635 #define DOUBLETYPE long double
7636 #else
7637 #define DOUBLETYPE double
7638 #endif
7639 #endif
7640
7641 #include <stdio.h>
7642
7643 #define I_STDLIB $i_stdlib
7644 #ifdef I_STDLIB
7645 #include <stdlib.h>
7646 #endif
7647
7648 int
7649 checkit(expect, got)
7650 char *expect;
7651 char *got;
7652 {
7653     if (strcmp(expect, got)) {
7654                 printf("%s oddity:  Expected %s, got %s\n",
7655                         myname, expect, got);
7656                 exit(1);
7657         }
7658 }
7659
7660 int main()
7661
7662         char buf[64]; 
7663         buf[63] = '\0';
7664
7665         /* This must be 1st test on (which?) platform */
7666         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
7667         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
7668         checkit("0.1", buf);
7669
7670         Gconvert((DOUBLETYPE)1.0, 8, 0, buf); 
7671         checkit("1", buf);
7672
7673         Gconvert((DOUBLETYPE)1.1, 8, 0, buf); 
7674         checkit("1.1", buf);
7675
7676         Gconvert((DOUBLETYPE)1.01, 8, 0, buf); 
7677         checkit("1.01", buf);
7678
7679         Gconvert((DOUBLETYPE)1.001, 8, 0, buf); 
7680         checkit("1.001", buf);
7681
7682         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf); 
7683         checkit("1.0001", buf);
7684
7685         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf); 
7686         checkit("1.00001", buf);
7687
7688         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf); 
7689         checkit("1.000001", buf);
7690
7691         Gconvert((DOUBLETYPE)0.0, 8, 0, buf); 
7692         checkit("0", buf);
7693
7694         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf); 
7695         checkit("-1", buf);
7696
7697         /* Some Linux gcvt's give 1.e+5 here. */
7698         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf); 
7699         checkit("100000", buf);
7700         
7701         /* Some Linux gcvt's give -1.e+5 here. */
7702         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf); 
7703         checkit("-100000", buf);
7704
7705         Gconvert((DOUBLETYPE)123.456, 8, 0, buf); 
7706         checkit("123.456", buf);
7707
7708         exit(0);
7709 }
7710 EOP
7711 case "$d_Gconvert" in
7712 gconvert*) xxx_list='gconvert gcvt sprintf' ;;
7713 gcvt*) xxx_list='gcvt gconvert sprintf' ;;
7714 sprintf*) xxx_list='sprintf gconvert gcvt' ;;
7715 *) xxx_list='gconvert gcvt sprintf' ;;
7716 esac
7717
7718 case "$d_longdbl$uselongdouble$d_PRIgldbl" in
7719 "$define$define$define")
7720     # for long doubles prefer first qgcvt, then sprintf
7721     xxx_list="`echo $xxx_list|sed s/sprintf//`" 
7722     xxx_list="sprintf $xxx_list"
7723     case "$d_qgcvt" in
7724     "$define") xxx_list="qgcvt $xxx_list" ;;
7725     esac
7726     ;;
7727 esac
7728
7729 for xxx_convert in $xxx_list; do
7730         echo "Trying $xxx_convert..."
7731         $rm -f try try$_o
7732         set try -DTRY_$xxx_convert
7733         if eval $compile; then
7734                 echo "$xxx_convert() found." >&4
7735                 if ./try; then
7736                         echo "I'll use $xxx_convert to convert floats into a string." >&4
7737                         break;
7738                 else
7739                         echo "...But $xxx_convert didn't work as I expected."
7740                 fi
7741         else
7742                 echo "$xxx_convert NOT found." >&4
7743         fi
7744 done
7745         
7746 case "$xxx_convert" in
7747 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
7748 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
7749 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
7750 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
7751    "$define$define$define")
7752       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
7753    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
7754    esac
7755    ;;  
7756 esac
7757
7758 : see if _fwalk exists
7759 set fwalk d__fwalk
7760 eval $inlibc
7761
7762 : Initialize h_fcntl
7763 h_fcntl=false
7764
7765 : Initialize h_sysfile
7766 h_sysfile=false
7767
7768 : access call always available on UNIX
7769 set access d_access
7770 eval $inlibc
7771
7772 : locate the flags for 'access()'
7773 case "$d_access" in
7774 "$define")
7775         echo " "
7776         $cat >access.c <<'EOCP'
7777 #include <sys/types.h>
7778 #ifdef I_FCNTL
7779 #include <fcntl.h>
7780 #endif
7781 #ifdef I_SYS_FILE
7782 #include <sys/file.h>
7783 #endif
7784 #ifdef I_UNISTD
7785 #include <unistd.h>
7786 #endif
7787 int main() {
7788         exit(R_OK);
7789 }
7790 EOCP
7791         : check sys/file.h first, no particular reason here
7792         if $test `./findhdr sys/file.h` && \
7793                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
7794                 h_sysfile=true;
7795                 echo "<sys/file.h> defines the *_OK access constants." >&4
7796         elif $test `./findhdr fcntl.h` && \
7797                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
7798                 h_fcntl=true;
7799                 echo "<fcntl.h> defines the *_OK access constants." >&4
7800         elif $test `./findhdr unistd.h` && \
7801                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
7802                 echo "<unistd.h> defines the *_OK access constants." >&4
7803         else
7804                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
7805         fi
7806         ;;
7807 esac
7808 $rm -f access*
7809
7810 : see if accessx exists
7811 set accessx d_accessx
7812 eval $inlibc
7813
7814 : see if alarm exists
7815 set alarm d_alarm
7816 eval $inlibc
7817
7818 : see if atolf exists
7819 set atolf d_atolf
7820 eval $inlibc
7821
7822 : see if atoll exists
7823 set atoll d_atoll
7824 eval $inlibc
7825
7826 : Look for GNU-cc style attribute checking
7827 echo " "
7828 echo "Checking whether your compiler can handle __attribute__ ..." >&4
7829 $cat >attrib.c <<'EOCP'
7830 #include <stdio.h>
7831 void croak (char* pat,...) __attribute__((format(printf,1,2),noreturn));
7832 EOCP
7833 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
7834         if $contains 'warning' attrib.out >/dev/null 2>&1; then
7835                 echo "Your C compiler doesn't fully support __attribute__."
7836                 val="$undef"
7837         else
7838                 echo "Your C compiler supports __attribute__."
7839                 val="$define"
7840         fi
7841 else
7842         echo "Your C compiler doesn't seem to understand __attribute__ at all."
7843         val="$undef"
7844 fi
7845 set d_attribut
7846 eval $setvar
7847 $rm -f attrib*
7848
7849 : see if bcmp exists
7850 set bcmp d_bcmp
7851 eval $inlibc
7852
7853 : see if bcopy exists
7854 set bcopy d_bcopy
7855 eval $inlibc
7856
7857 : see if this is a unistd.h system
7858 set unistd.h i_unistd
7859 eval $inhdr
7860
7861 : see if getpgrp exists
7862 set getpgrp d_getpgrp
7863 eval $inlibc
7864
7865 case "$d_getpgrp" in
7866 "$define")
7867         echo " "
7868         echo "Checking to see which flavor of getpgrp is in use..."
7869         $cat >set.c <<EOP
7870 #$i_unistd I_UNISTD
7871 #include <sys/types.h>
7872 #ifdef I_UNISTD
7873 #  include <unistd.h>
7874 #endif
7875 int main()
7876 {
7877         if (getuid() == 0) {
7878                 printf("(I see you are running Configure as super-user...)\n");
7879                 setuid(1);
7880         }
7881 #ifdef TRY_BSD_PGRP
7882         if (getpgrp(1) == 0)
7883                 exit(0);
7884 #else
7885         if (getpgrp() > 0)
7886                 exit(0);
7887 #endif
7888         exit(1);
7889 }
7890 EOP
7891         if $cc -o set -DTRY_BSD_PGRP $ccflags $ldflags set.c $libs >/dev/null 2>&1 && ./set; then
7892                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
7893                 val="$define"
7894         elif $cc -o set $ccflags $ldflags set.c $libs >/dev/null 2>&1 && ./set; then
7895                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
7896                 val="$undef"
7897         else
7898                 echo "I can't seem to compile and run the test program."
7899                 if ./usg; then
7900                         xxx="a USG one, i.e. you use getpgrp()."
7901                 else
7902                         # SVR4 systems can appear rather BSD-ish.
7903                         case "$i_unistd" in
7904                         $undef)
7905                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
7906                                 val="$define"
7907                                 ;;
7908                         $define)
7909                                 xxx="probably a USG one, i.e. you use getpgrp()."
7910                                 val="$undef"
7911                                 ;;
7912                         esac
7913                 fi
7914                 echo "Assuming your getpgrp is $xxx" >&4
7915         fi
7916         ;;
7917 *) val="$undef";;
7918 esac
7919 set d_bsdgetpgrp
7920 eval $setvar
7921 $rm -f set set.c
7922
7923 : see if setpgrp exists
7924 set setpgrp d_setpgrp
7925 eval $inlibc
7926
7927 case "$d_setpgrp" in
7928 "$define")
7929         echo " "
7930         echo "Checking to see which flavor of setpgrp is in use..."
7931         $cat >set.c <<EOP
7932 #$i_unistd I_UNISTD
7933 #include <sys/types.h>
7934 #ifdef I_UNISTD
7935 #  include <unistd.h>
7936 #endif
7937 int main()
7938 {
7939         if (getuid() == 0) {
7940                 printf("(I see you are running Configure as super-user...)\n");
7941                 setuid(1);
7942         }
7943 #ifdef TRY_BSD_PGRP
7944         if (-1 == setpgrp(1, 1))
7945                 exit(0);
7946 #else
7947         if (setpgrp() != -1)
7948                 exit(0);
7949 #endif
7950         exit(1);
7951 }
7952 EOP
7953         if $cc -o set -DTRY_BSD_PGRP $ccflags $ldflags set.c $libs >/dev/null 2>&1 && ./set; then
7954                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
7955                 val="$define"
7956         elif $cc -o set $ccflags $ldflags set.c $libs >/dev/null 2>&1 && ./set; then
7957                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
7958                 val="$undef"
7959         else
7960                 echo "(I can't seem to compile and run the test program.)"
7961                 if ./usg; then
7962                         xxx="a USG one, i.e. you use setpgrp()."
7963                 else
7964                         # SVR4 systems can appear rather BSD-ish.
7965                         case "$i_unistd" in
7966                         $undef)
7967                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
7968                                 val="$define"
7969                                 ;;
7970                         $define)
7971                                 xxx="probably a USG one, i.e. you use setpgrp()."
7972                                 val="$undef"
7973                                 ;;
7974                         esac
7975                 fi
7976                 echo "Assuming your setpgrp is $xxx" >&4
7977         fi
7978         ;;
7979 *) val="$undef";;
7980 esac
7981 set d_bsdsetpgrp
7982 eval $setvar
7983 $rm -f set set.c
7984 : see if bzero exists
7985 set bzero d_bzero
7986 eval $inlibc
7987
7988 : see if signal is declared as pointer to function returning int or void
7989 echo " "
7990 xxx=`./findhdr signal.h`
7991 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
7992 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
7993         echo "You have int (*signal())() instead of void." >&4
7994         val="$undef"
7995 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
7996         echo "You have void (*signal())()." >&4
7997         val="$define"
7998 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
7999         echo "You have int (*signal())() instead of void." >&4
8000         val="$undef"
8001 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
8002         echo "You have void (*signal())()." >&4
8003         val="$define"
8004 else
8005         case "$d_voidsig" in
8006         '')
8007         echo "I can't determine whether signal handler returns void or int..." >&4
8008                 dflt=void
8009                 rp="What type does your signal handler return?"
8010                 . ./myread
8011                 case "$ans" in
8012                 v*) val="$define";;
8013                 *) val="$undef";;
8014                 esac;;
8015         "$define")
8016                 echo "As you already told me, signal handler returns void." >&4
8017                 val="$define"
8018                 ;;
8019         *)      echo "As you already told me, signal handler returns int." >&4
8020                 val="$undef"
8021                 ;;
8022         esac
8023 fi
8024 set d_voidsig
8025 eval $setvar
8026 case "$d_voidsig" in
8027 "$define") signal_t="void";;
8028 *) signal_t="int";;
8029 esac
8030 $rm -f $$.tmp
8031
8032 : check for ability to cast large floats to 32-bit ints.
8033 echo " "
8034 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
8035 if $test "$intsize" -ge 4; then
8036         xxx=int
8037 else
8038         xxx=long
8039 fi
8040 $cat >try.c <<EOCP
8041 #include <stdio.h>
8042 #include <sys/types.h>
8043 #include <signal.h>
8044 $signal_t blech(s) int s; { exit(3); }
8045 int main()
8046 {
8047         $xxx i32;
8048         double f, g;
8049         int result = 0;
8050         char str[16];
8051         signal(SIGFPE, blech);
8052
8053         /* Don't let compiler optimize the test away.  Store the number 
8054            in a writable string for gcc to pass to sscanf under HP/UX.
8055         */
8056         sprintf(str, "2147483647");
8057         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
8058         g = 10 * f;
8059         i32  = ($xxx) g;
8060
8061         /* x86 processors will probably give 0x8000 0000, which is a
8062        sign change.  We don't want that.  We want to mimic SPARC
8063            behavior here, which is to preserve the sign and give
8064            back 0x7fff ffff.
8065         */
8066         if (i32 != ($xxx) f)
8067                 result |= 1;
8068         exit(result);
8069 }
8070 EOCP
8071 set try
8072 if eval $compile_ok; then
8073         ./try
8074         yyy=$?
8075 else
8076         echo "(I can't seem to compile the test program--assuming it can't)"
8077         yyy=1
8078 fi
8079 case "$yyy" in
8080 0)      val="$define"
8081         echo "Yup, it can."
8082         ;;
8083 *)      val="$undef"
8084         echo "Nope, it can't."
8085         ;;
8086 esac
8087 set d_casti32
8088 eval $setvar
8089 $rm -f try try.*
8090
8091 : check for ability to cast negative floats to unsigned
8092 echo " "
8093 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
8094 $cat >try.c <<EOCP
8095 #include <stdio.h>
8096 #include <sys/types.h>
8097 #include <signal.h>
8098 $signal_t blech(s) int s; { exit(7); }
8099 $signal_t blech_in_list(s) int s; { exit(4); }
8100 unsigned long dummy_long(p) unsigned long p; { return p; }
8101 unsigned int dummy_int(p) unsigned int p; { return p; }
8102 unsigned short dummy_short(p) unsigned short p; { return p; }
8103 int main()
8104 {
8105         double f;
8106         unsigned long along;
8107         unsigned int aint;
8108         unsigned short ashort;
8109         int result = 0;
8110         char str[16];
8111         
8112         /* Frustrate gcc-2.7.2's optimizer which failed this test with
8113            a direct f = -123. assignment.  gcc-2.8.0 reportedly
8114            optimized the whole file away
8115         */
8116         /* Store the number in a writable string for gcc to pass to 
8117            sscanf under HP/UX.
8118         */
8119         sprintf(str, "-123");
8120         sscanf(str, "%lf", &f);  /* f = -123.; */
8121
8122         signal(SIGFPE, blech);
8123         along = (unsigned long)f;
8124         aint = (unsigned int)f;
8125         ashort = (unsigned short)f;
8126         if (along != (unsigned long)-123)
8127                 result |= 1;
8128         if (aint != (unsigned int)-123)
8129                 result |= 1;
8130         if (ashort != (unsigned short)-123)
8131                 result |= 1;
8132         sprintf(str, "1073741824.");
8133         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
8134         f = f + f;
8135         along = 0;
8136         along = (unsigned long)f;
8137         if (along != 0x80000000)
8138                 result |= 2;
8139         f -= 1.;
8140         along = 0;
8141         along = (unsigned long)f;
8142         if (along != 0x7fffffff)
8143                 result |= 1;
8144         f += 2.;
8145         along = 0;
8146         along = (unsigned long)f;
8147         if (along != 0x80000001)
8148                 result |= 2;
8149         if (result)
8150                 exit(result);
8151         signal(SIGFPE, blech_in_list);
8152         sprintf(str, "123.");
8153         sscanf(str, "%lf", &f);  /* f = 123.; */
8154         along = dummy_long((unsigned long)f);
8155         aint = dummy_int((unsigned int)f);
8156         ashort = dummy_short((unsigned short)f);
8157         if (along != (unsigned long)123)
8158                 result |= 4;
8159         if (aint != (unsigned int)123)
8160                 result |= 4;
8161         if (ashort != (unsigned short)123)
8162                 result |= 4;
8163         exit(result);
8164
8165 }
8166 EOCP
8167 set try
8168 if eval $compile_ok; then
8169         ./try
8170         castflags=$?
8171 else
8172         echo "(I can't seem to compile the test program--assuming it can't)"
8173         castflags=7
8174 fi
8175 case "$castflags" in
8176 0)      val="$define"
8177         echo "Yup, it can."
8178         ;;
8179 *)      val="$undef"
8180         echo "Nope, it can't."
8181         ;;
8182 esac
8183 set d_castneg
8184 eval $setvar
8185 $rm -f try.*
8186
8187 : see if vprintf exists
8188 echo " "
8189 if set vprintf val -f d_vprintf; eval $csym; $val; then
8190         echo 'vprintf() found.' >&4
8191         val="$define"
8192         $cat >vprintf.c <<'EOF'
8193 #include <varargs.h>
8194
8195 int main() { xxx("foo"); }
8196
8197 xxx(va_alist)
8198 va_dcl
8199 {
8200         va_list args;
8201         char buf[10];
8202
8203         va_start(args);
8204         exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
8205 }
8206 EOF
8207         set vprintf
8208         if eval $compile && ./vprintf; then
8209                 echo "Your vsprintf() returns (int)." >&4
8210                 val2="$undef"
8211         else
8212                 echo "Your vsprintf() returns (char*)." >&4
8213                 val2="$define"
8214         fi
8215 else
8216         echo 'vprintf() NOT found.' >&4
8217                 val="$undef"
8218                 val2="$undef"
8219 fi
8220 set d_vprintf
8221 eval $setvar
8222 val=$val2
8223 set d_charvspr
8224 eval $setvar
8225
8226 : see if chown exists
8227 set chown d_chown
8228 eval $inlibc
8229
8230 : see if chroot exists
8231 set chroot d_chroot
8232 eval $inlibc
8233
8234 : see if chsize exists
8235 set chsize d_chsize
8236 eval $inlibc
8237
8238 : check for const keyword
8239 echo " "
8240 echo 'Checking to see if your C compiler knows about "const"...' >&4
8241 $cat >const.c <<'EOCP'
8242 typedef struct spug { int drokk; } spug;
8243 int main()
8244 {
8245         const char *foo;
8246         const spug y;
8247 }
8248 EOCP
8249 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
8250         val="$define"
8251         echo "Yup, it does."
8252 else
8253         val="$undef"
8254         echo "Nope, it doesn't."
8255 fi
8256 set d_const
8257 eval $setvar
8258
8259 : see if crypt exists
8260 echo " "
8261 if set crypt val -f d_crypt; eval $csym; $val; then
8262         echo 'crypt() found.' >&4
8263         val="$define"
8264         cryptlib=''
8265 else
8266         cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
8267         if $test -z "$cryptlib"; then
8268                 cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
8269         else
8270                 cryptlib=-lcrypt
8271         fi
8272         if $test -z "$cryptlib"; then
8273                 cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
8274         else
8275                 cryptlib=-lcrypt
8276         fi
8277         if $test -z "$cryptlib"; then
8278                 cryptlib=`./loc libcrypt$_a "" $libpth`
8279         else
8280                 cryptlib=-lcrypt
8281         fi
8282         if $test -z "$cryptlib"; then
8283                 echo 'crypt() NOT found.' >&4
8284                 val="$undef"
8285         else
8286                 val="$define"
8287         fi
8288 fi
8289 set d_crypt
8290 eval $setvar
8291
8292 : get csh whereabouts
8293 case "$csh" in
8294 'csh') val="$undef" ;;
8295 *) val="$define" ;;
8296 esac
8297 set d_csh
8298 eval $setvar
8299 : Respect a hint or command line value for full_csh.
8300 case "$full_csh" in
8301 '') full_csh=$csh ;;
8302 esac
8303
8304 : see if cuserid exists
8305 set cuserid d_cuserid
8306 eval $inlibc
8307
8308 : see if this is a limits.h system
8309 set limits.h i_limits
8310 eval $inhdr
8311
8312 : see if this is a float.h system
8313 set float.h i_float
8314 eval $inhdr
8315
8316 : See if number of significant digits in a double precision number is known
8317 echo " "
8318 $cat >dbl_dig.c <<EOM
8319 #$i_limits I_LIMITS
8320 #$i_float I_FLOAT
8321 #ifdef I_LIMITS
8322 #include <limits.h>
8323 #endif
8324 #ifdef I_FLOAT
8325 #include <float.h>
8326 #endif
8327 #ifdef DBL_DIG
8328 printf("Contains DBL_DIG");
8329 #endif
8330 EOM
8331 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
8332 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
8333         echo "DBL_DIG found." >&4
8334         val="$define"
8335 else
8336         echo "DBL_DIG NOT found." >&4
8337         val="$undef"
8338 fi
8339 $rm -f dbl_dig.?
8340 set d_dbl_dig
8341 eval $setvar
8342
8343 : see if difftime exists
8344 set difftime d_difftime
8345 eval $inlibc
8346
8347 : see if this is a dirent system
8348 echo " "
8349 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
8350         val="$define"
8351         echo "<dirent.h> found." >&4
8352 else
8353         val="$undef"
8354         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
8355                 echo "<sys/dir.h> found." >&4
8356                 echo " "
8357         else
8358                 xinc=`./findhdr sys/ndir.h`
8359         fi
8360         echo "<dirent.h> NOT found." >&4
8361 fi
8362 set i_dirent
8363 eval $setvar
8364
8365 : Look for type of directory structure.
8366 echo " "
8367 $cppstdin $cppflags $cppminus < "$xinc" > try.c
8368
8369 case "$direntrytype" in
8370 ''|' ')
8371         case "$i_dirent" in
8372         $define) guess1='struct dirent' ;;
8373         *) guess1='struct direct'  ;;
8374         esac
8375         ;;
8376 *)      guess1="$direntrytype"
8377         ;;
8378 esac
8379
8380 case "$guess1" in
8381 'struct dirent') guess2='struct direct' ;;
8382 *) guess2='struct dirent' ;;
8383 esac
8384                 
8385 if $contains "$guess1" try.c >/dev/null 2>&1; then
8386         direntrytype="$guess1"
8387         echo "Your directory entries are $direntrytype." >&4
8388 elif $contains "$guess2" try.c >/dev/null 2>&1; then
8389         direntrytype="$guess2"
8390         echo "Your directory entries seem to be $direntrytype." >&4
8391 else
8392         echo "I don't recognize your system's directory entries." >&4
8393         rp="What type is used for directory entries on this system?"
8394         dflt="$guess1"
8395         . ./myread
8396         direntrytype="$ans"
8397 fi
8398 $rm -f try.c
8399
8400
8401 : see if the directory entry stores field length
8402 echo " "
8403 $cppstdin $cppflags $cppminus < "$xinc" > try.c
8404 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
8405         echo "Good, your directory entry keeps length information in d_namlen." >&4
8406         val="$define"
8407 else
8408         echo "Your directory entry does not know about the d_namlen field." >&4
8409         val="$undef"
8410 fi
8411 set d_dirnamlen
8412 eval $setvar
8413 $rm -f try.c
8414
8415 : see if dlerror exists
8416 xxx_runnm="$runnm"
8417 runnm=false
8418 set dlerror d_dlerror
8419 eval $inlibc
8420 runnm="$xxx_runnm"
8421
8422 : see if dlfcn is available
8423 set dlfcn.h i_dlfcn
8424 eval $inhdr
8425
8426 case "$usedl" in
8427 $define|y|true)
8428         $cat << EOM
8429
8430 On a few systems, the dynamically loaded modules that perl generates and uses
8431 will need a different extension than shared libs. The default will probably
8432 be appropriate.
8433
8434 EOM
8435         case "$dlext" in
8436         '')     dflt="$so" ;;
8437         *)      dflt="$dlext" ;;
8438         esac
8439         rp='What is the extension of dynamically loaded modules'
8440         . ./myread
8441         dlext="$ans"
8442         ;;
8443 *)
8444         dlext="none"
8445         ;;
8446 esac
8447
8448 : Check if dlsym need a leading underscore
8449 echo " "
8450 val="$undef"
8451
8452 case "$dlsrc" in
8453 dl_dlopen.xs)
8454         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
8455         $cat >dyna.c <<'EOM'
8456 fred () { }
8457 EOM
8458
8459 $cat >fred.c<<EOM
8460
8461 #include <stdio.h>
8462 #$i_dlfcn I_DLFCN
8463 #ifdef I_DLFCN
8464 #include <dlfcn.h>      /* the dynamic linker include file for Sunos/Solaris */
8465 #else
8466 #include <sys/types.h>
8467 #include <nlist.h>
8468 #include <link.h>
8469 #endif
8470
8471 extern int fred() ;
8472
8473 int main()
8474 {
8475     void * handle ;
8476     void * symbol ;
8477 #ifndef RTLD_LAZY
8478     int mode = 1 ;
8479 #else
8480     int mode = RTLD_LAZY ;
8481 #endif
8482     handle = dlopen("./dyna.$dlext", mode) ;
8483     if (handle == NULL) {
8484         printf ("1\n") ;
8485         fflush (stdout) ;
8486         exit(0);
8487     }
8488     symbol = dlsym(handle, "fred") ;
8489     if (symbol == NULL) {
8490         /* try putting a leading underscore */
8491         symbol = dlsym(handle, "_fred") ;
8492         if (symbol == NULL) {
8493             printf ("2\n") ;
8494             fflush (stdout) ;
8495             exit(0);
8496         }
8497         printf ("3\n") ;
8498     }
8499     else
8500         printf ("4\n") ;
8501     fflush (stdout) ;
8502     exit(0);
8503 }
8504 EOM
8505         : Call the object file tmp-dyna.o in case dlext=o.
8506         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 && 
8507                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 && 
8508                 $ld -o dyna.$dlext $lddlflags tmp-dyna${_o} > /dev/null 2>&1 && 
8509                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1; then
8510                 xxx=`./fred`
8511                 case $xxx in
8512                 1)      echo "Test program failed using dlopen." >&4
8513                         echo "Perhaps you should not use dynamic loading." >&4;;
8514                 2)      echo "Test program failed using dlsym." >&4
8515                         echo "Perhaps you should not use dynamic loading." >&4;;
8516                 3)      echo "dlsym needs a leading underscore" >&4
8517                         val="$define" ;;
8518                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
8519                 esac
8520         else
8521                 echo "I can't compile and run the test program." >&4
8522                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
8523         fi
8524         ;;
8525 esac
8526                 
8527 $rm -f fred fred.? dyna.$dlext dyna.? tmp-dyna.?
8528
8529 set d_dlsymun
8530 eval $setvar
8531
8532 hasproto='varname=$1; func=$2; shift; shift;
8533 while $test $# -ge 2; do
8534         case "$1" in
8535         $define) echo "#include <$2>";;
8536         esac ;
8537     shift 2;
8538 done > try.c;
8539 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
8540 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
8541         echo "$func() prototype found.";
8542         val="$define";
8543 else
8544         echo "$func() prototype NOT found.";
8545         val="$undef";
8546 fi;
8547 set $varname;
8548 eval $setvar;
8549 $rm -f try.c tryout.c'
8550
8551 : see if prototype for drand48 is available
8552 echo " "
8553 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
8554 eval $hasproto
8555
8556 : see if dup2 exists
8557 set dup2 d_dup2
8558 eval $inlibc
8559
8560 : see if eaccess exists
8561 set eaccess d_eaccess
8562 eval $inlibc
8563
8564 : see if endgrent exists
8565 set endgrent d_endgrent
8566 eval $inlibc
8567
8568 : see if endhostent exists
8569 set endhostent d_endhent
8570 eval $inlibc
8571
8572 : see if endnetent exists
8573 set endnetent d_endnent
8574 eval $inlibc
8575
8576 : see if endprotoent exists
8577 set endprotoent d_endpent
8578 eval $inlibc
8579
8580 : see if endpwent exists
8581 set endpwent d_endpwent
8582 eval $inlibc
8583
8584 : see if endservent exists
8585 set endservent d_endsent
8586 eval $inlibc
8587
8588 : Locate the flags for 'open()'
8589 echo " "
8590 $cat >open3.c <<'EOCP'
8591 #include <sys/types.h>
8592 #ifdef I_FCNTL
8593 #include <fcntl.h>
8594 #endif
8595 #ifdef I_SYS_FILE
8596 #include <sys/file.h>
8597 #endif
8598 int main() {
8599         if(O_RDONLY);
8600 #ifdef O_TRUNC
8601         exit(0);
8602 #else
8603         exit(1);
8604 #endif
8605 }
8606 EOCP
8607 : check sys/file.h first to get FREAD on Sun
8608 if $test `./findhdr sys/file.h` && \
8609                 set open3 -DI_SYS_FILE && eval $compile; then
8610         h_sysfile=true;
8611         echo "<sys/file.h> defines the O_* constants..." >&4
8612         if ./open3; then
8613                 echo "and you have the 3 argument form of open()." >&4
8614                 val="$define"
8615         else
8616                 echo "but not the 3 argument form of open().  Oh, well." >&4
8617                 val="$undef"
8618         fi
8619 elif $test `./findhdr fcntl.h` && \
8620                 set open3 -DI_FCNTL && eval $compile; then
8621         h_fcntl=true;
8622         echo "<fcntl.h> defines the O_* constants..." >&4
8623         if ./open3; then
8624                 echo "and you have the 3 argument form of open()." >&4
8625                 val="$define"
8626         else
8627                 echo "but not the 3 argument form of open().  Oh, well." >&4
8628                 val="$undef"
8629         fi
8630 else
8631         val="$undef"
8632         echo "I can't find the O_* constant definitions!  You got problems." >&4
8633 fi
8634 set d_open3
8635 eval $setvar
8636 $rm -f open3*
8637
8638 : see which of string.h or strings.h is needed
8639 echo " "
8640 strings=`./findhdr string.h`
8641 if $test "$strings" && $test -r "$strings"; then
8642         echo "Using <string.h> instead of <strings.h>." >&4
8643         val="$define"
8644 else
8645         val="$undef"
8646         strings=`./findhdr strings.h`
8647         if $test "$strings" && $test -r "$strings"; then
8648                 echo "Using <strings.h> instead of <string.h>." >&4
8649         else
8650                 echo "No string header found -- You'll surely have problems." >&4
8651         fi
8652 fi
8653 set i_string
8654 eval $setvar
8655 case "$i_string" in
8656 "$undef") strings=`./findhdr strings.h`;;
8657 *)        strings=`./findhdr string.h`;;
8658 esac
8659
8660 : check for non-blocking I/O stuff
8661 case "$h_sysfile" in
8662 true) echo "#include <sys/file.h>" > head.c;;
8663 *)
8664         case "$h_fcntl" in
8665         true) echo "#include <fcntl.h>" > head.c;;
8666         *) echo "#include <sys/fcntl.h>" > head.c;;
8667         esac
8668         ;;
8669 esac
8670 echo " "
8671 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
8672 case "$o_nonblock" in
8673 '')
8674         $cat head.c > try.c
8675         $cat >>try.c <<'EOCP'
8676 #include <stdio.h>
8677 int main() {
8678 #ifdef O_NONBLOCK
8679         printf("O_NONBLOCK\n");
8680         exit(0);
8681 #endif
8682 #ifdef O_NDELAY
8683         printf("O_NDELAY\n");
8684         exit(0);
8685 #endif
8686 #ifdef FNDELAY
8687         printf("FNDELAY\n");
8688         exit(0);
8689 #endif
8690         exit(0);
8691 }
8692 EOCP
8693         set try
8694         if eval $compile_ok; then
8695                 o_nonblock=`./try`
8696                 case "$o_nonblock" in
8697                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
8698                 *) echo "Seems like we can use $o_nonblock.";;
8699                 esac
8700         else
8701                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
8702         fi
8703         ;;
8704 *) echo "Using $hint value $o_nonblock.";;
8705 esac
8706 $rm -f try try.* .out core
8707
8708 echo " "
8709 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
8710 case "$eagain" in
8711 '')
8712         $cat head.c > try.c
8713         $cat >>try.c <<EOCP
8714 #include <errno.h>
8715 #include <sys/types.h>
8716 #include <signal.h>
8717 #include <stdio.h> 
8718 #define MY_O_NONBLOCK $o_nonblock
8719 #ifndef errno  /* XXX need better Configure test */
8720 extern int errno;
8721 #endif
8722 #$i_unistd I_UNISTD
8723 #ifdef I_UNISTD
8724 #include <unistd.h>
8725 #endif
8726 #$i_string I_STRING
8727 #ifdef I_STRING
8728 #include <string.h>
8729 #else
8730 #include <strings.h>
8731 #endif
8732 $signal_t blech(x) int x; { exit(3); }
8733 EOCP
8734         $cat >> try.c <<'EOCP'
8735 int main()
8736 {
8737         int pd[2];
8738         int pu[2];
8739         char buf[1];
8740         char string[100];
8741
8742         pipe(pd);       /* Down: child -> parent */
8743         pipe(pu);       /* Up: parent -> child */
8744         if (0 != fork()) {
8745                 int ret;
8746                 close(pd[1]);   /* Parent reads from pd[0] */
8747                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
8748                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
8749                         exit(1);
8750                 signal(SIGALRM, blech);
8751                 alarm(5);
8752                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
8753                         exit(2);
8754                 sprintf(string, "%d\n", ret);
8755                 write(2, string, strlen(string));
8756                 alarm(0);
8757 #ifdef EAGAIN
8758                 if (errno == EAGAIN) {
8759                         printf("EAGAIN\n");
8760                         goto ok;
8761                 }
8762 #endif
8763 #ifdef EWOULDBLOCK
8764                 if (errno == EWOULDBLOCK)
8765                         printf("EWOULDBLOCK\n");
8766 #endif
8767         ok:
8768                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
8769                 sleep(2);                               /* Give it time to close our pipe */
8770                 alarm(5);
8771                 ret = read(pd[0], buf, 1);      /* Should read EOF */
8772                 alarm(0);
8773                 sprintf(string, "%d\n", ret);
8774                 write(3, string, strlen(string));
8775                 exit(0);
8776         }
8777
8778         close(pd[0]);                   /* We write to pd[1] */
8779         close(pu[1]);                   /* We read from pu[0] */
8780         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
8781         close(pd[1]);                   /* Pipe pd is now fully closed! */
8782         exit(0);                                /* Bye bye, thank you for playing! */
8783 }
8784 EOCP
8785         set try
8786         if eval $compile_ok; then
8787                 echo "$startsh" >mtry
8788                 echo "./try >try.out 2>try.ret 3>try.err || exit 4" >>mtry
8789                 chmod +x mtry
8790                 ./mtry >/dev/null 2>&1
8791                 case $? in
8792                 0) eagain=`$cat try.out`;;
8793                 1) echo "Could not perform non-blocking setting!";;
8794                 2) echo "I did a successful read() for something that was not there!";;
8795                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
8796                 *) echo "Something terribly wrong happened during testing.";;
8797                 esac
8798                 rd_nodata=`$cat try.ret`
8799                 echo "A read() system call with no data present returns $rd_nodata."
8800                 case "$rd_nodata" in
8801                 0|-1) ;;
8802                 *)
8803                         echo "(That's peculiar, fixing that to be -1.)"
8804                         rd_nodata=-1
8805                         ;;
8806                 esac
8807                 case "$eagain" in
8808                 '')
8809                         echo "Forcing errno EAGAIN on read() with no data available."
8810                         eagain=EAGAIN
8811                         ;;
8812                 *)
8813                         echo "Your read() sets errno to $eagain when no data is available."
8814                         ;;
8815                 esac
8816                 status=`$cat try.err`
8817                 case "$status" in
8818                 0) echo "And it correctly returns 0 to signal EOF.";;
8819                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
8820                 *) echo "However, your read() returns '$status' on EOF??";;
8821                 esac
8822                 val="$define"
8823                 if test "$status" = "$rd_nodata"; then
8824                         echo "WARNING: you can't distinguish between EOF and no data!"
8825                         val="$undef"
8826                 fi
8827         else
8828                 echo "I can't compile the test program--assuming errno EAGAIN will do."
8829                 eagain=EAGAIN
8830         fi
8831         set d_eofnblk
8832         eval $setvar
8833         ;;
8834 *)
8835         echo "Using $hint value $eagain."
8836         echo "Your read() returns $rd_nodata when no data is present."
8837         case "$d_eofnblk" in
8838         "$define") echo "And you can see EOF because read() returns 0.";;
8839         "$undef") echo "But you can't see EOF status from read() returned value.";;
8840         *)
8841                 echo "(Assuming you can't see EOF status from read anyway.)"
8842                 d_eofnblk=$undef
8843                 ;;
8844         esac
8845         ;;
8846 esac
8847 $rm -f try try.* .out core head.c mtry
8848
8849 : see if fchmod exists
8850 set fchmod d_fchmod
8851 eval $inlibc
8852
8853 : see if fchown exists
8854 set fchown d_fchown
8855 eval $inlibc
8856
8857 : see if this is an fcntl system
8858 set fcntl d_fcntl
8859 eval $inlibc
8860
8861 echo " "
8862 : See if fcntl-based locking works.
8863 $cat >try.c <<'EOCP'
8864 #include <stdlib.h>
8865 #include <unistd.h>
8866 #include <fcntl.h>
8867 int main() {
8868 #if defined(F_SETLK) && defined(F_SETLKW)
8869      struct flock flock;
8870      int retval, fd;
8871      fd = open("try.c", O_RDONLY);
8872      flock.l_type = F_RDLCK;
8873      flock.l_whence = SEEK_SET;
8874      flock.l_start = flock.l_len = 0;
8875      retval = fcntl(fd, F_SETLK, &flock);
8876      close(fd);
8877      (retval < 0 ? exit(2) : exit(0));
8878 #else
8879      exit(2);
8880 #endif
8881 }
8882 EOCP
8883 echo "Checking if fcntl-based file locking works... "
8884 case "$d_fcntl" in
8885 "$define")
8886         set try
8887         if eval $compile_ok; then
8888                 if ./try; then
8889                         echo "Yes, it seems to work."
8890                         val="$define"
8891                 else
8892                         echo "Nope, it didn't work."
8893                         val="$undef"
8894                 fi
8895         else
8896                 echo "I'm unable to compile the test program, so I'll assume not."
8897                 val="$undef"
8898         fi
8899         ;;
8900 *) val="$undef";
8901         echo "Nope, since you don't even have fcntl()."
8902         ;;
8903 esac
8904 set d_fcntl_can_lock
8905 eval $setvar
8906 $rm -f try*
8907
8908
8909 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
8910 while $test $# -ge 2; do
8911         case "$1" in
8912         $define) echo "#include <$2>";;
8913         esac ;
8914     shift 2;
8915 done > try.c;
8916 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
8917 set try;
8918 if eval $compile; then
8919         val="$define";
8920 else
8921         val="$undef";
8922 fi;
8923 set $varname;
8924 eval $setvar;
8925 $rm -f try.c try.o'
8926
8927 socketlib=''
8928 sockethdr=''
8929 : see whether socket exists
8930 echo " "
8931 $echo $n "Hmm... $c" >&4
8932 if set socket val -f d_socket; eval $csym; $val; then
8933         echo "Looks like you have Berkeley networking support." >&4
8934         d_socket="$define"
8935         if set setsockopt val -f; eval $csym; $val; then
8936                 d_oldsock="$undef"
8937         else
8938                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
8939                 d_oldsock="$define"
8940         fi
8941 else
8942         if $contains socklib libc.list >/dev/null 2>&1; then
8943                 echo "Looks like you have Berkeley networking support." >&4
8944                 d_socket="$define"
8945                 : we will have to assume that it supports the 4.2 BSD interface
8946                 d_oldsock="$undef"
8947         else
8948                 echo "You don't have Berkeley networking in libc$_a..." >&4
8949                 if test "X$d_socket" = "X$define"; then
8950                    echo "...but you seem to believe that you have sockets." >&4
8951                 else
8952                         for net in net socket
8953                         do
8954                                 if test -f /usr/lib/lib$net$_a; then
8955                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
8956                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
8957                                         if $contains socket libc.list >/dev/null 2>&1; then
8958                                                 d_socket="$define"
8959                                                 socketlib="-l$net"
8960                                                 case "$net" in
8961                                                 net)
8962                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
8963                                                         sockethdr="-I/usr/netinclude"
8964                                                         ;;
8965                                                 esac
8966                                                 echo "Found Berkeley sockets interface in lib$net." >& 4 
8967                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
8968                                                         d_oldsock="$undef"
8969                                                 else
8970                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
8971                                                         d_oldsock="$define"
8972                                                 fi
8973                                                 break
8974                                         fi
8975                                 fi
8976                         done
8977                         if test "X$d_socket" != "X$define"; then
8978                            echo "or anywhere else I see." >&4
8979                            d_socket="$undef"
8980                            d_oldsock="$undef"
8981                         fi
8982                 fi
8983         fi
8984 fi
8985
8986 : see if socketpair exists
8987 set socketpair d_sockpair
8988 eval $inlibc
8989
8990
8991 echo " "
8992 echo "Checking the availability of certain socket constants..." >& 4
8993 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
8994         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
8995         $cat >try.c <<EOF
8996 #include <sys/types.h>
8997 #include <sys/socket.h>
8998 int main() {
8999     int i = $ENUM;
9000 }
9001 EOF
9002         val="$undef"
9003         set try; if eval $compile; then
9004                 val="$define"
9005         fi
9006         set d_${enum}; eval $setvar
9007         $rm -f try.c try
9008 done
9009
9010 : see if sys/select.h has to be included
9011 set sys/select.h i_sysselct
9012 eval $inhdr
9013
9014 : see if we should include time.h, sys/time.h, or both
9015 echo " "
9016 if test "X$timeincl" = X; then
9017         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
9018         $echo $n "I'm now running the test program...$c"
9019         $cat >try.c <<'EOCP'
9020 #include <sys/types.h>
9021 #ifdef I_TIME
9022 #include <time.h>
9023 #endif
9024 #ifdef I_SYSTIME
9025 #ifdef SYSTIMEKERNEL
9026 #define KERNEL
9027 #endif
9028 #include <sys/time.h>
9029 #endif
9030 #ifdef I_SYSSELECT
9031 #include <sys/select.h>
9032 #endif
9033 int main()
9034 {
9035         struct tm foo;
9036 #ifdef S_TIMEVAL
9037         struct timeval bar;
9038 #endif
9039 #ifdef S_TIMEZONE
9040         struct timezone tzp;
9041 #endif
9042         if (foo.tm_sec == foo.tm_sec)
9043                 exit(0);
9044 #ifdef S_TIMEVAL
9045         if (bar.tv_sec == bar.tv_sec)
9046                 exit(0);
9047 #endif
9048         exit(1);
9049 }
9050 EOCP
9051         flags=''
9052         for s_timezone in '-DS_TIMEZONE' ''; do
9053         sysselect=''
9054         for s_timeval in '-DS_TIMEVAL' ''; do
9055         for i_systimek in '' '-DSYSTIMEKERNEL'; do
9056         for i_time in '' '-DI_TIME'; do
9057         for i_systime in '-DI_SYSTIME' ''; do
9058                 case "$flags" in
9059                 '') $echo $n ".$c"
9060                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
9061                         if eval $compile; then
9062                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
9063                                 shift
9064                                 flags="$*"
9065                                 echo " "
9066                                 $echo $n "Succeeded with $flags$c"
9067                         fi
9068                         ;;
9069                 esac
9070         done
9071         done
9072         done
9073         done
9074         done
9075         timeincl=''
9076         echo " "
9077         case "$flags" in
9078         *SYSTIMEKERNEL*) i_systimek="$define"
9079                 timeincl=`./findhdr sys/time.h`
9080                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
9081         *) i_systimek="$undef";;
9082         esac
9083         case "$flags" in
9084         *I_TIME*) i_time="$define"
9085                 timeincl=`./findhdr time.h`" $timeincl"
9086                 echo "We'll include <time.h>." >&4;;
9087         *) i_time="$undef";;
9088         esac
9089         case "$flags" in
9090         *I_SYSTIME*) i_systime="$define"
9091                 timeincl=`./findhdr sys/time.h`" $timeincl"
9092                 echo "We'll include <sys/time.h>." >&4;;
9093         *) i_systime="$undef";;
9094         esac
9095         $rm -f try.c try
9096 fi
9097
9098 : check for fd_set items
9099 $cat <<EOM
9100
9101 Checking to see how well your C compiler handles fd_set and friends ...
9102 EOM
9103 $cat >fd_set.c <<EOCP
9104 #$i_systime I_SYS_TIME
9105 #$i_sysselct I_SYS_SELECT
9106 #$d_socket HAS_SOCKET
9107 #include <sys/types.h>
9108 #ifdef HAS_SOCKET
9109 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
9110 #endif
9111 #ifdef I_SYS_TIME
9112 #include <sys/time.h>
9113 #endif
9114 #ifdef I_SYS_SELECT
9115 #include <sys/select.h>
9116 #endif
9117 int main() {
9118         fd_set fds;
9119
9120 #ifdef TRYBITS
9121         if(fds.fds_bits);
9122 #endif
9123
9124 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
9125         exit(0);
9126 #else
9127         exit(1);
9128 #endif
9129 }
9130 EOCP
9131 set fd_set -DTRYBITS
9132 if eval $compile; then
9133         d_fds_bits="$define"
9134         d_fd_set="$define"
9135         echo "Well, your system knows about the normal fd_set typedef..." >&4
9136         if ./fd_set; then
9137                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
9138                 d_fd_macros="$define"
9139         else
9140                 $cat >&4 <<'EOM'
9141 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
9142 EOM
9143                 d_fd_macros="$undef"
9144         fi
9145 else
9146         $cat <<'EOM'
9147 Hmm, your compiler has some difficulty with fd_set.  Checking further...
9148 EOM
9149         set fd_set
9150         if eval $compile; then
9151                 d_fds_bits="$undef"
9152                 d_fd_set="$define"
9153                 echo "Well, your system has some sort of fd_set available..." >&4
9154                 if ./fd_set; then
9155                         echo "and you have the normal fd_set macros." >&4
9156                         d_fd_macros="$define"
9157                 else
9158                         $cat <<'EOM'
9159 but not the normal fd_set macros!  Gross!  More work for me...
9160 EOM
9161                         d_fd_macros="$undef"
9162                 fi
9163         else
9164         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
9165                 d_fd_set="$undef"
9166                 d_fds_bits="$undef"
9167                 d_fd_macros="$undef"
9168         fi
9169 fi
9170 $rm -f fd_set*
9171
9172 : see if fgetpos exists
9173 set fgetpos d_fgetpos
9174 eval $inlibc
9175
9176 : see if flock exists
9177 set flock d_flock
9178 eval $inlibc
9179
9180 : see if fork exists
9181 set fork d_fork
9182 eval $inlibc
9183
9184 : see if pathconf exists
9185 set pathconf d_pathconf
9186 eval $inlibc
9187
9188 : see if fpathconf exists
9189 set fpathconf d_fpathconf
9190 eval $inlibc
9191
9192
9193 : check for fpos64_t
9194 echo " "
9195 echo "Checking to see if you have fpos64_t..." >&4
9196 $cat >try.c <<EOCP
9197 #include <stdio.h>
9198 int main() { fpos64_t x = 7; }
9199 EOCP
9200 set try
9201 if eval $compile; then
9202         val="$define"
9203         echo "You have fpos64_t."
9204 else
9205         val="$undef"
9206         echo "You do not have fpos64_t."
9207         case "$fpossize" in
9208         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
9209         esac
9210 fi
9211 $rm -f try.* try
9212 set d_fpos64_t
9213 eval $setvar
9214
9215 : see if frexpl exists
9216 set frexpl d_frexpl
9217 eval $inlibc
9218
9219 hasstruct='varname=$1; struct=$2; shift; shift;
9220 while $test $# -ge 2; do
9221         case "$1" in
9222         $define) echo "#include <$2>";;
9223         esac ;
9224     shift 2;
9225 done > try.c;
9226 echo "int main () { struct $struct foo; }" >> try.c;
9227 set try;
9228 if eval $compile; then
9229         val="$define";
9230 else
9231         val="$undef";
9232 fi;
9233 set $varname;
9234 eval $setvar;
9235 $rm -f try.c try.o'
9236
9237 : see if this is a sys/param system
9238 set sys/param.h i_sysparam
9239 eval $inhdr
9240
9241 : see if this is a sys/mount.h system
9242 set sys/mount.h i_sysmount
9243 eval $inhdr
9244
9245 : see if sys/types.h has to be included
9246 set sys/types.h i_systypes
9247 eval $inhdr
9248
9249
9250 echo " "
9251 echo "Checking to see if your system supports struct fs_data..." >&4
9252 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
9253 eval $hasstruct
9254 case "$d_fs_data_s" in
9255 "$define")      echo "Yes, it does."   ;;
9256 *)              echo "No, it doesn't." ;;
9257 esac
9258
9259 : see if fseeko exists
9260 set fseeko d_fseeko
9261 eval $inlibc
9262 case "$longsize" in
9263 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
9264 esac
9265
9266 : see if fsetpos exists
9267 set fsetpos d_fsetpos
9268 eval $inlibc
9269
9270
9271 : see if fstatfs exists
9272 set fstatfs d_fstatfs
9273 eval $inlibc
9274
9275
9276 : see if statvfs exists
9277 set statvfs d_statvfs
9278 eval $inlibc
9279
9280 : see if fstatvfs exists
9281 set fstatvfs d_fstatvfs
9282 eval $inlibc
9283
9284
9285 : see if fsync exists
9286 set fsync d_fsync
9287 eval $inlibc
9288
9289 : see if ftello exists
9290 set ftello d_ftello
9291 eval $inlibc
9292 case "$longsize" in
9293 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
9294 esac
9295
9296 : see if getcwd exists
9297 set getcwd d_getcwd
9298 eval $inlibc
9299
9300 : see if getespwnam exists
9301 set getespwnam d_getespwnam
9302 eval $inlibc
9303
9304
9305 : see if getfsstat exists
9306 set getfsstat d_getfsstat
9307 eval $inlibc
9308
9309 : see if getgrent exists
9310 set getgrent d_getgrent
9311 eval $inlibc
9312
9313 : see if gethostbyaddr exists
9314 set gethostbyaddr d_gethbyaddr
9315 eval $inlibc
9316
9317 : see if gethostbyname exists
9318 set gethostbyname d_gethbyname
9319 eval $inlibc
9320
9321 : see if gethostent exists
9322 set gethostent d_gethent
9323 eval $inlibc
9324
9325 : see how we will look up host name
9326 echo " "
9327 call=''
9328 if set gethostname val -f d_gethname; eval $csym; $val; then
9329         echo 'gethostname() found.' >&4
9330         d_gethname="$define"
9331         call=gethostname
9332 fi
9333 if set uname val -f d_uname; eval $csym; $val; then
9334         if ./xenix; then
9335                 $cat <<'EOM'
9336 uname() was found, but you're running xenix, and older versions of xenix
9337 have a broken uname(). If you don't really know whether your xenix is old
9338 enough to have a broken system call, use the default answer.
9339
9340 EOM
9341                 dflt=y
9342                 case "$d_uname" in
9343                 "$define") dflt=n;;
9344                 esac
9345                 rp='Is your uname() broken?'
9346                 . ./myread
9347                 case "$ans" in
9348                 n*) d_uname="$define"; call=uname;;
9349                 esac
9350         else
9351                 echo 'uname() found.' >&4
9352                 d_uname="$define"
9353                 case "$call" in
9354                 '') call=uname ;;
9355                 esac
9356         fi
9357 fi
9358 case "$d_gethname" in
9359 '') d_gethname="$undef";;
9360 esac
9361 case "$d_uname" in
9362 '') d_uname="$undef";;
9363 esac
9364 case "$d_uname$d_gethname" in
9365 *define*)
9366         dflt=n
9367         cat <<EOM
9368  
9369 Every now and then someone has a $call() that lies about the hostname
9370 but can't be fixed for political or economic reasons.  If you wish, I can
9371 pretend $call() isn't there and maybe compute hostname at run-time
9372 thanks to the '$phostname' command.
9373
9374 EOM
9375         rp="Shall I ignore $call() from now on?"
9376         . ./myread
9377         case "$ans" in
9378         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
9379         esac;;
9380 esac
9381 case "$phostname" in
9382 '') aphostname='';;
9383 *) case "$aphostname" in
9384         /*) ;;
9385         *) set X $phostname
9386                 shift
9387                 file=$1
9388                 shift
9389                 file=`./loc $file $file $pth`
9390                 aphostname=`echo $file $*`
9391                 ;;
9392         esac
9393         ;;
9394 esac
9395 case "$d_uname$d_gethname" in
9396 *define*) ;;
9397 *)
9398         case "$phostname" in
9399         '')
9400                 echo "There will be no way for $package to get your hostname." >&4;;
9401         *)
9402         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
9403                 ;;
9404         esac;;
9405 esac
9406 case "$d_phostname" in
9407 '') d_phostname="$undef";;
9408 esac
9409
9410 : see if this is a netdb.h system
9411 set netdb.h i_netdb
9412 eval $inhdr
9413
9414 : see if prototypes for various gethostxxx netdb.h functions are available
9415 echo " "
9416 set d_gethostprotos gethostent $i_netdb netdb.h
9417 eval $hasproto
9418
9419 : see if getlogin exists
9420 set getlogin d_getlogin
9421 eval $inlibc
9422
9423 : see if getmnt exists
9424 set getmnt d_getmnt
9425 eval $inlibc
9426
9427 : see if getmntent exists
9428 set getmntent d_getmntent
9429 eval $inlibc
9430
9431 : see if getnetbyaddr exists
9432 set getnetbyaddr d_getnbyaddr
9433 eval $inlibc
9434
9435 : see if getnetbyname exists
9436 set getnetbyname d_getnbyname
9437 eval $inlibc
9438
9439 : see if getnetent exists
9440 set getnetent d_getnent
9441 eval $inlibc
9442
9443 : see if prototypes for various getnetxxx netdb.h functions are available
9444 echo " "
9445 set d_getnetprotos getnetent $i_netdb netdb.h
9446 eval $hasproto
9447
9448 : see if getpagesize exists
9449 set getpagesize d_getpagsz
9450 eval $inlibc
9451
9452
9453 : see if getprotobyname exists
9454 set getprotobyname d_getpbyname
9455 eval $inlibc
9456
9457 : see if getprotobynumber exists
9458 set getprotobynumber d_getpbynumber
9459 eval $inlibc
9460
9461 : see if getprotoent exists
9462 set getprotoent d_getpent
9463 eval $inlibc
9464
9465 : see if getpgid exists
9466 set getpgid d_getpgid
9467 eval $inlibc
9468
9469 : see if getpgrp2 exists
9470 set getpgrp2 d_getpgrp2
9471 eval $inlibc
9472
9473 : see if getppid exists
9474 set getppid d_getppid
9475 eval $inlibc
9476
9477 : see if getpriority exists
9478 set getpriority d_getprior
9479 eval $inlibc
9480
9481 : see if prototypes for various getprotoxxx netdb.h functions are available
9482 echo " "
9483 set d_getprotoprotos getprotoent $i_netdb netdb.h
9484 eval $hasproto
9485
9486 : see if getprpwnam exists
9487 set getprpwnam d_getprpwnam
9488 eval $inlibc
9489
9490 : see if getpwent exists
9491 set getpwent d_getpwent
9492 eval $inlibc
9493
9494
9495 : see if getservbyname exists
9496 set getservbyname d_getsbyname
9497 eval $inlibc
9498
9499 : see if getservbyport exists
9500 set getservbyport d_getsbyport
9501 eval $inlibc
9502
9503 : see if getservent exists
9504 set getservent d_getsent
9505 eval $inlibc
9506
9507 : see if prototypes for various getservxxx netdb.h functions are available
9508 echo " "
9509 set d_getservprotos getservent $i_netdb netdb.h
9510 eval $hasproto
9511
9512 : see if getspnam exists
9513 set getspnam d_getspnam
9514 eval $inlibc
9515
9516 : see if gettimeofday or ftime exists
9517 set gettimeofday d_gettimeod
9518 eval $inlibc
9519 case "$d_gettimeod" in
9520 "$undef")
9521         set ftime d_ftime 
9522         eval $inlibc
9523         ;;
9524 *)
9525         val="$undef"; set d_ftime; eval $setvar
9526         ;;
9527 esac
9528 case "$d_gettimeod$d_ftime" in
9529 "$undef$undef")
9530         echo " "
9531         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
9532         ;;
9533 esac
9534
9535 : see if this is an grp system
9536 set grp.h i_grp
9537 eval $inhdr
9538
9539 case "$i_grp" in
9540 $define)
9541         xxx=`./findhdr grp.h`
9542         $cppstdin $cppflags $cppminus < $xxx >$$.h
9543
9544         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
9545                 val="$define"
9546         else
9547                 val="$undef"
9548         fi
9549         set d_grpasswd
9550         eval $setvar
9551
9552         $rm -f $$.h
9553         ;;
9554 *)
9555         val="$undef";
9556         set d_grpasswd; eval $setvar
9557         ;;
9558 esac
9559
9560 : see if hasmntopt exists
9561 set hasmntopt d_hasmntopt
9562 eval $inlibc
9563
9564 : see if this is a netinet/in.h or sys/in.h system
9565 set netinet/in.h i_niin sys/in.h i_sysin
9566 eval $inhdr
9567
9568 : see if arpa/inet.h has to be included
9569 set arpa/inet.h i_arpainet
9570 eval $inhdr
9571
9572 : see if htonl --and friends-- exists
9573 val=''
9574 set htonl val
9575 eval $inlibc
9576
9577 : Maybe they are macros.
9578 case "$val" in
9579 $undef)
9580         $cat >htonl.c <<EOM
9581 #include <stdio.h>
9582 #include <sys/types.h>
9583 #$i_niin I_NETINET_IN
9584 #$i_sysin I_SYS_IN
9585 #$i_arpainet I_ARPA_INET
9586 #ifdef I_NETINET_IN
9587 #include <netinet/in.h>
9588 #endif
9589 #ifdef I_SYS_IN
9590 #include <sys/in.h>
9591 #endif
9592 #ifdef I_ARPA_INET
9593 #include <arpa/inet.h>
9594 #endif
9595 #ifdef htonl
9596 printf("Defined as a macro.");
9597 #endif
9598 EOM
9599         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
9600         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
9601                 val="$define"
9602                 echo "But it seems to be defined as a macro." >&4
9603         fi
9604         $rm -f htonl.?
9605         ;;
9606 esac
9607 set d_htonl
9608 eval $setvar
9609
9610 : see if iconv exists
9611 set iconv d_iconv
9612 eval $inlibc
9613
9614 : index or strchr
9615 echo " "
9616 if set index val -f; eval $csym; $val; then
9617         if set strchr val -f d_strchr; eval $csym; $val; then
9618                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
9619                         val="$define"
9620                         vali="$undef"
9621                         echo "strchr() found." >&4
9622                 else
9623                         val="$undef"
9624                         vali="$define"
9625                         echo "index() found." >&4
9626                 fi
9627         else
9628                 val="$undef"
9629                 vali="$define"
9630                 echo "index() found." >&4
9631         fi
9632 else
9633         if set strchr val -f d_strchr; eval $csym; $val; then
9634                 val="$define"
9635                 vali="$undef"
9636                 echo "strchr() found." >&4
9637         else
9638                 echo "No index() or strchr() found!" >&4
9639                 val="$undef"
9640                 vali="$undef"
9641         fi
9642 fi
9643 set d_strchr; eval $setvar
9644 val="$vali"
9645 set d_index; eval $setvar
9646
9647 : check whether inet_aton exists
9648 set inet_aton d_inetaton
9649 eval $inlibc
9650
9651 : see if inttypes.h is available
9652 : we want a real compile instead of Inhdr because some systems
9653 : have an inttypes.h which includes non-existent headers
9654 echo " "
9655 $cat >try.c <<EOCP
9656 #include <inttypes.h>
9657 int main() {
9658         static int32_t foo32 = 0x12345678;
9659 }
9660 EOCP
9661 set try
9662 if eval $compile; then
9663         echo "<inttypes.h> found." >&4
9664         val="$define"
9665 else
9666         echo "<inttypes.h> NOT found." >&4
9667         val="$undef"
9668 fi
9669 $rm -f try.c try
9670 set i_inttypes
9671 eval $setvar
9672
9673 : check for int64_t
9674 echo " "
9675 echo "Checking to see if you have int64_t..." >&4
9676 $cat >try.c <<EOCP
9677 #include <sys/types.h>
9678 #$i_inttypes I_INTTYPES
9679 #ifdef I_INTTYPES
9680 #include <inttypes.h>
9681 #endif
9682 int main() { int64_t x = 7; }
9683 EOCP
9684 set try
9685 if eval $compile; then
9686         val="$define"
9687         echo "You have int64_t."
9688 else
9689         val="$undef"
9690         echo "You do not have int64_t."
9691 fi
9692 $rm -f try try.*
9693 set d_int64_t
9694 eval $setvar
9695
9696 : Look for isascii
9697 echo " "
9698 $cat >isascii.c <<'EOCP'
9699 #include <stdio.h>
9700 #include <ctype.h>
9701 int main() {
9702         int c = 'A';
9703         if (isascii(c))
9704                 exit(0);
9705         else
9706                 exit(1);
9707 }
9708 EOCP
9709 set isascii
9710 if eval $compile; then
9711         echo "isascii() found." >&4
9712         val="$define"
9713 else
9714         echo "isascii() NOT found." >&4
9715         val="$undef"
9716 fi
9717 set d_isascii
9718 eval $setvar
9719 $rm -f isascii*
9720
9721 : see if isnan exists
9722 set isnan d_isnan
9723 eval $inlibc
9724
9725 : see if isnanl exists
9726 set isnanl d_isnanl
9727 eval $inlibc
9728
9729 : see if killpg exists
9730 set killpg d_killpg
9731 eval $inlibc
9732
9733 : see if lchown exists
9734 echo " "
9735 $cat > try.c <<'EOCP'
9736 /* System header to define __stub macros and hopefully few prototypes,
9737     which can conflict with char lchown(); below.  */
9738 #include <assert.h>
9739 /* Override any gcc2 internal prototype to avoid an error.  */
9740 /* We use char because int might match the return type of a gcc2
9741    builtin and then its argument prototype would still apply.  */
9742 char lchown();
9743 int main() {
9744     /*  The GNU C library defines this for functions which it implements
9745         to always fail with ENOSYS.  Some functions are actually named
9746         something starting with __ and the normal name is an alias.  */
9747 #if defined (__stub_lchown) || defined (__stub___lchown)
9748 choke me
9749 #else
9750 lchown();
9751 #endif
9752 ; return 0; }
9753 EOCP
9754 set try
9755 if eval $compile; then
9756     $echo "lchown() found." >&4
9757     val="$define"
9758 else
9759     $echo "lchown() NOT found." >&4
9760     val="$undef"
9761 fi
9762 set d_lchown
9763 eval $setvar
9764
9765 : See if number of significant digits in a double precision number is known
9766 echo " "
9767 $cat >ldbl_dig.c <<EOM
9768 #$i_limits I_LIMITS
9769 #$i_float I_FLOAT
9770 #ifdef I_LIMITS
9771 #include <limits.h>
9772 #endif
9773 #ifdef I_FLOAT
9774 #include <float.h>
9775 #endif
9776 #ifdef LDBL_DIG
9777 printf("Contains LDBL_DIG");
9778 #endif
9779 EOM
9780 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
9781 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
9782         echo "LDBL_DIG found." >&4
9783         val="$define"
9784 else
9785         echo "LDBL_DIG NOT found." >&4
9786         val="$undef"
9787 fi
9788 $rm -f ldbl_dig.?
9789 set d_ldbl_dig
9790 eval $setvar
9791
9792 : see if link exists
9793 set link d_link
9794 eval $inlibc
9795
9796 : see if localeconv exists
9797 set localeconv d_locconv
9798 eval $inlibc
9799
9800 : see if lockf exists
9801 set lockf d_lockf
9802 eval $inlibc
9803
9804 : check for long long
9805 echo " "
9806 echo "Checking to see if you have long long..." >&4
9807 echo 'int main() { long long x = 7; return 0; }' > try.c
9808 set try
9809 if eval $compile; then
9810         val="$define"
9811         echo "You have long long."
9812 else
9813         val="$undef"
9814         echo "You do not have long long."
9815 fi
9816 $rm try.*
9817 set d_longlong
9818 eval $setvar
9819
9820 : check for length of long long
9821 case "${d_longlong}${longlongsize}" in
9822 $define)
9823         echo " "
9824         echo "Checking to see how big your long longs are..." >&4
9825         $cat >try.c <<'EOCP'
9826 #include <stdio.h>
9827 int main()
9828 {
9829     printf("%d\n", (int)sizeof(long long));
9830     return(0);
9831 }
9832 EOCP
9833         set try
9834         if eval $compile_ok; then
9835                 longlongsize=`./try$exe_ext`
9836                 echo "Your long longs are $longlongsize bytes long."
9837         else
9838                 dflt='8'
9839                 echo " "
9840                 echo "(I can't seem to compile the test program.  Guessing...)"
9841                 rp="What is the size of a long long (in bytes)?"
9842                 . ./myread
9843                 longlongsize="$ans"
9844         fi
9845         if $test "X$longsize" = "X$longlongsize"; then
9846                 echo "(That isn't any different from an ordinary long.)"
9847         fi      
9848         ;;
9849 esac
9850 $rm -f try.* try
9851
9852 : see if prototype for lseek is available
9853 echo " "
9854 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
9855 eval $hasproto
9856
9857 : see if lstat exists
9858 set lstat d_lstat
9859 eval $inlibc
9860
9861 : see if madvise exists
9862 set madvise d_madvise
9863 eval $inlibc
9864
9865 : see if mblen exists
9866 set mblen d_mblen
9867 eval $inlibc
9868
9869 : see if mbstowcs exists
9870 set mbstowcs d_mbstowcs
9871 eval $inlibc
9872
9873 : see if mbtowc exists
9874 set mbtowc d_mbtowc
9875 eval $inlibc
9876
9877 : see if memchr exists
9878 set memchr d_memchr
9879 eval $inlibc
9880
9881 : see if memcmp exists
9882 set memcmp d_memcmp
9883 eval $inlibc
9884
9885 : see if memcpy exists
9886 set memcpy d_memcpy
9887 eval $inlibc
9888
9889 : see if memmove exists
9890 set memmove d_memmove
9891 eval $inlibc
9892
9893 : see if memset exists
9894 set memset d_memset
9895 eval $inlibc
9896
9897 : see if mkdir exists
9898 set mkdir d_mkdir
9899 eval $inlibc
9900
9901 : see if mkdtemp exists
9902 set mkdtemp d_mkdtemp
9903 eval $inlibc
9904
9905 : see if mkfifo exists
9906 set mkfifo d_mkfifo
9907 eval $inlibc
9908
9909 : see if mkstemp exists
9910 set mkstemp d_mkstemp
9911 eval $inlibc
9912
9913 : see if mkstemps exists
9914 set mkstemps d_mkstemps
9915 eval $inlibc
9916
9917 : see if mktime exists
9918 set mktime d_mktime
9919 eval $inlibc
9920
9921 : see if this is a sys/mman.h system
9922 set sys/mman.h i_sysmman
9923 eval $inhdr
9924
9925 : see if mmap exists
9926 set mmap d_mmap
9927 eval $inlibc
9928 : see what shmat returns
9929 : default to something harmless
9930 mmaptype='void *'
9931 case "$i_sysmman$d_mmap" in
9932 "$define$define")
9933         $cat >mmap.c <<'END'
9934 #include <sys/mman.h>
9935 void *mmap();
9936 END
9937         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
9938                 mmaptype='void *'
9939         else
9940                 mmaptype='caddr_t'
9941         fi
9942         echo "and it returns ($mmaptype)." >&4
9943         ;;
9944 esac
9945
9946
9947
9948 : see if modfl exists
9949 set modfl d_modfl
9950 eval $inlibc
9951
9952 : see if mprotect exists
9953 set mprotect d_mprotect
9954 eval $inlibc
9955
9956 : see if msgctl exists
9957 set msgctl d_msgctl
9958 eval $inlibc
9959
9960 : see if msgget exists
9961 set msgget d_msgget
9962 eval $inlibc
9963
9964 : see if msgsnd exists
9965 set msgsnd d_msgsnd
9966 eval $inlibc
9967
9968 : see if msgrcv exists
9969 set msgrcv d_msgrcv
9970 eval $inlibc
9971
9972 : see how much of the 'msg*(2)' library is present.
9973 h_msg=true
9974 echo " "
9975 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
9976 *"$undef"*) h_msg=false;;
9977 esac
9978 case "$osname" in
9979 freebsd)
9980     case "`ipcs 2>&1`" in
9981     "SVID messages"*"not configured"*)
9982         echo "Your $osname does not have the msg*(2) configured." >&4
9983         h_msg=false
9984         val="$undef"
9985         set msgctl d_msgctl
9986         eval $setvar
9987         set msgget d_msgget
9988         eval $setvar
9989         set msgsnd d_msgsnd
9990         eval $setvar
9991         set msgrcv d_msgrcv
9992         eval $setvar
9993         ;;
9994     esac
9995     ;;
9996 esac
9997 : we could also check for sys/ipc.h ...
9998 if $h_msg && $test `./findhdr sys/msg.h`; then
9999         echo "You have the full msg*(2) library." >&4
10000         val="$define"
10001 else
10002         echo "You don't have the full msg*(2) library." >&4
10003         val="$undef"
10004 fi
10005 set d_msg
10006 eval $setvar
10007
10008 : see if msync exists
10009 set msync d_msync
10010 eval $inlibc
10011
10012 : see if munmap exists
10013 set munmap d_munmap
10014 eval $inlibc
10015
10016 : see if nice exists
10017 set nice d_nice
10018 eval $inlibc
10019
10020
10021 echo " "
10022 echo "Checking which 64-bit integer type we could use..." >&4
10023
10024 case "$intsize" in
10025 8) val=int
10026    set quadtype
10027    eval $setvar
10028    val='"unsigned int"'
10029    set uquadtype
10030    eval $setvar
10031    quadkind=1
10032    ;;
10033 *) case "$longsize" in
10034    8) val=long
10035       set quadtype
10036       eval $setvar
10037       val='"unsigned long"'
10038       set uquadtype
10039       eval $setvar
10040       quadkind=2
10041       ;;
10042    *) case "$d_longlong:$longlongsize" in
10043       define:8)
10044         val='"long long"'
10045         set quadtype
10046         eval $setvar
10047         val='"unsigned long long"'
10048         set uquadtype
10049         eval $setvar
10050         quadkind=3
10051         ;;
10052       *) case "$d_int64_t" in
10053          define)
10054            val=int64_t
10055            set quadtype
10056            eval $setvar
10057            val=uint64_t
10058            set uquadtype
10059            eval $setvar
10060            quadkind=4
10061            ;;
10062          esac
10063          ;;
10064       esac
10065       ;;
10066    esac
10067    ;;
10068 esac
10069
10070 case "$quadtype" in
10071 '')     echo "Alas, no 64-bit integer types in sight." >&4
10072         d_quad="$undef"
10073         ;;
10074 *)      if test X"$use64bitint" = Xdefine -o X"$longsize" = X8; then
10075             verb="will"
10076         else
10077             verb="could"
10078         fi
10079         echo "We $verb use '$quadtype' for 64-bit integers." >&4
10080         d_quad="$define"
10081         ;;
10082 esac
10083
10084 : check for length of character
10085 echo " "
10086 case "$charsize" in
10087 '')
10088         echo "Checking to see how big your characters are (hey, you never know)..." >&4
10089         $cat >try.c <<'EOCP'
10090 #include <stdio.h>
10091 int main()
10092 {
10093     printf("%d\n", (int)sizeof(char));
10094     exit(0);
10095 }
10096 EOCP
10097         set try
10098         if eval $compile_ok; then
10099                 dflt=`./try`
10100         else
10101                 dflt='1'
10102                 echo "(I can't seem to compile the test program.  Guessing...)"
10103         fi
10104         ;;
10105 *)
10106         dflt="$charsize"
10107         ;;
10108 esac
10109 rp="What is the size of a character (in bytes)?"
10110 . ./myread
10111 charsize="$ans"
10112 $rm -f try.c try
10113
10114 : check for volatile keyword
10115 echo " "
10116 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
10117 $cat >try.c <<'EOCP'
10118 int main()
10119 {
10120         typedef struct _goo_struct goo_struct;
10121         goo_struct * volatile goo = ((goo_struct *)0);
10122         struct _goo_struct {
10123                 long long_int;
10124                 int reg_int;
10125                 char char_var;
10126         };
10127         typedef unsigned short foo_t;
10128         char *volatile foo;
10129         volatile int bar;
10130         volatile foo_t blech;
10131         foo = foo;
10132 }
10133 EOCP
10134 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
10135         val="$define"
10136         echo "Yup, it does."
10137 else
10138         val="$undef"
10139         echo "Nope, it doesn't."
10140 fi
10141 set d_volatile
10142 eval $setvar
10143 $rm -f try.*
10144
10145
10146 echo " "
10147 $echo "Choosing the C types to be used for Perl's internal types..." >&4
10148
10149 case "$use64bitint:$d_quad:$quadtype" in
10150 define:define:?*)
10151         ivtype="$quadtype"
10152         uvtype="$uquadtype"
10153         ivsize=8
10154         uvsize=8
10155         ;;
10156 *)      ivtype="long"
10157         uvtype="unsigned long"
10158         ivsize=$longsize
10159         uvsize=$longsize
10160         ;;
10161 esac
10162
10163 case "$uselongdouble:$d_longdbl" in
10164 define:define)
10165         nvtype="long double"
10166         nvsize=$longdblsize
10167         ;;
10168 *)      nvtype=double
10169         nvsize=$doublesize
10170         ;;
10171 esac
10172
10173 $echo "(IV will be "$ivtype", $ivsize bytes)"
10174 $echo "(UV will be "$uvtype", $uvsize bytes)"
10175 $echo "(NV will be "$nvtype", $nvsize bytes)"
10176
10177 $cat >try.c <<EOCP
10178 #$i_inttypes I_INTTYPES
10179 #ifdef I_INTTYPES
10180 #include <inttypes.h>
10181 #endif
10182 #include <stdio.h>
10183 int main() {
10184 #ifdef INT8
10185    int8_t i =  INT8_MAX;
10186   uint8_t u = UINT8_MAX;
10187   printf("int8_t\n");
10188 #endif
10189 #ifdef INT16
10190    int16_t i =  INT16_MAX;
10191   uint16_t i = UINT16_MAX;
10192   printf("int16_t\n");
10193 #endif
10194 #ifdef INT32
10195    int32_t i =  INT32_MAX;
10196   uint32_t u = UINT32_MAX;
10197   printf("int32_t\n");
10198 #endif
10199 }
10200 EOCP
10201
10202 case "$i8type" in
10203 '')     case "$charsize" in
10204         1)      i8type=char
10205                 u8type="unsigned char"
10206                 i8size=$charsize
10207                 u8size=$charsize
10208                 ;;
10209         esac
10210         ;;
10211 esac
10212 case "$i8type" in
10213 '')     set try -DINT8
10214         if eval $compile; then
10215                 case "`./try$exe_ext`" in
10216                 int8_t) i8type=int8_t
10217                         u8type=uint8_t
10218                         i8size=1
10219                         u8size=1
10220                         ;;
10221                 esac
10222         fi
10223         ;;
10224 esac
10225 case "$i8type" in
10226 '')     if $test $charsize -ge 1; then
10227                 i8type=char
10228                 u8type="unsigned char"
10229                 i8size=$charsize
10230                 u8size=$charsize
10231         fi
10232         ;;
10233 esac
10234
10235 case "$i16type" in
10236 '')     case "$shortsize" in
10237         2)      i16type=short
10238                 u16type="unsigned short"
10239                 i16size=$shortsize
10240                 u16size=$shortsize
10241                 ;;
10242         esac
10243         ;;
10244 esac
10245 case "$i16type" in
10246 '')     set try -DINT16
10247         if eval $compile; then
10248                 case "`./try$exe_ext`" in
10249                 int16_t)
10250                         i16type=int16_t
10251                         u16type=uint16_t
10252                         i16size=2
10253                         u16size=2
10254                         ;;
10255                 esac
10256         fi
10257         ;;
10258 esac
10259 case "$i16type" in
10260 '')     if $test $shortsize -ge 2; then
10261                 i16type=short
10262                 u16type="unsigned short"
10263                 i16size=$shortsize
10264                 u16size=$shortsize
10265         fi
10266         ;;
10267 esac
10268
10269 case "$i32type" in
10270 '')     case "$longsize" in
10271         4)      i32type=long
10272                 u32type="unsigned long"
10273                 i32size=$longsize
10274                 u32size=$longsize
10275                 ;;
10276         *)      case "$intsize" in
10277                 4)      i32type=int
10278                         u32type="unsigned int"
10279                         i32size=$intsize
10280                         u32size=$intsize
10281                         ;;
10282                 esac
10283                 ;;
10284         esac
10285         ;;
10286 esac
10287 case "$i32type" in
10288 '')     set try -DINT32
10289         if eval $compile; then
10290                 case "`./try$exe_ext`" in
10291                 int32_t)
10292                         i32type=int32_t
10293                         u32type=uint32_t
10294                         i32size=4
10295                         u32size=4
10296                         ;;
10297                 esac
10298         fi
10299         ;;
10300 esac
10301 case "$i32type" in
10302 '')     if $test $intsize -ge 4; then
10303                 i32type=int
10304                 u32type="unsigned int"
10305                 i32size=$intsize
10306                 u32size=$intsize
10307         fi
10308         ;;
10309 esac
10310
10311 case "$i64type" in
10312 '')     case "$d_quad:$quadtype" in
10313         define:?*)
10314                 i64type="$quadtype"
10315                 u64type="$uquadtype"
10316                 i64size=8
10317                 u64size=8
10318                 ;;
10319         esac
10320         ;;
10321 esac
10322
10323 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
10324 : volatile so that the compiler has to store it out to memory.
10325 if test X"$d_volatile" = X"$define"; then
10326         volatile=volatile
10327 fi
10328 $cat <<EOP >try.c
10329 #include <stdio.h>
10330 #include <sys/types.h>
10331 #include <signal.h>
10332 #ifdef SIGFPE
10333 $volatile int bletched = 0;
10334 $signal_t blech(s) int s; { bletched = 1; }
10335 #endif
10336 int main() {
10337     $uvtype u = 0;
10338     $nvtype d;
10339     int     n = 8 * $uvsize;
10340     int     i;
10341 #ifdef SIGFPE
10342     signal(SIGFPE, blech);
10343 #endif
10344
10345     for (i = 0; i < n; i++) {
10346       u = u << 1 | ($uvtype)1;
10347       d = ($nvtype)u;
10348       if (($uvtype)d != u)
10349         break;
10350       if (d <= 0)
10351         break;
10352       d = ($nvtype)(u - 1);
10353       if (($uvtype)d != (u - 1))
10354         break;
10355 #ifdef SIGFPE
10356       if (bletched) {
10357         break;
10358 #endif
10359       } 
10360     }
10361     printf("%d\n", ((i == n) ? -n : i));
10362     exit(0);
10363 }
10364 EOP
10365 set try
10366
10367 d_nv_preserves_uv="$undef"
10368 if eval $compile; then
10369         d_nv_preserves_uv_bits="`./try$exe_ext`"
10370 fi
10371 case "$d_nv_preserves_uv_bits" in
10372 \-[1-9]*)       
10373         d_nv_preserves_uv_bits=`expr 0 - $d_nv_preserves_uv_bits`
10374         $echo "Your NVs can preserve all $d_nv_preserves_uv_bits bits of your UVs."  2>&1
10375         d_nv_preserves_uv="$define"
10376         ;;
10377 [1-9]*) $echo "Your NVs can preserve only $d_nv_preserves_uv_bits bits of your UVs."  2>&1
10378         d_nv_preserves_uv="$undef" ;;
10379 *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
10380         d_nv_preserves_uv_bits="$undef" ;;
10381 esac
10382
10383 $rm -f try.* try
10384
10385
10386 : check for off64_t
10387 echo " "
10388 echo "Checking to see if you have off64_t..." >&4
10389 $cat >try.c <<EOCP
10390 #include <sys/types.h>
10391 #include <unistd.h>
10392 int main() { off64_t x = 7; }
10393 EOCP
10394 set try
10395 if eval $compile; then
10396         val="$define"
10397         echo "You have off64_t."
10398 else
10399         val="$undef"
10400         echo "You do not have off64_t."
10401         case "$lseeksize" in
10402         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
10403         esac
10404 fi
10405 $rm -f try.* try
10406 set d_off64_t
10407 eval $setvar
10408
10409 : see if POSIX threads are available
10410 set pthread.h i_pthread
10411 eval $inhdr
10412
10413
10414
10415
10416 : how to create joinable pthreads
10417 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
10418         echo " "
10419         echo "Checking what constant to use for creating joinable pthreads..." >&4 
10420         $cat >try.c <<'EOCP'
10421 #include <pthread.h>
10422 int main() {
10423     int detachstate = JOINABLE;
10424 }
10425 EOCP
10426         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
10427         if eval $compile; then
10428                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
10429                 val="$undef" # Yes, undef.
10430                 set d_old_pthread_create_joinable
10431                 eval $setvar
10432                 val=""
10433                 set old_pthread_create_joinable
10434                 eval $setvar
10435         else
10436                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
10437                 if eval $compile; then
10438                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
10439                         val="$define"
10440                         set d_old_pthread_create_joinable
10441                         eval $setvar
10442                         val=PTHREAD_CREATE_UNDETACHED
10443                         set old_pthread_create_joinable
10444                         eval $setvar
10445                 else            
10446                         set try -DJOINABLE=__UNDETACHED
10447                         if eval $compile; then
10448                                 echo "You seem to use __UNDETACHED." >&4
10449                                 val="$define"
10450                                 set d_old_pthread_create_joinable
10451                                 eval $setvar
10452                                 val=__UNDETACHED
10453                                 set old_pthread_create_joinable
10454                                 eval $setvar
10455                         else
10456                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
10457                                 val="$define"
10458                                 set d_old_pthread_create_joinable
10459                                 eval $setvar
10460                                 val=0
10461                                 set old_pthread_create_joinable
10462                                 eval $setvar
10463                         fi
10464                 fi
10465         fi
10466         $rm -f try try.*
10467 else
10468     d_old_pthread_create_joinable="$undef"
10469     old_pthread_create_joinable=""
10470 fi
10471
10472 : see if pause exists
10473 set pause d_pause
10474 eval $inlibc
10475
10476 : see if pipe exists
10477 set pipe d_pipe
10478 eval $inlibc
10479
10480 : see if poll exists
10481 set poll d_poll
10482 eval $inlibc
10483
10484
10485 : see whether the various POSIXish _yields exist
10486 $cat >try.c <<EOP
10487 #include <pthread.h>
10488 #include <stdio.h>
10489 int main() {
10490 #ifdef SCHED_YIELD
10491         sched_yield();
10492 #else
10493 #ifdef PTHREAD_YIELD
10494         pthread_yield();
10495 #else
10496 #ifdef PTHREAD_YIELD_NULL
10497         pthread_yield(NULL);
10498 #endif
10499 #endif
10500 #endif
10501 }
10502 EOP
10503 : see if sched_yield exists
10504 set try -DSCHED_YIELD
10505 if eval $compile; then
10506     val="$define"
10507     sched_yield='sched_yield()'
10508 else
10509     val="$undef"
10510 fi
10511 case "$usethreads" in
10512 $define)
10513         case "$val" in
10514         $define) echo 'sched_yield() found.' >&4        ;;
10515         *)       echo 'sched_yield() NOT found.' >&4    ;;
10516         esac
10517 esac
10518 set d_sched_yield
10519 eval $setvar
10520
10521 : see if pthread_yield exists
10522 set try -DPTHREAD_YIELD
10523 if eval $compile; then
10524     val="$define"
10525     case "$sched_yield" in
10526     '') sched_yield='pthread_yield()' ;;
10527     esac
10528 else
10529     set try -DPTHREAD_YIELD_NULL
10530     if eval $compile; then
10531         val="$define"
10532         case "$sched_yield" in
10533         '') sched_yield='pthread_yield(NULL)' ;;
10534         esac
10535     else
10536         val="$undef"
10537     fi
10538 fi
10539 case "$usethreads" in
10540 $define)
10541         case "$val" in
10542         $define) echo 'pthread_yield() found.' >&4      ;;
10543         *)       echo 'pthread_yield() NOT found.' >&4  ;;
10544         esac
10545         ;;
10546 esac
10547 set d_pthread_yield
10548 eval $setvar
10549
10550 case "$sched_yield" in
10551 '') sched_yield=undef ;;
10552 esac
10553
10554 $rm -f try try.*
10555
10556 : see if this is a pwd.h system
10557 set pwd.h i_pwd
10558 eval $inhdr
10559
10560 case "$i_pwd" in
10561 $define)
10562         xxx=`./findhdr pwd.h`
10563         $cppstdin $cppflags $cppminus < $xxx >$$.h
10564
10565         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
10566                 val="$define"
10567         else
10568                 val="$undef"
10569         fi
10570         set d_pwquota
10571         eval $setvar
10572
10573         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
10574                 val="$define"
10575         else
10576                 val="$undef"
10577         fi
10578         set d_pwage
10579         eval $setvar
10580
10581         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
10582                 val="$define"
10583         else
10584                 val="$undef"
10585         fi
10586         set d_pwchange
10587         eval $setvar
10588
10589         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
10590                 val="$define"
10591         else
10592                 val="$undef"
10593         fi
10594         set d_pwclass
10595         eval $setvar
10596
10597         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
10598                 val="$define"
10599         else
10600                 val="$undef"
10601         fi
10602         set d_pwexpire
10603         eval $setvar
10604
10605         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
10606                 val="$define"
10607         else
10608                 val="$undef"
10609         fi
10610         set d_pwcomment
10611         eval $setvar
10612
10613         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
10614                 val="$define"
10615         else
10616                 val="$undef"
10617         fi
10618         set d_pwgecos
10619         eval $setvar
10620
10621         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
10622                 val="$define"
10623         else
10624                 val="$undef"
10625         fi
10626         set d_pwpasswd
10627         eval $setvar
10628
10629         $rm -f $$.h
10630         ;;
10631 *)
10632         val="$undef"; 
10633         set d_pwquota; eval $setvar
10634         set d_pwage; eval $setvar
10635         set d_pwchange; eval $setvar
10636         set d_pwclass; eval $setvar
10637         set d_pwexpire; eval $setvar
10638         set d_pwcomment; eval $setvar
10639         set d_pwgecos; eval $setvar
10640         set d_pwpasswd; eval $setvar
10641         ;;
10642 esac
10643
10644 : see if readdir and friends exist
10645 set readdir d_readdir
10646 eval $inlibc
10647 set seekdir d_seekdir
10648 eval $inlibc
10649 set telldir d_telldir
10650 eval $inlibc
10651 set rewinddir d_rewinddir
10652 eval $inlibc
10653
10654 : see if readlink exists
10655 set readlink d_readlink
10656 eval $inlibc
10657
10658 : see if rename exists
10659 set rename d_rename
10660 eval $inlibc
10661
10662 : see if rmdir exists
10663 set rmdir d_rmdir
10664 eval $inlibc
10665
10666 : see if memory.h is available.
10667 val=''
10668 set memory.h val
10669 eval $inhdr
10670
10671 : See if it conflicts with string.h
10672 case "$val" in
10673 $define)
10674         case "$strings" in
10675         '') ;;
10676         *)
10677                 $cppstdin $cppflags $cppminus < $strings > mem.h
10678                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
10679                         echo " "
10680                         echo "We won't be including <memory.h>."
10681                         val="$undef"
10682                 fi
10683                 $rm -f mem.h
10684                 ;;
10685         esac
10686 esac
10687 set i_memory
10688 eval $setvar
10689
10690 : can bcopy handle overlapping blocks?
10691 val="$undef"
10692 case "$d_bcopy" in
10693 "$define")
10694         echo " "
10695         echo "Checking to see if your bcopy() can do overlapping copies..." >&4
10696         $cat >try.c <<EOCP
10697 #$i_memory I_MEMORY
10698 #$i_stdlib I_STDLIB
10699 #$i_string I_STRING
10700 #$i_unistd I_UNISTD
10701 EOCP
10702         $cat >>try.c <<'EOCP'
10703 #include <stdio.h>
10704 #ifdef I_MEMORY
10705 #  include <memory.h>
10706 #endif
10707 #ifdef I_STDLIB
10708 #  include <stdlib.h>
10709 #endif
10710 #ifdef I_STRING
10711 #  include <string.h>
10712 #else
10713 #  include <strings.h>
10714 #endif
10715 #ifdef I_UNISTD
10716 #  include <unistd.h>  /* Needed for NetBSD */
10717 #endif
10718 int main()
10719 {
10720 char buf[128], abc[128];
10721 char *b;
10722 int len;
10723 int off;
10724 int align;
10725
10726 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
10727
10728 for (align = 7; align >= 0; align--) {
10729         for (len = 36; len; len--) {
10730                 b = buf+align;
10731                 bcopy(abc, b, len);
10732                 for (off = 1; off <= len; off++) {
10733                         bcopy(b, b+off, len);
10734                         bcopy(b+off, b, len);
10735                         if (bcmp(b, abc, len))
10736                                 exit(1);
10737                 }
10738         }
10739 }
10740 exit(0);
10741 }
10742 EOCP
10743         set try
10744         if eval $compile_ok; then
10745                 if ./try 2>/dev/null; then
10746                         echo "Yes, it can."
10747                         val="$define"
10748                 else
10749                         echo "It can't, sorry."
10750                         case "$d_memmove" in
10751                         "$define") echo "But that's Ok since you have memmove()." ;;
10752                         esac
10753                 fi
10754         else
10755                 echo "(I can't compile the test program, so we'll assume not...)"
10756                 case "$d_memmove" in
10757                 "$define") echo "But that's Ok since you have memmove()." ;;
10758                 esac
10759         fi
10760         ;;
10761 esac
10762 $rm -f try.* try core
10763 set d_safebcpy
10764 eval $setvar
10765
10766 : can memcpy handle overlapping blocks?
10767 val="$undef"
10768 case "$d_memcpy" in
10769 "$define")
10770         echo " "
10771         echo "Checking to see if your memcpy() can do overlapping copies..." >&4
10772         $cat >try.c <<EOCP
10773 #$i_memory I_MEMORY
10774 #$i_stdlib I_STDLIB
10775 #$i_string I_STRING
10776 #$i_unistd I_UNISTD
10777 EOCP
10778         $cat >>try.c <<'EOCP'
10779 #include <stdio.h>
10780 #ifdef I_MEMORY
10781 #  include <memory.h>
10782 #endif
10783 #ifdef I_STDLIB
10784 #  include <stdlib.h>
10785 #endif
10786 #ifdef I_STRING
10787 #  include <string.h>
10788 #else
10789 #  include <strings.h>
10790 #endif
10791 #ifdef I_UNISTD
10792 #  include <unistd.h>  /* Needed for NetBSD */
10793 #endif
10794 int main()
10795 {
10796 char buf[128], abc[128];
10797 char *b;
10798 int len;
10799 int off;
10800 int align;
10801
10802 /* Copy "abcde..." string to char abc[] so that gcc doesn't
10803    try to store the string in read-only memory. */
10804 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
10805
10806 for (align = 7; align >= 0; align--) {
10807         for (len = 36; len; len--) {
10808                 b = buf+align;
10809                 memcpy(b, abc, len);
10810                 for (off = 1; off <= len; off++) {
10811                         memcpy(b+off, b, len);
10812                         memcpy(b, b+off, len);
10813                         if (memcmp(b, abc, len))
10814                                 exit(1);
10815                 }
10816         }
10817 }
10818 exit(0);
10819 }
10820 EOCP
10821         set try
10822         if eval $compile_ok; then
10823                 if ./try 2>/dev/null; then
10824                         echo "Yes, it can."
10825                         val="$define"
10826                 else
10827                         echo "It can't, sorry."
10828                         case "$d_memmove" in
10829                         "$define") echo "But that's Ok since you have memmove()." ;;
10830                         esac
10831                 fi
10832         else
10833                 echo "(I can't compile the test program, so we'll assume not...)"
10834                 case "$d_memmove" in
10835                 "$define") echo "But that's Ok since you have memmove()." ;;
10836                 esac
10837         fi
10838         ;;
10839 esac
10840 $rm -f try.* try core
10841 set d_safemcpy
10842 eval $setvar
10843
10844 : can memcmp be trusted to compare relative magnitude?
10845 val="$undef"
10846 case "$d_memcmp" in
10847 "$define")
10848         echo " "
10849         echo "Checking if your memcmp() can compare relative magnitude..." >&4
10850         $cat >try.c <<EOCP
10851 #$i_memory I_MEMORY
10852 #$i_stdlib I_STDLIB
10853 #$i_string I_STRING
10854 #$i_unistd I_UNISTD
10855 EOCP
10856         $cat >>try.c <<'EOCP'
10857 #include <stdio.h>
10858 #ifdef I_MEMORY
10859 #  include <memory.h>
10860 #endif
10861 #ifdef I_STDLIB
10862 #  include <stdlib.h>
10863 #endif
10864 #ifdef I_STRING
10865 #  include <string.h>
10866 #else
10867 #  include <strings.h>
10868 #endif
10869 #ifdef I_UNISTD
10870 #  include <unistd.h>  /* Needed for NetBSD */
10871 #endif
10872 int main()
10873 {
10874 char a = -1;
10875 char b = 0;
10876 if ((a < b) && memcmp(&a, &b, 1) < 0)
10877         exit(1);
10878 exit(0);
10879 }
10880 EOCP
10881         set try
10882         if eval $compile_ok; then
10883                 if ./try 2>/dev/null; then
10884                         echo "Yes, it can."
10885                         val="$define"
10886                 else
10887                         echo "No, it can't (it uses signed chars)."
10888                 fi
10889         else
10890                 echo "(I can't compile the test program, so we'll assume not...)"
10891         fi
10892         ;;
10893 esac
10894 $rm -f try.* try core
10895 set d_sanemcmp
10896 eval $setvar
10897
10898 : see if select exists
10899 set select d_select
10900 eval $inlibc
10901
10902 : see if semctl exists
10903 set semctl d_semctl
10904 eval $inlibc
10905
10906 : see if semget exists
10907 set semget d_semget
10908 eval $inlibc
10909
10910 : see if semop exists
10911 set semop d_semop
10912 eval $inlibc
10913
10914 : see how much of the 'sem*(2)' library is present.
10915 h_sem=true
10916 echo " "
10917 case "$d_semctl$d_semget$d_semop" in
10918 *"$undef"*) h_sem=false;;
10919 esac
10920 case "$osname" in
10921 freebsd)
10922     case "`ipcs 2>&1`" in
10923     "SVID messages"*"not configured"*)
10924         echo "Your $osname does not have the sem*(2) configured." >&4
10925         h_sem=false
10926         val="$undef"
10927         set semctl d_semctl
10928         eval $setvar
10929         set semget d_semget
10930         eval $setvar
10931         set semop d_semop
10932         eval $setvar
10933         ;;
10934     esac
10935     ;;
10936 esac
10937 : we could also check for sys/ipc.h ...
10938 if $h_sem && $test `./findhdr sys/sem.h`; then
10939         echo "You have the full sem*(2) library." >&4
10940         val="$define"
10941 else
10942         echo "You don't have the full sem*(2) library." >&4
10943         val="$undef"
10944 fi
10945 set d_sem
10946 eval $setvar
10947
10948 : see whether sys/sem.h defines union semun
10949 echo " "
10950 $cat > try.c <<'END'
10951 #include <sys/types.h>
10952 #include <sys/ipc.h>
10953 #include <sys/sem.h>
10954 int main () { union semun semun; semun.buf = 0; }
10955 END
10956 set try
10957 if eval $compile; then
10958     echo "You have union semun in <sys/sem.h>." >&4
10959     val="$define"
10960 else
10961     echo "You do not have union semun in <sys/sem.h>." >&4
10962     val="$undef"
10963 fi
10964 $rm -f try try.c try.h
10965 set d_union_semun
10966 eval $setvar
10967
10968 : see how to do semctl IPC_STAT
10969 case "$d_sem" in
10970 $define)
10971     : see whether semctl IPC_STAT can use union semun
10972     echo " "
10973     $cat > try.h <<END
10974 #ifndef S_IRUSR
10975 #   ifdef S_IREAD
10976 #       define S_IRUSR S_IREAD
10977 #       define S_IWUSR S_IWRITE
10978 #       define S_IXUSR S_IEXEC
10979 #   else
10980 #       define S_IRUSR 0400
10981 #       define S_IWUSR 0200
10982 #       define S_IXUSR 0100
10983 #   endif
10984 #   define S_IRGRP (S_IRUSR>>3)
10985 #   define S_IWGRP (S_IWUSR>>3)
10986 #   define S_IXGRP (S_IXUSR>>3)
10987 #   define S_IROTH (S_IRUSR>>6)
10988 #   define S_IWOTH (S_IWUSR>>6)
10989 #   define S_IXOTH (S_IXUSR>>6)
10990 #endif
10991 #ifndef S_IRWXU
10992 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
10993 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
10994 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
10995 #endif
10996 END
10997
10998     $cat > try.c <<END
10999 #include <sys/types.h>
11000 #include <sys/ipc.h>
11001 #include <sys/sem.h>
11002 #include <sys/stat.h>
11003 #include <stdio.h>
11004 #include <errno.h>
11005 #include "try.h"
11006 #ifndef errno
11007 extern int errno;
11008 #endif
11009 #$d_union_semun HAS_UNION_SEMUN
11010 int main() {
11011     union semun
11012 #ifndef HAS_UNION_SEMUN
11013     {
11014         int val;
11015         struct semid_ds *buf;
11016         unsigned short *array;
11017     }
11018 #endif
11019     arg;
11020     int sem, st;
11021
11022 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
11023     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
11024     if (sem > -1) {
11025         struct semid_ds argbuf;
11026         arg.buf = &argbuf;
11027 #       ifdef IPC_STAT
11028         st = semctl(sem, 0, IPC_STAT, arg);
11029         if (st == 0)
11030             printf("semun\n");
11031         else
11032 #       endif /* IPC_STAT */
11033             printf("semctl IPC_STAT failed: errno = %d\n", errno);
11034 #       ifdef IPC_RMID
11035         if (semctl(sem, 0, IPC_RMID, arg) != 0)
11036 #       endif /* IPC_RMID */
11037             printf("semctl IPC_RMID failed: errno = %d\n", errno);
11038     } else
11039 #endif /* IPC_PRIVATE && ... */
11040         printf("semget failed: errno = %d\n", errno);
11041   return 0;
11042 }
11043 END
11044     val="$undef"
11045     set try
11046     if eval $compile; then
11047         xxx=`./try`
11048         case "$xxx" in
11049         semun) val="$define" ;;
11050         esac
11051     fi
11052     $rm -f try try.c
11053     set d_semctl_semun
11054     eval $setvar
11055     case "$d_semctl_semun" in
11056     $define)
11057         echo "You can use union semun for semctl IPC_STAT." >&4
11058         also='also'
11059         ;;
11060     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
11061         also=''
11062         ;;
11063     esac
11064
11065     : see whether semctl IPC_STAT can use struct semid_ds pointer
11066     $cat > try.c <<'END'
11067 #include <sys/types.h>
11068 #include <sys/ipc.h>
11069 #include <sys/sem.h>
11070 #include <sys/stat.h>
11071 #include "try.h"
11072 #include <stdio.h>
11073 #include <errno.h>
11074 #ifndef errno
11075 extern int errno;
11076 #endif
11077 int main() {
11078     struct semid_ds arg;
11079     int sem, st;
11080
11081 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
11082     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
11083     if (sem > -1) {
11084 #       ifdef IPC_STAT
11085         st = semctl(sem, 0, IPC_STAT, &arg);
11086         if (st == 0)
11087             printf("semid_ds\n");
11088         else
11089 #       endif /* IPC_STAT */
11090             printf("semctl IPC_STAT failed: errno = %d\n", errno);
11091 #       ifdef IPC_RMID
11092         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
11093 #       endif /* IPC_RMID */
11094             printf("semctl IPC_RMID failed: errno = %d\n", errno);
11095     } else
11096 #endif /* IPC_PRIVATE && ... */
11097         printf("semget failed: errno = %d\n", errno);
11098
11099     return 0;
11100 }
11101 END
11102     val="$undef"
11103     set try
11104     if eval $compile; then
11105         xxx=`./try`
11106         case "$xxx" in
11107         semid_ds) val="$define" ;;
11108         esac
11109     fi
11110     $rm -f try try.c
11111     set d_semctl_semid_ds
11112     eval $setvar
11113     case "$d_semctl_semid_ds" in
11114     $define)
11115         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
11116         ;;
11117     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
11118         ;;
11119     esac
11120     $rm -f try.h
11121     ;;
11122 *)  val="$undef"
11123
11124     # We do not have the full sem*(2) library, so assume we can not
11125     # use either.
11126
11127     set d_semctl_semun
11128     eval $setvar
11129
11130     set d_semctl_semid_ds
11131     eval $setvar
11132     ;;
11133 esac
11134
11135 : see if setegid exists
11136 set setegid d_setegid
11137 eval $inlibc
11138
11139 : see if seteuid exists
11140 set seteuid d_seteuid
11141 eval $inlibc
11142
11143 : see if setgrent exists
11144 set setgrent d_setgrent
11145 eval $inlibc
11146
11147 : see if sethostent exists
11148 set sethostent d_sethent
11149 eval $inlibc
11150
11151 : see if setlinebuf exists
11152 set setlinebuf d_setlinebuf
11153 eval $inlibc
11154
11155 : see if setlocale exists
11156 set setlocale d_setlocale
11157 eval $inlibc
11158
11159 : see if setnetent exists
11160 set setnetent d_setnent
11161 eval $inlibc
11162
11163 : see if setprotoent exists
11164 set setprotoent d_setpent
11165 eval $inlibc
11166
11167 : see if setpgid exists
11168 set setpgid d_setpgid
11169 eval $inlibc
11170
11171 : see if setpgrp2 exists
11172 set setpgrp2 d_setpgrp2
11173 eval $inlibc
11174
11175 : see if setpriority exists
11176 set setpriority d_setprior
11177 eval $inlibc
11178
11179 : see if setproctitle exists
11180 set setproctitle d_setproctitle
11181 eval $inlibc
11182
11183 : see if setpwent exists
11184 set setpwent d_setpwent
11185 eval $inlibc
11186
11187 : see if setregid exists
11188 set setregid d_setregid
11189 eval $inlibc
11190 set setresgid d_setresgid
11191 eval $inlibc
11192
11193 : see if setreuid exists
11194 set setreuid d_setreuid
11195 eval $inlibc
11196 set setresuid d_setresuid
11197 eval $inlibc
11198
11199 : see if setrgid exists
11200 set setrgid d_setrgid
11201 eval $inlibc
11202
11203 : see if setruid exists
11204 set setruid d_setruid
11205 eval $inlibc
11206
11207 : see if setservent exists
11208 set setservent d_setsent
11209 eval $inlibc
11210
11211 : see if setsid exists
11212 set setsid d_setsid
11213 eval $inlibc
11214
11215 : see if setvbuf exists
11216 set setvbuf d_setvbuf
11217 eval $inlibc
11218
11219 : see if sfio.h is available
11220 set sfio.h i_sfio
11221 eval $inhdr
11222
11223
11224 : see if sfio library is available
11225 case "$i_sfio" in
11226 $define)
11227         val=''
11228         set sfreserve val
11229         eval $inlibc
11230         ;;
11231 *)
11232         val="$undef"
11233         ;;
11234 esac
11235 : Ok, but do we want to use it.
11236 case "$val" in
11237 $define)
11238         case "$usesfio" in
11239         true|$define|[yY]*) dflt='y';;
11240         *) dflt='n';;
11241         esac
11242         echo "$package can use the sfio library, but it is experimental."
11243         case "$useperlio" in
11244         "$undef")
11245             echo "For sfio also the PerlIO abstraction layer is needed."
11246             echo "Earlier you said you wouldn't want that."
11247             ;;
11248         esac
11249         rp="You seem to have sfio available, do you want to try using it?"
11250         . ./myread
11251         case "$ans" in
11252         y|Y)    echo "Ok, turning on both sfio and PerlIO, then."
11253                 useperlio="$define"
11254                 val="$define"
11255                 ;;
11256         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
11257                 val="$undef"
11258                 : Remove sfio from list of libraries to use
11259                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
11260                 shift
11261                 libs="$*"
11262                 echo "libs = $libs" >&4
11263                 ;;
11264         esac
11265         ;;
11266 *)      case "$usesfio" in
11267         true|$define|[yY]*)
11268                 echo "Sorry, cannot find sfio on this machine." >&4
11269                 echo "Ignoring your setting of usesfio=$usesfio." >&4
11270                 val="$undef"
11271                 ;;
11272         esac
11273         ;;
11274 esac
11275 set d_sfio
11276 eval $setvar
11277 case "$d_sfio" in
11278 $define) usesfio='true';;
11279 *) usesfio='false';;
11280 esac
11281
11282 : see if shmctl exists
11283 set shmctl d_shmctl
11284 eval $inlibc
11285
11286 : see if shmget exists
11287 set shmget d_shmget
11288 eval $inlibc
11289
11290 : see if shmat exists
11291 set shmat d_shmat
11292 eval $inlibc
11293 : see what shmat returns
11294 case "$d_shmat" in
11295 "$define")
11296         $cat >shmat.c <<'END'
11297 #include <sys/shm.h>
11298 void *shmat();
11299 END
11300         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
11301                 shmattype='void *'
11302         else
11303                 shmattype='char *'
11304         fi
11305         echo "and it returns ($shmattype)." >&4
11306         : see if a prototype for shmat is available
11307         xxx=`./findhdr sys/shm.h`
11308         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
11309         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
11310                 val="$define"
11311         else
11312                 val="$undef"
11313         fi
11314         $rm -f shmat.[co]
11315         ;;
11316 *)
11317         val="$undef"
11318         ;;
11319 esac
11320 set d_shmatprototype
11321 eval $setvar
11322
11323 : see if shmdt exists
11324 set shmdt d_shmdt
11325 eval $inlibc
11326
11327 : see how much of the 'shm*(2)' library is present.
11328 h_shm=true
11329 echo " "
11330 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
11331 *"$undef"*) h_shm=false;;
11332 esac
11333 case "$osname" in
11334 freebsd)
11335     case "`ipcs 2>&1`" in
11336     "SVID shared memory"*"not configured"*)
11337         echo "Your $osname does not have the shm*(2) configured." >&4
11338         h_shm=false
11339         val="$undef"
11340         set shmctl d_shmctl
11341         evat $setvar
11342         set shmget d_shmget
11343         evat $setvar
11344         set shmat d_shmat
11345         evat $setvar
11346         set shmdt d_shmdt
11347         evat $setvar
11348         ;;
11349     esac
11350     ;;
11351 esac
11352 : we could also check for sys/ipc.h ...
11353 if $h_shm && $test `./findhdr sys/shm.h`; then
11354         echo "You have the full shm*(2) library." >&4
11355         val="$define"
11356 else
11357         echo "You don't have the full shm*(2) library." >&4
11358         val="$undef"
11359 fi
11360 set d_shm
11361 eval $setvar
11362
11363 echo " "
11364 : see if we have sigaction
11365 if set sigaction val -f d_sigaction; eval $csym; $val; then
11366         echo 'sigaction() found.' >&4
11367         $cat > try.c <<'EOP'
11368 #include <stdio.h>
11369 #include <sys/types.h>
11370 #include <signal.h>
11371 int main()
11372 {
11373     struct sigaction act, oact;
11374     act.sa_flags = 0;
11375     oact.sa_handler = 0;
11376     /* so that act and oact are used */
11377     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
11378 }
11379 EOP
11380         set try
11381         if eval $compile_ok; then
11382                 val="$define"
11383         else
11384                 echo "But you don't seem to have a useable struct sigaction." >&4
11385                 val="$undef"
11386         fi
11387 else
11388         echo 'sigaction NOT found.' >&4
11389         val="$undef"
11390 fi
11391 set d_sigaction; eval $setvar
11392 $rm -f try try$_o try.c
11393
11394 : see if sigsetjmp exists
11395 echo " "
11396 case "$d_sigsetjmp" in
11397 '')
11398         $cat >try.c <<'EOP'
11399 #include <setjmp.h>
11400 sigjmp_buf env;
11401 int set = 1;
11402 int main()
11403 {
11404         if (sigsetjmp(env,1))
11405                 exit(set);
11406         set = 0;
11407         siglongjmp(env, 1);
11408         exit(1);
11409 }
11410 EOP
11411         set try
11412         if eval $compile; then
11413                 if ./try >/dev/null 2>&1; then
11414                         echo "POSIX sigsetjmp found." >&4
11415                         val="$define"
11416                 else
11417                         $cat >&4 <<EOM
11418 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
11419 I'll ignore them.
11420 EOM
11421                         val="$undef"
11422                 fi
11423         else
11424                 echo "sigsetjmp not found." >&4
11425                 val="$undef"
11426         fi
11427         ;;
11428 *) val="$d_sigsetjmp"
11429         case "$d_sigsetjmp" in
11430         $define) echo "POSIX sigsetjmp found." >&4;;
11431         $undef) echo "sigsetjmp not found." >&4;;
11432         esac
11433         ;;
11434 esac
11435 set d_sigsetjmp
11436 eval $setvar
11437 $rm -f try.c try
11438
11439 : see if socks5_init exists
11440 set socks5_init d_socks5_init
11441 eval $inlibc
11442
11443 : see if sys/stat.h is available
11444 set sys/stat.h i_sysstat
11445 eval $inhdr
11446
11447
11448 : see if stat knows about block sizes
11449 echo " "
11450 echo "Checking to see if your struct stat has st_blocks field..." >&4
11451 set d_statblks stat st_blocks $i_sysstat sys/stat.h
11452 eval $hasfield
11453
11454
11455 : see if this is a sys/vfs.h system
11456 set sys/vfs.h i_sysvfs
11457 eval $inhdr
11458
11459
11460 : see if this is a sys/statfs.h system
11461 set sys/statfs.h i_sysstatfs
11462 eval $inhdr
11463
11464
11465 echo " "
11466 echo "Checking to see if your system supports struct statfs..." >&4
11467 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
11468 eval $hasstruct
11469 case "$d_statfs_s" in
11470 "$define")      echo "Yes, it does."   ;;
11471 *)              echo "No, it doesn't." ;;
11472 esac
11473
11474
11475
11476 : see if struct statfs knows about f_flags
11477 case "$d_statfs_s" in
11478 define) 
11479         echo " "
11480         echo "Checking to see if your struct statfs has f_flags field..." >&4
11481         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
11482         eval $hasfield
11483         ;;
11484 *)      val="$undef"
11485         set d_statfs_f_flags
11486         eval $setvar
11487         ;;
11488 esac
11489 case "$d_statfs_f_flags" in
11490 "$define")      echo "Yes, it does."   ;;
11491 *)              echo "No, it doesn't." ;;
11492 esac
11493
11494 : see if _ptr and _cnt from stdio act std
11495 echo " "
11496
11497 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
11498         echo "(Looks like you have stdio.h from BSD.)"
11499         case "$stdio_ptr" in
11500         '') stdio_ptr='((fp)->_p)'
11501                 ptr_lval=$define
11502                 ;;
11503         *)      ptr_lval=$d_stdio_ptr_lval;;
11504         esac
11505         case "$stdio_cnt" in
11506         '') stdio_cnt='((fp)->_r)'
11507                 cnt_lval=$define
11508                 ;;
11509         *)      cnt_lval=$d_stdio_cnt_lval;;
11510         esac
11511         case "$stdio_base" in
11512         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
11513         esac
11514         case "$stdio_bufsiz" in
11515         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
11516         esac
11517 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
11518         echo "(Looks like you have stdio.h from Linux.)"
11519         case "$stdio_ptr" in
11520         '') stdio_ptr='((fp)->_IO_read_ptr)'
11521                 ptr_lval=$define
11522                 ;;
11523         *)      ptr_lval=$d_stdio_ptr_lval;;
11524         esac
11525         case "$stdio_cnt" in
11526         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
11527                 cnt_lval=$undef
11528                 ;;
11529         *)      cnt_lval=$d_stdio_cnt_lval;;
11530         esac
11531         case "$stdio_base" in
11532         '') stdio_base='((fp)->_IO_read_base)';;
11533         esac
11534         case "$stdio_bufsiz" in
11535         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
11536         esac
11537 else
11538         case "$stdio_ptr" in
11539         '') stdio_ptr='((fp)->_ptr)'
11540                 ptr_lval=$define
11541                 ;;
11542         *)      ptr_lval=$d_stdio_ptr_lval;;
11543         esac
11544         case "$stdio_cnt" in
11545         '') stdio_cnt='((fp)->_cnt)'
11546                 cnt_lval=$define
11547                 ;;
11548         *)      cnt_lval=$d_stdio_cnt_lval;;
11549         esac
11550         case "$stdio_base" in
11551         '') stdio_base='((fp)->_base)';;
11552         esac
11553         case "$stdio_bufsiz" in
11554         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
11555         esac
11556 fi
11557
11558 : test whether _ptr and _cnt really work
11559 echo "Checking how std your stdio is..." >&4
11560 $cat >try.c <<EOP
11561 #include <stdio.h>
11562 #define FILE_ptr(fp)    $stdio_ptr
11563 #define FILE_cnt(fp)    $stdio_cnt
11564 int main() {
11565         FILE *fp = fopen("try.c", "r");
11566         char c = getc(fp);
11567         if (
11568                 18 <= FILE_cnt(fp) &&
11569                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
11570         )
11571                 exit(0);
11572         exit(1);
11573 }
11574 EOP
11575 val="$undef"
11576 set try
11577 if eval $compile; then
11578         if ./try; then
11579                 echo "Your stdio acts pretty std."
11580                 val="$define"
11581         else
11582                 echo "Your stdio isn't very std."
11583         fi
11584 else
11585         echo "Your stdio doesn't appear very std."
11586 fi
11587 $rm -f try.c try
11588 set d_stdstdio
11589 eval $setvar
11590
11591 : Can _ptr be used as an lvalue?
11592 case "$d_stdstdio$ptr_lval" in
11593 $define$define) val=$define ;;
11594 *) val=$undef ;;
11595 esac
11596 set d_stdio_ptr_lval
11597 eval $setvar
11598
11599 : Can _cnt be used as an lvalue?
11600 case "$d_stdstdio$cnt_lval" in
11601 $define$define) val=$define ;;
11602 *) val=$undef ;;
11603 esac
11604 set d_stdio_cnt_lval
11605 eval $setvar
11606
11607
11608 : test whether setting _ptr sets _cnt as a side effect
11609 d_stdio_ptr_lval_sets_cnt="$undef"
11610 d_stdio_ptr_lval_nochange_cnt="$undef"
11611 case "$d_stdio_ptr_lval$d_stdstdio" in
11612 $define$define)
11613         echo "Checking to see what happens if we set the stdio ptr..." >&4
11614 $cat >try.c <<EOP
11615 #include <stdio.h>
11616 /* Can we scream? */
11617 /* Eat dust sed :-) */
11618 /* In the buffer space, no one can hear you scream. */
11619 #define FILE_ptr(fp)    $stdio_ptr
11620 #define FILE_cnt(fp)    $stdio_cnt
11621 #include <sys/types.h>
11622 int main() {
11623         FILE *fp = fopen("try.c", "r");
11624         int c;
11625         char *ptr;
11626         size_t cnt;
11627         if (!fp) {
11628             puts("Fail even to read");
11629             exit(1);
11630         }
11631         c = getc(fp); /* Read away the first # */
11632         if (c == EOF) {
11633             puts("Fail even to read");
11634             exit(1);
11635         }
11636         if (!(
11637                 18 <= FILE_cnt(fp) &&
11638                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
11639         )) {
11640                 puts("Fail even to read");
11641                 exit (1);
11642         }
11643         ptr = (char*) FILE_ptr(fp);
11644         cnt = (size_t)FILE_cnt(fp);
11645
11646         FILE_ptr(fp) += 42;
11647
11648         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
11649                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
11650                 exit (1);
11651         }
11652         if (FILE_cnt(fp) <= 20) {
11653                 printf ("Fail (<20 chars to test)");
11654                 exit (1);
11655         }
11656         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
11657                 puts("Fail compare");
11658                 exit (1);
11659         }
11660         if (cnt == FILE_cnt(fp)) {
11661                 puts("Pass_unchanged");
11662                 exit (0);
11663         }       
11664         if (FILE_cnt(fp) == (cnt - 42)) {
11665                 puts("Pass_changed");
11666                 exit (0);
11667         }
11668         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
11669         return 1;
11670
11671 }
11672 EOP
11673         set try
11674         if eval $compile; then
11675                 case `./try$exe_ext` in
11676                 Pass_changed)
11677                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
11678                         d_stdio_ptr_lval_sets_cnt="$define" ;;
11679                 Pass_unchanged)
11680                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
11681                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
11682                 Fail*)
11683                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
11684                 *)
11685                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
11686         esac
11687         else
11688                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
11689         fi
11690         $rm -f try.c try
11691         ;;
11692 esac
11693
11694 : see if _base is also standard
11695 val="$undef"
11696 case "$d_stdstdio" in
11697 $define)
11698         $cat >try.c <<EOP
11699 #include <stdio.h>
11700 #define FILE_base(fp)   $stdio_base
11701 #define FILE_bufsiz(fp) $stdio_bufsiz
11702 int main() {
11703         FILE *fp = fopen("try.c", "r");
11704         char c = getc(fp);
11705         if (
11706                 19 <= FILE_bufsiz(fp) &&
11707                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
11708         )
11709                 exit(0);
11710         exit(1);
11711 }
11712 EOP
11713         set try
11714         if eval $compile; then
11715                 if ./try; then
11716                         echo "And its _base field acts std."
11717                         val="$define"
11718                 else
11719                         echo "But its _base field isn't std."
11720                 fi
11721         else
11722                 echo "However, it seems to be lacking the _base field."
11723         fi
11724         $rm -f try.c try
11725         ;;
11726 esac
11727 set d_stdiobase
11728 eval $setvar
11729
11730 $cat >&4 <<EOM
11731 Checking how to access stdio streams by file descriptor number...
11732 EOM
11733 case "$stdio_stream_array" in
11734 '')     $cat >try.c <<EOCP
11735 #include <stdio.h>
11736 int main() {
11737   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
11738     printf("yes\n");
11739 }
11740 EOCP
11741         for s in _iob __iob __sF
11742         do
11743                 set try -DSTDIO_STREAM_ARRAY=$s
11744                 if eval $compile; then
11745                         case "`./try$exe_ext`" in
11746                         yes)    stdio_stream_array=$s; break ;;
11747                         esac
11748                 fi
11749         done
11750         $rm -f try.* try$exe_ext
11751 esac
11752 case "$stdio_stream_array" in
11753 '')     $cat >&4 <<EOM
11754 I can't figure out how to access stdio streams by file descriptor number.
11755 EOM
11756         d_stdio_stream_array="$undef"
11757         ;;
11758 *)      $cat >&4 <<EOM
11759 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
11760 EOM
11761         d_stdio_stream_array="$define"
11762         ;;
11763 esac
11764
11765 : see if strcoll exists
11766 set strcoll d_strcoll
11767 eval $inlibc
11768
11769 : check for structure copying
11770 echo " "
11771 echo "Checking to see if your C compiler can copy structs..." >&4
11772 $cat >try.c <<'EOCP'
11773 int main()
11774 {
11775         struct blurfl {
11776                 int dyick;
11777         } foo, bar;
11778
11779         foo = bar;
11780 }
11781 EOCP
11782 if $cc -c try.c >/dev/null 2>&1 ; then
11783         val="$define"
11784         echo "Yup, it can."
11785 else
11786         val="$undef"
11787         echo "Nope, it can't."
11788 fi
11789 set d_strctcpy
11790 eval $setvar
11791 $rm -f try.*
11792
11793 : see if strerror and/or sys_errlist[] exist
11794 echo " "
11795 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
11796     if set strerror val -f d_strerror; eval $csym; $val; then
11797                 echo 'strerror() found.' >&4
11798                 d_strerror="$define"
11799                 d_strerrm='strerror(e)'
11800                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
11801                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
11802                         d_syserrlst="$define"
11803                 else
11804                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
11805                         d_syserrlst="$undef"
11806                 fi
11807     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
11808                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
11809                 echo 'strerror() found in string header.' >&4
11810                 d_strerror="$define"
11811                 d_strerrm='strerror(e)'
11812                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
11813                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
11814                                 d_syserrlst="$define"
11815                 else
11816                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
11817                         d_syserrlst="$undef"
11818                 fi
11819     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
11820                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
11821                 d_strerror="$undef"
11822                 d_syserrlst="$define"
11823                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
11824     else
11825                 echo 'strerror() and sys_errlist[] NOT found.' >&4
11826                 d_strerror="$undef"
11827                 d_syserrlst="$undef"
11828                 d_strerrm='"unknown"'
11829     fi
11830 fi
11831
11832 : see if strtod exists
11833 set strtod d_strtod
11834 eval $inlibc
11835
11836 : see if strtol exists
11837 set strtol d_strtol
11838 eval $inlibc
11839
11840 : see if strtold exists
11841 set strtold d_strtold
11842 eval $inlibc
11843
11844 : see if strtoll exists
11845 set strtoll d_strtoll
11846 eval $inlibc
11847
11848 case "$d_longlong-$d_strtoll" in
11849 "$define-$define")
11850         $cat <<EOM
11851 Checking whether your strtoll() works okay...
11852 EOM
11853         $cat >try.c <<'EOCP'
11854 #include <errno.h>
11855 #ifdef __hpux
11856 #define strtoll __strtoll
11857 #endif
11858 #ifdef __EMX__
11859 #define strtoll _strtoll
11860 #endif
11861 #include <stdio.h>
11862 extern long long int strtoll(char *s, char **, int); 
11863 static int bad = 0;
11864 int check(char *s, long long ell, int een) {
11865         long long gll;
11866         errno = 0;
11867         gll = strtoll(s, 0, 10);
11868         if (!((gll == ell) && (errno == een)))
11869                 bad++;
11870 }
11871 int main() {
11872         check(" 1",                                      1LL, 0);
11873         check(" 0",                                      0LL, 0);
11874         check("-1",                                     -1LL, 0);
11875         check("-9223372036854775808", -9223372036854775808LL, 0);
11876         check("-9223372036854775808", -9223372036854775808LL, 0);
11877         check(" 9223372036854775807",  9223372036854775807LL, 0);
11878         check("-9223372036854775808", -9223372036854775808LL, 0);
11879         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
11880         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
11881         if (!bad)
11882                 printf("ok\n");
11883 }
11884 EOCP
11885         set try
11886         if eval $compile; then
11887                 yyy=`./try`
11888                 case "$yyy" in
11889                 ok) echo "Your strtoll() seems to be working okay." ;;
11890                 *) cat <<EOM >&4
11891 Your strtoll() doesn't seem to be working okay.
11892 EOM
11893                    d_strtoll="$undef"
11894                    ;;
11895                 esac
11896         else
11897                 echo "(I can't seem to compile the test program--assuming it doesn't)"
11898                 d_strtoll="$undef"
11899         fi
11900         ;;
11901 esac
11902
11903 : see if strtoul exists
11904 set strtoul d_strtoul
11905 eval $inlibc
11906
11907 : see if strtoull exists
11908 set strtoull d_strtoull
11909 eval $inlibc
11910
11911 case "$d_longlong-$d_strtoull" in
11912 "$define-$define")
11913         $cat <<EOM
11914 Checking whether your strtoull() works okay...
11915 EOM
11916         $cat >try.c <<'EOCP'
11917 #include <errno.h>
11918 #ifdef __hpux
11919 #define strtoull __strtoull
11920 #endif
11921 #include <stdio.h>
11922 extern unsigned long long int strtoull(char *s, char **, int); 
11923 static int bad = 0;
11924 int check(char *s, long long eull, int een) {
11925         long long gull;
11926         errno = 0;
11927         gull = strtoull(s, 0, 10);
11928         if (!((gull == eull) && (errno == een)))
11929                 bad++;
11930 }
11931 int main() {
11932         check(" 1",                                       1LL, 0);
11933         check(" 0",                                       0LL, 0);
11934         check("18446744073709551615", 18446744073709551615ULL, 0);
11935         check("18446744073709551616", 18446744073709551615ULL, ERANGE);
11936         if (!bad)
11937                 printf("ok\n");
11938 }
11939 EOCP
11940         set try
11941         if eval $compile; then
11942                 case "`./try`" in
11943                 ok) echo "Your strtoull() seems to be working okay." ;;
11944                 *) cat <<EOM >&4
11945 Your strtoull() doesn't seem to be working okay.
11946 EOM
11947                    d_strtoull="$undef"
11948                    ;;
11949                 esac
11950         fi
11951         ;;
11952 esac
11953
11954 : see if strtouq exists
11955 set strtouq d_strtouq
11956 eval $inlibc
11957
11958 : see if strxfrm exists
11959 set strxfrm d_strxfrm
11960 eval $inlibc
11961
11962 : see if symlink exists
11963 set symlink d_symlink
11964 eval $inlibc
11965
11966 : see if syscall exists
11967 set syscall d_syscall
11968 eval $inlibc
11969
11970 : see if sysconf exists
11971 set sysconf d_sysconf
11972 eval $inlibc
11973
11974 : see if system exists
11975 set system d_system
11976 eval $inlibc
11977
11978 : see if tcgetpgrp exists
11979 set tcgetpgrp d_tcgetpgrp
11980 eval $inlibc
11981
11982 : see if tcsetpgrp exists
11983 set tcsetpgrp d_tcsetpgrp
11984 eval $inlibc
11985
11986 : see if prototype for telldir is available
11987 echo " "
11988 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
11989 eval $hasproto
11990
11991 : see if this is a sys/times.h system
11992 set sys/times.h i_systimes
11993 eval $inhdr
11994
11995 : see if times exists
11996 echo " "
11997 if set times val -f d_times; eval $csym; $val; then
11998         echo 'times() found.' >&4
11999         d_times="$define"
12000         inc=''
12001         case "$i_systimes" in
12002         "$define") inc='sys/times.h';;
12003         esac
12004         rp="What is the type returned by times() on this system?"
12005         set clock_t clocktype long stdio.h sys/types.h $inc
12006         eval $typedef_ask
12007 else
12008         echo 'times() NOT found, hope that will do.' >&4
12009         d_times="$undef"
12010         clocktype='int'
12011 fi
12012
12013 : see if truncate exists
12014 set truncate d_truncate
12015 eval $inlibc
12016
12017 : see if tzname[] exists
12018 echo " "
12019 if set tzname val -a d_tzname; eval $csym; $val; then
12020         val="$define"
12021         echo 'tzname[] found.' >&4
12022 else
12023         val="$undef"
12024         echo 'tzname[] NOT found.' >&4
12025 fi
12026 set d_tzname
12027 eval $setvar
12028
12029 : see if umask exists
12030 set umask d_umask
12031 eval $inlibc
12032
12033 : see if ustat exists
12034 set ustat d_ustat
12035 eval $inlibc
12036
12037 : backward compatibility for d_hvfork
12038 if test X$d_hvfork != X; then
12039         d_vfork="$d_hvfork"
12040         d_hvfork=''
12041 fi
12042 : see if there is a vfork
12043 val=''
12044 set vfork val
12045 eval $inlibc
12046
12047 : Ok, but do we want to use it. vfork is reportedly unreliable in 
12048 : perl on Solaris 2.x, and probably elsewhere.
12049 case "$val" in
12050 $define)
12051         echo " "
12052         case "$usevfork" in
12053         false) dflt='n';;
12054         *) dflt='y';;
12055         esac
12056         cat <<'EOM'
12057  
12058 Perl can only use a vfork() that doesn't suffer from strict
12059 restrictions on calling functions or modifying global data in
12060 the child.  For example, glibc-2.1 contains such a vfork()
12061 that is unsuitable.  If your system provides a proper fork()
12062 call, chances are that you do NOT want perl to use vfork().
12063
12064 EOM
12065         rp="Do you still want to use vfork()?"
12066         . ./myread
12067         case "$ans" in
12068         y|Y) ;;
12069         *)
12070                 echo "Ok, we won't use vfork()."
12071                 val="$undef"
12072                 ;;
12073         esac
12074         ;;
12075 esac
12076 set d_vfork
12077 eval $setvar
12078 case "$d_vfork" in
12079 $define) usevfork='true';;
12080 *) usevfork='false';;
12081 esac
12082
12083 : see if this is an sysdir system
12084 set sys/dir.h i_sysdir
12085 eval $inhdr
12086
12087 : see if this is an sysndir system
12088 set sys/ndir.h i_sysndir
12089 eval $inhdr
12090
12091 : see if closedir exists
12092 set closedir d_closedir
12093 eval $inlibc
12094
12095 case "$d_closedir" in
12096 "$define")
12097         echo " "
12098         echo "Checking whether closedir() returns a status..." >&4
12099         cat > closedir.c <<EOM
12100 #$i_dirent I_DIRENT             /**/
12101 #$i_sysdir I_SYS_DIR            /**/
12102 #$i_sysndir I_SYS_NDIR          /**/
12103 #$i_systypes I_SYS_TYPES        /**/
12104
12105 #if defined(I_SYS_TYPES)
12106 #include <sys/types.h>
12107 #endif
12108 #if defined(I_DIRENT)
12109 #include <dirent.h>
12110 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
12111 #include <sys/dir.h>
12112 #endif
12113 #else
12114 #ifdef I_SYS_NDIR
12115 #include <sys/ndir.h>
12116 #else
12117 #ifdef I_SYS_DIR
12118 #ifdef hp9000s500
12119 #include <ndir.h>       /* may be wrong in the future */
12120 #else
12121 #include <sys/dir.h>
12122 #endif
12123 #endif
12124 #endif
12125 #endif 
12126 int main() { return closedir(opendir(".")); }
12127 EOM
12128         set closedir
12129         if eval $compile_ok; then
12130                 if ./closedir > /dev/null 2>&1 ; then
12131                         echo "Yes, it does."
12132                         val="$undef"
12133                 else
12134                         echo "No, it doesn't."
12135                         val="$define"
12136                 fi
12137         else
12138                 echo "(I can't seem to compile the test program--assuming it doesn't)"
12139                 val="$define"
12140         fi
12141         ;;
12142 *)
12143         val="$undef";
12144         ;;
12145 esac
12146 set d_void_closedir
12147 eval $setvar
12148 $rm -f closedir*
12149 : see if there is a wait4
12150 set wait4 d_wait4
12151 eval $inlibc
12152
12153 : see if waitpid exists
12154 set waitpid d_waitpid
12155 eval $inlibc
12156
12157 : see if wcstombs exists
12158 set wcstombs d_wcstombs
12159 eval $inlibc
12160
12161 : see if wctomb exists
12162 set wctomb d_wctomb
12163 eval $inlibc
12164
12165 : preserve RCS keywords in files with variable substitution, grrr
12166 Date='$Date'
12167 Id='$Id'
12168 Log='$Log'
12169 RCSfile='$RCSfile'
12170 Revision='$Revision'
12171
12172 case "$crosscompile" in
12173 ''|[nN]*) crosscompile="$undef" ;;
12174 esac
12175
12176 case "$osname" in
12177 next|rhapsody|darwin) multiarch="$define" ;;
12178 esac
12179 case "$multiarch" in
12180 ''|[nN]*) multiarch="$undef" ;;
12181 esac
12182
12183 : check for alignment requirements
12184 echo " "
12185 case "$crosscompile$multiarch" in
12186 *$define*)
12187         $cat <<EOM
12188 You seem to be either cross-compiling or doing a multiarchitecture build,
12189 skipping the memory alignment check.
12190
12191 EOM
12192         case "$alignbytes" in
12193         '') alignbytes=8 ;;
12194         esac
12195         ;;
12196 *)
12197         case "$alignbytes" in
12198         '') echo "Checking alignment constraints..." >&4
12199                 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
12200                         $cat >try.c <<'EOCP'
12201 typedef long double NV;
12202 EOCP
12203                 else
12204                         $cat >try.c <<'EOCP'
12205 typedef double NV;
12206 EOCP
12207                 fi
12208                 $cat >>try.c <<'EOCP'
12209 #include <stdio.h>
12210 struct foobar {
12211         char foo;
12212         NV bar;
12213 } try_algn;
12214 int main()
12215 {
12216     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
12217     return(0);
12218 }
12219 EOCP
12220                 set try
12221                 if eval $compile_ok; then
12222                         dflt=`./try`
12223                 else
12224                         dflt='8'
12225                         echo "(I can't seem to compile the test program...)"
12226                 fi
12227                 ;;
12228         *) dflt="$alignbytes"
12229                 ;;
12230         esac
12231         rp="Doubles must be aligned on a how-many-byte boundary?"
12232         . ./myread
12233         alignbytes="$ans"
12234         $rm -f try.c try
12235         ;;
12236 esac
12237
12238
12239 : set the base revision
12240 baserev=5.0
12241
12242 : check for ordering of bytes in a long
12243 echo " "
12244 case "$crosscompile$multiarch" in
12245 *$define*)
12246         $cat <<EOM
12247 You seem to be either cross-compiling or doing a multiarchitecture build,
12248 skipping the byteorder check.
12249
12250 EOM
12251         byteorder='0xffff'
12252         ;;
12253 *)
12254         case "$byteorder" in
12255         '')
12256                 $cat <<'EOM'
12257 In the following, larger digits indicate more significance.  A big-endian
12258 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
12259 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
12260 machines may have weird orders like 3412.  A Cray will report 87654321,
12261 an Alpha will report 12345678. If the test program works the default is
12262 probably right.
12263 I'm now running the test program...
12264 EOM
12265                 $cat >try.c <<'EOCP'
12266 #include <stdio.h>
12267 int main()
12268 {
12269         int i;
12270         union {
12271                 unsigned long l;
12272                 char c[sizeof(long)];
12273         } u;
12274
12275         if (sizeof(long) > 4)
12276                 u.l = (0x08070605L << 32) | 0x04030201L;
12277         else
12278                 u.l = 0x04030201L;
12279         for (i = 0; i < sizeof(long); i++)
12280                 printf("%c", u.c[i]+'0');
12281         printf("\n");
12282         exit(0);
12283 }
12284 EOCP
12285                 xxx_prompt=y
12286                 set try
12287                 if eval $compile && ./try > /dev/null; then
12288                         dflt=`./try`
12289                         case "$dflt" in
12290                         [1-4][1-4][1-4][1-4]|12345678|87654321)
12291                                 echo "(The test program ran ok.)"
12292                                 echo "byteorder=$dflt"
12293                                 xxx_prompt=n
12294                         ;;
12295                         ????|????????) echo "(The test program ran ok.)" ;;
12296                         *) echo "(The test program didn't run right for some reason.)" ;;
12297                         esac
12298                 else
12299                         dflt='4321'
12300                         cat <<'EOM'
12301 (I can't seem to compile the test program.  Guessing big-endian...)
12302 EOM
12303                 fi
12304                 case "$xxx_prompt" in
12305                 y)
12306                         rp="What is the order of bytes in a long?"
12307                         . ./myread
12308                         byteorder="$ans"
12309                         ;;
12310                 *)      byteorder=$dflt
12311                         ;;
12312                 esac
12313                 ;;
12314         esac
12315         $rm -f try.c try
12316         ;;
12317 esac
12318
12319
12320 : how do we catenate cpp tokens here?
12321 echo " "
12322 echo "Checking to see how your cpp does stuff like catenate tokens..." >&4
12323 $cat >cpp_stuff.c <<'EOCP'
12324 #define RCAT(a,b)a/**/b
12325 #define ACAT(a,b)a ## b
12326 RCAT(Rei,ser)
12327 ACAT(Cir,cus)
12328 EOCP
12329 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
12330 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
12331         echo "Oh!  Smells like ANSI's been here." >&4
12332         echo "We can catify or stringify, separately or together!"
12333         cpp_stuff=42
12334 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
12335         echo "Ah, yes!  The good old days!" >&4
12336         echo "However, in the good old days we don't know how to stringify and"
12337         echo "catify at the same time."
12338         cpp_stuff=1
12339 else
12340         $cat >&4 <<EOM
12341 Hmm, I don't seem to be able to catenate tokens with your cpp.  You're going
12342 to have to edit the values of CAT[2-5] in config.h...
12343 EOM
12344         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
12345 fi
12346 $rm -f cpp_stuff.*
12347
12348 : see if this is a db.h system
12349 set db.h i_db
12350 eval $inhdr
12351
12352 case "$i_db" in
12353 $define)
12354         : Check db version.
12355         echo " "
12356         echo "Checking Berkeley DB version ..." >&4
12357         $cat >try.c <<EOCP
12358 #$d_const HASCONST
12359 #ifndef HASCONST
12360 #define const
12361 #endif
12362 #include <sys/types.h>
12363 #include <stdio.h>
12364 #include <db.h>
12365 int main()
12366 {
12367 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
12368     int Major, Minor, Patch ;
12369     unsigned long Version ;
12370     (void)db_version(&Major, &Minor, &Patch) ;
12371     printf("You have Berkeley DB Version 2 or greater\n");
12372
12373     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
12374                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
12375     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
12376                 Major, Minor, Patch) ;
12377
12378     /* check that db.h & libdb are compatible */
12379     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
12380         printf("db.h and libdb are incompatible\n") ;
12381         exit(3);        
12382     }
12383
12384     printf("db.h and libdb are compatible\n") ;
12385
12386     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
12387                 + DB_VERSION_PATCH ;
12388
12389     /* needs to be >= 2.3.4 */
12390     if (Version < 2003004) {
12391     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
12392         printf("but Perl needs Berkeley DB 2.3.4 or greater\n") ;
12393         exit(2);        
12394     }
12395
12396     exit(0);
12397 #else
12398 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
12399     printf("You have Berkeley DB Version 1\n");
12400     exit(0);    /* DB version < 2: the coast is clear. */
12401 #else
12402     exit(1);    /* <db.h> not Berkeley DB? */
12403 #endif
12404 #endif
12405 }
12406 EOCP
12407         set try
12408         if eval $compile_ok && ./try; then
12409                 echo 'Looks OK.' >&4
12410         else
12411                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
12412                 i_db=$undef
12413                 case " $libs " in
12414                 *"-ldb "*)
12415                         : Remove db from list of libraries to use
12416                         echo "Removing unusable -ldb from library list" >&4
12417                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
12418                         shift
12419                         libs="$*"
12420                         echo "libs = $libs" >&4
12421                         ;;
12422                 esac
12423         fi
12424         $rm -f try.*
12425         ;;
12426 esac
12427
12428 case "$i_db" in
12429 define)
12430         : Check the return type needed for hash 
12431         echo " "
12432         echo "Checking return type needed for hash for Berkeley DB ..." >&4
12433         $cat >try.c <<EOCP
12434 #$d_const HASCONST
12435 #ifndef HASCONST
12436 #define const
12437 #endif
12438 #include <sys/types.h>
12439 #include <db.h>
12440
12441 #ifndef DB_VERSION_MAJOR
12442 u_int32_t hash_cb (ptr, size)
12443 const void *ptr;
12444 size_t size;
12445 {
12446 }
12447 HASHINFO info;
12448 int main()
12449 {
12450         info.hash = hash_cb;
12451 }
12452 #endif
12453 EOCP
12454         if $cc $ccflags -c try.c >try.out 2>&1 ; then
12455                 if $contains warning try.out >>/dev/null 2>&1 ; then
12456                         db_hashtype='int'
12457                 else
12458                         db_hashtype='u_int32_t'
12459                 fi
12460         else
12461                 : XXX Maybe we should just give up here.
12462                 db_hashtype=u_int32_t
12463                 $cat try.out >&4
12464                 echo "Help:  I can't seem to compile the db test program." >&4
12465                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
12466         fi
12467         $rm -f try.*
12468         echo "Your version of Berkeley DB uses $db_hashtype for hash."
12469         ;;
12470 *)      db_hashtype=u_int32_t
12471         ;;
12472 esac
12473 case "$i_db" in
12474 define)
12475         : Check the return type needed for prefix 
12476         echo " "
12477         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
12478         cat >try.c <<EOCP
12479 #$d_const HASCONST
12480 #ifndef HASCONST
12481 #define const
12482 #endif
12483 #include <sys/types.h>
12484 #include <db.h>
12485
12486 #ifndef DB_VERSION_MAJOR
12487 size_t prefix_cb (key1, key2)
12488 const DBT *key1;
12489 const DBT *key2;
12490 {
12491 }
12492 BTREEINFO info;
12493 int main()
12494 {
12495         info.prefix = prefix_cb;
12496 }
12497 #endif
12498 EOCP
12499         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
12500                 if $contains warning try.out >>/dev/null 2>&1 ; then
12501                         db_prefixtype='int'
12502                 else
12503                         db_prefixtype='size_t'
12504                 fi
12505         else
12506                 db_prefixtype='size_t'
12507                 : XXX Maybe we should just give up here.
12508                 $cat try.out >&4
12509                 echo "Help:  I can't seem to compile the db test program." >&4
12510                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
12511         fi
12512         $rm -f try.*
12513         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
12514         ;;
12515 *)      db_prefixtype='size_t'
12516         ;;
12517 esac
12518
12519 : check for void type
12520 echo " "
12521 echo "Checking to see how well your C compiler groks the void type..." >&4
12522 case "$voidflags" in
12523 '')
12524         $cat >try.c <<'EOCP'
12525 #if TRY & 1
12526 void sub() {
12527 #else
12528 sub() {
12529 #endif
12530         extern void moo();      /* function returning void */
12531         void (*goo)();          /* ptr to func returning void */
12532 #if TRY & 8
12533         void *hue;              /* generic ptr */
12534 #endif
12535 #if TRY & 2
12536         void (*foo[10])();
12537 #endif
12538
12539 #if TRY & 4
12540         if(goo == moo) {
12541                 exit(0);
12542         }
12543 #endif
12544         exit(0);
12545 }
12546 int main() { sub(); }
12547 EOCP
12548         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
12549                 voidflags=$defvoidused
12550         echo "Good.  It appears to support void to the level $package wants.">&4
12551                 if $contains warning .out >/dev/null 2>&1; then
12552                         echo "However, you might get some warnings that look like this:"
12553                         $cat .out
12554                 fi
12555         else
12556 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
12557                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
12558                         echo "It supports 1..."
12559                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
12560                                 echo "It also supports 2..."
12561                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
12562                                         voidflags=7
12563                                         echo "And it supports 4 but not 8 definitely."
12564                                 else
12565                                         echo "It doesn't support 4..."
12566                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
12567                                                 voidflags=11
12568                                                 echo "But it supports 8."
12569                                         else
12570                                                 voidflags=3
12571                                                 echo "Neither does it support 8."
12572                                         fi
12573                                 fi
12574                         else
12575                                 echo "It does not support 2..."
12576                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
12577                                         voidflags=13
12578                                         echo "But it supports 4 and 8."
12579                                 else
12580                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
12581                                                 voidflags=5
12582                                                 echo "And it supports 4 but has not heard about 8."
12583                                         else
12584                                                 echo "However it supports 8 but not 4."
12585                                         fi
12586                                 fi
12587                         fi
12588                 else
12589                         echo "There is no support at all for void."
12590                         voidflags=0
12591                 fi
12592         fi
12593 esac
12594 case "$voidflags" in
12595 "$defvoidused") ;;
12596 *)      $cat >&4 <<'EOM'
12597   Support flag bits are:
12598     1: basic void declarations.
12599     2: arrays of pointers to functions returning void.
12600     4: operations between pointers to and addresses of void functions.
12601     8: generic void pointers.
12602 EOM
12603         dflt="$voidflags";
12604         rp="Your void support flags add up to what?"
12605         . ./myread
12606         voidflags="$ans"
12607         ;;
12608 esac
12609 $rm -f try.* .out
12610
12611
12612 : How can we generate normalized random numbers ?
12613 echo " "
12614 echo "Looking for a random number function..." >&4
12615 case "$randfunc" in
12616 '')
12617         if set drand48 val -f; eval $csym; $val; then
12618                 dflt="drand48"
12619                 echo "Good, found drand48()." >&4
12620         elif set random val -f; eval $csym; $val; then
12621                 dflt="random"
12622                 echo "OK, found random()." >&4
12623         else
12624                 dflt="rand"
12625                 echo "Yick, looks like I have to use rand()." >&4
12626         fi
12627         echo " "
12628         ;;
12629 *)
12630         dflt="$randfunc"
12631         ;;
12632 esac
12633 cont=true
12634
12635 case "$ccflags" in
12636 *-Dmy_rand=*|*-Dmy_srand=*)
12637         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
12638         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
12639         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
12640         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
12641         ;;
12642 esac
12643
12644 while $test "$cont"; do
12645         rp="Use which function to generate random numbers?"
12646         . ./myread
12647         if $test "$ans" = "$dflt"; then
12648                 : null
12649         else
12650                 randbits=''
12651         fi
12652         randfunc="$ans"
12653         if set $ans val -f; eval $csym; $val; then
12654                 cont=''
12655         else
12656                 dflt=y
12657                 rp="I cannot find function $ans. Use that name anyway?"
12658                 . ./myread
12659                 dflt=rand
12660                 case "$ans" in
12661                         [yY]*) cont='';;
12662                 esac
12663         fi
12664         case "$cont" in
12665         '')
12666                 case "$randfunc" in
12667                 drand48)
12668                         drand01="drand48()"
12669                         seedfunc="srand48"
12670                         randbits=48
12671                         randseedtype=long
12672                         ;;
12673                 rand|random)
12674                         case "$randbits" in
12675                         '')
12676 echo "Checking to see how many bits your $randfunc() function produces..." >&4
12677                                 $cat >try.c <<EOCP
12678 #$i_unistd I_UNISTD
12679 #$i_stdlib I_STDLIB
12680 #include <stdio.h>
12681 #ifdef I_UNISTD
12682 #  include <unistd.h>
12683 #endif
12684 #ifdef I_STDLIB
12685 #  include <stdlib.h>
12686 #endif
12687 int main()
12688 {
12689         register int i;
12690         register unsigned long tmp;
12691         register unsigned long max = 0L;
12692
12693         for (i = 1000; i; i--) {
12694                 tmp = (unsigned long) $randfunc();
12695                 if (tmp > max) max = tmp;
12696         }
12697         for (i = 0; max; i++)
12698                 max /= 2;
12699         printf("%d\n",i);
12700 }
12701 EOCP
12702                                 set try
12703                                 if eval $compile_ok; then
12704                                         dflt=`try`
12705                                 else
12706                                         dflt='?'
12707                                         echo "(I can't seem to compile the test program...)"
12708                                 fi
12709                                 ;;
12710                         *)
12711                                 dflt="$randbits"
12712                                 ;;
12713                         esac
12714                         rp="How many bits does your $randfunc() function produce?"
12715                         . ./myread
12716                         randbits="$ans"
12717                         $rm -f try.c try
12718                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
12719                         seedfunc="s$randfunc"
12720                         randseedtype=unsigned
12721                         ;;
12722                 *)
12723                         dflt="31"
12724                         rp="How many bits does your $randfunc() function produce?"
12725                         . ./myread
12726                         randbits="$ans"
12727                         seedfunc="s$randfunc"
12728                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
12729                         if set $seedfunc val -f; eval $csym; $val; then
12730                                 echo "(Using $seedfunc() to seed random generator)"
12731                         else
12732                                 echo "(Warning: no $seedfunc() to seed random generator)"
12733                                 seedfunc=rand
12734                         fi
12735                         randseedtype=unsigned
12736                         ;;
12737                 esac
12738                 ;;
12739         esac
12740 done
12741
12742 echo " "
12743 echo "Determining whether or not we are on an EBCDIC system..." >&4
12744 $cat >tebcdic.c <<'EOM'
12745 int main()
12746 {
12747   if ('M'==0xd4) return 0;
12748   return 1;
12749 }
12750 EOM
12751
12752 val=$undef
12753 set tebcdic
12754 if eval $compile_ok; then
12755         if ./tebcdic; then
12756                 echo "You seem to speak EBCDIC." >&4
12757                 val="$define"
12758         else
12759                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF8." >&4
12760         fi
12761 else
12762         echo "I'm unable to compile the test program." >&4
12763         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
12764 fi
12765 $rm -f tebcdic.c tebcdic
12766 set ebcdic
12767 eval $setvar
12768
12769 echo " "
12770 $cat >&4 <<EOM
12771 Checking how to flush all pending stdio output...
12772 EOM
12773 # I only know how to find the first 32 possibly open files on SunOS.
12774 # See also hints/sunos_4_1.sh and util.c  --AD
12775 case "$osname" in
12776 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
12777 esac
12778 $cat >>try.c <<EOCP
12779 #include <stdio.h>
12780 #$i_unistd I_UNISTD
12781 #ifdef I_UNISTD
12782 # include <unistd.h>
12783 #endif
12784 #$d_sysconf HAS_SYSCONF
12785 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
12786 #ifdef HAS_STDIO_STREAM_ARRAY
12787 # define STDIO_STREAM_ARRAY $stdio_stream_array
12788 #endif
12789 int main() {
12790   FILE* p = fopen("try.out", "w");
12791 #ifdef TRY_FPUTC
12792   fputc('x', p);
12793 #else
12794 # ifdef TRY_FPRINTF
12795   fprintf(p, "x");
12796 # endif
12797 #endif
12798 #ifdef TRY_FFLUSH_NULL
12799   fflush(NULL);
12800 #endif
12801 #ifdef TRY_FFLUSH_ALL
12802   {
12803     long open_max = -1;
12804 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
12805     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
12806 # else
12807 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
12808     open_max = sysconf(_SC_OPEN_MAX);
12809 #  else
12810 #   ifdef FOPEN_MAX
12811     open_max = FOPEN_MAX;
12812 #   else
12813 #    ifdef OPEN_MAX
12814     open_max = OPEN_MAX;
12815 #    else
12816 #     ifdef _NFILE
12817     open_max = _NFILE;
12818 #     endif
12819 #    endif
12820 #   endif
12821 #  endif
12822 # endif 
12823 # ifdef HAS_STDIO_STREAM_ARRAY
12824     if (open_max > 0) {
12825       long i;
12826       for (i = 0; i < open_max; i++)
12827             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
12828                 STDIO_STREAM_ARRAY[i]._file < open_max &&
12829                 STDIO_STREAM_ARRAY[i]._flag)
12830                 fflush(&STDIO_STREAM_ARRAY[i]);
12831     }   
12832   }
12833 # endif
12834 #endif
12835   _exit(42);
12836 }
12837 EOCP
12838 : first we have to find out how _not_ to flush
12839 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
12840     output=''
12841     set try -DTRY_FPUTC
12842     if eval $compile; then
12843             $rm -f try.out
12844             ./try$exe_ext 2>/dev/null
12845             if $test ! -s try.out -a "X$?" = X42; then
12846                 output=-DTRY_FPUTC
12847             fi
12848     fi
12849     case "$output" in
12850     '')
12851             set try -DTRY_FPRINTF
12852             $rm -f try.out
12853             if eval $compile; then
12854                     $rm -f try.out
12855                     ./try$exe_ext 2>/dev/null
12856                     if $test ! -s try.out -a "X$?" = X42; then
12857                         output=-DTRY_FPRINTF
12858                     fi
12859             fi
12860         ;;
12861     esac
12862 fi
12863 : check for fflush NULL behaviour
12864 case "$fflushNULL" in
12865 '')     set try -DTRY_FFLUSH_NULL $output
12866         if eval $compile; then
12867                 $rm -f try.out
12868                 ./try$exe_ext 2>/dev/null
12869                 code="$?"
12870                 if $test -s try.out -a "X$code" = X42; then
12871                         fflushNULL="`$cat try.out`"
12872                 else
12873                         if $test "X$code" != X42; then
12874                                 $cat >&4 <<EOM
12875 (If this test failed, don't worry, we'll try another method shortly.)
12876 EOM
12877                         fi
12878                 fi
12879         fi
12880         $rm -f core try.core core.try.*
12881         case "$fflushNULL" in
12882         x)      $cat >&4 <<EOM
12883 Your fflush(NULL) works okay for output streams.
12884 Let's see if it clobbers input pipes...
12885 EOM
12886 # As of mid-March 2000 all versions of Solaris appear to have a stdio
12887 # bug that improperly flushes the input end of pipes.  So we avoid the
12888 # autoflush on fork/system/exec support for now. :-(
12889 $cat >tryp.c <<EOCP
12890 #include <stdio.h>
12891 int
12892 main(int argc, char **argv)
12893 {
12894     char buf[1024];
12895     int i;
12896     char *bp = buf;
12897     while (1) {
12898         while ((i = getc(stdin)) != -1
12899                && (*bp++ = i) != '\n'
12900                && bp < &buf[1024])
12901         /* DO NOTHING */ ;
12902         *bp = '\0';
12903         fprintf(stdout, "%s", buf);
12904         fflush(NULL);
12905         if (i == -1)
12906             return 0;
12907         bp = buf;
12908     }
12909 }
12910 EOCP
12911                 fflushNULL="$define"
12912                 set tryp
12913                 if eval $compile; then
12914                     $rm -f tryp.out
12915                     $cat tryp.c | ./tryp$exe_ext 2>/dev/null > tryp.out
12916                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
12917                        $cat >&4 <<EOM
12918 fflush(NULL) seems to behave okay with input streams.
12919 EOM
12920                         fflushNULL="$define"
12921                     else
12922                         $cat >&4 <<EOM
12923 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
12924 EOM
12925                         fflushNULL="$undef"
12926                     fi
12927                 fi
12928                 $rm -f core tryp.c tryp.core core.tryp.*
12929                 ;;
12930         '')     $cat >&4 <<EOM
12931 Your fflush(NULL) isn't working (contrary to ANSI C).
12932 EOM
12933                 fflushNULL="$undef"
12934                 ;;
12935         *)      $cat >&4 <<EOM
12936 Cannot figure out whether your fflush(NULL) works or not.
12937 I'm assuming it doesn't (contrary to ANSI C).
12938 EOM
12939                 fflushNULL="$undef"
12940                 ;;
12941         esac
12942         ;;
12943 $define|true|[yY]*)
12944         fflushNULL="$define"
12945         ;;
12946 *)
12947         fflushNULL="$undef"
12948         ;;
12949 esac
12950 : check explicit looping only if NULL did not work, and if the pipe
12951 : bug does not show up on an explicit flush too
12952 case "$fflushNULL" in
12953 "$undef")
12954         $cat >tryp.c <<EOCP
12955 #include <stdio.h>
12956 int
12957 main(int argc, char **argv)
12958 {
12959     char buf[1024];
12960     int i;
12961     char *bp = buf;
12962     while (1) {
12963         while ((i = getc(stdin)) != -1
12964                && (*bp++ = i) != '\n'
12965                && bp < &buf[1024])
12966         /* DO NOTHING */ ;
12967         *bp = '\0';
12968         fprintf(stdout, "%s", buf);
12969         fflush(stdin);
12970         if (i == -1)
12971             return 0;
12972         bp = buf;
12973     }
12974 }
12975 EOCP
12976         set tryp
12977         if eval $compile; then
12978             $rm -f tryp.out
12979             $cat tryp.c | ./tryp$exe_ext 2>/dev/null > tryp.out
12980             if cmp tryp.c tryp.out >/dev/null 2>&1; then
12981                $cat >&4 <<EOM
12982 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
12983 EOM
12984                 : now check for fflushall behaviour
12985                 case "$fflushall" in
12986                 '')     set try -DTRY_FFLUSH_ALL $output
12987                         if eval $compile; then
12988                                 $cat >&4 <<EOM
12989 (Now testing the other method--but note that this also may fail.)
12990 EOM
12991                                 $rm -f try.out
12992                                 ./try$exe_ext 2>/dev/null
12993                                 if $test -s try.out -a "X$?" = X42; then
12994                                         fflushall="`$cat try.out`"
12995                                 fi
12996                         fi
12997                         $rm -f core try.core core.try.*
12998                         case "$fflushall" in
12999                         x)      $cat >&4 <<EOM
13000 Whew. Flushing explicitly all the stdio streams works.
13001 EOM
13002                                 fflushall="$define"
13003                                 ;;
13004                         '')     $cat >&4 <<EOM
13005 Sigh. Flushing explicitly all the stdio streams doesn't work.
13006 EOM
13007                                 fflushall="$undef"
13008                                 ;;
13009                         *)      $cat >&4 <<EOM
13010 Cannot figure out whether flushing stdio streams explicitly works or not.
13011 I'm assuming it doesn't.
13012 EOM
13013                                 fflushall="$undef"
13014                                 ;;
13015                         esac
13016                         ;;
13017                 "$define"|true|[yY]*)
13018                         fflushall="$define"
13019                         ;;
13020                 *)
13021                         fflushall="$undef"
13022                         ;;
13023                 esac
13024             else
13025                 $cat >&4 <<EOM
13026 All is futile.  Even fflush(stdin) clobbers input pipes!
13027 EOM
13028                 fflushall="$undef"
13029             fi
13030         else
13031             fflushall="$undef"
13032         fi
13033         $rm -f core tryp.c tryp.core core.tryp.*
13034         ;;
13035 *)      fflushall="$undef"
13036         ;;
13037 esac
13038
13039 case "$fflushNULL$fflushall" in
13040 undefundef)
13041         $cat <<EOM
13042 OK, I give up.  I cannot figure out how to flush pending stdio output.
13043 We won't be flushing handles at all before fork/exec/popen.
13044 EOM
13045         ;;
13046 esac
13047 $rm -f try.* try$exe_ext
13048
13049 : Store the full pathname to the ar program for use in the C program
13050 : Respect a hint or command line value for full_ar.
13051 case "$full_ar" in
13052 '') full_ar=$ar ;;
13053 esac
13054
13055 : Store the full pathname to the sed program for use in the C program
13056 full_sed=$sed
13057
13058 : see what type gids are declared as in the kernel
13059 echo " "
13060 echo "Looking for the type for group ids returned by getgid()."
13061 set gid_t gidtype xxx stdio.h sys/types.h
13062 eval $typedef
13063 case "$gidtype" in
13064 xxx)
13065         xxx=`./findhdr sys/user.h`
13066         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
13067         case $1 in
13068         unsigned) dflt="$1 $2" ;;
13069         *) dflt="$1" ;;
13070         esac
13071         ;;
13072 *) dflt="$gidtype";;
13073 esac
13074 case "$gidtype" in
13075 gid_t) echo "gid_t found." ;;
13076 *)      rp="What is the type for group ids returned by getgid()?"
13077         . ./myread
13078         gidtype="$ans"
13079         ;;
13080 esac
13081
13082 echo " "
13083 case "$gidtype" in
13084 *_t) zzz="$gidtype"     ;;
13085 *)   zzz="gid"          ;;
13086 esac
13087 echo "Checking the size of $zzz..." >&4 
13088 cat > try.c <<EOCP
13089 #include <sys/types.h>
13090 #include <stdio.h>
13091 int main() {
13092     printf("%d\n", (int)sizeof($gidtype));
13093     exit(0);
13094 }
13095 EOCP
13096 set try
13097 if eval $compile_ok; then
13098         yyy=`./try`
13099         case "$yyy" in
13100         '')     gidsize=4
13101                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
13102                 ;;
13103         *)      gidsize=$yyy
13104                 echo "Your $zzz is $gidsize bytes long."
13105                 ;;
13106         esac
13107 else
13108         gidsize=4
13109         echo "(I can't compile the test program--guessing $gidsize.)" >&4
13110 fi
13111
13112
13113 echo " "
13114 case "$gidtype" in
13115 *_t) zzz="$gidtype"     ;;
13116 *)   zzz="gid"          ;;
13117 esac
13118 echo "Checking the sign of $zzz..." >&4 
13119 cat > try.c <<EOCP
13120 #include <sys/types.h>
13121 #include <stdio.h>
13122 int main() {
13123         $gidtype foo = -1;
13124         if (foo < 0)
13125                 printf("-1\n");
13126         else
13127                 printf("1\n");
13128 }
13129 EOCP
13130 set try
13131 if eval $compile; then
13132         yyy=`./try`
13133         case "$yyy" in
13134         '')     gidsign=1
13135                 echo "(I can't execute the test program--guessing unsigned.)" >&4
13136                 ;;
13137         *)      gidsign=$yyy
13138                 case "$gidsign" in
13139                  1) echo "Your $zzz is unsigned." ;;
13140                 -1) echo "Your $zzz is signed."   ;;
13141                 esac
13142                 ;;
13143         esac
13144 else
13145         gidsign=1
13146         echo "(I can't compile the test program--guessing unsigned.)" >&4
13147 fi
13148
13149
13150 echo " "
13151
13152 if $test X"$quadtype" != X; then
13153
13154 echo "Checking how to print 64-bit integers..." >&4
13155
13156 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
13157         $cat >try.c <<'EOCP'
13158 #include <sys/types.h>
13159 #include <stdio.h>
13160 int main() {
13161   int q = 12345678901;
13162   printf("%ld\n", q);
13163 }
13164 EOCP
13165         set try
13166         if eval $compile; then
13167                 yyy=`./try$exe_ext`
13168                 case "$yyy" in
13169                 12345678901)
13170                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
13171                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
13172                         echo "We will use %d."
13173                         ;;
13174                 esac
13175         fi
13176 fi
13177
13178 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
13179         $cat >try.c <<'EOCP'
13180 #include <sys/types.h>
13181 #include <stdio.h>
13182 int main() {
13183   long q = 12345678901;
13184   printf("%ld\n", q);
13185 }
13186 EOCP
13187         set try
13188         if eval $compile; then
13189                 yyy=`./try$exe_ext`
13190                 case "$yyy" in
13191                 12345678901)
13192                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
13193                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
13194                         echo "We will use %ld."
13195                         ;;
13196                 esac
13197         fi
13198 fi
13199
13200 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
13201         $cat >try.c <<'EOCP'
13202 #include <sys/types.h>
13203 #include <inttypes.h>
13204 #include <stdio.h>
13205 int main() {
13206   int64_t q = 12345678901;
13207   printf("%" PRId64 "\n", q);
13208 }
13209 EOCP
13210         set try
13211         if eval $compile; then
13212                 yyy=`./try$exe_ext`
13213                 case "$yyy" in
13214                 12345678901)
13215                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
13216                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
13217                         echo "We will use the C9X style."
13218                         ;;
13219                 esac
13220         fi
13221 fi
13222
13223 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
13224         $cat >try.c <<'EOCP'
13225 #include <sys/types.h>
13226 #include <stdio.h>
13227 int main() {
13228   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
13229   printf("%lld\n", q);
13230 }
13231 EOCP
13232         set try
13233         if eval $compile; then
13234                 yyy=`./try$exe_ext`
13235                 case "$yyy" in
13236                 12345678901)
13237                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
13238                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
13239                         echo "We will use the %lld style."
13240                         ;;
13241                 esac
13242         fi
13243 fi
13244
13245 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
13246         $cat >try.c <<EOCP
13247 #include <sys/types.h>
13248 #include <stdio.h>
13249 int main() {
13250   $quadtype q = 12345678901;
13251   printf("%Ld\n", q);
13252 }
13253 EOCP
13254         set try
13255         if eval $compile; then
13256                 yyy=`./try$exe_ext`
13257                 case "$yyy" in
13258                 12345678901)
13259                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
13260                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
13261                         echo "We will use %Ld."
13262                         ;;
13263                 esac
13264         fi
13265 fi
13266
13267 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
13268         $cat >try.c <<EOCP
13269 #include <sys/types.h>
13270 #include <stdio.h>
13271 int main() {
13272   $quadtype q = 12345678901;
13273   printf("%qd\n", q);
13274 }
13275 EOCP
13276         set try
13277         if eval $compile; then
13278                 yyy=`./try$exe_ext`
13279                 case "$yyy" in
13280                 12345678901)
13281                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
13282                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
13283                         echo "We will use %qd."
13284                         ;;
13285                 esac
13286         fi
13287 fi
13288
13289 if $test X"$sPRId64" = X; then
13290         echo "Cannot figure out how to print 64-bit integers." >&4
13291 fi
13292
13293 $rm -f try try.*
13294
13295 fi
13296
13297 case "$sPRId64" in
13298 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef"; 
13299         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef"; 
13300         ;;
13301 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define"; 
13302         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define"; 
13303         ;;
13304 esac
13305
13306
13307 echo " "
13308 $echo "Checking the format strings to be used for Perl's internal types..." >&4
13309
13310 if $test X"$ivsize" = X8; then
13311         ivdformat="$sPRId64"
13312         uvuformat="$sPRIu64"
13313         uvoformat="$sPRIo64"
13314         uvxformat="$sPRIx64"
13315         uvXUformat="$sPRIXU64"
13316 else
13317         if $test X"$ivsize" = X"$longsize"; then
13318                 ivdformat='"ld"'
13319                 uvuformat='"lu"'
13320                 uvoformat='"lo"'
13321                 uvxformat='"lx"'
13322                 uvXUformat='"lX"'
13323         else
13324                 if $test X"$ivsize" = X"$intsize"; then
13325                         ivdformat='"d"'
13326                         uvuformat='"u"'
13327                         uvoformat='"o"'
13328                         uvxformat='"x"'
13329                         uvXUformat='"X"'
13330                 else
13331                         : far out
13332                         if $test X"$ivsize" = X"$shortsize"; then
13333                                 ivdformat='"hd"'
13334                                 uvuformat='"hu"'
13335                                 uvoformat='"ho"'
13336                                 uvxformat='"hx"'
13337                                 uvXUformat='"hX"'
13338                         fi
13339                 fi
13340         fi
13341 fi
13342
13343 if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
13344         nveformat="$sPRIeldbl"
13345         nvfformat="$sPRIfldbl"
13346         nvgformat="$sPRIgldbl"
13347         nvEUformat="$sPRIEUldbl"
13348         nvFUformat="$sPRIFUldbl"
13349         nvGUformat="$sPRIGUldbl"
13350 else
13351         nveformat='"e"'
13352         nvfformat='"f"'
13353         nvgformat='"g"'
13354         nvEUformat='"E"'
13355         nvFUformat='"F"'
13356         nvGUformat='"G"'
13357 fi
13358
13359 case "$ivdformat" in
13360 '') echo "$0: Fatal: failed to find format strings, cannot continue." >& 4
13361     exit 1
13362     ;;
13363 esac
13364
13365
13366 echo " "
13367 $echo "Checking the format string to be used for gids..." >&4
13368
13369 case "$gidsign" in
13370 -1)     if $test X"$gidsize" = X"$ivsize"; then
13371                 gidformat="$ivdformat"
13372         else
13373                 if $test X"$gidsize" = X"$longsize"; then
13374                         gidformat='"ld"'
13375                 else
13376                         if $test X"$gidsize" = X"$intsize"; then
13377                                 gidformat='"d"'
13378                         else
13379                                 if $test X"$gidsize" = X"$shortsize"; then
13380                                         gidformat='"hd"'
13381                                 fi
13382                         fi
13383                 fi
13384         fi
13385         ;;
13386 *)      if $test X"$gidsize" = X"$uvsize"; then
13387                 gidformat="$uvuformat"
13388         else
13389                 if $test X"$gidsize" = X"$longsize"; then
13390                         gidformat='"lu"'
13391                 else
13392                         if $test X"$gidsize" = X"$intsize"; then
13393                                 gidformat='"u"'
13394                         else
13395                                 if $test X"$gidsize" = X"$shortsize"; then
13396                                         gidformat='"hu"'
13397                                 fi
13398                         fi
13399                 fi
13400         fi
13401         ;;
13402 esac
13403
13404 : see if getgroups exists
13405 set getgroups d_getgrps
13406 eval $inlibc
13407
13408 : see if setgroups exists
13409 set setgroups d_setgrps
13410 eval $inlibc
13411
13412
13413 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
13414 echo " "
13415 case "$d_getgrps$d_setgrps" in
13416 *define*)
13417         case "$groupstype" in
13418         '') dflt="$gidtype" ;;
13419         *)  dflt="$groupstype" ;;
13420         esac
13421         $cat <<EOM
13422 What type of pointer is the second argument to getgroups() and setgroups()?
13423 Usually this is the same as group ids, $gidtype, but not always.
13424
13425 EOM
13426         rp='What type pointer is the second argument to getgroups() and setgroups()?'
13427         . ./myread
13428         groupstype="$ans"
13429         ;;
13430 *)  groupstype="$gidtype";;
13431 esac
13432
13433 echo " "
13434 echo "Checking if your $make program sets \$(MAKE)..." >&4
13435 case "$make_set_make" in
13436 '')
13437         $sed 's/^X //' > testmake.mak << 'EOF'
13438 Xall:
13439 X       @echo 'maketemp="$(MAKE)"'
13440 EOF
13441         case "`$make -f testmake.mak 2>/dev/null`" in
13442         *maketemp=*) make_set_make='#' ;;
13443         *)      make_set_make="MAKE=$make" ;;
13444         esac
13445         $rm -f testmake.mak
13446         ;;
13447 esac
13448 case "$make_set_make" in
13449 '#') echo "Yup, it does.";;
13450 *) echo "Nope, it doesn't.";;
13451 esac
13452
13453 : see what type is used for mode_t
13454 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
13455 set mode_t modetype int stdio.h sys/types.h
13456 eval $typedef_ask
13457
13458 : define a fucntion to check prototypes
13459 $cat > protochk <<EOSH
13460 $startsh
13461 cc="$cc"
13462 optimize="$optimize"
13463 ccflags="$ccflags"
13464 prototype="$prototype"
13465 define="$define"
13466 rm=$rm
13467 EOSH
13468
13469 $cat >> protochk <<'EOSH'
13470
13471 $rm -f try.c
13472 foo="$1"
13473 shift
13474 while test $# -ge 2; do
13475         case "$1" in
13476                 $define) echo "#include <$2>" >> try.c ;;
13477                 literal) echo "$2" >> try.c ;;
13478         esac
13479     shift 2
13480 done
13481 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
13482 cat >> try.c <<'EOCP'
13483 #ifdef CAN_PROTOTYPE
13484 #define _(args) args
13485 #else
13486 #define _(args) ()
13487 #endif
13488 EOCP
13489 echo "$foo" >> try.c
13490 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
13491 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
13492 status=$?
13493 $rm -f try.[co]
13494 exit $status
13495 EOSH
13496 chmod +x protochk
13497 $eunicefix protochk
13498
13499 : see what type is used for size_t
13500 rp="What is the type used for the length parameter for string functions?"
13501 set size_t sizetype 'unsigned int' stdio.h sys/types.h
13502 eval $typedef_ask
13503
13504 : check for type of arguments to gethostbyaddr. 
13505 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
13506         case "$d_gethbyaddr" in
13507         $define)
13508                 $cat <<EOM
13509
13510 Checking to see what type of arguments are accepted by gethostbyaddr().
13511 EOM
13512                 hdrs="$define sys/types.h
13513                         $d_socket sys/socket.h 
13514                         $i_niin netinet/in.h 
13515                         $i_netdb netdb.h
13516                         $i_unistd unistd.h"
13517                 : The first arg can 'char *' or 'void *'
13518                 : The second arg is some of integral type
13519                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
13520                         for yyy in size_t long int; do
13521                                 case "$netdb_host_type" in
13522                                 '')     try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
13523                                         if ./protochk "$try" $hdrs; then
13524                                                 echo "Your system accepts $xxx for the first arg."
13525                                                 echo "...and $yyy for the second arg."
13526                                                 netdb_host_type="$xxx"
13527                                                 netdb_hlen_type="$yyy"
13528                                         fi
13529                                         ;;
13530                                 esac
13531                         done
13532                 done
13533                 : In case none of those worked, prompt the user.
13534                 case "$netdb_host_type" in
13535                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
13536                         dflt='char *'
13537                         . ./myread
13538                         netdb_host_type=$ans
13539                         rp='What is the type for the 2nd argument to gethostbyaddr?'
13540                         dflt="$sizetype"
13541                         . ./myread
13542                         netdb_hlen_type=$ans
13543                         ;;
13544                 esac
13545                 ;;
13546         *)      : no gethostbyaddr, so pick harmless defaults
13547                 netdb_host_type='char *'
13548                 netdb_hlen_type="$sizetype"
13549                 ;;
13550         esac
13551         # Remove the "const" if needed. -- but then we'll have a 
13552         # prototype clash!
13553         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
13554 fi
13555
13556 : check for type of argument to gethostbyname. 
13557 if test "X$netdb_name_type" = X ; then
13558         case "$d_gethbyname" in
13559         $define)
13560                 $cat <<EOM
13561
13562 Checking to see what type of argument is accepted by gethostbyname().
13563 EOM
13564                 hdrs="$define sys/types.h
13565                         $d_socket sys/socket.h 
13566                         $i_niin netinet/in.h 
13567                         $i_netdb netdb.h
13568                         $i_unistd unistd.h"
13569                 for xxx in "const char *" "char *"; do
13570                         case "$netdb_name_type" in
13571                         '')     try="extern struct hostent *gethostbyname($xxx);"
13572                                 if ./protochk "$try" $hdrs; then
13573                                         echo "Your system accepts $xxx."
13574                                         netdb_name_type="$xxx"
13575                                 fi
13576                                 ;;
13577                         esac
13578                 done
13579                 : In case none of those worked, prompt the user.
13580                 case "$netdb_name_type" in
13581                 '')     rp='What is the type for the 1st argument to gethostbyname?'
13582                         dflt='char *'
13583                         . ./myread
13584                         netdb_name_type=$ans
13585                         ;;
13586                 esac
13587                 ;;
13588         *)      : no gethostbyname, so pick harmless default
13589                 netdb_name_type='char *'
13590                 ;;
13591         esac
13592 fi
13593
13594 : check for type of 1st argument to getnetbyaddr. 
13595 if test "X$netdb_net_type" = X ; then
13596         case "$d_getnbyaddr" in
13597         $define)
13598                 $cat <<EOM
13599
13600 Checking to see what type of 1st argument is accepted by getnetbyaddr().
13601 EOM
13602                 hdrs="$define sys/types.h
13603                         $d_socket sys/socket.h 
13604                         $i_niin netinet/in.h 
13605                         $i_netdb netdb.h
13606                         $i_unistd unistd.h"
13607                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
13608                         case "$netdb_net_type" in
13609                         '')     try="extern struct netent *getnetbyaddr($xxx, int);"
13610                                 if ./protochk "$try" $hdrs; then
13611                                         echo "Your system accepts $xxx."
13612                                         netdb_net_type="$xxx"
13613                                 fi
13614                                 ;;
13615                         esac
13616                 done
13617                 : In case none of those worked, prompt the user.
13618                 case "$netdb_net_type" in
13619                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
13620                         dflt='long'
13621                         . ./myread
13622                         netdb_net_type=$ans
13623                         ;;
13624                 esac
13625                 ;;
13626         *)      : no getnetbyaddr, so pick harmless default
13627                 netdb_net_type='long'
13628                 ;;
13629         esac
13630 fi
13631 : locate the preferred pager for this system
13632 case "$pager" in
13633 '')
13634         dflt=''
13635         case "$pg" in
13636         /*) dflt=$pg;;
13637         [a-zA-Z]:/*) dflt=$pg;;
13638         esac
13639         case "$more" in
13640         /*) dflt=$more;;
13641         [a-zA-Z]:/*) dflt=$more;;
13642         esac
13643         case "$less" in
13644         /*) dflt=$less;;
13645         [a-zA-Z]:/*) dflt=$less;;
13646         esac
13647         case "$dflt" in
13648         '') dflt=/usr/ucb/more;;
13649         esac
13650         ;;
13651 *) dflt="$pager";;
13652 esac
13653 echo " "
13654 fn=f/
13655 rp='What pager is used on your system?'
13656 . ./getfile
13657 pager="$ans"
13658
13659 : see what type pids are declared as in the kernel
13660 rp="What is the type of process ids on this system?"
13661 set pid_t pidtype int stdio.h sys/types.h
13662 eval $typedef_ask
13663
13664 : Find earliest binary compatible site_perl subdirectory perl can use.
13665 case "$bincompat5005" in
13666 "$define") xs_apiversion='5.005' ;;
13667 *) xs_apiversion=$version ;;   # The current site_perl version.
13668 esac
13669 : Find earliest pure perl site_perl subdirectory perl can use.
13670 : The versioned directories started at 5.005.
13671 pm_apiversion='5.005'
13672
13673 : check for length of pointer
13674 echo " "
13675 case "$ptrsize" in
13676 '')
13677         echo "Checking to see how big your pointers are..." >&4
13678         if test "$voidflags" -gt 7; then
13679                 echo '#define VOID_PTR char *' > try.c
13680         else
13681                 echo '#define VOID_PTR void *' > try.c
13682         fi
13683         $cat >>try.c <<'EOCP'
13684 #include <stdio.h>
13685 int main()
13686 {
13687     printf("%d\n", (int)sizeof(VOID_PTR));
13688     exit(0);
13689 }
13690 EOCP
13691         set try
13692         if eval $compile_ok; then
13693                 ptrsize=`./try`
13694                 echo "Your pointers are $ptrsize bytes long."
13695         else
13696                 dflt='4'
13697                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
13698                 rp="What is the size of a pointer (in bytes)?"
13699                 . ./myread
13700                 ptrsize="$ans"
13701         fi
13702         ;;
13703 esac
13704 $rm -f try.c try
13705
13706 : see if ar generates random libraries by itself
13707 echo " "
13708 echo "Checking how to generate random libraries on your machine..." >&4
13709 echo 'int bar1() { return bar2(); }' > bar1.c
13710 echo 'int bar2() { return 2; }' > bar2.c
13711 $cat > foo.c <<'EOP'
13712 int main() { printf("%d\n", bar1()); exit(0); }
13713 EOP
13714 $cc $ccflags -c bar1.c >/dev/null 2>&1
13715 $cc $ccflags -c bar2.c >/dev/null 2>&1
13716 $cc $ccflags -c foo.c >/dev/null 2>&1
13717 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
13718 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
13719         ./foobar >/dev/null 2>&1; then
13720         echo "$ar appears to generate random libraries itself."
13721         orderlib=false
13722         ranlib=":"
13723 elif $ar ts bar$_a >/dev/null 2>&1 &&
13724         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
13725         ./foobar >/dev/null 2>&1; then
13726                 echo "a table of contents needs to be added with '$ar ts'."
13727                 orderlib=false
13728                 ranlib="$ar ts"
13729 else
13730         case "$ranlib" in
13731         :) ranlib='';;
13732         '')
13733                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
13734                 $test -f $ranlib || ranlib=''
13735                 ;;
13736         esac
13737         if $test -n "$ranlib"; then
13738                 echo "your system has '$ranlib'; we'll use that."
13739                 orderlib=false
13740         else
13741                 echo "your system doesn't seem to support random libraries"
13742                 echo "so we'll use lorder and tsort to order the libraries."
13743                 orderlib=true
13744                 ranlib=":"
13745         fi
13746 fi
13747 $rm -f foo* bar* 
13748
13749 : check for type of arguments to select. 
13750 case "$selecttype" in
13751 '') case "$d_select" in
13752         $define)
13753                 echo " "
13754                 $cat <<EOM
13755 Checking to see what type of arguments are accepted by select().
13756 EOM
13757                 hdrs="$define sys/types.h
13758                         $i_systime sys/time.h 
13759                         $i_sysselct sys/select.h
13760                         $d_socket sys/socket.h"
13761                 : The first arg can be int, unsigned, or size_t
13762                 : The last arg may or may not be 'const'
13763                 val=''
13764                 : void pointer has been seen but using that
13765                 : breaks the selectminbits test
13766                 for xxx in 'fd_set *' 'int *'; do
13767                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
13768                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
13769                                         case "$val" in
13770                                         '')     try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
13771                                                 if ./protochk "$try" $hdrs; then
13772                                                         echo "Your system accepts $xxx."
13773                                                         val="$xxx"
13774                                                 fi
13775                                                 ;;
13776                                         esac
13777                                 done
13778                         done
13779                 done
13780                 case "$val" in
13781                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
13782                         case "$d_fd_set" in
13783                                 $define) dflt="fd_set *" ;;
13784                                 *)              dflt="int *" ;;
13785                         esac
13786                         . ./myread
13787                         val=$ans
13788                         ;;
13789                 esac
13790                 selecttype="$val"
13791                 ;;
13792         *)      : no select, so pick a harmless default
13793                 selecttype='int *'
13794                 ;;
13795         esac
13796         ;;
13797 esac
13798
13799 : check for the select 'width'
13800 case "$selectminbits" in
13801 '') case "$d_select" in
13802         $define)
13803                 $cat <<EOM
13804
13805 Checking to see on how many bits at a time your select() operates...
13806 EOM
13807                 $cat >try.c <<EOCP
13808 #include <sys/types.h>
13809 #$i_time I_TIME
13810 #$i_systime I_SYS_TIME
13811 #$i_systimek I_SYS_TIME_KERNEL
13812 #ifdef I_TIME
13813 #   include <time.h>
13814 #endif
13815 #ifdef I_SYS_TIME
13816 #   ifdef I_SYS_TIME_KERNEL
13817 #       define KERNEL
13818 #   endif
13819 #   include <sys/time.h>
13820 #   ifdef I_SYS_TIME_KERNEL
13821 #       undef KERNEL
13822 #   endif
13823 #endif
13824 #$i_sysselct I_SYS_SELECT
13825 #ifdef I_SYS_SELECT
13826 #include <sys/select.h>
13827 #endif
13828 #$d_socket HAS_SOCKET
13829 #ifdef HAS_SOCKET
13830 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
13831 #endif
13832 #include <stdio.h>
13833 $selecttype b;
13834 #define S sizeof(*(b))
13835 #define MINBITS 64
13836 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
13837 #define NBITS  (NBYTES * 8)
13838 int main() {
13839     char s[NBYTES];
13840     struct timeval t;
13841     int i;
13842     FILE* fp;
13843     int fd;
13844
13845     fclose(stdin);
13846     fp = fopen("try.c", "r");
13847     if (fp == 0)
13848       exit(1);
13849     fd = fileno(fp);
13850     if (fd < 0)
13851       exit(2);
13852     b = ($selecttype)s;
13853     for (i = 0; i < NBITS; i++)
13854         FD_SET(i, b);
13855     t.tv_sec  = 0;
13856     t.tv_usec = 0;
13857     select(fd + 1, b, 0, 0, &t);
13858     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
13859     printf("%d\n", i + 1);
13860     return 0;
13861 }
13862 EOCP
13863                 set try
13864                 if eval $compile_ok; then
13865                         selectminbits=`./try`
13866                         case "$selectminbits" in
13867                         '')     cat >&4 <<EOM
13868 Cannot figure out on how many bits at a time your select() operates.
13869 I'll play safe and guess it is 32 bits.
13870 EOM
13871                                 selectminbits=32
13872                                 bits="32 bits"
13873                                 ;;
13874                         1)      bits="1 bit" ;;
13875                         *)      bits="$selectminbits bits" ;;
13876                         esac
13877                         echo "Your select() operates on $bits at a time." >&4
13878                 else
13879                         rp='What is the minimum number of bits your select() operates on?'
13880                         case "$byteorder" in
13881                         1234|12345678)  dflt=32 ;;
13882                         *)              dflt=1  ;;
13883                         esac
13884                         . ./myread
13885                         val=$ans
13886                         selectminbits="$val"
13887                 fi
13888                 $rm -f try.* try
13889                 ;;
13890         *)      : no select, so pick a harmless default
13891                 selectminbits='32'
13892                 ;;
13893         esac
13894         ;;
13895 esac
13896
13897 : Trace out the files included by signal.h, then look for SIGxxx names.
13898 : Remove SIGARRAYSIZE used by HPUX.
13899 : Remove SIGSTKSIZE used by Linux.
13900 : Remove SIGSTKSZ used by Posix.
13901 : Remove SIGTYP void lines used by OS2.
13902 : Some cpps, like os390, dont give the file name anywhere
13903 if [ "X$fieldn" = X ]; then
13904         : Just make some guesses.  We check them later.
13905         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
13906 else
13907         xxx=`echo '#include <signal.h>' |
13908         $cppstdin $cppminus $cppflags 2>/dev/null |
13909         $grep '^[       ]*#.*include' | 
13910         $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sort | $uniq`
13911 fi
13912 : Check this list of files to be sure we have parsed the cpp output ok.
13913 : This will also avoid potentially non-existent files, such 
13914 : as ../foo/bar.h
13915 xxxfiles=''
13916 for xx in $xxx /dev/null ; do
13917         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
13918 done
13919 : If we have found no files, at least try signal.h
13920 case "$xxxfiles" in
13921 '')     xxxfiles=`./findhdr signal.h` ;;
13922 esac
13923 xxx=`awk '
13924 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
13925         print substr($2, 4, 20)
13926 }
13927 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
13928         print substr($3, 4, 20)
13929 }' $xxxfiles`
13930 : Append some common names just in case the awk scan failed.
13931 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
13932 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
13933 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
13934 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
13935 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
13936
13937 : generate a few handy files for later
13938 $cat > signal.c <<'EOCP'
13939 #include <sys/types.h>
13940 #include <signal.h>
13941 #include <stdio.h>
13942 int main() {
13943
13944 /* Strange style to avoid deeply-nested #if/#else/#endif */
13945 #ifndef NSIG
13946 #  ifdef _NSIG
13947 #    define NSIG (_NSIG)
13948 #  endif
13949 #endif
13950
13951 #ifndef NSIG
13952 #  ifdef SIGMAX
13953 #    define NSIG (SIGMAX+1)
13954 #  endif
13955 #endif
13956
13957 #ifndef NSIG
13958 #  ifdef SIG_MAX
13959 #    define NSIG (SIG_MAX+1)
13960 #  endif
13961 #endif
13962
13963 #ifndef NSIG
13964 #  ifdef MAXSIG
13965 #    define NSIG (MAXSIG+1)
13966 #  endif
13967 #endif
13968
13969 #ifndef NSIG
13970 #  ifdef MAX_SIG
13971 #    define NSIG (MAX_SIG+1)
13972 #  endif
13973 #endif
13974
13975 #ifndef NSIG
13976 #  ifdef SIGARRAYSIZE
13977 #    define NSIG (SIGARRAYSIZE+1) /* Not sure of the +1 */
13978 #  endif
13979 #endif
13980
13981 #ifndef NSIG
13982 #  ifdef _sys_nsig
13983 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
13984 #  endif
13985 #endif
13986
13987 /* Default to some arbitrary number that's big enough to get most
13988    of the common signals.
13989 */
13990 #ifndef NSIG
13991 #    define NSIG 50
13992 #endif
13993
13994 printf("NSIG %d\n", NSIG);
13995
13996 #ifndef JUST_NSIG
13997
13998 EOCP
13999
14000 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
14001 {
14002         printf "#ifdef SIG"; printf $1; printf "\n"
14003         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
14004         printf $1; printf ");\n"
14005         printf "#endif\n"
14006 }
14007 END {
14008         printf "#endif /* JUST_NSIG */\n";
14009         printf "exit(0);\n}\n";
14010 }
14011 ' >>signal.c
14012 $cat >signal.awk <<'EOP'
14013 BEGIN { ndups = 0 }
14014 $1 ~ /^NSIG$/ { nsig = $2 }
14015 ($1 !~ /^NSIG$/) && (NF == 2) {
14016     if ($2 > maxsig) { maxsig = $2 }
14017     if (sig_name[$2]) {
14018         dup_name[ndups] = $1
14019         dup_num[ndups] = $2
14020         ndups++ 
14021     }
14022     else {
14023         sig_name[$2] = $1
14024         sig_num[$2] = $2
14025     }
14026 }
14027 END { 
14028     if (nsig == 0) {
14029         nsig = maxsig + 1
14030     }
14031     printf("NSIG %d\n", nsig);
14032     for (n = 1; n < nsig; n++) {
14033         if (sig_name[n]) {
14034             printf("%s %d\n", sig_name[n], sig_num[n])
14035         }
14036         else {
14037             printf("NUM%d %d\n", n, n) 
14038         }
14039     }
14040     for (n = 0; n < ndups; n++) {
14041         printf("%s %d\n", dup_name[n], dup_num[n])
14042     }
14043 }
14044 EOP
14045 $cat >signal_cmd <<EOS
14046 $startsh
14047 if $test -s signal.lst; then
14048     echo "Using your existing signal.lst file"
14049         exit 0
14050 fi
14051 xxx="$xxx"
14052 EOS
14053 $cat >>signal_cmd <<'EOS'
14054
14055 set signal
14056 if eval $compile_ok; then
14057         ./signal$_exe | $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
14058 else
14059         echo "(I can't seem be able to compile the whole test program)" >&4
14060         echo "(I'll try it in little pieces.)" >&4
14061         set signal -DJUST_NSIG
14062         if eval $compile_ok; then
14063                 ./signal$_exe > signal.nsg
14064                 $cat signal.nsg
14065         else
14066                 echo "I can't seem to figure out how many signals you have." >&4
14067                 echo "Guessing 50." >&4
14068                 echo 'NSIG 50' > signal.nsg
14069         fi
14070         : Now look at all the signal names, one at a time.
14071         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
14072                 $cat > signal.c <<EOCP
14073 #include <sys/types.h>
14074 #include <signal.h>
14075 #include <stdio.h>
14076 int main() {
14077 printf("$xx %d\n", SIG${xx});
14078 return 0;
14079 }
14080 EOCP
14081                 set signal
14082                 if eval $compile; then
14083                         echo "SIG${xx} found."
14084                         ./signal$_exe  >> signal.ls1
14085                 else
14086                         echo "SIG${xx} NOT found."
14087                 fi
14088         done
14089         if $test -s signal.ls1; then
14090                 $cat signal.nsg signal.ls1 |
14091                         $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
14092         fi
14093
14094 fi
14095 if $test -s signal.lst; then
14096         :
14097 else
14098         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
14099         echo 'kill -l' >signal
14100         set X `csh -f <signal`
14101         $rm -f signal
14102         shift
14103         case $# in
14104         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
14105         esac
14106         echo $@ | $tr ' ' $trnl | \
14107             $awk '{ printf "%s %d\n", $1, ++s; }
14108                   END { printf "NSIG %d\n", ++s }' >signal.lst
14109 fi
14110 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
14111 EOS
14112 chmod a+x signal_cmd
14113 $eunicefix signal_cmd
14114
14115 : generate list of signal names
14116 echo " "
14117 case "$sig_name_init" in
14118 '') doinit=yes ;;
14119 *)  case "$sig_num_init" in
14120     ''|*,*) doinit=yes ;;
14121     esac ;;
14122 esac
14123 case "$doinit" in
14124 yes)
14125         echo "Generating a list of signal names and numbers..." >&4
14126         . ./signal_cmd
14127         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
14128         sig_name=`$awk 'BEGIN { printf "ZERO " }
14129                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
14130         sig_num=`$awk  'BEGIN { printf "0 " }
14131                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
14132         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
14133                              !/^NSIG/   { printf "\"%s\", ", $1 }
14134                              END        { printf "0\n" }' signal.lst`
14135         sig_num_init=`$awk  'BEGIN      { printf "0, " }
14136                              !/^NSIG/   { printf "%d, ", $2}
14137                              END        { printf "0\n"}' signal.lst`
14138         ;;
14139 esac
14140 echo "The following $sig_count signals are available:"
14141 echo " "
14142 echo $sig_name | $awk \
14143 'BEGIN { linelen = 0 }
14144 {
14145         for (i = 1; i <= NF; i++) {
14146                 name = "SIG" $i " "
14147                 linelen = linelen + length(name)
14148                 if (linelen > 70) {
14149                         printf "\n"
14150                         linelen = length(name)
14151                 }
14152                 printf "%s", name
14153         }
14154         printf "\n"
14155 }'
14156 $rm -f signal signal.c signal.awk signal.lst signal_cmd 
14157
14158 echo " "
14159 case "$sizetype" in
14160 *_t) zzz="$sizetype"    ;;
14161 *)   zzz="filesize"     ;;
14162 esac
14163 echo "Checking the size of $zzz..." >&4 
14164 cat > try.c <<EOCP
14165 #include <sys/types.h>
14166 #include <stdio.h>
14167 int main() {
14168     printf("%d\n", (int)sizeof($sizetype));
14169     exit(0);
14170 }
14171 EOCP
14172 set try
14173 if eval $compile_ok; then
14174         yyy=`./try`
14175         case "$yyy" in
14176         '')     sizesize=4
14177                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
14178                 ;;
14179         *)      sizesize=$yyy
14180                 echo "Your $zzz size is $sizesize bytes."
14181                 ;;
14182         esac
14183 else
14184         sizesize=4
14185         echo "(I can't compile the test program--guessing $sizesize.)" >&4
14186 fi
14187
14188
14189 : check for socklen_t
14190 echo " "
14191 echo "Checking to see if you have socklen_t..." >&4
14192 $cat >try.c <<EOCP
14193 #include <sys/types.h>
14194 #$d_socket HAS_SOCKET
14195 #ifdef HAS_SOCKET
14196 #include <sys/socket.h>
14197 #endif
14198 int main() { socklen_t x = 16; }
14199 EOCP
14200 set try
14201 if eval $compile; then
14202         val="$define"
14203         echo "You have socklen_t."
14204 else
14205         val="$undef"
14206         echo "You do not have socklen_t."
14207         case "$sizetype" in
14208         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
14209         esac
14210 fi
14211 $rm -f try try.*
14212 set d_socklen_t
14213 eval $setvar
14214
14215 : see if this is a socks.h system
14216 set socks.h i_socks
14217 eval $inhdr
14218
14219 : check for type of the size argument to socket calls
14220 case "$d_socket" in
14221 "$define")
14222         $cat <<EOM
14223
14224 Checking to see what type is the last argument of accept().
14225 EOM
14226         yyy=''
14227         case "$d_socklen_t" in
14228         "$define") yyy="$yyy socklen_t"
14229         esac
14230         yyy="$yyy $sizetype int long unsigned"
14231         for xxx in $yyy; do
14232                 case "$socksizetype" in
14233                 '')     try="extern int accept(int, struct sockaddr *, $xxx *);"
14234                         case "$usesocks" in
14235                         "$define")
14236                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
14237                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
14238                                         socksizetype="$xxx"
14239                                 fi
14240                                 ;;
14241                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
14242                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
14243                                         socksizetype="$xxx"
14244                                 fi
14245                                 ;;
14246                         esac
14247                         ;;
14248                 esac
14249         done
14250 : In case none of those worked, prompt the user.
14251         case "$socksizetype" in
14252         '')     rp='What is the type for socket address structure sizes?'
14253                 dflt='int'
14254                 . ./myread
14255                 socksizetype=$ans
14256                 ;;
14257         esac
14258         ;;
14259 *)      : no sockets, so pick relatively harmless default
14260         socksizetype='int'
14261         ;;
14262 esac
14263
14264 : see what type is used for signed size_t
14265 set ssize_t ssizetype int stdio.h sys/types.h
14266 eval $typedef
14267 dflt="$ssizetype"
14268 $cat > ssize.c <<EOM
14269 #include <stdio.h>
14270 #include <sys/types.h>
14271 #define Size_t $sizetype
14272 #define SSize_t $dflt
14273 int main()
14274 {
14275         if (sizeof(Size_t) == sizeof(SSize_t))
14276                 printf("$dflt\n");
14277         else if (sizeof(Size_t) == sizeof(int))
14278                 printf("int\n");
14279         else 
14280                 printf("long\n");
14281         exit(0);
14282 }
14283 EOM
14284 echo " "
14285 set ssize
14286 if eval $compile_ok && ./ssize > /dev/null; then
14287         ssizetype=`./ssize`
14288         echo "I'll be using $ssizetype for functions returning a byte count." >&4
14289 else
14290         $cat >&4 <<EOM
14291 Help! I can't compile and run the ssize_t test program: please enlighten me!
14292 (This is probably a misconfiguration in your system or libraries, and
14293 you really ought to fix it.  Still, I'll try anyway.)
14294
14295 I need a type that is the same size as $sizetype, but is guaranteed to
14296 be signed.  Common values are ssize_t, int and long.
14297
14298 EOM
14299         rp="What signed type is the same size as $sizetype?"
14300         . ./myread
14301         ssizetype="$ans"
14302 fi
14303 $rm -f ssize ssize.*
14304
14305 : see what type of char stdio uses.
14306 echo " "
14307 if $contains 'unsigned.*char.*_ptr;' `./findhdr stdio.h` >/dev/null 2>&1 ; then
14308         echo "Your stdio uses unsigned chars." >&4
14309         stdchar="unsigned char"
14310 else
14311         echo "Your stdio uses signed chars." >&4
14312         stdchar="char"
14313 fi
14314
14315 : see if time exists
14316 echo " "
14317 if test "X$d_time" = X -o X"$timetype" = X; then
14318     if set time val -f d_time; eval $csym; $val; then
14319                 echo 'time() found.' >&4
14320                 val="$define"
14321                 rp="What is the type returned by time() on this system?"
14322                 set time_t timetype long stdio.h sys/types.h
14323                 eval $typedef_ask
14324     else
14325                 echo 'time() not found, hope that will do.' >&4
14326                 val="$undef"
14327                 timetype='int';
14328     fi
14329     set d_time
14330     eval $setvar
14331 fi
14332
14333 : see what type uids are declared as in the kernel
14334 echo " "
14335 echo "Looking for the type for user ids returned by getuid()."
14336 set uid_t uidtype xxx stdio.h sys/types.h
14337 eval $typedef
14338 case "$uidtype" in
14339 xxx)
14340         xxx=`./findhdr sys/user.h`
14341         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
14342         case $1 in
14343         unsigned) dflt="$1 $2" ;;
14344         *) dflt="$1" ;;
14345         esac
14346         ;;
14347 *) dflt="$uidtype";;
14348 esac
14349 case "$uidtype" in
14350 uid_t)  echo "uid_t found." ;;
14351 *)      rp="What is the type for user ids returned by getuid()?"
14352         . ./myread
14353         uidtype="$ans"
14354         ;;
14355 esac
14356
14357 echo " "
14358 case "$uidtype" in
14359 *_t) zzz="$uidtype"     ;;
14360 *)   zzz="uid"          ;;
14361 esac
14362 echo "Checking the size of $zzz..." >&4 
14363 cat > try.c <<EOCP
14364 #include <sys/types.h>
14365 #include <stdio.h>
14366 int main() {
14367     printf("%d\n", (int)sizeof($uidtype));
14368     exit(0);
14369 }
14370 EOCP
14371 set try
14372 if eval $compile_ok; then
14373         yyy=`./try`
14374         case "$yyy" in
14375         '')     uidsize=4
14376                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
14377                 ;;
14378         *)      uidsize=$yyy
14379                 echo "Your $zzz is $uidsize bytes long."
14380                 ;;
14381         esac
14382 else
14383         uidsize=4
14384         echo "(I can't compile the test program--guessing $uidsize.)" >&4
14385 fi
14386
14387 echo " "
14388 case "$uidtype" in
14389 *_t) zzz="$uidtype"     ;;
14390 *)   zzz="uid"          ;;
14391 esac
14392 echo "Checking the sign of $zzz..." >&4
14393 cat > try.c <<EOCP
14394 #include <sys/types.h>
14395 #include <stdio.h>
14396 int main() {
14397         $uidtype foo = -1;
14398         if (foo < 0)
14399                 printf("-1\n");
14400         else
14401                 printf("1\n");
14402 }
14403 EOCP
14404 set try
14405 if eval $compile; then
14406         yyy=`./try`
14407         case "$yyy" in
14408         '')     uidsign=1
14409                 echo "(I can't execute the test program--guessing unsigned.)" >&4
14410                 ;;
14411         *)      uidsign=$yyy
14412                 case "$uidsign" in
14413                  1) echo "Your $zzz is unsigned." ;;
14414                 -1) echo "Your $zzz is signed."   ;;
14415                 esac
14416                 ;;
14417         esac
14418 else
14419         uidsign=1
14420         echo "(I can't compile the test program--guessing unsigned.)" >&4
14421 fi
14422
14423
14424
14425 echo " "
14426 $echo "Checking the format string to be used for uids..." >&4
14427
14428 case "$uidsign" in
14429 -1)     if $test X"$uidsize" = X"$ivsize"; then
14430                 uidformat="$ivdformat"
14431         else
14432                 if $test X"$uidsize" = X"$longsize"; then
14433                         uidformat='"ld"'
14434                 else
14435                         if $test X"$uidsize" = X"$intsize"; then
14436                                 uidformat='"d"'
14437                         else
14438                                 if $test X"$uidsize" = X"$shortsize"; then
14439                                         uidformat='"hd"'
14440                                 fi
14441                         fi
14442                 fi
14443         fi
14444         ;;
14445 *)      if $test X"$uidsize" = X"$uvsize"; then
14446                 uidformat="$uvuformat"
14447         else
14448                 if $test X"$uidsize" = X"$longsize"; then
14449                         uidformat='"lu"'
14450                 else
14451                         if $test X"$uidsize" = X"$intsize"; then
14452                                 uidformat='"u"'
14453                         else
14454                                 if $test X"$uidsize" = X"$shortsize"; then
14455                                         uidformat='"hu"'
14456                                 fi
14457                         fi
14458                 fi
14459         fi
14460         ;;
14461 esac
14462
14463 : see if dbm.h is available
14464 : see if dbmclose exists
14465 set dbmclose d_dbmclose
14466 eval $inlibc
14467
14468 case "$d_dbmclose" in
14469 $define)
14470         set dbm.h i_dbm
14471         eval $inhdr
14472         case "$i_dbm" in
14473         $define)
14474                 val="$undef"
14475                 set i_rpcsvcdbm
14476                 eval $setvar
14477                 ;;
14478         *)      set rpcsvc/dbm.h i_rpcsvcdbm
14479                 eval $inhdr
14480                 ;;
14481         esac
14482         ;;
14483 *)      echo "We won't be including <dbm.h>"
14484         val="$undef"
14485         set i_dbm
14486         eval $setvar
14487         val="$undef"
14488         set i_rpcsvcdbm
14489         eval $setvar
14490         ;;
14491 esac
14492
14493 : see if this is a sys/file.h system
14494 val=''
14495 set sys/file.h val
14496 eval $inhdr
14497
14498 : do we need to include sys/file.h ?
14499 case "$val" in
14500 "$define")
14501         echo " "
14502         if $h_sysfile; then
14503                 val="$define"
14504                 echo "We'll be including <sys/file.h>." >&4
14505         else
14506                 val="$undef"
14507                 echo "We won't be including <sys/file.h>." >&4
14508         fi
14509         ;;
14510 *)
14511         h_sysfile=false
14512         ;;
14513 esac
14514 set i_sysfile
14515 eval $setvar
14516
14517 : see if fcntl.h is there
14518 val=''
14519 set fcntl.h val
14520 eval $inhdr
14521
14522 : see if we can include fcntl.h
14523 case "$val" in
14524 "$define")
14525         echo " "
14526         if $h_fcntl; then
14527                 val="$define"
14528                 echo "We'll be including <fcntl.h>." >&4
14529         else
14530                 val="$undef"
14531                 if $h_sysfile; then
14532         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
14533                 else
14534                         echo "We won't be including <fcntl.h>." >&4
14535                 fi
14536         fi
14537         ;;
14538 *)
14539         h_fcntl=false
14540         val="$undef"
14541         ;;
14542 esac
14543 set i_fcntl
14544 eval $setvar
14545
14546 : see if this is a iconv.h system
14547 set iconv.h i_iconv
14548 eval $inhdr
14549
14550 : see if this is a ieeefp.h system
14551 set ieeefp.h i_ieeefp
14552 eval $inhdr
14553
14554 : see if this is a libutil.h system
14555 set libutil.h i_libutil
14556 eval $inhdr
14557
14558 : see if locale.h is available
14559 set locale.h i_locale
14560 eval $inhdr
14561
14562 : see if mach cthreads are available
14563 if test "X$usethreads" = "X$define"; then
14564         set mach/cthreads.h i_machcthr
14565         eval $inhdr
14566 else
14567         i_machcthr="$undef"
14568 fi
14569
14570
14571
14572 : see if this is a math.h system
14573 set math.h i_math
14574 eval $inhdr
14575
14576 : see if this is a mntent.h system
14577 set mntent.h i_mntent
14578 eval $inhdr
14579
14580 : see if ndbm.h is available
14581 set ndbm.h t_ndbm
14582 eval $inhdr
14583 case "$t_ndbm" in
14584 $define)
14585         : see if dbm_open exists
14586         set dbm_open d_dbm_open
14587         eval $inlibc
14588         case "$d_dbm_open" in
14589         $undef)
14590                 t_ndbm="$undef"
14591                 echo "We won't be including <ndbm.h>"
14592                 ;;
14593         esac
14594         ;;
14595 esac
14596 val="$t_ndbm"
14597 set i_ndbm
14598 eval $setvar
14599
14600 : see if net/errno.h is available
14601 val=''
14602 set net/errno.h val
14603 eval $inhdr
14604
14605 : Unfortunately, it causes problems on some systems.  Arrgh.
14606 case "$val" in
14607 $define)
14608         cat > try.c <<'EOM'
14609 #include <stdio.h>
14610 #include <errno.h>
14611 #include <net/errno.h>
14612 int func()
14613 {
14614         return ENOTSOCK;
14615 }
14616 EOM
14617         if $cc $ccflags -c try.c >/dev/null 2>&1; then
14618                 echo "We'll be including <net/errno.h>." >&4
14619         else
14620                 echo "We won't be including <net/errno.h>." >&4
14621                 val="$undef"
14622         fi
14623         $rm -f try.* try
14624         ;;
14625 esac
14626 set i_neterrno
14627 eval $setvar
14628
14629 : see if netinet/tcp.h is available
14630 set netinet/tcp.h i_netinettcp
14631 eval $inhdr
14632
14633 : see if this is a poll.h system
14634 set poll.h i_poll
14635 eval $inhdr
14636
14637 : see if this is a prot.h system
14638 set prot.h i_prot
14639 eval $inhdr
14640
14641 echo " "
14642 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4 
14643 $cat <<'EOSH' > Cppsym.know
14644 a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
14645 AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
14646 alliant alpha am29000 AM29000 amiga AMIGAOS AMIX
14647 ansi ANSI_C_SOURCE apollo ardent atarist att386 att3b BeOS
14648 BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
14649 BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
14650 bull c cadmus clipper CMU COFF COMPILER_VERSION
14651 concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
14652 CYGWIN DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
14653 Dynix DynixPTX ELF encore EPI EXTENSIONS FILE_OFFSET_BITS
14654 FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
14655 GNU_SOURCE GNUC GNUC_MINOR GO32 gould GOULD_PN
14656 H3050R H3050RX hbullx20 hcx host_mips
14657 hp200 hp300 hp700 HP700 hp800 hp9000
14658 hp9000s200 hp9000s300 hp9000s400 hp9000s500
14659 hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
14660 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
14661 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
14662 INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
14663 LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
14664 LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
14665 Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
14666 LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
14667 M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
14668 M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
14669 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
14670 MATH_HAS_NO_SIDE_EFFECTS
14671 mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
14672 mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
14673 mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
14674 MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
14675 mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
14676 NetBSD news1500 news1700 news1800 news1900 news3700
14677 news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
14678 ns32016 ns32332 ns32k nsc32000
14679 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
14680 pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
14681 pc532 pdp11 PGC PIC plexus PORTAR posix
14682 POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
14683 POSIX_C_SOURCE POSIX_SOURCE POWER
14684 PROTOTYPES PWB pyr QNX R3000 REENTRANT RES Rhapsody RISC6000
14685 riscix riscos RT scs SCO sequent sgi SGI_SOURCE sinix
14686 SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
14687 sony sony_news sonyrisc sparc sparclite spectrum
14688 stardent stdc STDC_EXT stratos sun sun3 sun386
14689 Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
14690 SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
14691 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
14692 sysV68 sysV88 Tek4132 Tek4300 titan
14693 tower tower32 tower32_200 tower32_600 tower32_700
14694 tower32_800 tower32_850 tss
14695 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
14696 ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
14697 unix UNIX95 UNIX99 unixpc unos USGr4 USGr4_2
14698 Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms xenix Xenix286
14699 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
14700 XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
14701 z8000
14702 EOSH
14703 # Maybe put other stuff here too.
14704 cat <<EOSH >>Cppsym.know
14705 $osname
14706 EOSH
14707 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
14708 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
14709 $cat Cppsym.know > Cppsym.c
14710 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
14711 $rm -f Cppsym.a Cppsym.b Cppsym.c
14712 cat <<EOSH > Cppsym
14713 $startsh
14714 if $test \$# -gt 0; then
14715     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
14716     if $test -s Cppsym.got; then
14717         $rm -f Cppsym.got
14718         exit 0
14719     fi
14720     $rm -f Cppsym.got
14721     exit 1
14722 else
14723     $tr " " "$trnl" | ./Cppsym.try
14724     exit 0
14725 fi
14726 EOSH
14727 chmod +x Cppsym
14728 $eunicefix Cppsym
14729 cat <<EOSH > Cppsym.try
14730 $startsh
14731 cat <<'EOCP' > try.c
14732 #include <stdio.h>
14733 int main() {
14734 EOCP
14735 $awk \\
14736 EOSH
14737 cat <<'EOSH' >> Cppsym.try
14738 'length($1) > 0 {
14739     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
14740     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
14741     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
14742     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
14743 }'       >> try.c
14744 echo '}' >> try.c
14745 EOSH
14746 cat <<EOSH >> Cppsym.try
14747 ccflags="$ccflags"
14748 case "$osname-$gccversion" in
14749 irix-) ccflags="\$ccflags -woff 1178" ;;
14750 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
14751 esac
14752 $cc -o try $optimize \$ccflags $ldflags try.c $libs && ./try$exe_ext
14753 EOSH
14754 chmod +x Cppsym.try
14755 $eunicefix Cppsym.try
14756 ./Cppsym < Cppsym.know > Cppsym.true
14757 : now check the C compiler for additional symbols
14758 postprocess_cc_v=''
14759 case "$osname" in
14760 aix) postprocess_cc_v="|$tr , ' '" ;;
14761 esac
14762 $cat >ccsym <<EOS
14763 $startsh
14764 $cat >tmp.c <<EOF
14765 extern int foo;
14766 EOF
14767 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
14768 do
14769         case "\$i" in
14770         -D*) echo "\$i" | $sed 's/^-D//';;
14771         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A\(.*\)(\(.*\))/\1=\2/';;
14772         esac
14773 done
14774 $rm -f try.c
14775 EOS
14776 postprocess_cc_v=''
14777 chmod +x ccsym
14778 $eunicefix ccsym
14779 ./ccsym > ccsym1.raw
14780 if $test -s ccsym1.raw; then
14781        $sort ccsym1.raw | $uniq >ccsym.raw
14782 else
14783        mv ccsym1.raw ccsym.raw
14784 fi
14785
14786 $awk '/\=/ { print $0; next }
14787         { print $0"=1" }' ccsym.raw >ccsym.list
14788 $awk '/\=/ { print $0; next }
14789         { print $0"=1" }' Cppsym.true >ccsym.true
14790 $comm -13 ccsym.true ccsym.list >ccsym.own
14791 $comm -12 ccsym.true ccsym.list >ccsym.com
14792 $comm -23 ccsym.true ccsym.list >ccsym.cpp
14793 also=''
14794 if $test -z ccsym.raw; then
14795         echo "Your C compiler doesn't seem to define any symbols!" >&4
14796         echo " "
14797         echo "However, your C preprocessor defines the following symbols:"
14798         $cat Cppsym.true
14799         ccsymbols=''
14800         cppsymbols=`$cat Cppsym.true`
14801         cppsymbols=`echo $cppsymbols`
14802         cppccsymbols="$cppsymbols"
14803 else
14804         if $test -s ccsym.com; then
14805                 echo "Your C compiler and pre-processor define these symbols:"
14806                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
14807                 also='also '
14808                 symbols='ones'
14809                 cppccsymbols=`$cat ccsym.com`
14810                 cppccsymbols=`echo $cppccsymbols`
14811                 $test "$silent" || sleep 1
14812         fi
14813         if $test -s ccsym.cpp; then
14814                 $test "$also" && echo " "
14815                 echo "Your C pre-processor ${also}defines the following symbols:"
14816                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
14817                 also='further '
14818                 cppsymbols=`$cat ccsym.cpp`
14819                 cppsymbols=`echo $cppsymbols`
14820                 $test "$silent" || sleep 1
14821         fi
14822         if $test -s ccsym.own; then
14823                 $test "$also" && echo " "
14824                 echo "Your C compiler ${also}defines the following cpp symbols:"
14825                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
14826                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
14827                 ccsymbols=`$cat ccsym.own`
14828                 ccsymbols=`echo $ccsymbols`
14829                 $test "$silent" || sleep 1
14830         fi
14831 fi
14832 $rm -f ccsym* Cppsym.*
14833
14834 : see if this is a termio system
14835 val="$undef"
14836 val2="$undef"
14837 val3="$undef"
14838 if $test `./findhdr termios.h`; then
14839         set tcsetattr i_termios
14840         eval $inlibc
14841         val3="$i_termios"
14842 fi
14843 echo " "
14844 case "$val3" in
14845 "$define") echo "You have POSIX termios.h... good!" >&4;;
14846 *) if ./Cppsym pyr; then
14847                 case "`/bin/universe`" in
14848                 ucb) if $test `./findhdr sgtty.h`; then
14849                                 val2="$define"
14850                                 echo "<sgtty.h> found." >&4
14851                         else
14852                                 echo "System is pyramid with BSD universe."
14853                                 echo "<sgtty.h> not found--you could have problems." >&4
14854                         fi;;
14855                 *) if $test `./findhdr termio.h`; then
14856                                 val="$define"
14857                                 echo "<termio.h> found." >&4
14858                         else
14859                                 echo "System is pyramid with USG universe."
14860                                 echo "<termio.h> not found--you could have problems." >&4
14861                         fi;;
14862                 esac
14863         elif ./usg; then
14864                 if $test `./findhdr termio.h`; then
14865                         echo "<termio.h> found." >&4
14866                         val="$define"
14867                 elif $test `./findhdr sgtty.h`; then
14868                         echo "<sgtty.h> found." >&4
14869                         val2="$define"
14870                 else
14871 echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
14872                 fi
14873         else
14874                 if $test `./findhdr sgtty.h`; then
14875                         echo "<sgtty.h> found." >&4
14876                         val2="$define"
14877                 elif $test `./findhdr termio.h`; then
14878                         echo "<termio.h> found." >&4
14879                         val="$define"
14880                 else
14881 echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
14882                 fi
14883         fi;;
14884 esac
14885 set i_termio; eval $setvar
14886 val=$val2; set i_sgtty; eval $setvar
14887 val=$val3; set i_termios; eval $setvar
14888
14889 : see if this is a shadow.h system
14890 set shadow.h i_shadow
14891 eval $inhdr
14892
14893 : see if stdarg is available
14894 echo " "
14895 if $test `./findhdr stdarg.h`; then
14896         echo "<stdarg.h> found." >&4
14897         valstd="$define"
14898 else
14899         echo "<stdarg.h> NOT found." >&4
14900         valstd="$undef"
14901 fi
14902
14903 : see if varags is available
14904 echo " "
14905 if $test `./findhdr varargs.h`; then
14906         echo "<varargs.h> found." >&4
14907 else
14908         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
14909 fi
14910
14911 : set up the varargs testing programs
14912 $cat > varargs.c <<EOP
14913 #ifdef I_STDARG
14914 #include <stdarg.h>
14915 #endif
14916 #ifdef I_VARARGS
14917 #include <varargs.h>
14918 #endif
14919
14920 #ifdef I_STDARG
14921 int f(char *p, ...)
14922 #else
14923 int f(va_alist)
14924 va_dcl
14925 #endif
14926 {
14927         va_list ap;
14928 #ifndef I_STDARG
14929         char *p;
14930 #endif
14931 #ifdef I_STDARG
14932         va_start(ap,p);
14933 #else
14934         va_start(ap);
14935         p = va_arg(ap, char *);
14936 #endif
14937         va_end(ap);
14938 }
14939 EOP
14940 $cat > varargs <<EOP
14941 $startsh
14942 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
14943         echo "true"
14944 else
14945         echo "false"
14946 fi
14947 $rm -f varargs$_o
14948 EOP
14949 chmod +x varargs
14950
14951 : now check which varargs header should be included
14952 echo " "
14953 i_varhdr=''
14954 case "$valstd" in
14955 "$define")
14956         if `./varargs I_STDARG`; then
14957                 val='stdarg.h'
14958         elif `./varargs I_VARARGS`; then
14959                 val='varargs.h'
14960         fi
14961         ;;
14962 *)
14963         if `./varargs I_VARARGS`; then
14964                 val='varargs.h'
14965         fi
14966         ;;
14967 esac
14968 case "$val" in
14969 '')
14970 echo "I could not find the definition for va_dcl... You have problems..." >&4
14971         val="$undef"; set i_stdarg; eval $setvar
14972         val="$undef"; set i_varargs; eval $setvar
14973         ;;
14974 *) 
14975         set i_varhdr
14976         eval $setvar
14977         case "$i_varhdr" in
14978         stdarg.h)
14979                 val="$define"; set i_stdarg; eval $setvar
14980                 val="$undef"; set i_varargs; eval $setvar
14981                 ;;
14982         varargs.h)
14983                 val="$undef"; set i_stdarg; eval $setvar
14984                 val="$define"; set i_varargs; eval $setvar
14985                 ;;
14986         esac
14987         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
14988 esac
14989 $rm -f varargs*
14990
14991 : see if stddef is available
14992 set stddef.h i_stddef
14993 eval $inhdr
14994
14995 : see if this is a sunmath.h system
14996 set sunmath.h i_sunmath
14997 eval $inhdr
14998
14999 : see if sys/access.h is available
15000 set sys/access.h i_sysaccess
15001 eval $inhdr
15002
15003 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
15004 set sys/filio.h i_sysfilio
15005 eval $inhdr
15006 echo " "
15007 if $test `./findhdr sys/ioctl.h`; then
15008         val="$define"
15009         echo '<sys/ioctl.h> found.' >&4
15010 else
15011         val="$undef"
15012         if $test $i_sysfilio = "$define"; then
15013             echo '<sys/ioctl.h> NOT found.' >&4
15014         else
15015                 $test $i_sgtty = "$define" && xxx="sgtty.h"
15016                 $test $i_termio = "$define" && xxx="termio.h"
15017                 $test $i_termios = "$define" && xxx="termios.h"
15018 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
15019         fi
15020 fi
15021 set i_sysioctl
15022 eval $setvar
15023
15024
15025 : see if this is a syslog.h system
15026 set syslog.h i_syslog
15027 eval $inhdr
15028
15029
15030 : see if this is a sys/mode.h system
15031 set sys/mode.h i_sysmode
15032 eval $inhdr
15033
15034 : see if sys/resource.h has to be included
15035 set sys/resource.h i_sysresrc
15036 eval $inhdr
15037
15038 : see if sys/security.h is available
15039 set sys/security.h i_syssecrt
15040 eval $inhdr
15041
15042 : see if this is a sys/statvfs.h system
15043 set sys/statvfs.h i_sysstatvfs
15044 eval $inhdr
15045
15046 : see if this is a sys/uio.h system
15047 set sys/uio.h i_sysuio
15048 eval $inhdr
15049
15050 : see if this is a sys/un.h system
15051 set sys/un.h i_sysun
15052 eval $inhdr
15053
15054
15055 : see if this is a sys/utsname.h system
15056 set sys/utsname.h i_sysutsname
15057 eval $inhdr
15058
15059 : see if this is a syswait system
15060 set sys/wait.h i_syswait
15061 eval $inhdr
15062
15063 : see if this is a ustat.h system
15064 set ustat.h i_ustat
15065 eval $inhdr
15066
15067 : see if this is an utime system
15068 set utime.h i_utime
15069 eval $inhdr
15070
15071 : see if this is a values.h system
15072 set values.h i_values
15073 eval $inhdr
15074
15075 : see if this is a vfork system
15076 case "$d_vfork" in
15077 "$define")
15078         set vfork.h i_vfork
15079         eval $inhdr
15080         ;;
15081 *)
15082         i_vfork="$undef"
15083         ;;
15084 esac
15085
15086 : see if gdbm.h is available
15087 set gdbm.h t_gdbm
15088 eval $inhdr
15089 case "$t_gdbm" in
15090 $define)
15091         : see if gdbm_open exists
15092         set gdbm_open d_gdbm_open
15093         eval $inlibc
15094         case "$d_gdbm_open" in
15095         $undef)
15096                 t_gdbm="$undef"
15097                 echo "We won't be including <gdbm.h>"
15098                 ;;
15099         esac
15100         ;;
15101 esac
15102 val="$t_gdbm"
15103 set i_gdbm
15104 eval $setvar
15105
15106 echo " "
15107 echo "Looking for extensions..." >&4
15108 : If we are using the old config.sh, known_extensions may contain
15109 : old or inaccurate or duplicate values.
15110 known_extensions=''
15111 nonxs_extensions=''
15112 : We do not use find because it might not be available.
15113 : We do not just use MANIFEST because the user may have dropped
15114 : some additional extensions into the source tree and expect them
15115 : to be built.
15116
15117 : Function to recursively find available extensions, ignoring DynaLoader
15118 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
15119 find_extensions='
15120     for xxx in *; do
15121        case "$xxx" in
15122            DynaLoader|dynaload) ;;
15123            *)
15124            if $test -f $xxx/$xxx.xs; then
15125                known_extensions="$known_extensions $1$xxx";
15126            elif $test -f $xxx/Makefile.PL; then
15127                nonxs_extensions="$nonxs_extensions $1$xxx";
15128            else
15129                if $test -d $xxx -a $# -lt 10; then
15130                    set $1$xxx/ $*;
15131                    cd $xxx;
15132                    eval $find_extensions;
15133                    cd ..;
15134                    shift;
15135                fi;
15136            fi
15137            ;;
15138        esac;
15139     done'
15140 tdir=`pwd`
15141 cd $rsrc/ext
15142 set X
15143 shift
15144 eval $find_extensions
15145 set X $nonxs_extensions
15146 shift
15147 nonxs_extensions="$*"
15148 set X $known_extensions
15149 shift
15150 known_extensions="$*"
15151 cd $tdir
15152
15153 : Now see which are supported on this system.
15154 avail_ext=''
15155 for xxx in $known_extensions ; do
15156         case "$xxx" in
15157         DB_File|db_file)
15158                 case "$i_db" in
15159                 $define) avail_ext="$avail_ext $xxx" ;;
15160                 esac
15161                 ;;
15162         GDBM_File|gdbm_fil)
15163                 case "$i_gdbm" in 
15164                 $define) avail_ext="$avail_ext $xxx" ;;
15165                 esac
15166                 ;;
15167         NDBM_File|ndbm_fil)
15168                 case "$i_ndbm" in
15169                 $define)
15170                     case "$osname-$use64bitint" in
15171                     hpux-define)
15172                         case "$libs" in
15173                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
15174                         esac
15175                         ;;
15176                     *) avail_ext="$avail_ext $xxx" ;;
15177                     esac
15178                     ;;
15179                 esac
15180                 ;;
15181         ODBM_File|odbm_fil) 
15182                 case "${i_dbm}${i_rpcsvcdbm}" in
15183                 *"${define}"*)
15184                     case "$osname-$use64bitint" in
15185                     hpux-define)
15186                         case "$libs" in
15187                         *-ldbm*) avail_ext="$avail_ext $xxx" ;;
15188                         esac
15189                         ;;
15190                     *) avail_ext="$avail_ext $xxx" ;;
15191                     esac
15192                     ;;
15193                 esac
15194                 ;;
15195         POSIX|posix)
15196                 case "$useposix" in
15197                 true|define|y) avail_ext="$avail_ext $xxx" ;;
15198                 esac
15199                 ;;
15200         Opcode|opcode)
15201                 case "$useopcode" in
15202                 true|define|y) avail_ext="$avail_ext $xxx" ;;
15203                 esac
15204                 ;;
15205         Socket|socket)
15206                 case "$d_socket" in 
15207                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
15208                 esac
15209                 ;;
15210         Sys/Syslog|sys/syslog)
15211                 : XXX syslog requires socket
15212                 case "$d_socket" in 
15213                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
15214                 esac
15215                 ;;
15216         Thread|thread)
15217                 case "$usethreads" in 
15218                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
15219                 esac
15220                 ;;
15221         IPC/SysV|ipc/sysv)
15222                 : XXX Do we need a useipcsysv variable here
15223                 case "${d_msg}${d_sem}${d_shm}" in 
15224                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
15225                 esac
15226                 ;;
15227         *)      avail_ext="$avail_ext $xxx"
15228                 ;;
15229         esac
15230 done
15231
15232 set X $avail_ext
15233 shift
15234 avail_ext="$*"
15235
15236 : Now see which nonxs extensions are supported on this system.
15237 : For now assume all are.
15238 nonxs_ext=''
15239 for xxx in $nonxs_extensions ; do
15240         case "$xxx" in
15241         *)      nonxs_ext="$nonxs_ext $xxx"
15242                 ;;
15243         esac
15244 done
15245
15246 set X $nonxs_ext
15247 shift
15248 nonxs_ext="$*"
15249
15250 case $usedl in
15251 $define)
15252         $cat <<EOM
15253 A number of extensions are supplied with $package.  You may choose to
15254 compile these extensions for dynamic loading (the default), compile
15255 them into the $package executable (static loading), or not include
15256 them at all.  Answer "none" to include no extensions.
15257 Note that DynaLoader is always built and need not be mentioned here.
15258
15259 EOM
15260         case "$dynamic_ext" in
15261         '') dflt="$avail_ext" ;;
15262         *)      dflt="$dynamic_ext"
15263                 # Perhaps we are reusing an old out-of-date config.sh.
15264                 case "$hint" in
15265                 previous)
15266                         if test X"$dynamic_ext" != X"$avail_ext"; then
15267                                 $cat <<EOM
15268 NOTICE:  Your previous config.sh list may be incorrect. 
15269 The extensions now available to you are 
15270         ${avail_ext}
15271 but the default list from your previous config.sh is
15272         ${dynamic_ext} 
15273
15274 EOM
15275                         fi
15276                         ;;
15277                 esac
15278                 ;;
15279         esac
15280         case "$dflt" in
15281         '')     dflt=none;;
15282         esac
15283         rp="What extensions do you wish to load dynamically?"
15284         . ./myread
15285         case "$ans" in
15286         none) dynamic_ext=' ' ;;
15287         *) dynamic_ext="$ans" ;;
15288         esac
15289
15290         case "$static_ext" in
15291         '')
15292                 : Exclude those already listed in dynamic linking
15293                 dflt=''
15294                 for xxx in $avail_ext; do
15295                         case " $dynamic_ext " in
15296                         *" $xxx "*) ;;
15297                         *) dflt="$dflt $xxx" ;;
15298                         esac
15299                 done
15300                 set X $dflt
15301                 shift
15302                 dflt="$*"
15303                 ;;
15304         *)  dflt="$static_ext" 
15305                 ;;
15306         esac
15307
15308         case "$dflt" in
15309         '')     dflt=none;;
15310         esac
15311         rp="What extensions do you wish to load statically?"
15312         . ./myread
15313         case "$ans" in
15314         none) static_ext=' ' ;;
15315         *) static_ext="$ans" ;;
15316         esac
15317         ;;
15318 *)
15319         $cat <<EOM
15320 A number of extensions are supplied with $package.  Answer "none" 
15321 to include no extensions. 
15322 Note that DynaLoader is always built and need not be mentioned here.
15323
15324 EOM
15325         case "$static_ext" in
15326         '') dflt="$avail_ext" ;;
15327         *)      dflt="$static_ext"
15328                 # Perhaps we are reusing an old out-of-date config.sh.
15329                 case "$hint" in
15330                 previous)
15331                         if test X"$static_ext" != X"$avail_ext"; then
15332                                 $cat <<EOM
15333 NOTICE:  Your previous config.sh list may be incorrect. 
15334 The extensions now available to you are 
15335         ${avail_ext}
15336 but the default list from your previous config.sh is
15337         ${static_ext} 
15338
15339 EOM
15340                         fi
15341                         ;;
15342                 esac
15343                 ;;
15344         esac
15345         : Exclude those that are not xs extensions
15346         case "$dflt" in
15347         '')     dflt=none;;
15348         esac
15349         rp="What extensions do you wish to include?"
15350         . ./myread
15351         case "$ans" in
15352         none) static_ext=' ' ;;
15353         *) static_ext="$ans" ;;
15354         esac
15355         ;;
15356 esac
15357
15358 set X $dynamic_ext $static_ext $nonxs_ext
15359 shift
15360 extensions="$*"
15361
15362 : Remove libraries needed only for extensions
15363 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
15364 : The exception is SunOS 4.x, which needs them.
15365 case "${osname}X${osvers}" in
15366 sunos*X4*)
15367     perllibs="$libs"
15368     ;;
15369 *) case "$usedl" in
15370     $define|true|[yY]*)
15371             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'` 
15372             shift
15373             perllibs="$*"
15374             ;;
15375     *)  perllibs="$libs"
15376             ;;
15377     esac
15378     ;;
15379 esac
15380
15381 : Remove build directory name from cppstdin so it can be used from
15382 : either the present location or the final installed location.
15383 echo " "
15384 : Get out of the UU directory to get correct path name.
15385 cd ..
15386 case "$cppstdin" in
15387 `pwd`/cppstdin)
15388         echo "Stripping down cppstdin path name"
15389         cppstdin=cppstdin
15390         ;;
15391 esac
15392 cd UU
15393
15394 : end of configuration questions
15395 echo " "
15396 echo "End of configuration questions."
15397 echo " "
15398
15399 : back to where it started
15400 if test -d ../UU; then
15401         cd ..
15402 fi
15403
15404 : configuration may be patched via a 'config.over' file
15405 if $test -f config.over; then
15406         echo " "
15407         dflt=y
15408         rp='I see a config.over file.  Do you wish to load it?'
15409         . UU/myread
15410         case "$ans" in
15411         n*) echo "OK, I'll ignore it.";;
15412         *)      . ./config.over
15413                 echo "Configuration override changes have been loaded."
15414                 ;;
15415         esac
15416 fi
15417
15418 : in case they want portability, strip down executable paths
15419 case "$d_portable" in
15420 "$define")
15421         echo " "
15422         echo "Stripping down executable paths..." >&4
15423         for file in $loclist $trylist; do
15424                 eval temp=\$$file
15425                 eval $file=`basename $temp`
15426         done
15427         ;;
15428 esac
15429
15430 : create config.sh file
15431 echo " "
15432 echo "Creating config.sh..." >&4
15433 $spitshell <<EOT >config.sh
15434 $startsh
15435 #
15436 # This file was produced by running the Configure script. It holds all the
15437 # definitions figured out by Configure. Should you modify one of these values,
15438 # do not forget to propagate your changes by running "Configure -der". You may
15439 # instead choose to run each of the .SH files by yourself, or "Configure -S".
15440 #
15441
15442 # Package name      : $package
15443 # Source directory  : $src
15444 # Configuration time: $cf_time
15445 # Configured by     : $cf_by
15446 # Target system     : $myuname
15447
15448 Author='$Author'
15449 Date='$Date'
15450 Header='$Header'
15451 Id='$Id'
15452 Locker='$Locker'
15453 Log='$Log'
15454 Mcc='$Mcc'
15455 RCSfile='$RCSfile'
15456 Revision='$Revision'
15457 Source='$Source'
15458 State='$State'
15459 _a='$_a'
15460 _exe='$_exe'
15461 _o='$_o'
15462 afs='$afs'
15463 alignbytes='$alignbytes'
15464 ansi2knr='$ansi2knr'
15465 aphostname='$aphostname'
15466 api_revision='$api_revision'
15467 api_subversion='$api_subversion'
15468 api_version='$api_version'
15469 api_versionstring='$api_versionstring'
15470 ar='$ar'
15471 archlib='$archlib'
15472 archlibexp='$archlibexp'
15473 archname64='$archname64'
15474 archname='$archname'
15475 archobjs='$archobjs'
15476 awk='$awk'
15477 baserev='$baserev'
15478 bash='$bash'
15479 bin='$bin'
15480 bincompat5005='$bincompat5005'
15481 binexp='$binexp'
15482 bison='$bison'
15483 byacc='$byacc'
15484 byteorder='$byteorder'
15485 c='$c'
15486 castflags='$castflags'
15487 cat='$cat'
15488 cc='$cc'
15489 cccdlflags='$cccdlflags'
15490 ccdlflags='$ccdlflags'
15491 ccflags='$ccflags'
15492 ccflags_uselargefiles='$ccflags_uselargefiles'
15493 ccname='$ccname'
15494 ccsymbols='$ccsymbols'
15495 ccversion='$ccversion'
15496 cf_by='$cf_by'
15497 cf_email='$cf_email'
15498 cf_time='$cf_time'
15499 charsize='$charsize'
15500 chgrp='$chgrp'
15501 chmod='$chmod'
15502 chown='$chown'
15503 clocktype='$clocktype'
15504 comm='$comm'
15505 compress='$compress'
15506 contains='$contains'
15507 cp='$cp'
15508 cpio='$cpio'
15509 cpp='$cpp'
15510 cpp_stuff='$cpp_stuff'
15511 cppccsymbols='$cppccsymbols'
15512 cppflags='$cppflags'
15513 cpplast='$cpplast'
15514 cppminus='$cppminus'
15515 cpprun='$cpprun'
15516 cppstdin='$cppstdin'
15517 cppsymbols='$cppsymbols'
15518 crosscompile='$crosscompile'
15519 cryptlib='$cryptlib'
15520 csh='$csh'
15521 d_Gconvert='$d_Gconvert'
15522 d_PRIEUldbl='$d_PRIEUldbl'
15523 d_PRIFUldbl='$d_PRIFUldbl'
15524 d_PRIGUldbl='$d_PRIGUldbl'
15525 d_PRIXU64='$d_PRIXU64'
15526 d_PRId64='$d_PRId64'
15527 d_PRIeldbl='$d_PRIeldbl'
15528 d_PRIfldbl='$d_PRIfldbl'
15529 d_PRIgldbl='$d_PRIgldbl'
15530 d_PRIi64='$d_PRIi64'
15531 d_PRIo64='$d_PRIo64'
15532 d_PRIu64='$d_PRIu64'
15533 d_PRIx64='$d_PRIx64'
15534 d_SCNfldbl='$d_SCNfldbl'
15535 d__fwalk='$d__fwalk'
15536 d_access='$d_access'
15537 d_accessx='$d_accessx'
15538 d_alarm='$d_alarm'
15539 d_archlib='$d_archlib'
15540 d_atolf='$d_atolf'
15541 d_atoll='$d_atoll'
15542 d_attribut='$d_attribut'
15543 d_bcmp='$d_bcmp'
15544 d_bcopy='$d_bcopy'
15545 d_bincompat5005='$d_bincompat5005'
15546 d_bsd='$d_bsd'
15547 d_bsdgetpgrp='$d_bsdgetpgrp'
15548 d_bsdsetpgrp='$d_bsdsetpgrp'
15549 d_bzero='$d_bzero'
15550 d_casti32='$d_casti32'
15551 d_castneg='$d_castneg'
15552 d_charvspr='$d_charvspr'
15553 d_chown='$d_chown'
15554 d_chroot='$d_chroot'
15555 d_chsize='$d_chsize'
15556 d_closedir='$d_closedir'
15557 d_const='$d_const'
15558 d_crypt='$d_crypt'
15559 d_csh='$d_csh'
15560 d_cuserid='$d_cuserid'
15561 d_dbl_dig='$d_dbl_dig'
15562 d_difftime='$d_difftime'
15563 d_dirnamlen='$d_dirnamlen'
15564 d_dlerror='$d_dlerror'
15565 d_dlopen='$d_dlopen'
15566 d_dlsymun='$d_dlsymun'
15567 d_dosuid='$d_dosuid'
15568 d_drand48proto='$d_drand48proto'
15569 d_dup2='$d_dup2'
15570 d_eaccess='$d_eaccess'
15571 d_endgrent='$d_endgrent'
15572 d_endhent='$d_endhent'
15573 d_endnent='$d_endnent'
15574 d_endpent='$d_endpent'
15575 d_endpwent='$d_endpwent'
15576 d_endsent='$d_endsent'
15577 d_eofnblk='$d_eofnblk'
15578 d_eunice='$d_eunice'
15579 d_fchmod='$d_fchmod'
15580 d_fchown='$d_fchown'
15581 d_fcntl='$d_fcntl'
15582 d_fcntl_can_lock='$d_fcntl_can_lock'
15583 d_fd_macros='$d_fd_macros'
15584 d_fd_set='$d_fd_set'
15585 d_fds_bits='$d_fds_bits'
15586 d_fgetpos='$d_fgetpos'
15587 d_flexfnam='$d_flexfnam'
15588 d_flock='$d_flock'
15589 d_fork='$d_fork'
15590 d_fpathconf='$d_fpathconf'
15591 d_fpos64_t='$d_fpos64_t'
15592 d_frexpl='$d_frexpl'
15593 d_fs_data_s='$d_fs_data_s'
15594 d_fseeko='$d_fseeko'
15595 d_fsetpos='$d_fsetpos'
15596 d_fstatfs='$d_fstatfs'
15597 d_fstatvfs='$d_fstatvfs'
15598 d_fsync='$d_fsync'
15599 d_ftello='$d_ftello'
15600 d_ftime='$d_ftime'
15601 d_getcwd='$d_getcwd'
15602 d_getespwnam='$d_getespwnam'
15603 d_getfsstat='$d_getfsstat'
15604 d_getgrent='$d_getgrent'
15605 d_getgrps='$d_getgrps'
15606 d_gethbyaddr='$d_gethbyaddr'
15607 d_gethbyname='$d_gethbyname'
15608 d_gethent='$d_gethent'
15609 d_gethname='$d_gethname'
15610 d_gethostprotos='$d_gethostprotos'
15611 d_getlogin='$d_getlogin'
15612 d_getmnt='$d_getmnt'
15613 d_getmntent='$d_getmntent'
15614 d_getnbyaddr='$d_getnbyaddr'
15615 d_getnbyname='$d_getnbyname'
15616 d_getnent='$d_getnent'
15617 d_getnetprotos='$d_getnetprotos'
15618 d_getpagsz='$d_getpagsz'
15619 d_getpbyname='$d_getpbyname'
15620 d_getpbynumber='$d_getpbynumber'
15621 d_getpent='$d_getpent'
15622 d_getpgid='$d_getpgid'
15623 d_getpgrp2='$d_getpgrp2'
15624 d_getpgrp='$d_getpgrp'
15625 d_getppid='$d_getppid'
15626 d_getprior='$d_getprior'
15627 d_getprotoprotos='$d_getprotoprotos'
15628 d_getprpwnam='$d_getprpwnam'
15629 d_getpwent='$d_getpwent'
15630 d_getsbyname='$d_getsbyname'
15631 d_getsbyport='$d_getsbyport'
15632 d_getsent='$d_getsent'
15633 d_getservprotos='$d_getservprotos'
15634 d_getspnam='$d_getspnam'
15635 d_gettimeod='$d_gettimeod'
15636 d_gnulibc='$d_gnulibc'
15637 d_grpasswd='$d_grpasswd'
15638 d_hasmntopt='$d_hasmntopt'
15639 d_htonl='$d_htonl'
15640 d_iconv='$d_iconv'
15641 d_index='$d_index'
15642 d_inetaton='$d_inetaton'
15643 d_int64_t='$d_int64_t'
15644 d_isascii='$d_isascii'
15645 d_isnan='$d_isnan'
15646 d_isnanl='$d_isnanl'
15647 d_killpg='$d_killpg'
15648 d_lchown='$d_lchown'
15649 d_ldbl_dig='$d_ldbl_dig'
15650 d_link='$d_link'
15651 d_locconv='$d_locconv'
15652 d_lockf='$d_lockf'
15653 d_longdbl='$d_longdbl'
15654 d_longlong='$d_longlong'
15655 d_lseekproto='$d_lseekproto'
15656 d_lstat='$d_lstat'
15657 d_madvise='$d_madvise'
15658 d_mblen='$d_mblen'
15659 d_mbstowcs='$d_mbstowcs'
15660 d_mbtowc='$d_mbtowc'
15661 d_memchr='$d_memchr'
15662 d_memcmp='$d_memcmp'
15663 d_memcpy='$d_memcpy'
15664 d_memmove='$d_memmove'
15665 d_memset='$d_memset'
15666 d_mkdir='$d_mkdir'
15667 d_mkdtemp='$d_mkdtemp'
15668 d_mkfifo='$d_mkfifo'
15669 d_mkstemp='$d_mkstemp'
15670 d_mkstemps='$d_mkstemps'
15671 d_mktime='$d_mktime'
15672 d_mmap='$d_mmap'
15673 d_modfl='$d_modfl'
15674 d_mprotect='$d_mprotect'
15675 d_msg='$d_msg'
15676 d_msg_ctrunc='$d_msg_ctrunc'
15677 d_msg_dontroute='$d_msg_dontroute'
15678 d_msg_oob='$d_msg_oob'
15679 d_msg_peek='$d_msg_peek'
15680 d_msg_proxy='$d_msg_proxy'
15681 d_msgctl='$d_msgctl'
15682 d_msgget='$d_msgget'
15683 d_msgrcv='$d_msgrcv'
15684 d_msgsnd='$d_msgsnd'
15685 d_msync='$d_msync'
15686 d_munmap='$d_munmap'
15687 d_mymalloc='$d_mymalloc'
15688 d_nice='$d_nice'
15689 d_nv_preserves_uv='$d_nv_preserves_uv'
15690 d_nv_preserves_uv_bits='$d_nv_preserves_uv_bits'
15691 d_off64_t='$d_off64_t'
15692 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
15693 d_oldpthreads='$d_oldpthreads'
15694 d_oldsock='$d_oldsock'
15695 d_open3='$d_open3'
15696 d_pathconf='$d_pathconf'
15697 d_pause='$d_pause'
15698 d_perl_otherlibdirs='$d_perl_otherlibdirs'
15699 d_phostname='$d_phostname'
15700 d_pipe='$d_pipe'
15701 d_poll='$d_poll'
15702 d_portable='$d_portable'
15703 d_pthread_yield='$d_pthread_yield'
15704 d_pwage='$d_pwage'
15705 d_pwchange='$d_pwchange'
15706 d_pwclass='$d_pwclass'
15707 d_pwcomment='$d_pwcomment'
15708 d_pwexpire='$d_pwexpire'
15709 d_pwgecos='$d_pwgecos'
15710 d_pwpasswd='$d_pwpasswd'
15711 d_pwquota='$d_pwquota'
15712 d_qgcvt='$d_qgcvt'
15713 d_quad='$d_quad'
15714 d_readdir='$d_readdir'
15715 d_readlink='$d_readlink'
15716 d_rename='$d_rename'
15717 d_rewinddir='$d_rewinddir'
15718 d_rmdir='$d_rmdir'
15719 d_safebcpy='$d_safebcpy'
15720 d_safemcpy='$d_safemcpy'
15721 d_sanemcmp='$d_sanemcmp'
15722 d_sched_yield='$d_sched_yield'
15723 d_scm_rights='$d_scm_rights'
15724 d_seekdir='$d_seekdir'
15725 d_select='$d_select'
15726 d_sem='$d_sem'
15727 d_semctl='$d_semctl'
15728 d_semctl_semid_ds='$d_semctl_semid_ds'
15729 d_semctl_semun='$d_semctl_semun'
15730 d_semget='$d_semget'
15731 d_semop='$d_semop'
15732 d_setegid='$d_setegid'
15733 d_seteuid='$d_seteuid'
15734 d_setgrent='$d_setgrent'
15735 d_setgrps='$d_setgrps'
15736 d_sethent='$d_sethent'
15737 d_setlinebuf='$d_setlinebuf'
15738 d_setlocale='$d_setlocale'
15739 d_setnent='$d_setnent'
15740 d_setpent='$d_setpent'
15741 d_setpgid='$d_setpgid'
15742 d_setpgrp2='$d_setpgrp2'
15743 d_setpgrp='$d_setpgrp'
15744 d_setprior='$d_setprior'
15745 d_setproctitle='$d_setproctitle'
15746 d_setpwent='$d_setpwent'
15747 d_setregid='$d_setregid'
15748 d_setresgid='$d_setresgid'
15749 d_setresuid='$d_setresuid'
15750 d_setreuid='$d_setreuid'
15751 d_setrgid='$d_setrgid'
15752 d_setruid='$d_setruid'
15753 d_setsent='$d_setsent'
15754 d_setsid='$d_setsid'
15755 d_setvbuf='$d_setvbuf'
15756 d_sfio='$d_sfio'
15757 d_shm='$d_shm'
15758 d_shmat='$d_shmat'
15759 d_shmatprototype='$d_shmatprototype'
15760 d_shmctl='$d_shmctl'
15761 d_shmdt='$d_shmdt'
15762 d_shmget='$d_shmget'
15763 d_sigaction='$d_sigaction'
15764 d_sigsetjmp='$d_sigsetjmp'
15765 d_socket='$d_socket'
15766 d_socklen_t='$d_socklen_t'
15767 d_sockpair='$d_sockpair'
15768 d_socks5_init='$d_socks5_init'
15769 d_sqrtl='$d_sqrtl'
15770 d_statblks='$d_statblks'
15771 d_statfs_f_flags='$d_statfs_f_flags'
15772 d_statfs_s='$d_statfs_s'
15773 d_statvfs='$d_statvfs'
15774 d_stdio_cnt_lval='$d_stdio_cnt_lval'
15775 d_stdio_ptr_lval='$d_stdio_ptr_lval'
15776 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
15777 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
15778 d_stdio_stream_array='$d_stdio_stream_array'
15779 d_stdiobase='$d_stdiobase'
15780 d_stdstdio='$d_stdstdio'
15781 d_strchr='$d_strchr'
15782 d_strcoll='$d_strcoll'
15783 d_strctcpy='$d_strctcpy'
15784 d_strerrm='$d_strerrm'
15785 d_strerror='$d_strerror'
15786 d_strtod='$d_strtod'
15787 d_strtol='$d_strtol'
15788 d_strtold='$d_strtold'
15789 d_strtoll='$d_strtoll'
15790 d_strtoul='$d_strtoul'
15791 d_strtoull='$d_strtoull'
15792 d_strtouq='$d_strtouq'
15793 d_strxfrm='$d_strxfrm'
15794 d_suidsafe='$d_suidsafe'
15795 d_symlink='$d_symlink'
15796 d_syscall='$d_syscall'
15797 d_sysconf='$d_sysconf'
15798 d_sysernlst='$d_sysernlst'
15799 d_syserrlst='$d_syserrlst'
15800 d_system='$d_system'
15801 d_tcgetpgrp='$d_tcgetpgrp'
15802 d_tcsetpgrp='$d_tcsetpgrp'
15803 d_telldir='$d_telldir'
15804 d_telldirproto='$d_telldirproto'
15805 d_time='$d_time'
15806 d_times='$d_times'
15807 d_truncate='$d_truncate'
15808 d_tzname='$d_tzname'
15809 d_umask='$d_umask'
15810 d_uname='$d_uname'
15811 d_union_semun='$d_union_semun'
15812 d_ustat='$d_ustat'
15813 d_vendorarch='$d_vendorarch'
15814 d_vendorbin='$d_vendorbin'
15815 d_vendorlib='$d_vendorlib'
15816 d_vfork='$d_vfork'
15817 d_void_closedir='$d_void_closedir'
15818 d_voidsig='$d_voidsig'
15819 d_voidtty='$d_voidtty'
15820 d_volatile='$d_volatile'
15821 d_vprintf='$d_vprintf'
15822 d_wait4='$d_wait4'
15823 d_waitpid='$d_waitpid'
15824 d_wcstombs='$d_wcstombs'
15825 d_wctomb='$d_wctomb'
15826 d_xenix='$d_xenix'
15827 date='$date'
15828 db_hashtype='$db_hashtype'
15829 db_prefixtype='$db_prefixtype'
15830 defvoidused='$defvoidused'
15831 direntrytype='$direntrytype'
15832 dlext='$dlext'
15833 dlsrc='$dlsrc'
15834 doublesize='$doublesize'
15835 drand01='$drand01'
15836 dynamic_ext='$dynamic_ext'
15837 eagain='$eagain'
15838 ebcdic='$ebcdic'
15839 echo='$echo'
15840 egrep='$egrep'
15841 emacs='$emacs'
15842 eunicefix='$eunicefix'
15843 exe_ext='$exe_ext'
15844 expr='$expr'
15845 extensions='$extensions'
15846 fflushNULL='$fflushNULL'
15847 fflushall='$fflushall'
15848 find='$find'
15849 firstmakefile='$firstmakefile'
15850 flex='$flex'
15851 fpossize='$fpossize'
15852 fpostype='$fpostype'
15853 freetype='$freetype'
15854 full_ar='$full_ar'
15855 full_csh='$full_csh'
15856 full_sed='$full_sed'
15857 gccosandvers='$gccosandvers'
15858 gccversion='$gccversion'
15859 gidformat='$gidformat'
15860 gidsign='$gidsign'
15861 gidsize='$gidsize'
15862 gidtype='$gidtype'
15863 glibpth='$glibpth'
15864 grep='$grep'
15865 groupcat='$groupcat'
15866 groupstype='$groupstype'
15867 gzip='$gzip'
15868 h_fcntl='$h_fcntl'
15869 h_sysfile='$h_sysfile'
15870 hint='$hint'
15871 hostcat='$hostcat'
15872 i16size='$i16size'
15873 i16type='$i16type'
15874 i32size='$i32size'
15875 i32type='$i32type'
15876 i64size='$i64size'
15877 i64type='$i64type'
15878 i8size='$i8size'
15879 i8type='$i8type'
15880 i_arpainet='$i_arpainet'
15881 i_bsdioctl='$i_bsdioctl'
15882 i_db='$i_db'
15883 i_dbm='$i_dbm'
15884 i_dirent='$i_dirent'
15885 i_dld='$i_dld'
15886 i_dlfcn='$i_dlfcn'
15887 i_fcntl='$i_fcntl'
15888 i_float='$i_float'
15889 i_gdbm='$i_gdbm'
15890 i_grp='$i_grp'
15891 i_iconv='$i_iconv'
15892 i_ieeefp='$i_ieeefp'
15893 i_inttypes='$i_inttypes'
15894 i_libutil='$i_libutil'
15895 i_limits='$i_limits'
15896 i_locale='$i_locale'
15897 i_machcthr='$i_machcthr'
15898 i_malloc='$i_malloc'
15899 i_math='$i_math'
15900 i_memory='$i_memory'
15901 i_mntent='$i_mntent'
15902 i_ndbm='$i_ndbm'
15903 i_netdb='$i_netdb'
15904 i_neterrno='$i_neterrno'
15905 i_netinettcp='$i_netinettcp'
15906 i_niin='$i_niin'
15907 i_poll='$i_poll'
15908 i_prot='$i_prot'
15909 i_pthread='$i_pthread'
15910 i_pwd='$i_pwd'
15911 i_rpcsvcdbm='$i_rpcsvcdbm'
15912 i_sfio='$i_sfio'
15913 i_sgtty='$i_sgtty'
15914 i_shadow='$i_shadow'
15915 i_socks='$i_socks'
15916 i_stdarg='$i_stdarg'
15917 i_stddef='$i_stddef'
15918 i_stdlib='$i_stdlib'
15919 i_string='$i_string'
15920 i_sunmath='$i_sunmath'
15921 i_sysaccess='$i_sysaccess'
15922 i_sysdir='$i_sysdir'
15923 i_sysfile='$i_sysfile'
15924 i_sysfilio='$i_sysfilio'
15925 i_sysin='$i_sysin'
15926 i_sysioctl='$i_sysioctl'
15927 i_syslog='$i_syslog'
15928 i_sysmman='$i_sysmman'
15929 i_sysmode='$i_sysmode'
15930 i_sysmount='$i_sysmount'
15931 i_sysndir='$i_sysndir'
15932 i_sysparam='$i_sysparam'
15933 i_sysresrc='$i_sysresrc'
15934 i_syssecrt='$i_syssecrt'
15935 i_sysselct='$i_sysselct'
15936 i_syssockio='$i_syssockio'
15937 i_sysstat='$i_sysstat'
15938 i_sysstatfs='$i_sysstatfs'
15939 i_sysstatvfs='$i_sysstatvfs'
15940 i_systime='$i_systime'
15941 i_systimek='$i_systimek'
15942 i_systimes='$i_systimes'
15943 i_systypes='$i_systypes'
15944 i_sysuio='$i_sysuio'
15945 i_sysun='$i_sysun'
15946 i_sysutsname='$i_sysutsname'
15947 i_sysvfs='$i_sysvfs'
15948 i_syswait='$i_syswait'
15949 i_termio='$i_termio'
15950 i_termios='$i_termios'
15951 i_time='$i_time'
15952 i_unistd='$i_unistd'
15953 i_ustat='$i_ustat'
15954 i_utime='$i_utime'
15955 i_values='$i_values'
15956 i_varargs='$i_varargs'
15957 i_varhdr='$i_varhdr'
15958 i_vfork='$i_vfork'
15959 ignore_versioned_solibs='$ignore_versioned_solibs'
15960 inc_version_list='$inc_version_list'
15961 inc_version_list_init='$inc_version_list_init'
15962 incpath='$incpath'
15963 inews='$inews'
15964 installarchlib='$installarchlib'
15965 installbin='$installbin'
15966 installman1dir='$installman1dir'
15967 installman3dir='$installman3dir'
15968 installprefix='$installprefix'
15969 installprefixexp='$installprefixexp'
15970 installprivlib='$installprivlib'
15971 installscript='$installscript'
15972 installsitearch='$installsitearch'
15973 installsitebin='$installsitebin'
15974 installsitelib='$installsitelib'
15975 installstyle='$installstyle'
15976 installusrbinperl='$installusrbinperl'
15977 installvendorarch='$installvendorarch'
15978 installvendorbin='$installvendorbin'
15979 installvendorlib='$installvendorlib'
15980 intsize='$intsize'
15981 ivdformat='$ivdformat'
15982 ivsize='$ivsize'
15983 ivtype='$ivtype'
15984 known_extensions='$known_extensions'
15985 ksh='$ksh'
15986 ld='$ld'
15987 lddlflags='$lddlflags'
15988 ldflags='$ldflags'
15989 ldflags_uselargefiles='$ldflags_uselargefiles'
15990 ldlibpthname='$ldlibpthname'
15991 less='$less'
15992 lib_ext='$lib_ext'
15993 libc='$libc'
15994 libperl='$libperl'
15995 libpth='$libpth'
15996 libs='$libs'
15997 libsdirs='$libsdirs'
15998 libsfiles='$libsfiles'
15999 libsfound='$libsfound'
16000 libspath='$libspath'
16001 libswanted='$libswanted'
16002 libswanted_uselargefiles='$libswanted_uselargefiles'
16003 line='$line'
16004 lint='$lint'
16005 lkflags='$lkflags'
16006 ln='$ln'
16007 lns='$lns'
16008 locincpth='$locincpth'
16009 loclibpth='$loclibpth'
16010 longdblsize='$longdblsize'
16011 longlongsize='$longlongsize'
16012 longsize='$longsize'
16013 lp='$lp'
16014 lpr='$lpr'
16015 ls='$ls'
16016 lseeksize='$lseeksize'
16017 lseektype='$lseektype'
16018 mail='$mail'
16019 mailx='$mailx'
16020 make='$make'
16021 make_set_make='$make_set_make'
16022 mallocobj='$mallocobj'
16023 mallocsrc='$mallocsrc'
16024 malloctype='$malloctype'
16025 man1dir='$man1dir'
16026 man1direxp='$man1direxp'
16027 man1ext='$man1ext'
16028 man3dir='$man3dir'
16029 man3direxp='$man3direxp'
16030 man3ext='$man3ext'
16031 mips_type='$mips_type'
16032 mkdir='$mkdir'
16033 mmaptype='$mmaptype'
16034 modetype='$modetype'
16035 more='$more'
16036 multiarch='$multiarch'
16037 mv='$mv'
16038 myarchname='$myarchname'
16039 mydomain='$mydomain'
16040 myhostname='$myhostname'
16041 myuname='$myuname'
16042 n='$n'
16043 netdb_hlen_type='$netdb_hlen_type'
16044 netdb_host_type='$netdb_host_type'
16045 netdb_name_type='$netdb_name_type'
16046 netdb_net_type='$netdb_net_type'
16047 nm='$nm'
16048 nm_opt='$nm_opt'
16049 nm_so_opt='$nm_so_opt'
16050 nonxs_ext='$nonxs_ext'
16051 nroff='$nroff'
16052 nvEUformat='$nvEUformat'
16053 nvFUformat='$nvFUformat'
16054 nvGUformat='$nvGUformat'
16055 nveformat='$nveformat'
16056 nvfformat='$nvfformat'
16057 nvgformat='$nvgformat'
16058 nvsize='$nvsize'
16059 nvtype='$nvtype'
16060 o_nonblock='$o_nonblock'
16061 obj_ext='$obj_ext'
16062 old_pthread_create_joinable='$old_pthread_create_joinable'
16063 optimize='$optimize'
16064 orderlib='$orderlib'
16065 osname='$osname'
16066 osvers='$osvers'
16067 otherlibdirs='$otherlibdirs'
16068 package='$package'
16069 pager='$pager'
16070 passcat='$passcat'
16071 patchlevel='$patchlevel'
16072 path_sep='$path_sep'
16073 perl5='$perl5'
16074 perl='$perl'
16075 perladmin='$perladmin'
16076 perllibs='$perllibs'
16077 perlpath='$perlpath'
16078 pg='$pg'
16079 phostname='$phostname'
16080 pidtype='$pidtype'
16081 plibpth='$plibpth'
16082 pm_apiversion='$pm_apiversion'
16083 pmake='$pmake'
16084 pr='$pr'
16085 prefix='$prefix'
16086 prefixexp='$prefixexp'
16087 privlib='$privlib'
16088 privlibexp='$privlibexp'
16089 prototype='$prototype'
16090 ptrsize='$ptrsize'
16091 quadkind='$quadkind'
16092 quadtype='$quadtype'
16093 randbits='$randbits'
16094 randfunc='$randfunc'
16095 randseedtype='$randseedtype'
16096 ranlib='$ranlib'
16097 rd_nodata='$rd_nodata'
16098 revision='$revision'
16099 rm='$rm'
16100 rmail='$rmail'
16101 runnm='$runnm'
16102 sPRIEUldbl='$sPRIEUldbl'
16103 sPRIFUldbl='$sPRIFUldbl'
16104 sPRIGUldbl='$sPRIGUldbl'
16105 sPRIXU64='$sPRIXU64'
16106 sPRId64='$sPRId64'
16107 sPRIeldbl='$sPRIeldbl'
16108 sPRIfldbl='$sPRIfldbl'
16109 sPRIgldbl='$sPRIgldbl'
16110 sPRIi64='$sPRIi64'
16111 sPRIo64='$sPRIo64'
16112 sPRIu64='$sPRIu64'
16113 sPRIx64='$sPRIx64'
16114 sSCNfldbl='$sSCNfldbl'
16115 sched_yield='$sched_yield'
16116 scriptdir='$scriptdir'
16117 scriptdirexp='$scriptdirexp'
16118 sed='$sed'
16119 seedfunc='$seedfunc'
16120 selectminbits='$selectminbits'
16121 selecttype='$selecttype'
16122 sendmail='$sendmail'
16123 sh='$sh'
16124 shar='$shar'
16125 sharpbang='$sharpbang'
16126 shmattype='$shmattype'
16127 shortsize='$shortsize'
16128 shrpenv='$shrpenv'
16129 shsharp='$shsharp'
16130 sig_count='$sig_count'
16131 sig_name='$sig_name'
16132 sig_name_init='$sig_name_init'
16133 sig_num='$sig_num'
16134 sig_num_init='$sig_num_init'
16135 signal_t='$signal_t'
16136 sitearch='$sitearch'
16137 sitearchexp='$sitearchexp'
16138 sitebin='$sitebin'
16139 sitebinexp='$sitebinexp'
16140 sitelib='$sitelib'
16141 sitelib_stem='$sitelib_stem'
16142 sitelibexp='$sitelibexp'
16143 siteprefix='$siteprefix'
16144 siteprefixexp='$siteprefixexp'
16145 sizesize='$sizesize'
16146 sizetype='$sizetype'
16147 sleep='$sleep'
16148 smail='$smail'
16149 so='$so'
16150 sockethdr='$sockethdr'
16151 socketlib='$socketlib'
16152 socksizetype='$socksizetype'
16153 sort='$sort'
16154 spackage='$spackage'
16155 spitshell='$spitshell'
16156 src='$src'
16157 ssizetype='$ssizetype'
16158 startperl='$startperl'
16159 startsh='$startsh'
16160 static_ext='$static_ext'
16161 stdchar='$stdchar'
16162 stdio_base='$stdio_base'
16163 stdio_bufsiz='$stdio_bufsiz'
16164 stdio_cnt='$stdio_cnt'
16165 stdio_filbuf='$stdio_filbuf'
16166 stdio_ptr='$stdio_ptr'
16167 stdio_stream_array='$stdio_stream_array'
16168 strings='$strings'
16169 submit='$submit'
16170 subversion='$subversion'
16171 sysman='$sysman'
16172 tail='$tail'
16173 tar='$tar'
16174 tbl='$tbl'
16175 tee='$tee'
16176 test='$test'
16177 timeincl='$timeincl'
16178 timetype='$timetype'
16179 touch='$touch'
16180 tr='$tr'
16181 trnl='$trnl'
16182 troff='$troff'
16183 u16size='$u16size'
16184 u16type='$u16type'
16185 u32size='$u32size'
16186 u32type='$u32type'
16187 u64size='$u64size'
16188 u64type='$u64type'
16189 u8size='$u8size'
16190 u8type='$u8type'
16191 uidformat='$uidformat'
16192 uidsign='$uidsign'
16193 uidsize='$uidsize'
16194 uidtype='$uidtype'
16195 uname='$uname'
16196 uniq='$uniq'
16197 uquadtype='$uquadtype'
16198 use5005threads='$use5005threads'
16199 use64bitall='$use64bitall'
16200 use64bitint='$use64bitint'
16201 usedl='$usedl'
16202 useithreads='$useithreads'
16203 uselargefiles='$uselargefiles'
16204 uselongdouble='$uselongdouble'
16205 usemorebits='$usemorebits'
16206 usemultiplicity='$usemultiplicity'
16207 usemymalloc='$usemymalloc'
16208 usenm='$usenm'
16209 useopcode='$useopcode'
16210 useperlio='$useperlio'
16211 useposix='$useposix'
16212 usesfio='$usesfio'
16213 useshrplib='$useshrplib'
16214 usesocks='$usesocks'
16215 usethreads='$usethreads'
16216 usevendorprefix='$usevendorprefix'
16217 usevfork='$usevfork'
16218 usrinc='$usrinc'
16219 uuname='$uuname'
16220 uvXUformat='$uvXUformat'
16221 uvoformat='$uvoformat'
16222 uvsize='$uvsize'
16223 uvtype='$uvtype'
16224 uvuformat='$uvuformat'
16225 uvxformat='$uvxformat'
16226 vendorarch='$vendorarch'
16227 vendorarchexp='$vendorarchexp'
16228 vendorbin='$vendorbin'
16229 vendorbinexp='$vendorbinexp'
16230 vendorlib='$vendorlib'
16231 vendorlib_stem='$vendorlib_stem'
16232 vendorlibexp='$vendorlibexp'
16233 vendorprefix='$vendorprefix'
16234 vendorprefixexp='$vendorprefixexp'
16235 version='$version'
16236 versiononly='$versiononly'
16237 vi='$vi'
16238 voidflags='$voidflags'
16239 xlibpth='$xlibpth'
16240 xs_apiversion='$xs_apiversion'
16241 zcat='$zcat'
16242 zip='$zip'
16243 EOT
16244
16245 : Add in command line options if available
16246 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
16247
16248 : add special variables
16249 $test -f $src/patchlevel.h && \
16250 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
16251 echo "CONFIGDOTSH=true" >>config.sh
16252
16253 : propagate old symbols
16254 if $test -f UU/config.sh; then
16255         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
16256         sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
16257         $sort | $uniq -u >UU/oldsyms
16258         set X `cat UU/oldsyms`
16259         shift
16260         case $# in
16261         0) ;;
16262         *)
16263                 cat <<EOM
16264 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
16265 EOM
16266                 echo "# Variables propagated from previous config.sh file." >>config.sh
16267                 for sym in `cat UU/oldsyms`; do
16268                         echo "    Propagating $hint variable "'$'"$sym..."
16269                         eval 'tmp="$'"${sym}"'"'
16270                         echo "$tmp" | \
16271                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
16272                 done
16273                 ;;
16274         esac
16275 fi
16276
16277 : Finish up by extracting the .SH files
16278 case "$alldone" in
16279 exit)
16280         $rm -rf UU
16281         echo "Done."
16282         exit 0
16283         ;;
16284 cont)
16285         ;;
16286 '')
16287         dflt=''
16288         nostick=true
16289         $cat <<EOM
16290
16291 If you'd like to make any changes to the config.sh file before I begin
16292 to configure things, do it as a shell escape now (e.g. !vi config.sh).
16293
16294 EOM
16295         rp="Press return or use a shell escape to edit config.sh:"
16296         . UU/myread
16297         nostick=''
16298         case "$ans" in
16299         '') ;;
16300         *) : in case they cannot read
16301                 sh 1>&4 -c "$ans";;
16302         esac
16303         ;;
16304 esac
16305
16306 : if this fails, just run all the .SH files by hand
16307 . ./config.sh
16308
16309 echo " "
16310 exec 1>&4
16311 . ./UU/extract
16312
16313 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
16314         dflt=y
16315         case "$silent" in
16316         true) ;;
16317         *)
16318                 $cat <<EOM
16319
16320 Now you need to generate make dependencies by running "$make depend".
16321 You might prefer to run it in background: "$make depend > makedepend.out &"
16322 It can take a while, so you might not want to run it right now.
16323
16324 EOM
16325                 ;;
16326         esac
16327         rp="Run $make depend now?"
16328         . UU/myread
16329         case "$ans" in
16330         y*)
16331                 $make depend && echo "Now you must run '$make'."
16332                 ;;
16333         *)
16334                 echo "You must run '$make depend' then '$make'."
16335                 ;;
16336         esac
16337 elif test -f [Mm]akefile; then
16338         echo " "
16339         echo "Now you must run a $make."
16340 else
16341         echo "Done."
16342 fi
16343
16344 if $test -f Policy.sh; then
16345     $cat <<EOM
16346
16347 If you compile $package on a different machine or from a different object
16348 directory, copy the Policy.sh file from this object directory to the
16349 new one before you run Configure -- this will help you with most of
16350 the policy defaults.
16351
16352 EOM
16353 fi
16354 if $test -f config.msg; then
16355     echo "Hmm.  I also noted the following information while running:"
16356     echo " "
16357     $cat config.msg >&4
16358     $rm -f config.msg
16359 fi
16360 $rm -f kit*isdone ark*isdone
16361 $rm -rf UU
16362
16363 : End of Configure
16364