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 Wed Aug 30 16:44:38 EET DST 2000 [metaconfig 3.0 PL70]
24 # (with additional metaconfig patches by perlbug@perl.org)
25
26 cat >/tmp/c1$$ <<EOF
27 ARGGGHHHH!!!!!
28
29 SCO csh still thinks true is false.  Write to SCO today and tell them that next
30 year Configure ought to "rm /bin/csh" unless they fix their blasted shell. :-)
31
32 (Actually, Configure ought to just patch csh in place.  Hmm.  Hmmmmm.  All
33 we'd have to do is go in and swap the && and || tokens, wherever they are.)
34
35 [End of diatribe. We now return you to your regularly scheduled programming...]
36 EOF
37 cat >/tmp/c2$$ <<EOF
38
39 OOPS!  You naughty creature!  You didn't run Configure with sh!
40 I will attempt to remedy the situation by running sh for you...
41 EOF
42
43 true || cat /tmp/c1$$ /tmp/c2$$
44 true || exec sh $0 $argv:q
45
46 (exit $?0) || cat /tmp/c2$$
47 (exit $?0) || exec sh $0 $argv:q
48 rm -f /tmp/c1$$ /tmp/c2$$
49
50 : compute my invocation name
51 me=$0
52 case "$0" in
53 */*)
54         me=`echo $0 | sed -e 's!.*/\(.*\)!\1!' 2>/dev/null`
55         test "$me" || me=$0
56         ;;
57 esac
58
59 : Proper separator for the PATH environment variable
60 p_=:
61 : On OS/2 this directory should exist if this is not floppy only system :-]
62 if test -d c:/. ; then
63     if test -n "$OS2_SHELL"; then
64                 p_=\;
65                 PATH=`cmd /c "echo %PATH%" | tr '\\\\' / `
66                 OS2_SHELL=`cmd /c "echo %OS2_SHELL%" | tr '\\\\' / | tr '[A-Z]' '[a-z]'`
67         elif test -n "$DJGPP"; then
68                 p_=\;
69         fi
70 fi
71
72 : Proper PATH setting
73 paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin'
74 paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin"
75 paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin"
76 paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin"
77 paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb"
78 paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /usr/ccs/bin"
79 paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib"
80 paths="$paths /sbin /usr/sbin /usr/libexec"
81
82 for p in $paths
83 do
84         case "$p_$PATH$p_" in
85         *$p_$p$p_*) ;;
86         *) test -d $p && PATH=$PATH$p_$p ;;
87         esac
88 done
89
90 PATH=.$p_$PATH
91 export PATH
92
93 : shall we be using ksh?
94 inksh=''
95 needksh=''
96 avoidksh=''
97 newsh=/bin/ksh
98 changesh=''
99 if (PATH=.; alias -x) >/dev/null 2>&1; then
100                 inksh=true
101 fi
102 if test -f /hp-ux -a -f /bin/ksh; then
103         needksh='to avoid sh bug in "here document" expansion'
104 fi
105 if test -d /usr/lpp -a -f /usr/bin/bsh -a -f /usr/bin/uname; then
106         if test X`/usr/bin/uname -v` = X4; then
107                 avoidksh="to avoid AIX 4's /bin/sh"
108                 newsh=/usr/bin/bsh
109         fi
110 fi
111 if test -f /osf_boot -a -f /usr/sbin/setld; then
112         if test X`/usr/bin/uname -s` = XOSF1; then
113                 avoidksh="to avoid Digital UNIX' ksh"
114                 newsh=/bin/sh
115                 unset BIN_SH # if this is 'xpg4' sh will start up ksh
116         fi
117 fi
118 case "$inksh/$needksh" in
119 /[a-z]*)
120                 ENV=''
121                 changesh=true
122                 reason="$needksh"
123         ;;
124 esac
125 case "$inksh/$avoidksh" in
126 true/[a-z]*)
127         changesh=true
128         reason="$avoidksh"
129         ;;
130 esac
131 case "$inksh/$needksh-$avoidksh-" in
132 true/--)
133                 cat <<EOM
134 (I see you are using the Korn shell.  Some ksh's blow up on $me,
135 mainly on older exotic systems.  If yours does, try the Bourne shell instead.)
136 EOM
137         ;;
138 esac
139 case "$changesh" in
140 true)
141         echo "(Feeding myself to $newsh $reason.)"
142         case "$0" in
143         Configure|*/Configure) exec $newsh $0 "$@";;
144         *) exec $newsh Configure "$@";;
145         esac
146         ;;
147 esac
148
149 : if needed set CDPATH to a harmless value that is not chatty
150 : avoid bash 2.02 problems with empty CDPATH.
151 case "$CDPATH" in
152 '')     ;;
153 *)      case "$SHELL" in
154         *bash*) CDPATH='.' ;;
155         *)              CDPATH='' ;;
156         esac
157         ;;
158 esac
159 : Configure runs within the UU subdirectory
160 test -d UU || mkdir UU
161 cd UU && rm -f ./*
162
163 ccsymbols=''
164 cppccsymbols=''
165 cppsymbols=''
166 dynamic_ext=''
167 extensions=''
168 known_extensions=''
169 nonxs_ext=''
170 static_ext=''
171 useopcode=''
172 useposix=''
173 d_bsd=''
174 d_eunice=''
175 d_xenix=''
176 eunicefix=''
177 Mcc=''
178 ar=''
179 awk=''
180 bash=''
181 bison=''
182 byacc=''
183 cat=''
184 chgrp=''
185 chmod=''
186 chown=''
187 comm=''
188 compress=''
189 cp=''
190 cpio=''
191 cpp=''
192 csh=''
193 date=''
194 echo=''
195 egrep=''
196 emacs=''
197 expr=''
198 find=''
199 flex=''
200 grep=''
201 gzip=''
202 inews=''
203 ksh=''
204 less=''
205 line=''
206 lint=''
207 ln=''
208 lp=''
209 lpr=''
210 ls=''
211 mail=''
212 mailx=''
213 make=''
214 mkdir=''
215 more=''
216 mv=''
217 nm=''
218 nroff=''
219 perl=''
220 pg=''
221 pmake=''
222 pr=''
223 rm=''
224 rmail=''
225 sed=''
226 sendmail=''
227 shar=''
228 sleep=''
229 smail=''
230 sort=''
231 submit=''
232 tail=''
233 tar=''
234 tbl=''
235 tee=''
236 test=''
237 touch=''
238 tr=''
239 troff=''
240 uname=''
241 uniq=''
242 uuname=''
243 vi=''
244 zcat=''
245 zip=''
246 full_ar=''
247 full_sed=''
248 libswanted=''
249 hint=''
250 myuname=''
251 osname=''
252 osvers=''
253 Author=''
254 Date=''
255 Header=''
256 Id=''
257 Locker=''
258 Log=''
259 RCSfile=''
260 Revision=''
261 Source=''
262 State=''
263 _a=''
264 _exe=''
265 _o=''
266 archobjs=''
267 exe_ext=''
268 firstmakefile=''
269 lib_ext=''
270 obj_ext=''
271 path_sep=''
272 afs=''
273 alignbytes=''
274 ansi2knr=''
275 archlib=''
276 archlibexp=''
277 d_archlib=''
278 installarchlib=''
279 archname=''
280 myarchname=''
281 d_atolf=''
282 d_atoll=''
283 baserev=''
284 bin=''
285 binexp=''
286 installbin=''
287 bincompat5005=''
288 d_bincompat5005=''
289 byteorder=''
290 cc=''
291 ccflags=''
292 cppflags=''
293 ldflags=''
294 lkflags=''
295 locincpth=''
296 optimize=''
297 cf_email=''
298 cf_by=''
299 cf_time=''
300 charsize=''
301 contains=''
302 cpp_stuff=''
303 cpplast=''
304 cppminus=''
305 cpprun=''
306 cppstdin=''
307 crosscompile=''
308 d_access=''
309 d_accessx=''
310 d_alarm=''
311 d_attribut=''
312 d_bcmp=''
313 d_bcopy=''
314 d_bzero=''
315 d_casti32=''
316 castflags=''
317 d_castneg=''
318 d_chown=''
319 d_chroot=''
320 d_chsize=''
321 d_closedir=''
322 d_void_closedir=''
323 d_const=''
324 cryptlib=''
325 d_crypt=''
326 d_csh=''
327 full_csh=''
328 d_cuserid=''
329 d_dbl_dig=''
330 d_difftime=''
331 d_dlerror=''
332 d_dlopen=''
333 d_dlsymun=''
334 d_dosuid=''
335 d_suidsafe=''
336 d_drand48proto=''
337 d_dup2=''
338 d_eaccess=''
339 d_endgrent=''
340 d_endhent=''
341 d_endnent=''
342 d_endpent=''
343 d_endpwent=''
344 d_endsent=''
345 d_fchmod=''
346 d_fchown=''
347 d_fcntl=''
348 d_fd_macros=''
349 d_fd_set=''
350 d_fds_bits=''
351 d_fgetpos=''
352 d_flexfnam=''
353 d_flock=''
354 d_fork=''
355 d_fpos64_t=''
356 d_frexpl=''
357 d_fs_data_s=''
358 d_fseeko=''
359 d_fsetpos=''
360 d_fstatfs=''
361 d_ftello=''
362 d_ftime=''
363 d_gettimeod=''
364 d_Gconvert=''
365 d_getcwd=''
366 d_getespwnam=''
367 d_getfsstat=''
368 d_getgrent=''
369 d_getgrps=''
370 d_gethbyaddr=''
371 d_gethbyname=''
372 d_gethent=''
373 aphostname=''
374 d_gethname=''
375 d_phostname=''
376 d_uname=''
377 d_gethostprotos=''
378 d_getlogin=''
379 d_getmnt=''
380 d_getmntent=''
381 d_getnbyaddr=''
382 d_getnbyname=''
383 d_getnent=''
384 d_getnetprotos=''
385 d_getpent=''
386 d_getpgid=''
387 d_getpgrp2=''
388 d_bsdgetpgrp=''
389 d_getpgrp=''
390 d_getppid=''
391 d_getprior=''
392 d_getpbyname=''
393 d_getpbynumber=''
394 d_getprotoprotos=''
395 d_getprpwnam=''
396 d_getpwent=''
397 d_getsent=''
398 d_getservprotos=''
399 d_getspnam=''
400 d_getsbyname=''
401 d_getsbyport=''
402 d_gnulibc=''
403 d_hasmntopt=''
404 d_htonl=''
405 d_iconv=''
406 d_inetaton=''
407 d_int64_t=''
408 d_isascii=''
409 d_isnan=''
410 d_isnanl=''
411 d_killpg=''
412 d_lchown=''
413 d_ldbl_dig=''
414 d_link=''
415 d_locconv=''
416 d_lockf=''
417 d_longdbl=''
418 longdblsize=''
419 d_longlong=''
420 longlongsize=''
421 d_lseekproto=''
422 d_lstat=''
423 d_madvise=''
424 d_mblen=''
425 d_mbstowcs=''
426 d_mbtowc=''
427 d_memchr=''
428 d_memcmp=''
429 d_memcpy=''
430 d_memmove=''
431 d_memset=''
432 d_mkdir=''
433 d_mkdtemp=''
434 d_mkfifo=''
435 d_mkstemp=''
436 d_mkstemps=''
437 d_mktime=''
438 d_mmap=''
439 mmaptype=''
440 d_modfl=''
441 d_mprotect=''
442 d_msg=''
443 d_msgctl=''
444 d_msgget=''
445 d_msgrcv=''
446 d_msgsnd=''
447 d_msync=''
448 d_munmap=''
449 d_nice=''
450 d_off64_t=''
451 d_open3=''
452 d_fpathconf=''
453 d_pathconf=''
454 d_pause=''
455 d_pipe=''
456 d_poll=''
457 d_portable=''
458 d_old_pthread_create_joinable=''
459 old_pthread_create_joinable=''
460 d_pthread_yield=''
461 d_sched_yield=''
462 sched_yield=''
463 d_qgcvt=''
464 d_readdir=''
465 d_rewinddir=''
466 d_seekdir=''
467 d_telldir=''
468 d_readlink=''
469 d_rename=''
470 d_rmdir=''
471 d_safebcpy=''
472 d_safemcpy=''
473 d_sanemcmp=''
474 d_select=''
475 d_sem=''
476 d_semctl=''
477 d_semget=''
478 d_semop=''
479 d_setegid=''
480 d_seteuid=''
481 d_setgrent=''
482 d_setgrps=''
483 d_sethent=''
484 d_setlinebuf=''
485 d_setlocale=''
486 d_setnent=''
487 d_setpent=''
488 d_setpgid=''
489 d_setpgrp2=''
490 d_bsdsetpgrp=''
491 d_setpgrp=''
492 d_setprior=''
493 d_setproctitle=''
494 d_setpwent=''
495 d_setregid=''
496 d_setresgid=''
497 d_setresuid=''
498 d_setreuid=''
499 d_setrgid=''
500 d_setruid=''
501 d_setsent=''
502 d_setsid=''
503 d_setvbuf=''
504 d_sfio=''
505 usesfio=''
506 d_shm=''
507 d_shmat=''
508 d_shmatprototype=''
509 shmattype=''
510 d_shmctl=''
511 d_shmdt=''
512 d_shmget=''
513 d_sigaction=''
514 d_sigsetjmp=''
515 d_msg_ctrunc=''
516 d_msg_dontroute=''
517 d_msg_oob=''
518 d_msg_peek=''
519 d_msg_proxy=''
520 d_oldsock=''
521 d_scm_rights=''
522 d_socket=''
523 d_sockpair=''
524 sockethdr=''
525 socketlib=''
526 d_socklen_t=''
527 d_socks5_init=''
528 d_sqrtl=''
529 d_statblks=''
530 d_statfs_f_flags=''
531 d_statfs_s=''
532 d_fstatvfs=''
533 d_statvfs=''
534 d_stdio_cnt_lval=''
535 d_stdio_ptr_lval=''
536 d_stdiobase=''
537 d_stdstdio=''
538 stdio_base=''
539 stdio_bufsiz=''
540 stdio_cnt=''
541 stdio_filbuf=''
542 stdio_ptr=''
543 d_index=''
544 d_strchr=''
545 d_strcoll=''
546 d_strctcpy=''
547 d_strerrm=''
548 d_strerror=''
549 d_sysernlst=''
550 d_syserrlst=''
551 d_strtod=''
552 d_strtol=''
553 d_strtold=''
554 d_strtoll=''
555 d_strtoul=''
556 d_strtoull=''
557 d_strtouq=''
558 d_strxfrm=''
559 d_symlink=''
560 d_syscall=''
561 d_sysconf=''
562 d_system=''
563 d_tcgetpgrp=''
564 d_tcsetpgrp=''
565 d_telldirproto=''
566 d_time=''
567 timetype=''
568 clocktype=''
569 d_times=''
570 d_truncate=''
571 d_tzname=''
572 d_umask=''
573 d_semctl_semid_ds=''
574 d_semctl_semun=''
575 d_union_semun=''
576 d_ustat=''
577 d_vfork=''
578 usevfork=''
579 d_voidsig=''
580 signal_t=''
581 d_volatile=''
582 d_charvspr=''
583 d_vprintf=''
584 d_wait4=''
585 d_waitpid=''
586 d_wcstombs=''
587 d_wctomb=''
588 dlext=''
589 cccdlflags=''
590 ccdlflags=''
591 dlsrc=''
592 ld=''
593 lddlflags=''
594 usedl=''
595 doublesize=''
596 ebcdic=''
597 fflushNULL=''
598 fflushall=''
599 fpossize=''
600 fpostype=''
601 ccname=''
602 gccosandvers=''
603 gccversion=''
604 gidformat=''
605 gidsign=''
606 gidsize=''
607 gidtype=''
608 groupstype=''
609 h_fcntl=''
610 h_sysfile=''
611 i_arpainet=''
612 db_hashtype=''
613 db_prefixtype=''
614 i_db=''
615 i_dbm=''
616 i_rpcsvcdbm=''
617 d_dirnamlen=''
618 direntrytype=''
619 i_dirent=''
620 i_dld=''
621 i_dlfcn=''
622 i_fcntl=''
623 i_float=''
624 i_gdbm=''
625 d_grpasswd=''
626 i_grp=''
627 i_iconv=''
628 i_ieeefp=''
629 i_inttypes=''
630 i_libutil=''
631 i_limits=''
632 i_locale=''
633 i_machcthr=''
634 i_malloc=''
635 i_math=''
636 i_memory=''
637 i_mntent=''
638 i_ndbm=''
639 i_netdb=''
640 i_neterrno=''
641 i_netinettcp=''
642 i_niin=''
643 i_sysin=''
644 i_poll=''
645 i_prot=''
646 i_pthread=''
647 d_pwage=''
648 d_pwchange=''
649 d_pwclass=''
650 d_pwcomment=''
651 d_pwexpire=''
652 d_pwgecos=''
653 d_pwpasswd=''
654 d_pwquota=''
655 i_pwd=''
656 i_sfio=''
657 i_shadow=''
658 i_socks=''
659 i_stddef=''
660 i_stdlib=''
661 i_string=''
662 strings=''
663 i_sunmath=''
664 i_sysaccess=''
665 i_sysdir=''
666 i_sysfile=''
667 d_voidtty=''
668 i_bsdioctl=''
669 i_sysfilio=''
670 i_sysioctl=''
671 i_syssockio=''
672 i_syslog=''
673 i_sysmman=''
674 i_sysmode=''
675 i_sysmount=''
676 i_sysndir=''
677 i_sysparam=''
678 i_sysresrc=''
679 i_syssecrt=''
680 i_sysselct=''
681 i_sysstat=''
682 i_sysstatfs=''
683 i_sysstatvfs=''
684 i_systimes=''
685 i_systypes=''
686 i_sysuio=''
687 i_sysun=''
688 i_sysutsname=''
689 i_sysvfs=''
690 i_syswait=''
691 i_sgtty=''
692 i_termio=''
693 i_termios=''
694 i_systime=''
695 i_systimek=''
696 i_time=''
697 timeincl=''
698 i_unistd=''
699 i_ustat=''
700 i_utime=''
701 i_values=''
702 i_stdarg=''
703 i_varargs=''
704 i_varhdr=''
705 i_vfork=''
706 inc_version_list=''
707 inc_version_list_init=''
708 installprefix=''
709 installprefixexp=''
710 installstyle=''
711 installusrbinperl=''
712 intsize=''
713 longsize=''
714 shortsize=''
715 libc=''
716 ldlibpthname=''
717 libperl=''
718 shrpenv=''
719 useshrplib=''
720 glibpth=''
721 libpth=''
722 loclibpth=''
723 plibpth=''
724 xlibpth=''
725 ignore_versioned_solibs=''
726 libs=''
727 libsdirs=''
728 libsfiles=''
729 libsfound=''
730 libspath=''
731 lns=''
732 d_PRIEldbl=''
733 d_PRIFldbl=''
734 d_PRIGldbl=''
735 d_PRIeldbl=''
736 d_PRIfldbl=''
737 d_PRIgldbl=''
738 sPRIEldbl=''
739 sPRIFldbl=''
740 sPRIGldbl=''
741 sPRIeldbl=''
742 sPRIfldbl=''
743 sPRIgldbl=''
744 lseeksize=''
745 lseektype=''
746 make_set_make=''
747 d_mymalloc=''
748 freetype=''
749 mallocobj=''
750 mallocsrc=''
751 malloctype=''
752 usemymalloc=''
753 installman1dir=''
754 man1dir=''
755 man1direxp=''
756 man1ext=''
757 installman3dir=''
758 man3dir=''
759 man3direxp=''
760 man3ext=''
761 huge=''
762 large=''
763 medium=''
764 models=''
765 small=''
766 split=''
767 modetype=''
768 multiarch=''
769 mydomain=''
770 myhostname=''
771 phostname=''
772 c=''
773 n=''
774 d_eofnblk=''
775 eagain=''
776 o_nonblock=''
777 rd_nodata=''
778 netdb_hlen_type=''
779 netdb_host_type=''
780 netdb_name_type=''
781 netdb_net_type=''
782 groupcat=''
783 hostcat=''
784 passcat=''
785 orderlib=''
786 ranlib=''
787 d_perl_otherlibdirs=''
788 otherlibdirs=''
789 package=''
790 spackage=''
791 pager=''
792 api_revision=''
793 api_subversion=''
794 api_version=''
795 api_versionstring=''
796 patchlevel=''
797 revision=''
798 subversion=''
799 version=''
800 perl5=''
801 perladmin=''
802 perlpath=''
803 d_nv_preserves_uv=''
804 d_nv_preserves_uv_bits=''
805 i16size=''
806 i16type=''
807 i32size=''
808 i32type=''
809 i64size=''
810 i64type=''
811 i8size=''
812 i8type=''
813 ivsize=''
814 ivtype=''
815 nvsize=''
816 nvtype=''
817 u16size=''
818 u16type=''
819 u32size=''
820 u32type=''
821 u64size=''
822 u64type=''
823 u8size=''
824 u8type=''
825 uvsize=''
826 uvtype=''
827 ivdformat=''
828 nvEformat=''
829 nvFformat=''
830 nvGformat=''
831 nveformat=''
832 nvfformat=''
833 nvgformat=''
834 uvXformat=''
835 uvoformat=''
836 uvuformat=''
837 uvxformat=''
838 pidtype=''
839 prefix=''
840 prefixexp=''
841 installprivlib=''
842 privlib=''
843 privlibexp=''
844 prototype=''
845 ptrsize=''
846 d_PRIX64=''
847 d_PRId64=''
848 d_PRIi64=''
849 d_PRIo64=''
850 d_PRIu64=''
851 d_PRIx64=''
852 sPRIX64=''
853 sPRId64=''
854 sPRIi64=''
855 sPRIo64=''
856 sPRIu64=''
857 sPRIx64=''
858 d_quad=''
859 quadkind=''
860 quadtype=''
861 uquadtype=''
862 drand01=''
863 randbits=''
864 randfunc=''
865 randseedtype=''
866 seedfunc=''
867 installscript=''
868 scriptdir=''
869 scriptdirexp=''
870 selectminbits=''
871 selecttype=''
872 sh=''
873 sig_count=''
874 sig_name=''
875 sig_name_init=''
876 sig_num=''
877 sig_num_init=''
878 installsitearch=''
879 sitearch=''
880 sitearchexp=''
881 installsitebin=''
882 sitebin=''
883 sitebinexp=''
884 installsitelib=''
885 sitelib=''
886 sitelib_stem=''
887 sitelibexp=''
888 siteprefix=''
889 siteprefixexp=''
890 sizesize=''
891 sizetype=''
892 so=''
893 socksizetype=''
894 sharpbang=''
895 shsharp=''
896 spitshell=''
897 src=''
898 ssizetype=''
899 startperl=''
900 startsh=''
901 stdchar=''
902 d_stdio_stream_array=''
903 stdio_stream_array=''
904 sysman=''
905 trnl=''
906 uidformat=''
907 uidsign=''
908 uidsize=''
909 uidtype=''
910 archname64=''
911 use64bitall=''
912 use64bitint=''
913 ccflags_uselargefiles=''
914 ldflags_uselargefiles=''
915 libswanted_uselargefiles=''
916 uselargefiles=''
917 uselongdouble=''
918 usemorebits=''
919 usemultiplicity=''
920 nm_opt=''
921 nm_so_opt=''
922 runnm=''
923 usenm=''
924 useperlio=''
925 usesocks=''
926 d_oldpthreads=''
927 use5005threads=''
928 useithreads=''
929 usethreads=''
930 incpath=''
931 mips_type=''
932 usrinc=''
933 d_vendorarch=''
934 installvendorarch=''
935 vendorarch=''
936 vendorarchexp=''
937 d_vendorbin=''
938 installvendorbin=''
939 vendorbin=''
940 vendorbinexp=''
941 d_vendorlib=''
942 installvendorlib=''
943 vendorlib=''
944 vendorlib_stem=''
945 vendorlibexp=''
946 usevendorprefix=''
947 vendorprefix=''
948 vendorprefixexp=''
949 defvoidused=''
950 voidflags=''
951 pm_apiversion=''
952 xs_apiversion=''
953 CONFIG=''
954
955 define='define'
956 undef='undef'
957 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
958 rmlist=''
959
960 : We must find out about Eunice early
961 eunicefix=':'
962 if test -f /etc/unixtovms; then
963         eunicefix=/etc/unixtovms
964 fi
965 if test -f /etc/unixtovms.exe; then
966         eunicefix=/etc/unixtovms.exe
967 fi
968
969 i_whoami=''
970 : set useposix=false in your hint file to disable the POSIX extension.
971 useposix=true
972 : set useopcode=false in your hint file to disable the Opcode extension.
973 useopcode=true
974 : Trailing extension.  Override this in a hint file, if needed.
975 _exe=''
976 : Extra object files, if any, needed on this platform.
977 archobjs=''
978 archname=''
979 : Possible local include directories to search.
980 : Set locincpth to "" in a hint file to defeat local include searches.
981 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
982 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
983 :
984 : no include file wanted by default
985 inclwanted=''
986
987 groupstype=''
988 : change the next line if compiling for Xenix/286 on Xenix/386
989 xlibpth='/usr/lib/386 /lib/386'
990 : Possible local library directories to search.
991 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
992 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
993
994 : general looking path for locating libraries
995 glibpth="/usr/lib/large /lib /usr/lib $xlibpth"
996 glibpth="$glibpth /lib/large /usr/lib/small /lib/small"
997 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
998 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
999 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
1000
1001 : Private path used by Configure to find libraries.  Its value
1002 : is prepended to libpth. This variable takes care of special
1003 : machines, like the mips.  Usually, it should be empty.
1004 plibpth=''
1005
1006 : default library list
1007 libswanted=''
1008 : some systems want to use only the non-versioned libso:s
1009 ignore_versioned_solibs=''
1010 archname64=''
1011 ccflags_uselargefiles=''
1012 ldflags_uselargefiles=''
1013 libswanted_uselargefiles=''
1014 : set usemultiplicity on the Configure command line to enable multiplicity.
1015 : set usesocks on the Configure command line to enable socks.
1016 : set usethreads on the Configure command line to enable threads.
1017 : full support for void wanted by default
1018 defvoidused=15
1019
1020 : List of libraries we want.
1021 : If anyone needs -lnet, put it in a hint file.
1022 libswanted='sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl'
1023 libswanted="$libswanted dld ld sun m c cposix posix"
1024 libswanted="$libswanted ndir dir crypt sec"
1025 libswanted="$libswanted ucb bsd BSD PW x iconv util"
1026 : We probably want to search /usr/shlib before most other libraries.
1027 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1028 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1029 glibpth="/usr/shlib $glibpth"
1030 : Do not use vfork unless overridden by a hint file.
1031 usevfork=false
1032
1033 : Find the basic shell for Bourne shell scripts
1034 case "$sh" in
1035 '')
1036         case "$SYSTYPE" in
1037         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1038         *) xxx='/bin/sh';;
1039         esac
1040         if test -f "$xxx"; then
1041                 sh="$xxx"
1042         else
1043                 : Build up a list and do a single loop so we can 'break' out.
1044                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1045                 for xxx in sh bash ksh pdksh ash; do
1046                         for p in $pth; do
1047                                 try="$try ${p}/${xxx}"
1048                         done
1049                 done
1050                 for xxx in $try; do
1051                         if test -f "$xxx"; then
1052                                 sh="$xxx";
1053                                 break
1054                         elif test -f "$xxx.exe"; then
1055                                 sh="$xxx";
1056                                 break
1057                         fi
1058                 done
1059         fi
1060         ;;
1061 esac
1062
1063 case "$sh" in
1064 '')     cat <<EOM >&2
1065 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
1066
1067 Usually it's in /bin/sh.  How did you even get this far?
1068 Please contact me (Perl Maintainers) at perlbug@perl.org and 
1069 we'll try to straighten this all out.
1070 EOM
1071         exit 1
1072         ;;
1073 esac
1074
1075 : see if sh knows # comments
1076 if `$sh -c '#' >/dev/null 2>&1`; then
1077         shsharp=true
1078         spitshell=cat
1079         xcat=/bin/cat
1080         test -f $xcat || xcat=/usr/bin/cat
1081         echo "#!$xcat" >try
1082         $eunicefix try
1083         chmod +x try
1084         ./try > today
1085         if test -s today; then
1086                 sharpbang='#!'
1087         else
1088                 echo "#! $xcat" > try
1089                 $eunicefix try
1090                 chmod +x try
1091                 ./try > today
1092                 if test -s today; then
1093                         sharpbang='#! '
1094                 else
1095                         sharpbang=': use '
1096                 fi
1097         fi
1098 else
1099         echo " "
1100         echo "Your $sh doesn't grok # comments--I will strip them later on."
1101         shsharp=false
1102         cd ..
1103         echo "exec grep -v '^[  ]*#'" >spitshell
1104         chmod +x spitshell
1105         $eunicefix spitshell
1106         spitshell=`pwd`/spitshell
1107         cd UU
1108         echo "I presume that if # doesn't work, #! won't work either!"
1109         sharpbang=': use '
1110 fi
1111 rm -f try today
1112
1113 : figure out how to guarantee sh startup
1114 case "$startsh" in
1115 '') startsh=${sharpbang}${sh} ;;
1116 *)
1117 esac
1118 cat >try <<EOSS
1119 $startsh
1120 set abc
1121 test "$?abc" != 1
1122 EOSS
1123
1124 chmod +x try
1125 $eunicefix try
1126 if ./try; then
1127         : echo "Yup, it does."
1128 else
1129         echo "Hmm... '$startsh' does not guarantee sh startup..."
1130         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1131 fi
1132 rm -f try
1133
1134
1135 : Save command line options in file UU/cmdline.opt for later use in
1136 : generating config.sh.
1137 cat > cmdline.opt <<EOSH
1138 # Configure command line arguments.
1139 config_arg0='$0'
1140 config_args='$*'
1141 config_argc=$#
1142 EOSH
1143 argn=1
1144 for arg in "$@"; do
1145         cat >>cmdline.opt <<EOSH
1146 config_arg$argn='$arg'
1147 EOSH
1148         argn=`expr $argn + 1`
1149 done
1150
1151 : produce awk script to parse command line options
1152 cat >options.awk <<'EOF'
1153 BEGIN {
1154         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1155
1156         len = length(optstr);
1157         for (i = 1; i <= len; i++) {
1158                 c = substr(optstr, i, 1);
1159                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1160                 if (a == ":") {
1161                         arg[c] = 1;
1162                         i++;
1163                 }
1164                 opt[c] = 1;
1165         }
1166 }
1167 {
1168         expect = 0;
1169         str = $0;
1170         if (substr(str, 1, 1) != "-") {
1171                 printf("'%s'\n", str);
1172                 next;
1173         }
1174         len = length($0);
1175         for (i = 2; i <= len; i++) {
1176                 c = substr(str, i, 1);
1177                 if (!opt[c]) {
1178                         printf("-%s\n", substr(str, i));
1179                         next;
1180                 }
1181                 printf("-%s\n", c);
1182                 if (arg[c]) {
1183                         if (i < len)
1184                                 printf("'%s'\n", substr(str, i + 1));
1185                         else
1186                                 expect = 1;
1187                         next;
1188                 }
1189         }
1190 }
1191 END {
1192         if (expect)
1193                 print "?";
1194 }
1195 EOF
1196
1197 : process the command line options
1198 set X `for arg in "$@"; do echo "X$arg"; done |
1199         sed -e s/X// | awk -f options.awk`
1200 eval "set $*"
1201 shift
1202 rm -f options.awk
1203
1204 : set up default values
1205 fastread=''
1206 reuseval=false
1207 config_sh=''
1208 alldone=''
1209 error=''
1210 silent=''
1211 extractsh=''
1212 override=''
1213 knowitall=''
1214 rm -f optdef.sh posthint.sh
1215 cat >optdef.sh <<EOS
1216 $startsh
1217 EOS
1218
1219
1220 : option parsing
1221 while test $# -gt 0; do
1222         case "$1" in
1223         -d) shift; fastread=yes;;
1224         -e) shift; alldone=cont;;
1225         -f)
1226                 shift
1227                 cd ..
1228                 if test -r "$1"; then
1229                         config_sh="$1"
1230                 else
1231                         echo "$me: cannot read config file $1." >&2
1232                         error=true
1233                 fi
1234                 cd UU
1235                 shift;;
1236         -h) shift; error=true;;
1237         -r) shift; reuseval=true;;
1238         -s) shift; silent=true; realsilent=true;;
1239         -E) shift; alldone=exit;;
1240         -K) shift; knowitall=true;;
1241         -O) shift; override=true;;
1242         -S) shift; silent=true; extractsh=true;;
1243         -D)
1244                 shift
1245                 case "$1" in
1246                 *=)
1247                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1248                         echo "$me: ignoring -D $1" >&2
1249                         ;;
1250                 *=*) echo "$1" | \
1251                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1252                 *) echo "$1='define'" >> optdef.sh;;
1253                 esac
1254                 shift
1255                 ;;
1256         -U)
1257                 shift
1258                 case "$1" in
1259                 *=) echo "$1" >> optdef.sh;;
1260                 *=*)
1261                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1262                         echo "$me: ignoring -U $1" >&2
1263                         ;;
1264                 *) echo "$1='undef'" >> optdef.sh;;
1265                 esac
1266                 shift
1267                 ;;
1268         -A)
1269             shift
1270             xxx=''
1271             yyy="$1"
1272             zzz=''
1273             uuu=undef
1274             case "$yyy" in
1275             *=*) zzz=`echo $yyy|sed 's!=.*!!'`
1276                  case "$zzz" in
1277                  *:*) zzz='' ;;
1278                  *)   xxx=append
1279                       zzz=" "`echo $yyy|sed 's!^[^=]*=!!'` 
1280                       yyy=`echo $yyy|sed 's!=.*!!'` ;;
1281                  esac
1282                  ;;
1283             esac
1284             case "$xxx" in
1285             '')  case "$yyy" in
1286                  *:*) xxx=`echo $yyy|sed 's!:.*!!'`
1287                       yyy=`echo $yyy|sed 's!^[^:]*:!!'`
1288                       zzz=`echo $yyy|sed 's!^[^=]*=!!'`
1289                       yyy=`echo $yyy|sed 's!=.*!!'` ;;
1290                  *)   xxx=`echo $yyy|sed 's!:.*!!'`
1291                       yyy=`echo $yyy|sed 's!^[^:]*:!!'` ;;
1292                  esac
1293                  ;;       
1294             esac
1295             case "$xxx" in
1296             append)
1297                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1298             clear)
1299                 echo "$yyy=''"                  >> posthint.sh ;;
1300             define)
1301                 case "$zzz" in
1302                 '') zzz=define ;;
1303                 esac
1304                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1305             eval)
1306                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1307             prepend)
1308                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1309             undef)
1310                 case "$zzz" in
1311                 '') zzz="$uuu" ;;
1312                 esac
1313                 echo "$yyy=$zzz"                >> posthint.sh ;;
1314             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1315             esac
1316             shift
1317             ;;
1318         -V) echo "$me generated by metaconfig 3.0 PL70." >&2
1319             exit 0;;
1320         --) break;;
1321         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1322         *) break;;
1323         esac
1324 done
1325
1326 case "$error" in
1327 true)
1328         cat >&2 <<EOM
1329 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1330                  [-U symbol] [-U symbol=] [-A command:symbol...]
1331   -d : use defaults for all answers.
1332   -e : go on without questioning past the production of config.sh.
1333   -f : specify an alternate default configuration file.
1334   -h : print this help message and exit (with an error status).
1335   -r : reuse C symbols value if possible (skips costly nm extraction).
1336   -s : silent mode, only echoes questions and essential information.
1337   -D : define symbol to have some value:
1338          -D symbol         symbol gets the value 'define'
1339          -D symbol=value   symbol gets the value 'value'
1340   -E : stop at the end of questions, after having produced config.sh.
1341   -K : do not use unless you know what you are doing.
1342   -O : let -D and -U override definitions from loaded configuration file.
1343   -S : perform variable substitutions on all .SH files (can mix with -f)
1344   -U : undefine symbol:
1345          -U symbol    symbol gets the value 'undef'
1346          -U symbol=   symbol gets completely empty
1347   -A : manipulate symbol after the platform specific hints have been applied:
1348          -A symbol=value                append " "value to symbol
1349          -A append:symbol=value         append value to symbol
1350          -A define:symbol=value         define symbol to have value
1351          -A clear:symbol                define symbol to be ''
1352          -A define:symbol               define symbol to be 'define'
1353          -A eval:symbol=value           define symbol to be eval of value
1354          -A prepend:symbol=value        prepend value to symbol
1355          -A undef:symbol                define symbol to be 'undef'
1356          -A undef:symbol=               define symbol to be ''
1357   -V : print version number and exit (with a zero status).
1358 EOM
1359         exit 1
1360         ;;
1361 esac
1362
1363 : Sanity checks
1364 case "$fastread$alldone" in
1365 yescont|yesexit) ;;
1366 *)
1367         case "$extractsh" in
1368         true) ;;
1369         *)
1370                 if test ! -t 0; then
1371                         echo "Say 'sh Configure', not 'sh <Configure'"
1372                         exit 1
1373                 fi
1374                 ;;
1375         esac
1376         ;;
1377 esac
1378
1379 exec 4>&1
1380 case "$silent" in
1381 true) exec 1>/dev/null;;
1382 esac
1383
1384 : run the defines and the undefines, if any, but leave the file out there...
1385 touch optdef.sh
1386 . ./optdef.sh
1387 : create the posthint manipulation script and leave the file out there...
1388 touch posthint.sh
1389
1390 : set package name
1391 package=perl5
1392 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1393 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1394 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1395 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1396 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1397 esac
1398
1399 : Some greps do not return status, grrr.
1400 echo "grimblepritz" >grimble
1401 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1402         contains=contains
1403 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1404         contains=grep
1405 else
1406         contains=contains
1407 fi
1408 rm -f grimble
1409 : the following should work in any shell
1410 case "$contains" in
1411 contains*)
1412         echo " "
1413         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1414         cat >contains <<'EOSS'
1415 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1416 EOSS
1417 chmod +x contains
1418 esac
1419
1420 : Find the path to the source tree
1421 case "$src" in
1422 '') case "$0" in
1423     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1424          case "$src" in
1425          /*)    ;;
1426          *)     src=`cd ../$src && pwd` ;;
1427          esac
1428          ;;
1429     *)   src='.';;
1430     esac;;
1431 esac
1432 case "$src" in
1433 '')     src=/
1434         rsrc=/
1435         ;;
1436 /*) rsrc="$src";;
1437 *) rsrc="../$src";;
1438 esac
1439 if test -f $rsrc/Configure && \
1440         $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1441 then
1442    : found it, so we are ok.
1443 else
1444         rsrc=''
1445         for src in . .. ../.. ../../.. ../../../..; do
1446                 if test -f ../$src/Configure && \
1447                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1448                 then
1449                         rsrc=../$src
1450                         break
1451                 fi
1452         done
1453 fi
1454 case "$rsrc" in
1455 '')
1456         cat <<EOM >&4
1457
1458 Sorry, I can't seem to locate the source dir for $package.  Please start
1459 Configure with an explicit path -- i.e. /some/path/Configure.
1460
1461 EOM
1462         exit 1
1463         ;;
1464 ../.)   rsrc='..';;
1465 *)
1466         echo " "
1467         echo "Sources for $package found in \"$src\"." >&4
1468         ;;
1469 esac
1470
1471 : script used to extract .SH files with variable substitutions
1472 cat >extract <<'EOS'
1473 CONFIGDOTSH=true
1474 echo "Doing variable substitutions on .SH files..."
1475 if test -f $src/MANIFEST; then
1476         set x `awk '{print $1}' <$src/MANIFEST | grep '\.SH$'`
1477 else
1478         echo "(Looking for .SH files under the source directory.)"
1479         set x `(cd $src; find . -name "*.SH" -print)`
1480 fi
1481 shift
1482 case $# in
1483 0) set x `(cd $src; echo *.SH)`; shift;;
1484 esac
1485 if test ! -f $src/$1; then
1486         shift
1487 fi
1488 mkdir_p='
1489 name=$1;
1490 create="";
1491 while test $name; do
1492         if test ! -d "$name"; then
1493                 create="$name $create";
1494                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1495                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1496         else
1497                 name="";
1498         fi;
1499 done;
1500 for file in $create; do
1501         mkdir $file;
1502 done
1503 '
1504 for file in $*; do
1505         case "$src" in
1506         ".")
1507                 case "$file" in
1508                 */*)
1509                         dir=`expr X$file : 'X\(.*\)/'`
1510                         file=`expr X$file : 'X.*/\(.*\)'`
1511                         (cd $dir && . ./$file)
1512                         ;;
1513                 *)
1514                         . ./$file
1515                         ;;
1516                 esac
1517                 ;;
1518         *)
1519                 case "$file" in
1520                 */*)
1521                         dir=`expr X$file : 'X\(.*\)/'`
1522                         file=`expr X$file : 'X.*/\(.*\)'`
1523                         (set x $dir; shift; eval $mkdir_p)
1524                         sh <$src/$dir/$file
1525                         ;;
1526                 *)
1527                         sh <$src/$file
1528                         ;;
1529                 esac
1530                 ;;
1531         esac
1532 done
1533 if test -f $src/config_h.SH; then
1534         if test ! -f config.h; then
1535         : oops, they left it out of MANIFEST, probably, so do it anyway.
1536         . $src/config_h.SH
1537         fi
1538 fi
1539 EOS
1540
1541 : extract files and exit if asked to do so
1542 case "$extractsh" in
1543 true)
1544         case "$realsilent" in
1545         true) ;;
1546         *) exec 1>&4;;
1547         esac
1548         case "$config_sh" in
1549         '') config_sh='config.sh';;
1550         esac
1551         echo " "
1552         echo "Fetching answers from $config_sh..."
1553         cd ..
1554         . $config_sh
1555         test "$override" && . ./optdef.sh
1556         echo " "
1557         . UU/extract
1558         rm -rf UU
1559         echo "Done."
1560         exit 0
1561         ;;
1562 esac
1563
1564 : Eunice requires " " instead of "", can you believe it
1565 echo " "
1566 : Here we go...
1567 echo "Beginning of configuration questions for $package."
1568
1569 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1570
1571 : first determine how to suppress newline on echo command
1572 echo " "
1573 echo "Checking echo to see how to suppress newlines..."
1574 (echo "hi there\c" ; echo " ") >.echotmp
1575 if $contains c .echotmp >/dev/null 2>&1 ; then
1576         echo "...using -n."
1577         n='-n'
1578         c=''
1579 else
1580         cat <<'EOM'
1581 ...using \c
1582 EOM
1583         n=''
1584         c='\c'
1585 fi
1586 echo $n "The star should be here-->$c"
1587 echo '*'
1588 rm -f .echotmp
1589
1590 : Now test for existence of everything in MANIFEST
1591 echo " "
1592 if test -f $rsrc/MANIFEST; then
1593         echo "First let's make sure your kit is complete.  Checking..." >&4
1594         awk '$1 !~ /PACK[A-Z]+/ {print $1}' $rsrc/MANIFEST | split -50
1595         rm -f missing
1596         tmppwd=`pwd`
1597         for filelist in x??; do
1598                 (cd $rsrc; ls `cat $tmppwd/$filelist` >/dev/null 2>>$tmppwd/missing)
1599         done
1600         if test -s missing; then
1601                 cat missing >&4
1602                 cat >&4 <<'EOM'
1603
1604 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1605
1606 You have the option of continuing the configuration process, despite the
1607 distinct possibility that your kit is damaged, by typing 'y'es.  If you
1608 do, don't blame me if something goes wrong.  I advise you to type 'n'o
1609 and contact the author (perlbug@perl.org).
1610
1611 EOM
1612                 echo $n "Continue? [n] $c" >&4
1613                 read ans
1614                 case "$ans" in
1615                 y*)
1616                         echo "Continuing..." >&4
1617                         rm -f missing
1618                         ;;
1619                 *)
1620                         echo "ABORTING..." >&4
1621                         kill $$
1622                         ;;
1623                 esac
1624         else
1625                 echo "Looks good..."
1626         fi
1627 else
1628         echo "There is no MANIFEST file.  I hope your kit is complete !"
1629 fi
1630 rm -f missing x??
1631
1632 echo " "
1633 : Find the appropriate value for a newline for tr
1634 if test -n "$DJGPP"; then
1635        trnl='\012'
1636 fi
1637 if test X"$trnl" = X; then
1638         case "`echo foo|tr '\n' x 2>/dev/null`" in
1639         foox) trnl='\n' ;;
1640         esac
1641 fi
1642 if test X"$trnl" = X; then
1643         case "`echo foo|tr '\012' x 2>/dev/null`" in
1644         foox) trnl='\012' ;;
1645         esac
1646 fi
1647 if test X"$trnl" = X; then
1648         cat <<EOM >&2
1649
1650 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
1651
1652 EOM
1653         exit 1
1654 fi
1655
1656 : compute the number of columns on the terminal for proper question formatting
1657 case "$COLUMNS" in
1658 '') COLUMNS='80';;
1659 esac
1660
1661 : set up the echo used in my read
1662 myecho="case \"\$xxxm\" in
1663 '') echo $n \"\$rp $c\" >&4;;
1664 *) case \"\$rp\" in
1665         '') echo $n \"[\$xxxm] $c\";;
1666         *)
1667                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
1668                         echo \"\$rp\" >&4
1669                         echo $n \"[\$xxxm] $c\" >&4
1670                 else
1671                         echo $n \"\$rp [\$xxxm] $c\" >&4
1672                 fi
1673                 ;;
1674         esac;;
1675 esac"
1676
1677 : now set up to do reads with possible shell escape and default assignment
1678 cat <<EOSC >myread
1679 $startsh
1680 xxxm=\$dflt
1681 $myecho
1682 ans='!'
1683 case "\$fastread" in
1684 yes) case "\$dflt" in
1685         '') ;;
1686         *) ans='';
1687                 case "\$silent-\$rp" in
1688                 true-) ;;
1689                 *) echo " " >&4;;
1690                 esac;;
1691         esac;;
1692 *) case "\$silent" in
1693         true) case "\$rp" in
1694                 '') ans='';;
1695                 esac;;
1696         esac;;
1697 esac
1698 while expr "X\$ans" : "X!" >/dev/null; do
1699         read answ
1700         set x \$xxxm
1701         shift
1702         aok=''; eval "ans=\\"\$answ\\"" && aok=y
1703         case  "\$answ" in
1704         "!")
1705                 sh 1>&4
1706                 echo " "
1707                 $myecho
1708                 ;;
1709         !*)
1710                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
1711                 shift
1712                 sh 1>&4 -c "\$*"
1713                 echo " "
1714                 $myecho
1715                 ;;
1716         "\$ans")
1717                 case "\$ans" in
1718                 \\&*)
1719                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
1720                         shift
1721                         case "\$1" in
1722                         -d)
1723                                 fastread=yes
1724                                 echo "(OK, I'll run with -d after this question.)" >&4
1725                                 ;;
1726                         -*)
1727                                 echo "*** Sorry, \$1 not supported yet." >&4
1728                                 ;;
1729                         esac
1730                         $myecho
1731                         ans=!
1732                         ;;
1733                 esac;;
1734         *)
1735                 case "\$aok" in
1736                 y)
1737                         echo "*** Substitution done -- please confirm."
1738                         xxxm="\$ans"
1739                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
1740                         xxxm="\$ans"
1741                         ans=!
1742                         ;;
1743                 *)
1744                         echo "*** Error -- try again."
1745                         ans=!
1746                         ;;
1747                 esac
1748                 $myecho
1749                 ;;
1750         esac
1751         case "\$ans\$xxxm\$nostick" in
1752         '')
1753                 ans=!
1754                 $myecho
1755                 ;;
1756         esac
1757 done
1758 case "\$ans" in
1759 '') ans="\$xxxm";;
1760 esac
1761 EOSC
1762
1763 : create .config dir to save info across Configure sessions
1764 test -d ../.config || mkdir ../.config
1765 cat >../.config/README <<EOF
1766 This directory created by Configure to save information that should
1767 persist across sessions for $package.
1768
1769 You may safely delete it if you wish.
1770 EOF
1771
1772 xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
1773 case "$usedevel" in
1774 $define|true|[yY]*) ;;
1775 *) case "$xversion" in
1776    *[13579])
1777         cat >&4 <<EOH
1778 *** WHOA THERE!!! ***
1779
1780     This is an UNSTABLE DEVELOPMENT release.
1781     The version of this $package distribution is $xversion, that is, odd,
1782     (as opposed to even) and that signifies a development release.
1783     If you want a maintenance release, you want an even-numbered version.)
1784
1785     Do ***NOT*** install this into production use.
1786     Data corruption and crashes are possible.
1787
1788     It is most seriously suggested that you do not continue any further
1789     unless you want to help in developing and debugging Perl.
1790
1791 EOH
1792         rp='Do you really want to continue?'
1793         dflt='n'
1794         . ./myread
1795         case "$ans" in
1796         [yY]) echo >&4 "Okay, continuing." ;;
1797         *) echo >&4 "Okay, bye."
1798            exit 1
1799            ;;
1800         esac
1801         ;;
1802     esac
1803     ;;
1804 esac
1805
1806 : general instructions
1807 needman=true
1808 firsttime=true
1809 user=`(logname) 2>/dev/null`
1810 case "$user" in
1811 '') user=`whoami 2>&1`;;
1812 esac
1813 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
1814         firsttime=false
1815         echo " "
1816         rp='Would you like to see the instructions?'
1817         dflt=n
1818         . ./myread
1819         case "$ans" in
1820         [yY]*) ;;
1821         *) needman=false;;
1822         esac
1823 fi
1824 if $needman; then
1825         cat <<EOH
1826
1827 This installation shell script will examine your system and ask you questions
1828 to determine how the perl5 package should be installed. If you get
1829 stuck on a question, you may use a ! shell escape to start a subshell or
1830 execute a command.  Many of the questions will have default answers in square
1831 brackets; typing carriage return will give you the default.
1832
1833 On some of the questions which ask for file or directory names you are allowed
1834 to use the ~name construct to specify the login directory belonging to "name",
1835 even if you don't have a shell which knows about that.  Questions where this is
1836 allowed will be marked "(~name ok)".
1837
1838 EOH
1839         rp=''
1840         dflt='Type carriage return to continue'
1841         . ./myread
1842         cat <<'EOH'
1843
1844 The prompter used in this script allows you to use shell variables and
1845 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
1846 in the default answer, as if the default line was a set of arguments given to a
1847 script shell.  This means you may also use $* to repeat the whole default line,
1848 so you do not have to re-type everything to add something to the default.
1849
1850 Everytime there is a substitution, you will have to confirm.  If there is an
1851 error (e.g. an unmatched backtick), the default answer will remain unchanged
1852 and you will be prompted again.
1853
1854 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
1855 the questions and use the computed defaults (or the previous answers if there
1856 was already a config.sh file). Type 'Configure -h' for a list of options.
1857 You may also start interactively and then answer '& -d' at any prompt to turn
1858 on the non-interactive behaviour for the remainder of the execution.
1859
1860 EOH
1861         . ./myread
1862         cat <<EOH
1863
1864 Much effort has been expended to ensure that this shell script will run on any
1865 Unix system.  If despite that it blows up on yours, your best bet is to edit
1866 Configure and run it again.  If you can't run Configure for some reason,
1867 you'll have to generate a config.sh file by hand.  Whatever problems you
1868 have, let me (perlbug@perl.org) know how I blew it.
1869
1870 This installation script affects things in two ways:
1871
1872 1) it may do direct variable substitutions on some of the files included
1873    in this kit.
1874 2) it builds a config.h file for inclusion in C programs.  You may edit
1875    any of these files as the need arises after running this script.
1876
1877 If you make a mistake on a question, there is no easy way to back up to it
1878 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
1879 files.  Configure will offer to let you do this before it runs the SH files.
1880
1881 EOH
1882         dflt='Type carriage return to continue'
1883         . ./myread
1884         case "$firsttime" in
1885         true) echo $user >>../.config/instruct;;
1886         esac
1887 fi
1888
1889 : find out where common programs are
1890 echo " "
1891 echo "Locating common programs..." >&4
1892 cat <<EOSC >loc
1893 $startsh
1894 case \$# in
1895 0) exit 1;;
1896 esac
1897 thing=\$1
1898 shift
1899 dflt=\$1
1900 shift
1901 for dir in \$*; do
1902         case "\$thing" in
1903         .)
1904         if test -d \$dir/\$thing; then
1905                 echo \$dir
1906                 exit 0
1907         fi
1908         ;;
1909         *)
1910         for thisthing in \$dir/\$thing; do
1911                 : just loop through to pick last item
1912         done
1913         if test -f \$thisthing; then
1914                 echo \$thisthing
1915                 exit 0
1916         elif test -f \$dir/\$thing.exe; then
1917                 if test -n "$DJGPP"; then
1918                         echo \$dir/\$thing.exe
1919                 else
1920                         : on Eunice apparently
1921                         echo \$dir/\$thing
1922                 fi
1923                 exit 0
1924         fi
1925         ;;
1926         esac
1927 done
1928 echo \$dflt
1929 exit 1
1930 EOSC
1931 chmod +x loc
1932 $eunicefix loc
1933 loclist="
1934 awk
1935 cat
1936 comm
1937 cp
1938 echo
1939 expr
1940 grep
1941 ls
1942 make
1943 mkdir
1944 rm
1945 sed
1946 sort
1947 touch
1948 tr
1949 uniq
1950 "
1951 trylist="
1952 Mcc
1953 ar
1954 byacc
1955 cpp
1956 csh
1957 date
1958 egrep
1959 gzip
1960 less
1961 ln
1962 more
1963 nm
1964 nroff
1965 pg
1966 test
1967 uname
1968 zip
1969 "
1970 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1971 pth="$pth /lib /usr/lib"
1972 for file in $loclist; do
1973         eval xxx=\$$file
1974         case "$xxx" in
1975         /*|?:[\\/]*)
1976                 if test -f "$xxx"; then
1977                         : ok
1978                 else
1979                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
1980                         xxx=`./loc $file $file $pth`
1981                 fi
1982                 ;;
1983         '') xxx=`./loc $file $file $pth`;;
1984         *) xxx=`./loc $xxx $xxx $pth`;;
1985         esac
1986         eval $file=$xxx
1987         eval _$file=$xxx
1988         case "$xxx" in
1989         /*)
1990                 echo $file is in $xxx.
1991                 ;;
1992         ?:[\\/]*)
1993                 echo $file is in $xxx.
1994                 ;;
1995         *)
1996                 echo "I don't know where '$file' is, and my life depends on it." >&4
1997                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
1998                 exit 1
1999                 ;;
2000         esac
2001 done
2002 echo " "
2003 echo "Don't worry if any of the following aren't found..."
2004 say=offhand
2005 for file in $trylist; do
2006         eval xxx=\$$file
2007         case "$xxx" in
2008         /*|?:[\\/]*)
2009                 if test -f "$xxx"; then
2010                         : ok
2011                 else
2012                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2013                         xxx=`./loc $file $file $pth`
2014                 fi
2015                 ;;
2016         '') xxx=`./loc $file $file $pth`;;
2017         *) xxx=`./loc $xxx $xxx $pth`;;
2018         esac
2019         eval $file=$xxx
2020         eval _$file=$xxx
2021         case "$xxx" in
2022         /*)
2023                 echo $file is in $xxx.
2024                 ;;
2025         ?:[\\/]*)
2026                 echo $file is in $xxx.
2027                 ;;
2028         *)
2029                 echo "I don't see $file out there, $say."
2030                 say=either
2031                 ;;
2032         esac
2033 done
2034 case "$egrep" in
2035 egrep)
2036         echo "Substituting grep for egrep."
2037         egrep=$grep
2038         ;;
2039 esac
2040 case "$ln" in
2041 ln)
2042         echo "Substituting cp for ln."
2043         ln=$cp
2044         ;;
2045 esac
2046 case "$test" in
2047 test)
2048         echo "Hopefully test is built into your sh."
2049         ;;
2050 *)
2051         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2052                 echo "Using the test built into your sh."
2053                 test=test
2054                 _test=test
2055         fi
2056         ;;
2057 esac
2058 case "$echo" in
2059 echo)
2060         echo "Hopefully echo is built into your sh."
2061         ;;
2062 '') ;;
2063 *)
2064         echo " "
2065 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2066         $echo $n "hi there$c" >foo1
2067         echo $n "hi there$c" >foo2
2068         if cmp foo1 foo2 >/dev/null 2>&1; then
2069                 echo "They are compatible.  In fact, they may be identical."
2070         else
2071                 case "$n" in
2072                 '-n') n='' c='\c';;
2073                 *) n='-n' c='';;
2074                 esac
2075                 cat <<FOO
2076 They are not compatible!  You are probably running ksh on a non-USG system.
2077 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2078 have echo built in and we may have to run some Bourne shell scripts.  That
2079 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2080
2081 FOO
2082                 $echo $n "The star should be here-->$c"
2083                 $echo "*"
2084         fi
2085         $rm -f foo1 foo2
2086         ;;
2087 esac
2088
2089 cat <<EOS >checkcc
2090 $startsh
2091 EOS
2092 cat <<'EOSC' >>checkcc
2093 case "$cc" in
2094 '') ;;
2095 *)  $rm -f try try.*
2096     $cat >try.c <<EOM
2097 int main(int argc, char *argv[]) {
2098   return 0;
2099 }
2100 EOM
2101     if $cc -o try try.c; then
2102        :
2103     else
2104         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2105         despair=yes
2106         trygcc=yes
2107         case "$cc" in
2108         *gcc*) trygcc=no ;;
2109         esac
2110         case "`$cc -v -c try.c 2>&1`" in
2111         *gcc*) trygcc=no ;;
2112         esac
2113         if $test X"$trygcc" = Xyes; then
2114             if gcc -o try -c try.c; then
2115                 echo " "
2116                 echo "You seem to have a working gcc, though." >&4
2117                 rp="Would you like to use it?"
2118                 dflt=y
2119                 if $test -f myread; then
2120                     . ./myread
2121                 else
2122                     if $test -f UU/myread; then
2123                         . ./UU/myread
2124                     else
2125                         echo "Cannot find myread, sorry.  Aborting." >&2
2126                         exit 1
2127                     fi
2128                 fi  
2129                 case "$ans" in
2130                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no ;;
2131                 esac
2132             fi
2133         fi
2134         if $test X"$despair" = Xyes; then
2135             echo "You need to find a working C compiler." >&4
2136             echo "I cannot continue any further, aborting." >&4
2137             exit 1
2138         fi
2139     fi
2140     $rm -f try try.*
2141     ;;
2142 esac
2143 EOSC
2144
2145 : determine whether symbolic links are supported
2146 echo " "
2147 $touch blurfl
2148 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2149         echo "Symbolic links are supported." >&4
2150         lns="$ln -s"
2151 else
2152         echo "Symbolic links are NOT supported." >&4
2153         lns="$ln"
2154 fi
2155 $rm -f blurfl sym
2156
2157 : see whether [:lower:] and [:upper:] are supported character classes
2158 echo " "
2159 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2160 ABYZ)
2161         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2162         up='[:upper:]'
2163         low='[:lower:]'
2164         ;;
2165 *)      # There is a discontinuity in EBCDIC between 'I' and 'J'
2166         # (0xc9 and 0xd1), therefore that is a nice testing point.
2167         if test "X$up" = X -o "X$low" = X; then
2168             case "`echo IJ | $tr '[I-J]' '[i-j]' 2>/dev/null`" in
2169             ij) up='[A-Z]'
2170                 low='[a-z]'
2171                 ;;
2172             esac
2173         fi
2174         if test "X$up" = X -o "X$low" = X; then
2175             case "`echo IJ | $tr I-J i-j 2>/dev/null`" in
2176             ij) up='A-Z'
2177                 low='a-z'
2178                 ;;
2179             esac
2180         fi
2181         if test "X$up" = X -o "X$low" = X; then
2182             case "`echo IJ | od -x 2>/dev/null`" in
2183             *C9D1*|*c9d1*)
2184                 echo "Hey, this might be EBCDIC." >&4
2185                 if test "X$up" = X -o "X$low" = X; then
2186                     case "`echo IJ | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
2187                     ij) up='[A-IJ-RS-Z]'
2188                         low='[a-ij-rs-z]'
2189                         ;;
2190                     esac
2191                 fi
2192                 if test "X$up" = X -o "X$low" = X; then
2193                     case "`echo IJ | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
2194                     ij) up='A-IJ-RS-Z'
2195                         low='a-ij-rs-z'
2196                         ;;
2197                     esac
2198                 fi
2199                 ;;
2200             esac
2201         fi
2202 esac
2203 case "`echo IJ | $tr \"$up\" \"$low\" 2>/dev/null`" in
2204 ij)
2205     echo "Using $up and $low to convert case." >&4
2206     ;;
2207 *)
2208     echo "I don't know how to translate letters from upper to lower case." >&4
2209     echo "Your tr is not acting any way I know of." >&4
2210     exit 1
2211     ;;
2212 esac
2213 : set up the translation script tr, must be called with ./tr of course
2214 cat >tr <<EOSC
2215 $startsh
2216 case "\$1\$2" in
2217 '[A-Z][a-z]') exec $tr '$up' '$low';;
2218 '[a-z][A-Z]') exec $tr '$low' '$up';;
2219 esac
2220 exec $tr "\$@"
2221 EOSC
2222 chmod +x tr
2223 $eunicefix tr
2224
2225 : Try to determine whether config.sh was made on this system
2226 case "$config_sh" in
2227 '')
2228 myuname=`$uname -a 2>/dev/null`
2229 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
2230 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
2231 # because the A-Z/a-z are not consecutive.
2232 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
2233         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
2234 newmyuname="$myuname"
2235 dflt=n
2236 case "$knowitall" in
2237 '')
2238         if test -f ../config.sh; then
2239                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
2240                         eval "`grep myuname= ../config.sh`"
2241                 fi
2242                 if test "X$myuname" = "X$newmyuname"; then
2243                         dflt=y
2244                 fi
2245         fi
2246         ;;
2247 *) dflt=y;;
2248 esac
2249
2250 : Get old answers from old config file if Configure was run on the
2251 : same system, otherwise use the hints.
2252 hint=default
2253 cd ..
2254 if test -f config.sh; then
2255         echo " "
2256         rp="I see a config.sh file.  Shall I use it to set the defaults?"
2257         . UU/myread
2258         case "$ans" in
2259         n*|N*) echo "OK, I'll ignore it."; mv config.sh config.sh.old;;
2260         *)  echo "Fetching default answers from your old config.sh file..." >&4
2261                 tmp_n="$n"
2262                 tmp_c="$c"
2263                 tmp_sh="$sh"
2264                 . ./config.sh
2265                 cp config.sh UU
2266                 n="$tmp_n"
2267                 c="$tmp_c"
2268                 : Older versions did not always set $sh.  Catch re-use of such
2269                 : an old config.sh.
2270                 case "$sh" in
2271                 '') sh="$tmp_sh" ;;
2272                 esac
2273                 hint=previous
2274                 ;;
2275         esac
2276 fi
2277 . ./UU/checkcc
2278 if test ! -f config.sh; then
2279         $cat <<EOM
2280
2281 First time through, eh?  I have some defaults handy for some systems
2282 that need some extra help getting the Configure answers right:
2283
2284 EOM
2285         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
2286         dflt=''
2287         : Half the following guesses are probably wrong... If you have better
2288         : tests or hints, please send them to perlbug@perl.org
2289         : The metaconfig authors would also appreciate a copy...
2290         $test -f /irix && osname=irix
2291         $test -f /xenix && osname=sco_xenix
2292         $test -f /dynix && osname=dynix
2293         $test -f /dnix && osname=dnix
2294         $test -f /lynx.os && osname=lynxos
2295         $test -f /unicos && osname=unicos && osvers=`$uname -r`
2296         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
2297         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
2298         $test -f /bin/mips && /bin/mips && osname=mips
2299         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
2300                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
2301         $test -d /usr/apollo/bin && osname=apollo
2302         $test -f /etc/saf/_sactab && osname=svr4
2303         $test -d /usr/include/minix && osname=minix
2304         if $test -d /MachTen -o -d /MachTen_Folder; then
2305                 osname=machten
2306                 if $test -x /sbin/version; then
2307                         osvers=`/sbin/version | $awk '{print $2}' |
2308                         $sed -e 's/[A-Za-z]$//'`
2309                 elif $test -x /usr/etc/version; then
2310                         osvers=`/usr/etc/version | $awk '{print $2}' |
2311                         $sed -e 's/[A-Za-z]$//'`
2312                 else
2313                         osvers="$2.$3"
2314                 fi
2315         fi
2316
2317         $test -f /sys/posix.dll &&
2318                 $test -f /usr/bin/what &&
2319                 set X `/usr/bin/what /sys/posix.dll` &&
2320                 $test "$3" = UWIN &&
2321                 osname=uwin &&
2322                 osvers="$5"
2323
2324         if $test -f $uname; then
2325                 set X $myuname
2326                 shift
2327
2328                 case "$5" in
2329                 fps*) osname=fps ;;
2330                 mips*)
2331                         case "$4" in
2332                         umips) osname=umips ;;
2333                         *) osname=mips ;;
2334                         esac;;
2335                 [23]100) osname=mips ;;
2336                 next*) osname=next ;;
2337                 i386*)
2338                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
2339                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
2340                                 osname='sco'
2341                                 osvers=$tmp
2342                         elif $test -f /etc/kconfig; then
2343                                 osname=isc
2344                                 if test "$lns" = "$ln -s"; then
2345                                         osvers=4
2346                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
2347                                         osvers=3
2348                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
2349                                         osvers=2
2350                                 fi
2351                         fi
2352                         tmp=''
2353                         ;;
2354                 pc*)
2355                         if test -n "$DJGPP"; then
2356                                 osname=dos
2357                                 osvers=djgpp
2358                         fi
2359                         ;;
2360                 esac
2361
2362                 case "$1" in
2363                 aix) osname=aix
2364                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
2365                         case "$tmp" in
2366                         'not found') osvers="$4"."$3" ;;
2367                         '<3240'|'<>3240') osvers=3.2.0 ;;
2368                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
2369                         '=3250'|'>3250') osvers=3.2.5 ;;
2370                         *) osvers=$tmp;;
2371                         esac
2372                         ;;
2373                 bsd386) osname=bsd386
2374                         osvers=`$uname -r`
2375                         ;;
2376                 cygwin*) osname=cygwin
2377                         osvers="$3"
2378                         ;;
2379                 *dc.osx) osname=dcosx
2380                         osvers="$3"
2381                         ;;
2382                 dnix) osname=dnix
2383                         osvers="$3"
2384                         ;;
2385                 domainos) osname=apollo
2386                         osvers="$3"
2387                         ;;
2388                 dgux) osname=dgux 
2389                         osvers="$3"
2390                         ;;
2391                 dynixptx*) osname=dynixptx
2392                         osvers=`echo "$4"|sed 's/^v//'`
2393                         ;;
2394                 freebsd) osname=freebsd 
2395                         osvers="$3" ;;
2396                 genix) osname=genix ;;
2397                 hp*) osname=hpux 
2398                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
2399                         ;;
2400                 irix*) osname=irix
2401                         case "$3" in
2402                         4*) osvers=4 ;;
2403                         5*) osvers=5 ;;
2404                         *)      osvers="$3" ;;
2405                         esac
2406                         ;;
2407                 linux) osname=linux
2408                         case "$3" in
2409                         *)      osvers="$3" ;;
2410                         esac
2411                         ;;
2412                 MiNT) osname=mint
2413                         ;;
2414                 netbsd*) osname=netbsd
2415                         osvers="$3"
2416                         ;;
2417                 news-os) osvers="$3"
2418                         case "$3" in
2419                         4*) osname=newsos4 ;;
2420                         *) osname=newsos ;;
2421                         esac
2422                         ;;
2423                 next*) osname=next ;;
2424                 POSIX-BC | posix-bc ) osname=posix-bc
2425                         osvers="$3"
2426                         ;;
2427                 powerux | power_ux | powermax_os | powermaxos | \
2428                 powerunix | power_unix) osname=powerux
2429                         osvers="$3"
2430                         ;;
2431                 qnx) osname=qnx
2432                         osvers="$4"
2433                         ;;
2434                 solaris) osname=solaris
2435                         case "$3" in
2436                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
2437                         *)      osvers="$3" ;;
2438                         esac
2439                         ;;
2440                 sunos) osname=sunos
2441                         case "$3" in
2442                         5*) osname=solaris
2443                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
2444                         *)      osvers="$3" ;;
2445                         esac
2446                         ;;
2447                 titanos) osname=titanos
2448                         case "$3" in
2449                         1*) osvers=1 ;;
2450                         2*) osvers=2 ;;
2451                         3*) osvers=3 ;;
2452                         4*) osvers=4 ;;
2453                         *)      osvers="$3" ;;
2454                         esac
2455                         ;;
2456                 ultrix) osname=ultrix
2457                         osvers="$3"
2458                         ;;
2459                 osf1|mls+)      case "$5" in
2460                                 alpha)
2461                                         osname=dec_osf
2462                                         osvers=`sizer -v | awk '{print $3}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
2463                                         case "$osvers" in
2464                                         [1-9].[0-9]*) ;;
2465                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
2466                                         esac
2467                                         ;;
2468                         hp*)    osname=hp_osf1  ;;
2469                         mips)   osname=mips_osf1 ;;
2470                         esac
2471                         ;;
2472                 unixware) osname=svr5
2473                         osvers="$4"
2474                         ;;
2475                 uts) osname=uts
2476                         osvers="$3"
2477                         ;;
2478                 $2) case "$osname" in
2479                         *isc*) ;;
2480                         *freebsd*) ;;
2481                         svr*)
2482                                 : svr4.x or possibly later
2483                                 case "svr$3" in 
2484                                 ${osname}*)
2485                                         osname=svr$3
2486                                         osvers=$4
2487                                         ;;
2488                                 esac
2489                                 case "$osname" in
2490                                 svr4.0)
2491                                         : Check for ESIX
2492                                         if test -f /stand/boot ; then
2493                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
2494                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
2495                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
2496                                                         if test -n "$isesix"; then
2497                                                                 osname=esix4
2498                                                         fi
2499                                                 fi
2500                                         fi
2501                                         ;;
2502                                 esac
2503                                 ;;
2504                         *)      if test -f /etc/systemid; then
2505                                         osname=sco
2506                                         set `echo $3 | $sed 's/\./ /g'` $4
2507                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
2508                                                 osvers=$1.$2.$3
2509                                         elif $test -f $src/hints/sco_$1_$2.sh; then
2510                                                 osvers=$1.$2
2511                                         elif $test -f $src/hints/sco_$1.sh; then
2512                                                 osvers=$1
2513                                         fi
2514                                 else
2515                                         case "$osname" in
2516                                         '') : Still unknown.  Probably a generic Sys V.
2517                                                 osname="sysv"
2518                                                 osvers="$3"
2519                                                 ;;
2520                                         esac
2521                                 fi
2522                                 ;;
2523                         esac
2524                         ;;
2525                 *)      case "$osname" in
2526                         '') : Still unknown.  Probably a generic BSD.
2527                                 osname="$1"
2528                                 osvers="$3"
2529                                 ;;
2530                         esac
2531                         ;;
2532                 esac
2533         else
2534                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
2535                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
2536                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
2537                                 osname=news_os
2538                         fi
2539                         $rm -f UU/kernel.what
2540                 elif test -d c:/.; then
2541                         set X $myuname
2542                         osname=os2
2543                         osvers="$5"
2544                 fi
2545         fi
2546         
2547         : Now look for a hint file osname_osvers, unless one has been
2548         : specified already.
2549         case "$hintfile" in
2550         ''|' ')
2551                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
2552                 : Also try without trailing minor version numbers.
2553                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
2554                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
2555                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
2556                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
2557                 case "$file" in
2558                 '') dflt=none ;;
2559                 *)  case "$osvers" in
2560                         '') dflt=$file
2561                                 ;;
2562                         *)  if $test -f $src/hints/$file.sh ; then
2563                                         dflt=$file
2564                                 elif $test -f $src/hints/$xfile.sh ; then
2565                                         dflt=$xfile
2566                                 elif $test -f $src/hints/$xxfile.sh ; then
2567                                         dflt=$xxfile
2568                                 elif $test -f $src/hints/$xxxfile.sh ; then
2569                                         dflt=$xxxfile
2570                                 elif $test -f $src/hints/$xxxxfile.sh ; then
2571                                         dflt=$xxxxfile
2572                                 elif $test -f "$src/hints/${osname}.sh" ; then
2573                                         dflt="${osname}"
2574                                 else
2575                                         dflt=none
2576                                 fi
2577                                 ;;
2578                         esac
2579                         ;;
2580                 esac
2581                 if $test -f Policy.sh ; then
2582                         case "$dflt" in
2583                         *Policy*) ;;
2584                         none) dflt="Policy" ;;
2585                         *) dflt="Policy $dflt" ;;
2586                         esac
2587                 fi
2588                 ;;
2589         *)
2590                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
2591                 ;;
2592         esac
2593
2594         if $test -f Policy.sh ; then
2595                 $cat <<EOM
2596
2597 There's also a Policy hint file available, which should make the
2598 site-specific (policy) questions easier to answer.
2599 EOM
2600
2601         fi
2602
2603         $cat <<EOM
2604
2605 You may give one or more space-separated answers, or "none" if appropriate.
2606 A well-behaved OS will have no hints, so answering "none" or just "Policy"
2607 is a good thing.  DO NOT give a wrong version or a wrong OS.
2608
2609 EOM
2610
2611         rp="Which of these apply, if any?"
2612         . UU/myread
2613         tans=$ans
2614         for file in $tans; do
2615                 if $test X$file = XPolicy -a -f Policy.sh; then
2616                         . Policy.sh
2617                         $cat Policy.sh >> UU/config.sh
2618                 elif $test -f $src/hints/$file.sh; then
2619                         . $src/hints/$file.sh
2620                         $cat $src/hints/$file.sh >> UU/config.sh
2621                 elif $test X$tans = X -o X$tans = Xnone ; then
2622                         : nothing
2623                 else
2624                         : Give one chance to correct a possible typo.
2625                         echo "$file.sh does not exist"
2626                         dflt=$file
2627                         rp="hint to use instead?"
2628                         . UU/myread
2629                         for file in $ans; do
2630                                 if $test -f "$src/hints/$file.sh"; then
2631                                         . $src/hints/$file.sh
2632                                         $cat $src/hints/$file.sh >> UU/config.sh
2633                                 elif $test X$ans = X -o X$ans = Xnone ; then
2634                                         : nothing
2635                                 else
2636                                         echo "$file.sh does not exist -- ignored."
2637                                 fi
2638                         done
2639                 fi
2640         done
2641
2642         hint=recommended
2643         : Remember our hint file for later.
2644         if $test -f "$src/hints/$file.sh" ; then
2645                 hintfile="$file"
2646         else
2647                 hintfile=''
2648         fi
2649 fi
2650 cd UU
2651 ;;
2652 *)
2653         echo " "
2654         echo "Fetching default answers from $config_sh..." >&4
2655         tmp_n="$n"
2656         tmp_c="$c"
2657         cd ..
2658         cp $config_sh config.sh 2>/dev/null
2659         chmod +w config.sh
2660         . ./config.sh
2661         cd UU
2662         cp ../config.sh .
2663         n="$tmp_n"
2664         c="$tmp_c"
2665         hint=previous
2666         ;;
2667 esac
2668 test "$override" && . ./optdef.sh
2669 myuname="$newmyuname"
2670
2671 : Restore computed paths
2672 for file in $loclist $trylist; do
2673         eval $file="\$_$file"
2674 done
2675
2676 cat << EOM
2677
2678 Configure uses the operating system name and version to set some defaults.
2679 The default value is probably right if the name rings a bell. Otherwise,
2680 since spelling matters for me, either accept the default or answer "none"
2681 to leave it blank.
2682
2683 EOM
2684 case "$osname" in
2685         ''|' ')
2686                 case "$hintfile" in
2687                 ''|' '|none) dflt=none ;;
2688                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
2689                 esac
2690                 ;;
2691         *) dflt="$osname" ;;
2692 esac
2693 rp="Operating system name?"
2694 . ./myread
2695 case "$ans" in
2696 none)  osname='' ;;
2697 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
2698 esac
2699 echo " "
2700 case "$osvers" in
2701         ''|' ')
2702                 case "$hintfile" in
2703                 ''|' '|none) dflt=none ;;
2704                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
2705                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
2706                         case "$dflt" in
2707                         ''|' ') dflt=none ;;
2708                         esac
2709                         ;;
2710                 esac
2711                 ;;
2712         *) dflt="$osvers" ;;
2713 esac
2714 rp="Operating system version?"
2715 . ./myread
2716 case "$ans" in
2717 none)  osvers='' ;;
2718 *) osvers="$ans" ;;
2719 esac
2720
2721
2722 . ./posthint.sh
2723
2724 : who configured the system
2725 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
2726 cf_by=`(logname) 2>/dev/null`
2727 case "$cf_by" in
2728 "")
2729         cf_by=`(whoami) 2>/dev/null`
2730         case "$cf_by" in
2731         "") cf_by=unknown ;;
2732         esac ;;
2733 esac
2734
2735 : set up the script used to warn in case of inconsistency
2736 cat <<EOS >whoa
2737 $startsh
2738 EOS
2739 cat <<'EOSC' >>whoa
2740 dflt=y
2741 echo " "
2742 echo "*** WHOA THERE!!! ***" >&4
2743 echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
2744 rp="    Keep the $hint value?"
2745 . ./myread
2746 case "$ans" in
2747 y) td=$was; tu=$was;;
2748 esac
2749 EOSC
2750
2751 : function used to set $1 to $val
2752 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
2753 case "$val$was" in
2754 $define$undef) . ./whoa; eval "$var=\$td";;
2755 $undef$define) . ./whoa; eval "$var=\$tu";;
2756 *) eval "$var=$val";;
2757 esac'
2758
2759 case "$usethreads" in
2760 $define|true|[yY]*)     dflt='y';;
2761 *) dflt='n';;
2762 esac
2763 cat <<EOM
2764
2765 Perl can be built to take advantage of threads on some systems.
2766 To do so, Configure can be run with -Dusethreads.
2767
2768 Note that threading is a highly experimental feature, and
2769 some known race conditions still remain.  If you choose to try
2770 it, be very sure to not actually deploy it for production
2771 purposes.  README.threads has more details, and is required
2772 reading if you enable threads.
2773
2774 If this doesn't make any sense to you, just accept the default '$dflt'.
2775 EOM
2776 rp='Build a threading Perl?'
2777 . ./myread
2778 case "$ans" in
2779 y|Y)    val="$define" ;;
2780 *)      val="$undef" ;;
2781 esac
2782 set usethreads
2783 eval $setvar
2784
2785 case "$usethreads" in
2786 $define)
2787         $cat <<EOM
2788
2789 As of 5.5.640, Perl has two different internal threading implementations,
2790 the 5.005 version (5005threads) and an interpreter-based version
2791 (ithreads) that has one interpreter per thread.  Both are very 
2792 experimental.  This arrangement exists to help developers work out
2793 which one is better.
2794
2795 If you're a casual user, you probably don't want interpreter-threads
2796 at this time.  There doesn't yet exist a way to create threads from
2797 within Perl in this model, i.e., "use Thread;" will NOT work.
2798 EOM
2799         : Default to ithreads unless overridden on command line or with
2800         : old config.sh
2801         dflt='y'
2802         case "$use5005threads" in
2803                 $define|true|[yY]*) dflt='n';;
2804         esac
2805         case "$useithreads" in
2806                 $undef|false|[nN]*) dflt='n';;
2807         esac
2808         rp='Use interpreter-based ithreads?'
2809         . ./myread
2810         case "$ans" in
2811         y|Y)    val="$define" ;;
2812         *)      val="$undef" ;;
2813         esac
2814         set useithreads
2815         eval $setvar
2816         : Now set use5005threads to the opposite value.
2817         case "$useithreads" in
2818         $define) val="$undef" ;;
2819         *) val="$define" ;;
2820         esac
2821         set use5005threads
2822         eval $setvar
2823         ;;
2824 *)
2825         useithreads="$undef"
2826         use5005threads="$undef"
2827         ;;
2828 esac
2829
2830 case "$d_oldpthreads" in
2831 '')     : Configure tests would be welcome here.  For now, assume undef.
2832         val="$undef" ;;
2833 *)      val="$d_oldpthreads" ;;
2834 esac
2835 set d_oldpthreads
2836 eval $setvar
2837
2838
2839 case "$usethreads" in
2840 "$define"|true|[yY]*)
2841 : Look for a hint-file generated 'call-back-unit'.  If the
2842 : user has specified that a threading perl is to be built,
2843 : we may need to set or change some other defaults.
2844         if $test -f usethreads.cbu; then
2845                 echo "Your platform has some specific hints for threaded builds, using them..."
2846                 . ./usethreads.cbu
2847         else
2848                 $cat <<EOM
2849 (Your platform doesn't have any specific hints for threaded builds.
2850  Assuming POSIX threads, then.)
2851 EOM
2852         fi
2853         ;;
2854 esac
2855
2856 cat <<EOM
2857
2858 Perl can be built so that multiple Perl interpreters can coexist
2859 within the same Perl executable.
2860 EOM
2861
2862 case "$useithreads" in
2863 $define)
2864         cat <<EOM
2865 This multiple interpreter support is required for interpreter-based threads.
2866 EOM
2867         val="$define"
2868         ;;
2869 *)      case "$usemultiplicity" in
2870         $define|true|[yY]*)     dflt='y';;
2871         *) dflt='n';;
2872         esac
2873         echo " "
2874         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
2875         rp='Build Perl for multiplicity?'
2876         . ./myread
2877         case "$ans" in
2878         y|Y)    val="$define" ;;
2879         *)      val="$undef" ;;
2880         esac
2881         ;;
2882 esac
2883 set usemultiplicity
2884 eval $setvar
2885
2886 : determine where manual pages are on this system
2887 echo " "
2888 case "$sysman" in
2889 '') 
2890         syspath='/usr/man/man1 /usr/man/mann /usr/man/manl /usr/man/local/man1'
2891         syspath="$syspath /usr/man/u_man/man1 /usr/share/man/man1"
2892         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
2893         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
2894         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
2895         sysman=`./loc . /usr/man/man1 $syspath`
2896         ;;
2897 esac
2898 if $test -d "$sysman"; then
2899         echo "System manual is in $sysman." >&4
2900 else
2901         echo "Could not find manual pages in source form." >&4
2902 fi
2903
2904 : see what memory models we can support
2905 case "$models" in
2906 '')
2907         $cat >pdp11.c <<'EOP'
2908 int main() {
2909 #ifdef pdp11
2910         exit(0);
2911 #else
2912         exit(1);
2913 #endif
2914 }
2915 EOP
2916         case "$cc" in
2917         '') modelcc="$cc" ;;
2918         *) modelcc="cc" ;;
2919         esac
2920         ( $modelcc -o pdp11 pdp11.c ) >/dev/null 2>&1
2921         if $test -f pdp11 && ./pdp11 2>/dev/null; then
2922                 dflt='unsplit split'
2923         else
2924                 tans=`./loc . X /lib/small /lib/large /usr/lib/small /usr/lib/large /lib/medium /usr/lib/medium /lib/huge`
2925                 case "$tans" in
2926                 X) dflt='none';;
2927                 *) if $test -d /lib/small || $test -d /usr/lib/small; then
2928                                 dflt='small'
2929                         else
2930                                 dflt=''
2931                         fi
2932                         if $test -d /lib/medium || $test -d /usr/lib/medium; then
2933                                 dflt="$dflt medium"
2934                         fi
2935                         if $test -d /lib/large || $test -d /usr/lib/large; then
2936                                 dflt="$dflt large"
2937                         fi
2938                         if $test -d /lib/huge || $test -d /usr/lib/huge; then
2939                                 dflt="$dflt huge"
2940                         fi
2941                 esac
2942         fi;;
2943 *) dflt="$models";;
2944 esac
2945 $cat <<EOM
2946  
2947 Some systems have different model sizes.  On most systems they are called
2948 small, medium, large, and huge.  On the PDP11 they are called unsplit and
2949 split.  If your system doesn't support different memory models, say "none".
2950 If you wish to force everything to one memory model, say "none" here and
2951 put the appropriate flags later when it asks you for other cc and ld flags.
2952 Venix systems may wish to put "none" and let the compiler figure things out.
2953 (In the following question multiple model names should be space separated.)
2954
2955 The default for most systems is "none".
2956
2957 EOM
2958 rp="Which memory models are supported?"
2959 . ./myread
2960 models="$ans"
2961
2962 case "$models" in
2963 none)
2964         small=''
2965         medium=''
2966         large=''
2967         huge=''
2968         unsplit=''
2969         split=''
2970         ;;
2971 *split)
2972         case "$split" in
2973         '') if $contains '\-i' $sysman/ld.1 >/dev/null 2>&1 || \
2974                          $contains '\-i' $sysman/cc.1 >/dev/null 2>&1; then
2975                         dflt='-i'
2976                 else
2977                         dflt='none'
2978                 fi;;
2979         *) dflt="$split";;
2980         esac
2981         rp="What flag indicates separate I and D space?"
2982         . ./myread
2983         tans="$ans"
2984         case "$tans" in
2985         none) tans='';;
2986         esac
2987         split="$tans"
2988         unsplit='';;
2989 *large*|*small*|*medium*|*huge*)
2990         case "$models" in
2991         *large*)
2992                 case "$large" in
2993                 '') dflt='-Ml';;
2994                 *) dflt="$large";;
2995                 esac
2996         rp="What flag indicates large model?"
2997         . ./myread
2998         tans="$ans"
2999         case "$tans" in
3000         none) tans='';
3001         esac
3002         large="$tans";;
3003         *) large='';;
3004         esac
3005         case "$models" in
3006         *huge*) case "$huge" in
3007                 '') dflt='-Mh';;
3008                 *) dflt="$huge";;
3009                 esac
3010                 rp="What flag indicates huge model?"
3011                 . ./myread
3012                 tans="$ans"
3013                 case "$tans" in
3014                 none) tans='';
3015                 esac
3016                 huge="$tans";;
3017         *) huge="$large";;
3018         esac
3019         case "$models" in
3020         *medium*) case "$medium" in
3021                 '') dflt='-Mm';;
3022                 *) dflt="$medium";;
3023                 esac
3024                 rp="What flag indicates medium model?"
3025                 . ./myread
3026                 tans="$ans"
3027                 case "$tans" in
3028                 none) tans='';
3029                 esac
3030                 medium="$tans";;
3031         *) medium="$large";;
3032         esac
3033         case "$models" in
3034         *small*) case "$small" in
3035                 '') dflt='none';;
3036                 *) dflt="$small";;
3037                 esac
3038                 rp="What flag indicates small model?"
3039                 . ./myread
3040                 tans="$ans"
3041                 case "$tans" in
3042                 none) tans='';
3043                 esac
3044                 small="$tans";;
3045         *) small='';;
3046         esac
3047         ;;
3048 *)
3049         echo "Unrecognized memory models--you may have to edit Makefile.SH" >&4
3050         ;;
3051 esac
3052 $rm -f pdp11.* pdp11
3053
3054 : make some quick guesses about what we are up against
3055 echo " "
3056 $echo $n "Hmm...  $c"
3057 echo exit 1 >bsd
3058 echo exit 1 >usg
3059 echo exit 1 >v7
3060 echo exit 1 >osf1
3061 echo exit 1 >eunice
3062 echo exit 1 >xenix
3063 echo exit 1 >venix
3064 echo exit 1 >os2
3065 d_bsd="$undef"
3066 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
3067 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
3068 then
3069         echo "Looks kind of like an OSF/1 system, but we'll see..."
3070         echo exit 0 >osf1
3071 elif test `echo abc | tr a-z A-Z` = Abc ; then
3072         xxx=`./loc addbib blurfl $pth`
3073         if $test -f $xxx; then
3074         echo "Looks kind of like a USG system with BSD features, but we'll see..."
3075                 echo exit 0 >bsd
3076                 echo exit 0 >usg
3077         else
3078                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
3079                         echo "Looks kind of like an extended USG system, but we'll see..."
3080                 else
3081                         echo "Looks kind of like a USG system, but we'll see..."
3082                 fi
3083                 echo exit 0 >usg
3084         fi
3085 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
3086         echo "Looks kind of like a BSD system, but we'll see..."
3087         d_bsd="$define"
3088         echo exit 0 >bsd
3089 else
3090         echo "Looks kind of like a Version 7 system, but we'll see..."
3091         echo exit 0 >v7
3092 fi
3093 case "$eunicefix" in
3094 *unixtovms*)
3095         $cat <<'EOI'
3096 There is, however, a strange, musty smell in the air that reminds me of
3097 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
3098 EOI
3099         echo exit 0 >eunice
3100         d_eunice="$define"
3101 : it so happens the Eunice I know will not run shell scripts in Unix format
3102         ;;
3103 *)
3104         echo " "
3105         echo "Congratulations.  You aren't running Eunice."
3106         d_eunice="$undef"
3107         ;;
3108 esac
3109 : Detect OS2.  The p_ variable is set above in the Head.U unit.
3110 case "$p_" in
3111 :) ;;
3112 *)
3113         $cat <<'EOI'
3114 I have the feeling something is not exactly right, however...don't tell me...
3115 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
3116 EOI
3117         echo exit 0 >os2
3118         ;;
3119 esac
3120 if test -f /xenix; then
3121         echo "Actually, this looks more like a XENIX system..."
3122         echo exit 0 >xenix
3123         d_xenix="$define"
3124 else
3125         echo " "
3126         echo "It's not Xenix..."
3127         d_xenix="$undef"
3128 fi
3129 chmod +x xenix
3130 $eunicefix xenix
3131 if test -f /venix; then
3132         echo "Actually, this looks more like a VENIX system..."
3133         echo exit 0 >venix
3134 else
3135         echo " "
3136         if ./xenix; then
3137                 : null
3138         else
3139                 echo "Nor is it Venix..."
3140         fi
3141 fi
3142 chmod +x bsd usg v7 osf1 eunice xenix venix os2
3143 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
3144 $rm -f foo
3145
3146 : see if we need a special compiler
3147 echo " "
3148 if ./usg; then
3149         case "$cc" in
3150         '') case "$Mcc" in
3151                 /*) dflt='Mcc';;
3152                 *) case "$large" in
3153                         -M*) dflt='cc';;
3154                         *)      if $contains '\-M' $sysman/cc.1 >/dev/null 2>&1 ; then
3155                                         if $contains '\-M' $sysman/cpp.1 >/dev/null 2>&1; then
3156                                                 dflt='cc'
3157                                         else
3158                                                 dflt='cc -M'
3159                                         fi
3160                                 else
3161                                         dflt='cc'
3162                                 fi;;
3163                         esac;;
3164                 esac;;
3165         *)  dflt="$cc";;
3166         esac
3167         case "$dflt" in
3168         *M*)    $cat <<'EOM'
3169 On some older systems the default C compiler will not resolve multiple global
3170 references that happen to have the same name.  On some such systems the "Mcc"
3171 command may be used to force these to be resolved.  On other systems a "cc -M"
3172 command is required.  (Note that the -M flag on other systems indicates a
3173 memory model to use!) If you have the Gnu C compiler, you might wish to use
3174 that instead.
3175
3176 EOM
3177         ;;
3178         esac
3179         rp="Use which C compiler?"
3180         . ./myread
3181         cc="$ans"
3182 else
3183         case "$cc" in
3184         '') dflt=cc;;
3185         *) dflt="$cc";;
3186         esac
3187         rp="Use which C compiler?"
3188         . ./myread
3189         cc="$ans"
3190 fi
3191 : Look for a hint-file generated 'call-back-unit'.  Now that the
3192 : user has specified the compiler, we may need to set or change some
3193 : other defaults.
3194 if $test -f cc.cbu; then
3195     . ./cc.cbu
3196 fi
3197 . ./checkcc
3198
3199 echo " "
3200 echo "Checking for GNU cc in disguise and/or its version number..." >&4
3201 $cat >gccvers.c <<EOM
3202 #include <stdio.h>
3203 int main() {
3204 #ifdef __GNUC__
3205 #ifdef __VERSION__
3206         printf("%s\n", __VERSION__);
3207 #else
3208         printf("%s\n", "1");
3209 #endif
3210 #endif
3211         exit(0);
3212 }
3213 EOM
3214 if $cc $ldflags -o gccvers gccvers.c; then
3215         gccversion=`./gccvers`
3216         case "$gccversion" in
3217         '') echo "You are not using GNU cc." ;;
3218         *)  echo "You are using GNU cc $gccversion."
3219             ccname=gcc  
3220             ;;
3221         esac
3222 else
3223         echo " "
3224         echo "*** WHOA THERE!!! ***" >&4
3225         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
3226         case "$knowitall" in
3227         '')
3228         echo "    You'd better start hunting for one and let me know about it." >&4
3229                 exit 1
3230                 ;;
3231         esac
3232 fi
3233 $rm -f gccvers*
3234 case "$gccversion" in
3235 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
3236 esac
3237 case "$gccversion" in
3238 '') gccosandvers='' ;;
3239 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
3240    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
3241    gccshortvers=''
3242    case "$gccosandvers" in
3243    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
3244    $osname$osvers) ;; # looking good
3245    $osname*) cat <<EOM >&4
3246
3247 *** WHOA THERE!!! ***
3248
3249     Your gcc has not been compiled for the exact release of
3250     your operating system ($gccosandvers versus $osname$osvers).
3251
3252     In general it is a good idea to keep gcc synchronized with
3253     the operating system because otherwise serious problems
3254     may ensue when trying to compile software, like Perl.
3255
3256     I'm trying to be optimistic here, though, and will continue.
3257     If later during the configuration and build icky compilation
3258     problems appear (headerfile conflicts being the most common
3259     manifestation), I suggest reinstalling the gcc to match
3260     your operating system release.
3261
3262 EOM
3263       ;;
3264    *) gccosandvers='' ;; # failed to parse, better be silent
3265    esac
3266    ;;
3267 esac
3268 case "$ccname" in
3269 '') ccname="$cc" ;;
3270 esac
3271
3272 : see how we invoke the C preprocessor
3273 echo " "
3274 echo "Now, how can we feed standard input to your C preprocessor..." >&4
3275 cat <<'EOT' >testcpp.c
3276 #define ABC abc
3277 #define XYZ xyz
3278 ABC.XYZ
3279 EOT
3280 cd ..
3281 if test ! -f cppstdin; then
3282         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
3283                 # AIX cc -E doesn't show the absolute headerfile
3284                 # locations but we'll cheat by using the -M flag.
3285                 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
3286         else
3287                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
3288         fi
3289 else
3290         echo "Keeping your $hint cppstdin wrapper."
3291 fi
3292 chmod 755 cppstdin
3293 wrapper=`pwd`/cppstdin
3294 ok='false'
3295 cd UU
3296
3297 if $test "X$cppstdin" != "X" && \
3298         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
3299         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3300 then
3301         echo "You used to use $cppstdin $cppminus so we'll use that again."
3302         case "$cpprun" in
3303         '') echo "But let's see if we can live without a wrapper..." ;;
3304         *)
3305                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
3306                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3307                 then
3308                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
3309                         ok='true'
3310                 else
3311                         echo "(However, $cpprun $cpplast does not work, let's see...)"
3312                 fi
3313                 ;;
3314         esac
3315 else
3316         case "$cppstdin" in
3317         '') ;;
3318         *)
3319                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
3320                 ;;
3321         esac
3322 fi
3323
3324 if $ok; then
3325         : nothing
3326 elif echo 'Maybe "'"$cc"' -E" will work...'; \
3327         $cc -E <testcpp.c >testcpp.out 2>&1; \
3328         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3329         echo "Yup, it does."
3330         x_cpp="$cc -E"
3331         x_minus='';
3332 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
3333         $cc -E - <testcpp.c >testcpp.out 2>&1; \
3334         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3335         echo "Yup, it does."
3336         x_cpp="$cc -E"
3337         x_minus='-';
3338 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
3339         $cc -P <testcpp.c >testcpp.out 2>&1; \
3340         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3341         echo "Yipee, that works!"
3342         x_cpp="$cc -P"
3343         x_minus='';
3344 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
3345         $cc -P - <testcpp.c >testcpp.out 2>&1; \
3346         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3347         echo "At long last!"
3348         x_cpp="$cc -P"
3349         x_minus='-';
3350 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
3351         $cpp <testcpp.c >testcpp.out 2>&1; \
3352         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3353         echo "It works!"
3354         x_cpp="$cpp"
3355         x_minus='';
3356 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
3357         $cpp - <testcpp.c >testcpp.out 2>&1; \
3358         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3359         echo "Hooray, it works!  I was beginning to wonder."
3360         x_cpp="$cpp"
3361         x_minus='-';
3362 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
3363         $wrapper <testcpp.c >testcpp.out 2>&1; \
3364         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3365         x_cpp="$wrapper"
3366         x_minus=''
3367         echo "Eureka!"
3368 else
3369         dflt=''
3370         rp="No dice.  I can't find a C preprocessor.  Name one:"
3371         . ./myread
3372         x_cpp="$ans"
3373         x_minus=''
3374         $x_cpp <testcpp.c >testcpp.out 2>&1
3375         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3376                 echo "OK, that will do." >&4
3377         else
3378 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
3379                 exit 1
3380         fi
3381 fi
3382
3383 case "$ok" in
3384 false)
3385         cppstdin="$x_cpp"
3386         cppminus="$x_minus"
3387         cpprun="$x_cpp"
3388         cpplast="$x_minus"
3389         set X $x_cpp
3390         shift
3391         case "$1" in
3392         "$cpp")
3393                 echo "Perhaps can we force $cc -E using a wrapper..."
3394                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
3395                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3396                 then
3397                         echo "Yup, we can."
3398                         cppstdin="$wrapper"
3399                         cppminus='';
3400                 else
3401                         echo "Nope, we'll have to live without it..."
3402                 fi
3403                 ;;
3404         esac
3405         case "$cpprun" in
3406         "$wrapper")
3407                 cpprun=''
3408                 cpplast=''
3409                 ;;
3410         esac
3411         ;;
3412 esac
3413
3414 case "$cppstdin" in
3415 "$wrapper"|'cppstdin') ;;
3416 *) $rm -f $wrapper;;
3417 esac
3418 $rm -f testcpp.c testcpp.out
3419
3420 : decide how portable to be.  Allow command line overrides.
3421 case "$d_portable" in
3422 "$undef") ;;
3423 *)      d_portable="$define" ;;
3424 esac
3425
3426 : set up shell script to do ~ expansion
3427 cat >filexp <<EOSS
3428 $startsh
3429 : expand filename
3430 case "\$1" in
3431  ~/*|~)
3432         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3433         ;;
3434  ~*)
3435         if $test -f /bin/csh; then
3436                 /bin/csh -f -c "glob \$1"
3437                 failed=\$?
3438                 echo ""
3439                 exit \$failed
3440         else
3441                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3442                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3443                 if $test ! -d "\$dir"; then
3444                         me=\`basename \$0\`
3445                         echo "\$me: can't locate home directory for: \$name" >&2
3446                         exit 1
3447                 fi
3448                 case "\$1" in
3449                 */*)
3450                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3451                         ;;
3452                 *)
3453                         echo \$dir
3454                         ;;
3455                 esac
3456         fi
3457         ;;
3458 *)
3459         echo \$1
3460         ;;
3461 esac
3462 EOSS
3463 chmod +x filexp
3464 $eunicefix filexp
3465
3466 : now set up to get a file name
3467 cat <<EOS >getfile
3468 $startsh
3469 EOS
3470 cat <<'EOSC' >>getfile
3471 tilde=''
3472 fullpath=''
3473 already=''
3474 skip=''
3475 none_ok=''
3476 exp_file=''
3477 nopath_ok=''
3478 orig_rp="$rp"
3479 orig_dflt="$dflt"
3480 case "$gfpth" in
3481 '') gfpth='.' ;;
3482 esac
3483
3484 case "$fn" in
3485 *\(*)
3486         expr $fn : '.*(\(.*\)).*' | tr ',' $trnl >getfile.ok
3487         fn=`echo $fn | sed 's/(.*)//'`
3488         ;;
3489 esac
3490
3491 case "$fn" in
3492 *:*)
3493         loc_file=`expr $fn : '.*:\(.*\)'`
3494         fn=`expr $fn : '\(.*\):.*'`
3495         ;;
3496 esac
3497
3498 case "$fn" in
3499 *~*) tilde=true;;
3500 esac
3501 case "$fn" in
3502 */*) fullpath=true;;
3503 esac
3504 case "$fn" in
3505 *+*) skip=true;;
3506 esac
3507 case "$fn" in
3508 *n*) none_ok=true;;
3509 esac
3510 case "$fn" in
3511 *e*) exp_file=true;;
3512 esac
3513 case "$fn" in
3514 *p*) nopath_ok=true;;
3515 esac
3516
3517 case "$fn" in
3518 *f*) type='File';;
3519 *d*) type='Directory';;
3520 *l*) type='Locate';;
3521 esac
3522
3523 what="$type"
3524 case "$what" in
3525 Locate) what='File';;
3526 esac
3527
3528 case "$exp_file" in
3529 '')
3530         case "$d_portable" in
3531         "$define") ;;
3532         *) exp_file=true;;
3533         esac
3534         ;;
3535 esac
3536
3537 cd ..
3538 while test "$type"; do
3539         redo=''
3540         rp="$orig_rp"
3541         dflt="$orig_dflt"
3542         case "$tilde" in
3543         true) rp="$rp (~name ok)";;
3544         esac
3545         . UU/myread
3546         if test -f UU/getfile.ok && \
3547                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3548         then
3549                 value="$ans"
3550                 ansexp="$ans"
3551                 break
3552         fi
3553         case "$ans" in
3554         none)
3555                 value=''
3556                 ansexp=''
3557                 case "$none_ok" in
3558                 true) type='';;
3559                 esac
3560                 ;;
3561         *)
3562                 case "$tilde" in
3563                 '') value="$ans"
3564                         ansexp="$ans";;
3565                 *)
3566                         value=`UU/filexp $ans`
3567                         case $? in
3568                         0)
3569                                 if test "$ans" != "$value"; then
3570                                         echo "(That expands to $value on this system.)"
3571                                 fi
3572                                 ;;
3573                         *) value="$ans";;
3574                         esac
3575                         ansexp="$value"
3576                         case "$exp_file" in
3577                         '') value="$ans";;
3578                         esac
3579                         ;;
3580                 esac
3581                 case "$fullpath" in
3582                 true)
3583                         case "$ansexp" in
3584                         /*) value="$ansexp" ;;
3585                         [a-zA-Z]:/*) value="$ansexp" ;;
3586                         *)
3587                                 redo=true
3588                                 case "$already" in
3589                                 true)
3590                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
3591                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
3592                                         ;;
3593                                 *)
3594                                 echo "Please give a full path name, starting with slash." >&4
3595                                         case "$tilde" in
3596                                         true)
3597                                 echo "Note that using ~name is ok provided it expands well." >&4
3598                                                 already=true
3599                                                 ;;
3600                                         esac
3601                                 esac
3602                                 ;;
3603                         esac
3604                         ;;
3605                 esac
3606                 case "$redo" in
3607                 '')
3608                         case "$type" in
3609                         File)
3610                                 for fp in $gfpth; do
3611                                         if test "X$fp" = X.; then
3612                                             pf="$ansexp"
3613                                         else    
3614                                             pf="$fp/$ansexp"
3615                                         fi
3616                                         if test -f "$pf"; then
3617                                                 type=''
3618                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3619                                         then
3620                                                 echo "($value is not a plain file, but that's ok.)"
3621                                                 type=''
3622                                         fi
3623                                         if test X"$type" = X; then
3624                                             value="$pf"
3625                                             break
3626                                         fi
3627                                 done
3628                                 ;;
3629                         Directory)
3630                                 for fp in $gfpth; do
3631                                         if test "X$fp" = X.; then
3632                                             dir="$ans"
3633                                             direxp="$ansexp"
3634                                         else    
3635                                             dir="$fp/$ansexp"
3636                                             direxp="$fp/$ansexp"
3637                                         fi
3638                                         if test -d "$direxp"; then
3639                                                 type=''
3640                                                 value="$dir"
3641                                                 break
3642                                         fi
3643                                 done
3644                                 ;;
3645                         Locate)
3646                                 if test -d "$ansexp"; then
3647                                         echo "(Looking for $loc_file in directory $value.)"
3648                                         value="$value/$loc_file"
3649                                         ansexp="$ansexp/$loc_file"
3650                                 fi
3651                                 if test -f "$ansexp"; then
3652                                         type=''
3653                                 fi
3654                                 case "$nopath_ok" in
3655                                 true)   case "$value" in
3656                                         */*) ;;
3657                                         *)      echo "Assuming $value will be in people's path."
3658                                                 type=''
3659                                                 ;;
3660                                         esac
3661                                         ;;
3662                                 esac
3663                                 ;;
3664                         esac
3665
3666                         case "$skip" in
3667                         true) type='';
3668                         esac
3669
3670                         case "$type" in
3671                         '') ;;
3672                         *)
3673                                 if test "$fastread" = yes; then
3674                                         dflt=y
3675                                 else
3676                                         dflt=n
3677                                 fi
3678                                 rp="$what $value doesn't exist.  Use that name anyway?"
3679                                 . UU/myread
3680                                 dflt=''
3681                                 case "$ans" in
3682                                 y*) type='';;
3683                                 *) echo " ";;
3684                                 esac
3685                                 ;;
3686                         esac
3687                         ;;
3688                 esac
3689                 ;;
3690         esac
3691 done
3692 cd UU
3693 ans="$value"
3694 rp="$orig_rp"
3695 dflt="$orig_dflt"
3696 rm -f getfile.ok
3697 test "X$gfpthkeep" != Xy && gfpth=""
3698 EOSC
3699
3700 : What should the include directory be ?
3701 echo " "
3702 $echo $n "Hmm...  $c"
3703 dflt='/usr/include'
3704 incpath=''
3705 mips_type=''
3706 if $test -f /bin/mips && /bin/mips; then
3707         echo "Looks like a MIPS system..."
3708         $cat >usr.c <<'EOCP'
3709 #ifdef SYSTYPE_BSD43
3710 /bsd43
3711 #endif
3712 EOCP
3713         if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
3714                 dflt='/bsd43/usr/include'
3715                 incpath='/bsd43'
3716                 mips_type='BSD 4.3'
3717         else
3718                 mips_type='System V'
3719         fi
3720         $rm -f usr.c usr.out
3721         echo "and you're compiling with the $mips_type compiler and libraries."
3722         xxx_prompt=y
3723         echo "exit 0" >mips
3724 else
3725         echo "Doesn't look like a MIPS system."
3726         xxx_prompt=n
3727         echo "exit 1" >mips
3728 fi
3729 chmod +x mips
3730 $eunicefix mips
3731 case "$usrinc" in
3732 '') ;;
3733 *) dflt="$usrinc";;
3734 esac
3735 case "$xxx_prompt" in
3736 y)      fn=d/
3737         echo " "
3738         rp='Where are the include files you want to use?'
3739         . ./getfile
3740         usrinc="$ans"
3741         ;;
3742 *)      usrinc="$dflt"
3743         ;;
3744 esac
3745
3746 : Set private lib path
3747 case "$plibpth" in
3748 '') if ./mips; then
3749                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
3750         fi;;
3751 esac
3752 case "$libpth" in
3753 ' ') dlist='';;
3754 '') dlist="$loclibpth $plibpth $glibpth";;
3755 *) dlist="$libpth";;
3756 esac
3757
3758 : Now check and see which directories actually exist, avoiding duplicates
3759 libpth=''
3760 for xxx in $dlist
3761 do
3762     if $test -d $xxx; then
3763                 case " $libpth " in
3764                 *" $xxx "*) ;;
3765                 *) libpth="$libpth $xxx";;
3766                 esac
3767     fi
3768 done
3769 $cat <<'EOM'
3770
3771 Some systems have incompatible or broken versions of libraries.  Among
3772 the directories listed in the question below, please remove any you
3773 know not to be holding relevant libraries, and add any that are needed.
3774 Say "none" for none.
3775
3776 EOM
3777 case "$libpth" in
3778 '') dflt='none';;
3779 *)
3780         set X $libpth
3781         shift
3782         dflt=${1+"$@"}
3783         ;;
3784 esac
3785 rp="Directories to use for library searches?"
3786 . ./myread
3787 case "$ans" in
3788 none) libpth=' ';;
3789 *) libpth="$ans";;
3790 esac
3791
3792 : compute shared library extension
3793 case "$so" in
3794 '')
3795         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
3796                 dflt='sl'
3797         else
3798                 dflt='so'
3799         fi
3800         ;;
3801 *) dflt="$so";;
3802 esac
3803 $cat <<EOM
3804
3805 On some systems, shared libraries may be available.  Answer 'none' if
3806 you want to suppress searching of shared libraries for the remainder
3807 of this configuration.
3808
3809 EOM
3810 rp='What is the file extension used for shared libraries?'
3811 . ./myread
3812 so="$ans"
3813
3814 : Define several unixisms.
3815 : Hints files or command line option can be used to override them.
3816 : The convoluted testing is in case hints files set either the old
3817 : or the new name.
3818 case "$_exe" in
3819 '')     case "$exe_ext" in
3820     '') ;;
3821         *)      _exe="$exe_ext" ;;
3822         esac
3823         ;;
3824 esac
3825 case "$_a" in
3826 '')     case "$lib_ext" in
3827     '') _a='.a';;
3828         *)      _a="$lib_ext" ;;
3829         esac
3830         ;;
3831 esac
3832 case "$_o" in
3833 '') case "$obj_ext" in
3834         '')     _o='.o';;
3835         *)      _o="$obj_ext";;
3836         esac
3837         ;;
3838 esac
3839 case "$p_" in
3840 '') case "$path_sep" in
3841         '')     p_=':';;
3842         *)      p_="$path_sep";;
3843         esac
3844         ;;
3845 esac
3846 exe_ext=$_exe
3847 lib_ext=$_a
3848 obj_ext=$_o
3849 path_sep=$p_
3850
3851 : Which makefile gets called first.  This is used by make depend.
3852 case "$firstmakefile" in
3853 '') firstmakefile='makefile';;
3854 esac
3855
3856 case "$usesocks" in
3857 $define|true|[yY]*)     dflt='y';;
3858 *) dflt='n';;
3859 esac
3860 cat <<EOM
3861
3862 Perl can be built to use the SOCKS proxy protocol library.  To do so,
3863 Configure must be run with -Dusesocks.
3864
3865 If this doesn't make any sense to you, just accept the default '$dflt'.
3866 EOM
3867 rp='Build Perl for SOCKS?'
3868 . ./myread
3869 case "$ans" in
3870 y|Y)    val="$define" ;;     
3871 *)      val="$undef" ;;
3872 esac
3873 set usesocks
3874 eval $setvar
3875
3876 : Looking for optional libraries
3877 echo " "
3878 echo "Checking for optional libraries..." >&4
3879 case "$libs" in
3880 ' '|'') dflt='';;
3881 *) dflt="$libs";;
3882 esac
3883 case "$libswanted" in
3884 '') libswanted='c_s';;
3885 esac
3886 case "$usesocks" in
3887 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
3888 esac
3889 libsfound=''
3890 libsfiles=''
3891 libsdirs=''
3892 libspath=''
3893 for thisdir in $libpth $xlibpth; do
3894   test -d $thisdir && libspath="$libspath $thisdir"
3895 done
3896 for thislib in $libswanted; do
3897         for thisdir in $libspath; do
3898             xxx=''
3899             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
3900                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|tail -1`
3901                 $test -f "$xxx" && eval $libscheck
3902                 $test -f "$xxx" && libstyle=shared
3903             fi
3904             if test ! -f "$xxx"; then
3905                 xxx=$thisdir/lib$thislib.$so
3906                 $test -f "$xxx" && eval $libscheck
3907                 $test -f "$xxx" && libstyle=shared
3908             fi  
3909             if test ! -f "$xxx"; then
3910                 xxx=$thisdir/lib$thislib$_a
3911                 $test -f "$xxx" && eval $libscheck
3912                 $test -f "$xxx" && libstyle=static
3913             fi
3914             if test ! -f "$xxx"; then
3915                 xxx=$thisdir/$thislib$_a
3916                 $test -f "$xxx" && eval $libscheck
3917                 $test -f "$xxx" && libstyle=static
3918             fi
3919             if test ! -f "$xxx"; then
3920                 xxx=$thisdir/lib${thislib}_s$_a
3921                 $test -f "$xxx" && eval $libscheck
3922                 $test -f "$xxx" && libstyle=static
3923                 $test -f "$xxx" && thislib=${thislib}_s
3924             fi
3925             if test ! -f "$xxx"; then
3926                 xxx=$thisdir/Slib$thislib$_a
3927                 $test -f "$xxx" && eval $libscheck
3928                 $test -f "$xxx" && libstyle=static
3929             fi
3930             if $test -f "$xxx"; then
3931                 case "$libstyle" in
3932                 shared) echo "Found -l$thislib (shared)." ;;
3933                 static) echo "Found -l$thislib." ;;
3934                 *)      echo "Found -l$thislib ($libstyle)." ;;
3935                 esac
3936                 case " $dflt " in
3937                 *"-l$thislib "*);;
3938                 *) dflt="$dflt -l$thislib"
3939                    libsfound="$libsfound $xxx"
3940                    yyy=`basename $xxx`
3941                    libsfiles="$libsfiles $yyy"
3942                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
3943                    case " $libsdirs " in
3944                    *" $yyy "*) ;;
3945                    *) libsdirs="$libsdirs $yyy" ;;
3946                    esac
3947                    ;;
3948                 esac
3949                 break
3950             fi  
3951         done
3952         if $test ! -f "$xxx"; then
3953             echo "No -l$thislib."
3954         fi
3955 done
3956 set X $dflt
3957 shift
3958 dflt="$*"
3959 case "$libs" in
3960 '') dflt="$dflt";;
3961 *) dflt="$libs";;
3962 esac
3963 case "$dflt" in
3964 ' '|'') dflt='none';;
3965 esac
3966
3967 $cat <<EOM
3968
3969 In order to compile $package on your machine, a number of libraries
3970 are usually needed.  Include any other special libraries here as well.
3971 Say "none" for none.  The default list is almost always right.
3972 EOM
3973
3974 echo " "
3975 rp="What libraries to use?"
3976 . ./myread
3977 case "$ans" in
3978 none) libs=' ';;
3979 *) libs="$ans";;
3980 esac
3981
3982 : determine optimization, if desired, or use for debug flag also
3983 case "$optimize" in
3984 ' '|$undef) dflt='none';;
3985 '') dflt='-O';;
3986 *) dflt="$optimize";;
3987 esac
3988 $cat <<EOH
3989
3990 By default, $package compiles with the -O flag to use the optimizer.
3991 Alternately, you might want to use the symbolic debugger, which uses
3992 the -g flag (on traditional Unix systems).  Either flag can be
3993 specified here.  To use neither flag, specify the word "none".
3994
3995 EOH
3996 rp="What optimizer/debugger flag should be used?"
3997 . ./myread
3998 optimize="$ans"
3999 case "$optimize" in
4000 'none') optimize=" ";;
4001 esac
4002
4003 dflt=''
4004 : We will not override a previous value, but we might want to
4005 : augment a hint file
4006 case "$hint" in
4007 default|recommended)
4008         case "$gccversion" in
4009         1*) dflt='-fpcc-struct-return' ;;
4010         esac
4011         case "$optimize" in
4012         *-g*) dflt="$dflt -DDEBUGGING";;
4013         esac
4014         case "$gccversion" in
4015         2*) if test -d /etc/conf/kconfig.d &&
4016                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
4017                 then
4018                         dflt="$dflt -posix"
4019                 fi
4020                 ;;
4021         esac
4022         case "$gccversion" in
4023         1*) ;;
4024         2.[0-8]*) ;;
4025         ?*)     echo " "
4026                 echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
4027                 echo 'int main(void) { return 0; }' > gcctest.c
4028                 if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
4029                         echo "Yes, it does." 2>&1
4030                         case "$ccflags" in
4031                         *strict-aliasing*) 
4032                                 echo "Leaving current flags $ccflags alone." 2>&1
4033                                 ;;
4034                         *) dflt="$dflt -fno-strict-aliasing" ;;
4035                         esac
4036                 else
4037                         echo "Nope, it doesn't, but that's ok." 2>&1
4038                 fi
4039                 ;;
4040         esac
4041         ;;
4042 esac
4043
4044 case "$mips_type" in
4045 *BSD*|'') inclwanted="$locincpth $usrinc";;
4046 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
4047 esac
4048 for thisincl in $inclwanted; do
4049         if $test -d $thisincl; then
4050                 if $test x$thisincl != x$usrinc; then
4051                         case "$dflt" in
4052                         *$thisincl*);;
4053                         *) dflt="$dflt -I$thisincl";;
4054                         esac
4055                 fi
4056         fi
4057 done
4058
4059 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
4060         xxx=true;
4061 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
4062         xxx=true;
4063 else
4064         xxx=false;
4065 fi;
4066 if $xxx; then
4067         case "$dflt" in
4068         *$2*);;
4069         *) dflt="$dflt -D$2";;
4070         esac;
4071 fi'
4072
4073 set signal.h LANGUAGE_C; eval $inctest
4074
4075 case "$usesocks" in
4076 $define)
4077         ccflags="$ccflags -DSOCKS"
4078         ;;
4079 esac
4080
4081 case "$hint" in
4082 default|recommended) dflt="$ccflags $dflt" ;;
4083 *) dflt="$ccflags";;
4084 esac
4085
4086 case "$dflt" in
4087 ''|' ') dflt=none;;
4088 esac
4089 $cat <<EOH
4090
4091 Your C compiler may want other flags.  For this question you should include
4092 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
4093 but you should NOT include libraries or ld flags like -lwhatever.  If you
4094 want $package to honor its debug switch, you should include -DDEBUGGING here.
4095 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
4096
4097 To use no flags, specify the word "none".
4098
4099 EOH
4100 set X $dflt
4101 shift
4102 dflt=${1+"$@"}
4103 rp="Any additional cc flags?"
4104 . ./myread
4105 case "$ans" in
4106 none) ccflags='';;
4107 *) ccflags="$ans";;
4108 esac
4109
4110 : the following weeds options from ccflags that are of no interest to cpp
4111 cppflags="$ccflags"
4112 case "$gccversion" in
4113 1*) cppflags="$cppflags -D__GNUC__"
4114 esac
4115 case "$mips_type" in
4116 '');;
4117 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
4118 esac
4119 case "$cppflags" in
4120 '');;
4121 *)
4122         echo " "
4123         echo "Let me guess what the preprocessor flags are..." >&4
4124         set X $cppflags
4125         shift
4126         cppflags=''
4127         $cat >cpp.c <<'EOM'
4128 #define BLURFL foo
4129
4130 BLURFL xx LFRULB
4131 EOM
4132         previous=''
4133         for flag in $*
4134         do
4135                 case "$flag" in
4136                 -*) ftry="$flag";;
4137                 *) ftry="$previous $flag";;
4138                 esac
4139                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
4140                         >cpp1.out 2>/dev/null && \
4141                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
4142                         >cpp2.out 2>/dev/null && \
4143                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
4144                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
4145                 then
4146                         cppflags="$cppflags $ftry"
4147                         previous=''
4148                 else
4149                         previous="$flag"
4150                 fi
4151         done
4152         set X $cppflags
4153         shift
4154         cppflags=${1+"$@"}
4155         case "$cppflags" in
4156         *-*)  echo "They appear to be: $cppflags";;
4157         esac
4158         $rm -f cpp.c cpp?.out
4159         ;;
4160 esac
4161
4162 : flags used in final linking phase
4163 case "$ldflags" in
4164 '') if ./venix; then
4165                 dflt='-i -z'
4166         else
4167                 dflt=''
4168         fi
4169         case "$ccflags" in
4170         *-posix*) dflt="$dflt -posix" ;;
4171         esac
4172         ;;
4173 *) dflt="$ldflags";;
4174 esac
4175
4176 : Try to guess additional flags to pick up local libraries.
4177 for thislibdir in $libpth; do
4178         case " $loclibpth " in
4179         *" $thislibdir "*)
4180                 case "$dflt " in 
4181                 *"-L$thislibdir "*) ;;
4182                 *)  dflt="$dflt -L$thislibdir" ;;
4183                 esac
4184                 ;;
4185         esac
4186 done
4187
4188 case "$dflt" in
4189 '') dflt='none' ;;
4190 esac
4191
4192 $cat <<EOH
4193
4194 Your C linker may need flags.  For this question you should
4195 include -L/whatever and any other flags used by the C linker, but you
4196 should NOT include libraries like -lwhatever.
4197
4198 Make sure you include the appropriate -L/path flags if your C linker
4199 does not normally search all of the directories you specified above,
4200 namely
4201         $libpth
4202 To use no flags, specify the word "none".
4203
4204 EOH
4205
4206 rp="Any additional ld flags (NOT including libraries)?"
4207 . ./myread
4208 case "$ans" in
4209 none) ldflags='';;
4210 *) ldflags="$ans";;
4211 esac
4212 rmlist="$rmlist pdp11"
4213
4214 : coherency check
4215 echo " "
4216 echo "Checking your choice of C compiler and flags for coherency..." >&4
4217 $cat > try.c <<'EOF'
4218 #include <stdio.h>
4219 int main() { printf("Ok\n"); exit(0); }
4220 EOF
4221 set X $cc $optimize $ccflags -o try $ldflags try.c $libs
4222 shift
4223 $cat >try.msg <<'EOM'
4224 I've tried to compile and run the following simple program:
4225
4226 EOM
4227 $cat try.c >> try.msg
4228
4229 $cat >> try.msg <<EOM
4230
4231 I used the command:
4232
4233         $*
4234         ./try
4235
4236 and I got the following output:
4237
4238 EOM
4239 dflt=y
4240 if sh -c "$cc $optimize $ccflags -o try $ldflags try.c $libs" >>try.msg 2>&1; then
4241         if sh -c './try' >>try.msg 2>&1; then
4242                 xxx=`./try`
4243                 case "$xxx" in
4244                 "Ok") dflt=n ;;
4245                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
4246                         case " $libs " in
4247                         *" -lsfio "*)
4248                                 cat >> try.msg <<'EOQS'
4249 If $libs contains -lsfio, and sfio is mis-configured, then it
4250 sometimes (apparently) runs and exits with a 0 status, but with no
4251 output!  It may have to do with sfio's use of _exit vs. exit.
4252
4253 EOQS
4254                                 rp="You have a big problem.  Shall I abort Configure"
4255                                 dflt=y
4256                                 ;;
4257                         esac
4258                         ;;
4259                 esac
4260         else
4261                 echo "The program compiled OK, but exited with status $?." >>try.msg
4262                 rp="You have a problem.  Shall I abort Configure"
4263                 dflt=y
4264         fi
4265 else
4266         echo "I can't compile the test program." >>try.msg
4267         rp="You have a BIG problem.  Shall I abort Configure"
4268         dflt=y
4269 fi
4270 case "$dflt" in
4271 y)
4272         $cat try.msg >&4
4273         case "$knowitall" in
4274         '')
4275                 echo "(The supplied flags or libraries might be incorrect.)"
4276                 ;;
4277         *) dflt=n;;
4278         esac
4279         echo " "
4280         . ./myread
4281         case "$ans" in
4282         n*|N*) ;;
4283         *)      echo "Ok.  Stopping Configure." >&4
4284                 exit 1
4285                 ;;
4286         esac
4287         ;;
4288 n) echo "OK, that should do.";;
4289 esac
4290 $rm -f try try.* core
4291
4292 : define an is-a-typedef? function
4293 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
4294 case "$inclist" in
4295 "") inclist="sys/types.h";;
4296 esac;
4297 eval "varval=\$$var";
4298 case "$varval" in
4299 "")
4300         $rm -f temp.c;
4301         for inc in $inclist; do
4302                 echo "#include <$inc>" >>temp.c;
4303         done;
4304         echo "#ifdef $type" >> temp.c;
4305         echo "printf(\"We have $type\");" >> temp.c;
4306         echo "#endif" >> temp.c;
4307         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
4308         if $contains $type temp.E >/dev/null 2>&1; then
4309                 eval "$var=\$type";
4310         else
4311                 eval "$var=\$def";
4312         fi;
4313         $rm -f temp.?;;
4314 *) eval "$var=\$varval";;
4315 esac'
4316
4317 : define an is-a-typedef? function that prompts if the type is not available.
4318 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
4319 case "$inclist" in
4320 "") inclist="sys/types.h";;
4321 esac;
4322 eval "varval=\$$var";
4323 case "$varval" in
4324 "")
4325         $rm -f temp.c;
4326         for inc in $inclist; do
4327                 echo "#include <$inc>" >>temp.c;
4328         done;
4329         echo "#ifdef $type" >> temp.c;
4330         echo "printf(\"We have $type\");" >> temp.c;
4331         echo "#endif" >> temp.c;
4332         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
4333         echo " " ;
4334         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
4335         if $contains $type temp.E >/dev/null 2>&1; then
4336                 echo "$type found." >&4;
4337                 eval "$var=\$type";
4338         else
4339                 echo "$type NOT found." >&4;
4340                 dflt="$def";
4341                 . ./myread ;
4342                 eval "$var=\$ans";
4343         fi;
4344         $rm -f temp.?;;
4345 *) eval "$var=\$varval";;
4346 esac'
4347
4348 : define a shorthand compile call
4349 compile='
4350 mc_file=$1;
4351 shift;
4352 $cc $optimize $ccflags $ldflags -o ${mc_file} $* ${mc_file}.c $libs > /dev/null 2>&1;'
4353 : define a shorthand compile call for compilations that should be ok.
4354 compile_ok='
4355 mc_file=$1;
4356 shift;
4357 $cc $optimize $ccflags $ldflags -o ${mc_file} $* ${mc_file}.c $libs;'
4358
4359 : check for lengths of integral types
4360 echo " "
4361 case "$intsize" in
4362 '')
4363         echo "Checking to see how big your integers are..." >&4
4364         $cat >intsize.c <<'EOCP'
4365 #include <stdio.h>
4366 int main()
4367 {
4368         printf("intsize=%d;\n", (int)sizeof(int));
4369         printf("longsize=%d;\n", (int)sizeof(long));
4370         printf("shortsize=%d;\n", (int)sizeof(short));
4371         exit(0);
4372 }
4373 EOCP
4374         set intsize
4375         if eval $compile_ok && ./intsize > /dev/null; then
4376                 eval `./intsize`
4377                 echo "Your integers are $intsize bytes long."
4378                 echo "Your long integers are $longsize bytes long."
4379                 echo "Your short integers are $shortsize bytes long."
4380         else
4381                 $cat >&4 <<EOM
4382 !
4383 Help! I can't compile and run the intsize test program: please enlighten me!
4384 (This is probably a misconfiguration in your system or libraries, and
4385 you really ought to fix it.  Still, I'll try anyway.)
4386 !
4387 EOM
4388                 dflt=4
4389                 rp="What is the size of an integer (in bytes)?"
4390                 . ./myread
4391                 intsize="$ans"
4392                 dflt=$intsize
4393                 rp="What is the size of a long integer (in bytes)?"
4394                 . ./myread
4395                 longsize="$ans"
4396                 dflt=2
4397                 rp="What is the size of a short integer (in bytes)?"
4398                 . ./myread
4399                 shortsize="$ans"
4400         fi
4401         ;;
4402 esac
4403 $rm -f intsize intsize.*
4404
4405 : see what type lseek is declared as in the kernel
4406 rp="What is the type used for lseek's offset on this system?"
4407 set off_t lseektype long stdio.h sys/types.h
4408 eval $typedef_ask
4409
4410 echo " "
4411 echo "Checking to see how big your file offsets are..." >&4
4412 $cat >try.c <<EOCP
4413 #include <sys/types.h>
4414 #include <stdio.h>
4415 int main()
4416 {
4417     printf("%d\n", (int)sizeof($lseektype));
4418     return(0); 
4419 }
4420 EOCP
4421 set try
4422 if eval $compile_ok; then
4423         lseeksize=`./try`
4424         echo "Your file offsets are $lseeksize bytes long."
4425 else
4426         dflt=$longsize
4427         echo " "
4428         echo "(I can't seem to compile the test program.  Guessing...)"
4429         rp="What is the size of your file offsets (in bytes)?"
4430         . ./myread
4431         lseeksize="$ans"
4432 fi
4433 $rm -f try.c try
4434
4435 : see what type file positions are declared as in the library
4436 rp="What is the type for file position used by fsetpos()?"
4437 set fpos_t fpostype long stdio.h sys/types.h
4438 eval $typedef_ask
4439
4440 echo " "
4441 case "$fpostype" in
4442 *_t) zzz="$fpostype"    ;;
4443 *)   zzz="fpos_t"       ;;
4444 esac
4445 echo "Checking the size of $zzz..." >&4 
4446 cat > try.c <<EOCP
4447 #include <sys/types.h>
4448 #include <stdio.h>
4449 int main() {
4450     printf("%d\n", (int)sizeof($fpostype));
4451     exit(0);
4452 }
4453 EOCP
4454 set try
4455 if eval $compile_ok; then
4456         yyy=`./try`
4457         case "$yyy" in
4458         '')     fpossize=4
4459                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
4460                 ;;
4461         *)      fpossize=$yyy
4462                 echo "Your $zzz is $fpossize bytes long."
4463                 ;;
4464         esac
4465 else
4466         dflt="$longsize"
4467         echo " " >&4
4468         echo "(I can't compile the test program.  Guessing...)" >&4
4469         rp="What is the size of your file positions (in bytes)?"
4470         . ./myread
4471         fpossize="$ans"
4472 fi
4473
4474
4475
4476 # Backward compatibility (uselfs is deprecated).
4477 case "$uselfs" in
4478 "$define"|true|[yY]*)
4479         cat <<EOM >&4
4480
4481 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
4482 EOM
4483         uselargefiles="$define"
4484         ;;
4485 esac                          
4486
4487 case "$lseeksize:$fpossize" in
4488 8:8) cat <<EOM
4489
4490 You can have files larger than 2 gigabytes.
4491 EOM
4492    val="$define" ;;
4493 *)    case "$uselargefiles" in
4494    "$undef"|false|[nN]*) dflt='n' ;;
4495    *)   dflt='y' ;;
4496    esac
4497    cat <<EOM
4498
4499 Perl can be built to understand large files (files larger than 2 gigabytes)
4500 on some systems.  To do so, Configure can be run with -Duselargefiles.
4501
4502 If this doesn't make any sense to you, just accept the default '$dflt'.
4503 EOM
4504    rp='Try to understand large files, if available?'
4505    . ./myread
4506    case "$ans" in
4507    y|Y)         val="$define" ;;
4508    *)           val="$undef"  ;;
4509    esac
4510    ;;
4511 esac
4512 set uselargefiles
4513 eval $setvar
4514 case "$uselargefiles" in
4515 "$define")
4516 : Look for a hint-file generated 'call-back-unit'.  If the
4517 : user has specified that a large files perl is to be built,
4518 : we may need to set or change some other defaults.
4519         if $test -f uselargefiles.cbu; then
4520                 echo "Your platform has some specific hints for large file builds, using them..."
4521                 . ./uselargefiles.cbu
4522                 echo " "
4523                 echo "Rechecking to see how big your file offsets are..." >&4
4524                 $cat >try.c <<EOCP
4525 #include <sys/types.h>
4526 #include <stdio.h>
4527 int main()
4528 {
4529     printf("%d\n", (int)sizeof($lseektype));
4530     return(0); 
4531 }
4532 EOCP
4533                 set try
4534                 if eval $compile_ok; then
4535                         lseeksize=`./try`
4536                         $echo "Your file offsets are now $lseeksize bytes long."
4537                 else
4538                         dflt="$lseeksize"
4539                         echo " "
4540                         echo "(I can't seem to compile the test program.  Guessing...)"
4541                         rp="What is the size of your file offsets (in bytes)?"
4542                         . ./myread
4543                         lseeksize="$ans"
4544                 fi
4545                 case "$fpostype" in
4546                 *_t) zzz="$fpostype"    ;;
4547                 *)   zzz="fpos_t"       ;;
4548                 esac
4549                 $echo $n "Rechecking the size of $zzz...$c" >&4 
4550                 $cat > try.c <<EOCP
4551 #include <sys/types.h>
4552 #include <stdio.h>
4553 int main() {
4554     printf("%d\n", (int)sizeof($fpostype));
4555     exit(0);
4556 }
4557 EOCP
4558                 set try
4559                 if eval $compile_ok; then
4560                         yyy=`./try`
4561                         dflt="$lseeksize"
4562                         case "$yyy" in
4563                         '')     echo " "
4564                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
4565                                 ;;
4566                         *)      fpossize=$yyy
4567                                 echo " $fpossize bytes." >&4
4568                                 ;;
4569                         esac
4570                 else
4571                         dflt="$fpossize"
4572                         echo " "
4573                         echo "(I can't compile the test program.  Guessing...)" >&4
4574                         rp="What is the size of your file positions (in bytes)?"
4575                         . ./myread
4576                         fpossize="$ans"
4577                 fi
4578                 $rm -f try.c try
4579         fi
4580         ;;
4581 esac
4582
4583
4584 case "$usemorebits" in
4585 "$define"|true|[yY]*)
4586         use64bitint="$define"
4587         uselongdouble="$define"
4588         usemorebits="$define"
4589         ;;
4590 *)      usemorebits="$undef"
4591         ;;
4592 esac
4593
4594
4595 case "$uselonglong" in
4596 "$define"|true|[yY]*)
4597         cat <<EOM >&4
4598
4599 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
4600 EOM
4601         use64bitint="$define"
4602         ;;
4603 esac                          
4604 case "$use64bits" in
4605 "$define"|true|[yY]*)
4606         cat <<EOM >&4
4607
4608 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
4609 EOM
4610         use64bitint="$define"
4611         ;;
4612 esac                          
4613 case "$use64bitints" in
4614 "$define"|true|[yY]*)
4615         cat <<EOM >&4
4616
4617 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
4618 EOM
4619         use64bitint="$define"
4620         ;;
4621 esac                          
4622 case "$use64bitsint" in
4623 "$define"|true|[yY]*)
4624         cat <<EOM >&4
4625
4626 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
4627 EOM
4628         use64bitint="$define"
4629         ;;
4630 esac                          
4631 case "$uselonglongs" in
4632 "$define"|true|[yY]*)
4633         cat <<EOM >&4
4634
4635 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
4636 EOM
4637         use64bitint="$define"
4638         ;;
4639 esac                          
4640 case "$use64bitsall" in
4641 "$define"|true|[yY]*)
4642         cat <<EOM >&4
4643
4644 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
4645 EOM
4646         use64bitall="$define"
4647         ;;
4648 esac                          
4649
4650 case "$ccflags" in
4651 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
4652 esac
4653 case "$use64bitall" in
4654 "$define"|true|[yY]*) use64bitint="$define" ;;
4655 esac
4656
4657 case "$longsize" in
4658 8) cat <<EOM
4659
4660 You have natively 64-bit long integers.
4661 EOM
4662    val="$define"
4663    ;;
4664 *) case "$use64bitint" in
4665    "$define"|true|[yY]*) dflt='y';;
4666    *) dflt='n';;
4667    esac
4668    cat <<EOM
4669
4670 Perl can be built to take advantage of 64-bit integer types
4671 on some systems.  To do so, Configure can be run with -Duse64bitint.
4672 Choosing this option will most probably introduce binary incompatibilities.
4673
4674 If this doesn't make any sense to you, just accept the default '$dflt'.
4675 EOM
4676    rp='Try to use 64-bit integers, if available?'
4677    . ./myread
4678    case "$ans" in
4679    [yY]*) val="$define" ;;
4680    *)     val="$undef"  ;;
4681    esac
4682    ;;
4683 esac
4684 set use64bitint
4685 eval $setvar
4686
4687 case "$use64bitall" in
4688 "$define"|true|[yY]*) dflt='y' ;;
4689 *) case "$longsize" in
4690    8) dflt='y' ;;
4691    *) dflt='n' ;;
4692    esac
4693    ;;
4694 esac    
4695 cat <<EOM
4696
4697 You may also choose to try maximal 64-bitness.  It means using as much
4698 64-bitness as possible on the platform.  This in turn means even more
4699 binary incompatibilities.  On the other hand, your platform may not
4700 have any more 64-bitness available than what you already have chosen.
4701
4702 If this doesn't make any sense to you, just accept the default '$dflt'.
4703 EOM
4704 rp='Try to use maximal 64-bit support, if available?'
4705 . ./myread
4706 case "$ans" in
4707 [yY]*) val="$define" ;;
4708 *)     val="$undef"  ;;
4709 esac
4710 set use64bitall
4711 eval $setvar
4712 case "$use64bitall" in
4713 "$define")
4714         case "$use64bitint" in
4715         "$undef")
4716                 cat <<EOM
4717
4718 Since you have chosen a maximally 64-bit build, I'm also turning on
4719 the use of 64-bit integers.
4720 EOM
4721                 use64bitint="$define" ;;
4722         esac
4723         ;;
4724 esac
4725
4726 case "$use64bitint" in
4727 "$define"|true|[yY]*)
4728 : Look for a hint-file generated 'call-back-unit'.  If the
4729 : user has specified that a 64-bit perl is to be built,
4730 : we may need to set or change some other defaults.
4731         if $test -f use64bitint.cbu; then
4732                 echo "Your platform has some specific hints for 64-bit integers, using them..."
4733                 . ./use64bitint.cbu
4734         fi
4735         case "$longsize" in
4736         4) case "$archname64" in
4737            '') archname64=64int ;;
4738            esac
4739            ;;
4740         esac
4741         ;;
4742 esac
4743
4744 case "$use64bitall" in
4745 "$define"|true|[yY]*)
4746 : Look for a hint-file generated 'call-back-unit'.  If the
4747 : user has specified that a maximally 64-bit perl is to be built,
4748 : we may need to set or change some other defaults.
4749         if $test -f use64bitall.cbu; then
4750                 echo "Your platform has some specific hints for 64-bit builds, using them..."
4751                 . ./use64bitall.cbu
4752         fi
4753         case "$longsize" in
4754         4) case "$archname64" in
4755            ''|64int) archname64=64all ;;
4756            esac
4757            ;;
4758         esac
4759         ;;
4760 esac
4761
4762 echo " "
4763 echo "Checking for GNU C Library..." >&4
4764 cat >gnulibc.c <<EOM
4765 #include <stdio.h>
4766 int main()
4767 {
4768 #ifdef __GLIBC__
4769     exit(0);
4770 #else
4771     exit(1);
4772 #endif
4773 }
4774 EOM
4775 set gnulibc
4776 if eval $compile_ok && ./gnulibc; then
4777         val="$define"
4778         echo "You are using the GNU C Library"
4779 else
4780         val="$undef"
4781         echo "You are not using the GNU C Library"
4782 fi
4783 $rm -f gnulibc*
4784 set d_gnulibc
4785 eval $setvar
4786
4787 : see if nm is to be used to determine whether a symbol is defined or not
4788 case "$usenm" in
4789 '')
4790         dflt=''
4791         case "$d_gnulibc" in
4792         "$define")
4793                 echo " "
4794                 echo "nm probably won't work on the GNU C Library." >&4
4795                 dflt=n
4796                 ;;
4797         esac
4798         case "$dflt" in
4799         '') 
4800                 if $test "$osname" = aix -a ! -f /lib/syscalls.exp; then
4801                         echo " "
4802                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
4803                         echo "'nm' won't be sufficient on this sytem." >&4
4804                         dflt=n
4805                 fi
4806                 ;;
4807         esac
4808         case "$dflt" in
4809         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
4810                 if $test $dflt -gt 20; then
4811                         dflt=y
4812                 else
4813                         dflt=n
4814                 fi
4815                 ;;
4816         esac
4817         ;;
4818 *)
4819         case "$usenm" in
4820         true|$define) dflt=y;;
4821         *) dflt=n;;
4822         esac
4823         ;;
4824 esac
4825 $cat <<EOM
4826
4827 I can use $nm to extract the symbols from your C libraries. This
4828 is a time consuming task which may generate huge output on the disk (up
4829 to 3 megabytes) but that should make the symbols extraction faster. The
4830 alternative is to skip the 'nm' extraction part and to compile a small
4831 test program instead to determine whether each symbol is present. If
4832 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
4833 this may be the best solution.
4834
4835 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
4836
4837 EOM
4838 rp="Shall I use $nm to extract C symbols from the libraries?"
4839 . ./myread
4840 case "$ans" in
4841 [Nn]*) usenm=false;;
4842 *) usenm=true;;
4843 esac
4844
4845 runnm=$usenm
4846 case "$reuseval" in
4847 true) runnm=false;;
4848 esac
4849
4850 : nm options which may be necessary
4851 case "$nm_opt" in
4852 '') if $test -f /mach_boot; then
4853                 nm_opt=''       # Mach
4854         elif $test -d /usr/ccs/lib; then
4855                 nm_opt='-p'     # Solaris (and SunOS?)
4856         elif $test -f /dgux; then
4857                 nm_opt='-p'     # DG-UX
4858         elif $test -f /lib64/rld; then
4859                 nm_opt='-p'     # 64-bit Irix
4860         else
4861                 nm_opt=''
4862         fi;;
4863 esac
4864
4865 : nm options which may be necessary for shared libraries but illegal
4866 : for archive libraries.  Thank you, Linux.
4867 case "$nm_so_opt" in
4868 '')     case "$myuname" in
4869         *linux*)
4870                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
4871                         nm_so_opt='--dynamic'
4872                 fi
4873                 ;;
4874         esac
4875         ;;
4876 esac
4877
4878 case "$runnm" in
4879 true)
4880 : get list of predefined functions in a handy place
4881 echo " "
4882 case "$libc" in
4883 '') libc=unknown
4884         case "$libs" in
4885         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
4886         esac
4887         ;;
4888 esac
4889 libnames='';
4890 case "$libs" in
4891 '') ;;
4892 *)  for thislib in $libs; do
4893         case "$thislib" in
4894         -lc|-lc_s)
4895                 : Handle C library specially below.
4896                 ;;
4897         -l*)
4898                 thislib=`echo $thislib | $sed -e 's/^-l//'`
4899                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
4900                         :
4901                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
4902                         :
4903                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
4904                         :
4905                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
4906                         :
4907                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
4908                         :
4909                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
4910                         :
4911                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
4912                         :
4913                 else
4914                         try=''
4915                 fi
4916                 libnames="$libnames $try"
4917                 ;;
4918         *) libnames="$libnames $thislib" ;;
4919         esac
4920         done
4921         ;;
4922 esac
4923 xxx=normal
4924 case "$libc" in
4925 unknown)
4926         set /lib/libc.$so
4927         for xxx in $libpth; do
4928                 $test -r $1 || set $xxx/libc.$so
4929                 : The messy sed command sorts on library version numbers.
4930                 $test -r $1 || \
4931                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
4932                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
4933                                 h
4934                                 s/[0-9][0-9]*/0000&/g
4935                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
4936                                 G
4937                                 s/\n/ /' | \
4938                          sort | $sed -e 's/^.* //'`
4939                 eval set \$$#
4940         done
4941         $test -r $1 || set /usr/ccs/lib/libc.$so
4942         $test -r $1 || set /lib/libsys_s$_a
4943         ;;
4944 *)
4945         set blurfl
4946         ;;
4947 esac
4948 if $test -r "$1"; then
4949         echo "Your (shared) C library seems to be in $1."
4950         libc="$1"
4951 elif $test -r /lib/libc && $test -r /lib/clib; then
4952         echo "Your C library seems to be in both /lib/clib and /lib/libc."
4953         xxx=apollo
4954         libc='/lib/clib /lib/libc'
4955         if $test -r /lib/syslib; then
4956                 echo "(Your math library is in /lib/syslib.)"
4957                 libc="$libc /lib/syslib"
4958         fi
4959 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
4960         echo "Your C library seems to be in $libc, as you said before."
4961 elif $test -r $incpath/usr/lib/libc$_a; then
4962         libc=$incpath/usr/lib/libc$_a;
4963         echo "Your C library seems to be in $libc.  That's fine."
4964 elif $test -r /lib/libc$_a; then
4965         libc=/lib/libc$_a;
4966         echo "Your C library seems to be in $libc.  You're normal."
4967 else
4968         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
4969                 :
4970         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
4971                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
4972         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
4973                 :
4974         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
4975                 :
4976         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
4977                 :
4978         else
4979                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
4980         fi
4981         if $test -r "$tans"; then
4982                 echo "Your C library seems to be in $tans, of all places."
4983                 libc=$tans
4984         else
4985                 libc='blurfl'
4986         fi
4987 fi
4988 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
4989         dflt="$libc"
4990         cat <<EOM
4991
4992 If the guess above is wrong (which it might be if you're using a strange
4993 compiler, or your machine supports multiple models), you can override it here.
4994
4995 EOM
4996 else
4997         dflt=''
4998         echo $libpth | tr ' ' $trnl | sort | uniq > libpath
4999         cat >&4 <<EOM
5000 I can't seem to find your C library.  I've looked in the following places:
5001
5002 EOM
5003         $sed 's/^/      /' libpath
5004         cat <<EOM
5005
5006 None of these seems to contain your C library. I need to get its name...
5007
5008 EOM
5009 fi
5010 fn=f
5011 rp='Where is your C library?'
5012 . ./getfile
5013 libc="$ans"
5014
5015 echo " "
5016 echo $libc $libnames | tr ' ' $trnl | sort | uniq > libnames
5017 set X `cat libnames`
5018 shift
5019 xxx=files
5020 case $# in 1) xxx=file; esac
5021 echo "Extracting names from the following $xxx for later perusal:" >&4
5022 echo " "
5023 $sed 's/^/      /' libnames >&4
5024 echo " "
5025 $echo $n "This may take a while...$c" >&4
5026
5027 for file in $*; do
5028         case $file in
5029         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
5030         *) $nm $nm_opt $file 2>/dev/null;;
5031         esac
5032 done >libc.tmp
5033
5034 $echo $n ".$c"
5035 $grep fprintf libc.tmp > libc.ptf
5036 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
5037 xrun='eval "<libc.tmp $com >libc.list"; echo "done" >&4'
5038 xxx='[ADTSIW]'
5039 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *_[_.]*//p' -e 's/^.* $xxx  *//p'";\
5040         eval $xscan;\
5041         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5042                 eval $xrun
5043 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
5044         eval $xscan;\
5045         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5046                 eval $xrun
5047 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
5048         eval $xscan;\
5049         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5050                 eval $xrun
5051 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
5052         eval $xscan;\
5053         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5054                 eval $xrun
5055 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
5056         eval $xscan;\
5057         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5058                 eval $xrun
5059 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
5060         eval $xscan;\
5061         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5062                 eval $xrun
5063 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
5064                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
5065         eval $xscan;\
5066         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5067                 eval $xrun
5068 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
5069         eval $xscan;\
5070         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5071                 eval $xrun
5072 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
5073         eval $xscan;\
5074         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5075                 eval $xrun
5076 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
5077         eval $xscan;\
5078         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5079                 eval $xrun
5080 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
5081         eval $xscan;\
5082         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5083                 eval $xrun
5084 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
5085         eval $xscan;\
5086         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5087                 eval $xrun
5088 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
5089         eval $xscan;\
5090         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5091                 eval $xrun
5092 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
5093         eval $xscan;\
5094         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5095                 eval $xrun
5096 else
5097         $nm -p $* 2>/dev/null >libc.tmp
5098         $grep fprintf libc.tmp > libc.ptf
5099         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
5100                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
5101         then
5102                 nm_opt='-p'
5103                 eval $xrun
5104         else
5105                 echo " "
5106                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
5107                 com=''
5108                 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
5109                         for thisname in $libnames $libc; do
5110                                 $ar t $thisname >>libc.tmp
5111                         done
5112                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
5113                         echo "Ok." >&4
5114                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
5115                         # Repeat libc to extract forwarders to DLL entries too
5116                         for thisname in $libnames $libc; do
5117                                 $ar tv $thisname >>libc.tmp
5118                                 # Revision 50 of EMX has bug in $ar.
5119                                 # it will not extract forwarders to DLL entries
5120                                 # Use emximp which will extract exactly them.
5121                                 emximp -o tmp.imp $thisname \
5122                                     2>/dev/null && \
5123                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
5124                                     < tmp.imp >>libc.tmp
5125                                 $rm tmp.imp
5126                         done
5127                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
5128                         echo "Ok." >&4
5129                 else
5130                         echo "$ar didn't seem to work right." >&4
5131                         echo "Maybe this is a Cray...trying bld instead..." >&4
5132                         if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
5133                         then
5134                                 for thisname in $libnames; do
5135                                         bld t $libnames | \
5136                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
5137                                         $ar t $thisname >>libc.tmp
5138                                 done
5139                                 echo "Ok." >&4
5140                         else
5141                                 echo "That didn't work either.  Giving up." >&4
5142                                 exit 1
5143                         fi
5144                 fi
5145         fi
5146 fi
5147 nm_extract="$com"
5148 if $test -f /lib/syscalls.exp; then
5149         echo " "
5150         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
5151         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*$/\1/p' /lib/syscalls.exp >>libc.list
5152 fi
5153 ;;
5154 esac
5155 $rm -f libnames libpath
5156
5157 : is a C symbol defined?
5158 csym='tlook=$1;
5159 case "$3" in
5160 -v) tf=libc.tmp; tc=""; tdc="";;
5161 -a) tf=libc.tmp; tc="[0]"; tdc="[]";;
5162 *) tlook="^$1\$"; tf=libc.list; tc="()"; tdc="()";;
5163 esac;
5164 tx=yes;
5165 case "$reuseval-$4" in
5166 true-) ;;
5167 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
5168 esac;
5169 case "$tx" in
5170 yes)
5171         case "$runnm" in
5172         true)
5173                 if $contains $tlook $tf >/dev/null 2>&1;
5174                 then tval=true;
5175                 else tval=false;
5176                 fi;;
5177         *)
5178                 echo "int main() { extern short $1$tdc; printf(\"%hd\", $1$tc); }" > t.c;
5179                 if $cc $optimize $ccflags $ldflags -o t t.c $libs >/dev/null 2>&1;
5180                 then tval=true;
5181                 else tval=false;
5182                 fi;
5183                 $rm -f t t.c;;
5184         esac;;
5185 *)
5186         case "$tval" in
5187         $define) tval=true;;
5188         *) tval=false;;
5189         esac;;
5190 esac;
5191 eval "$2=$tval"'
5192
5193 : define an is-in-libc? function
5194 inlibc='echo " "; td=$define; tu=$undef;
5195 sym=$1; var=$2; eval "was=\$$2";
5196 tx=yes;
5197 case "$reuseval$was" in
5198 true) ;;
5199 true*) tx=no;;
5200 esac;
5201 case "$tx" in
5202 yes)
5203         set $sym tres -f;
5204         eval $csym;
5205         case "$tres" in
5206         true)
5207                 echo "$sym() found." >&4;
5208                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
5209         *)
5210                 echo "$sym() NOT found." >&4;
5211                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
5212         esac;;
5213 *)
5214         case "$was" in
5215         $define) echo "$sym() found." >&4;;
5216         *) echo "$sym() NOT found." >&4;;
5217         esac;;
5218 esac'
5219
5220 : see if sqrtl exists
5221 set sqrtl d_sqrtl
5222 eval $inlibc
5223
5224 case "$ccflags" in
5225 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
5226 esac
5227
5228 case "$uselongdouble" in
5229 $define|true|[yY]*)     dflt='y';;
5230 *) dflt='n';;
5231 esac
5232 cat <<EOM
5233
5234 Perl can be built to take advantage of long doubles which
5235 (if available) may give more accuracy and range for floating point numbers.
5236
5237 If this doesn't make any sense to you, just accept the default '$dflt'.
5238 EOM
5239 rp='Try to use long doubles if available?'
5240 . ./myread
5241 case "$ans" in
5242 y|Y)    val="$define"   ;;
5243 *)      val="$undef"    ;;
5244 esac
5245 set uselongdouble
5246 eval $setvar
5247
5248 case "$uselongdouble" in
5249 true|[yY]*) uselongdouble="$define" ;;
5250 esac
5251
5252 case "$uselongdouble" in
5253 $define)
5254 : Look for a hint-file generated 'call-back-unit'.  If the
5255 : user has specified that long doubles should be used,
5256 : we may need to set or change some other defaults.
5257         if $test -f uselongdouble.cbu; then
5258                 echo "Your platform has some specific hints for long doubles, using them..."
5259                 . ./uselongdouble.cbu
5260         else
5261                 $cat <<EOM
5262 (Your platform doesn't have any specific hints for long doubles.)
5263 EOM
5264         fi
5265         ;;
5266 esac
5267
5268 case "$uselongdouble:$d_sqrtl" in
5269 $define:$undef)
5270                 $cat <<EOM >&4
5271
5272 *** You requested the use of long doubles but you do not seem to have
5273 *** the mathematic functions for long doubles.  I'm disabling the use
5274 *** of long doubles.
5275
5276 EOM
5277         uselongdouble=$undef
5278         ;;
5279 esac
5280
5281 : determine the architecture name
5282 echo " "
5283 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
5284         tarch=`arch`"-$osname"
5285 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
5286         if uname -m > tmparch 2>&1 ; then
5287                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
5288                         -e 's/$/'"-$osname/" tmparch`
5289         else
5290                 tarch="$osname"
5291         fi
5292         $rm -f tmparch
5293 else
5294         tarch="$osname"
5295 fi
5296 case "$myarchname" in
5297 ''|"$tarch") ;;
5298 *)
5299         echo "(Your architecture name used to be $myarchname.)"
5300         archname=''
5301         ;;
5302 esac
5303 myarchname="$tarch"
5304 case "$archname" in
5305 '') dflt="$tarch";;
5306 *) dflt="$archname";;
5307 esac
5308 rp='What is your architecture name'
5309 . ./myread
5310 archname="$ans"
5311 case "$usethreads" in
5312 $define)
5313         echo "Threads selected." >&4
5314         case "$archname" in
5315         *-thread*) echo "...and architecture name already has -thread." >&4
5316                 ;;
5317         *)      archname="$archname-thread"
5318                 echo "...setting architecture name to $archname." >&4
5319                 ;;
5320         esac
5321         ;;
5322 esac
5323 case "$usemultiplicity" in
5324 $define)
5325         echo "Multiplicity selected." >&4
5326         case "$archname" in
5327         *-multi*) echo "...and architecture name already has -multi." >&4
5328                 ;;
5329         *)      archname="$archname-multi"
5330                 echo "...setting architecture name to $archname." >&4
5331                 ;;
5332         esac
5333         ;;
5334 esac
5335 case "$use64bitint$use64bitall" in
5336 *"$define"*)
5337         case "$archname64" in
5338         '')
5339                 ;;
5340         *)
5341                 case "$use64bitint" in
5342                 "$define") echo "64 bit integers selected." >&4 ;;
5343                 esac
5344                 case "$use64bitall" in
5345                 "$define") echo "64 bit memory model selected." >&4 ;;
5346                 esac
5347                 case "$archname" in
5348                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
5349                         ;;
5350                 *)      archname="$archname-$archname64"
5351                         echo "...setting architecture name to $archname." >&4
5352                         ;;
5353                 esac
5354                 ;;
5355         esac
5356 esac
5357 case "$uselongdouble" in
5358 $define)
5359         echo "Long doubles selected." >&4
5360         case "$archname" in
5361         *-ld*) echo "...and architecture name already has -ld." >&4
5362                 ;;
5363         *)      archname="$archname-ld"
5364                 echo "...setting architecture name to $archname." >&4
5365                 ;;
5366         esac
5367         ;;
5368 esac
5369
5370 : determine root of directory hierarchy where package will be installed.
5371 case "$prefix" in
5372 '')
5373         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
5374         ;;
5375 *)
5376         dflt="$prefix"
5377         ;;
5378 esac
5379 $cat <<EOM
5380
5381 By default, $package will be installed in $dflt/bin, manual pages
5382 under $dflt/man, etc..., i.e. with $dflt as prefix for all
5383 installation directories. Typically this is something like /usr/local.
5384 If you wish to have binaries under /usr/bin but other parts of the
5385 installation under /usr/local, that's ok: you will be prompted
5386 separately for each of the installation directories, the prefix being
5387 only used to set the defaults.
5388
5389 EOM
5390 fn=d~
5391 rp='Installation prefix to use?'
5392 . ./getfile
5393 oldprefix=''
5394 case "$prefix" in
5395 '') ;;
5396 *)
5397         case "$ans" in
5398         "$prefix") ;;
5399         *) oldprefix="$prefix";;
5400         esac
5401         ;;
5402 esac
5403 prefix="$ans"
5404 prefixexp="$ansexp"
5405
5406 : is AFS running?
5407 echo " "
5408 case "$afs" in
5409 $define|true)   afs=true ;;
5410 $undef|false)   afs=false ;;
5411 *)      if test -d /afs; then
5412                 afs=true
5413         else
5414                 afs=false
5415         fi
5416         ;;
5417 esac
5418 if $afs; then
5419         echo "AFS may be running... I'll be extra cautious then..." >&4
5420 else
5421         echo "AFS does not seem to be running..." >&4
5422 fi
5423
5424 : determine installation prefix for where package is to be installed.
5425 if $afs; then 
5426 $cat <<EOM
5427
5428 Since you are running AFS, I need to distinguish the directory in which
5429 files will reside from the directory in which they are installed (and from
5430 which they are presumably copied to the former directory by occult means).
5431
5432 EOM
5433         case "$installprefix" in
5434         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
5435         *) dflt="$installprefix";;
5436         esac
5437 else
5438 $cat <<EOM
5439
5440 In some special cases, particularly when building $package for distribution,
5441 it is convenient to distinguish between the directory in which files should 
5442 be installed from the directory ($prefix) in which they 
5443 will eventually reside.  For most users, these two directories are the same.
5444
5445 EOM
5446         case "$installprefix" in
5447         '') dflt=$prefix ;;
5448         *) dflt=$installprefix;;
5449         esac
5450 fi
5451 fn=d~
5452 rp='What installation prefix should I use for installing files?'
5453 . ./getfile
5454 installprefix="$ans"
5455 installprefixexp="$ansexp"
5456
5457 : set the prefixit variable, to compute a suitable default value
5458 prefixit='case "$3" in
5459 ""|none)
5460         case "$oldprefix" in
5461         "") eval "$1=\"\$$2\"";;
5462         *)
5463                 case "$3" in
5464                 "") eval "$1=";;
5465                 none)
5466                         eval "tp=\"\$$2\"";
5467                         case "$tp" in
5468                         ""|" ") eval "$1=\"\$$2\"";;
5469                         *) eval "$1=";;
5470                         esac;;
5471                 esac;;
5472         esac;;
5473 *)
5474         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
5475         case "$tp" in
5476         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
5477         /*-$oldprefix/*|\~*-$oldprefix/*)
5478                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
5479         *) eval "$1=\"\$$2\"";;
5480         esac;;
5481 esac'
5482
5483
5484 : get the patchlevel
5485 echo " "
5486 echo "Getting the current patchlevel..." >&4
5487 if $test -r $rsrc/patchlevel.h;then
5488         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
5489         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
5490         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
5491         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
5492         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
5493         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
5494 else
5495         revision=0
5496         patchlevel=0
5497         subversion=0
5498         api_revision=0
5499         api_version=0
5500         api_subversion=0
5501 fi
5502 $echo "(You have $package version $patchlevel subversion $subversion.)"
5503 case "$osname" in
5504 dos|vms)
5505         : XXX Should be a Configure test for double-dots in filenames.
5506         version=`echo $revision $patchlevel $subversion | \
5507                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
5508         api_versionstring=`echo $api_revision $api_version $api_subversion | \
5509                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
5510         ;;
5511 *)
5512         version=`echo $revision $patchlevel $subversion | \
5513                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
5514         api_versionstring=`echo $api_revision $api_version $api_subversion | \
5515                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
5516         ;;
5517 esac
5518 : Special case the 5.005_xx maintenance series, which used 5.005
5519 : without any subversion label as a subdirectory in $sitelib
5520 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
5521         api_versionstring='5.005'
5522 fi
5523
5524 : determine installation style
5525 : For now, try to deduce it from prefix unless it is already set.
5526 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
5527 case "$installstyle" in
5528 '')     case "$prefix" in
5529                 *perl*) dflt='lib';;
5530                 *) dflt='lib/perl5' ;;
5531         esac
5532         ;;
5533 *)      dflt="$installstyle" ;;
5534 esac
5535 : Probably not worth prompting for this since we prompt for all
5536 : the directories individually, and the prompt would be too long and
5537 : confusing anyway.
5538 installstyle=$dflt
5539
5540 : determine where private library files go
5541 : Usual default is /usr/local/lib/perl5/$version.
5542 : Also allow things like /opt/perl/lib/$version, since 
5543 : /opt/perl/lib/perl5... would be redundant.
5544 : The default "style" setting is made in installstyle.U
5545 case "$installstyle" in
5546 *lib/perl5*) set dflt privlib lib/$package/$version ;;
5547 *)       set dflt privlib lib/$version ;;
5548 esac
5549 eval $prefixit
5550 $cat <<EOM
5551
5552 There are some auxiliary files for $package that need to be put into a
5553 private library directory that is accessible by everyone.
5554
5555 EOM
5556 fn=d~+
5557 rp='Pathname where the private library files will reside?'
5558 . ./getfile
5559 privlib="$ans"
5560 privlibexp="$ansexp"
5561 : Change installation prefix, if necessary.
5562 if $test X"$prefix" != X"$installprefix"; then
5563         installprivlib=`echo $privlibexp | sed "s#^$prefix#$installprefix#"`
5564 else
5565         installprivlib="$privlibexp"
5566 fi
5567
5568 : set the prefixup variable, to restore leading tilda escape
5569 prefixup='case "$prefixexp" in
5570 "$prefix") ;;
5571 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
5572 esac'
5573
5574 : determine where public architecture dependent libraries go
5575 set archlib archlib
5576 eval $prefixit
5577 : privlib default is /usr/local/lib/$package/$version
5578 : archlib default is /usr/local/lib/$package/$version/$archname
5579 : privlib may have an optional trailing /share.
5580 tdflt=`echo $privlib | $sed 's,/share$,,'`
5581 tdflt=$tdflt/$archname
5582 case "$archlib" in
5583 '')     dflt=$tdflt
5584         ;;
5585 *)      dflt="$archlib"
5586     ;;
5587 esac
5588 $cat <<EOM
5589
5590 $spackage contains architecture-dependent library files.  If you are
5591 sharing libraries in a heterogeneous environment, you might store
5592 these files in a separate location.  Otherwise, you can just include
5593 them with the rest of the public library files.
5594
5595 EOM
5596 fn=d+~
5597 rp='Where do you want to put the public architecture-dependent libraries?'
5598 . ./getfile
5599 archlib="$ans"
5600 archlibexp="$ansexp"
5601 if $test X"$archlib" = X"$privlib"; then
5602         d_archlib="$undef"
5603 else
5604         d_archlib="$define"
5605 fi
5606 : Change installation prefix, if necessary.
5607 if $test X"$prefix" != X"$installprefix"; then
5608         installarchlib=`echo $archlibexp | sed "s#^$prefix#$installprefix#"`
5609 else
5610         installarchlib="$archlibexp"
5611 fi
5612
5613
5614 : Binary compatibility with 5.005 is not possible for builds
5615 : with advanced features
5616 case "$usethreads$usemultiplicity" in
5617 *define*)
5618         bincompat5005="$undef"
5619         d_bincompat5005="$undef"
5620         ;;
5621 *)      $cat <<EOM
5622
5623 This version of Perl can be compiled for binary compatibility with 5.005.
5624 If you decide to do so, you will be able to continue using most of the
5625 extensions that were compiled for Perl 5.005.
5626
5627 EOM
5628         case "$bincompat5005$d_bincompat5005" in
5629         *"$undef"*) dflt=n ;;
5630         *) dflt=y ;;
5631         esac
5632         rp='Binary compatibility with Perl 5.005?'
5633         . ./myread
5634         case "$ans" in
5635         y*) val="$define" ;;
5636         *)  val="$undef" ;;
5637         esac
5638         set d_bincompat5005
5639         eval $setvar
5640         case "$d_bincompat5005" in
5641         "$define")
5642                 bincompat5005="$define"
5643                 ;;
5644         *)      bincompat5005="$undef"
5645                 d_bincompat5005="$undef"
5646                 ;;
5647         esac
5648         ;;
5649 esac
5650
5651
5652 : see if setuid scripts can be secure
5653 $cat <<EOM
5654
5655 Some kernels have a bug that prevents setuid #! scripts from being
5656 secure.  Some sites have disabled setuid #! scripts because of this.
5657
5658 First let's decide if your kernel supports secure setuid #! scripts.
5659 (If setuid #! scripts would be secure but have been disabled anyway,
5660 don't say that they are secure if asked.)
5661
5662 EOM
5663
5664 val="$undef"
5665 if $test -d /dev/fd; then
5666         echo "#!$ls" >reflect
5667         chmod +x,u+s reflect
5668         ./reflect >flect 2>&1
5669         if $contains "/dev/fd" flect >/dev/null; then
5670                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
5671                 val="$define"
5672         else
5673                 $cat <<EOM
5674 If you are not sure if they are secure, I can check but I'll need a
5675 username and password different from the one you are using right now.
5676 If you don't have such a username or don't want me to test, simply
5677 enter 'none'.
5678
5679 EOM
5680                 rp='Other username to test security of setuid scripts with?'
5681                 dflt='none'
5682                 . ./myread
5683                 case "$ans" in
5684                 n|none)
5685                         case "$d_suidsafe" in
5686                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
5687                                 dflt=n;;
5688                         "$undef")
5689                                 echo "Well, the $hint value is *not* secure." >&4
5690                                 dflt=n;;
5691                         *)      echo "Well, the $hint value *is* secure." >&4
5692                                 dflt=y;;
5693                         esac
5694                         ;;
5695                 *)
5696                         $rm -f reflect flect
5697                         echo "#!$ls" >reflect
5698                         chmod +x,u+s reflect
5699                         echo >flect
5700                         chmod a+w flect
5701                         echo '"su" will (probably) prompt you for '"$ans's password."
5702                         su $ans -c './reflect >flect'
5703                         if $contains "/dev/fd" flect >/dev/null; then
5704                                 echo "Okay, it looks like setuid scripts are secure." >&4
5705                                 dflt=y
5706                         else
5707                                 echo "I don't think setuid scripts are secure." >&4
5708                                 dflt=n
5709                         fi
5710                         ;;
5711                 esac
5712                 rp='Does your kernel have *secure* setuid scripts?'
5713                 . ./myread
5714                 case "$ans" in
5715                 [yY]*)  val="$define";;
5716                 *)      val="$undef";;
5717                 esac
5718         fi
5719 else
5720         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
5721         echo "(That's for file descriptors, not floppy disks.)"
5722         val="$undef"
5723 fi
5724 set d_suidsafe
5725 eval $setvar
5726
5727 $rm -f reflect flect
5728
5729 : now see if they want to do setuid emulation
5730 echo " "
5731 val="$undef"
5732 case "$d_suidsafe" in
5733 "$define")
5734         val="$undef"
5735         echo "No need to emulate SUID scripts since they are secure here." >& 4
5736         ;;
5737 *)
5738         $cat <<EOM
5739 Some systems have disabled setuid scripts, especially systems where
5740 setuid scripts cannot be secure.  On systems where setuid scripts have
5741 been disabled, the setuid/setgid bits on scripts are currently
5742 useless.  It is possible for $package to detect those bits and emulate
5743 setuid/setgid in a secure fashion.  This emulation will only work if
5744 setuid scripts have been disabled in your kernel.
5745
5746 EOM
5747         case "$d_dosuid" in
5748         "$define") dflt=y ;;
5749         *) dflt=n ;;
5750         esac
5751         rp="Do you want to do setuid/setgid emulation?"
5752         . ./myread
5753         case "$ans" in
5754         [yY]*)  val="$define";;
5755         *)      val="$undef";;
5756         esac
5757         ;;
5758 esac
5759 set d_dosuid
5760 eval $setvar
5761
5762 : determine filename position in cpp output
5763 echo " "
5764 echo "Computing filename position in cpp output for #include directives..." >&4
5765 echo '#include <stdio.h>' > foo.c
5766 $cat >fieldn <<EOF
5767 $startsh
5768 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5769 $grep '^[       ]*#.*stdio\.h' | \
5770 while read cline; do
5771         pos=1
5772         set \$cline
5773         while $test \$# -gt 0; do
5774                 if $test -r \`echo \$1 | $tr -d '"'\`; then
5775                         echo "\$pos"
5776                         exit 0
5777                 fi
5778                 shift
5779                 pos=\`expr \$pos + 1\`
5780         done
5781 done
5782 EOF
5783 chmod +x fieldn
5784 fieldn=`./fieldn`
5785 $rm -f foo.c fieldn
5786 case $fieldn in
5787 '') pos='???';;
5788 1) pos=first;;
5789 2) pos=second;;
5790 3) pos=third;;
5791 *) pos="${fieldn}th";;
5792 esac
5793 echo "Your cpp writes the filename in the $pos field of the line."
5794
5795 : locate header file
5796 $cat >findhdr <<EOF
5797 $startsh
5798 wanted=\$1
5799 name=''
5800 for usrincdir in $usrinc
5801 do
5802         if test -f \$usrincdir/\$wanted; then
5803                 echo "\$usrincdir/\$wanted"
5804                 exit 0
5805         fi
5806 done
5807 awkprg='{ print \$$fieldn }'
5808 echo "#include <\$wanted>" > foo\$\$.c
5809 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5810 $grep "^[       ]*#.*\$wanted" | \
5811 while read cline; do
5812         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5813         case "\$name" in
5814         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5815         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5816         *) exit 2;;
5817         esac;
5818 done;
5819 #
5820 # status = 0: grep returned 0 lines, case statement not executed
5821 # status = 1: headerfile found
5822 # status = 2: while loop executed, no headerfile found
5823 #
5824 status=\$?
5825 $rm -f foo\$\$.c;
5826 if test \$status -eq 1; then
5827         exit 0;
5828 fi
5829 exit 1
5830 EOF
5831 chmod +x findhdr
5832
5833 : define an alternate in-header-list? function
5834 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5835 cont=true; xxf="echo \"<\$1> found.\" >&4";
5836 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5837 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5838 esac;
5839 case $# in 4) instead=instead;; *) instead="at last";; esac;
5840 while $test "$cont"; do
5841         xxx=`./findhdr $1`
5842         var=$2; eval "was=\$$2";
5843         if $test "$xxx" && $test -r "$xxx";
5844         then eval $xxf;
5845         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5846                 cont="";
5847         else eval $xxnf;
5848         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5849         set $yyy; shift; shift; yyy=$@;
5850         case $# in 0) cont="";;
5851         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5852                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5853         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5854                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5855         esac;
5856 done;
5857 while $test "$yyy";
5858 do set $yyy; var=$2; eval "was=\$$2";
5859         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5860         set $yyy; shift; shift; yyy=$@;
5861 done'
5862
5863 : see if this is a malloc.h system
5864 set malloc.h i_malloc
5865 eval $inhdr
5866
5867 : see if stdlib is available
5868 set stdlib.h i_stdlib
5869 eval $inhdr
5870
5871 : determine which malloc to compile in
5872 echo " "
5873 case "$usemymalloc" in
5874 ''|[yY]*|true|$define)  dflt='y' ;;
5875 *)      dflt='n' ;;
5876 esac
5877 rp="Do you wish to attempt to use the malloc that comes with $package?"
5878 . ./myread
5879 usemymalloc="$ans"
5880 case "$ans" in
5881 y*|true)
5882         usemymalloc='y'
5883         mallocsrc='malloc.c'
5884         mallocobj="malloc$_o"
5885         d_mymalloc="$define"
5886         case "$libs" in
5887         *-lmalloc*)
5888                 : Remove malloc from list of libraries to use
5889                 echo "Removing unneeded -lmalloc from library list" >&4
5890                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
5891                 shift
5892                 libs="$*"
5893                 echo "libs = $libs" >&4
5894                 ;;
5895         esac
5896         ;;
5897 *)
5898         usemymalloc='n'
5899         mallocsrc=''
5900         mallocobj=''
5901         d_mymalloc="$undef"
5902         ;;
5903 esac
5904
5905 : compute the return types of malloc and free
5906 echo " "
5907 $cat >malloc.c <<END
5908 #$i_malloc I_MALLOC
5909 #$i_stdlib I_STDLIB
5910 #include <stdio.h>
5911 #include <sys/types.h>
5912 #ifdef I_MALLOC
5913 #include <malloc.h>
5914 #endif
5915 #ifdef I_STDLIB
5916 #include <stdlib.h>
5917 #endif
5918 #ifdef TRY_MALLOC
5919 void *malloc();
5920 #endif
5921 #ifdef TRY_FREE
5922 void free();
5923 #endif
5924 END
5925 case "$malloctype" in
5926 '')
5927         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
5928                 malloctype='void *'
5929         else
5930                 malloctype='char *'
5931         fi
5932         ;;
5933 esac
5934 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
5935
5936 case "$freetype" in
5937 '')
5938         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
5939                 freetype='void'
5940         else
5941                 freetype='int'
5942         fi
5943         ;;
5944 esac
5945 echo "Your system uses $freetype free(), it would seem." >&4
5946 $rm -f malloc.[co]
5947 $cat <<EOM
5948
5949 After $package is installed, you may wish to install various
5950 add-on modules and utilities.  Typically, these add-ons will
5951 be installed under $prefix with the rest
5952 of this package.  However, you may wish to install such add-ons
5953 elsewhere under a different prefix.
5954
5955 If you do not wish to put everything under a single prefix, that's
5956 ok.  You will be prompted for the individual locations; this siteprefix
5957 is only used to suggest the defaults.
5958
5959 The default should be fine for most people.
5960
5961 EOM
5962 fn=d~+
5963 rp='Installation prefix to use for add-on modules and utilities?'
5964 : XXX Here might be another good place for an installstyle setting.
5965 case "$siteprefix" in
5966 '') dflt=$prefix ;;
5967 *)  dflt=$siteprefix ;;
5968 esac
5969 . ./getfile
5970 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
5971 oldsiteprefix=''
5972 case "$siteprefix" in
5973 '') ;;
5974 *)      case "$ans" in
5975         "$prefix") ;;
5976         *) oldsiteprefix="$prefix";;
5977         esac
5978         ;;
5979 esac
5980 siteprefix="$ans"
5981 siteprefixexp="$ansexp"
5982
5983 : determine where site specific libraries go.
5984 : Usual default is /usr/local/lib/perl5/site_perl/$version
5985 : The default "style" setting is made in installstyle.U
5986 : XXX No longer works with Prefixit stuff.
5987 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
5988 case "$sitelib" in
5989 '') case "$installstyle" in
5990         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
5991         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
5992         esac
5993         ;;
5994 *)      dflt="$sitelib"
5995         ;;
5996 esac
5997 $cat <<EOM
5998
5999 The installation process will create a directory for
6000 site-specific extensions and modules.  Most users find it convenient
6001 to place all site-specific files in this directory rather than in the
6002 main distribution directory.
6003
6004 EOM
6005 fn=d~+
6006 rp='Pathname for the site-specific library files?'
6007 . ./getfile
6008 sitelib="$ans"
6009 sitelibexp="$ansexp"
6010 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
6011 : Change installation prefix, if necessary.
6012 if $test X"$prefix" != X"$installprefix"; then
6013         installsitelib=`echo $sitelibexp | $sed "s#^$prefix#$installprefix#"`
6014 else
6015         installsitelib="$sitelibexp"
6016 fi
6017
6018 : determine where site specific architecture-dependent libraries go.
6019 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
6020 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
6021 : sitelib may have an optional trailing /share.
6022 case "$sitearch" in
6023 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
6024         dflt="$dflt/$archname"
6025         ;;
6026 *)      dflt="$sitearch"
6027         ;;
6028 esac
6029 set sitearch sitearch none
6030 eval $prefixit
6031 $cat <<EOM
6032
6033 The installation process will also create a directory for
6034 architecture-dependent site-specific extensions and modules.
6035
6036 EOM
6037 fn=d~+
6038 rp='Pathname for the site-specific architecture-dependent library files?'
6039 . ./getfile
6040 sitearch="$ans"
6041 sitearchexp="$ansexp"
6042 : Change installation prefix, if necessary.
6043 if $test X"$prefix" != X"$installprefix"; then
6044         installsitearch=`echo $sitearchexp | sed "s#^$prefix#$installprefix#"`
6045 else
6046         installsitearch="$sitearchexp"
6047 fi
6048
6049 $cat <<EOM
6050
6051 The installation process will also create a directory for
6052 vendor-supplied add-ons.  Vendors who supply perl with their system
6053 may find it convenient to place all vendor-supplied files in this
6054 directory rather than in the main distribution directory.  This will
6055 ease upgrades between binary-compatible maintenance versions of perl.
6056
6057 Of course you may also use these directories in whatever way you see
6058 fit.  For example, you might use them to access modules shared over a
6059 company-wide network.
6060
6061 The default answer should be fine for most people.
6062 This causes further questions about vendor add-ons to be skipped
6063 and no vendor-specific directories will be configured for perl.
6064
6065 EOM
6066 rp='Do you want to configure vendor-specific add-on directories?'
6067 case "$usevendorprefix" in
6068 define|true|[yY]*) dflt=y ;;
6069 *)      : User may have set vendorprefix directly on Configure command line.
6070         case "$vendorprefix" in
6071         ''|' ') dflt=n ;;
6072         *)      dflt=y ;;
6073         esac
6074         ;;
6075 esac
6076 . ./myread
6077 case "$ans" in
6078 [yY]*)  fn=d~+
6079         rp='Installation prefix to use for vendor-supplied add-ons?'
6080         case "$vendorprefix" in
6081         '') dflt='' ;;
6082         *)  dflt=$vendorprefix ;;
6083         esac
6084         . ./getfile
6085         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6086         oldvendorprefix=''
6087         case "$vendorprefix" in
6088         '') ;;
6089         *)      case "$ans" in
6090                 "$prefix") ;;
6091                 *) oldvendorprefix="$prefix";;
6092                 esac
6093                 ;;
6094         esac
6095         usevendorprefix="$define"
6096         vendorprefix="$ans"
6097         vendorprefixexp="$ansexp"
6098         ;;
6099 *)      usevendorprefix="$undef"
6100         vendorprefix=''
6101         vendorprefixexp=''
6102         ;;
6103 esac
6104
6105 case "$vendorprefix" in
6106 '')     d_vendorlib="$undef"
6107         vendorlib=''
6108         vendorlibexp=''
6109         ;;
6110 *)      d_vendorlib="$define"
6111         : determine where vendor-supplied modules go.
6112         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
6113         case "$vendorlib" in
6114         '')
6115                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6116                 case "$installstyle" in
6117                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
6118                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
6119                 esac
6120                 ;;
6121         *)      dflt="$vendorlib"
6122                 ;;
6123         esac
6124         fn=d~+
6125         rp='Pathname for the vendor-supplied library files?'
6126         . ./getfile
6127         vendorlib="$ans"
6128         vendorlibexp="$ansexp"
6129         ;;
6130 esac
6131 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
6132 : Change installation prefix, if necessary.
6133 if $test X"$prefix" != X"$installprefix"; then
6134         installvendorlib=`echo $vendorlibexp | $sed "s#^$prefix#$installprefix#"`
6135 else
6136         installvendorlib="$vendorlibexp"
6137 fi
6138
6139 case "$vendorprefix" in
6140 '')     d_vendorarch="$undef"
6141         vendorarch=''
6142         vendorarchexp=''
6143         ;;
6144 *)      d_vendorarch="$define"
6145         : determine where vendor-supplied architecture-dependent libraries go.
6146         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
6147         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
6148         : vendorlib may have an optional trailing /share.
6149         case "$vendorarch" in
6150         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
6151                 dflt="$dflt/$archname"
6152                 ;;
6153         *)      dflt="$vendorarch" ;;
6154         esac
6155         fn=d~+
6156         rp='Pathname for vendor-supplied architecture-dependent files?'
6157         . ./getfile
6158         vendorarch="$ans"
6159         vendorarchexp="$ansexp"
6160         ;;
6161 esac
6162 : Change installation prefix, if necessary.
6163 if $test X"$prefix" != X"$installprefix"; then
6164         installvendorarch=`echo $vendorarchexp | sed "s#^$prefix#$installprefix#"`
6165 else
6166         installvendorarch="$vendorarchexp"
6167 fi
6168
6169 : Final catch-all directories to search
6170 $cat <<EOM
6171
6172 Lastly, you can have perl look in other directories for extensions and
6173 modules in addition to those already specified.
6174 These directories will be searched after 
6175         $sitearch 
6176         $sitelib 
6177 EOM
6178 test X"$vendorlib" != "X" && echo '     ' $vendorlib
6179 test X"$vendorarch" != "X" && echo '    ' $vendorarch
6180 echo ' '
6181 case "$otherlibdirs" in
6182 ''|' ') dflt='none' ;;
6183 *)      dflt="$otherlibdirs" ;;
6184 esac
6185 $cat <<EOM
6186 Enter a colon-separated set of extra paths to include in perl's @INC
6187 search path, or enter 'none' for no extra paths.
6188
6189 EOM
6190
6191 rp='Colon-separated list of additional directories for perl to search?'
6192 . ./myread
6193 case "$ans" in
6194 ' '|''|none)    otherlibdirs=' ' ;;     
6195 *)      otherlibdirs="$ans" ;;
6196 esac
6197 case "$otherlibdirs" in
6198 ' ') val=$undef ;;
6199 *)      val=$define ;;
6200 esac
6201 set d_perl_otherlibdirs
6202 eval $setvar
6203
6204 : Cruising for prototypes
6205 echo " "
6206 echo "Checking out function prototypes..." >&4
6207 $cat >prototype.c <<'EOCP'
6208 int main(int argc, char *argv[]) {
6209         exit(0);}
6210 EOCP
6211 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
6212         echo "Your C compiler appears to support function prototypes."
6213         val="$define"
6214 else
6215         echo "Your C compiler doesn't seem to understand function prototypes."
6216         val="$undef"
6217 fi
6218 set prototype
6219 eval $setvar
6220 $rm -f prototype*
6221
6222 case "$prototype" in
6223 "$define") ;;
6224 *)      ansi2knr='ansi2knr'
6225         echo " "
6226         cat <<EOM >&4
6227
6228 $me:  FATAL ERROR:
6229 This version of $package can only be compiled by a compiler that 
6230 understands function prototypes.  Unfortunately, your C compiler 
6231         $cc $ccflags
6232 doesn't seem to understand them.  Sorry about that.
6233
6234 If GNU cc is available for your system, perhaps you could try that instead.  
6235
6236 Eventually, we hope to support building Perl with pre-ANSI compilers.
6237 If you would like to help in that effort, please contact <perlbug@perl.org>.
6238
6239 Aborting Configure now.
6240 EOM
6241         exit 2
6242         ;;
6243 esac
6244
6245 : determine where public executables go
6246 echo " "
6247 set dflt bin bin
6248 eval $prefixit
6249 fn=d~
6250 rp='Pathname where the public executables will reside?'
6251 . ./getfile
6252 if $test "X$ansexp" != "X$binexp"; then
6253         installbin=''
6254 fi
6255 bin="$ans"
6256 binexp="$ansexp"
6257 : Change installation prefix, if necessary.
6258 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
6259 if $test X"$prefix" != X"$installprefix"; then
6260         installbin=`echo $binexp | sed "s#^$prefix#$installprefix#"`
6261 else
6262         installbin="$binexp"
6263 fi
6264
6265 : Find perl5.005 or later.
6266 echo "Looking for a previously installed perl5.005 or later... "
6267 case "$perl5" in
6268 '')     for tdir in `echo "$binexp:$PATH" | $sed "s/$path_sep/ /g"`; do
6269                 : Check if this perl is recent and can load a simple module
6270                 if $test -x $tdir/perl && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6271                         perl5=$tdir/perl
6272                         break;
6273                 elif $test -x $tdir/perl5 && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6274                         perl5=$tdir/perl
6275                         break;
6276                 fi
6277         done
6278         ;;
6279 *)      perl5="$perl5"
6280         ;;
6281 esac
6282 case "$perl5" in
6283 '')     echo "None found.  That's ok.";;
6284 *)      echo "Using $perl5." ;;
6285 esac
6286
6287 : Determine list of previous versions to include in @INC
6288 $cat > getverlist <<EOPL
6289 #!$perl5 -w
6290 use File::Basename;
6291 \$api_versionstring = "$api_versionstring";
6292 \$version = "$version";
6293 \$stem = "$sitelib_stem";
6294 \$archname = "$archname";
6295 EOPL
6296         $cat >> getverlist <<'EOPL'
6297 # Can't have leading @ because metaconfig interprets it as a command!
6298 ;@inc_version_list=();
6299 # XXX Redo to do opendir/readdir? 
6300 if (-d $stem) {
6301     chdir($stem);
6302     ;@candidates = glob("5.*");
6303 }
6304 else {
6305     ;@candidates = ();
6306 }
6307
6308 # XXX ToDo:  These comparisons must be reworked when two-digit
6309 # subversions come along, so that 5.7.10 compares as greater than
6310 # 5.7.3!  By that time, hope that 5.6.x is sufficiently
6311 # widespread that we can use the built-in version vectors rather
6312 # than reinventing them here.  For 5.6.0, however, we must
6313 # assume this script will likely be run by 5.005_0x.  --AD 1/2000.
6314 foreach $d (@candidates) {
6315     if ($d lt $version) {
6316         if ($d ge $api_versionstring) {
6317             unshift(@inc_version_list, grep { -d } "$d/$archname", $d);
6318         }
6319         elsif ($d ge "5.005") {
6320             unshift(@inc_version_list, grep { -d } $d);
6321         }
6322     }
6323     else {
6324         # Skip newer version.  I.e. don't look in
6325         # 5.7.0 if we're installing 5.6.1.
6326     }
6327 }
6328
6329 if (@inc_version_list) {
6330     print join(' ', @inc_version_list);
6331 }
6332 else {
6333     # Blank space to preserve value for next Configure run.
6334     print " ";
6335 }
6336 EOPL
6337 chmod +x getverlist
6338 case "$inc_version_list" in
6339 '')     if test -x "$perl5"; then
6340                 dflt=`$perl5 getverlist`
6341         else
6342                 dflt='none'
6343         fi
6344         ;;
6345 $undef) dflt='none' ;;
6346 *)  dflt="$inc_version_list" ;;
6347 esac
6348 case "$dflt" in
6349 ''|' ') dflt=none ;;
6350 esac
6351 case "$dflt" in
6352 5.005) case "$bincompat5005" in
6353        $define|true|[yY]*) ;;
6354        *) dflt=none ;;
6355        esac
6356        ;;
6357 esac
6358 $cat <<'EOM'
6359
6360 In order to ease the process of upgrading, this version of perl 
6361 can be configured to use modules built and installed with earlier 
6362 versions of perl that were installed under $prefix.  Specify here
6363 the list of earlier versions that this version of perl should check.
6364 If Configure detected no earlier versions of perl installed under
6365 $prefix, then the list will be empty.  Answer 'none' to tell perl
6366 to not search earlier versions.
6367
6368 The default should almost always be sensible, so if you're not sure,
6369 just accept the default.
6370 EOM
6371
6372 rp='List of earlier versions to include in @INC?'
6373 . ./myread
6374 case "$ans" in
6375 [Nn]one|''|' ') inc_version_list=' ' ;;
6376 *) inc_version_list="$ans" ;;
6377 esac
6378 case "$inc_version_list" in
6379 ''|' ') 
6380         inc_version_list_init='0';;
6381 *)      inc_version_list_init=`echo $inc_version_list |
6382                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
6383         ;;
6384 esac
6385 $rm -f getverlist
6386
6387 : determine whether to install perl also as /usr/bin/perl
6388
6389 echo " "
6390 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
6391         $cat <<EOM
6392 Many scripts expect perl to be installed as /usr/bin/perl.
6393 I can install the perl you are about to compile also as /usr/bin/perl
6394 (in addition to $installbin/perl).
6395 EOM
6396         case "$installusrbinperl" in
6397         "$undef"|[nN]*) dflt='n';;
6398         *)              dflt='y';;
6399         esac
6400         rp="Do you want to install perl as /usr/bin/perl?"
6401         . ./myread
6402         case "$ans" in
6403         [yY]*)  val="$define";;
6404         *)      val="$undef" ;;
6405         esac
6406 else
6407         val="$undef"
6408 fi
6409 set installusrbinperl
6410 eval $setvar
6411
6412 : see if dld is available
6413 set dld.h i_dld
6414 eval $inhdr
6415
6416 : see if dlopen exists
6417 xxx_runnm="$runnm"
6418 runnm=false
6419 set dlopen d_dlopen
6420 eval $inlibc
6421 runnm="$xxx_runnm"
6422
6423 : determine which dynamic loading, if any, to compile in
6424 echo " "
6425 dldir="ext/DynaLoader"
6426 case "$usedl" in
6427 $define|y|true)
6428         dflt='y'
6429         usedl="$define"
6430         ;;
6431 $undef|n|false)
6432         dflt='n'
6433         usedl="$undef"
6434         ;;
6435 *) 
6436         dflt='n'
6437         case "$d_dlopen" in
6438             $define) dflt='y' ;;
6439         esac
6440         case "$i_dld" in
6441             $define) dflt='y' ;;
6442         esac
6443         : Does a dl_xxx.xs file exist for this operating system
6444         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
6445         ;;
6446 esac
6447 rp="Do you wish to use dynamic loading?"
6448 . ./myread
6449 usedl="$ans"
6450 case "$ans" in
6451 y*) usedl="$define"
6452         case "$dlsrc" in
6453         '')
6454                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
6455                         dflt="$dldir/dl_${osname}.xs"
6456                 elif $test "$d_dlopen" = "$define" ; then
6457                         dflt="$dldir/dl_dlopen.xs"
6458                 elif $test "$i_dld" = "$define" ; then
6459                         dflt="$dldir/dl_dld.xs"
6460                 else
6461                         dflt=''
6462                 fi
6463                 ;;
6464         *)      dflt="$dldir/$dlsrc"
6465                 ;;
6466         esac
6467     echo "The following dynamic loading files are available:"
6468         : Can not go over to $dldir because getfile has path hard-coded in.
6469         tdir=`pwd`; cd $rsrc; $ls -C $dldir/dl*.xs; cd $tdir
6470         rp="Source file to use for dynamic loading"
6471         fn="fne"
6472         gfpth="$src"
6473         . ./getfile
6474         usedl="$define"
6475         : emulate basename
6476         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
6477
6478         $cat << EOM
6479
6480 Some systems may require passing special flags to $cc -c to
6481 compile modules that will be used to create a shared library.
6482 To use no flags, say "none".
6483
6484 EOM
6485     case "$cccdlflags" in
6486     '') case "$gccversion" in
6487                 '') case "$osname" in
6488                         hpux)   dflt='+z' ;;
6489                         next)   dflt='none' ;;
6490                         irix*)  dflt='-KPIC' ;;
6491                         svr4*|esix*|solaris) dflt='-KPIC' ;;
6492                         sunos)  dflt='-pic' ;;
6493                         *)      dflt='none' ;;
6494                     esac
6495                         ;;
6496                 *)  case "$osname" in
6497                         svr4*|esix*|solaris) dflt='-fPIC' ;;
6498                         *)      dflt='-fpic' ;;
6499                     esac ;;
6500             esac ;;
6501         ' ') dflt='none' ;;
6502     *)  dflt="$cccdlflags" ;;
6503     esac
6504     rp="Any special flags to pass to $cc -c to compile shared library modules?"
6505     . ./myread
6506     case "$ans" in
6507     none) cccdlflags=' ' ;;
6508     *) cccdlflags="$ans" ;;
6509     esac
6510
6511     cat << EOM
6512
6513 Some systems use ld to create libraries that can be dynamically loaded,
6514 while other systems (such as those using ELF) use $cc.
6515
6516 EOM
6517         case "$ld" in
6518         '')     $cat >try.c <<'EOM'
6519 /* Test for whether ELF binaries are produced */
6520 #include <fcntl.h>
6521 #include <stdlib.h>
6522 int main() {
6523         char b[4];
6524         int i = open("a.out",O_RDONLY);
6525         if(i == -1) 
6526                 exit(1); /* fail */
6527         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
6528                 exit(0); /* succeed (yes, it's ELF) */
6529         else
6530                 exit(1); /* fail */
6531 }
6532 EOM
6533                 if $cc $ccflags try.c >/dev/null 2>&1 && ./a.out; then
6534                         cat <<EOM
6535 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
6536 EOM
6537                         dflt="$cc"
6538                 else
6539                         echo "I'll use ld to build dynamic libraries."
6540                         dflt='ld'
6541                 fi
6542                 rm -f try.c a.out
6543                 ;;
6544         *)      dflt="$ld"
6545                 ;;
6546         esac
6547
6548     rp="What command should be used to create dynamic libraries?"
6549     . ./myread
6550         ld="$ans"
6551
6552     cat << EOM
6553
6554 Some systems may require passing special flags to $ld to create a
6555 library that can be dynamically loaded.  If your ld flags include
6556 -L/other/path options to locate libraries outside your loader's normal
6557 search path, you may need to specify those -L options here as well.  To
6558 use no flags, say "none".
6559
6560 EOM
6561     case "$lddlflags" in
6562     '') case "$osname" in
6563                         beos) dflt='-nostart' ;;
6564                         hpux) dflt='-b';
6565                               case "$gccversion" in
6566                               '') dflt="$dflt +vnocompatwarnings" ;;
6567                               esac
6568                               ;;        
6569                         linux|irix*)    dflt='-shared' ;;
6570                         next)  dflt='none' ;;
6571                         solaris) dflt='-G' ;;
6572                         sunos) dflt='-assert nodefinitions' ;;
6573                         svr4*|esix*) dflt="-G $ldflags" ;;
6574                 *)     dflt='none' ;;
6575                         esac
6576                         ;;
6577     *) dflt="$lddlflags" ;;
6578     esac
6579
6580         : Try to guess additional flags to pick up local libraries.
6581         : Be careful not to append to a plain 'none'
6582         case "$dflt" in
6583         none) dflt='' ;;
6584         esac
6585         for thisflag in $ldflags; do
6586                 case "$thisflag" in
6587                 -L*|-R*)
6588                         case " $dflt " in
6589                         *" $thisflag "*) ;;
6590                         *) dflt="$dflt $thisflag" ;;
6591                         esac
6592                         ;;
6593                 esac
6594         done
6595
6596         case "$dflt" in
6597         ''|' ') dflt='none' ;;
6598         esac
6599
6600     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
6601     . ./myread
6602     case "$ans" in
6603     none) lddlflags=' ' ;;
6604     *) lddlflags="$ans" ;;
6605     esac
6606
6607         cat <<EOM
6608
6609 Some systems may require passing special flags to $cc to indicate that
6610 the resulting executable will use dynamic linking.  To use no flags,
6611 say "none".
6612
6613 EOM
6614     case "$ccdlflags" in
6615     '') case "$osname" in
6616                 hpux)   dflt='-Wl,-E' ;;
6617                 linux)  dflt='-rdynamic' ;;
6618                 next)   dflt='none' ;;
6619                 sunos)  dflt='none' ;;
6620                 *)      dflt='none' ;;
6621             esac ;;
6622     ' ')  dflt='none' ;;
6623     *)  dflt="$ccdlflags" ;;
6624     esac
6625     rp="Any special flags to pass to $cc to use dynamic linking?"
6626     . ./myread
6627     case "$ans" in
6628     none) ccdlflags=' ' ;;
6629     *) ccdlflags="$ans" ;;
6630     esac
6631     ;;
6632 *)  usedl="$undef"
6633         ld='ld'
6634     dlsrc='dl_none.xs'
6635     lddlflags=''
6636     ccdlflags=''
6637     ;;
6638 esac
6639
6640 also=''
6641 case "$usedl" in
6642 $undef)
6643         # No dynamic loading being used, so don't bother even to prompt.
6644         useshrplib='false'
6645         ;;
6646 *)      case "$useshrplib" in
6647         '')     case "$osname" in
6648                 svr4*|dgux|dynixptx|esix|powerux|beos|cygwin*)
6649                         dflt=y
6650                         also='Building a shared libperl is required for dynamic loading to work on your system.'
6651                         ;;
6652                 next*)
6653                         case "$osvers" in
6654                         4*)     dflt=y
6655                                 also='Building a shared libperl is needed for MAB support.'
6656                                 ;;
6657                         *)      dflt=n
6658                                 ;;
6659                         esac
6660                         ;;
6661                 *)      dflt=n
6662                         ;;
6663                 esac
6664                 ;;
6665         $define|true|[Yy]*)
6666                 dflt=y
6667                 ;;
6668         *)      dflt=n
6669                 ;;
6670         esac
6671         $cat << EOM
6672
6673 The perl executable is normally obtained by linking perlmain.c with
6674 libperl${_a}, any static extensions (usually just DynaLoader), and
6675 any other libraries needed on this system (such as -lm, etc.).  Since
6676 your system supports dynamic loading, it is probably possible to build
6677 a shared libperl.$so.  If you will have more than one executable linked
6678 to libperl.$so, this will significantly reduce the size of each
6679 executable, but it may have a noticeable affect on performance.  The
6680 default is probably sensible for your system.
6681 $also
6682
6683 EOM
6684         rp="Build a shared libperl.$so (y/n)"
6685         . ./myread
6686         case "$ans" in
6687         true|$define|[Yy]*)
6688                 useshrplib='true'  ;;
6689         *)      useshrplib='false' ;;
6690         esac
6691         ;;
6692 esac
6693
6694 case "$useshrplib" in
6695 true)
6696         case "$libperl" in
6697         '')
6698                 # Figure out a good name for libperl.so.  Since it gets stored in
6699                 # a version-specific architecture-dependent library, the version
6700                 # number isn't really that important, except for making cc/ld happy.
6701                 #
6702                 # A name such as libperl.so.3.1
6703                 majmin="libperl.$so.$patchlevel.$subversion"
6704                 # A name such as libperl.so.301
6705                 majonly=`echo $patchlevel $subversion |
6706                         $awk '{printf "%d%02d", $1, $2}'`
6707                 majonly=libperl.$so.$majonly
6708                 # I'd prefer to keep the os-specific stuff here to a minimum, and
6709                 # rely on figuring it out from the naming of libc.
6710                 case "${osname}${osvers}" in
6711                 next4*)
6712                         dflt=libperl.5.$so
6713                         # XXX How handle the --version stuff for MAB?
6714                         ;;
6715                 linux*)  # ld won't link with a bare -lperl otherwise.
6716                         dflt=libperl.$so
6717                         ;;
6718                 cygwin*) # include version
6719                         dflt=`echo libperl$version | sed -e 's/\./_/g'`$lib_ext
6720                         ;;
6721                 *)      # Try to guess based on whether libc has major.minor.
6722                         case "$libc" in
6723                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
6724                         *libc.$so.[0-9]*) dflt=$majonly ;;
6725                         *)      dflt=libperl.$so ;;
6726                         esac
6727                         ;;
6728                 esac
6729                 ;;
6730         *)      dflt=$libperl
6731                 ;;
6732         esac
6733         cat << EOM
6734
6735 I need to select a good name for the shared libperl.  If your system uses
6736 library names with major and minor numbers, then you might want something
6737 like $majmin.  Alternatively, if your system uses a single version
6738 number for shared libraries, then you might want to use $majonly.
6739 Or, your system might be quite happy with a simple libperl.$so.
6740
6741 Since the shared libperl will get installed into a version-specific
6742 architecture-dependent directory, the version number of the shared perl
6743 library probably isn't important, so the default should be o.k.
6744
6745 EOM
6746         rp='What name do you want to give to the shared libperl?'
6747         . ./myread
6748         libperl=$ans
6749         echo "Ok, I'll use $libperl"
6750         ;;
6751 *)
6752         libperl="libperl${_a}"
6753         ;;
6754 esac
6755
6756 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
6757 case "$shrpdir" in
6758 '') ;;
6759 *)      $cat >&4 <<EOM
6760 WARNING:  Use of the shrpdir variable for the installation location of
6761 the shared $libperl is not supported.  It was never documented and
6762 will not work in this version.  Let me (perlbug@perl.org)
6763 know of any problems this may cause.
6764
6765 EOM
6766         case "$shrpdir" in
6767         "$archlibexp/CORE")
6768                 $cat >&4 <<EOM
6769 But your current setting of $shrpdir is
6770 the default anyway, so it's harmless.
6771 EOM
6772                 ;;
6773         *)
6774                 $cat >&4 <<EOM
6775 Further, your current attempted setting of $shrpdir
6776 conflicts with the value of $archlibexp/CORE
6777 that installperl will use.
6778 EOM
6779                 ;;
6780         esac
6781         ;;
6782 esac
6783
6784 # How will the perl executable find the installed shared $libperl?
6785 # Add $xxx to ccdlflags.
6786 # If we can't figure out a command-line option, use $shrpenv to
6787 # set env LD_RUN_PATH.  The main perl makefile uses this.
6788 shrpdir=$archlibexp/CORE
6789 xxx=''
6790 tmp_shrpenv=''
6791 if "$useshrplib"; then
6792     case "$osname" in 
6793         aix)
6794                 # We'll set it in Makefile.SH...
6795                 ;;
6796         solaris|netbsd)
6797                 xxx="-R $shrpdir"
6798                 ;;
6799         freebsd)
6800                 xxx="-Wl,-R$shrpdir"
6801                 ;;
6802         linux|irix*|dec_osf)
6803                 xxx="-Wl,-rpath,$shrpdir"
6804                 ;;
6805         next)
6806                 # next doesn't like the default...
6807                 ;;
6808         beos)
6809                 # beos doesn't like the default, either.
6810                 ;;
6811         hpux*)
6812                 # hpux doesn't like the default, either.
6813                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
6814                 ;;
6815         *)
6816                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
6817                 ;;
6818         esac
6819         case "$xxx" in
6820         '') ;;
6821         *)      
6822                 # Only add $xxx if it isn't already in ccdlflags.
6823                 case " $ccdlflags " in
6824                 *" $xxx "*)     ;;
6825                 *)      ccdlflags="$ccdlflags $xxx"
6826                         cat <<EOM >&4
6827
6828 Adding $xxx to the flags
6829 passed to $ld so that the perl executable will find the 
6830 installed shared $libperl.
6831
6832 EOM
6833                         ;;
6834                 esac
6835                 ;;
6836         esac
6837 fi
6838 # Fix ccdlflags in AIX for building external extensions.
6839 # (For building Perl itself bare -bE:perl.exp is needed,
6840 #  Makefile.SH takes care of this.)
6841 case "$osname" in
6842 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
6843 esac
6844 # Respect a hint or command-line value.
6845 case "$shrpenv" in
6846 '') shrpenv="$tmp_shrpenv" ;;
6847 esac
6848 case "$ldlibpthname" in
6849 '')     ldlibpthname=LD_LIBRARY_PATH ;;
6850 none)   ldlibpthname='' ;;
6851 esac
6852
6853 : determine where manual pages go
6854 set man1dir man1dir none
6855 eval $prefixit
6856 $cat <<EOM
6857
6858 $spackage has manual pages available in source form.
6859 EOM
6860 case "$nroff" in
6861 nroff)
6862         echo "However, you don't have nroff, so they're probably useless to you."
6863         case "$man1dir" in
6864         '') man1dir="none";;
6865         esac;;
6866 esac
6867 echo "If you don't want the manual sources installed, answer 'none'."
6868 case "$man1dir" in
6869 ' ') dflt=none
6870         ;;
6871 '')
6872         lookpath="$prefixexp/man/man1 $prefixexp/man/l_man/man1"
6873         lookpath="$lookpath $prefixexp/man/p_man/man1"
6874         lookpath="$lookpath $prefixexp/man/u_man/man1"
6875         lookpath="$lookpath $prefixexp/man/man.1"
6876         case "$sysman" in
6877         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
6878         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
6879         esac
6880         set dflt
6881         eval $prefixup
6882         ;;
6883 *)  dflt="$man1dir"
6884         ;;
6885 esac
6886 echo " "
6887 fn=dn+~
6888 rp="Where do the main $spackage manual pages (source) go?"
6889 . ./getfile
6890 if $test "X$man1direxp" != "X$ansexp"; then
6891         installman1dir=''
6892 fi
6893 man1dir="$ans"
6894 man1direxp="$ansexp"
6895 case "$man1dir" in
6896 '')     man1dir=' '
6897         installman1dir='';;
6898 esac
6899
6900 : Change installation prefix, if necessary.
6901 if $test X"$prefix" != X"$installprefix"; then
6902         installman1dir=`echo $man1direxp | $sed "s#^$prefix#$installprefix#"`
6903 else
6904         installman1dir="$man1direxp"
6905 fi
6906
6907 : What suffix to use on installed man pages
6908
6909 case "$man1dir" in
6910 ' ')
6911         man1ext='0'
6912         ;;
6913 *)
6914         rp="What suffix should be used for the main $spackage man pages?"
6915         case "$man1ext" in
6916         '')     case "$man1dir" in
6917                 *1)  dflt=1 ;;
6918                 *1p) dflt=1p ;;
6919                 *1pm) dflt=1pm ;;
6920                 *l) dflt=l;;
6921                 *n) dflt=n;;
6922                 *o) dflt=o;;
6923                 *p) dflt=p;;
6924                 *C) dflt=C;;
6925                 *L) dflt=L;;
6926                 *L1) dflt=L1;;
6927                 *) dflt=1;;
6928                 esac
6929                 ;;
6930         *)      dflt="$man1ext";;
6931         esac
6932         . ./myread
6933         man1ext="$ans"
6934         ;;
6935 esac
6936
6937 : see if we can have long filenames
6938 echo " "
6939 first=123456789abcdef
6940 $rm -f $first
6941 if (echo hi >$first) 2>/dev/null; then
6942         if $test -f 123456789abcde; then
6943                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
6944                 val="$undef"
6945         else
6946                 echo 'You can have filenames longer than 14 characters.'>&4
6947                 val="$define"
6948         fi
6949 else
6950         $cat <<'EOM'
6951 You can't have filenames longer than 14 chars.
6952 You can't even think about them!
6953 EOM
6954         val="$undef"
6955 fi 
6956 set d_flexfnam
6957 eval $setvar
6958 $rm -rf 123456789abcde*
6959
6960 : determine where library module manual pages go
6961 set man3dir man3dir none
6962 eval $prefixit
6963 $cat <<EOM
6964
6965 $spackage has manual pages for many of the library modules.
6966 EOM
6967
6968 case "$nroff" in
6969 nroff)
6970         $cat <<'EOM'
6971 However, you don't have nroff, so they're probably useless to you.
6972 EOM
6973         case "$man3dir" in
6974         '') man3dir="none";;
6975         esac;;
6976 esac
6977
6978 case "$d_flexfnam" in
6979 undef)
6980         $cat <<'EOM'
6981 However, your system can't handle the long file names like File::Basename.3. 
6982 EOM
6983         case "$man3dir" in
6984         '') man3dir="none";;
6985         esac;;
6986 esac
6987
6988 echo "If you don't want the manual sources installed, answer 'none'."
6989 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6990 case "$man3dir" in
6991 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
6992         if $test -d "$privlib/man/man3"; then
6993                 cat <<EOM >&4
6994
6995 WARNING:  Previous versions of perl installed man3 pages into
6996 $privlib/man/man3.  This version will suggest a 
6997 new default of $dflt.  
6998 EOM
6999                 tdflt=$dflt
7000                 dflt='n'
7001                 rp='Do you wish to preserve the old behavior?(y/n)'
7002                 . ./myread
7003                 case "$ans" in
7004                 y*) dflt="$privlib/man/man3" ;;
7005                 *)  dflt=$tdflt ;;
7006                 esac
7007     fi
7008         ;;
7009 *)      dflt="$man3dir" ;;
7010 esac
7011 case "$dflt" in
7012 ' ') dflt=none ;;
7013 esac
7014 echo " "
7015 fn=dn+~
7016 rp="Where do the $package library man pages (source) go?"
7017 . ./getfile
7018 man3dir="$ans"
7019 man3direxp="$ansexp"
7020 case "$man3dir" in
7021 '')     man3dir=' '
7022         installman3dir='';;
7023 esac
7024
7025 : Change installation prefix, if necessary.
7026 if $test X"$prefix" != X"$installprefix"; then
7027         installman3dir=`echo $man3direxp | $sed "s#^$prefix#$installprefix#"`
7028 else
7029         installman3dir="$man3direxp"
7030 fi
7031
7032 : What suffix to use on installed man pages
7033 case "$man3dir" in
7034 ' ')
7035         man3ext='0'
7036         ;;
7037 *)
7038         rp="What suffix should be used for the $package library man pages?"
7039         case "$man3ext" in
7040         '')     case "$man3dir" in
7041                 *3)  dflt=3 ;;
7042                 *3p) dflt=3p ;;
7043                 *3pm) dflt=3pm ;;
7044                 *l) dflt=l;;
7045                 *n) dflt=n;;
7046                 *o) dflt=o;;
7047                 *p) dflt=p;;
7048                 *C) dflt=C;;
7049                 *L) dflt=L;;
7050                 *L3) dflt=L3;;
7051                 *) dflt=3;;
7052                 esac
7053                 ;;
7054         *)      dflt="$man3ext";;
7055         esac
7056         . ./myread
7057         man3ext="$ans"
7058         ;;
7059 esac
7060
7061 : see if we have to deal with yellow pages, now NIS.
7062 if $test -d /usr/etc/yp || $test -d /etc/yp; then
7063         if $test -f /usr/etc/nibindd; then
7064                 echo " "
7065                 echo "I'm fairly confident you're on a NeXT."
7066                 echo " "
7067                 rp='Do you get the hosts file via NetInfo?'
7068                 dflt=y
7069                 case "$hostcat" in
7070                 nidump*) ;;
7071                 '') ;;
7072                 *) dflt=n;;
7073                 esac
7074                 . ./myread
7075                 case "$ans" in
7076                 y*) hostcat='nidump hosts .';;
7077                 *)      case "$hostcat" in
7078                         nidump*) hostcat='';;
7079                         esac
7080                         ;;
7081                 esac
7082         fi
7083         case "$hostcat" in
7084         nidump*) ;;
7085         *)
7086                 case "$hostcat" in
7087                 *ypcat*) dflt=y;;
7088                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
7089                                 dflt=y
7090                         else
7091                                 dflt=n
7092                         fi;;
7093                 *) dflt=n;;
7094                 esac
7095                 echo " "
7096                 rp='Are you getting the hosts file via yellow pages?'
7097                 . ./myread
7098                 case "$ans" in
7099                 y*) hostcat='ypcat hosts';;
7100                 *) hostcat='cat /etc/hosts';;
7101                 esac
7102                 ;;
7103         esac
7104 fi
7105 case "$hostcat" in
7106 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
7107 esac
7108 case "$groupcat" in
7109 '') test -f /etc/group && groupcat='cat /etc/group';;
7110 esac
7111 case "$passcat" in
7112 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
7113 esac
7114
7115 : now get the host name
7116 echo " "
7117 echo "Figuring out host name..." >&4
7118 case "$myhostname" in
7119 '') cont=true
7120         echo 'Maybe "hostname" will work...'
7121         if tans=`sh -c hostname 2>&1` ; then
7122                 myhostname=$tans
7123                 phostname=hostname
7124                 cont=''
7125         fi
7126         ;;
7127 *) cont='';;
7128 esac
7129 if $test "$cont"; then
7130         if ./xenix; then
7131                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
7132                 if tans=`cat /etc/systemid 2>&1` ; then
7133                         myhostname=$tans
7134                         phostname='cat /etc/systemid'
7135                         echo "Whadyaknow.  Xenix always was a bit strange..."
7136                         cont=''
7137                 fi
7138         elif $test -r /etc/systemid; then
7139                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
7140         fi
7141 fi
7142 if $test "$cont"; then
7143         echo 'No, maybe "uuname -l" will work...'
7144         if tans=`sh -c 'uuname -l' 2>&1` ; then
7145                 myhostname=$tans
7146                 phostname='uuname -l'
7147         else
7148                 echo 'Strange.  Maybe "uname -n" will work...'
7149                 if tans=`sh -c 'uname -n' 2>&1` ; then
7150                         myhostname=$tans
7151                         phostname='uname -n'
7152                 else
7153                         echo 'Oh well, maybe I can mine it out of whoami.h...'
7154                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
7155                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
7156                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
7157                         else
7158                                 case "$myhostname" in
7159                                 '') echo "Does this machine have an identity crisis or something?"
7160                                         phostname='';;
7161                                 *)
7162                                         echo "Well, you said $myhostname before..."
7163                                         phostname='echo $myhostname';;
7164                                 esac
7165                         fi
7166                 fi
7167         fi
7168 fi
7169 : you do not want to know about this
7170 set $myhostname
7171 myhostname=$1
7172
7173 : verify guess
7174 if $test "$myhostname" ; then
7175         dflt=y
7176         rp='Your host name appears to be "'$myhostname'".'" Right?"
7177         . ./myread
7178         case "$ans" in
7179         y*) ;;
7180         *) myhostname='';;
7181         esac
7182 fi
7183
7184 : bad guess or no guess
7185 while $test "X$myhostname" = X ; do
7186         dflt=''
7187         rp="Please type the (one word) name of your host:"
7188         . ./myread
7189         myhostname="$ans"
7190 done
7191
7192 : translate upper to lower if necessary
7193 case "$myhostname" in
7194 *[A-Z]*)
7195         echo "(Normalizing case in your host name)"
7196         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
7197         ;;
7198 esac
7199
7200 case "$myhostname" in
7201 *.*)
7202         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
7203         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
7204         echo "(Trimming domain name from host name--host name is now $myhostname)"
7205         ;;
7206 *) case "$mydomain" in
7207         '')
7208                 {
7209                         test "X$hostcat" = "Xypcat hosts" &&
7210                         ypmatch "$myhostname" hosts 2>/dev/null |\
7211                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
7212                         $test -s hosts
7213                 } || {
7214                         test "X$hostcat" != "X" &&
7215                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
7216                                         /[       ]$myhostname[  . ]/p" > hosts
7217                 }
7218                 tmp_re="[       . ]"
7219                 $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
7220                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
7221                 dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
7222                         hosts | $sort | $uniq | \
7223                         $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
7224                 case `$echo X$dflt` in
7225                 X*\ *)  echo "(Several hosts in /etc/hosts matched hostname)"
7226                         dflt=.
7227                         ;;
7228                 X.) echo "(You do not have fully-qualified names in /etc/hosts)"
7229                         ;;
7230                 esac
7231                 case "$dflt" in
7232                 .)
7233                         tans=`./loc resolv.conf X /etc /usr/etc`
7234                         if $test -f "$tans"; then
7235                                 echo "(Attempting domain name extraction from $tans)"
7236                                 dflt=.`$sed -n -e 's/   / /g' \
7237                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
7238                                   | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
7239                                 case "$dflt" in
7240                                 .) dflt=.`$sed -n -e 's/        / /g' \
7241                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
7242                                      | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
7243                                         ;;
7244                                 esac
7245                         fi
7246                         ;;
7247                 esac
7248                 case "$dflt" in
7249                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
7250                         dflt=.`sh -c domainname 2>/dev/null`
7251                         case "$dflt" in
7252                         '') dflt='.';;
7253                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
7254                         esac
7255                         ;;
7256                 esac
7257                 case "$dflt" in
7258                 .) echo "(Lost all hope -- silly guess then)"
7259                         dflt='.uucp'
7260                         ;;
7261                 esac
7262                 $rm -f hosts
7263                 ;;
7264         *) dflt="$mydomain";;
7265         esac;;
7266 esac
7267 echo " "
7268 rp="What is your domain name?"
7269 . ./myread
7270 tans="$ans"
7271 case "$ans" in
7272 '') ;;
7273 .*) ;;
7274 *) tans=".$tans";;
7275 esac
7276 mydomain="$tans"
7277
7278 : translate upper to lower if necessary
7279 case "$mydomain" in
7280 *[A-Z]*)
7281         echo "(Normalizing case in your domain name)"
7282         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
7283         ;;
7284 esac
7285
7286 : a little sanity check here
7287 case "$phostname" in
7288 '') ;;
7289 *)
7290         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
7291         $myhostname$mydomain|$myhostname) ;;
7292         *)
7293                 case "$phostname" in
7294                 sed*)
7295                         echo "(That doesn't agree with your whoami.h file, by the way.)"
7296                         ;;
7297                 *)
7298                         echo "(That doesn't agree with your $phostname command, by the way.)"
7299                         ;;
7300                 esac
7301         ;;
7302         esac
7303         ;;
7304 esac
7305
7306 $cat <<EOM
7307
7308 I need to get your e-mail address in Internet format if possible, i.e.
7309 something like user@host.domain. Please answer accurately since I have
7310 no easy means to double check it. The default value provided below
7311 is most probably close to reality but may not be valid from outside
7312 your organization...
7313
7314 EOM
7315 cont=x
7316 while test "$cont"; do
7317         case "$cf_email" in
7318         '') dflt="$cf_by@$myhostname$mydomain";;
7319         *) dflt="$cf_email";;
7320         esac
7321         rp='What is your e-mail address?'
7322         . ./myread
7323         cf_email="$ans"
7324         case "$cf_email" in
7325         *@*.*) cont='' ;;
7326         *)
7327                 rp='Address does not look like an Internet one.  Use it anyway?'
7328                 case "$fastread" in
7329                 yes) dflt=y ;;
7330                 *) dflt=n ;;
7331                 esac
7332                 . ./myread
7333                 case "$ans" in
7334                 y*) cont='' ;;
7335                 *) echo " " ;;
7336                 esac
7337                 ;;
7338         esac
7339 done
7340
7341 $cat <<EOM
7342
7343 If you or somebody else will be maintaining perl at your site, please
7344 fill in the correct e-mail address here so that they may be contacted
7345 if necessary. Currently, the "perlbug" program included with perl
7346 will send mail to this address in addition to perlbug@perl.org. You may
7347 enter "none" for no administrator.
7348
7349 EOM
7350 case "$perladmin" in
7351 '') dflt="$cf_email";;
7352 *) dflt="$perladmin";;
7353 esac
7354 rp='Perl administrator e-mail address'
7355 . ./myread
7356 perladmin="$ans"
7357
7358 : figure out how to guarantee perl startup
7359 case "$startperl" in
7360 '')
7361         case "$sharpbang" in
7362         *!)
7363                 $cat <<EOH
7364
7365 I can use the #! construct to start perl on your system. This will
7366 make startup of perl scripts faster, but may cause problems if you
7367 want to share those scripts and perl is not in a standard place
7368 ($binexp/perl) on all your platforms. The alternative is to force
7369 a shell by starting the script with a single ':' character.
7370
7371 EOH
7372                 dflt="$binexp/perl"
7373                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
7374                 . ./myread
7375                 case "$ans" in
7376                 none)   startperl=": # use perl";;
7377                 *)      startperl="#!$ans"
7378                         if $test 30 -lt `echo "$ans" | wc -c`; then
7379                                 $cat >&4 <<EOM
7380
7381 WARNING:  Some systems limit the #! command to 32 characters.
7382 If you experience difficulty running Perl scripts with #!, try
7383 installing Perl in a directory with a shorter pathname.
7384
7385 EOM
7386                         fi ;;
7387                 esac
7388                 ;;
7389         *) startperl=": # use perl"
7390                 ;;
7391         esac
7392         ;;
7393 esac
7394 echo "I'll use $startperl to start perl scripts."
7395
7396 : figure best path for perl in scripts
7397 case "$perlpath" in
7398 '')
7399         perlpath="$binexp/perl"
7400         case "$startperl" in
7401         *!*) ;;
7402         *)
7403                 $cat <<EOH
7404
7405 I will use the "eval 'exec'" idiom to start Perl on your system.
7406 I can use the full path of your Perl binary for this purpose, but
7407 doing so may cause problems if you want to share those scripts and
7408 Perl is not always in a standard place ($binexp/perl).
7409
7410 EOH
7411                 dflt="$binexp/perl"
7412                 rp="What path shall I use in \"eval 'exec'\"?"
7413                 . ./myread
7414                 perlpath="$ans"
7415                 ;;
7416         esac
7417         ;;
7418 esac
7419 case "$startperl" in
7420 *!*)    ;;
7421 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
7422 esac
7423
7424 : determine where public executable scripts go
7425 set scriptdir scriptdir
7426 eval $prefixit
7427 case "$scriptdir" in
7428 '')
7429         dflt="$bin"
7430         : guess some guesses
7431         $test -d /usr/share/scripts && dflt=/usr/share/scripts
7432         $test -d /usr/share/bin     && dflt=/usr/share/bin
7433         $test -d /usr/local/script  && dflt=/usr/local/script
7434         $test -d /usr/local/scripts && dflt=/usr/local/scripts
7435         $test -d $prefixexp/script  && dflt=$prefixexp/script
7436         set dflt
7437         eval $prefixup
7438         ;;
7439 *)  dflt="$scriptdir"
7440         ;;
7441 esac
7442 $cat <<EOM
7443  
7444 Some installations have a separate directory just for executable scripts so
7445 that they can mount it across multiple architectures but keep the scripts in
7446 one spot.  You might, for example, have a subdirectory of /usr/share for this.
7447 Or you might just lump your scripts in with all your other executables.
7448  
7449 EOM
7450 fn=d~
7451 rp='Where do you keep publicly executable scripts?'
7452 . ./getfile
7453 if $test "X$ansexp" != "X$scriptdirexp"; then
7454         installscript=''
7455 fi
7456 scriptdir="$ans"
7457 scriptdirexp="$ansexp"
7458 : Change installation prefix, if necessary.
7459 if $test X"$prefix" != X"$installprefix"; then
7460         installscript=`echo $scriptdirexp | sed "s#^$prefix#$installprefix#"`
7461 else
7462         installscript="$scriptdirexp"
7463 fi
7464
7465 : determine where add-on public executables go
7466 case "$sitebin" in
7467 '')     dflt=$siteprefix/bin ;;
7468 *)      dflt=$sitebin ;;
7469 esac
7470 fn=d~
7471 rp='Pathname where the add-on public executables should be installed?'
7472 . ./getfile
7473 sitebin="$ans"
7474 sitebinexp="$ansexp"
7475 : Change installation prefix, if necessary.
7476 if $test X"$prefix" != X"$installprefix"; then
7477         installsitebin=`echo $sitebinexp | sed "s#^$prefix#$installprefix#"`
7478 else
7479         installsitebin="$sitebinexp"
7480 fi
7481
7482 case "$useperlio" in
7483 $define|true|[yY]*)     dflt='y';;
7484 *) dflt='n';;
7485 esac
7486 cat <<EOM
7487
7488 Previous version of $package used the standard IO mechanisms as defined
7489 in <stdio.h>.  Versions 5.003_02 and later of perl allow alternate IO
7490 mechanisms via a "PerlIO" abstraction, but the stdio mechanism is still
7491 the default.  This abstraction layer can use AT&T's sfio (if you already
7492 have sfio installed) or regular stdio.  Using PerlIO with sfio may cause
7493 problems with some extension modules.  Using PerlIO with stdio is safe,
7494 but it is slower than plain stdio and therefore is not the default.
7495
7496 If this doesn't make any sense to you, just accept the default '$dflt'.
7497 EOM
7498 rp='Use the experimental PerlIO abstraction layer?'
7499 . ./myread
7500 case "$ans" in
7501 y|Y) 
7502         val="$define"
7503         ;;     
7504 *)      
7505         echo "Ok, doing things the stdio way"
7506         val="$undef"
7507         ;;
7508 esac
7509 set useperlio
7510 eval $setvar 
7511
7512 case "$vendorprefix" in
7513 '')     d_vendorbin="$undef"
7514         vendorbin=''
7515         vendorbinexp=''
7516         ;;
7517 *)      d_vendorbin="$define"
7518         : determine where vendor-supplied executables go.
7519         case "$vendorbin" in
7520         '') dflt=$vendorprefix/bin ;;
7521         *)      dflt="$vendorbin" ;;
7522         esac
7523         fn=d~+
7524         rp='Pathname for the vendor-supplied executables directory?'
7525         . ./getfile
7526         vendorbin="$ans"
7527         vendorbinexp="$ansexp"
7528         ;;
7529 esac
7530 : Change installation prefix, if necessary.
7531 if $test X"$prefix" != X"$installprefix"; then
7532         installvendorbin=`echo $vendorbinexp | $sed "s#^$prefix#$installprefix#"`
7533 else
7534         installvendorbin="$vendorbinexp"
7535 fi
7536
7537 : see if qgcvt exists
7538 set qgcvt d_qgcvt
7539 eval $inlibc
7540
7541 : check for length of double
7542 echo " "
7543 case "$doublesize" in
7544 '')
7545         echo "Checking to see how big your double precision numbers are..." >&4
7546         $cat >try.c <<'EOCP'
7547 #include <stdio.h>
7548 int main()
7549 {
7550     printf("%d\n", (int)sizeof(double));
7551     exit(0);
7552 }
7553 EOCP
7554         set try
7555         if eval $compile_ok; then
7556                 doublesize=`./try`
7557                 echo "Your double is $doublesize bytes long."
7558         else
7559                 dflt='8'
7560                 echo "(I can't seem to compile the test program.  Guessing...)"
7561                 rp="What is the size of a double precision number (in bytes)?"
7562                 . ./myread
7563                 doublesize="$ans"
7564         fi
7565         ;;
7566 esac
7567 $rm -f try.c try
7568
7569 : check for long doubles
7570 echo " "
7571 echo "Checking to see if you have long double..." >&4
7572 echo 'int main() { long double x = 7.0; }' > try.c
7573 set try
7574 if eval $compile; then
7575         val="$define"
7576         echo "You have long double."
7577 else
7578         val="$undef"
7579         echo "You do not have long double."
7580 fi
7581 $rm try.*
7582 set d_longdbl
7583 eval $setvar
7584
7585 : check for length of long double
7586 case "${d_longdbl}${longdblsize}" in
7587 $define)
7588         echo " "
7589         echo "Checking to see how big your long doubles are..." >&4
7590         $cat >try.c <<'EOCP'
7591 #include <stdio.h>
7592 int main()
7593 {
7594         printf("%d\n", sizeof(long double));
7595 }
7596 EOCP
7597         set try
7598         set try
7599         if eval $compile; then
7600                 longdblsize=`./try$exe_ext`
7601                 echo "Your long doubles are $longdblsize bytes long."
7602         else
7603                 dflt='8'
7604                 echo " "
7605                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
7606                 rp="What is the size of a long double (in bytes)?"
7607                 . ./myread
7608                 longdblsize="$ans"
7609         fi
7610         if $test "X$doublesize" = "X$longdblsize"; then
7611                 echo "(That isn't any different from an ordinary double.)"
7612         fi      
7613         ;;
7614 esac
7615 $rm -f try.* try
7616
7617 echo " "
7618
7619 if $test X"$d_longdbl" = X"$define"; then
7620
7621 echo "Checking how to print long doubles..." >&4
7622
7623 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
7624         $cat >try.c <<'EOCP'
7625 #include <sys/types.h>
7626 #include <stdio.h>
7627 int main() {
7628   double d = 123.456;
7629   printf("%.3f\n", d);
7630 }
7631 EOCP
7632         set try
7633         if eval $compile; then
7634                 yyy=`./try$exe_ext`
7635                 case "$yyy" in
7636                 123.456)
7637                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
7638                         sPRIFldbl='"F"'; sPRIGldbl='"G"'; sPRIEldbl='"E"';
7639                         echo "We will use %f."
7640                         ;;
7641                 esac
7642         fi
7643 fi
7644
7645 if $test X"$sPRIfldbl" = X; then
7646         $cat >try.c <<'EOCP'
7647 #include <sys/types.h>
7648 #include <stdio.h>
7649 int main() {
7650   long double d = 123.456;
7651   printf("%.3llf\n", d);
7652 }
7653 EOCP
7654         set try
7655         if eval $compile; then
7656                 yyy=`./try$exe_ext`
7657                 case "$yyy" in
7658                 123.456)
7659                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
7660                         sPRIFldbl='"llF"'; sPRIGldbl='"llG"'; sPRIEldbl='"llE"';
7661                         echo "We will use %llf."
7662                         ;;
7663                 esac
7664         fi
7665 fi
7666
7667 if $test X"$sPRIfldbl" = X; then
7668         $cat >try.c <<'EOCP'
7669 #include <sys/types.h>
7670 #include <stdio.h>
7671 int main() {
7672   long double d = 123.456;
7673   printf("%.3Lf\n", d);
7674 }
7675 EOCP
7676         set try
7677         if eval $compile; then
7678                 yyy=`./try$exe_ext`
7679                 case "$yyy" in
7680                 123.456)
7681                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
7682                         sPRIFldbl='"LF"'; sPRIGldbl='"LG"'; sPRIEldbl='"LE"';
7683                         echo "We will use %Lf."
7684                         ;;
7685                 esac
7686         fi
7687 fi
7688
7689 if $test X"$sPRIfldbl" = X; then
7690         $cat >try.c <<'EOCP'
7691 #include <sys/types.h>
7692 #include <stdio.h>
7693 int main() {
7694   long double d = 123.456;
7695   printf("%.3lf\n", d);
7696 }
7697 EOCP
7698         set try
7699         if eval $compile; then
7700                 yyy=`./try$exe_ext`
7701                 case "$yyy" in
7702                 123.456)
7703                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
7704                         sPRIFldbl='"lF"'; sPRIGldbl='"lG"'; sPRIEldbl='"lE"';
7705                         echo "We will use %lf."
7706                         ;;
7707                 esac
7708         fi
7709 fi
7710
7711 if $test X"$sPRIfldbl" = X; then
7712         echo "Cannot figure out how to print long doubles." >&4
7713 fi
7714
7715 $rm -f try try.*
7716
7717 fi # d_longdbl
7718
7719 case "$sPRIfldbl" in
7720 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef"; 
7721         d_PRIFldbl="$undef"; d_PRIGldbl="$undef"; d_PRIEldbl="$undef"; 
7722         ;;
7723 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define"; 
7724         d_PRIFldbl="$define"; d_PRIGldbl="$define"; d_PRIEldbl="$define"; 
7725         ;;
7726 esac
7727
7728 : Check how to convert floats to strings.
7729 echo " "
7730 echo "Checking for an efficient way to convert floats to strings."
7731 echo " " > try.c
7732 case "$uselongdouble" in
7733 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
7734 esac
7735 case "$d_longdbl" in
7736 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
7737 esac
7738 case "$d_PRIgldbl" in
7739 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
7740 esac
7741 $cat >>try.c <<EOP
7742 #ifdef TRY_gconvert
7743 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
7744 char *myname = "gconvert";
7745 #endif
7746 #ifdef TRY_gcvt
7747 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
7748 char *myname = "gcvt";
7749 #endif
7750 #ifdef TRY_qgcvt
7751 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
7752 char *myname = "qgcvt";
7753 #define DOUBLETYPE long double
7754 #endif
7755 #ifdef TRY_sprintf
7756 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE) && defined(HAS_PRIgldbl)
7757 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
7758 #else
7759 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
7760 #endif
7761 char *myname = "sprintf";
7762 #endif
7763
7764 #ifndef DOUBLETYPE
7765 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
7766 #define DOUBLETYPE long double
7767 #else
7768 #define DOUBLETYPE double
7769 #endif
7770 #endif
7771
7772 #include <stdio.h>
7773
7774 #define I_STDLIB $i_stdlib
7775 #ifdef I_STDLIB
7776 #include <stdlib.h>
7777 #endif
7778
7779 int
7780 checkit(expect, got)
7781 char *expect;
7782 char *got;
7783 {
7784     if (strcmp(expect, got)) {
7785                 printf("%s oddity:  Expected %s, got %s\n",
7786                         myname, expect, got);
7787                 exit(1);
7788         }
7789 }
7790
7791 int main()
7792
7793         char buf[64]; 
7794         buf[63] = '\0';
7795
7796         /* This must be 1st test on (which?) platform */
7797         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
7798         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
7799         checkit("0.1", buf);
7800
7801         Gconvert((DOUBLETYPE)1.0, 8, 0, buf); 
7802         checkit("1", buf);
7803
7804         Gconvert((DOUBLETYPE)1.1, 8, 0, buf); 
7805         checkit("1.1", buf);
7806
7807         Gconvert((DOUBLETYPE)1.01, 8, 0, buf); 
7808         checkit("1.01", buf);
7809
7810         Gconvert((DOUBLETYPE)1.001, 8, 0, buf); 
7811         checkit("1.001", buf);
7812
7813         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf); 
7814         checkit("1.0001", buf);
7815
7816         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf); 
7817         checkit("1.00001", buf);
7818
7819         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf); 
7820         checkit("1.000001", buf);
7821
7822         Gconvert((DOUBLETYPE)0.0, 8, 0, buf); 
7823         checkit("0", buf);
7824
7825         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf); 
7826         checkit("-1", buf);
7827
7828         /* Some Linux gcvt's give 1.e+5 here. */
7829         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf); 
7830         checkit("100000", buf);
7831         
7832         /* Some Linux gcvt's give -1.e+5 here. */
7833         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf); 
7834         checkit("-100000", buf);
7835
7836         exit(0);
7837 }
7838 EOP
7839 case "$d_Gconvert" in
7840 gconvert*) xxx_list='gconvert gcvt sprintf' ;;
7841 gcvt*) xxx_list='gcvt gconvert sprintf' ;;
7842 *) xxx_list='sprintf gconvert gcvt' ;;
7843 esac
7844
7845 case "$d_longdbl$uselongdouble$d_PRIgldbl" in
7846 "$define$define$define")
7847     xxx_list="`echo $xxx_list|sed s/sprintf//`" 
7848     xxx_list="sprintf $xxx_list"
7849     case "$d_qgcvt" in
7850     "$define") xxx_list="qgcvt $xxx_list" ;;
7851     esac
7852     ;;
7853 esac
7854
7855 for xxx_convert in $xxx_list; do
7856         echo "Trying $xxx_convert..."
7857         $rm -f try try$_o
7858         set try -DTRY_$xxx_convert
7859         if eval $compile; then
7860                 echo "$xxx_convert() found." >&4
7861                 if ./try; then
7862                         echo "I'll use $xxx_convert to convert floats into a string." >&4
7863                         break;
7864                 else
7865                         echo "...But $xxx_convert didn't work as I expected."
7866                 fi
7867         else
7868                 echo "$xxx_convert NOT found." >&4
7869         fi
7870 done
7871         
7872 case "$xxx_convert" in
7873 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
7874 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
7875 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
7876 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
7877    "$define$define$define")
7878       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
7879    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
7880    esac
7881    ;;  
7882 esac
7883
7884 : Initialize h_fcntl
7885 h_fcntl=false
7886
7887 : Initialize h_sysfile
7888 h_sysfile=false
7889
7890 : access call always available on UNIX
7891 set access d_access
7892 eval $inlibc
7893
7894 : locate the flags for 'access()'
7895 case "$d_access" in
7896 "$define")
7897         echo " "
7898         $cat >access.c <<'EOCP'
7899 #include <sys/types.h>
7900 #ifdef I_FCNTL
7901 #include <fcntl.h>
7902 #endif
7903 #ifdef I_SYS_FILE
7904 #include <sys/file.h>
7905 #endif
7906 #ifdef I_UNISTD
7907 #include <unistd.h>
7908 #endif
7909 int main() {
7910         exit(R_OK);
7911 }
7912 EOCP
7913         : check sys/file.h first, no particular reason here
7914         if $test `./findhdr sys/file.h` && \
7915                 $cc $cppflags -DI_SYS_FILE -o access access.c >/dev/null 2>&1 ; then
7916                 h_sysfile=true;
7917                 echo "<sys/file.h> defines the *_OK access constants." >&4
7918         elif $test `./findhdr fcntl.h` && \
7919                 $cc $cppflags -DI_FCNTL -o access access.c >/dev/null 2>&1 ; then
7920                 h_fcntl=true;
7921                 echo "<fcntl.h> defines the *_OK access constants." >&4
7922         elif $test `./findhdr unistd.h` && \
7923                 $cc $cppflags -DI_UNISTD -o access access.c >/dev/null 2>&1 ; then
7924                 echo "<unistd.h> defines the *_OK access constants." >&4
7925         else
7926                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
7927         fi
7928         ;;
7929 esac
7930 $rm -f access*
7931
7932 : see if accessx exists
7933 set accessx d_accessx
7934 eval $inlibc
7935
7936 : see if alarm exists
7937 set alarm d_alarm
7938 eval $inlibc
7939
7940 : see if atolf exists
7941 set atolf d_atolf
7942 eval $inlibc
7943
7944 : see if atoll exists
7945 set atoll d_atoll
7946 eval $inlibc
7947
7948 : Look for GNU-cc style attribute checking
7949 echo " "
7950 echo "Checking whether your compiler can handle __attribute__ ..." >&4
7951 $cat >attrib.c <<'EOCP'
7952 #include <stdio.h>
7953 void croak (char* pat,...) __attribute__((format(printf,1,2),noreturn));
7954 EOCP
7955 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
7956         if $contains 'warning' attrib.out >/dev/null 2>&1; then
7957                 echo "Your C compiler doesn't fully support __attribute__."
7958                 val="$undef"
7959         else
7960                 echo "Your C compiler supports __attribute__."
7961                 val="$define"
7962         fi
7963 else
7964         echo "Your C compiler doesn't seem to understand __attribute__ at all."
7965         val="$undef"
7966 fi
7967 set d_attribut
7968 eval $setvar
7969 $rm -f attrib*
7970
7971 : see if bcmp exists
7972 set bcmp d_bcmp
7973 eval $inlibc
7974
7975 : see if bcopy exists
7976 set bcopy d_bcopy
7977 eval $inlibc
7978
7979 : see if this is a unistd.h system
7980 set unistd.h i_unistd
7981 eval $inhdr
7982
7983 : see if getpgrp exists
7984 set getpgrp d_getpgrp
7985 eval $inlibc
7986
7987 case "$d_getpgrp" in
7988 "$define")
7989         echo " "
7990         echo "Checking to see which flavor of getpgrp is in use..."
7991         $cat >set.c <<EOP
7992 #$i_unistd I_UNISTD
7993 #include <sys/types.h>
7994 #ifdef I_UNISTD
7995 #  include <unistd.h>
7996 #endif
7997 int main()
7998 {
7999         if (getuid() == 0) {
8000                 printf("(I see you are running Configure as super-user...)\n");
8001                 setuid(1);
8002         }
8003 #ifdef TRY_BSD_PGRP
8004         if (getpgrp(1) == 0)
8005                 exit(0);
8006 #else
8007         if (getpgrp() > 0)
8008                 exit(0);
8009 #endif
8010         exit(1);
8011 }
8012 EOP
8013         if $cc -DTRY_BSD_PGRP $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
8014                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
8015                 val="$define"
8016         elif $cc $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
8017                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
8018                 val="$undef"
8019         else
8020                 echo "I can't seem to compile and run the test program."
8021                 if ./usg; then
8022                         xxx="a USG one, i.e. you use getpgrp()."
8023                 else
8024                         # SVR4 systems can appear rather BSD-ish.
8025                         case "$i_unistd" in
8026                         $undef)
8027                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
8028                                 val="$define"
8029                                 ;;
8030                         $define)
8031                                 xxx="probably a USG one, i.e. you use getpgrp()."
8032                                 val="$undef"
8033                                 ;;
8034                         esac
8035                 fi
8036                 echo "Assuming your getpgrp is $xxx" >&4
8037         fi
8038         ;;
8039 *) val="$undef";;
8040 esac
8041 set d_bsdgetpgrp
8042 eval $setvar
8043 $rm -f set set.c
8044
8045 : see if setpgrp exists
8046 set setpgrp d_setpgrp
8047 eval $inlibc
8048
8049 case "$d_setpgrp" in
8050 "$define")
8051         echo " "
8052         echo "Checking to see which flavor of setpgrp is in use..."
8053         $cat >set.c <<EOP
8054 #$i_unistd I_UNISTD
8055 #include <sys/types.h>
8056 #ifdef I_UNISTD
8057 #  include <unistd.h>
8058 #endif
8059 int main()
8060 {
8061         if (getuid() == 0) {
8062                 printf("(I see you are running Configure as super-user...)\n");
8063                 setuid(1);
8064         }
8065 #ifdef TRY_BSD_PGRP
8066         if (-1 == setpgrp(1, 1))
8067                 exit(0);
8068 #else
8069         if (setpgrp() != -1)
8070                 exit(0);
8071 #endif
8072         exit(1);
8073 }
8074 EOP
8075         if $cc -DTRY_BSD_PGRP $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
8076                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
8077                 val="$define"
8078         elif $cc $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
8079                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
8080                 val="$undef"
8081         else
8082                 echo "(I can't seem to compile and run the test program.)"
8083                 if ./usg; then
8084                         xxx="a USG one, i.e. you use setpgrp()."
8085                 else
8086                         # SVR4 systems can appear rather BSD-ish.
8087                         case "$i_unistd" in
8088                         $undef)
8089                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
8090                                 val="$define"
8091                                 ;;
8092                         $define)
8093                                 xxx="probably a USG one, i.e. you use setpgrp()."
8094                                 val="$undef"
8095                                 ;;
8096                         esac
8097                 fi
8098                 echo "Assuming your setpgrp is $xxx" >&4
8099         fi
8100         ;;
8101 *) val="$undef";;
8102 esac
8103 set d_bsdsetpgrp
8104 eval $setvar
8105 $rm -f set set.c
8106 : see if bzero exists
8107 set bzero d_bzero
8108 eval $inlibc
8109
8110 : see if signal is declared as pointer to function returning int or void
8111 echo " "
8112 xxx=`./findhdr signal.h`
8113 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
8114 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
8115         echo "You have int (*signal())() instead of void." >&4
8116         val="$undef"
8117 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
8118         echo "You have void (*signal())()." >&4
8119         val="$define"
8120 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
8121         echo "You have int (*signal())() instead of void." >&4
8122         val="$undef"
8123 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
8124         echo "You have void (*signal())()." >&4
8125         val="$define"
8126 else
8127         case "$d_voidsig" in
8128         '')
8129         echo "I can't determine whether signal handler returns void or int..." >&4
8130                 dflt=void
8131                 rp="What type does your signal handler return?"
8132                 . ./myread
8133                 case "$ans" in
8134                 v*) val="$define";;
8135                 *) val="$undef";;
8136                 esac;;
8137         "$define")
8138                 echo "As you already told me, signal handler returns void." >&4
8139                 val="$define"
8140                 ;;
8141         *)      echo "As you already told me, signal handler returns int." >&4
8142                 val="$undef"
8143                 ;;
8144         esac
8145 fi
8146 set d_voidsig
8147 eval $setvar
8148 case "$d_voidsig" in
8149 "$define") signal_t="void";;
8150 *) signal_t="int";;
8151 esac
8152 $rm -f $$.tmp
8153
8154 : check for ability to cast large floats to 32-bit ints.
8155 echo " "
8156 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
8157 if $test "$intsize" -ge 4; then
8158         xxx=int
8159 else
8160         xxx=long
8161 fi
8162 $cat >try.c <<EOCP
8163 #include <stdio.h>
8164 #include <sys/types.h>
8165 #include <signal.h>
8166 $signal_t blech(s) int s; { exit(3); }
8167 int main()
8168 {
8169         $xxx i32;
8170         double f, g;
8171         int result = 0;
8172         char str[16];
8173         signal(SIGFPE, blech);
8174
8175         /* Don't let compiler optimize the test away.  Store the number 
8176            in a writable string for gcc to pass to sscanf under HP/UX.
8177         */
8178         sprintf(str, "2147483647");
8179         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
8180         g = 10 * f;
8181         i32  = ($xxx) g;
8182
8183         /* x86 processors will probably give 0x8000 0000, which is a
8184        sign change.  We don't want that.  We want to mimic SPARC
8185            behavior here, which is to preserve the sign and give
8186            back 0x7fff ffff.
8187         */
8188         if (i32 != ($xxx) f)
8189                 result |= 1;
8190         exit(result);
8191 }
8192 EOCP
8193 set try
8194 if eval $compile_ok; then
8195         ./try
8196         yyy=$?
8197 else
8198         echo "(I can't seem to compile the test program--assuming it can't)"
8199         yyy=1
8200 fi
8201 case "$yyy" in
8202 0)      val="$define"
8203         echo "Yup, it can."
8204         ;;
8205 *)      val="$undef"
8206         echo "Nope, it can't."
8207         ;;
8208 esac
8209 set d_casti32
8210 eval $setvar
8211 $rm -f try try.*
8212
8213 : check for ability to cast negative floats to unsigned
8214 echo " "
8215 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
8216 $cat >try.c <<EOCP
8217 #include <stdio.h>
8218 #include <sys/types.h>
8219 #include <signal.h>
8220 $signal_t blech(s) int s; { exit(7); }
8221 $signal_t blech_in_list(s) int s; { exit(4); }
8222 unsigned long dummy_long(p) unsigned long p; { return p; }
8223 unsigned int dummy_int(p) unsigned int p; { return p; }
8224 unsigned short dummy_short(p) unsigned short p; { return p; }
8225 int main()
8226 {
8227         double f;
8228         unsigned long along;
8229         unsigned int aint;
8230         unsigned short ashort;
8231         int result = 0;
8232         char str[16];
8233         
8234         /* Frustrate gcc-2.7.2's optimizer which failed this test with
8235            a direct f = -123. assignment.  gcc-2.8.0 reportedly
8236            optimized the whole file away
8237         */
8238         /* Store the number in a writable string for gcc to pass to 
8239            sscanf under HP/UX.
8240         */
8241         sprintf(str, "-123");
8242         sscanf(str, "%lf", &f);  /* f = -123.; */
8243
8244         signal(SIGFPE, blech);
8245         along = (unsigned long)f;
8246         aint = (unsigned int)f;
8247         ashort = (unsigned short)f;
8248         if (along != (unsigned long)-123)
8249                 result |= 1;
8250         if (aint != (unsigned int)-123)
8251                 result |= 1;
8252         if (ashort != (unsigned short)-123)
8253                 result |= 1;
8254         sprintf(str, "1073741824.");
8255         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
8256         f = f + f;
8257         along = 0;
8258         along = (unsigned long)f;
8259         if (along != 0x80000000)
8260                 result |= 2;
8261         f -= 1.;
8262         along = 0;
8263         along = (unsigned long)f;
8264         if (along != 0x7fffffff)
8265                 result |= 1;
8266         f += 2.;
8267         along = 0;
8268         along = (unsigned long)f;
8269         if (along != 0x80000001)
8270                 result |= 2;
8271         if (result)
8272                 exit(result);
8273         signal(SIGFPE, blech_in_list);
8274         sprintf(str, "123.");
8275         sscanf(str, "%lf", &f);  /* f = 123.; */
8276         along = dummy_long((unsigned long)f);
8277         aint = dummy_int((unsigned int)f);
8278         ashort = dummy_short((unsigned short)f);
8279         if (along != (unsigned long)123)
8280                 result |= 4;
8281         if (aint != (unsigned int)123)
8282                 result |= 4;
8283         if (ashort != (unsigned short)123)
8284                 result |= 4;
8285         exit(result);
8286
8287 }
8288 EOCP
8289 set try
8290 if eval $compile_ok; then
8291         ./try
8292         castflags=$?
8293 else
8294         echo "(I can't seem to compile the test program--assuming it can't)"
8295         castflags=7
8296 fi
8297 case "$castflags" in
8298 0)      val="$define"
8299         echo "Yup, it can."
8300         ;;
8301 *)      val="$undef"
8302         echo "Nope, it can't."
8303         ;;
8304 esac
8305 set d_castneg
8306 eval $setvar
8307 $rm -f try.*
8308
8309 : see if vprintf exists
8310 echo " "
8311 if set vprintf val -f d_vprintf; eval $csym; $val; then
8312         echo 'vprintf() found.' >&4
8313         val="$define"
8314         $cat >vprintf.c <<'EOF'
8315 #include <varargs.h>
8316
8317 int main() { xxx("foo"); }
8318
8319 xxx(va_alist)
8320 va_dcl
8321 {
8322         va_list args;
8323         char buf[10];
8324
8325         va_start(args);
8326         exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
8327 }
8328 EOF
8329         set vprintf
8330         if eval $compile && ./vprintf; then
8331                 echo "Your vsprintf() returns (int)." >&4
8332                 val2="$undef"
8333         else
8334                 echo "Your vsprintf() returns (char*)." >&4
8335                 val2="$define"
8336         fi
8337 else
8338         echo 'vprintf() NOT found.' >&4
8339                 val="$undef"
8340                 val2="$undef"
8341 fi
8342 set d_vprintf
8343 eval $setvar
8344 val=$val2
8345 set d_charvspr
8346 eval $setvar
8347
8348 : see if chown exists
8349 set chown d_chown
8350 eval $inlibc
8351
8352 : see if chroot exists
8353 set chroot d_chroot
8354 eval $inlibc
8355
8356 : see if chsize exists
8357 set chsize d_chsize
8358 eval $inlibc
8359
8360 : check for const keyword
8361 echo " "
8362 echo 'Checking to see if your C compiler knows about "const"...' >&4
8363 $cat >const.c <<'EOCP'
8364 typedef struct spug { int drokk; } spug;
8365 int main()
8366 {
8367         const char *foo;
8368         const spug y;
8369 }
8370 EOCP
8371 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
8372         val="$define"
8373         echo "Yup, it does."
8374 else
8375         val="$undef"
8376         echo "Nope, it doesn't."
8377 fi
8378 set d_const
8379 eval $setvar
8380
8381 : see if crypt exists
8382 echo " "
8383 if set crypt val -f d_crypt; eval $csym; $val; then
8384         echo 'crypt() found.' >&4
8385         val="$define"
8386         cryptlib=''
8387 else
8388         cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
8389         if $test -z "$cryptlib"; then
8390                 cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
8391         else
8392                 cryptlib=-lcrypt
8393         fi
8394         if $test -z "$cryptlib"; then
8395                 cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
8396         else
8397                 cryptlib=-lcrypt
8398         fi
8399         if $test -z "$cryptlib"; then
8400                 cryptlib=`./loc libcrypt$_a "" $libpth`
8401         else
8402                 cryptlib=-lcrypt
8403         fi
8404         if $test -z "$cryptlib"; then
8405                 echo 'crypt() NOT found.' >&4
8406                 val="$undef"
8407         else
8408                 val="$define"
8409         fi
8410 fi
8411 set d_crypt
8412 eval $setvar
8413
8414 : get csh whereabouts
8415 case "$csh" in
8416 'csh') val="$undef" ;;
8417 *) val="$define" ;;
8418 esac
8419 set d_csh
8420 eval $setvar
8421 : Respect a hint or command line value for full_csh.
8422 case "$full_csh" in
8423 '') full_csh=$csh ;;
8424 esac
8425
8426 : see if cuserid exists
8427 set cuserid d_cuserid
8428 eval $inlibc
8429
8430 : see if this is a limits.h system
8431 set limits.h i_limits
8432 eval $inhdr
8433
8434 : see if this is a float.h system
8435 set float.h i_float
8436 eval $inhdr
8437
8438 : See if number of significant digits in a double precision number is known
8439 echo " "
8440 $cat >dbl_dig.c <<EOM
8441 #$i_limits I_LIMITS
8442 #$i_float I_FLOAT
8443 #ifdef I_LIMITS
8444 #include <limits.h>
8445 #endif
8446 #ifdef I_FLOAT
8447 #include <float.h>
8448 #endif
8449 #ifdef DBL_DIG
8450 printf("Contains DBL_DIG");
8451 #endif
8452 EOM
8453 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
8454 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
8455         echo "DBL_DIG found." >&4
8456         val="$define"
8457 else
8458         echo "DBL_DIG NOT found." >&4
8459         val="$undef"
8460 fi
8461 $rm -f dbl_dig.?
8462 set d_dbl_dig
8463 eval $setvar
8464
8465 : see if difftime exists
8466 set difftime d_difftime
8467 eval $inlibc
8468
8469 : see if this is a dirent system
8470 echo " "
8471 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
8472         val="$define"
8473         echo "<dirent.h> found." >&4
8474 else
8475         val="$undef"
8476         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
8477                 echo "<sys/dir.h> found." >&4
8478                 echo " "
8479         else
8480                 xinc=`./findhdr sys/ndir.h`
8481         fi
8482         echo "<dirent.h> NOT found." >&4
8483 fi
8484 set i_dirent
8485 eval $setvar
8486
8487 : Look for type of directory structure.
8488 echo " "
8489 $cppstdin $cppflags $cppminus < "$xinc" > try.c
8490
8491 case "$direntrytype" in
8492 ''|' ')
8493         case "$i_dirent" in
8494         $define) guess1='struct dirent' ;;
8495         *) guess1='struct direct'  ;;
8496         esac
8497         ;;
8498 *)      guess1="$direntrytype"
8499         ;;
8500 esac
8501
8502 case "$guess1" in
8503 'struct dirent') guess2='struct direct' ;;
8504 *) guess2='struct dirent' ;;
8505 esac
8506                 
8507 if $contains "$guess1" try.c >/dev/null 2>&1; then
8508         direntrytype="$guess1"
8509         echo "Your directory entries are $direntrytype." >&4
8510 elif $contains "$guess2" try.c >/dev/null 2>&1; then
8511         direntrytype="$guess2"
8512         echo "Your directory entries seem to be $direntrytype." >&4
8513 else
8514         echo "I don't recognize your system's directory entries." >&4
8515         rp="What type is used for directory entries on this system?"
8516         dflt="$guess1"
8517         . ./myread
8518         direntrytype="$ans"
8519 fi
8520 $rm -f try.c
8521
8522
8523 : see if the directory entry stores field length
8524 echo " "
8525 $cppstdin $cppflags $cppminus < "$xinc" > try.c
8526 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
8527         echo "Good, your directory entry keeps length information in d_namlen." >&4
8528         val="$define"
8529 else
8530         echo "Your directory entry does not know about the d_namlen field." >&4
8531         val="$undef"
8532 fi
8533 set d_dirnamlen
8534 eval $setvar
8535 $rm -f try.c
8536
8537 : see if dlerror exists
8538 xxx_runnm="$runnm"
8539 runnm=false
8540 set dlerror d_dlerror
8541 eval $inlibc
8542 runnm="$xxx_runnm"
8543
8544 : see if dlfcn is available
8545 set dlfcn.h i_dlfcn
8546 eval $inhdr
8547
8548 case "$usedl" in
8549 $define|y|true)
8550         $cat << EOM
8551
8552 On a few systems, the dynamically loaded modules that perl generates and uses
8553 will need a different extension than shared libs. The default will probably
8554 be appropriate.
8555
8556 EOM
8557         case "$dlext" in
8558         '')     dflt="$so" ;;
8559         *)      dflt="$dlext" ;;
8560         esac
8561         rp='What is the extension of dynamically loaded modules'
8562         . ./myread
8563         dlext="$ans"
8564         ;;
8565 *)
8566         dlext="none"
8567         ;;
8568 esac
8569
8570 : Check if dlsym need a leading underscore
8571 echo " "
8572 val="$undef"
8573
8574 case "$dlsrc" in
8575 dl_dlopen.xs)
8576         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
8577         $cat >dyna.c <<'EOM'
8578 fred () { }
8579 EOM
8580
8581 $cat >fred.c<<EOM
8582
8583 #include <stdio.h>
8584 #$i_dlfcn I_DLFCN
8585 #ifdef I_DLFCN
8586 #include <dlfcn.h>      /* the dynamic linker include file for Sunos/Solaris */
8587 #else
8588 #include <sys/types.h>
8589 #include <nlist.h>
8590 #include <link.h>
8591 #endif
8592
8593 extern int fred() ;
8594
8595 int main()
8596 {
8597     void * handle ;
8598     void * symbol ;
8599 #ifndef RTLD_LAZY
8600     int mode = 1 ;
8601 #else
8602     int mode = RTLD_LAZY ;
8603 #endif
8604     handle = dlopen("./dyna.$dlext", mode) ;
8605     if (handle == NULL) {
8606         printf ("1\n") ;
8607         fflush (stdout) ;
8608         exit(0);
8609     }
8610     symbol = dlsym(handle, "fred") ;
8611     if (symbol == NULL) {
8612         /* try putting a leading underscore */
8613         symbol = dlsym(handle, "_fred") ;
8614         if (symbol == NULL) {
8615             printf ("2\n") ;
8616             fflush (stdout) ;
8617             exit(0);
8618         }
8619         printf ("3\n") ;
8620     }
8621     else
8622         printf ("4\n") ;
8623     fflush (stdout) ;
8624     exit(0);
8625 }
8626 EOM
8627         : Call the object file tmp-dyna.o in case dlext=o.
8628         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 && 
8629                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 && 
8630                 $ld $lddlflags -o dyna.$dlext tmp-dyna${_o} > /dev/null 2>&1 && 
8631                 $cc $ccflags -o fred $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1; then
8632                 xxx=`./fred`
8633                 case $xxx in
8634                 1)      echo "Test program failed using dlopen." >&4
8635                         echo "Perhaps you should not use dynamic loading." >&4;;
8636                 2)      echo "Test program failed using dlsym." >&4
8637                         echo "Perhaps you should not use dynamic loading." >&4;;
8638                 3)      echo "dlsym needs a leading underscore" >&4
8639                         val="$define" ;;
8640                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
8641                 esac
8642         else
8643                 echo "I can't compile and run the test program." >&4
8644                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
8645         fi
8646         ;;
8647 esac
8648                 
8649 $rm -f fred fred.? dyna.$dlext dyna.? tmp-dyna.?
8650
8651 set d_dlsymun
8652 eval $setvar
8653
8654 hasproto='varname=$1; func=$2; shift; shift;
8655 while $test $# -ge 2; do
8656         case "$1" in
8657         $define) echo "#include <$2>";;
8658         esac ;
8659     shift 2;
8660 done > try.c;
8661 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
8662 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
8663         echo "$func() prototype found.";
8664         val="$define";
8665 else
8666         echo "$func() prototype NOT found.";
8667         val="$undef";
8668 fi;
8669 set $varname;
8670 eval $setvar;
8671 $rm -f try.c tryout.c'
8672
8673 : see if prototype for drand48 is available
8674 echo " "
8675 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
8676 eval $hasproto
8677
8678 : see if dup2 exists
8679 set dup2 d_dup2
8680 eval $inlibc
8681
8682 : see if eaccess exists
8683 set eaccess d_eaccess
8684 eval $inlibc
8685
8686 : see if endgrent exists
8687 set endgrent d_endgrent
8688 eval $inlibc
8689
8690 : see if endhostent exists
8691 set endhostent d_endhent
8692 eval $inlibc
8693
8694 : see if endnetent exists
8695 set endnetent d_endnent
8696 eval $inlibc
8697
8698 : see if endprotoent exists
8699 set endprotoent d_endpent
8700 eval $inlibc
8701
8702 : see if endpwent exists
8703 set endpwent d_endpwent
8704 eval $inlibc
8705
8706 : see if endservent exists
8707 set endservent d_endsent
8708 eval $inlibc
8709
8710 : Locate the flags for 'open()'
8711 echo " "
8712 $cat >open3.c <<'EOCP'
8713 #include <sys/types.h>
8714 #ifdef I_FCNTL
8715 #include <fcntl.h>
8716 #endif
8717 #ifdef I_SYS_FILE
8718 #include <sys/file.h>
8719 #endif
8720 int main() {
8721         if(O_RDONLY);
8722 #ifdef O_TRUNC
8723         exit(0);
8724 #else
8725         exit(1);
8726 #endif
8727 }
8728 EOCP
8729 : check sys/file.h first to get FREAD on Sun
8730 if $test `./findhdr sys/file.h` && \
8731                 set open3 -DI_SYS_FILE && eval $compile; then
8732         h_sysfile=true;
8733         echo "<sys/file.h> defines the O_* constants..." >&4
8734         if ./open3; then
8735                 echo "and you have the 3 argument form of open()." >&4
8736                 val="$define"
8737         else
8738                 echo "but not the 3 argument form of open().  Oh, well." >&4
8739                 val="$undef"
8740         fi
8741 elif $test `./findhdr fcntl.h` && \
8742                 set open3 -DI_FCNTL && eval $compile; then
8743         h_fcntl=true;
8744         echo "<fcntl.h> defines the O_* constants..." >&4
8745         if ./open3; then
8746                 echo "and you have the 3 argument form of open()." >&4
8747                 val="$define"
8748         else
8749                 echo "but not the 3 argument form of open().  Oh, well." >&4
8750                 val="$undef"
8751         fi
8752 else
8753         val="$undef"
8754         echo "I can't find the O_* constant definitions!  You got problems." >&4
8755 fi
8756 set d_open3
8757 eval $setvar
8758 $rm -f open3*
8759
8760 : see which of string.h or strings.h is needed
8761 echo " "
8762 strings=`./findhdr string.h`
8763 if $test "$strings" && $test -r "$strings"; then
8764         echo "Using <string.h> instead of <strings.h>." >&4
8765         val="$define"
8766 else
8767         val="$undef"
8768         strings=`./findhdr strings.h`
8769         if $test "$strings" && $test -r "$strings"; then
8770                 echo "Using <strings.h> instead of <string.h>." >&4
8771         else
8772                 echo "No string header found -- You'll surely have problems." >&4
8773         fi
8774 fi
8775 set i_string
8776 eval $setvar
8777 case "$i_string" in
8778 "$undef") strings=`./findhdr strings.h`;;
8779 *)        strings=`./findhdr string.h`;;
8780 esac
8781
8782 : check for non-blocking I/O stuff
8783 case "$h_sysfile" in
8784 true) echo "#include <sys/file.h>" > head.c;;
8785 *)
8786         case "$h_fcntl" in
8787         true) echo "#include <fcntl.h>" > head.c;;
8788         *) echo "#include <sys/fcntl.h>" > head.c;;
8789         esac
8790         ;;
8791 esac
8792 echo " "
8793 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
8794 case "$o_nonblock" in
8795 '')
8796         $cat head.c > try.c
8797         $cat >>try.c <<'EOCP'
8798 #include <stdio.h>
8799 int main() {
8800 #ifdef O_NONBLOCK
8801         printf("O_NONBLOCK\n");
8802         exit(0);
8803 #endif
8804 #ifdef O_NDELAY
8805         printf("O_NDELAY\n");
8806         exit(0);
8807 #endif
8808 #ifdef FNDELAY
8809         printf("FNDELAY\n");
8810         exit(0);
8811 #endif
8812         exit(0);
8813 }
8814 EOCP
8815         set try
8816         if eval $compile_ok; then
8817                 o_nonblock=`./try`
8818                 case "$o_nonblock" in
8819                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
8820                 *) echo "Seems like we can use $o_nonblock.";;
8821                 esac
8822         else
8823                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
8824         fi
8825         ;;
8826 *) echo "Using $hint value $o_nonblock.";;
8827 esac
8828 $rm -f try try.* .out core
8829
8830 echo " "
8831 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
8832 case "$eagain" in
8833 '')
8834         $cat head.c > try.c
8835         $cat >>try.c <<EOCP
8836 #include <errno.h>
8837 #include <sys/types.h>
8838 #include <signal.h>
8839 #include <stdio.h> 
8840 #define MY_O_NONBLOCK $o_nonblock
8841 #ifndef errno  /* XXX need better Configure test */
8842 extern int errno;
8843 #endif
8844 #$i_unistd I_UNISTD
8845 #ifdef I_UNISTD
8846 #include <unistd.h>
8847 #endif
8848 #$i_string I_STRING
8849 #ifdef I_STRING
8850 #include <string.h>
8851 #else
8852 #include <strings.h>
8853 #endif
8854 $signal_t blech(x) int x; { exit(3); }
8855 EOCP
8856         $cat >> try.c <<'EOCP'
8857 int main()
8858 {
8859         int pd[2];
8860         int pu[2];
8861         char buf[1];
8862         char string[100];
8863
8864         pipe(pd);       /* Down: child -> parent */
8865         pipe(pu);       /* Up: parent -> child */
8866         if (0 != fork()) {
8867                 int ret;
8868                 close(pd[1]);   /* Parent reads from pd[0] */
8869                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
8870                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
8871                         exit(1);
8872                 signal(SIGALRM, blech);
8873                 alarm(5);
8874                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
8875                         exit(2);
8876                 sprintf(string, "%d\n", ret);
8877                 write(2, string, strlen(string));
8878                 alarm(0);
8879 #ifdef EAGAIN
8880                 if (errno == EAGAIN) {
8881                         printf("EAGAIN\n");
8882                         goto ok;
8883                 }
8884 #endif
8885 #ifdef EWOULDBLOCK
8886                 if (errno == EWOULDBLOCK)
8887                         printf("EWOULDBLOCK\n");
8888 #endif
8889         ok:
8890                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
8891                 sleep(2);                               /* Give it time to close our pipe */
8892                 alarm(5);
8893                 ret = read(pd[0], buf, 1);      /* Should read EOF */
8894                 alarm(0);
8895                 sprintf(string, "%d\n", ret);
8896                 write(3, string, strlen(string));
8897                 exit(0);
8898         }
8899
8900         close(pd[0]);                   /* We write to pd[1] */
8901         close(pu[1]);                   /* We read from pu[0] */
8902         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
8903         close(pd[1]);                   /* Pipe pd is now fully closed! */
8904         exit(0);                                /* Bye bye, thank you for playing! */
8905 }
8906 EOCP
8907         set try
8908         if eval $compile_ok; then
8909                 echo "$startsh" >mtry
8910                 echo "./try >try.out 2>try.ret 3>try.err || exit 4" >>mtry
8911                 chmod +x mtry
8912                 ./mtry >/dev/null 2>&1
8913                 case $? in
8914                 0) eagain=`$cat try.out`;;
8915                 1) echo "Could not perform non-blocking setting!";;
8916                 2) echo "I did a successful read() for something that was not there!";;
8917                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
8918                 *) echo "Something terribly wrong happened during testing.";;
8919                 esac
8920                 rd_nodata=`$cat try.ret`
8921                 echo "A read() system call with no data present returns $rd_nodata."
8922                 case "$rd_nodata" in
8923                 0|-1) ;;
8924                 *)
8925                         echo "(That's peculiar, fixing that to be -1.)"
8926                         rd_nodata=-1
8927                         ;;
8928                 esac
8929                 case "$eagain" in
8930                 '')
8931                         echo "Forcing errno EAGAIN on read() with no data available."
8932                         eagain=EAGAIN
8933                         ;;
8934                 *)
8935                         echo "Your read() sets errno to $eagain when no data is available."
8936                         ;;
8937                 esac
8938                 status=`$cat try.err`
8939                 case "$status" in
8940                 0) echo "And it correctly returns 0 to signal EOF.";;
8941                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
8942                 *) echo "However, your read() returns '$status' on EOF??";;
8943                 esac
8944                 val="$define"
8945                 if test "$status" = "$rd_nodata"; then
8946                         echo "WARNING: you can't distinguish between EOF and no data!"
8947                         val="$undef"
8948                 fi
8949         else
8950                 echo "I can't compile the test program--assuming errno EAGAIN will do."
8951                 eagain=EAGAIN
8952         fi
8953         set d_eofnblk
8954         eval $setvar
8955         ;;
8956 *)
8957         echo "Using $hint value $eagain."
8958         echo "Your read() returns $rd_nodata when no data is present."
8959         case "$d_eofnblk" in
8960         "$define") echo "And you can see EOF because read() returns 0.";;
8961         "$undef") echo "But you can't see EOF status from read() returned value.";;
8962         *)
8963                 echo "(Assuming you can't see EOF status from read anyway.)"
8964                 d_eofnblk=$undef
8965                 ;;
8966         esac
8967         ;;
8968 esac
8969 $rm -f try try.* .out core head.c mtry
8970
8971 : see if fchmod exists
8972 set fchmod d_fchmod
8973 eval $inlibc
8974
8975 : see if fchown exists
8976 set fchown d_fchown
8977 eval $inlibc
8978
8979 : see if this is an fcntl system
8980 set fcntl d_fcntl
8981 eval $inlibc
8982
8983 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
8984 while $test $# -ge 2; do
8985         case "$1" in
8986         $define) echo "#include <$2>";;
8987         esac ;
8988     shift 2;
8989 done > try.c;
8990 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
8991 set try;
8992 if eval $compile; then
8993         val="$define";
8994 else
8995         val="$undef";
8996 fi;
8997 set $varname;
8998 eval $setvar;
8999 $rm -f try.c try.o'
9000
9001 socketlib=''
9002 sockethdr=''
9003 : see whether socket exists
9004 echo " "
9005 $echo $n "Hmm... $c" >&4
9006 if set socket val -f d_socket; eval $csym; $val; then
9007         echo "Looks like you have Berkeley networking support." >&4
9008         d_socket="$define"
9009         if set setsockopt val -f; eval $csym; $val; then
9010                 d_oldsock="$undef"
9011         else
9012                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
9013                 d_oldsock="$define"
9014         fi
9015 else
9016         if $contains socklib libc.list >/dev/null 2>&1; then
9017                 echo "Looks like you have Berkeley networking support." >&4
9018                 d_socket="$define"
9019                 : we will have to assume that it supports the 4.2 BSD interface
9020                 d_oldsock="$undef"
9021         else
9022                 echo "You don't have Berkeley networking in libc$_a..." >&4
9023                 if test "X$d_socket" = "X$define"; then
9024                    echo "...but you seem to believe that you have sockets." >&4
9025                 else
9026                         for net in net socket
9027                         do
9028                                 if test -f /usr/lib/lib$net$_a; then
9029                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
9030                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
9031                                         if $contains socket libc.list >/dev/null 2>&1; then
9032                                                 d_socket="$define"
9033                                                 socketlib="-l$net"
9034                                                 case "$net" in
9035                                                 net)
9036                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
9037                                                         sockethdr="-I/usr/netinclude"
9038                                                         ;;
9039                                                 esac
9040                                                 echo "Found Berkeley sockets interface in lib$net." >& 4 
9041                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
9042                                                         d_oldsock="$undef"
9043                                                 else
9044                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
9045                                                         d_oldsock="$define"
9046                                                 fi
9047                                                 break
9048                                         fi
9049                                 fi
9050                         done
9051                         if test "X$d_socket" != "X$define"; then
9052                            echo "or anywhere else I see." >&4
9053                            d_socket="$undef"
9054                            d_oldsock="$undef"
9055                         fi
9056                 fi
9057         fi
9058 fi
9059
9060 : see if socketpair exists
9061 set socketpair d_sockpair
9062 eval $inlibc
9063
9064
9065 echo " "
9066 echo "Checking the availability of certain socket constants..." >& 4
9067 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
9068         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
9069         $cat >try.c <<EOF
9070 #include <sys/types.h>
9071 #include <sys/socket.h>
9072 int main() {
9073     int i = $ENUM;
9074 }
9075 EOF
9076         val="$undef"
9077         set try; if eval $compile; then
9078                 val="$define"
9079         fi
9080         set d_${enum}; eval $setvar
9081         $rm -f try.c try
9082 done
9083
9084 : see if sys/select.h has to be included
9085 set sys/select.h i_sysselct
9086 eval $inhdr
9087
9088 : see if we should include time.h, sys/time.h, or both
9089 echo " "
9090 if test "X$timeincl" = X; then
9091         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
9092         $echo $n "I'm now running the test program...$c"
9093         $cat >try.c <<'EOCP'
9094 #include <sys/types.h>
9095 #ifdef I_TIME
9096 #include <time.h>
9097 #endif
9098 #ifdef I_SYSTIME
9099 #ifdef SYSTIMEKERNEL
9100 #define KERNEL
9101 #endif
9102 #include <sys/time.h>
9103 #endif
9104 #ifdef I_SYSSELECT
9105 #include <sys/select.h>
9106 #endif
9107 int main()
9108 {
9109         struct tm foo;
9110 #ifdef S_TIMEVAL
9111         struct timeval bar;
9112 #endif
9113 #ifdef S_TIMEZONE
9114         struct timezone tzp;
9115 #endif
9116         if (foo.tm_sec == foo.tm_sec)
9117                 exit(0);
9118 #ifdef S_TIMEVAL
9119         if (bar.tv_sec == bar.tv_sec)
9120                 exit(0);
9121 #endif
9122         exit(1);
9123 }
9124 EOCP
9125         flags=''
9126         for s_timezone in '-DS_TIMEZONE' ''; do
9127         sysselect=''
9128         for s_timeval in '-DS_TIMEVAL' ''; do
9129         for i_systimek in '' '-DSYSTIMEKERNEL'; do
9130         for i_time in '' '-DI_TIME'; do
9131         for i_systime in '-DI_SYSTIME' ''; do
9132                 case "$flags" in
9133                 '') $echo $n ".$c"
9134                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
9135                         if eval $compile; then
9136                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
9137                                 shift
9138                                 flags="$*"
9139                                 echo " "
9140                                 $echo $n "Succeeded with $flags$c"
9141                         fi
9142                         ;;
9143                 esac
9144         done
9145         done
9146         done
9147         done
9148         done
9149         timeincl=''
9150         echo " "
9151         case "$flags" in
9152         *SYSTIMEKERNEL*) i_systimek="$define"
9153                 timeincl=`./findhdr sys/time.h`
9154                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
9155         *) i_systimek="$undef";;
9156         esac
9157         case "$flags" in
9158         *I_TIME*) i_time="$define"
9159                 timeincl=`./findhdr time.h`" $timeincl"
9160                 echo "We'll include <time.h>." >&4;;
9161         *) i_time="$undef";;
9162         esac
9163         case "$flags" in
9164         *I_SYSTIME*) i_systime="$define"
9165                 timeincl=`./findhdr sys/time.h`" $timeincl"
9166                 echo "We'll include <sys/time.h>." >&4;;
9167         *) i_systime="$undef";;
9168         esac
9169         $rm -f try.c try
9170 fi
9171
9172 : check for fd_set items
9173 $cat <<EOM
9174
9175 Checking to see how well your C compiler handles fd_set and friends ...
9176 EOM
9177 $cat >fd_set.c <<EOCP
9178 #$i_systime I_SYS_TIME
9179 #$i_sysselct I_SYS_SELECT
9180 #$d_socket HAS_SOCKET
9181 #include <sys/types.h>
9182 #ifdef HAS_SOCKET
9183 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
9184 #endif
9185 #ifdef I_SYS_TIME
9186 #include <sys/time.h>
9187 #endif
9188 #ifdef I_SYS_SELECT
9189 #include <sys/select.h>
9190 #endif
9191 int main() {
9192         fd_set fds;
9193
9194 #ifdef TRYBITS
9195         if(fds.fds_bits);
9196 #endif
9197
9198 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
9199         exit(0);
9200 #else
9201         exit(1);
9202 #endif
9203 }
9204 EOCP
9205 set fd_set -DTRYBITS
9206 if eval $compile; then
9207         d_fds_bits="$define"
9208         d_fd_set="$define"
9209         echo "Well, your system knows about the normal fd_set typedef..." >&4
9210         if ./fd_set; then
9211                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
9212                 d_fd_macros="$define"
9213         else
9214                 $cat >&4 <<'EOM'
9215 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
9216 EOM
9217                 d_fd_macros="$undef"
9218         fi
9219 else
9220         $cat <<'EOM'
9221 Hmm, your compiler has some difficulty with fd_set.  Checking further...
9222 EOM
9223         set fd_set
9224         if eval $compile; then
9225                 d_fds_bits="$undef"
9226                 d_fd_set="$define"
9227                 echo "Well, your system has some sort of fd_set available..." >&4
9228                 if ./fd_set; then
9229                         echo "and you have the normal fd_set macros." >&4
9230                         d_fd_macros="$define"
9231                 else
9232                         $cat <<'EOM'
9233 but not the normal fd_set macros!  Gross!  More work for me...
9234 EOM
9235                         d_fd_macros="$undef"
9236                 fi
9237         else
9238         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
9239                 d_fd_set="$undef"
9240                 d_fds_bits="$undef"
9241                 d_fd_macros="$undef"
9242         fi
9243 fi
9244 $rm -f fd_set*
9245
9246 : see if fgetpos exists
9247 set fgetpos d_fgetpos
9248 eval $inlibc
9249
9250 : see if flock exists
9251 set flock d_flock
9252 eval $inlibc
9253
9254 : see if fork exists
9255 set fork d_fork
9256 eval $inlibc
9257
9258 : see if pathconf exists
9259 set pathconf d_pathconf
9260 eval $inlibc
9261
9262 : see if fpathconf exists
9263 set fpathconf d_fpathconf
9264 eval $inlibc
9265
9266
9267 : check for fpos64_t
9268 echo " "
9269 echo "Checking to see if you have fpos64_t..." >&4
9270 $cat >try.c <<EOCP
9271 #include <stdio.h>
9272 int main() { fpos64_t x = 7; }
9273 EOCP
9274 set try
9275 if eval $compile; then
9276         val="$define"
9277         echo "You have fpos64_t."
9278 else
9279         val="$undef"
9280         echo "You do not have fpos64_t."
9281         case "$fpossize" in
9282         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
9283         esac
9284 fi
9285 $rm -f try.* try
9286 set d_fpos64_t
9287 eval $setvar
9288
9289 : see if frexpl exists
9290 set frexpl d_frexpl
9291 eval $inlibc
9292
9293 hasstruct='varname=$1; struct=$2; shift; shift;
9294 while $test $# -ge 2; do
9295         case "$1" in
9296         $define) echo "#include <$2>";;
9297         esac ;
9298     shift 2;
9299 done > try.c;
9300 echo "int main () { struct $struct foo; }" >> try.c;
9301 set try;
9302 if eval $compile; then
9303         val="$define";
9304 else
9305         val="$undef";
9306 fi;
9307 set $varname;
9308 eval $setvar;
9309 $rm -f try.c try.o'
9310
9311 : see if this is a sys/param system
9312 set sys/param.h i_sysparam
9313 eval $inhdr
9314
9315 : see if this is a sys/mount.h system
9316 set sys/mount.h i_sysmount
9317 eval $inhdr
9318
9319 : see if sys/types.h has to be included
9320 set sys/types.h i_systypes
9321 eval $inhdr
9322
9323
9324 echo " "
9325 echo "Checking to see if your system supports struct fs_data..." >&4
9326 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
9327 eval $hasstruct
9328 case "$d_fs_data_s" in
9329 "$define")      echo "Yes, it does."   ;;
9330 *)              echo "No, it doesn't." ;;
9331 esac
9332
9333 : see if fseeko exists
9334 set fseeko d_fseeko
9335 eval $inlibc
9336 case "$longsize" in
9337 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
9338 esac
9339
9340 : see if fsetpos exists
9341 set fsetpos d_fsetpos
9342 eval $inlibc
9343
9344
9345 : see if fstatfs exists
9346 set fstatfs d_fstatfs
9347 eval $inlibc
9348
9349
9350 : see if statvfs exists
9351 set statvfs d_statvfs
9352 eval $inlibc
9353
9354 : see if fstatvfs exists
9355 set fstatvfs d_fstatvfs
9356 eval $inlibc
9357
9358
9359 : see if ftello exists
9360 set ftello d_ftello
9361 eval $inlibc
9362 case "$longsize" in
9363 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
9364 esac
9365
9366 : see if getcwd exists
9367 set getcwd d_getcwd
9368 eval $inlibc
9369
9370 : see if getespwnam exists
9371 set getespwnam d_getespwnam
9372 eval $inlibc
9373
9374
9375 : see if getfsstat exists
9376 set getfsstat d_getfsstat
9377 eval $inlibc
9378
9379 : see if getgrent exists
9380 set getgrent d_getgrent
9381 eval $inlibc
9382
9383 : see if gethostbyaddr exists
9384 set gethostbyaddr d_gethbyaddr
9385 eval $inlibc
9386
9387 : see if gethostbyname exists
9388 set gethostbyname d_gethbyname
9389 eval $inlibc
9390
9391 : see if gethostent exists
9392 set gethostent d_gethent
9393 eval $inlibc
9394
9395 : see how we will look up host name
9396 echo " "
9397 call=''
9398 if set gethostname val -f d_gethname; eval $csym; $val; then
9399         echo 'gethostname() found.' >&4
9400         d_gethname="$define"
9401         call=gethostname
9402 fi
9403 if set uname val -f d_uname; eval $csym; $val; then
9404         if ./xenix; then
9405                 $cat <<'EOM'
9406 uname() was found, but you're running xenix, and older versions of xenix
9407 have a broken uname(). If you don't really know whether your xenix is old
9408 enough to have a broken system call, use the default answer.
9409
9410 EOM
9411                 dflt=y
9412                 case "$d_uname" in
9413                 "$define") dflt=n;;
9414                 esac
9415                 rp='Is your uname() broken?'
9416                 . ./myread
9417                 case "$ans" in
9418                 n*) d_uname="$define"; call=uname;;
9419                 esac
9420         else
9421                 echo 'uname() found.' >&4
9422                 d_uname="$define"
9423                 case "$call" in
9424                 '') call=uname ;;
9425                 esac
9426         fi
9427 fi
9428 case "$d_gethname" in
9429 '') d_gethname="$undef";;
9430 esac
9431 case "$d_uname" in
9432 '') d_uname="$undef";;
9433 esac
9434 case "$d_uname$d_gethname" in
9435 *define*)
9436         dflt=n
9437         cat <<EOM
9438  
9439 Every now and then someone has a $call() that lies about the hostname
9440 but can't be fixed for political or economic reasons.  If you wish, I can
9441 pretend $call() isn't there and maybe compute hostname at run-time
9442 thanks to the '$phostname' command.
9443
9444 EOM
9445         rp="Shall I ignore $call() from now on?"
9446         . ./myread
9447         case "$ans" in
9448         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
9449         esac;;
9450 esac
9451 case "$phostname" in
9452 '') aphostname='';;
9453 *) case "$aphostname" in
9454         /*) ;;
9455         *) set X $phostname
9456                 shift
9457                 file=$1
9458                 shift
9459                 file=`./loc $file $file $pth`
9460                 aphostname=`echo $file $*`
9461                 ;;
9462         esac
9463         ;;
9464 esac
9465 case "$d_uname$d_gethname" in
9466 *define*) ;;
9467 *)
9468         case "$phostname" in
9469         '')
9470                 echo "There will be no way for $package to get your hostname." >&4;;
9471         *)
9472         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
9473                 ;;
9474         esac;;
9475 esac
9476 case "$d_phostname" in
9477 '') d_phostname="$undef";;
9478 esac
9479
9480 : see if this is a netdb.h system
9481 set netdb.h i_netdb
9482 eval $inhdr
9483
9484 : see if prototypes for various gethostxxx netdb.h functions are available
9485 echo " "
9486 set d_gethostprotos gethostent $i_netdb netdb.h
9487 eval $hasproto
9488
9489 : see if getlogin exists
9490 set getlogin d_getlogin
9491 eval $inlibc
9492
9493 : see if getmnt exists
9494 set getmnt d_getmnt
9495 eval $inlibc
9496
9497 : see if getmntent exists
9498 set getmntent d_getmntent
9499 eval $inlibc
9500
9501 : see if getnetbyaddr exists
9502 set getnetbyaddr d_getnbyaddr
9503 eval $inlibc
9504
9505 : see if getnetbyname exists
9506 set getnetbyname d_getnbyname
9507 eval $inlibc
9508
9509 : see if getnetent exists
9510 set getnetent d_getnent
9511 eval $inlibc
9512
9513 : see if prototypes for various getnetxxx netdb.h functions are available
9514 echo " "
9515 set d_getnetprotos getnetent $i_netdb netdb.h
9516 eval $hasproto
9517
9518
9519 : see if getprotobyname exists
9520 set getprotobyname d_getpbyname
9521 eval $inlibc
9522
9523 : see if getprotobynumber exists
9524 set getprotobynumber d_getpbynumber
9525 eval $inlibc
9526
9527 : see if getprotoent exists
9528 set getprotoent d_getpent
9529 eval $inlibc
9530
9531 : see if getpgid exists
9532 set getpgid d_getpgid
9533 eval $inlibc
9534
9535 : see if getpgrp2 exists
9536 set getpgrp2 d_getpgrp2
9537 eval $inlibc
9538
9539 : see if getppid exists
9540 set getppid d_getppid
9541 eval $inlibc
9542
9543 : see if getpriority exists
9544 set getpriority d_getprior
9545 eval $inlibc
9546
9547 : see if prototypes for various getprotoxxx netdb.h functions are available
9548 echo " "
9549 set d_getprotoprotos getprotoent $i_netdb netdb.h
9550 eval $hasproto
9551
9552 : see if getprpwnam exists
9553 set getprpwnam d_getprpwnam
9554 eval $inlibc
9555
9556 : see if getpwent exists
9557 set getpwent d_getpwent
9558 eval $inlibc
9559
9560
9561 : see if getservbyname exists
9562 set getservbyname d_getsbyname
9563 eval $inlibc
9564
9565 : see if getservbyport exists
9566 set getservbyport d_getsbyport
9567 eval $inlibc
9568
9569 : see if getservent exists
9570 set getservent d_getsent
9571 eval $inlibc
9572
9573 : see if prototypes for various getservxxx netdb.h functions are available
9574 echo " "
9575 set d_getservprotos getservent $i_netdb netdb.h
9576 eval $hasproto
9577
9578 : see if getspnam exists
9579 set getspnam d_getspnam
9580 eval $inlibc
9581
9582 : see if gettimeofday or ftime exists
9583 set gettimeofday d_gettimeod
9584 eval $inlibc
9585 case "$d_gettimeod" in
9586 "$undef")
9587         set ftime d_ftime 
9588         eval $inlibc
9589         ;;
9590 *)
9591         val="$undef"; set d_ftime; eval $setvar
9592         ;;
9593 esac
9594 case "$d_gettimeod$d_ftime" in
9595 "$undef$undef")
9596         echo " "
9597         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
9598         ;;
9599 esac
9600
9601 : see if this is an grp system
9602 set grp.h i_grp
9603 eval $inhdr
9604
9605 case "$i_grp" in
9606 $define)
9607         xxx=`./findhdr grp.h`
9608         $cppstdin $cppflags $cppminus < $xxx >$$.h
9609
9610         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
9611                 val="$define"
9612         else
9613                 val="$undef"
9614         fi
9615         set d_grpasswd
9616         eval $setvar
9617
9618         $rm -f $$.h
9619         ;;
9620 *)
9621         val="$undef";
9622         set d_grpasswd; eval $setvar
9623         ;;
9624 esac
9625
9626 : see if hasmntopt exists
9627 set hasmntopt d_hasmntopt
9628 eval $inlibc
9629
9630 : see if this is a netinet/in.h or sys/in.h system
9631 set netinet/in.h i_niin sys/in.h i_sysin
9632 eval $inhdr
9633
9634 : see if arpa/inet.h has to be included
9635 set arpa/inet.h i_arpainet
9636 eval $inhdr
9637
9638 : see if htonl --and friends-- exists
9639 val=''
9640 set htonl val
9641 eval $inlibc
9642
9643 : Maybe they are macros.
9644 case "$val" in
9645 $undef)
9646         $cat >htonl.c <<EOM
9647 #include <stdio.h>
9648 #include <sys/types.h>
9649 #$i_niin I_NETINET_IN
9650 #$i_sysin I_SYS_IN
9651 #$i_arpainet I_ARPA_INET
9652 #ifdef I_NETINET_IN
9653 #include <netinet/in.h>
9654 #endif
9655 #ifdef I_SYS_IN
9656 #include <sys/in.h>
9657 #endif
9658 #ifdef I_ARPA_INET
9659 #include <arpa/inet.h>
9660 #endif
9661 #ifdef htonl
9662 printf("Defined as a macro.");
9663 #endif
9664 EOM
9665         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
9666         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
9667                 val="$define"
9668                 echo "But it seems to be defined as a macro." >&4
9669         fi
9670         $rm -f htonl.?
9671         ;;
9672 esac
9673 set d_htonl
9674 eval $setvar
9675
9676 : see if iconv exists
9677 set iconv d_iconv
9678 eval $inlibc
9679
9680 : index or strchr
9681 echo " "
9682 if set index val -f; eval $csym; $val; then
9683         if set strchr val -f d_strchr; eval $csym; $val; then
9684                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
9685                         val="$define"
9686                         vali="$undef"
9687                         echo "strchr() found." >&4
9688                 else
9689                         val="$undef"
9690                         vali="$define"
9691                         echo "index() found." >&4
9692                 fi
9693         else
9694                 val="$undef"
9695                 vali="$define"
9696                 echo "index() found." >&4
9697         fi
9698 else
9699         if set strchr val -f d_strchr; eval $csym; $val; then
9700                 val="$define"
9701                 vali="$undef"
9702                 echo "strchr() found." >&4
9703         else
9704                 echo "No index() or strchr() found!" >&4
9705                 val="$undef"
9706                 vali="$undef"
9707         fi
9708 fi
9709 set d_strchr; eval $setvar
9710 val="$vali"
9711 set d_index; eval $setvar
9712
9713 : check whether inet_aton exists
9714 set inet_aton d_inetaton
9715 eval $inlibc
9716
9717 : see if inttypes.h is available
9718 : we want a real compile instead of Inhdr because some systems
9719 : have an inttypes.h which includes non-existent headers
9720 echo " "
9721 $cat >try.c <<EOCP
9722 #include <inttypes.h>
9723 int main() {
9724         static int32_t foo32 = 0x12345678;
9725 }
9726 EOCP
9727 set try
9728 if eval $compile; then
9729         echo "<inttypes.h> found." >&4
9730         val="$define"
9731 else
9732         echo "<inttypes.h> NOT found." >&4
9733         val="$undef"
9734 fi
9735 $rm -f try.c try
9736 set i_inttypes
9737 eval $setvar
9738
9739 : check for int64_t
9740 echo " "
9741 echo "Checking to see if you have int64_t..." >&4
9742 $cat >try.c <<EOCP
9743 #include <sys/types.h>
9744 #$i_inttypes I_INTTYPES
9745 #ifdef I_INTTYPES
9746 #include <inttypes.h>
9747 #endif
9748 int main() { int64_t x = 7; }
9749 EOCP
9750 set try
9751 if eval $compile; then
9752         val="$define"
9753         echo "You have int64_t."
9754 else
9755         val="$undef"
9756         echo "You do not have int64_t."
9757 fi
9758 $rm -f try try.*
9759 set d_int64_t
9760 eval $setvar
9761
9762 : Look for isascii
9763 echo " "
9764 $cat >isascii.c <<'EOCP'
9765 #include <stdio.h>
9766 #include <ctype.h>
9767 int main() {
9768         int c = 'A';
9769         if (isascii(c))
9770                 exit(0);
9771         else
9772                 exit(1);
9773 }
9774 EOCP
9775 set isascii
9776 if eval $compile; then
9777         echo "isascii() found." >&4
9778         val="$define"
9779 else
9780         echo "isascii() NOT found." >&4
9781         val="$undef"
9782 fi
9783 set d_isascii
9784 eval $setvar
9785 $rm -f isascii*
9786
9787 : see if isnan exists
9788 set isnan d_isnan
9789 eval $inlibc
9790
9791 : see if isnanl exists
9792 set isnanl d_isnanl
9793 eval $inlibc
9794
9795 : see if killpg exists
9796 set killpg d_killpg
9797 eval $inlibc
9798
9799 : see if lchown exists
9800 echo " "
9801 $cat > try.c <<'EOCP'
9802 /* System header to define __stub macros and hopefully few prototypes,
9803     which can conflict with char lchown(); below.  */
9804 #include <assert.h>
9805 /* Override any gcc2 internal prototype to avoid an error.  */
9806 /* We use char because int might match the return type of a gcc2
9807    builtin and then its argument prototype would still apply.  */
9808 char lchown();
9809 int main() {
9810     /*  The GNU C library defines this for functions which it implements
9811         to always fail with ENOSYS.  Some functions are actually named
9812         something starting with __ and the normal name is an alias.  */
9813 #if defined (__stub_lchown) || defined (__stub___lchown)
9814 choke me
9815 #else
9816 lchown();
9817 #endif
9818 ; return 0; }
9819 EOCP
9820 set try
9821 if eval $compile; then
9822     $echo "lchown() found." >&4
9823     val="$define"
9824 else
9825     $echo "lchown() NOT found." >&4
9826     val="$undef"
9827 fi
9828 set d_lchown
9829 eval $setvar
9830
9831 : See if number of significant digits in a double precision number is known
9832 echo " "
9833 $cat >ldbl_dig.c <<EOM
9834 #$i_limits I_LIMITS
9835 #$i_float I_FLOAT
9836 #ifdef I_LIMITS
9837 #include <limits.h>
9838 #endif
9839 #ifdef I_FLOAT
9840 #include <float.h>
9841 #endif
9842 #ifdef LDBL_DIG
9843 printf("Contains LDBL_DIG");
9844 #endif
9845 EOM
9846 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
9847 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
9848         echo "LDBL_DIG found." >&4
9849         val="$define"
9850 else
9851         echo "LDBL_DIG NOT found." >&4
9852         val="$undef"
9853 fi
9854 $rm -f ldbl_dig.?
9855 set d_ldbl_dig
9856 eval $setvar
9857
9858 : see if link exists
9859 set link d_link
9860 eval $inlibc
9861
9862 : see if localeconv exists
9863 set localeconv d_locconv
9864 eval $inlibc
9865
9866 : see if lockf exists
9867 set lockf d_lockf
9868 eval $inlibc
9869
9870 : check for long long
9871 echo " "
9872 echo "Checking to see if you have long long..." >&4
9873 echo 'int main() { long long x = 7; return 0; }' > try.c
9874 set try
9875 if eval $compile; then
9876         val="$define"
9877         echo "You have long long."
9878 else
9879         val="$undef"
9880         echo "You do not have long long."
9881 fi
9882 $rm try.*
9883 set d_longlong
9884 eval $setvar
9885
9886 : check for length of long long
9887 case "${d_longlong}${longlongsize}" in
9888 $define)
9889         echo " "
9890         echo "Checking to see how big your long longs are..." >&4
9891         $cat >try.c <<'EOCP'
9892 #include <stdio.h>
9893 int main()
9894 {
9895     printf("%d\n", (int)sizeof(long long));
9896     return(0);
9897 }
9898 EOCP
9899         set try
9900         if eval $compile_ok; then
9901                 longlongsize=`./try$exe_ext`
9902                 echo "Your long longs are $longlongsize bytes long."
9903         else
9904                 dflt='8'
9905                 echo " "
9906                 echo "(I can't seem to compile the test program.  Guessing...)"
9907                 rp="What is the size of a long long (in bytes)?"
9908                 . ./myread
9909                 longlongsize="$ans"
9910         fi
9911         if $test "X$longsize" = "X$longlongsize"; then
9912                 echo "(That isn't any different from an ordinary long.)"
9913         fi      
9914         ;;
9915 esac
9916 $rm -f try.* try
9917
9918 : see if prototype for lseek is available
9919 echo " "
9920 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
9921 eval $hasproto
9922
9923 : see if lstat exists
9924 set lstat d_lstat
9925 eval $inlibc
9926
9927 : see if madvise exists
9928 set madvise d_madvise
9929 eval $inlibc
9930
9931 : see if mblen exists
9932 set mblen d_mblen
9933 eval $inlibc
9934
9935 : see if mbstowcs exists
9936 set mbstowcs d_mbstowcs
9937 eval $inlibc
9938
9939 : see if mbtowc exists
9940 set mbtowc d_mbtowc
9941 eval $inlibc
9942
9943 : see if memchr exists
9944 set memchr d_memchr
9945 eval $inlibc
9946
9947 : see if memcmp exists
9948 set memcmp d_memcmp
9949 eval $inlibc
9950
9951 : see if memcpy exists
9952 set memcpy d_memcpy
9953 eval $inlibc
9954
9955 : see if memmove exists
9956 set memmove d_memmove
9957 eval $inlibc
9958
9959 : see if memset exists
9960 set memset d_memset
9961 eval $inlibc
9962
9963 : see if mkdir exists
9964 set mkdir d_mkdir
9965 eval $inlibc
9966
9967 : see if mkdtemp exists
9968 set mkdtemp d_mkdtemp
9969 eval $inlibc
9970
9971 : see if mkfifo exists
9972 set mkfifo d_mkfifo
9973 eval $inlibc
9974
9975 : see if mkstemp exists
9976 set mkstemp d_mkstemp
9977 eval $inlibc
9978
9979 : see if mkstemps exists
9980 set mkstemps d_mkstemps
9981 eval $inlibc
9982
9983 : see if mktime exists
9984 set mktime d_mktime
9985 eval $inlibc
9986
9987 : see if this is a sys/mman.h system
9988 set sys/mman.h i_sysmman
9989 eval $inhdr
9990
9991 : see if mmap exists
9992 set mmap d_mmap
9993 eval $inlibc
9994 : see what shmat returns
9995 : default to something harmless
9996 mmaptype='void *'
9997 case "$i_sysmman$d_mmap" in
9998 "$define$define")
9999         $cat >mmap.c <<'END'
10000 #include <sys/mman.h>
10001 void *mmap();
10002 END
10003         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
10004                 mmaptype='void *'
10005         else
10006                 mmaptype='caddr_t'
10007         fi
10008         echo "and it returns ($mmaptype)." >&4
10009         ;;
10010 esac
10011
10012
10013
10014 : see if modfl exists
10015 set modfl d_modfl
10016 eval $inlibc
10017
10018 : see if mprotect exists
10019 set mprotect d_mprotect
10020 eval $inlibc
10021
10022 : see if msgctl exists
10023 set msgctl d_msgctl
10024 eval $inlibc
10025
10026 : see if msgget exists
10027 set msgget d_msgget
10028 eval $inlibc
10029
10030 : see if msgsnd exists
10031 set msgsnd d_msgsnd
10032 eval $inlibc
10033
10034 : see if msgrcv exists
10035 set msgrcv d_msgrcv
10036 eval $inlibc
10037
10038 : see how much of the 'msg*(2)' library is present.
10039 h_msg=true
10040 echo " "
10041 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
10042 *"$undef"*) h_msg=false;;
10043 esac
10044 case "$osname" in
10045 freebsd)
10046     case "`ipcs 2>&1`" in
10047     "SVID messages"*"not configured"*)
10048         echo "Your $osname does not have the msg*(2) configured." >&4
10049         h_msg=false
10050         val="$undef"
10051         set msgctl d_msgctl
10052         eval $setvar
10053         set msgget d_msgget
10054         eval $setvar
10055         set msgsnd d_msgsnd
10056         eval $setvar
10057         set msgrcv d_msgrcv
10058         eval $setvar
10059         ;;
10060     esac
10061     ;;
10062 esac
10063 : we could also check for sys/ipc.h ...
10064 if $h_msg && $test `./findhdr sys/msg.h`; then
10065         echo "You have the full msg*(2) library." >&4
10066         val="$define"
10067 else
10068         echo "You don't have the full msg*(2) library." >&4
10069         val="$undef"
10070 fi
10071 set d_msg
10072 eval $setvar
10073
10074 : see if msync exists
10075 set msync d_msync
10076 eval $inlibc
10077
10078 : see if munmap exists
10079 set munmap d_munmap
10080 eval $inlibc
10081
10082 : see if nice exists
10083 set nice d_nice
10084 eval $inlibc
10085
10086
10087 echo " "
10088 echo "Checking which 64-bit integer type we could use..." >&4
10089
10090 case "$intsize" in
10091 8) val=int
10092    set quadtype
10093    eval $setvar
10094    val='"unsigned int"'
10095    set uquadtype
10096    eval $setvar
10097    quadkind=1
10098    ;;
10099 *) case "$longsize" in
10100    8) val=long
10101       set quadtype
10102       eval $setvar
10103       val='"unsigned long"'
10104       set uquadtype
10105       eval $setvar
10106       quadkind=2
10107       ;;
10108    *) case "$d_longlong:$longlongsize" in
10109       define:8)
10110         val='"long long"'
10111         set quadtype
10112         eval $setvar
10113         val='"unsigned long long"'
10114         set uquadtype
10115         eval $setvar
10116         quadkind=3
10117         ;;
10118       *) case "$d_int64_t" in
10119          define)
10120            val=int64_t
10121            set quadtype
10122            eval $setvar
10123            val=uint64_t
10124            set uquadtype
10125            eval $setvar
10126            quadkind=4
10127            ;;
10128          esac
10129          ;;
10130       esac
10131       ;;
10132    esac
10133    ;;
10134 esac
10135
10136 case "$quadtype" in
10137 '')     echo "Alas, no 64-bit integer types in sight." >&4
10138         d_quad="$undef"
10139         ;;
10140 *)      if test X"$use64bitint" = Xdefine -o X"$longsize" = X8; then
10141             verb="will"
10142         else
10143             verb="could"
10144         fi
10145         echo "We $verb use '$quadtype' for 64-bit integers." >&4
10146         d_quad="$define"
10147         ;;
10148 esac
10149
10150 : check for length of character
10151 echo " "
10152 case "$charsize" in
10153 '')
10154         echo "Checking to see how big your characters are (hey, you never know)..." >&4
10155         $cat >try.c <<'EOCP'
10156 #include <stdio.h>
10157 int main()
10158 {
10159     printf("%d\n", (int)sizeof(char));
10160     exit(0);
10161 }
10162 EOCP
10163         set try
10164         if eval $compile_ok; then
10165                 dflt=`./try`
10166         else
10167                 dflt='1'
10168                 echo "(I can't seem to compile the test program.  Guessing...)"
10169         fi
10170         ;;
10171 *)
10172         dflt="$charsize"
10173         ;;
10174 esac
10175 rp="What is the size of a character (in bytes)?"
10176 . ./myread
10177 charsize="$ans"
10178 $rm -f try.c try
10179
10180
10181 echo " "
10182 $echo "Choosing the C types to be used for Perl's internal types..." >&4
10183
10184 case "$use64bitint:$d_quad:$quadtype" in
10185 define:define:?*)
10186         ivtype="$quadtype"
10187         uvtype="$uquadtype"
10188         ivsize=8
10189         uvsize=8
10190         ;;
10191 *)      ivtype="long"
10192         uvtype="unsigned long"
10193         ivsize=$longsize
10194         uvsize=$longsize
10195         ;;
10196 esac
10197
10198 case "$uselongdouble:$d_longdbl" in
10199 define:define)
10200         nvtype="long double"
10201         nvsize=$longdblsize
10202         ;;
10203 *)      nvtype=double
10204         nvsize=$doublesize
10205         ;;
10206 esac
10207
10208 $echo "(IV will be "$ivtype", $ivsize bytes)"
10209 $echo "(UV will be "$uvtype", $uvsize bytes)"
10210 $echo "(NV will be "$nvtype", $nvsize bytes)"
10211
10212 $cat >try.c <<EOCP
10213 #$i_inttypes I_INTTYPES
10214 #ifdef I_INTTYPES
10215 #include <inttypes.h>
10216 #endif
10217 #include <stdio.h>
10218 int main() {
10219 #ifdef INT8
10220    int8_t i =  INT8_MAX;
10221   uint8_t u = UINT8_MAX;
10222   printf("int8_t\n");
10223 #endif
10224 #ifdef INT16
10225    int16_t i =  INT16_MAX;
10226   uint16_t i = UINT16_MAX;
10227   printf("int16_t\n");
10228 #endif
10229 #ifdef INT32
10230    int32_t i =  INT32_MAX;
10231   uint32_t u = UINT32_MAX;
10232   printf("int32_t\n");
10233 #endif
10234 }
10235 EOCP
10236
10237 case "$i8type" in
10238 '')     case "$charsize" in
10239         1)      i8type=char
10240                 u8type="unsigned char"
10241                 i8size=$charsize
10242                 u8size=$charsize
10243                 ;;
10244         esac
10245         ;;
10246 esac
10247 case "$i8type" in
10248 '')     set try -DINT8
10249         if eval $compile; then
10250                 case "`./try$exe_ext`" in
10251                 int8_t) i8type=int8_t
10252                         u8type=uint8_t
10253                         i8size=1
10254                         u8size=1
10255                         ;;
10256                 esac
10257         fi
10258         ;;
10259 esac
10260 case "$i8type" in
10261 '')     if $test $charsize -ge 1; then
10262                 i8type=char
10263                 u8type="unsigned char"
10264                 i8size=$charsize
10265                 u8size=$charsize
10266         fi
10267         ;;
10268 esac
10269
10270 case "$i16type" in
10271 '')     case "$shortsize" in
10272         2)      i16type=short
10273                 u16type="unsigned short"
10274                 i16size=$shortsize
10275                 u16size=$shortsize
10276                 ;;
10277         esac
10278         ;;
10279 esac
10280 case "$i16type" in
10281 '')     set try -DINT16
10282         if eval $compile; then
10283                 case "`./try$exe_ext`" in
10284                 int16_t)
10285                         i16type=int16_t
10286                         u16type=uint16_t
10287                         i16size=2
10288                         u16size=2
10289                         ;;
10290                 esac
10291         fi
10292         ;;
10293 esac
10294 case "$i16type" in
10295 '')     if $test $shortsize -ge 2; then
10296                 i16type=short
10297                 u16type="unsigned short"
10298                 i16size=$shortsize
10299                 u16size=$shortsize
10300         fi
10301         ;;
10302 esac
10303
10304 case "$i32type" in
10305 '')     case "$longsize" in
10306         4)      i32type=long
10307                 u32type="unsigned long"
10308                 i32size=$longsize
10309                 u32size=$longsize
10310                 ;;
10311         *)      case "$intsize" in
10312                 4)      i32type=int
10313                         u32type="unsigned int"
10314                         i32size=$intsize
10315                         u32size=$intsize
10316                         ;;
10317                 esac
10318                 ;;
10319         esac
10320         ;;
10321 esac
10322 case "$i32type" in
10323 '')     set try -DINT32
10324         if eval $compile; then
10325                 case "`./try$exe_ext`" in
10326                 int32_t)
10327                         i32type=int32_t
10328                         u32type=uint32_t
10329                         i32size=4
10330                         u32size=4
10331                         ;;
10332                 esac
10333         fi
10334         ;;
10335 esac
10336 case "$i32type" in
10337 '')     if $test $intsize -ge 4; then
10338                 i32type=int
10339                 u32type="unsigned int"
10340                 i32size=$intsize
10341                 u32size=$intsize
10342         fi
10343         ;;
10344 esac
10345
10346 case "$i64type" in
10347 '')     case "$d_quad:$quadtype" in
10348         define:?*)
10349                 i64type="$quadtype"
10350                 u64type="$uquadtype"
10351                 i64size=8
10352                 u64size=8
10353                 ;;
10354         esac
10355         ;;
10356 esac
10357
10358 $echo "Checking whether your NVs can preserve your UVs..." >&4
10359 $cat <<EOP >try.c
10360 #include <stdio.h>
10361 int main() {
10362     $uvtype k = ($uvtype)~0, l;
10363     $nvtype d;
10364     l = k;
10365     d = ($nvtype)l;
10366     l = ($uvtype)d;
10367     if (l == k)
10368        printf("preserve\n");
10369     exit(0);
10370 }
10371 EOP
10372 set try
10373 if eval $compile; then
10374         case "`./try$exe_ext`" in
10375         preserve) d_nv_preserves_uv="$define" ;;
10376         esac
10377 fi      
10378 case "$d_nv_preserves_uv" in
10379 $define) $echo "Yes, they can."  2>&1 ;;
10380 *)       $echo "No, they can't." 2>&1
10381          d_nv_preserves_uv="$undef"
10382          ;;
10383 esac
10384
10385 $rm -f try.* try
10386
10387 case "$d_nv_preserves_uv" in
10388 "$define") d_nv_preserves_uv_bits=`expr $uvsize \* 8` ;;
10389 *)      $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
10390         $cat <<EOP >try.c
10391 #include <stdio.h>
10392 int main() {
10393     $uvtype u = 0;
10394     int     n = 8 * $uvsize;
10395     int     i;
10396     for (i = 0; i < n; i++) {
10397       u = u << 1 | ($uvtype)1;
10398       if (($uvtype)($nvtype)u != u)
10399         break;
10400     }
10401     printf("%d\n", i);
10402     exit(0);
10403 }
10404 EOP
10405         set try
10406         if eval $compile; then
10407                 d_nv_preserves_uv_bits="`./try$exe_ext`"
10408         fi
10409         case "$d_nv_preserves_uv_bits" in
10410         [1-9]*) $echo "Your NVs can preserve $d_nv_preserves_uv_bits bits of your UVs."  2>&1 ;;
10411         *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
10412                 d_nv_preserves_uv_bits="$undef"
10413                 ;;
10414         esac
10415         $rm -f try.* try
10416         ;;
10417 esac
10418
10419
10420
10421 : check for off64_t
10422 echo " "
10423 echo "Checking to see if you have off64_t..." >&4
10424 $cat >try.c <<EOCP
10425 #include <sys/types.h>
10426 #include <unistd.h>
10427 int main() { off64_t x = 7; }
10428 EOCP
10429 set try
10430 if eval $compile; then
10431         val="$define"
10432         echo "You have off64_t."
10433 else
10434         val="$undef"
10435         echo "You do not have off64_t."
10436         case "$lseeksize" in
10437         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
10438         esac
10439 fi
10440 $rm -f try.* try
10441 set d_off64_t
10442 eval $setvar
10443
10444 : see if POSIX threads are available
10445 set pthread.h i_pthread
10446 eval $inhdr
10447
10448
10449
10450
10451 : how to create joinable pthreads
10452 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
10453         echo " "
10454         echo "Checking what constant to use for creating joinable pthreads..." >&4 
10455         $cat >try.c <<'EOCP'
10456 #include <pthread.h>
10457 int main() {
10458     int detachstate = JOINABLE;
10459 }
10460 EOCP
10461         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
10462         if eval $compile; then
10463                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
10464                 val="$undef" # Yes, undef.
10465                 set d_old_pthread_create_joinable
10466                 eval $setvar
10467                 val=""
10468                 set old_pthread_create_joinable
10469                 eval $setvar
10470         else
10471                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
10472                 if eval $compile; then
10473                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
10474                         val="$define"
10475                         set d_old_pthread_create_joinable
10476                         eval $setvar
10477                         val=PTHREAD_CREATE_UNDETACHED
10478                         set old_pthread_create_joinable
10479                         eval $setvar
10480                 else            
10481                         set try -DJOINABLE=__UNDETACHED
10482                         if eval $compile; then
10483                                 echo "You seem to use __UNDETACHED." >&4
10484                                 val="$define"
10485                                 set d_old_pthread_create_joinable
10486                                 eval $setvar
10487                                 val=__UNDETACHED
10488                                 set old_pthread_create_joinable
10489                                 eval $setvar
10490                         else
10491                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
10492                                 val="$define"
10493                                 set d_old_pthread_create_joinable
10494                                 eval $setvar
10495                                 val=0
10496                                 set old_pthread_create_joinable
10497                                 eval $setvar
10498                         fi
10499                 fi
10500         fi
10501         $rm -f try try.*
10502 else
10503     d_old_pthread_create_joinable="$undef"
10504     old_pthread_create_joinable=""
10505 fi
10506
10507 : see if pause exists
10508 set pause d_pause
10509 eval $inlibc
10510
10511 : see if pipe exists
10512 set pipe d_pipe
10513 eval $inlibc
10514
10515 : see if poll exists
10516 set poll d_poll
10517 eval $inlibc
10518
10519
10520 : see whether the various POSIXish _yields exist
10521 $cat >try.c <<EOP
10522 #include <pthread.h>
10523 #include <stdio.h>
10524 int main() {
10525 #ifdef SCHED_YIELD
10526         sched_yield();
10527 #else
10528 #ifdef PTHREAD_YIELD
10529         pthread_yield();
10530 #else
10531 #ifdef PTHREAD_YIELD_NULL
10532         pthread_yield(NULL);
10533 #endif
10534 #endif
10535 #endif
10536 }
10537 EOP
10538 : see if sched_yield exists
10539 set try -DSCHED_YIELD
10540 if eval $compile; then
10541     val="$define"
10542     sched_yield='sched_yield()'
10543 else
10544     val="$undef"
10545 fi
10546 case "$usethreads" in
10547 $define)
10548         case "$val" in
10549         $define) echo 'sched_yield() found.' >&4        ;;
10550         *)       echo 'sched_yield() NOT found.' >&4    ;;
10551         esac
10552 esac
10553 set d_sched_yield
10554 eval $setvar
10555
10556 : see if pthread_yield exists
10557 set try -DPTHREAD_YIELD
10558 if eval $compile; then
10559     val="$define"
10560     case "$sched_yield" in
10561     '') sched_yield='pthread_yield()' ;;
10562     esac
10563 else
10564     set try -DPTHREAD_YIELD_NULL
10565     if eval $compile; then
10566         val="$define"
10567         case "$sched_yield" in
10568         '') sched_yield='pthread_yield(NULL)' ;;
10569         esac
10570     else
10571         val="$undef"
10572     fi
10573 fi
10574 case "$usethreads" in
10575 $define)
10576         case "$val" in
10577         $define) echo 'pthread_yield() found.' >&4      ;;
10578         *)       echo 'pthread_yield() NOT found.' >&4  ;;
10579         esac
10580         ;;
10581 esac
10582 set d_pthread_yield
10583 eval $setvar
10584
10585 case "$sched_yield" in
10586 '') sched_yield=undef ;;
10587 esac
10588
10589 $rm -f try try.*
10590
10591 : see if this is a pwd.h system
10592 set pwd.h i_pwd
10593 eval $inhdr
10594
10595 case "$i_pwd" in
10596 $define)
10597         xxx=`./findhdr pwd.h`
10598         $cppstdin $cppflags $cppminus < $xxx >$$.h
10599
10600         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
10601                 val="$define"
10602         else
10603                 val="$undef"
10604         fi
10605         set d_pwquota
10606         eval $setvar
10607
10608         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
10609                 val="$define"
10610         else
10611                 val="$undef"
10612         fi
10613         set d_pwage
10614         eval $setvar
10615
10616         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
10617                 val="$define"
10618         else
10619                 val="$undef"
10620         fi
10621         set d_pwchange
10622         eval $setvar
10623
10624         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
10625                 val="$define"
10626         else
10627                 val="$undef"
10628         fi
10629         set d_pwclass
10630         eval $setvar
10631
10632         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
10633                 val="$define"
10634         else
10635                 val="$undef"
10636         fi
10637         set d_pwexpire
10638         eval $setvar
10639
10640         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
10641                 val="$define"
10642         else
10643                 val="$undef"
10644         fi
10645         set d_pwcomment
10646         eval $setvar
10647
10648         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
10649                 val="$define"
10650         else
10651                 val="$undef"
10652         fi
10653         set d_pwgecos
10654         eval $setvar
10655
10656         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
10657                 val="$define"
10658         else
10659                 val="$undef"
10660         fi
10661         set d_pwpasswd
10662         eval $setvar
10663
10664         $rm -f $$.h
10665         ;;
10666 *)
10667         val="$undef"; 
10668         set d_pwquota; eval $setvar
10669         set d_pwage; eval $setvar
10670         set d_pwchange; eval $setvar
10671         set d_pwclass; eval $setvar
10672         set d_pwexpire; eval $setvar
10673         set d_pwcomment; eval $setvar
10674         set d_pwgecos; eval $setvar
10675         set d_pwpasswd; eval $setvar
10676         ;;
10677 esac
10678
10679 : see if readdir and friends exist
10680 set readdir d_readdir
10681 eval $inlibc
10682 set seekdir d_seekdir
10683 eval $inlibc
10684 set telldir d_telldir
10685 eval $inlibc
10686 set rewinddir d_rewinddir
10687 eval $inlibc
10688
10689 : see if readlink exists
10690 set readlink d_readlink
10691 eval $inlibc
10692
10693 : see if rename exists
10694 set rename d_rename
10695 eval $inlibc
10696
10697 : see if rmdir exists
10698 set rmdir d_rmdir
10699 eval $inlibc
10700
10701 : see if memory.h is available.
10702 val=''
10703 set memory.h val
10704 eval $inhdr
10705
10706 : See if it conflicts with string.h
10707 case "$val" in
10708 $define)
10709         case "$strings" in
10710         '') ;;
10711         *)
10712                 $cppstdin $cppflags $cppminus < $strings > mem.h
10713                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
10714                         echo " "
10715                         echo "We won't be including <memory.h>."
10716                         val="$undef"
10717                 fi
10718                 $rm -f mem.h
10719                 ;;
10720         esac
10721 esac
10722 set i_memory
10723 eval $setvar
10724
10725 : can bcopy handle overlapping blocks?
10726 val="$undef"
10727 case "$d_bcopy" in
10728 "$define")
10729         echo " "
10730         echo "Checking to see if your bcopy() can do overlapping copies..." >&4
10731         $cat >try.c <<EOCP
10732 #$i_memory I_MEMORY
10733 #$i_stdlib I_STDLIB
10734 #$i_string I_STRING
10735 #$i_unistd I_UNISTD
10736 EOCP
10737         $cat >>try.c <<'EOCP'
10738 #include <stdio.h>
10739 #ifdef I_MEMORY
10740 #  include <memory.h>
10741 #endif
10742 #ifdef I_STDLIB
10743 #  include <stdlib.h>
10744 #endif
10745 #ifdef I_STRING
10746 #  include <string.h>
10747 #else
10748 #  include <strings.h>
10749 #endif
10750 #ifdef I_UNISTD
10751 #  include <unistd.h>  /* Needed for NetBSD */
10752 #endif
10753 int main()
10754 {
10755 char buf[128], abc[128];
10756 char *b;
10757 int len;
10758 int off;
10759 int align;
10760
10761 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
10762
10763 for (align = 7; align >= 0; align--) {
10764         for (len = 36; len; len--) {
10765                 b = buf+align;
10766                 bcopy(abc, b, len);
10767                 for (off = 1; off <= len; off++) {
10768                         bcopy(b, b+off, len);
10769                         bcopy(b+off, b, len);
10770                         if (bcmp(b, abc, len))
10771                                 exit(1);
10772                 }
10773         }
10774 }
10775 exit(0);
10776 }
10777 EOCP
10778         set try
10779         if eval $compile_ok; then
10780                 if ./try 2>/dev/null; then
10781                         echo "Yes, it can."
10782                         val="$define"
10783                 else
10784                         echo "It can't, sorry."
10785                         case "$d_memmove" in
10786                         "$define") echo "But that's Ok since you have memmove()." ;;
10787                         esac
10788                 fi
10789         else
10790                 echo "(I can't compile the test program, so we'll assume not...)"
10791                 case "$d_memmove" in
10792                 "$define") echo "But that's Ok since you have memmove()." ;;
10793                 esac
10794         fi
10795         ;;
10796 esac
10797 $rm -f try.* try core
10798 set d_safebcpy
10799 eval $setvar
10800
10801 : can memcpy handle overlapping blocks?
10802 val="$undef"
10803 case "$d_memcpy" in
10804 "$define")
10805         echo " "
10806         echo "Checking to see if your memcpy() can do overlapping copies..." >&4
10807         $cat >try.c <<EOCP
10808 #$i_memory I_MEMORY
10809 #$i_stdlib I_STDLIB
10810 #$i_string I_STRING
10811 #$i_unistd I_UNISTD
10812 EOCP
10813         $cat >>try.c <<'EOCP'
10814 #include <stdio.h>
10815 #ifdef I_MEMORY
10816 #  include <memory.h>
10817 #endif
10818 #ifdef I_STDLIB
10819 #  include <stdlib.h>
10820 #endif
10821 #ifdef I_STRING
10822 #  include <string.h>
10823 #else
10824 #  include <strings.h>
10825 #endif
10826 #ifdef I_UNISTD
10827 #  include <unistd.h>  /* Needed for NetBSD */
10828 #endif
10829 int main()
10830 {
10831 char buf[128], abc[128];
10832 char *b;
10833 int len;
10834 int off;
10835 int align;
10836
10837 /* Copy "abcde..." string to char abc[] so that gcc doesn't
10838    try to store the string in read-only memory. */
10839 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
10840
10841 for (align = 7; align >= 0; align--) {
10842         for (len = 36; len; len--) {
10843                 b = buf+align;
10844                 memcpy(b, abc, len);
10845                 for (off = 1; off <= len; off++) {
10846                         memcpy(b+off, b, len);
10847                         memcpy(b, b+off, len);
10848                         if (memcmp(b, abc, len))
10849                                 exit(1);
10850                 }
10851         }
10852 }
10853 exit(0);
10854 }
10855 EOCP
10856         set try
10857         if eval $compile_ok; then
10858                 if ./try 2>/dev/null; then
10859                         echo "Yes, it can."
10860                         val="$define"
10861                 else
10862                         echo "It can't, sorry."
10863                         case "$d_memmove" in
10864                         "$define") echo "But that's Ok since you have memmove()." ;;
10865                         esac
10866                 fi
10867         else
10868                 echo "(I can't compile the test program, so we'll assume not...)"
10869                 case "$d_memmove" in
10870                 "$define") echo "But that's Ok since you have memmove()." ;;
10871                 esac
10872         fi
10873         ;;
10874 esac
10875 $rm -f try.* try core
10876 set d_safemcpy
10877 eval $setvar
10878
10879 : can memcmp be trusted to compare relative magnitude?
10880 val="$undef"
10881 case "$d_memcmp" in
10882 "$define")
10883         echo " "
10884         echo "Checking if your memcmp() can compare relative magnitude..." >&4
10885         $cat >try.c <<EOCP
10886 #$i_memory I_MEMORY
10887 #$i_stdlib I_STDLIB
10888 #$i_string I_STRING
10889 #$i_unistd I_UNISTD
10890 EOCP
10891         $cat >>try.c <<'EOCP'
10892 #include <stdio.h>
10893 #ifdef I_MEMORY
10894 #  include <memory.h>
10895 #endif
10896 #ifdef I_STDLIB
10897 #  include <stdlib.h>
10898 #endif
10899 #ifdef I_STRING
10900 #  include <string.h>
10901 #else
10902 #  include <strings.h>
10903 #endif
10904 #ifdef I_UNISTD
10905 #  include <unistd.h>  /* Needed for NetBSD */
10906 #endif
10907 int main()
10908 {
10909 char a = -1;
10910 char b = 0;
10911 if ((a < b) && memcmp(&a, &b, 1) < 0)
10912         exit(1);
10913 exit(0);
10914 }
10915 EOCP
10916         set try
10917         if eval $compile_ok; then
10918                 if ./try 2>/dev/null; then
10919                         echo "Yes, it can."
10920                         val="$define"
10921                 else
10922                         echo "No, it can't (it uses signed chars)."
10923                 fi
10924         else
10925                 echo "(I can't compile the test program, so we'll assume not...)"
10926         fi
10927         ;;
10928 esac
10929 $rm -f try.* try core
10930 set d_sanemcmp
10931 eval $setvar
10932
10933 : see if select exists
10934 set select d_select
10935 eval $inlibc
10936
10937 : see if semctl exists
10938 set semctl d_semctl
10939 eval $inlibc
10940
10941 : see if semget exists
10942 set semget d_semget
10943 eval $inlibc
10944
10945 : see if semop exists
10946 set semop d_semop
10947 eval $inlibc
10948
10949 : see how much of the 'sem*(2)' library is present.
10950 h_sem=true
10951 echo " "
10952 case "$d_semctl$d_semget$d_semop" in
10953 *"$undef"*) h_sem=false;;
10954 esac
10955 case "$osname" in
10956 freebsd)
10957     case "`ipcs 2>&1`" in
10958     "SVID messages"*"not configured"*)
10959         echo "Your $osname does not have the sem*(2) configured." >&4
10960         h_sem=false
10961         val="$undef"
10962         set semctl d_semctl
10963         eval $setvar
10964         set semget d_semget
10965         eval $setvar
10966         set semop d_semop
10967         eval $setvar
10968         ;;
10969     esac
10970     ;;
10971 esac
10972 : we could also check for sys/ipc.h ...
10973 if $h_sem && $test `./findhdr sys/sem.h`; then
10974         echo "You have the full sem*(2) library." >&4
10975         val="$define"
10976 else
10977         echo "You don't have the full sem*(2) library." >&4
10978         val="$undef"
10979 fi
10980 set d_sem
10981 eval $setvar
10982
10983 : see whether sys/sem.h defines union semun
10984 echo " "
10985 $cat > try.c <<'END'
10986 #include <sys/types.h>
10987 #include <sys/ipc.h>
10988 #include <sys/sem.h>
10989 int main () { union semun semun; semun.buf = 0; }
10990 END
10991 set try
10992 if eval $compile; then
10993     echo "You have union semun in <sys/sem.h>." >&4
10994     val="$define"
10995 else
10996     echo "You do not have union semun in <sys/sem.h>." >&4
10997     val="$undef"
10998 fi
10999 $rm -f try try.c try.h
11000 set d_union_semun
11001 eval $setvar
11002
11003 : see how to do semctl IPC_STAT
11004 case "$d_sem" in
11005 $define)
11006     : see whether semctl IPC_STAT can use union semun
11007     echo " "
11008     $cat > try.h <<END
11009 #ifndef S_IRUSR
11010 #   ifdef S_IREAD
11011 #       define S_IRUSR S_IREAD
11012 #       define S_IWUSR S_IWRITE
11013 #       define S_IXUSR S_IEXEC
11014 #   else
11015 #       define S_IRUSR 0400
11016 #       define S_IWUSR 0200
11017 #       define S_IXUSR 0100
11018 #   endif
11019 #   define S_IRGRP (S_IRUSR>>3)
11020 #   define S_IWGRP (S_IWUSR>>3)
11021 #   define S_IXGRP (S_IXUSR>>3)
11022 #   define S_IROTH (S_IRUSR>>6)
11023 #   define S_IWOTH (S_IWUSR>>6)
11024 #   define S_IXOTH (S_IXUSR>>6)
11025 #endif
11026 #ifndef S_IRWXU
11027 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
11028 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
11029 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
11030 #endif
11031 END
11032
11033     $cat > try.c <<END
11034 #include <sys/types.h>
11035 #include <sys/ipc.h>
11036 #include <sys/sem.h>
11037 #include <sys/stat.h>
11038 #include <stdio.h>
11039 #include <errno.h>
11040 #include "try.h"
11041 #ifndef errno
11042 extern int errno;
11043 #endif
11044 #$d_union_semun HAS_UNION_SEMUN
11045 int main() {
11046     union semun
11047 #ifndef HAS_UNION_SEMUN
11048     {
11049         int val;
11050         struct semid_ds *buf;
11051         unsigned short *array;
11052     }
11053 #endif
11054     arg;
11055     int sem, st;
11056
11057 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
11058     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
11059     if (sem > -1) {
11060         struct semid_ds argbuf;
11061         arg.buf = &argbuf;
11062 #       ifdef IPC_STAT
11063         st = semctl(sem, 0, IPC_STAT, arg);
11064         if (st == 0)
11065             printf("semun\n");
11066         else
11067 #       endif /* IPC_STAT */
11068             printf("semctl IPC_STAT failed: errno = %d\n", errno);
11069 #       ifdef IPC_RMID
11070         if (semctl(sem, 0, IPC_RMID, arg) != 0)
11071 #       endif /* IPC_RMID */
11072             printf("semctl IPC_RMID failed: errno = %d\n", errno);
11073     } else
11074 #endif /* IPC_PRIVATE && ... */
11075         printf("semget failed: errno = %d\n", errno);
11076   return 0;
11077 }
11078 END
11079     val="$undef"
11080     set try
11081     if eval $compile; then
11082         xxx=`./try`
11083         case "$xxx" in
11084         semun) val="$define" ;;
11085         esac
11086     fi
11087     $rm -f try try.c
11088     set d_semctl_semun
11089     eval $setvar
11090     case "$d_semctl_semun" in
11091     $define)
11092         echo "You can use union semun for semctl IPC_STAT." >&4
11093         also='also'
11094         ;;
11095     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
11096         also=''
11097         ;;
11098     esac
11099
11100     : see whether semctl IPC_STAT can use struct semid_ds pointer
11101     $cat > try.c <<'END'
11102 #include <sys/types.h>
11103 #include <sys/ipc.h>
11104 #include <sys/sem.h>
11105 #include <sys/stat.h>
11106 #include "try.h"
11107 #include <stdio.h>
11108 #include <errno.h>
11109 #ifndef errno
11110 extern int errno;
11111 #endif
11112 int main() {
11113     struct semid_ds arg;
11114     int sem, st;
11115
11116 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
11117     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
11118     if (sem > -1) {
11119 #       ifdef IPC_STAT
11120         st = semctl(sem, 0, IPC_STAT, &arg);
11121         if (st == 0)
11122             printf("semid_ds\n");
11123         else
11124 #       endif /* IPC_STAT */
11125             printf("semctl IPC_STAT failed: errno = %d\n", errno);
11126 #       ifdef IPC_RMID
11127         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
11128 #       endif /* IPC_RMID */
11129             printf("semctl IPC_RMID failed: errno = %d\n", errno);
11130     } else
11131 #endif /* IPC_PRIVATE && ... */
11132         printf("semget failed: errno = %d\n", errno);
11133
11134     return 0;
11135 }
11136 END
11137     val="$undef"
11138     set try
11139     if eval $compile; then
11140         xxx=`./try`
11141         case "$xxx" in
11142         semid_ds) val="$define" ;;
11143         esac
11144     fi
11145     $rm -f try try.c
11146     set d_semctl_semid_ds
11147     eval $setvar
11148     case "$d_semctl_semid_ds" in
11149     $define)
11150         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
11151         ;;
11152     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
11153         ;;
11154     esac
11155     $rm -f try.h
11156     ;;
11157 *)  val="$undef"
11158
11159     # We do not have the full sem*(2) library, so assume we can not
11160     # use either.
11161
11162     set d_semctl_semun
11163     eval $setvar
11164
11165     set d_semctl_semid_ds
11166     eval $setvar
11167     ;;
11168 esac
11169
11170 : see if setegid exists
11171 set setegid d_setegid
11172 eval $inlibc
11173
11174 : see if seteuid exists
11175 set seteuid d_seteuid
11176 eval $inlibc
11177
11178 : see if setgrent exists
11179 set setgrent d_setgrent
11180 eval $inlibc
11181
11182 : see if sethostent exists
11183 set sethostent d_sethent
11184 eval $inlibc
11185
11186 : see if setlinebuf exists
11187 set setlinebuf d_setlinebuf
11188 eval $inlibc
11189
11190 : see if setlocale exists
11191 set setlocale d_setlocale
11192 eval $inlibc
11193
11194 : see if setnetent exists
11195 set setnetent d_setnent
11196 eval $inlibc
11197
11198 : see if setprotoent exists
11199 set setprotoent d_setpent
11200 eval $inlibc
11201
11202 : see if setpgid exists
11203 set setpgid d_setpgid
11204 eval $inlibc
11205
11206 : see if setpgrp2 exists
11207 set setpgrp2 d_setpgrp2
11208 eval $inlibc
11209
11210 : see if setpriority exists
11211 set setpriority d_setprior
11212 eval $inlibc
11213
11214 : see if setproctitle exists
11215 set setproctitle d_setproctitle
11216 eval $inlibc
11217
11218 : see if setpwent exists
11219 set setpwent d_setpwent
11220 eval $inlibc
11221
11222 : see if setregid exists
11223 set setregid d_setregid
11224 eval $inlibc
11225 set setresgid d_setresgid
11226 eval $inlibc
11227
11228 : see if setreuid exists
11229 set setreuid d_setreuid
11230 eval $inlibc
11231 set setresuid d_setresuid
11232 eval $inlibc
11233
11234 : see if setrgid exists
11235 set setrgid d_setrgid
11236 eval $inlibc
11237
11238 : see if setruid exists
11239 set setruid d_setruid
11240 eval $inlibc
11241
11242 : see if setservent exists
11243 set setservent d_setsent
11244 eval $inlibc
11245
11246 : see if setsid exists
11247 set setsid d_setsid
11248 eval $inlibc
11249
11250 : see if setvbuf exists
11251 set setvbuf d_setvbuf
11252 eval $inlibc
11253
11254 : see if sfio.h is available
11255 set sfio.h i_sfio
11256 eval $inhdr
11257
11258
11259 : see if sfio library is available
11260 case "$i_sfio" in
11261 $define)
11262         val=''
11263         set sfreserve val
11264         eval $inlibc
11265         ;;
11266 *)
11267         val="$undef"
11268         ;;
11269 esac
11270 : Ok, but do we want to use it.
11271 case "$val" in
11272 $define)
11273         case "$usesfio" in
11274         true|$define|[yY]*) dflt='y';;
11275         *) dflt='n';;
11276         esac
11277         echo "$package can use the sfio library, but it is experimental."
11278         case "$useperlio" in
11279         "$undef")
11280             echo "For sfio also the PerlIO abstraction layer is needed."
11281             echo "Earlier you said you wouldn't want that."
11282             ;;
11283         esac
11284         rp="You seem to have sfio available, do you want to try using it?"
11285         . ./myread
11286         case "$ans" in
11287         y|Y)    echo "Ok, turning on both sfio and PerlIO, then."
11288                 useperlio="$define"
11289                 val="$define"
11290                 ;;
11291         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
11292                 val="$undef"
11293                 : Remove sfio from list of libraries to use
11294                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
11295                 shift
11296                 libs="$*"
11297                 echo "libs = $libs" >&4
11298                 ;;
11299         esac
11300         ;;
11301 *)      case "$usesfio" in
11302         true|$define|[yY]*)
11303                 echo "Sorry, cannot find sfio on this machine." >&4
11304                 echo "Ignoring your setting of usesfio=$usesfio." >&4
11305                 val="$undef"
11306                 ;;
11307         esac
11308         ;;
11309 esac
11310 set d_sfio
11311 eval $setvar
11312 case "$d_sfio" in
11313 $define) usesfio='true';;
11314 *) usesfio='false';;
11315 esac
11316
11317 : see if shmctl exists
11318 set shmctl d_shmctl
11319 eval $inlibc
11320
11321 : see if shmget exists
11322 set shmget d_shmget
11323 eval $inlibc
11324
11325 : see if shmat exists
11326 set shmat d_shmat
11327 eval $inlibc
11328 : see what shmat returns
11329 case "$d_shmat" in
11330 "$define")
11331         $cat >shmat.c <<'END'
11332 #include <sys/shm.h>
11333 void *shmat();
11334 END
11335         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
11336                 shmattype='void *'
11337         else
11338                 shmattype='char *'
11339         fi
11340         echo "and it returns ($shmattype)." >&4
11341         : see if a prototype for shmat is available
11342         xxx=`./findhdr sys/shm.h`
11343         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
11344         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
11345                 val="$define"
11346         else
11347                 val="$undef"
11348         fi
11349         $rm -f shmat.[co]
11350         ;;
11351 *)
11352         val="$undef"
11353         ;;
11354 esac
11355 set d_shmatprototype
11356 eval $setvar
11357
11358 : see if shmdt exists
11359 set shmdt d_shmdt
11360 eval $inlibc
11361
11362 : see how much of the 'shm*(2)' library is present.
11363 h_shm=true
11364 echo " "
11365 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
11366 *"$undef"*) h_shm=false;;
11367 esac
11368 case "$osname" in
11369 freebsd)
11370     case "`ipcs 2>&1`" in
11371     "SVID shared memory"*"not configured"*)
11372         echo "Your $osname does not have the shm*(2) configured." >&4
11373         h_shm=false
11374         val="$undef"
11375         set shmctl d_shmctl
11376         evat $setvar
11377         set shmget d_shmget
11378         evat $setvar
11379         set shmat d_shmat
11380         evat $setvar
11381         set shmdt d_shmdt
11382         evat $setvar
11383         ;;
11384     esac
11385     ;;
11386 esac
11387 : we could also check for sys/ipc.h ...
11388 if $h_shm && $test `./findhdr sys/shm.h`; then
11389         echo "You have the full shm*(2) library." >&4
11390         val="$define"
11391 else
11392         echo "You don't have the full shm*(2) library." >&4
11393         val="$undef"
11394 fi
11395 set d_shm
11396 eval $setvar
11397
11398 echo " "
11399 : see if we have sigaction
11400 if set sigaction val -f d_sigaction; eval $csym; $val; then
11401         echo 'sigaction() found.' >&4
11402         $cat > try.c <<'EOP'
11403 #include <stdio.h>
11404 #include <sys/types.h>
11405 #include <signal.h>
11406 int main()
11407 {
11408     struct sigaction act, oact;
11409     act.sa_flags = 0;
11410     oact.sa_handler = 0;
11411     /* so that act and oact are used */
11412     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
11413 }
11414 EOP
11415         set try
11416         if eval $compile_ok; then
11417                 val="$define"
11418         else
11419                 echo "But you don't seem to have a useable struct sigaction." >&4
11420                 val="$undef"
11421         fi
11422 else
11423         echo 'sigaction NOT found.' >&4
11424         val="$undef"
11425 fi
11426 set d_sigaction; eval $setvar
11427 $rm -f try try$_o try.c
11428
11429 : see if sigsetjmp exists
11430 echo " "
11431 case "$d_sigsetjmp" in
11432 '')
11433         $cat >try.c <<'EOP'
11434 #include <setjmp.h>
11435 sigjmp_buf env;
11436 int set = 1;
11437 int main()
11438 {
11439         if (sigsetjmp(env,1))
11440                 exit(set);
11441         set = 0;
11442         siglongjmp(env, 1);
11443         exit(1);
11444 }
11445 EOP
11446         set try
11447         if eval $compile; then
11448                 if ./try >/dev/null 2>&1; then
11449                         echo "POSIX sigsetjmp found." >&4
11450                         val="$define"
11451                 else
11452                         $cat >&4 <<EOM
11453 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
11454 I'll ignore them.
11455 EOM
11456                         val="$undef"
11457                 fi
11458         else
11459                 echo "sigsetjmp not found." >&4
11460                 val="$undef"
11461         fi
11462         ;;
11463 *) val="$d_sigsetjmp"
11464         case "$d_sigsetjmp" in
11465         $define) echo "POSIX sigsetjmp found." >&4;;
11466         $undef) echo "sigsetjmp not found." >&4;;
11467         esac
11468         ;;
11469 esac
11470 set d_sigsetjmp
11471 eval $setvar
11472 $rm -f try.c try
11473
11474 : see if socks5_init exists
11475 set socks5_init d_socks5_init
11476 eval $inlibc
11477
11478 : see if sys/stat.h is available
11479 set sys/stat.h i_sysstat
11480 eval $inhdr
11481
11482
11483 : see if stat knows about block sizes
11484 echo " "
11485 echo "Checking to see if your struct stat has st_blocks field..." >&4
11486 set d_statblks stat st_blocks $i_sysstat sys/stat.h
11487 eval $hasfield
11488
11489
11490 : see if this is a sys/vfs.h system
11491 set sys/vfs.h i_sysvfs
11492 eval $inhdr
11493
11494
11495 : see if this is a sys/statfs.h system
11496 set sys/statfs.h i_sysstatfs
11497 eval $inhdr
11498
11499
11500 echo " "
11501 echo "Checking to see if your system supports struct statfs..." >&4
11502 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
11503 eval $hasstruct
11504 case "$d_statfs_s" in
11505 "$define")      echo "Yes, it does."   ;;
11506 *)              echo "No, it doesn't." ;;
11507 esac
11508
11509
11510
11511 : see if struct statfs knows about f_flags
11512 case "$d_statfs_s" in
11513 define) 
11514         echo " "
11515         echo "Checking to see if your struct statfs has f_flags field..." >&4
11516         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
11517         eval $hasfield
11518         ;;
11519 *)      val="$undef"
11520         set d_statfs_f_flags
11521         eval $setvar
11522         ;;
11523 esac
11524 case "$d_statfs_f_flags" in
11525 "$define")      echo "Yes, it does."   ;;
11526 *)              echo "No, it doesn't." ;;
11527 esac
11528
11529 : see if _ptr and _cnt from stdio act std
11530 echo " "
11531 if $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
11532         echo "(Looks like you have stdio.h from Linux.)"
11533         case "$stdio_ptr" in
11534         '') stdio_ptr='((fp)->_IO_read_ptr)'
11535                 ptr_lval=$define
11536                 ;;
11537         *)      ptr_lval=$d_stdio_ptr_lval;;
11538         esac
11539         case "$stdio_cnt" in
11540         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
11541                 cnt_lval=$undef
11542                 ;;
11543         *)      cnt_lval=$d_stdio_cnt_lval;;
11544         esac
11545         case "$stdio_base" in
11546         '') stdio_base='((fp)->_IO_read_base)';;
11547         esac
11548         case "$stdio_bufsiz" in
11549         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
11550         esac
11551 else
11552         case "$stdio_ptr" in
11553         '') stdio_ptr='((fp)->_ptr)'
11554                 ptr_lval=$define
11555                 ;;
11556         *)      ptr_lval=$d_stdio_ptr_lval;;
11557         esac
11558         case "$stdio_cnt" in
11559         '') stdio_cnt='((fp)->_cnt)'
11560                 cnt_lval=$define
11561                 ;;
11562         *)      cnt_lval=$d_stdio_cnt_lval;;
11563         esac
11564         case "$stdio_base" in
11565         '') stdio_base='((fp)->_base)';;
11566         esac
11567         case "$stdio_bufsiz" in
11568         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
11569         esac
11570 fi
11571 : test whether _ptr and _cnt really work
11572 echo "Checking how std your stdio is..." >&4
11573 $cat >try.c <<EOP
11574 #include <stdio.h>
11575 #define FILE_ptr(fp)    $stdio_ptr
11576 #define FILE_cnt(fp)    $stdio_cnt
11577 int main() {
11578         FILE *fp = fopen("try.c", "r");
11579         char c = getc(fp);
11580         if (
11581                 18 <= FILE_cnt(fp) &&
11582                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
11583         )
11584                 exit(0);
11585         exit(1);
11586 }
11587 EOP
11588 val="$undef"
11589 set try
11590 if eval $compile; then
11591         if ./try; then
11592                 echo "Your stdio acts pretty std."
11593                 val="$define"
11594         else
11595                 echo "Your stdio isn't very std."
11596         fi
11597 else
11598         echo "Your stdio doesn't appear very std."
11599 fi
11600 $rm -f try.c try
11601 set d_stdstdio
11602 eval $setvar
11603
11604 : Can _ptr be used as an lvalue?
11605 case "$d_stdstdio$ptr_lval" in
11606 $define$define) val=$define ;;
11607 *) val=$undef ;;
11608 esac
11609 set d_stdio_ptr_lval
11610 eval $setvar
11611
11612 : Can _cnt be used as an lvalue?
11613 case "$d_stdstdio$cnt_lval" in
11614 $define$define) val=$define ;;
11615 *) val=$undef ;;
11616 esac
11617 set d_stdio_cnt_lval
11618 eval $setvar
11619
11620 : see if _base is also standard
11621 val="$undef"
11622 case "$d_stdstdio" in
11623 $define)
11624         $cat >try.c <<EOP
11625 #include <stdio.h>
11626 #define FILE_base(fp)   $stdio_base
11627 #define FILE_bufsiz(fp) $stdio_bufsiz
11628 int main() {
11629         FILE *fp = fopen("try.c", "r");
11630         char c = getc(fp);
11631         if (
11632                 19 <= FILE_bufsiz(fp) &&
11633                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
11634         )
11635                 exit(0);
11636         exit(1);
11637 }
11638 EOP
11639         set try
11640         if eval $compile; then
11641                 if ./try; then
11642                         echo "And its _base field acts std."
11643                         val="$define"
11644                 else
11645                         echo "But its _base field isn't std."
11646                 fi
11647         else
11648                 echo "However, it seems to be lacking the _base field."
11649         fi
11650         $rm -f try.c try
11651         ;;
11652 esac
11653 set d_stdiobase
11654 eval $setvar
11655
11656 $cat >&4 <<EOM
11657 Checking how to access stdio streams by file descriptor number...
11658 EOM
11659 case "$stdio_stream_array" in
11660 '')     $cat >try.c <<EOCP
11661 #include <stdio.h>
11662 int main() {
11663   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
11664     printf("yes\n");
11665 }
11666 EOCP
11667         for s in _iob __iob __sF
11668         do
11669                 set try -DSTDIO_STREAM_ARRAY=$s
11670                 if eval $compile; then
11671                         case "`./try$exe_ext`" in
11672                         yes)    stdio_stream_array=$s; break ;;
11673                         esac
11674                 fi
11675         done
11676         $rm -f try.* try$exe_ext
11677 esac
11678 case "$stdio_stream_array" in
11679 '')     $cat >&4 <<EOM
11680 I can't figure out how to access stdio streams by file descriptor number.
11681 EOM
11682         d_stdio_stream_array="$undef"
11683         ;;
11684 *)      $cat >&4 <<EOM
11685 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
11686 EOM
11687         d_stdio_stream_array="$define"
11688         ;;
11689 esac
11690
11691 : see if strcoll exists
11692 set strcoll d_strcoll
11693 eval $inlibc
11694
11695 : check for structure copying
11696 echo " "
11697 echo "Checking to see if your C compiler can copy structs..." >&4
11698 $cat >try.c <<'EOCP'
11699 int main()
11700 {
11701         struct blurfl {
11702                 int dyick;
11703         } foo, bar;
11704
11705         foo = bar;
11706 }
11707 EOCP
11708 if $cc -c try.c >/dev/null 2>&1 ; then
11709         val="$define"
11710         echo "Yup, it can."
11711 else
11712         val="$undef"
11713         echo "Nope, it can't."
11714 fi
11715 set d_strctcpy
11716 eval $setvar
11717 $rm -f try.*
11718
11719 : see if strerror and/or sys_errlist[] exist
11720 echo " "
11721 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
11722     if set strerror val -f d_strerror; eval $csym; $val; then
11723                 echo 'strerror() found.' >&4
11724                 d_strerror="$define"
11725                 d_strerrm='strerror(e)'
11726                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
11727                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
11728                         d_syserrlst="$define"
11729                 else
11730                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
11731                         d_syserrlst="$undef"
11732                 fi
11733     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
11734                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
11735                 echo 'strerror() found in string header.' >&4
11736                 d_strerror="$define"
11737                 d_strerrm='strerror(e)'
11738                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
11739                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
11740                                 d_syserrlst="$define"
11741                 else
11742                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
11743                         d_syserrlst="$undef"
11744                 fi
11745     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
11746                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
11747                 d_strerror="$undef"
11748                 d_syserrlst="$define"
11749                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
11750     else
11751                 echo 'strerror() and sys_errlist[] NOT found.' >&4
11752                 d_strerror="$undef"
11753                 d_syserrlst="$undef"
11754                 d_strerrm='"unknown"'
11755     fi
11756 fi
11757
11758 : see if strtod exists
11759 set strtod d_strtod
11760 eval $inlibc
11761
11762 : see if strtol exists
11763 set strtol d_strtol
11764 eval $inlibc
11765
11766 : see if strtold exists
11767 set strtold d_strtold
11768 eval $inlibc
11769
11770 : see if strtoll exists
11771 set strtoll d_strtoll
11772 eval $inlibc
11773
11774 case "$d_longlong-$d_strtoll" in
11775 "$define-$define")
11776         $cat <<EOM
11777 Checking whether your strtoll() works okay...
11778 EOM
11779         $cat >try.c <<'EOCP'
11780 #include <errno.h>
11781 #ifdef __hpux
11782 #define strtoll __strtoll
11783 #endif
11784 #include <stdio.h>
11785 extern long long int strtoll(char *s, char **, int); 
11786 static int bad = 0;
11787 int check(char *s, long long ell, int een) {
11788         long long gll;
11789         errno = 0;
11790         gll = strtoll(s, 0, 10);
11791         if (!((gll == ell) && (errno == een)))
11792                 bad++;
11793 }
11794 int main() {
11795         check(" 1",                                      1LL, 0);
11796         check(" 0",                                      0LL, 0);
11797         check("-1",                                     -1LL, 0);
11798         check("-9223372036854775808", -9223372036854775808LL, 0);
11799         check("-9223372036854775808", -9223372036854775808LL, 0);
11800         check(" 9223372036854775807",  9223372036854775807LL, 0);
11801         check("-9223372036854775808", -9223372036854775808LL, 0);
11802         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
11803         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
11804         if (!bad)
11805                 printf("ok\n");
11806 }
11807 EOCP
11808         set try
11809         if eval $compile; then
11810                 case "`./try`" in
11811                 ok) echo "Your strtoll() seems to be working okay." ;;
11812                 *) cat <<EOM >&4
11813 Your strtoll() doesn't seem to be working okay.
11814 EOM
11815                    d_strtoll="$undef"
11816                    ;;
11817                 esac
11818         fi
11819         ;;
11820 esac
11821
11822 : see if strtoul exists
11823 set strtoul d_strtoul
11824 eval $inlibc
11825
11826 : see if strtoull exists
11827 set strtoull d_strtoull
11828 eval $inlibc
11829
11830 case "$d_longlong-$d_strtoull" in
11831 "$define-$define")
11832         $cat <<EOM
11833 Checking whether your strtoull() works okay...
11834 EOM
11835         $cat >try.c <<'EOCP'
11836 #include <errno.h>
11837 #ifdef __hpux
11838 #define strtoull __strtoull
11839 #endif
11840 #include <stdio.h>
11841 extern unsigned long long int strtoull(char *s, char **, int); 
11842 static int bad = 0;
11843 int check(char *s, long long eull, int een) {
11844         long long gull;
11845         errno = 0;
11846         gull = strtoull(s, 0, 10);
11847         if (!((gull == eull) && (errno == een)))
11848                 bad++;
11849 }
11850 int main() {
11851         check(" 1",                                       1LL, 0);
11852         check(" 0",                                       0LL, 0);
11853         check("18446744073709551615", 18446744073709551615ULL, 0);
11854         check("18446744073709551616", 18446744073709551615ULL, ERANGE);
11855         if (!bad)
11856                 printf("ok\n");
11857 }
11858 EOCP
11859         set try
11860         if eval $compile; then
11861                 case "`./try`" in
11862                 ok) echo "Your strtoull() seems to be working okay." ;;
11863                 *) cat <<EOM >&4
11864 Your strtoull() doesn't seem to be working okay.
11865 EOM
11866                    d_strtoull="$undef"
11867                    ;;
11868                 esac
11869         fi
11870         ;;
11871 esac
11872
11873 : see if strtouq exists
11874 set strtouq d_strtouq
11875 eval $inlibc
11876
11877 : see if strxfrm exists
11878 set strxfrm d_strxfrm
11879 eval $inlibc
11880
11881 : see if symlink exists
11882 set symlink d_symlink
11883 eval $inlibc
11884
11885 : see if syscall exists
11886 set syscall d_syscall
11887 eval $inlibc
11888
11889 : see if sysconf exists
11890 set sysconf d_sysconf
11891 eval $inlibc
11892
11893 : see if system exists
11894 set system d_system
11895 eval $inlibc
11896
11897 : see if tcgetpgrp exists
11898 set tcgetpgrp d_tcgetpgrp
11899 eval $inlibc
11900
11901 : see if tcsetpgrp exists
11902 set tcsetpgrp d_tcsetpgrp
11903 eval $inlibc
11904
11905 : see if prototype for telldir is available
11906 echo " "
11907 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
11908 eval $hasproto
11909
11910 : see if this is a sys/times.h system
11911 set sys/times.h i_systimes
11912 eval $inhdr
11913
11914 : see if times exists
11915 echo " "
11916 if set times val -f d_times; eval $csym; $val; then
11917         echo 'times() found.' >&4
11918         d_times="$define"
11919         inc=''
11920         case "$i_systimes" in
11921         "$define") inc='sys/times.h';;
11922         esac
11923         rp="What is the type returned by times() on this system?"
11924         set clock_t clocktype long stdio.h sys/types.h $inc
11925         eval $typedef_ask
11926 else
11927         echo 'times() NOT found, hope that will do.' >&4
11928         d_times="$undef"
11929         clocktype='int'
11930 fi
11931
11932 : see if truncate exists
11933 set truncate d_truncate
11934 eval $inlibc
11935
11936 : see if tzname[] exists
11937 echo " "
11938 if set tzname val -a d_tzname; eval $csym; $val; then
11939         val="$define"
11940         echo 'tzname[] found.' >&4
11941 else
11942         val="$undef"
11943         echo 'tzname[] NOT found.' >&4
11944 fi
11945 set d_tzname
11946 eval $setvar
11947
11948 : see if umask exists
11949 set umask d_umask
11950 eval $inlibc
11951
11952 : see if ustat exists
11953 set ustat d_ustat
11954 eval $inlibc
11955
11956 : backward compatibility for d_hvfork
11957 if test X$d_hvfork != X; then
11958         d_vfork="$d_hvfork"
11959         d_hvfork=''
11960 fi
11961 : see if there is a vfork
11962 val=''
11963 set vfork val
11964 eval $inlibc
11965
11966 : Ok, but do we want to use it. vfork is reportedly unreliable in 
11967 : perl on Solaris 2.x, and probably elsewhere.
11968 case "$val" in
11969 $define)
11970         echo " "
11971         case "$usevfork" in
11972         false) dflt='n';;
11973         *) dflt='y';;
11974         esac
11975         cat <<'EOM'
11976  
11977 Perl can only use a vfork() that doesn't suffer from strict
11978 restrictions on calling functions or modifying global data in
11979 the child.  For example, glibc-2.1 contains such a vfork()
11980 that is unsuitable.  If your system provides a proper fork()
11981 call, chances are that you do NOT want perl to use vfork().
11982
11983 EOM
11984         rp="Do you still want to use vfork()?"
11985         . ./myread
11986         case "$ans" in
11987         y|Y) ;;
11988         *)
11989                 echo "Ok, we won't use vfork()."
11990                 val="$undef"
11991                 ;;
11992         esac
11993         ;;
11994 esac
11995 set d_vfork
11996 eval $setvar
11997 case "$d_vfork" in
11998 $define) usevfork='true';;
11999 *) usevfork='false';;
12000 esac
12001
12002 : see if this is an sysdir system
12003 set sys/dir.h i_sysdir
12004 eval $inhdr
12005
12006 : see if this is an sysndir system
12007 set sys/ndir.h i_sysndir
12008 eval $inhdr
12009
12010 : see if closedir exists
12011 set closedir d_closedir
12012 eval $inlibc
12013
12014 case "$d_closedir" in
12015 "$define")
12016         echo " "
12017         echo "Checking whether closedir() returns a status..." >&4
12018         cat > closedir.c <<EOM
12019 #$i_dirent I_DIRENT             /**/
12020 #$i_sysdir I_SYS_DIR            /**/
12021 #$i_sysndir I_SYS_NDIR          /**/
12022 #$i_systypes I_SYS_TYPES        /**/
12023
12024 #if defined(I_SYS_TYPES)
12025 #include <sys/types.h>
12026 #endif
12027 #if defined(I_DIRENT)
12028 #include <dirent.h>
12029 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
12030 #include <sys/dir.h>
12031 #endif
12032 #else
12033 #ifdef I_SYS_NDIR
12034 #include <sys/ndir.h>
12035 #else
12036 #ifdef I_SYS_DIR
12037 #ifdef hp9000s500
12038 #include <ndir.h>       /* may be wrong in the future */
12039 #else
12040 #include <sys/dir.h>
12041 #endif
12042 #endif
12043 #endif
12044 #endif 
12045 int main() { return closedir(opendir(".")); }
12046 EOM
12047         set closedir
12048         if eval $compile_ok; then
12049                 if ./closedir > /dev/null 2>&1 ; then
12050                         echo "Yes, it does."
12051                         val="$undef"
12052                 else
12053                         echo "No, it doesn't."
12054                         val="$define"
12055                 fi
12056         else
12057                 echo "(I can't seem to compile the test program--assuming it doesn't)"
12058                 val="$define"
12059         fi
12060         ;;
12061 *)
12062         val="$undef";
12063         ;;
12064 esac
12065 set d_void_closedir
12066 eval $setvar
12067 $rm -f closedir*
12068 : check for volatile keyword
12069 echo " "
12070 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
12071 $cat >try.c <<'EOCP'
12072 int main()
12073 {
12074         typedef struct _goo_struct goo_struct;
12075         goo_struct * volatile goo = ((goo_struct *)0);
12076         struct _goo_struct {
12077                 long long_int;
12078                 int reg_int;
12079                 char char_var;
12080         };
12081         typedef unsigned short foo_t;
12082         char *volatile foo;
12083         volatile int bar;
12084         volatile foo_t blech;
12085         foo = foo;
12086 }
12087 EOCP
12088 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
12089         val="$define"
12090         echo "Yup, it does."
12091 else
12092         val="$undef"
12093         echo "Nope, it doesn't."
12094 fi
12095 set d_volatile
12096 eval $setvar
12097 $rm -f try.*
12098
12099 : see if there is a wait4
12100 set wait4 d_wait4
12101 eval $inlibc
12102
12103 : see if waitpid exists
12104 set waitpid d_waitpid
12105 eval $inlibc
12106
12107 : see if wcstombs exists
12108 set wcstombs d_wcstombs
12109 eval $inlibc
12110
12111 : see if wctomb exists
12112 set wctomb d_wctomb
12113 eval $inlibc
12114
12115 : preserve RCS keywords in files with variable substitution, grrr
12116 Date='$Date'
12117 Id='$Id'
12118 Log='$Log'
12119 RCSfile='$RCSfile'
12120 Revision='$Revision'
12121
12122 case "$crosscompile" in
12123 ''|[nN]*) crosscompile="$undef" ;;
12124 esac
12125
12126 case "$osname" in
12127 next|rhapsody|darwin) multiarch="$define" ;;
12128 esac
12129 case "$multiarch" in
12130 ''|[nN]*) multiarch="$undef" ;;
12131 esac
12132
12133 : check for alignment requirements
12134 echo " "
12135 case "$crosscompile$multiarch" in
12136 *$define*)
12137         $cat <<EOM
12138 You seem to be either cross-compiling or doing a multiarchitecture build,
12139 skipping the memory alignment check.
12140
12141 EOM
12142         case "$alignbytes" in
12143         '') alignbytes=8 ;;
12144         esac
12145         ;;
12146 *)
12147         case "$alignbytes" in
12148         '') echo "Checking alignment constraints..." >&4
12149                 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
12150                         $cat >try.c <<'EOCP'
12151 typedef long double NV;
12152 EOCP
12153                 else
12154                         $cat >try.c <<'EOCP'
12155 typedef double NV;
12156 EOCP
12157                 fi
12158                 $cat >>try.c <<'EOCP'
12159 #include <stdio.h>
12160 struct foobar {
12161         char foo;
12162         NV bar;
12163 } try_algn;
12164 int main()
12165 {
12166     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
12167     return(0);
12168 }
12169 EOCP
12170                 set try
12171                 if eval $compile_ok; then
12172                         dflt=`./try`
12173                 else
12174                         dflt='8'
12175                         echo "(I can't seem to compile the test program...)"
12176                 fi
12177                 ;;
12178         *) dflt="$alignbytes"
12179                 ;;
12180         esac
12181         rp="Doubles must be aligned on a how-many-byte boundary?"
12182         . ./myread
12183         alignbytes="$ans"
12184         $rm -f try.c try
12185         ;;
12186 esac
12187
12188
12189 : set the base revision
12190 baserev=5.0
12191
12192 : check for ordering of bytes in a long
12193 echo " "
12194 case "$crosscompile$multiarch" in
12195 *$define*)
12196         $cat <<EOM
12197 You seem to be either cross-compiling or doing a multiarchitecture build,
12198 skipping the byteorder check.
12199
12200 EOM
12201         byteorder='0xffff'
12202         ;;
12203 *)
12204         case "$byteorder" in
12205         '')
12206                 $cat <<'EOM'
12207 In the following, larger digits indicate more significance.  A big-endian
12208 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
12209 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
12210 machines may have weird orders like 3412.  A Cray will report 87654321,
12211 an Alpha will report 12345678. If the test program works the default is
12212 probably right.
12213 I'm now running the test program...
12214 EOM
12215                 $cat >try.c <<'EOCP'
12216 #include <stdio.h>
12217 int main()
12218 {
12219         int i;
12220         union {
12221                 unsigned long l;
12222                 char c[sizeof(long)];
12223         } u;
12224
12225         if (sizeof(long) > 4)
12226                 u.l = (0x08070605L << 32) | 0x04030201L;
12227         else
12228                 u.l = 0x04030201L;
12229         for (i = 0; i < sizeof(long); i++)
12230                 printf("%c", u.c[i]+'0');
12231         printf("\n");
12232         exit(0);
12233 }
12234 EOCP
12235                 xxx_prompt=y
12236                 set try
12237                 if eval $compile && ./try > /dev/null; then
12238                         dflt=`./try`
12239                         case "$dflt" in
12240                         [1-4][1-4][1-4][1-4]|12345678|87654321)
12241                                 echo "(The test program ran ok.)"
12242                                 echo "byteorder=$dflt"
12243                                 xxx_prompt=n
12244                         ;;
12245                         ????|????????) echo "(The test program ran ok.)" ;;
12246                         *) echo "(The test program didn't run right for some reason.)" ;;
12247                         esac
12248                 else
12249                         dflt='4321'
12250                         cat <<'EOM'
12251 (I can't seem to compile the test program.  Guessing big-endian...)
12252 EOM
12253                 fi
12254                 case "$xxx_prompt" in
12255                 y)
12256                         rp="What is the order of bytes in a long?"
12257                         . ./myread
12258                         byteorder="$ans"
12259                         ;;
12260                 *)      byteorder=$dflt
12261                         ;;
12262                 esac
12263                 ;;
12264         esac
12265         $rm -f try.c try
12266         ;;
12267 esac
12268
12269
12270 : how do we catenate cpp tokens here?
12271 echo " "
12272 echo "Checking to see how your cpp does stuff like catenate tokens..." >&4
12273 $cat >cpp_stuff.c <<'EOCP'
12274 #define RCAT(a,b)a/**/b
12275 #define ACAT(a,b)a ## b
12276 RCAT(Rei,ser)
12277 ACAT(Cir,cus)
12278 EOCP
12279 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
12280 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
12281         echo "Oh!  Smells like ANSI's been here." >&4
12282         echo "We can catify or stringify, separately or together!"
12283         cpp_stuff=42
12284 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
12285         echo "Ah, yes!  The good old days!" >&4
12286         echo "However, in the good old days we don't know how to stringify and"
12287         echo "catify at the same time."
12288         cpp_stuff=1
12289 else
12290         $cat >&4 <<EOM
12291 Hmm, I don't seem to be able to catenate tokens with your cpp.  You're going
12292 to have to edit the values of CAT[2-5] in config.h...
12293 EOM
12294         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
12295 fi
12296 $rm -f cpp_stuff.*
12297
12298 : see if this is a db.h system
12299 set db.h i_db
12300 eval $inhdr
12301
12302 case "$i_db" in
12303 $define)
12304         : Check db version.
12305         echo " "
12306         echo "Checking Berkeley DB version ..." >&4
12307         $cat >try.c <<EOCP
12308 #$d_const HASCONST
12309 #ifndef HASCONST
12310 #define const
12311 #endif
12312 #include <sys/types.h>
12313 #include <stdio.h>
12314 #include <db.h>
12315 int main()
12316 {
12317 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
12318     int Major, Minor, Patch ;
12319     unsigned long Version ;
12320     (void)db_version(&Major, &Minor, &Patch) ;
12321     printf("You have Berkeley DB Version 2 or greater\n");
12322
12323     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
12324                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
12325     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
12326                 Major, Minor, Patch) ;
12327
12328     /* check that db.h & libdb are compatible */
12329     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
12330         printf("db.h and libdb are incompatible\n") ;
12331         exit(3);        
12332     }
12333
12334     printf("db.h and libdb are compatible\n") ;
12335
12336     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
12337                 + DB_VERSION_PATCH ;
12338
12339     /* needs to be >= 2.3.4 */
12340     if (Version < 2003004) {
12341     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
12342         printf("but Perl needs Berkeley DB 2.3.4 or greater\n") ;
12343         exit(2);        
12344     }
12345
12346     exit(0);
12347 #else
12348 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
12349     printf("You have Berkeley DB Version 1\n");
12350     exit(0);    /* DB version < 2: the coast is clear. */
12351 #else
12352     exit(1);    /* <db.h> not Berkeley DB? */
12353 #endif
12354 #endif
12355 }
12356 EOCP
12357         set try
12358         if eval $compile_ok && ./try; then
12359                 echo 'Looks OK.' >&4
12360         else
12361                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
12362                 i_db=$undef
12363                 case " $libs " in
12364                 *"-ldb "*)
12365                         : Remove db from list of libraries to use
12366                         echo "Removing unusable -ldb from library list" >&4
12367                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
12368                         shift
12369                         libs="$*"
12370                         echo "libs = $libs" >&4
12371                         ;;
12372                 esac
12373         fi
12374         $rm -f try.*
12375         ;;
12376 esac
12377
12378 case "$i_db" in
12379 define)
12380         : Check the return type needed for hash 
12381         echo " "
12382         echo "Checking return type needed for hash for Berkeley DB ..." >&4
12383         $cat >try.c <<EOCP
12384 #$d_const HASCONST
12385 #ifndef HASCONST
12386 #define const
12387 #endif
12388 #include <sys/types.h>
12389 #include <db.h>
12390
12391 #ifndef DB_VERSION_MAJOR
12392 u_int32_t hash_cb (ptr, size)
12393 const void *ptr;
12394 size_t size;
12395 {
12396 }
12397 HASHINFO info;
12398 int main()
12399 {
12400         info.hash = hash_cb;
12401 }
12402 #endif
12403 EOCP
12404         if $cc $ccflags -c try.c >try.out 2>&1 ; then
12405                 if $contains warning try.out >>/dev/null 2>&1 ; then
12406                         db_hashtype='int'
12407                 else
12408                         db_hashtype='u_int32_t'
12409                 fi
12410         else
12411                 : XXX Maybe we should just give up here.
12412                 db_hashtype=u_int32_t
12413                 $cat try.out >&4
12414                 echo "Help:  I can't seem to compile the db test program." >&4
12415                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
12416         fi
12417         $rm -f try.*
12418         echo "Your version of Berkeley DB uses $db_hashtype for hash."
12419         ;;
12420 *)      db_hashtype=u_int32_t
12421         ;;
12422 esac
12423 case "$i_db" in
12424 define)
12425         : Check the return type needed for prefix 
12426         echo " "
12427         echo "Checking return type needed for prefix 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 size_t prefix_cb (key1, key2)
12438 const DBT *key1;
12439 const DBT *key2;
12440 {
12441 }
12442 BTREEINFO info;
12443 int main()
12444 {
12445         info.prefix = prefix_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_prefixtype='int'
12452                 else
12453                         db_prefixtype='size_t'
12454                 fi
12455         else
12456                 db_prefixtype='size_t'
12457                 : XXX Maybe we should just give up here.
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_prefixtype." >&4
12461         fi
12462         $rm -f try.*
12463         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
12464         ;;
12465 *)      db_prefixtype='size_t'
12466         ;;
12467 esac
12468
12469 : check for void type
12470 echo " "
12471 echo "Checking to see how well your C compiler groks the void type..." >&4
12472 case "$voidflags" in
12473 '')
12474         $cat >try.c <<'EOCP'
12475 #if TRY & 1
12476 void sub() {
12477 #else
12478 sub() {
12479 #endif
12480         extern void moo();      /* function returning void */
12481         void (*goo)();          /* ptr to func returning void */
12482 #if TRY & 8
12483         void *hue;              /* generic ptr */
12484 #endif
12485 #if TRY & 2
12486         void (*foo[10])();
12487 #endif
12488
12489 #if TRY & 4
12490         if(goo == moo) {
12491                 exit(0);
12492         }
12493 #endif
12494         exit(0);
12495 }
12496 int main() { sub(); }
12497 EOCP
12498         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
12499                 voidflags=$defvoidused
12500         echo "Good.  It appears to support void to the level $package wants.">&4
12501                 if $contains warning .out >/dev/null 2>&1; then
12502                         echo "However, you might get some warnings that look like this:"
12503                         $cat .out
12504                 fi
12505         else
12506 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
12507                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
12508                         echo "It supports 1..."
12509                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
12510                                 echo "It also supports 2..."
12511                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
12512                                         voidflags=7
12513                                         echo "And it supports 4 but not 8 definitely."
12514                                 else
12515                                         echo "It doesn't support 4..."
12516                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
12517                                                 voidflags=11
12518                                                 echo "But it supports 8."
12519                                         else
12520                                                 voidflags=3
12521                                                 echo "Neither does it support 8."
12522                                         fi
12523                                 fi
12524                         else
12525                                 echo "It does not support 2..."
12526                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
12527                                         voidflags=13
12528                                         echo "But it supports 4 and 8."
12529                                 else
12530                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
12531                                                 voidflags=5
12532                                                 echo "And it supports 4 but has not heard about 8."
12533                                         else
12534                                                 echo "However it supports 8 but not 4."
12535                                         fi
12536                                 fi
12537                         fi
12538                 else
12539                         echo "There is no support at all for void."
12540                         voidflags=0
12541                 fi
12542         fi
12543 esac
12544 case "$voidflags" in
12545 "$defvoidused") ;;
12546 *)      $cat >&4 <<'EOM'
12547   Support flag bits are:
12548     1: basic void declarations.
12549     2: arrays of pointers to functions returning void.
12550     4: operations between pointers to and addresses of void functions.
12551     8: generic void pointers.
12552 EOM
12553         dflt="$voidflags";
12554         rp="Your void support flags add up to what?"
12555         . ./myread
12556         voidflags="$ans"
12557         ;;
12558 esac
12559 $rm -f try.* .out
12560
12561
12562 : How can we generate normalized random numbers ?
12563 echo " "
12564 echo "Looking for a random number function..." >&4
12565 case "$randfunc" in
12566 '')
12567         if set drand48 val -f; eval $csym; $val; then
12568                 dflt="drand48"
12569                 echo "Good, found drand48()." >&4
12570         elif set random val -f; eval $csym; $val; then
12571                 dflt="random"
12572                 echo "OK, found random()." >&4
12573         else
12574                 dflt="rand"
12575                 echo "Yick, looks like I have to use rand()." >&4
12576         fi
12577         echo " "
12578         ;;
12579 *)
12580         dflt="$randfunc"
12581         ;;
12582 esac
12583 cont=true
12584
12585 case "$ccflags" in
12586 *-Dmy_rand=*|*-Dmy_srand=*)
12587         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
12588         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
12589         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
12590         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
12591         ;;
12592 esac
12593
12594 while $test "$cont"; do
12595         rp="Use which function to generate random numbers?"
12596         . ./myread
12597         if $test "$ans" = "$dflt"; then
12598                 : null
12599         else
12600                 randbits=''
12601         fi
12602         randfunc="$ans"
12603         if set $ans val -f; eval $csym; $val; then
12604                 cont=''
12605         else
12606                 dflt=y
12607                 rp="I cannot find function $ans. Use that name anyway?"
12608                 . ./myread
12609                 dflt=rand
12610                 case "$ans" in
12611                         [yY]*) cont='';;
12612                 esac
12613         fi
12614         case "$cont" in
12615         '')
12616                 case "$randfunc" in
12617                 drand48)
12618                         drand01="drand48()"
12619                         seedfunc="srand48"
12620                         randbits=48
12621                         randseedtype=long
12622                         ;;
12623                 rand|random)
12624                         case "$randbits" in
12625                         '')
12626 echo "Checking to see how many bits your $randfunc() function produces..." >&4
12627                                 $cat >try.c <<EOCP
12628 #$i_unistd I_UNISTD
12629 #$i_stdlib I_STDLIB
12630 #include <stdio.h>
12631 #ifdef I_UNISTD
12632 #  include <unistd.h>
12633 #endif
12634 #ifdef I_STDLIB
12635 #  include <stdlib.h>
12636 #endif
12637 int main()
12638 {
12639         register int i;
12640         register unsigned long tmp;
12641         register unsigned long max = 0L;
12642
12643         for (i = 1000; i; i--) {
12644                 tmp = (unsigned long) $randfunc();
12645                 if (tmp > max) max = tmp;
12646         }
12647         for (i = 0; max; i++)
12648                 max /= 2;
12649         printf("%d\n",i);
12650 }
12651 EOCP
12652                                 set try
12653                                 if eval $compile_ok; then
12654                                         dflt=`try`
12655                                 else
12656                                         dflt='?'
12657                                         echo "(I can't seem to compile the test program...)"
12658                                 fi
12659                                 ;;
12660                         *)
12661                                 dflt="$randbits"
12662                                 ;;
12663                         esac
12664                         rp="How many bits does your $randfunc() function produce?"
12665                         . ./myread
12666                         randbits="$ans"
12667                         $rm -f try.c try
12668                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
12669                         seedfunc="s$randfunc"
12670                         randseedtype=unsigned
12671                         ;;
12672                 *)
12673                         dflt="31"
12674                         rp="How many bits does your $randfunc() function produce?"
12675                         . ./myread
12676                         randbits="$ans"
12677                         seedfunc="s$randfunc"
12678                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
12679                         if set $seedfunc val -f; eval $csym; $val; then
12680                                 echo "(Using $seedfunc() to seed random generator)"
12681                         else
12682                                 echo "(Warning: no $seedfunc() to seed random generator)"
12683                                 seedfunc=rand
12684                         fi
12685                         randseedtype=unsigned
12686                         ;;
12687                 esac
12688                 ;;
12689         esac
12690 done
12691
12692 echo " "
12693 echo "Determining whether or not we are on an EBCDIC system..." >&4
12694 $cat >tebcdic.c <<'EOM'
12695 int main()
12696 {
12697   if ('M'==0xd4) return 0;
12698   return 1;
12699 }
12700 EOM
12701
12702 val=$undef
12703 set tebcdic
12704 if eval $compile_ok; then
12705         if ./tebcdic; then
12706                 echo "You have EBCDIC." >&4
12707                 val="$define"
12708         else
12709                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin." >&4
12710         fi
12711 else
12712         echo "I'm unable to compile the test program." >&4
12713         echo "I'll assume ASCII or some ISO Latin." >&4
12714 fi
12715 $rm -f tebcdic.c tebcdic
12716 set ebcdic
12717 eval $setvar
12718
12719 echo " "
12720 $cat >&4 <<EOM
12721 Checking how to flush all pending stdio output...
12722 EOM
12723 # I only know how to find the first 32 possibly open files on SunOS.
12724 # See also hints/sunos_4_1.sh and util.c  --AD
12725 case "$osname" in
12726 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
12727 esac
12728 $cat >>try.c <<EOCP
12729 #include <stdio.h>
12730 #$i_unistd I_UNISTD
12731 #ifdef I_UNISTD
12732 # include <unistd.h>
12733 #endif
12734 #$d_sysconf HAS_SYSCONF
12735 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
12736 #ifdef HAS_STDIO_STREAM_ARRAY
12737 # define STDIO_STREAM_ARRAY $stdio_stream_array
12738 #endif
12739 int main() {
12740   FILE* p = fopen("try.out", "w");
12741 #ifdef TRY_FPUTC
12742   fputc('x', p);
12743 #else
12744 # ifdef TRY_FPRINTF
12745   fprintf(p, "x");
12746 # endif
12747 #endif
12748 #ifdef TRY_FFLUSH_NULL
12749   fflush(NULL);
12750 #endif
12751 #ifdef TRY_FFLUSH_ALL
12752   {
12753     long open_max = -1;
12754 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
12755     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
12756 # else
12757 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
12758     open_max = sysconf(_SC_OPEN_MAX);
12759 #  else
12760 #   ifdef FOPEN_MAX
12761     open_max = FOPEN_MAX;
12762 #   else
12763 #    ifdef OPEN_MAX
12764     open_max = OPEN_MAX;
12765 #    else
12766 #     ifdef _NFILE
12767     open_max = _NFILE;
12768 #     endif
12769 #    endif
12770 #   endif
12771 #  endif
12772 # endif 
12773 # ifdef HAS_STDIO_STREAM_ARRAY
12774     if (open_max > 0) {
12775       long i;
12776       for (i = 0; i < open_max; i++)
12777             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
12778                 STDIO_STREAM_ARRAY[i]._file < open_max &&
12779                 STDIO_STREAM_ARRAY[i]._flag)
12780                 fflush(&STDIO_STREAM_ARRAY[i]);
12781     }   
12782   }
12783 # endif
12784 #endif
12785   _exit(42);
12786 }
12787 EOCP
12788 : first we have to find out how _not_ to flush
12789 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
12790     output=''
12791     set try -DTRY_FPUTC
12792     if eval $compile; then
12793             $rm -f try.out
12794             ./try$exe_ext 2>/dev/null
12795             if $test ! -s try.out -a "X$?" = X42; then
12796                 output=-DTRY_FPUTC
12797             fi
12798     fi
12799     case "$output" in
12800     '')
12801             set try -DTRY_FPRINTF
12802             $rm -f try.out
12803             if eval $compile; then
12804                     $rm -f try.out
12805                     ./try$exe_ext 2>/dev/null
12806                     if $test ! -s try.out -a "X$?" = X42; then
12807                         output=-DTRY_FPRINTF
12808                     fi
12809             fi
12810         ;;
12811     esac
12812 fi
12813 : check for fflush NULL behaviour
12814 case "$fflushNULL" in
12815 '')     set try -DTRY_FFLUSH_NULL $output
12816         if eval $compile; then
12817                 $rm -f try.out
12818                 ./try$exe_ext 2>/dev/null
12819                 code="$?"
12820                 if $test -s try.out -a "X$code" = X42; then
12821                         fflushNULL="`$cat try.out`"
12822                 else
12823                         if $test "X$code" != X42; then
12824                                 $cat >&4 <<EOM
12825 (If this test failed, don't worry, we'll try another method shortly.)
12826 EOM
12827                         fi
12828                 fi
12829         fi
12830         $rm -f core try.core core.try.*
12831         case "$fflushNULL" in
12832         x)      $cat >&4 <<EOM
12833 Your fflush(NULL) works okay for output streams.
12834 Let's see if it clobbers input pipes...
12835 EOM
12836 # As of mid-March 2000 all versions of Solaris appear to have a stdio
12837 # bug that improperly flushes the input end of pipes.  So we avoid the
12838 # autoflush on fork/system/exec support for now. :-(
12839 $cat >tryp.c <<EOCP
12840 #include <stdio.h>
12841 int
12842 main(int argc, char **argv)
12843 {
12844     char buf[1024];
12845     int i;
12846     char *bp = buf;
12847     while (1) {
12848         while ((i = getc(stdin)) != -1
12849                && (*bp++ = i) != '\n'
12850                && bp < &buf[1024])
12851         /* DO NOTHING */ ;
12852         *bp = '\0';
12853         fprintf(stdout, "%s", buf);
12854         fflush(NULL);
12855         if (i == -1)
12856             return 0;
12857         bp = buf;
12858     }
12859 }
12860 EOCP
12861                 fflushNULL="$define"
12862                 set tryp
12863                 if eval $compile; then
12864                     $rm -f tryp.out
12865                     $cat tryp.c | ./tryp$exe_ext 2>/dev/null > tryp.out
12866                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
12867                        $cat >&4 <<EOM
12868 fflush(NULL) seems to behave okay with input streams.
12869 EOM
12870                         fflushNULL="$define"
12871                     else
12872                         $cat >&4 <<EOM
12873 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
12874 EOM
12875                         fflushNULL="$undef"
12876                     fi
12877                 fi
12878                 $rm -f core tryp.c tryp.core core.tryp.*
12879                 ;;
12880         '')     $cat >&4 <<EOM
12881 Your fflush(NULL) isn't working (contrary to ANSI C).
12882 EOM
12883                 fflushNULL="$undef"
12884                 ;;
12885         *)      $cat >&4 <<EOM
12886 Cannot figure out whether your fflush(NULL) works or not.
12887 I'm assuming it doesn't (contrary to ANSI C).
12888 EOM
12889                 fflushNULL="$undef"
12890                 ;;
12891         esac
12892         ;;
12893 $define|true|[yY]*)
12894         fflushNULL="$define"
12895         ;;
12896 *)
12897         fflushNULL="$undef"
12898         ;;
12899 esac
12900 : check explicit looping only if NULL did not work, and if the pipe
12901 : bug does not show up on an explicit flush too
12902 case "$fflushNULL" in
12903 "$undef")
12904         $cat >tryp.c <<EOCP
12905 #include <stdio.h>
12906 int
12907 main(int argc, char **argv)
12908 {
12909     char buf[1024];
12910     int i;
12911     char *bp = buf;
12912     while (1) {
12913         while ((i = getc(stdin)) != -1
12914                && (*bp++ = i) != '\n'
12915                && bp < &buf[1024])
12916         /* DO NOTHING */ ;
12917         *bp = '\0';
12918         fprintf(stdout, "%s", buf);
12919         fflush(stdin);
12920         if (i == -1)
12921             return 0;
12922         bp = buf;
12923     }
12924 }
12925 EOCP
12926         set tryp
12927         if eval $compile; then
12928             $rm -f tryp.out
12929             $cat tryp.c | ./tryp$exe_ext 2>/dev/null > tryp.out
12930             if cmp tryp.c tryp.out >/dev/null 2>&1; then
12931                $cat >&4 <<EOM
12932 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
12933 EOM
12934                 : now check for fflushall behaviour
12935                 case "$fflushall" in
12936                 '')     set try -DTRY_FFLUSH_ALL $output
12937                         if eval $compile; then
12938                                 $cat >&4 <<EOM
12939 (Now testing the other method--but note that this also may fail.)
12940 EOM
12941                                 $rm -f try.out
12942                                 ./try$exe_ext 2>/dev/null
12943                                 if $test -s try.out -a "X$?" = X42; then
12944                                         fflushall="`$cat try.out`"
12945                                 fi
12946                         fi
12947                         $rm -f core try.core core.try.*
12948                         case "$fflushall" in
12949                         x)      $cat >&4 <<EOM
12950 Whew. Flushing explicitly all the stdio streams works.
12951 EOM
12952                                 fflushall="$define"
12953                                 ;;
12954                         '')     $cat >&4 <<EOM
12955 Sigh. Flushing explicitly all the stdio streams doesn't work.
12956 EOM
12957                                 fflushall="$undef"
12958                                 ;;
12959                         *)      $cat >&4 <<EOM
12960 Cannot figure out whether flushing stdio streams explicitly works or not.
12961 I'm assuming it doesn't.
12962 EOM
12963                                 fflushall="$undef"
12964                                 ;;
12965                         esac
12966                         ;;
12967                 "$define"|true|[yY]*)
12968                         fflushall="$define"
12969                         ;;
12970                 *)
12971                         fflushall="$undef"
12972                         ;;
12973                 esac
12974             else
12975                 $cat >&4 <<EOM
12976 All is futile.  Even fflush(stdin) clobbers input pipes!
12977 EOM
12978                 fflushall="$undef"
12979             fi
12980         else
12981             fflushall="$undef"
12982         fi
12983         $rm -f core tryp.c tryp.core core.tryp.*
12984         ;;
12985 *)      fflushall="$undef"
12986         ;;
12987 esac
12988
12989 case "$fflushNULL$fflushall" in
12990 undefundef)
12991         $cat <<EOM
12992 OK, I give up.  I cannot figure out how to flush pending stdio output.
12993 We won't be flushing handles at all before fork/exec/popen.
12994 EOM
12995         ;;
12996 esac
12997 $rm -f try.* try$exe_ext
12998
12999 : Store the full pathname to the ar program for use in the C program
13000 : Respect a hint or command line value for full_ar.
13001 case "$full_ar" in
13002 '') full_ar=$ar ;;
13003 esac
13004
13005 : Store the full pathname to the sed program for use in the C program
13006 full_sed=$sed
13007
13008 : see what type gids are declared as in the kernel
13009 echo " "
13010 echo "Looking for the type for group ids returned by getgid()."
13011 set gid_t gidtype xxx stdio.h sys/types.h
13012 eval $typedef
13013 case "$gidtype" in
13014 xxx)
13015         xxx=`./findhdr sys/user.h`
13016         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
13017         case $1 in
13018         unsigned) dflt="$1 $2" ;;
13019         *) dflt="$1" ;;
13020         esac
13021         ;;
13022 *) dflt="$gidtype";;
13023 esac
13024 case "$gidtype" in
13025 gid_t) echo "gid_t found." ;;
13026 *)      rp="What is the type for group ids returned by getgid()?"
13027         . ./myread
13028         gidtype="$ans"
13029         ;;
13030 esac
13031
13032 echo " "
13033 case "$gidtype" in
13034 *_t) zzz="$gidtype"     ;;
13035 *)   zzz="gid"          ;;
13036 esac
13037 echo "Checking the size of $zzz..." >&4 
13038 cat > try.c <<EOCP
13039 #include <sys/types.h>
13040 #include <stdio.h>
13041 int main() {
13042     printf("%d\n", (int)sizeof($gidtype));
13043     exit(0);
13044 }
13045 EOCP
13046 set try
13047 if eval $compile_ok; then
13048         yyy=`./try`
13049         case "$yyy" in
13050         '')     gidsize=4
13051                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
13052                 ;;
13053         *)      gidsize=$yyy
13054                 echo "Your $zzz is $gidsize bytes long."
13055                 ;;
13056         esac
13057 else
13058         gidsize=4
13059         echo "(I can't compile the test program--guessing $gidsize.)" >&4
13060 fi
13061
13062
13063 echo " "
13064 case "$gidtype" in
13065 *_t) zzz="$gidtype"     ;;
13066 *)   zzz="gid"          ;;
13067 esac
13068 echo "Checking the sign of $zzz..." >&4 
13069 cat > try.c <<EOCP
13070 #include <sys/types.h>
13071 #include <stdio.h>
13072 int main() {
13073         $gidtype foo = -1;
13074         if (foo < 0)
13075                 printf("-1\n");
13076         else
13077                 printf("1\n");
13078 }
13079 EOCP
13080 set try
13081 if eval $compile; then
13082         yyy=`./try`
13083         case "$yyy" in
13084         '')     gidsign=1
13085                 echo "(I can't execute the test program--guessing unsigned.)" >&4
13086                 ;;
13087         *)      gidsign=$yyy
13088                 case "$gidsign" in
13089                  1) echo "Your $zzz is unsigned." ;;
13090                 -1) echo "Your $zzz is signed."   ;;
13091                 esac
13092                 ;;
13093         esac
13094 else
13095         gidsign=1
13096         echo "(I can't compile the test program--guessing unsigned.)" >&4
13097 fi
13098
13099
13100 echo " "
13101
13102 if $test X"$quadtype" != X; then
13103
13104 echo "Checking how to print 64-bit integers..." >&4
13105
13106 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
13107         $cat >try.c <<'EOCP'
13108 #include <sys/types.h>
13109 #include <stdio.h>
13110 int main() {
13111   int q = 12345678901;
13112   printf("%ld\n", q);
13113 }
13114 EOCP
13115         set try
13116         if eval $compile; then
13117                 yyy=`./try$exe_ext`
13118                 case "$yyy" in
13119                 12345678901)
13120                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
13121                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIX64='"X"';
13122                         echo "We will use %d."
13123                         ;;
13124                 esac
13125         fi
13126 fi
13127
13128 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
13129         $cat >try.c <<'EOCP'
13130 #include <sys/types.h>
13131 #include <stdio.h>
13132 int main() {
13133   long q = 12345678901;
13134   printf("%ld\n", q);
13135 }
13136 EOCP
13137         set try
13138         if eval $compile; then
13139                 yyy=`./try$exe_ext`
13140                 case "$yyy" in
13141                 12345678901)
13142                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
13143                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIX64='"lX"';
13144                         echo "We will use %ld."
13145                         ;;
13146                 esac
13147         fi
13148 fi
13149
13150 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
13151         $cat >try.c <<'EOCP'
13152 #include <sys/types.h>
13153 #include <inttypes.h>
13154 #include <stdio.h>
13155 int main() {
13156   int64_t q = 12345678901;
13157   printf("%" PRId64 "\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=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
13166                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIX64=PRIX64;
13167                         echo "We will use the C9X style."
13168                         ;;
13169                 esac
13170         fi
13171 fi
13172
13173 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
13174         $cat >try.c <<'EOCP'
13175 #include <sys/types.h>
13176 #include <stdio.h>
13177 int main() {
13178   long long q = 12345678901LL; /* AIX cc requires the LL prefix. */
13179   printf("%lld\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='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
13188                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIX64='"llX"';
13189                         echo "We will use the %lld style."
13190                         ;;
13191                 esac
13192         fi
13193 fi
13194
13195 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
13196         $cat >try.c <<EOCP
13197 #include <sys/types.h>
13198 #include <stdio.h>
13199 int main() {
13200   $quadtype q = 12345678901;
13201   printf("%Ld\n", q);
13202 }
13203 EOCP
13204         set try
13205         if eval $compile; then
13206                 yyy=`./try$exe_ext`
13207                 case "$yyy" in
13208                 12345678901)
13209                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
13210                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIX64='"LX"';
13211                         echo "We will use %Ld."
13212                         ;;
13213                 esac
13214         fi
13215 fi
13216
13217 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
13218         $cat >try.c <<EOCP
13219 #include <sys/types.h>
13220 #include <stdio.h>
13221 int main() {
13222   $quadtype q = 12345678901;
13223   printf("%qd\n", q);
13224 }
13225 EOCP
13226         set try
13227         if eval $compile; then
13228                 yyy=`./try$exe_ext`
13229                 case "$yyy" in
13230                 12345678901)
13231                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
13232                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIX64='"qX"';
13233                         echo "We will use %qd."
13234                         ;;
13235                 esac
13236         fi
13237 fi
13238
13239 if $test X"$sPRId64" = X; then
13240         echo "Cannot figure out how to print 64-bit integers." >&4
13241 fi
13242
13243 $rm -f try try.*
13244
13245 fi
13246
13247 case "$sPRId64" in
13248 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef"; 
13249         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIX64="$undef"; 
13250         ;;
13251 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define"; 
13252         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIX64="$define"; 
13253         ;;
13254 esac
13255
13256
13257 echo " "
13258 $echo "Checking the format strings to be used for Perl's internal types..." >&4
13259
13260 if $test X"$ivsize" = X8; then
13261         ivdformat="$sPRId64"
13262         uvuformat="$sPRIu64"
13263         uvoformat="$sPRIo64"
13264         uvxformat="$sPRIx64"
13265         uvXformat="$sPRIX64"
13266 else
13267         if $test X"$ivsize" = X"$longsize"; then
13268                 ivdformat='"ld"'
13269                 uvuformat='"lu"'
13270                 uvoformat='"lo"'
13271                 uvxformat='"lx"'
13272                 uvXformat='"lX"'
13273         else
13274                 if $test X"$ivsize" = X"$intsize"; then
13275                         ivdformat='"d"'
13276                         uvuformat='"u"'
13277                         uvoformat='"o"'
13278                         uvxformat='"x"'
13279                         uvXformat='"X"'
13280                 else
13281                         : far out
13282                         if $test X"$ivsize" = X"$shortsize"; then
13283                                 ivdformat='"hd"'
13284                                 uvuformat='"hu"'
13285                                 uvoformat='"ho"'
13286                                 uvxformat='"hx"'
13287                                 uvXformat='"hX"'
13288                         fi
13289                 fi
13290         fi
13291 fi
13292
13293 if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
13294         nveformat="$sPRIeldbl"
13295         nvfformat="$sPRIfldbl"
13296         nvgformat="$sPRIgldbl"
13297         nvEformat="$sPRIEldbl"
13298         nvFformat="$sPRIFldbl"
13299         nvGformat="$sPRIGldbl"
13300 else
13301         nveformat='"e"'
13302         nvfformat='"f"'
13303         nvgformat='"g"'
13304         nvEformat='"E"'
13305         nvFformat='"F"'
13306         nvGformat='"G"'
13307 fi
13308
13309 case "$ivdformat" in
13310 '') echo "$0: Fatal: failed to find format strings, cannot continue." >& 4
13311     exit 1
13312     ;;
13313 esac
13314
13315
13316 echo " "
13317 $echo "Checking the format string to be used for gids..." >&4
13318
13319 case "$gidsign" in
13320 -1)     if $test X"$gidsize" = X"$ivsize"; then
13321                 gidformat="$ivdformat"
13322         else
13323                 if $test X"$gidsize" = X"$longsize"; then
13324                         gidformat='"ld"'
13325                 else
13326                         if $test X"$gidsize" = X"$intsize"; then
13327                                 gidformat='"d"'
13328                         else
13329                                 if $test X"$gidsize" = X"$shortsize"; then
13330                                         gidformat='"hd"'
13331                                 fi
13332                         fi
13333                 fi
13334         fi
13335         ;;
13336 *)      if $test X"$gidsize" = X"$uvsize"; then
13337                 gidformat="$uvuformat"
13338         else
13339                 if $test X"$gidsize" = X"$longsize"; then
13340                         gidformat='"lu"'
13341                 else
13342                         if $test X"$gidsize" = X"$intsize"; then
13343                                 gidformat='"u"'
13344                         else
13345                                 if $test X"$gidsize" = X"$shortsize"; then
13346                                         gidformat='"hu"'
13347                                 fi
13348                         fi
13349                 fi
13350         fi
13351         ;;
13352 esac
13353
13354 : see if getgroups exists
13355 set getgroups d_getgrps
13356 eval $inlibc
13357
13358 : see if setgroups exists
13359 set setgroups d_setgrps
13360 eval $inlibc
13361
13362
13363 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
13364 echo " "
13365 case "$d_getgrps$d_setgrps" in
13366 *define*)
13367         case "$groupstype" in
13368         '') dflt="$gidtype" ;;
13369         *)  dflt="$groupstype" ;;
13370         esac
13371         $cat <<EOM
13372 What type of pointer is the second argument to getgroups() and setgroups()?
13373 Usually this is the same as group ids, $gidtype, but not always.
13374
13375 EOM
13376         rp='What type pointer is the second argument to getgroups() and setgroups()?'
13377         . ./myread
13378         groupstype="$ans"
13379         ;;
13380 *)  groupstype="$gidtype";;
13381 esac
13382
13383 echo " "
13384 echo "Checking if your $make program sets \$(MAKE)..." >&4
13385 case "$make_set_make" in
13386 '')
13387         $sed 's/^X //' > testmake.mak << 'EOF'
13388 Xall:
13389 X       @echo 'maketemp="$(MAKE)"'
13390 EOF
13391         case "`$make -f testmake.mak 2>/dev/null`" in
13392         *maketemp=*) make_set_make='#' ;;
13393         *)      make_set_make="MAKE=$make" ;;
13394         esac
13395         $rm -f testmake.mak
13396         ;;
13397 esac
13398 case "$make_set_make" in
13399 '#') echo "Yup, it does.";;
13400 *) echo "Nope, it doesn't.";;
13401 esac
13402
13403 : see what type is used for mode_t
13404 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
13405 set mode_t modetype int stdio.h sys/types.h
13406 eval $typedef_ask
13407
13408 : define a fucntion to check prototypes
13409 $cat > protochk <<EOSH
13410 $startsh
13411 cc="$cc"
13412 optimize="$optimize"
13413 ccflags="$ccflags"
13414 prototype="$prototype"
13415 define="$define"
13416 rm=$rm
13417 EOSH
13418
13419 $cat >> protochk <<'EOSH'
13420
13421 $rm -f try.c
13422 foo="$1"
13423 shift
13424 while test $# -ge 2; do
13425         case "$1" in
13426                 $define) echo "#include <$2>" >> try.c ;;
13427                 literal) echo "$2" >> try.c ;;
13428         esac
13429     shift 2
13430 done
13431 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
13432 cat >> try.c <<'EOCP'
13433 #ifdef CAN_PROTOTYPE
13434 #define _(args) args
13435 #else
13436 #define _(args) ()
13437 #endif
13438 EOCP
13439 echo "$foo" >> try.c
13440 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
13441 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
13442 status=$?
13443 $rm -f try.[co]
13444 exit $status
13445 EOSH
13446 chmod +x protochk
13447 $eunicefix protochk
13448
13449 : see what type is used for size_t
13450 rp="What is the type used for the length parameter for string functions?"
13451 set size_t sizetype 'unsigned int' stdio.h sys/types.h
13452 eval $typedef_ask
13453
13454 : check for type of arguments to gethostbyaddr. 
13455 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
13456         case "$d_gethbyaddr" in
13457         $define)
13458                 $cat <<EOM
13459
13460 Checking to see what type of arguments are accepted by gethostbyaddr().
13461 EOM
13462                 hdrs="$define sys/types.h
13463                         $d_socket sys/socket.h 
13464                         $i_niin netinet/in.h 
13465                         $i_netdb netdb.h
13466                         $i_unistd unistd.h"
13467                 : The first arg can 'char *' or 'void *'
13468                 : The second arg is some of integral type
13469                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
13470                         for yyy in size_t long int; do
13471                                 case "$netdb_host_type" in
13472                                 '')     try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
13473                                         if ./protochk "$try" $hdrs; then
13474                                                 echo "Your system accepts $xxx for the first arg."
13475                                                 echo "...and $yyy for the second arg."
13476                                                 netdb_host_type="$xxx"
13477                                                 netdb_hlen_type="$yyy"
13478                                         fi
13479                                         ;;
13480                                 esac
13481                         done
13482                 done
13483                 : In case none of those worked, prompt the user.
13484                 case "$netdb_host_type" in
13485                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
13486                         dflt='char *'
13487                         . ./myread
13488                         netdb_host_type=$ans
13489                         rp='What is the type for the 2nd argument to gethostbyaddr?'
13490                         dflt="$sizetype"
13491                         . ./myread
13492                         netdb_hlen_type=$ans
13493                         ;;
13494                 esac
13495                 ;;
13496         *)      : no gethostbyaddr, so pick harmless defaults
13497                 netdb_host_type='char *'
13498                 netdb_hlen_type="$sizetype"
13499                 ;;
13500         esac
13501         # Remove the "const" if needed. -- but then we'll have a 
13502         # prototype clash!
13503         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
13504 fi
13505
13506 : check for type of argument to gethostbyname. 
13507 if test "X$netdb_name_type" = X ; then
13508         case "$d_gethbyname" in
13509         $define)
13510                 $cat <<EOM
13511
13512 Checking to see what type of argument is accepted by gethostbyname().
13513 EOM
13514                 hdrs="$define sys/types.h
13515                         $d_socket sys/socket.h 
13516                         $i_niin netinet/in.h 
13517                         $i_netdb netdb.h
13518                         $i_unistd unistd.h"
13519                 for xxx in "const char *" "char *"; do
13520                         case "$netdb_name_type" in
13521                         '')     try="extern struct hostent *gethostbyname($xxx);"
13522                                 if ./protochk "$try" $hdrs; then
13523                                         echo "Your system accepts $xxx."
13524                                         netdb_name_type="$xxx"
13525                                 fi
13526                                 ;;
13527                         esac
13528                 done
13529                 : In case none of those worked, prompt the user.
13530                 case "$netdb_name_type" in
13531                 '')     rp='What is the type for the 1st argument to gethostbyname?'
13532                         dflt='char *'
13533                         . ./myread
13534                         netdb_name_type=$ans
13535                         ;;
13536                 esac
13537                 ;;
13538         *)      : no gethostbyname, so pick harmless default
13539                 netdb_name_type='char *'
13540                 ;;
13541         esac
13542 fi
13543
13544 : check for type of 1st argument to getnetbyaddr. 
13545 if test "X$netdb_net_type" = X ; then
13546         case "$d_getnbyaddr" in
13547         $define)
13548                 $cat <<EOM
13549
13550 Checking to see what type of 1st argument is accepted by getnetbyaddr().
13551 EOM
13552                 hdrs="$define sys/types.h
13553                         $d_socket sys/socket.h 
13554                         $i_niin netinet/in.h 
13555                         $i_netdb netdb.h
13556                         $i_unistd unistd.h"
13557                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
13558                         case "$netdb_net_type" in
13559                         '')     try="extern struct netent *getnetbyaddr($xxx, int);"
13560                                 if ./protochk "$try" $hdrs; then
13561                                         echo "Your system accepts $xxx."
13562                                         netdb_net_type="$xxx"
13563                                 fi
13564                                 ;;
13565                         esac
13566                 done
13567                 : In case none of those worked, prompt the user.
13568                 case "$netdb_net_type" in
13569                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
13570                         dflt='long'
13571                         . ./myread
13572                         netdb_net_type=$ans
13573                         ;;
13574                 esac
13575                 ;;
13576         *)      : no getnetbyaddr, so pick harmless default
13577                 netdb_net_type='long'
13578                 ;;
13579         esac
13580 fi
13581 : locate the preferred pager for this system
13582 case "$pager" in
13583 '')
13584         dflt=''
13585         case "$pg" in
13586         /*) dflt=$pg;;
13587         esac
13588         case "$more" in
13589         /*) dflt=$more;;
13590         esac
13591         case "$less" in
13592         /*) dflt=$less;;
13593         esac
13594         case "$dflt" in
13595         '') dflt=/usr/ucb/more;;
13596         esac
13597         ;;
13598 *) dflt="$pager";;
13599 esac
13600 echo " "
13601 fn=f/
13602 rp='What pager is used on your system?'
13603 . ./getfile
13604 pager="$ans"
13605
13606 : see what type pids are declared as in the kernel
13607 rp="What is the type of process ids on this system?"
13608 set pid_t pidtype int stdio.h sys/types.h
13609 eval $typedef_ask
13610
13611 : Find earliest binary compatible site_perl subdirectory perl can use.
13612 case "$bincompat5005" in
13613 "$define") xs_apiversion='5.005' ;;
13614 *) xs_apiversion=$version ;;   # The current site_perl version.
13615 esac
13616 : Find earliest pure perl site_perl subdirectory perl can use.
13617 : The versioned directories started at 5.005.
13618 pm_apiversion='5.005'
13619
13620 : check for length of pointer
13621 echo " "
13622 case "$ptrsize" in
13623 '')
13624         echo "Checking to see how big your pointers are..." >&4
13625         if test "$voidflags" -gt 7; then
13626                 echo '#define VOID_PTR char *' > try.c
13627         else
13628                 echo '#define VOID_PTR void *' > try.c
13629         fi
13630         $cat >>try.c <<'EOCP'
13631 #include <stdio.h>
13632 int main()
13633 {
13634     printf("%d\n", (int)sizeof(VOID_PTR));
13635     exit(0);
13636 }
13637 EOCP
13638         set try
13639         if eval $compile_ok; then
13640                 ptrsize=`./try`
13641                 echo "Your pointers are $ptrsize bytes long."
13642         else
13643                 dflt='4'
13644                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
13645                 rp="What is the size of a pointer (in bytes)?"
13646                 . ./myread
13647                 ptrsize="$ans"
13648         fi
13649         ;;
13650 esac
13651 $rm -f try.c try
13652
13653 : see if ar generates random libraries by itself
13654 echo " "
13655 echo "Checking how to generate random libraries on your machine..." >&4
13656 echo 'int bar1() { return bar2(); }' > bar1.c
13657 echo 'int bar2() { return 2; }' > bar2.c
13658 $cat > foo.c <<'EOP'
13659 int main() { printf("%d\n", bar1()); exit(0); }
13660 EOP
13661 $cc $ccflags -c bar1.c >/dev/null 2>&1
13662 $cc $ccflags -c bar2.c >/dev/null 2>&1
13663 $cc $ccflags -c foo.c >/dev/null 2>&1
13664 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
13665 if $cc $ccflags $ldflags -o foobar foo$_o bar$_a $libs > /dev/null 2>&1 &&
13666         ./foobar >/dev/null 2>&1; then
13667         echo "$ar appears to generate random libraries itself."
13668         orderlib=false
13669         ranlib=":"
13670 elif $ar ts bar$_a >/dev/null 2>&1 &&
13671         $cc $ccflags $ldflags -o foobar foo$_o bar$_a $libs > /dev/null 2>&1 &&
13672         ./foobar >/dev/null 2>&1; then
13673                 echo "a table of contents needs to be added with '$ar ts'."
13674                 orderlib=false
13675                 ranlib="$ar ts"
13676 else
13677         case "$ranlib" in
13678         :) ranlib='';;
13679         '')
13680                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
13681                 $test -f $ranlib || ranlib=''
13682                 ;;
13683         esac
13684         if $test -n "$ranlib"; then
13685                 echo "your system has '$ranlib'; we'll use that."
13686                 orderlib=false
13687         else
13688                 echo "your system doesn't seem to support random libraries"
13689                 echo "so we'll use lorder and tsort to order the libraries."
13690                 orderlib=true
13691                 ranlib=":"
13692         fi
13693 fi
13694 $rm -f foo* bar* 
13695
13696 : check for type of arguments to select. 
13697 case "$selecttype" in
13698 '') case "$d_select" in
13699         $define)
13700                 echo " "
13701                 $cat <<EOM
13702 Checking to see what type of arguments are accepted by select().
13703 EOM
13704                 hdrs="$define sys/types.h
13705                         $i_systime sys/time.h 
13706                         $i_sysselct sys/select.h
13707                         $d_socket sys/socket.h"
13708                 : The first arg can be int, unsigned, or size_t
13709                 : The last arg may or may not be 'const'
13710                 val=''
13711                 : void pointer has been seen but using that
13712                 : breaks the selectminbits test
13713                 for xxx in 'fd_set *' 'int *'; do
13714                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
13715                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
13716                                         case "$val" in
13717                                         '')     try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
13718                                                 if ./protochk "$try" $hdrs; then
13719                                                         echo "Your system accepts $xxx."
13720                                                         val="$xxx"
13721                                                 fi
13722                                                 ;;
13723                                         esac
13724                                 done
13725                         done
13726                 done
13727                 case "$val" in
13728                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
13729                         case "$d_fd_set" in
13730                                 $define) dflt="fd_set *" ;;
13731                                 *)              dflt="int *" ;;
13732                         esac
13733                         . ./myread
13734                         val=$ans
13735                         ;;
13736                 esac
13737                 selecttype="$val"
13738                 ;;
13739         *)      : no select, so pick a harmless default
13740                 selecttype='int *'
13741                 ;;
13742         esac
13743         ;;
13744 esac
13745
13746 : check for the select 'width'
13747 case "$selectminbits" in
13748 '') case "$d_select" in
13749         $define)
13750                 $cat <<EOM
13751
13752 Checking to see on how many bits at a time your select() operates...
13753 EOM
13754                 $cat >try.c <<EOCP
13755 #include <sys/types.h>
13756 #$i_time I_TIME
13757 #$i_systime I_SYS_TIME
13758 #$i_systimek I_SYS_TIME_KERNEL
13759 #ifdef I_TIME
13760 #   include <time.h>
13761 #endif
13762 #ifdef I_SYS_TIME
13763 #   ifdef I_SYS_TIME_KERNEL
13764 #       define KERNEL
13765 #   endif
13766 #   include <sys/time.h>
13767 #   ifdef I_SYS_TIME_KERNEL
13768 #       undef KERNEL
13769 #   endif
13770 #endif
13771 #$i_sysselct I_SYS_SELECT
13772 #ifdef I_SYS_SELECT
13773 #include <sys/select.h>
13774 #endif
13775 #$d_socket HAS_SOCKET
13776 #ifdef HAS_SOCKET
13777 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
13778 #endif
13779 #include <stdio.h>
13780 $selecttype b;
13781 #define S sizeof(*(b))
13782 #define MINBITS 64
13783 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
13784 #define NBITS  (NBYTES * 8)
13785 int main() {
13786     char s[NBYTES];
13787     struct timeval t;
13788     int i;
13789     FILE* fp;
13790     int fd;
13791
13792     fclose(stdin);
13793     fp = fopen("try.c", "r");
13794     if (fp == 0)
13795       exit(1);
13796     fd = fileno(fp);
13797     if (fd < 0)
13798       exit(2);
13799     b = ($selecttype)s;
13800     for (i = 0; i < NBITS; i++)
13801         FD_SET(i, b);
13802     t.tv_sec  = 0;
13803     t.tv_usec = 0;
13804     select(fd + 1, b, 0, 0, &t);
13805     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
13806     printf("%d\n", i + 1);
13807     return 0;
13808 }
13809 EOCP
13810                 set try
13811                 if eval $compile_ok; then
13812                         selectminbits=`./try`
13813                         case "$selectminbits" in
13814                         '')     cat >&4 <<EOM
13815 Cannot figure out on how many bits at a time your select() operates.
13816 I'll play safe and guess it is 32 bits.
13817 EOM
13818                                 selectminbits=32
13819                                 bits="32 bits"
13820                                 ;;
13821                         1)      bits="1 bit" ;;
13822                         *)      bits="$selectminbits bits" ;;
13823                         esac
13824                         echo "Your select() operates on $bits at a time." >&4
13825                 else
13826                         rp='What is the minimum number of bits your select() operates on?'
13827                         case "$byteorder" in
13828                         1234|12345678)  dflt=32 ;;
13829                         *)              dflt=1  ;;
13830                         esac
13831                         . ./myread
13832                         val=$ans
13833                         selectminbits="$val"
13834                 fi
13835                 $rm -f try.* try
13836                 ;;
13837         *)      : no select, so pick a harmless default
13838                 selectminbits='32'
13839                 ;;
13840         esac
13841         ;;
13842 esac
13843
13844 : Trace out the files included by signal.h, then look for SIGxxx names.
13845 : Remove SIGARRAYSIZE used by HPUX.
13846 : Remove SIGSTKSIZE used by Linux.
13847 : Remove SIGSTKSZ used by Posix.
13848 : Remove SIGTYP void lines used by OS2.
13849 : Some cpps, like os390, dont give the file name anywhere
13850 if [ "X$fieldn" = X ]; then
13851         : Just make some guesses.  We check them later.
13852         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
13853 else
13854         xxx=`echo '#include <signal.h>' |
13855         $cppstdin $cppminus $cppflags 2>/dev/null |
13856         $grep '^[       ]*#.*include' | 
13857         $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sort | $uniq`
13858 fi
13859 : Check this list of files to be sure we have parsed the cpp output ok.
13860 : This will also avoid potentially non-existent files, such 
13861 : as ../foo/bar.h
13862 xxxfiles=''
13863 for xx in $xxx /dev/null ; do
13864         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
13865 done
13866 : If we have found no files, at least try signal.h
13867 case "$xxxfiles" in
13868 '')     xxxfiles=`./findhdr signal.h` ;;
13869 esac
13870 xxx=`awk '
13871 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
13872         print substr($2, 4, 20)
13873 }
13874 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
13875         print substr($3, 4, 20)
13876 }' $xxxfiles`
13877 : Append some common names just in case the awk scan failed.
13878 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
13879 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
13880 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
13881 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
13882 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
13883
13884 : generate a few handy files for later
13885 $cat > signal.c <<'EOCP'
13886 #include <sys/types.h>
13887 #include <signal.h>
13888 #include <stdio.h>
13889 int main() {
13890
13891 /* Strange style to avoid deeply-nested #if/#else/#endif */
13892 #ifndef NSIG
13893 #  ifdef _NSIG
13894 #    define NSIG (_NSIG)
13895 #  endif
13896 #endif
13897
13898 #ifndef NSIG
13899 #  ifdef SIGMAX
13900 #    define NSIG (SIGMAX+1)
13901 #  endif
13902 #endif
13903
13904 #ifndef NSIG
13905 #  ifdef SIG_MAX
13906 #    define NSIG (SIG_MAX+1)
13907 #  endif
13908 #endif
13909
13910 #ifndef NSIG
13911 #  ifdef MAXSIG
13912 #    define NSIG (MAXSIG+1)
13913 #  endif
13914 #endif
13915
13916 #ifndef NSIG
13917 #  ifdef MAX_SIG
13918 #    define NSIG (MAX_SIG+1)
13919 #  endif
13920 #endif
13921
13922 #ifndef NSIG
13923 #  ifdef SIGARRAYSIZE
13924 #    define NSIG (SIGARRAYSIZE+1) /* Not sure of the +1 */
13925 #  endif
13926 #endif
13927
13928 #ifndef NSIG
13929 #  ifdef _sys_nsig
13930 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
13931 #  endif
13932 #endif
13933
13934 /* Default to some arbitrary number that's big enough to get most
13935    of the common signals.
13936 */
13937 #ifndef NSIG
13938 #    define NSIG 50
13939 #endif
13940
13941 printf("NSIG %d\n", NSIG);
13942
13943 #ifndef JUST_NSIG
13944
13945 EOCP
13946
13947 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
13948 {
13949         printf "#ifdef SIG"; printf $1; printf "\n"
13950         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
13951         printf $1; printf ");\n"
13952         printf "#endif\n"
13953 }
13954 END {
13955         printf "#endif /* JUST_NSIG */\n";
13956         printf "exit(0);\n}\n";
13957 }
13958 ' >>signal.c
13959 $cat >signal.awk <<'EOP'
13960 BEGIN { ndups = 0 }
13961 $1 ~ /^NSIG$/ { nsig = $2 }
13962 ($1 !~ /^NSIG$/) && (NF == 2) {
13963     if ($2 > maxsig) { maxsig = $2 }
13964     if (sig_name[$2]) {
13965         dup_name[ndups] = $1
13966         dup_num[ndups] = $2
13967         ndups++ 
13968     }
13969     else {
13970         sig_name[$2] = $1
13971         sig_num[$2] = $2
13972     }
13973 }
13974 END { 
13975     if (nsig == 0) {
13976         nsig = maxsig + 1
13977     }
13978     printf("NSIG %d\n", nsig);
13979     for (n = 1; n < nsig; n++) {
13980         if (sig_name[n]) {
13981             printf("%s %d\n", sig_name[n], sig_num[n])
13982         }
13983         else {
13984             printf("NUM%d %d\n", n, n) 
13985         }
13986     }
13987     for (n = 0; n < ndups; n++) {
13988         printf("%s %d\n", dup_name[n], dup_num[n])
13989     }
13990 }
13991 EOP
13992 $cat >signal_cmd <<EOS
13993 $startsh
13994 if $test -s signal.lst; then
13995     echo "Using your existing signal.lst file"
13996         exit 0
13997 fi
13998 xxx="$xxx"
13999 EOS
14000 $cat >>signal_cmd <<'EOS'
14001
14002 set signal
14003 if eval $compile_ok; then
14004         ./signal$_exe | $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
14005 else
14006         echo "(I can't seem be able to compile the whole test program)" >&4
14007         echo "(I'll try it in little pieces.)" >&4
14008         set signal -DJUST_NSIG
14009         if eval $compile_ok; then
14010                 ./signal$_exe > signal.nsg
14011                 $cat signal.nsg
14012         else
14013                 echo "I can't seem to figure out how many signals you have." >&4
14014                 echo "Guessing 50." >&4
14015                 echo 'NSIG 50' > signal.nsg
14016         fi
14017         : Now look at all the signal names, one at a time.
14018         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
14019                 $cat > signal.c <<EOCP
14020 #include <sys/types.h>
14021 #include <signal.h>
14022 #include <stdio.h>
14023 int main() {
14024 printf("$xx %d\n", SIG${xx});
14025 return 0;
14026 }
14027 EOCP
14028                 set signal
14029                 if eval $compile; then
14030                         echo "SIG${xx} found."
14031                         ./signal$_exe  >> signal.ls1
14032                 else
14033                         echo "SIG${xx} NOT found."
14034                 fi
14035         done
14036         if $test -s signal.ls1; then
14037                 $cat signal.nsg signal.ls1 |
14038                         $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
14039         fi
14040
14041 fi
14042 if $test -s signal.lst; then
14043         :
14044 else
14045         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
14046         echo 'kill -l' >signal
14047         set X `csh -f <signal`
14048         $rm -f signal
14049         shift
14050         case $# in
14051         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
14052         esac
14053         echo $@ | $tr ' ' $trnl | \
14054             $awk '{ printf "%s %d\n", $1, ++s; }
14055                   END { printf "NSIG %d\n", ++s }' >signal.lst
14056 fi
14057 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
14058 EOS
14059 chmod a+x signal_cmd
14060 $eunicefix signal_cmd
14061
14062 : generate list of signal names
14063 echo " "
14064 case "$sig_name_init" in
14065 '') doinit=yes ;;
14066 *)  case "$sig_num_init" in
14067     ''|*,*) doinit=yes ;;
14068     esac ;;
14069 esac
14070 case "$doinit" in
14071 yes)
14072         echo "Generating a list of signal names and numbers..." >&4
14073         . ./signal_cmd
14074         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
14075         sig_name=`$awk 'BEGIN { printf "ZERO " }
14076                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
14077         sig_num=`$awk  'BEGIN { printf "0 " }
14078                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
14079         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
14080                              !/^NSIG/   { printf "\"%s\", ", $1 }
14081                              END        { printf "0\n" }' signal.lst`
14082         sig_num_init=`$awk  'BEGIN      { printf "0, " }
14083                              !/^NSIG/   { printf "%d, ", $2}
14084                              END        { printf "0\n"}' signal.lst`
14085         ;;
14086 esac
14087 echo "The following $sig_count signals are available:"
14088 echo " "
14089 echo $sig_name | $awk \
14090 'BEGIN { linelen = 0 }
14091 {
14092         for (i = 1; i <= NF; i++) {
14093                 name = "SIG" $i " "
14094                 linelen = linelen + length(name)
14095                 if (linelen > 70) {
14096                         printf "\n"
14097                         linelen = length(name)
14098                 }
14099                 printf "%s", name
14100         }
14101         printf "\n"
14102 }'
14103 $rm -f signal signal.c signal.awk signal.lst signal_cmd 
14104
14105 echo " "
14106 case "$sizetype" in
14107 *_t) zzz="$sizetype"    ;;
14108 *)   zzz="filesize"     ;;
14109 esac
14110 echo "Checking the size of $zzz..." >&4 
14111 cat > try.c <<EOCP
14112 #include <sys/types.h>
14113 #include <stdio.h>
14114 int main() {
14115     printf("%d\n", (int)sizeof($sizetype));
14116     exit(0);
14117 }
14118 EOCP
14119 set try
14120 if eval $compile_ok; then
14121         yyy=`./try`
14122         case "$yyy" in
14123         '')     sizesize=4
14124                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
14125                 ;;
14126         *)      sizesize=$yyy
14127                 echo "Your $zzz size is $sizesize bytes."
14128                 ;;
14129         esac
14130 else
14131         sizesize=4
14132         echo "(I can't compile the test program--guessing $sizesize.)" >&4
14133 fi
14134
14135
14136 : check for socklen_t
14137 echo " "
14138 echo "Checking to see if you have socklen_t..." >&4
14139 $cat >try.c <<EOCP
14140 #include <sys/types.h>
14141 #$d_socket HAS_SOCKET
14142 #ifdef HAS_SOCKET
14143 #include <sys/socket.h>
14144 #endif
14145 int main() { socklen_t x = 16; }
14146 EOCP
14147 set try
14148 if eval $compile; then
14149         val="$define"
14150         echo "You have socklen_t."
14151 else
14152         val="$undef"
14153         echo "You do not have socklen_t."
14154         case "$sizetype" in
14155         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
14156         esac
14157 fi
14158 $rm -f try try.*
14159 set d_socklen_t
14160 eval $setvar
14161
14162 : check for type of the size argument to socket calls
14163 case "$d_socket" in
14164 "$define")
14165         $cat <<EOM
14166
14167 Checking to see what type is the last argument of accept().
14168 EOM
14169         hdrs="$define sys/types.h $d_socket sys/socket.h" 
14170         yyy=''
14171         case "$d_socklen_t" in
14172         "$define") yyy="$yyy socklen_t"
14173         esac
14174         yyy="$yyy $sizetype int long unsigned"
14175         for xxx in $yyy; do
14176                 case "$socksizetype" in
14177                 '')     try="extern int accept(int, struct sockaddr *, $xxx *);"
14178                         if ./protochk "$try" $hdrs; then
14179                                 echo "Your system accepts '$xxx *' for the last argument of accept()."
14180                                 socksizetype="$xxx"
14181                         fi
14182                         ;;
14183                 esac
14184         done
14185 : In case none of those worked, prompt the user.
14186         case "$socksizetype" in
14187         '')     rp='What is the type for socket address structure sizes?'
14188                 dflt='int'
14189                 . ./myread
14190                 socksizetype=$ans
14191                 ;;
14192         esac
14193         ;;
14194 *)      : no sockets, so pick relatively harmless default
14195         socksizetype='int'
14196         ;;
14197 esac
14198
14199 : see what type is used for signed size_t
14200 set ssize_t ssizetype int stdio.h sys/types.h
14201 eval $typedef
14202 dflt="$ssizetype"
14203 $cat > ssize.c <<EOM
14204 #include <stdio.h>
14205 #include <sys/types.h>
14206 #define Size_t $sizetype
14207 #define SSize_t $dflt
14208 int main()
14209 {
14210         if (sizeof(Size_t) == sizeof(SSize_t))
14211                 printf("$dflt\n");
14212         else if (sizeof(Size_t) == sizeof(int))
14213                 printf("int\n");
14214         else 
14215                 printf("long\n");
14216         exit(0);
14217 }
14218 EOM
14219 echo " "
14220 set ssize
14221 if eval $compile_ok && ./ssize > /dev/null; then
14222         ssizetype=`./ssize`
14223         echo "I'll be using $ssizetype for functions returning a byte count." >&4
14224 else
14225         $cat >&4 <<EOM
14226 Help! I can't compile and run the ssize_t test program: please enlighten me!
14227 (This is probably a misconfiguration in your system or libraries, and
14228 you really ought to fix it.  Still, I'll try anyway.)
14229
14230 I need a type that is the same size as $sizetype, but is guaranteed to
14231 be signed.  Common values are ssize_t, int and long.
14232
14233 EOM
14234         rp="What signed type is the same size as $sizetype?"
14235         . ./myread
14236         ssizetype="$ans"
14237 fi
14238 $rm -f ssize ssize.*
14239
14240 : see what type of char stdio uses.
14241 echo " "
14242 if $contains 'unsigned.*char.*_ptr;' `./findhdr stdio.h` >/dev/null 2>&1 ; then
14243         echo "Your stdio uses unsigned chars." >&4
14244         stdchar="unsigned char"
14245 else
14246         echo "Your stdio uses signed chars." >&4
14247         stdchar="char"
14248 fi
14249
14250 : see if time exists
14251 echo " "
14252 if test "X$d_time" = X -o X"$timetype" = X; then
14253     if set time val -f d_time; eval $csym; $val; then
14254                 echo 'time() found.' >&4
14255                 val="$define"
14256                 rp="What is the type returned by time() on this system?"
14257                 set time_t timetype long stdio.h sys/types.h
14258                 eval $typedef_ask
14259     else
14260                 echo 'time() not found, hope that will do.' >&4
14261                 val="$undef"
14262                 timetype='int';
14263     fi
14264     set d_time
14265     eval $setvar
14266 fi
14267
14268 : see what type uids are declared as in the kernel
14269 echo " "
14270 echo "Looking for the type for user ids returned by getuid()."
14271 set uid_t uidtype xxx stdio.h sys/types.h
14272 eval $typedef
14273 case "$uidtype" in
14274 xxx)
14275         xxx=`./findhdr sys/user.h`
14276         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
14277         case $1 in
14278         unsigned) dflt="$1 $2" ;;
14279         *) dflt="$1" ;;
14280         esac
14281         ;;
14282 *) dflt="$uidtype";;
14283 esac
14284 case "$uidtype" in
14285 uid_t)  echo "uid_t found." ;;
14286 *)      rp="What is the type for user ids returned by getuid()?"
14287         . ./myread
14288         uidtype="$ans"
14289         ;;
14290 esac
14291
14292 echo " "
14293 case "$uidtype" in
14294 *_t) zzz="$uidtype"     ;;
14295 *)   zzz="uid"          ;;
14296 esac
14297 echo "Checking the size of $zzz..." >&4 
14298 cat > try.c <<EOCP
14299 #include <sys/types.h>
14300 #include <stdio.h>
14301 int main() {
14302     printf("%d\n", (int)sizeof($uidtype));
14303     exit(0);
14304 }
14305 EOCP
14306 set try
14307 if eval $compile_ok; then
14308         yyy=`./try`
14309         case "$yyy" in
14310         '')     uidsize=4
14311                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
14312                 ;;
14313         *)      uidsize=$yyy
14314                 echo "Your $zzz is $uidsize bytes long."
14315                 ;;
14316         esac
14317 else
14318         uidsize=4
14319         echo "(I can't compile the test program--guessing $uidsize.)" >&4
14320 fi
14321
14322 echo " "
14323 case "$uidtype" in
14324 *_t) zzz="$uidtype"     ;;
14325 *)   zzz="uid"          ;;
14326 esac
14327 echo "Checking the sign of $zzz..." >&4
14328 cat > try.c <<EOCP
14329 #include <sys/types.h>
14330 #include <stdio.h>
14331 int main() {
14332         $uidtype foo = -1;
14333         if (foo < 0)
14334                 printf("-1\n");
14335         else
14336                 printf("1\n");
14337 }
14338 EOCP
14339 set try
14340 if eval $compile; then
14341         yyy=`./try`
14342         case "$yyy" in
14343         '')     uidsign=1
14344                 echo "(I can't execute the test program--guessing unsigned.)" >&4
14345                 ;;
14346         *)      uidsign=$yyy
14347                 case "$uidsign" in
14348                  1) echo "Your $zzz is unsigned." ;;
14349                 -1) echo "Your $zzz is signed."   ;;
14350                 esac
14351                 ;;
14352         esac
14353 else
14354         uidsign=1
14355         echo "(I can't compile the test program--guessing unsigned.)" >&4
14356 fi
14357
14358
14359
14360 echo " "
14361 $echo "Checking the format string to be used for uids..." >&4
14362
14363 case "$uidsign" in
14364 -1)     if $test X"$uidsize" = X"$ivsize"; then
14365                 uidformat="$ivdformat"
14366         else
14367                 if $test X"$uidsize" = X"$longsize"; then
14368                         uidformat='"ld"'
14369                 else
14370                         if $test X"$uidsize" = X"$intsize"; then
14371                                 uidformat='"d"'
14372                         else
14373                                 if $test X"$uidsize" = X"$shortsize"; then
14374                                         uidformat='"hd"'
14375                                 fi
14376                         fi
14377                 fi
14378         fi
14379         ;;
14380 *)      if $test X"$uidsize" = X"$uvsize"; then
14381                 uidformat="$uvuformat"
14382         else
14383                 if $test X"$uidsize" = X"$longsize"; then
14384                         uidformat='"lu"'
14385                 else
14386                         if $test X"$uidsize" = X"$intsize"; then
14387                                 uidformat='"u"'
14388                         else
14389                                 if $test X"$uidsize" = X"$shortsize"; then
14390                                         uidformat='"hu"'
14391                                 fi
14392                         fi
14393                 fi
14394         fi
14395         ;;
14396 esac
14397
14398 : see if dbm.h is available
14399 : see if dbmclose exists
14400 set dbmclose d_dbmclose
14401 eval $inlibc
14402
14403 case "$d_dbmclose" in
14404 $define)
14405         set dbm.h i_dbm
14406         eval $inhdr
14407         case "$i_dbm" in
14408         $define)
14409                 val="$undef"
14410                 set i_rpcsvcdbm
14411                 eval $setvar
14412                 ;;
14413         *)      set rpcsvc/dbm.h i_rpcsvcdbm
14414                 eval $inhdr
14415                 ;;
14416         esac
14417         ;;
14418 *)      echo "We won't be including <dbm.h>"
14419         val="$undef"
14420         set i_dbm
14421         eval $setvar
14422         val="$undef"
14423         set i_rpcsvcdbm
14424         eval $setvar
14425         ;;
14426 esac
14427
14428 : see if this is a sys/file.h system
14429 val=''
14430 set sys/file.h val
14431 eval $inhdr
14432
14433 : do we need to include sys/file.h ?
14434 case "$val" in
14435 "$define")
14436         echo " "
14437         if $h_sysfile; then
14438                 val="$define"
14439                 echo "We'll be including <sys/file.h>." >&4
14440         else
14441                 val="$undef"
14442                 echo "We won't be including <sys/file.h>." >&4
14443         fi
14444         ;;
14445 *)
14446         h_sysfile=false
14447         ;;
14448 esac
14449 set i_sysfile
14450 eval $setvar
14451
14452 : see if fcntl.h is there
14453 val=''
14454 set fcntl.h val
14455 eval $inhdr
14456
14457 : see if we can include fcntl.h
14458 case "$val" in
14459 "$define")
14460         echo " "
14461         if $h_fcntl; then
14462                 val="$define"
14463                 echo "We'll be including <fcntl.h>." >&4
14464         else
14465                 val="$undef"
14466                 if $h_sysfile; then
14467         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
14468                 else
14469                         echo "We won't be including <fcntl.h>." >&4
14470                 fi
14471         fi
14472         ;;
14473 *)
14474         h_fcntl=false
14475         val="$undef"
14476         ;;
14477 esac
14478 set i_fcntl
14479 eval $setvar
14480
14481 : see if this is a iconv.h system
14482 set iconv.h i_iconv
14483 eval $inhdr
14484
14485 : see if this is a ieeefp.h system
14486 set ieeefp.h i_ieeefp
14487 eval $inhdr
14488
14489 : see if this is a libutil.h system
14490 set libutil.h i_libutil
14491 eval $inhdr
14492
14493 : see if locale.h is available
14494 set locale.h i_locale
14495 eval $inhdr
14496
14497 : see if mach cthreads are available
14498 if test "X$usethreads" = "X$define"; then
14499         set mach/cthreads.h i_machcthr
14500         eval $inhdr
14501 else
14502         i_machcthr="$undef"
14503 fi
14504
14505
14506
14507 : see if this is a math.h system
14508 set math.h i_math
14509 eval $inhdr
14510
14511 : see if this is a mntent.h system
14512 set mntent.h i_mntent
14513 eval $inhdr
14514
14515 : see if ndbm.h is available
14516 set ndbm.h t_ndbm
14517 eval $inhdr
14518 case "$t_ndbm" in
14519 $define)
14520         : see if dbm_open exists
14521         set dbm_open d_dbm_open
14522         eval $inlibc
14523         case "$d_dbm_open" in
14524         $undef)
14525                 t_ndbm="$undef"
14526                 echo "We won't be including <ndbm.h>"
14527                 ;;
14528         esac
14529         ;;
14530 esac
14531 val="$t_ndbm"
14532 set i_ndbm
14533 eval $setvar
14534
14535 : see if net/errno.h is available
14536 val=''
14537 set net/errno.h val
14538 eval $inhdr
14539
14540 : Unfortunately, it causes problems on some systems.  Arrgh.
14541 case "$val" in
14542 $define)
14543         cat > try.c <<'EOM'
14544 #include <stdio.h>
14545 #include <errno.h>
14546 #include <net/errno.h>
14547 int func()
14548 {
14549         return ENOTSOCK;
14550 }
14551 EOM
14552         if $cc $ccflags -c try.c >/dev/null 2>&1; then
14553                 echo "We'll be including <net/errno.h>." >&4
14554         else
14555                 echo "We won't be including <net/errno.h>." >&4
14556                 val="$undef"
14557         fi
14558         $rm -f try.* try
14559         ;;
14560 esac
14561 set i_neterrno
14562 eval $setvar
14563
14564 : see if netinet/tcp.h is available
14565 set netinet/tcp.h i_netinettcp
14566 eval $inhdr
14567
14568 : see if this is a poll.h system
14569 set poll.h i_poll
14570 eval $inhdr
14571
14572 : see if this is a prot.h system
14573 set prot.h i_prot
14574 eval $inhdr
14575
14576 echo " "
14577 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4 
14578 $cat <<'EOSH' > Cppsym.know
14579 a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
14580 AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
14581 alliant alpha am29000 AM29000 amiga AMIGAOS AMIX
14582 ansi ANSI_C_SOURCE apollo ardent atarist att386 att3b BeOS
14583 BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
14584 BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
14585 bull c cadmus clipper CMU COFF COMPILER_VERSION
14586 concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
14587 CYGWIN DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
14588 Dynix DynixPTX ELF encore EPI EXTENSIONS FILE_OFFSET_BITS
14589 FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
14590 GNU_SOURCE GNUC GNUC_MINOR GO32 gould GOULD_PN
14591 H3050R H3050RX hbullx20 hcx host_mips
14592 hp200 hp300 hp700 HP700 hp800 hp9000
14593 hp9000s200 hp9000s300 hp9000s400 hp9000s500
14594 hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
14595 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
14596 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
14597 INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
14598 LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
14599 LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
14600 Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
14601 LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
14602 M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
14603 M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
14604 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
14605 MATH_HAS_NO_SIDE_EFFECTS
14606 mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
14607 mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
14608 mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
14609 MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
14610 mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
14611 NetBSD news1500 news1700 news1800 news1900 news3700
14612 news700 news800 news900 NeXT NLS ns16000 ns32000
14613 ns32016 ns32332 ns32k nsc32000
14614 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
14615 pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
14616 pc532 pdp11 PGC PIC plexus PORTAR posix
14617 POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
14618 POSIX_C_SOURCE POSIX_SOURCE POWER
14619 PROTOTYPES PWB pyr QNX R3000 REENTRANT RES Rhapsody RISC6000
14620 riscix riscos RT scs SCO sequent sgi SGI_SOURCE sinix
14621 SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
14622 sony sony_news sonyrisc sparc sparclite spectrum
14623 stardent stdc STDC_EXT stratos sun sun3 sun386
14624 Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
14625 SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
14626 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
14627 sysV68 sysV88 Tek4132 Tek4300 titan
14628 tower tower32 tower32_200 tower32_600 tower32_700
14629 tower32_800 tower32_850 tss
14630 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
14631 ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
14632 unix UNIX95 UNIX99 unixpc unos USGr4 USGr4_2
14633 Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms xenix Xenix286
14634 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
14635 XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
14636 z8000
14637 EOSH
14638 # Maybe put other stuff here too.
14639 cat <<EOSH >>Cppsym.know
14640 $osname
14641 EOSH
14642 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
14643 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
14644 $cat Cppsym.know > Cppsym.c
14645 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | sort | uniq > Cppsym.know
14646 $rm -f Cppsym.a Cppsym.b Cppsym.c
14647 cat <<EOSH > Cppsym
14648 $startsh
14649 if $test \$# -gt 0; then
14650     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
14651     if $test -s Cppsym.got; then
14652         $rm -f Cppsym.got
14653         exit 0
14654     fi
14655     $rm -f Cppsym.got
14656     exit 1
14657 else
14658     $tr " " "$trnl" | ./Cppsym.try
14659     exit 0
14660 fi
14661 EOSH
14662 chmod +x Cppsym
14663 $eunicefix Cppsym
14664 cat <<EOSH > Cppsym.try
14665 $startsh
14666 cat <<'EOCP' > try.c
14667 #include <stdio.h>
14668 int main() {
14669 EOCP
14670 $awk \\
14671 EOSH
14672 cat <<'EOSH' >> Cppsym.try
14673 'length($1) > 0 {
14674     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
14675     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
14676     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
14677     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
14678 }'       >> try.c
14679 echo '}' >> try.c
14680 EOSH
14681 cat <<EOSH >> Cppsym.try
14682 ccflags="$ccflags"
14683 case "$osname-$gccversion" in
14684 irix-) ccflags="\$ccflags -woff 1178" ;;
14685 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
14686 esac
14687 $cc $optimize \$ccflags $ldflags -o try try.c $libs && ./try$exe_ext
14688 EOSH
14689 chmod +x Cppsym.try
14690 $eunicefix Cppsym.try
14691 ./Cppsym < Cppsym.know > Cppsym.true
14692 : now check the C compiler for additional symbols
14693 postprocess_cc_v=''
14694 case "$osname" in
14695 aix) postprocess_cc_v="|$tr , ' '" ;;
14696 esac
14697 $cat >ccsym <<EOS
14698 $startsh
14699 $cat >tmp.c <<EOF
14700 extern int foo;
14701 EOF
14702 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
14703 do
14704         case "\$i" in
14705         -D*) echo "\$i" | $sed 's/^-D//';;
14706         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A\(.*\)(\(.*\))/\1=\2/';;
14707         esac
14708 done
14709 $rm -f try.c
14710 EOS
14711 postprocess_cc_v=''
14712 chmod +x ccsym
14713 $eunicefix ccsym
14714 ./ccsym > ccsym1.raw
14715 if $test -s ccsym1.raw; then
14716        $sort ccsym1.raw | $uniq >ccsym.raw
14717 else
14718        mv ccsym1.raw ccsym.raw
14719 fi
14720
14721 $awk '/\=/ { print $0; next }
14722         { print $0"=1" }' ccsym.raw >ccsym.list
14723 $awk '/\=/ { print $0; next }
14724         { print $0"=1" }' Cppsym.true >ccsym.true
14725 $comm -13 ccsym.true ccsym.list >ccsym.own
14726 $comm -12 ccsym.true ccsym.list >ccsym.com
14727 $comm -23 ccsym.true ccsym.list >ccsym.cpp
14728 also=''
14729 if $test -z ccsym.raw; then
14730         echo "Your C compiler doesn't seem to define any symbols!" >&4
14731         echo " "
14732         echo "However, your C preprocessor defines the following symbols:"
14733         $cat Cppsym.true
14734         ccsymbols=''
14735         cppsymbols=`$cat Cppsym.true`
14736         cppsymbols=`echo $cppsymbols`
14737         cppccsymbols="$cppsymbols"
14738 else
14739         if $test -s ccsym.com; then
14740                 echo "Your C compiler and pre-processor define these symbols:"
14741                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
14742                 also='also '
14743                 symbols='ones'
14744                 cppccsymbols=`$cat ccsym.com`
14745                 cppccsymbols=`echo $cppccsymbols`
14746                 $test "$silent" || sleep 1
14747         fi
14748         if $test -s ccsym.cpp; then
14749                 $test "$also" && echo " "
14750                 echo "Your C pre-processor ${also}defines the following symbols:"
14751                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
14752                 also='further '
14753                 cppsymbols=`$cat ccsym.cpp`
14754                 cppsymbols=`echo $cppsymbols`
14755                 $test "$silent" || sleep 1
14756         fi
14757         if $test -s ccsym.own; then
14758                 $test "$also" && echo " "
14759                 echo "Your C compiler ${also}defines the following cpp symbols:"
14760                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
14761                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
14762                 ccsymbols=`$cat ccsym.own`
14763                 ccsymbols=`echo $ccsymbols`
14764                 $test "$silent" || sleep 1
14765         fi
14766 fi
14767 $rm -f ccsym* Cppsym.*
14768
14769 : see if this is a termio system
14770 val="$undef"
14771 val2="$undef"
14772 val3="$undef"
14773 if $test `./findhdr termios.h`; then
14774         set tcsetattr i_termios
14775         eval $inlibc
14776         val3="$i_termios"
14777 fi
14778 echo " "
14779 case "$val3" in
14780 "$define") echo "You have POSIX termios.h... good!" >&4;;
14781 *) if ./Cppsym pyr; then
14782                 case "`/bin/universe`" in
14783                 ucb) if $test `./findhdr sgtty.h`; then
14784                                 val2="$define"
14785                                 echo "<sgtty.h> found." >&4
14786                         else
14787                                 echo "System is pyramid with BSD universe."
14788                                 echo "<sgtty.h> not found--you could have problems." >&4
14789                         fi;;
14790                 *) if $test `./findhdr termio.h`; then
14791                                 val="$define"
14792                                 echo "<termio.h> found." >&4
14793                         else
14794                                 echo "System is pyramid with USG universe."
14795                                 echo "<termio.h> not found--you could have problems." >&4
14796                         fi;;
14797                 esac
14798         elif ./usg; then
14799                 if $test `./findhdr termio.h`; then
14800                         echo "<termio.h> found." >&4
14801                         val="$define"
14802                 elif $test `./findhdr sgtty.h`; then
14803                         echo "<sgtty.h> found." >&4
14804                         val2="$define"
14805                 else
14806 echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
14807                 fi
14808         else
14809                 if $test `./findhdr sgtty.h`; then
14810                         echo "<sgtty.h> found." >&4
14811                         val2="$define"
14812                 elif $test `./findhdr termio.h`; then
14813                         echo "<termio.h> found." >&4
14814                         val="$define"
14815                 else
14816 echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
14817                 fi
14818         fi;;
14819 esac
14820 set i_termio; eval $setvar
14821 val=$val2; set i_sgtty; eval $setvar
14822 val=$val3; set i_termios; eval $setvar
14823
14824 : see if this is a shadow.h system
14825 set shadow.h i_shadow
14826 eval $inhdr
14827
14828 : see if this is a socks.h system
14829 set socks.h i_socks
14830 eval $inhdr
14831
14832 : see if stdarg is available
14833 echo " "
14834 if $test `./findhdr stdarg.h`; then
14835         echo "<stdarg.h> found." >&4
14836         valstd="$define"
14837 else
14838         echo "<stdarg.h> NOT found." >&4
14839         valstd="$undef"
14840 fi
14841
14842 : see if varags is available
14843 echo " "
14844 if $test `./findhdr varargs.h`; then
14845         echo "<varargs.h> found." >&4
14846 else
14847         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
14848 fi
14849
14850 : set up the varargs testing programs
14851 $cat > varargs.c <<EOP
14852 #ifdef I_STDARG
14853 #include <stdarg.h>
14854 #endif
14855 #ifdef I_VARARGS
14856 #include <varargs.h>
14857 #endif
14858
14859 #ifdef I_STDARG
14860 int f(char *p, ...)
14861 #else
14862 int f(va_alist)
14863 va_dcl
14864 #endif
14865 {
14866         va_list ap;
14867 #ifndef I_STDARG
14868         char *p;
14869 #endif
14870 #ifdef I_STDARG
14871         va_start(ap,p);
14872 #else
14873         va_start(ap);
14874         p = va_arg(ap, char *);
14875 #endif
14876         va_end(ap);
14877 }
14878 EOP
14879 $cat > varargs <<EOP
14880 $startsh
14881 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
14882         echo "true"
14883 else
14884         echo "false"
14885 fi
14886 $rm -f varargs$_o
14887 EOP
14888 chmod +x varargs
14889
14890 : now check which varargs header should be included
14891 echo " "
14892 i_varhdr=''
14893 case "$valstd" in
14894 "$define")
14895         if `./varargs I_STDARG`; then
14896                 val='stdarg.h'
14897         elif `./varargs I_VARARGS`; then
14898                 val='varargs.h'
14899         fi
14900         ;;
14901 *)
14902         if `./varargs I_VARARGS`; then
14903                 val='varargs.h'
14904         fi
14905         ;;
14906 esac
14907 case "$val" in
14908 '')
14909 echo "I could not find the definition for va_dcl... You have problems..." >&4
14910         val="$undef"; set i_stdarg; eval $setvar
14911         val="$undef"; set i_varargs; eval $setvar
14912         ;;
14913 *) 
14914         set i_varhdr
14915         eval $setvar
14916         case "$i_varhdr" in
14917         stdarg.h)
14918                 val="$define"; set i_stdarg; eval $setvar
14919                 val="$undef"; set i_varargs; eval $setvar
14920                 ;;
14921         varargs.h)
14922                 val="$undef"; set i_stdarg; eval $setvar
14923                 val="$define"; set i_varargs; eval $setvar
14924                 ;;
14925         esac
14926         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
14927 esac
14928 $rm -f varargs*
14929
14930 : see if stddef is available
14931 set stddef.h i_stddef
14932 eval $inhdr
14933
14934 : see if this is a sunmath.h system
14935 set sunmath.h i_sunmath
14936 eval $inhdr
14937
14938 : see if sys/access.h is available
14939 set sys/access.h i_sysaccess
14940 eval $inhdr
14941
14942 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
14943 set sys/filio.h i_sysfilio
14944 eval $inhdr
14945 echo " "
14946 if $test `./findhdr sys/ioctl.h`; then
14947         val="$define"
14948         echo '<sys/ioctl.h> found.' >&4
14949 else
14950         val="$undef"
14951         if $test $i_sysfilio = "$define"; then
14952             echo '<sys/ioctl.h> NOT found.' >&4
14953         else
14954                 $test $i_sgtty = "$define" && xxx="sgtty.h"
14955                 $test $i_termio = "$define" && xxx="termio.h"
14956                 $test $i_termios = "$define" && xxx="termios.h"
14957 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
14958         fi
14959 fi
14960 set i_sysioctl
14961 eval $setvar
14962
14963
14964 : see if this is a syslog.h system
14965 set syslog.h i_syslog
14966 eval $inhdr
14967
14968
14969 : see if this is a sys/mode.h system
14970 set sys/mode.h i_sysmode
14971 eval $inhdr
14972
14973 : see if sys/resource.h has to be included
14974 set sys/resource.h i_sysresrc
14975 eval $inhdr
14976
14977 : see if sys/security.h is available
14978 set sys/security.h i_syssecrt
14979 eval $inhdr
14980
14981 : see if this is a sys/statvfs.h system
14982 set sys/statvfs.h i_sysstatvfs
14983 eval $inhdr
14984
14985 : see if this is a sys/uio.h system
14986 set sys/uio.h i_sysuio
14987 eval $inhdr
14988
14989 : see if this is a sys/un.h system
14990 set sys/un.h i_sysun
14991 eval $inhdr
14992
14993
14994 : see if this is a sys/utsname.h system
14995 set sys/utsname.h i_sysutsname
14996 eval $inhdr
14997
14998 : see if this is a syswait system
14999 set sys/wait.h i_syswait
15000 eval $inhdr
15001
15002 : see if this is a ustat.h system
15003 set ustat.h i_ustat
15004 eval $inhdr
15005
15006 : see if this is an utime system
15007 set utime.h i_utime
15008 eval $inhdr
15009
15010 : see if this is a values.h system
15011 set values.h i_values
15012 eval $inhdr
15013
15014 : see if this is a vfork system
15015 case "$d_vfork" in
15016 "$define")
15017         set vfork.h i_vfork
15018         eval $inhdr
15019         ;;
15020 *)
15021         i_vfork="$undef"
15022         ;;
15023 esac
15024
15025 : see if gdbm.h is available
15026 set gdbm.h t_gdbm
15027 eval $inhdr
15028 case "$t_gdbm" in
15029 $define)
15030         : see if gdbm_open exists
15031         set gdbm_open d_gdbm_open
15032         eval $inlibc
15033         case "$d_gdbm_open" in
15034         $undef)
15035                 t_gdbm="$undef"
15036                 echo "We won't be including <gdbm.h>"
15037                 ;;
15038         esac
15039         ;;
15040 esac
15041 val="$t_gdbm"
15042 set i_gdbm
15043 eval $setvar
15044
15045 echo " "
15046 echo "Looking for extensions..." >&4
15047 : If we are using the old config.sh, known_extensions may contain
15048 : old or inaccurate or duplicate values.
15049 known_extensions=''
15050 nonxs_extensions=''
15051 : We do not use find because it might not be available.
15052 : We do not just use MANIFEST because the user may have dropped
15053 : some additional extensions into the source tree and expect them
15054 : to be built.
15055
15056 : Function to recursively find available extensions, ignoring DynaLoader
15057 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
15058 find_extensions='
15059     for xxx in *; do
15060        case "$xxx" in
15061            DynaLoader|dynaload) ;;
15062            *)
15063            if $test -f $xxx/$xxx.xs; then
15064                known_extensions="$known_extensions $1$xxx";
15065            elif $test -f $xxx/Makefile.PL; then
15066                nonxs_extensions="$nonxs_extensions $1$xxx";
15067            else
15068                if $test -d $xxx -a $# -lt 10; then
15069                    set $1$xxx/ $*;
15070                    cd $xxx;
15071                    eval $find_extensions;
15072                    cd ..;
15073                    shift;
15074                fi;
15075            fi
15076            ;;
15077        esac;
15078     done'
15079 tdir=`pwd`
15080 cd $rsrc/ext
15081 set X
15082 shift
15083 eval $find_extensions
15084 set X $nonxs_extensions
15085 shift
15086 nonxs_extensions="$*"
15087 set X $known_extensions
15088 shift
15089 known_extensions="$*"
15090 cd $tdir
15091
15092 : Now see which are supported on this system.
15093 avail_ext=''
15094 for xxx in $known_extensions ; do
15095         case "$xxx" in
15096         DB_File|db_file)
15097                 case "$i_db" in
15098                 $define) avail_ext="$avail_ext $xxx" ;;
15099                 esac
15100                 ;;
15101         GDBM_File|gdbm_fil)
15102                 case "$i_gdbm" in 
15103                 $define) avail_ext="$avail_ext $xxx" ;;
15104                 esac
15105                 ;;
15106         NDBM_File|ndbm_fil)
15107                 case "$i_ndbm" in
15108                 $define)
15109                     case "$osname-$use64bitint" in
15110                     hpux-define)
15111                         case "$libs" in
15112                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
15113                         esac
15114                         ;;
15115                     *) avail_ext="$avail_ext $xxx" ;;
15116                     esac
15117                     ;;
15118                 esac
15119                 ;;
15120         ODBM_File|odbm_fil) 
15121                 case "${i_dbm}${i_rpcsvcdbm}" in
15122                 *"${define}"*)
15123                     case "$osname-$use64bitint" in
15124                     hpux-define)
15125                         case "$libs" in
15126                         *-ldbm*) avail_ext="$avail_ext $xxx" ;;
15127                         esac
15128                         ;;
15129                     *) avail_ext="$avail_ext $xxx" ;;
15130                     esac
15131                     ;;
15132                 esac
15133                 ;;
15134         POSIX|posix)
15135                 case "$useposix" in
15136                 true|define|y) avail_ext="$avail_ext $xxx" ;;
15137                 esac
15138                 ;;
15139         Opcode|opcode)
15140                 case "$useopcode" in
15141                 true|define|y) avail_ext="$avail_ext $xxx" ;;
15142                 esac
15143                 ;;
15144         Socket|socket)
15145                 case "$d_socket" in 
15146                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
15147                 esac
15148                 ;;
15149         Sys/Syslog|sys/syslog)
15150                 : XXX syslog requires socket
15151                 case "$d_socket" in 
15152                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
15153                 esac
15154                 ;;
15155         Thread|thread)
15156                 case "$usethreads" in 
15157                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
15158                 esac
15159                 ;;
15160         IPC/SysV|ipc/sysv)
15161                 : XXX Do we need a useipcsysv variable here
15162                 case "${d_msg}${d_sem}${d_shm}" in 
15163                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
15164                 esac
15165                 ;;
15166         *)      avail_ext="$avail_ext $xxx"
15167                 ;;
15168         esac
15169 done
15170
15171 set X $avail_ext
15172 shift
15173 avail_ext="$*"
15174
15175 : Now see which nonxs extensions are supported on this system.
15176 : For now assume all are.
15177 nonxs_ext=''
15178 for xxx in $nonxs_extensions ; do
15179         case "$xxx" in
15180         *)      nonxs_ext="$nonxs_ext $xxx"
15181                 ;;
15182         esac
15183 done
15184
15185 set X $nonxs_ext
15186 shift
15187 nonxs_ext="$*"
15188
15189 case $usedl in
15190 $define)
15191         $cat <<EOM
15192 A number of extensions are supplied with $package.  You may choose to
15193 compile these extensions for dynamic loading (the default), compile
15194 them into the $package executable (static loading), or not include
15195 them at all.  Answer "none" to include no extensions.
15196 Note that DynaLoader is always built and need not be mentioned here.
15197
15198 EOM
15199         case "$dynamic_ext" in
15200         '') dflt="$avail_ext" ;;
15201         *)      dflt="$dynamic_ext"
15202                 # Perhaps we are reusing an old out-of-date config.sh.
15203                 case "$hint" in
15204                 previous)
15205                         if test X"$dynamic_ext" != X"$avail_ext"; then
15206                                 $cat <<EOM
15207 NOTICE:  Your previous config.sh list may be incorrect. 
15208 The extensions now available to you are 
15209         ${avail_ext}
15210 but the default list from your previous config.sh is
15211         ${dynamic_ext} 
15212
15213 EOM
15214                         fi
15215                         ;;
15216                 esac
15217                 ;;
15218         esac
15219         case "$dflt" in
15220         '')     dflt=none;;
15221         esac
15222         rp="What extensions do you wish to load dynamically?"
15223         . ./myread
15224         case "$ans" in
15225         none) dynamic_ext=' ' ;;
15226         *) dynamic_ext="$ans" ;;
15227         esac
15228
15229         case "$static_ext" in
15230         '')
15231                 : Exclude those already listed in dynamic linking
15232                 dflt=''
15233                 for xxx in $avail_ext; do
15234                         case " $dynamic_ext " in
15235                         *" $xxx "*) ;;
15236                         *) dflt="$dflt $xxx" ;;
15237                         esac
15238                 done
15239                 set X $dflt
15240                 shift
15241                 dflt="$*"
15242                 ;;
15243         *)  dflt="$static_ext" 
15244                 ;;
15245         esac
15246
15247         case "$dflt" in
15248         '')     dflt=none;;
15249         esac
15250         rp="What extensions do you wish to load statically?"
15251         . ./myread
15252         case "$ans" in
15253         none) static_ext=' ' ;;
15254         *) static_ext="$ans" ;;
15255         esac
15256         ;;
15257 *)
15258         $cat <<EOM
15259 A number of extensions are supplied with $package.  Answer "none" 
15260 to include no extensions. 
15261 Note that DynaLoader is always built and need not be mentioned here.
15262
15263 EOM
15264         case "$static_ext" in
15265         '') dflt="$avail_ext" ;;
15266         *)      dflt="$static_ext"
15267                 # Perhaps we are reusing an old out-of-date config.sh.
15268                 case "$hint" in
15269                 previous)
15270                         if test X"$static_ext" != X"$avail_ext"; then
15271                                 $cat <<EOM
15272 NOTICE:  Your previous config.sh list may be incorrect. 
15273 The extensions now available to you are 
15274         ${avail_ext}
15275 but the default list from your previous config.sh is
15276         ${static_ext} 
15277
15278 EOM
15279                         fi
15280                         ;;
15281                 esac
15282                 ;;
15283         esac
15284         : Exclude those that are not xs extensions
15285         case "$dflt" in
15286         '')     dflt=none;;
15287         esac
15288         rp="What extensions do you wish to include?"
15289         . ./myread
15290         case "$ans" in
15291         none) static_ext=' ' ;;
15292         *) static_ext="$ans" ;;
15293         esac
15294         ;;
15295 esac
15296
15297 set X $dynamic_ext $static_ext $nonxs_ext
15298 shift
15299 extensions="$*"
15300
15301 : Remove build directory name from cppstdin so it can be used from
15302 : either the present location or the final installed location.
15303 echo " "
15304 : Get out of the UU directory to get correct path name.
15305 cd ..
15306 case "$cppstdin" in
15307 `pwd`/cppstdin)
15308         echo "Stripping down cppstdin path name"
15309         cppstdin=cppstdin
15310         ;;
15311 esac
15312 cd UU
15313
15314 : end of configuration questions
15315 echo " "
15316 echo "End of configuration questions."
15317 echo " "
15318
15319 : back to where it started
15320 if test -d ../UU; then
15321         cd ..
15322 fi
15323
15324 : configuration may be patched via a 'config.over' file
15325 if $test -f config.over; then
15326         echo " "
15327         dflt=y
15328         rp='I see a config.over file.  Do you wish to load it?'
15329         . UU/myread
15330         case "$ans" in
15331         n*) echo "OK, I'll ignore it.";;
15332         *)      . ./config.over
15333                 echo "Configuration override changes have been loaded."
15334                 ;;
15335         esac
15336 fi
15337
15338 : in case they want portability, strip down executable paths
15339 case "$d_portable" in
15340 "$define")
15341         echo " "
15342         echo "Stripping down executable paths..." >&4
15343         for file in $loclist $trylist; do
15344                 eval temp=\$$file
15345                 eval $file=`basename $temp`
15346         done
15347         ;;
15348 esac
15349
15350 : create config.sh file
15351 echo " "
15352 echo "Creating config.sh..." >&4
15353 $spitshell <<EOT >config.sh
15354 $startsh
15355 #
15356 # This file was produced by running the Configure script. It holds all the
15357 # definitions figured out by Configure. Should you modify one of these values,
15358 # do not forget to propagate your changes by running "Configure -der". You may
15359 # instead choose to run each of the .SH files by yourself, or "Configure -S".
15360 #
15361
15362 # Package name      : $package
15363 # Source directory  : $src
15364 # Configuration time: $cf_time
15365 # Configured by     : $cf_by
15366 # Target system     : $myuname
15367
15368 Author='$Author'
15369 Date='$Date'
15370 Header='$Header'
15371 Id='$Id'
15372 Locker='$Locker'
15373 Log='$Log'
15374 Mcc='$Mcc'
15375 RCSfile='$RCSfile'
15376 Revision='$Revision'
15377 Source='$Source'
15378 State='$State'
15379 _a='$_a'
15380 _exe='$_exe'
15381 _o='$_o'
15382 afs='$afs'
15383 alignbytes='$alignbytes'
15384 ansi2knr='$ansi2knr'
15385 aphostname='$aphostname'
15386 api_revision='$api_revision'
15387 api_subversion='$api_subversion'
15388 api_version='$api_version'
15389 api_versionstring='$api_versionstring'
15390 ar='$ar'
15391 archlib='$archlib'
15392 archlibexp='$archlibexp'
15393 archname64='$archname64'
15394 archname='$archname'
15395 archobjs='$archobjs'
15396 awk='$awk'
15397 baserev='$baserev'
15398 bash='$bash'
15399 bin='$bin'
15400 bincompat5005='$bincompat5005'
15401 binexp='$binexp'
15402 bison='$bison'
15403 byacc='$byacc'
15404 byteorder='$byteorder'
15405 c='$c'
15406 castflags='$castflags'
15407 cat='$cat'
15408 cc='$cc'
15409 cccdlflags='$cccdlflags'
15410 ccdlflags='$ccdlflags'
15411 ccflags='$ccflags'
15412 ccflags_uselargefiles='$ccflags_uselargefiles'
15413 ccname='$ccname'
15414 ccsymbols='$ccsymbols'
15415 cf_by='$cf_by'
15416 cf_email='$cf_email'
15417 cf_time='$cf_time'
15418 charsize='$charsize'
15419 chgrp='$chgrp'
15420 chmod='$chmod'
15421 chown='$chown'
15422 clocktype='$clocktype'
15423 comm='$comm'
15424 compress='$compress'
15425 contains='$contains'
15426 cp='$cp'
15427 cpio='$cpio'
15428 cpp='$cpp'
15429 cpp_stuff='$cpp_stuff'
15430 cppccsymbols='$cppccsymbols'
15431 cppflags='$cppflags'
15432 cpplast='$cpplast'
15433 cppminus='$cppminus'
15434 cpprun='$cpprun'
15435 cppstdin='$cppstdin'
15436 cppsymbols='$cppsymbols'
15437 crosscompile='$crosscompile'
15438 cryptlib='$cryptlib'
15439 csh='$csh'
15440 d_Gconvert='$d_Gconvert'
15441 d_PRIEldbl='$d_PRIEldbl'
15442 d_PRIFldbl='$d_PRIFldbl'
15443 d_PRIGldbl='$d_PRIGldbl'
15444 d_PRIX64='$d_PRIX64'
15445 d_PRId64='$d_PRId64'
15446 d_PRIeldbl='$d_PRIeldbl'
15447 d_PRIfldbl='$d_PRIfldbl'
15448 d_PRIgldbl='$d_PRIgldbl'
15449 d_PRIi64='$d_PRIi64'
15450 d_PRIo64='$d_PRIo64'
15451 d_PRIu64='$d_PRIu64'
15452 d_PRIx64='$d_PRIx64'
15453 d_access='$d_access'
15454 d_accessx='$d_accessx'
15455 d_alarm='$d_alarm'
15456 d_archlib='$d_archlib'
15457 d_atolf='$d_atolf'
15458 d_atoll='$d_atoll'
15459 d_attribut='$d_attribut'
15460 d_bcmp='$d_bcmp'
15461 d_bcopy='$d_bcopy'
15462 d_bincompat5005='$d_bincompat5005'
15463 d_bsd='$d_bsd'
15464 d_bsdgetpgrp='$d_bsdgetpgrp'
15465 d_bsdsetpgrp='$d_bsdsetpgrp'
15466 d_bzero='$d_bzero'
15467 d_casti32='$d_casti32'
15468 d_castneg='$d_castneg'
15469 d_charvspr='$d_charvspr'
15470 d_chown='$d_chown'
15471 d_chroot='$d_chroot'
15472 d_chsize='$d_chsize'
15473 d_closedir='$d_closedir'
15474 d_const='$d_const'
15475 d_crypt='$d_crypt'
15476 d_csh='$d_csh'
15477 d_cuserid='$d_cuserid'
15478 d_dbl_dig='$d_dbl_dig'
15479 d_difftime='$d_difftime'
15480 d_dirnamlen='$d_dirnamlen'
15481 d_dlerror='$d_dlerror'
15482 d_dlopen='$d_dlopen'
15483 d_dlsymun='$d_dlsymun'
15484 d_dosuid='$d_dosuid'
15485 d_drand48proto='$d_drand48proto'
15486 d_dup2='$d_dup2'
15487 d_eaccess='$d_eaccess'
15488 d_endgrent='$d_endgrent'
15489 d_endhent='$d_endhent'
15490 d_endnent='$d_endnent'
15491 d_endpent='$d_endpent'
15492 d_endpwent='$d_endpwent'
15493 d_endsent='$d_endsent'
15494 d_eofnblk='$d_eofnblk'
15495 d_eunice='$d_eunice'
15496 d_fchmod='$d_fchmod'
15497 d_fchown='$d_fchown'
15498 d_fcntl='$d_fcntl'
15499 d_fd_macros='$d_fd_macros'
15500 d_fd_set='$d_fd_set'
15501 d_fds_bits='$d_fds_bits'
15502 d_fgetpos='$d_fgetpos'
15503 d_flexfnam='$d_flexfnam'
15504 d_flock='$d_flock'
15505 d_fork='$d_fork'
15506 d_fpathconf='$d_fpathconf'
15507 d_fpos64_t='$d_fpos64_t'
15508 d_frexpl='$d_frexpl'
15509 d_fs_data_s='$d_fs_data_s'
15510 d_fseeko='$d_fseeko'
15511 d_fsetpos='$d_fsetpos'
15512 d_fstatfs='$d_fstatfs'
15513 d_fstatvfs='$d_fstatvfs'
15514 d_ftello='$d_ftello'
15515 d_ftime='$d_ftime'
15516 d_getcwd='$d_getcwd'
15517 d_getespwnam='$d_getespwnam'
15518 d_getfsstat='$d_getfsstat'
15519 d_getgrent='$d_getgrent'
15520 d_getgrps='$d_getgrps'
15521 d_gethbyaddr='$d_gethbyaddr'
15522 d_gethbyname='$d_gethbyname'
15523 d_gethent='$d_gethent'
15524 d_gethname='$d_gethname'
15525 d_gethostprotos='$d_gethostprotos'
15526 d_getlogin='$d_getlogin'
15527 d_getmnt='$d_getmnt'
15528 d_getmntent='$d_getmntent'
15529 d_getnbyaddr='$d_getnbyaddr'
15530 d_getnbyname='$d_getnbyname'
15531 d_getnent='$d_getnent'
15532 d_getnetprotos='$d_getnetprotos'
15533 d_getpbyname='$d_getpbyname'
15534 d_getpbynumber='$d_getpbynumber'
15535 d_getpent='$d_getpent'
15536 d_getpgid='$d_getpgid'
15537 d_getpgrp2='$d_getpgrp2'
15538 d_getpgrp='$d_getpgrp'
15539 d_getppid='$d_getppid'
15540 d_getprior='$d_getprior'
15541 d_getprotoprotos='$d_getprotoprotos'
15542 d_getprpwnam='$d_getprpwnam'
15543 d_getpwent='$d_getpwent'
15544 d_getsbyname='$d_getsbyname'
15545 d_getsbyport='$d_getsbyport'
15546 d_getsent='$d_getsent'
15547 d_getservprotos='$d_getservprotos'
15548 d_getspnam='$d_getspnam'
15549 d_gettimeod='$d_gettimeod'
15550 d_gnulibc='$d_gnulibc'
15551 d_grpasswd='$d_grpasswd'
15552 d_hasmntopt='$d_hasmntopt'
15553 d_htonl='$d_htonl'
15554 d_iconv='$d_iconv'
15555 d_index='$d_index'
15556 d_inetaton='$d_inetaton'
15557 d_int64_t='$d_int64_t'
15558 d_isascii='$d_isascii'
15559 d_isnan='$d_isnan'
15560 d_isnanl='$d_isnanl'
15561 d_killpg='$d_killpg'
15562 d_lchown='$d_lchown'
15563 d_ldbl_dig='$d_ldbl_dig'
15564 d_link='$d_link'
15565 d_locconv='$d_locconv'
15566 d_lockf='$d_lockf'
15567 d_longdbl='$d_longdbl'
15568 d_longlong='$d_longlong'
15569 d_lseekproto='$d_lseekproto'
15570 d_lstat='$d_lstat'
15571 d_madvise='$d_madvise'
15572 d_mblen='$d_mblen'
15573 d_mbstowcs='$d_mbstowcs'
15574 d_mbtowc='$d_mbtowc'
15575 d_memchr='$d_memchr'
15576 d_memcmp='$d_memcmp'
15577 d_memcpy='$d_memcpy'
15578 d_memmove='$d_memmove'
15579 d_memset='$d_memset'
15580 d_mkdir='$d_mkdir'
15581 d_mkdtemp='$d_mkdtemp'
15582 d_mkfifo='$d_mkfifo'
15583 d_mkstemp='$d_mkstemp'
15584 d_mkstemps='$d_mkstemps'
15585 d_mktime='$d_mktime'
15586 d_mmap='$d_mmap'
15587 d_modfl='$d_modfl'
15588 d_mprotect='$d_mprotect'
15589 d_msg='$d_msg'
15590 d_msg_ctrunc='$d_msg_ctrunc'
15591 d_msg_dontroute='$d_msg_dontroute'
15592 d_msg_oob='$d_msg_oob'
15593 d_msg_peek='$d_msg_peek'
15594 d_msg_proxy='$d_msg_proxy'
15595 d_msgctl='$d_msgctl'
15596 d_msgget='$d_msgget'
15597 d_msgrcv='$d_msgrcv'
15598 d_msgsnd='$d_msgsnd'
15599 d_msync='$d_msync'
15600 d_munmap='$d_munmap'
15601 d_mymalloc='$d_mymalloc'
15602 d_nice='$d_nice'
15603 d_nv_preserves_uv='$d_nv_preserves_uv'
15604 d_nv_preserves_uv_bits='$d_nv_preserves_uv_bits'
15605 d_off64_t='$d_off64_t'
15606 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
15607 d_oldpthreads='$d_oldpthreads'
15608 d_oldsock='$d_oldsock'
15609 d_open3='$d_open3'
15610 d_pathconf='$d_pathconf'
15611 d_pause='$d_pause'
15612 d_perl_otherlibdirs='$d_perl_otherlibdirs'
15613 d_phostname='$d_phostname'
15614 d_pipe='$d_pipe'
15615 d_poll='$d_poll'
15616 d_portable='$d_portable'
15617 d_pthread_yield='$d_pthread_yield'
15618 d_pwage='$d_pwage'
15619 d_pwchange='$d_pwchange'
15620 d_pwclass='$d_pwclass'
15621 d_pwcomment='$d_pwcomment'
15622 d_pwexpire='$d_pwexpire'
15623 d_pwgecos='$d_pwgecos'
15624 d_pwpasswd='$d_pwpasswd'
15625 d_pwquota='$d_pwquota'
15626 d_qgcvt='$d_qgcvt'
15627 d_quad='$d_quad'
15628 d_readdir='$d_readdir'
15629 d_readlink='$d_readlink'
15630 d_rename='$d_rename'
15631 d_rewinddir='$d_rewinddir'
15632 d_rmdir='$d_rmdir'
15633 d_safebcpy='$d_safebcpy'
15634 d_safemcpy='$d_safemcpy'
15635 d_sanemcmp='$d_sanemcmp'
15636 d_sched_yield='$d_sched_yield'
15637 d_scm_rights='$d_scm_rights'
15638 d_seekdir='$d_seekdir'
15639 d_select='$d_select'
15640 d_sem='$d_sem'
15641 d_semctl='$d_semctl'
15642 d_semctl_semid_ds='$d_semctl_semid_ds'
15643 d_semctl_semun='$d_semctl_semun'
15644 d_semget='$d_semget'
15645 d_semop='$d_semop'
15646 d_setegid='$d_setegid'
15647 d_seteuid='$d_seteuid'
15648 d_setgrent='$d_setgrent'
15649 d_setgrps='$d_setgrps'
15650 d_sethent='$d_sethent'
15651 d_setlinebuf='$d_setlinebuf'
15652 d_setlocale='$d_setlocale'
15653 d_setnent='$d_setnent'
15654 d_setpent='$d_setpent'
15655 d_setpgid='$d_setpgid'
15656 d_setpgrp2='$d_setpgrp2'
15657 d_setpgrp='$d_setpgrp'
15658 d_setprior='$d_setprior'
15659 d_setproctitle='$d_setproctitle'
15660 d_setpwent='$d_setpwent'
15661 d_setregid='$d_setregid'
15662 d_setresgid='$d_setresgid'
15663 d_setresuid='$d_setresuid'
15664 d_setreuid='$d_setreuid'
15665 d_setrgid='$d_setrgid'
15666 d_setruid='$d_setruid'
15667 d_setsent='$d_setsent'
15668 d_setsid='$d_setsid'
15669 d_setvbuf='$d_setvbuf'
15670 d_sfio='$d_sfio'
15671 d_shm='$d_shm'
15672 d_shmat='$d_shmat'
15673 d_shmatprototype='$d_shmatprototype'
15674 d_shmctl='$d_shmctl'
15675 d_shmdt='$d_shmdt'
15676 d_shmget='$d_shmget'
15677 d_sigaction='$d_sigaction'
15678 d_sigsetjmp='$d_sigsetjmp'
15679 d_socket='$d_socket'
15680 d_socklen_t='$d_socklen_t'
15681 d_sockpair='$d_sockpair'
15682 d_socks5_init='$d_socks5_init'
15683 d_sqrtl='$d_sqrtl'
15684 d_statblks='$d_statblks'
15685 d_statfs_f_flags='$d_statfs_f_flags'
15686 d_statfs_s='$d_statfs_s'
15687 d_statvfs='$d_statvfs'
15688 d_stdio_cnt_lval='$d_stdio_cnt_lval'
15689 d_stdio_ptr_lval='$d_stdio_ptr_lval'
15690 d_stdio_stream_array='$d_stdio_stream_array'
15691 d_stdiobase='$d_stdiobase'
15692 d_stdstdio='$d_stdstdio'
15693 d_strchr='$d_strchr'
15694 d_strcoll='$d_strcoll'
15695 d_strctcpy='$d_strctcpy'
15696 d_strerrm='$d_strerrm'
15697 d_strerror='$d_strerror'
15698 d_strtod='$d_strtod'
15699 d_strtol='$d_strtol'
15700 d_strtold='$d_strtold'
15701 d_strtoll='$d_strtoll'
15702 d_strtoul='$d_strtoul'
15703 d_strtoull='$d_strtoull'
15704 d_strtouq='$d_strtouq'
15705 d_strxfrm='$d_strxfrm'
15706 d_suidsafe='$d_suidsafe'
15707 d_symlink='$d_symlink'
15708 d_syscall='$d_syscall'
15709 d_sysconf='$d_sysconf'
15710 d_sysernlst='$d_sysernlst'
15711 d_syserrlst='$d_syserrlst'
15712 d_system='$d_system'
15713 d_tcgetpgrp='$d_tcgetpgrp'
15714 d_tcsetpgrp='$d_tcsetpgrp'
15715 d_telldir='$d_telldir'
15716 d_telldirproto='$d_telldirproto'
15717 d_time='$d_time'
15718 d_times='$d_times'
15719 d_truncate='$d_truncate'
15720 d_tzname='$d_tzname'
15721 d_umask='$d_umask'
15722 d_uname='$d_uname'
15723 d_union_semun='$d_union_semun'
15724 d_ustat='$d_ustat'
15725 d_vendorarch='$d_vendorarch'
15726 d_vendorbin='$d_vendorbin'
15727 d_vendorlib='$d_vendorlib'
15728 d_vfork='$d_vfork'
15729 d_void_closedir='$d_void_closedir'
15730 d_voidsig='$d_voidsig'
15731 d_voidtty='$d_voidtty'
15732 d_volatile='$d_volatile'
15733 d_vprintf='$d_vprintf'
15734 d_wait4='$d_wait4'
15735 d_waitpid='$d_waitpid'
15736 d_wcstombs='$d_wcstombs'
15737 d_wctomb='$d_wctomb'
15738 d_xenix='$d_xenix'
15739 date='$date'
15740 db_hashtype='$db_hashtype'
15741 db_prefixtype='$db_prefixtype'
15742 defvoidused='$defvoidused'
15743 direntrytype='$direntrytype'
15744 dlext='$dlext'
15745 dlsrc='$dlsrc'
15746 doublesize='$doublesize'
15747 drand01='$drand01'
15748 dynamic_ext='$dynamic_ext'
15749 eagain='$eagain'
15750 ebcdic='$ebcdic'
15751 echo='$echo'
15752 egrep='$egrep'
15753 emacs='$emacs'
15754 eunicefix='$eunicefix'
15755 exe_ext='$exe_ext'
15756 expr='$expr'
15757 extensions='$extensions'
15758 fflushNULL='$fflushNULL'
15759 fflushall='$fflushall'
15760 find='$find'
15761 firstmakefile='$firstmakefile'
15762 flex='$flex'
15763 fpossize='$fpossize'
15764 fpostype='$fpostype'
15765 freetype='$freetype'
15766 full_ar='$full_ar'
15767 full_csh='$full_csh'
15768 full_sed='$full_sed'
15769 gccosandvers='$gccosandvers'
15770 gccversion='$gccversion'
15771 gidformat='$gidformat'
15772 gidsign='$gidsign'
15773 gidsize='$gidsize'
15774 gidtype='$gidtype'
15775 glibpth='$glibpth'
15776 grep='$grep'
15777 groupcat='$groupcat'
15778 groupstype='$groupstype'
15779 gzip='$gzip'
15780 h_fcntl='$h_fcntl'
15781 h_sysfile='$h_sysfile'
15782 hint='$hint'
15783 hostcat='$hostcat'
15784 huge='$huge'
15785 i16size='$i16size'
15786 i16type='$i16type'
15787 i32size='$i32size'
15788 i32type='$i32type'
15789 i64size='$i64size'
15790 i64type='$i64type'
15791 i8size='$i8size'
15792 i8type='$i8type'
15793 i_arpainet='$i_arpainet'
15794 i_bsdioctl='$i_bsdioctl'
15795 i_db='$i_db'
15796 i_dbm='$i_dbm'
15797 i_dirent='$i_dirent'
15798 i_dld='$i_dld'
15799 i_dlfcn='$i_dlfcn'
15800 i_fcntl='$i_fcntl'
15801 i_float='$i_float'
15802 i_gdbm='$i_gdbm'
15803 i_grp='$i_grp'
15804 i_iconv='$i_iconv'
15805 i_ieeefp='$i_ieeefp'
15806 i_inttypes='$i_inttypes'
15807 i_libutil='$i_libutil'
15808 i_limits='$i_limits'
15809 i_locale='$i_locale'
15810 i_machcthr='$i_machcthr'
15811 i_malloc='$i_malloc'
15812 i_math='$i_math'
15813 i_memory='$i_memory'
15814 i_mntent='$i_mntent'
15815 i_ndbm='$i_ndbm'
15816 i_netdb='$i_netdb'
15817 i_neterrno='$i_neterrno'
15818 i_netinettcp='$i_netinettcp'
15819 i_niin='$i_niin'
15820 i_poll='$i_poll'
15821 i_prot='$i_prot'
15822 i_pthread='$i_pthread'
15823 i_pwd='$i_pwd'
15824 i_rpcsvcdbm='$i_rpcsvcdbm'
15825 i_sfio='$i_sfio'
15826 i_sgtty='$i_sgtty'
15827 i_shadow='$i_shadow'
15828 i_socks='$i_socks'
15829 i_stdarg='$i_stdarg'
15830 i_stddef='$i_stddef'
15831 i_stdlib='$i_stdlib'
15832 i_string='$i_string'
15833 i_sunmath='$i_sunmath'
15834 i_sysaccess='$i_sysaccess'
15835 i_sysdir='$i_sysdir'
15836 i_sysfile='$i_sysfile'
15837 i_sysfilio='$i_sysfilio'
15838 i_sysin='$i_sysin'
15839 i_sysioctl='$i_sysioctl'
15840 i_syslog='$i_syslog'
15841 i_sysmman='$i_sysmman'
15842 i_sysmode='$i_sysmode'
15843 i_sysmount='$i_sysmount'
15844 i_sysndir='$i_sysndir'
15845 i_sysparam='$i_sysparam'
15846 i_sysresrc='$i_sysresrc'
15847 i_syssecrt='$i_syssecrt'
15848 i_sysselct='$i_sysselct'
15849 i_syssockio='$i_syssockio'
15850 i_sysstat='$i_sysstat'
15851 i_sysstatfs='$i_sysstatfs'
15852 i_sysstatvfs='$i_sysstatvfs'
15853 i_systime='$i_systime'
15854 i_systimek='$i_systimek'
15855 i_systimes='$i_systimes'
15856 i_systypes='$i_systypes'
15857 i_sysuio='$i_sysuio'
15858 i_sysun='$i_sysun'
15859 i_sysutsname='$i_sysutsname'
15860 i_sysvfs='$i_sysvfs'
15861 i_syswait='$i_syswait'
15862 i_termio='$i_termio'
15863 i_termios='$i_termios'
15864 i_time='$i_time'
15865 i_unistd='$i_unistd'
15866 i_ustat='$i_ustat'
15867 i_utime='$i_utime'
15868 i_values='$i_values'
15869 i_varargs='$i_varargs'
15870 i_varhdr='$i_varhdr'
15871 i_vfork='$i_vfork'
15872 ignore_versioned_solibs='$ignore_versioned_solibs'
15873 inc_version_list='$inc_version_list'
15874 inc_version_list_init='$inc_version_list_init'
15875 incpath='$incpath'
15876 inews='$inews'
15877 installarchlib='$installarchlib'
15878 installbin='$installbin'
15879 installman1dir='$installman1dir'
15880 installman3dir='$installman3dir'
15881 installprefix='$installprefix'
15882 installprefixexp='$installprefixexp'
15883 installprivlib='$installprivlib'
15884 installscript='$installscript'
15885 installsitearch='$installsitearch'
15886 installsitebin='$installsitebin'
15887 installsitelib='$installsitelib'
15888 installstyle='$installstyle'
15889 installusrbinperl='$installusrbinperl'
15890 installvendorarch='$installvendorarch'
15891 installvendorbin='$installvendorbin'
15892 installvendorlib='$installvendorlib'
15893 intsize='$intsize'
15894 ivdformat='$ivdformat'
15895 ivsize='$ivsize'
15896 ivtype='$ivtype'
15897 known_extensions='$known_extensions'
15898 ksh='$ksh'
15899 large='$large'
15900 ld='$ld'
15901 lddlflags='$lddlflags'
15902 ldflags='$ldflags'
15903 ldflags_uselargefiles='$ldflags_uselargefiles'
15904 ldlibpthname='$ldlibpthname'
15905 less='$less'
15906 lib_ext='$lib_ext'
15907 libc='$libc'
15908 libperl='$libperl'
15909 libpth='$libpth'
15910 libs='$libs'
15911 libsdirs='$libsdirs'
15912 libsfiles='$libsfiles'
15913 libsfound='$libsfound'
15914 libspath='$libspath'
15915 libswanted='$libswanted'
15916 libswanted_uselargefiles='$libswanted_uselargefiles'
15917 line='$line'
15918 lint='$lint'
15919 lkflags='$lkflags'
15920 ln='$ln'
15921 lns='$lns'
15922 locincpth='$locincpth'
15923 loclibpth='$loclibpth'
15924 longdblsize='$longdblsize'
15925 longlongsize='$longlongsize'
15926 longsize='$longsize'
15927 lp='$lp'
15928 lpr='$lpr'
15929 ls='$ls'
15930 lseeksize='$lseeksize'
15931 lseektype='$lseektype'
15932 mail='$mail'
15933 mailx='$mailx'
15934 make='$make'
15935 make_set_make='$make_set_make'
15936 mallocobj='$mallocobj'
15937 mallocsrc='$mallocsrc'
15938 malloctype='$malloctype'
15939 man1dir='$man1dir'
15940 man1direxp='$man1direxp'
15941 man1ext='$man1ext'
15942 man3dir='$man3dir'
15943 man3direxp='$man3direxp'
15944 man3ext='$man3ext'
15945 medium='$medium'
15946 mips_type='$mips_type'
15947 mkdir='$mkdir'
15948 mmaptype='$mmaptype'
15949 models='$models'
15950 modetype='$modetype'
15951 more='$more'
15952 multiarch='$multiarch'
15953 mv='$mv'
15954 myarchname='$myarchname'
15955 mydomain='$mydomain'
15956 myhostname='$myhostname'
15957 myuname='$myuname'
15958 n='$n'
15959 netdb_hlen_type='$netdb_hlen_type'
15960 netdb_host_type='$netdb_host_type'
15961 netdb_name_type='$netdb_name_type'
15962 netdb_net_type='$netdb_net_type'
15963 nm='$nm'
15964 nm_opt='$nm_opt'
15965 nm_so_opt='$nm_so_opt'
15966 nonxs_ext='$nonxs_ext'
15967 nroff='$nroff'
15968 nvEformat='$nvEformat'
15969 nvFformat='$nvFformat'
15970 nvGformat='$nvGformat'
15971 nveformat='$nveformat'
15972 nvfformat='$nvfformat'
15973 nvgformat='$nvgformat'
15974 nvsize='$nvsize'
15975 nvtype='$nvtype'
15976 o_nonblock='$o_nonblock'
15977 obj_ext='$obj_ext'
15978 old_pthread_create_joinable='$old_pthread_create_joinable'
15979 optimize='$optimize'
15980 orderlib='$orderlib'
15981 osname='$osname'
15982 osvers='$osvers'
15983 otherlibdirs='$otherlibdirs'
15984 package='$package'
15985 pager='$pager'
15986 passcat='$passcat'
15987 patchlevel='$patchlevel'
15988 path_sep='$path_sep'
15989 perl5='$perl5'
15990 perl='$perl'
15991 perladmin='$perladmin'
15992 perlpath='$perlpath'
15993 pg='$pg'
15994 phostname='$phostname'
15995 pidtype='$pidtype'
15996 plibpth='$plibpth'
15997 pm_apiversion='$pm_apiversion'
15998 pmake='$pmake'
15999 pr='$pr'
16000 prefix='$prefix'
16001 prefixexp='$prefixexp'
16002 privlib='$privlib'
16003 privlibexp='$privlibexp'
16004 prototype='$prototype'
16005 ptrsize='$ptrsize'
16006 quadkind='$quadkind'
16007 quadtype='$quadtype'
16008 randbits='$randbits'
16009 randfunc='$randfunc'
16010 randseedtype='$randseedtype'
16011 ranlib='$ranlib'
16012 rd_nodata='$rd_nodata'
16013 revision='$revision'
16014 rm='$rm'
16015 rmail='$rmail'
16016 runnm='$runnm'
16017 sPRIEldbl='$sPRIEldbl'
16018 sPRIFldbl='$sPRIFldbl'
16019 sPRIGldbl='$sPRIGldbl'
16020 sPRIX64='$sPRIX64'
16021 sPRId64='$sPRId64'
16022 sPRIeldbl='$sPRIeldbl'
16023 sPRIfldbl='$sPRIfldbl'
16024 sPRIgldbl='$sPRIgldbl'
16025 sPRIi64='$sPRIi64'
16026 sPRIo64='$sPRIo64'
16027 sPRIu64='$sPRIu64'
16028 sPRIx64='$sPRIx64'
16029 sched_yield='$sched_yield'
16030 scriptdir='$scriptdir'
16031 scriptdirexp='$scriptdirexp'
16032 sed='$sed'
16033 seedfunc='$seedfunc'
16034 selectminbits='$selectminbits'
16035 selecttype='$selecttype'
16036 sendmail='$sendmail'
16037 sh='$sh'
16038 shar='$shar'
16039 sharpbang='$sharpbang'
16040 shmattype='$shmattype'
16041 shortsize='$shortsize'
16042 shrpenv='$shrpenv'
16043 shsharp='$shsharp'
16044 sig_count='$sig_count'
16045 sig_name='$sig_name'
16046 sig_name_init='$sig_name_init'
16047 sig_num='$sig_num'
16048 sig_num_init='$sig_num_init'
16049 signal_t='$signal_t'
16050 sitearch='$sitearch'
16051 sitearchexp='$sitearchexp'
16052 sitebin='$sitebin'
16053 sitebinexp='$sitebinexp'
16054 sitelib='$sitelib'
16055 sitelib_stem='$sitelib_stem'
16056 sitelibexp='$sitelibexp'
16057 siteprefix='$siteprefix'
16058 siteprefixexp='$siteprefixexp'
16059 sizesize='$sizesize'
16060 sizetype='$sizetype'
16061 sleep='$sleep'
16062 smail='$smail'
16063 small='$small'
16064 so='$so'
16065 sockethdr='$sockethdr'
16066 socketlib='$socketlib'
16067 socksizetype='$socksizetype'
16068 sort='$sort'
16069 spackage='$spackage'
16070 spitshell='$spitshell'
16071 split='$split'
16072 src='$src'
16073 ssizetype='$ssizetype'
16074 startperl='$startperl'
16075 startsh='$startsh'
16076 static_ext='$static_ext'
16077 stdchar='$stdchar'
16078 stdio_base='$stdio_base'
16079 stdio_bufsiz='$stdio_bufsiz'
16080 stdio_cnt='$stdio_cnt'
16081 stdio_filbuf='$stdio_filbuf'
16082 stdio_ptr='$stdio_ptr'
16083 stdio_stream_array='$stdio_stream_array'
16084 strings='$strings'
16085 submit='$submit'
16086 subversion='$subversion'
16087 sysman='$sysman'
16088 tail='$tail'
16089 tar='$tar'
16090 tbl='$tbl'
16091 tee='$tee'
16092 test='$test'
16093 timeincl='$timeincl'
16094 timetype='$timetype'
16095 touch='$touch'
16096 tr='$tr'
16097 trnl='$trnl'
16098 troff='$troff'
16099 u16size='$u16size'
16100 u16type='$u16type'
16101 u32size='$u32size'
16102 u32type='$u32type'
16103 u64size='$u64size'
16104 u64type='$u64type'
16105 u8size='$u8size'
16106 u8type='$u8type'
16107 uidformat='$uidformat'
16108 uidsign='$uidsign'
16109 uidsize='$uidsize'
16110 uidtype='$uidtype'
16111 uname='$uname'
16112 uniq='$uniq'
16113 uquadtype='$uquadtype'
16114 use5005threads='$use5005threads'
16115 use64bitall='$use64bitall'
16116 use64bitint='$use64bitint'
16117 usedl='$usedl'
16118 useithreads='$useithreads'
16119 uselargefiles='$uselargefiles'
16120 uselongdouble='$uselongdouble'
16121 usemorebits='$usemorebits'
16122 usemultiplicity='$usemultiplicity'
16123 usemymalloc='$usemymalloc'
16124 usenm='$usenm'
16125 useopcode='$useopcode'
16126 useperlio='$useperlio'
16127 useposix='$useposix'
16128 usesfio='$usesfio'
16129 useshrplib='$useshrplib'
16130 usesocks='$usesocks'
16131 usethreads='$usethreads'
16132 usevendorprefix='$usevendorprefix'
16133 usevfork='$usevfork'
16134 usrinc='$usrinc'
16135 uuname='$uuname'
16136 uvXformat='$uvXformat'
16137 uvoformat='$uvoformat'
16138 uvsize='$uvsize'
16139 uvtype='$uvtype'
16140 uvuformat='$uvuformat'
16141 uvxformat='$uvxformat'
16142 vendorarch='$vendorarch'
16143 vendorarchexp='$vendorarchexp'
16144 vendorbin='$vendorbin'
16145 vendorbinexp='$vendorbinexp'
16146 vendorlib='$vendorlib'
16147 vendorlib_stem='$vendorlib_stem'
16148 vendorlibexp='$vendorlibexp'
16149 vendorprefix='$vendorprefix'
16150 vendorprefixexp='$vendorprefixexp'
16151 version='$version'
16152 vi='$vi'
16153 voidflags='$voidflags'
16154 xlibpth='$xlibpth'
16155 xs_apiversion='$xs_apiversion'
16156 zcat='$zcat'
16157 zip='$zip'
16158 EOT
16159
16160 : Add in command line options if available
16161 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
16162
16163 : add special variables
16164 $test -f $src/patchlevel.h && \
16165 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
16166 echo "CONFIGDOTSH=true" >>config.sh
16167
16168 : propagate old symbols
16169 if $test -f UU/config.sh; then
16170         <UU/config.sh sort | uniq >UU/oldconfig.sh
16171         sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
16172         sort | uniq -u >UU/oldsyms
16173         set X `cat UU/oldsyms`
16174         shift
16175         case $# in
16176         0) ;;
16177         *)
16178                 cat <<EOM
16179 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
16180 EOM
16181                 echo "# Variables propagated from previous config.sh file." >>config.sh
16182                 for sym in `cat UU/oldsyms`; do
16183                         echo "    Propagating $hint variable "'$'"$sym..."
16184                         eval 'tmp="$'"${sym}"'"'
16185                         echo "$tmp" | \
16186                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
16187                 done
16188                 ;;
16189         esac
16190 fi
16191
16192 : Finish up by extracting the .SH files
16193 case "$alldone" in
16194 exit)
16195         $rm -rf UU
16196         echo "Done."
16197         exit 0
16198         ;;
16199 cont)
16200         ;;
16201 '')
16202         dflt=''
16203         nostick=true
16204         $cat <<EOM
16205
16206 If you'd like to make any changes to the config.sh file before I begin
16207 to configure things, do it as a shell escape now (e.g. !vi config.sh).
16208
16209 EOM
16210         rp="Press return or use a shell escape to edit config.sh:"
16211         . UU/myread
16212         nostick=''
16213         case "$ans" in
16214         '') ;;
16215         *) : in case they cannot read
16216                 sh 1>&4 -c "$ans";;
16217         esac
16218         ;;
16219 esac
16220
16221 : if this fails, just run all the .SH files by hand
16222 . ./config.sh
16223
16224 echo " "
16225 exec 1>&4
16226 . ./UU/extract
16227
16228 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
16229         dflt=y
16230         case "$silent" in
16231         true) ;;
16232         *)
16233                 $cat <<EOM
16234
16235 Now you need to generate make dependencies by running "$make depend".
16236 You might prefer to run it in background: "$make depend > makedepend.out &"
16237 It can take a while, so you might not want to run it right now.
16238
16239 EOM
16240                 ;;
16241         esac
16242         rp="Run $make depend now?"
16243         . UU/myread
16244         case "$ans" in
16245         y*)
16246                 $make depend && echo "Now you must run a $make."
16247                 ;;
16248         *)
16249                 echo "You must run '$make depend' then '$make'."
16250                 ;;
16251         esac
16252 elif test -f [Mm]akefile; then
16253         echo " "
16254         echo "Now you must run a $make."
16255 else
16256         echo "Done."
16257 fi
16258
16259 if $test -f Policy.sh; then
16260     $cat <<EOM
16261
16262 If you compile $package on a different machine or from a different object
16263 directory, copy the Policy.sh file from this object directory to the
16264 new one before you run Configure -- this will help you with most of
16265 the policy defaults.
16266
16267 EOM
16268 fi
16269 if $test -f config.msg; then
16270     echo "Hmm.  I also noted the following information while running:"
16271     echo " "
16272     $cat config.msg >&4
16273     $rm -f config.msg
16274 fi
16275 $rm -f kit*isdone ark*isdone
16276 $rm -rf UU
16277
16278 : End of Configure
16279