Generate OP_IS_SOCKET() and OP_IS_FILETEST() macros
[p5sagit/p5-mst-13.2.git] / Configure
1 #! /bin/sh
2 #
3 # If these # comments don't work, trim them. Don't worry about any other
4 # shell scripts, Configure will trim # comments from them for you.
5 #
6 # (If you are trying to port this package to a machine without sh,
7 # I would suggest you have a look at the prototypical config_h.SH file
8 # and edit it to reflect your system. Some packages may include samples
9 # of config.h for certain machines, so you might look for one of those.)
10 #
11 # Yes, you may rip this off to use in other distribution packages. This
12 # script belongs to the public domain and cannot be copyrighted.
13 #
14 # (Note: this Configure script was generated automatically. Rather than
15 # working with this copy of Configure, you may wish to get metaconfig.
16 # The dist-3.0 package (which contains metaconfig) was posted in
17 # comp.sources.misc and is available on CPAN under authors/id/RAM so
18 # you may fetch it yourself from your nearest archive site.)
19 #
20
21 # $Id: Head.U,v 3.0.1.9 1997/02/28 15:02:09 ram Exp $
22 #
23 # Generated on Wed Aug  2 03:07:08 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 uselargefiles=''
905 uselongdouble=''
906 usemorebits=''
907 usemultiplicity=''
908 nm_opt=''
909 nm_so_opt=''
910 runnm=''
911 usenm=''
912 useperlio=''
913 usesocks=''
914 d_oldpthreads=''
915 use5005threads=''
916 useithreads=''
917 usethreads=''
918 incpath=''
919 mips_type=''
920 usrinc=''
921 d_vendorarch=''
922 installvendorarch=''
923 vendorarch=''
924 vendorarchexp=''
925 d_vendorbin=''
926 installvendorbin=''
927 vendorbin=''
928 vendorbinexp=''
929 d_vendorlib=''
930 installvendorlib=''
931 vendorlib=''
932 vendorlib_stem=''
933 vendorlibexp=''
934 usevendorprefix=''
935 vendorprefix=''
936 vendorprefixexp=''
937 defvoidused=''
938 voidflags=''
939 pm_apiversion=''
940 xs_apiversion=''
941 CONFIG=''
942
943 define='define'
944 undef='undef'
945 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
946 rmlist=''
947
948 : We must find out about Eunice early
949 eunicefix=':'
950 if test -f /etc/unixtovms; then
951         eunicefix=/etc/unixtovms
952 fi
953 if test -f /etc/unixtovms.exe; then
954         eunicefix=/etc/unixtovms.exe
955 fi
956
957 i_whoami=''
958 : set useposix=false in your hint file to disable the POSIX extension.
959 useposix=true
960 : set useopcode=false in your hint file to disable the Opcode extension.
961 useopcode=true
962 : Trailing extension.  Override this in a hint file, if needed.
963 _exe=''
964 : Extra object files, if any, needed on this platform.
965 archobjs=''
966 : Possible local include directories to search.
967 : Set locincpth to "" in a hint file to defeat local include searches.
968 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
969 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
970 :
971 : no include file wanted by default
972 inclwanted=''
973
974 groupstype=''
975 : change the next line if compiling for Xenix/286 on Xenix/386
976 xlibpth='/usr/lib/386 /lib/386'
977 : Possible local library directories to search.
978 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
979 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
980
981 : general looking path for locating libraries
982 glibpth="/usr/lib/large /lib /usr/lib $xlibpth"
983 glibpth="$glibpth /lib/large /usr/lib/small /lib/small"
984 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
985 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
986 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
987
988 : Private path used by Configure to find libraries.  Its value
989 : is prepended to libpth. This variable takes care of special
990 : machines, like the mips.  Usually, it should be empty.
991 plibpth=''
992
993 : default library list
994 libswanted=''
995 : some systems want to use only the non-versioned libso:s
996 ignore_versioned_solibs=''
997 : set usemultiplicity on the Configure command line to enable multiplicity.
998 : set usesocks on the Configure command line to enable socks.
999 : set usethreads on the Configure command line to enable threads.
1000 : full support for void wanted by default
1001 defvoidused=15
1002
1003 : List of libraries we want.
1004 : If anyone needs -lnet, put it in a hint file.
1005 libswanted='sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl'
1006 libswanted="$libswanted dld ld sun m c cposix posix"
1007 libswanted="$libswanted ndir dir crypt sec"
1008 libswanted="$libswanted ucb bsd BSD PW x iconv util"
1009 : We probably want to search /usr/shlib before most other libraries.
1010 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1011 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1012 glibpth="/usr/shlib $glibpth"
1013 : Do not use vfork unless overridden by a hint file.
1014 usevfork=false
1015
1016 : Find the basic shell for Bourne shell scripts
1017 case "$sh" in
1018 '')
1019         case "$SYSTYPE" in
1020         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1021         *) xxx='/bin/sh';;
1022         esac
1023         if test -f "$xxx"; then
1024                 sh="$xxx"
1025         else
1026                 : Build up a list and do a single loop so we can 'break' out.
1027                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1028                 for xxx in sh bash ksh pdksh ash; do
1029                         for p in $pth; do
1030                                 try="$try ${p}/${xxx}"
1031                         done
1032                 done
1033                 for xxx in $try; do
1034                         if test -f "$xxx"; then
1035                                 sh="$xxx";
1036                                 break
1037                         elif test -f "$xxx.exe"; then
1038                                 sh="$xxx";
1039                                 break
1040                         fi
1041                 done
1042         fi
1043         ;;
1044 esac
1045
1046 case "$sh" in
1047 '')     cat <<EOM >&2
1048 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
1049
1050 Usually it's in /bin/sh.  How did you even get this far?
1051 Please contact me (Perl Maintainers) at perlbug@perl.com and 
1052 we'll try to straighten this all out.
1053 EOM
1054         exit 1
1055         ;;
1056 esac
1057
1058 : see if sh knows # comments
1059 if `$sh -c '#' >/dev/null 2>&1`; then
1060         shsharp=true
1061         spitshell=cat
1062         xcat=/bin/cat
1063         test -f $xcat || xcat=/usr/bin/cat
1064         echo "#!$xcat" >try
1065         $eunicefix try
1066         chmod +x try
1067         ./try > today
1068         if test -s today; then
1069                 sharpbang='#!'
1070         else
1071                 echo "#! $xcat" > try
1072                 $eunicefix try
1073                 chmod +x try
1074                 ./try > today
1075                 if test -s today; then
1076                         sharpbang='#! '
1077                 else
1078                         sharpbang=': use '
1079                 fi
1080         fi
1081 else
1082         echo " "
1083         echo "Your $sh doesn't grok # comments--I will strip them later on."
1084         shsharp=false
1085         cd ..
1086         echo "exec grep -v '^[  ]*#'" >spitshell
1087         chmod +x spitshell
1088         $eunicefix spitshell
1089         spitshell=`pwd`/spitshell
1090         cd UU
1091         echo "I presume that if # doesn't work, #! won't work either!"
1092         sharpbang=': use '
1093 fi
1094 rm -f try today
1095
1096 : figure out how to guarantee sh startup
1097 case "$startsh" in
1098 '') startsh=${sharpbang}${sh} ;;
1099 *)
1100 esac
1101 cat >try <<EOSS
1102 $startsh
1103 set abc
1104 test "$?abc" != 1
1105 EOSS
1106
1107 chmod +x try
1108 $eunicefix try
1109 if ./try; then
1110         : echo "Yup, it does."
1111 else
1112         echo "Hmm... '$startsh' does not guarantee sh startup..."
1113         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1114 fi
1115 rm -f try
1116
1117
1118 : Save command line options in file UU/cmdline.opt for later use in
1119 : generating config.sh.
1120 cat > cmdline.opt <<EOSH
1121 # Configure command line arguments.
1122 config_arg0='$0'
1123 config_args='$*'
1124 config_argc=$#
1125 EOSH
1126 argn=1
1127 for arg in "$@"; do
1128         cat >>cmdline.opt <<EOSH
1129 config_arg$argn='$arg'
1130 EOSH
1131         argn=`expr $argn + 1`
1132 done
1133
1134 : produce awk script to parse command line options
1135 cat >options.awk <<'EOF'
1136 BEGIN {
1137         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1138
1139         len = length(optstr);
1140         for (i = 1; i <= len; i++) {
1141                 c = substr(optstr, i, 1);
1142                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1143                 if (a == ":") {
1144                         arg[c] = 1;
1145                         i++;
1146                 }
1147                 opt[c] = 1;
1148         }
1149 }
1150 {
1151         expect = 0;
1152         str = $0;
1153         if (substr(str, 1, 1) != "-") {
1154                 printf("'%s'\n", str);
1155                 next;
1156         }
1157         len = length($0);
1158         for (i = 2; i <= len; i++) {
1159                 c = substr(str, i, 1);
1160                 if (!opt[c]) {
1161                         printf("-%s\n", substr(str, i));
1162                         next;
1163                 }
1164                 printf("-%s\n", c);
1165                 if (arg[c]) {
1166                         if (i < len)
1167                                 printf("'%s'\n", substr(str, i + 1));
1168                         else
1169                                 expect = 1;
1170                         next;
1171                 }
1172         }
1173 }
1174 END {
1175         if (expect)
1176                 print "?";
1177 }
1178 EOF
1179
1180 : process the command line options
1181 set X `for arg in "$@"; do echo "X$arg"; done |
1182         sed -e s/X// | awk -f options.awk`
1183 eval "set $*"
1184 shift
1185 rm -f options.awk
1186
1187 : set up default values
1188 fastread=''
1189 reuseval=false
1190 config_sh=''
1191 alldone=''
1192 error=''
1193 silent=''
1194 extractsh=''
1195 override=''
1196 knowitall=''
1197 rm -f optdef.sh posthint.sh
1198 cat >optdef.sh <<EOS
1199 $startsh
1200 EOS
1201
1202
1203 : option parsing
1204 while test $# -gt 0; do
1205         case "$1" in
1206         -d) shift; fastread=yes;;
1207         -e) shift; alldone=cont;;
1208         -f)
1209                 shift
1210                 cd ..
1211                 if test -r "$1"; then
1212                         config_sh="$1"
1213                 else
1214                         echo "$me: cannot read config file $1." >&2
1215                         error=true
1216                 fi
1217                 cd UU
1218                 shift;;
1219         -h) shift; error=true;;
1220         -r) shift; reuseval=true;;
1221         -s) shift; silent=true; realsilent=true;;
1222         -E) shift; alldone=exit;;
1223         -K) shift; knowitall=true;;
1224         -O) shift; override=true;;
1225         -S) shift; silent=true; extractsh=true;;
1226         -D)
1227                 shift
1228                 case "$1" in
1229                 *=)
1230                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1231                         echo "$me: ignoring -D $1" >&2
1232                         ;;
1233                 *=*) echo "$1" | \
1234                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1235                 *) echo "$1='define'" >> optdef.sh;;
1236                 esac
1237                 shift
1238                 ;;
1239         -U)
1240                 shift
1241                 case "$1" in
1242                 *=) echo "$1" >> optdef.sh;;
1243                 *=*)
1244                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1245                         echo "$me: ignoring -U $1" >&2
1246                         ;;
1247                 *) echo "$1='undef'" >> optdef.sh;;
1248                 esac
1249                 shift
1250                 ;;
1251         -A)
1252             shift
1253             xxx=''
1254             yyy="$1"
1255             zzz=''
1256             uuu=undef
1257             case "$yyy" in
1258             *=*) zzz=`echo $yyy|sed 's!=.*!!'`
1259                  case "$zzz" in
1260                  *:*) zzz='' ;;
1261                  *)   xxx=append
1262                       zzz=" "`echo $yyy|sed 's!^[^=]*=!!'` 
1263                       yyy=`echo $yyy|sed 's!=.*!!'` ;;
1264                  esac
1265                  ;;
1266             esac
1267             case "$xxx" in
1268             '')  case "$yyy" in
1269                  *:*) xxx=`echo $yyy|sed 's!:.*!!'`
1270                       yyy=`echo $yyy|sed 's!^[^:]*:!!'`
1271                       zzz=`echo $yyy|sed 's!^[^=]*=!!'`
1272                       yyy=`echo $yyy|sed 's!=.*!!'` ;;
1273                  *)   xxx=`echo $yyy|sed 's!:.*!!'`
1274                       yyy=`echo $yyy|sed 's!^[^:]*:!!'` ;;
1275                  esac
1276                  ;;       
1277             esac
1278             case "$xxx" in
1279             append)
1280                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1281             clear)
1282                 echo "$yyy=''"                  >> posthint.sh ;;
1283             define)
1284                 case "$zzz" in
1285                 '') zzz=define ;;
1286                 esac
1287                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1288             eval)
1289                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1290             prepend)
1291                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1292             undef)
1293                 case "$zzz" in
1294                 '') zzz="$uuu" ;;
1295                 esac
1296                 echo "$yyy=$zzz"                >> posthint.sh ;;
1297             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1298             esac
1299             shift
1300             ;;
1301         -V) echo "$me generated by metaconfig 3.0 PL70." >&2
1302             exit 0;;
1303         --) break;;
1304         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1305         *) break;;
1306         esac
1307 done
1308
1309 case "$error" in
1310 true)
1311         cat >&2 <<EOM
1312 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1313                  [-U symbol] [-U symbol=] [-A command:symbol...]
1314   -d : use defaults for all answers.
1315   -e : go on without questioning past the production of config.sh.
1316   -f : specify an alternate default configuration file.
1317   -h : print this help message and exit (with an error status).
1318   -r : reuse C symbols value if possible (skips costly nm extraction).
1319   -s : silent mode, only echoes questions and essential information.
1320   -D : define symbol to have some value:
1321          -D symbol         symbol gets the value 'define'
1322          -D symbol=value   symbol gets the value 'value'
1323   -E : stop at the end of questions, after having produced config.sh.
1324   -K : do not use unless you know what you are doing.
1325   -O : let -D and -U override definitions from loaded configuration file.
1326   -S : perform variable substitutions on all .SH files (can mix with -f)
1327   -U : undefine symbol:
1328          -U symbol    symbol gets the value 'undef'
1329          -U symbol=   symbol gets completely empty
1330   -A : manipulate symbol after the platform specific hints have been applied:
1331          -A symbol=value                append " "value to symbol
1332          -A append:symbol=value         append value to symbol
1333          -A define:symbol=value         define symbol to have value
1334          -A clear:symbol                define symbol to be ''
1335          -A define:symbol               define symbol to be 'define'
1336          -A eval:symbol=value           define symbol to be eval of value
1337          -A prepend:symbol=value        prepend value to symbol
1338          -A undef:symbol                define symbol to be 'undef'
1339          -A undef:symbol=               define symbol to be ''
1340   -V : print version number and exit (with a zero status).
1341 EOM
1342         exit 1
1343         ;;
1344 esac
1345
1346 : Sanity checks
1347 case "$fastread$alldone" in
1348 yescont|yesexit) ;;
1349 *)
1350         case "$extractsh" in
1351         true) ;;
1352         *)
1353                 if test ! -t 0; then
1354                         echo "Say 'sh Configure', not 'sh <Configure'"
1355                         exit 1
1356                 fi
1357                 ;;
1358         esac
1359         ;;
1360 esac
1361
1362 exec 4>&1
1363 case "$silent" in
1364 true) exec 1>/dev/null;;
1365 esac
1366
1367 : run the defines and the undefines, if any, but leave the file out there...
1368 touch optdef.sh
1369 . ./optdef.sh
1370 : create the posthint manipulation script and leave the file out there...
1371 touch posthint.sh
1372
1373 : set package name
1374 package=perl5
1375 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1376 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1377 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1378 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1379 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1380 esac
1381
1382 : Some greps do not return status, grrr.
1383 echo "grimblepritz" >grimble
1384 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1385         contains=contains
1386 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1387         contains=grep
1388 else
1389         contains=contains
1390 fi
1391 rm -f grimble
1392 : the following should work in any shell
1393 case "$contains" in
1394 contains*)
1395         echo " "
1396         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1397         cat >contains <<'EOSS'
1398 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1399 EOSS
1400 chmod +x contains
1401 esac
1402
1403 : Find the path to the source tree
1404 case "$src" in
1405 '') case "$0" in
1406     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1407          case "$src" in
1408          /*)    ;;
1409          *)     src=`cd ../$src && pwd` ;;
1410          esac
1411          ;;
1412     *)   src='.';;
1413     esac;;
1414 esac
1415 case "$src" in
1416 '')     src=/
1417         rsrc=/
1418         ;;
1419 /*) rsrc="$src";;
1420 *) rsrc="../$src";;
1421 esac
1422 if test -f $rsrc/Configure && \
1423         $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1424 then
1425    : found it, so we are ok.
1426 else
1427         rsrc=''
1428         for src in . .. ../.. ../../.. ../../../..; do
1429                 if test -f ../$src/Configure && \
1430                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1431                 then
1432                         rsrc=../$src
1433                         break
1434                 fi
1435         done
1436 fi
1437 case "$rsrc" in
1438 '')
1439         cat <<EOM >&4
1440
1441 Sorry, I can't seem to locate the source dir for $package.  Please start
1442 Configure with an explicit path -- i.e. /some/path/Configure.
1443
1444 EOM
1445         exit 1
1446         ;;
1447 ../.)   rsrc='..';;
1448 *)
1449         echo " "
1450         echo "Sources for $package found in \"$src\"." >&4
1451         ;;
1452 esac
1453
1454 : script used to extract .SH files with variable substitutions
1455 cat >extract <<'EOS'
1456 CONFIGDOTSH=true
1457 echo "Doing variable substitutions on .SH files..."
1458 if test -f $src/MANIFEST; then
1459         set x `awk '{print $1}' <$src/MANIFEST | grep '\.SH$'`
1460 else
1461         echo "(Looking for .SH files under the source directory.)"
1462         set x `(cd $src; find . -name "*.SH" -print)`
1463 fi
1464 shift
1465 case $# in
1466 0) set x `(cd $src; echo *.SH)`; shift;;
1467 esac
1468 if test ! -f $src/$1; then
1469         shift
1470 fi
1471 mkdir_p='
1472 name=$1;
1473 create="";
1474 while test $name; do
1475         if test ! -d "$name"; then
1476                 create="$name $create";
1477                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1478                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1479         else
1480                 name="";
1481         fi;
1482 done;
1483 for file in $create; do
1484         mkdir $file;
1485 done
1486 '
1487 for file in $*; do
1488         case "$src" in
1489         ".")
1490                 case "$file" in
1491                 */*)
1492                         dir=`expr X$file : 'X\(.*\)/'`
1493                         file=`expr X$file : 'X.*/\(.*\)'`
1494                         (cd $dir && . ./$file)
1495                         ;;
1496                 *)
1497                         . ./$file
1498                         ;;
1499                 esac
1500                 ;;
1501         *)
1502                 case "$file" in
1503                 */*)
1504                         dir=`expr X$file : 'X\(.*\)/'`
1505                         file=`expr X$file : 'X.*/\(.*\)'`
1506                         (set x $dir; shift; eval $mkdir_p)
1507                         sh <$src/$dir/$file
1508                         ;;
1509                 *)
1510                         sh <$src/$file
1511                         ;;
1512                 esac
1513                 ;;
1514         esac
1515 done
1516 if test -f $src/config_h.SH; then
1517         if test ! -f config.h; then
1518         : oops, they left it out of MANIFEST, probably, so do it anyway.
1519         . $src/config_h.SH
1520         fi
1521 fi
1522 EOS
1523
1524 : extract files and exit if asked to do so
1525 case "$extractsh" in
1526 true)
1527         case "$realsilent" in
1528         true) ;;
1529         *) exec 1>&4;;
1530         esac
1531         case "$config_sh" in
1532         '') config_sh='config.sh';;
1533         esac
1534         echo " "
1535         echo "Fetching answers from $config_sh..."
1536         cd ..
1537         . $config_sh
1538         test "$override" && . ./optdef.sh
1539         echo " "
1540         . UU/extract
1541         rm -rf UU
1542         echo "Done."
1543         exit 0
1544         ;;
1545 esac
1546
1547 : Eunice requires " " instead of "", can you believe it
1548 echo " "
1549 : Here we go...
1550 echo "Beginning of configuration questions for $package."
1551
1552 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1553
1554 : first determine how to suppress newline on echo command
1555 echo " "
1556 echo "Checking echo to see how to suppress newlines..."
1557 (echo "hi there\c" ; echo " ") >.echotmp
1558 if $contains c .echotmp >/dev/null 2>&1 ; then
1559         echo "...using -n."
1560         n='-n'
1561         c=''
1562 else
1563         cat <<'EOM'
1564 ...using \c
1565 EOM
1566         n=''
1567         c='\c'
1568 fi
1569 echo $n "The star should be here-->$c"
1570 echo '*'
1571 rm -f .echotmp
1572
1573 : Now test for existence of everything in MANIFEST
1574 echo " "
1575 if test -f $rsrc/MANIFEST; then
1576         echo "First let's make sure your kit is complete.  Checking..." >&4
1577         awk '$1 !~ /PACK[A-Z]+/ {print $1}' $rsrc/MANIFEST | split -50
1578         rm -f missing
1579         tmppwd=`pwd`
1580         for filelist in x??; do
1581                 (cd $rsrc; ls `cat $tmppwd/$filelist` >/dev/null 2>>$tmppwd/missing)
1582         done
1583         if test -s missing; then
1584                 cat missing >&4
1585                 cat >&4 <<'EOM'
1586
1587 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1588
1589 You have the option of continuing the configuration process, despite the
1590 distinct possibility that your kit is damaged, by typing 'y'es.  If you
1591 do, don't blame me if something goes wrong.  I advise you to type 'n'o
1592 and contact the author (perlbug@perl.com).
1593
1594 EOM
1595                 echo $n "Continue? [n] $c" >&4
1596                 read ans
1597                 case "$ans" in
1598                 y*)
1599                         echo "Continuing..." >&4
1600                         rm -f missing
1601                         ;;
1602                 *)
1603                         echo "ABORTING..." >&4
1604                         kill $$
1605                         ;;
1606                 esac
1607         else
1608                 echo "Looks good..."
1609         fi
1610 else
1611         echo "There is no MANIFEST file.  I hope your kit is complete !"
1612 fi
1613 rm -f missing x??
1614
1615 echo " "
1616 : Find the appropriate value for a newline for tr
1617 if test -n "$DJGPP"; then
1618        trnl='\012'
1619 fi
1620 if test X"$trnl" = X; then
1621         case "`echo foo|tr '\n' x 2>/dev/null`" in
1622         foox) trnl='\n' ;;
1623         esac
1624 fi
1625 if test X"$trnl" = X; then
1626         case "`echo foo|tr '\012' x 2>/dev/null`" in
1627         foox) trnl='\012' ;;
1628         esac
1629 fi
1630 if test X"$trnl" = X; then
1631         cat <<EOM >&2
1632
1633 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
1634
1635 EOM
1636         exit 1
1637 fi
1638
1639 : compute the number of columns on the terminal for proper question formatting
1640 case "$COLUMNS" in
1641 '') COLUMNS='80';;
1642 esac
1643
1644 : set up the echo used in my read
1645 myecho="case \"\$xxxm\" in
1646 '') echo $n \"\$rp $c\" >&4;;
1647 *) case \"\$rp\" in
1648         '') echo $n \"[\$xxxm] $c\";;
1649         *)
1650                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
1651                         echo \"\$rp\" >&4
1652                         echo $n \"[\$xxxm] $c\" >&4
1653                 else
1654                         echo $n \"\$rp [\$xxxm] $c\" >&4
1655                 fi
1656                 ;;
1657         esac;;
1658 esac"
1659
1660 : now set up to do reads with possible shell escape and default assignment
1661 cat <<EOSC >myread
1662 $startsh
1663 xxxm=\$dflt
1664 $myecho
1665 ans='!'
1666 case "\$fastread" in
1667 yes) case "\$dflt" in
1668         '') ;;
1669         *) ans='';
1670                 case "\$silent-\$rp" in
1671                 true-) ;;
1672                 *) echo " " >&4;;
1673                 esac;;
1674         esac;;
1675 *) case "\$silent" in
1676         true) case "\$rp" in
1677                 '') ans='';;
1678                 esac;;
1679         esac;;
1680 esac
1681 while expr "X\$ans" : "X!" >/dev/null; do
1682         read answ
1683         set x \$xxxm
1684         shift
1685         aok=''; eval "ans=\\"\$answ\\"" && aok=y
1686         case  "\$answ" in
1687         "!")
1688                 sh 1>&4
1689                 echo " "
1690                 $myecho
1691                 ;;
1692         !*)
1693                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
1694                 shift
1695                 sh 1>&4 -c "\$*"
1696                 echo " "
1697                 $myecho
1698                 ;;
1699         "\$ans")
1700                 case "\$ans" in
1701                 \\&*)
1702                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
1703                         shift
1704                         case "\$1" in
1705                         -d)
1706                                 fastread=yes
1707                                 echo "(OK, I'll run with -d after this question.)" >&4
1708                                 ;;
1709                         -*)
1710                                 echo "*** Sorry, \$1 not supported yet." >&4
1711                                 ;;
1712                         esac
1713                         $myecho
1714                         ans=!
1715                         ;;
1716                 esac;;
1717         *)
1718                 case "\$aok" in
1719                 y)
1720                         echo "*** Substitution done -- please confirm."
1721                         xxxm="\$ans"
1722                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
1723                         xxxm="\$ans"
1724                         ans=!
1725                         ;;
1726                 *)
1727                         echo "*** Error -- try again."
1728                         ans=!
1729                         ;;
1730                 esac
1731                 $myecho
1732                 ;;
1733         esac
1734         case "\$ans\$xxxm\$nostick" in
1735         '')
1736                 ans=!
1737                 $myecho
1738                 ;;
1739         esac
1740 done
1741 case "\$ans" in
1742 '') ans="\$xxxm";;
1743 esac
1744 EOSC
1745
1746 : create .config dir to save info across Configure sessions
1747 test -d ../.config || mkdir ../.config
1748 cat >../.config/README <<EOF
1749 This directory created by Configure to save information that should
1750 persist across sessions for $package.
1751
1752 You may safely delete it if you wish.
1753 EOF
1754
1755 : general instructions
1756 needman=true
1757 firsttime=true
1758 user=`(logname) 2>/dev/null`
1759 case "$user" in
1760 '') user=`whoami 2>&1`;;
1761 esac
1762 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
1763         firsttime=false
1764         echo " "
1765         rp='Would you like to see the instructions?'
1766         dflt=n
1767         . ./myread
1768         case "$ans" in
1769         [yY]*) ;;
1770         *) needman=false;;
1771         esac
1772 fi
1773 if $needman; then
1774         cat <<EOH
1775
1776 This installation shell script will examine your system and ask you questions
1777 to determine how the perl5 package should be installed. If you get
1778 stuck on a question, you may use a ! shell escape to start a subshell or
1779 execute a command.  Many of the questions will have default answers in square
1780 brackets; typing carriage return will give you the default.
1781
1782 On some of the questions which ask for file or directory names you are allowed
1783 to use the ~name construct to specify the login directory belonging to "name",
1784 even if you don't have a shell which knows about that.  Questions where this is
1785 allowed will be marked "(~name ok)".
1786
1787 EOH
1788         rp=''
1789         dflt='Type carriage return to continue'
1790         . ./myread
1791         cat <<'EOH'
1792
1793 The prompter used in this script allows you to use shell variables and
1794 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
1795 in the default answer, as if the default line was a set of arguments given to a
1796 script shell.  This means you may also use $* to repeat the whole default line,
1797 so you do not have to re-type everything to add something to the default.
1798
1799 Everytime there is a substitution, you will have to confirm.  If there is an
1800 error (e.g. an unmatched backtick), the default answer will remain unchanged
1801 and you will be prompted again.
1802
1803 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
1804 the questions and use the computed defaults (or the previous answers if there
1805 was already a config.sh file). Type 'Configure -h' for a list of options.
1806 You may also start interactively and then answer '& -d' at any prompt to turn
1807 on the non-interactive behaviour for the remainder of the execution.
1808
1809 EOH
1810         . ./myread
1811         cat <<EOH
1812
1813 Much effort has been expended to ensure that this shell script will run on any
1814 Unix system.  If despite that it blows up on yours, your best bet is to edit
1815 Configure and run it again.  If you can't run Configure for some reason,
1816 you'll have to generate a config.sh file by hand.  Whatever problems you
1817 have, let me (perlbug@perl.com) know how I blew it.
1818
1819 This installation script affects things in two ways:
1820
1821 1) it may do direct variable substitutions on some of the files included
1822    in this kit.
1823 2) it builds a config.h file for inclusion in C programs.  You may edit
1824    any of these files as the need arises after running this script.
1825
1826 If you make a mistake on a question, there is no easy way to back up to it
1827 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
1828 files.  Configure will offer to let you do this before it runs the SH files.
1829
1830 EOH
1831         dflt='Type carriage return to continue'
1832         . ./myread
1833         case "$firsttime" in
1834         true) echo $user >>../.config/instruct;;
1835         esac
1836 fi
1837
1838 : find out where common programs are
1839 echo " "
1840 echo "Locating common programs..." >&4
1841 cat <<EOSC >loc
1842 $startsh
1843 case \$# in
1844 0) exit 1;;
1845 esac
1846 thing=\$1
1847 shift
1848 dflt=\$1
1849 shift
1850 for dir in \$*; do
1851         case "\$thing" in
1852         .)
1853         if test -d \$dir/\$thing; then
1854                 echo \$dir
1855                 exit 0
1856         fi
1857         ;;
1858         *)
1859         for thisthing in \$dir/\$thing; do
1860                 : just loop through to pick last item
1861         done
1862         if test -f \$thisthing; then
1863                 echo \$thisthing
1864                 exit 0
1865         elif test -f \$dir/\$thing.exe; then
1866                 if test -n "$DJGPP"; then
1867                         echo \$dir/\$thing.exe
1868                 else
1869                         : on Eunice apparently
1870                         echo \$dir/\$thing
1871                 fi
1872                 exit 0
1873         fi
1874         ;;
1875         esac
1876 done
1877 echo \$dflt
1878 exit 1
1879 EOSC
1880 chmod +x loc
1881 $eunicefix loc
1882 loclist="
1883 awk
1884 cat
1885 comm
1886 cp
1887 echo
1888 expr
1889 grep
1890 ls
1891 make
1892 mkdir
1893 rm
1894 sed
1895 sort
1896 touch
1897 tr
1898 uniq
1899 "
1900 trylist="
1901 Mcc
1902 ar
1903 byacc
1904 cpp
1905 csh
1906 date
1907 egrep
1908 gzip
1909 less
1910 ln
1911 more
1912 nm
1913 nroff
1914 pg
1915 test
1916 uname
1917 zip
1918 "
1919 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1920 pth="$pth /lib /usr/lib"
1921 for file in $loclist; do
1922         eval xxx=\$$file
1923         case "$xxx" in
1924         /*|?:[\\/]*)
1925                 if test -f "$xxx"; then
1926                         : ok
1927                 else
1928                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
1929                         xxx=`./loc $file $file $pth`
1930                 fi
1931                 ;;
1932         '') xxx=`./loc $file $file $pth`;;
1933         *) xxx=`./loc $xxx $xxx $pth`;;
1934         esac
1935         eval $file=$xxx
1936         eval _$file=$xxx
1937         case "$xxx" in
1938         /*)
1939                 echo $file is in $xxx.
1940                 ;;
1941         ?:[\\/]*)
1942                 echo $file is in $xxx.
1943                 ;;
1944         *)
1945                 echo "I don't know where '$file' is, and my life depends on it." >&4
1946                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
1947                 exit 1
1948                 ;;
1949         esac
1950 done
1951 echo " "
1952 echo "Don't worry if any of the following aren't found..."
1953 say=offhand
1954 for file in $trylist; do
1955         eval xxx=\$$file
1956         case "$xxx" in
1957         /*|?:[\\/]*)
1958                 if test -f "$xxx"; then
1959                         : ok
1960                 else
1961                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
1962                         xxx=`./loc $file $file $pth`
1963                 fi
1964                 ;;
1965         '') xxx=`./loc $file $file $pth`;;
1966         *) xxx=`./loc $xxx $xxx $pth`;;
1967         esac
1968         eval $file=$xxx
1969         eval _$file=$xxx
1970         case "$xxx" in
1971         /*)
1972                 echo $file is in $xxx.
1973                 ;;
1974         ?:[\\/]*)
1975                 echo $file is in $xxx.
1976                 ;;
1977         *)
1978                 echo "I don't see $file out there, $say."
1979                 say=either
1980                 ;;
1981         esac
1982 done
1983 case "$egrep" in
1984 egrep)
1985         echo "Substituting grep for egrep."
1986         egrep=$grep
1987         ;;
1988 esac
1989 case "$ln" in
1990 ln)
1991         echo "Substituting cp for ln."
1992         ln=$cp
1993         ;;
1994 esac
1995 case "$test" in
1996 test)
1997         echo "Hopefully test is built into your sh."
1998         ;;
1999 *)
2000         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2001                 echo "Using the test built into your sh."
2002                 test=test
2003                 _test=test
2004         fi
2005         ;;
2006 esac
2007 case "$echo" in
2008 echo)
2009         echo "Hopefully echo is built into your sh."
2010         ;;
2011 '') ;;
2012 *)
2013         echo " "
2014 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2015         $echo $n "hi there$c" >foo1
2016         echo $n "hi there$c" >foo2
2017         if cmp foo1 foo2 >/dev/null 2>&1; then
2018                 echo "They are compatible.  In fact, they may be identical."
2019         else
2020                 case "$n" in
2021                 '-n') n='' c='\c';;
2022                 *) n='-n' c='';;
2023                 esac
2024                 cat <<FOO
2025 They are not compatible!  You are probably running ksh on a non-USG system.
2026 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2027 have echo built in and we may have to run some Bourne shell scripts.  That
2028 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2029
2030 FOO
2031                 $echo $n "The star should be here-->$c"
2032                 $echo "*"
2033         fi
2034         $rm -f foo1 foo2
2035         ;;
2036 esac
2037
2038 cat <<EOS >checkcc
2039 $startsh
2040 EOS
2041 cat <<'EOSC' >>checkcc
2042 case "$cc" in
2043 '') ;;
2044 *)  $rm -f try try.*
2045     $cat >try.c <<EOM
2046 int main(int argc, char *argv[]) {
2047   return 0;
2048 }
2049 EOM
2050     if $cc -o try try.c; then
2051        :
2052     else
2053         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2054         despair=yes
2055         trygcc=yes
2056         case "$cc" in
2057         *gcc*) trygcc=no ;;
2058         esac
2059         case "`$cc -v -c try.c 2>&1`" in
2060         *gcc*) trygcc=no ;;
2061         esac
2062         if $test X"$trygcc" = Xyes; then
2063             if gcc -o try -c try.c; then
2064                 echo " "
2065                 echo "You seem to have a working gcc, though." >&4
2066                 rp="Would you like to use it?"
2067                 dflt=y
2068                 if $test -f myread; then
2069                     . ./myread
2070                 else
2071                     if $test -f UU/myread; then
2072                         . ./UU/myread
2073                     else
2074                         echo "Cannot find myread, sorry.  Aborting." >&2
2075                         exit 1
2076                     fi
2077                 fi  
2078                 case "$ans" in
2079                 [yY]*) cc=gcc; ccflags=''; despair=no ;;
2080                 esac
2081             fi
2082         fi
2083         if $test X"$despair" = Xyes; then
2084             echo "You need to find a working C compiler." >&4
2085             echo "I cannot continue any further, aborting." >&4
2086             exit 1
2087         fi
2088     fi
2089     $rm -f try try.*
2090     ;;
2091 esac
2092 EOSC
2093
2094 : determine whether symbolic links are supported
2095 echo " "
2096 $touch blurfl
2097 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2098         echo "Symbolic links are supported." >&4
2099         lns="$ln -s"
2100 else
2101         echo "Symbolic links are NOT supported." >&4
2102         lns="$ln"
2103 fi
2104 $rm -f blurfl sym
2105
2106 : see whether [:lower:] and [:upper:] are supported character classes
2107 echo " "
2108 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2109 ABYZ)
2110         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2111         up='[:upper:]'
2112         low='[:lower:]'
2113         ;;
2114 *)      # There is a discontinuity in EBCDIC between 'I' and 'J'
2115         # (0xc9 and 0xd1), therefore that is a nice testing point.
2116         if test "X$up" = X -o "X$low" = X; then
2117             case "`echo IJ | $tr '[I-J]' '[i-j]' 2>/dev/null`" in
2118             ij) up='[A-Z]'
2119                 low='[a-z]'
2120                 ;;
2121             esac
2122         fi
2123         if test "X$up" = X -o "X$low" = X; then
2124             case "`echo IJ | $tr I-J i-j 2>/dev/null`" in
2125             ij) up='A-Z'
2126                 low='a-z'
2127                 ;;
2128             esac
2129         fi
2130         if test "X$up" = X -o "X$low" = X; then
2131             case "`echo IJ | od -x 2>/dev/null`" in
2132             *C9D1*|*c9d1*)
2133                 echo "Hey, this might be EBCDIC." >&4
2134                 if test "X$up" = X -o "X$low" = X; then
2135                     case "`echo IJ | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
2136                     ij) up='[A-IJ-RS-Z]'
2137                         low='[a-ij-rs-z]'
2138                         ;;
2139                     esac
2140                 fi
2141                 if test "X$up" = X -o "X$low" = X; then
2142                     case "`echo IJ | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
2143                     ij) up='A-IJ-RS-Z'
2144                         low='a-ij-rs-z'
2145                         ;;
2146                     esac
2147                 fi
2148                 ;;
2149             esac
2150         fi
2151 esac
2152 case "`echo IJ | $tr \"$up\" \"$low\" 2>/dev/null`" in
2153 ij)
2154     echo "Using $up and $low to convert case." >&4
2155     ;;
2156 *)
2157     echo "I don't know how to translate letters from upper to lower case." >&4
2158     echo "Your tr is not acting any way I know of." >&4
2159     exit 1
2160     ;;
2161 esac
2162 : set up the translation script tr, must be called with ./tr of course
2163 cat >tr <<EOSC
2164 $startsh
2165 case "\$1\$2" in
2166 '[A-Z][a-z]') exec $tr '$up' '$low';;
2167 '[a-z][A-Z]') exec $tr '$low' '$up';;
2168 esac
2169 exec $tr "\$@"
2170 EOSC
2171 chmod +x tr
2172 $eunicefix tr
2173
2174 : Try to determine whether config.sh was made on this system
2175 case "$config_sh" in
2176 '')
2177 myuname=`$uname -a 2>/dev/null`
2178 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
2179 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
2180 # because the A-Z/a-z are not consecutive.
2181 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
2182         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
2183 newmyuname="$myuname"
2184 dflt=n
2185 case "$knowitall" in
2186 '')
2187         if test -f ../config.sh; then
2188                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
2189                         eval "`grep myuname= ../config.sh`"
2190                 fi
2191                 if test "X$myuname" = "X$newmyuname"; then
2192                         dflt=y
2193                 fi
2194         fi
2195         ;;
2196 *) dflt=y;;
2197 esac
2198
2199 : Get old answers from old config file if Configure was run on the
2200 : same system, otherwise use the hints.
2201 hint=default
2202 cd ..
2203 if test -f config.sh; then
2204         echo " "
2205         rp="I see a config.sh file.  Shall I use it to set the defaults?"
2206         . UU/myread
2207         case "$ans" in
2208         n*|N*) echo "OK, I'll ignore it."; mv config.sh config.sh.old;;
2209         *)  echo "Fetching default answers from your old config.sh file..." >&4
2210                 tmp_n="$n"
2211                 tmp_c="$c"
2212                 tmp_sh="$sh"
2213                 . ./config.sh
2214                 cp config.sh UU
2215                 n="$tmp_n"
2216                 c="$tmp_c"
2217                 : Older versions did not always set $sh.  Catch re-use of such
2218                 : an old config.sh.
2219                 case "$sh" in
2220                 '') sh="$tmp_sh" ;;
2221                 esac
2222                 hint=previous
2223                 ;;
2224         esac
2225 fi
2226 . ./UU/checkcc
2227 if test ! -f config.sh; then
2228         $cat <<EOM
2229
2230 First time through, eh?  I have some defaults handy for some systems
2231 that need some extra help getting the Configure answers right:
2232
2233 EOM
2234         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
2235         dflt=''
2236         : Half the following guesses are probably wrong... If you have better
2237         : tests or hints, please send them to perlbug@perl.com
2238         : The metaconfig authors would also appreciate a copy...
2239         $test -f /irix && osname=irix
2240         $test -f /xenix && osname=sco_xenix
2241         $test -f /dynix && osname=dynix
2242         $test -f /dnix && osname=dnix
2243         $test -f /lynx.os && osname=lynxos
2244         $test -f /unicos && osname=unicos && osvers=`$uname -r`
2245         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
2246         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
2247         $test -f /bin/mips && /bin/mips && osname=mips
2248         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
2249                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
2250         $test -d /usr/apollo/bin && osname=apollo
2251         $test -f /etc/saf/_sactab && osname=svr4
2252         $test -d /usr/include/minix && osname=minix
2253         if $test -d /MachTen -o -d /MachTen_Folder; then
2254                 osname=machten
2255                 if $test -x /sbin/version; then
2256                         osvers=`/sbin/version | $awk '{print $2}' |
2257                         $sed -e 's/[A-Za-z]$//'`
2258                 elif $test -x /usr/etc/version; then
2259                         osvers=`/usr/etc/version | $awk '{print $2}' |
2260                         $sed -e 's/[A-Za-z]$//'`
2261                 else
2262                         osvers="$2.$3"
2263                 fi
2264         fi
2265
2266         $test -f /sys/posix.dll &&
2267                 $test -f /usr/bin/what &&
2268                 set X `/usr/bin/what /sys/posix.dll` &&
2269                 $test "$3" = UWIN &&
2270                 osname=uwin &&
2271                 osvers="$5"
2272
2273         if $test -f $uname; then
2274                 set X $myuname
2275                 shift
2276
2277                 case "$5" in
2278                 fps*) osname=fps ;;
2279                 mips*)
2280                         case "$4" in
2281                         umips) osname=umips ;;
2282                         *) osname=mips ;;
2283                         esac;;
2284                 [23]100) osname=mips ;;
2285                 next*) osname=next ;;
2286                 i386*)
2287                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
2288                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
2289                                 osname='sco'
2290                                 osvers=$tmp
2291                         elif $test -f /etc/kconfig; then
2292                                 osname=isc
2293                                 if test "$lns" = "$ln -s"; then
2294                                         osvers=4
2295                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
2296                                         osvers=3
2297                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
2298                                         osvers=2
2299                                 fi
2300                         fi
2301                         tmp=''
2302                         ;;
2303                 pc*)
2304                         if test -n "$DJGPP"; then
2305                                 osname=dos
2306                                 osvers=djgpp
2307                         fi
2308                         ;;
2309                 esac
2310
2311                 case "$1" in
2312                 aix) osname=aix
2313                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
2314                         case "$tmp" in
2315                         'not found') osvers="$4"."$3" ;;
2316                         '<3240'|'<>3240') osvers=3.2.0 ;;
2317                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
2318                         '=3250'|'>3250') osvers=3.2.5 ;;
2319                         *) osvers=$tmp;;
2320                         esac
2321                         ;;
2322                 bsd386) osname=bsd386
2323                         osvers=`$uname -r`
2324                         ;;
2325                 cygwin*) osname=cygwin
2326                         osvers="$3"
2327                         ;;
2328                 *dc.osx) osname=dcosx
2329                         osvers="$3"
2330                         ;;
2331                 dnix) osname=dnix
2332                         osvers="$3"
2333                         ;;
2334                 domainos) osname=apollo
2335                         osvers="$3"
2336                         ;;
2337                 dgux) osname=dgux 
2338                         osvers="$3"
2339                         ;;
2340                 dynixptx*) osname=dynixptx
2341                         osvers=`echo "$4"|sed 's/^v//'`
2342                         ;;
2343                 freebsd) osname=freebsd 
2344                         osvers="$3" ;;
2345                 genix) osname=genix ;;
2346                 hp*) osname=hpux 
2347                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
2348                         ;;
2349                 irix*) osname=irix
2350                         case "$3" in
2351                         4*) osvers=4 ;;
2352                         5*) osvers=5 ;;
2353                         *)      osvers="$3" ;;
2354                         esac
2355                         ;;
2356                 linux) osname=linux
2357                         case "$3" in
2358                         *)      osvers="$3" ;;
2359                         esac
2360                         ;;
2361                 MiNT) osname=mint
2362                         ;;
2363                 netbsd*) osname=netbsd
2364                         osvers="$3"
2365                         ;;
2366                 news-os) osvers="$3"
2367                         case "$3" in
2368                         4*) osname=newsos4 ;;
2369                         *) osname=newsos ;;
2370                         esac
2371                         ;;
2372                 next*) osname=next ;;
2373                 POSIX-BC | posix-bc ) osname=posix-bc
2374                         osvers="$3"
2375                         ;;
2376                 powerux | power_ux | powermax_os | powermaxos | \
2377                 powerunix | power_unix) osname=powerux
2378                         osvers="$3"
2379                         ;;
2380                 qnx) osname=qnx
2381                         osvers="$4"
2382                         ;;
2383                 solaris) osname=solaris
2384                         case "$3" in
2385                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
2386                         *)      osvers="$3" ;;
2387                         esac
2388                         ;;
2389                 sunos) osname=sunos
2390                         case "$3" in
2391                         5*) osname=solaris
2392                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
2393                         *)      osvers="$3" ;;
2394                         esac
2395                         ;;
2396                 titanos) osname=titanos
2397                         case "$3" in
2398                         1*) osvers=1 ;;
2399                         2*) osvers=2 ;;
2400                         3*) osvers=3 ;;
2401                         4*) osvers=4 ;;
2402                         *)      osvers="$3" ;;
2403                         esac
2404                         ;;
2405                 ultrix) osname=ultrix
2406                         osvers="$3"
2407                         ;;
2408                 osf1|mls+)      case "$5" in
2409                                 alpha)
2410                                         osname=dec_osf
2411                                         osvers=`sizer -v | awk '{print $3}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
2412                                         case "$osvers" in
2413                                         [1-9].[0-9]*) ;;
2414                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
2415                                         esac
2416                                         ;;
2417                         hp*)    osname=hp_osf1  ;;
2418                         mips)   osname=mips_osf1 ;;
2419                         esac
2420                         ;;
2421                 unixware) osname=svr5
2422                         osvers="$4"
2423                         ;;
2424                 uts) osname=uts
2425                         osvers="$3"
2426                         ;;
2427                 $2) case "$osname" in
2428                         *isc*) ;;
2429                         *freebsd*) ;;
2430                         svr*)
2431                                 : svr4.x or possibly later
2432                                 case "svr$3" in 
2433                                 ${osname}*)
2434                                         osname=svr$3
2435                                         osvers=$4
2436                                         ;;
2437                                 esac
2438                                 case "$osname" in
2439                                 svr4.0)
2440                                         : Check for ESIX
2441                                         if test -f /stand/boot ; then
2442                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
2443                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
2444                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
2445                                                         if test -n "$isesix"; then
2446                                                                 osname=esix4
2447                                                         fi
2448                                                 fi
2449                                         fi
2450                                         ;;
2451                                 esac
2452                                 ;;
2453                         *)      if test -f /etc/systemid; then
2454                                         osname=sco
2455                                         set `echo $3 | $sed 's/\./ /g'` $4
2456                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
2457                                                 osvers=$1.$2.$3
2458                                         elif $test -f $src/hints/sco_$1_$2.sh; then
2459                                                 osvers=$1.$2
2460                                         elif $test -f $src/hints/sco_$1.sh; then
2461                                                 osvers=$1
2462                                         fi
2463                                 else
2464                                         case "$osname" in
2465                                         '') : Still unknown.  Probably a generic Sys V.
2466                                                 osname="sysv"
2467                                                 osvers="$3"
2468                                                 ;;
2469                                         esac
2470                                 fi
2471                                 ;;
2472                         esac
2473                         ;;
2474                 *)      case "$osname" in
2475                         '') : Still unknown.  Probably a generic BSD.
2476                                 osname="$1"
2477                                 osvers="$3"
2478                                 ;;
2479                         esac
2480                         ;;
2481                 esac
2482         else
2483                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
2484                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
2485                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
2486                                 osname=news_os
2487                         fi
2488                         $rm -f UU/kernel.what
2489                 elif test -d c:/.; then
2490                         set X $myuname
2491                         osname=os2
2492                         osvers="$5"
2493                 fi
2494         fi
2495         
2496         : Now look for a hint file osname_osvers, unless one has been
2497         : specified already.
2498         case "$hintfile" in
2499         ''|' ')
2500                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
2501                 : Also try without trailing minor version numbers.
2502                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
2503                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
2504                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
2505                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
2506                 case "$file" in
2507                 '') dflt=none ;;
2508                 *)  case "$osvers" in
2509                         '') dflt=$file
2510                                 ;;
2511                         *)  if $test -f $src/hints/$file.sh ; then
2512                                         dflt=$file
2513                                 elif $test -f $src/hints/$xfile.sh ; then
2514                                         dflt=$xfile
2515                                 elif $test -f $src/hints/$xxfile.sh ; then
2516                                         dflt=$xxfile
2517                                 elif $test -f $src/hints/$xxxfile.sh ; then
2518                                         dflt=$xxxfile
2519                                 elif $test -f $src/hints/$xxxxfile.sh ; then
2520                                         dflt=$xxxxfile
2521                                 elif $test -f "$src/hints/${osname}.sh" ; then
2522                                         dflt="${osname}"
2523                                 else
2524                                         dflt=none
2525                                 fi
2526                                 ;;
2527                         esac
2528                         ;;
2529                 esac
2530                 if $test -f Policy.sh ; then
2531                         case "$dflt" in
2532                         *Policy*) ;;
2533                         none) dflt="Policy" ;;
2534                         *) dflt="Policy $dflt" ;;
2535                         esac
2536                 fi
2537                 ;;
2538         *)
2539                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
2540                 ;;
2541         esac
2542
2543         if $test -f Policy.sh ; then
2544                 $cat <<EOM
2545
2546 There's also a Policy hint file available, which should make the
2547 site-specific (policy) questions easier to answer.
2548 EOM
2549
2550         fi
2551
2552         $cat <<EOM
2553
2554 You may give one or more space-separated answers, or "none" if appropriate.
2555 A well-behaved OS will have no hints, so answering "none" or just "Policy"
2556 is a good thing.  DO NOT give a wrong version or a wrong OS.
2557
2558 EOM
2559
2560         rp="Which of these apply, if any?"
2561         . UU/myread
2562         tans=$ans
2563         for file in $tans; do
2564                 if $test X$file = XPolicy -a -f Policy.sh; then
2565                         . Policy.sh
2566                         $cat Policy.sh >> UU/config.sh
2567                 elif $test -f $src/hints/$file.sh; then
2568                         . $src/hints/$file.sh
2569                         $cat $src/hints/$file.sh >> UU/config.sh
2570                 elif $test X$tans = X -o X$tans = Xnone ; then
2571                         : nothing
2572                 else
2573                         : Give one chance to correct a possible typo.
2574                         echo "$file.sh does not exist"
2575                         dflt=$file
2576                         rp="hint to use instead?"
2577                         . UU/myread
2578                         for file in $ans; do
2579                                 if $test -f "$src/hints/$file.sh"; then
2580                                         . $src/hints/$file.sh
2581                                         $cat $src/hints/$file.sh >> UU/config.sh
2582                                 elif $test X$ans = X -o X$ans = Xnone ; then
2583                                         : nothing
2584                                 else
2585                                         echo "$file.sh does not exist -- ignored."
2586                                 fi
2587                         done
2588                 fi
2589         done
2590
2591         hint=recommended
2592         : Remember our hint file for later.
2593         if $test -f "$src/hints/$file.sh" ; then
2594                 hintfile="$file"
2595         else
2596                 hintfile=''
2597         fi
2598 fi
2599 cd UU
2600 ;;
2601 *)
2602         echo " "
2603         echo "Fetching default answers from $config_sh..." >&4
2604         tmp_n="$n"
2605         tmp_c="$c"
2606         cd ..
2607         cp $config_sh config.sh 2>/dev/null
2608         chmod +w config.sh
2609         . ./config.sh
2610         cd UU
2611         cp ../config.sh .
2612         n="$tmp_n"
2613         c="$tmp_c"
2614         hint=previous
2615         ;;
2616 esac
2617 test "$override" && . ./optdef.sh
2618 myuname="$newmyuname"
2619
2620 : Restore computed paths
2621 for file in $loclist $trylist; do
2622         eval $file="\$_$file"
2623 done
2624
2625 cat << EOM
2626
2627 Configure uses the operating system name and version to set some defaults.
2628 The default value is probably right if the name rings a bell. Otherwise,
2629 since spelling matters for me, either accept the default or answer "none"
2630 to leave it blank.
2631
2632 EOM
2633 case "$osname" in
2634         ''|' ')
2635                 case "$hintfile" in
2636                 ''|' '|none) dflt=none ;;
2637                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
2638                 esac
2639                 ;;
2640         *) dflt="$osname" ;;
2641 esac
2642 rp="Operating system name?"
2643 . ./myread
2644 case "$ans" in
2645 none)  osname='' ;;
2646 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
2647 esac
2648 echo " "
2649 case "$osvers" in
2650         ''|' ')
2651                 case "$hintfile" in
2652                 ''|' '|none) dflt=none ;;
2653                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
2654                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
2655                         case "$dflt" in
2656                         ''|' ') dflt=none ;;
2657                         esac
2658                         ;;
2659                 esac
2660                 ;;
2661         *) dflt="$osvers" ;;
2662 esac
2663 rp="Operating system version?"
2664 . ./myread
2665 case "$ans" in
2666 none)  osvers='' ;;
2667 *) osvers="$ans" ;;
2668 esac
2669
2670
2671 . ./posthint.sh
2672
2673 : who configured the system
2674 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
2675 cf_by=`(logname) 2>/dev/null`
2676 case "$cf_by" in
2677 "")
2678         cf_by=`(whoami) 2>/dev/null`
2679         case "$cf_by" in
2680         "") cf_by=unknown ;;
2681         esac ;;
2682 esac
2683
2684 : set up the script used to warn in case of inconsistency
2685 cat <<EOS >whoa
2686 $startsh
2687 EOS
2688 cat <<'EOSC' >>whoa
2689 dflt=y
2690 echo " "
2691 echo "*** WHOA THERE!!! ***" >&4
2692 echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
2693 rp="    Keep the $hint value?"
2694 . ./myread
2695 case "$ans" in
2696 y) td=$was; tu=$was;;
2697 esac
2698 EOSC
2699
2700 : function used to set $1 to $val
2701 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
2702 case "$val$was" in
2703 $define$undef) . ./whoa; eval "$var=\$td";;
2704 $undef$define) . ./whoa; eval "$var=\$tu";;
2705 *) eval "$var=$val";;
2706 esac'
2707
2708 case "$usethreads" in
2709 $define|true|[yY]*)     dflt='y';;
2710 *) dflt='n';;
2711 esac
2712 cat <<EOM
2713
2714 Perl can be built to take advantage of threads on some systems.
2715 To do so, Configure can be run with -Dusethreads.
2716
2717 Note that threading is a highly experimental feature, and
2718 some known race conditions still remain.  If you choose to try
2719 it, be very sure to not actually deploy it for production
2720 purposes.  README.threads has more details, and is required
2721 reading if you enable threads.
2722
2723 If this doesn't make any sense to you, just accept the default '$dflt'.
2724 EOM
2725 rp='Build a threading Perl?'
2726 . ./myread
2727 case "$ans" in
2728 y|Y)    val="$define" ;;
2729 *)      val="$undef" ;;
2730 esac
2731 set usethreads
2732 eval $setvar
2733
2734 case "$usethreads" in
2735 $define)
2736         $cat <<EOM
2737
2738 As of 5.5.640, Perl has two different internal threading implementations,
2739 the 5.005 version (5005threads) and an interpreter-based version
2740 (ithreads) that has one interpreter per thread.  Both are very 
2741 experimental.  This arrangement exists to help developers work out
2742 which one is better.
2743
2744 If you're a casual user, you probably don't want interpreter-threads
2745 at this time.  There doesn't yet exist a way to create threads from
2746 within Perl in this model, i.e., "use Thread;" will NOT work.
2747 EOM
2748         : Default to ithreads unless overridden on command line or with
2749         : old config.sh
2750         dflt='y'
2751         case "$use5005threads" in
2752                 $define|true|[yY]*) dflt='n';;
2753         esac
2754         case "$useithreads" in
2755                 $undef|false|[nN]*) dflt='n';;
2756         esac
2757         rp='Use interpreter-based ithreads?'
2758         . ./myread
2759         case "$ans" in
2760         y|Y)    val="$define" ;;
2761         *)      val="$undef" ;;
2762         esac
2763         set useithreads
2764         eval $setvar
2765         : Now set use5005threads to the opposite value.
2766         case "$useithreads" in
2767         $define) val="$undef" ;;
2768         *) val="$define" ;;
2769         esac
2770         set use5005threads
2771         eval $setvar
2772         ;;
2773 *)
2774         useithreads="$undef"
2775         use5005threads="$undef"
2776         ;;
2777 esac
2778
2779 case "$d_oldpthreads" in
2780 '')     : Configure tests would be welcome here.  For now, assume undef.
2781         val="$undef" ;;
2782 *)      val="$d_oldpthreads" ;;
2783 esac
2784 set d_oldpthreads
2785 eval $setvar
2786
2787
2788 case "$usethreads" in
2789 "$define"|true|[yY]*)
2790 : Look for a hint-file generated 'call-back-unit'.  If the
2791 : user has specified that a threading perl is to be built,
2792 : we may need to set or change some other defaults.
2793         if $test -f usethreads.cbu; then
2794                 echo "Your platform has some specific hints for threaded builds, using them..."
2795                 . ./usethreads.cbu
2796         else
2797                 $cat <<EOM
2798 (Your platform doesn't have any specific hints for threaded builds.
2799  Assuming POSIX threads, then.)
2800 EOM
2801         fi
2802         ;;
2803 esac
2804
2805 cat <<EOM
2806
2807 Perl can be built so that multiple Perl interpreters can coexist
2808 within the same Perl executable.
2809 EOM
2810
2811 case "$useithreads" in
2812 $define)
2813         cat <<EOM
2814 This multiple interpreter support is required for interpreter-based threads.
2815 EOM
2816         val="$define"
2817         ;;
2818 *)      case "$usemultiplicity" in
2819         $define|true|[yY]*)     dflt='y';;
2820         *) dflt='n';;
2821         esac
2822         echo " "
2823         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
2824         rp='Build Perl for multiplicity?'
2825         . ./myread
2826         case "$ans" in
2827         y|Y)    val="$define" ;;
2828         *)      val="$undef" ;;
2829         esac
2830         ;;
2831 esac
2832 set usemultiplicity
2833 eval $setvar
2834
2835 : determine where manual pages are on this system
2836 echo " "
2837 case "$sysman" in
2838 '') 
2839         syspath='/usr/man/man1 /usr/man/mann /usr/man/manl /usr/man/local/man1'
2840         syspath="$syspath /usr/man/u_man/man1 /usr/share/man/man1"
2841         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
2842         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
2843         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
2844         sysman=`./loc . /usr/man/man1 $syspath`
2845         ;;
2846 esac
2847 if $test -d "$sysman"; then
2848         echo "System manual is in $sysman." >&4
2849 else
2850         echo "Could not find manual pages in source form." >&4
2851 fi
2852
2853 : see what memory models we can support
2854 case "$models" in
2855 '')
2856         $cat >pdp11.c <<'EOP'
2857 int main() {
2858 #ifdef pdp11
2859         exit(0);
2860 #else
2861         exit(1);
2862 #endif
2863 }
2864 EOP
2865         case "$cc" in
2866         '') modelcc="$cc" ;;
2867         *) modelcc="cc" ;;
2868         esac
2869         ( $modelcc -o pdp11 pdp11.c ) >/dev/null 2>&1
2870         if $test -f pdp11 && ./pdp11 2>/dev/null; then
2871                 dflt='unsplit split'
2872         else
2873                 tans=`./loc . X /lib/small /lib/large /usr/lib/small /usr/lib/large /lib/medium /usr/lib/medium /lib/huge`
2874                 case "$tans" in
2875                 X) dflt='none';;
2876                 *) if $test -d /lib/small || $test -d /usr/lib/small; then
2877                                 dflt='small'
2878                         else
2879                                 dflt=''
2880                         fi
2881                         if $test -d /lib/medium || $test -d /usr/lib/medium; then
2882                                 dflt="$dflt medium"
2883                         fi
2884                         if $test -d /lib/large || $test -d /usr/lib/large; then
2885                                 dflt="$dflt large"
2886                         fi
2887                         if $test -d /lib/huge || $test -d /usr/lib/huge; then
2888                                 dflt="$dflt huge"
2889                         fi
2890                 esac
2891         fi;;
2892 *) dflt="$models";;
2893 esac
2894 $cat <<EOM
2895  
2896 Some systems have different model sizes.  On most systems they are called
2897 small, medium, large, and huge.  On the PDP11 they are called unsplit and
2898 split.  If your system doesn't support different memory models, say "none".
2899 If you wish to force everything to one memory model, say "none" here and
2900 put the appropriate flags later when it asks you for other cc and ld flags.
2901 Venix systems may wish to put "none" and let the compiler figure things out.
2902 (In the following question multiple model names should be space separated.)
2903
2904 The default for most systems is "none".
2905
2906 EOM
2907 rp="Which memory models are supported?"
2908 . ./myread
2909 models="$ans"
2910
2911 case "$models" in
2912 none)
2913         small=''
2914         medium=''
2915         large=''
2916         huge=''
2917         unsplit=''
2918         split=''
2919         ;;
2920 *split)
2921         case "$split" in
2922         '') if $contains '\-i' $sysman/ld.1 >/dev/null 2>&1 || \
2923                          $contains '\-i' $sysman/cc.1 >/dev/null 2>&1; then
2924                         dflt='-i'
2925                 else
2926                         dflt='none'
2927                 fi;;
2928         *) dflt="$split";;
2929         esac
2930         rp="What flag indicates separate I and D space?"
2931         . ./myread
2932         tans="$ans"
2933         case "$tans" in
2934         none) tans='';;
2935         esac
2936         split="$tans"
2937         unsplit='';;
2938 *large*|*small*|*medium*|*huge*)
2939         case "$models" in
2940         *large*)
2941                 case "$large" in
2942                 '') dflt='-Ml';;
2943                 *) dflt="$large";;
2944                 esac
2945         rp="What flag indicates large model?"
2946         . ./myread
2947         tans="$ans"
2948         case "$tans" in
2949         none) tans='';
2950         esac
2951         large="$tans";;
2952         *) large='';;
2953         esac
2954         case "$models" in
2955         *huge*) case "$huge" in
2956                 '') dflt='-Mh';;
2957                 *) dflt="$huge";;
2958                 esac
2959                 rp="What flag indicates huge model?"
2960                 . ./myread
2961                 tans="$ans"
2962                 case "$tans" in
2963                 none) tans='';
2964                 esac
2965                 huge="$tans";;
2966         *) huge="$large";;
2967         esac
2968         case "$models" in
2969         *medium*) case "$medium" in
2970                 '') dflt='-Mm';;
2971                 *) dflt="$medium";;
2972                 esac
2973                 rp="What flag indicates medium model?"
2974                 . ./myread
2975                 tans="$ans"
2976                 case "$tans" in
2977                 none) tans='';
2978                 esac
2979                 medium="$tans";;
2980         *) medium="$large";;
2981         esac
2982         case "$models" in
2983         *small*) case "$small" in
2984                 '') dflt='none';;
2985                 *) dflt="$small";;
2986                 esac
2987                 rp="What flag indicates small model?"
2988                 . ./myread
2989                 tans="$ans"
2990                 case "$tans" in
2991                 none) tans='';
2992                 esac
2993                 small="$tans";;
2994         *) small='';;
2995         esac
2996         ;;
2997 *)
2998         echo "Unrecognized memory models--you may have to edit Makefile.SH" >&4
2999         ;;
3000 esac
3001 $rm -f pdp11.* pdp11
3002
3003 : make some quick guesses about what we are up against
3004 echo " "
3005 $echo $n "Hmm...  $c"
3006 echo exit 1 >bsd
3007 echo exit 1 >usg
3008 echo exit 1 >v7
3009 echo exit 1 >osf1
3010 echo exit 1 >eunice
3011 echo exit 1 >xenix
3012 echo exit 1 >venix
3013 echo exit 1 >os2
3014 d_bsd="$undef"
3015 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
3016 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
3017 then
3018         echo "Looks kind of like an OSF/1 system, but we'll see..."
3019         echo exit 0 >osf1
3020 elif test `echo abc | tr a-z A-Z` = Abc ; then
3021         xxx=`./loc addbib blurfl $pth`
3022         if $test -f $xxx; then
3023         echo "Looks kind of like a USG system with BSD features, but we'll see..."
3024                 echo exit 0 >bsd
3025                 echo exit 0 >usg
3026         else
3027                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
3028                         echo "Looks kind of like an extended USG system, but we'll see..."
3029                 else
3030                         echo "Looks kind of like a USG system, but we'll see..."
3031                 fi
3032                 echo exit 0 >usg
3033         fi
3034 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
3035         echo "Looks kind of like a BSD system, but we'll see..."
3036         d_bsd="$define"
3037         echo exit 0 >bsd
3038 else
3039         echo "Looks kind of like a Version 7 system, but we'll see..."
3040         echo exit 0 >v7
3041 fi
3042 case "$eunicefix" in
3043 *unixtovms*)
3044         $cat <<'EOI'
3045 There is, however, a strange, musty smell in the air that reminds me of
3046 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
3047 EOI
3048         echo exit 0 >eunice
3049         d_eunice="$define"
3050 : it so happens the Eunice I know will not run shell scripts in Unix format
3051         ;;
3052 *)
3053         echo " "
3054         echo "Congratulations.  You aren't running Eunice."
3055         d_eunice="$undef"
3056         ;;
3057 esac
3058 : Detect OS2.  The p_ variable is set above in the Head.U unit.
3059 case "$p_" in
3060 :) ;;
3061 *)
3062         $cat <<'EOI'
3063 I have the feeling something is not exactly right, however...don't tell me...
3064 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
3065 EOI
3066         echo exit 0 >os2
3067         ;;
3068 esac
3069 if test -f /xenix; then
3070         echo "Actually, this looks more like a XENIX system..."
3071         echo exit 0 >xenix
3072         d_xenix="$define"
3073 else
3074         echo " "
3075         echo "It's not Xenix..."
3076         d_xenix="$undef"
3077 fi
3078 chmod +x xenix
3079 $eunicefix xenix
3080 if test -f /venix; then
3081         echo "Actually, this looks more like a VENIX system..."
3082         echo exit 0 >venix
3083 else
3084         echo " "
3085         if ./xenix; then
3086                 : null
3087         else
3088                 echo "Nor is it Venix..."
3089         fi
3090 fi
3091 chmod +x bsd usg v7 osf1 eunice xenix venix os2
3092 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
3093 $rm -f foo
3094
3095 : see if we need a special compiler
3096 echo " "
3097 if ./usg; then
3098         case "$cc" in
3099         '') case "$Mcc" in
3100                 /*) dflt='Mcc';;
3101                 *) case "$large" in
3102                         -M*) dflt='cc';;
3103                         *)      if $contains '\-M' $sysman/cc.1 >/dev/null 2>&1 ; then
3104                                         if $contains '\-M' $sysman/cpp.1 >/dev/null 2>&1; then
3105                                                 dflt='cc'
3106                                         else
3107                                                 dflt='cc -M'
3108                                         fi
3109                                 else
3110                                         dflt='cc'
3111                                 fi;;
3112                         esac;;
3113                 esac;;
3114         *)  dflt="$cc";;
3115         esac
3116         case "$dflt" in
3117         *M*)    $cat <<'EOM'
3118 On some older systems the default C compiler will not resolve multiple global
3119 references that happen to have the same name.  On some such systems the "Mcc"
3120 command may be used to force these to be resolved.  On other systems a "cc -M"
3121 command is required.  (Note that the -M flag on other systems indicates a
3122 memory model to use!) If you have the Gnu C compiler, you might wish to use
3123 that instead.
3124
3125 EOM
3126         ;;
3127         esac
3128         rp="Use which C compiler?"
3129         . ./myread
3130         cc="$ans"
3131 else
3132         case "$cc" in
3133         '') dflt=cc;;
3134         *) dflt="$cc";;
3135         esac
3136         rp="Use which C compiler?"
3137         . ./myread
3138         cc="$ans"
3139 fi
3140 : Look for a hint-file generated 'call-back-unit'.  Now that the
3141 : user has specified the compiler, we may need to set or change some
3142 : other defaults.
3143 if $test -f cc.cbu; then
3144     . ./cc.cbu
3145 fi
3146 . ./checkcc
3147
3148 echo " "
3149 echo "Checking for GNU cc in disguise and/or its version number..." >&4
3150 $cat >gccvers.c <<EOM
3151 #include <stdio.h>
3152 int main() {
3153 #ifdef __GNUC__
3154 #ifdef __VERSION__
3155         printf("%s\n", __VERSION__);
3156 #else
3157         printf("%s\n", "1");
3158 #endif
3159 #endif
3160         exit(0);
3161 }
3162 EOM
3163 if $cc $ldflags -o gccvers gccvers.c; then
3164         gccversion=`./gccvers`
3165         case "$gccversion" in
3166         '') echo "You are not using GNU cc." ;;
3167         *)  echo "You are using GNU cc $gccversion."
3168             ;;
3169         esac
3170 else
3171         echo " "
3172         echo "*** WHOA THERE!!! ***" >&4
3173         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
3174         case "$knowitall" in
3175         '')
3176         echo "    You'd better start hunting for one and let me know about it." >&4
3177                 exit 1
3178                 ;;
3179         esac
3180 fi
3181 $rm -f gccvers*
3182 case "$gccversion" in
3183 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
3184 esac
3185 case "$gccversion" in
3186 '') gccosandvers='' ;;
3187 *) gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed 's!.*/[^-]*-[^-]*-\([^/]*\)/'$gccversion'/specs$!\1!'`
3188    case "$gccosandvers" in
3189    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
3190    $osname$osvers) ;; # looking good
3191    $osname*) cat <<EOM >&4
3192
3193 *** WHOA THERE!!! ***
3194
3195     Your gcc has not been compiled for the exact release of
3196     your operating system ($gccosandvers versus $osname$osvers).
3197
3198     In general it is a good idea to keep gcc synchronized with
3199     the operating system because otherwise serious problems
3200     may ensue when trying to compile software, like Perl.
3201
3202     I'm trying to be optimistic here, though, and will continue.
3203     If later during the configuration and build icky compilation
3204     problems appear (headerfile conflicts being the most common
3205     manifestation), I suggest reinstalling the gcc to match
3206     your operating system release.
3207
3208 EOM
3209       ;;
3210    *) gccosandvers='' ;; # failed to parse, better be silent
3211    esac
3212    ;;
3213 esac
3214
3215
3216
3217
3218 : see how we invoke the C preprocessor
3219 echo " "
3220 echo "Now, how can we feed standard input to your C preprocessor..." >&4
3221 cat <<'EOT' >testcpp.c
3222 #define ABC abc
3223 #define XYZ xyz
3224 ABC.XYZ
3225 EOT
3226 cd ..
3227 if test ! -f cppstdin; then
3228         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
3229                 # AIX cc -E doesn't show the absolute headerfile
3230                 # locations but we'll cheat by using the -M flag.
3231                 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
3232         else
3233                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
3234         fi
3235 else
3236         echo "Keeping your $hint cppstdin wrapper."
3237 fi
3238 chmod 755 cppstdin
3239 wrapper=`pwd`/cppstdin
3240 ok='false'
3241 cd UU
3242
3243 if $test "X$cppstdin" != "X" && \
3244         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
3245         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3246 then
3247         echo "You used to use $cppstdin $cppminus so we'll use that again."
3248         case "$cpprun" in
3249         '') echo "But let's see if we can live without a wrapper..." ;;
3250         *)
3251                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
3252                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3253                 then
3254                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
3255                         ok='true'
3256                 else
3257                         echo "(However, $cpprun $cpplast does not work, let's see...)"
3258                 fi
3259                 ;;
3260         esac
3261 else
3262         case "$cppstdin" in
3263         '') ;;
3264         *)
3265                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
3266                 ;;
3267         esac
3268 fi
3269
3270 if $ok; then
3271         : nothing
3272 elif echo 'Maybe "'"$cc"' -E" will work...'; \
3273         $cc -E <testcpp.c >testcpp.out 2>&1; \
3274         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3275         echo "Yup, it does."
3276         x_cpp="$cc -E"
3277         x_minus='';
3278 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
3279         $cc -E - <testcpp.c >testcpp.out 2>&1; \
3280         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3281         echo "Yup, it does."
3282         x_cpp="$cc -E"
3283         x_minus='-';
3284 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
3285         $cc -P <testcpp.c >testcpp.out 2>&1; \
3286         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3287         echo "Yipee, that works!"
3288         x_cpp="$cc -P"
3289         x_minus='';
3290 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
3291         $cc -P - <testcpp.c >testcpp.out 2>&1; \
3292         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3293         echo "At long last!"
3294         x_cpp="$cc -P"
3295         x_minus='-';
3296 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
3297         $cpp <testcpp.c >testcpp.out 2>&1; \
3298         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3299         echo "It works!"
3300         x_cpp="$cpp"
3301         x_minus='';
3302 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
3303         $cpp - <testcpp.c >testcpp.out 2>&1; \
3304         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3305         echo "Hooray, it works!  I was beginning to wonder."
3306         x_cpp="$cpp"
3307         x_minus='-';
3308 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
3309         $wrapper <testcpp.c >testcpp.out 2>&1; \
3310         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3311         x_cpp="$wrapper"
3312         x_minus=''
3313         echo "Eureka!"
3314 else
3315         dflt=''
3316         rp="No dice.  I can't find a C preprocessor.  Name one:"
3317         . ./myread
3318         x_cpp="$ans"
3319         x_minus=''
3320         $x_cpp <testcpp.c >testcpp.out 2>&1
3321         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3322                 echo "OK, that will do." >&4
3323         else
3324 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
3325                 exit 1
3326         fi
3327 fi
3328
3329 case "$ok" in
3330 false)
3331         cppstdin="$x_cpp"
3332         cppminus="$x_minus"
3333         cpprun="$x_cpp"
3334         cpplast="$x_minus"
3335         set X $x_cpp
3336         shift
3337         case "$1" in
3338         "$cpp")
3339                 echo "Perhaps can we force $cc -E using a wrapper..."
3340                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
3341                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3342                 then
3343                         echo "Yup, we can."
3344                         cppstdin="$wrapper"
3345                         cppminus='';
3346                 else
3347                         echo "Nope, we'll have to live without it..."
3348                 fi
3349                 ;;
3350         esac
3351         case "$cpprun" in
3352         "$wrapper")
3353                 cpprun=''
3354                 cpplast=''
3355                 ;;
3356         esac
3357         ;;
3358 esac
3359
3360 case "$cppstdin" in
3361 "$wrapper"|'cppstdin') ;;
3362 *) $rm -f $wrapper;;
3363 esac
3364 $rm -f testcpp.c testcpp.out
3365
3366 : decide how portable to be.  Allow command line overrides.
3367 case "$d_portable" in
3368 "$undef") ;;
3369 *)      d_portable="$define" ;;
3370 esac
3371
3372 : set up shell script to do ~ expansion
3373 cat >filexp <<EOSS
3374 $startsh
3375 : expand filename
3376 case "\$1" in
3377  ~/*|~)
3378         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3379         ;;
3380  ~*)
3381         if $test -f /bin/csh; then
3382                 /bin/csh -f -c "glob \$1"
3383                 failed=\$?
3384                 echo ""
3385                 exit \$failed
3386         else
3387                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3388                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3389                 if $test ! -d "\$dir"; then
3390                         me=\`basename \$0\`
3391                         echo "\$me: can't locate home directory for: \$name" >&2
3392                         exit 1
3393                 fi
3394                 case "\$1" in
3395                 */*)
3396                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3397                         ;;
3398                 *)
3399                         echo \$dir
3400                         ;;
3401                 esac
3402         fi
3403         ;;
3404 *)
3405         echo \$1
3406         ;;
3407 esac
3408 EOSS
3409 chmod +x filexp
3410 $eunicefix filexp
3411
3412 : now set up to get a file name
3413 cat <<EOS >getfile
3414 $startsh
3415 EOS
3416 cat <<'EOSC' >>getfile
3417 tilde=''
3418 fullpath=''
3419 already=''
3420 skip=''
3421 none_ok=''
3422 exp_file=''
3423 nopath_ok=''
3424 orig_rp="$rp"
3425 orig_dflt="$dflt"
3426 case "$gfpth" in
3427 '') gfpth='.' ;;
3428 esac
3429
3430 case "$fn" in
3431 *\(*)
3432         expr $fn : '.*(\(.*\)).*' | tr ',' $trnl >getfile.ok
3433         fn=`echo $fn | sed 's/(.*)//'`
3434         ;;
3435 esac
3436
3437 case "$fn" in
3438 *:*)
3439         loc_file=`expr $fn : '.*:\(.*\)'`
3440         fn=`expr $fn : '\(.*\):.*'`
3441         ;;
3442 esac
3443
3444 case "$fn" in
3445 *~*) tilde=true;;
3446 esac
3447 case "$fn" in
3448 */*) fullpath=true;;
3449 esac
3450 case "$fn" in
3451 *+*) skip=true;;
3452 esac
3453 case "$fn" in
3454 *n*) none_ok=true;;
3455 esac
3456 case "$fn" in
3457 *e*) exp_file=true;;
3458 esac
3459 case "$fn" in
3460 *p*) nopath_ok=true;;
3461 esac
3462
3463 case "$fn" in
3464 *f*) type='File';;
3465 *d*) type='Directory';;
3466 *l*) type='Locate';;
3467 esac
3468
3469 what="$type"
3470 case "$what" in
3471 Locate) what='File';;
3472 esac
3473
3474 case "$exp_file" in
3475 '')
3476         case "$d_portable" in
3477         "$define") ;;
3478         *) exp_file=true;;
3479         esac
3480         ;;
3481 esac
3482
3483 cd ..
3484 while test "$type"; do
3485         redo=''
3486         rp="$orig_rp"
3487         dflt="$orig_dflt"
3488         case "$tilde" in
3489         true) rp="$rp (~name ok)";;
3490         esac
3491         . UU/myread
3492         if test -f UU/getfile.ok && \
3493                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3494         then
3495                 value="$ans"
3496                 ansexp="$ans"
3497                 break
3498         fi
3499         case "$ans" in
3500         none)
3501                 value=''
3502                 ansexp=''
3503                 case "$none_ok" in
3504                 true) type='';;
3505                 esac
3506                 ;;
3507         *)
3508                 case "$tilde" in
3509                 '') value="$ans"
3510                         ansexp="$ans";;
3511                 *)
3512                         value=`UU/filexp $ans`
3513                         case $? in
3514                         0)
3515                                 if test "$ans" != "$value"; then
3516                                         echo "(That expands to $value on this system.)"
3517                                 fi
3518                                 ;;
3519                         *) value="$ans";;
3520                         esac
3521                         ansexp="$value"
3522                         case "$exp_file" in
3523                         '') value="$ans";;
3524                         esac
3525                         ;;
3526                 esac
3527                 case "$fullpath" in
3528                 true)
3529                         case "$ansexp" in
3530                         /*) value="$ansexp" ;;
3531                         [a-zA-Z]:/*) value="$ansexp" ;;
3532                         *)
3533                                 redo=true
3534                                 case "$already" in
3535                                 true)
3536                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
3537                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
3538                                         ;;
3539                                 *)
3540                                 echo "Please give a full path name, starting with slash." >&4
3541                                         case "$tilde" in
3542                                         true)
3543                                 echo "Note that using ~name is ok provided it expands well." >&4
3544                                                 already=true
3545                                                 ;;
3546                                         esac
3547                                 esac
3548                                 ;;
3549                         esac
3550                         ;;
3551                 esac
3552                 case "$redo" in
3553                 '')
3554                         case "$type" in
3555                         File)
3556                                 for fp in $gfpth; do
3557                                         if test "X$fp" = X.; then
3558                                             pf="$ansexp"
3559                                         else    
3560                                             pf="$fp/$ansexp"
3561                                         fi
3562                                         if test -f "$pf"; then
3563                                                 type=''
3564                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3565                                         then
3566                                                 echo "($value is not a plain file, but that's ok.)"
3567                                                 type=''
3568                                         fi
3569                                         if test X"$type" = X; then
3570                                             value="$pf"
3571                                             break
3572                                         fi
3573                                 done
3574                                 ;;
3575                         Directory)
3576                                 for fp in $gfpth; do
3577                                         if test "X$fp" = X.; then
3578                                             dir="$ans"
3579                                             direxp="$ansexp"
3580                                         else    
3581                                             dir="$fp/$ansexp"
3582                                             direxp="$fp/$ansexp"
3583                                         fi
3584                                         if test -d "$direxp"; then
3585                                                 type=''
3586                                                 value="$dir"
3587                                                 break
3588                                         fi
3589                                 done
3590                                 ;;
3591                         Locate)
3592                                 if test -d "$ansexp"; then
3593                                         echo "(Looking for $loc_file in directory $value.)"
3594                                         value="$value/$loc_file"
3595                                         ansexp="$ansexp/$loc_file"
3596                                 fi
3597                                 if test -f "$ansexp"; then
3598                                         type=''
3599                                 fi
3600                                 case "$nopath_ok" in
3601                                 true)   case "$value" in
3602                                         */*) ;;
3603                                         *)      echo "Assuming $value will be in people's path."
3604                                                 type=''
3605                                                 ;;
3606                                         esac
3607                                         ;;
3608                                 esac
3609                                 ;;
3610                         esac
3611
3612                         case "$skip" in
3613                         true) type='';
3614                         esac
3615
3616                         case "$type" in
3617                         '') ;;
3618                         *)
3619                                 if test "$fastread" = yes; then
3620                                         dflt=y
3621                                 else
3622                                         dflt=n
3623                                 fi
3624                                 rp="$what $value doesn't exist.  Use that name anyway?"
3625                                 . UU/myread
3626                                 dflt=''
3627                                 case "$ans" in
3628                                 y*) type='';;
3629                                 *) echo " ";;
3630                                 esac
3631                                 ;;
3632                         esac
3633                         ;;
3634                 esac
3635                 ;;
3636         esac
3637 done
3638 cd UU
3639 ans="$value"
3640 rp="$orig_rp"
3641 dflt="$orig_dflt"
3642 rm -f getfile.ok
3643 test "X$gfpthkeep" != Xy && gfpth=""
3644 EOSC
3645
3646 : What should the include directory be ?
3647 echo " "
3648 $echo $n "Hmm...  $c"
3649 dflt='/usr/include'
3650 incpath=''
3651 mips_type=''
3652 if $test -f /bin/mips && /bin/mips; then
3653         echo "Looks like a MIPS system..."
3654         $cat >usr.c <<'EOCP'
3655 #ifdef SYSTYPE_BSD43
3656 /bsd43
3657 #endif
3658 EOCP
3659         if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
3660                 dflt='/bsd43/usr/include'
3661                 incpath='/bsd43'
3662                 mips_type='BSD 4.3'
3663         else
3664                 mips_type='System V'
3665         fi
3666         $rm -f usr.c usr.out
3667         echo "and you're compiling with the $mips_type compiler and libraries."
3668         xxx_prompt=y
3669         echo "exit 0" >mips
3670 else
3671         echo "Doesn't look like a MIPS system."
3672         xxx_prompt=n
3673         echo "exit 1" >mips
3674 fi
3675 chmod +x mips
3676 $eunicefix mips
3677 case "$usrinc" in
3678 '') ;;
3679 *) dflt="$usrinc";;
3680 esac
3681 case "$xxx_prompt" in
3682 y)      fn=d/
3683         echo " "
3684         rp='Where are the include files you want to use?'
3685         . ./getfile
3686         usrinc="$ans"
3687         ;;
3688 *)      usrinc="$dflt"
3689         ;;
3690 esac
3691
3692 : Set private lib path
3693 case "$plibpth" in
3694 '') if ./mips; then
3695                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
3696         fi;;
3697 esac
3698 case "$libpth" in
3699 ' ') dlist='';;
3700 '') dlist="$loclibpth $plibpth $glibpth";;
3701 *) dlist="$libpth";;
3702 esac
3703
3704 : Now check and see which directories actually exist, avoiding duplicates
3705 libpth=''
3706 for xxx in $dlist
3707 do
3708     if $test -d $xxx; then
3709                 case " $libpth " in
3710                 *" $xxx "*) ;;
3711                 *) libpth="$libpth $xxx";;
3712                 esac
3713     fi
3714 done
3715 $cat <<'EOM'
3716
3717 Some systems have incompatible or broken versions of libraries.  Among
3718 the directories listed in the question below, please remove any you
3719 know not to be holding relevant libraries, and add any that are needed.
3720 Say "none" for none.
3721
3722 EOM
3723 case "$libpth" in
3724 '') dflt='none';;
3725 *)
3726         set X $libpth
3727         shift
3728         dflt=${1+"$@"}
3729         ;;
3730 esac
3731 rp="Directories to use for library searches?"
3732 . ./myread
3733 case "$ans" in
3734 none) libpth=' ';;
3735 *) libpth="$ans";;
3736 esac
3737
3738 : compute shared library extension
3739 case "$so" in
3740 '')
3741         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
3742                 dflt='sl'
3743         else
3744                 dflt='so'
3745         fi
3746         ;;
3747 *) dflt="$so";;
3748 esac
3749 $cat <<EOM
3750
3751 On some systems, shared libraries may be available.  Answer 'none' if
3752 you want to suppress searching of shared libraries for the remainder
3753 of this configuration.
3754
3755 EOM
3756 rp='What is the file extension used for shared libraries?'
3757 . ./myread
3758 so="$ans"
3759
3760 : Define several unixisms.
3761 : Hints files or command line option can be used to override them.
3762 : The convoluted testing is in case hints files set either the old
3763 : or the new name.
3764 case "$_exe" in
3765 '')     case "$exe_ext" in
3766     '') ;;
3767         *)      _exe="$exe_ext" ;;
3768         esac
3769         ;;
3770 esac
3771 case "$_a" in
3772 '')     case "$lib_ext" in
3773     '') _a='.a';;
3774         *)      _a="$lib_ext" ;;
3775         esac
3776         ;;
3777 esac
3778 case "$_o" in
3779 '') case "$obj_ext" in
3780         '')     _o='.o';;
3781         *)      _o="$obj_ext";;
3782         esac
3783         ;;
3784 esac
3785 case "$p_" in
3786 '') case "$path_sep" in
3787         '')     p_=':';;
3788         *)      p_="$path_sep";;
3789         esac
3790         ;;
3791 esac
3792 exe_ext=$_exe
3793 lib_ext=$_a
3794 obj_ext=$_o
3795 path_sep=$p_
3796
3797 : Which makefile gets called first.  This is used by make depend.
3798 case "$firstmakefile" in
3799 '') firstmakefile='makefile';;
3800 esac
3801
3802 case "$usesocks" in
3803 $define|true|[yY]*)     dflt='y';;
3804 *) dflt='n';;
3805 esac
3806 cat <<EOM
3807
3808 Perl can be built to use the SOCKS proxy protocol library.  To do so,
3809 Configure must be run with -Dusesocks.
3810
3811 If this doesn't make any sense to you, just accept the default '$dflt'.
3812 EOM
3813 rp='Build Perl for SOCKS?'
3814 . ./myread
3815 case "$ans" in
3816 y|Y)    val="$define" ;;     
3817 *)      val="$undef" ;;
3818 esac
3819 set usesocks
3820 eval $setvar
3821
3822 : Looking for optional libraries
3823 echo " "
3824 echo "Checking for optional libraries..." >&4
3825 case "$libs" in
3826 ' '|'') dflt='';;
3827 *) dflt="$libs";;
3828 esac
3829 case "$libswanted" in
3830 '') libswanted='c_s';;
3831 esac
3832 case "$usesocks" in
3833 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
3834 esac
3835 libsfound=''
3836 libsfiles=''
3837 libsdirs=''
3838 libspath=''
3839 for thisdir in $libpth $xlibpth; do
3840   test -d $thisdir && libspath="$libspath $thisdir"
3841 done
3842 for thislib in $libswanted; do
3843         for thisdir in $libspath; do
3844             xxx=''
3845             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
3846                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|tail -1`
3847                 $test -f "$xxx" && eval $libscheck
3848                 $test -f "$xxx" && libstyle=shared
3849             fi
3850             if test ! -f "$xxx"; then
3851                 xxx=$thisdir/lib$thislib.$so
3852                 $test -f "$xxx" && eval $libscheck
3853                 $test -f "$xxx" && libstyle=shared
3854             fi  
3855             if test ! -f "$xxx"; then
3856                 xxx=$thisdir/lib$thislib$_a
3857                 $test -f "$xxx" && eval $libscheck
3858                 $test -f "$xxx" && libstyle=static
3859             fi
3860             if test ! -f "$xxx"; then
3861                 xxx=$thisdir/$thislib$_a
3862                 $test -f "$xxx" && eval $libscheck
3863                 $test -f "$xxx" && libstyle=static
3864             fi
3865             if test ! -f "$xxx"; then
3866                 xxx=$thisdir/lib${thislib}_s$_a
3867                 $test -f "$xxx" && eval $libscheck
3868                 $test -f "$xxx" && libstyle=static
3869                 $test -f "$xxx" && thislib=${thislib}_s
3870             fi
3871             if test ! -f "$xxx"; then
3872                 xxx=$thisdir/Slib$thislib$_a
3873                 $test -f "$xxx" && eval $libscheck
3874                 $test -f "$xxx" && libstyle=static
3875             fi
3876             if $test -f "$xxx"; then
3877                 case "$libstyle" in
3878                 shared) echo "Found -l$thislib (shared)." ;;
3879                 static) echo "Found -l$thislib." ;;
3880                 *)      echo "Found -l$thislib ($libstyle)." ;;
3881                 esac
3882                 case " $dflt " in
3883                 *"-l$thislib "*);;
3884                 *) dflt="$dflt -l$thislib"
3885                    libsfound="$libsfound $xxx"
3886                    yyy=`basename $xxx`
3887                    libsfiles="$libsfiles $yyy"
3888                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
3889                    case " $libsdirs " in
3890                    *" $yyy "*) ;;
3891                    *) libsdirs="$libsdirs $yyy" ;;
3892                    esac
3893                    ;;
3894                 esac
3895                 break
3896             fi  
3897         done
3898         if $test ! -f "$xxx"; then
3899             echo "No -l$thislib."
3900         fi
3901 done
3902 set X $dflt
3903 shift
3904 dflt="$*"
3905 case "$libs" in
3906 '') dflt="$dflt";;
3907 *) dflt="$libs";;
3908 esac
3909 case "$dflt" in
3910 ' '|'') dflt='none';;
3911 esac
3912
3913 $cat <<EOM
3914
3915 In order to compile $package on your machine, a number of libraries
3916 are usually needed.  Include any other special libraries here as well.
3917 Say "none" for none.  The default list is almost always right.
3918 EOM
3919
3920 echo " "
3921 rp="What libraries to use?"
3922 . ./myread
3923 case "$ans" in
3924 none) libs=' ';;
3925 *) libs="$ans";;
3926 esac
3927
3928 : determine optimization, if desired, or use for debug flag also
3929 case "$optimize" in
3930 ' '|$undef) dflt='none';;
3931 '') dflt='-O';;
3932 *) dflt="$optimize";;
3933 esac
3934 $cat <<EOH
3935
3936 By default, $package compiles with the -O flag to use the optimizer.
3937 Alternately, you might want to use the symbolic debugger, which uses
3938 the -g flag (on traditional Unix systems).  Either flag can be
3939 specified here.  To use neither flag, specify the word "none".
3940
3941 EOH
3942 rp="What optimizer/debugger flag should be used?"
3943 . ./myread
3944 optimize="$ans"
3945 case "$optimize" in
3946 'none') optimize=" ";;
3947 esac
3948
3949 dflt=''
3950 : We will not override a previous value, but we might want to
3951 : augment a hint file
3952 case "$hint" in
3953 default|recommended)
3954         case "$gccversion" in
3955         1*) dflt='-fpcc-struct-return' ;;
3956         esac
3957         case "$optimize" in
3958         *-g*) dflt="$dflt -DDEBUGGING";;
3959         esac
3960         case "$gccversion" in
3961         2*) if test -d /etc/conf/kconfig.d &&
3962                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
3963                 then
3964                         dflt="$dflt -posix"
3965                 fi
3966                 ;;
3967         esac
3968         case "$gccversion" in
3969         1*) ;;
3970         2.[0-8]*) ;;
3971         ?*)     echo " "
3972                 echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
3973                 echo 'int main(void) { return 0; }' > gcctest.c
3974                 if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
3975                         echo "Yes, it does." 2>&1
3976                         case "$ccflags" in
3977                         *strict-aliasing*) 
3978                                 echo "Leaving current flags $ccflags alone." 2>&1
3979                                 ;;
3980                         *) dflt="$dflt -fno-strict-aliasing" ;;
3981                         esac
3982                 else
3983                         echo "Nope, it doesn't, but that's ok." 2>&1
3984                 fi
3985                 ;;
3986         esac
3987         ;;
3988 esac
3989
3990 case "$mips_type" in
3991 *BSD*|'') inclwanted="$locincpth $usrinc";;
3992 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
3993 esac
3994 for thisincl in $inclwanted; do
3995         if $test -d $thisincl; then
3996                 if $test x$thisincl != x$usrinc; then
3997                         case "$dflt" in
3998                         *$thisincl*);;
3999                         *) dflt="$dflt -I$thisincl";;
4000                         esac
4001                 fi
4002         fi
4003 done
4004
4005 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
4006         xxx=true;
4007 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
4008         xxx=true;
4009 else
4010         xxx=false;
4011 fi;
4012 if $xxx; then
4013         case "$dflt" in
4014         *$2*);;
4015         *) dflt="$dflt -D$2";;
4016         esac;
4017 fi'
4018
4019 set signal.h LANGUAGE_C; eval $inctest
4020
4021 case "$usesocks" in
4022 $define)
4023         ccflags="$ccflags -DSOCKS"
4024         ;;
4025 esac
4026
4027 case "$hint" in
4028 default|recommended) dflt="$ccflags $dflt" ;;
4029 *) dflt="$ccflags";;
4030 esac
4031
4032 case "$dflt" in
4033 ''|' ') dflt=none;;
4034 esac
4035 $cat <<EOH
4036
4037 Your C compiler may want other flags.  For this question you should include
4038 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
4039 but you should NOT include libraries or ld flags like -lwhatever.  If you
4040 want $package to honor its debug switch, you should include -DDEBUGGING here.
4041 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
4042
4043 To use no flags, specify the word "none".
4044
4045 EOH
4046 set X $dflt
4047 shift
4048 dflt=${1+"$@"}
4049 rp="Any additional cc flags?"
4050 . ./myread
4051 case "$ans" in
4052 none) ccflags='';;
4053 *) ccflags="$ans";;
4054 esac
4055
4056 : the following weeds options from ccflags that are of no interest to cpp
4057 cppflags="$ccflags"
4058 case "$gccversion" in
4059 1*) cppflags="$cppflags -D__GNUC__"
4060 esac
4061 case "$mips_type" in
4062 '');;
4063 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
4064 esac
4065 case "$cppflags" in
4066 '');;
4067 *)
4068         echo " "
4069         echo "Let me guess what the preprocessor flags are..." >&4
4070         set X $cppflags
4071         shift
4072         cppflags=''
4073         $cat >cpp.c <<'EOM'
4074 #define BLURFL foo
4075
4076 BLURFL xx LFRULB
4077 EOM
4078         previous=''
4079         for flag in $*
4080         do
4081                 case "$flag" in
4082                 -*) ftry="$flag";;
4083                 *) ftry="$previous $flag";;
4084                 esac
4085                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
4086                         >cpp1.out 2>/dev/null && \
4087                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
4088                         >cpp2.out 2>/dev/null && \
4089                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
4090                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
4091                 then
4092                         cppflags="$cppflags $ftry"
4093                         previous=''
4094                 else
4095                         previous="$flag"
4096                 fi
4097         done
4098         set X $cppflags
4099         shift
4100         cppflags=${1+"$@"}
4101         case "$cppflags" in
4102         *-*)  echo "They appear to be: $cppflags";;
4103         esac
4104         $rm -f cpp.c cpp?.out
4105         ;;
4106 esac
4107
4108 : flags used in final linking phase
4109 case "$ldflags" in
4110 '') if ./venix; then
4111                 dflt='-i -z'
4112         else
4113                 dflt=''
4114         fi
4115         case "$ccflags" in
4116         *-posix*) dflt="$dflt -posix" ;;
4117         esac
4118         ;;
4119 *) dflt="$ldflags";;
4120 esac
4121
4122 : Try to guess additional flags to pick up local libraries.
4123 for thislibdir in $libpth; do
4124         case " $loclibpth " in
4125         *" $thislibdir "*)
4126                 case "$dflt " in 
4127                 *"-L$thislibdir "*) ;;
4128                 *)  dflt="$dflt -L$thislibdir" ;;
4129                 esac
4130                 ;;
4131         esac
4132 done
4133
4134 case "$dflt" in
4135 '') dflt='none' ;;
4136 esac
4137
4138 $cat <<EOH
4139
4140 Your C linker may need flags.  For this question you should
4141 include -L/whatever and any other flags used by the C linker, but you
4142 should NOT include libraries like -lwhatever.
4143
4144 Make sure you include the appropriate -L/path flags if your C linker
4145 does not normally search all of the directories you specified above,
4146 namely
4147         $libpth
4148 To use no flags, specify the word "none".
4149
4150 EOH
4151
4152 rp="Any additional ld flags (NOT including libraries)?"
4153 . ./myread
4154 case "$ans" in
4155 none) ldflags='';;
4156 *) ldflags="$ans";;
4157 esac
4158 rmlist="$rmlist pdp11"
4159
4160 : coherency check
4161 echo " "
4162 echo "Checking your choice of C compiler and flags for coherency..." >&4
4163 $cat > try.c <<'EOF'
4164 #include <stdio.h>
4165 int main() { printf("Ok\n"); exit(0); }
4166 EOF
4167 set X $cc $optimize $ccflags -o try $ldflags try.c $libs
4168 shift
4169 $cat >try.msg <<'EOM'
4170 I've tried to compile and run the following simple program:
4171
4172 EOM
4173 $cat try.c >> try.msg
4174
4175 $cat >> try.msg <<EOM
4176
4177 I used the command:
4178
4179         $*
4180         ./try
4181
4182 and I got the following output:
4183
4184 EOM
4185 dflt=y
4186 if sh -c "$cc $optimize $ccflags -o try $ldflags try.c $libs" >>try.msg 2>&1; then
4187         if sh -c './try' >>try.msg 2>&1; then
4188                 xxx=`./try`
4189                 case "$xxx" in
4190                 "Ok") dflt=n ;;
4191                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
4192                         case " $libs " in
4193                         *" -lsfio "*)
4194                                 cat >> try.msg <<'EOQS'
4195 If $libs contains -lsfio, and sfio is mis-configured, then it
4196 sometimes (apparently) runs and exits with a 0 status, but with no
4197 output!  It may have to do with sfio's use of _exit vs. exit.
4198
4199 EOQS
4200                                 rp="You have a big problem.  Shall I abort Configure"
4201                                 dflt=y
4202                                 ;;
4203                         esac
4204                         ;;
4205                 esac
4206         else
4207                 echo "The program compiled OK, but exited with status $?." >>try.msg
4208                 rp="You have a problem.  Shall I abort Configure"
4209                 dflt=y
4210         fi
4211 else
4212         echo "I can't compile the test program." >>try.msg
4213         rp="You have a BIG problem.  Shall I abort Configure"
4214         dflt=y
4215 fi
4216 case "$dflt" in
4217 y)
4218         $cat try.msg >&4
4219         case "$knowitall" in
4220         '')
4221                 echo "(The supplied flags or libraries might be incorrect.)"
4222                 ;;
4223         *) dflt=n;;
4224         esac
4225         echo " "
4226         . ./myread
4227         case "$ans" in
4228         n*|N*) ;;
4229         *)      echo "Ok.  Stopping Configure." >&4
4230                 exit 1
4231                 ;;
4232         esac
4233         ;;
4234 n) echo "OK, that should do.";;
4235 esac
4236 $rm -f try try.* core
4237
4238 : define an is-a-typedef? function
4239 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
4240 case "$inclist" in
4241 "") inclist="sys/types.h";;
4242 esac;
4243 eval "varval=\$$var";
4244 case "$varval" in
4245 "")
4246         $rm -f temp.c;
4247         for inc in $inclist; do
4248                 echo "#include <$inc>" >>temp.c;
4249         done;
4250         echo "#ifdef $type" >> temp.c;
4251         echo "printf(\"We have $type\");" >> temp.c;
4252         echo "#endif" >> temp.c;
4253         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
4254         if $contains $type temp.E >/dev/null 2>&1; then
4255                 eval "$var=\$type";
4256         else
4257                 eval "$var=\$def";
4258         fi;
4259         $rm -f temp.?;;
4260 *) eval "$var=\$varval";;
4261 esac'
4262
4263 : define an is-a-typedef? function that prompts if the type is not available.
4264 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
4265 case "$inclist" in
4266 "") inclist="sys/types.h";;
4267 esac;
4268 eval "varval=\$$var";
4269 case "$varval" in
4270 "")
4271         $rm -f temp.c;
4272         for inc in $inclist; do
4273                 echo "#include <$inc>" >>temp.c;
4274         done;
4275         echo "#ifdef $type" >> temp.c;
4276         echo "printf(\"We have $type\");" >> temp.c;
4277         echo "#endif" >> temp.c;
4278         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
4279         echo " " ;
4280         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
4281         if $contains $type temp.E >/dev/null 2>&1; then
4282                 echo "$type found." >&4;
4283                 eval "$var=\$type";
4284         else
4285                 echo "$type NOT found." >&4;
4286                 dflt="$def";
4287                 . ./myread ;
4288                 eval "$var=\$ans";
4289         fi;
4290         $rm -f temp.?;;
4291 *) eval "$var=\$varval";;
4292 esac'
4293
4294 : define a shorthand compile call
4295 compile='
4296 mc_file=$1;
4297 shift;
4298 $cc $optimize $ccflags $ldflags -o ${mc_file} $* ${mc_file}.c $libs > /dev/null 2>&1;'
4299 : define a shorthand compile call for compilations that should be ok.
4300 compile_ok='
4301 mc_file=$1;
4302 shift;
4303 $cc $optimize $ccflags $ldflags -o ${mc_file} $* ${mc_file}.c $libs;'
4304
4305 : check for lengths of integral types
4306 echo " "
4307 case "$intsize" in
4308 '')
4309         echo "Checking to see how big your integers are..." >&4
4310         $cat >intsize.c <<'EOCP'
4311 #include <stdio.h>
4312 int main()
4313 {
4314         printf("intsize=%d;\n", (int)sizeof(int));
4315         printf("longsize=%d;\n", (int)sizeof(long));
4316         printf("shortsize=%d;\n", (int)sizeof(short));
4317         exit(0);
4318 }
4319 EOCP
4320         set intsize
4321         if eval $compile_ok && ./intsize > /dev/null; then
4322                 eval `./intsize`
4323                 echo "Your integers are $intsize bytes long."
4324                 echo "Your long integers are $longsize bytes long."
4325                 echo "Your short integers are $shortsize bytes long."
4326         else
4327                 $cat >&4 <<EOM
4328 !
4329 Help! I can't compile and run the intsize test program: please enlighten me!
4330 (This is probably a misconfiguration in your system or libraries, and
4331 you really ought to fix it.  Still, I'll try anyway.)
4332 !
4333 EOM
4334                 dflt=4
4335                 rp="What is the size of an integer (in bytes)?"
4336                 . ./myread
4337                 intsize="$ans"
4338                 dflt=$intsize
4339                 rp="What is the size of a long integer (in bytes)?"
4340                 . ./myread
4341                 longsize="$ans"
4342                 dflt=2
4343                 rp="What is the size of a short integer (in bytes)?"
4344                 . ./myread
4345                 shortsize="$ans"
4346         fi
4347         ;;
4348 esac
4349 $rm -f intsize intsize.*
4350
4351 : see what type lseek is declared as in the kernel
4352 rp="What is the type used for lseek's offset on this system?"
4353 set off_t lseektype long stdio.h sys/types.h
4354 eval $typedef_ask
4355
4356 echo " "
4357 echo "Checking to see how big your file offsets are..." >&4
4358 $cat >try.c <<EOCP
4359 #include <sys/types.h>
4360 #include <stdio.h>
4361 int main()
4362 {
4363     printf("%d\n", (int)sizeof($lseektype));
4364     return(0); 
4365 }
4366 EOCP
4367 set try
4368 if eval $compile_ok; then
4369         lseeksize=`./try`
4370         echo "Your file offsets are $lseeksize bytes long."
4371 else
4372         dflt=$longsize
4373         echo " "
4374         echo "(I can't seem to compile the test program.  Guessing...)"
4375         rp="What is the size of your file offsets (in bytes)?"
4376         . ./myread
4377         lseeksize="$ans"
4378 fi
4379 $rm -f try.c try
4380
4381 : see what type file positions are declared as in the library
4382 rp="What is the type for file position used by fsetpos()?"
4383 set fpos_t fpostype long stdio.h sys/types.h
4384 eval $typedef_ask
4385
4386 echo " "
4387 case "$fpostype" in
4388 *_t) zzz="$fpostype"    ;;
4389 *)   zzz="fpos_t"       ;;
4390 esac
4391 echo "Checking the size of $zzz..." >&4 
4392 cat > try.c <<EOCP
4393 #include <sys/types.h>
4394 #include <stdio.h>
4395 int main() {
4396     printf("%d\n", (int)sizeof($fpostype));
4397     exit(0);
4398 }
4399 EOCP
4400 set try
4401 if eval $compile_ok; then
4402         yyy=`./try`
4403         case "$yyy" in
4404         '')     fpossize=4
4405                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
4406                 ;;
4407         *)      fpossize=$yyy
4408                 echo "Your $zzz is $fpossize bytes long."
4409                 ;;
4410         esac
4411 else
4412         dflt="$longsize"
4413         echo " " >&4
4414         echo "(I can't compile the test program.  Guessing...)" >&4
4415         rp="What is the size of your file positions (in bytes)?"
4416         . ./myread
4417         fpossize="$ans"
4418 fi
4419
4420
4421
4422 # Backward compatibility (uselfs is deprecated).
4423 case "$uselfs" in
4424 "$define"|true|[yY]*)
4425         cat <<EOM >&4
4426
4427 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
4428 EOM
4429         uselargefiles="$define"
4430         ;;
4431 esac                          
4432
4433 case "$lseeksize:$fpossize" in
4434 8:8) cat <<EOM
4435
4436 You can have files larger than 2 gigabytes.
4437 EOM
4438    val="$define" ;;
4439 *)    case "$uselargefiles" in
4440    "$undef"|false|[nN]*) dflt='n' ;;
4441    *)   dflt='y' ;;
4442    esac
4443    cat <<EOM
4444
4445 Perl can be built to understand large files (files larger than 2 gigabytes)
4446 on some systems.  To do so, Configure can be run with -Duselargefiles.
4447
4448 If this doesn't make any sense to you, just accept the default '$dflt'.
4449 EOM
4450    rp='Try to understand large files, if available?'
4451    . ./myread
4452    case "$ans" in
4453    y|Y)         val="$define" ;;
4454    *)           val="$undef"  ;;
4455    esac
4456    ;;
4457 esac
4458 set uselargefiles
4459 eval $setvar
4460 case "$uselargefiles" in
4461 "$define")
4462 : Look for a hint-file generated 'call-back-unit'.  If the
4463 : user has specified that a large files perl is to be built,
4464 : we may need to set or change some other defaults.
4465         if $test -f uselargefiles.cbu; then
4466                 echo "Your platform has some specific hints for large file builds, using them..."
4467                 . ./uselargefiles.cbu
4468                 echo " "
4469                 echo "Rechecking to see how big your file offsets are..." >&4
4470                 $cat >try.c <<EOCP
4471 #include <sys/types.h>
4472 #include <stdio.h>
4473 int main()
4474 {
4475     printf("%d\n", (int)sizeof($lseektype));
4476     return(0); 
4477 }
4478 EOCP
4479                 set try
4480                 if eval $compile_ok; then
4481                         lseeksize=`./try`
4482                         $echo "Your file offsets are now $lseeksize bytes long."
4483                 else
4484                         dflt="$lseeksize"
4485                         echo " "
4486                         echo "(I can't seem to compile the test program.  Guessing...)"
4487                         rp="What is the size of your file offsets (in bytes)?"
4488                         . ./myread
4489                         lseeksize="$ans"
4490                 fi
4491                 case "$fpostype" in
4492                 *_t) zzz="$fpostype"    ;;
4493                 *)   zzz="fpos_t"       ;;
4494                 esac
4495                 $echo $n "Rechecking the size of $zzz...$c" >&4 
4496                 $cat > try.c <<EOCP
4497 #include <sys/types.h>
4498 #include <stdio.h>
4499 int main() {
4500     printf("%d\n", (int)sizeof($fpostype));
4501     exit(0);
4502 }
4503 EOCP
4504                 set try
4505                 if eval $compile_ok; then
4506                         yyy=`./try`
4507                         dflt="$lseeksize"
4508                         case "$yyy" in
4509                         '')     echo " "
4510                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
4511                                 ;;
4512                         *)      fpossize=$yyy
4513                                 echo " $fpossize bytes." >&4
4514                                 ;;
4515                         esac
4516                 else
4517                         dflt="$fpossize"
4518                         echo " "
4519                         echo "(I can't compile the test program.  Guessing...)" >&4
4520                         rp="What is the size of your file positions (in bytes)?"
4521                         . ./myread
4522                         fpossize="$ans"
4523                 fi
4524                 $rm -f try.c try
4525         fi
4526         ;;
4527 esac
4528
4529
4530 case "$usemorebits" in
4531 "$define"|true|[yY]*)
4532         use64bitint="$define"
4533         uselongdouble="$define"
4534         usemorebits="$define"
4535         ;;
4536 *)      usemorebits="$undef"
4537         ;;
4538 esac
4539
4540
4541 case "$uselonglong" in
4542 "$define"|true|[yY]*)
4543         cat <<EOM >&4
4544
4545 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
4546 EOM
4547         use64bitint="$define"
4548         ;;
4549 esac                          
4550 case "$use64bits" in
4551 "$define"|true|[yY]*)
4552         cat <<EOM >&4
4553
4554 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
4555 EOM
4556         use64bitint="$define"
4557         ;;
4558 esac                          
4559 case "$use64bitints" in
4560 "$define"|true|[yY]*)
4561         cat <<EOM >&4
4562
4563 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
4564 EOM
4565         use64bitint="$define"
4566         ;;
4567 esac                          
4568 case "$use64bitsint" in
4569 "$define"|true|[yY]*)
4570         cat <<EOM >&4
4571
4572 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
4573 EOM
4574         use64bitint="$define"
4575         ;;
4576 esac                          
4577 case "$uselonglongs" in
4578 "$define"|true|[yY]*)
4579         cat <<EOM >&4
4580
4581 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
4582 EOM
4583         use64bitint="$define"
4584         ;;
4585 esac                          
4586 case "$use64bitsall" in
4587 "$define"|true|[yY]*)
4588         cat <<EOM >&4
4589
4590 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
4591 EOM
4592         use64bitall="$define"
4593         ;;
4594 esac                          
4595
4596 case "$ccflags" in
4597 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
4598 esac
4599 case "$use64bitall" in
4600 "$define"|true|[yY]*) use64bitint="$define" ;;
4601 esac
4602
4603 case "$longsize" in
4604 8) cat <<EOM
4605
4606 You have natively 64-bit long integers.
4607 EOM
4608    val="$define"
4609    ;;
4610 *) case "$use64bitint" in
4611    "$define"|true|[yY]*) dflt='y';;
4612    *) dflt='n';;
4613    esac
4614    cat <<EOM
4615
4616 Perl can be built to take advantage of 64-bit integer types
4617 on some systems.  To do so, Configure can be run with -Duse64bitint.
4618 Choosing this option will most probably introduce binary incompatibilities.
4619
4620 If this doesn't make any sense to you, just accept the default '$dflt'.
4621 EOM
4622    rp='Try to use 64-bit integers, if available?'
4623    . ./myread
4624    case "$ans" in
4625    [yY]*) val="$define" ;;
4626    *)     val="$undef"  ;;
4627    esac
4628    ;;
4629 esac
4630 set use64bitint
4631 eval $setvar
4632
4633 case "$use64bitall" in
4634 "$define"|true|[yY]*) dflt='y' ;;
4635 *) case "$longsize" in
4636    8) dflt='y' ;;
4637    *) dflt='n' ;;
4638    esac
4639    ;;
4640 esac    
4641 cat <<EOM
4642
4643 You may also choose to try maximal 64-bitness.  It means using as much
4644 64-bitness as possible on the platform.  This in turn means even more
4645 binary incompatibilities.  On the other hand, your platform may not
4646 have any more 64-bitness available than what you already have chosen.
4647
4648 If this doesn't make any sense to you, just accept the default '$dflt'.
4649 EOM
4650 rp='Try to use maximal 64-bit support, if available?'
4651 . ./myread
4652 case "$ans" in
4653 [yY]*) val="$define" ;;
4654 *)     val="$undef"  ;;
4655 esac
4656 set use64bitall
4657 eval $setvar
4658 case "$use64bitall" in
4659 "$define")
4660         case "$use64bitint" in
4661         "$undef")
4662                 cat <<EOM
4663
4664 Since you have chosen a maximally 64-bit build, I'm also turning on
4665 the use of 64-bit integers.
4666 EOM
4667                 use64bitint="$define" ;;
4668         esac
4669         ;;
4670 esac
4671
4672 case "$use64bitint" in
4673 "$define"|true|[yY]*)
4674 : Look for a hint-file generated 'call-back-unit'.  If the
4675 : user has specified that a 64-bit perl is to be built,
4676 : we may need to set or change some other defaults.
4677         if $test -f use64bitint.cbu; then
4678                 echo "Your platform has some specific hints for 64-bit integers, using them..."
4679                 . ./use64bitint.cbu
4680         fi
4681         case "$longsize" in
4682         4) case "$archname64" in
4683            '') archname64=64int ;;
4684            esac
4685            ;;
4686         esac
4687         ;;
4688 esac
4689
4690 case "$use64bitall" in
4691 "$define"|true|[yY]*)
4692 : Look for a hint-file generated 'call-back-unit'.  If the
4693 : user has specified that a maximally 64-bit perl is to be built,
4694 : we may need to set or change some other defaults.
4695         if $test -f use64bitall.cbu; then
4696                 echo "Your platform has some specific hints for 64-bit builds, using them..."
4697                 . ./use64bitall.cbu
4698         fi
4699         case "$longsize" in
4700         4) case "$archname64" in
4701            ''|64int) archname64=64all ;;
4702            esac
4703            ;;
4704         esac
4705         ;;
4706 esac
4707
4708 : determine the architecture name
4709 echo " "
4710 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
4711         tarch=`arch`"-$osname"
4712 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
4713         if uname -m > tmparch 2>&1 ; then
4714                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
4715                         -e 's/$/'"-$osname/" tmparch`
4716         else
4717                 tarch="$osname"
4718         fi
4719         $rm -f tmparch
4720 else
4721         tarch="$osname"
4722 fi
4723 case "$myarchname" in
4724 ''|"$tarch") ;;
4725 *)
4726         echo "(Your architecture name used to be $myarchname.)"
4727         archname=''
4728         ;;
4729 esac
4730 myarchname="$tarch"
4731 case "$archname" in
4732 '') dflt="$tarch";;
4733 *) dflt="$archname";;
4734 esac
4735 rp='What is your architecture name'
4736 . ./myread
4737 archname="$ans"
4738 case "$usethreads" in
4739 $define)
4740         echo "Threads selected." >&4
4741         case "$archname" in
4742         *-thread*) echo "...and architecture name already has -thread." >&4
4743                 ;;
4744         *)      archname="$archname-thread"
4745                 echo "...setting architecture name to $archname." >&4
4746                 ;;
4747         esac
4748         ;;
4749 esac
4750 case "$usemultiplicity" in
4751 $define)
4752         echo "Multiplicity selected." >&4
4753         case "$archname" in
4754         *-multi*) echo "...and architecture name already has -multi." >&4
4755                 ;;
4756         *)      archname="$archname-multi"
4757                 echo "...setting architecture name to $archname." >&4
4758                 ;;
4759         esac
4760         ;;
4761 esac
4762 case "$use64bitint" in
4763 $define)
4764         case "$archname64" in
4765         '')
4766                 ;;
4767         *)
4768                 case "$archname" in
4769                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
4770                         ;;
4771                 *)      archname="$archname-$archname64"
4772                         echo "...setting architecture name to $archname." >&4
4773                         ;;
4774                 esac
4775                 ;;
4776         esac
4777 esac
4778
4779 : determine root of directory hierarchy where package will be installed.
4780 case "$prefix" in
4781 '')
4782         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
4783         ;;
4784 *)
4785         dflt="$prefix"
4786         ;;
4787 esac
4788 $cat <<EOM
4789
4790 By default, $package will be installed in $dflt/bin, manual pages
4791 under $dflt/man, etc..., i.e. with $dflt as prefix for all
4792 installation directories. Typically this is something like /usr/local.
4793 If you wish to have binaries under /usr/bin but other parts of the
4794 installation under /usr/local, that's ok: you will be prompted
4795 separately for each of the installation directories, the prefix being
4796 only used to set the defaults.
4797
4798 EOM
4799 fn=d~
4800 rp='Installation prefix to use?'
4801 . ./getfile
4802 oldprefix=''
4803 case "$prefix" in
4804 '') ;;
4805 *)
4806         case "$ans" in
4807         "$prefix") ;;
4808         *) oldprefix="$prefix";;
4809         esac
4810         ;;
4811 esac
4812 prefix="$ans"
4813 prefixexp="$ansexp"
4814
4815 : is AFS running?
4816 echo " "
4817 case "$afs" in
4818 $define|true)   afs=true ;;
4819 $undef|false)   afs=false ;;
4820 *)      if test -d /afs; then
4821                 afs=true
4822         else
4823                 afs=false
4824         fi
4825         ;;
4826 esac
4827 if $afs; then
4828         echo "AFS may be running... I'll be extra cautious then..." >&4
4829 else
4830         echo "AFS does not seem to be running..." >&4
4831 fi
4832
4833 : determine installation prefix for where package is to be installed.
4834 if $afs; then 
4835 $cat <<EOM
4836
4837 Since you are running AFS, I need to distinguish the directory in which
4838 files will reside from the directory in which they are installed (and from
4839 which they are presumably copied to the former directory by occult means).
4840
4841 EOM
4842         case "$installprefix" in
4843         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
4844         *) dflt="$installprefix";;
4845         esac
4846 else
4847 $cat <<EOM
4848
4849 In some special cases, particularly when building $package for distribution,
4850 it is convenient to distinguish between the directory in which files should 
4851 be installed from the directory ($prefix) in which they 
4852 will eventually reside.  For most users, these two directories are the same.
4853
4854 EOM
4855         case "$installprefix" in
4856         '') dflt=$prefix ;;
4857         *) dflt=$installprefix;;
4858         esac
4859 fi
4860 fn=d~
4861 rp='What installation prefix should I use for installing files?'
4862 . ./getfile
4863 installprefix="$ans"
4864 installprefixexp="$ansexp"
4865
4866 : set the prefixit variable, to compute a suitable default value
4867 prefixit='case "$3" in
4868 ""|none)
4869         case "$oldprefix" in
4870         "") eval "$1=\"\$$2\"";;
4871         *)
4872                 case "$3" in
4873                 "") eval "$1=";;
4874                 none)
4875                         eval "tp=\"\$$2\"";
4876                         case "$tp" in
4877                         ""|" ") eval "$1=\"\$$2\"";;
4878                         *) eval "$1=";;
4879                         esac;;
4880                 esac;;
4881         esac;;
4882 *)
4883         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
4884         case "$tp" in
4885         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
4886         /*-$oldprefix/*|\~*-$oldprefix/*)
4887                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
4888         *) eval "$1=\"\$$2\"";;
4889         esac;;
4890 esac'
4891
4892
4893 : get the patchlevel
4894 echo " "
4895 echo "Getting the current patchlevel..." >&4
4896 if $test -r $rsrc/patchlevel.h;then
4897         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
4898         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
4899         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4900         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
4901         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
4902         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4903 else
4904         revision=0
4905         patchlevel=0
4906         subversion=0
4907         api_revision=0
4908         api_version=0
4909         api_subversion=0
4910 fi
4911 $echo $n "(You have $package revision $revision" $c
4912 $echo $n " patchlevel $patchlevel" $c
4913 test 0 -eq "$subversion" || $echo $n " subversion $subversion" $c
4914 echo ".)"
4915 case "$osname" in
4916 dos|vms)
4917         : XXX Should be a Configure test for double-dots in filenames.
4918         version=`echo $revision $patchlevel $subversion | \
4919                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4920         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4921                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4922         ;;
4923 *)
4924         version=`echo $revision $patchlevel $subversion | \
4925                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4926         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4927                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4928         ;;
4929 esac
4930 : Special case the 5.005_xx maintenance series, which used 5.005
4931 : without any subversion label as a subdirectory in $sitelib
4932 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
4933         api_versionstring='5.005'
4934 fi
4935
4936 : determine installation style
4937 : For now, try to deduce it from prefix unless it is already set.
4938 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
4939 case "$installstyle" in
4940 '')     case "$prefix" in
4941                 *perl*) dflt='lib';;
4942                 *) dflt='lib/perl5' ;;
4943         esac
4944         ;;
4945 *)      dflt="$installstyle" ;;
4946 esac
4947 : Probably not worth prompting for this since we prompt for all
4948 : the directories individually, and the prompt would be too long and
4949 : confusing anyway.
4950 installstyle=$dflt
4951
4952 : determine where private library files go
4953 : Usual default is /usr/local/lib/perl5/$version.
4954 : Also allow things like /opt/perl/lib/$version, since 
4955 : /opt/perl/lib/perl5... would be redundant.
4956 : The default "style" setting is made in installstyle.U
4957 case "$installstyle" in
4958 *lib/perl5*) set dflt privlib lib/$package/$version ;;
4959 *)       set dflt privlib lib/$version ;;
4960 esac
4961 eval $prefixit
4962 $cat <<EOM
4963
4964 There are some auxiliary files for $package that need to be put into a
4965 private library directory that is accessible by everyone.
4966
4967 EOM
4968 fn=d~+
4969 rp='Pathname where the private library files will reside?'
4970 . ./getfile
4971 privlib="$ans"
4972 privlibexp="$ansexp"
4973 : Change installation prefix, if necessary.
4974 if $test X"$prefix" != X"$installprefix"; then
4975         installprivlib=`echo $privlibexp | sed "s#^$prefix#$installprefix#"`
4976 else
4977         installprivlib="$privlibexp"
4978 fi
4979
4980 : set the prefixup variable, to restore leading tilda escape
4981 prefixup='case "$prefixexp" in
4982 "$prefix") ;;
4983 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
4984 esac'
4985
4986 : determine where public architecture dependent libraries go
4987 set archlib archlib
4988 eval $prefixit
4989 : privlib default is /usr/local/lib/$package/$version
4990 : archlib default is /usr/local/lib/$package/$version/$archname
4991 : privlib may have an optional trailing /share.
4992 tdflt=`echo $privlib | $sed 's,/share$,,'`
4993 tdflt=$tdflt/$archname
4994 case "$archlib" in
4995 '')     dflt=$tdflt
4996         ;;
4997 *)      dflt="$archlib"
4998     ;;
4999 esac
5000 $cat <<EOM
5001
5002 $spackage contains architecture-dependent library files.  If you are
5003 sharing libraries in a heterogeneous environment, you might store
5004 these files in a separate location.  Otherwise, you can just include
5005 them with the rest of the public library files.
5006
5007 EOM
5008 fn=d+~
5009 rp='Where do you want to put the public architecture-dependent libraries?'
5010 . ./getfile
5011 archlib="$ans"
5012 archlibexp="$ansexp"
5013 if $test X"$archlib" = X"$privlib"; then
5014         d_archlib="$undef"
5015 else
5016         d_archlib="$define"
5017 fi
5018 : Change installation prefix, if necessary.
5019 if $test X"$prefix" != X"$installprefix"; then
5020         installarchlib=`echo $archlibexp | sed "s#^$prefix#$installprefix#"`
5021 else
5022         installarchlib="$archlibexp"
5023 fi
5024
5025
5026 : Binary compatibility with 5.005 is not possible for builds
5027 : with advanced features
5028 case "$usethreads$usemultiplicity" in
5029 *define*)
5030         bincompat5005="$undef"
5031         d_bincompat5005="$undef"
5032         ;;
5033 *)      $cat <<EOM
5034
5035 This version of Perl can be compiled for binary compatibility with 5.005.
5036 If you decide to do so, you will be able to continue using most of the
5037 extensions that were compiled for Perl 5.005.
5038
5039 EOM
5040         case "$bincompat5005$d_bincompat5005" in
5041         *"$undef"*) dflt=n ;;
5042         *) dflt=y ;;
5043         esac
5044         rp='Binary compatibility with Perl 5.005?'
5045         . ./myread
5046         case "$ans" in
5047         y*) val="$define" ;;
5048         *)  val="$undef" ;;
5049         esac
5050         set d_bincompat5005
5051         eval $setvar
5052         case "$d_bincompat5005" in
5053         "$define")
5054                 bincompat5005="$define"
5055                 ;;
5056         *)      bincompat5005="$undef"
5057                 d_bincompat5005="$undef"
5058                 ;;
5059         esac
5060         ;;
5061 esac
5062
5063
5064 : see if setuid scripts can be secure
5065 $cat <<EOM
5066
5067 Some kernels have a bug that prevents setuid #! scripts from being
5068 secure.  Some sites have disabled setuid #! scripts because of this.
5069
5070 First let's decide if your kernel supports secure setuid #! scripts.
5071 (If setuid #! scripts would be secure but have been disabled anyway,
5072 don't say that they are secure if asked.)
5073
5074 EOM
5075
5076 val="$undef"
5077 if $test -d /dev/fd; then
5078         echo "#!$ls" >reflect
5079         chmod +x,u+s reflect
5080         ./reflect >flect 2>&1
5081         if $contains "/dev/fd" flect >/dev/null; then
5082                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
5083                 val="$define"
5084         else
5085                 $cat <<EOM
5086 If you are not sure if they are secure, I can check but I'll need a
5087 username and password different from the one you are using right now.
5088 If you don't have such a username or don't want me to test, simply
5089 enter 'none'.
5090
5091 EOM
5092                 rp='Other username to test security of setuid scripts with?'
5093                 dflt='none'
5094                 . ./myread
5095                 case "$ans" in
5096                 n|none)
5097                         case "$d_suidsafe" in
5098                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
5099                                 dflt=n;;
5100                         "$undef")
5101                                 echo "Well, the $hint value is *not* secure." >&4
5102                                 dflt=n;;
5103                         *)      echo "Well, the $hint value *is* secure." >&4
5104                                 dflt=y;;
5105                         esac
5106                         ;;
5107                 *)
5108                         $rm -f reflect flect
5109                         echo "#!$ls" >reflect
5110                         chmod +x,u+s reflect
5111                         echo >flect
5112                         chmod a+w flect
5113                         echo '"su" will (probably) prompt you for '"$ans's password."
5114                         su $ans -c './reflect >flect'
5115                         if $contains "/dev/fd" flect >/dev/null; then
5116                                 echo "Okay, it looks like setuid scripts are secure." >&4
5117                                 dflt=y
5118                         else
5119                                 echo "I don't think setuid scripts are secure." >&4
5120                                 dflt=n
5121                         fi
5122                         ;;
5123                 esac
5124                 rp='Does your kernel have *secure* setuid scripts?'
5125                 . ./myread
5126                 case "$ans" in
5127                 [yY]*)  val="$define";;
5128                 *)      val="$undef";;
5129                 esac
5130         fi
5131 else
5132         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
5133         echo "(That's for file descriptors, not floppy disks.)"
5134         val="$undef"
5135 fi
5136 set d_suidsafe
5137 eval $setvar
5138
5139 $rm -f reflect flect
5140
5141 : now see if they want to do setuid emulation
5142 echo " "
5143 val="$undef"
5144 case "$d_suidsafe" in
5145 "$define")
5146         val="$undef"
5147         echo "No need to emulate SUID scripts since they are secure here." >& 4
5148         ;;
5149 *)
5150         $cat <<EOM
5151 Some systems have disabled setuid scripts, especially systems where
5152 setuid scripts cannot be secure.  On systems where setuid scripts have
5153 been disabled, the setuid/setgid bits on scripts are currently
5154 useless.  It is possible for $package to detect those bits and emulate
5155 setuid/setgid in a secure fashion.  This emulation will only work if
5156 setuid scripts have been disabled in your kernel.
5157
5158 EOM
5159         case "$d_dosuid" in
5160         "$define") dflt=y ;;
5161         *) dflt=n ;;
5162         esac
5163         rp="Do you want to do setuid/setgid emulation?"
5164         . ./myread
5165         case "$ans" in
5166         [yY]*)  val="$define";;
5167         *)      val="$undef";;
5168         esac
5169         ;;
5170 esac
5171 set d_dosuid
5172 eval $setvar
5173
5174 : determine filename position in cpp output
5175 echo " "
5176 echo "Computing filename position in cpp output for #include directives..." >&4
5177 echo '#include <stdio.h>' > foo.c
5178 $cat >fieldn <<EOF
5179 $startsh
5180 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5181 $grep '^[       ]*#.*stdio\.h' | \
5182 while read cline; do
5183         pos=1
5184         set \$cline
5185         while $test \$# -gt 0; do
5186                 if $test -r \`echo \$1 | $tr -d '"'\`; then
5187                         echo "\$pos"
5188                         exit 0
5189                 fi
5190                 shift
5191                 pos=\`expr \$pos + 1\`
5192         done
5193 done
5194 EOF
5195 chmod +x fieldn
5196 fieldn=`./fieldn`
5197 $rm -f foo.c fieldn
5198 case $fieldn in
5199 '') pos='???';;
5200 1) pos=first;;
5201 2) pos=second;;
5202 3) pos=third;;
5203 *) pos="${fieldn}th";;
5204 esac
5205 echo "Your cpp writes the filename in the $pos field of the line."
5206
5207 : locate header file
5208 $cat >findhdr <<EOF
5209 $startsh
5210 wanted=\$1
5211 name=''
5212 for usrincdir in $usrinc
5213 do
5214         if test -f \$usrincdir/\$wanted; then
5215                 echo "\$usrincdir/\$wanted"
5216                 exit 0
5217         fi
5218 done
5219 awkprg='{ print \$$fieldn }'
5220 echo "#include <\$wanted>" > foo\$\$.c
5221 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5222 $grep "^[       ]*#.*\$wanted" | \
5223 while read cline; do
5224         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5225         case "\$name" in
5226         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5227         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5228         *) exit 2;;
5229         esac;
5230 done;
5231 #
5232 # status = 0: grep returned 0 lines, case statement not executed
5233 # status = 1: headerfile found
5234 # status = 2: while loop executed, no headerfile found
5235 #
5236 status=\$?
5237 $rm -f foo\$\$.c;
5238 if test \$status -eq 1; then
5239         exit 0;
5240 fi
5241 exit 1
5242 EOF
5243 chmod +x findhdr
5244
5245 : define an alternate in-header-list? function
5246 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5247 cont=true; xxf="echo \"<\$1> found.\" >&4";
5248 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5249 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5250 esac;
5251 case $# in 4) instead=instead;; *) instead="at last";; esac;
5252 while $test "$cont"; do
5253         xxx=`./findhdr $1`
5254         var=$2; eval "was=\$$2";
5255         if $test "$xxx" && $test -r "$xxx";
5256         then eval $xxf;
5257         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5258                 cont="";
5259         else eval $xxnf;
5260         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5261         set $yyy; shift; shift; yyy=$@;
5262         case $# in 0) cont="";;
5263         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5264                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5265         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5266                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5267         esac;
5268 done;
5269 while $test "$yyy";
5270 do set $yyy; var=$2; eval "was=\$$2";
5271         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5272         set $yyy; shift; shift; yyy=$@;
5273 done'
5274
5275 : see if this is a malloc.h system
5276 set malloc.h i_malloc
5277 eval $inhdr
5278
5279 : see if stdlib is available
5280 set stdlib.h i_stdlib
5281 eval $inhdr
5282
5283 : determine which malloc to compile in
5284 echo " "
5285 case "$usemymalloc" in
5286 ''|[yY]*|true|$define)  dflt='y' ;;
5287 *)      dflt='n' ;;
5288 esac
5289 rp="Do you wish to attempt to use the malloc that comes with $package?"
5290 . ./myread
5291 usemymalloc="$ans"
5292 case "$ans" in
5293 y*|true)
5294         usemymalloc='y'
5295         mallocsrc='malloc.c'
5296         mallocobj="malloc$_o"
5297         d_mymalloc="$define"
5298         case "$libs" in
5299         *-lmalloc*)
5300                 : Remove malloc from list of libraries to use
5301                 echo "Removing unneeded -lmalloc from library list" >&4
5302                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
5303                 shift
5304                 libs="$*"
5305                 echo "libs = $libs" >&4
5306                 ;;
5307         esac
5308         ;;
5309 *)
5310         usemymalloc='n'
5311         mallocsrc=''
5312         mallocobj=''
5313         d_mymalloc="$undef"
5314         ;;
5315 esac
5316
5317 : compute the return types of malloc and free
5318 echo " "
5319 $cat >malloc.c <<END
5320 #$i_malloc I_MALLOC
5321 #$i_stdlib I_STDLIB
5322 #include <stdio.h>
5323 #include <sys/types.h>
5324 #ifdef I_MALLOC
5325 #include <malloc.h>
5326 #endif
5327 #ifdef I_STDLIB
5328 #include <stdlib.h>
5329 #endif
5330 #ifdef TRY_MALLOC
5331 void *malloc();
5332 #endif
5333 #ifdef TRY_FREE
5334 void free();
5335 #endif
5336 END
5337 case "$malloctype" in
5338 '')
5339         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
5340                 malloctype='void *'
5341         else
5342                 malloctype='char *'
5343         fi
5344         ;;
5345 esac
5346 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
5347
5348 case "$freetype" in
5349 '')
5350         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
5351                 freetype='void'
5352         else
5353                 freetype='int'
5354         fi
5355         ;;
5356 esac
5357 echo "Your system uses $freetype free(), it would seem." >&4
5358 $rm -f malloc.[co]
5359 $cat <<EOM
5360
5361 After $package is installed, you may wish to install various
5362 add-on modules and utilities.  Typically, these add-ons will
5363 be installed under $prefix with the rest
5364 of this package.  However, you may wish to install such add-ons
5365 elsewhere under a different prefix.
5366
5367 If you do not wish to put everything under a single prefix, that's
5368 ok.  You will be prompted for the individual locations; this siteprefix
5369 is only used to suggest the defaults.
5370
5371 The default should be fine for most people.
5372
5373 EOM
5374 fn=d~+
5375 rp='Installation prefix to use for add-on modules and utilities?'
5376 : XXX Here might be another good place for an installstyle setting.
5377 case "$siteprefix" in
5378 '') dflt=$prefix ;;
5379 *)  dflt=$siteprefix ;;
5380 esac
5381 . ./getfile
5382 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
5383 oldsiteprefix=''
5384 case "$siteprefix" in
5385 '') ;;
5386 *)      case "$ans" in
5387         "$prefix") ;;
5388         *) oldsiteprefix="$prefix";;
5389         esac
5390         ;;
5391 esac
5392 siteprefix="$ans"
5393 siteprefixexp="$ansexp"
5394
5395 : determine where site specific libraries go.
5396 : Usual default is /usr/local/lib/perl5/site_perl/$version
5397 : The default "style" setting is made in installstyle.U
5398 : XXX No longer works with Prefixit stuff.
5399 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
5400 case "$sitelib" in
5401 '') case "$installstyle" in
5402         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
5403         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
5404         esac
5405         ;;
5406 *)      dflt="$sitelib"
5407         ;;
5408 esac
5409 $cat <<EOM
5410
5411 The installation process will create a directory for
5412 site-specific extensions and modules.  Most users find it convenient
5413 to place all site-specific files in this directory rather than in the
5414 main distribution directory.
5415
5416 EOM
5417 fn=d~+
5418 rp='Pathname for the site-specific library files?'
5419 . ./getfile
5420 sitelib="$ans"
5421 sitelibexp="$ansexp"
5422 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
5423 : Change installation prefix, if necessary.
5424 if $test X"$prefix" != X"$installprefix"; then
5425         installsitelib=`echo $sitelibexp | $sed "s#^$prefix#$installprefix#"`
5426 else
5427         installsitelib="$sitelibexp"
5428 fi
5429
5430 : determine where site specific architecture-dependent libraries go.
5431 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
5432 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
5433 : sitelib may have an optional trailing /share.
5434 case "$sitearch" in
5435 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
5436         dflt="$dflt/$archname"
5437         ;;
5438 *)      dflt="$sitearch"
5439         ;;
5440 esac
5441 set sitearch sitearch none
5442 eval $prefixit
5443 $cat <<EOM
5444
5445 The installation process will also create a directory for
5446 architecture-dependent site-specific extensions and modules.
5447
5448 EOM
5449 fn=d~+
5450 rp='Pathname for the site-specific architecture-dependent library files?'
5451 . ./getfile
5452 sitearch="$ans"
5453 sitearchexp="$ansexp"
5454 : Change installation prefix, if necessary.
5455 if $test X"$prefix" != X"$installprefix"; then
5456         installsitearch=`echo $sitearchexp | sed "s#^$prefix#$installprefix#"`
5457 else
5458         installsitearch="$sitearchexp"
5459 fi
5460
5461 $cat <<EOM
5462
5463 The installation process will also create a directory for
5464 vendor-supplied add-ons.  Vendors who supply perl with their system
5465 may find it convenient to place all vendor-supplied files in this
5466 directory rather than in the main distribution directory.  This will
5467 ease upgrades between binary-compatible maintenance versions of perl.
5468
5469 Of course you may also use these directories in whatever way you see
5470 fit.  For example, you might use them to access modules shared over a
5471 company-wide network.
5472
5473 The default answer should be fine for most people.
5474 This causes further questions about vendor add-ons to be skipped
5475 and no vendor-specific directories will be configured for perl.
5476
5477 EOM
5478 rp='Do you want to configure vendor-specific add-on directories?'
5479 case "$usevendorprefix" in
5480 define|true|[yY]*) dflt=y ;;
5481 *)      : User may have set vendorprefix directly on Configure command line.
5482         case "$vendorprefix" in
5483         ''|' ') dflt=n ;;
5484         *)      dflt=y ;;
5485         esac
5486         ;;
5487 esac
5488 . ./myread
5489 case "$ans" in
5490 [yY]*)  fn=d~+
5491         rp='Installation prefix to use for vendor-supplied add-ons?'
5492         case "$vendorprefix" in
5493         '') dflt='' ;;
5494         *)  dflt=$vendorprefix ;;
5495         esac
5496         . ./getfile
5497         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
5498         oldvendorprefix=''
5499         case "$vendorprefix" in
5500         '') ;;
5501         *)      case "$ans" in
5502                 "$prefix") ;;
5503                 *) oldvendorprefix="$prefix";;
5504                 esac
5505                 ;;
5506         esac
5507         usevendorprefix="$define"
5508         vendorprefix="$ans"
5509         vendorprefixexp="$ansexp"
5510         ;;
5511 *)      usevendorprefix="$undef"
5512         vendorprefix=''
5513         vendorprefixexp=''
5514         ;;
5515 esac
5516
5517 case "$vendorprefix" in
5518 '')     d_vendorlib="$undef"
5519         vendorlib=''
5520         vendorlibexp=''
5521         ;;
5522 *)      d_vendorlib="$define"
5523         : determine where vendor-supplied modules go.
5524         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
5525         case "$vendorlib" in
5526         '')
5527                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
5528                 case "$installstyle" in
5529                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
5530                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
5531                 esac
5532                 ;;
5533         *)      dflt="$vendorlib"
5534                 ;;
5535         esac
5536         fn=d~+
5537         rp='Pathname for the vendor-supplied library files?'
5538         . ./getfile
5539         vendorlib="$ans"
5540         vendorlibexp="$ansexp"
5541         ;;
5542 esac
5543 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
5544 : Change installation prefix, if necessary.
5545 if $test X"$prefix" != X"$installprefix"; then
5546         installvendorlib=`echo $vendorlibexp | $sed "s#^$prefix#$installprefix#"`
5547 else
5548         installvendorlib="$vendorlibexp"
5549 fi
5550
5551 case "$vendorprefix" in
5552 '')     d_vendorarch="$undef"
5553         vendorarch=''
5554         vendorarchexp=''
5555         ;;
5556 *)      d_vendorarch="$define"
5557         : determine where vendor-supplied architecture-dependent libraries go.
5558         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
5559         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
5560         : vendorlib may have an optional trailing /share.
5561         case "$vendorarch" in
5562         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
5563                 dflt="$dflt/$archname"
5564                 ;;
5565         *)      dflt="$vendorarch" ;;
5566         esac
5567         fn=d~+
5568         rp='Pathname for vendor-supplied architecture-dependent files?'
5569         . ./getfile
5570         vendorarch="$ans"
5571         vendorarchexp="$ansexp"
5572         ;;
5573 esac
5574 : Change installation prefix, if necessary.
5575 if $test X"$prefix" != X"$installprefix"; then
5576         installvendorarch=`echo $vendorarchexp | sed "s#^$prefix#$installprefix#"`
5577 else
5578         installvendorarch="$vendorarchexp"
5579 fi
5580
5581 : Final catch-all directories to search
5582 $cat <<EOM
5583
5584 Lastly, you can have perl look in other directories for extensions and
5585 modules in addition to those already specified.
5586 These directories will be searched after 
5587         $sitearch 
5588         $sitelib 
5589 EOM
5590 test X"$vendorlib" != "X" && echo '     ' $vendorlib
5591 test X"$vendorarch" != "X" && echo '    ' $vendorarch
5592 echo ' '
5593 case "$otherlibdirs" in
5594 ''|' ') dflt='none' ;;
5595 *)      dflt="$otherlibdirs" ;;
5596 esac
5597 $cat <<EOM
5598 Enter a colon-separated set of extra paths to include in perl's @INC
5599 search path, or enter 'none' for no extra paths.
5600
5601 EOM
5602
5603 rp='Colon-separated list of additional directories for perl to search?'
5604 . ./myread
5605 case "$ans" in
5606 ' '|''|none)    otherlibdirs=' ' ;;     
5607 *)      otherlibdirs="$ans" ;;
5608 esac
5609 case "$otherlibdirs" in
5610 ' ') val=$undef ;;
5611 *)      val=$define ;;
5612 esac
5613 set d_perl_otherlibdirs
5614 eval $setvar
5615
5616 : Cruising for prototypes
5617 echo " "
5618 echo "Checking out function prototypes..." >&4
5619 $cat >prototype.c <<'EOCP'
5620 int main(int argc, char *argv[]) {
5621         exit(0);}
5622 EOCP
5623 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
5624         echo "Your C compiler appears to support function prototypes."
5625         val="$define"
5626 else
5627         echo "Your C compiler doesn't seem to understand function prototypes."
5628         val="$undef"
5629 fi
5630 set prototype
5631 eval $setvar
5632 $rm -f prototype*
5633
5634 case "$prototype" in
5635 "$define") ;;
5636 *)      ansi2knr='ansi2knr'
5637         echo " "
5638         cat <<EOM >&4
5639
5640 $me:  FATAL ERROR:
5641 This version of $package can only be compiled by a compiler that 
5642 understands function prototypes.  Unfortunately, your C compiler 
5643         $cc $ccflags
5644 doesn't seem to understand them.  Sorry about that.
5645
5646 If GNU cc is available for your system, perhaps you could try that instead.  
5647
5648 Eventually, we hope to support building Perl with pre-ANSI compilers.
5649 If you would like to help in that effort, please contact <perlbug@perl.org>.
5650
5651 Aborting Configure now.
5652 EOM
5653         exit 2
5654         ;;
5655 esac
5656
5657 : determine where public executables go
5658 echo " "
5659 set dflt bin bin
5660 eval $prefixit
5661 fn=d~
5662 rp='Pathname where the public executables will reside?'
5663 . ./getfile
5664 if $test "X$ansexp" != "X$binexp"; then
5665         installbin=''
5666 fi
5667 bin="$ans"
5668 binexp="$ansexp"
5669 : Change installation prefix, if necessary.
5670 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
5671 if $test X"$prefix" != X"$installprefix"; then
5672         installbin=`echo $binexp | sed "s#^$prefix#$installprefix#"`
5673 else
5674         installbin="$binexp"
5675 fi
5676
5677 : Find perl5.005 or later.
5678 echo "Looking for a previously installed perl5.005 or later... "
5679 case "$perl5" in
5680 '')     for tdir in `echo "$binexp:$PATH" | $sed "s/$path_sep/ /g"`; do
5681                 : Check if this perl is recent and can load a simple module
5682                 if $test -x $tdir/perl && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
5683                         perl5=$tdir/perl
5684                         break;
5685                 elif $test -x $tdir/perl5 && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
5686                         perl5=$tdir/perl
5687                         break;
5688                 fi
5689         done
5690         ;;
5691 *)      perl5="$perl5"
5692         ;;
5693 esac
5694 case "$perl5" in
5695 '')     echo "None found.  That's ok.";;
5696 *)      echo "Using $perl5." ;;
5697 esac
5698
5699 : Determine list of previous versions to include in @INC
5700 $cat > getverlist <<EOPL
5701 #!$perl5 -w
5702 use File::Basename;
5703 \$api_versionstring = "$api_versionstring";
5704 \$version = "$version";
5705 \$stem = "$sitelib_stem";
5706 \$archname = "$archname";
5707 EOPL
5708         $cat >> getverlist <<'EOPL'
5709 # Can't have leading @ because metaconfig interprets it as a command!
5710 ;@inc_version_list=();
5711 # XXX Redo to do opendir/readdir? 
5712 if (-d $stem) {
5713     chdir($stem);
5714     ;@candidates = glob("5.*");
5715 }
5716 else {
5717     ;@candidates = ();
5718 }
5719
5720 # XXX ToDo:  These comparisons must be reworked when two-digit
5721 # subversions come along, so that 5.7.10 compares as greater than
5722 # 5.7.3!  By that time, hope that 5.6.x is sufficiently
5723 # widespread that we can use the built-in version vectors rather
5724 # than reinventing them here.  For 5.6.0, however, we must
5725 # assume this script will likely be run by 5.005_0x.  --AD 1/2000.
5726 foreach $d (@candidates) {
5727     if ($d lt $version) {
5728         if ($d ge $api_versionstring) {
5729             unshift(@inc_version_list, grep { -d } "$d/$archname", $d);
5730         }
5731         elsif ($d ge "5.005") {
5732             unshift(@inc_version_list, grep { -d } $d);
5733         }
5734     }
5735     else {
5736         # Skip newer version.  I.e. don't look in
5737         # 5.7.0 if we're installing 5.6.1.
5738     }
5739 }
5740
5741 if (@inc_version_list) {
5742     print join(' ', @inc_version_list);
5743 }
5744 else {
5745     # Blank space to preserve value for next Configure run.
5746     print " ";
5747 }
5748 EOPL
5749 chmod +x getverlist
5750 case "$inc_version_list" in
5751 '')     if test -x "$perl5"; then
5752                 dflt=`$perl5 getverlist`
5753         else
5754                 dflt='none'
5755         fi
5756         ;;
5757 $undef) dflt='none' ;;
5758 *)  dflt="$inc_version_list" ;;
5759 esac
5760 case "$dflt" in
5761 ''|' ') dflt=none ;;
5762 esac
5763 $cat <<'EOM'
5764
5765 In order to ease the process of upgrading, this version of perl 
5766 can be configured to use modules built and installed with earlier 
5767 versions of perl that were installed under $prefix.  Specify here
5768 the list of earlier versions that this version of perl should check.
5769 If Configure detected no earlier versions of perl installed under
5770 $prefix, then the list will be empty.  Answer 'none' to tell perl
5771 to not search earlier versions.
5772
5773 The default should almost always be sensible, so if you're not sure,
5774 just accept the default.
5775 EOM
5776
5777 rp='List of earlier versions to include in @INC?'
5778 . ./myread
5779 case "$ans" in
5780 [Nn]one|''|' ') inc_version_list=' ' ;;
5781 *) inc_version_list="$ans" ;;
5782 esac
5783 case "$inc_version_list" in
5784 ''|' ') 
5785         inc_version_list_init='0';;
5786 *)      inc_version_list_init=`echo $inc_version_list |
5787                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
5788         ;;
5789 esac
5790 $rm -f getverlist
5791
5792 : determine whether to install perl also as /usr/bin/perl
5793
5794 echo " "
5795 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
5796         $cat <<EOM
5797 Many scripts expect perl to be installed as /usr/bin/perl.
5798 I can install the perl you are about to compile also as /usr/bin/perl
5799 (in addition to $installbin/perl).
5800 EOM
5801         case "$installusrbinperl" in
5802         "$undef"|[nN]*) dflt='n';;
5803         *)              dflt='y';;
5804         esac
5805         rp="Do you want to install perl as /usr/bin/perl?"
5806         . ./myread
5807         case "$ans" in
5808         [yY]*)  val="$define";;
5809         *)      val="$undef" ;;
5810         esac
5811 else
5812         val="$undef"
5813 fi
5814 set installusrbinperl
5815 eval $setvar
5816
5817 echo " "
5818 echo "Checking for GNU C Library..." >&4
5819 cat >gnulibc.c <<EOM
5820 #include <stdio.h>
5821 int main()
5822 {
5823 #ifdef __GLIBC__
5824     exit(0);
5825 #else
5826     exit(1);
5827 #endif
5828 }
5829 EOM
5830 set gnulibc
5831 if eval $compile_ok && ./gnulibc; then
5832         val="$define"
5833         echo "You are using the GNU C Library"
5834 else
5835         val="$undef"
5836         echo "You are not using the GNU C Library"
5837 fi
5838 $rm -f gnulibc*
5839 set d_gnulibc
5840 eval $setvar
5841
5842 : see if nm is to be used to determine whether a symbol is defined or not
5843 case "$usenm" in
5844 '')
5845         dflt=''
5846         case "$d_gnulibc" in
5847         "$define")
5848                 echo " "
5849                 echo "nm probably won't work on the GNU C Library." >&4
5850                 dflt=n
5851                 ;;
5852         esac
5853         case "$dflt" in
5854         '') 
5855                 if $test "$osname" = aix -a ! -f /lib/syscalls.exp; then
5856                         echo " "
5857                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
5858                         echo "'nm' won't be sufficient on this sytem." >&4
5859                         dflt=n
5860                 fi
5861                 ;;
5862         esac
5863         case "$dflt" in
5864         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
5865                 if $test $dflt -gt 20; then
5866                         dflt=y
5867                 else
5868                         dflt=n
5869                 fi
5870                 ;;
5871         esac
5872         ;;
5873 *)
5874         case "$usenm" in
5875         true|$define) dflt=y;;
5876         *) dflt=n;;
5877         esac
5878         ;;
5879 esac
5880 $cat <<EOM
5881
5882 I can use $nm to extract the symbols from your C libraries. This
5883 is a time consuming task which may generate huge output on the disk (up
5884 to 3 megabytes) but that should make the symbols extraction faster. The
5885 alternative is to skip the 'nm' extraction part and to compile a small
5886 test program instead to determine whether each symbol is present. If
5887 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
5888 this may be the best solution.
5889
5890 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
5891
5892 EOM
5893 rp="Shall I use $nm to extract C symbols from the libraries?"
5894 . ./myread
5895 case "$ans" in
5896 [Nn]*) usenm=false;;
5897 *) usenm=true;;
5898 esac
5899
5900 runnm=$usenm
5901 case "$reuseval" in
5902 true) runnm=false;;
5903 esac
5904
5905 : nm options which may be necessary
5906 case "$nm_opt" in
5907 '') if $test -f /mach_boot; then
5908                 nm_opt=''       # Mach
5909         elif $test -d /usr/ccs/lib; then
5910                 nm_opt='-p'     # Solaris (and SunOS?)
5911         elif $test -f /dgux; then
5912                 nm_opt='-p'     # DG-UX
5913         elif $test -f /lib64/rld; then
5914                 nm_opt='-p'     # 64-bit Irix
5915         else
5916                 nm_opt=''
5917         fi;;
5918 esac
5919
5920 : nm options which may be necessary for shared libraries but illegal
5921 : for archive libraries.  Thank you, Linux.
5922 case "$nm_so_opt" in
5923 '')     case "$myuname" in
5924         *linux*)
5925                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
5926                         nm_so_opt='--dynamic'
5927                 fi
5928                 ;;
5929         esac
5930         ;;
5931 esac
5932
5933 case "$runnm" in
5934 true)
5935 : get list of predefined functions in a handy place
5936 echo " "
5937 case "$libc" in
5938 '') libc=unknown
5939         case "$libs" in
5940         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
5941         esac
5942         ;;
5943 esac
5944 libnames='';
5945 case "$libs" in
5946 '') ;;
5947 *)  for thislib in $libs; do
5948         case "$thislib" in
5949         -lc|-lc_s)
5950                 : Handle C library specially below.
5951                 ;;
5952         -l*)
5953                 thislib=`echo $thislib | $sed -e 's/^-l//'`
5954                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
5955                         :
5956                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
5957                         :
5958                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
5959                         :
5960                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
5961                         :
5962                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
5963                         :
5964                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
5965                         :
5966                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
5967                         :
5968                 else
5969                         try=''
5970                 fi
5971                 libnames="$libnames $try"
5972                 ;;
5973         *) libnames="$libnames $thislib" ;;
5974         esac
5975         done
5976         ;;
5977 esac
5978 xxx=normal
5979 case "$libc" in
5980 unknown)
5981         set /lib/libc.$so
5982         for xxx in $libpth; do
5983                 $test -r $1 || set $xxx/libc.$so
5984                 : The messy sed command sorts on library version numbers.
5985                 $test -r $1 || \
5986                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
5987                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
5988                                 h
5989                                 s/[0-9][0-9]*/0000&/g
5990                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
5991                                 G
5992                                 s/\n/ /' | \
5993                          sort | $sed -e 's/^.* //'`
5994                 eval set \$$#
5995         done
5996         $test -r $1 || set /usr/ccs/lib/libc.$so
5997         $test -r $1 || set /lib/libsys_s$_a
5998         ;;
5999 *)
6000         set blurfl
6001         ;;
6002 esac
6003 if $test -r "$1"; then
6004         echo "Your (shared) C library seems to be in $1."
6005         libc="$1"
6006 elif $test -r /lib/libc && $test -r /lib/clib; then
6007         echo "Your C library seems to be in both /lib/clib and /lib/libc."
6008         xxx=apollo
6009         libc='/lib/clib /lib/libc'
6010         if $test -r /lib/syslib; then
6011                 echo "(Your math library is in /lib/syslib.)"
6012                 libc="$libc /lib/syslib"
6013         fi
6014 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
6015         echo "Your C library seems to be in $libc, as you said before."
6016 elif $test -r $incpath/usr/lib/libc$_a; then
6017         libc=$incpath/usr/lib/libc$_a;
6018         echo "Your C library seems to be in $libc.  That's fine."
6019 elif $test -r /lib/libc$_a; then
6020         libc=/lib/libc$_a;
6021         echo "Your C library seems to be in $libc.  You're normal."
6022 else
6023         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
6024                 :
6025         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
6026                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
6027         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
6028                 :
6029         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
6030                 :
6031         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
6032                 :
6033         else
6034                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
6035         fi
6036         if $test -r "$tans"; then
6037                 echo "Your C library seems to be in $tans, of all places."
6038                 libc=$tans
6039         else
6040                 libc='blurfl'
6041         fi
6042 fi
6043 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
6044         dflt="$libc"
6045         cat <<EOM
6046
6047 If the guess above is wrong (which it might be if you're using a strange
6048 compiler, or your machine supports multiple models), you can override it here.
6049
6050 EOM
6051 else
6052         dflt=''
6053         echo $libpth | tr ' ' $trnl | sort | uniq > libpath
6054         cat >&4 <<EOM
6055 I can't seem to find your C library.  I've looked in the following places:
6056
6057 EOM
6058         $sed 's/^/      /' libpath
6059         cat <<EOM
6060
6061 None of these seems to contain your C library. I need to get its name...
6062
6063 EOM
6064 fi
6065 fn=f
6066 rp='Where is your C library?'
6067 . ./getfile
6068 libc="$ans"
6069
6070 echo " "
6071 echo $libc $libnames | tr ' ' $trnl | sort | uniq > libnames
6072 set X `cat libnames`
6073 shift
6074 xxx=files
6075 case $# in 1) xxx=file; esac
6076 echo "Extracting names from the following $xxx for later perusal:" >&4
6077 echo " "
6078 $sed 's/^/      /' libnames >&4
6079 echo " "
6080 $echo $n "This may take a while...$c" >&4
6081
6082 for file in $*; do
6083         case $file in
6084         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
6085         *) $nm $nm_opt $file 2>/dev/null;;
6086         esac
6087 done >libc.tmp
6088
6089 $echo $n ".$c"
6090 $grep fprintf libc.tmp > libc.ptf
6091 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
6092 xrun='eval "<libc.tmp $com >libc.list"; echo "done" >&4'
6093 xxx='[ADTSIW]'
6094 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *_[_.]*//p' -e 's/^.* $xxx  *//p'";\
6095         eval $xscan;\
6096         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6097                 eval $xrun
6098 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
6099         eval $xscan;\
6100         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6101                 eval $xrun
6102 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
6103         eval $xscan;\
6104         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6105                 eval $xrun
6106 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
6107         eval $xscan;\
6108         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6109                 eval $xrun
6110 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
6111         eval $xscan;\
6112         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6113                 eval $xrun
6114 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
6115         eval $xscan;\
6116         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6117                 eval $xrun
6118 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
6119                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
6120         eval $xscan;\
6121         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6122                 eval $xrun
6123 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
6124         eval $xscan;\
6125         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6126                 eval $xrun
6127 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
6128         eval $xscan;\
6129         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6130                 eval $xrun
6131 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
6132         eval $xscan;\
6133         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6134                 eval $xrun
6135 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
6136         eval $xscan;\
6137         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6138                 eval $xrun
6139 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
6140         eval $xscan;\
6141         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6142                 eval $xrun
6143 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
6144         eval $xscan;\
6145         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6146                 eval $xrun
6147 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
6148         eval $xscan;\
6149         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6150                 eval $xrun
6151 else
6152         $nm -p $* 2>/dev/null >libc.tmp
6153         $grep fprintf libc.tmp > libc.ptf
6154         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
6155                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
6156         then
6157                 nm_opt='-p'
6158                 eval $xrun
6159         else
6160                 echo " "
6161                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
6162                 com=''
6163                 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
6164                         for thisname in $libnames $libc; do
6165                                 $ar t $thisname >>libc.tmp
6166                         done
6167                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
6168                         echo "Ok." >&4
6169                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
6170                         # Repeat libc to extract forwarders to DLL entries too
6171                         for thisname in $libnames $libc; do
6172                                 $ar tv $thisname >>libc.tmp
6173                                 # Revision 50 of EMX has bug in $ar.
6174                                 # it will not extract forwarders to DLL entries
6175                                 # Use emximp which will extract exactly them.
6176                                 emximp -o tmp.imp $thisname \
6177                                     2>/dev/null && \
6178                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
6179                                     < tmp.imp >>libc.tmp
6180                                 $rm tmp.imp
6181                         done
6182                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
6183                         echo "Ok." >&4
6184                 else
6185                         echo "$ar didn't seem to work right." >&4
6186                         echo "Maybe this is a Cray...trying bld instead..." >&4
6187                         if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
6188                         then
6189                                 for thisname in $libnames; do
6190                                         bld t $libnames | \
6191                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
6192                                         $ar t $thisname >>libc.tmp
6193                                 done
6194                                 echo "Ok." >&4
6195                         else
6196                                 echo "That didn't work either.  Giving up." >&4
6197                                 exit 1
6198                         fi
6199                 fi
6200         fi
6201 fi
6202 nm_extract="$com"
6203 if $test -f /lib/syscalls.exp; then
6204         echo " "
6205         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
6206         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*$/\1/p' /lib/syscalls.exp >>libc.list
6207 fi
6208 ;;
6209 esac
6210 $rm -f libnames libpath
6211
6212 : see if dld is available
6213 set dld.h i_dld
6214 eval $inhdr
6215
6216 : is a C symbol defined?
6217 csym='tlook=$1;
6218 case "$3" in
6219 -v) tf=libc.tmp; tc=""; tdc="";;
6220 -a) tf=libc.tmp; tc="[0]"; tdc="[]";;
6221 *) tlook="^$1\$"; tf=libc.list; tc="()"; tdc="()";;
6222 esac;
6223 tx=yes;
6224 case "$reuseval-$4" in
6225 true-) ;;
6226 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
6227 esac;
6228 case "$tx" in
6229 yes)
6230         case "$runnm" in
6231         true)
6232                 if $contains $tlook $tf >/dev/null 2>&1;
6233                 then tval=true;
6234                 else tval=false;
6235                 fi;;
6236         *)
6237                 echo "int main() { extern short $1$tdc; printf(\"%hd\", $1$tc); }" > t.c;
6238                 if $cc $optimize $ccflags $ldflags -o t t.c $libs >/dev/null 2>&1;
6239                 then tval=true;
6240                 else tval=false;
6241                 fi;
6242                 $rm -f t t.c;;
6243         esac;;
6244 *)
6245         case "$tval" in
6246         $define) tval=true;;
6247         *) tval=false;;
6248         esac;;
6249 esac;
6250 eval "$2=$tval"'
6251
6252 : define an is-in-libc? function
6253 inlibc='echo " "; td=$define; tu=$undef;
6254 sym=$1; var=$2; eval "was=\$$2";
6255 tx=yes;
6256 case "$reuseval$was" in
6257 true) ;;
6258 true*) tx=no;;
6259 esac;
6260 case "$tx" in
6261 yes)
6262         set $sym tres -f;
6263         eval $csym;
6264         case "$tres" in
6265         true)
6266                 echo "$sym() found." >&4;
6267                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
6268         *)
6269                 echo "$sym() NOT found." >&4;
6270                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
6271         esac;;
6272 *)
6273         case "$was" in
6274         $define) echo "$sym() found." >&4;;
6275         *) echo "$sym() NOT found." >&4;;
6276         esac;;
6277 esac'
6278
6279 : see if dlopen exists
6280 xxx_runnm="$runnm"
6281 runnm=false
6282 set dlopen d_dlopen
6283 eval $inlibc
6284 runnm="$xxx_runnm"
6285
6286 : determine which dynamic loading, if any, to compile in
6287 echo " "
6288 dldir="ext/DynaLoader"
6289 case "$usedl" in
6290 $define|y|true)
6291         dflt='y'
6292         usedl="$define"
6293         ;;
6294 $undef|n|false)
6295         dflt='n'
6296         usedl="$undef"
6297         ;;
6298 *) 
6299         dflt='n'
6300         case "$d_dlopen" in
6301             $define) dflt='y' ;;
6302         esac
6303         case "$i_dld" in
6304             $define) dflt='y' ;;
6305         esac
6306         : Does a dl_xxx.xs file exist for this operating system
6307         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
6308         ;;
6309 esac
6310 rp="Do you wish to use dynamic loading?"
6311 . ./myread
6312 usedl="$ans"
6313 case "$ans" in
6314 y*) usedl="$define"
6315         case "$dlsrc" in
6316         '')
6317                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
6318                         dflt="$dldir/dl_${osname}.xs"
6319                 elif $test "$d_dlopen" = "$define" ; then
6320                         dflt="$dldir/dl_dlopen.xs"
6321                 elif $test "$i_dld" = "$define" ; then
6322                         dflt="$dldir/dl_dld.xs"
6323                 else
6324                         dflt=''
6325                 fi
6326                 ;;
6327         *)      dflt="$dldir/$dlsrc"
6328                 ;;
6329         esac
6330     echo "The following dynamic loading files are available:"
6331         : Can not go over to $dldir because getfile has path hard-coded in.
6332         tdir=`pwd`; cd $rsrc; $ls -C $dldir/dl*.xs; cd $tdir
6333         rp="Source file to use for dynamic loading"
6334         fn="fne"
6335         gfpth="$src"
6336         . ./getfile
6337         usedl="$define"
6338         : emulate basename
6339         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
6340
6341         $cat << EOM
6342
6343 Some systems may require passing special flags to $cc -c to
6344 compile modules that will be used to create a shared library.
6345 To use no flags, say "none".
6346
6347 EOM
6348     case "$cccdlflags" in
6349     '') case "$gccversion" in
6350                 '') case "$osname" in
6351                         hpux)   dflt='+z' ;;
6352                         next)   dflt='none' ;;
6353                         irix*)  dflt='-KPIC' ;;
6354                         svr4*|esix*|solaris) dflt='-KPIC' ;;
6355                         sunos)  dflt='-pic' ;;
6356                         *)      dflt='none' ;;
6357                     esac
6358                         ;;
6359                 *)  case "$osname" in
6360                         svr4*|esix*|solaris) dflt='-fPIC' ;;
6361                         *)      dflt='-fpic' ;;
6362                     esac ;;
6363             esac ;;
6364         ' ') dflt='none' ;;
6365     *)  dflt="$cccdlflags" ;;
6366     esac
6367     rp="Any special flags to pass to $cc -c to compile shared library modules?"
6368     . ./myread
6369     case "$ans" in
6370     none) cccdlflags=' ' ;;
6371     *) cccdlflags="$ans" ;;
6372     esac
6373
6374     cat << EOM
6375
6376 Some systems use ld to create libraries that can be dynamically loaded,
6377 while other systems (such as those using ELF) use $cc.
6378
6379 EOM
6380         case "$ld" in
6381         '')     $cat >try.c <<'EOM'
6382 /* Test for whether ELF binaries are produced */
6383 #include <fcntl.h>
6384 #include <stdlib.h>
6385 int main() {
6386         char b[4];
6387         int i = open("a.out",O_RDONLY);
6388         if(i == -1) 
6389                 exit(1); /* fail */
6390         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
6391                 exit(0); /* succeed (yes, it's ELF) */
6392         else
6393                 exit(1); /* fail */
6394 }
6395 EOM
6396                 if $cc $ccflags try.c >/dev/null 2>&1 && ./a.out; then
6397                         cat <<EOM
6398 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
6399 EOM
6400                         dflt="$cc"
6401                 else
6402                         echo "I'll use ld to build dynamic libraries."
6403                         dflt='ld'
6404                 fi
6405                 rm -f try.c a.out
6406                 ;;
6407         *)      dflt="$ld"
6408                 ;;
6409         esac
6410
6411     rp="What command should be used to create dynamic libraries?"
6412     . ./myread
6413         ld="$ans"
6414
6415     cat << EOM
6416
6417 Some systems may require passing special flags to $ld to create a
6418 library that can be dynamically loaded.  If your ld flags include
6419 -L/other/path options to locate libraries outside your loader's normal
6420 search path, you may need to specify those -L options here as well.  To
6421 use no flags, say "none".
6422
6423 EOM
6424     case "$lddlflags" in
6425     '') case "$osname" in
6426                         beos) dflt='-nostart' ;;
6427                         hpux) dflt='-b';
6428                               case "$gccversion" in
6429                               '') dflt="$dflt +vnocompatwarnings" ;;
6430                               esac
6431                               ;;        
6432                         linux|irix*)    dflt='-shared' ;;
6433                         next)  dflt='none' ;;
6434                         solaris) dflt='-G' ;;
6435                         sunos) dflt='-assert nodefinitions' ;;
6436                         svr4*|esix*) dflt="-G $ldflags" ;;
6437                 *)     dflt='none' ;;
6438                         esac
6439                         ;;
6440     *) dflt="$lddlflags" ;;
6441     esac
6442
6443         : Try to guess additional flags to pick up local libraries.
6444         : Be careful not to append to a plain 'none'
6445         case "$dflt" in
6446         none) dflt='' ;;
6447         esac
6448         for thisflag in $ldflags; do
6449                 case "$thisflag" in
6450                 -L*)
6451                         case " $dflt " in
6452                         *" $thisflag "*) ;;
6453                         *) dflt="$dflt $thisflag" ;;
6454                         esac
6455                         ;;
6456                 esac
6457         done
6458
6459         case "$dflt" in
6460         ''|' ') dflt='none' ;;
6461         esac
6462
6463     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
6464     . ./myread
6465     case "$ans" in
6466     none) lddlflags=' ' ;;
6467     *) lddlflags="$ans" ;;
6468     esac
6469
6470         cat <<EOM
6471
6472 Some systems may require passing special flags to $cc to indicate that
6473 the resulting executable will use dynamic linking.  To use no flags,
6474 say "none".
6475
6476 EOM
6477     case "$ccdlflags" in
6478     '') case "$osname" in
6479                 hpux)   dflt='-Wl,-E' ;;
6480                 linux)  dflt='-rdynamic' ;;
6481                 next)   dflt='none' ;;
6482                 sunos)  dflt='none' ;;
6483                 *)      dflt='none' ;;
6484             esac ;;
6485     ' ')  dflt='none' ;;
6486     *)  dflt="$ccdlflags" ;;
6487     esac
6488     rp="Any special flags to pass to $cc to use dynamic linking?"
6489     . ./myread
6490     case "$ans" in
6491     none) ccdlflags=' ' ;;
6492     *) ccdlflags="$ans" ;;
6493     esac
6494     ;;
6495 *)  usedl="$undef"
6496         ld='ld'
6497     dlsrc='dl_none.xs'
6498     lddlflags=''
6499     ccdlflags=''
6500     ;;
6501 esac
6502
6503 also=''
6504 case "$usedl" in
6505 $undef)
6506         # No dynamic loading being used, so don't bother even to prompt.
6507         useshrplib='false'
6508         ;;
6509 *)      case "$useshrplib" in
6510         '')     case "$osname" in
6511                 svr4*|dgux|dynixptx|esix|powerux|beos|cygwin*)
6512                         dflt=y
6513                         also='Building a shared libperl is required for dynamic loading to work on your system.'
6514                         ;;
6515                 next*)
6516                         case "$osvers" in
6517                         4*)     dflt=y
6518                                 also='Building a shared libperl is needed for MAB support.'
6519                                 ;;
6520                         *)      dflt=n
6521                                 ;;
6522                         esac
6523                         ;;
6524                 *)      dflt=n
6525                         ;;
6526                 esac
6527                 ;;
6528         $define|true|[Yy]*)
6529                 dflt=y
6530                 ;;
6531         *)      dflt=n
6532                 ;;
6533         esac
6534         $cat << EOM
6535
6536 The perl executable is normally obtained by linking perlmain.c with
6537 libperl${_a}, any static extensions (usually just DynaLoader), and
6538 any other libraries needed on this system (such as -lm, etc.).  Since
6539 your system supports dynamic loading, it is probably possible to build
6540 a shared libperl.$so.  If you will have more than one executable linked
6541 to libperl.$so, this will significantly reduce the size of each
6542 executable, but it may have a noticeable affect on performance.  The
6543 default is probably sensible for your system.
6544 $also
6545
6546 EOM
6547         rp="Build a shared libperl.$so (y/n)"
6548         . ./myread
6549         case "$ans" in
6550         true|$define|[Yy]*)
6551                 useshrplib='true'  ;;
6552         *)      useshrplib='false' ;;
6553         esac
6554         ;;
6555 esac
6556
6557 case "$useshrplib" in
6558 true)
6559         case "$libperl" in
6560         '')
6561                 # Figure out a good name for libperl.so.  Since it gets stored in
6562                 # a version-specific architecture-dependent library, the version
6563                 # number isn't really that important, except for making cc/ld happy.
6564                 #
6565                 # A name such as libperl.so.3.1
6566                 majmin="libperl.$so.$patchlevel.$subversion"
6567                 # A name such as libperl.so.301
6568                 majonly=`echo $patchlevel $subversion |
6569                         $awk '{printf "%d%02d", $1, $2}'`
6570                 majonly=libperl.$so.$majonly
6571                 # I'd prefer to keep the os-specific stuff here to a minimum, and
6572                 # rely on figuring it out from the naming of libc.
6573                 case "${osname}${osvers}" in
6574                 next4*)
6575                         dflt=libperl.5.$so
6576                         # XXX How handle the --version stuff for MAB?
6577                         ;;
6578                 linux*)  # ld won't link with a bare -lperl otherwise.
6579                         dflt=libperl.$so
6580                         ;;
6581                 cygwin*) # include version
6582                         dflt=`echo libperl$version | sed -e 's/\./_/g'`$lib_ext
6583                         ;;
6584                 *)      # Try to guess based on whether libc has major.minor.
6585                         case "$libc" in
6586                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
6587                         *libc.$so.[0-9]*) dflt=$majonly ;;
6588                         *)      dflt=libperl.$so ;;
6589                         esac
6590                         ;;
6591                 esac
6592                 ;;
6593         *)      dflt=$libperl
6594                 ;;
6595         esac
6596         cat << EOM
6597
6598 I need to select a good name for the shared libperl.  If your system uses
6599 library names with major and minor numbers, then you might want something
6600 like $majmin.  Alternatively, if your system uses a single version
6601 number for shared libraries, then you might want to use $majonly.
6602 Or, your system might be quite happy with a simple libperl.$so.
6603
6604 Since the shared libperl will get installed into a version-specific
6605 architecture-dependent directory, the version number of the shared perl
6606 library probably isn't important, so the default should be o.k.
6607
6608 EOM
6609         rp='What name do you want to give to the shared libperl?'
6610         . ./myread
6611         libperl=$ans
6612         echo "Ok, I'll use $libperl"
6613         ;;
6614 *)
6615         libperl="libperl${_a}"
6616         ;;
6617 esac
6618
6619 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
6620 case "$shrpdir" in
6621 '') ;;
6622 *)      $cat >&4 <<EOM
6623 WARNING:  Use of the shrpdir variable for the installation location of
6624 the shared $libperl is not supported.  It was never documented and
6625 will not work in this version.  Let me (perlbug@perl.com)
6626 know of any problems this may cause.
6627
6628 EOM
6629         case "$shrpdir" in
6630         "$archlibexp/CORE")
6631                 $cat >&4 <<EOM
6632 But your current setting of $shrpdir is
6633 the default anyway, so it's harmless.
6634 EOM
6635                 ;;
6636         *)
6637                 $cat >&4 <<EOM
6638 Further, your current attempted setting of $shrpdir
6639 conflicts with the value of $archlibexp/CORE
6640 that installperl will use.
6641 EOM
6642                 ;;
6643         esac
6644         ;;
6645 esac
6646
6647 # How will the perl executable find the installed shared $libperl?
6648 # Add $xxx to ccdlflags.
6649 # If we can't figure out a command-line option, use $shrpenv to
6650 # set env LD_RUN_PATH.  The main perl makefile uses this.
6651 shrpdir=$archlibexp/CORE
6652 xxx=''
6653 tmp_shrpenv=''
6654 if "$useshrplib"; then
6655     case "$osname" in 
6656         aix)
6657                 # We'll set it in Makefile.SH...
6658                 ;;
6659         solaris|netbsd)
6660                 xxx="-R $shrpdir"
6661                 ;;
6662         freebsd)
6663                 xxx="-Wl,-R$shrpdir"
6664                 ;;
6665         linux|irix*|dec_osf)
6666                 xxx="-Wl,-rpath,$shrpdir"
6667                 ;;
6668         next)
6669                 # next doesn't like the default...
6670                 ;;
6671         beos)
6672                 # beos doesn't like the default, either.
6673                 ;;
6674         hpux*)
6675                 # hpux doesn't like the default, either.
6676                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
6677                 ;;
6678         *)
6679                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
6680                 ;;
6681         esac
6682         case "$xxx" in
6683         '') ;;
6684         *)      
6685                 # Only add $xxx if it isn't already in ccdlflags.
6686                 case " $ccdlflags " in
6687                 *" $xxx "*)     ;;
6688                 *)      ccdlflags="$ccdlflags $xxx"
6689                         cat <<EOM >&4
6690
6691 Adding $xxx to the flags
6692 passed to $ld so that the perl executable will find the 
6693 installed shared $libperl.
6694
6695 EOM
6696                         ;;
6697                 esac
6698                 ;;
6699         esac
6700 fi
6701 # Fix ccdlflags in AIX for building external extensions.
6702 # (For building Perl itself bare -bE:perl.exp is needed,
6703 #  Makefile.SH takes care of this.)
6704 case "$osname" in
6705 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
6706 esac
6707 # Respect a hint or command-line value.
6708 case "$shrpenv" in
6709 '') shrpenv="$tmp_shrpenv" ;;
6710 esac
6711 case "$ldlibpthname" in
6712 '')     ldlibpthname=LD_LIBRARY_PATH ;;
6713 none)   ldlibpthname='' ;;
6714 esac
6715
6716 : determine where manual pages go
6717 set man1dir man1dir none
6718 eval $prefixit
6719 $cat <<EOM
6720
6721 $spackage has manual pages available in source form.
6722 EOM
6723 case "$nroff" in
6724 nroff)
6725         echo "However, you don't have nroff, so they're probably useless to you."
6726         case "$man1dir" in
6727         '') man1dir="none";;
6728         esac;;
6729 esac
6730 echo "If you don't want the manual sources installed, answer 'none'."
6731 case "$man1dir" in
6732 ' ') dflt=none
6733         ;;
6734 '')
6735         lookpath="$prefixexp/man/man1 $prefixexp/man/l_man/man1"
6736         lookpath="$lookpath $prefixexp/man/p_man/man1"
6737         lookpath="$lookpath $prefixexp/man/u_man/man1"
6738         lookpath="$lookpath $prefixexp/man/man.1"
6739         case "$sysman" in
6740         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
6741         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
6742         esac
6743         set dflt
6744         eval $prefixup
6745         ;;
6746 *)  dflt="$man1dir"
6747         ;;
6748 esac
6749 echo " "
6750 fn=dn+~
6751 rp="Where do the main $spackage manual pages (source) go?"
6752 . ./getfile
6753 if $test "X$man1direxp" != "X$ansexp"; then
6754         installman1dir=''
6755 fi
6756 man1dir="$ans"
6757 man1direxp="$ansexp"
6758 case "$man1dir" in
6759 '')     man1dir=' '
6760         installman1dir='';;
6761 esac
6762
6763 : Change installation prefix, if necessary.
6764 if $test X"$prefix" != X"$installprefix"; then
6765         installman1dir=`echo $man1direxp | $sed "s#^$prefix#$installprefix#"`
6766 else
6767         installman1dir="$man1direxp"
6768 fi
6769
6770 : What suffix to use on installed man pages
6771
6772 case "$man1dir" in
6773 ' ')
6774         man1ext='0'
6775         ;;
6776 *)
6777         rp="What suffix should be used for the main $spackage man pages?"
6778         case "$man1ext" in
6779         '')     case "$man1dir" in
6780                 *1)  dflt=1 ;;
6781                 *1p) dflt=1p ;;
6782                 *1pm) dflt=1pm ;;
6783                 *l) dflt=l;;
6784                 *n) dflt=n;;
6785                 *o) dflt=o;;
6786                 *p) dflt=p;;
6787                 *C) dflt=C;;
6788                 *L) dflt=L;;
6789                 *L1) dflt=L1;;
6790                 *) dflt=1;;
6791                 esac
6792                 ;;
6793         *)      dflt="$man1ext";;
6794         esac
6795         . ./myread
6796         man1ext="$ans"
6797         ;;
6798 esac
6799
6800 : see if we can have long filenames
6801 echo " "
6802 first=123456789abcdef
6803 $rm -f $first
6804 if (echo hi >$first) 2>/dev/null; then
6805         if $test -f 123456789abcde; then
6806                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
6807                 val="$undef"
6808         else
6809                 echo 'You can have filenames longer than 14 characters.'>&4
6810                 val="$define"
6811         fi
6812 else
6813         $cat <<'EOM'
6814 You can't have filenames longer than 14 chars.
6815 You can't even think about them!
6816 EOM
6817         val="$undef"
6818 fi 
6819 set d_flexfnam
6820 eval $setvar
6821 $rm -rf 123456789abcde*
6822
6823 : determine where library module manual pages go
6824 set man3dir man3dir none
6825 eval $prefixit
6826 $cat <<EOM
6827
6828 $spackage has manual pages for many of the library modules.
6829 EOM
6830
6831 case "$nroff" in
6832 nroff)
6833         $cat <<'EOM'
6834 However, you don't have nroff, so they're probably useless to you.
6835 EOM
6836         case "$man3dir" in
6837         '') man3dir="none";;
6838         esac;;
6839 esac
6840
6841 case "$d_flexfnam" in
6842 undef)
6843         $cat <<'EOM'
6844 However, your system can't handle the long file names like File::Basename.3. 
6845 EOM
6846         case "$man3dir" in
6847         '') man3dir="none";;
6848         esac;;
6849 esac
6850
6851 echo "If you don't want the manual sources installed, answer 'none'."
6852 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6853 case "$man3dir" in
6854 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
6855         if $test -d "$privlib/man/man3"; then
6856                 cat <<EOM >&4
6857
6858 WARNING:  Previous versions of perl installed man3 pages into
6859 $privlib/man/man3.  This version will suggest a 
6860 new default of $dflt.  
6861 EOM
6862                 tdflt=$dflt
6863                 dflt='n'
6864                 rp='Do you wish to preserve the old behavior?(y/n)'
6865                 . ./myread
6866                 case "$ans" in
6867                 y*) dflt="$privlib/man/man3" ;;
6868                 *)  dflt=$tdflt ;;
6869                 esac
6870     fi
6871         ;;
6872 *)      dflt="$man3dir" ;;
6873 esac
6874 case "$dflt" in
6875 ' ') dflt=none ;;
6876 esac
6877 echo " "
6878 fn=dn+~
6879 rp="Where do the $package library man pages (source) go?"
6880 . ./getfile
6881 man3dir="$ans"
6882 man3direxp="$ansexp"
6883 case "$man3dir" in
6884 '')     man3dir=' '
6885         installman3dir='';;
6886 esac
6887
6888 : Change installation prefix, if necessary.
6889 if $test X"$prefix" != X"$installprefix"; then
6890         installman3dir=`echo $man3direxp | $sed "s#^$prefix#$installprefix#"`
6891 else
6892         installman3dir="$man3direxp"
6893 fi
6894
6895 : What suffix to use on installed man pages
6896 case "$man3dir" in
6897 ' ')
6898         man3ext='0'
6899         ;;
6900 *)
6901         rp="What suffix should be used for the $package library man pages?"
6902         case "$man3ext" in
6903         '')     case "$man3dir" in
6904                 *3)  dflt=3 ;;
6905                 *3p) dflt=3p ;;
6906                 *3pm) dflt=3pm ;;
6907                 *l) dflt=l;;
6908                 *n) dflt=n;;
6909                 *o) dflt=o;;
6910                 *p) dflt=p;;
6911                 *C) dflt=C;;
6912                 *L) dflt=L;;
6913                 *L3) dflt=L3;;
6914                 *) dflt=3;;
6915                 esac
6916                 ;;
6917         *)      dflt="$man3ext";;
6918         esac
6919         . ./myread
6920         man3ext="$ans"
6921         ;;
6922 esac
6923
6924 : see if we have to deal with yellow pages, now NIS.
6925 if $test -d /usr/etc/yp || $test -d /etc/yp; then
6926         if $test -f /usr/etc/nibindd; then
6927                 echo " "
6928                 echo "I'm fairly confident you're on a NeXT."
6929                 echo " "
6930                 rp='Do you get the hosts file via NetInfo?'
6931                 dflt=y
6932                 case "$hostcat" in
6933                 nidump*) ;;
6934                 '') ;;
6935                 *) dflt=n;;
6936                 esac
6937                 . ./myread
6938                 case "$ans" in
6939                 y*) hostcat='nidump hosts .';;
6940                 *)      case "$hostcat" in
6941                         nidump*) hostcat='';;
6942                         esac
6943                         ;;
6944                 esac
6945         fi
6946         case "$hostcat" in
6947         nidump*) ;;
6948         *)
6949                 case "$hostcat" in
6950                 *ypcat*) dflt=y;;
6951                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
6952                                 dflt=y
6953                         else
6954                                 dflt=n
6955                         fi;;
6956                 *) dflt=n;;
6957                 esac
6958                 echo " "
6959                 rp='Are you getting the hosts file via yellow pages?'
6960                 . ./myread
6961                 case "$ans" in
6962                 y*) hostcat='ypcat hosts';;
6963                 *) hostcat='cat /etc/hosts';;
6964                 esac
6965                 ;;
6966         esac
6967 fi
6968 case "$hostcat" in
6969 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
6970 esac
6971 case "$groupcat" in
6972 '') test -f /etc/group && groupcat='cat /etc/group';;
6973 esac
6974 case "$passcat" in
6975 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
6976 esac
6977
6978 : now get the host name
6979 echo " "
6980 echo "Figuring out host name..." >&4
6981 case "$myhostname" in
6982 '') cont=true
6983         echo 'Maybe "hostname" will work...'
6984         if tans=`sh -c hostname 2>&1` ; then
6985                 myhostname=$tans
6986                 phostname=hostname
6987                 cont=''
6988         fi
6989         ;;
6990 *) cont='';;
6991 esac
6992 if $test "$cont"; then
6993         if ./xenix; then
6994                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
6995                 if tans=`cat /etc/systemid 2>&1` ; then
6996                         myhostname=$tans
6997                         phostname='cat /etc/systemid'
6998                         echo "Whadyaknow.  Xenix always was a bit strange..."
6999                         cont=''
7000                 fi
7001         elif $test -r /etc/systemid; then
7002                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
7003         fi
7004 fi
7005 if $test "$cont"; then
7006         echo 'No, maybe "uuname -l" will work...'
7007         if tans=`sh -c 'uuname -l' 2>&1` ; then
7008                 myhostname=$tans
7009                 phostname='uuname -l'
7010         else
7011                 echo 'Strange.  Maybe "uname -n" will work...'
7012                 if tans=`sh -c 'uname -n' 2>&1` ; then
7013                         myhostname=$tans
7014                         phostname='uname -n'
7015                 else
7016                         echo 'Oh well, maybe I can mine it out of whoami.h...'
7017                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
7018                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
7019                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
7020                         else
7021                                 case "$myhostname" in
7022                                 '') echo "Does this machine have an identity crisis or something?"
7023                                         phostname='';;
7024                                 *)
7025                                         echo "Well, you said $myhostname before..."
7026                                         phostname='echo $myhostname';;
7027                                 esac
7028                         fi
7029                 fi
7030         fi
7031 fi
7032 : you do not want to know about this
7033 set $myhostname
7034 myhostname=$1
7035
7036 : verify guess
7037 if $test "$myhostname" ; then
7038         dflt=y
7039         rp='Your host name appears to be "'$myhostname'".'" Right?"
7040         . ./myread
7041         case "$ans" in
7042         y*) ;;
7043         *) myhostname='';;
7044         esac
7045 fi
7046
7047 : bad guess or no guess
7048 while $test "X$myhostname" = X ; do
7049         dflt=''
7050         rp="Please type the (one word) name of your host:"
7051         . ./myread
7052         myhostname="$ans"
7053 done
7054
7055 : translate upper to lower if necessary
7056 case "$myhostname" in
7057 *[A-Z]*)
7058         echo "(Normalizing case in your host name)"
7059         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
7060         ;;
7061 esac
7062
7063 case "$myhostname" in
7064 *.*)
7065         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
7066         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
7067         echo "(Trimming domain name from host name--host name is now $myhostname)"
7068         ;;
7069 *) case "$mydomain" in
7070         '')
7071                 {
7072                         test "X$hostcat" = "Xypcat hosts" &&
7073                         ypmatch "$myhostname" hosts 2>/dev/null |\
7074                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
7075                         $test -s hosts
7076                 } || {
7077                         test "X$hostcat" != "X" &&
7078                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
7079                                         /[       ]$myhostname[  . ]/p" > hosts
7080                 }
7081                 tmp_re="[       . ]"
7082                 $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
7083                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
7084                 dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
7085                         hosts | $sort | $uniq | \
7086                         $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
7087                 case `$echo X$dflt` in
7088                 X*\ *)  echo "(Several hosts in /etc/hosts matched hostname)"
7089                         dflt=.
7090                         ;;
7091                 X.) echo "(You do not have fully-qualified names in /etc/hosts)"
7092                         ;;
7093                 esac
7094                 case "$dflt" in
7095                 .)
7096                         tans=`./loc resolv.conf X /etc /usr/etc`
7097                         if $test -f "$tans"; then
7098                                 echo "(Attempting domain name extraction from $tans)"
7099                                 dflt=.`$sed -n -e 's/   / /g' \
7100                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
7101                                   | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
7102                                 case "$dflt" in
7103                                 .) dflt=.`$sed -n -e 's/        / /g' \
7104                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
7105                                      | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
7106                                         ;;
7107                                 esac
7108                         fi
7109                         ;;
7110                 esac
7111                 case "$dflt" in
7112                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
7113                         dflt=.`sh -c domainname 2>/dev/null`
7114                         case "$dflt" in
7115                         '') dflt='.';;
7116                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
7117                         esac
7118                         ;;
7119                 esac
7120                 case "$dflt" in
7121                 .) echo "(Lost all hope -- silly guess then)"
7122                         dflt='.uucp'
7123                         ;;
7124                 esac
7125                 $rm -f hosts
7126                 ;;
7127         *) dflt="$mydomain";;
7128         esac;;
7129 esac
7130 echo " "
7131 rp="What is your domain name?"
7132 . ./myread
7133 tans="$ans"
7134 case "$ans" in
7135 '') ;;
7136 .*) ;;
7137 *) tans=".$tans";;
7138 esac
7139 mydomain="$tans"
7140
7141 : translate upper to lower if necessary
7142 case "$mydomain" in
7143 *[A-Z]*)
7144         echo "(Normalizing case in your domain name)"
7145         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
7146         ;;
7147 esac
7148
7149 : a little sanity check here
7150 case "$phostname" in
7151 '') ;;
7152 *)
7153         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
7154         $myhostname$mydomain|$myhostname) ;;
7155         *)
7156                 case "$phostname" in
7157                 sed*)
7158                         echo "(That doesn't agree with your whoami.h file, by the way.)"
7159                         ;;
7160                 *)
7161                         echo "(That doesn't agree with your $phostname command, by the way.)"
7162                         ;;
7163                 esac
7164         ;;
7165         esac
7166         ;;
7167 esac
7168
7169 $cat <<EOM
7170
7171 I need to get your e-mail address in Internet format if possible, i.e.
7172 something like user@host.domain. Please answer accurately since I have
7173 no easy means to double check it. The default value provided below
7174 is most probably close to reality but may not be valid from outside
7175 your organization...
7176
7177 EOM
7178 cont=x
7179 while test "$cont"; do
7180         case "$cf_email" in
7181         '') dflt="$cf_by@$myhostname$mydomain";;
7182         *) dflt="$cf_email";;
7183         esac
7184         rp='What is your e-mail address?'
7185         . ./myread
7186         cf_email="$ans"
7187         case "$cf_email" in
7188         *@*.*) cont='' ;;
7189         *)
7190                 rp='Address does not look like an Internet one.  Use it anyway?'
7191                 case "$fastread" in
7192                 yes) dflt=y ;;
7193                 *) dflt=n ;;
7194                 esac
7195                 . ./myread
7196                 case "$ans" in
7197                 y*) cont='' ;;
7198                 *) echo " " ;;
7199                 esac
7200                 ;;
7201         esac
7202 done
7203
7204 $cat <<EOM
7205
7206 If you or somebody else will be maintaining perl at your site, please
7207 fill in the correct e-mail address here so that they may be contacted
7208 if necessary. Currently, the "perlbug" program included with perl
7209 will send mail to this address in addition to perlbug@perl.com. You may
7210 enter "none" for no administrator.
7211
7212 EOM
7213 case "$perladmin" in
7214 '') dflt="$cf_email";;
7215 *) dflt="$perladmin";;
7216 esac
7217 rp='Perl administrator e-mail address'
7218 . ./myread
7219 perladmin="$ans"
7220
7221 : figure out how to guarantee perl startup
7222 case "$startperl" in
7223 '')
7224         case "$sharpbang" in
7225         *!)
7226                 $cat <<EOH
7227
7228 I can use the #! construct to start perl on your system. This will
7229 make startup of perl scripts faster, but may cause problems if you
7230 want to share those scripts and perl is not in a standard place
7231 ($binexp/perl) on all your platforms. The alternative is to force
7232 a shell by starting the script with a single ':' character.
7233
7234 EOH
7235                 dflt="$binexp/perl"
7236                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
7237                 . ./myread
7238                 case "$ans" in
7239                 none)   startperl=": # use perl";;
7240                 *)      startperl="#!$ans"
7241                         if $test 30 -lt `echo "$ans" | wc -c`; then
7242                                 $cat >&4 <<EOM
7243
7244 WARNING:  Some systems limit the #! command to 32 characters.
7245 If you experience difficulty running Perl scripts with #!, try
7246 installing Perl in a directory with a shorter pathname.
7247
7248 EOM
7249                         fi ;;
7250                 esac
7251                 ;;
7252         *) startperl=": # use perl"
7253                 ;;
7254         esac
7255         ;;
7256 esac
7257 echo "I'll use $startperl to start perl scripts."
7258
7259 : figure best path for perl in scripts
7260 case "$perlpath" in
7261 '')
7262         perlpath="$binexp/perl"
7263         case "$startperl" in
7264         *!*) ;;
7265         *)
7266                 $cat <<EOH
7267
7268 I will use the "eval 'exec'" idiom to start Perl on your system.
7269 I can use the full path of your Perl binary for this purpose, but
7270 doing so may cause problems if you want to share those scripts and
7271 Perl is not always in a standard place ($binexp/perl).
7272
7273 EOH
7274                 dflt="$binexp/perl"
7275                 rp="What path shall I use in \"eval 'exec'\"?"
7276                 . ./myread
7277                 perlpath="$ans"
7278                 ;;
7279         esac
7280         ;;
7281 esac
7282 case "$startperl" in
7283 *!*)    ;;
7284 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
7285 esac
7286
7287 : determine where public executable scripts go
7288 set scriptdir scriptdir
7289 eval $prefixit
7290 case "$scriptdir" in
7291 '')
7292         dflt="$bin"
7293         : guess some guesses
7294         $test -d /usr/share/scripts && dflt=/usr/share/scripts
7295         $test -d /usr/share/bin     && dflt=/usr/share/bin
7296         $test -d /usr/local/script  && dflt=/usr/local/script
7297         $test -d /usr/local/scripts && dflt=/usr/local/scripts
7298         $test -d $prefixexp/script  && dflt=$prefixexp/script
7299         set dflt
7300         eval $prefixup
7301         ;;
7302 *)  dflt="$scriptdir"
7303         ;;
7304 esac
7305 $cat <<EOM
7306  
7307 Some installations have a separate directory just for executable scripts so
7308 that they can mount it across multiple architectures but keep the scripts in
7309 one spot.  You might, for example, have a subdirectory of /usr/share for this.
7310 Or you might just lump your scripts in with all your other executables.
7311  
7312 EOM
7313 fn=d~
7314 rp='Where do you keep publicly executable scripts?'
7315 . ./getfile
7316 if $test "X$ansexp" != "X$scriptdirexp"; then
7317         installscript=''
7318 fi
7319 scriptdir="$ans"
7320 scriptdirexp="$ansexp"
7321 : Change installation prefix, if necessary.
7322 if $test X"$prefix" != X"$installprefix"; then
7323         installscript=`echo $scriptdirexp | sed "s#^$prefix#$installprefix#"`
7324 else
7325         installscript="$scriptdirexp"
7326 fi
7327
7328 : determine where add-on public executables go
7329 case "$sitebin" in
7330 '')     dflt=$siteprefix/bin ;;
7331 *)      dflt=$sitebin ;;
7332 esac
7333 fn=d~
7334 rp='Pathname where the add-on public executables should be installed?'
7335 . ./getfile
7336 sitebin="$ans"
7337 sitebinexp="$ansexp"
7338 : Change installation prefix, if necessary.
7339 if $test X"$prefix" != X"$installprefix"; then
7340         installsitebin=`echo $sitebinexp | sed "s#^$prefix#$installprefix#"`
7341 else
7342         installsitebin="$sitebinexp"
7343 fi
7344
7345 : see if sqrtl exists
7346 set sqrtl d_sqrtl
7347 eval $inlibc
7348
7349 case "$ccflags" in
7350 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
7351 esac
7352
7353 case "$uselongdouble" in
7354 $define|true|[yY]*)     dflt='y';;
7355 *) dflt='n';;
7356 esac
7357 cat <<EOM
7358
7359 Perl can be built to take advantage of long doubles which
7360 (if available) may give more accuracy and range for floating point numbers.
7361
7362 If this doesn't make any sense to you, just accept the default '$dflt'.
7363 EOM
7364 rp='Try to use long doubles if available?'
7365 . ./myread
7366 case "$ans" in
7367 y|Y)    val="$define"   ;;
7368 *)      val="$undef"    ;;
7369 esac
7370 set uselongdouble
7371 eval $setvar
7372
7373 case "$uselongdouble" in
7374 true|[yY]*) uselongdouble="$define" ;;
7375 esac
7376
7377 case "$uselongdouble" in
7378 $define)
7379 : Look for a hint-file generated 'call-back-unit'.  If the
7380 : user has specified that long doubles should be used,
7381 : we may need to set or change some other defaults.
7382         if $test -f uselongdouble.cbu; then
7383                 echo "Your platform has some specific hints for long doubles, using them..."
7384                 . ./uselongdouble.cbu
7385         else
7386                 $cat <<EOM
7387 (Your platform doesn't have any specific hints for long doubles.)
7388 EOM
7389         fi
7390         ;;
7391 esac
7392
7393 case "$uselongdouble:$d_sqrtl" in
7394 $define:$undef)
7395                 $cat <<EOM >&4
7396
7397 *** You requested the use of long doubles but you do not seem to have
7398 *** the mathematic functions for long doubles.  I'm disabling the use
7399 *** of long doubles.
7400
7401 EOM
7402         uselongdouble=$undef
7403         ;;
7404 esac
7405
7406 case "$useperlio" in
7407 $define|true|[yY]*)     dflt='y';;
7408 *) dflt='n';;
7409 esac
7410 cat <<EOM
7411
7412 Previous version of $package used the standard IO mechanisms as defined
7413 in <stdio.h>.  Versions 5.003_02 and later of perl allow alternate IO
7414 mechanisms via a "PerlIO" abstraction, but the stdio mechanism is still
7415 the default.  This abstraction layer can use AT&T's sfio (if you already
7416 have sfio installed) or regular stdio.  Using PerlIO with sfio may cause
7417 problems with some extension modules.  Using PerlIO with stdio is safe,
7418 but it is slower than plain stdio and therefore is not the default.
7419
7420 If this doesn't make any sense to you, just accept the default '$dflt'.
7421 EOM
7422 rp='Use the experimental PerlIO abstraction layer?'
7423 . ./myread
7424 case "$ans" in
7425 y|Y) 
7426         val="$define"
7427         ;;     
7428 *)      
7429         echo "Ok, doing things the stdio way"
7430         val="$undef"
7431         ;;
7432 esac
7433 set useperlio
7434 eval $setvar 
7435
7436 case "$vendorprefix" in
7437 '')     d_vendorbin="$undef"
7438         vendorbin=''
7439         vendorbinexp=''
7440         ;;
7441 *)      d_vendorbin="$define"
7442         : determine where vendor-supplied executables go.
7443         case "$vendorbin" in
7444         '') dflt=$vendorprefix/bin ;;
7445         *)      dflt="$vendorbin" ;;
7446         esac
7447         fn=d~+
7448         rp='Pathname for the vendor-supplied executables directory?'
7449         . ./getfile
7450         vendorbin="$ans"
7451         vendorbinexp="$ansexp"
7452         ;;
7453 esac
7454 : Change installation prefix, if necessary.
7455 if $test X"$prefix" != X"$installprefix"; then
7456         installvendorbin=`echo $vendorbinexp | $sed "s#^$prefix#$installprefix#"`
7457 else
7458         installvendorbin="$vendorbinexp"
7459 fi
7460
7461 : see if qgcvt exists
7462 set qgcvt d_qgcvt
7463 eval $inlibc
7464
7465 : check for length of double
7466 echo " "
7467 case "$doublesize" in
7468 '')
7469         echo "Checking to see how big your double precision numbers are..." >&4
7470         $cat >try.c <<'EOCP'
7471 #include <stdio.h>
7472 int main()
7473 {
7474     printf("%d\n", (int)sizeof(double));
7475     exit(0);
7476 }
7477 EOCP
7478         set try
7479         if eval $compile_ok; then
7480                 doublesize=`./try`
7481                 echo "Your double is $doublesize bytes long."
7482         else
7483                 dflt='8'
7484                 echo "(I can't seem to compile the test program.  Guessing...)"
7485                 rp="What is the size of a double precision number (in bytes)?"
7486                 . ./myread
7487                 doublesize="$ans"
7488         fi
7489         ;;
7490 esac
7491 $rm -f try.c try
7492
7493 : check for long doubles
7494 echo " "
7495 echo "Checking to see if you have long double..." >&4
7496 echo 'int main() { long double x = 7.0; }' > try.c
7497 set try
7498 if eval $compile; then
7499         val="$define"
7500         echo "You have long double."
7501 else
7502         val="$undef"
7503         echo "You do not have long double."
7504 fi
7505 $rm try.*
7506 set d_longdbl
7507 eval $setvar
7508
7509 : check for length of long double
7510 case "${d_longdbl}${longdblsize}" in
7511 $define)
7512         echo " "
7513         echo "Checking to see how big your long doubles are..." >&4
7514         $cat >try.c <<'EOCP'
7515 #include <stdio.h>
7516 int main()
7517 {
7518         printf("%d\n", sizeof(long double));
7519 }
7520 EOCP
7521         set try
7522         set try
7523         if eval $compile; then
7524                 longdblsize=`./try$exe_ext`
7525                 echo "Your long doubles are $longdblsize bytes long."
7526         else
7527                 dflt='8'
7528                 echo " "
7529                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
7530                 rp="What is the size of a long double (in bytes)?"
7531                 . ./myread
7532                 longdblsize="$ans"
7533         fi
7534         if $test "X$doublesize" = "X$longdblsize"; then
7535                 echo "(That isn't any different from an ordinary double.)"
7536         fi      
7537         ;;
7538 esac
7539 $rm -f try.* try
7540
7541 echo " "
7542
7543 if $test X"$d_longdbl" = X"$define"; then
7544
7545 echo "Checking how to print long doubles..." >&4
7546
7547 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
7548         $cat >try.c <<'EOCP'
7549 #include <sys/types.h>
7550 #include <stdio.h>
7551 int main() {
7552   double d = 123.456;
7553   printf("%.3f\n", d);
7554 }
7555 EOCP
7556         set try
7557         if eval $compile; then
7558                 yyy=`./try$exe_ext`
7559                 case "$yyy" in
7560                 123.456)
7561                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
7562                         sPRIFldbl='"F"'; sPRIGldbl='"G"'; sPRIEldbl='"E"';
7563                         echo "We will use %f."
7564                         ;;
7565                 esac
7566         fi
7567 fi
7568
7569 if $test X"$sPRIfldbl" = X; then
7570         $cat >try.c <<'EOCP'
7571 #include <sys/types.h>
7572 #include <stdio.h>
7573 int main() {
7574   long double d = 123.456;
7575   printf("%.3llf\n", d);
7576 }
7577 EOCP
7578         set try
7579         if eval $compile; then
7580                 yyy=`./try$exe_ext`
7581                 case "$yyy" in
7582                 123.456)
7583                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
7584                         sPRIFldbl='"llF"'; sPRIGldbl='"llG"'; sPRIEldbl='"llE"';
7585                         echo "We will use %llf."
7586                         ;;
7587                 esac
7588         fi
7589 fi
7590
7591 if $test X"$sPRIfldbl" = X; then
7592         $cat >try.c <<'EOCP'
7593 #include <sys/types.h>
7594 #include <stdio.h>
7595 int main() {
7596   long double d = 123.456;
7597   printf("%.3Lf\n", d);
7598 }
7599 EOCP
7600         set try
7601         if eval $compile; then
7602                 yyy=`./try$exe_ext`
7603                 case "$yyy" in
7604                 123.456)
7605                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
7606                         sPRIFldbl='"LF"'; sPRIGldbl='"LG"'; sPRIEldbl='"LE"';
7607                         echo "We will use %Lf."
7608                         ;;
7609                 esac
7610         fi
7611 fi
7612
7613 if $test X"$sPRIfldbl" = X; then
7614         $cat >try.c <<'EOCP'
7615 #include <sys/types.h>
7616 #include <stdio.h>
7617 int main() {
7618   long double d = 123.456;
7619   printf("%.3lf\n", d);
7620 }
7621 EOCP
7622         set try
7623         if eval $compile; then
7624                 yyy=`./try$exe_ext`
7625                 case "$yyy" in
7626                 123.456)
7627                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
7628                         sPRIFldbl='"lF"'; sPRIGldbl='"lG"'; sPRIEldbl='"lE"';
7629                         echo "We will use %lf."
7630                         ;;
7631                 esac
7632         fi
7633 fi
7634
7635 if $test X"$sPRIfldbl" = X; then
7636         echo "Cannot figure out how to print long doubles." >&4
7637 fi
7638
7639 $rm -f try try.*
7640
7641 fi # d_longdbl
7642
7643 case "$sPRIfldbl" in
7644 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef"; 
7645         d_PRIFldbl="$undef"; d_PRIGldbl="$undef"; d_PRIEldbl="$undef"; 
7646         ;;
7647 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define"; 
7648         d_PRIFldbl="$define"; d_PRIGldbl="$define"; d_PRIEldbl="$define"; 
7649         ;;
7650 esac
7651
7652 : Check how to convert floats to strings.
7653 if test "X$d_Gconvert" = X; then
7654         echo " "
7655         echo "Checking for an efficient way to convert floats to strings."
7656         echo " " > try.c
7657         case "$uselongdouble" in
7658         "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
7659         esac
7660         case "$d_longdbl" in
7661         "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
7662         esac
7663         case "$d_PRIgldbl" in
7664         "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
7665         esac
7666         $cat >>try.c <<EOP
7667 #ifdef TRY_gconvert
7668 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
7669 char *myname = "gconvert";
7670 #endif
7671 #ifdef TRY_gcvt
7672 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
7673 char *myname = "gcvt";
7674 #endif
7675 #ifdef TRY_qgcvt
7676 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
7677 char *myname = "qgcvt";
7678 #define DOUBLETYPE long double
7679 #endif
7680 #ifdef TRY_sprintf
7681 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE) && defined(HAS_PRIgldbl)
7682 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
7683 #else
7684 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
7685 #endif
7686 char *myname = "sprintf";
7687 #endif
7688
7689 #ifndef DOUBLETYPE
7690 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
7691 #define DOUBLETYPE long double
7692 #else
7693 #define DOUBLETYPE double
7694 #endif
7695 #endif
7696
7697 #include <stdio.h>
7698
7699 #define I_STDLIB $i_stdlib
7700 #ifdef I_STDLIB
7701 #include <stdlib.h>
7702 #endif
7703
7704 int
7705 checkit(expect, got)
7706 char *expect;
7707 char *got;
7708 {
7709     if (strcmp(expect, got)) {
7710                 printf("%s oddity:  Expected %s, got %s\n",
7711                         myname, expect, got);
7712                 exit(1);
7713         }
7714 }
7715
7716 int main()
7717
7718         char buf[64]; 
7719         buf[63] = '\0';
7720
7721         /* This must be 1st test on (which?) platform */
7722         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
7723         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
7724         checkit("0.1", buf);
7725
7726         Gconvert((DOUBLETYPE)1.0, 8, 0, buf); 
7727         checkit("1", buf);
7728
7729         Gconvert((DOUBLETYPE)1.1, 8, 0, buf); 
7730         checkit("1.1", buf);
7731
7732         Gconvert((DOUBLETYPE)1.01, 8, 0, buf); 
7733         checkit("1.01", buf);
7734
7735         Gconvert((DOUBLETYPE)1.001, 8, 0, buf); 
7736         checkit("1.001", buf);
7737
7738         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf); 
7739         checkit("1.0001", buf);
7740
7741         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf); 
7742         checkit("1.00001", buf);
7743
7744         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf); 
7745         checkit("1.000001", buf);
7746
7747         Gconvert((DOUBLETYPE)0.0, 8, 0, buf); 
7748         checkit("0", buf);
7749
7750         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf); 
7751         checkit("-1", buf);
7752
7753         /* Some Linux gcvt's give 1.e+5 here. */
7754         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf); 
7755         checkit("100000", buf);
7756         
7757         /* Some Linux gcvt's give -1.e+5 here. */
7758         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf); 
7759         checkit("-100000", buf);
7760
7761         exit(0);
7762 }
7763 EOP
7764         case "$d_Gconvert" in
7765         gconvert*) xxx_list='gconvert gcvt sprintf' ;;
7766         gcvt*) xxx_list='gcvt gconvert sprintf' ;;
7767         sprintf*) xxx_list='sprintf gconvert gcvt' ;;
7768         *) xxx_list='gconvert gcvt sprintf' ;;
7769         esac
7770
7771         case "$d_longdbl$uselongdouble$d_qgcvt" in
7772         "$define$define$define") xxx_list="`echo $xxx_list|sed 's/gcvt/qgcvt gcvt/'`" ;;
7773         esac
7774
7775         for xxx_convert in $xxx_list; do
7776                 echo "Trying $xxx_convert..."
7777                 $rm -f try try$_o
7778                 set try -DTRY_$xxx_convert
7779                 if eval $compile; then
7780                         echo "$xxx_convert() found." >&4
7781                         if ./try; then
7782                                 echo "I'll use $xxx_convert to convert floats into a string." >&4
7783                                 break;
7784                         else
7785                                 echo "...But $xxx_convert didn't work as I expected."
7786                         fi
7787                 else
7788                         echo "$xxx_convert NOT found." >&4
7789                 fi
7790         done
7791                 
7792         case "$xxx_convert" in
7793         gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
7794         gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
7795         qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
7796         *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
7797            "$define$define$define")
7798               d_Gconvert="sprintf((b),\"%.*$sPRIgldbl\",(n),(x))" ;;
7799            *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
7800            esac
7801            ;;  
7802         esac
7803 fi
7804
7805 : Initialize h_fcntl
7806 h_fcntl=false
7807
7808 : Initialize h_sysfile
7809 h_sysfile=false
7810
7811 : access call always available on UNIX
7812 set access d_access
7813 eval $inlibc
7814
7815 : locate the flags for 'access()'
7816 case "$d_access" in
7817 "$define")
7818         echo " "
7819         $cat >access.c <<'EOCP'
7820 #include <sys/types.h>
7821 #ifdef I_FCNTL
7822 #include <fcntl.h>
7823 #endif
7824 #ifdef I_SYS_FILE
7825 #include <sys/file.h>
7826 #endif
7827 #ifdef I_UNISTD
7828 #include <unistd.h>
7829 #endif
7830 int main() {
7831         exit(R_OK);
7832 }
7833 EOCP
7834         : check sys/file.h first, no particular reason here
7835         if $test `./findhdr sys/file.h` && \
7836                 $cc $cppflags -DI_SYS_FILE -o access access.c >/dev/null 2>&1 ; then
7837                 h_sysfile=true;
7838                 echo "<sys/file.h> defines the *_OK access constants." >&4
7839         elif $test `./findhdr fcntl.h` && \
7840                 $cc $cppflags -DI_FCNTL -o access access.c >/dev/null 2>&1 ; then
7841                 h_fcntl=true;
7842                 echo "<fcntl.h> defines the *_OK access constants." >&4
7843         elif $test `./findhdr unistd.h` && \
7844                 $cc $cppflags -DI_UNISTD -o access access.c >/dev/null 2>&1 ; then
7845                 echo "<unistd.h> defines the *_OK access constants." >&4
7846         else
7847                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
7848         fi
7849         ;;
7850 esac
7851 $rm -f access*
7852
7853 : see if accessx exists
7854 set accessx d_accessx
7855 eval $inlibc
7856
7857 : see if alarm exists
7858 set alarm d_alarm
7859 eval $inlibc
7860
7861 : see if atolf exists
7862 set atolf d_atolf
7863 eval $inlibc
7864
7865 : see if atoll exists
7866 set atoll d_atoll
7867 eval $inlibc
7868
7869 : Look for GNU-cc style attribute checking
7870 echo " "
7871 echo "Checking whether your compiler can handle __attribute__ ..." >&4
7872 $cat >attrib.c <<'EOCP'
7873 #include <stdio.h>
7874 void croak (char* pat,...) __attribute__((format(printf,1,2),noreturn));
7875 EOCP
7876 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
7877         if $contains 'warning' attrib.out >/dev/null 2>&1; then
7878                 echo "Your C compiler doesn't fully support __attribute__."
7879                 val="$undef"
7880         else
7881                 echo "Your C compiler supports __attribute__."
7882                 val="$define"
7883         fi
7884 else
7885         echo "Your C compiler doesn't seem to understand __attribute__ at all."
7886         val="$undef"
7887 fi
7888 set d_attribut
7889 eval $setvar
7890 $rm -f attrib*
7891
7892 : see if bcmp exists
7893 set bcmp d_bcmp
7894 eval $inlibc
7895
7896 : see if bcopy exists
7897 set bcopy d_bcopy
7898 eval $inlibc
7899
7900 : see if this is a unistd.h system
7901 set unistd.h i_unistd
7902 eval $inhdr
7903
7904 : see if getpgrp exists
7905 set getpgrp d_getpgrp
7906 eval $inlibc
7907
7908 case "$d_getpgrp" in
7909 "$define")
7910         echo " "
7911         echo "Checking to see which flavor of getpgrp is in use..."
7912         $cat >set.c <<EOP
7913 #$i_unistd I_UNISTD
7914 #include <sys/types.h>
7915 #ifdef I_UNISTD
7916 #  include <unistd.h>
7917 #endif
7918 int main()
7919 {
7920         if (getuid() == 0) {
7921                 printf("(I see you are running Configure as super-user...)\n");
7922                 setuid(1);
7923         }
7924 #ifdef TRY_BSD_PGRP
7925         if (getpgrp(1) == 0)
7926                 exit(0);
7927 #else
7928         if (getpgrp() > 0)
7929                 exit(0);
7930 #endif
7931         exit(1);
7932 }
7933 EOP
7934         if $cc -DTRY_BSD_PGRP $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7935                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
7936                 val="$define"
7937         elif $cc $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7938                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
7939                 val="$undef"
7940         else
7941                 echo "I can't seem to compile and run the test program."
7942                 if ./usg; then
7943                         xxx="a USG one, i.e. you use getpgrp()."
7944                 else
7945                         # SVR4 systems can appear rather BSD-ish.
7946                         case "$i_unistd" in
7947                         $undef)
7948                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
7949                                 val="$define"
7950                                 ;;
7951                         $define)
7952                                 xxx="probably a USG one, i.e. you use getpgrp()."
7953                                 val="$undef"
7954                                 ;;
7955                         esac
7956                 fi
7957                 echo "Assuming your getpgrp is $xxx" >&4
7958         fi
7959         ;;
7960 *) val="$undef";;
7961 esac
7962 set d_bsdgetpgrp
7963 eval $setvar
7964 $rm -f set set.c
7965
7966 : see if setpgrp exists
7967 set setpgrp d_setpgrp
7968 eval $inlibc
7969
7970 case "$d_setpgrp" in
7971 "$define")
7972         echo " "
7973         echo "Checking to see which flavor of setpgrp is in use..."
7974         $cat >set.c <<EOP
7975 #$i_unistd I_UNISTD
7976 #include <sys/types.h>
7977 #ifdef I_UNISTD
7978 #  include <unistd.h>
7979 #endif
7980 int main()
7981 {
7982         if (getuid() == 0) {
7983                 printf("(I see you are running Configure as super-user...)\n");
7984                 setuid(1);
7985         }
7986 #ifdef TRY_BSD_PGRP
7987         if (-1 == setpgrp(1, 1))
7988                 exit(0);
7989 #else
7990         if (setpgrp() != -1)
7991                 exit(0);
7992 #endif
7993         exit(1);
7994 }
7995 EOP
7996         if $cc -DTRY_BSD_PGRP $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7997                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
7998                 val="$define"
7999         elif $cc $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
8000                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
8001                 val="$undef"
8002         else
8003                 echo "(I can't seem to compile and run the test program.)"
8004                 if ./usg; then
8005                         xxx="a USG one, i.e. you use setpgrp()."
8006                 else
8007                         # SVR4 systems can appear rather BSD-ish.
8008                         case "$i_unistd" in
8009                         $undef)
8010                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
8011                                 val="$define"
8012                                 ;;
8013                         $define)
8014                                 xxx="probably a USG one, i.e. you use setpgrp()."
8015                                 val="$undef"
8016                                 ;;
8017                         esac
8018                 fi
8019                 echo "Assuming your setpgrp is $xxx" >&4
8020         fi
8021         ;;
8022 *) val="$undef";;
8023 esac
8024 set d_bsdsetpgrp
8025 eval $setvar
8026 $rm -f set set.c
8027 : see if bzero exists
8028 set bzero d_bzero
8029 eval $inlibc
8030
8031 : see if signal is declared as pointer to function returning int or void
8032 echo " "
8033 xxx=`./findhdr signal.h`
8034 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
8035 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
8036         echo "You have int (*signal())() instead of void." >&4
8037         val="$undef"
8038 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
8039         echo "You have void (*signal())()." >&4
8040         val="$define"
8041 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
8042         echo "You have int (*signal())() instead of void." >&4
8043         val="$undef"
8044 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
8045         echo "You have void (*signal())()." >&4
8046         val="$define"
8047 else
8048         case "$d_voidsig" in
8049         '')
8050         echo "I can't determine whether signal handler returns void or int..." >&4
8051                 dflt=void
8052                 rp="What type does your signal handler return?"
8053                 . ./myread
8054                 case "$ans" in
8055                 v*) val="$define";;
8056                 *) val="$undef";;
8057                 esac;;
8058         "$define")
8059                 echo "As you already told me, signal handler returns void." >&4
8060                 val="$define"
8061                 ;;
8062         *)      echo "As you already told me, signal handler returns int." >&4
8063                 val="$undef"
8064                 ;;
8065         esac
8066 fi
8067 set d_voidsig
8068 eval $setvar
8069 case "$d_voidsig" in
8070 "$define") signal_t="void";;
8071 *) signal_t="int";;
8072 esac
8073 $rm -f $$.tmp
8074
8075 : check for ability to cast large floats to 32-bit ints.
8076 echo " "
8077 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
8078 if $test "$intsize" -ge 4; then
8079         xxx=int
8080 else
8081         xxx=long
8082 fi
8083 $cat >try.c <<EOCP
8084 #include <stdio.h>
8085 #include <sys/types.h>
8086 #include <signal.h>
8087 $signal_t blech(s) int s; { exit(3); }
8088 int main()
8089 {
8090         $xxx i32;
8091         double f, g;
8092         int result = 0;
8093         char str[16];
8094         signal(SIGFPE, blech);
8095
8096         /* Don't let compiler optimize the test away.  Store the number 
8097            in a writable string for gcc to pass to sscanf under HP/UX.
8098         */
8099         sprintf(str, "2147483647");
8100         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
8101         g = 10 * f;
8102         i32  = ($xxx) g;
8103
8104         /* x86 processors will probably give 0x8000 0000, which is a
8105        sign change.  We don't want that.  We want to mimic SPARC
8106            behavior here, which is to preserve the sign and give
8107            back 0x7fff ffff.
8108         */
8109         if (i32 != ($xxx) f)
8110                 result |= 1;
8111         exit(result);
8112 }
8113 EOCP
8114 set try
8115 if eval $compile_ok; then
8116         ./try
8117         yyy=$?
8118 else
8119         echo "(I can't seem to compile the test program--assuming it can't)"
8120         yyy=1
8121 fi
8122 case "$yyy" in
8123 0)      val="$define"
8124         echo "Yup, it can."
8125         ;;
8126 *)      val="$undef"
8127         echo "Nope, it can't."
8128         ;;
8129 esac
8130 set d_casti32
8131 eval $setvar
8132 $rm -f try try.*
8133
8134 : check for ability to cast negative floats to unsigned
8135 echo " "
8136 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
8137 $cat >try.c <<EOCP
8138 #include <stdio.h>
8139 #include <sys/types.h>
8140 #include <signal.h>
8141 $signal_t blech(s) int s; { exit(7); }
8142 $signal_t blech_in_list(s) int s; { exit(4); }
8143 unsigned long dummy_long(p) unsigned long p; { return p; }
8144 unsigned int dummy_int(p) unsigned int p; { return p; }
8145 unsigned short dummy_short(p) unsigned short p; { return p; }
8146 int main()
8147 {
8148         double f;
8149         unsigned long along;
8150         unsigned int aint;
8151         unsigned short ashort;
8152         int result = 0;
8153         char str[16];
8154         
8155         /* Frustrate gcc-2.7.2's optimizer which failed this test with
8156            a direct f = -123. assignment.  gcc-2.8.0 reportedly
8157            optimized the whole file away
8158         */
8159         /* Store the number in a writable string for gcc to pass to 
8160            sscanf under HP/UX.
8161         */
8162         sprintf(str, "-123");
8163         sscanf(str, "%lf", &f);  /* f = -123.; */
8164
8165         signal(SIGFPE, blech);
8166         along = (unsigned long)f;
8167         aint = (unsigned int)f;
8168         ashort = (unsigned short)f;
8169         if (along != (unsigned long)-123)
8170                 result |= 1;
8171         if (aint != (unsigned int)-123)
8172                 result |= 1;
8173         if (ashort != (unsigned short)-123)
8174                 result |= 1;
8175         sprintf(str, "1073741824.");
8176         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
8177         f = f + f;
8178         along = 0;
8179         along = (unsigned long)f;
8180         if (along != 0x80000000)
8181                 result |= 2;
8182         f -= 1.;
8183         along = 0;
8184         along = (unsigned long)f;
8185         if (along != 0x7fffffff)
8186                 result |= 1;
8187         f += 2.;
8188         along = 0;
8189         along = (unsigned long)f;
8190         if (along != 0x80000001)
8191                 result |= 2;
8192         if (result)
8193                 exit(result);
8194         signal(SIGFPE, blech_in_list);
8195         sprintf(str, "123.");
8196         sscanf(str, "%lf", &f);  /* f = 123.; */
8197         along = dummy_long((unsigned long)f);
8198         aint = dummy_int((unsigned int)f);
8199         ashort = dummy_short((unsigned short)f);
8200         if (along != (unsigned long)123)
8201                 result |= 4;
8202         if (aint != (unsigned int)123)
8203                 result |= 4;
8204         if (ashort != (unsigned short)123)
8205                 result |= 4;
8206         exit(result);
8207
8208 }
8209 EOCP
8210 set try
8211 if eval $compile_ok; then
8212         ./try
8213         castflags=$?
8214 else
8215         echo "(I can't seem to compile the test program--assuming it can't)"
8216         castflags=7
8217 fi
8218 case "$castflags" in
8219 0)      val="$define"
8220         echo "Yup, it can."
8221         ;;
8222 *)      val="$undef"
8223         echo "Nope, it can't."
8224         ;;
8225 esac
8226 set d_castneg
8227 eval $setvar
8228 $rm -f try.*
8229
8230 : see if vprintf exists
8231 echo " "
8232 if set vprintf val -f d_vprintf; eval $csym; $val; then
8233         echo 'vprintf() found.' >&4
8234         val="$define"
8235         $cat >vprintf.c <<'EOF'
8236 #include <varargs.h>
8237
8238 int main() { xxx("foo"); }
8239
8240 xxx(va_alist)
8241 va_dcl
8242 {
8243         va_list args;
8244         char buf[10];
8245
8246         va_start(args);
8247         exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
8248 }
8249 EOF
8250         set vprintf
8251         if eval $compile && ./vprintf; then
8252                 echo "Your vsprintf() returns (int)." >&4
8253                 val2="$undef"
8254         else
8255                 echo "Your vsprintf() returns (char*)." >&4
8256                 val2="$define"
8257         fi
8258 else
8259         echo 'vprintf() NOT found.' >&4
8260                 val="$undef"
8261                 val2="$undef"
8262 fi
8263 set d_vprintf
8264 eval $setvar
8265 val=$val2
8266 set d_charvspr
8267 eval $setvar
8268
8269 : see if chown exists
8270 set chown d_chown
8271 eval $inlibc
8272
8273 : see if chroot exists
8274 set chroot d_chroot
8275 eval $inlibc
8276
8277 : see if chsize exists
8278 set chsize d_chsize
8279 eval $inlibc
8280
8281 : check for const keyword
8282 echo " "
8283 echo 'Checking to see if your C compiler knows about "const"...' >&4
8284 $cat >const.c <<'EOCP'
8285 typedef struct spug { int drokk; } spug;
8286 int main()
8287 {
8288         const char *foo;
8289         const spug y;
8290 }
8291 EOCP
8292 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
8293         val="$define"
8294         echo "Yup, it does."
8295 else
8296         val="$undef"
8297         echo "Nope, it doesn't."
8298 fi
8299 set d_const
8300 eval $setvar
8301
8302 : see if crypt exists
8303 echo " "
8304 if set crypt val -f d_crypt; eval $csym; $val; then
8305         echo 'crypt() found.' >&4
8306         val="$define"
8307         cryptlib=''
8308 else
8309         cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
8310         if $test -z "$cryptlib"; then
8311                 cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
8312         else
8313                 cryptlib=-lcrypt
8314         fi
8315         if $test -z "$cryptlib"; then
8316                 cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
8317         else
8318                 cryptlib=-lcrypt
8319         fi
8320         if $test -z "$cryptlib"; then
8321                 cryptlib=`./loc libcrypt$_a "" $libpth`
8322         else
8323                 cryptlib=-lcrypt
8324         fi
8325         if $test -z "$cryptlib"; then
8326                 echo 'crypt() NOT found.' >&4
8327                 val="$undef"
8328         else
8329                 val="$define"
8330         fi
8331 fi
8332 set d_crypt
8333 eval $setvar
8334
8335 : get csh whereabouts
8336 case "$csh" in
8337 'csh') val="$undef" ;;
8338 *) val="$define" ;;
8339 esac
8340 set d_csh
8341 eval $setvar
8342 : Respect a hint or command line value for full_csh.
8343 case "$full_csh" in
8344 '') full_csh=$csh ;;
8345 esac
8346
8347 : see if cuserid exists
8348 set cuserid d_cuserid
8349 eval $inlibc
8350
8351 : see if this is a limits.h system
8352 set limits.h i_limits
8353 eval $inhdr
8354
8355 : see if this is a float.h system
8356 set float.h i_float
8357 eval $inhdr
8358
8359 : See if number of significant digits in a double precision number is known
8360 echo " "
8361 $cat >dbl_dig.c <<EOM
8362 #$i_limits I_LIMITS
8363 #$i_float I_FLOAT
8364 #ifdef I_LIMITS
8365 #include <limits.h>
8366 #endif
8367 #ifdef I_FLOAT
8368 #include <float.h>
8369 #endif
8370 #ifdef DBL_DIG
8371 printf("Contains DBL_DIG");
8372 #endif
8373 EOM
8374 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
8375 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
8376         echo "DBL_DIG found." >&4
8377         val="$define"
8378 else
8379         echo "DBL_DIG NOT found." >&4
8380         val="$undef"
8381 fi
8382 $rm -f dbl_dig.?
8383 set d_dbl_dig
8384 eval $setvar
8385
8386 : see if difftime exists
8387 set difftime d_difftime
8388 eval $inlibc
8389
8390 : see if this is a dirent system
8391 echo " "
8392 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
8393         val="$define"
8394         echo "<dirent.h> found." >&4
8395 else
8396         val="$undef"
8397         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
8398                 echo "<sys/dir.h> found." >&4
8399                 echo " "
8400         else
8401                 xinc=`./findhdr sys/ndir.h`
8402         fi
8403         echo "<dirent.h> NOT found." >&4
8404 fi
8405 set i_dirent
8406 eval $setvar
8407
8408 : Look for type of directory structure.
8409 echo " "
8410 $cppstdin $cppflags $cppminus < "$xinc" > try.c
8411
8412 case "$direntrytype" in
8413 ''|' ')
8414         case "$i_dirent" in
8415         $define) guess1='struct dirent' ;;
8416         *) guess1='struct direct'  ;;
8417         esac
8418         ;;
8419 *)      guess1="$direntrytype"
8420         ;;
8421 esac
8422
8423 case "$guess1" in
8424 'struct dirent') guess2='struct direct' ;;
8425 *) guess2='struct dirent' ;;
8426 esac
8427                 
8428 if $contains "$guess1" try.c >/dev/null 2>&1; then
8429         direntrytype="$guess1"
8430         echo "Your directory entries are $direntrytype." >&4
8431 elif $contains "$guess2" try.c >/dev/null 2>&1; then
8432         direntrytype="$guess2"
8433         echo "Your directory entries seem to be $direntrytype." >&4
8434 else
8435         echo "I don't recognize your system's directory entries." >&4
8436         rp="What type is used for directory entries on this system?"
8437         dflt="$guess1"
8438         . ./myread
8439         direntrytype="$ans"
8440 fi
8441 $rm -f try.c
8442
8443
8444 : see if the directory entry stores field length
8445 echo " "
8446 $cppstdin $cppflags $cppminus < "$xinc" > try.c
8447 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
8448         echo "Good, your directory entry keeps length information in d_namlen." >&4
8449         val="$define"
8450 else
8451         echo "Your directory entry does not know about the d_namlen field." >&4
8452         val="$undef"
8453 fi
8454 set d_dirnamlen
8455 eval $setvar
8456 $rm -f try.c
8457
8458 : see if dlerror exists
8459 xxx_runnm="$runnm"
8460 runnm=false
8461 set dlerror d_dlerror
8462 eval $inlibc
8463 runnm="$xxx_runnm"
8464
8465 : see if dlfcn is available
8466 set dlfcn.h i_dlfcn
8467 eval $inhdr
8468
8469 case "$usedl" in
8470 $define|y|true)
8471         $cat << EOM
8472
8473 On a few systems, the dynamically loaded modules that perl generates and uses
8474 will need a different extension than shared libs. The default will probably
8475 be appropriate.
8476
8477 EOM
8478         case "$dlext" in
8479         '')     dflt="$so" ;;
8480         *)      dflt="$dlext" ;;
8481         esac
8482         rp='What is the extension of dynamically loaded modules'
8483         . ./myread
8484         dlext="$ans"
8485         ;;
8486 *)
8487         dlext="none"
8488         ;;
8489 esac
8490
8491 : Check if dlsym need a leading underscore
8492 echo " "
8493 val="$undef"
8494
8495 case "$dlsrc" in
8496 dl_dlopen.xs)
8497         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
8498         $cat >dyna.c <<'EOM'
8499 fred () { }
8500 EOM
8501
8502 $cat >fred.c<<EOM
8503
8504 #include <stdio.h>
8505 #$i_dlfcn I_DLFCN
8506 #ifdef I_DLFCN
8507 #include <dlfcn.h>      /* the dynamic linker include file for Sunos/Solaris */
8508 #else
8509 #include <sys/types.h>
8510 #include <nlist.h>
8511 #include <link.h>
8512 #endif
8513
8514 extern int fred() ;
8515
8516 int main()
8517 {
8518     void * handle ;
8519     void * symbol ;
8520 #ifndef RTLD_LAZY
8521     int mode = 1 ;
8522 #else
8523     int mode = RTLD_LAZY ;
8524 #endif
8525     handle = dlopen("./dyna.$dlext", mode) ;
8526     if (handle == NULL) {
8527         printf ("1\n") ;
8528         fflush (stdout) ;
8529         exit(0);
8530     }
8531     symbol = dlsym(handle, "fred") ;
8532     if (symbol == NULL) {
8533         /* try putting a leading underscore */
8534         symbol = dlsym(handle, "_fred") ;
8535         if (symbol == NULL) {
8536             printf ("2\n") ;
8537             fflush (stdout) ;
8538             exit(0);
8539         }
8540         printf ("3\n") ;
8541     }
8542     else
8543         printf ("4\n") ;
8544     fflush (stdout) ;
8545     exit(0);
8546 }
8547 EOM
8548         : Call the object file tmp-dyna.o in case dlext=o.
8549         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 && 
8550                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 && 
8551                 $ld $lddlflags -o dyna.$dlext tmp-dyna${_o} > /dev/null 2>&1 && 
8552                 $cc $ccflags -o fred $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1; then
8553                 xxx=`./fred`
8554                 case $xxx in
8555                 1)      echo "Test program failed using dlopen." >&4
8556                         echo "Perhaps you should not use dynamic loading." >&4;;
8557                 2)      echo "Test program failed using dlsym." >&4
8558                         echo "Perhaps you should not use dynamic loading." >&4;;
8559                 3)      echo "dlsym needs a leading underscore" >&4
8560                         val="$define" ;;
8561                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
8562                 esac
8563         else
8564                 echo "I can't compile and run the test program." >&4
8565                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
8566         fi
8567         ;;
8568 esac
8569                 
8570 $rm -f fred fred.? dyna.$dlext dyna.? tmp-dyna.?
8571
8572 set d_dlsymun
8573 eval $setvar
8574
8575 hasproto='varname=$1; func=$2; shift; shift;
8576 while $test $# -ge 2; do
8577         case "$1" in
8578         $define) echo "#include <$2>";;
8579         esac ;
8580     shift 2;
8581 done > try.c;
8582 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
8583 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
8584         echo "$func() prototype found.";
8585         val="$define";
8586 else
8587         echo "$func() prototype NOT found.";
8588         val="$undef";
8589 fi;
8590 set $varname;
8591 eval $setvar;
8592 $rm -f try.c tryout.c'
8593
8594 : see if prototype for drand48 is available
8595 echo " "
8596 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
8597 eval $hasproto
8598
8599 : see if dup2 exists
8600 set dup2 d_dup2
8601 eval $inlibc
8602
8603 : see if eaccess exists
8604 set eaccess d_eaccess
8605 eval $inlibc
8606
8607 : see if endgrent exists
8608 set endgrent d_endgrent
8609 eval $inlibc
8610
8611 : see if endhostent exists
8612 set endhostent d_endhent
8613 eval $inlibc
8614
8615 : see if endnetent exists
8616 set endnetent d_endnent
8617 eval $inlibc
8618
8619 : see if endprotoent exists
8620 set endprotoent d_endpent
8621 eval $inlibc
8622
8623 : see if endpwent exists
8624 set endpwent d_endpwent
8625 eval $inlibc
8626
8627 : see if endservent exists
8628 set endservent d_endsent
8629 eval $inlibc
8630
8631 : Locate the flags for 'open()'
8632 echo " "
8633 $cat >open3.c <<'EOCP'
8634 #include <sys/types.h>
8635 #ifdef I_FCNTL
8636 #include <fcntl.h>
8637 #endif
8638 #ifdef I_SYS_FILE
8639 #include <sys/file.h>
8640 #endif
8641 int main() {
8642         if(O_RDONLY);
8643 #ifdef O_TRUNC
8644         exit(0);
8645 #else
8646         exit(1);
8647 #endif
8648 }
8649 EOCP
8650 : check sys/file.h first to get FREAD on Sun
8651 if $test `./findhdr sys/file.h` && \
8652                 set open3 -DI_SYS_FILE && eval $compile; then
8653         h_sysfile=true;
8654         echo "<sys/file.h> defines the O_* constants..." >&4
8655         if ./open3; then
8656                 echo "and you have the 3 argument form of open()." >&4
8657                 val="$define"
8658         else
8659                 echo "but not the 3 argument form of open().  Oh, well." >&4
8660                 val="$undef"
8661         fi
8662 elif $test `./findhdr fcntl.h` && \
8663                 set open3 -DI_FCNTL && eval $compile; then
8664         h_fcntl=true;
8665         echo "<fcntl.h> defines the O_* constants..." >&4
8666         if ./open3; then
8667                 echo "and you have the 3 argument form of open()." >&4
8668                 val="$define"
8669         else
8670                 echo "but not the 3 argument form of open().  Oh, well." >&4
8671                 val="$undef"
8672         fi
8673 else
8674         val="$undef"
8675         echo "I can't find the O_* constant definitions!  You got problems." >&4
8676 fi
8677 set d_open3
8678 eval $setvar
8679 $rm -f open3*
8680
8681 : see which of string.h or strings.h is needed
8682 echo " "
8683 strings=`./findhdr string.h`
8684 if $test "$strings" && $test -r "$strings"; then
8685         echo "Using <string.h> instead of <strings.h>." >&4
8686         val="$define"
8687 else
8688         val="$undef"
8689         strings=`./findhdr strings.h`
8690         if $test "$strings" && $test -r "$strings"; then
8691                 echo "Using <strings.h> instead of <string.h>." >&4
8692         else
8693                 echo "No string header found -- You'll surely have problems." >&4
8694         fi
8695 fi
8696 set i_string
8697 eval $setvar
8698 case "$i_string" in
8699 "$undef") strings=`./findhdr strings.h`;;
8700 *)        strings=`./findhdr string.h`;;
8701 esac
8702
8703 : check for non-blocking I/O stuff
8704 case "$h_sysfile" in
8705 true) echo "#include <sys/file.h>" > head.c;;
8706 *)
8707         case "$h_fcntl" in
8708         true) echo "#include <fcntl.h>" > head.c;;
8709         *) echo "#include <sys/fcntl.h>" > head.c;;
8710         esac
8711         ;;
8712 esac
8713 echo " "
8714 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
8715 case "$o_nonblock" in
8716 '')
8717         $cat head.c > try.c
8718         $cat >>try.c <<'EOCP'
8719 #include <stdio.h>
8720 int main() {
8721 #ifdef O_NONBLOCK
8722         printf("O_NONBLOCK\n");
8723         exit(0);
8724 #endif
8725 #ifdef O_NDELAY
8726         printf("O_NDELAY\n");
8727         exit(0);
8728 #endif
8729 #ifdef FNDELAY
8730         printf("FNDELAY\n");
8731         exit(0);
8732 #endif
8733         exit(0);
8734 }
8735 EOCP
8736         set try
8737         if eval $compile_ok; then
8738                 o_nonblock=`./try`
8739                 case "$o_nonblock" in
8740                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
8741                 *) echo "Seems like we can use $o_nonblock.";;
8742                 esac
8743         else
8744                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
8745         fi
8746         ;;
8747 *) echo "Using $hint value $o_nonblock.";;
8748 esac
8749 $rm -f try try.* .out core
8750
8751 echo " "
8752 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
8753 case "$eagain" in
8754 '')
8755         $cat head.c > try.c
8756         $cat >>try.c <<EOCP
8757 #include <errno.h>
8758 #include <sys/types.h>
8759 #include <signal.h>
8760 #include <stdio.h> 
8761 #define MY_O_NONBLOCK $o_nonblock
8762 #ifndef errno  /* XXX need better Configure test */
8763 extern int errno;
8764 #endif
8765 #$i_unistd I_UNISTD
8766 #ifdef I_UNISTD
8767 #include <unistd.h>
8768 #endif
8769 #$i_string I_STRING
8770 #ifdef I_STRING
8771 #include <string.h>
8772 #else
8773 #include <strings.h>
8774 #endif
8775 $signal_t blech(x) int x; { exit(3); }
8776 EOCP
8777         $cat >> try.c <<'EOCP'
8778 int main()
8779 {
8780         int pd[2];
8781         int pu[2];
8782         char buf[1];
8783         char string[100];
8784
8785         pipe(pd);       /* Down: child -> parent */
8786         pipe(pu);       /* Up: parent -> child */
8787         if (0 != fork()) {
8788                 int ret;
8789                 close(pd[1]);   /* Parent reads from pd[0] */
8790                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
8791                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
8792                         exit(1);
8793                 signal(SIGALRM, blech);
8794                 alarm(5);
8795                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
8796                         exit(2);
8797                 sprintf(string, "%d\n", ret);
8798                 write(2, string, strlen(string));
8799                 alarm(0);
8800 #ifdef EAGAIN
8801                 if (errno == EAGAIN) {
8802                         printf("EAGAIN\n");
8803                         goto ok;
8804                 }
8805 #endif
8806 #ifdef EWOULDBLOCK
8807                 if (errno == EWOULDBLOCK)
8808                         printf("EWOULDBLOCK\n");
8809 #endif
8810         ok:
8811                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
8812                 sleep(2);                               /* Give it time to close our pipe */
8813                 alarm(5);
8814                 ret = read(pd[0], buf, 1);      /* Should read EOF */
8815                 alarm(0);
8816                 sprintf(string, "%d\n", ret);
8817                 write(3, string, strlen(string));
8818                 exit(0);
8819         }
8820
8821         close(pd[0]);                   /* We write to pd[1] */
8822         close(pu[1]);                   /* We read from pu[0] */
8823         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
8824         close(pd[1]);                   /* Pipe pd is now fully closed! */
8825         exit(0);                                /* Bye bye, thank you for playing! */
8826 }
8827 EOCP
8828         set try
8829         if eval $compile_ok; then
8830                 echo "$startsh" >mtry
8831                 echo "./try >try.out 2>try.ret 3>try.err || exit 4" >>mtry
8832                 chmod +x mtry
8833                 ./mtry >/dev/null 2>&1
8834                 case $? in
8835                 0) eagain=`$cat try.out`;;
8836                 1) echo "Could not perform non-blocking setting!";;
8837                 2) echo "I did a successful read() for something that was not there!";;
8838                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
8839                 *) echo "Something terribly wrong happened during testing.";;
8840                 esac
8841                 rd_nodata=`$cat try.ret`
8842                 echo "A read() system call with no data present returns $rd_nodata."
8843                 case "$rd_nodata" in
8844                 0|-1) ;;
8845                 *)
8846                         echo "(That's peculiar, fixing that to be -1.)"
8847                         rd_nodata=-1
8848                         ;;
8849                 esac
8850                 case "$eagain" in
8851                 '')
8852                         echo "Forcing errno EAGAIN on read() with no data available."
8853                         eagain=EAGAIN
8854                         ;;
8855                 *)
8856                         echo "Your read() sets errno to $eagain when no data is available."
8857                         ;;
8858                 esac
8859                 status=`$cat try.err`
8860                 case "$status" in
8861                 0) echo "And it correctly returns 0 to signal EOF.";;
8862                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
8863                 *) echo "However, your read() returns '$status' on EOF??";;
8864                 esac
8865                 val="$define"
8866                 if test "$status" = "$rd_nodata"; then
8867                         echo "WARNING: you can't distinguish between EOF and no data!"
8868                         val="$undef"
8869                 fi
8870         else
8871                 echo "I can't compile the test program--assuming errno EAGAIN will do."
8872                 eagain=EAGAIN
8873         fi
8874         set d_eofnblk
8875         eval $setvar
8876         ;;
8877 *)
8878         echo "Using $hint value $eagain."
8879         echo "Your read() returns $rd_nodata when no data is present."
8880         case "$d_eofnblk" in
8881         "$define") echo "And you can see EOF because read() returns 0.";;
8882         "$undef") echo "But you can't see EOF status from read() returned value.";;
8883         *)
8884                 echo "(Assuming you can't see EOF status from read anyway.)"
8885                 d_eofnblk=$undef
8886                 ;;
8887         esac
8888         ;;
8889 esac
8890 $rm -f try try.* .out core head.c mtry
8891
8892 : see if fchmod exists
8893 set fchmod d_fchmod
8894 eval $inlibc
8895
8896 : see if fchown exists
8897 set fchown d_fchown
8898 eval $inlibc
8899
8900 : see if this is an fcntl system
8901 set fcntl d_fcntl
8902 eval $inlibc
8903
8904 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
8905 while $test $# -ge 2; do
8906         case "$1" in
8907         $define) echo "#include <$2>";;
8908         esac ;
8909     shift 2;
8910 done > try.c;
8911 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
8912 set try;
8913 if eval $compile; then
8914         val="$define";
8915 else
8916         val="$undef";
8917 fi;
8918 set $varname;
8919 eval $setvar;
8920 $rm -f try.c try.o'
8921
8922 socketlib=''
8923 sockethdr=''
8924 : see whether socket exists
8925 echo " "
8926 $echo $n "Hmm... $c" >&4
8927 if set socket val -f d_socket; eval $csym; $val; then
8928         echo "Looks like you have Berkeley networking support." >&4
8929         d_socket="$define"
8930         if set setsockopt val -f; eval $csym; $val; then
8931                 d_oldsock="$undef"
8932         else
8933                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
8934                 d_oldsock="$define"
8935         fi
8936 else
8937         if $contains socklib libc.list >/dev/null 2>&1; then
8938                 echo "Looks like you have Berkeley networking support." >&4
8939                 d_socket="$define"
8940                 : we will have to assume that it supports the 4.2 BSD interface
8941                 d_oldsock="$undef"
8942         else
8943                 echo "You don't have Berkeley networking in libc$_a..." >&4
8944                 if test "X$d_socket" = "X$define"; then
8945                    echo "...but you seem to believe that you have sockets." >&4
8946                 else
8947                         for net in net socket
8948                         do
8949                                 if test -f /usr/lib/lib$net$_a; then
8950                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
8951                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
8952                                         if $contains socket libc.list >/dev/null 2>&1; then
8953                                                 d_socket="$define"
8954                                                 socketlib="-l$net"
8955                                                 case "$net" in
8956                                                 net)
8957                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
8958                                                         sockethdr="-I/usr/netinclude"
8959                                                         ;;
8960                                                 esac
8961                                                 echo "Found Berkeley sockets interface in lib$net." >& 4 
8962                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
8963                                                         d_oldsock="$undef"
8964                                                 else
8965                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
8966                                                         d_oldsock="$define"
8967                                                 fi
8968                                                 break
8969                                         fi
8970                                 fi
8971                         done
8972                         if test "X$d_socket" != "X$define"; then
8973                            echo "or anywhere else I see." >&4
8974                            d_socket="$undef"
8975                            d_oldsock="$undef"
8976                         fi
8977                 fi
8978         fi
8979 fi
8980
8981 : see if socketpair exists
8982 set socketpair d_sockpair
8983 eval $inlibc
8984
8985
8986 echo " "
8987 echo "Checking the availability of certain socket constants..." >& 4
8988 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
8989         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
8990         $cat >try.c <<EOF
8991 #include <sys/types.h>
8992 #include <sys/socket.h>
8993 int main() {
8994     int i = $ENUM;
8995 }
8996 EOF
8997         val="$undef"
8998         set try; if eval $compile; then
8999                 val="$define"
9000         fi
9001         set d_${enum}; eval $setvar
9002         $rm -f try.c try
9003 done
9004
9005 : see if sys/select.h has to be included
9006 set sys/select.h i_sysselct
9007 eval $inhdr
9008
9009 : see if we should include time.h, sys/time.h, or both
9010 echo " "
9011 if test "X$timeincl" = X; then
9012         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
9013         $echo $n "I'm now running the test program...$c"
9014         $cat >try.c <<'EOCP'
9015 #include <sys/types.h>
9016 #ifdef I_TIME
9017 #include <time.h>
9018 #endif
9019 #ifdef I_SYSTIME
9020 #ifdef SYSTIMEKERNEL
9021 #define KERNEL
9022 #endif
9023 #include <sys/time.h>
9024 #endif
9025 #ifdef I_SYSSELECT
9026 #include <sys/select.h>
9027 #endif
9028 int main()
9029 {
9030         struct tm foo;
9031 #ifdef S_TIMEVAL
9032         struct timeval bar;
9033 #endif
9034 #ifdef S_TIMEZONE
9035         struct timezone tzp;
9036 #endif
9037         if (foo.tm_sec == foo.tm_sec)
9038                 exit(0);
9039 #ifdef S_TIMEVAL
9040         if (bar.tv_sec == bar.tv_sec)
9041                 exit(0);
9042 #endif
9043         exit(1);
9044 }
9045 EOCP
9046         flags=''
9047         for s_timezone in '-DS_TIMEZONE' ''; do
9048         sysselect=''
9049         for s_timeval in '-DS_TIMEVAL' ''; do
9050         for i_systimek in '' '-DSYSTIMEKERNEL'; do
9051         for i_time in '' '-DI_TIME'; do
9052         for i_systime in '-DI_SYSTIME' ''; do
9053                 case "$flags" in
9054                 '') $echo $n ".$c"
9055                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
9056                         if eval $compile; then
9057                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
9058                                 shift
9059                                 flags="$*"
9060                                 echo " "
9061                                 $echo $n "Succeeded with $flags$c"
9062                         fi
9063                         ;;
9064                 esac
9065         done
9066         done
9067         done
9068         done
9069         done
9070         timeincl=''
9071         echo " "
9072         case "$flags" in
9073         *SYSTIMEKERNEL*) i_systimek="$define"
9074                 timeincl=`./findhdr sys/time.h`
9075                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
9076         *) i_systimek="$undef";;
9077         esac
9078         case "$flags" in
9079         *I_TIME*) i_time="$define"
9080                 timeincl=`./findhdr time.h`" $timeincl"
9081                 echo "We'll include <time.h>." >&4;;
9082         *) i_time="$undef";;
9083         esac
9084         case "$flags" in
9085         *I_SYSTIME*) i_systime="$define"
9086                 timeincl=`./findhdr sys/time.h`" $timeincl"
9087                 echo "We'll include <sys/time.h>." >&4;;
9088         *) i_systime="$undef";;
9089         esac
9090         $rm -f try.c try
9091 fi
9092
9093 : check for fd_set items
9094 $cat <<EOM
9095
9096 Checking to see how well your C compiler handles fd_set and friends ...
9097 EOM
9098 $cat >fd_set.c <<EOCP
9099 #$i_systime I_SYS_TIME
9100 #$i_sysselct I_SYS_SELECT
9101 #$d_socket HAS_SOCKET
9102 #include <sys/types.h>
9103 #ifdef HAS_SOCKET
9104 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
9105 #endif
9106 #ifdef I_SYS_TIME
9107 #include <sys/time.h>
9108 #endif
9109 #ifdef I_SYS_SELECT
9110 #include <sys/select.h>
9111 #endif
9112 int main() {
9113         fd_set fds;
9114
9115 #ifdef TRYBITS
9116         if(fds.fds_bits);
9117 #endif
9118
9119 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
9120         exit(0);
9121 #else
9122         exit(1);
9123 #endif
9124 }
9125 EOCP
9126 set fd_set -DTRYBITS
9127 if eval $compile; then
9128         d_fds_bits="$define"
9129         d_fd_set="$define"
9130         echo "Well, your system knows about the normal fd_set typedef..." >&4
9131         if ./fd_set; then
9132                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
9133                 d_fd_macros="$define"
9134         else
9135                 $cat >&4 <<'EOM'
9136 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
9137 EOM
9138                 d_fd_macros="$undef"
9139         fi
9140 else
9141         $cat <<'EOM'
9142 Hmm, your compiler has some difficulty with fd_set.  Checking further...
9143 EOM
9144         set fd_set
9145         if eval $compile; then
9146                 d_fds_bits="$undef"
9147                 d_fd_set="$define"
9148                 echo "Well, your system has some sort of fd_set available..." >&4
9149                 if ./fd_set; then
9150                         echo "and you have the normal fd_set macros." >&4
9151                         d_fd_macros="$define"
9152                 else
9153                         $cat <<'EOM'
9154 but not the normal fd_set macros!  Gross!  More work for me...
9155 EOM
9156                         d_fd_macros="$undef"
9157                 fi
9158         else
9159         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
9160                 d_fd_set="$undef"
9161                 d_fds_bits="$undef"
9162                 d_fd_macros="$undef"
9163         fi
9164 fi
9165 $rm -f fd_set*
9166
9167 : see if fgetpos exists
9168 set fgetpos d_fgetpos
9169 eval $inlibc
9170
9171 : see if flock exists
9172 set flock d_flock
9173 eval $inlibc
9174
9175 : see if fork exists
9176 set fork d_fork
9177 eval $inlibc
9178
9179 : see if pathconf exists
9180 set pathconf d_pathconf
9181 eval $inlibc
9182
9183 : see if fpathconf exists
9184 set fpathconf d_fpathconf
9185 eval $inlibc
9186
9187
9188 : check for fpos64_t
9189 echo " "
9190 echo "Checking to see if you have fpos64_t..." >&4
9191 $cat >try.c <<EOCP
9192 #include <stdio.h>
9193 int main() { fpos64_t x = 7; }
9194 EOCP
9195 set try
9196 if eval $compile; then
9197         val="$define"
9198         echo "You have fpos64_t."
9199 else
9200         val="$undef"
9201         echo "You do not have fpos64_t."
9202         case "$fpossize" in
9203         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
9204         esac
9205 fi
9206 $rm -f try.* try
9207 set d_fpos64_t
9208 eval $setvar
9209
9210 : see if frexpl exists
9211 set frexpl d_frexpl
9212 eval $inlibc
9213
9214 hasstruct='varname=$1; struct=$2; shift; shift;
9215 while $test $# -ge 2; do
9216         case "$1" in
9217         $define) echo "#include <$2>";;
9218         esac ;
9219     shift 2;
9220 done > try.c;
9221 echo "int main () { struct $struct foo; }" >> try.c;
9222 set try;
9223 if eval $compile; then
9224         val="$define";
9225 else
9226         val="$undef";
9227 fi;
9228 set $varname;
9229 eval $setvar;
9230 $rm -f try.c try.o'
9231
9232 : see if this is a sys/param system
9233 set sys/param.h i_sysparam
9234 eval $inhdr
9235
9236 : see if this is a sys/mount.h system
9237 set sys/mount.h i_sysmount
9238 eval $inhdr
9239
9240 : see if sys/types.h has to be included
9241 set sys/types.h i_systypes
9242 eval $inhdr
9243
9244
9245 echo " "
9246 echo "Checking to see if your system supports struct fs_data..." >&4
9247 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
9248 eval $hasstruct
9249 case "$d_fs_data_s" in
9250 "$define")      echo "Yes, it does."   ;;
9251 *)              echo "No, it doesn't." ;;
9252 esac
9253
9254 : see if fseeko exists
9255 set fseeko d_fseeko
9256 eval $inlibc
9257 case "$longsize" in
9258 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
9259 esac
9260
9261 : see if fsetpos exists
9262 set fsetpos d_fsetpos
9263 eval $inlibc
9264
9265
9266 : see if fstatfs exists
9267 set fstatfs d_fstatfs
9268 eval $inlibc
9269
9270
9271 : see if statvfs exists
9272 set statvfs d_statvfs
9273 eval $inlibc
9274
9275 : see if fstatvfs exists
9276 set fstatvfs d_fstatvfs
9277 eval $inlibc
9278
9279
9280 : see if ftello exists
9281 set ftello d_ftello
9282 eval $inlibc
9283 case "$longsize" in
9284 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
9285 esac
9286
9287 : see if getcwd exists
9288 set getcwd d_getcwd
9289 eval $inlibc
9290
9291 : see if getespwnam exists
9292 set getespwnam d_getespwnam
9293 eval $inlibc
9294
9295
9296 : see if getfsstat exists
9297 set getfsstat d_getfsstat
9298 eval $inlibc
9299
9300 : see if getgrent exists
9301 set getgrent d_getgrent
9302 eval $inlibc
9303
9304 : see if gethostbyaddr exists
9305 set gethostbyaddr d_gethbyaddr
9306 eval $inlibc
9307
9308 : see if gethostbyname exists
9309 set gethostbyname d_gethbyname
9310 eval $inlibc
9311
9312 : see if gethostent exists
9313 set gethostent d_gethent
9314 eval $inlibc
9315
9316 : see how we will look up host name
9317 echo " "
9318 call=''
9319 if set gethostname val -f d_gethname; eval $csym; $val; then
9320         echo 'gethostname() found.' >&4
9321         d_gethname="$define"
9322         call=gethostname
9323 fi
9324 if set uname val -f d_uname; eval $csym; $val; then
9325         if ./xenix; then
9326                 $cat <<'EOM'
9327 uname() was found, but you're running xenix, and older versions of xenix
9328 have a broken uname(). If you don't really know whether your xenix is old
9329 enough to have a broken system call, use the default answer.
9330
9331 EOM
9332                 dflt=y
9333                 case "$d_uname" in
9334                 "$define") dflt=n;;
9335                 esac
9336                 rp='Is your uname() broken?'
9337                 . ./myread
9338                 case "$ans" in
9339                 n*) d_uname="$define"; call=uname;;
9340                 esac
9341         else
9342                 echo 'uname() found.' >&4
9343                 d_uname="$define"
9344                 case "$call" in
9345                 '') call=uname ;;
9346                 esac
9347         fi
9348 fi
9349 case "$d_gethname" in
9350 '') d_gethname="$undef";;
9351 esac
9352 case "$d_uname" in
9353 '') d_uname="$undef";;
9354 esac
9355 case "$d_uname$d_gethname" in
9356 *define*)
9357         dflt=n
9358         cat <<EOM
9359  
9360 Every now and then someone has a $call() that lies about the hostname
9361 but can't be fixed for political or economic reasons.  If you wish, I can
9362 pretend $call() isn't there and maybe compute hostname at run-time
9363 thanks to the '$phostname' command.
9364
9365 EOM
9366         rp="Shall I ignore $call() from now on?"
9367         . ./myread
9368         case "$ans" in
9369         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
9370         esac;;
9371 esac
9372 case "$phostname" in
9373 '') aphostname='';;
9374 *) case "$aphostname" in
9375         /*) ;;
9376         *) set X $phostname
9377                 shift
9378                 file=$1
9379                 shift
9380                 file=`./loc $file $file $pth`
9381                 aphostname=`echo $file $*`
9382                 ;;
9383         esac
9384         ;;
9385 esac
9386 case "$d_uname$d_gethname" in
9387 *define*) ;;
9388 *)
9389         case "$phostname" in
9390         '')
9391                 echo "There will be no way for $package to get your hostname." >&4;;
9392         *)
9393         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
9394                 ;;
9395         esac;;
9396 esac
9397 case "$d_phostname" in
9398 '') d_phostname="$undef";;
9399 esac
9400
9401 : see if this is a netdb.h system
9402 set netdb.h i_netdb
9403 eval $inhdr
9404
9405 : see if prototypes for various gethostxxx netdb.h functions are available
9406 echo " "
9407 set d_gethostprotos gethostent $i_netdb netdb.h
9408 eval $hasproto
9409
9410 : see if getlogin exists
9411 set getlogin d_getlogin
9412 eval $inlibc
9413
9414 : see if getmnt exists
9415 set getmnt d_getmnt
9416 eval $inlibc
9417
9418 : see if getmntent exists
9419 set getmntent d_getmntent
9420 eval $inlibc
9421
9422 : see if getnetbyaddr exists
9423 set getnetbyaddr d_getnbyaddr
9424 eval $inlibc
9425
9426 : see if getnetbyname exists
9427 set getnetbyname d_getnbyname
9428 eval $inlibc
9429
9430 : see if getnetent exists
9431 set getnetent d_getnent
9432 eval $inlibc
9433
9434 : see if prototypes for various getnetxxx netdb.h functions are available
9435 echo " "
9436 set d_getnetprotos getnetent $i_netdb netdb.h
9437 eval $hasproto
9438
9439
9440 : see if getprotobyname exists
9441 set getprotobyname d_getpbyname
9442 eval $inlibc
9443
9444 : see if getprotobynumber exists
9445 set getprotobynumber d_getpbynumber
9446 eval $inlibc
9447
9448 : see if getprotoent exists
9449 set getprotoent d_getpent
9450 eval $inlibc
9451
9452 : see if getpgid exists
9453 set getpgid d_getpgid
9454 eval $inlibc
9455
9456 : see if getpgrp2 exists
9457 set getpgrp2 d_getpgrp2
9458 eval $inlibc
9459
9460 : see if getppid exists
9461 set getppid d_getppid
9462 eval $inlibc
9463
9464 : see if getpriority exists
9465 set getpriority d_getprior
9466 eval $inlibc
9467
9468 : see if prototypes for various getprotoxxx netdb.h functions are available
9469 echo " "
9470 set d_getprotoprotos getprotoent $i_netdb netdb.h
9471 eval $hasproto
9472
9473 : see if getprpwnam exists
9474 set getprpwnam d_getprpwnam
9475 eval $inlibc
9476
9477 : see if getpwent exists
9478 set getpwent d_getpwent
9479 eval $inlibc
9480
9481
9482 : see if getservbyname exists
9483 set getservbyname d_getsbyname
9484 eval $inlibc
9485
9486 : see if getservbyport exists
9487 set getservbyport d_getsbyport
9488 eval $inlibc
9489
9490 : see if getservent exists
9491 set getservent d_getsent
9492 eval $inlibc
9493
9494 : see if prototypes for various getservxxx netdb.h functions are available
9495 echo " "
9496 set d_getservprotos getservent $i_netdb netdb.h
9497 eval $hasproto
9498
9499 : see if getspnam exists
9500 set getspnam d_getspnam
9501 eval $inlibc
9502
9503 : see if gettimeofday or ftime exists
9504 set gettimeofday d_gettimeod
9505 eval $inlibc
9506 case "$d_gettimeod" in
9507 "$undef")
9508         set ftime d_ftime 
9509         eval $inlibc
9510         ;;
9511 *)
9512         val="$undef"; set d_ftime; eval $setvar
9513         ;;
9514 esac
9515 case "$d_gettimeod$d_ftime" in
9516 "$undef$undef")
9517         echo " "
9518         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
9519         ;;
9520 esac
9521
9522 : see if this is an grp system
9523 set grp.h i_grp
9524 eval $inhdr
9525
9526 case "$i_grp" in
9527 $define)
9528         xxx=`./findhdr grp.h`
9529         $cppstdin $cppflags $cppminus < $xxx >$$.h
9530
9531         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
9532                 val="$define"
9533         else
9534                 val="$undef"
9535         fi
9536         set d_grpasswd
9537         eval $setvar
9538
9539         $rm -f $$.h
9540         ;;
9541 *)
9542         val="$undef";
9543         set d_grpasswd; eval $setvar
9544         ;;
9545 esac
9546
9547 : see if hasmntopt exists
9548 set hasmntopt d_hasmntopt
9549 eval $inlibc
9550
9551 : see if this is a netinet/in.h or sys/in.h system
9552 set netinet/in.h i_niin sys/in.h i_sysin
9553 eval $inhdr
9554
9555 : see if arpa/inet.h has to be included
9556 set arpa/inet.h i_arpainet
9557 eval $inhdr
9558
9559 : see if htonl --and friends-- exists
9560 val=''
9561 set htonl val
9562 eval $inlibc
9563
9564 : Maybe they are macros.
9565 case "$val" in
9566 $undef)
9567         $cat >htonl.c <<EOM
9568 #include <stdio.h>
9569 #include <sys/types.h>
9570 #$i_niin I_NETINET_IN
9571 #$i_sysin I_SYS_IN
9572 #$i_arpainet I_ARPA_INET
9573 #ifdef I_NETINET_IN
9574 #include <netinet/in.h>
9575 #endif
9576 #ifdef I_SYS_IN
9577 #include <sys/in.h>
9578 #endif
9579 #ifdef I_ARPA_INET
9580 #include <arpa/inet.h>
9581 #endif
9582 #ifdef htonl
9583 printf("Defined as a macro.");
9584 #endif
9585 EOM
9586         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
9587         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
9588                 val="$define"
9589                 echo "But it seems to be defined as a macro." >&4
9590         fi
9591         $rm -f htonl.?
9592         ;;
9593 esac
9594 set d_htonl
9595 eval $setvar
9596
9597 : see if iconv exists
9598 set iconv d_iconv
9599 eval $inlibc
9600
9601 : index or strchr
9602 echo " "
9603 if set index val -f; eval $csym; $val; then
9604         if set strchr val -f d_strchr; eval $csym; $val; then
9605                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
9606                         val="$define"
9607                         vali="$undef"
9608                         echo "strchr() found." >&4
9609                 else
9610                         val="$undef"
9611                         vali="$define"
9612                         echo "index() found." >&4
9613                 fi
9614         else
9615                 val="$undef"
9616                 vali="$define"
9617                 echo "index() found." >&4
9618         fi
9619 else
9620         if set strchr val -f d_strchr; eval $csym; $val; then
9621                 val="$define"
9622                 vali="$undef"
9623                 echo "strchr() found." >&4
9624         else
9625                 echo "No index() or strchr() found!" >&4
9626                 val="$undef"
9627                 vali="$undef"
9628         fi
9629 fi
9630 set d_strchr; eval $setvar
9631 val="$vali"
9632 set d_index; eval $setvar
9633
9634 : check whether inet_aton exists
9635 set inet_aton d_inetaton
9636 eval $inlibc
9637
9638 : see if inttypes.h is available
9639 : we want a real compile instead of Inhdr because some systems
9640 : have an inttypes.h which includes non-existent headers
9641 echo " "
9642 $cat >try.c <<EOCP
9643 #include <inttypes.h>
9644 int main() {
9645         static int32_t foo32 = 0x12345678;
9646 }
9647 EOCP
9648 set try
9649 if eval $compile; then
9650         echo "<inttypes.h> found." >&4
9651         val="$define"
9652 else
9653         echo "<inttypes.h> NOT found." >&4
9654         val="$undef"
9655 fi
9656 $rm -f try.c try
9657 set i_inttypes
9658 eval $setvar
9659
9660 : check for int64_t
9661 echo " "
9662 echo "Checking to see if you have int64_t..." >&4
9663 $cat >try.c <<EOCP
9664 #include <sys/types.h>
9665 #$i_inttypes I_INTTYPES
9666 #ifdef I_INTTYPES
9667 #include <inttypes.h>
9668 #endif
9669 int main() { int64_t x = 7; }
9670 EOCP
9671 set try
9672 if eval $compile; then
9673         val="$define"
9674         echo "You have int64_t."
9675 else
9676         val="$undef"
9677         echo "You do not have int64_t."
9678 fi
9679 $rm -f try try.*
9680 set d_int64_t
9681 eval $setvar
9682
9683 : Look for isascii
9684 echo " "
9685 $cat >isascii.c <<'EOCP'
9686 #include <stdio.h>
9687 #include <ctype.h>
9688 int main() {
9689         int c = 'A';
9690         if (isascii(c))
9691                 exit(0);
9692         else
9693                 exit(1);
9694 }
9695 EOCP
9696 set isascii
9697 if eval $compile; then
9698         echo "isascii() found." >&4
9699         val="$define"
9700 else
9701         echo "isascii() NOT found." >&4
9702         val="$undef"
9703 fi
9704 set d_isascii
9705 eval $setvar
9706 $rm -f isascii*
9707
9708 : see if isnan exists
9709 set isnan d_isnan
9710 eval $inlibc
9711
9712 : see if isnanl exists
9713 set isnanl d_isnanl
9714 eval $inlibc
9715
9716 : see if killpg exists
9717 set killpg d_killpg
9718 eval $inlibc
9719
9720 : see if lchown exists
9721 echo " "
9722 $cat > try.c <<'EOCP'
9723 /* System header to define __stub macros and hopefully few prototypes,
9724     which can conflict with char lchown(); below.  */
9725 #include <assert.h>
9726 /* Override any gcc2 internal prototype to avoid an error.  */
9727 /* We use char because int might match the return type of a gcc2
9728    builtin and then its argument prototype would still apply.  */
9729 char lchown();
9730 int main() {
9731     /*  The GNU C library defines this for functions which it implements
9732         to always fail with ENOSYS.  Some functions are actually named
9733         something starting with __ and the normal name is an alias.  */
9734 #if defined (__stub_lchown) || defined (__stub___lchown)
9735 choke me
9736 #else
9737 lchown();
9738 #endif
9739 ; return 0; }
9740 EOCP
9741 set try
9742 if eval $compile; then
9743     $echo "lchown() found." >&4
9744     val="$define"
9745 else
9746     $echo "lchown() NOT found." >&4
9747     val="$undef"
9748 fi
9749 set d_lchown
9750 eval $setvar
9751
9752 : See if number of significant digits in a double precision number is known
9753 echo " "
9754 $cat >ldbl_dig.c <<EOM
9755 #$i_limits I_LIMITS
9756 #$i_float I_FLOAT
9757 #ifdef I_LIMITS
9758 #include <limits.h>
9759 #endif
9760 #ifdef I_FLOAT
9761 #include <float.h>
9762 #endif
9763 #ifdef LDBL_DIG
9764 printf("Contains LDBL_DIG");
9765 #endif
9766 EOM
9767 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
9768 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
9769         echo "LDBL_DIG found." >&4
9770         val="$define"
9771 else
9772         echo "LDBL_DIG NOT found." >&4
9773         val="$undef"
9774 fi
9775 $rm -f ldbl_dig.?
9776 set d_ldbl_dig
9777 eval $setvar
9778
9779 : see if link exists
9780 set link d_link
9781 eval $inlibc
9782
9783 : see if localeconv exists
9784 set localeconv d_locconv
9785 eval $inlibc
9786
9787 : see if lockf exists
9788 set lockf d_lockf
9789 eval $inlibc
9790
9791 : check for long long
9792 echo " "
9793 echo "Checking to see if you have long long..." >&4
9794 echo 'int main() { long long x = 7; return 0; }' > try.c
9795 set try
9796 if eval $compile; then
9797         val="$define"
9798         echo "You have long long."
9799 else
9800         val="$undef"
9801         echo "You do not have long long."
9802 fi
9803 $rm try.*
9804 set d_longlong
9805 eval $setvar
9806
9807 : check for length of long long
9808 case "${d_longlong}${longlongsize}" in
9809 $define)
9810         echo " "
9811         echo "Checking to see how big your long longs are..." >&4
9812         $cat >try.c <<'EOCP'
9813 #include <stdio.h>
9814 int main()
9815 {
9816     printf("%d\n", (int)sizeof(long long));
9817     return(0);
9818 }
9819 EOCP
9820         set try
9821         if eval $compile_ok; then
9822                 longlongsize=`./try$exe_ext`
9823                 echo "Your long longs are $longlongsize bytes long."
9824         else
9825                 dflt='8'
9826                 echo " "
9827                 echo "(I can't seem to compile the test program.  Guessing...)"
9828                 rp="What is the size of a long long (in bytes)?"
9829                 . ./myread
9830                 longlongsize="$ans"
9831         fi
9832         if $test "X$longsize" = "X$longlongsize"; then
9833                 echo "(That isn't any different from an ordinary long.)"
9834         fi      
9835         ;;
9836 esac
9837 $rm -f try.* try
9838
9839 : see if prototype for lseek is available
9840 echo " "
9841 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
9842 eval $hasproto
9843
9844 : see if lstat exists
9845 set lstat d_lstat
9846 eval $inlibc
9847
9848 : see if madvise exists
9849 set madvise d_madvise
9850 eval $inlibc
9851
9852 : see if mblen exists
9853 set mblen d_mblen
9854 eval $inlibc
9855
9856 : see if mbstowcs exists
9857 set mbstowcs d_mbstowcs
9858 eval $inlibc
9859
9860 : see if mbtowc exists
9861 set mbtowc d_mbtowc
9862 eval $inlibc
9863
9864 : see if memchr exists
9865 set memchr d_memchr
9866 eval $inlibc
9867
9868 : see if memcmp exists
9869 set memcmp d_memcmp
9870 eval $inlibc
9871
9872 : see if memcpy exists
9873 set memcpy d_memcpy
9874 eval $inlibc
9875
9876 : see if memmove exists
9877 set memmove d_memmove
9878 eval $inlibc
9879
9880 : see if memset exists
9881 set memset d_memset
9882 eval $inlibc
9883
9884 : see if mkdir exists
9885 set mkdir d_mkdir
9886 eval $inlibc
9887
9888 : see if mkdtemp exists
9889 set mkdtemp d_mkdtemp
9890 eval $inlibc
9891
9892 : see if mkfifo exists
9893 set mkfifo d_mkfifo
9894 eval $inlibc
9895
9896 : see if mkstemp exists
9897 set mkstemp d_mkstemp
9898 eval $inlibc
9899
9900 : see if mkstemps exists
9901 set mkstemps d_mkstemps
9902 eval $inlibc
9903
9904 : see if mktime exists
9905 set mktime d_mktime
9906 eval $inlibc
9907
9908 : see if this is a sys/mman.h system
9909 set sys/mman.h i_sysmman
9910 eval $inhdr
9911
9912 : see if mmap exists
9913 set mmap d_mmap
9914 eval $inlibc
9915 : see what shmat returns
9916 : default to something harmless
9917 mmaptype='void *'
9918 case "$i_sysmman$d_mmap" in
9919 "$define$define")
9920         $cat >mmap.c <<'END'
9921 #include <sys/mman.h>
9922 void *mmap();
9923 END
9924         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
9925                 mmaptype='void *'
9926         else
9927                 mmaptype='caddr_t'
9928         fi
9929         echo "and it returns ($mmaptype)." >&4
9930         ;;
9931 esac
9932
9933
9934
9935 : see if modfl exists
9936 set modfl d_modfl
9937 eval $inlibc
9938
9939 : see if mprotect exists
9940 set mprotect d_mprotect
9941 eval $inlibc
9942
9943 : see if msgctl exists
9944 set msgctl d_msgctl
9945 eval $inlibc
9946
9947 : see if msgget exists
9948 set msgget d_msgget
9949 eval $inlibc
9950
9951 : see if msgsnd exists
9952 set msgsnd d_msgsnd
9953 eval $inlibc
9954
9955 : see if msgrcv exists
9956 set msgrcv d_msgrcv
9957 eval $inlibc
9958
9959 : see how much of the 'msg*(2)' library is present.
9960 h_msg=true
9961 echo " "
9962 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
9963 *"$undef"*) h_msg=false;;
9964 esac
9965 case "$osname" in
9966 freebsd)
9967     case "`ipcs 2>&1`" in
9968     "SVID messages"*"not configured"*)
9969         echo "Your $osname does not have the msg*(2) configured." >&4
9970         h_msg=false
9971         val="$undef"
9972         set msgctl d_msgctl
9973         eval $setvar
9974         set msgget d_msgget
9975         eval $setvar
9976         set msgsnd d_msgsnd
9977         eval $setvar
9978         set msgrcv d_msgrcv
9979         eval $setvar
9980         ;;
9981     esac
9982     ;;
9983 esac
9984 : we could also check for sys/ipc.h ...
9985 if $h_msg && $test `./findhdr sys/msg.h`; then
9986         echo "You have the full msg*(2) library." >&4
9987         val="$define"
9988 else
9989         echo "You don't have the full msg*(2) library." >&4
9990         val="$undef"
9991 fi
9992 set d_msg
9993 eval $setvar
9994
9995 : see if msync exists
9996 set msync d_msync
9997 eval $inlibc
9998
9999 : see if munmap exists
10000 set munmap d_munmap
10001 eval $inlibc
10002
10003 : see if nice exists
10004 set nice d_nice
10005 eval $inlibc
10006
10007
10008 echo " "
10009 echo "Checking which 64-bit integer type we could use..." >&4
10010
10011 case "$intsize" in
10012 8) val=int
10013    set quadtype
10014    eval $setvar
10015    val='"unsigned int"'
10016    set uquadtype
10017    eval $setvar
10018    quadkind=1
10019    ;;
10020 *) case "$longsize" in
10021    8) val=long
10022       set quadtype
10023       eval $setvar
10024       val='"unsigned long"'
10025       set uquadtype
10026       eval $setvar
10027       quadkind=2
10028       ;;
10029    *) case "$d_longlong:$longlongsize" in
10030       define:8)
10031         val='"long long"'
10032         set quadtype
10033         eval $setvar
10034         val='"unsigned long long"'
10035         set uquadtype
10036         eval $setvar
10037         quadkind=3
10038         ;;
10039       *) case "$d_int64_t" in
10040          define)
10041            val=int64_t
10042            set quadtype
10043            eval $setvar
10044            val=uint64_t
10045            set uquadtype
10046            eval $setvar
10047            quadkind=4
10048            ;;
10049          esac
10050          ;;
10051       esac
10052       ;;
10053    esac
10054    ;;
10055 esac
10056
10057 case "$quadtype" in
10058 '')     echo "Alas, no 64-bit integer types in sight." >&4
10059         d_quad="$undef"
10060         ;;
10061 *)      if test X"$use64bitint" = Xdefine -o X"$longsize" = X8; then
10062             verb="will"
10063         else
10064             verb="could"
10065         fi
10066         echo "We $verb use '$quadtype' for 64-bit integers." >&4
10067         d_quad="$define"
10068         ;;
10069 esac
10070
10071 : check for length of character
10072 echo " "
10073 case "$charsize" in
10074 '')
10075         echo "Checking to see how big your characters are (hey, you never know)..." >&4
10076         $cat >try.c <<'EOCP'
10077 #include <stdio.h>
10078 int main()
10079 {
10080     printf("%d\n", (int)sizeof(char));
10081     exit(0);
10082 }
10083 EOCP
10084         set try
10085         if eval $compile_ok; then
10086                 dflt=`./try`
10087         else
10088                 dflt='1'
10089                 echo "(I can't seem to compile the test program.  Guessing...)"
10090         fi
10091         ;;
10092 *)
10093         dflt="$charsize"
10094         ;;
10095 esac
10096 rp="What is the size of a character (in bytes)?"
10097 . ./myread
10098 charsize="$ans"
10099 $rm -f try.c try
10100
10101
10102 echo " "
10103 $echo "Choosing the C types to be used for Perl's internal types..." >&4
10104
10105 case "$use64bitint:$d_quad:$quadtype" in
10106 define:define:?*)
10107         ivtype="$quadtype"
10108         uvtype="$uquadtype"
10109         ivsize=8
10110         uvsize=8
10111         ;;
10112 *)      ivtype="long"
10113         uvtype="unsigned long"
10114         ivsize=$longsize
10115         uvsize=$longsize
10116         ;;
10117 esac
10118
10119 case "$uselongdouble:$d_longdbl" in
10120 define:define)
10121         nvtype="long double"
10122         nvsize=$longdblsize
10123         ;;
10124 *)      nvtype=double
10125         nvsize=$doublesize
10126         ;;
10127 esac
10128
10129 $echo "(IV will be "$ivtype", $ivsize bytes)"
10130 $echo "(UV will be "$uvtype", $uvsize bytes)"
10131 $echo "(NV will be "$nvtype", $nvsize bytes)"
10132
10133 $cat >try.c <<EOCP
10134 #$i_inttypes I_INTTYPES
10135 #ifdef I_INTTYPES
10136 #include <inttypes.h>
10137 #endif
10138 #include <stdio.h>
10139 int main() {
10140 #ifdef INT8
10141    int8_t i =  INT8_MAX;
10142   uint8_t u = UINT8_MAX;
10143   printf("int8_t\n");
10144 #endif
10145 #ifdef INT16
10146    int16_t i =  INT16_MAX;
10147   uint16_t i = UINT16_MAX;
10148   printf("int16_t\n");
10149 #endif
10150 #ifdef INT32
10151    int32_t i =  INT32_MAX;
10152   uint32_t u = UINT32_MAX;
10153   printf("int32_t\n");
10154 #endif
10155 }
10156 EOCP
10157
10158 case "$i8type" in
10159 '')     case "$charsize" in
10160         1)      i8type=char
10161                 u8type="unsigned char"
10162                 i8size=$charsize
10163                 u8size=$charsize
10164                 ;;
10165         esac
10166         ;;
10167 esac
10168 case "$i8type" in
10169 '')     set try -DINT8
10170         if eval $compile; then
10171                 case "`./try$exe_ext`" in
10172                 int8_t) i8type=int8_t
10173                         u8type=uint8_t
10174                         i8size=1
10175                         u8size=1
10176                         ;;
10177                 esac
10178         fi
10179         ;;
10180 esac
10181 case "$i8type" in
10182 '')     if $test $charsize -ge 1; then
10183                 i8type=char
10184                 u8type="unsigned char"
10185                 i8size=$charsize
10186                 u8size=$charsize
10187         fi
10188         ;;
10189 esac
10190
10191 case "$i16type" in
10192 '')     case "$shortsize" in
10193         2)      i16type=short
10194                 u16type="unsigned short"
10195                 i16size=$shortsize
10196                 u16size=$shortsize
10197                 ;;
10198         esac
10199         ;;
10200 esac
10201 case "$i16type" in
10202 '')     set try -DINT16
10203         if eval $compile; then
10204                 case "`./try$exe_ext`" in
10205                 int16_t)
10206                         i16type=int16_t
10207                         u16type=uint16_t
10208                         i16size=2
10209                         u16size=2
10210                         ;;
10211                 esac
10212         fi
10213         ;;
10214 esac
10215 case "$i16type" in
10216 '')     if $test $shortsize -ge 2; then
10217                 i16type=short
10218                 u16type="unsigned short"
10219                 i16size=$shortsize
10220                 u16size=$shortsize
10221         fi
10222         ;;
10223 esac
10224
10225 case "$i32type" in
10226 '')     case "$longsize" in
10227         4)      i32type=long
10228                 u32type="unsigned long"
10229                 i32size=$longsize
10230                 u32size=$longsize
10231                 ;;
10232         *)      case "$intsize" in
10233                 4)      i32type=int
10234                         u32type="unsigned int"
10235                         i32size=$intsize
10236                         u32size=$intsize
10237                         ;;
10238                 esac
10239                 ;;
10240         esac
10241         ;;
10242 esac
10243 case "$i32type" in
10244 '')     set try -DINT32
10245         if eval $compile; then
10246                 case "`./try$exe_ext`" in
10247                 int32_t)
10248                         i32type=int32_t
10249                         u32type=uint32_t
10250                         i32size=4
10251                         u32size=4
10252                         ;;
10253                 esac
10254         fi
10255         ;;
10256 esac
10257 case "$i32type" in
10258 '')     if $test $intsize -ge 4; then
10259                 i32type=int
10260                 u32type="unsigned int"
10261                 i32size=$intsize
10262                 u32size=$intsize
10263         fi
10264         ;;
10265 esac
10266
10267 case "$i64type" in
10268 '')     case "$d_quad:$quadtype" in
10269         define:?*)
10270                 i64type="$quadtype"
10271                 u64type="$uquadtype"
10272                 i64size=8
10273                 u64size=8
10274                 ;;
10275         esac
10276         ;;
10277 esac
10278
10279 $echo "Checking whether your NVs can preserve your UVs..." >&4
10280 $cat <<EOP >try.c
10281 #include <stdio.h>
10282 int main() {
10283     $uvtype k = ($uvtype)~0, l;
10284     $nvtype d;
10285     l = k;
10286     d = ($nvtype)l;
10287     l = ($uvtype)d;
10288     if (l == k)
10289        printf("preserve\n");
10290     exit(0);
10291 }
10292 EOP
10293 set try
10294 if eval $compile; then
10295         case "`./try$exe_ext`" in
10296         preserve) d_nv_preserves_uv="$define" ;;
10297         esac
10298 fi      
10299 case "$d_nv_preserves_uv" in
10300 $define) $echo "Yes, they can."  2>&1 ;;
10301 *)       $echo "No, they can't." 2>&1
10302          d_nv_preserves_uv="$undef"
10303          ;;
10304 esac
10305
10306 $rm -f try.* try
10307
10308 case "$d_nv_preserves_uv" in
10309 "$define") d_nv_preserves_uv_bits=`expr $uvsize \* 8` ;;
10310 *)      $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
10311         $cat <<EOP >try.c
10312 #include <stdio.h>
10313 int main() {
10314     $uvtype u = 0;
10315     int     n = 8 * $uvsize;
10316     int     i;
10317     for (i = 0; i < n; i++) {
10318       u = u << 1 | ($uvtype)1;
10319       if (($uvtype)($nvtype)u != u)
10320         break;
10321     }
10322     printf("%d\n", i);
10323     exit(0);
10324 }
10325 EOP
10326         set try
10327         if eval $compile; then
10328                 d_nv_preserves_uv_bits="`./try$exe_ext`"
10329         fi
10330         case "$d_nv_preserves_uv_bits" in
10331         [1-9]*) $echo "Your NVs can preserve $d_nv_preserves_uv_bits bits of your UVs."  2>&1 ;;
10332         *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
10333                 d_nv_preserves_uv_bits="$undef"
10334                 ;;
10335         esac
10336         $rm -f try.* try
10337         ;;
10338 esac
10339
10340
10341
10342 : check for off64_t
10343 echo " "
10344 echo "Checking to see if you have off64_t..." >&4
10345 $cat >try.c <<EOCP
10346 #include <sys/types.h>
10347 #include <unistd.h>
10348 int main() { off64_t x = 7; }
10349 EOCP
10350 set try
10351 if eval $compile; then
10352         val="$define"
10353         echo "You have off64_t."
10354 else
10355         val="$undef"
10356         echo "You do not have off64_t."
10357         case "$lseeksize" in
10358         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
10359         esac
10360 fi
10361 $rm -f try.* try
10362 set d_off64_t
10363 eval $setvar
10364
10365 : see if POSIX threads are available
10366 set pthread.h i_pthread
10367 eval $inhdr
10368
10369
10370
10371
10372 : how to create joinable pthreads
10373 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
10374         echo " "
10375         echo "Checking what constant to use for creating joinable pthreads..." >&4 
10376         $cat >try.c <<'EOCP'
10377 #include <pthread.h>
10378 int main() {
10379     int detachstate = JOINABLE;
10380 }
10381 EOCP
10382         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
10383         if eval $compile; then
10384                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
10385                 val="$undef" # Yes, undef.
10386                 set d_old_pthread_create_joinable
10387                 eval $setvar
10388                 val=""
10389                 set old_pthread_create_joinable
10390                 eval $setvar
10391         else
10392                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
10393                 if eval $compile; then
10394                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
10395                         val="$define"
10396                         set d_old_pthread_create_joinable
10397                         eval $setvar
10398                         val=PTHREAD_CREATE_UNDETACHED
10399                         set old_pthread_create_joinable
10400                         eval $setvar
10401                 else            
10402                         set try -DJOINABLE=__UNDETACHED
10403                         if eval $compile; then
10404                                 echo "You seem to use __UNDETACHED." >&4
10405                                 val="$define"
10406                                 set d_old_pthread_create_joinable
10407                                 eval $setvar
10408                                 val=__UNDETACHED
10409                                 set old_pthread_create_joinable
10410                                 eval $setvar
10411                         else
10412                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
10413                                 val="$define"
10414                                 set d_old_pthread_create_joinable
10415                                 eval $setvar
10416                                 val=0
10417                                 set old_pthread_create_joinable
10418                                 eval $setvar
10419                         fi
10420                 fi
10421         fi
10422         $rm -f try try.*
10423 else
10424     d_old_pthread_create_joinable="$undef"
10425     old_pthread_create_joinable=""
10426 fi
10427
10428 : see if pause exists
10429 set pause d_pause
10430 eval $inlibc
10431
10432 : see if pipe exists
10433 set pipe d_pipe
10434 eval $inlibc
10435
10436 : see if poll exists
10437 set poll d_poll
10438 eval $inlibc
10439
10440
10441 : see whether the various POSIXish _yields exist
10442 $cat >try.c <<EOP
10443 #include <pthread.h>
10444 #include <stdio.h>
10445 int main() {
10446 #ifdef SCHED_YIELD
10447         sched_yield();
10448 #else
10449 #ifdef PTHREAD_YIELD
10450         pthread_yield();
10451 #else
10452 #ifdef PTHREAD_YIELD_NULL
10453         pthread_yield(NULL);
10454 #endif
10455 #endif
10456 #endif
10457 }
10458 EOP
10459 : see if sched_yield exists
10460 set try -DSCHED_YIELD
10461 if eval $compile; then
10462     val="$define"
10463     sched_yield='sched_yield()'
10464 else
10465     val="$undef"
10466 fi
10467 case "$usethreads" in
10468 $define)
10469         case "$val" in
10470         $define) echo 'sched_yield() found.' >&4        ;;
10471         *)       echo 'sched_yield() NOT found.' >&4    ;;
10472         esac
10473 esac
10474 set d_sched_yield
10475 eval $setvar
10476
10477 : see if pthread_yield exists
10478 set try -DPTHREAD_YIELD
10479 if eval $compile; then
10480     val="$define"
10481     case "$sched_yield" in
10482     '') sched_yield='pthread_yield()' ;;
10483     esac
10484 else
10485     set try -DPTHREAD_YIELD_NULL
10486     if eval $compile; then
10487         val="$define"
10488         case "$sched_yield" in
10489         '') sched_yield='pthread_yield(NULL)' ;;
10490         esac
10491     else
10492         val="$undef"
10493     fi
10494 fi
10495 case "$usethreads" in
10496 $define)
10497         case "$val" in
10498         $define) echo 'pthread_yield() found.' >&4      ;;
10499         *)       echo 'pthread_yield() NOT found.' >&4  ;;
10500         esac
10501         ;;
10502 esac
10503 set d_pthread_yield
10504 eval $setvar
10505
10506 case "$sched_yield" in
10507 '') sched_yield=undef ;;
10508 esac
10509
10510 $rm -f try try.*
10511
10512 : see if this is a pwd.h system
10513 set pwd.h i_pwd
10514 eval $inhdr
10515
10516 case "$i_pwd" in
10517 $define)
10518         xxx=`./findhdr pwd.h`
10519         $cppstdin $cppflags $cppminus < $xxx >$$.h
10520
10521         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
10522                 val="$define"
10523         else
10524                 val="$undef"
10525         fi
10526         set d_pwquota
10527         eval $setvar
10528
10529         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
10530                 val="$define"
10531         else
10532                 val="$undef"
10533         fi
10534         set d_pwage
10535         eval $setvar
10536
10537         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
10538                 val="$define"
10539         else
10540                 val="$undef"
10541         fi
10542         set d_pwchange
10543         eval $setvar
10544
10545         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
10546                 val="$define"
10547         else
10548                 val="$undef"
10549         fi
10550         set d_pwclass
10551         eval $setvar
10552
10553         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
10554                 val="$define"
10555         else
10556                 val="$undef"
10557         fi
10558         set d_pwexpire
10559         eval $setvar
10560
10561         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
10562                 val="$define"
10563         else
10564                 val="$undef"
10565         fi
10566         set d_pwcomment
10567         eval $setvar
10568
10569         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
10570                 val="$define"
10571         else
10572                 val="$undef"
10573         fi
10574         set d_pwgecos
10575         eval $setvar
10576
10577         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
10578                 val="$define"
10579         else
10580                 val="$undef"
10581         fi
10582         set d_pwpasswd
10583         eval $setvar
10584
10585         $rm -f $$.h
10586         ;;
10587 *)
10588         val="$undef"; 
10589         set d_pwquota; eval $setvar
10590         set d_pwage; eval $setvar
10591         set d_pwchange; eval $setvar
10592         set d_pwclass; eval $setvar
10593         set d_pwexpire; eval $setvar
10594         set d_pwcomment; eval $setvar
10595         set d_pwgecos; eval $setvar
10596         set d_pwpasswd; eval $setvar
10597         ;;
10598 esac
10599
10600 : see if readdir and friends exist
10601 set readdir d_readdir
10602 eval $inlibc
10603 set seekdir d_seekdir
10604 eval $inlibc
10605 set telldir d_telldir
10606 eval $inlibc
10607 set rewinddir d_rewinddir
10608 eval $inlibc
10609
10610 : see if readlink exists
10611 set readlink d_readlink
10612 eval $inlibc
10613
10614 : see if rename exists
10615 set rename d_rename
10616 eval $inlibc
10617
10618 : see if rmdir exists
10619 set rmdir d_rmdir
10620 eval $inlibc
10621
10622 : see if memory.h is available.
10623 val=''
10624 set memory.h val
10625 eval $inhdr
10626
10627 : See if it conflicts with string.h
10628 case "$val" in
10629 $define)
10630         case "$strings" in
10631         '') ;;
10632         *)
10633                 $cppstdin $cppflags $cppminus < $strings > mem.h
10634                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
10635                         echo " "
10636                         echo "We won't be including <memory.h>."
10637                         val="$undef"
10638                 fi
10639                 $rm -f mem.h
10640                 ;;
10641         esac
10642 esac
10643 set i_memory
10644 eval $setvar
10645
10646 : can bcopy handle overlapping blocks?
10647 val="$undef"
10648 case "$d_bcopy" in
10649 "$define")
10650         echo " "
10651         echo "Checking to see if your bcopy() can do overlapping copies..." >&4
10652         $cat >try.c <<EOCP
10653 #$i_memory I_MEMORY
10654 #$i_stdlib I_STDLIB
10655 #$i_string I_STRING
10656 #$i_unistd I_UNISTD
10657 EOCP
10658         $cat >>try.c <<'EOCP'
10659 #include <stdio.h>
10660 #ifdef I_MEMORY
10661 #  include <memory.h>
10662 #endif
10663 #ifdef I_STDLIB
10664 #  include <stdlib.h>
10665 #endif
10666 #ifdef I_STRING
10667 #  include <string.h>
10668 #else
10669 #  include <strings.h>
10670 #endif
10671 #ifdef I_UNISTD
10672 #  include <unistd.h>  /* Needed for NetBSD */
10673 #endif
10674 int main()
10675 {
10676 char buf[128], abc[128];
10677 char *b;
10678 int len;
10679 int off;
10680 int align;
10681
10682 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
10683
10684 for (align = 7; align >= 0; align--) {
10685         for (len = 36; len; len--) {
10686                 b = buf+align;
10687                 bcopy(abc, b, len);
10688                 for (off = 1; off <= len; off++) {
10689                         bcopy(b, b+off, len);
10690                         bcopy(b+off, b, len);
10691                         if (bcmp(b, abc, len))
10692                                 exit(1);
10693                 }
10694         }
10695 }
10696 exit(0);
10697 }
10698 EOCP
10699         set try
10700         if eval $compile_ok; then
10701                 if ./try 2>/dev/null; then
10702                         echo "Yes, it can."
10703                         val="$define"
10704                 else
10705                         echo "It can't, sorry."
10706                         case "$d_memmove" in
10707                         "$define") echo "But that's Ok since you have memmove()." ;;
10708                         esac
10709                 fi
10710         else
10711                 echo "(I can't compile the test program, so we'll assume not...)"
10712                 case "$d_memmove" in
10713                 "$define") echo "But that's Ok since you have memmove()." ;;
10714                 esac
10715         fi
10716         ;;
10717 esac
10718 $rm -f try.* try core
10719 set d_safebcpy
10720 eval $setvar
10721
10722 : can memcpy handle overlapping blocks?
10723 val="$undef"
10724 case "$d_memcpy" in
10725 "$define")
10726         echo " "
10727         echo "Checking to see if your memcpy() can do overlapping copies..." >&4
10728         $cat >try.c <<EOCP
10729 #$i_memory I_MEMORY
10730 #$i_stdlib I_STDLIB
10731 #$i_string I_STRING
10732 #$i_unistd I_UNISTD
10733 EOCP
10734         $cat >>try.c <<'EOCP'
10735 #include <stdio.h>
10736 #ifdef I_MEMORY
10737 #  include <memory.h>
10738 #endif
10739 #ifdef I_STDLIB
10740 #  include <stdlib.h>
10741 #endif
10742 #ifdef I_STRING
10743 #  include <string.h>
10744 #else
10745 #  include <strings.h>
10746 #endif
10747 #ifdef I_UNISTD
10748 #  include <unistd.h>  /* Needed for NetBSD */
10749 #endif
10750 int main()
10751 {
10752 char buf[128], abc[128];
10753 char *b;
10754 int len;
10755 int off;
10756 int align;
10757
10758 /* Copy "abcde..." string to char abc[] so that gcc doesn't
10759    try to store the string in read-only memory. */
10760 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
10761
10762 for (align = 7; align >= 0; align--) {
10763         for (len = 36; len; len--) {
10764                 b = buf+align;
10765                 memcpy(b, abc, len);
10766                 for (off = 1; off <= len; off++) {
10767                         memcpy(b+off, b, len);
10768                         memcpy(b, b+off, len);
10769                         if (memcmp(b, abc, len))
10770                                 exit(1);
10771                 }
10772         }
10773 }
10774 exit(0);
10775 }
10776 EOCP
10777         set try
10778         if eval $compile_ok; then
10779                 if ./try 2>/dev/null; then
10780                         echo "Yes, it can."
10781                         val="$define"
10782                 else
10783                         echo "It can't, sorry."
10784                         case "$d_memmove" in
10785                         "$define") echo "But that's Ok since you have memmove()." ;;
10786                         esac
10787                 fi
10788         else
10789                 echo "(I can't compile the test program, so we'll assume not...)"
10790                 case "$d_memmove" in
10791                 "$define") echo "But that's Ok since you have memmove()." ;;
10792                 esac
10793         fi
10794         ;;
10795 esac
10796 $rm -f try.* try core
10797 set d_safemcpy
10798 eval $setvar
10799
10800 : can memcmp be trusted to compare relative magnitude?
10801 val="$undef"
10802 case "$d_memcmp" in
10803 "$define")
10804         echo " "
10805         echo "Checking if your memcmp() can compare relative magnitude..." >&4
10806         $cat >try.c <<EOCP
10807 #$i_memory I_MEMORY
10808 #$i_stdlib I_STDLIB
10809 #$i_string I_STRING
10810 #$i_unistd I_UNISTD
10811 EOCP
10812         $cat >>try.c <<'EOCP'
10813 #include <stdio.h>
10814 #ifdef I_MEMORY
10815 #  include <memory.h>
10816 #endif
10817 #ifdef I_STDLIB
10818 #  include <stdlib.h>
10819 #endif
10820 #ifdef I_STRING
10821 #  include <string.h>
10822 #else
10823 #  include <strings.h>
10824 #endif
10825 #ifdef I_UNISTD
10826 #  include <unistd.h>  /* Needed for NetBSD */
10827 #endif
10828 int main()
10829 {
10830 char a = -1;
10831 char b = 0;
10832 if ((a < b) && memcmp(&a, &b, 1) < 0)
10833         exit(1);
10834 exit(0);
10835 }
10836 EOCP
10837         set try
10838         if eval $compile_ok; then
10839                 if ./try 2>/dev/null; then
10840                         echo "Yes, it can."
10841                         val="$define"
10842                 else
10843                         echo "No, it can't (it uses signed chars)."
10844                 fi
10845         else
10846                 echo "(I can't compile the test program, so we'll assume not...)"
10847         fi
10848         ;;
10849 esac
10850 $rm -f try.* try core
10851 set d_sanemcmp
10852 eval $setvar
10853
10854 : see if select exists
10855 set select d_select
10856 eval $inlibc
10857
10858 : see if semctl exists
10859 set semctl d_semctl
10860 eval $inlibc
10861
10862 : see if semget exists
10863 set semget d_semget
10864 eval $inlibc
10865
10866 : see if semop exists
10867 set semop d_semop
10868 eval $inlibc
10869
10870 : see how much of the 'sem*(2)' library is present.
10871 h_sem=true
10872 echo " "
10873 case "$d_semctl$d_semget$d_semop" in
10874 *"$undef"*) h_sem=false;;
10875 esac
10876 case "$osname" in
10877 freebsd)
10878     case "`ipcs 2>&1`" in
10879     "SVID messages"*"not configured"*)
10880         echo "Your $osname does not have the sem*(2) configured." >&4
10881         h_sem=false
10882         val="$undef"
10883         set semctl d_semctl
10884         eval $setvar
10885         set semget d_semget
10886         eval $setvar
10887         set semop d_semop
10888         eval $setvar
10889         ;;
10890     esac
10891     ;;
10892 esac
10893 : we could also check for sys/ipc.h ...
10894 if $h_sem && $test `./findhdr sys/sem.h`; then
10895         echo "You have the full sem*(2) library." >&4
10896         val="$define"
10897 else
10898         echo "You don't have the full sem*(2) library." >&4
10899         val="$undef"
10900 fi
10901 set d_sem
10902 eval $setvar
10903
10904 : see whether sys/sem.h defines union semun
10905 echo " "
10906 $cat > try.c <<'END'
10907 #include <sys/types.h>
10908 #include <sys/ipc.h>
10909 #include <sys/sem.h>
10910 int main () { union semun semun; semun.buf = 0; }
10911 END
10912 set try
10913 if eval $compile; then
10914     echo "You have union semun in <sys/sem.h>." >&4
10915     val="$define"
10916 else
10917     echo "You do not have union semun in <sys/sem.h>." >&4
10918     val="$undef"
10919 fi
10920 $rm -f try try.c try.h
10921 set d_union_semun
10922 eval $setvar
10923
10924 : see how to do semctl IPC_STAT
10925 case "$d_sem" in
10926 $define)
10927     : see whether semctl IPC_STAT can use union semun
10928     echo " "
10929     $cat > try.h <<END
10930 #ifndef S_IRUSR
10931 #   ifdef S_IREAD
10932 #       define S_IRUSR S_IREAD
10933 #       define S_IWUSR S_IWRITE
10934 #       define S_IXUSR S_IEXEC
10935 #   else
10936 #       define S_IRUSR 0400
10937 #       define S_IWUSR 0200
10938 #       define S_IXUSR 0100
10939 #   endif
10940 #   define S_IRGRP (S_IRUSR>>3)
10941 #   define S_IWGRP (S_IWUSR>>3)
10942 #   define S_IXGRP (S_IXUSR>>3)
10943 #   define S_IROTH (S_IRUSR>>6)
10944 #   define S_IWOTH (S_IWUSR>>6)
10945 #   define S_IXOTH (S_IXUSR>>6)
10946 #endif
10947 #ifndef S_IRWXU
10948 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
10949 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
10950 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
10951 #endif
10952 END
10953
10954     $cat > try.c <<END
10955 #include <sys/types.h>
10956 #include <sys/ipc.h>
10957 #include <sys/sem.h>
10958 #include <sys/stat.h>
10959 #include <stdio.h>
10960 #include <errno.h>
10961 #include "try.h"
10962 #ifndef errno
10963 extern int errno;
10964 #endif
10965 #$d_union_semun HAS_UNION_SEMUN
10966 int main() {
10967     union semun
10968 #ifndef HAS_UNION_SEMUN
10969     {
10970         int val;
10971         struct semid_ds *buf;
10972         unsigned short *array;
10973     }
10974 #endif
10975     arg;
10976     int sem, st;
10977
10978 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
10979     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
10980     if (sem > -1) {
10981         struct semid_ds argbuf;
10982         arg.buf = &argbuf;
10983 #       ifdef IPC_STAT
10984         st = semctl(sem, 0, IPC_STAT, arg);
10985         if (st == 0)
10986             printf("semun\n");
10987         else
10988 #       endif /* IPC_STAT */
10989             printf("semctl IPC_STAT failed: errno = %d\n", errno);
10990 #       ifdef IPC_RMID
10991         if (semctl(sem, 0, IPC_RMID, arg) != 0)
10992 #       endif /* IPC_RMID */
10993             printf("semctl IPC_RMID failed: errno = %d\n", errno);
10994     } else
10995 #endif /* IPC_PRIVATE && ... */
10996         printf("semget failed: errno = %d\n", errno);
10997   return 0;
10998 }
10999 END
11000     val="$undef"
11001     set try
11002     if eval $compile; then
11003         xxx=`./try`
11004         case "$xxx" in
11005         semun) val="$define" ;;
11006         esac
11007     fi
11008     $rm -f try try.c
11009     set d_semctl_semun
11010     eval $setvar
11011     case "$d_semctl_semun" in
11012     $define)
11013         echo "You can use union semun for semctl IPC_STAT." >&4
11014         also='also'
11015         ;;
11016     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
11017         also=''
11018         ;;
11019     esac
11020
11021     : see whether semctl IPC_STAT can use struct semid_ds pointer
11022     $cat > try.c <<'END'
11023 #include <sys/types.h>
11024 #include <sys/ipc.h>
11025 #include <sys/sem.h>
11026 #include <sys/stat.h>
11027 #include "try.h"
11028 #include <stdio.h>
11029 #include <errno.h>
11030 #ifndef errno
11031 extern int errno;
11032 #endif
11033 int main() {
11034     struct semid_ds arg;
11035     int sem, st;
11036
11037 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
11038     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
11039     if (sem > -1) {
11040 #       ifdef IPC_STAT
11041         st = semctl(sem, 0, IPC_STAT, &arg);
11042         if (st == 0)
11043             printf("semid_ds\n");
11044         else
11045 #       endif /* IPC_STAT */
11046             printf("semctl IPC_STAT failed: errno = %d\n", errno);
11047 #       ifdef IPC_RMID
11048         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
11049 #       endif /* IPC_RMID */
11050             printf("semctl IPC_RMID failed: errno = %d\n", errno);
11051     } else
11052 #endif /* IPC_PRIVATE && ... */
11053         printf("semget failed: errno = %d\n", errno);
11054
11055     return 0;
11056 }
11057 END
11058     val="$undef"
11059     set try
11060     if eval $compile; then
11061         xxx=`./try`
11062         case "$xxx" in
11063         semid_ds) val="$define" ;;
11064         esac
11065     fi
11066     $rm -f try try.c
11067     set d_semctl_semid_ds
11068     eval $setvar
11069     case "$d_semctl_semid_ds" in
11070     $define)
11071         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
11072         ;;
11073     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
11074         ;;
11075     esac
11076     $rm -f try.h
11077     ;;
11078 *)  val="$undef"
11079
11080     # We do not have the full sem*(2) library, so assume we can not
11081     # use either.
11082
11083     set d_semctl_semun
11084     eval $setvar
11085
11086     set d_semctl_semid_ds
11087     eval $setvar
11088     ;;
11089 esac
11090
11091 : see if setegid exists
11092 set setegid d_setegid
11093 eval $inlibc
11094
11095 : see if seteuid exists
11096 set seteuid d_seteuid
11097 eval $inlibc
11098
11099 : see if setgrent exists
11100 set setgrent d_setgrent
11101 eval $inlibc
11102
11103 : see if sethostent exists
11104 set sethostent d_sethent
11105 eval $inlibc
11106
11107 : see if setlinebuf exists
11108 set setlinebuf d_setlinebuf
11109 eval $inlibc
11110
11111 : see if setlocale exists
11112 set setlocale d_setlocale
11113 eval $inlibc
11114
11115 : see if setnetent exists
11116 set setnetent d_setnent
11117 eval $inlibc
11118
11119 : see if setprotoent exists
11120 set setprotoent d_setpent
11121 eval $inlibc
11122
11123 : see if setpgid exists
11124 set setpgid d_setpgid
11125 eval $inlibc
11126
11127 : see if setpgrp2 exists
11128 set setpgrp2 d_setpgrp2
11129 eval $inlibc
11130
11131 : see if setpriority exists
11132 set setpriority d_setprior
11133 eval $inlibc
11134
11135 : see if setproctitle exists
11136 set setproctitle d_setproctitle
11137 eval $inlibc
11138
11139 : see if setpwent exists
11140 set setpwent d_setpwent
11141 eval $inlibc
11142
11143 : see if setregid exists
11144 set setregid d_setregid
11145 eval $inlibc
11146 set setresgid d_setresgid
11147 eval $inlibc
11148
11149 : see if setreuid exists
11150 set setreuid d_setreuid
11151 eval $inlibc
11152 set setresuid d_setresuid
11153 eval $inlibc
11154
11155 : see if setrgid exists
11156 set setrgid d_setrgid
11157 eval $inlibc
11158
11159 : see if setruid exists
11160 set setruid d_setruid
11161 eval $inlibc
11162
11163 : see if setservent exists
11164 set setservent d_setsent
11165 eval $inlibc
11166
11167 : see if setsid exists
11168 set setsid d_setsid
11169 eval $inlibc
11170
11171 : see if setvbuf exists
11172 set setvbuf d_setvbuf
11173 eval $inlibc
11174
11175 : see if sfio.h is available
11176 set sfio.h i_sfio
11177 eval $inhdr
11178
11179
11180 : see if sfio library is available
11181 case "$i_sfio" in
11182 $define)
11183         val=''
11184         set sfreserve val
11185         eval $inlibc
11186         ;;
11187 *)
11188         val="$undef"
11189         ;;
11190 esac
11191 : Ok, but do we want to use it.
11192 case "$val" in
11193 $define)
11194         case "$usesfio" in
11195         true|$define|[yY]*) dflt='y';;
11196         *) dflt='n';;
11197         esac
11198         echo "$package can use the sfio library, but it is experimental."
11199         rp="You seem to have sfio available, do you want to try using it?"
11200         . ./myread
11201         case "$ans" in
11202         y|Y) ;;
11203         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
11204                 val="$undef"
11205                 : Remove sfio from list of libraries to use
11206                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
11207                 shift
11208                 libs="$*"
11209                 echo "libs = $libs" >&4
11210                 ;;
11211         esac
11212         ;;
11213 *)      case "$usesfio" in
11214         true|$define|[yY]*)
11215                 echo "Sorry, cannot find sfio on this machine" >&4
11216                 echo "Ignoring your setting of usesfio=$usesfio" >&4
11217                 ;;
11218         esac
11219         ;;
11220 esac
11221 set d_sfio
11222 eval $setvar
11223 case "$d_sfio" in
11224 $define) usesfio='true';;
11225 *) usesfio='false';;
11226 esac
11227
11228 : see if shmctl exists
11229 set shmctl d_shmctl
11230 eval $inlibc
11231
11232 : see if shmget exists
11233 set shmget d_shmget
11234 eval $inlibc
11235
11236 : see if shmat exists
11237 set shmat d_shmat
11238 eval $inlibc
11239 : see what shmat returns
11240 case "$d_shmat" in
11241 "$define")
11242         $cat >shmat.c <<'END'
11243 #include <sys/shm.h>
11244 void *shmat();
11245 END
11246         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
11247                 shmattype='void *'
11248         else
11249                 shmattype='char *'
11250         fi
11251         echo "and it returns ($shmattype)." >&4
11252         : see if a prototype for shmat is available
11253         xxx=`./findhdr sys/shm.h`
11254         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
11255         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
11256                 val="$define"
11257         else
11258                 val="$undef"
11259         fi
11260         $rm -f shmat.[co]
11261         ;;
11262 *)
11263         val="$undef"
11264         ;;
11265 esac
11266 set d_shmatprototype
11267 eval $setvar
11268
11269 : see if shmdt exists
11270 set shmdt d_shmdt
11271 eval $inlibc
11272
11273 : see how much of the 'shm*(2)' library is present.
11274 h_shm=true
11275 echo " "
11276 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
11277 *"$undef"*) h_shm=false;;
11278 esac
11279 case "$osname" in
11280 freebsd)
11281     case "`ipcs 2>&1`" in
11282     "SVID shared memory"*"not configured"*)
11283         echo "Your $osname does not have the shm*(2) configured." >&4
11284         h_shm=false
11285         val="$undef"
11286         set shmctl d_shmctl
11287         evat $setvar
11288         set shmget d_shmget
11289         evat $setvar
11290         set shmat d_shmat
11291         evat $setvar
11292         set shmdt d_shmdt
11293         evat $setvar
11294         ;;
11295     esac
11296     ;;
11297 esac
11298 : we could also check for sys/ipc.h ...
11299 if $h_shm && $test `./findhdr sys/shm.h`; then
11300         echo "You have the full shm*(2) library." >&4
11301         val="$define"
11302 else
11303         echo "You don't have the full shm*(2) library." >&4
11304         val="$undef"
11305 fi
11306 set d_shm
11307 eval $setvar
11308
11309 echo " "
11310 : see if we have sigaction
11311 if set sigaction val -f d_sigaction; eval $csym; $val; then
11312         echo 'sigaction() found.' >&4
11313         $cat > try.c <<'EOP'
11314 #include <stdio.h>
11315 #include <sys/types.h>
11316 #include <signal.h>
11317 int main()
11318 {
11319     struct sigaction act, oact;
11320     act.sa_flags = 0;
11321     oact.sa_handler = 0;
11322     /* so that act and oact are used */
11323     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
11324 }
11325 EOP
11326         set try
11327         if eval $compile_ok; then
11328                 val="$define"
11329         else
11330                 echo "But you don't seem to have a useable struct sigaction." >&4
11331                 val="$undef"
11332         fi
11333 else
11334         echo 'sigaction NOT found.' >&4
11335         val="$undef"
11336 fi
11337 set d_sigaction; eval $setvar
11338 $rm -f try try$_o try.c
11339
11340 : see if sigsetjmp exists
11341 echo " "
11342 case "$d_sigsetjmp" in
11343 '')
11344         $cat >try.c <<'EOP'
11345 #include <setjmp.h>
11346 sigjmp_buf env;
11347 int set = 1;
11348 int main()
11349 {
11350         if (sigsetjmp(env,1))
11351                 exit(set);
11352         set = 0;
11353         siglongjmp(env, 1);
11354         exit(1);
11355 }
11356 EOP
11357         set try
11358         if eval $compile; then
11359                 if ./try >/dev/null 2>&1; then
11360                         echo "POSIX sigsetjmp found." >&4
11361                         val="$define"
11362                 else
11363                         $cat >&4 <<EOM
11364 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
11365 I'll ignore them.
11366 EOM
11367                         val="$undef"
11368                 fi
11369         else
11370                 echo "sigsetjmp not found." >&4
11371                 val="$undef"
11372         fi
11373         ;;
11374 *) val="$d_sigsetjmp"
11375         case "$d_sigsetjmp" in
11376         $define) echo "POSIX sigsetjmp found." >&4;;
11377         $undef) echo "sigsetjmp not found." >&4;;
11378         esac
11379         ;;
11380 esac
11381 set d_sigsetjmp
11382 eval $setvar
11383 $rm -f try.c try
11384
11385 : see if sys/stat.h is available
11386 set sys/stat.h i_sysstat
11387 eval $inhdr
11388
11389
11390 : see if stat knows about block sizes
11391 echo " "
11392 echo "Checking to see if your struct stat has st_blocks field..." >&4
11393 set d_statblks stat st_blocks $i_sysstat sys/stat.h
11394 eval $hasfield
11395
11396
11397 : see if this is a sys/vfs.h system
11398 set sys/vfs.h i_sysvfs
11399 eval $inhdr
11400
11401
11402 : see if this is a sys/statfs.h system
11403 set sys/statfs.h i_sysstatfs
11404 eval $inhdr
11405
11406
11407 echo " "
11408 echo "Checking to see if your system supports struct statfs..." >&4
11409 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
11410 eval $hasstruct
11411 case "$d_statfs_s" in
11412 "$define")      echo "Yes, it does."   ;;
11413 *)              echo "No, it doesn't." ;;
11414 esac
11415
11416
11417
11418 : see if struct statfs knows about f_flags
11419 case "$d_statfs_s" in
11420 define) 
11421         echo " "
11422         echo "Checking to see if your struct statfs has f_flags field..." >&4
11423         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
11424         eval $hasfield
11425         ;;
11426 *)      val="$undef"
11427         set d_statfs_f_flags
11428         eval $setvar
11429         ;;
11430 esac
11431 case "$d_statfs_f_flags" in
11432 "$define")      echo "Yes, it does."   ;;
11433 *)              echo "No, it doesn't." ;;
11434 esac
11435
11436 : see if _ptr and _cnt from stdio act std
11437 echo " "
11438 if $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
11439         echo "(Looks like you have stdio.h from Linux.)"
11440         case "$stdio_ptr" in
11441         '') stdio_ptr='((fp)->_IO_read_ptr)'
11442                 ptr_lval=$define
11443                 ;;
11444         *)      ptr_lval=$d_stdio_ptr_lval;;
11445         esac
11446         case "$stdio_cnt" in
11447         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
11448                 cnt_lval=$undef
11449                 ;;
11450         *)      cnt_lval=$d_stdio_cnt_lval;;
11451         esac
11452         case "$stdio_base" in
11453         '') stdio_base='((fp)->_IO_read_base)';;
11454         esac
11455         case "$stdio_bufsiz" in
11456         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
11457         esac
11458 else
11459         case "$stdio_ptr" in
11460         '') stdio_ptr='((fp)->_ptr)'
11461                 ptr_lval=$define
11462                 ;;
11463         *)      ptr_lval=$d_stdio_ptr_lval;;
11464         esac
11465         case "$stdio_cnt" in
11466         '') stdio_cnt='((fp)->_cnt)'
11467                 cnt_lval=$define
11468                 ;;
11469         *)      cnt_lval=$d_stdio_cnt_lval;;
11470         esac
11471         case "$stdio_base" in
11472         '') stdio_base='((fp)->_base)';;
11473         esac
11474         case "$stdio_bufsiz" in
11475         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
11476         esac
11477 fi
11478 : test whether _ptr and _cnt really work
11479 echo "Checking how std your stdio is..." >&4
11480 $cat >try.c <<EOP
11481 #include <stdio.h>
11482 #define FILE_ptr(fp)    $stdio_ptr
11483 #define FILE_cnt(fp)    $stdio_cnt
11484 int main() {
11485         FILE *fp = fopen("try.c", "r");
11486         char c = getc(fp);
11487         if (
11488                 18 <= FILE_cnt(fp) &&
11489                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
11490         )
11491                 exit(0);
11492         exit(1);
11493 }
11494 EOP
11495 val="$undef"
11496 set try
11497 if eval $compile; then
11498         if ./try; then
11499                 echo "Your stdio acts pretty std."
11500                 val="$define"
11501         else
11502                 echo "Your stdio isn't very std."
11503         fi
11504 else
11505         echo "Your stdio doesn't appear very std."
11506 fi
11507 $rm -f try.c try
11508 set d_stdstdio
11509 eval $setvar
11510
11511 : Can _ptr be used as an lvalue?
11512 case "$d_stdstdio$ptr_lval" in
11513 $define$define) val=$define ;;
11514 *) val=$undef ;;
11515 esac
11516 set d_stdio_ptr_lval
11517 eval $setvar
11518
11519 : Can _cnt be used as an lvalue?
11520 case "$d_stdstdio$cnt_lval" in
11521 $define$define) val=$define ;;
11522 *) val=$undef ;;
11523 esac
11524 set d_stdio_cnt_lval
11525 eval $setvar
11526
11527 : see if _base is also standard
11528 val="$undef"
11529 case "$d_stdstdio" in
11530 $define)
11531         $cat >try.c <<EOP
11532 #include <stdio.h>
11533 #define FILE_base(fp)   $stdio_base
11534 #define FILE_bufsiz(fp) $stdio_bufsiz
11535 int main() {
11536         FILE *fp = fopen("try.c", "r");
11537         char c = getc(fp);
11538         if (
11539                 19 <= FILE_bufsiz(fp) &&
11540                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
11541         )
11542                 exit(0);
11543         exit(1);
11544 }
11545 EOP
11546         set try
11547         if eval $compile; then
11548                 if ./try; then
11549                         echo "And its _base field acts std."
11550                         val="$define"
11551                 else
11552                         echo "But its _base field isn't std."
11553                 fi
11554         else
11555                 echo "However, it seems to be lacking the _base field."
11556         fi
11557         $rm -f try.c try
11558         ;;
11559 esac
11560 set d_stdiobase
11561 eval $setvar
11562
11563 $cat >&4 <<EOM
11564 Checking how to access stdio streams by file descriptor number...
11565 EOM
11566 case "$stdio_stream_array" in
11567 '')     $cat >try.c <<EOCP
11568 #include <stdio.h>
11569 int main() {
11570   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
11571     printf("yes\n");
11572 }
11573 EOCP
11574         for s in _iob __iob __sF
11575         do
11576                 set try -DSTDIO_STREAM_ARRAY=$s
11577                 if eval $compile; then
11578                         case "`./try$exe_ext`" in
11579                         yes)    stdio_stream_array=$s; break ;;
11580                         esac
11581                 fi
11582         done
11583         $rm -f try.* try$exe_ext
11584 esac
11585 case "$stdio_stream_array" in
11586 '')     $cat >&4 <<EOM
11587 I can't figure out how to access stdio streams by file descriptor number.
11588 EOM
11589         d_stdio_stream_array="$undef"
11590         ;;
11591 *)      $cat >&4 <<EOM
11592 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
11593 EOM
11594         d_stdio_stream_array="$define"
11595         ;;
11596 esac
11597
11598 : see if strcoll exists
11599 set strcoll d_strcoll
11600 eval $inlibc
11601
11602 : check for structure copying
11603 echo " "
11604 echo "Checking to see if your C compiler can copy structs..." >&4
11605 $cat >try.c <<'EOCP'
11606 int main()
11607 {
11608         struct blurfl {
11609                 int dyick;
11610         } foo, bar;
11611
11612         foo = bar;
11613 }
11614 EOCP
11615 if $cc -c try.c >/dev/null 2>&1 ; then
11616         val="$define"
11617         echo "Yup, it can."
11618 else
11619         val="$undef"
11620         echo "Nope, it can't."
11621 fi
11622 set d_strctcpy
11623 eval $setvar
11624 $rm -f try.*
11625
11626 : see if strerror and/or sys_errlist[] exist
11627 echo " "
11628 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
11629     if set strerror val -f d_strerror; eval $csym; $val; then
11630                 echo 'strerror() found.' >&4
11631                 d_strerror="$define"
11632                 d_strerrm='strerror(e)'
11633                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
11634                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
11635                         d_syserrlst="$define"
11636                 else
11637                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
11638                         d_syserrlst="$undef"
11639                 fi
11640     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
11641                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
11642                 echo 'strerror() found in string header.' >&4
11643                 d_strerror="$define"
11644                 d_strerrm='strerror(e)'
11645                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
11646                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
11647                                 d_syserrlst="$define"
11648                 else
11649                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
11650                         d_syserrlst="$undef"
11651                 fi
11652     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
11653                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
11654                 d_strerror="$undef"
11655                 d_syserrlst="$define"
11656                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
11657     else
11658                 echo 'strerror() and sys_errlist[] NOT found.' >&4
11659                 d_strerror="$undef"
11660                 d_syserrlst="$undef"
11661                 d_strerrm='"unknown"'
11662     fi
11663 fi
11664
11665 : see if strtod exists
11666 set strtod d_strtod
11667 eval $inlibc
11668
11669 : see if strtol exists
11670 set strtol d_strtol
11671 eval $inlibc
11672
11673 : see if strtold exists
11674 set strtold d_strtold
11675 eval $inlibc
11676
11677 : see if strtoll exists
11678 set strtoll d_strtoll
11679 eval $inlibc
11680
11681 case "$d_longlong-$d_strtoll" in
11682 "$define-$define")
11683         $cat <<EOM
11684 Checking whether your strtoll() works okay...
11685 EOM
11686         $cat >try.c <<'EOCP'
11687 #include <errno.h>
11688 #ifdef __hpux
11689 #define strtoll __strtoll
11690 #endif
11691 #include <stdio.h>
11692 extern long long int strtoll(char *s, char **, int); 
11693 static int bad = 0;
11694 int check(char *s, long long ell, int een) {
11695         long long gll;
11696         errno = 0;
11697         gll = strtoll(s, 0, 10);
11698         if (!((gll == ell) && (errno == een)))
11699                 bad++;
11700 }
11701 int main() {
11702         check(" 1",                                      1LL, 0);
11703         check(" 0",                                      0LL, 0);
11704         check("-1",                                     -1LL, 0);
11705         check("-9223372036854775808", -9223372036854775808LL, 0);
11706         check("-9223372036854775808", -9223372036854775808LL, 0);
11707         check(" 9223372036854775807",  9223372036854775807LL, 0);
11708         check("-9223372036854775808", -9223372036854775808LL, 0);
11709         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
11710         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
11711         if (!bad)
11712                 printf("ok\n");
11713 }
11714 EOCP
11715         set try
11716         if eval $compile; then
11717                 case "`./try`" in
11718                 ok) echo "Your strtoll() seems to be working okay." ;;
11719                 *) cat <<EOM >&4
11720 Your strtoll() doesn't seem to be working okay.
11721 EOM
11722                    d_strtoll="$undef"
11723                    ;;
11724                 esac
11725         fi
11726         ;;
11727 esac
11728
11729 : see if strtoul exists
11730 set strtoul d_strtoul
11731 eval $inlibc
11732
11733 : see if strtoull exists
11734 set strtoull d_strtoull
11735 eval $inlibc
11736
11737 case "$d_longlong-$d_strtoull" in
11738 "$define-$define")
11739         $cat <<EOM
11740 Checking whether your strtoull() works okay...
11741 EOM
11742         $cat >try.c <<'EOCP'
11743 #include <errno.h>
11744 #ifdef __hpux
11745 #define strtoull __strtoull
11746 #endif
11747 #include <stdio.h>
11748 extern unsigned long long int strtoull(char *s, char **, int); 
11749 static int bad = 0;
11750 int check(char *s, long long eull, int een) {
11751         long long gull;
11752         errno = 0;
11753         gull = strtoull(s, 0, 10);
11754         if (!((gull == eull) && (errno == een)))
11755                 bad++;
11756 }
11757 int main() {
11758         check(" 1",                                       1LL, 0);
11759         check(" 0",                                       0LL, 0);
11760         check("18446744073709551615", 18446744073709551615ULL, 0);
11761         check("18446744073709551616", 18446744073709551615ULL, ERANGE);
11762         if (!bad)
11763                 printf("ok\n");
11764 }
11765 EOCP
11766         set try
11767         if eval $compile; then
11768                 case "`./try`" in
11769                 ok) echo "Your strtoull() seems to be working okay." ;;
11770                 *) cat <<EOM >&4
11771 Your strtoull() doesn't seem to be working okay.
11772 EOM
11773                    d_strtoull="$undef"
11774                    ;;
11775                 esac
11776         fi
11777         ;;
11778 esac
11779
11780 : see if strtouq exists
11781 set strtouq d_strtouq
11782 eval $inlibc
11783
11784 : see if strxfrm exists
11785 set strxfrm d_strxfrm
11786 eval $inlibc
11787
11788 : see if symlink exists
11789 set symlink d_symlink
11790 eval $inlibc
11791
11792 : see if syscall exists
11793 set syscall d_syscall
11794 eval $inlibc
11795
11796 : see if sysconf exists
11797 set sysconf d_sysconf
11798 eval $inlibc
11799
11800 : see if system exists
11801 set system d_system
11802 eval $inlibc
11803
11804 : see if tcgetpgrp exists
11805 set tcgetpgrp d_tcgetpgrp
11806 eval $inlibc
11807
11808 : see if tcsetpgrp exists
11809 set tcsetpgrp d_tcsetpgrp
11810 eval $inlibc
11811
11812 : see if prototype for telldir is available
11813 echo " "
11814 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
11815 eval $hasproto
11816
11817 : see if this is a sys/times.h system
11818 set sys/times.h i_systimes
11819 eval $inhdr
11820
11821 : see if times exists
11822 echo " "
11823 if set times val -f d_times; eval $csym; $val; then
11824         echo 'times() found.' >&4
11825         d_times="$define"
11826         inc=''
11827         case "$i_systimes" in
11828         "$define") inc='sys/times.h';;
11829         esac
11830         rp="What is the type returned by times() on this system?"
11831         set clock_t clocktype long stdio.h sys/types.h $inc
11832         eval $typedef_ask
11833 else
11834         echo 'times() NOT found, hope that will do.' >&4
11835         d_times="$undef"
11836         clocktype='int'
11837 fi
11838
11839 : see if truncate exists
11840 set truncate d_truncate
11841 eval $inlibc
11842
11843 : see if tzname[] exists
11844 echo " "
11845 if set tzname val -a d_tzname; eval $csym; $val; then
11846         val="$define"
11847         echo 'tzname[] found.' >&4
11848 else
11849         val="$undef"
11850         echo 'tzname[] NOT found.' >&4
11851 fi
11852 set d_tzname
11853 eval $setvar
11854
11855 : see if umask exists
11856 set umask d_umask
11857 eval $inlibc
11858
11859 : see if ustat exists
11860 set ustat d_ustat
11861 eval $inlibc
11862
11863 : backward compatibility for d_hvfork
11864 if test X$d_hvfork != X; then
11865         d_vfork="$d_hvfork"
11866         d_hvfork=''
11867 fi
11868 : see if there is a vfork
11869 val=''
11870 set vfork val
11871 eval $inlibc
11872
11873 : Ok, but do we want to use it. vfork is reportedly unreliable in 
11874 : perl on Solaris 2.x, and probably elsewhere.
11875 case "$val" in
11876 $define)
11877         echo " "
11878         case "$usevfork" in
11879         false) dflt='n';;
11880         *) dflt='y';;
11881         esac
11882         cat <<'EOM'
11883  
11884 Perl can only use a vfork() that doesn't suffer from strict
11885 restrictions on calling functions or modifying global data in
11886 the child.  For example, glibc-2.1 contains such a vfork()
11887 that is unsuitable.  If your system provides a proper fork()
11888 call, chances are that you do NOT want perl to use vfork().
11889
11890 EOM
11891         rp="Do you still want to use vfork()?"
11892         . ./myread
11893         case "$ans" in
11894         y|Y) ;;
11895         *)
11896                 echo "Ok, we won't use vfork()."
11897                 val="$undef"
11898                 ;;
11899         esac
11900         ;;
11901 esac
11902 set d_vfork
11903 eval $setvar
11904 case "$d_vfork" in
11905 $define) usevfork='true';;
11906 *) usevfork='false';;
11907 esac
11908
11909 : see if this is an sysdir system
11910 set sys/dir.h i_sysdir
11911 eval $inhdr
11912
11913 : see if this is an sysndir system
11914 set sys/ndir.h i_sysndir
11915 eval $inhdr
11916
11917 : see if closedir exists
11918 set closedir d_closedir
11919 eval $inlibc
11920
11921 case "$d_closedir" in
11922 "$define")
11923         echo " "
11924         echo "Checking whether closedir() returns a status..." >&4
11925         cat > closedir.c <<EOM
11926 #$i_dirent I_DIRENT             /**/
11927 #$i_sysdir I_SYS_DIR            /**/
11928 #$i_sysndir I_SYS_NDIR          /**/
11929 #$i_systypes I_SYS_TYPES        /**/
11930
11931 #if defined(I_SYS_TYPES)
11932 #include <sys/types.h>
11933 #endif
11934 #if defined(I_DIRENT)
11935 #include <dirent.h>
11936 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
11937 #include <sys/dir.h>
11938 #endif
11939 #else
11940 #ifdef I_SYS_NDIR
11941 #include <sys/ndir.h>
11942 #else
11943 #ifdef I_SYS_DIR
11944 #ifdef hp9000s500
11945 #include <ndir.h>       /* may be wrong in the future */
11946 #else
11947 #include <sys/dir.h>
11948 #endif
11949 #endif
11950 #endif
11951 #endif 
11952 int main() { return closedir(opendir(".")); }
11953 EOM
11954         set closedir
11955         if eval $compile_ok; then
11956                 if ./closedir > /dev/null 2>&1 ; then
11957                         echo "Yes, it does."
11958                         val="$undef"
11959                 else
11960                         echo "No, it doesn't."
11961                         val="$define"
11962                 fi
11963         else
11964                 echo "(I can't seem to compile the test program--assuming it doesn't)"
11965                 val="$define"
11966         fi
11967         ;;
11968 *)
11969         val="$undef";
11970         ;;
11971 esac
11972 set d_void_closedir
11973 eval $setvar
11974 $rm -f closedir*
11975 : check for volatile keyword
11976 echo " "
11977 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
11978 $cat >try.c <<'EOCP'
11979 int main()
11980 {
11981         typedef struct _goo_struct goo_struct;
11982         goo_struct * volatile goo = ((goo_struct *)0);
11983         struct _goo_struct {
11984                 long long_int;
11985                 int reg_int;
11986                 char char_var;
11987         };
11988         typedef unsigned short foo_t;
11989         char *volatile foo;
11990         volatile int bar;
11991         volatile foo_t blech;
11992         foo = foo;
11993 }
11994 EOCP
11995 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
11996         val="$define"
11997         echo "Yup, it does."
11998 else
11999         val="$undef"
12000         echo "Nope, it doesn't."
12001 fi
12002 set d_volatile
12003 eval $setvar
12004 $rm -f try.*
12005
12006 : see if there is a wait4
12007 set wait4 d_wait4
12008 eval $inlibc
12009
12010 : see if waitpid exists
12011 set waitpid d_waitpid
12012 eval $inlibc
12013
12014 : see if wcstombs exists
12015 set wcstombs d_wcstombs
12016 eval $inlibc
12017
12018 : see if wctomb exists
12019 set wctomb d_wctomb
12020 eval $inlibc
12021
12022 : preserve RCS keywords in files with variable substitution, grrr
12023 Date='$Date'
12024 Id='$Id'
12025 Log='$Log'
12026 RCSfile='$RCSfile'
12027 Revision='$Revision'
12028
12029 case "$crosscompile" in
12030 ''|[nN]*) crosscompile="$undef" ;;
12031 esac
12032
12033 case "$osname" in
12034 next|rhapsody|darwin) multiarch="$define" ;;
12035 esac
12036 case "$multiarch" in
12037 ''|[nN]*) multiarch="$undef" ;;
12038 esac
12039
12040 : check for alignment requirements
12041 echo " "
12042 case "$crosscompile$multiarch" in
12043 *$define*)
12044         $cat <<EOM
12045 You seem to be either cross-compiling or doing a multiarchitecture build,
12046 skipping the memory alignment check.
12047
12048 EOM
12049         case "$alignbytes" in
12050         '') alignbytes=8 ;;
12051         esac
12052         ;;
12053 *)
12054         case "$alignbytes" in
12055         '') echo "Checking alignment constraints..." >&4
12056                 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
12057                         $cat >try.c <<'EOCP'
12058 typedef long double NV;
12059 EOCP
12060                 else
12061                         $cat >try.c <<'EOCP'
12062 typedef double NV;
12063 EOCP
12064                 fi
12065                 $cat >>try.c <<'EOCP'
12066 #include <stdio.h>
12067 struct foobar {
12068         char foo;
12069         NV bar;
12070 } try_algn;
12071 int main()
12072 {
12073     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
12074     return(0);
12075 }
12076 EOCP
12077                 set try
12078                 if eval $compile_ok; then
12079                         dflt=`./try`
12080                 else
12081                         dflt='8'
12082                         echo "(I can't seem to compile the test program...)"
12083                 fi
12084                 ;;
12085         *) dflt="$alignbytes"
12086                 ;;
12087         esac
12088         rp="Doubles must be aligned on a how-many-byte boundary?"
12089         . ./myread
12090         alignbytes="$ans"
12091         $rm -f try.c try
12092         ;;
12093 esac
12094
12095
12096 : set the base revision
12097 baserev=5.0
12098
12099 : check for ordering of bytes in a long
12100 echo " "
12101 case "$crosscompile$multiarch" in
12102 *$define*)
12103         $cat <<EOM
12104 You seem to be either cross-compiling or doing a multiarchitecture build,
12105 skipping the byteorder check.
12106
12107 EOM
12108         byteorder='0xffff'
12109         ;;
12110 *)
12111         case "$byteorder" in
12112         '')
12113                 $cat <<'EOM'
12114 In the following, larger digits indicate more significance.  A big-endian
12115 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
12116 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
12117 machines may have weird orders like 3412.  A Cray will report 87654321,
12118 an Alpha will report 12345678. If the test program works the default is
12119 probably right.
12120 I'm now running the test program...
12121 EOM
12122                 $cat >try.c <<'EOCP'
12123 #include <stdio.h>
12124 int main()
12125 {
12126         int i;
12127         union {
12128                 unsigned long l;
12129                 char c[sizeof(long)];
12130         } u;
12131
12132         if (sizeof(long) > 4)
12133                 u.l = (0x08070605L << 32) | 0x04030201L;
12134         else
12135                 u.l = 0x04030201L;
12136         for (i = 0; i < sizeof(long); i++)
12137                 printf("%c", u.c[i]+'0');
12138         printf("\n");
12139         exit(0);
12140 }
12141 EOCP
12142                 xxx_prompt=y
12143                 set try
12144                 if eval $compile && ./try > /dev/null; then
12145                         dflt=`./try`
12146                         case "$dflt" in
12147                         [1-4][1-4][1-4][1-4]|12345678|87654321)
12148                                 echo "(The test program ran ok.)"
12149                                 echo "byteorder=$dflt"
12150                                 xxx_prompt=n
12151                         ;;
12152                         ????|????????) echo "(The test program ran ok.)" ;;
12153                         *) echo "(The test program didn't run right for some reason.)" ;;
12154                         esac
12155                 else
12156                         dflt='4321'
12157                         cat <<'EOM'
12158 (I can't seem to compile the test program.  Guessing big-endian...)
12159 EOM
12160                 fi
12161                 case "$xxx_prompt" in
12162                 y)
12163                         rp="What is the order of bytes in a long?"
12164                         . ./myread
12165                         byteorder="$ans"
12166                         ;;
12167                 *)      byteorder=$dflt
12168                         ;;
12169                 esac
12170                 ;;
12171         esac
12172         $rm -f try.c try
12173         ;;
12174 esac
12175
12176
12177 : how do we catenate cpp tokens here?
12178 echo " "
12179 echo "Checking to see how your cpp does stuff like catenate tokens..." >&4
12180 $cat >cpp_stuff.c <<'EOCP'
12181 #define RCAT(a,b)a/**/b
12182 #define ACAT(a,b)a ## b
12183 RCAT(Rei,ser)
12184 ACAT(Cir,cus)
12185 EOCP
12186 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
12187 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
12188         echo "Oh!  Smells like ANSI's been here." >&4
12189         echo "We can catify or stringify, separately or together!"
12190         cpp_stuff=42
12191 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
12192         echo "Ah, yes!  The good old days!" >&4
12193         echo "However, in the good old days we don't know how to stringify and"
12194         echo "catify at the same time."
12195         cpp_stuff=1
12196 else
12197         $cat >&4 <<EOM
12198 Hmm, I don't seem to be able to catenate tokens with your cpp.  You're going
12199 to have to edit the values of CAT[2-5] in config.h...
12200 EOM
12201         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
12202 fi
12203 $rm -f cpp_stuff.*
12204
12205 : see if this is a db.h system
12206 set db.h i_db
12207 eval $inhdr
12208
12209 case "$i_db" in
12210 $define)
12211         : Check db version.
12212         echo " "
12213         echo "Checking Berkeley DB version ..." >&4
12214         $cat >try.c <<EOCP
12215 #$d_const HASCONST
12216 #ifndef HASCONST
12217 #define const
12218 #endif
12219 #include <sys/types.h>
12220 #include <stdio.h>
12221 #include <db.h>
12222 int main()
12223 {
12224 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
12225     int Major, Minor, Patch ;
12226     unsigned long Version ;
12227     (void)db_version(&Major, &Minor, &Patch) ;
12228     printf("You have Berkeley DB Version 2 or greater\n");
12229
12230     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
12231                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
12232     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
12233                 Major, Minor, Patch) ;
12234
12235     /* check that db.h & libdb are compatible */
12236     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
12237         printf("db.h and libdb are incompatible\n") ;
12238         exit(3);        
12239     }
12240
12241     printf("db.h and libdb are compatible\n") ;
12242
12243     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
12244                 + DB_VERSION_PATCH ;
12245
12246     /* needs to be >= 2.3.4 */
12247     if (Version < 2003004) {
12248     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
12249         printf("but Perl needs Berkeley DB 2.3.4 or greater\n") ;
12250         exit(2);        
12251     }
12252
12253     exit(0);
12254 #else
12255 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
12256     printf("You have Berkeley DB Version 1\n");
12257     exit(0);    /* DB version < 2: the coast is clear. */
12258 #else
12259     exit(1);    /* <db.h> not Berkeley DB? */
12260 #endif
12261 #endif
12262 }
12263 EOCP
12264         set try
12265         if eval $compile_ok && ./try; then
12266                 echo 'Looks OK.' >&4
12267         else
12268                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
12269                 i_db=$undef
12270                 case " $libs " in
12271                 *"-ldb "*)
12272                         : Remove db from list of libraries to use
12273                         echo "Removing unusable -ldb from library list" >&4
12274                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
12275                         shift
12276                         libs="$*"
12277                         echo "libs = $libs" >&4
12278                         ;;
12279                 esac
12280         fi
12281         $rm -f try.*
12282         ;;
12283 esac
12284
12285 case "$i_db" in
12286 define)
12287         : Check the return type needed for hash 
12288         echo " "
12289         echo "Checking return type needed for hash for Berkeley DB ..." >&4
12290         $cat >try.c <<EOCP
12291 #$d_const HASCONST
12292 #ifndef HASCONST
12293 #define const
12294 #endif
12295 #include <sys/types.h>
12296 #include <db.h>
12297
12298 #ifndef DB_VERSION_MAJOR
12299 u_int32_t hash_cb (ptr, size)
12300 const void *ptr;
12301 size_t size;
12302 {
12303 }
12304 HASHINFO info;
12305 int main()
12306 {
12307         info.hash = hash_cb;
12308 }
12309 #endif
12310 EOCP
12311         if $cc $ccflags -c try.c >try.out 2>&1 ; then
12312                 if $contains warning try.out >>/dev/null 2>&1 ; then
12313                         db_hashtype='int'
12314                 else
12315                         db_hashtype='u_int32_t'
12316                 fi
12317         else
12318                 : XXX Maybe we should just give up here.
12319                 db_hashtype=u_int32_t
12320                 $cat try.out >&4
12321                 echo "Help:  I can't seem to compile the db test program." >&4
12322                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
12323         fi
12324         $rm -f try.*
12325         echo "Your version of Berkeley DB uses $db_hashtype for hash."
12326         ;;
12327 *)      db_hashtype=u_int32_t
12328         ;;
12329 esac
12330 case "$i_db" in
12331 define)
12332         : Check the return type needed for prefix 
12333         echo " "
12334         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
12335         cat >try.c <<EOCP
12336 #$d_const HASCONST
12337 #ifndef HASCONST
12338 #define const
12339 #endif
12340 #include <sys/types.h>
12341 #include <db.h>
12342
12343 #ifndef DB_VERSION_MAJOR
12344 size_t prefix_cb (key1, key2)
12345 const DBT *key1;
12346 const DBT *key2;
12347 {
12348 }
12349 BTREEINFO info;
12350 int main()
12351 {
12352         info.prefix = prefix_cb;
12353 }
12354 #endif
12355 EOCP
12356         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
12357                 if $contains warning try.out >>/dev/null 2>&1 ; then
12358                         db_prefixtype='int'
12359                 else
12360                         db_prefixtype='size_t'
12361                 fi
12362         else
12363                 db_prefixtype='size_t'
12364                 : XXX Maybe we should just give up here.
12365                 $cat try.out >&4
12366                 echo "Help:  I can't seem to compile the db test program." >&4
12367                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
12368         fi
12369         $rm -f try.*
12370         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
12371         ;;
12372 *)      db_prefixtype='size_t'
12373         ;;
12374 esac
12375
12376 : check for void type
12377 echo " "
12378 echo "Checking to see how well your C compiler groks the void type..." >&4
12379 case "$voidflags" in
12380 '')
12381         $cat >try.c <<'EOCP'
12382 #if TRY & 1
12383 void sub() {
12384 #else
12385 sub() {
12386 #endif
12387         extern void moo();      /* function returning void */
12388         void (*goo)();          /* ptr to func returning void */
12389 #if TRY & 8
12390         void *hue;              /* generic ptr */
12391 #endif
12392 #if TRY & 2
12393         void (*foo[10])();
12394 #endif
12395
12396 #if TRY & 4
12397         if(goo == moo) {
12398                 exit(0);
12399         }
12400 #endif
12401         exit(0);
12402 }
12403 int main() { sub(); }
12404 EOCP
12405         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
12406                 voidflags=$defvoidused
12407         echo "Good.  It appears to support void to the level $package wants.">&4
12408                 if $contains warning .out >/dev/null 2>&1; then
12409                         echo "However, you might get some warnings that look like this:"
12410                         $cat .out
12411                 fi
12412         else
12413 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
12414                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
12415                         echo "It supports 1..."
12416                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
12417                                 echo "It also supports 2..."
12418                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
12419                                         voidflags=7
12420                                         echo "And it supports 4 but not 8 definitely."
12421                                 else
12422                                         echo "It doesn't support 4..."
12423                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
12424                                                 voidflags=11
12425                                                 echo "But it supports 8."
12426                                         else
12427                                                 voidflags=3
12428                                                 echo "Neither does it support 8."
12429                                         fi
12430                                 fi
12431                         else
12432                                 echo "It does not support 2..."
12433                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
12434                                         voidflags=13
12435                                         echo "But it supports 4 and 8."
12436                                 else
12437                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
12438                                                 voidflags=5
12439                                                 echo "And it supports 4 but has not heard about 8."
12440                                         else
12441                                                 echo "However it supports 8 but not 4."
12442                                         fi
12443                                 fi
12444                         fi
12445                 else
12446                         echo "There is no support at all for void."
12447                         voidflags=0
12448                 fi
12449         fi
12450 esac
12451 case "$voidflags" in
12452 "$defvoidused") ;;
12453 *)      $cat >&4 <<'EOM'
12454   Support flag bits are:
12455     1: basic void declarations.
12456     2: arrays of pointers to functions returning void.
12457     4: operations between pointers to and addresses of void functions.
12458     8: generic void pointers.
12459 EOM
12460         dflt="$voidflags";
12461         rp="Your void support flags add up to what?"
12462         . ./myread
12463         voidflags="$ans"
12464         ;;
12465 esac
12466 $rm -f try.* .out
12467
12468
12469 : How can we generate normalized random numbers ?
12470 echo " "
12471 echo "Looking for a random number function..." >&4
12472 case "$randfunc" in
12473 '')
12474         if set drand48 val -f; eval $csym; $val; then
12475                 dflt="drand48"
12476                 echo "Good, found drand48()." >&4
12477         elif set random val -f; eval $csym; $val; then
12478                 dflt="random"
12479                 echo "OK, found random()." >&4
12480         else
12481                 dflt="rand"
12482                 echo "Yick, looks like I have to use rand()." >&4
12483         fi
12484         echo " "
12485         ;;
12486 *)
12487         dflt="$randfunc"
12488         ;;
12489 esac
12490 cont=true
12491
12492 case "$ccflags" in
12493 *-Dmy_rand=*|*-Dmy_srand=*)
12494         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
12495         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
12496         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
12497         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
12498         ;;
12499 esac
12500
12501 while $test "$cont"; do
12502         rp="Use which function to generate random numbers?"
12503         . ./myread
12504         if $test "$ans" = "$dflt"; then
12505                 : null
12506         else
12507                 randbits=''
12508         fi
12509         randfunc="$ans"
12510         if set $ans val -f; eval $csym; $val; then
12511                 cont=''
12512         else
12513                 dflt=y
12514                 rp="I cannot find function $ans. Use that name anyway?"
12515                 . ./myread
12516                 dflt=rand
12517                 case "$ans" in
12518                         [yY]*) cont='';;
12519                 esac
12520         fi
12521         case "$cont" in
12522         '')
12523                 case "$randfunc" in
12524                 drand48)
12525                         drand01="drand48()"
12526                         seedfunc="srand48"
12527                         randbits=48
12528                         randseedtype=long
12529                         ;;
12530                 rand|random)
12531                         case "$randbits" in
12532                         '')
12533 echo "Checking to see how many bits your $randfunc() function produces..." >&4
12534                                 $cat >try.c <<EOCP
12535 #$i_unistd I_UNISTD
12536 #$i_stdlib I_STDLIB
12537 #include <stdio.h>
12538 #ifdef I_UNISTD
12539 #  include <unistd.h>
12540 #endif
12541 #ifdef I_STDLIB
12542 #  include <stdlib.h>
12543 #endif
12544 int main()
12545 {
12546         register int i;
12547         register unsigned long tmp;
12548         register unsigned long max = 0L;
12549
12550         for (i = 1000; i; i--) {
12551                 tmp = (unsigned long) $randfunc();
12552                 if (tmp > max) max = tmp;
12553         }
12554         for (i = 0; max; i++)
12555                 max /= 2;
12556         printf("%d\n",i);
12557 }
12558 EOCP
12559                                 set try
12560                                 if eval $compile_ok; then
12561                                         dflt=`try`
12562                                 else
12563                                         dflt='?'
12564                                         echo "(I can't seem to compile the test program...)"
12565                                 fi
12566                                 ;;
12567                         *)
12568                                 dflt="$randbits"
12569                                 ;;
12570                         esac
12571                         rp="How many bits does your $randfunc() function produce?"
12572                         . ./myread
12573                         randbits="$ans"
12574                         $rm -f try.c try
12575                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
12576                         seedfunc="s$randfunc"
12577                         randseedtype=unsigned
12578                         ;;
12579                 *)
12580                         dflt="31"
12581                         rp="How many bits does your $randfunc() function produce?"
12582                         . ./myread
12583                         randbits="$ans"
12584                         seedfunc="s$randfunc"
12585                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
12586                         if set $seedfunc val -f; eval $csym; $val; then
12587                                 echo "(Using $seedfunc() to seed random generator)"
12588                         else
12589                                 echo "(Warning: no $seedfunc() to seed random generator)"
12590                                 seedfunc=rand
12591                         fi
12592                         randseedtype=unsigned
12593                         ;;
12594                 esac
12595                 ;;
12596         esac
12597 done
12598
12599 echo " "
12600 echo "Determining whether or not we are on an EBCDIC system..." >&4
12601 $cat >tebcdic.c <<'EOM'
12602 int main()
12603 {
12604   if ('M'==0xd4) return 0;
12605   return 1;
12606 }
12607 EOM
12608
12609 val=$undef
12610 set tebcdic
12611 if eval $compile_ok; then
12612         if ./tebcdic; then
12613                 echo "You have EBCDIC." >&4
12614                 val="$define"
12615         else
12616                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin." >&4
12617         fi
12618 else
12619         echo "I'm unable to compile the test program." >&4
12620         echo "I'll assume ASCII or some ISO Latin." >&4
12621 fi
12622 $rm -f tebcdic.c tebcdic
12623 set ebcdic
12624 eval $setvar
12625
12626 echo " "
12627 $cat >&4 <<EOM
12628 Checking how to flush all pending stdio output...
12629 EOM
12630 # I only know how to find the first 32 possibly open files on SunOS.
12631 # See also hints/sunos_4_1.sh and util.c  --AD
12632 case "$osname" in
12633 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
12634 esac
12635 $cat >>try.c <<EOCP
12636 #include <stdio.h>
12637 #$i_unistd I_UNISTD
12638 #ifdef I_UNISTD
12639 # include <unistd.h>
12640 #endif
12641 #$d_sysconf HAS_SYSCONF
12642 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
12643 #ifdef HAS_STDIO_STREAM_ARRAY
12644 # define STDIO_STREAM_ARRAY $stdio_stream_array
12645 #endif
12646 int main() {
12647   FILE* p = fopen("try.out", "w");
12648 #ifdef TRY_FPUTC
12649   fputc('x', p);
12650 #else
12651 # ifdef TRY_FPRINTF
12652   fprintf(p, "x");
12653 # endif
12654 #endif
12655 #ifdef TRY_FFLUSH_NULL
12656   fflush(NULL);
12657 #endif
12658 #ifdef TRY_FFLUSH_ALL
12659   {
12660     long open_max = -1;
12661 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
12662     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
12663 # else
12664 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
12665     open_max = sysconf(_SC_OPEN_MAX);
12666 #  else
12667 #   ifdef FOPEN_MAX
12668     open_max = FOPEN_MAX;
12669 #   else
12670 #    ifdef OPEN_MAX
12671     open_max = OPEN_MAX;
12672 #    else
12673 #     ifdef _NFILE
12674     open_max = _NFILE;
12675 #     endif
12676 #    endif
12677 #   endif
12678 #  endif
12679 # endif 
12680 # ifdef HAS_STDIO_STREAM_ARRAY
12681     if (open_max > 0) {
12682       long i;
12683       for (i = 0; i < open_max; i++)
12684             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
12685                 STDIO_STREAM_ARRAY[i]._file < open_max &&
12686                 STDIO_STREAM_ARRAY[i]._flag)
12687                 fflush(&STDIO_STREAM_ARRAY[i]);
12688     }   
12689   }
12690 # endif
12691 #endif
12692   _exit(42);
12693 }
12694 EOCP
12695 : first we have to find out how _not_ to flush
12696 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
12697     output=''
12698     set try -DTRY_FPUTC
12699     if eval $compile; then
12700             $rm -f try.out
12701             ./try$exe_ext 2>/dev/null
12702             if $test ! -s try.out -a "X$?" = X42; then
12703                 output=-DTRY_FPUTC
12704             fi
12705     fi
12706     case "$output" in
12707     '')
12708             set try -DTRY_FPRINTF
12709             $rm -f try.out
12710             if eval $compile; then
12711                     $rm -f try.out
12712                     ./try$exe_ext 2>/dev/null
12713                     if $test ! -s try.out -a "X$?" = X42; then
12714                         output=-DTRY_FPRINTF
12715                     fi
12716             fi
12717         ;;
12718     esac
12719 fi
12720 : check for fflush NULL behaviour
12721 case "$fflushNULL" in
12722 '')     set try -DTRY_FFLUSH_NULL $output
12723         if eval $compile; then
12724                 $rm -f try.out
12725                 ./try$exe_ext 2>/dev/null
12726                 code="$?"
12727                 if $test -s try.out -a "X$code" = X42; then
12728                         fflushNULL="`$cat try.out`"
12729                 else
12730                         if $test "X$code" != X42; then
12731                                 $cat >&4 <<EOM
12732 (If this test failed, don't worry, we'll try another method shortly.)
12733 EOM
12734                         fi
12735                 fi
12736         fi
12737         $rm -f core try.core core.try.*
12738         case "$fflushNULL" in
12739         x)      $cat >&4 <<EOM
12740 Your fflush(NULL) works okay for output streams.
12741 Let's see if it clobbers input pipes...
12742 EOM
12743 # As of mid-March 2000 all versions of Solaris appear to have a stdio
12744 # bug that improperly flushes the input end of pipes.  So we avoid the
12745 # autoflush on fork/system/exec support for now. :-(
12746 $cat >tryp.c <<EOCP
12747 #include <stdio.h>
12748 int
12749 main(int argc, char **argv)
12750 {
12751     char buf[1024];
12752     int i;
12753     char *bp = buf;
12754     while (1) {
12755         while ((i = getc(stdin)) != -1
12756                && (*bp++ = i) != '\n'
12757                && bp < &buf[1024])
12758         /* DO NOTHING */ ;
12759         *bp = '\0';
12760         fprintf(stdout, "%s", buf);
12761         fflush(NULL);
12762         if (i == -1)
12763             return 0;
12764         bp = buf;
12765     }
12766 }
12767 EOCP
12768                 fflushNULL="$define"
12769                 set tryp
12770                 if eval $compile; then
12771                     $rm -f tryp.out
12772                     $cat tryp.c | ./tryp$exe_ext 2>/dev/null > tryp.out
12773                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
12774                        $cat >&4 <<EOM
12775 fflush(NULL) seems to behave okay with input streams.
12776 EOM
12777                         fflushNULL="$define"
12778                     else
12779                         $cat >&4 <<EOM
12780 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
12781 EOM
12782                         fflushNULL="$undef"
12783                     fi
12784                 fi
12785                 $rm -f core tryp.c tryp.core core.tryp.*
12786                 ;;
12787         '')     $cat >&4 <<EOM
12788 Your fflush(NULL) isn't working (contrary to ANSI C).
12789 EOM
12790                 fflushNULL="$undef"
12791                 ;;
12792         *)      $cat >&4 <<EOM
12793 Cannot figure out whether your fflush(NULL) works or not.
12794 I'm assuming it doesn't (contrary to ANSI C).
12795 EOM
12796                 fflushNULL="$undef"
12797                 ;;
12798         esac
12799         ;;
12800 $define|true|[yY]*)
12801         fflushNULL="$define"
12802         ;;
12803 *)
12804         fflushNULL="$undef"
12805         ;;
12806 esac
12807 : check explicit looping only if NULL did not work, and if the pipe
12808 : bug does not show up on an explicit flush too
12809 case "$fflushNULL" in
12810 "$undef")
12811         $cat >tryp.c <<EOCP
12812 #include <stdio.h>
12813 int
12814 main(int argc, char **argv)
12815 {
12816     char buf[1024];
12817     int i;
12818     char *bp = buf;
12819     while (1) {
12820         while ((i = getc(stdin)) != -1
12821                && (*bp++ = i) != '\n'
12822                && bp < &buf[1024])
12823         /* DO NOTHING */ ;
12824         *bp = '\0';
12825         fprintf(stdout, "%s", buf);
12826         fflush(stdin);
12827         if (i == -1)
12828             return 0;
12829         bp = buf;
12830     }
12831 }
12832 EOCP
12833         set tryp
12834         if eval $compile; then
12835             $rm -f tryp.out
12836             $cat tryp.c | ./tryp$exe_ext 2>/dev/null > tryp.out
12837             if cmp tryp.c tryp.out >/dev/null 2>&1; then
12838                $cat >&4 <<EOM
12839 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
12840 EOM
12841                 : now check for fflushall behaviour
12842                 case "$fflushall" in
12843                 '')     set try -DTRY_FFLUSH_ALL $output
12844                         if eval $compile; then
12845                                 $cat >&4 <<EOM
12846 (Now testing the other method--but note that this also may fail.)
12847 EOM
12848                                 $rm -f try.out
12849                                 ./try$exe_ext 2>/dev/null
12850                                 if $test -s try.out -a "X$?" = X42; then
12851                                         fflushall="`$cat try.out`"
12852                                 fi
12853                         fi
12854                         $rm -f core try.core core.try.*
12855                         case "$fflushall" in
12856                         x)      $cat >&4 <<EOM
12857 Whew. Flushing explicitly all the stdio streams works.
12858 EOM
12859                                 fflushall="$define"
12860                                 ;;
12861                         '')     $cat >&4 <<EOM
12862 Sigh. Flushing explicitly all the stdio streams doesn't work.
12863 EOM
12864                                 fflushall="$undef"
12865                                 ;;
12866                         *)      $cat >&4 <<EOM
12867 Cannot figure out whether flushing stdio streams explicitly works or not.
12868 I'm assuming it doesn't.
12869 EOM
12870                                 fflushall="$undef"
12871                                 ;;
12872                         esac
12873                         ;;
12874                 "$define"|true|[yY]*)
12875                         fflushall="$define"
12876                         ;;
12877                 *)
12878                         fflushall="$undef"
12879                         ;;
12880                 esac
12881             else
12882                 $cat >&4 <<EOM
12883 All is futile.  Even fflush(stdin) clobbers input pipes!
12884 EOM
12885                 fflushall="$undef"
12886             fi
12887         else
12888             fflushall="$undef"
12889         fi
12890         $rm -f core tryp.c tryp.core core.tryp.*
12891         ;;
12892 *)      fflushall="$undef"
12893         ;;
12894 esac
12895
12896 case "$fflushNULL$fflushall" in
12897 undefundef)
12898         $cat <<EOM
12899 OK, I give up.  I cannot figure out how to flush pending stdio output.
12900 We won't be flushing handles at all before fork/exec/popen.
12901 EOM
12902         ;;
12903 esac
12904 $rm -f try.* try$exe_ext
12905
12906 : Store the full pathname to the ar program for use in the C program
12907 : Respect a hint or command line value for full_ar.
12908 case "$full_ar" in
12909 '') full_ar=$ar ;;
12910 esac
12911
12912 : Store the full pathname to the sed program for use in the C program
12913 full_sed=$sed
12914
12915 : see what type gids are declared as in the kernel
12916 echo " "
12917 echo "Looking for the type for group ids returned by getgid()."
12918 set gid_t gidtype xxx stdio.h sys/types.h
12919 eval $typedef
12920 case "$gidtype" in
12921 xxx)
12922         xxx=`./findhdr sys/user.h`
12923         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
12924         case $1 in
12925         unsigned) dflt="$1 $2" ;;
12926         *) dflt="$1" ;;
12927         esac
12928         ;;
12929 *) dflt="$gidtype";;
12930 esac
12931 case "$gidtype" in
12932 gid_t) echo "gid_t found." ;;
12933 *)      rp="What is the type for group ids returned by getgid()?"
12934         . ./myread
12935         gidtype="$ans"
12936         ;;
12937 esac
12938
12939 echo " "
12940 case "$gidtype" in
12941 *_t) zzz="$gidtype"     ;;
12942 *)   zzz="gid"          ;;
12943 esac
12944 echo "Checking the size of $zzz..." >&4 
12945 cat > try.c <<EOCP
12946 #include <sys/types.h>
12947 #include <stdio.h>
12948 int main() {
12949     printf("%d\n", (int)sizeof($gidtype));
12950     exit(0);
12951 }
12952 EOCP
12953 set try
12954 if eval $compile_ok; then
12955         yyy=`./try`
12956         case "$yyy" in
12957         '')     gidsize=4
12958                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
12959                 ;;
12960         *)      gidsize=$yyy
12961                 echo "Your $zzz is $gidsize bytes long."
12962                 ;;
12963         esac
12964 else
12965         gidsize=4
12966         echo "(I can't compile the test program--guessing $gidsize.)" >&4
12967 fi
12968
12969
12970 echo " "
12971 case "$gidtype" in
12972 *_t) zzz="$gidtype"     ;;
12973 *)   zzz="gid"          ;;
12974 esac
12975 echo "Checking the sign of $zzz..." >&4 
12976 cat > try.c <<EOCP
12977 #include <sys/types.h>
12978 #include <stdio.h>
12979 int main() {
12980         $gidtype foo = -1;
12981         if (foo < 0)
12982                 printf("-1\n");
12983         else
12984                 printf("1\n");
12985 }
12986 EOCP
12987 set try
12988 if eval $compile; then
12989         yyy=`./try`
12990         case "$yyy" in
12991         '')     gidsign=1
12992                 echo "(I can't execute the test program--guessing unsigned.)" >&4
12993                 ;;
12994         *)      gidsign=$yyy
12995                 case "$gidsign" in
12996                  1) echo "Your $zzz is unsigned." ;;
12997                 -1) echo "Your $zzz is signed."   ;;
12998                 esac
12999                 ;;
13000         esac
13001 else
13002         gidsign=1
13003         echo "(I can't compile the test program--guessing unsigned.)" >&4
13004 fi
13005
13006
13007 echo " "
13008
13009 if $test X"$quadtype" != X; then
13010
13011 echo "Checking how to print 64-bit integers..." >&4
13012
13013 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
13014         $cat >try.c <<'EOCP'
13015 #include <sys/types.h>
13016 #include <stdio.h>
13017 int main() {
13018   int q = 12345678901;
13019   printf("%ld\n", q);
13020 }
13021 EOCP
13022         set try
13023         if eval $compile; then
13024                 yyy=`./try$exe_ext`
13025                 case "$yyy" in
13026                 12345678901)
13027                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
13028                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIX64='"X"';
13029                         echo "We will use %d."
13030                         ;;
13031                 esac
13032         fi
13033 fi
13034
13035 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
13036         $cat >try.c <<'EOCP'
13037 #include <sys/types.h>
13038 #include <stdio.h>
13039 int main() {
13040   long q = 12345678901;
13041   printf("%ld\n", q);
13042 }
13043 EOCP
13044         set try
13045         if eval $compile; then
13046                 yyy=`./try$exe_ext`
13047                 case "$yyy" in
13048                 12345678901)
13049                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
13050                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIX64='"lX"';
13051                         echo "We will use %ld."
13052                         ;;
13053                 esac
13054         fi
13055 fi
13056
13057 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
13058         $cat >try.c <<'EOCP'
13059 #include <sys/types.h>
13060 #include <inttypes.h>
13061 #include <stdio.h>
13062 int main() {
13063   int64_t q = 12345678901;
13064   printf("%" PRId64 "\n", q);
13065 }
13066 EOCP
13067         set try
13068         if eval $compile; then
13069                 yyy=`./try$exe_ext`
13070                 case "$yyy" in
13071                 12345678901)
13072                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
13073                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIX64=PRIX64;
13074                         echo "We will use the C9X style."
13075                         ;;
13076                 esac
13077         fi
13078 fi
13079
13080 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
13081         $cat >try.c <<'EOCP'
13082 #include <sys/types.h>
13083 #include <stdio.h>
13084 int main() {
13085   long long q = 12345678901LL; /* AIX cc requires the LL prefix. */
13086   printf("%lld\n", q);
13087 }
13088 EOCP
13089         set try
13090         if eval $compile; then
13091                 yyy=`./try$exe_ext`
13092                 case "$yyy" in
13093                 12345678901)
13094                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
13095                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIX64='"llX"';
13096                         echo "We will use the %lld style."
13097                         ;;
13098                 esac
13099         fi
13100 fi
13101
13102 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
13103         $cat >try.c <<EOCP
13104 #include <sys/types.h>
13105 #include <stdio.h>
13106 int main() {
13107   $quadtype q = 12345678901;
13108   printf("%Ld\n", q);
13109 }
13110 EOCP
13111         set try
13112         if eval $compile; then
13113                 yyy=`./try$exe_ext`
13114                 case "$yyy" in
13115                 12345678901)
13116                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
13117                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIX64='"LX"';
13118                         echo "We will use %Ld."
13119                         ;;
13120                 esac
13121         fi
13122 fi
13123
13124 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
13125         $cat >try.c <<EOCP
13126 #include <sys/types.h>
13127 #include <stdio.h>
13128 int main() {
13129   $quadtype q = 12345678901;
13130   printf("%qd\n", q);
13131 }
13132 EOCP
13133         set try
13134         if eval $compile; then
13135                 yyy=`./try$exe_ext`
13136                 case "$yyy" in
13137                 12345678901)
13138                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
13139                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIX64='"qX"';
13140                         echo "We will use %qd."
13141                         ;;
13142                 esac
13143         fi
13144 fi
13145
13146 if $test X"$sPRId64" = X; then
13147         echo "Cannot figure out how to print 64-bit integers." >&4
13148 fi
13149
13150 $rm -f try try.*
13151
13152 fi
13153
13154 case "$sPRId64" in
13155 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef"; 
13156         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIX64="$undef"; 
13157         ;;
13158 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define"; 
13159         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIX64="$define"; 
13160         ;;
13161 esac
13162
13163
13164 echo " "
13165 $echo "Checking the format strings to be used for Perl's internal types..." >&4
13166
13167 if $test X"$ivsize" = X8; then
13168         ivdformat="$sPRId64"
13169         uvuformat="$sPRIu64"
13170         uvoformat="$sPRIo64"
13171         uvxformat="$sPRIx64"
13172 else
13173         if $test X"$ivsize" = X"$longsize"; then
13174                 ivdformat='"ld"'
13175                 uvuformat='"lu"'
13176                 uvoformat='"lo"'
13177                 uvxformat='"lx"'
13178         else
13179                 if $test X"$ivsize" = X"$intsize"; then
13180                         ivdformat='"d"'
13181                         uvuformat='"u"'
13182                         uvoformat='"o"'
13183                         uvxformat='"x"'
13184                 else
13185                         : far out
13186                         if $test X"$ivsize" = X"$shortsize"; then
13187                                 ivdformat='"hd"'
13188                                 uvuformat='"hu"'
13189                                 uvoformat='"ho"'
13190                                 uvxformat='"hx"'
13191                         fi
13192                 fi
13193         fi
13194 fi
13195
13196 case "$ivdformat" in
13197 '') echo "$0: Fatal: failed to find format strings, cannot continue." >& 4
13198     exit 1
13199     ;;
13200 esac
13201
13202
13203 echo " "
13204 $echo "Checking the format string to be used for gids..." >&4
13205
13206 case "$gidsign" in
13207 -1)     if $test X"$gidsize" = X"$ivsize"; then
13208                 gidformat="$ivdformat"
13209         else
13210                 if $test X"$gidsize" = X"$longsize"; then
13211                         gidformat='"ld"'
13212                 else
13213                         if $test X"$gidsize" = X"$intsize"; then
13214                                 gidformat='"d"'
13215                         else
13216                                 if $test X"$gidsize" = X"$shortsize"; then
13217                                         gidformat='"hd"'
13218                                 fi
13219                         fi
13220                 fi
13221         fi
13222         ;;
13223 *)      if $test X"$gidsize" = X"$uvsize"; then
13224                 gidformat="$uvuformat"
13225         else
13226                 if $test X"$gidsize" = X"$longsize"; then
13227                         gidformat='"lu"'
13228                 else
13229                         if $test X"$gidsize" = X"$intsize"; then
13230                                 gidformat='"u"'
13231                         else
13232                                 if $test X"$gidsize" = X"$shortsize"; then
13233                                         gidformat='"hu"'
13234                                 fi
13235                         fi
13236                 fi
13237         fi
13238         ;;
13239 esac
13240
13241 : see if getgroups exists
13242 set getgroups d_getgrps
13243 eval $inlibc
13244
13245 : see if setgroups exists
13246 set setgroups d_setgrps
13247 eval $inlibc
13248
13249
13250 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
13251 echo " "
13252 case "$d_getgrps$d_setgrps" in
13253 *define*)
13254         case "$groupstype" in
13255         '') dflt="$gidtype" ;;
13256         *)  dflt="$groupstype" ;;
13257         esac
13258         $cat <<EOM
13259 What type of pointer is the second argument to getgroups() and setgroups()?
13260 Usually this is the same as group ids, $gidtype, but not always.
13261
13262 EOM
13263         rp='What type pointer is the second argument to getgroups() and setgroups()?'
13264         . ./myread
13265         groupstype="$ans"
13266         ;;
13267 *)  groupstype="$gidtype";;
13268 esac
13269
13270 echo " "
13271 echo "Checking if your $make program sets \$(MAKE)..." >&4
13272 case "$make_set_make" in
13273 '')
13274         $sed 's/^X //' > testmake.mak << 'EOF'
13275 Xall:
13276 X       @echo 'maketemp="$(MAKE)"'
13277 EOF
13278         case "`$make -f testmake.mak 2>/dev/null`" in
13279         *maketemp=*) make_set_make='#' ;;
13280         *)      make_set_make="MAKE=$make" ;;
13281         esac
13282         $rm -f testmake.mak
13283         ;;
13284 esac
13285 case "$make_set_make" in
13286 '#') echo "Yup, it does.";;
13287 *) echo "Nope, it doesn't.";;
13288 esac
13289
13290 : see what type is used for mode_t
13291 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
13292 set mode_t modetype int stdio.h sys/types.h
13293 eval $typedef_ask
13294
13295 : define a fucntion to check prototypes
13296 $cat > protochk <<EOSH
13297 $startsh
13298 cc="$cc"
13299 optimize="$optimize"
13300 ccflags="$ccflags"
13301 prototype="$prototype"
13302 define="$define"
13303 rm=$rm
13304 EOSH
13305
13306 $cat >> protochk <<'EOSH'
13307
13308 $rm -f try.c
13309 foo="$1"
13310 shift
13311 while test $# -ge 2; do
13312         case "$1" in
13313                 $define) echo "#include <$2>" >> try.c ;;
13314                 literal) echo "$2" >> try.c ;;
13315         esac
13316     shift 2
13317 done
13318 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
13319 cat >> try.c <<'EOCP'
13320 #ifdef CAN_PROTOTYPE
13321 #define _(args) args
13322 #else
13323 #define _(args) ()
13324 #endif
13325 EOCP
13326 echo "$foo" >> try.c
13327 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
13328 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
13329 status=$?
13330 $rm -f try.[co]
13331 exit $status
13332 EOSH
13333 chmod +x protochk
13334 $eunicefix protochk
13335
13336 : see what type is used for size_t
13337 rp="What is the type used for the length parameter for string functions?"
13338 set size_t sizetype 'unsigned int' stdio.h sys/types.h
13339 eval $typedef_ask
13340
13341 : check for type of arguments to gethostbyaddr. 
13342 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
13343         case "$d_gethbyaddr" in
13344         $define)
13345                 $cat <<EOM
13346
13347 Checking to see what type of arguments are accepted by gethostbyaddr().
13348 EOM
13349                 hdrs="$define sys/types.h
13350                         $d_socket sys/socket.h 
13351                         $i_niin netinet/in.h 
13352                         $i_netdb netdb.h
13353                         $i_unistd unistd.h"
13354                 : The first arg can 'char *' or 'void *'
13355                 : The second arg is some of integral type
13356                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
13357                         for yyy in size_t long int; do
13358                                 case "$netdb_host_type" in
13359                                 '')     try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
13360                                         if ./protochk "$try" $hdrs; then
13361                                                 echo "Your system accepts $xxx for the first arg."
13362                                                 echo "...and $yyy for the second arg."
13363                                                 netdb_host_type="$xxx"
13364                                                 netdb_hlen_type="$yyy"
13365                                         fi
13366                                         ;;
13367                                 esac
13368                         done
13369                 done
13370                 : In case none of those worked, prompt the user.
13371                 case "$netdb_host_type" in
13372                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
13373                         dflt='char *'
13374                         . ./myread
13375                         netdb_host_type=$ans
13376                         rp='What is the type for the 2nd argument to gethostbyaddr?'
13377                         dflt="$sizetype"
13378                         . ./myread
13379                         netdb_hlen_type=$ans
13380                         ;;
13381                 esac
13382                 ;;
13383         *)      : no gethostbyaddr, so pick harmless defaults
13384                 netdb_host_type='char *'
13385                 netdb_hlen_type="$sizetype"
13386                 ;;
13387         esac
13388         # Remove the "const" if needed. -- but then we'll have a 
13389         # prototype clash!
13390         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
13391 fi
13392
13393 : check for type of argument to gethostbyname. 
13394 if test "X$netdb_name_type" = X ; then
13395         case "$d_gethbyname" in
13396         $define)
13397                 $cat <<EOM
13398
13399 Checking to see what type of argument is accepted by gethostbyname().
13400 EOM
13401                 hdrs="$define sys/types.h
13402                         $d_socket sys/socket.h 
13403                         $i_niin netinet/in.h 
13404                         $i_netdb netdb.h
13405                         $i_unistd unistd.h"
13406                 for xxx in "const char *" "char *"; do
13407                         case "$netdb_name_type" in
13408                         '')     try="extern struct hostent *gethostbyname($xxx);"
13409                                 if ./protochk "$try" $hdrs; then
13410                                         echo "Your system accepts $xxx."
13411                                         netdb_name_type="$xxx"
13412                                 fi
13413                                 ;;
13414                         esac
13415                 done
13416                 : In case none of those worked, prompt the user.
13417                 case "$netdb_name_type" in
13418                 '')     rp='What is the type for the 1st argument to gethostbyname?'
13419                         dflt='char *'
13420                         . ./myread
13421                         netdb_name_type=$ans
13422                         ;;
13423                 esac
13424                 ;;
13425         *)      : no gethostbyname, so pick harmless default
13426                 netdb_name_type='char *'
13427                 ;;
13428         esac
13429 fi
13430
13431 : check for type of 1st argument to getnetbyaddr. 
13432 if test "X$netdb_net_type" = X ; then
13433         case "$d_getnbyaddr" in
13434         $define)
13435                 $cat <<EOM
13436
13437 Checking to see what type of 1st argument is accepted by getnetbyaddr().
13438 EOM
13439                 hdrs="$define sys/types.h
13440                         $d_socket sys/socket.h 
13441                         $i_niin netinet/in.h 
13442                         $i_netdb netdb.h
13443                         $i_unistd unistd.h"
13444                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
13445                         case "$netdb_net_type" in
13446                         '')     try="extern struct netent *getnetbyaddr($xxx, int);"
13447                                 if ./protochk "$try" $hdrs; then
13448                                         echo "Your system accepts $xxx."
13449                                         netdb_net_type="$xxx"
13450                                 fi
13451                                 ;;
13452                         esac
13453                 done
13454                 : In case none of those worked, prompt the user.
13455                 case "$netdb_net_type" in
13456                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
13457                         dflt='long'
13458                         . ./myread
13459                         netdb_net_type=$ans
13460                         ;;
13461                 esac
13462                 ;;
13463         *)      : no getnetbyaddr, so pick harmless default
13464                 netdb_net_type='long'
13465                 ;;
13466         esac
13467 fi
13468 : locate the preferred pager for this system
13469 case "$pager" in
13470 '')
13471         dflt=''
13472         case "$pg" in
13473         /*) dflt=$pg;;
13474         esac
13475         case "$more" in
13476         /*) dflt=$more;;
13477         esac
13478         case "$less" in
13479         /*) dflt=$less;;
13480         esac
13481         case "$dflt" in
13482         '') dflt=/usr/ucb/more;;
13483         esac
13484         ;;
13485 *) dflt="$pager";;
13486 esac
13487 echo " "
13488 fn=f/
13489 rp='What pager is used on your system?'
13490 . ./getfile
13491 pager="$ans"
13492
13493 : see what type pids are declared as in the kernel
13494 rp="What is the type of process ids on this system?"
13495 set pid_t pidtype int stdio.h sys/types.h
13496 eval $typedef_ask
13497
13498 : Find earliest binary compatible site_perl subdirectory perl can use.
13499 case "$bincompat5005" in
13500 "$define") xs_apiversion='5.005' ;;
13501 *) xs_apiversion=$version ;;   # The current site_perl version.
13502 esac
13503 : Find earliest pure perl site_perl subdirectory perl can use.
13504 : The versioned directories started at 5.005.
13505 pm_apiversion='5.005'
13506
13507 : check for length of pointer
13508 echo " "
13509 case "$ptrsize" in
13510 '')
13511         echo "Checking to see how big your pointers are..." >&4
13512         if test "$voidflags" -gt 7; then
13513                 echo '#define VOID_PTR char *' > try.c
13514         else
13515                 echo '#define VOID_PTR void *' > try.c
13516         fi
13517         $cat >>try.c <<'EOCP'
13518 #include <stdio.h>
13519 int main()
13520 {
13521     printf("%d\n", (int)sizeof(VOID_PTR));
13522     exit(0);
13523 }
13524 EOCP
13525         set try
13526         if eval $compile_ok; then
13527                 ptrsize=`./try`
13528                 echo "Your pointers are $ptrsize bytes long."
13529         else
13530                 dflt='4'
13531                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
13532                 rp="What is the size of a pointer (in bytes)?"
13533                 . ./myread
13534                 ptrsize="$ans"
13535         fi
13536         ;;
13537 esac
13538 $rm -f try.c try
13539
13540 : see if ar generates random libraries by itself
13541 echo " "
13542 echo "Checking how to generate random libraries on your machine..." >&4
13543 echo 'int bar1() { return bar2(); }' > bar1.c
13544 echo 'int bar2() { return 2; }' > bar2.c
13545 $cat > foo.c <<'EOP'
13546 int main() { printf("%d\n", bar1()); exit(0); }
13547 EOP
13548 $cc $ccflags -c bar1.c >/dev/null 2>&1
13549 $cc $ccflags -c bar2.c >/dev/null 2>&1
13550 $cc $ccflags -c foo.c >/dev/null 2>&1
13551 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
13552 if $cc $ccflags $ldflags -o foobar foo$_o bar$_a $libs > /dev/null 2>&1 &&
13553         ./foobar >/dev/null 2>&1; then
13554         echo "$ar appears to generate random libraries itself."
13555         orderlib=false
13556         ranlib=":"
13557 elif $ar ts bar$_a >/dev/null 2>&1 &&
13558         $cc $ccflags $ldflags -o foobar foo$_o bar$_a $libs > /dev/null 2>&1 &&
13559         ./foobar >/dev/null 2>&1; then
13560                 echo "a table of contents needs to be added with '$ar ts'."
13561                 orderlib=false
13562                 ranlib="$ar ts"
13563 else
13564         case "$ranlib" in
13565         :) ranlib='';;
13566         '')
13567                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
13568                 $test -f $ranlib || ranlib=''
13569                 ;;
13570         esac
13571         if $test -n "$ranlib"; then
13572                 echo "your system has '$ranlib'; we'll use that."
13573                 orderlib=false
13574         else
13575                 echo "your system doesn't seem to support random libraries"
13576                 echo "so we'll use lorder and tsort to order the libraries."
13577                 orderlib=true
13578                 ranlib=":"
13579         fi
13580 fi
13581 $rm -f foo* bar* 
13582
13583 : check for type of arguments to select. 
13584 case "$selecttype" in
13585 '') case "$d_select" in
13586         $define)
13587                 echo " "
13588                 $cat <<EOM
13589 Checking to see what type of arguments are accepted by select().
13590 EOM
13591                 hdrs="$define sys/types.h
13592                         $i_systime sys/time.h 
13593                         $i_sysselct sys/select.h
13594                         $d_socket sys/socket.h"
13595                 : The first arg can be int, unsigned, or size_t
13596                 : The last arg may or may not be 'const'
13597                 val=''
13598                 : void pointer has been seen but using that
13599                 : breaks the selectminbits test
13600                 for xxx in 'fd_set *' 'int *'; do
13601                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
13602                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
13603                                         case "$val" in
13604                                         '')     try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
13605                                                 if ./protochk "$try" $hdrs; then
13606                                                         echo "Your system accepts $xxx."
13607                                                         val="$xxx"
13608                                                 fi
13609                                                 ;;
13610                                         esac
13611                                 done
13612                         done
13613                 done
13614                 case "$val" in
13615                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
13616                         case "$d_fd_set" in
13617                                 $define) dflt="fd_set *" ;;
13618                                 *)              dflt="int *" ;;
13619                         esac
13620                         . ./myread
13621                         val=$ans
13622                         ;;
13623                 esac
13624                 selecttype="$val"
13625                 ;;
13626         *)      : no select, so pick a harmless default
13627                 selecttype='int *'
13628                 ;;
13629         esac
13630         ;;
13631 esac
13632
13633 : check for the select 'width'
13634 case "$selectminbits" in
13635 '') case "$d_select" in
13636         $define)
13637                 $cat <<EOM
13638
13639 Checking to see on how many bits at a time your select() operates...
13640 EOM
13641                 $cat >try.c <<EOCP
13642 #include <sys/types.h>
13643 #$i_time I_TIME
13644 #$i_systime I_SYS_TIME
13645 #$i_systimek I_SYS_TIME_KERNEL
13646 #ifdef I_TIME
13647 #   include <time.h>
13648 #endif
13649 #ifdef I_SYS_TIME
13650 #   ifdef I_SYS_TIME_KERNEL
13651 #       define KERNEL
13652 #   endif
13653 #   include <sys/time.h>
13654 #   ifdef I_SYS_TIME_KERNEL
13655 #       undef KERNEL
13656 #   endif
13657 #endif
13658 #$i_sysselct I_SYS_SELECT
13659 #ifdef I_SYS_SELECT
13660 #include <sys/select.h>
13661 #endif
13662 #$d_socket HAS_SOCKET
13663 #ifdef HAS_SOCKET
13664 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
13665 #endif
13666 #include <stdio.h>
13667 $selecttype b;
13668 #define S sizeof(*(b))
13669 #define MINBITS 64
13670 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
13671 #define NBITS  (NBYTES * 8)
13672 int main() {
13673     char s[NBYTES];
13674     struct timeval t;
13675     int i;
13676     FILE* fp;
13677     int fd;
13678
13679     fclose(stdin);
13680     fp = fopen("try.c", "r");
13681     if (fp == 0)
13682       exit(1);
13683     fd = fileno(fp);
13684     if (fd < 0)
13685       exit(2);
13686     b = ($selecttype)s;
13687     for (i = 0; i < NBITS; i++)
13688         FD_SET(i, b);
13689     t.tv_sec  = 0;
13690     t.tv_usec = 0;
13691     select(fd + 1, b, 0, 0, &t);
13692     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
13693     printf("%d\n", i + 1);
13694     return 0;
13695 }
13696 EOCP
13697                 set try
13698                 if eval $compile_ok; then
13699                         selectminbits=`./try`
13700                         case "$selectminbits" in
13701                         '')     cat >&4 <<EOM
13702 Cannot figure out on how many bits at a time your select() operates.
13703 I'll play safe and guess it is 32 bits.
13704 EOM
13705                                 selectminbits=32
13706                                 bits="32 bits"
13707                                 ;;
13708                         1)      bits="1 bit" ;;
13709                         *)      bits="$selectminbits bits" ;;
13710                         esac
13711                         echo "Your select() operates on $bits at a time." >&4
13712                 else
13713                         rp='What is the minimum number of bits your select() operates on?'
13714                         case "$byteorder" in
13715                         1234|12345678)  dflt=32 ;;
13716                         *)              dflt=1  ;;
13717                         esac
13718                         . ./myread
13719                         val=$ans
13720                         selectminbits="$val"
13721                 fi
13722                 $rm -f try.* try
13723                 ;;
13724         *)      : no select, so pick a harmless default
13725                 selectminbits='32'
13726                 ;;
13727         esac
13728         ;;
13729 esac
13730
13731 : Trace out the files included by signal.h, then look for SIGxxx names.
13732 : Remove SIGARRAYSIZE used by HPUX.
13733 : Remove SIGSTKSIZE used by Linux.
13734 : Remove SIGSTKSZ used by Posix.
13735 : Remove SIGTYP void lines used by OS2.
13736 : Some cpps, like os390, dont give the file name anywhere
13737 if [ "X$fieldn" = X ]; then
13738         : Just make some guesses.  We check them later.
13739         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
13740 else
13741         xxx=`echo '#include <signal.h>' |
13742         $cppstdin $cppminus $cppflags 2>/dev/null |
13743         $grep '^[       ]*#.*include' | 
13744         $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sort | $uniq`
13745 fi
13746 : Check this list of files to be sure we have parsed the cpp output ok.
13747 : This will also avoid potentially non-existent files, such 
13748 : as ../foo/bar.h
13749 xxxfiles=''
13750 for xx in $xxx /dev/null ; do
13751         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
13752 done
13753 : If we have found no files, at least try signal.h
13754 case "$xxxfiles" in
13755 '')     xxxfiles=`./findhdr signal.h` ;;
13756 esac
13757 xxx=`awk '
13758 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
13759         print substr($2, 4, 20)
13760 }
13761 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
13762         print substr($3, 4, 20)
13763 }' $xxxfiles`
13764 : Append some common names just in case the awk scan failed.
13765 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
13766 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
13767 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
13768 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
13769 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
13770
13771 : generate a few handy files for later
13772 $cat > signal.c <<'EOCP'
13773 #include <sys/types.h>
13774 #include <signal.h>
13775 #include <stdio.h>
13776 int main() {
13777
13778 /* Strange style to avoid deeply-nested #if/#else/#endif */
13779 #ifndef NSIG
13780 #  ifdef _NSIG
13781 #    define NSIG (_NSIG)
13782 #  endif
13783 #endif
13784
13785 #ifndef NSIG
13786 #  ifdef SIGMAX
13787 #    define NSIG (SIGMAX+1)
13788 #  endif
13789 #endif
13790
13791 #ifndef NSIG
13792 #  ifdef SIG_MAX
13793 #    define NSIG (SIG_MAX+1)
13794 #  endif
13795 #endif
13796
13797 #ifndef NSIG
13798 #  ifdef MAXSIG
13799 #    define NSIG (MAXSIG+1)
13800 #  endif
13801 #endif
13802
13803 #ifndef NSIG
13804 #  ifdef MAX_SIG
13805 #    define NSIG (MAX_SIG+1)
13806 #  endif
13807 #endif
13808
13809 #ifndef NSIG
13810 #  ifdef SIGARRAYSIZE
13811 #    define NSIG (SIGARRAYSIZE+1) /* Not sure of the +1 */
13812 #  endif
13813 #endif
13814
13815 #ifndef NSIG
13816 #  ifdef _sys_nsig
13817 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
13818 #  endif
13819 #endif
13820
13821 /* Default to some arbitrary number that's big enough to get most
13822    of the common signals.
13823 */
13824 #ifndef NSIG
13825 #    define NSIG 50
13826 #endif
13827
13828 printf("NSIG %d\n", NSIG);
13829
13830 #ifndef JUST_NSIG
13831
13832 EOCP
13833
13834 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
13835 {
13836         printf "#ifdef SIG"; printf $1; printf "\n"
13837         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
13838         printf $1; printf ");\n"
13839         printf "#endif\n"
13840 }
13841 END {
13842         printf "#endif /* JUST_NSIG */\n";
13843         printf "exit(0);\n}\n";
13844 }
13845 ' >>signal.c
13846 $cat >signal.awk <<'EOP'
13847 BEGIN { ndups = 0 }
13848 $1 ~ /^NSIG$/ { nsig = $2 }
13849 ($1 !~ /^NSIG$/) && (NF == 2) {
13850     if ($2 > maxsig) { maxsig = $2 }
13851     if (sig_name[$2]) {
13852         dup_name[ndups] = $1
13853         dup_num[ndups] = $2
13854         ndups++ 
13855     }
13856     else {
13857         sig_name[$2] = $1
13858         sig_num[$2] = $2
13859     }
13860 }
13861 END { 
13862     if (nsig == 0) {
13863         nsig = maxsig + 1
13864     }
13865     printf("NSIG %d\n", nsig);
13866     for (n = 1; n < nsig; n++) {
13867         if (sig_name[n]) {
13868             printf("%s %d\n", sig_name[n], sig_num[n])
13869         }
13870         else {
13871             printf("NUM%d %d\n", n, n) 
13872         }
13873     }
13874     for (n = 0; n < ndups; n++) {
13875         printf("%s %d\n", dup_name[n], dup_num[n])
13876     }
13877 }
13878 EOP
13879 $cat >signal_cmd <<EOS
13880 $startsh
13881 if $test -s signal.lst; then
13882     echo "Using your existing signal.lst file"
13883         exit 0
13884 fi
13885 xxx="$xxx"
13886 EOS
13887 $cat >>signal_cmd <<'EOS'
13888
13889 set signal
13890 if eval $compile_ok; then
13891         ./signal$_exe | $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
13892 else
13893         echo "(I can't seem be able to compile the whole test program)" >&4
13894         echo "(I'll try it in little pieces.)" >&4
13895         set signal -DJUST_NSIG
13896         if eval $compile_ok; then
13897                 ./signal$_exe > signal.nsg
13898                 $cat signal.nsg
13899         else
13900                 echo "I can't seem to figure out how many signals you have." >&4
13901                 echo "Guessing 50." >&4
13902                 echo 'NSIG 50' > signal.nsg
13903         fi
13904         : Now look at all the signal names, one at a time.
13905         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
13906                 $cat > signal.c <<EOCP
13907 #include <sys/types.h>
13908 #include <signal.h>
13909 #include <stdio.h>
13910 int main() {
13911 printf("$xx %d\n", SIG${xx});
13912 return 0;
13913 }
13914 EOCP
13915                 set signal
13916                 if eval $compile; then
13917                         echo "SIG${xx} found."
13918                         ./signal$_exe  >> signal.ls1
13919                 else
13920                         echo "SIG${xx} NOT found."
13921                 fi
13922         done
13923         if $test -s signal.ls1; then
13924                 $cat signal.nsg signal.ls1 |
13925                         $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
13926         fi
13927
13928 fi
13929 if $test -s signal.lst; then
13930         :
13931 else
13932         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
13933         echo 'kill -l' >signal
13934         set X `csh -f <signal`
13935         $rm -f signal
13936         shift
13937         case $# in
13938         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
13939         esac
13940         echo $@ | $tr ' ' $trnl | \
13941             $awk '{ printf "%s %d\n", $1, ++s; }
13942                   END { printf "NSIG %d\n", ++s }' >signal.lst
13943 fi
13944 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
13945 EOS
13946 chmod a+x signal_cmd
13947 $eunicefix signal_cmd
13948
13949 : generate list of signal names
13950 echo " "
13951 case "$sig_name_init" in
13952 '') doinit=yes ;;
13953 *)  case "$sig_num_init" in
13954     ''|*,*) doinit=yes ;;
13955     esac ;;
13956 esac
13957 case "$doinit" in
13958 yes)
13959         echo "Generating a list of signal names and numbers..." >&4
13960         . ./signal_cmd
13961         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
13962         sig_name=`$awk 'BEGIN { printf "ZERO " }
13963                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
13964         sig_num=`$awk  'BEGIN { printf "0 " }
13965                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
13966         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
13967                              !/^NSIG/   { printf "\"%s\", ", $1 }
13968                              END        { printf "0\n" }' signal.lst`
13969         sig_num_init=`$awk  'BEGIN      { printf "0, " }
13970                              !/^NSIG/   { printf "%d, ", $2}
13971                              END        { printf "0\n"}' signal.lst`
13972         ;;
13973 esac
13974 echo "The following $sig_count signals are available:"
13975 echo " "
13976 echo $sig_name | $awk \
13977 'BEGIN { linelen = 0 }
13978 {
13979         for (i = 1; i <= NF; i++) {
13980                 name = "SIG" $i " "
13981                 linelen = linelen + length(name)
13982                 if (linelen > 70) {
13983                         printf "\n"
13984                         linelen = length(name)
13985                 }
13986                 printf "%s", name
13987         }
13988         printf "\n"
13989 }'
13990 $rm -f signal signal.c signal.awk signal.lst signal_cmd 
13991
13992 echo " "
13993 case "$sizetype" in
13994 *_t) zzz="$sizetype"    ;;
13995 *)   zzz="filesize"     ;;
13996 esac
13997 echo "Checking the size of $zzz..." >&4 
13998 cat > try.c <<EOCP
13999 #include <sys/types.h>
14000 #include <stdio.h>
14001 int main() {
14002     printf("%d\n", (int)sizeof($sizetype));
14003     exit(0);
14004 }
14005 EOCP
14006 set try
14007 if eval $compile_ok; then
14008         yyy=`./try`
14009         case "$yyy" in
14010         '')     sizesize=4
14011                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
14012                 ;;
14013         *)      sizesize=$yyy
14014                 echo "Your $zzz size is $sizesize bytes."
14015                 ;;
14016         esac
14017 else
14018         sizesize=4
14019         echo "(I can't compile the test program--guessing $sizesize.)" >&4
14020 fi
14021
14022
14023 : check for socklen_t
14024 echo " "
14025 echo "Checking to see if you have socklen_t..." >&4
14026 $cat >try.c <<EOCP
14027 #include <sys/types.h>
14028 #$d_socket HAS_SOCKET
14029 #ifdef HAS_SOCKET
14030 #include <sys/socket.h>
14031 #endif
14032 int main() { socklen_t x = 16; }
14033 EOCP
14034 set try
14035 if eval $compile; then
14036         val="$define"
14037         echo "You have socklen_t."
14038 else
14039         val="$undef"
14040         echo "You do not have socklen_t."
14041         case "$sizetype" in
14042         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
14043         esac
14044 fi
14045 $rm -f try try.*
14046 set d_socklen_t
14047 eval $setvar
14048
14049 : check for type of the size argument to socket calls
14050 case "$d_socket" in
14051 "$define")
14052         $cat <<EOM
14053
14054 Checking to see what type is the last argument of accept().
14055 EOM
14056         hdrs="$define sys/types.h $d_socket sys/socket.h" 
14057         yyy=''
14058         case "$d_socklen_t" in
14059         "$define") yyy="$yyy socklen_t"
14060         esac
14061         yyy="$yyy $sizetype int long unsigned"
14062         for xxx in $yyy; do
14063                 case "$socksizetype" in
14064                 '')     try="extern int accept(int, struct sockaddr *, $xxx *);"
14065                         if ./protochk "$try" $hdrs; then
14066                                 echo "Your system accepts '$xxx *' for the last argument of accept()."
14067                                 socksizetype="$xxx"
14068                         fi
14069                         ;;
14070                 esac
14071         done
14072 : In case none of those worked, prompt the user.
14073         case "$socksizetype" in
14074         '')     rp='What is the type for socket address structure sizes?'
14075                 dflt='int'
14076                 . ./myread
14077                 socksizetype=$ans
14078                 ;;
14079         esac
14080         ;;
14081 *)      : no sockets, so pick relatively harmless default
14082         socksizetype='int'
14083         ;;
14084 esac
14085
14086 : see what type is used for signed size_t
14087 set ssize_t ssizetype int stdio.h sys/types.h
14088 eval $typedef
14089 dflt="$ssizetype"
14090 $cat > ssize.c <<EOM
14091 #include <stdio.h>
14092 #include <sys/types.h>
14093 #define Size_t $sizetype
14094 #define SSize_t $dflt
14095 int main()
14096 {
14097         if (sizeof(Size_t) == sizeof(SSize_t))
14098                 printf("$dflt\n");
14099         else if (sizeof(Size_t) == sizeof(int))
14100                 printf("int\n");
14101         else 
14102                 printf("long\n");
14103         exit(0);
14104 }
14105 EOM
14106 echo " "
14107 set ssize
14108 if eval $compile_ok && ./ssize > /dev/null; then
14109         ssizetype=`./ssize`
14110         echo "I'll be using $ssizetype for functions returning a byte count." >&4
14111 else
14112         $cat >&4 <<EOM
14113 Help! I can't compile and run the ssize_t test program: please enlighten me!
14114 (This is probably a misconfiguration in your system or libraries, and
14115 you really ought to fix it.  Still, I'll try anyway.)
14116
14117 I need a type that is the same size as $sizetype, but is guaranteed to
14118 be signed.  Common values are ssize_t, int and long.
14119
14120 EOM
14121         rp="What signed type is the same size as $sizetype?"
14122         . ./myread
14123         ssizetype="$ans"
14124 fi
14125 $rm -f ssize ssize.*
14126
14127 : see what type of char stdio uses.
14128 echo " "
14129 if $contains 'unsigned.*char.*_ptr;' `./findhdr stdio.h` >/dev/null 2>&1 ; then
14130         echo "Your stdio uses unsigned chars." >&4
14131         stdchar="unsigned char"
14132 else
14133         echo "Your stdio uses signed chars." >&4
14134         stdchar="char"
14135 fi
14136
14137 : see if time exists
14138 echo " "
14139 if test "X$d_time" = X -o X"$timetype" = X; then
14140     if set time val -f d_time; eval $csym; $val; then
14141                 echo 'time() found.' >&4
14142                 val="$define"
14143                 rp="What is the type returned by time() on this system?"
14144                 set time_t timetype long stdio.h sys/types.h
14145                 eval $typedef_ask
14146     else
14147                 echo 'time() not found, hope that will do.' >&4
14148                 val="$undef"
14149                 timetype='int';
14150     fi
14151     set d_time
14152     eval $setvar
14153 fi
14154
14155 : see what type uids are declared as in the kernel
14156 echo " "
14157 echo "Looking for the type for user ids returned by getuid()."
14158 set uid_t uidtype xxx stdio.h sys/types.h
14159 eval $typedef
14160 case "$uidtype" in
14161 xxx)
14162         xxx=`./findhdr sys/user.h`
14163         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
14164         case $1 in
14165         unsigned) dflt="$1 $2" ;;
14166         *) dflt="$1" ;;
14167         esac
14168         ;;
14169 *) dflt="$uidtype";;
14170 esac
14171 case "$uidtype" in
14172 uid_t)  echo "uid_t found." ;;
14173 *)      rp="What is the type for user ids returned by getuid()?"
14174         . ./myread
14175         uidtype="$ans"
14176         ;;
14177 esac
14178
14179 echo " "
14180 case "$uidtype" in
14181 *_t) zzz="$uidtype"     ;;
14182 *)   zzz="uid"          ;;
14183 esac
14184 echo "Checking the size of $zzz..." >&4 
14185 cat > try.c <<EOCP
14186 #include <sys/types.h>
14187 #include <stdio.h>
14188 int main() {
14189     printf("%d\n", (int)sizeof($uidtype));
14190     exit(0);
14191 }
14192 EOCP
14193 set try
14194 if eval $compile_ok; then
14195         yyy=`./try`
14196         case "$yyy" in
14197         '')     uidsize=4
14198                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
14199                 ;;
14200         *)      uidsize=$yyy
14201                 echo "Your $zzz is $uidsize bytes long."
14202                 ;;
14203         esac
14204 else
14205         uidsize=4
14206         echo "(I can't compile the test program--guessing $uidsize.)" >&4
14207 fi
14208
14209 echo " "
14210 case "$uidtype" in
14211 *_t) zzz="$uidtype"     ;;
14212 *)   zzz="uid"          ;;
14213 esac
14214 echo "Checking the sign of $zzz..." >&4
14215 cat > try.c <<EOCP
14216 #include <sys/types.h>
14217 #include <stdio.h>
14218 int main() {
14219         $uidtype foo = -1;
14220         if (foo < 0)
14221                 printf("-1\n");
14222         else
14223                 printf("1\n");
14224 }
14225 EOCP
14226 set try
14227 if eval $compile; then
14228         yyy=`./try`
14229         case "$yyy" in
14230         '')     uidsign=1
14231                 echo "(I can't execute the test program--guessing unsigned.)" >&4
14232                 ;;
14233         *)      uidsign=$yyy
14234                 case "$uidsign" in
14235                  1) echo "Your $zzz is unsigned." ;;
14236                 -1) echo "Your $zzz is signed."   ;;
14237                 esac
14238                 ;;
14239         esac
14240 else
14241         uidsign=1
14242         echo "(I can't compile the test program--guessing unsigned.)" >&4
14243 fi
14244
14245
14246
14247 echo " "
14248 $echo "Checking the format string to be used for uids..." >&4
14249
14250 case "$uidsign" in
14251 -1)     if $test X"$uidsize" = X"$ivsize"; then
14252                 uidformat="$ivdformat"
14253         else
14254                 if $test X"$uidsize" = X"$longsize"; then
14255                         uidformat='"ld"'
14256                 else
14257                         if $test X"$uidsize" = X"$intsize"; then
14258                                 uidformat='"d"'
14259                         else
14260                                 if $test X"$uidsize" = X"$shortsize"; then
14261                                         uidformat='"hd"'
14262                                 fi
14263                         fi
14264                 fi
14265         fi
14266         ;;
14267 *)      if $test X"$uidsize" = X"$uvsize"; then
14268                 uidformat="$uvuformat"
14269         else
14270                 if $test X"$uidsize" = X"$longsize"; then
14271                         uidformat='"lu"'
14272                 else
14273                         if $test X"$uidsize" = X"$intsize"; then
14274                                 uidformat='"u"'
14275                         else
14276                                 if $test X"$uidsize" = X"$shortsize"; then
14277                                         uidformat='"hu"'
14278                                 fi
14279                         fi
14280                 fi
14281         fi
14282         ;;
14283 esac
14284
14285 : see if dbm.h is available
14286 : see if dbmclose exists
14287 set dbmclose d_dbmclose
14288 eval $inlibc
14289
14290 case "$d_dbmclose" in
14291 $define)
14292         set dbm.h i_dbm
14293         eval $inhdr
14294         case "$i_dbm" in
14295         $define)
14296                 val="$undef"
14297                 set i_rpcsvcdbm
14298                 eval $setvar
14299                 ;;
14300         *)      set rpcsvc/dbm.h i_rpcsvcdbm
14301                 eval $inhdr
14302                 ;;
14303         esac
14304         ;;
14305 *)      echo "We won't be including <dbm.h>"
14306         val="$undef"
14307         set i_dbm
14308         eval $setvar
14309         val="$undef"
14310         set i_rpcsvcdbm
14311         eval $setvar
14312         ;;
14313 esac
14314
14315 : see if this is a sys/file.h system
14316 val=''
14317 set sys/file.h val
14318 eval $inhdr
14319
14320 : do we need to include sys/file.h ?
14321 case "$val" in
14322 "$define")
14323         echo " "
14324         if $h_sysfile; then
14325                 val="$define"
14326                 echo "We'll be including <sys/file.h>." >&4
14327         else
14328                 val="$undef"
14329                 echo "We won't be including <sys/file.h>." >&4
14330         fi
14331         ;;
14332 *)
14333         h_sysfile=false
14334         ;;
14335 esac
14336 set i_sysfile
14337 eval $setvar
14338
14339 : see if fcntl.h is there
14340 val=''
14341 set fcntl.h val
14342 eval $inhdr
14343
14344 : see if we can include fcntl.h
14345 case "$val" in
14346 "$define")
14347         echo " "
14348         if $h_fcntl; then
14349                 val="$define"
14350                 echo "We'll be including <fcntl.h>." >&4
14351         else
14352                 val="$undef"
14353                 if $h_sysfile; then
14354         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
14355                 else
14356                         echo "We won't be including <fcntl.h>." >&4
14357                 fi
14358         fi
14359         ;;
14360 *)
14361         h_fcntl=false
14362         val="$undef"
14363         ;;
14364 esac
14365 set i_fcntl
14366 eval $setvar
14367
14368 : see if this is a iconv.h system
14369 set iconv.h i_iconv
14370 eval $inhdr
14371
14372 : see if this is a ieeefp.h system
14373 set ieeefp.h i_ieeefp
14374 eval $inhdr
14375
14376 : see if this is a libutil.h system
14377 set libutil.h i_libutil
14378 eval $inhdr
14379
14380 : see if locale.h is available
14381 set locale.h i_locale
14382 eval $inhdr
14383
14384 : see if mach cthreads are available
14385 if test "X$usethreads" = "X$define"; then
14386         set mach/cthreads.h i_machcthr
14387         eval $inhdr
14388 else
14389         i_machcthr="$undef"
14390 fi
14391
14392
14393
14394 : see if this is a math.h system
14395 set math.h i_math
14396 eval $inhdr
14397
14398 : see if this is a mntent.h system
14399 set mntent.h i_mntent
14400 eval $inhdr
14401
14402 : see if ndbm.h is available
14403 set ndbm.h t_ndbm
14404 eval $inhdr
14405 case "$t_ndbm" in
14406 $define)
14407         : see if dbm_open exists
14408         set dbm_open d_dbm_open
14409         eval $inlibc
14410         case "$d_dbm_open" in
14411         $undef)
14412                 t_ndbm="$undef"
14413                 echo "We won't be including <ndbm.h>"
14414                 ;;
14415         esac
14416         ;;
14417 esac
14418 val="$t_ndbm"
14419 set i_ndbm
14420 eval $setvar
14421
14422 : see if net/errno.h is available
14423 val=''
14424 set net/errno.h val
14425 eval $inhdr
14426
14427 : Unfortunately, it causes problems on some systems.  Arrgh.
14428 case "$val" in
14429 $define)
14430         cat > try.c <<'EOM'
14431 #include <stdio.h>
14432 #include <errno.h>
14433 #include <net/errno.h>
14434 int func()
14435 {
14436         return ENOTSOCK;
14437 }
14438 EOM
14439         if $cc $ccflags -c try.c >/dev/null 2>&1; then
14440                 echo "We'll be including <net/errno.h>." >&4
14441         else
14442                 echo "We won't be including <net/errno.h>." >&4
14443                 val="$undef"
14444         fi
14445         $rm -f try.* try
14446         ;;
14447 esac
14448 set i_neterrno
14449 eval $setvar
14450
14451 : see if netinet/tcp.h is available
14452 set netinet/tcp.h i_netinettcp
14453 eval $inhdr
14454
14455 : see if this is a poll.h system
14456 set poll.h i_poll
14457 eval $inhdr
14458
14459 : see if this is a prot.h system
14460 set prot.h i_prot
14461 eval $inhdr
14462
14463 echo " "
14464 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4 
14465 $cat <<'EOSH' > Cppsym.know
14466 a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
14467 AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
14468 alliant alpha am29000 AM29000 amiga AMIGAOS AMIX
14469 ansi ANSI_C_SOURCE apollo ardent atarist att386 att3b BeOS
14470 BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
14471 BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
14472 bull c cadmus clipper CMU COFF COMPILER_VERSION
14473 concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
14474 CYGWIN DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
14475 Dynix DynixPTX ELF encore EPI EXTENSIONS FILE_OFFSET_BITS
14476 FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
14477 GNU_SOURCE GNUC GNUC_MINOR GO32 gould GOULD_PN
14478 H3050R H3050RX hbullx20 hcx host_mips
14479 hp200 hp300 hp700 HP700 hp800 hp9000
14480 hp9000s200 hp9000s300 hp9000s400 hp9000s500
14481 hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
14482 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
14483 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
14484 INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
14485 LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
14486 LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
14487 Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
14488 LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
14489 M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
14490 M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
14491 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
14492 MATH_HAS_NO_SIDE_EFFECTS
14493 mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
14494 mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
14495 mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
14496 MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
14497 mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
14498 NetBSD news1500 news1700 news1800 news1900 news3700
14499 news700 news800 news900 NeXT NLS ns16000 ns32000
14500 ns32016 ns32332 ns32k nsc32000
14501 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
14502 pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
14503 pc532 pdp11 PGC PIC plexus PORTAR posix
14504 POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
14505 POSIX_C_SOURCE POSIX_SOURCE POWER
14506 PROTOTYPES PWB pyr QNX R3000 REENTRANT RES Rhapsody RISC6000
14507 riscix riscos RT scs SCO sequent sgi SGI_SOURCE sinix
14508 SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
14509 sony sony_news sonyrisc sparc sparclite spectrum
14510 stardent stdc STDC_EXT stratos sun sun3 sun386
14511 Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
14512 SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
14513 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
14514 sysV68 sysV88 Tek4132 Tek4300 titan
14515 tower tower32 tower32_200 tower32_600 tower32_700
14516 tower32_800 tower32_850 tss
14517 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
14518 ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
14519 unix UNIX95 UNIX99 unixpc unos USGr4 USGr4_2
14520 Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms xenix Xenix286
14521 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
14522 XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
14523 z8000
14524 EOSH
14525 # Maybe put other stuff here too.
14526 cat <<EOSH >>Cppsym.know
14527 $osname
14528 EOSH
14529 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
14530 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
14531 $cat Cppsym.a Cppsym.b | $tr ' ' $trnl | sort | uniq > Cppsym.know
14532 $rm -f Cppsym.a Cppsym.b
14533 cat <<EOSH > Cppsym
14534 $startsh
14535 if $test \$# -gt 0; then
14536     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
14537     if $test -s Cppsym.got; then
14538         $rm -f Cppsym.got
14539         exit 0
14540     fi
14541     $rm -f Cppsym.got
14542     exit 1
14543 else
14544     $tr " " "$trnl" | ./Cppsym.try
14545     exit 0
14546 fi
14547 EOSH
14548 chmod +x Cppsym
14549 $eunicefix Cppsym
14550 cat <<EOSH > Cppsym.try
14551 $startsh
14552 cat <<'EOCP' > try.c
14553 #include <stdio.h>
14554 int main() {
14555 EOCP
14556 $awk \\
14557 EOSH
14558 cat <<'EOSH' >> Cppsym.try
14559 'length($1) > 0 {
14560     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
14561     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
14562     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
14563     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
14564 }'       >> try.c
14565 echo '}' >> try.c
14566 EOSH
14567 cat <<EOSH >> Cppsym.try
14568 ccflags="$ccflags"
14569 case "$osname-$gccversion" in
14570 irix-) ccflags="\$ccflags -woff 1178" ;;
14571 esac
14572 $cc $optimize \$ccflags $ldflags -o try try.c $libs && ./try$exe_ext
14573 EOSH
14574 chmod +x Cppsym.try
14575 $eunicefix Cppsym.try
14576 ./Cppsym < Cppsym.know > Cppsym.true
14577 : now check the C compiler for additional symbols
14578 postprocess_cc_v=''
14579 case "$osname" in
14580 aix) postprocess_cc_v="|$tr , ' '" ;;
14581 esac
14582 $cat >ccsym <<EOS
14583 $startsh
14584 $cat >tmp.c <<EOF
14585 extern int foo;
14586 EOF
14587 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
14588 do
14589         case "\$i" in
14590         -D*) echo "\$i" | $sed 's/^-D//';;
14591         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A\(.*\)(\(.*\))/\1=\2/';;
14592         esac
14593 done
14594 $rm -f try.c
14595 EOS
14596 postprocess_cc_v=''
14597 chmod +x ccsym
14598 $eunicefix ccsym
14599 ./ccsym > ccsym1.raw
14600 if $test -s ccsym1.raw; then
14601        $sort ccsym1.raw | $uniq >ccsym.raw
14602 else
14603        mv ccsym1.raw ccsym.raw
14604 fi
14605
14606 $awk '/\=/ { print $0; next }
14607         { print $0"=1" }' ccsym.raw >ccsym.list
14608 $awk '/\=/ { print $0; next }
14609         { print $0"=1" }' Cppsym.true >ccsym.true
14610 $comm -13 ccsym.true ccsym.list >ccsym.own
14611 $comm -12 ccsym.true ccsym.list >ccsym.com
14612 $comm -23 ccsym.true ccsym.list >ccsym.cpp
14613 also=''
14614 if $test -z ccsym.raw; then
14615         echo "Your C compiler doesn't seem to define any symbols!" >&4
14616         echo " "
14617         echo "However, your C preprocessor defines the following symbols:"
14618         $cat Cppsym.true
14619         ccsymbols=''
14620         cppsymbols=`$cat Cppsym.true`
14621         cppsymbols=`echo $cppsymbols`
14622         cppccsymbols="$cppsymbols"
14623 else
14624         if $test -s ccsym.com; then
14625                 echo "Your C compiler and pre-processor define these symbols:"
14626                 $sed -e 's/\(.*\)=.*/\1/' ccsym.com
14627                 also='also '
14628                 symbols='ones'
14629                 cppccsymbols=`$cat ccsym.com`
14630                 cppccsymbols=`echo $cppccsymbols`
14631                 $test "$silent" || sleep 1
14632         fi
14633         if $test -s ccsym.cpp; then
14634                 $test "$also" && echo " "
14635                 echo "Your C pre-processor ${also}defines the following symbols:"
14636                 $sed -e 's/\(.*\)=.*/\1/' ccsym.cpp
14637                 also='further '
14638                 cppsymbols=`$cat ccsym.cpp`
14639                 cppsymbols=`echo $cppsymbols`
14640                 $test "$silent" || sleep 1
14641         fi
14642         if $test -s ccsym.own; then
14643                 $test "$also" && echo " "
14644                 echo "Your C compiler ${also}defines the following cpp symbols:"
14645                 $sed -e 's/\(.*\)=1/\1/' ccsym.own
14646                 $sed -e 's/\(.*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
14647                 ccsymbols=`$cat ccsym.own`
14648                 ccsymbols=`echo $ccsymbols`
14649                 $test "$silent" || sleep 1
14650         fi
14651 fi
14652 $rm -f ccsym*
14653
14654 : see if this is a termio system
14655 val="$undef"
14656 val2="$undef"
14657 val3="$undef"
14658 if $test `./findhdr termios.h`; then
14659         set tcsetattr i_termios
14660         eval $inlibc
14661         val3="$i_termios"
14662 fi
14663 echo " "
14664 case "$val3" in
14665 "$define") echo "You have POSIX termios.h... good!" >&4;;
14666 *) if ./Cppsym pyr; then
14667                 case "`/bin/universe`" in
14668                 ucb) if $test `./findhdr sgtty.h`; then
14669                                 val2="$define"
14670                                 echo "<sgtty.h> found." >&4
14671                         else
14672                                 echo "System is pyramid with BSD universe."
14673                                 echo "<sgtty.h> not found--you could have problems." >&4
14674                         fi;;
14675                 *) if $test `./findhdr termio.h`; then
14676                                 val="$define"
14677                                 echo "<termio.h> found." >&4
14678                         else
14679                                 echo "System is pyramid with USG universe."
14680                                 echo "<termio.h> not found--you could have problems." >&4
14681                         fi;;
14682                 esac
14683         elif ./usg; then
14684                 if $test `./findhdr termio.h`; then
14685                         echo "<termio.h> found." >&4
14686                         val="$define"
14687                 elif $test `./findhdr sgtty.h`; then
14688                         echo "<sgtty.h> found." >&4
14689                         val2="$define"
14690                 else
14691 echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
14692                 fi
14693         else
14694                 if $test `./findhdr sgtty.h`; then
14695                         echo "<sgtty.h> found." >&4
14696                         val2="$define"
14697                 elif $test `./findhdr termio.h`; then
14698                         echo "<termio.h> found." >&4
14699                         val="$define"
14700                 else
14701 echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
14702                 fi
14703         fi;;
14704 esac
14705 set i_termio; eval $setvar
14706 val=$val2; set i_sgtty; eval $setvar
14707 val=$val3; set i_termios; eval $setvar
14708
14709 : see if this is a shadow.h system
14710 set shadow.h i_shadow
14711 eval $inhdr
14712
14713 : see if this is a socks.h system
14714 set socks.h i_socks
14715 eval $inhdr
14716
14717 : see if stdarg is available
14718 echo " "
14719 if $test `./findhdr stdarg.h`; then
14720         echo "<stdarg.h> found." >&4
14721         valstd="$define"
14722 else
14723         echo "<stdarg.h> NOT found." >&4
14724         valstd="$undef"
14725 fi
14726
14727 : see if varags is available
14728 echo " "
14729 if $test `./findhdr varargs.h`; then
14730         echo "<varargs.h> found." >&4
14731 else
14732         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
14733 fi
14734
14735 : set up the varargs testing programs
14736 $cat > varargs.c <<EOP
14737 #ifdef I_STDARG
14738 #include <stdarg.h>
14739 #endif
14740 #ifdef I_VARARGS
14741 #include <varargs.h>
14742 #endif
14743
14744 #ifdef I_STDARG
14745 int f(char *p, ...)
14746 #else
14747 int f(va_alist)
14748 va_dcl
14749 #endif
14750 {
14751         va_list ap;
14752 #ifndef I_STDARG
14753         char *p;
14754 #endif
14755 #ifdef I_STDARG
14756         va_start(ap,p);
14757 #else
14758         va_start(ap);
14759         p = va_arg(ap, char *);
14760 #endif
14761         va_end(ap);
14762 }
14763 EOP
14764 $cat > varargs <<EOP
14765 $startsh
14766 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
14767         echo "true"
14768 else
14769         echo "false"
14770 fi
14771 $rm -f varargs$_o
14772 EOP
14773 chmod +x varargs
14774
14775 : now check which varargs header should be included
14776 echo " "
14777 i_varhdr=''
14778 case "$valstd" in
14779 "$define")
14780         if `./varargs I_STDARG`; then
14781                 val='stdarg.h'
14782         elif `./varargs I_VARARGS`; then
14783                 val='varargs.h'
14784         fi
14785         ;;
14786 *)
14787         if `./varargs I_VARARGS`; then
14788                 val='varargs.h'
14789         fi
14790         ;;
14791 esac
14792 case "$val" in
14793 '')
14794 echo "I could not find the definition for va_dcl... You have problems..." >&4
14795         val="$undef"; set i_stdarg; eval $setvar
14796         val="$undef"; set i_varargs; eval $setvar
14797         ;;
14798 *) 
14799         set i_varhdr
14800         eval $setvar
14801         case "$i_varhdr" in
14802         stdarg.h)
14803                 val="$define"; set i_stdarg; eval $setvar
14804                 val="$undef"; set i_varargs; eval $setvar
14805                 ;;
14806         varargs.h)
14807                 val="$undef"; set i_stdarg; eval $setvar
14808                 val="$define"; set i_varargs; eval $setvar
14809                 ;;
14810         esac
14811         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
14812 esac
14813 $rm -f varargs*
14814
14815 : see if stddef is available
14816 set stddef.h i_stddef
14817 eval $inhdr
14818
14819 : see if this is a sunmath.h system
14820 set sunmath.h i_sunmath
14821 eval $inhdr
14822
14823 : see if sys/access.h is available
14824 set sys/access.h i_sysaccess
14825 eval $inhdr
14826
14827 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
14828 set sys/filio.h i_sysfilio
14829 eval $inhdr
14830 echo " "
14831 if $test `./findhdr sys/ioctl.h`; then
14832         val="$define"
14833         echo '<sys/ioctl.h> found.' >&4
14834 else
14835         val="$undef"
14836         if $test $i_sysfilio = "$define"; then
14837             echo '<sys/ioctl.h> NOT found.' >&4
14838         else
14839                 $test $i_sgtty = "$define" && xxx="sgtty.h"
14840                 $test $i_termio = "$define" && xxx="termio.h"
14841                 $test $i_termios = "$define" && xxx="termios.h"
14842 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
14843         fi
14844 fi
14845 set i_sysioctl
14846 eval $setvar
14847
14848
14849 : see if this is a syslog.h system
14850 set syslog.h i_syslog
14851 eval $inhdr
14852
14853
14854 : see if this is a sys/mode.h system
14855 set sys/mode.h i_sysmode
14856 eval $inhdr
14857
14858 : see if sys/resource.h has to be included
14859 set sys/resource.h i_sysresrc
14860 eval $inhdr
14861
14862 : see if sys/security.h is available
14863 set sys/security.h i_syssecrt
14864 eval $inhdr
14865
14866 : see if this is a sys/statvfs.h system
14867 set sys/statvfs.h i_sysstatvfs
14868 eval $inhdr
14869
14870 : see if this is a sys/uio.h system
14871 set sys/uio.h i_sysuio
14872 eval $inhdr
14873
14874 : see if this is a sys/un.h system
14875 set sys/un.h i_sysun
14876 eval $inhdr
14877
14878
14879 : see if this is a sys/utsname.h system
14880 set sys/utsname.h i_sysutsname
14881 eval $inhdr
14882
14883 : see if this is a syswait system
14884 set sys/wait.h i_syswait
14885 eval $inhdr
14886
14887 : see if this is a ustat.h system
14888 set ustat.h i_ustat
14889 eval $inhdr
14890
14891 : see if this is an utime system
14892 set utime.h i_utime
14893 eval $inhdr
14894
14895 : see if this is a values.h system
14896 set values.h i_values
14897 eval $inhdr
14898
14899 : see if this is a vfork system
14900 case "$d_vfork" in
14901 "$define")
14902         set vfork.h i_vfork
14903         eval $inhdr
14904         ;;
14905 *)
14906         i_vfork="$undef"
14907         ;;
14908 esac
14909
14910 : see if gdbm.h is available
14911 set gdbm.h t_gdbm
14912 eval $inhdr
14913 case "$t_gdbm" in
14914 $define)
14915         : see if gdbm_open exists
14916         set gdbm_open d_gdbm_open
14917         eval $inlibc
14918         case "$d_gdbm_open" in
14919         $undef)
14920                 t_gdbm="$undef"
14921                 echo "We won't be including <gdbm.h>"
14922                 ;;
14923         esac
14924         ;;
14925 esac
14926 val="$t_gdbm"
14927 set i_gdbm
14928 eval $setvar
14929
14930 echo " "
14931 echo "Looking for extensions..." >&4
14932 : If we are using the old config.sh, known_extensions may contain
14933 : old or inaccurate or duplicate values.
14934 known_extensions=''
14935 nonxs_extensions=''
14936 : We do not use find because it might not be available.
14937 : We do not just use MANIFEST because the user may have dropped
14938 : some additional extensions into the source tree and expect them
14939 : to be built.
14940
14941 : Function to recursively find available extensions, ignoring DynaLoader
14942 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
14943 find_extensions='
14944     for xxx in *; do
14945        case "$xxx" in
14946            DynaLoader|dynaload) ;;
14947            *)
14948            if $test -f $xxx/$xxx.xs; then
14949                known_extensions="$known_extensions $1$xxx";
14950            elif $test -f $xxx/Makefile.PL; then
14951                nonxs_extensions="$nonxs_extensions $1$xxx";
14952            else
14953                if $test -d $xxx -a $# -lt 10; then
14954                    set $1$xxx/ $*;
14955                    cd $xxx;
14956                    eval $find_extensions;
14957                    cd ..;
14958                    shift;
14959                fi;
14960            fi
14961            ;;
14962        esac;
14963     done'
14964 tdir=`pwd`
14965 cd $rsrc/ext
14966 set X
14967 shift
14968 eval $find_extensions
14969 set X $nonxs_extensions
14970 shift
14971 nonxs_extensions="$*"
14972 set X $known_extensions
14973 shift
14974 known_extensions="$*"
14975 cd $tdir
14976
14977 : Now see which are supported on this system.
14978 avail_ext=''
14979 for xxx in $known_extensions ; do
14980         case "$xxx" in
14981         DB_File|db_file)
14982                 case "$i_db" in
14983                 $define) avail_ext="$avail_ext $xxx" ;;
14984                 esac
14985                 ;;
14986         GDBM_File|gdbm_fil)
14987                 case "$i_gdbm" in 
14988                 $define) avail_ext="$avail_ext $xxx" ;;
14989                 esac
14990                 ;;
14991         NDBM_File|ndbm_fil)
14992                 case "$i_ndbm" in
14993                 $define)
14994                     case "$osname-$use64bitint" in
14995                     hpux-define)
14996                         case "$libs" in
14997                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
14998                         esac
14999                         ;;
15000                     *) avail_ext="$avail_ext $xxx" ;;
15001                     esac
15002                     ;;
15003                 esac
15004                 ;;
15005         ODBM_File|odbm_fil) 
15006                 case "${i_dbm}${i_rpcsvcdbm}" in
15007                 *"${define}"*)
15008                     case "$osname-$use64bitint" in
15009                     hpux-define)
15010                         case "$libs" in
15011                         *-ldbm*) avail_ext="$avail_ext $xxx" ;;
15012                         esac
15013                         ;;
15014                     *) avail_ext="$avail_ext $xxx" ;;
15015                     esac
15016                     ;;
15017                 esac
15018                 ;;
15019         POSIX|posix)
15020                 case "$useposix" in
15021                 true|define|y) avail_ext="$avail_ext $xxx" ;;
15022                 esac
15023                 ;;
15024         Opcode|opcode)
15025                 case "$useopcode" in
15026                 true|define|y) avail_ext="$avail_ext $xxx" ;;
15027                 esac
15028                 ;;
15029         Socket|socket)
15030                 case "$d_socket" in 
15031                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
15032                 esac
15033                 ;;
15034         Sys/Syslog|sys/syslog)
15035                 : XXX syslog requires socket
15036                 case "$d_socket" in 
15037                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
15038                 esac
15039                 ;;
15040         Thread|thread)
15041                 case "$usethreads" in 
15042                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
15043                 esac
15044                 ;;
15045         IPC/SysV|ipc/sysv)
15046                 : XXX Do we need a useipcsysv variable here
15047                 case "${d_msg}${d_sem}${d_shm}" in 
15048                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
15049                 esac
15050                 ;;
15051         *)      avail_ext="$avail_ext $xxx"
15052                 ;;
15053         esac
15054 done
15055
15056 set X $avail_ext
15057 shift
15058 avail_ext="$*"
15059
15060 : Now see which nonxs extensions are supported on this system.
15061 : For now assume all are.
15062 nonxs_ext=''
15063 for xxx in $nonxs_extensions ; do
15064         case "$xxx" in
15065         *)      nonxs_ext="$nonxs_ext $xxx"
15066                 ;;
15067         esac
15068 done
15069
15070 set X $nonxs_ext
15071 shift
15072 nonxs_ext="$*"
15073
15074 case $usedl in
15075 $define)
15076         $cat <<EOM
15077 A number of extensions are supplied with $package.  You may choose to
15078 compile these extensions for dynamic loading (the default), compile
15079 them into the $package executable (static loading), or not include
15080 them at all.  Answer "none" to include no extensions.
15081 Note that DynaLoader is always built and need not be mentioned here.
15082
15083 EOM
15084         case "$dynamic_ext" in
15085         '') dflt="$avail_ext" ;;
15086         *)      dflt="$dynamic_ext"
15087                 # Perhaps we are reusing an old out-of-date config.sh.
15088                 case "$hint" in
15089                 previous)
15090                         if test X"$dynamic_ext" != X"$avail_ext"; then
15091                                 $cat <<EOM
15092 NOTICE:  Your previous config.sh list may be incorrect. 
15093 The extensions now available to you are 
15094         ${avail_ext}
15095 but the default list from your previous config.sh is
15096         ${dynamic_ext} 
15097
15098 EOM
15099                         fi
15100                         ;;
15101                 esac
15102                 ;;
15103         esac
15104         case "$dflt" in
15105         '')     dflt=none;;
15106         esac
15107         rp="What extensions do you wish to load dynamically?"
15108         . ./myread
15109         case "$ans" in
15110         none) dynamic_ext=' ' ;;
15111         *) dynamic_ext="$ans" ;;
15112         esac
15113
15114         case "$static_ext" in
15115         '')
15116                 : Exclude those already listed in dynamic linking
15117                 dflt=''
15118                 for xxx in $avail_ext; do
15119                         case " $dynamic_ext " in
15120                         *" $xxx "*) ;;
15121                         *) dflt="$dflt $xxx" ;;
15122                         esac
15123                 done
15124                 set X $dflt
15125                 shift
15126                 dflt="$*"
15127                 ;;
15128         *)  dflt="$static_ext" 
15129                 ;;
15130         esac
15131
15132         case "$dflt" in
15133         '')     dflt=none;;
15134         esac
15135         rp="What extensions do you wish to load statically?"
15136         . ./myread
15137         case "$ans" in
15138         none) static_ext=' ' ;;
15139         *) static_ext="$ans" ;;
15140         esac
15141         ;;
15142 *)
15143         $cat <<EOM
15144 A number of extensions are supplied with $package.  Answer "none" 
15145 to include no extensions. 
15146 Note that DynaLoader is always built and need not be mentioned here.
15147
15148 EOM
15149         case "$static_ext" in
15150         '') dflt="$avail_ext" ;;
15151         *)      dflt="$static_ext"
15152                 # Perhaps we are reusing an old out-of-date config.sh.
15153                 case "$hint" in
15154                 previous)
15155                         if test X"$static_ext" != X"$avail_ext"; then
15156                                 $cat <<EOM
15157 NOTICE:  Your previous config.sh list may be incorrect. 
15158 The extensions now available to you are 
15159         ${avail_ext}
15160 but the default list from your previous config.sh is
15161         ${static_ext} 
15162
15163 EOM
15164                         fi
15165                         ;;
15166                 esac
15167                 ;;
15168         esac
15169         : Exclude those that are not xs extensions
15170         case "$dflt" in
15171         '')     dflt=none;;
15172         esac
15173         rp="What extensions do you wish to include?"
15174         . ./myread
15175         case "$ans" in
15176         none) static_ext=' ' ;;
15177         *) static_ext="$ans" ;;
15178         esac
15179         ;;
15180 esac
15181
15182 set X $dynamic_ext $static_ext $nonxs_ext
15183 shift
15184 extensions="$*"
15185
15186 : Remove build directory name from cppstdin so it can be used from
15187 : either the present location or the final installed location.
15188 echo " "
15189 : Get out of the UU directory to get correct path name.
15190 cd ..
15191 case "$cppstdin" in
15192 `pwd`/cppstdin)
15193         echo "Stripping down cppstdin path name"
15194         cppstdin=cppstdin
15195         ;;
15196 esac
15197 cd UU
15198
15199 : end of configuration questions
15200 echo " "
15201 echo "End of configuration questions."
15202 echo " "
15203
15204 : back to where it started
15205 if test -d ../UU; then
15206         cd ..
15207 fi
15208
15209 : configuration may be patched via a 'config.over' file
15210 if $test -f config.over; then
15211         echo " "
15212         dflt=y
15213         rp='I see a config.over file.  Do you wish to load it?'
15214         . UU/myread
15215         case "$ans" in
15216         n*) echo "OK, I'll ignore it.";;
15217         *)      . ./config.over
15218                 echo "Configuration override changes have been loaded."
15219                 ;;
15220         esac
15221 fi
15222
15223 : in case they want portability, strip down executable paths
15224 case "$d_portable" in
15225 "$define")
15226         echo " "
15227         echo "Stripping down executable paths..." >&4
15228         for file in $loclist $trylist; do
15229                 eval temp=\$$file
15230                 eval $file=`basename $temp`
15231         done
15232         ;;
15233 esac
15234
15235 : create config.sh file
15236 echo " "
15237 echo "Creating config.sh..." >&4
15238 $spitshell <<EOT >config.sh
15239 $startsh
15240 #
15241 # This file was produced by running the Configure script. It holds all the
15242 # definitions figured out by Configure. Should you modify one of these values,
15243 # do not forget to propagate your changes by running "Configure -der". You may
15244 # instead choose to run each of the .SH files by yourself, or "Configure -S".
15245 #
15246
15247 # Package name      : $package
15248 # Source directory  : $src
15249 # Configuration time: $cf_time
15250 # Configured by     : $cf_by
15251 # Target system     : $myuname
15252
15253 Author='$Author'
15254 Date='$Date'
15255 Header='$Header'
15256 Id='$Id'
15257 Locker='$Locker'
15258 Log='$Log'
15259 Mcc='$Mcc'
15260 RCSfile='$RCSfile'
15261 Revision='$Revision'
15262 Source='$Source'
15263 State='$State'
15264 _a='$_a'
15265 _exe='$_exe'
15266 _o='$_o'
15267 afs='$afs'
15268 alignbytes='$alignbytes'
15269 ansi2knr='$ansi2knr'
15270 aphostname='$aphostname'
15271 api_revision='$api_revision'
15272 api_subversion='$api_subversion'
15273 api_version='$api_version'
15274 api_versionstring='$api_versionstring'
15275 ar='$ar'
15276 archlib='$archlib'
15277 archlibexp='$archlibexp'
15278 archname64='$archname64'
15279 archname='$archname'
15280 archobjs='$archobjs'
15281 awk='$awk'
15282 baserev='$baserev'
15283 bash='$bash'
15284 bin='$bin'
15285 bincompat5005='$bincompat5005'
15286 binexp='$binexp'
15287 bison='$bison'
15288 byacc='$byacc'
15289 byteorder='$byteorder'
15290 c='$c'
15291 castflags='$castflags'
15292 cat='$cat'
15293 cc='$cc'
15294 cccdlflags='$cccdlflags'
15295 ccdlflags='$ccdlflags'
15296 ccflags='$ccflags'
15297 ccsymbols='$ccsymbols'
15298 cf_by='$cf_by'
15299 cf_email='$cf_email'
15300 cf_time='$cf_time'
15301 charsize='$charsize'
15302 chgrp='$chgrp'
15303 chmod='$chmod'
15304 chown='$chown'
15305 clocktype='$clocktype'
15306 comm='$comm'
15307 compress='$compress'
15308 contains='$contains'
15309 cp='$cp'
15310 cpio='$cpio'
15311 cpp='$cpp'
15312 cpp_stuff='$cpp_stuff'
15313 cppccsymbols='$cppccsymbols'
15314 cppflags='$cppflags'
15315 cpplast='$cpplast'
15316 cppminus='$cppminus'
15317 cpprun='$cpprun'
15318 cppstdin='$cppstdin'
15319 cppsymbols='$cppsymbols'
15320 crosscompile='$crosscompile'
15321 cryptlib='$cryptlib'
15322 csh='$csh'
15323 d_Gconvert='$d_Gconvert'
15324 d_PRIEldbl='$d_PRIEldbl'
15325 d_PRIFldbl='$d_PRIFldbl'
15326 d_PRIGldbl='$d_PRIGldbl'
15327 d_PRIX64='$d_PRIX64'
15328 d_PRId64='$d_PRId64'
15329 d_PRIeldbl='$d_PRIeldbl'
15330 d_PRIfldbl='$d_PRIfldbl'
15331 d_PRIgldbl='$d_PRIgldbl'
15332 d_PRIi64='$d_PRIi64'
15333 d_PRIo64='$d_PRIo64'
15334 d_PRIu64='$d_PRIu64'
15335 d_PRIx64='$d_PRIx64'
15336 d_access='$d_access'
15337 d_accessx='$d_accessx'
15338 d_alarm='$d_alarm'
15339 d_archlib='$d_archlib'
15340 d_atolf='$d_atolf'
15341 d_atoll='$d_atoll'
15342 d_attribut='$d_attribut'
15343 d_bcmp='$d_bcmp'
15344 d_bcopy='$d_bcopy'
15345 d_bincompat5005='$d_bincompat5005'
15346 d_bsd='$d_bsd'
15347 d_bsdgetpgrp='$d_bsdgetpgrp'
15348 d_bsdsetpgrp='$d_bsdsetpgrp'
15349 d_bzero='$d_bzero'
15350 d_casti32='$d_casti32'
15351 d_castneg='$d_castneg'
15352 d_charvspr='$d_charvspr'
15353 d_chown='$d_chown'
15354 d_chroot='$d_chroot'
15355 d_chsize='$d_chsize'
15356 d_closedir='$d_closedir'
15357 d_const='$d_const'
15358 d_crypt='$d_crypt'
15359 d_csh='$d_csh'
15360 d_cuserid='$d_cuserid'
15361 d_dbl_dig='$d_dbl_dig'
15362 d_difftime='$d_difftime'
15363 d_dirnamlen='$d_dirnamlen'
15364 d_dlerror='$d_dlerror'
15365 d_dlopen='$d_dlopen'
15366 d_dlsymun='$d_dlsymun'
15367 d_dosuid='$d_dosuid'
15368 d_drand48proto='$d_drand48proto'
15369 d_dup2='$d_dup2'
15370 d_eaccess='$d_eaccess'
15371 d_endgrent='$d_endgrent'
15372 d_endhent='$d_endhent'
15373 d_endnent='$d_endnent'
15374 d_endpent='$d_endpent'
15375 d_endpwent='$d_endpwent'
15376 d_endsent='$d_endsent'
15377 d_eofnblk='$d_eofnblk'
15378 d_eunice='$d_eunice'
15379 d_fchmod='$d_fchmod'
15380 d_fchown='$d_fchown'
15381 d_fcntl='$d_fcntl'
15382 d_fd_macros='$d_fd_macros'
15383 d_fd_set='$d_fd_set'
15384 d_fds_bits='$d_fds_bits'
15385 d_fgetpos='$d_fgetpos'
15386 d_flexfnam='$d_flexfnam'
15387 d_flock='$d_flock'
15388 d_fork='$d_fork'
15389 d_fpathconf='$d_fpathconf'
15390 d_fpos64_t='$d_fpos64_t'
15391 d_frexpl='$d_frexpl'
15392 d_fs_data_s='$d_fs_data_s'
15393 d_fseeko='$d_fseeko'
15394 d_fsetpos='$d_fsetpos'
15395 d_fstatfs='$d_fstatfs'
15396 d_fstatvfs='$d_fstatvfs'
15397 d_ftello='$d_ftello'
15398 d_ftime='$d_ftime'
15399 d_getcwd='$d_getcwd'
15400 d_getespwnam='$d_getespwnam'
15401 d_getfsstat='$d_getfsstat'
15402 d_getgrent='$d_getgrent'
15403 d_getgrps='$d_getgrps'
15404 d_gethbyaddr='$d_gethbyaddr'
15405 d_gethbyname='$d_gethbyname'
15406 d_gethent='$d_gethent'
15407 d_gethname='$d_gethname'
15408 d_gethostprotos='$d_gethostprotos'
15409 d_getlogin='$d_getlogin'
15410 d_getmnt='$d_getmnt'
15411 d_getmntent='$d_getmntent'
15412 d_getnbyaddr='$d_getnbyaddr'
15413 d_getnbyname='$d_getnbyname'
15414 d_getnent='$d_getnent'
15415 d_getnetprotos='$d_getnetprotos'
15416 d_getpbyname='$d_getpbyname'
15417 d_getpbynumber='$d_getpbynumber'
15418 d_getpent='$d_getpent'
15419 d_getpgid='$d_getpgid'
15420 d_getpgrp2='$d_getpgrp2'
15421 d_getpgrp='$d_getpgrp'
15422 d_getppid='$d_getppid'
15423 d_getprior='$d_getprior'
15424 d_getprotoprotos='$d_getprotoprotos'
15425 d_getprpwnam='$d_getprpwnam'
15426 d_getpwent='$d_getpwent'
15427 d_getsbyname='$d_getsbyname'
15428 d_getsbyport='$d_getsbyport'
15429 d_getsent='$d_getsent'
15430 d_getservprotos='$d_getservprotos'
15431 d_getspnam='$d_getspnam'
15432 d_gettimeod='$d_gettimeod'
15433 d_gnulibc='$d_gnulibc'
15434 d_grpasswd='$d_grpasswd'
15435 d_hasmntopt='$d_hasmntopt'
15436 d_htonl='$d_htonl'
15437 d_iconv='$d_iconv'
15438 d_index='$d_index'
15439 d_inetaton='$d_inetaton'
15440 d_int64_t='$d_int64_t'
15441 d_isascii='$d_isascii'
15442 d_isnan='$d_isnan'
15443 d_isnanl='$d_isnanl'
15444 d_killpg='$d_killpg'
15445 d_lchown='$d_lchown'
15446 d_ldbl_dig='$d_ldbl_dig'
15447 d_link='$d_link'
15448 d_locconv='$d_locconv'
15449 d_lockf='$d_lockf'
15450 d_longdbl='$d_longdbl'
15451 d_longlong='$d_longlong'
15452 d_lseekproto='$d_lseekproto'
15453 d_lstat='$d_lstat'
15454 d_madvise='$d_madvise'
15455 d_mblen='$d_mblen'
15456 d_mbstowcs='$d_mbstowcs'
15457 d_mbtowc='$d_mbtowc'
15458 d_memchr='$d_memchr'
15459 d_memcmp='$d_memcmp'
15460 d_memcpy='$d_memcpy'
15461 d_memmove='$d_memmove'
15462 d_memset='$d_memset'
15463 d_mkdir='$d_mkdir'
15464 d_mkdtemp='$d_mkdtemp'
15465 d_mkfifo='$d_mkfifo'
15466 d_mkstemp='$d_mkstemp'
15467 d_mkstemps='$d_mkstemps'
15468 d_mktime='$d_mktime'
15469 d_mmap='$d_mmap'
15470 d_modfl='$d_modfl'
15471 d_mprotect='$d_mprotect'
15472 d_msg='$d_msg'
15473 d_msg_ctrunc='$d_msg_ctrunc'
15474 d_msg_dontroute='$d_msg_dontroute'
15475 d_msg_oob='$d_msg_oob'
15476 d_msg_peek='$d_msg_peek'
15477 d_msg_proxy='$d_msg_proxy'
15478 d_msgctl='$d_msgctl'
15479 d_msgget='$d_msgget'
15480 d_msgrcv='$d_msgrcv'
15481 d_msgsnd='$d_msgsnd'
15482 d_msync='$d_msync'
15483 d_munmap='$d_munmap'
15484 d_mymalloc='$d_mymalloc'
15485 d_nice='$d_nice'
15486 d_nv_preserves_uv='$d_nv_preserves_uv'
15487 d_nv_preserves_uv_bits='$d_nv_preserves_uv_bits'
15488 d_off64_t='$d_off64_t'
15489 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
15490 d_oldpthreads='$d_oldpthreads'
15491 d_oldsock='$d_oldsock'
15492 d_open3='$d_open3'
15493 d_pathconf='$d_pathconf'
15494 d_pause='$d_pause'
15495 d_perl_otherlibdirs='$d_perl_otherlibdirs'
15496 d_phostname='$d_phostname'
15497 d_pipe='$d_pipe'
15498 d_poll='$d_poll'
15499 d_portable='$d_portable'
15500 d_pthread_yield='$d_pthread_yield'
15501 d_pwage='$d_pwage'
15502 d_pwchange='$d_pwchange'
15503 d_pwclass='$d_pwclass'
15504 d_pwcomment='$d_pwcomment'
15505 d_pwexpire='$d_pwexpire'
15506 d_pwgecos='$d_pwgecos'
15507 d_pwpasswd='$d_pwpasswd'
15508 d_pwquota='$d_pwquota'
15509 d_qgcvt='$d_qgcvt'
15510 d_quad='$d_quad'
15511 d_readdir='$d_readdir'
15512 d_readlink='$d_readlink'
15513 d_rename='$d_rename'
15514 d_rewinddir='$d_rewinddir'
15515 d_rmdir='$d_rmdir'
15516 d_safebcpy='$d_safebcpy'
15517 d_safemcpy='$d_safemcpy'
15518 d_sanemcmp='$d_sanemcmp'
15519 d_sched_yield='$d_sched_yield'
15520 d_scm_rights='$d_scm_rights'
15521 d_seekdir='$d_seekdir'
15522 d_select='$d_select'
15523 d_sem='$d_sem'
15524 d_semctl='$d_semctl'
15525 d_semctl_semid_ds='$d_semctl_semid_ds'
15526 d_semctl_semun='$d_semctl_semun'
15527 d_semget='$d_semget'
15528 d_semop='$d_semop'
15529 d_setegid='$d_setegid'
15530 d_seteuid='$d_seteuid'
15531 d_setgrent='$d_setgrent'
15532 d_setgrps='$d_setgrps'
15533 d_sethent='$d_sethent'
15534 d_setlinebuf='$d_setlinebuf'
15535 d_setlocale='$d_setlocale'
15536 d_setnent='$d_setnent'
15537 d_setpent='$d_setpent'
15538 d_setpgid='$d_setpgid'
15539 d_setpgrp2='$d_setpgrp2'
15540 d_setpgrp='$d_setpgrp'
15541 d_setprior='$d_setprior'
15542 d_setproctitle='$d_setproctitle'
15543 d_setpwent='$d_setpwent'
15544 d_setregid='$d_setregid'
15545 d_setresgid='$d_setresgid'
15546 d_setresuid='$d_setresuid'
15547 d_setreuid='$d_setreuid'
15548 d_setrgid='$d_setrgid'
15549 d_setruid='$d_setruid'
15550 d_setsent='$d_setsent'
15551 d_setsid='$d_setsid'
15552 d_setvbuf='$d_setvbuf'
15553 d_sfio='$d_sfio'
15554 d_shm='$d_shm'
15555 d_shmat='$d_shmat'
15556 d_shmatprototype='$d_shmatprototype'
15557 d_shmctl='$d_shmctl'
15558 d_shmdt='$d_shmdt'
15559 d_shmget='$d_shmget'
15560 d_sigaction='$d_sigaction'
15561 d_sigsetjmp='$d_sigsetjmp'
15562 d_socket='$d_socket'
15563 d_socklen_t='$d_socklen_t'
15564 d_sockpair='$d_sockpair'
15565 d_sqrtl='$d_sqrtl'
15566 d_statblks='$d_statblks'
15567 d_statfs_f_flags='$d_statfs_f_flags'
15568 d_statfs_s='$d_statfs_s'
15569 d_statvfs='$d_statvfs'
15570 d_stdio_cnt_lval='$d_stdio_cnt_lval'
15571 d_stdio_ptr_lval='$d_stdio_ptr_lval'
15572 d_stdio_stream_array='$d_stdio_stream_array'
15573 d_stdiobase='$d_stdiobase'
15574 d_stdstdio='$d_stdstdio'
15575 d_strchr='$d_strchr'
15576 d_strcoll='$d_strcoll'
15577 d_strctcpy='$d_strctcpy'
15578 d_strerrm='$d_strerrm'
15579 d_strerror='$d_strerror'
15580 d_strtod='$d_strtod'
15581 d_strtol='$d_strtol'
15582 d_strtold='$d_strtold'
15583 d_strtoll='$d_strtoll'
15584 d_strtoul='$d_strtoul'
15585 d_strtoull='$d_strtoull'
15586 d_strtouq='$d_strtouq'
15587 d_strxfrm='$d_strxfrm'
15588 d_suidsafe='$d_suidsafe'
15589 d_symlink='$d_symlink'
15590 d_syscall='$d_syscall'
15591 d_sysconf='$d_sysconf'
15592 d_sysernlst='$d_sysernlst'
15593 d_syserrlst='$d_syserrlst'
15594 d_system='$d_system'
15595 d_tcgetpgrp='$d_tcgetpgrp'
15596 d_tcsetpgrp='$d_tcsetpgrp'
15597 d_telldir='$d_telldir'
15598 d_telldirproto='$d_telldirproto'
15599 d_time='$d_time'
15600 d_times='$d_times'
15601 d_truncate='$d_truncate'
15602 d_tzname='$d_tzname'
15603 d_umask='$d_umask'
15604 d_uname='$d_uname'
15605 d_union_semun='$d_union_semun'
15606 d_ustat='$d_ustat'
15607 d_vendorarch='$d_vendorarch'
15608 d_vendorbin='$d_vendorbin'
15609 d_vendorlib='$d_vendorlib'
15610 d_vfork='$d_vfork'
15611 d_void_closedir='$d_void_closedir'
15612 d_voidsig='$d_voidsig'
15613 d_voidtty='$d_voidtty'
15614 d_volatile='$d_volatile'
15615 d_vprintf='$d_vprintf'
15616 d_wait4='$d_wait4'
15617 d_waitpid='$d_waitpid'
15618 d_wcstombs='$d_wcstombs'
15619 d_wctomb='$d_wctomb'
15620 d_xenix='$d_xenix'
15621 date='$date'
15622 db_hashtype='$db_hashtype'
15623 db_prefixtype='$db_prefixtype'
15624 defvoidused='$defvoidused'
15625 direntrytype='$direntrytype'
15626 dlext='$dlext'
15627 dlsrc='$dlsrc'
15628 doublesize='$doublesize'
15629 drand01='$drand01'
15630 dynamic_ext='$dynamic_ext'
15631 eagain='$eagain'
15632 ebcdic='$ebcdic'
15633 echo='$echo'
15634 egrep='$egrep'
15635 emacs='$emacs'
15636 eunicefix='$eunicefix'
15637 exe_ext='$exe_ext'
15638 expr='$expr'
15639 extensions='$extensions'
15640 fflushNULL='$fflushNULL'
15641 fflushall='$fflushall'
15642 find='$find'
15643 firstmakefile='$firstmakefile'
15644 flex='$flex'
15645 fpossize='$fpossize'
15646 fpostype='$fpostype'
15647 freetype='$freetype'
15648 full_ar='$full_ar'
15649 full_csh='$full_csh'
15650 full_sed='$full_sed'
15651 gccosandvers='$gccosandvers'
15652 gccversion='$gccversion'
15653 gidformat='$gidformat'
15654 gidsign='$gidsign'
15655 gidsize='$gidsize'
15656 gidtype='$gidtype'
15657 glibpth='$glibpth'
15658 grep='$grep'
15659 groupcat='$groupcat'
15660 groupstype='$groupstype'
15661 gzip='$gzip'
15662 h_fcntl='$h_fcntl'
15663 h_sysfile='$h_sysfile'
15664 hint='$hint'
15665 hostcat='$hostcat'
15666 huge='$huge'
15667 i16size='$i16size'
15668 i16type='$i16type'
15669 i32size='$i32size'
15670 i32type='$i32type'
15671 i64size='$i64size'
15672 i64type='$i64type'
15673 i8size='$i8size'
15674 i8type='$i8type'
15675 i_arpainet='$i_arpainet'
15676 i_bsdioctl='$i_bsdioctl'
15677 i_db='$i_db'
15678 i_dbm='$i_dbm'
15679 i_dirent='$i_dirent'
15680 i_dld='$i_dld'
15681 i_dlfcn='$i_dlfcn'
15682 i_fcntl='$i_fcntl'
15683 i_float='$i_float'
15684 i_gdbm='$i_gdbm'
15685 i_grp='$i_grp'
15686 i_iconv='$i_iconv'
15687 i_ieeefp='$i_ieeefp'
15688 i_inttypes='$i_inttypes'
15689 i_libutil='$i_libutil'
15690 i_limits='$i_limits'
15691 i_locale='$i_locale'
15692 i_machcthr='$i_machcthr'
15693 i_malloc='$i_malloc'
15694 i_math='$i_math'
15695 i_memory='$i_memory'
15696 i_mntent='$i_mntent'
15697 i_ndbm='$i_ndbm'
15698 i_netdb='$i_netdb'
15699 i_neterrno='$i_neterrno'
15700 i_netinettcp='$i_netinettcp'
15701 i_niin='$i_niin'
15702 i_poll='$i_poll'
15703 i_prot='$i_prot'
15704 i_pthread='$i_pthread'
15705 i_pwd='$i_pwd'
15706 i_rpcsvcdbm='$i_rpcsvcdbm'
15707 i_sfio='$i_sfio'
15708 i_sgtty='$i_sgtty'
15709 i_shadow='$i_shadow'
15710 i_socks='$i_socks'
15711 i_stdarg='$i_stdarg'
15712 i_stddef='$i_stddef'
15713 i_stdlib='$i_stdlib'
15714 i_string='$i_string'
15715 i_sunmath='$i_sunmath'
15716 i_sysaccess='$i_sysaccess'
15717 i_sysdir='$i_sysdir'
15718 i_sysfile='$i_sysfile'
15719 i_sysfilio='$i_sysfilio'
15720 i_sysin='$i_sysin'
15721 i_sysioctl='$i_sysioctl'
15722 i_syslog='$i_syslog'
15723 i_sysmman='$i_sysmman'
15724 i_sysmode='$i_sysmode'
15725 i_sysmount='$i_sysmount'
15726 i_sysndir='$i_sysndir'
15727 i_sysparam='$i_sysparam'
15728 i_sysresrc='$i_sysresrc'
15729 i_syssecrt='$i_syssecrt'
15730 i_sysselct='$i_sysselct'
15731 i_syssockio='$i_syssockio'
15732 i_sysstat='$i_sysstat'
15733 i_sysstatfs='$i_sysstatfs'
15734 i_sysstatvfs='$i_sysstatvfs'
15735 i_systime='$i_systime'
15736 i_systimek='$i_systimek'
15737 i_systimes='$i_systimes'
15738 i_systypes='$i_systypes'
15739 i_sysuio='$i_sysuio'
15740 i_sysun='$i_sysun'
15741 i_sysutsname='$i_sysutsname'
15742 i_sysvfs='$i_sysvfs'
15743 i_syswait='$i_syswait'
15744 i_termio='$i_termio'
15745 i_termios='$i_termios'
15746 i_time='$i_time'
15747 i_unistd='$i_unistd'
15748 i_ustat='$i_ustat'
15749 i_utime='$i_utime'
15750 i_values='$i_values'
15751 i_varargs='$i_varargs'
15752 i_varhdr='$i_varhdr'
15753 i_vfork='$i_vfork'
15754 ignore_versioned_solibs='$ignore_versioned_solibs'
15755 inc_version_list='$inc_version_list'
15756 inc_version_list_init='$inc_version_list_init'
15757 incpath='$incpath'
15758 inews='$inews'
15759 installarchlib='$installarchlib'
15760 installbin='$installbin'
15761 installman1dir='$installman1dir'
15762 installman3dir='$installman3dir'
15763 installprefix='$installprefix'
15764 installprefixexp='$installprefixexp'
15765 installprivlib='$installprivlib'
15766 installscript='$installscript'
15767 installsitearch='$installsitearch'
15768 installsitebin='$installsitebin'
15769 installsitelib='$installsitelib'
15770 installstyle='$installstyle'
15771 installusrbinperl='$installusrbinperl'
15772 installvendorarch='$installvendorarch'
15773 installvendorbin='$installvendorbin'
15774 installvendorlib='$installvendorlib'
15775 intsize='$intsize'
15776 ivdformat='$ivdformat'
15777 ivsize='$ivsize'
15778 ivtype='$ivtype'
15779 known_extensions='$known_extensions'
15780 ksh='$ksh'
15781 large='$large'
15782 ld='$ld'
15783 lddlflags='$lddlflags'
15784 ldflags='$ldflags'
15785 ldlibpthname='$ldlibpthname'
15786 less='$less'
15787 lib_ext='$lib_ext'
15788 libc='$libc'
15789 libperl='$libperl'
15790 libpth='$libpth'
15791 libs='$libs'
15792 libsdirs='$libsdirs'
15793 libsfiles='$libsfiles'
15794 libsfound='$libsfound'
15795 libspath='$libspath'
15796 libswanted='$libswanted'
15797 line='$line'
15798 lint='$lint'
15799 lkflags='$lkflags'
15800 ln='$ln'
15801 lns='$lns'
15802 locincpth='$locincpth'
15803 loclibpth='$loclibpth'
15804 longdblsize='$longdblsize'
15805 longlongsize='$longlongsize'
15806 longsize='$longsize'
15807 lp='$lp'
15808 lpr='$lpr'
15809 ls='$ls'
15810 lseeksize='$lseeksize'
15811 lseektype='$lseektype'
15812 mail='$mail'
15813 mailx='$mailx'
15814 make='$make'
15815 make_set_make='$make_set_make'
15816 mallocobj='$mallocobj'
15817 mallocsrc='$mallocsrc'
15818 malloctype='$malloctype'
15819 man1dir='$man1dir'
15820 man1direxp='$man1direxp'
15821 man1ext='$man1ext'
15822 man3dir='$man3dir'
15823 man3direxp='$man3direxp'
15824 man3ext='$man3ext'
15825 medium='$medium'
15826 mips_type='$mips_type'
15827 mkdir='$mkdir'
15828 mmaptype='$mmaptype'
15829 models='$models'
15830 modetype='$modetype'
15831 more='$more'
15832 multiarch='$multiarch'
15833 mv='$mv'
15834 myarchname='$myarchname'
15835 mydomain='$mydomain'
15836 myhostname='$myhostname'
15837 myuname='$myuname'
15838 n='$n'
15839 netdb_hlen_type='$netdb_hlen_type'
15840 netdb_host_type='$netdb_host_type'
15841 netdb_name_type='$netdb_name_type'
15842 netdb_net_type='$netdb_net_type'
15843 nm='$nm'
15844 nm_opt='$nm_opt'
15845 nm_so_opt='$nm_so_opt'
15846 nonxs_ext='$nonxs_ext'
15847 nroff='$nroff'
15848 nvsize='$nvsize'
15849 nvtype='$nvtype'
15850 o_nonblock='$o_nonblock'
15851 obj_ext='$obj_ext'
15852 old_pthread_create_joinable='$old_pthread_create_joinable'
15853 optimize='$optimize'
15854 orderlib='$orderlib'
15855 osname='$osname'
15856 osvers='$osvers'
15857 otherlibdirs='$otherlibdirs'
15858 package='$package'
15859 pager='$pager'
15860 passcat='$passcat'
15861 patchlevel='$patchlevel'
15862 path_sep='$path_sep'
15863 perl5='$perl5'
15864 perl='$perl'
15865 perladmin='$perladmin'
15866 perlpath='$perlpath'
15867 pg='$pg'
15868 phostname='$phostname'
15869 pidtype='$pidtype'
15870 plibpth='$plibpth'
15871 pm_apiversion='$pm_apiversion'
15872 pmake='$pmake'
15873 pr='$pr'
15874 prefix='$prefix'
15875 prefixexp='$prefixexp'
15876 privlib='$privlib'
15877 privlibexp='$privlibexp'
15878 prototype='$prototype'
15879 ptrsize='$ptrsize'
15880 quadkind='$quadkind'
15881 quadtype='$quadtype'
15882 randbits='$randbits'
15883 randfunc='$randfunc'
15884 randseedtype='$randseedtype'
15885 ranlib='$ranlib'
15886 rd_nodata='$rd_nodata'
15887 revision='$revision'
15888 rm='$rm'
15889 rmail='$rmail'
15890 runnm='$runnm'
15891 sPRIEldbl='$sPRIEldbl'
15892 sPRIFldbl='$sPRIFldbl'
15893 sPRIGldbl='$sPRIGldbl'
15894 sPRIX64='$sPRIX64'
15895 sPRId64='$sPRId64'
15896 sPRIeldbl='$sPRIeldbl'
15897 sPRIfldbl='$sPRIfldbl'
15898 sPRIgldbl='$sPRIgldbl'
15899 sPRIi64='$sPRIi64'
15900 sPRIo64='$sPRIo64'
15901 sPRIu64='$sPRIu64'
15902 sPRIx64='$sPRIx64'
15903 sched_yield='$sched_yield'
15904 scriptdir='$scriptdir'
15905 scriptdirexp='$scriptdirexp'
15906 sed='$sed'
15907 seedfunc='$seedfunc'
15908 selectminbits='$selectminbits'
15909 selecttype='$selecttype'
15910 sendmail='$sendmail'
15911 sh='$sh'
15912 shar='$shar'
15913 sharpbang='$sharpbang'
15914 shmattype='$shmattype'
15915 shortsize='$shortsize'
15916 shrpenv='$shrpenv'
15917 shsharp='$shsharp'
15918 sig_count='$sig_count'
15919 sig_name='$sig_name'
15920 sig_name_init='$sig_name_init'
15921 sig_num='$sig_num'
15922 sig_num_init='$sig_num_init'
15923 signal_t='$signal_t'
15924 sitearch='$sitearch'
15925 sitearchexp='$sitearchexp'
15926 sitebin='$sitebin'
15927 sitebinexp='$sitebinexp'
15928 sitelib='$sitelib'
15929 sitelib_stem='$sitelib_stem'
15930 sitelibexp='$sitelibexp'
15931 siteprefix='$siteprefix'
15932 siteprefixexp='$siteprefixexp'
15933 sizesize='$sizesize'
15934 sizetype='$sizetype'
15935 sleep='$sleep'
15936 smail='$smail'
15937 small='$small'
15938 so='$so'
15939 sockethdr='$sockethdr'
15940 socketlib='$socketlib'
15941 socksizetype='$socksizetype'
15942 sort='$sort'
15943 spackage='$spackage'
15944 spitshell='$spitshell'
15945 split='$split'
15946 src='$src'
15947 ssizetype='$ssizetype'
15948 startperl='$startperl'
15949 startsh='$startsh'
15950 static_ext='$static_ext'
15951 stdchar='$stdchar'
15952 stdio_base='$stdio_base'
15953 stdio_bufsiz='$stdio_bufsiz'
15954 stdio_cnt='$stdio_cnt'
15955 stdio_filbuf='$stdio_filbuf'
15956 stdio_ptr='$stdio_ptr'
15957 stdio_stream_array='$stdio_stream_array'
15958 strings='$strings'
15959 submit='$submit'
15960 subversion='$subversion'
15961 sysman='$sysman'
15962 tail='$tail'
15963 tar='$tar'
15964 tbl='$tbl'
15965 tee='$tee'
15966 test='$test'
15967 timeincl='$timeincl'
15968 timetype='$timetype'
15969 touch='$touch'
15970 tr='$tr'
15971 trnl='$trnl'
15972 troff='$troff'
15973 u16size='$u16size'
15974 u16type='$u16type'
15975 u32size='$u32size'
15976 u32type='$u32type'
15977 u64size='$u64size'
15978 u64type='$u64type'
15979 u8size='$u8size'
15980 u8type='$u8type'
15981 uidformat='$uidformat'
15982 uidsign='$uidsign'
15983 uidsize='$uidsize'
15984 uidtype='$uidtype'
15985 uname='$uname'
15986 uniq='$uniq'
15987 uquadtype='$uquadtype'
15988 use5005threads='$use5005threads'
15989 use64bitall='$use64bitall'
15990 use64bitint='$use64bitint'
15991 usedl='$usedl'
15992 useithreads='$useithreads'
15993 uselargefiles='$uselargefiles'
15994 uselongdouble='$uselongdouble'
15995 usemorebits='$usemorebits'
15996 usemultiplicity='$usemultiplicity'
15997 usemymalloc='$usemymalloc'
15998 usenm='$usenm'
15999 useopcode='$useopcode'
16000 useperlio='$useperlio'
16001 useposix='$useposix'
16002 usesfio='$usesfio'
16003 useshrplib='$useshrplib'
16004 usesocks='$usesocks'
16005 usethreads='$usethreads'
16006 usevendorprefix='$usevendorprefix'
16007 usevfork='$usevfork'
16008 usrinc='$usrinc'
16009 uuname='$uuname'
16010 uvoformat='$uvoformat'
16011 uvsize='$uvsize'
16012 uvtype='$uvtype'
16013 uvuformat='$uvuformat'
16014 uvxformat='$uvxformat'
16015 vendorarch='$vendorarch'
16016 vendorarchexp='$vendorarchexp'
16017 vendorbin='$vendorbin'
16018 vendorbinexp='$vendorbinexp'
16019 vendorlib='$vendorlib'
16020 vendorlib_stem='$vendorlib_stem'
16021 vendorlibexp='$vendorlibexp'
16022 vendorprefix='$vendorprefix'
16023 vendorprefixexp='$vendorprefixexp'
16024 version='$version'
16025 vi='$vi'
16026 voidflags='$voidflags'
16027 xlibpth='$xlibpth'
16028 xs_apiversion='$xs_apiversion'
16029 zcat='$zcat'
16030 zip='$zip'
16031 EOT
16032
16033 : Add in command line options if available
16034 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
16035
16036 : add special variables
16037 $test -f $src/patchlevel.h && \
16038 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
16039 echo "CONFIGDOTSH=true" >>config.sh
16040
16041 : propagate old symbols
16042 if $test -f UU/config.sh; then
16043         <UU/config.sh sort | uniq >UU/oldconfig.sh
16044         sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
16045         sort | uniq -u >UU/oldsyms
16046         set X `cat UU/oldsyms`
16047         shift
16048         case $# in
16049         0) ;;
16050         *)
16051                 cat <<EOM
16052 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
16053 EOM
16054                 echo "# Variables propagated from previous config.sh file." >>config.sh
16055                 for sym in `cat UU/oldsyms`; do
16056                         echo "    Propagating $hint variable "'$'"$sym..."
16057                         eval 'tmp="$'"${sym}"'"'
16058                         echo "$tmp" | \
16059                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
16060                 done
16061                 ;;
16062         esac
16063 fi
16064
16065 : Finish up by extracting the .SH files
16066 case "$alldone" in
16067 exit)
16068         $rm -rf UU
16069         echo "Done."
16070         exit 0
16071         ;;
16072 cont)
16073         ;;
16074 '')
16075         dflt=''
16076         nostick=true
16077         $cat <<EOM
16078
16079 If you'd like to make any changes to the config.sh file before I begin
16080 to configure things, do it as a shell escape now (e.g. !vi config.sh).
16081
16082 EOM
16083         rp="Press return or use a shell escape to edit config.sh:"
16084         . UU/myread
16085         nostick=''
16086         case "$ans" in
16087         '') ;;
16088         *) : in case they cannot read
16089                 sh 1>&4 -c "$ans";;
16090         esac
16091         ;;
16092 esac
16093
16094 : if this fails, just run all the .SH files by hand
16095 . ./config.sh
16096
16097 echo " "
16098 exec 1>&4
16099 . ./UU/extract
16100
16101 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
16102         dflt=y
16103         case "$silent" in
16104         true) ;;
16105         *)
16106                 $cat <<EOM
16107
16108 Now you need to generate make dependencies by running "$make depend".
16109 You might prefer to run it in background: "$make depend > makedepend.out &"
16110 It can take a while, so you might not want to run it right now.
16111
16112 EOM
16113                 ;;
16114         esac
16115         rp="Run $make depend now?"
16116         . UU/myread
16117         case "$ans" in
16118         y*)
16119                 $make depend && echo "Now you must run a $make."
16120                 ;;
16121         *)
16122                 echo "You must run '$make depend' then '$make'."
16123                 ;;
16124         esac
16125 elif test -f [Mm]akefile; then
16126         echo " "
16127         echo "Now you must run a $make."
16128 else
16129         echo "Done."
16130 fi
16131
16132 if $test -f Policy.sh; then
16133     $cat <<EOM
16134
16135 If you compile $package on a different machine or from a different object
16136 directory, copy the Policy.sh file from this object directory to the
16137 new one before you run Configure -- this will help you with most of
16138 the policy defaults.
16139
16140 EOM
16141 fi
16142 if $test -f config.msg; then
16143     echo "Hmm.  I also noted the following information while running:"
16144     echo " "
16145     $cat config.msg >&4
16146     $rm -f config.msg
16147 fi
16148 $rm -f kit*isdone ark*isdone
16149 $rm -rf UU
16150
16151 : End of Configure
16152