Various Configure nits by Philip Newton,
[p5sagit/p5-mst-13.2.git] / Configure
1 #! /bin/sh
2 #
3 # If these # comments don't work, trim them. Don't worry about any other
4 # shell scripts, Configure will trim # comments from them for you.
5 #
6 # (If you are trying to port this package to a machine without sh,
7 # I would suggest you have a look at the prototypical config_h.SH file
8 # and edit it to reflect your system. Some packages may include samples
9 # of config.h for certain machines, so you might look for one of those.)
10 #
11 # Yes, you may rip this off to use in other distribution packages. This
12 # script belongs to the public domain and cannot be copyrighted.
13 #
14 # (Note: this Configure script was generated automatically. Rather than
15 # working with this copy of Configure, you may wish to get metaconfig.
16 # The dist-3.0 package (which contains metaconfig) was posted in
17 # comp.sources.misc and is available on CPAN under authors/id/RAM so
18 # you may fetch it yourself from your nearest archive site.)
19 #
20
21 # $Id: Head.U,v 3.0.1.9 1997/02/28 15:02:09 ram Exp $
22 #
23 # Generated on Sat Sep  2 18:40:07 EET DST 2000 [metaconfig 3.0 PL70]
24 # (with additional metaconfig patches by perlbug@perl.org)
25
26 cat >/tmp/c1$$ <<EOF
27 ARGGGHHHH!!!!!
28
29 SCO csh still thinks true is false.  Write to SCO today and tell them that next
30 year Configure ought to "rm /bin/csh" unless they fix their blasted shell. :-)
31
32 (Actually, Configure ought to just patch csh in place.  Hmm.  Hmmmmm.  All
33 we'd have to do is go in and swap the && and || tokens, wherever they are.)
34
35 [End of diatribe. We now return you to your regularly scheduled programming...]
36 EOF
37 cat >/tmp/c2$$ <<EOF
38
39 OOPS!  You naughty creature!  You didn't run Configure with sh!
40 I will attempt to remedy the situation by running sh for you...
41 EOF
42
43 true || cat /tmp/c1$$ /tmp/c2$$
44 true || exec sh $0 $argv:q
45
46 (exit $?0) || cat /tmp/c2$$
47 (exit $?0) || exec sh $0 $argv:q
48 rm -f /tmp/c1$$ /tmp/c2$$
49
50 : compute my invocation name
51 me=$0
52 case "$0" in
53 */*)
54         me=`echo $0 | sed -e 's!.*/\(.*\)!\1!' 2>/dev/null`
55         test "$me" || me=$0
56         ;;
57 esac
58
59 : Proper separator for the PATH environment variable
60 p_=:
61 : On OS/2 this directory should exist if this is not floppy only system :-]
62 if test -d c:/. ; then
63     if test -n "$OS2_SHELL"; then
64                 p_=\;
65                 PATH=`cmd /c "echo %PATH%" | tr '\\\\' / `
66                 OS2_SHELL=`cmd /c "echo %OS2_SHELL%" | tr '\\\\' / | tr '[A-Z]' '[a-z]'`
67         elif test -n "$DJGPP"; then
68                 p_=\;
69         fi
70 fi
71
72 : Proper PATH setting
73 paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin'
74 paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin"
75 paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin"
76 paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin"
77 paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb"
78 paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /usr/ccs/bin"
79 paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib"
80 paths="$paths /sbin /usr/sbin /usr/libexec"
81
82 for p in $paths
83 do
84         case "$p_$PATH$p_" in
85         *$p_$p$p_*) ;;
86         *) test -d $p && PATH=$PATH$p_$p ;;
87         esac
88 done
89
90 PATH=.$p_$PATH
91 export PATH
92
93 : shall we be using ksh?
94 inksh=''
95 needksh=''
96 avoidksh=''
97 newsh=/bin/ksh
98 changesh=''
99 if (PATH=.; alias -x) >/dev/null 2>&1; then
100                 inksh=true
101 fi
102 if test -f /hp-ux -a -f /bin/ksh; then
103         needksh='to avoid sh bug in "here document" expansion'
104 fi
105 if test -d /usr/lpp -a -f /usr/bin/bsh -a -f /usr/bin/uname; then
106         if test X`/usr/bin/uname -v` = X4; then
107                 avoidksh="to avoid AIX 4's /bin/sh"
108                 newsh=/usr/bin/bsh
109         fi
110 fi
111 if test -f /osf_boot -a -f /usr/sbin/setld; then
112         if test X`/usr/bin/uname -s` = XOSF1; then
113                 avoidksh="to avoid Digital UNIX' ksh"
114                 newsh=/bin/sh
115                 unset BIN_SH # if this is 'xpg4' sh will start up ksh
116         fi
117 fi
118 case "$inksh/$needksh" in
119 /[a-z]*)
120                 ENV=''
121                 changesh=true
122                 reason="$needksh"
123         ;;
124 esac
125 case "$inksh/$avoidksh" in
126 true/[a-z]*)
127         changesh=true
128         reason="$avoidksh"
129         ;;
130 esac
131 case "$inksh/$needksh-$avoidksh-" in
132 true/--)
133                 cat <<EOM
134 (I see you are using the Korn shell.  Some ksh's blow up on $me,
135 mainly on older exotic systems.  If yours does, try the Bourne shell instead.)
136 EOM
137         ;;
138 esac
139 case "$changesh" in
140 true)
141         echo "(Feeding myself to $newsh $reason.)"
142         case "$0" in
143         Configure|*/Configure) exec $newsh $0 "$@";;
144         *) exec $newsh Configure "$@";;
145         esac
146         ;;
147 esac
148
149 : if needed set CDPATH to a harmless value that is not chatty
150 : avoid bash 2.02 problems with empty CDPATH.
151 case "$CDPATH" in
152 '')     ;;
153 *)      case "$SHELL" in
154         *bash*) CDPATH='.' ;;
155         *)              CDPATH='' ;;
156         esac
157         ;;
158 esac
159 : Configure runs within the UU subdirectory
160 test -d UU || mkdir UU
161 cd UU && rm -f ./*
162
163 ccname=''
164 ccversion=''
165 ccsymbols=''
166 cppccsymbols=''
167 cppsymbols=''
168 dynamic_ext=''
169 extensions=''
170 known_extensions=''
171 nonxs_ext=''
172 static_ext=''
173 useopcode=''
174 useposix=''
175 d_bsd=''
176 d_eunice=''
177 d_xenix=''
178 eunicefix=''
179 Mcc=''
180 ar=''
181 awk=''
182 bash=''
183 bison=''
184 byacc=''
185 cat=''
186 chgrp=''
187 chmod=''
188 chown=''
189 comm=''
190 compress=''
191 cp=''
192 cpio=''
193 cpp=''
194 csh=''
195 date=''
196 echo=''
197 egrep=''
198 emacs=''
199 expr=''
200 find=''
201 flex=''
202 grep=''
203 gzip=''
204 inews=''
205 ksh=''
206 less=''
207 line=''
208 lint=''
209 ln=''
210 lp=''
211 lpr=''
212 ls=''
213 mail=''
214 mailx=''
215 make=''
216 mkdir=''
217 more=''
218 mv=''
219 nm=''
220 nroff=''
221 perl=''
222 pg=''
223 pmake=''
224 pr=''
225 rm=''
226 rmail=''
227 sed=''
228 sendmail=''
229 shar=''
230 sleep=''
231 smail=''
232 sort=''
233 submit=''
234 tail=''
235 tar=''
236 tbl=''
237 tee=''
238 test=''
239 touch=''
240 tr=''
241 troff=''
242 uname=''
243 uniq=''
244 uuname=''
245 vi=''
246 zcat=''
247 zip=''
248 full_ar=''
249 full_sed=''
250 libswanted=''
251 hint=''
252 myuname=''
253 osname=''
254 osvers=''
255 Author=''
256 Date=''
257 Header=''
258 Id=''
259 Locker=''
260 Log=''
261 RCSfile=''
262 Revision=''
263 Source=''
264 State=''
265 _a=''
266 _exe=''
267 _o=''
268 archobjs=''
269 exe_ext=''
270 firstmakefile=''
271 lib_ext=''
272 obj_ext=''
273 path_sep=''
274 afs=''
275 alignbytes=''
276 ansi2knr=''
277 archlib=''
278 archlibexp=''
279 d_archlib=''
280 installarchlib=''
281 archname=''
282 myarchname=''
283 d_atolf=''
284 d_atoll=''
285 baserev=''
286 bin=''
287 binexp=''
288 installbin=''
289 bincompat5005=''
290 d_bincompat5005=''
291 byteorder=''
292 cc=''
293 ccflags=''
294 cppflags=''
295 ldflags=''
296 lkflags=''
297 locincpth=''
298 optimize=''
299 cf_email=''
300 cf_by=''
301 cf_time=''
302 charsize=''
303 contains=''
304 cpp_stuff=''
305 cpplast=''
306 cppminus=''
307 cpprun=''
308 cppstdin=''
309 crosscompile=''
310 d_access=''
311 d_accessx=''
312 d_alarm=''
313 d_attribut=''
314 d_bcmp=''
315 d_bcopy=''
316 d_bzero=''
317 d_casti32=''
318 castflags=''
319 d_castneg=''
320 d_chown=''
321 d_chroot=''
322 d_chsize=''
323 d_closedir=''
324 d_void_closedir=''
325 d_const=''
326 cryptlib=''
327 d_crypt=''
328 d_csh=''
329 full_csh=''
330 d_cuserid=''
331 d_dbl_dig=''
332 d_difftime=''
333 d_dlerror=''
334 d_dlopen=''
335 d_dlsymun=''
336 d_dosuid=''
337 d_suidsafe=''
338 d_drand48proto=''
339 d_dup2=''
340 d_eaccess=''
341 d_endgrent=''
342 d_endhent=''
343 d_endnent=''
344 d_endpent=''
345 d_endpwent=''
346 d_endsent=''
347 d_fchmod=''
348 d_fchown=''
349 d_fcntl=''
350 d_fd_macros=''
351 d_fd_set=''
352 d_fds_bits=''
353 d_fgetpos=''
354 d_flexfnam=''
355 d_flock=''
356 d_fork=''
357 d_fpos64_t=''
358 d_frexpl=''
359 d_fs_data_s=''
360 d_fseeko=''
361 d_fsetpos=''
362 d_fstatfs=''
363 d_ftello=''
364 d_ftime=''
365 d_gettimeod=''
366 d_Gconvert=''
367 d_getcwd=''
368 d_getespwnam=''
369 d_getfsstat=''
370 d_getgrent=''
371 d_getgrps=''
372 d_gethbyaddr=''
373 d_gethbyname=''
374 d_gethent=''
375 aphostname=''
376 d_gethname=''
377 d_phostname=''
378 d_uname=''
379 d_gethostprotos=''
380 d_getlogin=''
381 d_getmnt=''
382 d_getmntent=''
383 d_getnbyaddr=''
384 d_getnbyname=''
385 d_getnent=''
386 d_getnetprotos=''
387 d_getpent=''
388 d_getpgid=''
389 d_getpgrp2=''
390 d_bsdgetpgrp=''
391 d_getpgrp=''
392 d_getppid=''
393 d_getprior=''
394 d_getpbyname=''
395 d_getpbynumber=''
396 d_getprotoprotos=''
397 d_getprpwnam=''
398 d_getpwent=''
399 d_getsent=''
400 d_getservprotos=''
401 d_getspnam=''
402 d_getsbyname=''
403 d_getsbyport=''
404 d_gnulibc=''
405 d_hasmntopt=''
406 d_htonl=''
407 d_iconv=''
408 d_inetaton=''
409 d_int64_t=''
410 d_isascii=''
411 d_isnan=''
412 d_isnanl=''
413 d_killpg=''
414 d_lchown=''
415 d_ldbl_dig=''
416 d_link=''
417 d_locconv=''
418 d_lockf=''
419 d_longdbl=''
420 longdblsize=''
421 d_longlong=''
422 longlongsize=''
423 d_lseekproto=''
424 d_lstat=''
425 d_madvise=''
426 d_mblen=''
427 d_mbstowcs=''
428 d_mbtowc=''
429 d_memchr=''
430 d_memcmp=''
431 d_memcpy=''
432 d_memmove=''
433 d_memset=''
434 d_mkdir=''
435 d_mkdtemp=''
436 d_mkfifo=''
437 d_mkstemp=''
438 d_mkstemps=''
439 d_mktime=''
440 d_mmap=''
441 mmaptype=''
442 d_modfl=''
443 d_mprotect=''
444 d_msg=''
445 d_msgctl=''
446 d_msgget=''
447 d_msgrcv=''
448 d_msgsnd=''
449 d_msync=''
450 d_munmap=''
451 d_nice=''
452 d_off64_t=''
453 d_open3=''
454 d_fpathconf=''
455 d_pathconf=''
456 d_pause=''
457 d_pipe=''
458 d_poll=''
459 d_portable=''
460 d_old_pthread_create_joinable=''
461 old_pthread_create_joinable=''
462 d_pthread_yield=''
463 d_sched_yield=''
464 sched_yield=''
465 d_qgcvt=''
466 d_readdir=''
467 d_rewinddir=''
468 d_seekdir=''
469 d_telldir=''
470 d_readlink=''
471 d_rename=''
472 d_rmdir=''
473 d_safebcpy=''
474 d_safemcpy=''
475 d_sanemcmp=''
476 d_select=''
477 d_sem=''
478 d_semctl=''
479 d_semget=''
480 d_semop=''
481 d_setegid=''
482 d_seteuid=''
483 d_setgrent=''
484 d_setgrps=''
485 d_sethent=''
486 d_setlinebuf=''
487 d_setlocale=''
488 d_setnent=''
489 d_setpent=''
490 d_setpgid=''
491 d_setpgrp2=''
492 d_bsdsetpgrp=''
493 d_setpgrp=''
494 d_setprior=''
495 d_setproctitle=''
496 d_setpwent=''
497 d_setregid=''
498 d_setresgid=''
499 d_setresuid=''
500 d_setreuid=''
501 d_setrgid=''
502 d_setruid=''
503 d_setsent=''
504 d_setsid=''
505 d_setvbuf=''
506 d_sfio=''
507 usesfio=''
508 d_shm=''
509 d_shmat=''
510 d_shmatprototype=''
511 shmattype=''
512 d_shmctl=''
513 d_shmdt=''
514 d_shmget=''
515 d_sigaction=''
516 d_sigsetjmp=''
517 d_msg_ctrunc=''
518 d_msg_dontroute=''
519 d_msg_oob=''
520 d_msg_peek=''
521 d_msg_proxy=''
522 d_oldsock=''
523 d_scm_rights=''
524 d_socket=''
525 d_sockpair=''
526 sockethdr=''
527 socketlib=''
528 d_socklen_t=''
529 d_socks5_init=''
530 d_sqrtl=''
531 d_statblks=''
532 d_statfs_f_flags=''
533 d_statfs_s=''
534 d_fstatvfs=''
535 d_statvfs=''
536 d_stdio_cnt_lval=''
537 d_stdio_ptr_lval=''
538 d_stdiobase=''
539 d_stdstdio=''
540 stdio_base=''
541 stdio_bufsiz=''
542 stdio_cnt=''
543 stdio_filbuf=''
544 stdio_ptr=''
545 d_index=''
546 d_strchr=''
547 d_strcoll=''
548 d_strctcpy=''
549 d_strerrm=''
550 d_strerror=''
551 d_sysernlst=''
552 d_syserrlst=''
553 d_strtod=''
554 d_strtol=''
555 d_strtold=''
556 d_strtoll=''
557 d_strtoul=''
558 d_strtoull=''
559 d_strtouq=''
560 d_strxfrm=''
561 d_symlink=''
562 d_syscall=''
563 d_sysconf=''
564 d_system=''
565 d_tcgetpgrp=''
566 d_tcsetpgrp=''
567 d_telldirproto=''
568 d_time=''
569 timetype=''
570 clocktype=''
571 d_times=''
572 d_truncate=''
573 d_tzname=''
574 d_umask=''
575 d_semctl_semid_ds=''
576 d_semctl_semun=''
577 d_union_semun=''
578 d_ustat=''
579 d_vfork=''
580 usevfork=''
581 d_voidsig=''
582 signal_t=''
583 d_volatile=''
584 d_charvspr=''
585 d_vprintf=''
586 d_wait4=''
587 d_waitpid=''
588 d_wcstombs=''
589 d_wctomb=''
590 dlext=''
591 cccdlflags=''
592 ccdlflags=''
593 dlsrc=''
594 ld=''
595 lddlflags=''
596 usedl=''
597 doublesize=''
598 ebcdic=''
599 fflushNULL=''
600 fflushall=''
601 fpossize=''
602 fpostype=''
603 gccosandvers=''
604 gccversion=''
605 gidformat=''
606 gidsign=''
607 gidsize=''
608 gidtype=''
609 groupstype=''
610 h_fcntl=''
611 h_sysfile=''
612 i_arpainet=''
613 db_hashtype=''
614 db_prefixtype=''
615 i_db=''
616 i_dbm=''
617 i_rpcsvcdbm=''
618 d_dirnamlen=''
619 direntrytype=''
620 i_dirent=''
621 i_dld=''
622 i_dlfcn=''
623 i_fcntl=''
624 i_float=''
625 i_gdbm=''
626 d_grpasswd=''
627 i_grp=''
628 i_iconv=''
629 i_ieeefp=''
630 i_inttypes=''
631 i_libutil=''
632 i_limits=''
633 i_locale=''
634 i_machcthr=''
635 i_malloc=''
636 i_math=''
637 i_memory=''
638 i_mntent=''
639 i_ndbm=''
640 i_netdb=''
641 i_neterrno=''
642 i_netinettcp=''
643 i_niin=''
644 i_sysin=''
645 i_poll=''
646 i_prot=''
647 i_pthread=''
648 d_pwage=''
649 d_pwchange=''
650 d_pwclass=''
651 d_pwcomment=''
652 d_pwexpire=''
653 d_pwgecos=''
654 d_pwpasswd=''
655 d_pwquota=''
656 i_pwd=''
657 i_sfio=''
658 i_shadow=''
659 i_socks=''
660 i_stddef=''
661 i_stdlib=''
662 i_string=''
663 strings=''
664 i_sunmath=''
665 i_sysaccess=''
666 i_sysdir=''
667 i_sysfile=''
668 d_voidtty=''
669 i_bsdioctl=''
670 i_sysfilio=''
671 i_sysioctl=''
672 i_syssockio=''
673 i_syslog=''
674 i_sysmman=''
675 i_sysmode=''
676 i_sysmount=''
677 i_sysndir=''
678 i_sysparam=''
679 i_sysresrc=''
680 i_syssecrt=''
681 i_sysselct=''
682 i_sysstat=''
683 i_sysstatfs=''
684 i_sysstatvfs=''
685 i_systimes=''
686 i_systypes=''
687 i_sysuio=''
688 i_sysun=''
689 i_sysutsname=''
690 i_sysvfs=''
691 i_syswait=''
692 i_sgtty=''
693 i_termio=''
694 i_termios=''
695 i_systime=''
696 i_systimek=''
697 i_time=''
698 timeincl=''
699 i_unistd=''
700 i_ustat=''
701 i_utime=''
702 i_values=''
703 i_stdarg=''
704 i_varargs=''
705 i_varhdr=''
706 i_vfork=''
707 inc_version_list=''
708 inc_version_list_init=''
709 installprefix=''
710 installprefixexp=''
711 installstyle=''
712 installusrbinperl=''
713 intsize=''
714 longsize=''
715 shortsize=''
716 libc=''
717 ldlibpthname=''
718 libperl=''
719 shrpenv=''
720 useshrplib=''
721 glibpth=''
722 libpth=''
723 loclibpth=''
724 plibpth=''
725 xlibpth=''
726 ignore_versioned_solibs=''
727 libs=''
728 libsdirs=''
729 libsfiles=''
730 libsfound=''
731 libspath=''
732 lns=''
733 d_PRIEUldbl=''
734 d_PRIFUldbl=''
735 d_PRIGUldbl=''
736 d_PRIeldbl=''
737 d_PRIfldbl=''
738 d_PRIgldbl=''
739 d_SCNfldbl=''
740 sPRIEUldbl=''
741 sPRIFUldbl=''
742 sPRIGUldbl=''
743 sPRIeldbl=''
744 sPRIfldbl=''
745 sPRIgldbl=''
746 sSCNfldbl=''
747 lseeksize=''
748 lseektype=''
749 make_set_make=''
750 d_mymalloc=''
751 freetype=''
752 mallocobj=''
753 mallocsrc=''
754 malloctype=''
755 usemymalloc=''
756 installman1dir=''
757 man1dir=''
758 man1direxp=''
759 man1ext=''
760 installman3dir=''
761 man3dir=''
762 man3direxp=''
763 man3ext=''
764 huge=''
765 large=''
766 medium=''
767 models=''
768 small=''
769 split=''
770 modetype=''
771 multiarch=''
772 mydomain=''
773 myhostname=''
774 phostname=''
775 c=''
776 n=''
777 d_eofnblk=''
778 eagain=''
779 o_nonblock=''
780 rd_nodata=''
781 netdb_hlen_type=''
782 netdb_host_type=''
783 netdb_name_type=''
784 netdb_net_type=''
785 groupcat=''
786 hostcat=''
787 passcat=''
788 orderlib=''
789 ranlib=''
790 d_perl_otherlibdirs=''
791 otherlibdirs=''
792 package=''
793 spackage=''
794 pager=''
795 api_revision=''
796 api_subversion=''
797 api_version=''
798 api_versionstring=''
799 patchlevel=''
800 revision=''
801 subversion=''
802 version=''
803 perl5=''
804 perladmin=''
805 perlpath=''
806 d_nv_preserves_uv=''
807 d_nv_preserves_uv_bits=''
808 i16size=''
809 i16type=''
810 i32size=''
811 i32type=''
812 i64size=''
813 i64type=''
814 i8size=''
815 i8type=''
816 ivsize=''
817 ivtype=''
818 nvsize=''
819 nvtype=''
820 u16size=''
821 u16type=''
822 u32size=''
823 u32type=''
824 u64size=''
825 u64type=''
826 u8size=''
827 u8type=''
828 uvsize=''
829 uvtype=''
830 ivdformat=''
831 nvEUformat=''
832 nvFUformat=''
833 nvGUformat=''
834 nveformat=''
835 nvfformat=''
836 nvgformat=''
837 uvXUformat=''
838 uvoformat=''
839 uvuformat=''
840 uvxformat=''
841 pidtype=''
842 prefix=''
843 prefixexp=''
844 installprivlib=''
845 privlib=''
846 privlibexp=''
847 prototype=''
848 ptrsize=''
849 d_PRIXU64=''
850 d_PRId64=''
851 d_PRIi64=''
852 d_PRIo64=''
853 d_PRIu64=''
854 d_PRIx64=''
855 sPRIXU64=''
856 sPRId64=''
857 sPRIi64=''
858 sPRIo64=''
859 sPRIu64=''
860 sPRIx64=''
861 d_quad=''
862 quadkind=''
863 quadtype=''
864 uquadtype=''
865 drand01=''
866 randbits=''
867 randfunc=''
868 randseedtype=''
869 seedfunc=''
870 installscript=''
871 scriptdir=''
872 scriptdirexp=''
873 selectminbits=''
874 selecttype=''
875 sh=''
876 sig_count=''
877 sig_name=''
878 sig_name_init=''
879 sig_num=''
880 sig_num_init=''
881 installsitearch=''
882 sitearch=''
883 sitearchexp=''
884 installsitebin=''
885 sitebin=''
886 sitebinexp=''
887 installsitelib=''
888 sitelib=''
889 sitelib_stem=''
890 sitelibexp=''
891 siteprefix=''
892 siteprefixexp=''
893 sizesize=''
894 sizetype=''
895 so=''
896 socksizetype=''
897 sharpbang=''
898 shsharp=''
899 spitshell=''
900 src=''
901 ssizetype=''
902 startperl=''
903 startsh=''
904 stdchar=''
905 d_stdio_stream_array=''
906 stdio_stream_array=''
907 sysman=''
908 trnl=''
909 uidformat=''
910 uidsign=''
911 uidsize=''
912 uidtype=''
913 archname64=''
914 use64bitall=''
915 use64bitint=''
916 ccflags_uselargefiles=''
917 ldflags_uselargefiles=''
918 libswanted_uselargefiles=''
919 uselargefiles=''
920 uselongdouble=''
921 usemorebits=''
922 usemultiplicity=''
923 nm_opt=''
924 nm_so_opt=''
925 runnm=''
926 usenm=''
927 useperlio=''
928 usesocks=''
929 d_oldpthreads=''
930 use5005threads=''
931 useithreads=''
932 usethreads=''
933 incpath=''
934 mips_type=''
935 usrinc=''
936 d_vendorarch=''
937 installvendorarch=''
938 vendorarch=''
939 vendorarchexp=''
940 d_vendorbin=''
941 installvendorbin=''
942 vendorbin=''
943 vendorbinexp=''
944 d_vendorlib=''
945 installvendorlib=''
946 vendorlib=''
947 vendorlib_stem=''
948 vendorlibexp=''
949 usevendorprefix=''
950 vendorprefix=''
951 vendorprefixexp=''
952 defvoidused=''
953 voidflags=''
954 pm_apiversion=''
955 xs_apiversion=''
956 CONFIG=''
957
958 define='define'
959 undef='undef'
960 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
961 rmlist=''
962
963 : We must find out about Eunice early
964 eunicefix=':'
965 if test -f /etc/unixtovms; then
966         eunicefix=/etc/unixtovms
967 fi
968 if test -f /etc/unixtovms.exe; then
969         eunicefix=/etc/unixtovms.exe
970 fi
971
972 i_whoami=''
973 ccname=''
974 ccversion=''
975 : set useposix=false in your hint file to disable the POSIX extension.
976 useposix=true
977 : set useopcode=false in your hint file to disable the Opcode extension.
978 useopcode=true
979 : Trailing extension.  Override this in a hint file, if needed.
980 _exe=''
981 : Extra object files, if any, needed on this platform.
982 archobjs=''
983 archname=''
984 : Possible local include directories to search.
985 : Set locincpth to "" in a hint file to defeat local include searches.
986 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
987 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
988 :
989 : no include file wanted by default
990 inclwanted=''
991
992 groupstype=''
993 : change the next line if compiling for Xenix/286 on Xenix/386
994 xlibpth='/usr/lib/386 /lib/386'
995 : Possible local library directories to search.
996 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
997 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
998
999 : general looking path for locating libraries
1000 glibpth="/usr/lib/large /lib /usr/lib $xlibpth"
1001 glibpth="$glibpth /lib/large /usr/lib/small /lib/small"
1002 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1003 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1004 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
1005
1006 : Private path used by Configure to find libraries.  Its value
1007 : is prepended to libpth. This variable takes care of special
1008 : machines, like the mips.  Usually, it should be empty.
1009 plibpth=''
1010
1011 : default library list
1012 libswanted=''
1013 : some systems want to use only the non-versioned libso:s
1014 ignore_versioned_solibs=''
1015 archname64=''
1016 ccflags_uselargefiles=''
1017 ldflags_uselargefiles=''
1018 libswanted_uselargefiles=''
1019 : set usemultiplicity on the Configure command line to enable multiplicity.
1020 : set usesocks on the Configure command line to enable socks.
1021 : set usethreads on the Configure command line to enable threads.
1022 : full support for void wanted by default
1023 defvoidused=15
1024
1025 : List of libraries we want.
1026 : If anyone needs -lnet, put it in a hint file.
1027 libswanted='sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl'
1028 libswanted="$libswanted dld ld sun m c cposix posix"
1029 libswanted="$libswanted ndir dir crypt sec"
1030 libswanted="$libswanted ucb bsd BSD PW x iconv util"
1031 : We probably want to search /usr/shlib before most other libraries.
1032 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1033 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1034 glibpth="/usr/shlib $glibpth"
1035 : Do not use vfork unless overridden by a hint file.
1036 usevfork=false
1037
1038 : Find the basic shell for Bourne shell scripts
1039 case "$sh" in
1040 '')
1041         case "$SYSTYPE" in
1042         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1043         *) xxx='/bin/sh';;
1044         esac
1045         if test -f "$xxx"; then
1046                 sh="$xxx"
1047         else
1048                 : Build up a list and do a single loop so we can 'break' out.
1049                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1050                 for xxx in sh bash ksh pdksh ash; do
1051                         for p in $pth; do
1052                                 try="$try ${p}/${xxx}"
1053                         done
1054                 done
1055                 for xxx in $try; do
1056                         if test -f "$xxx"; then
1057                                 sh="$xxx";
1058                                 break
1059                         elif test -f "$xxx.exe"; then
1060                                 sh="$xxx";
1061                                 break
1062                         fi
1063                 done
1064         fi
1065         ;;
1066 esac
1067
1068 case "$sh" in
1069 '')     cat <<EOM >&2
1070 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
1071
1072 Usually it's in /bin/sh.  How did you even get this far?
1073 Please contact me (Perl Maintainers) at perlbug@perl.org and 
1074 we'll try to straighten this all out.
1075 EOM
1076         exit 1
1077         ;;
1078 esac
1079
1080 : see if sh knows # comments
1081 if `$sh -c '#' >/dev/null 2>&1`; then
1082         shsharp=true
1083         spitshell=cat
1084         xcat=/bin/cat
1085         test -f $xcat || xcat=/usr/bin/cat
1086         echo "#!$xcat" >try
1087         $eunicefix try
1088         chmod +x try
1089         ./try > today
1090         if test -s today; then
1091                 sharpbang='#!'
1092         else
1093                 echo "#! $xcat" > try
1094                 $eunicefix try
1095                 chmod +x try
1096                 ./try > today
1097                 if test -s today; then
1098                         sharpbang='#! '
1099                 else
1100                         sharpbang=': use '
1101                 fi
1102         fi
1103 else
1104         echo " "
1105         echo "Your $sh doesn't grok # comments--I will strip them later on."
1106         shsharp=false
1107         cd ..
1108         echo "exec grep -v '^[  ]*#'" >spitshell
1109         chmod +x spitshell
1110         $eunicefix spitshell
1111         spitshell=`pwd`/spitshell
1112         cd UU
1113         echo "I presume that if # doesn't work, #! won't work either!"
1114         sharpbang=': use '
1115 fi
1116 rm -f try today
1117
1118 : figure out how to guarantee sh startup
1119 case "$startsh" in
1120 '') startsh=${sharpbang}${sh} ;;
1121 *)
1122 esac
1123 cat >try <<EOSS
1124 $startsh
1125 set abc
1126 test "$?abc" != 1
1127 EOSS
1128
1129 chmod +x try
1130 $eunicefix try
1131 if ./try; then
1132         : echo "Yup, it does."
1133 else
1134         echo "Hmm... '$startsh' does not guarantee sh startup..."
1135         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1136 fi
1137 rm -f try
1138
1139
1140 : Save command line options in file UU/cmdline.opt for later use in
1141 : generating config.sh.
1142 cat > cmdline.opt <<EOSH
1143 # Configure command line arguments.
1144 config_arg0='$0'
1145 config_args='$*'
1146 config_argc=$#
1147 EOSH
1148 argn=1
1149 for arg in "$@"; do
1150         cat >>cmdline.opt <<EOSH
1151 config_arg$argn='$arg'
1152 EOSH
1153         argn=`expr $argn + 1`
1154 done
1155
1156 : produce awk script to parse command line options
1157 cat >options.awk <<'EOF'
1158 BEGIN {
1159         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1160
1161         len = length(optstr);
1162         for (i = 1; i <= len; i++) {
1163                 c = substr(optstr, i, 1);
1164                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1165                 if (a == ":") {
1166                         arg[c] = 1;
1167                         i++;
1168                 }
1169                 opt[c] = 1;
1170         }
1171 }
1172 {
1173         expect = 0;
1174         str = $0;
1175         if (substr(str, 1, 1) != "-") {
1176                 printf("'%s'\n", str);
1177                 next;
1178         }
1179         len = length($0);
1180         for (i = 2; i <= len; i++) {
1181                 c = substr(str, i, 1);
1182                 if (!opt[c]) {
1183                         printf("-%s\n", substr(str, i));
1184                         next;
1185                 }
1186                 printf("-%s\n", c);
1187                 if (arg[c]) {
1188                         if (i < len)
1189                                 printf("'%s'\n", substr(str, i + 1));
1190                         else
1191                                 expect = 1;
1192                         next;
1193                 }
1194         }
1195 }
1196 END {
1197         if (expect)
1198                 print "?";
1199 }
1200 EOF
1201
1202 : process the command line options
1203 set X `for arg in "$@"; do echo "X$arg"; done |
1204         sed -e s/X// | awk -f options.awk`
1205 eval "set $*"
1206 shift
1207 rm -f options.awk
1208
1209 : set up default values
1210 fastread=''
1211 reuseval=false
1212 config_sh=''
1213 alldone=''
1214 error=''
1215 silent=''
1216 extractsh=''
1217 override=''
1218 knowitall=''
1219 rm -f optdef.sh posthint.sh
1220 cat >optdef.sh <<EOS
1221 $startsh
1222 EOS
1223
1224
1225 : option parsing
1226 while test $# -gt 0; do
1227         case "$1" in
1228         -d) shift; fastread=yes;;
1229         -e) shift; alldone=cont;;
1230         -f)
1231                 shift
1232                 cd ..
1233                 if test -r "$1"; then
1234                         config_sh="$1"
1235                 else
1236                         echo "$me: cannot read config file $1." >&2
1237                         error=true
1238                 fi
1239                 cd UU
1240                 shift;;
1241         -h) shift; error=true;;
1242         -r) shift; reuseval=true;;
1243         -s) shift; silent=true; realsilent=true;;
1244         -E) shift; alldone=exit;;
1245         -K) shift; knowitall=true;;
1246         -O) shift; override=true;;
1247         -S) shift; silent=true; extractsh=true;;
1248         -D)
1249                 shift
1250                 case "$1" in
1251                 *=)
1252                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1253                         echo "$me: ignoring -D $1" >&2
1254                         ;;
1255                 *=*) echo "$1" | \
1256                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1257                 *) echo "$1='define'" >> optdef.sh;;
1258                 esac
1259                 shift
1260                 ;;
1261         -U)
1262                 shift
1263                 case "$1" in
1264                 *=) echo "$1" >> optdef.sh;;
1265                 *=*)
1266                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1267                         echo "$me: ignoring -U $1" >&2
1268                         ;;
1269                 *) echo "$1='undef'" >> optdef.sh;;
1270                 esac
1271                 shift
1272                 ;;
1273         -A)
1274             shift
1275             xxx=''
1276             yyy="$1"
1277             zzz=''
1278             uuu=undef
1279             case "$yyy" in
1280             *=*) zzz=`echo $yyy|sed 's!=.*!!'`
1281                  case "$zzz" in
1282                  *:*) zzz='' ;;
1283                  *)   xxx=append
1284                       zzz=" "`echo $yyy|sed 's!^[^=]*=!!'` 
1285                       yyy=`echo $yyy|sed 's!=.*!!'` ;;
1286                  esac
1287                  ;;
1288             esac
1289             case "$xxx" in
1290             '')  case "$yyy" in
1291                  *:*) xxx=`echo $yyy|sed 's!:.*!!'`
1292                       yyy=`echo $yyy|sed 's!^[^:]*:!!'`
1293                       zzz=`echo $yyy|sed 's!^[^=]*=!!'`
1294                       yyy=`echo $yyy|sed 's!=.*!!'` ;;
1295                  *)   xxx=`echo $yyy|sed 's!:.*!!'`
1296                       yyy=`echo $yyy|sed 's!^[^:]*:!!'` ;;
1297                  esac
1298                  ;;       
1299             esac
1300             case "$xxx" in
1301             append)
1302                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1303             clear)
1304                 echo "$yyy=''"                  >> posthint.sh ;;
1305             define)
1306                 case "$zzz" in
1307                 '') zzz=define ;;
1308                 esac
1309                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1310             eval)
1311                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1312             prepend)
1313                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1314             undef)
1315                 case "$zzz" in
1316                 '') zzz="$uuu" ;;
1317                 esac
1318                 echo "$yyy=$zzz"                >> posthint.sh ;;
1319             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1320             esac
1321             shift
1322             ;;
1323         -V) echo "$me generated by metaconfig 3.0 PL70." >&2
1324             exit 0;;
1325         --) break;;
1326         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1327         *) break;;
1328         esac
1329 done
1330
1331 case "$error" in
1332 true)
1333         cat >&2 <<EOM
1334 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1335                  [-U symbol] [-U symbol=] [-A command:symbol...]
1336   -d : use defaults for all answers.
1337   -e : go on without questioning past the production of config.sh.
1338   -f : specify an alternate default configuration file.
1339   -h : print this help message and exit (with an error status).
1340   -r : reuse C symbols value if possible (skips costly nm extraction).
1341   -s : silent mode, only echoes questions and essential information.
1342   -D : define symbol to have some value:
1343          -D symbol         symbol gets the value 'define'
1344          -D symbol=value   symbol gets the value 'value'
1345   -E : stop at the end of questions, after having produced config.sh.
1346   -K : do not use unless you know what you are doing.
1347   -O : let -D and -U override definitions from loaded configuration file.
1348   -S : perform variable substitutions on all .SH files (can mix with -f)
1349   -U : undefine symbol:
1350          -U symbol    symbol gets the value 'undef'
1351          -U symbol=   symbol gets completely empty
1352   -A : manipulate symbol after the platform specific hints have been applied:
1353          -A symbol=value                append " "value to symbol
1354          -A append:symbol=value         append value to symbol
1355          -A define:symbol=value         define symbol to have value
1356          -A clear:symbol                define symbol to be ''
1357          -A define:symbol               define symbol to be 'define'
1358          -A eval:symbol=value           define symbol to be eval of value
1359          -A prepend:symbol=value        prepend value to symbol
1360          -A undef:symbol                define symbol to be 'undef'
1361          -A undef:symbol=               define symbol to be ''
1362   -V : print version number and exit (with a zero status).
1363 EOM
1364         exit 1
1365         ;;
1366 esac
1367
1368 : Sanity checks
1369 case "$fastread$alldone" in
1370 yescont|yesexit) ;;
1371 *)
1372         case "$extractsh" in
1373         true) ;;
1374         *)
1375                 if test ! -t 0; then
1376                         echo "Say 'sh Configure', not 'sh <Configure'"
1377                         exit 1
1378                 fi
1379                 ;;
1380         esac
1381         ;;
1382 esac
1383
1384 exec 4>&1
1385 case "$silent" in
1386 true) exec 1>/dev/null;;
1387 esac
1388
1389 : run the defines and the undefines, if any, but leave the file out there...
1390 touch optdef.sh
1391 . ./optdef.sh
1392 : create the posthint manipulation script and leave the file out there...
1393 touch posthint.sh
1394
1395 : set package name
1396 package=perl5
1397 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1398 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1399 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1400 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1401 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1402 esac
1403
1404 : Some greps do not return status, grrr.
1405 echo "grimblepritz" >grimble
1406 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1407         contains=contains
1408 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1409         contains=grep
1410 else
1411         contains=contains
1412 fi
1413 rm -f grimble
1414 : the following should work in any shell
1415 case "$contains" in
1416 contains*)
1417         echo " "
1418         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1419         cat >contains <<'EOSS'
1420 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1421 EOSS
1422 chmod +x contains
1423 esac
1424
1425 : Find the path to the source tree
1426 case "$src" in
1427 '') case "$0" in
1428     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1429          case "$src" in
1430          /*)    ;;
1431          *)     src=`cd ../$src && pwd` ;;
1432          esac
1433          ;;
1434     *)   src='.';;
1435     esac;;
1436 esac
1437 case "$src" in
1438 '')     src=/
1439         rsrc=/
1440         ;;
1441 /*) rsrc="$src";;
1442 *) rsrc="../$src";;
1443 esac
1444 if test -f $rsrc/Configure && \
1445         $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1446 then
1447    : found it, so we are ok.
1448 else
1449         rsrc=''
1450         for src in . .. ../.. ../../.. ../../../..; do
1451                 if test -f ../$src/Configure && \
1452                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1453                 then
1454                         rsrc=../$src
1455                         break
1456                 fi
1457         done
1458 fi
1459 case "$rsrc" in
1460 '')
1461         cat <<EOM >&4
1462
1463 Sorry, I can't seem to locate the source dir for $package.  Please start
1464 Configure with an explicit path -- i.e. /some/path/Configure.
1465
1466 EOM
1467         exit 1
1468         ;;
1469 ../.)   rsrc='..';;
1470 *)
1471         echo " "
1472         echo "Sources for $package found in \"$src\"." >&4
1473         ;;
1474 esac
1475
1476 : script used to extract .SH files with variable substitutions
1477 cat >extract <<'EOS'
1478 CONFIGDOTSH=true
1479 echo "Doing variable substitutions on .SH files..."
1480 if test -f $src/MANIFEST; then
1481         set x `awk '{print $1}' <$src/MANIFEST | grep '\.SH$'`
1482 else
1483         echo "(Looking for .SH files under the source directory.)"
1484         set x `(cd $src; find . -name "*.SH" -print)`
1485 fi
1486 shift
1487 case $# in
1488 0) set x `(cd $src; echo *.SH)`; shift;;
1489 esac
1490 if test ! -f $src/$1; then
1491         shift
1492 fi
1493 mkdir_p='
1494 name=$1;
1495 create="";
1496 while test $name; do
1497         if test ! -d "$name"; then
1498                 create="$name $create";
1499                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1500                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1501         else
1502                 name="";
1503         fi;
1504 done;
1505 for file in $create; do
1506         mkdir $file;
1507 done
1508 '
1509 for file in $*; do
1510         case "$src" in
1511         ".")
1512                 case "$file" in
1513                 */*)
1514                         dir=`expr X$file : 'X\(.*\)/'`
1515                         file=`expr X$file : 'X.*/\(.*\)'`
1516                         (cd $dir && . ./$file)
1517                         ;;
1518                 *)
1519                         . ./$file
1520                         ;;
1521                 esac
1522                 ;;
1523         *)
1524                 case "$file" in
1525                 */*)
1526                         dir=`expr X$file : 'X\(.*\)/'`
1527                         file=`expr X$file : 'X.*/\(.*\)'`
1528                         (set x $dir; shift; eval $mkdir_p)
1529                         sh <$src/$dir/$file
1530                         ;;
1531                 *)
1532                         sh <$src/$file
1533                         ;;
1534                 esac
1535                 ;;
1536         esac
1537 done
1538 if test -f $src/config_h.SH; then
1539         if test ! -f config.h; then
1540         : oops, they left it out of MANIFEST, probably, so do it anyway.
1541         . $src/config_h.SH
1542         fi
1543 fi
1544 EOS
1545
1546 : extract files and exit if asked to do so
1547 case "$extractsh" in
1548 true)
1549         case "$realsilent" in
1550         true) ;;
1551         *) exec 1>&4;;
1552         esac
1553         case "$config_sh" in
1554         '') config_sh='config.sh';;
1555         esac
1556         echo " "
1557         echo "Fetching answers from $config_sh..."
1558         cd ..
1559         . $config_sh
1560         test "$override" && . ./optdef.sh
1561         echo " "
1562         . UU/extract
1563         rm -rf UU
1564         echo "Done."
1565         exit 0
1566         ;;
1567 esac
1568
1569 : Eunice requires " " instead of "", can you believe it
1570 echo " "
1571 : Here we go...
1572 echo "Beginning of configuration questions for $package."
1573
1574 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1575
1576 : first determine how to suppress newline on echo command
1577 echo " "
1578 echo "Checking echo to see how to suppress newlines..."
1579 (echo "hi there\c" ; echo " ") >.echotmp
1580 if $contains c .echotmp >/dev/null 2>&1 ; then
1581         echo "...using -n."
1582         n='-n'
1583         c=''
1584 else
1585         cat <<'EOM'
1586 ...using \c
1587 EOM
1588         n=''
1589         c='\c'
1590 fi
1591 echo $n "The star should be here-->$c"
1592 echo '*'
1593 rm -f .echotmp
1594
1595 : Now test for existence of everything in MANIFEST
1596 echo " "
1597 if test -f $rsrc/MANIFEST; then
1598         echo "First let's make sure your kit is complete.  Checking..." >&4
1599         awk '$1 !~ /PACK[A-Z]+/ {print $1}' $rsrc/MANIFEST | split -50
1600         rm -f missing
1601         tmppwd=`pwd`
1602         for filelist in x??; do
1603                 (cd $rsrc; ls `cat $tmppwd/$filelist` >/dev/null 2>>$tmppwd/missing)
1604         done
1605         if test -s missing; then
1606                 cat missing >&4
1607                 cat >&4 <<'EOM'
1608
1609 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1610
1611 You have the option of continuing the configuration process, despite the
1612 distinct possibility that your kit is damaged, by typing 'y'es.  If you
1613 do, don't blame me if something goes wrong.  I advise you to type 'n'o
1614 and contact the author (perlbug@perl.org).
1615
1616 EOM
1617                 echo $n "Continue? [n] $c" >&4
1618                 read ans
1619                 case "$ans" in
1620                 y*)
1621                         echo "Continuing..." >&4
1622                         rm -f missing
1623                         ;;
1624                 *)
1625                         echo "ABORTING..." >&4
1626                         kill $$
1627                         ;;
1628                 esac
1629         else
1630                 echo "Looks good..."
1631         fi
1632 else
1633         echo "There is no MANIFEST file.  I hope your kit is complete !"
1634 fi
1635 rm -f missing x??
1636
1637 echo " "
1638 : Find the appropriate value for a newline for tr
1639 if test -n "$DJGPP"; then
1640        trnl='\012'
1641 fi
1642 if test X"$trnl" = X; then
1643         case "`echo foo|tr '\n' x 2>/dev/null`" in
1644         foox) trnl='\n' ;;
1645         esac
1646 fi
1647 if test X"$trnl" = X; then
1648         case "`echo foo|tr '\012' x 2>/dev/null`" in
1649         foox) trnl='\012' ;;
1650         esac
1651 fi
1652 if test X"$trnl" = X; then
1653         cat <<EOM >&2
1654
1655 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
1656
1657 EOM
1658         exit 1
1659 fi
1660
1661 : compute the number of columns on the terminal for proper question formatting
1662 case "$COLUMNS" in
1663 '') COLUMNS='80';;
1664 esac
1665
1666 : set up the echo used in my read
1667 myecho="case \"\$xxxm\" in
1668 '') echo $n \"\$rp $c\" >&4;;
1669 *) case \"\$rp\" in
1670         '') echo $n \"[\$xxxm] $c\";;
1671         *)
1672                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
1673                         echo \"\$rp\" >&4
1674                         echo $n \"[\$xxxm] $c\" >&4
1675                 else
1676                         echo $n \"\$rp [\$xxxm] $c\" >&4
1677                 fi
1678                 ;;
1679         esac;;
1680 esac"
1681
1682 : now set up to do reads with possible shell escape and default assignment
1683 cat <<EOSC >myread
1684 $startsh
1685 xxxm=\$dflt
1686 $myecho
1687 ans='!'
1688 case "\$fastread" in
1689 yes) case "\$dflt" in
1690         '') ;;
1691         *) ans='';
1692                 case "\$silent-\$rp" in
1693                 true-) ;;
1694                 *) echo " " >&4;;
1695                 esac;;
1696         esac;;
1697 *) case "\$silent" in
1698         true) case "\$rp" in
1699                 '') ans='';;
1700                 esac;;
1701         esac;;
1702 esac
1703 while expr "X\$ans" : "X!" >/dev/null; do
1704         read answ
1705         set x \$xxxm
1706         shift
1707         aok=''; eval "ans=\\"\$answ\\"" && aok=y
1708         case  "\$answ" in
1709         "!")
1710                 sh 1>&4
1711                 echo " "
1712                 $myecho
1713                 ;;
1714         !*)
1715                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
1716                 shift
1717                 sh 1>&4 -c "\$*"
1718                 echo " "
1719                 $myecho
1720                 ;;
1721         "\$ans")
1722                 case "\$ans" in
1723                 \\&*)
1724                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
1725                         shift
1726                         case "\$1" in
1727                         -d)
1728                                 fastread=yes
1729                                 echo "(OK, I'll run with -d after this question.)" >&4
1730                                 ;;
1731                         -*)
1732                                 echo "*** Sorry, \$1 not supported yet." >&4
1733                                 ;;
1734                         esac
1735                         $myecho
1736                         ans=!
1737                         ;;
1738                 esac;;
1739         *)
1740                 case "\$aok" in
1741                 y)
1742                         echo "*** Substitution done -- please confirm."
1743                         xxxm="\$ans"
1744                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
1745                         xxxm="\$ans"
1746                         ans=!
1747                         ;;
1748                 *)
1749                         echo "*** Error -- try again."
1750                         ans=!
1751                         ;;
1752                 esac
1753                 $myecho
1754                 ;;
1755         esac
1756         case "\$ans\$xxxm\$nostick" in
1757         '')
1758                 ans=!
1759                 $myecho
1760                 ;;
1761         esac
1762 done
1763 case "\$ans" in
1764 '') ans="\$xxxm";;
1765 esac
1766 EOSC
1767
1768 : create .config dir to save info across Configure sessions
1769 test -d ../.config || mkdir ../.config
1770 cat >../.config/README <<EOF
1771 This directory created by Configure to save information that should
1772 persist across sessions for $package.
1773
1774 You may safely delete it if you wish.
1775 EOF
1776
1777 xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
1778 case "$usedevel" in
1779 $define|true|[yY]*) ;;
1780 *) case "$xversion" in
1781    *[13579])
1782         cat >&4 <<EOH
1783 *** WHOA THERE!!! ***
1784
1785     This is an UNSTABLE DEVELOPMENT release.
1786     The version of this $package distribution is $xversion, that is, odd,
1787     (as opposed to even) and that signifies a development release.
1788     If you want a maintenance release, you want an even-numbered version.
1789
1790     Do ***NOT*** install this into production use.
1791     Data corruption and crashes are possible.
1792
1793     It is most seriously suggested that you do not continue any further
1794     unless you want to help in developing and debugging Perl.
1795
1796 EOH
1797         rp='Do you really want to continue?'
1798         dflt='n'
1799         . ./myread
1800         case "$ans" in
1801         [yY]) echo >&4 "Okay, continuing." ;;
1802         *) echo >&4 "Okay, bye."
1803            exit 1
1804            ;;
1805         esac
1806         ;;
1807     esac
1808     ;;
1809 esac
1810
1811 : general instructions
1812 needman=true
1813 firsttime=true
1814 user=`(logname) 2>/dev/null`
1815 case "$user" in
1816 '') user=`whoami 2>&1`;;
1817 esac
1818 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
1819         firsttime=false
1820         echo " "
1821         rp='Would you like to see the instructions?'
1822         dflt=n
1823         . ./myread
1824         case "$ans" in
1825         [yY]*) ;;
1826         *) needman=false;;
1827         esac
1828 fi
1829 if $needman; then
1830         cat <<EOH
1831
1832 This installation shell script will examine your system and ask you questions
1833 to determine how the perl5 package should be installed. If you get
1834 stuck on a question, you may use a ! shell escape to start a subshell or
1835 execute a command.  Many of the questions will have default answers in square
1836 brackets; typing carriage return will give you the default.
1837
1838 On some of the questions which ask for file or directory names you are allowed
1839 to use the ~name construct to specify the login directory belonging to "name",
1840 even if you don't have a shell which knows about that.  Questions where this is
1841 allowed will be marked "(~name ok)".
1842
1843 EOH
1844         rp=''
1845         dflt='Type carriage return to continue'
1846         . ./myread
1847         cat <<'EOH'
1848
1849 The prompter used in this script allows you to use shell variables and
1850 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
1851 in the default answer, as if the default line was a set of arguments given to a
1852 script shell.  This means you may also use $* to repeat the whole default line,
1853 so you do not have to re-type everything to add something to the default.
1854
1855 Everytime there is a substitution, you will have to confirm.  If there is an
1856 error (e.g. an unmatched backtick), the default answer will remain unchanged
1857 and you will be prompted again.
1858
1859 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
1860 the questions and use the computed defaults (or the previous answers if there
1861 was already a config.sh file). Type 'Configure -h' for a list of options.
1862 You may also start interactively and then answer '& -d' at any prompt to turn
1863 on the non-interactive behaviour for the remainder of the execution.
1864
1865 EOH
1866         . ./myread
1867         cat <<EOH
1868
1869 Much effort has been expended to ensure that this shell script will run on any
1870 Unix system.  If despite that it blows up on yours, your best bet is to edit
1871 Configure and run it again.  If you can't run Configure for some reason,
1872 you'll have to generate a config.sh file by hand.  Whatever problems you
1873 have, let me (perlbug@perl.org) know how I blew it.
1874
1875 This installation script affects things in two ways:
1876
1877 1) it may do direct variable substitutions on some of the files included
1878    in this kit.
1879 2) it builds a config.h file for inclusion in C programs.  You may edit
1880    any of these files as the need arises after running this script.
1881
1882 If you make a mistake on a question, there is no easy way to back up to it
1883 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
1884 files.  Configure will offer to let you do this before it runs the SH files.
1885
1886 EOH
1887         dflt='Type carriage return to continue'
1888         . ./myread
1889         case "$firsttime" in
1890         true) echo $user >>../.config/instruct;;
1891         esac
1892 fi
1893
1894 : find out where common programs are
1895 echo " "
1896 echo "Locating common programs..." >&4
1897 cat <<EOSC >loc
1898 $startsh
1899 case \$# in
1900 0) exit 1;;
1901 esac
1902 thing=\$1
1903 shift
1904 dflt=\$1
1905 shift
1906 for dir in \$*; do
1907         case "\$thing" in
1908         .)
1909         if test -d \$dir/\$thing; then
1910                 echo \$dir
1911                 exit 0
1912         fi
1913         ;;
1914         *)
1915         for thisthing in \$dir/\$thing; do
1916                 : just loop through to pick last item
1917         done
1918         if test -f \$thisthing; then
1919                 echo \$thisthing
1920                 exit 0
1921         elif test -f \$dir/\$thing.exe; then
1922                 if test -n "$DJGPP"; then
1923                         echo \$dir/\$thing.exe
1924                 else
1925                         : on Eunice apparently
1926                         echo \$dir/\$thing
1927                 fi
1928                 exit 0
1929         fi
1930         ;;
1931         esac
1932 done
1933 echo \$dflt
1934 exit 1
1935 EOSC
1936 chmod +x loc
1937 $eunicefix loc
1938 loclist="
1939 awk
1940 cat
1941 comm
1942 cp
1943 echo
1944 expr
1945 grep
1946 ls
1947 make
1948 mkdir
1949 rm
1950 sed
1951 sort
1952 touch
1953 tr
1954 uniq
1955 "
1956 trylist="
1957 Mcc
1958 ar
1959 byacc
1960 cpp
1961 csh
1962 date
1963 egrep
1964 gzip
1965 less
1966 ln
1967 more
1968 nm
1969 nroff
1970 pg
1971 test
1972 uname
1973 zip
1974 "
1975 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1976 pth="$pth /lib /usr/lib"
1977 for file in $loclist; do
1978         eval xxx=\$$file
1979         case "$xxx" in
1980         /*|?:[\\/]*)
1981                 if test -f "$xxx"; then
1982                         : ok
1983                 else
1984                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
1985                         xxx=`./loc $file $file $pth`
1986                 fi
1987                 ;;
1988         '') xxx=`./loc $file $file $pth`;;
1989         *) xxx=`./loc $xxx $xxx $pth`;;
1990         esac
1991         eval $file=$xxx
1992         eval _$file=$xxx
1993         case "$xxx" in
1994         /*)
1995                 echo $file is in $xxx.
1996                 ;;
1997         ?:[\\/]*)
1998                 echo $file is in $xxx.
1999                 ;;
2000         *)
2001                 echo "I don't know where '$file' is, and my life depends on it." >&4
2002                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2003                 exit 1
2004                 ;;
2005         esac
2006 done
2007 echo " "
2008 echo "Don't worry if any of the following aren't found..."
2009 say=offhand
2010 for file in $trylist; do
2011         eval xxx=\$$file
2012         case "$xxx" in
2013         /*|?:[\\/]*)
2014                 if test -f "$xxx"; then
2015                         : ok
2016                 else
2017                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2018                         xxx=`./loc $file $file $pth`
2019                 fi
2020                 ;;
2021         '') xxx=`./loc $file $file $pth`;;
2022         *) xxx=`./loc $xxx $xxx $pth`;;
2023         esac
2024         eval $file=$xxx
2025         eval _$file=$xxx
2026         case "$xxx" in
2027         /*)
2028                 echo $file is in $xxx.
2029                 ;;
2030         ?:[\\/]*)
2031                 echo $file is in $xxx.
2032                 ;;
2033         *)
2034                 echo "I don't see $file out there, $say."
2035                 say=either
2036                 ;;
2037         esac
2038 done
2039 case "$egrep" in
2040 egrep)
2041         echo "Substituting grep for egrep."
2042         egrep=$grep
2043         ;;
2044 esac
2045 case "$ln" in
2046 ln)
2047         echo "Substituting cp for ln."
2048         ln=$cp
2049         ;;
2050 esac
2051 case "$test" in
2052 test)
2053         echo "Hopefully test is built into your sh."
2054         ;;
2055 *)
2056         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2057                 echo "Using the test built into your sh."
2058                 test=test
2059                 _test=test
2060         fi
2061         ;;
2062 esac
2063 case "$echo" in
2064 echo)
2065         echo "Hopefully echo is built into your sh."
2066         ;;
2067 '') ;;
2068 *)
2069         echo " "
2070 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2071         $echo $n "hi there$c" >foo1
2072         echo $n "hi there$c" >foo2
2073         if cmp foo1 foo2 >/dev/null 2>&1; then
2074                 echo "They are compatible.  In fact, they may be identical."
2075         else
2076                 case "$n" in
2077                 '-n') n='' c='\c';;
2078                 *) n='-n' c='';;
2079                 esac
2080                 cat <<FOO
2081 They are not compatible!  You are probably running ksh on a non-USG system.
2082 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2083 have echo built in and we may have to run some Bourne shell scripts.  That
2084 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2085
2086 FOO
2087                 $echo $n "The star should be here-->$c"
2088                 $echo "*"
2089         fi
2090         $rm -f foo1 foo2
2091         ;;
2092 esac
2093
2094 cat <<EOS >checkcc
2095 $startsh
2096 EOS
2097 cat <<'EOSC' >>checkcc
2098 case "$cc" in
2099 '') ;;
2100 *)  $rm -f try try.*
2101     $cat >try.c <<EOM
2102 int main(int argc, char *argv[]) {
2103   return 0;
2104 }
2105 EOM
2106     if $cc -o try try.c; then
2107        :
2108     else
2109         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2110         despair=yes
2111         trygcc=yes
2112         case "$cc" in
2113         *gcc*) trygcc=no ;;
2114         esac
2115         case "`$cc -v -c try.c 2>&1`" in
2116         *gcc*) trygcc=no ;;
2117         esac
2118         if $test X"$trygcc" = Xyes; then
2119             if gcc -o try -c try.c; then
2120                 echo " "
2121                 echo "You seem to have a working gcc, though." >&4
2122                 rp="Would you like to use it?"
2123                 dflt=y
2124                 if $test -f myread; then
2125                     . ./myread
2126                 else
2127                     if $test -f UU/myread; then
2128                         . ./UU/myread
2129                     else
2130                         echo "Cannot find myread, sorry.  Aborting." >&2
2131                         exit 1
2132                     fi
2133                 fi  
2134                 case "$ans" in
2135                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no ;;
2136                 esac
2137             fi
2138         fi
2139         if $test X"$despair" = Xyes; then
2140             echo "You need to find a working C compiler." >&4
2141             echo "I cannot continue any further, aborting." >&4
2142             exit 1
2143         fi
2144     fi
2145     $rm -f try try.*
2146     ;;
2147 esac
2148 EOSC
2149
2150 : determine whether symbolic links are supported
2151 echo " "
2152 $touch blurfl
2153 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2154         echo "Symbolic links are supported." >&4
2155         lns="$ln -s"
2156 else
2157         echo "Symbolic links are NOT supported." >&4
2158         lns="$ln"
2159 fi
2160 $rm -f blurfl sym
2161
2162 : see whether [:lower:] and [:upper:] are supported character classes
2163 echo " "
2164 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2165 ABYZ)
2166         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2167         up='[:upper:]'
2168         low='[:lower:]'
2169         ;;
2170 *)      # There is a discontinuity in EBCDIC between 'I' and 'J'
2171         # (0xc9 and 0xd1), therefore that is a nice testing point.
2172         if test "X$up" = X -o "X$low" = X; then
2173             case "`echo IJ | $tr '[I-J]' '[i-j]' 2>/dev/null`" in
2174             ij) up='[A-Z]'
2175                 low='[a-z]'
2176                 ;;
2177             esac
2178         fi
2179         if test "X$up" = X -o "X$low" = X; then
2180             case "`echo IJ | $tr I-J i-j 2>/dev/null`" in
2181             ij) up='A-Z'
2182                 low='a-z'
2183                 ;;
2184             esac
2185         fi
2186         if test "X$up" = X -o "X$low" = X; then
2187             case "`echo IJ | od -x 2>/dev/null`" in
2188             *C9D1*|*c9d1*)
2189                 echo "Hey, this might be EBCDIC." >&4
2190                 if test "X$up" = X -o "X$low" = X; then
2191                     case "`echo IJ | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
2192                     ij) up='[A-IJ-RS-Z]'
2193                         low='[a-ij-rs-z]'
2194                         ;;
2195                     esac
2196                 fi
2197                 if test "X$up" = X -o "X$low" = X; then
2198                     case "`echo IJ | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
2199                     ij) up='A-IJ-RS-Z'
2200                         low='a-ij-rs-z'
2201                         ;;
2202                     esac
2203                 fi
2204                 ;;
2205             esac
2206         fi
2207 esac
2208 case "`echo IJ | $tr \"$up\" \"$low\" 2>/dev/null`" in
2209 ij)
2210     echo "Using $up and $low to convert case." >&4
2211     ;;
2212 *)
2213     echo "I don't know how to translate letters from upper to lower case." >&4
2214     echo "Your tr is not acting any way I know of." >&4
2215     exit 1
2216     ;;
2217 esac
2218 : set up the translation script tr, must be called with ./tr of course
2219 cat >tr <<EOSC
2220 $startsh
2221 case "\$1\$2" in
2222 '[A-Z][a-z]') exec $tr '$up' '$low';;
2223 '[a-z][A-Z]') exec $tr '$low' '$up';;
2224 esac
2225 exec $tr "\$@"
2226 EOSC
2227 chmod +x tr
2228 $eunicefix tr
2229
2230 : Try to determine whether config.sh was made on this system
2231 case "$config_sh" in
2232 '')
2233 myuname=`$uname -a 2>/dev/null`
2234 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
2235 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
2236 # because the A-Z/a-z are not consecutive.
2237 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
2238         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
2239 newmyuname="$myuname"
2240 dflt=n
2241 case "$knowitall" in
2242 '')
2243         if test -f ../config.sh; then
2244                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
2245                         eval "`grep myuname= ../config.sh`"
2246                 fi
2247                 if test "X$myuname" = "X$newmyuname"; then
2248                         dflt=y
2249                 fi
2250         fi
2251         ;;
2252 *) dflt=y;;
2253 esac
2254
2255 : Get old answers from old config file if Configure was run on the
2256 : same system, otherwise use the hints.
2257 hint=default
2258 cd ..
2259 if test -f config.sh; then
2260         echo " "
2261         rp="I see a config.sh file.  Shall I use it to set the defaults?"
2262         . UU/myread
2263         case "$ans" in
2264         n*|N*) echo "OK, I'll ignore it."; mv config.sh config.sh.old;;
2265         *)  echo "Fetching default answers from your old config.sh file..." >&4
2266                 tmp_n="$n"
2267                 tmp_c="$c"
2268                 tmp_sh="$sh"
2269                 . ./config.sh
2270                 cp config.sh UU
2271                 n="$tmp_n"
2272                 c="$tmp_c"
2273                 : Older versions did not always set $sh.  Catch re-use of such
2274                 : an old config.sh.
2275                 case "$sh" in
2276                 '') sh="$tmp_sh" ;;
2277                 esac
2278                 hint=previous
2279                 ;;
2280         esac
2281 fi
2282 . ./UU/checkcc
2283 if test ! -f config.sh; then
2284         $cat <<EOM
2285
2286 First time through, eh?  I have some defaults handy for some systems
2287 that need some extra help getting the Configure answers right:
2288
2289 EOM
2290         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
2291         dflt=''
2292         : Half the following guesses are probably wrong... If you have better
2293         : tests or hints, please send them to perlbug@perl.org
2294         : The metaconfig authors would also appreciate a copy...
2295         $test -f /irix && osname=irix
2296         $test -f /xenix && osname=sco_xenix
2297         $test -f /dynix && osname=dynix
2298         $test -f /dnix && osname=dnix
2299         $test -f /lynx.os && osname=lynxos
2300         $test -f /unicos && osname=unicos && osvers=`$uname -r`
2301         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
2302         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
2303         $test -f /bin/mips && /bin/mips && osname=mips
2304         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
2305                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
2306         $test -d /usr/apollo/bin && osname=apollo
2307         $test -f /etc/saf/_sactab && osname=svr4
2308         $test -d /usr/include/minix && osname=minix
2309         if $test -d /MachTen -o -d /MachTen_Folder; then
2310                 osname=machten
2311                 if $test -x /sbin/version; then
2312                         osvers=`/sbin/version | $awk '{print $2}' |
2313                         $sed -e 's/[A-Za-z]$//'`
2314                 elif $test -x /usr/etc/version; then
2315                         osvers=`/usr/etc/version | $awk '{print $2}' |
2316                         $sed -e 's/[A-Za-z]$//'`
2317                 else
2318                         osvers="$2.$3"
2319                 fi
2320         fi
2321
2322         $test -f /sys/posix.dll &&
2323                 $test -f /usr/bin/what &&
2324                 set X `/usr/bin/what /sys/posix.dll` &&
2325                 $test "$3" = UWIN &&
2326                 osname=uwin &&
2327                 osvers="$5"
2328
2329         if $test -f $uname; then
2330                 set X $myuname
2331                 shift
2332
2333                 case "$5" in
2334                 fps*) osname=fps ;;
2335                 mips*)
2336                         case "$4" in
2337                         umips) osname=umips ;;
2338                         *) osname=mips ;;
2339                         esac;;
2340                 [23]100) osname=mips ;;
2341                 next*) osname=next ;;
2342                 i386*)
2343                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
2344                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
2345                                 osname='sco'
2346                                 osvers=$tmp
2347                         elif $test -f /etc/kconfig; then
2348                                 osname=isc
2349                                 if test "$lns" = "$ln -s"; then
2350                                         osvers=4
2351                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
2352                                         osvers=3
2353                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
2354                                         osvers=2
2355                                 fi
2356                         fi
2357                         tmp=''
2358                         ;;
2359                 pc*)
2360                         if test -n "$DJGPP"; then
2361                                 osname=dos
2362                                 osvers=djgpp
2363                         fi
2364                         ;;
2365                 esac
2366
2367                 case "$1" in
2368                 aix) osname=aix
2369                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
2370                         case "$tmp" in
2371                         'not found') osvers="$4"."$3" ;;
2372                         '<3240'|'<>3240') osvers=3.2.0 ;;
2373                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
2374                         '=3250'|'>3250') osvers=3.2.5 ;;
2375                         *) osvers=$tmp;;
2376                         esac
2377                         ;;
2378                 bsd386) osname=bsd386
2379                         osvers=`$uname -r`
2380                         ;;
2381                 cygwin*) osname=cygwin
2382                         osvers="$3"
2383                         ;;
2384                 *dc.osx) osname=dcosx
2385                         osvers="$3"
2386                         ;;
2387                 dnix) osname=dnix
2388                         osvers="$3"
2389                         ;;
2390                 domainos) osname=apollo
2391                         osvers="$3"
2392                         ;;
2393                 dgux) osname=dgux 
2394                         osvers="$3"
2395                         ;;
2396                 dynixptx*) osname=dynixptx
2397                         osvers=`echo "$4"|sed 's/^v//'`
2398                         ;;
2399                 freebsd) osname=freebsd 
2400                         osvers="$3" ;;
2401                 genix) osname=genix ;;
2402                 hp*) osname=hpux 
2403                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
2404                         ;;
2405                 irix*) osname=irix
2406                         case "$3" in
2407                         4*) osvers=4 ;;
2408                         5*) osvers=5 ;;
2409                         *)      osvers="$3" ;;
2410                         esac
2411                         ;;
2412                 linux) osname=linux
2413                         case "$3" in
2414                         *)      osvers="$3" ;;
2415                         esac
2416                         ;;
2417                 MiNT) osname=mint
2418                         ;;
2419                 netbsd*) osname=netbsd
2420                         osvers="$3"
2421                         ;;
2422                 news-os) osvers="$3"
2423                         case "$3" in
2424                         4*) osname=newsos4 ;;
2425                         *) osname=newsos ;;
2426                         esac
2427                         ;;
2428                 next*) osname=next ;;
2429                 POSIX-BC | posix-bc ) osname=posix-bc
2430                         osvers="$3"
2431                         ;;
2432                 powerux | power_ux | powermax_os | powermaxos | \
2433                 powerunix | power_unix) osname=powerux
2434                         osvers="$3"
2435                         ;;
2436                 qnx) osname=qnx
2437                         osvers="$4"
2438                         ;;
2439                 solaris) osname=solaris
2440                         case "$3" in
2441                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
2442                         *)      osvers="$3" ;;
2443                         esac
2444                         ;;
2445                 sunos) osname=sunos
2446                         case "$3" in
2447                         5*) osname=solaris
2448                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
2449                         *)      osvers="$3" ;;
2450                         esac
2451                         ;;
2452                 titanos) osname=titanos
2453                         case "$3" in
2454                         1*) osvers=1 ;;
2455                         2*) osvers=2 ;;
2456                         3*) osvers=3 ;;
2457                         4*) osvers=4 ;;
2458                         *)      osvers="$3" ;;
2459                         esac
2460                         ;;
2461                 ultrix) osname=ultrix
2462                         osvers="$3"
2463                         ;;
2464                 osf1|mls+)      case "$5" in
2465                                 alpha)
2466                                         osname=dec_osf
2467                                         osvers=`sizer -v | awk '{print $3}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
2468                                         case "$osvers" in
2469                                         [1-9].[0-9]*) ;;
2470                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
2471                                         esac
2472                                         ;;
2473                         hp*)    osname=hp_osf1  ;;
2474                         mips)   osname=mips_osf1 ;;
2475                         esac
2476                         ;;
2477                 unixware) osname=svr5
2478                         osvers="$4"
2479                         ;;
2480                 uts) osname=uts
2481                         osvers="$3"
2482                         ;;
2483                 $2) case "$osname" in
2484                         *isc*) ;;
2485                         *freebsd*) ;;
2486                         svr*)
2487                                 : svr4.x or possibly later
2488                                 case "svr$3" in 
2489                                 ${osname}*)
2490                                         osname=svr$3
2491                                         osvers=$4
2492                                         ;;
2493                                 esac
2494                                 case "$osname" in
2495                                 svr4.0)
2496                                         : Check for ESIX
2497                                         if test -f /stand/boot ; then
2498                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
2499                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
2500                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
2501                                                         if test -n "$isesix"; then
2502                                                                 osname=esix4
2503                                                         fi
2504                                                 fi
2505                                         fi
2506                                         ;;
2507                                 esac
2508                                 ;;
2509                         *)      if test -f /etc/systemid; then
2510                                         osname=sco
2511                                         set `echo $3 | $sed 's/\./ /g'` $4
2512                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
2513                                                 osvers=$1.$2.$3
2514                                         elif $test -f $src/hints/sco_$1_$2.sh; then
2515                                                 osvers=$1.$2
2516                                         elif $test -f $src/hints/sco_$1.sh; then
2517                                                 osvers=$1
2518                                         fi
2519                                 else
2520                                         case "$osname" in
2521                                         '') : Still unknown.  Probably a generic Sys V.
2522                                                 osname="sysv"
2523                                                 osvers="$3"
2524                                                 ;;
2525                                         esac
2526                                 fi
2527                                 ;;
2528                         esac
2529                         ;;
2530                 *)      case "$osname" in
2531                         '') : Still unknown.  Probably a generic BSD.
2532                                 osname="$1"
2533                                 osvers="$3"
2534                                 ;;
2535                         esac
2536                         ;;
2537                 esac
2538         else
2539                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
2540                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
2541                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
2542                                 osname=news_os
2543                         fi
2544                         $rm -f UU/kernel.what
2545                 elif test -d c:/.; then
2546                         set X $myuname
2547                         osname=os2
2548                         osvers="$5"
2549                 fi
2550         fi
2551         
2552         : Now look for a hint file osname_osvers, unless one has been
2553         : specified already.
2554         case "$hintfile" in
2555         ''|' ')
2556                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
2557                 : Also try without trailing minor version numbers.
2558                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
2559                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
2560                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
2561                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
2562                 case "$file" in
2563                 '') dflt=none ;;
2564                 *)  case "$osvers" in
2565                         '') dflt=$file
2566                                 ;;
2567                         *)  if $test -f $src/hints/$file.sh ; then
2568                                         dflt=$file
2569                                 elif $test -f $src/hints/$xfile.sh ; then
2570                                         dflt=$xfile
2571                                 elif $test -f $src/hints/$xxfile.sh ; then
2572                                         dflt=$xxfile
2573                                 elif $test -f $src/hints/$xxxfile.sh ; then
2574                                         dflt=$xxxfile
2575                                 elif $test -f $src/hints/$xxxxfile.sh ; then
2576                                         dflt=$xxxxfile
2577                                 elif $test -f "$src/hints/${osname}.sh" ; then
2578                                         dflt="${osname}"
2579                                 else
2580                                         dflt=none
2581                                 fi
2582                                 ;;
2583                         esac
2584                         ;;
2585                 esac
2586                 if $test -f Policy.sh ; then
2587                         case "$dflt" in
2588                         *Policy*) ;;
2589                         none) dflt="Policy" ;;
2590                         *) dflt="Policy $dflt" ;;
2591                         esac
2592                 fi
2593                 ;;
2594         *)
2595                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
2596                 ;;
2597         esac
2598
2599         if $test -f Policy.sh ; then
2600                 $cat <<EOM
2601
2602 There's also a Policy hint file available, which should make the
2603 site-specific (policy) questions easier to answer.
2604 EOM
2605
2606         fi
2607
2608         $cat <<EOM
2609
2610 You may give one or more space-separated answers, or "none" if appropriate.
2611 A well-behaved OS will have no hints, so answering "none" or just "Policy"
2612 is a good thing.  DO NOT give a wrong version or a wrong OS.
2613
2614 EOM
2615
2616         rp="Which of these apply, if any?"
2617         . UU/myread
2618         tans=$ans
2619         for file in $tans; do
2620                 if $test X$file = XPolicy -a -f Policy.sh; then
2621                         . Policy.sh
2622                         $cat Policy.sh >> UU/config.sh
2623                 elif $test -f $src/hints/$file.sh; then
2624                         . $src/hints/$file.sh
2625                         $cat $src/hints/$file.sh >> UU/config.sh
2626                 elif $test X$tans = X -o X$tans = Xnone ; then
2627                         : nothing
2628                 else
2629                         : Give one chance to correct a possible typo.
2630                         echo "$file.sh does not exist"
2631                         dflt=$file
2632                         rp="hint to use instead?"
2633                         . UU/myread
2634                         for file in $ans; do
2635                                 if $test -f "$src/hints/$file.sh"; then
2636                                         . $src/hints/$file.sh
2637                                         $cat $src/hints/$file.sh >> UU/config.sh
2638                                 elif $test X$ans = X -o X$ans = Xnone ; then
2639                                         : nothing
2640                                 else
2641                                         echo "$file.sh does not exist -- ignored."
2642                                 fi
2643                         done
2644                 fi
2645         done
2646
2647         hint=recommended
2648         : Remember our hint file for later.
2649         if $test -f "$src/hints/$file.sh" ; then
2650                 hintfile="$file"
2651         else
2652                 hintfile=''
2653         fi
2654 fi
2655 cd UU
2656 ;;
2657 *)
2658         echo " "
2659         echo "Fetching default answers from $config_sh..." >&4
2660         tmp_n="$n"
2661         tmp_c="$c"
2662         cd ..
2663         cp $config_sh config.sh 2>/dev/null
2664         chmod +w config.sh
2665         . ./config.sh
2666         cd UU
2667         cp ../config.sh .
2668         n="$tmp_n"
2669         c="$tmp_c"
2670         hint=previous
2671         ;;
2672 esac
2673 test "$override" && . ./optdef.sh
2674 myuname="$newmyuname"
2675
2676 : Restore computed paths
2677 for file in $loclist $trylist; do
2678         eval $file="\$_$file"
2679 done
2680
2681 cat << EOM
2682
2683 Configure uses the operating system name and version to set some defaults.
2684 The default value is probably right if the name rings a bell. Otherwise,
2685 since spelling matters for me, either accept the default or answer "none"
2686 to leave it blank.
2687
2688 EOM
2689 case "$osname" in
2690         ''|' ')
2691                 case "$hintfile" in
2692                 ''|' '|none) dflt=none ;;
2693                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
2694                 esac
2695                 ;;
2696         *) dflt="$osname" ;;
2697 esac
2698 rp="Operating system name?"
2699 . ./myread
2700 case "$ans" in
2701 none)  osname='' ;;
2702 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
2703 esac
2704 echo " "
2705 case "$osvers" in
2706         ''|' ')
2707                 case "$hintfile" in
2708                 ''|' '|none) dflt=none ;;
2709                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
2710                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
2711                         case "$dflt" in
2712                         ''|' ') dflt=none ;;
2713                         esac
2714                         ;;
2715                 esac
2716                 ;;
2717         *) dflt="$osvers" ;;
2718 esac
2719 rp="Operating system version?"
2720 . ./myread
2721 case "$ans" in
2722 none)  osvers='' ;;
2723 *) osvers="$ans" ;;
2724 esac
2725
2726
2727 . ./posthint.sh
2728
2729 : who configured the system
2730 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
2731 cf_by=`(logname) 2>/dev/null`
2732 case "$cf_by" in
2733 "")
2734         cf_by=`(whoami) 2>/dev/null`
2735         case "$cf_by" in
2736         "") cf_by=unknown ;;
2737         esac ;;
2738 esac
2739
2740 : set up the script used to warn in case of inconsistency
2741 cat <<EOS >whoa
2742 $startsh
2743 EOS
2744 cat <<'EOSC' >>whoa
2745 dflt=y
2746 echo " "
2747 echo "*** WHOA THERE!!! ***" >&4
2748 echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
2749 rp="    Keep the $hint value?"
2750 . ./myread
2751 case "$ans" in
2752 y) td=$was; tu=$was;;
2753 esac
2754 EOSC
2755
2756 : function used to set $1 to $val
2757 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
2758 case "$val$was" in
2759 $define$undef) . ./whoa; eval "$var=\$td";;
2760 $undef$define) . ./whoa; eval "$var=\$tu";;
2761 *) eval "$var=$val";;
2762 esac'
2763
2764 case "$usethreads" in
2765 $define|true|[yY]*)     dflt='y';;
2766 *) dflt='n';;
2767 esac
2768 cat <<EOM
2769
2770 Perl can be built to take advantage of threads on some systems.
2771 To do so, Configure can be run with -Dusethreads.
2772
2773 Note that threading is a highly experimental feature, and
2774 some known race conditions still remain.  If you choose to try
2775 it, be very sure to not actually deploy it for production
2776 purposes.  README.threads has more details, and is required
2777 reading if you enable threads.
2778
2779 If this doesn't make any sense to you, just accept the default '$dflt'.
2780 EOM
2781 rp='Build a threading Perl?'
2782 . ./myread
2783 case "$ans" in
2784 y|Y)    val="$define" ;;
2785 *)      val="$undef" ;;
2786 esac
2787 set usethreads
2788 eval $setvar
2789
2790 case "$usethreads" in
2791 $define)
2792         $cat <<EOM
2793
2794 As of 5.5.640, Perl has two different internal threading implementations,
2795 the 5.005 version (5005threads) and an interpreter-based version
2796 (ithreads) that has one interpreter per thread.  Both are very 
2797 experimental.  This arrangement exists to help developers work out
2798 which one is better.
2799
2800 If you're a casual user, you probably don't want interpreter-threads
2801 at this time.  There doesn't yet exist a way to create threads from
2802 within Perl in this model, i.e., "use Thread;" will NOT work.
2803 EOM
2804         : Default to ithreads unless overridden on command line or with
2805         : old config.sh
2806         dflt='y'
2807         case "$use5005threads" in
2808                 $define|true|[yY]*) dflt='n';;
2809         esac
2810         case "$useithreads" in
2811                 $undef|false|[nN]*) dflt='n';;
2812         esac
2813         rp='Use interpreter-based ithreads?'
2814         . ./myread
2815         case "$ans" in
2816         y|Y)    val="$define" ;;
2817         *)      val="$undef" ;;
2818         esac
2819         set useithreads
2820         eval $setvar
2821         : Now set use5005threads to the opposite value.
2822         case "$useithreads" in
2823         $define) val="$undef" ;;
2824         *) val="$define" ;;
2825         esac
2826         set use5005threads
2827         eval $setvar
2828         ;;
2829 *)
2830         useithreads="$undef"
2831         use5005threads="$undef"
2832         ;;
2833 esac
2834
2835 case "$d_oldpthreads" in
2836 '')     : Configure tests would be welcome here.  For now, assume undef.
2837         val="$undef" ;;
2838 *)      val="$d_oldpthreads" ;;
2839 esac
2840 set d_oldpthreads
2841 eval $setvar
2842
2843
2844 case "$usethreads" in
2845 "$define"|true|[yY]*)
2846 : Look for a hint-file generated 'call-back-unit'.  If the
2847 : user has specified that a threading perl is to be built,
2848 : we may need to set or change some other defaults.
2849         if $test -f usethreads.cbu; then
2850                 echo "Your platform has some specific hints for threaded builds, using them..."
2851                 . ./usethreads.cbu
2852         else
2853                 $cat <<EOM
2854 (Your platform doesn't have any specific hints for threaded builds.
2855  Assuming POSIX threads, then.)
2856 EOM
2857         fi
2858         ;;
2859 esac
2860
2861 cat <<EOM
2862
2863 Perl can be built so that multiple Perl interpreters can coexist
2864 within the same Perl executable.
2865 EOM
2866
2867 case "$useithreads" in
2868 $define)
2869         cat <<EOM
2870 This multiple interpreter support is required for interpreter-based threads.
2871 EOM
2872         val="$define"
2873         ;;
2874 *)      case "$usemultiplicity" in
2875         $define|true|[yY]*)     dflt='y';;
2876         *) dflt='n';;
2877         esac
2878         echo " "
2879         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
2880         rp='Build Perl for multiplicity?'
2881         . ./myread
2882         case "$ans" in
2883         y|Y)    val="$define" ;;
2884         *)      val="$undef" ;;
2885         esac
2886         ;;
2887 esac
2888 set usemultiplicity
2889 eval $setvar
2890
2891 : determine where manual pages are on this system
2892 echo " "
2893 case "$sysman" in
2894 '') 
2895         syspath='/usr/man/man1 /usr/man/mann /usr/man/manl /usr/man/local/man1'
2896         syspath="$syspath /usr/man/u_man/man1 /usr/share/man/man1"
2897         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
2898         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
2899         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
2900         sysman=`./loc . /usr/man/man1 $syspath`
2901         ;;
2902 esac
2903 if $test -d "$sysman"; then
2904         echo "System manual is in $sysman." >&4
2905 else
2906         echo "Could not find manual pages in source form." >&4
2907 fi
2908
2909 : see what memory models we can support
2910 case "$models" in
2911 '')
2912         $cat >pdp11.c <<'EOP'
2913 int main() {
2914 #ifdef pdp11
2915         exit(0);
2916 #else
2917         exit(1);
2918 #endif
2919 }
2920 EOP
2921         case "$cc" in
2922         '') modelcc="$cc" ;;
2923         *) modelcc="cc" ;;
2924         esac
2925         ( $modelcc -o pdp11 pdp11.c ) >/dev/null 2>&1
2926         if $test -f pdp11 && ./pdp11 2>/dev/null; then
2927                 dflt='unsplit split'
2928         else
2929                 tans=`./loc . X /lib/small /lib/large /usr/lib/small /usr/lib/large /lib/medium /usr/lib/medium /lib/huge`
2930                 case "$tans" in
2931                 X) dflt='none';;
2932                 *) if $test -d /lib/small || $test -d /usr/lib/small; then
2933                                 dflt='small'
2934                         else
2935                                 dflt=''
2936                         fi
2937                         if $test -d /lib/medium || $test -d /usr/lib/medium; then
2938                                 dflt="$dflt medium"
2939                         fi
2940                         if $test -d /lib/large || $test -d /usr/lib/large; then
2941                                 dflt="$dflt large"
2942                         fi
2943                         if $test -d /lib/huge || $test -d /usr/lib/huge; then
2944                                 dflt="$dflt huge"
2945                         fi
2946                 esac
2947         fi;;
2948 *) dflt="$models";;
2949 esac
2950 $cat <<EOM
2951  
2952 Some systems have different model sizes.  On most systems they are called
2953 small, medium, large, and huge.  On the PDP11 they are called unsplit and
2954 split.  If your system doesn't support different memory models, say "none".
2955 If you wish to force everything to one memory model, say "none" here and
2956 put the appropriate flags later when it asks you for other cc and ld flags.
2957 Venix systems may wish to put "none" and let the compiler figure things out.
2958 (In the following question multiple model names should be space separated.)
2959
2960 The default for most systems is "none".
2961
2962 EOM
2963 rp="Which memory models are supported?"
2964 . ./myread
2965 models="$ans"
2966
2967 case "$models" in
2968 none)
2969         small=''
2970         medium=''
2971         large=''
2972         huge=''
2973         unsplit=''
2974         split=''
2975         ;;
2976 *split)
2977         case "$split" in
2978         '') if $contains '\-i' $sysman/ld.1 >/dev/null 2>&1 || \
2979                          $contains '\-i' $sysman/cc.1 >/dev/null 2>&1; then
2980                         dflt='-i'
2981                 else
2982                         dflt='none'
2983                 fi;;
2984         *) dflt="$split";;
2985         esac
2986         rp="What flag indicates separate I and D space?"
2987         . ./myread
2988         tans="$ans"
2989         case "$tans" in
2990         none) tans='';;
2991         esac
2992         split="$tans"
2993         unsplit='';;
2994 *large*|*small*|*medium*|*huge*)
2995         case "$models" in
2996         *large*)
2997                 case "$large" in
2998                 '') dflt='-Ml';;
2999                 *) dflt="$large";;
3000                 esac
3001         rp="What flag indicates large model?"
3002         . ./myread
3003         tans="$ans"
3004         case "$tans" in
3005         none) tans='';
3006         esac
3007         large="$tans";;
3008         *) large='';;
3009         esac
3010         case "$models" in
3011         *huge*) case "$huge" in
3012                 '') dflt='-Mh';;
3013                 *) dflt="$huge";;
3014                 esac
3015                 rp="What flag indicates huge model?"
3016                 . ./myread
3017                 tans="$ans"
3018                 case "$tans" in
3019                 none) tans='';
3020                 esac
3021                 huge="$tans";;
3022         *) huge="$large";;
3023         esac
3024         case "$models" in
3025         *medium*) case "$medium" in
3026                 '') dflt='-Mm';;
3027                 *) dflt="$medium";;
3028                 esac
3029                 rp="What flag indicates medium model?"
3030                 . ./myread
3031                 tans="$ans"
3032                 case "$tans" in
3033                 none) tans='';
3034                 esac
3035                 medium="$tans";;
3036         *) medium="$large";;
3037         esac
3038         case "$models" in
3039         *small*) case "$small" in
3040                 '') dflt='none';;
3041                 *) dflt="$small";;
3042                 esac
3043                 rp="What flag indicates small model?"
3044                 . ./myread
3045                 tans="$ans"
3046                 case "$tans" in
3047                 none) tans='';
3048                 esac
3049                 small="$tans";;
3050         *) small='';;
3051         esac
3052         ;;
3053 *)
3054         echo "Unrecognized memory models--you may have to edit Makefile.SH" >&4
3055         ;;
3056 esac
3057 $rm -f pdp11.* pdp11
3058
3059 : make some quick guesses about what we are up against
3060 echo " "
3061 $echo $n "Hmm...  $c"
3062 echo exit 1 >bsd
3063 echo exit 1 >usg
3064 echo exit 1 >v7
3065 echo exit 1 >osf1
3066 echo exit 1 >eunice
3067 echo exit 1 >xenix
3068 echo exit 1 >venix
3069 echo exit 1 >os2
3070 d_bsd="$undef"
3071 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
3072 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
3073 then
3074         echo "Looks kind of like an OSF/1 system, but we'll see..."
3075         echo exit 0 >osf1
3076 elif test `echo abc | tr a-z A-Z` = Abc ; then
3077         xxx=`./loc addbib blurfl $pth`
3078         if $test -f $xxx; then
3079         echo "Looks kind of like a USG system with BSD features, but we'll see..."
3080                 echo exit 0 >bsd
3081                 echo exit 0 >usg
3082         else
3083                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
3084                         echo "Looks kind of like an extended USG system, but we'll see..."
3085                 else
3086                         echo "Looks kind of like a USG system, but we'll see..."
3087                 fi
3088                 echo exit 0 >usg
3089         fi
3090 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
3091         echo "Looks kind of like a BSD system, but we'll see..."
3092         d_bsd="$define"
3093         echo exit 0 >bsd
3094 else
3095         echo "Looks kind of like a Version 7 system, but we'll see..."
3096         echo exit 0 >v7
3097 fi
3098 case "$eunicefix" in
3099 *unixtovms*)
3100         $cat <<'EOI'
3101 There is, however, a strange, musty smell in the air that reminds me of
3102 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
3103 EOI
3104         echo exit 0 >eunice
3105         d_eunice="$define"
3106 : it so happens the Eunice I know will not run shell scripts in Unix format
3107         ;;
3108 *)
3109         echo " "
3110         echo "Congratulations.  You aren't running Eunice."
3111         d_eunice="$undef"
3112         ;;
3113 esac
3114 : Detect OS2.  The p_ variable is set above in the Head.U unit.
3115 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
3116 : semicolon as a patch separator
3117 case "$p_" in
3118 :) ;;
3119 *)
3120         $cat <<'EOI'
3121 I have the feeling something is not exactly right, however...don't tell me...
3122 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
3123 (Or you may be running DOS with DJGPP.)
3124 EOI
3125         echo exit 0 >os2
3126         ;;
3127 esac
3128 if test -f /xenix; then
3129         echo "Actually, this looks more like a XENIX system..."
3130         echo exit 0 >xenix
3131         d_xenix="$define"
3132 else
3133         echo " "
3134         echo "It's not Xenix..."
3135         d_xenix="$undef"
3136 fi
3137 chmod +x xenix
3138 $eunicefix xenix
3139 if test -f /venix; then
3140         echo "Actually, this looks more like a VENIX system..."
3141         echo exit 0 >venix
3142 else
3143         echo " "
3144         if ./xenix; then
3145                 : null
3146         else
3147                 echo "Nor is it Venix..."
3148         fi
3149 fi
3150 chmod +x bsd usg v7 osf1 eunice xenix venix os2
3151 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
3152 $rm -f foo
3153
3154 : see if we need a special compiler
3155 echo " "
3156 if ./usg; then
3157         case "$cc" in
3158         '') case "$Mcc" in
3159                 /*) dflt='Mcc';;
3160                 *) case "$large" in
3161                         -M*) dflt='cc';;
3162                         *)      if $contains '\-M' $sysman/cc.1 >/dev/null 2>&1 ; then
3163                                         if $contains '\-M' $sysman/cpp.1 >/dev/null 2>&1; then
3164                                                 dflt='cc'
3165                                         else
3166                                                 dflt='cc -M'
3167                                         fi
3168                                 else
3169                                         dflt='cc'
3170                                 fi;;
3171                         esac;;
3172                 esac;;
3173         *)  dflt="$cc";;
3174         esac
3175         case "$dflt" in
3176         *M*)    $cat <<'EOM'
3177 On some older systems the default C compiler will not resolve multiple global
3178 references that happen to have the same name.  On some such systems the "Mcc"
3179 command may be used to force these to be resolved.  On other systems a "cc -M"
3180 command is required.  (Note that the -M flag on other systems indicates a
3181 memory model to use!) If you have the Gnu C compiler, you might wish to use
3182 that instead.
3183
3184 EOM
3185         ;;
3186         esac
3187         rp="Use which C compiler?"
3188         . ./myread
3189         cc="$ans"
3190 else
3191         case "$cc" in
3192         '') dflt=cc;;
3193         *) dflt="$cc";;
3194         esac
3195         rp="Use which C compiler?"
3196         . ./myread
3197         cc="$ans"
3198 fi
3199 : Look for a hint-file generated 'call-back-unit'.  Now that the
3200 : user has specified the compiler, we may need to set or change some
3201 : other defaults.
3202 if $test -f cc.cbu; then
3203     . ./cc.cbu
3204 fi
3205 . ./checkcc
3206
3207 echo " "
3208 echo "Checking for GNU cc in disguise and/or its version number..." >&4
3209 $cat >gccvers.c <<EOM
3210 #include <stdio.h>
3211 int main() {
3212 #ifdef __GNUC__
3213 #ifdef __VERSION__
3214         printf("%s\n", __VERSION__);
3215 #else
3216         printf("%s\n", "1");
3217 #endif
3218 #endif
3219         exit(0);
3220 }
3221 EOM
3222 if $cc $ldflags -o gccvers gccvers.c; then
3223         gccversion=`./gccvers`
3224         case "$gccversion" in
3225         '') echo "You are not using GNU cc." ;;
3226         *)  echo "You are using GNU cc $gccversion."
3227             ccname=gcc  
3228             ;;
3229         esac
3230 else
3231         echo " "
3232         echo "*** WHOA THERE!!! ***" >&4
3233         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
3234         case "$knowitall" in
3235         '')
3236         echo "    You'd better start hunting for one and let me know about it." >&4
3237                 exit 1
3238                 ;;
3239         esac
3240 fi
3241 $rm -f gccvers*
3242 case "$gccversion" in
3243 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
3244 esac
3245 case "$gccversion" in
3246 '') gccosandvers='' ;;
3247 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
3248    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
3249    gccshortvers=''
3250    case "$gccosandvers" in
3251    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
3252    $osname$osvers) ;; # looking good
3253    $osname*) cat <<EOM >&4
3254
3255 *** WHOA THERE!!! ***
3256
3257     Your gcc has not been compiled for the exact release of
3258     your operating system ($gccosandvers versus $osname$osvers).
3259
3260     In general it is a good idea to keep gcc synchronized with
3261     the operating system because otherwise serious problems
3262     may ensue when trying to compile software, like Perl.
3263
3264     I'm trying to be optimistic here, though, and will continue.
3265     If later during the configuration and build icky compilation
3266     problems appear (headerfile conflicts being the most common
3267     manifestation), I suggest reinstalling the gcc to match
3268     your operating system release.
3269
3270 EOM
3271       ;;
3272    *) gccosandvers='' ;; # failed to parse, better be silent
3273    esac
3274    ;;
3275 esac
3276 case "$ccname" in
3277 '') ccname="$cc" ;;
3278 esac
3279
3280 : see how we invoke the C preprocessor
3281 echo " "
3282 echo "Now, how can we feed standard input to your C preprocessor..." >&4
3283 cat <<'EOT' >testcpp.c
3284 #define ABC abc
3285 #define XYZ xyz
3286 ABC.XYZ
3287 EOT
3288 cd ..
3289 if test ! -f cppstdin; then
3290         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
3291                 # AIX cc -E doesn't show the absolute headerfile
3292                 # locations but we'll cheat by using the -M flag.
3293                 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
3294         else
3295                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
3296         fi
3297 else
3298         echo "Keeping your $hint cppstdin wrapper."
3299 fi
3300 chmod 755 cppstdin
3301 wrapper=`pwd`/cppstdin
3302 ok='false'
3303 cd UU
3304
3305 if $test "X$cppstdin" != "X" && \
3306         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
3307         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3308 then
3309         echo "You used to use $cppstdin $cppminus so we'll use that again."
3310         case "$cpprun" in
3311         '') echo "But let's see if we can live without a wrapper..." ;;
3312         *)
3313                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
3314                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3315                 then
3316                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
3317                         ok='true'
3318                 else
3319                         echo "(However, $cpprun $cpplast does not work, let's see...)"
3320                 fi
3321                 ;;
3322         esac
3323 else
3324         case "$cppstdin" in
3325         '') ;;
3326         *)
3327                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
3328                 ;;
3329         esac
3330 fi
3331
3332 if $ok; then
3333         : nothing
3334 elif echo 'Maybe "'"$cc"' -E" will work...'; \
3335         $cc -E <testcpp.c >testcpp.out 2>&1; \
3336         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3337         echo "Yup, it does."
3338         x_cpp="$cc -E"
3339         x_minus='';
3340 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
3341         $cc -E - <testcpp.c >testcpp.out 2>&1; \
3342         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3343         echo "Yup, it does."
3344         x_cpp="$cc -E"
3345         x_minus='-';
3346 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
3347         $cc -P <testcpp.c >testcpp.out 2>&1; \
3348         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3349         echo "Yipee, that works!"
3350         x_cpp="$cc -P"
3351         x_minus='';
3352 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
3353         $cc -P - <testcpp.c >testcpp.out 2>&1; \
3354         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3355         echo "At long last!"
3356         x_cpp="$cc -P"
3357         x_minus='-';
3358 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
3359         $cpp <testcpp.c >testcpp.out 2>&1; \
3360         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3361         echo "It works!"
3362         x_cpp="$cpp"
3363         x_minus='';
3364 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
3365         $cpp - <testcpp.c >testcpp.out 2>&1; \
3366         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3367         echo "Hooray, it works!  I was beginning to wonder."
3368         x_cpp="$cpp"
3369         x_minus='-';
3370 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
3371         $wrapper <testcpp.c >testcpp.out 2>&1; \
3372         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3373         x_cpp="$wrapper"
3374         x_minus=''
3375         echo "Eureka!"
3376 else
3377         dflt=''
3378         rp="No dice.  I can't find a C preprocessor.  Name one:"
3379         . ./myread
3380         x_cpp="$ans"
3381         x_minus=''
3382         $x_cpp <testcpp.c >testcpp.out 2>&1
3383         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3384                 echo "OK, that will do." >&4
3385         else
3386 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
3387                 exit 1
3388         fi
3389 fi
3390
3391 case "$ok" in
3392 false)
3393         cppstdin="$x_cpp"
3394         cppminus="$x_minus"
3395         cpprun="$x_cpp"
3396         cpplast="$x_minus"
3397         set X $x_cpp
3398         shift
3399         case "$1" in
3400         "$cpp")
3401                 echo "Perhaps can we force $cc -E using a wrapper..."
3402                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
3403                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3404                 then
3405                         echo "Yup, we can."
3406                         cppstdin="$wrapper"
3407                         cppminus='';
3408                 else
3409                         echo "Nope, we'll have to live without it..."
3410                 fi
3411                 ;;
3412         esac
3413         case "$cpprun" in
3414         "$wrapper")
3415                 cpprun=''
3416                 cpplast=''
3417                 ;;
3418         esac
3419         ;;
3420 esac
3421
3422 case "$cppstdin" in
3423 "$wrapper"|'cppstdin') ;;
3424 *) $rm -f $wrapper;;
3425 esac
3426 $rm -f testcpp.c testcpp.out
3427
3428 : decide how portable to be.  Allow command line overrides.
3429 case "$d_portable" in
3430 "$undef") ;;
3431 *)      d_portable="$define" ;;
3432 esac
3433
3434 : set up shell script to do ~ expansion
3435 cat >filexp <<EOSS
3436 $startsh
3437 : expand filename
3438 case "\$1" in
3439  ~/*|~)
3440         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3441         ;;
3442  ~*)
3443         if $test -f /bin/csh; then
3444                 /bin/csh -f -c "glob \$1"
3445                 failed=\$?
3446                 echo ""
3447                 exit \$failed
3448         else
3449                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3450                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3451                 if $test ! -d "\$dir"; then
3452                         me=\`basename \$0\`
3453                         echo "\$me: can't locate home directory for: \$name" >&2
3454                         exit 1
3455                 fi
3456                 case "\$1" in
3457                 */*)
3458                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3459                         ;;
3460                 *)
3461                         echo \$dir
3462                         ;;
3463                 esac
3464         fi
3465         ;;
3466 *)
3467         echo \$1
3468         ;;
3469 esac
3470 EOSS
3471 chmod +x filexp
3472 $eunicefix filexp
3473
3474 : now set up to get a file name
3475 cat <<EOS >getfile
3476 $startsh
3477 EOS
3478 cat <<'EOSC' >>getfile
3479 tilde=''
3480 fullpath=''
3481 already=''
3482 skip=''
3483 none_ok=''
3484 exp_file=''
3485 nopath_ok=''
3486 orig_rp="$rp"
3487 orig_dflt="$dflt"
3488 case "$gfpth" in
3489 '') gfpth='.' ;;
3490 esac
3491
3492 case "$fn" in
3493 *\(*)
3494         expr $fn : '.*(\(.*\)).*' | tr ',' $trnl >getfile.ok
3495         fn=`echo $fn | sed 's/(.*)//'`
3496         ;;
3497 esac
3498
3499 case "$fn" in
3500 *:*)
3501         loc_file=`expr $fn : '.*:\(.*\)'`
3502         fn=`expr $fn : '\(.*\):.*'`
3503         ;;
3504 esac
3505
3506 case "$fn" in
3507 *~*) tilde=true;;
3508 esac
3509 case "$fn" in
3510 */*) fullpath=true;;
3511 esac
3512 case "$fn" in
3513 *+*) skip=true;;
3514 esac
3515 case "$fn" in
3516 *n*) none_ok=true;;
3517 esac
3518 case "$fn" in
3519 *e*) exp_file=true;;
3520 esac
3521 case "$fn" in
3522 *p*) nopath_ok=true;;
3523 esac
3524
3525 case "$fn" in
3526 *f*) type='File';;
3527 *d*) type='Directory';;
3528 *l*) type='Locate';;
3529 esac
3530
3531 what="$type"
3532 case "$what" in
3533 Locate) what='File';;
3534 esac
3535
3536 case "$exp_file" in
3537 '')
3538         case "$d_portable" in
3539         "$define") ;;
3540         *) exp_file=true;;
3541         esac
3542         ;;
3543 esac
3544
3545 cd ..
3546 while test "$type"; do
3547         redo=''
3548         rp="$orig_rp"
3549         dflt="$orig_dflt"
3550         case "$tilde" in
3551         true) rp="$rp (~name ok)";;
3552         esac
3553         . UU/myread
3554         if test -f UU/getfile.ok && \
3555                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3556         then
3557                 value="$ans"
3558                 ansexp="$ans"
3559                 break
3560         fi
3561         case "$ans" in
3562         none)
3563                 value=''
3564                 ansexp=''
3565                 case "$none_ok" in
3566                 true) type='';;
3567                 esac
3568                 ;;
3569         *)
3570                 case "$tilde" in
3571                 '') value="$ans"
3572                         ansexp="$ans";;
3573                 *)
3574                         value=`UU/filexp $ans`
3575                         case $? in
3576                         0)
3577                                 if test "$ans" != "$value"; then
3578                                         echo "(That expands to $value on this system.)"
3579                                 fi
3580                                 ;;
3581                         *) value="$ans";;
3582                         esac
3583                         ansexp="$value"
3584                         case "$exp_file" in
3585                         '') value="$ans";;
3586                         esac
3587                         ;;
3588                 esac
3589                 case "$fullpath" in
3590                 true)
3591                         case "$ansexp" in
3592                         /*) value="$ansexp" ;;
3593                         [a-zA-Z]:/*) value="$ansexp" ;;
3594                         *)
3595                                 redo=true
3596                                 case "$already" in
3597                                 true)
3598                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
3599                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
3600                                         ;;
3601                                 *)
3602                                 echo "Please give a full path name, starting with slash." >&4
3603                                         case "$tilde" in
3604                                         true)
3605                                 echo "Note that using ~name is ok provided it expands well." >&4
3606                                                 already=true
3607                                                 ;;
3608                                         esac
3609                                 esac
3610                                 ;;
3611                         esac
3612                         ;;
3613                 esac
3614                 case "$redo" in
3615                 '')
3616                         case "$type" in
3617                         File)
3618                                 for fp in $gfpth; do
3619                                         if test "X$fp" = X.; then
3620                                             pf="$ansexp"
3621                                         else    
3622                                             pf="$fp/$ansexp"
3623                                         fi
3624                                         if test -f "$pf"; then
3625                                                 type=''
3626                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3627                                         then
3628                                                 echo "($value is not a plain file, but that's ok.)"
3629                                                 type=''
3630                                         fi
3631                                         if test X"$type" = X; then
3632                                             value="$pf"
3633                                             break
3634                                         fi
3635                                 done
3636                                 ;;
3637                         Directory)
3638                                 for fp in $gfpth; do
3639                                         if test "X$fp" = X.; then
3640                                             dir="$ans"
3641                                             direxp="$ansexp"
3642                                         else    
3643                                             dir="$fp/$ansexp"
3644                                             direxp="$fp/$ansexp"
3645                                         fi
3646                                         if test -d "$direxp"; then
3647                                                 type=''
3648                                                 value="$dir"
3649                                                 break
3650                                         fi
3651                                 done
3652                                 ;;
3653                         Locate)
3654                                 if test -d "$ansexp"; then
3655                                         echo "(Looking for $loc_file in directory $value.)"
3656                                         value="$value/$loc_file"
3657                                         ansexp="$ansexp/$loc_file"
3658                                 fi
3659                                 if test -f "$ansexp"; then
3660                                         type=''
3661                                 fi
3662                                 case "$nopath_ok" in
3663                                 true)   case "$value" in
3664                                         */*) ;;
3665                                         *)      echo "Assuming $value will be in people's path."
3666                                                 type=''
3667                                                 ;;
3668                                         esac
3669                                         ;;
3670                                 esac
3671                                 ;;
3672                         esac
3673
3674                         case "$skip" in
3675                         true) type='';
3676                         esac
3677
3678                         case "$type" in
3679                         '') ;;
3680                         *)
3681                                 if test "$fastread" = yes; then
3682                                         dflt=y
3683                                 else
3684                                         dflt=n
3685                                 fi
3686                                 rp="$what $value doesn't exist.  Use that name anyway?"
3687                                 . UU/myread
3688                                 dflt=''
3689                                 case "$ans" in
3690                                 y*) type='';;
3691                                 *) echo " ";;
3692                                 esac
3693                                 ;;
3694                         esac
3695                         ;;
3696                 esac
3697                 ;;
3698         esac
3699 done
3700 cd UU
3701 ans="$value"
3702 rp="$orig_rp"
3703 dflt="$orig_dflt"
3704 rm -f getfile.ok
3705 test "X$gfpthkeep" != Xy && gfpth=""
3706 EOSC
3707
3708 : What should the include directory be ?
3709 echo " "
3710 $echo $n "Hmm...  $c"
3711 dflt='/usr/include'
3712 incpath=''
3713 mips_type=''
3714 if $test -f /bin/mips && /bin/mips; then
3715         echo "Looks like a MIPS system..."
3716         $cat >usr.c <<'EOCP'
3717 #ifdef SYSTYPE_BSD43
3718 /bsd43
3719 #endif
3720 EOCP
3721         if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
3722                 dflt='/bsd43/usr/include'
3723                 incpath='/bsd43'
3724                 mips_type='BSD 4.3'
3725         else
3726                 mips_type='System V'
3727         fi
3728         $rm -f usr.c usr.out
3729         echo "and you're compiling with the $mips_type compiler and libraries."
3730         xxx_prompt=y
3731         echo "exit 0" >mips
3732 else
3733         echo "Doesn't look like a MIPS system."
3734         xxx_prompt=n
3735         echo "exit 1" >mips
3736 fi
3737 chmod +x mips
3738 $eunicefix mips
3739 case "$usrinc" in
3740 '') ;;
3741 *) dflt="$usrinc";;
3742 esac
3743 case "$xxx_prompt" in
3744 y)      fn=d/
3745         echo " "
3746         rp='Where are the include files you want to use?'
3747         . ./getfile
3748         usrinc="$ans"
3749         ;;
3750 *)      usrinc="$dflt"
3751         ;;
3752 esac
3753
3754 : Set private lib path
3755 case "$plibpth" in
3756 '') if ./mips; then
3757                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
3758         fi;;
3759 esac
3760 case "$libpth" in
3761 ' ') dlist='';;
3762 '') dlist="$loclibpth $plibpth $glibpth";;
3763 *) dlist="$libpth";;
3764 esac
3765
3766 : Now check and see which directories actually exist, avoiding duplicates
3767 libpth=''
3768 for xxx in $dlist
3769 do
3770     if $test -d $xxx; then
3771                 case " $libpth " in
3772                 *" $xxx "*) ;;
3773                 *) libpth="$libpth $xxx";;
3774                 esac
3775     fi
3776 done
3777 $cat <<'EOM'
3778
3779 Some systems have incompatible or broken versions of libraries.  Among
3780 the directories listed in the question below, please remove any you
3781 know not to be holding relevant libraries, and add any that are needed.
3782 Say "none" for none.
3783
3784 EOM
3785 case "$libpth" in
3786 '') dflt='none';;
3787 *)
3788         set X $libpth
3789         shift
3790         dflt=${1+"$@"}
3791         ;;
3792 esac
3793 rp="Directories to use for library searches?"
3794 . ./myread
3795 case "$ans" in
3796 none) libpth=' ';;
3797 *) libpth="$ans";;
3798 esac
3799
3800 : compute shared library extension
3801 case "$so" in
3802 '')
3803         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
3804                 dflt='sl'
3805         else
3806                 dflt='so'
3807         fi
3808         ;;
3809 *) dflt="$so";;
3810 esac
3811 $cat <<EOM
3812
3813 On some systems, shared libraries may be available.  Answer 'none' if
3814 you want to suppress searching of shared libraries for the remainder
3815 of this configuration.
3816
3817 EOM
3818 rp='What is the file extension used for shared libraries?'
3819 . ./myread
3820 so="$ans"
3821
3822 : Define several unixisms.
3823 : Hints files or command line option can be used to override them.
3824 : The convoluted testing is in case hints files set either the old
3825 : or the new name.
3826 case "$_exe" in
3827 '')     case "$exe_ext" in
3828     '') ;;
3829         *)      _exe="$exe_ext" ;;
3830         esac
3831         ;;
3832 esac
3833 case "$_a" in
3834 '')     case "$lib_ext" in
3835     '') _a='.a';;
3836         *)      _a="$lib_ext" ;;
3837         esac
3838         ;;
3839 esac
3840 case "$_o" in
3841 '') case "$obj_ext" in
3842         '')     _o='.o';;
3843         *)      _o="$obj_ext";;
3844         esac
3845         ;;
3846 esac
3847 case "$p_" in
3848 '') case "$path_sep" in
3849         '')     p_=':';;
3850         *)      p_="$path_sep";;
3851         esac
3852         ;;
3853 esac
3854 exe_ext=$_exe
3855 lib_ext=$_a
3856 obj_ext=$_o
3857 path_sep=$p_
3858
3859 : Which makefile gets called first.  This is used by make depend.
3860 case "$firstmakefile" in
3861 '') firstmakefile='makefile';;
3862 esac
3863
3864 case "$usesocks" in
3865 $define|true|[yY]*)     dflt='y';;
3866 *) dflt='n';;
3867 esac
3868 cat <<EOM
3869
3870 Perl can be built to use the SOCKS proxy protocol library.  To do so,
3871 Configure must be run with -Dusesocks.
3872
3873 If this doesn't make any sense to you, just accept the default '$dflt'.
3874 EOM
3875 rp='Build Perl for SOCKS?'
3876 . ./myread
3877 case "$ans" in
3878 y|Y)    val="$define" ;;     
3879 *)      val="$undef" ;;
3880 esac
3881 set usesocks
3882 eval $setvar
3883
3884 : Looking for optional libraries
3885 echo " "
3886 echo "Checking for optional libraries..." >&4
3887 case "$libs" in
3888 ' '|'') dflt='';;
3889 *) dflt="$libs";;
3890 esac
3891 case "$libswanted" in
3892 '') libswanted='c_s';;
3893 esac
3894 case "$usesocks" in
3895 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
3896 esac
3897 libsfound=''
3898 libsfiles=''
3899 libsdirs=''
3900 libspath=''
3901 for thisdir in $libpth $xlibpth; do
3902   test -d $thisdir && libspath="$libspath $thisdir"
3903 done
3904 for thislib in $libswanted; do
3905         for thisdir in $libspath; do
3906             xxx=''
3907             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
3908                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|tail -1`
3909                 $test -f "$xxx" && eval $libscheck
3910                 $test -f "$xxx" && libstyle=shared
3911             fi
3912             if test ! -f "$xxx"; then
3913                 xxx=$thisdir/lib$thislib.$so
3914                 $test -f "$xxx" && eval $libscheck
3915                 $test -f "$xxx" && libstyle=shared
3916             fi  
3917             if test ! -f "$xxx"; then
3918                 xxx=$thisdir/lib$thislib$_a
3919                 $test -f "$xxx" && eval $libscheck
3920                 $test -f "$xxx" && libstyle=static
3921             fi
3922             if test ! -f "$xxx"; then
3923                 xxx=$thisdir/$thislib$_a
3924                 $test -f "$xxx" && eval $libscheck
3925                 $test -f "$xxx" && libstyle=static
3926             fi
3927             if test ! -f "$xxx"; then
3928                 xxx=$thisdir/lib${thislib}_s$_a
3929                 $test -f "$xxx" && eval $libscheck
3930                 $test -f "$xxx" && libstyle=static
3931                 $test -f "$xxx" && thislib=${thislib}_s
3932             fi
3933             if test ! -f "$xxx"; then
3934                 xxx=$thisdir/Slib$thislib$_a
3935                 $test -f "$xxx" && eval $libscheck
3936                 $test -f "$xxx" && libstyle=static
3937             fi
3938             if $test -f "$xxx"; then
3939                 case "$libstyle" in
3940                 shared) echo "Found -l$thislib (shared)." ;;
3941                 static) echo "Found -l$thislib." ;;
3942                 *)      echo "Found -l$thislib ($libstyle)." ;;
3943                 esac
3944                 case " $dflt " in
3945                 *"-l$thislib "*);;
3946                 *) dflt="$dflt -l$thislib"
3947                    libsfound="$libsfound $xxx"
3948                    yyy=`basename $xxx`
3949                    libsfiles="$libsfiles $yyy"
3950                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
3951                    case " $libsdirs " in
3952                    *" $yyy "*) ;;
3953                    *) libsdirs="$libsdirs $yyy" ;;
3954                    esac
3955                    ;;
3956                 esac
3957                 break
3958             fi  
3959         done
3960         if $test ! -f "$xxx"; then
3961             echo "No -l$thislib."
3962         fi
3963 done
3964 set X $dflt
3965 shift
3966 dflt="$*"
3967 case "$libs" in
3968 '') dflt="$dflt";;
3969 *) dflt="$libs";;
3970 esac
3971 case "$dflt" in
3972 ' '|'') dflt='none';;
3973 esac
3974
3975 $cat <<EOM
3976
3977 In order to compile $package on your machine, a number of libraries
3978 are usually needed.  Include any other special libraries here as well.
3979 Say "none" for none.  The default list is almost always right.
3980 EOM
3981
3982 echo " "
3983 rp="What libraries to use?"
3984 . ./myread
3985 case "$ans" in
3986 none) libs=' ';;
3987 *) libs="$ans";;
3988 esac
3989
3990 : determine optimization, if desired, or use for debug flag also
3991 case "$optimize" in
3992 ' '|$undef) dflt='none';;
3993 '') dflt='-O';;
3994 *) dflt="$optimize";;
3995 esac
3996 $cat <<EOH
3997
3998 By default, $package compiles with the -O flag to use the optimizer.
3999 Alternately, you might want to use the symbolic debugger, which uses
4000 the -g flag (on traditional Unix systems).  Either flag can be
4001 specified here.  To use neither flag, specify the word "none".
4002
4003 EOH
4004 rp="What optimizer/debugger flag should be used?"
4005 . ./myread
4006 optimize="$ans"
4007 case "$optimize" in
4008 'none') optimize=" ";;
4009 esac
4010
4011 dflt=''
4012 : We will not override a previous value, but we might want to
4013 : augment a hint file
4014 case "$hint" in
4015 default|recommended)
4016         case "$gccversion" in
4017         1*) dflt='-fpcc-struct-return' ;;
4018         esac
4019         case "$optimize" in
4020         *-g*) dflt="$dflt -DDEBUGGING";;
4021         esac
4022         case "$gccversion" in
4023         2*) if test -d /etc/conf/kconfig.d &&
4024                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
4025                 then
4026                         dflt="$dflt -posix"
4027                 fi
4028                 ;;
4029         esac
4030         case "$gccversion" in
4031         1*) ;;
4032         2.[0-8]*) ;;
4033         ?*)     echo " "
4034                 echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
4035                 echo 'int main(void) { return 0; }' > gcctest.c
4036                 if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
4037                         echo "Yes, it does." 2>&1
4038                         case "$ccflags" in
4039                         *strict-aliasing*) 
4040                                 echo "Leaving current flags $ccflags alone." 2>&1
4041                                 ;;
4042                         *) dflt="$dflt -fno-strict-aliasing" ;;
4043                         esac
4044                 else
4045                         echo "Nope, it doesn't, but that's ok." 2>&1
4046                 fi
4047                 ;;
4048         esac
4049         ;;
4050 esac
4051
4052 case "$mips_type" in
4053 *BSD*|'') inclwanted="$locincpth $usrinc";;
4054 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
4055 esac
4056 for thisincl in $inclwanted; do
4057         if $test -d $thisincl; then
4058                 if $test x$thisincl != x$usrinc; then
4059                         case "$dflt" in
4060                         *" -I$thisincl "*);;
4061                         *) dflt="$dflt -I$thisincl ";;
4062                         esac
4063                 fi
4064         fi
4065 done
4066
4067 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
4068         xxx=true;
4069 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
4070         xxx=true;
4071 else
4072         xxx=false;
4073 fi;
4074 if $xxx; then
4075         case "$dflt" in
4076         *$2*);;
4077         *) dflt="$dflt -D$2";;
4078         esac;
4079 fi'
4080
4081 set signal.h LANGUAGE_C; eval $inctest
4082
4083 case "$usesocks" in
4084 $define)
4085         ccflags="$ccflags -DSOCKS"
4086         ;;
4087 esac
4088
4089 case "$hint" in
4090 default|recommended) dflt="$ccflags $dflt" ;;
4091 *) dflt="$ccflags";;
4092 esac
4093
4094 case "$dflt" in
4095 ''|' ') dflt=none;;
4096 esac
4097
4098 $cat <<EOH
4099
4100 Your C compiler may want other flags.  For this question you should include
4101 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
4102 but you should NOT include libraries or ld flags like -lwhatever.  If you
4103 want $package to honor its debug switch, you should include -DDEBUGGING here.
4104 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
4105
4106 To use no flags, specify the word "none".
4107
4108 EOH
4109 set X $dflt
4110 shift
4111 dflt=${1+"$@"}
4112 rp="Any additional cc flags?"
4113 . ./myread
4114 case "$ans" in
4115 none) ccflags='';;
4116 *) ccflags="$ans";;
4117 esac
4118
4119 : the following weeds options from ccflags that are of no interest to cpp
4120 cppflags="$ccflags"
4121 case "$gccversion" in
4122 1*) cppflags="$cppflags -D__GNUC__"
4123 esac
4124 case "$mips_type" in
4125 '');;
4126 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
4127 esac
4128 case "$cppflags" in
4129 '');;
4130 *)
4131         echo " "
4132         echo "Let me guess what the preprocessor flags are..." >&4
4133         set X $cppflags
4134         shift
4135         cppflags=''
4136         $cat >cpp.c <<'EOM'
4137 #define BLURFL foo
4138
4139 BLURFL xx LFRULB
4140 EOM
4141         previous=''
4142         for flag in $*
4143         do
4144                 case "$flag" in
4145                 -*) ftry="$flag";;
4146                 *) ftry="$previous $flag";;
4147                 esac
4148                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
4149                         >cpp1.out 2>/dev/null && \
4150                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
4151                         >cpp2.out 2>/dev/null && \
4152                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
4153                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
4154                 then
4155                         cppflags="$cppflags $ftry"
4156                         previous=''
4157                 else
4158                         previous="$flag"
4159                 fi
4160         done
4161         set X $cppflags
4162         shift
4163         cppflags=${1+"$@"}
4164         case "$cppflags" in
4165         *-*)  echo "They appear to be: $cppflags";;
4166         esac
4167         $rm -f cpp.c cpp?.out
4168         ;;
4169 esac
4170
4171 : flags used in final linking phase
4172 case "$ldflags" in
4173 '') if ./venix; then
4174                 dflt='-i -z'
4175         else
4176                 dflt=''
4177         fi
4178         case "$ccflags" in
4179         *-posix*) dflt="$dflt -posix" ;;
4180         esac
4181         ;;
4182 *) dflt="$ldflags";;
4183 esac
4184
4185 : Try to guess additional flags to pick up local libraries.
4186 for thislibdir in $libpth; do
4187         case " $loclibpth " in
4188         *" $thislibdir "*)
4189                 case "$dflt " in 
4190                 *"-L$thislibdir "*) ;;
4191                 *)  dflt="$dflt -L$thislibdir" ;;
4192                 esac
4193                 ;;
4194         esac
4195 done
4196
4197 case "$dflt" in
4198 '') dflt='none' ;;
4199 esac
4200
4201 $cat <<EOH
4202
4203 Your C linker may need flags.  For this question you should
4204 include -L/whatever and any other flags used by the C linker, but you
4205 should NOT include libraries like -lwhatever.
4206
4207 Make sure you include the appropriate -L/path flags if your C linker
4208 does not normally search all of the directories you specified above,
4209 namely
4210         $libpth
4211 To use no flags, specify the word "none".
4212
4213 EOH
4214
4215 rp="Any additional ld flags (NOT including libraries)?"
4216 . ./myread
4217 case "$ans" in
4218 none) ldflags='';;
4219 *) ldflags="$ans";;
4220 esac
4221 rmlist="$rmlist pdp11"
4222
4223 : coherency check
4224 echo " "
4225 echo "Checking your choice of C compiler and flags for coherency..." >&4
4226 $cat > try.c <<'EOF'
4227 #include <stdio.h>
4228 int main() { printf("Ok\n"); exit(0); }
4229 EOF
4230 set X $cc $optimize $ccflags -o try $ldflags try.c $libs
4231 shift
4232 $cat >try.msg <<'EOM'
4233 I've tried to compile and run the following simple program:
4234
4235 EOM
4236 $cat try.c >> try.msg
4237
4238 $cat >> try.msg <<EOM
4239
4240 I used the command:
4241
4242         $*
4243         ./try
4244
4245 and I got the following output:
4246
4247 EOM
4248 dflt=y
4249 if sh -c "$cc $optimize $ccflags -o try $ldflags try.c $libs" >>try.msg 2>&1; then
4250         if sh -c './try' >>try.msg 2>&1; then
4251                 xxx=`./try`
4252                 case "$xxx" in
4253                 "Ok") dflt=n ;;
4254                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
4255                         case " $libs " in
4256                         *" -lsfio "*)
4257                                 cat >> try.msg <<'EOQS'
4258 If $libs contains -lsfio, and sfio is mis-configured, then it
4259 sometimes (apparently) runs and exits with a 0 status, but with no
4260 output!  It may have to do with sfio's use of _exit vs. exit.
4261
4262 EOQS
4263                                 rp="You have a big problem.  Shall I abort Configure"
4264                                 dflt=y
4265                                 ;;
4266                         esac
4267                         ;;
4268                 esac
4269         else
4270                 echo "The program compiled OK, but exited with status $?." >>try.msg
4271                 rp="You have a problem.  Shall I abort Configure"
4272                 dflt=y
4273         fi
4274 else
4275         echo "I can't compile the test program." >>try.msg
4276         rp="You have a BIG problem.  Shall I abort Configure"
4277         dflt=y
4278 fi
4279 case "$dflt" in
4280 y)
4281         $cat try.msg >&4
4282         case "$knowitall" in
4283         '')
4284                 echo "(The supplied flags or libraries might be incorrect.)"
4285                 ;;
4286         *) dflt=n;;
4287         esac
4288         echo " "
4289         . ./myread
4290         case "$ans" in
4291         n*|N*) ;;
4292         *)      echo "Ok.  Stopping Configure." >&4
4293                 exit 1
4294                 ;;
4295         esac
4296         ;;
4297 n) echo "OK, that should do.";;
4298 esac
4299 $rm -f try try.* core
4300
4301 : define an is-a-typedef? function
4302 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
4303 case "$inclist" in
4304 "") inclist="sys/types.h";;
4305 esac;
4306 eval "varval=\$$var";
4307 case "$varval" in
4308 "")
4309         $rm -f temp.c;
4310         for inc in $inclist; do
4311                 echo "#include <$inc>" >>temp.c;
4312         done;
4313         echo "#ifdef $type" >> temp.c;
4314         echo "printf(\"We have $type\");" >> temp.c;
4315         echo "#endif" >> temp.c;
4316         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
4317         if $contains $type temp.E >/dev/null 2>&1; then
4318                 eval "$var=\$type";
4319         else
4320                 eval "$var=\$def";
4321         fi;
4322         $rm -f temp.?;;
4323 *) eval "$var=\$varval";;
4324 esac'
4325
4326 : define an is-a-typedef? function that prompts if the type is not available.
4327 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
4328 case "$inclist" in
4329 "") inclist="sys/types.h";;
4330 esac;
4331 eval "varval=\$$var";
4332 case "$varval" in
4333 "")
4334         $rm -f temp.c;
4335         for inc in $inclist; do
4336                 echo "#include <$inc>" >>temp.c;
4337         done;
4338         echo "#ifdef $type" >> temp.c;
4339         echo "printf(\"We have $type\");" >> temp.c;
4340         echo "#endif" >> temp.c;
4341         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
4342         echo " " ;
4343         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
4344         if $contains $type temp.E >/dev/null 2>&1; then
4345                 echo "$type found." >&4;
4346                 eval "$var=\$type";
4347         else
4348                 echo "$type NOT found." >&4;
4349                 dflt="$def";
4350                 . ./myread ;
4351                 eval "$var=\$ans";
4352         fi;
4353         $rm -f temp.?;;
4354 *) eval "$var=\$varval";;
4355 esac'
4356
4357 : define a shorthand compile call
4358 compile='
4359 mc_file=$1;
4360 shift;
4361 $cc $optimize $ccflags $ldflags -o ${mc_file} $* ${mc_file}.c $libs > /dev/null 2>&1;'
4362 : define a shorthand compile call for compilations that should be ok.
4363 compile_ok='
4364 mc_file=$1;
4365 shift;
4366 $cc $optimize $ccflags $ldflags -o ${mc_file} $* ${mc_file}.c $libs;'
4367
4368 : check for lengths of integral types
4369 echo " "
4370 case "$intsize" in
4371 '')
4372         echo "Checking to see how big your integers are..." >&4
4373         $cat >intsize.c <<'EOCP'
4374 #include <stdio.h>
4375 int main()
4376 {
4377         printf("intsize=%d;\n", (int)sizeof(int));
4378         printf("longsize=%d;\n", (int)sizeof(long));
4379         printf("shortsize=%d;\n", (int)sizeof(short));
4380         exit(0);
4381 }
4382 EOCP
4383         set intsize
4384         if eval $compile_ok && ./intsize > /dev/null; then
4385                 eval `./intsize`
4386                 echo "Your integers are $intsize bytes long."
4387                 echo "Your long integers are $longsize bytes long."
4388                 echo "Your short integers are $shortsize bytes long."
4389         else
4390                 $cat >&4 <<EOM
4391 !
4392 Help! I can't compile and run the intsize test program: please enlighten me!
4393 (This is probably a misconfiguration in your system or libraries, and
4394 you really ought to fix it.  Still, I'll try anyway.)
4395 !
4396 EOM
4397                 dflt=4
4398                 rp="What is the size of an integer (in bytes)?"
4399                 . ./myread
4400                 intsize="$ans"
4401                 dflt=$intsize
4402                 rp="What is the size of a long integer (in bytes)?"
4403                 . ./myread
4404                 longsize="$ans"
4405                 dflt=2
4406                 rp="What is the size of a short integer (in bytes)?"
4407                 . ./myread
4408                 shortsize="$ans"
4409         fi
4410         ;;
4411 esac
4412 $rm -f intsize intsize.*
4413
4414 : see what type lseek is declared as in the kernel
4415 rp="What is the type used for lseek's offset on this system?"
4416 set off_t lseektype long stdio.h sys/types.h
4417 eval $typedef_ask
4418
4419 echo " "
4420 echo "Checking to see how big your file offsets are..." >&4
4421 $cat >try.c <<EOCP
4422 #include <sys/types.h>
4423 #include <stdio.h>
4424 int main()
4425 {
4426     printf("%d\n", (int)sizeof($lseektype));
4427     return(0); 
4428 }
4429 EOCP
4430 set try
4431 if eval $compile_ok; then
4432         lseeksize=`./try`
4433         echo "Your file offsets are $lseeksize bytes long."
4434 else
4435         dflt=$longsize
4436         echo " "
4437         echo "(I can't seem to compile the test program.  Guessing...)"
4438         rp="What is the size of your file offsets (in bytes)?"
4439         . ./myread
4440         lseeksize="$ans"
4441 fi
4442 $rm -f try.c try
4443
4444 : see what type file positions are declared as in the library
4445 rp="What is the type for file position used by fsetpos()?"
4446 set fpos_t fpostype long stdio.h sys/types.h
4447 eval $typedef_ask
4448
4449 echo " "
4450 case "$fpostype" in
4451 *_t) zzz="$fpostype"    ;;
4452 *)   zzz="fpos_t"       ;;
4453 esac
4454 echo "Checking the size of $zzz..." >&4 
4455 cat > try.c <<EOCP
4456 #include <sys/types.h>
4457 #include <stdio.h>
4458 int main() {
4459     printf("%d\n", (int)sizeof($fpostype));
4460     exit(0);
4461 }
4462 EOCP
4463 set try
4464 if eval $compile_ok; then
4465         yyy=`./try`
4466         case "$yyy" in
4467         '')     fpossize=4
4468                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
4469                 ;;
4470         *)      fpossize=$yyy
4471                 echo "Your $zzz is $fpossize bytes long."
4472                 ;;
4473         esac
4474 else
4475         dflt="$longsize"
4476         echo " " >&4
4477         echo "(I can't compile the test program.  Guessing...)" >&4
4478         rp="What is the size of your file positions (in bytes)?"
4479         . ./myread
4480         fpossize="$ans"
4481 fi
4482
4483
4484
4485 # Backward compatibility (uselfs is deprecated).
4486 case "$uselfs" in
4487 "$define"|true|[yY]*)
4488         cat <<EOM >&4
4489
4490 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
4491 EOM
4492         uselargefiles="$define"
4493         ;;
4494 esac                          
4495
4496 case "$lseeksize:$fpossize" in
4497 8:8) cat <<EOM
4498
4499 You can have files larger than 2 gigabytes.
4500 EOM
4501    val="$define" ;;
4502 *)    case "$uselargefiles" in
4503    "$undef"|false|[nN]*) dflt='n' ;;
4504    *)   dflt='y' ;;
4505    esac
4506    cat <<EOM
4507
4508 Perl can be built to understand large files (files larger than 2 gigabytes)
4509 on some systems.  To do so, Configure can be run with -Duselargefiles.
4510
4511 If this doesn't make any sense to you, just accept the default '$dflt'.
4512 EOM
4513    rp='Try to understand large files, if available?'
4514    . ./myread
4515    case "$ans" in
4516    y|Y)         val="$define" ;;
4517    *)           val="$undef"  ;;
4518    esac
4519    ;;
4520 esac
4521 set uselargefiles
4522 eval $setvar
4523 case "$uselargefiles" in
4524 "$define")
4525 : Look for a hint-file generated 'call-back-unit'.  If the
4526 : user has specified that a large files perl is to be built,
4527 : we may need to set or change some other defaults.
4528         if $test -f uselargefiles.cbu; then
4529                 echo "Your platform has some specific hints for large file builds, using them..."
4530                 . ./uselargefiles.cbu
4531                 echo " "
4532                 echo "Rechecking to see how big your file offsets are..." >&4
4533                 $cat >try.c <<EOCP
4534 #include <sys/types.h>
4535 #include <stdio.h>
4536 int main()
4537 {
4538     printf("%d\n", (int)sizeof($lseektype));
4539     return(0); 
4540 }
4541 EOCP
4542                 set try
4543                 if eval $compile_ok; then
4544                         lseeksize=`./try`
4545                         $echo "Your file offsets are now $lseeksize bytes long."
4546                 else
4547                         dflt="$lseeksize"
4548                         echo " "
4549                         echo "(I can't seem to compile the test program.  Guessing...)"
4550                         rp="What is the size of your file offsets (in bytes)?"
4551                         . ./myread
4552                         lseeksize="$ans"
4553                 fi
4554                 case "$fpostype" in
4555                 *_t) zzz="$fpostype"    ;;
4556                 *)   zzz="fpos_t"       ;;
4557                 esac
4558                 $echo $n "Rechecking the size of $zzz...$c" >&4 
4559                 $cat > try.c <<EOCP
4560 #include <sys/types.h>
4561 #include <stdio.h>
4562 int main() {
4563     printf("%d\n", (int)sizeof($fpostype));
4564     exit(0);
4565 }
4566 EOCP
4567                 set try
4568                 if eval $compile_ok; then
4569                         yyy=`./try`
4570                         dflt="$lseeksize"
4571                         case "$yyy" in
4572                         '')     echo " "
4573                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
4574                                 ;;
4575                         *)      fpossize=$yyy
4576                                 echo " $fpossize bytes." >&4
4577                                 ;;
4578                         esac
4579                 else
4580                         dflt="$fpossize"
4581                         echo " "
4582                         echo "(I can't compile the test program.  Guessing...)" >&4
4583                         rp="What is the size of your file positions (in bytes)?"
4584                         . ./myread
4585                         fpossize="$ans"
4586                 fi
4587                 $rm -f try.c try
4588         fi
4589         ;;
4590 esac
4591
4592
4593 case "$usemorebits" in
4594 "$define"|true|[yY]*)
4595         use64bitint="$define"
4596         uselongdouble="$define"
4597         usemorebits="$define"
4598         ;;
4599 *)      usemorebits="$undef"
4600         ;;
4601 esac
4602
4603
4604 case "$uselonglong" in
4605 "$define"|true|[yY]*)
4606         cat <<EOM >&4
4607
4608 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
4609 EOM
4610         use64bitint="$define"
4611         ;;
4612 esac                          
4613 case "$use64bits" in
4614 "$define"|true|[yY]*)
4615         cat <<EOM >&4
4616
4617 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
4618 EOM
4619         use64bitint="$define"
4620         ;;
4621 esac                          
4622 case "$use64bitints" in
4623 "$define"|true|[yY]*)
4624         cat <<EOM >&4
4625
4626 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
4627 EOM
4628         use64bitint="$define"
4629         ;;
4630 esac                          
4631 case "$use64bitsint" in
4632 "$define"|true|[yY]*)
4633         cat <<EOM >&4
4634
4635 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
4636 EOM
4637         use64bitint="$define"
4638         ;;
4639 esac                          
4640 case "$uselonglongs" in
4641 "$define"|true|[yY]*)
4642         cat <<EOM >&4
4643
4644 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
4645 EOM
4646         use64bitint="$define"
4647         ;;
4648 esac                          
4649 case "$use64bitsall" in
4650 "$define"|true|[yY]*)
4651         cat <<EOM >&4
4652
4653 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
4654 EOM
4655         use64bitall="$define"
4656         ;;
4657 esac                          
4658
4659 case "$ccflags" in
4660 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
4661 esac
4662 case "$use64bitall" in
4663 "$define"|true|[yY]*) use64bitint="$define" ;;
4664 esac
4665
4666 case "$longsize" in
4667 8) cat <<EOM
4668
4669 You have natively 64-bit long integers.
4670 EOM
4671    val="$define"
4672    ;;
4673 *) case "$use64bitint" in
4674    "$define"|true|[yY]*) dflt='y';;
4675    *) dflt='n';;
4676    esac
4677    cat <<EOM
4678
4679 Perl can be built to take advantage of 64-bit integer types
4680 on some systems.  To do so, Configure can be run with -Duse64bitint.
4681 Choosing this option will most probably introduce binary incompatibilities.
4682
4683 If this doesn't make any sense to you, just accept the default '$dflt'.
4684 EOM
4685    rp='Try to use 64-bit integers, if available?'
4686    . ./myread
4687    case "$ans" in
4688    [yY]*) val="$define" ;;
4689    *)     val="$undef"  ;;
4690    esac
4691    ;;
4692 esac
4693 set use64bitint
4694 eval $setvar
4695
4696 case "$use64bitall" in
4697 "$define"|true|[yY]*) dflt='y' ;;
4698 *) case "$longsize" in
4699    8) dflt='y' ;;
4700    *) dflt='n' ;;
4701    esac
4702    ;;
4703 esac    
4704 cat <<EOM
4705
4706 You may also choose to try maximal 64-bitness.  It means using as much
4707 64-bitness as possible on the platform.  This in turn means even more
4708 binary incompatibilities.  On the other hand, your platform may not
4709 have any more 64-bitness available than what you already have chosen.
4710
4711 If this doesn't make any sense to you, just accept the default '$dflt'.
4712 EOM
4713 rp='Try to use maximal 64-bit support, if available?'
4714 . ./myread
4715 case "$ans" in
4716 [yY]*) val="$define" ;;
4717 *)     val="$undef"  ;;
4718 esac
4719 set use64bitall
4720 eval $setvar
4721 case "$use64bitall" in
4722 "$define")
4723         case "$use64bitint" in
4724         "$undef")
4725                 cat <<EOM
4726
4727 Since you have chosen a maximally 64-bit build, I'm also turning on
4728 the use of 64-bit integers.
4729 EOM
4730                 use64bitint="$define" ;;
4731         esac
4732         ;;
4733 esac
4734
4735 case "$use64bitint" in
4736 "$define"|true|[yY]*)
4737 : Look for a hint-file generated 'call-back-unit'.  If the
4738 : user has specified that a 64-bit perl is to be built,
4739 : we may need to set or change some other defaults.
4740         if $test -f use64bitint.cbu; then
4741                 echo "Your platform has some specific hints for 64-bit integers, using them..."
4742                 . ./use64bitint.cbu
4743         fi
4744         case "$longsize" in
4745         4) case "$archname64" in
4746            '') archname64=64int ;;
4747            esac
4748            ;;
4749         esac
4750         ;;
4751 esac
4752
4753 case "$use64bitall" in
4754 "$define"|true|[yY]*)
4755 : Look for a hint-file generated 'call-back-unit'.  If the
4756 : user has specified that a maximally 64-bit perl is to be built,
4757 : we may need to set or change some other defaults.
4758         if $test -f use64bitall.cbu; then
4759                 echo "Your platform has some specific hints for 64-bit builds, using them..."
4760                 . ./use64bitall.cbu
4761         fi
4762         case "$longsize" in
4763         4) case "$archname64" in
4764            ''|64int) archname64=64all ;;
4765            esac
4766            ;;
4767         esac
4768         ;;
4769 esac
4770
4771 echo " "
4772 echo "Checking for GNU C Library..." >&4
4773 cat >gnulibc.c <<EOM
4774 #include <stdio.h>
4775 int main()
4776 {
4777 #ifdef __GLIBC__
4778     exit(0);
4779 #else
4780     exit(1);
4781 #endif
4782 }
4783 EOM
4784 set gnulibc
4785 if eval $compile_ok && ./gnulibc; then
4786         val="$define"
4787         echo "You are using the GNU C Library"
4788 else
4789         val="$undef"
4790         echo "You are not using the GNU C Library"
4791 fi
4792 $rm -f gnulibc*
4793 set d_gnulibc
4794 eval $setvar
4795
4796 : see if nm is to be used to determine whether a symbol is defined or not
4797 case "$usenm" in
4798 '')
4799         dflt=''
4800         case "$d_gnulibc" in
4801         "$define")
4802                 echo " "
4803                 echo "nm probably won't work on the GNU C Library." >&4
4804                 dflt=n
4805                 ;;
4806         esac
4807         case "$dflt" in
4808         '') 
4809                 if $test "$osname" = aix -a ! -f /lib/syscalls.exp; then
4810                         echo " "
4811                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
4812                         echo "'nm' won't be sufficient on this sytem." >&4
4813                         dflt=n
4814                 fi
4815                 ;;
4816         esac
4817         case "$dflt" in
4818         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
4819                 if $test $dflt -gt 20; then
4820                         dflt=y
4821                 else
4822                         dflt=n
4823                 fi
4824                 ;;
4825         esac
4826         ;;
4827 *)
4828         case "$usenm" in
4829         true|$define) dflt=y;;
4830         *) dflt=n;;
4831         esac
4832         ;;
4833 esac
4834 $cat <<EOM
4835
4836 I can use $nm to extract the symbols from your C libraries. This
4837 is a time consuming task which may generate huge output on the disk (up
4838 to 3 megabytes) but that should make the symbols extraction faster. The
4839 alternative is to skip the 'nm' extraction part and to compile a small
4840 test program instead to determine whether each symbol is present. If
4841 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
4842 this may be the best solution.
4843
4844 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
4845
4846 EOM
4847 rp="Shall I use $nm to extract C symbols from the libraries?"
4848 . ./myread
4849 case "$ans" in
4850 [Nn]*) usenm=false;;
4851 *) usenm=true;;
4852 esac
4853
4854 runnm=$usenm
4855 case "$reuseval" in
4856 true) runnm=false;;
4857 esac
4858
4859 : nm options which may be necessary
4860 case "$nm_opt" in
4861 '') if $test -f /mach_boot; then
4862                 nm_opt=''       # Mach
4863         elif $test -d /usr/ccs/lib; then
4864                 nm_opt='-p'     # Solaris (and SunOS?)
4865         elif $test -f /dgux; then
4866                 nm_opt='-p'     # DG-UX
4867         elif $test -f /lib64/rld; then
4868                 nm_opt='-p'     # 64-bit Irix
4869         else
4870                 nm_opt=''
4871         fi;;
4872 esac
4873
4874 : nm options which may be necessary for shared libraries but illegal
4875 : for archive libraries.  Thank you, Linux.
4876 case "$nm_so_opt" in
4877 '')     case "$myuname" in
4878         *linux*)
4879                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
4880                         nm_so_opt='--dynamic'
4881                 fi
4882                 ;;
4883         esac
4884         ;;
4885 esac
4886
4887 case "$runnm" in
4888 true)
4889 : get list of predefined functions in a handy place
4890 echo " "
4891 case "$libc" in
4892 '') libc=unknown
4893         case "$libs" in
4894         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
4895         esac
4896         ;;
4897 esac
4898 libnames='';
4899 case "$libs" in
4900 '') ;;
4901 *)  for thislib in $libs; do
4902         case "$thislib" in
4903         -lc|-lc_s)
4904                 : Handle C library specially below.
4905                 ;;
4906         -l*)
4907                 thislib=`echo $thislib | $sed -e 's/^-l//'`
4908                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
4909                         :
4910                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
4911                         :
4912                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
4913                         :
4914                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
4915                         :
4916                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
4917                         :
4918                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
4919                         :
4920                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
4921                         :
4922                 else
4923                         try=''
4924                 fi
4925                 libnames="$libnames $try"
4926                 ;;
4927         *) libnames="$libnames $thislib" ;;
4928         esac
4929         done
4930         ;;
4931 esac
4932 xxx=normal
4933 case "$libc" in
4934 unknown)
4935         set /lib/libc.$so
4936         for xxx in $libpth; do
4937                 $test -r $1 || set $xxx/libc.$so
4938                 : The messy sed command sorts on library version numbers.
4939                 $test -r $1 || \
4940                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
4941                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
4942                                 h
4943                                 s/[0-9][0-9]*/0000&/g
4944                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
4945                                 G
4946                                 s/\n/ /' | \
4947                          sort | $sed -e 's/^.* //'`
4948                 eval set \$$#
4949         done
4950         $test -r $1 || set /usr/ccs/lib/libc.$so
4951         $test -r $1 || set /lib/libsys_s$_a
4952         ;;
4953 *)
4954         set blurfl
4955         ;;
4956 esac
4957 if $test -r "$1"; then
4958         echo "Your (shared) C library seems to be in $1."
4959         libc="$1"
4960 elif $test -r /lib/libc && $test -r /lib/clib; then
4961         echo "Your C library seems to be in both /lib/clib and /lib/libc."
4962         xxx=apollo
4963         libc='/lib/clib /lib/libc'
4964         if $test -r /lib/syslib; then
4965                 echo "(Your math library is in /lib/syslib.)"
4966                 libc="$libc /lib/syslib"
4967         fi
4968 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
4969         echo "Your C library seems to be in $libc, as you said before."
4970 elif $test -r $incpath/usr/lib/libc$_a; then
4971         libc=$incpath/usr/lib/libc$_a;
4972         echo "Your C library seems to be in $libc.  That's fine."
4973 elif $test -r /lib/libc$_a; then
4974         libc=/lib/libc$_a;
4975         echo "Your C library seems to be in $libc.  You're normal."
4976 else
4977         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
4978                 :
4979         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
4980                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
4981         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
4982                 :
4983         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
4984                 :
4985         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
4986                 :
4987         else
4988                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
4989         fi
4990         if $test -r "$tans"; then
4991                 echo "Your C library seems to be in $tans, of all places."
4992                 libc=$tans
4993         else
4994                 libc='blurfl'
4995         fi
4996 fi
4997 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
4998         dflt="$libc"
4999         cat <<EOM
5000
5001 If the guess above is wrong (which it might be if you're using a strange
5002 compiler, or your machine supports multiple models), you can override it here.
5003
5004 EOM
5005 else
5006         dflt=''
5007         echo $libpth | tr ' ' $trnl | sort | uniq > libpath
5008         cat >&4 <<EOM
5009 I can't seem to find your C library.  I've looked in the following places:
5010
5011 EOM
5012         $sed 's/^/      /' libpath
5013         cat <<EOM
5014
5015 None of these seems to contain your C library. I need to get its name...
5016
5017 EOM
5018 fi
5019 fn=f
5020 rp='Where is your C library?'
5021 . ./getfile
5022 libc="$ans"
5023
5024 echo " "
5025 echo $libc $libnames | tr ' ' $trnl | sort | uniq > libnames
5026 set X `cat libnames`
5027 shift
5028 xxx=files
5029 case $# in 1) xxx=file; esac
5030 echo "Extracting names from the following $xxx for later perusal:" >&4
5031 echo " "
5032 $sed 's/^/      /' libnames >&4
5033 echo " "
5034 $echo $n "This may take a while...$c" >&4
5035
5036 for file in $*; do
5037         case $file in
5038         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
5039         *) $nm $nm_opt $file 2>/dev/null;;
5040         esac
5041 done >libc.tmp
5042
5043 $echo $n ".$c"
5044 $grep fprintf libc.tmp > libc.ptf
5045 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
5046 xrun='eval "<libc.tmp $com >libc.list"; echo "done" >&4'
5047 xxx='[ADTSIW]'
5048 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *_[_.]*//p' -e 's/^.* $xxx  *//p'";\
5049         eval $xscan;\
5050         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5051                 eval $xrun
5052 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
5053         eval $xscan;\
5054         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5055                 eval $xrun
5056 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
5057         eval $xscan;\
5058         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5059                 eval $xrun
5060 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
5061         eval $xscan;\
5062         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5063                 eval $xrun
5064 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
5065         eval $xscan;\
5066         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5067                 eval $xrun
5068 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
5069         eval $xscan;\
5070         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5071                 eval $xrun
5072 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
5073                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
5074         eval $xscan;\
5075         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5076                 eval $xrun
5077 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
5078         eval $xscan;\
5079         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5080                 eval $xrun
5081 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
5082         eval $xscan;\
5083         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5084                 eval $xrun
5085 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
5086         eval $xscan;\
5087         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5088                 eval $xrun
5089 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
5090         eval $xscan;\
5091         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5092                 eval $xrun
5093 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
5094         eval $xscan;\
5095         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5096                 eval $xrun
5097 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
5098         eval $xscan;\
5099         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5100                 eval $xrun
5101 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
5102         eval $xscan;\
5103         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5104                 eval $xrun
5105 else
5106         $nm -p $* 2>/dev/null >libc.tmp
5107         $grep fprintf libc.tmp > libc.ptf
5108         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
5109                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
5110         then
5111                 nm_opt='-p'
5112                 eval $xrun
5113         else
5114                 echo " "
5115                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
5116                 com=''
5117                 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
5118                         for thisname in $libnames $libc; do
5119                                 $ar t $thisname >>libc.tmp
5120                         done
5121                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
5122                         echo "Ok." >&4
5123                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
5124                         # Repeat libc to extract forwarders to DLL entries too
5125                         for thisname in $libnames $libc; do
5126                                 $ar tv $thisname >>libc.tmp
5127                                 # Revision 50 of EMX has bug in $ar.
5128                                 # it will not extract forwarders to DLL entries
5129                                 # Use emximp which will extract exactly them.
5130                                 emximp -o tmp.imp $thisname \
5131                                     2>/dev/null && \
5132                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
5133                                     < tmp.imp >>libc.tmp
5134                                 $rm tmp.imp
5135                         done
5136                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
5137                         echo "Ok." >&4
5138                 else
5139                         echo "$ar didn't seem to work right." >&4
5140                         echo "Maybe this is a Cray...trying bld instead..." >&4
5141                         if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
5142                         then
5143                                 for thisname in $libnames; do
5144                                         bld t $libnames | \
5145                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
5146                                         $ar t $thisname >>libc.tmp
5147                                 done
5148                                 echo "Ok." >&4
5149                         else
5150                                 echo "That didn't work either.  Giving up." >&4
5151                                 exit 1
5152                         fi
5153                 fi
5154         fi
5155 fi
5156 nm_extract="$com"
5157 if $test -f /lib/syscalls.exp; then
5158         echo " "
5159         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
5160         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*$/\1/p' /lib/syscalls.exp >>libc.list
5161 fi
5162 ;;
5163 esac
5164 $rm -f libnames libpath
5165
5166 : is a C symbol defined?
5167 csym='tlook=$1;
5168 case "$3" in
5169 -v) tf=libc.tmp; tc=""; tdc="";;
5170 -a) tf=libc.tmp; tc="[0]"; tdc="[]";;
5171 *) tlook="^$1\$"; tf=libc.list; tc="()"; tdc="()";;
5172 esac;
5173 tx=yes;
5174 case "$reuseval-$4" in
5175 true-) ;;
5176 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
5177 esac;
5178 case "$tx" in
5179 yes)
5180         case "$runnm" in
5181         true)
5182                 if $contains $tlook $tf >/dev/null 2>&1;
5183                 then tval=true;
5184                 else tval=false;
5185                 fi;;
5186         *)
5187                 echo "int main() { extern short $1$tdc; printf(\"%hd\", $1$tc); }" > t.c;
5188                 if $cc $optimize $ccflags $ldflags -o t t.c $libs >/dev/null 2>&1;
5189                 then tval=true;
5190                 else tval=false;
5191                 fi;
5192                 $rm -f t t.c;;
5193         esac;;
5194 *)
5195         case "$tval" in
5196         $define) tval=true;;
5197         *) tval=false;;
5198         esac;;
5199 esac;
5200 eval "$2=$tval"'
5201
5202 : define an is-in-libc? function
5203 inlibc='echo " "; td=$define; tu=$undef;
5204 sym=$1; var=$2; eval "was=\$$2";
5205 tx=yes;
5206 case "$reuseval$was" in
5207 true) ;;
5208 true*) tx=no;;
5209 esac;
5210 case "$tx" in
5211 yes)
5212         set $sym tres -f;
5213         eval $csym;
5214         case "$tres" in
5215         true)
5216                 echo "$sym() found." >&4;
5217                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
5218         *)
5219                 echo "$sym() NOT found." >&4;
5220                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
5221         esac;;
5222 *)
5223         case "$was" in
5224         $define) echo "$sym() found." >&4;;
5225         *) echo "$sym() NOT found." >&4;;
5226         esac;;
5227 esac'
5228
5229 : see if sqrtl exists
5230 set sqrtl d_sqrtl
5231 eval $inlibc
5232
5233 case "$ccflags" in
5234 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
5235 esac
5236
5237 case "$uselongdouble" in
5238 $define|true|[yY]*)     dflt='y';;
5239 *) dflt='n';;
5240 esac
5241 cat <<EOM
5242
5243 Perl can be built to take advantage of long doubles which
5244 (if available) may give more accuracy and range for floating point numbers.
5245
5246 If this doesn't make any sense to you, just accept the default '$dflt'.
5247 EOM
5248 rp='Try to use long doubles if available?'
5249 . ./myread
5250 case "$ans" in
5251 y|Y)    val="$define"   ;;
5252 *)      val="$undef"    ;;
5253 esac
5254 set uselongdouble
5255 eval $setvar
5256
5257 case "$uselongdouble" in
5258 true|[yY]*) uselongdouble="$define" ;;
5259 esac
5260
5261 case "$uselongdouble" in
5262 $define)
5263 : Look for a hint-file generated 'call-back-unit'.  If the
5264 : user has specified that long doubles should be used,
5265 : we may need to set or change some other defaults.
5266         if $test -f uselongdouble.cbu; then
5267                 echo "Your platform has some specific hints for long doubles, using them..."
5268                 . ./uselongdouble.cbu
5269         else
5270                 $cat <<EOM
5271 (Your platform doesn't have any specific hints for long doubles.)
5272 EOM
5273         fi
5274         ;;
5275 esac
5276
5277 case "$uselongdouble:$d_sqrtl" in
5278 $define:$undef)
5279                 $cat <<EOM >&4
5280
5281 *** You requested the use of long doubles but you do not seem to have
5282 *** the mathematic functions for long doubles.  I'm disabling the use
5283 *** of long doubles.
5284
5285 EOM
5286         uselongdouble=$undef
5287         ;;
5288 esac
5289
5290 : check for length of double
5291 echo " "
5292 case "$doublesize" in
5293 '')
5294         echo "Checking to see how big your double precision numbers are..." >&4
5295         $cat >try.c <<'EOCP'
5296 #include <stdio.h>
5297 int main()
5298 {
5299     printf("%d\n", (int)sizeof(double));
5300     exit(0);
5301 }
5302 EOCP
5303         set try
5304         if eval $compile_ok; then
5305                 doublesize=`./try`
5306                 echo "Your double is $doublesize bytes long."
5307         else
5308                 dflt='8'
5309                 echo "(I can't seem to compile the test program.  Guessing...)"
5310                 rp="What is the size of a double precision number (in bytes)?"
5311                 . ./myread
5312                 doublesize="$ans"
5313         fi
5314         ;;
5315 esac
5316 $rm -f try.c try
5317
5318 : check for long doubles
5319 echo " "
5320 echo "Checking to see if you have long double..." >&4
5321 echo 'int main() { long double x = 7.0; }' > try.c
5322 set try
5323 if eval $compile; then
5324         val="$define"
5325         echo "You have long double."
5326 else
5327         val="$undef"
5328         echo "You do not have long double."
5329 fi
5330 $rm try.*
5331 set d_longdbl
5332 eval $setvar
5333
5334 : check for length of long double
5335 case "${d_longdbl}${longdblsize}" in
5336 $define)
5337         echo " "
5338         echo "Checking to see how big your long doubles are..." >&4
5339         $cat >try.c <<'EOCP'
5340 #include <stdio.h>
5341 int main()
5342 {
5343         printf("%d\n", sizeof(long double));
5344 }
5345 EOCP
5346         set try
5347         set try
5348         if eval $compile; then
5349                 longdblsize=`./try$exe_ext`
5350                 echo "Your long doubles are $longdblsize bytes long."
5351         else
5352                 dflt='8'
5353                 echo " "
5354                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
5355                 rp="What is the size of a long double (in bytes)?"
5356                 . ./myread
5357                 longdblsize="$ans"
5358         fi
5359         if $test "X$doublesize" = "X$longdblsize"; then
5360                 echo "(That isn't any different from an ordinary double.)"
5361         fi      
5362         ;;
5363 esac
5364 $rm -f try.* try
5365
5366 : determine the architecture name
5367 echo " "
5368 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
5369         tarch=`arch`"-$osname"
5370 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
5371         if uname -m > tmparch 2>&1 ; then
5372                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
5373                         -e 's/$/'"-$osname/" tmparch`
5374         else
5375                 tarch="$osname"
5376         fi
5377         $rm -f tmparch
5378 else
5379         tarch="$osname"
5380 fi
5381 case "$myarchname" in
5382 ''|"$tarch") ;;
5383 *)
5384         echo "(Your architecture name used to be $myarchname.)"
5385         archname=''
5386         ;;
5387 esac
5388 myarchname="$tarch"
5389 case "$archname" in
5390 '') dflt="$tarch";;
5391 *) dflt="$archname";;
5392 esac
5393 rp='What is your architecture name'
5394 . ./myread
5395 archname="$ans"
5396 case "$usethreads" in
5397 $define)
5398         echo "Threads selected." >&4
5399         case "$archname" in
5400         *-thread*) echo "...and architecture name already has -thread." >&4
5401                 ;;
5402         *)      archname="$archname-thread"
5403                 echo "...setting architecture name to $archname." >&4
5404                 ;;
5405         esac
5406         ;;
5407 esac
5408 case "$usemultiplicity" in
5409 $define)
5410         echo "Multiplicity selected." >&4
5411         case "$archname" in
5412         *-multi*) echo "...and architecture name already has -multi." >&4
5413                 ;;
5414         *)      archname="$archname-multi"
5415                 echo "...setting architecture name to $archname." >&4
5416                 ;;
5417         esac
5418         ;;
5419 esac
5420 case "$use64bitint$use64bitall" in
5421 *"$define"*)
5422         case "$archname64" in
5423         '')
5424                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
5425                 ;;
5426         *)
5427                 case "$use64bitint" in
5428                 "$define") echo "64 bit integers selected." >&4 ;;
5429                 esac
5430                 case "$use64bitall" in
5431                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
5432                 esac
5433                 case "$archname" in
5434                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
5435                         ;;
5436                 *)      archname="$archname-$archname64"
5437                         echo "...setting architecture name to $archname." >&4
5438                         ;;
5439                 esac
5440                 ;;
5441         esac
5442 esac
5443 case "$uselongdouble" in
5444 $define)
5445         echo "Long doubles selected." >&4
5446         case "$longdblsize" in
5447         $doublesize)
5448                 "...but long doubles are equal to doubles, not changing architecture name." >&4
5449                 ;;
5450         *)
5451                 case "$archname" in
5452                 *-ld*) echo "...and architecture name already has -ld." >&4
5453                         ;;
5454                 *)      archname="$archname-ld"
5455                         echo "...setting architecture name to $archname." >&4
5456                         ;;
5457                 esac
5458                 ;;
5459         esac
5460         ;;
5461 esac
5462
5463 : determine root of directory hierarchy where package will be installed.
5464 case "$prefix" in
5465 '')
5466         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
5467         ;;
5468 *)
5469         dflt="$prefix"
5470         ;;
5471 esac
5472 $cat <<EOM
5473
5474 By default, $package will be installed in $dflt/bin, manual pages
5475 under $dflt/man, etc..., i.e. with $dflt as prefix for all
5476 installation directories. Typically this is something like /usr/local.
5477 If you wish to have binaries under /usr/bin but other parts of the
5478 installation under /usr/local, that's ok: you will be prompted
5479 separately for each of the installation directories, the prefix being
5480 only used to set the defaults.
5481
5482 EOM
5483 fn=d~
5484 rp='Installation prefix to use?'
5485 . ./getfile
5486 oldprefix=''
5487 case "$prefix" in
5488 '') ;;
5489 *)
5490         case "$ans" in
5491         "$prefix") ;;
5492         *) oldprefix="$prefix";;
5493         esac
5494         ;;
5495 esac
5496 prefix="$ans"
5497 prefixexp="$ansexp"
5498
5499 : is AFS running?
5500 echo " "
5501 case "$afs" in
5502 $define|true)   afs=true ;;
5503 $undef|false)   afs=false ;;
5504 *)      if test -d /afs; then
5505                 afs=true
5506         else
5507                 afs=false
5508         fi
5509         ;;
5510 esac
5511 if $afs; then
5512         echo "AFS may be running... I'll be extra cautious then..." >&4
5513 else
5514         echo "AFS does not seem to be running..." >&4
5515 fi
5516
5517 : determine installation prefix for where package is to be installed.
5518 if $afs; then 
5519 $cat <<EOM
5520
5521 Since you are running AFS, I need to distinguish the directory in which
5522 files will reside from the directory in which they are installed (and from
5523 which they are presumably copied to the former directory by occult means).
5524
5525 EOM
5526         case "$installprefix" in
5527         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
5528         *) dflt="$installprefix";;
5529         esac
5530 else
5531 $cat <<EOM
5532
5533 In some special cases, particularly when building $package for distribution,
5534 it is convenient to distinguish between the directory in which files should 
5535 be installed from the directory ($prefix) in which they 
5536 will eventually reside.  For most users, these two directories are the same.
5537
5538 EOM
5539         case "$installprefix" in
5540         '') dflt=$prefix ;;
5541         *) dflt=$installprefix;;
5542         esac
5543 fi
5544 fn=d~
5545 rp='What installation prefix should I use for installing files?'
5546 . ./getfile
5547 installprefix="$ans"
5548 installprefixexp="$ansexp"
5549
5550 : set the prefixit variable, to compute a suitable default value
5551 prefixit='case "$3" in
5552 ""|none)
5553         case "$oldprefix" in
5554         "") eval "$1=\"\$$2\"";;
5555         *)
5556                 case "$3" in
5557                 "") eval "$1=";;
5558                 none)
5559                         eval "tp=\"\$$2\"";
5560                         case "$tp" in
5561                         ""|" ") eval "$1=\"\$$2\"";;
5562                         *) eval "$1=";;
5563                         esac;;
5564                 esac;;
5565         esac;;
5566 *)
5567         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
5568         case "$tp" in
5569         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
5570         /*-$oldprefix/*|\~*-$oldprefix/*)
5571                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
5572         *) eval "$1=\"\$$2\"";;
5573         esac;;
5574 esac'
5575
5576
5577 : get the patchlevel
5578 echo " "
5579 echo "Getting the current patchlevel..." >&4
5580 if $test -r $rsrc/patchlevel.h;then
5581         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
5582         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
5583         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
5584         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
5585         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
5586         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
5587 else
5588         revision=0
5589         patchlevel=0
5590         subversion=0
5591         api_revision=0
5592         api_version=0
5593         api_subversion=0
5594 fi
5595 $echo "(You have $package version $patchlevel subversion $subversion.)"
5596 case "$osname" in
5597 dos|vms)
5598         : XXX Should be a Configure test for double-dots in filenames.
5599         version=`echo $revision $patchlevel $subversion | \
5600                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
5601         api_versionstring=`echo $api_revision $api_version $api_subversion | \
5602                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
5603         ;;
5604 *)
5605         version=`echo $revision $patchlevel $subversion | \
5606                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
5607         api_versionstring=`echo $api_revision $api_version $api_subversion | \
5608                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
5609         ;;
5610 esac
5611 : Special case the 5.005_xx maintenance series, which used 5.005
5612 : without any subversion label as a subdirectory in $sitelib
5613 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
5614         api_versionstring='5.005'
5615 fi
5616
5617 : determine installation style
5618 : For now, try to deduce it from prefix unless it is already set.
5619 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
5620 case "$installstyle" in
5621 '')     case "$prefix" in
5622                 *perl*) dflt='lib';;
5623                 *) dflt='lib/perl5' ;;
5624         esac
5625         ;;
5626 *)      dflt="$installstyle" ;;
5627 esac
5628 : Probably not worth prompting for this since we prompt for all
5629 : the directories individually, and the prompt would be too long and
5630 : confusing anyway.
5631 installstyle=$dflt
5632
5633 : determine where private library files go
5634 : Usual default is /usr/local/lib/perl5/$version.
5635 : Also allow things like /opt/perl/lib/$version, since 
5636 : /opt/perl/lib/perl5... would be redundant.
5637 : The default "style" setting is made in installstyle.U
5638 case "$installstyle" in
5639 *lib/perl5*) set dflt privlib lib/$package/$version ;;
5640 *)       set dflt privlib lib/$version ;;
5641 esac
5642 eval $prefixit
5643 $cat <<EOM
5644
5645 There are some auxiliary files for $package that need to be put into a
5646 private library directory that is accessible by everyone.
5647
5648 EOM
5649 fn=d~+
5650 rp='Pathname where the private library files will reside?'
5651 . ./getfile
5652 privlib="$ans"
5653 privlibexp="$ansexp"
5654 : Change installation prefix, if necessary.
5655 if $test X"$prefix" != X"$installprefix"; then
5656         installprivlib=`echo $privlibexp | sed "s#^$prefix#$installprefix#"`
5657 else
5658         installprivlib="$privlibexp"
5659 fi
5660
5661 : set the prefixup variable, to restore leading tilda escape
5662 prefixup='case "$prefixexp" in
5663 "$prefix") ;;
5664 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
5665 esac'
5666
5667 : determine where public architecture dependent libraries go
5668 set archlib archlib
5669 eval $prefixit
5670 : privlib default is /usr/local/lib/$package/$version
5671 : archlib default is /usr/local/lib/$package/$version/$archname
5672 : privlib may have an optional trailing /share.
5673 tdflt=`echo $privlib | $sed 's,/share$,,'`
5674 tdflt=$tdflt/$archname
5675 case "$archlib" in
5676 '')     dflt=$tdflt
5677         ;;
5678 *)      dflt="$archlib"
5679     ;;
5680 esac
5681 $cat <<EOM
5682
5683 $spackage contains architecture-dependent library files.  If you are
5684 sharing libraries in a heterogeneous environment, you might store
5685 these files in a separate location.  Otherwise, you can just include
5686 them with the rest of the public library files.
5687
5688 EOM
5689 fn=d+~
5690 rp='Where do you want to put the public architecture-dependent libraries?'
5691 . ./getfile
5692 archlib="$ans"
5693 archlibexp="$ansexp"
5694 if $test X"$archlib" = X"$privlib"; then
5695         d_archlib="$undef"
5696 else
5697         d_archlib="$define"
5698 fi
5699 : Change installation prefix, if necessary.
5700 if $test X"$prefix" != X"$installprefix"; then
5701         installarchlib=`echo $archlibexp | sed "s#^$prefix#$installprefix#"`
5702 else
5703         installarchlib="$archlibexp"
5704 fi
5705
5706
5707 : Binary compatibility with 5.005 is not possible for builds
5708 : with advanced features
5709 case "$usethreads$usemultiplicity" in
5710 *define*)
5711         bincompat5005="$undef"
5712         d_bincompat5005="$undef"
5713         ;;
5714 *)      $cat <<EOM
5715
5716 This version of Perl can be compiled for binary compatibility with 5.005.
5717 If you decide to do so, you will be able to continue using most of the
5718 extensions that were compiled for Perl 5.005.
5719
5720 EOM
5721         case "$bincompat5005$d_bincompat5005" in
5722         *"$undef"*) dflt=n ;;
5723         *) dflt=y ;;
5724         esac
5725         rp='Binary compatibility with Perl 5.005?'
5726         . ./myread
5727         case "$ans" in
5728         y*) val="$define" ;;
5729         *)  val="$undef" ;;
5730         esac
5731         set d_bincompat5005
5732         eval $setvar
5733         case "$d_bincompat5005" in
5734         "$define")
5735                 bincompat5005="$define"
5736                 ;;
5737         *)      bincompat5005="$undef"
5738                 d_bincompat5005="$undef"
5739                 ;;
5740         esac
5741         ;;
5742 esac
5743
5744
5745 : see if setuid scripts can be secure
5746 $cat <<EOM
5747
5748 Some kernels have a bug that prevents setuid #! scripts from being
5749 secure.  Some sites have disabled setuid #! scripts because of this.
5750
5751 First let's decide if your kernel supports secure setuid #! scripts.
5752 (If setuid #! scripts would be secure but have been disabled anyway,
5753 don't say that they are secure if asked.)
5754
5755 EOM
5756
5757 val="$undef"
5758 if $test -d /dev/fd; then
5759         echo "#!$ls" >reflect
5760         chmod +x,u+s reflect
5761         ./reflect >flect 2>&1
5762         if $contains "/dev/fd" flect >/dev/null; then
5763                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
5764                 val="$define"
5765         else
5766                 $cat <<EOM
5767 If you are not sure if they are secure, I can check but I'll need a
5768 username and password different from the one you are using right now.
5769 If you don't have such a username or don't want me to test, simply
5770 enter 'none'.
5771
5772 EOM
5773                 rp='Other username to test security of setuid scripts with?'
5774                 dflt='none'
5775                 . ./myread
5776                 case "$ans" in
5777                 n|none)
5778                         case "$d_suidsafe" in
5779                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
5780                                 dflt=n;;
5781                         "$undef")
5782                                 echo "Well, the $hint value is *not* secure." >&4
5783                                 dflt=n;;
5784                         *)      echo "Well, the $hint value *is* secure." >&4
5785                                 dflt=y;;
5786                         esac
5787                         ;;
5788                 *)
5789                         $rm -f reflect flect
5790                         echo "#!$ls" >reflect
5791                         chmod +x,u+s reflect
5792                         echo >flect
5793                         chmod a+w flect
5794                         echo '"su" will (probably) prompt you for '"$ans's password."
5795                         su $ans -c './reflect >flect'
5796                         if $contains "/dev/fd" flect >/dev/null; then
5797                                 echo "Okay, it looks like setuid scripts are secure." >&4
5798                                 dflt=y
5799                         else
5800                                 echo "I don't think setuid scripts are secure." >&4
5801                                 dflt=n
5802                         fi
5803                         ;;
5804                 esac
5805                 rp='Does your kernel have *secure* setuid scripts?'
5806                 . ./myread
5807                 case "$ans" in
5808                 [yY]*)  val="$define";;
5809                 *)      val="$undef";;
5810                 esac
5811         fi
5812 else
5813         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
5814         echo "(That's for file descriptors, not floppy disks.)"
5815         val="$undef"
5816 fi
5817 set d_suidsafe
5818 eval $setvar
5819
5820 $rm -f reflect flect
5821
5822 : now see if they want to do setuid emulation
5823 echo " "
5824 val="$undef"
5825 case "$d_suidsafe" in
5826 "$define")
5827         val="$undef"
5828         echo "No need to emulate SUID scripts since they are secure here." >& 4
5829         ;;
5830 *)
5831         $cat <<EOM
5832 Some systems have disabled setuid scripts, especially systems where
5833 setuid scripts cannot be secure.  On systems where setuid scripts have
5834 been disabled, the setuid/setgid bits on scripts are currently
5835 useless.  It is possible for $package to detect those bits and emulate
5836 setuid/setgid in a secure fashion.  This emulation will only work if
5837 setuid scripts have been disabled in your kernel.
5838
5839 EOM
5840         case "$d_dosuid" in
5841         "$define") dflt=y ;;
5842         *) dflt=n ;;
5843         esac
5844         rp="Do you want to do setuid/setgid emulation?"
5845         . ./myread
5846         case "$ans" in
5847         [yY]*)  val="$define";;
5848         *)      val="$undef";;
5849         esac
5850         ;;
5851 esac
5852 set d_dosuid
5853 eval $setvar
5854
5855 : determine filename position in cpp output
5856 echo " "
5857 echo "Computing filename position in cpp output for #include directives..." >&4
5858 echo '#include <stdio.h>' > foo.c
5859 $cat >fieldn <<EOF
5860 $startsh
5861 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5862 $grep '^[       ]*#.*stdio\.h' | \
5863 while read cline; do
5864         pos=1
5865         set \$cline
5866         while $test \$# -gt 0; do
5867                 if $test -r \`echo \$1 | $tr -d '"'\`; then
5868                         echo "\$pos"
5869                         exit 0
5870                 fi
5871                 shift
5872                 pos=\`expr \$pos + 1\`
5873         done
5874 done
5875 EOF
5876 chmod +x fieldn
5877 fieldn=`./fieldn`
5878 $rm -f foo.c fieldn
5879 case $fieldn in
5880 '') pos='???';;
5881 1) pos=first;;
5882 2) pos=second;;
5883 3) pos=third;;
5884 *) pos="${fieldn}th";;
5885 esac
5886 echo "Your cpp writes the filename in the $pos field of the line."
5887
5888 : locate header file
5889 $cat >findhdr <<EOF
5890 $startsh
5891 wanted=\$1
5892 name=''
5893 for usrincdir in $usrinc
5894 do
5895         if test -f \$usrincdir/\$wanted; then
5896                 echo "\$usrincdir/\$wanted"
5897                 exit 0
5898         fi
5899 done
5900 awkprg='{ print \$$fieldn }'
5901 echo "#include <\$wanted>" > foo\$\$.c
5902 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5903 $grep "^[       ]*#.*\$wanted" | \
5904 while read cline; do
5905         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5906         case "\$name" in
5907         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5908         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5909         *) exit 2;;
5910         esac;
5911 done;
5912 #
5913 # status = 0: grep returned 0 lines, case statement not executed
5914 # status = 1: headerfile found
5915 # status = 2: while loop executed, no headerfile found
5916 #
5917 status=\$?
5918 $rm -f foo\$\$.c;
5919 if test \$status -eq 1; then
5920         exit 0;
5921 fi
5922 exit 1
5923 EOF
5924 chmod +x findhdr
5925
5926 : define an alternate in-header-list? function
5927 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5928 cont=true; xxf="echo \"<\$1> found.\" >&4";
5929 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5930 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5931 esac;
5932 case $# in 4) instead=instead;; *) instead="at last";; esac;
5933 while $test "$cont"; do
5934         xxx=`./findhdr $1`
5935         var=$2; eval "was=\$$2";
5936         if $test "$xxx" && $test -r "$xxx";
5937         then eval $xxf;
5938         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5939                 cont="";
5940         else eval $xxnf;
5941         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5942         set $yyy; shift; shift; yyy=$@;
5943         case $# in 0) cont="";;
5944         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5945                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5946         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5947                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5948         esac;
5949 done;
5950 while $test "$yyy";
5951 do set $yyy; var=$2; eval "was=\$$2";
5952         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5953         set $yyy; shift; shift; yyy=$@;
5954 done'
5955
5956 : see if this is a malloc.h system
5957 set malloc.h i_malloc
5958 eval $inhdr
5959
5960 : see if stdlib is available
5961 set stdlib.h i_stdlib
5962 eval $inhdr
5963
5964 : determine which malloc to compile in
5965 echo " "
5966 case "$usemymalloc" in
5967 ''|[yY]*|true|$define)  dflt='y' ;;
5968 *)      dflt='n' ;;
5969 esac
5970 rp="Do you wish to attempt to use the malloc that comes with $package?"
5971 . ./myread
5972 usemymalloc="$ans"
5973 case "$ans" in
5974 y*|true)
5975         usemymalloc='y'
5976         mallocsrc='malloc.c'
5977         mallocobj="malloc$_o"
5978         d_mymalloc="$define"
5979         case "$libs" in
5980         *-lmalloc*)
5981                 : Remove malloc from list of libraries to use
5982                 echo "Removing unneeded -lmalloc from library list" >&4
5983                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
5984                 shift
5985                 libs="$*"
5986                 echo "libs = $libs" >&4
5987                 ;;
5988         esac
5989         ;;
5990 *)
5991         usemymalloc='n'
5992         mallocsrc=''
5993         mallocobj=''
5994         d_mymalloc="$undef"
5995         ;;
5996 esac
5997
5998 : compute the return types of malloc and free
5999 echo " "
6000 $cat >malloc.c <<END
6001 #$i_malloc I_MALLOC
6002 #$i_stdlib I_STDLIB
6003 #include <stdio.h>
6004 #include <sys/types.h>
6005 #ifdef I_MALLOC
6006 #include <malloc.h>
6007 #endif
6008 #ifdef I_STDLIB
6009 #include <stdlib.h>
6010 #endif
6011 #ifdef TRY_MALLOC
6012 void *malloc();
6013 #endif
6014 #ifdef TRY_FREE
6015 void free();
6016 #endif
6017 END
6018 case "$malloctype" in
6019 '')
6020         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
6021                 malloctype='void *'
6022         else
6023                 malloctype='char *'
6024         fi
6025         ;;
6026 esac
6027 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
6028
6029 case "$freetype" in
6030 '')
6031         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
6032                 freetype='void'
6033         else
6034                 freetype='int'
6035         fi
6036         ;;
6037 esac
6038 echo "Your system uses $freetype free(), it would seem." >&4
6039 $rm -f malloc.[co]
6040 $cat <<EOM
6041
6042 After $package is installed, you may wish to install various
6043 add-on modules and utilities.  Typically, these add-ons will
6044 be installed under $prefix with the rest
6045 of this package.  However, you may wish to install such add-ons
6046 elsewhere under a different prefix.
6047
6048 If you do not wish to put everything under a single prefix, that's
6049 ok.  You will be prompted for the individual locations; this siteprefix
6050 is only used to suggest the defaults.
6051
6052 The default should be fine for most people.
6053
6054 EOM
6055 fn=d~+
6056 rp='Installation prefix to use for add-on modules and utilities?'
6057 : XXX Here might be another good place for an installstyle setting.
6058 case "$siteprefix" in
6059 '') dflt=$prefix ;;
6060 *)  dflt=$siteprefix ;;
6061 esac
6062 . ./getfile
6063 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6064 oldsiteprefix=''
6065 case "$siteprefix" in
6066 '') ;;
6067 *)      case "$ans" in
6068         "$prefix") ;;
6069         *) oldsiteprefix="$prefix";;
6070         esac
6071         ;;
6072 esac
6073 siteprefix="$ans"
6074 siteprefixexp="$ansexp"
6075
6076 : determine where site specific libraries go.
6077 : Usual default is /usr/local/lib/perl5/site_perl/$version
6078 : The default "style" setting is made in installstyle.U
6079 : XXX No longer works with Prefixit stuff.
6080 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6081 case "$sitelib" in
6082 '') case "$installstyle" in
6083         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
6084         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
6085         esac
6086         ;;
6087 *)      dflt="$sitelib"
6088         ;;
6089 esac
6090 $cat <<EOM
6091
6092 The installation process will create a directory for
6093 site-specific extensions and modules.  Most users find it convenient
6094 to place all site-specific files in this directory rather than in the
6095 main distribution directory.
6096
6097 EOM
6098 fn=d~+
6099 rp='Pathname for the site-specific library files?'
6100 . ./getfile
6101 sitelib="$ans"
6102 sitelibexp="$ansexp"
6103 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
6104 : Change installation prefix, if necessary.
6105 if $test X"$prefix" != X"$installprefix"; then
6106         installsitelib=`echo $sitelibexp | $sed "s#^$prefix#$installprefix#"`
6107 else
6108         installsitelib="$sitelibexp"
6109 fi
6110
6111 : determine where site specific architecture-dependent libraries go.
6112 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
6113 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
6114 : sitelib may have an optional trailing /share.
6115 case "$sitearch" in
6116 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
6117         dflt="$dflt/$archname"
6118         ;;
6119 *)      dflt="$sitearch"
6120         ;;
6121 esac
6122 set sitearch sitearch none
6123 eval $prefixit
6124 $cat <<EOM
6125
6126 The installation process will also create a directory for
6127 architecture-dependent site-specific extensions and modules.
6128
6129 EOM
6130 fn=d~+
6131 rp='Pathname for the site-specific architecture-dependent library files?'
6132 . ./getfile
6133 sitearch="$ans"
6134 sitearchexp="$ansexp"
6135 : Change installation prefix, if necessary.
6136 if $test X"$prefix" != X"$installprefix"; then
6137         installsitearch=`echo $sitearchexp | sed "s#^$prefix#$installprefix#"`
6138 else
6139         installsitearch="$sitearchexp"
6140 fi
6141
6142 $cat <<EOM
6143
6144 The installation process will also create a directory for
6145 vendor-supplied add-ons.  Vendors who supply perl with their system
6146 may find it convenient to place all vendor-supplied files in this
6147 directory rather than in the main distribution directory.  This will
6148 ease upgrades between binary-compatible maintenance versions of perl.
6149
6150 Of course you may also use these directories in whatever way you see
6151 fit.  For example, you might use them to access modules shared over a
6152 company-wide network.
6153
6154 The default answer should be fine for most people.
6155 This causes further questions about vendor add-ons to be skipped
6156 and no vendor-specific directories will be configured for perl.
6157
6158 EOM
6159 rp='Do you want to configure vendor-specific add-on directories?'
6160 case "$usevendorprefix" in
6161 define|true|[yY]*) dflt=y ;;
6162 *)      : User may have set vendorprefix directly on Configure command line.
6163         case "$vendorprefix" in
6164         ''|' ') dflt=n ;;
6165         *)      dflt=y ;;
6166         esac
6167         ;;
6168 esac
6169 . ./myread
6170 case "$ans" in
6171 [yY]*)  fn=d~+
6172         rp='Installation prefix to use for vendor-supplied add-ons?'
6173         case "$vendorprefix" in
6174         '') dflt='' ;;
6175         *)  dflt=$vendorprefix ;;
6176         esac
6177         . ./getfile
6178         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6179         oldvendorprefix=''
6180         case "$vendorprefix" in
6181         '') ;;
6182         *)      case "$ans" in
6183                 "$prefix") ;;
6184                 *) oldvendorprefix="$prefix";;
6185                 esac
6186                 ;;
6187         esac
6188         usevendorprefix="$define"
6189         vendorprefix="$ans"
6190         vendorprefixexp="$ansexp"
6191         ;;
6192 *)      usevendorprefix="$undef"
6193         vendorprefix=''
6194         vendorprefixexp=''
6195         ;;
6196 esac
6197
6198 case "$vendorprefix" in
6199 '')     d_vendorlib="$undef"
6200         vendorlib=''
6201         vendorlibexp=''
6202         ;;
6203 *)      d_vendorlib="$define"
6204         : determine where vendor-supplied modules go.
6205         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
6206         case "$vendorlib" in
6207         '')
6208                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6209                 case "$installstyle" in
6210                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
6211                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
6212                 esac
6213                 ;;
6214         *)      dflt="$vendorlib"
6215                 ;;
6216         esac
6217         fn=d~+
6218         rp='Pathname for the vendor-supplied library files?'
6219         . ./getfile
6220         vendorlib="$ans"
6221         vendorlibexp="$ansexp"
6222         ;;
6223 esac
6224 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
6225 : Change installation prefix, if necessary.
6226 if $test X"$prefix" != X"$installprefix"; then
6227         installvendorlib=`echo $vendorlibexp | $sed "s#^$prefix#$installprefix#"`
6228 else
6229         installvendorlib="$vendorlibexp"
6230 fi
6231
6232 case "$vendorprefix" in
6233 '')     d_vendorarch="$undef"
6234         vendorarch=''
6235         vendorarchexp=''
6236         ;;
6237 *)      d_vendorarch="$define"
6238         : determine where vendor-supplied architecture-dependent libraries go.
6239         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
6240         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
6241         : vendorlib may have an optional trailing /share.
6242         case "$vendorarch" in
6243         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
6244                 dflt="$dflt/$archname"
6245                 ;;
6246         *)      dflt="$vendorarch" ;;
6247         esac
6248         fn=d~+
6249         rp='Pathname for vendor-supplied architecture-dependent files?'
6250         . ./getfile
6251         vendorarch="$ans"
6252         vendorarchexp="$ansexp"
6253         ;;
6254 esac
6255 : Change installation prefix, if necessary.
6256 if $test X"$prefix" != X"$installprefix"; then
6257         installvendorarch=`echo $vendorarchexp | sed "s#^$prefix#$installprefix#"`
6258 else
6259         installvendorarch="$vendorarchexp"
6260 fi
6261
6262 : Final catch-all directories to search
6263 $cat <<EOM
6264
6265 Lastly, you can have perl look in other directories for extensions and
6266 modules in addition to those already specified.
6267 These directories will be searched after 
6268         $sitearch 
6269         $sitelib 
6270 EOM
6271 test X"$vendorlib" != "X" && echo '     ' $vendorlib
6272 test X"$vendorarch" != "X" && echo '    ' $vendorarch
6273 echo ' '
6274 case "$otherlibdirs" in
6275 ''|' ') dflt='none' ;;
6276 *)      dflt="$otherlibdirs" ;;
6277 esac
6278 $cat <<EOM
6279 Enter a colon-separated set of extra paths to include in perl's @INC
6280 search path, or enter 'none' for no extra paths.
6281
6282 EOM
6283
6284 rp='Colon-separated list of additional directories for perl to search?'
6285 . ./myread
6286 case "$ans" in
6287 ' '|''|none)    otherlibdirs=' ' ;;     
6288 *)      otherlibdirs="$ans" ;;
6289 esac
6290 case "$otherlibdirs" in
6291 ' ') val=$undef ;;
6292 *)      val=$define ;;
6293 esac
6294 set d_perl_otherlibdirs
6295 eval $setvar
6296
6297 : Cruising for prototypes
6298 echo " "
6299 echo "Checking out function prototypes..." >&4
6300 $cat >prototype.c <<'EOCP'
6301 int main(int argc, char *argv[]) {
6302         exit(0);}
6303 EOCP
6304 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
6305         echo "Your C compiler appears to support function prototypes."
6306         val="$define"
6307 else
6308         echo "Your C compiler doesn't seem to understand function prototypes."
6309         val="$undef"
6310 fi
6311 set prototype
6312 eval $setvar
6313 $rm -f prototype*
6314
6315 case "$prototype" in
6316 "$define") ;;
6317 *)      ansi2knr='ansi2knr'
6318         echo " "
6319         cat <<EOM >&4
6320
6321 $me:  FATAL ERROR:
6322 This version of $package can only be compiled by a compiler that 
6323 understands function prototypes.  Unfortunately, your C compiler 
6324         $cc $ccflags
6325 doesn't seem to understand them.  Sorry about that.
6326
6327 If GNU cc is available for your system, perhaps you could try that instead.  
6328
6329 Eventually, we hope to support building Perl with pre-ANSI compilers.
6330 If you would like to help in that effort, please contact <perlbug@perl.org>.
6331
6332 Aborting Configure now.
6333 EOM
6334         exit 2
6335         ;;
6336 esac
6337
6338 : determine where public executables go
6339 echo " "
6340 set dflt bin bin
6341 eval $prefixit
6342 fn=d~
6343 rp='Pathname where the public executables will reside?'
6344 . ./getfile
6345 if $test "X$ansexp" != "X$binexp"; then
6346         installbin=''
6347 fi
6348 bin="$ans"
6349 binexp="$ansexp"
6350 : Change installation prefix, if necessary.
6351 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
6352 if $test X"$prefix" != X"$installprefix"; then
6353         installbin=`echo $binexp | sed "s#^$prefix#$installprefix#"`
6354 else
6355         installbin="$binexp"
6356 fi
6357
6358 : Find perl5.005 or later.
6359 echo "Looking for a previously installed perl5.005 or later... "
6360 case "$perl5" in
6361 '')     for tdir in `echo "$binexp:$PATH" | $sed "s/$path_sep/ /g"`; do
6362                 : Check if this perl is recent and can load a simple module
6363                 if $test -x $tdir/perl && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6364                         perl5=$tdir/perl
6365                         break;
6366                 elif $test -x $tdir/perl5 && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6367                         perl5=$tdir/perl
6368                         break;
6369                 fi
6370         done
6371         ;;
6372 *)      perl5="$perl5"
6373         ;;
6374 esac
6375 case "$perl5" in
6376 '')     echo "None found.  That's ok.";;
6377 *)      echo "Using $perl5." ;;
6378 esac
6379
6380 : Determine list of previous versions to include in @INC
6381 $cat > getverlist <<EOPL
6382 #!$perl5 -w
6383 use File::Basename;
6384 \$api_versionstring = "$api_versionstring";
6385 \$version = "$version";
6386 \$stem = "$sitelib_stem";
6387 \$archname = "$archname";
6388 EOPL
6389         $cat >> getverlist <<'EOPL'
6390 # Can't have leading @ because metaconfig interprets it as a command!
6391 ;@inc_version_list=();
6392 # XXX Redo to do opendir/readdir? 
6393 if (-d $stem) {
6394     chdir($stem);
6395     ;@candidates = glob("5.*");
6396 }
6397 else {
6398     ;@candidates = ();
6399 }
6400
6401 # XXX ToDo:  These comparisons must be reworked when two-digit
6402 # subversions come along, so that 5.7.10 compares as greater than
6403 # 5.7.3!  By that time, hope that 5.6.x is sufficiently
6404 # widespread that we can use the built-in version vectors rather
6405 # than reinventing them here.  For 5.6.0, however, we must
6406 # assume this script will likely be run by 5.005_0x.  --AD 1/2000.
6407 foreach $d (@candidates) {
6408     if ($d lt $version) {
6409         if ($d ge $api_versionstring) {
6410             unshift(@inc_version_list, grep { -d } "$d/$archname", $d);
6411         }
6412         elsif ($d ge "5.005") {
6413             unshift(@inc_version_list, grep { -d } $d);
6414         }
6415     }
6416     else {
6417         # Skip newer version.  I.e. don't look in
6418         # 5.7.0 if we're installing 5.6.1.
6419     }
6420 }
6421
6422 if (@inc_version_list) {
6423     print join(' ', @inc_version_list);
6424 }
6425 else {
6426     # Blank space to preserve value for next Configure run.
6427     print " ";
6428 }
6429 EOPL
6430 chmod +x getverlist
6431 case "$inc_version_list" in
6432 '')     if test -x "$perl5"; then
6433                 dflt=`$perl5 getverlist`
6434         else
6435                 dflt='none'
6436         fi
6437         ;;
6438 $undef) dflt='none' ;;
6439 *)  dflt="$inc_version_list" ;;
6440 esac
6441 case "$dflt" in
6442 ''|' ') dflt=none ;;
6443 esac
6444 case "$dflt" in
6445 5.005) case "$bincompat5005" in
6446        $define|true|[yY]*) ;;
6447        *) dflt=none ;;
6448        esac
6449        ;;
6450 esac
6451 $cat <<'EOM'
6452
6453 In order to ease the process of upgrading, this version of perl 
6454 can be configured to use modules built and installed with earlier 
6455 versions of perl that were installed under $prefix.  Specify here
6456 the list of earlier versions that this version of perl should check.
6457 If Configure detected no earlier versions of perl installed under
6458 $prefix, then the list will be empty.  Answer 'none' to tell perl
6459 to not search earlier versions.
6460
6461 The default should almost always be sensible, so if you're not sure,
6462 just accept the default.
6463 EOM
6464
6465 rp='List of earlier versions to include in @INC?'
6466 . ./myread
6467 case "$ans" in
6468 [Nn]one|''|' ') inc_version_list=' ' ;;
6469 *) inc_version_list="$ans" ;;
6470 esac
6471 case "$inc_version_list" in
6472 ''|' ') 
6473         inc_version_list_init='0';;
6474 *)      inc_version_list_init=`echo $inc_version_list |
6475                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
6476         ;;
6477 esac
6478 $rm -f getverlist
6479
6480 : determine whether to install perl also as /usr/bin/perl
6481
6482 echo " "
6483 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
6484         $cat <<EOM
6485 Many scripts expect perl to be installed as /usr/bin/perl.
6486 I can install the perl you are about to compile also as /usr/bin/perl
6487 (in addition to $installbin/perl).
6488 EOM
6489         case "$installusrbinperl" in
6490         "$undef"|[nN]*) dflt='n';;
6491         *)              dflt='y';;
6492         esac
6493         rp="Do you want to install perl as /usr/bin/perl?"
6494         . ./myread
6495         case "$ans" in
6496         [yY]*)  val="$define";;
6497         *)      val="$undef" ;;
6498         esac
6499 else
6500         val="$undef"
6501 fi
6502 set installusrbinperl
6503 eval $setvar
6504
6505 : see if dld is available
6506 set dld.h i_dld
6507 eval $inhdr
6508
6509 : see if dlopen exists
6510 xxx_runnm="$runnm"
6511 runnm=false
6512 set dlopen d_dlopen
6513 eval $inlibc
6514 runnm="$xxx_runnm"
6515
6516 : determine which dynamic loading, if any, to compile in
6517 echo " "
6518 dldir="ext/DynaLoader"
6519 case "$usedl" in
6520 $define|y|true)
6521         dflt='y'
6522         usedl="$define"
6523         ;;
6524 $undef|n|false)
6525         dflt='n'
6526         usedl="$undef"
6527         ;;
6528 *) 
6529         dflt='n'
6530         case "$d_dlopen" in
6531             $define) dflt='y' ;;
6532         esac
6533         case "$i_dld" in
6534             $define) dflt='y' ;;
6535         esac
6536         : Does a dl_xxx.xs file exist for this operating system
6537         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
6538         ;;
6539 esac
6540 rp="Do you wish to use dynamic loading?"
6541 . ./myread
6542 usedl="$ans"
6543 case "$ans" in
6544 y*) usedl="$define"
6545         case "$dlsrc" in
6546         '')
6547                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
6548                         dflt="$dldir/dl_${osname}.xs"
6549                 elif $test "$d_dlopen" = "$define" ; then
6550                         dflt="$dldir/dl_dlopen.xs"
6551                 elif $test "$i_dld" = "$define" ; then
6552                         dflt="$dldir/dl_dld.xs"
6553                 else
6554                         dflt=''
6555                 fi
6556                 ;;
6557         *)      dflt="$dldir/$dlsrc"
6558                 ;;
6559         esac
6560     echo "The following dynamic loading files are available:"
6561         : Can not go over to $dldir because getfile has path hard-coded in.
6562         tdir=`pwd`; cd $rsrc; $ls -C $dldir/dl*.xs; cd $tdir
6563         rp="Source file to use for dynamic loading"
6564         fn="fne"
6565         gfpth="$src"
6566         . ./getfile
6567         usedl="$define"
6568         : emulate basename
6569         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
6570
6571         $cat << EOM
6572
6573 Some systems may require passing special flags to $cc -c to
6574 compile modules that will be used to create a shared library.
6575 To use no flags, say "none".
6576
6577 EOM
6578     case "$cccdlflags" in
6579     '') case "$gccversion" in
6580                 '') case "$osname" in
6581                         hpux)   dflt='+z' ;;
6582                         next)   dflt='none' ;;
6583                         irix*)  dflt='-KPIC' ;;
6584                         svr4*|esix*|solaris) dflt='-KPIC' ;;
6585                         sunos)  dflt='-pic' ;;
6586                         *)      dflt='none' ;;
6587                     esac
6588                         ;;
6589                 *)  case "$osname" in
6590                         svr4*|esix*|solaris) dflt='-fPIC' ;;
6591                         *)      dflt='-fpic' ;;
6592                     esac ;;
6593             esac ;;
6594         ' ') dflt='none' ;;
6595     *)  dflt="$cccdlflags" ;;
6596     esac
6597     rp="Any special flags to pass to $cc -c to compile shared library modules?"
6598     . ./myread
6599     case "$ans" in
6600     none) cccdlflags=' ' ;;
6601     *) cccdlflags="$ans" ;;
6602     esac
6603
6604     cat << EOM
6605
6606 Some systems use ld to create libraries that can be dynamically loaded,
6607 while other systems (such as those using ELF) use $cc.
6608
6609 EOM
6610         case "$ld" in
6611         '')     $cat >try.c <<'EOM'
6612 /* Test for whether ELF binaries are produced */
6613 #include <fcntl.h>
6614 #include <stdlib.h>
6615 int main() {
6616         char b[4];
6617         int i = open("a.out",O_RDONLY);
6618         if(i == -1) 
6619                 exit(1); /* fail */
6620         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
6621                 exit(0); /* succeed (yes, it's ELF) */
6622         else
6623                 exit(1); /* fail */
6624 }
6625 EOM
6626                 if $cc $ccflags try.c >/dev/null 2>&1 && ./a.out; then
6627                         cat <<EOM
6628 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
6629 EOM
6630                         dflt="$cc"
6631                 else
6632                         echo "I'll use ld to build dynamic libraries."
6633                         dflt='ld'
6634                 fi
6635                 rm -f try.c a.out
6636                 ;;
6637         *)      dflt="$ld"
6638                 ;;
6639         esac
6640
6641     rp="What command should be used to create dynamic libraries?"
6642     . ./myread
6643         ld="$ans"
6644
6645     cat << EOM
6646
6647 Some systems may require passing special flags to $ld to create a
6648 library that can be dynamically loaded.  If your ld flags include
6649 -L/other/path options to locate libraries outside your loader's normal
6650 search path, you may need to specify those -L options here as well.  To
6651 use no flags, say "none".
6652
6653 EOM
6654     case "$lddlflags" in
6655     '') case "$osname" in
6656                         beos) dflt='-nostart' ;;
6657                         hpux) dflt='-b';
6658                               case "$gccversion" in
6659                               '') dflt="$dflt +vnocompatwarnings" ;;
6660                               esac
6661                               ;;        
6662                         linux|irix*)    dflt='-shared' ;;
6663                         next)  dflt='none' ;;
6664                         solaris) dflt='-G' ;;
6665                         sunos) dflt='-assert nodefinitions' ;;
6666                         svr4*|esix*) dflt="-G $ldflags" ;;
6667                 *)     dflt='none' ;;
6668                         esac
6669                         ;;
6670     *) dflt="$lddlflags" ;;
6671     esac
6672
6673         : Try to guess additional flags to pick up local libraries.
6674         : Be careful not to append to a plain 'none'
6675         case "$dflt" in
6676         none) dflt='' ;;
6677         esac
6678         for thisflag in $ldflags; do
6679                 case "$thisflag" in
6680                 -L*|-R*)
6681                         case " $dflt " in
6682                         *" $thisflag "*) ;;
6683                         *) dflt="$dflt $thisflag" ;;
6684                         esac
6685                         ;;
6686                 esac
6687         done
6688
6689         case "$dflt" in
6690         ''|' ') dflt='none' ;;
6691         esac
6692
6693     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
6694     . ./myread
6695     case "$ans" in
6696     none) lddlflags=' ' ;;
6697     *) lddlflags="$ans" ;;
6698     esac
6699
6700         cat <<EOM
6701
6702 Some systems may require passing special flags to $cc to indicate that
6703 the resulting executable will use dynamic linking.  To use no flags,
6704 say "none".
6705
6706 EOM
6707     case "$ccdlflags" in
6708     '') case "$osname" in
6709                 hpux)   dflt='-Wl,-E' ;;
6710                 linux)  dflt='-rdynamic' ;;
6711                 next)   dflt='none' ;;
6712                 sunos)  dflt='none' ;;
6713                 *)      dflt='none' ;;
6714             esac ;;
6715     ' ')  dflt='none' ;;
6716     *)  dflt="$ccdlflags" ;;
6717     esac
6718     rp="Any special flags to pass to $cc to use dynamic linking?"
6719     . ./myread
6720     case "$ans" in
6721     none) ccdlflags=' ' ;;
6722     *) ccdlflags="$ans" ;;
6723     esac
6724     ;;
6725 *)  usedl="$undef"
6726         ld='ld'
6727     dlsrc='dl_none.xs'
6728     lddlflags=''
6729     ccdlflags=''
6730     ;;
6731 esac
6732
6733 also=''
6734 case "$usedl" in
6735 $undef)
6736         # No dynamic loading being used, so don't bother even to prompt.
6737         useshrplib='false'
6738         ;;
6739 *)      case "$useshrplib" in
6740         '')     case "$osname" in
6741                 svr4*|dgux|dynixptx|esix|powerux|beos|cygwin*)
6742                         dflt=y
6743                         also='Building a shared libperl is required for dynamic loading to work on your system.'
6744                         ;;
6745                 next*)
6746                         case "$osvers" in
6747                         4*)     dflt=y
6748                                 also='Building a shared libperl is needed for MAB support.'
6749                                 ;;
6750                         *)      dflt=n
6751                                 ;;
6752                         esac
6753                         ;;
6754                 *)      dflt=n
6755                         ;;
6756                 esac
6757                 ;;
6758         $define|true|[Yy]*)
6759                 dflt=y
6760                 ;;
6761         *)      dflt=n
6762                 ;;
6763         esac
6764         $cat << EOM
6765
6766 The perl executable is normally obtained by linking perlmain.c with
6767 libperl${_a}, any static extensions (usually just DynaLoader), and
6768 any other libraries needed on this system (such as -lm, etc.).  Since
6769 your system supports dynamic loading, it is probably possible to build
6770 a shared libperl.$so.  If you will have more than one executable linked
6771 to libperl.$so, this will significantly reduce the size of each
6772 executable, but it may have a noticeable affect on performance.  The
6773 default is probably sensible for your system.
6774 $also
6775
6776 EOM
6777         rp="Build a shared libperl.$so (y/n)"
6778         . ./myread
6779         case "$ans" in
6780         true|$define|[Yy]*)
6781                 useshrplib='true'  ;;
6782         *)      useshrplib='false' ;;
6783         esac
6784         ;;
6785 esac
6786
6787 case "$useshrplib" in
6788 true)
6789         case "$libperl" in
6790         '')
6791                 # Figure out a good name for libperl.so.  Since it gets stored in
6792                 # a version-specific architecture-dependent library, the version
6793                 # number isn't really that important, except for making cc/ld happy.
6794                 #
6795                 # A name such as libperl.so.3.1
6796                 majmin="libperl.$so.$patchlevel.$subversion"
6797                 # A name such as libperl.so.301
6798                 majonly=`echo $patchlevel $subversion |
6799                         $awk '{printf "%d%02d", $1, $2}'`
6800                 majonly=libperl.$so.$majonly
6801                 # I'd prefer to keep the os-specific stuff here to a minimum, and
6802                 # rely on figuring it out from the naming of libc.
6803                 case "${osname}${osvers}" in
6804                 next4*)
6805                         dflt=libperl.5.$so
6806                         # XXX How handle the --version stuff for MAB?
6807                         ;;
6808                 linux*)  # ld won't link with a bare -lperl otherwise.
6809                         dflt=libperl.$so
6810                         ;;
6811                 cygwin*) # include version
6812                         dflt=`echo libperl$version | sed -e 's/\./_/g'`$lib_ext
6813                         ;;
6814                 *)      # Try to guess based on whether libc has major.minor.
6815                         case "$libc" in
6816                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
6817                         *libc.$so.[0-9]*) dflt=$majonly ;;
6818                         *)      dflt=libperl.$so ;;
6819                         esac
6820                         ;;
6821                 esac
6822                 ;;
6823         *)      dflt=$libperl
6824                 ;;
6825         esac
6826         cat << EOM
6827
6828 I need to select a good name for the shared libperl.  If your system uses
6829 library names with major and minor numbers, then you might want something
6830 like $majmin.  Alternatively, if your system uses a single version
6831 number for shared libraries, then you might want to use $majonly.
6832 Or, your system might be quite happy with a simple libperl.$so.
6833
6834 Since the shared libperl will get installed into a version-specific
6835 architecture-dependent directory, the version number of the shared perl
6836 library probably isn't important, so the default should be o.k.
6837
6838 EOM
6839         rp='What name do you want to give to the shared libperl?'
6840         . ./myread
6841         libperl=$ans
6842         echo "Ok, I'll use $libperl"
6843         ;;
6844 *)
6845         libperl="libperl${_a}"
6846         ;;
6847 esac
6848
6849 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
6850 case "$shrpdir" in
6851 '') ;;
6852 *)      $cat >&4 <<EOM
6853 WARNING:  Use of the shrpdir variable for the installation location of
6854 the shared $libperl is not supported.  It was never documented and
6855 will not work in this version.  Let me (perlbug@perl.org)
6856 know of any problems this may cause.
6857
6858 EOM
6859         case "$shrpdir" in
6860         "$archlibexp/CORE")
6861                 $cat >&4 <<EOM
6862 But your current setting of $shrpdir is
6863 the default anyway, so it's harmless.
6864 EOM
6865                 ;;
6866         *)
6867                 $cat >&4 <<EOM
6868 Further, your current attempted setting of $shrpdir
6869 conflicts with the value of $archlibexp/CORE
6870 that installperl will use.
6871 EOM
6872                 ;;
6873         esac
6874         ;;
6875 esac
6876
6877 # How will the perl executable find the installed shared $libperl?
6878 # Add $xxx to ccdlflags.
6879 # If we can't figure out a command-line option, use $shrpenv to
6880 # set env LD_RUN_PATH.  The main perl makefile uses this.
6881 shrpdir=$archlibexp/CORE
6882 xxx=''
6883 tmp_shrpenv=''
6884 if "$useshrplib"; then
6885     case "$osname" in 
6886         aix)
6887                 # We'll set it in Makefile.SH...
6888                 ;;
6889         solaris|netbsd)
6890                 xxx="-R $shrpdir"
6891                 ;;
6892         freebsd)
6893                 xxx="-Wl,-R$shrpdir"
6894                 ;;
6895         linux|irix*|dec_osf)
6896                 xxx="-Wl,-rpath,$shrpdir"
6897                 ;;
6898         next)
6899                 # next doesn't like the default...
6900                 ;;
6901         beos)
6902                 # beos doesn't like the default, either.
6903                 ;;
6904         hpux*)
6905                 # hpux doesn't like the default, either.
6906                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
6907                 ;;
6908         *)
6909                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
6910                 ;;
6911         esac
6912         case "$xxx" in
6913         '') ;;
6914         *)      
6915                 # Only add $xxx if it isn't already in ccdlflags.
6916                 case " $ccdlflags " in
6917                 *" $xxx "*)     ;;
6918                 *)      ccdlflags="$ccdlflags $xxx"
6919                         cat <<EOM >&4
6920
6921 Adding $xxx to the flags
6922 passed to $ld so that the perl executable will find the 
6923 installed shared $libperl.
6924
6925 EOM
6926                         ;;
6927                 esac
6928                 ;;
6929         esac
6930 fi
6931 # Fix ccdlflags in AIX for building external extensions.
6932 # (For building Perl itself bare -bE:perl.exp is needed,
6933 #  Makefile.SH takes care of this.)
6934 case "$osname" in
6935 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
6936 esac
6937 # Respect a hint or command-line value.
6938 case "$shrpenv" in
6939 '') shrpenv="$tmp_shrpenv" ;;
6940 esac
6941 case "$ldlibpthname" in
6942 '')     ldlibpthname=LD_LIBRARY_PATH ;;
6943 none)   ldlibpthname='' ;;
6944 esac
6945
6946 : determine where manual pages go
6947 set man1dir man1dir none
6948 eval $prefixit
6949 $cat <<EOM
6950
6951 $spackage has manual pages available in source form.
6952 EOM
6953 case "$nroff" in
6954 nroff)
6955         echo "However, you don't have nroff, so they're probably useless to you."
6956         case "$man1dir" in
6957         '') man1dir="none";;
6958         esac;;
6959 esac
6960 echo "If you don't want the manual sources installed, answer 'none'."
6961 case "$man1dir" in
6962 ' ') dflt=none
6963         ;;
6964 '')
6965         lookpath="$prefixexp/man/man1 $prefixexp/man/l_man/man1"
6966         lookpath="$lookpath $prefixexp/man/p_man/man1"
6967         lookpath="$lookpath $prefixexp/man/u_man/man1"
6968         lookpath="$lookpath $prefixexp/man/man.1"
6969         case "$sysman" in
6970         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
6971         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
6972         esac
6973         set dflt
6974         eval $prefixup
6975         ;;
6976 *)  dflt="$man1dir"
6977         ;;
6978 esac
6979 echo " "
6980 fn=dn+~
6981 rp="Where do the main $spackage manual pages (source) go?"
6982 . ./getfile
6983 if $test "X$man1direxp" != "X$ansexp"; then
6984         installman1dir=''
6985 fi
6986 man1dir="$ans"
6987 man1direxp="$ansexp"
6988 case "$man1dir" in
6989 '')     man1dir=' '
6990         installman1dir='';;
6991 esac
6992
6993 : Change installation prefix, if necessary.
6994 if $test X"$prefix" != X"$installprefix"; then
6995         installman1dir=`echo $man1direxp | $sed "s#^$prefix#$installprefix#"`
6996 else
6997         installman1dir="$man1direxp"
6998 fi
6999
7000 : What suffix to use on installed man pages
7001
7002 case "$man1dir" in
7003 ' ')
7004         man1ext='0'
7005         ;;
7006 *)
7007         rp="What suffix should be used for the main $spackage man pages?"
7008         case "$man1ext" in
7009         '')     case "$man1dir" in
7010                 *1)  dflt=1 ;;
7011                 *1p) dflt=1p ;;
7012                 *1pm) dflt=1pm ;;
7013                 *l) dflt=l;;
7014                 *n) dflt=n;;
7015                 *o) dflt=o;;
7016                 *p) dflt=p;;
7017                 *C) dflt=C;;
7018                 *L) dflt=L;;
7019                 *L1) dflt=L1;;
7020                 *) dflt=1;;
7021                 esac
7022                 ;;
7023         *)      dflt="$man1ext";;
7024         esac
7025         . ./myread
7026         man1ext="$ans"
7027         ;;
7028 esac
7029
7030 : see if we can have long filenames
7031 echo " "
7032 first=123456789abcdef
7033 $rm -f $first
7034 if (echo hi >$first) 2>/dev/null; then
7035         if $test -f 123456789abcde; then
7036                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
7037                 val="$undef"
7038         else
7039                 echo 'You can have filenames longer than 14 characters.'>&4
7040                 val="$define"
7041         fi
7042 else
7043         $cat <<'EOM'
7044 You can't have filenames longer than 14 chars.
7045 You can't even think about them!
7046 EOM
7047         val="$undef"
7048 fi 
7049 set d_flexfnam
7050 eval $setvar
7051 $rm -rf 123456789abcde*
7052
7053 : determine where library module manual pages go
7054 set man3dir man3dir none
7055 eval $prefixit
7056 $cat <<EOM
7057
7058 $spackage has manual pages for many of the library modules.
7059 EOM
7060
7061 case "$nroff" in
7062 nroff)
7063         $cat <<'EOM'
7064 However, you don't have nroff, so they're probably useless to you.
7065 EOM
7066         case "$man3dir" in
7067         '') man3dir="none";;
7068         esac;;
7069 esac
7070
7071 case "$d_flexfnam" in
7072 undef)
7073         $cat <<'EOM'
7074 However, your system can't handle the long file names like File::Basename.3. 
7075 EOM
7076         case "$man3dir" in
7077         '') man3dir="none";;
7078         esac;;
7079 esac
7080
7081 echo "If you don't want the manual sources installed, answer 'none'."
7082 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
7083 case "$man3dir" in
7084 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
7085         if $test -d "$privlib/man/man3"; then
7086                 cat <<EOM >&4
7087
7088 WARNING:  Previous versions of perl installed man3 pages into
7089 $privlib/man/man3.  This version will suggest a 
7090 new default of $dflt.  
7091 EOM
7092                 tdflt=$dflt
7093                 dflt='n'
7094                 rp='Do you wish to preserve the old behavior?(y/n)'
7095                 . ./myread
7096                 case "$ans" in
7097                 y*) dflt="$privlib/man/man3" ;;
7098                 *)  dflt=$tdflt ;;
7099                 esac
7100     fi
7101         ;;
7102 *)      dflt="$man3dir" ;;
7103 esac
7104 case "$dflt" in
7105 ' ') dflt=none ;;
7106 esac
7107 echo " "
7108 fn=dn+~
7109 rp="Where do the $package library man pages (source) go?"
7110 . ./getfile
7111 man3dir="$ans"
7112 man3direxp="$ansexp"
7113 case "$man3dir" in
7114 '')     man3dir=' '
7115         installman3dir='';;
7116 esac
7117
7118 : Change installation prefix, if necessary.
7119 if $test X"$prefix" != X"$installprefix"; then
7120         installman3dir=`echo $man3direxp | $sed "s#^$prefix#$installprefix#"`
7121 else
7122         installman3dir="$man3direxp"
7123 fi
7124
7125 : What suffix to use on installed man pages
7126 case "$man3dir" in
7127 ' ')
7128         man3ext='0'
7129         ;;
7130 *)
7131         rp="What suffix should be used for the $package library man pages?"
7132         case "$man3ext" in
7133         '')     case "$man3dir" in
7134                 *3)  dflt=3 ;;
7135                 *3p) dflt=3p ;;
7136                 *3pm) dflt=3pm ;;
7137                 *l) dflt=l;;
7138                 *n) dflt=n;;
7139                 *o) dflt=o;;
7140                 *p) dflt=p;;
7141                 *C) dflt=C;;
7142                 *L) dflt=L;;
7143                 *L3) dflt=L3;;
7144                 *) dflt=3;;
7145                 esac
7146                 ;;
7147         *)      dflt="$man3ext";;
7148         esac
7149         . ./myread
7150         man3ext="$ans"
7151         ;;
7152 esac
7153
7154 : see if we have to deal with yellow pages, now NIS.
7155 if $test -d /usr/etc/yp || $test -d /etc/yp; then
7156         if $test -f /usr/etc/nibindd; then
7157                 echo " "
7158                 echo "I'm fairly confident you're on a NeXT."
7159                 echo " "
7160                 rp='Do you get the hosts file via NetInfo?'
7161                 dflt=y
7162                 case "$hostcat" in
7163                 nidump*) ;;
7164                 '') ;;
7165                 *) dflt=n;;
7166                 esac
7167                 . ./myread
7168                 case "$ans" in
7169                 y*) hostcat='nidump hosts .';;
7170                 *)      case "$hostcat" in
7171                         nidump*) hostcat='';;
7172                         esac
7173                         ;;
7174                 esac
7175         fi
7176         case "$hostcat" in
7177         nidump*) ;;
7178         *)
7179                 case "$hostcat" in
7180                 *ypcat*) dflt=y;;
7181                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
7182                                 dflt=y
7183                         else
7184                                 dflt=n
7185                         fi;;
7186                 *) dflt=n;;
7187                 esac
7188                 echo " "
7189                 rp='Are you getting the hosts file via yellow pages?'
7190                 . ./myread
7191                 case "$ans" in
7192                 y*) hostcat='ypcat hosts';;
7193                 *) hostcat='cat /etc/hosts';;
7194                 esac
7195                 ;;
7196         esac
7197 fi
7198 case "$hostcat" in
7199 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
7200 esac
7201 case "$groupcat" in
7202 '') test -f /etc/group && groupcat='cat /etc/group';;
7203 esac
7204 case "$passcat" in
7205 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
7206 esac
7207
7208 : now get the host name
7209 echo " "
7210 echo "Figuring out host name..." >&4
7211 case "$myhostname" in
7212 '') cont=true
7213         echo 'Maybe "hostname" will work...'
7214         if tans=`sh -c hostname 2>&1` ; then
7215                 myhostname=$tans
7216                 phostname=hostname
7217                 cont=''
7218         fi
7219         ;;
7220 *) cont='';;
7221 esac
7222 if $test "$cont"; then
7223         if ./xenix; then
7224                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
7225                 if tans=`cat /etc/systemid 2>&1` ; then
7226                         myhostname=$tans
7227                         phostname='cat /etc/systemid'
7228                         echo "Whadyaknow.  Xenix always was a bit strange..."
7229                         cont=''
7230                 fi
7231         elif $test -r /etc/systemid; then
7232                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
7233         fi
7234 fi
7235 if $test "$cont"; then
7236         echo 'No, maybe "uuname -l" will work...'
7237         if tans=`sh -c 'uuname -l' 2>&1` ; then
7238                 myhostname=$tans
7239                 phostname='uuname -l'
7240         else
7241                 echo 'Strange.  Maybe "uname -n" will work...'
7242                 if tans=`sh -c 'uname -n' 2>&1` ; then
7243                         myhostname=$tans
7244                         phostname='uname -n'
7245                 else
7246                         echo 'Oh well, maybe I can mine it out of whoami.h...'
7247                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
7248                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
7249                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
7250                         else
7251                                 case "$myhostname" in
7252                                 '') echo "Does this machine have an identity crisis or something?"
7253                                         phostname='';;
7254                                 *)
7255                                         echo "Well, you said $myhostname before..."
7256                                         phostname='echo $myhostname';;
7257                                 esac
7258                         fi
7259                 fi
7260         fi
7261 fi
7262 : you do not want to know about this
7263 set $myhostname
7264 myhostname=$1
7265
7266 : verify guess
7267 if $test "$myhostname" ; then
7268         dflt=y
7269         rp='Your host name appears to be "'$myhostname'".'" Right?"
7270         . ./myread
7271         case "$ans" in
7272         y*) ;;
7273         *) myhostname='';;
7274         esac
7275 fi
7276
7277 : bad guess or no guess
7278 while $test "X$myhostname" = X ; do
7279         dflt=''
7280         rp="Please type the (one word) name of your host:"
7281         . ./myread
7282         myhostname="$ans"
7283 done
7284
7285 : translate upper to lower if necessary
7286 case "$myhostname" in
7287 *[A-Z]*)
7288         echo "(Normalizing case in your host name)"
7289         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
7290         ;;
7291 esac
7292
7293 case "$myhostname" in
7294 *.*)
7295         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
7296         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
7297         echo "(Trimming domain name from host name--host name is now $myhostname)"
7298         ;;
7299 *) case "$mydomain" in
7300         '')
7301                 {
7302                         test "X$hostcat" = "Xypcat hosts" &&
7303                         ypmatch "$myhostname" hosts 2>/dev/null |\
7304                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
7305                         $test -s hosts
7306                 } || {
7307                         test "X$hostcat" != "X" &&
7308                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
7309                                         /[       ]$myhostname[  . ]/p" > hosts
7310                 }
7311                 tmp_re="[       . ]"
7312                 $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
7313                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
7314                 dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
7315                         hosts | $sort | $uniq | \
7316                         $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
7317                 case `$echo X$dflt` in
7318                 X*\ *)  echo "(Several hosts in /etc/hosts matched hostname)"
7319                         dflt=.
7320                         ;;
7321                 X.) echo "(You do not have fully-qualified names in /etc/hosts)"
7322                         ;;
7323                 esac
7324                 case "$dflt" in
7325                 .)
7326                         tans=`./loc resolv.conf X /etc /usr/etc`
7327                         if $test -f "$tans"; then
7328                                 echo "(Attempting domain name extraction from $tans)"
7329                                 dflt=.`$sed -n -e 's/   / /g' \
7330                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
7331                                   | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
7332                                 case "$dflt" in
7333                                 .) dflt=.`$sed -n -e 's/        / /g' \
7334                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
7335                                      | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
7336                                         ;;
7337                                 esac
7338                         fi
7339                         ;;
7340                 esac
7341                 case "$dflt" in
7342                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
7343                         dflt=.`sh -c domainname 2>/dev/null`
7344                         case "$dflt" in
7345                         '') dflt='.';;
7346                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
7347                         esac
7348                         ;;
7349                 esac
7350                 case "$dflt" in
7351                 .) echo "(Lost all hope -- silly guess then)"
7352                         dflt='.uucp'
7353                         ;;
7354                 esac
7355                 $rm -f hosts
7356                 ;;
7357         *) dflt="$mydomain";;
7358         esac;;
7359 esac
7360 echo " "
7361 rp="What is your domain name?"
7362 . ./myread
7363 tans="$ans"
7364 case "$ans" in
7365 '') ;;
7366 .*) ;;
7367 *) tans=".$tans";;
7368 esac
7369 mydomain="$tans"
7370
7371 : translate upper to lower if necessary
7372 case "$mydomain" in
7373 *[A-Z]*)
7374         echo "(Normalizing case in your domain name)"
7375         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
7376         ;;
7377 esac
7378
7379 : a little sanity check here
7380 case "$phostname" in
7381 '') ;;
7382 *)
7383         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
7384         $myhostname$mydomain|$myhostname) ;;
7385         *)
7386                 case "$phostname" in
7387                 sed*)
7388                         echo "(That doesn't agree with your whoami.h file, by the way.)"
7389                         ;;
7390                 *)
7391                         echo "(That doesn't agree with your $phostname command, by the way.)"
7392                         ;;
7393                 esac
7394         ;;
7395         esac
7396         ;;
7397 esac
7398
7399 $cat <<EOM
7400
7401 I need to get your e-mail address in Internet format if possible, i.e.
7402 something like user@host.domain. Please answer accurately since I have
7403 no easy means to double check it. The default value provided below
7404 is most probably close to reality but may not be valid from outside
7405 your organization...
7406
7407 EOM
7408 cont=x
7409 while test "$cont"; do
7410         case "$cf_email" in
7411         '') dflt="$cf_by@$myhostname$mydomain";;
7412         *) dflt="$cf_email";;
7413         esac
7414         rp='What is your e-mail address?'
7415         . ./myread
7416         cf_email="$ans"
7417         case "$cf_email" in
7418         *@*.*) cont='' ;;
7419         *)
7420                 rp='Address does not look like an Internet one.  Use it anyway?'
7421                 case "$fastread" in
7422                 yes) dflt=y ;;
7423                 *) dflt=n ;;
7424                 esac
7425                 . ./myread
7426                 case "$ans" in
7427                 y*) cont='' ;;
7428                 *) echo " " ;;
7429                 esac
7430                 ;;
7431         esac
7432 done
7433
7434 $cat <<EOM
7435
7436 If you or somebody else will be maintaining perl at your site, please
7437 fill in the correct e-mail address here so that they may be contacted
7438 if necessary. Currently, the "perlbug" program included with perl
7439 will send mail to this address in addition to perlbug@perl.org. You may
7440 enter "none" for no administrator.
7441
7442 EOM
7443 case "$perladmin" in
7444 '') dflt="$cf_email";;
7445 *) dflt="$perladmin";;
7446 esac
7447 rp='Perl administrator e-mail address'
7448 . ./myread
7449 perladmin="$ans"
7450
7451 : figure out how to guarantee perl startup
7452 case "$startperl" in
7453 '')
7454         case "$sharpbang" in
7455         *!)
7456                 $cat <<EOH
7457
7458 I can use the #! construct to start perl on your system. This will
7459 make startup of perl scripts faster, but may cause problems if you
7460 want to share those scripts and perl is not in a standard place
7461 ($binexp/perl) on all your platforms. The alternative is to force
7462 a shell by starting the script with a single ':' character.
7463
7464 EOH
7465                 dflt="$binexp/perl"
7466                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
7467                 . ./myread
7468                 case "$ans" in
7469                 none)   startperl=": # use perl";;
7470                 *)      startperl="#!$ans"
7471                         if $test 30 -lt `echo "$ans" | wc -c`; then
7472                                 $cat >&4 <<EOM
7473
7474 WARNING:  Some systems limit the #! command to 32 characters.
7475 If you experience difficulty running Perl scripts with #!, try
7476 installing Perl in a directory with a shorter pathname.
7477
7478 EOM
7479                         fi ;;
7480                 esac
7481                 ;;
7482         *) startperl=": # use perl"
7483                 ;;
7484         esac
7485         ;;
7486 esac
7487 echo "I'll use $startperl to start perl scripts."
7488
7489 : figure best path for perl in scripts
7490 case "$perlpath" in
7491 '')
7492         perlpath="$binexp/perl"
7493         case "$startperl" in
7494         *!*) ;;
7495         *)
7496                 $cat <<EOH
7497
7498 I will use the "eval 'exec'" idiom to start Perl on your system.
7499 I can use the full path of your Perl binary for this purpose, but
7500 doing so may cause problems if you want to share those scripts and
7501 Perl is not always in a standard place ($binexp/perl).
7502
7503 EOH
7504                 dflt="$binexp/perl"
7505                 rp="What path shall I use in \"eval 'exec'\"?"
7506                 . ./myread
7507                 perlpath="$ans"
7508                 ;;
7509         esac
7510         ;;
7511 esac
7512 case "$startperl" in
7513 *!*)    ;;
7514 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
7515 esac
7516
7517 : determine where public executable scripts go
7518 set scriptdir scriptdir
7519 eval $prefixit
7520 case "$scriptdir" in
7521 '')
7522         dflt="$bin"
7523         : guess some guesses
7524         $test -d /usr/share/scripts && dflt=/usr/share/scripts
7525         $test -d /usr/share/bin     && dflt=/usr/share/bin
7526         $test -d /usr/local/script  && dflt=/usr/local/script
7527         $test -d /usr/local/scripts && dflt=/usr/local/scripts
7528         $test -d $prefixexp/script  && dflt=$prefixexp/script
7529         set dflt
7530         eval $prefixup
7531         ;;
7532 *)  dflt="$scriptdir"
7533         ;;
7534 esac
7535 $cat <<EOM
7536  
7537 Some installations have a separate directory just for executable scripts so
7538 that they can mount it across multiple architectures but keep the scripts in
7539 one spot.  You might, for example, have a subdirectory of /usr/share for this.
7540 Or you might just lump your scripts in with all your other executables.
7541  
7542 EOM
7543 fn=d~
7544 rp='Where do you keep publicly executable scripts?'
7545 . ./getfile
7546 if $test "X$ansexp" != "X$scriptdirexp"; then
7547         installscript=''
7548 fi
7549 scriptdir="$ans"
7550 scriptdirexp="$ansexp"
7551 : Change installation prefix, if necessary.
7552 if $test X"$prefix" != X"$installprefix"; then
7553         installscript=`echo $scriptdirexp | sed "s#^$prefix#$installprefix#"`
7554 else
7555         installscript="$scriptdirexp"
7556 fi
7557
7558 : determine where add-on public executables go
7559 case "$sitebin" in
7560 '')     dflt=$siteprefix/bin ;;
7561 *)      dflt=$sitebin ;;
7562 esac
7563 fn=d~
7564 rp='Pathname where the add-on public executables should be installed?'
7565 . ./getfile
7566 sitebin="$ans"
7567 sitebinexp="$ansexp"
7568 : Change installation prefix, if necessary.
7569 if $test X"$prefix" != X"$installprefix"; then
7570         installsitebin=`echo $sitebinexp | sed "s#^$prefix#$installprefix#"`
7571 else
7572         installsitebin="$sitebinexp"
7573 fi
7574
7575 case "$useperlio" in
7576 $define|true|[yY]*)     dflt='y';;
7577 *) dflt='n';;
7578 esac
7579 cat <<EOM
7580
7581 Previous version of $package used the standard IO mechanisms as defined
7582 in <stdio.h>.  Versions 5.003_02 and later of perl allow alternate IO
7583 mechanisms via a "PerlIO" abstraction, but the stdio mechanism is still
7584 the default.  This abstraction layer can use AT&T's sfio (if you already
7585 have sfio installed) or regular stdio.  Using PerlIO with sfio may cause
7586 problems with some extension modules.  Using PerlIO with stdio is safe,
7587 but it is slower than plain stdio and therefore is not the default.
7588
7589 If this doesn't make any sense to you, just accept the default '$dflt'.
7590 EOM
7591 rp='Use the experimental PerlIO abstraction layer?'
7592 . ./myread
7593 case "$ans" in
7594 y|Y) 
7595         val="$define"
7596         ;;     
7597 *)      
7598         echo "Ok, doing things the stdio way"
7599         val="$undef"
7600         ;;
7601 esac
7602 set useperlio
7603 eval $setvar 
7604
7605 case "$vendorprefix" in
7606 '')     d_vendorbin="$undef"
7607         vendorbin=''
7608         vendorbinexp=''
7609         ;;
7610 *)      d_vendorbin="$define"
7611         : determine where vendor-supplied executables go.
7612         case "$vendorbin" in
7613         '') dflt=$vendorprefix/bin ;;
7614         *)      dflt="$vendorbin" ;;
7615         esac
7616         fn=d~+
7617         rp='Pathname for the vendor-supplied executables directory?'
7618         . ./getfile
7619         vendorbin="$ans"
7620         vendorbinexp="$ansexp"
7621         ;;
7622 esac
7623 : Change installation prefix, if necessary.
7624 if $test X"$prefix" != X"$installprefix"; then
7625         installvendorbin=`echo $vendorbinexp | $sed "s#^$prefix#$installprefix#"`
7626 else
7627         installvendorbin="$vendorbinexp"
7628 fi
7629
7630 : see if qgcvt exists
7631 set qgcvt d_qgcvt
7632 eval $inlibc
7633
7634 echo " "
7635
7636 if $test X"$d_longdbl" = X"$define"; then
7637
7638 echo "Checking how to print long doubles..." >&4
7639
7640 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
7641         $cat >try.c <<'EOCP'
7642 #include <sys/types.h>
7643 #include <stdio.h>
7644 int main() {
7645   double d = 123.456;
7646   printf("%.3f\n", d);
7647 }
7648 EOCP
7649         set try
7650         if eval $compile; then
7651                 yyy=`./try$exe_ext`
7652                 case "$yyy" in
7653                 123.456)
7654                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
7655                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
7656                         echo "We will use %f."
7657                         ;;
7658                 esac
7659         fi
7660 fi
7661
7662 if $test X"$sPRIfldbl" = X; then
7663         $cat >try.c <<'EOCP'
7664 #include <sys/types.h>
7665 #include <stdio.h>
7666 int main() {
7667   long double d = 123.456;
7668   printf("%.3llf\n", d);
7669 }
7670 EOCP
7671         set try
7672         if eval $compile; then
7673                 yyy=`./try$exe_ext`
7674                 case "$yyy" in
7675                 123.456)
7676                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
7677                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
7678                         echo "We will use %llf."
7679                         ;;
7680                 esac
7681         fi
7682 fi
7683
7684 if $test X"$sPRIfldbl" = X; then
7685         $cat >try.c <<'EOCP'
7686 #include <sys/types.h>
7687 #include <stdio.h>
7688 int main() {
7689   long double d = 123.456;
7690   printf("%.3Lf\n", d);
7691 }
7692 EOCP
7693         set try
7694         if eval $compile; then
7695                 yyy=`./try$exe_ext`
7696                 case "$yyy" in
7697                 123.456)
7698                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
7699                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
7700                         echo "We will use %Lf."
7701                         ;;
7702                 esac
7703         fi
7704 fi
7705
7706 if $test X"$sPRIfldbl" = X; then
7707         $cat >try.c <<'EOCP'
7708 #include <sys/types.h>
7709 #include <stdio.h>
7710 int main() {
7711   long double d = 123.456;
7712   printf("%.3lf\n", d);
7713 }
7714 EOCP
7715         set try
7716         if eval $compile; then
7717                 yyy=`./try$exe_ext`
7718                 case "$yyy" in
7719                 123.456)
7720                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
7721                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
7722                         echo "We will use %lf."
7723                         ;;
7724                 esac
7725         fi
7726 fi
7727
7728 if $test X"$sPRIfldbl" = X; then
7729         echo "Cannot figure out how to print long doubles." >&4
7730 else
7731         sSCNfldbl=$sPRIfldbl    # expect consistency
7732 fi
7733
7734 $rm -f try try.*
7735
7736 fi # d_longdbl
7737
7738 case "$sPRIfldbl" in
7739 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef"; 
7740         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef"; 
7741         d_SCNfldbl="$undef";
7742         ;;
7743 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define"; 
7744         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define"; 
7745         d_SCNfldbl="$define";
7746         ;;
7747 esac
7748
7749 : Check how to convert floats to strings.
7750 echo " "
7751 echo "Checking for an efficient way to convert floats to strings."
7752 echo " " > try.c
7753 case "$uselongdouble" in
7754 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
7755 esac
7756 case "$d_longdbl" in
7757 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
7758 esac
7759 case "$d_PRIgldbl" in
7760 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
7761 esac
7762 $cat >>try.c <<EOP
7763 #ifdef TRY_gconvert
7764 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
7765 char *myname = "gconvert";
7766 #endif
7767 #ifdef TRY_gcvt
7768 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
7769 char *myname = "gcvt";
7770 #endif
7771 #ifdef TRY_qgcvt
7772 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
7773 char *myname = "qgcvt";
7774 #define DOUBLETYPE long double
7775 #endif
7776 #ifdef TRY_sprintf
7777 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE) && defined(HAS_PRIgldbl)
7778 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
7779 #else
7780 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
7781 #endif
7782 char *myname = "sprintf";
7783 #endif
7784
7785 #ifndef DOUBLETYPE
7786 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
7787 #define DOUBLETYPE long double
7788 #else
7789 #define DOUBLETYPE double
7790 #endif
7791 #endif
7792
7793 #include <stdio.h>
7794
7795 #define I_STDLIB $i_stdlib
7796 #ifdef I_STDLIB
7797 #include <stdlib.h>
7798 #endif
7799
7800 int
7801 checkit(expect, got)
7802 char *expect;
7803 char *got;
7804 {
7805     if (strcmp(expect, got)) {
7806                 printf("%s oddity:  Expected %s, got %s\n",
7807                         myname, expect, got);
7808                 exit(1);
7809         }
7810 }
7811
7812 int main()
7813
7814         char buf[64]; 
7815         buf[63] = '\0';
7816
7817         /* This must be 1st test on (which?) platform */
7818         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
7819         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
7820         checkit("0.1", buf);
7821
7822         Gconvert((DOUBLETYPE)1.0, 8, 0, buf); 
7823         checkit("1", buf);
7824
7825         Gconvert((DOUBLETYPE)1.1, 8, 0, buf); 
7826         checkit("1.1", buf);
7827
7828         Gconvert((DOUBLETYPE)1.01, 8, 0, buf); 
7829         checkit("1.01", buf);
7830
7831         Gconvert((DOUBLETYPE)1.001, 8, 0, buf); 
7832         checkit("1.001", buf);
7833
7834         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf); 
7835         checkit("1.0001", buf);
7836
7837         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf); 
7838         checkit("1.00001", buf);
7839
7840         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf); 
7841         checkit("1.000001", buf);
7842
7843         Gconvert((DOUBLETYPE)0.0, 8, 0, buf); 
7844         checkit("0", buf);
7845
7846         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf); 
7847         checkit("-1", buf);
7848
7849         /* Some Linux gcvt's give 1.e+5 here. */
7850         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf); 
7851         checkit("100000", buf);
7852         
7853         /* Some Linux gcvt's give -1.e+5 here. */
7854         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf); 
7855         checkit("-100000", buf);
7856
7857         Gconvert((DOUBLETYPE)123.456, 8, 0, buf); 
7858         checkit("123.456", buf);
7859
7860         exit(0);
7861 }
7862 EOP
7863 case "$d_Gconvert" in
7864 gconvert*) xxx_list='gconvert gcvt sprintf' ;;
7865 gcvt*) xxx_list='gcvt gconvert sprintf' ;;
7866 sprintf*) xxx_list='sprintf gconvert gcvt' ;;
7867 *) xxx_list='gconvert gcvt sprintf' ;;
7868 esac
7869
7870 case "$d_longdbl$uselongdouble$d_PRIgldbl" in
7871 "$define$define$define")
7872     # for long doubles prefer first qgcvt, then sprintf
7873     xxx_list="`echo $xxx_list|sed s/sprintf//`" 
7874     xxx_list="sprintf $xxx_list"
7875     case "$d_qgcvt" in
7876     "$define") xxx_list="qgcvt $xxx_list" ;;
7877     esac
7878     ;;
7879 esac
7880
7881 for xxx_convert in $xxx_list; do
7882         echo "Trying $xxx_convert..."
7883         $rm -f try try$_o
7884         set try -DTRY_$xxx_convert
7885         if eval $compile; then
7886                 echo "$xxx_convert() found." >&4
7887                 if ./try; then
7888                         echo "I'll use $xxx_convert to convert floats into a string." >&4
7889                         break;
7890                 else
7891                         echo "...But $xxx_convert didn't work as I expected."
7892                 fi
7893         else
7894                 echo "$xxx_convert NOT found." >&4
7895         fi
7896 done
7897         
7898 case "$xxx_convert" in
7899 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
7900 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
7901 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
7902 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
7903    "$define$define$define")
7904       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
7905    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
7906    esac
7907    ;;  
7908 esac
7909
7910 : Initialize h_fcntl
7911 h_fcntl=false
7912
7913 : Initialize h_sysfile
7914 h_sysfile=false
7915
7916 : access call always available on UNIX
7917 set access d_access
7918 eval $inlibc
7919
7920 : locate the flags for 'access()'
7921 case "$d_access" in
7922 "$define")
7923         echo " "
7924         $cat >access.c <<'EOCP'
7925 #include <sys/types.h>
7926 #ifdef I_FCNTL
7927 #include <fcntl.h>
7928 #endif
7929 #ifdef I_SYS_FILE
7930 #include <sys/file.h>
7931 #endif
7932 #ifdef I_UNISTD
7933 #include <unistd.h>
7934 #endif
7935 int main() {
7936         exit(R_OK);
7937 }
7938 EOCP
7939         : check sys/file.h first, no particular reason here
7940         if $test `./findhdr sys/file.h` && \
7941                 $cc $cppflags -DI_SYS_FILE -o access access.c >/dev/null 2>&1 ; then
7942                 h_sysfile=true;
7943                 echo "<sys/file.h> defines the *_OK access constants." >&4
7944         elif $test `./findhdr fcntl.h` && \
7945                 $cc $cppflags -DI_FCNTL -o access access.c >/dev/null 2>&1 ; then
7946                 h_fcntl=true;
7947                 echo "<fcntl.h> defines the *_OK access constants." >&4
7948         elif $test `./findhdr unistd.h` && \
7949                 $cc $cppflags -DI_UNISTD -o access access.c >/dev/null 2>&1 ; then
7950                 echo "<unistd.h> defines the *_OK access constants." >&4
7951         else
7952                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
7953         fi
7954         ;;
7955 esac
7956 $rm -f access*
7957
7958 : see if accessx exists
7959 set accessx d_accessx
7960 eval $inlibc
7961
7962 : see if alarm exists
7963 set alarm d_alarm
7964 eval $inlibc
7965
7966 : see if atolf exists
7967 set atolf d_atolf
7968 eval $inlibc
7969
7970 : see if atoll exists
7971 set atoll d_atoll
7972 eval $inlibc
7973
7974 : Look for GNU-cc style attribute checking
7975 echo " "
7976 echo "Checking whether your compiler can handle __attribute__ ..." >&4
7977 $cat >attrib.c <<'EOCP'
7978 #include <stdio.h>
7979 void croak (char* pat,...) __attribute__((format(printf,1,2),noreturn));
7980 EOCP
7981 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
7982         if $contains 'warning' attrib.out >/dev/null 2>&1; then
7983                 echo "Your C compiler doesn't fully support __attribute__."
7984                 val="$undef"
7985         else
7986                 echo "Your C compiler supports __attribute__."
7987                 val="$define"
7988         fi
7989 else
7990         echo "Your C compiler doesn't seem to understand __attribute__ at all."
7991         val="$undef"
7992 fi
7993 set d_attribut
7994 eval $setvar
7995 $rm -f attrib*
7996
7997 : see if bcmp exists
7998 set bcmp d_bcmp
7999 eval $inlibc
8000
8001 : see if bcopy exists
8002 set bcopy d_bcopy
8003 eval $inlibc
8004
8005 : see if this is a unistd.h system
8006 set unistd.h i_unistd
8007 eval $inhdr
8008
8009 : see if getpgrp exists
8010 set getpgrp d_getpgrp
8011 eval $inlibc
8012
8013 case "$d_getpgrp" in
8014 "$define")
8015         echo " "
8016         echo "Checking to see which flavor of getpgrp is in use..."
8017         $cat >set.c <<EOP
8018 #$i_unistd I_UNISTD
8019 #include <sys/types.h>
8020 #ifdef I_UNISTD
8021 #  include <unistd.h>
8022 #endif
8023 int main()
8024 {
8025         if (getuid() == 0) {
8026                 printf("(I see you are running Configure as super-user...)\n");
8027                 setuid(1);
8028         }
8029 #ifdef TRY_BSD_PGRP
8030         if (getpgrp(1) == 0)
8031                 exit(0);
8032 #else
8033         if (getpgrp() > 0)
8034                 exit(0);
8035 #endif
8036         exit(1);
8037 }
8038 EOP
8039         if $cc -DTRY_BSD_PGRP $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
8040                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
8041                 val="$define"
8042         elif $cc $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
8043                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
8044                 val="$undef"
8045         else
8046                 echo "I can't seem to compile and run the test program."
8047                 if ./usg; then
8048                         xxx="a USG one, i.e. you use getpgrp()."
8049                 else
8050                         # SVR4 systems can appear rather BSD-ish.
8051                         case "$i_unistd" in
8052                         $undef)
8053                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
8054                                 val="$define"
8055                                 ;;
8056                         $define)
8057                                 xxx="probably a USG one, i.e. you use getpgrp()."
8058                                 val="$undef"
8059                                 ;;
8060                         esac
8061                 fi
8062                 echo "Assuming your getpgrp is $xxx" >&4
8063         fi
8064         ;;
8065 *) val="$undef";;
8066 esac
8067 set d_bsdgetpgrp
8068 eval $setvar
8069 $rm -f set set.c
8070
8071 : see if setpgrp exists
8072 set setpgrp d_setpgrp
8073 eval $inlibc
8074
8075 case "$d_setpgrp" in
8076 "$define")
8077         echo " "
8078         echo "Checking to see which flavor of setpgrp is in use..."
8079         $cat >set.c <<EOP
8080 #$i_unistd I_UNISTD
8081 #include <sys/types.h>
8082 #ifdef I_UNISTD
8083 #  include <unistd.h>
8084 #endif
8085 int main()
8086 {
8087         if (getuid() == 0) {
8088                 printf("(I see you are running Configure as super-user...)\n");
8089                 setuid(1);
8090         }
8091 #ifdef TRY_BSD_PGRP
8092         if (-1 == setpgrp(1, 1))
8093                 exit(0);
8094 #else
8095         if (setpgrp() != -1)
8096                 exit(0);
8097 #endif
8098         exit(1);
8099 }
8100 EOP
8101         if $cc -DTRY_BSD_PGRP $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
8102                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
8103                 val="$define"
8104         elif $cc $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
8105                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
8106                 val="$undef"
8107         else
8108                 echo "(I can't seem to compile and run the test program.)"
8109                 if ./usg; then
8110                         xxx="a USG one, i.e. you use setpgrp()."
8111                 else
8112                         # SVR4 systems can appear rather BSD-ish.
8113                         case "$i_unistd" in
8114                         $undef)
8115                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
8116                                 val="$define"
8117                                 ;;
8118                         $define)
8119                                 xxx="probably a USG one, i.e. you use setpgrp()."
8120                                 val="$undef"
8121                                 ;;
8122                         esac
8123                 fi
8124                 echo "Assuming your setpgrp is $xxx" >&4
8125         fi
8126         ;;
8127 *) val="$undef";;
8128 esac
8129 set d_bsdsetpgrp
8130 eval $setvar
8131 $rm -f set set.c
8132 : see if bzero exists
8133 set bzero d_bzero
8134 eval $inlibc
8135
8136 : see if signal is declared as pointer to function returning int or void
8137 echo " "
8138 xxx=`./findhdr signal.h`
8139 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
8140 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
8141         echo "You have int (*signal())() instead of void." >&4
8142         val="$undef"
8143 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
8144         echo "You have void (*signal())()." >&4
8145         val="$define"
8146 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
8147         echo "You have int (*signal())() instead of void." >&4
8148         val="$undef"
8149 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
8150         echo "You have void (*signal())()." >&4
8151         val="$define"
8152 else
8153         case "$d_voidsig" in
8154         '')
8155         echo "I can't determine whether signal handler returns void or int..." >&4
8156                 dflt=void
8157                 rp="What type does your signal handler return?"
8158                 . ./myread
8159                 case "$ans" in
8160                 v*) val="$define";;
8161                 *) val="$undef";;
8162                 esac;;
8163         "$define")
8164                 echo "As you already told me, signal handler returns void." >&4
8165                 val="$define"
8166                 ;;
8167         *)      echo "As you already told me, signal handler returns int." >&4
8168                 val="$undef"
8169                 ;;
8170         esac
8171 fi
8172 set d_voidsig
8173 eval $setvar
8174 case "$d_voidsig" in
8175 "$define") signal_t="void";;
8176 *) signal_t="int";;
8177 esac
8178 $rm -f $$.tmp
8179
8180 : check for ability to cast large floats to 32-bit ints.
8181 echo " "
8182 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
8183 if $test "$intsize" -ge 4; then
8184         xxx=int
8185 else
8186         xxx=long
8187 fi
8188 $cat >try.c <<EOCP
8189 #include <stdio.h>
8190 #include <sys/types.h>
8191 #include <signal.h>
8192 $signal_t blech(s) int s; { exit(3); }
8193 int main()
8194 {
8195         $xxx i32;
8196         double f, g;
8197         int result = 0;
8198         char str[16];
8199         signal(SIGFPE, blech);
8200
8201         /* Don't let compiler optimize the test away.  Store the number 
8202            in a writable string for gcc to pass to sscanf under HP/UX.
8203         */
8204         sprintf(str, "2147483647");
8205         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
8206         g = 10 * f;
8207         i32  = ($xxx) g;
8208
8209         /* x86 processors will probably give 0x8000 0000, which is a
8210        sign change.  We don't want that.  We want to mimic SPARC
8211            behavior here, which is to preserve the sign and give
8212            back 0x7fff ffff.
8213         */
8214         if (i32 != ($xxx) f)
8215                 result |= 1;
8216         exit(result);
8217 }
8218 EOCP
8219 set try
8220 if eval $compile_ok; then
8221         ./try
8222         yyy=$?
8223 else
8224         echo "(I can't seem to compile the test program--assuming it can't)"
8225         yyy=1
8226 fi
8227 case "$yyy" in
8228 0)      val="$define"
8229         echo "Yup, it can."
8230         ;;
8231 *)      val="$undef"
8232         echo "Nope, it can't."
8233         ;;
8234 esac
8235 set d_casti32
8236 eval $setvar
8237 $rm -f try try.*
8238
8239 : check for ability to cast negative floats to unsigned
8240 echo " "
8241 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
8242 $cat >try.c <<EOCP
8243 #include <stdio.h>
8244 #include <sys/types.h>
8245 #include <signal.h>
8246 $signal_t blech(s) int s; { exit(7); }
8247 $signal_t blech_in_list(s) int s; { exit(4); }
8248 unsigned long dummy_long(p) unsigned long p; { return p; }
8249 unsigned int dummy_int(p) unsigned int p; { return p; }
8250 unsigned short dummy_short(p) unsigned short p; { return p; }
8251 int main()
8252 {
8253         double f;
8254         unsigned long along;
8255         unsigned int aint;
8256         unsigned short ashort;
8257         int result = 0;
8258         char str[16];
8259         
8260         /* Frustrate gcc-2.7.2's optimizer which failed this test with
8261            a direct f = -123. assignment.  gcc-2.8.0 reportedly
8262            optimized the whole file away
8263         */
8264         /* Store the number in a writable string for gcc to pass to 
8265            sscanf under HP/UX.
8266         */
8267         sprintf(str, "-123");
8268         sscanf(str, "%lf", &f);  /* f = -123.; */
8269
8270         signal(SIGFPE, blech);
8271         along = (unsigned long)f;
8272         aint = (unsigned int)f;
8273         ashort = (unsigned short)f;
8274         if (along != (unsigned long)-123)
8275                 result |= 1;
8276         if (aint != (unsigned int)-123)
8277                 result |= 1;
8278         if (ashort != (unsigned short)-123)
8279                 result |= 1;
8280         sprintf(str, "1073741824.");
8281         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
8282         f = f + f;
8283         along = 0;
8284         along = (unsigned long)f;
8285         if (along != 0x80000000)
8286                 result |= 2;
8287         f -= 1.;
8288         along = 0;
8289         along = (unsigned long)f;
8290         if (along != 0x7fffffff)
8291                 result |= 1;
8292         f += 2.;
8293         along = 0;
8294         along = (unsigned long)f;
8295         if (along != 0x80000001)
8296                 result |= 2;
8297         if (result)
8298                 exit(result);
8299         signal(SIGFPE, blech_in_list);
8300         sprintf(str, "123.");
8301         sscanf(str, "%lf", &f);  /* f = 123.; */
8302         along = dummy_long((unsigned long)f);
8303         aint = dummy_int((unsigned int)f);
8304         ashort = dummy_short((unsigned short)f);
8305         if (along != (unsigned long)123)
8306                 result |= 4;
8307         if (aint != (unsigned int)123)
8308                 result |= 4;
8309         if (ashort != (unsigned short)123)
8310                 result |= 4;
8311         exit(result);
8312
8313 }
8314 EOCP
8315 set try
8316 if eval $compile_ok; then
8317         ./try
8318         castflags=$?
8319 else
8320         echo "(I can't seem to compile the test program--assuming it can't)"
8321         castflags=7
8322 fi
8323 case "$castflags" in
8324 0)      val="$define"
8325         echo "Yup, it can."
8326         ;;
8327 *)      val="$undef"
8328         echo "Nope, it can't."
8329         ;;
8330 esac
8331 set d_castneg
8332 eval $setvar
8333 $rm -f try.*
8334
8335 : see if vprintf exists
8336 echo " "
8337 if set vprintf val -f d_vprintf; eval $csym; $val; then
8338         echo 'vprintf() found.' >&4
8339         val="$define"
8340         $cat >vprintf.c <<'EOF'
8341 #include <varargs.h>
8342
8343 int main() { xxx("foo"); }
8344
8345 xxx(va_alist)
8346 va_dcl
8347 {
8348         va_list args;
8349         char buf[10];
8350
8351         va_start(args);
8352         exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
8353 }
8354 EOF
8355         set vprintf
8356         if eval $compile && ./vprintf; then
8357                 echo "Your vsprintf() returns (int)." >&4
8358                 val2="$undef"
8359         else
8360                 echo "Your vsprintf() returns (char*)." >&4
8361                 val2="$define"
8362         fi
8363 else
8364         echo 'vprintf() NOT found.' >&4
8365                 val="$undef"
8366                 val2="$undef"
8367 fi
8368 set d_vprintf
8369 eval $setvar
8370 val=$val2
8371 set d_charvspr
8372 eval $setvar
8373
8374 : see if chown exists
8375 set chown d_chown
8376 eval $inlibc
8377
8378 : see if chroot exists
8379 set chroot d_chroot
8380 eval $inlibc
8381
8382 : see if chsize exists
8383 set chsize d_chsize
8384 eval $inlibc
8385
8386 : check for const keyword
8387 echo " "
8388 echo 'Checking to see if your C compiler knows about "const"...' >&4
8389 $cat >const.c <<'EOCP'
8390 typedef struct spug { int drokk; } spug;
8391 int main()
8392 {
8393         const char *foo;
8394         const spug y;
8395 }
8396 EOCP
8397 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
8398         val="$define"
8399         echo "Yup, it does."
8400 else
8401         val="$undef"
8402         echo "Nope, it doesn't."
8403 fi
8404 set d_const
8405 eval $setvar
8406
8407 : see if crypt exists
8408 echo " "
8409 if set crypt val -f d_crypt; eval $csym; $val; then
8410         echo 'crypt() found.' >&4
8411         val="$define"
8412         cryptlib=''
8413 else
8414         cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
8415         if $test -z "$cryptlib"; then
8416                 cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
8417         else
8418                 cryptlib=-lcrypt
8419         fi
8420         if $test -z "$cryptlib"; then
8421                 cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
8422         else
8423                 cryptlib=-lcrypt
8424         fi
8425         if $test -z "$cryptlib"; then
8426                 cryptlib=`./loc libcrypt$_a "" $libpth`
8427         else
8428                 cryptlib=-lcrypt
8429         fi
8430         if $test -z "$cryptlib"; then
8431                 echo 'crypt() NOT found.' >&4
8432                 val="$undef"
8433         else
8434                 val="$define"
8435         fi
8436 fi
8437 set d_crypt
8438 eval $setvar
8439
8440 : get csh whereabouts
8441 case "$csh" in
8442 'csh') val="$undef" ;;
8443 *) val="$define" ;;
8444 esac
8445 set d_csh
8446 eval $setvar
8447 : Respect a hint or command line value for full_csh.
8448 case "$full_csh" in
8449 '') full_csh=$csh ;;
8450 esac
8451
8452 : see if cuserid exists
8453 set cuserid d_cuserid
8454 eval $inlibc
8455
8456 : see if this is a limits.h system
8457 set limits.h i_limits
8458 eval $inhdr
8459
8460 : see if this is a float.h system
8461 set float.h i_float
8462 eval $inhdr
8463
8464 : See if number of significant digits in a double precision number is known
8465 echo " "
8466 $cat >dbl_dig.c <<EOM
8467 #$i_limits I_LIMITS
8468 #$i_float I_FLOAT
8469 #ifdef I_LIMITS
8470 #include <limits.h>
8471 #endif
8472 #ifdef I_FLOAT
8473 #include <float.h>
8474 #endif
8475 #ifdef DBL_DIG
8476 printf("Contains DBL_DIG");
8477 #endif
8478 EOM
8479 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
8480 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
8481         echo "DBL_DIG found." >&4
8482         val="$define"
8483 else
8484         echo "DBL_DIG NOT found." >&4
8485         val="$undef"
8486 fi
8487 $rm -f dbl_dig.?
8488 set d_dbl_dig
8489 eval $setvar
8490
8491 : see if difftime exists
8492 set difftime d_difftime
8493 eval $inlibc
8494
8495 : see if this is a dirent system
8496 echo " "
8497 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
8498         val="$define"
8499         echo "<dirent.h> found." >&4
8500 else
8501         val="$undef"
8502         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
8503                 echo "<sys/dir.h> found." >&4
8504                 echo " "
8505         else
8506                 xinc=`./findhdr sys/ndir.h`
8507         fi
8508         echo "<dirent.h> NOT found." >&4
8509 fi
8510 set i_dirent
8511 eval $setvar
8512
8513 : Look for type of directory structure.
8514 echo " "
8515 $cppstdin $cppflags $cppminus < "$xinc" > try.c
8516
8517 case "$direntrytype" in
8518 ''|' ')
8519         case "$i_dirent" in
8520         $define) guess1='struct dirent' ;;
8521         *) guess1='struct direct'  ;;
8522         esac
8523         ;;
8524 *)      guess1="$direntrytype"
8525         ;;
8526 esac
8527
8528 case "$guess1" in
8529 'struct dirent') guess2='struct direct' ;;
8530 *) guess2='struct dirent' ;;
8531 esac
8532                 
8533 if $contains "$guess1" try.c >/dev/null 2>&1; then
8534         direntrytype="$guess1"
8535         echo "Your directory entries are $direntrytype." >&4
8536 elif $contains "$guess2" try.c >/dev/null 2>&1; then
8537         direntrytype="$guess2"
8538         echo "Your directory entries seem to be $direntrytype." >&4
8539 else
8540         echo "I don't recognize your system's directory entries." >&4
8541         rp="What type is used for directory entries on this system?"
8542         dflt="$guess1"
8543         . ./myread
8544         direntrytype="$ans"
8545 fi
8546 $rm -f try.c
8547
8548
8549 : see if the directory entry stores field length
8550 echo " "
8551 $cppstdin $cppflags $cppminus < "$xinc" > try.c
8552 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
8553         echo "Good, your directory entry keeps length information in d_namlen." >&4
8554         val="$define"
8555 else
8556         echo "Your directory entry does not know about the d_namlen field." >&4
8557         val="$undef"
8558 fi
8559 set d_dirnamlen
8560 eval $setvar
8561 $rm -f try.c
8562
8563 : see if dlerror exists
8564 xxx_runnm="$runnm"
8565 runnm=false
8566 set dlerror d_dlerror
8567 eval $inlibc
8568 runnm="$xxx_runnm"
8569
8570 : see if dlfcn is available
8571 set dlfcn.h i_dlfcn
8572 eval $inhdr
8573
8574 case "$usedl" in
8575 $define|y|true)
8576         $cat << EOM
8577
8578 On a few systems, the dynamically loaded modules that perl generates and uses
8579 will need a different extension than shared libs. The default will probably
8580 be appropriate.
8581
8582 EOM
8583         case "$dlext" in
8584         '')     dflt="$so" ;;
8585         *)      dflt="$dlext" ;;
8586         esac
8587         rp='What is the extension of dynamically loaded modules'
8588         . ./myread
8589         dlext="$ans"
8590         ;;
8591 *)
8592         dlext="none"
8593         ;;
8594 esac
8595
8596 : Check if dlsym need a leading underscore
8597 echo " "
8598 val="$undef"
8599
8600 case "$dlsrc" in
8601 dl_dlopen.xs)
8602         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
8603         $cat >dyna.c <<'EOM'
8604 fred () { }
8605 EOM
8606
8607 $cat >fred.c<<EOM
8608
8609 #include <stdio.h>
8610 #$i_dlfcn I_DLFCN
8611 #ifdef I_DLFCN
8612 #include <dlfcn.h>      /* the dynamic linker include file for Sunos/Solaris */
8613 #else
8614 #include <sys/types.h>
8615 #include <nlist.h>
8616 #include <link.h>
8617 #endif
8618
8619 extern int fred() ;
8620
8621 int main()
8622 {
8623     void * handle ;
8624     void * symbol ;
8625 #ifndef RTLD_LAZY
8626     int mode = 1 ;
8627 #else
8628     int mode = RTLD_LAZY ;
8629 #endif
8630     handle = dlopen("./dyna.$dlext", mode) ;
8631     if (handle == NULL) {
8632         printf ("1\n") ;
8633         fflush (stdout) ;
8634         exit(0);
8635     }
8636     symbol = dlsym(handle, "fred") ;
8637     if (symbol == NULL) {
8638         /* try putting a leading underscore */
8639         symbol = dlsym(handle, "_fred") ;
8640         if (symbol == NULL) {
8641             printf ("2\n") ;
8642             fflush (stdout) ;
8643             exit(0);
8644         }
8645         printf ("3\n") ;
8646     }
8647     else
8648         printf ("4\n") ;
8649     fflush (stdout) ;
8650     exit(0);
8651 }
8652 EOM
8653         : Call the object file tmp-dyna.o in case dlext=o.
8654         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 && 
8655                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 && 
8656                 $ld $lddlflags -o dyna.$dlext tmp-dyna${_o} > /dev/null 2>&1 && 
8657                 $cc $ccflags -o fred $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1; then
8658                 xxx=`./fred`
8659                 case $xxx in
8660                 1)      echo "Test program failed using dlopen." >&4
8661                         echo "Perhaps you should not use dynamic loading." >&4;;
8662                 2)      echo "Test program failed using dlsym." >&4
8663                         echo "Perhaps you should not use dynamic loading." >&4;;
8664                 3)      echo "dlsym needs a leading underscore" >&4
8665                         val="$define" ;;
8666                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
8667                 esac
8668         else
8669                 echo "I can't compile and run the test program." >&4
8670                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
8671         fi
8672         ;;
8673 esac
8674                 
8675 $rm -f fred fred.? dyna.$dlext dyna.? tmp-dyna.?
8676
8677 set d_dlsymun
8678 eval $setvar
8679
8680 hasproto='varname=$1; func=$2; shift; shift;
8681 while $test $# -ge 2; do
8682         case "$1" in
8683         $define) echo "#include <$2>";;
8684         esac ;
8685     shift 2;
8686 done > try.c;
8687 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
8688 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
8689         echo "$func() prototype found.";
8690         val="$define";
8691 else
8692         echo "$func() prototype NOT found.";
8693         val="$undef";
8694 fi;
8695 set $varname;
8696 eval $setvar;
8697 $rm -f try.c tryout.c'
8698
8699 : see if prototype for drand48 is available
8700 echo " "
8701 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
8702 eval $hasproto
8703
8704 : see if dup2 exists
8705 set dup2 d_dup2
8706 eval $inlibc
8707
8708 : see if eaccess exists
8709 set eaccess d_eaccess
8710 eval $inlibc
8711
8712 : see if endgrent exists
8713 set endgrent d_endgrent
8714 eval $inlibc
8715
8716 : see if endhostent exists
8717 set endhostent d_endhent
8718 eval $inlibc
8719
8720 : see if endnetent exists
8721 set endnetent d_endnent
8722 eval $inlibc
8723
8724 : see if endprotoent exists
8725 set endprotoent d_endpent
8726 eval $inlibc
8727
8728 : see if endpwent exists
8729 set endpwent d_endpwent
8730 eval $inlibc
8731
8732 : see if endservent exists
8733 set endservent d_endsent
8734 eval $inlibc
8735
8736 : Locate the flags for 'open()'
8737 echo " "
8738 $cat >open3.c <<'EOCP'
8739 #include <sys/types.h>
8740 #ifdef I_FCNTL
8741 #include <fcntl.h>
8742 #endif
8743 #ifdef I_SYS_FILE
8744 #include <sys/file.h>
8745 #endif
8746 int main() {
8747         if(O_RDONLY);
8748 #ifdef O_TRUNC
8749         exit(0);
8750 #else
8751         exit(1);
8752 #endif
8753 }
8754 EOCP
8755 : check sys/file.h first to get FREAD on Sun
8756 if $test `./findhdr sys/file.h` && \
8757                 set open3 -DI_SYS_FILE && eval $compile; then
8758         h_sysfile=true;
8759         echo "<sys/file.h> defines the O_* constants..." >&4
8760         if ./open3; then
8761                 echo "and you have the 3 argument form of open()." >&4
8762                 val="$define"
8763         else
8764                 echo "but not the 3 argument form of open().  Oh, well." >&4
8765                 val="$undef"
8766         fi
8767 elif $test `./findhdr fcntl.h` && \
8768                 set open3 -DI_FCNTL && eval $compile; then
8769         h_fcntl=true;
8770         echo "<fcntl.h> defines the O_* constants..." >&4
8771         if ./open3; then
8772                 echo "and you have the 3 argument form of open()." >&4
8773                 val="$define"
8774         else
8775                 echo "but not the 3 argument form of open().  Oh, well." >&4
8776                 val="$undef"
8777         fi
8778 else
8779         val="$undef"
8780         echo "I can't find the O_* constant definitions!  You got problems." >&4
8781 fi
8782 set d_open3
8783 eval $setvar
8784 $rm -f open3*
8785
8786 : see which of string.h or strings.h is needed
8787 echo " "
8788 strings=`./findhdr string.h`
8789 if $test "$strings" && $test -r "$strings"; then
8790         echo "Using <string.h> instead of <strings.h>." >&4
8791         val="$define"
8792 else
8793         val="$undef"
8794         strings=`./findhdr strings.h`
8795         if $test "$strings" && $test -r "$strings"; then
8796                 echo "Using <strings.h> instead of <string.h>." >&4
8797         else
8798                 echo "No string header found -- You'll surely have problems." >&4
8799         fi
8800 fi
8801 set i_string
8802 eval $setvar
8803 case "$i_string" in
8804 "$undef") strings=`./findhdr strings.h`;;
8805 *)        strings=`./findhdr string.h`;;
8806 esac
8807
8808 : check for non-blocking I/O stuff
8809 case "$h_sysfile" in
8810 true) echo "#include <sys/file.h>" > head.c;;
8811 *)
8812         case "$h_fcntl" in
8813         true) echo "#include <fcntl.h>" > head.c;;
8814         *) echo "#include <sys/fcntl.h>" > head.c;;
8815         esac
8816         ;;
8817 esac
8818 echo " "
8819 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
8820 case "$o_nonblock" in
8821 '')
8822         $cat head.c > try.c
8823         $cat >>try.c <<'EOCP'
8824 #include <stdio.h>
8825 int main() {
8826 #ifdef O_NONBLOCK
8827         printf("O_NONBLOCK\n");
8828         exit(0);
8829 #endif
8830 #ifdef O_NDELAY
8831         printf("O_NDELAY\n");
8832         exit(0);
8833 #endif
8834 #ifdef FNDELAY
8835         printf("FNDELAY\n");
8836         exit(0);
8837 #endif
8838         exit(0);
8839 }
8840 EOCP
8841         set try
8842         if eval $compile_ok; then
8843                 o_nonblock=`./try`
8844                 case "$o_nonblock" in
8845                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
8846                 *) echo "Seems like we can use $o_nonblock.";;
8847                 esac
8848         else
8849                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
8850         fi
8851         ;;
8852 *) echo "Using $hint value $o_nonblock.";;
8853 esac
8854 $rm -f try try.* .out core
8855
8856 echo " "
8857 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
8858 case "$eagain" in
8859 '')
8860         $cat head.c > try.c
8861         $cat >>try.c <<EOCP
8862 #include <errno.h>
8863 #include <sys/types.h>
8864 #include <signal.h>
8865 #include <stdio.h> 
8866 #define MY_O_NONBLOCK $o_nonblock
8867 #ifndef errno  /* XXX need better Configure test */
8868 extern int errno;
8869 #endif
8870 #$i_unistd I_UNISTD
8871 #ifdef I_UNISTD
8872 #include <unistd.h>
8873 #endif
8874 #$i_string I_STRING
8875 #ifdef I_STRING
8876 #include <string.h>
8877 #else
8878 #include <strings.h>
8879 #endif
8880 $signal_t blech(x) int x; { exit(3); }
8881 EOCP
8882         $cat >> try.c <<'EOCP'
8883 int main()
8884 {
8885         int pd[2];
8886         int pu[2];
8887         char buf[1];
8888         char string[100];
8889
8890         pipe(pd);       /* Down: child -> parent */
8891         pipe(pu);       /* Up: parent -> child */
8892         if (0 != fork()) {
8893                 int ret;
8894                 close(pd[1]);   /* Parent reads from pd[0] */
8895                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
8896                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
8897                         exit(1);
8898                 signal(SIGALRM, blech);
8899                 alarm(5);
8900                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
8901                         exit(2);
8902                 sprintf(string, "%d\n", ret);
8903                 write(2, string, strlen(string));
8904                 alarm(0);
8905 #ifdef EAGAIN
8906                 if (errno == EAGAIN) {
8907                         printf("EAGAIN\n");
8908                         goto ok;
8909                 }
8910 #endif
8911 #ifdef EWOULDBLOCK
8912                 if (errno == EWOULDBLOCK)
8913                         printf("EWOULDBLOCK\n");
8914 #endif
8915         ok:
8916                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
8917                 sleep(2);                               /* Give it time to close our pipe */
8918                 alarm(5);
8919                 ret = read(pd[0], buf, 1);      /* Should read EOF */
8920                 alarm(0);
8921                 sprintf(string, "%d\n", ret);
8922                 write(3, string, strlen(string));
8923                 exit(0);
8924         }
8925
8926         close(pd[0]);                   /* We write to pd[1] */
8927         close(pu[1]);                   /* We read from pu[0] */
8928         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
8929         close(pd[1]);                   /* Pipe pd is now fully closed! */
8930         exit(0);                                /* Bye bye, thank you for playing! */
8931 }
8932 EOCP
8933         set try
8934         if eval $compile_ok; then
8935                 echo "$startsh" >mtry
8936                 echo "./try >try.out 2>try.ret 3>try.err || exit 4" >>mtry
8937                 chmod +x mtry
8938                 ./mtry >/dev/null 2>&1
8939                 case $? in
8940                 0) eagain=`$cat try.out`;;
8941                 1) echo "Could not perform non-blocking setting!";;
8942                 2) echo "I did a successful read() for something that was not there!";;
8943                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
8944                 *) echo "Something terribly wrong happened during testing.";;
8945                 esac
8946                 rd_nodata=`$cat try.ret`
8947                 echo "A read() system call with no data present returns $rd_nodata."
8948                 case "$rd_nodata" in
8949                 0|-1) ;;
8950                 *)
8951                         echo "(That's peculiar, fixing that to be -1.)"
8952                         rd_nodata=-1
8953                         ;;
8954                 esac
8955                 case "$eagain" in
8956                 '')
8957                         echo "Forcing errno EAGAIN on read() with no data available."
8958                         eagain=EAGAIN
8959                         ;;
8960                 *)
8961                         echo "Your read() sets errno to $eagain when no data is available."
8962                         ;;
8963                 esac
8964                 status=`$cat try.err`
8965                 case "$status" in
8966                 0) echo "And it correctly returns 0 to signal EOF.";;
8967                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
8968                 *) echo "However, your read() returns '$status' on EOF??";;
8969                 esac
8970                 val="$define"
8971                 if test "$status" = "$rd_nodata"; then
8972                         echo "WARNING: you can't distinguish between EOF and no data!"
8973                         val="$undef"
8974                 fi
8975         else
8976                 echo "I can't compile the test program--assuming errno EAGAIN will do."
8977                 eagain=EAGAIN
8978         fi
8979         set d_eofnblk
8980         eval $setvar
8981         ;;
8982 *)
8983         echo "Using $hint value $eagain."
8984         echo "Your read() returns $rd_nodata when no data is present."
8985         case "$d_eofnblk" in
8986         "$define") echo "And you can see EOF because read() returns 0.";;
8987         "$undef") echo "But you can't see EOF status from read() returned value.";;
8988         *)
8989                 echo "(Assuming you can't see EOF status from read anyway.)"
8990                 d_eofnblk=$undef
8991                 ;;
8992         esac
8993         ;;
8994 esac
8995 $rm -f try try.* .out core head.c mtry
8996
8997 : see if fchmod exists
8998 set fchmod d_fchmod
8999 eval $inlibc
9000
9001 : see if fchown exists
9002 set fchown d_fchown
9003 eval $inlibc
9004
9005 : see if this is an fcntl system
9006 set fcntl d_fcntl
9007 eval $inlibc
9008
9009 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
9010 while $test $# -ge 2; do
9011         case "$1" in
9012         $define) echo "#include <$2>";;
9013         esac ;
9014     shift 2;
9015 done > try.c;
9016 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
9017 set try;
9018 if eval $compile; then
9019         val="$define";
9020 else
9021         val="$undef";
9022 fi;
9023 set $varname;
9024 eval $setvar;
9025 $rm -f try.c try.o'
9026
9027 socketlib=''
9028 sockethdr=''
9029 : see whether socket exists
9030 echo " "
9031 $echo $n "Hmm... $c" >&4
9032 if set socket val -f d_socket; eval $csym; $val; then
9033         echo "Looks like you have Berkeley networking support." >&4
9034         d_socket="$define"
9035         if set setsockopt val -f; eval $csym; $val; then
9036                 d_oldsock="$undef"
9037         else
9038                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
9039                 d_oldsock="$define"
9040         fi
9041 else
9042         if $contains socklib libc.list >/dev/null 2>&1; then
9043                 echo "Looks like you have Berkeley networking support." >&4
9044                 d_socket="$define"
9045                 : we will have to assume that it supports the 4.2 BSD interface
9046                 d_oldsock="$undef"
9047         else
9048                 echo "You don't have Berkeley networking in libc$_a..." >&4
9049                 if test "X$d_socket" = "X$define"; then
9050                    echo "...but you seem to believe that you have sockets." >&4
9051                 else
9052                         for net in net socket
9053                         do
9054                                 if test -f /usr/lib/lib$net$_a; then
9055                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
9056                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
9057                                         if $contains socket libc.list >/dev/null 2>&1; then
9058                                                 d_socket="$define"
9059                                                 socketlib="-l$net"
9060                                                 case "$net" in
9061                                                 net)
9062                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
9063                                                         sockethdr="-I/usr/netinclude"
9064                                                         ;;
9065                                                 esac
9066                                                 echo "Found Berkeley sockets interface in lib$net." >& 4 
9067                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
9068                                                         d_oldsock="$undef"
9069                                                 else
9070                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
9071                                                         d_oldsock="$define"
9072                                                 fi
9073                                                 break
9074                                         fi
9075                                 fi
9076                         done
9077                         if test "X$d_socket" != "X$define"; then
9078                            echo "or anywhere else I see." >&4
9079                            d_socket="$undef"
9080                            d_oldsock="$undef"
9081                         fi
9082                 fi
9083         fi
9084 fi
9085
9086 : see if socketpair exists
9087 set socketpair d_sockpair
9088 eval $inlibc
9089
9090
9091 echo " "
9092 echo "Checking the availability of certain socket constants..." >& 4
9093 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
9094         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
9095         $cat >try.c <<EOF
9096 #include <sys/types.h>
9097 #include <sys/socket.h>
9098 int main() {
9099     int i = $ENUM;
9100 }
9101 EOF
9102         val="$undef"
9103         set try; if eval $compile; then
9104                 val="$define"
9105         fi
9106         set d_${enum}; eval $setvar
9107         $rm -f try.c try
9108 done
9109
9110 : see if sys/select.h has to be included
9111 set sys/select.h i_sysselct
9112 eval $inhdr
9113
9114 : see if we should include time.h, sys/time.h, or both
9115 echo " "
9116 if test "X$timeincl" = X; then
9117         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
9118         $echo $n "I'm now running the test program...$c"
9119         $cat >try.c <<'EOCP'
9120 #include <sys/types.h>
9121 #ifdef I_TIME
9122 #include <time.h>
9123 #endif
9124 #ifdef I_SYSTIME
9125 #ifdef SYSTIMEKERNEL
9126 #define KERNEL
9127 #endif
9128 #include <sys/time.h>
9129 #endif
9130 #ifdef I_SYSSELECT
9131 #include <sys/select.h>
9132 #endif
9133 int main()
9134 {
9135         struct tm foo;
9136 #ifdef S_TIMEVAL
9137         struct timeval bar;
9138 #endif
9139 #ifdef S_TIMEZONE
9140         struct timezone tzp;
9141 #endif
9142         if (foo.tm_sec == foo.tm_sec)
9143                 exit(0);
9144 #ifdef S_TIMEVAL
9145         if (bar.tv_sec == bar.tv_sec)
9146                 exit(0);
9147 #endif
9148         exit(1);
9149 }
9150 EOCP
9151         flags=''
9152         for s_timezone in '-DS_TIMEZONE' ''; do
9153         sysselect=''
9154         for s_timeval in '-DS_TIMEVAL' ''; do
9155         for i_systimek in '' '-DSYSTIMEKERNEL'; do
9156         for i_time in '' '-DI_TIME'; do
9157         for i_systime in '-DI_SYSTIME' ''; do
9158                 case "$flags" in
9159                 '') $echo $n ".$c"
9160                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
9161                         if eval $compile; then
9162                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
9163                                 shift
9164                                 flags="$*"
9165                                 echo " "
9166                                 $echo $n "Succeeded with $flags$c"
9167                         fi
9168                         ;;
9169                 esac
9170         done
9171         done
9172         done
9173         done
9174         done
9175         timeincl=''
9176         echo " "
9177         case "$flags" in
9178         *SYSTIMEKERNEL*) i_systimek="$define"
9179                 timeincl=`./findhdr sys/time.h`
9180                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
9181         *) i_systimek="$undef";;
9182         esac
9183         case "$flags" in
9184         *I_TIME*) i_time="$define"
9185                 timeincl=`./findhdr time.h`" $timeincl"
9186                 echo "We'll include <time.h>." >&4;;
9187         *) i_time="$undef";;
9188         esac
9189         case "$flags" in
9190         *I_SYSTIME*) i_systime="$define"
9191                 timeincl=`./findhdr sys/time.h`" $timeincl"
9192                 echo "We'll include <sys/time.h>." >&4;;
9193         *) i_systime="$undef";;
9194         esac
9195         $rm -f try.c try
9196 fi
9197
9198 : check for fd_set items
9199 $cat <<EOM
9200
9201 Checking to see how well your C compiler handles fd_set and friends ...
9202 EOM
9203 $cat >fd_set.c <<EOCP
9204 #$i_systime I_SYS_TIME
9205 #$i_sysselct I_SYS_SELECT
9206 #$d_socket HAS_SOCKET
9207 #include <sys/types.h>
9208 #ifdef HAS_SOCKET
9209 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
9210 #endif
9211 #ifdef I_SYS_TIME
9212 #include <sys/time.h>
9213 #endif
9214 #ifdef I_SYS_SELECT
9215 #include <sys/select.h>
9216 #endif
9217 int main() {
9218         fd_set fds;
9219
9220 #ifdef TRYBITS
9221         if(fds.fds_bits);
9222 #endif
9223
9224 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
9225         exit(0);
9226 #else
9227         exit(1);
9228 #endif
9229 }
9230 EOCP
9231 set fd_set -DTRYBITS
9232 if eval $compile; then
9233         d_fds_bits="$define"
9234         d_fd_set="$define"
9235         echo "Well, your system knows about the normal fd_set typedef..." >&4
9236         if ./fd_set; then
9237                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
9238                 d_fd_macros="$define"
9239         else
9240                 $cat >&4 <<'EOM'
9241 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
9242 EOM
9243                 d_fd_macros="$undef"
9244         fi
9245 else
9246         $cat <<'EOM'
9247 Hmm, your compiler has some difficulty with fd_set.  Checking further...
9248 EOM
9249         set fd_set
9250         if eval $compile; then
9251                 d_fds_bits="$undef"
9252                 d_fd_set="$define"
9253                 echo "Well, your system has some sort of fd_set available..." >&4
9254                 if ./fd_set; then
9255                         echo "and you have the normal fd_set macros." >&4
9256                         d_fd_macros="$define"
9257                 else
9258                         $cat <<'EOM'
9259 but not the normal fd_set macros!  Gross!  More work for me...
9260 EOM
9261                         d_fd_macros="$undef"
9262                 fi
9263         else
9264         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
9265                 d_fd_set="$undef"
9266                 d_fds_bits="$undef"
9267                 d_fd_macros="$undef"
9268         fi
9269 fi
9270 $rm -f fd_set*
9271
9272 : see if fgetpos exists
9273 set fgetpos d_fgetpos
9274 eval $inlibc
9275
9276 : see if flock exists
9277 set flock d_flock
9278 eval $inlibc
9279
9280 : see if fork exists
9281 set fork d_fork
9282 eval $inlibc
9283
9284 : see if pathconf exists
9285 set pathconf d_pathconf
9286 eval $inlibc
9287
9288 : see if fpathconf exists
9289 set fpathconf d_fpathconf
9290 eval $inlibc
9291
9292
9293 : check for fpos64_t
9294 echo " "
9295 echo "Checking to see if you have fpos64_t..." >&4
9296 $cat >try.c <<EOCP
9297 #include <stdio.h>
9298 int main() { fpos64_t x = 7; }
9299 EOCP
9300 set try
9301 if eval $compile; then
9302         val="$define"
9303         echo "You have fpos64_t."
9304 else
9305         val="$undef"
9306         echo "You do not have fpos64_t."
9307         case "$fpossize" in
9308         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
9309         esac
9310 fi
9311 $rm -f try.* try
9312 set d_fpos64_t
9313 eval $setvar
9314
9315 : see if frexpl exists
9316 set frexpl d_frexpl
9317 eval $inlibc
9318
9319 hasstruct='varname=$1; struct=$2; shift; shift;
9320 while $test $# -ge 2; do
9321         case "$1" in
9322         $define) echo "#include <$2>";;
9323         esac ;
9324     shift 2;
9325 done > try.c;
9326 echo "int main () { struct $struct foo; }" >> try.c;
9327 set try;
9328 if eval $compile; then
9329         val="$define";
9330 else
9331         val="$undef";
9332 fi;
9333 set $varname;
9334 eval $setvar;
9335 $rm -f try.c try.o'
9336
9337 : see if this is a sys/param system
9338 set sys/param.h i_sysparam
9339 eval $inhdr
9340
9341 : see if this is a sys/mount.h system
9342 set sys/mount.h i_sysmount
9343 eval $inhdr
9344
9345 : see if sys/types.h has to be included
9346 set sys/types.h i_systypes
9347 eval $inhdr
9348
9349
9350 echo " "
9351 echo "Checking to see if your system supports struct fs_data..." >&4
9352 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
9353 eval $hasstruct
9354 case "$d_fs_data_s" in
9355 "$define")      echo "Yes, it does."   ;;
9356 *)              echo "No, it doesn't." ;;
9357 esac
9358
9359 : see if fseeko exists
9360 set fseeko d_fseeko
9361 eval $inlibc
9362 case "$longsize" in
9363 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
9364 esac
9365
9366 : see if fsetpos exists
9367 set fsetpos d_fsetpos
9368 eval $inlibc
9369
9370
9371 : see if fstatfs exists
9372 set fstatfs d_fstatfs
9373 eval $inlibc
9374
9375
9376 : see if statvfs exists
9377 set statvfs d_statvfs
9378 eval $inlibc
9379
9380 : see if fstatvfs exists
9381 set fstatvfs d_fstatvfs
9382 eval $inlibc
9383
9384
9385 : see if ftello exists
9386 set ftello d_ftello
9387 eval $inlibc
9388 case "$longsize" in
9389 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
9390 esac
9391
9392 : see if getcwd exists
9393 set getcwd d_getcwd
9394 eval $inlibc
9395
9396 : see if getespwnam exists
9397 set getespwnam d_getespwnam
9398 eval $inlibc
9399
9400
9401 : see if getfsstat exists
9402 set getfsstat d_getfsstat
9403 eval $inlibc
9404
9405 : see if getgrent exists
9406 set getgrent d_getgrent
9407 eval $inlibc
9408
9409 : see if gethostbyaddr exists
9410 set gethostbyaddr d_gethbyaddr
9411 eval $inlibc
9412
9413 : see if gethostbyname exists
9414 set gethostbyname d_gethbyname
9415 eval $inlibc
9416
9417 : see if gethostent exists
9418 set gethostent d_gethent
9419 eval $inlibc
9420
9421 : see how we will look up host name
9422 echo " "
9423 call=''
9424 if set gethostname val -f d_gethname; eval $csym; $val; then
9425         echo 'gethostname() found.' >&4
9426         d_gethname="$define"
9427         call=gethostname
9428 fi
9429 if set uname val -f d_uname; eval $csym; $val; then
9430         if ./xenix; then
9431                 $cat <<'EOM'
9432 uname() was found, but you're running xenix, and older versions of xenix
9433 have a broken uname(). If you don't really know whether your xenix is old
9434 enough to have a broken system call, use the default answer.
9435
9436 EOM
9437                 dflt=y
9438                 case "$d_uname" in
9439                 "$define") dflt=n;;
9440                 esac
9441                 rp='Is your uname() broken?'
9442                 . ./myread
9443                 case "$ans" in
9444                 n*) d_uname="$define"; call=uname;;
9445                 esac
9446         else
9447                 echo 'uname() found.' >&4
9448                 d_uname="$define"
9449                 case "$call" in
9450                 '') call=uname ;;
9451                 esac
9452         fi
9453 fi
9454 case "$d_gethname" in
9455 '') d_gethname="$undef";;
9456 esac
9457 case "$d_uname" in
9458 '') d_uname="$undef";;
9459 esac
9460 case "$d_uname$d_gethname" in
9461 *define*)
9462         dflt=n
9463         cat <<EOM
9464  
9465 Every now and then someone has a $call() that lies about the hostname
9466 but can't be fixed for political or economic reasons.  If you wish, I can
9467 pretend $call() isn't there and maybe compute hostname at run-time
9468 thanks to the '$phostname' command.
9469
9470 EOM
9471         rp="Shall I ignore $call() from now on?"
9472         . ./myread
9473         case "$ans" in
9474         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
9475         esac;;
9476 esac
9477 case "$phostname" in
9478 '') aphostname='';;
9479 *) case "$aphostname" in
9480         /*) ;;
9481         *) set X $phostname
9482                 shift
9483                 file=$1
9484                 shift
9485                 file=`./loc $file $file $pth`
9486                 aphostname=`echo $file $*`
9487                 ;;
9488         esac
9489         ;;
9490 esac
9491 case "$d_uname$d_gethname" in
9492 *define*) ;;
9493 *)
9494         case "$phostname" in
9495         '')
9496                 echo "There will be no way for $package to get your hostname." >&4;;
9497         *)
9498         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
9499                 ;;
9500         esac;;
9501 esac
9502 case "$d_phostname" in
9503 '') d_phostname="$undef";;
9504 esac
9505
9506 : see if this is a netdb.h system
9507 set netdb.h i_netdb
9508 eval $inhdr
9509
9510 : see if prototypes for various gethostxxx netdb.h functions are available
9511 echo " "
9512 set d_gethostprotos gethostent $i_netdb netdb.h
9513 eval $hasproto
9514
9515 : see if getlogin exists
9516 set getlogin d_getlogin
9517 eval $inlibc
9518
9519 : see if getmnt exists
9520 set getmnt d_getmnt
9521 eval $inlibc
9522
9523 : see if getmntent exists
9524 set getmntent d_getmntent
9525 eval $inlibc
9526
9527 : see if getnetbyaddr exists
9528 set getnetbyaddr d_getnbyaddr
9529 eval $inlibc
9530
9531 : see if getnetbyname exists
9532 set getnetbyname d_getnbyname
9533 eval $inlibc
9534
9535 : see if getnetent exists
9536 set getnetent d_getnent
9537 eval $inlibc
9538
9539 : see if prototypes for various getnetxxx netdb.h functions are available
9540 echo " "
9541 set d_getnetprotos getnetent $i_netdb netdb.h
9542 eval $hasproto
9543
9544
9545 : see if getprotobyname exists
9546 set getprotobyname d_getpbyname
9547 eval $inlibc
9548
9549 : see if getprotobynumber exists
9550 set getprotobynumber d_getpbynumber
9551 eval $inlibc
9552
9553 : see if getprotoent exists
9554 set getprotoent d_getpent
9555 eval $inlibc
9556
9557 : see if getpgid exists
9558 set getpgid d_getpgid
9559 eval $inlibc
9560
9561 : see if getpgrp2 exists
9562 set getpgrp2 d_getpgrp2
9563 eval $inlibc
9564
9565 : see if getppid exists
9566 set getppid d_getppid
9567 eval $inlibc
9568
9569 : see if getpriority exists
9570 set getpriority d_getprior
9571 eval $inlibc
9572
9573 : see if prototypes for various getprotoxxx netdb.h functions are available
9574 echo " "
9575 set d_getprotoprotos getprotoent $i_netdb netdb.h
9576 eval $hasproto
9577
9578 : see if getprpwnam exists
9579 set getprpwnam d_getprpwnam
9580 eval $inlibc
9581
9582 : see if getpwent exists
9583 set getpwent d_getpwent
9584 eval $inlibc
9585
9586
9587 : see if getservbyname exists
9588 set getservbyname d_getsbyname
9589 eval $inlibc
9590
9591 : see if getservbyport exists
9592 set getservbyport d_getsbyport
9593 eval $inlibc
9594
9595 : see if getservent exists
9596 set getservent d_getsent
9597 eval $inlibc
9598
9599 : see if prototypes for various getservxxx netdb.h functions are available
9600 echo " "
9601 set d_getservprotos getservent $i_netdb netdb.h
9602 eval $hasproto
9603
9604 : see if getspnam exists
9605 set getspnam d_getspnam
9606 eval $inlibc
9607
9608 : see if gettimeofday or ftime exists
9609 set gettimeofday d_gettimeod
9610 eval $inlibc
9611 case "$d_gettimeod" in
9612 "$undef")
9613         set ftime d_ftime 
9614         eval $inlibc
9615         ;;
9616 *)
9617         val="$undef"; set d_ftime; eval $setvar
9618         ;;
9619 esac
9620 case "$d_gettimeod$d_ftime" in
9621 "$undef$undef")
9622         echo " "
9623         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
9624         ;;
9625 esac
9626
9627 : see if this is an grp system
9628 set grp.h i_grp
9629 eval $inhdr
9630
9631 case "$i_grp" in
9632 $define)
9633         xxx=`./findhdr grp.h`
9634         $cppstdin $cppflags $cppminus < $xxx >$$.h
9635
9636         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
9637                 val="$define"
9638         else
9639                 val="$undef"
9640         fi
9641         set d_grpasswd
9642         eval $setvar
9643
9644         $rm -f $$.h
9645         ;;
9646 *)
9647         val="$undef";
9648         set d_grpasswd; eval $setvar
9649         ;;
9650 esac
9651
9652 : see if hasmntopt exists
9653 set hasmntopt d_hasmntopt
9654 eval $inlibc
9655
9656 : see if this is a netinet/in.h or sys/in.h system
9657 set netinet/in.h i_niin sys/in.h i_sysin
9658 eval $inhdr
9659
9660 : see if arpa/inet.h has to be included
9661 set arpa/inet.h i_arpainet
9662 eval $inhdr
9663
9664 : see if htonl --and friends-- exists
9665 val=''
9666 set htonl val
9667 eval $inlibc
9668
9669 : Maybe they are macros.
9670 case "$val" in
9671 $undef)
9672         $cat >htonl.c <<EOM
9673 #include <stdio.h>
9674 #include <sys/types.h>
9675 #$i_niin I_NETINET_IN
9676 #$i_sysin I_SYS_IN
9677 #$i_arpainet I_ARPA_INET
9678 #ifdef I_NETINET_IN
9679 #include <netinet/in.h>
9680 #endif
9681 #ifdef I_SYS_IN
9682 #include <sys/in.h>
9683 #endif
9684 #ifdef I_ARPA_INET
9685 #include <arpa/inet.h>
9686 #endif
9687 #ifdef htonl
9688 printf("Defined as a macro.");
9689 #endif
9690 EOM
9691         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
9692         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
9693                 val="$define"
9694                 echo "But it seems to be defined as a macro." >&4
9695         fi
9696         $rm -f htonl.?
9697         ;;
9698 esac
9699 set d_htonl
9700 eval $setvar
9701
9702 : see if iconv exists
9703 set iconv d_iconv
9704 eval $inlibc
9705
9706 : index or strchr
9707 echo " "
9708 if set index val -f; eval $csym; $val; then
9709         if set strchr val -f d_strchr; eval $csym; $val; then
9710                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
9711                         val="$define"
9712                         vali="$undef"
9713                         echo "strchr() found." >&4
9714                 else
9715                         val="$undef"
9716                         vali="$define"
9717                         echo "index() found." >&4
9718                 fi
9719         else
9720                 val="$undef"
9721                 vali="$define"
9722                 echo "index() found." >&4
9723         fi
9724 else
9725         if set strchr val -f d_strchr; eval $csym; $val; then
9726                 val="$define"
9727                 vali="$undef"
9728                 echo "strchr() found." >&4
9729         else
9730                 echo "No index() or strchr() found!" >&4
9731                 val="$undef"
9732                 vali="$undef"
9733         fi
9734 fi
9735 set d_strchr; eval $setvar
9736 val="$vali"
9737 set d_index; eval $setvar
9738
9739 : check whether inet_aton exists
9740 set inet_aton d_inetaton
9741 eval $inlibc
9742
9743 : see if inttypes.h is available
9744 : we want a real compile instead of Inhdr because some systems
9745 : have an inttypes.h which includes non-existent headers
9746 echo " "
9747 $cat >try.c <<EOCP
9748 #include <inttypes.h>
9749 int main() {
9750         static int32_t foo32 = 0x12345678;
9751 }
9752 EOCP
9753 set try
9754 if eval $compile; then
9755         echo "<inttypes.h> found." >&4
9756         val="$define"
9757 else
9758         echo "<inttypes.h> NOT found." >&4
9759         val="$undef"
9760 fi
9761 $rm -f try.c try
9762 set i_inttypes
9763 eval $setvar
9764
9765 : check for int64_t
9766 echo " "
9767 echo "Checking to see if you have int64_t..." >&4
9768 $cat >try.c <<EOCP
9769 #include <sys/types.h>
9770 #$i_inttypes I_INTTYPES
9771 #ifdef I_INTTYPES
9772 #include <inttypes.h>
9773 #endif
9774 int main() { int64_t x = 7; }
9775 EOCP
9776 set try
9777 if eval $compile; then
9778         val="$define"
9779         echo "You have int64_t."
9780 else
9781         val="$undef"
9782         echo "You do not have int64_t."
9783 fi
9784 $rm -f try try.*
9785 set d_int64_t
9786 eval $setvar
9787
9788 : Look for isascii
9789 echo " "
9790 $cat >isascii.c <<'EOCP'
9791 #include <stdio.h>
9792 #include <ctype.h>
9793 int main() {
9794         int c = 'A';
9795         if (isascii(c))
9796                 exit(0);
9797         else
9798                 exit(1);
9799 }
9800 EOCP
9801 set isascii
9802 if eval $compile; then
9803         echo "isascii() found." >&4
9804         val="$define"
9805 else
9806         echo "isascii() NOT found." >&4
9807         val="$undef"
9808 fi
9809 set d_isascii
9810 eval $setvar
9811 $rm -f isascii*
9812
9813 : see if isnan exists
9814 set isnan d_isnan
9815 eval $inlibc
9816
9817 : see if isnanl exists
9818 set isnanl d_isnanl
9819 eval $inlibc
9820
9821 : see if killpg exists
9822 set killpg d_killpg
9823 eval $inlibc
9824
9825 : see if lchown exists
9826 echo " "
9827 $cat > try.c <<'EOCP'
9828 /* System header to define __stub macros and hopefully few prototypes,
9829     which can conflict with char lchown(); below.  */
9830 #include <assert.h>
9831 /* Override any gcc2 internal prototype to avoid an error.  */
9832 /* We use char because int might match the return type of a gcc2
9833    builtin and then its argument prototype would still apply.  */
9834 char lchown();
9835 int main() {
9836     /*  The GNU C library defines this for functions which it implements
9837         to always fail with ENOSYS.  Some functions are actually named
9838         something starting with __ and the normal name is an alias.  */
9839 #if defined (__stub_lchown) || defined (__stub___lchown)
9840 choke me
9841 #else
9842 lchown();
9843 #endif
9844 ; return 0; }
9845 EOCP
9846 set try
9847 if eval $compile; then
9848     $echo "lchown() found." >&4
9849     val="$define"
9850 else
9851     $echo "lchown() NOT found." >&4
9852     val="$undef"
9853 fi
9854 set d_lchown
9855 eval $setvar
9856
9857 : See if number of significant digits in a double precision number is known
9858 echo " "
9859 $cat >ldbl_dig.c <<EOM
9860 #$i_limits I_LIMITS
9861 #$i_float I_FLOAT
9862 #ifdef I_LIMITS
9863 #include <limits.h>
9864 #endif
9865 #ifdef I_FLOAT
9866 #include <float.h>
9867 #endif
9868 #ifdef LDBL_DIG
9869 printf("Contains LDBL_DIG");
9870 #endif
9871 EOM
9872 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
9873 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
9874         echo "LDBL_DIG found." >&4
9875         val="$define"
9876 else
9877         echo "LDBL_DIG NOT found." >&4
9878         val="$undef"
9879 fi
9880 $rm -f ldbl_dig.?
9881 set d_ldbl_dig
9882 eval $setvar
9883
9884 : see if link exists
9885 set link d_link
9886 eval $inlibc
9887
9888 : see if localeconv exists
9889 set localeconv d_locconv
9890 eval $inlibc
9891
9892 : see if lockf exists
9893 set lockf d_lockf
9894 eval $inlibc
9895
9896 : check for long long
9897 echo " "
9898 echo "Checking to see if you have long long..." >&4
9899 echo 'int main() { long long x = 7; return 0; }' > try.c
9900 set try
9901 if eval $compile; then
9902         val="$define"
9903         echo "You have long long."
9904 else
9905         val="$undef"
9906         echo "You do not have long long."
9907 fi
9908 $rm try.*
9909 set d_longlong
9910 eval $setvar
9911
9912 : check for length of long long
9913 case "${d_longlong}${longlongsize}" in
9914 $define)
9915         echo " "
9916         echo "Checking to see how big your long longs are..." >&4
9917         $cat >try.c <<'EOCP'
9918 #include <stdio.h>
9919 int main()
9920 {
9921     printf("%d\n", (int)sizeof(long long));
9922     return(0);
9923 }
9924 EOCP
9925         set try
9926         if eval $compile_ok; then
9927                 longlongsize=`./try$exe_ext`
9928                 echo "Your long longs are $longlongsize bytes long."
9929         else
9930                 dflt='8'
9931                 echo " "
9932                 echo "(I can't seem to compile the test program.  Guessing...)"
9933                 rp="What is the size of a long long (in bytes)?"
9934                 . ./myread
9935                 longlongsize="$ans"
9936         fi
9937         if $test "X$longsize" = "X$longlongsize"; then
9938                 echo "(That isn't any different from an ordinary long.)"
9939         fi      
9940         ;;
9941 esac
9942 $rm -f try.* try
9943
9944 : see if prototype for lseek is available
9945 echo " "
9946 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
9947 eval $hasproto
9948
9949 : see if lstat exists
9950 set lstat d_lstat
9951 eval $inlibc
9952
9953 : see if madvise exists
9954 set madvise d_madvise
9955 eval $inlibc
9956
9957 : see if mblen exists
9958 set mblen d_mblen
9959 eval $inlibc
9960
9961 : see if mbstowcs exists
9962 set mbstowcs d_mbstowcs
9963 eval $inlibc
9964
9965 : see if mbtowc exists
9966 set mbtowc d_mbtowc
9967 eval $inlibc
9968
9969 : see if memchr exists
9970 set memchr d_memchr
9971 eval $inlibc
9972
9973 : see if memcmp exists
9974 set memcmp d_memcmp
9975 eval $inlibc
9976
9977 : see if memcpy exists
9978 set memcpy d_memcpy
9979 eval $inlibc
9980
9981 : see if memmove exists
9982 set memmove d_memmove
9983 eval $inlibc
9984
9985 : see if memset exists
9986 set memset d_memset
9987 eval $inlibc
9988
9989 : see if mkdir exists
9990 set mkdir d_mkdir
9991 eval $inlibc
9992
9993 : see if mkdtemp exists
9994 set mkdtemp d_mkdtemp
9995 eval $inlibc
9996
9997 : see if mkfifo exists
9998 set mkfifo d_mkfifo
9999 eval $inlibc
10000
10001 : see if mkstemp exists
10002 set mkstemp d_mkstemp
10003 eval $inlibc
10004
10005 : see if mkstemps exists
10006 set mkstemps d_mkstemps
10007 eval $inlibc
10008
10009 : see if mktime exists
10010 set mktime d_mktime
10011 eval $inlibc
10012
10013 : see if this is a sys/mman.h system
10014 set sys/mman.h i_sysmman
10015 eval $inhdr
10016
10017 : see if mmap exists
10018 set mmap d_mmap
10019 eval $inlibc
10020 : see what shmat returns
10021 : default to something harmless
10022 mmaptype='void *'
10023 case "$i_sysmman$d_mmap" in
10024 "$define$define")
10025         $cat >mmap.c <<'END'
10026 #include <sys/mman.h>
10027 void *mmap();
10028 END
10029         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
10030                 mmaptype='void *'
10031         else
10032                 mmaptype='caddr_t'
10033         fi
10034         echo "and it returns ($mmaptype)." >&4
10035         ;;
10036 esac
10037
10038
10039
10040 : see if modfl exists
10041 set modfl d_modfl
10042 eval $inlibc
10043
10044 : see if mprotect exists
10045 set mprotect d_mprotect
10046 eval $inlibc
10047
10048 : see if msgctl exists
10049 set msgctl d_msgctl
10050 eval $inlibc
10051
10052 : see if msgget exists
10053 set msgget d_msgget
10054 eval $inlibc
10055
10056 : see if msgsnd exists
10057 set msgsnd d_msgsnd
10058 eval $inlibc
10059
10060 : see if msgrcv exists
10061 set msgrcv d_msgrcv
10062 eval $inlibc
10063
10064 : see how much of the 'msg*(2)' library is present.
10065 h_msg=true
10066 echo " "
10067 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
10068 *"$undef"*) h_msg=false;;
10069 esac
10070 case "$osname" in
10071 freebsd)
10072     case "`ipcs 2>&1`" in
10073     "SVID messages"*"not configured"*)
10074         echo "Your $osname does not have the msg*(2) configured." >&4
10075         h_msg=false
10076         val="$undef"
10077         set msgctl d_msgctl
10078         eval $setvar
10079         set msgget d_msgget
10080         eval $setvar
10081         set msgsnd d_msgsnd
10082         eval $setvar
10083         set msgrcv d_msgrcv
10084         eval $setvar
10085         ;;
10086     esac
10087     ;;
10088 esac
10089 : we could also check for sys/ipc.h ...
10090 if $h_msg && $test `./findhdr sys/msg.h`; then
10091         echo "You have the full msg*(2) library." >&4
10092         val="$define"
10093 else
10094         echo "You don't have the full msg*(2) library." >&4
10095         val="$undef"
10096 fi
10097 set d_msg
10098 eval $setvar
10099
10100 : see if msync exists
10101 set msync d_msync
10102 eval $inlibc
10103
10104 : see if munmap exists
10105 set munmap d_munmap
10106 eval $inlibc
10107
10108 : see if nice exists
10109 set nice d_nice
10110 eval $inlibc
10111
10112
10113 echo " "
10114 echo "Checking which 64-bit integer type we could use..." >&4
10115
10116 case "$intsize" in
10117 8) val=int
10118    set quadtype
10119    eval $setvar
10120    val='"unsigned int"'
10121    set uquadtype
10122    eval $setvar
10123    quadkind=1
10124    ;;
10125 *) case "$longsize" in
10126    8) val=long
10127       set quadtype
10128       eval $setvar
10129       val='"unsigned long"'
10130       set uquadtype
10131       eval $setvar
10132       quadkind=2
10133       ;;
10134    *) case "$d_longlong:$longlongsize" in
10135       define:8)
10136         val='"long long"'
10137         set quadtype
10138         eval $setvar
10139         val='"unsigned long long"'
10140         set uquadtype
10141         eval $setvar
10142         quadkind=3
10143         ;;
10144       *) case "$d_int64_t" in
10145          define)
10146            val=int64_t
10147            set quadtype
10148            eval $setvar
10149            val=uint64_t
10150            set uquadtype
10151            eval $setvar
10152            quadkind=4
10153            ;;
10154          esac
10155          ;;
10156       esac
10157       ;;
10158    esac
10159    ;;
10160 esac
10161
10162 case "$quadtype" in
10163 '')     echo "Alas, no 64-bit integer types in sight." >&4
10164         d_quad="$undef"
10165         ;;
10166 *)      if test X"$use64bitint" = Xdefine -o X"$longsize" = X8; then
10167             verb="will"
10168         else
10169             verb="could"
10170         fi
10171         echo "We $verb use '$quadtype' for 64-bit integers." >&4
10172         d_quad="$define"
10173         ;;
10174 esac
10175
10176 : check for length of character
10177 echo " "
10178 case "$charsize" in
10179 '')
10180         echo "Checking to see how big your characters are (hey, you never know)..." >&4
10181         $cat >try.c <<'EOCP'
10182 #include <stdio.h>
10183 int main()
10184 {
10185     printf("%d\n", (int)sizeof(char));
10186     exit(0);
10187 }
10188 EOCP
10189         set try
10190         if eval $compile_ok; then
10191                 dflt=`./try`
10192         else
10193                 dflt='1'
10194                 echo "(I can't seem to compile the test program.  Guessing...)"
10195         fi
10196         ;;
10197 *)
10198         dflt="$charsize"
10199         ;;
10200 esac
10201 rp="What is the size of a character (in bytes)?"
10202 . ./myread
10203 charsize="$ans"
10204 $rm -f try.c try
10205
10206
10207 echo " "
10208 $echo "Choosing the C types to be used for Perl's internal types..." >&4
10209
10210 case "$use64bitint:$d_quad:$quadtype" in
10211 define:define:?*)
10212         ivtype="$quadtype"
10213         uvtype="$uquadtype"
10214         ivsize=8
10215         uvsize=8
10216         ;;
10217 *)      ivtype="long"
10218         uvtype="unsigned long"
10219         ivsize=$longsize
10220         uvsize=$longsize
10221         ;;
10222 esac
10223
10224 case "$uselongdouble:$d_longdbl" in
10225 define:define)
10226         nvtype="long double"
10227         nvsize=$longdblsize
10228         ;;
10229 *)      nvtype=double
10230         nvsize=$doublesize
10231         ;;
10232 esac
10233
10234 $echo "(IV will be "$ivtype", $ivsize bytes)"
10235 $echo "(UV will be "$uvtype", $uvsize bytes)"
10236 $echo "(NV will be "$nvtype", $nvsize bytes)"
10237
10238 $cat >try.c <<EOCP
10239 #$i_inttypes I_INTTYPES
10240 #ifdef I_INTTYPES
10241 #include <inttypes.h>
10242 #endif
10243 #include <stdio.h>
10244 int main() {
10245 #ifdef INT8
10246    int8_t i =  INT8_MAX;
10247   uint8_t u = UINT8_MAX;
10248   printf("int8_t\n");
10249 #endif
10250 #ifdef INT16
10251    int16_t i =  INT16_MAX;
10252   uint16_t i = UINT16_MAX;
10253   printf("int16_t\n");
10254 #endif
10255 #ifdef INT32
10256    int32_t i =  INT32_MAX;
10257   uint32_t u = UINT32_MAX;
10258   printf("int32_t\n");
10259 #endif
10260 }
10261 EOCP
10262
10263 case "$i8type" in
10264 '')     case "$charsize" in
10265         1)      i8type=char
10266                 u8type="unsigned char"
10267                 i8size=$charsize
10268                 u8size=$charsize
10269                 ;;
10270         esac
10271         ;;
10272 esac
10273 case "$i8type" in
10274 '')     set try -DINT8
10275         if eval $compile; then
10276                 case "`./try$exe_ext`" in
10277                 int8_t) i8type=int8_t
10278                         u8type=uint8_t
10279                         i8size=1
10280                         u8size=1
10281                         ;;
10282                 esac
10283         fi
10284         ;;
10285 esac
10286 case "$i8type" in
10287 '')     if $test $charsize -ge 1; then
10288                 i8type=char
10289                 u8type="unsigned char"
10290                 i8size=$charsize
10291                 u8size=$charsize
10292         fi
10293         ;;
10294 esac
10295
10296 case "$i16type" in
10297 '')     case "$shortsize" in
10298         2)      i16type=short
10299                 u16type="unsigned short"
10300                 i16size=$shortsize
10301                 u16size=$shortsize
10302                 ;;
10303         esac
10304         ;;
10305 esac
10306 case "$i16type" in
10307 '')     set try -DINT16
10308         if eval $compile; then
10309                 case "`./try$exe_ext`" in
10310                 int16_t)
10311                         i16type=int16_t
10312                         u16type=uint16_t
10313                         i16size=2
10314                         u16size=2
10315                         ;;
10316                 esac
10317         fi
10318         ;;
10319 esac
10320 case "$i16type" in
10321 '')     if $test $shortsize -ge 2; then
10322                 i16type=short
10323                 u16type="unsigned short"
10324                 i16size=$shortsize
10325                 u16size=$shortsize
10326         fi
10327         ;;
10328 esac
10329
10330 case "$i32type" in
10331 '')     case "$longsize" in
10332         4)      i32type=long
10333                 u32type="unsigned long"
10334                 i32size=$longsize
10335                 u32size=$longsize
10336                 ;;
10337         *)      case "$intsize" in
10338                 4)      i32type=int
10339                         u32type="unsigned int"
10340                         i32size=$intsize
10341                         u32size=$intsize
10342                         ;;
10343                 esac
10344                 ;;
10345         esac
10346         ;;
10347 esac
10348 case "$i32type" in
10349 '')     set try -DINT32
10350         if eval $compile; then
10351                 case "`./try$exe_ext`" in
10352                 int32_t)
10353                         i32type=int32_t
10354                         u32type=uint32_t
10355                         i32size=4
10356                         u32size=4
10357                         ;;
10358                 esac
10359         fi
10360         ;;
10361 esac
10362 case "$i32type" in
10363 '')     if $test $intsize -ge 4; then
10364                 i32type=int
10365                 u32type="unsigned int"
10366                 i32size=$intsize
10367                 u32size=$intsize
10368         fi
10369         ;;
10370 esac
10371
10372 case "$i64type" in
10373 '')     case "$d_quad:$quadtype" in
10374         define:?*)
10375                 i64type="$quadtype"
10376                 u64type="$uquadtype"
10377                 i64size=8
10378                 u64size=8
10379                 ;;
10380         esac
10381         ;;
10382 esac
10383
10384 $echo "Checking whether your NVs can preserve your UVs..." >&4
10385 $cat <<EOP >try.c
10386 #include <stdio.h>
10387 int main() {
10388     $uvtype k = ($uvtype)~0, l;
10389     $nvtype d;
10390     l = k;
10391     d = ($nvtype)l;
10392     l = ($uvtype)d;
10393     if (l == k)
10394        printf("preserve\n");
10395     exit(0);
10396 }
10397 EOP
10398 set try
10399 if eval $compile; then
10400         case "`./try$exe_ext`" in
10401         preserve) d_nv_preserves_uv="$define" ;;
10402         esac
10403 fi      
10404 case "$d_nv_preserves_uv" in
10405 $define) $echo "Yes, they can."  2>&1 ;;
10406 *)       $echo "No, they can't." 2>&1
10407          d_nv_preserves_uv="$undef"
10408          ;;
10409 esac
10410
10411 $rm -f try.* try
10412
10413 case "$d_nv_preserves_uv" in
10414 "$define") d_nv_preserves_uv_bits=`expr $uvsize \* 8` ;;
10415 *)      $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
10416         $cat <<EOP >try.c
10417 #include <stdio.h>
10418 int main() {
10419     $uvtype u = 0;
10420     int     n = 8 * $uvsize;
10421     int     i;
10422     for (i = 0; i < n; i++) {
10423       u = u << 1 | ($uvtype)1;
10424       if (($uvtype)($nvtype)u != u)
10425         break;
10426     }
10427     printf("%d\n", i);
10428     exit(0);
10429 }
10430 EOP
10431         set try
10432         if eval $compile; then
10433                 d_nv_preserves_uv_bits="`./try$exe_ext`"
10434         fi
10435         case "$d_nv_preserves_uv_bits" in
10436         [1-9]*) $echo "Your NVs can preserve $d_nv_preserves_uv_bits bits of your UVs."  2>&1 ;;
10437         *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
10438                 d_nv_preserves_uv_bits="$undef"
10439                 ;;
10440         esac
10441         $rm -f try.* try
10442         ;;
10443 esac
10444
10445
10446 : check for off64_t
10447 echo " "
10448 echo "Checking to see if you have off64_t..." >&4
10449 $cat >try.c <<EOCP
10450 #include <sys/types.h>
10451 #include <unistd.h>
10452 int main() { off64_t x = 7; }
10453 EOCP
10454 set try
10455 if eval $compile; then
10456         val="$define"
10457         echo "You have off64_t."
10458 else
10459         val="$undef"
10460         echo "You do not have off64_t."
10461         case "$lseeksize" in
10462         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
10463         esac
10464 fi
10465 $rm -f try.* try
10466 set d_off64_t
10467 eval $setvar
10468
10469 : see if POSIX threads are available
10470 set pthread.h i_pthread
10471 eval $inhdr
10472
10473
10474
10475
10476 : how to create joinable pthreads
10477 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
10478         echo " "
10479         echo "Checking what constant to use for creating joinable pthreads..." >&4 
10480         $cat >try.c <<'EOCP'
10481 #include <pthread.h>
10482 int main() {
10483     int detachstate = JOINABLE;
10484 }
10485 EOCP
10486         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
10487         if eval $compile; then
10488                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
10489                 val="$undef" # Yes, undef.
10490                 set d_old_pthread_create_joinable
10491                 eval $setvar
10492                 val=""
10493                 set old_pthread_create_joinable
10494                 eval $setvar
10495         else
10496                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
10497                 if eval $compile; then
10498                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
10499                         val="$define"
10500                         set d_old_pthread_create_joinable
10501                         eval $setvar
10502                         val=PTHREAD_CREATE_UNDETACHED
10503                         set old_pthread_create_joinable
10504                         eval $setvar
10505                 else            
10506                         set try -DJOINABLE=__UNDETACHED
10507                         if eval $compile; then
10508                                 echo "You seem to use __UNDETACHED." >&4
10509                                 val="$define"
10510                                 set d_old_pthread_create_joinable
10511                                 eval $setvar
10512                                 val=__UNDETACHED
10513                                 set old_pthread_create_joinable
10514                                 eval $setvar
10515                         else
10516                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
10517                                 val="$define"
10518                                 set d_old_pthread_create_joinable
10519                                 eval $setvar
10520                                 val=0
10521                                 set old_pthread_create_joinable
10522                                 eval $setvar
10523                         fi
10524                 fi
10525         fi
10526         $rm -f try try.*
10527 else
10528     d_old_pthread_create_joinable="$undef"
10529     old_pthread_create_joinable=""
10530 fi
10531
10532 : see if pause exists
10533 set pause d_pause
10534 eval $inlibc
10535
10536 : see if pipe exists
10537 set pipe d_pipe
10538 eval $inlibc
10539
10540 : see if poll exists
10541 set poll d_poll
10542 eval $inlibc
10543
10544
10545 : see whether the various POSIXish _yields exist
10546 $cat >try.c <<EOP
10547 #include <pthread.h>
10548 #include <stdio.h>
10549 int main() {
10550 #ifdef SCHED_YIELD
10551         sched_yield();
10552 #else
10553 #ifdef PTHREAD_YIELD
10554         pthread_yield();
10555 #else
10556 #ifdef PTHREAD_YIELD_NULL
10557         pthread_yield(NULL);
10558 #endif
10559 #endif
10560 #endif
10561 }
10562 EOP
10563 : see if sched_yield exists
10564 set try -DSCHED_YIELD
10565 if eval $compile; then
10566     val="$define"
10567     sched_yield='sched_yield()'
10568 else
10569     val="$undef"
10570 fi
10571 case "$usethreads" in
10572 $define)
10573         case "$val" in
10574         $define) echo 'sched_yield() found.' >&4        ;;
10575         *)       echo 'sched_yield() NOT found.' >&4    ;;
10576         esac
10577 esac
10578 set d_sched_yield
10579 eval $setvar
10580
10581 : see if pthread_yield exists
10582 set try -DPTHREAD_YIELD
10583 if eval $compile; then
10584     val="$define"
10585     case "$sched_yield" in
10586     '') sched_yield='pthread_yield()' ;;
10587     esac
10588 else
10589     set try -DPTHREAD_YIELD_NULL
10590     if eval $compile; then
10591         val="$define"
10592         case "$sched_yield" in
10593         '') sched_yield='pthread_yield(NULL)' ;;
10594         esac
10595     else
10596         val="$undef"
10597     fi
10598 fi
10599 case "$usethreads" in
10600 $define)
10601         case "$val" in
10602         $define) echo 'pthread_yield() found.' >&4      ;;
10603         *)       echo 'pthread_yield() NOT found.' >&4  ;;
10604         esac
10605         ;;
10606 esac
10607 set d_pthread_yield
10608 eval $setvar
10609
10610 case "$sched_yield" in
10611 '') sched_yield=undef ;;
10612 esac
10613
10614 $rm -f try try.*
10615
10616 : see if this is a pwd.h system
10617 set pwd.h i_pwd
10618 eval $inhdr
10619
10620 case "$i_pwd" in
10621 $define)
10622         xxx=`./findhdr pwd.h`
10623         $cppstdin $cppflags $cppminus < $xxx >$$.h
10624
10625         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
10626                 val="$define"
10627         else
10628                 val="$undef"
10629         fi
10630         set d_pwquota
10631         eval $setvar
10632
10633         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
10634                 val="$define"
10635         else
10636                 val="$undef"
10637         fi
10638         set d_pwage
10639         eval $setvar
10640
10641         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
10642                 val="$define"
10643         else
10644                 val="$undef"
10645         fi
10646         set d_pwchange
10647         eval $setvar
10648
10649         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
10650                 val="$define"
10651         else
10652                 val="$undef"
10653         fi
10654         set d_pwclass
10655         eval $setvar
10656
10657         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
10658                 val="$define"
10659         else
10660                 val="$undef"
10661         fi
10662         set d_pwexpire
10663         eval $setvar
10664
10665         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
10666                 val="$define"
10667         else
10668                 val="$undef"
10669         fi
10670         set d_pwcomment
10671         eval $setvar
10672
10673         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
10674                 val="$define"
10675         else
10676                 val="$undef"
10677         fi
10678         set d_pwgecos
10679         eval $setvar
10680
10681         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
10682                 val="$define"
10683         else
10684                 val="$undef"
10685         fi
10686         set d_pwpasswd
10687         eval $setvar
10688
10689         $rm -f $$.h
10690         ;;
10691 *)
10692         val="$undef"; 
10693         set d_pwquota; eval $setvar
10694         set d_pwage; eval $setvar
10695         set d_pwchange; eval $setvar
10696         set d_pwclass; eval $setvar
10697         set d_pwexpire; eval $setvar
10698         set d_pwcomment; eval $setvar
10699         set d_pwgecos; eval $setvar
10700         set d_pwpasswd; eval $setvar
10701         ;;
10702 esac
10703
10704 : see if readdir and friends exist
10705 set readdir d_readdir
10706 eval $inlibc
10707 set seekdir d_seekdir
10708 eval $inlibc
10709 set telldir d_telldir
10710 eval $inlibc
10711 set rewinddir d_rewinddir
10712 eval $inlibc
10713
10714 : see if readlink exists
10715 set readlink d_readlink
10716 eval $inlibc
10717
10718 : see if rename exists
10719 set rename d_rename
10720 eval $inlibc
10721
10722 : see if rmdir exists
10723 set rmdir d_rmdir
10724 eval $inlibc
10725
10726 : see if memory.h is available.
10727 val=''
10728 set memory.h val
10729 eval $inhdr
10730
10731 : See if it conflicts with string.h
10732 case "$val" in
10733 $define)
10734         case "$strings" in
10735         '') ;;
10736         *)
10737                 $cppstdin $cppflags $cppminus < $strings > mem.h
10738                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
10739                         echo " "
10740                         echo "We won't be including <memory.h>."
10741                         val="$undef"
10742                 fi
10743                 $rm -f mem.h
10744                 ;;
10745         esac
10746 esac
10747 set i_memory
10748 eval $setvar
10749
10750 : can bcopy handle overlapping blocks?
10751 val="$undef"
10752 case "$d_bcopy" in
10753 "$define")
10754         echo " "
10755         echo "Checking to see if your bcopy() can do overlapping copies..." >&4
10756         $cat >try.c <<EOCP
10757 #$i_memory I_MEMORY
10758 #$i_stdlib I_STDLIB
10759 #$i_string I_STRING
10760 #$i_unistd I_UNISTD
10761 EOCP
10762         $cat >>try.c <<'EOCP'
10763 #include <stdio.h>
10764 #ifdef I_MEMORY
10765 #  include <memory.h>
10766 #endif
10767 #ifdef I_STDLIB
10768 #  include <stdlib.h>
10769 #endif
10770 #ifdef I_STRING
10771 #  include <string.h>
10772 #else
10773 #  include <strings.h>
10774 #endif
10775 #ifdef I_UNISTD
10776 #  include <unistd.h>  /* Needed for NetBSD */
10777 #endif
10778 int main()
10779 {
10780 char buf[128], abc[128];
10781 char *b;
10782 int len;
10783 int off;
10784 int align;
10785
10786 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
10787
10788 for (align = 7; align >= 0; align--) {
10789         for (len = 36; len; len--) {
10790                 b = buf+align;
10791                 bcopy(abc, b, len);
10792                 for (off = 1; off <= len; off++) {
10793                         bcopy(b, b+off, len);
10794                         bcopy(b+off, b, len);
10795                         if (bcmp(b, abc, len))
10796                                 exit(1);
10797                 }
10798         }
10799 }
10800 exit(0);
10801 }
10802 EOCP
10803         set try
10804         if eval $compile_ok; then
10805                 if ./try 2>/dev/null; then
10806                         echo "Yes, it can."
10807                         val="$define"
10808                 else
10809                         echo "It can't, sorry."
10810                         case "$d_memmove" in
10811                         "$define") echo "But that's Ok since you have memmove()." ;;
10812                         esac
10813                 fi
10814         else
10815                 echo "(I can't compile the test program, so we'll assume not...)"
10816                 case "$d_memmove" in
10817                 "$define") echo "But that's Ok since you have memmove()." ;;
10818                 esac
10819         fi
10820         ;;
10821 esac
10822 $rm -f try.* try core
10823 set d_safebcpy
10824 eval $setvar
10825
10826 : can memcpy handle overlapping blocks?
10827 val="$undef"
10828 case "$d_memcpy" in
10829 "$define")
10830         echo " "
10831         echo "Checking to see if your memcpy() can do overlapping copies..." >&4
10832         $cat >try.c <<EOCP
10833 #$i_memory I_MEMORY
10834 #$i_stdlib I_STDLIB
10835 #$i_string I_STRING
10836 #$i_unistd I_UNISTD
10837 EOCP
10838         $cat >>try.c <<'EOCP'
10839 #include <stdio.h>
10840 #ifdef I_MEMORY
10841 #  include <memory.h>
10842 #endif
10843 #ifdef I_STDLIB
10844 #  include <stdlib.h>
10845 #endif
10846 #ifdef I_STRING
10847 #  include <string.h>
10848 #else
10849 #  include <strings.h>
10850 #endif
10851 #ifdef I_UNISTD
10852 #  include <unistd.h>  /* Needed for NetBSD */
10853 #endif
10854 int main()
10855 {
10856 char buf[128], abc[128];
10857 char *b;
10858 int len;
10859 int off;
10860 int align;
10861
10862 /* Copy "abcde..." string to char abc[] so that gcc doesn't
10863    try to store the string in read-only memory. */
10864 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
10865
10866 for (align = 7; align >= 0; align--) {
10867         for (len = 36; len; len--) {
10868                 b = buf+align;
10869                 memcpy(b, abc, len);
10870                 for (off = 1; off <= len; off++) {
10871                         memcpy(b+off, b, len);
10872                         memcpy(b, b+off, len);
10873                         if (memcmp(b, abc, len))
10874                                 exit(1);
10875                 }
10876         }
10877 }
10878 exit(0);
10879 }
10880 EOCP
10881         set try
10882         if eval $compile_ok; then
10883                 if ./try 2>/dev/null; then
10884                         echo "Yes, it can."
10885                         val="$define"
10886                 else
10887                         echo "It can't, sorry."
10888                         case "$d_memmove" in
10889                         "$define") echo "But that's Ok since you have memmove()." ;;
10890                         esac
10891                 fi
10892         else
10893                 echo "(I can't compile the test program, so we'll assume not...)"
10894                 case "$d_memmove" in
10895                 "$define") echo "But that's Ok since you have memmove()." ;;
10896                 esac
10897         fi
10898         ;;
10899 esac
10900 $rm -f try.* try core
10901 set d_safemcpy
10902 eval $setvar
10903
10904 : can memcmp be trusted to compare relative magnitude?
10905 val="$undef"
10906 case "$d_memcmp" in
10907 "$define")
10908         echo " "
10909         echo "Checking if your memcmp() can compare relative magnitude..." >&4
10910         $cat >try.c <<EOCP
10911 #$i_memory I_MEMORY
10912 #$i_stdlib I_STDLIB
10913 #$i_string I_STRING
10914 #$i_unistd I_UNISTD
10915 EOCP
10916         $cat >>try.c <<'EOCP'
10917 #include <stdio.h>
10918 #ifdef I_MEMORY
10919 #  include <memory.h>
10920 #endif
10921 #ifdef I_STDLIB
10922 #  include <stdlib.h>
10923 #endif
10924 #ifdef I_STRING
10925 #  include <string.h>
10926 #else
10927 #  include <strings.h>
10928 #endif
10929 #ifdef I_UNISTD
10930 #  include <unistd.h>  /* Needed for NetBSD */
10931 #endif
10932 int main()
10933 {
10934 char a = -1;
10935 char b = 0;
10936 if ((a < b) && memcmp(&a, &b, 1) < 0)
10937         exit(1);
10938 exit(0);
10939 }
10940 EOCP
10941         set try
10942         if eval $compile_ok; then
10943                 if ./try 2>/dev/null; then
10944                         echo "Yes, it can."
10945                         val="$define"
10946                 else
10947                         echo "No, it can't (it uses signed chars)."
10948                 fi
10949         else
10950                 echo "(I can't compile the test program, so we'll assume not...)"
10951         fi
10952         ;;
10953 esac
10954 $rm -f try.* try core
10955 set d_sanemcmp
10956 eval $setvar
10957
10958 : see if select exists
10959 set select d_select
10960 eval $inlibc
10961
10962 : see if semctl exists
10963 set semctl d_semctl
10964 eval $inlibc
10965
10966 : see if semget exists
10967 set semget d_semget
10968 eval $inlibc
10969
10970 : see if semop exists
10971 set semop d_semop
10972 eval $inlibc
10973
10974 : see how much of the 'sem*(2)' library is present.
10975 h_sem=true
10976 echo " "
10977 case "$d_semctl$d_semget$d_semop" in
10978 *"$undef"*) h_sem=false;;
10979 esac
10980 case "$osname" in
10981 freebsd)
10982     case "`ipcs 2>&1`" in
10983     "SVID messages"*"not configured"*)
10984         echo "Your $osname does not have the sem*(2) configured." >&4
10985         h_sem=false
10986         val="$undef"
10987         set semctl d_semctl
10988         eval $setvar
10989         set semget d_semget
10990         eval $setvar
10991         set semop d_semop
10992         eval $setvar
10993         ;;
10994     esac
10995     ;;
10996 esac
10997 : we could also check for sys/ipc.h ...
10998 if $h_sem && $test `./findhdr sys/sem.h`; then
10999         echo "You have the full sem*(2) library." >&4
11000         val="$define"
11001 else
11002         echo "You don't have the full sem*(2) library." >&4
11003         val="$undef"
11004 fi
11005 set d_sem
11006 eval $setvar
11007
11008 : see whether sys/sem.h defines union semun
11009 echo " "
11010 $cat > try.c <<'END'
11011 #include <sys/types.h>
11012 #include <sys/ipc.h>
11013 #include <sys/sem.h>
11014 int main () { union semun semun; semun.buf = 0; }
11015 END
11016 set try
11017 if eval $compile; then
11018     echo "You have union semun in <sys/sem.h>." >&4
11019     val="$define"
11020 else
11021     echo "You do not have union semun in <sys/sem.h>." >&4
11022     val="$undef"
11023 fi
11024 $rm -f try try.c try.h
11025 set d_union_semun
11026 eval $setvar
11027
11028 : see how to do semctl IPC_STAT
11029 case "$d_sem" in
11030 $define)
11031     : see whether semctl IPC_STAT can use union semun
11032     echo " "
11033     $cat > try.h <<END
11034 #ifndef S_IRUSR
11035 #   ifdef S_IREAD
11036 #       define S_IRUSR S_IREAD
11037 #       define S_IWUSR S_IWRITE
11038 #       define S_IXUSR S_IEXEC
11039 #   else
11040 #       define S_IRUSR 0400
11041 #       define S_IWUSR 0200
11042 #       define S_IXUSR 0100
11043 #   endif
11044 #   define S_IRGRP (S_IRUSR>>3)
11045 #   define S_IWGRP (S_IWUSR>>3)
11046 #   define S_IXGRP (S_IXUSR>>3)
11047 #   define S_IROTH (S_IRUSR>>6)
11048 #   define S_IWOTH (S_IWUSR>>6)
11049 #   define S_IXOTH (S_IXUSR>>6)
11050 #endif
11051 #ifndef S_IRWXU
11052 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
11053 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
11054 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
11055 #endif
11056 END
11057
11058     $cat > try.c <<END
11059 #include <sys/types.h>
11060 #include <sys/ipc.h>
11061 #include <sys/sem.h>
11062 #include <sys/stat.h>
11063 #include <stdio.h>
11064 #include <errno.h>
11065 #include "try.h"
11066 #ifndef errno
11067 extern int errno;
11068 #endif
11069 #$d_union_semun HAS_UNION_SEMUN
11070 int main() {
11071     union semun
11072 #ifndef HAS_UNION_SEMUN
11073     {
11074         int val;
11075         struct semid_ds *buf;
11076         unsigned short *array;
11077     }
11078 #endif
11079     arg;
11080     int sem, st;
11081
11082 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
11083     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
11084     if (sem > -1) {
11085         struct semid_ds argbuf;
11086         arg.buf = &argbuf;
11087 #       ifdef IPC_STAT
11088         st = semctl(sem, 0, IPC_STAT, arg);
11089         if (st == 0)
11090             printf("semun\n");
11091         else
11092 #       endif /* IPC_STAT */
11093             printf("semctl IPC_STAT failed: errno = %d\n", errno);
11094 #       ifdef IPC_RMID
11095         if (semctl(sem, 0, IPC_RMID, arg) != 0)
11096 #       endif /* IPC_RMID */
11097             printf("semctl IPC_RMID failed: errno = %d\n", errno);
11098     } else
11099 #endif /* IPC_PRIVATE && ... */
11100         printf("semget failed: errno = %d\n", errno);
11101   return 0;
11102 }
11103 END
11104     val="$undef"
11105     set try
11106     if eval $compile; then
11107         xxx=`./try`
11108         case "$xxx" in
11109         semun) val="$define" ;;
11110         esac
11111     fi
11112     $rm -f try try.c
11113     set d_semctl_semun
11114     eval $setvar
11115     case "$d_semctl_semun" in
11116     $define)
11117         echo "You can use union semun for semctl IPC_STAT." >&4
11118         also='also'
11119         ;;
11120     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
11121         also=''
11122         ;;
11123     esac
11124
11125     : see whether semctl IPC_STAT can use struct semid_ds pointer
11126     $cat > try.c <<'END'
11127 #include <sys/types.h>
11128 #include <sys/ipc.h>
11129 #include <sys/sem.h>
11130 #include <sys/stat.h>
11131 #include "try.h"
11132 #include <stdio.h>
11133 #include <errno.h>
11134 #ifndef errno
11135 extern int errno;
11136 #endif
11137 int main() {
11138     struct semid_ds arg;
11139     int sem, st;
11140
11141 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
11142     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
11143     if (sem > -1) {
11144 #       ifdef IPC_STAT
11145         st = semctl(sem, 0, IPC_STAT, &arg);
11146         if (st == 0)
11147             printf("semid_ds\n");
11148         else
11149 #       endif /* IPC_STAT */
11150             printf("semctl IPC_STAT failed: errno = %d\n", errno);
11151 #       ifdef IPC_RMID
11152         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
11153 #       endif /* IPC_RMID */
11154             printf("semctl IPC_RMID failed: errno = %d\n", errno);
11155     } else
11156 #endif /* IPC_PRIVATE && ... */
11157         printf("semget failed: errno = %d\n", errno);
11158
11159     return 0;
11160 }
11161 END
11162     val="$undef"
11163     set try
11164     if eval $compile; then
11165         xxx=`./try`
11166         case "$xxx" in
11167         semid_ds) val="$define" ;;
11168         esac
11169     fi
11170     $rm -f try try.c
11171     set d_semctl_semid_ds
11172     eval $setvar
11173     case "$d_semctl_semid_ds" in
11174     $define)
11175         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
11176         ;;
11177     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
11178         ;;
11179     esac
11180     $rm -f try.h
11181     ;;
11182 *)  val="$undef"
11183
11184     # We do not have the full sem*(2) library, so assume we can not
11185     # use either.
11186
11187     set d_semctl_semun
11188     eval $setvar
11189
11190     set d_semctl_semid_ds
11191     eval $setvar
11192     ;;
11193 esac
11194
11195 : see if setegid exists
11196 set setegid d_setegid
11197 eval $inlibc
11198
11199 : see if seteuid exists
11200 set seteuid d_seteuid
11201 eval $inlibc
11202
11203 : see if setgrent exists
11204 set setgrent d_setgrent
11205 eval $inlibc
11206
11207 : see if sethostent exists
11208 set sethostent d_sethent
11209 eval $inlibc
11210
11211 : see if setlinebuf exists
11212 set setlinebuf d_setlinebuf
11213 eval $inlibc
11214
11215 : see if setlocale exists
11216 set setlocale d_setlocale
11217 eval $inlibc
11218
11219 : see if setnetent exists
11220 set setnetent d_setnent
11221 eval $inlibc
11222
11223 : see if setprotoent exists
11224 set setprotoent d_setpent
11225 eval $inlibc
11226
11227 : see if setpgid exists
11228 set setpgid d_setpgid
11229 eval $inlibc
11230
11231 : see if setpgrp2 exists
11232 set setpgrp2 d_setpgrp2
11233 eval $inlibc
11234
11235 : see if setpriority exists
11236 set setpriority d_setprior
11237 eval $inlibc
11238
11239 : see if setproctitle exists
11240 set setproctitle d_setproctitle
11241 eval $inlibc
11242
11243 : see if setpwent exists
11244 set setpwent d_setpwent
11245 eval $inlibc
11246
11247 : see if setregid exists
11248 set setregid d_setregid
11249 eval $inlibc
11250 set setresgid d_setresgid
11251 eval $inlibc
11252
11253 : see if setreuid exists
11254 set setreuid d_setreuid
11255 eval $inlibc
11256 set setresuid d_setresuid
11257 eval $inlibc
11258
11259 : see if setrgid exists
11260 set setrgid d_setrgid
11261 eval $inlibc
11262
11263 : see if setruid exists
11264 set setruid d_setruid
11265 eval $inlibc
11266
11267 : see if setservent exists
11268 set setservent d_setsent
11269 eval $inlibc
11270
11271 : see if setsid exists
11272 set setsid d_setsid
11273 eval $inlibc
11274
11275 : see if setvbuf exists
11276 set setvbuf d_setvbuf
11277 eval $inlibc
11278
11279 : see if sfio.h is available
11280 set sfio.h i_sfio
11281 eval $inhdr
11282
11283
11284 : see if sfio library is available
11285 case "$i_sfio" in
11286 $define)
11287         val=''
11288         set sfreserve val
11289         eval $inlibc
11290         ;;
11291 *)
11292         val="$undef"
11293         ;;
11294 esac
11295 : Ok, but do we want to use it.
11296 case "$val" in
11297 $define)
11298         case "$usesfio" in
11299         true|$define|[yY]*) dflt='y';;
11300         *) dflt='n';;
11301         esac
11302         echo "$package can use the sfio library, but it is experimental."
11303         case "$useperlio" in
11304         "$undef")
11305             echo "For sfio also the PerlIO abstraction layer is needed."
11306             echo "Earlier you said you wouldn't want that."
11307             ;;
11308         esac
11309         rp="You seem to have sfio available, do you want to try using it?"
11310         . ./myread
11311         case "$ans" in
11312         y|Y)    echo "Ok, turning on both sfio and PerlIO, then."
11313                 useperlio="$define"
11314                 val="$define"
11315                 ;;
11316         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
11317                 val="$undef"
11318                 : Remove sfio from list of libraries to use
11319                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
11320                 shift
11321                 libs="$*"
11322                 echo "libs = $libs" >&4
11323                 ;;
11324         esac
11325         ;;
11326 *)      case "$usesfio" in
11327         true|$define|[yY]*)
11328                 echo "Sorry, cannot find sfio on this machine." >&4
11329                 echo "Ignoring your setting of usesfio=$usesfio." >&4
11330                 val="$undef"
11331                 ;;
11332         esac
11333         ;;
11334 esac
11335 set d_sfio
11336 eval $setvar
11337 case "$d_sfio" in
11338 $define) usesfio='true';;
11339 *) usesfio='false';;
11340 esac
11341
11342 : see if shmctl exists
11343 set shmctl d_shmctl
11344 eval $inlibc
11345
11346 : see if shmget exists
11347 set shmget d_shmget
11348 eval $inlibc
11349
11350 : see if shmat exists
11351 set shmat d_shmat
11352 eval $inlibc
11353 : see what shmat returns
11354 case "$d_shmat" in
11355 "$define")
11356         $cat >shmat.c <<'END'
11357 #include <sys/shm.h>
11358 void *shmat();
11359 END
11360         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
11361                 shmattype='void *'
11362         else
11363                 shmattype='char *'
11364         fi
11365         echo "and it returns ($shmattype)." >&4
11366         : see if a prototype for shmat is available
11367         xxx=`./findhdr sys/shm.h`
11368         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
11369         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
11370                 val="$define"
11371         else
11372                 val="$undef"
11373         fi
11374         $rm -f shmat.[co]
11375         ;;
11376 *)
11377         val="$undef"
11378         ;;
11379 esac
11380 set d_shmatprototype
11381 eval $setvar
11382
11383 : see if shmdt exists
11384 set shmdt d_shmdt
11385 eval $inlibc
11386
11387 : see how much of the 'shm*(2)' library is present.
11388 h_shm=true
11389 echo " "
11390 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
11391 *"$undef"*) h_shm=false;;
11392 esac
11393 case "$osname" in
11394 freebsd)
11395     case "`ipcs 2>&1`" in
11396     "SVID shared memory"*"not configured"*)
11397         echo "Your $osname does not have the shm*(2) configured." >&4
11398         h_shm=false
11399         val="$undef"
11400         set shmctl d_shmctl
11401         evat $setvar
11402         set shmget d_shmget
11403         evat $setvar
11404         set shmat d_shmat
11405         evat $setvar
11406         set shmdt d_shmdt
11407         evat $setvar
11408         ;;
11409     esac
11410     ;;
11411 esac
11412 : we could also check for sys/ipc.h ...
11413 if $h_shm && $test `./findhdr sys/shm.h`; then
11414         echo "You have the full shm*(2) library." >&4
11415         val="$define"
11416 else
11417         echo "You don't have the full shm*(2) library." >&4
11418         val="$undef"
11419 fi
11420 set d_shm
11421 eval $setvar
11422
11423 echo " "
11424 : see if we have sigaction
11425 if set sigaction val -f d_sigaction; eval $csym; $val; then
11426         echo 'sigaction() found.' >&4
11427         $cat > try.c <<'EOP'
11428 #include <stdio.h>
11429 #include <sys/types.h>
11430 #include <signal.h>
11431 int main()
11432 {
11433     struct sigaction act, oact;
11434     act.sa_flags = 0;
11435     oact.sa_handler = 0;
11436     /* so that act and oact are used */
11437     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
11438 }
11439 EOP
11440         set try
11441         if eval $compile_ok; then
11442                 val="$define"
11443         else
11444                 echo "But you don't seem to have a useable struct sigaction." >&4
11445                 val="$undef"
11446         fi
11447 else
11448         echo 'sigaction NOT found.' >&4
11449         val="$undef"
11450 fi
11451 set d_sigaction; eval $setvar
11452 $rm -f try try$_o try.c
11453
11454 : see if sigsetjmp exists
11455 echo " "
11456 case "$d_sigsetjmp" in
11457 '')
11458         $cat >try.c <<'EOP'
11459 #include <setjmp.h>
11460 sigjmp_buf env;
11461 int set = 1;
11462 int main()
11463 {
11464         if (sigsetjmp(env,1))
11465                 exit(set);
11466         set = 0;
11467         siglongjmp(env, 1);
11468         exit(1);
11469 }
11470 EOP
11471         set try
11472         if eval $compile; then
11473                 if ./try >/dev/null 2>&1; then
11474                         echo "POSIX sigsetjmp found." >&4
11475                         val="$define"
11476                 else
11477                         $cat >&4 <<EOM
11478 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
11479 I'll ignore them.
11480 EOM
11481                         val="$undef"
11482                 fi
11483         else
11484                 echo "sigsetjmp not found." >&4
11485                 val="$undef"
11486         fi
11487         ;;
11488 *) val="$d_sigsetjmp"
11489         case "$d_sigsetjmp" in
11490         $define) echo "POSIX sigsetjmp found." >&4;;
11491         $undef) echo "sigsetjmp not found." >&4;;
11492         esac
11493         ;;
11494 esac
11495 set d_sigsetjmp
11496 eval $setvar
11497 $rm -f try.c try
11498
11499 : see if socks5_init exists
11500 set socks5_init d_socks5_init
11501 eval $inlibc
11502
11503 : see if sys/stat.h is available
11504 set sys/stat.h i_sysstat
11505 eval $inhdr
11506
11507
11508 : see if stat knows about block sizes
11509 echo " "
11510 echo "Checking to see if your struct stat has st_blocks field..." >&4
11511 set d_statblks stat st_blocks $i_sysstat sys/stat.h
11512 eval $hasfield
11513
11514
11515 : see if this is a sys/vfs.h system
11516 set sys/vfs.h i_sysvfs
11517 eval $inhdr
11518
11519
11520 : see if this is a sys/statfs.h system
11521 set sys/statfs.h i_sysstatfs
11522 eval $inhdr
11523
11524
11525 echo " "
11526 echo "Checking to see if your system supports struct statfs..." >&4
11527 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
11528 eval $hasstruct
11529 case "$d_statfs_s" in
11530 "$define")      echo "Yes, it does."   ;;
11531 *)              echo "No, it doesn't." ;;
11532 esac
11533
11534
11535
11536 : see if struct statfs knows about f_flags
11537 case "$d_statfs_s" in
11538 define) 
11539         echo " "
11540         echo "Checking to see if your struct statfs has f_flags field..." >&4
11541         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
11542         eval $hasfield
11543         ;;
11544 *)      val="$undef"
11545         set d_statfs_f_flags
11546         eval $setvar
11547         ;;
11548 esac
11549 case "$d_statfs_f_flags" in
11550 "$define")      echo "Yes, it does."   ;;
11551 *)              echo "No, it doesn't." ;;
11552 esac
11553
11554 : see if _ptr and _cnt from stdio act std
11555 echo " "
11556 if $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
11557         echo "(Looks like you have stdio.h from Linux.)"
11558         case "$stdio_ptr" in
11559         '') stdio_ptr='((fp)->_IO_read_ptr)'
11560                 ptr_lval=$define
11561                 ;;
11562         *)      ptr_lval=$d_stdio_ptr_lval;;
11563         esac
11564         case "$stdio_cnt" in
11565         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
11566                 cnt_lval=$undef
11567                 ;;
11568         *)      cnt_lval=$d_stdio_cnt_lval;;
11569         esac
11570         case "$stdio_base" in
11571         '') stdio_base='((fp)->_IO_read_base)';;
11572         esac
11573         case "$stdio_bufsiz" in
11574         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
11575         esac
11576 else
11577         case "$stdio_ptr" in
11578         '') stdio_ptr='((fp)->_ptr)'
11579                 ptr_lval=$define
11580                 ;;
11581         *)      ptr_lval=$d_stdio_ptr_lval;;
11582         esac
11583         case "$stdio_cnt" in
11584         '') stdio_cnt='((fp)->_cnt)'
11585                 cnt_lval=$define
11586                 ;;
11587         *)      cnt_lval=$d_stdio_cnt_lval;;
11588         esac
11589         case "$stdio_base" in
11590         '') stdio_base='((fp)->_base)';;
11591         esac
11592         case "$stdio_bufsiz" in
11593         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
11594         esac
11595 fi
11596 : test whether _ptr and _cnt really work
11597 echo "Checking how std your stdio is..." >&4
11598 $cat >try.c <<EOP
11599 #include <stdio.h>
11600 #define FILE_ptr(fp)    $stdio_ptr
11601 #define FILE_cnt(fp)    $stdio_cnt
11602 int main() {
11603         FILE *fp = fopen("try.c", "r");
11604         char c = getc(fp);
11605         if (
11606                 18 <= FILE_cnt(fp) &&
11607                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
11608         )
11609                 exit(0);
11610         exit(1);
11611 }
11612 EOP
11613 val="$undef"
11614 set try
11615 if eval $compile; then
11616         if ./try; then
11617                 echo "Your stdio acts pretty std."
11618                 val="$define"
11619         else
11620                 echo "Your stdio isn't very std."
11621         fi
11622 else
11623         echo "Your stdio doesn't appear very std."
11624 fi
11625 $rm -f try.c try
11626 set d_stdstdio
11627 eval $setvar
11628
11629 : Can _ptr be used as an lvalue?
11630 case "$d_stdstdio$ptr_lval" in
11631 $define$define) val=$define ;;
11632 *) val=$undef ;;
11633 esac
11634 set d_stdio_ptr_lval
11635 eval $setvar
11636
11637 : Can _cnt be used as an lvalue?
11638 case "$d_stdstdio$cnt_lval" in
11639 $define$define) val=$define ;;
11640 *) val=$undef ;;
11641 esac
11642 set d_stdio_cnt_lval
11643 eval $setvar
11644
11645 : see if _base is also standard
11646 val="$undef"
11647 case "$d_stdstdio" in
11648 $define)
11649         $cat >try.c <<EOP
11650 #include <stdio.h>
11651 #define FILE_base(fp)   $stdio_base
11652 #define FILE_bufsiz(fp) $stdio_bufsiz
11653 int main() {
11654         FILE *fp = fopen("try.c", "r");
11655         char c = getc(fp);
11656         if (
11657                 19 <= FILE_bufsiz(fp) &&
11658                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
11659         )
11660                 exit(0);
11661         exit(1);
11662 }
11663 EOP
11664         set try
11665         if eval $compile; then
11666                 if ./try; then
11667                         echo "And its _base field acts std."
11668                         val="$define"
11669                 else
11670                         echo "But its _base field isn't std."
11671                 fi
11672         else
11673                 echo "However, it seems to be lacking the _base field."
11674         fi
11675         $rm -f try.c try
11676         ;;
11677 esac
11678 set d_stdiobase
11679 eval $setvar
11680
11681 $cat >&4 <<EOM
11682 Checking how to access stdio streams by file descriptor number...
11683 EOM
11684 case "$stdio_stream_array" in
11685 '')     $cat >try.c <<EOCP
11686 #include <stdio.h>
11687 int main() {
11688   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
11689     printf("yes\n");
11690 }
11691 EOCP
11692         for s in _iob __iob __sF
11693         do
11694                 set try -DSTDIO_STREAM_ARRAY=$s
11695                 if eval $compile; then
11696                         case "`./try$exe_ext`" in
11697                         yes)    stdio_stream_array=$s; break ;;
11698                         esac
11699                 fi
11700         done
11701         $rm -f try.* try$exe_ext
11702 esac
11703 case "$stdio_stream_array" in
11704 '')     $cat >&4 <<EOM
11705 I can't figure out how to access stdio streams by file descriptor number.
11706 EOM
11707         d_stdio_stream_array="$undef"
11708         ;;
11709 *)      $cat >&4 <<EOM
11710 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
11711 EOM
11712         d_stdio_stream_array="$define"
11713         ;;
11714 esac
11715
11716 : see if strcoll exists
11717 set strcoll d_strcoll
11718 eval $inlibc
11719
11720 : check for structure copying
11721 echo " "
11722 echo "Checking to see if your C compiler can copy structs..." >&4
11723 $cat >try.c <<'EOCP'
11724 int main()
11725 {
11726         struct blurfl {
11727                 int dyick;
11728         } foo, bar;
11729
11730         foo = bar;
11731 }
11732 EOCP
11733 if $cc -c try.c >/dev/null 2>&1 ; then
11734         val="$define"
11735         echo "Yup, it can."
11736 else
11737         val="$undef"
11738         echo "Nope, it can't."
11739 fi
11740 set d_strctcpy
11741 eval $setvar
11742 $rm -f try.*
11743
11744 : see if strerror and/or sys_errlist[] exist
11745 echo " "
11746 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
11747     if set strerror val -f d_strerror; eval $csym; $val; then
11748                 echo 'strerror() found.' >&4
11749                 d_strerror="$define"
11750                 d_strerrm='strerror(e)'
11751                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
11752                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
11753                         d_syserrlst="$define"
11754                 else
11755                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
11756                         d_syserrlst="$undef"
11757                 fi
11758     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
11759                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
11760                 echo 'strerror() found in string header.' >&4
11761                 d_strerror="$define"
11762                 d_strerrm='strerror(e)'
11763                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
11764                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
11765                                 d_syserrlst="$define"
11766                 else
11767                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
11768                         d_syserrlst="$undef"
11769                 fi
11770     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
11771                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
11772                 d_strerror="$undef"
11773                 d_syserrlst="$define"
11774                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
11775     else
11776                 echo 'strerror() and sys_errlist[] NOT found.' >&4
11777                 d_strerror="$undef"
11778                 d_syserrlst="$undef"
11779                 d_strerrm='"unknown"'
11780     fi
11781 fi
11782
11783 : see if strtod exists
11784 set strtod d_strtod
11785 eval $inlibc
11786
11787 : see if strtol exists
11788 set strtol d_strtol
11789 eval $inlibc
11790
11791 : see if strtold exists
11792 set strtold d_strtold
11793 eval $inlibc
11794
11795 : see if strtoll exists
11796 set strtoll d_strtoll
11797 eval $inlibc
11798
11799 case "$d_longlong-$d_strtoll" in
11800 "$define-$define")
11801         $cat <<EOM
11802 Checking whether your strtoll() works okay...
11803 EOM
11804         $cat >try.c <<'EOCP'
11805 #include <errno.h>
11806 #ifdef __hpux
11807 #define strtoll __strtoll
11808 #endif
11809 #include <stdio.h>
11810 extern long long int strtoll(char *s, char **, int); 
11811 static int bad = 0;
11812 int check(char *s, long long ell, int een) {
11813         long long gll;
11814         errno = 0;
11815         gll = strtoll(s, 0, 10);
11816         if (!((gll == ell) && (errno == een)))
11817                 bad++;
11818 }
11819 int main() {
11820         check(" 1",                                      1LL, 0);
11821         check(" 0",                                      0LL, 0);
11822         check("-1",                                     -1LL, 0);
11823         check("-9223372036854775808", -9223372036854775808LL, 0);
11824         check("-9223372036854775808", -9223372036854775808LL, 0);
11825         check(" 9223372036854775807",  9223372036854775807LL, 0);
11826         check("-9223372036854775808", -9223372036854775808LL, 0);
11827         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
11828         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
11829         if (!bad)
11830                 printf("ok\n");
11831 }
11832 EOCP
11833         set try
11834         if eval $compile; then
11835                 case "`./try`" in
11836                 ok) echo "Your strtoll() seems to be working okay." ;;
11837                 *) cat <<EOM >&4
11838 Your strtoll() doesn't seem to be working okay.
11839 EOM
11840                    d_strtoll="$undef"
11841                    ;;
11842                 esac
11843         fi
11844         ;;
11845 esac
11846
11847 : see if strtoul exists
11848 set strtoul d_strtoul
11849 eval $inlibc
11850
11851 : see if strtoull exists
11852 set strtoull d_strtoull
11853 eval $inlibc
11854
11855 case "$d_longlong-$d_strtoull" in
11856 "$define-$define")
11857         $cat <<EOM
11858 Checking whether your strtoull() works okay...
11859 EOM
11860         $cat >try.c <<'EOCP'
11861 #include <errno.h>
11862 #ifdef __hpux
11863 #define strtoull __strtoull
11864 #endif
11865 #include <stdio.h>
11866 extern unsigned long long int strtoull(char *s, char **, int); 
11867 static int bad = 0;
11868 int check(char *s, long long eull, int een) {
11869         long long gull;
11870         errno = 0;
11871         gull = strtoull(s, 0, 10);
11872         if (!((gull == eull) && (errno == een)))
11873                 bad++;
11874 }
11875 int main() {
11876         check(" 1",                                       1LL, 0);
11877         check(" 0",                                       0LL, 0);
11878         check("18446744073709551615", 18446744073709551615ULL, 0);
11879         check("18446744073709551616", 18446744073709551615ULL, ERANGE);
11880         if (!bad)
11881                 printf("ok\n");
11882 }
11883 EOCP
11884         set try
11885         if eval $compile; then
11886                 case "`./try`" in
11887                 ok) echo "Your strtoull() seems to be working okay." ;;
11888                 *) cat <<EOM >&4
11889 Your strtoull() doesn't seem to be working okay.
11890 EOM
11891                    d_strtoull="$undef"
11892                    ;;
11893                 esac
11894         fi
11895         ;;
11896 esac
11897
11898 : see if strtouq exists
11899 set strtouq d_strtouq
11900 eval $inlibc
11901
11902 : see if strxfrm exists
11903 set strxfrm d_strxfrm
11904 eval $inlibc
11905
11906 : see if symlink exists
11907 set symlink d_symlink
11908 eval $inlibc
11909
11910 : see if syscall exists
11911 set syscall d_syscall
11912 eval $inlibc
11913
11914 : see if sysconf exists
11915 set sysconf d_sysconf
11916 eval $inlibc
11917
11918 : see if system exists
11919 set system d_system
11920 eval $inlibc
11921
11922 : see if tcgetpgrp exists
11923 set tcgetpgrp d_tcgetpgrp
11924 eval $inlibc
11925
11926 : see if tcsetpgrp exists
11927 set tcsetpgrp d_tcsetpgrp
11928 eval $inlibc
11929
11930 : see if prototype for telldir is available
11931 echo " "
11932 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
11933 eval $hasproto
11934
11935 : see if this is a sys/times.h system
11936 set sys/times.h i_systimes
11937 eval $inhdr
11938
11939 : see if times exists
11940 echo " "
11941 if set times val -f d_times; eval $csym; $val; then
11942         echo 'times() found.' >&4
11943         d_times="$define"
11944         inc=''
11945         case "$i_systimes" in
11946         "$define") inc='sys/times.h';;
11947         esac
11948         rp="What is the type returned by times() on this system?"
11949         set clock_t clocktype long stdio.h sys/types.h $inc
11950         eval $typedef_ask
11951 else
11952         echo 'times() NOT found, hope that will do.' >&4
11953         d_times="$undef"
11954         clocktype='int'
11955 fi
11956
11957 : see if truncate exists
11958 set truncate d_truncate
11959 eval $inlibc
11960
11961 : see if tzname[] exists
11962 echo " "
11963 if set tzname val -a d_tzname; eval $csym; $val; then
11964         val="$define"
11965         echo 'tzname[] found.' >&4
11966 else
11967         val="$undef"
11968         echo 'tzname[] NOT found.' >&4
11969 fi
11970 set d_tzname
11971 eval $setvar
11972
11973 : see if umask exists
11974 set umask d_umask
11975 eval $inlibc
11976
11977 : see if ustat exists
11978 set ustat d_ustat
11979 eval $inlibc
11980
11981 : backward compatibility for d_hvfork
11982 if test X$d_hvfork != X; then
11983         d_vfork="$d_hvfork"
11984         d_hvfork=''
11985 fi
11986 : see if there is a vfork
11987 val=''
11988 set vfork val
11989 eval $inlibc
11990
11991 : Ok, but do we want to use it. vfork is reportedly unreliable in 
11992 : perl on Solaris 2.x, and probably elsewhere.
11993 case "$val" in
11994 $define)
11995         echo " "
11996         case "$usevfork" in
11997         false) dflt='n';;
11998         *) dflt='y';;
11999         esac
12000         cat <<'EOM'
12001  
12002 Perl can only use a vfork() that doesn't suffer from strict
12003 restrictions on calling functions or modifying global data in
12004 the child.  For example, glibc-2.1 contains such a vfork()
12005 that is unsuitable.  If your system provides a proper fork()
12006 call, chances are that you do NOT want perl to use vfork().
12007
12008 EOM
12009         rp="Do you still want to use vfork()?"
12010         . ./myread
12011         case "$ans" in
12012         y|Y) ;;
12013         *)
12014                 echo "Ok, we won't use vfork()."
12015                 val="$undef"
12016                 ;;
12017         esac
12018         ;;
12019 esac
12020 set d_vfork
12021 eval $setvar
12022 case "$d_vfork" in
12023 $define) usevfork='true';;
12024 *) usevfork='false';;
12025 esac
12026
12027 : see if this is an sysdir system
12028 set sys/dir.h i_sysdir
12029 eval $inhdr
12030
12031 : see if this is an sysndir system
12032 set sys/ndir.h i_sysndir
12033 eval $inhdr
12034
12035 : see if closedir exists
12036 set closedir d_closedir
12037 eval $inlibc
12038
12039 case "$d_closedir" in
12040 "$define")
12041         echo " "
12042         echo "Checking whether closedir() returns a status..." >&4
12043         cat > closedir.c <<EOM
12044 #$i_dirent I_DIRENT             /**/
12045 #$i_sysdir I_SYS_DIR            /**/
12046 #$i_sysndir I_SYS_NDIR          /**/
12047 #$i_systypes I_SYS_TYPES        /**/
12048
12049 #if defined(I_SYS_TYPES)
12050 #include <sys/types.h>
12051 #endif
12052 #if defined(I_DIRENT)
12053 #include <dirent.h>
12054 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
12055 #include <sys/dir.h>
12056 #endif
12057 #else
12058 #ifdef I_SYS_NDIR
12059 #include <sys/ndir.h>
12060 #else
12061 #ifdef I_SYS_DIR
12062 #ifdef hp9000s500
12063 #include <ndir.h>       /* may be wrong in the future */
12064 #else
12065 #include <sys/dir.h>
12066 #endif
12067 #endif
12068 #endif
12069 #endif 
12070 int main() { return closedir(opendir(".")); }
12071 EOM
12072         set closedir
12073         if eval $compile_ok; then
12074                 if ./closedir > /dev/null 2>&1 ; then
12075                         echo "Yes, it does."
12076                         val="$undef"
12077                 else
12078                         echo "No, it doesn't."
12079                         val="$define"
12080                 fi
12081         else
12082                 echo "(I can't seem to compile the test program--assuming it doesn't)"
12083                 val="$define"
12084         fi
12085         ;;
12086 *)
12087         val="$undef";
12088         ;;
12089 esac
12090 set d_void_closedir
12091 eval $setvar
12092 $rm -f closedir*
12093 : check for volatile keyword
12094 echo " "
12095 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
12096 $cat >try.c <<'EOCP'
12097 int main()
12098 {
12099         typedef struct _goo_struct goo_struct;
12100         goo_struct * volatile goo = ((goo_struct *)0);
12101         struct _goo_struct {
12102                 long long_int;
12103                 int reg_int;
12104                 char char_var;
12105         };
12106         typedef unsigned short foo_t;
12107         char *volatile foo;
12108         volatile int bar;
12109         volatile foo_t blech;
12110         foo = foo;
12111 }
12112 EOCP
12113 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
12114         val="$define"
12115         echo "Yup, it does."
12116 else
12117         val="$undef"
12118         echo "Nope, it doesn't."
12119 fi
12120 set d_volatile
12121 eval $setvar
12122 $rm -f try.*
12123
12124 : see if there is a wait4
12125 set wait4 d_wait4
12126 eval $inlibc
12127
12128 : see if waitpid exists
12129 set waitpid d_waitpid
12130 eval $inlibc
12131
12132 : see if wcstombs exists
12133 set wcstombs d_wcstombs
12134 eval $inlibc
12135
12136 : see if wctomb exists
12137 set wctomb d_wctomb
12138 eval $inlibc
12139
12140 : preserve RCS keywords in files with variable substitution, grrr
12141 Date='$Date'
12142 Id='$Id'
12143 Log='$Log'
12144 RCSfile='$RCSfile'
12145 Revision='$Revision'
12146
12147 case "$crosscompile" in
12148 ''|[nN]*) crosscompile="$undef" ;;
12149 esac
12150
12151 case "$osname" in
12152 next|rhapsody|darwin) multiarch="$define" ;;
12153 esac
12154 case "$multiarch" in
12155 ''|[nN]*) multiarch="$undef" ;;
12156 esac
12157
12158 : check for alignment requirements
12159 echo " "
12160 case "$crosscompile$multiarch" in
12161 *$define*)
12162         $cat <<EOM
12163 You seem to be either cross-compiling or doing a multiarchitecture build,
12164 skipping the memory alignment check.
12165
12166 EOM
12167         case "$alignbytes" in
12168         '') alignbytes=8 ;;
12169         esac
12170         ;;
12171 *)
12172         case "$alignbytes" in
12173         '') echo "Checking alignment constraints..." >&4
12174                 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
12175                         $cat >try.c <<'EOCP'
12176 typedef long double NV;
12177 EOCP
12178                 else
12179                         $cat >try.c <<'EOCP'
12180 typedef double NV;
12181 EOCP
12182                 fi
12183                 $cat >>try.c <<'EOCP'
12184 #include <stdio.h>
12185 struct foobar {
12186         char foo;
12187         NV bar;
12188 } try_algn;
12189 int main()
12190 {
12191     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
12192     return(0);
12193 }
12194 EOCP
12195                 set try
12196                 if eval $compile_ok; then
12197                         dflt=`./try`
12198                 else
12199                         dflt='8'
12200                         echo "(I can't seem to compile the test program...)"
12201                 fi
12202                 ;;
12203         *) dflt="$alignbytes"
12204                 ;;
12205         esac
12206         rp="Doubles must be aligned on a how-many-byte boundary?"
12207         . ./myread
12208         alignbytes="$ans"
12209         $rm -f try.c try
12210         ;;
12211 esac
12212
12213
12214 : set the base revision
12215 baserev=5.0
12216
12217 : check for ordering of bytes in a long
12218 echo " "
12219 case "$crosscompile$multiarch" in
12220 *$define*)
12221         $cat <<EOM
12222 You seem to be either cross-compiling or doing a multiarchitecture build,
12223 skipping the byteorder check.
12224
12225 EOM
12226         byteorder='0xffff'
12227         ;;
12228 *)
12229         case "$byteorder" in
12230         '')
12231                 $cat <<'EOM'
12232 In the following, larger digits indicate more significance.  A big-endian
12233 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
12234 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
12235 machines may have weird orders like 3412.  A Cray will report 87654321,
12236 an Alpha will report 12345678. If the test program works the default is
12237 probably right.
12238 I'm now running the test program...
12239 EOM
12240                 $cat >try.c <<'EOCP'
12241 #include <stdio.h>
12242 int main()
12243 {
12244         int i;
12245         union {
12246                 unsigned long l;
12247                 char c[sizeof(long)];
12248         } u;
12249
12250         if (sizeof(long) > 4)
12251                 u.l = (0x08070605L << 32) | 0x04030201L;
12252         else
12253                 u.l = 0x04030201L;
12254         for (i = 0; i < sizeof(long); i++)
12255                 printf("%c", u.c[i]+'0');
12256         printf("\n");
12257         exit(0);
12258 }
12259 EOCP
12260                 xxx_prompt=y
12261                 set try
12262                 if eval $compile && ./try > /dev/null; then
12263                         dflt=`./try`
12264                         case "$dflt" in
12265                         [1-4][1-4][1-4][1-4]|12345678|87654321)
12266                                 echo "(The test program ran ok.)"
12267                                 echo "byteorder=$dflt"
12268                                 xxx_prompt=n
12269                         ;;
12270                         ????|????????) echo "(The test program ran ok.)" ;;
12271                         *) echo "(The test program didn't run right for some reason.)" ;;
12272                         esac
12273                 else
12274                         dflt='4321'
12275                         cat <<'EOM'
12276 (I can't seem to compile the test program.  Guessing big-endian...)
12277 EOM
12278                 fi
12279                 case "$xxx_prompt" in
12280                 y)
12281                         rp="What is the order of bytes in a long?"
12282                         . ./myread
12283                         byteorder="$ans"
12284                         ;;
12285                 *)      byteorder=$dflt
12286                         ;;
12287                 esac
12288                 ;;
12289         esac
12290         $rm -f try.c try
12291         ;;
12292 esac
12293
12294
12295 : how do we catenate cpp tokens here?
12296 echo " "
12297 echo "Checking to see how your cpp does stuff like catenate tokens..." >&4
12298 $cat >cpp_stuff.c <<'EOCP'
12299 #define RCAT(a,b)a/**/b
12300 #define ACAT(a,b)a ## b
12301 RCAT(Rei,ser)
12302 ACAT(Cir,cus)
12303 EOCP
12304 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
12305 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
12306         echo "Oh!  Smells like ANSI's been here." >&4
12307         echo "We can catify or stringify, separately or together!"
12308         cpp_stuff=42
12309 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
12310         echo "Ah, yes!  The good old days!" >&4
12311         echo "However, in the good old days we don't know how to stringify and"
12312         echo "catify at the same time."
12313         cpp_stuff=1
12314 else
12315         $cat >&4 <<EOM
12316 Hmm, I don't seem to be able to catenate tokens with your cpp.  You're going
12317 to have to edit the values of CAT[2-5] in config.h...
12318 EOM
12319         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
12320 fi
12321 $rm -f cpp_stuff.*
12322
12323 : see if this is a db.h system
12324 set db.h i_db
12325 eval $inhdr
12326
12327 case "$i_db" in
12328 $define)
12329         : Check db version.
12330         echo " "
12331         echo "Checking Berkeley DB version ..." >&4
12332         $cat >try.c <<EOCP
12333 #$d_const HASCONST
12334 #ifndef HASCONST
12335 #define const
12336 #endif
12337 #include <sys/types.h>
12338 #include <stdio.h>
12339 #include <db.h>
12340 int main()
12341 {
12342 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
12343     int Major, Minor, Patch ;
12344     unsigned long Version ;
12345     (void)db_version(&Major, &Minor, &Patch) ;
12346     printf("You have Berkeley DB Version 2 or greater\n");
12347
12348     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
12349                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
12350     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
12351                 Major, Minor, Patch) ;
12352
12353     /* check that db.h & libdb are compatible */
12354     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
12355         printf("db.h and libdb are incompatible\n") ;
12356         exit(3);        
12357     }
12358
12359     printf("db.h and libdb are compatible\n") ;
12360
12361     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
12362                 + DB_VERSION_PATCH ;
12363
12364     /* needs to be >= 2.3.4 */
12365     if (Version < 2003004) {
12366     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
12367         printf("but Perl needs Berkeley DB 2.3.4 or greater\n") ;
12368         exit(2);        
12369     }
12370
12371     exit(0);
12372 #else
12373 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
12374     printf("You have Berkeley DB Version 1\n");
12375     exit(0);    /* DB version < 2: the coast is clear. */
12376 #else
12377     exit(1);    /* <db.h> not Berkeley DB? */
12378 #endif
12379 #endif
12380 }
12381 EOCP
12382         set try
12383         if eval $compile_ok && ./try; then
12384                 echo 'Looks OK.' >&4
12385         else
12386                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
12387                 i_db=$undef
12388                 case " $libs " in
12389                 *"-ldb "*)
12390                         : Remove db from list of libraries to use
12391                         echo "Removing unusable -ldb from library list" >&4
12392                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
12393                         shift
12394                         libs="$*"
12395                         echo "libs = $libs" >&4
12396                         ;;
12397                 esac
12398         fi
12399         $rm -f try.*
12400         ;;
12401 esac
12402
12403 case "$i_db" in
12404 define)
12405         : Check the return type needed for hash 
12406         echo " "
12407         echo "Checking return type needed for hash for Berkeley DB ..." >&4
12408         $cat >try.c <<EOCP
12409 #$d_const HASCONST
12410 #ifndef HASCONST
12411 #define const
12412 #endif
12413 #include <sys/types.h>
12414 #include <db.h>
12415
12416 #ifndef DB_VERSION_MAJOR
12417 u_int32_t hash_cb (ptr, size)
12418 const void *ptr;
12419 size_t size;
12420 {
12421 }
12422 HASHINFO info;
12423 int main()
12424 {
12425         info.hash = hash_cb;
12426 }
12427 #endif
12428 EOCP
12429         if $cc $ccflags -c try.c >try.out 2>&1 ; then
12430                 if $contains warning try.out >>/dev/null 2>&1 ; then
12431                         db_hashtype='int'
12432                 else
12433                         db_hashtype='u_int32_t'
12434                 fi
12435         else
12436                 : XXX Maybe we should just give up here.
12437                 db_hashtype=u_int32_t
12438                 $cat try.out >&4
12439                 echo "Help:  I can't seem to compile the db test program." >&4
12440                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
12441         fi
12442         $rm -f try.*
12443         echo "Your version of Berkeley DB uses $db_hashtype for hash."
12444         ;;
12445 *)      db_hashtype=u_int32_t
12446         ;;
12447 esac
12448 case "$i_db" in
12449 define)
12450         : Check the return type needed for prefix 
12451         echo " "
12452         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
12453         cat >try.c <<EOCP
12454 #$d_const HASCONST
12455 #ifndef HASCONST
12456 #define const
12457 #endif
12458 #include <sys/types.h>
12459 #include <db.h>
12460
12461 #ifndef DB_VERSION_MAJOR
12462 size_t prefix_cb (key1, key2)
12463 const DBT *key1;
12464 const DBT *key2;
12465 {
12466 }
12467 BTREEINFO info;
12468 int main()
12469 {
12470         info.prefix = prefix_cb;
12471 }
12472 #endif
12473 EOCP
12474         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
12475                 if $contains warning try.out >>/dev/null 2>&1 ; then
12476                         db_prefixtype='int'
12477                 else
12478                         db_prefixtype='size_t'
12479                 fi
12480         else
12481                 db_prefixtype='size_t'
12482                 : XXX Maybe we should just give up here.
12483                 $cat try.out >&4
12484                 echo "Help:  I can't seem to compile the db test program." >&4
12485                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
12486         fi
12487         $rm -f try.*
12488         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
12489         ;;
12490 *)      db_prefixtype='size_t'
12491         ;;
12492 esac
12493
12494 : check for void type
12495 echo " "
12496 echo "Checking to see how well your C compiler groks the void type..." >&4
12497 case "$voidflags" in
12498 '')
12499         $cat >try.c <<'EOCP'
12500 #if TRY & 1
12501 void sub() {
12502 #else
12503 sub() {
12504 #endif
12505         extern void moo();      /* function returning void */
12506         void (*goo)();          /* ptr to func returning void */
12507 #if TRY & 8
12508         void *hue;              /* generic ptr */
12509 #endif
12510 #if TRY & 2
12511         void (*foo[10])();
12512 #endif
12513
12514 #if TRY & 4
12515         if(goo == moo) {
12516                 exit(0);
12517         }
12518 #endif
12519         exit(0);
12520 }
12521 int main() { sub(); }
12522 EOCP
12523         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
12524                 voidflags=$defvoidused
12525         echo "Good.  It appears to support void to the level $package wants.">&4
12526                 if $contains warning .out >/dev/null 2>&1; then
12527                         echo "However, you might get some warnings that look like this:"
12528                         $cat .out
12529                 fi
12530         else
12531 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
12532                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
12533                         echo "It supports 1..."
12534                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
12535                                 echo "It also supports 2..."
12536                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
12537                                         voidflags=7
12538                                         echo "And it supports 4 but not 8 definitely."
12539                                 else
12540                                         echo "It doesn't support 4..."
12541                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
12542                                                 voidflags=11
12543                                                 echo "But it supports 8."
12544                                         else
12545                                                 voidflags=3
12546                                                 echo "Neither does it support 8."
12547                                         fi
12548                                 fi
12549                         else
12550                                 echo "It does not support 2..."
12551                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
12552                                         voidflags=13
12553                                         echo "But it supports 4 and 8."
12554                                 else
12555                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
12556                                                 voidflags=5
12557                                                 echo "And it supports 4 but has not heard about 8."
12558                                         else
12559                                                 echo "However it supports 8 but not 4."
12560                                         fi
12561                                 fi
12562                         fi
12563                 else
12564                         echo "There is no support at all for void."
12565                         voidflags=0
12566                 fi
12567         fi
12568 esac
12569 case "$voidflags" in
12570 "$defvoidused") ;;
12571 *)      $cat >&4 <<'EOM'
12572   Support flag bits are:
12573     1: basic void declarations.
12574     2: arrays of pointers to functions returning void.
12575     4: operations between pointers to and addresses of void functions.
12576     8: generic void pointers.
12577 EOM
12578         dflt="$voidflags";
12579         rp="Your void support flags add up to what?"
12580         . ./myread
12581         voidflags="$ans"
12582         ;;
12583 esac
12584 $rm -f try.* .out
12585
12586
12587 : How can we generate normalized random numbers ?
12588 echo " "
12589 echo "Looking for a random number function..." >&4
12590 case "$randfunc" in
12591 '')
12592         if set drand48 val -f; eval $csym; $val; then
12593                 dflt="drand48"
12594                 echo "Good, found drand48()." >&4
12595         elif set random val -f; eval $csym; $val; then
12596                 dflt="random"
12597                 echo "OK, found random()." >&4
12598         else
12599                 dflt="rand"
12600                 echo "Yick, looks like I have to use rand()." >&4
12601         fi
12602         echo " "
12603         ;;
12604 *)
12605         dflt="$randfunc"
12606         ;;
12607 esac
12608 cont=true
12609
12610 case "$ccflags" in
12611 *-Dmy_rand=*|*-Dmy_srand=*)
12612         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
12613         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
12614         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
12615         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
12616         ;;
12617 esac
12618
12619 while $test "$cont"; do
12620         rp="Use which function to generate random numbers?"
12621         . ./myread
12622         if $test "$ans" = "$dflt"; then
12623                 : null
12624         else
12625                 randbits=''
12626         fi
12627         randfunc="$ans"
12628         if set $ans val -f; eval $csym; $val; then
12629                 cont=''
12630         else
12631                 dflt=y
12632                 rp="I cannot find function $ans. Use that name anyway?"
12633                 . ./myread
12634                 dflt=rand
12635                 case "$ans" in
12636                         [yY]*) cont='';;
12637                 esac
12638         fi
12639         case "$cont" in
12640         '')
12641                 case "$randfunc" in
12642                 drand48)
12643                         drand01="drand48()"
12644                         seedfunc="srand48"
12645                         randbits=48
12646                         randseedtype=long
12647                         ;;
12648                 rand|random)
12649                         case "$randbits" in
12650                         '')
12651 echo "Checking to see how many bits your $randfunc() function produces..." >&4
12652                                 $cat >try.c <<EOCP
12653 #$i_unistd I_UNISTD
12654 #$i_stdlib I_STDLIB
12655 #include <stdio.h>
12656 #ifdef I_UNISTD
12657 #  include <unistd.h>
12658 #endif
12659 #ifdef I_STDLIB
12660 #  include <stdlib.h>
12661 #endif
12662 int main()
12663 {
12664         register int i;
12665         register unsigned long tmp;
12666         register unsigned long max = 0L;
12667
12668         for (i = 1000; i; i--) {
12669                 tmp = (unsigned long) $randfunc();
12670                 if (tmp > max) max = tmp;
12671         }
12672         for (i = 0; max; i++)
12673                 max /= 2;
12674         printf("%d\n",i);
12675 }
12676 EOCP
12677                                 set try
12678                                 if eval $compile_ok; then
12679                                         dflt=`try`
12680                                 else
12681                                         dflt='?'
12682                                         echo "(I can't seem to compile the test program...)"
12683                                 fi
12684                                 ;;
12685                         *)
12686                                 dflt="$randbits"
12687                                 ;;
12688                         esac
12689                         rp="How many bits does your $randfunc() function produce?"
12690                         . ./myread
12691                         randbits="$ans"
12692                         $rm -f try.c try
12693                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
12694                         seedfunc="s$randfunc"
12695                         randseedtype=unsigned
12696                         ;;
12697                 *)
12698                         dflt="31"
12699                         rp="How many bits does your $randfunc() function produce?"
12700                         . ./myread
12701                         randbits="$ans"
12702                         seedfunc="s$randfunc"
12703                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
12704                         if set $seedfunc val -f; eval $csym; $val; then
12705                                 echo "(Using $seedfunc() to seed random generator)"
12706                         else
12707                                 echo "(Warning: no $seedfunc() to seed random generator)"
12708                                 seedfunc=rand
12709                         fi
12710                         randseedtype=unsigned
12711                         ;;
12712                 esac
12713                 ;;
12714         esac
12715 done
12716
12717 echo " "
12718 echo "Determining whether or not we are on an EBCDIC system..." >&4
12719 $cat >tebcdic.c <<'EOM'
12720 int main()
12721 {
12722   if ('M'==0xd4) return 0;
12723   return 1;
12724 }
12725 EOM
12726
12727 val=$undef
12728 set tebcdic
12729 if eval $compile_ok; then
12730         if ./tebcdic; then
12731                 echo "You seem to speak EBCDIC." >&4
12732                 val="$define"
12733         else
12734                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF8." >&4
12735         fi
12736 else
12737         echo "I'm unable to compile the test program." >&4
12738         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
12739 fi
12740 $rm -f tebcdic.c tebcdic
12741 set ebcdic
12742 eval $setvar
12743
12744 echo " "
12745 $cat >&4 <<EOM
12746 Checking how to flush all pending stdio output...
12747 EOM
12748 # I only know how to find the first 32 possibly open files on SunOS.
12749 # See also hints/sunos_4_1.sh and util.c  --AD
12750 case "$osname" in
12751 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
12752 esac
12753 $cat >>try.c <<EOCP
12754 #include <stdio.h>
12755 #$i_unistd I_UNISTD
12756 #ifdef I_UNISTD
12757 # include <unistd.h>
12758 #endif
12759 #$d_sysconf HAS_SYSCONF
12760 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
12761 #ifdef HAS_STDIO_STREAM_ARRAY
12762 # define STDIO_STREAM_ARRAY $stdio_stream_array
12763 #endif
12764 int main() {
12765   FILE* p = fopen("try.out", "w");
12766 #ifdef TRY_FPUTC
12767   fputc('x', p);
12768 #else
12769 # ifdef TRY_FPRINTF
12770   fprintf(p, "x");
12771 # endif
12772 #endif
12773 #ifdef TRY_FFLUSH_NULL
12774   fflush(NULL);
12775 #endif
12776 #ifdef TRY_FFLUSH_ALL
12777   {
12778     long open_max = -1;
12779 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
12780     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
12781 # else
12782 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
12783     open_max = sysconf(_SC_OPEN_MAX);
12784 #  else
12785 #   ifdef FOPEN_MAX
12786     open_max = FOPEN_MAX;
12787 #   else
12788 #    ifdef OPEN_MAX
12789     open_max = OPEN_MAX;
12790 #    else
12791 #     ifdef _NFILE
12792     open_max = _NFILE;
12793 #     endif
12794 #    endif
12795 #   endif
12796 #  endif
12797 # endif 
12798 # ifdef HAS_STDIO_STREAM_ARRAY
12799     if (open_max > 0) {
12800       long i;
12801       for (i = 0; i < open_max; i++)
12802             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
12803                 STDIO_STREAM_ARRAY[i]._file < open_max &&
12804                 STDIO_STREAM_ARRAY[i]._flag)
12805                 fflush(&STDIO_STREAM_ARRAY[i]);
12806     }   
12807   }
12808 # endif
12809 #endif
12810   _exit(42);
12811 }
12812 EOCP
12813 : first we have to find out how _not_ to flush
12814 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
12815     output=''
12816     set try -DTRY_FPUTC
12817     if eval $compile; then
12818             $rm -f try.out
12819             ./try$exe_ext 2>/dev/null
12820             if $test ! -s try.out -a "X$?" = X42; then
12821                 output=-DTRY_FPUTC
12822             fi
12823     fi
12824     case "$output" in
12825     '')
12826             set try -DTRY_FPRINTF
12827             $rm -f try.out
12828             if eval $compile; then
12829                     $rm -f try.out
12830                     ./try$exe_ext 2>/dev/null
12831                     if $test ! -s try.out -a "X$?" = X42; then
12832                         output=-DTRY_FPRINTF
12833                     fi
12834             fi
12835         ;;
12836     esac
12837 fi
12838 : check for fflush NULL behaviour
12839 case "$fflushNULL" in
12840 '')     set try -DTRY_FFLUSH_NULL $output
12841         if eval $compile; then
12842                 $rm -f try.out
12843                 ./try$exe_ext 2>/dev/null
12844                 code="$?"
12845                 if $test -s try.out -a "X$code" = X42; then
12846                         fflushNULL="`$cat try.out`"
12847                 else
12848                         if $test "X$code" != X42; then
12849                                 $cat >&4 <<EOM
12850 (If this test failed, don't worry, we'll try another method shortly.)
12851 EOM
12852                         fi
12853                 fi
12854         fi
12855         $rm -f core try.core core.try.*
12856         case "$fflushNULL" in
12857         x)      $cat >&4 <<EOM
12858 Your fflush(NULL) works okay for output streams.
12859 Let's see if it clobbers input pipes...
12860 EOM
12861 # As of mid-March 2000 all versions of Solaris appear to have a stdio
12862 # bug that improperly flushes the input end of pipes.  So we avoid the
12863 # autoflush on fork/system/exec support for now. :-(
12864 $cat >tryp.c <<EOCP
12865 #include <stdio.h>
12866 int
12867 main(int argc, char **argv)
12868 {
12869     char buf[1024];
12870     int i;
12871     char *bp = buf;
12872     while (1) {
12873         while ((i = getc(stdin)) != -1
12874                && (*bp++ = i) != '\n'
12875                && bp < &buf[1024])
12876         /* DO NOTHING */ ;
12877         *bp = '\0';
12878         fprintf(stdout, "%s", buf);
12879         fflush(NULL);
12880         if (i == -1)
12881             return 0;
12882         bp = buf;
12883     }
12884 }
12885 EOCP
12886                 fflushNULL="$define"
12887                 set tryp
12888                 if eval $compile; then
12889                     $rm -f tryp.out
12890                     $cat tryp.c | ./tryp$exe_ext 2>/dev/null > tryp.out
12891                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
12892                        $cat >&4 <<EOM
12893 fflush(NULL) seems to behave okay with input streams.
12894 EOM
12895                         fflushNULL="$define"
12896                     else
12897                         $cat >&4 <<EOM
12898 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
12899 EOM
12900                         fflushNULL="$undef"
12901                     fi
12902                 fi
12903                 $rm -f core tryp.c tryp.core core.tryp.*
12904                 ;;
12905         '')     $cat >&4 <<EOM
12906 Your fflush(NULL) isn't working (contrary to ANSI C).
12907 EOM
12908                 fflushNULL="$undef"
12909                 ;;
12910         *)      $cat >&4 <<EOM
12911 Cannot figure out whether your fflush(NULL) works or not.
12912 I'm assuming it doesn't (contrary to ANSI C).
12913 EOM
12914                 fflushNULL="$undef"
12915                 ;;
12916         esac
12917         ;;
12918 $define|true|[yY]*)
12919         fflushNULL="$define"
12920         ;;
12921 *)
12922         fflushNULL="$undef"
12923         ;;
12924 esac
12925 : check explicit looping only if NULL did not work, and if the pipe
12926 : bug does not show up on an explicit flush too
12927 case "$fflushNULL" in
12928 "$undef")
12929         $cat >tryp.c <<EOCP
12930 #include <stdio.h>
12931 int
12932 main(int argc, char **argv)
12933 {
12934     char buf[1024];
12935     int i;
12936     char *bp = buf;
12937     while (1) {
12938         while ((i = getc(stdin)) != -1
12939                && (*bp++ = i) != '\n'
12940                && bp < &buf[1024])
12941         /* DO NOTHING */ ;
12942         *bp = '\0';
12943         fprintf(stdout, "%s", buf);
12944         fflush(stdin);
12945         if (i == -1)
12946             return 0;
12947         bp = buf;
12948     }
12949 }
12950 EOCP
12951         set tryp
12952         if eval $compile; then
12953             $rm -f tryp.out
12954             $cat tryp.c | ./tryp$exe_ext 2>/dev/null > tryp.out
12955             if cmp tryp.c tryp.out >/dev/null 2>&1; then
12956                $cat >&4 <<EOM
12957 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
12958 EOM
12959                 : now check for fflushall behaviour
12960                 case "$fflushall" in
12961                 '')     set try -DTRY_FFLUSH_ALL $output
12962                         if eval $compile; then
12963                                 $cat >&4 <<EOM
12964 (Now testing the other method--but note that this also may fail.)
12965 EOM
12966                                 $rm -f try.out
12967                                 ./try$exe_ext 2>/dev/null
12968                                 if $test -s try.out -a "X$?" = X42; then
12969                                         fflushall="`$cat try.out`"
12970                                 fi
12971                         fi
12972                         $rm -f core try.core core.try.*
12973                         case "$fflushall" in
12974                         x)      $cat >&4 <<EOM
12975 Whew. Flushing explicitly all the stdio streams works.
12976 EOM
12977                                 fflushall="$define"
12978                                 ;;
12979                         '')     $cat >&4 <<EOM
12980 Sigh. Flushing explicitly all the stdio streams doesn't work.
12981 EOM
12982                                 fflushall="$undef"
12983                                 ;;
12984                         *)      $cat >&4 <<EOM
12985 Cannot figure out whether flushing stdio streams explicitly works or not.
12986 I'm assuming it doesn't.
12987 EOM
12988                                 fflushall="$undef"
12989                                 ;;
12990                         esac
12991                         ;;
12992                 "$define"|true|[yY]*)
12993                         fflushall="$define"
12994                         ;;
12995                 *)
12996                         fflushall="$undef"
12997                         ;;
12998                 esac
12999             else
13000                 $cat >&4 <<EOM
13001 All is futile.  Even fflush(stdin) clobbers input pipes!
13002 EOM
13003                 fflushall="$undef"
13004             fi
13005         else
13006             fflushall="$undef"
13007         fi
13008         $rm -f core tryp.c tryp.core core.tryp.*
13009         ;;
13010 *)      fflushall="$undef"
13011         ;;
13012 esac
13013
13014 case "$fflushNULL$fflushall" in
13015 undefundef)
13016         $cat <<EOM
13017 OK, I give up.  I cannot figure out how to flush pending stdio output.
13018 We won't be flushing handles at all before fork/exec/popen.
13019 EOM
13020         ;;
13021 esac
13022 $rm -f try.* try$exe_ext
13023
13024 : Store the full pathname to the ar program for use in the C program
13025 : Respect a hint or command line value for full_ar.
13026 case "$full_ar" in
13027 '') full_ar=$ar ;;
13028 esac
13029
13030 : Store the full pathname to the sed program for use in the C program
13031 full_sed=$sed
13032
13033 : see what type gids are declared as in the kernel
13034 echo " "
13035 echo "Looking for the type for group ids returned by getgid()."
13036 set gid_t gidtype xxx stdio.h sys/types.h
13037 eval $typedef
13038 case "$gidtype" in
13039 xxx)
13040         xxx=`./findhdr sys/user.h`
13041         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
13042         case $1 in
13043         unsigned) dflt="$1 $2" ;;
13044         *) dflt="$1" ;;
13045         esac
13046         ;;
13047 *) dflt="$gidtype";;
13048 esac
13049 case "$gidtype" in
13050 gid_t) echo "gid_t found." ;;
13051 *)      rp="What is the type for group ids returned by getgid()?"
13052         . ./myread
13053         gidtype="$ans"
13054         ;;
13055 esac
13056
13057 echo " "
13058 case "$gidtype" in
13059 *_t) zzz="$gidtype"     ;;
13060 *)   zzz="gid"          ;;
13061 esac
13062 echo "Checking the size of $zzz..." >&4 
13063 cat > try.c <<EOCP
13064 #include <sys/types.h>
13065 #include <stdio.h>
13066 int main() {
13067     printf("%d\n", (int)sizeof($gidtype));
13068     exit(0);
13069 }
13070 EOCP
13071 set try
13072 if eval $compile_ok; then
13073         yyy=`./try`
13074         case "$yyy" in
13075         '')     gidsize=4
13076                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
13077                 ;;
13078         *)      gidsize=$yyy
13079                 echo "Your $zzz is $gidsize bytes long."
13080                 ;;
13081         esac
13082 else
13083         gidsize=4
13084         echo "(I can't compile the test program--guessing $gidsize.)" >&4
13085 fi
13086
13087
13088 echo " "
13089 case "$gidtype" in
13090 *_t) zzz="$gidtype"     ;;
13091 *)   zzz="gid"          ;;
13092 esac
13093 echo "Checking the sign of $zzz..." >&4 
13094 cat > try.c <<EOCP
13095 #include <sys/types.h>
13096 #include <stdio.h>
13097 int main() {
13098         $gidtype foo = -1;
13099         if (foo < 0)
13100                 printf("-1\n");
13101         else
13102                 printf("1\n");
13103 }
13104 EOCP
13105 set try
13106 if eval $compile; then
13107         yyy=`./try`
13108         case "$yyy" in
13109         '')     gidsign=1
13110                 echo "(I can't execute the test program--guessing unsigned.)" >&4
13111                 ;;
13112         *)      gidsign=$yyy
13113                 case "$gidsign" in
13114                  1) echo "Your $zzz is unsigned." ;;
13115                 -1) echo "Your $zzz is signed."   ;;
13116                 esac
13117                 ;;
13118         esac
13119 else
13120         gidsign=1
13121         echo "(I can't compile the test program--guessing unsigned.)" >&4
13122 fi
13123
13124
13125 echo " "
13126
13127 if $test X"$quadtype" != X; then
13128
13129 echo "Checking how to print 64-bit integers..." >&4
13130
13131 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
13132         $cat >try.c <<'EOCP'
13133 #include <sys/types.h>
13134 #include <stdio.h>
13135 int main() {
13136   int q = 12345678901;
13137   printf("%ld\n", q);
13138 }
13139 EOCP
13140         set try
13141         if eval $compile; then
13142                 yyy=`./try$exe_ext`
13143                 case "$yyy" in
13144                 12345678901)
13145                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
13146                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
13147                         echo "We will use %d."
13148                         ;;
13149                 esac
13150         fi
13151 fi
13152
13153 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
13154         $cat >try.c <<'EOCP'
13155 #include <sys/types.h>
13156 #include <stdio.h>
13157 int main() {
13158   long q = 12345678901;
13159   printf("%ld\n", q);
13160 }
13161 EOCP
13162         set try
13163         if eval $compile; then
13164                 yyy=`./try$exe_ext`
13165                 case "$yyy" in
13166                 12345678901)
13167                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
13168                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
13169                         echo "We will use %ld."
13170                         ;;
13171                 esac
13172         fi
13173 fi
13174
13175 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
13176         $cat >try.c <<'EOCP'
13177 #include <sys/types.h>
13178 #include <inttypes.h>
13179 #include <stdio.h>
13180 int main() {
13181   int64_t q = 12345678901;
13182   printf("%" PRId64 "\n", q);
13183 }
13184 EOCP
13185         set try
13186         if eval $compile; then
13187                 yyy=`./try$exe_ext`
13188                 case "$yyy" in
13189                 12345678901)
13190                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
13191                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
13192                         echo "We will use the C9X style."
13193                         ;;
13194                 esac
13195         fi
13196 fi
13197
13198 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
13199         $cat >try.c <<'EOCP'
13200 #include <sys/types.h>
13201 #include <stdio.h>
13202 int main() {
13203   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
13204   printf("%lld\n", q);
13205 }
13206 EOCP
13207         set try
13208         if eval $compile; then
13209                 yyy=`./try$exe_ext`
13210                 case "$yyy" in
13211                 12345678901)
13212                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
13213                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
13214                         echo "We will use the %lld style."
13215                         ;;
13216                 esac
13217         fi
13218 fi
13219
13220 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
13221         $cat >try.c <<EOCP
13222 #include <sys/types.h>
13223 #include <stdio.h>
13224 int main() {
13225   $quadtype q = 12345678901;
13226   printf("%Ld\n", q);
13227 }
13228 EOCP
13229         set try
13230         if eval $compile; then
13231                 yyy=`./try$exe_ext`
13232                 case "$yyy" in
13233                 12345678901)
13234                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
13235                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
13236                         echo "We will use %Ld."
13237                         ;;
13238                 esac
13239         fi
13240 fi
13241
13242 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
13243         $cat >try.c <<EOCP
13244 #include <sys/types.h>
13245 #include <stdio.h>
13246 int main() {
13247   $quadtype q = 12345678901;
13248   printf("%qd\n", q);
13249 }
13250 EOCP
13251         set try
13252         if eval $compile; then
13253                 yyy=`./try$exe_ext`
13254                 case "$yyy" in
13255                 12345678901)
13256                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
13257                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
13258                         echo "We will use %qd."
13259                         ;;
13260                 esac
13261         fi
13262 fi
13263
13264 if $test X"$sPRId64" = X; then
13265         echo "Cannot figure out how to print 64-bit integers." >&4
13266 fi
13267
13268 $rm -f try try.*
13269
13270 fi
13271
13272 case "$sPRId64" in
13273 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef"; 
13274         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef"; 
13275         ;;
13276 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define"; 
13277         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define"; 
13278         ;;
13279 esac
13280
13281
13282 echo " "
13283 $echo "Checking the format strings to be used for Perl's internal types..." >&4
13284
13285 if $test X"$ivsize" = X8; then
13286         ivdformat="$sPRId64"
13287         uvuformat="$sPRIu64"
13288         uvoformat="$sPRIo64"
13289         uvxformat="$sPRIx64"
13290         uvXUformat="$sPRIXU64"
13291 else
13292         if $test X"$ivsize" = X"$longsize"; then
13293                 ivdformat='"ld"'
13294                 uvuformat='"lu"'
13295                 uvoformat='"lo"'
13296                 uvxformat='"lx"'
13297                 uvXUformat='"lX"'
13298         else
13299                 if $test X"$ivsize" = X"$intsize"; then
13300                         ivdformat='"d"'
13301                         uvuformat='"u"'
13302                         uvoformat='"o"'
13303                         uvxformat='"x"'
13304                         uvXUformat='"X"'
13305                 else
13306                         : far out
13307                         if $test X"$ivsize" = X"$shortsize"; then
13308                                 ivdformat='"hd"'
13309                                 uvuformat='"hu"'
13310                                 uvoformat='"ho"'
13311                                 uvxformat='"hx"'
13312                                 uvXUformat='"hX"'
13313                         fi
13314                 fi
13315         fi
13316 fi
13317
13318 if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
13319         nveformat="$sPRIeldbl"
13320         nvfformat="$sPRIfldbl"
13321         nvgformat="$sPRIgldbl"
13322         nvEUformat="$sPRIEUldbl"
13323         nvFUformat="$sPRIFUldbl"
13324         nvGUformat="$sPRIGUldbl"
13325 else
13326         nveformat='"e"'
13327         nvfformat='"f"'
13328         nvgformat='"g"'
13329         nvEUformat='"E"'
13330         nvFUformat='"F"'
13331         nvGUformat='"G"'
13332 fi
13333
13334 case "$ivdformat" in
13335 '') echo "$0: Fatal: failed to find format strings, cannot continue." >& 4
13336     exit 1
13337     ;;
13338 esac
13339
13340
13341 echo " "
13342 $echo "Checking the format string to be used for gids..." >&4
13343
13344 case "$gidsign" in
13345 -1)     if $test X"$gidsize" = X"$ivsize"; then
13346                 gidformat="$ivdformat"
13347         else
13348                 if $test X"$gidsize" = X"$longsize"; then
13349                         gidformat='"ld"'
13350                 else
13351                         if $test X"$gidsize" = X"$intsize"; then
13352                                 gidformat='"d"'
13353                         else
13354                                 if $test X"$gidsize" = X"$shortsize"; then
13355                                         gidformat='"hd"'
13356                                 fi
13357                         fi
13358                 fi
13359         fi
13360         ;;
13361 *)      if $test X"$gidsize" = X"$uvsize"; then
13362                 gidformat="$uvuformat"
13363         else
13364                 if $test X"$gidsize" = X"$longsize"; then
13365                         gidformat='"lu"'
13366                 else
13367                         if $test X"$gidsize" = X"$intsize"; then
13368                                 gidformat='"u"'
13369                         else
13370                                 if $test X"$gidsize" = X"$shortsize"; then
13371                                         gidformat='"hu"'
13372                                 fi
13373                         fi
13374                 fi
13375         fi
13376         ;;
13377 esac
13378
13379 : see if getgroups exists
13380 set getgroups d_getgrps
13381 eval $inlibc
13382
13383 : see if setgroups exists
13384 set setgroups d_setgrps
13385 eval $inlibc
13386
13387
13388 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
13389 echo " "
13390 case "$d_getgrps$d_setgrps" in
13391 *define*)
13392         case "$groupstype" in
13393         '') dflt="$gidtype" ;;
13394         *)  dflt="$groupstype" ;;
13395         esac
13396         $cat <<EOM
13397 What type of pointer is the second argument to getgroups() and setgroups()?
13398 Usually this is the same as group ids, $gidtype, but not always.
13399
13400 EOM
13401         rp='What type pointer is the second argument to getgroups() and setgroups()?'
13402         . ./myread
13403         groupstype="$ans"
13404         ;;
13405 *)  groupstype="$gidtype";;
13406 esac
13407
13408 echo " "
13409 echo "Checking if your $make program sets \$(MAKE)..." >&4
13410 case "$make_set_make" in
13411 '')
13412         $sed 's/^X //' > testmake.mak << 'EOF'
13413 Xall:
13414 X       @echo 'maketemp="$(MAKE)"'
13415 EOF
13416         case "`$make -f testmake.mak 2>/dev/null`" in
13417         *maketemp=*) make_set_make='#' ;;
13418         *)      make_set_make="MAKE=$make" ;;
13419         esac
13420         $rm -f testmake.mak
13421         ;;
13422 esac
13423 case "$make_set_make" in
13424 '#') echo "Yup, it does.";;
13425 *) echo "Nope, it doesn't.";;
13426 esac
13427
13428 : see what type is used for mode_t
13429 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
13430 set mode_t modetype int stdio.h sys/types.h
13431 eval $typedef_ask
13432
13433 : define a fucntion to check prototypes
13434 $cat > protochk <<EOSH
13435 $startsh
13436 cc="$cc"
13437 optimize="$optimize"
13438 ccflags="$ccflags"
13439 prototype="$prototype"
13440 define="$define"
13441 rm=$rm
13442 EOSH
13443
13444 $cat >> protochk <<'EOSH'
13445
13446 $rm -f try.c
13447 foo="$1"
13448 shift
13449 while test $# -ge 2; do
13450         case "$1" in
13451                 $define) echo "#include <$2>" >> try.c ;;
13452                 literal) echo "$2" >> try.c ;;
13453         esac
13454     shift 2
13455 done
13456 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
13457 cat >> try.c <<'EOCP'
13458 #ifdef CAN_PROTOTYPE
13459 #define _(args) args
13460 #else
13461 #define _(args) ()
13462 #endif
13463 EOCP
13464 echo "$foo" >> try.c
13465 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
13466 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
13467 status=$?
13468 $rm -f try.[co]
13469 exit $status
13470 EOSH
13471 chmod +x protochk
13472 $eunicefix protochk
13473
13474 : see what type is used for size_t
13475 rp="What is the type used for the length parameter for string functions?"
13476 set size_t sizetype 'unsigned int' stdio.h sys/types.h
13477 eval $typedef_ask
13478
13479 : check for type of arguments to gethostbyaddr. 
13480 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
13481         case "$d_gethbyaddr" in
13482         $define)
13483                 $cat <<EOM
13484
13485 Checking to see what type of arguments are accepted by gethostbyaddr().
13486 EOM
13487                 hdrs="$define sys/types.h
13488                         $d_socket sys/socket.h 
13489                         $i_niin netinet/in.h 
13490                         $i_netdb netdb.h
13491                         $i_unistd unistd.h"
13492                 : The first arg can 'char *' or 'void *'
13493                 : The second arg is some of integral type
13494                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
13495                         for yyy in size_t long int; do
13496                                 case "$netdb_host_type" in
13497                                 '')     try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
13498                                         if ./protochk "$try" $hdrs; then
13499                                                 echo "Your system accepts $xxx for the first arg."
13500                                                 echo "...and $yyy for the second arg."
13501                                                 netdb_host_type="$xxx"
13502                                                 netdb_hlen_type="$yyy"
13503                                         fi
13504                                         ;;
13505                                 esac
13506                         done
13507                 done
13508                 : In case none of those worked, prompt the user.
13509                 case "$netdb_host_type" in
13510                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
13511                         dflt='char *'
13512                         . ./myread
13513                         netdb_host_type=$ans
13514                         rp='What is the type for the 2nd argument to gethostbyaddr?'
13515                         dflt="$sizetype"
13516                         . ./myread
13517                         netdb_hlen_type=$ans
13518                         ;;
13519                 esac
13520                 ;;
13521         *)      : no gethostbyaddr, so pick harmless defaults
13522                 netdb_host_type='char *'
13523                 netdb_hlen_type="$sizetype"
13524                 ;;
13525         esac
13526         # Remove the "const" if needed. -- but then we'll have a 
13527         # prototype clash!
13528         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
13529 fi
13530
13531 : check for type of argument to gethostbyname. 
13532 if test "X$netdb_name_type" = X ; then
13533         case "$d_gethbyname" in
13534         $define)
13535                 $cat <<EOM
13536
13537 Checking to see what type of argument is accepted by gethostbyname().
13538 EOM
13539                 hdrs="$define sys/types.h
13540                         $d_socket sys/socket.h 
13541                         $i_niin netinet/in.h 
13542                         $i_netdb netdb.h
13543                         $i_unistd unistd.h"
13544                 for xxx in "const char *" "char *"; do
13545                         case "$netdb_name_type" in
13546                         '')     try="extern struct hostent *gethostbyname($xxx);"
13547                                 if ./protochk "$try" $hdrs; then
13548                                         echo "Your system accepts $xxx."
13549                                         netdb_name_type="$xxx"
13550                                 fi
13551                                 ;;
13552                         esac
13553                 done
13554                 : In case none of those worked, prompt the user.
13555                 case "$netdb_name_type" in
13556                 '')     rp='What is the type for the 1st argument to gethostbyname?'
13557                         dflt='char *'
13558                         . ./myread
13559                         netdb_name_type=$ans
13560                         ;;
13561                 esac
13562                 ;;
13563         *)      : no gethostbyname, so pick harmless default
13564                 netdb_name_type='char *'
13565                 ;;
13566         esac
13567 fi
13568
13569 : check for type of 1st argument to getnetbyaddr. 
13570 if test "X$netdb_net_type" = X ; then
13571         case "$d_getnbyaddr" in
13572         $define)
13573                 $cat <<EOM
13574
13575 Checking to see what type of 1st argument is accepted by getnetbyaddr().
13576 EOM
13577                 hdrs="$define sys/types.h
13578                         $d_socket sys/socket.h 
13579                         $i_niin netinet/in.h 
13580                         $i_netdb netdb.h
13581                         $i_unistd unistd.h"
13582                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
13583                         case "$netdb_net_type" in
13584                         '')     try="extern struct netent *getnetbyaddr($xxx, int);"
13585                                 if ./protochk "$try" $hdrs; then
13586                                         echo "Your system accepts $xxx."
13587                                         netdb_net_type="$xxx"
13588                                 fi
13589                                 ;;
13590                         esac
13591                 done
13592                 : In case none of those worked, prompt the user.
13593                 case "$netdb_net_type" in
13594                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
13595                         dflt='long'
13596                         . ./myread
13597                         netdb_net_type=$ans
13598                         ;;
13599                 esac
13600                 ;;
13601         *)      : no getnetbyaddr, so pick harmless default
13602                 netdb_net_type='long'
13603                 ;;
13604         esac
13605 fi
13606 : locate the preferred pager for this system
13607 case "$pager" in
13608 '')
13609         dflt=''
13610         case "$pg" in
13611         /*) dflt=$pg;;
13612         [a-zA-Z]:/*) dflt=$pg;;
13613         esac
13614         case "$more" in
13615         /*) dflt=$more;;
13616         [a-zA-Z]:/*) dflt=$more;;
13617         esac
13618         case "$less" in
13619         /*) dflt=$less;;
13620         [a-zA-Z]:/*) dflt=$less;;
13621         esac
13622         case "$dflt" in
13623         '') dflt=/usr/ucb/more;;
13624         esac
13625         ;;
13626 *) dflt="$pager";;
13627 esac
13628 echo " "
13629 fn=f/
13630 rp='What pager is used on your system?'
13631 . ./getfile
13632 pager="$ans"
13633
13634 : see what type pids are declared as in the kernel
13635 rp="What is the type of process ids on this system?"
13636 set pid_t pidtype int stdio.h sys/types.h
13637 eval $typedef_ask
13638
13639 : Find earliest binary compatible site_perl subdirectory perl can use.
13640 case "$bincompat5005" in
13641 "$define") xs_apiversion='5.005' ;;
13642 *) xs_apiversion=$version ;;   # The current site_perl version.
13643 esac
13644 : Find earliest pure perl site_perl subdirectory perl can use.
13645 : The versioned directories started at 5.005.
13646 pm_apiversion='5.005'
13647
13648 : check for length of pointer
13649 echo " "
13650 case "$ptrsize" in
13651 '')
13652         echo "Checking to see how big your pointers are..." >&4
13653         if test "$voidflags" -gt 7; then
13654                 echo '#define VOID_PTR char *' > try.c
13655         else
13656                 echo '#define VOID_PTR void *' > try.c
13657         fi
13658         $cat >>try.c <<'EOCP'
13659 #include <stdio.h>
13660 int main()
13661 {
13662     printf("%d\n", (int)sizeof(VOID_PTR));
13663     exit(0);
13664 }
13665 EOCP
13666         set try
13667         if eval $compile_ok; then
13668                 ptrsize=`./try`
13669                 echo "Your pointers are $ptrsize bytes long."
13670         else
13671                 dflt='4'
13672                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
13673                 rp="What is the size of a pointer (in bytes)?"
13674                 . ./myread
13675                 ptrsize="$ans"
13676         fi
13677         ;;
13678 esac
13679 $rm -f try.c try
13680
13681 : see if ar generates random libraries by itself
13682 echo " "
13683 echo "Checking how to generate random libraries on your machine..." >&4
13684 echo 'int bar1() { return bar2(); }' > bar1.c
13685 echo 'int bar2() { return 2; }' > bar2.c
13686 $cat > foo.c <<'EOP'
13687 int main() { printf("%d\n", bar1()); exit(0); }
13688 EOP
13689 $cc $ccflags -c bar1.c >/dev/null 2>&1
13690 $cc $ccflags -c bar2.c >/dev/null 2>&1
13691 $cc $ccflags -c foo.c >/dev/null 2>&1
13692 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
13693 if $cc $ccflags $ldflags -o foobar foo$_o bar$_a $libs > /dev/null 2>&1 &&
13694         ./foobar >/dev/null 2>&1; then
13695         echo "$ar appears to generate random libraries itself."
13696         orderlib=false
13697         ranlib=":"
13698 elif $ar ts bar$_a >/dev/null 2>&1 &&
13699         $cc $ccflags $ldflags -o foobar foo$_o bar$_a $libs > /dev/null 2>&1 &&
13700         ./foobar >/dev/null 2>&1; then
13701                 echo "a table of contents needs to be added with '$ar ts'."
13702                 orderlib=false
13703                 ranlib="$ar ts"
13704 else
13705         case "$ranlib" in
13706         :) ranlib='';;
13707         '')
13708                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
13709                 $test -f $ranlib || ranlib=''
13710                 ;;
13711         esac
13712         if $test -n "$ranlib"; then
13713                 echo "your system has '$ranlib'; we'll use that."
13714                 orderlib=false
13715         else
13716                 echo "your system doesn't seem to support random libraries"
13717                 echo "so we'll use lorder and tsort to order the libraries."
13718                 orderlib=true
13719                 ranlib=":"
13720         fi
13721 fi
13722 $rm -f foo* bar* 
13723
13724 : check for type of arguments to select. 
13725 case "$selecttype" in
13726 '') case "$d_select" in
13727         $define)
13728                 echo " "
13729                 $cat <<EOM
13730 Checking to see what type of arguments are accepted by select().
13731 EOM
13732                 hdrs="$define sys/types.h
13733                         $i_systime sys/time.h 
13734                         $i_sysselct sys/select.h
13735                         $d_socket sys/socket.h"
13736                 : The first arg can be int, unsigned, or size_t
13737                 : The last arg may or may not be 'const'
13738                 val=''
13739                 : void pointer has been seen but using that
13740                 : breaks the selectminbits test
13741                 for xxx in 'fd_set *' 'int *'; do
13742                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
13743                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
13744                                         case "$val" in
13745                                         '')     try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
13746                                                 if ./protochk "$try" $hdrs; then
13747                                                         echo "Your system accepts $xxx."
13748                                                         val="$xxx"
13749                                                 fi
13750                                                 ;;
13751                                         esac
13752                                 done
13753                         done
13754                 done
13755                 case "$val" in
13756                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
13757                         case "$d_fd_set" in
13758                                 $define) dflt="fd_set *" ;;
13759                                 *)              dflt="int *" ;;
13760                         esac
13761                         . ./myread
13762                         val=$ans
13763                         ;;
13764                 esac
13765                 selecttype="$val"
13766                 ;;
13767         *)      : no select, so pick a harmless default
13768                 selecttype='int *'
13769                 ;;
13770         esac
13771         ;;
13772 esac
13773
13774 : check for the select 'width'
13775 case "$selectminbits" in
13776 '') case "$d_select" in
13777         $define)
13778                 $cat <<EOM
13779
13780 Checking to see on how many bits at a time your select() operates...
13781 EOM
13782                 $cat >try.c <<EOCP
13783 #include <sys/types.h>
13784 #$i_time I_TIME
13785 #$i_systime I_SYS_TIME
13786 #$i_systimek I_SYS_TIME_KERNEL
13787 #ifdef I_TIME
13788 #   include <time.h>
13789 #endif
13790 #ifdef I_SYS_TIME
13791 #   ifdef I_SYS_TIME_KERNEL
13792 #       define KERNEL
13793 #   endif
13794 #   include <sys/time.h>
13795 #   ifdef I_SYS_TIME_KERNEL
13796 #       undef KERNEL
13797 #   endif
13798 #endif
13799 #$i_sysselct I_SYS_SELECT
13800 #ifdef I_SYS_SELECT
13801 #include <sys/select.h>
13802 #endif
13803 #$d_socket HAS_SOCKET
13804 #ifdef HAS_SOCKET
13805 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
13806 #endif
13807 #include <stdio.h>
13808 $selecttype b;
13809 #define S sizeof(*(b))
13810 #define MINBITS 64
13811 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
13812 #define NBITS  (NBYTES * 8)
13813 int main() {
13814     char s[NBYTES];
13815     struct timeval t;
13816     int i;
13817     FILE* fp;
13818     int fd;
13819
13820     fclose(stdin);
13821     fp = fopen("try.c", "r");
13822     if (fp == 0)
13823       exit(1);
13824     fd = fileno(fp);
13825     if (fd < 0)
13826       exit(2);
13827     b = ($selecttype)s;
13828     for (i = 0; i < NBITS; i++)
13829         FD_SET(i, b);
13830     t.tv_sec  = 0;
13831     t.tv_usec = 0;
13832     select(fd + 1, b, 0, 0, &t);
13833     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
13834     printf("%d\n", i + 1);
13835     return 0;
13836 }
13837 EOCP
13838                 set try
13839                 if eval $compile_ok; then
13840                         selectminbits=`./try`
13841                         case "$selectminbits" in
13842                         '')     cat >&4 <<EOM
13843 Cannot figure out on how many bits at a time your select() operates.
13844 I'll play safe and guess it is 32 bits.
13845 EOM
13846                                 selectminbits=32
13847                                 bits="32 bits"
13848                                 ;;
13849                         1)      bits="1 bit" ;;
13850                         *)      bits="$selectminbits bits" ;;
13851                         esac
13852                         echo "Your select() operates on $bits at a time." >&4
13853                 else
13854                         rp='What is the minimum number of bits your select() operates on?'
13855                         case "$byteorder" in
13856                         1234|12345678)  dflt=32 ;;
13857                         *)              dflt=1  ;;
13858                         esac
13859                         . ./myread
13860                         val=$ans
13861                         selectminbits="$val"
13862                 fi
13863                 $rm -f try.* try
13864                 ;;
13865         *)      : no select, so pick a harmless default
13866                 selectminbits='32'
13867                 ;;
13868         esac
13869         ;;
13870 esac
13871
13872 : Trace out the files included by signal.h, then look for SIGxxx names.
13873 : Remove SIGARRAYSIZE used by HPUX.
13874 : Remove SIGSTKSIZE used by Linux.
13875 : Remove SIGSTKSZ used by Posix.
13876 : Remove SIGTYP void lines used by OS2.
13877 : Some cpps, like os390, dont give the file name anywhere
13878 if [ "X$fieldn" = X ]; then
13879         : Just make some guesses.  We check them later.
13880         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
13881 else
13882         xxx=`echo '#include <signal.h>' |
13883         $cppstdin $cppminus $cppflags 2>/dev/null |
13884         $grep '^[       ]*#.*include' | 
13885         $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sort | $uniq`
13886 fi
13887 : Check this list of files to be sure we have parsed the cpp output ok.
13888 : This will also avoid potentially non-existent files, such 
13889 : as ../foo/bar.h
13890 xxxfiles=''
13891 for xx in $xxx /dev/null ; do
13892         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
13893 done
13894 : If we have found no files, at least try signal.h
13895 case "$xxxfiles" in
13896 '')     xxxfiles=`./findhdr signal.h` ;;
13897 esac
13898 xxx=`awk '
13899 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
13900         print substr($2, 4, 20)
13901 }
13902 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
13903         print substr($3, 4, 20)
13904 }' $xxxfiles`
13905 : Append some common names just in case the awk scan failed.
13906 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
13907 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
13908 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
13909 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
13910 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
13911
13912 : generate a few handy files for later
13913 $cat > signal.c <<'EOCP'
13914 #include <sys/types.h>
13915 #include <signal.h>
13916 #include <stdio.h>
13917 int main() {
13918
13919 /* Strange style to avoid deeply-nested #if/#else/#endif */
13920 #ifndef NSIG
13921 #  ifdef _NSIG
13922 #    define NSIG (_NSIG)
13923 #  endif
13924 #endif
13925
13926 #ifndef NSIG
13927 #  ifdef SIGMAX
13928 #    define NSIG (SIGMAX+1)
13929 #  endif
13930 #endif
13931
13932 #ifndef NSIG
13933 #  ifdef SIG_MAX
13934 #    define NSIG (SIG_MAX+1)
13935 #  endif
13936 #endif
13937
13938 #ifndef NSIG
13939 #  ifdef MAXSIG
13940 #    define NSIG (MAXSIG+1)
13941 #  endif
13942 #endif
13943
13944 #ifndef NSIG
13945 #  ifdef MAX_SIG
13946 #    define NSIG (MAX_SIG+1)
13947 #  endif
13948 #endif
13949
13950 #ifndef NSIG
13951 #  ifdef SIGARRAYSIZE
13952 #    define NSIG (SIGARRAYSIZE+1) /* Not sure of the +1 */
13953 #  endif
13954 #endif
13955
13956 #ifndef NSIG
13957 #  ifdef _sys_nsig
13958 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
13959 #  endif
13960 #endif
13961
13962 /* Default to some arbitrary number that's big enough to get most
13963    of the common signals.
13964 */
13965 #ifndef NSIG
13966 #    define NSIG 50
13967 #endif
13968
13969 printf("NSIG %d\n", NSIG);
13970
13971 #ifndef JUST_NSIG
13972
13973 EOCP
13974
13975 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
13976 {
13977         printf "#ifdef SIG"; printf $1; printf "\n"
13978         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
13979         printf $1; printf ");\n"
13980         printf "#endif\n"
13981 }
13982 END {
13983         printf "#endif /* JUST_NSIG */\n";
13984         printf "exit(0);\n}\n";
13985 }
13986 ' >>signal.c
13987 $cat >signal.awk <<'EOP'
13988 BEGIN { ndups = 0 }
13989 $1 ~ /^NSIG$/ { nsig = $2 }
13990 ($1 !~ /^NSIG$/) && (NF == 2) {
13991     if ($2 > maxsig) { maxsig = $2 }
13992     if (sig_name[$2]) {
13993         dup_name[ndups] = $1
13994         dup_num[ndups] = $2
13995         ndups++ 
13996     }
13997     else {
13998         sig_name[$2] = $1
13999         sig_num[$2] = $2
14000     }
14001 }
14002 END { 
14003     if (nsig == 0) {
14004         nsig = maxsig + 1
14005     }
14006     printf("NSIG %d\n", nsig);
14007     for (n = 1; n < nsig; n++) {
14008         if (sig_name[n]) {
14009             printf("%s %d\n", sig_name[n], sig_num[n])
14010         }
14011         else {
14012             printf("NUM%d %d\n", n, n) 
14013         }
14014     }
14015     for (n = 0; n < ndups; n++) {
14016         printf("%s %d\n", dup_name[n], dup_num[n])
14017     }
14018 }
14019 EOP
14020 $cat >signal_cmd <<EOS
14021 $startsh
14022 if $test -s signal.lst; then
14023     echo "Using your existing signal.lst file"
14024         exit 0
14025 fi
14026 xxx="$xxx"
14027 EOS
14028 $cat >>signal_cmd <<'EOS'
14029
14030 set signal
14031 if eval $compile_ok; then
14032         ./signal$_exe | $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
14033 else
14034         echo "(I can't seem be able to compile the whole test program)" >&4
14035         echo "(I'll try it in little pieces.)" >&4
14036         set signal -DJUST_NSIG
14037         if eval $compile_ok; then
14038                 ./signal$_exe > signal.nsg
14039                 $cat signal.nsg
14040         else
14041                 echo "I can't seem to figure out how many signals you have." >&4
14042                 echo "Guessing 50." >&4
14043                 echo 'NSIG 50' > signal.nsg
14044         fi
14045         : Now look at all the signal names, one at a time.
14046         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
14047                 $cat > signal.c <<EOCP
14048 #include <sys/types.h>
14049 #include <signal.h>
14050 #include <stdio.h>
14051 int main() {
14052 printf("$xx %d\n", SIG${xx});
14053 return 0;
14054 }
14055 EOCP
14056                 set signal
14057                 if eval $compile; then
14058                         echo "SIG${xx} found."
14059                         ./signal$_exe  >> signal.ls1
14060                 else
14061                         echo "SIG${xx} NOT found."
14062                 fi
14063         done
14064         if $test -s signal.ls1; then
14065                 $cat signal.nsg signal.ls1 |
14066                         $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
14067         fi
14068
14069 fi
14070 if $test -s signal.lst; then
14071         :
14072 else
14073         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
14074         echo 'kill -l' >signal
14075         set X `csh -f <signal`
14076         $rm -f signal
14077         shift
14078         case $# in
14079         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
14080         esac
14081         echo $@ | $tr ' ' $trnl | \
14082             $awk '{ printf "%s %d\n", $1, ++s; }
14083                   END { printf "NSIG %d\n", ++s }' >signal.lst
14084 fi
14085 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
14086 EOS
14087 chmod a+x signal_cmd
14088 $eunicefix signal_cmd
14089
14090 : generate list of signal names
14091 echo " "
14092 case "$sig_name_init" in
14093 '') doinit=yes ;;
14094 *)  case "$sig_num_init" in
14095     ''|*,*) doinit=yes ;;
14096     esac ;;
14097 esac
14098 case "$doinit" in
14099 yes)
14100         echo "Generating a list of signal names and numbers..." >&4
14101         . ./signal_cmd
14102         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
14103         sig_name=`$awk 'BEGIN { printf "ZERO " }
14104                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
14105         sig_num=`$awk  'BEGIN { printf "0 " }
14106                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
14107         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
14108                              !/^NSIG/   { printf "\"%s\", ", $1 }
14109                              END        { printf "0\n" }' signal.lst`
14110         sig_num_init=`$awk  'BEGIN      { printf "0, " }
14111                              !/^NSIG/   { printf "%d, ", $2}
14112                              END        { printf "0\n"}' signal.lst`
14113         ;;
14114 esac
14115 echo "The following $sig_count signals are available:"
14116 echo " "
14117 echo $sig_name | $awk \
14118 'BEGIN { linelen = 0 }
14119 {
14120         for (i = 1; i <= NF; i++) {
14121                 name = "SIG" $i " "
14122                 linelen = linelen + length(name)
14123                 if (linelen > 70) {
14124                         printf "\n"
14125                         linelen = length(name)
14126                 }
14127                 printf "%s", name
14128         }
14129         printf "\n"
14130 }'
14131 $rm -f signal signal.c signal.awk signal.lst signal_cmd 
14132
14133 echo " "
14134 case "$sizetype" in
14135 *_t) zzz="$sizetype"    ;;
14136 *)   zzz="filesize"     ;;
14137 esac
14138 echo "Checking the size of $zzz..." >&4 
14139 cat > try.c <<EOCP
14140 #include <sys/types.h>
14141 #include <stdio.h>
14142 int main() {
14143     printf("%d\n", (int)sizeof($sizetype));
14144     exit(0);
14145 }
14146 EOCP
14147 set try
14148 if eval $compile_ok; then
14149         yyy=`./try`
14150         case "$yyy" in
14151         '')     sizesize=4
14152                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
14153                 ;;
14154         *)      sizesize=$yyy
14155                 echo "Your $zzz size is $sizesize bytes."
14156                 ;;
14157         esac
14158 else
14159         sizesize=4
14160         echo "(I can't compile the test program--guessing $sizesize.)" >&4
14161 fi
14162
14163
14164 : check for socklen_t
14165 echo " "
14166 echo "Checking to see if you have socklen_t..." >&4
14167 $cat >try.c <<EOCP
14168 #include <sys/types.h>
14169 #$d_socket HAS_SOCKET
14170 #ifdef HAS_SOCKET
14171 #include <sys/socket.h>
14172 #endif
14173 int main() { socklen_t x = 16; }
14174 EOCP
14175 set try
14176 if eval $compile; then
14177         val="$define"
14178         echo "You have socklen_t."
14179 else
14180         val="$undef"
14181         echo "You do not have socklen_t."
14182         case "$sizetype" in
14183         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
14184         esac
14185 fi
14186 $rm -f try try.*
14187 set d_socklen_t
14188 eval $setvar
14189
14190 : check for type of the size argument to socket calls
14191 case "$d_socket" in
14192 "$define")
14193         $cat <<EOM
14194
14195 Checking to see what type is the last argument of accept().
14196 EOM
14197         hdrs="$define sys/types.h $d_socket sys/socket.h" 
14198         yyy=''
14199         case "$d_socklen_t" in
14200         "$define") yyy="$yyy socklen_t"
14201         esac
14202         yyy="$yyy $sizetype int long unsigned"
14203         for xxx in $yyy; do
14204                 case "$socksizetype" in
14205                 '')     try="extern int accept(int, struct sockaddr *, $xxx *);"
14206                         if ./protochk "$try" $hdrs; then
14207                                 echo "Your system accepts '$xxx *' for the last argument of accept()."
14208                                 socksizetype="$xxx"
14209                         fi
14210                         ;;
14211                 esac
14212         done
14213 : In case none of those worked, prompt the user.
14214         case "$socksizetype" in
14215         '')     rp='What is the type for socket address structure sizes?'
14216                 dflt='int'
14217                 . ./myread
14218                 socksizetype=$ans
14219                 ;;
14220         esac
14221         ;;
14222 *)      : no sockets, so pick relatively harmless default
14223         socksizetype='int'
14224         ;;
14225 esac
14226
14227 : see what type is used for signed size_t
14228 set ssize_t ssizetype int stdio.h sys/types.h
14229 eval $typedef
14230 dflt="$ssizetype"
14231 $cat > ssize.c <<EOM
14232 #include <stdio.h>
14233 #include <sys/types.h>
14234 #define Size_t $sizetype
14235 #define SSize_t $dflt
14236 int main()
14237 {
14238         if (sizeof(Size_t) == sizeof(SSize_t))
14239                 printf("$dflt\n");
14240         else if (sizeof(Size_t) == sizeof(int))
14241                 printf("int\n");
14242         else 
14243                 printf("long\n");
14244         exit(0);
14245 }
14246 EOM
14247 echo " "
14248 set ssize
14249 if eval $compile_ok && ./ssize > /dev/null; then
14250         ssizetype=`./ssize`
14251         echo "I'll be using $ssizetype for functions returning a byte count." >&4
14252 else
14253         $cat >&4 <<EOM
14254 Help! I can't compile and run the ssize_t test program: please enlighten me!
14255 (This is probably a misconfiguration in your system or libraries, and
14256 you really ought to fix it.  Still, I'll try anyway.)
14257
14258 I need a type that is the same size as $sizetype, but is guaranteed to
14259 be signed.  Common values are ssize_t, int and long.
14260
14261 EOM
14262         rp="What signed type is the same size as $sizetype?"
14263         . ./myread
14264         ssizetype="$ans"
14265 fi
14266 $rm -f ssize ssize.*
14267
14268 : see what type of char stdio uses.
14269 echo " "
14270 if $contains 'unsigned.*char.*_ptr;' `./findhdr stdio.h` >/dev/null 2>&1 ; then
14271         echo "Your stdio uses unsigned chars." >&4
14272         stdchar="unsigned char"
14273 else
14274         echo "Your stdio uses signed chars." >&4
14275         stdchar="char"
14276 fi
14277
14278 : see if time exists
14279 echo " "
14280 if test "X$d_time" = X -o X"$timetype" = X; then
14281     if set time val -f d_time; eval $csym; $val; then
14282                 echo 'time() found.' >&4
14283                 val="$define"
14284                 rp="What is the type returned by time() on this system?"
14285                 set time_t timetype long stdio.h sys/types.h
14286                 eval $typedef_ask
14287     else
14288                 echo 'time() not found, hope that will do.' >&4
14289                 val="$undef"
14290                 timetype='int';
14291     fi
14292     set d_time
14293     eval $setvar
14294 fi
14295
14296 : see what type uids are declared as in the kernel
14297 echo " "
14298 echo "Looking for the type for user ids returned by getuid()."
14299 set uid_t uidtype xxx stdio.h sys/types.h
14300 eval $typedef
14301 case "$uidtype" in
14302 xxx)
14303         xxx=`./findhdr sys/user.h`
14304         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
14305         case $1 in
14306         unsigned) dflt="$1 $2" ;;
14307         *) dflt="$1" ;;
14308         esac
14309         ;;
14310 *) dflt="$uidtype";;
14311 esac
14312 case "$uidtype" in
14313 uid_t)  echo "uid_t found." ;;
14314 *)      rp="What is the type for user ids returned by getuid()?"
14315         . ./myread
14316         uidtype="$ans"
14317         ;;
14318 esac
14319
14320 echo " "
14321 case "$uidtype" in
14322 *_t) zzz="$uidtype"     ;;
14323 *)   zzz="uid"          ;;
14324 esac
14325 echo "Checking the size of $zzz..." >&4 
14326 cat > try.c <<EOCP
14327 #include <sys/types.h>
14328 #include <stdio.h>
14329 int main() {
14330     printf("%d\n", (int)sizeof($uidtype));
14331     exit(0);
14332 }
14333 EOCP
14334 set try
14335 if eval $compile_ok; then
14336         yyy=`./try`
14337         case "$yyy" in
14338         '')     uidsize=4
14339                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
14340                 ;;
14341         *)      uidsize=$yyy
14342                 echo "Your $zzz is $uidsize bytes long."
14343                 ;;
14344         esac
14345 else
14346         uidsize=4
14347         echo "(I can't compile the test program--guessing $uidsize.)" >&4
14348 fi
14349
14350 echo " "
14351 case "$uidtype" in
14352 *_t) zzz="$uidtype"     ;;
14353 *)   zzz="uid"          ;;
14354 esac
14355 echo "Checking the sign of $zzz..." >&4
14356 cat > try.c <<EOCP
14357 #include <sys/types.h>
14358 #include <stdio.h>
14359 int main() {
14360         $uidtype foo = -1;
14361         if (foo < 0)
14362                 printf("-1\n");
14363         else
14364                 printf("1\n");
14365 }
14366 EOCP
14367 set try
14368 if eval $compile; then
14369         yyy=`./try`
14370         case "$yyy" in
14371         '')     uidsign=1
14372                 echo "(I can't execute the test program--guessing unsigned.)" >&4
14373                 ;;
14374         *)      uidsign=$yyy
14375                 case "$uidsign" in
14376                  1) echo "Your $zzz is unsigned." ;;
14377                 -1) echo "Your $zzz is signed."   ;;
14378                 esac
14379                 ;;
14380         esac
14381 else
14382         uidsign=1
14383         echo "(I can't compile the test program--guessing unsigned.)" >&4
14384 fi
14385
14386
14387
14388 echo " "
14389 $echo "Checking the format string to be used for uids..." >&4
14390
14391 case "$uidsign" in
14392 -1)     if $test X"$uidsize" = X"$ivsize"; then
14393                 uidformat="$ivdformat"
14394         else
14395                 if $test X"$uidsize" = X"$longsize"; then
14396                         uidformat='"ld"'
14397                 else
14398                         if $test X"$uidsize" = X"$intsize"; then
14399                                 uidformat='"d"'
14400                         else
14401                                 if $test X"$uidsize" = X"$shortsize"; then
14402                                         uidformat='"hd"'
14403                                 fi
14404                         fi
14405                 fi
14406         fi
14407         ;;
14408 *)      if $test X"$uidsize" = X"$uvsize"; then
14409                 uidformat="$uvuformat"
14410         else
14411                 if $test X"$uidsize" = X"$longsize"; then
14412                         uidformat='"lu"'
14413                 else
14414                         if $test X"$uidsize" = X"$intsize"; then
14415                                 uidformat='"u"'
14416                         else
14417                                 if $test X"$uidsize" = X"$shortsize"; then
14418                                         uidformat='"hu"'
14419                                 fi
14420                         fi
14421                 fi
14422         fi
14423         ;;
14424 esac
14425
14426 : see if dbm.h is available
14427 : see if dbmclose exists
14428 set dbmclose d_dbmclose
14429 eval $inlibc
14430
14431 case "$d_dbmclose" in
14432 $define)
14433         set dbm.h i_dbm
14434         eval $inhdr
14435         case "$i_dbm" in
14436         $define)
14437                 val="$undef"
14438                 set i_rpcsvcdbm
14439                 eval $setvar
14440                 ;;
14441         *)      set rpcsvc/dbm.h i_rpcsvcdbm
14442                 eval $inhdr
14443                 ;;
14444         esac
14445         ;;
14446 *)      echo "We won't be including <dbm.h>"
14447         val="$undef"
14448         set i_dbm
14449         eval $setvar
14450         val="$undef"
14451         set i_rpcsvcdbm
14452         eval $setvar
14453         ;;
14454 esac
14455
14456 : see if this is a sys/file.h system
14457 val=''
14458 set sys/file.h val
14459 eval $inhdr
14460
14461 : do we need to include sys/file.h ?
14462 case "$val" in
14463 "$define")
14464         echo " "
14465         if $h_sysfile; then
14466                 val="$define"
14467                 echo "We'll be including <sys/file.h>." >&4
14468         else
14469                 val="$undef"
14470                 echo "We won't be including <sys/file.h>." >&4
14471         fi
14472         ;;
14473 *)
14474         h_sysfile=false
14475         ;;
14476 esac
14477 set i_sysfile
14478 eval $setvar
14479
14480 : see if fcntl.h is there
14481 val=''
14482 set fcntl.h val
14483 eval $inhdr
14484
14485 : see if we can include fcntl.h
14486 case "$val" in
14487 "$define")
14488         echo " "
14489         if $h_fcntl; then
14490                 val="$define"
14491                 echo "We'll be including <fcntl.h>." >&4
14492         else
14493                 val="$undef"
14494                 if $h_sysfile; then
14495         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
14496                 else
14497                         echo "We won't be including <fcntl.h>." >&4
14498                 fi
14499         fi
14500         ;;
14501 *)
14502         h_fcntl=false
14503         val="$undef"
14504         ;;
14505 esac
14506 set i_fcntl
14507 eval $setvar
14508
14509 : see if this is a iconv.h system
14510 set iconv.h i_iconv
14511 eval $inhdr
14512
14513 : see if this is a ieeefp.h system
14514 set ieeefp.h i_ieeefp
14515 eval $inhdr
14516
14517 : see if this is a libutil.h system
14518 set libutil.h i_libutil
14519 eval $inhdr
14520
14521 : see if locale.h is available
14522 set locale.h i_locale
14523 eval $inhdr
14524
14525 : see if mach cthreads are available
14526 if test "X$usethreads" = "X$define"; then
14527         set mach/cthreads.h i_machcthr
14528         eval $inhdr
14529 else
14530         i_machcthr="$undef"
14531 fi
14532
14533
14534
14535 : see if this is a math.h system
14536 set math.h i_math
14537 eval $inhdr
14538
14539 : see if this is a mntent.h system
14540 set mntent.h i_mntent
14541 eval $inhdr
14542
14543 : see if ndbm.h is available
14544 set ndbm.h t_ndbm
14545 eval $inhdr
14546 case "$t_ndbm" in
14547 $define)
14548         : see if dbm_open exists
14549         set dbm_open d_dbm_open
14550         eval $inlibc
14551         case "$d_dbm_open" in
14552         $undef)
14553                 t_ndbm="$undef"
14554                 echo "We won't be including <ndbm.h>"
14555                 ;;
14556         esac
14557         ;;
14558 esac
14559 val="$t_ndbm"
14560 set i_ndbm
14561 eval $setvar
14562
14563 : see if net/errno.h is available
14564 val=''
14565 set net/errno.h val
14566 eval $inhdr
14567
14568 : Unfortunately, it causes problems on some systems.  Arrgh.
14569 case "$val" in
14570 $define)
14571         cat > try.c <<'EOM'
14572 #include <stdio.h>
14573 #include <errno.h>
14574 #include <net/errno.h>
14575 int func()
14576 {
14577         return ENOTSOCK;
14578 }
14579 EOM
14580         if $cc $ccflags -c try.c >/dev/null 2>&1; then
14581                 echo "We'll be including <net/errno.h>." >&4
14582         else
14583                 echo "We won't be including <net/errno.h>." >&4
14584                 val="$undef"
14585         fi
14586         $rm -f try.* try
14587         ;;
14588 esac
14589 set i_neterrno
14590 eval $setvar
14591
14592 : see if netinet/tcp.h is available
14593 set netinet/tcp.h i_netinettcp
14594 eval $inhdr
14595
14596 : see if this is a poll.h system
14597 set poll.h i_poll
14598 eval $inhdr
14599
14600 : see if this is a prot.h system
14601 set prot.h i_prot
14602 eval $inhdr
14603
14604 echo " "
14605 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4 
14606 $cat <<'EOSH' > Cppsym.know
14607 a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
14608 AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
14609 alliant alpha am29000 AM29000 amiga AMIGAOS AMIX
14610 ansi ANSI_C_SOURCE apollo ardent atarist att386 att3b BeOS
14611 BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
14612 BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
14613 bull c cadmus clipper CMU COFF COMPILER_VERSION
14614 concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
14615 CYGWIN DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
14616 Dynix DynixPTX ELF encore EPI EXTENSIONS FILE_OFFSET_BITS
14617 FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
14618 GNU_SOURCE GNUC GNUC_MINOR GO32 gould GOULD_PN
14619 H3050R H3050RX hbullx20 hcx host_mips
14620 hp200 hp300 hp700 HP700 hp800 hp9000
14621 hp9000s200 hp9000s300 hp9000s400 hp9000s500
14622 hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
14623 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
14624 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
14625 INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
14626 LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
14627 LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
14628 Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
14629 LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
14630 M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
14631 M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
14632 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
14633 MATH_HAS_NO_SIDE_EFFECTS
14634 mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
14635 mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
14636 mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
14637 MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
14638 mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
14639 NetBSD news1500 news1700 news1800 news1900 news3700
14640 news700 news800 news900 NeXT NLS ns16000 ns32000
14641 ns32016 ns32332 ns32k nsc32000
14642 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
14643 pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
14644 pc532 pdp11 PGC PIC plexus PORTAR posix
14645 POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
14646 POSIX_C_SOURCE POSIX_SOURCE POWER
14647 PROTOTYPES PWB pyr QNX R3000 REENTRANT RES Rhapsody RISC6000
14648 riscix riscos RT scs SCO sequent sgi SGI_SOURCE sinix
14649 SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
14650 sony sony_news sonyrisc sparc sparclite spectrum
14651 stardent stdc STDC_EXT stratos sun sun3 sun386
14652 Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
14653 SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
14654 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
14655 sysV68 sysV88 Tek4132 Tek4300 titan
14656 tower tower32 tower32_200 tower32_600 tower32_700
14657 tower32_800 tower32_850 tss
14658 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
14659 ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
14660 unix UNIX95 UNIX99 unixpc unos USGr4 USGr4_2
14661 Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms xenix Xenix286
14662 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
14663 XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
14664 z8000
14665 EOSH
14666 # Maybe put other stuff here too.
14667 cat <<EOSH >>Cppsym.know
14668 $osname
14669 EOSH
14670 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
14671 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
14672 $cat Cppsym.know > Cppsym.c
14673 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | sort | uniq > Cppsym.know
14674 $rm -f Cppsym.a Cppsym.b Cppsym.c
14675 cat <<EOSH > Cppsym
14676 $startsh
14677 if $test \$# -gt 0; then
14678     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
14679     if $test -s Cppsym.got; then
14680         $rm -f Cppsym.got
14681         exit 0
14682     fi
14683     $rm -f Cppsym.got
14684     exit 1
14685 else
14686     $tr " " "$trnl" | ./Cppsym.try
14687     exit 0
14688 fi
14689 EOSH
14690 chmod +x Cppsym
14691 $eunicefix Cppsym
14692 cat <<EOSH > Cppsym.try
14693 $startsh
14694 cat <<'EOCP' > try.c
14695 #include <stdio.h>
14696 int main() {
14697 EOCP
14698 $awk \\
14699 EOSH
14700 cat <<'EOSH' >> Cppsym.try
14701 'length($1) > 0 {
14702     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
14703     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
14704     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
14705     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
14706 }'       >> try.c
14707 echo '}' >> try.c
14708 EOSH
14709 cat <<EOSH >> Cppsym.try
14710 ccflags="$ccflags"
14711 case "$osname-$gccversion" in
14712 irix-) ccflags="\$ccflags -woff 1178" ;;
14713 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
14714 esac
14715 $cc $optimize \$ccflags $ldflags -o try try.c $libs && ./try$exe_ext
14716 EOSH
14717 chmod +x Cppsym.try
14718 $eunicefix Cppsym.try
14719 ./Cppsym < Cppsym.know > Cppsym.true
14720 : now check the C compiler for additional symbols
14721 postprocess_cc_v=''
14722 case "$osname" in
14723 aix) postprocess_cc_v="|$tr , ' '" ;;
14724 esac
14725 $cat >ccsym <<EOS
14726 $startsh
14727 $cat >tmp.c <<EOF
14728 extern int foo;
14729 EOF
14730 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
14731 do
14732         case "\$i" in
14733         -D*) echo "\$i" | $sed 's/^-D//';;
14734         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A\(.*\)(\(.*\))/\1=\2/';;
14735         esac
14736 done
14737 $rm -f try.c
14738 EOS
14739 postprocess_cc_v=''
14740 chmod +x ccsym
14741 $eunicefix ccsym
14742 ./ccsym > ccsym1.raw
14743 if $test -s ccsym1.raw; then
14744        $sort ccsym1.raw | $uniq >ccsym.raw
14745 else
14746        mv ccsym1.raw ccsym.raw
14747 fi
14748
14749 $awk '/\=/ { print $0; next }
14750         { print $0"=1" }' ccsym.raw >ccsym.list
14751 $awk '/\=/ { print $0; next }
14752         { print $0"=1" }' Cppsym.true >ccsym.true
14753 $comm -13 ccsym.true ccsym.list >ccsym.own
14754 $comm -12 ccsym.true ccsym.list >ccsym.com
14755 $comm -23 ccsym.true ccsym.list >ccsym.cpp
14756 also=''
14757 if $test -z ccsym.raw; then
14758         echo "Your C compiler doesn't seem to define any symbols!" >&4
14759         echo " "
14760         echo "However, your C preprocessor defines the following symbols:"
14761         $cat Cppsym.true
14762         ccsymbols=''
14763         cppsymbols=`$cat Cppsym.true`
14764         cppsymbols=`echo $cppsymbols`
14765         cppccsymbols="$cppsymbols"
14766 else
14767         if $test -s ccsym.com; then
14768                 echo "Your C compiler and pre-processor define these symbols:"
14769                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
14770                 also='also '
14771                 symbols='ones'
14772                 cppccsymbols=`$cat ccsym.com`
14773                 cppccsymbols=`echo $cppccsymbols`
14774                 $test "$silent" || sleep 1
14775         fi
14776         if $test -s ccsym.cpp; then
14777                 $test "$also" && echo " "
14778                 echo "Your C pre-processor ${also}defines the following symbols:"
14779                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
14780                 also='further '
14781                 cppsymbols=`$cat ccsym.cpp`
14782                 cppsymbols=`echo $cppsymbols`
14783                 $test "$silent" || sleep 1
14784         fi
14785         if $test -s ccsym.own; then
14786                 $test "$also" && echo " "
14787                 echo "Your C compiler ${also}defines the following cpp symbols:"
14788                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
14789                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
14790                 ccsymbols=`$cat ccsym.own`
14791                 ccsymbols=`echo $ccsymbols`
14792                 $test "$silent" || sleep 1
14793         fi
14794 fi
14795 $rm -f ccsym* Cppsym.*
14796
14797 : see if this is a termio system
14798 val="$undef"
14799 val2="$undef"
14800 val3="$undef"
14801 if $test `./findhdr termios.h`; then
14802         set tcsetattr i_termios
14803         eval $inlibc
14804         val3="$i_termios"
14805 fi
14806 echo " "
14807 case "$val3" in
14808 "$define") echo "You have POSIX termios.h... good!" >&4;;
14809 *) if ./Cppsym pyr; then
14810                 case "`/bin/universe`" in
14811                 ucb) if $test `./findhdr sgtty.h`; then
14812                                 val2="$define"
14813                                 echo "<sgtty.h> found." >&4
14814                         else
14815                                 echo "System is pyramid with BSD universe."
14816                                 echo "<sgtty.h> not found--you could have problems." >&4
14817                         fi;;
14818                 *) if $test `./findhdr termio.h`; then
14819                                 val="$define"
14820                                 echo "<termio.h> found." >&4
14821                         else
14822                                 echo "System is pyramid with USG universe."
14823                                 echo "<termio.h> not found--you could have problems." >&4
14824                         fi;;
14825                 esac
14826         elif ./usg; then
14827                 if $test `./findhdr termio.h`; then
14828                         echo "<termio.h> found." >&4
14829                         val="$define"
14830                 elif $test `./findhdr sgtty.h`; then
14831                         echo "<sgtty.h> found." >&4
14832                         val2="$define"
14833                 else
14834 echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
14835                 fi
14836         else
14837                 if $test `./findhdr sgtty.h`; then
14838                         echo "<sgtty.h> found." >&4
14839                         val2="$define"
14840                 elif $test `./findhdr termio.h`; then
14841                         echo "<termio.h> found." >&4
14842                         val="$define"
14843                 else
14844 echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
14845                 fi
14846         fi;;
14847 esac
14848 set i_termio; eval $setvar
14849 val=$val2; set i_sgtty; eval $setvar
14850 val=$val3; set i_termios; eval $setvar
14851
14852 : see if this is a shadow.h system
14853 set shadow.h i_shadow
14854 eval $inhdr
14855
14856 : see if this is a socks.h system
14857 set socks.h i_socks
14858 eval $inhdr
14859
14860 : see if stdarg is available
14861 echo " "
14862 if $test `./findhdr stdarg.h`; then
14863         echo "<stdarg.h> found." >&4
14864         valstd="$define"
14865 else
14866         echo "<stdarg.h> NOT found." >&4
14867         valstd="$undef"
14868 fi
14869
14870 : see if varags is available
14871 echo " "
14872 if $test `./findhdr varargs.h`; then
14873         echo "<varargs.h> found." >&4
14874 else
14875         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
14876 fi
14877
14878 : set up the varargs testing programs
14879 $cat > varargs.c <<EOP
14880 #ifdef I_STDARG
14881 #include <stdarg.h>
14882 #endif
14883 #ifdef I_VARARGS
14884 #include <varargs.h>
14885 #endif
14886
14887 #ifdef I_STDARG
14888 int f(char *p, ...)
14889 #else
14890 int f(va_alist)
14891 va_dcl
14892 #endif
14893 {
14894         va_list ap;
14895 #ifndef I_STDARG
14896         char *p;
14897 #endif
14898 #ifdef I_STDARG
14899         va_start(ap,p);
14900 #else
14901         va_start(ap);
14902         p = va_arg(ap, char *);
14903 #endif
14904         va_end(ap);
14905 }
14906 EOP
14907 $cat > varargs <<EOP
14908 $startsh
14909 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
14910         echo "true"
14911 else
14912         echo "false"
14913 fi
14914 $rm -f varargs$_o
14915 EOP
14916 chmod +x varargs
14917
14918 : now check which varargs header should be included
14919 echo " "
14920 i_varhdr=''
14921 case "$valstd" in
14922 "$define")
14923         if `./varargs I_STDARG`; then
14924                 val='stdarg.h'
14925         elif `./varargs I_VARARGS`; then
14926                 val='varargs.h'
14927         fi
14928         ;;
14929 *)
14930         if `./varargs I_VARARGS`; then
14931                 val='varargs.h'
14932         fi
14933         ;;
14934 esac
14935 case "$val" in
14936 '')
14937 echo "I could not find the definition for va_dcl... You have problems..." >&4
14938         val="$undef"; set i_stdarg; eval $setvar
14939         val="$undef"; set i_varargs; eval $setvar
14940         ;;
14941 *) 
14942         set i_varhdr
14943         eval $setvar
14944         case "$i_varhdr" in
14945         stdarg.h)
14946                 val="$define"; set i_stdarg; eval $setvar
14947                 val="$undef"; set i_varargs; eval $setvar
14948                 ;;
14949         varargs.h)
14950                 val="$undef"; set i_stdarg; eval $setvar
14951                 val="$define"; set i_varargs; eval $setvar
14952                 ;;
14953         esac
14954         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
14955 esac
14956 $rm -f varargs*
14957
14958 : see if stddef is available
14959 set stddef.h i_stddef
14960 eval $inhdr
14961
14962 : see if this is a sunmath.h system
14963 set sunmath.h i_sunmath
14964 eval $inhdr
14965
14966 : see if sys/access.h is available
14967 set sys/access.h i_sysaccess
14968 eval $inhdr
14969
14970 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
14971 set sys/filio.h i_sysfilio
14972 eval $inhdr
14973 echo " "
14974 if $test `./findhdr sys/ioctl.h`; then
14975         val="$define"
14976         echo '<sys/ioctl.h> found.' >&4
14977 else
14978         val="$undef"
14979         if $test $i_sysfilio = "$define"; then
14980             echo '<sys/ioctl.h> NOT found.' >&4
14981         else
14982                 $test $i_sgtty = "$define" && xxx="sgtty.h"
14983                 $test $i_termio = "$define" && xxx="termio.h"
14984                 $test $i_termios = "$define" && xxx="termios.h"
14985 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
14986         fi
14987 fi
14988 set i_sysioctl
14989 eval $setvar
14990
14991
14992 : see if this is a syslog.h system
14993 set syslog.h i_syslog
14994 eval $inhdr
14995
14996
14997 : see if this is a sys/mode.h system
14998 set sys/mode.h i_sysmode
14999 eval $inhdr
15000
15001 : see if sys/resource.h has to be included
15002 set sys/resource.h i_sysresrc
15003 eval $inhdr
15004
15005 : see if sys/security.h is available
15006 set sys/security.h i_syssecrt
15007 eval $inhdr
15008
15009 : see if this is a sys/statvfs.h system
15010 set sys/statvfs.h i_sysstatvfs
15011 eval $inhdr
15012
15013 : see if this is a sys/uio.h system
15014 set sys/uio.h i_sysuio
15015 eval $inhdr
15016
15017 : see if this is a sys/un.h system
15018 set sys/un.h i_sysun
15019 eval $inhdr
15020
15021
15022 : see if this is a sys/utsname.h system
15023 set sys/utsname.h i_sysutsname
15024 eval $inhdr
15025
15026 : see if this is a syswait system
15027 set sys/wait.h i_syswait
15028 eval $inhdr
15029
15030 : see if this is a ustat.h system
15031 set ustat.h i_ustat
15032 eval $inhdr
15033
15034 : see if this is an utime system
15035 set utime.h i_utime
15036 eval $inhdr
15037
15038 : see if this is a values.h system
15039 set values.h i_values
15040 eval $inhdr
15041
15042 : see if this is a vfork system
15043 case "$d_vfork" in
15044 "$define")
15045         set vfork.h i_vfork
15046         eval $inhdr
15047         ;;
15048 *)
15049         i_vfork="$undef"
15050         ;;
15051 esac
15052
15053 : see if gdbm.h is available
15054 set gdbm.h t_gdbm
15055 eval $inhdr
15056 case "$t_gdbm" in
15057 $define)
15058         : see if gdbm_open exists
15059         set gdbm_open d_gdbm_open
15060         eval $inlibc
15061         case "$d_gdbm_open" in
15062         $undef)
15063                 t_gdbm="$undef"
15064                 echo "We won't be including <gdbm.h>"
15065                 ;;
15066         esac
15067         ;;
15068 esac
15069 val="$t_gdbm"
15070 set i_gdbm
15071 eval $setvar
15072
15073 echo " "
15074 echo "Looking for extensions..." >&4
15075 : If we are using the old config.sh, known_extensions may contain
15076 : old or inaccurate or duplicate values.
15077 known_extensions=''
15078 nonxs_extensions=''
15079 : We do not use find because it might not be available.
15080 : We do not just use MANIFEST because the user may have dropped
15081 : some additional extensions into the source tree and expect them
15082 : to be built.
15083
15084 : Function to recursively find available extensions, ignoring DynaLoader
15085 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
15086 find_extensions='
15087     for xxx in *; do
15088        case "$xxx" in
15089            DynaLoader|dynaload) ;;
15090            *)
15091            if $test -f $xxx/$xxx.xs; then
15092                known_extensions="$known_extensions $1$xxx";
15093            elif $test -f $xxx/Makefile.PL; then
15094                nonxs_extensions="$nonxs_extensions $1$xxx";
15095            else
15096                if $test -d $xxx -a $# -lt 10; then
15097                    set $1$xxx/ $*;
15098                    cd $xxx;
15099                    eval $find_extensions;
15100                    cd ..;
15101                    shift;
15102                fi;
15103            fi
15104            ;;
15105        esac;
15106     done'
15107 tdir=`pwd`
15108 cd $rsrc/ext
15109 set X
15110 shift
15111 eval $find_extensions
15112 set X $nonxs_extensions
15113 shift
15114 nonxs_extensions="$*"
15115 set X $known_extensions
15116 shift
15117 known_extensions="$*"
15118 cd $tdir
15119
15120 : Now see which are supported on this system.
15121 avail_ext=''
15122 for xxx in $known_extensions ; do
15123         case "$xxx" in
15124         DB_File|db_file)
15125                 case "$i_db" in
15126                 $define) avail_ext="$avail_ext $xxx" ;;
15127                 esac
15128                 ;;
15129         GDBM_File|gdbm_fil)
15130                 case "$i_gdbm" in 
15131                 $define) avail_ext="$avail_ext $xxx" ;;
15132                 esac
15133                 ;;
15134         NDBM_File|ndbm_fil)
15135                 case "$i_ndbm" in
15136                 $define)
15137                     case "$osname-$use64bitint" in
15138                     hpux-define)
15139                         case "$libs" in
15140                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
15141                         esac
15142                         ;;
15143                     *) avail_ext="$avail_ext $xxx" ;;
15144                     esac
15145                     ;;
15146                 esac
15147                 ;;
15148         ODBM_File|odbm_fil) 
15149                 case "${i_dbm}${i_rpcsvcdbm}" in
15150                 *"${define}"*)
15151                     case "$osname-$use64bitint" in
15152                     hpux-define)
15153                         case "$libs" in
15154                         *-ldbm*) avail_ext="$avail_ext $xxx" ;;
15155                         esac
15156                         ;;
15157                     *) avail_ext="$avail_ext $xxx" ;;
15158                     esac
15159                     ;;
15160                 esac
15161                 ;;
15162         POSIX|posix)
15163                 case "$useposix" in
15164                 true|define|y) avail_ext="$avail_ext $xxx" ;;
15165                 esac
15166                 ;;
15167         Opcode|opcode)
15168                 case "$useopcode" in
15169                 true|define|y) avail_ext="$avail_ext $xxx" ;;
15170                 esac
15171                 ;;
15172         Socket|socket)
15173                 case "$d_socket" in 
15174                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
15175                 esac
15176                 ;;
15177         Sys/Syslog|sys/syslog)
15178                 : XXX syslog requires socket
15179                 case "$d_socket" in 
15180                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
15181                 esac
15182                 ;;
15183         Thread|thread)
15184                 case "$usethreads" in 
15185                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
15186                 esac
15187                 ;;
15188         IPC/SysV|ipc/sysv)
15189                 : XXX Do we need a useipcsysv variable here
15190                 case "${d_msg}${d_sem}${d_shm}" in 
15191                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
15192                 esac
15193                 ;;
15194         *)      avail_ext="$avail_ext $xxx"
15195                 ;;
15196         esac
15197 done
15198
15199 set X $avail_ext
15200 shift
15201 avail_ext="$*"
15202
15203 : Now see which nonxs extensions are supported on this system.
15204 : For now assume all are.
15205 nonxs_ext=''
15206 for xxx in $nonxs_extensions ; do
15207         case "$xxx" in
15208         *)      nonxs_ext="$nonxs_ext $xxx"
15209                 ;;
15210         esac
15211 done
15212
15213 set X $nonxs_ext
15214 shift
15215 nonxs_ext="$*"
15216
15217 case $usedl in
15218 $define)
15219         $cat <<EOM
15220 A number of extensions are supplied with $package.  You may choose to
15221 compile these extensions for dynamic loading (the default), compile
15222 them into the $package executable (static loading), or not include
15223 them at all.  Answer "none" to include no extensions.
15224 Note that DynaLoader is always built and need not be mentioned here.
15225
15226 EOM
15227         case "$dynamic_ext" in
15228         '') dflt="$avail_ext" ;;
15229         *)      dflt="$dynamic_ext"
15230                 # Perhaps we are reusing an old out-of-date config.sh.
15231                 case "$hint" in
15232                 previous)
15233                         if test X"$dynamic_ext" != X"$avail_ext"; then
15234                                 $cat <<EOM
15235 NOTICE:  Your previous config.sh list may be incorrect. 
15236 The extensions now available to you are 
15237         ${avail_ext}
15238 but the default list from your previous config.sh is
15239         ${dynamic_ext} 
15240
15241 EOM
15242                         fi
15243                         ;;
15244                 esac
15245                 ;;
15246         esac
15247         case "$dflt" in
15248         '')     dflt=none;;
15249         esac
15250         rp="What extensions do you wish to load dynamically?"
15251         . ./myread
15252         case "$ans" in
15253         none) dynamic_ext=' ' ;;
15254         *) dynamic_ext="$ans" ;;
15255         esac
15256
15257         case "$static_ext" in
15258         '')
15259                 : Exclude those already listed in dynamic linking
15260                 dflt=''
15261                 for xxx in $avail_ext; do
15262                         case " $dynamic_ext " in
15263                         *" $xxx "*) ;;
15264                         *) dflt="$dflt $xxx" ;;
15265                         esac
15266                 done
15267                 set X $dflt
15268                 shift
15269                 dflt="$*"
15270                 ;;
15271         *)  dflt="$static_ext" 
15272                 ;;
15273         esac
15274
15275         case "$dflt" in
15276         '')     dflt=none;;
15277         esac
15278         rp="What extensions do you wish to load statically?"
15279         . ./myread
15280         case "$ans" in
15281         none) static_ext=' ' ;;
15282         *) static_ext="$ans" ;;
15283         esac
15284         ;;
15285 *)
15286         $cat <<EOM
15287 A number of extensions are supplied with $package.  Answer "none" 
15288 to include no extensions. 
15289 Note that DynaLoader is always built and need not be mentioned here.
15290
15291 EOM
15292         case "$static_ext" in
15293         '') dflt="$avail_ext" ;;
15294         *)      dflt="$static_ext"
15295                 # Perhaps we are reusing an old out-of-date config.sh.
15296                 case "$hint" in
15297                 previous)
15298                         if test X"$static_ext" != X"$avail_ext"; then
15299                                 $cat <<EOM
15300 NOTICE:  Your previous config.sh list may be incorrect. 
15301 The extensions now available to you are 
15302         ${avail_ext}
15303 but the default list from your previous config.sh is
15304         ${static_ext} 
15305
15306 EOM
15307                         fi
15308                         ;;
15309                 esac
15310                 ;;
15311         esac
15312         : Exclude those that are not xs extensions
15313         case "$dflt" in
15314         '')     dflt=none;;
15315         esac
15316         rp="What extensions do you wish to include?"
15317         . ./myread
15318         case "$ans" in
15319         none) static_ext=' ' ;;
15320         *) static_ext="$ans" ;;
15321         esac
15322         ;;
15323 esac
15324
15325 set X $dynamic_ext $static_ext $nonxs_ext
15326 shift
15327 extensions="$*"
15328
15329 : Remove build directory name from cppstdin so it can be used from
15330 : either the present location or the final installed location.
15331 echo " "
15332 : Get out of the UU directory to get correct path name.
15333 cd ..
15334 case "$cppstdin" in
15335 `pwd`/cppstdin)
15336         echo "Stripping down cppstdin path name"
15337         cppstdin=cppstdin
15338         ;;
15339 esac
15340 cd UU
15341
15342 : end of configuration questions
15343 echo " "
15344 echo "End of configuration questions."
15345 echo " "
15346
15347 : back to where it started
15348 if test -d ../UU; then
15349         cd ..
15350 fi
15351
15352 : configuration may be patched via a 'config.over' file
15353 if $test -f config.over; then
15354         echo " "
15355         dflt=y
15356         rp='I see a config.over file.  Do you wish to load it?'
15357         . UU/myread
15358         case "$ans" in
15359         n*) echo "OK, I'll ignore it.";;
15360         *)      . ./config.over
15361                 echo "Configuration override changes have been loaded."
15362                 ;;
15363         esac
15364 fi
15365
15366 : in case they want portability, strip down executable paths
15367 case "$d_portable" in
15368 "$define")
15369         echo " "
15370         echo "Stripping down executable paths..." >&4
15371         for file in $loclist $trylist; do
15372                 eval temp=\$$file
15373                 eval $file=`basename $temp`
15374         done
15375         ;;
15376 esac
15377
15378 : create config.sh file
15379 echo " "
15380 echo "Creating config.sh..." >&4
15381 $spitshell <<EOT >config.sh
15382 $startsh
15383 #
15384 # This file was produced by running the Configure script. It holds all the
15385 # definitions figured out by Configure. Should you modify one of these values,
15386 # do not forget to propagate your changes by running "Configure -der". You may
15387 # instead choose to run each of the .SH files by yourself, or "Configure -S".
15388 #
15389
15390 # Package name      : $package
15391 # Source directory  : $src
15392 # Configuration time: $cf_time
15393 # Configured by     : $cf_by
15394 # Target system     : $myuname
15395
15396 Author='$Author'
15397 Date='$Date'
15398 Header='$Header'
15399 Id='$Id'
15400 Locker='$Locker'
15401 Log='$Log'
15402 Mcc='$Mcc'
15403 RCSfile='$RCSfile'
15404 Revision='$Revision'
15405 Source='$Source'
15406 State='$State'
15407 _a='$_a'
15408 _exe='$_exe'
15409 _o='$_o'
15410 afs='$afs'
15411 alignbytes='$alignbytes'
15412 ansi2knr='$ansi2knr'
15413 aphostname='$aphostname'
15414 api_revision='$api_revision'
15415 api_subversion='$api_subversion'
15416 api_version='$api_version'
15417 api_versionstring='$api_versionstring'
15418 ar='$ar'
15419 archlib='$archlib'
15420 archlibexp='$archlibexp'
15421 archname64='$archname64'
15422 archname='$archname'
15423 archobjs='$archobjs'
15424 awk='$awk'
15425 baserev='$baserev'
15426 bash='$bash'
15427 bin='$bin'
15428 bincompat5005='$bincompat5005'
15429 binexp='$binexp'
15430 bison='$bison'
15431 byacc='$byacc'
15432 byteorder='$byteorder'
15433 c='$c'
15434 castflags='$castflags'
15435 cat='$cat'
15436 cc='$cc'
15437 cccdlflags='$cccdlflags'
15438 ccdlflags='$ccdlflags'
15439 ccflags='$ccflags'
15440 ccflags_uselargefiles='$ccflags_uselargefiles'
15441 ccname='$ccname'
15442 ccsymbols='$ccsymbols'
15443 ccversion='$ccversion'
15444 cf_by='$cf_by'
15445 cf_email='$cf_email'
15446 cf_time='$cf_time'
15447 charsize='$charsize'
15448 chgrp='$chgrp'
15449 chmod='$chmod'
15450 chown='$chown'
15451 clocktype='$clocktype'
15452 comm='$comm'
15453 compress='$compress'
15454 contains='$contains'
15455 cp='$cp'
15456 cpio='$cpio'
15457 cpp='$cpp'
15458 cpp_stuff='$cpp_stuff'
15459 cppccsymbols='$cppccsymbols'
15460 cppflags='$cppflags'
15461 cpplast='$cpplast'
15462 cppminus='$cppminus'
15463 cpprun='$cpprun'
15464 cppstdin='$cppstdin'
15465 cppsymbols='$cppsymbols'
15466 crosscompile='$crosscompile'
15467 cryptlib='$cryptlib'
15468 csh='$csh'
15469 d_Gconvert='$d_Gconvert'
15470 d_PRIEUldbl='$d_PRIEUldbl'
15471 d_PRIFUldbl='$d_PRIFUldbl'
15472 d_PRIGUldbl='$d_PRIGUldbl'
15473 d_PRIXU64='$d_PRIXU64'
15474 d_PRId64='$d_PRId64'
15475 d_PRIeldbl='$d_PRIeldbl'
15476 d_PRIfldbl='$d_PRIfldbl'
15477 d_PRIgldbl='$d_PRIgldbl'
15478 d_PRIi64='$d_PRIi64'
15479 d_PRIo64='$d_PRIo64'
15480 d_PRIu64='$d_PRIu64'
15481 d_PRIx64='$d_PRIx64'
15482 d_SCNfldbl='$d_SCNfldbl'
15483 d_access='$d_access'
15484 d_accessx='$d_accessx'
15485 d_alarm='$d_alarm'
15486 d_archlib='$d_archlib'
15487 d_atolf='$d_atolf'
15488 d_atoll='$d_atoll'
15489 d_attribut='$d_attribut'
15490 d_bcmp='$d_bcmp'
15491 d_bcopy='$d_bcopy'
15492 d_bincompat5005='$d_bincompat5005'
15493 d_bsd='$d_bsd'
15494 d_bsdgetpgrp='$d_bsdgetpgrp'
15495 d_bsdsetpgrp='$d_bsdsetpgrp'
15496 d_bzero='$d_bzero'
15497 d_casti32='$d_casti32'
15498 d_castneg='$d_castneg'
15499 d_charvspr='$d_charvspr'
15500 d_chown='$d_chown'
15501 d_chroot='$d_chroot'
15502 d_chsize='$d_chsize'
15503 d_closedir='$d_closedir'
15504 d_const='$d_const'
15505 d_crypt='$d_crypt'
15506 d_csh='$d_csh'
15507 d_cuserid='$d_cuserid'
15508 d_dbl_dig='$d_dbl_dig'
15509 d_difftime='$d_difftime'
15510 d_dirnamlen='$d_dirnamlen'
15511 d_dlerror='$d_dlerror'
15512 d_dlopen='$d_dlopen'
15513 d_dlsymun='$d_dlsymun'
15514 d_dosuid='$d_dosuid'
15515 d_drand48proto='$d_drand48proto'
15516 d_dup2='$d_dup2'
15517 d_eaccess='$d_eaccess'
15518 d_endgrent='$d_endgrent'
15519 d_endhent='$d_endhent'
15520 d_endnent='$d_endnent'
15521 d_endpent='$d_endpent'
15522 d_endpwent='$d_endpwent'
15523 d_endsent='$d_endsent'
15524 d_eofnblk='$d_eofnblk'
15525 d_eunice='$d_eunice'
15526 d_fchmod='$d_fchmod'
15527 d_fchown='$d_fchown'
15528 d_fcntl='$d_fcntl'
15529 d_fd_macros='$d_fd_macros'
15530 d_fd_set='$d_fd_set'
15531 d_fds_bits='$d_fds_bits'
15532 d_fgetpos='$d_fgetpos'
15533 d_flexfnam='$d_flexfnam'
15534 d_flock='$d_flock'
15535 d_fork='$d_fork'
15536 d_fpathconf='$d_fpathconf'
15537 d_fpos64_t='$d_fpos64_t'
15538 d_frexpl='$d_frexpl'
15539 d_fs_data_s='$d_fs_data_s'
15540 d_fseeko='$d_fseeko'
15541 d_fsetpos='$d_fsetpos'
15542 d_fstatfs='$d_fstatfs'
15543 d_fstatvfs='$d_fstatvfs'
15544 d_ftello='$d_ftello'
15545 d_ftime='$d_ftime'
15546 d_getcwd='$d_getcwd'
15547 d_getespwnam='$d_getespwnam'
15548 d_getfsstat='$d_getfsstat'
15549 d_getgrent='$d_getgrent'
15550 d_getgrps='$d_getgrps'
15551 d_gethbyaddr='$d_gethbyaddr'
15552 d_gethbyname='$d_gethbyname'
15553 d_gethent='$d_gethent'
15554 d_gethname='$d_gethname'
15555 d_gethostprotos='$d_gethostprotos'
15556 d_getlogin='$d_getlogin'
15557 d_getmnt='$d_getmnt'
15558 d_getmntent='$d_getmntent'
15559 d_getnbyaddr='$d_getnbyaddr'
15560 d_getnbyname='$d_getnbyname'
15561 d_getnent='$d_getnent'
15562 d_getnetprotos='$d_getnetprotos'
15563 d_getpbyname='$d_getpbyname'
15564 d_getpbynumber='$d_getpbynumber'
15565 d_getpent='$d_getpent'
15566 d_getpgid='$d_getpgid'
15567 d_getpgrp2='$d_getpgrp2'
15568 d_getpgrp='$d_getpgrp'
15569 d_getppid='$d_getppid'
15570 d_getprior='$d_getprior'
15571 d_getprotoprotos='$d_getprotoprotos'
15572 d_getprpwnam='$d_getprpwnam'
15573 d_getpwent='$d_getpwent'
15574 d_getsbyname='$d_getsbyname'
15575 d_getsbyport='$d_getsbyport'
15576 d_getsent='$d_getsent'
15577 d_getservprotos='$d_getservprotos'
15578 d_getspnam='$d_getspnam'
15579 d_gettimeod='$d_gettimeod'
15580 d_gnulibc='$d_gnulibc'
15581 d_grpasswd='$d_grpasswd'
15582 d_hasmntopt='$d_hasmntopt'
15583 d_htonl='$d_htonl'
15584 d_iconv='$d_iconv'
15585 d_index='$d_index'
15586 d_inetaton='$d_inetaton'
15587 d_int64_t='$d_int64_t'
15588 d_isascii='$d_isascii'
15589 d_isnan='$d_isnan'
15590 d_isnanl='$d_isnanl'
15591 d_killpg='$d_killpg'
15592 d_lchown='$d_lchown'
15593 d_ldbl_dig='$d_ldbl_dig'
15594 d_link='$d_link'
15595 d_locconv='$d_locconv'
15596 d_lockf='$d_lockf'
15597 d_longdbl='$d_longdbl'
15598 d_longlong='$d_longlong'
15599 d_lseekproto='$d_lseekproto'
15600 d_lstat='$d_lstat'
15601 d_madvise='$d_madvise'
15602 d_mblen='$d_mblen'
15603 d_mbstowcs='$d_mbstowcs'
15604 d_mbtowc='$d_mbtowc'
15605 d_memchr='$d_memchr'
15606 d_memcmp='$d_memcmp'
15607 d_memcpy='$d_memcpy'
15608 d_memmove='$d_memmove'
15609 d_memset='$d_memset'
15610 d_mkdir='$d_mkdir'
15611 d_mkdtemp='$d_mkdtemp'
15612 d_mkfifo='$d_mkfifo'
15613 d_mkstemp='$d_mkstemp'
15614 d_mkstemps='$d_mkstemps'
15615 d_mktime='$d_mktime'
15616 d_mmap='$d_mmap'
15617 d_modfl='$d_modfl'
15618 d_mprotect='$d_mprotect'
15619 d_msg='$d_msg'
15620 d_msg_ctrunc='$d_msg_ctrunc'
15621 d_msg_dontroute='$d_msg_dontroute'
15622 d_msg_oob='$d_msg_oob'
15623 d_msg_peek='$d_msg_peek'
15624 d_msg_proxy='$d_msg_proxy'
15625 d_msgctl='$d_msgctl'
15626 d_msgget='$d_msgget'
15627 d_msgrcv='$d_msgrcv'
15628 d_msgsnd='$d_msgsnd'
15629 d_msync='$d_msync'
15630 d_munmap='$d_munmap'
15631 d_mymalloc='$d_mymalloc'
15632 d_nice='$d_nice'
15633 d_nv_preserves_uv='$d_nv_preserves_uv'
15634 d_nv_preserves_uv_bits='$d_nv_preserves_uv_bits'
15635 d_off64_t='$d_off64_t'
15636 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
15637 d_oldpthreads='$d_oldpthreads'
15638 d_oldsock='$d_oldsock'
15639 d_open3='$d_open3'
15640 d_pathconf='$d_pathconf'
15641 d_pause='$d_pause'
15642 d_perl_otherlibdirs='$d_perl_otherlibdirs'
15643 d_phostname='$d_phostname'
15644 d_pipe='$d_pipe'
15645 d_poll='$d_poll'
15646 d_portable='$d_portable'
15647 d_pthread_yield='$d_pthread_yield'
15648 d_pwage='$d_pwage'
15649 d_pwchange='$d_pwchange'
15650 d_pwclass='$d_pwclass'
15651 d_pwcomment='$d_pwcomment'
15652 d_pwexpire='$d_pwexpire'
15653 d_pwgecos='$d_pwgecos'
15654 d_pwpasswd='$d_pwpasswd'
15655 d_pwquota='$d_pwquota'
15656 d_qgcvt='$d_qgcvt'
15657 d_quad='$d_quad'
15658 d_readdir='$d_readdir'
15659 d_readlink='$d_readlink'
15660 d_rename='$d_rename'
15661 d_rewinddir='$d_rewinddir'
15662 d_rmdir='$d_rmdir'
15663 d_safebcpy='$d_safebcpy'
15664 d_safemcpy='$d_safemcpy'
15665 d_sanemcmp='$d_sanemcmp'
15666 d_sched_yield='$d_sched_yield'
15667 d_scm_rights='$d_scm_rights'
15668 d_seekdir='$d_seekdir'
15669 d_select='$d_select'
15670 d_sem='$d_sem'
15671 d_semctl='$d_semctl'
15672 d_semctl_semid_ds='$d_semctl_semid_ds'
15673 d_semctl_semun='$d_semctl_semun'
15674 d_semget='$d_semget'
15675 d_semop='$d_semop'
15676 d_setegid='$d_setegid'
15677 d_seteuid='$d_seteuid'
15678 d_setgrent='$d_setgrent'
15679 d_setgrps='$d_setgrps'
15680 d_sethent='$d_sethent'
15681 d_setlinebuf='$d_setlinebuf'
15682 d_setlocale='$d_setlocale'
15683 d_setnent='$d_setnent'
15684 d_setpent='$d_setpent'
15685 d_setpgid='$d_setpgid'
15686 d_setpgrp2='$d_setpgrp2'
15687 d_setpgrp='$d_setpgrp'
15688 d_setprior='$d_setprior'
15689 d_setproctitle='$d_setproctitle'
15690 d_setpwent='$d_setpwent'
15691 d_setregid='$d_setregid'
15692 d_setresgid='$d_setresgid'
15693 d_setresuid='$d_setresuid'
15694 d_setreuid='$d_setreuid'
15695 d_setrgid='$d_setrgid'
15696 d_setruid='$d_setruid'
15697 d_setsent='$d_setsent'
15698 d_setsid='$d_setsid'
15699 d_setvbuf='$d_setvbuf'
15700 d_sfio='$d_sfio'
15701 d_shm='$d_shm'
15702 d_shmat='$d_shmat'
15703 d_shmatprototype='$d_shmatprototype'
15704 d_shmctl='$d_shmctl'
15705 d_shmdt='$d_shmdt'
15706 d_shmget='$d_shmget'
15707 d_sigaction='$d_sigaction'
15708 d_sigsetjmp='$d_sigsetjmp'
15709 d_socket='$d_socket'
15710 d_socklen_t='$d_socklen_t'
15711 d_sockpair='$d_sockpair'
15712 d_socks5_init='$d_socks5_init'
15713 d_sqrtl='$d_sqrtl'
15714 d_statblks='$d_statblks'
15715 d_statfs_f_flags='$d_statfs_f_flags'
15716 d_statfs_s='$d_statfs_s'
15717 d_statvfs='$d_statvfs'
15718 d_stdio_cnt_lval='$d_stdio_cnt_lval'
15719 d_stdio_ptr_lval='$d_stdio_ptr_lval'
15720 d_stdio_stream_array='$d_stdio_stream_array'
15721 d_stdiobase='$d_stdiobase'
15722 d_stdstdio='$d_stdstdio'
15723 d_strchr='$d_strchr'
15724 d_strcoll='$d_strcoll'
15725 d_strctcpy='$d_strctcpy'
15726 d_strerrm='$d_strerrm'
15727 d_strerror='$d_strerror'
15728 d_strtod='$d_strtod'
15729 d_strtol='$d_strtol'
15730 d_strtold='$d_strtold'
15731 d_strtoll='$d_strtoll'
15732 d_strtoul='$d_strtoul'
15733 d_strtoull='$d_strtoull'
15734 d_strtouq='$d_strtouq'
15735 d_strxfrm='$d_strxfrm'
15736 d_suidsafe='$d_suidsafe'
15737 d_symlink='$d_symlink'
15738 d_syscall='$d_syscall'
15739 d_sysconf='$d_sysconf'
15740 d_sysernlst='$d_sysernlst'
15741 d_syserrlst='$d_syserrlst'
15742 d_system='$d_system'
15743 d_tcgetpgrp='$d_tcgetpgrp'
15744 d_tcsetpgrp='$d_tcsetpgrp'
15745 d_telldir='$d_telldir'
15746 d_telldirproto='$d_telldirproto'
15747 d_time='$d_time'
15748 d_times='$d_times'
15749 d_truncate='$d_truncate'
15750 d_tzname='$d_tzname'
15751 d_umask='$d_umask'
15752 d_uname='$d_uname'
15753 d_union_semun='$d_union_semun'
15754 d_ustat='$d_ustat'
15755 d_vendorarch='$d_vendorarch'
15756 d_vendorbin='$d_vendorbin'
15757 d_vendorlib='$d_vendorlib'
15758 d_vfork='$d_vfork'
15759 d_void_closedir='$d_void_closedir'
15760 d_voidsig='$d_voidsig'
15761 d_voidtty='$d_voidtty'
15762 d_volatile='$d_volatile'
15763 d_vprintf='$d_vprintf'
15764 d_wait4='$d_wait4'
15765 d_waitpid='$d_waitpid'
15766 d_wcstombs='$d_wcstombs'
15767 d_wctomb='$d_wctomb'
15768 d_xenix='$d_xenix'
15769 date='$date'
15770 db_hashtype='$db_hashtype'
15771 db_prefixtype='$db_prefixtype'
15772 defvoidused='$defvoidused'
15773 direntrytype='$direntrytype'
15774 dlext='$dlext'
15775 dlsrc='$dlsrc'
15776 doublesize='$doublesize'
15777 drand01='$drand01'
15778 dynamic_ext='$dynamic_ext'
15779 eagain='$eagain'
15780 ebcdic='$ebcdic'
15781 echo='$echo'
15782 egrep='$egrep'
15783 emacs='$emacs'
15784 eunicefix='$eunicefix'
15785 exe_ext='$exe_ext'
15786 expr='$expr'
15787 extensions='$extensions'
15788 fflushNULL='$fflushNULL'
15789 fflushall='$fflushall'
15790 find='$find'
15791 firstmakefile='$firstmakefile'
15792 flex='$flex'
15793 fpossize='$fpossize'
15794 fpostype='$fpostype'
15795 freetype='$freetype'
15796 full_ar='$full_ar'
15797 full_csh='$full_csh'
15798 full_sed='$full_sed'
15799 gccosandvers='$gccosandvers'
15800 gccversion='$gccversion'
15801 gidformat='$gidformat'
15802 gidsign='$gidsign'
15803 gidsize='$gidsize'
15804 gidtype='$gidtype'
15805 glibpth='$glibpth'
15806 grep='$grep'
15807 groupcat='$groupcat'
15808 groupstype='$groupstype'
15809 gzip='$gzip'
15810 h_fcntl='$h_fcntl'
15811 h_sysfile='$h_sysfile'
15812 hint='$hint'
15813 hostcat='$hostcat'
15814 huge='$huge'
15815 i16size='$i16size'
15816 i16type='$i16type'
15817 i32size='$i32size'
15818 i32type='$i32type'
15819 i64size='$i64size'
15820 i64type='$i64type'
15821 i8size='$i8size'
15822 i8type='$i8type'
15823 i_arpainet='$i_arpainet'
15824 i_bsdioctl='$i_bsdioctl'
15825 i_db='$i_db'
15826 i_dbm='$i_dbm'
15827 i_dirent='$i_dirent'
15828 i_dld='$i_dld'
15829 i_dlfcn='$i_dlfcn'
15830 i_fcntl='$i_fcntl'
15831 i_float='$i_float'
15832 i_gdbm='$i_gdbm'
15833 i_grp='$i_grp'
15834 i_iconv='$i_iconv'
15835 i_ieeefp='$i_ieeefp'
15836 i_inttypes='$i_inttypes'
15837 i_libutil='$i_libutil'
15838 i_limits='$i_limits'
15839 i_locale='$i_locale'
15840 i_machcthr='$i_machcthr'
15841 i_malloc='$i_malloc'
15842 i_math='$i_math'
15843 i_memory='$i_memory'
15844 i_mntent='$i_mntent'
15845 i_ndbm='$i_ndbm'
15846 i_netdb='$i_netdb'
15847 i_neterrno='$i_neterrno'
15848 i_netinettcp='$i_netinettcp'
15849 i_niin='$i_niin'
15850 i_poll='$i_poll'
15851 i_prot='$i_prot'
15852 i_pthread='$i_pthread'
15853 i_pwd='$i_pwd'
15854 i_rpcsvcdbm='$i_rpcsvcdbm'
15855 i_sfio='$i_sfio'
15856 i_sgtty='$i_sgtty'
15857 i_shadow='$i_shadow'
15858 i_socks='$i_socks'
15859 i_stdarg='$i_stdarg'
15860 i_stddef='$i_stddef'
15861 i_stdlib='$i_stdlib'
15862 i_string='$i_string'
15863 i_sunmath='$i_sunmath'
15864 i_sysaccess='$i_sysaccess'
15865 i_sysdir='$i_sysdir'
15866 i_sysfile='$i_sysfile'
15867 i_sysfilio='$i_sysfilio'
15868 i_sysin='$i_sysin'
15869 i_sysioctl='$i_sysioctl'
15870 i_syslog='$i_syslog'
15871 i_sysmman='$i_sysmman'
15872 i_sysmode='$i_sysmode'
15873 i_sysmount='$i_sysmount'
15874 i_sysndir='$i_sysndir'
15875 i_sysparam='$i_sysparam'
15876 i_sysresrc='$i_sysresrc'
15877 i_syssecrt='$i_syssecrt'
15878 i_sysselct='$i_sysselct'
15879 i_syssockio='$i_syssockio'
15880 i_sysstat='$i_sysstat'
15881 i_sysstatfs='$i_sysstatfs'
15882 i_sysstatvfs='$i_sysstatvfs'
15883 i_systime='$i_systime'
15884 i_systimek='$i_systimek'
15885 i_systimes='$i_systimes'
15886 i_systypes='$i_systypes'
15887 i_sysuio='$i_sysuio'
15888 i_sysun='$i_sysun'
15889 i_sysutsname='$i_sysutsname'
15890 i_sysvfs='$i_sysvfs'
15891 i_syswait='$i_syswait'
15892 i_termio='$i_termio'
15893 i_termios='$i_termios'
15894 i_time='$i_time'
15895 i_unistd='$i_unistd'
15896 i_ustat='$i_ustat'
15897 i_utime='$i_utime'
15898 i_values='$i_values'
15899 i_varargs='$i_varargs'
15900 i_varhdr='$i_varhdr'
15901 i_vfork='$i_vfork'
15902 ignore_versioned_solibs='$ignore_versioned_solibs'
15903 inc_version_list='$inc_version_list'
15904 inc_version_list_init='$inc_version_list_init'
15905 incpath='$incpath'
15906 inews='$inews'
15907 installarchlib='$installarchlib'
15908 installbin='$installbin'
15909 installman1dir='$installman1dir'
15910 installman3dir='$installman3dir'
15911 installprefix='$installprefix'
15912 installprefixexp='$installprefixexp'
15913 installprivlib='$installprivlib'
15914 installscript='$installscript'
15915 installsitearch='$installsitearch'
15916 installsitebin='$installsitebin'
15917 installsitelib='$installsitelib'
15918 installstyle='$installstyle'
15919 installusrbinperl='$installusrbinperl'
15920 installvendorarch='$installvendorarch'
15921 installvendorbin='$installvendorbin'
15922 installvendorlib='$installvendorlib'
15923 intsize='$intsize'
15924 ivdformat='$ivdformat'
15925 ivsize='$ivsize'
15926 ivtype='$ivtype'
15927 known_extensions='$known_extensions'
15928 ksh='$ksh'
15929 large='$large'
15930 ld='$ld'
15931 lddlflags='$lddlflags'
15932 ldflags='$ldflags'
15933 ldflags_uselargefiles='$ldflags_uselargefiles'
15934 ldlibpthname='$ldlibpthname'
15935 less='$less'
15936 lib_ext='$lib_ext'
15937 libc='$libc'
15938 libperl='$libperl'
15939 libpth='$libpth'
15940 libs='$libs'
15941 libsdirs='$libsdirs'
15942 libsfiles='$libsfiles'
15943 libsfound='$libsfound'
15944 libspath='$libspath'
15945 libswanted='$libswanted'
15946 libswanted_uselargefiles='$libswanted_uselargefiles'
15947 line='$line'
15948 lint='$lint'
15949 lkflags='$lkflags'
15950 ln='$ln'
15951 lns='$lns'
15952 locincpth='$locincpth'
15953 loclibpth='$loclibpth'
15954 longdblsize='$longdblsize'
15955 longlongsize='$longlongsize'
15956 longsize='$longsize'
15957 lp='$lp'
15958 lpr='$lpr'
15959 ls='$ls'
15960 lseeksize='$lseeksize'
15961 lseektype='$lseektype'
15962 mail='$mail'
15963 mailx='$mailx'
15964 make='$make'
15965 make_set_make='$make_set_make'
15966 mallocobj='$mallocobj'
15967 mallocsrc='$mallocsrc'
15968 malloctype='$malloctype'
15969 man1dir='$man1dir'
15970 man1direxp='$man1direxp'
15971 man1ext='$man1ext'
15972 man3dir='$man3dir'
15973 man3direxp='$man3direxp'
15974 man3ext='$man3ext'
15975 medium='$medium'
15976 mips_type='$mips_type'
15977 mkdir='$mkdir'
15978 mmaptype='$mmaptype'
15979 models='$models'
15980 modetype='$modetype'
15981 more='$more'
15982 multiarch='$multiarch'
15983 mv='$mv'
15984 myarchname='$myarchname'
15985 mydomain='$mydomain'
15986 myhostname='$myhostname'
15987 myuname='$myuname'
15988 n='$n'
15989 netdb_hlen_type='$netdb_hlen_type'
15990 netdb_host_type='$netdb_host_type'
15991 netdb_name_type='$netdb_name_type'
15992 netdb_net_type='$netdb_net_type'
15993 nm='$nm'
15994 nm_opt='$nm_opt'
15995 nm_so_opt='$nm_so_opt'
15996 nonxs_ext='$nonxs_ext'
15997 nroff='$nroff'
15998 nvEUformat='$nvEUformat'
15999 nvFUformat='$nvFUformat'
16000 nvGUformat='$nvGUformat'
16001 nveformat='$nveformat'
16002 nvfformat='$nvfformat'
16003 nvgformat='$nvgformat'
16004 nvsize='$nvsize'
16005 nvtype='$nvtype'
16006 o_nonblock='$o_nonblock'
16007 obj_ext='$obj_ext'
16008 old_pthread_create_joinable='$old_pthread_create_joinable'
16009 optimize='$optimize'
16010 orderlib='$orderlib'
16011 osname='$osname'
16012 osvers='$osvers'
16013 otherlibdirs='$otherlibdirs'
16014 package='$package'
16015 pager='$pager'
16016 passcat='$passcat'
16017 patchlevel='$patchlevel'
16018 path_sep='$path_sep'
16019 perl5='$perl5'
16020 perl='$perl'
16021 perladmin='$perladmin'
16022 perlpath='$perlpath'
16023 pg='$pg'
16024 phostname='$phostname'
16025 pidtype='$pidtype'
16026 plibpth='$plibpth'
16027 pm_apiversion='$pm_apiversion'
16028 pmake='$pmake'
16029 pr='$pr'
16030 prefix='$prefix'
16031 prefixexp='$prefixexp'
16032 privlib='$privlib'
16033 privlibexp='$privlibexp'
16034 prototype='$prototype'
16035 ptrsize='$ptrsize'
16036 quadkind='$quadkind'
16037 quadtype='$quadtype'
16038 randbits='$randbits'
16039 randfunc='$randfunc'
16040 randseedtype='$randseedtype'
16041 ranlib='$ranlib'
16042 rd_nodata='$rd_nodata'
16043 revision='$revision'
16044 rm='$rm'
16045 rmail='$rmail'
16046 runnm='$runnm'
16047 sPRIEUldbl='$sPRIEUldbl'
16048 sPRIFUldbl='$sPRIFUldbl'
16049 sPRIGUldbl='$sPRIGUldbl'
16050 sPRIXU64='$sPRIXU64'
16051 sPRId64='$sPRId64'
16052 sPRIeldbl='$sPRIeldbl'
16053 sPRIfldbl='$sPRIfldbl'
16054 sPRIgldbl='$sPRIgldbl'
16055 sPRIi64='$sPRIi64'
16056 sPRIo64='$sPRIo64'
16057 sPRIu64='$sPRIu64'
16058 sPRIx64='$sPRIx64'
16059 sSCNfldbl='$sSCNfldbl'
16060 sched_yield='$sched_yield'
16061 scriptdir='$scriptdir'
16062 scriptdirexp='$scriptdirexp'
16063 sed='$sed'
16064 seedfunc='$seedfunc'
16065 selectminbits='$selectminbits'
16066 selecttype='$selecttype'
16067 sendmail='$sendmail'
16068 sh='$sh'
16069 shar='$shar'
16070 sharpbang='$sharpbang'
16071 shmattype='$shmattype'
16072 shortsize='$shortsize'
16073 shrpenv='$shrpenv'
16074 shsharp='$shsharp'
16075 sig_count='$sig_count'
16076 sig_name='$sig_name'
16077 sig_name_init='$sig_name_init'
16078 sig_num='$sig_num'
16079 sig_num_init='$sig_num_init'
16080 signal_t='$signal_t'
16081 sitearch='$sitearch'
16082 sitearchexp='$sitearchexp'
16083 sitebin='$sitebin'
16084 sitebinexp='$sitebinexp'
16085 sitelib='$sitelib'
16086 sitelib_stem='$sitelib_stem'
16087 sitelibexp='$sitelibexp'
16088 siteprefix='$siteprefix'
16089 siteprefixexp='$siteprefixexp'
16090 sizesize='$sizesize'
16091 sizetype='$sizetype'
16092 sleep='$sleep'
16093 smail='$smail'
16094 small='$small'
16095 so='$so'
16096 sockethdr='$sockethdr'
16097 socketlib='$socketlib'
16098 socksizetype='$socksizetype'
16099 sort='$sort'
16100 spackage='$spackage'
16101 spitshell='$spitshell'
16102 split='$split'
16103 src='$src'
16104 ssizetype='$ssizetype'
16105 startperl='$startperl'
16106 startsh='$startsh'
16107 static_ext='$static_ext'
16108 stdchar='$stdchar'
16109 stdio_base='$stdio_base'
16110 stdio_bufsiz='$stdio_bufsiz'
16111 stdio_cnt='$stdio_cnt'
16112 stdio_filbuf='$stdio_filbuf'
16113 stdio_ptr='$stdio_ptr'
16114 stdio_stream_array='$stdio_stream_array'
16115 strings='$strings'
16116 submit='$submit'
16117 subversion='$subversion'
16118 sysman='$sysman'
16119 tail='$tail'
16120 tar='$tar'
16121 tbl='$tbl'
16122 tee='$tee'
16123 test='$test'
16124 timeincl='$timeincl'
16125 timetype='$timetype'
16126 touch='$touch'
16127 tr='$tr'
16128 trnl='$trnl'
16129 troff='$troff'
16130 u16size='$u16size'
16131 u16type='$u16type'
16132 u32size='$u32size'
16133 u32type='$u32type'
16134 u64size='$u64size'
16135 u64type='$u64type'
16136 u8size='$u8size'
16137 u8type='$u8type'
16138 uidformat='$uidformat'
16139 uidsign='$uidsign'
16140 uidsize='$uidsize'
16141 uidtype='$uidtype'
16142 uname='$uname'
16143 uniq='$uniq'
16144 uquadtype='$uquadtype'
16145 use5005threads='$use5005threads'
16146 use64bitall='$use64bitall'
16147 use64bitint='$use64bitint'
16148 usedl='$usedl'
16149 useithreads='$useithreads'
16150 uselargefiles='$uselargefiles'
16151 uselongdouble='$uselongdouble'
16152 usemorebits='$usemorebits'
16153 usemultiplicity='$usemultiplicity'
16154 usemymalloc='$usemymalloc'
16155 usenm='$usenm'
16156 useopcode='$useopcode'
16157 useperlio='$useperlio'
16158 useposix='$useposix'
16159 usesfio='$usesfio'
16160 useshrplib='$useshrplib'
16161 usesocks='$usesocks'
16162 usethreads='$usethreads'
16163 usevendorprefix='$usevendorprefix'
16164 usevfork='$usevfork'
16165 usrinc='$usrinc'
16166 uuname='$uuname'
16167 uvXUformat='$uvXUformat'
16168 uvoformat='$uvoformat'
16169 uvsize='$uvsize'
16170 uvtype='$uvtype'
16171 uvuformat='$uvuformat'
16172 uvxformat='$uvxformat'
16173 vendorarch='$vendorarch'
16174 vendorarchexp='$vendorarchexp'
16175 vendorbin='$vendorbin'
16176 vendorbinexp='$vendorbinexp'
16177 vendorlib='$vendorlib'
16178 vendorlib_stem='$vendorlib_stem'
16179 vendorlibexp='$vendorlibexp'
16180 vendorprefix='$vendorprefix'
16181 vendorprefixexp='$vendorprefixexp'
16182 version='$version'
16183 vi='$vi'
16184 voidflags='$voidflags'
16185 xlibpth='$xlibpth'
16186 xs_apiversion='$xs_apiversion'
16187 zcat='$zcat'
16188 zip='$zip'
16189 EOT
16190
16191 : Add in command line options if available
16192 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
16193
16194 : add special variables
16195 $test -f $src/patchlevel.h && \
16196 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
16197 echo "CONFIGDOTSH=true" >>config.sh
16198
16199 : propagate old symbols
16200 if $test -f UU/config.sh; then
16201         <UU/config.sh sort | uniq >UU/oldconfig.sh
16202         sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
16203         sort | uniq -u >UU/oldsyms
16204         set X `cat UU/oldsyms`
16205         shift
16206         case $# in
16207         0) ;;
16208         *)
16209                 cat <<EOM
16210 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
16211 EOM
16212                 echo "# Variables propagated from previous config.sh file." >>config.sh
16213                 for sym in `cat UU/oldsyms`; do
16214                         echo "    Propagating $hint variable "'$'"$sym..."
16215                         eval 'tmp="$'"${sym}"'"'
16216                         echo "$tmp" | \
16217                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
16218                 done
16219                 ;;
16220         esac
16221 fi
16222
16223 : Finish up by extracting the .SH files
16224 case "$alldone" in
16225 exit)
16226         $rm -rf UU
16227         echo "Done."
16228         exit 0
16229         ;;
16230 cont)
16231         ;;
16232 '')
16233         dflt=''
16234         nostick=true
16235         $cat <<EOM
16236
16237 If you'd like to make any changes to the config.sh file before I begin
16238 to configure things, do it as a shell escape now (e.g. !vi config.sh).
16239
16240 EOM
16241         rp="Press return or use a shell escape to edit config.sh:"
16242         . UU/myread
16243         nostick=''
16244         case "$ans" in
16245         '') ;;
16246         *) : in case they cannot read
16247                 sh 1>&4 -c "$ans";;
16248         esac
16249         ;;
16250 esac
16251
16252 : if this fails, just run all the .SH files by hand
16253 . ./config.sh
16254
16255 echo " "
16256 exec 1>&4
16257 . ./UU/extract
16258
16259 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
16260         dflt=y
16261         case "$silent" in
16262         true) ;;
16263         *)
16264                 $cat <<EOM
16265
16266 Now you need to generate make dependencies by running "$make depend".
16267 You might prefer to run it in background: "$make depend > makedepend.out &"
16268 It can take a while, so you might not want to run it right now.
16269
16270 EOM
16271                 ;;
16272         esac
16273         rp="Run $make depend now?"
16274         . UU/myread
16275         case "$ans" in
16276         y*)
16277                 $make depend && echo "Now you must run '$make'."
16278                 ;;
16279         *)
16280                 echo "You must run '$make depend' then '$make'."
16281                 ;;
16282         esac
16283 elif test -f [Mm]akefile; then
16284         echo " "
16285         echo "Now you must run a $make."
16286 else
16287         echo "Done."
16288 fi
16289
16290 if $test -f Policy.sh; then
16291     $cat <<EOM
16292
16293 If you compile $package on a different machine or from a different object
16294 directory, copy the Policy.sh file from this object directory to the
16295 new one before you run Configure -- this will help you with most of
16296 the policy defaults.
16297
16298 EOM
16299 fi
16300 if $test -f config.msg; then
16301     echo "Hmm.  I also noted the following information while running:"
16302     echo " "
16303     $cat config.msg >&4
16304     $rm -f config.msg
16305 fi
16306 $rm -f kit*isdone ark*isdone
16307 $rm -rf UU
16308
16309 : End of Configure
16310