[ID 20000803.006] 'use lib ...' doesn't behave as documented
[p5sagit/p5-mst-13.2.git] / Configure
1 #! /bin/sh
2 #
3 # If these # comments don't work, trim them. Don't worry about any other
4 # shell scripts, Configure will trim # comments from them for you.
5 #
6 # (If you are trying to port this package to a machine without sh,
7 # I would suggest you have a look at the prototypical config_h.SH file
8 # and edit it to reflect your system. Some packages may include samples
9 # of config.h for certain machines, so you might look for one of those.)
10 #
11 # Yes, you may rip this off to use in other distribution packages. This
12 # script belongs to the public domain and cannot be copyrighted.
13 #
14 # (Note: this Configure script was generated automatically. Rather than
15 # working with this copy of Configure, you may wish to get metaconfig.
16 # The dist-3.0 package (which contains metaconfig) was posted in
17 # comp.sources.misc and is available on CPAN under authors/id/RAM so
18 # you may fetch it yourself from your nearest archive site.)
19 #
20
21 # $Id: Head.U,v 3.0.1.9 1997/02/28 15:02:09 ram Exp $
22 #
23 # Generated on Sat Aug  5 00:21:09 EET DST 2000 [metaconfig 3.0 PL70]
24 # (with additional metaconfig patches by perlbug@perl.com)
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_sqrtl=''
528 d_statblks=''
529 d_statfs_f_flags=''
530 d_statfs_s=''
531 d_fstatvfs=''
532 d_statvfs=''
533 d_stdio_cnt_lval=''
534 d_stdio_ptr_lval=''
535 d_stdiobase=''
536 d_stdstdio=''
537 stdio_base=''
538 stdio_bufsiz=''
539 stdio_cnt=''
540 stdio_filbuf=''
541 stdio_ptr=''
542 d_index=''
543 d_strchr=''
544 d_strcoll=''
545 d_strctcpy=''
546 d_strerrm=''
547 d_strerror=''
548 d_sysernlst=''
549 d_syserrlst=''
550 d_strtod=''
551 d_strtol=''
552 d_strtold=''
553 d_strtoll=''
554 d_strtoul=''
555 d_strtoull=''
556 d_strtouq=''
557 d_strxfrm=''
558 d_symlink=''
559 d_syscall=''
560 d_sysconf=''
561 d_system=''
562 d_tcgetpgrp=''
563 d_tcsetpgrp=''
564 d_telldirproto=''
565 d_time=''
566 timetype=''
567 clocktype=''
568 d_times=''
569 d_truncate=''
570 d_tzname=''
571 d_umask=''
572 d_semctl_semid_ds=''
573 d_semctl_semun=''
574 d_union_semun=''
575 d_ustat=''
576 d_vfork=''
577 usevfork=''
578 d_voidsig=''
579 signal_t=''
580 d_volatile=''
581 d_charvspr=''
582 d_vprintf=''
583 d_wait4=''
584 d_waitpid=''
585 d_wcstombs=''
586 d_wctomb=''
587 dlext=''
588 cccdlflags=''
589 ccdlflags=''
590 dlsrc=''
591 ld=''
592 lddlflags=''
593 usedl=''
594 doublesize=''
595 ebcdic=''
596 fflushNULL=''
597 fflushall=''
598 fpossize=''
599 fpostype=''
600 gccosandvers=''
601 gccversion=''
602 gidformat=''
603 gidsign=''
604 gidsize=''
605 gidtype=''
606 groupstype=''
607 h_fcntl=''
608 h_sysfile=''
609 i_arpainet=''
610 db_hashtype=''
611 db_prefixtype=''
612 i_db=''
613 i_dbm=''
614 i_rpcsvcdbm=''
615 d_dirnamlen=''
616 direntrytype=''
617 i_dirent=''
618 i_dld=''
619 i_dlfcn=''
620 i_fcntl=''
621 i_float=''
622 i_gdbm=''
623 d_grpasswd=''
624 i_grp=''
625 i_iconv=''
626 i_ieeefp=''
627 i_inttypes=''
628 i_libutil=''
629 i_limits=''
630 i_locale=''
631 i_machcthr=''
632 i_malloc=''
633 i_math=''
634 i_memory=''
635 i_mntent=''
636 i_ndbm=''
637 i_netdb=''
638 i_neterrno=''
639 i_netinettcp=''
640 i_niin=''
641 i_sysin=''
642 i_poll=''
643 i_prot=''
644 i_pthread=''
645 d_pwage=''
646 d_pwchange=''
647 d_pwclass=''
648 d_pwcomment=''
649 d_pwexpire=''
650 d_pwgecos=''
651 d_pwpasswd=''
652 d_pwquota=''
653 i_pwd=''
654 i_sfio=''
655 i_shadow=''
656 i_socks=''
657 i_stddef=''
658 i_stdlib=''
659 i_string=''
660 strings=''
661 i_sunmath=''
662 i_sysaccess=''
663 i_sysdir=''
664 i_sysfile=''
665 d_voidtty=''
666 i_bsdioctl=''
667 i_sysfilio=''
668 i_sysioctl=''
669 i_syssockio=''
670 i_syslog=''
671 i_sysmman=''
672 i_sysmode=''
673 i_sysmount=''
674 i_sysndir=''
675 i_sysparam=''
676 i_sysresrc=''
677 i_syssecrt=''
678 i_sysselct=''
679 i_sysstat=''
680 i_sysstatfs=''
681 i_sysstatvfs=''
682 i_systimes=''
683 i_systypes=''
684 i_sysuio=''
685 i_sysun=''
686 i_sysutsname=''
687 i_sysvfs=''
688 i_syswait=''
689 i_sgtty=''
690 i_termio=''
691 i_termios=''
692 i_systime=''
693 i_systimek=''
694 i_time=''
695 timeincl=''
696 i_unistd=''
697 i_ustat=''
698 i_utime=''
699 i_values=''
700 i_stdarg=''
701 i_varargs=''
702 i_varhdr=''
703 i_vfork=''
704 inc_version_list=''
705 inc_version_list_init=''
706 installprefix=''
707 installprefixexp=''
708 installstyle=''
709 installusrbinperl=''
710 intsize=''
711 longsize=''
712 shortsize=''
713 libc=''
714 ldlibpthname=''
715 libperl=''
716 shrpenv=''
717 useshrplib=''
718 glibpth=''
719 libpth=''
720 loclibpth=''
721 plibpth=''
722 xlibpth=''
723 ignore_versioned_solibs=''
724 libs=''
725 libsdirs=''
726 libsfiles=''
727 libsfound=''
728 libspath=''
729 lns=''
730 d_PRIEldbl=''
731 d_PRIFldbl=''
732 d_PRIGldbl=''
733 d_PRIeldbl=''
734 d_PRIfldbl=''
735 d_PRIgldbl=''
736 sPRIEldbl=''
737 sPRIFldbl=''
738 sPRIGldbl=''
739 sPRIeldbl=''
740 sPRIfldbl=''
741 sPRIgldbl=''
742 lseeksize=''
743 lseektype=''
744 make_set_make=''
745 d_mymalloc=''
746 freetype=''
747 mallocobj=''
748 mallocsrc=''
749 malloctype=''
750 usemymalloc=''
751 installman1dir=''
752 man1dir=''
753 man1direxp=''
754 man1ext=''
755 installman3dir=''
756 man3dir=''
757 man3direxp=''
758 man3ext=''
759 huge=''
760 large=''
761 medium=''
762 models=''
763 small=''
764 split=''
765 modetype=''
766 multiarch=''
767 mydomain=''
768 myhostname=''
769 phostname=''
770 c=''
771 n=''
772 d_eofnblk=''
773 eagain=''
774 o_nonblock=''
775 rd_nodata=''
776 netdb_hlen_type=''
777 netdb_host_type=''
778 netdb_name_type=''
779 netdb_net_type=''
780 groupcat=''
781 hostcat=''
782 passcat=''
783 orderlib=''
784 ranlib=''
785 d_perl_otherlibdirs=''
786 otherlibdirs=''
787 package=''
788 spackage=''
789 pager=''
790 api_revision=''
791 api_subversion=''
792 api_version=''
793 api_versionstring=''
794 patchlevel=''
795 revision=''
796 subversion=''
797 version=''
798 perl5=''
799 perladmin=''
800 perlpath=''
801 d_nv_preserves_uv=''
802 d_nv_preserves_uv_bits=''
803 i16size=''
804 i16type=''
805 i32size=''
806 i32type=''
807 i64size=''
808 i64type=''
809 i8size=''
810 i8type=''
811 ivsize=''
812 ivtype=''
813 nvsize=''
814 nvtype=''
815 u16size=''
816 u16type=''
817 u32size=''
818 u32type=''
819 u64size=''
820 u64type=''
821 u8size=''
822 u8type=''
823 uvsize=''
824 uvtype=''
825 ivdformat=''
826 uvoformat=''
827 uvuformat=''
828 uvxformat=''
829 pidtype=''
830 prefix=''
831 prefixexp=''
832 installprivlib=''
833 privlib=''
834 privlibexp=''
835 prototype=''
836 ptrsize=''
837 d_PRIX64=''
838 d_PRId64=''
839 d_PRIi64=''
840 d_PRIo64=''
841 d_PRIu64=''
842 d_PRIx64=''
843 sPRIX64=''
844 sPRId64=''
845 sPRIi64=''
846 sPRIo64=''
847 sPRIu64=''
848 sPRIx64=''
849 d_quad=''
850 quadkind=''
851 quadtype=''
852 uquadtype=''
853 drand01=''
854 randbits=''
855 randfunc=''
856 randseedtype=''
857 seedfunc=''
858 installscript=''
859 scriptdir=''
860 scriptdirexp=''
861 selectminbits=''
862 selecttype=''
863 sh=''
864 sig_count=''
865 sig_name=''
866 sig_name_init=''
867 sig_num=''
868 sig_num_init=''
869 installsitearch=''
870 sitearch=''
871 sitearchexp=''
872 installsitebin=''
873 sitebin=''
874 sitebinexp=''
875 installsitelib=''
876 sitelib=''
877 sitelib_stem=''
878 sitelibexp=''
879 siteprefix=''
880 siteprefixexp=''
881 sizesize=''
882 sizetype=''
883 so=''
884 socksizetype=''
885 sharpbang=''
886 shsharp=''
887 spitshell=''
888 src=''
889 ssizetype=''
890 startperl=''
891 startsh=''
892 stdchar=''
893 d_stdio_stream_array=''
894 stdio_stream_array=''
895 sysman=''
896 trnl=''
897 uidformat=''
898 uidsign=''
899 uidsize=''
900 uidtype=''
901 archname64=''
902 use64bitall=''
903 use64bitint=''
904 ccflags_uselargefiles=''
905 ldflags_uselargefiles=''
906 libswanted_uselargefiles=''
907 uselargefiles=''
908 uselongdouble=''
909 usemorebits=''
910 usemultiplicity=''
911 nm_opt=''
912 nm_so_opt=''
913 runnm=''
914 usenm=''
915 useperlio=''
916 usesocks=''
917 d_oldpthreads=''
918 use5005threads=''
919 useithreads=''
920 usethreads=''
921 incpath=''
922 mips_type=''
923 usrinc=''
924 d_vendorarch=''
925 installvendorarch=''
926 vendorarch=''
927 vendorarchexp=''
928 d_vendorbin=''
929 installvendorbin=''
930 vendorbin=''
931 vendorbinexp=''
932 d_vendorlib=''
933 installvendorlib=''
934 vendorlib=''
935 vendorlib_stem=''
936 vendorlibexp=''
937 usevendorprefix=''
938 vendorprefix=''
939 vendorprefixexp=''
940 defvoidused=''
941 voidflags=''
942 pm_apiversion=''
943 xs_apiversion=''
944 CONFIG=''
945
946 define='define'
947 undef='undef'
948 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
949 rmlist=''
950
951 : We must find out about Eunice early
952 eunicefix=':'
953 if test -f /etc/unixtovms; then
954         eunicefix=/etc/unixtovms
955 fi
956 if test -f /etc/unixtovms.exe; then
957         eunicefix=/etc/unixtovms.exe
958 fi
959
960 i_whoami=''
961 : set useposix=false in your hint file to disable the POSIX extension.
962 useposix=true
963 : set useopcode=false in your hint file to disable the Opcode extension.
964 useopcode=true
965 : Trailing extension.  Override this in a hint file, if needed.
966 _exe=''
967 : Extra object files, if any, needed on this platform.
968 archobjs=''
969 : Possible local include directories to search.
970 : Set locincpth to "" in a hint file to defeat local include searches.
971 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
972 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
973 :
974 : no include file wanted by default
975 inclwanted=''
976
977 groupstype=''
978 : change the next line if compiling for Xenix/286 on Xenix/386
979 xlibpth='/usr/lib/386 /lib/386'
980 : Possible local library directories to search.
981 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
982 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
983
984 : general looking path for locating libraries
985 glibpth="/usr/lib/large /lib /usr/lib $xlibpth"
986 glibpth="$glibpth /lib/large /usr/lib/small /lib/small"
987 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
988 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
989 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
990
991 : Private path used by Configure to find libraries.  Its value
992 : is prepended to libpth. This variable takes care of special
993 : machines, like the mips.  Usually, it should be empty.
994 plibpth=''
995
996 : default library list
997 libswanted=''
998 : some systems want to use only the non-versioned libso:s
999 ignore_versioned_solibs=''
1000 ccflags_uselargefiles=''
1001 ldflags_uselargefiles=''
1002 libswanted_uselargefiles=''
1003 : set usemultiplicity on the Configure command line to enable multiplicity.
1004 : set usesocks on the Configure command line to enable socks.
1005 : set usethreads on the Configure command line to enable threads.
1006 : full support for void wanted by default
1007 defvoidused=15
1008
1009 : List of libraries we want.
1010 : If anyone needs -lnet, put it in a hint file.
1011 libswanted='sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl'
1012 libswanted="$libswanted dld ld sun m c cposix posix"
1013 libswanted="$libswanted ndir dir crypt sec"
1014 libswanted="$libswanted ucb bsd BSD PW x iconv util"
1015 : We probably want to search /usr/shlib before most other libraries.
1016 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1017 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1018 glibpth="/usr/shlib $glibpth"
1019 : Do not use vfork unless overridden by a hint file.
1020 usevfork=false
1021
1022 : Find the basic shell for Bourne shell scripts
1023 case "$sh" in
1024 '')
1025         case "$SYSTYPE" in
1026         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1027         *) xxx='/bin/sh';;
1028         esac
1029         if test -f "$xxx"; then
1030                 sh="$xxx"
1031         else
1032                 : Build up a list and do a single loop so we can 'break' out.
1033                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1034                 for xxx in sh bash ksh pdksh ash; do
1035                         for p in $pth; do
1036                                 try="$try ${p}/${xxx}"
1037                         done
1038                 done
1039                 for xxx in $try; do
1040                         if test -f "$xxx"; then
1041                                 sh="$xxx";
1042                                 break
1043                         elif test -f "$xxx.exe"; then
1044                                 sh="$xxx";
1045                                 break
1046                         fi
1047                 done
1048         fi
1049         ;;
1050 esac
1051
1052 case "$sh" in
1053 '')     cat <<EOM >&2
1054 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
1055
1056 Usually it's in /bin/sh.  How did you even get this far?
1057 Please contact me (Perl Maintainers) at perlbug@perl.com and 
1058 we'll try to straighten this all out.
1059 EOM
1060         exit 1
1061         ;;
1062 esac
1063
1064 : see if sh knows # comments
1065 if `$sh -c '#' >/dev/null 2>&1`; then
1066         shsharp=true
1067         spitshell=cat
1068         xcat=/bin/cat
1069         test -f $xcat || xcat=/usr/bin/cat
1070         echo "#!$xcat" >try
1071         $eunicefix try
1072         chmod +x try
1073         ./try > today
1074         if test -s today; then
1075                 sharpbang='#!'
1076         else
1077                 echo "#! $xcat" > try
1078                 $eunicefix try
1079                 chmod +x try
1080                 ./try > today
1081                 if test -s today; then
1082                         sharpbang='#! '
1083                 else
1084                         sharpbang=': use '
1085                 fi
1086         fi
1087 else
1088         echo " "
1089         echo "Your $sh doesn't grok # comments--I will strip them later on."
1090         shsharp=false
1091         cd ..
1092         echo "exec grep -v '^[  ]*#'" >spitshell
1093         chmod +x spitshell
1094         $eunicefix spitshell
1095         spitshell=`pwd`/spitshell
1096         cd UU
1097         echo "I presume that if # doesn't work, #! won't work either!"
1098         sharpbang=': use '
1099 fi
1100 rm -f try today
1101
1102 : figure out how to guarantee sh startup
1103 case "$startsh" in
1104 '') startsh=${sharpbang}${sh} ;;
1105 *)
1106 esac
1107 cat >try <<EOSS
1108 $startsh
1109 set abc
1110 test "$?abc" != 1
1111 EOSS
1112
1113 chmod +x try
1114 $eunicefix try
1115 if ./try; then
1116         : echo "Yup, it does."
1117 else
1118         echo "Hmm... '$startsh' does not guarantee sh startup..."
1119         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1120 fi
1121 rm -f try
1122
1123
1124 : Save command line options in file UU/cmdline.opt for later use in
1125 : generating config.sh.
1126 cat > cmdline.opt <<EOSH
1127 # Configure command line arguments.
1128 config_arg0='$0'
1129 config_args='$*'
1130 config_argc=$#
1131 EOSH
1132 argn=1
1133 for arg in "$@"; do
1134         cat >>cmdline.opt <<EOSH
1135 config_arg$argn='$arg'
1136 EOSH
1137         argn=`expr $argn + 1`
1138 done
1139
1140 : produce awk script to parse command line options
1141 cat >options.awk <<'EOF'
1142 BEGIN {
1143         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1144
1145         len = length(optstr);
1146         for (i = 1; i <= len; i++) {
1147                 c = substr(optstr, i, 1);
1148                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1149                 if (a == ":") {
1150                         arg[c] = 1;
1151                         i++;
1152                 }
1153                 opt[c] = 1;
1154         }
1155 }
1156 {
1157         expect = 0;
1158         str = $0;
1159         if (substr(str, 1, 1) != "-") {
1160                 printf("'%s'\n", str);
1161                 next;
1162         }
1163         len = length($0);
1164         for (i = 2; i <= len; i++) {
1165                 c = substr(str, i, 1);
1166                 if (!opt[c]) {
1167                         printf("-%s\n", substr(str, i));
1168                         next;
1169                 }
1170                 printf("-%s\n", c);
1171                 if (arg[c]) {
1172                         if (i < len)
1173                                 printf("'%s'\n", substr(str, i + 1));
1174                         else
1175                                 expect = 1;
1176                         next;
1177                 }
1178         }
1179 }
1180 END {
1181         if (expect)
1182                 print "?";
1183 }
1184 EOF
1185
1186 : process the command line options
1187 set X `for arg in "$@"; do echo "X$arg"; done |
1188         sed -e s/X// | awk -f options.awk`
1189 eval "set $*"
1190 shift
1191 rm -f options.awk
1192
1193 : set up default values
1194 fastread=''
1195 reuseval=false
1196 config_sh=''
1197 alldone=''
1198 error=''
1199 silent=''
1200 extractsh=''
1201 override=''
1202 knowitall=''
1203 rm -f optdef.sh posthint.sh
1204 cat >optdef.sh <<EOS
1205 $startsh
1206 EOS
1207
1208
1209 : option parsing
1210 while test $# -gt 0; do
1211         case "$1" in
1212         -d) shift; fastread=yes;;
1213         -e) shift; alldone=cont;;
1214         -f)
1215                 shift
1216                 cd ..
1217                 if test -r "$1"; then
1218                         config_sh="$1"
1219                 else
1220                         echo "$me: cannot read config file $1." >&2
1221                         error=true
1222                 fi
1223                 cd UU
1224                 shift;;
1225         -h) shift; error=true;;
1226         -r) shift; reuseval=true;;
1227         -s) shift; silent=true; realsilent=true;;
1228         -E) shift; alldone=exit;;
1229         -K) shift; knowitall=true;;
1230         -O) shift; override=true;;
1231         -S) shift; silent=true; extractsh=true;;
1232         -D)
1233                 shift
1234                 case "$1" in
1235                 *=)
1236                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1237                         echo "$me: ignoring -D $1" >&2
1238                         ;;
1239                 *=*) echo "$1" | \
1240                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1241                 *) echo "$1='define'" >> optdef.sh;;
1242                 esac
1243                 shift
1244                 ;;
1245         -U)
1246                 shift
1247                 case "$1" in
1248                 *=) echo "$1" >> optdef.sh;;
1249                 *=*)
1250                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1251                         echo "$me: ignoring -U $1" >&2
1252                         ;;
1253                 *) echo "$1='undef'" >> optdef.sh;;
1254                 esac
1255                 shift
1256                 ;;
1257         -A)
1258             shift
1259             xxx=''
1260             yyy="$1"
1261             zzz=''
1262             uuu=undef
1263             case "$yyy" in
1264             *=*) zzz=`echo $yyy|sed 's!=.*!!'`
1265                  case "$zzz" in
1266                  *:*) zzz='' ;;
1267                  *)   xxx=append
1268                       zzz=" "`echo $yyy|sed 's!^[^=]*=!!'` 
1269                       yyy=`echo $yyy|sed 's!=.*!!'` ;;
1270                  esac
1271                  ;;
1272             esac
1273             case "$xxx" in
1274             '')  case "$yyy" in
1275                  *:*) xxx=`echo $yyy|sed 's!:.*!!'`
1276                       yyy=`echo $yyy|sed 's!^[^:]*:!!'`
1277                       zzz=`echo $yyy|sed 's!^[^=]*=!!'`
1278                       yyy=`echo $yyy|sed 's!=.*!!'` ;;
1279                  *)   xxx=`echo $yyy|sed 's!:.*!!'`
1280                       yyy=`echo $yyy|sed 's!^[^:]*:!!'` ;;
1281                  esac
1282                  ;;       
1283             esac
1284             case "$xxx" in
1285             append)
1286                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1287             clear)
1288                 echo "$yyy=''"                  >> posthint.sh ;;
1289             define)
1290                 case "$zzz" in
1291                 '') zzz=define ;;
1292                 esac
1293                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1294             eval)
1295                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1296             prepend)
1297                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1298             undef)
1299                 case "$zzz" in
1300                 '') zzz="$uuu" ;;
1301                 esac
1302                 echo "$yyy=$zzz"                >> posthint.sh ;;
1303             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1304             esac
1305             shift
1306             ;;
1307         -V) echo "$me generated by metaconfig 3.0 PL70." >&2
1308             exit 0;;
1309         --) break;;
1310         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1311         *) break;;
1312         esac
1313 done
1314
1315 case "$error" in
1316 true)
1317         cat >&2 <<EOM
1318 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1319                  [-U symbol] [-U symbol=] [-A command:symbol...]
1320   -d : use defaults for all answers.
1321   -e : go on without questioning past the production of config.sh.
1322   -f : specify an alternate default configuration file.
1323   -h : print this help message and exit (with an error status).
1324   -r : reuse C symbols value if possible (skips costly nm extraction).
1325   -s : silent mode, only echoes questions and essential information.
1326   -D : define symbol to have some value:
1327          -D symbol         symbol gets the value 'define'
1328          -D symbol=value   symbol gets the value 'value'
1329   -E : stop at the end of questions, after having produced config.sh.
1330   -K : do not use unless you know what you are doing.
1331   -O : let -D and -U override definitions from loaded configuration file.
1332   -S : perform variable substitutions on all .SH files (can mix with -f)
1333   -U : undefine symbol:
1334          -U symbol    symbol gets the value 'undef'
1335          -U symbol=   symbol gets completely empty
1336   -A : manipulate symbol after the platform specific hints have been applied:
1337          -A symbol=value                append " "value to symbol
1338          -A append:symbol=value         append value to symbol
1339          -A define:symbol=value         define symbol to have value
1340          -A clear:symbol                define symbol to be ''
1341          -A define:symbol               define symbol to be 'define'
1342          -A eval:symbol=value           define symbol to be eval of value
1343          -A prepend:symbol=value        prepend value to symbol
1344          -A undef:symbol                define symbol to be 'undef'
1345          -A undef:symbol=               define symbol to be ''
1346   -V : print version number and exit (with a zero status).
1347 EOM
1348         exit 1
1349         ;;
1350 esac
1351
1352 : Sanity checks
1353 case "$fastread$alldone" in
1354 yescont|yesexit) ;;
1355 *)
1356         case "$extractsh" in
1357         true) ;;
1358         *)
1359                 if test ! -t 0; then
1360                         echo "Say 'sh Configure', not 'sh <Configure'"
1361                         exit 1
1362                 fi
1363                 ;;
1364         esac
1365         ;;
1366 esac
1367
1368 exec 4>&1
1369 case "$silent" in
1370 true) exec 1>/dev/null;;
1371 esac
1372
1373 : run the defines and the undefines, if any, but leave the file out there...
1374 touch optdef.sh
1375 . ./optdef.sh
1376 : create the posthint manipulation script and leave the file out there...
1377 touch posthint.sh
1378
1379 : set package name
1380 package=perl5
1381 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1382 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1383 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1384 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1385 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1386 esac
1387
1388 : Some greps do not return status, grrr.
1389 echo "grimblepritz" >grimble
1390 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1391         contains=contains
1392 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1393         contains=grep
1394 else
1395         contains=contains
1396 fi
1397 rm -f grimble
1398 : the following should work in any shell
1399 case "$contains" in
1400 contains*)
1401         echo " "
1402         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1403         cat >contains <<'EOSS'
1404 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1405 EOSS
1406 chmod +x contains
1407 esac
1408
1409 : Find the path to the source tree
1410 case "$src" in
1411 '') case "$0" in
1412     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1413          case "$src" in
1414          /*)    ;;
1415          *)     src=`cd ../$src && pwd` ;;
1416          esac
1417          ;;
1418     *)   src='.';;
1419     esac;;
1420 esac
1421 case "$src" in
1422 '')     src=/
1423         rsrc=/
1424         ;;
1425 /*) rsrc="$src";;
1426 *) rsrc="../$src";;
1427 esac
1428 if test -f $rsrc/Configure && \
1429         $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1430 then
1431    : found it, so we are ok.
1432 else
1433         rsrc=''
1434         for src in . .. ../.. ../../.. ../../../..; do
1435                 if test -f ../$src/Configure && \
1436                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1437                 then
1438                         rsrc=../$src
1439                         break
1440                 fi
1441         done
1442 fi
1443 case "$rsrc" in
1444 '')
1445         cat <<EOM >&4
1446
1447 Sorry, I can't seem to locate the source dir for $package.  Please start
1448 Configure with an explicit path -- i.e. /some/path/Configure.
1449
1450 EOM
1451         exit 1
1452         ;;
1453 ../.)   rsrc='..';;
1454 *)
1455         echo " "
1456         echo "Sources for $package found in \"$src\"." >&4
1457         ;;
1458 esac
1459
1460 : script used to extract .SH files with variable substitutions
1461 cat >extract <<'EOS'
1462 CONFIGDOTSH=true
1463 echo "Doing variable substitutions on .SH files..."
1464 if test -f $src/MANIFEST; then
1465         set x `awk '{print $1}' <$src/MANIFEST | grep '\.SH$'`
1466 else
1467         echo "(Looking for .SH files under the source directory.)"
1468         set x `(cd $src; find . -name "*.SH" -print)`
1469 fi
1470 shift
1471 case $# in
1472 0) set x `(cd $src; echo *.SH)`; shift;;
1473 esac
1474 if test ! -f $src/$1; then
1475         shift
1476 fi
1477 mkdir_p='
1478 name=$1;
1479 create="";
1480 while test $name; do
1481         if test ! -d "$name"; then
1482                 create="$name $create";
1483                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1484                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1485         else
1486                 name="";
1487         fi;
1488 done;
1489 for file in $create; do
1490         mkdir $file;
1491 done
1492 '
1493 for file in $*; do
1494         case "$src" in
1495         ".")
1496                 case "$file" in
1497                 */*)
1498                         dir=`expr X$file : 'X\(.*\)/'`
1499                         file=`expr X$file : 'X.*/\(.*\)'`
1500                         (cd $dir && . ./$file)
1501                         ;;
1502                 *)
1503                         . ./$file
1504                         ;;
1505                 esac
1506                 ;;
1507         *)
1508                 case "$file" in
1509                 */*)
1510                         dir=`expr X$file : 'X\(.*\)/'`
1511                         file=`expr X$file : 'X.*/\(.*\)'`
1512                         (set x $dir; shift; eval $mkdir_p)
1513                         sh <$src/$dir/$file
1514                         ;;
1515                 *)
1516                         sh <$src/$file
1517                         ;;
1518                 esac
1519                 ;;
1520         esac
1521 done
1522 if test -f $src/config_h.SH; then
1523         if test ! -f config.h; then
1524         : oops, they left it out of MANIFEST, probably, so do it anyway.
1525         . $src/config_h.SH
1526         fi
1527 fi
1528 EOS
1529
1530 : extract files and exit if asked to do so
1531 case "$extractsh" in
1532 true)
1533         case "$realsilent" in
1534         true) ;;
1535         *) exec 1>&4;;
1536         esac
1537         case "$config_sh" in
1538         '') config_sh='config.sh';;
1539         esac
1540         echo " "
1541         echo "Fetching answers from $config_sh..."
1542         cd ..
1543         . $config_sh
1544         test "$override" && . ./optdef.sh
1545         echo " "
1546         . UU/extract
1547         rm -rf UU
1548         echo "Done."
1549         exit 0
1550         ;;
1551 esac
1552
1553 : Eunice requires " " instead of "", can you believe it
1554 echo " "
1555 : Here we go...
1556 echo "Beginning of configuration questions for $package."
1557
1558 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1559
1560 : first determine how to suppress newline on echo command
1561 echo " "
1562 echo "Checking echo to see how to suppress newlines..."
1563 (echo "hi there\c" ; echo " ") >.echotmp
1564 if $contains c .echotmp >/dev/null 2>&1 ; then
1565         echo "...using -n."
1566         n='-n'
1567         c=''
1568 else
1569         cat <<'EOM'
1570 ...using \c
1571 EOM
1572         n=''
1573         c='\c'
1574 fi
1575 echo $n "The star should be here-->$c"
1576 echo '*'
1577 rm -f .echotmp
1578
1579 : Now test for existence of everything in MANIFEST
1580 echo " "
1581 if test -f $rsrc/MANIFEST; then
1582         echo "First let's make sure your kit is complete.  Checking..." >&4
1583         awk '$1 !~ /PACK[A-Z]+/ {print $1}' $rsrc/MANIFEST | split -50
1584         rm -f missing
1585         tmppwd=`pwd`
1586         for filelist in x??; do
1587                 (cd $rsrc; ls `cat $tmppwd/$filelist` >/dev/null 2>>$tmppwd/missing)
1588         done
1589         if test -s missing; then
1590                 cat missing >&4
1591                 cat >&4 <<'EOM'
1592
1593 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1594
1595 You have the option of continuing the configuration process, despite the
1596 distinct possibility that your kit is damaged, by typing 'y'es.  If you
1597 do, don't blame me if something goes wrong.  I advise you to type 'n'o
1598 and contact the author (perlbug@perl.com).
1599
1600 EOM
1601                 echo $n "Continue? [n] $c" >&4
1602                 read ans
1603                 case "$ans" in
1604                 y*)
1605                         echo "Continuing..." >&4
1606                         rm -f missing
1607                         ;;
1608                 *)
1609                         echo "ABORTING..." >&4
1610                         kill $$
1611                         ;;
1612                 esac
1613         else
1614                 echo "Looks good..."
1615         fi
1616 else
1617         echo "There is no MANIFEST file.  I hope your kit is complete !"
1618 fi
1619 rm -f missing x??
1620
1621 echo " "
1622 : Find the appropriate value for a newline for tr
1623 if test -n "$DJGPP"; then
1624        trnl='\012'
1625 fi
1626 if test X"$trnl" = X; then
1627         case "`echo foo|tr '\n' x 2>/dev/null`" in
1628         foox) trnl='\n' ;;
1629         esac
1630 fi
1631 if test X"$trnl" = X; then
1632         case "`echo foo|tr '\012' x 2>/dev/null`" in
1633         foox) trnl='\012' ;;
1634         esac
1635 fi
1636 if test X"$trnl" = X; then
1637         cat <<EOM >&2
1638
1639 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
1640
1641 EOM
1642         exit 1
1643 fi
1644
1645 : compute the number of columns on the terminal for proper question formatting
1646 case "$COLUMNS" in
1647 '') COLUMNS='80';;
1648 esac
1649
1650 : set up the echo used in my read
1651 myecho="case \"\$xxxm\" in
1652 '') echo $n \"\$rp $c\" >&4;;
1653 *) case \"\$rp\" in
1654         '') echo $n \"[\$xxxm] $c\";;
1655         *)
1656                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
1657                         echo \"\$rp\" >&4
1658                         echo $n \"[\$xxxm] $c\" >&4
1659                 else
1660                         echo $n \"\$rp [\$xxxm] $c\" >&4
1661                 fi
1662                 ;;
1663         esac;;
1664 esac"
1665
1666 : now set up to do reads with possible shell escape and default assignment
1667 cat <<EOSC >myread
1668 $startsh
1669 xxxm=\$dflt
1670 $myecho
1671 ans='!'
1672 case "\$fastread" in
1673 yes) case "\$dflt" in
1674         '') ;;
1675         *) ans='';
1676                 case "\$silent-\$rp" in
1677                 true-) ;;
1678                 *) echo " " >&4;;
1679                 esac;;
1680         esac;;
1681 *) case "\$silent" in
1682         true) case "\$rp" in
1683                 '') ans='';;
1684                 esac;;
1685         esac;;
1686 esac
1687 while expr "X\$ans" : "X!" >/dev/null; do
1688         read answ
1689         set x \$xxxm
1690         shift
1691         aok=''; eval "ans=\\"\$answ\\"" && aok=y
1692         case  "\$answ" in
1693         "!")
1694                 sh 1>&4
1695                 echo " "
1696                 $myecho
1697                 ;;
1698         !*)
1699                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
1700                 shift
1701                 sh 1>&4 -c "\$*"
1702                 echo " "
1703                 $myecho
1704                 ;;
1705         "\$ans")
1706                 case "\$ans" in
1707                 \\&*)
1708                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
1709                         shift
1710                         case "\$1" in
1711                         -d)
1712                                 fastread=yes
1713                                 echo "(OK, I'll run with -d after this question.)" >&4
1714                                 ;;
1715                         -*)
1716                                 echo "*** Sorry, \$1 not supported yet." >&4
1717                                 ;;
1718                         esac
1719                         $myecho
1720                         ans=!
1721                         ;;
1722                 esac;;
1723         *)
1724                 case "\$aok" in
1725                 y)
1726                         echo "*** Substitution done -- please confirm."
1727                         xxxm="\$ans"
1728                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
1729                         xxxm="\$ans"
1730                         ans=!
1731                         ;;
1732                 *)
1733                         echo "*** Error -- try again."
1734                         ans=!
1735                         ;;
1736                 esac
1737                 $myecho
1738                 ;;
1739         esac
1740         case "\$ans\$xxxm\$nostick" in
1741         '')
1742                 ans=!
1743                 $myecho
1744                 ;;
1745         esac
1746 done
1747 case "\$ans" in
1748 '') ans="\$xxxm";;
1749 esac
1750 EOSC
1751
1752 : create .config dir to save info across Configure sessions
1753 test -d ../.config || mkdir ../.config
1754 cat >../.config/README <<EOF
1755 This directory created by Configure to save information that should
1756 persist across sessions for $package.
1757
1758 You may safely delete it if you wish.
1759 EOF
1760
1761 : general instructions
1762 needman=true
1763 firsttime=true
1764 user=`(logname) 2>/dev/null`
1765 case "$user" in
1766 '') user=`whoami 2>&1`;;
1767 esac
1768 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
1769         firsttime=false
1770         echo " "
1771         rp='Would you like to see the instructions?'
1772         dflt=n
1773         . ./myread
1774         case "$ans" in
1775         [yY]*) ;;
1776         *) needman=false;;
1777         esac
1778 fi
1779 if $needman; then
1780         cat <<EOH
1781
1782 This installation shell script will examine your system and ask you questions
1783 to determine how the perl5 package should be installed. If you get
1784 stuck on a question, you may use a ! shell escape to start a subshell or
1785 execute a command.  Many of the questions will have default answers in square
1786 brackets; typing carriage return will give you the default.
1787
1788 On some of the questions which ask for file or directory names you are allowed
1789 to use the ~name construct to specify the login directory belonging to "name",
1790 even if you don't have a shell which knows about that.  Questions where this is
1791 allowed will be marked "(~name ok)".
1792
1793 EOH
1794         rp=''
1795         dflt='Type carriage return to continue'
1796         . ./myread
1797         cat <<'EOH'
1798
1799 The prompter used in this script allows you to use shell variables and
1800 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
1801 in the default answer, as if the default line was a set of arguments given to a
1802 script shell.  This means you may also use $* to repeat the whole default line,
1803 so you do not have to re-type everything to add something to the default.
1804
1805 Everytime there is a substitution, you will have to confirm.  If there is an
1806 error (e.g. an unmatched backtick), the default answer will remain unchanged
1807 and you will be prompted again.
1808
1809 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
1810 the questions and use the computed defaults (or the previous answers if there
1811 was already a config.sh file). Type 'Configure -h' for a list of options.
1812 You may also start interactively and then answer '& -d' at any prompt to turn
1813 on the non-interactive behaviour for the remainder of the execution.
1814
1815 EOH
1816         . ./myread
1817         cat <<EOH
1818
1819 Much effort has been expended to ensure that this shell script will run on any
1820 Unix system.  If despite that it blows up on yours, your best bet is to edit
1821 Configure and run it again.  If you can't run Configure for some reason,
1822 you'll have to generate a config.sh file by hand.  Whatever problems you
1823 have, let me (perlbug@perl.com) know how I blew it.
1824
1825 This installation script affects things in two ways:
1826
1827 1) it may do direct variable substitutions on some of the files included
1828    in this kit.
1829 2) it builds a config.h file for inclusion in C programs.  You may edit
1830    any of these files as the need arises after running this script.
1831
1832 If you make a mistake on a question, there is no easy way to back up to it
1833 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
1834 files.  Configure will offer to let you do this before it runs the SH files.
1835
1836 EOH
1837         dflt='Type carriage return to continue'
1838         . ./myread
1839         case "$firsttime" in
1840         true) echo $user >>../.config/instruct;;
1841         esac
1842 fi
1843
1844 : find out where common programs are
1845 echo " "
1846 echo "Locating common programs..." >&4
1847 cat <<EOSC >loc
1848 $startsh
1849 case \$# in
1850 0) exit 1;;
1851 esac
1852 thing=\$1
1853 shift
1854 dflt=\$1
1855 shift
1856 for dir in \$*; do
1857         case "\$thing" in
1858         .)
1859         if test -d \$dir/\$thing; then
1860                 echo \$dir
1861                 exit 0
1862         fi
1863         ;;
1864         *)
1865         for thisthing in \$dir/\$thing; do
1866                 : just loop through to pick last item
1867         done
1868         if test -f \$thisthing; then
1869                 echo \$thisthing
1870                 exit 0
1871         elif test -f \$dir/\$thing.exe; then
1872                 if test -n "$DJGPP"; then
1873                         echo \$dir/\$thing.exe
1874                 else
1875                         : on Eunice apparently
1876                         echo \$dir/\$thing
1877                 fi
1878                 exit 0
1879         fi
1880         ;;
1881         esac
1882 done
1883 echo \$dflt
1884 exit 1
1885 EOSC
1886 chmod +x loc
1887 $eunicefix loc
1888 loclist="
1889 awk
1890 cat
1891 comm
1892 cp
1893 echo
1894 expr
1895 grep
1896 ls
1897 make
1898 mkdir
1899 rm
1900 sed
1901 sort
1902 touch
1903 tr
1904 uniq
1905 "
1906 trylist="
1907 Mcc
1908 ar
1909 byacc
1910 cpp
1911 csh
1912 date
1913 egrep
1914 gzip
1915 less
1916 ln
1917 more
1918 nm
1919 nroff
1920 pg
1921 test
1922 uname
1923 zip
1924 "
1925 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1926 pth="$pth /lib /usr/lib"
1927 for file in $loclist; do
1928         eval xxx=\$$file
1929         case "$xxx" in
1930         /*|?:[\\/]*)
1931                 if test -f "$xxx"; then
1932                         : ok
1933                 else
1934                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
1935                         xxx=`./loc $file $file $pth`
1936                 fi
1937                 ;;
1938         '') xxx=`./loc $file $file $pth`;;
1939         *) xxx=`./loc $xxx $xxx $pth`;;
1940         esac
1941         eval $file=$xxx
1942         eval _$file=$xxx
1943         case "$xxx" in
1944         /*)
1945                 echo $file is in $xxx.
1946                 ;;
1947         ?:[\\/]*)
1948                 echo $file is in $xxx.
1949                 ;;
1950         *)
1951                 echo "I don't know where '$file' is, and my life depends on it." >&4
1952                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
1953                 exit 1
1954                 ;;
1955         esac
1956 done
1957 echo " "
1958 echo "Don't worry if any of the following aren't found..."
1959 say=offhand
1960 for file in $trylist; do
1961         eval xxx=\$$file
1962         case "$xxx" in
1963         /*|?:[\\/]*)
1964                 if test -f "$xxx"; then
1965                         : ok
1966                 else
1967                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
1968                         xxx=`./loc $file $file $pth`
1969                 fi
1970                 ;;
1971         '') xxx=`./loc $file $file $pth`;;
1972         *) xxx=`./loc $xxx $xxx $pth`;;
1973         esac
1974         eval $file=$xxx
1975         eval _$file=$xxx
1976         case "$xxx" in
1977         /*)
1978                 echo $file is in $xxx.
1979                 ;;
1980         ?:[\\/]*)
1981                 echo $file is in $xxx.
1982                 ;;
1983         *)
1984                 echo "I don't see $file out there, $say."
1985                 say=either
1986                 ;;
1987         esac
1988 done
1989 case "$egrep" in
1990 egrep)
1991         echo "Substituting grep for egrep."
1992         egrep=$grep
1993         ;;
1994 esac
1995 case "$ln" in
1996 ln)
1997         echo "Substituting cp for ln."
1998         ln=$cp
1999         ;;
2000 esac
2001 case "$test" in
2002 test)
2003         echo "Hopefully test is built into your sh."
2004         ;;
2005 *)
2006         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2007                 echo "Using the test built into your sh."
2008                 test=test
2009                 _test=test
2010         fi
2011         ;;
2012 esac
2013 case "$echo" in
2014 echo)
2015         echo "Hopefully echo is built into your sh."
2016         ;;
2017 '') ;;
2018 *)
2019         echo " "
2020 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2021         $echo $n "hi there$c" >foo1
2022         echo $n "hi there$c" >foo2
2023         if cmp foo1 foo2 >/dev/null 2>&1; then
2024                 echo "They are compatible.  In fact, they may be identical."
2025         else
2026                 case "$n" in
2027                 '-n') n='' c='\c';;
2028                 *) n='-n' c='';;
2029                 esac
2030                 cat <<FOO
2031 They are not compatible!  You are probably running ksh on a non-USG system.
2032 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2033 have echo built in and we may have to run some Bourne shell scripts.  That
2034 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2035
2036 FOO
2037                 $echo $n "The star should be here-->$c"
2038                 $echo "*"
2039         fi
2040         $rm -f foo1 foo2
2041         ;;
2042 esac
2043
2044 cat <<EOS >checkcc
2045 $startsh
2046 EOS
2047 cat <<'EOSC' >>checkcc
2048 case "$cc" in
2049 '') ;;
2050 *)  $rm -f try try.*
2051     $cat >try.c <<EOM
2052 int main(int argc, char *argv[]) {
2053   return 0;
2054 }
2055 EOM
2056     if $cc -o try try.c; then
2057        :
2058     else
2059         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2060         despair=yes
2061         trygcc=yes
2062         case "$cc" in
2063         *gcc*) trygcc=no ;;
2064         esac
2065         case "`$cc -v -c try.c 2>&1`" in
2066         *gcc*) trygcc=no ;;
2067         esac
2068         if $test X"$trygcc" = Xyes; then
2069             if gcc -o try -c try.c; then
2070                 echo " "
2071                 echo "You seem to have a working gcc, though." >&4
2072                 rp="Would you like to use it?"
2073                 dflt=y
2074                 if $test -f myread; then
2075                     . ./myread
2076                 else
2077                     if $test -f UU/myread; then
2078                         . ./UU/myread
2079                     else
2080                         echo "Cannot find myread, sorry.  Aborting." >&2
2081                         exit 1
2082                     fi
2083                 fi  
2084                 case "$ans" in
2085                 [yY]*) cc=gcc; ccflags=''; despair=no ;;
2086                 esac
2087             fi
2088         fi
2089         if $test X"$despair" = Xyes; then
2090             echo "You need to find a working C compiler." >&4
2091             echo "I cannot continue any further, aborting." >&4
2092             exit 1
2093         fi
2094     fi
2095     $rm -f try try.*
2096     ;;
2097 esac
2098 EOSC
2099
2100 : determine whether symbolic links are supported
2101 echo " "
2102 $touch blurfl
2103 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2104         echo "Symbolic links are supported." >&4
2105         lns="$ln -s"
2106 else
2107         echo "Symbolic links are NOT supported." >&4
2108         lns="$ln"
2109 fi
2110 $rm -f blurfl sym
2111
2112 : see whether [:lower:] and [:upper:] are supported character classes
2113 echo " "
2114 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2115 ABYZ)
2116         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2117         up='[:upper:]'
2118         low='[:lower:]'
2119         ;;
2120 *)      # There is a discontinuity in EBCDIC between 'I' and 'J'
2121         # (0xc9 and 0xd1), therefore that is a nice testing point.
2122         if test "X$up" = X -o "X$low" = X; then
2123             case "`echo IJ | $tr '[I-J]' '[i-j]' 2>/dev/null`" in
2124             ij) up='[A-Z]'
2125                 low='[a-z]'
2126                 ;;
2127             esac
2128         fi
2129         if test "X$up" = X -o "X$low" = X; then
2130             case "`echo IJ | $tr I-J i-j 2>/dev/null`" in
2131             ij) up='A-Z'
2132                 low='a-z'
2133                 ;;
2134             esac
2135         fi
2136         if test "X$up" = X -o "X$low" = X; then
2137             case "`echo IJ | od -x 2>/dev/null`" in
2138             *C9D1*|*c9d1*)
2139                 echo "Hey, this might be EBCDIC." >&4
2140                 if test "X$up" = X -o "X$low" = X; then
2141                     case "`echo IJ | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
2142                     ij) up='[A-IJ-RS-Z]'
2143                         low='[a-ij-rs-z]'
2144                         ;;
2145                     esac
2146                 fi
2147                 if test "X$up" = X -o "X$low" = X; then
2148                     case "`echo IJ | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
2149                     ij) up='A-IJ-RS-Z'
2150                         low='a-ij-rs-z'
2151                         ;;
2152                     esac
2153                 fi
2154                 ;;
2155             esac
2156         fi
2157 esac
2158 case "`echo IJ | $tr \"$up\" \"$low\" 2>/dev/null`" in
2159 ij)
2160     echo "Using $up and $low to convert case." >&4
2161     ;;
2162 *)
2163     echo "I don't know how to translate letters from upper to lower case." >&4
2164     echo "Your tr is not acting any way I know of." >&4
2165     exit 1
2166     ;;
2167 esac
2168 : set up the translation script tr, must be called with ./tr of course
2169 cat >tr <<EOSC
2170 $startsh
2171 case "\$1\$2" in
2172 '[A-Z][a-z]') exec $tr '$up' '$low';;
2173 '[a-z][A-Z]') exec $tr '$low' '$up';;
2174 esac
2175 exec $tr "\$@"
2176 EOSC
2177 chmod +x tr
2178 $eunicefix tr
2179
2180 : Try to determine whether config.sh was made on this system
2181 case "$config_sh" in
2182 '')
2183 myuname=`$uname -a 2>/dev/null`
2184 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
2185 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
2186 # because the A-Z/a-z are not consecutive.
2187 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
2188         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
2189 newmyuname="$myuname"
2190 dflt=n
2191 case "$knowitall" in
2192 '')
2193         if test -f ../config.sh; then
2194                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
2195                         eval "`grep myuname= ../config.sh`"
2196                 fi
2197                 if test "X$myuname" = "X$newmyuname"; then
2198                         dflt=y
2199                 fi
2200         fi
2201         ;;
2202 *) dflt=y;;
2203 esac
2204
2205 : Get old answers from old config file if Configure was run on the
2206 : same system, otherwise use the hints.
2207 hint=default
2208 cd ..
2209 if test -f config.sh; then
2210         echo " "
2211         rp="I see a config.sh file.  Shall I use it to set the defaults?"
2212         . UU/myread
2213         case "$ans" in
2214         n*|N*) echo "OK, I'll ignore it."; mv config.sh config.sh.old;;
2215         *)  echo "Fetching default answers from your old config.sh file..." >&4
2216                 tmp_n="$n"
2217                 tmp_c="$c"
2218                 tmp_sh="$sh"
2219                 . ./config.sh
2220                 cp config.sh UU
2221                 n="$tmp_n"
2222                 c="$tmp_c"
2223                 : Older versions did not always set $sh.  Catch re-use of such
2224                 : an old config.sh.
2225                 case "$sh" in
2226                 '') sh="$tmp_sh" ;;
2227                 esac
2228                 hint=previous
2229                 ;;
2230         esac
2231 fi
2232 . ./UU/checkcc
2233 if test ! -f config.sh; then
2234         $cat <<EOM
2235
2236 First time through, eh?  I have some defaults handy for some systems
2237 that need some extra help getting the Configure answers right:
2238
2239 EOM
2240         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
2241         dflt=''
2242         : Half the following guesses are probably wrong... If you have better
2243         : tests or hints, please send them to perlbug@perl.com
2244         : The metaconfig authors would also appreciate a copy...
2245         $test -f /irix && osname=irix
2246         $test -f /xenix && osname=sco_xenix
2247         $test -f /dynix && osname=dynix
2248         $test -f /dnix && osname=dnix
2249         $test -f /lynx.os && osname=lynxos
2250         $test -f /unicos && osname=unicos && osvers=`$uname -r`
2251         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
2252         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
2253         $test -f /bin/mips && /bin/mips && osname=mips
2254         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
2255                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
2256         $test -d /usr/apollo/bin && osname=apollo
2257         $test -f /etc/saf/_sactab && osname=svr4
2258         $test -d /usr/include/minix && osname=minix
2259         if $test -d /MachTen -o -d /MachTen_Folder; then
2260                 osname=machten
2261                 if $test -x /sbin/version; then
2262                         osvers=`/sbin/version | $awk '{print $2}' |
2263                         $sed -e 's/[A-Za-z]$//'`
2264                 elif $test -x /usr/etc/version; then
2265                         osvers=`/usr/etc/version | $awk '{print $2}' |
2266                         $sed -e 's/[A-Za-z]$//'`
2267                 else
2268                         osvers="$2.$3"
2269                 fi
2270         fi
2271
2272         $test -f /sys/posix.dll &&
2273                 $test -f /usr/bin/what &&
2274                 set X `/usr/bin/what /sys/posix.dll` &&
2275                 $test "$3" = UWIN &&
2276                 osname=uwin &&
2277                 osvers="$5"
2278
2279         if $test -f $uname; then
2280                 set X $myuname
2281                 shift
2282
2283                 case "$5" in
2284                 fps*) osname=fps ;;
2285                 mips*)
2286                         case "$4" in
2287                         umips) osname=umips ;;
2288                         *) osname=mips ;;
2289                         esac;;
2290                 [23]100) osname=mips ;;
2291                 next*) osname=next ;;
2292                 i386*)
2293                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
2294                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
2295                                 osname='sco'
2296                                 osvers=$tmp
2297                         elif $test -f /etc/kconfig; then
2298                                 osname=isc
2299                                 if test "$lns" = "$ln -s"; then
2300                                         osvers=4
2301                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
2302                                         osvers=3
2303                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
2304                                         osvers=2
2305                                 fi
2306                         fi
2307                         tmp=''
2308                         ;;
2309                 pc*)
2310                         if test -n "$DJGPP"; then
2311                                 osname=dos
2312                                 osvers=djgpp
2313                         fi
2314                         ;;
2315                 esac
2316
2317                 case "$1" in
2318                 aix) osname=aix
2319                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
2320                         case "$tmp" in
2321                         'not found') osvers="$4"."$3" ;;
2322                         '<3240'|'<>3240') osvers=3.2.0 ;;
2323                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
2324                         '=3250'|'>3250') osvers=3.2.5 ;;
2325                         *) osvers=$tmp;;
2326                         esac
2327                         ;;
2328                 bsd386) osname=bsd386
2329                         osvers=`$uname -r`
2330                         ;;
2331                 cygwin*) osname=cygwin
2332                         osvers="$3"
2333                         ;;
2334                 *dc.osx) osname=dcosx
2335                         osvers="$3"
2336                         ;;
2337                 dnix) osname=dnix
2338                         osvers="$3"
2339                         ;;
2340                 domainos) osname=apollo
2341                         osvers="$3"
2342                         ;;
2343                 dgux) osname=dgux 
2344                         osvers="$3"
2345                         ;;
2346                 dynixptx*) osname=dynixptx
2347                         osvers=`echo "$4"|sed 's/^v//'`
2348                         ;;
2349                 freebsd) osname=freebsd 
2350                         osvers="$3" ;;
2351                 genix) osname=genix ;;
2352                 hp*) osname=hpux 
2353                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
2354                         ;;
2355                 irix*) osname=irix
2356                         case "$3" in
2357                         4*) osvers=4 ;;
2358                         5*) osvers=5 ;;
2359                         *)      osvers="$3" ;;
2360                         esac
2361                         ;;
2362                 linux) osname=linux
2363                         case "$3" in
2364                         *)      osvers="$3" ;;
2365                         esac
2366                         ;;
2367                 MiNT) osname=mint
2368                         ;;
2369                 netbsd*) osname=netbsd
2370                         osvers="$3"
2371                         ;;
2372                 news-os) osvers="$3"
2373                         case "$3" in
2374                         4*) osname=newsos4 ;;
2375                         *) osname=newsos ;;
2376                         esac
2377                         ;;
2378                 next*) osname=next ;;
2379                 POSIX-BC | posix-bc ) osname=posix-bc
2380                         osvers="$3"
2381                         ;;
2382                 powerux | power_ux | powermax_os | powermaxos | \
2383                 powerunix | power_unix) osname=powerux
2384                         osvers="$3"
2385                         ;;
2386                 qnx) osname=qnx
2387                         osvers="$4"
2388                         ;;
2389                 solaris) osname=solaris
2390                         case "$3" in
2391                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
2392                         *)      osvers="$3" ;;
2393                         esac
2394                         ;;
2395                 sunos) osname=sunos
2396                         case "$3" in
2397                         5*) osname=solaris
2398                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
2399                         *)      osvers="$3" ;;
2400                         esac
2401                         ;;
2402                 titanos) osname=titanos
2403                         case "$3" in
2404                         1*) osvers=1 ;;
2405                         2*) osvers=2 ;;
2406                         3*) osvers=3 ;;
2407                         4*) osvers=4 ;;
2408                         *)      osvers="$3" ;;
2409                         esac
2410                         ;;
2411                 ultrix) osname=ultrix
2412                         osvers="$3"
2413                         ;;
2414                 osf1|mls+)      case "$5" in
2415                                 alpha)
2416                                         osname=dec_osf
2417                                         osvers=`sizer -v | awk '{print $3}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
2418                                         case "$osvers" in
2419                                         [1-9].[0-9]*) ;;
2420                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
2421                                         esac
2422                                         ;;
2423                         hp*)    osname=hp_osf1  ;;
2424                         mips)   osname=mips_osf1 ;;
2425                         esac
2426                         ;;
2427                 unixware) osname=svr5
2428                         osvers="$4"
2429                         ;;
2430                 uts) osname=uts
2431                         osvers="$3"
2432                         ;;
2433                 $2) case "$osname" in
2434                         *isc*) ;;
2435                         *freebsd*) ;;
2436                         svr*)
2437                                 : svr4.x or possibly later
2438                                 case "svr$3" in 
2439                                 ${osname}*)
2440                                         osname=svr$3
2441                                         osvers=$4
2442                                         ;;
2443                                 esac
2444                                 case "$osname" in
2445                                 svr4.0)
2446                                         : Check for ESIX
2447                                         if test -f /stand/boot ; then
2448                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
2449                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
2450                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
2451                                                         if test -n "$isesix"; then
2452                                                                 osname=esix4
2453                                                         fi
2454                                                 fi
2455                                         fi
2456                                         ;;
2457                                 esac
2458                                 ;;
2459                         *)      if test -f /etc/systemid; then
2460                                         osname=sco
2461                                         set `echo $3 | $sed 's/\./ /g'` $4
2462                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
2463                                                 osvers=$1.$2.$3
2464                                         elif $test -f $src/hints/sco_$1_$2.sh; then
2465                                                 osvers=$1.$2
2466                                         elif $test -f $src/hints/sco_$1.sh; then
2467                                                 osvers=$1
2468                                         fi
2469                                 else
2470                                         case "$osname" in
2471                                         '') : Still unknown.  Probably a generic Sys V.
2472                                                 osname="sysv"
2473                                                 osvers="$3"
2474                                                 ;;
2475                                         esac
2476                                 fi
2477                                 ;;
2478                         esac
2479                         ;;
2480                 *)      case "$osname" in
2481                         '') : Still unknown.  Probably a generic BSD.
2482                                 osname="$1"
2483                                 osvers="$3"
2484                                 ;;
2485                         esac
2486                         ;;
2487                 esac
2488         else
2489                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
2490                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
2491                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
2492                                 osname=news_os
2493                         fi
2494                         $rm -f UU/kernel.what
2495                 elif test -d c:/.; then
2496                         set X $myuname
2497                         osname=os2
2498                         osvers="$5"
2499                 fi
2500         fi
2501         
2502         : Now look for a hint file osname_osvers, unless one has been
2503         : specified already.
2504         case "$hintfile" in
2505         ''|' ')
2506                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
2507                 : Also try without trailing minor version numbers.
2508                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
2509                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
2510                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
2511                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
2512                 case "$file" in
2513                 '') dflt=none ;;
2514                 *)  case "$osvers" in
2515                         '') dflt=$file
2516                                 ;;
2517                         *)  if $test -f $src/hints/$file.sh ; then
2518                                         dflt=$file
2519                                 elif $test -f $src/hints/$xfile.sh ; then
2520                                         dflt=$xfile
2521                                 elif $test -f $src/hints/$xxfile.sh ; then
2522                                         dflt=$xxfile
2523                                 elif $test -f $src/hints/$xxxfile.sh ; then
2524                                         dflt=$xxxfile
2525                                 elif $test -f $src/hints/$xxxxfile.sh ; then
2526                                         dflt=$xxxxfile
2527                                 elif $test -f "$src/hints/${osname}.sh" ; then
2528                                         dflt="${osname}"
2529                                 else
2530                                         dflt=none
2531                                 fi
2532                                 ;;
2533                         esac
2534                         ;;
2535                 esac
2536                 if $test -f Policy.sh ; then
2537                         case "$dflt" in
2538                         *Policy*) ;;
2539                         none) dflt="Policy" ;;
2540                         *) dflt="Policy $dflt" ;;
2541                         esac
2542                 fi
2543                 ;;
2544         *)
2545                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
2546                 ;;
2547         esac
2548
2549         if $test -f Policy.sh ; then
2550                 $cat <<EOM
2551
2552 There's also a Policy hint file available, which should make the
2553 site-specific (policy) questions easier to answer.
2554 EOM
2555
2556         fi
2557
2558         $cat <<EOM
2559
2560 You may give one or more space-separated answers, or "none" if appropriate.
2561 A well-behaved OS will have no hints, so answering "none" or just "Policy"
2562 is a good thing.  DO NOT give a wrong version or a wrong OS.
2563
2564 EOM
2565
2566         rp="Which of these apply, if any?"
2567         . UU/myread
2568         tans=$ans
2569         for file in $tans; do
2570                 if $test X$file = XPolicy -a -f Policy.sh; then
2571                         . Policy.sh
2572                         $cat Policy.sh >> UU/config.sh
2573                 elif $test -f $src/hints/$file.sh; then
2574                         . $src/hints/$file.sh
2575                         $cat $src/hints/$file.sh >> UU/config.sh
2576                 elif $test X$tans = X -o X$tans = Xnone ; then
2577                         : nothing
2578                 else
2579                         : Give one chance to correct a possible typo.
2580                         echo "$file.sh does not exist"
2581                         dflt=$file
2582                         rp="hint to use instead?"
2583                         . UU/myread
2584                         for file in $ans; do
2585                                 if $test -f "$src/hints/$file.sh"; then
2586                                         . $src/hints/$file.sh
2587                                         $cat $src/hints/$file.sh >> UU/config.sh
2588                                 elif $test X$ans = X -o X$ans = Xnone ; then
2589                                         : nothing
2590                                 else
2591                                         echo "$file.sh does not exist -- ignored."
2592                                 fi
2593                         done
2594                 fi
2595         done
2596
2597         hint=recommended
2598         : Remember our hint file for later.
2599         if $test -f "$src/hints/$file.sh" ; then
2600                 hintfile="$file"
2601         else
2602                 hintfile=''
2603         fi
2604 fi
2605 cd UU
2606 ;;
2607 *)
2608         echo " "
2609         echo "Fetching default answers from $config_sh..." >&4
2610         tmp_n="$n"
2611         tmp_c="$c"
2612         cd ..
2613         cp $config_sh config.sh 2>/dev/null
2614         chmod +w config.sh
2615         . ./config.sh
2616         cd UU
2617         cp ../config.sh .
2618         n="$tmp_n"
2619         c="$tmp_c"
2620         hint=previous
2621         ;;
2622 esac
2623 test "$override" && . ./optdef.sh
2624 myuname="$newmyuname"
2625
2626 : Restore computed paths
2627 for file in $loclist $trylist; do
2628         eval $file="\$_$file"
2629 done
2630
2631 cat << EOM
2632
2633 Configure uses the operating system name and version to set some defaults.
2634 The default value is probably right if the name rings a bell. Otherwise,
2635 since spelling matters for me, either accept the default or answer "none"
2636 to leave it blank.
2637
2638 EOM
2639 case "$osname" in
2640         ''|' ')
2641                 case "$hintfile" in
2642                 ''|' '|none) dflt=none ;;
2643                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
2644                 esac
2645                 ;;
2646         *) dflt="$osname" ;;
2647 esac
2648 rp="Operating system name?"
2649 . ./myread
2650 case "$ans" in
2651 none)  osname='' ;;
2652 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
2653 esac
2654 echo " "
2655 case "$osvers" in
2656         ''|' ')
2657                 case "$hintfile" in
2658                 ''|' '|none) dflt=none ;;
2659                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
2660                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
2661                         case "$dflt" in
2662                         ''|' ') dflt=none ;;
2663                         esac
2664                         ;;
2665                 esac
2666                 ;;
2667         *) dflt="$osvers" ;;
2668 esac
2669 rp="Operating system version?"
2670 . ./myread
2671 case "$ans" in
2672 none)  osvers='' ;;
2673 *) osvers="$ans" ;;
2674 esac
2675
2676
2677 . ./posthint.sh
2678
2679 : who configured the system
2680 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
2681 cf_by=`(logname) 2>/dev/null`
2682 case "$cf_by" in
2683 "")
2684         cf_by=`(whoami) 2>/dev/null`
2685         case "$cf_by" in
2686         "") cf_by=unknown ;;
2687         esac ;;
2688 esac
2689
2690 : set up the script used to warn in case of inconsistency
2691 cat <<EOS >whoa
2692 $startsh
2693 EOS
2694 cat <<'EOSC' >>whoa
2695 dflt=y
2696 echo " "
2697 echo "*** WHOA THERE!!! ***" >&4
2698 echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
2699 rp="    Keep the $hint value?"
2700 . ./myread
2701 case "$ans" in
2702 y) td=$was; tu=$was;;
2703 esac
2704 EOSC
2705
2706 : function used to set $1 to $val
2707 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
2708 case "$val$was" in
2709 $define$undef) . ./whoa; eval "$var=\$td";;
2710 $undef$define) . ./whoa; eval "$var=\$tu";;
2711 *) eval "$var=$val";;
2712 esac'
2713
2714 case "$usethreads" in
2715 $define|true|[yY]*)     dflt='y';;
2716 *) dflt='n';;
2717 esac
2718 cat <<EOM
2719
2720 Perl can be built to take advantage of threads on some systems.
2721 To do so, Configure can be run with -Dusethreads.
2722
2723 Note that threading is a highly experimental feature, and
2724 some known race conditions still remain.  If you choose to try
2725 it, be very sure to not actually deploy it for production
2726 purposes.  README.threads has more details, and is required
2727 reading if you enable threads.
2728
2729 If this doesn't make any sense to you, just accept the default '$dflt'.
2730 EOM
2731 rp='Build a threading Perl?'
2732 . ./myread
2733 case "$ans" in
2734 y|Y)    val="$define" ;;
2735 *)      val="$undef" ;;
2736 esac
2737 set usethreads
2738 eval $setvar
2739
2740 case "$usethreads" in
2741 $define)
2742         $cat <<EOM
2743
2744 As of 5.5.640, Perl has two different internal threading implementations,
2745 the 5.005 version (5005threads) and an interpreter-based version
2746 (ithreads) that has one interpreter per thread.  Both are very 
2747 experimental.  This arrangement exists to help developers work out
2748 which one is better.
2749
2750 If you're a casual user, you probably don't want interpreter-threads
2751 at this time.  There doesn't yet exist a way to create threads from
2752 within Perl in this model, i.e., "use Thread;" will NOT work.
2753 EOM
2754         : Default to ithreads unless overridden on command line or with
2755         : old config.sh
2756         dflt='y'
2757         case "$use5005threads" in
2758                 $define|true|[yY]*) dflt='n';;
2759         esac
2760         case "$useithreads" in
2761                 $undef|false|[nN]*) dflt='n';;
2762         esac
2763         rp='Use interpreter-based ithreads?'
2764         . ./myread
2765         case "$ans" in
2766         y|Y)    val="$define" ;;
2767         *)      val="$undef" ;;
2768         esac
2769         set useithreads
2770         eval $setvar
2771         : Now set use5005threads to the opposite value.
2772         case "$useithreads" in
2773         $define) val="$undef" ;;
2774         *) val="$define" ;;
2775         esac
2776         set use5005threads
2777         eval $setvar
2778         ;;
2779 *)
2780         useithreads="$undef"
2781         use5005threads="$undef"
2782         ;;
2783 esac
2784
2785 case "$d_oldpthreads" in
2786 '')     : Configure tests would be welcome here.  For now, assume undef.
2787         val="$undef" ;;
2788 *)      val="$d_oldpthreads" ;;
2789 esac
2790 set d_oldpthreads
2791 eval $setvar
2792
2793
2794 case "$usethreads" in
2795 "$define"|true|[yY]*)
2796 : Look for a hint-file generated 'call-back-unit'.  If the
2797 : user has specified that a threading perl is to be built,
2798 : we may need to set or change some other defaults.
2799         if $test -f usethreads.cbu; then
2800                 echo "Your platform has some specific hints for threaded builds, using them..."
2801                 . ./usethreads.cbu
2802         else
2803                 $cat <<EOM
2804 (Your platform doesn't have any specific hints for threaded builds.
2805  Assuming POSIX threads, then.)
2806 EOM
2807         fi
2808         ;;
2809 esac
2810
2811 cat <<EOM
2812
2813 Perl can be built so that multiple Perl interpreters can coexist
2814 within the same Perl executable.
2815 EOM
2816
2817 case "$useithreads" in
2818 $define)
2819         cat <<EOM
2820 This multiple interpreter support is required for interpreter-based threads.
2821 EOM
2822         val="$define"
2823         ;;
2824 *)      case "$usemultiplicity" in
2825         $define|true|[yY]*)     dflt='y';;
2826         *) dflt='n';;
2827         esac
2828         echo " "
2829         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
2830         rp='Build Perl for multiplicity?'
2831         . ./myread
2832         case "$ans" in
2833         y|Y)    val="$define" ;;
2834         *)      val="$undef" ;;
2835         esac
2836         ;;
2837 esac
2838 set usemultiplicity
2839 eval $setvar
2840
2841 : determine where manual pages are on this system
2842 echo " "
2843 case "$sysman" in
2844 '') 
2845         syspath='/usr/man/man1 /usr/man/mann /usr/man/manl /usr/man/local/man1'
2846         syspath="$syspath /usr/man/u_man/man1 /usr/share/man/man1"
2847         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
2848         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
2849         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
2850         sysman=`./loc . /usr/man/man1 $syspath`
2851         ;;
2852 esac
2853 if $test -d "$sysman"; then
2854         echo "System manual is in $sysman." >&4
2855 else
2856         echo "Could not find manual pages in source form." >&4
2857 fi
2858
2859 : see what memory models we can support
2860 case "$models" in
2861 '')
2862         $cat >pdp11.c <<'EOP'
2863 int main() {
2864 #ifdef pdp11
2865         exit(0);
2866 #else
2867         exit(1);
2868 #endif
2869 }
2870 EOP
2871         case "$cc" in
2872         '') modelcc="$cc" ;;
2873         *) modelcc="cc" ;;
2874         esac
2875         ( $modelcc -o pdp11 pdp11.c ) >/dev/null 2>&1
2876         if $test -f pdp11 && ./pdp11 2>/dev/null; then
2877                 dflt='unsplit split'
2878         else
2879                 tans=`./loc . X /lib/small /lib/large /usr/lib/small /usr/lib/large /lib/medium /usr/lib/medium /lib/huge`
2880                 case "$tans" in
2881                 X) dflt='none';;
2882                 *) if $test -d /lib/small || $test -d /usr/lib/small; then
2883                                 dflt='small'
2884                         else
2885                                 dflt=''
2886                         fi
2887                         if $test -d /lib/medium || $test -d /usr/lib/medium; then
2888                                 dflt="$dflt medium"
2889                         fi
2890                         if $test -d /lib/large || $test -d /usr/lib/large; then
2891                                 dflt="$dflt large"
2892                         fi
2893                         if $test -d /lib/huge || $test -d /usr/lib/huge; then
2894                                 dflt="$dflt huge"
2895                         fi
2896                 esac
2897         fi;;
2898 *) dflt="$models";;
2899 esac
2900 $cat <<EOM
2901  
2902 Some systems have different model sizes.  On most systems they are called
2903 small, medium, large, and huge.  On the PDP11 they are called unsplit and
2904 split.  If your system doesn't support different memory models, say "none".
2905 If you wish to force everything to one memory model, say "none" here and
2906 put the appropriate flags later when it asks you for other cc and ld flags.
2907 Venix systems may wish to put "none" and let the compiler figure things out.
2908 (In the following question multiple model names should be space separated.)
2909
2910 The default for most systems is "none".
2911
2912 EOM
2913 rp="Which memory models are supported?"
2914 . ./myread
2915 models="$ans"
2916
2917 case "$models" in
2918 none)
2919         small=''
2920         medium=''
2921         large=''
2922         huge=''
2923         unsplit=''
2924         split=''
2925         ;;
2926 *split)
2927         case "$split" in
2928         '') if $contains '\-i' $sysman/ld.1 >/dev/null 2>&1 || \
2929                          $contains '\-i' $sysman/cc.1 >/dev/null 2>&1; then
2930                         dflt='-i'
2931                 else
2932                         dflt='none'
2933                 fi;;
2934         *) dflt="$split";;
2935         esac
2936         rp="What flag indicates separate I and D space?"
2937         . ./myread
2938         tans="$ans"
2939         case "$tans" in
2940         none) tans='';;
2941         esac
2942         split="$tans"
2943         unsplit='';;
2944 *large*|*small*|*medium*|*huge*)
2945         case "$models" in
2946         *large*)
2947                 case "$large" in
2948                 '') dflt='-Ml';;
2949                 *) dflt="$large";;
2950                 esac
2951         rp="What flag indicates large model?"
2952         . ./myread
2953         tans="$ans"
2954         case "$tans" in
2955         none) tans='';
2956         esac
2957         large="$tans";;
2958         *) large='';;
2959         esac
2960         case "$models" in
2961         *huge*) case "$huge" in
2962                 '') dflt='-Mh';;
2963                 *) dflt="$huge";;
2964                 esac
2965                 rp="What flag indicates huge model?"
2966                 . ./myread
2967                 tans="$ans"
2968                 case "$tans" in
2969                 none) tans='';
2970                 esac
2971                 huge="$tans";;
2972         *) huge="$large";;
2973         esac
2974         case "$models" in
2975         *medium*) case "$medium" in
2976                 '') dflt='-Mm';;
2977                 *) dflt="$medium";;
2978                 esac
2979                 rp="What flag indicates medium model?"
2980                 . ./myread
2981                 tans="$ans"
2982                 case "$tans" in
2983                 none) tans='';
2984                 esac
2985                 medium="$tans";;
2986         *) medium="$large";;
2987         esac
2988         case "$models" in
2989         *small*) case "$small" in
2990                 '') dflt='none';;
2991                 *) dflt="$small";;
2992                 esac
2993                 rp="What flag indicates small model?"
2994                 . ./myread
2995                 tans="$ans"
2996                 case "$tans" in
2997                 none) tans='';
2998                 esac
2999                 small="$tans";;
3000         *) small='';;
3001         esac
3002         ;;
3003 *)
3004         echo "Unrecognized memory models--you may have to edit Makefile.SH" >&4
3005         ;;
3006 esac
3007 $rm -f pdp11.* pdp11
3008
3009 : make some quick guesses about what we are up against
3010 echo " "
3011 $echo $n "Hmm...  $c"
3012 echo exit 1 >bsd
3013 echo exit 1 >usg
3014 echo exit 1 >v7
3015 echo exit 1 >osf1
3016 echo exit 1 >eunice
3017 echo exit 1 >xenix
3018 echo exit 1 >venix
3019 echo exit 1 >os2
3020 d_bsd="$undef"
3021 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
3022 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
3023 then
3024         echo "Looks kind of like an OSF/1 system, but we'll see..."
3025         echo exit 0 >osf1
3026 elif test `echo abc | tr a-z A-Z` = Abc ; then
3027         xxx=`./loc addbib blurfl $pth`
3028         if $test -f $xxx; then
3029         echo "Looks kind of like a USG system with BSD features, but we'll see..."
3030                 echo exit 0 >bsd
3031                 echo exit 0 >usg
3032         else
3033                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
3034                         echo "Looks kind of like an extended USG system, but we'll see..."
3035                 else
3036                         echo "Looks kind of like a USG system, but we'll see..."
3037                 fi
3038                 echo exit 0 >usg
3039         fi
3040 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
3041         echo "Looks kind of like a BSD system, but we'll see..."
3042         d_bsd="$define"
3043         echo exit 0 >bsd
3044 else
3045         echo "Looks kind of like a Version 7 system, but we'll see..."
3046         echo exit 0 >v7
3047 fi
3048 case "$eunicefix" in
3049 *unixtovms*)
3050         $cat <<'EOI'
3051 There is, however, a strange, musty smell in the air that reminds me of
3052 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
3053 EOI
3054         echo exit 0 >eunice
3055         d_eunice="$define"
3056 : it so happens the Eunice I know will not run shell scripts in Unix format
3057         ;;
3058 *)
3059         echo " "
3060         echo "Congratulations.  You aren't running Eunice."
3061         d_eunice="$undef"
3062         ;;
3063 esac
3064 : Detect OS2.  The p_ variable is set above in the Head.U unit.
3065 case "$p_" in
3066 :) ;;
3067 *)
3068         $cat <<'EOI'
3069 I have the feeling something is not exactly right, however...don't tell me...
3070 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
3071 EOI
3072         echo exit 0 >os2
3073         ;;
3074 esac
3075 if test -f /xenix; then
3076         echo "Actually, this looks more like a XENIX system..."
3077         echo exit 0 >xenix
3078         d_xenix="$define"
3079 else
3080         echo " "
3081         echo "It's not Xenix..."
3082         d_xenix="$undef"
3083 fi
3084 chmod +x xenix
3085 $eunicefix xenix
3086 if test -f /venix; then
3087         echo "Actually, this looks more like a VENIX system..."
3088         echo exit 0 >venix
3089 else
3090         echo " "
3091         if ./xenix; then
3092                 : null
3093         else
3094                 echo "Nor is it Venix..."
3095         fi
3096 fi
3097 chmod +x bsd usg v7 osf1 eunice xenix venix os2
3098 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
3099 $rm -f foo
3100
3101 : see if we need a special compiler
3102 echo " "
3103 if ./usg; then
3104         case "$cc" in
3105         '') case "$Mcc" in
3106                 /*) dflt='Mcc';;
3107                 *) case "$large" in
3108                         -M*) dflt='cc';;
3109                         *)      if $contains '\-M' $sysman/cc.1 >/dev/null 2>&1 ; then
3110                                         if $contains '\-M' $sysman/cpp.1 >/dev/null 2>&1; then
3111                                                 dflt='cc'
3112                                         else
3113                                                 dflt='cc -M'
3114                                         fi
3115                                 else
3116                                         dflt='cc'
3117                                 fi;;
3118                         esac;;
3119                 esac;;
3120         *)  dflt="$cc";;
3121         esac
3122         case "$dflt" in
3123         *M*)    $cat <<'EOM'
3124 On some older systems the default C compiler will not resolve multiple global
3125 references that happen to have the same name.  On some such systems the "Mcc"
3126 command may be used to force these to be resolved.  On other systems a "cc -M"
3127 command is required.  (Note that the -M flag on other systems indicates a
3128 memory model to use!) If you have the Gnu C compiler, you might wish to use
3129 that instead.
3130
3131 EOM
3132         ;;
3133         esac
3134         rp="Use which C compiler?"
3135         . ./myread
3136         cc="$ans"
3137 else
3138         case "$cc" in
3139         '') dflt=cc;;
3140         *) dflt="$cc";;
3141         esac
3142         rp="Use which C compiler?"
3143         . ./myread
3144         cc="$ans"
3145 fi
3146 : Look for a hint-file generated 'call-back-unit'.  Now that the
3147 : user has specified the compiler, we may need to set or change some
3148 : other defaults.
3149 if $test -f cc.cbu; then
3150     . ./cc.cbu
3151 fi
3152 . ./checkcc
3153
3154 echo " "
3155 echo "Checking for GNU cc in disguise and/or its version number..." >&4
3156 $cat >gccvers.c <<EOM
3157 #include <stdio.h>
3158 int main() {
3159 #ifdef __GNUC__
3160 #ifdef __VERSION__
3161         printf("%s\n", __VERSION__);
3162 #else
3163         printf("%s\n", "1");
3164 #endif
3165 #endif
3166         exit(0);
3167 }
3168 EOM
3169 if $cc $ldflags -o gccvers gccvers.c; then
3170         gccversion=`./gccvers`
3171         case "$gccversion" in
3172         '') echo "You are not using GNU cc." ;;
3173         *)  echo "You are using GNU cc $gccversion."
3174             ;;
3175         esac
3176 else
3177         echo " "
3178         echo "*** WHOA THERE!!! ***" >&4
3179         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
3180         case "$knowitall" in
3181         '')
3182         echo "    You'd better start hunting for one and let me know about it." >&4
3183                 exit 1
3184                 ;;
3185         esac
3186 fi
3187 $rm -f gccvers*
3188 case "$gccversion" in
3189 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
3190 esac
3191 case "$gccversion" in
3192 '') gccosandvers='' ;;
3193 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
3194    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
3195    gccshortvers=''
3196    case "$gccosandvers" in
3197    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
3198    $osname$osvers) ;; # looking good
3199    $osname*) cat <<EOM >&4
3200
3201 *** WHOA THERE!!! ***
3202
3203     Your gcc has not been compiled for the exact release of
3204     your operating system ($gccosandvers versus $osname$osvers).
3205
3206     In general it is a good idea to keep gcc synchronized with
3207     the operating system because otherwise serious problems
3208     may ensue when trying to compile software, like Perl.
3209
3210     I'm trying to be optimistic here, though, and will continue.
3211     If later during the configuration and build icky compilation
3212     problems appear (headerfile conflicts being the most common
3213     manifestation), I suggest reinstalling the gcc to match
3214     your operating system release.
3215
3216 EOM
3217       ;;
3218    *) gccosandvers='' ;; # failed to parse, better be silent
3219    esac
3220    ;;
3221 esac
3222
3223
3224
3225
3226 : see how we invoke the C preprocessor
3227 echo " "
3228 echo "Now, how can we feed standard input to your C preprocessor..." >&4
3229 cat <<'EOT' >testcpp.c
3230 #define ABC abc
3231 #define XYZ xyz
3232 ABC.XYZ
3233 EOT
3234 cd ..
3235 if test ! -f cppstdin; then
3236         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
3237                 # AIX cc -E doesn't show the absolute headerfile
3238                 # locations but we'll cheat by using the -M flag.
3239                 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
3240         else
3241                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
3242         fi
3243 else
3244         echo "Keeping your $hint cppstdin wrapper."
3245 fi
3246 chmod 755 cppstdin
3247 wrapper=`pwd`/cppstdin
3248 ok='false'
3249 cd UU
3250
3251 if $test "X$cppstdin" != "X" && \
3252         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
3253         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3254 then
3255         echo "You used to use $cppstdin $cppminus so we'll use that again."
3256         case "$cpprun" in
3257         '') echo "But let's see if we can live without a wrapper..." ;;
3258         *)
3259                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
3260                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3261                 then
3262                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
3263                         ok='true'
3264                 else
3265                         echo "(However, $cpprun $cpplast does not work, let's see...)"
3266                 fi
3267                 ;;
3268         esac
3269 else
3270         case "$cppstdin" in
3271         '') ;;
3272         *)
3273                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
3274                 ;;
3275         esac
3276 fi
3277
3278 if $ok; then
3279         : nothing
3280 elif echo 'Maybe "'"$cc"' -E" will work...'; \
3281         $cc -E <testcpp.c >testcpp.out 2>&1; \
3282         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3283         echo "Yup, it does."
3284         x_cpp="$cc -E"
3285         x_minus='';
3286 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
3287         $cc -E - <testcpp.c >testcpp.out 2>&1; \
3288         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3289         echo "Yup, it does."
3290         x_cpp="$cc -E"
3291         x_minus='-';
3292 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
3293         $cc -P <testcpp.c >testcpp.out 2>&1; \
3294         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3295         echo "Yipee, that works!"
3296         x_cpp="$cc -P"
3297         x_minus='';
3298 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
3299         $cc -P - <testcpp.c >testcpp.out 2>&1; \
3300         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3301         echo "At long last!"
3302         x_cpp="$cc -P"
3303         x_minus='-';
3304 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
3305         $cpp <testcpp.c >testcpp.out 2>&1; \
3306         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3307         echo "It works!"
3308         x_cpp="$cpp"
3309         x_minus='';
3310 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
3311         $cpp - <testcpp.c >testcpp.out 2>&1; \
3312         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3313         echo "Hooray, it works!  I was beginning to wonder."
3314         x_cpp="$cpp"
3315         x_minus='-';
3316 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
3317         $wrapper <testcpp.c >testcpp.out 2>&1; \
3318         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3319         x_cpp="$wrapper"
3320         x_minus=''
3321         echo "Eureka!"
3322 else
3323         dflt=''
3324         rp="No dice.  I can't find a C preprocessor.  Name one:"
3325         . ./myread
3326         x_cpp="$ans"
3327         x_minus=''
3328         $x_cpp <testcpp.c >testcpp.out 2>&1
3329         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3330                 echo "OK, that will do." >&4
3331         else
3332 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
3333                 exit 1
3334         fi
3335 fi
3336
3337 case "$ok" in
3338 false)
3339         cppstdin="$x_cpp"
3340         cppminus="$x_minus"
3341         cpprun="$x_cpp"
3342         cpplast="$x_minus"
3343         set X $x_cpp
3344         shift
3345         case "$1" in
3346         "$cpp")
3347                 echo "Perhaps can we force $cc -E using a wrapper..."
3348                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
3349                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3350                 then
3351                         echo "Yup, we can."
3352                         cppstdin="$wrapper"
3353                         cppminus='';
3354                 else
3355                         echo "Nope, we'll have to live without it..."
3356                 fi
3357                 ;;
3358         esac
3359         case "$cpprun" in
3360         "$wrapper")
3361                 cpprun=''
3362                 cpplast=''
3363                 ;;
3364         esac
3365         ;;
3366 esac
3367
3368 case "$cppstdin" in
3369 "$wrapper"|'cppstdin') ;;
3370 *) $rm -f $wrapper;;
3371 esac
3372 $rm -f testcpp.c testcpp.out
3373
3374 : decide how portable to be.  Allow command line overrides.
3375 case "$d_portable" in
3376 "$undef") ;;
3377 *)      d_portable="$define" ;;
3378 esac
3379
3380 : set up shell script to do ~ expansion
3381 cat >filexp <<EOSS
3382 $startsh
3383 : expand filename
3384 case "\$1" in
3385  ~/*|~)
3386         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3387         ;;
3388  ~*)
3389         if $test -f /bin/csh; then
3390                 /bin/csh -f -c "glob \$1"
3391                 failed=\$?
3392                 echo ""
3393                 exit \$failed
3394         else
3395                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3396                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3397                 if $test ! -d "\$dir"; then
3398                         me=\`basename \$0\`
3399                         echo "\$me: can't locate home directory for: \$name" >&2
3400                         exit 1
3401                 fi
3402                 case "\$1" in
3403                 */*)
3404                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3405                         ;;
3406                 *)
3407                         echo \$dir
3408                         ;;
3409                 esac
3410         fi
3411         ;;
3412 *)
3413         echo \$1
3414         ;;
3415 esac
3416 EOSS
3417 chmod +x filexp
3418 $eunicefix filexp
3419
3420 : now set up to get a file name
3421 cat <<EOS >getfile
3422 $startsh
3423 EOS
3424 cat <<'EOSC' >>getfile
3425 tilde=''
3426 fullpath=''
3427 already=''
3428 skip=''
3429 none_ok=''
3430 exp_file=''
3431 nopath_ok=''
3432 orig_rp="$rp"
3433 orig_dflt="$dflt"
3434 case "$gfpth" in
3435 '') gfpth='.' ;;
3436 esac
3437
3438 case "$fn" in
3439 *\(*)
3440         expr $fn : '.*(\(.*\)).*' | tr ',' $trnl >getfile.ok
3441         fn=`echo $fn | sed 's/(.*)//'`
3442         ;;
3443 esac
3444
3445 case "$fn" in
3446 *:*)
3447         loc_file=`expr $fn : '.*:\(.*\)'`
3448         fn=`expr $fn : '\(.*\):.*'`
3449         ;;
3450 esac
3451
3452 case "$fn" in
3453 *~*) tilde=true;;
3454 esac
3455 case "$fn" in
3456 */*) fullpath=true;;
3457 esac
3458 case "$fn" in
3459 *+*) skip=true;;
3460 esac
3461 case "$fn" in
3462 *n*) none_ok=true;;
3463 esac
3464 case "$fn" in
3465 *e*) exp_file=true;;
3466 esac
3467 case "$fn" in
3468 *p*) nopath_ok=true;;
3469 esac
3470
3471 case "$fn" in
3472 *f*) type='File';;
3473 *d*) type='Directory';;
3474 *l*) type='Locate';;
3475 esac
3476
3477 what="$type"
3478 case "$what" in
3479 Locate) what='File';;
3480 esac
3481
3482 case "$exp_file" in
3483 '')
3484         case "$d_portable" in
3485         "$define") ;;
3486         *) exp_file=true;;
3487         esac
3488         ;;
3489 esac
3490
3491 cd ..
3492 while test "$type"; do
3493         redo=''
3494         rp="$orig_rp"
3495         dflt="$orig_dflt"
3496         case "$tilde" in
3497         true) rp="$rp (~name ok)";;
3498         esac
3499         . UU/myread
3500         if test -f UU/getfile.ok && \
3501                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3502         then
3503                 value="$ans"
3504                 ansexp="$ans"
3505                 break
3506         fi
3507         case "$ans" in
3508         none)
3509                 value=''
3510                 ansexp=''
3511                 case "$none_ok" in
3512                 true) type='';;
3513                 esac
3514                 ;;
3515         *)
3516                 case "$tilde" in
3517                 '') value="$ans"
3518                         ansexp="$ans";;
3519                 *)
3520                         value=`UU/filexp $ans`
3521                         case $? in
3522                         0)
3523                                 if test "$ans" != "$value"; then
3524                                         echo "(That expands to $value on this system.)"
3525                                 fi
3526                                 ;;
3527                         *) value="$ans";;
3528                         esac
3529                         ansexp="$value"
3530                         case "$exp_file" in
3531                         '') value="$ans";;
3532                         esac
3533                         ;;
3534                 esac
3535                 case "$fullpath" in
3536                 true)
3537                         case "$ansexp" in
3538                         /*) value="$ansexp" ;;
3539                         [a-zA-Z]:/*) value="$ansexp" ;;
3540                         *)
3541                                 redo=true
3542                                 case "$already" in
3543                                 true)
3544                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
3545                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
3546                                         ;;
3547                                 *)
3548                                 echo "Please give a full path name, starting with slash." >&4
3549                                         case "$tilde" in
3550                                         true)
3551                                 echo "Note that using ~name is ok provided it expands well." >&4
3552                                                 already=true
3553                                                 ;;
3554                                         esac
3555                                 esac
3556                                 ;;
3557                         esac
3558                         ;;
3559                 esac
3560                 case "$redo" in
3561                 '')
3562                         case "$type" in
3563                         File)
3564                                 for fp in $gfpth; do
3565                                         if test "X$fp" = X.; then
3566                                             pf="$ansexp"
3567                                         else    
3568                                             pf="$fp/$ansexp"
3569                                         fi
3570                                         if test -f "$pf"; then
3571                                                 type=''
3572                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3573                                         then
3574                                                 echo "($value is not a plain file, but that's ok.)"
3575                                                 type=''
3576                                         fi
3577                                         if test X"$type" = X; then
3578                                             value="$pf"
3579                                             break
3580                                         fi
3581                                 done
3582                                 ;;
3583                         Directory)
3584                                 for fp in $gfpth; do
3585                                         if test "X$fp" = X.; then
3586                                             dir="$ans"
3587                                             direxp="$ansexp"
3588                                         else    
3589                                             dir="$fp/$ansexp"
3590                                             direxp="$fp/$ansexp"
3591                                         fi
3592                                         if test -d "$direxp"; then
3593                                                 type=''
3594                                                 value="$dir"
3595                                                 break
3596                                         fi
3597                                 done
3598                                 ;;
3599                         Locate)
3600                                 if test -d "$ansexp"; then
3601                                         echo "(Looking for $loc_file in directory $value.)"
3602                                         value="$value/$loc_file"
3603                                         ansexp="$ansexp/$loc_file"
3604                                 fi
3605                                 if test -f "$ansexp"; then
3606                                         type=''
3607                                 fi
3608                                 case "$nopath_ok" in
3609                                 true)   case "$value" in
3610                                         */*) ;;
3611                                         *)      echo "Assuming $value will be in people's path."
3612                                                 type=''
3613                                                 ;;
3614                                         esac
3615                                         ;;
3616                                 esac
3617                                 ;;
3618                         esac
3619
3620                         case "$skip" in
3621                         true) type='';
3622                         esac
3623
3624                         case "$type" in
3625                         '') ;;
3626                         *)
3627                                 if test "$fastread" = yes; then
3628                                         dflt=y
3629                                 else
3630                                         dflt=n
3631                                 fi
3632                                 rp="$what $value doesn't exist.  Use that name anyway?"
3633                                 . UU/myread
3634                                 dflt=''
3635                                 case "$ans" in
3636                                 y*) type='';;
3637                                 *) echo " ";;
3638                                 esac
3639                                 ;;
3640                         esac
3641                         ;;
3642                 esac
3643                 ;;
3644         esac
3645 done
3646 cd UU
3647 ans="$value"
3648 rp="$orig_rp"
3649 dflt="$orig_dflt"
3650 rm -f getfile.ok
3651 test "X$gfpthkeep" != Xy && gfpth=""
3652 EOSC
3653
3654 : What should the include directory be ?
3655 echo " "
3656 $echo $n "Hmm...  $c"
3657 dflt='/usr/include'
3658 incpath=''
3659 mips_type=''
3660 if $test -f /bin/mips && /bin/mips; then
3661         echo "Looks like a MIPS system..."
3662         $cat >usr.c <<'EOCP'
3663 #ifdef SYSTYPE_BSD43
3664 /bsd43
3665 #endif
3666 EOCP
3667         if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
3668                 dflt='/bsd43/usr/include'
3669                 incpath='/bsd43'
3670                 mips_type='BSD 4.3'
3671         else
3672                 mips_type='System V'
3673         fi
3674         $rm -f usr.c usr.out
3675         echo "and you're compiling with the $mips_type compiler and libraries."
3676         xxx_prompt=y
3677         echo "exit 0" >mips
3678 else
3679         echo "Doesn't look like a MIPS system."
3680         xxx_prompt=n
3681         echo "exit 1" >mips
3682 fi
3683 chmod +x mips
3684 $eunicefix mips
3685 case "$usrinc" in
3686 '') ;;
3687 *) dflt="$usrinc";;
3688 esac
3689 case "$xxx_prompt" in
3690 y)      fn=d/
3691         echo " "
3692         rp='Where are the include files you want to use?'
3693         . ./getfile
3694         usrinc="$ans"
3695         ;;
3696 *)      usrinc="$dflt"
3697         ;;
3698 esac
3699
3700 : Set private lib path
3701 case "$plibpth" in
3702 '') if ./mips; then
3703                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
3704         fi;;
3705 esac
3706 case "$libpth" in
3707 ' ') dlist='';;
3708 '') dlist="$loclibpth $plibpth $glibpth";;
3709 *) dlist="$libpth";;
3710 esac
3711
3712 : Now check and see which directories actually exist, avoiding duplicates
3713 libpth=''
3714 for xxx in $dlist
3715 do
3716     if $test -d $xxx; then
3717                 case " $libpth " in
3718                 *" $xxx "*) ;;
3719                 *) libpth="$libpth $xxx";;
3720                 esac
3721     fi
3722 done
3723 $cat <<'EOM'
3724
3725 Some systems have incompatible or broken versions of libraries.  Among
3726 the directories listed in the question below, please remove any you
3727 know not to be holding relevant libraries, and add any that are needed.
3728 Say "none" for none.
3729
3730 EOM
3731 case "$libpth" in
3732 '') dflt='none';;
3733 *)
3734         set X $libpth
3735         shift
3736         dflt=${1+"$@"}
3737         ;;
3738 esac
3739 rp="Directories to use for library searches?"
3740 . ./myread
3741 case "$ans" in
3742 none) libpth=' ';;
3743 *) libpth="$ans";;
3744 esac
3745
3746 : compute shared library extension
3747 case "$so" in
3748 '')
3749         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
3750                 dflt='sl'
3751         else
3752                 dflt='so'
3753         fi
3754         ;;
3755 *) dflt="$so";;
3756 esac
3757 $cat <<EOM
3758
3759 On some systems, shared libraries may be available.  Answer 'none' if
3760 you want to suppress searching of shared libraries for the remainder
3761 of this configuration.
3762
3763 EOM
3764 rp='What is the file extension used for shared libraries?'
3765 . ./myread
3766 so="$ans"
3767
3768 : Define several unixisms.
3769 : Hints files or command line option can be used to override them.
3770 : The convoluted testing is in case hints files set either the old
3771 : or the new name.
3772 case "$_exe" in
3773 '')     case "$exe_ext" in
3774     '') ;;
3775         *)      _exe="$exe_ext" ;;
3776         esac
3777         ;;
3778 esac
3779 case "$_a" in
3780 '')     case "$lib_ext" in
3781     '') _a='.a';;
3782         *)      _a="$lib_ext" ;;
3783         esac
3784         ;;
3785 esac
3786 case "$_o" in
3787 '') case "$obj_ext" in
3788         '')     _o='.o';;
3789         *)      _o="$obj_ext";;
3790         esac
3791         ;;
3792 esac
3793 case "$p_" in
3794 '') case "$path_sep" in
3795         '')     p_=':';;
3796         *)      p_="$path_sep";;
3797         esac
3798         ;;
3799 esac
3800 exe_ext=$_exe
3801 lib_ext=$_a
3802 obj_ext=$_o
3803 path_sep=$p_
3804
3805 : Which makefile gets called first.  This is used by make depend.
3806 case "$firstmakefile" in
3807 '') firstmakefile='makefile';;
3808 esac
3809
3810 case "$usesocks" in
3811 $define|true|[yY]*)     dflt='y';;
3812 *) dflt='n';;
3813 esac
3814 cat <<EOM
3815
3816 Perl can be built to use the SOCKS proxy protocol library.  To do so,
3817 Configure must be run with -Dusesocks.
3818
3819 If this doesn't make any sense to you, just accept the default '$dflt'.
3820 EOM
3821 rp='Build Perl for SOCKS?'
3822 . ./myread
3823 case "$ans" in
3824 y|Y)    val="$define" ;;     
3825 *)      val="$undef" ;;
3826 esac
3827 set usesocks
3828 eval $setvar
3829
3830 : Looking for optional libraries
3831 echo " "
3832 echo "Checking for optional libraries..." >&4
3833 case "$libs" in
3834 ' '|'') dflt='';;
3835 *) dflt="$libs";;
3836 esac
3837 case "$libswanted" in
3838 '') libswanted='c_s';;
3839 esac
3840 case "$usesocks" in
3841 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
3842 esac
3843 libsfound=''
3844 libsfiles=''
3845 libsdirs=''
3846 libspath=''
3847 for thisdir in $libpth $xlibpth; do
3848   test -d $thisdir && libspath="$libspath $thisdir"
3849 done
3850 for thislib in $libswanted; do
3851         for thisdir in $libspath; do
3852             xxx=''
3853             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
3854                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|tail -1`
3855                 $test -f "$xxx" && eval $libscheck
3856                 $test -f "$xxx" && libstyle=shared
3857             fi
3858             if test ! -f "$xxx"; then
3859                 xxx=$thisdir/lib$thislib.$so
3860                 $test -f "$xxx" && eval $libscheck
3861                 $test -f "$xxx" && libstyle=shared
3862             fi  
3863             if test ! -f "$xxx"; then
3864                 xxx=$thisdir/lib$thislib$_a
3865                 $test -f "$xxx" && eval $libscheck
3866                 $test -f "$xxx" && libstyle=static
3867             fi
3868             if test ! -f "$xxx"; then
3869                 xxx=$thisdir/$thislib$_a
3870                 $test -f "$xxx" && eval $libscheck
3871                 $test -f "$xxx" && libstyle=static
3872             fi
3873             if test ! -f "$xxx"; then
3874                 xxx=$thisdir/lib${thislib}_s$_a
3875                 $test -f "$xxx" && eval $libscheck
3876                 $test -f "$xxx" && libstyle=static
3877                 $test -f "$xxx" && thislib=${thislib}_s
3878             fi
3879             if test ! -f "$xxx"; then
3880                 xxx=$thisdir/Slib$thislib$_a
3881                 $test -f "$xxx" && eval $libscheck
3882                 $test -f "$xxx" && libstyle=static
3883             fi
3884             if $test -f "$xxx"; then
3885                 case "$libstyle" in
3886                 shared) echo "Found -l$thislib (shared)." ;;
3887                 static) echo "Found -l$thislib." ;;
3888                 *)      echo "Found -l$thislib ($libstyle)." ;;
3889                 esac
3890                 case " $dflt " in
3891                 *"-l$thislib "*);;
3892                 *) dflt="$dflt -l$thislib"
3893                    libsfound="$libsfound $xxx"
3894                    yyy=`basename $xxx`
3895                    libsfiles="$libsfiles $yyy"
3896                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
3897                    case " $libsdirs " in
3898                    *" $yyy "*) ;;
3899                    *) libsdirs="$libsdirs $yyy" ;;
3900                    esac
3901                    ;;
3902                 esac
3903                 break
3904             fi  
3905         done
3906         if $test ! -f "$xxx"; then
3907             echo "No -l$thislib."
3908         fi
3909 done
3910 set X $dflt
3911 shift
3912 dflt="$*"
3913 case "$libs" in
3914 '') dflt="$dflt";;
3915 *) dflt="$libs";;
3916 esac
3917 case "$dflt" in
3918 ' '|'') dflt='none';;
3919 esac
3920
3921 $cat <<EOM
3922
3923 In order to compile $package on your machine, a number of libraries
3924 are usually needed.  Include any other special libraries here as well.
3925 Say "none" for none.  The default list is almost always right.
3926 EOM
3927
3928 echo " "
3929 rp="What libraries to use?"
3930 . ./myread
3931 case "$ans" in
3932 none) libs=' ';;
3933 *) libs="$ans";;
3934 esac
3935
3936 : determine optimization, if desired, or use for debug flag also
3937 case "$optimize" in
3938 ' '|$undef) dflt='none';;
3939 '') dflt='-O';;
3940 *) dflt="$optimize";;
3941 esac
3942 $cat <<EOH
3943
3944 By default, $package compiles with the -O flag to use the optimizer.
3945 Alternately, you might want to use the symbolic debugger, which uses
3946 the -g flag (on traditional Unix systems).  Either flag can be
3947 specified here.  To use neither flag, specify the word "none".
3948
3949 EOH
3950 rp="What optimizer/debugger flag should be used?"
3951 . ./myread
3952 optimize="$ans"
3953 case "$optimize" in
3954 'none') optimize=" ";;
3955 esac
3956
3957 dflt=''
3958 : We will not override a previous value, but we might want to
3959 : augment a hint file
3960 case "$hint" in
3961 default|recommended)
3962         case "$gccversion" in
3963         1*) dflt='-fpcc-struct-return' ;;
3964         esac
3965         case "$optimize" in
3966         *-g*) dflt="$dflt -DDEBUGGING";;
3967         esac
3968         case "$gccversion" in
3969         2*) if test -d /etc/conf/kconfig.d &&
3970                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
3971                 then
3972                         dflt="$dflt -posix"
3973                 fi
3974                 ;;
3975         esac
3976         case "$gccversion" in
3977         1*) ;;
3978         2.[0-8]*) ;;
3979         ?*)     echo " "
3980                 echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
3981                 echo 'int main(void) { return 0; }' > gcctest.c
3982                 if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
3983                         echo "Yes, it does." 2>&1
3984                         case "$ccflags" in
3985                         *strict-aliasing*) 
3986                                 echo "Leaving current flags $ccflags alone." 2>&1
3987                                 ;;
3988                         *) dflt="$dflt -fno-strict-aliasing" ;;
3989                         esac
3990                 else
3991                         echo "Nope, it doesn't, but that's ok." 2>&1
3992                 fi
3993                 ;;
3994         esac
3995         ;;
3996 esac
3997
3998 case "$mips_type" in
3999 *BSD*|'') inclwanted="$locincpth $usrinc";;
4000 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
4001 esac
4002 for thisincl in $inclwanted; do
4003         if $test -d $thisincl; then
4004                 if $test x$thisincl != x$usrinc; then
4005                         case "$dflt" in
4006                         *$thisincl*);;
4007                         *) dflt="$dflt -I$thisincl";;
4008                         esac
4009                 fi
4010         fi
4011 done
4012
4013 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
4014         xxx=true;
4015 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
4016         xxx=true;
4017 else
4018         xxx=false;
4019 fi;
4020 if $xxx; then
4021         case "$dflt" in
4022         *$2*);;
4023         *) dflt="$dflt -D$2";;
4024         esac;
4025 fi'
4026
4027 set signal.h LANGUAGE_C; eval $inctest
4028
4029 case "$usesocks" in
4030 $define)
4031         ccflags="$ccflags -DSOCKS"
4032         ;;
4033 esac
4034
4035 case "$hint" in
4036 default|recommended) dflt="$ccflags $dflt" ;;
4037 *) dflt="$ccflags";;
4038 esac
4039
4040 case "$dflt" in
4041 ''|' ') dflt=none;;
4042 esac
4043 $cat <<EOH
4044
4045 Your C compiler may want other flags.  For this question you should include
4046 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
4047 but you should NOT include libraries or ld flags like -lwhatever.  If you
4048 want $package to honor its debug switch, you should include -DDEBUGGING here.
4049 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
4050
4051 To use no flags, specify the word "none".
4052
4053 EOH
4054 set X $dflt
4055 shift
4056 dflt=${1+"$@"}
4057 rp="Any additional cc flags?"
4058 . ./myread
4059 case "$ans" in
4060 none) ccflags='';;
4061 *) ccflags="$ans";;
4062 esac
4063
4064 : the following weeds options from ccflags that are of no interest to cpp
4065 cppflags="$ccflags"
4066 case "$gccversion" in
4067 1*) cppflags="$cppflags -D__GNUC__"
4068 esac
4069 case "$mips_type" in
4070 '');;
4071 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
4072 esac
4073 case "$cppflags" in
4074 '');;
4075 *)
4076         echo " "
4077         echo "Let me guess what the preprocessor flags are..." >&4
4078         set X $cppflags
4079         shift
4080         cppflags=''
4081         $cat >cpp.c <<'EOM'
4082 #define BLURFL foo
4083
4084 BLURFL xx LFRULB
4085 EOM
4086         previous=''
4087         for flag in $*
4088         do
4089                 case "$flag" in
4090                 -*) ftry="$flag";;
4091                 *) ftry="$previous $flag";;
4092                 esac
4093                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
4094                         >cpp1.out 2>/dev/null && \
4095                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
4096                         >cpp2.out 2>/dev/null && \
4097                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
4098                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
4099                 then
4100                         cppflags="$cppflags $ftry"
4101                         previous=''
4102                 else
4103                         previous="$flag"
4104                 fi
4105         done
4106         set X $cppflags
4107         shift
4108         cppflags=${1+"$@"}
4109         case "$cppflags" in
4110         *-*)  echo "They appear to be: $cppflags";;
4111         esac
4112         $rm -f cpp.c cpp?.out
4113         ;;
4114 esac
4115
4116 : flags used in final linking phase
4117 case "$ldflags" in
4118 '') if ./venix; then
4119                 dflt='-i -z'
4120         else
4121                 dflt=''
4122         fi
4123         case "$ccflags" in
4124         *-posix*) dflt="$dflt -posix" ;;
4125         esac
4126         ;;
4127 *) dflt="$ldflags";;
4128 esac
4129
4130 : Try to guess additional flags to pick up local libraries.
4131 for thislibdir in $libpth; do
4132         case " $loclibpth " in
4133         *" $thislibdir "*)
4134                 case "$dflt " in 
4135                 *"-L$thislibdir "*) ;;
4136                 *)  dflt="$dflt -L$thislibdir" ;;
4137                 esac
4138                 ;;
4139         esac
4140 done
4141
4142 case "$dflt" in
4143 '') dflt='none' ;;
4144 esac
4145
4146 $cat <<EOH
4147
4148 Your C linker may need flags.  For this question you should
4149 include -L/whatever and any other flags used by the C linker, but you
4150 should NOT include libraries like -lwhatever.
4151
4152 Make sure you include the appropriate -L/path flags if your C linker
4153 does not normally search all of the directories you specified above,
4154 namely
4155         $libpth
4156 To use no flags, specify the word "none".
4157
4158 EOH
4159
4160 rp="Any additional ld flags (NOT including libraries)?"
4161 . ./myread
4162 case "$ans" in
4163 none) ldflags='';;
4164 *) ldflags="$ans";;
4165 esac
4166 rmlist="$rmlist pdp11"
4167
4168 : coherency check
4169 echo " "
4170 echo "Checking your choice of C compiler and flags for coherency..." >&4
4171 $cat > try.c <<'EOF'
4172 #include <stdio.h>
4173 int main() { printf("Ok\n"); exit(0); }
4174 EOF
4175 set X $cc $optimize $ccflags -o try $ldflags try.c $libs
4176 shift
4177 $cat >try.msg <<'EOM'
4178 I've tried to compile and run the following simple program:
4179
4180 EOM
4181 $cat try.c >> try.msg
4182
4183 $cat >> try.msg <<EOM
4184
4185 I used the command:
4186
4187         $*
4188         ./try
4189
4190 and I got the following output:
4191
4192 EOM
4193 dflt=y
4194 if sh -c "$cc $optimize $ccflags -o try $ldflags try.c $libs" >>try.msg 2>&1; then
4195         if sh -c './try' >>try.msg 2>&1; then
4196                 xxx=`./try`
4197                 case "$xxx" in
4198                 "Ok") dflt=n ;;
4199                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
4200                         case " $libs " in
4201                         *" -lsfio "*)
4202                                 cat >> try.msg <<'EOQS'
4203 If $libs contains -lsfio, and sfio is mis-configured, then it
4204 sometimes (apparently) runs and exits with a 0 status, but with no
4205 output!  It may have to do with sfio's use of _exit vs. exit.
4206
4207 EOQS
4208                                 rp="You have a big problem.  Shall I abort Configure"
4209                                 dflt=y
4210                                 ;;
4211                         esac
4212                         ;;
4213                 esac
4214         else
4215                 echo "The program compiled OK, but exited with status $?." >>try.msg
4216                 rp="You have a problem.  Shall I abort Configure"
4217                 dflt=y
4218         fi
4219 else
4220         echo "I can't compile the test program." >>try.msg
4221         rp="You have a BIG problem.  Shall I abort Configure"
4222         dflt=y
4223 fi
4224 case "$dflt" in
4225 y)
4226         $cat try.msg >&4
4227         case "$knowitall" in
4228         '')
4229                 echo "(The supplied flags or libraries might be incorrect.)"
4230                 ;;
4231         *) dflt=n;;
4232         esac
4233         echo " "
4234         . ./myread
4235         case "$ans" in
4236         n*|N*) ;;
4237         *)      echo "Ok.  Stopping Configure." >&4
4238                 exit 1
4239                 ;;
4240         esac
4241         ;;
4242 n) echo "OK, that should do.";;
4243 esac
4244 $rm -f try try.* core
4245
4246 : define an is-a-typedef? function
4247 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
4248 case "$inclist" in
4249 "") inclist="sys/types.h";;
4250 esac;
4251 eval "varval=\$$var";
4252 case "$varval" in
4253 "")
4254         $rm -f temp.c;
4255         for inc in $inclist; do
4256                 echo "#include <$inc>" >>temp.c;
4257         done;
4258         echo "#ifdef $type" >> temp.c;
4259         echo "printf(\"We have $type\");" >> temp.c;
4260         echo "#endif" >> temp.c;
4261         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
4262         if $contains $type temp.E >/dev/null 2>&1; then
4263                 eval "$var=\$type";
4264         else
4265                 eval "$var=\$def";
4266         fi;
4267         $rm -f temp.?;;
4268 *) eval "$var=\$varval";;
4269 esac'
4270
4271 : define an is-a-typedef? function that prompts if the type is not available.
4272 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
4273 case "$inclist" in
4274 "") inclist="sys/types.h";;
4275 esac;
4276 eval "varval=\$$var";
4277 case "$varval" in
4278 "")
4279         $rm -f temp.c;
4280         for inc in $inclist; do
4281                 echo "#include <$inc>" >>temp.c;
4282         done;
4283         echo "#ifdef $type" >> temp.c;
4284         echo "printf(\"We have $type\");" >> temp.c;
4285         echo "#endif" >> temp.c;
4286         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
4287         echo " " ;
4288         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
4289         if $contains $type temp.E >/dev/null 2>&1; then
4290                 echo "$type found." >&4;
4291                 eval "$var=\$type";
4292         else
4293                 echo "$type NOT found." >&4;
4294                 dflt="$def";
4295                 . ./myread ;
4296                 eval "$var=\$ans";
4297         fi;
4298         $rm -f temp.?;;
4299 *) eval "$var=\$varval";;
4300 esac'
4301
4302 : define a shorthand compile call
4303 compile='
4304 mc_file=$1;
4305 shift;
4306 $cc $optimize $ccflags $ldflags -o ${mc_file} $* ${mc_file}.c $libs > /dev/null 2>&1;'
4307 : define a shorthand compile call for compilations that should be ok.
4308 compile_ok='
4309 mc_file=$1;
4310 shift;
4311 $cc $optimize $ccflags $ldflags -o ${mc_file} $* ${mc_file}.c $libs;'
4312
4313 : check for lengths of integral types
4314 echo " "
4315 case "$intsize" in
4316 '')
4317         echo "Checking to see how big your integers are..." >&4
4318         $cat >intsize.c <<'EOCP'
4319 #include <stdio.h>
4320 int main()
4321 {
4322         printf("intsize=%d;\n", (int)sizeof(int));
4323         printf("longsize=%d;\n", (int)sizeof(long));
4324         printf("shortsize=%d;\n", (int)sizeof(short));
4325         exit(0);
4326 }
4327 EOCP
4328         set intsize
4329         if eval $compile_ok && ./intsize > /dev/null; then
4330                 eval `./intsize`
4331                 echo "Your integers are $intsize bytes long."
4332                 echo "Your long integers are $longsize bytes long."
4333                 echo "Your short integers are $shortsize bytes long."
4334         else
4335                 $cat >&4 <<EOM
4336 !
4337 Help! I can't compile and run the intsize test program: please enlighten me!
4338 (This is probably a misconfiguration in your system or libraries, and
4339 you really ought to fix it.  Still, I'll try anyway.)
4340 !
4341 EOM
4342                 dflt=4
4343                 rp="What is the size of an integer (in bytes)?"
4344                 . ./myread
4345                 intsize="$ans"
4346                 dflt=$intsize
4347                 rp="What is the size of a long integer (in bytes)?"
4348                 . ./myread
4349                 longsize="$ans"
4350                 dflt=2
4351                 rp="What is the size of a short integer (in bytes)?"
4352                 . ./myread
4353                 shortsize="$ans"
4354         fi
4355         ;;
4356 esac
4357 $rm -f intsize intsize.*
4358
4359 : see what type lseek is declared as in the kernel
4360 rp="What is the type used for lseek's offset on this system?"
4361 set off_t lseektype long stdio.h sys/types.h
4362 eval $typedef_ask
4363
4364 echo " "
4365 echo "Checking to see how big your file offsets are..." >&4
4366 $cat >try.c <<EOCP
4367 #include <sys/types.h>
4368 #include <stdio.h>
4369 int main()
4370 {
4371     printf("%d\n", (int)sizeof($lseektype));
4372     return(0); 
4373 }
4374 EOCP
4375 set try
4376 if eval $compile_ok; then
4377         lseeksize=`./try`
4378         echo "Your file offsets are $lseeksize bytes long."
4379 else
4380         dflt=$longsize
4381         echo " "
4382         echo "(I can't seem to compile the test program.  Guessing...)"
4383         rp="What is the size of your file offsets (in bytes)?"
4384         . ./myread
4385         lseeksize="$ans"
4386 fi
4387 $rm -f try.c try
4388
4389 : see what type file positions are declared as in the library
4390 rp="What is the type for file position used by fsetpos()?"
4391 set fpos_t fpostype long stdio.h sys/types.h
4392 eval $typedef_ask
4393
4394 echo " "
4395 case "$fpostype" in
4396 *_t) zzz="$fpostype"    ;;
4397 *)   zzz="fpos_t"       ;;
4398 esac
4399 echo "Checking the size of $zzz..." >&4 
4400 cat > try.c <<EOCP
4401 #include <sys/types.h>
4402 #include <stdio.h>
4403 int main() {
4404     printf("%d\n", (int)sizeof($fpostype));
4405     exit(0);
4406 }
4407 EOCP
4408 set try
4409 if eval $compile_ok; then
4410         yyy=`./try`
4411         case "$yyy" in
4412         '')     fpossize=4
4413                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
4414                 ;;
4415         *)      fpossize=$yyy
4416                 echo "Your $zzz is $fpossize bytes long."
4417                 ;;
4418         esac
4419 else
4420         dflt="$longsize"
4421         echo " " >&4
4422         echo "(I can't compile the test program.  Guessing...)" >&4
4423         rp="What is the size of your file positions (in bytes)?"
4424         . ./myread
4425         fpossize="$ans"
4426 fi
4427
4428
4429
4430 # Backward compatibility (uselfs is deprecated).
4431 case "$uselfs" in
4432 "$define"|true|[yY]*)
4433         cat <<EOM >&4
4434
4435 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
4436 EOM
4437         uselargefiles="$define"
4438         ;;
4439 esac                          
4440
4441 case "$lseeksize:$fpossize" in
4442 8:8) cat <<EOM
4443
4444 You can have files larger than 2 gigabytes.
4445 EOM
4446    val="$define" ;;
4447 *)    case "$uselargefiles" in
4448    "$undef"|false|[nN]*) dflt='n' ;;
4449    *)   dflt='y' ;;
4450    esac
4451    cat <<EOM
4452
4453 Perl can be built to understand large files (files larger than 2 gigabytes)
4454 on some systems.  To do so, Configure can be run with -Duselargefiles.
4455
4456 If this doesn't make any sense to you, just accept the default '$dflt'.
4457 EOM
4458    rp='Try to understand large files, if available?'
4459    . ./myread
4460    case "$ans" in
4461    y|Y)         val="$define" ;;
4462    *)           val="$undef"  ;;
4463    esac
4464    ;;
4465 esac
4466 set uselargefiles
4467 eval $setvar
4468 case "$uselargefiles" in
4469 "$define")
4470 : Look for a hint-file generated 'call-back-unit'.  If the
4471 : user has specified that a large files perl is to be built,
4472 : we may need to set or change some other defaults.
4473         if $test -f uselargefiles.cbu; then
4474                 echo "Your platform has some specific hints for large file builds, using them..."
4475                 . ./uselargefiles.cbu
4476                 echo " "
4477                 echo "Rechecking to see how big your file offsets are..." >&4
4478                 $cat >try.c <<EOCP
4479 #include <sys/types.h>
4480 #include <stdio.h>
4481 int main()
4482 {
4483     printf("%d\n", (int)sizeof($lseektype));
4484     return(0); 
4485 }
4486 EOCP
4487                 set try
4488                 if eval $compile_ok; then
4489                         lseeksize=`./try`
4490                         $echo "Your file offsets are now $lseeksize bytes long."
4491                 else
4492                         dflt="$lseeksize"
4493                         echo " "
4494                         echo "(I can't seem to compile the test program.  Guessing...)"
4495                         rp="What is the size of your file offsets (in bytes)?"
4496                         . ./myread
4497                         lseeksize="$ans"
4498                 fi
4499                 case "$fpostype" in
4500                 *_t) zzz="$fpostype"    ;;
4501                 *)   zzz="fpos_t"       ;;
4502                 esac
4503                 $echo $n "Rechecking the size of $zzz...$c" >&4 
4504                 $cat > try.c <<EOCP
4505 #include <sys/types.h>
4506 #include <stdio.h>
4507 int main() {
4508     printf("%d\n", (int)sizeof($fpostype));
4509     exit(0);
4510 }
4511 EOCP
4512                 set try
4513                 if eval $compile_ok; then
4514                         yyy=`./try`
4515                         dflt="$lseeksize"
4516                         case "$yyy" in
4517                         '')     echo " "
4518                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
4519                                 ;;
4520                         *)      fpossize=$yyy
4521                                 echo " $fpossize bytes." >&4
4522                                 ;;
4523                         esac
4524                 else
4525                         dflt="$fpossize"
4526                         echo " "
4527                         echo "(I can't compile the test program.  Guessing...)" >&4
4528                         rp="What is the size of your file positions (in bytes)?"
4529                         . ./myread
4530                         fpossize="$ans"
4531                 fi
4532                 $rm -f try.c try
4533         fi
4534         ;;
4535 esac
4536
4537
4538 case "$usemorebits" in
4539 "$define"|true|[yY]*)
4540         use64bitint="$define"
4541         uselongdouble="$define"
4542         usemorebits="$define"
4543         ;;
4544 *)      usemorebits="$undef"
4545         ;;
4546 esac
4547
4548
4549 case "$uselonglong" in
4550 "$define"|true|[yY]*)
4551         cat <<EOM >&4
4552
4553 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
4554 EOM
4555         use64bitint="$define"
4556         ;;
4557 esac                          
4558 case "$use64bits" in
4559 "$define"|true|[yY]*)
4560         cat <<EOM >&4
4561
4562 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
4563 EOM
4564         use64bitint="$define"
4565         ;;
4566 esac                          
4567 case "$use64bitints" in
4568 "$define"|true|[yY]*)
4569         cat <<EOM >&4
4570
4571 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
4572 EOM
4573         use64bitint="$define"
4574         ;;
4575 esac                          
4576 case "$use64bitsint" in
4577 "$define"|true|[yY]*)
4578         cat <<EOM >&4
4579
4580 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
4581 EOM
4582         use64bitint="$define"
4583         ;;
4584 esac                          
4585 case "$uselonglongs" in
4586 "$define"|true|[yY]*)
4587         cat <<EOM >&4
4588
4589 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
4590 EOM
4591         use64bitint="$define"
4592         ;;
4593 esac                          
4594 case "$use64bitsall" in
4595 "$define"|true|[yY]*)
4596         cat <<EOM >&4
4597
4598 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
4599 EOM
4600         use64bitall="$define"
4601         ;;
4602 esac                          
4603
4604 case "$ccflags" in
4605 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
4606 esac
4607 case "$use64bitall" in
4608 "$define"|true|[yY]*) use64bitint="$define" ;;
4609 esac
4610
4611 case "$longsize" in
4612 8) cat <<EOM
4613
4614 You have natively 64-bit long integers.
4615 EOM
4616    val="$define"
4617    ;;
4618 *) case "$use64bitint" in
4619    "$define"|true|[yY]*) dflt='y';;
4620    *) dflt='n';;
4621    esac
4622    cat <<EOM
4623
4624 Perl can be built to take advantage of 64-bit integer types
4625 on some systems.  To do so, Configure can be run with -Duse64bitint.
4626 Choosing this option will most probably introduce binary incompatibilities.
4627
4628 If this doesn't make any sense to you, just accept the default '$dflt'.
4629 EOM
4630    rp='Try to use 64-bit integers, if available?'
4631    . ./myread
4632    case "$ans" in
4633    [yY]*) val="$define" ;;
4634    *)     val="$undef"  ;;
4635    esac
4636    ;;
4637 esac
4638 set use64bitint
4639 eval $setvar
4640
4641 case "$use64bitall" in
4642 "$define"|true|[yY]*) dflt='y' ;;
4643 *) case "$longsize" in
4644    8) dflt='y' ;;
4645    *) dflt='n' ;;
4646    esac
4647    ;;
4648 esac    
4649 cat <<EOM
4650
4651 You may also choose to try maximal 64-bitness.  It means using as much
4652 64-bitness as possible on the platform.  This in turn means even more
4653 binary incompatibilities.  On the other hand, your platform may not
4654 have any more 64-bitness available than what you already have chosen.
4655
4656 If this doesn't make any sense to you, just accept the default '$dflt'.
4657 EOM
4658 rp='Try to use maximal 64-bit support, if available?'
4659 . ./myread
4660 case "$ans" in
4661 [yY]*) val="$define" ;;
4662 *)     val="$undef"  ;;
4663 esac
4664 set use64bitall
4665 eval $setvar
4666 case "$use64bitall" in
4667 "$define")
4668         case "$use64bitint" in
4669         "$undef")
4670                 cat <<EOM
4671
4672 Since you have chosen a maximally 64-bit build, I'm also turning on
4673 the use of 64-bit integers.
4674 EOM
4675                 use64bitint="$define" ;;
4676         esac
4677         ;;
4678 esac
4679
4680 case "$use64bitint" in
4681 "$define"|true|[yY]*)
4682 : Look for a hint-file generated 'call-back-unit'.  If the
4683 : user has specified that a 64-bit perl is to be built,
4684 : we may need to set or change some other defaults.
4685         if $test -f use64bitint.cbu; then
4686                 echo "Your platform has some specific hints for 64-bit integers, using them..."
4687                 . ./use64bitint.cbu
4688         fi
4689         case "$longsize" in
4690         4) case "$archname64" in
4691            '') archname64=64int ;;
4692            esac
4693            ;;
4694         esac
4695         ;;
4696 esac
4697
4698 case "$use64bitall" in
4699 "$define"|true|[yY]*)
4700 : Look for a hint-file generated 'call-back-unit'.  If the
4701 : user has specified that a maximally 64-bit perl is to be built,
4702 : we may need to set or change some other defaults.
4703         if $test -f use64bitall.cbu; then
4704                 echo "Your platform has some specific hints for 64-bit builds, using them..."
4705                 . ./use64bitall.cbu
4706         fi
4707         case "$longsize" in
4708         4) case "$archname64" in
4709            ''|64int) archname64=64all ;;
4710            esac
4711            ;;
4712         esac
4713         ;;
4714 esac
4715
4716 : determine the architecture name
4717 echo " "
4718 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
4719         tarch=`arch`"-$osname"
4720 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
4721         if uname -m > tmparch 2>&1 ; then
4722                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
4723                         -e 's/$/'"-$osname/" tmparch`
4724         else
4725                 tarch="$osname"
4726         fi
4727         $rm -f tmparch
4728 else
4729         tarch="$osname"
4730 fi
4731 case "$myarchname" in
4732 ''|"$tarch") ;;
4733 *)
4734         echo "(Your architecture name used to be $myarchname.)"
4735         archname=''
4736         ;;
4737 esac
4738 myarchname="$tarch"
4739 case "$archname" in
4740 '') dflt="$tarch";;
4741 *) dflt="$archname";;
4742 esac
4743 rp='What is your architecture name'
4744 . ./myread
4745 archname="$ans"
4746 case "$usethreads" in
4747 $define)
4748         echo "Threads selected." >&4
4749         case "$archname" in
4750         *-thread*) echo "...and architecture name already has -thread." >&4
4751                 ;;
4752         *)      archname="$archname-thread"
4753                 echo "...setting architecture name to $archname." >&4
4754                 ;;
4755         esac
4756         ;;
4757 esac
4758 case "$usemultiplicity" in
4759 $define)
4760         echo "Multiplicity selected." >&4
4761         case "$archname" in
4762         *-multi*) echo "...and architecture name already has -multi." >&4
4763                 ;;
4764         *)      archname="$archname-multi"
4765                 echo "...setting architecture name to $archname." >&4
4766                 ;;
4767         esac
4768         ;;
4769 esac
4770 case "$use64bitint" in
4771 $define)
4772         case "$archname64" in
4773         '')
4774                 ;;
4775         *)
4776                 case "$archname" in
4777                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
4778                         ;;
4779                 *)      archname="$archname-$archname64"
4780                         echo "...setting architecture name to $archname." >&4
4781                         ;;
4782                 esac
4783                 ;;
4784         esac
4785 esac
4786
4787 : determine root of directory hierarchy where package will be installed.
4788 case "$prefix" in
4789 '')
4790         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
4791         ;;
4792 *)
4793         dflt="$prefix"
4794         ;;
4795 esac
4796 $cat <<EOM
4797
4798 By default, $package will be installed in $dflt/bin, manual pages
4799 under $dflt/man, etc..., i.e. with $dflt as prefix for all
4800 installation directories. Typically this is something like /usr/local.
4801 If you wish to have binaries under /usr/bin but other parts of the
4802 installation under /usr/local, that's ok: you will be prompted
4803 separately for each of the installation directories, the prefix being
4804 only used to set the defaults.
4805
4806 EOM
4807 fn=d~
4808 rp='Installation prefix to use?'
4809 . ./getfile
4810 oldprefix=''
4811 case "$prefix" in
4812 '') ;;
4813 *)
4814         case "$ans" in
4815         "$prefix") ;;
4816         *) oldprefix="$prefix";;
4817         esac
4818         ;;
4819 esac
4820 prefix="$ans"
4821 prefixexp="$ansexp"
4822
4823 : is AFS running?
4824 echo " "
4825 case "$afs" in
4826 $define|true)   afs=true ;;
4827 $undef|false)   afs=false ;;
4828 *)      if test -d /afs; then
4829                 afs=true
4830         else
4831                 afs=false
4832         fi
4833         ;;
4834 esac
4835 if $afs; then
4836         echo "AFS may be running... I'll be extra cautious then..." >&4
4837 else
4838         echo "AFS does not seem to be running..." >&4
4839 fi
4840
4841 : determine installation prefix for where package is to be installed.
4842 if $afs; then 
4843 $cat <<EOM
4844
4845 Since you are running AFS, I need to distinguish the directory in which
4846 files will reside from the directory in which they are installed (and from
4847 which they are presumably copied to the former directory by occult means).
4848
4849 EOM
4850         case "$installprefix" in
4851         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
4852         *) dflt="$installprefix";;
4853         esac
4854 else
4855 $cat <<EOM
4856
4857 In some special cases, particularly when building $package for distribution,
4858 it is convenient to distinguish between the directory in which files should 
4859 be installed from the directory ($prefix) in which they 
4860 will eventually reside.  For most users, these two directories are the same.
4861
4862 EOM
4863         case "$installprefix" in
4864         '') dflt=$prefix ;;
4865         *) dflt=$installprefix;;
4866         esac
4867 fi
4868 fn=d~
4869 rp='What installation prefix should I use for installing files?'
4870 . ./getfile
4871 installprefix="$ans"
4872 installprefixexp="$ansexp"
4873
4874 : set the prefixit variable, to compute a suitable default value
4875 prefixit='case "$3" in
4876 ""|none)
4877         case "$oldprefix" in
4878         "") eval "$1=\"\$$2\"";;
4879         *)
4880                 case "$3" in
4881                 "") eval "$1=";;
4882                 none)
4883                         eval "tp=\"\$$2\"";
4884                         case "$tp" in
4885                         ""|" ") eval "$1=\"\$$2\"";;
4886                         *) eval "$1=";;
4887                         esac;;
4888                 esac;;
4889         esac;;
4890 *)
4891         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
4892         case "$tp" in
4893         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
4894         /*-$oldprefix/*|\~*-$oldprefix/*)
4895                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
4896         *) eval "$1=\"\$$2\"";;
4897         esac;;
4898 esac'
4899
4900
4901 : get the patchlevel
4902 echo " "
4903 echo "Getting the current patchlevel..." >&4
4904 if $test -r $rsrc/patchlevel.h;then
4905         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
4906         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
4907         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4908         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
4909         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
4910         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4911 else
4912         revision=0
4913         patchlevel=0
4914         subversion=0
4915         api_revision=0
4916         api_version=0
4917         api_subversion=0
4918 fi
4919 $echo $n "(You have $package revision $revision" $c
4920 $echo $n " patchlevel $patchlevel" $c
4921 test 0 -eq "$subversion" || $echo $n " subversion $subversion" $c
4922 echo ".)"
4923 case "$osname" in
4924 dos|vms)
4925         : XXX Should be a Configure test for double-dots in filenames.
4926         version=`echo $revision $patchlevel $subversion | \
4927                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4928         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4929                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4930         ;;
4931 *)
4932         version=`echo $revision $patchlevel $subversion | \
4933                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4934         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4935                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4936         ;;
4937 esac
4938 : Special case the 5.005_xx maintenance series, which used 5.005
4939 : without any subversion label as a subdirectory in $sitelib
4940 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
4941         api_versionstring='5.005'
4942 fi
4943
4944 : determine installation style
4945 : For now, try to deduce it from prefix unless it is already set.
4946 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
4947 case "$installstyle" in
4948 '')     case "$prefix" in
4949                 *perl*) dflt='lib';;
4950                 *) dflt='lib/perl5' ;;
4951         esac
4952         ;;
4953 *)      dflt="$installstyle" ;;
4954 esac
4955 : Probably not worth prompting for this since we prompt for all
4956 : the directories individually, and the prompt would be too long and
4957 : confusing anyway.
4958 installstyle=$dflt
4959
4960 : determine where private library files go
4961 : Usual default is /usr/local/lib/perl5/$version.
4962 : Also allow things like /opt/perl/lib/$version, since 
4963 : /opt/perl/lib/perl5... would be redundant.
4964 : The default "style" setting is made in installstyle.U
4965 case "$installstyle" in
4966 *lib/perl5*) set dflt privlib lib/$package/$version ;;
4967 *)       set dflt privlib lib/$version ;;
4968 esac
4969 eval $prefixit
4970 $cat <<EOM
4971
4972 There are some auxiliary files for $package that need to be put into a
4973 private library directory that is accessible by everyone.
4974
4975 EOM
4976 fn=d~+
4977 rp='Pathname where the private library files will reside?'
4978 . ./getfile
4979 privlib="$ans"
4980 privlibexp="$ansexp"
4981 : Change installation prefix, if necessary.
4982 if $test X"$prefix" != X"$installprefix"; then
4983         installprivlib=`echo $privlibexp | sed "s#^$prefix#$installprefix#"`
4984 else
4985         installprivlib="$privlibexp"
4986 fi
4987
4988 : set the prefixup variable, to restore leading tilda escape
4989 prefixup='case "$prefixexp" in
4990 "$prefix") ;;
4991 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
4992 esac'
4993
4994 : determine where public architecture dependent libraries go
4995 set archlib archlib
4996 eval $prefixit
4997 : privlib default is /usr/local/lib/$package/$version
4998 : archlib default is /usr/local/lib/$package/$version/$archname
4999 : privlib may have an optional trailing /share.
5000 tdflt=`echo $privlib | $sed 's,/share$,,'`
5001 tdflt=$tdflt/$archname
5002 case "$archlib" in
5003 '')     dflt=$tdflt
5004         ;;
5005 *)      dflt="$archlib"
5006     ;;
5007 esac
5008 $cat <<EOM
5009
5010 $spackage contains architecture-dependent library files.  If you are
5011 sharing libraries in a heterogeneous environment, you might store
5012 these files in a separate location.  Otherwise, you can just include
5013 them with the rest of the public library files.
5014
5015 EOM
5016 fn=d+~
5017 rp='Where do you want to put the public architecture-dependent libraries?'
5018 . ./getfile
5019 archlib="$ans"
5020 archlibexp="$ansexp"
5021 if $test X"$archlib" = X"$privlib"; then
5022         d_archlib="$undef"
5023 else
5024         d_archlib="$define"
5025 fi
5026 : Change installation prefix, if necessary.
5027 if $test X"$prefix" != X"$installprefix"; then
5028         installarchlib=`echo $archlibexp | sed "s#^$prefix#$installprefix#"`
5029 else
5030         installarchlib="$archlibexp"
5031 fi
5032
5033
5034 : Binary compatibility with 5.005 is not possible for builds
5035 : with advanced features
5036 case "$usethreads$usemultiplicity" in
5037 *define*)
5038         bincompat5005="$undef"
5039         d_bincompat5005="$undef"
5040         ;;
5041 *)      $cat <<EOM
5042
5043 This version of Perl can be compiled for binary compatibility with 5.005.
5044 If you decide to do so, you will be able to continue using most of the
5045 extensions that were compiled for Perl 5.005.
5046
5047 EOM
5048         case "$bincompat5005$d_bincompat5005" in
5049         *"$undef"*) dflt=n ;;
5050         *) dflt=y ;;
5051         esac
5052         rp='Binary compatibility with Perl 5.005?'
5053         . ./myread
5054         case "$ans" in
5055         y*) val="$define" ;;
5056         *)  val="$undef" ;;
5057         esac
5058         set d_bincompat5005
5059         eval $setvar
5060         case "$d_bincompat5005" in
5061         "$define")
5062                 bincompat5005="$define"
5063                 ;;
5064         *)      bincompat5005="$undef"
5065                 d_bincompat5005="$undef"
5066                 ;;
5067         esac
5068         ;;
5069 esac
5070
5071
5072 : see if setuid scripts can be secure
5073 $cat <<EOM
5074
5075 Some kernels have a bug that prevents setuid #! scripts from being
5076 secure.  Some sites have disabled setuid #! scripts because of this.
5077
5078 First let's decide if your kernel supports secure setuid #! scripts.
5079 (If setuid #! scripts would be secure but have been disabled anyway,
5080 don't say that they are secure if asked.)
5081
5082 EOM
5083
5084 val="$undef"
5085 if $test -d /dev/fd; then
5086         echo "#!$ls" >reflect
5087         chmod +x,u+s reflect
5088         ./reflect >flect 2>&1
5089         if $contains "/dev/fd" flect >/dev/null; then
5090                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
5091                 val="$define"
5092         else
5093                 $cat <<EOM
5094 If you are not sure if they are secure, I can check but I'll need a
5095 username and password different from the one you are using right now.
5096 If you don't have such a username or don't want me to test, simply
5097 enter 'none'.
5098
5099 EOM
5100                 rp='Other username to test security of setuid scripts with?'
5101                 dflt='none'
5102                 . ./myread
5103                 case "$ans" in
5104                 n|none)
5105                         case "$d_suidsafe" in
5106                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
5107                                 dflt=n;;
5108                         "$undef")
5109                                 echo "Well, the $hint value is *not* secure." >&4
5110                                 dflt=n;;
5111                         *)      echo "Well, the $hint value *is* secure." >&4
5112                                 dflt=y;;
5113                         esac
5114                         ;;
5115                 *)
5116                         $rm -f reflect flect
5117                         echo "#!$ls" >reflect
5118                         chmod +x,u+s reflect
5119                         echo >flect
5120                         chmod a+w flect
5121                         echo '"su" will (probably) prompt you for '"$ans's password."
5122                         su $ans -c './reflect >flect'
5123                         if $contains "/dev/fd" flect >/dev/null; then
5124                                 echo "Okay, it looks like setuid scripts are secure." >&4
5125                                 dflt=y
5126                         else
5127                                 echo "I don't think setuid scripts are secure." >&4
5128                                 dflt=n
5129                         fi
5130                         ;;
5131                 esac
5132                 rp='Does your kernel have *secure* setuid scripts?'
5133                 . ./myread
5134                 case "$ans" in
5135                 [yY]*)  val="$define";;
5136                 *)      val="$undef";;
5137                 esac
5138         fi
5139 else
5140         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
5141         echo "(That's for file descriptors, not floppy disks.)"
5142         val="$undef"
5143 fi
5144 set d_suidsafe
5145 eval $setvar
5146
5147 $rm -f reflect flect
5148
5149 : now see if they want to do setuid emulation
5150 echo " "
5151 val="$undef"
5152 case "$d_suidsafe" in
5153 "$define")
5154         val="$undef"
5155         echo "No need to emulate SUID scripts since they are secure here." >& 4
5156         ;;
5157 *)
5158         $cat <<EOM
5159 Some systems have disabled setuid scripts, especially systems where
5160 setuid scripts cannot be secure.  On systems where setuid scripts have
5161 been disabled, the setuid/setgid bits on scripts are currently
5162 useless.  It is possible for $package to detect those bits and emulate
5163 setuid/setgid in a secure fashion.  This emulation will only work if
5164 setuid scripts have been disabled in your kernel.
5165
5166 EOM
5167         case "$d_dosuid" in
5168         "$define") dflt=y ;;
5169         *) dflt=n ;;
5170         esac
5171         rp="Do you want to do setuid/setgid emulation?"
5172         . ./myread
5173         case "$ans" in
5174         [yY]*)  val="$define";;
5175         *)      val="$undef";;
5176         esac
5177         ;;
5178 esac
5179 set d_dosuid
5180 eval $setvar
5181
5182 : determine filename position in cpp output
5183 echo " "
5184 echo "Computing filename position in cpp output for #include directives..." >&4
5185 echo '#include <stdio.h>' > foo.c
5186 $cat >fieldn <<EOF
5187 $startsh
5188 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5189 $grep '^[       ]*#.*stdio\.h' | \
5190 while read cline; do
5191         pos=1
5192         set \$cline
5193         while $test \$# -gt 0; do
5194                 if $test -r \`echo \$1 | $tr -d '"'\`; then
5195                         echo "\$pos"
5196                         exit 0
5197                 fi
5198                 shift
5199                 pos=\`expr \$pos + 1\`
5200         done
5201 done
5202 EOF
5203 chmod +x fieldn
5204 fieldn=`./fieldn`
5205 $rm -f foo.c fieldn
5206 case $fieldn in
5207 '') pos='???';;
5208 1) pos=first;;
5209 2) pos=second;;
5210 3) pos=third;;
5211 *) pos="${fieldn}th";;
5212 esac
5213 echo "Your cpp writes the filename in the $pos field of the line."
5214
5215 : locate header file
5216 $cat >findhdr <<EOF
5217 $startsh
5218 wanted=\$1
5219 name=''
5220 for usrincdir in $usrinc
5221 do
5222         if test -f \$usrincdir/\$wanted; then
5223                 echo "\$usrincdir/\$wanted"
5224                 exit 0
5225         fi
5226 done
5227 awkprg='{ print \$$fieldn }'
5228 echo "#include <\$wanted>" > foo\$\$.c
5229 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5230 $grep "^[       ]*#.*\$wanted" | \
5231 while read cline; do
5232         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5233         case "\$name" in
5234         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5235         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5236         *) exit 2;;
5237         esac;
5238 done;
5239 #
5240 # status = 0: grep returned 0 lines, case statement not executed
5241 # status = 1: headerfile found
5242 # status = 2: while loop executed, no headerfile found
5243 #
5244 status=\$?
5245 $rm -f foo\$\$.c;
5246 if test \$status -eq 1; then
5247         exit 0;
5248 fi
5249 exit 1
5250 EOF
5251 chmod +x findhdr
5252
5253 : define an alternate in-header-list? function
5254 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5255 cont=true; xxf="echo \"<\$1> found.\" >&4";
5256 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5257 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5258 esac;
5259 case $# in 4) instead=instead;; *) instead="at last";; esac;
5260 while $test "$cont"; do
5261         xxx=`./findhdr $1`
5262         var=$2; eval "was=\$$2";
5263         if $test "$xxx" && $test -r "$xxx";
5264         then eval $xxf;
5265         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5266                 cont="";
5267         else eval $xxnf;
5268         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5269         set $yyy; shift; shift; yyy=$@;
5270         case $# in 0) cont="";;
5271         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5272                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5273         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5274                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5275         esac;
5276 done;
5277 while $test "$yyy";
5278 do set $yyy; var=$2; eval "was=\$$2";
5279         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5280         set $yyy; shift; shift; yyy=$@;
5281 done'
5282
5283 : see if this is a malloc.h system
5284 set malloc.h i_malloc
5285 eval $inhdr
5286
5287 : see if stdlib is available
5288 set stdlib.h i_stdlib
5289 eval $inhdr
5290
5291 : determine which malloc to compile in
5292 echo " "
5293 case "$usemymalloc" in
5294 ''|[yY]*|true|$define)  dflt='y' ;;
5295 *)      dflt='n' ;;
5296 esac
5297 rp="Do you wish to attempt to use the malloc that comes with $package?"
5298 . ./myread
5299 usemymalloc="$ans"
5300 case "$ans" in
5301 y*|true)
5302         usemymalloc='y'
5303         mallocsrc='malloc.c'
5304         mallocobj="malloc$_o"
5305         d_mymalloc="$define"
5306         case "$libs" in
5307         *-lmalloc*)
5308                 : Remove malloc from list of libraries to use
5309                 echo "Removing unneeded -lmalloc from library list" >&4
5310                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
5311                 shift
5312                 libs="$*"
5313                 echo "libs = $libs" >&4
5314                 ;;
5315         esac
5316         ;;
5317 *)
5318         usemymalloc='n'
5319         mallocsrc=''
5320         mallocobj=''
5321         d_mymalloc="$undef"
5322         ;;
5323 esac
5324
5325 : compute the return types of malloc and free
5326 echo " "
5327 $cat >malloc.c <<END
5328 #$i_malloc I_MALLOC
5329 #$i_stdlib I_STDLIB
5330 #include <stdio.h>
5331 #include <sys/types.h>
5332 #ifdef I_MALLOC
5333 #include <malloc.h>
5334 #endif
5335 #ifdef I_STDLIB
5336 #include <stdlib.h>
5337 #endif
5338 #ifdef TRY_MALLOC
5339 void *malloc();
5340 #endif
5341 #ifdef TRY_FREE
5342 void free();
5343 #endif
5344 END
5345 case "$malloctype" in
5346 '')
5347         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
5348                 malloctype='void *'
5349         else
5350                 malloctype='char *'
5351         fi
5352         ;;
5353 esac
5354 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
5355
5356 case "$freetype" in
5357 '')
5358         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
5359                 freetype='void'
5360         else
5361                 freetype='int'
5362         fi
5363         ;;
5364 esac
5365 echo "Your system uses $freetype free(), it would seem." >&4
5366 $rm -f malloc.[co]
5367 $cat <<EOM
5368
5369 After $package is installed, you may wish to install various
5370 add-on modules and utilities.  Typically, these add-ons will
5371 be installed under $prefix with the rest
5372 of this package.  However, you may wish to install such add-ons
5373 elsewhere under a different prefix.
5374
5375 If you do not wish to put everything under a single prefix, that's
5376 ok.  You will be prompted for the individual locations; this siteprefix
5377 is only used to suggest the defaults.
5378
5379 The default should be fine for most people.
5380
5381 EOM
5382 fn=d~+
5383 rp='Installation prefix to use for add-on modules and utilities?'
5384 : XXX Here might be another good place for an installstyle setting.
5385 case "$siteprefix" in
5386 '') dflt=$prefix ;;
5387 *)  dflt=$siteprefix ;;
5388 esac
5389 . ./getfile
5390 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
5391 oldsiteprefix=''
5392 case "$siteprefix" in
5393 '') ;;
5394 *)      case "$ans" in
5395         "$prefix") ;;
5396         *) oldsiteprefix="$prefix";;
5397         esac
5398         ;;
5399 esac
5400 siteprefix="$ans"
5401 siteprefixexp="$ansexp"
5402
5403 : determine where site specific libraries go.
5404 : Usual default is /usr/local/lib/perl5/site_perl/$version
5405 : The default "style" setting is made in installstyle.U
5406 : XXX No longer works with Prefixit stuff.
5407 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
5408 case "$sitelib" in
5409 '') case "$installstyle" in
5410         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
5411         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
5412         esac
5413         ;;
5414 *)      dflt="$sitelib"
5415         ;;
5416 esac
5417 $cat <<EOM
5418
5419 The installation process will create a directory for
5420 site-specific extensions and modules.  Most users find it convenient
5421 to place all site-specific files in this directory rather than in the
5422 main distribution directory.
5423
5424 EOM
5425 fn=d~+
5426 rp='Pathname for the site-specific library files?'
5427 . ./getfile
5428 sitelib="$ans"
5429 sitelibexp="$ansexp"
5430 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
5431 : Change installation prefix, if necessary.
5432 if $test X"$prefix" != X"$installprefix"; then
5433         installsitelib=`echo $sitelibexp | $sed "s#^$prefix#$installprefix#"`
5434 else
5435         installsitelib="$sitelibexp"
5436 fi
5437
5438 : determine where site specific architecture-dependent libraries go.
5439 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
5440 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
5441 : sitelib may have an optional trailing /share.
5442 case "$sitearch" in
5443 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
5444         dflt="$dflt/$archname"
5445         ;;
5446 *)      dflt="$sitearch"
5447         ;;
5448 esac
5449 set sitearch sitearch none
5450 eval $prefixit
5451 $cat <<EOM
5452
5453 The installation process will also create a directory for
5454 architecture-dependent site-specific extensions and modules.
5455
5456 EOM
5457 fn=d~+
5458 rp='Pathname for the site-specific architecture-dependent library files?'
5459 . ./getfile
5460 sitearch="$ans"
5461 sitearchexp="$ansexp"
5462 : Change installation prefix, if necessary.
5463 if $test X"$prefix" != X"$installprefix"; then
5464         installsitearch=`echo $sitearchexp | sed "s#^$prefix#$installprefix#"`
5465 else
5466         installsitearch="$sitearchexp"
5467 fi
5468
5469 $cat <<EOM
5470
5471 The installation process will also create a directory for
5472 vendor-supplied add-ons.  Vendors who supply perl with their system
5473 may find it convenient to place all vendor-supplied files in this
5474 directory rather than in the main distribution directory.  This will
5475 ease upgrades between binary-compatible maintenance versions of perl.
5476
5477 Of course you may also use these directories in whatever way you see
5478 fit.  For example, you might use them to access modules shared over a
5479 company-wide network.
5480
5481 The default answer should be fine for most people.
5482 This causes further questions about vendor add-ons to be skipped
5483 and no vendor-specific directories will be configured for perl.
5484
5485 EOM
5486 rp='Do you want to configure vendor-specific add-on directories?'
5487 case "$usevendorprefix" in
5488 define|true|[yY]*) dflt=y ;;
5489 *)      : User may have set vendorprefix directly on Configure command line.
5490         case "$vendorprefix" in
5491         ''|' ') dflt=n ;;
5492         *)      dflt=y ;;
5493         esac
5494         ;;
5495 esac
5496 . ./myread
5497 case "$ans" in
5498 [yY]*)  fn=d~+
5499         rp='Installation prefix to use for vendor-supplied add-ons?'
5500         case "$vendorprefix" in
5501         '') dflt='' ;;
5502         *)  dflt=$vendorprefix ;;
5503         esac
5504         . ./getfile
5505         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
5506         oldvendorprefix=''
5507         case "$vendorprefix" in
5508         '') ;;
5509         *)      case "$ans" in
5510                 "$prefix") ;;
5511                 *) oldvendorprefix="$prefix";;
5512                 esac
5513                 ;;
5514         esac
5515         usevendorprefix="$define"
5516         vendorprefix="$ans"
5517         vendorprefixexp="$ansexp"
5518         ;;
5519 *)      usevendorprefix="$undef"
5520         vendorprefix=''
5521         vendorprefixexp=''
5522         ;;
5523 esac
5524
5525 case "$vendorprefix" in
5526 '')     d_vendorlib="$undef"
5527         vendorlib=''
5528         vendorlibexp=''
5529         ;;
5530 *)      d_vendorlib="$define"
5531         : determine where vendor-supplied modules go.
5532         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
5533         case "$vendorlib" in
5534         '')
5535                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
5536                 case "$installstyle" in
5537                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
5538                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
5539                 esac
5540                 ;;
5541         *)      dflt="$vendorlib"
5542                 ;;
5543         esac
5544         fn=d~+
5545         rp='Pathname for the vendor-supplied library files?'
5546         . ./getfile
5547         vendorlib="$ans"
5548         vendorlibexp="$ansexp"
5549         ;;
5550 esac
5551 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
5552 : Change installation prefix, if necessary.
5553 if $test X"$prefix" != X"$installprefix"; then
5554         installvendorlib=`echo $vendorlibexp | $sed "s#^$prefix#$installprefix#"`
5555 else
5556         installvendorlib="$vendorlibexp"
5557 fi
5558
5559 case "$vendorprefix" in
5560 '')     d_vendorarch="$undef"
5561         vendorarch=''
5562         vendorarchexp=''
5563         ;;
5564 *)      d_vendorarch="$define"
5565         : determine where vendor-supplied architecture-dependent libraries go.
5566         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
5567         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
5568         : vendorlib may have an optional trailing /share.
5569         case "$vendorarch" in
5570         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
5571                 dflt="$dflt/$archname"
5572                 ;;
5573         *)      dflt="$vendorarch" ;;
5574         esac
5575         fn=d~+
5576         rp='Pathname for vendor-supplied architecture-dependent files?'
5577         . ./getfile
5578         vendorarch="$ans"
5579         vendorarchexp="$ansexp"
5580         ;;
5581 esac
5582 : Change installation prefix, if necessary.
5583 if $test X"$prefix" != X"$installprefix"; then
5584         installvendorarch=`echo $vendorarchexp | sed "s#^$prefix#$installprefix#"`
5585 else
5586         installvendorarch="$vendorarchexp"
5587 fi
5588
5589 : Final catch-all directories to search
5590 $cat <<EOM
5591
5592 Lastly, you can have perl look in other directories for extensions and
5593 modules in addition to those already specified.
5594 These directories will be searched after 
5595         $sitearch 
5596         $sitelib 
5597 EOM
5598 test X"$vendorlib" != "X" && echo '     ' $vendorlib
5599 test X"$vendorarch" != "X" && echo '    ' $vendorarch
5600 echo ' '
5601 case "$otherlibdirs" in
5602 ''|' ') dflt='none' ;;
5603 *)      dflt="$otherlibdirs" ;;
5604 esac
5605 $cat <<EOM
5606 Enter a colon-separated set of extra paths to include in perl's @INC
5607 search path, or enter 'none' for no extra paths.
5608
5609 EOM
5610
5611 rp='Colon-separated list of additional directories for perl to search?'
5612 . ./myread
5613 case "$ans" in
5614 ' '|''|none)    otherlibdirs=' ' ;;     
5615 *)      otherlibdirs="$ans" ;;
5616 esac
5617 case "$otherlibdirs" in
5618 ' ') val=$undef ;;
5619 *)      val=$define ;;
5620 esac
5621 set d_perl_otherlibdirs
5622 eval $setvar
5623
5624 : Cruising for prototypes
5625 echo " "
5626 echo "Checking out function prototypes..." >&4
5627 $cat >prototype.c <<'EOCP'
5628 int main(int argc, char *argv[]) {
5629         exit(0);}
5630 EOCP
5631 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
5632         echo "Your C compiler appears to support function prototypes."
5633         val="$define"
5634 else
5635         echo "Your C compiler doesn't seem to understand function prototypes."
5636         val="$undef"
5637 fi
5638 set prototype
5639 eval $setvar
5640 $rm -f prototype*
5641
5642 case "$prototype" in
5643 "$define") ;;
5644 *)      ansi2knr='ansi2knr'
5645         echo " "
5646         cat <<EOM >&4
5647
5648 $me:  FATAL ERROR:
5649 This version of $package can only be compiled by a compiler that 
5650 understands function prototypes.  Unfortunately, your C compiler 
5651         $cc $ccflags
5652 doesn't seem to understand them.  Sorry about that.
5653
5654 If GNU cc is available for your system, perhaps you could try that instead.  
5655
5656 Eventually, we hope to support building Perl with pre-ANSI compilers.
5657 If you would like to help in that effort, please contact <perlbug@perl.org>.
5658
5659 Aborting Configure now.
5660 EOM
5661         exit 2
5662         ;;
5663 esac
5664
5665 : determine where public executables go
5666 echo " "
5667 set dflt bin bin
5668 eval $prefixit
5669 fn=d~
5670 rp='Pathname where the public executables will reside?'
5671 . ./getfile
5672 if $test "X$ansexp" != "X$binexp"; then
5673         installbin=''
5674 fi
5675 bin="$ans"
5676 binexp="$ansexp"
5677 : Change installation prefix, if necessary.
5678 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
5679 if $test X"$prefix" != X"$installprefix"; then
5680         installbin=`echo $binexp | sed "s#^$prefix#$installprefix#"`
5681 else
5682         installbin="$binexp"
5683 fi
5684
5685 : Find perl5.005 or later.
5686 echo "Looking for a previously installed perl5.005 or later... "
5687 case "$perl5" in
5688 '')     for tdir in `echo "$binexp:$PATH" | $sed "s/$path_sep/ /g"`; do
5689                 : Check if this perl is recent and can load a simple module
5690                 if $test -x $tdir/perl && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
5691                         perl5=$tdir/perl
5692                         break;
5693                 elif $test -x $tdir/perl5 && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
5694                         perl5=$tdir/perl
5695                         break;
5696                 fi
5697         done
5698         ;;
5699 *)      perl5="$perl5"
5700         ;;
5701 esac
5702 case "$perl5" in
5703 '')     echo "None found.  That's ok.";;
5704 *)      echo "Using $perl5." ;;
5705 esac
5706
5707 : Determine list of previous versions to include in @INC
5708 $cat > getverlist <<EOPL
5709 #!$perl5 -w
5710 use File::Basename;
5711 \$api_versionstring = "$api_versionstring";
5712 \$version = "$version";
5713 \$stem = "$sitelib_stem";
5714 \$archname = "$archname";
5715 EOPL
5716         $cat >> getverlist <<'EOPL'
5717 # Can't have leading @ because metaconfig interprets it as a command!
5718 ;@inc_version_list=();
5719 # XXX Redo to do opendir/readdir? 
5720 if (-d $stem) {
5721     chdir($stem);
5722     ;@candidates = glob("5.*");
5723 }
5724 else {
5725     ;@candidates = ();
5726 }
5727
5728 # XXX ToDo:  These comparisons must be reworked when two-digit
5729 # subversions come along, so that 5.7.10 compares as greater than
5730 # 5.7.3!  By that time, hope that 5.6.x is sufficiently
5731 # widespread that we can use the built-in version vectors rather
5732 # than reinventing them here.  For 5.6.0, however, we must
5733 # assume this script will likely be run by 5.005_0x.  --AD 1/2000.
5734 foreach $d (@candidates) {
5735     if ($d lt $version) {
5736         if ($d ge $api_versionstring) {
5737             unshift(@inc_version_list, grep { -d } "$d/$archname", $d);
5738         }
5739         elsif ($d ge "5.005") {
5740             unshift(@inc_version_list, grep { -d } $d);
5741         }
5742     }
5743     else {
5744         # Skip newer version.  I.e. don't look in
5745         # 5.7.0 if we're installing 5.6.1.
5746     }
5747 }
5748
5749 if (@inc_version_list) {
5750     print join(' ', @inc_version_list);
5751 }
5752 else {
5753     # Blank space to preserve value for next Configure run.
5754     print " ";
5755 }
5756 EOPL
5757 chmod +x getverlist
5758 case "$inc_version_list" in
5759 '')     if test -x "$perl5"; then
5760                 dflt=`$perl5 getverlist`
5761         else
5762                 dflt='none'
5763         fi
5764         ;;
5765 $undef) dflt='none' ;;
5766 *)  dflt="$inc_version_list" ;;
5767 esac
5768 case "$dflt" in
5769 ''|' ') dflt=none ;;
5770 esac
5771 $cat <<'EOM'
5772
5773 In order to ease the process of upgrading, this version of perl 
5774 can be configured to use modules built and installed with earlier 
5775 versions of perl that were installed under $prefix.  Specify here
5776 the list of earlier versions that this version of perl should check.
5777 If Configure detected no earlier versions of perl installed under
5778 $prefix, then the list will be empty.  Answer 'none' to tell perl
5779 to not search earlier versions.
5780
5781 The default should almost always be sensible, so if you're not sure,
5782 just accept the default.
5783 EOM
5784
5785 rp='List of earlier versions to include in @INC?'
5786 . ./myread
5787 case "$ans" in
5788 [Nn]one|''|' ') inc_version_list=' ' ;;
5789 *) inc_version_list="$ans" ;;
5790 esac
5791 case "$inc_version_list" in
5792 ''|' ') 
5793         inc_version_list_init='0';;
5794 *)      inc_version_list_init=`echo $inc_version_list |
5795                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
5796         ;;
5797 esac
5798 $rm -f getverlist
5799
5800 : determine whether to install perl also as /usr/bin/perl
5801
5802 echo " "
5803 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
5804         $cat <<EOM
5805 Many scripts expect perl to be installed as /usr/bin/perl.
5806 I can install the perl you are about to compile also as /usr/bin/perl
5807 (in addition to $installbin/perl).
5808 EOM
5809         case "$installusrbinperl" in
5810         "$undef"|[nN]*) dflt='n';;
5811         *)              dflt='y';;
5812         esac
5813         rp="Do you want to install perl as /usr/bin/perl?"
5814         . ./myread
5815         case "$ans" in
5816         [yY]*)  val="$define";;
5817         *)      val="$undef" ;;
5818         esac
5819 else
5820         val="$undef"
5821 fi
5822 set installusrbinperl
5823 eval $setvar
5824
5825 echo " "
5826 echo "Checking for GNU C Library..." >&4
5827 cat >gnulibc.c <<EOM
5828 #include <stdio.h>
5829 int main()
5830 {
5831 #ifdef __GLIBC__
5832     exit(0);
5833 #else
5834     exit(1);
5835 #endif
5836 }
5837 EOM
5838 set gnulibc
5839 if eval $compile_ok && ./gnulibc; then
5840         val="$define"
5841         echo "You are using the GNU C Library"
5842 else
5843         val="$undef"
5844         echo "You are not using the GNU C Library"
5845 fi
5846 $rm -f gnulibc*
5847 set d_gnulibc
5848 eval $setvar
5849
5850 : see if nm is to be used to determine whether a symbol is defined or not
5851 case "$usenm" in
5852 '')
5853         dflt=''
5854         case "$d_gnulibc" in
5855         "$define")
5856                 echo " "
5857                 echo "nm probably won't work on the GNU C Library." >&4
5858                 dflt=n
5859                 ;;
5860         esac
5861         case "$dflt" in
5862         '') 
5863                 if $test "$osname" = aix -a ! -f /lib/syscalls.exp; then
5864                         echo " "
5865                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
5866                         echo "'nm' won't be sufficient on this sytem." >&4
5867                         dflt=n
5868                 fi
5869                 ;;
5870         esac
5871         case "$dflt" in
5872         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
5873                 if $test $dflt -gt 20; then
5874                         dflt=y
5875                 else
5876                         dflt=n
5877                 fi
5878                 ;;
5879         esac
5880         ;;
5881 *)
5882         case "$usenm" in
5883         true|$define) dflt=y;;
5884         *) dflt=n;;
5885         esac
5886         ;;
5887 esac
5888 $cat <<EOM
5889
5890 I can use $nm to extract the symbols from your C libraries. This
5891 is a time consuming task which may generate huge output on the disk (up
5892 to 3 megabytes) but that should make the symbols extraction faster. The
5893 alternative is to skip the 'nm' extraction part and to compile a small
5894 test program instead to determine whether each symbol is present. If
5895 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
5896 this may be the best solution.
5897
5898 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
5899
5900 EOM
5901 rp="Shall I use $nm to extract C symbols from the libraries?"
5902 . ./myread
5903 case "$ans" in
5904 [Nn]*) usenm=false;;
5905 *) usenm=true;;
5906 esac
5907
5908 runnm=$usenm
5909 case "$reuseval" in
5910 true) runnm=false;;
5911 esac
5912
5913 : nm options which may be necessary
5914 case "$nm_opt" in
5915 '') if $test -f /mach_boot; then
5916                 nm_opt=''       # Mach
5917         elif $test -d /usr/ccs/lib; then
5918                 nm_opt='-p'     # Solaris (and SunOS?)
5919         elif $test -f /dgux; then
5920                 nm_opt='-p'     # DG-UX
5921         elif $test -f /lib64/rld; then
5922                 nm_opt='-p'     # 64-bit Irix
5923         else
5924                 nm_opt=''
5925         fi;;
5926 esac
5927
5928 : nm options which may be necessary for shared libraries but illegal
5929 : for archive libraries.  Thank you, Linux.
5930 case "$nm_so_opt" in
5931 '')     case "$myuname" in
5932         *linux*)
5933                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
5934                         nm_so_opt='--dynamic'
5935                 fi
5936                 ;;
5937         esac
5938         ;;
5939 esac
5940
5941 case "$runnm" in
5942 true)
5943 : get list of predefined functions in a handy place
5944 echo " "
5945 case "$libc" in
5946 '') libc=unknown
5947         case "$libs" in
5948         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
5949         esac
5950         ;;
5951 esac
5952 libnames='';
5953 case "$libs" in
5954 '') ;;
5955 *)  for thislib in $libs; do
5956         case "$thislib" in
5957         -lc|-lc_s)
5958                 : Handle C library specially below.
5959                 ;;
5960         -l*)
5961                 thislib=`echo $thislib | $sed -e 's/^-l//'`
5962                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
5963                         :
5964                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
5965                         :
5966                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
5967                         :
5968                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
5969                         :
5970                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
5971                         :
5972                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
5973                         :
5974                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
5975                         :
5976                 else
5977                         try=''
5978                 fi
5979                 libnames="$libnames $try"
5980                 ;;
5981         *) libnames="$libnames $thislib" ;;
5982         esac
5983         done
5984         ;;
5985 esac
5986 xxx=normal
5987 case "$libc" in
5988 unknown)
5989         set /lib/libc.$so
5990         for xxx in $libpth; do
5991                 $test -r $1 || set $xxx/libc.$so
5992                 : The messy sed command sorts on library version numbers.
5993                 $test -r $1 || \
5994                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
5995                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
5996                                 h
5997                                 s/[0-9][0-9]*/0000&/g
5998                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
5999                                 G
6000                                 s/\n/ /' | \
6001                          sort | $sed -e 's/^.* //'`
6002                 eval set \$$#
6003         done
6004         $test -r $1 || set /usr/ccs/lib/libc.$so
6005         $test -r $1 || set /lib/libsys_s$_a
6006         ;;
6007 *)
6008         set blurfl
6009         ;;
6010 esac
6011 if $test -r "$1"; then
6012         echo "Your (shared) C library seems to be in $1."
6013         libc="$1"
6014 elif $test -r /lib/libc && $test -r /lib/clib; then
6015         echo "Your C library seems to be in both /lib/clib and /lib/libc."
6016         xxx=apollo
6017         libc='/lib/clib /lib/libc'
6018         if $test -r /lib/syslib; then
6019                 echo "(Your math library is in /lib/syslib.)"
6020                 libc="$libc /lib/syslib"
6021         fi
6022 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
6023         echo "Your C library seems to be in $libc, as you said before."
6024 elif $test -r $incpath/usr/lib/libc$_a; then
6025         libc=$incpath/usr/lib/libc$_a;
6026         echo "Your C library seems to be in $libc.  That's fine."
6027 elif $test -r /lib/libc$_a; then
6028         libc=/lib/libc$_a;
6029         echo "Your C library seems to be in $libc.  You're normal."
6030 else
6031         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
6032                 :
6033         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
6034                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
6035         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
6036                 :
6037         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
6038                 :
6039         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
6040                 :
6041         else
6042                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
6043         fi
6044         if $test -r "$tans"; then
6045                 echo "Your C library seems to be in $tans, of all places."
6046                 libc=$tans
6047         else
6048                 libc='blurfl'
6049         fi
6050 fi
6051 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
6052         dflt="$libc"
6053         cat <<EOM
6054
6055 If the guess above is wrong (which it might be if you're using a strange
6056 compiler, or your machine supports multiple models), you can override it here.
6057
6058 EOM
6059 else
6060         dflt=''
6061         echo $libpth | tr ' ' $trnl | sort | uniq > libpath
6062         cat >&4 <<EOM
6063 I can't seem to find your C library.  I've looked in the following places:
6064
6065 EOM
6066         $sed 's/^/      /' libpath
6067         cat <<EOM
6068
6069 None of these seems to contain your C library. I need to get its name...
6070
6071 EOM
6072 fi
6073 fn=f
6074 rp='Where is your C library?'
6075 . ./getfile
6076 libc="$ans"
6077
6078 echo " "
6079 echo $libc $libnames | tr ' ' $trnl | sort | uniq > libnames
6080 set X `cat libnames`
6081 shift
6082 xxx=files
6083 case $# in 1) xxx=file; esac
6084 echo "Extracting names from the following $xxx for later perusal:" >&4
6085 echo " "
6086 $sed 's/^/      /' libnames >&4
6087 echo " "
6088 $echo $n "This may take a while...$c" >&4
6089
6090 for file in $*; do
6091         case $file in
6092         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
6093         *) $nm $nm_opt $file 2>/dev/null;;
6094         esac
6095 done >libc.tmp
6096
6097 $echo $n ".$c"
6098 $grep fprintf libc.tmp > libc.ptf
6099 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
6100 xrun='eval "<libc.tmp $com >libc.list"; echo "done" >&4'
6101 xxx='[ADTSIW]'
6102 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *_[_.]*//p' -e 's/^.* $xxx  *//p'";\
6103         eval $xscan;\
6104         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6105                 eval $xrun
6106 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
6107         eval $xscan;\
6108         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6109                 eval $xrun
6110 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
6111         eval $xscan;\
6112         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6113                 eval $xrun
6114 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
6115         eval $xscan;\
6116         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6117                 eval $xrun
6118 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
6119         eval $xscan;\
6120         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6121                 eval $xrun
6122 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
6123         eval $xscan;\
6124         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6125                 eval $xrun
6126 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
6127                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
6128         eval $xscan;\
6129         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6130                 eval $xrun
6131 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
6132         eval $xscan;\
6133         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6134                 eval $xrun
6135 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
6136         eval $xscan;\
6137         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6138                 eval $xrun
6139 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
6140         eval $xscan;\
6141         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6142                 eval $xrun
6143 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
6144         eval $xscan;\
6145         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6146                 eval $xrun
6147 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
6148         eval $xscan;\
6149         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6150                 eval $xrun
6151 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
6152         eval $xscan;\
6153         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6154                 eval $xrun
6155 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
6156         eval $xscan;\
6157         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6158                 eval $xrun
6159 else
6160         $nm -p $* 2>/dev/null >libc.tmp
6161         $grep fprintf libc.tmp > libc.ptf
6162         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
6163                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
6164         then
6165                 nm_opt='-p'
6166                 eval $xrun
6167         else
6168                 echo " "
6169                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
6170                 com=''
6171                 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
6172                         for thisname in $libnames $libc; do
6173                                 $ar t $thisname >>libc.tmp
6174                         done
6175                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
6176                         echo "Ok." >&4
6177                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
6178                         # Repeat libc to extract forwarders to DLL entries too
6179                         for thisname in $libnames $libc; do
6180                                 $ar tv $thisname >>libc.tmp
6181                                 # Revision 50 of EMX has bug in $ar.
6182                                 # it will not extract forwarders to DLL entries
6183                                 # Use emximp which will extract exactly them.
6184                                 emximp -o tmp.imp $thisname \
6185                                     2>/dev/null && \
6186                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
6187                                     < tmp.imp >>libc.tmp
6188                                 $rm tmp.imp
6189                         done
6190                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
6191                         echo "Ok." >&4
6192                 else
6193                         echo "$ar didn't seem to work right." >&4
6194                         echo "Maybe this is a Cray...trying bld instead..." >&4
6195                         if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
6196                         then
6197                                 for thisname in $libnames; do
6198                                         bld t $libnames | \
6199                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
6200                                         $ar t $thisname >>libc.tmp
6201                                 done
6202                                 echo "Ok." >&4
6203                         else
6204                                 echo "That didn't work either.  Giving up." >&4
6205                                 exit 1
6206                         fi
6207                 fi
6208         fi
6209 fi
6210 nm_extract="$com"
6211 if $test -f /lib/syscalls.exp; then
6212         echo " "
6213         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
6214         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*$/\1/p' /lib/syscalls.exp >>libc.list
6215 fi
6216 ;;
6217 esac
6218 $rm -f libnames libpath
6219
6220 : see if dld is available
6221 set dld.h i_dld
6222 eval $inhdr
6223
6224 : is a C symbol defined?
6225 csym='tlook=$1;
6226 case "$3" in
6227 -v) tf=libc.tmp; tc=""; tdc="";;
6228 -a) tf=libc.tmp; tc="[0]"; tdc="[]";;
6229 *) tlook="^$1\$"; tf=libc.list; tc="()"; tdc="()";;
6230 esac;
6231 tx=yes;
6232 case "$reuseval-$4" in
6233 true-) ;;
6234 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
6235 esac;
6236 case "$tx" in
6237 yes)
6238         case "$runnm" in
6239         true)
6240                 if $contains $tlook $tf >/dev/null 2>&1;
6241                 then tval=true;
6242                 else tval=false;
6243                 fi;;
6244         *)
6245                 echo "int main() { extern short $1$tdc; printf(\"%hd\", $1$tc); }" > t.c;
6246                 if $cc $optimize $ccflags $ldflags -o t t.c $libs >/dev/null 2>&1;
6247                 then tval=true;
6248                 else tval=false;
6249                 fi;
6250                 $rm -f t t.c;;
6251         esac;;
6252 *)
6253         case "$tval" in
6254         $define) tval=true;;
6255         *) tval=false;;
6256         esac;;
6257 esac;
6258 eval "$2=$tval"'
6259
6260 : define an is-in-libc? function
6261 inlibc='echo " "; td=$define; tu=$undef;
6262 sym=$1; var=$2; eval "was=\$$2";
6263 tx=yes;
6264 case "$reuseval$was" in
6265 true) ;;
6266 true*) tx=no;;
6267 esac;
6268 case "$tx" in
6269 yes)
6270         set $sym tres -f;
6271         eval $csym;
6272         case "$tres" in
6273         true)
6274                 echo "$sym() found." >&4;
6275                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
6276         *)
6277                 echo "$sym() NOT found." >&4;
6278                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
6279         esac;;
6280 *)
6281         case "$was" in
6282         $define) echo "$sym() found." >&4;;
6283         *) echo "$sym() NOT found." >&4;;
6284         esac;;
6285 esac'
6286
6287 : see if dlopen exists
6288 xxx_runnm="$runnm"
6289 runnm=false
6290 set dlopen d_dlopen
6291 eval $inlibc
6292 runnm="$xxx_runnm"
6293
6294 : determine which dynamic loading, if any, to compile in
6295 echo " "
6296 dldir="ext/DynaLoader"
6297 case "$usedl" in
6298 $define|y|true)
6299         dflt='y'
6300         usedl="$define"
6301         ;;
6302 $undef|n|false)
6303         dflt='n'
6304         usedl="$undef"
6305         ;;
6306 *) 
6307         dflt='n'
6308         case "$d_dlopen" in
6309             $define) dflt='y' ;;
6310         esac
6311         case "$i_dld" in
6312             $define) dflt='y' ;;
6313         esac
6314         : Does a dl_xxx.xs file exist for this operating system
6315         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
6316         ;;
6317 esac
6318 rp="Do you wish to use dynamic loading?"
6319 . ./myread
6320 usedl="$ans"
6321 case "$ans" in
6322 y*) usedl="$define"
6323         case "$dlsrc" in
6324         '')
6325                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
6326                         dflt="$dldir/dl_${osname}.xs"
6327                 elif $test "$d_dlopen" = "$define" ; then
6328                         dflt="$dldir/dl_dlopen.xs"
6329                 elif $test "$i_dld" = "$define" ; then
6330                         dflt="$dldir/dl_dld.xs"
6331                 else
6332                         dflt=''
6333                 fi
6334                 ;;
6335         *)      dflt="$dldir/$dlsrc"
6336                 ;;
6337         esac
6338     echo "The following dynamic loading files are available:"
6339         : Can not go over to $dldir because getfile has path hard-coded in.
6340         tdir=`pwd`; cd $rsrc; $ls -C $dldir/dl*.xs; cd $tdir
6341         rp="Source file to use for dynamic loading"
6342         fn="fne"
6343         gfpth="$src"
6344         . ./getfile
6345         usedl="$define"
6346         : emulate basename
6347         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
6348
6349         $cat << EOM
6350
6351 Some systems may require passing special flags to $cc -c to
6352 compile modules that will be used to create a shared library.
6353 To use no flags, say "none".
6354
6355 EOM
6356     case "$cccdlflags" in
6357     '') case "$gccversion" in
6358                 '') case "$osname" in
6359                         hpux)   dflt='+z' ;;
6360                         next)   dflt='none' ;;
6361                         irix*)  dflt='-KPIC' ;;
6362                         svr4*|esix*|solaris) dflt='-KPIC' ;;
6363                         sunos)  dflt='-pic' ;;
6364                         *)      dflt='none' ;;
6365                     esac
6366                         ;;
6367                 *)  case "$osname" in
6368                         svr4*|esix*|solaris) dflt='-fPIC' ;;
6369                         *)      dflt='-fpic' ;;
6370                     esac ;;
6371             esac ;;
6372         ' ') dflt='none' ;;
6373     *)  dflt="$cccdlflags" ;;
6374     esac
6375     rp="Any special flags to pass to $cc -c to compile shared library modules?"
6376     . ./myread
6377     case "$ans" in
6378     none) cccdlflags=' ' ;;
6379     *) cccdlflags="$ans" ;;
6380     esac
6381
6382     cat << EOM
6383
6384 Some systems use ld to create libraries that can be dynamically loaded,
6385 while other systems (such as those using ELF) use $cc.
6386
6387 EOM
6388         case "$ld" in
6389         '')     $cat >try.c <<'EOM'
6390 /* Test for whether ELF binaries are produced */
6391 #include <fcntl.h>
6392 #include <stdlib.h>
6393 int main() {
6394         char b[4];
6395         int i = open("a.out",O_RDONLY);
6396         if(i == -1) 
6397                 exit(1); /* fail */
6398         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
6399                 exit(0); /* succeed (yes, it's ELF) */
6400         else
6401                 exit(1); /* fail */
6402 }
6403 EOM
6404                 if $cc $ccflags try.c >/dev/null 2>&1 && ./a.out; then
6405                         cat <<EOM
6406 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
6407 EOM
6408                         dflt="$cc"
6409                 else
6410                         echo "I'll use ld to build dynamic libraries."
6411                         dflt='ld'
6412                 fi
6413                 rm -f try.c a.out
6414                 ;;
6415         *)      dflt="$ld"
6416                 ;;
6417         esac
6418
6419     rp="What command should be used to create dynamic libraries?"
6420     . ./myread
6421         ld="$ans"
6422
6423     cat << EOM
6424
6425 Some systems may require passing special flags to $ld to create a
6426 library that can be dynamically loaded.  If your ld flags include
6427 -L/other/path options to locate libraries outside your loader's normal
6428 search path, you may need to specify those -L options here as well.  To
6429 use no flags, say "none".
6430
6431 EOM
6432     case "$lddlflags" in
6433     '') case "$osname" in
6434                         beos) dflt='-nostart' ;;
6435                         hpux) dflt='-b';
6436                               case "$gccversion" in
6437                               '') dflt="$dflt +vnocompatwarnings" ;;
6438                               esac
6439                               ;;        
6440                         linux|irix*)    dflt='-shared' ;;
6441                         next)  dflt='none' ;;
6442                         solaris) dflt='-G' ;;
6443                         sunos) dflt='-assert nodefinitions' ;;
6444                         svr4*|esix*) dflt="-G $ldflags" ;;
6445                 *)     dflt='none' ;;
6446                         esac
6447                         ;;
6448     *) dflt="$lddlflags" ;;
6449     esac
6450
6451         : Try to guess additional flags to pick up local libraries.
6452         : Be careful not to append to a plain 'none'
6453         case "$dflt" in
6454         none) dflt='' ;;
6455         esac
6456         for thisflag in $ldflags; do
6457                 case "$thisflag" in
6458                 -L*)
6459                         case " $dflt " in
6460                         *" $thisflag "*) ;;
6461                         *) dflt="$dflt $thisflag" ;;
6462                         esac
6463                         ;;
6464                 esac
6465         done
6466
6467         case "$dflt" in
6468         ''|' ') dflt='none' ;;
6469         esac
6470
6471     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
6472     . ./myread
6473     case "$ans" in
6474     none) lddlflags=' ' ;;
6475     *) lddlflags="$ans" ;;
6476     esac
6477
6478         cat <<EOM
6479
6480 Some systems may require passing special flags to $cc to indicate that
6481 the resulting executable will use dynamic linking.  To use no flags,
6482 say "none".
6483
6484 EOM
6485     case "$ccdlflags" in
6486     '') case "$osname" in
6487                 hpux)   dflt='-Wl,-E' ;;
6488                 linux)  dflt='-rdynamic' ;;
6489                 next)   dflt='none' ;;
6490                 sunos)  dflt='none' ;;
6491                 *)      dflt='none' ;;
6492             esac ;;
6493     ' ')  dflt='none' ;;
6494     *)  dflt="$ccdlflags" ;;
6495     esac
6496     rp="Any special flags to pass to $cc to use dynamic linking?"
6497     . ./myread
6498     case "$ans" in
6499     none) ccdlflags=' ' ;;
6500     *) ccdlflags="$ans" ;;
6501     esac
6502     ;;
6503 *)  usedl="$undef"
6504         ld='ld'
6505     dlsrc='dl_none.xs'
6506     lddlflags=''
6507     ccdlflags=''
6508     ;;
6509 esac
6510
6511 also=''
6512 case "$usedl" in
6513 $undef)
6514         # No dynamic loading being used, so don't bother even to prompt.
6515         useshrplib='false'
6516         ;;
6517 *)      case "$useshrplib" in
6518         '')     case "$osname" in
6519                 svr4*|dgux|dynixptx|esix|powerux|beos|cygwin*)
6520                         dflt=y
6521                         also='Building a shared libperl is required for dynamic loading to work on your system.'
6522                         ;;
6523                 next*)
6524                         case "$osvers" in
6525                         4*)     dflt=y
6526                                 also='Building a shared libperl is needed for MAB support.'
6527                                 ;;
6528                         *)      dflt=n
6529                                 ;;
6530                         esac
6531                         ;;
6532                 *)      dflt=n
6533                         ;;
6534                 esac
6535                 ;;
6536         $define|true|[Yy]*)
6537                 dflt=y
6538                 ;;
6539         *)      dflt=n
6540                 ;;
6541         esac
6542         $cat << EOM
6543
6544 The perl executable is normally obtained by linking perlmain.c with
6545 libperl${_a}, any static extensions (usually just DynaLoader), and
6546 any other libraries needed on this system (such as -lm, etc.).  Since
6547 your system supports dynamic loading, it is probably possible to build
6548 a shared libperl.$so.  If you will have more than one executable linked
6549 to libperl.$so, this will significantly reduce the size of each
6550 executable, but it may have a noticeable affect on performance.  The
6551 default is probably sensible for your system.
6552 $also
6553
6554 EOM
6555         rp="Build a shared libperl.$so (y/n)"
6556         . ./myread
6557         case "$ans" in
6558         true|$define|[Yy]*)
6559                 useshrplib='true'  ;;
6560         *)      useshrplib='false' ;;
6561         esac
6562         ;;
6563 esac
6564
6565 case "$useshrplib" in
6566 true)
6567         case "$libperl" in
6568         '')
6569                 # Figure out a good name for libperl.so.  Since it gets stored in
6570                 # a version-specific architecture-dependent library, the version
6571                 # number isn't really that important, except for making cc/ld happy.
6572                 #
6573                 # A name such as libperl.so.3.1
6574                 majmin="libperl.$so.$patchlevel.$subversion"
6575                 # A name such as libperl.so.301
6576                 majonly=`echo $patchlevel $subversion |
6577                         $awk '{printf "%d%02d", $1, $2}'`
6578                 majonly=libperl.$so.$majonly
6579                 # I'd prefer to keep the os-specific stuff here to a minimum, and
6580                 # rely on figuring it out from the naming of libc.
6581                 case "${osname}${osvers}" in
6582                 next4*)
6583                         dflt=libperl.5.$so
6584                         # XXX How handle the --version stuff for MAB?
6585                         ;;
6586                 linux*)  # ld won't link with a bare -lperl otherwise.
6587                         dflt=libperl.$so
6588                         ;;
6589                 cygwin*) # include version
6590                         dflt=`echo libperl$version | sed -e 's/\./_/g'`$lib_ext
6591                         ;;
6592                 *)      # Try to guess based on whether libc has major.minor.
6593                         case "$libc" in
6594                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
6595                         *libc.$so.[0-9]*) dflt=$majonly ;;
6596                         *)      dflt=libperl.$so ;;
6597                         esac
6598                         ;;
6599                 esac
6600                 ;;
6601         *)      dflt=$libperl
6602                 ;;
6603         esac
6604         cat << EOM
6605
6606 I need to select a good name for the shared libperl.  If your system uses
6607 library names with major and minor numbers, then you might want something
6608 like $majmin.  Alternatively, if your system uses a single version
6609 number for shared libraries, then you might want to use $majonly.
6610 Or, your system might be quite happy with a simple libperl.$so.
6611
6612 Since the shared libperl will get installed into a version-specific
6613 architecture-dependent directory, the version number of the shared perl
6614 library probably isn't important, so the default should be o.k.
6615
6616 EOM
6617         rp='What name do you want to give to the shared libperl?'
6618         . ./myread
6619         libperl=$ans
6620         echo "Ok, I'll use $libperl"
6621         ;;
6622 *)
6623         libperl="libperl${_a}"
6624         ;;
6625 esac
6626
6627 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
6628 case "$shrpdir" in
6629 '') ;;
6630 *)      $cat >&4 <<EOM
6631 WARNING:  Use of the shrpdir variable for the installation location of
6632 the shared $libperl is not supported.  It was never documented and
6633 will not work in this version.  Let me (perlbug@perl.com)
6634 know of any problems this may cause.
6635
6636 EOM
6637         case "$shrpdir" in
6638         "$archlibexp/CORE")
6639                 $cat >&4 <<EOM
6640 But your current setting of $shrpdir is
6641 the default anyway, so it's harmless.
6642 EOM
6643                 ;;
6644         *)
6645                 $cat >&4 <<EOM
6646 Further, your current attempted setting of $shrpdir
6647 conflicts with the value of $archlibexp/CORE
6648 that installperl will use.
6649 EOM
6650                 ;;
6651         esac
6652         ;;
6653 esac
6654
6655 # How will the perl executable find the installed shared $libperl?
6656 # Add $xxx to ccdlflags.
6657 # If we can't figure out a command-line option, use $shrpenv to
6658 # set env LD_RUN_PATH.  The main perl makefile uses this.
6659 shrpdir=$archlibexp/CORE
6660 xxx=''
6661 tmp_shrpenv=''
6662 if "$useshrplib"; then
6663     case "$osname" in 
6664         aix)
6665                 # We'll set it in Makefile.SH...
6666                 ;;
6667         solaris|netbsd)
6668                 xxx="-R $shrpdir"
6669                 ;;
6670         freebsd)
6671                 xxx="-Wl,-R$shrpdir"
6672                 ;;
6673         linux|irix*|dec_osf)
6674                 xxx="-Wl,-rpath,$shrpdir"
6675                 ;;
6676         next)
6677                 # next doesn't like the default...
6678                 ;;
6679         beos)
6680                 # beos doesn't like the default, either.
6681                 ;;
6682         hpux*)
6683                 # hpux doesn't like the default, either.
6684                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
6685                 ;;
6686         *)
6687                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
6688                 ;;
6689         esac
6690         case "$xxx" in
6691         '') ;;
6692         *)      
6693                 # Only add $xxx if it isn't already in ccdlflags.
6694                 case " $ccdlflags " in
6695                 *" $xxx "*)     ;;
6696                 *)      ccdlflags="$ccdlflags $xxx"
6697                         cat <<EOM >&4
6698
6699 Adding $xxx to the flags
6700 passed to $ld so that the perl executable will find the 
6701 installed shared $libperl.
6702
6703 EOM
6704                         ;;
6705                 esac
6706                 ;;
6707         esac
6708 fi
6709 # Fix ccdlflags in AIX for building external extensions.
6710 # (For building Perl itself bare -bE:perl.exp is needed,
6711 #  Makefile.SH takes care of this.)
6712 case "$osname" in
6713 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
6714 esac
6715 # Respect a hint or command-line value.
6716 case "$shrpenv" in
6717 '') shrpenv="$tmp_shrpenv" ;;
6718 esac
6719 case "$ldlibpthname" in
6720 '')     ldlibpthname=LD_LIBRARY_PATH ;;
6721 none)   ldlibpthname='' ;;
6722 esac
6723
6724 : determine where manual pages go
6725 set man1dir man1dir none
6726 eval $prefixit
6727 $cat <<EOM
6728
6729 $spackage has manual pages available in source form.
6730 EOM
6731 case "$nroff" in
6732 nroff)
6733         echo "However, you don't have nroff, so they're probably useless to you."
6734         case "$man1dir" in
6735         '') man1dir="none";;
6736         esac;;
6737 esac
6738 echo "If you don't want the manual sources installed, answer 'none'."
6739 case "$man1dir" in
6740 ' ') dflt=none
6741         ;;
6742 '')
6743         lookpath="$prefixexp/man/man1 $prefixexp/man/l_man/man1"
6744         lookpath="$lookpath $prefixexp/man/p_man/man1"
6745         lookpath="$lookpath $prefixexp/man/u_man/man1"
6746         lookpath="$lookpath $prefixexp/man/man.1"
6747         case "$sysman" in
6748         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
6749         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
6750         esac
6751         set dflt
6752         eval $prefixup
6753         ;;
6754 *)  dflt="$man1dir"
6755         ;;
6756 esac
6757 echo " "
6758 fn=dn+~
6759 rp="Where do the main $spackage manual pages (source) go?"
6760 . ./getfile
6761 if $test "X$man1direxp" != "X$ansexp"; then
6762         installman1dir=''
6763 fi
6764 man1dir="$ans"
6765 man1direxp="$ansexp"
6766 case "$man1dir" in
6767 '')     man1dir=' '
6768         installman1dir='';;
6769 esac
6770
6771 : Change installation prefix, if necessary.
6772 if $test X"$prefix" != X"$installprefix"; then
6773         installman1dir=`echo $man1direxp | $sed "s#^$prefix#$installprefix#"`
6774 else
6775         installman1dir="$man1direxp"
6776 fi
6777
6778 : What suffix to use on installed man pages
6779
6780 case "$man1dir" in
6781 ' ')
6782         man1ext='0'
6783         ;;
6784 *)
6785         rp="What suffix should be used for the main $spackage man pages?"
6786         case "$man1ext" in
6787         '')     case "$man1dir" in
6788                 *1)  dflt=1 ;;
6789                 *1p) dflt=1p ;;
6790                 *1pm) dflt=1pm ;;
6791                 *l) dflt=l;;
6792                 *n) dflt=n;;
6793                 *o) dflt=o;;
6794                 *p) dflt=p;;
6795                 *C) dflt=C;;
6796                 *L) dflt=L;;
6797                 *L1) dflt=L1;;
6798                 *) dflt=1;;
6799                 esac
6800                 ;;
6801         *)      dflt="$man1ext";;
6802         esac
6803         . ./myread
6804         man1ext="$ans"
6805         ;;
6806 esac
6807
6808 : see if we can have long filenames
6809 echo " "
6810 first=123456789abcdef
6811 $rm -f $first
6812 if (echo hi >$first) 2>/dev/null; then
6813         if $test -f 123456789abcde; then
6814                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
6815                 val="$undef"
6816         else
6817                 echo 'You can have filenames longer than 14 characters.'>&4
6818                 val="$define"
6819         fi
6820 else
6821         $cat <<'EOM'
6822 You can't have filenames longer than 14 chars.
6823 You can't even think about them!
6824 EOM
6825         val="$undef"
6826 fi 
6827 set d_flexfnam
6828 eval $setvar
6829 $rm -rf 123456789abcde*
6830
6831 : determine where library module manual pages go
6832 set man3dir man3dir none
6833 eval $prefixit
6834 $cat <<EOM
6835
6836 $spackage has manual pages for many of the library modules.
6837 EOM
6838
6839 case "$nroff" in
6840 nroff)
6841         $cat <<'EOM'
6842 However, you don't have nroff, so they're probably useless to you.
6843 EOM
6844         case "$man3dir" in
6845         '') man3dir="none";;
6846         esac;;
6847 esac
6848
6849 case "$d_flexfnam" in
6850 undef)
6851         $cat <<'EOM'
6852 However, your system can't handle the long file names like File::Basename.3. 
6853 EOM
6854         case "$man3dir" in
6855         '') man3dir="none";;
6856         esac;;
6857 esac
6858
6859 echo "If you don't want the manual sources installed, answer 'none'."
6860 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6861 case "$man3dir" in
6862 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
6863         if $test -d "$privlib/man/man3"; then
6864                 cat <<EOM >&4
6865
6866 WARNING:  Previous versions of perl installed man3 pages into
6867 $privlib/man/man3.  This version will suggest a 
6868 new default of $dflt.  
6869 EOM
6870                 tdflt=$dflt
6871                 dflt='n'
6872                 rp='Do you wish to preserve the old behavior?(y/n)'
6873                 . ./myread
6874                 case "$ans" in
6875                 y*) dflt="$privlib/man/man3" ;;
6876                 *)  dflt=$tdflt ;;
6877                 esac
6878     fi
6879         ;;
6880 *)      dflt="$man3dir" ;;
6881 esac
6882 case "$dflt" in
6883 ' ') dflt=none ;;
6884 esac
6885 echo " "
6886 fn=dn+~
6887 rp="Where do the $package library man pages (source) go?"
6888 . ./getfile
6889 man3dir="$ans"
6890 man3direxp="$ansexp"
6891 case "$man3dir" in
6892 '')     man3dir=' '
6893         installman3dir='';;
6894 esac
6895
6896 : Change installation prefix, if necessary.
6897 if $test X"$prefix" != X"$installprefix"; then
6898         installman3dir=`echo $man3direxp | $sed "s#^$prefix#$installprefix#"`
6899 else
6900         installman3dir="$man3direxp"
6901 fi
6902
6903 : What suffix to use on installed man pages
6904 case "$man3dir" in
6905 ' ')
6906         man3ext='0'
6907         ;;
6908 *)
6909         rp="What suffix should be used for the $package library man pages?"
6910         case "$man3ext" in
6911         '')     case "$man3dir" in
6912                 *3)  dflt=3 ;;
6913                 *3p) dflt=3p ;;
6914                 *3pm) dflt=3pm ;;
6915                 *l) dflt=l;;
6916                 *n) dflt=n;;
6917                 *o) dflt=o;;
6918                 *p) dflt=p;;
6919                 *C) dflt=C;;
6920                 *L) dflt=L;;
6921                 *L3) dflt=L3;;
6922                 *) dflt=3;;
6923                 esac
6924                 ;;
6925         *)      dflt="$man3ext";;
6926         esac
6927         . ./myread
6928         man3ext="$ans"
6929         ;;
6930 esac
6931
6932 : see if we have to deal with yellow pages, now NIS.
6933 if $test -d /usr/etc/yp || $test -d /etc/yp; then
6934         if $test -f /usr/etc/nibindd; then
6935                 echo " "
6936                 echo "I'm fairly confident you're on a NeXT."
6937                 echo " "
6938                 rp='Do you get the hosts file via NetInfo?'
6939                 dflt=y
6940                 case "$hostcat" in
6941                 nidump*) ;;
6942                 '') ;;
6943                 *) dflt=n;;
6944                 esac
6945                 . ./myread
6946                 case "$ans" in
6947                 y*) hostcat='nidump hosts .';;
6948                 *)      case "$hostcat" in
6949                         nidump*) hostcat='';;
6950                         esac
6951                         ;;
6952                 esac
6953         fi
6954         case "$hostcat" in
6955         nidump*) ;;
6956         *)
6957                 case "$hostcat" in
6958                 *ypcat*) dflt=y;;
6959                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
6960                                 dflt=y
6961                         else
6962                                 dflt=n
6963                         fi;;
6964                 *) dflt=n;;
6965                 esac
6966                 echo " "
6967                 rp='Are you getting the hosts file via yellow pages?'
6968                 . ./myread
6969                 case "$ans" in
6970                 y*) hostcat='ypcat hosts';;
6971                 *) hostcat='cat /etc/hosts';;
6972                 esac
6973                 ;;
6974         esac
6975 fi
6976 case "$hostcat" in
6977 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
6978 esac
6979 case "$groupcat" in
6980 '') test -f /etc/group && groupcat='cat /etc/group';;
6981 esac
6982 case "$passcat" in
6983 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
6984 esac
6985
6986 : now get the host name
6987 echo " "
6988 echo "Figuring out host name..." >&4
6989 case "$myhostname" in
6990 '') cont=true
6991         echo 'Maybe "hostname" will work...'
6992         if tans=`sh -c hostname 2>&1` ; then
6993                 myhostname=$tans
6994                 phostname=hostname
6995                 cont=''
6996         fi
6997         ;;
6998 *) cont='';;
6999 esac
7000 if $test "$cont"; then
7001         if ./xenix; then
7002                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
7003                 if tans=`cat /etc/systemid 2>&1` ; then
7004                         myhostname=$tans
7005                         phostname='cat /etc/systemid'
7006                         echo "Whadyaknow.  Xenix always was a bit strange..."
7007                         cont=''
7008                 fi
7009         elif $test -r /etc/systemid; then
7010                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
7011         fi
7012 fi
7013 if $test "$cont"; then
7014         echo 'No, maybe "uuname -l" will work...'
7015         if tans=`sh -c 'uuname -l' 2>&1` ; then
7016                 myhostname=$tans
7017                 phostname='uuname -l'
7018         else
7019                 echo 'Strange.  Maybe "uname -n" will work...'
7020                 if tans=`sh -c 'uname -n' 2>&1` ; then
7021                         myhostname=$tans
7022                         phostname='uname -n'
7023                 else
7024                         echo 'Oh well, maybe I can mine it out of whoami.h...'
7025                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
7026                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
7027                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
7028                         else
7029                                 case "$myhostname" in
7030                                 '') echo "Does this machine have an identity crisis or something?"
7031                                         phostname='';;
7032                                 *)
7033                                         echo "Well, you said $myhostname before..."
7034                                         phostname='echo $myhostname';;
7035                                 esac
7036                         fi
7037                 fi
7038         fi
7039 fi
7040 : you do not want to know about this
7041 set $myhostname
7042 myhostname=$1
7043
7044 : verify guess
7045 if $test "$myhostname" ; then
7046         dflt=y
7047         rp='Your host name appears to be "'$myhostname'".'" Right?"
7048         . ./myread
7049         case "$ans" in
7050         y*) ;;
7051         *) myhostname='';;
7052         esac
7053 fi
7054
7055 : bad guess or no guess
7056 while $test "X$myhostname" = X ; do
7057         dflt=''
7058         rp="Please type the (one word) name of your host:"
7059         . ./myread
7060         myhostname="$ans"
7061 done
7062
7063 : translate upper to lower if necessary
7064 case "$myhostname" in
7065 *[A-Z]*)
7066         echo "(Normalizing case in your host name)"
7067         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
7068         ;;
7069 esac
7070
7071 case "$myhostname" in
7072 *.*)
7073         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
7074         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
7075         echo "(Trimming domain name from host name--host name is now $myhostname)"
7076         ;;
7077 *) case "$mydomain" in
7078         '')
7079                 {
7080                         test "X$hostcat" = "Xypcat hosts" &&
7081                         ypmatch "$myhostname" hosts 2>/dev/null |\
7082                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
7083                         $test -s hosts
7084                 } || {
7085                         test "X$hostcat" != "X" &&
7086                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
7087                                         /[       ]$myhostname[  . ]/p" > hosts
7088                 }
7089                 tmp_re="[       . ]"
7090                 $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
7091                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
7092                 dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
7093                         hosts | $sort | $uniq | \
7094                         $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
7095                 case `$echo X$dflt` in
7096                 X*\ *)  echo "(Several hosts in /etc/hosts matched hostname)"
7097                         dflt=.
7098                         ;;
7099                 X.) echo "(You do not have fully-qualified names in /etc/hosts)"
7100                         ;;
7101                 esac
7102                 case "$dflt" in
7103                 .)
7104                         tans=`./loc resolv.conf X /etc /usr/etc`
7105                         if $test -f "$tans"; then
7106                                 echo "(Attempting domain name extraction from $tans)"
7107                                 dflt=.`$sed -n -e 's/   / /g' \
7108                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
7109                                   | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
7110                                 case "$dflt" in
7111                                 .) dflt=.`$sed -n -e 's/        / /g' \
7112                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
7113                                      | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
7114                                         ;;
7115                                 esac
7116                         fi
7117                         ;;
7118                 esac
7119                 case "$dflt" in
7120                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
7121                         dflt=.`sh -c domainname 2>/dev/null`
7122                         case "$dflt" in
7123                         '') dflt='.';;
7124                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
7125                         esac
7126                         ;;
7127                 esac
7128                 case "$dflt" in
7129                 .) echo "(Lost all hope -- silly guess then)"
7130                         dflt='.uucp'
7131                         ;;
7132                 esac
7133                 $rm -f hosts
7134                 ;;
7135         *) dflt="$mydomain";;
7136         esac;;
7137 esac
7138 echo " "
7139 rp="What is your domain name?"
7140 . ./myread
7141 tans="$ans"
7142 case "$ans" in
7143 '') ;;
7144 .*) ;;
7145 *) tans=".$tans";;
7146 esac
7147 mydomain="$tans"
7148
7149 : translate upper to lower if necessary
7150 case "$mydomain" in
7151 *[A-Z]*)
7152         echo "(Normalizing case in your domain name)"
7153         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
7154         ;;
7155 esac
7156
7157 : a little sanity check here
7158 case "$phostname" in
7159 '') ;;
7160 *)
7161         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
7162         $myhostname$mydomain|$myhostname) ;;
7163         *)
7164                 case "$phostname" in
7165                 sed*)
7166                         echo "(That doesn't agree with your whoami.h file, by the way.)"
7167                         ;;
7168                 *)
7169                         echo "(That doesn't agree with your $phostname command, by the way.)"
7170                         ;;
7171                 esac
7172         ;;
7173         esac
7174         ;;
7175 esac
7176
7177 $cat <<EOM
7178
7179 I need to get your e-mail address in Internet format if possible, i.e.
7180 something like user@host.domain. Please answer accurately since I have
7181 no easy means to double check it. The default value provided below
7182 is most probably close to reality but may not be valid from outside
7183 your organization...
7184
7185 EOM
7186 cont=x
7187 while test "$cont"; do
7188         case "$cf_email" in
7189         '') dflt="$cf_by@$myhostname$mydomain";;
7190         *) dflt="$cf_email";;
7191         esac
7192         rp='What is your e-mail address?'
7193         . ./myread
7194         cf_email="$ans"
7195         case "$cf_email" in
7196         *@*.*) cont='' ;;
7197         *)
7198                 rp='Address does not look like an Internet one.  Use it anyway?'
7199                 case "$fastread" in
7200                 yes) dflt=y ;;
7201                 *) dflt=n ;;
7202                 esac
7203                 . ./myread
7204                 case "$ans" in
7205                 y*) cont='' ;;
7206                 *) echo " " ;;
7207                 esac
7208                 ;;
7209         esac
7210 done
7211
7212 $cat <<EOM
7213
7214 If you or somebody else will be maintaining perl at your site, please
7215 fill in the correct e-mail address here so that they may be contacted
7216 if necessary. Currently, the "perlbug" program included with perl
7217 will send mail to this address in addition to perlbug@perl.com. You may
7218 enter "none" for no administrator.
7219
7220 EOM
7221 case "$perladmin" in
7222 '') dflt="$cf_email";;
7223 *) dflt="$perladmin";;
7224 esac
7225 rp='Perl administrator e-mail address'
7226 . ./myread
7227 perladmin="$ans"
7228
7229 : figure out how to guarantee perl startup
7230 case "$startperl" in
7231 '')
7232         case "$sharpbang" in
7233         *!)
7234                 $cat <<EOH
7235
7236 I can use the #! construct to start perl on your system. This will
7237 make startup of perl scripts faster, but may cause problems if you
7238 want to share those scripts and perl is not in a standard place
7239 ($binexp/perl) on all your platforms. The alternative is to force
7240 a shell by starting the script with a single ':' character.
7241
7242 EOH
7243                 dflt="$binexp/perl"
7244                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
7245                 . ./myread
7246                 case "$ans" in
7247                 none)   startperl=": # use perl";;
7248                 *)      startperl="#!$ans"
7249                         if $test 30 -lt `echo "$ans" | wc -c`; then
7250                                 $cat >&4 <<EOM
7251
7252 WARNING:  Some systems limit the #! command to 32 characters.
7253 If you experience difficulty running Perl scripts with #!, try
7254 installing Perl in a directory with a shorter pathname.
7255
7256 EOM
7257                         fi ;;
7258                 esac
7259                 ;;
7260         *) startperl=": # use perl"
7261                 ;;
7262         esac
7263         ;;
7264 esac
7265 echo "I'll use $startperl to start perl scripts."
7266
7267 : figure best path for perl in scripts
7268 case "$perlpath" in
7269 '')
7270         perlpath="$binexp/perl"
7271         case "$startperl" in
7272         *!*) ;;
7273         *)
7274                 $cat <<EOH
7275
7276 I will use the "eval 'exec'" idiom to start Perl on your system.
7277 I can use the full path of your Perl binary for this purpose, but
7278 doing so may cause problems if you want to share those scripts and
7279 Perl is not always in a standard place ($binexp/perl).
7280
7281 EOH
7282                 dflt="$binexp/perl"
7283                 rp="What path shall I use in \"eval 'exec'\"?"
7284                 . ./myread
7285                 perlpath="$ans"
7286                 ;;
7287         esac
7288         ;;
7289 esac
7290 case "$startperl" in
7291 *!*)    ;;
7292 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
7293 esac
7294
7295 : determine where public executable scripts go
7296 set scriptdir scriptdir
7297 eval $prefixit
7298 case "$scriptdir" in
7299 '')
7300         dflt="$bin"
7301         : guess some guesses
7302         $test -d /usr/share/scripts && dflt=/usr/share/scripts
7303         $test -d /usr/share/bin     && dflt=/usr/share/bin
7304         $test -d /usr/local/script  && dflt=/usr/local/script
7305         $test -d /usr/local/scripts && dflt=/usr/local/scripts
7306         $test -d $prefixexp/script  && dflt=$prefixexp/script
7307         set dflt
7308         eval $prefixup
7309         ;;
7310 *)  dflt="$scriptdir"
7311         ;;
7312 esac
7313 $cat <<EOM
7314  
7315 Some installations have a separate directory just for executable scripts so
7316 that they can mount it across multiple architectures but keep the scripts in
7317 one spot.  You might, for example, have a subdirectory of /usr/share for this.
7318 Or you might just lump your scripts in with all your other executables.
7319  
7320 EOM
7321 fn=d~
7322 rp='Where do you keep publicly executable scripts?'
7323 . ./getfile
7324 if $test "X$ansexp" != "X$scriptdirexp"; then
7325         installscript=''
7326 fi
7327 scriptdir="$ans"
7328 scriptdirexp="$ansexp"
7329 : Change installation prefix, if necessary.
7330 if $test X"$prefix" != X"$installprefix"; then
7331         installscript=`echo $scriptdirexp | sed "s#^$prefix#$installprefix#"`
7332 else
7333         installscript="$scriptdirexp"
7334 fi
7335
7336 : determine where add-on public executables go
7337 case "$sitebin" in
7338 '')     dflt=$siteprefix/bin ;;
7339 *)      dflt=$sitebin ;;
7340 esac
7341 fn=d~
7342 rp='Pathname where the add-on public executables should be installed?'
7343 . ./getfile
7344 sitebin="$ans"
7345 sitebinexp="$ansexp"
7346 : Change installation prefix, if necessary.
7347 if $test X"$prefix" != X"$installprefix"; then
7348         installsitebin=`echo $sitebinexp | sed "s#^$prefix#$installprefix#"`
7349 else
7350         installsitebin="$sitebinexp"
7351 fi
7352
7353 : see if sqrtl exists
7354 set sqrtl d_sqrtl
7355 eval $inlibc
7356
7357 case "$ccflags" in
7358 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
7359 esac
7360
7361 case "$uselongdouble" in
7362 $define|true|[yY]*)     dflt='y';;
7363 *) dflt='n';;
7364 esac
7365 cat <<EOM
7366
7367 Perl can be built to take advantage of long doubles which
7368 (if available) may give more accuracy and range for floating point numbers.
7369
7370 If this doesn't make any sense to you, just accept the default '$dflt'.
7371 EOM
7372 rp='Try to use long doubles if available?'
7373 . ./myread
7374 case "$ans" in
7375 y|Y)    val="$define"   ;;
7376 *)      val="$undef"    ;;
7377 esac
7378 set uselongdouble
7379 eval $setvar
7380
7381 case "$uselongdouble" in
7382 true|[yY]*) uselongdouble="$define" ;;
7383 esac
7384
7385 case "$uselongdouble" in
7386 $define)
7387 : Look for a hint-file generated 'call-back-unit'.  If the
7388 : user has specified that long doubles should be used,
7389 : we may need to set or change some other defaults.
7390         if $test -f uselongdouble.cbu; then
7391                 echo "Your platform has some specific hints for long doubles, using them..."
7392                 . ./uselongdouble.cbu
7393         else
7394                 $cat <<EOM
7395 (Your platform doesn't have any specific hints for long doubles.)
7396 EOM
7397         fi
7398         ;;
7399 esac
7400
7401 case "$uselongdouble:$d_sqrtl" in
7402 $define:$undef)
7403                 $cat <<EOM >&4
7404
7405 *** You requested the use of long doubles but you do not seem to have
7406 *** the mathematic functions for long doubles.  I'm disabling the use
7407 *** of long doubles.
7408
7409 EOM
7410         uselongdouble=$undef
7411         ;;
7412 esac
7413
7414 case "$useperlio" in
7415 $define|true|[yY]*)     dflt='y';;
7416 *) dflt='n';;
7417 esac
7418 cat <<EOM
7419
7420 Previous version of $package used the standard IO mechanisms as defined
7421 in <stdio.h>.  Versions 5.003_02 and later of perl allow alternate IO
7422 mechanisms via a "PerlIO" abstraction, but the stdio mechanism is still
7423 the default.  This abstraction layer can use AT&T's sfio (if you already
7424 have sfio installed) or regular stdio.  Using PerlIO with sfio may cause
7425 problems with some extension modules.  Using PerlIO with stdio is safe,
7426 but it is slower than plain stdio and therefore is not the default.
7427
7428 If this doesn't make any sense to you, just accept the default '$dflt'.
7429 EOM
7430 rp='Use the experimental PerlIO abstraction layer?'
7431 . ./myread
7432 case "$ans" in
7433 y|Y) 
7434         val="$define"
7435         ;;     
7436 *)      
7437         echo "Ok, doing things the stdio way"
7438         val="$undef"
7439         ;;
7440 esac
7441 set useperlio
7442 eval $setvar 
7443
7444 case "$vendorprefix" in
7445 '')     d_vendorbin="$undef"
7446         vendorbin=''
7447         vendorbinexp=''
7448         ;;
7449 *)      d_vendorbin="$define"
7450         : determine where vendor-supplied executables go.
7451         case "$vendorbin" in
7452         '') dflt=$vendorprefix/bin ;;
7453         *)      dflt="$vendorbin" ;;
7454         esac
7455         fn=d~+
7456         rp='Pathname for the vendor-supplied executables directory?'
7457         . ./getfile
7458         vendorbin="$ans"
7459         vendorbinexp="$ansexp"
7460         ;;
7461 esac
7462 : Change installation prefix, if necessary.
7463 if $test X"$prefix" != X"$installprefix"; then
7464         installvendorbin=`echo $vendorbinexp | $sed "s#^$prefix#$installprefix#"`
7465 else
7466         installvendorbin="$vendorbinexp"
7467 fi
7468
7469 : see if qgcvt exists
7470 set qgcvt d_qgcvt
7471 eval $inlibc
7472
7473 : check for length of double
7474 echo " "
7475 case "$doublesize" in
7476 '')
7477         echo "Checking to see how big your double precision numbers are..." >&4
7478         $cat >try.c <<'EOCP'
7479 #include <stdio.h>
7480 int main()
7481 {
7482     printf("%d\n", (int)sizeof(double));
7483     exit(0);
7484 }
7485 EOCP
7486         set try
7487         if eval $compile_ok; then
7488                 doublesize=`./try`
7489                 echo "Your double is $doublesize bytes long."
7490         else
7491                 dflt='8'
7492                 echo "(I can't seem to compile the test program.  Guessing...)"
7493                 rp="What is the size of a double precision number (in bytes)?"
7494                 . ./myread
7495                 doublesize="$ans"
7496         fi
7497         ;;
7498 esac
7499 $rm -f try.c try
7500
7501 : check for long doubles
7502 echo " "
7503 echo "Checking to see if you have long double..." >&4
7504 echo 'int main() { long double x = 7.0; }' > try.c
7505 set try
7506 if eval $compile; then
7507         val="$define"
7508         echo "You have long double."
7509 else
7510         val="$undef"
7511         echo "You do not have long double."
7512 fi
7513 $rm try.*
7514 set d_longdbl
7515 eval $setvar
7516
7517 : check for length of long double
7518 case "${d_longdbl}${longdblsize}" in
7519 $define)
7520         echo " "
7521         echo "Checking to see how big your long doubles are..." >&4
7522         $cat >try.c <<'EOCP'
7523 #include <stdio.h>
7524 int main()
7525 {
7526         printf("%d\n", sizeof(long double));
7527 }
7528 EOCP
7529         set try
7530         set try
7531         if eval $compile; then
7532                 longdblsize=`./try$exe_ext`
7533                 echo "Your long doubles are $longdblsize bytes long."
7534         else
7535                 dflt='8'
7536                 echo " "
7537                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
7538                 rp="What is the size of a long double (in bytes)?"
7539                 . ./myread
7540                 longdblsize="$ans"
7541         fi
7542         if $test "X$doublesize" = "X$longdblsize"; then
7543                 echo "(That isn't any different from an ordinary double.)"
7544         fi      
7545         ;;
7546 esac
7547 $rm -f try.* try
7548
7549 echo " "
7550
7551 if $test X"$d_longdbl" = X"$define"; then
7552
7553 echo "Checking how to print long doubles..." >&4
7554
7555 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
7556         $cat >try.c <<'EOCP'
7557 #include <sys/types.h>
7558 #include <stdio.h>
7559 int main() {
7560   double d = 123.456;
7561   printf("%.3f\n", d);
7562 }
7563 EOCP
7564         set try
7565         if eval $compile; then
7566                 yyy=`./try$exe_ext`
7567                 case "$yyy" in
7568                 123.456)
7569                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
7570                         sPRIFldbl='"F"'; sPRIGldbl='"G"'; sPRIEldbl='"E"';
7571                         echo "We will use %f."
7572                         ;;
7573                 esac
7574         fi
7575 fi
7576
7577 if $test X"$sPRIfldbl" = X; then
7578         $cat >try.c <<'EOCP'
7579 #include <sys/types.h>
7580 #include <stdio.h>
7581 int main() {
7582   long double d = 123.456;
7583   printf("%.3llf\n", d);
7584 }
7585 EOCP
7586         set try
7587         if eval $compile; then
7588                 yyy=`./try$exe_ext`
7589                 case "$yyy" in
7590                 123.456)
7591                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
7592                         sPRIFldbl='"llF"'; sPRIGldbl='"llG"'; sPRIEldbl='"llE"';
7593                         echo "We will use %llf."
7594                         ;;
7595                 esac
7596         fi
7597 fi
7598
7599 if $test X"$sPRIfldbl" = X; then
7600         $cat >try.c <<'EOCP'
7601 #include <sys/types.h>
7602 #include <stdio.h>
7603 int main() {
7604   long double d = 123.456;
7605   printf("%.3Lf\n", d);
7606 }
7607 EOCP
7608         set try
7609         if eval $compile; then
7610                 yyy=`./try$exe_ext`
7611                 case "$yyy" in
7612                 123.456)
7613                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
7614                         sPRIFldbl='"LF"'; sPRIGldbl='"LG"'; sPRIEldbl='"LE"';
7615                         echo "We will use %Lf."
7616                         ;;
7617                 esac
7618         fi
7619 fi
7620
7621 if $test X"$sPRIfldbl" = X; then
7622         $cat >try.c <<'EOCP'
7623 #include <sys/types.h>
7624 #include <stdio.h>
7625 int main() {
7626   long double d = 123.456;
7627   printf("%.3lf\n", d);
7628 }
7629 EOCP
7630         set try
7631         if eval $compile; then
7632                 yyy=`./try$exe_ext`
7633                 case "$yyy" in
7634                 123.456)
7635                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
7636                         sPRIFldbl='"lF"'; sPRIGldbl='"lG"'; sPRIEldbl='"lE"';
7637                         echo "We will use %lf."
7638                         ;;
7639                 esac
7640         fi
7641 fi
7642
7643 if $test X"$sPRIfldbl" = X; then
7644         echo "Cannot figure out how to print long doubles." >&4
7645 fi
7646
7647 $rm -f try try.*
7648
7649 fi # d_longdbl
7650
7651 case "$sPRIfldbl" in
7652 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef"; 
7653         d_PRIFldbl="$undef"; d_PRIGldbl="$undef"; d_PRIEldbl="$undef"; 
7654         ;;
7655 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define"; 
7656         d_PRIFldbl="$define"; d_PRIGldbl="$define"; d_PRIEldbl="$define"; 
7657         ;;
7658 esac
7659
7660 : Check how to convert floats to strings.
7661 if test "X$d_Gconvert" = X; then
7662         echo " "
7663         echo "Checking for an efficient way to convert floats to strings."
7664         echo " " > try.c
7665         case "$uselongdouble" in
7666         "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
7667         esac
7668         case "$d_longdbl" in
7669         "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
7670         esac
7671         case "$d_PRIgldbl" in
7672         "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
7673         esac
7674         $cat >>try.c <<EOP
7675 #ifdef TRY_gconvert
7676 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
7677 char *myname = "gconvert";
7678 #endif
7679 #ifdef TRY_gcvt
7680 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
7681 char *myname = "gcvt";
7682 #endif
7683 #ifdef TRY_qgcvt
7684 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
7685 char *myname = "qgcvt";
7686 #define DOUBLETYPE long double
7687 #endif
7688 #ifdef TRY_sprintf
7689 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE) && defined(HAS_PRIgldbl)
7690 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
7691 #else
7692 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
7693 #endif
7694 char *myname = "sprintf";
7695 #endif
7696
7697 #ifndef DOUBLETYPE
7698 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
7699 #define DOUBLETYPE long double
7700 #else
7701 #define DOUBLETYPE double
7702 #endif
7703 #endif
7704
7705 #include <stdio.h>
7706
7707 #define I_STDLIB $i_stdlib
7708 #ifdef I_STDLIB
7709 #include <stdlib.h>
7710 #endif
7711
7712 int
7713 checkit(expect, got)
7714 char *expect;
7715 char *got;
7716 {
7717     if (strcmp(expect, got)) {
7718                 printf("%s oddity:  Expected %s, got %s\n",
7719                         myname, expect, got);
7720                 exit(1);
7721         }
7722 }
7723
7724 int main()
7725
7726         char buf[64]; 
7727         buf[63] = '\0';
7728
7729         /* This must be 1st test on (which?) platform */
7730         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
7731         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
7732         checkit("0.1", buf);
7733
7734         Gconvert((DOUBLETYPE)1.0, 8, 0, buf); 
7735         checkit("1", buf);
7736
7737         Gconvert((DOUBLETYPE)1.1, 8, 0, buf); 
7738         checkit("1.1", buf);
7739
7740         Gconvert((DOUBLETYPE)1.01, 8, 0, buf); 
7741         checkit("1.01", buf);
7742
7743         Gconvert((DOUBLETYPE)1.001, 8, 0, buf); 
7744         checkit("1.001", buf);
7745
7746         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf); 
7747         checkit("1.0001", buf);
7748
7749         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf); 
7750         checkit("1.00001", buf);
7751
7752         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf); 
7753         checkit("1.000001", buf);
7754
7755         Gconvert((DOUBLETYPE)0.0, 8, 0, buf); 
7756         checkit("0", buf);
7757
7758         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf); 
7759         checkit("-1", buf);
7760
7761         /* Some Linux gcvt's give 1.e+5 here. */
7762         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf); 
7763         checkit("100000", buf);
7764         
7765         /* Some Linux gcvt's give -1.e+5 here. */
7766         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf); 
7767         checkit("-100000", buf);
7768
7769         exit(0);
7770 }
7771 EOP
7772         case "$d_Gconvert" in
7773         gconvert*) xxx_list='gconvert gcvt sprintf' ;;
7774         gcvt*) xxx_list='gcvt gconvert sprintf' ;;
7775         sprintf*) xxx_list='sprintf gconvert gcvt' ;;
7776         *) xxx_list='gconvert gcvt sprintf' ;;
7777         esac
7778
7779         case "$d_longdbl$uselongdouble$d_qgcvt" in
7780         "$define$define$define") xxx_list="`echo $xxx_list|sed 's/gcvt/qgcvt gcvt/'`" ;;
7781         esac
7782
7783         for xxx_convert in $xxx_list; do
7784                 echo "Trying $xxx_convert..."
7785                 $rm -f try try$_o
7786                 set try -DTRY_$xxx_convert
7787                 if eval $compile; then
7788                         echo "$xxx_convert() found." >&4
7789                         if ./try; then
7790                                 echo "I'll use $xxx_convert to convert floats into a string." >&4
7791                                 break;
7792                         else
7793                                 echo "...But $xxx_convert didn't work as I expected."
7794                         fi
7795                 else
7796                         echo "$xxx_convert NOT found." >&4
7797                 fi
7798         done
7799                 
7800         case "$xxx_convert" in
7801         gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
7802         gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
7803         qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
7804         *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
7805            "$define$define$define")
7806               d_Gconvert="sprintf((b),\"%.*$sPRIgldbl\",(n),(x))" ;;
7807            *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
7808            esac
7809            ;;  
7810         esac
7811 fi
7812
7813 : Initialize h_fcntl
7814 h_fcntl=false
7815
7816 : Initialize h_sysfile
7817 h_sysfile=false
7818
7819 : access call always available on UNIX
7820 set access d_access
7821 eval $inlibc
7822
7823 : locate the flags for 'access()'
7824 case "$d_access" in
7825 "$define")
7826         echo " "
7827         $cat >access.c <<'EOCP'
7828 #include <sys/types.h>
7829 #ifdef I_FCNTL
7830 #include <fcntl.h>
7831 #endif
7832 #ifdef I_SYS_FILE
7833 #include <sys/file.h>
7834 #endif
7835 #ifdef I_UNISTD
7836 #include <unistd.h>
7837 #endif
7838 int main() {
7839         exit(R_OK);
7840 }
7841 EOCP
7842         : check sys/file.h first, no particular reason here
7843         if $test `./findhdr sys/file.h` && \
7844                 $cc $cppflags -DI_SYS_FILE -o access access.c >/dev/null 2>&1 ; then
7845                 h_sysfile=true;
7846                 echo "<sys/file.h> defines the *_OK access constants." >&4
7847         elif $test `./findhdr fcntl.h` && \
7848                 $cc $cppflags -DI_FCNTL -o access access.c >/dev/null 2>&1 ; then
7849                 h_fcntl=true;
7850                 echo "<fcntl.h> defines the *_OK access constants." >&4
7851         elif $test `./findhdr unistd.h` && \
7852                 $cc $cppflags -DI_UNISTD -o access access.c >/dev/null 2>&1 ; then
7853                 echo "<unistd.h> defines the *_OK access constants." >&4
7854         else
7855                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
7856         fi
7857         ;;
7858 esac
7859 $rm -f access*
7860
7861 : see if accessx exists
7862 set accessx d_accessx
7863 eval $inlibc
7864
7865 : see if alarm exists
7866 set alarm d_alarm
7867 eval $inlibc
7868
7869 : see if atolf exists
7870 set atolf d_atolf
7871 eval $inlibc
7872
7873 : see if atoll exists
7874 set atoll d_atoll
7875 eval $inlibc
7876
7877 : Look for GNU-cc style attribute checking
7878 echo " "
7879 echo "Checking whether your compiler can handle __attribute__ ..." >&4
7880 $cat >attrib.c <<'EOCP'
7881 #include <stdio.h>
7882 void croak (char* pat,...) __attribute__((format(printf,1,2),noreturn));
7883 EOCP
7884 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
7885         if $contains 'warning' attrib.out >/dev/null 2>&1; then
7886                 echo "Your C compiler doesn't fully support __attribute__."
7887                 val="$undef"
7888         else
7889                 echo "Your C compiler supports __attribute__."
7890                 val="$define"
7891         fi
7892 else
7893         echo "Your C compiler doesn't seem to understand __attribute__ at all."
7894         val="$undef"
7895 fi
7896 set d_attribut
7897 eval $setvar
7898 $rm -f attrib*
7899
7900 : see if bcmp exists
7901 set bcmp d_bcmp
7902 eval $inlibc
7903
7904 : see if bcopy exists
7905 set bcopy d_bcopy
7906 eval $inlibc
7907
7908 : see if this is a unistd.h system
7909 set unistd.h i_unistd
7910 eval $inhdr
7911
7912 : see if getpgrp exists
7913 set getpgrp d_getpgrp
7914 eval $inlibc
7915
7916 case "$d_getpgrp" in
7917 "$define")
7918         echo " "
7919         echo "Checking to see which flavor of getpgrp is in use..."
7920         $cat >set.c <<EOP
7921 #$i_unistd I_UNISTD
7922 #include <sys/types.h>
7923 #ifdef I_UNISTD
7924 #  include <unistd.h>
7925 #endif
7926 int main()
7927 {
7928         if (getuid() == 0) {
7929                 printf("(I see you are running Configure as super-user...)\n");
7930                 setuid(1);
7931         }
7932 #ifdef TRY_BSD_PGRP
7933         if (getpgrp(1) == 0)
7934                 exit(0);
7935 #else
7936         if (getpgrp() > 0)
7937                 exit(0);
7938 #endif
7939         exit(1);
7940 }
7941 EOP
7942         if $cc -DTRY_BSD_PGRP $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7943                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
7944                 val="$define"
7945         elif $cc $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7946                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
7947                 val="$undef"
7948         else
7949                 echo "I can't seem to compile and run the test program."
7950                 if ./usg; then
7951                         xxx="a USG one, i.e. you use getpgrp()."
7952                 else
7953                         # SVR4 systems can appear rather BSD-ish.
7954                         case "$i_unistd" in
7955                         $undef)
7956                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
7957                                 val="$define"
7958                                 ;;
7959                         $define)
7960                                 xxx="probably a USG one, i.e. you use getpgrp()."
7961                                 val="$undef"
7962                                 ;;
7963                         esac
7964                 fi
7965                 echo "Assuming your getpgrp is $xxx" >&4
7966         fi
7967         ;;
7968 *) val="$undef";;
7969 esac
7970 set d_bsdgetpgrp
7971 eval $setvar
7972 $rm -f set set.c
7973
7974 : see if setpgrp exists
7975 set setpgrp d_setpgrp
7976 eval $inlibc
7977
7978 case "$d_setpgrp" in
7979 "$define")
7980         echo " "
7981         echo "Checking to see which flavor of setpgrp is in use..."
7982         $cat >set.c <<EOP
7983 #$i_unistd I_UNISTD
7984 #include <sys/types.h>
7985 #ifdef I_UNISTD
7986 #  include <unistd.h>
7987 #endif
7988 int main()
7989 {
7990         if (getuid() == 0) {
7991                 printf("(I see you are running Configure as super-user...)\n");
7992                 setuid(1);
7993         }
7994 #ifdef TRY_BSD_PGRP
7995         if (-1 == setpgrp(1, 1))
7996                 exit(0);
7997 #else
7998         if (setpgrp() != -1)
7999                 exit(0);
8000 #endif
8001         exit(1);
8002 }
8003 EOP
8004         if $cc -DTRY_BSD_PGRP $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
8005                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
8006                 val="$define"
8007         elif $cc $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
8008                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
8009                 val="$undef"
8010         else
8011                 echo "(I can't seem to compile and run the test program.)"
8012                 if ./usg; then
8013                         xxx="a USG one, i.e. you use setpgrp()."
8014                 else
8015                         # SVR4 systems can appear rather BSD-ish.
8016                         case "$i_unistd" in
8017                         $undef)
8018                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
8019                                 val="$define"
8020                                 ;;
8021                         $define)
8022                                 xxx="probably a USG one, i.e. you use setpgrp()."
8023                                 val="$undef"
8024                                 ;;
8025                         esac
8026                 fi
8027                 echo "Assuming your setpgrp is $xxx" >&4
8028         fi
8029         ;;
8030 *) val="$undef";;
8031 esac
8032 set d_bsdsetpgrp
8033 eval $setvar
8034 $rm -f set set.c
8035 : see if bzero exists
8036 set bzero d_bzero
8037 eval $inlibc
8038
8039 : see if signal is declared as pointer to function returning int or void
8040 echo " "
8041 xxx=`./findhdr signal.h`
8042 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
8043 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
8044         echo "You have int (*signal())() instead of void." >&4
8045         val="$undef"
8046 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
8047         echo "You have void (*signal())()." >&4
8048         val="$define"
8049 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
8050         echo "You have int (*signal())() instead of void." >&4
8051         val="$undef"
8052 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
8053         echo "You have void (*signal())()." >&4
8054         val="$define"
8055 else
8056         case "$d_voidsig" in
8057         '')
8058         echo "I can't determine whether signal handler returns void or int..." >&4
8059                 dflt=void
8060                 rp="What type does your signal handler return?"
8061                 . ./myread
8062                 case "$ans" in
8063                 v*) val="$define";;
8064                 *) val="$undef";;
8065                 esac;;
8066         "$define")
8067                 echo "As you already told me, signal handler returns void." >&4
8068                 val="$define"
8069                 ;;
8070         *)      echo "As you already told me, signal handler returns int." >&4
8071                 val="$undef"
8072                 ;;
8073         esac
8074 fi
8075 set d_voidsig
8076 eval $setvar
8077 case "$d_voidsig" in
8078 "$define") signal_t="void";;
8079 *) signal_t="int";;
8080 esac
8081 $rm -f $$.tmp
8082
8083 : check for ability to cast large floats to 32-bit ints.
8084 echo " "
8085 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
8086 if $test "$intsize" -ge 4; then
8087         xxx=int
8088 else
8089         xxx=long
8090 fi
8091 $cat >try.c <<EOCP
8092 #include <stdio.h>
8093 #include <sys/types.h>
8094 #include <signal.h>
8095 $signal_t blech(s) int s; { exit(3); }
8096 int main()
8097 {
8098         $xxx i32;
8099         double f, g;
8100         int result = 0;
8101         char str[16];
8102         signal(SIGFPE, blech);
8103
8104         /* Don't let compiler optimize the test away.  Store the number 
8105            in a writable string for gcc to pass to sscanf under HP/UX.
8106         */
8107         sprintf(str, "2147483647");
8108         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
8109         g = 10 * f;
8110         i32  = ($xxx) g;
8111
8112         /* x86 processors will probably give 0x8000 0000, which is a
8113        sign change.  We don't want that.  We want to mimic SPARC
8114            behavior here, which is to preserve the sign and give
8115            back 0x7fff ffff.
8116         */
8117         if (i32 != ($xxx) f)
8118                 result |= 1;
8119         exit(result);
8120 }
8121 EOCP
8122 set try
8123 if eval $compile_ok; then
8124         ./try
8125         yyy=$?
8126 else
8127         echo "(I can't seem to compile the test program--assuming it can't)"
8128         yyy=1
8129 fi
8130 case "$yyy" in
8131 0)      val="$define"
8132         echo "Yup, it can."
8133         ;;
8134 *)      val="$undef"
8135         echo "Nope, it can't."
8136         ;;
8137 esac
8138 set d_casti32
8139 eval $setvar
8140 $rm -f try try.*
8141
8142 : check for ability to cast negative floats to unsigned
8143 echo " "
8144 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
8145 $cat >try.c <<EOCP
8146 #include <stdio.h>
8147 #include <sys/types.h>
8148 #include <signal.h>
8149 $signal_t blech(s) int s; { exit(7); }
8150 $signal_t blech_in_list(s) int s; { exit(4); }
8151 unsigned long dummy_long(p) unsigned long p; { return p; }
8152 unsigned int dummy_int(p) unsigned int p; { return p; }
8153 unsigned short dummy_short(p) unsigned short p; { return p; }
8154 int main()
8155 {
8156         double f;
8157         unsigned long along;
8158         unsigned int aint;
8159         unsigned short ashort;
8160         int result = 0;
8161         char str[16];
8162         
8163         /* Frustrate gcc-2.7.2's optimizer which failed this test with
8164            a direct f = -123. assignment.  gcc-2.8.0 reportedly
8165            optimized the whole file away
8166         */
8167         /* Store the number in a writable string for gcc to pass to 
8168            sscanf under HP/UX.
8169         */
8170         sprintf(str, "-123");
8171         sscanf(str, "%lf", &f);  /* f = -123.; */
8172
8173         signal(SIGFPE, blech);
8174         along = (unsigned long)f;
8175         aint = (unsigned int)f;
8176         ashort = (unsigned short)f;
8177         if (along != (unsigned long)-123)
8178                 result |= 1;
8179         if (aint != (unsigned int)-123)
8180                 result |= 1;
8181         if (ashort != (unsigned short)-123)
8182                 result |= 1;
8183         sprintf(str, "1073741824.");
8184         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
8185         f = f + f;
8186         along = 0;
8187         along = (unsigned long)f;
8188         if (along != 0x80000000)
8189                 result |= 2;
8190         f -= 1.;
8191         along = 0;
8192         along = (unsigned long)f;
8193         if (along != 0x7fffffff)
8194                 result |= 1;
8195         f += 2.;
8196         along = 0;
8197         along = (unsigned long)f;
8198         if (along != 0x80000001)
8199                 result |= 2;
8200         if (result)
8201                 exit(result);
8202         signal(SIGFPE, blech_in_list);
8203         sprintf(str, "123.");
8204         sscanf(str, "%lf", &f);  /* f = 123.; */
8205         along = dummy_long((unsigned long)f);
8206         aint = dummy_int((unsigned int)f);
8207         ashort = dummy_short((unsigned short)f);
8208         if (along != (unsigned long)123)
8209                 result |= 4;
8210         if (aint != (unsigned int)123)
8211                 result |= 4;
8212         if (ashort != (unsigned short)123)
8213                 result |= 4;
8214         exit(result);
8215
8216 }
8217 EOCP
8218 set try
8219 if eval $compile_ok; then
8220         ./try
8221         castflags=$?
8222 else
8223         echo "(I can't seem to compile the test program--assuming it can't)"
8224         castflags=7
8225 fi
8226 case "$castflags" in
8227 0)      val="$define"
8228         echo "Yup, it can."
8229         ;;
8230 *)      val="$undef"
8231         echo "Nope, it can't."
8232         ;;
8233 esac
8234 set d_castneg
8235 eval $setvar
8236 $rm -f try.*
8237
8238 : see if vprintf exists
8239 echo " "
8240 if set vprintf val -f d_vprintf; eval $csym; $val; then
8241         echo 'vprintf() found.' >&4
8242         val="$define"
8243         $cat >vprintf.c <<'EOF'
8244 #include <varargs.h>
8245
8246 int main() { xxx("foo"); }
8247
8248 xxx(va_alist)
8249 va_dcl
8250 {
8251         va_list args;
8252         char buf[10];
8253
8254         va_start(args);
8255         exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
8256 }
8257 EOF
8258         set vprintf
8259         if eval $compile && ./vprintf; then
8260                 echo "Your vsprintf() returns (int)." >&4
8261                 val2="$undef"
8262         else
8263                 echo "Your vsprintf() returns (char*)." >&4
8264                 val2="$define"
8265         fi
8266 else
8267         echo 'vprintf() NOT found.' >&4
8268                 val="$undef"
8269                 val2="$undef"
8270 fi
8271 set d_vprintf
8272 eval $setvar
8273 val=$val2
8274 set d_charvspr
8275 eval $setvar
8276
8277 : see if chown exists
8278 set chown d_chown
8279 eval $inlibc
8280
8281 : see if chroot exists
8282 set chroot d_chroot
8283 eval $inlibc
8284
8285 : see if chsize exists
8286 set chsize d_chsize
8287 eval $inlibc
8288
8289 : check for const keyword
8290 echo " "
8291 echo 'Checking to see if your C compiler knows about "const"...' >&4
8292 $cat >const.c <<'EOCP'
8293 typedef struct spug { int drokk; } spug;
8294 int main()
8295 {
8296         const char *foo;
8297         const spug y;
8298 }
8299 EOCP
8300 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
8301         val="$define"
8302         echo "Yup, it does."
8303 else
8304         val="$undef"
8305         echo "Nope, it doesn't."
8306 fi
8307 set d_const
8308 eval $setvar
8309
8310 : see if crypt exists
8311 echo " "
8312 if set crypt val -f d_crypt; eval $csym; $val; then
8313         echo 'crypt() found.' >&4
8314         val="$define"
8315         cryptlib=''
8316 else
8317         cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
8318         if $test -z "$cryptlib"; then
8319                 cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
8320         else
8321                 cryptlib=-lcrypt
8322         fi
8323         if $test -z "$cryptlib"; then
8324                 cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
8325         else
8326                 cryptlib=-lcrypt
8327         fi
8328         if $test -z "$cryptlib"; then
8329                 cryptlib=`./loc libcrypt$_a "" $libpth`
8330         else
8331                 cryptlib=-lcrypt
8332         fi
8333         if $test -z "$cryptlib"; then
8334                 echo 'crypt() NOT found.' >&4
8335                 val="$undef"
8336         else
8337                 val="$define"
8338         fi
8339 fi
8340 set d_crypt
8341 eval $setvar
8342
8343 : get csh whereabouts
8344 case "$csh" in
8345 'csh') val="$undef" ;;
8346 *) val="$define" ;;
8347 esac
8348 set d_csh
8349 eval $setvar
8350 : Respect a hint or command line value for full_csh.
8351 case "$full_csh" in
8352 '') full_csh=$csh ;;
8353 esac
8354
8355 : see if cuserid exists
8356 set cuserid d_cuserid
8357 eval $inlibc
8358
8359 : see if this is a limits.h system
8360 set limits.h i_limits
8361 eval $inhdr
8362
8363 : see if this is a float.h system
8364 set float.h i_float
8365 eval $inhdr
8366
8367 : See if number of significant digits in a double precision number is known
8368 echo " "
8369 $cat >dbl_dig.c <<EOM
8370 #$i_limits I_LIMITS
8371 #$i_float I_FLOAT
8372 #ifdef I_LIMITS
8373 #include <limits.h>
8374 #endif
8375 #ifdef I_FLOAT
8376 #include <float.h>
8377 #endif
8378 #ifdef DBL_DIG
8379 printf("Contains DBL_DIG");
8380 #endif
8381 EOM
8382 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
8383 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
8384         echo "DBL_DIG found." >&4
8385         val="$define"
8386 else
8387         echo "DBL_DIG NOT found." >&4
8388         val="$undef"
8389 fi
8390 $rm -f dbl_dig.?
8391 set d_dbl_dig
8392 eval $setvar
8393
8394 : see if difftime exists
8395 set difftime d_difftime
8396 eval $inlibc
8397
8398 : see if this is a dirent system
8399 echo " "
8400 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
8401         val="$define"
8402         echo "<dirent.h> found." >&4
8403 else
8404         val="$undef"
8405         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
8406                 echo "<sys/dir.h> found." >&4
8407                 echo " "
8408         else
8409                 xinc=`./findhdr sys/ndir.h`
8410         fi
8411         echo "<dirent.h> NOT found." >&4
8412 fi
8413 set i_dirent
8414 eval $setvar
8415
8416 : Look for type of directory structure.
8417 echo " "
8418 $cppstdin $cppflags $cppminus < "$xinc" > try.c
8419
8420 case "$direntrytype" in
8421 ''|' ')
8422         case "$i_dirent" in
8423         $define) guess1='struct dirent' ;;
8424         *) guess1='struct direct'  ;;
8425         esac
8426         ;;
8427 *)      guess1="$direntrytype"
8428         ;;
8429 esac
8430
8431 case "$guess1" in
8432 'struct dirent') guess2='struct direct' ;;
8433 *) guess2='struct dirent' ;;
8434 esac
8435                 
8436 if $contains "$guess1" try.c >/dev/null 2>&1; then
8437         direntrytype="$guess1"
8438         echo "Your directory entries are $direntrytype." >&4
8439 elif $contains "$guess2" try.c >/dev/null 2>&1; then
8440         direntrytype="$guess2"
8441         echo "Your directory entries seem to be $direntrytype." >&4
8442 else
8443         echo "I don't recognize your system's directory entries." >&4
8444         rp="What type is used for directory entries on this system?"
8445         dflt="$guess1"
8446         . ./myread
8447         direntrytype="$ans"
8448 fi
8449 $rm -f try.c
8450
8451
8452 : see if the directory entry stores field length
8453 echo " "
8454 $cppstdin $cppflags $cppminus < "$xinc" > try.c
8455 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
8456         echo "Good, your directory entry keeps length information in d_namlen." >&4
8457         val="$define"
8458 else
8459         echo "Your directory entry does not know about the d_namlen field." >&4
8460         val="$undef"
8461 fi
8462 set d_dirnamlen
8463 eval $setvar
8464 $rm -f try.c
8465
8466 : see if dlerror exists
8467 xxx_runnm="$runnm"
8468 runnm=false
8469 set dlerror d_dlerror
8470 eval $inlibc
8471 runnm="$xxx_runnm"
8472
8473 : see if dlfcn is available
8474 set dlfcn.h i_dlfcn
8475 eval $inhdr
8476
8477 case "$usedl" in
8478 $define|y|true)
8479         $cat << EOM
8480
8481 On a few systems, the dynamically loaded modules that perl generates and uses
8482 will need a different extension than shared libs. The default will probably
8483 be appropriate.
8484
8485 EOM
8486         case "$dlext" in
8487         '')     dflt="$so" ;;
8488         *)      dflt="$dlext" ;;
8489         esac
8490         rp='What is the extension of dynamically loaded modules'
8491         . ./myread
8492         dlext="$ans"
8493         ;;
8494 *)
8495         dlext="none"
8496         ;;
8497 esac
8498
8499 : Check if dlsym need a leading underscore
8500 echo " "
8501 val="$undef"
8502
8503 case "$dlsrc" in
8504 dl_dlopen.xs)
8505         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
8506         $cat >dyna.c <<'EOM'
8507 fred () { }
8508 EOM
8509
8510 $cat >fred.c<<EOM
8511
8512 #include <stdio.h>
8513 #$i_dlfcn I_DLFCN
8514 #ifdef I_DLFCN
8515 #include <dlfcn.h>      /* the dynamic linker include file for Sunos/Solaris */
8516 #else
8517 #include <sys/types.h>
8518 #include <nlist.h>
8519 #include <link.h>
8520 #endif
8521
8522 extern int fred() ;
8523
8524 int main()
8525 {
8526     void * handle ;
8527     void * symbol ;
8528 #ifndef RTLD_LAZY
8529     int mode = 1 ;
8530 #else
8531     int mode = RTLD_LAZY ;
8532 #endif
8533     handle = dlopen("./dyna.$dlext", mode) ;
8534     if (handle == NULL) {
8535         printf ("1\n") ;
8536         fflush (stdout) ;
8537         exit(0);
8538     }
8539     symbol = dlsym(handle, "fred") ;
8540     if (symbol == NULL) {
8541         /* try putting a leading underscore */
8542         symbol = dlsym(handle, "_fred") ;
8543         if (symbol == NULL) {
8544             printf ("2\n") ;
8545             fflush (stdout) ;
8546             exit(0);
8547         }
8548         printf ("3\n") ;
8549     }
8550     else
8551         printf ("4\n") ;
8552     fflush (stdout) ;
8553     exit(0);
8554 }
8555 EOM
8556         : Call the object file tmp-dyna.o in case dlext=o.
8557         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 && 
8558                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 && 
8559                 $ld $lddlflags -o dyna.$dlext tmp-dyna${_o} > /dev/null 2>&1 && 
8560                 $cc $ccflags -o fred $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1; then
8561                 xxx=`./fred`
8562                 case $xxx in
8563                 1)      echo "Test program failed using dlopen." >&4
8564                         echo "Perhaps you should not use dynamic loading." >&4;;
8565                 2)      echo "Test program failed using dlsym." >&4
8566                         echo "Perhaps you should not use dynamic loading." >&4;;
8567                 3)      echo "dlsym needs a leading underscore" >&4
8568                         val="$define" ;;
8569                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
8570                 esac
8571         else
8572                 echo "I can't compile and run the test program." >&4
8573                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
8574         fi
8575         ;;
8576 esac
8577                 
8578 $rm -f fred fred.? dyna.$dlext dyna.? tmp-dyna.?
8579
8580 set d_dlsymun
8581 eval $setvar
8582
8583 hasproto='varname=$1; func=$2; shift; shift;
8584 while $test $# -ge 2; do
8585         case "$1" in
8586         $define) echo "#include <$2>";;
8587         esac ;
8588     shift 2;
8589 done > try.c;
8590 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
8591 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
8592         echo "$func() prototype found.";
8593         val="$define";
8594 else
8595         echo "$func() prototype NOT found.";
8596         val="$undef";
8597 fi;
8598 set $varname;
8599 eval $setvar;
8600 $rm -f try.c tryout.c'
8601
8602 : see if prototype for drand48 is available
8603 echo " "
8604 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
8605 eval $hasproto
8606
8607 : see if dup2 exists
8608 set dup2 d_dup2
8609 eval $inlibc
8610
8611 : see if eaccess exists
8612 set eaccess d_eaccess
8613 eval $inlibc
8614
8615 : see if endgrent exists
8616 set endgrent d_endgrent
8617 eval $inlibc
8618
8619 : see if endhostent exists
8620 set endhostent d_endhent
8621 eval $inlibc
8622
8623 : see if endnetent exists
8624 set endnetent d_endnent
8625 eval $inlibc
8626
8627 : see if endprotoent exists
8628 set endprotoent d_endpent
8629 eval $inlibc
8630
8631 : see if endpwent exists
8632 set endpwent d_endpwent
8633 eval $inlibc
8634
8635 : see if endservent exists
8636 set endservent d_endsent
8637 eval $inlibc
8638
8639 : Locate the flags for 'open()'
8640 echo " "
8641 $cat >open3.c <<'EOCP'
8642 #include <sys/types.h>
8643 #ifdef I_FCNTL
8644 #include <fcntl.h>
8645 #endif
8646 #ifdef I_SYS_FILE
8647 #include <sys/file.h>
8648 #endif
8649 int main() {
8650         if(O_RDONLY);
8651 #ifdef O_TRUNC
8652         exit(0);
8653 #else
8654         exit(1);
8655 #endif
8656 }
8657 EOCP
8658 : check sys/file.h first to get FREAD on Sun
8659 if $test `./findhdr sys/file.h` && \
8660                 set open3 -DI_SYS_FILE && eval $compile; then
8661         h_sysfile=true;
8662         echo "<sys/file.h> defines the O_* constants..." >&4
8663         if ./open3; then
8664                 echo "and you have the 3 argument form of open()." >&4
8665                 val="$define"
8666         else
8667                 echo "but not the 3 argument form of open().  Oh, well." >&4
8668                 val="$undef"
8669         fi
8670 elif $test `./findhdr fcntl.h` && \
8671                 set open3 -DI_FCNTL && eval $compile; then
8672         h_fcntl=true;
8673         echo "<fcntl.h> defines the O_* constants..." >&4
8674         if ./open3; then
8675                 echo "and you have the 3 argument form of open()." >&4
8676                 val="$define"
8677         else
8678                 echo "but not the 3 argument form of open().  Oh, well." >&4
8679                 val="$undef"
8680         fi
8681 else
8682         val="$undef"
8683         echo "I can't find the O_* constant definitions!  You got problems." >&4
8684 fi
8685 set d_open3
8686 eval $setvar
8687 $rm -f open3*
8688
8689 : see which of string.h or strings.h is needed
8690 echo " "
8691 strings=`./findhdr string.h`
8692 if $test "$strings" && $test -r "$strings"; then
8693         echo "Using <string.h> instead of <strings.h>." >&4
8694         val="$define"
8695 else
8696         val="$undef"
8697         strings=`./findhdr strings.h`
8698         if $test "$strings" && $test -r "$strings"; then
8699                 echo "Using <strings.h> instead of <string.h>." >&4
8700         else
8701                 echo "No string header found -- You'll surely have problems." >&4
8702         fi
8703 fi
8704 set i_string
8705 eval $setvar
8706 case "$i_string" in
8707 "$undef") strings=`./findhdr strings.h`;;
8708 *)        strings=`./findhdr string.h`;;
8709 esac
8710
8711 : check for non-blocking I/O stuff
8712 case "$h_sysfile" in
8713 true) echo "#include <sys/file.h>" > head.c;;
8714 *)
8715         case "$h_fcntl" in
8716         true) echo "#include <fcntl.h>" > head.c;;
8717         *) echo "#include <sys/fcntl.h>" > head.c;;
8718         esac
8719         ;;
8720 esac
8721 echo " "
8722 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
8723 case "$o_nonblock" in
8724 '')
8725         $cat head.c > try.c
8726         $cat >>try.c <<'EOCP'
8727 #include <stdio.h>
8728 int main() {
8729 #ifdef O_NONBLOCK
8730         printf("O_NONBLOCK\n");
8731         exit(0);
8732 #endif
8733 #ifdef O_NDELAY
8734         printf("O_NDELAY\n");
8735         exit(0);
8736 #endif
8737 #ifdef FNDELAY
8738         printf("FNDELAY\n");
8739         exit(0);
8740 #endif
8741         exit(0);
8742 }
8743 EOCP
8744         set try
8745         if eval $compile_ok; then
8746                 o_nonblock=`./try`
8747                 case "$o_nonblock" in
8748                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
8749                 *) echo "Seems like we can use $o_nonblock.";;
8750                 esac
8751         else
8752                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
8753         fi
8754         ;;
8755 *) echo "Using $hint value $o_nonblock.";;
8756 esac
8757 $rm -f try try.* .out core
8758
8759 echo " "
8760 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
8761 case "$eagain" in
8762 '')
8763         $cat head.c > try.c
8764         $cat >>try.c <<EOCP
8765 #include <errno.h>
8766 #include <sys/types.h>
8767 #include <signal.h>
8768 #include <stdio.h> 
8769 #define MY_O_NONBLOCK $o_nonblock
8770 #ifndef errno  /* XXX need better Configure test */
8771 extern int errno;
8772 #endif
8773 #$i_unistd I_UNISTD
8774 #ifdef I_UNISTD
8775 #include <unistd.h>
8776 #endif
8777 #$i_string I_STRING
8778 #ifdef I_STRING
8779 #include <string.h>
8780 #else
8781 #include <strings.h>
8782 #endif
8783 $signal_t blech(x) int x; { exit(3); }
8784 EOCP
8785         $cat >> try.c <<'EOCP'
8786 int main()
8787 {
8788         int pd[2];
8789         int pu[2];
8790         char buf[1];
8791         char string[100];
8792
8793         pipe(pd);       /* Down: child -> parent */
8794         pipe(pu);       /* Up: parent -> child */
8795         if (0 != fork()) {
8796                 int ret;
8797                 close(pd[1]);   /* Parent reads from pd[0] */
8798                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
8799                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
8800                         exit(1);
8801                 signal(SIGALRM, blech);
8802                 alarm(5);
8803                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
8804                         exit(2);
8805                 sprintf(string, "%d\n", ret);
8806                 write(2, string, strlen(string));
8807                 alarm(0);
8808 #ifdef EAGAIN
8809                 if (errno == EAGAIN) {
8810                         printf("EAGAIN\n");
8811                         goto ok;
8812                 }
8813 #endif
8814 #ifdef EWOULDBLOCK
8815                 if (errno == EWOULDBLOCK)
8816                         printf("EWOULDBLOCK\n");
8817 #endif
8818         ok:
8819                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
8820                 sleep(2);                               /* Give it time to close our pipe */
8821                 alarm(5);
8822                 ret = read(pd[0], buf, 1);      /* Should read EOF */
8823                 alarm(0);
8824                 sprintf(string, "%d\n", ret);
8825                 write(3, string, strlen(string));
8826                 exit(0);
8827         }
8828
8829         close(pd[0]);                   /* We write to pd[1] */
8830         close(pu[1]);                   /* We read from pu[0] */
8831         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
8832         close(pd[1]);                   /* Pipe pd is now fully closed! */
8833         exit(0);                                /* Bye bye, thank you for playing! */
8834 }
8835 EOCP
8836         set try
8837         if eval $compile_ok; then
8838                 echo "$startsh" >mtry
8839                 echo "./try >try.out 2>try.ret 3>try.err || exit 4" >>mtry
8840                 chmod +x mtry
8841                 ./mtry >/dev/null 2>&1
8842                 case $? in
8843                 0) eagain=`$cat try.out`;;
8844                 1) echo "Could not perform non-blocking setting!";;
8845                 2) echo "I did a successful read() for something that was not there!";;
8846                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
8847                 *) echo "Something terribly wrong happened during testing.";;
8848                 esac
8849                 rd_nodata=`$cat try.ret`
8850                 echo "A read() system call with no data present returns $rd_nodata."
8851                 case "$rd_nodata" in
8852                 0|-1) ;;
8853                 *)
8854                         echo "(That's peculiar, fixing that to be -1.)"
8855                         rd_nodata=-1
8856                         ;;
8857                 esac
8858                 case "$eagain" in
8859                 '')
8860                         echo "Forcing errno EAGAIN on read() with no data available."
8861                         eagain=EAGAIN
8862                         ;;
8863                 *)
8864                         echo "Your read() sets errno to $eagain when no data is available."
8865                         ;;
8866                 esac
8867                 status=`$cat try.err`
8868                 case "$status" in
8869                 0) echo "And it correctly returns 0 to signal EOF.";;
8870                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
8871                 *) echo "However, your read() returns '$status' on EOF??";;
8872                 esac
8873                 val="$define"
8874                 if test "$status" = "$rd_nodata"; then
8875                         echo "WARNING: you can't distinguish between EOF and no data!"
8876                         val="$undef"
8877                 fi
8878         else
8879                 echo "I can't compile the test program--assuming errno EAGAIN will do."
8880                 eagain=EAGAIN
8881         fi
8882         set d_eofnblk
8883         eval $setvar
8884         ;;
8885 *)
8886         echo "Using $hint value $eagain."
8887         echo "Your read() returns $rd_nodata when no data is present."
8888         case "$d_eofnblk" in
8889         "$define") echo "And you can see EOF because read() returns 0.";;
8890         "$undef") echo "But you can't see EOF status from read() returned value.";;
8891         *)
8892                 echo "(Assuming you can't see EOF status from read anyway.)"
8893                 d_eofnblk=$undef
8894                 ;;
8895         esac
8896         ;;
8897 esac
8898 $rm -f try try.* .out core head.c mtry
8899
8900 : see if fchmod exists
8901 set fchmod d_fchmod
8902 eval $inlibc
8903
8904 : see if fchown exists
8905 set fchown d_fchown
8906 eval $inlibc
8907
8908 : see if this is an fcntl system
8909 set fcntl d_fcntl
8910 eval $inlibc
8911
8912 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
8913 while $test $# -ge 2; do
8914         case "$1" in
8915         $define) echo "#include <$2>";;
8916         esac ;
8917     shift 2;
8918 done > try.c;
8919 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
8920 set try;
8921 if eval $compile; then
8922         val="$define";
8923 else
8924         val="$undef";
8925 fi;
8926 set $varname;
8927 eval $setvar;
8928 $rm -f try.c try.o'
8929
8930 socketlib=''
8931 sockethdr=''
8932 : see whether socket exists
8933 echo " "
8934 $echo $n "Hmm... $c" >&4
8935 if set socket val -f d_socket; eval $csym; $val; then
8936         echo "Looks like you have Berkeley networking support." >&4
8937         d_socket="$define"
8938         if set setsockopt val -f; eval $csym; $val; then
8939                 d_oldsock="$undef"
8940         else
8941                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
8942                 d_oldsock="$define"
8943         fi
8944 else
8945         if $contains socklib libc.list >/dev/null 2>&1; then
8946                 echo "Looks like you have Berkeley networking support." >&4
8947                 d_socket="$define"
8948                 : we will have to assume that it supports the 4.2 BSD interface
8949                 d_oldsock="$undef"
8950         else
8951                 echo "You don't have Berkeley networking in libc$_a..." >&4
8952                 if test "X$d_socket" = "X$define"; then
8953                    echo "...but you seem to believe that you have sockets." >&4
8954                 else
8955                         for net in net socket
8956                         do
8957                                 if test -f /usr/lib/lib$net$_a; then
8958                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
8959                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
8960                                         if $contains socket libc.list >/dev/null 2>&1; then
8961                                                 d_socket="$define"
8962                                                 socketlib="-l$net"
8963                                                 case "$net" in
8964                                                 net)
8965                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
8966                                                         sockethdr="-I/usr/netinclude"
8967                                                         ;;
8968                                                 esac
8969                                                 echo "Found Berkeley sockets interface in lib$net." >& 4 
8970                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
8971                                                         d_oldsock="$undef"
8972                                                 else
8973                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
8974                                                         d_oldsock="$define"
8975                                                 fi
8976                                                 break
8977                                         fi
8978                                 fi
8979                         done
8980                         if test "X$d_socket" != "X$define"; then
8981                            echo "or anywhere else I see." >&4
8982                            d_socket="$undef"
8983                            d_oldsock="$undef"
8984                         fi
8985                 fi
8986         fi
8987 fi
8988
8989 : see if socketpair exists
8990 set socketpair d_sockpair
8991 eval $inlibc
8992
8993
8994 echo " "
8995 echo "Checking the availability of certain socket constants..." >& 4
8996 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
8997         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
8998         $cat >try.c <<EOF
8999 #include <sys/types.h>
9000 #include <sys/socket.h>
9001 int main() {
9002     int i = $ENUM;
9003 }
9004 EOF
9005         val="$undef"
9006         set try; if eval $compile; then
9007                 val="$define"
9008         fi
9009         set d_${enum}; eval $setvar
9010         $rm -f try.c try
9011 done
9012
9013 : see if sys/select.h has to be included
9014 set sys/select.h i_sysselct
9015 eval $inhdr
9016
9017 : see if we should include time.h, sys/time.h, or both
9018 echo " "
9019 if test "X$timeincl" = X; then
9020         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
9021         $echo $n "I'm now running the test program...$c"
9022         $cat >try.c <<'EOCP'
9023 #include <sys/types.h>
9024 #ifdef I_TIME
9025 #include <time.h>
9026 #endif
9027 #ifdef I_SYSTIME
9028 #ifdef SYSTIMEKERNEL
9029 #define KERNEL
9030 #endif
9031 #include <sys/time.h>
9032 #endif
9033 #ifdef I_SYSSELECT
9034 #include <sys/select.h>
9035 #endif
9036 int main()
9037 {
9038         struct tm foo;
9039 #ifdef S_TIMEVAL
9040         struct timeval bar;
9041 #endif
9042 #ifdef S_TIMEZONE
9043         struct timezone tzp;
9044 #endif
9045         if (foo.tm_sec == foo.tm_sec)
9046                 exit(0);
9047 #ifdef S_TIMEVAL
9048         if (bar.tv_sec == bar.tv_sec)
9049                 exit(0);
9050 #endif
9051         exit(1);
9052 }
9053 EOCP
9054         flags=''
9055         for s_timezone in '-DS_TIMEZONE' ''; do
9056         sysselect=''
9057         for s_timeval in '-DS_TIMEVAL' ''; do
9058         for i_systimek in '' '-DSYSTIMEKERNEL'; do
9059         for i_time in '' '-DI_TIME'; do
9060         for i_systime in '-DI_SYSTIME' ''; do
9061                 case "$flags" in
9062                 '') $echo $n ".$c"
9063                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
9064                         if eval $compile; then
9065                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
9066                                 shift
9067                                 flags="$*"
9068                                 echo " "
9069                                 $echo $n "Succeeded with $flags$c"
9070                         fi
9071                         ;;
9072                 esac
9073         done
9074         done
9075         done
9076         done
9077         done
9078         timeincl=''
9079         echo " "
9080         case "$flags" in
9081         *SYSTIMEKERNEL*) i_systimek="$define"
9082                 timeincl=`./findhdr sys/time.h`
9083                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
9084         *) i_systimek="$undef";;
9085         esac
9086         case "$flags" in
9087         *I_TIME*) i_time="$define"
9088                 timeincl=`./findhdr time.h`" $timeincl"
9089                 echo "We'll include <time.h>." >&4;;
9090         *) i_time="$undef";;
9091         esac
9092         case "$flags" in
9093         *I_SYSTIME*) i_systime="$define"
9094                 timeincl=`./findhdr sys/time.h`" $timeincl"
9095                 echo "We'll include <sys/time.h>." >&4;;
9096         *) i_systime="$undef";;
9097         esac
9098         $rm -f try.c try
9099 fi
9100
9101 : check for fd_set items
9102 $cat <<EOM
9103
9104 Checking to see how well your C compiler handles fd_set and friends ...
9105 EOM
9106 $cat >fd_set.c <<EOCP
9107 #$i_systime I_SYS_TIME
9108 #$i_sysselct I_SYS_SELECT
9109 #$d_socket HAS_SOCKET
9110 #include <sys/types.h>
9111 #ifdef HAS_SOCKET
9112 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
9113 #endif
9114 #ifdef I_SYS_TIME
9115 #include <sys/time.h>
9116 #endif
9117 #ifdef I_SYS_SELECT
9118 #include <sys/select.h>
9119 #endif
9120 int main() {
9121         fd_set fds;
9122
9123 #ifdef TRYBITS
9124         if(fds.fds_bits);
9125 #endif
9126
9127 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
9128         exit(0);
9129 #else
9130         exit(1);
9131 #endif
9132 }
9133 EOCP
9134 set fd_set -DTRYBITS
9135 if eval $compile; then
9136         d_fds_bits="$define"
9137         d_fd_set="$define"
9138         echo "Well, your system knows about the normal fd_set typedef..." >&4
9139         if ./fd_set; then
9140                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
9141                 d_fd_macros="$define"
9142         else
9143                 $cat >&4 <<'EOM'
9144 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
9145 EOM
9146                 d_fd_macros="$undef"
9147         fi
9148 else
9149         $cat <<'EOM'
9150 Hmm, your compiler has some difficulty with fd_set.  Checking further...
9151 EOM
9152         set fd_set
9153         if eval $compile; then
9154                 d_fds_bits="$undef"
9155                 d_fd_set="$define"
9156                 echo "Well, your system has some sort of fd_set available..." >&4
9157                 if ./fd_set; then
9158                         echo "and you have the normal fd_set macros." >&4
9159                         d_fd_macros="$define"
9160                 else
9161                         $cat <<'EOM'
9162 but not the normal fd_set macros!  Gross!  More work for me...
9163 EOM
9164                         d_fd_macros="$undef"
9165                 fi
9166         else
9167         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
9168                 d_fd_set="$undef"
9169                 d_fds_bits="$undef"
9170                 d_fd_macros="$undef"
9171         fi
9172 fi
9173 $rm -f fd_set*
9174
9175 : see if fgetpos exists
9176 set fgetpos d_fgetpos
9177 eval $inlibc
9178
9179 : see if flock exists
9180 set flock d_flock
9181 eval $inlibc
9182
9183 : see if fork exists
9184 set fork d_fork
9185 eval $inlibc
9186
9187 : see if pathconf exists
9188 set pathconf d_pathconf
9189 eval $inlibc
9190
9191 : see if fpathconf exists
9192 set fpathconf d_fpathconf
9193 eval $inlibc
9194
9195
9196 : check for fpos64_t
9197 echo " "
9198 echo "Checking to see if you have fpos64_t..." >&4
9199 $cat >try.c <<EOCP
9200 #include <stdio.h>
9201 int main() { fpos64_t x = 7; }
9202 EOCP
9203 set try
9204 if eval $compile; then
9205         val="$define"
9206         echo "You have fpos64_t."
9207 else
9208         val="$undef"
9209         echo "You do not have fpos64_t."
9210         case "$fpossize" in
9211         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
9212         esac
9213 fi
9214 $rm -f try.* try
9215 set d_fpos64_t
9216 eval $setvar
9217
9218 : see if frexpl exists
9219 set frexpl d_frexpl
9220 eval $inlibc
9221
9222 hasstruct='varname=$1; struct=$2; shift; shift;
9223 while $test $# -ge 2; do
9224         case "$1" in
9225         $define) echo "#include <$2>";;
9226         esac ;
9227     shift 2;
9228 done > try.c;
9229 echo "int main () { struct $struct foo; }" >> try.c;
9230 set try;
9231 if eval $compile; then
9232         val="$define";
9233 else
9234         val="$undef";
9235 fi;
9236 set $varname;
9237 eval $setvar;
9238 $rm -f try.c try.o'
9239
9240 : see if this is a sys/param system
9241 set sys/param.h i_sysparam
9242 eval $inhdr
9243
9244 : see if this is a sys/mount.h system
9245 set sys/mount.h i_sysmount
9246 eval $inhdr
9247
9248 : see if sys/types.h has to be included
9249 set sys/types.h i_systypes
9250 eval $inhdr
9251
9252
9253 echo " "
9254 echo "Checking to see if your system supports struct fs_data..." >&4
9255 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
9256 eval $hasstruct
9257 case "$d_fs_data_s" in
9258 "$define")      echo "Yes, it does."   ;;
9259 *)              echo "No, it doesn't." ;;
9260 esac
9261
9262 : see if fseeko exists
9263 set fseeko d_fseeko
9264 eval $inlibc
9265 case "$longsize" in
9266 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
9267 esac
9268
9269 : see if fsetpos exists
9270 set fsetpos d_fsetpos
9271 eval $inlibc
9272
9273
9274 : see if fstatfs exists
9275 set fstatfs d_fstatfs
9276 eval $inlibc
9277
9278
9279 : see if statvfs exists
9280 set statvfs d_statvfs
9281 eval $inlibc
9282
9283 : see if fstatvfs exists
9284 set fstatvfs d_fstatvfs
9285 eval $inlibc
9286
9287
9288 : see if ftello exists
9289 set ftello d_ftello
9290 eval $inlibc
9291 case "$longsize" in
9292 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
9293 esac
9294
9295 : see if getcwd exists
9296 set getcwd d_getcwd
9297 eval $inlibc
9298
9299 : see if getespwnam exists
9300 set getespwnam d_getespwnam
9301 eval $inlibc
9302
9303
9304 : see if getfsstat exists
9305 set getfsstat d_getfsstat
9306 eval $inlibc
9307
9308 : see if getgrent exists
9309 set getgrent d_getgrent
9310 eval $inlibc
9311
9312 : see if gethostbyaddr exists
9313 set gethostbyaddr d_gethbyaddr
9314 eval $inlibc
9315
9316 : see if gethostbyname exists
9317 set gethostbyname d_gethbyname
9318 eval $inlibc
9319
9320 : see if gethostent exists
9321 set gethostent d_gethent
9322 eval $inlibc
9323
9324 : see how we will look up host name
9325 echo " "
9326 call=''
9327 if set gethostname val -f d_gethname; eval $csym; $val; then
9328         echo 'gethostname() found.' >&4
9329         d_gethname="$define"
9330         call=gethostname
9331 fi
9332 if set uname val -f d_uname; eval $csym; $val; then
9333         if ./xenix; then
9334                 $cat <<'EOM'
9335 uname() was found, but you're running xenix, and older versions of xenix
9336 have a broken uname(). If you don't really know whether your xenix is old
9337 enough to have a broken system call, use the default answer.
9338
9339 EOM
9340                 dflt=y
9341                 case "$d_uname" in
9342                 "$define") dflt=n;;
9343                 esac
9344                 rp='Is your uname() broken?'
9345                 . ./myread
9346                 case "$ans" in
9347                 n*) d_uname="$define"; call=uname;;
9348                 esac
9349         else
9350                 echo 'uname() found.' >&4
9351                 d_uname="$define"
9352                 case "$call" in
9353                 '') call=uname ;;
9354                 esac
9355         fi
9356 fi
9357 case "$d_gethname" in
9358 '') d_gethname="$undef";;
9359 esac
9360 case "$d_uname" in
9361 '') d_uname="$undef";;
9362 esac
9363 case "$d_uname$d_gethname" in
9364 *define*)
9365         dflt=n
9366         cat <<EOM
9367  
9368 Every now and then someone has a $call() that lies about the hostname
9369 but can't be fixed for political or economic reasons.  If you wish, I can
9370 pretend $call() isn't there and maybe compute hostname at run-time
9371 thanks to the '$phostname' command.
9372
9373 EOM
9374         rp="Shall I ignore $call() from now on?"
9375         . ./myread
9376         case "$ans" in
9377         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
9378         esac;;
9379 esac
9380 case "$phostname" in
9381 '') aphostname='';;
9382 *) case "$aphostname" in
9383         /*) ;;
9384         *) set X $phostname
9385                 shift
9386                 file=$1
9387                 shift
9388                 file=`./loc $file $file $pth`
9389                 aphostname=`echo $file $*`
9390                 ;;
9391         esac
9392         ;;
9393 esac
9394 case "$d_uname$d_gethname" in
9395 *define*) ;;
9396 *)
9397         case "$phostname" in
9398         '')
9399                 echo "There will be no way for $package to get your hostname." >&4;;
9400         *)
9401         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
9402                 ;;
9403         esac;;
9404 esac
9405 case "$d_phostname" in
9406 '') d_phostname="$undef";;
9407 esac
9408
9409 : see if this is a netdb.h system
9410 set netdb.h i_netdb
9411 eval $inhdr
9412
9413 : see if prototypes for various gethostxxx netdb.h functions are available
9414 echo " "
9415 set d_gethostprotos gethostent $i_netdb netdb.h
9416 eval $hasproto
9417
9418 : see if getlogin exists
9419 set getlogin d_getlogin
9420 eval $inlibc
9421
9422 : see if getmnt exists
9423 set getmnt d_getmnt
9424 eval $inlibc
9425
9426 : see if getmntent exists
9427 set getmntent d_getmntent
9428 eval $inlibc
9429
9430 : see if getnetbyaddr exists
9431 set getnetbyaddr d_getnbyaddr
9432 eval $inlibc
9433
9434 : see if getnetbyname exists
9435 set getnetbyname d_getnbyname
9436 eval $inlibc
9437
9438 : see if getnetent exists
9439 set getnetent d_getnent
9440 eval $inlibc
9441
9442 : see if prototypes for various getnetxxx netdb.h functions are available
9443 echo " "
9444 set d_getnetprotos getnetent $i_netdb netdb.h
9445 eval $hasproto
9446
9447
9448 : see if getprotobyname exists
9449 set getprotobyname d_getpbyname
9450 eval $inlibc
9451
9452 : see if getprotobynumber exists
9453 set getprotobynumber d_getpbynumber
9454 eval $inlibc
9455
9456 : see if getprotoent exists
9457 set getprotoent d_getpent
9458 eval $inlibc
9459
9460 : see if getpgid exists
9461 set getpgid d_getpgid
9462 eval $inlibc
9463
9464 : see if getpgrp2 exists
9465 set getpgrp2 d_getpgrp2
9466 eval $inlibc
9467
9468 : see if getppid exists
9469 set getppid d_getppid
9470 eval $inlibc
9471
9472 : see if getpriority exists
9473 set getpriority d_getprior
9474 eval $inlibc
9475
9476 : see if prototypes for various getprotoxxx netdb.h functions are available
9477 echo " "
9478 set d_getprotoprotos getprotoent $i_netdb netdb.h
9479 eval $hasproto
9480
9481 : see if getprpwnam exists
9482 set getprpwnam d_getprpwnam
9483 eval $inlibc
9484
9485 : see if getpwent exists
9486 set getpwent d_getpwent
9487 eval $inlibc
9488
9489
9490 : see if getservbyname exists
9491 set getservbyname d_getsbyname
9492 eval $inlibc
9493
9494 : see if getservbyport exists
9495 set getservbyport d_getsbyport
9496 eval $inlibc
9497
9498 : see if getservent exists
9499 set getservent d_getsent
9500 eval $inlibc
9501
9502 : see if prototypes for various getservxxx netdb.h functions are available
9503 echo " "
9504 set d_getservprotos getservent $i_netdb netdb.h
9505 eval $hasproto
9506
9507 : see if getspnam exists
9508 set getspnam d_getspnam
9509 eval $inlibc
9510
9511 : see if gettimeofday or ftime exists
9512 set gettimeofday d_gettimeod
9513 eval $inlibc
9514 case "$d_gettimeod" in
9515 "$undef")
9516         set ftime d_ftime 
9517         eval $inlibc
9518         ;;
9519 *)
9520         val="$undef"; set d_ftime; eval $setvar
9521         ;;
9522 esac
9523 case "$d_gettimeod$d_ftime" in
9524 "$undef$undef")
9525         echo " "
9526         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
9527         ;;
9528 esac
9529
9530 : see if this is an grp system
9531 set grp.h i_grp
9532 eval $inhdr
9533
9534 case "$i_grp" in
9535 $define)
9536         xxx=`./findhdr grp.h`
9537         $cppstdin $cppflags $cppminus < $xxx >$$.h
9538
9539         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
9540                 val="$define"
9541         else
9542                 val="$undef"
9543         fi
9544         set d_grpasswd
9545         eval $setvar
9546
9547         $rm -f $$.h
9548         ;;
9549 *)
9550         val="$undef";
9551         set d_grpasswd; eval $setvar
9552         ;;
9553 esac
9554
9555 : see if hasmntopt exists
9556 set hasmntopt d_hasmntopt
9557 eval $inlibc
9558
9559 : see if this is a netinet/in.h or sys/in.h system
9560 set netinet/in.h i_niin sys/in.h i_sysin
9561 eval $inhdr
9562
9563 : see if arpa/inet.h has to be included
9564 set arpa/inet.h i_arpainet
9565 eval $inhdr
9566
9567 : see if htonl --and friends-- exists
9568 val=''
9569 set htonl val
9570 eval $inlibc
9571
9572 : Maybe they are macros.
9573 case "$val" in
9574 $undef)
9575         $cat >htonl.c <<EOM
9576 #include <stdio.h>
9577 #include <sys/types.h>
9578 #$i_niin I_NETINET_IN
9579 #$i_sysin I_SYS_IN
9580 #$i_arpainet I_ARPA_INET
9581 #ifdef I_NETINET_IN
9582 #include <netinet/in.h>
9583 #endif
9584 #ifdef I_SYS_IN
9585 #include <sys/in.h>
9586 #endif
9587 #ifdef I_ARPA_INET
9588 #include <arpa/inet.h>
9589 #endif
9590 #ifdef htonl
9591 printf("Defined as a macro.");
9592 #endif
9593 EOM
9594         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
9595         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
9596                 val="$define"
9597                 echo "But it seems to be defined as a macro." >&4
9598         fi
9599         $rm -f htonl.?
9600         ;;
9601 esac
9602 set d_htonl
9603 eval $setvar
9604
9605 : see if iconv exists
9606 set iconv d_iconv
9607 eval $inlibc
9608
9609 : index or strchr
9610 echo " "
9611 if set index val -f; eval $csym; $val; then
9612         if set strchr val -f d_strchr; eval $csym; $val; then
9613                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
9614                         val="$define"
9615                         vali="$undef"
9616                         echo "strchr() found." >&4
9617                 else
9618                         val="$undef"
9619                         vali="$define"
9620                         echo "index() found." >&4
9621                 fi
9622         else
9623                 val="$undef"
9624                 vali="$define"
9625                 echo "index() found." >&4
9626         fi
9627 else
9628         if set strchr val -f d_strchr; eval $csym; $val; then
9629                 val="$define"
9630                 vali="$undef"
9631                 echo "strchr() found." >&4
9632         else
9633                 echo "No index() or strchr() found!" >&4
9634                 val="$undef"
9635                 vali="$undef"
9636         fi
9637 fi
9638 set d_strchr; eval $setvar
9639 val="$vali"
9640 set d_index; eval $setvar
9641
9642 : check whether inet_aton exists
9643 set inet_aton d_inetaton
9644 eval $inlibc
9645
9646 : see if inttypes.h is available
9647 : we want a real compile instead of Inhdr because some systems
9648 : have an inttypes.h which includes non-existent headers
9649 echo " "
9650 $cat >try.c <<EOCP
9651 #include <inttypes.h>
9652 int main() {
9653         static int32_t foo32 = 0x12345678;
9654 }
9655 EOCP
9656 set try
9657 if eval $compile; then
9658         echo "<inttypes.h> found." >&4
9659         val="$define"
9660 else
9661         echo "<inttypes.h> NOT found." >&4
9662         val="$undef"
9663 fi
9664 $rm -f try.c try
9665 set i_inttypes
9666 eval $setvar
9667
9668 : check for int64_t
9669 echo " "
9670 echo "Checking to see if you have int64_t..." >&4
9671 $cat >try.c <<EOCP
9672 #include <sys/types.h>
9673 #$i_inttypes I_INTTYPES
9674 #ifdef I_INTTYPES
9675 #include <inttypes.h>
9676 #endif
9677 int main() { int64_t x = 7; }
9678 EOCP
9679 set try
9680 if eval $compile; then
9681         val="$define"
9682         echo "You have int64_t."
9683 else
9684         val="$undef"
9685         echo "You do not have int64_t."
9686 fi
9687 $rm -f try try.*
9688 set d_int64_t
9689 eval $setvar
9690
9691 : Look for isascii
9692 echo " "
9693 $cat >isascii.c <<'EOCP'
9694 #include <stdio.h>
9695 #include <ctype.h>
9696 int main() {
9697         int c = 'A';
9698         if (isascii(c))
9699                 exit(0);
9700         else
9701                 exit(1);
9702 }
9703 EOCP
9704 set isascii
9705 if eval $compile; then
9706         echo "isascii() found." >&4
9707         val="$define"
9708 else
9709         echo "isascii() NOT found." >&4
9710         val="$undef"
9711 fi
9712 set d_isascii
9713 eval $setvar
9714 $rm -f isascii*
9715
9716 : see if isnan exists
9717 set isnan d_isnan
9718 eval $inlibc
9719
9720 : see if isnanl exists
9721 set isnanl d_isnanl
9722 eval $inlibc
9723
9724 : see if killpg exists
9725 set killpg d_killpg
9726 eval $inlibc
9727
9728 : see if lchown exists
9729 echo " "
9730 $cat > try.c <<'EOCP'
9731 /* System header to define __stub macros and hopefully few prototypes,
9732     which can conflict with char lchown(); below.  */
9733 #include <assert.h>
9734 /* Override any gcc2 internal prototype to avoid an error.  */
9735 /* We use char because int might match the return type of a gcc2
9736    builtin and then its argument prototype would still apply.  */
9737 char lchown();
9738 int main() {
9739     /*  The GNU C library defines this for functions which it implements
9740         to always fail with ENOSYS.  Some functions are actually named
9741         something starting with __ and the normal name is an alias.  */
9742 #if defined (__stub_lchown) || defined (__stub___lchown)
9743 choke me
9744 #else
9745 lchown();
9746 #endif
9747 ; return 0; }
9748 EOCP
9749 set try
9750 if eval $compile; then
9751     $echo "lchown() found." >&4
9752     val="$define"
9753 else
9754     $echo "lchown() NOT found." >&4
9755     val="$undef"
9756 fi
9757 set d_lchown
9758 eval $setvar
9759
9760 : See if number of significant digits in a double precision number is known
9761 echo " "
9762 $cat >ldbl_dig.c <<EOM
9763 #$i_limits I_LIMITS
9764 #$i_float I_FLOAT
9765 #ifdef I_LIMITS
9766 #include <limits.h>
9767 #endif
9768 #ifdef I_FLOAT
9769 #include <float.h>
9770 #endif
9771 #ifdef LDBL_DIG
9772 printf("Contains LDBL_DIG");
9773 #endif
9774 EOM
9775 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
9776 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
9777         echo "LDBL_DIG found." >&4
9778         val="$define"
9779 else
9780         echo "LDBL_DIG NOT found." >&4
9781         val="$undef"
9782 fi
9783 $rm -f ldbl_dig.?
9784 set d_ldbl_dig
9785 eval $setvar
9786
9787 : see if link exists
9788 set link d_link
9789 eval $inlibc
9790
9791 : see if localeconv exists
9792 set localeconv d_locconv
9793 eval $inlibc
9794
9795 : see if lockf exists
9796 set lockf d_lockf
9797 eval $inlibc
9798
9799 : check for long long
9800 echo " "
9801 echo "Checking to see if you have long long..." >&4
9802 echo 'int main() { long long x = 7; return 0; }' > try.c
9803 set try
9804 if eval $compile; then
9805         val="$define"
9806         echo "You have long long."
9807 else
9808         val="$undef"
9809         echo "You do not have long long."
9810 fi
9811 $rm try.*
9812 set d_longlong
9813 eval $setvar
9814
9815 : check for length of long long
9816 case "${d_longlong}${longlongsize}" in
9817 $define)
9818         echo " "
9819         echo "Checking to see how big your long longs are..." >&4
9820         $cat >try.c <<'EOCP'
9821 #include <stdio.h>
9822 int main()
9823 {
9824     printf("%d\n", (int)sizeof(long long));
9825     return(0);
9826 }
9827 EOCP
9828         set try
9829         if eval $compile_ok; then
9830                 longlongsize=`./try$exe_ext`
9831                 echo "Your long longs are $longlongsize bytes long."
9832         else
9833                 dflt='8'
9834                 echo " "
9835                 echo "(I can't seem to compile the test program.  Guessing...)"
9836                 rp="What is the size of a long long (in bytes)?"
9837                 . ./myread
9838                 longlongsize="$ans"
9839         fi
9840         if $test "X$longsize" = "X$longlongsize"; then
9841                 echo "(That isn't any different from an ordinary long.)"
9842         fi      
9843         ;;
9844 esac
9845 $rm -f try.* try
9846
9847 : see if prototype for lseek is available
9848 echo " "
9849 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
9850 eval $hasproto
9851
9852 : see if lstat exists
9853 set lstat d_lstat
9854 eval $inlibc
9855
9856 : see if madvise exists
9857 set madvise d_madvise
9858 eval $inlibc
9859
9860 : see if mblen exists
9861 set mblen d_mblen
9862 eval $inlibc
9863
9864 : see if mbstowcs exists
9865 set mbstowcs d_mbstowcs
9866 eval $inlibc
9867
9868 : see if mbtowc exists
9869 set mbtowc d_mbtowc
9870 eval $inlibc
9871
9872 : see if memchr exists
9873 set memchr d_memchr
9874 eval $inlibc
9875
9876 : see if memcmp exists
9877 set memcmp d_memcmp
9878 eval $inlibc
9879
9880 : see if memcpy exists
9881 set memcpy d_memcpy
9882 eval $inlibc
9883
9884 : see if memmove exists
9885 set memmove d_memmove
9886 eval $inlibc
9887
9888 : see if memset exists
9889 set memset d_memset
9890 eval $inlibc
9891
9892 : see if mkdir exists
9893 set mkdir d_mkdir
9894 eval $inlibc
9895
9896 : see if mkdtemp exists
9897 set mkdtemp d_mkdtemp
9898 eval $inlibc
9899
9900 : see if mkfifo exists
9901 set mkfifo d_mkfifo
9902 eval $inlibc
9903
9904 : see if mkstemp exists
9905 set mkstemp d_mkstemp
9906 eval $inlibc
9907
9908 : see if mkstemps exists
9909 set mkstemps d_mkstemps
9910 eval $inlibc
9911
9912 : see if mktime exists
9913 set mktime d_mktime
9914 eval $inlibc
9915
9916 : see if this is a sys/mman.h system
9917 set sys/mman.h i_sysmman
9918 eval $inhdr
9919
9920 : see if mmap exists
9921 set mmap d_mmap
9922 eval $inlibc
9923 : see what shmat returns
9924 : default to something harmless
9925 mmaptype='void *'
9926 case "$i_sysmman$d_mmap" in
9927 "$define$define")
9928         $cat >mmap.c <<'END'
9929 #include <sys/mman.h>
9930 void *mmap();
9931 END
9932         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
9933                 mmaptype='void *'
9934         else
9935                 mmaptype='caddr_t'
9936         fi
9937         echo "and it returns ($mmaptype)." >&4
9938         ;;
9939 esac
9940
9941
9942
9943 : see if modfl exists
9944 set modfl d_modfl
9945 eval $inlibc
9946
9947 : see if mprotect exists
9948 set mprotect d_mprotect
9949 eval $inlibc
9950
9951 : see if msgctl exists
9952 set msgctl d_msgctl
9953 eval $inlibc
9954
9955 : see if msgget exists
9956 set msgget d_msgget
9957 eval $inlibc
9958
9959 : see if msgsnd exists
9960 set msgsnd d_msgsnd
9961 eval $inlibc
9962
9963 : see if msgrcv exists
9964 set msgrcv d_msgrcv
9965 eval $inlibc
9966
9967 : see how much of the 'msg*(2)' library is present.
9968 h_msg=true
9969 echo " "
9970 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
9971 *"$undef"*) h_msg=false;;
9972 esac
9973 case "$osname" in
9974 freebsd)
9975     case "`ipcs 2>&1`" in
9976     "SVID messages"*"not configured"*)
9977         echo "Your $osname does not have the msg*(2) configured." >&4
9978         h_msg=false
9979         val="$undef"
9980         set msgctl d_msgctl
9981         eval $setvar
9982         set msgget d_msgget
9983         eval $setvar
9984         set msgsnd d_msgsnd
9985         eval $setvar
9986         set msgrcv d_msgrcv
9987         eval $setvar
9988         ;;
9989     esac
9990     ;;
9991 esac
9992 : we could also check for sys/ipc.h ...
9993 if $h_msg && $test `./findhdr sys/msg.h`; then
9994         echo "You have the full msg*(2) library." >&4
9995         val="$define"
9996 else
9997         echo "You don't have the full msg*(2) library." >&4
9998         val="$undef"
9999 fi
10000 set d_msg
10001 eval $setvar
10002
10003 : see if msync exists
10004 set msync d_msync
10005 eval $inlibc
10006
10007 : see if munmap exists
10008 set munmap d_munmap
10009 eval $inlibc
10010
10011 : see if nice exists
10012 set nice d_nice
10013 eval $inlibc
10014
10015
10016 echo " "
10017 echo "Checking which 64-bit integer type we could use..." >&4
10018
10019 case "$intsize" in
10020 8) val=int
10021    set quadtype
10022    eval $setvar
10023    val='"unsigned int"'
10024    set uquadtype
10025    eval $setvar
10026    quadkind=1
10027    ;;
10028 *) case "$longsize" in
10029    8) val=long
10030       set quadtype
10031       eval $setvar
10032       val='"unsigned long"'
10033       set uquadtype
10034       eval $setvar
10035       quadkind=2
10036       ;;
10037    *) case "$d_longlong:$longlongsize" in
10038       define:8)
10039         val='"long long"'
10040         set quadtype
10041         eval $setvar
10042         val='"unsigned long long"'
10043         set uquadtype
10044         eval $setvar
10045         quadkind=3
10046         ;;
10047       *) case "$d_int64_t" in
10048          define)
10049            val=int64_t
10050            set quadtype
10051            eval $setvar
10052            val=uint64_t
10053            set uquadtype
10054            eval $setvar
10055            quadkind=4
10056            ;;
10057          esac
10058          ;;
10059       esac
10060       ;;
10061    esac
10062    ;;
10063 esac
10064
10065 case "$quadtype" in
10066 '')     echo "Alas, no 64-bit integer types in sight." >&4
10067         d_quad="$undef"
10068         ;;
10069 *)      if test X"$use64bitint" = Xdefine -o X"$longsize" = X8; then
10070             verb="will"
10071         else
10072             verb="could"
10073         fi
10074         echo "We $verb use '$quadtype' for 64-bit integers." >&4
10075         d_quad="$define"
10076         ;;
10077 esac
10078
10079 : check for length of character
10080 echo " "
10081 case "$charsize" in
10082 '')
10083         echo "Checking to see how big your characters are (hey, you never know)..." >&4
10084         $cat >try.c <<'EOCP'
10085 #include <stdio.h>
10086 int main()
10087 {
10088     printf("%d\n", (int)sizeof(char));
10089     exit(0);
10090 }
10091 EOCP
10092         set try
10093         if eval $compile_ok; then
10094                 dflt=`./try`
10095         else
10096                 dflt='1'
10097                 echo "(I can't seem to compile the test program.  Guessing...)"
10098         fi
10099         ;;
10100 *)
10101         dflt="$charsize"
10102         ;;
10103 esac
10104 rp="What is the size of a character (in bytes)?"
10105 . ./myread
10106 charsize="$ans"
10107 $rm -f try.c try
10108
10109
10110 echo " "
10111 $echo "Choosing the C types to be used for Perl's internal types..." >&4
10112
10113 case "$use64bitint:$d_quad:$quadtype" in
10114 define:define:?*)
10115         ivtype="$quadtype"
10116         uvtype="$uquadtype"
10117         ivsize=8
10118         uvsize=8
10119         ;;
10120 *)      ivtype="long"
10121         uvtype="unsigned long"
10122         ivsize=$longsize
10123         uvsize=$longsize
10124         ;;
10125 esac
10126
10127 case "$uselongdouble:$d_longdbl" in
10128 define:define)
10129         nvtype="long double"
10130         nvsize=$longdblsize
10131         ;;
10132 *)      nvtype=double
10133         nvsize=$doublesize
10134         ;;
10135 esac
10136
10137 $echo "(IV will be "$ivtype", $ivsize bytes)"
10138 $echo "(UV will be "$uvtype", $uvsize bytes)"
10139 $echo "(NV will be "$nvtype", $nvsize bytes)"
10140
10141 $cat >try.c <<EOCP
10142 #$i_inttypes I_INTTYPES
10143 #ifdef I_INTTYPES
10144 #include <inttypes.h>
10145 #endif
10146 #include <stdio.h>
10147 int main() {
10148 #ifdef INT8
10149    int8_t i =  INT8_MAX;
10150   uint8_t u = UINT8_MAX;
10151   printf("int8_t\n");
10152 #endif
10153 #ifdef INT16
10154    int16_t i =  INT16_MAX;
10155   uint16_t i = UINT16_MAX;
10156   printf("int16_t\n");
10157 #endif
10158 #ifdef INT32
10159    int32_t i =  INT32_MAX;
10160   uint32_t u = UINT32_MAX;
10161   printf("int32_t\n");
10162 #endif
10163 }
10164 EOCP
10165
10166 case "$i8type" in
10167 '')     case "$charsize" in
10168         1)      i8type=char
10169                 u8type="unsigned char"
10170                 i8size=$charsize
10171                 u8size=$charsize
10172                 ;;
10173         esac
10174         ;;
10175 esac
10176 case "$i8type" in
10177 '')     set try -DINT8
10178         if eval $compile; then
10179                 case "`./try$exe_ext`" in
10180                 int8_t) i8type=int8_t
10181                         u8type=uint8_t
10182                         i8size=1
10183                         u8size=1
10184                         ;;
10185                 esac
10186         fi
10187         ;;
10188 esac
10189 case "$i8type" in
10190 '')     if $test $charsize -ge 1; then
10191                 i8type=char
10192                 u8type="unsigned char"
10193                 i8size=$charsize
10194                 u8size=$charsize
10195         fi
10196         ;;
10197 esac
10198
10199 case "$i16type" in
10200 '')     case "$shortsize" in
10201         2)      i16type=short
10202                 u16type="unsigned short"
10203                 i16size=$shortsize
10204                 u16size=$shortsize
10205                 ;;
10206         esac
10207         ;;
10208 esac
10209 case "$i16type" in
10210 '')     set try -DINT16
10211         if eval $compile; then
10212                 case "`./try$exe_ext`" in
10213                 int16_t)
10214                         i16type=int16_t
10215                         u16type=uint16_t
10216                         i16size=2
10217                         u16size=2
10218                         ;;
10219                 esac
10220         fi
10221         ;;
10222 esac
10223 case "$i16type" in
10224 '')     if $test $shortsize -ge 2; then
10225                 i16type=short
10226                 u16type="unsigned short"
10227                 i16size=$shortsize
10228                 u16size=$shortsize
10229         fi
10230         ;;
10231 esac
10232
10233 case "$i32type" in
10234 '')     case "$longsize" in
10235         4)      i32type=long
10236                 u32type="unsigned long"
10237                 i32size=$longsize
10238                 u32size=$longsize
10239                 ;;
10240         *)      case "$intsize" in
10241                 4)      i32type=int
10242                         u32type="unsigned int"
10243                         i32size=$intsize
10244                         u32size=$intsize
10245                         ;;
10246                 esac
10247                 ;;
10248         esac
10249         ;;
10250 esac
10251 case "$i32type" in
10252 '')     set try -DINT32
10253         if eval $compile; then
10254                 case "`./try$exe_ext`" in
10255                 int32_t)
10256                         i32type=int32_t
10257                         u32type=uint32_t
10258                         i32size=4
10259                         u32size=4
10260                         ;;
10261                 esac
10262         fi
10263         ;;
10264 esac
10265 case "$i32type" in
10266 '')     if $test $intsize -ge 4; then
10267                 i32type=int
10268                 u32type="unsigned int"
10269                 i32size=$intsize
10270                 u32size=$intsize
10271         fi
10272         ;;
10273 esac
10274
10275 case "$i64type" in
10276 '')     case "$d_quad:$quadtype" in
10277         define:?*)
10278                 i64type="$quadtype"
10279                 u64type="$uquadtype"
10280                 i64size=8
10281                 u64size=8
10282                 ;;
10283         esac
10284         ;;
10285 esac
10286
10287 $echo "Checking whether your NVs can preserve your UVs..." >&4
10288 $cat <<EOP >try.c
10289 #include <stdio.h>
10290 int main() {
10291     $uvtype k = ($uvtype)~0, l;
10292     $nvtype d;
10293     l = k;
10294     d = ($nvtype)l;
10295     l = ($uvtype)d;
10296     if (l == k)
10297        printf("preserve\n");
10298     exit(0);
10299 }
10300 EOP
10301 set try
10302 if eval $compile; then
10303         case "`./try$exe_ext`" in
10304         preserve) d_nv_preserves_uv="$define" ;;
10305         esac
10306 fi      
10307 case "$d_nv_preserves_uv" in
10308 $define) $echo "Yes, they can."  2>&1 ;;
10309 *)       $echo "No, they can't." 2>&1
10310          d_nv_preserves_uv="$undef"
10311          ;;
10312 esac
10313
10314 $rm -f try.* try
10315
10316 case "$d_nv_preserves_uv" in
10317 "$define") d_nv_preserves_uv_bits=`expr $uvsize \* 8` ;;
10318 *)      $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
10319         $cat <<EOP >try.c
10320 #include <stdio.h>
10321 int main() {
10322     $uvtype u = 0;
10323     int     n = 8 * $uvsize;
10324     int     i;
10325     for (i = 0; i < n; i++) {
10326       u = u << 1 | ($uvtype)1;
10327       if (($uvtype)($nvtype)u != u)
10328         break;
10329     }
10330     printf("%d\n", i);
10331     exit(0);
10332 }
10333 EOP
10334         set try
10335         if eval $compile; then
10336                 d_nv_preserves_uv_bits="`./try$exe_ext`"
10337         fi
10338         case "$d_nv_preserves_uv_bits" in
10339         [1-9]*) $echo "Your NVs can preserve $d_nv_preserves_uv_bits bits of your UVs."  2>&1 ;;
10340         *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
10341                 d_nv_preserves_uv_bits="$undef"
10342                 ;;
10343         esac
10344         $rm -f try.* try
10345         ;;
10346 esac
10347
10348
10349
10350 : check for off64_t
10351 echo " "
10352 echo "Checking to see if you have off64_t..." >&4
10353 $cat >try.c <<EOCP
10354 #include <sys/types.h>
10355 #include <unistd.h>
10356 int main() { off64_t x = 7; }
10357 EOCP
10358 set try
10359 if eval $compile; then
10360         val="$define"
10361         echo "You have off64_t."
10362 else
10363         val="$undef"
10364         echo "You do not have off64_t."
10365         case "$lseeksize" in
10366         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
10367         esac
10368 fi
10369 $rm -f try.* try
10370 set d_off64_t
10371 eval $setvar
10372
10373 : see if POSIX threads are available
10374 set pthread.h i_pthread
10375 eval $inhdr
10376
10377
10378
10379
10380 : how to create joinable pthreads
10381 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
10382         echo " "
10383         echo "Checking what constant to use for creating joinable pthreads..." >&4 
10384         $cat >try.c <<'EOCP'
10385 #include <pthread.h>
10386 int main() {
10387     int detachstate = JOINABLE;
10388 }
10389 EOCP
10390         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
10391         if eval $compile; then
10392                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
10393                 val="$undef" # Yes, undef.
10394                 set d_old_pthread_create_joinable
10395                 eval $setvar
10396                 val=""
10397                 set old_pthread_create_joinable
10398                 eval $setvar
10399         else
10400                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
10401                 if eval $compile; then
10402                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
10403                         val="$define"
10404                         set d_old_pthread_create_joinable
10405                         eval $setvar
10406                         val=PTHREAD_CREATE_UNDETACHED
10407                         set old_pthread_create_joinable
10408                         eval $setvar
10409                 else            
10410                         set try -DJOINABLE=__UNDETACHED
10411                         if eval $compile; then
10412                                 echo "You seem to use __UNDETACHED." >&4
10413                                 val="$define"
10414                                 set d_old_pthread_create_joinable
10415                                 eval $setvar
10416                                 val=__UNDETACHED
10417                                 set old_pthread_create_joinable
10418                                 eval $setvar
10419                         else
10420                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
10421                                 val="$define"
10422                                 set d_old_pthread_create_joinable
10423                                 eval $setvar
10424                                 val=0
10425                                 set old_pthread_create_joinable
10426                                 eval $setvar
10427                         fi
10428                 fi
10429         fi
10430         $rm -f try try.*
10431 else
10432     d_old_pthread_create_joinable="$undef"
10433     old_pthread_create_joinable=""
10434 fi
10435
10436 : see if pause exists
10437 set pause d_pause
10438 eval $inlibc
10439
10440 : see if pipe exists
10441 set pipe d_pipe
10442 eval $inlibc
10443
10444 : see if poll exists
10445 set poll d_poll
10446 eval $inlibc
10447
10448
10449 : see whether the various POSIXish _yields exist
10450 $cat >try.c <<EOP
10451 #include <pthread.h>
10452 #include <stdio.h>
10453 int main() {
10454 #ifdef SCHED_YIELD
10455         sched_yield();
10456 #else
10457 #ifdef PTHREAD_YIELD
10458         pthread_yield();
10459 #else
10460 #ifdef PTHREAD_YIELD_NULL
10461         pthread_yield(NULL);
10462 #endif
10463 #endif
10464 #endif
10465 }
10466 EOP
10467 : see if sched_yield exists
10468 set try -DSCHED_YIELD
10469 if eval $compile; then
10470     val="$define"
10471     sched_yield='sched_yield()'
10472 else
10473     val="$undef"
10474 fi
10475 case "$usethreads" in
10476 $define)
10477         case "$val" in
10478         $define) echo 'sched_yield() found.' >&4        ;;
10479         *)       echo 'sched_yield() NOT found.' >&4    ;;
10480         esac
10481 esac
10482 set d_sched_yield
10483 eval $setvar
10484
10485 : see if pthread_yield exists
10486 set try -DPTHREAD_YIELD
10487 if eval $compile; then
10488     val="$define"
10489     case "$sched_yield" in
10490     '') sched_yield='pthread_yield()' ;;
10491     esac
10492 else
10493     set try -DPTHREAD_YIELD_NULL
10494     if eval $compile; then
10495         val="$define"
10496         case "$sched_yield" in
10497         '') sched_yield='pthread_yield(NULL)' ;;
10498         esac
10499     else
10500         val="$undef"
10501     fi
10502 fi
10503 case "$usethreads" in
10504 $define)
10505         case "$val" in
10506         $define) echo 'pthread_yield() found.' >&4      ;;
10507         *)       echo 'pthread_yield() NOT found.' >&4  ;;
10508         esac
10509         ;;
10510 esac
10511 set d_pthread_yield
10512 eval $setvar
10513
10514 case "$sched_yield" in
10515 '') sched_yield=undef ;;
10516 esac
10517
10518 $rm -f try try.*
10519
10520 : see if this is a pwd.h system
10521 set pwd.h i_pwd
10522 eval $inhdr
10523
10524 case "$i_pwd" in
10525 $define)
10526         xxx=`./findhdr pwd.h`
10527         $cppstdin $cppflags $cppminus < $xxx >$$.h
10528
10529         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
10530                 val="$define"
10531         else
10532                 val="$undef"
10533         fi
10534         set d_pwquota
10535         eval $setvar
10536
10537         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
10538                 val="$define"
10539         else
10540                 val="$undef"
10541         fi
10542         set d_pwage
10543         eval $setvar
10544
10545         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
10546                 val="$define"
10547         else
10548                 val="$undef"
10549         fi
10550         set d_pwchange
10551         eval $setvar
10552
10553         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
10554                 val="$define"
10555         else
10556                 val="$undef"
10557         fi
10558         set d_pwclass
10559         eval $setvar
10560
10561         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
10562                 val="$define"
10563         else
10564                 val="$undef"
10565         fi
10566         set d_pwexpire
10567         eval $setvar
10568
10569         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
10570                 val="$define"
10571         else
10572                 val="$undef"
10573         fi
10574         set d_pwcomment
10575         eval $setvar
10576
10577         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
10578                 val="$define"
10579         else
10580                 val="$undef"
10581         fi
10582         set d_pwgecos
10583         eval $setvar
10584
10585         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
10586                 val="$define"
10587         else
10588                 val="$undef"
10589         fi
10590         set d_pwpasswd
10591         eval $setvar
10592
10593         $rm -f $$.h
10594         ;;
10595 *)
10596         val="$undef"; 
10597         set d_pwquota; eval $setvar
10598         set d_pwage; eval $setvar
10599         set d_pwchange; eval $setvar
10600         set d_pwclass; eval $setvar
10601         set d_pwexpire; eval $setvar
10602         set d_pwcomment; eval $setvar
10603         set d_pwgecos; eval $setvar
10604         set d_pwpasswd; eval $setvar
10605         ;;
10606 esac
10607
10608 : see if readdir and friends exist
10609 set readdir d_readdir
10610 eval $inlibc
10611 set seekdir d_seekdir
10612 eval $inlibc
10613 set telldir d_telldir
10614 eval $inlibc
10615 set rewinddir d_rewinddir
10616 eval $inlibc
10617
10618 : see if readlink exists
10619 set readlink d_readlink
10620 eval $inlibc
10621
10622 : see if rename exists
10623 set rename d_rename
10624 eval $inlibc
10625
10626 : see if rmdir exists
10627 set rmdir d_rmdir
10628 eval $inlibc
10629
10630 : see if memory.h is available.
10631 val=''
10632 set memory.h val
10633 eval $inhdr
10634
10635 : See if it conflicts with string.h
10636 case "$val" in
10637 $define)
10638         case "$strings" in
10639         '') ;;
10640         *)
10641                 $cppstdin $cppflags $cppminus < $strings > mem.h
10642                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
10643                         echo " "
10644                         echo "We won't be including <memory.h>."
10645                         val="$undef"
10646                 fi
10647                 $rm -f mem.h
10648                 ;;
10649         esac
10650 esac
10651 set i_memory
10652 eval $setvar
10653
10654 : can bcopy handle overlapping blocks?
10655 val="$undef"
10656 case "$d_bcopy" in
10657 "$define")
10658         echo " "
10659         echo "Checking to see if your bcopy() can do overlapping copies..." >&4
10660         $cat >try.c <<EOCP
10661 #$i_memory I_MEMORY
10662 #$i_stdlib I_STDLIB
10663 #$i_string I_STRING
10664 #$i_unistd I_UNISTD
10665 EOCP
10666         $cat >>try.c <<'EOCP'
10667 #include <stdio.h>
10668 #ifdef I_MEMORY
10669 #  include <memory.h>
10670 #endif
10671 #ifdef I_STDLIB
10672 #  include <stdlib.h>
10673 #endif
10674 #ifdef I_STRING
10675 #  include <string.h>
10676 #else
10677 #  include <strings.h>
10678 #endif
10679 #ifdef I_UNISTD
10680 #  include <unistd.h>  /* Needed for NetBSD */
10681 #endif
10682 int main()
10683 {
10684 char buf[128], abc[128];
10685 char *b;
10686 int len;
10687 int off;
10688 int align;
10689
10690 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
10691
10692 for (align = 7; align >= 0; align--) {
10693         for (len = 36; len; len--) {
10694                 b = buf+align;
10695                 bcopy(abc, b, len);
10696                 for (off = 1; off <= len; off++) {
10697                         bcopy(b, b+off, len);
10698                         bcopy(b+off, b, len);
10699                         if (bcmp(b, abc, len))
10700                                 exit(1);
10701                 }
10702         }
10703 }
10704 exit(0);
10705 }
10706 EOCP
10707         set try
10708         if eval $compile_ok; then
10709                 if ./try 2>/dev/null; then
10710                         echo "Yes, it can."
10711                         val="$define"
10712                 else
10713                         echo "It can't, sorry."
10714                         case "$d_memmove" in
10715                         "$define") echo "But that's Ok since you have memmove()." ;;
10716                         esac
10717                 fi
10718         else
10719                 echo "(I can't compile the test program, so we'll assume not...)"
10720                 case "$d_memmove" in
10721                 "$define") echo "But that's Ok since you have memmove()." ;;
10722                 esac
10723         fi
10724         ;;
10725 esac
10726 $rm -f try.* try core
10727 set d_safebcpy
10728 eval $setvar
10729
10730 : can memcpy handle overlapping blocks?
10731 val="$undef"
10732 case "$d_memcpy" in
10733 "$define")
10734         echo " "
10735         echo "Checking to see if your memcpy() can do overlapping copies..." >&4
10736         $cat >try.c <<EOCP
10737 #$i_memory I_MEMORY
10738 #$i_stdlib I_STDLIB
10739 #$i_string I_STRING
10740 #$i_unistd I_UNISTD
10741 EOCP
10742         $cat >>try.c <<'EOCP'
10743 #include <stdio.h>
10744 #ifdef I_MEMORY
10745 #  include <memory.h>
10746 #endif
10747 #ifdef I_STDLIB
10748 #  include <stdlib.h>
10749 #endif
10750 #ifdef I_STRING
10751 #  include <string.h>
10752 #else
10753 #  include <strings.h>
10754 #endif
10755 #ifdef I_UNISTD
10756 #  include <unistd.h>  /* Needed for NetBSD */
10757 #endif
10758 int main()
10759 {
10760 char buf[128], abc[128];
10761 char *b;
10762 int len;
10763 int off;
10764 int align;
10765
10766 /* Copy "abcde..." string to char abc[] so that gcc doesn't
10767    try to store the string in read-only memory. */
10768 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
10769
10770 for (align = 7; align >= 0; align--) {
10771         for (len = 36; len; len--) {
10772                 b = buf+align;
10773                 memcpy(b, abc, len);
10774                 for (off = 1; off <= len; off++) {
10775                         memcpy(b+off, b, len);
10776                         memcpy(b, b+off, len);
10777                         if (memcmp(b, abc, len))
10778                                 exit(1);
10779                 }
10780         }
10781 }
10782 exit(0);
10783 }
10784 EOCP
10785         set try
10786         if eval $compile_ok; then
10787                 if ./try 2>/dev/null; then
10788                         echo "Yes, it can."
10789                         val="$define"
10790                 else
10791                         echo "It can't, sorry."
10792                         case "$d_memmove" in
10793                         "$define") echo "But that's Ok since you have memmove()." ;;
10794                         esac
10795                 fi
10796         else
10797                 echo "(I can't compile the test program, so we'll assume not...)"
10798                 case "$d_memmove" in
10799                 "$define") echo "But that's Ok since you have memmove()." ;;
10800                 esac
10801         fi
10802         ;;
10803 esac
10804 $rm -f try.* try core
10805 set d_safemcpy
10806 eval $setvar
10807
10808 : can memcmp be trusted to compare relative magnitude?
10809 val="$undef"
10810 case "$d_memcmp" in
10811 "$define")
10812         echo " "
10813         echo "Checking if your memcmp() can compare relative magnitude..." >&4
10814         $cat >try.c <<EOCP
10815 #$i_memory I_MEMORY
10816 #$i_stdlib I_STDLIB
10817 #$i_string I_STRING
10818 #$i_unistd I_UNISTD
10819 EOCP
10820         $cat >>try.c <<'EOCP'
10821 #include <stdio.h>
10822 #ifdef I_MEMORY
10823 #  include <memory.h>
10824 #endif
10825 #ifdef I_STDLIB
10826 #  include <stdlib.h>
10827 #endif
10828 #ifdef I_STRING
10829 #  include <string.h>
10830 #else
10831 #  include <strings.h>
10832 #endif
10833 #ifdef I_UNISTD
10834 #  include <unistd.h>  /* Needed for NetBSD */
10835 #endif
10836 int main()
10837 {
10838 char a = -1;
10839 char b = 0;
10840 if ((a < b) && memcmp(&a, &b, 1) < 0)
10841         exit(1);
10842 exit(0);
10843 }
10844 EOCP
10845         set try
10846         if eval $compile_ok; then
10847                 if ./try 2>/dev/null; then
10848                         echo "Yes, it can."
10849                         val="$define"
10850                 else
10851                         echo "No, it can't (it uses signed chars)."
10852                 fi
10853         else
10854                 echo "(I can't compile the test program, so we'll assume not...)"
10855         fi
10856         ;;
10857 esac
10858 $rm -f try.* try core
10859 set d_sanemcmp
10860 eval $setvar
10861
10862 : see if select exists
10863 set select d_select
10864 eval $inlibc
10865
10866 : see if semctl exists
10867 set semctl d_semctl
10868 eval $inlibc
10869
10870 : see if semget exists
10871 set semget d_semget
10872 eval $inlibc
10873
10874 : see if semop exists
10875 set semop d_semop
10876 eval $inlibc
10877
10878 : see how much of the 'sem*(2)' library is present.
10879 h_sem=true
10880 echo " "
10881 case "$d_semctl$d_semget$d_semop" in
10882 *"$undef"*) h_sem=false;;
10883 esac
10884 case "$osname" in
10885 freebsd)
10886     case "`ipcs 2>&1`" in
10887     "SVID messages"*"not configured"*)
10888         echo "Your $osname does not have the sem*(2) configured." >&4
10889         h_sem=false
10890         val="$undef"
10891         set semctl d_semctl
10892         eval $setvar
10893         set semget d_semget
10894         eval $setvar
10895         set semop d_semop
10896         eval $setvar
10897         ;;
10898     esac
10899     ;;
10900 esac
10901 : we could also check for sys/ipc.h ...
10902 if $h_sem && $test `./findhdr sys/sem.h`; then
10903         echo "You have the full sem*(2) library." >&4
10904         val="$define"
10905 else
10906         echo "You don't have the full sem*(2) library." >&4
10907         val="$undef"
10908 fi
10909 set d_sem
10910 eval $setvar
10911
10912 : see whether sys/sem.h defines union semun
10913 echo " "
10914 $cat > try.c <<'END'
10915 #include <sys/types.h>
10916 #include <sys/ipc.h>
10917 #include <sys/sem.h>
10918 int main () { union semun semun; semun.buf = 0; }
10919 END
10920 set try
10921 if eval $compile; then
10922     echo "You have union semun in <sys/sem.h>." >&4
10923     val="$define"
10924 else
10925     echo "You do not have union semun in <sys/sem.h>." >&4
10926     val="$undef"
10927 fi
10928 $rm -f try try.c try.h
10929 set d_union_semun
10930 eval $setvar
10931
10932 : see how to do semctl IPC_STAT
10933 case "$d_sem" in
10934 $define)
10935     : see whether semctl IPC_STAT can use union semun
10936     echo " "
10937     $cat > try.h <<END
10938 #ifndef S_IRUSR
10939 #   ifdef S_IREAD
10940 #       define S_IRUSR S_IREAD
10941 #       define S_IWUSR S_IWRITE
10942 #       define S_IXUSR S_IEXEC
10943 #   else
10944 #       define S_IRUSR 0400
10945 #       define S_IWUSR 0200
10946 #       define S_IXUSR 0100
10947 #   endif
10948 #   define S_IRGRP (S_IRUSR>>3)
10949 #   define S_IWGRP (S_IWUSR>>3)
10950 #   define S_IXGRP (S_IXUSR>>3)
10951 #   define S_IROTH (S_IRUSR>>6)
10952 #   define S_IWOTH (S_IWUSR>>6)
10953 #   define S_IXOTH (S_IXUSR>>6)
10954 #endif
10955 #ifndef S_IRWXU
10956 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
10957 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
10958 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
10959 #endif
10960 END
10961
10962     $cat > try.c <<END
10963 #include <sys/types.h>
10964 #include <sys/ipc.h>
10965 #include <sys/sem.h>
10966 #include <sys/stat.h>
10967 #include <stdio.h>
10968 #include <errno.h>
10969 #include "try.h"
10970 #ifndef errno
10971 extern int errno;
10972 #endif
10973 #$d_union_semun HAS_UNION_SEMUN
10974 int main() {
10975     union semun
10976 #ifndef HAS_UNION_SEMUN
10977     {
10978         int val;
10979         struct semid_ds *buf;
10980         unsigned short *array;
10981     }
10982 #endif
10983     arg;
10984     int sem, st;
10985
10986 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
10987     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
10988     if (sem > -1) {
10989         struct semid_ds argbuf;
10990         arg.buf = &argbuf;
10991 #       ifdef IPC_STAT
10992         st = semctl(sem, 0, IPC_STAT, arg);
10993         if (st == 0)
10994             printf("semun\n");
10995         else
10996 #       endif /* IPC_STAT */
10997             printf("semctl IPC_STAT failed: errno = %d\n", errno);
10998 #       ifdef IPC_RMID
10999         if (semctl(sem, 0, IPC_RMID, arg) != 0)
11000 #       endif /* IPC_RMID */
11001             printf("semctl IPC_RMID failed: errno = %d\n", errno);
11002     } else
11003 #endif /* IPC_PRIVATE && ... */
11004         printf("semget failed: errno = %d\n", errno);
11005   return 0;
11006 }
11007 END
11008     val="$undef"
11009     set try
11010     if eval $compile; then
11011         xxx=`./try`
11012         case "$xxx" in
11013         semun) val="$define" ;;
11014         esac
11015     fi
11016     $rm -f try try.c
11017     set d_semctl_semun
11018     eval $setvar
11019     case "$d_semctl_semun" in
11020     $define)
11021         echo "You can use union semun for semctl IPC_STAT." >&4
11022         also='also'
11023         ;;
11024     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
11025         also=''
11026         ;;
11027     esac
11028
11029     : see whether semctl IPC_STAT can use struct semid_ds pointer
11030     $cat > try.c <<'END'
11031 #include <sys/types.h>
11032 #include <sys/ipc.h>
11033 #include <sys/sem.h>
11034 #include <sys/stat.h>
11035 #include "try.h"
11036 #include <stdio.h>
11037 #include <errno.h>
11038 #ifndef errno
11039 extern int errno;
11040 #endif
11041 int main() {
11042     struct semid_ds arg;
11043     int sem, st;
11044
11045 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
11046     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
11047     if (sem > -1) {
11048 #       ifdef IPC_STAT
11049         st = semctl(sem, 0, IPC_STAT, &arg);
11050         if (st == 0)
11051             printf("semid_ds\n");
11052         else
11053 #       endif /* IPC_STAT */
11054             printf("semctl IPC_STAT failed: errno = %d\n", errno);
11055 #       ifdef IPC_RMID
11056         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
11057 #       endif /* IPC_RMID */
11058             printf("semctl IPC_RMID failed: errno = %d\n", errno);
11059     } else
11060 #endif /* IPC_PRIVATE && ... */
11061         printf("semget failed: errno = %d\n", errno);
11062
11063     return 0;
11064 }
11065 END
11066     val="$undef"
11067     set try
11068     if eval $compile; then
11069         xxx=`./try`
11070         case "$xxx" in
11071         semid_ds) val="$define" ;;
11072         esac
11073     fi
11074     $rm -f try try.c
11075     set d_semctl_semid_ds
11076     eval $setvar
11077     case "$d_semctl_semid_ds" in
11078     $define)
11079         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
11080         ;;
11081     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
11082         ;;
11083     esac
11084     $rm -f try.h
11085     ;;
11086 *)  val="$undef"
11087
11088     # We do not have the full sem*(2) library, so assume we can not
11089     # use either.
11090
11091     set d_semctl_semun
11092     eval $setvar
11093
11094     set d_semctl_semid_ds
11095     eval $setvar
11096     ;;
11097 esac
11098
11099 : see if setegid exists
11100 set setegid d_setegid
11101 eval $inlibc
11102
11103 : see if seteuid exists
11104 set seteuid d_seteuid
11105 eval $inlibc
11106
11107 : see if setgrent exists
11108 set setgrent d_setgrent
11109 eval $inlibc
11110
11111 : see if sethostent exists
11112 set sethostent d_sethent
11113 eval $inlibc
11114
11115 : see if setlinebuf exists
11116 set setlinebuf d_setlinebuf
11117 eval $inlibc
11118
11119 : see if setlocale exists
11120 set setlocale d_setlocale
11121 eval $inlibc
11122
11123 : see if setnetent exists
11124 set setnetent d_setnent
11125 eval $inlibc
11126
11127 : see if setprotoent exists
11128 set setprotoent d_setpent
11129 eval $inlibc
11130
11131 : see if setpgid exists
11132 set setpgid d_setpgid
11133 eval $inlibc
11134
11135 : see if setpgrp2 exists
11136 set setpgrp2 d_setpgrp2
11137 eval $inlibc
11138
11139 : see if setpriority exists
11140 set setpriority d_setprior
11141 eval $inlibc
11142
11143 : see if setproctitle exists
11144 set setproctitle d_setproctitle
11145 eval $inlibc
11146
11147 : see if setpwent exists
11148 set setpwent d_setpwent
11149 eval $inlibc
11150
11151 : see if setregid exists
11152 set setregid d_setregid
11153 eval $inlibc
11154 set setresgid d_setresgid
11155 eval $inlibc
11156
11157 : see if setreuid exists
11158 set setreuid d_setreuid
11159 eval $inlibc
11160 set setresuid d_setresuid
11161 eval $inlibc
11162
11163 : see if setrgid exists
11164 set setrgid d_setrgid
11165 eval $inlibc
11166
11167 : see if setruid exists
11168 set setruid d_setruid
11169 eval $inlibc
11170
11171 : see if setservent exists
11172 set setservent d_setsent
11173 eval $inlibc
11174
11175 : see if setsid exists
11176 set setsid d_setsid
11177 eval $inlibc
11178
11179 : see if setvbuf exists
11180 set setvbuf d_setvbuf
11181 eval $inlibc
11182
11183 : see if sfio.h is available
11184 set sfio.h i_sfio
11185 eval $inhdr
11186
11187
11188 : see if sfio library is available
11189 case "$i_sfio" in
11190 $define)
11191         val=''
11192         set sfreserve val
11193         eval $inlibc
11194         ;;
11195 *)
11196         val="$undef"
11197         ;;
11198 esac
11199 : Ok, but do we want to use it.
11200 case "$val" in
11201 $define)
11202         case "$usesfio" in
11203         true|$define|[yY]*) dflt='y';;
11204         *) dflt='n';;
11205         esac
11206         echo "$package can use the sfio library, but it is experimental."
11207         rp="You seem to have sfio available, do you want to try using it?"
11208         . ./myread
11209         case "$ans" in
11210         y|Y) ;;
11211         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
11212                 val="$undef"
11213                 : Remove sfio from list of libraries to use
11214                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
11215                 shift
11216                 libs="$*"
11217                 echo "libs = $libs" >&4
11218                 ;;
11219         esac
11220         ;;
11221 *)      case "$usesfio" in
11222         true|$define|[yY]*)
11223                 echo "Sorry, cannot find sfio on this machine" >&4
11224                 echo "Ignoring your setting of usesfio=$usesfio" >&4
11225                 ;;
11226         esac
11227         ;;
11228 esac
11229 set d_sfio
11230 eval $setvar
11231 case "$d_sfio" in
11232 $define) usesfio='true';;
11233 *) usesfio='false';;
11234 esac
11235
11236 : see if shmctl exists
11237 set shmctl d_shmctl
11238 eval $inlibc
11239
11240 : see if shmget exists
11241 set shmget d_shmget
11242 eval $inlibc
11243
11244 : see if shmat exists
11245 set shmat d_shmat
11246 eval $inlibc
11247 : see what shmat returns
11248 case "$d_shmat" in
11249 "$define")
11250         $cat >shmat.c <<'END'
11251 #include <sys/shm.h>
11252 void *shmat();
11253 END
11254         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
11255                 shmattype='void *'
11256         else
11257                 shmattype='char *'
11258         fi
11259         echo "and it returns ($shmattype)." >&4
11260         : see if a prototype for shmat is available
11261         xxx=`./findhdr sys/shm.h`
11262         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
11263         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
11264                 val="$define"
11265         else
11266                 val="$undef"
11267         fi
11268         $rm -f shmat.[co]
11269         ;;
11270 *)
11271         val="$undef"
11272         ;;
11273 esac
11274 set d_shmatprototype
11275 eval $setvar
11276
11277 : see if shmdt exists
11278 set shmdt d_shmdt
11279 eval $inlibc
11280
11281 : see how much of the 'shm*(2)' library is present.
11282 h_shm=true
11283 echo " "
11284 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
11285 *"$undef"*) h_shm=false;;
11286 esac
11287 case "$osname" in
11288 freebsd)
11289     case "`ipcs 2>&1`" in
11290     "SVID shared memory"*"not configured"*)
11291         echo "Your $osname does not have the shm*(2) configured." >&4
11292         h_shm=false
11293         val="$undef"
11294         set shmctl d_shmctl
11295         evat $setvar
11296         set shmget d_shmget
11297         evat $setvar
11298         set shmat d_shmat
11299         evat $setvar
11300         set shmdt d_shmdt
11301         evat $setvar
11302         ;;
11303     esac
11304     ;;
11305 esac
11306 : we could also check for sys/ipc.h ...
11307 if $h_shm && $test `./findhdr sys/shm.h`; then
11308         echo "You have the full shm*(2) library." >&4
11309         val="$define"
11310 else
11311         echo "You don't have the full shm*(2) library." >&4
11312         val="$undef"
11313 fi
11314 set d_shm
11315 eval $setvar
11316
11317 echo " "
11318 : see if we have sigaction
11319 if set sigaction val -f d_sigaction; eval $csym; $val; then
11320         echo 'sigaction() found.' >&4
11321         $cat > try.c <<'EOP'
11322 #include <stdio.h>
11323 #include <sys/types.h>
11324 #include <signal.h>
11325 int main()
11326 {
11327     struct sigaction act, oact;
11328     act.sa_flags = 0;
11329     oact.sa_handler = 0;
11330     /* so that act and oact are used */
11331     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
11332 }
11333 EOP
11334         set try
11335         if eval $compile_ok; then
11336                 val="$define"
11337         else
11338                 echo "But you don't seem to have a useable struct sigaction." >&4
11339                 val="$undef"
11340         fi
11341 else
11342         echo 'sigaction NOT found.' >&4
11343         val="$undef"
11344 fi
11345 set d_sigaction; eval $setvar
11346 $rm -f try try$_o try.c
11347
11348 : see if sigsetjmp exists
11349 echo " "
11350 case "$d_sigsetjmp" in
11351 '')
11352         $cat >try.c <<'EOP'
11353 #include <setjmp.h>
11354 sigjmp_buf env;
11355 int set = 1;
11356 int main()
11357 {
11358         if (sigsetjmp(env,1))
11359                 exit(set);
11360         set = 0;
11361         siglongjmp(env, 1);
11362         exit(1);
11363 }
11364 EOP
11365         set try
11366         if eval $compile; then
11367                 if ./try >/dev/null 2>&1; then
11368                         echo "POSIX sigsetjmp found." >&4
11369                         val="$define"
11370                 else
11371                         $cat >&4 <<EOM
11372 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
11373 I'll ignore them.
11374 EOM
11375                         val="$undef"
11376                 fi
11377         else
11378                 echo "sigsetjmp not found." >&4
11379                 val="$undef"
11380         fi
11381         ;;
11382 *) val="$d_sigsetjmp"
11383         case "$d_sigsetjmp" in
11384         $define) echo "POSIX sigsetjmp found." >&4;;
11385         $undef) echo "sigsetjmp not found." >&4;;
11386         esac
11387         ;;
11388 esac
11389 set d_sigsetjmp
11390 eval $setvar
11391 $rm -f try.c try
11392
11393 : see if sys/stat.h is available
11394 set sys/stat.h i_sysstat
11395 eval $inhdr
11396
11397
11398 : see if stat knows about block sizes
11399 echo " "
11400 echo "Checking to see if your struct stat has st_blocks field..." >&4
11401 set d_statblks stat st_blocks $i_sysstat sys/stat.h
11402 eval $hasfield
11403
11404
11405 : see if this is a sys/vfs.h system
11406 set sys/vfs.h i_sysvfs
11407 eval $inhdr
11408
11409
11410 : see if this is a sys/statfs.h system
11411 set sys/statfs.h i_sysstatfs
11412 eval $inhdr
11413
11414
11415 echo " "
11416 echo "Checking to see if your system supports struct statfs..." >&4
11417 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
11418 eval $hasstruct
11419 case "$d_statfs_s" in
11420 "$define")      echo "Yes, it does."   ;;
11421 *)              echo "No, it doesn't." ;;
11422 esac
11423
11424
11425
11426 : see if struct statfs knows about f_flags
11427 case "$d_statfs_s" in
11428 define) 
11429         echo " "
11430         echo "Checking to see if your struct statfs has f_flags field..." >&4
11431         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
11432         eval $hasfield
11433         ;;
11434 *)      val="$undef"
11435         set d_statfs_f_flags
11436         eval $setvar
11437         ;;
11438 esac
11439 case "$d_statfs_f_flags" in
11440 "$define")      echo "Yes, it does."   ;;
11441 *)              echo "No, it doesn't." ;;
11442 esac
11443
11444 : see if _ptr and _cnt from stdio act std
11445 echo " "
11446 if $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
11447         echo "(Looks like you have stdio.h from Linux.)"
11448         case "$stdio_ptr" in
11449         '') stdio_ptr='((fp)->_IO_read_ptr)'
11450                 ptr_lval=$define
11451                 ;;
11452         *)      ptr_lval=$d_stdio_ptr_lval;;
11453         esac
11454         case "$stdio_cnt" in
11455         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
11456                 cnt_lval=$undef
11457                 ;;
11458         *)      cnt_lval=$d_stdio_cnt_lval;;
11459         esac
11460         case "$stdio_base" in
11461         '') stdio_base='((fp)->_IO_read_base)';;
11462         esac
11463         case "$stdio_bufsiz" in
11464         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
11465         esac
11466 else
11467         case "$stdio_ptr" in
11468         '') stdio_ptr='((fp)->_ptr)'
11469                 ptr_lval=$define
11470                 ;;
11471         *)      ptr_lval=$d_stdio_ptr_lval;;
11472         esac
11473         case "$stdio_cnt" in
11474         '') stdio_cnt='((fp)->_cnt)'
11475                 cnt_lval=$define
11476                 ;;
11477         *)      cnt_lval=$d_stdio_cnt_lval;;
11478         esac
11479         case "$stdio_base" in
11480         '') stdio_base='((fp)->_base)';;
11481         esac
11482         case "$stdio_bufsiz" in
11483         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
11484         esac
11485 fi
11486 : test whether _ptr and _cnt really work
11487 echo "Checking how std your stdio is..." >&4
11488 $cat >try.c <<EOP
11489 #include <stdio.h>
11490 #define FILE_ptr(fp)    $stdio_ptr
11491 #define FILE_cnt(fp)    $stdio_cnt
11492 int main() {
11493         FILE *fp = fopen("try.c", "r");
11494         char c = getc(fp);
11495         if (
11496                 18 <= FILE_cnt(fp) &&
11497                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
11498         )
11499                 exit(0);
11500         exit(1);
11501 }
11502 EOP
11503 val="$undef"
11504 set try
11505 if eval $compile; then
11506         if ./try; then
11507                 echo "Your stdio acts pretty std."
11508                 val="$define"
11509         else
11510                 echo "Your stdio isn't very std."
11511         fi
11512 else
11513         echo "Your stdio doesn't appear very std."
11514 fi
11515 $rm -f try.c try
11516 set d_stdstdio
11517 eval $setvar
11518
11519 : Can _ptr be used as an lvalue?
11520 case "$d_stdstdio$ptr_lval" in
11521 $define$define) val=$define ;;
11522 *) val=$undef ;;
11523 esac
11524 set d_stdio_ptr_lval
11525 eval $setvar
11526
11527 : Can _cnt be used as an lvalue?
11528 case "$d_stdstdio$cnt_lval" in
11529 $define$define) val=$define ;;
11530 *) val=$undef ;;
11531 esac
11532 set d_stdio_cnt_lval
11533 eval $setvar
11534
11535 : see if _base is also standard
11536 val="$undef"
11537 case "$d_stdstdio" in
11538 $define)
11539         $cat >try.c <<EOP
11540 #include <stdio.h>
11541 #define FILE_base(fp)   $stdio_base
11542 #define FILE_bufsiz(fp) $stdio_bufsiz
11543 int main() {
11544         FILE *fp = fopen("try.c", "r");
11545         char c = getc(fp);
11546         if (
11547                 19 <= FILE_bufsiz(fp) &&
11548                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
11549         )
11550                 exit(0);
11551         exit(1);
11552 }
11553 EOP
11554         set try
11555         if eval $compile; then
11556                 if ./try; then
11557                         echo "And its _base field acts std."
11558                         val="$define"
11559                 else
11560                         echo "But its _base field isn't std."
11561                 fi
11562         else
11563                 echo "However, it seems to be lacking the _base field."
11564         fi
11565         $rm -f try.c try
11566         ;;
11567 esac
11568 set d_stdiobase
11569 eval $setvar
11570
11571 $cat >&4 <<EOM
11572 Checking how to access stdio streams by file descriptor number...
11573 EOM
11574 case "$stdio_stream_array" in
11575 '')     $cat >try.c <<EOCP
11576 #include <stdio.h>
11577 int main() {
11578   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
11579     printf("yes\n");
11580 }
11581 EOCP
11582         for s in _iob __iob __sF
11583         do
11584                 set try -DSTDIO_STREAM_ARRAY=$s
11585                 if eval $compile; then
11586                         case "`./try$exe_ext`" in
11587                         yes)    stdio_stream_array=$s; break ;;
11588                         esac
11589                 fi
11590         done
11591         $rm -f try.* try$exe_ext
11592 esac
11593 case "$stdio_stream_array" in
11594 '')     $cat >&4 <<EOM
11595 I can't figure out how to access stdio streams by file descriptor number.
11596 EOM
11597         d_stdio_stream_array="$undef"
11598         ;;
11599 *)      $cat >&4 <<EOM
11600 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
11601 EOM
11602         d_stdio_stream_array="$define"
11603         ;;
11604 esac
11605
11606 : see if strcoll exists
11607 set strcoll d_strcoll
11608 eval $inlibc
11609
11610 : check for structure copying
11611 echo " "
11612 echo "Checking to see if your C compiler can copy structs..." >&4
11613 $cat >try.c <<'EOCP'
11614 int main()
11615 {
11616         struct blurfl {
11617                 int dyick;
11618         } foo, bar;
11619
11620         foo = bar;
11621 }
11622 EOCP
11623 if $cc -c try.c >/dev/null 2>&1 ; then
11624         val="$define"
11625         echo "Yup, it can."
11626 else
11627         val="$undef"
11628         echo "Nope, it can't."
11629 fi
11630 set d_strctcpy
11631 eval $setvar
11632 $rm -f try.*
11633
11634 : see if strerror and/or sys_errlist[] exist
11635 echo " "
11636 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
11637     if set strerror val -f d_strerror; eval $csym; $val; then
11638                 echo 'strerror() found.' >&4
11639                 d_strerror="$define"
11640                 d_strerrm='strerror(e)'
11641                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
11642                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
11643                         d_syserrlst="$define"
11644                 else
11645                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
11646                         d_syserrlst="$undef"
11647                 fi
11648     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
11649                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
11650                 echo 'strerror() found in string header.' >&4
11651                 d_strerror="$define"
11652                 d_strerrm='strerror(e)'
11653                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
11654                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
11655                                 d_syserrlst="$define"
11656                 else
11657                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
11658                         d_syserrlst="$undef"
11659                 fi
11660     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
11661                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
11662                 d_strerror="$undef"
11663                 d_syserrlst="$define"
11664                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
11665     else
11666                 echo 'strerror() and sys_errlist[] NOT found.' >&4
11667                 d_strerror="$undef"
11668                 d_syserrlst="$undef"
11669                 d_strerrm='"unknown"'
11670     fi
11671 fi
11672
11673 : see if strtod exists
11674 set strtod d_strtod
11675 eval $inlibc
11676
11677 : see if strtol exists
11678 set strtol d_strtol
11679 eval $inlibc
11680
11681 : see if strtold exists
11682 set strtold d_strtold
11683 eval $inlibc
11684
11685 : see if strtoll exists
11686 set strtoll d_strtoll
11687 eval $inlibc
11688
11689 case "$d_longlong-$d_strtoll" in
11690 "$define-$define")
11691         $cat <<EOM
11692 Checking whether your strtoll() works okay...
11693 EOM
11694         $cat >try.c <<'EOCP'
11695 #include <errno.h>
11696 #ifdef __hpux
11697 #define strtoll __strtoll
11698 #endif
11699 #include <stdio.h>
11700 extern long long int strtoll(char *s, char **, int); 
11701 static int bad = 0;
11702 int check(char *s, long long ell, int een) {
11703         long long gll;
11704         errno = 0;
11705         gll = strtoll(s, 0, 10);
11706         if (!((gll == ell) && (errno == een)))
11707                 bad++;
11708 }
11709 int main() {
11710         check(" 1",                                      1LL, 0);
11711         check(" 0",                                      0LL, 0);
11712         check("-1",                                     -1LL, 0);
11713         check("-9223372036854775808", -9223372036854775808LL, 0);
11714         check("-9223372036854775808", -9223372036854775808LL, 0);
11715         check(" 9223372036854775807",  9223372036854775807LL, 0);
11716         check("-9223372036854775808", -9223372036854775808LL, 0);
11717         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
11718         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
11719         if (!bad)
11720                 printf("ok\n");
11721 }
11722 EOCP
11723         set try
11724         if eval $compile; then
11725                 case "`./try`" in
11726                 ok) echo "Your strtoll() seems to be working okay." ;;
11727                 *) cat <<EOM >&4
11728 Your strtoll() doesn't seem to be working okay.
11729 EOM
11730                    d_strtoll="$undef"
11731                    ;;
11732                 esac
11733         fi
11734         ;;
11735 esac
11736
11737 : see if strtoul exists
11738 set strtoul d_strtoul
11739 eval $inlibc
11740
11741 : see if strtoull exists
11742 set strtoull d_strtoull
11743 eval $inlibc
11744
11745 case "$d_longlong-$d_strtoull" in
11746 "$define-$define")
11747         $cat <<EOM
11748 Checking whether your strtoull() works okay...
11749 EOM
11750         $cat >try.c <<'EOCP'
11751 #include <errno.h>
11752 #ifdef __hpux
11753 #define strtoull __strtoull
11754 #endif
11755 #include <stdio.h>
11756 extern unsigned long long int strtoull(char *s, char **, int); 
11757 static int bad = 0;
11758 int check(char *s, long long eull, int een) {
11759         long long gull;
11760         errno = 0;
11761         gull = strtoull(s, 0, 10);
11762         if (!((gull == eull) && (errno == een)))
11763                 bad++;
11764 }
11765 int main() {
11766         check(" 1",                                       1LL, 0);
11767         check(" 0",                                       0LL, 0);
11768         check("18446744073709551615", 18446744073709551615ULL, 0);
11769         check("18446744073709551616", 18446744073709551615ULL, ERANGE);
11770         if (!bad)
11771                 printf("ok\n");
11772 }
11773 EOCP
11774         set try
11775         if eval $compile; then
11776                 case "`./try`" in
11777                 ok) echo "Your strtoull() seems to be working okay." ;;
11778                 *) cat <<EOM >&4
11779 Your strtoull() doesn't seem to be working okay.
11780 EOM
11781                    d_strtoull="$undef"
11782                    ;;
11783                 esac
11784         fi
11785         ;;
11786 esac
11787
11788 : see if strtouq exists
11789 set strtouq d_strtouq
11790 eval $inlibc
11791
11792 : see if strxfrm exists
11793 set strxfrm d_strxfrm
11794 eval $inlibc
11795
11796 : see if symlink exists
11797 set symlink d_symlink
11798 eval $inlibc
11799
11800 : see if syscall exists
11801 set syscall d_syscall
11802 eval $inlibc
11803
11804 : see if sysconf exists
11805 set sysconf d_sysconf
11806 eval $inlibc
11807
11808 : see if system exists
11809 set system d_system
11810 eval $inlibc
11811
11812 : see if tcgetpgrp exists
11813 set tcgetpgrp d_tcgetpgrp
11814 eval $inlibc
11815
11816 : see if tcsetpgrp exists
11817 set tcsetpgrp d_tcsetpgrp
11818 eval $inlibc
11819
11820 : see if prototype for telldir is available
11821 echo " "
11822 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
11823 eval $hasproto
11824
11825 : see if this is a sys/times.h system
11826 set sys/times.h i_systimes
11827 eval $inhdr
11828
11829 : see if times exists
11830 echo " "
11831 if set times val -f d_times; eval $csym; $val; then
11832         echo 'times() found.' >&4
11833         d_times="$define"
11834         inc=''
11835         case "$i_systimes" in
11836         "$define") inc='sys/times.h';;
11837         esac
11838         rp="What is the type returned by times() on this system?"
11839         set clock_t clocktype long stdio.h sys/types.h $inc
11840         eval $typedef_ask
11841 else
11842         echo 'times() NOT found, hope that will do.' >&4
11843         d_times="$undef"
11844         clocktype='int'
11845 fi
11846
11847 : see if truncate exists
11848 set truncate d_truncate
11849 eval $inlibc
11850
11851 : see if tzname[] exists
11852 echo " "
11853 if set tzname val -a d_tzname; eval $csym; $val; then
11854         val="$define"
11855         echo 'tzname[] found.' >&4
11856 else
11857         val="$undef"
11858         echo 'tzname[] NOT found.' >&4
11859 fi
11860 set d_tzname
11861 eval $setvar
11862
11863 : see if umask exists
11864 set umask d_umask
11865 eval $inlibc
11866
11867 : see if ustat exists
11868 set ustat d_ustat
11869 eval $inlibc
11870
11871 : backward compatibility for d_hvfork
11872 if test X$d_hvfork != X; then
11873         d_vfork="$d_hvfork"
11874         d_hvfork=''
11875 fi
11876 : see if there is a vfork
11877 val=''
11878 set vfork val
11879 eval $inlibc
11880
11881 : Ok, but do we want to use it. vfork is reportedly unreliable in 
11882 : perl on Solaris 2.x, and probably elsewhere.
11883 case "$val" in
11884 $define)
11885         echo " "
11886         case "$usevfork" in
11887         false) dflt='n';;
11888         *) dflt='y';;
11889         esac
11890         cat <<'EOM'
11891  
11892 Perl can only use a vfork() that doesn't suffer from strict
11893 restrictions on calling functions or modifying global data in
11894 the child.  For example, glibc-2.1 contains such a vfork()
11895 that is unsuitable.  If your system provides a proper fork()
11896 call, chances are that you do NOT want perl to use vfork().
11897
11898 EOM
11899         rp="Do you still want to use vfork()?"
11900         . ./myread
11901         case "$ans" in
11902         y|Y) ;;
11903         *)
11904                 echo "Ok, we won't use vfork()."
11905                 val="$undef"
11906                 ;;
11907         esac
11908         ;;
11909 esac
11910 set d_vfork
11911 eval $setvar
11912 case "$d_vfork" in
11913 $define) usevfork='true';;
11914 *) usevfork='false';;
11915 esac
11916
11917 : see if this is an sysdir system
11918 set sys/dir.h i_sysdir
11919 eval $inhdr
11920
11921 : see if this is an sysndir system
11922 set sys/ndir.h i_sysndir
11923 eval $inhdr
11924
11925 : see if closedir exists
11926 set closedir d_closedir
11927 eval $inlibc
11928
11929 case "$d_closedir" in
11930 "$define")
11931         echo " "
11932         echo "Checking whether closedir() returns a status..." >&4
11933         cat > closedir.c <<EOM
11934 #$i_dirent I_DIRENT             /**/
11935 #$i_sysdir I_SYS_DIR            /**/
11936 #$i_sysndir I_SYS_NDIR          /**/
11937 #$i_systypes I_SYS_TYPES        /**/
11938
11939 #if defined(I_SYS_TYPES)
11940 #include <sys/types.h>
11941 #endif
11942 #if defined(I_DIRENT)
11943 #include <dirent.h>
11944 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
11945 #include <sys/dir.h>
11946 #endif
11947 #else
11948 #ifdef I_SYS_NDIR
11949 #include <sys/ndir.h>
11950 #else
11951 #ifdef I_SYS_DIR
11952 #ifdef hp9000s500
11953 #include <ndir.h>       /* may be wrong in the future */
11954 #else
11955 #include <sys/dir.h>
11956 #endif
11957 #endif
11958 #endif
11959 #endif 
11960 int main() { return closedir(opendir(".")); }
11961 EOM
11962         set closedir
11963         if eval $compile_ok; then
11964                 if ./closedir > /dev/null 2>&1 ; then
11965                         echo "Yes, it does."
11966                         val="$undef"
11967                 else
11968                         echo "No, it doesn't."
11969                         val="$define"
11970                 fi
11971         else
11972                 echo "(I can't seem to compile the test program--assuming it doesn't)"
11973                 val="$define"
11974         fi
11975         ;;
11976 *)
11977         val="$undef";
11978         ;;
11979 esac
11980 set d_void_closedir
11981 eval $setvar
11982 $rm -f closedir*
11983 : check for volatile keyword
11984 echo " "
11985 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
11986 $cat >try.c <<'EOCP'
11987 int main()
11988 {
11989         typedef struct _goo_struct goo_struct;
11990         goo_struct * volatile goo = ((goo_struct *)0);
11991         struct _goo_struct {
11992                 long long_int;
11993                 int reg_int;
11994                 char char_var;
11995         };
11996         typedef unsigned short foo_t;
11997         char *volatile foo;
11998         volatile int bar;
11999         volatile foo_t blech;
12000         foo = foo;
12001 }
12002 EOCP
12003 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
12004         val="$define"
12005         echo "Yup, it does."
12006 else
12007         val="$undef"
12008         echo "Nope, it doesn't."
12009 fi
12010 set d_volatile
12011 eval $setvar
12012 $rm -f try.*
12013
12014 : see if there is a wait4
12015 set wait4 d_wait4
12016 eval $inlibc
12017
12018 : see if waitpid exists
12019 set waitpid d_waitpid
12020 eval $inlibc
12021
12022 : see if wcstombs exists
12023 set wcstombs d_wcstombs
12024 eval $inlibc
12025
12026 : see if wctomb exists
12027 set wctomb d_wctomb
12028 eval $inlibc
12029
12030 : preserve RCS keywords in files with variable substitution, grrr
12031 Date='$Date'
12032 Id='$Id'
12033 Log='$Log'
12034 RCSfile='$RCSfile'
12035 Revision='$Revision'
12036
12037 case "$crosscompile" in
12038 ''|[nN]*) crosscompile="$undef" ;;
12039 esac
12040
12041 case "$osname" in
12042 next|rhapsody|darwin) multiarch="$define" ;;
12043 esac
12044 case "$multiarch" in
12045 ''|[nN]*) multiarch="$undef" ;;
12046 esac
12047
12048 : check for alignment requirements
12049 echo " "
12050 case "$crosscompile$multiarch" in
12051 *$define*)
12052         $cat <<EOM
12053 You seem to be either cross-compiling or doing a multiarchitecture build,
12054 skipping the memory alignment check.
12055
12056 EOM
12057         case "$alignbytes" in
12058         '') alignbytes=8 ;;
12059         esac
12060         ;;
12061 *)
12062         case "$alignbytes" in
12063         '') echo "Checking alignment constraints..." >&4
12064                 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
12065                         $cat >try.c <<'EOCP'
12066 typedef long double NV;
12067 EOCP
12068                 else
12069                         $cat >try.c <<'EOCP'
12070 typedef double NV;
12071 EOCP
12072                 fi
12073                 $cat >>try.c <<'EOCP'
12074 #include <stdio.h>
12075 struct foobar {
12076         char foo;
12077         NV bar;
12078 } try_algn;
12079 int main()
12080 {
12081     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
12082     return(0);
12083 }
12084 EOCP
12085                 set try
12086                 if eval $compile_ok; then
12087                         dflt=`./try`
12088                 else
12089                         dflt='8'
12090                         echo "(I can't seem to compile the test program...)"
12091                 fi
12092                 ;;
12093         *) dflt="$alignbytes"
12094                 ;;
12095         esac
12096         rp="Doubles must be aligned on a how-many-byte boundary?"
12097         . ./myread
12098         alignbytes="$ans"
12099         $rm -f try.c try
12100         ;;
12101 esac
12102
12103
12104 : set the base revision
12105 baserev=5.0
12106
12107 : check for ordering of bytes in a long
12108 echo " "
12109 case "$crosscompile$multiarch" in
12110 *$define*)
12111         $cat <<EOM
12112 You seem to be either cross-compiling or doing a multiarchitecture build,
12113 skipping the byteorder check.
12114
12115 EOM
12116         byteorder='0xffff'
12117         ;;
12118 *)
12119         case "$byteorder" in
12120         '')
12121                 $cat <<'EOM'
12122 In the following, larger digits indicate more significance.  A big-endian
12123 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
12124 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
12125 machines may have weird orders like 3412.  A Cray will report 87654321,
12126 an Alpha will report 12345678. If the test program works the default is
12127 probably right.
12128 I'm now running the test program...
12129 EOM
12130                 $cat >try.c <<'EOCP'
12131 #include <stdio.h>
12132 int main()
12133 {
12134         int i;
12135         union {
12136                 unsigned long l;
12137                 char c[sizeof(long)];
12138         } u;
12139
12140         if (sizeof(long) > 4)
12141                 u.l = (0x08070605L << 32) | 0x04030201L;
12142         else
12143                 u.l = 0x04030201L;
12144         for (i = 0; i < sizeof(long); i++)
12145                 printf("%c", u.c[i]+'0');
12146         printf("\n");
12147         exit(0);
12148 }
12149 EOCP
12150                 xxx_prompt=y
12151                 set try
12152                 if eval $compile && ./try > /dev/null; then
12153                         dflt=`./try`
12154                         case "$dflt" in
12155                         [1-4][1-4][1-4][1-4]|12345678|87654321)
12156                                 echo "(The test program ran ok.)"
12157                                 echo "byteorder=$dflt"
12158                                 xxx_prompt=n
12159                         ;;
12160                         ????|????????) echo "(The test program ran ok.)" ;;
12161                         *) echo "(The test program didn't run right for some reason.)" ;;
12162                         esac
12163                 else
12164                         dflt='4321'
12165                         cat <<'EOM'
12166 (I can't seem to compile the test program.  Guessing big-endian...)
12167 EOM
12168                 fi
12169                 case "$xxx_prompt" in
12170                 y)
12171                         rp="What is the order of bytes in a long?"
12172                         . ./myread
12173                         byteorder="$ans"
12174                         ;;
12175                 *)      byteorder=$dflt
12176                         ;;
12177                 esac
12178                 ;;
12179         esac
12180         $rm -f try.c try
12181         ;;
12182 esac
12183
12184
12185 : how do we catenate cpp tokens here?
12186 echo " "
12187 echo "Checking to see how your cpp does stuff like catenate tokens..." >&4
12188 $cat >cpp_stuff.c <<'EOCP'
12189 #define RCAT(a,b)a/**/b
12190 #define ACAT(a,b)a ## b
12191 RCAT(Rei,ser)
12192 ACAT(Cir,cus)
12193 EOCP
12194 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
12195 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
12196         echo "Oh!  Smells like ANSI's been here." >&4
12197         echo "We can catify or stringify, separately or together!"
12198         cpp_stuff=42
12199 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
12200         echo "Ah, yes!  The good old days!" >&4
12201         echo "However, in the good old days we don't know how to stringify and"
12202         echo "catify at the same time."
12203         cpp_stuff=1
12204 else
12205         $cat >&4 <<EOM
12206 Hmm, I don't seem to be able to catenate tokens with your cpp.  You're going
12207 to have to edit the values of CAT[2-5] in config.h...
12208 EOM
12209         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
12210 fi
12211 $rm -f cpp_stuff.*
12212
12213 : see if this is a db.h system
12214 set db.h i_db
12215 eval $inhdr
12216
12217 case "$i_db" in
12218 $define)
12219         : Check db version.
12220         echo " "
12221         echo "Checking Berkeley DB version ..." >&4
12222         $cat >try.c <<EOCP
12223 #$d_const HASCONST
12224 #ifndef HASCONST
12225 #define const
12226 #endif
12227 #include <sys/types.h>
12228 #include <stdio.h>
12229 #include <db.h>
12230 int main()
12231 {
12232 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
12233     int Major, Minor, Patch ;
12234     unsigned long Version ;
12235     (void)db_version(&Major, &Minor, &Patch) ;
12236     printf("You have Berkeley DB Version 2 or greater\n");
12237
12238     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
12239                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
12240     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
12241                 Major, Minor, Patch) ;
12242
12243     /* check that db.h & libdb are compatible */
12244     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
12245         printf("db.h and libdb are incompatible\n") ;
12246         exit(3);        
12247     }
12248
12249     printf("db.h and libdb are compatible\n") ;
12250
12251     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
12252                 + DB_VERSION_PATCH ;
12253
12254     /* needs to be >= 2.3.4 */
12255     if (Version < 2003004) {
12256     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
12257         printf("but Perl needs Berkeley DB 2.3.4 or greater\n") ;
12258         exit(2);        
12259     }
12260
12261     exit(0);
12262 #else
12263 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
12264     printf("You have Berkeley DB Version 1\n");
12265     exit(0);    /* DB version < 2: the coast is clear. */
12266 #else
12267     exit(1);    /* <db.h> not Berkeley DB? */
12268 #endif
12269 #endif
12270 }
12271 EOCP
12272         set try
12273         if eval $compile_ok && ./try; then
12274                 echo 'Looks OK.' >&4
12275         else
12276                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
12277                 i_db=$undef
12278                 case " $libs " in
12279                 *"-ldb "*)
12280                         : Remove db from list of libraries to use
12281                         echo "Removing unusable -ldb from library list" >&4
12282                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
12283                         shift
12284                         libs="$*"
12285                         echo "libs = $libs" >&4
12286                         ;;
12287                 esac
12288         fi
12289         $rm -f try.*
12290         ;;
12291 esac
12292
12293 case "$i_db" in
12294 define)
12295         : Check the return type needed for hash 
12296         echo " "
12297         echo "Checking return type needed for hash for Berkeley DB ..." >&4
12298         $cat >try.c <<EOCP
12299 #$d_const HASCONST
12300 #ifndef HASCONST
12301 #define const
12302 #endif
12303 #include <sys/types.h>
12304 #include <db.h>
12305
12306 #ifndef DB_VERSION_MAJOR
12307 u_int32_t hash_cb (ptr, size)
12308 const void *ptr;
12309 size_t size;
12310 {
12311 }
12312 HASHINFO info;
12313 int main()
12314 {
12315         info.hash = hash_cb;
12316 }
12317 #endif
12318 EOCP
12319         if $cc $ccflags -c try.c >try.out 2>&1 ; then
12320                 if $contains warning try.out >>/dev/null 2>&1 ; then
12321                         db_hashtype='int'
12322                 else
12323                         db_hashtype='u_int32_t'
12324                 fi
12325         else
12326                 : XXX Maybe we should just give up here.
12327                 db_hashtype=u_int32_t
12328                 $cat try.out >&4
12329                 echo "Help:  I can't seem to compile the db test program." >&4
12330                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
12331         fi
12332         $rm -f try.*
12333         echo "Your version of Berkeley DB uses $db_hashtype for hash."
12334         ;;
12335 *)      db_hashtype=u_int32_t
12336         ;;
12337 esac
12338 case "$i_db" in
12339 define)
12340         : Check the return type needed for prefix 
12341         echo " "
12342         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
12343         cat >try.c <<EOCP
12344 #$d_const HASCONST
12345 #ifndef HASCONST
12346 #define const
12347 #endif
12348 #include <sys/types.h>
12349 #include <db.h>
12350
12351 #ifndef DB_VERSION_MAJOR
12352 size_t prefix_cb (key1, key2)
12353 const DBT *key1;
12354 const DBT *key2;
12355 {
12356 }
12357 BTREEINFO info;
12358 int main()
12359 {
12360         info.prefix = prefix_cb;
12361 }
12362 #endif
12363 EOCP
12364         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
12365                 if $contains warning try.out >>/dev/null 2>&1 ; then
12366                         db_prefixtype='int'
12367                 else
12368                         db_prefixtype='size_t'
12369                 fi
12370         else
12371                 db_prefixtype='size_t'
12372                 : XXX Maybe we should just give up here.
12373                 $cat try.out >&4
12374                 echo "Help:  I can't seem to compile the db test program." >&4
12375                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
12376         fi
12377         $rm -f try.*
12378         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
12379         ;;
12380 *)      db_prefixtype='size_t'
12381         ;;
12382 esac
12383
12384 : check for void type
12385 echo " "
12386 echo "Checking to see how well your C compiler groks the void type..." >&4
12387 case "$voidflags" in
12388 '')
12389         $cat >try.c <<'EOCP'
12390 #if TRY & 1
12391 void sub() {
12392 #else
12393 sub() {
12394 #endif
12395         extern void moo();      /* function returning void */
12396         void (*goo)();          /* ptr to func returning void */
12397 #if TRY & 8
12398         void *hue;              /* generic ptr */
12399 #endif
12400 #if TRY & 2
12401         void (*foo[10])();
12402 #endif
12403
12404 #if TRY & 4
12405         if(goo == moo) {
12406                 exit(0);
12407         }
12408 #endif
12409         exit(0);
12410 }
12411 int main() { sub(); }
12412 EOCP
12413         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
12414                 voidflags=$defvoidused
12415         echo "Good.  It appears to support void to the level $package wants.">&4
12416                 if $contains warning .out >/dev/null 2>&1; then
12417                         echo "However, you might get some warnings that look like this:"
12418                         $cat .out
12419                 fi
12420         else
12421 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
12422                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
12423                         echo "It supports 1..."
12424                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
12425                                 echo "It also supports 2..."
12426                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
12427                                         voidflags=7
12428                                         echo "And it supports 4 but not 8 definitely."
12429                                 else
12430                                         echo "It doesn't support 4..."
12431                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
12432                                                 voidflags=11
12433                                                 echo "But it supports 8."
12434                                         else
12435                                                 voidflags=3
12436                                                 echo "Neither does it support 8."
12437                                         fi
12438                                 fi
12439                         else
12440                                 echo "It does not support 2..."
12441                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
12442                                         voidflags=13
12443                                         echo "But it supports 4 and 8."
12444                                 else
12445                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
12446                                                 voidflags=5
12447                                                 echo "And it supports 4 but has not heard about 8."
12448                                         else
12449                                                 echo "However it supports 8 but not 4."
12450                                         fi
12451                                 fi
12452                         fi
12453                 else
12454                         echo "There is no support at all for void."
12455                         voidflags=0
12456                 fi
12457         fi
12458 esac
12459 case "$voidflags" in
12460 "$defvoidused") ;;
12461 *)      $cat >&4 <<'EOM'
12462   Support flag bits are:
12463     1: basic void declarations.
12464     2: arrays of pointers to functions returning void.
12465     4: operations between pointers to and addresses of void functions.
12466     8: generic void pointers.
12467 EOM
12468         dflt="$voidflags";
12469         rp="Your void support flags add up to what?"
12470         . ./myread
12471         voidflags="$ans"
12472         ;;
12473 esac
12474 $rm -f try.* .out
12475
12476
12477 : How can we generate normalized random numbers ?
12478 echo " "
12479 echo "Looking for a random number function..." >&4
12480 case "$randfunc" in
12481 '')
12482         if set drand48 val -f; eval $csym; $val; then
12483                 dflt="drand48"
12484                 echo "Good, found drand48()." >&4
12485         elif set random val -f; eval $csym; $val; then
12486                 dflt="random"
12487                 echo "OK, found random()." >&4
12488         else
12489                 dflt="rand"
12490                 echo "Yick, looks like I have to use rand()." >&4
12491         fi
12492         echo " "
12493         ;;
12494 *)
12495         dflt="$randfunc"
12496         ;;
12497 esac
12498 cont=true
12499
12500 case "$ccflags" in
12501 *-Dmy_rand=*|*-Dmy_srand=*)
12502         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
12503         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
12504         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
12505         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
12506         ;;
12507 esac
12508
12509 while $test "$cont"; do
12510         rp="Use which function to generate random numbers?"
12511         . ./myread
12512         if $test "$ans" = "$dflt"; then
12513                 : null
12514         else
12515                 randbits=''
12516         fi
12517         randfunc="$ans"
12518         if set $ans val -f; eval $csym; $val; then
12519                 cont=''
12520         else
12521                 dflt=y
12522                 rp="I cannot find function $ans. Use that name anyway?"
12523                 . ./myread
12524                 dflt=rand
12525                 case "$ans" in
12526                         [yY]*) cont='';;
12527                 esac
12528         fi
12529         case "$cont" in
12530         '')
12531                 case "$randfunc" in
12532                 drand48)
12533                         drand01="drand48()"
12534                         seedfunc="srand48"
12535                         randbits=48
12536                         randseedtype=long
12537                         ;;
12538                 rand|random)
12539                         case "$randbits" in
12540                         '')
12541 echo "Checking to see how many bits your $randfunc() function produces..." >&4
12542                                 $cat >try.c <<EOCP
12543 #$i_unistd I_UNISTD
12544 #$i_stdlib I_STDLIB
12545 #include <stdio.h>
12546 #ifdef I_UNISTD
12547 #  include <unistd.h>
12548 #endif
12549 #ifdef I_STDLIB
12550 #  include <stdlib.h>
12551 #endif
12552 int main()
12553 {
12554         register int i;
12555         register unsigned long tmp;
12556         register unsigned long max = 0L;
12557
12558         for (i = 1000; i; i--) {
12559                 tmp = (unsigned long) $randfunc();
12560                 if (tmp > max) max = tmp;
12561         }
12562         for (i = 0; max; i++)
12563                 max /= 2;
12564         printf("%d\n",i);
12565 }
12566 EOCP
12567                                 set try
12568                                 if eval $compile_ok; then
12569                                         dflt=`try`
12570                                 else
12571                                         dflt='?'
12572                                         echo "(I can't seem to compile the test program...)"
12573                                 fi
12574                                 ;;
12575                         *)
12576                                 dflt="$randbits"
12577                                 ;;
12578                         esac
12579                         rp="How many bits does your $randfunc() function produce?"
12580                         . ./myread
12581                         randbits="$ans"
12582                         $rm -f try.c try
12583                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
12584                         seedfunc="s$randfunc"
12585                         randseedtype=unsigned
12586                         ;;
12587                 *)
12588                         dflt="31"
12589                         rp="How many bits does your $randfunc() function produce?"
12590                         . ./myread
12591                         randbits="$ans"
12592                         seedfunc="s$randfunc"
12593                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
12594                         if set $seedfunc val -f; eval $csym; $val; then
12595                                 echo "(Using $seedfunc() to seed random generator)"
12596                         else
12597                                 echo "(Warning: no $seedfunc() to seed random generator)"
12598                                 seedfunc=rand
12599                         fi
12600                         randseedtype=unsigned
12601                         ;;
12602                 esac
12603                 ;;
12604         esac
12605 done
12606
12607 echo " "
12608 echo "Determining whether or not we are on an EBCDIC system..." >&4
12609 $cat >tebcdic.c <<'EOM'
12610 int main()
12611 {
12612   if ('M'==0xd4) return 0;
12613   return 1;
12614 }
12615 EOM
12616
12617 val=$undef
12618 set tebcdic
12619 if eval $compile_ok; then
12620         if ./tebcdic; then
12621                 echo "You have EBCDIC." >&4
12622                 val="$define"
12623         else
12624                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin." >&4
12625         fi
12626 else
12627         echo "I'm unable to compile the test program." >&4
12628         echo "I'll assume ASCII or some ISO Latin." >&4
12629 fi
12630 $rm -f tebcdic.c tebcdic
12631 set ebcdic
12632 eval $setvar
12633
12634 echo " "
12635 $cat >&4 <<EOM
12636 Checking how to flush all pending stdio output...
12637 EOM
12638 # I only know how to find the first 32 possibly open files on SunOS.
12639 # See also hints/sunos_4_1.sh and util.c  --AD
12640 case "$osname" in
12641 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
12642 esac
12643 $cat >>try.c <<EOCP
12644 #include <stdio.h>
12645 #$i_unistd I_UNISTD
12646 #ifdef I_UNISTD
12647 # include <unistd.h>
12648 #endif
12649 #$d_sysconf HAS_SYSCONF
12650 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
12651 #ifdef HAS_STDIO_STREAM_ARRAY
12652 # define STDIO_STREAM_ARRAY $stdio_stream_array
12653 #endif
12654 int main() {
12655   FILE* p = fopen("try.out", "w");
12656 #ifdef TRY_FPUTC
12657   fputc('x', p);
12658 #else
12659 # ifdef TRY_FPRINTF
12660   fprintf(p, "x");
12661 # endif
12662 #endif
12663 #ifdef TRY_FFLUSH_NULL
12664   fflush(NULL);
12665 #endif
12666 #ifdef TRY_FFLUSH_ALL
12667   {
12668     long open_max = -1;
12669 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
12670     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
12671 # else
12672 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
12673     open_max = sysconf(_SC_OPEN_MAX);
12674 #  else
12675 #   ifdef FOPEN_MAX
12676     open_max = FOPEN_MAX;
12677 #   else
12678 #    ifdef OPEN_MAX
12679     open_max = OPEN_MAX;
12680 #    else
12681 #     ifdef _NFILE
12682     open_max = _NFILE;
12683 #     endif
12684 #    endif
12685 #   endif
12686 #  endif
12687 # endif 
12688 # ifdef HAS_STDIO_STREAM_ARRAY
12689     if (open_max > 0) {
12690       long i;
12691       for (i = 0; i < open_max; i++)
12692             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
12693                 STDIO_STREAM_ARRAY[i]._file < open_max &&
12694                 STDIO_STREAM_ARRAY[i]._flag)
12695                 fflush(&STDIO_STREAM_ARRAY[i]);
12696     }   
12697   }
12698 # endif
12699 #endif
12700   _exit(42);
12701 }
12702 EOCP
12703 : first we have to find out how _not_ to flush
12704 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
12705     output=''
12706     set try -DTRY_FPUTC
12707     if eval $compile; then
12708             $rm -f try.out
12709             ./try$exe_ext 2>/dev/null
12710             if $test ! -s try.out -a "X$?" = X42; then
12711                 output=-DTRY_FPUTC
12712             fi
12713     fi
12714     case "$output" in
12715     '')
12716             set try -DTRY_FPRINTF
12717             $rm -f try.out
12718             if eval $compile; then
12719                     $rm -f try.out
12720                     ./try$exe_ext 2>/dev/null
12721                     if $test ! -s try.out -a "X$?" = X42; then
12722                         output=-DTRY_FPRINTF
12723                     fi
12724             fi
12725         ;;
12726     esac
12727 fi
12728 : check for fflush NULL behaviour
12729 case "$fflushNULL" in
12730 '')     set try -DTRY_FFLUSH_NULL $output
12731         if eval $compile; then
12732                 $rm -f try.out
12733                 ./try$exe_ext 2>/dev/null
12734                 code="$?"
12735                 if $test -s try.out -a "X$code" = X42; then
12736                         fflushNULL="`$cat try.out`"
12737                 else
12738                         if $test "X$code" != X42; then
12739                                 $cat >&4 <<EOM
12740 (If this test failed, don't worry, we'll try another method shortly.)
12741 EOM
12742                         fi
12743                 fi
12744         fi
12745         $rm -f core try.core core.try.*
12746         case "$fflushNULL" in
12747         x)      $cat >&4 <<EOM
12748 Your fflush(NULL) works okay for output streams.
12749 Let's see if it clobbers input pipes...
12750 EOM
12751 # As of mid-March 2000 all versions of Solaris appear to have a stdio
12752 # bug that improperly flushes the input end of pipes.  So we avoid the
12753 # autoflush on fork/system/exec support for now. :-(
12754 $cat >tryp.c <<EOCP
12755 #include <stdio.h>
12756 int
12757 main(int argc, char **argv)
12758 {
12759     char buf[1024];
12760     int i;
12761     char *bp = buf;
12762     while (1) {
12763         while ((i = getc(stdin)) != -1
12764                && (*bp++ = i) != '\n'
12765                && bp < &buf[1024])
12766         /* DO NOTHING */ ;
12767         *bp = '\0';
12768         fprintf(stdout, "%s", buf);
12769         fflush(NULL);
12770         if (i == -1)
12771             return 0;
12772         bp = buf;
12773     }
12774 }
12775 EOCP
12776                 fflushNULL="$define"
12777                 set tryp
12778                 if eval $compile; then
12779                     $rm -f tryp.out
12780                     $cat tryp.c | ./tryp$exe_ext 2>/dev/null > tryp.out
12781                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
12782                        $cat >&4 <<EOM
12783 fflush(NULL) seems to behave okay with input streams.
12784 EOM
12785                         fflushNULL="$define"
12786                     else
12787                         $cat >&4 <<EOM
12788 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
12789 EOM
12790                         fflushNULL="$undef"
12791                     fi
12792                 fi
12793                 $rm -f core tryp.c tryp.core core.tryp.*
12794                 ;;
12795         '')     $cat >&4 <<EOM
12796 Your fflush(NULL) isn't working (contrary to ANSI C).
12797 EOM
12798                 fflushNULL="$undef"
12799                 ;;
12800         *)      $cat >&4 <<EOM
12801 Cannot figure out whether your fflush(NULL) works or not.
12802 I'm assuming it doesn't (contrary to ANSI C).
12803 EOM
12804                 fflushNULL="$undef"
12805                 ;;
12806         esac
12807         ;;
12808 $define|true|[yY]*)
12809         fflushNULL="$define"
12810         ;;
12811 *)
12812         fflushNULL="$undef"
12813         ;;
12814 esac
12815 : check explicit looping only if NULL did not work, and if the pipe
12816 : bug does not show up on an explicit flush too
12817 case "$fflushNULL" in
12818 "$undef")
12819         $cat >tryp.c <<EOCP
12820 #include <stdio.h>
12821 int
12822 main(int argc, char **argv)
12823 {
12824     char buf[1024];
12825     int i;
12826     char *bp = buf;
12827     while (1) {
12828         while ((i = getc(stdin)) != -1
12829                && (*bp++ = i) != '\n'
12830                && bp < &buf[1024])
12831         /* DO NOTHING */ ;
12832         *bp = '\0';
12833         fprintf(stdout, "%s", buf);
12834         fflush(stdin);
12835         if (i == -1)
12836             return 0;
12837         bp = buf;
12838     }
12839 }
12840 EOCP
12841         set tryp
12842         if eval $compile; then
12843             $rm -f tryp.out
12844             $cat tryp.c | ./tryp$exe_ext 2>/dev/null > tryp.out
12845             if cmp tryp.c tryp.out >/dev/null 2>&1; then
12846                $cat >&4 <<EOM
12847 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
12848 EOM
12849                 : now check for fflushall behaviour
12850                 case "$fflushall" in
12851                 '')     set try -DTRY_FFLUSH_ALL $output
12852                         if eval $compile; then
12853                                 $cat >&4 <<EOM
12854 (Now testing the other method--but note that this also may fail.)
12855 EOM
12856                                 $rm -f try.out
12857                                 ./try$exe_ext 2>/dev/null
12858                                 if $test -s try.out -a "X$?" = X42; then
12859                                         fflushall="`$cat try.out`"
12860                                 fi
12861                         fi
12862                         $rm -f core try.core core.try.*
12863                         case "$fflushall" in
12864                         x)      $cat >&4 <<EOM
12865 Whew. Flushing explicitly all the stdio streams works.
12866 EOM
12867                                 fflushall="$define"
12868                                 ;;
12869                         '')     $cat >&4 <<EOM
12870 Sigh. Flushing explicitly all the stdio streams doesn't work.
12871 EOM
12872                                 fflushall="$undef"
12873                                 ;;
12874                         *)      $cat >&4 <<EOM
12875 Cannot figure out whether flushing stdio streams explicitly works or not.
12876 I'm assuming it doesn't.
12877 EOM
12878                                 fflushall="$undef"
12879                                 ;;
12880                         esac
12881                         ;;
12882                 "$define"|true|[yY]*)
12883                         fflushall="$define"
12884                         ;;
12885                 *)
12886                         fflushall="$undef"
12887                         ;;
12888                 esac
12889             else
12890                 $cat >&4 <<EOM
12891 All is futile.  Even fflush(stdin) clobbers input pipes!
12892 EOM
12893                 fflushall="$undef"
12894             fi
12895         else
12896             fflushall="$undef"
12897         fi
12898         $rm -f core tryp.c tryp.core core.tryp.*
12899         ;;
12900 *)      fflushall="$undef"
12901         ;;
12902 esac
12903
12904 case "$fflushNULL$fflushall" in
12905 undefundef)
12906         $cat <<EOM
12907 OK, I give up.  I cannot figure out how to flush pending stdio output.
12908 We won't be flushing handles at all before fork/exec/popen.
12909 EOM
12910         ;;
12911 esac
12912 $rm -f try.* try$exe_ext
12913
12914 : Store the full pathname to the ar program for use in the C program
12915 : Respect a hint or command line value for full_ar.
12916 case "$full_ar" in
12917 '') full_ar=$ar ;;
12918 esac
12919
12920 : Store the full pathname to the sed program for use in the C program
12921 full_sed=$sed
12922
12923 : see what type gids are declared as in the kernel
12924 echo " "
12925 echo "Looking for the type for group ids returned by getgid()."
12926 set gid_t gidtype xxx stdio.h sys/types.h
12927 eval $typedef
12928 case "$gidtype" in
12929 xxx)
12930         xxx=`./findhdr sys/user.h`
12931         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
12932         case $1 in
12933         unsigned) dflt="$1 $2" ;;
12934         *) dflt="$1" ;;
12935         esac
12936         ;;
12937 *) dflt="$gidtype";;
12938 esac
12939 case "$gidtype" in
12940 gid_t) echo "gid_t found." ;;
12941 *)      rp="What is the type for group ids returned by getgid()?"
12942         . ./myread
12943         gidtype="$ans"
12944         ;;
12945 esac
12946
12947 echo " "
12948 case "$gidtype" in
12949 *_t) zzz="$gidtype"     ;;
12950 *)   zzz="gid"          ;;
12951 esac
12952 echo "Checking the size of $zzz..." >&4 
12953 cat > try.c <<EOCP
12954 #include <sys/types.h>
12955 #include <stdio.h>
12956 int main() {
12957     printf("%d\n", (int)sizeof($gidtype));
12958     exit(0);
12959 }
12960 EOCP
12961 set try
12962 if eval $compile_ok; then
12963         yyy=`./try`
12964         case "$yyy" in
12965         '')     gidsize=4
12966                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
12967                 ;;
12968         *)      gidsize=$yyy
12969                 echo "Your $zzz is $gidsize bytes long."
12970                 ;;
12971         esac
12972 else
12973         gidsize=4
12974         echo "(I can't compile the test program--guessing $gidsize.)" >&4
12975 fi
12976
12977
12978 echo " "
12979 case "$gidtype" in
12980 *_t) zzz="$gidtype"     ;;
12981 *)   zzz="gid"          ;;
12982 esac
12983 echo "Checking the sign of $zzz..." >&4 
12984 cat > try.c <<EOCP
12985 #include <sys/types.h>
12986 #include <stdio.h>
12987 int main() {
12988         $gidtype foo = -1;
12989         if (foo < 0)
12990                 printf("-1\n");
12991         else
12992                 printf("1\n");
12993 }
12994 EOCP
12995 set try
12996 if eval $compile; then
12997         yyy=`./try`
12998         case "$yyy" in
12999         '')     gidsign=1
13000                 echo "(I can't execute the test program--guessing unsigned.)" >&4
13001                 ;;
13002         *)      gidsign=$yyy
13003                 case "$gidsign" in
13004                  1) echo "Your $zzz is unsigned." ;;
13005                 -1) echo "Your $zzz is signed."   ;;
13006                 esac
13007                 ;;
13008         esac
13009 else
13010         gidsign=1
13011         echo "(I can't compile the test program--guessing unsigned.)" >&4
13012 fi
13013
13014
13015 echo " "
13016
13017 if $test X"$quadtype" != X; then
13018
13019 echo "Checking how to print 64-bit integers..." >&4
13020
13021 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
13022         $cat >try.c <<'EOCP'
13023 #include <sys/types.h>
13024 #include <stdio.h>
13025 int main() {
13026   int q = 12345678901;
13027   printf("%ld\n", q);
13028 }
13029 EOCP
13030         set try
13031         if eval $compile; then
13032                 yyy=`./try$exe_ext`
13033                 case "$yyy" in
13034                 12345678901)
13035                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
13036                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIX64='"X"';
13037                         echo "We will use %d."
13038                         ;;
13039                 esac
13040         fi
13041 fi
13042
13043 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
13044         $cat >try.c <<'EOCP'
13045 #include <sys/types.h>
13046 #include <stdio.h>
13047 int main() {
13048   long q = 12345678901;
13049   printf("%ld\n", q);
13050 }
13051 EOCP
13052         set try
13053         if eval $compile; then
13054                 yyy=`./try$exe_ext`
13055                 case "$yyy" in
13056                 12345678901)
13057                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
13058                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIX64='"lX"';
13059                         echo "We will use %ld."
13060                         ;;
13061                 esac
13062         fi
13063 fi
13064
13065 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
13066         $cat >try.c <<'EOCP'
13067 #include <sys/types.h>
13068 #include <inttypes.h>
13069 #include <stdio.h>
13070 int main() {
13071   int64_t q = 12345678901;
13072   printf("%" PRId64 "\n", q);
13073 }
13074 EOCP
13075         set try
13076         if eval $compile; then
13077                 yyy=`./try$exe_ext`
13078                 case "$yyy" in
13079                 12345678901)
13080                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
13081                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIX64=PRIX64;
13082                         echo "We will use the C9X style."
13083                         ;;
13084                 esac
13085         fi
13086 fi
13087
13088 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
13089         $cat >try.c <<'EOCP'
13090 #include <sys/types.h>
13091 #include <stdio.h>
13092 int main() {
13093   long long q = 12345678901LL; /* AIX cc requires the LL prefix. */
13094   printf("%lld\n", q);
13095 }
13096 EOCP
13097         set try
13098         if eval $compile; then
13099                 yyy=`./try$exe_ext`
13100                 case "$yyy" in
13101                 12345678901)
13102                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
13103                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIX64='"llX"';
13104                         echo "We will use the %lld style."
13105                         ;;
13106                 esac
13107         fi
13108 fi
13109
13110 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
13111         $cat >try.c <<EOCP
13112 #include <sys/types.h>
13113 #include <stdio.h>
13114 int main() {
13115   $quadtype q = 12345678901;
13116   printf("%Ld\n", q);
13117 }
13118 EOCP
13119         set try
13120         if eval $compile; then
13121                 yyy=`./try$exe_ext`
13122                 case "$yyy" in
13123                 12345678901)
13124                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
13125                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIX64='"LX"';
13126                         echo "We will use %Ld."
13127                         ;;
13128                 esac
13129         fi
13130 fi
13131
13132 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
13133         $cat >try.c <<EOCP
13134 #include <sys/types.h>
13135 #include <stdio.h>
13136 int main() {
13137   $quadtype q = 12345678901;
13138   printf("%qd\n", q);
13139 }
13140 EOCP
13141         set try
13142         if eval $compile; then
13143                 yyy=`./try$exe_ext`
13144                 case "$yyy" in
13145                 12345678901)
13146                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
13147                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIX64='"qX"';
13148                         echo "We will use %qd."
13149                         ;;
13150                 esac
13151         fi
13152 fi
13153
13154 if $test X"$sPRId64" = X; then
13155         echo "Cannot figure out how to print 64-bit integers." >&4
13156 fi
13157
13158 $rm -f try try.*
13159
13160 fi
13161
13162 case "$sPRId64" in
13163 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef"; 
13164         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIX64="$undef"; 
13165         ;;
13166 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define"; 
13167         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIX64="$define"; 
13168         ;;
13169 esac
13170
13171
13172 echo " "
13173 $echo "Checking the format strings to be used for Perl's internal types..." >&4
13174
13175 if $test X"$ivsize" = X8; then
13176         ivdformat="$sPRId64"
13177         uvuformat="$sPRIu64"
13178         uvoformat="$sPRIo64"
13179         uvxformat="$sPRIx64"
13180 else
13181         if $test X"$ivsize" = X"$longsize"; then
13182                 ivdformat='"ld"'
13183                 uvuformat='"lu"'
13184                 uvoformat='"lo"'
13185                 uvxformat='"lx"'
13186         else
13187                 if $test X"$ivsize" = X"$intsize"; then
13188                         ivdformat='"d"'
13189                         uvuformat='"u"'
13190                         uvoformat='"o"'
13191                         uvxformat='"x"'
13192                 else
13193                         : far out
13194                         if $test X"$ivsize" = X"$shortsize"; then
13195                                 ivdformat='"hd"'
13196                                 uvuformat='"hu"'
13197                                 uvoformat='"ho"'
13198                                 uvxformat='"hx"'
13199                         fi
13200                 fi
13201         fi
13202 fi
13203
13204 case "$ivdformat" in
13205 '') echo "$0: Fatal: failed to find format strings, cannot continue." >& 4
13206     exit 1
13207     ;;
13208 esac
13209
13210
13211 echo " "
13212 $echo "Checking the format string to be used for gids..." >&4
13213
13214 case "$gidsign" in
13215 -1)     if $test X"$gidsize" = X"$ivsize"; then
13216                 gidformat="$ivdformat"
13217         else
13218                 if $test X"$gidsize" = X"$longsize"; then
13219                         gidformat='"ld"'
13220                 else
13221                         if $test X"$gidsize" = X"$intsize"; then
13222                                 gidformat='"d"'
13223                         else
13224                                 if $test X"$gidsize" = X"$shortsize"; then
13225                                         gidformat='"hd"'
13226                                 fi
13227                         fi
13228                 fi
13229         fi
13230         ;;
13231 *)      if $test X"$gidsize" = X"$uvsize"; then
13232                 gidformat="$uvuformat"
13233         else
13234                 if $test X"$gidsize" = X"$longsize"; then
13235                         gidformat='"lu"'
13236                 else
13237                         if $test X"$gidsize" = X"$intsize"; then
13238                                 gidformat='"u"'
13239                         else
13240                                 if $test X"$gidsize" = X"$shortsize"; then
13241                                         gidformat='"hu"'
13242                                 fi
13243                         fi
13244                 fi
13245         fi
13246         ;;
13247 esac
13248
13249 : see if getgroups exists
13250 set getgroups d_getgrps
13251 eval $inlibc
13252
13253 : see if setgroups exists
13254 set setgroups d_setgrps
13255 eval $inlibc
13256
13257
13258 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
13259 echo " "
13260 case "$d_getgrps$d_setgrps" in
13261 *define*)
13262         case "$groupstype" in
13263         '') dflt="$gidtype" ;;
13264         *)  dflt="$groupstype" ;;
13265         esac
13266         $cat <<EOM
13267 What type of pointer is the second argument to getgroups() and setgroups()?
13268 Usually this is the same as group ids, $gidtype, but not always.
13269
13270 EOM
13271         rp='What type pointer is the second argument to getgroups() and setgroups()?'
13272         . ./myread
13273         groupstype="$ans"
13274         ;;
13275 *)  groupstype="$gidtype";;
13276 esac
13277
13278 echo " "
13279 echo "Checking if your $make program sets \$(MAKE)..." >&4
13280 case "$make_set_make" in
13281 '')
13282         $sed 's/^X //' > testmake.mak << 'EOF'
13283 Xall:
13284 X       @echo 'maketemp="$(MAKE)"'
13285 EOF
13286         case "`$make -f testmake.mak 2>/dev/null`" in
13287         *maketemp=*) make_set_make='#' ;;
13288         *)      make_set_make="MAKE=$make" ;;
13289         esac
13290         $rm -f testmake.mak
13291         ;;
13292 esac
13293 case "$make_set_make" in
13294 '#') echo "Yup, it does.";;
13295 *) echo "Nope, it doesn't.";;
13296 esac
13297
13298 : see what type is used for mode_t
13299 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
13300 set mode_t modetype int stdio.h sys/types.h
13301 eval $typedef_ask
13302
13303 : define a fucntion to check prototypes
13304 $cat > protochk <<EOSH
13305 $startsh
13306 cc="$cc"
13307 optimize="$optimize"
13308 ccflags="$ccflags"
13309 prototype="$prototype"
13310 define="$define"
13311 rm=$rm
13312 EOSH
13313
13314 $cat >> protochk <<'EOSH'
13315
13316 $rm -f try.c
13317 foo="$1"
13318 shift
13319 while test $# -ge 2; do
13320         case "$1" in
13321                 $define) echo "#include <$2>" >> try.c ;;
13322                 literal) echo "$2" >> try.c ;;
13323         esac
13324     shift 2
13325 done
13326 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
13327 cat >> try.c <<'EOCP'
13328 #ifdef CAN_PROTOTYPE
13329 #define _(args) args
13330 #else
13331 #define _(args) ()
13332 #endif
13333 EOCP
13334 echo "$foo" >> try.c
13335 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
13336 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
13337 status=$?
13338 $rm -f try.[co]
13339 exit $status
13340 EOSH
13341 chmod +x protochk
13342 $eunicefix protochk
13343
13344 : see what type is used for size_t
13345 rp="What is the type used for the length parameter for string functions?"
13346 set size_t sizetype 'unsigned int' stdio.h sys/types.h
13347 eval $typedef_ask
13348
13349 : check for type of arguments to gethostbyaddr. 
13350 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
13351         case "$d_gethbyaddr" in
13352         $define)
13353                 $cat <<EOM
13354
13355 Checking to see what type of arguments are accepted by gethostbyaddr().
13356 EOM
13357                 hdrs="$define sys/types.h
13358                         $d_socket sys/socket.h 
13359                         $i_niin netinet/in.h 
13360                         $i_netdb netdb.h
13361                         $i_unistd unistd.h"
13362                 : The first arg can 'char *' or 'void *'
13363                 : The second arg is some of integral type
13364                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
13365                         for yyy in size_t long int; do
13366                                 case "$netdb_host_type" in
13367                                 '')     try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
13368                                         if ./protochk "$try" $hdrs; then
13369                                                 echo "Your system accepts $xxx for the first arg."
13370                                                 echo "...and $yyy for the second arg."
13371                                                 netdb_host_type="$xxx"
13372                                                 netdb_hlen_type="$yyy"
13373                                         fi
13374                                         ;;
13375                                 esac
13376                         done
13377                 done
13378                 : In case none of those worked, prompt the user.
13379                 case "$netdb_host_type" in
13380                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
13381                         dflt='char *'
13382                         . ./myread
13383                         netdb_host_type=$ans
13384                         rp='What is the type for the 2nd argument to gethostbyaddr?'
13385                         dflt="$sizetype"
13386                         . ./myread
13387                         netdb_hlen_type=$ans
13388                         ;;
13389                 esac
13390                 ;;
13391         *)      : no gethostbyaddr, so pick harmless defaults
13392                 netdb_host_type='char *'
13393                 netdb_hlen_type="$sizetype"
13394                 ;;
13395         esac
13396         # Remove the "const" if needed. -- but then we'll have a 
13397         # prototype clash!
13398         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
13399 fi
13400
13401 : check for type of argument to gethostbyname. 
13402 if test "X$netdb_name_type" = X ; then
13403         case "$d_gethbyname" in
13404         $define)
13405                 $cat <<EOM
13406
13407 Checking to see what type of argument is accepted by gethostbyname().
13408 EOM
13409                 hdrs="$define sys/types.h
13410                         $d_socket sys/socket.h 
13411                         $i_niin netinet/in.h 
13412                         $i_netdb netdb.h
13413                         $i_unistd unistd.h"
13414                 for xxx in "const char *" "char *"; do
13415                         case "$netdb_name_type" in
13416                         '')     try="extern struct hostent *gethostbyname($xxx);"
13417                                 if ./protochk "$try" $hdrs; then
13418                                         echo "Your system accepts $xxx."
13419                                         netdb_name_type="$xxx"
13420                                 fi
13421                                 ;;
13422                         esac
13423                 done
13424                 : In case none of those worked, prompt the user.
13425                 case "$netdb_name_type" in
13426                 '')     rp='What is the type for the 1st argument to gethostbyname?'
13427                         dflt='char *'
13428                         . ./myread
13429                         netdb_name_type=$ans
13430                         ;;
13431                 esac
13432                 ;;
13433         *)      : no gethostbyname, so pick harmless default
13434                 netdb_name_type='char *'
13435                 ;;
13436         esac
13437 fi
13438
13439 : check for type of 1st argument to getnetbyaddr. 
13440 if test "X$netdb_net_type" = X ; then
13441         case "$d_getnbyaddr" in
13442         $define)
13443                 $cat <<EOM
13444
13445 Checking to see what type of 1st argument is accepted by getnetbyaddr().
13446 EOM
13447                 hdrs="$define sys/types.h
13448                         $d_socket sys/socket.h 
13449                         $i_niin netinet/in.h 
13450                         $i_netdb netdb.h
13451                         $i_unistd unistd.h"
13452                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
13453                         case "$netdb_net_type" in
13454                         '')     try="extern struct netent *getnetbyaddr($xxx, int);"
13455                                 if ./protochk "$try" $hdrs; then
13456                                         echo "Your system accepts $xxx."
13457                                         netdb_net_type="$xxx"
13458                                 fi
13459                                 ;;
13460                         esac
13461                 done
13462                 : In case none of those worked, prompt the user.
13463                 case "$netdb_net_type" in
13464                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
13465                         dflt='long'
13466                         . ./myread
13467                         netdb_net_type=$ans
13468                         ;;
13469                 esac
13470                 ;;
13471         *)      : no getnetbyaddr, so pick harmless default
13472                 netdb_net_type='long'
13473                 ;;
13474         esac
13475 fi
13476 : locate the preferred pager for this system
13477 case "$pager" in
13478 '')
13479         dflt=''
13480         case "$pg" in
13481         /*) dflt=$pg;;
13482         esac
13483         case "$more" in
13484         /*) dflt=$more;;
13485         esac
13486         case "$less" in
13487         /*) dflt=$less;;
13488         esac
13489         case "$dflt" in
13490         '') dflt=/usr/ucb/more;;
13491         esac
13492         ;;
13493 *) dflt="$pager";;
13494 esac
13495 echo " "
13496 fn=f/
13497 rp='What pager is used on your system?'
13498 . ./getfile
13499 pager="$ans"
13500
13501 : see what type pids are declared as in the kernel
13502 rp="What is the type of process ids on this system?"
13503 set pid_t pidtype int stdio.h sys/types.h
13504 eval $typedef_ask
13505
13506 : Find earliest binary compatible site_perl subdirectory perl can use.
13507 case "$bincompat5005" in
13508 "$define") xs_apiversion='5.005' ;;
13509 *) xs_apiversion=$version ;;   # The current site_perl version.
13510 esac
13511 : Find earliest pure perl site_perl subdirectory perl can use.
13512 : The versioned directories started at 5.005.
13513 pm_apiversion='5.005'
13514
13515 : check for length of pointer
13516 echo " "
13517 case "$ptrsize" in
13518 '')
13519         echo "Checking to see how big your pointers are..." >&4
13520         if test "$voidflags" -gt 7; then
13521                 echo '#define VOID_PTR char *' > try.c
13522         else
13523                 echo '#define VOID_PTR void *' > try.c
13524         fi
13525         $cat >>try.c <<'EOCP'
13526 #include <stdio.h>
13527 int main()
13528 {
13529     printf("%d\n", (int)sizeof(VOID_PTR));
13530     exit(0);
13531 }
13532 EOCP
13533         set try
13534         if eval $compile_ok; then
13535                 ptrsize=`./try`
13536                 echo "Your pointers are $ptrsize bytes long."
13537         else
13538                 dflt='4'
13539                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
13540                 rp="What is the size of a pointer (in bytes)?"
13541                 . ./myread
13542                 ptrsize="$ans"
13543         fi
13544         ;;
13545 esac
13546 $rm -f try.c try
13547
13548 : see if ar generates random libraries by itself
13549 echo " "
13550 echo "Checking how to generate random libraries on your machine..." >&4
13551 echo 'int bar1() { return bar2(); }' > bar1.c
13552 echo 'int bar2() { return 2; }' > bar2.c
13553 $cat > foo.c <<'EOP'
13554 int main() { printf("%d\n", bar1()); exit(0); }
13555 EOP
13556 $cc $ccflags -c bar1.c >/dev/null 2>&1
13557 $cc $ccflags -c bar2.c >/dev/null 2>&1
13558 $cc $ccflags -c foo.c >/dev/null 2>&1
13559 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
13560 if $cc $ccflags $ldflags -o foobar foo$_o bar$_a $libs > /dev/null 2>&1 &&
13561         ./foobar >/dev/null 2>&1; then
13562         echo "$ar appears to generate random libraries itself."
13563         orderlib=false
13564         ranlib=":"
13565 elif $ar ts bar$_a >/dev/null 2>&1 &&
13566         $cc $ccflags $ldflags -o foobar foo$_o bar$_a $libs > /dev/null 2>&1 &&
13567         ./foobar >/dev/null 2>&1; then
13568                 echo "a table of contents needs to be added with '$ar ts'."
13569                 orderlib=false
13570                 ranlib="$ar ts"
13571 else
13572         case "$ranlib" in
13573         :) ranlib='';;
13574         '')
13575                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
13576                 $test -f $ranlib || ranlib=''
13577                 ;;
13578         esac
13579         if $test -n "$ranlib"; then
13580                 echo "your system has '$ranlib'; we'll use that."
13581                 orderlib=false
13582         else
13583                 echo "your system doesn't seem to support random libraries"
13584                 echo "so we'll use lorder and tsort to order the libraries."
13585                 orderlib=true
13586                 ranlib=":"
13587         fi
13588 fi
13589 $rm -f foo* bar* 
13590
13591 : check for type of arguments to select. 
13592 case "$selecttype" in
13593 '') case "$d_select" in
13594         $define)
13595                 echo " "
13596                 $cat <<EOM
13597 Checking to see what type of arguments are accepted by select().
13598 EOM
13599                 hdrs="$define sys/types.h
13600                         $i_systime sys/time.h 
13601                         $i_sysselct sys/select.h
13602                         $d_socket sys/socket.h"
13603                 : The first arg can be int, unsigned, or size_t
13604                 : The last arg may or may not be 'const'
13605                 val=''
13606                 : void pointer has been seen but using that
13607                 : breaks the selectminbits test
13608                 for xxx in 'fd_set *' 'int *'; do
13609                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
13610                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
13611                                         case "$val" in
13612                                         '')     try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
13613                                                 if ./protochk "$try" $hdrs; then
13614                                                         echo "Your system accepts $xxx."
13615                                                         val="$xxx"
13616                                                 fi
13617                                                 ;;
13618                                         esac
13619                                 done
13620                         done
13621                 done
13622                 case "$val" in
13623                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
13624                         case "$d_fd_set" in
13625                                 $define) dflt="fd_set *" ;;
13626                                 *)              dflt="int *" ;;
13627                         esac
13628                         . ./myread
13629                         val=$ans
13630                         ;;
13631                 esac
13632                 selecttype="$val"
13633                 ;;
13634         *)      : no select, so pick a harmless default
13635                 selecttype='int *'
13636                 ;;
13637         esac
13638         ;;
13639 esac
13640
13641 : check for the select 'width'
13642 case "$selectminbits" in
13643 '') case "$d_select" in
13644         $define)
13645                 $cat <<EOM
13646
13647 Checking to see on how many bits at a time your select() operates...
13648 EOM
13649                 $cat >try.c <<EOCP
13650 #include <sys/types.h>
13651 #$i_time I_TIME
13652 #$i_systime I_SYS_TIME
13653 #$i_systimek I_SYS_TIME_KERNEL
13654 #ifdef I_TIME
13655 #   include <time.h>
13656 #endif
13657 #ifdef I_SYS_TIME
13658 #   ifdef I_SYS_TIME_KERNEL
13659 #       define KERNEL
13660 #   endif
13661 #   include <sys/time.h>
13662 #   ifdef I_SYS_TIME_KERNEL
13663 #       undef KERNEL
13664 #   endif
13665 #endif
13666 #$i_sysselct I_SYS_SELECT
13667 #ifdef I_SYS_SELECT
13668 #include <sys/select.h>
13669 #endif
13670 #$d_socket HAS_SOCKET
13671 #ifdef HAS_SOCKET
13672 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
13673 #endif
13674 #include <stdio.h>
13675 $selecttype b;
13676 #define S sizeof(*(b))
13677 #define MINBITS 64
13678 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
13679 #define NBITS  (NBYTES * 8)
13680 int main() {
13681     char s[NBYTES];
13682     struct timeval t;
13683     int i;
13684     FILE* fp;
13685     int fd;
13686
13687     fclose(stdin);
13688     fp = fopen("try.c", "r");
13689     if (fp == 0)
13690       exit(1);
13691     fd = fileno(fp);
13692     if (fd < 0)
13693       exit(2);
13694     b = ($selecttype)s;
13695     for (i = 0; i < NBITS; i++)
13696         FD_SET(i, b);
13697     t.tv_sec  = 0;
13698     t.tv_usec = 0;
13699     select(fd + 1, b, 0, 0, &t);
13700     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
13701     printf("%d\n", i + 1);
13702     return 0;
13703 }
13704 EOCP
13705                 set try
13706                 if eval $compile_ok; then
13707                         selectminbits=`./try`
13708                         case "$selectminbits" in
13709                         '')     cat >&4 <<EOM
13710 Cannot figure out on how many bits at a time your select() operates.
13711 I'll play safe and guess it is 32 bits.
13712 EOM
13713                                 selectminbits=32
13714                                 bits="32 bits"
13715                                 ;;
13716                         1)      bits="1 bit" ;;
13717                         *)      bits="$selectminbits bits" ;;
13718                         esac
13719                         echo "Your select() operates on $bits at a time." >&4
13720                 else
13721                         rp='What is the minimum number of bits your select() operates on?'
13722                         case "$byteorder" in
13723                         1234|12345678)  dflt=32 ;;
13724                         *)              dflt=1  ;;
13725                         esac
13726                         . ./myread
13727                         val=$ans
13728                         selectminbits="$val"
13729                 fi
13730                 $rm -f try.* try
13731                 ;;
13732         *)      : no select, so pick a harmless default
13733                 selectminbits='32'
13734                 ;;
13735         esac
13736         ;;
13737 esac
13738
13739 : Trace out the files included by signal.h, then look for SIGxxx names.
13740 : Remove SIGARRAYSIZE used by HPUX.
13741 : Remove SIGSTKSIZE used by Linux.
13742 : Remove SIGSTKSZ used by Posix.
13743 : Remove SIGTYP void lines used by OS2.
13744 : Some cpps, like os390, dont give the file name anywhere
13745 if [ "X$fieldn" = X ]; then
13746         : Just make some guesses.  We check them later.
13747         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
13748 else
13749         xxx=`echo '#include <signal.h>' |
13750         $cppstdin $cppminus $cppflags 2>/dev/null |
13751         $grep '^[       ]*#.*include' | 
13752         $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sort | $uniq`
13753 fi
13754 : Check this list of files to be sure we have parsed the cpp output ok.
13755 : This will also avoid potentially non-existent files, such 
13756 : as ../foo/bar.h
13757 xxxfiles=''
13758 for xx in $xxx /dev/null ; do
13759         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
13760 done
13761 : If we have found no files, at least try signal.h
13762 case "$xxxfiles" in
13763 '')     xxxfiles=`./findhdr signal.h` ;;
13764 esac
13765 xxx=`awk '
13766 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
13767         print substr($2, 4, 20)
13768 }
13769 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
13770         print substr($3, 4, 20)
13771 }' $xxxfiles`
13772 : Append some common names just in case the awk scan failed.
13773 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
13774 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
13775 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
13776 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
13777 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
13778
13779 : generate a few handy files for later
13780 $cat > signal.c <<'EOCP'
13781 #include <sys/types.h>
13782 #include <signal.h>
13783 #include <stdio.h>
13784 int main() {
13785
13786 /* Strange style to avoid deeply-nested #if/#else/#endif */
13787 #ifndef NSIG
13788 #  ifdef _NSIG
13789 #    define NSIG (_NSIG)
13790 #  endif
13791 #endif
13792
13793 #ifndef NSIG
13794 #  ifdef SIGMAX
13795 #    define NSIG (SIGMAX+1)
13796 #  endif
13797 #endif
13798
13799 #ifndef NSIG
13800 #  ifdef SIG_MAX
13801 #    define NSIG (SIG_MAX+1)
13802 #  endif
13803 #endif
13804
13805 #ifndef NSIG
13806 #  ifdef MAXSIG
13807 #    define NSIG (MAXSIG+1)
13808 #  endif
13809 #endif
13810
13811 #ifndef NSIG
13812 #  ifdef MAX_SIG
13813 #    define NSIG (MAX_SIG+1)
13814 #  endif
13815 #endif
13816
13817 #ifndef NSIG
13818 #  ifdef SIGARRAYSIZE
13819 #    define NSIG (SIGARRAYSIZE+1) /* Not sure of the +1 */
13820 #  endif
13821 #endif
13822
13823 #ifndef NSIG
13824 #  ifdef _sys_nsig
13825 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
13826 #  endif
13827 #endif
13828
13829 /* Default to some arbitrary number that's big enough to get most
13830    of the common signals.
13831 */
13832 #ifndef NSIG
13833 #    define NSIG 50
13834 #endif
13835
13836 printf("NSIG %d\n", NSIG);
13837
13838 #ifndef JUST_NSIG
13839
13840 EOCP
13841
13842 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
13843 {
13844         printf "#ifdef SIG"; printf $1; printf "\n"
13845         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
13846         printf $1; printf ");\n"
13847         printf "#endif\n"
13848 }
13849 END {
13850         printf "#endif /* JUST_NSIG */\n";
13851         printf "exit(0);\n}\n";
13852 }
13853 ' >>signal.c
13854 $cat >signal.awk <<'EOP'
13855 BEGIN { ndups = 0 }
13856 $1 ~ /^NSIG$/ { nsig = $2 }
13857 ($1 !~ /^NSIG$/) && (NF == 2) {
13858     if ($2 > maxsig) { maxsig = $2 }
13859     if (sig_name[$2]) {
13860         dup_name[ndups] = $1
13861         dup_num[ndups] = $2
13862         ndups++ 
13863     }
13864     else {
13865         sig_name[$2] = $1
13866         sig_num[$2] = $2
13867     }
13868 }
13869 END { 
13870     if (nsig == 0) {
13871         nsig = maxsig + 1
13872     }
13873     printf("NSIG %d\n", nsig);
13874     for (n = 1; n < nsig; n++) {
13875         if (sig_name[n]) {
13876             printf("%s %d\n", sig_name[n], sig_num[n])
13877         }
13878         else {
13879             printf("NUM%d %d\n", n, n) 
13880         }
13881     }
13882     for (n = 0; n < ndups; n++) {
13883         printf("%s %d\n", dup_name[n], dup_num[n])
13884     }
13885 }
13886 EOP
13887 $cat >signal_cmd <<EOS
13888 $startsh
13889 if $test -s signal.lst; then
13890     echo "Using your existing signal.lst file"
13891         exit 0
13892 fi
13893 xxx="$xxx"
13894 EOS
13895 $cat >>signal_cmd <<'EOS'
13896
13897 set signal
13898 if eval $compile_ok; then
13899         ./signal$_exe | $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
13900 else
13901         echo "(I can't seem be able to compile the whole test program)" >&4
13902         echo "(I'll try it in little pieces.)" >&4
13903         set signal -DJUST_NSIG
13904         if eval $compile_ok; then
13905                 ./signal$_exe > signal.nsg
13906                 $cat signal.nsg
13907         else
13908                 echo "I can't seem to figure out how many signals you have." >&4
13909                 echo "Guessing 50." >&4
13910                 echo 'NSIG 50' > signal.nsg
13911         fi
13912         : Now look at all the signal names, one at a time.
13913         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
13914                 $cat > signal.c <<EOCP
13915 #include <sys/types.h>
13916 #include <signal.h>
13917 #include <stdio.h>
13918 int main() {
13919 printf("$xx %d\n", SIG${xx});
13920 return 0;
13921 }
13922 EOCP
13923                 set signal
13924                 if eval $compile; then
13925                         echo "SIG${xx} found."
13926                         ./signal$_exe  >> signal.ls1
13927                 else
13928                         echo "SIG${xx} NOT found."
13929                 fi
13930         done
13931         if $test -s signal.ls1; then
13932                 $cat signal.nsg signal.ls1 |
13933                         $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
13934         fi
13935
13936 fi
13937 if $test -s signal.lst; then
13938         :
13939 else
13940         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
13941         echo 'kill -l' >signal
13942         set X `csh -f <signal`
13943         $rm -f signal
13944         shift
13945         case $# in
13946         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
13947         esac
13948         echo $@ | $tr ' ' $trnl | \
13949             $awk '{ printf "%s %d\n", $1, ++s; }
13950                   END { printf "NSIG %d\n", ++s }' >signal.lst
13951 fi
13952 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
13953 EOS
13954 chmod a+x signal_cmd
13955 $eunicefix signal_cmd
13956
13957 : generate list of signal names
13958 echo " "
13959 case "$sig_name_init" in
13960 '') doinit=yes ;;
13961 *)  case "$sig_num_init" in
13962     ''|*,*) doinit=yes ;;
13963     esac ;;
13964 esac
13965 case "$doinit" in
13966 yes)
13967         echo "Generating a list of signal names and numbers..." >&4
13968         . ./signal_cmd
13969         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
13970         sig_name=`$awk 'BEGIN { printf "ZERO " }
13971                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
13972         sig_num=`$awk  'BEGIN { printf "0 " }
13973                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
13974         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
13975                              !/^NSIG/   { printf "\"%s\", ", $1 }
13976                              END        { printf "0\n" }' signal.lst`
13977         sig_num_init=`$awk  'BEGIN      { printf "0, " }
13978                              !/^NSIG/   { printf "%d, ", $2}
13979                              END        { printf "0\n"}' signal.lst`
13980         ;;
13981 esac
13982 echo "The following $sig_count signals are available:"
13983 echo " "
13984 echo $sig_name | $awk \
13985 'BEGIN { linelen = 0 }
13986 {
13987         for (i = 1; i <= NF; i++) {
13988                 name = "SIG" $i " "
13989                 linelen = linelen + length(name)
13990                 if (linelen > 70) {
13991                         printf "\n"
13992                         linelen = length(name)
13993                 }
13994                 printf "%s", name
13995         }
13996         printf "\n"
13997 }'
13998 $rm -f signal signal.c signal.awk signal.lst signal_cmd 
13999
14000 echo " "
14001 case "$sizetype" in
14002 *_t) zzz="$sizetype"    ;;
14003 *)   zzz="filesize"     ;;
14004 esac
14005 echo "Checking the size of $zzz..." >&4 
14006 cat > try.c <<EOCP
14007 #include <sys/types.h>
14008 #include <stdio.h>
14009 int main() {
14010     printf("%d\n", (int)sizeof($sizetype));
14011     exit(0);
14012 }
14013 EOCP
14014 set try
14015 if eval $compile_ok; then
14016         yyy=`./try`
14017         case "$yyy" in
14018         '')     sizesize=4
14019                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
14020                 ;;
14021         *)      sizesize=$yyy
14022                 echo "Your $zzz size is $sizesize bytes."
14023                 ;;
14024         esac
14025 else
14026         sizesize=4
14027         echo "(I can't compile the test program--guessing $sizesize.)" >&4
14028 fi
14029
14030
14031 : check for socklen_t
14032 echo " "
14033 echo "Checking to see if you have socklen_t..." >&4
14034 $cat >try.c <<EOCP
14035 #include <sys/types.h>
14036 #$d_socket HAS_SOCKET
14037 #ifdef HAS_SOCKET
14038 #include <sys/socket.h>
14039 #endif
14040 int main() { socklen_t x = 16; }
14041 EOCP
14042 set try
14043 if eval $compile; then
14044         val="$define"
14045         echo "You have socklen_t."
14046 else
14047         val="$undef"
14048         echo "You do not have socklen_t."
14049         case "$sizetype" in
14050         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
14051         esac
14052 fi
14053 $rm -f try try.*
14054 set d_socklen_t
14055 eval $setvar
14056
14057 : check for type of the size argument to socket calls
14058 case "$d_socket" in
14059 "$define")
14060         $cat <<EOM
14061
14062 Checking to see what type is the last argument of accept().
14063 EOM
14064         hdrs="$define sys/types.h $d_socket sys/socket.h" 
14065         yyy=''
14066         case "$d_socklen_t" in
14067         "$define") yyy="$yyy socklen_t"
14068         esac
14069         yyy="$yyy $sizetype int long unsigned"
14070         for xxx in $yyy; do
14071                 case "$socksizetype" in
14072                 '')     try="extern int accept(int, struct sockaddr *, $xxx *);"
14073                         if ./protochk "$try" $hdrs; then
14074                                 echo "Your system accepts '$xxx *' for the last argument of accept()."
14075                                 socksizetype="$xxx"
14076                         fi
14077                         ;;
14078                 esac
14079         done
14080 : In case none of those worked, prompt the user.
14081         case "$socksizetype" in
14082         '')     rp='What is the type for socket address structure sizes?'
14083                 dflt='int'
14084                 . ./myread
14085                 socksizetype=$ans
14086                 ;;
14087         esac
14088         ;;
14089 *)      : no sockets, so pick relatively harmless default
14090         socksizetype='int'
14091         ;;
14092 esac
14093
14094 : see what type is used for signed size_t
14095 set ssize_t ssizetype int stdio.h sys/types.h
14096 eval $typedef
14097 dflt="$ssizetype"
14098 $cat > ssize.c <<EOM
14099 #include <stdio.h>
14100 #include <sys/types.h>
14101 #define Size_t $sizetype
14102 #define SSize_t $dflt
14103 int main()
14104 {
14105         if (sizeof(Size_t) == sizeof(SSize_t))
14106                 printf("$dflt\n");
14107         else if (sizeof(Size_t) == sizeof(int))
14108                 printf("int\n");
14109         else 
14110                 printf("long\n");
14111         exit(0);
14112 }
14113 EOM
14114 echo " "
14115 set ssize
14116 if eval $compile_ok && ./ssize > /dev/null; then
14117         ssizetype=`./ssize`
14118         echo "I'll be using $ssizetype for functions returning a byte count." >&4
14119 else
14120         $cat >&4 <<EOM
14121 Help! I can't compile and run the ssize_t test program: please enlighten me!
14122 (This is probably a misconfiguration in your system or libraries, and
14123 you really ought to fix it.  Still, I'll try anyway.)
14124
14125 I need a type that is the same size as $sizetype, but is guaranteed to
14126 be signed.  Common values are ssize_t, int and long.
14127
14128 EOM
14129         rp="What signed type is the same size as $sizetype?"
14130         . ./myread
14131         ssizetype="$ans"
14132 fi
14133 $rm -f ssize ssize.*
14134
14135 : see what type of char stdio uses.
14136 echo " "
14137 if $contains 'unsigned.*char.*_ptr;' `./findhdr stdio.h` >/dev/null 2>&1 ; then
14138         echo "Your stdio uses unsigned chars." >&4
14139         stdchar="unsigned char"
14140 else
14141         echo "Your stdio uses signed chars." >&4
14142         stdchar="char"
14143 fi
14144
14145 : see if time exists
14146 echo " "
14147 if test "X$d_time" = X -o X"$timetype" = X; then
14148     if set time val -f d_time; eval $csym; $val; then
14149                 echo 'time() found.' >&4
14150                 val="$define"
14151                 rp="What is the type returned by time() on this system?"
14152                 set time_t timetype long stdio.h sys/types.h
14153                 eval $typedef_ask
14154     else
14155                 echo 'time() not found, hope that will do.' >&4
14156                 val="$undef"
14157                 timetype='int';
14158     fi
14159     set d_time
14160     eval $setvar
14161 fi
14162
14163 : see what type uids are declared as in the kernel
14164 echo " "
14165 echo "Looking for the type for user ids returned by getuid()."
14166 set uid_t uidtype xxx stdio.h sys/types.h
14167 eval $typedef
14168 case "$uidtype" in
14169 xxx)
14170         xxx=`./findhdr sys/user.h`
14171         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
14172         case $1 in
14173         unsigned) dflt="$1 $2" ;;
14174         *) dflt="$1" ;;
14175         esac
14176         ;;
14177 *) dflt="$uidtype";;
14178 esac
14179 case "$uidtype" in
14180 uid_t)  echo "uid_t found." ;;
14181 *)      rp="What is the type for user ids returned by getuid()?"
14182         . ./myread
14183         uidtype="$ans"
14184         ;;
14185 esac
14186
14187 echo " "
14188 case "$uidtype" in
14189 *_t) zzz="$uidtype"     ;;
14190 *)   zzz="uid"          ;;
14191 esac
14192 echo "Checking the size of $zzz..." >&4 
14193 cat > try.c <<EOCP
14194 #include <sys/types.h>
14195 #include <stdio.h>
14196 int main() {
14197     printf("%d\n", (int)sizeof($uidtype));
14198     exit(0);
14199 }
14200 EOCP
14201 set try
14202 if eval $compile_ok; then
14203         yyy=`./try`
14204         case "$yyy" in
14205         '')     uidsize=4
14206                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
14207                 ;;
14208         *)      uidsize=$yyy
14209                 echo "Your $zzz is $uidsize bytes long."
14210                 ;;
14211         esac
14212 else
14213         uidsize=4
14214         echo "(I can't compile the test program--guessing $uidsize.)" >&4
14215 fi
14216
14217 echo " "
14218 case "$uidtype" in
14219 *_t) zzz="$uidtype"     ;;
14220 *)   zzz="uid"          ;;
14221 esac
14222 echo "Checking the sign of $zzz..." >&4
14223 cat > try.c <<EOCP
14224 #include <sys/types.h>
14225 #include <stdio.h>
14226 int main() {
14227         $uidtype foo = -1;
14228         if (foo < 0)
14229                 printf("-1\n");
14230         else
14231                 printf("1\n");
14232 }
14233 EOCP
14234 set try
14235 if eval $compile; then
14236         yyy=`./try`
14237         case "$yyy" in
14238         '')     uidsign=1
14239                 echo "(I can't execute the test program--guessing unsigned.)" >&4
14240                 ;;
14241         *)      uidsign=$yyy
14242                 case "$uidsign" in
14243                  1) echo "Your $zzz is unsigned." ;;
14244                 -1) echo "Your $zzz is signed."   ;;
14245                 esac
14246                 ;;
14247         esac
14248 else
14249         uidsign=1
14250         echo "(I can't compile the test program--guessing unsigned.)" >&4
14251 fi
14252
14253
14254
14255 echo " "
14256 $echo "Checking the format string to be used for uids..." >&4
14257
14258 case "$uidsign" in
14259 -1)     if $test X"$uidsize" = X"$ivsize"; then
14260                 uidformat="$ivdformat"
14261         else
14262                 if $test X"$uidsize" = X"$longsize"; then
14263                         uidformat='"ld"'
14264                 else
14265                         if $test X"$uidsize" = X"$intsize"; then
14266                                 uidformat='"d"'
14267                         else
14268                                 if $test X"$uidsize" = X"$shortsize"; then
14269                                         uidformat='"hd"'
14270                                 fi
14271                         fi
14272                 fi
14273         fi
14274         ;;
14275 *)      if $test X"$uidsize" = X"$uvsize"; then
14276                 uidformat="$uvuformat"
14277         else
14278                 if $test X"$uidsize" = X"$longsize"; then
14279                         uidformat='"lu"'
14280                 else
14281                         if $test X"$uidsize" = X"$intsize"; then
14282                                 uidformat='"u"'
14283                         else
14284                                 if $test X"$uidsize" = X"$shortsize"; then
14285                                         uidformat='"hu"'
14286                                 fi
14287                         fi
14288                 fi
14289         fi
14290         ;;
14291 esac
14292
14293 : see if dbm.h is available
14294 : see if dbmclose exists
14295 set dbmclose d_dbmclose
14296 eval $inlibc
14297
14298 case "$d_dbmclose" in
14299 $define)
14300         set dbm.h i_dbm
14301         eval $inhdr
14302         case "$i_dbm" in
14303         $define)
14304                 val="$undef"
14305                 set i_rpcsvcdbm
14306                 eval $setvar
14307                 ;;
14308         *)      set rpcsvc/dbm.h i_rpcsvcdbm
14309                 eval $inhdr
14310                 ;;
14311         esac
14312         ;;
14313 *)      echo "We won't be including <dbm.h>"
14314         val="$undef"
14315         set i_dbm
14316         eval $setvar
14317         val="$undef"
14318         set i_rpcsvcdbm
14319         eval $setvar
14320         ;;
14321 esac
14322
14323 : see if this is a sys/file.h system
14324 val=''
14325 set sys/file.h val
14326 eval $inhdr
14327
14328 : do we need to include sys/file.h ?
14329 case "$val" in
14330 "$define")
14331         echo " "
14332         if $h_sysfile; then
14333                 val="$define"
14334                 echo "We'll be including <sys/file.h>." >&4
14335         else
14336                 val="$undef"
14337                 echo "We won't be including <sys/file.h>." >&4
14338         fi
14339         ;;
14340 *)
14341         h_sysfile=false
14342         ;;
14343 esac
14344 set i_sysfile
14345 eval $setvar
14346
14347 : see if fcntl.h is there
14348 val=''
14349 set fcntl.h val
14350 eval $inhdr
14351
14352 : see if we can include fcntl.h
14353 case "$val" in
14354 "$define")
14355         echo " "
14356         if $h_fcntl; then
14357                 val="$define"
14358                 echo "We'll be including <fcntl.h>." >&4
14359         else
14360                 val="$undef"
14361                 if $h_sysfile; then
14362         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
14363                 else
14364                         echo "We won't be including <fcntl.h>." >&4
14365                 fi
14366         fi
14367         ;;
14368 *)
14369         h_fcntl=false
14370         val="$undef"
14371         ;;
14372 esac
14373 set i_fcntl
14374 eval $setvar
14375
14376 : see if this is a iconv.h system
14377 set iconv.h i_iconv
14378 eval $inhdr
14379
14380 : see if this is a ieeefp.h system
14381 set ieeefp.h i_ieeefp
14382 eval $inhdr
14383
14384 : see if this is a libutil.h system
14385 set libutil.h i_libutil
14386 eval $inhdr
14387
14388 : see if locale.h is available
14389 set locale.h i_locale
14390 eval $inhdr
14391
14392 : see if mach cthreads are available
14393 if test "X$usethreads" = "X$define"; then
14394         set mach/cthreads.h i_machcthr
14395         eval $inhdr
14396 else
14397         i_machcthr="$undef"
14398 fi
14399
14400
14401
14402 : see if this is a math.h system
14403 set math.h i_math
14404 eval $inhdr
14405
14406 : see if this is a mntent.h system
14407 set mntent.h i_mntent
14408 eval $inhdr
14409
14410 : see if ndbm.h is available
14411 set ndbm.h t_ndbm
14412 eval $inhdr
14413 case "$t_ndbm" in
14414 $define)
14415         : see if dbm_open exists
14416         set dbm_open d_dbm_open
14417         eval $inlibc
14418         case "$d_dbm_open" in
14419         $undef)
14420                 t_ndbm="$undef"
14421                 echo "We won't be including <ndbm.h>"
14422                 ;;
14423         esac
14424         ;;
14425 esac
14426 val="$t_ndbm"
14427 set i_ndbm
14428 eval $setvar
14429
14430 : see if net/errno.h is available
14431 val=''
14432 set net/errno.h val
14433 eval $inhdr
14434
14435 : Unfortunately, it causes problems on some systems.  Arrgh.
14436 case "$val" in
14437 $define)
14438         cat > try.c <<'EOM'
14439 #include <stdio.h>
14440 #include <errno.h>
14441 #include <net/errno.h>
14442 int func()
14443 {
14444         return ENOTSOCK;
14445 }
14446 EOM
14447         if $cc $ccflags -c try.c >/dev/null 2>&1; then
14448                 echo "We'll be including <net/errno.h>." >&4
14449         else
14450                 echo "We won't be including <net/errno.h>." >&4
14451                 val="$undef"
14452         fi
14453         $rm -f try.* try
14454         ;;
14455 esac
14456 set i_neterrno
14457 eval $setvar
14458
14459 : see if netinet/tcp.h is available
14460 set netinet/tcp.h i_netinettcp
14461 eval $inhdr
14462
14463 : see if this is a poll.h system
14464 set poll.h i_poll
14465 eval $inhdr
14466
14467 : see if this is a prot.h system
14468 set prot.h i_prot
14469 eval $inhdr
14470
14471 echo " "
14472 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4 
14473 $cat <<'EOSH' > Cppsym.know
14474 a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
14475 AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
14476 alliant alpha am29000 AM29000 amiga AMIGAOS AMIX
14477 ansi ANSI_C_SOURCE apollo ardent atarist att386 att3b BeOS
14478 BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
14479 BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
14480 bull c cadmus clipper CMU COFF COMPILER_VERSION
14481 concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
14482 CYGWIN DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
14483 Dynix DynixPTX ELF encore EPI EXTENSIONS FILE_OFFSET_BITS
14484 FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
14485 GNU_SOURCE GNUC GNUC_MINOR GO32 gould GOULD_PN
14486 H3050R H3050RX hbullx20 hcx host_mips
14487 hp200 hp300 hp700 HP700 hp800 hp9000
14488 hp9000s200 hp9000s300 hp9000s400 hp9000s500
14489 hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
14490 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
14491 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
14492 INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
14493 LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
14494 LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
14495 Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
14496 LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
14497 M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
14498 M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
14499 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
14500 MATH_HAS_NO_SIDE_EFFECTS
14501 mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
14502 mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
14503 mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
14504 MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
14505 mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
14506 NetBSD news1500 news1700 news1800 news1900 news3700
14507 news700 news800 news900 NeXT NLS ns16000 ns32000
14508 ns32016 ns32332 ns32k nsc32000
14509 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
14510 pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
14511 pc532 pdp11 PGC PIC plexus PORTAR posix
14512 POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
14513 POSIX_C_SOURCE POSIX_SOURCE POWER
14514 PROTOTYPES PWB pyr QNX R3000 REENTRANT RES Rhapsody RISC6000
14515 riscix riscos RT scs SCO sequent sgi SGI_SOURCE sinix
14516 SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
14517 sony sony_news sonyrisc sparc sparclite spectrum
14518 stardent stdc STDC_EXT stratos sun sun3 sun386
14519 Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
14520 SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
14521 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
14522 sysV68 sysV88 Tek4132 Tek4300 titan
14523 tower tower32 tower32_200 tower32_600 tower32_700
14524 tower32_800 tower32_850 tss
14525 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
14526 ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
14527 unix UNIX95 UNIX99 unixpc unos USGr4 USGr4_2
14528 Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms xenix Xenix286
14529 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
14530 XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
14531 z8000
14532 EOSH
14533 # Maybe put other stuff here too.
14534 cat <<EOSH >>Cppsym.know
14535 $osname
14536 EOSH
14537 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
14538 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
14539 $cat Cppsym.know > Cppsym.c
14540 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | sort | uniq > Cppsym.know
14541 $rm -f Cppsym.a Cppsym.b Cppsym.c
14542 cat <<EOSH > Cppsym
14543 $startsh
14544 if $test \$# -gt 0; then
14545     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
14546     if $test -s Cppsym.got; then
14547         $rm -f Cppsym.got
14548         exit 0
14549     fi
14550     $rm -f Cppsym.got
14551     exit 1
14552 else
14553     $tr " " "$trnl" | ./Cppsym.try
14554     exit 0
14555 fi
14556 EOSH
14557 chmod +x Cppsym
14558 $eunicefix Cppsym
14559 cat <<EOSH > Cppsym.try
14560 $startsh
14561 cat <<'EOCP' > try.c
14562 #include <stdio.h>
14563 int main() {
14564 EOCP
14565 $awk \\
14566 EOSH
14567 cat <<'EOSH' >> Cppsym.try
14568 'length($1) > 0 {
14569     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
14570     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
14571     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
14572     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
14573 }'       >> try.c
14574 echo '}' >> try.c
14575 EOSH
14576 cat <<EOSH >> Cppsym.try
14577 ccflags="$ccflags"
14578 case "$osname-$gccversion" in
14579 irix-) ccflags="\$ccflags -woff 1178" ;;
14580 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
14581 esac
14582 $cc $optimize \$ccflags $ldflags -o try try.c $libs && ./try$exe_ext
14583 EOSH
14584 chmod +x Cppsym.try
14585 $eunicefix Cppsym.try
14586 ./Cppsym < Cppsym.know > Cppsym.true
14587 : now check the C compiler for additional symbols
14588 postprocess_cc_v=''
14589 case "$osname" in
14590 aix) postprocess_cc_v="|$tr , ' '" ;;
14591 esac
14592 $cat >ccsym <<EOS
14593 $startsh
14594 $cat >tmp.c <<EOF
14595 extern int foo;
14596 EOF
14597 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
14598 do
14599         case "\$i" in
14600         -D*) echo "\$i" | $sed 's/^-D//';;
14601         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A\(.*\)(\(.*\))/\1=\2/';;
14602         esac
14603 done
14604 $rm -f try.c
14605 EOS
14606 postprocess_cc_v=''
14607 chmod +x ccsym
14608 $eunicefix ccsym
14609 ./ccsym > ccsym1.raw
14610 if $test -s ccsym1.raw; then
14611        $sort ccsym1.raw | $uniq >ccsym.raw
14612 else
14613        mv ccsym1.raw ccsym.raw
14614 fi
14615
14616 $awk '/\=/ { print $0; next }
14617         { print $0"=1" }' ccsym.raw >ccsym.list
14618 $awk '/\=/ { print $0; next }
14619         { print $0"=1" }' Cppsym.true >ccsym.true
14620 $comm -13 ccsym.true ccsym.list >ccsym.own
14621 $comm -12 ccsym.true ccsym.list >ccsym.com
14622 $comm -23 ccsym.true ccsym.list >ccsym.cpp
14623 also=''
14624 if $test -z ccsym.raw; then
14625         echo "Your C compiler doesn't seem to define any symbols!" >&4
14626         echo " "
14627         echo "However, your C preprocessor defines the following symbols:"
14628         $cat Cppsym.true
14629         ccsymbols=''
14630         cppsymbols=`$cat Cppsym.true`
14631         cppsymbols=`echo $cppsymbols`
14632         cppccsymbols="$cppsymbols"
14633 else
14634         if $test -s ccsym.com; then
14635                 echo "Your C compiler and pre-processor define these symbols:"
14636                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
14637                 also='also '
14638                 symbols='ones'
14639                 cppccsymbols=`$cat ccsym.com`
14640                 cppccsymbols=`echo $cppccsymbols`
14641                 $test "$silent" || sleep 1
14642         fi
14643         if $test -s ccsym.cpp; then
14644                 $test "$also" && echo " "
14645                 echo "Your C pre-processor ${also}defines the following symbols:"
14646                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
14647                 also='further '
14648                 cppsymbols=`$cat ccsym.cpp`
14649                 cppsymbols=`echo $cppsymbols`
14650                 $test "$silent" || sleep 1
14651         fi
14652         if $test -s ccsym.own; then
14653                 $test "$also" && echo " "
14654                 echo "Your C compiler ${also}defines the following cpp symbols:"
14655                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
14656                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
14657                 ccsymbols=`$cat ccsym.own`
14658                 ccsymbols=`echo $ccsymbols`
14659                 $test "$silent" || sleep 1
14660         fi
14661 fi
14662 $rm -f ccsym* Cppsym.*
14663
14664 : see if this is a termio system
14665 val="$undef"
14666 val2="$undef"
14667 val3="$undef"
14668 if $test `./findhdr termios.h`; then
14669         set tcsetattr i_termios
14670         eval $inlibc
14671         val3="$i_termios"
14672 fi
14673 echo " "
14674 case "$val3" in
14675 "$define") echo "You have POSIX termios.h... good!" >&4;;
14676 *) if ./Cppsym pyr; then
14677                 case "`/bin/universe`" in
14678                 ucb) if $test `./findhdr sgtty.h`; then
14679                                 val2="$define"
14680                                 echo "<sgtty.h> found." >&4
14681                         else
14682                                 echo "System is pyramid with BSD universe."
14683                                 echo "<sgtty.h> not found--you could have problems." >&4
14684                         fi;;
14685                 *) if $test `./findhdr termio.h`; then
14686                                 val="$define"
14687                                 echo "<termio.h> found." >&4
14688                         else
14689                                 echo "System is pyramid with USG universe."
14690                                 echo "<termio.h> not found--you could have problems." >&4
14691                         fi;;
14692                 esac
14693         elif ./usg; then
14694                 if $test `./findhdr termio.h`; then
14695                         echo "<termio.h> found." >&4
14696                         val="$define"
14697                 elif $test `./findhdr sgtty.h`; then
14698                         echo "<sgtty.h> found." >&4
14699                         val2="$define"
14700                 else
14701 echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
14702                 fi
14703         else
14704                 if $test `./findhdr sgtty.h`; then
14705                         echo "<sgtty.h> found." >&4
14706                         val2="$define"
14707                 elif $test `./findhdr termio.h`; then
14708                         echo "<termio.h> found." >&4
14709                         val="$define"
14710                 else
14711 echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
14712                 fi
14713         fi;;
14714 esac
14715 set i_termio; eval $setvar
14716 val=$val2; set i_sgtty; eval $setvar
14717 val=$val3; set i_termios; eval $setvar
14718
14719 : see if this is a shadow.h system
14720 set shadow.h i_shadow
14721 eval $inhdr
14722
14723 : see if this is a socks.h system
14724 set socks.h i_socks
14725 eval $inhdr
14726
14727 : see if stdarg is available
14728 echo " "
14729 if $test `./findhdr stdarg.h`; then
14730         echo "<stdarg.h> found." >&4
14731         valstd="$define"
14732 else
14733         echo "<stdarg.h> NOT found." >&4
14734         valstd="$undef"
14735 fi
14736
14737 : see if varags is available
14738 echo " "
14739 if $test `./findhdr varargs.h`; then
14740         echo "<varargs.h> found." >&4
14741 else
14742         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
14743 fi
14744
14745 : set up the varargs testing programs
14746 $cat > varargs.c <<EOP
14747 #ifdef I_STDARG
14748 #include <stdarg.h>
14749 #endif
14750 #ifdef I_VARARGS
14751 #include <varargs.h>
14752 #endif
14753
14754 #ifdef I_STDARG
14755 int f(char *p, ...)
14756 #else
14757 int f(va_alist)
14758 va_dcl
14759 #endif
14760 {
14761         va_list ap;
14762 #ifndef I_STDARG
14763         char *p;
14764 #endif
14765 #ifdef I_STDARG
14766         va_start(ap,p);
14767 #else
14768         va_start(ap);
14769         p = va_arg(ap, char *);
14770 #endif
14771         va_end(ap);
14772 }
14773 EOP
14774 $cat > varargs <<EOP
14775 $startsh
14776 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
14777         echo "true"
14778 else
14779         echo "false"
14780 fi
14781 $rm -f varargs$_o
14782 EOP
14783 chmod +x varargs
14784
14785 : now check which varargs header should be included
14786 echo " "
14787 i_varhdr=''
14788 case "$valstd" in
14789 "$define")
14790         if `./varargs I_STDARG`; then
14791                 val='stdarg.h'
14792         elif `./varargs I_VARARGS`; then
14793                 val='varargs.h'
14794         fi
14795         ;;
14796 *)
14797         if `./varargs I_VARARGS`; then
14798                 val='varargs.h'
14799         fi
14800         ;;
14801 esac
14802 case "$val" in
14803 '')
14804 echo "I could not find the definition for va_dcl... You have problems..." >&4
14805         val="$undef"; set i_stdarg; eval $setvar
14806         val="$undef"; set i_varargs; eval $setvar
14807         ;;
14808 *) 
14809         set i_varhdr
14810         eval $setvar
14811         case "$i_varhdr" in
14812         stdarg.h)
14813                 val="$define"; set i_stdarg; eval $setvar
14814                 val="$undef"; set i_varargs; eval $setvar
14815                 ;;
14816         varargs.h)
14817                 val="$undef"; set i_stdarg; eval $setvar
14818                 val="$define"; set i_varargs; eval $setvar
14819                 ;;
14820         esac
14821         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
14822 esac
14823 $rm -f varargs*
14824
14825 : see if stddef is available
14826 set stddef.h i_stddef
14827 eval $inhdr
14828
14829 : see if this is a sunmath.h system
14830 set sunmath.h i_sunmath
14831 eval $inhdr
14832
14833 : see if sys/access.h is available
14834 set sys/access.h i_sysaccess
14835 eval $inhdr
14836
14837 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
14838 set sys/filio.h i_sysfilio
14839 eval $inhdr
14840 echo " "
14841 if $test `./findhdr sys/ioctl.h`; then
14842         val="$define"
14843         echo '<sys/ioctl.h> found.' >&4
14844 else
14845         val="$undef"
14846         if $test $i_sysfilio = "$define"; then
14847             echo '<sys/ioctl.h> NOT found.' >&4
14848         else
14849                 $test $i_sgtty = "$define" && xxx="sgtty.h"
14850                 $test $i_termio = "$define" && xxx="termio.h"
14851                 $test $i_termios = "$define" && xxx="termios.h"
14852 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
14853         fi
14854 fi
14855 set i_sysioctl
14856 eval $setvar
14857
14858
14859 : see if this is a syslog.h system
14860 set syslog.h i_syslog
14861 eval $inhdr
14862
14863
14864 : see if this is a sys/mode.h system
14865 set sys/mode.h i_sysmode
14866 eval $inhdr
14867
14868 : see if sys/resource.h has to be included
14869 set sys/resource.h i_sysresrc
14870 eval $inhdr
14871
14872 : see if sys/security.h is available
14873 set sys/security.h i_syssecrt
14874 eval $inhdr
14875
14876 : see if this is a sys/statvfs.h system
14877 set sys/statvfs.h i_sysstatvfs
14878 eval $inhdr
14879
14880 : see if this is a sys/uio.h system
14881 set sys/uio.h i_sysuio
14882 eval $inhdr
14883
14884 : see if this is a sys/un.h system
14885 set sys/un.h i_sysun
14886 eval $inhdr
14887
14888
14889 : see if this is a sys/utsname.h system
14890 set sys/utsname.h i_sysutsname
14891 eval $inhdr
14892
14893 : see if this is a syswait system
14894 set sys/wait.h i_syswait
14895 eval $inhdr
14896
14897 : see if this is a ustat.h system
14898 set ustat.h i_ustat
14899 eval $inhdr
14900
14901 : see if this is an utime system
14902 set utime.h i_utime
14903 eval $inhdr
14904
14905 : see if this is a values.h system
14906 set values.h i_values
14907 eval $inhdr
14908
14909 : see if this is a vfork system
14910 case "$d_vfork" in
14911 "$define")
14912         set vfork.h i_vfork
14913         eval $inhdr
14914         ;;
14915 *)
14916         i_vfork="$undef"
14917         ;;
14918 esac
14919
14920 : see if gdbm.h is available
14921 set gdbm.h t_gdbm
14922 eval $inhdr
14923 case "$t_gdbm" in
14924 $define)
14925         : see if gdbm_open exists
14926         set gdbm_open d_gdbm_open
14927         eval $inlibc
14928         case "$d_gdbm_open" in
14929         $undef)
14930                 t_gdbm="$undef"
14931                 echo "We won't be including <gdbm.h>"
14932                 ;;
14933         esac
14934         ;;
14935 esac
14936 val="$t_gdbm"
14937 set i_gdbm
14938 eval $setvar
14939
14940 echo " "
14941 echo "Looking for extensions..." >&4
14942 : If we are using the old config.sh, known_extensions may contain
14943 : old or inaccurate or duplicate values.
14944 known_extensions=''
14945 nonxs_extensions=''
14946 : We do not use find because it might not be available.
14947 : We do not just use MANIFEST because the user may have dropped
14948 : some additional extensions into the source tree and expect them
14949 : to be built.
14950
14951 : Function to recursively find available extensions, ignoring DynaLoader
14952 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
14953 find_extensions='
14954     for xxx in *; do
14955        case "$xxx" in
14956            DynaLoader|dynaload) ;;
14957            *)
14958            if $test -f $xxx/$xxx.xs; then
14959                known_extensions="$known_extensions $1$xxx";
14960            elif $test -f $xxx/Makefile.PL; then
14961                nonxs_extensions="$nonxs_extensions $1$xxx";
14962            else
14963                if $test -d $xxx -a $# -lt 10; then
14964                    set $1$xxx/ $*;
14965                    cd $xxx;
14966                    eval $find_extensions;
14967                    cd ..;
14968                    shift;
14969                fi;
14970            fi
14971            ;;
14972        esac;
14973     done'
14974 tdir=`pwd`
14975 cd $rsrc/ext
14976 set X
14977 shift
14978 eval $find_extensions
14979 set X $nonxs_extensions
14980 shift
14981 nonxs_extensions="$*"
14982 set X $known_extensions
14983 shift
14984 known_extensions="$*"
14985 cd $tdir
14986
14987 : Now see which are supported on this system.
14988 avail_ext=''
14989 for xxx in $known_extensions ; do
14990         case "$xxx" in
14991         DB_File|db_file)
14992                 case "$i_db" in
14993                 $define) avail_ext="$avail_ext $xxx" ;;
14994                 esac
14995                 ;;
14996         GDBM_File|gdbm_fil)
14997                 case "$i_gdbm" in 
14998                 $define) avail_ext="$avail_ext $xxx" ;;
14999                 esac
15000                 ;;
15001         NDBM_File|ndbm_fil)
15002                 case "$i_ndbm" in
15003                 $define)
15004                     case "$osname-$use64bitint" in
15005                     hpux-define)
15006                         case "$libs" in
15007                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
15008                         esac
15009                         ;;
15010                     *) avail_ext="$avail_ext $xxx" ;;
15011                     esac
15012                     ;;
15013                 esac
15014                 ;;
15015         ODBM_File|odbm_fil) 
15016                 case "${i_dbm}${i_rpcsvcdbm}" in
15017                 *"${define}"*)
15018                     case "$osname-$use64bitint" in
15019                     hpux-define)
15020                         case "$libs" in
15021                         *-ldbm*) avail_ext="$avail_ext $xxx" ;;
15022                         esac
15023                         ;;
15024                     *) avail_ext="$avail_ext $xxx" ;;
15025                     esac
15026                     ;;
15027                 esac
15028                 ;;
15029         POSIX|posix)
15030                 case "$useposix" in
15031                 true|define|y) avail_ext="$avail_ext $xxx" ;;
15032                 esac
15033                 ;;
15034         Opcode|opcode)
15035                 case "$useopcode" in
15036                 true|define|y) avail_ext="$avail_ext $xxx" ;;
15037                 esac
15038                 ;;
15039         Socket|socket)
15040                 case "$d_socket" in 
15041                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
15042                 esac
15043                 ;;
15044         Sys/Syslog|sys/syslog)
15045                 : XXX syslog requires socket
15046                 case "$d_socket" in 
15047                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
15048                 esac
15049                 ;;
15050         Thread|thread)
15051                 case "$usethreads" in 
15052                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
15053                 esac
15054                 ;;
15055         IPC/SysV|ipc/sysv)
15056                 : XXX Do we need a useipcsysv variable here
15057                 case "${d_msg}${d_sem}${d_shm}" in 
15058                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
15059                 esac
15060                 ;;
15061         *)      avail_ext="$avail_ext $xxx"
15062                 ;;
15063         esac
15064 done
15065
15066 set X $avail_ext
15067 shift
15068 avail_ext="$*"
15069
15070 : Now see which nonxs extensions are supported on this system.
15071 : For now assume all are.
15072 nonxs_ext=''
15073 for xxx in $nonxs_extensions ; do
15074         case "$xxx" in
15075         *)      nonxs_ext="$nonxs_ext $xxx"
15076                 ;;
15077         esac
15078 done
15079
15080 set X $nonxs_ext
15081 shift
15082 nonxs_ext="$*"
15083
15084 case $usedl in
15085 $define)
15086         $cat <<EOM
15087 A number of extensions are supplied with $package.  You may choose to
15088 compile these extensions for dynamic loading (the default), compile
15089 them into the $package executable (static loading), or not include
15090 them at all.  Answer "none" to include no extensions.
15091 Note that DynaLoader is always built and need not be mentioned here.
15092
15093 EOM
15094         case "$dynamic_ext" in
15095         '') dflt="$avail_ext" ;;
15096         *)      dflt="$dynamic_ext"
15097                 # Perhaps we are reusing an old out-of-date config.sh.
15098                 case "$hint" in
15099                 previous)
15100                         if test X"$dynamic_ext" != X"$avail_ext"; then
15101                                 $cat <<EOM
15102 NOTICE:  Your previous config.sh list may be incorrect. 
15103 The extensions now available to you are 
15104         ${avail_ext}
15105 but the default list from your previous config.sh is
15106         ${dynamic_ext} 
15107
15108 EOM
15109                         fi
15110                         ;;
15111                 esac
15112                 ;;
15113         esac
15114         case "$dflt" in
15115         '')     dflt=none;;
15116         esac
15117         rp="What extensions do you wish to load dynamically?"
15118         . ./myread
15119         case "$ans" in
15120         none) dynamic_ext=' ' ;;
15121         *) dynamic_ext="$ans" ;;
15122         esac
15123
15124         case "$static_ext" in
15125         '')
15126                 : Exclude those already listed in dynamic linking
15127                 dflt=''
15128                 for xxx in $avail_ext; do
15129                         case " $dynamic_ext " in
15130                         *" $xxx "*) ;;
15131                         *) dflt="$dflt $xxx" ;;
15132                         esac
15133                 done
15134                 set X $dflt
15135                 shift
15136                 dflt="$*"
15137                 ;;
15138         *)  dflt="$static_ext" 
15139                 ;;
15140         esac
15141
15142         case "$dflt" in
15143         '')     dflt=none;;
15144         esac
15145         rp="What extensions do you wish to load statically?"
15146         . ./myread
15147         case "$ans" in
15148         none) static_ext=' ' ;;
15149         *) static_ext="$ans" ;;
15150         esac
15151         ;;
15152 *)
15153         $cat <<EOM
15154 A number of extensions are supplied with $package.  Answer "none" 
15155 to include no extensions. 
15156 Note that DynaLoader is always built and need not be mentioned here.
15157
15158 EOM
15159         case "$static_ext" in
15160         '') dflt="$avail_ext" ;;
15161         *)      dflt="$static_ext"
15162                 # Perhaps we are reusing an old out-of-date config.sh.
15163                 case "$hint" in
15164                 previous)
15165                         if test X"$static_ext" != X"$avail_ext"; then
15166                                 $cat <<EOM
15167 NOTICE:  Your previous config.sh list may be incorrect. 
15168 The extensions now available to you are 
15169         ${avail_ext}
15170 but the default list from your previous config.sh is
15171         ${static_ext} 
15172
15173 EOM
15174                         fi
15175                         ;;
15176                 esac
15177                 ;;
15178         esac
15179         : Exclude those that are not xs extensions
15180         case "$dflt" in
15181         '')     dflt=none;;
15182         esac
15183         rp="What extensions do you wish to include?"
15184         . ./myread
15185         case "$ans" in
15186         none) static_ext=' ' ;;
15187         *) static_ext="$ans" ;;
15188         esac
15189         ;;
15190 esac
15191
15192 set X $dynamic_ext $static_ext $nonxs_ext
15193 shift
15194 extensions="$*"
15195
15196 : Remove build directory name from cppstdin so it can be used from
15197 : either the present location or the final installed location.
15198 echo " "
15199 : Get out of the UU directory to get correct path name.
15200 cd ..
15201 case "$cppstdin" in
15202 `pwd`/cppstdin)
15203         echo "Stripping down cppstdin path name"
15204         cppstdin=cppstdin
15205         ;;
15206 esac
15207 cd UU
15208
15209 : end of configuration questions
15210 echo " "
15211 echo "End of configuration questions."
15212 echo " "
15213
15214 : back to where it started
15215 if test -d ../UU; then
15216         cd ..
15217 fi
15218
15219 : configuration may be patched via a 'config.over' file
15220 if $test -f config.over; then
15221         echo " "
15222         dflt=y
15223         rp='I see a config.over file.  Do you wish to load it?'
15224         . UU/myread
15225         case "$ans" in
15226         n*) echo "OK, I'll ignore it.";;
15227         *)      . ./config.over
15228                 echo "Configuration override changes have been loaded."
15229                 ;;
15230         esac
15231 fi
15232
15233 : in case they want portability, strip down executable paths
15234 case "$d_portable" in
15235 "$define")
15236         echo " "
15237         echo "Stripping down executable paths..." >&4
15238         for file in $loclist $trylist; do
15239                 eval temp=\$$file
15240                 eval $file=`basename $temp`
15241         done
15242         ;;
15243 esac
15244
15245 : create config.sh file
15246 echo " "
15247 echo "Creating config.sh..." >&4
15248 $spitshell <<EOT >config.sh
15249 $startsh
15250 #
15251 # This file was produced by running the Configure script. It holds all the
15252 # definitions figured out by Configure. Should you modify one of these values,
15253 # do not forget to propagate your changes by running "Configure -der". You may
15254 # instead choose to run each of the .SH files by yourself, or "Configure -S".
15255 #
15256
15257 # Package name      : $package
15258 # Source directory  : $src
15259 # Configuration time: $cf_time
15260 # Configured by     : $cf_by
15261 # Target system     : $myuname
15262
15263 Author='$Author'
15264 Date='$Date'
15265 Header='$Header'
15266 Id='$Id'
15267 Locker='$Locker'
15268 Log='$Log'
15269 Mcc='$Mcc'
15270 RCSfile='$RCSfile'
15271 Revision='$Revision'
15272 Source='$Source'
15273 State='$State'
15274 _a='$_a'
15275 _exe='$_exe'
15276 _o='$_o'
15277 afs='$afs'
15278 alignbytes='$alignbytes'
15279 ansi2knr='$ansi2knr'
15280 aphostname='$aphostname'
15281 api_revision='$api_revision'
15282 api_subversion='$api_subversion'
15283 api_version='$api_version'
15284 api_versionstring='$api_versionstring'
15285 ar='$ar'
15286 archlib='$archlib'
15287 archlibexp='$archlibexp'
15288 archname64='$archname64'
15289 archname='$archname'
15290 archobjs='$archobjs'
15291 awk='$awk'
15292 baserev='$baserev'
15293 bash='$bash'
15294 bin='$bin'
15295 bincompat5005='$bincompat5005'
15296 binexp='$binexp'
15297 bison='$bison'
15298 byacc='$byacc'
15299 byteorder='$byteorder'
15300 c='$c'
15301 castflags='$castflags'
15302 cat='$cat'
15303 cc='$cc'
15304 cccdlflags='$cccdlflags'
15305 ccdlflags='$ccdlflags'
15306 ccflags='$ccflags'
15307 ccflags_uselargefiles='$ccflags_uselargefiles'
15308 ccsymbols='$ccsymbols'
15309 cf_by='$cf_by'
15310 cf_email='$cf_email'
15311 cf_time='$cf_time'
15312 charsize='$charsize'
15313 chgrp='$chgrp'
15314 chmod='$chmod'
15315 chown='$chown'
15316 clocktype='$clocktype'
15317 comm='$comm'
15318 compress='$compress'
15319 contains='$contains'
15320 cp='$cp'
15321 cpio='$cpio'
15322 cpp='$cpp'
15323 cpp_stuff='$cpp_stuff'
15324 cppccsymbols='$cppccsymbols'
15325 cppflags='$cppflags'
15326 cpplast='$cpplast'
15327 cppminus='$cppminus'
15328 cpprun='$cpprun'
15329 cppstdin='$cppstdin'
15330 cppsymbols='$cppsymbols'
15331 crosscompile='$crosscompile'
15332 cryptlib='$cryptlib'
15333 csh='$csh'
15334 d_Gconvert='$d_Gconvert'
15335 d_PRIEldbl='$d_PRIEldbl'
15336 d_PRIFldbl='$d_PRIFldbl'
15337 d_PRIGldbl='$d_PRIGldbl'
15338 d_PRIX64='$d_PRIX64'
15339 d_PRId64='$d_PRId64'
15340 d_PRIeldbl='$d_PRIeldbl'
15341 d_PRIfldbl='$d_PRIfldbl'
15342 d_PRIgldbl='$d_PRIgldbl'
15343 d_PRIi64='$d_PRIi64'
15344 d_PRIo64='$d_PRIo64'
15345 d_PRIu64='$d_PRIu64'
15346 d_PRIx64='$d_PRIx64'
15347 d_access='$d_access'
15348 d_accessx='$d_accessx'
15349 d_alarm='$d_alarm'
15350 d_archlib='$d_archlib'
15351 d_atolf='$d_atolf'
15352 d_atoll='$d_atoll'
15353 d_attribut='$d_attribut'
15354 d_bcmp='$d_bcmp'
15355 d_bcopy='$d_bcopy'
15356 d_bincompat5005='$d_bincompat5005'
15357 d_bsd='$d_bsd'
15358 d_bsdgetpgrp='$d_bsdgetpgrp'
15359 d_bsdsetpgrp='$d_bsdsetpgrp'
15360 d_bzero='$d_bzero'
15361 d_casti32='$d_casti32'
15362 d_castneg='$d_castneg'
15363 d_charvspr='$d_charvspr'
15364 d_chown='$d_chown'
15365 d_chroot='$d_chroot'
15366 d_chsize='$d_chsize'
15367 d_closedir='$d_closedir'
15368 d_const='$d_const'
15369 d_crypt='$d_crypt'
15370 d_csh='$d_csh'
15371 d_cuserid='$d_cuserid'
15372 d_dbl_dig='$d_dbl_dig'
15373 d_difftime='$d_difftime'
15374 d_dirnamlen='$d_dirnamlen'
15375 d_dlerror='$d_dlerror'
15376 d_dlopen='$d_dlopen'
15377 d_dlsymun='$d_dlsymun'
15378 d_dosuid='$d_dosuid'
15379 d_drand48proto='$d_drand48proto'
15380 d_dup2='$d_dup2'
15381 d_eaccess='$d_eaccess'
15382 d_endgrent='$d_endgrent'
15383 d_endhent='$d_endhent'
15384 d_endnent='$d_endnent'
15385 d_endpent='$d_endpent'
15386 d_endpwent='$d_endpwent'
15387 d_endsent='$d_endsent'
15388 d_eofnblk='$d_eofnblk'
15389 d_eunice='$d_eunice'
15390 d_fchmod='$d_fchmod'
15391 d_fchown='$d_fchown'
15392 d_fcntl='$d_fcntl'
15393 d_fd_macros='$d_fd_macros'
15394 d_fd_set='$d_fd_set'
15395 d_fds_bits='$d_fds_bits'
15396 d_fgetpos='$d_fgetpos'
15397 d_flexfnam='$d_flexfnam'
15398 d_flock='$d_flock'
15399 d_fork='$d_fork'
15400 d_fpathconf='$d_fpathconf'
15401 d_fpos64_t='$d_fpos64_t'
15402 d_frexpl='$d_frexpl'
15403 d_fs_data_s='$d_fs_data_s'
15404 d_fseeko='$d_fseeko'
15405 d_fsetpos='$d_fsetpos'
15406 d_fstatfs='$d_fstatfs'
15407 d_fstatvfs='$d_fstatvfs'
15408 d_ftello='$d_ftello'
15409 d_ftime='$d_ftime'
15410 d_getcwd='$d_getcwd'
15411 d_getespwnam='$d_getespwnam'
15412 d_getfsstat='$d_getfsstat'
15413 d_getgrent='$d_getgrent'
15414 d_getgrps='$d_getgrps'
15415 d_gethbyaddr='$d_gethbyaddr'
15416 d_gethbyname='$d_gethbyname'
15417 d_gethent='$d_gethent'
15418 d_gethname='$d_gethname'
15419 d_gethostprotos='$d_gethostprotos'
15420 d_getlogin='$d_getlogin'
15421 d_getmnt='$d_getmnt'
15422 d_getmntent='$d_getmntent'
15423 d_getnbyaddr='$d_getnbyaddr'
15424 d_getnbyname='$d_getnbyname'
15425 d_getnent='$d_getnent'
15426 d_getnetprotos='$d_getnetprotos'
15427 d_getpbyname='$d_getpbyname'
15428 d_getpbynumber='$d_getpbynumber'
15429 d_getpent='$d_getpent'
15430 d_getpgid='$d_getpgid'
15431 d_getpgrp2='$d_getpgrp2'
15432 d_getpgrp='$d_getpgrp'
15433 d_getppid='$d_getppid'
15434 d_getprior='$d_getprior'
15435 d_getprotoprotos='$d_getprotoprotos'
15436 d_getprpwnam='$d_getprpwnam'
15437 d_getpwent='$d_getpwent'
15438 d_getsbyname='$d_getsbyname'
15439 d_getsbyport='$d_getsbyport'
15440 d_getsent='$d_getsent'
15441 d_getservprotos='$d_getservprotos'
15442 d_getspnam='$d_getspnam'
15443 d_gettimeod='$d_gettimeod'
15444 d_gnulibc='$d_gnulibc'
15445 d_grpasswd='$d_grpasswd'
15446 d_hasmntopt='$d_hasmntopt'
15447 d_htonl='$d_htonl'
15448 d_iconv='$d_iconv'
15449 d_index='$d_index'
15450 d_inetaton='$d_inetaton'
15451 d_int64_t='$d_int64_t'
15452 d_isascii='$d_isascii'
15453 d_isnan='$d_isnan'
15454 d_isnanl='$d_isnanl'
15455 d_killpg='$d_killpg'
15456 d_lchown='$d_lchown'
15457 d_ldbl_dig='$d_ldbl_dig'
15458 d_link='$d_link'
15459 d_locconv='$d_locconv'
15460 d_lockf='$d_lockf'
15461 d_longdbl='$d_longdbl'
15462 d_longlong='$d_longlong'
15463 d_lseekproto='$d_lseekproto'
15464 d_lstat='$d_lstat'
15465 d_madvise='$d_madvise'
15466 d_mblen='$d_mblen'
15467 d_mbstowcs='$d_mbstowcs'
15468 d_mbtowc='$d_mbtowc'
15469 d_memchr='$d_memchr'
15470 d_memcmp='$d_memcmp'
15471 d_memcpy='$d_memcpy'
15472 d_memmove='$d_memmove'
15473 d_memset='$d_memset'
15474 d_mkdir='$d_mkdir'
15475 d_mkdtemp='$d_mkdtemp'
15476 d_mkfifo='$d_mkfifo'
15477 d_mkstemp='$d_mkstemp'
15478 d_mkstemps='$d_mkstemps'
15479 d_mktime='$d_mktime'
15480 d_mmap='$d_mmap'
15481 d_modfl='$d_modfl'
15482 d_mprotect='$d_mprotect'
15483 d_msg='$d_msg'
15484 d_msg_ctrunc='$d_msg_ctrunc'
15485 d_msg_dontroute='$d_msg_dontroute'
15486 d_msg_oob='$d_msg_oob'
15487 d_msg_peek='$d_msg_peek'
15488 d_msg_proxy='$d_msg_proxy'
15489 d_msgctl='$d_msgctl'
15490 d_msgget='$d_msgget'
15491 d_msgrcv='$d_msgrcv'
15492 d_msgsnd='$d_msgsnd'
15493 d_msync='$d_msync'
15494 d_munmap='$d_munmap'
15495 d_mymalloc='$d_mymalloc'
15496 d_nice='$d_nice'
15497 d_nv_preserves_uv='$d_nv_preserves_uv'
15498 d_nv_preserves_uv_bits='$d_nv_preserves_uv_bits'
15499 d_off64_t='$d_off64_t'
15500 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
15501 d_oldpthreads='$d_oldpthreads'
15502 d_oldsock='$d_oldsock'
15503 d_open3='$d_open3'
15504 d_pathconf='$d_pathconf'
15505 d_pause='$d_pause'
15506 d_perl_otherlibdirs='$d_perl_otherlibdirs'
15507 d_phostname='$d_phostname'
15508 d_pipe='$d_pipe'
15509 d_poll='$d_poll'
15510 d_portable='$d_portable'
15511 d_pthread_yield='$d_pthread_yield'
15512 d_pwage='$d_pwage'
15513 d_pwchange='$d_pwchange'
15514 d_pwclass='$d_pwclass'
15515 d_pwcomment='$d_pwcomment'
15516 d_pwexpire='$d_pwexpire'
15517 d_pwgecos='$d_pwgecos'
15518 d_pwpasswd='$d_pwpasswd'
15519 d_pwquota='$d_pwquota'
15520 d_qgcvt='$d_qgcvt'
15521 d_quad='$d_quad'
15522 d_readdir='$d_readdir'
15523 d_readlink='$d_readlink'
15524 d_rename='$d_rename'
15525 d_rewinddir='$d_rewinddir'
15526 d_rmdir='$d_rmdir'
15527 d_safebcpy='$d_safebcpy'
15528 d_safemcpy='$d_safemcpy'
15529 d_sanemcmp='$d_sanemcmp'
15530 d_sched_yield='$d_sched_yield'
15531 d_scm_rights='$d_scm_rights'
15532 d_seekdir='$d_seekdir'
15533 d_select='$d_select'
15534 d_sem='$d_sem'
15535 d_semctl='$d_semctl'
15536 d_semctl_semid_ds='$d_semctl_semid_ds'
15537 d_semctl_semun='$d_semctl_semun'
15538 d_semget='$d_semget'
15539 d_semop='$d_semop'
15540 d_setegid='$d_setegid'
15541 d_seteuid='$d_seteuid'
15542 d_setgrent='$d_setgrent'
15543 d_setgrps='$d_setgrps'
15544 d_sethent='$d_sethent'
15545 d_setlinebuf='$d_setlinebuf'
15546 d_setlocale='$d_setlocale'
15547 d_setnent='$d_setnent'
15548 d_setpent='$d_setpent'
15549 d_setpgid='$d_setpgid'
15550 d_setpgrp2='$d_setpgrp2'
15551 d_setpgrp='$d_setpgrp'
15552 d_setprior='$d_setprior'
15553 d_setproctitle='$d_setproctitle'
15554 d_setpwent='$d_setpwent'
15555 d_setregid='$d_setregid'
15556 d_setresgid='$d_setresgid'
15557 d_setresuid='$d_setresuid'
15558 d_setreuid='$d_setreuid'
15559 d_setrgid='$d_setrgid'
15560 d_setruid='$d_setruid'
15561 d_setsent='$d_setsent'
15562 d_setsid='$d_setsid'
15563 d_setvbuf='$d_setvbuf'
15564 d_sfio='$d_sfio'
15565 d_shm='$d_shm'
15566 d_shmat='$d_shmat'
15567 d_shmatprototype='$d_shmatprototype'
15568 d_shmctl='$d_shmctl'
15569 d_shmdt='$d_shmdt'
15570 d_shmget='$d_shmget'
15571 d_sigaction='$d_sigaction'
15572 d_sigsetjmp='$d_sigsetjmp'
15573 d_socket='$d_socket'
15574 d_socklen_t='$d_socklen_t'
15575 d_sockpair='$d_sockpair'
15576 d_sqrtl='$d_sqrtl'
15577 d_statblks='$d_statblks'
15578 d_statfs_f_flags='$d_statfs_f_flags'
15579 d_statfs_s='$d_statfs_s'
15580 d_statvfs='$d_statvfs'
15581 d_stdio_cnt_lval='$d_stdio_cnt_lval'
15582 d_stdio_ptr_lval='$d_stdio_ptr_lval'
15583 d_stdio_stream_array='$d_stdio_stream_array'
15584 d_stdiobase='$d_stdiobase'
15585 d_stdstdio='$d_stdstdio'
15586 d_strchr='$d_strchr'
15587 d_strcoll='$d_strcoll'
15588 d_strctcpy='$d_strctcpy'
15589 d_strerrm='$d_strerrm'
15590 d_strerror='$d_strerror'
15591 d_strtod='$d_strtod'
15592 d_strtol='$d_strtol'
15593 d_strtold='$d_strtold'
15594 d_strtoll='$d_strtoll'
15595 d_strtoul='$d_strtoul'
15596 d_strtoull='$d_strtoull'
15597 d_strtouq='$d_strtouq'
15598 d_strxfrm='$d_strxfrm'
15599 d_suidsafe='$d_suidsafe'
15600 d_symlink='$d_symlink'
15601 d_syscall='$d_syscall'
15602 d_sysconf='$d_sysconf'
15603 d_sysernlst='$d_sysernlst'
15604 d_syserrlst='$d_syserrlst'
15605 d_system='$d_system'
15606 d_tcgetpgrp='$d_tcgetpgrp'
15607 d_tcsetpgrp='$d_tcsetpgrp'
15608 d_telldir='$d_telldir'
15609 d_telldirproto='$d_telldirproto'
15610 d_time='$d_time'
15611 d_times='$d_times'
15612 d_truncate='$d_truncate'
15613 d_tzname='$d_tzname'
15614 d_umask='$d_umask'
15615 d_uname='$d_uname'
15616 d_union_semun='$d_union_semun'
15617 d_ustat='$d_ustat'
15618 d_vendorarch='$d_vendorarch'
15619 d_vendorbin='$d_vendorbin'
15620 d_vendorlib='$d_vendorlib'
15621 d_vfork='$d_vfork'
15622 d_void_closedir='$d_void_closedir'
15623 d_voidsig='$d_voidsig'
15624 d_voidtty='$d_voidtty'
15625 d_volatile='$d_volatile'
15626 d_vprintf='$d_vprintf'
15627 d_wait4='$d_wait4'
15628 d_waitpid='$d_waitpid'
15629 d_wcstombs='$d_wcstombs'
15630 d_wctomb='$d_wctomb'
15631 d_xenix='$d_xenix'
15632 date='$date'
15633 db_hashtype='$db_hashtype'
15634 db_prefixtype='$db_prefixtype'
15635 defvoidused='$defvoidused'
15636 direntrytype='$direntrytype'
15637 dlext='$dlext'
15638 dlsrc='$dlsrc'
15639 doublesize='$doublesize'
15640 drand01='$drand01'
15641 dynamic_ext='$dynamic_ext'
15642 eagain='$eagain'
15643 ebcdic='$ebcdic'
15644 echo='$echo'
15645 egrep='$egrep'
15646 emacs='$emacs'
15647 eunicefix='$eunicefix'
15648 exe_ext='$exe_ext'
15649 expr='$expr'
15650 extensions='$extensions'
15651 fflushNULL='$fflushNULL'
15652 fflushall='$fflushall'
15653 find='$find'
15654 firstmakefile='$firstmakefile'
15655 flex='$flex'
15656 fpossize='$fpossize'
15657 fpostype='$fpostype'
15658 freetype='$freetype'
15659 full_ar='$full_ar'
15660 full_csh='$full_csh'
15661 full_sed='$full_sed'
15662 gccosandvers='$gccosandvers'
15663 gccversion='$gccversion'
15664 gidformat='$gidformat'
15665 gidsign='$gidsign'
15666 gidsize='$gidsize'
15667 gidtype='$gidtype'
15668 glibpth='$glibpth'
15669 grep='$grep'
15670 groupcat='$groupcat'
15671 groupstype='$groupstype'
15672 gzip='$gzip'
15673 h_fcntl='$h_fcntl'
15674 h_sysfile='$h_sysfile'
15675 hint='$hint'
15676 hostcat='$hostcat'
15677 huge='$huge'
15678 i16size='$i16size'
15679 i16type='$i16type'
15680 i32size='$i32size'
15681 i32type='$i32type'
15682 i64size='$i64size'
15683 i64type='$i64type'
15684 i8size='$i8size'
15685 i8type='$i8type'
15686 i_arpainet='$i_arpainet'
15687 i_bsdioctl='$i_bsdioctl'
15688 i_db='$i_db'
15689 i_dbm='$i_dbm'
15690 i_dirent='$i_dirent'
15691 i_dld='$i_dld'
15692 i_dlfcn='$i_dlfcn'
15693 i_fcntl='$i_fcntl'
15694 i_float='$i_float'
15695 i_gdbm='$i_gdbm'
15696 i_grp='$i_grp'
15697 i_iconv='$i_iconv'
15698 i_ieeefp='$i_ieeefp'
15699 i_inttypes='$i_inttypes'
15700 i_libutil='$i_libutil'
15701 i_limits='$i_limits'
15702 i_locale='$i_locale'
15703 i_machcthr='$i_machcthr'
15704 i_malloc='$i_malloc'
15705 i_math='$i_math'
15706 i_memory='$i_memory'
15707 i_mntent='$i_mntent'
15708 i_ndbm='$i_ndbm'
15709 i_netdb='$i_netdb'
15710 i_neterrno='$i_neterrno'
15711 i_netinettcp='$i_netinettcp'
15712 i_niin='$i_niin'
15713 i_poll='$i_poll'
15714 i_prot='$i_prot'
15715 i_pthread='$i_pthread'
15716 i_pwd='$i_pwd'
15717 i_rpcsvcdbm='$i_rpcsvcdbm'
15718 i_sfio='$i_sfio'
15719 i_sgtty='$i_sgtty'
15720 i_shadow='$i_shadow'
15721 i_socks='$i_socks'
15722 i_stdarg='$i_stdarg'
15723 i_stddef='$i_stddef'
15724 i_stdlib='$i_stdlib'
15725 i_string='$i_string'
15726 i_sunmath='$i_sunmath'
15727 i_sysaccess='$i_sysaccess'
15728 i_sysdir='$i_sysdir'
15729 i_sysfile='$i_sysfile'
15730 i_sysfilio='$i_sysfilio'
15731 i_sysin='$i_sysin'
15732 i_sysioctl='$i_sysioctl'
15733 i_syslog='$i_syslog'
15734 i_sysmman='$i_sysmman'
15735 i_sysmode='$i_sysmode'
15736 i_sysmount='$i_sysmount'
15737 i_sysndir='$i_sysndir'
15738 i_sysparam='$i_sysparam'
15739 i_sysresrc='$i_sysresrc'
15740 i_syssecrt='$i_syssecrt'
15741 i_sysselct='$i_sysselct'
15742 i_syssockio='$i_syssockio'
15743 i_sysstat='$i_sysstat'
15744 i_sysstatfs='$i_sysstatfs'
15745 i_sysstatvfs='$i_sysstatvfs'
15746 i_systime='$i_systime'
15747 i_systimek='$i_systimek'
15748 i_systimes='$i_systimes'
15749 i_systypes='$i_systypes'
15750 i_sysuio='$i_sysuio'
15751 i_sysun='$i_sysun'
15752 i_sysutsname='$i_sysutsname'
15753 i_sysvfs='$i_sysvfs'
15754 i_syswait='$i_syswait'
15755 i_termio='$i_termio'
15756 i_termios='$i_termios'
15757 i_time='$i_time'
15758 i_unistd='$i_unistd'
15759 i_ustat='$i_ustat'
15760 i_utime='$i_utime'
15761 i_values='$i_values'
15762 i_varargs='$i_varargs'
15763 i_varhdr='$i_varhdr'
15764 i_vfork='$i_vfork'
15765 ignore_versioned_solibs='$ignore_versioned_solibs'
15766 inc_version_list='$inc_version_list'
15767 inc_version_list_init='$inc_version_list_init'
15768 incpath='$incpath'
15769 inews='$inews'
15770 installarchlib='$installarchlib'
15771 installbin='$installbin'
15772 installman1dir='$installman1dir'
15773 installman3dir='$installman3dir'
15774 installprefix='$installprefix'
15775 installprefixexp='$installprefixexp'
15776 installprivlib='$installprivlib'
15777 installscript='$installscript'
15778 installsitearch='$installsitearch'
15779 installsitebin='$installsitebin'
15780 installsitelib='$installsitelib'
15781 installstyle='$installstyle'
15782 installusrbinperl='$installusrbinperl'
15783 installvendorarch='$installvendorarch'
15784 installvendorbin='$installvendorbin'
15785 installvendorlib='$installvendorlib'
15786 intsize='$intsize'
15787 ivdformat='$ivdformat'
15788 ivsize='$ivsize'
15789 ivtype='$ivtype'
15790 known_extensions='$known_extensions'
15791 ksh='$ksh'
15792 large='$large'
15793 ld='$ld'
15794 lddlflags='$lddlflags'
15795 ldflags='$ldflags'
15796 ldflags_uselargefiles='$ldflags_uselargefiles'
15797 ldlibpthname='$ldlibpthname'
15798 less='$less'
15799 lib_ext='$lib_ext'
15800 libc='$libc'
15801 libperl='$libperl'
15802 libpth='$libpth'
15803 libs='$libs'
15804 libsdirs='$libsdirs'
15805 libsfiles='$libsfiles'
15806 libsfound='$libsfound'
15807 libspath='$libspath'
15808 libswanted='$libswanted'
15809 libswanted_uselargefiles='$libswanted_uselargefiles'
15810 line='$line'
15811 lint='$lint'
15812 lkflags='$lkflags'
15813 ln='$ln'
15814 lns='$lns'
15815 locincpth='$locincpth'
15816 loclibpth='$loclibpth'
15817 longdblsize='$longdblsize'
15818 longlongsize='$longlongsize'
15819 longsize='$longsize'
15820 lp='$lp'
15821 lpr='$lpr'
15822 ls='$ls'
15823 lseeksize='$lseeksize'
15824 lseektype='$lseektype'
15825 mail='$mail'
15826 mailx='$mailx'
15827 make='$make'
15828 make_set_make='$make_set_make'
15829 mallocobj='$mallocobj'
15830 mallocsrc='$mallocsrc'
15831 malloctype='$malloctype'
15832 man1dir='$man1dir'
15833 man1direxp='$man1direxp'
15834 man1ext='$man1ext'
15835 man3dir='$man3dir'
15836 man3direxp='$man3direxp'
15837 man3ext='$man3ext'
15838 medium='$medium'
15839 mips_type='$mips_type'
15840 mkdir='$mkdir'
15841 mmaptype='$mmaptype'
15842 models='$models'
15843 modetype='$modetype'
15844 more='$more'
15845 multiarch='$multiarch'
15846 mv='$mv'
15847 myarchname='$myarchname'
15848 mydomain='$mydomain'
15849 myhostname='$myhostname'
15850 myuname='$myuname'
15851 n='$n'
15852 netdb_hlen_type='$netdb_hlen_type'
15853 netdb_host_type='$netdb_host_type'
15854 netdb_name_type='$netdb_name_type'
15855 netdb_net_type='$netdb_net_type'
15856 nm='$nm'
15857 nm_opt='$nm_opt'
15858 nm_so_opt='$nm_so_opt'
15859 nonxs_ext='$nonxs_ext'
15860 nroff='$nroff'
15861 nvsize='$nvsize'
15862 nvtype='$nvtype'
15863 o_nonblock='$o_nonblock'
15864 obj_ext='$obj_ext'
15865 old_pthread_create_joinable='$old_pthread_create_joinable'
15866 optimize='$optimize'
15867 orderlib='$orderlib'
15868 osname='$osname'
15869 osvers='$osvers'
15870 otherlibdirs='$otherlibdirs'
15871 package='$package'
15872 pager='$pager'
15873 passcat='$passcat'
15874 patchlevel='$patchlevel'
15875 path_sep='$path_sep'
15876 perl5='$perl5'
15877 perl='$perl'
15878 perladmin='$perladmin'
15879 perlpath='$perlpath'
15880 pg='$pg'
15881 phostname='$phostname'
15882 pidtype='$pidtype'
15883 plibpth='$plibpth'
15884 pm_apiversion='$pm_apiversion'
15885 pmake='$pmake'
15886 pr='$pr'
15887 prefix='$prefix'
15888 prefixexp='$prefixexp'
15889 privlib='$privlib'
15890 privlibexp='$privlibexp'
15891 prototype='$prototype'
15892 ptrsize='$ptrsize'
15893 quadkind='$quadkind'
15894 quadtype='$quadtype'
15895 randbits='$randbits'
15896 randfunc='$randfunc'
15897 randseedtype='$randseedtype'
15898 ranlib='$ranlib'
15899 rd_nodata='$rd_nodata'
15900 revision='$revision'
15901 rm='$rm'
15902 rmail='$rmail'
15903 runnm='$runnm'
15904 sPRIEldbl='$sPRIEldbl'
15905 sPRIFldbl='$sPRIFldbl'
15906 sPRIGldbl='$sPRIGldbl'
15907 sPRIX64='$sPRIX64'
15908 sPRId64='$sPRId64'
15909 sPRIeldbl='$sPRIeldbl'
15910 sPRIfldbl='$sPRIfldbl'
15911 sPRIgldbl='$sPRIgldbl'
15912 sPRIi64='$sPRIi64'
15913 sPRIo64='$sPRIo64'
15914 sPRIu64='$sPRIu64'
15915 sPRIx64='$sPRIx64'
15916 sched_yield='$sched_yield'
15917 scriptdir='$scriptdir'
15918 scriptdirexp='$scriptdirexp'
15919 sed='$sed'
15920 seedfunc='$seedfunc'
15921 selectminbits='$selectminbits'
15922 selecttype='$selecttype'
15923 sendmail='$sendmail'
15924 sh='$sh'
15925 shar='$shar'
15926 sharpbang='$sharpbang'
15927 shmattype='$shmattype'
15928 shortsize='$shortsize'
15929 shrpenv='$shrpenv'
15930 shsharp='$shsharp'
15931 sig_count='$sig_count'
15932 sig_name='$sig_name'
15933 sig_name_init='$sig_name_init'
15934 sig_num='$sig_num'
15935 sig_num_init='$sig_num_init'
15936 signal_t='$signal_t'
15937 sitearch='$sitearch'
15938 sitearchexp='$sitearchexp'
15939 sitebin='$sitebin'
15940 sitebinexp='$sitebinexp'
15941 sitelib='$sitelib'
15942 sitelib_stem='$sitelib_stem'
15943 sitelibexp='$sitelibexp'
15944 siteprefix='$siteprefix'
15945 siteprefixexp='$siteprefixexp'
15946 sizesize='$sizesize'
15947 sizetype='$sizetype'
15948 sleep='$sleep'
15949 smail='$smail'
15950 small='$small'
15951 so='$so'
15952 sockethdr='$sockethdr'
15953 socketlib='$socketlib'
15954 socksizetype='$socksizetype'
15955 sort='$sort'
15956 spackage='$spackage'
15957 spitshell='$spitshell'
15958 split='$split'
15959 src='$src'
15960 ssizetype='$ssizetype'
15961 startperl='$startperl'
15962 startsh='$startsh'
15963 static_ext='$static_ext'
15964 stdchar='$stdchar'
15965 stdio_base='$stdio_base'
15966 stdio_bufsiz='$stdio_bufsiz'
15967 stdio_cnt='$stdio_cnt'
15968 stdio_filbuf='$stdio_filbuf'
15969 stdio_ptr='$stdio_ptr'
15970 stdio_stream_array='$stdio_stream_array'
15971 strings='$strings'
15972 submit='$submit'
15973 subversion='$subversion'
15974 sysman='$sysman'
15975 tail='$tail'
15976 tar='$tar'
15977 tbl='$tbl'
15978 tee='$tee'
15979 test='$test'
15980 timeincl='$timeincl'
15981 timetype='$timetype'
15982 touch='$touch'
15983 tr='$tr'
15984 trnl='$trnl'
15985 troff='$troff'
15986 u16size='$u16size'
15987 u16type='$u16type'
15988 u32size='$u32size'
15989 u32type='$u32type'
15990 u64size='$u64size'
15991 u64type='$u64type'
15992 u8size='$u8size'
15993 u8type='$u8type'
15994 uidformat='$uidformat'
15995 uidsign='$uidsign'
15996 uidsize='$uidsize'
15997 uidtype='$uidtype'
15998 uname='$uname'
15999 uniq='$uniq'
16000 uquadtype='$uquadtype'
16001 use5005threads='$use5005threads'
16002 use64bitall='$use64bitall'
16003 use64bitint='$use64bitint'
16004 usedl='$usedl'
16005 useithreads='$useithreads'
16006 uselargefiles='$uselargefiles'
16007 uselongdouble='$uselongdouble'
16008 usemorebits='$usemorebits'
16009 usemultiplicity='$usemultiplicity'
16010 usemymalloc='$usemymalloc'
16011 usenm='$usenm'
16012 useopcode='$useopcode'
16013 useperlio='$useperlio'
16014 useposix='$useposix'
16015 usesfio='$usesfio'
16016 useshrplib='$useshrplib'
16017 usesocks='$usesocks'
16018 usethreads='$usethreads'
16019 usevendorprefix='$usevendorprefix'
16020 usevfork='$usevfork'
16021 usrinc='$usrinc'
16022 uuname='$uuname'
16023 uvoformat='$uvoformat'
16024 uvsize='$uvsize'
16025 uvtype='$uvtype'
16026 uvuformat='$uvuformat'
16027 uvxformat='$uvxformat'
16028 vendorarch='$vendorarch'
16029 vendorarchexp='$vendorarchexp'
16030 vendorbin='$vendorbin'
16031 vendorbinexp='$vendorbinexp'
16032 vendorlib='$vendorlib'
16033 vendorlib_stem='$vendorlib_stem'
16034 vendorlibexp='$vendorlibexp'
16035 vendorprefix='$vendorprefix'
16036 vendorprefixexp='$vendorprefixexp'
16037 version='$version'
16038 vi='$vi'
16039 voidflags='$voidflags'
16040 xlibpth='$xlibpth'
16041 xs_apiversion='$xs_apiversion'
16042 zcat='$zcat'
16043 zip='$zip'
16044 EOT
16045
16046 : Add in command line options if available
16047 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
16048
16049 : add special variables
16050 $test -f $src/patchlevel.h && \
16051 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
16052 echo "CONFIGDOTSH=true" >>config.sh
16053
16054 : propagate old symbols
16055 if $test -f UU/config.sh; then
16056         <UU/config.sh sort | uniq >UU/oldconfig.sh
16057         sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
16058         sort | uniq -u >UU/oldsyms
16059         set X `cat UU/oldsyms`
16060         shift
16061         case $# in
16062         0) ;;
16063         *)
16064                 cat <<EOM
16065 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
16066 EOM
16067                 echo "# Variables propagated from previous config.sh file." >>config.sh
16068                 for sym in `cat UU/oldsyms`; do
16069                         echo "    Propagating $hint variable "'$'"$sym..."
16070                         eval 'tmp="$'"${sym}"'"'
16071                         echo "$tmp" | \
16072                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
16073                 done
16074                 ;;
16075         esac
16076 fi
16077
16078 : Finish up by extracting the .SH files
16079 case "$alldone" in
16080 exit)
16081         $rm -rf UU
16082         echo "Done."
16083         exit 0
16084         ;;
16085 cont)
16086         ;;
16087 '')
16088         dflt=''
16089         nostick=true
16090         $cat <<EOM
16091
16092 If you'd like to make any changes to the config.sh file before I begin
16093 to configure things, do it as a shell escape now (e.g. !vi config.sh).
16094
16095 EOM
16096         rp="Press return or use a shell escape to edit config.sh:"
16097         . UU/myread
16098         nostick=''
16099         case "$ans" in
16100         '') ;;
16101         *) : in case they cannot read
16102                 sh 1>&4 -c "$ans";;
16103         esac
16104         ;;
16105 esac
16106
16107 : if this fails, just run all the .SH files by hand
16108 . ./config.sh
16109
16110 echo " "
16111 exec 1>&4
16112 . ./UU/extract
16113
16114 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
16115         dflt=y
16116         case "$silent" in
16117         true) ;;
16118         *)
16119                 $cat <<EOM
16120
16121 Now you need to generate make dependencies by running "$make depend".
16122 You might prefer to run it in background: "$make depend > makedepend.out &"
16123 It can take a while, so you might not want to run it right now.
16124
16125 EOM
16126                 ;;
16127         esac
16128         rp="Run $make depend now?"
16129         . UU/myread
16130         case "$ans" in
16131         y*)
16132                 $make depend && echo "Now you must run a $make."
16133                 ;;
16134         *)
16135                 echo "You must run '$make depend' then '$make'."
16136                 ;;
16137         esac
16138 elif test -f [Mm]akefile; then
16139         echo " "
16140         echo "Now you must run a $make."
16141 else
16142         echo "Done."
16143 fi
16144
16145 if $test -f Policy.sh; then
16146     $cat <<EOM
16147
16148 If you compile $package on a different machine or from a different object
16149 directory, copy the Policy.sh file from this object directory to the
16150 new one before you run Configure -- this will help you with most of
16151 the policy defaults.
16152
16153 EOM
16154 fi
16155 if $test -f config.msg; then
16156     echo "Hmm.  I also noted the following information while running:"
16157     echo " "
16158     $cat config.msg >&4
16159     $rm -f config.msg
16160 fi
16161 $rm -f kit*isdone ark*isdone
16162 $rm -rf UU
16163
16164 : End of Configure
16165