Update Changes.
[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 Sun Nov 12 20:50:13 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_access=''
312 d_accessx=''
313 d_alarm=''
314 d_attribut=''
315 d_bcmp=''
316 d_bcopy=''
317 d_bzero=''
318 d_casti32=''
319 castflags=''
320 d_castneg=''
321 d_chown=''
322 d_chroot=''
323 d_chsize=''
324 d_closedir=''
325 d_void_closedir=''
326 d_const=''
327 cryptlib=''
328 d_crypt=''
329 d_csh=''
330 full_csh=''
331 d_cuserid=''
332 d_dbl_dig=''
333 d_difftime=''
334 d_dlerror=''
335 d_dlopen=''
336 d_dlsymun=''
337 d_dosuid=''
338 d_suidsafe=''
339 d_drand48proto=''
340 d_dup2=''
341 d_eaccess=''
342 d_endgrent=''
343 d_endhent=''
344 d_endnent=''
345 d_endpent=''
346 d_endpwent=''
347 d_endsent=''
348 d_fchmod=''
349 d_fchown=''
350 d_fcntl=''
351 d_fcntl_can_lock=''
352 d_fd_macros=''
353 d_fd_set=''
354 d_fds_bits=''
355 d_fgetpos=''
356 d_flexfnam=''
357 d_flock=''
358 d_fork=''
359 d_fpos64_t=''
360 d_frexpl=''
361 d_fs_data_s=''
362 d_fseeko=''
363 d_fsetpos=''
364 d_fstatfs=''
365 d_fsync=''
366 d_ftello=''
367 d_ftime=''
368 d_gettimeod=''
369 d_Gconvert=''
370 d_getcwd=''
371 d_getespwnam=''
372 d_getfsstat=''
373 d_getgrent=''
374 d_getgrps=''
375 d_gethbyaddr=''
376 d_gethbyname=''
377 d_gethent=''
378 aphostname=''
379 d_gethname=''
380 d_phostname=''
381 d_uname=''
382 d_gethostprotos=''
383 d_getlogin=''
384 d_getmnt=''
385 d_getmntent=''
386 d_getnbyaddr=''
387 d_getnbyname=''
388 d_getnent=''
389 d_getnetprotos=''
390 d_getpagsz=''
391 d_getpent=''
392 d_getpgid=''
393 d_getpgrp2=''
394 d_bsdgetpgrp=''
395 d_getpgrp=''
396 d_getppid=''
397 d_getprior=''
398 d_getpbyname=''
399 d_getpbynumber=''
400 d_getprotoprotos=''
401 d_getprpwnam=''
402 d_getpwent=''
403 d_getsent=''
404 d_getservprotos=''
405 d_getspnam=''
406 d_getsbyname=''
407 d_getsbyport=''
408 d_gnulibc=''
409 d_hasmntopt=''
410 d_htonl=''
411 d_iconv=''
412 d_inetaton=''
413 d_int64_t=''
414 d_isascii=''
415 d_isnan=''
416 d_isnanl=''
417 d_killpg=''
418 d_lchown=''
419 d_ldbl_dig=''
420 d_link=''
421 d_locconv=''
422 d_lockf=''
423 d_longdbl=''
424 longdblsize=''
425 d_longlong=''
426 longlongsize=''
427 d_lseekproto=''
428 d_lstat=''
429 d_madvise=''
430 d_mblen=''
431 d_mbstowcs=''
432 d_mbtowc=''
433 d_memchr=''
434 d_memcmp=''
435 d_memcpy=''
436 d_memmove=''
437 d_memset=''
438 d_mkdir=''
439 d_mkdtemp=''
440 d_mkfifo=''
441 d_mkstemp=''
442 d_mkstemps=''
443 d_mktime=''
444 d_mmap=''
445 mmaptype=''
446 d_modfl=''
447 d_mprotect=''
448 d_msg=''
449 d_msgctl=''
450 d_msgget=''
451 d_msgrcv=''
452 d_msgsnd=''
453 d_msync=''
454 d_munmap=''
455 d_nice=''
456 d_off64_t=''
457 d_open3=''
458 d_fpathconf=''
459 d_pathconf=''
460 d_pause=''
461 d_pipe=''
462 d_poll=''
463 d_portable=''
464 d_old_pthread_create_joinable=''
465 old_pthread_create_joinable=''
466 d_pthread_yield=''
467 d_sched_yield=''
468 sched_yield=''
469 d_qgcvt=''
470 d_readdir=''
471 d_rewinddir=''
472 d_seekdir=''
473 d_telldir=''
474 d_readlink=''
475 d_rename=''
476 d_rmdir=''
477 d_safebcpy=''
478 d_safemcpy=''
479 d_sanemcmp=''
480 d_select=''
481 d_sem=''
482 d_semctl=''
483 d_semget=''
484 d_semop=''
485 d_setegid=''
486 d_seteuid=''
487 d_setgrent=''
488 d_setgrps=''
489 d_sethent=''
490 d_setlinebuf=''
491 d_setlocale=''
492 d_setnent=''
493 d_setpent=''
494 d_setpgid=''
495 d_setpgrp2=''
496 d_bsdsetpgrp=''
497 d_setpgrp=''
498 d_setprior=''
499 d_setproctitle=''
500 d_setpwent=''
501 d_setregid=''
502 d_setresgid=''
503 d_setresuid=''
504 d_setreuid=''
505 d_setrgid=''
506 d_setruid=''
507 d_setsent=''
508 d_setsid=''
509 d_setvbuf=''
510 d_sfio=''
511 usesfio=''
512 d_shm=''
513 d_shmat=''
514 d_shmatprototype=''
515 shmattype=''
516 d_shmctl=''
517 d_shmdt=''
518 d_shmget=''
519 d_sigaction=''
520 d_sigsetjmp=''
521 d_msg_ctrunc=''
522 d_msg_dontroute=''
523 d_msg_oob=''
524 d_msg_peek=''
525 d_msg_proxy=''
526 d_oldsock=''
527 d_scm_rights=''
528 d_socket=''
529 d_sockpair=''
530 sockethdr=''
531 socketlib=''
532 d_socklen_t=''
533 d_socks5_init=''
534 d_sqrtl=''
535 d_statblks=''
536 d_statfs_f_flags=''
537 d_statfs_s=''
538 d_fstatvfs=''
539 d_statvfs=''
540 d_stdio_cnt_lval=''
541 d_stdio_ptr_lval=''
542 d_stdio_ptr_lval_nochange_cnt=''
543 d_stdio_ptr_lval_sets_cnt=''
544 d_stdiobase=''
545 d_stdstdio=''
546 stdio_base=''
547 stdio_bufsiz=''
548 stdio_cnt=''
549 stdio_filbuf=''
550 stdio_ptr=''
551 d_index=''
552 d_strchr=''
553 d_strcoll=''
554 d_strctcpy=''
555 d_strerrm=''
556 d_strerror=''
557 d_sysernlst=''
558 d_syserrlst=''
559 d_strtod=''
560 d_strtol=''
561 d_strtold=''
562 d_strtoll=''
563 d_strtoul=''
564 d_strtoull=''
565 d_strtouq=''
566 d_strxfrm=''
567 d_symlink=''
568 d_syscall=''
569 d_sysconf=''
570 d_system=''
571 d_tcgetpgrp=''
572 d_tcsetpgrp=''
573 d_telldirproto=''
574 d_time=''
575 timetype=''
576 clocktype=''
577 d_times=''
578 d_truncate=''
579 d_tzname=''
580 d_umask=''
581 d_semctl_semid_ds=''
582 d_semctl_semun=''
583 d_union_semun=''
584 d_ustat=''
585 d_vfork=''
586 usevfork=''
587 d_voidsig=''
588 signal_t=''
589 d_volatile=''
590 d_charvspr=''
591 d_vprintf=''
592 d_wait4=''
593 d_waitpid=''
594 d_wcstombs=''
595 d_wctomb=''
596 dlext=''
597 cccdlflags=''
598 ccdlflags=''
599 dlsrc=''
600 ld=''
601 lddlflags=''
602 usedl=''
603 doublesize=''
604 ebcdic=''
605 fflushNULL=''
606 fflushall=''
607 fpossize=''
608 fpostype=''
609 gccosandvers=''
610 gccversion=''
611 gidformat=''
612 gidsign=''
613 gidsize=''
614 gidtype=''
615 groupstype=''
616 h_fcntl=''
617 h_sysfile=''
618 i_arpainet=''
619 db_hashtype=''
620 db_prefixtype=''
621 i_db=''
622 i_dbm=''
623 i_rpcsvcdbm=''
624 d_dirnamlen=''
625 direntrytype=''
626 i_dirent=''
627 i_dld=''
628 i_dlfcn=''
629 i_fcntl=''
630 i_float=''
631 i_gdbm=''
632 d_grpasswd=''
633 i_grp=''
634 i_iconv=''
635 i_ieeefp=''
636 i_inttypes=''
637 i_libutil=''
638 i_limits=''
639 i_locale=''
640 i_machcthr=''
641 i_malloc=''
642 i_math=''
643 i_memory=''
644 i_mntent=''
645 i_ndbm=''
646 i_netdb=''
647 i_neterrno=''
648 i_netinettcp=''
649 i_niin=''
650 i_sysin=''
651 i_poll=''
652 i_prot=''
653 i_pthread=''
654 d_pwage=''
655 d_pwchange=''
656 d_pwclass=''
657 d_pwcomment=''
658 d_pwexpire=''
659 d_pwgecos=''
660 d_pwpasswd=''
661 d_pwquota=''
662 i_pwd=''
663 i_sfio=''
664 i_shadow=''
665 i_socks=''
666 i_stddef=''
667 i_stdlib=''
668 i_string=''
669 strings=''
670 i_sunmath=''
671 i_sysaccess=''
672 i_sysdir=''
673 i_sysfile=''
674 d_voidtty=''
675 i_bsdioctl=''
676 i_sysfilio=''
677 i_sysioctl=''
678 i_syssockio=''
679 i_syslog=''
680 i_sysmman=''
681 i_sysmode=''
682 i_sysmount=''
683 i_sysndir=''
684 i_sysparam=''
685 i_sysresrc=''
686 i_syssecrt=''
687 i_sysselct=''
688 i_sysstat=''
689 i_sysstatfs=''
690 i_sysstatvfs=''
691 i_systimes=''
692 i_systypes=''
693 i_sysuio=''
694 i_sysun=''
695 i_sysutsname=''
696 i_sysvfs=''
697 i_syswait=''
698 i_sgtty=''
699 i_termio=''
700 i_termios=''
701 i_systime=''
702 i_systimek=''
703 i_time=''
704 timeincl=''
705 i_unistd=''
706 i_ustat=''
707 i_utime=''
708 i_values=''
709 i_stdarg=''
710 i_varargs=''
711 i_varhdr=''
712 i_vfork=''
713 inc_version_list=''
714 inc_version_list_init=''
715 installprefix=''
716 installprefixexp=''
717 installstyle=''
718 installusrbinperl=''
719 intsize=''
720 longsize=''
721 shortsize=''
722 libc=''
723 ldlibpthname=''
724 libperl=''
725 shrpenv=''
726 useshrplib=''
727 glibpth=''
728 libpth=''
729 loclibpth=''
730 plibpth=''
731 xlibpth=''
732 ignore_versioned_solibs=''
733 libs=''
734 libsdirs=''
735 libsfiles=''
736 libsfound=''
737 libspath=''
738 lns=''
739 d_PRIEUldbl=''
740 d_PRIFUldbl=''
741 d_PRIGUldbl=''
742 d_PRIeldbl=''
743 d_PRIfldbl=''
744 d_PRIgldbl=''
745 d_SCNfldbl=''
746 sPRIEUldbl=''
747 sPRIFUldbl=''
748 sPRIGUldbl=''
749 sPRIeldbl=''
750 sPRIfldbl=''
751 sPRIgldbl=''
752 sSCNfldbl=''
753 lseeksize=''
754 lseektype=''
755 make_set_make=''
756 d_mymalloc=''
757 freetype=''
758 mallocobj=''
759 mallocsrc=''
760 malloctype=''
761 usemymalloc=''
762 installman1dir=''
763 man1dir=''
764 man1direxp=''
765 man1ext=''
766 installman3dir=''
767 man3dir=''
768 man3direxp=''
769 man3ext=''
770 modetype=''
771 multiarch=''
772 mydomain=''
773 myhostname=''
774 phostname=''
775 c=''
776 n=''
777 d_eofnblk=''
778 eagain=''
779 o_nonblock=''
780 rd_nodata=''
781 netdb_hlen_type=''
782 netdb_host_type=''
783 netdb_name_type=''
784 netdb_net_type=''
785 groupcat=''
786 hostcat=''
787 passcat=''
788 orderlib=''
789 ranlib=''
790 d_perl_otherlibdirs=''
791 otherlibdirs=''
792 package=''
793 spackage=''
794 pager=''
795 api_revision=''
796 api_subversion=''
797 api_version=''
798 api_versionstring=''
799 patchlevel=''
800 revision=''
801 subversion=''
802 version=''
803 perl5=''
804 perladmin=''
805 perlpath=''
806 d_nv_preserves_uv=''
807 d_nv_preserves_uv_bits=''
808 i16size=''
809 i16type=''
810 i32size=''
811 i32type=''
812 i64size=''
813 i64type=''
814 i8size=''
815 i8type=''
816 ivsize=''
817 ivtype=''
818 nvsize=''
819 nvtype=''
820 u16size=''
821 u16type=''
822 u32size=''
823 u32type=''
824 u64size=''
825 u64type=''
826 u8size=''
827 u8type=''
828 uvsize=''
829 uvtype=''
830 ivdformat=''
831 nvEUformat=''
832 nvFUformat=''
833 nvGUformat=''
834 nveformat=''
835 nvfformat=''
836 nvgformat=''
837 uvXUformat=''
838 uvoformat=''
839 uvuformat=''
840 uvxformat=''
841 pidtype=''
842 prefix=''
843 prefixexp=''
844 installprivlib=''
845 privlib=''
846 privlibexp=''
847 prototype=''
848 ptrsize=''
849 d_PRIXU64=''
850 d_PRId64=''
851 d_PRIi64=''
852 d_PRIo64=''
853 d_PRIu64=''
854 d_PRIx64=''
855 sPRIXU64=''
856 sPRId64=''
857 sPRIi64=''
858 sPRIo64=''
859 sPRIu64=''
860 sPRIx64=''
861 d_quad=''
862 quadkind=''
863 quadtype=''
864 uquadtype=''
865 drand01=''
866 randbits=''
867 randfunc=''
868 randseedtype=''
869 seedfunc=''
870 installscript=''
871 scriptdir=''
872 scriptdirexp=''
873 selectminbits=''
874 selecttype=''
875 sh=''
876 sig_count=''
877 sig_name=''
878 sig_name_init=''
879 sig_num=''
880 sig_num_init=''
881 installsitearch=''
882 sitearch=''
883 sitearchexp=''
884 installsitebin=''
885 sitebin=''
886 sitebinexp=''
887 installsitelib=''
888 sitelib=''
889 sitelib_stem=''
890 sitelibexp=''
891 siteprefix=''
892 siteprefixexp=''
893 sizesize=''
894 sizetype=''
895 so=''
896 socksizetype=''
897 sharpbang=''
898 shsharp=''
899 spitshell=''
900 src=''
901 ssizetype=''
902 startperl=''
903 startsh=''
904 stdchar=''
905 d_stdio_stream_array=''
906 stdio_stream_array=''
907 sysman=''
908 trnl=''
909 uidformat=''
910 uidsign=''
911 uidsize=''
912 uidtype=''
913 archname64=''
914 use64bitall=''
915 use64bitint=''
916 ccflags_uselargefiles=''
917 ldflags_uselargefiles=''
918 libswanted_uselargefiles=''
919 uselargefiles=''
920 uselongdouble=''
921 usemorebits=''
922 usemultiplicity=''
923 nm_opt=''
924 nm_so_opt=''
925 runnm=''
926 usenm=''
927 useperlio=''
928 usesocks=''
929 d_oldpthreads=''
930 use5005threads=''
931 useithreads=''
932 usethreads=''
933 incpath=''
934 mips_type=''
935 usrinc=''
936 d_vendorarch=''
937 installvendorarch=''
938 vendorarch=''
939 vendorarchexp=''
940 d_vendorbin=''
941 installvendorbin=''
942 vendorbin=''
943 vendorbinexp=''
944 d_vendorlib=''
945 installvendorlib=''
946 vendorlib=''
947 vendorlib_stem=''
948 vendorlibexp=''
949 usevendorprefix=''
950 vendorprefix=''
951 vendorprefixexp=''
952 versiononly=''
953 defvoidused=''
954 voidflags=''
955 pm_apiversion=''
956 xs_apiversion=''
957 CONFIG=''
958
959 define='define'
960 undef='undef'
961 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
962 rmlist=''
963
964 : We must find out about Eunice early
965 eunicefix=':'
966 if test -f /etc/unixtovms; then
967         eunicefix=/etc/unixtovms
968 fi
969 if test -f /etc/unixtovms.exe; then
970         eunicefix=/etc/unixtovms.exe
971 fi
972
973 i_whoami=''
974 ccname=''
975 ccversion=''
976 perllibs=''
977 : set useposix=false in your hint file to disable the POSIX extension.
978 useposix=true
979 : set useopcode=false in your hint file to disable the Opcode extension.
980 useopcode=true
981 : Trailing extension.  Override this in a hint file, if needed.
982 _exe=''
983 : Extra object files, if any, needed on this platform.
984 archobjs=''
985 archname=''
986 : Possible local include directories to search.
987 : Set locincpth to "" in a hint file to defeat local include searches.
988 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
989 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
990 :
991 : no include file wanted by default
992 inclwanted=''
993
994 groupstype=''
995 : change the next line if compiling for Xenix/286 on Xenix/386
996 xlibpth='/usr/lib/386 /lib/386'
997 : Possible local library directories to search.
998 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
999 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1000
1001 : general looking path for locating libraries
1002 glibpth="/lib /usr/lib $xlibpth"
1003 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1004 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1005 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
1006
1007 : Private path used by Configure to find libraries.  Its value
1008 : is prepended to libpth. This variable takes care of special
1009 : machines, like the mips.  Usually, it should be empty.
1010 plibpth=''
1011
1012 : default library list
1013 libswanted=''
1014 : some systems want to use only the non-versioned libso:s
1015 ignore_versioned_solibs=''
1016 archname64=''
1017 ccflags_uselargefiles=''
1018 ldflags_uselargefiles=''
1019 libswanted_uselargefiles=''
1020 : set usemultiplicity on the Configure command line to enable multiplicity.
1021 : set usesocks on the Configure command line to enable socks.
1022 : set usethreads on the Configure command line to enable threads.
1023 : full support for void wanted by default
1024 defvoidused=15
1025
1026 : List of libraries we want.
1027 : If anyone needs -lnet, put it in a hint file.
1028 libswanted='sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl'
1029 libswanted="$libswanted dld ld sun m c cposix posix"
1030 libswanted="$libswanted ndir dir crypt sec"
1031 libswanted="$libswanted ucb bsd BSD PW x iconv util"
1032 : We probably want to search /usr/shlib before most other libraries.
1033 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1034 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1035 glibpth="/usr/shlib $glibpth"
1036 : Do not use vfork unless overridden by a hint file.
1037 usevfork=false
1038
1039 : Find the basic shell for Bourne shell scripts
1040 case "$sh" in
1041 '')
1042         case "$SYSTYPE" in
1043         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1044         *) xxx='/bin/sh';;
1045         esac
1046         if test -f "$xxx"; then
1047                 sh="$xxx"
1048         else
1049                 : Build up a list and do a single loop so we can 'break' out.
1050                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1051                 for xxx in sh bash ksh pdksh ash; do
1052                         for p in $pth; do
1053                                 try="$try ${p}/${xxx}"
1054                         done
1055                 done
1056                 for xxx in $try; do
1057                         if test -f "$xxx"; then
1058                                 sh="$xxx";
1059                                 break
1060                         elif test -f "$xxx.exe"; then
1061                                 sh="$xxx";
1062                                 break
1063                         fi
1064                 done
1065         fi
1066         ;;
1067 esac
1068
1069 case "$sh" in
1070 '')     cat <<EOM >&2
1071 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
1072
1073 Usually it's in /bin/sh.  How did you even get this far?
1074 Please contact me (Perl Maintainers) at perlbug@perl.org and 
1075 we'll try to straighten this all out.
1076 EOM
1077         exit 1
1078         ;;
1079 esac
1080
1081 : see if sh knows # comments
1082 if `$sh -c '#' >/dev/null 2>&1`; then
1083         shsharp=true
1084         spitshell=cat
1085         xcat=/bin/cat
1086         test -f $xcat || xcat=/usr/bin/cat
1087         echo "#!$xcat" >try
1088         $eunicefix try
1089         chmod +x try
1090         ./try > today
1091         if test -s today; then
1092                 sharpbang='#!'
1093         else
1094                 echo "#! $xcat" > try
1095                 $eunicefix try
1096                 chmod +x try
1097                 ./try > today
1098                 if test -s today; then
1099                         sharpbang='#! '
1100                 else
1101                         sharpbang=': use '
1102                 fi
1103         fi
1104 else
1105         echo " "
1106         echo "Your $sh doesn't grok # comments--I will strip them later on."
1107         shsharp=false
1108         cd ..
1109         echo "exec grep -v '^[  ]*#'" >spitshell
1110         chmod +x spitshell
1111         $eunicefix spitshell
1112         spitshell=`pwd`/spitshell
1113         cd UU
1114         echo "I presume that if # doesn't work, #! won't work either!"
1115         sharpbang=': use '
1116 fi
1117 rm -f try today
1118
1119 : figure out how to guarantee sh startup
1120 case "$startsh" in
1121 '') startsh=${sharpbang}${sh} ;;
1122 *)
1123 esac
1124 cat >try <<EOSS
1125 $startsh
1126 set abc
1127 test "$?abc" != 1
1128 EOSS
1129
1130 chmod +x try
1131 $eunicefix try
1132 if ./try; then
1133         : echo "Yup, it does."
1134 else
1135         echo "Hmm... '$startsh' does not guarantee sh startup..."
1136         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1137 fi
1138 rm -f try
1139
1140
1141 : Save command line options in file UU/cmdline.opt for later use in
1142 : generating config.sh.
1143 cat > cmdline.opt <<EOSH
1144 # Configure command line arguments.
1145 config_arg0='$0'
1146 config_args='$*'
1147 config_argc=$#
1148 EOSH
1149 argn=1
1150 for arg in "$@"; do
1151         cat >>cmdline.opt <<EOSH
1152 config_arg$argn='$arg'
1153 EOSH
1154         argn=`expr $argn + 1`
1155 done
1156
1157 : produce awk script to parse command line options
1158 cat >options.awk <<'EOF'
1159 BEGIN {
1160         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1161
1162         len = length(optstr);
1163         for (i = 1; i <= len; i++) {
1164                 c = substr(optstr, i, 1);
1165                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1166                 if (a == ":") {
1167                         arg[c] = 1;
1168                         i++;
1169                 }
1170                 opt[c] = 1;
1171         }
1172 }
1173 {
1174         expect = 0;
1175         str = $0;
1176         if (substr(str, 1, 1) != "-") {
1177                 printf("'%s'\n", str);
1178                 next;
1179         }
1180         len = length($0);
1181         for (i = 2; i <= len; i++) {
1182                 c = substr(str, i, 1);
1183                 if (!opt[c]) {
1184                         printf("-%s\n", substr(str, i));
1185                         next;
1186                 }
1187                 printf("-%s\n", c);
1188                 if (arg[c]) {
1189                         if (i < len)
1190                                 printf("'%s'\n", substr(str, i + 1));
1191                         else
1192                                 expect = 1;
1193                         next;
1194                 }
1195         }
1196 }
1197 END {
1198         if (expect)
1199                 print "?";
1200 }
1201 EOF
1202
1203 : process the command line options
1204 set X `for arg in "$@"; do echo "X$arg"; done |
1205         sed -e s/X// | awk -f options.awk`
1206 eval "set $*"
1207 shift
1208 rm -f options.awk
1209
1210 : set up default values
1211 fastread=''
1212 reuseval=false
1213 config_sh=''
1214 alldone=''
1215 error=''
1216 silent=''
1217 extractsh=''
1218 override=''
1219 knowitall=''
1220 rm -f optdef.sh posthint.sh
1221 cat >optdef.sh <<EOS
1222 $startsh
1223 EOS
1224
1225
1226 : option parsing
1227 while test $# -gt 0; do
1228         case "$1" in
1229         -d) shift; fastread=yes;;
1230         -e) shift; alldone=cont;;
1231         -f)
1232                 shift
1233                 cd ..
1234                 if test -r "$1"; then
1235                         config_sh="$1"
1236                 else
1237                         echo "$me: cannot read config file $1." >&2
1238                         error=true
1239                 fi
1240                 cd UU
1241                 shift;;
1242         -h) shift; error=true;;
1243         -r) shift; reuseval=true;;
1244         -s) shift; silent=true; realsilent=true;;
1245         -E) shift; alldone=exit;;
1246         -K) shift; knowitall=true;;
1247         -O) shift; override=true;;
1248         -S) shift; silent=true; extractsh=true;;
1249         -D)
1250                 shift
1251                 case "$1" in
1252                 *=)
1253                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1254                         echo "$me: ignoring -D $1" >&2
1255                         ;;
1256                 *=*) echo "$1" | \
1257                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1258                 *) echo "$1='define'" >> optdef.sh;;
1259                 esac
1260                 shift
1261                 ;;
1262         -U)
1263                 shift
1264                 case "$1" in
1265                 *=) echo "$1" >> optdef.sh;;
1266                 *=*)
1267                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1268                         echo "$me: ignoring -U $1" >&2
1269                         ;;
1270                 *) echo "$1='undef'" >> optdef.sh;;
1271                 esac
1272                 shift
1273                 ;;
1274         -A)
1275             shift
1276             xxx=''
1277             yyy="$1"
1278             zzz=''
1279             uuu=undef
1280             case "$yyy" in
1281             *=*) zzz=`echo $yyy|sed 's!=.*!!'`
1282                  case "$zzz" in
1283                  *:*) zzz='' ;;
1284                  *)   xxx=append
1285                       zzz=" "`echo $yyy|sed 's!^[^=]*=!!'` 
1286                       yyy=`echo $yyy|sed 's!=.*!!'` ;;
1287                  esac
1288                  ;;
1289             esac
1290             case "$xxx" in
1291             '')  case "$yyy" in
1292                  *:*) xxx=`echo $yyy|sed 's!:.*!!'`
1293                       yyy=`echo $yyy|sed 's!^[^:]*:!!'`
1294                       zzz=`echo $yyy|sed 's!^[^=]*=!!'`
1295                       yyy=`echo $yyy|sed 's!=.*!!'` ;;
1296                  *)   xxx=`echo $yyy|sed 's!:.*!!'`
1297                       yyy=`echo $yyy|sed 's!^[^:]*:!!'` ;;
1298                  esac
1299                  ;;       
1300             esac
1301             case "$xxx" in
1302             append)
1303                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1304             clear)
1305                 echo "$yyy=''"                  >> posthint.sh ;;
1306             define)
1307                 case "$zzz" in
1308                 '') zzz=define ;;
1309                 esac
1310                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1311             eval)
1312                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1313             prepend)
1314                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1315             undef)
1316                 case "$zzz" in
1317                 '') zzz="$uuu" ;;
1318                 esac
1319                 echo "$yyy=$zzz"                >> posthint.sh ;;
1320             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1321             esac
1322             shift
1323             ;;
1324         -V) echo "$me generated by metaconfig 3.0 PL70." >&2
1325             exit 0;;
1326         --) break;;
1327         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1328         *) break;;
1329         esac
1330 done
1331
1332 case "$error" in
1333 true)
1334         cat >&2 <<EOM
1335 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1336                  [-U symbol] [-U symbol=] [-A command:symbol...]
1337   -d : use defaults for all answers.
1338   -e : go on without questioning past the production of config.sh.
1339   -f : specify an alternate default configuration file.
1340   -h : print this help message and exit (with an error status).
1341   -r : reuse C symbols value if possible (skips costly nm extraction).
1342   -s : silent mode, only echoes questions and essential information.
1343   -D : define symbol to have some value:
1344          -D symbol         symbol gets the value 'define'
1345          -D symbol=value   symbol gets the value 'value'
1346   -E : stop at the end of questions, after having produced config.sh.
1347   -K : do not use unless you know what you are doing.
1348   -O : let -D and -U override definitions from loaded configuration file.
1349   -S : perform variable substitutions on all .SH files (can mix with -f)
1350   -U : undefine symbol:
1351          -U symbol    symbol gets the value 'undef'
1352          -U symbol=   symbol gets completely empty
1353   -A : manipulate symbol after the platform specific hints have been applied:
1354          -A symbol=value                append " "value to symbol
1355          -A append:symbol=value         append value to symbol
1356          -A define:symbol=value         define symbol to have value
1357          -A clear:symbol                define symbol to be ''
1358          -A define:symbol               define symbol to be 'define'
1359          -A eval:symbol=value           define symbol to be eval of value
1360          -A prepend:symbol=value        prepend value to symbol
1361          -A undef:symbol                define symbol to be 'undef'
1362          -A undef:symbol=               define symbol to be ''
1363   -V : print version number and exit (with a zero status).
1364 EOM
1365         exit 1
1366         ;;
1367 esac
1368
1369 : Sanity checks
1370 case "$fastread$alldone" in
1371 yescont|yesexit) ;;
1372 *)
1373         case "$extractsh" in
1374         true) ;;
1375         *)
1376                 if test ! -t 0; then
1377                         echo "Say 'sh Configure', not 'sh <Configure'"
1378                         exit 1
1379                 fi
1380                 ;;
1381         esac
1382         ;;
1383 esac
1384
1385 exec 4>&1
1386 case "$silent" in
1387 true) exec 1>/dev/null;;
1388 esac
1389
1390 : run the defines and the undefines, if any, but leave the file out there...
1391 touch optdef.sh
1392 . ./optdef.sh
1393 : create the posthint manipulation script and leave the file out there...
1394 touch posthint.sh
1395
1396 : set package name
1397 package=perl5
1398 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1399 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1400 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1401 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1402 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1403 esac
1404
1405 : Some greps do not return status, grrr.
1406 echo "grimblepritz" >grimble
1407 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1408         contains=contains
1409 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1410         contains=grep
1411 else
1412         contains=contains
1413 fi
1414 rm -f grimble
1415 : the following should work in any shell
1416 case "$contains" in
1417 contains*)
1418         echo " "
1419         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1420         cat >contains <<'EOSS'
1421 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1422 EOSS
1423 chmod +x contains
1424 esac
1425
1426 : Find the path to the source tree
1427 case "$src" in
1428 '') case "$0" in
1429     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1430          case "$src" in
1431          /*)    ;;
1432          *)     src=`cd ../$src && pwd` ;;
1433          esac
1434          ;;
1435     *)   src='.';;
1436     esac;;
1437 esac
1438 case "$src" in
1439 '')     src=/
1440         rsrc=/
1441         ;;
1442 /*) rsrc="$src";;
1443 *) rsrc="../$src";;
1444 esac
1445 if test -f $rsrc/Configure && \
1446         $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1447 then
1448    : found it, so we are ok.
1449 else
1450         rsrc=''
1451         for src in . .. ../.. ../../.. ../../../..; do
1452                 if test -f ../$src/Configure && \
1453                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1454                 then
1455                         rsrc=../$src
1456                         break
1457                 fi
1458         done
1459 fi
1460 case "$rsrc" in
1461 '')
1462         cat <<EOM >&4
1463
1464 Sorry, I can't seem to locate the source dir for $package.  Please start
1465 Configure with an explicit path -- i.e. /some/path/Configure.
1466
1467 EOM
1468         exit 1
1469         ;;
1470 ../.)   rsrc='..';;
1471 *)
1472         echo " "
1473         echo "Sources for $package found in \"$src\"." >&4
1474         ;;
1475 esac
1476
1477 : script used to extract .SH files with variable substitutions
1478 cat >extract <<'EOS'
1479 CONFIGDOTSH=true
1480 echo "Doing variable substitutions on .SH files..."
1481 if test -f $src/MANIFEST; then
1482         set x `awk '{print $1}' <$src/MANIFEST | grep '\.SH$'`
1483 else
1484         echo "(Looking for .SH files under the source directory.)"
1485         set x `(cd $src; find . -name "*.SH" -print)`
1486 fi
1487 shift
1488 case $# in
1489 0) set x `(cd $src; echo *.SH)`; shift;;
1490 esac
1491 if test ! -f $src/$1; then
1492         shift
1493 fi
1494 mkdir_p='
1495 name=$1;
1496 create="";
1497 while test $name; do
1498         if test ! -d "$name"; then
1499                 create="$name $create";
1500                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1501                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1502         else
1503                 name="";
1504         fi;
1505 done;
1506 for file in $create; do
1507         mkdir $file;
1508 done
1509 '
1510 for file in $*; do
1511         case "$src" in
1512         ".")
1513                 case "$file" in
1514                 */*)
1515                         dir=`expr X$file : 'X\(.*\)/'`
1516                         file=`expr X$file : 'X.*/\(.*\)'`
1517                         (cd $dir && . ./$file)
1518                         ;;
1519                 *)
1520                         . ./$file
1521                         ;;
1522                 esac
1523                 ;;
1524         *)
1525                 case "$file" in
1526                 */*)
1527                         dir=`expr X$file : 'X\(.*\)/'`
1528                         file=`expr X$file : 'X.*/\(.*\)'`
1529                         (set x $dir; shift; eval $mkdir_p)
1530                         sh <$src/$dir/$file
1531                         ;;
1532                 *)
1533                         sh <$src/$file
1534                         ;;
1535                 esac
1536                 ;;
1537         esac
1538 done
1539 if test -f $src/config_h.SH; then
1540         if test ! -f config.h; then
1541         : oops, they left it out of MANIFEST, probably, so do it anyway.
1542         . $src/config_h.SH
1543         fi
1544 fi
1545 EOS
1546
1547 : extract files and exit if asked to do so
1548 case "$extractsh" in
1549 true)
1550         case "$realsilent" in
1551         true) ;;
1552         *) exec 1>&4;;
1553         esac
1554         case "$config_sh" in
1555         '') config_sh='config.sh';;
1556         esac
1557         echo " "
1558         echo "Fetching answers from $config_sh..."
1559         cd ..
1560         . $config_sh
1561         test "$override" && . ./optdef.sh
1562         echo " "
1563         . UU/extract
1564         rm -rf UU
1565         echo "Done."
1566         exit 0
1567         ;;
1568 esac
1569
1570 : Eunice requires " " instead of "", can you believe it
1571 echo " "
1572 : Here we go...
1573 echo "Beginning of configuration questions for $package."
1574
1575 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1576
1577 : first determine how to suppress newline on echo command
1578 echo " "
1579 echo "Checking echo to see how to suppress newlines..."
1580 (echo "hi there\c" ; echo " ") >.echotmp
1581 if $contains c .echotmp >/dev/null 2>&1 ; then
1582         echo "...using -n."
1583         n='-n'
1584         c=''
1585 else
1586         cat <<'EOM'
1587 ...using \c
1588 EOM
1589         n=''
1590         c='\c'
1591 fi
1592 echo $n "The star should be here-->$c"
1593 echo '*'
1594 rm -f .echotmp
1595
1596 : Now test for existence of everything in MANIFEST
1597 echo " "
1598 if test -f $rsrc/MANIFEST; then
1599         echo "First let's make sure your kit is complete.  Checking..." >&4
1600         awk '$1 !~ /PACK[A-Z]+/ {print $1}' $rsrc/MANIFEST | split -50
1601         rm -f missing
1602         tmppwd=`pwd`
1603         for filelist in x??; do
1604                 (cd $rsrc; ls `cat $tmppwd/$filelist` >/dev/null 2>>$tmppwd/missing)
1605         done
1606         if test -s missing; then
1607                 cat missing >&4
1608                 cat >&4 <<'EOM'
1609
1610 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1611
1612 You have the option of continuing the configuration process, despite the
1613 distinct possibility that your kit is damaged, by typing 'y'es.  If you
1614 do, don't blame me if something goes wrong.  I advise you to type 'n'o
1615 and contact the author (perlbug@perl.org).
1616
1617 EOM
1618                 echo $n "Continue? [n] $c" >&4
1619                 read ans
1620                 case "$ans" in
1621                 y*)
1622                         echo "Continuing..." >&4
1623                         rm -f missing
1624                         ;;
1625                 *)
1626                         echo "ABORTING..." >&4
1627                         kill $$
1628                         ;;
1629                 esac
1630         else
1631                 echo "Looks good..."
1632         fi
1633 else
1634         echo "There is no MANIFEST file.  I hope your kit is complete !"
1635 fi
1636 rm -f missing x??
1637
1638 echo " "
1639 : Find the appropriate value for a newline for tr
1640 if test -n "$DJGPP"; then
1641        trnl='\012'
1642 fi
1643 if test X"$trnl" = X; then
1644         case "`echo foo|tr '\n' x 2>/dev/null`" in
1645         foox) trnl='\n' ;;
1646         esac
1647 fi
1648 if test X"$trnl" = X; then
1649         case "`echo foo|tr '\012' x 2>/dev/null`" in
1650         foox) trnl='\012' ;;
1651         esac
1652 fi
1653 if test X"$trnl" = X; then
1654         cat <<EOM >&2
1655
1656 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
1657
1658 EOM
1659         exit 1
1660 fi
1661
1662 : compute the number of columns on the terminal for proper question formatting
1663 case "$COLUMNS" in
1664 '') COLUMNS='80';;
1665 esac
1666
1667 : set up the echo used in my read
1668 myecho="case \"\$xxxm\" in
1669 '') echo $n \"\$rp $c\" >&4;;
1670 *) case \"\$rp\" in
1671         '') echo $n \"[\$xxxm] $c\";;
1672         *)
1673                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
1674                         echo \"\$rp\" >&4
1675                         echo $n \"[\$xxxm] $c\" >&4
1676                 else
1677                         echo $n \"\$rp [\$xxxm] $c\" >&4
1678                 fi
1679                 ;;
1680         esac;;
1681 esac"
1682
1683 : now set up to do reads with possible shell escape and default assignment
1684 cat <<EOSC >myread
1685 $startsh
1686 xxxm=\$dflt
1687 $myecho
1688 ans='!'
1689 case "\$fastread" in
1690 yes) case "\$dflt" in
1691         '') ;;
1692         *) ans='';
1693                 case "\$silent-\$rp" in
1694                 true-) ;;
1695                 *) echo " " >&4;;
1696                 esac;;
1697         esac;;
1698 *) case "\$silent" in
1699         true) case "\$rp" in
1700                 '') ans='';;
1701                 esac;;
1702         esac;;
1703 esac
1704 while expr "X\$ans" : "X!" >/dev/null; do
1705         read answ
1706         set x \$xxxm
1707         shift
1708         aok=''; eval "ans=\\"\$answ\\"" && aok=y
1709         case  "\$answ" in
1710         "!")
1711                 sh 1>&4
1712                 echo " "
1713                 $myecho
1714                 ;;
1715         !*)
1716                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
1717                 shift
1718                 sh 1>&4 -c "\$*"
1719                 echo " "
1720                 $myecho
1721                 ;;
1722         "\$ans")
1723                 case "\$ans" in
1724                 \\&*)
1725                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
1726                         shift
1727                         case "\$1" in
1728                         -d)
1729                                 fastread=yes
1730                                 echo "(OK, I'll run with -d after this question.)" >&4
1731                                 ;;
1732                         -*)
1733                                 echo "*** Sorry, \$1 not supported yet." >&4
1734                                 ;;
1735                         esac
1736                         $myecho
1737                         ans=!
1738                         ;;
1739                 esac;;
1740         *)
1741                 case "\$aok" in
1742                 y)
1743                         echo "*** Substitution done -- please confirm."
1744                         xxxm="\$ans"
1745                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
1746                         xxxm="\$ans"
1747                         ans=!
1748                         ;;
1749                 *)
1750                         echo "*** Error -- try again."
1751                         ans=!
1752                         ;;
1753                 esac
1754                 $myecho
1755                 ;;
1756         esac
1757         case "\$ans\$xxxm\$nostick" in
1758         '')
1759                 ans=!
1760                 $myecho
1761                 ;;
1762         esac
1763 done
1764 case "\$ans" in
1765 '') ans="\$xxxm";;
1766 esac
1767 EOSC
1768
1769 : create .config dir to save info across Configure sessions
1770 test -d ../.config || mkdir ../.config
1771 cat >../.config/README <<EOF
1772 This directory created by Configure to save information that should
1773 persist across sessions for $package.
1774
1775 You may safely delete it if you wish.
1776 EOF
1777
1778 xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
1779 case "$usedevel" in
1780 $define|true|[yY]*) ;;
1781 *) case "$xversion" in
1782    *[13579])
1783         cat >&4 <<EOH
1784 *** WHOA THERE!!! ***
1785
1786     This is an UNSTABLE DEVELOPMENT release.
1787     The version of this $package distribution is $xversion, that is, odd,
1788     (as opposed to even) and that signifies a development release.
1789     If you want a maintenance release, you want an even-numbered version.
1790
1791     Do ***NOT*** install this into production use.
1792     Data corruption and crashes are possible.
1793
1794     It is most seriously suggested that you do not continue any further
1795     unless you want to help in developing and debugging Perl.
1796
1797 EOH
1798         rp='Do you really want to continue?'
1799         dflt='n'
1800         . ./myread
1801         case "$ans" in
1802         [yY]) echo >&4 "Okay, continuing." ;;
1803         *) echo >&4 "Okay, bye."
1804            exit 1
1805            ;;
1806         esac
1807         ;;
1808     esac
1809     ;;
1810 esac
1811
1812 : general instructions
1813 needman=true
1814 firsttime=true
1815 user=`(logname) 2>/dev/null`
1816 case "$user" in
1817 '') user=`whoami 2>&1`;;
1818 esac
1819 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
1820         firsttime=false
1821         echo " "
1822         rp='Would you like to see the instructions?'
1823         dflt=n
1824         . ./myread
1825         case "$ans" in
1826         [yY]*) ;;
1827         *) needman=false;;
1828         esac
1829 fi
1830 if $needman; then
1831         cat <<EOH
1832
1833 This installation shell script will examine your system and ask you questions
1834 to determine how the perl5 package should be installed. If you get
1835 stuck on a question, you may use a ! shell escape to start a subshell or
1836 execute a command.  Many of the questions will have default answers in square
1837 brackets; typing carriage return will give you the default.
1838
1839 On some of the questions which ask for file or directory names you are allowed
1840 to use the ~name construct to specify the login directory belonging to "name",
1841 even if you don't have a shell which knows about that.  Questions where this is
1842 allowed will be marked "(~name ok)".
1843
1844 EOH
1845         rp=''
1846         dflt='Type carriage return to continue'
1847         . ./myread
1848         cat <<'EOH'
1849
1850 The prompter used in this script allows you to use shell variables and
1851 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
1852 in the default answer, as if the default line was a set of arguments given to a
1853 script shell.  This means you may also use $* to repeat the whole default line,
1854 so you do not have to re-type everything to add something to the default.
1855
1856 Everytime there is a substitution, you will have to confirm.  If there is an
1857 error (e.g. an unmatched backtick), the default answer will remain unchanged
1858 and you will be prompted again.
1859
1860 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
1861 the questions and use the computed defaults (or the previous answers if there
1862 was already a config.sh file). Type 'Configure -h' for a list of options.
1863 You may also start interactively and then answer '& -d' at any prompt to turn
1864 on the non-interactive behaviour for the remainder of the execution.
1865
1866 EOH
1867         . ./myread
1868         cat <<EOH
1869
1870 Much effort has been expended to ensure that this shell script will run on any
1871 Unix system.  If despite that it blows up on yours, your best bet is to edit
1872 Configure and run it again.  If you can't run Configure for some reason,
1873 you'll have to generate a config.sh file by hand.  Whatever problems you
1874 have, let me (perlbug@perl.org) know how I blew it.
1875
1876 This installation script affects things in two ways:
1877
1878 1) it may do direct variable substitutions on some of the files included
1879    in this kit.
1880 2) it builds a config.h file for inclusion in C programs.  You may edit
1881    any of these files as the need arises after running this script.
1882
1883 If you make a mistake on a question, there is no easy way to back up to it
1884 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
1885 files.  Configure will offer to let you do this before it runs the SH files.
1886
1887 EOH
1888         dflt='Type carriage return to continue'
1889         . ./myread
1890         case "$firsttime" in
1891         true) echo $user >>../.config/instruct;;
1892         esac
1893 fi
1894
1895 : find out where common programs are
1896 echo " "
1897 echo "Locating common programs..." >&4
1898 cat <<EOSC >loc
1899 $startsh
1900 case \$# in
1901 0) exit 1;;
1902 esac
1903 thing=\$1
1904 shift
1905 dflt=\$1
1906 shift
1907 for dir in \$*; do
1908         case "\$thing" in
1909         .)
1910         if test -d \$dir/\$thing; then
1911                 echo \$dir
1912                 exit 0
1913         fi
1914         ;;
1915         *)
1916         for thisthing in \$dir/\$thing; do
1917                 : just loop through to pick last item
1918         done
1919         if test -f \$thisthing; then
1920                 echo \$thisthing
1921                 exit 0
1922         elif test -f \$dir/\$thing.exe; then
1923                 if test -n "$DJGPP"; then
1924                         echo \$dir/\$thing.exe
1925                 else
1926                         : on Eunice apparently
1927                         echo \$dir/\$thing
1928                 fi
1929                 exit 0
1930         fi
1931         ;;
1932         esac
1933 done
1934 echo \$dflt
1935 exit 1
1936 EOSC
1937 chmod +x loc
1938 $eunicefix loc
1939 loclist="
1940 awk
1941 cat
1942 comm
1943 cp
1944 echo
1945 expr
1946 grep
1947 ls
1948 make
1949 mkdir
1950 rm
1951 sed
1952 sort
1953 touch
1954 tr
1955 uniq
1956 "
1957 trylist="
1958 Mcc
1959 ar
1960 byacc
1961 cpp
1962 csh
1963 date
1964 egrep
1965 gzip
1966 less
1967 ln
1968 more
1969 nm
1970 nroff
1971 pg
1972 test
1973 uname
1974 zip
1975 "
1976 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1977 pth="$pth /lib /usr/lib"
1978 for file in $loclist; do
1979         eval xxx=\$$file
1980         case "$xxx" in
1981         /*|?:[\\/]*)
1982                 if test -f "$xxx"; then
1983                         : ok
1984                 else
1985                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
1986                         xxx=`./loc $file $file $pth`
1987                 fi
1988                 ;;
1989         '') xxx=`./loc $file $file $pth`;;
1990         *) xxx=`./loc $xxx $xxx $pth`;;
1991         esac
1992         eval $file=$xxx
1993         eval _$file=$xxx
1994         case "$xxx" in
1995         /*)
1996                 echo $file is in $xxx.
1997                 ;;
1998         ?:[\\/]*)
1999                 echo $file is in $xxx.
2000                 ;;
2001         *)
2002                 echo "I don't know where '$file' is, and my life depends on it." >&4
2003                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2004                 exit 1
2005                 ;;
2006         esac
2007 done
2008 echo " "
2009 echo "Don't worry if any of the following aren't found..."
2010 say=offhand
2011 for file in $trylist; do
2012         eval xxx=\$$file
2013         case "$xxx" in
2014         /*|?:[\\/]*)
2015                 if test -f "$xxx"; then
2016                         : ok
2017                 else
2018                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2019                         xxx=`./loc $file $file $pth`
2020                 fi
2021                 ;;
2022         '') xxx=`./loc $file $file $pth`;;
2023         *) xxx=`./loc $xxx $xxx $pth`;;
2024         esac
2025         eval $file=$xxx
2026         eval _$file=$xxx
2027         case "$xxx" in
2028         /*)
2029                 echo $file is in $xxx.
2030                 ;;
2031         ?:[\\/]*)
2032                 echo $file is in $xxx.
2033                 ;;
2034         *)
2035                 echo "I don't see $file out there, $say."
2036                 say=either
2037                 ;;
2038         esac
2039 done
2040 case "$egrep" in
2041 egrep)
2042         echo "Substituting grep for egrep."
2043         egrep=$grep
2044         ;;
2045 esac
2046 case "$ln" in
2047 ln)
2048         echo "Substituting cp for ln."
2049         ln=$cp
2050         ;;
2051 esac
2052 case "$test" in
2053 test)
2054         echo "Hopefully test is built into your sh."
2055         ;;
2056 *)
2057         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2058                 echo "Using the test built into your sh."
2059                 test=test
2060                 _test=test
2061         fi
2062         ;;
2063 esac
2064 case "$echo" in
2065 echo)
2066         echo "Hopefully echo is built into your sh."
2067         ;;
2068 '') ;;
2069 *)
2070         echo " "
2071 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2072         $echo $n "hi there$c" >foo1
2073         echo $n "hi there$c" >foo2
2074         if cmp foo1 foo2 >/dev/null 2>&1; then
2075                 echo "They are compatible.  In fact, they may be identical."
2076         else
2077                 case "$n" in
2078                 '-n') n='' c='\c';;
2079                 *) n='-n' c='';;
2080                 esac
2081                 cat <<FOO
2082 They are not compatible!  You are probably running ksh on a non-USG system.
2083 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2084 have echo built in and we may have to run some Bourne shell scripts.  That
2085 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2086
2087 FOO
2088                 $echo $n "The star should be here-->$c"
2089                 $echo "*"
2090         fi
2091         $rm -f foo1 foo2
2092         ;;
2093 esac
2094
2095 cat <<EOS >checkcc
2096 $startsh
2097 EOS
2098 cat <<'EOSC' >>checkcc
2099 case "$cc" in
2100 '') ;;
2101 *)  $rm -f try try.*
2102     $cat >try.c <<EOM
2103 int main(int argc, char *argv[]) {
2104   return 0;
2105 }
2106 EOM
2107     if $cc -o try $ccflags try.c; then
2108        :
2109     else
2110         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2111         despair=yes
2112         trygcc=yes
2113         case "$cc" in
2114         *gcc*) trygcc=no ;;
2115         esac
2116         case "`$cc -v -c try.c 2>&1`" in
2117         *gcc*) trygcc=no ;;
2118         esac
2119         if $test X"$trygcc" = Xyes; then
2120             if gcc -o try -c try.c; then
2121                 echo " "
2122                 echo "You seem to have a working gcc, though." >&4
2123                 rp="Would you like to use it?"
2124                 dflt=y
2125                 if $test -f myread; then
2126                     . ./myread
2127                 else
2128                     if $test -f UU/myread; then
2129                         . ./UU/myread
2130                     else
2131                         echo "Cannot find myread, sorry.  Aborting." >&2
2132                         exit 1
2133                     fi
2134                 fi  
2135                 case "$ans" in
2136                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no ;;
2137                 esac
2138             fi
2139         fi
2140         if $test X"$despair" = Xyes; then
2141             $cat >&4 <<EOM
2142 You need to find a working C compiler.
2143 Either (purchase and) install the C compiler supplied by your OS vendor,
2144 or for a free C compiler try http://gcc.gnu.org/
2145 I cannot continue any further, aborting.
2146 EOM
2147             exit 1
2148         fi
2149     fi
2150     $rm -f try try.*
2151     ;;
2152 esac
2153 EOSC
2154
2155 : determine whether symbolic links are supported
2156 echo " "
2157 $touch blurfl
2158 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2159         echo "Symbolic links are supported." >&4
2160         lns="$ln -s"
2161 else
2162         echo "Symbolic links are NOT supported." >&4
2163         lns="$ln"
2164 fi
2165 $rm -f blurfl sym
2166
2167 : see whether [:lower:] and [:upper:] are supported character classes
2168 echo " "
2169 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2170 ABYZ)
2171         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2172         up='[:upper:]'
2173         low='[:lower:]'
2174         ;;
2175 *)      # There is a discontinuity in EBCDIC between 'I' and 'J'
2176         # (0xc9 and 0xd1), therefore that is a nice testing point.
2177         if test "X$up" = X -o "X$low" = X; then
2178             case "`echo IJ | $tr '[I-J]' '[i-j]' 2>/dev/null`" in
2179             ij) up='[A-Z]'
2180                 low='[a-z]'
2181                 ;;
2182             esac
2183         fi
2184         if test "X$up" = X -o "X$low" = X; then
2185             case "`echo IJ | $tr I-J i-j 2>/dev/null`" in
2186             ij) up='A-Z'
2187                 low='a-z'
2188                 ;;
2189             esac
2190         fi
2191         if test "X$up" = X -o "X$low" = X; then
2192             case "`echo IJ | od -x 2>/dev/null`" in
2193             *C9D1*|*c9d1*)
2194                 echo "Hey, this might be EBCDIC." >&4
2195                 if test "X$up" = X -o "X$low" = X; then
2196                     case "`echo IJ | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
2197                     ij) up='[A-IJ-RS-Z]'
2198                         low='[a-ij-rs-z]'
2199                         ;;
2200                     esac
2201                 fi
2202                 if test "X$up" = X -o "X$low" = X; then
2203                     case "`echo IJ | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
2204                     ij) up='A-IJ-RS-Z'
2205                         low='a-ij-rs-z'
2206                         ;;
2207                     esac
2208                 fi
2209                 ;;
2210             esac
2211         fi
2212 esac
2213 case "`echo IJ | $tr \"$up\" \"$low\" 2>/dev/null`" in
2214 ij)
2215     echo "Using $up and $low to convert case." >&4
2216     ;;
2217 *)
2218     echo "I don't know how to translate letters from upper to lower case." >&4
2219     echo "Your tr is not acting any way I know of." >&4
2220     exit 1
2221     ;;
2222 esac
2223 : set up the translation script tr, must be called with ./tr of course
2224 cat >tr <<EOSC
2225 $startsh
2226 case "\$1\$2" in
2227 '[A-Z][a-z]') exec $tr '$up' '$low';;
2228 '[a-z][A-Z]') exec $tr '$low' '$up';;
2229 esac
2230 exec $tr "\$@"
2231 EOSC
2232 chmod +x tr
2233 $eunicefix tr
2234
2235 : Try to determine whether config.sh was made on this system
2236 case "$config_sh" in
2237 '')
2238 myuname=`$uname -a 2>/dev/null`
2239 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
2240 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
2241 # because the A-Z/a-z are not consecutive.
2242 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
2243         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
2244 newmyuname="$myuname"
2245 dflt=n
2246 case "$knowitall" in
2247 '')
2248         if test -f ../config.sh; then
2249                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
2250                         eval "`grep myuname= ../config.sh`"
2251                 fi
2252                 if test "X$myuname" = "X$newmyuname"; then
2253                         dflt=y
2254                 fi
2255         fi
2256         ;;
2257 *) dflt=y;;
2258 esac
2259
2260 : Get old answers from old config file if Configure was run on the
2261 : same system, otherwise use the hints.
2262 hint=default
2263 cd ..
2264 if test -f config.sh; then
2265         echo " "
2266         rp="I see a config.sh file.  Shall I use it to set the defaults?"
2267         . UU/myread
2268         case "$ans" in
2269         n*|N*) echo "OK, I'll ignore it."
2270                 mv config.sh config.sh.old
2271                 myuname="$newmyuname"
2272                 ;;
2273         *)  echo "Fetching default answers from your old config.sh file..." >&4
2274                 tmp_n="$n"
2275                 tmp_c="$c"
2276                 tmp_sh="$sh"
2277                 . ./config.sh
2278                 cp config.sh UU
2279                 n="$tmp_n"
2280                 c="$tmp_c"
2281                 : Older versions did not always set $sh.  Catch re-use of such
2282                 : an old config.sh.
2283                 case "$sh" in
2284                 '') sh="$tmp_sh" ;;
2285                 esac
2286                 hint=previous
2287                 ;;
2288         esac
2289 fi
2290 . ./UU/checkcc
2291 if test ! -f config.sh; then
2292         $cat <<EOM
2293
2294 First time through, eh?  I have some defaults handy for some systems
2295 that need some extra help getting the Configure answers right:
2296
2297 EOM
2298         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
2299         dflt=''
2300         : Half the following guesses are probably wrong... If you have better
2301         : tests or hints, please send them to perlbug@perl.org
2302         : The metaconfig authors would also appreciate a copy...
2303         $test -f /irix && osname=irix
2304         $test -f /xenix && osname=sco_xenix
2305         $test -f /dynix && osname=dynix
2306         $test -f /dnix && osname=dnix
2307         $test -f /lynx.os && osname=lynxos
2308         $test -f /unicos && osname=unicos && osvers=`$uname -r`
2309         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
2310         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
2311         $test -f /bin/mips && /bin/mips && osname=mips
2312         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
2313                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
2314         $test -d /usr/apollo/bin && osname=apollo
2315         $test -f /etc/saf/_sactab && osname=svr4
2316         $test -d /usr/include/minix && osname=minix
2317         if $test -d /MachTen -o -d /MachTen_Folder; then
2318                 osname=machten
2319                 if $test -x /sbin/version; then
2320                         osvers=`/sbin/version | $awk '{print $2}' |
2321                         $sed -e 's/[A-Za-z]$//'`
2322                 elif $test -x /usr/etc/version; then
2323                         osvers=`/usr/etc/version | $awk '{print $2}' |
2324                         $sed -e 's/[A-Za-z]$//'`
2325                 else
2326                         osvers="$2.$3"
2327                 fi
2328         fi
2329
2330         $test -f /sys/posix.dll &&
2331                 $test -f /usr/bin/what &&
2332                 set X `/usr/bin/what /sys/posix.dll` &&
2333                 $test "$3" = UWIN &&
2334                 osname=uwin &&
2335                 osvers="$5"
2336
2337         if $test -f $uname; then
2338                 set X $myuname
2339                 shift
2340
2341                 case "$5" in
2342                 fps*) osname=fps ;;
2343                 mips*)
2344                         case "$4" in
2345                         umips) osname=umips ;;
2346                         *) osname=mips ;;
2347                         esac;;
2348                 [23]100) osname=mips ;;
2349                 next*) osname=next ;;
2350                 i386*)
2351                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
2352                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
2353                                 osname='sco'
2354                                 osvers=$tmp
2355                         elif $test -f /etc/kconfig; then
2356                                 osname=isc
2357                                 if test "$lns" = "$ln -s"; then
2358                                         osvers=4
2359                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
2360                                         osvers=3
2361                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
2362                                         osvers=2
2363                                 fi
2364                         fi
2365                         tmp=''
2366                         ;;
2367                 pc*)
2368                         if test -n "$DJGPP"; then
2369                                 osname=dos
2370                                 osvers=djgpp
2371                         fi
2372                         ;;
2373                 esac
2374
2375                 case "$1" in
2376                 aix) osname=aix
2377                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
2378                         case "$tmp" in
2379                         'not found') osvers="$4"."$3" ;;
2380                         '<3240'|'<>3240') osvers=3.2.0 ;;
2381                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
2382                         '=3250'|'>3250') osvers=3.2.5 ;;
2383                         *) osvers=$tmp;;
2384                         esac
2385                         ;;
2386                 bsd386) osname=bsd386
2387                         osvers=`$uname -r`
2388                         ;;
2389                 cygwin*) osname=cygwin
2390                         osvers="$3"
2391                         ;;
2392                 *dc.osx) osname=dcosx
2393                         osvers="$3"
2394                         ;;
2395                 dnix) osname=dnix
2396                         osvers="$3"
2397                         ;;
2398                 domainos) osname=apollo
2399                         osvers="$3"
2400                         ;;
2401                 dgux) osname=dgux 
2402                         osvers="$3"
2403                         ;;
2404                 dynixptx*) osname=dynixptx
2405                         osvers=`echo "$4"|sed 's/^v//'`
2406                         ;;
2407                 freebsd) osname=freebsd 
2408                         osvers="$3" ;;
2409                 genix) osname=genix ;;
2410                 hp*) osname=hpux 
2411                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
2412                         ;;
2413                 irix*) osname=irix
2414                         case "$3" in
2415                         4*) osvers=4 ;;
2416                         5*) osvers=5 ;;
2417                         *)      osvers="$3" ;;
2418                         esac
2419                         ;;
2420                 linux) osname=linux
2421                         case "$3" in
2422                         *)      osvers="$3" ;;
2423                         esac
2424                         ;;
2425                 MiNT) osname=mint
2426                         ;;
2427                 netbsd*) osname=netbsd
2428                         osvers="$3"
2429                         ;;
2430                 news-os) osvers="$3"
2431                         case "$3" in
2432                         4*) osname=newsos4 ;;
2433                         *) osname=newsos ;;
2434                         esac
2435                         ;;
2436                 next*) osname=next ;;
2437                 nonstop-ux) osname=nonstopux ;;
2438                 POSIX-BC | posix-bc ) osname=posix-bc
2439                         osvers="$3"
2440                         ;;
2441                 powerux | power_ux | powermax_os | powermaxos | \
2442                 powerunix | power_unix) osname=powerux
2443                         osvers="$3"
2444                         ;;
2445                 qnx) osname=qnx
2446                         osvers="$4"
2447                         ;;
2448                 solaris) osname=solaris
2449                         case "$3" in
2450                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
2451                         *)      osvers="$3" ;;
2452                         esac
2453                         ;;
2454                 sunos) osname=sunos
2455                         case "$3" in
2456                         5*) osname=solaris
2457                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
2458                         *)      osvers="$3" ;;
2459                         esac
2460                         ;;
2461                 titanos) osname=titanos
2462                         case "$3" in
2463                         1*) osvers=1 ;;
2464                         2*) osvers=2 ;;
2465                         3*) osvers=3 ;;
2466                         4*) osvers=4 ;;
2467                         *)      osvers="$3" ;;
2468                         esac
2469                         ;;
2470                 ultrix) osname=ultrix
2471                         osvers="$3"
2472                         ;;
2473                 osf1|mls+)      case "$5" in
2474                                 alpha)
2475                                         osname=dec_osf
2476                                         osvers=`sizer -v | awk '{print $3}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
2477                                         case "$osvers" in
2478                                         [1-9].[0-9]*) ;;
2479                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
2480                                         esac
2481                                         ;;
2482                         hp*)    osname=hp_osf1  ;;
2483                         mips)   osname=mips_osf1 ;;
2484                         esac
2485                         ;;
2486                 unixware) osname=svr5
2487                         osvers="$4"
2488                         ;;
2489                 uts) osname=uts
2490                         osvers="$3"
2491                         ;;
2492                 $2) case "$osname" in
2493                         *isc*) ;;
2494                         *freebsd*) ;;
2495                         svr*)
2496                                 : svr4.x or possibly later
2497                                 case "svr$3" in 
2498                                 ${osname}*)
2499                                         osname=svr$3
2500                                         osvers=$4
2501                                         ;;
2502                                 esac
2503                                 case "$osname" in
2504                                 svr4.0)
2505                                         : Check for ESIX
2506                                         if test -f /stand/boot ; then
2507                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
2508                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
2509                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
2510                                                         if test -n "$isesix"; then
2511                                                                 osname=esix4
2512                                                         fi
2513                                                 fi
2514                                         fi
2515                                         ;;
2516                                 esac
2517                                 ;;
2518                         *)      if test -f /etc/systemid; then
2519                                         osname=sco
2520                                         set `echo $3 | $sed 's/\./ /g'` $4
2521                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
2522                                                 osvers=$1.$2.$3
2523                                         elif $test -f $src/hints/sco_$1_$2.sh; then
2524                                                 osvers=$1.$2
2525                                         elif $test -f $src/hints/sco_$1.sh; then
2526                                                 osvers=$1
2527                                         fi
2528                                 else
2529                                         case "$osname" in
2530                                         '') : Still unknown.  Probably a generic Sys V.
2531                                                 osname="sysv"
2532                                                 osvers="$3"
2533                                                 ;;
2534                                         esac
2535                                 fi
2536                                 ;;
2537                         esac
2538                         ;;
2539                 *)      case "$osname" in
2540                         '') : Still unknown.  Probably a generic BSD.
2541                                 osname="$1"
2542                                 osvers="$3"
2543                                 ;;
2544                         esac
2545                         ;;
2546                 esac
2547         else
2548                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
2549                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
2550                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
2551                                 osname=news_os
2552                         fi
2553                         $rm -f UU/kernel.what
2554                 elif test -d c:/.; then
2555                         set X $myuname
2556                         osname=os2
2557                         osvers="$5"
2558                 fi
2559         fi
2560         
2561         : Now look for a hint file osname_osvers, unless one has been
2562         : specified already.
2563         case "$hintfile" in
2564         ''|' ')
2565                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
2566                 : Also try without trailing minor version numbers.
2567                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
2568                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
2569                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
2570                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
2571                 case "$file" in
2572                 '') dflt=none ;;
2573                 *)  case "$osvers" in
2574                         '') dflt=$file
2575                                 ;;
2576                         *)  if $test -f $src/hints/$file.sh ; then
2577                                         dflt=$file
2578                                 elif $test -f $src/hints/$xfile.sh ; then
2579                                         dflt=$xfile
2580                                 elif $test -f $src/hints/$xxfile.sh ; then
2581                                         dflt=$xxfile
2582                                 elif $test -f $src/hints/$xxxfile.sh ; then
2583                                         dflt=$xxxfile
2584                                 elif $test -f $src/hints/$xxxxfile.sh ; then
2585                                         dflt=$xxxxfile
2586                                 elif $test -f "$src/hints/${osname}.sh" ; then
2587                                         dflt="${osname}"
2588                                 else
2589                                         dflt=none
2590                                 fi
2591                                 ;;
2592                         esac
2593                         ;;
2594                 esac
2595                 if $test -f Policy.sh ; then
2596                         case "$dflt" in
2597                         *Policy*) ;;
2598                         none) dflt="Policy" ;;
2599                         *) dflt="Policy $dflt" ;;
2600                         esac
2601                 fi
2602                 ;;
2603         *)
2604                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
2605                 ;;
2606         esac
2607
2608         if $test -f Policy.sh ; then
2609                 $cat <<EOM
2610
2611 There's also a Policy hint file available, which should make the
2612 site-specific (policy) questions easier to answer.
2613 EOM
2614
2615         fi
2616
2617         $cat <<EOM
2618
2619 You may give one or more space-separated answers, or "none" if appropriate.
2620 A well-behaved OS will have no hints, so answering "none" or just "Policy"
2621 is a good thing.  DO NOT give a wrong version or a wrong OS.
2622
2623 EOM
2624
2625         rp="Which of these apply, if any?"
2626         . UU/myread
2627         tans=$ans
2628         for file in $tans; do
2629                 if $test X$file = XPolicy -a -f Policy.sh; then
2630                         . Policy.sh
2631                         $cat Policy.sh >> UU/config.sh
2632                 elif $test -f $src/hints/$file.sh; then
2633                         . $src/hints/$file.sh
2634                         $cat $src/hints/$file.sh >> UU/config.sh
2635                 elif $test X$tans = X -o X$tans = Xnone ; then
2636                         : nothing
2637                 else
2638                         : Give one chance to correct a possible typo.
2639                         echo "$file.sh does not exist"
2640                         dflt=$file
2641                         rp="hint to use instead?"
2642                         . UU/myread
2643                         for file in $ans; do
2644                                 if $test -f "$src/hints/$file.sh"; then
2645                                         . $src/hints/$file.sh
2646                                         $cat $src/hints/$file.sh >> UU/config.sh
2647                                 elif $test X$ans = X -o X$ans = Xnone ; then
2648                                         : nothing
2649                                 else
2650                                         echo "$file.sh does not exist -- ignored."
2651                                 fi
2652                         done
2653                 fi
2654         done
2655
2656         hint=recommended
2657         : Remember our hint file for later.
2658         if $test -f "$src/hints/$file.sh" ; then
2659                 hintfile="$file"
2660         else
2661                 hintfile=''
2662         fi
2663 fi
2664 cd UU
2665 ;;
2666 *)
2667         echo " "
2668         echo "Fetching default answers from $config_sh..." >&4
2669         tmp_n="$n"
2670         tmp_c="$c"
2671         cd ..
2672         cp $config_sh config.sh 2>/dev/null
2673         chmod +w config.sh
2674         . ./config.sh
2675         cd UU
2676         cp ../config.sh .
2677         n="$tmp_n"
2678         c="$tmp_c"
2679         hint=previous
2680         ;;
2681 esac
2682 test "$override" && . ./optdef.sh
2683
2684 : Restore computed paths
2685 for file in $loclist $trylist; do
2686         eval $file="\$_$file"
2687 done
2688
2689 cat << EOM
2690
2691 Configure uses the operating system name and version to set some defaults.
2692 The default value is probably right if the name rings a bell. Otherwise,
2693 since spelling matters for me, either accept the default or answer "none"
2694 to leave it blank.
2695
2696 EOM
2697 case "$osname" in
2698         ''|' ')
2699                 case "$hintfile" in
2700                 ''|' '|none) dflt=none ;;
2701                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
2702                 esac
2703                 ;;
2704         *) dflt="$osname" ;;
2705 esac
2706 rp="Operating system name?"
2707 . ./myread
2708 case "$ans" in
2709 none)  osname='' ;;
2710 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
2711 esac
2712 echo " "
2713 case "$osvers" in
2714         ''|' ')
2715                 case "$hintfile" in
2716                 ''|' '|none) dflt=none ;;
2717                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
2718                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
2719                         case "$dflt" in
2720                         ''|' ') dflt=none ;;
2721                         esac
2722                         ;;
2723                 esac
2724                 ;;
2725         *) dflt="$osvers" ;;
2726 esac
2727 rp="Operating system version?"
2728 . ./myread
2729 case "$ans" in
2730 none)  osvers='' ;;
2731 *) osvers="$ans" ;;
2732 esac
2733
2734
2735 . ./posthint.sh
2736
2737 : who configured the system
2738 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
2739 cf_by=`(logname) 2>/dev/null`
2740 case "$cf_by" in
2741 "")
2742         cf_by=`(whoami) 2>/dev/null`
2743         case "$cf_by" in
2744         "") cf_by=unknown ;;
2745         esac ;;
2746 esac
2747
2748 : set up the script used to warn in case of inconsistency
2749 cat <<EOS >whoa
2750 $startsh
2751 EOS
2752 cat <<'EOSC' >>whoa
2753 dflt=y
2754 echo " "
2755 echo "*** WHOA THERE!!! ***" >&4
2756 echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
2757 rp="    Keep the $hint value?"
2758 . ./myread
2759 case "$ans" in
2760 y) td=$was; tu=$was;;
2761 esac
2762 EOSC
2763
2764 : function used to set $1 to $val
2765 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
2766 case "$val$was" in
2767 $define$undef) . ./whoa; eval "$var=\$td";;
2768 $undef$define) . ./whoa; eval "$var=\$tu";;
2769 *) eval "$var=$val";;
2770 esac'
2771
2772 case "$usethreads" in
2773 $define|true|[yY]*)     dflt='y';;
2774 *) dflt='n';;
2775 esac
2776 cat <<EOM
2777
2778 Perl can be built to take advantage of threads on some systems.
2779 To do so, Configure can be run with -Dusethreads.
2780
2781 Note that threading is a highly experimental feature, and
2782 some known race conditions still remain.  If you choose to try
2783 it, be very sure to not actually deploy it for production
2784 purposes.  README.threads has more details, and is required
2785 reading if you enable threads.
2786
2787 If this doesn't make any sense to you, just accept the default '$dflt'.
2788 EOM
2789 rp='Build a threading Perl?'
2790 . ./myread
2791 case "$ans" in
2792 y|Y)    val="$define" ;;
2793 *)      val="$undef" ;;
2794 esac
2795 set usethreads
2796 eval $setvar
2797
2798 case "$usethreads" in
2799 $define)
2800         $cat <<EOM
2801
2802 As of 5.5.640, Perl has two different internal threading implementations,
2803 the 5.005 version (5005threads) and an interpreter-based version
2804 (ithreads) that has one interpreter per thread.  Both are very 
2805 experimental.  This arrangement exists to help developers work out
2806 which one is better.
2807
2808 If you're a casual user, you probably don't want interpreter-threads
2809 at this time.  There doesn't yet exist a way to create threads from
2810 within Perl in this model, i.e., "use Thread;" will NOT work.
2811 EOM
2812         : Default to ithreads unless overridden on command line or with
2813         : old config.sh
2814         dflt='y'
2815         case "$use5005threads" in
2816                 $define|true|[yY]*) dflt='n';;
2817         esac
2818         case "$useithreads" in
2819                 $undef|false|[nN]*) dflt='n';;
2820         esac
2821         rp='Use interpreter-based ithreads?'
2822         . ./myread
2823         case "$ans" in
2824         y|Y)    val="$define" ;;
2825         *)      val="$undef" ;;
2826         esac
2827         set useithreads
2828         eval $setvar
2829         : Now set use5005threads to the opposite value.
2830         case "$useithreads" in
2831         $define) val="$undef" ;;
2832         *) val="$define" ;;
2833         esac
2834         set use5005threads
2835         eval $setvar
2836         ;;
2837 *)
2838         useithreads="$undef"
2839         use5005threads="$undef"
2840         ;;
2841 esac
2842
2843 case "$d_oldpthreads" in
2844 '')     : Configure tests would be welcome here.  For now, assume undef.
2845         val="$undef" ;;
2846 *)      val="$d_oldpthreads" ;;
2847 esac
2848 set d_oldpthreads
2849 eval $setvar
2850
2851
2852 case "$usethreads" in
2853 "$define"|true|[yY]*)
2854 : Look for a hint-file generated 'call-back-unit'.  If the
2855 : user has specified that a threading perl is to be built,
2856 : we may need to set or change some other defaults.
2857         if $test -f usethreads.cbu; then
2858                 echo "Your platform has some specific hints for threaded builds, using them..."
2859                 . ./usethreads.cbu
2860         else
2861                 $cat <<EOM
2862 (Your platform doesn't have any specific hints for threaded builds.
2863  Assuming POSIX threads, then.)
2864 EOM
2865         fi
2866         ;;
2867 esac
2868
2869 cat <<EOM
2870
2871 Perl can be built so that multiple Perl interpreters can coexist
2872 within the same Perl executable.
2873 EOM
2874
2875 case "$useithreads" in
2876 $define)
2877         cat <<EOM
2878 This multiple interpreter support is required for interpreter-based threads.
2879 EOM
2880         val="$define"
2881         ;;
2882 *)      case "$usemultiplicity" in
2883         $define|true|[yY]*)     dflt='y';;
2884         *) dflt='n';;
2885         esac
2886         echo " "
2887         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
2888         rp='Build Perl for multiplicity?'
2889         . ./myread
2890         case "$ans" in
2891         y|Y)    val="$define" ;;
2892         *)      val="$undef" ;;
2893         esac
2894         ;;
2895 esac
2896 set usemultiplicity
2897 eval $setvar
2898
2899 : make some quick guesses about what we are up against
2900 echo " "
2901 $echo $n "Hmm...  $c"
2902 echo exit 1 >bsd
2903 echo exit 1 >usg
2904 echo exit 1 >v7
2905 echo exit 1 >osf1
2906 echo exit 1 >eunice
2907 echo exit 1 >xenix
2908 echo exit 1 >venix
2909 echo exit 1 >os2
2910 d_bsd="$undef"
2911 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
2912 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
2913 then
2914         echo "Looks kind of like an OSF/1 system, but we'll see..."
2915         echo exit 0 >osf1
2916 elif test `echo abc | $tr a-z A-Z` = Abc ; then
2917         xxx=`./loc addbib blurfl $pth`
2918         if $test -f $xxx; then
2919         echo "Looks kind of like a USG system with BSD features, but we'll see..."
2920                 echo exit 0 >bsd
2921                 echo exit 0 >usg
2922         else
2923                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
2924                         echo "Looks kind of like an extended USG system, but we'll see..."
2925                 else
2926                         echo "Looks kind of like a USG system, but we'll see..."
2927                 fi
2928                 echo exit 0 >usg
2929         fi
2930 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
2931         echo "Looks kind of like a BSD system, but we'll see..."
2932         d_bsd="$define"
2933         echo exit 0 >bsd
2934 else
2935         echo "Looks kind of like a Version 7 system, but we'll see..."
2936         echo exit 0 >v7
2937 fi
2938 case "$eunicefix" in
2939 *unixtovms*)
2940         $cat <<'EOI'
2941 There is, however, a strange, musty smell in the air that reminds me of
2942 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
2943 EOI
2944         echo exit 0 >eunice
2945         d_eunice="$define"
2946 : it so happens the Eunice I know will not run shell scripts in Unix format
2947         ;;
2948 *)
2949         echo " "
2950         echo "Congratulations.  You aren't running Eunice."
2951         d_eunice="$undef"
2952         ;;
2953 esac
2954 : Detect OS2.  The p_ variable is set above in the Head.U unit.
2955 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
2956 : semicolon as a patch separator
2957 case "$p_" in
2958 :) ;;
2959 *)
2960         $cat <<'EOI'
2961 I have the feeling something is not exactly right, however...don't tell me...
2962 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
2963 (Or you may be running DOS with DJGPP.)
2964 EOI
2965         echo exit 0 >os2
2966         ;;
2967 esac
2968 if test -f /xenix; then
2969         echo "Actually, this looks more like a XENIX system..."
2970         echo exit 0 >xenix
2971         d_xenix="$define"
2972 else
2973         echo " "
2974         echo "It's not Xenix..."
2975         d_xenix="$undef"
2976 fi
2977 chmod +x xenix
2978 $eunicefix xenix
2979 if test -f /venix; then
2980         echo "Actually, this looks more like a VENIX system..."
2981         echo exit 0 >venix
2982 else
2983         echo " "
2984         if ./xenix; then
2985                 : null
2986         else
2987                 echo "Nor is it Venix..."
2988         fi
2989 fi
2990 chmod +x bsd usg v7 osf1 eunice xenix venix os2
2991 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
2992 $rm -f foo
2993
2994 case "$cc" in
2995 '') dflt=cc;;
2996 *) dflt="$cc";;
2997 esac
2998 rp="Use which C compiler?"
2999 . ./myread
3000 cc="$ans"
3001 : Look for a hint-file generated 'call-back-unit'.  Now that the
3002 : user has specified the compiler, we may need to set or change some
3003 : other defaults.
3004 if $test -f cc.cbu; then
3005     . ./cc.cbu
3006 fi
3007 . ./checkcc
3008
3009 echo " "
3010 echo "Checking for GNU cc in disguise and/or its version number..." >&4
3011 $cat >gccvers.c <<EOM
3012 #include <stdio.h>
3013 int main() {
3014 #ifdef __GNUC__
3015 #ifdef __VERSION__
3016         printf("%s\n", __VERSION__);
3017 #else
3018         printf("%s\n", "1");
3019 #endif
3020 #endif
3021         exit(0);
3022 }
3023 EOM
3024 if $cc -o gccvers $ldflags gccvers.c; then
3025         gccversion=`./gccvers`
3026         case "$gccversion" in
3027         '') echo "You are not using GNU cc." ;;
3028         *)  echo "You are using GNU cc $gccversion."
3029             ccname=gcc  
3030             ;;
3031         esac
3032 else
3033         echo " "
3034         echo "*** WHOA THERE!!! ***" >&4
3035         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
3036         case "$knowitall" in
3037         '')
3038         echo "    You'd better start hunting for one and let me know about it." >&4
3039                 exit 1
3040                 ;;
3041         esac
3042 fi
3043 $rm -f gccvers*
3044 case "$gccversion" in
3045 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
3046 esac
3047 case "$gccversion" in
3048 '') gccosandvers='' ;;
3049 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
3050    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
3051    gccshortvers=''
3052    case "$gccosandvers" in
3053    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
3054    $osname$osvers) ;; # looking good
3055    $osname*) cat <<EOM >&4
3056
3057 *** WHOA THERE!!! ***
3058
3059     Your gcc has not been compiled for the exact release of
3060     your operating system ($gccosandvers versus $osname$osvers).
3061
3062     In general it is a good idea to keep gcc synchronized with
3063     the operating system because otherwise serious problems
3064     may ensue when trying to compile software, like Perl.
3065
3066     I'm trying to be optimistic here, though, and will continue.
3067     If later during the configuration and build icky compilation
3068     problems appear (headerfile conflicts being the most common
3069     manifestation), I suggest reinstalling the gcc to match
3070     your operating system release.
3071
3072 EOM
3073       ;;
3074    *) gccosandvers='' ;; # failed to parse, better be silent
3075    esac
3076    ;;
3077 esac
3078 case "$ccname" in
3079 '') ccname="$cc" ;;
3080 esac
3081
3082 : see how we invoke the C preprocessor
3083 echo " "
3084 echo "Now, how can we feed standard input to your C preprocessor..." >&4
3085 cat <<'EOT' >testcpp.c
3086 #define ABC abc
3087 #define XYZ xyz
3088 ABC.XYZ
3089 EOT
3090 cd ..
3091 if test ! -f cppstdin; then
3092         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
3093                 # AIX cc -E doesn't show the absolute headerfile
3094                 # locations but we'll cheat by using the -M flag.
3095                 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
3096         else
3097                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
3098         fi
3099 else
3100         echo "Keeping your $hint cppstdin wrapper."
3101 fi
3102 chmod 755 cppstdin
3103 wrapper=`pwd`/cppstdin
3104 ok='false'
3105 cd UU
3106
3107 if $test "X$cppstdin" != "X" && \
3108         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
3109         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3110 then
3111         echo "You used to use $cppstdin $cppminus so we'll use that again."
3112         case "$cpprun" in
3113         '') echo "But let's see if we can live without a wrapper..." ;;
3114         *)
3115                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
3116                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3117                 then
3118                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
3119                         ok='true'
3120                 else
3121                         echo "(However, $cpprun $cpplast does not work, let's see...)"
3122                 fi
3123                 ;;
3124         esac
3125 else
3126         case "$cppstdin" in
3127         '') ;;
3128         *)
3129                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
3130                 ;;
3131         esac
3132 fi
3133
3134 if $ok; then
3135         : nothing
3136 elif echo 'Maybe "'"$cc"' -E" will work...'; \
3137         $cc -E <testcpp.c >testcpp.out 2>&1; \
3138         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3139         echo "Yup, it does."
3140         x_cpp="$cc -E"
3141         x_minus='';
3142 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
3143         $cc -E - <testcpp.c >testcpp.out 2>&1; \
3144         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3145         echo "Yup, it does."
3146         x_cpp="$cc -E"
3147         x_minus='-';
3148 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
3149         $cc -P <testcpp.c >testcpp.out 2>&1; \
3150         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3151         echo "Yipee, that works!"
3152         x_cpp="$cc -P"
3153         x_minus='';
3154 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
3155         $cc -P - <testcpp.c >testcpp.out 2>&1; \
3156         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3157         echo "At long last!"
3158         x_cpp="$cc -P"
3159         x_minus='-';
3160 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
3161         $cpp <testcpp.c >testcpp.out 2>&1; \
3162         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3163         echo "It works!"
3164         x_cpp="$cpp"
3165         x_minus='';
3166 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
3167         $cpp - <testcpp.c >testcpp.out 2>&1; \
3168         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3169         echo "Hooray, it works!  I was beginning to wonder."
3170         x_cpp="$cpp"
3171         x_minus='-';
3172 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
3173         $wrapper <testcpp.c >testcpp.out 2>&1; \
3174         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3175         x_cpp="$wrapper"
3176         x_minus=''
3177         echo "Eureka!"
3178 else
3179         dflt=''
3180         rp="No dice.  I can't find a C preprocessor.  Name one:"
3181         . ./myread
3182         x_cpp="$ans"
3183         x_minus=''
3184         $x_cpp <testcpp.c >testcpp.out 2>&1
3185         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3186                 echo "OK, that will do." >&4
3187         else
3188 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
3189                 exit 1
3190         fi
3191 fi
3192
3193 case "$ok" in
3194 false)
3195         cppstdin="$x_cpp"
3196         cppminus="$x_minus"
3197         cpprun="$x_cpp"
3198         cpplast="$x_minus"
3199         set X $x_cpp
3200         shift
3201         case "$1" in
3202         "$cpp")
3203                 echo "Perhaps can we force $cc -E using a wrapper..."
3204                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
3205                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3206                 then
3207                         echo "Yup, we can."
3208                         cppstdin="$wrapper"
3209                         cppminus='';
3210                 else
3211                         echo "Nope, we'll have to live without it..."
3212                 fi
3213                 ;;
3214         esac
3215         case "$cpprun" in
3216         "$wrapper")
3217                 cpprun=''
3218                 cpplast=''
3219                 ;;
3220         esac
3221         ;;
3222 esac
3223
3224 case "$cppstdin" in
3225 "$wrapper"|'cppstdin') ;;
3226 *) $rm -f $wrapper;;
3227 esac
3228 $rm -f testcpp.c testcpp.out
3229
3230 : decide how portable to be.  Allow command line overrides.
3231 case "$d_portable" in
3232 "$undef") ;;
3233 *)      d_portable="$define" ;;
3234 esac
3235
3236 : set up shell script to do ~ expansion
3237 cat >filexp <<EOSS
3238 $startsh
3239 : expand filename
3240 case "\$1" in
3241  ~/*|~)
3242         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3243         ;;
3244  ~*)
3245         if $test -f /bin/csh; then
3246                 /bin/csh -f -c "glob \$1"
3247                 failed=\$?
3248                 echo ""
3249                 exit \$failed
3250         else
3251                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3252                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3253                 if $test ! -d "\$dir"; then
3254                         me=\`basename \$0\`
3255                         echo "\$me: can't locate home directory for: \$name" >&2
3256                         exit 1
3257                 fi
3258                 case "\$1" in
3259                 */*)
3260                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3261                         ;;
3262                 *)
3263                         echo \$dir
3264                         ;;
3265                 esac
3266         fi
3267         ;;
3268 *)
3269         echo \$1
3270         ;;
3271 esac
3272 EOSS
3273 chmod +x filexp
3274 $eunicefix filexp
3275
3276 : now set up to get a file name
3277 cat <<EOS >getfile
3278 $startsh
3279 EOS
3280 cat <<'EOSC' >>getfile
3281 tilde=''
3282 fullpath=''
3283 already=''
3284 skip=''
3285 none_ok=''
3286 exp_file=''
3287 nopath_ok=''
3288 orig_rp="$rp"
3289 orig_dflt="$dflt"
3290 case "$gfpth" in
3291 '') gfpth='.' ;;
3292 esac
3293
3294 case "$fn" in
3295 *\(*)
3296         expr $fn : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3297         fn=`echo $fn | sed 's/(.*)//'`
3298         ;;
3299 esac
3300
3301 case "$fn" in
3302 *:*)
3303         loc_file=`expr $fn : '.*:\(.*\)'`
3304         fn=`expr $fn : '\(.*\):.*'`
3305         ;;
3306 esac
3307
3308 case "$fn" in
3309 *~*) tilde=true;;
3310 esac
3311 case "$fn" in
3312 */*) fullpath=true;;
3313 esac
3314 case "$fn" in
3315 *+*) skip=true;;
3316 esac
3317 case "$fn" in
3318 *n*) none_ok=true;;
3319 esac
3320 case "$fn" in
3321 *e*) exp_file=true;;
3322 esac
3323 case "$fn" in
3324 *p*) nopath_ok=true;;
3325 esac
3326
3327 case "$fn" in
3328 *f*) type='File';;
3329 *d*) type='Directory';;
3330 *l*) type='Locate';;
3331 esac
3332
3333 what="$type"
3334 case "$what" in
3335 Locate) what='File';;
3336 esac
3337
3338 case "$exp_file" in
3339 '')
3340         case "$d_portable" in
3341         "$define") ;;
3342         *) exp_file=true;;
3343         esac
3344         ;;
3345 esac
3346
3347 cd ..
3348 while test "$type"; do
3349         redo=''
3350         rp="$orig_rp"
3351         dflt="$orig_dflt"
3352         case "$tilde" in
3353         true) rp="$rp (~name ok)";;
3354         esac
3355         . UU/myread
3356         if test -f UU/getfile.ok && \
3357                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3358         then
3359                 value="$ans"
3360                 ansexp="$ans"
3361                 break
3362         fi
3363         case "$ans" in
3364         none)
3365                 value=''
3366                 ansexp=''
3367                 case "$none_ok" in
3368                 true) type='';;
3369                 esac
3370                 ;;
3371         *)
3372                 case "$tilde" in
3373                 '') value="$ans"
3374                         ansexp="$ans";;
3375                 *)
3376                         value=`UU/filexp $ans`
3377                         case $? in
3378                         0)
3379                                 if test "$ans" != "$value"; then
3380                                         echo "(That expands to $value on this system.)"
3381                                 fi
3382                                 ;;
3383                         *) value="$ans";;
3384                         esac
3385                         ansexp="$value"
3386                         case "$exp_file" in
3387                         '') value="$ans";;
3388                         esac
3389                         ;;
3390                 esac
3391                 case "$fullpath" in
3392                 true)
3393                         case "$ansexp" in
3394                         /*) value="$ansexp" ;;
3395                         [a-zA-Z]:/*) value="$ansexp" ;;
3396                         *)
3397                                 redo=true
3398                                 case "$already" in
3399                                 true)
3400                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
3401                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
3402                                         ;;
3403                                 *)
3404                                 echo "Please give a full path name, starting with slash." >&4
3405                                         case "$tilde" in
3406                                         true)
3407                                 echo "Note that using ~name is ok provided it expands well." >&4
3408                                                 already=true
3409                                                 ;;
3410                                         esac
3411                                 esac
3412                                 ;;
3413                         esac
3414                         ;;
3415                 esac
3416                 case "$redo" in
3417                 '')
3418                         case "$type" in
3419                         File)
3420                                 for fp in $gfpth; do
3421                                         if test "X$fp" = X.; then
3422                                             pf="$ansexp"
3423                                         else    
3424                                             pf="$fp/$ansexp"
3425                                         fi
3426                                         if test -f "$pf"; then
3427                                                 type=''
3428                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3429                                         then
3430                                                 echo "($value is not a plain file, but that's ok.)"
3431                                                 type=''
3432                                         fi
3433                                         if test X"$type" = X; then
3434                                             value="$pf"
3435                                             break
3436                                         fi
3437                                 done
3438                                 ;;
3439                         Directory)
3440                                 for fp in $gfpth; do
3441                                         if test "X$fp" = X.; then
3442                                             dir="$ans"
3443                                             direxp="$ansexp"
3444                                         else    
3445                                             dir="$fp/$ansexp"
3446                                             direxp="$fp/$ansexp"
3447                                         fi
3448                                         if test -d "$direxp"; then
3449                                                 type=''
3450                                                 value="$dir"
3451                                                 break
3452                                         fi
3453                                 done
3454                                 ;;
3455                         Locate)
3456                                 if test -d "$ansexp"; then
3457                                         echo "(Looking for $loc_file in directory $value.)"
3458                                         value="$value/$loc_file"
3459                                         ansexp="$ansexp/$loc_file"
3460                                 fi
3461                                 if test -f "$ansexp"; then
3462                                         type=''
3463                                 fi
3464                                 case "$nopath_ok" in
3465                                 true)   case "$value" in
3466                                         */*) ;;
3467                                         *)      echo "Assuming $value will be in people's path."
3468                                                 type=''
3469                                                 ;;
3470                                         esac
3471                                         ;;
3472                                 esac
3473                                 ;;
3474                         esac
3475
3476                         case "$skip" in
3477                         true) type='';
3478                         esac
3479
3480                         case "$type" in
3481                         '') ;;
3482                         *)
3483                                 if test "$fastread" = yes; then
3484                                         dflt=y
3485                                 else
3486                                         dflt=n
3487                                 fi
3488                                 rp="$what $value doesn't exist.  Use that name anyway?"
3489                                 . UU/myread
3490                                 dflt=''
3491                                 case "$ans" in
3492                                 y*) type='';;
3493                                 *) echo " ";;
3494                                 esac
3495                                 ;;
3496                         esac
3497                         ;;
3498                 esac
3499                 ;;
3500         esac
3501 done
3502 cd UU
3503 ans="$value"
3504 rp="$orig_rp"
3505 dflt="$orig_dflt"
3506 rm -f getfile.ok
3507 test "X$gfpthkeep" != Xy && gfpth=""
3508 EOSC
3509
3510 : What should the include directory be ?
3511 echo " "
3512 $echo $n "Hmm...  $c"
3513 dflt='/usr/include'
3514 incpath=''
3515 mips_type=''
3516 if $test -f /bin/mips && /bin/mips; then
3517         echo "Looks like a MIPS system..."
3518         $cat >usr.c <<'EOCP'
3519 #ifdef SYSTYPE_BSD43
3520 /bsd43
3521 #endif
3522 EOCP
3523         if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
3524                 dflt='/bsd43/usr/include'
3525                 incpath='/bsd43'
3526                 mips_type='BSD 4.3'
3527         else
3528                 mips_type='System V'
3529         fi
3530         $rm -f usr.c usr.out
3531         echo "and you're compiling with the $mips_type compiler and libraries."
3532         xxx_prompt=y
3533         echo "exit 0" >mips
3534 else
3535         echo "Doesn't look like a MIPS system."
3536         xxx_prompt=n
3537         echo "exit 1" >mips
3538 fi
3539 chmod +x mips
3540 $eunicefix mips
3541 case "$usrinc" in
3542 '') ;;
3543 *) dflt="$usrinc";;
3544 esac
3545 case "$xxx_prompt" in
3546 y)      fn=d/
3547         echo " "
3548         rp='Where are the include files you want to use?'
3549         . ./getfile
3550         usrinc="$ans"
3551         ;;
3552 *)      usrinc="$dflt"
3553         ;;
3554 esac
3555
3556 : Set private lib path
3557 case "$plibpth" in
3558 '') if ./mips; then
3559                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
3560         fi;;
3561 esac
3562 case "$libpth" in
3563 ' ') dlist='';;
3564 '') dlist="$loclibpth $plibpth $glibpth";;
3565 *) dlist="$libpth";;
3566 esac
3567
3568 : Now check and see which directories actually exist, avoiding duplicates
3569 libpth=''
3570 for xxx in $dlist
3571 do
3572     if $test -d $xxx; then
3573                 case " $libpth " in
3574                 *" $xxx "*) ;;
3575                 *) libpth="$libpth $xxx";;
3576                 esac
3577     fi
3578 done
3579 $cat <<'EOM'
3580
3581 Some systems have incompatible or broken versions of libraries.  Among
3582 the directories listed in the question below, please remove any you
3583 know not to be holding relevant libraries, and add any that are needed.
3584 Say "none" for none.
3585
3586 EOM
3587 case "$libpth" in
3588 '') dflt='none';;
3589 *)
3590         set X $libpth
3591         shift
3592         dflt=${1+"$@"}
3593         ;;
3594 esac
3595 rp="Directories to use for library searches?"
3596 . ./myread
3597 case "$ans" in
3598 none) libpth=' ';;
3599 *) libpth="$ans";;
3600 esac
3601
3602 : compute shared library extension
3603 case "$so" in
3604 '')
3605         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
3606                 dflt='sl'
3607         else
3608                 dflt='so'
3609         fi
3610         ;;
3611 *) dflt="$so";;
3612 esac
3613 $cat <<EOM
3614
3615 On some systems, shared libraries may be available.  Answer 'none' if
3616 you want to suppress searching of shared libraries for the remainder
3617 of this configuration.
3618
3619 EOM
3620 rp='What is the file extension used for shared libraries?'
3621 . ./myread
3622 so="$ans"
3623
3624 : Define several unixisms.
3625 : Hints files or command line option can be used to override them.
3626 : The convoluted testing is in case hints files set either the old
3627 : or the new name.
3628 case "$_exe" in
3629 '')     case "$exe_ext" in
3630     '') ;;
3631         *)      _exe="$exe_ext" ;;
3632         esac
3633         ;;
3634 esac
3635 case "$_a" in
3636 '')     case "$lib_ext" in
3637     '') _a='.a';;
3638         *)      _a="$lib_ext" ;;
3639         esac
3640         ;;
3641 esac
3642 case "$_o" in
3643 '') case "$obj_ext" in
3644         '')     _o='.o';;
3645         *)      _o="$obj_ext";;
3646         esac
3647         ;;
3648 esac
3649 case "$p_" in
3650 '') case "$path_sep" in
3651         '')     p_=':';;
3652         *)      p_="$path_sep";;
3653         esac
3654         ;;
3655 esac
3656 exe_ext=$_exe
3657 lib_ext=$_a
3658 obj_ext=$_o
3659 path_sep=$p_
3660
3661 : Which makefile gets called first.  This is used by make depend.
3662 case "$firstmakefile" in
3663 '') firstmakefile='makefile';;
3664 esac
3665
3666 case "$usesocks" in
3667 $define|true|[yY]*)     dflt='y';;
3668 *) dflt='n';;
3669 esac
3670 cat <<EOM
3671
3672 Perl can be built to use the SOCKS proxy protocol library.  To do so,
3673 Configure must be run with -Dusesocks.
3674
3675 If this doesn't make any sense to you, just accept the default '$dflt'.
3676 EOM
3677 rp='Build Perl for SOCKS?'
3678 . ./myread
3679 case "$ans" in
3680 y|Y)    val="$define" ;;     
3681 *)      val="$undef" ;;
3682 esac
3683 set usesocks
3684 eval $setvar
3685
3686 : Looking for optional libraries
3687 echo " "
3688 echo "Checking for optional libraries..." >&4
3689 case "$libs" in
3690 ' '|'') dflt='';;
3691 *) dflt="$libs";;
3692 esac
3693 case "$libswanted" in
3694 '') libswanted='c_s';;
3695 esac
3696 case "$usesocks" in
3697 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
3698 esac
3699 libsfound=''
3700 libsfiles=''
3701 libsdirs=''
3702 libspath=''
3703 for thisdir in $libpth $xlibpth; do
3704   test -d $thisdir && libspath="$libspath $thisdir"
3705 done
3706 for thislib in $libswanted; do
3707         for thisdir in $libspath; do
3708             xxx=''
3709             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
3710                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|tail -1`
3711                 $test -f "$xxx" && eval $libscheck
3712                 $test -f "$xxx" && libstyle=shared
3713             fi
3714             if test ! -f "$xxx"; then
3715                 xxx=$thisdir/lib$thislib.$so
3716                 $test -f "$xxx" && eval $libscheck
3717                 $test -f "$xxx" && libstyle=shared
3718             fi  
3719             if test ! -f "$xxx"; then
3720                 xxx=$thisdir/lib$thislib$_a
3721                 $test -f "$xxx" && eval $libscheck
3722                 $test -f "$xxx" && libstyle=static
3723             fi
3724             if test ! -f "$xxx"; then
3725                 xxx=$thisdir/$thislib$_a
3726                 $test -f "$xxx" && eval $libscheck
3727                 $test -f "$xxx" && libstyle=static
3728             fi
3729             if test ! -f "$xxx"; then
3730                 xxx=$thisdir/lib${thislib}_s$_a
3731                 $test -f "$xxx" && eval $libscheck
3732                 $test -f "$xxx" && libstyle=static
3733                 $test -f "$xxx" && thislib=${thislib}_s
3734             fi
3735             if test ! -f "$xxx"; then
3736                 xxx=$thisdir/Slib$thislib$_a
3737                 $test -f "$xxx" && eval $libscheck
3738                 $test -f "$xxx" && libstyle=static
3739             fi
3740             if $test -f "$xxx"; then
3741                 case "$libstyle" in
3742                 shared) echo "Found -l$thislib (shared)." ;;
3743                 static) echo "Found -l$thislib." ;;
3744                 *)      echo "Found -l$thislib ($libstyle)." ;;
3745                 esac
3746                 case " $dflt " in
3747                 *"-l$thislib "*);;
3748                 *) dflt="$dflt -l$thislib"
3749                    libsfound="$libsfound $xxx"
3750                    yyy=`basename $xxx`
3751                    libsfiles="$libsfiles $yyy"
3752                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
3753                    case " $libsdirs " in
3754                    *" $yyy "*) ;;
3755                    *) libsdirs="$libsdirs $yyy" ;;
3756                    esac
3757                    ;;
3758                 esac
3759                 break
3760             fi  
3761         done
3762         if $test ! -f "$xxx"; then
3763             echo "No -l$thislib."
3764         fi
3765 done
3766 set X $dflt
3767 shift
3768 dflt="$*"
3769 case "$libs" in
3770 '') dflt="$dflt";;
3771 *) dflt="$libs";;
3772 esac
3773 case "$dflt" in
3774 ' '|'') dflt='none';;
3775 esac
3776
3777 $cat <<EOM
3778
3779 In order to compile $package on your machine, a number of libraries
3780 are usually needed.  Include any other special libraries here as well.
3781 Say "none" for none.  The default list is almost always right.
3782 EOM
3783
3784 echo " "
3785 rp="What libraries to use?"
3786 . ./myread
3787 case "$ans" in
3788 none) libs=' ';;
3789 *) libs="$ans";;
3790 esac
3791
3792 : determine optimization, if desired, or use for debug flag also
3793 case "$optimize" in
3794 ' '|$undef) dflt='none';;
3795 '') dflt='-O';;
3796 *) dflt="$optimize";;
3797 esac
3798 $cat <<EOH
3799
3800 By default, $package compiles with the -O flag to use the optimizer.
3801 Alternately, you might want to use the symbolic debugger, which uses
3802 the -g flag (on traditional Unix systems).  Either flag can be
3803 specified here.  To use neither flag, specify the word "none".
3804
3805 EOH
3806 rp="What optimizer/debugger flag should be used?"
3807 . ./myread
3808 optimize="$ans"
3809 case "$optimize" in
3810 'none') optimize=" ";;
3811 esac
3812
3813 dflt=''
3814 : We will not override a previous value, but we might want to
3815 : augment a hint file
3816 case "$hint" in
3817 default|recommended)
3818         case "$gccversion" in
3819         1*) dflt='-fpcc-struct-return' ;;
3820         esac
3821         case "$optimize" in
3822         *-g*) dflt="$dflt -DDEBUGGING";;
3823         esac
3824         case "$gccversion" in
3825         2*) if test -d /etc/conf/kconfig.d &&
3826                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
3827                 then
3828                         dflt="$dflt -posix"
3829                 fi
3830                 ;;
3831         esac
3832         case "$gccversion" in
3833         1*) ;;
3834         2.[0-8]*) ;;
3835         ?*)     echo " "
3836                 echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
3837                 echo 'int main(void) { return 0; }' > gcctest.c
3838                 if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
3839                         echo "Yes, it does." 2>&1
3840                         case "$ccflags" in
3841                         *strict-aliasing*) 
3842                                 echo "Leaving current flags $ccflags alone." 2>&1
3843                                 ;;
3844                         *) dflt="$dflt -fno-strict-aliasing" ;;
3845                         esac
3846                 else
3847                         echo "Nope, it doesn't, but that's ok." 2>&1
3848                 fi
3849                 ;;
3850         esac
3851         ;;
3852 esac
3853
3854 case "$mips_type" in
3855 *BSD*|'') inclwanted="$locincpth $usrinc";;
3856 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
3857 esac
3858 for thisincl in $inclwanted; do
3859         if $test -d $thisincl; then
3860                 if $test x$thisincl != x$usrinc; then
3861                         case "$dflt" in
3862                         *" -I$thisincl "*);;
3863                         *) dflt="$dflt -I$thisincl ";;
3864                         esac
3865                 fi
3866         fi
3867 done
3868
3869 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
3870         xxx=true;
3871 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
3872         xxx=true;
3873 else
3874         xxx=false;
3875 fi;
3876 if $xxx; then
3877         case "$dflt" in
3878         *$2*);;
3879         *) dflt="$dflt -D$2";;
3880         esac;
3881 fi'
3882
3883 set signal.h LANGUAGE_C; eval $inctest
3884
3885 case "$usesocks" in
3886 $define)
3887         ccflags="$ccflags -DSOCKS"
3888         ;;
3889 esac
3890
3891 case "$hint" in
3892 default|recommended) dflt="$ccflags $dflt" ;;
3893 *) dflt="$ccflags";;
3894 esac
3895
3896 case "$dflt" in
3897 ''|' ') dflt=none;;
3898 esac
3899
3900 $cat <<EOH
3901
3902 Your C compiler may want other flags.  For this question you should include
3903 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
3904 but you should NOT include libraries or ld flags like -lwhatever.  If you
3905 want $package to honor its debug switch, you should include -DDEBUGGING here.
3906 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
3907
3908 To use no flags, specify the word "none".
3909
3910 EOH
3911 set X $dflt
3912 shift
3913 dflt=${1+"$@"}
3914 rp="Any additional cc flags?"
3915 . ./myread
3916 case "$ans" in
3917 none) ccflags='';;
3918 *) ccflags="$ans";;
3919 esac
3920
3921 : the following weeds options from ccflags that are of no interest to cpp
3922 cppflags="$ccflags"
3923 case "$gccversion" in
3924 1*) cppflags="$cppflags -D__GNUC__"
3925 esac
3926 case "$mips_type" in
3927 '');;
3928 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
3929 esac
3930 case "$cppflags" in
3931 '');;
3932 *)
3933         echo " "
3934         echo "Let me guess what the preprocessor flags are..." >&4
3935         set X $cppflags
3936         shift
3937         cppflags=''
3938         $cat >cpp.c <<'EOM'
3939 #define BLURFL foo
3940
3941 BLURFL xx LFRULB
3942 EOM
3943         previous=''
3944         for flag in $*
3945         do
3946                 case "$flag" in
3947                 -*) ftry="$flag";;
3948                 *) ftry="$previous $flag";;
3949                 esac
3950                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
3951                         >cpp1.out 2>/dev/null && \
3952                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
3953                         >cpp2.out 2>/dev/null && \
3954                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
3955                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
3956                 then
3957                         cppflags="$cppflags $ftry"
3958                         previous=''
3959                 else
3960                         previous="$flag"
3961                 fi
3962         done
3963         set X $cppflags
3964         shift
3965         cppflags=${1+"$@"}
3966         case "$cppflags" in
3967         *-*)  echo "They appear to be: $cppflags";;
3968         esac
3969         $rm -f cpp.c cpp?.out
3970         ;;
3971 esac
3972
3973 : flags used in final linking phase
3974 case "$ldflags" in
3975 '') if ./venix; then
3976                 dflt='-i -z'
3977         else
3978                 dflt=''
3979         fi
3980         case "$ccflags" in
3981         *-posix*) dflt="$dflt -posix" ;;
3982         esac
3983         ;;
3984 *) dflt="$ldflags";;
3985 esac
3986
3987 : Try to guess additional flags to pick up local libraries.
3988 for thislibdir in $libpth; do
3989         case " $loclibpth " in
3990         *" $thislibdir "*)
3991                 case "$dflt " in 
3992                 *"-L$thislibdir "*) ;;
3993                 *)  dflt="$dflt -L$thislibdir" ;;
3994                 esac
3995                 ;;
3996         esac
3997 done
3998
3999 case "$dflt" in
4000 '') dflt='none' ;;
4001 esac
4002
4003 $cat <<EOH
4004
4005 Your C linker may need flags.  For this question you should
4006 include -L/whatever and any other flags used by the C linker, but you
4007 should NOT include libraries like -lwhatever.
4008
4009 Make sure you include the appropriate -L/path flags if your C linker
4010 does not normally search all of the directories you specified above,
4011 namely
4012         $libpth
4013 To use no flags, specify the word "none".
4014
4015 EOH
4016
4017 rp="Any additional ld flags (NOT including libraries)?"
4018 . ./myread
4019 case "$ans" in
4020 none) ldflags='';;
4021 *) ldflags="$ans";;
4022 esac
4023 rmlist="$rmlist pdp11"
4024
4025 : coherency check
4026 echo " "
4027 echo "Checking your choice of C compiler and flags for coherency..." >&4
4028 $cat > try.c <<'EOF'
4029 #include <stdio.h>
4030 int main() { printf("Ok\n"); exit(0); }
4031 EOF
4032 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
4033 shift
4034 $cat >try.msg <<'EOM'
4035 I've tried to compile and run the following simple program:
4036
4037 EOM
4038 $cat try.c >> try.msg
4039
4040 $cat >> try.msg <<EOM
4041
4042 I used the command:
4043
4044         $*
4045         ./try
4046
4047 and I got the following output:
4048
4049 EOM
4050 dflt=y
4051 if sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
4052         if sh -c './try' >>try.msg 2>&1; then
4053                 xxx=`./try`
4054                 case "$xxx" in
4055                 "Ok") dflt=n ;;
4056                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
4057                         case " $libs " in
4058                         *" -lsfio "*)
4059                                 cat >> try.msg <<'EOQS'
4060 If $libs contains -lsfio, and sfio is mis-configured, then it
4061 sometimes (apparently) runs and exits with a 0 status, but with no
4062 output!  It may have to do with sfio's use of _exit vs. exit.
4063
4064 EOQS
4065                                 rp="You have a big problem.  Shall I abort Configure"
4066                                 dflt=y
4067                                 ;;
4068                         esac
4069                         ;;
4070                 esac
4071         else
4072                 echo "The program compiled OK, but exited with status $?." >>try.msg
4073                 rp="You have a problem.  Shall I abort Configure"
4074                 dflt=y
4075         fi
4076 else
4077         echo "I can't compile the test program." >>try.msg
4078         rp="You have a BIG problem.  Shall I abort Configure"
4079         dflt=y
4080 fi
4081 case "$dflt" in
4082 y)
4083         $cat try.msg >&4
4084         case "$knowitall" in
4085         '')
4086                 echo "(The supplied flags or libraries might be incorrect.)"
4087                 ;;
4088         *) dflt=n;;
4089         esac
4090         echo " "
4091         . ./myread
4092         case "$ans" in
4093         n*|N*) ;;
4094         *)      echo "Ok.  Stopping Configure." >&4
4095                 exit 1
4096                 ;;
4097         esac
4098         ;;
4099 n) echo "OK, that should do.";;
4100 esac
4101 $rm -f try try.* core
4102
4103 : define an is-a-typedef? function
4104 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
4105 case "$inclist" in
4106 "") inclist="sys/types.h";;
4107 esac;
4108 eval "varval=\$$var";
4109 case "$varval" in
4110 "")
4111         $rm -f temp.c;
4112         for inc in $inclist; do
4113                 echo "#include <$inc>" >>temp.c;
4114         done;
4115         echo "#ifdef $type" >> temp.c;
4116         echo "printf(\"We have $type\");" >> temp.c;
4117         echo "#endif" >> temp.c;
4118         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
4119         if $contains $type temp.E >/dev/null 2>&1; then
4120                 eval "$var=\$type";
4121         else
4122                 eval "$var=\$def";
4123         fi;
4124         $rm -f temp.?;;
4125 *) eval "$var=\$varval";;
4126 esac'
4127
4128 : define an is-a-typedef? function that prompts if the type is not available.
4129 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
4130 case "$inclist" in
4131 "") inclist="sys/types.h";;
4132 esac;
4133 eval "varval=\$$var";
4134 case "$varval" in
4135 "")
4136         $rm -f temp.c;
4137         for inc in $inclist; do
4138                 echo "#include <$inc>" >>temp.c;
4139         done;
4140         echo "#ifdef $type" >> temp.c;
4141         echo "printf(\"We have $type\");" >> temp.c;
4142         echo "#endif" >> temp.c;
4143         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
4144         echo " " ;
4145         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
4146         if $contains $type temp.E >/dev/null 2>&1; then
4147                 echo "$type found." >&4;
4148                 eval "$var=\$type";
4149         else
4150                 echo "$type NOT found." >&4;
4151                 dflt="$def";
4152                 . ./myread ;
4153                 eval "$var=\$ans";
4154         fi;
4155         $rm -f temp.?;;
4156 *) eval "$var=\$varval";;
4157 esac'
4158
4159 : define a shorthand compile call
4160 compile='
4161 mc_file=$1;
4162 shift;
4163 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
4164 : define a shorthand compile call for compilations that should be ok.
4165 compile_ok='
4166 mc_file=$1;
4167 shift;
4168 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
4169
4170 : check for lengths of integral types
4171 echo " "
4172 case "$intsize" in
4173 '')
4174         echo "Checking to see how big your integers are..." >&4
4175         $cat >intsize.c <<'EOCP'
4176 #include <stdio.h>
4177 int main()
4178 {
4179         printf("intsize=%d;\n", (int)sizeof(int));
4180         printf("longsize=%d;\n", (int)sizeof(long));
4181         printf("shortsize=%d;\n", (int)sizeof(short));
4182         exit(0);
4183 }
4184 EOCP
4185         set intsize
4186         if eval $compile_ok && ./intsize > /dev/null; then
4187                 eval `./intsize`
4188                 echo "Your integers are $intsize bytes long."
4189                 echo "Your long integers are $longsize bytes long."
4190                 echo "Your short integers are $shortsize bytes long."
4191         else
4192                 $cat >&4 <<EOM
4193 !
4194 Help! I can't compile and run the intsize test program: please enlighten me!
4195 (This is probably a misconfiguration in your system or libraries, and
4196 you really ought to fix it.  Still, I'll try anyway.)
4197 !
4198 EOM
4199                 dflt=4
4200                 rp="What is the size of an integer (in bytes)?"
4201                 . ./myread
4202                 intsize="$ans"
4203                 dflt=$intsize
4204                 rp="What is the size of a long integer (in bytes)?"
4205                 . ./myread
4206                 longsize="$ans"
4207                 dflt=2
4208                 rp="What is the size of a short integer (in bytes)?"
4209                 . ./myread
4210                 shortsize="$ans"
4211         fi
4212         ;;
4213 esac
4214 $rm -f intsize intsize.*
4215
4216 : see what type lseek is declared as in the kernel
4217 rp="What is the type used for lseek's offset on this system?"
4218 set off_t lseektype long stdio.h sys/types.h
4219 eval $typedef_ask
4220
4221 echo " "
4222 echo "Checking to see how big your file offsets are..." >&4
4223 $cat >try.c <<EOCP
4224 #include <sys/types.h>
4225 #include <stdio.h>
4226 int main()
4227 {
4228     printf("%d\n", (int)sizeof($lseektype));
4229     return(0); 
4230 }
4231 EOCP
4232 set try
4233 if eval $compile_ok; then
4234         lseeksize=`./try`
4235         echo "Your file offsets are $lseeksize bytes long."
4236 else
4237         dflt=$longsize
4238         echo " "
4239         echo "(I can't seem to compile the test program.  Guessing...)"
4240         rp="What is the size of your file offsets (in bytes)?"
4241         . ./myread
4242         lseeksize="$ans"
4243 fi
4244 $rm -f try.c try
4245
4246 : see what type file positions are declared as in the library
4247 rp="What is the type for file position used by fsetpos()?"
4248 set fpos_t fpostype long stdio.h sys/types.h
4249 eval $typedef_ask
4250
4251 echo " "
4252 case "$fpostype" in
4253 *_t) zzz="$fpostype"    ;;
4254 *)   zzz="fpos_t"       ;;
4255 esac
4256 echo "Checking the size of $zzz..." >&4 
4257 cat > try.c <<EOCP
4258 #include <sys/types.h>
4259 #include <stdio.h>
4260 int main() {
4261     printf("%d\n", (int)sizeof($fpostype));
4262     exit(0);
4263 }
4264 EOCP
4265 set try
4266 if eval $compile_ok; then
4267         yyy=`./try`
4268         case "$yyy" in
4269         '')     fpossize=4
4270                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
4271                 ;;
4272         *)      fpossize=$yyy
4273                 echo "Your $zzz is $fpossize bytes long."
4274                 ;;
4275         esac
4276 else
4277         dflt="$longsize"
4278         echo " " >&4
4279         echo "(I can't compile the test program.  Guessing...)" >&4
4280         rp="What is the size of your file positions (in bytes)?"
4281         . ./myread
4282         fpossize="$ans"
4283 fi
4284
4285
4286
4287 # Backward compatibility (uselfs is deprecated).
4288 case "$uselfs" in
4289 "$define"|true|[yY]*)
4290         cat <<EOM >&4
4291
4292 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
4293 EOM
4294         uselargefiles="$define"
4295         ;;
4296 esac                          
4297
4298 case "$lseeksize:$fpossize" in
4299 8:8) cat <<EOM
4300
4301 You can have files larger than 2 gigabytes.
4302 EOM
4303    val="$define" ;;
4304 *)    case "$uselargefiles" in
4305    "$undef"|false|[nN]*) dflt='n' ;;
4306    *)   dflt='y' ;;
4307    esac
4308    cat <<EOM
4309
4310 Perl can be built to understand large files (files larger than 2 gigabytes)
4311 on some systems.  To do so, Configure can be run with -Duselargefiles.
4312
4313 If this doesn't make any sense to you, just accept the default '$dflt'.
4314 EOM
4315    rp='Try to understand large files, if available?'
4316    . ./myread
4317    case "$ans" in
4318    y|Y)         val="$define" ;;
4319    *)           val="$undef"  ;;
4320    esac
4321    ;;
4322 esac
4323 set uselargefiles
4324 eval $setvar
4325 case "$uselargefiles" in
4326 "$define")
4327 : Look for a hint-file generated 'call-back-unit'.  If the
4328 : user has specified that a large files perl is to be built,
4329 : we may need to set or change some other defaults.
4330         if $test -f uselargefiles.cbu; then
4331                 echo "Your platform has some specific hints for large file builds, using them..."
4332                 . ./uselargefiles.cbu
4333                 echo " "
4334                 echo "Rechecking to see how big your file offsets are..." >&4
4335                 $cat >try.c <<EOCP
4336 #include <sys/types.h>
4337 #include <stdio.h>
4338 int main()
4339 {
4340     printf("%d\n", (int)sizeof($lseektype));
4341     return(0); 
4342 }
4343 EOCP
4344                 set try
4345                 if eval $compile_ok; then
4346                         lseeksize=`./try`
4347                         $echo "Your file offsets are now $lseeksize bytes long."
4348                 else
4349                         dflt="$lseeksize"
4350                         echo " "
4351                         echo "(I can't seem to compile the test program.  Guessing...)"
4352                         rp="What is the size of your file offsets (in bytes)?"
4353                         . ./myread
4354                         lseeksize="$ans"
4355                 fi
4356                 case "$fpostype" in
4357                 *_t) zzz="$fpostype"    ;;
4358                 *)   zzz="fpos_t"       ;;
4359                 esac
4360                 $echo $n "Rechecking the size of $zzz...$c" >&4 
4361                 $cat > try.c <<EOCP
4362 #include <sys/types.h>
4363 #include <stdio.h>
4364 int main() {
4365     printf("%d\n", (int)sizeof($fpostype));
4366     exit(0);
4367 }
4368 EOCP
4369                 set try
4370                 if eval $compile_ok; then
4371                         yyy=`./try`
4372                         dflt="$lseeksize"
4373                         case "$yyy" in
4374                         '')     echo " "
4375                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
4376                                 ;;
4377                         *)      fpossize=$yyy
4378                                 echo " $fpossize bytes." >&4
4379                                 ;;
4380                         esac
4381                 else
4382                         dflt="$fpossize"
4383                         echo " "
4384                         echo "(I can't compile the test program.  Guessing...)" >&4
4385                         rp="What is the size of your file positions (in bytes)?"
4386                         . ./myread
4387                         fpossize="$ans"
4388                 fi
4389                 $rm -f try.c try
4390         fi
4391         ;;
4392 esac
4393
4394
4395 case "$usemorebits" in
4396 "$define"|true|[yY]*)
4397         use64bitint="$define"
4398         uselongdouble="$define"
4399         usemorebits="$define"
4400         ;;
4401 *)      usemorebits="$undef"
4402         ;;
4403 esac
4404
4405
4406 case "$uselonglong" in
4407 "$define"|true|[yY]*)
4408         cat <<EOM >&4
4409
4410 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
4411 EOM
4412         use64bitint="$define"
4413         ;;
4414 esac                          
4415 case "$use64bits" in
4416 "$define"|true|[yY]*)
4417         cat <<EOM >&4
4418
4419 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
4420 EOM
4421         use64bitint="$define"
4422         ;;
4423 esac                          
4424 case "$use64bitints" in
4425 "$define"|true|[yY]*)
4426         cat <<EOM >&4
4427
4428 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
4429 EOM
4430         use64bitint="$define"
4431         ;;
4432 esac                          
4433 case "$use64bitsint" in
4434 "$define"|true|[yY]*)
4435         cat <<EOM >&4
4436
4437 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
4438 EOM
4439         use64bitint="$define"
4440         ;;
4441 esac                          
4442 case "$uselonglongs" in
4443 "$define"|true|[yY]*)
4444         cat <<EOM >&4
4445
4446 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
4447 EOM
4448         use64bitint="$define"
4449         ;;
4450 esac                          
4451 case "$use64bitsall" in
4452 "$define"|true|[yY]*)
4453         cat <<EOM >&4
4454
4455 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
4456 EOM
4457         use64bitall="$define"
4458         ;;
4459 esac                          
4460
4461 case "$ccflags" in
4462 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
4463 esac
4464 case "$use64bitall" in
4465 "$define"|true|[yY]*) use64bitint="$define" ;;
4466 esac
4467
4468 case "$longsize" in
4469 8) cat <<EOM
4470
4471 You have natively 64-bit long integers.
4472 EOM
4473    val="$define"
4474    ;;
4475 *) case "$use64bitint" in
4476    "$define"|true|[yY]*) dflt='y';;
4477    *) dflt='n';;
4478    esac
4479    cat <<EOM
4480
4481 Perl can be built to take advantage of 64-bit integer types
4482 on some systems.  To do so, Configure can be run with -Duse64bitint.
4483 Choosing this option will most probably introduce binary incompatibilities.
4484
4485 If this doesn't make any sense to you, just accept the default '$dflt'.
4486 EOM
4487    rp='Try to use 64-bit integers, if available?'
4488    . ./myread
4489    case "$ans" in
4490    [yY]*) val="$define" ;;
4491    *)     val="$undef"  ;;
4492    esac
4493    ;;
4494 esac
4495 set use64bitint
4496 eval $setvar
4497
4498 case "$use64bitall" in
4499 "$define"|true|[yY]*) dflt='y' ;;
4500 *) case "$longsize" in
4501    8) dflt='y' ;;
4502    *) dflt='n' ;;
4503    esac
4504    ;;
4505 esac    
4506 cat <<EOM
4507
4508 You may also choose to try maximal 64-bitness.  It means using as much
4509 64-bitness as possible on the platform.  This in turn means even more
4510 binary incompatibilities.  On the other hand, your platform may not
4511 have any more 64-bitness available than what you already have chosen.
4512
4513 If this doesn't make any sense to you, just accept the default '$dflt'.
4514 EOM
4515 rp='Try to use maximal 64-bit support, if available?'
4516 . ./myread
4517 case "$ans" in
4518 [yY]*) val="$define" ;;
4519 *)     val="$undef"  ;;
4520 esac
4521 set use64bitall
4522 eval $setvar
4523 case "$use64bitall" in
4524 "$define")
4525         case "$use64bitint" in
4526         "$undef")
4527                 cat <<EOM
4528
4529 Since you have chosen a maximally 64-bit build, I'm also turning on
4530 the use of 64-bit integers.
4531 EOM
4532                 use64bitint="$define" ;;
4533         esac
4534         ;;
4535 esac
4536
4537 case "$use64bitint" in
4538 "$define"|true|[yY]*)
4539 : Look for a hint-file generated 'call-back-unit'.  If the
4540 : user has specified that a 64-bit perl is to be built,
4541 : we may need to set or change some other defaults.
4542         if $test -f use64bitint.cbu; then
4543                 echo "Your platform has some specific hints for 64-bit integers, using them..."
4544                 . ./use64bitint.cbu
4545         fi
4546         case "$longsize" in
4547         4) case "$archname64" in
4548            '') archname64=64int ;;
4549            esac
4550            ;;
4551         esac
4552         ;;
4553 esac
4554
4555 case "$use64bitall" in
4556 "$define"|true|[yY]*)
4557 : Look for a hint-file generated 'call-back-unit'.  If the
4558 : user has specified that a maximally 64-bit perl is to be built,
4559 : we may need to set or change some other defaults.
4560         if $test -f use64bitall.cbu; then
4561                 echo "Your platform has some specific hints for 64-bit builds, using them..."
4562                 . ./use64bitall.cbu
4563         fi
4564         case "$longsize" in
4565         4) case "$archname64" in
4566            ''|64int) archname64=64all ;;
4567            esac
4568            ;;
4569         esac
4570         ;;
4571 esac
4572
4573 echo " "
4574 echo "Checking for GNU C Library..." >&4
4575 cat >gnulibc.c <<EOM
4576 #include <stdio.h>
4577 int main()
4578 {
4579 #ifdef __GLIBC__
4580     exit(0);
4581 #else
4582     exit(1);
4583 #endif
4584 }
4585 EOM
4586 set gnulibc
4587 if eval $compile_ok && ./gnulibc; then
4588         val="$define"
4589         echo "You are using the GNU C Library"
4590 else
4591         val="$undef"
4592         echo "You are not using the GNU C Library"
4593 fi
4594 $rm -f gnulibc*
4595 set d_gnulibc
4596 eval $setvar
4597
4598 : see if nm is to be used to determine whether a symbol is defined or not
4599 case "$usenm" in
4600 '')
4601         dflt=''
4602         case "$d_gnulibc" in
4603         "$define")
4604                 echo " "
4605                 echo "nm probably won't work on the GNU C Library." >&4
4606                 dflt=n
4607                 ;;
4608         esac
4609         case "$dflt" in
4610         '') 
4611                 if $test "$osname" = aix -a ! -f /lib/syscalls.exp; then
4612                         echo " "
4613                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
4614                         echo "'nm' won't be sufficient on this sytem." >&4
4615                         dflt=n
4616                 fi
4617                 ;;
4618         esac
4619         case "$dflt" in
4620         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
4621                 if $test $dflt -gt 20; then
4622                         dflt=y
4623                 else
4624                         dflt=n
4625                 fi
4626                 ;;
4627         esac
4628         ;;
4629 *)
4630         case "$usenm" in
4631         true|$define) dflt=y;;
4632         *) dflt=n;;
4633         esac
4634         ;;
4635 esac
4636 $cat <<EOM
4637
4638 I can use $nm to extract the symbols from your C libraries. This
4639 is a time consuming task which may generate huge output on the disk (up
4640 to 3 megabytes) but that should make the symbols extraction faster. The
4641 alternative is to skip the 'nm' extraction part and to compile a small
4642 test program instead to determine whether each symbol is present. If
4643 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
4644 this may be the best solution.
4645
4646 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
4647
4648 EOM
4649 rp="Shall I use $nm to extract C symbols from the libraries?"
4650 . ./myread
4651 case "$ans" in
4652 [Nn]*) usenm=false;;
4653 *) usenm=true;;
4654 esac
4655
4656 runnm=$usenm
4657 case "$reuseval" in
4658 true) runnm=false;;
4659 esac
4660
4661 : nm options which may be necessary
4662 case "$nm_opt" in
4663 '') if $test -f /mach_boot; then
4664                 nm_opt=''       # Mach
4665         elif $test -d /usr/ccs/lib; then
4666                 nm_opt='-p'     # Solaris (and SunOS?)
4667         elif $test -f /dgux; then
4668                 nm_opt='-p'     # DG-UX
4669         elif $test -f /lib64/rld; then
4670                 nm_opt='-p'     # 64-bit Irix
4671         else
4672                 nm_opt=''
4673         fi;;
4674 esac
4675
4676 : nm options which may be necessary for shared libraries but illegal
4677 : for archive libraries.  Thank you, Linux.
4678 case "$nm_so_opt" in
4679 '')     case "$myuname" in
4680         *linux*)
4681                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
4682                         nm_so_opt='--dynamic'
4683                 fi
4684                 ;;
4685         esac
4686         ;;
4687 esac
4688
4689 case "$runnm" in
4690 true)
4691 : get list of predefined functions in a handy place
4692 echo " "
4693 case "$libc" in
4694 '') libc=unknown
4695         case "$libs" in
4696         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
4697         esac
4698         ;;
4699 esac
4700 libnames='';
4701 case "$libs" in
4702 '') ;;
4703 *)  for thislib in $libs; do
4704         case "$thislib" in
4705         -lc|-lc_s)
4706                 : Handle C library specially below.
4707                 ;;
4708         -l*)
4709                 thislib=`echo $thislib | $sed -e 's/^-l//'`
4710                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
4711                         :
4712                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
4713                         :
4714                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
4715                         :
4716                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
4717                         :
4718                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
4719                         :
4720                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
4721                         :
4722                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
4723                         :
4724                 else
4725                         try=''
4726                 fi
4727                 libnames="$libnames $try"
4728                 ;;
4729         *) libnames="$libnames $thislib" ;;
4730         esac
4731         done
4732         ;;
4733 esac
4734 xxx=normal
4735 case "$libc" in
4736 unknown)
4737         set /lib/libc.$so
4738         for xxx in $libpth; do
4739                 $test -r $1 || set $xxx/libc.$so
4740                 : The messy sed command sorts on library version numbers.
4741                 $test -r $1 || \
4742                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
4743                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
4744                                 h
4745                                 s/[0-9][0-9]*/0000&/g
4746                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
4747                                 G
4748                                 s/\n/ /' | \
4749                          $sort | $sed -e 's/^.* //'`
4750                 eval set \$$#
4751         done
4752         $test -r $1 || set /usr/ccs/lib/libc.$so
4753         $test -r $1 || set /lib/libsys_s$_a
4754         ;;
4755 *)
4756         set blurfl
4757         ;;
4758 esac
4759 if $test -r "$1"; then
4760         echo "Your (shared) C library seems to be in $1."
4761         libc="$1"
4762 elif $test -r /lib/libc && $test -r /lib/clib; then
4763         echo "Your C library seems to be in both /lib/clib and /lib/libc."
4764         xxx=apollo
4765         libc='/lib/clib /lib/libc'
4766         if $test -r /lib/syslib; then
4767                 echo "(Your math library is in /lib/syslib.)"
4768                 libc="$libc /lib/syslib"
4769         fi
4770 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
4771         echo "Your C library seems to be in $libc, as you said before."
4772 elif $test -r $incpath/usr/lib/libc$_a; then
4773         libc=$incpath/usr/lib/libc$_a;
4774         echo "Your C library seems to be in $libc.  That's fine."
4775 elif $test -r /lib/libc$_a; then
4776         libc=/lib/libc$_a;
4777         echo "Your C library seems to be in $libc.  You're normal."
4778 else
4779         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
4780                 :
4781         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
4782                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
4783         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
4784                 :
4785         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
4786                 :
4787         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
4788                 :
4789         else
4790                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
4791         fi
4792         if $test -r "$tans"; then
4793                 echo "Your C library seems to be in $tans, of all places."
4794                 libc=$tans
4795         else
4796                 libc='blurfl'
4797         fi
4798 fi
4799 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
4800         dflt="$libc"
4801         cat <<EOM
4802
4803 If the guess above is wrong (which it might be if you're using a strange
4804 compiler, or your machine supports multiple models), you can override it here.
4805
4806 EOM
4807 else
4808         dflt=''
4809         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
4810         cat >&4 <<EOM
4811 I can't seem to find your C library.  I've looked in the following places:
4812
4813 EOM
4814         $sed 's/^/      /' libpath
4815         cat <<EOM
4816
4817 None of these seems to contain your C library. I need to get its name...
4818
4819 EOM
4820 fi
4821 fn=f
4822 rp='Where is your C library?'
4823 . ./getfile
4824 libc="$ans"
4825
4826 echo " "
4827 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
4828 set X `cat libnames`
4829 shift
4830 xxx=files
4831 case $# in 1) xxx=file; esac
4832 echo "Extracting names from the following $xxx for later perusal:" >&4
4833 echo " "
4834 $sed 's/^/      /' libnames >&4
4835 echo " "
4836 $echo $n "This may take a while...$c" >&4
4837
4838 for file in $*; do
4839         case $file in
4840         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
4841         *) $nm $nm_opt $file 2>/dev/null;;
4842         esac
4843 done >libc.tmp
4844
4845 $echo $n ".$c"
4846 $grep fprintf libc.tmp > libc.ptf
4847 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
4848 xrun='eval "<libc.tmp $com >libc.list"; echo "done" >&4'
4849 xxx='[ADTSIW]'
4850 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *_[_.]*//p' -e 's/^.* $xxx  *//p'";\
4851         eval $xscan;\
4852         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4853                 eval $xrun
4854 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
4855         eval $xscan;\
4856         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4857                 eval $xrun
4858 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
4859         eval $xscan;\
4860         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4861                 eval $xrun
4862 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
4863         eval $xscan;\
4864         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4865                 eval $xrun
4866 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
4867         eval $xscan;\
4868         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4869                 eval $xrun
4870 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
4871         eval $xscan;\
4872         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4873                 eval $xrun
4874 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
4875                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
4876         eval $xscan;\
4877         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4878                 eval $xrun
4879 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
4880         eval $xscan;\
4881         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4882                 eval $xrun
4883 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
4884         eval $xscan;\
4885         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4886                 eval $xrun
4887 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
4888         eval $xscan;\
4889         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4890                 eval $xrun
4891 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
4892         eval $xscan;\
4893         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4894                 eval $xrun
4895 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
4896         eval $xscan;\
4897         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4898                 eval $xrun
4899 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
4900         eval $xscan;\
4901         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4902                 eval $xrun
4903 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
4904         eval $xscan;\
4905         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4906                 eval $xrun
4907 else
4908         $nm -p $* 2>/dev/null >libc.tmp
4909         $grep fprintf libc.tmp > libc.ptf
4910         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
4911                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
4912         then
4913                 nm_opt='-p'
4914                 eval $xrun
4915         else
4916                 echo " "
4917                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
4918                 com=''
4919                 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
4920                         for thisname in $libnames $libc; do
4921                                 $ar t $thisname >>libc.tmp
4922                         done
4923                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
4924                         echo "Ok." >&4
4925                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
4926                         # Repeat libc to extract forwarders to DLL entries too
4927                         for thisname in $libnames $libc; do
4928                                 $ar tv $thisname >>libc.tmp
4929                                 # Revision 50 of EMX has bug in $ar.
4930                                 # it will not extract forwarders to DLL entries
4931                                 # Use emximp which will extract exactly them.
4932                                 emximp -o tmp.imp $thisname \
4933                                     2>/dev/null && \
4934                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
4935                                     < tmp.imp >>libc.tmp
4936                                 $rm tmp.imp
4937                         done
4938                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
4939                         echo "Ok." >&4
4940                 else
4941                         echo "$ar didn't seem to work right." >&4
4942                         echo "Maybe this is a Cray...trying bld instead..." >&4
4943                         if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
4944                         then
4945                                 for thisname in $libnames; do
4946                                         bld t $libnames | \
4947                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
4948                                         $ar t $thisname >>libc.tmp
4949                                 done
4950                                 echo "Ok." >&4
4951                         else
4952                                 echo "That didn't work either.  Giving up." >&4
4953                                 exit 1
4954                         fi
4955                 fi
4956         fi
4957 fi
4958 nm_extract="$com"
4959 if $test -f /lib/syscalls.exp; then
4960         echo " "
4961         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
4962         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*$/\1/p' /lib/syscalls.exp >>libc.list
4963 fi
4964 ;;
4965 esac
4966 $rm -f libnames libpath
4967
4968 : is a C symbol defined?
4969 csym='tlook=$1;
4970 case "$3" in
4971 -v) tf=libc.tmp; tc=""; tdc="";;
4972 -a) tf=libc.tmp; tc="[0]"; tdc="[]";;
4973 *) tlook="^$1\$"; tf=libc.list; tc="()"; tdc="()";;
4974 esac;
4975 tx=yes;
4976 case "$reuseval-$4" in
4977 true-) ;;
4978 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
4979 esac;
4980 case "$tx" in
4981 yes)
4982         case "$runnm" in
4983         true)
4984                 if $contains $tlook $tf >/dev/null 2>&1;
4985                 then tval=true;
4986                 else tval=false;
4987                 fi;;
4988         *)
4989                 echo "int main() { extern short $1$tdc; printf(\"%hd\", $1$tc); }" > t.c;
4990                 if $cc -o t $optimize $ccflags $ldflags t.c $libs >/dev/null 2>&1;
4991                 then tval=true;
4992                 else tval=false;
4993                 fi;
4994                 $rm -f t t.c;;
4995         esac;;
4996 *)
4997         case "$tval" in
4998         $define) tval=true;;
4999         *) tval=false;;
5000         esac;;
5001 esac;
5002 eval "$2=$tval"'
5003
5004 : define an is-in-libc? function
5005 inlibc='echo " "; td=$define; tu=$undef;
5006 sym=$1; var=$2; eval "was=\$$2";
5007 tx=yes;
5008 case "$reuseval$was" in
5009 true) ;;
5010 true*) tx=no;;
5011 esac;
5012 case "$tx" in
5013 yes)
5014         set $sym tres -f;
5015         eval $csym;
5016         case "$tres" in
5017         true)
5018                 echo "$sym() found." >&4;
5019                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
5020         *)
5021                 echo "$sym() NOT found." >&4;
5022                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
5023         esac;;
5024 *)
5025         case "$was" in
5026         $define) echo "$sym() found." >&4;;
5027         *) echo "$sym() NOT found." >&4;;
5028         esac;;
5029 esac'
5030
5031 : see if sqrtl exists
5032 set sqrtl d_sqrtl
5033 eval $inlibc
5034
5035 case "$ccflags" in
5036 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
5037 esac
5038
5039 case "$uselongdouble" in
5040 $define|true|[yY]*)     dflt='y';;
5041 *) dflt='n';;
5042 esac
5043 cat <<EOM
5044
5045 Perl can be built to take advantage of long doubles which
5046 (if available) may give more accuracy and range for floating point numbers.
5047
5048 If this doesn't make any sense to you, just accept the default '$dflt'.
5049 EOM
5050 rp='Try to use long doubles if available?'
5051 . ./myread
5052 case "$ans" in
5053 y|Y)    val="$define"   ;;
5054 *)      val="$undef"    ;;
5055 esac
5056 set uselongdouble
5057 eval $setvar
5058
5059 case "$uselongdouble" in
5060 true|[yY]*) uselongdouble="$define" ;;
5061 esac
5062
5063 case "$uselongdouble" in
5064 $define)
5065 : Look for a hint-file generated 'call-back-unit'.  If the
5066 : user has specified that long doubles should be used,
5067 : we may need to set or change some other defaults.
5068         if $test -f uselongdouble.cbu; then
5069                 echo "Your platform has some specific hints for long doubles, using them..."
5070                 . ./uselongdouble.cbu
5071         else
5072                 $cat <<EOM
5073 (Your platform doesn't have any specific hints for long doubles.)
5074 EOM
5075         fi
5076         ;;
5077 esac
5078
5079 case "$uselongdouble:$d_sqrtl" in
5080 $define:$undef)
5081                 $cat <<EOM >&4
5082
5083 *** You requested the use of long doubles but you do not seem to have
5084 *** the mathematic functions for long doubles.  I'm disabling the use
5085 *** of long doubles.
5086
5087 EOM
5088         uselongdouble=$undef
5089         ;;
5090 esac
5091
5092 : check for length of double
5093 echo " "
5094 case "$doublesize" in
5095 '')
5096         echo "Checking to see how big your double precision numbers are..." >&4
5097         $cat >try.c <<'EOCP'
5098 #include <stdio.h>
5099 int main()
5100 {
5101     printf("%d\n", (int)sizeof(double));
5102     exit(0);
5103 }
5104 EOCP
5105         set try
5106         if eval $compile_ok; then
5107                 doublesize=`./try`
5108                 echo "Your double is $doublesize bytes long."
5109         else
5110                 dflt='8'
5111                 echo "(I can't seem to compile the test program.  Guessing...)"
5112                 rp="What is the size of a double precision number (in bytes)?"
5113                 . ./myread
5114                 doublesize="$ans"
5115         fi
5116         ;;
5117 esac
5118 $rm -f try.c try
5119
5120 : check for long doubles
5121 echo " "
5122 echo "Checking to see if you have long double..." >&4
5123 echo 'int main() { long double x = 7.0; }' > try.c
5124 set try
5125 if eval $compile; then
5126         val="$define"
5127         echo "You have long double."
5128 else
5129         val="$undef"
5130         echo "You do not have long double."
5131 fi
5132 $rm try.*
5133 set d_longdbl
5134 eval $setvar
5135
5136 : check for length of long double
5137 case "${d_longdbl}${longdblsize}" in
5138 $define)
5139         echo " "
5140         echo "Checking to see how big your long doubles are..." >&4
5141         $cat >try.c <<'EOCP'
5142 #include <stdio.h>
5143 int main()
5144 {
5145         printf("%d\n", sizeof(long double));
5146 }
5147 EOCP
5148         set try
5149         set try
5150         if eval $compile; then
5151                 longdblsize=`./try$exe_ext`
5152                 echo "Your long doubles are $longdblsize bytes long."
5153         else
5154                 dflt='8'
5155                 echo " "
5156                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
5157                 rp="What is the size of a long double (in bytes)?"
5158                 . ./myread
5159                 longdblsize="$ans"
5160         fi
5161         if $test "X$doublesize" = "X$longdblsize"; then
5162                 echo "(That isn't any different from an ordinary double.)"
5163         fi      
5164         ;;
5165 esac
5166 $rm -f try.* try
5167
5168 : determine the architecture name
5169 echo " "
5170 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
5171         tarch=`arch`"-$osname"
5172 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
5173         if uname -m > tmparch 2>&1 ; then
5174                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
5175                         -e 's/$/'"-$osname/" tmparch`
5176         else
5177                 tarch="$osname"
5178         fi
5179         $rm -f tmparch
5180 else
5181         tarch="$osname"
5182 fi
5183 case "$myarchname" in
5184 ''|"$tarch") ;;
5185 *)
5186         echo "(Your architecture name used to be $myarchname.)"
5187         archname=''
5188         ;;
5189 esac
5190 myarchname="$tarch"
5191 case "$archname" in
5192 '') dflt="$tarch";;
5193 *) dflt="$archname";;
5194 esac
5195 rp='What is your architecture name'
5196 . ./myread
5197 archname="$ans"
5198 case "$usethreads" in
5199 $define)
5200         echo "Threads selected." >&4
5201         case "$archname" in
5202         *-thread*) echo "...and architecture name already has -thread." >&4
5203                 ;;
5204         *)      archname="$archname-thread"
5205                 echo "...setting architecture name to $archname." >&4
5206                 ;;
5207         esac
5208         ;;
5209 esac
5210 case "$usemultiplicity" in
5211 $define)
5212         echo "Multiplicity selected." >&4
5213         case "$archname" in
5214         *-multi*) echo "...and architecture name already has -multi." >&4
5215                 ;;
5216         *)      archname="$archname-multi"
5217                 echo "...setting architecture name to $archname." >&4
5218                 ;;
5219         esac
5220         ;;
5221 esac
5222 case "$use64bitint$use64bitall" in
5223 *"$define"*)
5224         case "$archname64" in
5225         '')
5226                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
5227                 ;;
5228         *)
5229                 case "$use64bitint" in
5230                 "$define") echo "64 bit integers selected." >&4 ;;
5231                 esac
5232                 case "$use64bitall" in
5233                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
5234                 esac
5235                 case "$archname" in
5236                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
5237                         ;;
5238                 *)      archname="$archname-$archname64"
5239                         echo "...setting architecture name to $archname." >&4
5240                         ;;
5241                 esac
5242                 ;;
5243         esac
5244 esac
5245 case "$uselongdouble" in
5246 $define)
5247         echo "Long doubles selected." >&4
5248         case "$longdblsize" in
5249         $doublesize)
5250                 "...but long doubles are equal to doubles, not changing architecture name." >&4
5251                 ;;
5252         *)
5253                 case "$archname" in
5254                 *-ld*) echo "...and architecture name already has -ld." >&4
5255                         ;;
5256                 *)      archname="$archname-ld"
5257                         echo "...setting architecture name to $archname." >&4
5258                         ;;
5259                 esac
5260                 ;;
5261         esac
5262         ;;
5263 esac
5264
5265 : determine root of directory hierarchy where package will be installed.
5266 case "$prefix" in
5267 '')
5268         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
5269         ;;
5270 *)
5271         dflt="$prefix"
5272         ;;
5273 esac
5274 $cat <<EOM
5275
5276 By default, $package will be installed in $dflt/bin, manual pages
5277 under $dflt/man, etc..., i.e. with $dflt as prefix for all
5278 installation directories. Typically this is something like /usr/local.
5279 If you wish to have binaries under /usr/bin but other parts of the
5280 installation under /usr/local, that's ok: you will be prompted
5281 separately for each of the installation directories, the prefix being
5282 only used to set the defaults.
5283
5284 EOM
5285 fn=d~
5286 rp='Installation prefix to use?'
5287 . ./getfile
5288 oldprefix=''
5289 case "$prefix" in
5290 '') ;;
5291 *)
5292         case "$ans" in
5293         "$prefix") ;;
5294         *) oldprefix="$prefix";;
5295         esac
5296         ;;
5297 esac
5298 prefix="$ans"
5299 prefixexp="$ansexp"
5300
5301 : is AFS running?
5302 echo " "
5303 case "$afs" in
5304 $define|true)   afs=true ;;
5305 $undef|false)   afs=false ;;
5306 *)      if test -d /afs; then
5307                 afs=true
5308         else
5309                 afs=false
5310         fi
5311         ;;
5312 esac
5313 if $afs; then
5314         echo "AFS may be running... I'll be extra cautious then..." >&4
5315 else
5316         echo "AFS does not seem to be running..." >&4
5317 fi
5318
5319 : determine installation prefix for where package is to be installed.
5320 if $afs; then 
5321 $cat <<EOM
5322
5323 Since you are running AFS, I need to distinguish the directory in which
5324 files will reside from the directory in which they are installed (and from
5325 which they are presumably copied to the former directory by occult means).
5326
5327 EOM
5328         case "$installprefix" in
5329         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
5330         *) dflt="$installprefix";;
5331         esac
5332 else
5333 $cat <<EOM
5334
5335 In some special cases, particularly when building $package for distribution,
5336 it is convenient to distinguish between the directory in which files should 
5337 be installed from the directory ($prefix) in which they 
5338 will eventually reside.  For most users, these two directories are the same.
5339
5340 EOM
5341         case "$installprefix" in
5342         '') dflt=$prefix ;;
5343         *) dflt=$installprefix;;
5344         esac
5345 fi
5346 fn=d~
5347 rp='What installation prefix should I use for installing files?'
5348 . ./getfile
5349 installprefix="$ans"
5350 installprefixexp="$ansexp"
5351
5352 : set the prefixit variable, to compute a suitable default value
5353 prefixit='case "$3" in
5354 ""|none)
5355         case "$oldprefix" in
5356         "") eval "$1=\"\$$2\"";;
5357         *)
5358                 case "$3" in
5359                 "") eval "$1=";;
5360                 none)
5361                         eval "tp=\"\$$2\"";
5362                         case "$tp" in
5363                         ""|" ") eval "$1=\"\$$2\"";;
5364                         *) eval "$1=";;
5365                         esac;;
5366                 esac;;
5367         esac;;
5368 *)
5369         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
5370         case "$tp" in
5371         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
5372         /*-$oldprefix/*|\~*-$oldprefix/*)
5373                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
5374         *) eval "$1=\"\$$2\"";;
5375         esac;;
5376 esac'
5377
5378
5379 : get the patchlevel
5380 echo " "
5381 echo "Getting the current patchlevel..." >&4
5382 if $test -r $rsrc/patchlevel.h;then
5383         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
5384         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
5385         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
5386         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
5387         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
5388         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
5389 else
5390         revision=0
5391         patchlevel=0
5392         subversion=0
5393         api_revision=0
5394         api_version=0
5395         api_subversion=0
5396 fi
5397 $echo "(You have $package version $patchlevel subversion $subversion.)"
5398 case "$osname" in
5399 dos|vms)
5400         : XXX Should be a Configure test for double-dots in filenames.
5401         version=`echo $revision $patchlevel $subversion | \
5402                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
5403         api_versionstring=`echo $api_revision $api_version $api_subversion | \
5404                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
5405         ;;
5406 *)
5407         version=`echo $revision $patchlevel $subversion | \
5408                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
5409         api_versionstring=`echo $api_revision $api_version $api_subversion | \
5410                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
5411         ;;
5412 esac
5413 : Special case the 5.005_xx maintenance series, which used 5.005
5414 : without any subversion label as a subdirectory in $sitelib
5415 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
5416         api_versionstring='5.005'
5417 fi
5418
5419 : determine installation style
5420 : For now, try to deduce it from prefix unless it is already set.
5421 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
5422 case "$installstyle" in
5423 '')     case "$prefix" in
5424                 *perl*) dflt='lib';;
5425                 *) dflt='lib/perl5' ;;
5426         esac
5427         ;;
5428 *)      dflt="$installstyle" ;;
5429 esac
5430 : Probably not worth prompting for this since we prompt for all
5431 : the directories individually, and the prompt would be too long and
5432 : confusing anyway.
5433 installstyle=$dflt
5434
5435 : determine where private library files go
5436 : Usual default is /usr/local/lib/perl5/$version.
5437 : Also allow things like /opt/perl/lib/$version, since 
5438 : /opt/perl/lib/perl5... would be redundant.
5439 : The default "style" setting is made in installstyle.U
5440 case "$installstyle" in
5441 *lib/perl5*) set dflt privlib lib/$package/$version ;;
5442 *)       set dflt privlib lib/$version ;;
5443 esac
5444 eval $prefixit
5445 $cat <<EOM
5446
5447 There are some auxiliary files for $package that need to be put into a
5448 private library directory that is accessible by everyone.
5449
5450 EOM
5451 fn=d~+
5452 rp='Pathname where the private library files will reside?'
5453 . ./getfile
5454 privlib="$ans"
5455 privlibexp="$ansexp"
5456 : Change installation prefix, if necessary.
5457 if $test X"$prefix" != X"$installprefix"; then
5458         installprivlib=`echo $privlibexp | sed "s#^$prefix#$installprefix#"`
5459 else
5460         installprivlib="$privlibexp"
5461 fi
5462
5463 : set the prefixup variable, to restore leading tilda escape
5464 prefixup='case "$prefixexp" in
5465 "$prefix") ;;
5466 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
5467 esac'
5468
5469 : determine where public architecture dependent libraries go
5470 set archlib archlib
5471 eval $prefixit
5472 : privlib default is /usr/local/lib/$package/$version
5473 : archlib default is /usr/local/lib/$package/$version/$archname
5474 : privlib may have an optional trailing /share.
5475 tdflt=`echo $privlib | $sed 's,/share$,,'`
5476 tdflt=$tdflt/$archname
5477 case "$archlib" in
5478 '')     dflt=$tdflt
5479         ;;
5480 *)      dflt="$archlib"
5481     ;;
5482 esac
5483 $cat <<EOM
5484
5485 $spackage contains architecture-dependent library files.  If you are
5486 sharing libraries in a heterogeneous environment, you might store
5487 these files in a separate location.  Otherwise, you can just include
5488 them with the rest of the public library files.
5489
5490 EOM
5491 fn=d+~
5492 rp='Where do you want to put the public architecture-dependent libraries?'
5493 . ./getfile
5494 archlib="$ans"
5495 archlibexp="$ansexp"
5496 if $test X"$archlib" = X"$privlib"; then
5497         d_archlib="$undef"
5498 else
5499         d_archlib="$define"
5500 fi
5501 : Change installation prefix, if necessary.
5502 if $test X"$prefix" != X"$installprefix"; then
5503         installarchlib=`echo $archlibexp | sed "s#^$prefix#$installprefix#"`
5504 else
5505         installarchlib="$archlibexp"
5506 fi
5507
5508
5509 : Binary compatibility with 5.005 is not possible for builds
5510 : with advanced features
5511 case "$usethreads$usemultiplicity" in
5512 *define*)
5513         bincompat5005="$undef"
5514         d_bincompat5005="$undef"
5515         ;;
5516 *)      $cat <<EOM
5517
5518 This version of Perl can be compiled for binary compatibility with 5.005.
5519 If you decide to do so, you will be able to continue using most of the
5520 extensions that were compiled for Perl 5.005.
5521
5522 EOM
5523         case "$bincompat5005$d_bincompat5005" in
5524         *"$undef"*) dflt=n ;;
5525         *) dflt=y ;;
5526         esac
5527         rp='Binary compatibility with Perl 5.005?'
5528         . ./myread
5529         case "$ans" in
5530         y*) val="$define" ;;
5531         *)  val="$undef" ;;
5532         esac
5533         set d_bincompat5005
5534         eval $setvar
5535         case "$d_bincompat5005" in
5536         "$define")
5537                 bincompat5005="$define"
5538                 ;;
5539         *)      bincompat5005="$undef"
5540                 d_bincompat5005="$undef"
5541                 ;;
5542         esac
5543         ;;
5544 esac
5545
5546
5547 : see if setuid scripts can be secure
5548 $cat <<EOM
5549
5550 Some kernels have a bug that prevents setuid #! scripts from being
5551 secure.  Some sites have disabled setuid #! scripts because of this.
5552
5553 First let's decide if your kernel supports secure setuid #! scripts.
5554 (If setuid #! scripts would be secure but have been disabled anyway,
5555 don't say that they are secure if asked.)
5556
5557 EOM
5558
5559 val="$undef"
5560 if $test -d /dev/fd; then
5561         echo "#!$ls" >reflect
5562         chmod +x,u+s reflect
5563         ./reflect >flect 2>&1
5564         if $contains "/dev/fd" flect >/dev/null; then
5565                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
5566                 val="$define"
5567         else
5568                 $cat <<EOM
5569 If you are not sure if they are secure, I can check but I'll need a
5570 username and password different from the one you are using right now.
5571 If you don't have such a username or don't want me to test, simply
5572 enter 'none'.
5573
5574 EOM
5575                 rp='Other username to test security of setuid scripts with?'
5576                 dflt='none'
5577                 . ./myread
5578                 case "$ans" in
5579                 n|none)
5580                         case "$d_suidsafe" in
5581                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
5582                                 dflt=n;;
5583                         "$undef")
5584                                 echo "Well, the $hint value is *not* secure." >&4
5585                                 dflt=n;;
5586                         *)      echo "Well, the $hint value *is* secure." >&4
5587                                 dflt=y;;
5588                         esac
5589                         ;;
5590                 *)
5591                         $rm -f reflect flect
5592                         echo "#!$ls" >reflect
5593                         chmod +x,u+s reflect
5594                         echo >flect
5595                         chmod a+w flect
5596                         echo '"su" will (probably) prompt you for '"$ans's password."
5597                         su $ans -c './reflect >flect'
5598                         if $contains "/dev/fd" flect >/dev/null; then
5599                                 echo "Okay, it looks like setuid scripts are secure." >&4
5600                                 dflt=y
5601                         else
5602                                 echo "I don't think setuid scripts are secure." >&4
5603                                 dflt=n
5604                         fi
5605                         ;;
5606                 esac
5607                 rp='Does your kernel have *secure* setuid scripts?'
5608                 . ./myread
5609                 case "$ans" in
5610                 [yY]*)  val="$define";;
5611                 *)      val="$undef";;
5612                 esac
5613         fi
5614 else
5615         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
5616         echo "(That's for file descriptors, not floppy disks.)"
5617         val="$undef"
5618 fi
5619 set d_suidsafe
5620 eval $setvar
5621
5622 $rm -f reflect flect
5623
5624 : now see if they want to do setuid emulation
5625 echo " "
5626 val="$undef"
5627 case "$d_suidsafe" in
5628 "$define")
5629         val="$undef"
5630         echo "No need to emulate SUID scripts since they are secure here." >& 4
5631         ;;
5632 *)
5633         $cat <<EOM
5634 Some systems have disabled setuid scripts, especially systems where
5635 setuid scripts cannot be secure.  On systems where setuid scripts have
5636 been disabled, the setuid/setgid bits on scripts are currently
5637 useless.  It is possible for $package to detect those bits and emulate
5638 setuid/setgid in a secure fashion.  This emulation will only work if
5639 setuid scripts have been disabled in your kernel.
5640
5641 EOM
5642         case "$d_dosuid" in
5643         "$define") dflt=y ;;
5644         *) dflt=n ;;
5645         esac
5646         rp="Do you want to do setuid/setgid emulation?"
5647         . ./myread
5648         case "$ans" in
5649         [yY]*)  val="$define";;
5650         *)      val="$undef";;
5651         esac
5652         ;;
5653 esac
5654 set d_dosuid
5655 eval $setvar
5656
5657 : determine filename position in cpp output
5658 echo " "
5659 echo "Computing filename position in cpp output for #include directives..." >&4
5660 echo '#include <stdio.h>' > foo.c
5661 $cat >fieldn <<EOF
5662 $startsh
5663 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5664 $grep '^[       ]*#.*stdio\.h' | \
5665 while read cline; do
5666         pos=1
5667         set \$cline
5668         while $test \$# -gt 0; do
5669                 if $test -r \`echo \$1 | $tr -d '"'\`; then
5670                         echo "\$pos"
5671                         exit 0
5672                 fi
5673                 shift
5674                 pos=\`expr \$pos + 1\`
5675         done
5676 done
5677 EOF
5678 chmod +x fieldn
5679 fieldn=`./fieldn`
5680 $rm -f foo.c fieldn
5681 case $fieldn in
5682 '') pos='???';;
5683 1) pos=first;;
5684 2) pos=second;;
5685 3) pos=third;;
5686 *) pos="${fieldn}th";;
5687 esac
5688 echo "Your cpp writes the filename in the $pos field of the line."
5689
5690 : locate header file
5691 $cat >findhdr <<EOF
5692 $startsh
5693 wanted=\$1
5694 name=''
5695 for usrincdir in $usrinc
5696 do
5697         if test -f \$usrincdir/\$wanted; then
5698                 echo "\$usrincdir/\$wanted"
5699                 exit 0
5700         fi
5701 done
5702 awkprg='{ print \$$fieldn }'
5703 echo "#include <\$wanted>" > foo\$\$.c
5704 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5705 $grep "^[       ]*#.*\$wanted" | \
5706 while read cline; do
5707         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5708         case "\$name" in
5709         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5710         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5711         *) exit 2;;
5712         esac;
5713 done;
5714 #
5715 # status = 0: grep returned 0 lines, case statement not executed
5716 # status = 1: headerfile found
5717 # status = 2: while loop executed, no headerfile found
5718 #
5719 status=\$?
5720 $rm -f foo\$\$.c;
5721 if test \$status -eq 1; then
5722         exit 0;
5723 fi
5724 exit 1
5725 EOF
5726 chmod +x findhdr
5727
5728 : define an alternate in-header-list? function
5729 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5730 cont=true; xxf="echo \"<\$1> found.\" >&4";
5731 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5732 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5733 esac;
5734 case $# in 4) instead=instead;; *) instead="at last";; esac;
5735 while $test "$cont"; do
5736         xxx=`./findhdr $1`
5737         var=$2; eval "was=\$$2";
5738         if $test "$xxx" && $test -r "$xxx";
5739         then eval $xxf;
5740         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5741                 cont="";
5742         else eval $xxnf;
5743         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5744         set $yyy; shift; shift; yyy=$@;
5745         case $# in 0) cont="";;
5746         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5747                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5748         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5749                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5750         esac;
5751 done;
5752 while $test "$yyy";
5753 do set $yyy; var=$2; eval "was=\$$2";
5754         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5755         set $yyy; shift; shift; yyy=$@;
5756 done'
5757
5758 : see if this is a malloc.h system
5759 set malloc.h i_malloc
5760 eval $inhdr
5761
5762 : see if stdlib is available
5763 set stdlib.h i_stdlib
5764 eval $inhdr
5765
5766 : determine which malloc to compile in
5767 echo " "
5768 case "$usemymalloc" in
5769 ''|[yY]*|true|$define)  dflt='y' ;;
5770 *)      dflt='n' ;;
5771 esac
5772 rp="Do you wish to attempt to use the malloc that comes with $package?"
5773 . ./myread
5774 usemymalloc="$ans"
5775 case "$ans" in
5776 y*|true)
5777         usemymalloc='y'
5778         mallocsrc='malloc.c'
5779         mallocobj="malloc$_o"
5780         d_mymalloc="$define"
5781         case "$libs" in
5782         *-lmalloc*)
5783                 : Remove malloc from list of libraries to use
5784                 echo "Removing unneeded -lmalloc from library list" >&4
5785                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
5786                 shift
5787                 libs="$*"
5788                 echo "libs = $libs" >&4
5789                 ;;
5790         esac
5791         ;;
5792 *)
5793         usemymalloc='n'
5794         mallocsrc=''
5795         mallocobj=''
5796         d_mymalloc="$undef"
5797         ;;
5798 esac
5799
5800 : compute the return types of malloc and free
5801 echo " "
5802 $cat >malloc.c <<END
5803 #$i_malloc I_MALLOC
5804 #$i_stdlib I_STDLIB
5805 #include <stdio.h>
5806 #include <sys/types.h>
5807 #ifdef I_MALLOC
5808 #include <malloc.h>
5809 #endif
5810 #ifdef I_STDLIB
5811 #include <stdlib.h>
5812 #endif
5813 #ifdef TRY_MALLOC
5814 void *malloc();
5815 #endif
5816 #ifdef TRY_FREE
5817 void free();
5818 #endif
5819 END
5820 case "$malloctype" in
5821 '')
5822         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
5823                 malloctype='void *'
5824         else
5825                 malloctype='char *'
5826         fi
5827         ;;
5828 esac
5829 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
5830
5831 case "$freetype" in
5832 '')
5833         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
5834                 freetype='void'
5835         else
5836                 freetype='int'
5837         fi
5838         ;;
5839 esac
5840 echo "Your system uses $freetype free(), it would seem." >&4
5841 $rm -f malloc.[co]
5842 $cat <<EOM
5843
5844 After $package is installed, you may wish to install various
5845 add-on modules and utilities.  Typically, these add-ons will
5846 be installed under $prefix with the rest
5847 of this package.  However, you may wish to install such add-ons
5848 elsewhere under a different prefix.
5849
5850 If you do not wish to put everything under a single prefix, that's
5851 ok.  You will be prompted for the individual locations; this siteprefix
5852 is only used to suggest the defaults.
5853
5854 The default should be fine for most people.
5855
5856 EOM
5857 fn=d~+
5858 rp='Installation prefix to use for add-on modules and utilities?'
5859 : XXX Here might be another good place for an installstyle setting.
5860 case "$siteprefix" in
5861 '') dflt=$prefix ;;
5862 *)  dflt=$siteprefix ;;
5863 esac
5864 . ./getfile
5865 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
5866 oldsiteprefix=''
5867 case "$siteprefix" in
5868 '') ;;
5869 *)      case "$ans" in
5870         "$prefix") ;;
5871         *) oldsiteprefix="$prefix";;
5872         esac
5873         ;;
5874 esac
5875 siteprefix="$ans"
5876 siteprefixexp="$ansexp"
5877
5878 : determine where site specific libraries go.
5879 : Usual default is /usr/local/lib/perl5/site_perl/$version
5880 : The default "style" setting is made in installstyle.U
5881 : XXX No longer works with Prefixit stuff.
5882 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
5883 case "$sitelib" in
5884 '') case "$installstyle" in
5885         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
5886         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
5887         esac
5888         ;;
5889 *)      dflt="$sitelib"
5890         ;;
5891 esac
5892 $cat <<EOM
5893
5894 The installation process will create a directory for
5895 site-specific extensions and modules.  Most users find it convenient
5896 to place all site-specific files in this directory rather than in the
5897 main distribution directory.
5898
5899 EOM
5900 fn=d~+
5901 rp='Pathname for the site-specific library files?'
5902 . ./getfile
5903 sitelib="$ans"
5904 sitelibexp="$ansexp"
5905 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
5906 : Change installation prefix, if necessary.
5907 if $test X"$prefix" != X"$installprefix"; then
5908         installsitelib=`echo $sitelibexp | $sed "s#^$prefix#$installprefix#"`
5909 else
5910         installsitelib="$sitelibexp"
5911 fi
5912
5913 : determine where site specific architecture-dependent libraries go.
5914 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
5915 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
5916 : sitelib may have an optional trailing /share.
5917 case "$sitearch" in
5918 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
5919         dflt="$dflt/$archname"
5920         ;;
5921 *)      dflt="$sitearch"
5922         ;;
5923 esac
5924 set sitearch sitearch none
5925 eval $prefixit
5926 $cat <<EOM
5927
5928 The installation process will also create a directory for
5929 architecture-dependent site-specific extensions and modules.
5930
5931 EOM
5932 fn=d~+
5933 rp='Pathname for the site-specific architecture-dependent library files?'
5934 . ./getfile
5935 sitearch="$ans"
5936 sitearchexp="$ansexp"
5937 : Change installation prefix, if necessary.
5938 if $test X"$prefix" != X"$installprefix"; then
5939         installsitearch=`echo $sitearchexp | sed "s#^$prefix#$installprefix#"`
5940 else
5941         installsitearch="$sitearchexp"
5942 fi
5943
5944 $cat <<EOM
5945
5946 The installation process will also create a directory for
5947 vendor-supplied add-ons.  Vendors who supply perl with their system
5948 may find it convenient to place all vendor-supplied files in this
5949 directory rather than in the main distribution directory.  This will
5950 ease upgrades between binary-compatible maintenance versions of perl.
5951
5952 Of course you may also use these directories in whatever way you see
5953 fit.  For example, you might use them to access modules shared over a
5954 company-wide network.
5955
5956 The default answer should be fine for most people.
5957 This causes further questions about vendor add-ons to be skipped
5958 and no vendor-specific directories will be configured for perl.
5959
5960 EOM
5961 rp='Do you want to configure vendor-specific add-on directories?'
5962 case "$usevendorprefix" in
5963 define|true|[yY]*) dflt=y ;;
5964 *)      : User may have set vendorprefix directly on Configure command line.
5965         case "$vendorprefix" in
5966         ''|' ') dflt=n ;;
5967         *)      dflt=y ;;
5968         esac
5969         ;;
5970 esac
5971 . ./myread
5972 case "$ans" in
5973 [yY]*)  fn=d~+
5974         rp='Installation prefix to use for vendor-supplied add-ons?'
5975         case "$vendorprefix" in
5976         '') dflt='' ;;
5977         *)  dflt=$vendorprefix ;;
5978         esac
5979         . ./getfile
5980         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
5981         oldvendorprefix=''
5982         case "$vendorprefix" in
5983         '') ;;
5984         *)      case "$ans" in
5985                 "$prefix") ;;
5986                 *) oldvendorprefix="$prefix";;
5987                 esac
5988                 ;;
5989         esac
5990         usevendorprefix="$define"
5991         vendorprefix="$ans"
5992         vendorprefixexp="$ansexp"
5993         ;;
5994 *)      usevendorprefix="$undef"
5995         vendorprefix=''
5996         vendorprefixexp=''
5997         ;;
5998 esac
5999
6000 case "$vendorprefix" in
6001 '')     d_vendorlib="$undef"
6002         vendorlib=''
6003         vendorlibexp=''
6004         ;;
6005 *)      d_vendorlib="$define"
6006         : determine where vendor-supplied modules go.
6007         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
6008         case "$vendorlib" in
6009         '')
6010                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6011                 case "$installstyle" in
6012                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
6013                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
6014                 esac
6015                 ;;
6016         *)      dflt="$vendorlib"
6017                 ;;
6018         esac
6019         fn=d~+
6020         rp='Pathname for the vendor-supplied library files?'
6021         . ./getfile
6022         vendorlib="$ans"
6023         vendorlibexp="$ansexp"
6024         ;;
6025 esac
6026 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
6027 : Change installation prefix, if necessary.
6028 if $test X"$prefix" != X"$installprefix"; then
6029         installvendorlib=`echo $vendorlibexp | $sed "s#^$prefix#$installprefix#"`
6030 else
6031         installvendorlib="$vendorlibexp"
6032 fi
6033
6034 case "$vendorprefix" in
6035 '')     d_vendorarch="$undef"
6036         vendorarch=''
6037         vendorarchexp=''
6038         ;;
6039 *)      d_vendorarch="$define"
6040         : determine where vendor-supplied architecture-dependent libraries go.
6041         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
6042         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
6043         : vendorlib may have an optional trailing /share.
6044         case "$vendorarch" in
6045         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
6046                 dflt="$dflt/$archname"
6047                 ;;
6048         *)      dflt="$vendorarch" ;;
6049         esac
6050         fn=d~+
6051         rp='Pathname for vendor-supplied architecture-dependent files?'
6052         . ./getfile
6053         vendorarch="$ans"
6054         vendorarchexp="$ansexp"
6055         ;;
6056 esac
6057 : Change installation prefix, if necessary.
6058 if $test X"$prefix" != X"$installprefix"; then
6059         installvendorarch=`echo $vendorarchexp | sed "s#^$prefix#$installprefix#"`
6060 else
6061         installvendorarch="$vendorarchexp"
6062 fi
6063
6064 : Final catch-all directories to search
6065 $cat <<EOM
6066
6067 Lastly, you can have perl look in other directories for extensions and
6068 modules in addition to those already specified.
6069 These directories will be searched after 
6070         $sitearch 
6071         $sitelib 
6072 EOM
6073 test X"$vendorlib" != "X" && echo '     ' $vendorlib
6074 test X"$vendorarch" != "X" && echo '    ' $vendorarch
6075 echo ' '
6076 case "$otherlibdirs" in
6077 ''|' ') dflt='none' ;;
6078 *)      dflt="$otherlibdirs" ;;
6079 esac
6080 $cat <<EOM
6081 Enter a colon-separated set of extra paths to include in perl's @INC
6082 search path, or enter 'none' for no extra paths.
6083
6084 EOM
6085
6086 rp='Colon-separated list of additional directories for perl to search?'
6087 . ./myread
6088 case "$ans" in
6089 ' '|''|none)    otherlibdirs=' ' ;;     
6090 *)      otherlibdirs="$ans" ;;
6091 esac
6092 case "$otherlibdirs" in
6093 ' ') val=$undef ;;
6094 *)      val=$define ;;
6095 esac
6096 set d_perl_otherlibdirs
6097 eval $setvar
6098
6099 : Cruising for prototypes
6100 echo " "
6101 echo "Checking out function prototypes..." >&4
6102 $cat >prototype.c <<'EOCP'
6103 int main(int argc, char *argv[]) {
6104         exit(0);}
6105 EOCP
6106 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
6107         echo "Your C compiler appears to support function prototypes."
6108         val="$define"
6109 else
6110         echo "Your C compiler doesn't seem to understand function prototypes."
6111         val="$undef"
6112 fi
6113 set prototype
6114 eval $setvar
6115 $rm -f prototype*
6116
6117 case "$prototype" in
6118 "$define") ;;
6119 *)      ansi2knr='ansi2knr'
6120         echo " "
6121         cat <<EOM >&4
6122
6123 $me:  FATAL ERROR:
6124 This version of $package can only be compiled by a compiler that 
6125 understands function prototypes.  Unfortunately, your C compiler 
6126         $cc $ccflags
6127 doesn't seem to understand them.  Sorry about that.
6128
6129 If GNU cc is available for your system, perhaps you could try that instead.  
6130
6131 Eventually, we hope to support building Perl with pre-ANSI compilers.
6132 If you would like to help in that effort, please contact <perlbug@perl.org>.
6133
6134 Aborting Configure now.
6135 EOM
6136         exit 2
6137         ;;
6138 esac
6139
6140 : determine where public executables go
6141 echo " "
6142 set dflt bin bin
6143 eval $prefixit
6144 fn=d~
6145 rp='Pathname where the public executables will reside?'
6146 . ./getfile
6147 if $test "X$ansexp" != "X$binexp"; then
6148         installbin=''
6149 fi
6150 bin="$ans"
6151 binexp="$ansexp"
6152 : Change installation prefix, if necessary.
6153 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
6154 if $test X"$prefix" != X"$installprefix"; then
6155         installbin=`echo $binexp | sed "s#^$prefix#$installprefix#"`
6156 else
6157         installbin="$binexp"
6158 fi
6159
6160 : Find perl5.005 or later.
6161 echo "Looking for a previously installed perl5.005 or later... "
6162 case "$perl5" in
6163 '')     for tdir in `echo "$binexp:$PATH" | $sed "s/$path_sep/ /g"`; do
6164                 : Check if this perl is recent and can load a simple module
6165                 if $test -x $tdir/perl && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6166                         perl5=$tdir/perl
6167                         break;
6168                 elif $test -x $tdir/perl5 && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6169                         perl5=$tdir/perl
6170                         break;
6171                 fi
6172         done
6173         ;;
6174 *)      perl5="$perl5"
6175         ;;
6176 esac
6177 case "$perl5" in
6178 '')     echo "None found.  That's ok.";;
6179 *)      echo "Using $perl5." ;;
6180 esac
6181
6182 : Determine list of previous versions to include in @INC
6183 $cat > getverlist <<EOPL
6184 #!$perl5 -w
6185 use File::Basename;
6186 \$api_versionstring = "$api_versionstring";
6187 \$version = "$version";
6188 \$stem = "$sitelib_stem";
6189 \$archname = "$archname";
6190 EOPL
6191         $cat >> getverlist <<'EOPL'
6192 # Can't have leading @ because metaconfig interprets it as a command!
6193 ;@inc_version_list=();
6194 # XXX Redo to do opendir/readdir? 
6195 if (-d $stem) {
6196     chdir($stem);
6197     ;@candidates = glob("5.*");
6198 }
6199 else {
6200     ;@candidates = ();
6201 }
6202
6203 # XXX ToDo:  These comparisons must be reworked when two-digit
6204 # subversions come along, so that 5.7.10 compares as greater than
6205 # 5.7.3!  By that time, hope that 5.6.x is sufficiently
6206 # widespread that we can use the built-in version vectors rather
6207 # than reinventing them here.  For 5.6.0, however, we must
6208 # assume this script will likely be run by 5.005_0x.  --AD 1/2000.
6209 foreach $d (@candidates) {
6210     if ($d lt $version) {
6211         if ($d ge $api_versionstring) {
6212             unshift(@inc_version_list, grep { -d } "$d/$archname", $d);
6213         }
6214         elsif ($d ge "5.005") {
6215             unshift(@inc_version_list, grep { -d } $d);
6216         }
6217     }
6218     else {
6219         # Skip newer version.  I.e. don't look in
6220         # 5.7.0 if we're installing 5.6.1.
6221     }
6222 }
6223
6224 if (@inc_version_list) {
6225     print join(' ', @inc_version_list);
6226 }
6227 else {
6228     # Blank space to preserve value for next Configure run.
6229     print " ";
6230 }
6231 EOPL
6232 chmod +x getverlist
6233 case "$inc_version_list" in
6234 '')     if test -x "$perl5"; then
6235                 dflt=`$perl5 getverlist`
6236         else
6237                 dflt='none'
6238         fi
6239         ;;
6240 $undef) dflt='none' ;;
6241 *)  dflt="$inc_version_list" ;;
6242 esac
6243 case "$dflt" in
6244 ''|' ') dflt=none ;;
6245 esac
6246 case "$dflt" in
6247 5.005) case "$bincompat5005" in
6248        $define|true|[yY]*) ;;
6249        *) dflt=none ;;
6250        esac
6251        ;;
6252 esac
6253 $cat <<'EOM'
6254
6255 In order to ease the process of upgrading, this version of perl 
6256 can be configured to use modules built and installed with earlier 
6257 versions of perl that were installed under $prefix.  Specify here
6258 the list of earlier versions that this version of perl should check.
6259 If Configure detected no earlier versions of perl installed under
6260 $prefix, then the list will be empty.  Answer 'none' to tell perl
6261 to not search earlier versions.
6262
6263 The default should almost always be sensible, so if you're not sure,
6264 just accept the default.
6265 EOM
6266
6267 rp='List of earlier versions to include in @INC?'
6268 . ./myread
6269 case "$ans" in
6270 [Nn]one|''|' ') inc_version_list=' ' ;;
6271 *) inc_version_list="$ans" ;;
6272 esac
6273 case "$inc_version_list" in
6274 ''|' ') 
6275         inc_version_list_init='0';;
6276 *)      inc_version_list_init=`echo $inc_version_list |
6277                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
6278         ;;
6279 esac
6280 $rm -f getverlist
6281
6282 : determine whether to install perl also as /usr/bin/perl
6283
6284 echo " "
6285 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
6286         $cat <<EOM
6287 Many scripts expect perl to be installed as /usr/bin/perl.
6288 I can install the perl you are about to compile also as /usr/bin/perl
6289 (in addition to $installbin/perl).
6290 EOM
6291         case "$installusrbinperl" in
6292         "$undef"|[nN]*) dflt='n';;
6293         *)              dflt='y';;
6294         esac
6295         rp="Do you want to install perl as /usr/bin/perl?"
6296         . ./myread
6297         case "$ans" in
6298         [yY]*)  val="$define";;
6299         *)      val="$undef" ;;
6300         esac
6301 else
6302         val="$undef"
6303 fi
6304 set installusrbinperl
6305 eval $setvar
6306
6307 : see if dld is available
6308 set dld.h i_dld
6309 eval $inhdr
6310
6311 : see if dlopen exists
6312 xxx_runnm="$runnm"
6313 runnm=false
6314 set dlopen d_dlopen
6315 eval $inlibc
6316 runnm="$xxx_runnm"
6317
6318 : determine which dynamic loading, if any, to compile in
6319 echo " "
6320 dldir="ext/DynaLoader"
6321 case "$usedl" in
6322 $define|y|true)
6323         dflt='y'
6324         usedl="$define"
6325         ;;
6326 $undef|n|false)
6327         dflt='n'
6328         usedl="$undef"
6329         ;;
6330 *) 
6331         dflt='n'
6332         case "$d_dlopen" in
6333             $define) dflt='y' ;;
6334         esac
6335         case "$i_dld" in
6336             $define) dflt='y' ;;
6337         esac
6338         : Does a dl_xxx.xs file exist for this operating system
6339         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
6340         ;;
6341 esac
6342 rp="Do you wish to use dynamic loading?"
6343 . ./myread
6344 usedl="$ans"
6345 case "$ans" in
6346 y*) usedl="$define"
6347         case "$dlsrc" in
6348         '')
6349                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
6350                         dflt="$dldir/dl_${osname}.xs"
6351                 elif $test "$d_dlopen" = "$define" ; then
6352                         dflt="$dldir/dl_dlopen.xs"
6353                 elif $test "$i_dld" = "$define" ; then
6354                         dflt="$dldir/dl_dld.xs"
6355                 else
6356                         dflt=''
6357                 fi
6358                 ;;
6359         *)      dflt="$dldir/$dlsrc"
6360                 ;;
6361         esac
6362     echo "The following dynamic loading files are available:"
6363         : Can not go over to $dldir because getfile has path hard-coded in.
6364         tdir=`pwd`; cd $rsrc; $ls -C $dldir/dl*.xs; cd $tdir
6365         rp="Source file to use for dynamic loading"
6366         fn="fne"
6367         gfpth="$src"
6368         . ./getfile
6369         usedl="$define"
6370         : emulate basename
6371         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
6372
6373         $cat << EOM
6374
6375 Some systems may require passing special flags to $cc -c to
6376 compile modules that will be used to create a shared library.
6377 To use no flags, say "none".
6378
6379 EOM
6380     case "$cccdlflags" in
6381     '') case "$gccversion" in
6382                 '') case "$osname" in
6383                         hpux)   dflt='+z' ;;
6384                         next)   dflt='none' ;;
6385                         irix*)  dflt='-KPIC' ;;
6386                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
6387                         sunos)  dflt='-pic' ;;
6388                         *)      dflt='none' ;;
6389                     esac
6390                         ;;
6391                 *)  case "$osname" in
6392                         svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
6393                         *)      dflt='-fpic' ;;
6394                     esac ;;
6395             esac ;;
6396         ' ') dflt='none' ;;
6397     *)  dflt="$cccdlflags" ;;
6398     esac
6399     rp="Any special flags to pass to $cc -c to compile shared library modules?"
6400     . ./myread
6401     case "$ans" in
6402     none) cccdlflags=' ' ;;
6403     *) cccdlflags="$ans" ;;
6404     esac
6405
6406     cat << EOM
6407
6408 Some systems use ld to create libraries that can be dynamically loaded,
6409 while other systems (such as those using ELF) use $cc.
6410
6411 EOM
6412         case "$ld" in
6413         '')     $cat >try.c <<'EOM'
6414 /* Test for whether ELF binaries are produced */
6415 #include <fcntl.h>
6416 #include <stdlib.h>
6417 int main() {
6418         char b[4];
6419         int i = open("a.out",O_RDONLY);
6420         if(i == -1) 
6421                 exit(1); /* fail */
6422         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
6423                 exit(0); /* succeed (yes, it's ELF) */
6424         else
6425                 exit(1); /* fail */
6426 }
6427 EOM
6428                 if $cc $ccflags try.c >/dev/null 2>&1 && ./a.out; then
6429                         cat <<EOM
6430 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
6431 EOM
6432                         dflt="$cc"
6433                 else
6434                         echo "I'll use ld to build dynamic libraries."
6435                         dflt='ld'
6436                 fi
6437                 rm -f try.c a.out
6438                 ;;
6439         *)      dflt="$ld"
6440                 ;;
6441         esac
6442
6443     rp="What command should be used to create dynamic libraries?"
6444     . ./myread
6445         ld="$ans"
6446
6447     cat << EOM
6448
6449 Some systems may require passing special flags to $ld to create a
6450 library that can be dynamically loaded.  If your ld flags include
6451 -L/other/path options to locate libraries outside your loader's normal
6452 search path, you may need to specify those -L options here as well.  To
6453 use no flags, say "none".
6454
6455 EOM
6456     case "$lddlflags" in
6457     '') case "$osname" in
6458                         beos) dflt='-nostart' ;;
6459                         hpux) dflt='-b';
6460                               case "$gccversion" in
6461                               '') dflt="$dflt +vnocompatwarnings" ;;
6462                               esac
6463                               ;;        
6464                         linux|irix*)    dflt='-shared' ;;
6465                         next)  dflt='none' ;;
6466                         solaris) dflt='-G' ;;
6467                         sunos) dflt='-assert nodefinitions' ;;
6468                         svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
6469                 *)     dflt='none' ;;
6470                         esac
6471                         ;;
6472     *) dflt="$lddlflags" ;;
6473     esac
6474
6475         : Try to guess additional flags to pick up local libraries.
6476         : Be careful not to append to a plain 'none'
6477         case "$dflt" in
6478         none) dflt='' ;;
6479         esac
6480         for thisflag in $ldflags; do
6481                 case "$thisflag" in
6482                 -L*|-R*)
6483                         case " $dflt " in
6484                         *" $thisflag "*) ;;
6485                         *) dflt="$dflt $thisflag" ;;
6486                         esac
6487                         ;;
6488                 esac
6489         done
6490
6491         case "$dflt" in
6492         ''|' ') dflt='none' ;;
6493         esac
6494
6495     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
6496     . ./myread
6497     case "$ans" in
6498     none) lddlflags=' ' ;;
6499     *) lddlflags="$ans" ;;
6500     esac
6501
6502         cat <<EOM
6503
6504 Some systems may require passing special flags to $cc to indicate that
6505 the resulting executable will use dynamic linking.  To use no flags,
6506 say "none".
6507
6508 EOM
6509     case "$ccdlflags" in
6510     '') case "$osname" in
6511                 hpux)   dflt='-Wl,-E' ;;
6512                 linux)  dflt='-rdynamic' ;;
6513                 next)   dflt='none' ;;
6514                 sunos)  dflt='none' ;;
6515                 *)      dflt='none' ;;
6516             esac ;;
6517     ' ')  dflt='none' ;;
6518     *)  dflt="$ccdlflags" ;;
6519     esac
6520     rp="Any special flags to pass to $cc to use dynamic linking?"
6521     . ./myread
6522     case "$ans" in
6523     none) ccdlflags=' ' ;;
6524     *) ccdlflags="$ans" ;;
6525     esac
6526     ;;
6527 *)  usedl="$undef"
6528         ld='ld'
6529     dlsrc='dl_none.xs'
6530     lddlflags=''
6531     ccdlflags=''
6532     ;;
6533 esac
6534
6535 also=''
6536 case "$usedl" in
6537 $undef)
6538         # No dynamic loading being used, so don't bother even to prompt.
6539         useshrplib='false'
6540         ;;
6541 *)      case "$useshrplib" in
6542         '')     case "$osname" in
6543                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|beos|cygwin*)
6544                         dflt=y
6545                         also='Building a shared libperl is required for dynamic loading to work on your system.'
6546                         ;;
6547                 next*)
6548                         case "$osvers" in
6549                         4*)     dflt=y
6550                                 also='Building a shared libperl is needed for MAB support.'
6551                                 ;;
6552                         *)      dflt=n
6553                                 ;;
6554                         esac
6555                         ;;
6556                 *)      dflt=n
6557                         ;;
6558                 esac
6559                 ;;
6560         $define|true|[Yy]*)
6561                 dflt=y
6562                 ;;
6563         *)      dflt=n
6564                 ;;
6565         esac
6566         $cat << EOM
6567
6568 The perl executable is normally obtained by linking perlmain.c with
6569 libperl${_a}, any static extensions (usually just DynaLoader), and
6570 any other libraries needed on this system (such as -lm, etc.).  Since
6571 your system supports dynamic loading, it is probably possible to build
6572 a shared libperl.$so.  If you will have more than one executable linked
6573 to libperl.$so, this will significantly reduce the size of each
6574 executable, but it may have a noticeable affect on performance.  The
6575 default is probably sensible for your system.
6576 $also
6577
6578 EOM
6579         rp="Build a shared libperl.$so (y/n)"
6580         . ./myread
6581         case "$ans" in
6582         true|$define|[Yy]*)
6583                 useshrplib='true'  ;;
6584         *)      useshrplib='false' ;;
6585         esac
6586         ;;
6587 esac
6588
6589 case "$useshrplib" in
6590 true)
6591         case "$libperl" in
6592         '')
6593                 # Figure out a good name for libperl.so.  Since it gets stored in
6594                 # a version-specific architecture-dependent library, the version
6595                 # number isn't really that important, except for making cc/ld happy.
6596                 #
6597                 # A name such as libperl.so.3.1
6598                 majmin="libperl.$so.$patchlevel.$subversion"
6599                 # A name such as libperl.so.301
6600                 majonly=`echo $patchlevel $subversion |
6601                         $awk '{printf "%d%02d", $1, $2}'`
6602                 majonly=libperl.$so.$majonly
6603                 # I'd prefer to keep the os-specific stuff here to a minimum, and
6604                 # rely on figuring it out from the naming of libc.
6605                 case "${osname}${osvers}" in
6606                 next4*)
6607                         dflt=libperl.5.$so
6608                         # XXX How handle the --version stuff for MAB?
6609                         ;;
6610                 linux*)  # ld won't link with a bare -lperl otherwise.
6611                         dflt=libperl.$so
6612                         ;;
6613                 cygwin*) # include version
6614                         dflt=`echo libperl$version | sed -e 's/\./_/g'`$lib_ext
6615                         ;;
6616                 *)      # Try to guess based on whether libc has major.minor.
6617                         case "$libc" in
6618                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
6619                         *libc.$so.[0-9]*) dflt=$majonly ;;
6620                         *)      dflt=libperl.$so ;;
6621                         esac
6622                         ;;
6623                 esac
6624                 ;;
6625         *)      dflt=$libperl
6626                 ;;
6627         esac
6628         cat << EOM
6629
6630 I need to select a good name for the shared libperl.  If your system uses
6631 library names with major and minor numbers, then you might want something
6632 like $majmin.  Alternatively, if your system uses a single version
6633 number for shared libraries, then you might want to use $majonly.
6634 Or, your system might be quite happy with a simple libperl.$so.
6635
6636 Since the shared libperl will get installed into a version-specific
6637 architecture-dependent directory, the version number of the shared perl
6638 library probably isn't important, so the default should be o.k.
6639
6640 EOM
6641         rp='What name do you want to give to the shared libperl?'
6642         . ./myread
6643         libperl=$ans
6644         echo "Ok, I'll use $libperl"
6645         ;;
6646 *)
6647         libperl="libperl${_a}"
6648         ;;
6649 esac
6650
6651 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
6652 case "$shrpdir" in
6653 '') ;;
6654 *)      $cat >&4 <<EOM
6655 WARNING:  Use of the shrpdir variable for the installation location of
6656 the shared $libperl is not supported.  It was never documented and
6657 will not work in this version.  Let me (perlbug@perl.org)
6658 know of any problems this may cause.
6659
6660 EOM
6661         case "$shrpdir" in
6662         "$archlibexp/CORE")
6663                 $cat >&4 <<EOM
6664 But your current setting of $shrpdir is
6665 the default anyway, so it's harmless.
6666 EOM
6667                 ;;
6668         *)
6669                 $cat >&4 <<EOM
6670 Further, your current attempted setting of $shrpdir
6671 conflicts with the value of $archlibexp/CORE
6672 that installperl will use.
6673 EOM
6674                 ;;
6675         esac
6676         ;;
6677 esac
6678
6679 # How will the perl executable find the installed shared $libperl?
6680 # Add $xxx to ccdlflags.
6681 # If we can't figure out a command-line option, use $shrpenv to
6682 # set env LD_RUN_PATH.  The main perl makefile uses this.
6683 shrpdir=$archlibexp/CORE
6684 xxx=''
6685 tmp_shrpenv=''
6686 if "$useshrplib"; then
6687     case "$osname" in 
6688         aix)
6689                 # We'll set it in Makefile.SH...
6690                 ;;
6691         solaris|netbsd)
6692                 xxx="-R $shrpdir"
6693                 ;;
6694         freebsd)
6695                 xxx="-Wl,-R$shrpdir"
6696                 ;;
6697         linux|irix*|dec_osf)
6698                 xxx="-Wl,-rpath,$shrpdir"
6699                 ;;
6700         next)
6701                 # next doesn't like the default...
6702                 ;;
6703         beos)
6704                 # beos doesn't like the default, either.
6705                 ;;
6706         hpux*)
6707                 # hpux doesn't like the default, either.
6708                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
6709                 ;;
6710         *)
6711                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
6712                 ;;
6713         esac
6714         case "$xxx" in
6715         '') ;;
6716         *)      
6717                 # Only add $xxx if it isn't already in ccdlflags.
6718                 case " $ccdlflags " in
6719                 *" $xxx "*)     ;;
6720                 *)      ccdlflags="$ccdlflags $xxx"
6721                         cat <<EOM >&4
6722
6723 Adding $xxx to the flags
6724 passed to $ld so that the perl executable will find the 
6725 installed shared $libperl.
6726
6727 EOM
6728                         ;;
6729                 esac
6730                 ;;
6731         esac
6732 fi
6733 # Fix ccdlflags in AIX for building external extensions.
6734 # (For building Perl itself bare -bE:perl.exp is needed,
6735 #  Makefile.SH takes care of this.)
6736 case "$osname" in
6737 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
6738 esac
6739 # Respect a hint or command-line value.
6740 case "$shrpenv" in
6741 '') shrpenv="$tmp_shrpenv" ;;
6742 esac
6743 case "$ldlibpthname" in
6744 '')     ldlibpthname=LD_LIBRARY_PATH ;;
6745 none)   ldlibpthname='' ;;
6746 esac
6747
6748 : determine where manual pages are on this system
6749 echo " "
6750 case "$sysman" in
6751 '') 
6752         syspath='/usr/man/man1 /usr/man/mann /usr/man/manl /usr/man/local/man1'
6753         syspath="$syspath /usr/man/u_man/man1 /usr/share/man/man1"
6754         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
6755         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
6756         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
6757         sysman=`./loc . /usr/man/man1 $syspath`
6758         ;;
6759 esac
6760 if $test -d "$sysman"; then
6761         echo "System manual is in $sysman." >&4
6762 else
6763         echo "Could not find manual pages in source form." >&4
6764 fi
6765
6766 : determine where manual pages go
6767 set man1dir man1dir none
6768 eval $prefixit
6769 $cat <<EOM
6770
6771 $spackage has manual pages available in source form.
6772 EOM
6773 case "$nroff" in
6774 nroff)
6775         echo "However, you don't have nroff, so they're probably useless to you."
6776         case "$man1dir" in
6777         '') man1dir="none";;
6778         esac;;
6779 esac
6780 echo "If you don't want the manual sources installed, answer 'none'."
6781 case "$man1dir" in
6782 ' ') dflt=none
6783         ;;
6784 '')
6785         lookpath="$prefixexp/man/man1 $prefixexp/man/l_man/man1"
6786         lookpath="$lookpath $prefixexp/man/p_man/man1"
6787         lookpath="$lookpath $prefixexp/man/u_man/man1"
6788         lookpath="$lookpath $prefixexp/man/man.1"
6789         case "$sysman" in
6790         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
6791         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
6792         esac
6793         set dflt
6794         eval $prefixup
6795         ;;
6796 *)  dflt="$man1dir"
6797         ;;
6798 esac
6799 echo " "
6800 fn=dn+~
6801 rp="Where do the main $spackage manual pages (source) go?"
6802 . ./getfile
6803 if $test "X$man1direxp" != "X$ansexp"; then
6804         installman1dir=''
6805 fi
6806 man1dir="$ans"
6807 man1direxp="$ansexp"
6808 case "$man1dir" in
6809 '')     man1dir=' '
6810         installman1dir='';;
6811 esac
6812
6813 : Change installation prefix, if necessary.
6814 if $test X"$prefix" != X"$installprefix"; then
6815         installman1dir=`echo $man1direxp | $sed "s#^$prefix#$installprefix#"`
6816 else
6817         installman1dir="$man1direxp"
6818 fi
6819
6820 : What suffix to use on installed man pages
6821
6822 case "$man1dir" in
6823 ' ')
6824         man1ext='0'
6825         ;;
6826 *)
6827         rp="What suffix should be used for the main $spackage man pages?"
6828         case "$man1ext" in
6829         '')     case "$man1dir" in
6830                 *1)  dflt=1 ;;
6831                 *1p) dflt=1p ;;
6832                 *1pm) dflt=1pm ;;
6833                 *l) dflt=l;;
6834                 *n) dflt=n;;
6835                 *o) dflt=o;;
6836                 *p) dflt=p;;
6837                 *C) dflt=C;;
6838                 *L) dflt=L;;
6839                 *L1) dflt=L1;;
6840                 *) dflt=1;;
6841                 esac
6842                 ;;
6843         *)      dflt="$man1ext";;
6844         esac
6845         . ./myread
6846         man1ext="$ans"
6847         ;;
6848 esac
6849
6850 : see if we can have long filenames
6851 echo " "
6852 first=123456789abcdef
6853 $rm -f $first
6854 if (echo hi >$first) 2>/dev/null; then
6855         if $test -f 123456789abcde; then
6856                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
6857                 val="$undef"
6858         else
6859                 echo 'You can have filenames longer than 14 characters.'>&4
6860                 val="$define"
6861         fi
6862 else
6863         $cat <<'EOM'
6864 You can't have filenames longer than 14 chars.
6865 You can't even think about them!
6866 EOM
6867         val="$undef"
6868 fi 
6869 set d_flexfnam
6870 eval $setvar
6871 $rm -rf 123456789abcde*
6872
6873 : determine where library module manual pages go
6874 set man3dir man3dir none
6875 eval $prefixit
6876 $cat <<EOM
6877
6878 $spackage has manual pages for many of the library modules.
6879 EOM
6880
6881 case "$nroff" in
6882 nroff)
6883         $cat <<'EOM'
6884 However, you don't have nroff, so they're probably useless to you.
6885 EOM
6886         case "$man3dir" in
6887         '') man3dir="none";;
6888         esac;;
6889 esac
6890
6891 case "$d_flexfnam" in
6892 undef)
6893         $cat <<'EOM'
6894 However, your system can't handle the long file names like File::Basename.3. 
6895 EOM
6896         case "$man3dir" in
6897         '') man3dir="none";;
6898         esac;;
6899 esac
6900
6901 echo "If you don't want the manual sources installed, answer 'none'."
6902 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6903 case "$man3dir" in
6904 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
6905         if $test -d "$privlib/man/man3"; then
6906                 cat <<EOM >&4
6907
6908 WARNING:  Previous versions of perl installed man3 pages into
6909 $privlib/man/man3.  This version will suggest a 
6910 new default of $dflt.  
6911 EOM
6912                 tdflt=$dflt
6913                 dflt='n'
6914                 rp='Do you wish to preserve the old behavior?(y/n)'
6915                 . ./myread
6916                 case "$ans" in
6917                 y*) dflt="$privlib/man/man3" ;;
6918                 *)  dflt=$tdflt ;;
6919                 esac
6920     fi
6921         ;;
6922 *)      dflt="$man3dir" ;;
6923 esac
6924 case "$dflt" in
6925 ' ') dflt=none ;;
6926 esac
6927 echo " "
6928 fn=dn+~
6929 rp="Where do the $package library man pages (source) go?"
6930 . ./getfile
6931 man3dir="$ans"
6932 man3direxp="$ansexp"
6933 case "$man3dir" in
6934 '')     man3dir=' '
6935         installman3dir='';;
6936 esac
6937
6938 : Change installation prefix, if necessary.
6939 if $test X"$prefix" != X"$installprefix"; then
6940         installman3dir=`echo $man3direxp | $sed "s#^$prefix#$installprefix#"`
6941 else
6942         installman3dir="$man3direxp"
6943 fi
6944
6945 : What suffix to use on installed man pages
6946 case "$man3dir" in
6947 ' ')
6948         man3ext='0'
6949         ;;
6950 *)
6951         rp="What suffix should be used for the $package library man pages?"
6952         case "$man3ext" in
6953         '')     case "$man3dir" in
6954                 *3)  dflt=3 ;;
6955                 *3p) dflt=3p ;;
6956                 *3pm) dflt=3pm ;;
6957                 *l) dflt=l;;
6958                 *n) dflt=n;;
6959                 *o) dflt=o;;
6960                 *p) dflt=p;;
6961                 *C) dflt=C;;
6962                 *L) dflt=L;;
6963                 *L3) dflt=L3;;
6964                 *) dflt=3;;
6965                 esac
6966                 ;;
6967         *)      dflt="$man3ext";;
6968         esac
6969         . ./myread
6970         man3ext="$ans"
6971         ;;
6972 esac
6973
6974 : see if we have to deal with yellow pages, now NIS.
6975 if $test -d /usr/etc/yp || $test -d /etc/yp; then
6976         if $test -f /usr/etc/nibindd; then
6977                 echo " "
6978                 echo "I'm fairly confident you're on a NeXT."
6979                 echo " "
6980                 rp='Do you get the hosts file via NetInfo?'
6981                 dflt=y
6982                 case "$hostcat" in
6983                 nidump*) ;;
6984                 '') ;;
6985                 *) dflt=n;;
6986                 esac
6987                 . ./myread
6988                 case "$ans" in
6989                 y*) hostcat='nidump hosts .';;
6990                 *)      case "$hostcat" in
6991                         nidump*) hostcat='';;
6992                         esac
6993                         ;;
6994                 esac
6995         fi
6996         case "$hostcat" in
6997         nidump*) ;;
6998         *)
6999                 case "$hostcat" in
7000                 *ypcat*) dflt=y;;
7001                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
7002                                 dflt=y
7003                         else
7004                                 dflt=n
7005                         fi;;
7006                 *) dflt=n;;
7007                 esac
7008                 echo " "
7009                 rp='Are you getting the hosts file via yellow pages?'
7010                 . ./myread
7011                 case "$ans" in
7012                 y*) hostcat='ypcat hosts';;
7013                 *) hostcat='cat /etc/hosts';;
7014                 esac
7015                 ;;
7016         esac
7017 fi
7018 case "$hostcat" in
7019 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
7020 esac
7021 case "$groupcat" in
7022 '') test -f /etc/group && groupcat='cat /etc/group';;
7023 esac
7024 case "$passcat" in
7025 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
7026 esac
7027
7028 : now get the host name
7029 echo " "
7030 echo "Figuring out host name..." >&4
7031 case "$myhostname" in
7032 '') cont=true
7033         echo 'Maybe "hostname" will work...'
7034         if tans=`sh -c hostname 2>&1` ; then
7035                 myhostname=$tans
7036                 phostname=hostname
7037                 cont=''
7038         fi
7039         ;;
7040 *) cont='';;
7041 esac
7042 if $test "$cont"; then
7043         if ./xenix; then
7044                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
7045                 if tans=`cat /etc/systemid 2>&1` ; then
7046                         myhostname=$tans
7047                         phostname='cat /etc/systemid'
7048                         echo "Whadyaknow.  Xenix always was a bit strange..."
7049                         cont=''
7050                 fi
7051         elif $test -r /etc/systemid; then
7052                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
7053         fi
7054 fi
7055 if $test "$cont"; then
7056         echo 'No, maybe "uuname -l" will work...'
7057         if tans=`sh -c 'uuname -l' 2>&1` ; then
7058                 myhostname=$tans
7059                 phostname='uuname -l'
7060         else
7061                 echo 'Strange.  Maybe "uname -n" will work...'
7062                 if tans=`sh -c 'uname -n' 2>&1` ; then
7063                         myhostname=$tans
7064                         phostname='uname -n'
7065                 else
7066                         echo 'Oh well, maybe I can mine it out of whoami.h...'
7067                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
7068                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
7069                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
7070                         else
7071                                 case "$myhostname" in
7072                                 '') echo "Does this machine have an identity crisis or something?"
7073                                         phostname='';;
7074                                 *)
7075                                         echo "Well, you said $myhostname before..."
7076                                         phostname='echo $myhostname';;
7077                                 esac
7078                         fi
7079                 fi
7080         fi
7081 fi
7082 : you do not want to know about this
7083 set $myhostname
7084 myhostname=$1
7085
7086 : verify guess
7087 if $test "$myhostname" ; then
7088         dflt=y
7089         rp='Your host name appears to be "'$myhostname'".'" Right?"
7090         . ./myread
7091         case "$ans" in
7092         y*) ;;
7093         *) myhostname='';;
7094         esac
7095 fi
7096
7097 : bad guess or no guess
7098 while $test "X$myhostname" = X ; do
7099         dflt=''
7100         rp="Please type the (one word) name of your host:"
7101         . ./myread
7102         myhostname="$ans"
7103 done
7104
7105 : translate upper to lower if necessary
7106 case "$myhostname" in
7107 *[A-Z]*)
7108         echo "(Normalizing case in your host name)"
7109         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
7110         ;;
7111 esac
7112
7113 case "$myhostname" in
7114 *.*)
7115         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
7116         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
7117         echo "(Trimming domain name from host name--host name is now $myhostname)"
7118         ;;
7119 *) case "$mydomain" in
7120         '')
7121                 {
7122                         test "X$hostcat" = "Xypcat hosts" &&
7123                         ypmatch "$myhostname" hosts 2>/dev/null |\
7124                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
7125                         $test -s hosts
7126                 } || {
7127                         test "X$hostcat" != "X" &&
7128                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
7129                                         /[       ]$myhostname[  . ]/p" > hosts
7130                 }
7131                 tmp_re="[       . ]"
7132                 if $test -f hosts; then
7133                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
7134                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
7135                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
7136                                 hosts | $sort | $uniq | \
7137                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
7138                         case `$echo X$dflt` in
7139                         X*\ *)  echo "(Several hosts in the database matched hostname)"
7140                                 dflt=.
7141                                 ;;
7142                         X.) echo "(You do not have fully-qualified names in the hosts database)"
7143                                 ;;
7144                         esac
7145                 else
7146                         echo "(I cannot locate a hosts database anywhere)"
7147                         dflt=.
7148                 fi
7149                 case "$dflt" in
7150                 .)
7151                         tans=`./loc resolv.conf X /etc /usr/etc`
7152                         if $test -f "$tans"; then
7153                                 echo "(Attempting domain name extraction from $tans)"
7154                                 dflt=.`$sed -n -e 's/   / /g' \
7155                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
7156                                   | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
7157                                 case "$dflt" in
7158                                 .) dflt=.`$sed -n -e 's/        / /g' \
7159                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
7160                                      | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
7161                                         ;;
7162                                 esac
7163                         fi
7164                         ;;
7165                 esac
7166                 case "$dflt" in
7167                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
7168                         dflt=.`sh -c domainname 2>/dev/null`
7169                         case "$dflt" in
7170                         '') dflt='.';;
7171                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
7172                         esac
7173                         ;;
7174                 esac
7175                 case "$dflt" in
7176                 .) echo "(Lost all hope -- silly guess then)"
7177                         dflt='.uucp'
7178                         ;;
7179                 esac
7180                 $rm -f hosts
7181                 ;;
7182         *) dflt="$mydomain";;
7183         esac;;
7184 esac
7185 echo " "
7186 rp="What is your domain name?"
7187 . ./myread
7188 tans="$ans"
7189 case "$ans" in
7190 '') ;;
7191 .*) ;;
7192 *) tans=".$tans";;
7193 esac
7194 mydomain="$tans"
7195
7196 : translate upper to lower if necessary
7197 case "$mydomain" in
7198 *[A-Z]*)
7199         echo "(Normalizing case in your domain name)"
7200         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
7201         ;;
7202 esac
7203
7204 : a little sanity check here
7205 case "$phostname" in
7206 '') ;;
7207 *)
7208         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
7209         $myhostname$mydomain|$myhostname) ;;
7210         *)
7211                 case "$phostname" in
7212                 sed*)
7213                         echo "(That doesn't agree with your whoami.h file, by the way.)"
7214                         ;;
7215                 *)
7216                         echo "(That doesn't agree with your $phostname command, by the way.)"
7217                         ;;
7218                 esac
7219         ;;
7220         esac
7221         ;;
7222 esac
7223
7224 $cat <<EOM
7225
7226 I need to get your e-mail address in Internet format if possible, i.e.
7227 something like user@host.domain. Please answer accurately since I have
7228 no easy means to double check it. The default value provided below
7229 is most probably close to reality but may not be valid from outside
7230 your organization...
7231
7232 EOM
7233 cont=x
7234 while test "$cont"; do
7235         case "$cf_email" in
7236         '') dflt="$cf_by@$myhostname$mydomain";;
7237         *) dflt="$cf_email";;
7238         esac
7239         rp='What is your e-mail address?'
7240         . ./myread
7241         cf_email="$ans"
7242         case "$cf_email" in
7243         *@*.*) cont='' ;;
7244         *)
7245                 rp='Address does not look like an Internet one.  Use it anyway?'
7246                 case "$fastread" in
7247                 yes) dflt=y ;;
7248                 *) dflt=n ;;
7249                 esac
7250                 . ./myread
7251                 case "$ans" in
7252                 y*) cont='' ;;
7253                 *) echo " " ;;
7254                 esac
7255                 ;;
7256         esac
7257 done
7258
7259 $cat <<EOM
7260
7261 If you or somebody else will be maintaining perl at your site, please
7262 fill in the correct e-mail address here so that they may be contacted
7263 if necessary. Currently, the "perlbug" program included with perl
7264 will send mail to this address in addition to perlbug@perl.org. You may
7265 enter "none" for no administrator.
7266
7267 EOM
7268 case "$perladmin" in
7269 '') dflt="$cf_email";;
7270 *) dflt="$perladmin";;
7271 esac
7272 rp='Perl administrator e-mail address'
7273 . ./myread
7274 perladmin="$ans"
7275
7276 : determine whether to only install version-specific parts.
7277 echo " "
7278 $cat <<EOM
7279 Do you want to install only the version-specific parts of the perl
7280 distribution?  Usually you do *not* want to do this.
7281 EOM
7282 case "$versiononly" in
7283 "$define"|[Yy]*|true) dflt='y' ;;
7284 *) dflt='n';
7285 esac
7286 rp="Do you want to install only the version-specific parts of perl?"
7287 . ./myread
7288 case "$ans" in
7289 [yY]*)  val="$define";;
7290 *)      val="$undef" ;;
7291 esac
7292 set versiononly
7293 eval $setvar
7294
7295 : figure out how to guarantee perl startup
7296 case "$startperl" in
7297 '')
7298         case "$sharpbang" in
7299         *!)
7300                 $cat <<EOH
7301
7302 I can use the #! construct to start perl on your system. This will
7303 make startup of perl scripts faster, but may cause problems if you
7304 want to share those scripts and perl is not in a standard place
7305 ($binexp/perl) on all your platforms. The alternative is to force
7306 a shell by starting the script with a single ':' character.
7307
7308 EOH
7309                 case "$versiononly" in
7310                 "$define")      dflt="$binexp/perl$version";;  
7311                 *)              dflt="$binexp/perl";;
7312                 esac
7313                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
7314                 . ./myread
7315                 case "$ans" in
7316                 none)   startperl=": # use perl";;
7317                 *)      startperl="#!$ans"
7318                         if $test 30 -lt `echo "$ans" | wc -c`; then
7319                                 $cat >&4 <<EOM
7320
7321 WARNING:  Some systems limit the #! command to 32 characters.
7322 If you experience difficulty running Perl scripts with #!, try
7323 installing Perl in a directory with a shorter pathname.
7324
7325 EOM
7326                         fi ;;
7327                 esac
7328                 ;;
7329         *) startperl=": # use perl"
7330                 ;;
7331         esac
7332         ;;
7333 esac
7334 echo "I'll use $startperl to start perl scripts."
7335
7336 : figure best path for perl in scripts
7337 case "$perlpath" in
7338 '')
7339         perlpath="$binexp/perl"
7340         case "$startperl" in
7341         *!*) ;;
7342         *)
7343                 $cat <<EOH
7344
7345 I will use the "eval 'exec'" idiom to start Perl on your system.
7346 I can use the full path of your Perl binary for this purpose, but
7347 doing so may cause problems if you want to share those scripts and
7348 Perl is not always in a standard place ($binexp/perl).
7349
7350 EOH
7351                 dflt="$binexp/perl"
7352                 rp="What path shall I use in \"eval 'exec'\"?"
7353                 . ./myread
7354                 perlpath="$ans"
7355                 ;;
7356         esac
7357         ;;
7358 esac
7359 case "$startperl" in
7360 *!*)    ;;
7361 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
7362 esac
7363
7364 : determine where public executable scripts go
7365 set scriptdir scriptdir
7366 eval $prefixit
7367 case "$scriptdir" in
7368 '')
7369         dflt="$bin"
7370         : guess some guesses
7371         $test -d /usr/share/scripts && dflt=/usr/share/scripts
7372         $test -d /usr/share/bin     && dflt=/usr/share/bin
7373         $test -d /usr/local/script  && dflt=/usr/local/script
7374         $test -d /usr/local/scripts && dflt=/usr/local/scripts
7375         $test -d $prefixexp/script  && dflt=$prefixexp/script
7376         set dflt
7377         eval $prefixup
7378         ;;
7379 *)  dflt="$scriptdir"
7380         ;;
7381 esac
7382 $cat <<EOM
7383  
7384 Some installations have a separate directory just for executable scripts so
7385 that they can mount it across multiple architectures but keep the scripts in
7386 one spot.  You might, for example, have a subdirectory of /usr/share for this.
7387 Or you might just lump your scripts in with all your other executables.
7388  
7389 EOM
7390 fn=d~
7391 rp='Where do you keep publicly executable scripts?'
7392 . ./getfile
7393 if $test "X$ansexp" != "X$scriptdirexp"; then
7394         installscript=''
7395 fi
7396 scriptdir="$ans"
7397 scriptdirexp="$ansexp"
7398 : Change installation prefix, if necessary.
7399 if $test X"$prefix" != X"$installprefix"; then
7400         installscript=`echo $scriptdirexp | sed "s#^$prefix#$installprefix#"`
7401 else
7402         installscript="$scriptdirexp"
7403 fi
7404
7405 : determine where add-on public executables go
7406 case "$sitebin" in
7407 '')     dflt=$siteprefix/bin ;;
7408 *)      dflt=$sitebin ;;
7409 esac
7410 fn=d~
7411 rp='Pathname where the add-on public executables should be installed?'
7412 . ./getfile
7413 sitebin="$ans"
7414 sitebinexp="$ansexp"
7415 : Change installation prefix, if necessary.
7416 if $test X"$prefix" != X"$installprefix"; then
7417         installsitebin=`echo $sitebinexp | sed "s#^$prefix#$installprefix#"`
7418 else
7419         installsitebin="$sitebinexp"
7420 fi
7421
7422 case "$useperlio" in
7423 $define|true|[yY]*)     dflt='y';;
7424 *) dflt='n';;
7425 esac
7426 cat <<EOM
7427
7428 Previous version of $package used the standard IO mechanisms as defined
7429 in <stdio.h>.  Versions 5.003_02 and later of perl allow alternate IO
7430 mechanisms via a "PerlIO" abstraction, but the stdio mechanism is still
7431 the default.  This abstraction layer can use AT&T's sfio (if you already
7432 have sfio installed) or regular stdio.  Using PerlIO with sfio may cause
7433 problems with some extension modules.  Using PerlIO with stdio is safe,
7434 but it is slower than plain stdio and therefore is not the default.
7435
7436 If this doesn't make any sense to you, just accept the default '$dflt'.
7437 EOM
7438 rp='Use the experimental PerlIO abstraction layer?'
7439 . ./myread
7440 case "$ans" in
7441 y|Y) 
7442         val="$define"
7443         ;;     
7444 *)      
7445         echo "Ok, doing things the stdio way"
7446         val="$undef"
7447         ;;
7448 esac
7449 set useperlio
7450 eval $setvar 
7451
7452 case "$vendorprefix" in
7453 '')     d_vendorbin="$undef"
7454         vendorbin=''
7455         vendorbinexp=''
7456         ;;
7457 *)      d_vendorbin="$define"
7458         : determine where vendor-supplied executables go.
7459         case "$vendorbin" in
7460         '') dflt=$vendorprefix/bin ;;
7461         *)      dflt="$vendorbin" ;;
7462         esac
7463         fn=d~+
7464         rp='Pathname for the vendor-supplied executables directory?'
7465         . ./getfile
7466         vendorbin="$ans"
7467         vendorbinexp="$ansexp"
7468         ;;
7469 esac
7470 : Change installation prefix, if necessary.
7471 if $test X"$prefix" != X"$installprefix"; then
7472         installvendorbin=`echo $vendorbinexp | $sed "s#^$prefix#$installprefix#"`
7473 else
7474         installvendorbin="$vendorbinexp"
7475 fi
7476
7477 : see if qgcvt exists
7478 set qgcvt d_qgcvt
7479 eval $inlibc
7480
7481 echo " "
7482
7483 if $test X"$d_longdbl" = X"$define"; then
7484
7485 echo "Checking how to print long doubles..." >&4
7486
7487 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
7488         $cat >try.c <<'EOCP'
7489 #include <sys/types.h>
7490 #include <stdio.h>
7491 int main() {
7492   double d = 123.456;
7493   printf("%.3f\n", d);
7494 }
7495 EOCP
7496         set try
7497         if eval $compile; then
7498                 yyy=`./try$exe_ext`
7499                 case "$yyy" in
7500                 123.456)
7501                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
7502                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
7503                         echo "We will use %f."
7504                         ;;
7505                 esac
7506         fi
7507 fi
7508
7509 if $test X"$sPRIfldbl" = X; then
7510         $cat >try.c <<'EOCP'
7511 #include <sys/types.h>
7512 #include <stdio.h>
7513 int main() {
7514   long double d = 123.456;
7515   printf("%.3llf\n", d);
7516 }
7517 EOCP
7518         set try
7519         if eval $compile; then
7520                 yyy=`./try$exe_ext`
7521                 case "$yyy" in
7522                 123.456)
7523                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
7524                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
7525                         echo "We will use %llf."
7526                         ;;
7527                 esac
7528         fi
7529 fi
7530
7531 if $test X"$sPRIfldbl" = X; then
7532         $cat >try.c <<'EOCP'
7533 #include <sys/types.h>
7534 #include <stdio.h>
7535 int main() {
7536   long double d = 123.456;
7537   printf("%.3Lf\n", d);
7538 }
7539 EOCP
7540         set try
7541         if eval $compile; then
7542                 yyy=`./try$exe_ext`
7543                 case "$yyy" in
7544                 123.456)
7545                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
7546                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
7547                         echo "We will use %Lf."
7548                         ;;
7549                 esac
7550         fi
7551 fi
7552
7553 if $test X"$sPRIfldbl" = X; then
7554         $cat >try.c <<'EOCP'
7555 #include <sys/types.h>
7556 #include <stdio.h>
7557 int main() {
7558   long double d = 123.456;
7559   printf("%.3lf\n", d);
7560 }
7561 EOCP
7562         set try
7563         if eval $compile; then
7564                 yyy=`./try$exe_ext`
7565                 case "$yyy" in
7566                 123.456)
7567                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
7568                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
7569                         echo "We will use %lf."
7570                         ;;
7571                 esac
7572         fi
7573 fi
7574
7575 if $test X"$sPRIfldbl" = X; then
7576         echo "Cannot figure out how to print long doubles." >&4
7577 else
7578         sSCNfldbl=$sPRIfldbl    # expect consistency
7579 fi
7580
7581 $rm -f try try.*
7582
7583 fi # d_longdbl
7584
7585 case "$sPRIfldbl" in
7586 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef"; 
7587         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef"; 
7588         d_SCNfldbl="$undef";
7589         ;;
7590 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define"; 
7591         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define"; 
7592         d_SCNfldbl="$define";
7593         ;;
7594 esac
7595
7596 : Check how to convert floats to strings.
7597 echo " "
7598 echo "Checking for an efficient way to convert floats to strings."
7599 echo " " > try.c
7600 case "$uselongdouble" in
7601 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
7602 esac
7603 case "$d_longdbl" in
7604 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
7605 esac
7606 case "$d_PRIgldbl" in
7607 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
7608 esac
7609 $cat >>try.c <<EOP
7610 #ifdef TRY_gconvert
7611 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
7612 char *myname = "gconvert";
7613 #endif
7614 #ifdef TRY_gcvt
7615 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
7616 char *myname = "gcvt";
7617 #endif
7618 #ifdef TRY_qgcvt
7619 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
7620 char *myname = "qgcvt";
7621 #define DOUBLETYPE long double
7622 #endif
7623 #ifdef TRY_sprintf
7624 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE) && defined(HAS_PRIgldbl)
7625 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
7626 #else
7627 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
7628 #endif
7629 char *myname = "sprintf";
7630 #endif
7631
7632 #ifndef DOUBLETYPE
7633 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
7634 #define DOUBLETYPE long double
7635 #else
7636 #define DOUBLETYPE double
7637 #endif
7638 #endif
7639
7640 #include <stdio.h>
7641
7642 #define I_STDLIB $i_stdlib
7643 #ifdef I_STDLIB
7644 #include <stdlib.h>
7645 #endif
7646
7647 int
7648 checkit(expect, got)
7649 char *expect;
7650 char *got;
7651 {
7652     if (strcmp(expect, got)) {
7653                 printf("%s oddity:  Expected %s, got %s\n",
7654                         myname, expect, got);
7655                 exit(1);
7656         }
7657 }
7658
7659 int main()
7660
7661         char buf[64]; 
7662         buf[63] = '\0';
7663
7664         /* This must be 1st test on (which?) platform */
7665         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
7666         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
7667         checkit("0.1", buf);
7668
7669         Gconvert((DOUBLETYPE)1.0, 8, 0, buf); 
7670         checkit("1", buf);
7671
7672         Gconvert((DOUBLETYPE)1.1, 8, 0, buf); 
7673         checkit("1.1", buf);
7674
7675         Gconvert((DOUBLETYPE)1.01, 8, 0, buf); 
7676         checkit("1.01", buf);
7677
7678         Gconvert((DOUBLETYPE)1.001, 8, 0, buf); 
7679         checkit("1.001", buf);
7680
7681         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf); 
7682         checkit("1.0001", buf);
7683
7684         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf); 
7685         checkit("1.00001", buf);
7686
7687         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf); 
7688         checkit("1.000001", buf);
7689
7690         Gconvert((DOUBLETYPE)0.0, 8, 0, buf); 
7691         checkit("0", buf);
7692
7693         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf); 
7694         checkit("-1", buf);
7695
7696         /* Some Linux gcvt's give 1.e+5 here. */
7697         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf); 
7698         checkit("100000", buf);
7699         
7700         /* Some Linux gcvt's give -1.e+5 here. */
7701         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf); 
7702         checkit("-100000", buf);
7703
7704         Gconvert((DOUBLETYPE)123.456, 8, 0, buf); 
7705         checkit("123.456", buf);
7706
7707         exit(0);
7708 }
7709 EOP
7710 case "$d_Gconvert" in
7711 gconvert*) xxx_list='gconvert gcvt sprintf' ;;
7712 gcvt*) xxx_list='gcvt gconvert sprintf' ;;
7713 sprintf*) xxx_list='sprintf gconvert gcvt' ;;
7714 *) xxx_list='gconvert gcvt sprintf' ;;
7715 esac
7716
7717 case "$d_longdbl$uselongdouble$d_PRIgldbl" in
7718 "$define$define$define")
7719     # for long doubles prefer first qgcvt, then sprintf
7720     xxx_list="`echo $xxx_list|sed s/sprintf//`" 
7721     xxx_list="sprintf $xxx_list"
7722     case "$d_qgcvt" in
7723     "$define") xxx_list="qgcvt $xxx_list" ;;
7724     esac
7725     ;;
7726 esac
7727
7728 for xxx_convert in $xxx_list; do
7729         echo "Trying $xxx_convert..."
7730         $rm -f try try$_o
7731         set try -DTRY_$xxx_convert
7732         if eval $compile; then
7733                 echo "$xxx_convert() found." >&4
7734                 if ./try; then
7735                         echo "I'll use $xxx_convert to convert floats into a string." >&4
7736                         break;
7737                 else
7738                         echo "...But $xxx_convert didn't work as I expected."
7739                 fi
7740         else
7741                 echo "$xxx_convert NOT found." >&4
7742         fi
7743 done
7744         
7745 case "$xxx_convert" in
7746 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
7747 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
7748 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
7749 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
7750    "$define$define$define")
7751       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
7752    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
7753    esac
7754    ;;  
7755 esac
7756
7757 : Initialize h_fcntl
7758 h_fcntl=false
7759
7760 : Initialize h_sysfile
7761 h_sysfile=false
7762
7763 : access call always available on UNIX
7764 set access d_access
7765 eval $inlibc
7766
7767 : locate the flags for 'access()'
7768 case "$d_access" in
7769 "$define")
7770         echo " "
7771         $cat >access.c <<'EOCP'
7772 #include <sys/types.h>
7773 #ifdef I_FCNTL
7774 #include <fcntl.h>
7775 #endif
7776 #ifdef I_SYS_FILE
7777 #include <sys/file.h>
7778 #endif
7779 #ifdef I_UNISTD
7780 #include <unistd.h>
7781 #endif
7782 int main() {
7783         exit(R_OK);
7784 }
7785 EOCP
7786         : check sys/file.h first, no particular reason here
7787         if $test `./findhdr sys/file.h` && \
7788                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
7789                 h_sysfile=true;
7790                 echo "<sys/file.h> defines the *_OK access constants." >&4
7791         elif $test `./findhdr fcntl.h` && \
7792                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
7793                 h_fcntl=true;
7794                 echo "<fcntl.h> defines the *_OK access constants." >&4
7795         elif $test `./findhdr unistd.h` && \
7796                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
7797                 echo "<unistd.h> defines the *_OK access constants." >&4
7798         else
7799                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
7800         fi
7801         ;;
7802 esac
7803 $rm -f access*
7804
7805 : see if accessx exists
7806 set accessx d_accessx
7807 eval $inlibc
7808
7809 : see if alarm exists
7810 set alarm d_alarm
7811 eval $inlibc
7812
7813 : see if atolf exists
7814 set atolf d_atolf
7815 eval $inlibc
7816
7817 : see if atoll exists
7818 set atoll d_atoll
7819 eval $inlibc
7820
7821 : Look for GNU-cc style attribute checking
7822 echo " "
7823 echo "Checking whether your compiler can handle __attribute__ ..." >&4
7824 $cat >attrib.c <<'EOCP'
7825 #include <stdio.h>
7826 void croak (char* pat,...) __attribute__((format(printf,1,2),noreturn));
7827 EOCP
7828 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
7829         if $contains 'warning' attrib.out >/dev/null 2>&1; then
7830                 echo "Your C compiler doesn't fully support __attribute__."
7831                 val="$undef"
7832         else
7833                 echo "Your C compiler supports __attribute__."
7834                 val="$define"
7835         fi
7836 else
7837         echo "Your C compiler doesn't seem to understand __attribute__ at all."
7838         val="$undef"
7839 fi
7840 set d_attribut
7841 eval $setvar
7842 $rm -f attrib*
7843
7844 : see if bcmp exists
7845 set bcmp d_bcmp
7846 eval $inlibc
7847
7848 : see if bcopy exists
7849 set bcopy d_bcopy
7850 eval $inlibc
7851
7852 : see if this is a unistd.h system
7853 set unistd.h i_unistd
7854 eval $inhdr
7855
7856 : see if getpgrp exists
7857 set getpgrp d_getpgrp
7858 eval $inlibc
7859
7860 case "$d_getpgrp" in
7861 "$define")
7862         echo " "
7863         echo "Checking to see which flavor of getpgrp is in use..."
7864         $cat >set.c <<EOP
7865 #$i_unistd I_UNISTD
7866 #include <sys/types.h>
7867 #ifdef I_UNISTD
7868 #  include <unistd.h>
7869 #endif
7870 int main()
7871 {
7872         if (getuid() == 0) {
7873                 printf("(I see you are running Configure as super-user...)\n");
7874                 setuid(1);
7875         }
7876 #ifdef TRY_BSD_PGRP
7877         if (getpgrp(1) == 0)
7878                 exit(0);
7879 #else
7880         if (getpgrp() > 0)
7881                 exit(0);
7882 #endif
7883         exit(1);
7884 }
7885 EOP
7886         if $cc -o set -DTRY_BSD_PGRP $ccflags $ldflags set.c $libs >/dev/null 2>&1 && ./set; then
7887                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
7888                 val="$define"
7889         elif $cc -o set $ccflags $ldflags set.c $libs >/dev/null 2>&1 && ./set; then
7890                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
7891                 val="$undef"
7892         else
7893                 echo "I can't seem to compile and run the test program."
7894                 if ./usg; then
7895                         xxx="a USG one, i.e. you use getpgrp()."
7896                 else
7897                         # SVR4 systems can appear rather BSD-ish.
7898                         case "$i_unistd" in
7899                         $undef)
7900                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
7901                                 val="$define"
7902                                 ;;
7903                         $define)
7904                                 xxx="probably a USG one, i.e. you use getpgrp()."
7905                                 val="$undef"
7906                                 ;;
7907                         esac
7908                 fi
7909                 echo "Assuming your getpgrp is $xxx" >&4
7910         fi
7911         ;;
7912 *) val="$undef";;
7913 esac
7914 set d_bsdgetpgrp
7915 eval $setvar
7916 $rm -f set set.c
7917
7918 : see if setpgrp exists
7919 set setpgrp d_setpgrp
7920 eval $inlibc
7921
7922 case "$d_setpgrp" in
7923 "$define")
7924         echo " "
7925         echo "Checking to see which flavor of setpgrp is in use..."
7926         $cat >set.c <<EOP
7927 #$i_unistd I_UNISTD
7928 #include <sys/types.h>
7929 #ifdef I_UNISTD
7930 #  include <unistd.h>
7931 #endif
7932 int main()
7933 {
7934         if (getuid() == 0) {
7935                 printf("(I see you are running Configure as super-user...)\n");
7936                 setuid(1);
7937         }
7938 #ifdef TRY_BSD_PGRP
7939         if (-1 == setpgrp(1, 1))
7940                 exit(0);
7941 #else
7942         if (setpgrp() != -1)
7943                 exit(0);
7944 #endif
7945         exit(1);
7946 }
7947 EOP
7948         if $cc -o set -DTRY_BSD_PGRP $ccflags $ldflags set.c $libs >/dev/null 2>&1 && ./set; then
7949                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
7950                 val="$define"
7951         elif $cc -o set $ccflags $ldflags set.c $libs >/dev/null 2>&1 && ./set; then
7952                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
7953                 val="$undef"
7954         else
7955                 echo "(I can't seem to compile and run the test program.)"
7956                 if ./usg; then
7957                         xxx="a USG one, i.e. you use setpgrp()."
7958                 else
7959                         # SVR4 systems can appear rather BSD-ish.
7960                         case "$i_unistd" in
7961                         $undef)
7962                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
7963                                 val="$define"
7964                                 ;;
7965                         $define)
7966                                 xxx="probably a USG one, i.e. you use setpgrp()."
7967                                 val="$undef"
7968                                 ;;
7969                         esac
7970                 fi
7971                 echo "Assuming your setpgrp is $xxx" >&4
7972         fi
7973         ;;
7974 *) val="$undef";;
7975 esac
7976 set d_bsdsetpgrp
7977 eval $setvar
7978 $rm -f set set.c
7979 : see if bzero exists
7980 set bzero d_bzero
7981 eval $inlibc
7982
7983 : see if signal is declared as pointer to function returning int or void
7984 echo " "
7985 xxx=`./findhdr signal.h`
7986 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
7987 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
7988         echo "You have int (*signal())() instead of void." >&4
7989         val="$undef"
7990 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
7991         echo "You have void (*signal())()." >&4
7992         val="$define"
7993 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
7994         echo "You have int (*signal())() instead of void." >&4
7995         val="$undef"
7996 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
7997         echo "You have void (*signal())()." >&4
7998         val="$define"
7999 else
8000         case "$d_voidsig" in
8001         '')
8002         echo "I can't determine whether signal handler returns void or int..." >&4
8003                 dflt=void
8004                 rp="What type does your signal handler return?"
8005                 . ./myread
8006                 case "$ans" in
8007                 v*) val="$define";;
8008                 *) val="$undef";;
8009                 esac;;
8010         "$define")
8011                 echo "As you already told me, signal handler returns void." >&4
8012                 val="$define"
8013                 ;;
8014         *)      echo "As you already told me, signal handler returns int." >&4
8015                 val="$undef"
8016                 ;;
8017         esac
8018 fi
8019 set d_voidsig
8020 eval $setvar
8021 case "$d_voidsig" in
8022 "$define") signal_t="void";;
8023 *) signal_t="int";;
8024 esac
8025 $rm -f $$.tmp
8026
8027 : check for ability to cast large floats to 32-bit ints.
8028 echo " "
8029 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
8030 if $test "$intsize" -ge 4; then
8031         xxx=int
8032 else
8033         xxx=long
8034 fi
8035 $cat >try.c <<EOCP
8036 #include <stdio.h>
8037 #include <sys/types.h>
8038 #include <signal.h>
8039 $signal_t blech(s) int s; { exit(3); }
8040 int main()
8041 {
8042         $xxx i32;
8043         double f, g;
8044         int result = 0;
8045         char str[16];
8046         signal(SIGFPE, blech);
8047
8048         /* Don't let compiler optimize the test away.  Store the number 
8049            in a writable string for gcc to pass to sscanf under HP/UX.
8050         */
8051         sprintf(str, "2147483647");
8052         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
8053         g = 10 * f;
8054         i32  = ($xxx) g;
8055
8056         /* x86 processors will probably give 0x8000 0000, which is a
8057        sign change.  We don't want that.  We want to mimic SPARC
8058            behavior here, which is to preserve the sign and give
8059            back 0x7fff ffff.
8060         */
8061         if (i32 != ($xxx) f)
8062                 result |= 1;
8063         exit(result);
8064 }
8065 EOCP
8066 set try
8067 if eval $compile_ok; then
8068         ./try
8069         yyy=$?
8070 else
8071         echo "(I can't seem to compile the test program--assuming it can't)"
8072         yyy=1
8073 fi
8074 case "$yyy" in
8075 0)      val="$define"
8076         echo "Yup, it can."
8077         ;;
8078 *)      val="$undef"
8079         echo "Nope, it can't."
8080         ;;
8081 esac
8082 set d_casti32
8083 eval $setvar
8084 $rm -f try try.*
8085
8086 : check for ability to cast negative floats to unsigned
8087 echo " "
8088 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
8089 $cat >try.c <<EOCP
8090 #include <stdio.h>
8091 #include <sys/types.h>
8092 #include <signal.h>
8093 $signal_t blech(s) int s; { exit(7); }
8094 $signal_t blech_in_list(s) int s; { exit(4); }
8095 unsigned long dummy_long(p) unsigned long p; { return p; }
8096 unsigned int dummy_int(p) unsigned int p; { return p; }
8097 unsigned short dummy_short(p) unsigned short p; { return p; }
8098 int main()
8099 {
8100         double f;
8101         unsigned long along;
8102         unsigned int aint;
8103         unsigned short ashort;
8104         int result = 0;
8105         char str[16];
8106         
8107         /* Frustrate gcc-2.7.2's optimizer which failed this test with
8108            a direct f = -123. assignment.  gcc-2.8.0 reportedly
8109            optimized the whole file away
8110         */
8111         /* Store the number in a writable string for gcc to pass to 
8112            sscanf under HP/UX.
8113         */
8114         sprintf(str, "-123");
8115         sscanf(str, "%lf", &f);  /* f = -123.; */
8116
8117         signal(SIGFPE, blech);
8118         along = (unsigned long)f;
8119         aint = (unsigned int)f;
8120         ashort = (unsigned short)f;
8121         if (along != (unsigned long)-123)
8122                 result |= 1;
8123         if (aint != (unsigned int)-123)
8124                 result |= 1;
8125         if (ashort != (unsigned short)-123)
8126                 result |= 1;
8127         sprintf(str, "1073741824.");
8128         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
8129         f = f + f;
8130         along = 0;
8131         along = (unsigned long)f;
8132         if (along != 0x80000000)
8133                 result |= 2;
8134         f -= 1.;
8135         along = 0;
8136         along = (unsigned long)f;
8137         if (along != 0x7fffffff)
8138                 result |= 1;
8139         f += 2.;
8140         along = 0;
8141         along = (unsigned long)f;
8142         if (along != 0x80000001)
8143                 result |= 2;
8144         if (result)
8145                 exit(result);
8146         signal(SIGFPE, blech_in_list);
8147         sprintf(str, "123.");
8148         sscanf(str, "%lf", &f);  /* f = 123.; */
8149         along = dummy_long((unsigned long)f);
8150         aint = dummy_int((unsigned int)f);
8151         ashort = dummy_short((unsigned short)f);
8152         if (along != (unsigned long)123)
8153                 result |= 4;
8154         if (aint != (unsigned int)123)
8155                 result |= 4;
8156         if (ashort != (unsigned short)123)
8157                 result |= 4;
8158         exit(result);
8159
8160 }
8161 EOCP
8162 set try
8163 if eval $compile_ok; then
8164         ./try
8165         castflags=$?
8166 else
8167         echo "(I can't seem to compile the test program--assuming it can't)"
8168         castflags=7
8169 fi
8170 case "$castflags" in
8171 0)      val="$define"
8172         echo "Yup, it can."
8173         ;;
8174 *)      val="$undef"
8175         echo "Nope, it can't."
8176         ;;
8177 esac
8178 set d_castneg
8179 eval $setvar
8180 $rm -f try.*
8181
8182 : see if vprintf exists
8183 echo " "
8184 if set vprintf val -f d_vprintf; eval $csym; $val; then
8185         echo 'vprintf() found.' >&4
8186         val="$define"
8187         $cat >vprintf.c <<'EOF'
8188 #include <varargs.h>
8189
8190 int main() { xxx("foo"); }
8191
8192 xxx(va_alist)
8193 va_dcl
8194 {
8195         va_list args;
8196         char buf[10];
8197
8198         va_start(args);
8199         exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
8200 }
8201 EOF
8202         set vprintf
8203         if eval $compile && ./vprintf; then
8204                 echo "Your vsprintf() returns (int)." >&4
8205                 val2="$undef"
8206         else
8207                 echo "Your vsprintf() returns (char*)." >&4
8208                 val2="$define"
8209         fi
8210 else
8211         echo 'vprintf() NOT found.' >&4
8212                 val="$undef"
8213                 val2="$undef"
8214 fi
8215 set d_vprintf
8216 eval $setvar
8217 val=$val2
8218 set d_charvspr
8219 eval $setvar
8220
8221 : see if chown exists
8222 set chown d_chown
8223 eval $inlibc
8224
8225 : see if chroot exists
8226 set chroot d_chroot
8227 eval $inlibc
8228
8229 : see if chsize exists
8230 set chsize d_chsize
8231 eval $inlibc
8232
8233 : check for const keyword
8234 echo " "
8235 echo 'Checking to see if your C compiler knows about "const"...' >&4
8236 $cat >const.c <<'EOCP'
8237 typedef struct spug { int drokk; } spug;
8238 int main()
8239 {
8240         const char *foo;
8241         const spug y;
8242 }
8243 EOCP
8244 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
8245         val="$define"
8246         echo "Yup, it does."
8247 else
8248         val="$undef"
8249         echo "Nope, it doesn't."
8250 fi
8251 set d_const
8252 eval $setvar
8253
8254 : see if crypt exists
8255 echo " "
8256 if set crypt val -f d_crypt; eval $csym; $val; then
8257         echo 'crypt() found.' >&4
8258         val="$define"
8259         cryptlib=''
8260 else
8261         cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
8262         if $test -z "$cryptlib"; then
8263                 cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
8264         else
8265                 cryptlib=-lcrypt
8266         fi
8267         if $test -z "$cryptlib"; then
8268                 cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
8269         else
8270                 cryptlib=-lcrypt
8271         fi
8272         if $test -z "$cryptlib"; then
8273                 cryptlib=`./loc libcrypt$_a "" $libpth`
8274         else
8275                 cryptlib=-lcrypt
8276         fi
8277         if $test -z "$cryptlib"; then
8278                 echo 'crypt() NOT found.' >&4
8279                 val="$undef"
8280         else
8281                 val="$define"
8282         fi
8283 fi
8284 set d_crypt
8285 eval $setvar
8286
8287 : get csh whereabouts
8288 case "$csh" in
8289 'csh') val="$undef" ;;
8290 *) val="$define" ;;
8291 esac
8292 set d_csh
8293 eval $setvar
8294 : Respect a hint or command line value for full_csh.
8295 case "$full_csh" in
8296 '') full_csh=$csh ;;
8297 esac
8298
8299 : see if cuserid exists
8300 set cuserid d_cuserid
8301 eval $inlibc
8302
8303 : see if this is a limits.h system
8304 set limits.h i_limits
8305 eval $inhdr
8306
8307 : see if this is a float.h system
8308 set float.h i_float
8309 eval $inhdr
8310
8311 : See if number of significant digits in a double precision number is known
8312 echo " "
8313 $cat >dbl_dig.c <<EOM
8314 #$i_limits I_LIMITS
8315 #$i_float I_FLOAT
8316 #ifdef I_LIMITS
8317 #include <limits.h>
8318 #endif
8319 #ifdef I_FLOAT
8320 #include <float.h>
8321 #endif
8322 #ifdef DBL_DIG
8323 printf("Contains DBL_DIG");
8324 #endif
8325 EOM
8326 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
8327 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
8328         echo "DBL_DIG found." >&4
8329         val="$define"
8330 else
8331         echo "DBL_DIG NOT found." >&4
8332         val="$undef"
8333 fi
8334 $rm -f dbl_dig.?
8335 set d_dbl_dig
8336 eval $setvar
8337
8338 : see if difftime exists
8339 set difftime d_difftime
8340 eval $inlibc
8341
8342 : see if this is a dirent system
8343 echo " "
8344 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
8345         val="$define"
8346         echo "<dirent.h> found." >&4
8347 else
8348         val="$undef"
8349         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
8350                 echo "<sys/dir.h> found." >&4
8351                 echo " "
8352         else
8353                 xinc=`./findhdr sys/ndir.h`
8354         fi
8355         echo "<dirent.h> NOT found." >&4
8356 fi
8357 set i_dirent
8358 eval $setvar
8359
8360 : Look for type of directory structure.
8361 echo " "
8362 $cppstdin $cppflags $cppminus < "$xinc" > try.c
8363
8364 case "$direntrytype" in
8365 ''|' ')
8366         case "$i_dirent" in
8367         $define) guess1='struct dirent' ;;
8368         *) guess1='struct direct'  ;;
8369         esac
8370         ;;
8371 *)      guess1="$direntrytype"
8372         ;;
8373 esac
8374
8375 case "$guess1" in
8376 'struct dirent') guess2='struct direct' ;;
8377 *) guess2='struct dirent' ;;
8378 esac
8379                 
8380 if $contains "$guess1" try.c >/dev/null 2>&1; then
8381         direntrytype="$guess1"
8382         echo "Your directory entries are $direntrytype." >&4
8383 elif $contains "$guess2" try.c >/dev/null 2>&1; then
8384         direntrytype="$guess2"
8385         echo "Your directory entries seem to be $direntrytype." >&4
8386 else
8387         echo "I don't recognize your system's directory entries." >&4
8388         rp="What type is used for directory entries on this system?"
8389         dflt="$guess1"
8390         . ./myread
8391         direntrytype="$ans"
8392 fi
8393 $rm -f try.c
8394
8395
8396 : see if the directory entry stores field length
8397 echo " "
8398 $cppstdin $cppflags $cppminus < "$xinc" > try.c
8399 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
8400         echo "Good, your directory entry keeps length information in d_namlen." >&4
8401         val="$define"
8402 else
8403         echo "Your directory entry does not know about the d_namlen field." >&4
8404         val="$undef"
8405 fi
8406 set d_dirnamlen
8407 eval $setvar
8408 $rm -f try.c
8409
8410 : see if dlerror exists
8411 xxx_runnm="$runnm"
8412 runnm=false
8413 set dlerror d_dlerror
8414 eval $inlibc
8415 runnm="$xxx_runnm"
8416
8417 : see if dlfcn is available
8418 set dlfcn.h i_dlfcn
8419 eval $inhdr
8420
8421 case "$usedl" in
8422 $define|y|true)
8423         $cat << EOM
8424
8425 On a few systems, the dynamically loaded modules that perl generates and uses
8426 will need a different extension than shared libs. The default will probably
8427 be appropriate.
8428
8429 EOM
8430         case "$dlext" in
8431         '')     dflt="$so" ;;
8432         *)      dflt="$dlext" ;;
8433         esac
8434         rp='What is the extension of dynamically loaded modules'
8435         . ./myread
8436         dlext="$ans"
8437         ;;
8438 *)
8439         dlext="none"
8440         ;;
8441 esac
8442
8443 : Check if dlsym need a leading underscore
8444 echo " "
8445 val="$undef"
8446
8447 case "$dlsrc" in
8448 dl_dlopen.xs)
8449         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
8450         $cat >dyna.c <<'EOM'
8451 fred () { }
8452 EOM
8453
8454 $cat >fred.c<<EOM
8455
8456 #include <stdio.h>
8457 #$i_dlfcn I_DLFCN
8458 #ifdef I_DLFCN
8459 #include <dlfcn.h>      /* the dynamic linker include file for Sunos/Solaris */
8460 #else
8461 #include <sys/types.h>
8462 #include <nlist.h>
8463 #include <link.h>
8464 #endif
8465
8466 extern int fred() ;
8467
8468 int main()
8469 {
8470     void * handle ;
8471     void * symbol ;
8472 #ifndef RTLD_LAZY
8473     int mode = 1 ;
8474 #else
8475     int mode = RTLD_LAZY ;
8476 #endif
8477     handle = dlopen("./dyna.$dlext", mode) ;
8478     if (handle == NULL) {
8479         printf ("1\n") ;
8480         fflush (stdout) ;
8481         exit(0);
8482     }
8483     symbol = dlsym(handle, "fred") ;
8484     if (symbol == NULL) {
8485         /* try putting a leading underscore */
8486         symbol = dlsym(handle, "_fred") ;
8487         if (symbol == NULL) {
8488             printf ("2\n") ;
8489             fflush (stdout) ;
8490             exit(0);
8491         }
8492         printf ("3\n") ;
8493     }
8494     else
8495         printf ("4\n") ;
8496     fflush (stdout) ;
8497     exit(0);
8498 }
8499 EOM
8500         : Call the object file tmp-dyna.o in case dlext=o.
8501         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 && 
8502                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 && 
8503                 $ld -o dyna.$dlext $lddlflags tmp-dyna${_o} > /dev/null 2>&1 && 
8504                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1; then
8505                 xxx=`./fred`
8506                 case $xxx in
8507                 1)      echo "Test program failed using dlopen." >&4
8508                         echo "Perhaps you should not use dynamic loading." >&4;;
8509                 2)      echo "Test program failed using dlsym." >&4
8510                         echo "Perhaps you should not use dynamic loading." >&4;;
8511                 3)      echo "dlsym needs a leading underscore" >&4
8512                         val="$define" ;;
8513                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
8514                 esac
8515         else
8516                 echo "I can't compile and run the test program." >&4
8517                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
8518         fi
8519         ;;
8520 esac
8521                 
8522 $rm -f fred fred.? dyna.$dlext dyna.? tmp-dyna.?
8523
8524 set d_dlsymun
8525 eval $setvar
8526
8527 hasproto='varname=$1; func=$2; shift; shift;
8528 while $test $# -ge 2; do
8529         case "$1" in
8530         $define) echo "#include <$2>";;
8531         esac ;
8532     shift 2;
8533 done > try.c;
8534 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
8535 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
8536         echo "$func() prototype found.";
8537         val="$define";
8538 else
8539         echo "$func() prototype NOT found.";
8540         val="$undef";
8541 fi;
8542 set $varname;
8543 eval $setvar;
8544 $rm -f try.c tryout.c'
8545
8546 : see if prototype for drand48 is available
8547 echo " "
8548 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
8549 eval $hasproto
8550
8551 : see if dup2 exists
8552 set dup2 d_dup2
8553 eval $inlibc
8554
8555 : see if eaccess exists
8556 set eaccess d_eaccess
8557 eval $inlibc
8558
8559 : see if endgrent exists
8560 set endgrent d_endgrent
8561 eval $inlibc
8562
8563 : see if endhostent exists
8564 set endhostent d_endhent
8565 eval $inlibc
8566
8567 : see if endnetent exists
8568 set endnetent d_endnent
8569 eval $inlibc
8570
8571 : see if endprotoent exists
8572 set endprotoent d_endpent
8573 eval $inlibc
8574
8575 : see if endpwent exists
8576 set endpwent d_endpwent
8577 eval $inlibc
8578
8579 : see if endservent exists
8580 set endservent d_endsent
8581 eval $inlibc
8582
8583 : Locate the flags for 'open()'
8584 echo " "
8585 $cat >open3.c <<'EOCP'
8586 #include <sys/types.h>
8587 #ifdef I_FCNTL
8588 #include <fcntl.h>
8589 #endif
8590 #ifdef I_SYS_FILE
8591 #include <sys/file.h>
8592 #endif
8593 int main() {
8594         if(O_RDONLY);
8595 #ifdef O_TRUNC
8596         exit(0);
8597 #else
8598         exit(1);
8599 #endif
8600 }
8601 EOCP
8602 : check sys/file.h first to get FREAD on Sun
8603 if $test `./findhdr sys/file.h` && \
8604                 set open3 -DI_SYS_FILE && eval $compile; then
8605         h_sysfile=true;
8606         echo "<sys/file.h> defines the O_* constants..." >&4
8607         if ./open3; then
8608                 echo "and you have the 3 argument form of open()." >&4
8609                 val="$define"
8610         else
8611                 echo "but not the 3 argument form of open().  Oh, well." >&4
8612                 val="$undef"
8613         fi
8614 elif $test `./findhdr fcntl.h` && \
8615                 set open3 -DI_FCNTL && eval $compile; then
8616         h_fcntl=true;
8617         echo "<fcntl.h> defines the O_* constants..." >&4
8618         if ./open3; then
8619                 echo "and you have the 3 argument form of open()." >&4
8620                 val="$define"
8621         else
8622                 echo "but not the 3 argument form of open().  Oh, well." >&4
8623                 val="$undef"
8624         fi
8625 else
8626         val="$undef"
8627         echo "I can't find the O_* constant definitions!  You got problems." >&4
8628 fi
8629 set d_open3
8630 eval $setvar
8631 $rm -f open3*
8632
8633 : see which of string.h or strings.h is needed
8634 echo " "
8635 strings=`./findhdr string.h`
8636 if $test "$strings" && $test -r "$strings"; then
8637         echo "Using <string.h> instead of <strings.h>." >&4
8638         val="$define"
8639 else
8640         val="$undef"
8641         strings=`./findhdr strings.h`
8642         if $test "$strings" && $test -r "$strings"; then
8643                 echo "Using <strings.h> instead of <string.h>." >&4
8644         else
8645                 echo "No string header found -- You'll surely have problems." >&4
8646         fi
8647 fi
8648 set i_string
8649 eval $setvar
8650 case "$i_string" in
8651 "$undef") strings=`./findhdr strings.h`;;
8652 *)        strings=`./findhdr string.h`;;
8653 esac
8654
8655 : check for non-blocking I/O stuff
8656 case "$h_sysfile" in
8657 true) echo "#include <sys/file.h>" > head.c;;
8658 *)
8659         case "$h_fcntl" in
8660         true) echo "#include <fcntl.h>" > head.c;;
8661         *) echo "#include <sys/fcntl.h>" > head.c;;
8662         esac
8663         ;;
8664 esac
8665 echo " "
8666 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
8667 case "$o_nonblock" in
8668 '')
8669         $cat head.c > try.c
8670         $cat >>try.c <<'EOCP'
8671 #include <stdio.h>
8672 int main() {
8673 #ifdef O_NONBLOCK
8674         printf("O_NONBLOCK\n");
8675         exit(0);
8676 #endif
8677 #ifdef O_NDELAY
8678         printf("O_NDELAY\n");
8679         exit(0);
8680 #endif
8681 #ifdef FNDELAY
8682         printf("FNDELAY\n");
8683         exit(0);
8684 #endif
8685         exit(0);
8686 }
8687 EOCP
8688         set try
8689         if eval $compile_ok; then
8690                 o_nonblock=`./try`
8691                 case "$o_nonblock" in
8692                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
8693                 *) echo "Seems like we can use $o_nonblock.";;
8694                 esac
8695         else
8696                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
8697         fi
8698         ;;
8699 *) echo "Using $hint value $o_nonblock.";;
8700 esac
8701 $rm -f try try.* .out core
8702
8703 echo " "
8704 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
8705 case "$eagain" in
8706 '')
8707         $cat head.c > try.c
8708         $cat >>try.c <<EOCP
8709 #include <errno.h>
8710 #include <sys/types.h>
8711 #include <signal.h>
8712 #include <stdio.h> 
8713 #define MY_O_NONBLOCK $o_nonblock
8714 #ifndef errno  /* XXX need better Configure test */
8715 extern int errno;
8716 #endif
8717 #$i_unistd I_UNISTD
8718 #ifdef I_UNISTD
8719 #include <unistd.h>
8720 #endif
8721 #$i_string I_STRING
8722 #ifdef I_STRING
8723 #include <string.h>
8724 #else
8725 #include <strings.h>
8726 #endif
8727 $signal_t blech(x) int x; { exit(3); }
8728 EOCP
8729         $cat >> try.c <<'EOCP'
8730 int main()
8731 {
8732         int pd[2];
8733         int pu[2];
8734         char buf[1];
8735         char string[100];
8736
8737         pipe(pd);       /* Down: child -> parent */
8738         pipe(pu);       /* Up: parent -> child */
8739         if (0 != fork()) {
8740                 int ret;
8741                 close(pd[1]);   /* Parent reads from pd[0] */
8742                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
8743                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
8744                         exit(1);
8745                 signal(SIGALRM, blech);
8746                 alarm(5);
8747                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
8748                         exit(2);
8749                 sprintf(string, "%d\n", ret);
8750                 write(2, string, strlen(string));
8751                 alarm(0);
8752 #ifdef EAGAIN
8753                 if (errno == EAGAIN) {
8754                         printf("EAGAIN\n");
8755                         goto ok;
8756                 }
8757 #endif
8758 #ifdef EWOULDBLOCK
8759                 if (errno == EWOULDBLOCK)
8760                         printf("EWOULDBLOCK\n");
8761 #endif
8762         ok:
8763                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
8764                 sleep(2);                               /* Give it time to close our pipe */
8765                 alarm(5);
8766                 ret = read(pd[0], buf, 1);      /* Should read EOF */
8767                 alarm(0);
8768                 sprintf(string, "%d\n", ret);
8769                 write(3, string, strlen(string));
8770                 exit(0);
8771         }
8772
8773         close(pd[0]);                   /* We write to pd[1] */
8774         close(pu[1]);                   /* We read from pu[0] */
8775         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
8776         close(pd[1]);                   /* Pipe pd is now fully closed! */
8777         exit(0);                                /* Bye bye, thank you for playing! */
8778 }
8779 EOCP
8780         set try
8781         if eval $compile_ok; then
8782                 echo "$startsh" >mtry
8783                 echo "./try >try.out 2>try.ret 3>try.err || exit 4" >>mtry
8784                 chmod +x mtry
8785                 ./mtry >/dev/null 2>&1
8786                 case $? in
8787                 0) eagain=`$cat try.out`;;
8788                 1) echo "Could not perform non-blocking setting!";;
8789                 2) echo "I did a successful read() for something that was not there!";;
8790                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
8791                 *) echo "Something terribly wrong happened during testing.";;
8792                 esac
8793                 rd_nodata=`$cat try.ret`
8794                 echo "A read() system call with no data present returns $rd_nodata."
8795                 case "$rd_nodata" in
8796                 0|-1) ;;
8797                 *)
8798                         echo "(That's peculiar, fixing that to be -1.)"
8799                         rd_nodata=-1
8800                         ;;
8801                 esac
8802                 case "$eagain" in
8803                 '')
8804                         echo "Forcing errno EAGAIN on read() with no data available."
8805                         eagain=EAGAIN
8806                         ;;
8807                 *)
8808                         echo "Your read() sets errno to $eagain when no data is available."
8809                         ;;
8810                 esac
8811                 status=`$cat try.err`
8812                 case "$status" in
8813                 0) echo "And it correctly returns 0 to signal EOF.";;
8814                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
8815                 *) echo "However, your read() returns '$status' on EOF??";;
8816                 esac
8817                 val="$define"
8818                 if test "$status" = "$rd_nodata"; then
8819                         echo "WARNING: you can't distinguish between EOF and no data!"
8820                         val="$undef"
8821                 fi
8822         else
8823                 echo "I can't compile the test program--assuming errno EAGAIN will do."
8824                 eagain=EAGAIN
8825         fi
8826         set d_eofnblk
8827         eval $setvar
8828         ;;
8829 *)
8830         echo "Using $hint value $eagain."
8831         echo "Your read() returns $rd_nodata when no data is present."
8832         case "$d_eofnblk" in
8833         "$define") echo "And you can see EOF because read() returns 0.";;
8834         "$undef") echo "But you can't see EOF status from read() returned value.";;
8835         *)
8836                 echo "(Assuming you can't see EOF status from read anyway.)"
8837                 d_eofnblk=$undef
8838                 ;;
8839         esac
8840         ;;
8841 esac
8842 $rm -f try try.* .out core head.c mtry
8843
8844 : see if fchmod exists
8845 set fchmod d_fchmod
8846 eval $inlibc
8847
8848 : see if fchown exists
8849 set fchown d_fchown
8850 eval $inlibc
8851
8852 : see if this is an fcntl system
8853 set fcntl d_fcntl
8854 eval $inlibc
8855
8856 echo " "
8857 : See if fcntl-based locking works.
8858 $cat >try.c <<'EOCP'
8859 #include <stdlib.h>
8860 #include <unistd.h>
8861 #include <fcntl.h>
8862 int main() {
8863 #if defined(F_SETLK) && defined(F_SETLKW)
8864      struct flock flock;
8865      int retval, fd;
8866      fd = open("try.c", O_RDONLY);
8867      flock.l_type = F_RDLCK;
8868      flock.l_whence = SEEK_SET;
8869      flock.l_start = flock.l_len = 0;
8870      retval = fcntl(fd, F_SETLK, &flock);
8871      close(fd);
8872      (retval < 0 ? exit(2) : exit(0));
8873 #else
8874      exit(2);
8875 #endif
8876 }
8877 EOCP
8878 echo "Checking if fcntl-based file locking works... "
8879 case "$d_fcntl" in
8880 "$define")
8881         set try
8882         if eval $compile_ok; then
8883                 if ./try; then
8884                         echo "Yes, it seems to work."
8885                         val="$define"
8886                 else
8887                         echo "Nope, it didn't work."
8888                         val="$undef"
8889                 fi
8890         else
8891                 echo "I'm unable to compile the test program, so I'll assume not."
8892                 val="$undef"
8893         fi
8894         ;;
8895 *) val="$undef";
8896         echo "Nope, since you don't even have fcntl()."
8897         ;;
8898 esac
8899 set d_fcntl_can_lock
8900 eval $setvar
8901 $rm -f try*
8902
8903
8904 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
8905 while $test $# -ge 2; do
8906         case "$1" in
8907         $define) echo "#include <$2>";;
8908         esac ;
8909     shift 2;
8910 done > try.c;
8911 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
8912 set try;
8913 if eval $compile; then
8914         val="$define";
8915 else
8916         val="$undef";
8917 fi;
8918 set $varname;
8919 eval $setvar;
8920 $rm -f try.c try.o'
8921
8922 socketlib=''
8923 sockethdr=''
8924 : see whether socket exists
8925 echo " "
8926 $echo $n "Hmm... $c" >&4
8927 if set socket val -f d_socket; eval $csym; $val; then
8928         echo "Looks like you have Berkeley networking support." >&4
8929         d_socket="$define"
8930         if set setsockopt val -f; eval $csym; $val; then
8931                 d_oldsock="$undef"
8932         else
8933                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
8934                 d_oldsock="$define"
8935         fi
8936 else
8937         if $contains socklib libc.list >/dev/null 2>&1; then
8938                 echo "Looks like you have Berkeley networking support." >&4
8939                 d_socket="$define"
8940                 : we will have to assume that it supports the 4.2 BSD interface
8941                 d_oldsock="$undef"
8942         else
8943                 echo "You don't have Berkeley networking in libc$_a..." >&4
8944                 if test "X$d_socket" = "X$define"; then
8945                    echo "...but you seem to believe that you have sockets." >&4
8946                 else
8947                         for net in net socket
8948                         do
8949                                 if test -f /usr/lib/lib$net$_a; then
8950                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
8951                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
8952                                         if $contains socket libc.list >/dev/null 2>&1; then
8953                                                 d_socket="$define"
8954                                                 socketlib="-l$net"
8955                                                 case "$net" in
8956                                                 net)
8957                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
8958                                                         sockethdr="-I/usr/netinclude"
8959                                                         ;;
8960                                                 esac
8961                                                 echo "Found Berkeley sockets interface in lib$net." >& 4 
8962                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
8963                                                         d_oldsock="$undef"
8964                                                 else
8965                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
8966                                                         d_oldsock="$define"
8967                                                 fi
8968                                                 break
8969                                         fi
8970                                 fi
8971                         done
8972                         if test "X$d_socket" != "X$define"; then
8973                            echo "or anywhere else I see." >&4
8974                            d_socket="$undef"
8975                            d_oldsock="$undef"
8976                         fi
8977                 fi
8978         fi
8979 fi
8980
8981 : see if socketpair exists
8982 set socketpair d_sockpair
8983 eval $inlibc
8984
8985
8986 echo " "
8987 echo "Checking the availability of certain socket constants..." >& 4
8988 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
8989         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
8990         $cat >try.c <<EOF
8991 #include <sys/types.h>
8992 #include <sys/socket.h>
8993 int main() {
8994     int i = $ENUM;
8995 }
8996 EOF
8997         val="$undef"
8998         set try; if eval $compile; then
8999                 val="$define"
9000         fi
9001         set d_${enum}; eval $setvar
9002         $rm -f try.c try
9003 done
9004
9005 : see if sys/select.h has to be included
9006 set sys/select.h i_sysselct
9007 eval $inhdr
9008
9009 : see if we should include time.h, sys/time.h, or both
9010 echo " "
9011 if test "X$timeincl" = X; then
9012         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
9013         $echo $n "I'm now running the test program...$c"
9014         $cat >try.c <<'EOCP'
9015 #include <sys/types.h>
9016 #ifdef I_TIME
9017 #include <time.h>
9018 #endif
9019 #ifdef I_SYSTIME
9020 #ifdef SYSTIMEKERNEL
9021 #define KERNEL
9022 #endif
9023 #include <sys/time.h>
9024 #endif
9025 #ifdef I_SYSSELECT
9026 #include <sys/select.h>
9027 #endif
9028 int main()
9029 {
9030         struct tm foo;
9031 #ifdef S_TIMEVAL
9032         struct timeval bar;
9033 #endif
9034 #ifdef S_TIMEZONE
9035         struct timezone tzp;
9036 #endif
9037         if (foo.tm_sec == foo.tm_sec)
9038                 exit(0);
9039 #ifdef S_TIMEVAL
9040         if (bar.tv_sec == bar.tv_sec)
9041                 exit(0);
9042 #endif
9043         exit(1);
9044 }
9045 EOCP
9046         flags=''
9047         for s_timezone in '-DS_TIMEZONE' ''; do
9048         sysselect=''
9049         for s_timeval in '-DS_TIMEVAL' ''; do
9050         for i_systimek in '' '-DSYSTIMEKERNEL'; do
9051         for i_time in '' '-DI_TIME'; do
9052         for i_systime in '-DI_SYSTIME' ''; do
9053                 case "$flags" in
9054                 '') $echo $n ".$c"
9055                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
9056                         if eval $compile; then
9057                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
9058                                 shift
9059                                 flags="$*"
9060                                 echo " "
9061                                 $echo $n "Succeeded with $flags$c"
9062                         fi
9063                         ;;
9064                 esac
9065         done
9066         done
9067         done
9068         done
9069         done
9070         timeincl=''
9071         echo " "
9072         case "$flags" in
9073         *SYSTIMEKERNEL*) i_systimek="$define"
9074                 timeincl=`./findhdr sys/time.h`
9075                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
9076         *) i_systimek="$undef";;
9077         esac
9078         case "$flags" in
9079         *I_TIME*) i_time="$define"
9080                 timeincl=`./findhdr time.h`" $timeincl"
9081                 echo "We'll include <time.h>." >&4;;
9082         *) i_time="$undef";;
9083         esac
9084         case "$flags" in
9085         *I_SYSTIME*) i_systime="$define"
9086                 timeincl=`./findhdr sys/time.h`" $timeincl"
9087                 echo "We'll include <sys/time.h>." >&4;;
9088         *) i_systime="$undef";;
9089         esac
9090         $rm -f try.c try
9091 fi
9092
9093 : check for fd_set items
9094 $cat <<EOM
9095
9096 Checking to see how well your C compiler handles fd_set and friends ...
9097 EOM
9098 $cat >fd_set.c <<EOCP
9099 #$i_systime I_SYS_TIME
9100 #$i_sysselct I_SYS_SELECT
9101 #$d_socket HAS_SOCKET
9102 #include <sys/types.h>
9103 #ifdef HAS_SOCKET
9104 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
9105 #endif
9106 #ifdef I_SYS_TIME
9107 #include <sys/time.h>
9108 #endif
9109 #ifdef I_SYS_SELECT
9110 #include <sys/select.h>
9111 #endif
9112 int main() {
9113         fd_set fds;
9114
9115 #ifdef TRYBITS
9116         if(fds.fds_bits);
9117 #endif
9118
9119 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
9120         exit(0);
9121 #else
9122         exit(1);
9123 #endif
9124 }
9125 EOCP
9126 set fd_set -DTRYBITS
9127 if eval $compile; then
9128         d_fds_bits="$define"
9129         d_fd_set="$define"
9130         echo "Well, your system knows about the normal fd_set typedef..." >&4
9131         if ./fd_set; then
9132                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
9133                 d_fd_macros="$define"
9134         else
9135                 $cat >&4 <<'EOM'
9136 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
9137 EOM
9138                 d_fd_macros="$undef"
9139         fi
9140 else
9141         $cat <<'EOM'
9142 Hmm, your compiler has some difficulty with fd_set.  Checking further...
9143 EOM
9144         set fd_set
9145         if eval $compile; then
9146                 d_fds_bits="$undef"
9147                 d_fd_set="$define"
9148                 echo "Well, your system has some sort of fd_set available..." >&4
9149                 if ./fd_set; then
9150                         echo "and you have the normal fd_set macros." >&4
9151                         d_fd_macros="$define"
9152                 else
9153                         $cat <<'EOM'
9154 but not the normal fd_set macros!  Gross!  More work for me...
9155 EOM
9156                         d_fd_macros="$undef"
9157                 fi
9158         else
9159         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
9160                 d_fd_set="$undef"
9161                 d_fds_bits="$undef"
9162                 d_fd_macros="$undef"
9163         fi
9164 fi
9165 $rm -f fd_set*
9166
9167 : see if fgetpos exists
9168 set fgetpos d_fgetpos
9169 eval $inlibc
9170
9171 : see if flock exists
9172 set flock d_flock
9173 eval $inlibc
9174
9175 : see if fork exists
9176 set fork d_fork
9177 eval $inlibc
9178
9179 : see if pathconf exists
9180 set pathconf d_pathconf
9181 eval $inlibc
9182
9183 : see if fpathconf exists
9184 set fpathconf d_fpathconf
9185 eval $inlibc
9186
9187
9188 : check for fpos64_t
9189 echo " "
9190 echo "Checking to see if you have fpos64_t..." >&4
9191 $cat >try.c <<EOCP
9192 #include <stdio.h>
9193 int main() { fpos64_t x = 7; }
9194 EOCP
9195 set try
9196 if eval $compile; then
9197         val="$define"
9198         echo "You have fpos64_t."
9199 else
9200         val="$undef"
9201         echo "You do not have fpos64_t."
9202         case "$fpossize" in
9203         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
9204         esac
9205 fi
9206 $rm -f try.* try
9207 set d_fpos64_t
9208 eval $setvar
9209
9210 : see if frexpl exists
9211 set frexpl d_frexpl
9212 eval $inlibc
9213
9214 hasstruct='varname=$1; struct=$2; shift; shift;
9215 while $test $# -ge 2; do
9216         case "$1" in
9217         $define) echo "#include <$2>";;
9218         esac ;
9219     shift 2;
9220 done > try.c;
9221 echo "int main () { struct $struct foo; }" >> try.c;
9222 set try;
9223 if eval $compile; then
9224         val="$define";
9225 else
9226         val="$undef";
9227 fi;
9228 set $varname;
9229 eval $setvar;
9230 $rm -f try.c try.o'
9231
9232 : see if this is a sys/param system
9233 set sys/param.h i_sysparam
9234 eval $inhdr
9235
9236 : see if this is a sys/mount.h system
9237 set sys/mount.h i_sysmount
9238 eval $inhdr
9239
9240 : see if sys/types.h has to be included
9241 set sys/types.h i_systypes
9242 eval $inhdr
9243
9244
9245 echo " "
9246 echo "Checking to see if your system supports struct fs_data..." >&4
9247 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
9248 eval $hasstruct
9249 case "$d_fs_data_s" in
9250 "$define")      echo "Yes, it does."   ;;
9251 *)              echo "No, it doesn't." ;;
9252 esac
9253
9254 : see if fseeko exists
9255 set fseeko d_fseeko
9256 eval $inlibc
9257 case "$longsize" in
9258 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
9259 esac
9260
9261 : see if fsetpos exists
9262 set fsetpos d_fsetpos
9263 eval $inlibc
9264
9265
9266 : see if fstatfs exists
9267 set fstatfs d_fstatfs
9268 eval $inlibc
9269
9270
9271 : see if statvfs exists
9272 set statvfs d_statvfs
9273 eval $inlibc
9274
9275 : see if fstatvfs exists
9276 set fstatvfs d_fstatvfs
9277 eval $inlibc
9278
9279
9280 : see if fsync exists
9281 set fsync d_fsync
9282 eval $inlibc
9283
9284 : see if ftello exists
9285 set ftello d_ftello
9286 eval $inlibc
9287 case "$longsize" in
9288 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
9289 esac
9290
9291 : see if getcwd exists
9292 set getcwd d_getcwd
9293 eval $inlibc
9294
9295 : see if getespwnam exists
9296 set getespwnam d_getespwnam
9297 eval $inlibc
9298
9299
9300 : see if getfsstat exists
9301 set getfsstat d_getfsstat
9302 eval $inlibc
9303
9304 : see if getgrent exists
9305 set getgrent d_getgrent
9306 eval $inlibc
9307
9308 : see if gethostbyaddr exists
9309 set gethostbyaddr d_gethbyaddr
9310 eval $inlibc
9311
9312 : see if gethostbyname exists
9313 set gethostbyname d_gethbyname
9314 eval $inlibc
9315
9316 : see if gethostent exists
9317 set gethostent d_gethent
9318 eval $inlibc
9319
9320 : see how we will look up host name
9321 echo " "
9322 call=''
9323 if set gethostname val -f d_gethname; eval $csym; $val; then
9324         echo 'gethostname() found.' >&4
9325         d_gethname="$define"
9326         call=gethostname
9327 fi
9328 if set uname val -f d_uname; eval $csym; $val; then
9329         if ./xenix; then
9330                 $cat <<'EOM'
9331 uname() was found, but you're running xenix, and older versions of xenix
9332 have a broken uname(). If you don't really know whether your xenix is old
9333 enough to have a broken system call, use the default answer.
9334
9335 EOM
9336                 dflt=y
9337                 case "$d_uname" in
9338                 "$define") dflt=n;;
9339                 esac
9340                 rp='Is your uname() broken?'
9341                 . ./myread
9342                 case "$ans" in
9343                 n*) d_uname="$define"; call=uname;;
9344                 esac
9345         else
9346                 echo 'uname() found.' >&4
9347                 d_uname="$define"
9348                 case "$call" in
9349                 '') call=uname ;;
9350                 esac
9351         fi
9352 fi
9353 case "$d_gethname" in
9354 '') d_gethname="$undef";;
9355 esac
9356 case "$d_uname" in
9357 '') d_uname="$undef";;
9358 esac
9359 case "$d_uname$d_gethname" in
9360 *define*)
9361         dflt=n
9362         cat <<EOM
9363  
9364 Every now and then someone has a $call() that lies about the hostname
9365 but can't be fixed for political or economic reasons.  If you wish, I can
9366 pretend $call() isn't there and maybe compute hostname at run-time
9367 thanks to the '$phostname' command.
9368
9369 EOM
9370         rp="Shall I ignore $call() from now on?"
9371         . ./myread
9372         case "$ans" in
9373         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
9374         esac;;
9375 esac
9376 case "$phostname" in
9377 '') aphostname='';;
9378 *) case "$aphostname" in
9379         /*) ;;
9380         *) set X $phostname
9381                 shift
9382                 file=$1
9383                 shift
9384                 file=`./loc $file $file $pth`
9385                 aphostname=`echo $file $*`
9386                 ;;
9387         esac
9388         ;;
9389 esac
9390 case "$d_uname$d_gethname" in
9391 *define*) ;;
9392 *)
9393         case "$phostname" in
9394         '')
9395                 echo "There will be no way for $package to get your hostname." >&4;;
9396         *)
9397         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
9398                 ;;
9399         esac;;
9400 esac
9401 case "$d_phostname" in
9402 '') d_phostname="$undef";;
9403 esac
9404
9405 : see if this is a netdb.h system
9406 set netdb.h i_netdb
9407 eval $inhdr
9408
9409 : see if prototypes for various gethostxxx netdb.h functions are available
9410 echo " "
9411 set d_gethostprotos gethostent $i_netdb netdb.h
9412 eval $hasproto
9413
9414 : see if getlogin exists
9415 set getlogin d_getlogin
9416 eval $inlibc
9417
9418 : see if getmnt exists
9419 set getmnt d_getmnt
9420 eval $inlibc
9421
9422 : see if getmntent exists
9423 set getmntent d_getmntent
9424 eval $inlibc
9425
9426 : see if getnetbyaddr exists
9427 set getnetbyaddr d_getnbyaddr
9428 eval $inlibc
9429
9430 : see if getnetbyname exists
9431 set getnetbyname d_getnbyname
9432 eval $inlibc
9433
9434 : see if getnetent exists
9435 set getnetent d_getnent
9436 eval $inlibc
9437
9438 : see if prototypes for various getnetxxx netdb.h functions are available
9439 echo " "
9440 set d_getnetprotos getnetent $i_netdb netdb.h
9441 eval $hasproto
9442
9443 : see if getpagesize exists
9444 set getpagesize d_getpagsz
9445 eval $inlibc
9446
9447
9448 : see if getprotobyname exists
9449 set getprotobyname d_getpbyname
9450 eval $inlibc
9451
9452 : see if getprotobynumber exists
9453 set getprotobynumber d_getpbynumber
9454 eval $inlibc
9455
9456 : see if getprotoent exists
9457 set getprotoent d_getpent
9458 eval $inlibc
9459
9460 : see if getpgid exists
9461 set getpgid d_getpgid
9462 eval $inlibc
9463
9464 : see if getpgrp2 exists
9465 set getpgrp2 d_getpgrp2
9466 eval $inlibc
9467
9468 : see if getppid exists
9469 set getppid d_getppid
9470 eval $inlibc
9471
9472 : see if getpriority exists
9473 set getpriority d_getprior
9474 eval $inlibc
9475
9476 : see if prototypes for various getprotoxxx netdb.h functions are available
9477 echo " "
9478 set d_getprotoprotos getprotoent $i_netdb netdb.h
9479 eval $hasproto
9480
9481 : see if getprpwnam exists
9482 set getprpwnam d_getprpwnam
9483 eval $inlibc
9484
9485 : see if getpwent exists
9486 set getpwent d_getpwent
9487 eval $inlibc
9488
9489
9490 : see if getservbyname exists
9491 set getservbyname d_getsbyname
9492 eval $inlibc
9493
9494 : see if getservbyport exists
9495 set getservbyport d_getsbyport
9496 eval $inlibc
9497
9498 : see if getservent exists
9499 set getservent d_getsent
9500 eval $inlibc
9501
9502 : see if prototypes for various getservxxx netdb.h functions are available
9503 echo " "
9504 set d_getservprotos getservent $i_netdb netdb.h
9505 eval $hasproto
9506
9507 : see if getspnam exists
9508 set getspnam d_getspnam
9509 eval $inlibc
9510
9511 : see if gettimeofday or ftime exists
9512 set gettimeofday d_gettimeod
9513 eval $inlibc
9514 case "$d_gettimeod" in
9515 "$undef")
9516         set ftime d_ftime 
9517         eval $inlibc
9518         ;;
9519 *)
9520         val="$undef"; set d_ftime; eval $setvar
9521         ;;
9522 esac
9523 case "$d_gettimeod$d_ftime" in
9524 "$undef$undef")
9525         echo " "
9526         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
9527         ;;
9528 esac
9529
9530 : see if this is an grp system
9531 set grp.h i_grp
9532 eval $inhdr
9533
9534 case "$i_grp" in
9535 $define)
9536         xxx=`./findhdr grp.h`
9537         $cppstdin $cppflags $cppminus < $xxx >$$.h
9538
9539         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
9540                 val="$define"
9541         else
9542                 val="$undef"
9543         fi
9544         set d_grpasswd
9545         eval $setvar
9546
9547         $rm -f $$.h
9548         ;;
9549 *)
9550         val="$undef";
9551         set d_grpasswd; eval $setvar
9552         ;;
9553 esac
9554
9555 : see if hasmntopt exists
9556 set hasmntopt d_hasmntopt
9557 eval $inlibc
9558
9559 : see if this is a netinet/in.h or sys/in.h system
9560 set netinet/in.h i_niin sys/in.h i_sysin
9561 eval $inhdr
9562
9563 : see if arpa/inet.h has to be included
9564 set arpa/inet.h i_arpainet
9565 eval $inhdr
9566
9567 : see if htonl --and friends-- exists
9568 val=''
9569 set htonl val
9570 eval $inlibc
9571
9572 : Maybe they are macros.
9573 case "$val" in
9574 $undef)
9575         $cat >htonl.c <<EOM
9576 #include <stdio.h>
9577 #include <sys/types.h>
9578 #$i_niin I_NETINET_IN
9579 #$i_sysin I_SYS_IN
9580 #$i_arpainet I_ARPA_INET
9581 #ifdef I_NETINET_IN
9582 #include <netinet/in.h>
9583 #endif
9584 #ifdef I_SYS_IN
9585 #include <sys/in.h>
9586 #endif
9587 #ifdef I_ARPA_INET
9588 #include <arpa/inet.h>
9589 #endif
9590 #ifdef htonl
9591 printf("Defined as a macro.");
9592 #endif
9593 EOM
9594         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
9595         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
9596                 val="$define"
9597                 echo "But it seems to be defined as a macro." >&4
9598         fi
9599         $rm -f htonl.?
9600         ;;
9601 esac
9602 set d_htonl
9603 eval $setvar
9604
9605 : see if iconv exists
9606 set iconv d_iconv
9607 eval $inlibc
9608
9609 : index or strchr
9610 echo " "
9611 if set index val -f; eval $csym; $val; then
9612         if set strchr val -f d_strchr; eval $csym; $val; then
9613                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
9614                         val="$define"
9615                         vali="$undef"
9616                         echo "strchr() found." >&4
9617                 else
9618                         val="$undef"
9619                         vali="$define"
9620                         echo "index() found." >&4
9621                 fi
9622         else
9623                 val="$undef"
9624                 vali="$define"
9625                 echo "index() found." >&4
9626         fi
9627 else
9628         if set strchr val -f d_strchr; eval $csym; $val; then
9629                 val="$define"
9630                 vali="$undef"
9631                 echo "strchr() found." >&4
9632         else
9633                 echo "No index() or strchr() found!" >&4
9634                 val="$undef"
9635                 vali="$undef"
9636         fi
9637 fi
9638 set d_strchr; eval $setvar
9639 val="$vali"
9640 set d_index; eval $setvar
9641
9642 : check whether inet_aton exists
9643 set inet_aton d_inetaton
9644 eval $inlibc
9645
9646 : see if inttypes.h is available
9647 : we want a real compile instead of Inhdr because some systems
9648 : have an inttypes.h which includes non-existent headers
9649 echo " "
9650 $cat >try.c <<EOCP
9651 #include <inttypes.h>
9652 int main() {
9653         static int32_t foo32 = 0x12345678;
9654 }
9655 EOCP
9656 set try
9657 if eval $compile; then
9658         echo "<inttypes.h> found." >&4
9659         val="$define"
9660 else
9661         echo "<inttypes.h> NOT found." >&4
9662         val="$undef"
9663 fi
9664 $rm -f try.c try
9665 set i_inttypes
9666 eval $setvar
9667
9668 : check for int64_t
9669 echo " "
9670 echo "Checking to see if you have int64_t..." >&4
9671 $cat >try.c <<EOCP
9672 #include <sys/types.h>
9673 #$i_inttypes I_INTTYPES
9674 #ifdef I_INTTYPES
9675 #include <inttypes.h>
9676 #endif
9677 int main() { int64_t x = 7; }
9678 EOCP
9679 set try
9680 if eval $compile; then
9681         val="$define"
9682         echo "You have int64_t."
9683 else
9684         val="$undef"
9685         echo "You do not have int64_t."
9686 fi
9687 $rm -f try try.*
9688 set d_int64_t
9689 eval $setvar
9690
9691 : Look for isascii
9692 echo " "
9693 $cat >isascii.c <<'EOCP'
9694 #include <stdio.h>
9695 #include <ctype.h>
9696 int main() {
9697         int c = 'A';
9698         if (isascii(c))
9699                 exit(0);
9700         else
9701                 exit(1);
9702 }
9703 EOCP
9704 set isascii
9705 if eval $compile; then
9706         echo "isascii() found." >&4
9707         val="$define"
9708 else
9709         echo "isascii() NOT found." >&4
9710         val="$undef"
9711 fi
9712 set d_isascii
9713 eval $setvar
9714 $rm -f isascii*
9715
9716 : see if isnan exists
9717 set isnan d_isnan
9718 eval $inlibc
9719
9720 : see if isnanl exists
9721 set isnanl d_isnanl
9722 eval $inlibc
9723
9724 : see if killpg exists
9725 set killpg d_killpg
9726 eval $inlibc
9727
9728 : see if lchown exists
9729 echo " "
9730 $cat > try.c <<'EOCP'
9731 /* System header to define __stub macros and hopefully few prototypes,
9732     which can conflict with char lchown(); below.  */
9733 #include <assert.h>
9734 /* Override any gcc2 internal prototype to avoid an error.  */
9735 /* We use char because int might match the return type of a gcc2
9736    builtin and then its argument prototype would still apply.  */
9737 char lchown();
9738 int main() {
9739     /*  The GNU C library defines this for functions which it implements
9740         to always fail with ENOSYS.  Some functions are actually named
9741         something starting with __ and the normal name is an alias.  */
9742 #if defined (__stub_lchown) || defined (__stub___lchown)
9743 choke me
9744 #else
9745 lchown();
9746 #endif
9747 ; return 0; }
9748 EOCP
9749 set try
9750 if eval $compile; then
9751     $echo "lchown() found." >&4
9752     val="$define"
9753 else
9754     $echo "lchown() NOT found." >&4
9755     val="$undef"
9756 fi
9757 set d_lchown
9758 eval $setvar
9759
9760 : See if number of significant digits in a double precision number is known
9761 echo " "
9762 $cat >ldbl_dig.c <<EOM
9763 #$i_limits I_LIMITS
9764 #$i_float I_FLOAT
9765 #ifdef I_LIMITS
9766 #include <limits.h>
9767 #endif
9768 #ifdef I_FLOAT
9769 #include <float.h>
9770 #endif
9771 #ifdef LDBL_DIG
9772 printf("Contains LDBL_DIG");
9773 #endif
9774 EOM
9775 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
9776 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
9777         echo "LDBL_DIG found." >&4
9778         val="$define"
9779 else
9780         echo "LDBL_DIG NOT found." >&4
9781         val="$undef"
9782 fi
9783 $rm -f ldbl_dig.?
9784 set d_ldbl_dig
9785 eval $setvar
9786
9787 : see if link exists
9788 set link d_link
9789 eval $inlibc
9790
9791 : see if localeconv exists
9792 set localeconv d_locconv
9793 eval $inlibc
9794
9795 : see if lockf exists
9796 set lockf d_lockf
9797 eval $inlibc
9798
9799 : check for long long
9800 echo " "
9801 echo "Checking to see if you have long long..." >&4
9802 echo 'int main() { long long x = 7; return 0; }' > try.c
9803 set try
9804 if eval $compile; then
9805         val="$define"
9806         echo "You have long long."
9807 else
9808         val="$undef"
9809         echo "You do not have long long."
9810 fi
9811 $rm try.*
9812 set d_longlong
9813 eval $setvar
9814
9815 : check for length of long long
9816 case "${d_longlong}${longlongsize}" in
9817 $define)
9818         echo " "
9819         echo "Checking to see how big your long longs are..." >&4
9820         $cat >try.c <<'EOCP'
9821 #include <stdio.h>
9822 int main()
9823 {
9824     printf("%d\n", (int)sizeof(long long));
9825     return(0);
9826 }
9827 EOCP
9828         set try
9829         if eval $compile_ok; then
9830                 longlongsize=`./try$exe_ext`
9831                 echo "Your long longs are $longlongsize bytes long."
9832         else
9833                 dflt='8'
9834                 echo " "
9835                 echo "(I can't seem to compile the test program.  Guessing...)"
9836                 rp="What is the size of a long long (in bytes)?"
9837                 . ./myread
9838                 longlongsize="$ans"
9839         fi
9840         if $test "X$longsize" = "X$longlongsize"; then
9841                 echo "(That isn't any different from an ordinary long.)"
9842         fi      
9843         ;;
9844 esac
9845 $rm -f try.* try
9846
9847 : see if prototype for lseek is available
9848 echo " "
9849 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
9850 eval $hasproto
9851
9852 : see if lstat exists
9853 set lstat d_lstat
9854 eval $inlibc
9855
9856 : see if madvise exists
9857 set madvise d_madvise
9858 eval $inlibc
9859
9860 : see if mblen exists
9861 set mblen d_mblen
9862 eval $inlibc
9863
9864 : see if mbstowcs exists
9865 set mbstowcs d_mbstowcs
9866 eval $inlibc
9867
9868 : see if mbtowc exists
9869 set mbtowc d_mbtowc
9870 eval $inlibc
9871
9872 : see if memchr exists
9873 set memchr d_memchr
9874 eval $inlibc
9875
9876 : see if memcmp exists
9877 set memcmp d_memcmp
9878 eval $inlibc
9879
9880 : see if memcpy exists
9881 set memcpy d_memcpy
9882 eval $inlibc
9883
9884 : see if memmove exists
9885 set memmove d_memmove
9886 eval $inlibc
9887
9888 : see if memset exists
9889 set memset d_memset
9890 eval $inlibc
9891
9892 : see if mkdir exists
9893 set mkdir d_mkdir
9894 eval $inlibc
9895
9896 : see if mkdtemp exists
9897 set mkdtemp d_mkdtemp
9898 eval $inlibc
9899
9900 : see if mkfifo exists
9901 set mkfifo d_mkfifo
9902 eval $inlibc
9903
9904 : see if mkstemp exists
9905 set mkstemp d_mkstemp
9906 eval $inlibc
9907
9908 : see if mkstemps exists
9909 set mkstemps d_mkstemps
9910 eval $inlibc
9911
9912 : see if mktime exists
9913 set mktime d_mktime
9914 eval $inlibc
9915
9916 : see if this is a sys/mman.h system
9917 set sys/mman.h i_sysmman
9918 eval $inhdr
9919
9920 : see if mmap exists
9921 set mmap d_mmap
9922 eval $inlibc
9923 : see what shmat returns
9924 : default to something harmless
9925 mmaptype='void *'
9926 case "$i_sysmman$d_mmap" in
9927 "$define$define")
9928         $cat >mmap.c <<'END'
9929 #include <sys/mman.h>
9930 void *mmap();
9931 END
9932         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
9933                 mmaptype='void *'
9934         else
9935                 mmaptype='caddr_t'
9936         fi
9937         echo "and it returns ($mmaptype)." >&4
9938         ;;
9939 esac
9940
9941
9942
9943 : see if modfl exists
9944 set modfl d_modfl
9945 eval $inlibc
9946
9947 : see if mprotect exists
9948 set mprotect d_mprotect
9949 eval $inlibc
9950
9951 : see if msgctl exists
9952 set msgctl d_msgctl
9953 eval $inlibc
9954
9955 : see if msgget exists
9956 set msgget d_msgget
9957 eval $inlibc
9958
9959 : see if msgsnd exists
9960 set msgsnd d_msgsnd
9961 eval $inlibc
9962
9963 : see if msgrcv exists
9964 set msgrcv d_msgrcv
9965 eval $inlibc
9966
9967 : see how much of the 'msg*(2)' library is present.
9968 h_msg=true
9969 echo " "
9970 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
9971 *"$undef"*) h_msg=false;;
9972 esac
9973 case "$osname" in
9974 freebsd)
9975     case "`ipcs 2>&1`" in
9976     "SVID messages"*"not configured"*)
9977         echo "Your $osname does not have the msg*(2) configured." >&4
9978         h_msg=false
9979         val="$undef"
9980         set msgctl d_msgctl
9981         eval $setvar
9982         set msgget d_msgget
9983         eval $setvar
9984         set msgsnd d_msgsnd
9985         eval $setvar
9986         set msgrcv d_msgrcv
9987         eval $setvar
9988         ;;
9989     esac
9990     ;;
9991 esac
9992 : we could also check for sys/ipc.h ...
9993 if $h_msg && $test `./findhdr sys/msg.h`; then
9994         echo "You have the full msg*(2) library." >&4
9995         val="$define"
9996 else
9997         echo "You don't have the full msg*(2) library." >&4
9998         val="$undef"
9999 fi
10000 set d_msg
10001 eval $setvar
10002
10003 : see if msync exists
10004 set msync d_msync
10005 eval $inlibc
10006
10007 : see if munmap exists
10008 set munmap d_munmap
10009 eval $inlibc
10010
10011 : see if nice exists
10012 set nice d_nice
10013 eval $inlibc
10014
10015
10016 echo " "
10017 echo "Checking which 64-bit integer type we could use..." >&4
10018
10019 case "$intsize" in
10020 8) val=int
10021    set quadtype
10022    eval $setvar
10023    val='"unsigned int"'
10024    set uquadtype
10025    eval $setvar
10026    quadkind=1
10027    ;;
10028 *) case "$longsize" in
10029    8) val=long
10030       set quadtype
10031       eval $setvar
10032       val='"unsigned long"'
10033       set uquadtype
10034       eval $setvar
10035       quadkind=2
10036       ;;
10037    *) case "$d_longlong:$longlongsize" in
10038       define:8)
10039         val='"long long"'
10040         set quadtype
10041         eval $setvar
10042         val='"unsigned long long"'
10043         set uquadtype
10044         eval $setvar
10045         quadkind=3
10046         ;;
10047       *) case "$d_int64_t" in
10048          define)
10049            val=int64_t
10050            set quadtype
10051            eval $setvar
10052            val=uint64_t
10053            set uquadtype
10054            eval $setvar
10055            quadkind=4
10056            ;;
10057          esac
10058          ;;
10059       esac
10060       ;;
10061    esac
10062    ;;
10063 esac
10064
10065 case "$quadtype" in
10066 '')     echo "Alas, no 64-bit integer types in sight." >&4
10067         d_quad="$undef"
10068         ;;
10069 *)      if test X"$use64bitint" = Xdefine -o X"$longsize" = X8; then
10070             verb="will"
10071         else
10072             verb="could"
10073         fi
10074         echo "We $verb use '$quadtype' for 64-bit integers." >&4
10075         d_quad="$define"
10076         ;;
10077 esac
10078
10079 : check for length of character
10080 echo " "
10081 case "$charsize" in
10082 '')
10083         echo "Checking to see how big your characters are (hey, you never know)..." >&4
10084         $cat >try.c <<'EOCP'
10085 #include <stdio.h>
10086 int main()
10087 {
10088     printf("%d\n", (int)sizeof(char));
10089     exit(0);
10090 }
10091 EOCP
10092         set try
10093         if eval $compile_ok; then
10094                 dflt=`./try`
10095         else
10096                 dflt='1'
10097                 echo "(I can't seem to compile the test program.  Guessing...)"
10098         fi
10099         ;;
10100 *)
10101         dflt="$charsize"
10102         ;;
10103 esac
10104 rp="What is the size of a character (in bytes)?"
10105 . ./myread
10106 charsize="$ans"
10107 $rm -f try.c try
10108
10109 : check for volatile keyword
10110 echo " "
10111 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
10112 $cat >try.c <<'EOCP'
10113 int main()
10114 {
10115         typedef struct _goo_struct goo_struct;
10116         goo_struct * volatile goo = ((goo_struct *)0);
10117         struct _goo_struct {
10118                 long long_int;
10119                 int reg_int;
10120                 char char_var;
10121         };
10122         typedef unsigned short foo_t;
10123         char *volatile foo;
10124         volatile int bar;
10125         volatile foo_t blech;
10126         foo = foo;
10127 }
10128 EOCP
10129 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
10130         val="$define"
10131         echo "Yup, it does."
10132 else
10133         val="$undef"
10134         echo "Nope, it doesn't."
10135 fi
10136 set d_volatile
10137 eval $setvar
10138 $rm -f try.*
10139
10140
10141 echo " "
10142 $echo "Choosing the C types to be used for Perl's internal types..." >&4
10143
10144 case "$use64bitint:$d_quad:$quadtype" in
10145 define:define:?*)
10146         ivtype="$quadtype"
10147         uvtype="$uquadtype"
10148         ivsize=8
10149         uvsize=8
10150         ;;
10151 *)      ivtype="long"
10152         uvtype="unsigned long"
10153         ivsize=$longsize
10154         uvsize=$longsize
10155         ;;
10156 esac
10157
10158 case "$uselongdouble:$d_longdbl" in
10159 define:define)
10160         nvtype="long double"
10161         nvsize=$longdblsize
10162         ;;
10163 *)      nvtype=double
10164         nvsize=$doublesize
10165         ;;
10166 esac
10167
10168 $echo "(IV will be "$ivtype", $ivsize bytes)"
10169 $echo "(UV will be "$uvtype", $uvsize bytes)"
10170 $echo "(NV will be "$nvtype", $nvsize bytes)"
10171
10172 $cat >try.c <<EOCP
10173 #$i_inttypes I_INTTYPES
10174 #ifdef I_INTTYPES
10175 #include <inttypes.h>
10176 #endif
10177 #include <stdio.h>
10178 int main() {
10179 #ifdef INT8
10180    int8_t i =  INT8_MAX;
10181   uint8_t u = UINT8_MAX;
10182   printf("int8_t\n");
10183 #endif
10184 #ifdef INT16
10185    int16_t i =  INT16_MAX;
10186   uint16_t i = UINT16_MAX;
10187   printf("int16_t\n");
10188 #endif
10189 #ifdef INT32
10190    int32_t i =  INT32_MAX;
10191   uint32_t u = UINT32_MAX;
10192   printf("int32_t\n");
10193 #endif
10194 }
10195 EOCP
10196
10197 case "$i8type" in
10198 '')     case "$charsize" in
10199         1)      i8type=char
10200                 u8type="unsigned char"
10201                 i8size=$charsize
10202                 u8size=$charsize
10203                 ;;
10204         esac
10205         ;;
10206 esac
10207 case "$i8type" in
10208 '')     set try -DINT8
10209         if eval $compile; then
10210                 case "`./try$exe_ext`" in
10211                 int8_t) i8type=int8_t
10212                         u8type=uint8_t
10213                         i8size=1
10214                         u8size=1
10215                         ;;
10216                 esac
10217         fi
10218         ;;
10219 esac
10220 case "$i8type" in
10221 '')     if $test $charsize -ge 1; then
10222                 i8type=char
10223                 u8type="unsigned char"
10224                 i8size=$charsize
10225                 u8size=$charsize
10226         fi
10227         ;;
10228 esac
10229
10230 case "$i16type" in
10231 '')     case "$shortsize" in
10232         2)      i16type=short
10233                 u16type="unsigned short"
10234                 i16size=$shortsize
10235                 u16size=$shortsize
10236                 ;;
10237         esac
10238         ;;
10239 esac
10240 case "$i16type" in
10241 '')     set try -DINT16
10242         if eval $compile; then
10243                 case "`./try$exe_ext`" in
10244                 int16_t)
10245                         i16type=int16_t
10246                         u16type=uint16_t
10247                         i16size=2
10248                         u16size=2
10249                         ;;
10250                 esac
10251         fi
10252         ;;
10253 esac
10254 case "$i16type" in
10255 '')     if $test $shortsize -ge 2; then
10256                 i16type=short
10257                 u16type="unsigned short"
10258                 i16size=$shortsize
10259                 u16size=$shortsize
10260         fi
10261         ;;
10262 esac
10263
10264 case "$i32type" in
10265 '')     case "$longsize" in
10266         4)      i32type=long
10267                 u32type="unsigned long"
10268                 i32size=$longsize
10269                 u32size=$longsize
10270                 ;;
10271         *)      case "$intsize" in
10272                 4)      i32type=int
10273                         u32type="unsigned int"
10274                         i32size=$intsize
10275                         u32size=$intsize
10276                         ;;
10277                 esac
10278                 ;;
10279         esac
10280         ;;
10281 esac
10282 case "$i32type" in
10283 '')     set try -DINT32
10284         if eval $compile; then
10285                 case "`./try$exe_ext`" in
10286                 int32_t)
10287                         i32type=int32_t
10288                         u32type=uint32_t
10289                         i32size=4
10290                         u32size=4
10291                         ;;
10292                 esac
10293         fi
10294         ;;
10295 esac
10296 case "$i32type" in
10297 '')     if $test $intsize -ge 4; then
10298                 i32type=int
10299                 u32type="unsigned int"
10300                 i32size=$intsize
10301                 u32size=$intsize
10302         fi
10303         ;;
10304 esac
10305
10306 case "$i64type" in
10307 '')     case "$d_quad:$quadtype" in
10308         define:?*)
10309                 i64type="$quadtype"
10310                 u64type="$uquadtype"
10311                 i64size=8
10312                 u64size=8
10313                 ;;
10314         esac
10315         ;;
10316 esac
10317
10318 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
10319 : volatile so that the compiler has to store it out to memory.
10320 if test X"$d_volatile" = X"$define"; then
10321         volatile=volatile
10322 fi
10323 $cat <<EOP >try.c
10324 #include <stdio.h>
10325 #include <sys/types.h>
10326 #include <signal.h>
10327 #ifdef SIGFPE
10328 $volatile int bletched = 0;
10329 $signal_t blech(s) int s; { bletched = 1; }
10330 #endif
10331 int main() {
10332     $uvtype u = 0;
10333     $nvtype d;
10334     int     n = 8 * $uvsize;
10335     int     i;
10336 #ifdef SIGFPE
10337     signal(SIGFPE, blech);
10338 #endif
10339
10340     for (i = 0; i < n; i++) {
10341       u = u << 1 | ($uvtype)1;
10342       d = ($nvtype)u;
10343       if (($uvtype)d != u)
10344         break;
10345       if (d <= 0)
10346         break;
10347       d = ($nvtype)(u - 1);
10348       if (($uvtype)d != (u - 1))
10349         break;
10350 #ifdef SIGFPE
10351       if (bletched) {
10352         break;
10353 #endif
10354       } 
10355     }
10356     printf("%d\n", ((i == n) ? -n : i));
10357     exit(0);
10358 }
10359 EOP
10360 set try
10361
10362 d_nv_preserves_uv="$undef"
10363 if eval $compile; then
10364         d_nv_preserves_uv_bits="`./try$exe_ext`"
10365 fi
10366 case "$d_nv_preserves_uv_bits" in
10367 \-[1-9]*)       
10368         d_nv_preserves_uv_bits=`expr 0 - $d_nv_preserves_uv_bits`
10369         $echo "Your NVs can preserve all $d_nv_preserves_uv_bits bits of your UVs."  2>&1
10370         d_nv_preserves_uv="$define"
10371         ;;
10372 [1-9]*) $echo "Your NVs can preserve only $d_nv_preserves_uv_bits bits of your UVs."  2>&1
10373         d_nv_preserves_uv="$undef" ;;
10374 *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
10375         d_nv_preserves_uv_bits="$undef" ;;
10376 esac
10377
10378 $rm -f try.* try
10379
10380
10381 : check for off64_t
10382 echo " "
10383 echo "Checking to see if you have off64_t..." >&4
10384 $cat >try.c <<EOCP
10385 #include <sys/types.h>
10386 #include <unistd.h>
10387 int main() { off64_t x = 7; }
10388 EOCP
10389 set try
10390 if eval $compile; then
10391         val="$define"
10392         echo "You have off64_t."
10393 else
10394         val="$undef"
10395         echo "You do not have off64_t."
10396         case "$lseeksize" in
10397         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
10398         esac
10399 fi
10400 $rm -f try.* try
10401 set d_off64_t
10402 eval $setvar
10403
10404 : see if POSIX threads are available
10405 set pthread.h i_pthread
10406 eval $inhdr
10407
10408
10409
10410
10411 : how to create joinable pthreads
10412 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
10413         echo " "
10414         echo "Checking what constant to use for creating joinable pthreads..." >&4 
10415         $cat >try.c <<'EOCP'
10416 #include <pthread.h>
10417 int main() {
10418     int detachstate = JOINABLE;
10419 }
10420 EOCP
10421         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
10422         if eval $compile; then
10423                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
10424                 val="$undef" # Yes, undef.
10425                 set d_old_pthread_create_joinable
10426                 eval $setvar
10427                 val=""
10428                 set old_pthread_create_joinable
10429                 eval $setvar
10430         else
10431                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
10432                 if eval $compile; then
10433                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
10434                         val="$define"
10435                         set d_old_pthread_create_joinable
10436                         eval $setvar
10437                         val=PTHREAD_CREATE_UNDETACHED
10438                         set old_pthread_create_joinable
10439                         eval $setvar
10440                 else            
10441                         set try -DJOINABLE=__UNDETACHED
10442                         if eval $compile; then
10443                                 echo "You seem to use __UNDETACHED." >&4
10444                                 val="$define"
10445                                 set d_old_pthread_create_joinable
10446                                 eval $setvar
10447                                 val=__UNDETACHED
10448                                 set old_pthread_create_joinable
10449                                 eval $setvar
10450                         else
10451                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
10452                                 val="$define"
10453                                 set d_old_pthread_create_joinable
10454                                 eval $setvar
10455                                 val=0
10456                                 set old_pthread_create_joinable
10457                                 eval $setvar
10458                         fi
10459                 fi
10460         fi
10461         $rm -f try try.*
10462 else
10463     d_old_pthread_create_joinable="$undef"
10464     old_pthread_create_joinable=""
10465 fi
10466
10467 : see if pause exists
10468 set pause d_pause
10469 eval $inlibc
10470
10471 : see if pipe exists
10472 set pipe d_pipe
10473 eval $inlibc
10474
10475 : see if poll exists
10476 set poll d_poll
10477 eval $inlibc
10478
10479
10480 : see whether the various POSIXish _yields exist
10481 $cat >try.c <<EOP
10482 #include <pthread.h>
10483 #include <stdio.h>
10484 int main() {
10485 #ifdef SCHED_YIELD
10486         sched_yield();
10487 #else
10488 #ifdef PTHREAD_YIELD
10489         pthread_yield();
10490 #else
10491 #ifdef PTHREAD_YIELD_NULL
10492         pthread_yield(NULL);
10493 #endif
10494 #endif
10495 #endif
10496 }
10497 EOP
10498 : see if sched_yield exists
10499 set try -DSCHED_YIELD
10500 if eval $compile; then
10501     val="$define"
10502     sched_yield='sched_yield()'
10503 else
10504     val="$undef"
10505 fi
10506 case "$usethreads" in
10507 $define)
10508         case "$val" in
10509         $define) echo 'sched_yield() found.' >&4        ;;
10510         *)       echo 'sched_yield() NOT found.' >&4    ;;
10511         esac
10512 esac
10513 set d_sched_yield
10514 eval $setvar
10515
10516 : see if pthread_yield exists
10517 set try -DPTHREAD_YIELD
10518 if eval $compile; then
10519     val="$define"
10520     case "$sched_yield" in
10521     '') sched_yield='pthread_yield()' ;;
10522     esac
10523 else
10524     set try -DPTHREAD_YIELD_NULL
10525     if eval $compile; then
10526         val="$define"
10527         case "$sched_yield" in
10528         '') sched_yield='pthread_yield(NULL)' ;;
10529         esac
10530     else
10531         val="$undef"
10532     fi
10533 fi
10534 case "$usethreads" in
10535 $define)
10536         case "$val" in
10537         $define) echo 'pthread_yield() found.' >&4      ;;
10538         *)       echo 'pthread_yield() NOT found.' >&4  ;;
10539         esac
10540         ;;
10541 esac
10542 set d_pthread_yield
10543 eval $setvar
10544
10545 case "$sched_yield" in
10546 '') sched_yield=undef ;;
10547 esac
10548
10549 $rm -f try try.*
10550
10551 : see if this is a pwd.h system
10552 set pwd.h i_pwd
10553 eval $inhdr
10554
10555 case "$i_pwd" in
10556 $define)
10557         xxx=`./findhdr pwd.h`
10558         $cppstdin $cppflags $cppminus < $xxx >$$.h
10559
10560         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
10561                 val="$define"
10562         else
10563                 val="$undef"
10564         fi
10565         set d_pwquota
10566         eval $setvar
10567
10568         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
10569                 val="$define"
10570         else
10571                 val="$undef"
10572         fi
10573         set d_pwage
10574         eval $setvar
10575
10576         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
10577                 val="$define"
10578         else
10579                 val="$undef"
10580         fi
10581         set d_pwchange
10582         eval $setvar
10583
10584         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
10585                 val="$define"
10586         else
10587                 val="$undef"
10588         fi
10589         set d_pwclass
10590         eval $setvar
10591
10592         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
10593                 val="$define"
10594         else
10595                 val="$undef"
10596         fi
10597         set d_pwexpire
10598         eval $setvar
10599
10600         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
10601                 val="$define"
10602         else
10603                 val="$undef"
10604         fi
10605         set d_pwcomment
10606         eval $setvar
10607
10608         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
10609                 val="$define"
10610         else
10611                 val="$undef"
10612         fi
10613         set d_pwgecos
10614         eval $setvar
10615
10616         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
10617                 val="$define"
10618         else
10619                 val="$undef"
10620         fi
10621         set d_pwpasswd
10622         eval $setvar
10623
10624         $rm -f $$.h
10625         ;;
10626 *)
10627         val="$undef"; 
10628         set d_pwquota; eval $setvar
10629         set d_pwage; eval $setvar
10630         set d_pwchange; eval $setvar
10631         set d_pwclass; eval $setvar
10632         set d_pwexpire; eval $setvar
10633         set d_pwcomment; eval $setvar
10634         set d_pwgecos; eval $setvar
10635         set d_pwpasswd; eval $setvar
10636         ;;
10637 esac
10638
10639 : see if readdir and friends exist
10640 set readdir d_readdir
10641 eval $inlibc
10642 set seekdir d_seekdir
10643 eval $inlibc
10644 set telldir d_telldir
10645 eval $inlibc
10646 set rewinddir d_rewinddir
10647 eval $inlibc
10648
10649 : see if readlink exists
10650 set readlink d_readlink
10651 eval $inlibc
10652
10653 : see if rename exists
10654 set rename d_rename
10655 eval $inlibc
10656
10657 : see if rmdir exists
10658 set rmdir d_rmdir
10659 eval $inlibc
10660
10661 : see if memory.h is available.
10662 val=''
10663 set memory.h val
10664 eval $inhdr
10665
10666 : See if it conflicts with string.h
10667 case "$val" in
10668 $define)
10669         case "$strings" in
10670         '') ;;
10671         *)
10672                 $cppstdin $cppflags $cppminus < $strings > mem.h
10673                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
10674                         echo " "
10675                         echo "We won't be including <memory.h>."
10676                         val="$undef"
10677                 fi
10678                 $rm -f mem.h
10679                 ;;
10680         esac
10681 esac
10682 set i_memory
10683 eval $setvar
10684
10685 : can bcopy handle overlapping blocks?
10686 val="$undef"
10687 case "$d_bcopy" in
10688 "$define")
10689         echo " "
10690         echo "Checking to see if your bcopy() can do overlapping copies..." >&4
10691         $cat >try.c <<EOCP
10692 #$i_memory I_MEMORY
10693 #$i_stdlib I_STDLIB
10694 #$i_string I_STRING
10695 #$i_unistd I_UNISTD
10696 EOCP
10697         $cat >>try.c <<'EOCP'
10698 #include <stdio.h>
10699 #ifdef I_MEMORY
10700 #  include <memory.h>
10701 #endif
10702 #ifdef I_STDLIB
10703 #  include <stdlib.h>
10704 #endif
10705 #ifdef I_STRING
10706 #  include <string.h>
10707 #else
10708 #  include <strings.h>
10709 #endif
10710 #ifdef I_UNISTD
10711 #  include <unistd.h>  /* Needed for NetBSD */
10712 #endif
10713 int main()
10714 {
10715 char buf[128], abc[128];
10716 char *b;
10717 int len;
10718 int off;
10719 int align;
10720
10721 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
10722
10723 for (align = 7; align >= 0; align--) {
10724         for (len = 36; len; len--) {
10725                 b = buf+align;
10726                 bcopy(abc, b, len);
10727                 for (off = 1; off <= len; off++) {
10728                         bcopy(b, b+off, len);
10729                         bcopy(b+off, b, len);
10730                         if (bcmp(b, abc, len))
10731                                 exit(1);
10732                 }
10733         }
10734 }
10735 exit(0);
10736 }
10737 EOCP
10738         set try
10739         if eval $compile_ok; then
10740                 if ./try 2>/dev/null; then
10741                         echo "Yes, it can."
10742                         val="$define"
10743                 else
10744                         echo "It can't, sorry."
10745                         case "$d_memmove" in
10746                         "$define") echo "But that's Ok since you have memmove()." ;;
10747                         esac
10748                 fi
10749         else
10750                 echo "(I can't compile the test program, so we'll assume not...)"
10751                 case "$d_memmove" in
10752                 "$define") echo "But that's Ok since you have memmove()." ;;
10753                 esac
10754         fi
10755         ;;
10756 esac
10757 $rm -f try.* try core
10758 set d_safebcpy
10759 eval $setvar
10760
10761 : can memcpy handle overlapping blocks?
10762 val="$undef"
10763 case "$d_memcpy" in
10764 "$define")
10765         echo " "
10766         echo "Checking to see if your memcpy() can do overlapping copies..." >&4
10767         $cat >try.c <<EOCP
10768 #$i_memory I_MEMORY
10769 #$i_stdlib I_STDLIB
10770 #$i_string I_STRING
10771 #$i_unistd I_UNISTD
10772 EOCP
10773         $cat >>try.c <<'EOCP'
10774 #include <stdio.h>
10775 #ifdef I_MEMORY
10776 #  include <memory.h>
10777 #endif
10778 #ifdef I_STDLIB
10779 #  include <stdlib.h>
10780 #endif
10781 #ifdef I_STRING
10782 #  include <string.h>
10783 #else
10784 #  include <strings.h>
10785 #endif
10786 #ifdef I_UNISTD
10787 #  include <unistd.h>  /* Needed for NetBSD */
10788 #endif
10789 int main()
10790 {
10791 char buf[128], abc[128];
10792 char *b;
10793 int len;
10794 int off;
10795 int align;
10796
10797 /* Copy "abcde..." string to char abc[] so that gcc doesn't
10798    try to store the string in read-only memory. */
10799 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
10800
10801 for (align = 7; align >= 0; align--) {
10802         for (len = 36; len; len--) {
10803                 b = buf+align;
10804                 memcpy(b, abc, len);
10805                 for (off = 1; off <= len; off++) {
10806                         memcpy(b+off, b, len);
10807                         memcpy(b, b+off, len);
10808                         if (memcmp(b, abc, len))
10809                                 exit(1);
10810                 }
10811         }
10812 }
10813 exit(0);
10814 }
10815 EOCP
10816         set try
10817         if eval $compile_ok; then
10818                 if ./try 2>/dev/null; then
10819                         echo "Yes, it can."
10820                         val="$define"
10821                 else
10822                         echo "It can't, sorry."
10823                         case "$d_memmove" in
10824                         "$define") echo "But that's Ok since you have memmove()." ;;
10825                         esac
10826                 fi
10827         else
10828                 echo "(I can't compile the test program, so we'll assume not...)"
10829                 case "$d_memmove" in
10830                 "$define") echo "But that's Ok since you have memmove()." ;;
10831                 esac
10832         fi
10833         ;;
10834 esac
10835 $rm -f try.* try core
10836 set d_safemcpy
10837 eval $setvar
10838
10839 : can memcmp be trusted to compare relative magnitude?
10840 val="$undef"
10841 case "$d_memcmp" in
10842 "$define")
10843         echo " "
10844         echo "Checking if your memcmp() can compare relative magnitude..." >&4
10845         $cat >try.c <<EOCP
10846 #$i_memory I_MEMORY
10847 #$i_stdlib I_STDLIB
10848 #$i_string I_STRING
10849 #$i_unistd I_UNISTD
10850 EOCP
10851         $cat >>try.c <<'EOCP'
10852 #include <stdio.h>
10853 #ifdef I_MEMORY
10854 #  include <memory.h>
10855 #endif
10856 #ifdef I_STDLIB
10857 #  include <stdlib.h>
10858 #endif
10859 #ifdef I_STRING
10860 #  include <string.h>
10861 #else
10862 #  include <strings.h>
10863 #endif
10864 #ifdef I_UNISTD
10865 #  include <unistd.h>  /* Needed for NetBSD */
10866 #endif
10867 int main()
10868 {
10869 char a = -1;
10870 char b = 0;
10871 if ((a < b) && memcmp(&a, &b, 1) < 0)
10872         exit(1);
10873 exit(0);
10874 }
10875 EOCP
10876         set try
10877         if eval $compile_ok; then
10878                 if ./try 2>/dev/null; then
10879                         echo "Yes, it can."
10880                         val="$define"
10881                 else
10882                         echo "No, it can't (it uses signed chars)."
10883                 fi
10884         else
10885                 echo "(I can't compile the test program, so we'll assume not...)"
10886         fi
10887         ;;
10888 esac
10889 $rm -f try.* try core
10890 set d_sanemcmp
10891 eval $setvar
10892
10893 : see if select exists
10894 set select d_select
10895 eval $inlibc
10896
10897 : see if semctl exists
10898 set semctl d_semctl
10899 eval $inlibc
10900
10901 : see if semget exists
10902 set semget d_semget
10903 eval $inlibc
10904
10905 : see if semop exists
10906 set semop d_semop
10907 eval $inlibc
10908
10909 : see how much of the 'sem*(2)' library is present.
10910 h_sem=true
10911 echo " "
10912 case "$d_semctl$d_semget$d_semop" in
10913 *"$undef"*) h_sem=false;;
10914 esac
10915 case "$osname" in
10916 freebsd)
10917     case "`ipcs 2>&1`" in
10918     "SVID messages"*"not configured"*)
10919         echo "Your $osname does not have the sem*(2) configured." >&4
10920         h_sem=false
10921         val="$undef"
10922         set semctl d_semctl
10923         eval $setvar
10924         set semget d_semget
10925         eval $setvar
10926         set semop d_semop
10927         eval $setvar
10928         ;;
10929     esac
10930     ;;
10931 esac
10932 : we could also check for sys/ipc.h ...
10933 if $h_sem && $test `./findhdr sys/sem.h`; then
10934         echo "You have the full sem*(2) library." >&4
10935         val="$define"
10936 else
10937         echo "You don't have the full sem*(2) library." >&4
10938         val="$undef"
10939 fi
10940 set d_sem
10941 eval $setvar
10942
10943 : see whether sys/sem.h defines union semun
10944 echo " "
10945 $cat > try.c <<'END'
10946 #include <sys/types.h>
10947 #include <sys/ipc.h>
10948 #include <sys/sem.h>
10949 int main () { union semun semun; semun.buf = 0; }
10950 END
10951 set try
10952 if eval $compile; then
10953     echo "You have union semun in <sys/sem.h>." >&4
10954     val="$define"
10955 else
10956     echo "You do not have union semun in <sys/sem.h>." >&4
10957     val="$undef"
10958 fi
10959 $rm -f try try.c try.h
10960 set d_union_semun
10961 eval $setvar
10962
10963 : see how to do semctl IPC_STAT
10964 case "$d_sem" in
10965 $define)
10966     : see whether semctl IPC_STAT can use union semun
10967     echo " "
10968     $cat > try.h <<END
10969 #ifndef S_IRUSR
10970 #   ifdef S_IREAD
10971 #       define S_IRUSR S_IREAD
10972 #       define S_IWUSR S_IWRITE
10973 #       define S_IXUSR S_IEXEC
10974 #   else
10975 #       define S_IRUSR 0400
10976 #       define S_IWUSR 0200
10977 #       define S_IXUSR 0100
10978 #   endif
10979 #   define S_IRGRP (S_IRUSR>>3)
10980 #   define S_IWGRP (S_IWUSR>>3)
10981 #   define S_IXGRP (S_IXUSR>>3)
10982 #   define S_IROTH (S_IRUSR>>6)
10983 #   define S_IWOTH (S_IWUSR>>6)
10984 #   define S_IXOTH (S_IXUSR>>6)
10985 #endif
10986 #ifndef S_IRWXU
10987 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
10988 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
10989 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
10990 #endif
10991 END
10992
10993     $cat > try.c <<END
10994 #include <sys/types.h>
10995 #include <sys/ipc.h>
10996 #include <sys/sem.h>
10997 #include <sys/stat.h>
10998 #include <stdio.h>
10999 #include <errno.h>
11000 #include "try.h"
11001 #ifndef errno
11002 extern int errno;
11003 #endif
11004 #$d_union_semun HAS_UNION_SEMUN
11005 int main() {
11006     union semun
11007 #ifndef HAS_UNION_SEMUN
11008     {
11009         int val;
11010         struct semid_ds *buf;
11011         unsigned short *array;
11012     }
11013 #endif
11014     arg;
11015     int sem, st;
11016
11017 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
11018     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
11019     if (sem > -1) {
11020         struct semid_ds argbuf;
11021         arg.buf = &argbuf;
11022 #       ifdef IPC_STAT
11023         st = semctl(sem, 0, IPC_STAT, arg);
11024         if (st == 0)
11025             printf("semun\n");
11026         else
11027 #       endif /* IPC_STAT */
11028             printf("semctl IPC_STAT failed: errno = %d\n", errno);
11029 #       ifdef IPC_RMID
11030         if (semctl(sem, 0, IPC_RMID, arg) != 0)
11031 #       endif /* IPC_RMID */
11032             printf("semctl IPC_RMID failed: errno = %d\n", errno);
11033     } else
11034 #endif /* IPC_PRIVATE && ... */
11035         printf("semget failed: errno = %d\n", errno);
11036   return 0;
11037 }
11038 END
11039     val="$undef"
11040     set try
11041     if eval $compile; then
11042         xxx=`./try`
11043         case "$xxx" in
11044         semun) val="$define" ;;
11045         esac
11046     fi
11047     $rm -f try try.c
11048     set d_semctl_semun
11049     eval $setvar
11050     case "$d_semctl_semun" in
11051     $define)
11052         echo "You can use union semun for semctl IPC_STAT." >&4
11053         also='also'
11054         ;;
11055     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
11056         also=''
11057         ;;
11058     esac
11059
11060     : see whether semctl IPC_STAT can use struct semid_ds pointer
11061     $cat > try.c <<'END'
11062 #include <sys/types.h>
11063 #include <sys/ipc.h>
11064 #include <sys/sem.h>
11065 #include <sys/stat.h>
11066 #include "try.h"
11067 #include <stdio.h>
11068 #include <errno.h>
11069 #ifndef errno
11070 extern int errno;
11071 #endif
11072 int main() {
11073     struct semid_ds arg;
11074     int sem, st;
11075
11076 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
11077     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
11078     if (sem > -1) {
11079 #       ifdef IPC_STAT
11080         st = semctl(sem, 0, IPC_STAT, &arg);
11081         if (st == 0)
11082             printf("semid_ds\n");
11083         else
11084 #       endif /* IPC_STAT */
11085             printf("semctl IPC_STAT failed: errno = %d\n", errno);
11086 #       ifdef IPC_RMID
11087         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
11088 #       endif /* IPC_RMID */
11089             printf("semctl IPC_RMID failed: errno = %d\n", errno);
11090     } else
11091 #endif /* IPC_PRIVATE && ... */
11092         printf("semget failed: errno = %d\n", errno);
11093
11094     return 0;
11095 }
11096 END
11097     val="$undef"
11098     set try
11099     if eval $compile; then
11100         xxx=`./try`
11101         case "$xxx" in
11102         semid_ds) val="$define" ;;
11103         esac
11104     fi
11105     $rm -f try try.c
11106     set d_semctl_semid_ds
11107     eval $setvar
11108     case "$d_semctl_semid_ds" in
11109     $define)
11110         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
11111         ;;
11112     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
11113         ;;
11114     esac
11115     $rm -f try.h
11116     ;;
11117 *)  val="$undef"
11118
11119     # We do not have the full sem*(2) library, so assume we can not
11120     # use either.
11121
11122     set d_semctl_semun
11123     eval $setvar
11124
11125     set d_semctl_semid_ds
11126     eval $setvar
11127     ;;
11128 esac
11129
11130 : see if setegid exists
11131 set setegid d_setegid
11132 eval $inlibc
11133
11134 : see if seteuid exists
11135 set seteuid d_seteuid
11136 eval $inlibc
11137
11138 : see if setgrent exists
11139 set setgrent d_setgrent
11140 eval $inlibc
11141
11142 : see if sethostent exists
11143 set sethostent d_sethent
11144 eval $inlibc
11145
11146 : see if setlinebuf exists
11147 set setlinebuf d_setlinebuf
11148 eval $inlibc
11149
11150 : see if setlocale exists
11151 set setlocale d_setlocale
11152 eval $inlibc
11153
11154 : see if setnetent exists
11155 set setnetent d_setnent
11156 eval $inlibc
11157
11158 : see if setprotoent exists
11159 set setprotoent d_setpent
11160 eval $inlibc
11161
11162 : see if setpgid exists
11163 set setpgid d_setpgid
11164 eval $inlibc
11165
11166 : see if setpgrp2 exists
11167 set setpgrp2 d_setpgrp2
11168 eval $inlibc
11169
11170 : see if setpriority exists
11171 set setpriority d_setprior
11172 eval $inlibc
11173
11174 : see if setproctitle exists
11175 set setproctitle d_setproctitle
11176 eval $inlibc
11177
11178 : see if setpwent exists
11179 set setpwent d_setpwent
11180 eval $inlibc
11181
11182 : see if setregid exists
11183 set setregid d_setregid
11184 eval $inlibc
11185 set setresgid d_setresgid
11186 eval $inlibc
11187
11188 : see if setreuid exists
11189 set setreuid d_setreuid
11190 eval $inlibc
11191 set setresuid d_setresuid
11192 eval $inlibc
11193
11194 : see if setrgid exists
11195 set setrgid d_setrgid
11196 eval $inlibc
11197
11198 : see if setruid exists
11199 set setruid d_setruid
11200 eval $inlibc
11201
11202 : see if setservent exists
11203 set setservent d_setsent
11204 eval $inlibc
11205
11206 : see if setsid exists
11207 set setsid d_setsid
11208 eval $inlibc
11209
11210 : see if setvbuf exists
11211 set setvbuf d_setvbuf
11212 eval $inlibc
11213
11214 : see if sfio.h is available
11215 set sfio.h i_sfio
11216 eval $inhdr
11217
11218
11219 : see if sfio library is available
11220 case "$i_sfio" in
11221 $define)
11222         val=''
11223         set sfreserve val
11224         eval $inlibc
11225         ;;
11226 *)
11227         val="$undef"
11228         ;;
11229 esac
11230 : Ok, but do we want to use it.
11231 case "$val" in
11232 $define)
11233         case "$usesfio" in
11234         true|$define|[yY]*) dflt='y';;
11235         *) dflt='n';;
11236         esac
11237         echo "$package can use the sfio library, but it is experimental."
11238         case "$useperlio" in
11239         "$undef")
11240             echo "For sfio also the PerlIO abstraction layer is needed."
11241             echo "Earlier you said you wouldn't want that."
11242             ;;
11243         esac
11244         rp="You seem to have sfio available, do you want to try using it?"
11245         . ./myread
11246         case "$ans" in
11247         y|Y)    echo "Ok, turning on both sfio and PerlIO, then."
11248                 useperlio="$define"
11249                 val="$define"
11250                 ;;
11251         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
11252                 val="$undef"
11253                 : Remove sfio from list of libraries to use
11254                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
11255                 shift
11256                 libs="$*"
11257                 echo "libs = $libs" >&4
11258                 ;;
11259         esac
11260         ;;
11261 *)      case "$usesfio" in
11262         true|$define|[yY]*)
11263                 echo "Sorry, cannot find sfio on this machine." >&4
11264                 echo "Ignoring your setting of usesfio=$usesfio." >&4
11265                 val="$undef"
11266                 ;;
11267         esac
11268         ;;
11269 esac
11270 set d_sfio
11271 eval $setvar
11272 case "$d_sfio" in
11273 $define) usesfio='true';;
11274 *) usesfio='false';;
11275 esac
11276
11277 : see if shmctl exists
11278 set shmctl d_shmctl
11279 eval $inlibc
11280
11281 : see if shmget exists
11282 set shmget d_shmget
11283 eval $inlibc
11284
11285 : see if shmat exists
11286 set shmat d_shmat
11287 eval $inlibc
11288 : see what shmat returns
11289 case "$d_shmat" in
11290 "$define")
11291         $cat >shmat.c <<'END'
11292 #include <sys/shm.h>
11293 void *shmat();
11294 END
11295         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
11296                 shmattype='void *'
11297         else
11298                 shmattype='char *'
11299         fi
11300         echo "and it returns ($shmattype)." >&4
11301         : see if a prototype for shmat is available
11302         xxx=`./findhdr sys/shm.h`
11303         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
11304         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
11305                 val="$define"
11306         else
11307                 val="$undef"
11308         fi
11309         $rm -f shmat.[co]
11310         ;;
11311 *)
11312         val="$undef"
11313         ;;
11314 esac
11315 set d_shmatprototype
11316 eval $setvar
11317
11318 : see if shmdt exists
11319 set shmdt d_shmdt
11320 eval $inlibc
11321
11322 : see how much of the 'shm*(2)' library is present.
11323 h_shm=true
11324 echo " "
11325 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
11326 *"$undef"*) h_shm=false;;
11327 esac
11328 case "$osname" in
11329 freebsd)
11330     case "`ipcs 2>&1`" in
11331     "SVID shared memory"*"not configured"*)
11332         echo "Your $osname does not have the shm*(2) configured." >&4
11333         h_shm=false
11334         val="$undef"
11335         set shmctl d_shmctl
11336         evat $setvar
11337         set shmget d_shmget
11338         evat $setvar
11339         set shmat d_shmat
11340         evat $setvar
11341         set shmdt d_shmdt
11342         evat $setvar
11343         ;;
11344     esac
11345     ;;
11346 esac
11347 : we could also check for sys/ipc.h ...
11348 if $h_shm && $test `./findhdr sys/shm.h`; then
11349         echo "You have the full shm*(2) library." >&4
11350         val="$define"
11351 else
11352         echo "You don't have the full shm*(2) library." >&4
11353         val="$undef"
11354 fi
11355 set d_shm
11356 eval $setvar
11357
11358 echo " "
11359 : see if we have sigaction
11360 if set sigaction val -f d_sigaction; eval $csym; $val; then
11361         echo 'sigaction() found.' >&4
11362         $cat > try.c <<'EOP'
11363 #include <stdio.h>
11364 #include <sys/types.h>
11365 #include <signal.h>
11366 int main()
11367 {
11368     struct sigaction act, oact;
11369     act.sa_flags = 0;
11370     oact.sa_handler = 0;
11371     /* so that act and oact are used */
11372     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
11373 }
11374 EOP
11375         set try
11376         if eval $compile_ok; then
11377                 val="$define"
11378         else
11379                 echo "But you don't seem to have a useable struct sigaction." >&4
11380                 val="$undef"
11381         fi
11382 else
11383         echo 'sigaction NOT found.' >&4
11384         val="$undef"
11385 fi
11386 set d_sigaction; eval $setvar
11387 $rm -f try try$_o try.c
11388
11389 : see if sigsetjmp exists
11390 echo " "
11391 case "$d_sigsetjmp" in
11392 '')
11393         $cat >try.c <<'EOP'
11394 #include <setjmp.h>
11395 sigjmp_buf env;
11396 int set = 1;
11397 int main()
11398 {
11399         if (sigsetjmp(env,1))
11400                 exit(set);
11401         set = 0;
11402         siglongjmp(env, 1);
11403         exit(1);
11404 }
11405 EOP
11406         set try
11407         if eval $compile; then
11408                 if ./try >/dev/null 2>&1; then
11409                         echo "POSIX sigsetjmp found." >&4
11410                         val="$define"
11411                 else
11412                         $cat >&4 <<EOM
11413 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
11414 I'll ignore them.
11415 EOM
11416                         val="$undef"
11417                 fi
11418         else
11419                 echo "sigsetjmp not found." >&4
11420                 val="$undef"
11421         fi
11422         ;;
11423 *) val="$d_sigsetjmp"
11424         case "$d_sigsetjmp" in
11425         $define) echo "POSIX sigsetjmp found." >&4;;
11426         $undef) echo "sigsetjmp not found." >&4;;
11427         esac
11428         ;;
11429 esac
11430 set d_sigsetjmp
11431 eval $setvar
11432 $rm -f try.c try
11433
11434 : see if socks5_init exists
11435 set socks5_init d_socks5_init
11436 eval $inlibc
11437
11438 : see if sys/stat.h is available
11439 set sys/stat.h i_sysstat
11440 eval $inhdr
11441
11442
11443 : see if stat knows about block sizes
11444 echo " "
11445 echo "Checking to see if your struct stat has st_blocks field..." >&4
11446 set d_statblks stat st_blocks $i_sysstat sys/stat.h
11447 eval $hasfield
11448
11449
11450 : see if this is a sys/vfs.h system
11451 set sys/vfs.h i_sysvfs
11452 eval $inhdr
11453
11454
11455 : see if this is a sys/statfs.h system
11456 set sys/statfs.h i_sysstatfs
11457 eval $inhdr
11458
11459
11460 echo " "
11461 echo "Checking to see if your system supports struct statfs..." >&4
11462 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
11463 eval $hasstruct
11464 case "$d_statfs_s" in
11465 "$define")      echo "Yes, it does."   ;;
11466 *)              echo "No, it doesn't." ;;
11467 esac
11468
11469
11470
11471 : see if struct statfs knows about f_flags
11472 case "$d_statfs_s" in
11473 define) 
11474         echo " "
11475         echo "Checking to see if your struct statfs has f_flags field..." >&4
11476         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
11477         eval $hasfield
11478         ;;
11479 *)      val="$undef"
11480         set d_statfs_f_flags
11481         eval $setvar
11482         ;;
11483 esac
11484 case "$d_statfs_f_flags" in
11485 "$define")      echo "Yes, it does."   ;;
11486 *)              echo "No, it doesn't." ;;
11487 esac
11488
11489 : see if _ptr and _cnt from stdio act std
11490 echo " "
11491
11492 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
11493         echo "(Looks like you have stdio.h from BSD.)"
11494         case "$stdio_ptr" in
11495         '') stdio_ptr='((fp)->_p)'
11496                 ptr_lval=$define
11497                 ;;
11498         *)      ptr_lval=$d_stdio_ptr_lval;;
11499         esac
11500         case "$stdio_cnt" in
11501         '') stdio_cnt='((fp)->_r)'
11502                 cnt_lval=$define
11503                 ;;
11504         *)      cnt_lval=$d_stdio_cnt_lval;;
11505         esac
11506         case "$stdio_base" in
11507         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
11508         esac
11509         case "$stdio_bufsiz" in
11510         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
11511         esac
11512 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
11513         echo "(Looks like you have stdio.h from Linux.)"
11514         case "$stdio_ptr" in
11515         '') stdio_ptr='((fp)->_IO_read_ptr)'
11516                 ptr_lval=$define
11517                 ;;
11518         *)      ptr_lval=$d_stdio_ptr_lval;;
11519         esac
11520         case "$stdio_cnt" in
11521         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
11522                 cnt_lval=$undef
11523                 ;;
11524         *)      cnt_lval=$d_stdio_cnt_lval;;
11525         esac
11526         case "$stdio_base" in
11527         '') stdio_base='((fp)->_IO_read_base)';;
11528         esac
11529         case "$stdio_bufsiz" in
11530         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
11531         esac
11532 else
11533         case "$stdio_ptr" in
11534         '') stdio_ptr='((fp)->_ptr)'
11535                 ptr_lval=$define
11536                 ;;
11537         *)      ptr_lval=$d_stdio_ptr_lval;;
11538         esac
11539         case "$stdio_cnt" in
11540         '') stdio_cnt='((fp)->_cnt)'
11541                 cnt_lval=$define
11542                 ;;
11543         *)      cnt_lval=$d_stdio_cnt_lval;;
11544         esac
11545         case "$stdio_base" in
11546         '') stdio_base='((fp)->_base)';;
11547         esac
11548         case "$stdio_bufsiz" in
11549         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
11550         esac
11551 fi
11552
11553 : test whether _ptr and _cnt really work
11554 echo "Checking how std your stdio is..." >&4
11555 $cat >try.c <<EOP
11556 #include <stdio.h>
11557 #define FILE_ptr(fp)    $stdio_ptr
11558 #define FILE_cnt(fp)    $stdio_cnt
11559 int main() {
11560         FILE *fp = fopen("try.c", "r");
11561         char c = getc(fp);
11562         if (
11563                 18 <= FILE_cnt(fp) &&
11564                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
11565         )
11566                 exit(0);
11567         exit(1);
11568 }
11569 EOP
11570 val="$undef"
11571 set try
11572 if eval $compile; then
11573         if ./try; then
11574                 echo "Your stdio acts pretty std."
11575                 val="$define"
11576         else
11577                 echo "Your stdio isn't very std."
11578         fi
11579 else
11580         echo "Your stdio doesn't appear very std."
11581 fi
11582 $rm -f try.c try
11583 set d_stdstdio
11584 eval $setvar
11585
11586 : Can _ptr be used as an lvalue?
11587 case "$d_stdstdio$ptr_lval" in
11588 $define$define) val=$define ;;
11589 *) val=$undef ;;
11590 esac
11591 set d_stdio_ptr_lval
11592 eval $setvar
11593
11594 : Can _cnt be used as an lvalue?
11595 case "$d_stdstdio$cnt_lval" in
11596 $define$define) val=$define ;;
11597 *) val=$undef ;;
11598 esac
11599 set d_stdio_cnt_lval
11600 eval $setvar
11601
11602
11603 : test whether setting _ptr sets _cnt as a side effect
11604 d_stdio_ptr_lval_sets_cnt="$undef"
11605 d_stdio_ptr_lval_nochange_cnt="$undef"
11606 case "$d_stdio_ptr_lval$d_stdstdio" in
11607 $define$define)
11608         echo "Checking to see what happens if we set the stdio ptr..." >&4
11609 $cat >try.c <<EOP
11610 #include <stdio.h>
11611 /* Can we scream? */
11612 /* Eat dust sed :-) */
11613 /* In the buffer space, no one can hear you scream. */
11614 #define FILE_ptr(fp)    $stdio_ptr
11615 #define FILE_cnt(fp)    $stdio_cnt
11616 #include <sys/types.h>
11617 int main() {
11618         FILE *fp = fopen("try.c", "r");
11619         int c;
11620         char *ptr;
11621         size_t cnt;
11622         if (!fp) {
11623             puts("Fail even to read");
11624             exit(1);
11625         }
11626         c = getc(fp); /* Read away the first # */
11627         if (c == EOF) {
11628             puts("Fail even to read");
11629             exit(1);
11630         }
11631         if (!(
11632                 18 <= FILE_cnt(fp) &&
11633                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
11634         )) {
11635                 puts("Fail even to read");
11636                 exit (1);
11637         }
11638         ptr = (char*) FILE_ptr(fp);
11639         cnt = (size_t)FILE_cnt(fp);
11640
11641         FILE_ptr(fp) += 42;
11642
11643         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
11644                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
11645                 exit (1);
11646         }
11647         if (FILE_cnt(fp) <= 20) {
11648                 printf ("Fail (<20 chars to test)");
11649                 exit (1);
11650         }
11651         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
11652                 puts("Fail compare");
11653                 exit (1);
11654         }
11655         if (cnt == FILE_cnt(fp)) {
11656                 puts("Pass_unchanged");
11657                 exit (0);
11658         }       
11659         if (FILE_cnt(fp) == (cnt - 42)) {
11660                 puts("Pass_changed");
11661                 exit (0);
11662         }
11663         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
11664         return 1;
11665
11666 }
11667 EOP
11668         set try
11669         if eval $compile; then
11670                 case `./try$exe_ext` in
11671                 Pass_changed)
11672                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
11673                         d_stdio_ptr_lval_sets_cnt="$define" ;;
11674                 Pass_unchanged)
11675                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
11676                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
11677                 Fail*)
11678                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
11679                 *)
11680                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
11681         esac
11682         else
11683                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
11684         fi
11685         $rm -f try.c try
11686         ;;
11687 esac
11688
11689 : see if _base is also standard
11690 val="$undef"
11691 case "$d_stdstdio" in
11692 $define)
11693         $cat >try.c <<EOP
11694 #include <stdio.h>
11695 #define FILE_base(fp)   $stdio_base
11696 #define FILE_bufsiz(fp) $stdio_bufsiz
11697 int main() {
11698         FILE *fp = fopen("try.c", "r");
11699         char c = getc(fp);
11700         if (
11701                 19 <= FILE_bufsiz(fp) &&
11702                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
11703         )
11704                 exit(0);
11705         exit(1);
11706 }
11707 EOP
11708         set try
11709         if eval $compile; then
11710                 if ./try; then
11711                         echo "And its _base field acts std."
11712                         val="$define"
11713                 else
11714                         echo "But its _base field isn't std."
11715                 fi
11716         else
11717                 echo "However, it seems to be lacking the _base field."
11718         fi
11719         $rm -f try.c try
11720         ;;
11721 esac
11722 set d_stdiobase
11723 eval $setvar
11724
11725 $cat >&4 <<EOM
11726 Checking how to access stdio streams by file descriptor number...
11727 EOM
11728 case "$stdio_stream_array" in
11729 '')     $cat >try.c <<EOCP
11730 #include <stdio.h>
11731 int main() {
11732   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
11733     printf("yes\n");
11734 }
11735 EOCP
11736         for s in _iob __iob __sF
11737         do
11738                 set try -DSTDIO_STREAM_ARRAY=$s
11739                 if eval $compile; then
11740                         case "`./try$exe_ext`" in
11741                         yes)    stdio_stream_array=$s; break ;;
11742                         esac
11743                 fi
11744         done
11745         $rm -f try.* try$exe_ext
11746 esac
11747 case "$stdio_stream_array" in
11748 '')     $cat >&4 <<EOM
11749 I can't figure out how to access stdio streams by file descriptor number.
11750 EOM
11751         d_stdio_stream_array="$undef"
11752         ;;
11753 *)      $cat >&4 <<EOM
11754 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
11755 EOM
11756         d_stdio_stream_array="$define"
11757         ;;
11758 esac
11759
11760 : see if strcoll exists
11761 set strcoll d_strcoll
11762 eval $inlibc
11763
11764 : check for structure copying
11765 echo " "
11766 echo "Checking to see if your C compiler can copy structs..." >&4
11767 $cat >try.c <<'EOCP'
11768 int main()
11769 {
11770         struct blurfl {
11771                 int dyick;
11772         } foo, bar;
11773
11774         foo = bar;
11775 }
11776 EOCP
11777 if $cc -c try.c >/dev/null 2>&1 ; then
11778         val="$define"
11779         echo "Yup, it can."
11780 else
11781         val="$undef"
11782         echo "Nope, it can't."
11783 fi
11784 set d_strctcpy
11785 eval $setvar
11786 $rm -f try.*
11787
11788 : see if strerror and/or sys_errlist[] exist
11789 echo " "
11790 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
11791     if set strerror val -f d_strerror; eval $csym; $val; then
11792                 echo 'strerror() found.' >&4
11793                 d_strerror="$define"
11794                 d_strerrm='strerror(e)'
11795                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
11796                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
11797                         d_syserrlst="$define"
11798                 else
11799                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
11800                         d_syserrlst="$undef"
11801                 fi
11802     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
11803                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
11804                 echo 'strerror() found in string header.' >&4
11805                 d_strerror="$define"
11806                 d_strerrm='strerror(e)'
11807                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
11808                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
11809                                 d_syserrlst="$define"
11810                 else
11811                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
11812                         d_syserrlst="$undef"
11813                 fi
11814     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
11815                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
11816                 d_strerror="$undef"
11817                 d_syserrlst="$define"
11818                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
11819     else
11820                 echo 'strerror() and sys_errlist[] NOT found.' >&4
11821                 d_strerror="$undef"
11822                 d_syserrlst="$undef"
11823                 d_strerrm='"unknown"'
11824     fi
11825 fi
11826
11827 : see if strtod exists
11828 set strtod d_strtod
11829 eval $inlibc
11830
11831 : see if strtol exists
11832 set strtol d_strtol
11833 eval $inlibc
11834
11835 : see if strtold exists
11836 set strtold d_strtold
11837 eval $inlibc
11838
11839 : see if strtoll exists
11840 set strtoll d_strtoll
11841 eval $inlibc
11842
11843 case "$d_longlong-$d_strtoll" in
11844 "$define-$define")
11845         $cat <<EOM
11846 Checking whether your strtoll() works okay...
11847 EOM
11848         $cat >try.c <<'EOCP'
11849 #include <errno.h>
11850 #ifdef __hpux
11851 #define strtoll __strtoll
11852 #endif
11853 #ifdef __EMX__
11854 #define strtoll _strtoll
11855 #endif
11856 #include <stdio.h>
11857 extern long long int strtoll(char *s, char **, int); 
11858 static int bad = 0;
11859 int check(char *s, long long ell, int een) {
11860         long long gll;
11861         errno = 0;
11862         gll = strtoll(s, 0, 10);
11863         if (!((gll == ell) && (errno == een)))
11864                 bad++;
11865 }
11866 int main() {
11867         check(" 1",                                      1LL, 0);
11868         check(" 0",                                      0LL, 0);
11869         check("-1",                                     -1LL, 0);
11870         check("-9223372036854775808", -9223372036854775808LL, 0);
11871         check("-9223372036854775808", -9223372036854775808LL, 0);
11872         check(" 9223372036854775807",  9223372036854775807LL, 0);
11873         check("-9223372036854775808", -9223372036854775808LL, 0);
11874         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
11875         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
11876         if (!bad)
11877                 printf("ok\n");
11878 }
11879 EOCP
11880         set try
11881         if eval $compile; then
11882                 yyy=`./try`
11883                 case "$yyy" in
11884                 ok) echo "Your strtoll() seems to be working okay." ;;
11885                 *) cat <<EOM >&4
11886 Your strtoll() doesn't seem to be working okay.
11887 EOM
11888                    d_strtoll="$undef"
11889                    ;;
11890                 esac
11891         else
11892                 echo "(I can't seem to compile the test program--assuming it doesn't)"
11893                 d_strtoll="$undef"
11894         fi
11895         ;;
11896 esac
11897
11898 : see if strtoul exists
11899 set strtoul d_strtoul
11900 eval $inlibc
11901
11902 : see if strtoull exists
11903 set strtoull d_strtoull
11904 eval $inlibc
11905
11906 case "$d_longlong-$d_strtoull" in
11907 "$define-$define")
11908         $cat <<EOM
11909 Checking whether your strtoull() works okay...
11910 EOM
11911         $cat >try.c <<'EOCP'
11912 #include <errno.h>
11913 #ifdef __hpux
11914 #define strtoull __strtoull
11915 #endif
11916 #include <stdio.h>
11917 extern unsigned long long int strtoull(char *s, char **, int); 
11918 static int bad = 0;
11919 int check(char *s, long long eull, int een) {
11920         long long gull;
11921         errno = 0;
11922         gull = strtoull(s, 0, 10);
11923         if (!((gull == eull) && (errno == een)))
11924                 bad++;
11925 }
11926 int main() {
11927         check(" 1",                                       1LL, 0);
11928         check(" 0",                                       0LL, 0);
11929         check("18446744073709551615", 18446744073709551615ULL, 0);
11930         check("18446744073709551616", 18446744073709551615ULL, ERANGE);
11931         if (!bad)
11932                 printf("ok\n");
11933 }
11934 EOCP
11935         set try
11936         if eval $compile; then
11937                 case "`./try`" in
11938                 ok) echo "Your strtoull() seems to be working okay." ;;
11939                 *) cat <<EOM >&4
11940 Your strtoull() doesn't seem to be working okay.
11941 EOM
11942                    d_strtoull="$undef"
11943                    ;;
11944                 esac
11945         fi
11946         ;;
11947 esac
11948
11949 : see if strtouq exists
11950 set strtouq d_strtouq
11951 eval $inlibc
11952
11953 : see if strxfrm exists
11954 set strxfrm d_strxfrm
11955 eval $inlibc
11956
11957 : see if symlink exists
11958 set symlink d_symlink
11959 eval $inlibc
11960
11961 : see if syscall exists
11962 set syscall d_syscall
11963 eval $inlibc
11964
11965 : see if sysconf exists
11966 set sysconf d_sysconf
11967 eval $inlibc
11968
11969 : see if system exists
11970 set system d_system
11971 eval $inlibc
11972
11973 : see if tcgetpgrp exists
11974 set tcgetpgrp d_tcgetpgrp
11975 eval $inlibc
11976
11977 : see if tcsetpgrp exists
11978 set tcsetpgrp d_tcsetpgrp
11979 eval $inlibc
11980
11981 : see if prototype for telldir is available
11982 echo " "
11983 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
11984 eval $hasproto
11985
11986 : see if this is a sys/times.h system
11987 set sys/times.h i_systimes
11988 eval $inhdr
11989
11990 : see if times exists
11991 echo " "
11992 if set times val -f d_times; eval $csym; $val; then
11993         echo 'times() found.' >&4
11994         d_times="$define"
11995         inc=''
11996         case "$i_systimes" in
11997         "$define") inc='sys/times.h';;
11998         esac
11999         rp="What is the type returned by times() on this system?"
12000         set clock_t clocktype long stdio.h sys/types.h $inc
12001         eval $typedef_ask
12002 else
12003         echo 'times() NOT found, hope that will do.' >&4
12004         d_times="$undef"
12005         clocktype='int'
12006 fi
12007
12008 : see if truncate exists
12009 set truncate d_truncate
12010 eval $inlibc
12011
12012 : see if tzname[] exists
12013 echo " "
12014 if set tzname val -a d_tzname; eval $csym; $val; then
12015         val="$define"
12016         echo 'tzname[] found.' >&4
12017 else
12018         val="$undef"
12019         echo 'tzname[] NOT found.' >&4
12020 fi
12021 set d_tzname
12022 eval $setvar
12023
12024 : see if umask exists
12025 set umask d_umask
12026 eval $inlibc
12027
12028 : see if ustat exists
12029 set ustat d_ustat
12030 eval $inlibc
12031
12032 : backward compatibility for d_hvfork
12033 if test X$d_hvfork != X; then
12034         d_vfork="$d_hvfork"
12035         d_hvfork=''
12036 fi
12037 : see if there is a vfork
12038 val=''
12039 set vfork val
12040 eval $inlibc
12041
12042 : Ok, but do we want to use it. vfork is reportedly unreliable in 
12043 : perl on Solaris 2.x, and probably elsewhere.
12044 case "$val" in
12045 $define)
12046         echo " "
12047         case "$usevfork" in
12048         false) dflt='n';;
12049         *) dflt='y';;
12050         esac
12051         cat <<'EOM'
12052  
12053 Perl can only use a vfork() that doesn't suffer from strict
12054 restrictions on calling functions or modifying global data in
12055 the child.  For example, glibc-2.1 contains such a vfork()
12056 that is unsuitable.  If your system provides a proper fork()
12057 call, chances are that you do NOT want perl to use vfork().
12058
12059 EOM
12060         rp="Do you still want to use vfork()?"
12061         . ./myread
12062         case "$ans" in
12063         y|Y) ;;
12064         *)
12065                 echo "Ok, we won't use vfork()."
12066                 val="$undef"
12067                 ;;
12068         esac
12069         ;;
12070 esac
12071 set d_vfork
12072 eval $setvar
12073 case "$d_vfork" in
12074 $define) usevfork='true';;
12075 *) usevfork='false';;
12076 esac
12077
12078 : see if this is an sysdir system
12079 set sys/dir.h i_sysdir
12080 eval $inhdr
12081
12082 : see if this is an sysndir system
12083 set sys/ndir.h i_sysndir
12084 eval $inhdr
12085
12086 : see if closedir exists
12087 set closedir d_closedir
12088 eval $inlibc
12089
12090 case "$d_closedir" in
12091 "$define")
12092         echo " "
12093         echo "Checking whether closedir() returns a status..." >&4
12094         cat > closedir.c <<EOM
12095 #$i_dirent I_DIRENT             /**/
12096 #$i_sysdir I_SYS_DIR            /**/
12097 #$i_sysndir I_SYS_NDIR          /**/
12098 #$i_systypes I_SYS_TYPES        /**/
12099
12100 #if defined(I_SYS_TYPES)
12101 #include <sys/types.h>
12102 #endif
12103 #if defined(I_DIRENT)
12104 #include <dirent.h>
12105 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
12106 #include <sys/dir.h>
12107 #endif
12108 #else
12109 #ifdef I_SYS_NDIR
12110 #include <sys/ndir.h>
12111 #else
12112 #ifdef I_SYS_DIR
12113 #ifdef hp9000s500
12114 #include <ndir.h>       /* may be wrong in the future */
12115 #else
12116 #include <sys/dir.h>
12117 #endif
12118 #endif
12119 #endif
12120 #endif 
12121 int main() { return closedir(opendir(".")); }
12122 EOM
12123         set closedir
12124         if eval $compile_ok; then
12125                 if ./closedir > /dev/null 2>&1 ; then
12126                         echo "Yes, it does."
12127                         val="$undef"
12128                 else
12129                         echo "No, it doesn't."
12130                         val="$define"
12131                 fi
12132         else
12133                 echo "(I can't seem to compile the test program--assuming it doesn't)"
12134                 val="$define"
12135         fi
12136         ;;
12137 *)
12138         val="$undef";
12139         ;;
12140 esac
12141 set d_void_closedir
12142 eval $setvar
12143 $rm -f closedir*
12144 : see if there is a wait4
12145 set wait4 d_wait4
12146 eval $inlibc
12147
12148 : see if waitpid exists
12149 set waitpid d_waitpid
12150 eval $inlibc
12151
12152 : see if wcstombs exists
12153 set wcstombs d_wcstombs
12154 eval $inlibc
12155
12156 : see if wctomb exists
12157 set wctomb d_wctomb
12158 eval $inlibc
12159
12160 : preserve RCS keywords in files with variable substitution, grrr
12161 Date='$Date'
12162 Id='$Id'
12163 Log='$Log'
12164 RCSfile='$RCSfile'
12165 Revision='$Revision'
12166
12167 case "$crosscompile" in
12168 ''|[nN]*) crosscompile="$undef" ;;
12169 esac
12170
12171 case "$osname" in
12172 next|rhapsody|darwin) multiarch="$define" ;;
12173 esac
12174 case "$multiarch" in
12175 ''|[nN]*) multiarch="$undef" ;;
12176 esac
12177
12178 : check for alignment requirements
12179 echo " "
12180 case "$crosscompile$multiarch" in
12181 *$define*)
12182         $cat <<EOM
12183 You seem to be either cross-compiling or doing a multiarchitecture build,
12184 skipping the memory alignment check.
12185
12186 EOM
12187         case "$alignbytes" in
12188         '') alignbytes=8 ;;
12189         esac
12190         ;;
12191 *)
12192         case "$alignbytes" in
12193         '') echo "Checking alignment constraints..." >&4
12194                 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
12195                         $cat >try.c <<'EOCP'
12196 typedef long double NV;
12197 EOCP
12198                 else
12199                         $cat >try.c <<'EOCP'
12200 typedef double NV;
12201 EOCP
12202                 fi
12203                 $cat >>try.c <<'EOCP'
12204 #include <stdio.h>
12205 struct foobar {
12206         char foo;
12207         NV bar;
12208 } try_algn;
12209 int main()
12210 {
12211     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
12212     return(0);
12213 }
12214 EOCP
12215                 set try
12216                 if eval $compile_ok; then
12217                         dflt=`./try`
12218                 else
12219                         dflt='8'
12220                         echo "(I can't seem to compile the test program...)"
12221                 fi
12222                 ;;
12223         *) dflt="$alignbytes"
12224                 ;;
12225         esac
12226         rp="Doubles must be aligned on a how-many-byte boundary?"
12227         . ./myread
12228         alignbytes="$ans"
12229         $rm -f try.c try
12230         ;;
12231 esac
12232
12233
12234 : set the base revision
12235 baserev=5.0
12236
12237 : check for ordering of bytes in a long
12238 echo " "
12239 case "$crosscompile$multiarch" in
12240 *$define*)
12241         $cat <<EOM
12242 You seem to be either cross-compiling or doing a multiarchitecture build,
12243 skipping the byteorder check.
12244
12245 EOM
12246         byteorder='0xffff'
12247         ;;
12248 *)
12249         case "$byteorder" in
12250         '')
12251                 $cat <<'EOM'
12252 In the following, larger digits indicate more significance.  A big-endian
12253 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
12254 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
12255 machines may have weird orders like 3412.  A Cray will report 87654321,
12256 an Alpha will report 12345678. If the test program works the default is
12257 probably right.
12258 I'm now running the test program...
12259 EOM
12260                 $cat >try.c <<'EOCP'
12261 #include <stdio.h>
12262 int main()
12263 {
12264         int i;
12265         union {
12266                 unsigned long l;
12267                 char c[sizeof(long)];
12268         } u;
12269
12270         if (sizeof(long) > 4)
12271                 u.l = (0x08070605L << 32) | 0x04030201L;
12272         else
12273                 u.l = 0x04030201L;
12274         for (i = 0; i < sizeof(long); i++)
12275                 printf("%c", u.c[i]+'0');
12276         printf("\n");
12277         exit(0);
12278 }
12279 EOCP
12280                 xxx_prompt=y
12281                 set try
12282                 if eval $compile && ./try > /dev/null; then
12283                         dflt=`./try`
12284                         case "$dflt" in
12285                         [1-4][1-4][1-4][1-4]|12345678|87654321)
12286                                 echo "(The test program ran ok.)"
12287                                 echo "byteorder=$dflt"
12288                                 xxx_prompt=n
12289                         ;;
12290                         ????|????????) echo "(The test program ran ok.)" ;;
12291                         *) echo "(The test program didn't run right for some reason.)" ;;
12292                         esac
12293                 else
12294                         dflt='4321'
12295                         cat <<'EOM'
12296 (I can't seem to compile the test program.  Guessing big-endian...)
12297 EOM
12298                 fi
12299                 case "$xxx_prompt" in
12300                 y)
12301                         rp="What is the order of bytes in a long?"
12302                         . ./myread
12303                         byteorder="$ans"
12304                         ;;
12305                 *)      byteorder=$dflt
12306                         ;;
12307                 esac
12308                 ;;
12309         esac
12310         $rm -f try.c try
12311         ;;
12312 esac
12313
12314
12315 : how do we catenate cpp tokens here?
12316 echo " "
12317 echo "Checking to see how your cpp does stuff like catenate tokens..." >&4
12318 $cat >cpp_stuff.c <<'EOCP'
12319 #define RCAT(a,b)a/**/b
12320 #define ACAT(a,b)a ## b
12321 RCAT(Rei,ser)
12322 ACAT(Cir,cus)
12323 EOCP
12324 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
12325 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
12326         echo "Oh!  Smells like ANSI's been here." >&4
12327         echo "We can catify or stringify, separately or together!"
12328         cpp_stuff=42
12329 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
12330         echo "Ah, yes!  The good old days!" >&4
12331         echo "However, in the good old days we don't know how to stringify and"
12332         echo "catify at the same time."
12333         cpp_stuff=1
12334 else
12335         $cat >&4 <<EOM
12336 Hmm, I don't seem to be able to catenate tokens with your cpp.  You're going
12337 to have to edit the values of CAT[2-5] in config.h...
12338 EOM
12339         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
12340 fi
12341 $rm -f cpp_stuff.*
12342
12343 : see if this is a db.h system
12344 set db.h i_db
12345 eval $inhdr
12346
12347 case "$i_db" in
12348 $define)
12349         : Check db version.
12350         echo " "
12351         echo "Checking Berkeley DB version ..." >&4
12352         $cat >try.c <<EOCP
12353 #$d_const HASCONST
12354 #ifndef HASCONST
12355 #define const
12356 #endif
12357 #include <sys/types.h>
12358 #include <stdio.h>
12359 #include <db.h>
12360 int main()
12361 {
12362 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
12363     int Major, Minor, Patch ;
12364     unsigned long Version ;
12365     (void)db_version(&Major, &Minor, &Patch) ;
12366     printf("You have Berkeley DB Version 2 or greater\n");
12367
12368     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
12369                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
12370     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
12371                 Major, Minor, Patch) ;
12372
12373     /* check that db.h & libdb are compatible */
12374     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
12375         printf("db.h and libdb are incompatible\n") ;
12376         exit(3);        
12377     }
12378
12379     printf("db.h and libdb are compatible\n") ;
12380
12381     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
12382                 + DB_VERSION_PATCH ;
12383
12384     /* needs to be >= 2.3.4 */
12385     if (Version < 2003004) {
12386     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
12387         printf("but Perl needs Berkeley DB 2.3.4 or greater\n") ;
12388         exit(2);        
12389     }
12390
12391     exit(0);
12392 #else
12393 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
12394     printf("You have Berkeley DB Version 1\n");
12395     exit(0);    /* DB version < 2: the coast is clear. */
12396 #else
12397     exit(1);    /* <db.h> not Berkeley DB? */
12398 #endif
12399 #endif
12400 }
12401 EOCP
12402         set try
12403         if eval $compile_ok && ./try; then
12404                 echo 'Looks OK.' >&4
12405         else
12406                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
12407                 i_db=$undef
12408                 case " $libs " in
12409                 *"-ldb "*)
12410                         : Remove db from list of libraries to use
12411                         echo "Removing unusable -ldb from library list" >&4
12412                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
12413                         shift
12414                         libs="$*"
12415                         echo "libs = $libs" >&4
12416                         ;;
12417                 esac
12418         fi
12419         $rm -f try.*
12420         ;;
12421 esac
12422
12423 case "$i_db" in
12424 define)
12425         : Check the return type needed for hash 
12426         echo " "
12427         echo "Checking return type needed for hash for Berkeley DB ..." >&4
12428         $cat >try.c <<EOCP
12429 #$d_const HASCONST
12430 #ifndef HASCONST
12431 #define const
12432 #endif
12433 #include <sys/types.h>
12434 #include <db.h>
12435
12436 #ifndef DB_VERSION_MAJOR
12437 u_int32_t hash_cb (ptr, size)
12438 const void *ptr;
12439 size_t size;
12440 {
12441 }
12442 HASHINFO info;
12443 int main()
12444 {
12445         info.hash = hash_cb;
12446 }
12447 #endif
12448 EOCP
12449         if $cc $ccflags -c try.c >try.out 2>&1 ; then
12450                 if $contains warning try.out >>/dev/null 2>&1 ; then
12451                         db_hashtype='int'
12452                 else
12453                         db_hashtype='u_int32_t'
12454                 fi
12455         else
12456                 : XXX Maybe we should just give up here.
12457                 db_hashtype=u_int32_t
12458                 $cat try.out >&4
12459                 echo "Help:  I can't seem to compile the db test program." >&4
12460                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
12461         fi
12462         $rm -f try.*
12463         echo "Your version of Berkeley DB uses $db_hashtype for hash."
12464         ;;
12465 *)      db_hashtype=u_int32_t
12466         ;;
12467 esac
12468 case "$i_db" in
12469 define)
12470         : Check the return type needed for prefix 
12471         echo " "
12472         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
12473         cat >try.c <<EOCP
12474 #$d_const HASCONST
12475 #ifndef HASCONST
12476 #define const
12477 #endif
12478 #include <sys/types.h>
12479 #include <db.h>
12480
12481 #ifndef DB_VERSION_MAJOR
12482 size_t prefix_cb (key1, key2)
12483 const DBT *key1;
12484 const DBT *key2;
12485 {
12486 }
12487 BTREEINFO info;
12488 int main()
12489 {
12490         info.prefix = prefix_cb;
12491 }
12492 #endif
12493 EOCP
12494         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
12495                 if $contains warning try.out >>/dev/null 2>&1 ; then
12496                         db_prefixtype='int'
12497                 else
12498                         db_prefixtype='size_t'
12499                 fi
12500         else
12501                 db_prefixtype='size_t'
12502                 : XXX Maybe we should just give up here.
12503                 $cat try.out >&4
12504                 echo "Help:  I can't seem to compile the db test program." >&4
12505                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
12506         fi
12507         $rm -f try.*
12508         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
12509         ;;
12510 *)      db_prefixtype='size_t'
12511         ;;
12512 esac
12513
12514 : check for void type
12515 echo " "
12516 echo "Checking to see how well your C compiler groks the void type..." >&4
12517 case "$voidflags" in
12518 '')
12519         $cat >try.c <<'EOCP'
12520 #if TRY & 1
12521 void sub() {
12522 #else
12523 sub() {
12524 #endif
12525         extern void moo();      /* function returning void */
12526         void (*goo)();          /* ptr to func returning void */
12527 #if TRY & 8
12528         void *hue;              /* generic ptr */
12529 #endif
12530 #if TRY & 2
12531         void (*foo[10])();
12532 #endif
12533
12534 #if TRY & 4
12535         if(goo == moo) {
12536                 exit(0);
12537         }
12538 #endif
12539         exit(0);
12540 }
12541 int main() { sub(); }
12542 EOCP
12543         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
12544                 voidflags=$defvoidused
12545         echo "Good.  It appears to support void to the level $package wants.">&4
12546                 if $contains warning .out >/dev/null 2>&1; then
12547                         echo "However, you might get some warnings that look like this:"
12548                         $cat .out
12549                 fi
12550         else
12551 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
12552                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
12553                         echo "It supports 1..."
12554                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
12555                                 echo "It also supports 2..."
12556                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
12557                                         voidflags=7
12558                                         echo "And it supports 4 but not 8 definitely."
12559                                 else
12560                                         echo "It doesn't support 4..."
12561                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
12562                                                 voidflags=11
12563                                                 echo "But it supports 8."
12564                                         else
12565                                                 voidflags=3
12566                                                 echo "Neither does it support 8."
12567                                         fi
12568                                 fi
12569                         else
12570                                 echo "It does not support 2..."
12571                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
12572                                         voidflags=13
12573                                         echo "But it supports 4 and 8."
12574                                 else
12575                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
12576                                                 voidflags=5
12577                                                 echo "And it supports 4 but has not heard about 8."
12578                                         else
12579                                                 echo "However it supports 8 but not 4."
12580                                         fi
12581                                 fi
12582                         fi
12583                 else
12584                         echo "There is no support at all for void."
12585                         voidflags=0
12586                 fi
12587         fi
12588 esac
12589 case "$voidflags" in
12590 "$defvoidused") ;;
12591 *)      $cat >&4 <<'EOM'
12592   Support flag bits are:
12593     1: basic void declarations.
12594     2: arrays of pointers to functions returning void.
12595     4: operations between pointers to and addresses of void functions.
12596     8: generic void pointers.
12597 EOM
12598         dflt="$voidflags";
12599         rp="Your void support flags add up to what?"
12600         . ./myread
12601         voidflags="$ans"
12602         ;;
12603 esac
12604 $rm -f try.* .out
12605
12606
12607 : How can we generate normalized random numbers ?
12608 echo " "
12609 echo "Looking for a random number function..." >&4
12610 case "$randfunc" in
12611 '')
12612         if set drand48 val -f; eval $csym; $val; then
12613                 dflt="drand48"
12614                 echo "Good, found drand48()." >&4
12615         elif set random val -f; eval $csym; $val; then
12616                 dflt="random"
12617                 echo "OK, found random()." >&4
12618         else
12619                 dflt="rand"
12620                 echo "Yick, looks like I have to use rand()." >&4
12621         fi
12622         echo " "
12623         ;;
12624 *)
12625         dflt="$randfunc"
12626         ;;
12627 esac
12628 cont=true
12629
12630 case "$ccflags" in
12631 *-Dmy_rand=*|*-Dmy_srand=*)
12632         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
12633         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
12634         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
12635         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
12636         ;;
12637 esac
12638
12639 while $test "$cont"; do
12640         rp="Use which function to generate random numbers?"
12641         . ./myread
12642         if $test "$ans" = "$dflt"; then
12643                 : null
12644         else
12645                 randbits=''
12646         fi
12647         randfunc="$ans"
12648         if set $ans val -f; eval $csym; $val; then
12649                 cont=''
12650         else
12651                 dflt=y
12652                 rp="I cannot find function $ans. Use that name anyway?"
12653                 . ./myread
12654                 dflt=rand
12655                 case "$ans" in
12656                         [yY]*) cont='';;
12657                 esac
12658         fi
12659         case "$cont" in
12660         '')
12661                 case "$randfunc" in
12662                 drand48)
12663                         drand01="drand48()"
12664                         seedfunc="srand48"
12665                         randbits=48
12666                         randseedtype=long
12667                         ;;
12668                 rand|random)
12669                         case "$randbits" in
12670                         '')
12671 echo "Checking to see how many bits your $randfunc() function produces..." >&4
12672                                 $cat >try.c <<EOCP
12673 #$i_unistd I_UNISTD
12674 #$i_stdlib I_STDLIB
12675 #include <stdio.h>
12676 #ifdef I_UNISTD
12677 #  include <unistd.h>
12678 #endif
12679 #ifdef I_STDLIB
12680 #  include <stdlib.h>
12681 #endif
12682 int main()
12683 {
12684         register int i;
12685         register unsigned long tmp;
12686         register unsigned long max = 0L;
12687
12688         for (i = 1000; i; i--) {
12689                 tmp = (unsigned long) $randfunc();
12690                 if (tmp > max) max = tmp;
12691         }
12692         for (i = 0; max; i++)
12693                 max /= 2;
12694         printf("%d\n",i);
12695 }
12696 EOCP
12697                                 set try
12698                                 if eval $compile_ok; then
12699                                         dflt=`try`
12700                                 else
12701                                         dflt='?'
12702                                         echo "(I can't seem to compile the test program...)"
12703                                 fi
12704                                 ;;
12705                         *)
12706                                 dflt="$randbits"
12707                                 ;;
12708                         esac
12709                         rp="How many bits does your $randfunc() function produce?"
12710                         . ./myread
12711                         randbits="$ans"
12712                         $rm -f try.c try
12713                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
12714                         seedfunc="s$randfunc"
12715                         randseedtype=unsigned
12716                         ;;
12717                 *)
12718                         dflt="31"
12719                         rp="How many bits does your $randfunc() function produce?"
12720                         . ./myread
12721                         randbits="$ans"
12722                         seedfunc="s$randfunc"
12723                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
12724                         if set $seedfunc val -f; eval $csym; $val; then
12725                                 echo "(Using $seedfunc() to seed random generator)"
12726                         else
12727                                 echo "(Warning: no $seedfunc() to seed random generator)"
12728                                 seedfunc=rand
12729                         fi
12730                         randseedtype=unsigned
12731                         ;;
12732                 esac
12733                 ;;
12734         esac
12735 done
12736
12737 echo " "
12738 echo "Determining whether or not we are on an EBCDIC system..." >&4
12739 $cat >tebcdic.c <<'EOM'
12740 int main()
12741 {
12742   if ('M'==0xd4) return 0;
12743   return 1;
12744 }
12745 EOM
12746
12747 val=$undef
12748 set tebcdic
12749 if eval $compile_ok; then
12750         if ./tebcdic; then
12751                 echo "You seem to speak EBCDIC." >&4
12752                 val="$define"
12753         else
12754                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF8." >&4
12755         fi
12756 else
12757         echo "I'm unable to compile the test program." >&4
12758         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
12759 fi
12760 $rm -f tebcdic.c tebcdic
12761 set ebcdic
12762 eval $setvar
12763
12764 echo " "
12765 $cat >&4 <<EOM
12766 Checking how to flush all pending stdio output...
12767 EOM
12768 # I only know how to find the first 32 possibly open files on SunOS.
12769 # See also hints/sunos_4_1.sh and util.c  --AD
12770 case "$osname" in
12771 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
12772 esac
12773 $cat >>try.c <<EOCP
12774 #include <stdio.h>
12775 #$i_unistd I_UNISTD
12776 #ifdef I_UNISTD
12777 # include <unistd.h>
12778 #endif
12779 #$d_sysconf HAS_SYSCONF
12780 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
12781 #ifdef HAS_STDIO_STREAM_ARRAY
12782 # define STDIO_STREAM_ARRAY $stdio_stream_array
12783 #endif
12784 int main() {
12785   FILE* p = fopen("try.out", "w");
12786 #ifdef TRY_FPUTC
12787   fputc('x', p);
12788 #else
12789 # ifdef TRY_FPRINTF
12790   fprintf(p, "x");
12791 # endif
12792 #endif
12793 #ifdef TRY_FFLUSH_NULL
12794   fflush(NULL);
12795 #endif
12796 #ifdef TRY_FFLUSH_ALL
12797   {
12798     long open_max = -1;
12799 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
12800     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
12801 # else
12802 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
12803     open_max = sysconf(_SC_OPEN_MAX);
12804 #  else
12805 #   ifdef FOPEN_MAX
12806     open_max = FOPEN_MAX;
12807 #   else
12808 #    ifdef OPEN_MAX
12809     open_max = OPEN_MAX;
12810 #    else
12811 #     ifdef _NFILE
12812     open_max = _NFILE;
12813 #     endif
12814 #    endif
12815 #   endif
12816 #  endif
12817 # endif 
12818 # ifdef HAS_STDIO_STREAM_ARRAY
12819     if (open_max > 0) {
12820       long i;
12821       for (i = 0; i < open_max; i++)
12822             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
12823                 STDIO_STREAM_ARRAY[i]._file < open_max &&
12824                 STDIO_STREAM_ARRAY[i]._flag)
12825                 fflush(&STDIO_STREAM_ARRAY[i]);
12826     }   
12827   }
12828 # endif
12829 #endif
12830   _exit(42);
12831 }
12832 EOCP
12833 : first we have to find out how _not_ to flush
12834 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
12835     output=''
12836     set try -DTRY_FPUTC
12837     if eval $compile; then
12838             $rm -f try.out
12839             ./try$exe_ext 2>/dev/null
12840             if $test ! -s try.out -a "X$?" = X42; then
12841                 output=-DTRY_FPUTC
12842             fi
12843     fi
12844     case "$output" in
12845     '')
12846             set try -DTRY_FPRINTF
12847             $rm -f try.out
12848             if eval $compile; then
12849                     $rm -f try.out
12850                     ./try$exe_ext 2>/dev/null
12851                     if $test ! -s try.out -a "X$?" = X42; then
12852                         output=-DTRY_FPRINTF
12853                     fi
12854             fi
12855         ;;
12856     esac
12857 fi
12858 : check for fflush NULL behaviour
12859 case "$fflushNULL" in
12860 '')     set try -DTRY_FFLUSH_NULL $output
12861         if eval $compile; then
12862                 $rm -f try.out
12863                 ./try$exe_ext 2>/dev/null
12864                 code="$?"
12865                 if $test -s try.out -a "X$code" = X42; then
12866                         fflushNULL="`$cat try.out`"
12867                 else
12868                         if $test "X$code" != X42; then
12869                                 $cat >&4 <<EOM
12870 (If this test failed, don't worry, we'll try another method shortly.)
12871 EOM
12872                         fi
12873                 fi
12874         fi
12875         $rm -f core try.core core.try.*
12876         case "$fflushNULL" in
12877         x)      $cat >&4 <<EOM
12878 Your fflush(NULL) works okay for output streams.
12879 Let's see if it clobbers input pipes...
12880 EOM
12881 # As of mid-March 2000 all versions of Solaris appear to have a stdio
12882 # bug that improperly flushes the input end of pipes.  So we avoid the
12883 # autoflush on fork/system/exec support for now. :-(
12884 $cat >tryp.c <<EOCP
12885 #include <stdio.h>
12886 int
12887 main(int argc, char **argv)
12888 {
12889     char buf[1024];
12890     int i;
12891     char *bp = buf;
12892     while (1) {
12893         while ((i = getc(stdin)) != -1
12894                && (*bp++ = i) != '\n'
12895                && bp < &buf[1024])
12896         /* DO NOTHING */ ;
12897         *bp = '\0';
12898         fprintf(stdout, "%s", buf);
12899         fflush(NULL);
12900         if (i == -1)
12901             return 0;
12902         bp = buf;
12903     }
12904 }
12905 EOCP
12906                 fflushNULL="$define"
12907                 set tryp
12908                 if eval $compile; then
12909                     $rm -f tryp.out
12910                     $cat tryp.c | ./tryp$exe_ext 2>/dev/null > tryp.out
12911                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
12912                        $cat >&4 <<EOM
12913 fflush(NULL) seems to behave okay with input streams.
12914 EOM
12915                         fflushNULL="$define"
12916                     else
12917                         $cat >&4 <<EOM
12918 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
12919 EOM
12920                         fflushNULL="$undef"
12921                     fi
12922                 fi
12923                 $rm -f core tryp.c tryp.core core.tryp.*
12924                 ;;
12925         '')     $cat >&4 <<EOM
12926 Your fflush(NULL) isn't working (contrary to ANSI C).
12927 EOM
12928                 fflushNULL="$undef"
12929                 ;;
12930         *)      $cat >&4 <<EOM
12931 Cannot figure out whether your fflush(NULL) works or not.
12932 I'm assuming it doesn't (contrary to ANSI C).
12933 EOM
12934                 fflushNULL="$undef"
12935                 ;;
12936         esac
12937         ;;
12938 $define|true|[yY]*)
12939         fflushNULL="$define"
12940         ;;
12941 *)
12942         fflushNULL="$undef"
12943         ;;
12944 esac
12945 : check explicit looping only if NULL did not work, and if the pipe
12946 : bug does not show up on an explicit flush too
12947 case "$fflushNULL" in
12948 "$undef")
12949         $cat >tryp.c <<EOCP
12950 #include <stdio.h>
12951 int
12952 main(int argc, char **argv)
12953 {
12954     char buf[1024];
12955     int i;
12956     char *bp = buf;
12957     while (1) {
12958         while ((i = getc(stdin)) != -1
12959                && (*bp++ = i) != '\n'
12960                && bp < &buf[1024])
12961         /* DO NOTHING */ ;
12962         *bp = '\0';
12963         fprintf(stdout, "%s", buf);
12964         fflush(stdin);
12965         if (i == -1)
12966             return 0;
12967         bp = buf;
12968     }
12969 }
12970 EOCP
12971         set tryp
12972         if eval $compile; then
12973             $rm -f tryp.out
12974             $cat tryp.c | ./tryp$exe_ext 2>/dev/null > tryp.out
12975             if cmp tryp.c tryp.out >/dev/null 2>&1; then
12976                $cat >&4 <<EOM
12977 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
12978 EOM
12979                 : now check for fflushall behaviour
12980                 case "$fflushall" in
12981                 '')     set try -DTRY_FFLUSH_ALL $output
12982                         if eval $compile; then
12983                                 $cat >&4 <<EOM
12984 (Now testing the other method--but note that this also may fail.)
12985 EOM
12986                                 $rm -f try.out
12987                                 ./try$exe_ext 2>/dev/null
12988                                 if $test -s try.out -a "X$?" = X42; then
12989                                         fflushall="`$cat try.out`"
12990                                 fi
12991                         fi
12992                         $rm -f core try.core core.try.*
12993                         case "$fflushall" in
12994                         x)      $cat >&4 <<EOM
12995 Whew. Flushing explicitly all the stdio streams works.
12996 EOM
12997                                 fflushall="$define"
12998                                 ;;
12999                         '')     $cat >&4 <<EOM
13000 Sigh. Flushing explicitly all the stdio streams doesn't work.
13001 EOM
13002                                 fflushall="$undef"
13003                                 ;;
13004                         *)      $cat >&4 <<EOM
13005 Cannot figure out whether flushing stdio streams explicitly works or not.
13006 I'm assuming it doesn't.
13007 EOM
13008                                 fflushall="$undef"
13009                                 ;;
13010                         esac
13011                         ;;
13012                 "$define"|true|[yY]*)
13013                         fflushall="$define"
13014                         ;;
13015                 *)
13016                         fflushall="$undef"
13017                         ;;
13018                 esac
13019             else
13020                 $cat >&4 <<EOM
13021 All is futile.  Even fflush(stdin) clobbers input pipes!
13022 EOM
13023                 fflushall="$undef"
13024             fi
13025         else
13026             fflushall="$undef"
13027         fi
13028         $rm -f core tryp.c tryp.core core.tryp.*
13029         ;;
13030 *)      fflushall="$undef"
13031         ;;
13032 esac
13033
13034 case "$fflushNULL$fflushall" in
13035 undefundef)
13036         $cat <<EOM
13037 OK, I give up.  I cannot figure out how to flush pending stdio output.
13038 We won't be flushing handles at all before fork/exec/popen.
13039 EOM
13040         ;;
13041 esac
13042 $rm -f try.* try$exe_ext
13043
13044 : Store the full pathname to the ar program for use in the C program
13045 : Respect a hint or command line value for full_ar.
13046 case "$full_ar" in
13047 '') full_ar=$ar ;;
13048 esac
13049
13050 : Store the full pathname to the sed program for use in the C program
13051 full_sed=$sed
13052
13053 : see what type gids are declared as in the kernel
13054 echo " "
13055 echo "Looking for the type for group ids returned by getgid()."
13056 set gid_t gidtype xxx stdio.h sys/types.h
13057 eval $typedef
13058 case "$gidtype" in
13059 xxx)
13060         xxx=`./findhdr sys/user.h`
13061         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
13062         case $1 in
13063         unsigned) dflt="$1 $2" ;;
13064         *) dflt="$1" ;;
13065         esac
13066         ;;
13067 *) dflt="$gidtype";;
13068 esac
13069 case "$gidtype" in
13070 gid_t) echo "gid_t found." ;;
13071 *)      rp="What is the type for group ids returned by getgid()?"
13072         . ./myread
13073         gidtype="$ans"
13074         ;;
13075 esac
13076
13077 echo " "
13078 case "$gidtype" in
13079 *_t) zzz="$gidtype"     ;;
13080 *)   zzz="gid"          ;;
13081 esac
13082 echo "Checking the size of $zzz..." >&4 
13083 cat > try.c <<EOCP
13084 #include <sys/types.h>
13085 #include <stdio.h>
13086 int main() {
13087     printf("%d\n", (int)sizeof($gidtype));
13088     exit(0);
13089 }
13090 EOCP
13091 set try
13092 if eval $compile_ok; then
13093         yyy=`./try`
13094         case "$yyy" in
13095         '')     gidsize=4
13096                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
13097                 ;;
13098         *)      gidsize=$yyy
13099                 echo "Your $zzz is $gidsize bytes long."
13100                 ;;
13101         esac
13102 else
13103         gidsize=4
13104         echo "(I can't compile the test program--guessing $gidsize.)" >&4
13105 fi
13106
13107
13108 echo " "
13109 case "$gidtype" in
13110 *_t) zzz="$gidtype"     ;;
13111 *)   zzz="gid"          ;;
13112 esac
13113 echo "Checking the sign of $zzz..." >&4 
13114 cat > try.c <<EOCP
13115 #include <sys/types.h>
13116 #include <stdio.h>
13117 int main() {
13118         $gidtype foo = -1;
13119         if (foo < 0)
13120                 printf("-1\n");
13121         else
13122                 printf("1\n");
13123 }
13124 EOCP
13125 set try
13126 if eval $compile; then
13127         yyy=`./try`
13128         case "$yyy" in
13129         '')     gidsign=1
13130                 echo "(I can't execute the test program--guessing unsigned.)" >&4
13131                 ;;
13132         *)      gidsign=$yyy
13133                 case "$gidsign" in
13134                  1) echo "Your $zzz is unsigned." ;;
13135                 -1) echo "Your $zzz is signed."   ;;
13136                 esac
13137                 ;;
13138         esac
13139 else
13140         gidsign=1
13141         echo "(I can't compile the test program--guessing unsigned.)" >&4
13142 fi
13143
13144
13145 echo " "
13146
13147 if $test X"$quadtype" != X; then
13148
13149 echo "Checking how to print 64-bit integers..." >&4
13150
13151 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
13152         $cat >try.c <<'EOCP'
13153 #include <sys/types.h>
13154 #include <stdio.h>
13155 int main() {
13156   int q = 12345678901;
13157   printf("%ld\n", q);
13158 }
13159 EOCP
13160         set try
13161         if eval $compile; then
13162                 yyy=`./try$exe_ext`
13163                 case "$yyy" in
13164                 12345678901)
13165                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
13166                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
13167                         echo "We will use %d."
13168                         ;;
13169                 esac
13170         fi
13171 fi
13172
13173 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
13174         $cat >try.c <<'EOCP'
13175 #include <sys/types.h>
13176 #include <stdio.h>
13177 int main() {
13178   long q = 12345678901;
13179   printf("%ld\n", q);
13180 }
13181 EOCP
13182         set try
13183         if eval $compile; then
13184                 yyy=`./try$exe_ext`
13185                 case "$yyy" in
13186                 12345678901)
13187                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
13188                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
13189                         echo "We will use %ld."
13190                         ;;
13191                 esac
13192         fi
13193 fi
13194
13195 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
13196         $cat >try.c <<'EOCP'
13197 #include <sys/types.h>
13198 #include <inttypes.h>
13199 #include <stdio.h>
13200 int main() {
13201   int64_t q = 12345678901;
13202   printf("%" PRId64 "\n", q);
13203 }
13204 EOCP
13205         set try
13206         if eval $compile; then
13207                 yyy=`./try$exe_ext`
13208                 case "$yyy" in
13209                 12345678901)
13210                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
13211                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
13212                         echo "We will use the C9X style."
13213                         ;;
13214                 esac
13215         fi
13216 fi
13217
13218 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
13219         $cat >try.c <<'EOCP'
13220 #include <sys/types.h>
13221 #include <stdio.h>
13222 int main() {
13223   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
13224   printf("%lld\n", q);
13225 }
13226 EOCP
13227         set try
13228         if eval $compile; then
13229                 yyy=`./try$exe_ext`
13230                 case "$yyy" in
13231                 12345678901)
13232                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
13233                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
13234                         echo "We will use the %lld style."
13235                         ;;
13236                 esac
13237         fi
13238 fi
13239
13240 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
13241         $cat >try.c <<EOCP
13242 #include <sys/types.h>
13243 #include <stdio.h>
13244 int main() {
13245   $quadtype q = 12345678901;
13246   printf("%Ld\n", q);
13247 }
13248 EOCP
13249         set try
13250         if eval $compile; then
13251                 yyy=`./try$exe_ext`
13252                 case "$yyy" in
13253                 12345678901)
13254                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
13255                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
13256                         echo "We will use %Ld."
13257                         ;;
13258                 esac
13259         fi
13260 fi
13261
13262 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
13263         $cat >try.c <<EOCP
13264 #include <sys/types.h>
13265 #include <stdio.h>
13266 int main() {
13267   $quadtype q = 12345678901;
13268   printf("%qd\n", q);
13269 }
13270 EOCP
13271         set try
13272         if eval $compile; then
13273                 yyy=`./try$exe_ext`
13274                 case "$yyy" in
13275                 12345678901)
13276                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
13277                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
13278                         echo "We will use %qd."
13279                         ;;
13280                 esac
13281         fi
13282 fi
13283
13284 if $test X"$sPRId64" = X; then
13285         echo "Cannot figure out how to print 64-bit integers." >&4
13286 fi
13287
13288 $rm -f try try.*
13289
13290 fi
13291
13292 case "$sPRId64" in
13293 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef"; 
13294         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef"; 
13295         ;;
13296 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define"; 
13297         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define"; 
13298         ;;
13299 esac
13300
13301
13302 echo " "
13303 $echo "Checking the format strings to be used for Perl's internal types..." >&4
13304
13305 if $test X"$ivsize" = X8; then
13306         ivdformat="$sPRId64"
13307         uvuformat="$sPRIu64"
13308         uvoformat="$sPRIo64"
13309         uvxformat="$sPRIx64"
13310         uvXUformat="$sPRIXU64"
13311 else
13312         if $test X"$ivsize" = X"$longsize"; then
13313                 ivdformat='"ld"'
13314                 uvuformat='"lu"'
13315                 uvoformat='"lo"'
13316                 uvxformat='"lx"'
13317                 uvXUformat='"lX"'
13318         else
13319                 if $test X"$ivsize" = X"$intsize"; then
13320                         ivdformat='"d"'
13321                         uvuformat='"u"'
13322                         uvoformat='"o"'
13323                         uvxformat='"x"'
13324                         uvXUformat='"X"'
13325                 else
13326                         : far out
13327                         if $test X"$ivsize" = X"$shortsize"; then
13328                                 ivdformat='"hd"'
13329                                 uvuformat='"hu"'
13330                                 uvoformat='"ho"'
13331                                 uvxformat='"hx"'
13332                                 uvXUformat='"hX"'
13333                         fi
13334                 fi
13335         fi
13336 fi
13337
13338 if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
13339         nveformat="$sPRIeldbl"
13340         nvfformat="$sPRIfldbl"
13341         nvgformat="$sPRIgldbl"
13342         nvEUformat="$sPRIEUldbl"
13343         nvFUformat="$sPRIFUldbl"
13344         nvGUformat="$sPRIGUldbl"
13345 else
13346         nveformat='"e"'
13347         nvfformat='"f"'
13348         nvgformat='"g"'
13349         nvEUformat='"E"'
13350         nvFUformat='"F"'
13351         nvGUformat='"G"'
13352 fi
13353
13354 case "$ivdformat" in
13355 '') echo "$0: Fatal: failed to find format strings, cannot continue." >& 4
13356     exit 1
13357     ;;
13358 esac
13359
13360
13361 echo " "
13362 $echo "Checking the format string to be used for gids..." >&4
13363
13364 case "$gidsign" in
13365 -1)     if $test X"$gidsize" = X"$ivsize"; then
13366                 gidformat="$ivdformat"
13367         else
13368                 if $test X"$gidsize" = X"$longsize"; then
13369                         gidformat='"ld"'
13370                 else
13371                         if $test X"$gidsize" = X"$intsize"; then
13372                                 gidformat='"d"'
13373                         else
13374                                 if $test X"$gidsize" = X"$shortsize"; then
13375                                         gidformat='"hd"'
13376                                 fi
13377                         fi
13378                 fi
13379         fi
13380         ;;
13381 *)      if $test X"$gidsize" = X"$uvsize"; then
13382                 gidformat="$uvuformat"
13383         else
13384                 if $test X"$gidsize" = X"$longsize"; then
13385                         gidformat='"lu"'
13386                 else
13387                         if $test X"$gidsize" = X"$intsize"; then
13388                                 gidformat='"u"'
13389                         else
13390                                 if $test X"$gidsize" = X"$shortsize"; then
13391                                         gidformat='"hu"'
13392                                 fi
13393                         fi
13394                 fi
13395         fi
13396         ;;
13397 esac
13398
13399 : see if getgroups exists
13400 set getgroups d_getgrps
13401 eval $inlibc
13402
13403 : see if setgroups exists
13404 set setgroups d_setgrps
13405 eval $inlibc
13406
13407
13408 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
13409 echo " "
13410 case "$d_getgrps$d_setgrps" in
13411 *define*)
13412         case "$groupstype" in
13413         '') dflt="$gidtype" ;;
13414         *)  dflt="$groupstype" ;;
13415         esac
13416         $cat <<EOM
13417 What type of pointer is the second argument to getgroups() and setgroups()?
13418 Usually this is the same as group ids, $gidtype, but not always.
13419
13420 EOM
13421         rp='What type pointer is the second argument to getgroups() and setgroups()?'
13422         . ./myread
13423         groupstype="$ans"
13424         ;;
13425 *)  groupstype="$gidtype";;
13426 esac
13427
13428 echo " "
13429 echo "Checking if your $make program sets \$(MAKE)..." >&4
13430 case "$make_set_make" in
13431 '')
13432         $sed 's/^X //' > testmake.mak << 'EOF'
13433 Xall:
13434 X       @echo 'maketemp="$(MAKE)"'
13435 EOF
13436         case "`$make -f testmake.mak 2>/dev/null`" in
13437         *maketemp=*) make_set_make='#' ;;
13438         *)      make_set_make="MAKE=$make" ;;
13439         esac
13440         $rm -f testmake.mak
13441         ;;
13442 esac
13443 case "$make_set_make" in
13444 '#') echo "Yup, it does.";;
13445 *) echo "Nope, it doesn't.";;
13446 esac
13447
13448 : see what type is used for mode_t
13449 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
13450 set mode_t modetype int stdio.h sys/types.h
13451 eval $typedef_ask
13452
13453 : define a fucntion to check prototypes
13454 $cat > protochk <<EOSH
13455 $startsh
13456 cc="$cc"
13457 optimize="$optimize"
13458 ccflags="$ccflags"
13459 prototype="$prototype"
13460 define="$define"
13461 rm=$rm
13462 EOSH
13463
13464 $cat >> protochk <<'EOSH'
13465
13466 $rm -f try.c
13467 foo="$1"
13468 shift
13469 while test $# -ge 2; do
13470         case "$1" in
13471                 $define) echo "#include <$2>" >> try.c ;;
13472                 literal) echo "$2" >> try.c ;;
13473         esac
13474     shift 2
13475 done
13476 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
13477 cat >> try.c <<'EOCP'
13478 #ifdef CAN_PROTOTYPE
13479 #define _(args) args
13480 #else
13481 #define _(args) ()
13482 #endif
13483 EOCP
13484 echo "$foo" >> try.c
13485 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
13486 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
13487 status=$?
13488 $rm -f try.[co]
13489 exit $status
13490 EOSH
13491 chmod +x protochk
13492 $eunicefix protochk
13493
13494 : see what type is used for size_t
13495 rp="What is the type used for the length parameter for string functions?"
13496 set size_t sizetype 'unsigned int' stdio.h sys/types.h
13497 eval $typedef_ask
13498
13499 : check for type of arguments to gethostbyaddr. 
13500 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
13501         case "$d_gethbyaddr" in
13502         $define)
13503                 $cat <<EOM
13504
13505 Checking to see what type of arguments are accepted by gethostbyaddr().
13506 EOM
13507                 hdrs="$define sys/types.h
13508                         $d_socket sys/socket.h 
13509                         $i_niin netinet/in.h 
13510                         $i_netdb netdb.h
13511                         $i_unistd unistd.h"
13512                 : The first arg can 'char *' or 'void *'
13513                 : The second arg is some of integral type
13514                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
13515                         for yyy in size_t long int; do
13516                                 case "$netdb_host_type" in
13517                                 '')     try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
13518                                         if ./protochk "$try" $hdrs; then
13519                                                 echo "Your system accepts $xxx for the first arg."
13520                                                 echo "...and $yyy for the second arg."
13521                                                 netdb_host_type="$xxx"
13522                                                 netdb_hlen_type="$yyy"
13523                                         fi
13524                                         ;;
13525                                 esac
13526                         done
13527                 done
13528                 : In case none of those worked, prompt the user.
13529                 case "$netdb_host_type" in
13530                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
13531                         dflt='char *'
13532                         . ./myread
13533                         netdb_host_type=$ans
13534                         rp='What is the type for the 2nd argument to gethostbyaddr?'
13535                         dflt="$sizetype"
13536                         . ./myread
13537                         netdb_hlen_type=$ans
13538                         ;;
13539                 esac
13540                 ;;
13541         *)      : no gethostbyaddr, so pick harmless defaults
13542                 netdb_host_type='char *'
13543                 netdb_hlen_type="$sizetype"
13544                 ;;
13545         esac
13546         # Remove the "const" if needed. -- but then we'll have a 
13547         # prototype clash!
13548         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
13549 fi
13550
13551 : check for type of argument to gethostbyname. 
13552 if test "X$netdb_name_type" = X ; then
13553         case "$d_gethbyname" in
13554         $define)
13555                 $cat <<EOM
13556
13557 Checking to see what type of argument is accepted by gethostbyname().
13558 EOM
13559                 hdrs="$define sys/types.h
13560                         $d_socket sys/socket.h 
13561                         $i_niin netinet/in.h 
13562                         $i_netdb netdb.h
13563                         $i_unistd unistd.h"
13564                 for xxx in "const char *" "char *"; do
13565                         case "$netdb_name_type" in
13566                         '')     try="extern struct hostent *gethostbyname($xxx);"
13567                                 if ./protochk "$try" $hdrs; then
13568                                         echo "Your system accepts $xxx."
13569                                         netdb_name_type="$xxx"
13570                                 fi
13571                                 ;;
13572                         esac
13573                 done
13574                 : In case none of those worked, prompt the user.
13575                 case "$netdb_name_type" in
13576                 '')     rp='What is the type for the 1st argument to gethostbyname?'
13577                         dflt='char *'
13578                         . ./myread
13579                         netdb_name_type=$ans
13580                         ;;
13581                 esac
13582                 ;;
13583         *)      : no gethostbyname, so pick harmless default
13584                 netdb_name_type='char *'
13585                 ;;
13586         esac
13587 fi
13588
13589 : check for type of 1st argument to getnetbyaddr. 
13590 if test "X$netdb_net_type" = X ; then
13591         case "$d_getnbyaddr" in
13592         $define)
13593                 $cat <<EOM
13594
13595 Checking to see what type of 1st argument is accepted by getnetbyaddr().
13596 EOM
13597                 hdrs="$define sys/types.h
13598                         $d_socket sys/socket.h 
13599                         $i_niin netinet/in.h 
13600                         $i_netdb netdb.h
13601                         $i_unistd unistd.h"
13602                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
13603                         case "$netdb_net_type" in
13604                         '')     try="extern struct netent *getnetbyaddr($xxx, int);"
13605                                 if ./protochk "$try" $hdrs; then
13606                                         echo "Your system accepts $xxx."
13607                                         netdb_net_type="$xxx"
13608                                 fi
13609                                 ;;
13610                         esac
13611                 done
13612                 : In case none of those worked, prompt the user.
13613                 case "$netdb_net_type" in
13614                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
13615                         dflt='long'
13616                         . ./myread
13617                         netdb_net_type=$ans
13618                         ;;
13619                 esac
13620                 ;;
13621         *)      : no getnetbyaddr, so pick harmless default
13622                 netdb_net_type='long'
13623                 ;;
13624         esac
13625 fi
13626 : locate the preferred pager for this system
13627 case "$pager" in
13628 '')
13629         dflt=''
13630         case "$pg" in
13631         /*) dflt=$pg;;
13632         [a-zA-Z]:/*) dflt=$pg;;
13633         esac
13634         case "$more" in
13635         /*) dflt=$more;;
13636         [a-zA-Z]:/*) dflt=$more;;
13637         esac
13638         case "$less" in
13639         /*) dflt=$less;;
13640         [a-zA-Z]:/*) dflt=$less;;
13641         esac
13642         case "$dflt" in
13643         '') dflt=/usr/ucb/more;;
13644         esac
13645         ;;
13646 *) dflt="$pager";;
13647 esac
13648 echo " "
13649 fn=f/
13650 rp='What pager is used on your system?'
13651 . ./getfile
13652 pager="$ans"
13653
13654 : see what type pids are declared as in the kernel
13655 rp="What is the type of process ids on this system?"
13656 set pid_t pidtype int stdio.h sys/types.h
13657 eval $typedef_ask
13658
13659 : Find earliest binary compatible site_perl subdirectory perl can use.
13660 case "$bincompat5005" in
13661 "$define") xs_apiversion='5.005' ;;
13662 *) xs_apiversion=$version ;;   # The current site_perl version.
13663 esac
13664 : Find earliest pure perl site_perl subdirectory perl can use.
13665 : The versioned directories started at 5.005.
13666 pm_apiversion='5.005'
13667
13668 : check for length of pointer
13669 echo " "
13670 case "$ptrsize" in
13671 '')
13672         echo "Checking to see how big your pointers are..." >&4
13673         if test "$voidflags" -gt 7; then
13674                 echo '#define VOID_PTR char *' > try.c
13675         else
13676                 echo '#define VOID_PTR void *' > try.c
13677         fi
13678         $cat >>try.c <<'EOCP'
13679 #include <stdio.h>
13680 int main()
13681 {
13682     printf("%d\n", (int)sizeof(VOID_PTR));
13683     exit(0);
13684 }
13685 EOCP
13686         set try
13687         if eval $compile_ok; then
13688                 ptrsize=`./try`
13689                 echo "Your pointers are $ptrsize bytes long."
13690         else
13691                 dflt='4'
13692                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
13693                 rp="What is the size of a pointer (in bytes)?"
13694                 . ./myread
13695                 ptrsize="$ans"
13696         fi
13697         ;;
13698 esac
13699 $rm -f try.c try
13700
13701 : see if ar generates random libraries by itself
13702 echo " "
13703 echo "Checking how to generate random libraries on your machine..." >&4
13704 echo 'int bar1() { return bar2(); }' > bar1.c
13705 echo 'int bar2() { return 2; }' > bar2.c
13706 $cat > foo.c <<'EOP'
13707 int main() { printf("%d\n", bar1()); exit(0); }
13708 EOP
13709 $cc $ccflags -c bar1.c >/dev/null 2>&1
13710 $cc $ccflags -c bar2.c >/dev/null 2>&1
13711 $cc $ccflags -c foo.c >/dev/null 2>&1
13712 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
13713 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
13714         ./foobar >/dev/null 2>&1; then
13715         echo "$ar appears to generate random libraries itself."
13716         orderlib=false
13717         ranlib=":"
13718 elif $ar ts bar$_a >/dev/null 2>&1 &&
13719         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
13720         ./foobar >/dev/null 2>&1; then
13721                 echo "a table of contents needs to be added with '$ar ts'."
13722                 orderlib=false
13723                 ranlib="$ar ts"
13724 else
13725         case "$ranlib" in
13726         :) ranlib='';;
13727         '')
13728                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
13729                 $test -f $ranlib || ranlib=''
13730                 ;;
13731         esac
13732         if $test -n "$ranlib"; then
13733                 echo "your system has '$ranlib'; we'll use that."
13734                 orderlib=false
13735         else
13736                 echo "your system doesn't seem to support random libraries"
13737                 echo "so we'll use lorder and tsort to order the libraries."
13738                 orderlib=true
13739                 ranlib=":"
13740         fi
13741 fi
13742 $rm -f foo* bar* 
13743
13744 : check for type of arguments to select. 
13745 case "$selecttype" in
13746 '') case "$d_select" in
13747         $define)
13748                 echo " "
13749                 $cat <<EOM
13750 Checking to see what type of arguments are accepted by select().
13751 EOM
13752                 hdrs="$define sys/types.h
13753                         $i_systime sys/time.h 
13754                         $i_sysselct sys/select.h
13755                         $d_socket sys/socket.h"
13756                 : The first arg can be int, unsigned, or size_t
13757                 : The last arg may or may not be 'const'
13758                 val=''
13759                 : void pointer has been seen but using that
13760                 : breaks the selectminbits test
13761                 for xxx in 'fd_set *' 'int *'; do
13762                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
13763                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
13764                                         case "$val" in
13765                                         '')     try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
13766                                                 if ./protochk "$try" $hdrs; then
13767                                                         echo "Your system accepts $xxx."
13768                                                         val="$xxx"
13769                                                 fi
13770                                                 ;;
13771                                         esac
13772                                 done
13773                         done
13774                 done
13775                 case "$val" in
13776                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
13777                         case "$d_fd_set" in
13778                                 $define) dflt="fd_set *" ;;
13779                                 *)              dflt="int *" ;;
13780                         esac
13781                         . ./myread
13782                         val=$ans
13783                         ;;
13784                 esac
13785                 selecttype="$val"
13786                 ;;
13787         *)      : no select, so pick a harmless default
13788                 selecttype='int *'
13789                 ;;
13790         esac
13791         ;;
13792 esac
13793
13794 : check for the select 'width'
13795 case "$selectminbits" in
13796 '') case "$d_select" in
13797         $define)
13798                 $cat <<EOM
13799
13800 Checking to see on how many bits at a time your select() operates...
13801 EOM
13802                 $cat >try.c <<EOCP
13803 #include <sys/types.h>
13804 #$i_time I_TIME
13805 #$i_systime I_SYS_TIME
13806 #$i_systimek I_SYS_TIME_KERNEL
13807 #ifdef I_TIME
13808 #   include <time.h>
13809 #endif
13810 #ifdef I_SYS_TIME
13811 #   ifdef I_SYS_TIME_KERNEL
13812 #       define KERNEL
13813 #   endif
13814 #   include <sys/time.h>
13815 #   ifdef I_SYS_TIME_KERNEL
13816 #       undef KERNEL
13817 #   endif
13818 #endif
13819 #$i_sysselct I_SYS_SELECT
13820 #ifdef I_SYS_SELECT
13821 #include <sys/select.h>
13822 #endif
13823 #$d_socket HAS_SOCKET
13824 #ifdef HAS_SOCKET
13825 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
13826 #endif
13827 #include <stdio.h>
13828 $selecttype b;
13829 #define S sizeof(*(b))
13830 #define MINBITS 64
13831 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
13832 #define NBITS  (NBYTES * 8)
13833 int main() {
13834     char s[NBYTES];
13835     struct timeval t;
13836     int i;
13837     FILE* fp;
13838     int fd;
13839
13840     fclose(stdin);
13841     fp = fopen("try.c", "r");
13842     if (fp == 0)
13843       exit(1);
13844     fd = fileno(fp);
13845     if (fd < 0)
13846       exit(2);
13847     b = ($selecttype)s;
13848     for (i = 0; i < NBITS; i++)
13849         FD_SET(i, b);
13850     t.tv_sec  = 0;
13851     t.tv_usec = 0;
13852     select(fd + 1, b, 0, 0, &t);
13853     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
13854     printf("%d\n", i + 1);
13855     return 0;
13856 }
13857 EOCP
13858                 set try
13859                 if eval $compile_ok; then
13860                         selectminbits=`./try`
13861                         case "$selectminbits" in
13862                         '')     cat >&4 <<EOM
13863 Cannot figure out on how many bits at a time your select() operates.
13864 I'll play safe and guess it is 32 bits.
13865 EOM
13866                                 selectminbits=32
13867                                 bits="32 bits"
13868                                 ;;
13869                         1)      bits="1 bit" ;;
13870                         *)      bits="$selectminbits bits" ;;
13871                         esac
13872                         echo "Your select() operates on $bits at a time." >&4
13873                 else
13874                         rp='What is the minimum number of bits your select() operates on?'
13875                         case "$byteorder" in
13876                         1234|12345678)  dflt=32 ;;
13877                         *)              dflt=1  ;;
13878                         esac
13879                         . ./myread
13880                         val=$ans
13881                         selectminbits="$val"
13882                 fi
13883                 $rm -f try.* try
13884                 ;;
13885         *)      : no select, so pick a harmless default
13886                 selectminbits='32'
13887                 ;;
13888         esac
13889         ;;
13890 esac
13891
13892 : Trace out the files included by signal.h, then look for SIGxxx names.
13893 : Remove SIGARRAYSIZE used by HPUX.
13894 : Remove SIGSTKSIZE used by Linux.
13895 : Remove SIGSTKSZ used by Posix.
13896 : Remove SIGTYP void lines used by OS2.
13897 : Some cpps, like os390, dont give the file name anywhere
13898 if [ "X$fieldn" = X ]; then
13899         : Just make some guesses.  We check them later.
13900         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
13901 else
13902         xxx=`echo '#include <signal.h>' |
13903         $cppstdin $cppminus $cppflags 2>/dev/null |
13904         $grep '^[       ]*#.*include' | 
13905         $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sort | $uniq`
13906 fi
13907 : Check this list of files to be sure we have parsed the cpp output ok.
13908 : This will also avoid potentially non-existent files, such 
13909 : as ../foo/bar.h
13910 xxxfiles=''
13911 for xx in $xxx /dev/null ; do
13912         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
13913 done
13914 : If we have found no files, at least try signal.h
13915 case "$xxxfiles" in
13916 '')     xxxfiles=`./findhdr signal.h` ;;
13917 esac
13918 xxx=`awk '
13919 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
13920         print substr($2, 4, 20)
13921 }
13922 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
13923         print substr($3, 4, 20)
13924 }' $xxxfiles`
13925 : Append some common names just in case the awk scan failed.
13926 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
13927 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
13928 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
13929 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
13930 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
13931
13932 : generate a few handy files for later
13933 $cat > signal.c <<'EOCP'
13934 #include <sys/types.h>
13935 #include <signal.h>
13936 #include <stdio.h>
13937 int main() {
13938
13939 /* Strange style to avoid deeply-nested #if/#else/#endif */
13940 #ifndef NSIG
13941 #  ifdef _NSIG
13942 #    define NSIG (_NSIG)
13943 #  endif
13944 #endif
13945
13946 #ifndef NSIG
13947 #  ifdef SIGMAX
13948 #    define NSIG (SIGMAX+1)
13949 #  endif
13950 #endif
13951
13952 #ifndef NSIG
13953 #  ifdef SIG_MAX
13954 #    define NSIG (SIG_MAX+1)
13955 #  endif
13956 #endif
13957
13958 #ifndef NSIG
13959 #  ifdef MAXSIG
13960 #    define NSIG (MAXSIG+1)
13961 #  endif
13962 #endif
13963
13964 #ifndef NSIG
13965 #  ifdef MAX_SIG
13966 #    define NSIG (MAX_SIG+1)
13967 #  endif
13968 #endif
13969
13970 #ifndef NSIG
13971 #  ifdef SIGARRAYSIZE
13972 #    define NSIG (SIGARRAYSIZE+1) /* Not sure of the +1 */
13973 #  endif
13974 #endif
13975
13976 #ifndef NSIG
13977 #  ifdef _sys_nsig
13978 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
13979 #  endif
13980 #endif
13981
13982 /* Default to some arbitrary number that's big enough to get most
13983    of the common signals.
13984 */
13985 #ifndef NSIG
13986 #    define NSIG 50
13987 #endif
13988
13989 printf("NSIG %d\n", NSIG);
13990
13991 #ifndef JUST_NSIG
13992
13993 EOCP
13994
13995 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
13996 {
13997         printf "#ifdef SIG"; printf $1; printf "\n"
13998         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
13999         printf $1; printf ");\n"
14000         printf "#endif\n"
14001 }
14002 END {
14003         printf "#endif /* JUST_NSIG */\n";
14004         printf "exit(0);\n}\n";
14005 }
14006 ' >>signal.c
14007 $cat >signal.awk <<'EOP'
14008 BEGIN { ndups = 0 }
14009 $1 ~ /^NSIG$/ { nsig = $2 }
14010 ($1 !~ /^NSIG$/) && (NF == 2) {
14011     if ($2 > maxsig) { maxsig = $2 }
14012     if (sig_name[$2]) {
14013         dup_name[ndups] = $1
14014         dup_num[ndups] = $2
14015         ndups++ 
14016     }
14017     else {
14018         sig_name[$2] = $1
14019         sig_num[$2] = $2
14020     }
14021 }
14022 END { 
14023     if (nsig == 0) {
14024         nsig = maxsig + 1
14025     }
14026     printf("NSIG %d\n", nsig);
14027     for (n = 1; n < nsig; n++) {
14028         if (sig_name[n]) {
14029             printf("%s %d\n", sig_name[n], sig_num[n])
14030         }
14031         else {
14032             printf("NUM%d %d\n", n, n) 
14033         }
14034     }
14035     for (n = 0; n < ndups; n++) {
14036         printf("%s %d\n", dup_name[n], dup_num[n])
14037     }
14038 }
14039 EOP
14040 $cat >signal_cmd <<EOS
14041 $startsh
14042 if $test -s signal.lst; then
14043     echo "Using your existing signal.lst file"
14044         exit 0
14045 fi
14046 xxx="$xxx"
14047 EOS
14048 $cat >>signal_cmd <<'EOS'
14049
14050 set signal
14051 if eval $compile_ok; then
14052         ./signal$_exe | $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
14053 else
14054         echo "(I can't seem be able to compile the whole test program)" >&4
14055         echo "(I'll try it in little pieces.)" >&4
14056         set signal -DJUST_NSIG
14057         if eval $compile_ok; then
14058                 ./signal$_exe > signal.nsg
14059                 $cat signal.nsg
14060         else
14061                 echo "I can't seem to figure out how many signals you have." >&4
14062                 echo "Guessing 50." >&4
14063                 echo 'NSIG 50' > signal.nsg
14064         fi
14065         : Now look at all the signal names, one at a time.
14066         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
14067                 $cat > signal.c <<EOCP
14068 #include <sys/types.h>
14069 #include <signal.h>
14070 #include <stdio.h>
14071 int main() {
14072 printf("$xx %d\n", SIG${xx});
14073 return 0;
14074 }
14075 EOCP
14076                 set signal
14077                 if eval $compile; then
14078                         echo "SIG${xx} found."
14079                         ./signal$_exe  >> signal.ls1
14080                 else
14081                         echo "SIG${xx} NOT found."
14082                 fi
14083         done
14084         if $test -s signal.ls1; then
14085                 $cat signal.nsg signal.ls1 |
14086                         $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
14087         fi
14088
14089 fi
14090 if $test -s signal.lst; then
14091         :
14092 else
14093         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
14094         echo 'kill -l' >signal
14095         set X `csh -f <signal`
14096         $rm -f signal
14097         shift
14098         case $# in
14099         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
14100         esac
14101         echo $@ | $tr ' ' $trnl | \
14102             $awk '{ printf "%s %d\n", $1, ++s; }
14103                   END { printf "NSIG %d\n", ++s }' >signal.lst
14104 fi
14105 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
14106 EOS
14107 chmod a+x signal_cmd
14108 $eunicefix signal_cmd
14109
14110 : generate list of signal names
14111 echo " "
14112 case "$sig_name_init" in
14113 '') doinit=yes ;;
14114 *)  case "$sig_num_init" in
14115     ''|*,*) doinit=yes ;;
14116     esac ;;
14117 esac
14118 case "$doinit" in
14119 yes)
14120         echo "Generating a list of signal names and numbers..." >&4
14121         . ./signal_cmd
14122         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
14123         sig_name=`$awk 'BEGIN { printf "ZERO " }
14124                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
14125         sig_num=`$awk  'BEGIN { printf "0 " }
14126                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
14127         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
14128                              !/^NSIG/   { printf "\"%s\", ", $1 }
14129                              END        { printf "0\n" }' signal.lst`
14130         sig_num_init=`$awk  'BEGIN      { printf "0, " }
14131                              !/^NSIG/   { printf "%d, ", $2}
14132                              END        { printf "0\n"}' signal.lst`
14133         ;;
14134 esac
14135 echo "The following $sig_count signals are available:"
14136 echo " "
14137 echo $sig_name | $awk \
14138 'BEGIN { linelen = 0 }
14139 {
14140         for (i = 1; i <= NF; i++) {
14141                 name = "SIG" $i " "
14142                 linelen = linelen + length(name)
14143                 if (linelen > 70) {
14144                         printf "\n"
14145                         linelen = length(name)
14146                 }
14147                 printf "%s", name
14148         }
14149         printf "\n"
14150 }'
14151 $rm -f signal signal.c signal.awk signal.lst signal_cmd 
14152
14153 echo " "
14154 case "$sizetype" in
14155 *_t) zzz="$sizetype"    ;;
14156 *)   zzz="filesize"     ;;
14157 esac
14158 echo "Checking the size of $zzz..." >&4 
14159 cat > try.c <<EOCP
14160 #include <sys/types.h>
14161 #include <stdio.h>
14162 int main() {
14163     printf("%d\n", (int)sizeof($sizetype));
14164     exit(0);
14165 }
14166 EOCP
14167 set try
14168 if eval $compile_ok; then
14169         yyy=`./try`
14170         case "$yyy" in
14171         '')     sizesize=4
14172                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
14173                 ;;
14174         *)      sizesize=$yyy
14175                 echo "Your $zzz size is $sizesize bytes."
14176                 ;;
14177         esac
14178 else
14179         sizesize=4
14180         echo "(I can't compile the test program--guessing $sizesize.)" >&4
14181 fi
14182
14183
14184 : check for socklen_t
14185 echo " "
14186 echo "Checking to see if you have socklen_t..." >&4
14187 $cat >try.c <<EOCP
14188 #include <sys/types.h>
14189 #$d_socket HAS_SOCKET
14190 #ifdef HAS_SOCKET
14191 #include <sys/socket.h>
14192 #endif
14193 int main() { socklen_t x = 16; }
14194 EOCP
14195 set try
14196 if eval $compile; then
14197         val="$define"
14198         echo "You have socklen_t."
14199 else
14200         val="$undef"
14201         echo "You do not have socklen_t."
14202         case "$sizetype" in
14203         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
14204         esac
14205 fi
14206 $rm -f try try.*
14207 set d_socklen_t
14208 eval $setvar
14209
14210 : check for type of the size argument to socket calls
14211 case "$d_socket" in
14212 "$define")
14213         $cat <<EOM
14214
14215 Checking to see what type is the last argument of accept().
14216 EOM
14217         hdrs="$define sys/types.h $d_socket sys/socket.h" 
14218         yyy=''
14219         case "$d_socklen_t" in
14220         "$define") yyy="$yyy socklen_t"
14221         esac
14222         yyy="$yyy $sizetype int long unsigned"
14223         for xxx in $yyy; do
14224                 case "$socksizetype" in
14225                 '')     try="extern int accept(int, struct sockaddr *, $xxx *);"
14226                         if ./protochk "$try" $hdrs; then
14227                                 echo "Your system accepts '$xxx *' for the last argument of accept()."
14228                                 socksizetype="$xxx"
14229                         fi
14230                         ;;
14231                 esac
14232         done
14233 : In case none of those worked, prompt the user.
14234         case "$socksizetype" in
14235         '')     rp='What is the type for socket address structure sizes?'
14236                 dflt='int'
14237                 . ./myread
14238                 socksizetype=$ans
14239                 ;;
14240         esac
14241         ;;
14242 *)      : no sockets, so pick relatively harmless default
14243         socksizetype='int'
14244         ;;
14245 esac
14246
14247 : see what type is used for signed size_t
14248 set ssize_t ssizetype int stdio.h sys/types.h
14249 eval $typedef
14250 dflt="$ssizetype"
14251 $cat > ssize.c <<EOM
14252 #include <stdio.h>
14253 #include <sys/types.h>
14254 #define Size_t $sizetype
14255 #define SSize_t $dflt
14256 int main()
14257 {
14258         if (sizeof(Size_t) == sizeof(SSize_t))
14259                 printf("$dflt\n");
14260         else if (sizeof(Size_t) == sizeof(int))
14261                 printf("int\n");
14262         else 
14263                 printf("long\n");
14264         exit(0);
14265 }
14266 EOM
14267 echo " "
14268 set ssize
14269 if eval $compile_ok && ./ssize > /dev/null; then
14270         ssizetype=`./ssize`
14271         echo "I'll be using $ssizetype for functions returning a byte count." >&4
14272 else
14273         $cat >&4 <<EOM
14274 Help! I can't compile and run the ssize_t test program: please enlighten me!
14275 (This is probably a misconfiguration in your system or libraries, and
14276 you really ought to fix it.  Still, I'll try anyway.)
14277
14278 I need a type that is the same size as $sizetype, but is guaranteed to
14279 be signed.  Common values are ssize_t, int and long.
14280
14281 EOM
14282         rp="What signed type is the same size as $sizetype?"
14283         . ./myread
14284         ssizetype="$ans"
14285 fi
14286 $rm -f ssize ssize.*
14287
14288 : see what type of char stdio uses.
14289 echo " "
14290 if $contains 'unsigned.*char.*_ptr;' `./findhdr stdio.h` >/dev/null 2>&1 ; then
14291         echo "Your stdio uses unsigned chars." >&4
14292         stdchar="unsigned char"
14293 else
14294         echo "Your stdio uses signed chars." >&4
14295         stdchar="char"
14296 fi
14297
14298 : see if time exists
14299 echo " "
14300 if test "X$d_time" = X -o X"$timetype" = X; then
14301     if set time val -f d_time; eval $csym; $val; then
14302                 echo 'time() found.' >&4
14303                 val="$define"
14304                 rp="What is the type returned by time() on this system?"
14305                 set time_t timetype long stdio.h sys/types.h
14306                 eval $typedef_ask
14307     else
14308                 echo 'time() not found, hope that will do.' >&4
14309                 val="$undef"
14310                 timetype='int';
14311     fi
14312     set d_time
14313     eval $setvar
14314 fi
14315
14316 : see what type uids are declared as in the kernel
14317 echo " "
14318 echo "Looking for the type for user ids returned by getuid()."
14319 set uid_t uidtype xxx stdio.h sys/types.h
14320 eval $typedef
14321 case "$uidtype" in
14322 xxx)
14323         xxx=`./findhdr sys/user.h`
14324         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
14325         case $1 in
14326         unsigned) dflt="$1 $2" ;;
14327         *) dflt="$1" ;;
14328         esac
14329         ;;
14330 *) dflt="$uidtype";;
14331 esac
14332 case "$uidtype" in
14333 uid_t)  echo "uid_t found." ;;
14334 *)      rp="What is the type for user ids returned by getuid()?"
14335         . ./myread
14336         uidtype="$ans"
14337         ;;
14338 esac
14339
14340 echo " "
14341 case "$uidtype" in
14342 *_t) zzz="$uidtype"     ;;
14343 *)   zzz="uid"          ;;
14344 esac
14345 echo "Checking the size of $zzz..." >&4 
14346 cat > try.c <<EOCP
14347 #include <sys/types.h>
14348 #include <stdio.h>
14349 int main() {
14350     printf("%d\n", (int)sizeof($uidtype));
14351     exit(0);
14352 }
14353 EOCP
14354 set try
14355 if eval $compile_ok; then
14356         yyy=`./try`
14357         case "$yyy" in
14358         '')     uidsize=4
14359                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
14360                 ;;
14361         *)      uidsize=$yyy
14362                 echo "Your $zzz is $uidsize bytes long."
14363                 ;;
14364         esac
14365 else
14366         uidsize=4
14367         echo "(I can't compile the test program--guessing $uidsize.)" >&4
14368 fi
14369
14370 echo " "
14371 case "$uidtype" in
14372 *_t) zzz="$uidtype"     ;;
14373 *)   zzz="uid"          ;;
14374 esac
14375 echo "Checking the sign of $zzz..." >&4
14376 cat > try.c <<EOCP
14377 #include <sys/types.h>
14378 #include <stdio.h>
14379 int main() {
14380         $uidtype foo = -1;
14381         if (foo < 0)
14382                 printf("-1\n");
14383         else
14384                 printf("1\n");
14385 }
14386 EOCP
14387 set try
14388 if eval $compile; then
14389         yyy=`./try`
14390         case "$yyy" in
14391         '')     uidsign=1
14392                 echo "(I can't execute the test program--guessing unsigned.)" >&4
14393                 ;;
14394         *)      uidsign=$yyy
14395                 case "$uidsign" in
14396                  1) echo "Your $zzz is unsigned." ;;
14397                 -1) echo "Your $zzz is signed."   ;;
14398                 esac
14399                 ;;
14400         esac
14401 else
14402         uidsign=1
14403         echo "(I can't compile the test program--guessing unsigned.)" >&4
14404 fi
14405
14406
14407
14408 echo " "
14409 $echo "Checking the format string to be used for uids..." >&4
14410
14411 case "$uidsign" in
14412 -1)     if $test X"$uidsize" = X"$ivsize"; then
14413                 uidformat="$ivdformat"
14414         else
14415                 if $test X"$uidsize" = X"$longsize"; then
14416                         uidformat='"ld"'
14417                 else
14418                         if $test X"$uidsize" = X"$intsize"; then
14419                                 uidformat='"d"'
14420                         else
14421                                 if $test X"$uidsize" = X"$shortsize"; then
14422                                         uidformat='"hd"'
14423                                 fi
14424                         fi
14425                 fi
14426         fi
14427         ;;
14428 *)      if $test X"$uidsize" = X"$uvsize"; then
14429                 uidformat="$uvuformat"
14430         else
14431                 if $test X"$uidsize" = X"$longsize"; then
14432                         uidformat='"lu"'
14433                 else
14434                         if $test X"$uidsize" = X"$intsize"; then
14435                                 uidformat='"u"'
14436                         else
14437                                 if $test X"$uidsize" = X"$shortsize"; then
14438                                         uidformat='"hu"'
14439                                 fi
14440                         fi
14441                 fi
14442         fi
14443         ;;
14444 esac
14445
14446 : see if dbm.h is available
14447 : see if dbmclose exists
14448 set dbmclose d_dbmclose
14449 eval $inlibc
14450
14451 case "$d_dbmclose" in
14452 $define)
14453         set dbm.h i_dbm
14454         eval $inhdr
14455         case "$i_dbm" in
14456         $define)
14457                 val="$undef"
14458                 set i_rpcsvcdbm
14459                 eval $setvar
14460                 ;;
14461         *)      set rpcsvc/dbm.h i_rpcsvcdbm
14462                 eval $inhdr
14463                 ;;
14464         esac
14465         ;;
14466 *)      echo "We won't be including <dbm.h>"
14467         val="$undef"
14468         set i_dbm
14469         eval $setvar
14470         val="$undef"
14471         set i_rpcsvcdbm
14472         eval $setvar
14473         ;;
14474 esac
14475
14476 : see if this is a sys/file.h system
14477 val=''
14478 set sys/file.h val
14479 eval $inhdr
14480
14481 : do we need to include sys/file.h ?
14482 case "$val" in
14483 "$define")
14484         echo " "
14485         if $h_sysfile; then
14486                 val="$define"
14487                 echo "We'll be including <sys/file.h>." >&4
14488         else
14489                 val="$undef"
14490                 echo "We won't be including <sys/file.h>." >&4
14491         fi
14492         ;;
14493 *)
14494         h_sysfile=false
14495         ;;
14496 esac
14497 set i_sysfile
14498 eval $setvar
14499
14500 : see if fcntl.h is there
14501 val=''
14502 set fcntl.h val
14503 eval $inhdr
14504
14505 : see if we can include fcntl.h
14506 case "$val" in
14507 "$define")
14508         echo " "
14509         if $h_fcntl; then
14510                 val="$define"
14511                 echo "We'll be including <fcntl.h>." >&4
14512         else
14513                 val="$undef"
14514                 if $h_sysfile; then
14515         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
14516                 else
14517                         echo "We won't be including <fcntl.h>." >&4
14518                 fi
14519         fi
14520         ;;
14521 *)
14522         h_fcntl=false
14523         val="$undef"
14524         ;;
14525 esac
14526 set i_fcntl
14527 eval $setvar
14528
14529 : see if this is a iconv.h system
14530 set iconv.h i_iconv
14531 eval $inhdr
14532
14533 : see if this is a ieeefp.h system
14534 set ieeefp.h i_ieeefp
14535 eval $inhdr
14536
14537 : see if this is a libutil.h system
14538 set libutil.h i_libutil
14539 eval $inhdr
14540
14541 : see if locale.h is available
14542 set locale.h i_locale
14543 eval $inhdr
14544
14545 : see if mach cthreads are available
14546 if test "X$usethreads" = "X$define"; then
14547         set mach/cthreads.h i_machcthr
14548         eval $inhdr
14549 else
14550         i_machcthr="$undef"
14551 fi
14552
14553
14554
14555 : see if this is a math.h system
14556 set math.h i_math
14557 eval $inhdr
14558
14559 : see if this is a mntent.h system
14560 set mntent.h i_mntent
14561 eval $inhdr
14562
14563 : see if ndbm.h is available
14564 set ndbm.h t_ndbm
14565 eval $inhdr
14566 case "$t_ndbm" in
14567 $define)
14568         : see if dbm_open exists
14569         set dbm_open d_dbm_open
14570         eval $inlibc
14571         case "$d_dbm_open" in
14572         $undef)
14573                 t_ndbm="$undef"
14574                 echo "We won't be including <ndbm.h>"
14575                 ;;
14576         esac
14577         ;;
14578 esac
14579 val="$t_ndbm"
14580 set i_ndbm
14581 eval $setvar
14582
14583 : see if net/errno.h is available
14584 val=''
14585 set net/errno.h val
14586 eval $inhdr
14587
14588 : Unfortunately, it causes problems on some systems.  Arrgh.
14589 case "$val" in
14590 $define)
14591         cat > try.c <<'EOM'
14592 #include <stdio.h>
14593 #include <errno.h>
14594 #include <net/errno.h>
14595 int func()
14596 {
14597         return ENOTSOCK;
14598 }
14599 EOM
14600         if $cc $ccflags -c try.c >/dev/null 2>&1; then
14601                 echo "We'll be including <net/errno.h>." >&4
14602         else
14603                 echo "We won't be including <net/errno.h>." >&4
14604                 val="$undef"
14605         fi
14606         $rm -f try.* try
14607         ;;
14608 esac
14609 set i_neterrno
14610 eval $setvar
14611
14612 : see if netinet/tcp.h is available
14613 set netinet/tcp.h i_netinettcp
14614 eval $inhdr
14615
14616 : see if this is a poll.h system
14617 set poll.h i_poll
14618 eval $inhdr
14619
14620 : see if this is a prot.h system
14621 set prot.h i_prot
14622 eval $inhdr
14623
14624 echo " "
14625 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4 
14626 $cat <<'EOSH' > Cppsym.know
14627 a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
14628 AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
14629 alliant alpha am29000 AM29000 amiga AMIGAOS AMIX
14630 ansi ANSI_C_SOURCE apollo ardent atarist att386 att3b BeOS
14631 BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
14632 BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
14633 bull c cadmus clipper CMU COFF COMPILER_VERSION
14634 concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
14635 CYGWIN DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
14636 Dynix DynixPTX ELF encore EPI EXTENSIONS FILE_OFFSET_BITS
14637 FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
14638 GNU_SOURCE GNUC GNUC_MINOR GO32 gould GOULD_PN
14639 H3050R H3050RX hbullx20 hcx host_mips
14640 hp200 hp300 hp700 HP700 hp800 hp9000
14641 hp9000s200 hp9000s300 hp9000s400 hp9000s500
14642 hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
14643 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
14644 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
14645 INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
14646 LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
14647 LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
14648 Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
14649 LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
14650 M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
14651 M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
14652 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
14653 MATH_HAS_NO_SIDE_EFFECTS
14654 mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
14655 mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
14656 mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
14657 MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
14658 mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
14659 NetBSD news1500 news1700 news1800 news1900 news3700
14660 news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
14661 ns32016 ns32332 ns32k nsc32000
14662 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
14663 pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
14664 pc532 pdp11 PGC PIC plexus PORTAR posix
14665 POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
14666 POSIX_C_SOURCE POSIX_SOURCE POWER
14667 PROTOTYPES PWB pyr QNX R3000 REENTRANT RES Rhapsody RISC6000
14668 riscix riscos RT scs SCO sequent sgi SGI_SOURCE sinix
14669 SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
14670 sony sony_news sonyrisc sparc sparclite spectrum
14671 stardent stdc STDC_EXT stratos sun sun3 sun386
14672 Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
14673 SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
14674 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
14675 sysV68 sysV88 Tek4132 Tek4300 titan
14676 tower tower32 tower32_200 tower32_600 tower32_700
14677 tower32_800 tower32_850 tss
14678 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
14679 ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
14680 unix UNIX95 UNIX99 unixpc unos USGr4 USGr4_2
14681 Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms xenix Xenix286
14682 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
14683 XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
14684 z8000
14685 EOSH
14686 # Maybe put other stuff here too.
14687 cat <<EOSH >>Cppsym.know
14688 $osname
14689 EOSH
14690 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
14691 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
14692 $cat Cppsym.know > Cppsym.c
14693 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
14694 $rm -f Cppsym.a Cppsym.b Cppsym.c
14695 cat <<EOSH > Cppsym
14696 $startsh
14697 if $test \$# -gt 0; then
14698     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
14699     if $test -s Cppsym.got; then
14700         $rm -f Cppsym.got
14701         exit 0
14702     fi
14703     $rm -f Cppsym.got
14704     exit 1
14705 else
14706     $tr " " "$trnl" | ./Cppsym.try
14707     exit 0
14708 fi
14709 EOSH
14710 chmod +x Cppsym
14711 $eunicefix Cppsym
14712 cat <<EOSH > Cppsym.try
14713 $startsh
14714 cat <<'EOCP' > try.c
14715 #include <stdio.h>
14716 int main() {
14717 EOCP
14718 $awk \\
14719 EOSH
14720 cat <<'EOSH' >> Cppsym.try
14721 'length($1) > 0 {
14722     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
14723     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
14724     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
14725     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
14726 }'       >> try.c
14727 echo '}' >> try.c
14728 EOSH
14729 cat <<EOSH >> Cppsym.try
14730 ccflags="$ccflags"
14731 case "$osname-$gccversion" in
14732 irix-) ccflags="\$ccflags -woff 1178" ;;
14733 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
14734 esac
14735 $cc -o try $optimize \$ccflags $ldflags try.c $libs && ./try$exe_ext
14736 EOSH
14737 chmod +x Cppsym.try
14738 $eunicefix Cppsym.try
14739 ./Cppsym < Cppsym.know > Cppsym.true
14740 : now check the C compiler for additional symbols
14741 postprocess_cc_v=''
14742 case "$osname" in
14743 aix) postprocess_cc_v="|$tr , ' '" ;;
14744 esac
14745 $cat >ccsym <<EOS
14746 $startsh
14747 $cat >tmp.c <<EOF
14748 extern int foo;
14749 EOF
14750 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
14751 do
14752         case "\$i" in
14753         -D*) echo "\$i" | $sed 's/^-D//';;
14754         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A\(.*\)(\(.*\))/\1=\2/';;
14755         esac
14756 done
14757 $rm -f try.c
14758 EOS
14759 postprocess_cc_v=''
14760 chmod +x ccsym
14761 $eunicefix ccsym
14762 ./ccsym > ccsym1.raw
14763 if $test -s ccsym1.raw; then
14764        $sort ccsym1.raw | $uniq >ccsym.raw
14765 else
14766        mv ccsym1.raw ccsym.raw
14767 fi
14768
14769 $awk '/\=/ { print $0; next }
14770         { print $0"=1" }' ccsym.raw >ccsym.list
14771 $awk '/\=/ { print $0; next }
14772         { print $0"=1" }' Cppsym.true >ccsym.true
14773 $comm -13 ccsym.true ccsym.list >ccsym.own
14774 $comm -12 ccsym.true ccsym.list >ccsym.com
14775 $comm -23 ccsym.true ccsym.list >ccsym.cpp
14776 also=''
14777 if $test -z ccsym.raw; then
14778         echo "Your C compiler doesn't seem to define any symbols!" >&4
14779         echo " "
14780         echo "However, your C preprocessor defines the following symbols:"
14781         $cat Cppsym.true
14782         ccsymbols=''
14783         cppsymbols=`$cat Cppsym.true`
14784         cppsymbols=`echo $cppsymbols`
14785         cppccsymbols="$cppsymbols"
14786 else
14787         if $test -s ccsym.com; then
14788                 echo "Your C compiler and pre-processor define these symbols:"
14789                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
14790                 also='also '
14791                 symbols='ones'
14792                 cppccsymbols=`$cat ccsym.com`
14793                 cppccsymbols=`echo $cppccsymbols`
14794                 $test "$silent" || sleep 1
14795         fi
14796         if $test -s ccsym.cpp; then
14797                 $test "$also" && echo " "
14798                 echo "Your C pre-processor ${also}defines the following symbols:"
14799                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
14800                 also='further '
14801                 cppsymbols=`$cat ccsym.cpp`
14802                 cppsymbols=`echo $cppsymbols`
14803                 $test "$silent" || sleep 1
14804         fi
14805         if $test -s ccsym.own; then
14806                 $test "$also" && echo " "
14807                 echo "Your C compiler ${also}defines the following cpp symbols:"
14808                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
14809                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
14810                 ccsymbols=`$cat ccsym.own`
14811                 ccsymbols=`echo $ccsymbols`
14812                 $test "$silent" || sleep 1
14813         fi
14814 fi
14815 $rm -f ccsym* Cppsym.*
14816
14817 : see if this is a termio system
14818 val="$undef"
14819 val2="$undef"
14820 val3="$undef"
14821 if $test `./findhdr termios.h`; then
14822         set tcsetattr i_termios
14823         eval $inlibc
14824         val3="$i_termios"
14825 fi
14826 echo " "
14827 case "$val3" in
14828 "$define") echo "You have POSIX termios.h... good!" >&4;;
14829 *) if ./Cppsym pyr; then
14830                 case "`/bin/universe`" in
14831                 ucb) if $test `./findhdr sgtty.h`; then
14832                                 val2="$define"
14833                                 echo "<sgtty.h> found." >&4
14834                         else
14835                                 echo "System is pyramid with BSD universe."
14836                                 echo "<sgtty.h> not found--you could have problems." >&4
14837                         fi;;
14838                 *) if $test `./findhdr termio.h`; then
14839                                 val="$define"
14840                                 echo "<termio.h> found." >&4
14841                         else
14842                                 echo "System is pyramid with USG universe."
14843                                 echo "<termio.h> not found--you could have problems." >&4
14844                         fi;;
14845                 esac
14846         elif ./usg; then
14847                 if $test `./findhdr termio.h`; then
14848                         echo "<termio.h> found." >&4
14849                         val="$define"
14850                 elif $test `./findhdr sgtty.h`; then
14851                         echo "<sgtty.h> found." >&4
14852                         val2="$define"
14853                 else
14854 echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
14855                 fi
14856         else
14857                 if $test `./findhdr sgtty.h`; then
14858                         echo "<sgtty.h> found." >&4
14859                         val2="$define"
14860                 elif $test `./findhdr termio.h`; then
14861                         echo "<termio.h> found." >&4
14862                         val="$define"
14863                 else
14864 echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
14865                 fi
14866         fi;;
14867 esac
14868 set i_termio; eval $setvar
14869 val=$val2; set i_sgtty; eval $setvar
14870 val=$val3; set i_termios; eval $setvar
14871
14872 : see if this is a shadow.h system
14873 set shadow.h i_shadow
14874 eval $inhdr
14875
14876 : see if this is a socks.h system
14877 set socks.h i_socks
14878 eval $inhdr
14879
14880 : see if stdarg is available
14881 echo " "
14882 if $test `./findhdr stdarg.h`; then
14883         echo "<stdarg.h> found." >&4
14884         valstd="$define"
14885 else
14886         echo "<stdarg.h> NOT found." >&4
14887         valstd="$undef"
14888 fi
14889
14890 : see if varags is available
14891 echo " "
14892 if $test `./findhdr varargs.h`; then
14893         echo "<varargs.h> found." >&4
14894 else
14895         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
14896 fi
14897
14898 : set up the varargs testing programs
14899 $cat > varargs.c <<EOP
14900 #ifdef I_STDARG
14901 #include <stdarg.h>
14902 #endif
14903 #ifdef I_VARARGS
14904 #include <varargs.h>
14905 #endif
14906
14907 #ifdef I_STDARG
14908 int f(char *p, ...)
14909 #else
14910 int f(va_alist)
14911 va_dcl
14912 #endif
14913 {
14914         va_list ap;
14915 #ifndef I_STDARG
14916         char *p;
14917 #endif
14918 #ifdef I_STDARG
14919         va_start(ap,p);
14920 #else
14921         va_start(ap);
14922         p = va_arg(ap, char *);
14923 #endif
14924         va_end(ap);
14925 }
14926 EOP
14927 $cat > varargs <<EOP
14928 $startsh
14929 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
14930         echo "true"
14931 else
14932         echo "false"
14933 fi
14934 $rm -f varargs$_o
14935 EOP
14936 chmod +x varargs
14937
14938 : now check which varargs header should be included
14939 echo " "
14940 i_varhdr=''
14941 case "$valstd" in
14942 "$define")
14943         if `./varargs I_STDARG`; then
14944                 val='stdarg.h'
14945         elif `./varargs I_VARARGS`; then
14946                 val='varargs.h'
14947         fi
14948         ;;
14949 *)
14950         if `./varargs I_VARARGS`; then
14951                 val='varargs.h'
14952         fi
14953         ;;
14954 esac
14955 case "$val" in
14956 '')
14957 echo "I could not find the definition for va_dcl... You have problems..." >&4
14958         val="$undef"; set i_stdarg; eval $setvar
14959         val="$undef"; set i_varargs; eval $setvar
14960         ;;
14961 *) 
14962         set i_varhdr
14963         eval $setvar
14964         case "$i_varhdr" in
14965         stdarg.h)
14966                 val="$define"; set i_stdarg; eval $setvar
14967                 val="$undef"; set i_varargs; eval $setvar
14968                 ;;
14969         varargs.h)
14970                 val="$undef"; set i_stdarg; eval $setvar
14971                 val="$define"; set i_varargs; eval $setvar
14972                 ;;
14973         esac
14974         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
14975 esac
14976 $rm -f varargs*
14977
14978 : see if stddef is available
14979 set stddef.h i_stddef
14980 eval $inhdr
14981
14982 : see if this is a sunmath.h system
14983 set sunmath.h i_sunmath
14984 eval $inhdr
14985
14986 : see if sys/access.h is available
14987 set sys/access.h i_sysaccess
14988 eval $inhdr
14989
14990 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
14991 set sys/filio.h i_sysfilio
14992 eval $inhdr
14993 echo " "
14994 if $test `./findhdr sys/ioctl.h`; then
14995         val="$define"
14996         echo '<sys/ioctl.h> found.' >&4
14997 else
14998         val="$undef"
14999         if $test $i_sysfilio = "$define"; then
15000             echo '<sys/ioctl.h> NOT found.' >&4
15001         else
15002                 $test $i_sgtty = "$define" && xxx="sgtty.h"
15003                 $test $i_termio = "$define" && xxx="termio.h"
15004                 $test $i_termios = "$define" && xxx="termios.h"
15005 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
15006         fi
15007 fi
15008 set i_sysioctl
15009 eval $setvar
15010
15011
15012 : see if this is a syslog.h system
15013 set syslog.h i_syslog
15014 eval $inhdr
15015
15016
15017 : see if this is a sys/mode.h system
15018 set sys/mode.h i_sysmode
15019 eval $inhdr
15020
15021 : see if sys/resource.h has to be included
15022 set sys/resource.h i_sysresrc
15023 eval $inhdr
15024
15025 : see if sys/security.h is available
15026 set sys/security.h i_syssecrt
15027 eval $inhdr
15028
15029 : see if this is a sys/statvfs.h system
15030 set sys/statvfs.h i_sysstatvfs
15031 eval $inhdr
15032
15033 : see if this is a sys/uio.h system
15034 set sys/uio.h i_sysuio
15035 eval $inhdr
15036
15037 : see if this is a sys/un.h system
15038 set sys/un.h i_sysun
15039 eval $inhdr
15040
15041
15042 : see if this is a sys/utsname.h system
15043 set sys/utsname.h i_sysutsname
15044 eval $inhdr
15045
15046 : see if this is a syswait system
15047 set sys/wait.h i_syswait
15048 eval $inhdr
15049
15050 : see if this is a ustat.h system
15051 set ustat.h i_ustat
15052 eval $inhdr
15053
15054 : see if this is an utime system
15055 set utime.h i_utime
15056 eval $inhdr
15057
15058 : see if this is a values.h system
15059 set values.h i_values
15060 eval $inhdr
15061
15062 : see if this is a vfork system
15063 case "$d_vfork" in
15064 "$define")
15065         set vfork.h i_vfork
15066         eval $inhdr
15067         ;;
15068 *)
15069         i_vfork="$undef"
15070         ;;
15071 esac
15072
15073 : see if gdbm.h is available
15074 set gdbm.h t_gdbm
15075 eval $inhdr
15076 case "$t_gdbm" in
15077 $define)
15078         : see if gdbm_open exists
15079         set gdbm_open d_gdbm_open
15080         eval $inlibc
15081         case "$d_gdbm_open" in
15082         $undef)
15083                 t_gdbm="$undef"
15084                 echo "We won't be including <gdbm.h>"
15085                 ;;
15086         esac
15087         ;;
15088 esac
15089 val="$t_gdbm"
15090 set i_gdbm
15091 eval $setvar
15092
15093 echo " "
15094 echo "Looking for extensions..." >&4
15095 : If we are using the old config.sh, known_extensions may contain
15096 : old or inaccurate or duplicate values.
15097 known_extensions=''
15098 nonxs_extensions=''
15099 : We do not use find because it might not be available.
15100 : We do not just use MANIFEST because the user may have dropped
15101 : some additional extensions into the source tree and expect them
15102 : to be built.
15103
15104 : Function to recursively find available extensions, ignoring DynaLoader
15105 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
15106 find_extensions='
15107     for xxx in *; do
15108        case "$xxx" in
15109            DynaLoader|dynaload) ;;
15110            *)
15111            if $test -f $xxx/$xxx.xs; then
15112                known_extensions="$known_extensions $1$xxx";
15113            elif $test -f $xxx/Makefile.PL; then
15114                nonxs_extensions="$nonxs_extensions $1$xxx";
15115            else
15116                if $test -d $xxx -a $# -lt 10; then
15117                    set $1$xxx/ $*;
15118                    cd $xxx;
15119                    eval $find_extensions;
15120                    cd ..;
15121                    shift;
15122                fi;
15123            fi
15124            ;;
15125        esac;
15126     done'
15127 tdir=`pwd`
15128 cd $rsrc/ext
15129 set X
15130 shift
15131 eval $find_extensions
15132 set X $nonxs_extensions
15133 shift
15134 nonxs_extensions="$*"
15135 set X $known_extensions
15136 shift
15137 known_extensions="$*"
15138 cd $tdir
15139
15140 : Now see which are supported on this system.
15141 avail_ext=''
15142 for xxx in $known_extensions ; do
15143         case "$xxx" in
15144         DB_File|db_file)
15145                 case "$i_db" in
15146                 $define) avail_ext="$avail_ext $xxx" ;;
15147                 esac
15148                 ;;
15149         GDBM_File|gdbm_fil)
15150                 case "$i_gdbm" in 
15151                 $define) avail_ext="$avail_ext $xxx" ;;
15152                 esac
15153                 ;;
15154         NDBM_File|ndbm_fil)
15155                 case "$i_ndbm" in
15156                 $define)
15157                     case "$osname-$use64bitint" in
15158                     hpux-define)
15159                         case "$libs" in
15160                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
15161                         esac
15162                         ;;
15163                     *) avail_ext="$avail_ext $xxx" ;;
15164                     esac
15165                     ;;
15166                 esac
15167                 ;;
15168         ODBM_File|odbm_fil) 
15169                 case "${i_dbm}${i_rpcsvcdbm}" in
15170                 *"${define}"*)
15171                     case "$osname-$use64bitint" in
15172                     hpux-define)
15173                         case "$libs" in
15174                         *-ldbm*) avail_ext="$avail_ext $xxx" ;;
15175                         esac
15176                         ;;
15177                     *) avail_ext="$avail_ext $xxx" ;;
15178                     esac
15179                     ;;
15180                 esac
15181                 ;;
15182         POSIX|posix)
15183                 case "$useposix" in
15184                 true|define|y) avail_ext="$avail_ext $xxx" ;;
15185                 esac
15186                 ;;
15187         Opcode|opcode)
15188                 case "$useopcode" in
15189                 true|define|y) avail_ext="$avail_ext $xxx" ;;
15190                 esac
15191                 ;;
15192         Socket|socket)
15193                 case "$d_socket" in 
15194                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
15195                 esac
15196                 ;;
15197         Sys/Syslog|sys/syslog)
15198                 : XXX syslog requires socket
15199                 case "$d_socket" in 
15200                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
15201                 esac
15202                 ;;
15203         Thread|thread)
15204                 case "$usethreads" in 
15205                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
15206                 esac
15207                 ;;
15208         IPC/SysV|ipc/sysv)
15209                 : XXX Do we need a useipcsysv variable here
15210                 case "${d_msg}${d_sem}${d_shm}" in 
15211                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
15212                 esac
15213                 ;;
15214         *)      avail_ext="$avail_ext $xxx"
15215                 ;;
15216         esac
15217 done
15218
15219 set X $avail_ext
15220 shift
15221 avail_ext="$*"
15222
15223 : Now see which nonxs extensions are supported on this system.
15224 : For now assume all are.
15225 nonxs_ext=''
15226 for xxx in $nonxs_extensions ; do
15227         case "$xxx" in
15228         *)      nonxs_ext="$nonxs_ext $xxx"
15229                 ;;
15230         esac
15231 done
15232
15233 set X $nonxs_ext
15234 shift
15235 nonxs_ext="$*"
15236
15237 case $usedl in
15238 $define)
15239         $cat <<EOM
15240 A number of extensions are supplied with $package.  You may choose to
15241 compile these extensions for dynamic loading (the default), compile
15242 them into the $package executable (static loading), or not include
15243 them at all.  Answer "none" to include no extensions.
15244 Note that DynaLoader is always built and need not be mentioned here.
15245
15246 EOM
15247         case "$dynamic_ext" in
15248         '') dflt="$avail_ext" ;;
15249         *)      dflt="$dynamic_ext"
15250                 # Perhaps we are reusing an old out-of-date config.sh.
15251                 case "$hint" in
15252                 previous)
15253                         if test X"$dynamic_ext" != X"$avail_ext"; then
15254                                 $cat <<EOM
15255 NOTICE:  Your previous config.sh list may be incorrect. 
15256 The extensions now available to you are 
15257         ${avail_ext}
15258 but the default list from your previous config.sh is
15259         ${dynamic_ext} 
15260
15261 EOM
15262                         fi
15263                         ;;
15264                 esac
15265                 ;;
15266         esac
15267         case "$dflt" in
15268         '')     dflt=none;;
15269         esac
15270         rp="What extensions do you wish to load dynamically?"
15271         . ./myread
15272         case "$ans" in
15273         none) dynamic_ext=' ' ;;
15274         *) dynamic_ext="$ans" ;;
15275         esac
15276
15277         case "$static_ext" in
15278         '')
15279                 : Exclude those already listed in dynamic linking
15280                 dflt=''
15281                 for xxx in $avail_ext; do
15282                         case " $dynamic_ext " in
15283                         *" $xxx "*) ;;
15284                         *) dflt="$dflt $xxx" ;;
15285                         esac
15286                 done
15287                 set X $dflt
15288                 shift
15289                 dflt="$*"
15290                 ;;
15291         *)  dflt="$static_ext" 
15292                 ;;
15293         esac
15294
15295         case "$dflt" in
15296         '')     dflt=none;;
15297         esac
15298         rp="What extensions do you wish to load statically?"
15299         . ./myread
15300         case "$ans" in
15301         none) static_ext=' ' ;;
15302         *) static_ext="$ans" ;;
15303         esac
15304         ;;
15305 *)
15306         $cat <<EOM
15307 A number of extensions are supplied with $package.  Answer "none" 
15308 to include no extensions. 
15309 Note that DynaLoader is always built and need not be mentioned here.
15310
15311 EOM
15312         case "$static_ext" in
15313         '') dflt="$avail_ext" ;;
15314         *)      dflt="$static_ext"
15315                 # Perhaps we are reusing an old out-of-date config.sh.
15316                 case "$hint" in
15317                 previous)
15318                         if test X"$static_ext" != X"$avail_ext"; then
15319                                 $cat <<EOM
15320 NOTICE:  Your previous config.sh list may be incorrect. 
15321 The extensions now available to you are 
15322         ${avail_ext}
15323 but the default list from your previous config.sh is
15324         ${static_ext} 
15325
15326 EOM
15327                         fi
15328                         ;;
15329                 esac
15330                 ;;
15331         esac
15332         : Exclude those that are not xs extensions
15333         case "$dflt" in
15334         '')     dflt=none;;
15335         esac
15336         rp="What extensions do you wish to include?"
15337         . ./myread
15338         case "$ans" in
15339         none) static_ext=' ' ;;
15340         *) static_ext="$ans" ;;
15341         esac
15342         ;;
15343 esac
15344
15345 set X $dynamic_ext $static_ext $nonxs_ext
15346 shift
15347 extensions="$*"
15348
15349 : Remove libraries needed only for extensions
15350 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
15351 : The exception is SunOS 4.x, which needs them.
15352 case "${osname}X${osvers}" in
15353 sunos*X4*)
15354     perllibs="$libs"
15355     ;;
15356 *) case "$usedl" in
15357     $define|true|[yY]*)
15358             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'` 
15359             shift
15360             perllibs="$*"
15361             ;;
15362     *)  perllibs="$libs"
15363             ;;
15364     esac
15365     ;;
15366 esac
15367
15368 : Remove build directory name from cppstdin so it can be used from
15369 : either the present location or the final installed location.
15370 echo " "
15371 : Get out of the UU directory to get correct path name.
15372 cd ..
15373 case "$cppstdin" in
15374 `pwd`/cppstdin)
15375         echo "Stripping down cppstdin path name"
15376         cppstdin=cppstdin
15377         ;;
15378 esac
15379 cd UU
15380
15381 : end of configuration questions
15382 echo " "
15383 echo "End of configuration questions."
15384 echo " "
15385
15386 : back to where it started
15387 if test -d ../UU; then
15388         cd ..
15389 fi
15390
15391 : configuration may be patched via a 'config.over' file
15392 if $test -f config.over; then
15393         echo " "
15394         dflt=y
15395         rp='I see a config.over file.  Do you wish to load it?'
15396         . UU/myread
15397         case "$ans" in
15398         n*) echo "OK, I'll ignore it.";;
15399         *)      . ./config.over
15400                 echo "Configuration override changes have been loaded."
15401                 ;;
15402         esac
15403 fi
15404
15405 : in case they want portability, strip down executable paths
15406 case "$d_portable" in
15407 "$define")
15408         echo " "
15409         echo "Stripping down executable paths..." >&4
15410         for file in $loclist $trylist; do
15411                 eval temp=\$$file
15412                 eval $file=`basename $temp`
15413         done
15414         ;;
15415 esac
15416
15417 : create config.sh file
15418 echo " "
15419 echo "Creating config.sh..." >&4
15420 $spitshell <<EOT >config.sh
15421 $startsh
15422 #
15423 # This file was produced by running the Configure script. It holds all the
15424 # definitions figured out by Configure. Should you modify one of these values,
15425 # do not forget to propagate your changes by running "Configure -der". You may
15426 # instead choose to run each of the .SH files by yourself, or "Configure -S".
15427 #
15428
15429 # Package name      : $package
15430 # Source directory  : $src
15431 # Configuration time: $cf_time
15432 # Configured by     : $cf_by
15433 # Target system     : $myuname
15434
15435 Author='$Author'
15436 Date='$Date'
15437 Header='$Header'
15438 Id='$Id'
15439 Locker='$Locker'
15440 Log='$Log'
15441 Mcc='$Mcc'
15442 RCSfile='$RCSfile'
15443 Revision='$Revision'
15444 Source='$Source'
15445 State='$State'
15446 _a='$_a'
15447 _exe='$_exe'
15448 _o='$_o'
15449 afs='$afs'
15450 alignbytes='$alignbytes'
15451 ansi2knr='$ansi2knr'
15452 aphostname='$aphostname'
15453 api_revision='$api_revision'
15454 api_subversion='$api_subversion'
15455 api_version='$api_version'
15456 api_versionstring='$api_versionstring'
15457 ar='$ar'
15458 archlib='$archlib'
15459 archlibexp='$archlibexp'
15460 archname64='$archname64'
15461 archname='$archname'
15462 archobjs='$archobjs'
15463 awk='$awk'
15464 baserev='$baserev'
15465 bash='$bash'
15466 bin='$bin'
15467 bincompat5005='$bincompat5005'
15468 binexp='$binexp'
15469 bison='$bison'
15470 byacc='$byacc'
15471 byteorder='$byteorder'
15472 c='$c'
15473 castflags='$castflags'
15474 cat='$cat'
15475 cc='$cc'
15476 cccdlflags='$cccdlflags'
15477 ccdlflags='$ccdlflags'
15478 ccflags='$ccflags'
15479 ccflags_uselargefiles='$ccflags_uselargefiles'
15480 ccname='$ccname'
15481 ccsymbols='$ccsymbols'
15482 ccversion='$ccversion'
15483 cf_by='$cf_by'
15484 cf_email='$cf_email'
15485 cf_time='$cf_time'
15486 charsize='$charsize'
15487 chgrp='$chgrp'
15488 chmod='$chmod'
15489 chown='$chown'
15490 clocktype='$clocktype'
15491 comm='$comm'
15492 compress='$compress'
15493 contains='$contains'
15494 cp='$cp'
15495 cpio='$cpio'
15496 cpp='$cpp'
15497 cpp_stuff='$cpp_stuff'
15498 cppccsymbols='$cppccsymbols'
15499 cppflags='$cppflags'
15500 cpplast='$cpplast'
15501 cppminus='$cppminus'
15502 cpprun='$cpprun'
15503 cppstdin='$cppstdin'
15504 cppsymbols='$cppsymbols'
15505 crosscompile='$crosscompile'
15506 cryptlib='$cryptlib'
15507 csh='$csh'
15508 d_Gconvert='$d_Gconvert'
15509 d_PRIEUldbl='$d_PRIEUldbl'
15510 d_PRIFUldbl='$d_PRIFUldbl'
15511 d_PRIGUldbl='$d_PRIGUldbl'
15512 d_PRIXU64='$d_PRIXU64'
15513 d_PRId64='$d_PRId64'
15514 d_PRIeldbl='$d_PRIeldbl'
15515 d_PRIfldbl='$d_PRIfldbl'
15516 d_PRIgldbl='$d_PRIgldbl'
15517 d_PRIi64='$d_PRIi64'
15518 d_PRIo64='$d_PRIo64'
15519 d_PRIu64='$d_PRIu64'
15520 d_PRIx64='$d_PRIx64'
15521 d_SCNfldbl='$d_SCNfldbl'
15522 d_access='$d_access'
15523 d_accessx='$d_accessx'
15524 d_alarm='$d_alarm'
15525 d_archlib='$d_archlib'
15526 d_atolf='$d_atolf'
15527 d_atoll='$d_atoll'
15528 d_attribut='$d_attribut'
15529 d_bcmp='$d_bcmp'
15530 d_bcopy='$d_bcopy'
15531 d_bincompat5005='$d_bincompat5005'
15532 d_bsd='$d_bsd'
15533 d_bsdgetpgrp='$d_bsdgetpgrp'
15534 d_bsdsetpgrp='$d_bsdsetpgrp'
15535 d_bzero='$d_bzero'
15536 d_casti32='$d_casti32'
15537 d_castneg='$d_castneg'
15538 d_charvspr='$d_charvspr'
15539 d_chown='$d_chown'
15540 d_chroot='$d_chroot'
15541 d_chsize='$d_chsize'
15542 d_closedir='$d_closedir'
15543 d_const='$d_const'
15544 d_crypt='$d_crypt'
15545 d_csh='$d_csh'
15546 d_cuserid='$d_cuserid'
15547 d_dbl_dig='$d_dbl_dig'
15548 d_difftime='$d_difftime'
15549 d_dirnamlen='$d_dirnamlen'
15550 d_dlerror='$d_dlerror'
15551 d_dlopen='$d_dlopen'
15552 d_dlsymun='$d_dlsymun'
15553 d_dosuid='$d_dosuid'
15554 d_drand48proto='$d_drand48proto'
15555 d_dup2='$d_dup2'
15556 d_eaccess='$d_eaccess'
15557 d_endgrent='$d_endgrent'
15558 d_endhent='$d_endhent'
15559 d_endnent='$d_endnent'
15560 d_endpent='$d_endpent'
15561 d_endpwent='$d_endpwent'
15562 d_endsent='$d_endsent'
15563 d_eofnblk='$d_eofnblk'
15564 d_eunice='$d_eunice'
15565 d_fchmod='$d_fchmod'
15566 d_fchown='$d_fchown'
15567 d_fcntl='$d_fcntl'
15568 d_fcntl_can_lock='$d_fcntl_can_lock'
15569 d_fd_macros='$d_fd_macros'
15570 d_fd_set='$d_fd_set'
15571 d_fds_bits='$d_fds_bits'
15572 d_fgetpos='$d_fgetpos'
15573 d_flexfnam='$d_flexfnam'
15574 d_flock='$d_flock'
15575 d_fork='$d_fork'
15576 d_fpathconf='$d_fpathconf'
15577 d_fpos64_t='$d_fpos64_t'
15578 d_frexpl='$d_frexpl'
15579 d_fs_data_s='$d_fs_data_s'
15580 d_fseeko='$d_fseeko'
15581 d_fsetpos='$d_fsetpos'
15582 d_fstatfs='$d_fstatfs'
15583 d_fstatvfs='$d_fstatvfs'
15584 d_fsync='$d_fsync'
15585 d_ftello='$d_ftello'
15586 d_ftime='$d_ftime'
15587 d_getcwd='$d_getcwd'
15588 d_getespwnam='$d_getespwnam'
15589 d_getfsstat='$d_getfsstat'
15590 d_getgrent='$d_getgrent'
15591 d_getgrps='$d_getgrps'
15592 d_gethbyaddr='$d_gethbyaddr'
15593 d_gethbyname='$d_gethbyname'
15594 d_gethent='$d_gethent'
15595 d_gethname='$d_gethname'
15596 d_gethostprotos='$d_gethostprotos'
15597 d_getlogin='$d_getlogin'
15598 d_getmnt='$d_getmnt'
15599 d_getmntent='$d_getmntent'
15600 d_getnbyaddr='$d_getnbyaddr'
15601 d_getnbyname='$d_getnbyname'
15602 d_getnent='$d_getnent'
15603 d_getnetprotos='$d_getnetprotos'
15604 d_getpagsz='$d_getpagsz'
15605 d_getpbyname='$d_getpbyname'
15606 d_getpbynumber='$d_getpbynumber'
15607 d_getpent='$d_getpent'
15608 d_getpgid='$d_getpgid'
15609 d_getpgrp2='$d_getpgrp2'
15610 d_getpgrp='$d_getpgrp'
15611 d_getppid='$d_getppid'
15612 d_getprior='$d_getprior'
15613 d_getprotoprotos='$d_getprotoprotos'
15614 d_getprpwnam='$d_getprpwnam'
15615 d_getpwent='$d_getpwent'
15616 d_getsbyname='$d_getsbyname'
15617 d_getsbyport='$d_getsbyport'
15618 d_getsent='$d_getsent'
15619 d_getservprotos='$d_getservprotos'
15620 d_getspnam='$d_getspnam'
15621 d_gettimeod='$d_gettimeod'
15622 d_gnulibc='$d_gnulibc'
15623 d_grpasswd='$d_grpasswd'
15624 d_hasmntopt='$d_hasmntopt'
15625 d_htonl='$d_htonl'
15626 d_iconv='$d_iconv'
15627 d_index='$d_index'
15628 d_inetaton='$d_inetaton'
15629 d_int64_t='$d_int64_t'
15630 d_isascii='$d_isascii'
15631 d_isnan='$d_isnan'
15632 d_isnanl='$d_isnanl'
15633 d_killpg='$d_killpg'
15634 d_lchown='$d_lchown'
15635 d_ldbl_dig='$d_ldbl_dig'
15636 d_link='$d_link'
15637 d_locconv='$d_locconv'
15638 d_lockf='$d_lockf'
15639 d_longdbl='$d_longdbl'
15640 d_longlong='$d_longlong'
15641 d_lseekproto='$d_lseekproto'
15642 d_lstat='$d_lstat'
15643 d_madvise='$d_madvise'
15644 d_mblen='$d_mblen'
15645 d_mbstowcs='$d_mbstowcs'
15646 d_mbtowc='$d_mbtowc'
15647 d_memchr='$d_memchr'
15648 d_memcmp='$d_memcmp'
15649 d_memcpy='$d_memcpy'
15650 d_memmove='$d_memmove'
15651 d_memset='$d_memset'
15652 d_mkdir='$d_mkdir'
15653 d_mkdtemp='$d_mkdtemp'
15654 d_mkfifo='$d_mkfifo'
15655 d_mkstemp='$d_mkstemp'
15656 d_mkstemps='$d_mkstemps'
15657 d_mktime='$d_mktime'
15658 d_mmap='$d_mmap'
15659 d_modfl='$d_modfl'
15660 d_mprotect='$d_mprotect'
15661 d_msg='$d_msg'
15662 d_msg_ctrunc='$d_msg_ctrunc'
15663 d_msg_dontroute='$d_msg_dontroute'
15664 d_msg_oob='$d_msg_oob'
15665 d_msg_peek='$d_msg_peek'
15666 d_msg_proxy='$d_msg_proxy'
15667 d_msgctl='$d_msgctl'
15668 d_msgget='$d_msgget'
15669 d_msgrcv='$d_msgrcv'
15670 d_msgsnd='$d_msgsnd'
15671 d_msync='$d_msync'
15672 d_munmap='$d_munmap'
15673 d_mymalloc='$d_mymalloc'
15674 d_nice='$d_nice'
15675 d_nv_preserves_uv='$d_nv_preserves_uv'
15676 d_nv_preserves_uv_bits='$d_nv_preserves_uv_bits'
15677 d_off64_t='$d_off64_t'
15678 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
15679 d_oldpthreads='$d_oldpthreads'
15680 d_oldsock='$d_oldsock'
15681 d_open3='$d_open3'
15682 d_pathconf='$d_pathconf'
15683 d_pause='$d_pause'
15684 d_perl_otherlibdirs='$d_perl_otherlibdirs'
15685 d_phostname='$d_phostname'
15686 d_pipe='$d_pipe'
15687 d_poll='$d_poll'
15688 d_portable='$d_portable'
15689 d_pthread_yield='$d_pthread_yield'
15690 d_pwage='$d_pwage'
15691 d_pwchange='$d_pwchange'
15692 d_pwclass='$d_pwclass'
15693 d_pwcomment='$d_pwcomment'
15694 d_pwexpire='$d_pwexpire'
15695 d_pwgecos='$d_pwgecos'
15696 d_pwpasswd='$d_pwpasswd'
15697 d_pwquota='$d_pwquota'
15698 d_qgcvt='$d_qgcvt'
15699 d_quad='$d_quad'
15700 d_readdir='$d_readdir'
15701 d_readlink='$d_readlink'
15702 d_rename='$d_rename'
15703 d_rewinddir='$d_rewinddir'
15704 d_rmdir='$d_rmdir'
15705 d_safebcpy='$d_safebcpy'
15706 d_safemcpy='$d_safemcpy'
15707 d_sanemcmp='$d_sanemcmp'
15708 d_sched_yield='$d_sched_yield'
15709 d_scm_rights='$d_scm_rights'
15710 d_seekdir='$d_seekdir'
15711 d_select='$d_select'
15712 d_sem='$d_sem'
15713 d_semctl='$d_semctl'
15714 d_semctl_semid_ds='$d_semctl_semid_ds'
15715 d_semctl_semun='$d_semctl_semun'
15716 d_semget='$d_semget'
15717 d_semop='$d_semop'
15718 d_setegid='$d_setegid'
15719 d_seteuid='$d_seteuid'
15720 d_setgrent='$d_setgrent'
15721 d_setgrps='$d_setgrps'
15722 d_sethent='$d_sethent'
15723 d_setlinebuf='$d_setlinebuf'
15724 d_setlocale='$d_setlocale'
15725 d_setnent='$d_setnent'
15726 d_setpent='$d_setpent'
15727 d_setpgid='$d_setpgid'
15728 d_setpgrp2='$d_setpgrp2'
15729 d_setpgrp='$d_setpgrp'
15730 d_setprior='$d_setprior'
15731 d_setproctitle='$d_setproctitle'
15732 d_setpwent='$d_setpwent'
15733 d_setregid='$d_setregid'
15734 d_setresgid='$d_setresgid'
15735 d_setresuid='$d_setresuid'
15736 d_setreuid='$d_setreuid'
15737 d_setrgid='$d_setrgid'
15738 d_setruid='$d_setruid'
15739 d_setsent='$d_setsent'
15740 d_setsid='$d_setsid'
15741 d_setvbuf='$d_setvbuf'
15742 d_sfio='$d_sfio'
15743 d_shm='$d_shm'
15744 d_shmat='$d_shmat'
15745 d_shmatprototype='$d_shmatprototype'
15746 d_shmctl='$d_shmctl'
15747 d_shmdt='$d_shmdt'
15748 d_shmget='$d_shmget'
15749 d_sigaction='$d_sigaction'
15750 d_sigsetjmp='$d_sigsetjmp'
15751 d_socket='$d_socket'
15752 d_socklen_t='$d_socklen_t'
15753 d_sockpair='$d_sockpair'
15754 d_socks5_init='$d_socks5_init'
15755 d_sqrtl='$d_sqrtl'
15756 d_statblks='$d_statblks'
15757 d_statfs_f_flags='$d_statfs_f_flags'
15758 d_statfs_s='$d_statfs_s'
15759 d_statvfs='$d_statvfs'
15760 d_stdio_cnt_lval='$d_stdio_cnt_lval'
15761 d_stdio_ptr_lval='$d_stdio_ptr_lval'
15762 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
15763 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
15764 d_stdio_stream_array='$d_stdio_stream_array'
15765 d_stdiobase='$d_stdiobase'
15766 d_stdstdio='$d_stdstdio'
15767 d_strchr='$d_strchr'
15768 d_strcoll='$d_strcoll'
15769 d_strctcpy='$d_strctcpy'
15770 d_strerrm='$d_strerrm'
15771 d_strerror='$d_strerror'
15772 d_strtod='$d_strtod'
15773 d_strtol='$d_strtol'
15774 d_strtold='$d_strtold'
15775 d_strtoll='$d_strtoll'
15776 d_strtoul='$d_strtoul'
15777 d_strtoull='$d_strtoull'
15778 d_strtouq='$d_strtouq'
15779 d_strxfrm='$d_strxfrm'
15780 d_suidsafe='$d_suidsafe'
15781 d_symlink='$d_symlink'
15782 d_syscall='$d_syscall'
15783 d_sysconf='$d_sysconf'
15784 d_sysernlst='$d_sysernlst'
15785 d_syserrlst='$d_syserrlst'
15786 d_system='$d_system'
15787 d_tcgetpgrp='$d_tcgetpgrp'
15788 d_tcsetpgrp='$d_tcsetpgrp'
15789 d_telldir='$d_telldir'
15790 d_telldirproto='$d_telldirproto'
15791 d_time='$d_time'
15792 d_times='$d_times'
15793 d_truncate='$d_truncate'
15794 d_tzname='$d_tzname'
15795 d_umask='$d_umask'
15796 d_uname='$d_uname'
15797 d_union_semun='$d_union_semun'
15798 d_ustat='$d_ustat'
15799 d_vendorarch='$d_vendorarch'
15800 d_vendorbin='$d_vendorbin'
15801 d_vendorlib='$d_vendorlib'
15802 d_vfork='$d_vfork'
15803 d_void_closedir='$d_void_closedir'
15804 d_voidsig='$d_voidsig'
15805 d_voidtty='$d_voidtty'
15806 d_volatile='$d_volatile'
15807 d_vprintf='$d_vprintf'
15808 d_wait4='$d_wait4'
15809 d_waitpid='$d_waitpid'
15810 d_wcstombs='$d_wcstombs'
15811 d_wctomb='$d_wctomb'
15812 d_xenix='$d_xenix'
15813 date='$date'
15814 db_hashtype='$db_hashtype'
15815 db_prefixtype='$db_prefixtype'
15816 defvoidused='$defvoidused'
15817 direntrytype='$direntrytype'
15818 dlext='$dlext'
15819 dlsrc='$dlsrc'
15820 doublesize='$doublesize'
15821 drand01='$drand01'
15822 dynamic_ext='$dynamic_ext'
15823 eagain='$eagain'
15824 ebcdic='$ebcdic'
15825 echo='$echo'
15826 egrep='$egrep'
15827 emacs='$emacs'
15828 eunicefix='$eunicefix'
15829 exe_ext='$exe_ext'
15830 expr='$expr'
15831 extensions='$extensions'
15832 fflushNULL='$fflushNULL'
15833 fflushall='$fflushall'
15834 find='$find'
15835 firstmakefile='$firstmakefile'
15836 flex='$flex'
15837 fpossize='$fpossize'
15838 fpostype='$fpostype'
15839 freetype='$freetype'
15840 full_ar='$full_ar'
15841 full_csh='$full_csh'
15842 full_sed='$full_sed'
15843 gccosandvers='$gccosandvers'
15844 gccversion='$gccversion'
15845 gidformat='$gidformat'
15846 gidsign='$gidsign'
15847 gidsize='$gidsize'
15848 gidtype='$gidtype'
15849 glibpth='$glibpth'
15850 grep='$grep'
15851 groupcat='$groupcat'
15852 groupstype='$groupstype'
15853 gzip='$gzip'
15854 h_fcntl='$h_fcntl'
15855 h_sysfile='$h_sysfile'
15856 hint='$hint'
15857 hostcat='$hostcat'
15858 i16size='$i16size'
15859 i16type='$i16type'
15860 i32size='$i32size'
15861 i32type='$i32type'
15862 i64size='$i64size'
15863 i64type='$i64type'
15864 i8size='$i8size'
15865 i8type='$i8type'
15866 i_arpainet='$i_arpainet'
15867 i_bsdioctl='$i_bsdioctl'
15868 i_db='$i_db'
15869 i_dbm='$i_dbm'
15870 i_dirent='$i_dirent'
15871 i_dld='$i_dld'
15872 i_dlfcn='$i_dlfcn'
15873 i_fcntl='$i_fcntl'
15874 i_float='$i_float'
15875 i_gdbm='$i_gdbm'
15876 i_grp='$i_grp'
15877 i_iconv='$i_iconv'
15878 i_ieeefp='$i_ieeefp'
15879 i_inttypes='$i_inttypes'
15880 i_libutil='$i_libutil'
15881 i_limits='$i_limits'
15882 i_locale='$i_locale'
15883 i_machcthr='$i_machcthr'
15884 i_malloc='$i_malloc'
15885 i_math='$i_math'
15886 i_memory='$i_memory'
15887 i_mntent='$i_mntent'
15888 i_ndbm='$i_ndbm'
15889 i_netdb='$i_netdb'
15890 i_neterrno='$i_neterrno'
15891 i_netinettcp='$i_netinettcp'
15892 i_niin='$i_niin'
15893 i_poll='$i_poll'
15894 i_prot='$i_prot'
15895 i_pthread='$i_pthread'
15896 i_pwd='$i_pwd'
15897 i_rpcsvcdbm='$i_rpcsvcdbm'
15898 i_sfio='$i_sfio'
15899 i_sgtty='$i_sgtty'
15900 i_shadow='$i_shadow'
15901 i_socks='$i_socks'
15902 i_stdarg='$i_stdarg'
15903 i_stddef='$i_stddef'
15904 i_stdlib='$i_stdlib'
15905 i_string='$i_string'
15906 i_sunmath='$i_sunmath'
15907 i_sysaccess='$i_sysaccess'
15908 i_sysdir='$i_sysdir'
15909 i_sysfile='$i_sysfile'
15910 i_sysfilio='$i_sysfilio'
15911 i_sysin='$i_sysin'
15912 i_sysioctl='$i_sysioctl'
15913 i_syslog='$i_syslog'
15914 i_sysmman='$i_sysmman'
15915 i_sysmode='$i_sysmode'
15916 i_sysmount='$i_sysmount'
15917 i_sysndir='$i_sysndir'
15918 i_sysparam='$i_sysparam'
15919 i_sysresrc='$i_sysresrc'
15920 i_syssecrt='$i_syssecrt'
15921 i_sysselct='$i_sysselct'
15922 i_syssockio='$i_syssockio'
15923 i_sysstat='$i_sysstat'
15924 i_sysstatfs='$i_sysstatfs'
15925 i_sysstatvfs='$i_sysstatvfs'
15926 i_systime='$i_systime'
15927 i_systimek='$i_systimek'
15928 i_systimes='$i_systimes'
15929 i_systypes='$i_systypes'
15930 i_sysuio='$i_sysuio'
15931 i_sysun='$i_sysun'
15932 i_sysutsname='$i_sysutsname'
15933 i_sysvfs='$i_sysvfs'
15934 i_syswait='$i_syswait'
15935 i_termio='$i_termio'
15936 i_termios='$i_termios'
15937 i_time='$i_time'
15938 i_unistd='$i_unistd'
15939 i_ustat='$i_ustat'
15940 i_utime='$i_utime'
15941 i_values='$i_values'
15942 i_varargs='$i_varargs'
15943 i_varhdr='$i_varhdr'
15944 i_vfork='$i_vfork'
15945 ignore_versioned_solibs='$ignore_versioned_solibs'
15946 inc_version_list='$inc_version_list'
15947 inc_version_list_init='$inc_version_list_init'
15948 incpath='$incpath'
15949 inews='$inews'
15950 installarchlib='$installarchlib'
15951 installbin='$installbin'
15952 installman1dir='$installman1dir'
15953 installman3dir='$installman3dir'
15954 installprefix='$installprefix'
15955 installprefixexp='$installprefixexp'
15956 installprivlib='$installprivlib'
15957 installscript='$installscript'
15958 installsitearch='$installsitearch'
15959 installsitebin='$installsitebin'
15960 installsitelib='$installsitelib'
15961 installstyle='$installstyle'
15962 installusrbinperl='$installusrbinperl'
15963 installvendorarch='$installvendorarch'
15964 installvendorbin='$installvendorbin'
15965 installvendorlib='$installvendorlib'
15966 intsize='$intsize'
15967 ivdformat='$ivdformat'
15968 ivsize='$ivsize'
15969 ivtype='$ivtype'
15970 known_extensions='$known_extensions'
15971 ksh='$ksh'
15972 ld='$ld'
15973 lddlflags='$lddlflags'
15974 ldflags='$ldflags'
15975 ldflags_uselargefiles='$ldflags_uselargefiles'
15976 ldlibpthname='$ldlibpthname'
15977 less='$less'
15978 lib_ext='$lib_ext'
15979 libc='$libc'
15980 libperl='$libperl'
15981 libpth='$libpth'
15982 libs='$libs'
15983 libsdirs='$libsdirs'
15984 libsfiles='$libsfiles'
15985 libsfound='$libsfound'
15986 libspath='$libspath'
15987 libswanted='$libswanted'
15988 libswanted_uselargefiles='$libswanted_uselargefiles'
15989 line='$line'
15990 lint='$lint'
15991 lkflags='$lkflags'
15992 ln='$ln'
15993 lns='$lns'
15994 locincpth='$locincpth'
15995 loclibpth='$loclibpth'
15996 longdblsize='$longdblsize'
15997 longlongsize='$longlongsize'
15998 longsize='$longsize'
15999 lp='$lp'
16000 lpr='$lpr'
16001 ls='$ls'
16002 lseeksize='$lseeksize'
16003 lseektype='$lseektype'
16004 mail='$mail'
16005 mailx='$mailx'
16006 make='$make'
16007 make_set_make='$make_set_make'
16008 mallocobj='$mallocobj'
16009 mallocsrc='$mallocsrc'
16010 malloctype='$malloctype'
16011 man1dir='$man1dir'
16012 man1direxp='$man1direxp'
16013 man1ext='$man1ext'
16014 man3dir='$man3dir'
16015 man3direxp='$man3direxp'
16016 man3ext='$man3ext'
16017 mips_type='$mips_type'
16018 mkdir='$mkdir'
16019 mmaptype='$mmaptype'
16020 modetype='$modetype'
16021 more='$more'
16022 multiarch='$multiarch'
16023 mv='$mv'
16024 myarchname='$myarchname'
16025 mydomain='$mydomain'
16026 myhostname='$myhostname'
16027 myuname='$myuname'
16028 n='$n'
16029 netdb_hlen_type='$netdb_hlen_type'
16030 netdb_host_type='$netdb_host_type'
16031 netdb_name_type='$netdb_name_type'
16032 netdb_net_type='$netdb_net_type'
16033 nm='$nm'
16034 nm_opt='$nm_opt'
16035 nm_so_opt='$nm_so_opt'
16036 nonxs_ext='$nonxs_ext'
16037 nroff='$nroff'
16038 nvEUformat='$nvEUformat'
16039 nvFUformat='$nvFUformat'
16040 nvGUformat='$nvGUformat'
16041 nveformat='$nveformat'
16042 nvfformat='$nvfformat'
16043 nvgformat='$nvgformat'
16044 nvsize='$nvsize'
16045 nvtype='$nvtype'
16046 o_nonblock='$o_nonblock'
16047 obj_ext='$obj_ext'
16048 old_pthread_create_joinable='$old_pthread_create_joinable'
16049 optimize='$optimize'
16050 orderlib='$orderlib'
16051 osname='$osname'
16052 osvers='$osvers'
16053 otherlibdirs='$otherlibdirs'
16054 package='$package'
16055 pager='$pager'
16056 passcat='$passcat'
16057 patchlevel='$patchlevel'
16058 path_sep='$path_sep'
16059 perl5='$perl5'
16060 perl='$perl'
16061 perladmin='$perladmin'
16062 perllibs='$perllibs'
16063 perlpath='$perlpath'
16064 pg='$pg'
16065 phostname='$phostname'
16066 pidtype='$pidtype'
16067 plibpth='$plibpth'
16068 pm_apiversion='$pm_apiversion'
16069 pmake='$pmake'
16070 pr='$pr'
16071 prefix='$prefix'
16072 prefixexp='$prefixexp'
16073 privlib='$privlib'
16074 privlibexp='$privlibexp'
16075 prototype='$prototype'
16076 ptrsize='$ptrsize'
16077 quadkind='$quadkind'
16078 quadtype='$quadtype'
16079 randbits='$randbits'
16080 randfunc='$randfunc'
16081 randseedtype='$randseedtype'
16082 ranlib='$ranlib'
16083 rd_nodata='$rd_nodata'
16084 revision='$revision'
16085 rm='$rm'
16086 rmail='$rmail'
16087 runnm='$runnm'
16088 sPRIEUldbl='$sPRIEUldbl'
16089 sPRIFUldbl='$sPRIFUldbl'
16090 sPRIGUldbl='$sPRIGUldbl'
16091 sPRIXU64='$sPRIXU64'
16092 sPRId64='$sPRId64'
16093 sPRIeldbl='$sPRIeldbl'
16094 sPRIfldbl='$sPRIfldbl'
16095 sPRIgldbl='$sPRIgldbl'
16096 sPRIi64='$sPRIi64'
16097 sPRIo64='$sPRIo64'
16098 sPRIu64='$sPRIu64'
16099 sPRIx64='$sPRIx64'
16100 sSCNfldbl='$sSCNfldbl'
16101 sched_yield='$sched_yield'
16102 scriptdir='$scriptdir'
16103 scriptdirexp='$scriptdirexp'
16104 sed='$sed'
16105 seedfunc='$seedfunc'
16106 selectminbits='$selectminbits'
16107 selecttype='$selecttype'
16108 sendmail='$sendmail'
16109 sh='$sh'
16110 shar='$shar'
16111 sharpbang='$sharpbang'
16112 shmattype='$shmattype'
16113 shortsize='$shortsize'
16114 shrpenv='$shrpenv'
16115 shsharp='$shsharp'
16116 sig_count='$sig_count'
16117 sig_name='$sig_name'
16118 sig_name_init='$sig_name_init'
16119 sig_num='$sig_num'
16120 sig_num_init='$sig_num_init'
16121 signal_t='$signal_t'
16122 sitearch='$sitearch'
16123 sitearchexp='$sitearchexp'
16124 sitebin='$sitebin'
16125 sitebinexp='$sitebinexp'
16126 sitelib='$sitelib'
16127 sitelib_stem='$sitelib_stem'
16128 sitelibexp='$sitelibexp'
16129 siteprefix='$siteprefix'
16130 siteprefixexp='$siteprefixexp'
16131 sizesize='$sizesize'
16132 sizetype='$sizetype'
16133 sleep='$sleep'
16134 smail='$smail'
16135 so='$so'
16136 sockethdr='$sockethdr'
16137 socketlib='$socketlib'
16138 socksizetype='$socksizetype'
16139 sort='$sort'
16140 spackage='$spackage'
16141 spitshell='$spitshell'
16142 src='$src'
16143 ssizetype='$ssizetype'
16144 startperl='$startperl'
16145 startsh='$startsh'
16146 static_ext='$static_ext'
16147 stdchar='$stdchar'
16148 stdio_base='$stdio_base'
16149 stdio_bufsiz='$stdio_bufsiz'
16150 stdio_cnt='$stdio_cnt'
16151 stdio_filbuf='$stdio_filbuf'
16152 stdio_ptr='$stdio_ptr'
16153 stdio_stream_array='$stdio_stream_array'
16154 strings='$strings'
16155 submit='$submit'
16156 subversion='$subversion'
16157 sysman='$sysman'
16158 tail='$tail'
16159 tar='$tar'
16160 tbl='$tbl'
16161 tee='$tee'
16162 test='$test'
16163 timeincl='$timeincl'
16164 timetype='$timetype'
16165 touch='$touch'
16166 tr='$tr'
16167 trnl='$trnl'
16168 troff='$troff'
16169 u16size='$u16size'
16170 u16type='$u16type'
16171 u32size='$u32size'
16172 u32type='$u32type'
16173 u64size='$u64size'
16174 u64type='$u64type'
16175 u8size='$u8size'
16176 u8type='$u8type'
16177 uidformat='$uidformat'
16178 uidsign='$uidsign'
16179 uidsize='$uidsize'
16180 uidtype='$uidtype'
16181 uname='$uname'
16182 uniq='$uniq'
16183 uquadtype='$uquadtype'
16184 use5005threads='$use5005threads'
16185 use64bitall='$use64bitall'
16186 use64bitint='$use64bitint'
16187 usedl='$usedl'
16188 useithreads='$useithreads'
16189 uselargefiles='$uselargefiles'
16190 uselongdouble='$uselongdouble'
16191 usemorebits='$usemorebits'
16192 usemultiplicity='$usemultiplicity'
16193 usemymalloc='$usemymalloc'
16194 usenm='$usenm'
16195 useopcode='$useopcode'
16196 useperlio='$useperlio'
16197 useposix='$useposix'
16198 usesfio='$usesfio'
16199 useshrplib='$useshrplib'
16200 usesocks='$usesocks'
16201 usethreads='$usethreads'
16202 usevendorprefix='$usevendorprefix'
16203 usevfork='$usevfork'
16204 usrinc='$usrinc'
16205 uuname='$uuname'
16206 uvXUformat='$uvXUformat'
16207 uvoformat='$uvoformat'
16208 uvsize='$uvsize'
16209 uvtype='$uvtype'
16210 uvuformat='$uvuformat'
16211 uvxformat='$uvxformat'
16212 vendorarch='$vendorarch'
16213 vendorarchexp='$vendorarchexp'
16214 vendorbin='$vendorbin'
16215 vendorbinexp='$vendorbinexp'
16216 vendorlib='$vendorlib'
16217 vendorlib_stem='$vendorlib_stem'
16218 vendorlibexp='$vendorlibexp'
16219 vendorprefix='$vendorprefix'
16220 vendorprefixexp='$vendorprefixexp'
16221 version='$version'
16222 versiononly='$versiononly'
16223 vi='$vi'
16224 voidflags='$voidflags'
16225 xlibpth='$xlibpth'
16226 xs_apiversion='$xs_apiversion'
16227 zcat='$zcat'
16228 zip='$zip'
16229 EOT
16230
16231 : Add in command line options if available
16232 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
16233
16234 : add special variables
16235 $test -f $src/patchlevel.h && \
16236 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
16237 echo "CONFIGDOTSH=true" >>config.sh
16238
16239 : propagate old symbols
16240 if $test -f UU/config.sh; then
16241         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
16242         sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
16243         $sort | $uniq -u >UU/oldsyms
16244         set X `cat UU/oldsyms`
16245         shift
16246         case $# in
16247         0) ;;
16248         *)
16249                 cat <<EOM
16250 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
16251 EOM
16252                 echo "# Variables propagated from previous config.sh file." >>config.sh
16253                 for sym in `cat UU/oldsyms`; do
16254                         echo "    Propagating $hint variable "'$'"$sym..."
16255                         eval 'tmp="$'"${sym}"'"'
16256                         echo "$tmp" | \
16257                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
16258                 done
16259                 ;;
16260         esac
16261 fi
16262
16263 : Finish up by extracting the .SH files
16264 case "$alldone" in
16265 exit)
16266         $rm -rf UU
16267         echo "Done."
16268         exit 0
16269         ;;
16270 cont)
16271         ;;
16272 '')
16273         dflt=''
16274         nostick=true
16275         $cat <<EOM
16276
16277 If you'd like to make any changes to the config.sh file before I begin
16278 to configure things, do it as a shell escape now (e.g. !vi config.sh).
16279
16280 EOM
16281         rp="Press return or use a shell escape to edit config.sh:"
16282         . UU/myread
16283         nostick=''
16284         case "$ans" in
16285         '') ;;
16286         *) : in case they cannot read
16287                 sh 1>&4 -c "$ans";;
16288         esac
16289         ;;
16290 esac
16291
16292 : if this fails, just run all the .SH files by hand
16293 . ./config.sh
16294
16295 echo " "
16296 exec 1>&4
16297 . ./UU/extract
16298
16299 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
16300         dflt=y
16301         case "$silent" in
16302         true) ;;
16303         *)
16304                 $cat <<EOM
16305
16306 Now you need to generate make dependencies by running "$make depend".
16307 You might prefer to run it in background: "$make depend > makedepend.out &"
16308 It can take a while, so you might not want to run it right now.
16309
16310 EOM
16311                 ;;
16312         esac
16313         rp="Run $make depend now?"
16314         . UU/myread
16315         case "$ans" in
16316         y*)
16317                 $make depend && echo "Now you must run '$make'."
16318                 ;;
16319         *)
16320                 echo "You must run '$make depend' then '$make'."
16321                 ;;
16322         esac
16323 elif test -f [Mm]akefile; then
16324         echo " "
16325         echo "Now you must run a $make."
16326 else
16327         echo "Done."
16328 fi
16329
16330 if $test -f Policy.sh; then
16331     $cat <<EOM
16332
16333 If you compile $package on a different machine or from a different object
16334 directory, copy the Policy.sh file from this object directory to the
16335 new one before you run Configure -- this will help you with most of
16336 the policy defaults.
16337
16338 EOM
16339 fi
16340 if $test -f config.msg; then
16341     echo "Hmm.  I also noted the following information while running:"
16342     echo " "
16343     $cat config.msg >&4
16344     $rm -f config.msg
16345 fi
16346 $rm -f kit*isdone ark*isdone
16347 $rm -rf UU
16348
16349 : End of Configure
16350