This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Re: Solaris x86 has no SPARC libraries!
[perl5.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 Fri Sep  1 21:10:02 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 case "$p_" in
3116 :) ;;
3117 *)
3118         $cat <<'EOI'
3119 I have the feeling something is not exactly right, however...don't tell me...
3120 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
3121 EOI
3122         echo exit 0 >os2
3123         ;;
3124 esac
3125 if test -f /xenix; then
3126         echo "Actually, this looks more like a XENIX system..."
3127         echo exit 0 >xenix
3128         d_xenix="$define"
3129 else
3130         echo " "
3131         echo "It's not Xenix..."
3132         d_xenix="$undef"
3133 fi
3134 chmod +x xenix
3135 $eunicefix xenix
3136 if test -f /venix; then
3137         echo "Actually, this looks more like a VENIX system..."
3138         echo exit 0 >venix
3139 else
3140         echo " "
3141         if ./xenix; then
3142                 : null
3143         else
3144                 echo "Nor is it Venix..."
3145         fi
3146 fi
3147 chmod +x bsd usg v7 osf1 eunice xenix venix os2
3148 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
3149 $rm -f foo
3150
3151 : see if we need a special compiler
3152 echo " "
3153 if ./usg; then
3154         case "$cc" in
3155         '') case "$Mcc" in
3156                 /*) dflt='Mcc';;
3157                 *) case "$large" in
3158                         -M*) dflt='cc';;
3159                         *)      if $contains '\-M' $sysman/cc.1 >/dev/null 2>&1 ; then
3160                                         if $contains '\-M' $sysman/cpp.1 >/dev/null 2>&1; then
3161                                                 dflt='cc'
3162                                         else
3163                                                 dflt='cc -M'
3164                                         fi
3165                                 else
3166                                         dflt='cc'
3167                                 fi;;
3168                         esac;;
3169                 esac;;
3170         *)  dflt="$cc";;
3171         esac
3172         case "$dflt" in
3173         *M*)    $cat <<'EOM'
3174 On some older systems the default C compiler will not resolve multiple global
3175 references that happen to have the same name.  On some such systems the "Mcc"
3176 command may be used to force these to be resolved.  On other systems a "cc -M"
3177 command is required.  (Note that the -M flag on other systems indicates a
3178 memory model to use!) If you have the Gnu C compiler, you might wish to use
3179 that instead.
3180
3181 EOM
3182         ;;
3183         esac
3184         rp="Use which C compiler?"
3185         . ./myread
3186         cc="$ans"
3187 else
3188         case "$cc" in
3189         '') dflt=cc;;
3190         *) dflt="$cc";;
3191         esac
3192         rp="Use which C compiler?"
3193         . ./myread
3194         cc="$ans"
3195 fi
3196 : Look for a hint-file generated 'call-back-unit'.  Now that the
3197 : user has specified the compiler, we may need to set or change some
3198 : other defaults.
3199 if $test -f cc.cbu; then
3200     . ./cc.cbu
3201 fi
3202 . ./checkcc
3203
3204 echo " "
3205 echo "Checking for GNU cc in disguise and/or its version number..." >&4
3206 $cat >gccvers.c <<EOM
3207 #include <stdio.h>
3208 int main() {
3209 #ifdef __GNUC__
3210 #ifdef __VERSION__
3211         printf("%s\n", __VERSION__);
3212 #else
3213         printf("%s\n", "1");
3214 #endif
3215 #endif
3216         exit(0);
3217 }
3218 EOM
3219 if $cc $ldflags -o gccvers gccvers.c; then
3220         gccversion=`./gccvers`
3221         case "$gccversion" in
3222         '') echo "You are not using GNU cc." ;;
3223         *)  echo "You are using GNU cc $gccversion."
3224             ccname=gcc  
3225             ;;
3226         esac
3227 else
3228         echo " "
3229         echo "*** WHOA THERE!!! ***" >&4
3230         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
3231         case "$knowitall" in
3232         '')
3233         echo "    You'd better start hunting for one and let me know about it." >&4
3234                 exit 1
3235                 ;;
3236         esac
3237 fi
3238 $rm -f gccvers*
3239 case "$gccversion" in
3240 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
3241 esac
3242 case "$gccversion" in
3243 '') gccosandvers='' ;;
3244 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
3245    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
3246    gccshortvers=''
3247    case "$gccosandvers" in
3248    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
3249    $osname$osvers) ;; # looking good
3250    $osname*) cat <<EOM >&4
3251
3252 *** WHOA THERE!!! ***
3253
3254     Your gcc has not been compiled for the exact release of
3255     your operating system ($gccosandvers versus $osname$osvers).
3256
3257     In general it is a good idea to keep gcc synchronized with
3258     the operating system because otherwise serious problems
3259     may ensue when trying to compile software, like Perl.
3260
3261     I'm trying to be optimistic here, though, and will continue.
3262     If later during the configuration and build icky compilation
3263     problems appear (headerfile conflicts being the most common
3264     manifestation), I suggest reinstalling the gcc to match
3265     your operating system release.
3266
3267 EOM
3268       ;;
3269    *) gccosandvers='' ;; # failed to parse, better be silent
3270    esac
3271    ;;
3272 esac
3273 case "$ccname" in
3274 '') ccname="$cc" ;;
3275 esac
3276
3277 : see how we invoke the C preprocessor
3278 echo " "
3279 echo "Now, how can we feed standard input to your C preprocessor..." >&4
3280 cat <<'EOT' >testcpp.c
3281 #define ABC abc
3282 #define XYZ xyz
3283 ABC.XYZ
3284 EOT
3285 cd ..
3286 if test ! -f cppstdin; then
3287         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
3288                 # AIX cc -E doesn't show the absolute headerfile
3289                 # locations but we'll cheat by using the -M flag.
3290                 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
3291         else
3292                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
3293         fi
3294 else
3295         echo "Keeping your $hint cppstdin wrapper."
3296 fi
3297 chmod 755 cppstdin
3298 wrapper=`pwd`/cppstdin
3299 ok='false'
3300 cd UU
3301
3302 if $test "X$cppstdin" != "X" && \
3303         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
3304         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3305 then
3306         echo "You used to use $cppstdin $cppminus so we'll use that again."
3307         case "$cpprun" in
3308         '') echo "But let's see if we can live without a wrapper..." ;;
3309         *)
3310                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
3311                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3312                 then
3313                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
3314                         ok='true'
3315                 else
3316                         echo "(However, $cpprun $cpplast does not work, let's see...)"
3317                 fi
3318                 ;;
3319         esac
3320 else
3321         case "$cppstdin" in
3322         '') ;;
3323         *)
3324                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
3325                 ;;
3326         esac
3327 fi
3328
3329 if $ok; then
3330         : nothing
3331 elif echo 'Maybe "'"$cc"' -E" will work...'; \
3332         $cc -E <testcpp.c >testcpp.out 2>&1; \
3333         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3334         echo "Yup, it does."
3335         x_cpp="$cc -E"
3336         x_minus='';
3337 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
3338         $cc -E - <testcpp.c >testcpp.out 2>&1; \
3339         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3340         echo "Yup, it does."
3341         x_cpp="$cc -E"
3342         x_minus='-';
3343 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
3344         $cc -P <testcpp.c >testcpp.out 2>&1; \
3345         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3346         echo "Yipee, that works!"
3347         x_cpp="$cc -P"
3348         x_minus='';
3349 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
3350         $cc -P - <testcpp.c >testcpp.out 2>&1; \
3351         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3352         echo "At long last!"
3353         x_cpp="$cc -P"
3354         x_minus='-';
3355 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
3356         $cpp <testcpp.c >testcpp.out 2>&1; \
3357         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3358         echo "It works!"
3359         x_cpp="$cpp"
3360         x_minus='';
3361 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
3362         $cpp - <testcpp.c >testcpp.out 2>&1; \
3363         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3364         echo "Hooray, it works!  I was beginning to wonder."
3365         x_cpp="$cpp"
3366         x_minus='-';
3367 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
3368         $wrapper <testcpp.c >testcpp.out 2>&1; \
3369         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3370         x_cpp="$wrapper"
3371         x_minus=''
3372         echo "Eureka!"
3373 else
3374         dflt=''
3375         rp="No dice.  I can't find a C preprocessor.  Name one:"
3376         . ./myread
3377         x_cpp="$ans"
3378         x_minus=''
3379         $x_cpp <testcpp.c >testcpp.out 2>&1
3380         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3381                 echo "OK, that will do." >&4
3382         else
3383 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
3384                 exit 1
3385         fi
3386 fi
3387
3388 case "$ok" in
3389 false)
3390         cppstdin="$x_cpp"
3391         cppminus="$x_minus"
3392         cpprun="$x_cpp"
3393         cpplast="$x_minus"
3394         set X $x_cpp
3395         shift
3396         case "$1" in
3397         "$cpp")
3398                 echo "Perhaps can we force $cc -E using a wrapper..."
3399                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
3400                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3401                 then
3402                         echo "Yup, we can."
3403                         cppstdin="$wrapper"
3404                         cppminus='';
3405                 else
3406                         echo "Nope, we'll have to live without it..."
3407                 fi
3408                 ;;
3409         esac
3410         case "$cpprun" in
3411         "$wrapper")
3412                 cpprun=''
3413                 cpplast=''
3414                 ;;
3415         esac
3416         ;;
3417 esac
3418
3419 case "$cppstdin" in
3420 "$wrapper"|'cppstdin') ;;
3421 *) $rm -f $wrapper;;
3422 esac
3423 $rm -f testcpp.c testcpp.out
3424
3425 : decide how portable to be.  Allow command line overrides.
3426 case "$d_portable" in
3427 "$undef") ;;
3428 *)      d_portable="$define" ;;
3429 esac
3430
3431 : set up shell script to do ~ expansion
3432 cat >filexp <<EOSS
3433 $startsh
3434 : expand filename
3435 case "\$1" in
3436  ~/*|~)
3437         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3438         ;;
3439  ~*)
3440         if $test -f /bin/csh; then
3441                 /bin/csh -f -c "glob \$1"
3442                 failed=\$?
3443                 echo ""
3444                 exit \$failed
3445         else
3446                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3447                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3448                 if $test ! -d "\$dir"; then
3449                         me=\`basename \$0\`
3450                         echo "\$me: can't locate home directory for: \$name" >&2
3451                         exit 1
3452                 fi
3453                 case "\$1" in
3454                 */*)
3455                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3456                         ;;
3457                 *)
3458                         echo \$dir
3459                         ;;
3460                 esac
3461         fi
3462         ;;
3463 *)
3464         echo \$1
3465         ;;
3466 esac
3467 EOSS
3468 chmod +x filexp
3469 $eunicefix filexp
3470
3471 : now set up to get a file name
3472 cat <<EOS >getfile
3473 $startsh
3474 EOS
3475 cat <<'EOSC' >>getfile
3476 tilde=''
3477 fullpath=''
3478 already=''
3479 skip=''
3480 none_ok=''
3481 exp_file=''
3482 nopath_ok=''
3483 orig_rp="$rp"
3484 orig_dflt="$dflt"
3485 case "$gfpth" in
3486 '') gfpth='.' ;;
3487 esac
3488
3489 case "$fn" in
3490 *\(*)
3491         expr $fn : '.*(\(.*\)).*' | tr ',' $trnl >getfile.ok
3492         fn=`echo $fn | sed 's/(.*)//'`
3493         ;;
3494 esac
3495
3496 case "$fn" in
3497 *:*)
3498         loc_file=`expr $fn : '.*:\(.*\)'`
3499         fn=`expr $fn : '\(.*\):.*'`
3500         ;;
3501 esac
3502
3503 case "$fn" in
3504 *~*) tilde=true;;
3505 esac
3506 case "$fn" in
3507 */*) fullpath=true;;
3508 esac
3509 case "$fn" in
3510 *+*) skip=true;;
3511 esac
3512 case "$fn" in
3513 *n*) none_ok=true;;
3514 esac
3515 case "$fn" in
3516 *e*) exp_file=true;;
3517 esac
3518 case "$fn" in
3519 *p*) nopath_ok=true;;
3520 esac
3521
3522 case "$fn" in
3523 *f*) type='File';;
3524 *d*) type='Directory';;
3525 *l*) type='Locate';;
3526 esac
3527
3528 what="$type"
3529 case "$what" in
3530 Locate) what='File';;
3531 esac
3532
3533 case "$exp_file" in
3534 '')
3535         case "$d_portable" in
3536         "$define") ;;
3537         *) exp_file=true;;
3538         esac
3539         ;;
3540 esac
3541
3542 cd ..
3543 while test "$type"; do
3544         redo=''
3545         rp="$orig_rp"
3546         dflt="$orig_dflt"
3547         case "$tilde" in
3548         true) rp="$rp (~name ok)";;
3549         esac
3550         . UU/myread
3551         if test -f UU/getfile.ok && \
3552                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3553         then
3554                 value="$ans"
3555                 ansexp="$ans"
3556                 break
3557         fi
3558         case "$ans" in
3559         none)
3560                 value=''
3561                 ansexp=''
3562                 case "$none_ok" in
3563                 true) type='';;
3564                 esac
3565                 ;;
3566         *)
3567                 case "$tilde" in
3568                 '') value="$ans"
3569                         ansexp="$ans";;
3570                 *)
3571                         value=`UU/filexp $ans`
3572                         case $? in
3573                         0)
3574                                 if test "$ans" != "$value"; then
3575                                         echo "(That expands to $value on this system.)"
3576                                 fi
3577                                 ;;
3578                         *) value="$ans";;
3579                         esac
3580                         ansexp="$value"
3581                         case "$exp_file" in
3582                         '') value="$ans";;
3583                         esac
3584                         ;;
3585                 esac
3586                 case "$fullpath" in
3587                 true)
3588                         case "$ansexp" in
3589                         /*) value="$ansexp" ;;
3590                         [a-zA-Z]:/*) value="$ansexp" ;;
3591                         *)
3592                                 redo=true
3593                                 case "$already" in
3594                                 true)
3595                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
3596                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
3597                                         ;;
3598                                 *)
3599                                 echo "Please give a full path name, starting with slash." >&4
3600                                         case "$tilde" in
3601                                         true)
3602                                 echo "Note that using ~name is ok provided it expands well." >&4
3603                                                 already=true
3604                                                 ;;
3605                                         esac
3606                                 esac
3607                                 ;;
3608                         esac
3609                         ;;
3610                 esac
3611                 case "$redo" in
3612                 '')
3613                         case "$type" in
3614                         File)
3615                                 for fp in $gfpth; do
3616                                         if test "X$fp" = X.; then
3617                                             pf="$ansexp"
3618                                         else    
3619                                             pf="$fp/$ansexp"
3620                                         fi
3621                                         if test -f "$pf"; then
3622                                                 type=''
3623                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3624                                         then
3625                                                 echo "($value is not a plain file, but that's ok.)"
3626                                                 type=''
3627                                         fi
3628                                         if test X"$type" = X; then
3629                                             value="$pf"
3630                                             break
3631                                         fi
3632                                 done
3633                                 ;;
3634                         Directory)
3635                                 for fp in $gfpth; do
3636                                         if test "X$fp" = X.; then
3637                                             dir="$ans"
3638                                             direxp="$ansexp"
3639                                         else    
3640                                             dir="$fp/$ansexp"
3641                                             direxp="$fp/$ansexp"
3642                                         fi
3643                                         if test -d "$direxp"; then
3644                                                 type=''
3645                                                 value="$dir"
3646                                                 break
3647                                         fi
3648                                 done
3649                                 ;;
3650                         Locate)
3651                                 if test -d "$ansexp"; then
3652                                         echo "(Looking for $loc_file in directory $value.)"
3653                                         value="$value/$loc_file"
3654                                         ansexp="$ansexp/$loc_file"
3655                                 fi
3656                                 if test -f "$ansexp"; then
3657                                         type=''
3658                                 fi
3659                                 case "$nopath_ok" in
3660                                 true)   case "$value" in
3661                                         */*) ;;
3662                                         *)      echo "Assuming $value will be in people's path."
3663                                                 type=''
3664                                                 ;;
3665                                         esac
3666                                         ;;
3667                                 esac
3668                                 ;;
3669                         esac
3670
3671                         case "$skip" in
3672                         true) type='';
3673                         esac
3674
3675                         case "$type" in
3676                         '') ;;
3677                         *)
3678                                 if test "$fastread" = yes; then
3679                                         dflt=y
3680                                 else
3681                                         dflt=n
3682                                 fi
3683                                 rp="$what $value doesn't exist.  Use that name anyway?"
3684                                 . UU/myread
3685                                 dflt=''
3686                                 case "$ans" in
3687                                 y*) type='';;
3688                                 *) echo " ";;
3689                                 esac
3690                                 ;;
3691                         esac
3692                         ;;
3693                 esac
3694                 ;;
3695         esac
3696 done
3697 cd UU
3698 ans="$value"
3699 rp="$orig_rp"
3700 dflt="$orig_dflt"
3701 rm -f getfile.ok
3702 test "X$gfpthkeep" != Xy && gfpth=""
3703 EOSC
3704
3705 : What should the include directory be ?
3706 echo " "
3707 $echo $n "Hmm...  $c"
3708 dflt='/usr/include'
3709 incpath=''
3710 mips_type=''
3711 if $test -f /bin/mips && /bin/mips; then
3712         echo "Looks like a MIPS system..."
3713         $cat >usr.c <<'EOCP'
3714 #ifdef SYSTYPE_BSD43
3715 /bsd43
3716 #endif
3717 EOCP
3718         if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
3719                 dflt='/bsd43/usr/include'
3720                 incpath='/bsd43'
3721                 mips_type='BSD 4.3'
3722         else
3723                 mips_type='System V'
3724         fi
3725         $rm -f usr.c usr.out
3726         echo "and you're compiling with the $mips_type compiler and libraries."
3727         xxx_prompt=y
3728         echo "exit 0" >mips
3729 else
3730         echo "Doesn't look like a MIPS system."
3731         xxx_prompt=n
3732         echo "exit 1" >mips
3733 fi
3734 chmod +x mips
3735 $eunicefix mips
3736 case "$usrinc" in
3737 '') ;;
3738 *) dflt="$usrinc";;
3739 esac
3740 case "$xxx_prompt" in
3741 y)      fn=d/
3742         echo " "
3743         rp='Where are the include files you want to use?'
3744         . ./getfile
3745         usrinc="$ans"
3746         ;;
3747 *)      usrinc="$dflt"
3748         ;;
3749 esac
3750
3751 : Set private lib path
3752 case "$plibpth" in
3753 '') if ./mips; then
3754                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
3755         fi;;
3756 esac
3757 case "$libpth" in
3758 ' ') dlist='';;
3759 '') dlist="$loclibpth $plibpth $glibpth";;
3760 *) dlist="$libpth";;
3761 esac
3762
3763 : Now check and see which directories actually exist, avoiding duplicates
3764 libpth=''
3765 for xxx in $dlist
3766 do
3767     if $test -d $xxx; then
3768                 case " $libpth " in
3769                 *" $xxx "*) ;;
3770                 *) libpth="$libpth $xxx";;
3771                 esac
3772     fi
3773 done
3774 $cat <<'EOM'
3775
3776 Some systems have incompatible or broken versions of libraries.  Among
3777 the directories listed in the question below, please remove any you
3778 know not to be holding relevant libraries, and add any that are needed.
3779 Say "none" for none.
3780
3781 EOM
3782 case "$libpth" in
3783 '') dflt='none';;
3784 *)
3785         set X $libpth
3786         shift
3787         dflt=${1+"$@"}
3788         ;;
3789 esac
3790 rp="Directories to use for library searches?"
3791 . ./myread
3792 case "$ans" in
3793 none) libpth=' ';;
3794 *) libpth="$ans";;
3795 esac
3796
3797 : compute shared library extension
3798 case "$so" in
3799 '')
3800         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
3801                 dflt='sl'
3802         else
3803                 dflt='so'
3804         fi
3805         ;;
3806 *) dflt="$so";;
3807 esac
3808 $cat <<EOM
3809
3810 On some systems, shared libraries may be available.  Answer 'none' if
3811 you want to suppress searching of shared libraries for the remainder
3812 of this configuration.
3813
3814 EOM
3815 rp='What is the file extension used for shared libraries?'
3816 . ./myread
3817 so="$ans"
3818
3819 : Define several unixisms.
3820 : Hints files or command line option can be used to override them.
3821 : The convoluted testing is in case hints files set either the old
3822 : or the new name.
3823 case "$_exe" in
3824 '')     case "$exe_ext" in
3825     '') ;;
3826         *)      _exe="$exe_ext" ;;
3827         esac
3828         ;;
3829 esac
3830 case "$_a" in
3831 '')     case "$lib_ext" in
3832     '') _a='.a';;
3833         *)      _a="$lib_ext" ;;
3834         esac
3835         ;;
3836 esac
3837 case "$_o" in
3838 '') case "$obj_ext" in
3839         '')     _o='.o';;
3840         *)      _o="$obj_ext";;
3841         esac
3842         ;;
3843 esac
3844 case "$p_" in
3845 '') case "$path_sep" in
3846         '')     p_=':';;
3847         *)      p_="$path_sep";;
3848         esac
3849         ;;
3850 esac
3851 exe_ext=$_exe
3852 lib_ext=$_a
3853 obj_ext=$_o
3854 path_sep=$p_
3855
3856 : Which makefile gets called first.  This is used by make depend.
3857 case "$firstmakefile" in
3858 '') firstmakefile='makefile';;
3859 esac
3860
3861 case "$usesocks" in
3862 $define|true|[yY]*)     dflt='y';;
3863 *) dflt='n';;
3864 esac
3865 cat <<EOM
3866
3867 Perl can be built to use the SOCKS proxy protocol library.  To do so,
3868 Configure must be run with -Dusesocks.
3869
3870 If this doesn't make any sense to you, just accept the default '$dflt'.
3871 EOM
3872 rp='Build Perl for SOCKS?'
3873 . ./myread
3874 case "$ans" in
3875 y|Y)    val="$define" ;;     
3876 *)      val="$undef" ;;
3877 esac
3878 set usesocks
3879 eval $setvar
3880
3881 : Looking for optional libraries
3882 echo " "
3883 echo "Checking for optional libraries..." >&4
3884 case "$libs" in
3885 ' '|'') dflt='';;
3886 *) dflt="$libs";;
3887 esac
3888 case "$libswanted" in
3889 '') libswanted='c_s';;
3890 esac
3891 case "$usesocks" in
3892 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
3893 esac
3894 libsfound=''
3895 libsfiles=''
3896 libsdirs=''
3897 libspath=''
3898 for thisdir in $libpth $xlibpth; do
3899   test -d $thisdir && libspath="$libspath $thisdir"
3900 done
3901 for thislib in $libswanted; do
3902         for thisdir in $libspath; do
3903             xxx=''
3904             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
3905                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|tail -1`
3906                 $test -f "$xxx" && eval $libscheck
3907                 $test -f "$xxx" && libstyle=shared
3908             fi
3909             if test ! -f "$xxx"; then
3910                 xxx=$thisdir/lib$thislib.$so
3911                 $test -f "$xxx" && eval $libscheck
3912                 $test -f "$xxx" && libstyle=shared
3913             fi  
3914             if test ! -f "$xxx"; then
3915                 xxx=$thisdir/lib$thislib$_a
3916                 $test -f "$xxx" && eval $libscheck
3917                 $test -f "$xxx" && libstyle=static
3918             fi
3919             if test ! -f "$xxx"; then
3920                 xxx=$thisdir/$thislib$_a
3921                 $test -f "$xxx" && eval $libscheck
3922                 $test -f "$xxx" && libstyle=static
3923             fi
3924             if test ! -f "$xxx"; then
3925                 xxx=$thisdir/lib${thislib}_s$_a
3926                 $test -f "$xxx" && eval $libscheck
3927                 $test -f "$xxx" && libstyle=static
3928                 $test -f "$xxx" && thislib=${thislib}_s
3929             fi
3930             if test ! -f "$xxx"; then
3931                 xxx=$thisdir/Slib$thislib$_a
3932                 $test -f "$xxx" && eval $libscheck
3933                 $test -f "$xxx" && libstyle=static
3934             fi
3935             if $test -f "$xxx"; then
3936                 case "$libstyle" in
3937                 shared) echo "Found -l$thislib (shared)." ;;
3938                 static) echo "Found -l$thislib." ;;
3939                 *)      echo "Found -l$thislib ($libstyle)." ;;
3940                 esac
3941                 case " $dflt " in
3942                 *"-l$thislib "*);;
3943                 *) dflt="$dflt -l$thislib"
3944                    libsfound="$libsfound $xxx"
3945                    yyy=`basename $xxx`
3946                    libsfiles="$libsfiles $yyy"
3947                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
3948                    case " $libsdirs " in
3949                    *" $yyy "*) ;;
3950                    *) libsdirs="$libsdirs $yyy" ;;
3951                    esac
3952                    ;;
3953                 esac
3954                 break
3955             fi  
3956         done
3957         if $test ! -f "$xxx"; then
3958             echo "No -l$thislib."
3959         fi
3960 done
3961 set X $dflt
3962 shift
3963 dflt="$*"
3964 case "$libs" in
3965 '') dflt="$dflt";;
3966 *) dflt="$libs";;
3967 esac
3968 case "$dflt" in
3969 ' '|'') dflt='none';;
3970 esac
3971
3972 $cat <<EOM
3973
3974 In order to compile $package on your machine, a number of libraries
3975 are usually needed.  Include any other special libraries here as well.
3976 Say "none" for none.  The default list is almost always right.
3977 EOM
3978
3979 echo " "
3980 rp="What libraries to use?"
3981 . ./myread
3982 case "$ans" in
3983 none) libs=' ';;
3984 *) libs="$ans";;
3985 esac
3986
3987 : determine optimization, if desired, or use for debug flag also
3988 case "$optimize" in
3989 ' '|$undef) dflt='none';;
3990 '') dflt='-O';;
3991 *) dflt="$optimize";;
3992 esac
3993 $cat <<EOH
3994
3995 By default, $package compiles with the -O flag to use the optimizer.
3996 Alternately, you might want to use the symbolic debugger, which uses
3997 the -g flag (on traditional Unix systems).  Either flag can be
3998 specified here.  To use neither flag, specify the word "none".
3999
4000 EOH
4001 rp="What optimizer/debugger flag should be used?"
4002 . ./myread
4003 optimize="$ans"
4004 case "$optimize" in
4005 'none') optimize=" ";;
4006 esac
4007
4008 dflt=''
4009 : We will not override a previous value, but we might want to
4010 : augment a hint file
4011 case "$hint" in
4012 default|recommended)
4013         case "$gccversion" in
4014         1*) dflt='-fpcc-struct-return' ;;
4015         esac
4016         case "$optimize" in
4017         *-g*) dflt="$dflt -DDEBUGGING";;
4018         esac
4019         case "$gccversion" in
4020         2*) if test -d /etc/conf/kconfig.d &&
4021                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
4022                 then
4023                         dflt="$dflt -posix"
4024                 fi
4025                 ;;
4026         esac
4027         case "$gccversion" in
4028         1*) ;;
4029         2.[0-8]*) ;;
4030         ?*)     echo " "
4031                 echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
4032                 echo 'int main(void) { return 0; }' > gcctest.c
4033                 if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
4034                         echo "Yes, it does." 2>&1
4035                         case "$ccflags" in
4036                         *strict-aliasing*) 
4037                                 echo "Leaving current flags $ccflags alone." 2>&1
4038                                 ;;
4039                         *) dflt="$dflt -fno-strict-aliasing" ;;
4040                         esac
4041                 else
4042                         echo "Nope, it doesn't, but that's ok." 2>&1
4043                 fi
4044                 ;;
4045         esac
4046         ;;
4047 esac
4048
4049 case "$mips_type" in
4050 *BSD*|'') inclwanted="$locincpth $usrinc";;
4051 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
4052 esac
4053 for thisincl in $inclwanted; do
4054         if $test -d $thisincl; then
4055                 if $test x$thisincl != x$usrinc; then
4056                         case "$dflt" in
4057                         *" -I$thisincl "*);;
4058                         *) dflt="$dflt -I$thisincl ";;
4059                         esac
4060                 fi
4061         fi
4062 done
4063
4064 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
4065         xxx=true;
4066 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
4067         xxx=true;
4068 else
4069         xxx=false;
4070 fi;
4071 if $xxx; then
4072         case "$dflt" in
4073         *$2*);;
4074         *) dflt="$dflt -D$2";;
4075         esac;
4076 fi'
4077
4078 set signal.h LANGUAGE_C; eval $inctest
4079
4080 case "$usesocks" in
4081 $define)
4082         ccflags="$ccflags -DSOCKS"
4083         ;;
4084 esac
4085
4086 case "$hint" in
4087 default|recommended) dflt="$ccflags $dflt" ;;
4088 *) dflt="$ccflags";;
4089 esac
4090
4091 case "$dflt" in
4092 ''|' ') dflt=none;;
4093 esac
4094
4095 $cat <<EOH
4096
4097 Your C compiler may want other flags.  For this question you should include
4098 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
4099 but you should NOT include libraries or ld flags like -lwhatever.  If you
4100 want $package to honor its debug switch, you should include -DDEBUGGING here.
4101 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
4102
4103 To use no flags, specify the word "none".
4104
4105 EOH
4106 set X $dflt
4107 shift
4108 dflt=${1+"$@"}
4109 rp="Any additional cc flags?"
4110 . ./myread
4111 case "$ans" in
4112 none) ccflags='';;
4113 *) ccflags="$ans";;
4114 esac
4115
4116 : the following weeds options from ccflags that are of no interest to cpp
4117 cppflags="$ccflags"
4118 case "$gccversion" in
4119 1*) cppflags="$cppflags -D__GNUC__"
4120 esac
4121 case "$mips_type" in
4122 '');;
4123 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
4124 esac
4125 case "$cppflags" in
4126 '');;
4127 *)
4128         echo " "
4129         echo "Let me guess what the preprocessor flags are..." >&4
4130         set X $cppflags
4131         shift
4132         cppflags=''
4133         $cat >cpp.c <<'EOM'
4134 #define BLURFL foo
4135
4136 BLURFL xx LFRULB
4137 EOM
4138         previous=''
4139         for flag in $*
4140         do
4141                 case "$flag" in
4142                 -*) ftry="$flag";;
4143                 *) ftry="$previous $flag";;
4144                 esac
4145                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
4146                         >cpp1.out 2>/dev/null && \
4147                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
4148                         >cpp2.out 2>/dev/null && \
4149                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
4150                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
4151                 then
4152                         cppflags="$cppflags $ftry"
4153                         previous=''
4154                 else
4155                         previous="$flag"
4156                 fi
4157         done
4158         set X $cppflags
4159         shift
4160         cppflags=${1+"$@"}
4161         case "$cppflags" in
4162         *-*)  echo "They appear to be: $cppflags";;
4163         esac
4164         $rm -f cpp.c cpp?.out
4165         ;;
4166 esac
4167
4168 : flags used in final linking phase
4169 case "$ldflags" in
4170 '') if ./venix; then
4171                 dflt='-i -z'
4172         else
4173                 dflt=''
4174         fi
4175         case "$ccflags" in
4176         *-posix*) dflt="$dflt -posix" ;;
4177         esac
4178         ;;
4179 *) dflt="$ldflags";;
4180 esac
4181
4182 : Try to guess additional flags to pick up local libraries.
4183 for thislibdir in $libpth; do
4184         case " $loclibpth " in
4185         *" $thislibdir "*)
4186                 case "$dflt " in 
4187                 *"-L$thislibdir "*) ;;
4188                 *)  dflt="$dflt -L$thislibdir" ;;
4189                 esac
4190                 ;;
4191         esac
4192 done
4193
4194 case "$dflt" in
4195 '') dflt='none' ;;
4196 esac
4197
4198 $cat <<EOH
4199
4200 Your C linker may need flags.  For this question you should
4201 include -L/whatever and any other flags used by the C linker, but you
4202 should NOT include libraries like -lwhatever.
4203
4204 Make sure you include the appropriate -L/path flags if your C linker
4205 does not normally search all of the directories you specified above,
4206 namely
4207         $libpth
4208 To use no flags, specify the word "none".
4209
4210 EOH
4211
4212 rp="Any additional ld flags (NOT including libraries)?"
4213 . ./myread
4214 case "$ans" in
4215 none) ldflags='';;
4216 *) ldflags="$ans";;
4217 esac
4218 rmlist="$rmlist pdp11"
4219
4220 : coherency check
4221 echo " "
4222 echo "Checking your choice of C compiler and flags for coherency..." >&4
4223 $cat > try.c <<'EOF'
4224 #include <stdio.h>
4225 int main() { printf("Ok\n"); exit(0); }
4226 EOF
4227 set X $cc $optimize $ccflags -o try $ldflags try.c $libs
4228 shift
4229 $cat >try.msg <<'EOM'
4230 I've tried to compile and run the following simple program:
4231
4232 EOM
4233 $cat try.c >> try.msg
4234
4235 $cat >> try.msg <<EOM
4236
4237 I used the command:
4238
4239         $*
4240         ./try
4241
4242 and I got the following output:
4243
4244 EOM
4245 dflt=y
4246 if sh -c "$cc $optimize $ccflags -o try $ldflags try.c $libs" >>try.msg 2>&1; then
4247         if sh -c './try' >>try.msg 2>&1; then
4248                 xxx=`./try`
4249                 case "$xxx" in
4250                 "Ok") dflt=n ;;
4251                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
4252                         case " $libs " in
4253                         *" -lsfio "*)
4254                                 cat >> try.msg <<'EOQS'
4255 If $libs contains -lsfio, and sfio is mis-configured, then it
4256 sometimes (apparently) runs and exits with a 0 status, but with no
4257 output!  It may have to do with sfio's use of _exit vs. exit.
4258
4259 EOQS
4260                                 rp="You have a big problem.  Shall I abort Configure"
4261                                 dflt=y
4262                                 ;;
4263                         esac
4264                         ;;
4265                 esac
4266         else
4267                 echo "The program compiled OK, but exited with status $?." >>try.msg
4268                 rp="You have a problem.  Shall I abort Configure"
4269                 dflt=y
4270         fi
4271 else
4272         echo "I can't compile the test program." >>try.msg
4273         rp="You have a BIG problem.  Shall I abort Configure"
4274         dflt=y
4275 fi
4276 case "$dflt" in
4277 y)
4278         $cat try.msg >&4
4279         case "$knowitall" in
4280         '')
4281                 echo "(The supplied flags or libraries might be incorrect.)"
4282                 ;;
4283         *) dflt=n;;
4284         esac
4285         echo " "
4286         . ./myread
4287         case "$ans" in
4288         n*|N*) ;;
4289         *)      echo "Ok.  Stopping Configure." >&4
4290                 exit 1
4291                 ;;
4292         esac
4293         ;;
4294 n) echo "OK, that should do.";;
4295 esac
4296 $rm -f try try.* core
4297
4298 : define an is-a-typedef? function
4299 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
4300 case "$inclist" in
4301 "") inclist="sys/types.h";;
4302 esac;
4303 eval "varval=\$$var";
4304 case "$varval" in
4305 "")
4306         $rm -f temp.c;
4307         for inc in $inclist; do
4308                 echo "#include <$inc>" >>temp.c;
4309         done;
4310         echo "#ifdef $type" >> temp.c;
4311         echo "printf(\"We have $type\");" >> temp.c;
4312         echo "#endif" >> temp.c;
4313         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
4314         if $contains $type temp.E >/dev/null 2>&1; then
4315                 eval "$var=\$type";
4316         else
4317                 eval "$var=\$def";
4318         fi;
4319         $rm -f temp.?;;
4320 *) eval "$var=\$varval";;
4321 esac'
4322
4323 : define an is-a-typedef? function that prompts if the type is not available.
4324 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
4325 case "$inclist" in
4326 "") inclist="sys/types.h";;
4327 esac;
4328 eval "varval=\$$var";
4329 case "$varval" in
4330 "")
4331         $rm -f temp.c;
4332         for inc in $inclist; do
4333                 echo "#include <$inc>" >>temp.c;
4334         done;
4335         echo "#ifdef $type" >> temp.c;
4336         echo "printf(\"We have $type\");" >> temp.c;
4337         echo "#endif" >> temp.c;
4338         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
4339         echo " " ;
4340         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
4341         if $contains $type temp.E >/dev/null 2>&1; then
4342                 echo "$type found." >&4;
4343                 eval "$var=\$type";
4344         else
4345                 echo "$type NOT found." >&4;
4346                 dflt="$def";
4347                 . ./myread ;
4348                 eval "$var=\$ans";
4349         fi;
4350         $rm -f temp.?;;
4351 *) eval "$var=\$varval";;
4352 esac'
4353
4354 : define a shorthand compile call
4355 compile='
4356 mc_file=$1;
4357 shift;
4358 $cc $optimize $ccflags $ldflags -o ${mc_file} $* ${mc_file}.c $libs > /dev/null 2>&1;'
4359 : define a shorthand compile call for compilations that should be ok.
4360 compile_ok='
4361 mc_file=$1;
4362 shift;
4363 $cc $optimize $ccflags $ldflags -o ${mc_file} $* ${mc_file}.c $libs;'
4364
4365 : check for lengths of integral types
4366 echo " "
4367 case "$intsize" in
4368 '')
4369         echo "Checking to see how big your integers are..." >&4
4370         $cat >intsize.c <<'EOCP'
4371 #include <stdio.h>
4372 int main()
4373 {
4374         printf("intsize=%d;\n", (int)sizeof(int));
4375         printf("longsize=%d;\n", (int)sizeof(long));
4376         printf("shortsize=%d;\n", (int)sizeof(short));
4377         exit(0);
4378 }
4379 EOCP
4380         set intsize
4381         if eval $compile_ok && ./intsize > /dev/null; then
4382                 eval `./intsize`
4383                 echo "Your integers are $intsize bytes long."
4384                 echo "Your long integers are $longsize bytes long."
4385                 echo "Your short integers are $shortsize bytes long."
4386         else
4387                 $cat >&4 <<EOM
4388 !
4389 Help! I can't compile and run the intsize test program: please enlighten me!
4390 (This is probably a misconfiguration in your system or libraries, and
4391 you really ought to fix it.  Still, I'll try anyway.)
4392 !
4393 EOM
4394                 dflt=4
4395                 rp="What is the size of an integer (in bytes)?"
4396                 . ./myread
4397                 intsize="$ans"
4398                 dflt=$intsize
4399                 rp="What is the size of a long integer (in bytes)?"
4400                 . ./myread
4401                 longsize="$ans"
4402                 dflt=2
4403                 rp="What is the size of a short integer (in bytes)?"
4404                 . ./myread
4405                 shortsize="$ans"
4406         fi
4407         ;;
4408 esac
4409 $rm -f intsize intsize.*
4410
4411 : see what type lseek is declared as in the kernel
4412 rp="What is the type used for lseek's offset on this system?"
4413 set off_t lseektype long stdio.h sys/types.h
4414 eval $typedef_ask
4415
4416 echo " "
4417 echo "Checking to see how big your file offsets are..." >&4
4418 $cat >try.c <<EOCP
4419 #include <sys/types.h>
4420 #include <stdio.h>
4421 int main()
4422 {
4423     printf("%d\n", (int)sizeof($lseektype));
4424     return(0); 
4425 }
4426 EOCP
4427 set try
4428 if eval $compile_ok; then
4429         lseeksize=`./try`
4430         echo "Your file offsets are $lseeksize bytes long."
4431 else
4432         dflt=$longsize
4433         echo " "
4434         echo "(I can't seem to compile the test program.  Guessing...)"
4435         rp="What is the size of your file offsets (in bytes)?"
4436         . ./myread
4437         lseeksize="$ans"
4438 fi
4439 $rm -f try.c try
4440
4441 : see what type file positions are declared as in the library
4442 rp="What is the type for file position used by fsetpos()?"
4443 set fpos_t fpostype long stdio.h sys/types.h
4444 eval $typedef_ask
4445
4446 echo " "
4447 case "$fpostype" in
4448 *_t) zzz="$fpostype"    ;;
4449 *)   zzz="fpos_t"       ;;
4450 esac
4451 echo "Checking the size of $zzz..." >&4 
4452 cat > try.c <<EOCP
4453 #include <sys/types.h>
4454 #include <stdio.h>
4455 int main() {
4456     printf("%d\n", (int)sizeof($fpostype));
4457     exit(0);
4458 }
4459 EOCP
4460 set try
4461 if eval $compile_ok; then
4462         yyy=`./try`
4463         case "$yyy" in
4464         '')     fpossize=4
4465                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
4466                 ;;
4467         *)      fpossize=$yyy
4468                 echo "Your $zzz is $fpossize bytes long."
4469                 ;;
4470         esac
4471 else
4472         dflt="$longsize"
4473         echo " " >&4
4474         echo "(I can't compile the test program.  Guessing...)" >&4
4475         rp="What is the size of your file positions (in bytes)?"
4476         . ./myread
4477         fpossize="$ans"
4478 fi
4479
4480
4481
4482 # Backward compatibility (uselfs is deprecated).
4483 case "$uselfs" in
4484 "$define"|true|[yY]*)
4485         cat <<EOM >&4
4486
4487 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
4488 EOM
4489         uselargefiles="$define"
4490         ;;
4491 esac                          
4492
4493 case "$lseeksize:$fpossize" in
4494 8:8) cat <<EOM
4495
4496 You can have files larger than 2 gigabytes.
4497 EOM
4498    val="$define" ;;
4499 *)    case "$uselargefiles" in
4500    "$undef"|false|[nN]*) dflt='n' ;;
4501    *)   dflt='y' ;;
4502    esac
4503    cat <<EOM
4504
4505 Perl can be built to understand large files (files larger than 2 gigabytes)
4506 on some systems.  To do so, Configure can be run with -Duselargefiles.
4507
4508 If this doesn't make any sense to you, just accept the default '$dflt'.
4509 EOM
4510    rp='Try to understand large files, if available?'
4511    . ./myread
4512    case "$ans" in
4513    y|Y)         val="$define" ;;
4514    *)           val="$undef"  ;;
4515    esac
4516    ;;
4517 esac
4518 set uselargefiles
4519 eval $setvar
4520 case "$uselargefiles" in
4521 "$define")
4522 : Look for a hint-file generated 'call-back-unit'.  If the
4523 : user has specified that a large files perl is to be built,
4524 : we may need to set or change some other defaults.
4525         if $test -f uselargefiles.cbu; then
4526                 echo "Your platform has some specific hints for large file builds, using them..."
4527                 . ./uselargefiles.cbu
4528                 echo " "
4529                 echo "Rechecking to see how big your file offsets are..." >&4
4530                 $cat >try.c <<EOCP
4531 #include <sys/types.h>
4532 #include <stdio.h>
4533 int main()
4534 {
4535     printf("%d\n", (int)sizeof($lseektype));
4536     return(0); 
4537 }
4538 EOCP
4539                 set try
4540                 if eval $compile_ok; then
4541                         lseeksize=`./try`
4542                         $echo "Your file offsets are now $lseeksize bytes long."
4543                 else
4544                         dflt="$lseeksize"
4545                         echo " "
4546                         echo "(I can't seem to compile the test program.  Guessing...)"
4547                         rp="What is the size of your file offsets (in bytes)?"
4548                         . ./myread
4549                         lseeksize="$ans"
4550                 fi
4551                 case "$fpostype" in
4552                 *_t) zzz="$fpostype"    ;;
4553                 *)   zzz="fpos_t"       ;;
4554                 esac
4555                 $echo $n "Rechecking the size of $zzz...$c" >&4 
4556                 $cat > try.c <<EOCP
4557 #include <sys/types.h>
4558 #include <stdio.h>
4559 int main() {
4560     printf("%d\n", (int)sizeof($fpostype));
4561     exit(0);
4562 }
4563 EOCP
4564                 set try
4565                 if eval $compile_ok; then
4566                         yyy=`./try`
4567                         dflt="$lseeksize"
4568                         case "$yyy" in
4569                         '')     echo " "
4570                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
4571                                 ;;
4572                         *)      fpossize=$yyy
4573                                 echo " $fpossize bytes." >&4
4574                                 ;;
4575                         esac
4576                 else
4577                         dflt="$fpossize"
4578                         echo " "
4579                         echo "(I can't compile the test program.  Guessing...)" >&4
4580                         rp="What is the size of your file positions (in bytes)?"
4581                         . ./myread
4582                         fpossize="$ans"
4583                 fi
4584                 $rm -f try.c try
4585         fi
4586         ;;
4587 esac
4588
4589
4590 case "$usemorebits" in
4591 "$define"|true|[yY]*)
4592         use64bitint="$define"
4593         uselongdouble="$define"
4594         usemorebits="$define"
4595         ;;
4596 *)      usemorebits="$undef"
4597         ;;
4598 esac
4599
4600
4601 case "$uselonglong" in
4602 "$define"|true|[yY]*)
4603         cat <<EOM >&4
4604
4605 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
4606 EOM
4607         use64bitint="$define"
4608         ;;
4609 esac                          
4610 case "$use64bits" in
4611 "$define"|true|[yY]*)
4612         cat <<EOM >&4
4613
4614 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
4615 EOM
4616         use64bitint="$define"
4617         ;;
4618 esac                          
4619 case "$use64bitints" in
4620 "$define"|true|[yY]*)
4621         cat <<EOM >&4
4622
4623 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
4624 EOM
4625         use64bitint="$define"
4626         ;;
4627 esac                          
4628 case "$use64bitsint" in
4629 "$define"|true|[yY]*)
4630         cat <<EOM >&4
4631
4632 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
4633 EOM
4634         use64bitint="$define"
4635         ;;
4636 esac                          
4637 case "$uselonglongs" in
4638 "$define"|true|[yY]*)
4639         cat <<EOM >&4
4640
4641 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
4642 EOM
4643         use64bitint="$define"
4644         ;;
4645 esac                          
4646 case "$use64bitsall" in
4647 "$define"|true|[yY]*)
4648         cat <<EOM >&4
4649
4650 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
4651 EOM
4652         use64bitall="$define"
4653         ;;
4654 esac                          
4655
4656 case "$ccflags" in
4657 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
4658 esac
4659 case "$use64bitall" in
4660 "$define"|true|[yY]*) use64bitint="$define" ;;
4661 esac
4662
4663 case "$longsize" in
4664 8) cat <<EOM
4665
4666 You have natively 64-bit long integers.
4667 EOM
4668    val="$define"
4669    ;;
4670 *) case "$use64bitint" in
4671    "$define"|true|[yY]*) dflt='y';;
4672    *) dflt='n';;
4673    esac
4674    cat <<EOM
4675
4676 Perl can be built to take advantage of 64-bit integer types
4677 on some systems.  To do so, Configure can be run with -Duse64bitint.
4678 Choosing this option will most probably introduce binary incompatibilities.
4679
4680 If this doesn't make any sense to you, just accept the default '$dflt'.
4681 EOM
4682    rp='Try to use 64-bit integers, if available?'
4683    . ./myread
4684    case "$ans" in
4685    [yY]*) val="$define" ;;
4686    *)     val="$undef"  ;;
4687    esac
4688    ;;
4689 esac
4690 set use64bitint
4691 eval $setvar
4692
4693 case "$use64bitall" in
4694 "$define"|true|[yY]*) dflt='y' ;;
4695 *) case "$longsize" in
4696    8) dflt='y' ;;
4697    *) dflt='n' ;;
4698    esac
4699    ;;
4700 esac    
4701 cat <<EOM
4702
4703 You may also choose to try maximal 64-bitness.  It means using as much
4704 64-bitness as possible on the platform.  This in turn means even more
4705 binary incompatibilities.  On the other hand, your platform may not
4706 have any more 64-bitness available than what you already have chosen.
4707
4708 If this doesn't make any sense to you, just accept the default '$dflt'.
4709 EOM
4710 rp='Try to use maximal 64-bit support, if available?'
4711 . ./myread
4712 case "$ans" in
4713 [yY]*) val="$define" ;;
4714 *)     val="$undef"  ;;
4715 esac
4716 set use64bitall
4717 eval $setvar
4718 case "$use64bitall" in
4719 "$define")
4720         case "$use64bitint" in
4721         "$undef")
4722                 cat <<EOM
4723
4724 Since you have chosen a maximally 64-bit build, I'm also turning on
4725 the use of 64-bit integers.
4726 EOM
4727                 use64bitint="$define" ;;
4728         esac
4729         ;;
4730 esac
4731
4732 case "$use64bitint" in
4733 "$define"|true|[yY]*)
4734 : Look for a hint-file generated 'call-back-unit'.  If the
4735 : user has specified that a 64-bit perl is to be built,
4736 : we may need to set or change some other defaults.
4737         if $test -f use64bitint.cbu; then
4738                 echo "Your platform has some specific hints for 64-bit integers, using them..."
4739                 . ./use64bitint.cbu
4740         fi
4741         case "$longsize" in
4742         4) case "$archname64" in
4743            '') archname64=64int ;;
4744            esac
4745            ;;
4746         esac
4747         ;;
4748 esac
4749
4750 case "$use64bitall" in
4751 "$define"|true|[yY]*)
4752 : Look for a hint-file generated 'call-back-unit'.  If the
4753 : user has specified that a maximally 64-bit perl is to be built,
4754 : we may need to set or change some other defaults.
4755         if $test -f use64bitall.cbu; then
4756                 echo "Your platform has some specific hints for 64-bit builds, using them..."
4757                 . ./use64bitall.cbu
4758         fi
4759         case "$longsize" in
4760         4) case "$archname64" in
4761            ''|64int) archname64=64all ;;
4762            esac
4763            ;;
4764         esac
4765         ;;
4766 esac
4767
4768 echo " "
4769 echo "Checking for GNU C Library..." >&4
4770 cat >gnulibc.c <<EOM
4771 #include <stdio.h>
4772 int main()
4773 {
4774 #ifdef __GLIBC__
4775     exit(0);
4776 #else
4777     exit(1);
4778 #endif
4779 }
4780 EOM
4781 set gnulibc
4782 if eval $compile_ok && ./gnulibc; then
4783         val="$define"
4784         echo "You are using the GNU C Library"
4785 else
4786         val="$undef"
4787         echo "You are not using the GNU C Library"
4788 fi
4789 $rm -f gnulibc*
4790 set d_gnulibc
4791 eval $setvar
4792
4793 : see if nm is to be used to determine whether a symbol is defined or not
4794 case "$usenm" in
4795 '')
4796         dflt=''
4797         case "$d_gnulibc" in
4798         "$define")
4799                 echo " "
4800                 echo "nm probably won't work on the GNU C Library." >&4
4801                 dflt=n
4802                 ;;
4803         esac
4804         case "$dflt" in
4805         '') 
4806                 if $test "$osname" = aix -a ! -f /lib/syscalls.exp; then
4807                         echo " "
4808                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
4809                         echo "'nm' won't be sufficient on this sytem." >&4
4810                         dflt=n
4811                 fi
4812                 ;;
4813         esac
4814         case "$dflt" in
4815         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
4816                 if $test $dflt -gt 20; then
4817                         dflt=y
4818                 else
4819                         dflt=n
4820                 fi
4821                 ;;
4822         esac
4823         ;;
4824 *)
4825         case "$usenm" in
4826         true|$define) dflt=y;;
4827         *) dflt=n;;
4828         esac
4829         ;;
4830 esac
4831 $cat <<EOM
4832
4833 I can use $nm to extract the symbols from your C libraries. This
4834 is a time consuming task which may generate huge output on the disk (up
4835 to 3 megabytes) but that should make the symbols extraction faster. The
4836 alternative is to skip the 'nm' extraction part and to compile a small
4837 test program instead to determine whether each symbol is present. If
4838 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
4839 this may be the best solution.
4840
4841 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
4842
4843 EOM
4844 rp="Shall I use $nm to extract C symbols from the libraries?"
4845 . ./myread
4846 case "$ans" in
4847 [Nn]*) usenm=false;;
4848 *) usenm=true;;
4849 esac
4850
4851 runnm=$usenm
4852 case "$reuseval" in
4853 true) runnm=false;;
4854 esac
4855
4856 : nm options which may be necessary
4857 case "$nm_opt" in
4858 '') if $test -f /mach_boot; then
4859                 nm_opt=''       # Mach
4860         elif $test -d /usr/ccs/lib; then
4861                 nm_opt='-p'     # Solaris (and SunOS?)
4862         elif $test -f /dgux; then
4863                 nm_opt='-p'     # DG-UX
4864         elif $test -f /lib64/rld; then
4865                 nm_opt='-p'     # 64-bit Irix
4866         else
4867                 nm_opt=''
4868         fi;;
4869 esac
4870
4871 : nm options which may be necessary for shared libraries but illegal
4872 : for archive libraries.  Thank you, Linux.
4873 case "$nm_so_opt" in
4874 '')     case "$myuname" in
4875         *linux*)
4876                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
4877                         nm_so_opt='--dynamic'
4878                 fi
4879                 ;;
4880         esac
4881         ;;
4882 esac
4883
4884 case "$runnm" in
4885 true)
4886 : get list of predefined functions in a handy place
4887 echo " "
4888 case "$libc" in
4889 '') libc=unknown
4890         case "$libs" in
4891         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
4892         esac
4893         ;;
4894 esac
4895 libnames='';
4896 case "$libs" in
4897 '') ;;
4898 *)  for thislib in $libs; do
4899         case "$thislib" in
4900         -lc|-lc_s)
4901                 : Handle C library specially below.
4902                 ;;
4903         -l*)
4904                 thislib=`echo $thislib | $sed -e 's/^-l//'`
4905                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
4906                         :
4907                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
4908                         :
4909                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
4910                         :
4911                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
4912                         :
4913                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
4914                         :
4915                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
4916                         :
4917                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
4918                         :
4919                 else
4920                         try=''
4921                 fi
4922                 libnames="$libnames $try"
4923                 ;;
4924         *) libnames="$libnames $thislib" ;;
4925         esac
4926         done
4927         ;;
4928 esac
4929 xxx=normal
4930 case "$libc" in
4931 unknown)
4932         set /lib/libc.$so
4933         for xxx in $libpth; do
4934                 $test -r $1 || set $xxx/libc.$so
4935                 : The messy sed command sorts on library version numbers.
4936                 $test -r $1 || \
4937                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
4938                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
4939                                 h
4940                                 s/[0-9][0-9]*/0000&/g
4941                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
4942                                 G
4943                                 s/\n/ /' | \
4944                          sort | $sed -e 's/^.* //'`
4945                 eval set \$$#
4946         done
4947         $test -r $1 || set /usr/ccs/lib/libc.$so
4948         $test -r $1 || set /lib/libsys_s$_a
4949         ;;
4950 *)
4951         set blurfl
4952         ;;
4953 esac
4954 if $test -r "$1"; then
4955         echo "Your (shared) C library seems to be in $1."
4956         libc="$1"
4957 elif $test -r /lib/libc && $test -r /lib/clib; then
4958         echo "Your C library seems to be in both /lib/clib and /lib/libc."
4959         xxx=apollo
4960         libc='/lib/clib /lib/libc'
4961         if $test -r /lib/syslib; then
4962                 echo "(Your math library is in /lib/syslib.)"
4963                 libc="$libc /lib/syslib"
4964         fi
4965 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
4966         echo "Your C library seems to be in $libc, as you said before."
4967 elif $test -r $incpath/usr/lib/libc$_a; then
4968         libc=$incpath/usr/lib/libc$_a;
4969         echo "Your C library seems to be in $libc.  That's fine."
4970 elif $test -r /lib/libc$_a; then
4971         libc=/lib/libc$_a;
4972         echo "Your C library seems to be in $libc.  You're normal."
4973 else
4974         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
4975                 :
4976         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
4977                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
4978         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
4979                 :
4980         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
4981                 :
4982         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
4983                 :
4984         else
4985                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
4986         fi
4987         if $test -r "$tans"; then
4988                 echo "Your C library seems to be in $tans, of all places."
4989                 libc=$tans
4990         else
4991                 libc='blurfl'
4992         fi
4993 fi
4994 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
4995         dflt="$libc"
4996         cat <<EOM
4997
4998 If the guess above is wrong (which it might be if you're using a strange
4999 compiler, or your machine supports multiple models), you can override it here.
5000
5001 EOM
5002 else
5003         dflt=''
5004         echo $libpth | tr ' ' $trnl | sort | uniq > libpath
5005         cat >&4 <<EOM
5006 I can't seem to find your C library.  I've looked in the following places:
5007
5008 EOM
5009         $sed 's/^/      /' libpath
5010         cat <<EOM
5011
5012 None of these seems to contain your C library. I need to get its name...
5013
5014 EOM
5015 fi
5016 fn=f
5017 rp='Where is your C library?'
5018 . ./getfile
5019 libc="$ans"
5020
5021 echo " "
5022 echo $libc $libnames | tr ' ' $trnl | sort | uniq > libnames
5023 set X `cat libnames`
5024 shift
5025 xxx=files
5026 case $# in 1) xxx=file; esac
5027 echo "Extracting names from the following $xxx for later perusal:" >&4
5028 echo " "
5029 $sed 's/^/      /' libnames >&4
5030 echo " "
5031 $echo $n "This may take a while...$c" >&4
5032
5033 for file in $*; do
5034         case $file in
5035         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
5036         *) $nm $nm_opt $file 2>/dev/null;;
5037         esac
5038 done >libc.tmp
5039
5040 $echo $n ".$c"
5041 $grep fprintf libc.tmp > libc.ptf
5042 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
5043 xrun='eval "<libc.tmp $com >libc.list"; echo "done" >&4'
5044 xxx='[ADTSIW]'
5045 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *_[_.]*//p' -e 's/^.* $xxx  *//p'";\
5046         eval $xscan;\
5047         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5048                 eval $xrun
5049 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
5050         eval $xscan;\
5051         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5052                 eval $xrun
5053 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
5054         eval $xscan;\
5055         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5056                 eval $xrun
5057 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
5058         eval $xscan;\
5059         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5060                 eval $xrun
5061 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
5062         eval $xscan;\
5063         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5064                 eval $xrun
5065 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
5066         eval $xscan;\
5067         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5068                 eval $xrun
5069 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
5070                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
5071         eval $xscan;\
5072         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5073                 eval $xrun
5074 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
5075         eval $xscan;\
5076         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5077                 eval $xrun
5078 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
5079         eval $xscan;\
5080         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5081                 eval $xrun
5082 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
5083         eval $xscan;\
5084         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5085                 eval $xrun
5086 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
5087         eval $xscan;\
5088         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5089                 eval $xrun
5090 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
5091         eval $xscan;\
5092         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5093                 eval $xrun
5094 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
5095         eval $xscan;\
5096         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5097                 eval $xrun
5098 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
5099         eval $xscan;\
5100         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5101                 eval $xrun
5102 else
5103         $nm -p $* 2>/dev/null >libc.tmp
5104         $grep fprintf libc.tmp > libc.ptf
5105         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
5106                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
5107         then
5108                 nm_opt='-p'
5109                 eval $xrun
5110         else
5111                 echo " "
5112                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
5113                 com=''
5114                 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
5115                         for thisname in $libnames $libc; do
5116                                 $ar t $thisname >>libc.tmp
5117                         done
5118                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
5119                         echo "Ok." >&4
5120                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
5121                         # Repeat libc to extract forwarders to DLL entries too
5122                         for thisname in $libnames $libc; do
5123                                 $ar tv $thisname >>libc.tmp
5124                                 # Revision 50 of EMX has bug in $ar.
5125                                 # it will not extract forwarders to DLL entries
5126                                 # Use emximp which will extract exactly them.
5127                                 emximp -o tmp.imp $thisname \
5128                                     2>/dev/null && \
5129                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
5130                                     < tmp.imp >>libc.tmp
5131                                 $rm tmp.imp
5132                         done
5133                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
5134                         echo "Ok." >&4
5135                 else
5136                         echo "$ar didn't seem to work right." >&4
5137                         echo "Maybe this is a Cray...trying bld instead..." >&4
5138                         if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
5139                         then
5140                                 for thisname in $libnames; do
5141                                         bld t $libnames | \
5142                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
5143                                         $ar t $thisname >>libc.tmp
5144                                 done
5145                                 echo "Ok." >&4
5146                         else
5147                                 echo "That didn't work either.  Giving up." >&4
5148                                 exit 1
5149                         fi
5150                 fi
5151         fi
5152 fi
5153 nm_extract="$com"
5154 if $test -f /lib/syscalls.exp; then
5155         echo " "
5156         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
5157         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*$/\1/p' /lib/syscalls.exp >>libc.list
5158 fi
5159 ;;
5160 esac
5161 $rm -f libnames libpath
5162
5163 : is a C symbol defined?
5164 csym='tlook=$1;
5165 case "$3" in
5166 -v) tf=libc.tmp; tc=""; tdc="";;
5167 -a) tf=libc.tmp; tc="[0]"; tdc="[]";;
5168 *) tlook="^$1\$"; tf=libc.list; tc="()"; tdc="()";;
5169 esac;
5170 tx=yes;
5171 case "$reuseval-$4" in
5172 true-) ;;
5173 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
5174 esac;
5175 case "$tx" in
5176 yes)
5177         case "$runnm" in
5178         true)
5179                 if $contains $tlook $tf >/dev/null 2>&1;
5180                 then tval=true;
5181                 else tval=false;
5182                 fi;;
5183         *)
5184                 echo "int main() { extern short $1$tdc; printf(\"%hd\", $1$tc); }" > t.c;
5185                 if $cc $optimize $ccflags $ldflags -o t t.c $libs >/dev/null 2>&1;
5186                 then tval=true;
5187                 else tval=false;
5188                 fi;
5189                 $rm -f t t.c;;
5190         esac;;
5191 *)
5192         case "$tval" in
5193         $define) tval=true;;
5194         *) tval=false;;
5195         esac;;
5196 esac;
5197 eval "$2=$tval"'
5198
5199 : define an is-in-libc? function
5200 inlibc='echo " "; td=$define; tu=$undef;
5201 sym=$1; var=$2; eval "was=\$$2";
5202 tx=yes;
5203 case "$reuseval$was" in
5204 true) ;;
5205 true*) tx=no;;
5206 esac;
5207 case "$tx" in
5208 yes)
5209         set $sym tres -f;
5210         eval $csym;
5211         case "$tres" in
5212         true)
5213                 echo "$sym() found." >&4;
5214                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
5215         *)
5216                 echo "$sym() NOT found." >&4;
5217                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
5218         esac;;
5219 *)
5220         case "$was" in
5221         $define) echo "$sym() found." >&4;;
5222         *) echo "$sym() NOT found." >&4;;
5223         esac;;
5224 esac'
5225
5226 : see if sqrtl exists
5227 set sqrtl d_sqrtl
5228 eval $inlibc
5229
5230 case "$ccflags" in
5231 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
5232 esac
5233
5234 case "$uselongdouble" in
5235 $define|true|[yY]*)     dflt='y';;
5236 *) dflt='n';;
5237 esac
5238 cat <<EOM
5239
5240 Perl can be built to take advantage of long doubles which
5241 (if available) may give more accuracy and range for floating point numbers.
5242
5243 If this doesn't make any sense to you, just accept the default '$dflt'.
5244 EOM
5245 rp='Try to use long doubles if available?'
5246 . ./myread
5247 case "$ans" in
5248 y|Y)    val="$define"   ;;
5249 *)      val="$undef"    ;;
5250 esac
5251 set uselongdouble
5252 eval $setvar
5253
5254 case "$uselongdouble" in
5255 true|[yY]*) uselongdouble="$define" ;;
5256 esac
5257
5258 case "$uselongdouble" in
5259 $define)
5260 : Look for a hint-file generated 'call-back-unit'.  If the
5261 : user has specified that long doubles should be used,
5262 : we may need to set or change some other defaults.
5263         if $test -f uselongdouble.cbu; then
5264                 echo "Your platform has some specific hints for long doubles, using them..."
5265                 . ./uselongdouble.cbu
5266         else
5267                 $cat <<EOM
5268 (Your platform doesn't have any specific hints for long doubles.)
5269 EOM
5270         fi
5271         ;;
5272 esac
5273
5274 case "$uselongdouble:$d_sqrtl" in
5275 $define:$undef)
5276                 $cat <<EOM >&4
5277
5278 *** You requested the use of long doubles but you do not seem to have
5279 *** the mathematic functions for long doubles.  I'm disabling the use
5280 *** of long doubles.
5281
5282 EOM
5283         uselongdouble=$undef
5284         ;;
5285 esac
5286
5287 : check for length of double
5288 echo " "
5289 case "$doublesize" in
5290 '')
5291         echo "Checking to see how big your double precision numbers are..." >&4
5292         $cat >try.c <<'EOCP'
5293 #include <stdio.h>
5294 int main()
5295 {
5296     printf("%d\n", (int)sizeof(double));
5297     exit(0);
5298 }
5299 EOCP
5300         set try
5301         if eval $compile_ok; then
5302                 doublesize=`./try`
5303                 echo "Your double is $doublesize bytes long."
5304         else
5305                 dflt='8'
5306                 echo "(I can't seem to compile the test program.  Guessing...)"
5307                 rp="What is the size of a double precision number (in bytes)?"
5308                 . ./myread
5309                 doublesize="$ans"
5310         fi
5311         ;;
5312 esac
5313 $rm -f try.c try
5314
5315 : check for long doubles
5316 echo " "
5317 echo "Checking to see if you have long double..." >&4
5318 echo 'int main() { long double x = 7.0; }' > try.c
5319 set try
5320 if eval $compile; then
5321         val="$define"
5322         echo "You have long double."
5323 else
5324         val="$undef"
5325         echo "You do not have long double."
5326 fi
5327 $rm try.*
5328 set d_longdbl
5329 eval $setvar
5330
5331 : check for length of long double
5332 case "${d_longdbl}${longdblsize}" in
5333 $define)
5334         echo " "
5335         echo "Checking to see how big your long doubles are..." >&4
5336         $cat >try.c <<'EOCP'
5337 #include <stdio.h>
5338 int main()
5339 {
5340         printf("%d\n", sizeof(long double));
5341 }
5342 EOCP
5343         set try
5344         set try
5345         if eval $compile; then
5346                 longdblsize=`./try$exe_ext`
5347                 echo "Your long doubles are $longdblsize bytes long."
5348         else
5349                 dflt='8'
5350                 echo " "
5351                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
5352                 rp="What is the size of a long double (in bytes)?"
5353                 . ./myread
5354                 longdblsize="$ans"
5355         fi
5356         if $test "X$doublesize" = "X$longdblsize"; then
5357                 echo "(That isn't any different from an ordinary double.)"
5358         fi      
5359         ;;
5360 esac
5361 $rm -f try.* try
5362
5363 : determine the architecture name
5364 echo " "
5365 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
5366         tarch=`arch`"-$osname"
5367 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
5368         if uname -m > tmparch 2>&1 ; then
5369                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
5370                         -e 's/$/'"-$osname/" tmparch`
5371         else
5372                 tarch="$osname"
5373         fi
5374         $rm -f tmparch
5375 else
5376         tarch="$osname"
5377 fi
5378 case "$myarchname" in
5379 ''|"$tarch") ;;
5380 *)
5381         echo "(Your architecture name used to be $myarchname.)"
5382         archname=''
5383         ;;
5384 esac
5385 myarchname="$tarch"
5386 case "$archname" in
5387 '') dflt="$tarch";;
5388 *) dflt="$archname";;
5389 esac
5390 rp='What is your architecture name'
5391 . ./myread
5392 archname="$ans"
5393 case "$usethreads" in
5394 $define)
5395         echo "Threads selected." >&4
5396         case "$archname" in
5397         *-thread*) echo "...and architecture name already has -thread." >&4
5398                 ;;
5399         *)      archname="$archname-thread"
5400                 echo "...setting architecture name to $archname." >&4
5401                 ;;
5402         esac
5403         ;;
5404 esac
5405 case "$usemultiplicity" in
5406 $define)
5407         echo "Multiplicity selected." >&4
5408         case "$archname" in
5409         *-multi*) echo "...and architecture name already has -multi." >&4
5410                 ;;
5411         *)      archname="$archname-multi"
5412                 echo "...setting architecture name to $archname." >&4
5413                 ;;
5414         esac
5415         ;;
5416 esac
5417 case "$use64bitint$use64bitall" in
5418 *"$define"*)
5419         case "$archname64" in
5420         '')
5421                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
5422                 ;;
5423         *)
5424                 case "$use64bitint" in
5425                 "$define") echo "64 bit integers selected." >&4 ;;
5426                 esac
5427                 case "$use64bitall" in
5428                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
5429                 esac
5430                 case "$archname" in
5431                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
5432                         ;;
5433                 *)      archname="$archname-$archname64"
5434                         echo "...setting architecture name to $archname." >&4
5435                         ;;
5436                 esac
5437                 ;;
5438         esac
5439 esac
5440 case "$uselongdouble" in
5441 $define)
5442         echo "Long doubles selected." >&4
5443         case "$longdblsize" in
5444         $doublesize)
5445                 "...but long doubles are equal to doubles, not changing architecture name." >&4
5446                 ;;
5447         *)
5448                 case "$archname" in
5449                 *-ld*) echo "...and architecture name already has -ld." >&4
5450                         ;;
5451                 *)      archname="$archname-ld"
5452                         echo "...setting architecture name to $archname." >&4
5453                         ;;
5454                 esac
5455                 ;;
5456         esac
5457         ;;
5458 esac
5459
5460 : determine root of directory hierarchy where package will be installed.
5461 case "$prefix" in
5462 '')
5463         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
5464         ;;
5465 *)
5466         dflt="$prefix"
5467         ;;
5468 esac
5469 $cat <<EOM
5470
5471 By default, $package will be installed in $dflt/bin, manual pages
5472 under $dflt/man, etc..., i.e. with $dflt as prefix for all
5473 installation directories. Typically this is something like /usr/local.
5474 If you wish to have binaries under /usr/bin but other parts of the
5475 installation under /usr/local, that's ok: you will be prompted
5476 separately for each of the installation directories, the prefix being
5477 only used to set the defaults.
5478
5479 EOM
5480 fn=d~
5481 rp='Installation prefix to use?'
5482 . ./getfile
5483 oldprefix=''
5484 case "$prefix" in
5485 '') ;;
5486 *)
5487         case "$ans" in
5488         "$prefix") ;;
5489         *) oldprefix="$prefix";;
5490         esac
5491         ;;
5492 esac
5493 prefix="$ans"
5494 prefixexp="$ansexp"
5495
5496 : is AFS running?
5497 echo " "
5498 case "$afs" in
5499 $define|true)   afs=true ;;
5500 $undef|false)   afs=false ;;
5501 *)      if test -d /afs; then
5502                 afs=true
5503         else
5504                 afs=false
5505         fi
5506         ;;
5507 esac
5508 if $afs; then
5509         echo "AFS may be running... I'll be extra cautious then..." >&4
5510 else
5511         echo "AFS does not seem to be running..." >&4
5512 fi
5513
5514 : determine installation prefix for where package is to be installed.
5515 if $afs; then 
5516 $cat <<EOM
5517
5518 Since you are running AFS, I need to distinguish the directory in which
5519 files will reside from the directory in which they are installed (and from
5520 which they are presumably copied to the former directory by occult means).
5521
5522 EOM
5523         case "$installprefix" in
5524         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
5525         *) dflt="$installprefix";;
5526         esac
5527 else
5528 $cat <<EOM
5529
5530 In some special cases, particularly when building $package for distribution,
5531 it is convenient to distinguish between the directory in which files should 
5532 be installed from the directory ($prefix) in which they 
5533 will eventually reside.  For most users, these two directories are the same.
5534
5535 EOM
5536         case "$installprefix" in
5537         '') dflt=$prefix ;;
5538         *) dflt=$installprefix;;
5539         esac
5540 fi
5541 fn=d~
5542 rp='What installation prefix should I use for installing files?'
5543 . ./getfile
5544 installprefix="$ans"
5545 installprefixexp="$ansexp"
5546
5547 : set the prefixit variable, to compute a suitable default value
5548 prefixit='case "$3" in
5549 ""|none)
5550         case "$oldprefix" in
5551         "") eval "$1=\"\$$2\"";;
5552         *)
5553                 case "$3" in
5554                 "") eval "$1=";;
5555                 none)
5556                         eval "tp=\"\$$2\"";
5557                         case "$tp" in
5558                         ""|" ") eval "$1=\"\$$2\"";;
5559                         *) eval "$1=";;
5560                         esac;;
5561                 esac;;
5562         esac;;
5563 *)
5564         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
5565         case "$tp" in
5566         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
5567         /*-$oldprefix/*|\~*-$oldprefix/*)
5568                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
5569         *) eval "$1=\"\$$2\"";;
5570         esac;;
5571 esac'
5572
5573
5574 : get the patchlevel
5575 echo " "
5576 echo "Getting the current patchlevel..." >&4
5577 if $test -r $rsrc/patchlevel.h;then
5578         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
5579         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
5580         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
5581         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
5582         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
5583         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
5584 else
5585         revision=0
5586         patchlevel=0
5587         subversion=0
5588         api_revision=0
5589         api_version=0
5590         api_subversion=0
5591 fi
5592 $echo "(You have $package version $patchlevel subversion $subversion.)"
5593 case "$osname" in
5594 dos|vms)
5595         : XXX Should be a Configure test for double-dots in filenames.
5596         version=`echo $revision $patchlevel $subversion | \
5597                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
5598         api_versionstring=`echo $api_revision $api_version $api_subversion | \
5599                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
5600         ;;
5601 *)
5602         version=`echo $revision $patchlevel $subversion | \
5603                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
5604         api_versionstring=`echo $api_revision $api_version $api_subversion | \
5605                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
5606         ;;
5607 esac
5608 : Special case the 5.005_xx maintenance series, which used 5.005
5609 : without any subversion label as a subdirectory in $sitelib
5610 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
5611         api_versionstring='5.005'
5612 fi
5613
5614 : determine installation style
5615 : For now, try to deduce it from prefix unless it is already set.
5616 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
5617 case "$installstyle" in
5618 '')     case "$prefix" in
5619                 *perl*) dflt='lib';;
5620                 *) dflt='lib/perl5' ;;
5621         esac
5622         ;;
5623 *)      dflt="$installstyle" ;;
5624 esac
5625 : Probably not worth prompting for this since we prompt for all
5626 : the directories individually, and the prompt would be too long and
5627 : confusing anyway.
5628 installstyle=$dflt
5629
5630 : determine where private library files go
5631 : Usual default is /usr/local/lib/perl5/$version.
5632 : Also allow things like /opt/perl/lib/$version, since 
5633 : /opt/perl/lib/perl5... would be redundant.
5634 : The default "style" setting is made in installstyle.U
5635 case "$installstyle" in
5636 *lib/perl5*) set dflt privlib lib/$package/$version ;;
5637 *)       set dflt privlib lib/$version ;;
5638 esac
5639 eval $prefixit
5640 $cat <<EOM
5641
5642 There are some auxiliary files for $package that need to be put into a
5643 private library directory that is accessible by everyone.
5644
5645 EOM
5646 fn=d~+
5647 rp='Pathname where the private library files will reside?'
5648 . ./getfile
5649 privlib="$ans"
5650 privlibexp="$ansexp"
5651 : Change installation prefix, if necessary.
5652 if $test X"$prefix" != X"$installprefix"; then
5653         installprivlib=`echo $privlibexp | sed "s#^$prefix#$installprefix#"`
5654 else
5655         installprivlib="$privlibexp"
5656 fi
5657
5658 : set the prefixup variable, to restore leading tilda escape
5659 prefixup='case "$prefixexp" in
5660 "$prefix") ;;
5661 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
5662 esac'
5663
5664 : determine where public architecture dependent libraries go
5665 set archlib archlib
5666 eval $prefixit
5667 : privlib default is /usr/local/lib/$package/$version
5668 : archlib default is /usr/local/lib/$package/$version/$archname
5669 : privlib may have an optional trailing /share.
5670 tdflt=`echo $privlib | $sed 's,/share$,,'`
5671 tdflt=$tdflt/$archname
5672 case "$archlib" in
5673 '')     dflt=$tdflt
5674         ;;
5675 *)      dflt="$archlib"
5676     ;;
5677 esac
5678 $cat <<EOM
5679
5680 $spackage contains architecture-dependent library files.  If you are
5681 sharing libraries in a heterogeneous environment, you might store
5682 these files in a separate location.  Otherwise, you can just include
5683 them with the rest of the public library files.
5684
5685 EOM
5686 fn=d+~
5687 rp='Where do you want to put the public architecture-dependent libraries?'
5688 . ./getfile
5689 archlib="$ans"
5690 archlibexp="$ansexp"
5691 if $test X"$archlib" = X"$privlib"; then
5692         d_archlib="$undef"
5693 else
5694         d_archlib="$define"
5695 fi
5696 : Change installation prefix, if necessary.
5697 if $test X"$prefix" != X"$installprefix"; then
5698         installarchlib=`echo $archlibexp | sed "s#^$prefix#$installprefix#"`
5699 else
5700         installarchlib="$archlibexp"
5701 fi
5702
5703
5704 : Binary compatibility with 5.005 is not possible for builds
5705 : with advanced features
5706 case "$usethreads$usemultiplicity" in
5707 *define*)
5708         bincompat5005="$undef"
5709         d_bincompat5005="$undef"
5710         ;;
5711 *)      $cat <<EOM
5712
5713 This version of Perl can be compiled for binary compatibility with 5.005.
5714 If you decide to do so, you will be able to continue using most of the
5715 extensions that were compiled for Perl 5.005.
5716
5717 EOM
5718         case "$bincompat5005$d_bincompat5005" in
5719         *"$undef"*) dflt=n ;;
5720         *) dflt=y ;;
5721         esac
5722         rp='Binary compatibility with Perl 5.005?'
5723         . ./myread
5724         case "$ans" in
5725         y*) val="$define" ;;
5726         *)  val="$undef" ;;
5727         esac
5728         set d_bincompat5005
5729         eval $setvar
5730         case "$d_bincompat5005" in
5731         "$define")
5732                 bincompat5005="$define"
5733                 ;;
5734         *)      bincompat5005="$undef"
5735                 d_bincompat5005="$undef"
5736                 ;;
5737         esac
5738         ;;
5739 esac
5740
5741
5742 : see if setuid scripts can be secure
5743 $cat <<EOM
5744
5745 Some kernels have a bug that prevents setuid #! scripts from being
5746 secure.  Some sites have disabled setuid #! scripts because of this.
5747
5748 First let's decide if your kernel supports secure setuid #! scripts.
5749 (If setuid #! scripts would be secure but have been disabled anyway,
5750 don't say that they are secure if asked.)
5751
5752 EOM
5753
5754 val="$undef"
5755 if $test -d /dev/fd; then
5756         echo "#!$ls" >reflect
5757         chmod +x,u+s reflect
5758         ./reflect >flect 2>&1
5759         if $contains "/dev/fd" flect >/dev/null; then
5760                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
5761                 val="$define"
5762         else
5763                 $cat <<EOM
5764 If you are not sure if they are secure, I can check but I'll need a
5765 username and password different from the one you are using right now.
5766 If you don't have such a username or don't want me to test, simply
5767 enter 'none'.
5768
5769 EOM
5770                 rp='Other username to test security of setuid scripts with?'
5771                 dflt='none'
5772                 . ./myread
5773                 case "$ans" in
5774                 n|none)
5775                         case "$d_suidsafe" in
5776                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
5777                                 dflt=n;;
5778                         "$undef")
5779                                 echo "Well, the $hint value is *not* secure." >&4
5780                                 dflt=n;;
5781                         *)      echo "Well, the $hint value *is* secure." >&4
5782                                 dflt=y;;
5783                         esac
5784                         ;;
5785                 *)
5786                         $rm -f reflect flect
5787                         echo "#!$ls" >reflect
5788                         chmod +x,u+s reflect
5789                         echo >flect
5790                         chmod a+w flect
5791                         echo '"su" will (probably) prompt you for '"$ans's password."
5792                         su $ans -c './reflect >flect'
5793                         if $contains "/dev/fd" flect >/dev/null; then
5794                                 echo "Okay, it looks like setuid scripts are secure." >&4
5795                                 dflt=y
5796                         else
5797                                 echo "I don't think setuid scripts are secure." >&4
5798                                 dflt=n
5799                         fi
5800                         ;;
5801                 esac
5802                 rp='Does your kernel have *secure* setuid scripts?'
5803                 . ./myread
5804                 case "$ans" in
5805                 [yY]*)  val="$define";;
5806                 *)      val="$undef";;
5807                 esac
5808         fi
5809 else
5810         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
5811         echo "(That's for file descriptors, not floppy disks.)"
5812         val="$undef"
5813 fi
5814 set d_suidsafe
5815 eval $setvar
5816
5817 $rm -f reflect flect
5818
5819 : now see if they want to do setuid emulation
5820 echo " "
5821 val="$undef"
5822 case "$d_suidsafe" in
5823 "$define")
5824         val="$undef"
5825         echo "No need to emulate SUID scripts since they are secure here." >& 4
5826         ;;
5827 *)
5828         $cat <<EOM
5829 Some systems have disabled setuid scripts, especially systems where
5830 setuid scripts cannot be secure.  On systems where setuid scripts have
5831 been disabled, the setuid/setgid bits on scripts are currently
5832 useless.  It is possible for $package to detect those bits and emulate
5833 setuid/setgid in a secure fashion.  This emulation will only work if
5834 setuid scripts have been disabled in your kernel.
5835
5836 EOM
5837         case "$d_dosuid" in
5838         "$define") dflt=y ;;
5839         *) dflt=n ;;
5840         esac
5841         rp="Do you want to do setuid/setgid emulation?"
5842         . ./myread
5843         case "$ans" in
5844         [yY]*)  val="$define";;
5845         *)      val="$undef";;
5846         esac
5847         ;;
5848 esac
5849 set d_dosuid
5850 eval $setvar
5851
5852 : determine filename position in cpp output
5853 echo " "
5854 echo "Computing filename position in cpp output for #include directives..." >&4
5855 echo '#include <stdio.h>' > foo.c
5856 $cat >fieldn <<EOF
5857 $startsh
5858 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5859 $grep '^[       ]*#.*stdio\.h' | \
5860 while read cline; do
5861         pos=1
5862         set \$cline
5863         while $test \$# -gt 0; do
5864                 if $test -r \`echo \$1 | $tr -d '"'\`; then
5865                         echo "\$pos"
5866                         exit 0
5867                 fi
5868                 shift
5869                 pos=\`expr \$pos + 1\`
5870         done
5871 done
5872 EOF
5873 chmod +x fieldn
5874 fieldn=`./fieldn`
5875 $rm -f foo.c fieldn
5876 case $fieldn in
5877 '') pos='???';;
5878 1) pos=first;;
5879 2) pos=second;;
5880 3) pos=third;;
5881 *) pos="${fieldn}th";;
5882 esac
5883 echo "Your cpp writes the filename in the $pos field of the line."
5884
5885 : locate header file
5886 $cat >findhdr <<EOF
5887 $startsh
5888 wanted=\$1
5889 name=''
5890 for usrincdir in $usrinc
5891 do
5892         if test -f \$usrincdir/\$wanted; then
5893                 echo "\$usrincdir/\$wanted"
5894                 exit 0
5895         fi
5896 done
5897 awkprg='{ print \$$fieldn }'
5898 echo "#include <\$wanted>" > foo\$\$.c
5899 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5900 $grep "^[       ]*#.*\$wanted" | \
5901 while read cline; do
5902         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5903         case "\$name" in
5904         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5905         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5906         *) exit 2;;
5907         esac;
5908 done;
5909 #
5910 # status = 0: grep returned 0 lines, case statement not executed
5911 # status = 1: headerfile found
5912 # status = 2: while loop executed, no headerfile found
5913 #
5914 status=\$?
5915 $rm -f foo\$\$.c;
5916 if test \$status -eq 1; then
5917         exit 0;
5918 fi
5919 exit 1
5920 EOF
5921 chmod +x findhdr
5922
5923 : define an alternate in-header-list? function
5924 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5925 cont=true; xxf="echo \"<\$1> found.\" >&4";
5926 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5927 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5928 esac;
5929 case $# in 4) instead=instead;; *) instead="at last";; esac;
5930 while $test "$cont"; do
5931         xxx=`./findhdr $1`
5932         var=$2; eval "was=\$$2";
5933         if $test "$xxx" && $test -r "$xxx";
5934         then eval $xxf;
5935         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5936                 cont="";
5937         else eval $xxnf;
5938         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5939         set $yyy; shift; shift; yyy=$@;
5940         case $# in 0) cont="";;
5941         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5942                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5943         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5944                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5945         esac;
5946 done;
5947 while $test "$yyy";
5948 do set $yyy; var=$2; eval "was=\$$2";
5949         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5950         set $yyy; shift; shift; yyy=$@;
5951 done'
5952
5953 : see if this is a malloc.h system
5954 set malloc.h i_malloc
5955 eval $inhdr
5956
5957 : see if stdlib is available
5958 set stdlib.h i_stdlib
5959 eval $inhdr
5960
5961 : determine which malloc to compile in
5962 echo " "
5963 case "$usemymalloc" in
5964 ''|[yY]*|true|$define)  dflt='y' ;;
5965 *)      dflt='n' ;;
5966 esac
5967 rp="Do you wish to attempt to use the malloc that comes with $package?"
5968 . ./myread
5969 usemymalloc="$ans"
5970 case "$ans" in
5971 y*|true)
5972         usemymalloc='y'
5973         mallocsrc='malloc.c'
5974         mallocobj="malloc$_o"
5975         d_mymalloc="$define"
5976         case "$libs" in
5977         *-lmalloc*)
5978                 : Remove malloc from list of libraries to use
5979                 echo "Removing unneeded -lmalloc from library list" >&4
5980                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
5981                 shift
5982                 libs="$*"
5983                 echo "libs = $libs" >&4
5984                 ;;
5985         esac
5986         ;;
5987 *)
5988         usemymalloc='n'
5989         mallocsrc=''
5990         mallocobj=''
5991         d_mymalloc="$undef"
5992         ;;
5993 esac
5994
5995 : compute the return types of malloc and free
5996 echo " "
5997 $cat >malloc.c <<END
5998 #$i_malloc I_MALLOC
5999 #$i_stdlib I_STDLIB
6000 #include <stdio.h>
6001 #include <sys/types.h>
6002 #ifdef I_MALLOC
6003 #include <malloc.h>
6004 #endif
6005 #ifdef I_STDLIB
6006 #include <stdlib.h>
6007 #endif
6008 #ifdef TRY_MALLOC
6009 void *malloc();
6010 #endif
6011 #ifdef TRY_FREE
6012 void free();
6013 #endif
6014 END
6015 case "$malloctype" in
6016 '')
6017         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
6018                 malloctype='void *'
6019         else
6020                 malloctype='char *'
6021         fi
6022         ;;
6023 esac
6024 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
6025
6026 case "$freetype" in
6027 '')
6028         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
6029                 freetype='void'
6030         else
6031                 freetype='int'
6032         fi
6033         ;;
6034 esac
6035 echo "Your system uses $freetype free(), it would seem." >&4
6036 $rm -f malloc.[co]
6037 $cat <<EOM
6038
6039 After $package is installed, you may wish to install various
6040 add-on modules and utilities.  Typically, these add-ons will
6041 be installed under $prefix with the rest
6042 of this package.  However, you may wish to install such add-ons
6043 elsewhere under a different prefix.
6044
6045 If you do not wish to put everything under a single prefix, that's
6046 ok.  You will be prompted for the individual locations; this siteprefix
6047 is only used to suggest the defaults.
6048
6049 The default should be fine for most people.
6050
6051 EOM
6052 fn=d~+
6053 rp='Installation prefix to use for add-on modules and utilities?'
6054 : XXX Here might be another good place for an installstyle setting.
6055 case "$siteprefix" in
6056 '') dflt=$prefix ;;
6057 *)  dflt=$siteprefix ;;
6058 esac
6059 . ./getfile
6060 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6061 oldsiteprefix=''
6062 case "$siteprefix" in
6063 '') ;;
6064 *)      case "$ans" in
6065         "$prefix") ;;
6066         *) oldsiteprefix="$prefix";;
6067         esac
6068         ;;
6069 esac
6070 siteprefix="$ans"
6071 siteprefixexp="$ansexp"
6072
6073 : determine where site specific libraries go.
6074 : Usual default is /usr/local/lib/perl5/site_perl/$version
6075 : The default "style" setting is made in installstyle.U
6076 : XXX No longer works with Prefixit stuff.
6077 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6078 case "$sitelib" in
6079 '') case "$installstyle" in
6080         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
6081         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
6082         esac
6083         ;;
6084 *)      dflt="$sitelib"
6085         ;;
6086 esac
6087 $cat <<EOM
6088
6089 The installation process will create a directory for
6090 site-specific extensions and modules.  Most users find it convenient
6091 to place all site-specific files in this directory rather than in the
6092 main distribution directory.
6093
6094 EOM
6095 fn=d~+
6096 rp='Pathname for the site-specific library files?'
6097 . ./getfile
6098 sitelib="$ans"
6099 sitelibexp="$ansexp"
6100 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
6101 : Change installation prefix, if necessary.
6102 if $test X"$prefix" != X"$installprefix"; then
6103         installsitelib=`echo $sitelibexp | $sed "s#^$prefix#$installprefix#"`
6104 else
6105         installsitelib="$sitelibexp"
6106 fi
6107
6108 : determine where site specific architecture-dependent libraries go.
6109 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
6110 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
6111 : sitelib may have an optional trailing /share.
6112 case "$sitearch" in
6113 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
6114         dflt="$dflt/$archname"
6115         ;;
6116 *)      dflt="$sitearch"
6117         ;;
6118 esac
6119 set sitearch sitearch none
6120 eval $prefixit
6121 $cat <<EOM
6122
6123 The installation process will also create a directory for
6124 architecture-dependent site-specific extensions and modules.
6125
6126 EOM
6127 fn=d~+
6128 rp='Pathname for the site-specific architecture-dependent library files?'
6129 . ./getfile
6130 sitearch="$ans"
6131 sitearchexp="$ansexp"
6132 : Change installation prefix, if necessary.
6133 if $test X"$prefix" != X"$installprefix"; then
6134         installsitearch=`echo $sitearchexp | sed "s#^$prefix#$installprefix#"`
6135 else
6136         installsitearch="$sitearchexp"
6137 fi
6138
6139 $cat <<EOM
6140
6141 The installation process will also create a directory for
6142 vendor-supplied add-ons.  Vendors who supply perl with their system
6143 may find it convenient to place all vendor-supplied files in this
6144 directory rather than in the main distribution directory.  This will
6145 ease upgrades between binary-compatible maintenance versions of perl.
6146
6147 Of course you may also use these directories in whatever way you see
6148 fit.  For example, you might use them to access modules shared over a
6149 company-wide network.
6150
6151 The default answer should be fine for most people.
6152 This causes further questions about vendor add-ons to be skipped
6153 and no vendor-specific directories will be configured for perl.
6154
6155 EOM
6156 rp='Do you want to configure vendor-specific add-on directories?'
6157 case "$usevendorprefix" in
6158 define|true|[yY]*) dflt=y ;;
6159 *)      : User may have set vendorprefix directly on Configure command line.
6160         case "$vendorprefix" in
6161         ''|' ') dflt=n ;;
6162         *)      dflt=y ;;
6163         esac
6164         ;;
6165 esac
6166 . ./myread
6167 case "$ans" in
6168 [yY]*)  fn=d~+
6169         rp='Installation prefix to use for vendor-supplied add-ons?'
6170         case "$vendorprefix" in
6171         '') dflt='' ;;
6172         *)  dflt=$vendorprefix ;;
6173         esac
6174         . ./getfile
6175         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6176         oldvendorprefix=''
6177         case "$vendorprefix" in
6178         '') ;;
6179         *)      case "$ans" in
6180                 "$prefix") ;;
6181                 *) oldvendorprefix="$prefix";;
6182                 esac
6183                 ;;
6184         esac
6185         usevendorprefix="$define"
6186         vendorprefix="$ans"
6187         vendorprefixexp="$ansexp"
6188         ;;
6189 *)      usevendorprefix="$undef"
6190         vendorprefix=''
6191         vendorprefixexp=''
6192         ;;
6193 esac
6194
6195 case "$vendorprefix" in
6196 '')     d_vendorlib="$undef"
6197         vendorlib=''
6198         vendorlibexp=''
6199         ;;
6200 *)      d_vendorlib="$define"
6201         : determine where vendor-supplied modules go.
6202         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
6203         case "$vendorlib" in
6204         '')
6205                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6206                 case "$installstyle" in
6207                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
6208                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
6209                 esac
6210                 ;;
6211         *)      dflt="$vendorlib"
6212                 ;;
6213         esac
6214         fn=d~+
6215         rp='Pathname for the vendor-supplied library files?'
6216         . ./getfile
6217         vendorlib="$ans"
6218         vendorlibexp="$ansexp"
6219         ;;
6220 esac
6221 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
6222 : Change installation prefix, if necessary.
6223 if $test X"$prefix" != X"$installprefix"; then
6224         installvendorlib=`echo $vendorlibexp | $sed "s#^$prefix#$installprefix#"`
6225 else
6226         installvendorlib="$vendorlibexp"
6227 fi
6228
6229 case "$vendorprefix" in
6230 '')     d_vendorarch="$undef"
6231         vendorarch=''
6232         vendorarchexp=''
6233         ;;
6234 *)      d_vendorarch="$define"
6235         : determine where vendor-supplied architecture-dependent libraries go.
6236         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
6237         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
6238         : vendorlib may have an optional trailing /share.
6239         case "$vendorarch" in
6240         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
6241                 dflt="$dflt/$archname"
6242                 ;;
6243         *)      dflt="$vendorarch" ;;
6244         esac
6245         fn=d~+
6246         rp='Pathname for vendor-supplied architecture-dependent files?'
6247         . ./getfile
6248         vendorarch="$ans"
6249         vendorarchexp="$ansexp"
6250         ;;
6251 esac
6252 : Change installation prefix, if necessary.
6253 if $test X"$prefix" != X"$installprefix"; then
6254         installvendorarch=`echo $vendorarchexp | sed "s#^$prefix#$installprefix#"`
6255 else
6256         installvendorarch="$vendorarchexp"
6257 fi
6258
6259 : Final catch-all directories to search
6260 $cat <<EOM
6261
6262 Lastly, you can have perl look in other directories for extensions and
6263 modules in addition to those already specified.
6264 These directories will be searched after 
6265         $sitearch 
6266         $sitelib 
6267 EOM
6268 test X"$vendorlib" != "X" && echo '     ' $vendorlib
6269 test X"$vendorarch" != "X" && echo '    ' $vendorarch
6270 echo ' '
6271 case "$otherlibdirs" in
6272 ''|' ') dflt='none' ;;
6273 *)      dflt="$otherlibdirs" ;;
6274 esac
6275 $cat <<EOM
6276 Enter a colon-separated set of extra paths to include in perl's @INC
6277 search path, or enter 'none' for no extra paths.
6278
6279 EOM
6280
6281 rp='Colon-separated list of additional directories for perl to search?'
6282 . ./myread
6283 case "$ans" in
6284 ' '|''|none)    otherlibdirs=' ' ;;     
6285 *)      otherlibdirs="$ans" ;;
6286 esac
6287 case "$otherlibdirs" in
6288 ' ') val=$undef ;;
6289 *)      val=$define ;;
6290 esac
6291 set d_perl_otherlibdirs
6292 eval $setvar
6293
6294 : Cruising for prototypes
6295 echo " "
6296 echo "Checking out function prototypes..." >&4
6297 $cat >prototype.c <<'EOCP'
6298 int main(int argc, char *argv[]) {
6299         exit(0);}
6300 EOCP
6301 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
6302         echo "Your C compiler appears to support function prototypes."
6303         val="$define"
6304 else
6305         echo "Your C compiler doesn't seem to understand function prototypes."
6306         val="$undef"
6307 fi
6308 set prototype
6309 eval $setvar
6310 $rm -f prototype*
6311
6312 case "$prototype" in
6313 "$define") ;;
6314 *)      ansi2knr='ansi2knr'
6315         echo " "
6316         cat <<EOM >&4
6317
6318 $me:  FATAL ERROR:
6319 This version of $package can only be compiled by a compiler that 
6320 understands function prototypes.  Unfortunately, your C compiler 
6321         $cc $ccflags
6322 doesn't seem to understand them.  Sorry about that.
6323
6324 If GNU cc is available for your system, perhaps you could try that instead.  
6325
6326 Eventually, we hope to support building Perl with pre-ANSI compilers.
6327 If you would like to help in that effort, please contact <perlbug@perl.org>.
6328
6329 Aborting Configure now.
6330 EOM
6331         exit 2
6332         ;;
6333 esac
6334
6335 : determine where public executables go
6336 echo " "
6337 set dflt bin bin
6338 eval $prefixit
6339 fn=d~
6340 rp='Pathname where the public executables will reside?'
6341 . ./getfile
6342 if $test "X$ansexp" != "X$binexp"; then
6343         installbin=''
6344 fi
6345 bin="$ans"
6346 binexp="$ansexp"
6347 : Change installation prefix, if necessary.
6348 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
6349 if $test X"$prefix" != X"$installprefix"; then
6350         installbin=`echo $binexp | sed "s#^$prefix#$installprefix#"`
6351 else
6352         installbin="$binexp"
6353 fi
6354
6355 : Find perl5.005 or later.
6356 echo "Looking for a previously installed perl5.005 or later... "
6357 case "$perl5" in
6358 '')     for tdir in `echo "$binexp:$PATH" | $sed "s/$path_sep/ /g"`; do
6359                 : Check if this perl is recent and can load a simple module
6360                 if $test -x $tdir/perl && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6361                         perl5=$tdir/perl
6362                         break;
6363                 elif $test -x $tdir/perl5 && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6364                         perl5=$tdir/perl
6365                         break;
6366                 fi
6367         done
6368         ;;
6369 *)      perl5="$perl5"
6370         ;;
6371 esac
6372 case "$perl5" in
6373 '')     echo "None found.  That's ok.";;
6374 *)      echo "Using $perl5." ;;
6375 esac
6376
6377 : Determine list of previous versions to include in @INC
6378 $cat > getverlist <<EOPL
6379 #!$perl5 -w
6380 use File::Basename;
6381 \$api_versionstring = "$api_versionstring";
6382 \$version = "$version";
6383 \$stem = "$sitelib_stem";
6384 \$archname = "$archname";
6385 EOPL
6386         $cat >> getverlist <<'EOPL'
6387 # Can't have leading @ because metaconfig interprets it as a command!
6388 ;@inc_version_list=();
6389 # XXX Redo to do opendir/readdir? 
6390 if (-d $stem) {
6391     chdir($stem);
6392     ;@candidates = glob("5.*");
6393 }
6394 else {
6395     ;@candidates = ();
6396 }
6397
6398 # XXX ToDo:  These comparisons must be reworked when two-digit
6399 # subversions come along, so that 5.7.10 compares as greater than
6400 # 5.7.3!  By that time, hope that 5.6.x is sufficiently
6401 # widespread that we can use the built-in version vectors rather
6402 # than reinventing them here.  For 5.6.0, however, we must
6403 # assume this script will likely be run by 5.005_0x.  --AD 1/2000.
6404 foreach $d (@candidates) {
6405     if ($d lt $version) {
6406         if ($d ge $api_versionstring) {
6407             unshift(@inc_version_list, grep { -d } "$d/$archname", $d);
6408         }
6409         elsif ($d ge "5.005") {
6410             unshift(@inc_version_list, grep { -d } $d);
6411         }
6412     }
6413     else {
6414         # Skip newer version.  I.e. don't look in
6415         # 5.7.0 if we're installing 5.6.1.
6416     }
6417 }
6418
6419 if (@inc_version_list) {
6420     print join(' ', @inc_version_list);
6421 }
6422 else {
6423     # Blank space to preserve value for next Configure run.
6424     print " ";
6425 }
6426 EOPL
6427 chmod +x getverlist
6428 case "$inc_version_list" in
6429 '')     if test -x "$perl5"; then
6430                 dflt=`$perl5 getverlist`
6431         else
6432                 dflt='none'
6433         fi
6434         ;;
6435 $undef) dflt='none' ;;
6436 *)  dflt="$inc_version_list" ;;
6437 esac
6438 case "$dflt" in
6439 ''|' ') dflt=none ;;
6440 esac
6441 case "$dflt" in
6442 5.005) case "$bincompat5005" in
6443        $define|true|[yY]*) ;;
6444        *) dflt=none ;;
6445        esac
6446        ;;
6447 esac
6448 $cat <<'EOM'
6449
6450 In order to ease the process of upgrading, this version of perl 
6451 can be configured to use modules built and installed with earlier 
6452 versions of perl that were installed under $prefix.  Specify here
6453 the list of earlier versions that this version of perl should check.
6454 If Configure detected no earlier versions of perl installed under
6455 $prefix, then the list will be empty.  Answer 'none' to tell perl
6456 to not search earlier versions.
6457
6458 The default should almost always be sensible, so if you're not sure,
6459 just accept the default.
6460 EOM
6461
6462 rp='List of earlier versions to include in @INC?'
6463 . ./myread
6464 case "$ans" in
6465 [Nn]one|''|' ') inc_version_list=' ' ;;
6466 *) inc_version_list="$ans" ;;
6467 esac
6468 case "$inc_version_list" in
6469 ''|' ') 
6470         inc_version_list_init='0';;
6471 *)      inc_version_list_init=`echo $inc_version_list |
6472                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
6473         ;;
6474 esac
6475 $rm -f getverlist
6476
6477 : determine whether to install perl also as /usr/bin/perl
6478
6479 echo " "
6480 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
6481         $cat <<EOM
6482 Many scripts expect perl to be installed as /usr/bin/perl.
6483 I can install the perl you are about to compile also as /usr/bin/perl
6484 (in addition to $installbin/perl).
6485 EOM
6486         case "$installusrbinperl" in
6487         "$undef"|[nN]*) dflt='n';;
6488         *)              dflt='y';;
6489         esac
6490         rp="Do you want to install perl as /usr/bin/perl?"
6491         . ./myread
6492         case "$ans" in
6493         [yY]*)  val="$define";;
6494         *)      val="$undef" ;;
6495         esac
6496 else
6497         val="$undef"
6498 fi
6499 set installusrbinperl
6500 eval $setvar
6501
6502 : see if dld is available
6503 set dld.h i_dld
6504 eval $inhdr
6505
6506 : see if dlopen exists
6507 xxx_runnm="$runnm"
6508 runnm=false
6509 set dlopen d_dlopen
6510 eval $inlibc
6511 runnm="$xxx_runnm"
6512
6513 : determine which dynamic loading, if any, to compile in
6514 echo " "
6515 dldir="ext/DynaLoader"
6516 case "$usedl" in
6517 $define|y|true)
6518         dflt='y'
6519         usedl="$define"
6520         ;;
6521 $undef|n|false)
6522         dflt='n'
6523         usedl="$undef"
6524         ;;
6525 *) 
6526         dflt='n'
6527         case "$d_dlopen" in
6528             $define) dflt='y' ;;
6529         esac
6530         case "$i_dld" in
6531             $define) dflt='y' ;;
6532         esac
6533         : Does a dl_xxx.xs file exist for this operating system
6534         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
6535         ;;
6536 esac
6537 rp="Do you wish to use dynamic loading?"
6538 . ./myread
6539 usedl="$ans"
6540 case "$ans" in
6541 y*) usedl="$define"
6542         case "$dlsrc" in
6543         '')
6544                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
6545                         dflt="$dldir/dl_${osname}.xs"
6546                 elif $test "$d_dlopen" = "$define" ; then
6547                         dflt="$dldir/dl_dlopen.xs"
6548                 elif $test "$i_dld" = "$define" ; then
6549                         dflt="$dldir/dl_dld.xs"
6550                 else
6551                         dflt=''
6552                 fi
6553                 ;;
6554         *)      dflt="$dldir/$dlsrc"
6555                 ;;
6556         esac
6557     echo "The following dynamic loading files are available:"
6558         : Can not go over to $dldir because getfile has path hard-coded in.
6559         tdir=`pwd`; cd $rsrc; $ls -C $dldir/dl*.xs; cd $tdir
6560         rp="Source file to use for dynamic loading"
6561         fn="fne"
6562         gfpth="$src"
6563         . ./getfile
6564         usedl="$define"
6565         : emulate basename
6566         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
6567
6568         $cat << EOM
6569
6570 Some systems may require passing special flags to $cc -c to
6571 compile modules that will be used to create a shared library.
6572 To use no flags, say "none".
6573
6574 EOM
6575     case "$cccdlflags" in
6576     '') case "$gccversion" in
6577                 '') case "$osname" in
6578                         hpux)   dflt='+z' ;;
6579                         next)   dflt='none' ;;
6580                         irix*)  dflt='-KPIC' ;;
6581                         svr4*|esix*|solaris) dflt='-KPIC' ;;
6582                         sunos)  dflt='-pic' ;;
6583                         *)      dflt='none' ;;
6584                     esac
6585                         ;;
6586                 *)  case "$osname" in
6587                         svr4*|esix*|solaris) dflt='-fPIC' ;;
6588                         *)      dflt='-fpic' ;;
6589                     esac ;;
6590             esac ;;
6591         ' ') dflt='none' ;;
6592     *)  dflt="$cccdlflags" ;;
6593     esac
6594     rp="Any special flags to pass to $cc -c to compile shared library modules?"
6595     . ./myread
6596     case "$ans" in
6597     none) cccdlflags=' ' ;;
6598     *) cccdlflags="$ans" ;;
6599     esac
6600
6601     cat << EOM
6602
6603 Some systems use ld to create libraries that can be dynamically loaded,
6604 while other systems (such as those using ELF) use $cc.
6605
6606 EOM
6607         case "$ld" in
6608         '')     $cat >try.c <<'EOM'
6609 /* Test for whether ELF binaries are produced */
6610 #include <fcntl.h>
6611 #include <stdlib.h>
6612 int main() {
6613         char b[4];
6614         int i = open("a.out",O_RDONLY);
6615         if(i == -1) 
6616                 exit(1); /* fail */
6617         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
6618                 exit(0); /* succeed (yes, it's ELF) */
6619         else
6620                 exit(1); /* fail */
6621 }
6622 EOM
6623                 if $cc $ccflags try.c >/dev/null 2>&1 && ./a.out; then
6624                         cat <<EOM
6625 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
6626 EOM
6627                         dflt="$cc"
6628                 else
6629                         echo "I'll use ld to build dynamic libraries."
6630                         dflt='ld'
6631                 fi
6632                 rm -f try.c a.out
6633                 ;;
6634         *)      dflt="$ld"
6635                 ;;
6636         esac
6637
6638     rp="What command should be used to create dynamic libraries?"
6639     . ./myread
6640         ld="$ans"
6641
6642     cat << EOM
6643
6644 Some systems may require passing special flags to $ld to create a
6645 library that can be dynamically loaded.  If your ld flags include
6646 -L/other/path options to locate libraries outside your loader's normal
6647 search path, you may need to specify those -L options here as well.  To
6648 use no flags, say "none".
6649
6650 EOM
6651     case "$lddlflags" in
6652     '') case "$osname" in
6653                         beos) dflt='-nostart' ;;
6654                         hpux) dflt='-b';
6655                               case "$gccversion" in
6656                               '') dflt="$dflt +vnocompatwarnings" ;;
6657                               esac
6658                               ;;        
6659                         linux|irix*)    dflt='-shared' ;;
6660                         next)  dflt='none' ;;
6661                         solaris) dflt='-G' ;;
6662                         sunos) dflt='-assert nodefinitions' ;;
6663                         svr4*|esix*) dflt="-G $ldflags" ;;
6664                 *)     dflt='none' ;;
6665                         esac
6666                         ;;
6667     *) dflt="$lddlflags" ;;
6668     esac
6669
6670         : Try to guess additional flags to pick up local libraries.
6671         : Be careful not to append to a plain 'none'
6672         case "$dflt" in
6673         none) dflt='' ;;
6674         esac
6675         for thisflag in $ldflags; do
6676                 case "$thisflag" in
6677                 -L*|-R*)
6678                         case " $dflt " in
6679                         *" $thisflag "*) ;;
6680                         *) dflt="$dflt $thisflag" ;;
6681                         esac
6682                         ;;
6683                 esac
6684         done
6685
6686         case "$dflt" in
6687         ''|' ') dflt='none' ;;
6688         esac
6689
6690     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
6691     . ./myread
6692     case "$ans" in
6693     none) lddlflags=' ' ;;
6694     *) lddlflags="$ans" ;;
6695     esac
6696
6697         cat <<EOM
6698
6699 Some systems may require passing special flags to $cc to indicate that
6700 the resulting executable will use dynamic linking.  To use no flags,
6701 say "none".
6702
6703 EOM
6704     case "$ccdlflags" in
6705     '') case "$osname" in
6706                 hpux)   dflt='-Wl,-E' ;;
6707                 linux)  dflt='-rdynamic' ;;
6708                 next)   dflt='none' ;;
6709                 sunos)  dflt='none' ;;
6710                 *)      dflt='none' ;;
6711             esac ;;
6712     ' ')  dflt='none' ;;
6713     *)  dflt="$ccdlflags" ;;
6714     esac
6715     rp="Any special flags to pass to $cc to use dynamic linking?"
6716     . ./myread
6717     case "$ans" in
6718     none) ccdlflags=' ' ;;
6719     *) ccdlflags="$ans" ;;
6720     esac
6721     ;;
6722 *)  usedl="$undef"
6723         ld='ld'
6724     dlsrc='dl_none.xs'
6725     lddlflags=''
6726     ccdlflags=''
6727     ;;
6728 esac
6729
6730 also=''
6731 case "$usedl" in
6732 $undef)
6733         # No dynamic loading being used, so don't bother even to prompt.
6734         useshrplib='false'
6735         ;;
6736 *)      case "$useshrplib" in
6737         '')     case "$osname" in
6738                 svr4*|dgux|dynixptx|esix|powerux|beos|cygwin*)
6739                         dflt=y
6740                         also='Building a shared libperl is required for dynamic loading to work on your system.'
6741                         ;;
6742                 next*)
6743                         case "$osvers" in
6744                         4*)     dflt=y
6745                                 also='Building a shared libperl is needed for MAB support.'
6746                                 ;;
6747                         *)      dflt=n
6748                                 ;;
6749                         esac
6750                         ;;
6751                 *)      dflt=n
6752                         ;;
6753                 esac
6754                 ;;
6755         $define|true|[Yy]*)
6756                 dflt=y
6757                 ;;
6758         *)      dflt=n
6759                 ;;
6760         esac
6761         $cat << EOM
6762
6763 The perl executable is normally obtained by linking perlmain.c with
6764 libperl${_a}, any static extensions (usually just DynaLoader), and
6765 any other libraries needed on this system (such as -lm, etc.).  Since
6766 your system supports dynamic loading, it is probably possible to build
6767 a shared libperl.$so.  If you will have more than one executable linked
6768 to libperl.$so, this will significantly reduce the size of each
6769 executable, but it may have a noticeable affect on performance.  The
6770 default is probably sensible for your system.
6771 $also
6772
6773 EOM
6774         rp="Build a shared libperl.$so (y/n)"
6775         . ./myread
6776         case "$ans" in
6777         true|$define|[Yy]*)
6778                 useshrplib='true'  ;;
6779         *)      useshrplib='false' ;;
6780         esac
6781         ;;
6782 esac
6783
6784 case "$useshrplib" in
6785 true)
6786         case "$libperl" in
6787         '')
6788                 # Figure out a good name for libperl.so.  Since it gets stored in
6789                 # a version-specific architecture-dependent library, the version
6790                 # number isn't really that important, except for making cc/ld happy.
6791                 #
6792                 # A name such as libperl.so.3.1
6793                 majmin="libperl.$so.$patchlevel.$subversion"
6794                 # A name such as libperl.so.301
6795                 majonly=`echo $patchlevel $subversion |
6796                         $awk '{printf "%d%02d", $1, $2}'`
6797                 majonly=libperl.$so.$majonly
6798                 # I'd prefer to keep the os-specific stuff here to a minimum, and
6799                 # rely on figuring it out from the naming of libc.
6800                 case "${osname}${osvers}" in
6801                 next4*)
6802                         dflt=libperl.5.$so
6803                         # XXX How handle the --version stuff for MAB?
6804                         ;;
6805                 linux*)  # ld won't link with a bare -lperl otherwise.
6806                         dflt=libperl.$so
6807                         ;;
6808                 cygwin*) # include version
6809                         dflt=`echo libperl$version | sed -e 's/\./_/g'`$lib_ext
6810                         ;;
6811                 *)      # Try to guess based on whether libc has major.minor.
6812                         case "$libc" in
6813                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
6814                         *libc.$so.[0-9]*) dflt=$majonly ;;
6815                         *)      dflt=libperl.$so ;;
6816                         esac
6817                         ;;
6818                 esac
6819                 ;;
6820         *)      dflt=$libperl
6821                 ;;
6822         esac
6823         cat << EOM
6824
6825 I need to select a good name for the shared libperl.  If your system uses
6826 library names with major and minor numbers, then you might want something
6827 like $majmin.  Alternatively, if your system uses a single version
6828 number for shared libraries, then you might want to use $majonly.
6829 Or, your system might be quite happy with a simple libperl.$so.
6830
6831 Since the shared libperl will get installed into a version-specific
6832 architecture-dependent directory, the version number of the shared perl
6833 library probably isn't important, so the default should be o.k.
6834
6835 EOM
6836         rp='What name do you want to give to the shared libperl?'
6837         . ./myread
6838         libperl=$ans
6839         echo "Ok, I'll use $libperl"
6840         ;;
6841 *)
6842         libperl="libperl${_a}"
6843         ;;
6844 esac
6845
6846 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
6847 case "$shrpdir" in
6848 '') ;;
6849 *)      $cat >&4 <<EOM
6850 WARNING:  Use of the shrpdir variable for the installation location of
6851 the shared $libperl is not supported.  It was never documented and
6852 will not work in this version.  Let me (perlbug@perl.org)
6853 know of any problems this may cause.
6854
6855 EOM
6856         case "$shrpdir" in
6857         "$archlibexp/CORE")
6858                 $cat >&4 <<EOM
6859 But your current setting of $shrpdir is
6860 the default anyway, so it's harmless.
6861 EOM
6862                 ;;
6863         *)
6864                 $cat >&4 <<EOM
6865 Further, your current attempted setting of $shrpdir
6866 conflicts with the value of $archlibexp/CORE
6867 that installperl will use.
6868 EOM
6869                 ;;
6870         esac
6871         ;;
6872 esac
6873
6874 # How will the perl executable find the installed shared $libperl?
6875 # Add $xxx to ccdlflags.
6876 # If we can't figure out a command-line option, use $shrpenv to
6877 # set env LD_RUN_PATH.  The main perl makefile uses this.
6878 shrpdir=$archlibexp/CORE
6879 xxx=''
6880 tmp_shrpenv=''
6881 if "$useshrplib"; then
6882     case "$osname" in 
6883         aix)
6884                 # We'll set it in Makefile.SH...
6885                 ;;
6886         solaris|netbsd)
6887                 xxx="-R $shrpdir"
6888                 ;;
6889         freebsd)
6890                 xxx="-Wl,-R$shrpdir"
6891                 ;;
6892         linux|irix*|dec_osf)
6893                 xxx="-Wl,-rpath,$shrpdir"
6894                 ;;
6895         next)
6896                 # next doesn't like the default...
6897                 ;;
6898         beos)
6899                 # beos doesn't like the default, either.
6900                 ;;
6901         hpux*)
6902                 # hpux doesn't like the default, either.
6903                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
6904                 ;;
6905         *)
6906                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
6907                 ;;
6908         esac
6909         case "$xxx" in
6910         '') ;;
6911         *)      
6912                 # Only add $xxx if it isn't already in ccdlflags.
6913                 case " $ccdlflags " in
6914                 *" $xxx "*)     ;;
6915                 *)      ccdlflags="$ccdlflags $xxx"
6916                         cat <<EOM >&4
6917
6918 Adding $xxx to the flags
6919 passed to $ld so that the perl executable will find the 
6920 installed shared $libperl.
6921
6922 EOM
6923                         ;;
6924                 esac
6925                 ;;
6926         esac
6927 fi
6928 # Fix ccdlflags in AIX for building external extensions.
6929 # (For building Perl itself bare -bE:perl.exp is needed,
6930 #  Makefile.SH takes care of this.)
6931 case "$osname" in
6932 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
6933 esac
6934 # Respect a hint or command-line value.
6935 case "$shrpenv" in
6936 '') shrpenv="$tmp_shrpenv" ;;
6937 esac
6938 case "$ldlibpthname" in
6939 '')     ldlibpthname=LD_LIBRARY_PATH ;;
6940 none)   ldlibpthname='' ;;
6941 esac
6942
6943 : determine where manual pages go
6944 set man1dir man1dir none
6945 eval $prefixit
6946 $cat <<EOM
6947
6948 $spackage has manual pages available in source form.
6949 EOM
6950 case "$nroff" in
6951 nroff)
6952         echo "However, you don't have nroff, so they're probably useless to you."
6953         case "$man1dir" in
6954         '') man1dir="none";;
6955         esac;;
6956 esac
6957 echo "If you don't want the manual sources installed, answer 'none'."
6958 case "$man1dir" in
6959 ' ') dflt=none
6960         ;;
6961 '')
6962         lookpath="$prefixexp/man/man1 $prefixexp/man/l_man/man1"
6963         lookpath="$lookpath $prefixexp/man/p_man/man1"
6964         lookpath="$lookpath $prefixexp/man/u_man/man1"
6965         lookpath="$lookpath $prefixexp/man/man.1"
6966         case "$sysman" in
6967         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
6968         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
6969         esac
6970         set dflt
6971         eval $prefixup
6972         ;;
6973 *)  dflt="$man1dir"
6974         ;;
6975 esac
6976 echo " "
6977 fn=dn+~
6978 rp="Where do the main $spackage manual pages (source) go?"
6979 . ./getfile
6980 if $test "X$man1direxp" != "X$ansexp"; then
6981         installman1dir=''
6982 fi
6983 man1dir="$ans"
6984 man1direxp="$ansexp"
6985 case "$man1dir" in
6986 '')     man1dir=' '
6987         installman1dir='';;
6988 esac
6989
6990 : Change installation prefix, if necessary.
6991 if $test X"$prefix" != X"$installprefix"; then
6992         installman1dir=`echo $man1direxp | $sed "s#^$prefix#$installprefix#"`
6993 else
6994         installman1dir="$man1direxp"
6995 fi
6996
6997 : What suffix to use on installed man pages
6998
6999 case "$man1dir" in
7000 ' ')
7001         man1ext='0'
7002         ;;
7003 *)
7004         rp="What suffix should be used for the main $spackage man pages?"
7005         case "$man1ext" in
7006         '')     case "$man1dir" in
7007                 *1)  dflt=1 ;;
7008                 *1p) dflt=1p ;;
7009                 *1pm) dflt=1pm ;;
7010                 *l) dflt=l;;
7011                 *n) dflt=n;;
7012                 *o) dflt=o;;
7013                 *p) dflt=p;;
7014                 *C) dflt=C;;
7015                 *L) dflt=L;;
7016                 *L1) dflt=L1;;
7017                 *) dflt=1;;
7018                 esac
7019                 ;;
7020         *)      dflt="$man1ext";;
7021         esac
7022         . ./myread
7023         man1ext="$ans"
7024         ;;
7025 esac
7026
7027 : see if we can have long filenames
7028 echo " "
7029 first=123456789abcdef
7030 $rm -f $first
7031 if (echo hi >$first) 2>/dev/null; then
7032         if $test -f 123456789abcde; then
7033                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
7034                 val="$undef"
7035         else
7036                 echo 'You can have filenames longer than 14 characters.'>&4
7037                 val="$define"
7038         fi
7039 else
7040         $cat <<'EOM'
7041 You can't have filenames longer than 14 chars.
7042 You can't even think about them!
7043 EOM
7044         val="$undef"
7045 fi 
7046 set d_flexfnam
7047 eval $setvar
7048 $rm -rf 123456789abcde*
7049
7050 : determine where library module manual pages go
7051 set man3dir man3dir none
7052 eval $prefixit
7053 $cat <<EOM
7054
7055 $spackage has manual pages for many of the library modules.
7056 EOM
7057
7058 case "$nroff" in
7059 nroff)
7060         $cat <<'EOM'
7061 However, you don't have nroff, so they're probably useless to you.
7062 EOM
7063         case "$man3dir" in
7064         '') man3dir="none";;
7065         esac;;
7066 esac
7067
7068 case "$d_flexfnam" in
7069 undef)
7070         $cat <<'EOM'
7071 However, your system can't handle the long file names like File::Basename.3. 
7072 EOM
7073         case "$man3dir" in
7074         '') man3dir="none";;
7075         esac;;
7076 esac
7077
7078 echo "If you don't want the manual sources installed, answer 'none'."
7079 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
7080 case "$man3dir" in
7081 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
7082         if $test -d "$privlib/man/man3"; then
7083                 cat <<EOM >&4
7084
7085 WARNING:  Previous versions of perl installed man3 pages into
7086 $privlib/man/man3.  This version will suggest a 
7087 new default of $dflt.  
7088 EOM
7089                 tdflt=$dflt
7090                 dflt='n'
7091                 rp='Do you wish to preserve the old behavior?(y/n)'
7092                 . ./myread
7093                 case "$ans" in
7094                 y*) dflt="$privlib/man/man3" ;;
7095                 *)  dflt=$tdflt ;;
7096                 esac
7097     fi
7098         ;;
7099 *)      dflt="$man3dir" ;;
7100 esac
7101 case "$dflt" in
7102 ' ') dflt=none ;;
7103 esac
7104 echo " "
7105 fn=dn+~
7106 rp="Where do the $package library man pages (source) go?"
7107 . ./getfile
7108 man3dir="$ans"
7109 man3direxp="$ansexp"
7110 case "$man3dir" in
7111 '')     man3dir=' '
7112         installman3dir='';;
7113 esac
7114
7115 : Change installation prefix, if necessary.
7116 if $test X"$prefix" != X"$installprefix"; then
7117         installman3dir=`echo $man3direxp | $sed "s#^$prefix#$installprefix#"`
7118 else
7119         installman3dir="$man3direxp"
7120 fi
7121
7122 : What suffix to use on installed man pages
7123 case "$man3dir" in
7124 ' ')
7125         man3ext='0'
7126         ;;
7127 *)
7128         rp="What suffix should be used for the $package library man pages?"
7129         case "$man3ext" in
7130         '')     case "$man3dir" in
7131                 *3)  dflt=3 ;;
7132                 *3p) dflt=3p ;;
7133                 *3pm) dflt=3pm ;;
7134                 *l) dflt=l;;
7135                 *n) dflt=n;;
7136                 *o) dflt=o;;
7137                 *p) dflt=p;;
7138                 *C) dflt=C;;
7139                 *L) dflt=L;;
7140                 *L3) dflt=L3;;
7141                 *) dflt=3;;
7142                 esac
7143                 ;;
7144         *)      dflt="$man3ext";;
7145         esac
7146         . ./myread
7147         man3ext="$ans"
7148         ;;
7149 esac
7150
7151 : see if we have to deal with yellow pages, now NIS.
7152 if $test -d /usr/etc/yp || $test -d /etc/yp; then
7153         if $test -f /usr/etc/nibindd; then
7154                 echo " "
7155                 echo "I'm fairly confident you're on a NeXT."
7156                 echo " "
7157                 rp='Do you get the hosts file via NetInfo?'
7158                 dflt=y
7159                 case "$hostcat" in
7160                 nidump*) ;;
7161                 '') ;;
7162                 *) dflt=n;;
7163                 esac
7164                 . ./myread
7165                 case "$ans" in
7166                 y*) hostcat='nidump hosts .';;
7167                 *)      case "$hostcat" in
7168                         nidump*) hostcat='';;
7169                         esac
7170                         ;;
7171                 esac
7172         fi
7173         case "$hostcat" in
7174         nidump*) ;;
7175         *)
7176                 case "$hostcat" in
7177                 *ypcat*) dflt=y;;
7178                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
7179                                 dflt=y
7180                         else
7181                                 dflt=n
7182                         fi;;
7183                 *) dflt=n;;
7184                 esac
7185                 echo " "
7186                 rp='Are you getting the hosts file via yellow pages?'
7187                 . ./myread
7188                 case "$ans" in
7189                 y*) hostcat='ypcat hosts';;
7190                 *) hostcat='cat /etc/hosts';;
7191                 esac
7192                 ;;
7193         esac
7194 fi
7195 case "$hostcat" in
7196 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
7197 esac
7198 case "$groupcat" in
7199 '') test -f /etc/group && groupcat='cat /etc/group';;
7200 esac
7201 case "$passcat" in
7202 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
7203 esac
7204
7205 : now get the host name
7206 echo " "
7207 echo "Figuring out host name..." >&4
7208 case "$myhostname" in
7209 '') cont=true
7210         echo 'Maybe "hostname" will work...'
7211         if tans=`sh -c hostname 2>&1` ; then
7212                 myhostname=$tans
7213                 phostname=hostname
7214                 cont=''
7215         fi
7216         ;;
7217 *) cont='';;
7218 esac
7219 if $test "$cont"; then
7220         if ./xenix; then
7221                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
7222                 if tans=`cat /etc/systemid 2>&1` ; then
7223                         myhostname=$tans
7224                         phostname='cat /etc/systemid'
7225                         echo "Whadyaknow.  Xenix always was a bit strange..."
7226                         cont=''
7227                 fi
7228         elif $test -r /etc/systemid; then
7229                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
7230         fi
7231 fi
7232 if $test "$cont"; then
7233         echo 'No, maybe "uuname -l" will work...'
7234         if tans=`sh -c 'uuname -l' 2>&1` ; then
7235                 myhostname=$tans
7236                 phostname='uuname -l'
7237         else
7238                 echo 'Strange.  Maybe "uname -n" will work...'
7239                 if tans=`sh -c 'uname -n' 2>&1` ; then
7240                         myhostname=$tans
7241                         phostname='uname -n'
7242                 else
7243                         echo 'Oh well, maybe I can mine it out of whoami.h...'
7244                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
7245                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
7246                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
7247                         else
7248                                 case "$myhostname" in
7249                                 '') echo "Does this machine have an identity crisis or something?"
7250                                         phostname='';;
7251                                 *)
7252                                         echo "Well, you said $myhostname before..."
7253                                         phostname='echo $myhostname';;
7254                                 esac
7255                         fi
7256                 fi
7257         fi
7258 fi
7259 : you do not want to know about this
7260 set $myhostname
7261 myhostname=$1
7262
7263 : verify guess
7264 if $test "$myhostname" ; then
7265         dflt=y
7266         rp='Your host name appears to be "'$myhostname'".'" Right?"
7267         . ./myread
7268         case "$ans" in
7269         y*) ;;
7270         *) myhostname='';;
7271         esac
7272 fi
7273
7274 : bad guess or no guess
7275 while $test "X$myhostname" = X ; do
7276         dflt=''
7277         rp="Please type the (one word) name of your host:"
7278         . ./myread
7279         myhostname="$ans"
7280 done
7281
7282 : translate upper to lower if necessary
7283 case "$myhostname" in
7284 *[A-Z]*)
7285         echo "(Normalizing case in your host name)"
7286         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
7287         ;;
7288 esac
7289
7290 case "$myhostname" in
7291 *.*)
7292         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
7293         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
7294         echo "(Trimming domain name from host name--host name is now $myhostname)"
7295         ;;
7296 *) case "$mydomain" in
7297         '')
7298                 {
7299                         test "X$hostcat" = "Xypcat hosts" &&
7300                         ypmatch "$myhostname" hosts 2>/dev/null |\
7301                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
7302                         $test -s hosts
7303                 } || {
7304                         test "X$hostcat" != "X" &&
7305                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
7306                                         /[       ]$myhostname[  . ]/p" > hosts
7307                 }
7308                 tmp_re="[       . ]"
7309                 $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
7310                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
7311                 dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
7312                         hosts | $sort | $uniq | \
7313                         $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
7314                 case `$echo X$dflt` in
7315                 X*\ *)  echo "(Several hosts in /etc/hosts matched hostname)"
7316                         dflt=.
7317                         ;;
7318                 X.) echo "(You do not have fully-qualified names in /etc/hosts)"
7319                         ;;
7320                 esac
7321                 case "$dflt" in
7322                 .)
7323                         tans=`./loc resolv.conf X /etc /usr/etc`
7324                         if $test -f "$tans"; then
7325                                 echo "(Attempting domain name extraction from $tans)"
7326                                 dflt=.`$sed -n -e 's/   / /g' \
7327                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
7328                                   | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
7329                                 case "$dflt" in
7330                                 .) dflt=.`$sed -n -e 's/        / /g' \
7331                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
7332                                      | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
7333                                         ;;
7334                                 esac
7335                         fi
7336                         ;;
7337                 esac
7338                 case "$dflt" in
7339                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
7340                         dflt=.`sh -c domainname 2>/dev/null`
7341                         case "$dflt" in
7342                         '') dflt='.';;
7343                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
7344                         esac
7345                         ;;
7346                 esac
7347                 case "$dflt" in
7348                 .) echo "(Lost all hope -- silly guess then)"
7349                         dflt='.uucp'
7350                         ;;
7351                 esac
7352                 $rm -f hosts
7353                 ;;
7354         *) dflt="$mydomain";;
7355         esac;;
7356 esac
7357 echo " "
7358 rp="What is your domain name?"
7359 . ./myread
7360 tans="$ans"
7361 case "$ans" in
7362 '') ;;
7363 .*) ;;
7364 *) tans=".$tans";;
7365 esac
7366 mydomain="$tans"
7367
7368 : translate upper to lower if necessary
7369 case "$mydomain" in
7370 *[A-Z]*)
7371         echo "(Normalizing case in your domain name)"
7372         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
7373         ;;
7374 esac
7375
7376 : a little sanity check here
7377 case "$phostname" in
7378 '') ;;
7379 *)
7380         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
7381         $myhostname$mydomain|$myhostname) ;;
7382         *)
7383                 case "$phostname" in
7384                 sed*)
7385                         echo "(That doesn't agree with your whoami.h file, by the way.)"
7386                         ;;
7387                 *)
7388                         echo "(That doesn't agree with your $phostname command, by the way.)"
7389                         ;;
7390                 esac
7391         ;;
7392         esac
7393         ;;
7394 esac
7395
7396 $cat <<EOM
7397
7398 I need to get your e-mail address in Internet format if possible, i.e.
7399 something like user@host.domain. Please answer accurately since I have
7400 no easy means to double check it. The default value provided below
7401 is most probably close to reality but may not be valid from outside
7402 your organization...
7403
7404 EOM
7405 cont=x
7406 while test "$cont"; do
7407         case "$cf_email" in
7408         '') dflt="$cf_by@$myhostname$mydomain";;
7409         *) dflt="$cf_email";;
7410         esac
7411         rp='What is your e-mail address?'
7412         . ./myread
7413         cf_email="$ans"
7414         case "$cf_email" in
7415         *@*.*) cont='' ;;
7416         *)
7417                 rp='Address does not look like an Internet one.  Use it anyway?'
7418                 case "$fastread" in
7419                 yes) dflt=y ;;
7420                 *) dflt=n ;;
7421                 esac
7422                 . ./myread
7423                 case "$ans" in
7424                 y*) cont='' ;;
7425                 *) echo " " ;;
7426                 esac
7427                 ;;
7428         esac
7429 done
7430
7431 $cat <<EOM
7432
7433 If you or somebody else will be maintaining perl at your site, please
7434 fill in the correct e-mail address here so that they may be contacted
7435 if necessary. Currently, the "perlbug" program included with perl
7436 will send mail to this address in addition to perlbug@perl.org. You may
7437 enter "none" for no administrator.
7438
7439 EOM
7440 case "$perladmin" in
7441 '') dflt="$cf_email";;
7442 *) dflt="$perladmin";;
7443 esac
7444 rp='Perl administrator e-mail address'
7445 . ./myread
7446 perladmin="$ans"
7447
7448 : figure out how to guarantee perl startup
7449 case "$startperl" in
7450 '')
7451         case "$sharpbang" in
7452         *!)
7453                 $cat <<EOH
7454
7455 I can use the #! construct to start perl on your system. This will
7456 make startup of perl scripts faster, but may cause problems if you
7457 want to share those scripts and perl is not in a standard place
7458 ($binexp/perl) on all your platforms. The alternative is to force
7459 a shell by starting the script with a single ':' character.
7460
7461 EOH
7462                 dflt="$binexp/perl"
7463                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
7464                 . ./myread
7465                 case "$ans" in
7466                 none)   startperl=": # use perl";;
7467                 *)      startperl="#!$ans"
7468                         if $test 30 -lt `echo "$ans" | wc -c`; then
7469                                 $cat >&4 <<EOM
7470
7471 WARNING:  Some systems limit the #! command to 32 characters.
7472 If you experience difficulty running Perl scripts with #!, try
7473 installing Perl in a directory with a shorter pathname.
7474
7475 EOM
7476                         fi ;;
7477                 esac
7478                 ;;
7479         *) startperl=": # use perl"
7480                 ;;
7481         esac
7482         ;;
7483 esac
7484 echo "I'll use $startperl to start perl scripts."
7485
7486 : figure best path for perl in scripts
7487 case "$perlpath" in
7488 '')
7489         perlpath="$binexp/perl"
7490         case "$startperl" in
7491         *!*) ;;
7492         *)
7493                 $cat <<EOH
7494
7495 I will use the "eval 'exec'" idiom to start Perl on your system.
7496 I can use the full path of your Perl binary for this purpose, but
7497 doing so may cause problems if you want to share those scripts and
7498 Perl is not always in a standard place ($binexp/perl).
7499
7500 EOH
7501                 dflt="$binexp/perl"
7502                 rp="What path shall I use in \"eval 'exec'\"?"
7503                 . ./myread
7504                 perlpath="$ans"
7505                 ;;
7506         esac
7507         ;;
7508 esac
7509 case "$startperl" in
7510 *!*)    ;;
7511 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
7512 esac
7513
7514 : determine where public executable scripts go
7515 set scriptdir scriptdir
7516 eval $prefixit
7517 case "$scriptdir" in
7518 '')
7519         dflt="$bin"
7520         : guess some guesses
7521         $test -d /usr/share/scripts && dflt=/usr/share/scripts
7522         $test -d /usr/share/bin     && dflt=/usr/share/bin
7523         $test -d /usr/local/script  && dflt=/usr/local/script
7524         $test -d /usr/local/scripts && dflt=/usr/local/scripts
7525         $test -d $prefixexp/script  && dflt=$prefixexp/script
7526         set dflt
7527         eval $prefixup
7528         ;;
7529 *)  dflt="$scriptdir"
7530         ;;
7531 esac
7532 $cat <<EOM
7533  
7534 Some installations have a separate directory just for executable scripts so
7535 that they can mount it across multiple architectures but keep the scripts in
7536 one spot.  You might, for example, have a subdirectory of /usr/share for this.
7537 Or you might just lump your scripts in with all your other executables.
7538  
7539 EOM
7540 fn=d~
7541 rp='Where do you keep publicly executable scripts?'
7542 . ./getfile
7543 if $test "X$ansexp" != "X$scriptdirexp"; then
7544         installscript=''
7545 fi
7546 scriptdir="$ans"
7547 scriptdirexp="$ansexp"
7548 : Change installation prefix, if necessary.
7549 if $test X"$prefix" != X"$installprefix"; then
7550         installscript=`echo $scriptdirexp | sed "s#^$prefix#$installprefix#"`
7551 else
7552         installscript="$scriptdirexp"
7553 fi
7554
7555 : determine where add-on public executables go
7556 case "$sitebin" in
7557 '')     dflt=$siteprefix/bin ;;
7558 *)      dflt=$sitebin ;;
7559 esac
7560 fn=d~
7561 rp='Pathname where the add-on public executables should be installed?'
7562 . ./getfile
7563 sitebin="$ans"
7564 sitebinexp="$ansexp"
7565 : Change installation prefix, if necessary.
7566 if $test X"$prefix" != X"$installprefix"; then
7567         installsitebin=`echo $sitebinexp | sed "s#^$prefix#$installprefix#"`
7568 else
7569         installsitebin="$sitebinexp"
7570 fi
7571
7572 case "$useperlio" in
7573 $define|true|[yY]*)     dflt='y';;
7574 *) dflt='n';;
7575 esac
7576 cat <<EOM
7577
7578 Previous version of $package used the standard IO mechanisms as defined
7579 in <stdio.h>.  Versions 5.003_02 and later of perl allow alternate IO
7580 mechanisms via a "PerlIO" abstraction, but the stdio mechanism is still
7581 the default.  This abstraction layer can use AT&T's sfio (if you already
7582 have sfio installed) or regular stdio.  Using PerlIO with sfio may cause
7583 problems with some extension modules.  Using PerlIO with stdio is safe,
7584 but it is slower than plain stdio and therefore is not the default.
7585
7586 If this doesn't make any sense to you, just accept the default '$dflt'.
7587 EOM
7588 rp='Use the experimental PerlIO abstraction layer?'
7589 . ./myread
7590 case "$ans" in
7591 y|Y) 
7592         val="$define"
7593         ;;     
7594 *)      
7595         echo "Ok, doing things the stdio way"
7596         val="$undef"
7597         ;;
7598 esac
7599 set useperlio
7600 eval $setvar 
7601
7602 case "$vendorprefix" in
7603 '')     d_vendorbin="$undef"
7604         vendorbin=''
7605         vendorbinexp=''
7606         ;;
7607 *)      d_vendorbin="$define"
7608         : determine where vendor-supplied executables go.
7609         case "$vendorbin" in
7610         '') dflt=$vendorprefix/bin ;;
7611         *)      dflt="$vendorbin" ;;
7612         esac
7613         fn=d~+
7614         rp='Pathname for the vendor-supplied executables directory?'
7615         . ./getfile
7616         vendorbin="$ans"
7617         vendorbinexp="$ansexp"
7618         ;;
7619 esac
7620 : Change installation prefix, if necessary.
7621 if $test X"$prefix" != X"$installprefix"; then
7622         installvendorbin=`echo $vendorbinexp | $sed "s#^$prefix#$installprefix#"`
7623 else
7624         installvendorbin="$vendorbinexp"
7625 fi
7626
7627 : see if qgcvt exists
7628 set qgcvt d_qgcvt
7629 eval $inlibc
7630
7631 echo " "
7632
7633 if $test X"$d_longdbl" = X"$define"; then
7634
7635 echo "Checking how to print long doubles..." >&4
7636
7637 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
7638         $cat >try.c <<'EOCP'
7639 #include <sys/types.h>
7640 #include <stdio.h>
7641 int main() {
7642   double d = 123.456;
7643   printf("%.3f\n", d);
7644 }
7645 EOCP
7646         set try
7647         if eval $compile; then
7648                 yyy=`./try$exe_ext`
7649                 case "$yyy" in
7650                 123.456)
7651                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
7652                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
7653                         echo "We will use %f."
7654                         ;;
7655                 esac
7656         fi
7657 fi
7658
7659 if $test X"$sPRIfldbl" = X; then
7660         $cat >try.c <<'EOCP'
7661 #include <sys/types.h>
7662 #include <stdio.h>
7663 int main() {
7664   long double d = 123.456;
7665   printf("%.3llf\n", d);
7666 }
7667 EOCP
7668         set try
7669         if eval $compile; then
7670                 yyy=`./try$exe_ext`
7671                 case "$yyy" in
7672                 123.456)
7673                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
7674                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
7675                         echo "We will use %llf."
7676                         ;;
7677                 esac
7678         fi
7679 fi
7680
7681 if $test X"$sPRIfldbl" = X; then
7682         $cat >try.c <<'EOCP'
7683 #include <sys/types.h>
7684 #include <stdio.h>
7685 int main() {
7686   long double d = 123.456;
7687   printf("%.3Lf\n", d);
7688 }
7689 EOCP
7690         set try
7691         if eval $compile; then
7692                 yyy=`./try$exe_ext`
7693                 case "$yyy" in
7694                 123.456)
7695                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
7696                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
7697                         echo "We will use %Lf."
7698                         ;;
7699                 esac
7700         fi
7701 fi
7702
7703 if $test X"$sPRIfldbl" = X; then
7704         $cat >try.c <<'EOCP'
7705 #include <sys/types.h>
7706 #include <stdio.h>
7707 int main() {
7708   long double d = 123.456;
7709   printf("%.3lf\n", d);
7710 }
7711 EOCP
7712         set try
7713         if eval $compile; then
7714                 yyy=`./try$exe_ext`
7715                 case "$yyy" in
7716                 123.456)
7717                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
7718                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
7719                         echo "We will use %lf."
7720                         ;;
7721                 esac
7722         fi
7723 fi
7724
7725 if $test X"$sPRIfldbl" = X; then
7726         echo "Cannot figure out how to print long doubles." >&4
7727 else
7728         sSCNfldbl=$sPRIfldbl    # expect consistency
7729 fi
7730
7731 $rm -f try try.*
7732
7733 fi # d_longdbl
7734
7735 case "$sPRIfldbl" in
7736 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef"; 
7737         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef"; 
7738         d_SCNfldbl="$undef";
7739         ;;
7740 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define"; 
7741         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define"; 
7742         d_SCNfldbl="$define";
7743         ;;
7744 esac
7745
7746 : Check how to convert floats to strings.
7747 echo " "
7748 echo "Checking for an efficient way to convert floats to strings."
7749 echo " " > try.c
7750 case "$uselongdouble" in
7751 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
7752 esac
7753 case "$d_longdbl" in
7754 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
7755 esac
7756 case "$d_PRIgldbl" in
7757 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
7758 esac
7759 $cat >>try.c <<EOP
7760 #ifdef TRY_gconvert
7761 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
7762 char *myname = "gconvert";
7763 #endif
7764 #ifdef TRY_gcvt
7765 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
7766 char *myname = "gcvt";
7767 #endif
7768 #ifdef TRY_qgcvt
7769 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
7770 char *myname = "qgcvt";
7771 #define DOUBLETYPE long double
7772 #endif
7773 #ifdef TRY_sprintf
7774 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE) && defined(HAS_PRIgldbl)
7775 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
7776 #else
7777 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
7778 #endif
7779 char *myname = "sprintf";
7780 #endif
7781
7782 #ifndef DOUBLETYPE
7783 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
7784 #define DOUBLETYPE long double
7785 #else
7786 #define DOUBLETYPE double
7787 #endif
7788 #endif
7789
7790 #include <stdio.h>
7791
7792 #define I_STDLIB $i_stdlib
7793 #ifdef I_STDLIB
7794 #include <stdlib.h>
7795 #endif
7796
7797 int
7798 checkit(expect, got)
7799 char *expect;
7800 char *got;
7801 {
7802     if (strcmp(expect, got)) {
7803                 printf("%s oddity:  Expected %s, got %s\n",
7804                         myname, expect, got);
7805                 exit(1);
7806         }
7807 }
7808
7809 int main()
7810
7811         char buf[64]; 
7812         buf[63] = '\0';
7813
7814         /* This must be 1st test on (which?) platform */
7815         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
7816         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
7817         checkit("0.1", buf);
7818
7819         Gconvert((DOUBLETYPE)1.0, 8, 0, buf); 
7820         checkit("1", buf);
7821
7822         Gconvert((DOUBLETYPE)1.1, 8, 0, buf); 
7823         checkit("1.1", buf);
7824
7825         Gconvert((DOUBLETYPE)1.01, 8, 0, buf); 
7826         checkit("1.01", buf);
7827
7828         Gconvert((DOUBLETYPE)1.001, 8, 0, buf); 
7829         checkit("1.001", buf);
7830
7831         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf); 
7832         checkit("1.0001", buf);
7833
7834         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf); 
7835         checkit("1.00001", buf);
7836
7837         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf); 
7838         checkit("1.000001", buf);
7839
7840         Gconvert((DOUBLETYPE)0.0, 8, 0, buf); 
7841         checkit("0", buf);
7842
7843         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf); 
7844         checkit("-1", buf);
7845
7846         /* Some Linux gcvt's give 1.e+5 here. */
7847         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf); 
7848         checkit("100000", buf);
7849         
7850         /* Some Linux gcvt's give -1.e+5 here. */
7851         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf); 
7852         checkit("-100000", buf);
7853
7854         Gconvert((DOUBLETYPE)123.456, 8, 0, buf); 
7855         checkit("123.456", buf);
7856
7857         exit(0);
7858 }
7859 EOP
7860 case "$d_Gconvert" in
7861 gconvert*) xxx_list='gconvert gcvt sprintf' ;;
7862 gcvt*) xxx_list='gcvt gconvert sprintf' ;;
7863 sprintf*) xxx_list='sprintf gconvert gcvt' ;;
7864 *) xxx_list='gconvert gcvt sprintf' ;;
7865 esac
7866
7867 case "$d_longdbl$uselongdouble$d_PRIgldbl" in
7868 "$define$define$define")
7869     # for long doubles prefer first qgcvt, then sprintf
7870     xxx_list="`echo $xxx_list|sed s/sprintf//`" 
7871     xxx_list="sprintf $xxx_list"
7872     case "$d_qgcvt" in
7873     "$define") xxx_list="qgcvt $xxx_list" ;;
7874     esac
7875     ;;
7876 esac
7877
7878 for xxx_convert in $xxx_list; do
7879         echo "Trying $xxx_convert..."
7880         $rm -f try try$_o
7881         set try -DTRY_$xxx_convert
7882         if eval $compile; then
7883                 echo "$xxx_convert() found." >&4
7884                 if ./try; then
7885                         echo "I'll use $xxx_convert to convert floats into a string." >&4
7886                         break;
7887                 else
7888                         echo "...But $xxx_convert didn't work as I expected."
7889                 fi
7890         else
7891                 echo "$xxx_convert NOT found." >&4
7892         fi
7893 done
7894         
7895 case "$xxx_convert" in
7896 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
7897 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
7898 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
7899 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
7900    "$define$define$define")
7901       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
7902    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
7903    esac
7904    ;;  
7905 esac
7906
7907 : Initialize h_fcntl
7908 h_fcntl=false
7909
7910 : Initialize h_sysfile
7911 h_sysfile=false
7912
7913 : access call always available on UNIX
7914 set access d_access
7915 eval $inlibc
7916
7917 : locate the flags for 'access()'
7918 case "$d_access" in
7919 "$define")
7920         echo " "
7921         $cat >access.c <<'EOCP'
7922 #include <sys/types.h>
7923 #ifdef I_FCNTL
7924 #include <fcntl.h>
7925 #endif
7926 #ifdef I_SYS_FILE
7927 #include <sys/file.h>
7928 #endif
7929 #ifdef I_UNISTD
7930 #include <unistd.h>
7931 #endif
7932 int main() {
7933         exit(R_OK);
7934 }
7935 EOCP
7936         : check sys/file.h first, no particular reason here
7937         if $test `./findhdr sys/file.h` && \
7938                 $cc $cppflags -DI_SYS_FILE -o access access.c >/dev/null 2>&1 ; then
7939                 h_sysfile=true;
7940                 echo "<sys/file.h> defines the *_OK access constants." >&4
7941         elif $test `./findhdr fcntl.h` && \
7942                 $cc $cppflags -DI_FCNTL -o access access.c >/dev/null 2>&1 ; then
7943                 h_fcntl=true;
7944                 echo "<fcntl.h> defines the *_OK access constants." >&4
7945         elif $test `./findhdr unistd.h` && \
7946                 $cc $cppflags -DI_UNISTD -o access access.c >/dev/null 2>&1 ; then
7947                 echo "<unistd.h> defines the *_OK access constants." >&4
7948         else
7949                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
7950         fi
7951         ;;
7952 esac
7953 $rm -f access*
7954
7955 : see if accessx exists
7956 set accessx d_accessx
7957 eval $inlibc
7958
7959 : see if alarm exists
7960 set alarm d_alarm
7961 eval $inlibc
7962
7963 : see if atolf exists
7964 set atolf d_atolf
7965 eval $inlibc
7966
7967 : see if atoll exists
7968 set atoll d_atoll
7969 eval $inlibc
7970
7971 : Look for GNU-cc style attribute checking
7972 echo " "
7973 echo "Checking whether your compiler can handle __attribute__ ..." >&4
7974 $cat >attrib.c <<'EOCP'
7975 #include <stdio.h>
7976 void croak (char* pat,...) __attribute__((format(printf,1,2),noreturn));
7977 EOCP
7978 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
7979         if $contains 'warning' attrib.out >/dev/null 2>&1; then
7980                 echo "Your C compiler doesn't fully support __attribute__."
7981                 val="$undef"
7982         else
7983                 echo "Your C compiler supports __attribute__."
7984                 val="$define"
7985         fi
7986 else
7987         echo "Your C compiler doesn't seem to understand __attribute__ at all."
7988         val="$undef"
7989 fi
7990 set d_attribut
7991 eval $setvar
7992 $rm -f attrib*
7993
7994 : see if bcmp exists
7995 set bcmp d_bcmp
7996 eval $inlibc
7997
7998 : see if bcopy exists
7999 set bcopy d_bcopy
8000 eval $inlibc
8001
8002 : see if this is a unistd.h system
8003 set unistd.h i_unistd
8004 eval $inhdr
8005
8006 : see if getpgrp exists
8007 set getpgrp d_getpgrp
8008 eval $inlibc
8009
8010 case "$d_getpgrp" in
8011 "$define")
8012         echo " "
8013         echo "Checking to see which flavor of getpgrp is in use..."
8014         $cat >set.c <<EOP
8015 #$i_unistd I_UNISTD
8016 #include <sys/types.h>
8017 #ifdef I_UNISTD
8018 #  include <unistd.h>
8019 #endif
8020 int main()
8021 {
8022         if (getuid() == 0) {
8023                 printf("(I see you are running Configure as super-user...)\n");
8024                 setuid(1);
8025         }
8026 #ifdef TRY_BSD_PGRP
8027         if (getpgrp(1) == 0)
8028                 exit(0);
8029 #else
8030         if (getpgrp() > 0)
8031                 exit(0);
8032 #endif
8033         exit(1);
8034 }
8035 EOP
8036         if $cc -DTRY_BSD_PGRP $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
8037                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
8038                 val="$define"
8039         elif $cc $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
8040                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
8041                 val="$undef"
8042         else
8043                 echo "I can't seem to compile and run the test program."
8044                 if ./usg; then
8045                         xxx="a USG one, i.e. you use getpgrp()."
8046                 else
8047                         # SVR4 systems can appear rather BSD-ish.
8048                         case "$i_unistd" in
8049                         $undef)
8050                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
8051                                 val="$define"
8052                                 ;;
8053                         $define)
8054                                 xxx="probably a USG one, i.e. you use getpgrp()."
8055                                 val="$undef"
8056                                 ;;
8057                         esac
8058                 fi
8059                 echo "Assuming your getpgrp is $xxx" >&4
8060         fi
8061         ;;
8062 *) val="$undef";;
8063 esac
8064 set d_bsdgetpgrp
8065 eval $setvar
8066 $rm -f set set.c
8067
8068 : see if setpgrp exists
8069 set setpgrp d_setpgrp
8070 eval $inlibc
8071
8072 case "$d_setpgrp" in
8073 "$define")
8074         echo " "
8075         echo "Checking to see which flavor of setpgrp is in use..."
8076         $cat >set.c <<EOP
8077 #$i_unistd I_UNISTD
8078 #include <sys/types.h>
8079 #ifdef I_UNISTD
8080 #  include <unistd.h>
8081 #endif
8082 int main()
8083 {
8084         if (getuid() == 0) {
8085                 printf("(I see you are running Configure as super-user...)\n");
8086                 setuid(1);
8087         }
8088 #ifdef TRY_BSD_PGRP
8089         if (-1 == setpgrp(1, 1))
8090                 exit(0);
8091 #else
8092         if (setpgrp() != -1)
8093                 exit(0);
8094 #endif
8095         exit(1);
8096 }
8097 EOP
8098         if $cc -DTRY_BSD_PGRP $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
8099                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
8100                 val="$define"
8101         elif $cc $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
8102                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
8103                 val="$undef"
8104         else
8105                 echo "(I can't seem to compile and run the test program.)"
8106                 if ./usg; then
8107                         xxx="a USG one, i.e. you use setpgrp()."
8108                 else
8109                         # SVR4 systems can appear rather BSD-ish.
8110                         case "$i_unistd" in
8111                         $undef)
8112                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
8113                                 val="$define"
8114                                 ;;
8115                         $define)
8116                                 xxx="probably a USG one, i.e. you use setpgrp()."
8117                                 val="$undef"
8118                                 ;;
8119                         esac
8120                 fi
8121                 echo "Assuming your setpgrp is $xxx" >&4
8122         fi
8123         ;;
8124 *) val="$undef";;
8125 esac
8126 set d_bsdsetpgrp
8127 eval $setvar
8128 $rm -f set set.c
8129 : see if bzero exists
8130 set bzero d_bzero
8131 eval $inlibc
8132
8133 : see if signal is declared as pointer to function returning int or void
8134 echo " "
8135 xxx=`./findhdr signal.h`
8136 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
8137 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
8138         echo "You have int (*signal())() instead of void." >&4
8139         val="$undef"
8140 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
8141         echo "You have void (*signal())()." >&4
8142         val="$define"
8143 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
8144         echo "You have int (*signal())() instead of void." >&4
8145         val="$undef"
8146 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
8147         echo "You have void (*signal())()." >&4
8148         val="$define"
8149 else
8150         case "$d_voidsig" in
8151         '')
8152         echo "I can't determine whether signal handler returns void or int..." >&4
8153                 dflt=void
8154                 rp="What type does your signal handler return?"
8155                 . ./myread
8156                 case "$ans" in
8157                 v*) val="$define";;
8158                 *) val="$undef";;
8159                 esac;;
8160         "$define")
8161                 echo "As you already told me, signal handler returns void." >&4
8162                 val="$define"
8163                 ;;
8164         *)      echo "As you already told me, signal handler returns int." >&4
8165                 val="$undef"
8166                 ;;
8167         esac
8168 fi
8169 set d_voidsig
8170 eval $setvar
8171 case "$d_voidsig" in
8172 "$define") signal_t="void";;
8173 *) signal_t="int";;
8174 esac
8175 $rm -f $$.tmp
8176
8177 : check for ability to cast large floats to 32-bit ints.
8178 echo " "
8179 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
8180 if $test "$intsize" -ge 4; then
8181         xxx=int
8182 else
8183         xxx=long
8184 fi
8185 $cat >try.c <<EOCP
8186 #include <stdio.h>
8187 #include <sys/types.h>
8188 #include <signal.h>
8189 $signal_t blech(s) int s; { exit(3); }
8190 int main()
8191 {
8192         $xxx i32;
8193         double f, g;
8194         int result = 0;
8195         char str[16];
8196         signal(SIGFPE, blech);
8197
8198         /* Don't let compiler optimize the test away.  Store the number 
8199            in a writable string for gcc to pass to sscanf under HP/UX.
8200         */
8201         sprintf(str, "2147483647");
8202         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
8203         g = 10 * f;
8204         i32  = ($xxx) g;
8205
8206         /* x86 processors will probably give 0x8000 0000, which is a
8207        sign change.  We don't want that.  We want to mimic SPARC
8208            behavior here, which is to preserve the sign and give
8209            back 0x7fff ffff.
8210         */
8211         if (i32 != ($xxx) f)
8212                 result |= 1;
8213         exit(result);
8214 }
8215 EOCP
8216 set try
8217 if eval $compile_ok; then
8218         ./try
8219         yyy=$?
8220 else
8221         echo "(I can't seem to compile the test program--assuming it can't)"
8222         yyy=1
8223 fi
8224 case "$yyy" in
8225 0)      val="$define"
8226         echo "Yup, it can."
8227         ;;
8228 *)      val="$undef"
8229         echo "Nope, it can't."
8230         ;;
8231 esac
8232 set d_casti32
8233 eval $setvar
8234 $rm -f try try.*
8235
8236 : check for ability to cast negative floats to unsigned
8237 echo " "
8238 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
8239 $cat >try.c <<EOCP
8240 #include <stdio.h>
8241 #include <sys/types.h>
8242 #include <signal.h>
8243 $signal_t blech(s) int s; { exit(7); }
8244 $signal_t blech_in_list(s) int s; { exit(4); }
8245 unsigned long dummy_long(p) unsigned long p; { return p; }
8246 unsigned int dummy_int(p) unsigned int p; { return p; }
8247 unsigned short dummy_short(p) unsigned short p; { return p; }
8248 int main()
8249 {
8250         double f;
8251         unsigned long along;
8252         unsigned int aint;
8253         unsigned short ashort;
8254         int result = 0;
8255         char str[16];
8256         
8257         /* Frustrate gcc-2.7.2's optimizer which failed this test with
8258            a direct f = -123. assignment.  gcc-2.8.0 reportedly
8259            optimized the whole file away
8260         */
8261         /* Store the number in a writable string for gcc to pass to 
8262            sscanf under HP/UX.
8263         */
8264         sprintf(str, "-123");
8265         sscanf(str, "%lf", &f);  /* f = -123.; */
8266
8267         signal(SIGFPE, blech);
8268         along = (unsigned long)f;
8269         aint = (unsigned int)f;
8270         ashort = (unsigned short)f;
8271         if (along != (unsigned long)-123)
8272                 result |= 1;
8273         if (aint != (unsigned int)-123)
8274                 result |= 1;
8275         if (ashort != (unsigned short)-123)
8276                 result |= 1;
8277         sprintf(str, "1073741824.");
8278         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
8279         f = f + f;
8280         along = 0;
8281         along = (unsigned long)f;
8282         if (along != 0x80000000)
8283                 result |= 2;
8284         f -= 1.;
8285         along = 0;
8286         along = (unsigned long)f;
8287         if (along != 0x7fffffff)
8288                 result |= 1;
8289         f += 2.;
8290         along = 0;
8291         along = (unsigned long)f;
8292         if (along != 0x80000001)
8293                 result |= 2;
8294         if (result)
8295                 exit(result);
8296         signal(SIGFPE, blech_in_list);
8297         sprintf(str, "123.");
8298         sscanf(str, "%lf", &f);  /* f = 123.; */
8299         along = dummy_long((unsigned long)f);
8300         aint = dummy_int((unsigned int)f);
8301         ashort = dummy_short((unsigned short)f);
8302         if (along != (unsigned long)123)
8303                 result |= 4;
8304         if (aint != (unsigned int)123)
8305                 result |= 4;
8306         if (ashort != (unsigned short)123)
8307                 result |= 4;
8308         exit(result);
8309
8310 }
8311 EOCP
8312 set try
8313 if eval $compile_ok; then
8314         ./try
8315         castflags=$?
8316 else
8317         echo "(I can't seem to compile the test program--assuming it can't)"
8318         castflags=7
8319 fi
8320 case "$castflags" in
8321 0)      val="$define"
8322         echo "Yup, it can."
8323         ;;
8324 *)      val="$undef"
8325         echo "Nope, it can't."
8326         ;;
8327 esac
8328 set d_castneg
8329 eval $setvar
8330 $rm -f try.*
8331
8332 : see if vprintf exists
8333 echo " "
8334 if set vprintf val -f d_vprintf; eval $csym; $val; then
8335         echo 'vprintf() found.' >&4
8336         val="$define"
8337         $cat >vprintf.c <<'EOF'
8338 #include <varargs.h>
8339
8340 int main() { xxx("foo"); }
8341
8342 xxx(va_alist)
8343 va_dcl
8344 {
8345         va_list args;
8346         char buf[10];
8347
8348         va_start(args);
8349         exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
8350 }
8351 EOF
8352         set vprintf
8353         if eval $compile && ./vprintf; then
8354                 echo "Your vsprintf() returns (int)." >&4
8355                 val2="$undef"
8356         else
8357                 echo "Your vsprintf() returns (char*)." >&4
8358                 val2="$define"
8359         fi
8360 else
8361         echo 'vprintf() NOT found.' >&4
8362                 val="$undef"
8363                 val2="$undef"
8364 fi
8365 set d_vprintf
8366 eval $setvar
8367 val=$val2
8368 set d_charvspr
8369 eval $setvar
8370
8371 : see if chown exists
8372 set chown d_chown
8373 eval $inlibc
8374
8375 : see if chroot exists
8376 set chroot d_chroot
8377 eval $inlibc
8378
8379 : see if chsize exists
8380 set chsize d_chsize
8381 eval $inlibc
8382
8383 : check for const keyword
8384 echo " "
8385 echo 'Checking to see if your C compiler knows about "const"...' >&4
8386 $cat >const.c <<'EOCP'
8387 typedef struct spug { int drokk; } spug;
8388 int main()
8389 {
8390         const char *foo;
8391         const spug y;
8392 }
8393 EOCP
8394 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
8395         val="$define"
8396         echo "Yup, it does."
8397 else
8398         val="$undef"
8399         echo "Nope, it doesn't."
8400 fi
8401 set d_const
8402 eval $setvar
8403
8404 : see if crypt exists
8405 echo " "
8406 if set crypt val -f d_crypt; eval $csym; $val; then
8407         echo 'crypt() found.' >&4
8408         val="$define"
8409         cryptlib=''
8410 else
8411         cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
8412         if $test -z "$cryptlib"; then
8413                 cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
8414         else
8415                 cryptlib=-lcrypt
8416         fi
8417         if $test -z "$cryptlib"; then
8418                 cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
8419         else
8420                 cryptlib=-lcrypt
8421         fi
8422         if $test -z "$cryptlib"; then
8423                 cryptlib=`./loc libcrypt$_a "" $libpth`
8424         else
8425                 cryptlib=-lcrypt
8426         fi
8427         if $test -z "$cryptlib"; then
8428                 echo 'crypt() NOT found.' >&4
8429                 val="$undef"
8430         else
8431                 val="$define"
8432         fi
8433 fi
8434 set d_crypt
8435 eval $setvar
8436
8437 : get csh whereabouts
8438 case "$csh" in
8439 'csh') val="$undef" ;;
8440 *) val="$define" ;;
8441 esac
8442 set d_csh
8443 eval $setvar
8444 : Respect a hint or command line value for full_csh.
8445 case "$full_csh" in
8446 '') full_csh=$csh ;;
8447 esac
8448
8449 : see if cuserid exists
8450 set cuserid d_cuserid
8451 eval $inlibc
8452
8453 : see if this is a limits.h system
8454 set limits.h i_limits
8455 eval $inhdr
8456
8457 : see if this is a float.h system
8458 set float.h i_float
8459 eval $inhdr
8460
8461 : See if number of significant digits in a double precision number is known
8462 echo " "
8463 $cat >dbl_dig.c <<EOM
8464 #$i_limits I_LIMITS
8465 #$i_float I_FLOAT
8466 #ifdef I_LIMITS
8467 #include <limits.h>
8468 #endif
8469 #ifdef I_FLOAT
8470 #include <float.h>
8471 #endif
8472 #ifdef DBL_DIG
8473 printf("Contains DBL_DIG");
8474 #endif
8475 EOM
8476 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
8477 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
8478         echo "DBL_DIG found." >&4
8479         val="$define"
8480 else
8481         echo "DBL_DIG NOT found." >&4
8482         val="$undef"
8483 fi
8484 $rm -f dbl_dig.?
8485 set d_dbl_dig
8486 eval $setvar
8487
8488 : see if difftime exists
8489 set difftime d_difftime
8490 eval $inlibc
8491
8492 : see if this is a dirent system
8493 echo " "
8494 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
8495         val="$define"
8496         echo "<dirent.h> found." >&4
8497 else
8498         val="$undef"
8499         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
8500                 echo "<sys/dir.h> found." >&4
8501                 echo " "
8502         else
8503                 xinc=`./findhdr sys/ndir.h`
8504         fi
8505         echo "<dirent.h> NOT found." >&4
8506 fi
8507 set i_dirent
8508 eval $setvar
8509
8510 : Look for type of directory structure.
8511 echo " "
8512 $cppstdin $cppflags $cppminus < "$xinc" > try.c
8513
8514 case "$direntrytype" in
8515 ''|' ')
8516         case "$i_dirent" in
8517         $define) guess1='struct dirent' ;;
8518         *) guess1='struct direct'  ;;
8519         esac
8520         ;;
8521 *)      guess1="$direntrytype"
8522         ;;
8523 esac
8524
8525 case "$guess1" in
8526 'struct dirent') guess2='struct direct' ;;
8527 *) guess2='struct dirent' ;;
8528 esac
8529                 
8530 if $contains "$guess1" try.c >/dev/null 2>&1; then
8531         direntrytype="$guess1"
8532         echo "Your directory entries are $direntrytype." >&4
8533 elif $contains "$guess2" try.c >/dev/null 2>&1; then
8534         direntrytype="$guess2"
8535         echo "Your directory entries seem to be $direntrytype." >&4
8536 else
8537         echo "I don't recognize your system's directory entries." >&4
8538         rp="What type is used for directory entries on this system?"
8539         dflt="$guess1"
8540         . ./myread
8541         direntrytype="$ans"
8542 fi
8543 $rm -f try.c
8544
8545
8546 : see if the directory entry stores field length
8547 echo " "
8548 $cppstdin $cppflags $cppminus < "$xinc" > try.c
8549 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
8550         echo "Good, your directory entry keeps length information in d_namlen." >&4
8551         val="$define"
8552 else
8553         echo "Your directory entry does not know about the d_namlen field." >&4
8554         val="$undef"
8555 fi
8556 set d_dirnamlen
8557 eval $setvar
8558 $rm -f try.c
8559
8560 : see if dlerror exists
8561 xxx_runnm="$runnm"
8562 runnm=false
8563 set dlerror d_dlerror
8564 eval $inlibc
8565 runnm="$xxx_runnm"
8566
8567 : see if dlfcn is available
8568 set dlfcn.h i_dlfcn
8569 eval $inhdr
8570
8571 case "$usedl" in
8572 $define|y|true)
8573         $cat << EOM
8574
8575 On a few systems, the dynamically loaded modules that perl generates and uses
8576 will need a different extension than shared libs. The default will probably
8577 be appropriate.
8578
8579 EOM
8580         case "$dlext" in
8581         '')     dflt="$so" ;;
8582         *)      dflt="$dlext" ;;
8583         esac
8584         rp='What is the extension of dynamically loaded modules'
8585         . ./myread
8586         dlext="$ans"
8587         ;;
8588 *)
8589         dlext="none"
8590         ;;
8591 esac
8592
8593 : Check if dlsym need a leading underscore
8594 echo " "
8595 val="$undef"
8596
8597 case "$dlsrc" in
8598 dl_dlopen.xs)
8599         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
8600         $cat >dyna.c <<'EOM'
8601 fred () { }
8602 EOM
8603
8604 $cat >fred.c<<EOM
8605
8606 #include <stdio.h>
8607 #$i_dlfcn I_DLFCN
8608 #ifdef I_DLFCN
8609 #include <dlfcn.h>      /* the dynamic linker include file for Sunos/Solaris */
8610 #else
8611 #include <sys/types.h>
8612 #include <nlist.h>
8613 #include <link.h>
8614 #endif
8615
8616 extern int fred() ;
8617
8618 int main()
8619 {
8620     void * handle ;
8621     void * symbol ;
8622 #ifndef RTLD_LAZY
8623     int mode = 1 ;
8624 #else
8625     int mode = RTLD_LAZY ;
8626 #endif
8627     handle = dlopen("./dyna.$dlext", mode) ;
8628     if (handle == NULL) {
8629         printf ("1\n") ;
8630         fflush (stdout) ;
8631         exit(0);
8632     }
8633     symbol = dlsym(handle, "fred") ;
8634     if (symbol == NULL) {
8635         /* try putting a leading underscore */
8636         symbol = dlsym(handle, "_fred") ;
8637         if (symbol == NULL) {
8638             printf ("2\n") ;
8639             fflush (stdout) ;
8640             exit(0);
8641         }
8642         printf ("3\n") ;
8643     }
8644     else
8645         printf ("4\n") ;
8646     fflush (stdout) ;
8647     exit(0);
8648 }
8649 EOM
8650         : Call the object file tmp-dyna.o in case dlext=o.
8651         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 && 
8652                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 && 
8653                 $ld $lddlflags -o dyna.$dlext tmp-dyna${_o} > /dev/null 2>&1 && 
8654                 $cc $ccflags -o fred $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1; then
8655                 xxx=`./fred`
8656                 case $xxx in
8657                 1)      echo "Test program failed using dlopen." >&4
8658                         echo "Perhaps you should not use dynamic loading." >&4;;
8659                 2)      echo "Test program failed using dlsym." >&4
8660                         echo "Perhaps you should not use dynamic loading." >&4;;
8661                 3)      echo "dlsym needs a leading underscore" >&4
8662                         val="$define" ;;
8663                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
8664                 esac
8665         else
8666                 echo "I can't compile and run the test program." >&4
8667                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
8668         fi
8669         ;;
8670 esac
8671                 
8672 $rm -f fred fred.? dyna.$dlext dyna.? tmp-dyna.?
8673
8674 set d_dlsymun
8675 eval $setvar
8676
8677 hasproto='varname=$1; func=$2; shift; shift;
8678 while $test $# -ge 2; do
8679         case "$1" in
8680         $define) echo "#include <$2>";;
8681         esac ;
8682     shift 2;
8683 done > try.c;
8684 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
8685 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
8686         echo "$func() prototype found.";
8687         val="$define";
8688 else
8689         echo "$func() prototype NOT found.";
8690         val="$undef";
8691 fi;
8692 set $varname;
8693 eval $setvar;
8694 $rm -f try.c tryout.c'
8695
8696 : see if prototype for drand48 is available
8697 echo " "
8698 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
8699 eval $hasproto
8700
8701 : see if dup2 exists
8702 set dup2 d_dup2
8703 eval $inlibc
8704
8705 : see if eaccess exists
8706 set eaccess d_eaccess
8707 eval $inlibc
8708
8709 : see if endgrent exists
8710 set endgrent d_endgrent
8711 eval $inlibc
8712
8713 : see if endhostent exists
8714 set endhostent d_endhent
8715 eval $inlibc
8716
8717 : see if endnetent exists
8718 set endnetent d_endnent
8719 eval $inlibc
8720
8721 : see if endprotoent exists
8722 set endprotoent d_endpent
8723 eval $inlibc
8724
8725 : see if endpwent exists
8726 set endpwent d_endpwent
8727 eval $inlibc
8728
8729 : see if endservent exists
8730 set endservent d_endsent
8731 eval $inlibc
8732
8733 : Locate the flags for 'open()'
8734 echo " "
8735 $cat >open3.c <<'EOCP'
8736 #include <sys/types.h>
8737 #ifdef I_FCNTL
8738 #include <fcntl.h>
8739 #endif
8740 #ifdef I_SYS_FILE
8741 #include <sys/file.h>
8742 #endif
8743 int main() {
8744         if(O_RDONLY);
8745 #ifdef O_TRUNC
8746         exit(0);
8747 #else
8748         exit(1);
8749 #endif
8750 }
8751 EOCP
8752 : check sys/file.h first to get FREAD on Sun
8753 if $test `./findhdr sys/file.h` && \
8754                 set open3 -DI_SYS_FILE && eval $compile; then
8755         h_sysfile=true;
8756         echo "<sys/file.h> defines the O_* constants..." >&4
8757         if ./open3; then
8758                 echo "and you have the 3 argument form of open()." >&4
8759                 val="$define"
8760         else
8761                 echo "but not the 3 argument form of open().  Oh, well." >&4
8762                 val="$undef"
8763         fi
8764 elif $test `./findhdr fcntl.h` && \
8765                 set open3 -DI_FCNTL && eval $compile; then
8766         h_fcntl=true;
8767         echo "<fcntl.h> defines the O_* constants..." >&4
8768         if ./open3; then
8769                 echo "and you have the 3 argument form of open()." >&4
8770                 val="$define"
8771         else
8772                 echo "but not the 3 argument form of open().  Oh, well." >&4
8773                 val="$undef"
8774         fi
8775 else
8776         val="$undef"
8777         echo "I can't find the O_* constant definitions!  You got problems." >&4
8778 fi
8779 set d_open3
8780 eval $setvar
8781 $rm -f open3*
8782
8783 : see which of string.h or strings.h is needed
8784 echo " "
8785 strings=`./findhdr string.h`
8786 if $test "$strings" && $test -r "$strings"; then
8787         echo "Using <string.h> instead of <strings.h>." >&4
8788         val="$define"
8789 else
8790         val="$undef"
8791         strings=`./findhdr strings.h`
8792         if $test "$strings" && $test -r "$strings"; then
8793                 echo "Using <strings.h> instead of <string.h>." >&4
8794         else
8795                 echo "No string header found -- You'll surely have problems." >&4
8796         fi
8797 fi
8798 set i_string
8799 eval $setvar
8800 case "$i_string" in
8801 "$undef") strings=`./findhdr strings.h`;;
8802 *)        strings=`./findhdr string.h`;;
8803 esac
8804
8805 : check for non-blocking I/O stuff
8806 case "$h_sysfile" in
8807 true) echo "#include <sys/file.h>" > head.c;;
8808 *)
8809         case "$h_fcntl" in
8810         true) echo "#include <fcntl.h>" > head.c;;
8811         *) echo "#include <sys/fcntl.h>" > head.c;;
8812         esac
8813         ;;
8814 esac
8815 echo " "
8816 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
8817 case "$o_nonblock" in
8818 '')
8819         $cat head.c > try.c
8820         $cat >>try.c <<'EOCP'
8821 #include <stdio.h>
8822 int main() {
8823 #ifdef O_NONBLOCK
8824         printf("O_NONBLOCK\n");
8825         exit(0);
8826 #endif
8827 #ifdef O_NDELAY
8828         printf("O_NDELAY\n");
8829         exit(0);
8830 #endif
8831 #ifdef FNDELAY
8832         printf("FNDELAY\n");
8833         exit(0);
8834 #endif
8835         exit(0);
8836 }
8837 EOCP
8838         set try
8839         if eval $compile_ok; then
8840                 o_nonblock=`./try`
8841                 case "$o_nonblock" in
8842                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
8843                 *) echo "Seems like we can use $o_nonblock.";;
8844                 esac
8845         else
8846                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
8847         fi
8848         ;;
8849 *) echo "Using $hint value $o_nonblock.";;
8850 esac
8851 $rm -f try try.* .out core
8852
8853 echo " "
8854 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
8855 case "$eagain" in
8856 '')
8857         $cat head.c > try.c
8858         $cat >>try.c <<EOCP
8859 #include <errno.h>
8860 #include <sys/types.h>
8861 #include <signal.h>
8862 #include <stdio.h> 
8863 #define MY_O_NONBLOCK $o_nonblock
8864 #ifndef errno  /* XXX need better Configure test */
8865 extern int errno;
8866 #endif
8867 #$i_unistd I_UNISTD
8868 #ifdef I_UNISTD
8869 #include <unistd.h>
8870 #endif
8871 #$i_string I_STRING
8872 #ifdef I_STRING
8873 #include <string.h>
8874 #else
8875 #include <strings.h>
8876 #endif
8877 $signal_t blech(x) int x; { exit(3); }
8878 EOCP
8879         $cat >> try.c <<'EOCP'
8880 int main()
8881 {
8882         int pd[2];
8883         int pu[2];
8884         char buf[1];
8885         char string[100];
8886
8887         pipe(pd);       /* Down: child -> parent */
8888         pipe(pu);       /* Up: parent -> child */
8889         if (0 != fork()) {
8890                 int ret;
8891                 close(pd[1]);   /* Parent reads from pd[0] */
8892                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
8893                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
8894                         exit(1);
8895                 signal(SIGALRM, blech);
8896                 alarm(5);
8897                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
8898                         exit(2);
8899                 sprintf(string, "%d\n", ret);
8900                 write(2, string, strlen(string));
8901                 alarm(0);
8902 #ifdef EAGAIN
8903                 if (errno == EAGAIN) {
8904                         printf("EAGAIN\n");
8905                         goto ok;
8906                 }
8907 #endif
8908 #ifdef EWOULDBLOCK
8909                 if (errno == EWOULDBLOCK)
8910                         printf("EWOULDBLOCK\n");
8911 #endif
8912         ok:
8913                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
8914                 sleep(2);                               /* Give it time to close our pipe */
8915                 alarm(5);
8916                 ret = read(pd[0], buf, 1);      /* Should read EOF */
8917                 alarm(0);
8918                 sprintf(string, "%d\n", ret);
8919                 write(3, string, strlen(string));
8920                 exit(0);
8921         }
8922
8923         close(pd[0]);                   /* We write to pd[1] */
8924         close(pu[1]);                   /* We read from pu[0] */
8925         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
8926         close(pd[1]);                   /* Pipe pd is now fully closed! */
8927         exit(0);                                /* Bye bye, thank you for playing! */
8928 }
8929 EOCP
8930         set try
8931         if eval $compile_ok; then
8932                 echo "$startsh" >mtry
8933                 echo "./try >try.out 2>try.ret 3>try.err || exit 4" >>mtry
8934                 chmod +x mtry
8935                 ./mtry >/dev/null 2>&1
8936                 case $? in
8937                 0) eagain=`$cat try.out`;;
8938                 1) echo "Could not perform non-blocking setting!";;
8939                 2) echo "I did a successful read() for something that was not there!";;
8940                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
8941                 *) echo "Something terribly wrong happened during testing.";;
8942                 esac
8943                 rd_nodata=`$cat try.ret`
8944                 echo "A read() system call with no data present returns $rd_nodata."
8945                 case "$rd_nodata" in
8946                 0|-1) ;;
8947                 *)
8948                         echo "(That's peculiar, fixing that to be -1.)"
8949                         rd_nodata=-1
8950                         ;;
8951                 esac
8952                 case "$eagain" in
8953                 '')
8954                         echo "Forcing errno EAGAIN on read() with no data available."
8955                         eagain=EAGAIN
8956                         ;;
8957                 *)
8958                         echo "Your read() sets errno to $eagain when no data is available."
8959                         ;;
8960                 esac
8961                 status=`$cat try.err`
8962                 case "$status" in
8963                 0) echo "And it correctly returns 0 to signal EOF.";;
8964                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
8965                 *) echo "However, your read() returns '$status' on EOF??";;
8966                 esac
8967                 val="$define"
8968                 if test "$status" = "$rd_nodata"; then
8969                         echo "WARNING: you can't distinguish between EOF and no data!"
8970                         val="$undef"
8971                 fi
8972         else
8973                 echo "I can't compile the test program--assuming errno EAGAIN will do."
8974                 eagain=EAGAIN
8975         fi
8976         set d_eofnblk
8977         eval $setvar
8978         ;;
8979 *)
8980         echo "Using $hint value $eagain."
8981         echo "Your read() returns $rd_nodata when no data is present."
8982         case "$d_eofnblk" in
8983         "$define") echo "And you can see EOF because read() returns 0.";;
8984         "$undef") echo "But you can't see EOF status from read() returned value.";;
8985         *)
8986                 echo "(Assuming you can't see EOF status from read anyway.)"
8987                 d_eofnblk=$undef
8988                 ;;
8989         esac
8990         ;;
8991 esac
8992 $rm -f try try.* .out core head.c mtry
8993
8994 : see if fchmod exists
8995 set fchmod d_fchmod
8996 eval $inlibc
8997
8998 : see if fchown exists
8999 set fchown d_fchown
9000 eval $inlibc
9001
9002 : see if this is an fcntl system
9003 set fcntl d_fcntl
9004 eval $inlibc
9005
9006 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
9007 while $test $# -ge 2; do
9008         case "$1" in
9009         $define) echo "#include <$2>";;
9010         esac ;
9011     shift 2;
9012 done > try.c;
9013 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
9014 set try;
9015 if eval $compile; then
9016         val="$define";
9017 else
9018         val="$undef";
9019 fi;
9020 set $varname;
9021 eval $setvar;
9022 $rm -f try.c try.o'
9023
9024 socketlib=''
9025 sockethdr=''
9026 : see whether socket exists
9027 echo " "
9028 $echo $n "Hmm... $c" >&4
9029 if set socket val -f d_socket; eval $csym; $val; then
9030         echo "Looks like you have Berkeley networking support." >&4
9031         d_socket="$define"
9032         if set setsockopt val -f; eval $csym; $val; then
9033                 d_oldsock="$undef"
9034         else
9035                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
9036                 d_oldsock="$define"
9037         fi
9038 else
9039         if $contains socklib libc.list >/dev/null 2>&1; then
9040                 echo "Looks like you have Berkeley networking support." >&4
9041                 d_socket="$define"
9042                 : we will have to assume that it supports the 4.2 BSD interface
9043                 d_oldsock="$undef"
9044         else
9045                 echo "You don't have Berkeley networking in libc$_a..." >&4
9046                 if test "X$d_socket" = "X$define"; then
9047                    echo "...but you seem to believe that you have sockets." >&4
9048                 else
9049                         for net in net socket
9050                         do
9051                                 if test -f /usr/lib/lib$net$_a; then
9052                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
9053                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
9054                                         if $contains socket libc.list >/dev/null 2>&1; then
9055                                                 d_socket="$define"
9056                                                 socketlib="-l$net"
9057                                                 case "$net" in
9058                                                 net)
9059                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
9060                                                         sockethdr="-I/usr/netinclude"
9061                                                         ;;
9062                                                 esac
9063                                                 echo "Found Berkeley sockets interface in lib$net." >& 4 
9064                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
9065                                                         d_oldsock="$undef"
9066                                                 else
9067                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
9068                                                         d_oldsock="$define"
9069                                                 fi
9070                                                 break
9071                                         fi
9072                                 fi
9073                         done
9074                         if test "X$d_socket" != "X$define"; then
9075                            echo "or anywhere else I see." >&4
9076                            d_socket="$undef"
9077                            d_oldsock="$undef"
9078                         fi
9079                 fi
9080         fi
9081 fi
9082
9083 : see if socketpair exists
9084 set socketpair d_sockpair
9085 eval $inlibc
9086
9087
9088 echo " "
9089 echo "Checking the availability of certain socket constants..." >& 4
9090 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
9091         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
9092         $cat >try.c <<EOF
9093 #include <sys/types.h>
9094 #include <sys/socket.h>
9095 int main() {
9096     int i = $ENUM;
9097 }
9098 EOF
9099         val="$undef"
9100         set try; if eval $compile; then
9101                 val="$define"
9102         fi
9103         set d_${enum}; eval $setvar
9104         $rm -f try.c try
9105 done
9106
9107 : see if sys/select.h has to be included
9108 set sys/select.h i_sysselct
9109 eval $inhdr
9110
9111 : see if we should include time.h, sys/time.h, or both
9112 echo " "
9113 if test "X$timeincl" = X; then
9114         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
9115         $echo $n "I'm now running the test program...$c"
9116         $cat >try.c <<'EOCP'
9117 #include <sys/types.h>
9118 #ifdef I_TIME
9119 #include <time.h>
9120 #endif
9121 #ifdef I_SYSTIME
9122 #ifdef SYSTIMEKERNEL
9123 #define KERNEL
9124 #endif
9125 #include <sys/time.h>
9126 #endif
9127 #ifdef I_SYSSELECT
9128 #include <sys/select.h>
9129 #endif
9130 int main()
9131 {
9132         struct tm foo;
9133 #ifdef S_TIMEVAL
9134         struct timeval bar;
9135 #endif
9136 #ifdef S_TIMEZONE
9137         struct timezone tzp;
9138 #endif
9139         if (foo.tm_sec == foo.tm_sec)
9140                 exit(0);
9141 #ifdef S_TIMEVAL
9142         if (bar.tv_sec == bar.tv_sec)
9143                 exit(0);
9144 #endif
9145         exit(1);
9146 }
9147 EOCP
9148         flags=''
9149         for s_timezone in '-DS_TIMEZONE' ''; do
9150         sysselect=''
9151         for s_timeval in '-DS_TIMEVAL' ''; do
9152         for i_systimek in '' '-DSYSTIMEKERNEL'; do
9153         for i_time in '' '-DI_TIME'; do
9154         for i_systime in '-DI_SYSTIME' ''; do
9155                 case "$flags" in
9156                 '') $echo $n ".$c"
9157                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
9158                         if eval $compile; then
9159                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
9160                                 shift
9161                                 flags="$*"
9162                                 echo " "
9163                                 $echo $n "Succeeded with $flags$c"
9164                         fi
9165                         ;;
9166                 esac
9167         done
9168         done
9169         done
9170         done
9171         done
9172         timeincl=''
9173         echo " "
9174         case "$flags" in
9175         *SYSTIMEKERNEL*) i_systimek="$define"
9176                 timeincl=`./findhdr sys/time.h`
9177                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
9178         *) i_systimek="$undef";;
9179         esac
9180         case "$flags" in
9181         *I_TIME*) i_time="$define"
9182                 timeincl=`./findhdr time.h`" $timeincl"
9183                 echo "We'll include <time.h>." >&4;;
9184         *) i_time="$undef";;
9185         esac
9186         case "$flags" in
9187         *I_SYSTIME*) i_systime="$define"
9188                 timeincl=`./findhdr sys/time.h`" $timeincl"
9189                 echo "We'll include <sys/time.h>." >&4;;
9190         *) i_systime="$undef";;
9191         esac
9192         $rm -f try.c try
9193 fi
9194
9195 : check for fd_set items
9196 $cat <<EOM
9197
9198 Checking to see how well your C compiler handles fd_set and friends ...
9199 EOM
9200 $cat >fd_set.c <<EOCP
9201 #$i_systime I_SYS_TIME
9202 #$i_sysselct I_SYS_SELECT
9203 #$d_socket HAS_SOCKET
9204 #include <sys/types.h>
9205 #ifdef HAS_SOCKET
9206 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
9207 #endif
9208 #ifdef I_SYS_TIME
9209 #include <sys/time.h>
9210 #endif
9211 #ifdef I_SYS_SELECT
9212 #include <sys/select.h>
9213 #endif
9214 int main() {
9215         fd_set fds;
9216
9217 #ifdef TRYBITS
9218         if(fds.fds_bits);
9219 #endif
9220
9221 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
9222         exit(0);
9223 #else
9224         exit(1);
9225 #endif
9226 }
9227 EOCP
9228 set fd_set -DTRYBITS
9229 if eval $compile; then
9230         d_fds_bits="$define"
9231         d_fd_set="$define"
9232         echo "Well, your system knows about the normal fd_set typedef..." >&4
9233         if ./fd_set; then
9234                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
9235                 d_fd_macros="$define"
9236         else
9237                 $cat >&4 <<'EOM'
9238 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
9239 EOM
9240                 d_fd_macros="$undef"
9241         fi
9242 else
9243         $cat <<'EOM'
9244 Hmm, your compiler has some difficulty with fd_set.  Checking further...
9245 EOM
9246         set fd_set
9247         if eval $compile; then
9248                 d_fds_bits="$undef"
9249                 d_fd_set="$define"
9250                 echo "Well, your system has some sort of fd_set available..." >&4
9251                 if ./fd_set; then
9252                         echo "and you have the normal fd_set macros." >&4
9253                         d_fd_macros="$define"
9254                 else
9255                         $cat <<'EOM'
9256 but not the normal fd_set macros!  Gross!  More work for me...
9257 EOM
9258                         d_fd_macros="$undef"
9259                 fi
9260         else
9261         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
9262                 d_fd_set="$undef"
9263                 d_fds_bits="$undef"
9264                 d_fd_macros="$undef"
9265         fi
9266 fi
9267 $rm -f fd_set*
9268
9269 : see if fgetpos exists
9270 set fgetpos d_fgetpos
9271 eval $inlibc
9272
9273 : see if flock exists
9274 set flock d_flock
9275 eval $inlibc
9276
9277 : see if fork exists
9278 set fork d_fork
9279 eval $inlibc
9280
9281 : see if pathconf exists
9282 set pathconf d_pathconf
9283 eval $inlibc
9284
9285 : see if fpathconf exists
9286 set fpathconf d_fpathconf
9287 eval $inlibc
9288
9289
9290 : check for fpos64_t
9291 echo " "
9292 echo "Checking to see if you have fpos64_t..." >&4
9293 $cat >try.c <<EOCP
9294 #include <stdio.h>
9295 int main() { fpos64_t x = 7; }
9296 EOCP
9297 set try
9298 if eval $compile; then
9299         val="$define"
9300         echo "You have fpos64_t."
9301 else
9302         val="$undef"
9303         echo "You do not have fpos64_t."
9304         case "$fpossize" in
9305         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
9306         esac
9307 fi
9308 $rm -f try.* try
9309 set d_fpos64_t
9310 eval $setvar
9311
9312 : see if frexpl exists
9313 set frexpl d_frexpl
9314 eval $inlibc
9315
9316 hasstruct='varname=$1; struct=$2; shift; shift;
9317 while $test $# -ge 2; do
9318         case "$1" in
9319         $define) echo "#include <$2>";;
9320         esac ;
9321     shift 2;
9322 done > try.c;
9323 echo "int main () { struct $struct foo; }" >> try.c;
9324 set try;
9325 if eval $compile; then
9326         val="$define";
9327 else
9328         val="$undef";
9329 fi;
9330 set $varname;
9331 eval $setvar;
9332 $rm -f try.c try.o'
9333
9334 : see if this is a sys/param system
9335 set sys/param.h i_sysparam
9336 eval $inhdr
9337
9338 : see if this is a sys/mount.h system
9339 set sys/mount.h i_sysmount
9340 eval $inhdr
9341
9342 : see if sys/types.h has to be included
9343 set sys/types.h i_systypes
9344 eval $inhdr
9345
9346
9347 echo " "
9348 echo "Checking to see if your system supports struct fs_data..." >&4
9349 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
9350 eval $hasstruct
9351 case "$d_fs_data_s" in
9352 "$define")      echo "Yes, it does."   ;;
9353 *)              echo "No, it doesn't." ;;
9354 esac
9355
9356 : see if fseeko exists
9357 set fseeko d_fseeko
9358 eval $inlibc
9359 case "$longsize" in
9360 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
9361 esac
9362
9363 : see if fsetpos exists
9364 set fsetpos d_fsetpos
9365 eval $inlibc
9366
9367
9368 : see if fstatfs exists
9369 set fstatfs d_fstatfs
9370 eval $inlibc
9371
9372
9373 : see if statvfs exists
9374 set statvfs d_statvfs
9375 eval $inlibc
9376
9377 : see if fstatvfs exists
9378 set fstatvfs d_fstatvfs
9379 eval $inlibc
9380
9381
9382 : see if ftello exists
9383 set ftello d_ftello
9384 eval $inlibc
9385 case "$longsize" in
9386 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
9387 esac
9388
9389 : see if getcwd exists
9390 set getcwd d_getcwd
9391 eval $inlibc
9392
9393 : see if getespwnam exists
9394 set getespwnam d_getespwnam
9395 eval $inlibc
9396
9397
9398 : see if getfsstat exists
9399 set getfsstat d_getfsstat
9400 eval $inlibc
9401
9402 : see if getgrent exists
9403 set getgrent d_getgrent
9404 eval $inlibc
9405
9406 : see if gethostbyaddr exists
9407 set gethostbyaddr d_gethbyaddr
9408 eval $inlibc
9409
9410 : see if gethostbyname exists
9411 set gethostbyname d_gethbyname
9412 eval $inlibc
9413
9414 : see if gethostent exists
9415 set gethostent d_gethent
9416 eval $inlibc
9417
9418 : see how we will look up host name
9419 echo " "
9420 call=''
9421 if set gethostname val -f d_gethname; eval $csym; $val; then
9422         echo 'gethostname() found.' >&4
9423         d_gethname="$define"
9424         call=gethostname
9425 fi
9426 if set uname val -f d_uname; eval $csym; $val; then
9427         if ./xenix; then
9428                 $cat <<'EOM'
9429 uname() was found, but you're running xenix, and older versions of xenix
9430 have a broken uname(). If you don't really know whether your xenix is old
9431 enough to have a broken system call, use the default answer.
9432
9433 EOM
9434                 dflt=y
9435                 case "$d_uname" in
9436                 "$define") dflt=n;;
9437                 esac
9438                 rp='Is your uname() broken?'
9439                 . ./myread
9440                 case "$ans" in
9441                 n*) d_uname="$define"; call=uname;;
9442                 esac
9443         else
9444                 echo 'uname() found.' >&4
9445                 d_uname="$define"
9446                 case "$call" in
9447                 '') call=uname ;;
9448                 esac
9449         fi
9450 fi
9451 case "$d_gethname" in
9452 '') d_gethname="$undef";;
9453 esac
9454 case "$d_uname" in
9455 '') d_uname="$undef";;
9456 esac
9457 case "$d_uname$d_gethname" in
9458 *define*)
9459         dflt=n
9460         cat <<EOM
9461  
9462 Every now and then someone has a $call() that lies about the hostname
9463 but can't be fixed for political or economic reasons.  If you wish, I can
9464 pretend $call() isn't there and maybe compute hostname at run-time
9465 thanks to the '$phostname' command.
9466
9467 EOM
9468         rp="Shall I ignore $call() from now on?"
9469         . ./myread
9470         case "$ans" in
9471         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
9472         esac;;
9473 esac
9474 case "$phostname" in
9475 '') aphostname='';;
9476 *) case "$aphostname" in
9477         /*) ;;
9478         *) set X $phostname
9479                 shift
9480                 file=$1
9481                 shift
9482                 file=`./loc $file $file $pth`
9483                 aphostname=`echo $file $*`
9484                 ;;
9485         esac
9486         ;;
9487 esac
9488 case "$d_uname$d_gethname" in
9489 *define*) ;;
9490 *)
9491         case "$phostname" in
9492         '')
9493                 echo "There will be no way for $package to get your hostname." >&4;;
9494         *)
9495         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
9496                 ;;
9497         esac;;
9498 esac
9499 case "$d_phostname" in
9500 '') d_phostname="$undef";;
9501 esac
9502
9503 : see if this is a netdb.h system
9504 set netdb.h i_netdb
9505 eval $inhdr
9506
9507 : see if prototypes for various gethostxxx netdb.h functions are available
9508 echo " "
9509 set d_gethostprotos gethostent $i_netdb netdb.h
9510 eval $hasproto
9511
9512 : see if getlogin exists
9513 set getlogin d_getlogin
9514 eval $inlibc
9515
9516 : see if getmnt exists
9517 set getmnt d_getmnt
9518 eval $inlibc
9519
9520 : see if getmntent exists
9521 set getmntent d_getmntent
9522 eval $inlibc
9523
9524 : see if getnetbyaddr exists
9525 set getnetbyaddr d_getnbyaddr
9526 eval $inlibc
9527
9528 : see if getnetbyname exists
9529 set getnetbyname d_getnbyname
9530 eval $inlibc
9531
9532 : see if getnetent exists
9533 set getnetent d_getnent
9534 eval $inlibc
9535
9536 : see if prototypes for various getnetxxx netdb.h functions are available
9537 echo " "
9538 set d_getnetprotos getnetent $i_netdb netdb.h
9539 eval $hasproto
9540
9541
9542 : see if getprotobyname exists
9543 set getprotobyname d_getpbyname
9544 eval $inlibc
9545
9546 : see if getprotobynumber exists
9547 set getprotobynumber d_getpbynumber
9548 eval $inlibc
9549
9550 : see if getprotoent exists
9551 set getprotoent d_getpent
9552 eval $inlibc
9553
9554 : see if getpgid exists
9555 set getpgid d_getpgid
9556 eval $inlibc
9557
9558 : see if getpgrp2 exists
9559 set getpgrp2 d_getpgrp2
9560 eval $inlibc
9561
9562 : see if getppid exists
9563 set getppid d_getppid
9564 eval $inlibc
9565
9566 : see if getpriority exists
9567 set getpriority d_getprior
9568 eval $inlibc
9569
9570 : see if prototypes for various getprotoxxx netdb.h functions are available
9571 echo " "
9572 set d_getprotoprotos getprotoent $i_netdb netdb.h
9573 eval $hasproto
9574
9575 : see if getprpwnam exists
9576 set getprpwnam d_getprpwnam
9577 eval $inlibc
9578
9579 : see if getpwent exists
9580 set getpwent d_getpwent
9581 eval $inlibc
9582
9583
9584 : see if getservbyname exists
9585 set getservbyname d_getsbyname
9586 eval $inlibc
9587
9588 : see if getservbyport exists
9589 set getservbyport d_getsbyport
9590 eval $inlibc
9591
9592 : see if getservent exists
9593 set getservent d_getsent
9594 eval $inlibc
9595
9596 : see if prototypes for various getservxxx netdb.h functions are available
9597 echo " "
9598 set d_getservprotos getservent $i_netdb netdb.h
9599 eval $hasproto
9600
9601 : see if getspnam exists
9602 set getspnam d_getspnam
9603 eval $inlibc
9604
9605 : see if gettimeofday or ftime exists
9606 set gettimeofday d_gettimeod
9607 eval $inlibc
9608 case "$d_gettimeod" in
9609 "$undef")
9610         set ftime d_ftime 
9611         eval $inlibc
9612         ;;
9613 *)
9614         val="$undef"; set d_ftime; eval $setvar
9615         ;;
9616 esac
9617 case "$d_gettimeod$d_ftime" in
9618 "$undef$undef")
9619         echo " "
9620         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
9621         ;;
9622 esac
9623
9624 : see if this is an grp system
9625 set grp.h i_grp
9626 eval $inhdr
9627
9628 case "$i_grp" in
9629 $define)
9630         xxx=`./findhdr grp.h`
9631         $cppstdin $cppflags $cppminus < $xxx >$$.h
9632
9633         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
9634                 val="$define"
9635         else
9636                 val="$undef"
9637         fi
9638         set d_grpasswd
9639         eval $setvar
9640
9641         $rm -f $$.h
9642         ;;
9643 *)
9644         val="$undef";
9645         set d_grpasswd; eval $setvar
9646         ;;
9647 esac
9648
9649 : see if hasmntopt exists
9650 set hasmntopt d_hasmntopt
9651 eval $inlibc
9652
9653 : see if this is a netinet/in.h or sys/in.h system
9654 set netinet/in.h i_niin sys/in.h i_sysin
9655 eval $inhdr
9656
9657 : see if arpa/inet.h has to be included
9658 set arpa/inet.h i_arpainet
9659 eval $inhdr
9660
9661 : see if htonl --and friends-- exists
9662 val=''
9663 set htonl val
9664 eval $inlibc
9665
9666 : Maybe they are macros.
9667 case "$val" in
9668 $undef)
9669         $cat >htonl.c <<EOM
9670 #include <stdio.h>
9671 #include <sys/types.h>
9672 #$i_niin I_NETINET_IN
9673 #$i_sysin I_SYS_IN
9674 #$i_arpainet I_ARPA_INET
9675 #ifdef I_NETINET_IN
9676 #include <netinet/in.h>
9677 #endif
9678 #ifdef I_SYS_IN
9679 #include <sys/in.h>
9680 #endif
9681 #ifdef I_ARPA_INET
9682 #include <arpa/inet.h>
9683 #endif
9684 #ifdef htonl
9685 printf("Defined as a macro.");
9686 #endif
9687 EOM
9688         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
9689         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
9690                 val="$define"
9691                 echo "But it seems to be defined as a macro." >&4
9692         fi
9693         $rm -f htonl.?
9694         ;;
9695 esac
9696 set d_htonl
9697 eval $setvar
9698
9699 : see if iconv exists
9700 set iconv d_iconv
9701 eval $inlibc
9702
9703 : index or strchr
9704 echo " "
9705 if set index val -f; eval $csym; $val; then
9706         if set strchr val -f d_strchr; eval $csym; $val; then
9707                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
9708                         val="$define"
9709                         vali="$undef"
9710                         echo "strchr() found." >&4
9711                 else
9712                         val="$undef"
9713                         vali="$define"
9714                         echo "index() found." >&4
9715                 fi
9716         else
9717                 val="$undef"
9718                 vali="$define"
9719                 echo "index() found." >&4
9720         fi
9721 else
9722         if set strchr val -f d_strchr; eval $csym; $val; then
9723                 val="$define"
9724                 vali="$undef"
9725                 echo "strchr() found." >&4
9726         else
9727                 echo "No index() or strchr() found!" >&4
9728                 val="$undef"
9729                 vali="$undef"
9730         fi
9731 fi
9732 set d_strchr; eval $setvar
9733 val="$vali"
9734 set d_index; eval $setvar
9735
9736 : check whether inet_aton exists
9737 set inet_aton d_inetaton
9738 eval $inlibc
9739
9740 : see if inttypes.h is available
9741 : we want a real compile instead of Inhdr because some systems
9742 : have an inttypes.h which includes non-existent headers
9743 echo " "
9744 $cat >try.c <<EOCP
9745 #include <inttypes.h>
9746 int main() {
9747         static int32_t foo32 = 0x12345678;
9748 }
9749 EOCP
9750 set try
9751 if eval $compile; then
9752         echo "<inttypes.h> found." >&4
9753         val="$define"
9754 else
9755         echo "<inttypes.h> NOT found." >&4
9756         val="$undef"
9757 fi
9758 $rm -f try.c try
9759 set i_inttypes
9760 eval $setvar
9761
9762 : check for int64_t
9763 echo " "
9764 echo "Checking to see if you have int64_t..." >&4
9765 $cat >try.c <<EOCP
9766 #include <sys/types.h>
9767 #$i_inttypes I_INTTYPES
9768 #ifdef I_INTTYPES
9769 #include <inttypes.h>
9770 #endif
9771 int main() { int64_t x = 7; }
9772 EOCP
9773 set try
9774 if eval $compile; then
9775         val="$define"
9776         echo "You have int64_t."
9777 else
9778         val="$undef"
9779         echo "You do not have int64_t."
9780 fi
9781 $rm -f try try.*
9782 set d_int64_t
9783 eval $setvar
9784
9785 : Look for isascii
9786 echo " "
9787 $cat >isascii.c <<'EOCP'
9788 #include <stdio.h>
9789 #include <ctype.h>
9790 int main() {
9791         int c = 'A';
9792         if (isascii(c))
9793                 exit(0);
9794         else
9795                 exit(1);
9796 }
9797 EOCP
9798 set isascii
9799 if eval $compile; then
9800         echo "isascii() found." >&4
9801         val="$define"
9802 else
9803         echo "isascii() NOT found." >&4
9804         val="$undef"
9805 fi
9806 set d_isascii
9807 eval $setvar
9808 $rm -f isascii*
9809
9810 : see if isnan exists
9811 set isnan d_isnan
9812 eval $inlibc
9813
9814 : see if isnanl exists
9815 set isnanl d_isnanl
9816 eval $inlibc
9817
9818 : see if killpg exists
9819 set killpg d_killpg
9820 eval $inlibc
9821
9822 : see if lchown exists
9823 echo " "
9824 $cat > try.c <<'EOCP'
9825 /* System header to define __stub macros and hopefully few prototypes,
9826     which can conflict with char lchown(); below.  */
9827 #include <assert.h>
9828 /* Override any gcc2 internal prototype to avoid an error.  */
9829 /* We use char because int might match the return type of a gcc2
9830    builtin and then its argument prototype would still apply.  */
9831 char lchown();
9832 int main() {
9833     /*  The GNU C library defines this for functions which it implements
9834         to always fail with ENOSYS.  Some functions are actually named
9835         something starting with __ and the normal name is an alias.  */
9836 #if defined (__stub_lchown) || defined (__stub___lchown)
9837 choke me
9838 #else
9839 lchown();
9840 #endif
9841 ; return 0; }
9842 EOCP
9843 set try
9844 if eval $compile; then
9845     $echo "lchown() found." >&4
9846     val="$define"
9847 else
9848     $echo "lchown() NOT found." >&4
9849     val="$undef"
9850 fi
9851 set d_lchown
9852 eval $setvar
9853
9854 : See if number of significant digits in a double precision number is known
9855 echo " "
9856 $cat >ldbl_dig.c <<EOM
9857 #$i_limits I_LIMITS
9858 #$i_float I_FLOAT
9859 #ifdef I_LIMITS
9860 #include <limits.h>
9861 #endif
9862 #ifdef I_FLOAT
9863 #include <float.h>
9864 #endif
9865 #ifdef LDBL_DIG
9866 printf("Contains LDBL_DIG");
9867 #endif
9868 EOM
9869 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
9870 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
9871         echo "LDBL_DIG found." >&4
9872         val="$define"
9873 else
9874         echo "LDBL_DIG NOT found." >&4
9875         val="$undef"
9876 fi
9877 $rm -f ldbl_dig.?
9878 set d_ldbl_dig
9879 eval $setvar
9880
9881 : see if link exists
9882 set link d_link
9883 eval $inlibc
9884
9885 : see if localeconv exists
9886 set localeconv d_locconv
9887 eval $inlibc
9888
9889 : see if lockf exists
9890 set lockf d_lockf
9891 eval $inlibc
9892
9893 : check for long long
9894 echo " "
9895 echo "Checking to see if you have long long..." >&4
9896 echo 'int main() { long long x = 7; return 0; }' > try.c
9897 set try
9898 if eval $compile; then
9899         val="$define"
9900         echo "You have long long."
9901 else
9902         val="$undef"
9903         echo "You do not have long long."
9904 fi
9905 $rm try.*
9906 set d_longlong
9907 eval $setvar
9908
9909 : check for length of long long
9910 case "${d_longlong}${longlongsize}" in
9911 $define)
9912         echo " "
9913         echo "Checking to see how big your long longs are..." >&4
9914         $cat >try.c <<'EOCP'
9915 #include <stdio.h>
9916 int main()
9917 {
9918     printf("%d\n", (int)sizeof(long long));
9919     return(0);
9920 }
9921 EOCP
9922         set try
9923         if eval $compile_ok; then
9924                 longlongsize=`./try$exe_ext`
9925                 echo "Your long longs are $longlongsize bytes long."
9926         else
9927                 dflt='8'
9928                 echo " "
9929                 echo "(I can't seem to compile the test program.  Guessing...)"
9930                 rp="What is the size of a long long (in bytes)?"
9931                 . ./myread
9932                 longlongsize="$ans"
9933         fi
9934         if $test "X$longsize" = "X$longlongsize"; then
9935                 echo "(That isn't any different from an ordinary long.)"
9936         fi      
9937         ;;
9938 esac
9939 $rm -f try.* try
9940
9941 : see if prototype for lseek is available
9942 echo " "
9943 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
9944 eval $hasproto
9945
9946 : see if lstat exists
9947 set lstat d_lstat
9948 eval $inlibc
9949
9950 : see if madvise exists
9951 set madvise d_madvise
9952 eval $inlibc
9953
9954 : see if mblen exists
9955 set mblen d_mblen
9956 eval $inlibc
9957
9958 : see if mbstowcs exists
9959 set mbstowcs d_mbstowcs
9960 eval $inlibc
9961
9962 : see if mbtowc exists
9963 set mbtowc d_mbtowc
9964 eval $inlibc
9965
9966 : see if memchr exists
9967 set memchr d_memchr
9968 eval $inlibc
9969
9970 : see if memcmp exists
9971 set memcmp d_memcmp
9972 eval $inlibc
9973
9974 : see if memcpy exists
9975 set memcpy d_memcpy
9976 eval $inlibc
9977
9978 : see if memmove exists
9979 set memmove d_memmove
9980 eval $inlibc
9981
9982 : see if memset exists
9983 set memset d_memset
9984 eval $inlibc
9985
9986 : see if mkdir exists
9987 set mkdir d_mkdir
9988 eval $inlibc
9989
9990 : see if mkdtemp exists
9991 set mkdtemp d_mkdtemp
9992 eval $inlibc
9993
9994 : see if mkfifo exists
9995 set mkfifo d_mkfifo
9996 eval $inlibc
9997
9998 : see if mkstemp exists
9999 set mkstemp d_mkstemp
10000 eval $inlibc
10001
10002 : see if mkstemps exists
10003 set mkstemps d_mkstemps
10004 eval $inlibc
10005
10006 : see if mktime exists
10007 set mktime d_mktime
10008 eval $inlibc
10009
10010 : see if this is a sys/mman.h system
10011 set sys/mman.h i_sysmman
10012 eval $inhdr
10013
10014 : see if mmap exists
10015 set mmap d_mmap
10016 eval $inlibc
10017 : see what shmat returns
10018 : default to something harmless
10019 mmaptype='void *'
10020 case "$i_sysmman$d_mmap" in
10021 "$define$define")
10022         $cat >mmap.c <<'END'
10023 #include <sys/mman.h>
10024 void *mmap();
10025 END
10026         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
10027                 mmaptype='void *'
10028         else
10029                 mmaptype='caddr_t'
10030         fi
10031         echo "and it returns ($mmaptype)." >&4
10032         ;;
10033 esac
10034
10035
10036
10037 : see if modfl exists
10038 set modfl d_modfl
10039 eval $inlibc
10040
10041 : see if mprotect exists
10042 set mprotect d_mprotect
10043 eval $inlibc
10044
10045 : see if msgctl exists
10046 set msgctl d_msgctl
10047 eval $inlibc
10048
10049 : see if msgget exists
10050 set msgget d_msgget
10051 eval $inlibc
10052
10053 : see if msgsnd exists
10054 set msgsnd d_msgsnd
10055 eval $inlibc
10056
10057 : see if msgrcv exists
10058 set msgrcv d_msgrcv
10059 eval $inlibc
10060
10061 : see how much of the 'msg*(2)' library is present.
10062 h_msg=true
10063 echo " "
10064 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
10065 *"$undef"*) h_msg=false;;
10066 esac
10067 case "$osname" in
10068 freebsd)
10069     case "`ipcs 2>&1`" in
10070     "SVID messages"*"not configured"*)
10071         echo "Your $osname does not have the msg*(2) configured." >&4
10072         h_msg=false
10073         val="$undef"
10074         set msgctl d_msgctl
10075         eval $setvar
10076         set msgget d_msgget
10077         eval $setvar
10078         set msgsnd d_msgsnd
10079         eval $setvar
10080         set msgrcv d_msgrcv
10081         eval $setvar
10082         ;;
10083     esac
10084     ;;
10085 esac
10086 : we could also check for sys/ipc.h ...
10087 if $h_msg && $test `./findhdr sys/msg.h`; then
10088         echo "You have the full msg*(2) library." >&4
10089         val="$define"
10090 else
10091         echo "You don't have the full msg*(2) library." >&4
10092         val="$undef"
10093 fi
10094 set d_msg
10095 eval $setvar
10096
10097 : see if msync exists
10098 set msync d_msync
10099 eval $inlibc
10100
10101 : see if munmap exists
10102 set munmap d_munmap
10103 eval $inlibc
10104
10105 : see if nice exists
10106 set nice d_nice
10107 eval $inlibc
10108
10109
10110 echo " "
10111 echo "Checking which 64-bit integer type we could use..." >&4
10112
10113 case "$intsize" in
10114 8) val=int
10115    set quadtype
10116    eval $setvar
10117    val='"unsigned int"'
10118    set uquadtype
10119    eval $setvar
10120    quadkind=1
10121    ;;
10122 *) case "$longsize" in
10123    8) val=long
10124       set quadtype
10125       eval $setvar
10126       val='"unsigned long"'
10127       set uquadtype
10128       eval $setvar
10129       quadkind=2
10130       ;;
10131    *) case "$d_longlong:$longlongsize" in
10132       define:8)
10133         val='"long long"'
10134         set quadtype
10135         eval $setvar
10136         val='"unsigned long long"'
10137         set uquadtype
10138         eval $setvar
10139         quadkind=3
10140         ;;
10141       *) case "$d_int64_t" in
10142          define)
10143            val=int64_t
10144            set quadtype
10145            eval $setvar
10146            val=uint64_t
10147            set uquadtype
10148            eval $setvar
10149            quadkind=4
10150            ;;
10151          esac
10152          ;;
10153       esac
10154       ;;
10155    esac
10156    ;;
10157 esac
10158
10159 case "$quadtype" in
10160 '')     echo "Alas, no 64-bit integer types in sight." >&4
10161         d_quad="$undef"
10162         ;;
10163 *)      if test X"$use64bitint" = Xdefine -o X"$longsize" = X8; then
10164             verb="will"
10165         else
10166             verb="could"
10167         fi
10168         echo "We $verb use '$quadtype' for 64-bit integers." >&4
10169         d_quad="$define"
10170         ;;
10171 esac
10172
10173 : check for length of character
10174 echo " "
10175 case "$charsize" in
10176 '')
10177         echo "Checking to see how big your characters are (hey, you never know)..." >&4
10178         $cat >try.c <<'EOCP'
10179 #include <stdio.h>
10180 int main()
10181 {
10182     printf("%d\n", (int)sizeof(char));
10183     exit(0);
10184 }
10185 EOCP
10186         set try
10187         if eval $compile_ok; then
10188                 dflt=`./try`
10189         else
10190                 dflt='1'
10191                 echo "(I can't seem to compile the test program.  Guessing...)"
10192         fi
10193         ;;
10194 *)
10195         dflt="$charsize"
10196         ;;
10197 esac
10198 rp="What is the size of a character (in bytes)?"
10199 . ./myread
10200 charsize="$ans"
10201 $rm -f try.c try
10202
10203
10204 echo " "
10205 $echo "Choosing the C types to be used for Perl's internal types..." >&4
10206
10207 case "$use64bitint:$d_quad:$quadtype" in
10208 define:define:?*)
10209         ivtype="$quadtype"
10210         uvtype="$uquadtype"
10211         ivsize=8
10212         uvsize=8
10213         ;;
10214 *)      ivtype="long"
10215         uvtype="unsigned long"
10216         ivsize=$longsize
10217         uvsize=$longsize
10218         ;;
10219 esac
10220
10221 case "$uselongdouble:$d_longdbl" in
10222 define:define)
10223         nvtype="long double"
10224         nvsize=$longdblsize
10225         ;;
10226 *)      nvtype=double
10227         nvsize=$doublesize
10228         ;;
10229 esac
10230
10231 $echo "(IV will be "$ivtype", $ivsize bytes)"
10232 $echo "(UV will be "$uvtype", $uvsize bytes)"
10233 $echo "(NV will be "$nvtype", $nvsize bytes)"
10234
10235 $cat >try.c <<EOCP
10236 #$i_inttypes I_INTTYPES
10237 #ifdef I_INTTYPES
10238 #include <inttypes.h>
10239 #endif
10240 #include <stdio.h>
10241 int main() {
10242 #ifdef INT8
10243    int8_t i =  INT8_MAX;
10244   uint8_t u = UINT8_MAX;
10245   printf("int8_t\n");
10246 #endif
10247 #ifdef INT16
10248    int16_t i =  INT16_MAX;
10249   uint16_t i = UINT16_MAX;
10250   printf("int16_t\n");
10251 #endif
10252 #ifdef INT32
10253    int32_t i =  INT32_MAX;
10254   uint32_t u = UINT32_MAX;
10255   printf("int32_t\n");
10256 #endif
10257 }
10258 EOCP
10259
10260 case "$i8type" in
10261 '')     case "$charsize" in
10262         1)      i8type=char
10263                 u8type="unsigned char"
10264                 i8size=$charsize
10265                 u8size=$charsize
10266                 ;;
10267         esac
10268         ;;
10269 esac
10270 case "$i8type" in
10271 '')     set try -DINT8
10272         if eval $compile; then
10273                 case "`./try$exe_ext`" in
10274                 int8_t) i8type=int8_t
10275                         u8type=uint8_t
10276                         i8size=1
10277                         u8size=1
10278                         ;;
10279                 esac
10280         fi
10281         ;;
10282 esac
10283 case "$i8type" in
10284 '')     if $test $charsize -ge 1; then
10285                 i8type=char
10286                 u8type="unsigned char"
10287                 i8size=$charsize
10288                 u8size=$charsize
10289         fi
10290         ;;
10291 esac
10292
10293 case "$i16type" in
10294 '')     case "$shortsize" in
10295         2)      i16type=short
10296                 u16type="unsigned short"
10297                 i16size=$shortsize
10298                 u16size=$shortsize
10299                 ;;
10300         esac
10301         ;;
10302 esac
10303 case "$i16type" in
10304 '')     set try -DINT16
10305         if eval $compile; then
10306                 case "`./try$exe_ext`" in
10307                 int16_t)
10308                         i16type=int16_t
10309                         u16type=uint16_t
10310                         i16size=2
10311                         u16size=2
10312                         ;;
10313                 esac
10314         fi
10315         ;;
10316 esac
10317 case "$i16type" in
10318 '')     if $test $shortsize -ge 2; then
10319                 i16type=short
10320                 u16type="unsigned short"
10321                 i16size=$shortsize
10322                 u16size=$shortsize
10323         fi
10324         ;;
10325 esac
10326
10327 case "$i32type" in
10328 '')     case "$longsize" in
10329         4)      i32type=long
10330                 u32type="unsigned long"
10331                 i32size=$longsize
10332                 u32size=$longsize
10333                 ;;
10334         *)      case "$intsize" in
10335                 4)      i32type=int
10336                         u32type="unsigned int"
10337                         i32size=$intsize
10338                         u32size=$intsize
10339                         ;;
10340                 esac
10341                 ;;
10342         esac
10343         ;;
10344 esac
10345 case "$i32type" in
10346 '')     set try -DINT32
10347         if eval $compile; then
10348                 case "`./try$exe_ext`" in
10349                 int32_t)
10350                         i32type=int32_t
10351                         u32type=uint32_t
10352                         i32size=4
10353                         u32size=4
10354                         ;;
10355                 esac
10356         fi
10357         ;;
10358 esac
10359 case "$i32type" in
10360 '')     if $test $intsize -ge 4; then
10361                 i32type=int
10362                 u32type="unsigned int"
10363                 i32size=$intsize
10364                 u32size=$intsize
10365         fi
10366         ;;
10367 esac
10368
10369 case "$i64type" in
10370 '')     case "$d_quad:$quadtype" in
10371         define:?*)
10372                 i64type="$quadtype"
10373                 u64type="$uquadtype"
10374                 i64size=8
10375                 u64size=8
10376                 ;;
10377         esac
10378         ;;
10379 esac
10380
10381 $echo "Checking whether your NVs can preserve your UVs..." >&4
10382 $cat <<EOP >try.c
10383 #include <stdio.h>
10384 int main() {
10385     $uvtype k = ($uvtype)~0, l;
10386     $nvtype d;
10387     l = k;
10388     d = ($nvtype)l;
10389     l = ($uvtype)d;
10390     if (l == k)
10391        printf("preserve\n");
10392     exit(0);
10393 }
10394 EOP
10395 set try
10396 if eval $compile; then
10397         case "`./try$exe_ext`" in
10398         preserve) d_nv_preserves_uv="$define" ;;
10399         esac
10400 fi      
10401 case "$d_nv_preserves_uv" in
10402 $define) $echo "Yes, they can."  2>&1 ;;
10403 *)       $echo "No, they can't." 2>&1
10404          d_nv_preserves_uv="$undef"
10405          ;;
10406 esac
10407
10408 $rm -f try.* try
10409
10410 case "$d_nv_preserves_uv" in
10411 "$define") d_nv_preserves_uv_bits=`expr $uvsize \* 8` ;;
10412 *)      $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
10413         $cat <<EOP >try.c
10414 #include <stdio.h>
10415 int main() {
10416     $uvtype u = 0;
10417     int     n = 8 * $uvsize;
10418     int     i;
10419     for (i = 0; i < n; i++) {
10420       u = u << 1 | ($uvtype)1;
10421       if (($uvtype)($nvtype)u != u)
10422         break;
10423     }
10424     printf("%d\n", i);
10425     exit(0);
10426 }
10427 EOP
10428         set try
10429         if eval $compile; then
10430                 d_nv_preserves_uv_bits="`./try$exe_ext`"
10431         fi
10432         case "$d_nv_preserves_uv_bits" in
10433         [1-9]*) $echo "Your NVs can preserve $d_nv_preserves_uv_bits bits of your UVs."  2>&1 ;;
10434         *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
10435                 d_nv_preserves_uv_bits="$undef"
10436                 ;;
10437         esac
10438         $rm -f try.* try
10439         ;;
10440 esac
10441
10442
10443 : check for off64_t
10444 echo " "
10445 echo "Checking to see if you have off64_t..." >&4
10446 $cat >try.c <<EOCP
10447 #include <sys/types.h>
10448 #include <unistd.h>
10449 int main() { off64_t x = 7; }
10450 EOCP
10451 set try
10452 if eval $compile; then
10453         val="$define"
10454         echo "You have off64_t."
10455 else
10456         val="$undef"
10457         echo "You do not have off64_t."
10458         case "$lseeksize" in
10459         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
10460         esac
10461 fi
10462 $rm -f try.* try
10463 set d_off64_t
10464 eval $setvar
10465
10466 : see if POSIX threads are available
10467 set pthread.h i_pthread
10468 eval $inhdr
10469
10470
10471
10472
10473 : how to create joinable pthreads
10474 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
10475         echo " "
10476         echo "Checking what constant to use for creating joinable pthreads..." >&4 
10477         $cat >try.c <<'EOCP'
10478 #include <pthread.h>
10479 int main() {
10480     int detachstate = JOINABLE;
10481 }
10482 EOCP
10483         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
10484         if eval $compile; then
10485                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
10486                 val="$undef" # Yes, undef.
10487                 set d_old_pthread_create_joinable
10488                 eval $setvar
10489                 val=""
10490                 set old_pthread_create_joinable
10491                 eval $setvar
10492         else
10493                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
10494                 if eval $compile; then
10495                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
10496                         val="$define"
10497                         set d_old_pthread_create_joinable
10498                         eval $setvar
10499                         val=PTHREAD_CREATE_UNDETACHED
10500                         set old_pthread_create_joinable
10501                         eval $setvar
10502                 else            
10503                         set try -DJOINABLE=__UNDETACHED
10504                         if eval $compile; then
10505                                 echo "You seem to use __UNDETACHED." >&4
10506                                 val="$define"
10507                                 set d_old_pthread_create_joinable
10508                                 eval $setvar
10509                                 val=__UNDETACHED
10510                                 set old_pthread_create_joinable
10511                                 eval $setvar
10512                         else
10513                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
10514                                 val="$define"
10515                                 set d_old_pthread_create_joinable
10516                                 eval $setvar
10517                                 val=0
10518                                 set old_pthread_create_joinable
10519                                 eval $setvar
10520                         fi
10521                 fi
10522         fi
10523         $rm -f try try.*
10524 else
10525     d_old_pthread_create_joinable="$undef"
10526     old_pthread_create_joinable=""
10527 fi
10528
10529 : see if pause exists
10530 set pause d_pause
10531 eval $inlibc
10532
10533 : see if pipe exists
10534 set pipe d_pipe
10535 eval $inlibc
10536
10537 : see if poll exists
10538 set poll d_poll
10539 eval $inlibc
10540
10541
10542 : see whether the various POSIXish _yields exist
10543 $cat >try.c <<EOP
10544 #include <pthread.h>
10545 #include <stdio.h>
10546 int main() {
10547 #ifdef SCHED_YIELD
10548         sched_yield();
10549 #else
10550 #ifdef PTHREAD_YIELD
10551         pthread_yield();
10552 #else
10553 #ifdef PTHREAD_YIELD_NULL
10554         pthread_yield(NULL);
10555 #endif
10556 #endif
10557 #endif
10558 }
10559 EOP
10560 : see if sched_yield exists
10561 set try -DSCHED_YIELD
10562 if eval $compile; then
10563     val="$define"
10564     sched_yield='sched_yield()'
10565 else
10566     val="$undef"
10567 fi
10568 case "$usethreads" in
10569 $define)
10570         case "$val" in
10571         $define) echo 'sched_yield() found.' >&4        ;;
10572         *)       echo 'sched_yield() NOT found.' >&4    ;;
10573         esac
10574 esac
10575 set d_sched_yield
10576 eval $setvar
10577
10578 : see if pthread_yield exists
10579 set try -DPTHREAD_YIELD
10580 if eval $compile; then
10581     val="$define"
10582     case "$sched_yield" in
10583     '') sched_yield='pthread_yield()' ;;
10584     esac
10585 else
10586     set try -DPTHREAD_YIELD_NULL
10587     if eval $compile; then
10588         val="$define"
10589         case "$sched_yield" in
10590         '') sched_yield='pthread_yield(NULL)' ;;
10591         esac
10592     else
10593         val="$undef"
10594     fi
10595 fi
10596 case "$usethreads" in
10597 $define)
10598         case "$val" in
10599         $define) echo 'pthread_yield() found.' >&4      ;;
10600         *)       echo 'pthread_yield() NOT found.' >&4  ;;
10601         esac
10602         ;;
10603 esac
10604 set d_pthread_yield
10605 eval $setvar
10606
10607 case "$sched_yield" in
10608 '') sched_yield=undef ;;
10609 esac
10610
10611 $rm -f try try.*
10612
10613 : see if this is a pwd.h system
10614 set pwd.h i_pwd
10615 eval $inhdr
10616
10617 case "$i_pwd" in
10618 $define)
10619         xxx=`./findhdr pwd.h`
10620         $cppstdin $cppflags $cppminus < $xxx >$$.h
10621
10622         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
10623                 val="$define"
10624         else
10625                 val="$undef"
10626         fi
10627         set d_pwquota
10628         eval $setvar
10629
10630         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
10631                 val="$define"
10632         else
10633                 val="$undef"
10634         fi
10635         set d_pwage
10636         eval $setvar
10637
10638         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
10639                 val="$define"
10640         else
10641                 val="$undef"
10642         fi
10643         set d_pwchange
10644         eval $setvar
10645
10646         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
10647                 val="$define"
10648         else
10649                 val="$undef"
10650         fi
10651         set d_pwclass
10652         eval $setvar
10653
10654         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
10655                 val="$define"
10656         else
10657                 val="$undef"
10658         fi
10659         set d_pwexpire
10660         eval $setvar
10661
10662         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
10663                 val="$define"
10664         else
10665                 val="$undef"
10666         fi
10667         set d_pwcomment
10668         eval $setvar
10669
10670         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
10671                 val="$define"
10672         else
10673                 val="$undef"
10674         fi
10675         set d_pwgecos
10676         eval $setvar
10677
10678         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
10679                 val="$define"
10680         else
10681                 val="$undef"
10682         fi
10683         set d_pwpasswd
10684         eval $setvar
10685
10686         $rm -f $$.h
10687         ;;
10688 *)
10689         val="$undef"; 
10690         set d_pwquota; eval $setvar
10691         set d_pwage; eval $setvar
10692         set d_pwchange; eval $setvar
10693         set d_pwclass; eval $setvar
10694         set d_pwexpire; eval $setvar
10695         set d_pwcomment; eval $setvar
10696         set d_pwgecos; eval $setvar
10697         set d_pwpasswd; eval $setvar
10698         ;;
10699 esac
10700
10701 : see if readdir and friends exist
10702 set readdir d_readdir
10703 eval $inlibc
10704 set seekdir d_seekdir
10705 eval $inlibc
10706 set telldir d_telldir
10707 eval $inlibc
10708 set rewinddir d_rewinddir
10709 eval $inlibc
10710
10711 : see if readlink exists
10712 set readlink d_readlink
10713 eval $inlibc
10714
10715 : see if rename exists
10716 set rename d_rename
10717 eval $inlibc
10718
10719 : see if rmdir exists
10720 set rmdir d_rmdir
10721 eval $inlibc
10722
10723 : see if memory.h is available.
10724 val=''
10725 set memory.h val
10726 eval $inhdr
10727
10728 : See if it conflicts with string.h
10729 case "$val" in
10730 $define)
10731         case "$strings" in
10732         '') ;;
10733         *)
10734                 $cppstdin $cppflags $cppminus < $strings > mem.h
10735                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
10736                         echo " "
10737                         echo "We won't be including <memory.h>."
10738                         val="$undef"
10739                 fi
10740                 $rm -f mem.h
10741                 ;;
10742         esac
10743 esac
10744 set i_memory
10745 eval $setvar
10746
10747 : can bcopy handle overlapping blocks?
10748 val="$undef"
10749 case "$d_bcopy" in
10750 "$define")
10751         echo " "
10752         echo "Checking to see if your bcopy() can do overlapping copies..." >&4
10753         $cat >try.c <<EOCP
10754 #$i_memory I_MEMORY
10755 #$i_stdlib I_STDLIB
10756 #$i_string I_STRING
10757 #$i_unistd I_UNISTD
10758 EOCP
10759         $cat >>try.c <<'EOCP'
10760 #include <stdio.h>
10761 #ifdef I_MEMORY
10762 #  include <memory.h>
10763 #endif
10764 #ifdef I_STDLIB
10765 #  include <stdlib.h>
10766 #endif
10767 #ifdef I_STRING
10768 #  include <string.h>
10769 #else
10770 #  include <strings.h>
10771 #endif
10772 #ifdef I_UNISTD
10773 #  include <unistd.h>  /* Needed for NetBSD */
10774 #endif
10775 int main()
10776 {
10777 char buf[128], abc[128];
10778 char *b;
10779 int len;
10780 int off;
10781 int align;
10782
10783 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
10784
10785 for (align = 7; align >= 0; align--) {
10786         for (len = 36; len; len--) {
10787                 b = buf+align;
10788                 bcopy(abc, b, len);
10789                 for (off = 1; off <= len; off++) {
10790                         bcopy(b, b+off, len);
10791                         bcopy(b+off, b, len);
10792                         if (bcmp(b, abc, len))
10793                                 exit(1);
10794                 }
10795         }
10796 }
10797 exit(0);
10798 }
10799 EOCP
10800         set try
10801         if eval $compile_ok; then
10802                 if ./try 2>/dev/null; then
10803                         echo "Yes, it can."
10804                         val="$define"
10805                 else
10806                         echo "It can't, sorry."
10807                         case "$d_memmove" in
10808                         "$define") echo "But that's Ok since you have memmove()." ;;
10809                         esac
10810                 fi
10811         else
10812                 echo "(I can't compile the test program, so we'll assume not...)"
10813                 case "$d_memmove" in
10814                 "$define") echo "But that's Ok since you have memmove()." ;;
10815                 esac
10816         fi
10817         ;;
10818 esac
10819 $rm -f try.* try core
10820 set d_safebcpy
10821 eval $setvar
10822
10823 : can memcpy handle overlapping blocks?
10824 val="$undef"
10825 case "$d_memcpy" in
10826 "$define")
10827         echo " "
10828         echo "Checking to see if your memcpy() can do overlapping copies..." >&4
10829         $cat >try.c <<EOCP
10830 #$i_memory I_MEMORY
10831 #$i_stdlib I_STDLIB
10832 #$i_string I_STRING
10833 #$i_unistd I_UNISTD
10834 EOCP
10835         $cat >>try.c <<'EOCP'
10836 #include <stdio.h>
10837 #ifdef I_MEMORY
10838 #  include <memory.h>
10839 #endif
10840 #ifdef I_STDLIB
10841 #  include <stdlib.h>
10842 #endif
10843 #ifdef I_STRING
10844 #  include <string.h>
10845 #else
10846 #  include <strings.h>
10847 #endif
10848 #ifdef I_UNISTD
10849 #  include <unistd.h>  /* Needed for NetBSD */
10850 #endif
10851 int main()
10852 {
10853 char buf[128], abc[128];
10854 char *b;
10855 int len;
10856 int off;
10857 int align;
10858
10859 /* Copy "abcde..." string to char abc[] so that gcc doesn't
10860    try to store the string in read-only memory. */
10861 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
10862
10863 for (align = 7; align >= 0; align--) {
10864         for (len = 36; len; len--) {
10865                 b = buf+align;
10866                 memcpy(b, abc, len);
10867                 for (off = 1; off <= len; off++) {
10868                         memcpy(b+off, b, len);
10869                         memcpy(b, b+off, len);
10870                         if (memcmp(b, abc, len))
10871                                 exit(1);
10872                 }
10873         }
10874 }
10875 exit(0);
10876 }
10877 EOCP
10878         set try
10879         if eval $compile_ok; then
10880                 if ./try 2>/dev/null; then
10881                         echo "Yes, it can."
10882                         val="$define"
10883                 else
10884                         echo "It can't, sorry."
10885                         case "$d_memmove" in
10886                         "$define") echo "But that's Ok since you have memmove()." ;;
10887                         esac
10888                 fi
10889         else
10890                 echo "(I can't compile the test program, so we'll assume not...)"
10891                 case "$d_memmove" in
10892                 "$define") echo "But that's Ok since you have memmove()." ;;
10893                 esac
10894         fi
10895         ;;
10896 esac
10897 $rm -f try.* try core
10898 set d_safemcpy
10899 eval $setvar
10900
10901 : can memcmp be trusted to compare relative magnitude?
10902 val="$undef"
10903 case "$d_memcmp" in
10904 "$define")
10905         echo " "
10906         echo "Checking if your memcmp() can compare relative magnitude..." >&4
10907         $cat >try.c <<EOCP
10908 #$i_memory I_MEMORY
10909 #$i_stdlib I_STDLIB
10910 #$i_string I_STRING
10911 #$i_unistd I_UNISTD
10912 EOCP
10913         $cat >>try.c <<'EOCP'
10914 #include <stdio.h>
10915 #ifdef I_MEMORY
10916 #  include <memory.h>
10917 #endif
10918 #ifdef I_STDLIB
10919 #  include <stdlib.h>
10920 #endif
10921 #ifdef I_STRING
10922 #  include <string.h>
10923 #else
10924 #  include <strings.h>
10925 #endif
10926 #ifdef I_UNISTD
10927 #  include <unistd.h>  /* Needed for NetBSD */
10928 #endif
10929 int main()
10930 {
10931 char a = -1;
10932 char b = 0;
10933 if ((a < b) && memcmp(&a, &b, 1) < 0)
10934         exit(1);
10935 exit(0);
10936 }
10937 EOCP
10938         set try
10939         if eval $compile_ok; then
10940                 if ./try 2>/dev/null; then
10941                         echo "Yes, it can."
10942                         val="$define"
10943                 else
10944                         echo "No, it can't (it uses signed chars)."
10945                 fi
10946         else
10947                 echo "(I can't compile the test program, so we'll assume not...)"
10948         fi
10949         ;;
10950 esac
10951 $rm -f try.* try core
10952 set d_sanemcmp
10953 eval $setvar
10954
10955 : see if select exists
10956 set select d_select
10957 eval $inlibc
10958
10959 : see if semctl exists
10960 set semctl d_semctl
10961 eval $inlibc
10962
10963 : see if semget exists
10964 set semget d_semget
10965 eval $inlibc
10966
10967 : see if semop exists
10968 set semop d_semop
10969 eval $inlibc
10970
10971 : see how much of the 'sem*(2)' library is present.
10972 h_sem=true
10973 echo " "
10974 case "$d_semctl$d_semget$d_semop" in
10975 *"$undef"*) h_sem=false;;
10976 esac
10977 case "$osname" in
10978 freebsd)
10979     case "`ipcs 2>&1`" in
10980     "SVID messages"*"not configured"*)
10981         echo "Your $osname does not have the sem*(2) configured." >&4
10982         h_sem=false
10983         val="$undef"
10984         set semctl d_semctl
10985         eval $setvar
10986         set semget d_semget
10987         eval $setvar
10988         set semop d_semop
10989         eval $setvar
10990         ;;
10991     esac
10992     ;;
10993 esac
10994 : we could also check for sys/ipc.h ...
10995 if $h_sem && $test `./findhdr sys/sem.h`; then
10996         echo "You have the full sem*(2) library." >&4
10997         val="$define"
10998 else
10999         echo "You don't have the full sem*(2) library." >&4
11000         val="$undef"
11001 fi
11002 set d_sem
11003 eval $setvar
11004
11005 : see whether sys/sem.h defines union semun
11006 echo " "
11007 $cat > try.c <<'END'
11008 #include <sys/types.h>
11009 #include <sys/ipc.h>
11010 #include <sys/sem.h>
11011 int main () { union semun semun; semun.buf = 0; }
11012 END
11013 set try
11014 if eval $compile; then
11015     echo "You have union semun in <sys/sem.h>." >&4
11016     val="$define"
11017 else
11018     echo "You do not have union semun in <sys/sem.h>." >&4
11019     val="$undef"
11020 fi
11021 $rm -f try try.c try.h
11022 set d_union_semun
11023 eval $setvar
11024
11025 : see how to do semctl IPC_STAT
11026 case "$d_sem" in
11027 $define)
11028     : see whether semctl IPC_STAT can use union semun
11029     echo " "
11030     $cat > try.h <<END
11031 #ifndef S_IRUSR
11032 #   ifdef S_IREAD
11033 #       define S_IRUSR S_IREAD
11034 #       define S_IWUSR S_IWRITE
11035 #       define S_IXUSR S_IEXEC
11036 #   else
11037 #       define S_IRUSR 0400
11038 #       define S_IWUSR 0200
11039 #       define S_IXUSR 0100
11040 #   endif
11041 #   define S_IRGRP (S_IRUSR>>3)
11042 #   define S_IWGRP (S_IWUSR>>3)
11043 #   define S_IXGRP (S_IXUSR>>3)
11044 #   define S_IROTH (S_IRUSR>>6)
11045 #   define S_IWOTH (S_IWUSR>>6)
11046 #   define S_IXOTH (S_IXUSR>>6)
11047 #endif
11048 #ifndef S_IRWXU
11049 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
11050 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
11051 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
11052 #endif
11053 END
11054
11055     $cat > try.c <<END
11056 #include <sys/types.h>
11057 #include <sys/ipc.h>
11058 #include <sys/sem.h>
11059 #include <sys/stat.h>
11060 #include <stdio.h>
11061 #include <errno.h>
11062 #include "try.h"
11063 #ifndef errno
11064 extern int errno;
11065 #endif
11066 #$d_union_semun HAS_UNION_SEMUN
11067 int main() {
11068     union semun
11069 #ifndef HAS_UNION_SEMUN
11070     {
11071         int val;
11072         struct semid_ds *buf;
11073         unsigned short *array;
11074     }
11075 #endif
11076     arg;
11077     int sem, st;
11078
11079 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
11080     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
11081     if (sem > -1) {
11082         struct semid_ds argbuf;
11083         arg.buf = &argbuf;
11084 #       ifdef IPC_STAT
11085         st = semctl(sem, 0, IPC_STAT, arg);
11086         if (st == 0)
11087             printf("semun\n");
11088         else
11089 #       endif /* IPC_STAT */
11090             printf("semctl IPC_STAT failed: errno = %d\n", errno);
11091 #       ifdef IPC_RMID
11092         if (semctl(sem, 0, IPC_RMID, arg) != 0)
11093 #       endif /* IPC_RMID */
11094             printf("semctl IPC_RMID failed: errno = %d\n", errno);
11095     } else
11096 #endif /* IPC_PRIVATE && ... */
11097         printf("semget failed: errno = %d\n", errno);
11098   return 0;
11099 }
11100 END
11101     val="$undef"
11102     set try
11103     if eval $compile; then
11104         xxx=`./try`
11105         case "$xxx" in
11106         semun) val="$define" ;;
11107         esac
11108     fi
11109     $rm -f try try.c
11110     set d_semctl_semun
11111     eval $setvar
11112     case "$d_semctl_semun" in
11113     $define)
11114         echo "You can use union semun for semctl IPC_STAT." >&4
11115         also='also'
11116         ;;
11117     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
11118         also=''
11119         ;;
11120     esac
11121
11122     : see whether semctl IPC_STAT can use struct semid_ds pointer
11123     $cat > try.c <<'END'
11124 #include <sys/types.h>
11125 #include <sys/ipc.h>
11126 #include <sys/sem.h>
11127 #include <sys/stat.h>
11128 #include "try.h"
11129 #include <stdio.h>
11130 #include <errno.h>
11131 #ifndef errno
11132 extern int errno;
11133 #endif
11134 int main() {
11135     struct semid_ds arg;
11136     int sem, st;
11137
11138 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
11139     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
11140     if (sem > -1) {
11141 #       ifdef IPC_STAT
11142         st = semctl(sem, 0, IPC_STAT, &arg);
11143         if (st == 0)
11144             printf("semid_ds\n");
11145         else
11146 #       endif /* IPC_STAT */
11147             printf("semctl IPC_STAT failed: errno = %d\n", errno);
11148 #       ifdef IPC_RMID
11149         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
11150 #       endif /* IPC_RMID */
11151             printf("semctl IPC_RMID failed: errno = %d\n", errno);
11152     } else
11153 #endif /* IPC_PRIVATE && ... */
11154         printf("semget failed: errno = %d\n", errno);
11155
11156     return 0;
11157 }
11158 END
11159     val="$undef"
11160     set try
11161     if eval $compile; then
11162         xxx=`./try`
11163         case "$xxx" in
11164         semid_ds) val="$define" ;;
11165         esac
11166     fi
11167     $rm -f try try.c
11168     set d_semctl_semid_ds
11169     eval $setvar
11170     case "$d_semctl_semid_ds" in
11171     $define)
11172         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
11173         ;;
11174     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
11175         ;;
11176     esac
11177     $rm -f try.h
11178     ;;
11179 *)  val="$undef"
11180
11181     # We do not have the full sem*(2) library, so assume we can not
11182     # use either.
11183
11184     set d_semctl_semun
11185     eval $setvar
11186
11187     set d_semctl_semid_ds
11188     eval $setvar
11189     ;;
11190 esac
11191
11192 : see if setegid exists
11193 set setegid d_setegid
11194 eval $inlibc
11195
11196 : see if seteuid exists
11197 set seteuid d_seteuid
11198 eval $inlibc
11199
11200 : see if setgrent exists
11201 set setgrent d_setgrent
11202 eval $inlibc
11203
11204 : see if sethostent exists
11205 set sethostent d_sethent
11206 eval $inlibc
11207
11208 : see if setlinebuf exists
11209 set setlinebuf d_setlinebuf
11210 eval $inlibc
11211
11212 : see if setlocale exists
11213 set setlocale d_setlocale
11214 eval $inlibc
11215
11216 : see if setnetent exists
11217 set setnetent d_setnent
11218 eval $inlibc
11219
11220 : see if setprotoent exists
11221 set setprotoent d_setpent
11222 eval $inlibc
11223
11224 : see if setpgid exists
11225 set setpgid d_setpgid
11226 eval $inlibc
11227
11228 : see if setpgrp2 exists
11229 set setpgrp2 d_setpgrp2
11230 eval $inlibc
11231
11232 : see if setpriority exists
11233 set setpriority d_setprior
11234 eval $inlibc
11235
11236 : see if setproctitle exists
11237 set setproctitle d_setproctitle
11238 eval $inlibc
11239
11240 : see if setpwent exists
11241 set setpwent d_setpwent
11242 eval $inlibc
11243
11244 : see if setregid exists
11245 set setregid d_setregid
11246 eval $inlibc
11247 set setresgid d_setresgid
11248 eval $inlibc
11249
11250 : see if setreuid exists
11251 set setreuid d_setreuid
11252 eval $inlibc
11253 set setresuid d_setresuid
11254 eval $inlibc
11255
11256 : see if setrgid exists
11257 set setrgid d_setrgid
11258 eval $inlibc
11259
11260 : see if setruid exists
11261 set setruid d_setruid
11262 eval $inlibc
11263
11264 : see if setservent exists
11265 set setservent d_setsent
11266 eval $inlibc
11267
11268 : see if setsid exists
11269 set setsid d_setsid
11270 eval $inlibc
11271
11272 : see if setvbuf exists
11273 set setvbuf d_setvbuf
11274 eval $inlibc
11275
11276 : see if sfio.h is available
11277 set sfio.h i_sfio
11278 eval $inhdr
11279
11280
11281 : see if sfio library is available
11282 case "$i_sfio" in
11283 $define)
11284         val=''
11285         set sfreserve val
11286         eval $inlibc
11287         ;;
11288 *)
11289         val="$undef"
11290         ;;
11291 esac
11292 : Ok, but do we want to use it.
11293 case "$val" in
11294 $define)
11295         case "$usesfio" in
11296         true|$define|[yY]*) dflt='y';;
11297         *) dflt='n';;
11298         esac
11299         echo "$package can use the sfio library, but it is experimental."
11300         case "$useperlio" in
11301         "$undef")
11302             echo "For sfio also the PerlIO abstraction layer is needed."
11303             echo "Earlier you said you wouldn't want that."
11304             ;;
11305         esac
11306         rp="You seem to have sfio available, do you want to try using it?"
11307         . ./myread
11308         case "$ans" in
11309         y|Y)    echo "Ok, turning on both sfio and PerlIO, then."
11310                 useperlio="$define"
11311                 val="$define"
11312                 ;;
11313         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
11314                 val="$undef"
11315                 : Remove sfio from list of libraries to use
11316                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
11317                 shift
11318                 libs="$*"
11319                 echo "libs = $libs" >&4
11320                 ;;
11321         esac
11322         ;;
11323 *)      case "$usesfio" in
11324         true|$define|[yY]*)
11325                 echo "Sorry, cannot find sfio on this machine." >&4
11326                 echo "Ignoring your setting of usesfio=$usesfio." >&4
11327                 val="$undef"
11328                 ;;
11329         esac
11330         ;;
11331 esac
11332 set d_sfio
11333 eval $setvar
11334 case "$d_sfio" in
11335 $define) usesfio='true';;
11336 *) usesfio='false';;
11337 esac
11338
11339 : see if shmctl exists
11340 set shmctl d_shmctl
11341 eval $inlibc
11342
11343 : see if shmget exists
11344 set shmget d_shmget
11345 eval $inlibc
11346
11347 : see if shmat exists
11348 set shmat d_shmat
11349 eval $inlibc
11350 : see what shmat returns
11351 case "$d_shmat" in
11352 "$define")
11353         $cat >shmat.c <<'END'
11354 #include <sys/shm.h>
11355 void *shmat();
11356 END
11357         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
11358                 shmattype='void *'
11359         else
11360                 shmattype='char *'
11361         fi
11362         echo "and it returns ($shmattype)." >&4
11363         : see if a prototype for shmat is available
11364         xxx=`./findhdr sys/shm.h`
11365         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
11366         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
11367                 val="$define"
11368         else
11369                 val="$undef"
11370         fi
11371         $rm -f shmat.[co]
11372         ;;
11373 *)
11374         val="$undef"
11375         ;;
11376 esac
11377 set d_shmatprototype
11378 eval $setvar
11379
11380 : see if shmdt exists
11381 set shmdt d_shmdt
11382 eval $inlibc
11383
11384 : see how much of the 'shm*(2)' library is present.
11385 h_shm=true
11386 echo " "
11387 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
11388 *"$undef"*) h_shm=false;;
11389 esac
11390 case "$osname" in
11391 freebsd)
11392     case "`ipcs 2>&1`" in
11393     "SVID shared memory"*"not configured"*)
11394         echo "Your $osname does not have the shm*(2) configured." >&4
11395         h_shm=false
11396         val="$undef"
11397         set shmctl d_shmctl
11398         evat $setvar
11399         set shmget d_shmget
11400         evat $setvar
11401         set shmat d_shmat
11402         evat $setvar
11403         set shmdt d_shmdt
11404         evat $setvar
11405         ;;
11406     esac
11407     ;;
11408 esac
11409 : we could also check for sys/ipc.h ...
11410 if $h_shm && $test `./findhdr sys/shm.h`; then
11411         echo "You have the full shm*(2) library." >&4
11412         val="$define"
11413 else
11414         echo "You don't have the full shm*(2) library." >&4
11415         val="$undef"
11416 fi
11417 set d_shm
11418 eval $setvar
11419
11420 echo " "
11421 : see if we have sigaction
11422 if set sigaction val -f d_sigaction; eval $csym; $val; then
11423         echo 'sigaction() found.' >&4
11424         $cat > try.c <<'EOP'
11425 #include <stdio.h>
11426 #include <sys/types.h>
11427 #include <signal.h>
11428 int main()
11429 {
11430     struct sigaction act, oact;
11431     act.sa_flags = 0;
11432     oact.sa_handler = 0;
11433     /* so that act and oact are used */
11434     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
11435 }
11436 EOP
11437         set try
11438         if eval $compile_ok; then
11439                 val="$define"
11440         else
11441                 echo "But you don't seem to have a useable struct sigaction." >&4
11442                 val="$undef"
11443         fi
11444 else
11445         echo 'sigaction NOT found.' >&4
11446         val="$undef"
11447 fi
11448 set d_sigaction; eval $setvar
11449 $rm -f try try$_o try.c
11450
11451 : see if sigsetjmp exists
11452 echo " "
11453 case "$d_sigsetjmp" in
11454 '')
11455         $cat >try.c <<'EOP'
11456 #include <setjmp.h>
11457 sigjmp_buf env;
11458 int set = 1;
11459 int main()
11460 {
11461         if (sigsetjmp(env,1))
11462                 exit(set);
11463         set = 0;
11464         siglongjmp(env, 1);
11465         exit(1);
11466 }
11467 EOP
11468         set try
11469         if eval $compile; then
11470                 if ./try >/dev/null 2>&1; then
11471                         echo "POSIX sigsetjmp found." >&4
11472                         val="$define"
11473                 else
11474                         $cat >&4 <<EOM
11475 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
11476 I'll ignore them.
11477 EOM
11478                         val="$undef"
11479                 fi
11480         else
11481                 echo "sigsetjmp not found." >&4
11482                 val="$undef"
11483         fi
11484         ;;
11485 *) val="$d_sigsetjmp"
11486         case "$d_sigsetjmp" in
11487         $define) echo "POSIX sigsetjmp found." >&4;;
11488         $undef) echo "sigsetjmp not found." >&4;;
11489         esac
11490         ;;
11491 esac
11492 set d_sigsetjmp
11493 eval $setvar
11494 $rm -f try.c try
11495
11496 : see if socks5_init exists
11497 set socks5_init d_socks5_init
11498 eval $inlibc
11499
11500 : see if sys/stat.h is available
11501 set sys/stat.h i_sysstat
11502 eval $inhdr
11503
11504
11505 : see if stat knows about block sizes
11506 echo " "
11507 echo "Checking to see if your struct stat has st_blocks field..." >&4
11508 set d_statblks stat st_blocks $i_sysstat sys/stat.h
11509 eval $hasfield
11510
11511
11512 : see if this is a sys/vfs.h system
11513 set sys/vfs.h i_sysvfs
11514 eval $inhdr
11515
11516
11517 : see if this is a sys/statfs.h system
11518 set sys/statfs.h i_sysstatfs
11519 eval $inhdr
11520
11521
11522 echo " "
11523 echo "Checking to see if your system supports struct statfs..." >&4
11524 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
11525 eval $hasstruct
11526 case "$d_statfs_s" in
11527 "$define")      echo "Yes, it does."   ;;
11528 *)              echo "No, it doesn't." ;;
11529 esac
11530
11531
11532
11533 : see if struct statfs knows about f_flags
11534 case "$d_statfs_s" in
11535 define) 
11536         echo " "
11537         echo "Checking to see if your struct statfs has f_flags field..." >&4
11538         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
11539         eval $hasfield
11540         ;;
11541 *)      val="$undef"
11542         set d_statfs_f_flags
11543         eval $setvar
11544         ;;
11545 esac
11546 case "$d_statfs_f_flags" in
11547 "$define")      echo "Yes, it does."   ;;
11548 *)              echo "No, it doesn't." ;;
11549 esac
11550
11551 : see if _ptr and _cnt from stdio act std
11552 echo " "
11553 if $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
11554         echo "(Looks like you have stdio.h from Linux.)"
11555         case "$stdio_ptr" in
11556         '') stdio_ptr='((fp)->_IO_read_ptr)'
11557                 ptr_lval=$define
11558                 ;;
11559         *)      ptr_lval=$d_stdio_ptr_lval;;
11560         esac
11561         case "$stdio_cnt" in
11562         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
11563                 cnt_lval=$undef
11564                 ;;
11565         *)      cnt_lval=$d_stdio_cnt_lval;;
11566         esac
11567         case "$stdio_base" in
11568         '') stdio_base='((fp)->_IO_read_base)';;
11569         esac
11570         case "$stdio_bufsiz" in
11571         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
11572         esac
11573 else
11574         case "$stdio_ptr" in
11575         '') stdio_ptr='((fp)->_ptr)'
11576                 ptr_lval=$define
11577                 ;;
11578         *)      ptr_lval=$d_stdio_ptr_lval;;
11579         esac
11580         case "$stdio_cnt" in
11581         '') stdio_cnt='((fp)->_cnt)'
11582                 cnt_lval=$define
11583                 ;;
11584         *)      cnt_lval=$d_stdio_cnt_lval;;
11585         esac
11586         case "$stdio_base" in
11587         '') stdio_base='((fp)->_base)';;
11588         esac
11589         case "$stdio_bufsiz" in
11590         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
11591         esac
11592 fi
11593 : test whether _ptr and _cnt really work
11594 echo "Checking how std your stdio is..." >&4
11595 $cat >try.c <<EOP
11596 #include <stdio.h>
11597 #define FILE_ptr(fp)    $stdio_ptr
11598 #define FILE_cnt(fp)    $stdio_cnt
11599 int main() {
11600         FILE *fp = fopen("try.c", "r");
11601         char c = getc(fp);
11602         if (
11603                 18 <= FILE_cnt(fp) &&
11604                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
11605         )
11606                 exit(0);
11607         exit(1);
11608 }
11609 EOP
11610 val="$undef"
11611 set try
11612 if eval $compile; then
11613         if ./try; then
11614                 echo "Your stdio acts pretty std."
11615                 val="$define"
11616         else
11617                 echo "Your stdio isn't very std."
11618         fi
11619 else
11620         echo "Your stdio doesn't appear very std."
11621 fi
11622 $rm -f try.c try
11623 set d_stdstdio
11624 eval $setvar
11625
11626 : Can _ptr be used as an lvalue?
11627 case "$d_stdstdio$ptr_lval" in
11628 $define$define) val=$define ;;
11629 *) val=$undef ;;
11630 esac
11631 set d_stdio_ptr_lval
11632 eval $setvar
11633
11634 : Can _cnt be used as an lvalue?
11635 case "$d_stdstdio$cnt_lval" in
11636 $define$define) val=$define ;;
11637 *) val=$undef ;;
11638 esac
11639 set d_stdio_cnt_lval
11640 eval $setvar
11641
11642 : see if _base is also standard
11643 val="$undef"
11644 case "$d_stdstdio" in
11645 $define)
11646         $cat >try.c <<EOP
11647 #include <stdio.h>
11648 #define FILE_base(fp)   $stdio_base
11649 #define FILE_bufsiz(fp) $stdio_bufsiz
11650 int main() {
11651         FILE *fp = fopen("try.c", "r");
11652         char c = getc(fp);
11653         if (
11654                 19 <= FILE_bufsiz(fp) &&
11655                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
11656         )
11657                 exit(0);
11658         exit(1);
11659 }
11660 EOP
11661         set try
11662         if eval $compile; then
11663                 if ./try; then
11664                         echo "And its _base field acts std."
11665                         val="$define"
11666                 else
11667                         echo "But its _base field isn't std."
11668                 fi
11669         else
11670                 echo "However, it seems to be lacking the _base field."
11671         fi
11672         $rm -f try.c try
11673         ;;
11674 esac
11675 set d_stdiobase
11676 eval $setvar
11677
11678 $cat >&4 <<EOM
11679 Checking how to access stdio streams by file descriptor number...
11680 EOM
11681 case "$stdio_stream_array" in
11682 '')     $cat >try.c <<EOCP
11683 #include <stdio.h>
11684 int main() {
11685   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
11686     printf("yes\n");
11687 }
11688 EOCP
11689         for s in _iob __iob __sF
11690         do
11691                 set try -DSTDIO_STREAM_ARRAY=$s
11692                 if eval $compile; then
11693                         case "`./try$exe_ext`" in
11694                         yes)    stdio_stream_array=$s; break ;;
11695                         esac
11696                 fi
11697         done
11698         $rm -f try.* try$exe_ext
11699 esac
11700 case "$stdio_stream_array" in
11701 '')     $cat >&4 <<EOM
11702 I can't figure out how to access stdio streams by file descriptor number.
11703 EOM
11704         d_stdio_stream_array="$undef"
11705         ;;
11706 *)      $cat >&4 <<EOM
11707 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
11708 EOM
11709         d_stdio_stream_array="$define"
11710         ;;
11711 esac
11712
11713 : see if strcoll exists
11714 set strcoll d_strcoll
11715 eval $inlibc
11716
11717 : check for structure copying
11718 echo " "
11719 echo "Checking to see if your C compiler can copy structs..." >&4
11720 $cat >try.c <<'EOCP'
11721 int main()
11722 {
11723         struct blurfl {
11724                 int dyick;
11725         } foo, bar;
11726
11727         foo = bar;
11728 }
11729 EOCP
11730 if $cc -c try.c >/dev/null 2>&1 ; then
11731         val="$define"
11732         echo "Yup, it can."
11733 else
11734         val="$undef"
11735         echo "Nope, it can't."
11736 fi
11737 set d_strctcpy
11738 eval $setvar
11739 $rm -f try.*
11740
11741 : see if strerror and/or sys_errlist[] exist
11742 echo " "
11743 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
11744     if set strerror val -f d_strerror; eval $csym; $val; then
11745                 echo 'strerror() found.' >&4
11746                 d_strerror="$define"
11747                 d_strerrm='strerror(e)'
11748                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
11749                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
11750                         d_syserrlst="$define"
11751                 else
11752                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
11753                         d_syserrlst="$undef"
11754                 fi
11755     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
11756                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
11757                 echo 'strerror() found in string header.' >&4
11758                 d_strerror="$define"
11759                 d_strerrm='strerror(e)'
11760                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
11761                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
11762                                 d_syserrlst="$define"
11763                 else
11764                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
11765                         d_syserrlst="$undef"
11766                 fi
11767     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
11768                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
11769                 d_strerror="$undef"
11770                 d_syserrlst="$define"
11771                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
11772     else
11773                 echo 'strerror() and sys_errlist[] NOT found.' >&4
11774                 d_strerror="$undef"
11775                 d_syserrlst="$undef"
11776                 d_strerrm='"unknown"'
11777     fi
11778 fi
11779
11780 : see if strtod exists
11781 set strtod d_strtod
11782 eval $inlibc
11783
11784 : see if strtol exists
11785 set strtol d_strtol
11786 eval $inlibc
11787
11788 : see if strtold exists
11789 set strtold d_strtold
11790 eval $inlibc
11791
11792 : see if strtoll exists
11793 set strtoll d_strtoll
11794 eval $inlibc
11795
11796 case "$d_longlong-$d_strtoll" in
11797 "$define-$define")
11798         $cat <<EOM
11799 Checking whether your strtoll() works okay...
11800 EOM
11801         $cat >try.c <<'EOCP'
11802 #include <errno.h>
11803 #ifdef __hpux
11804 #define strtoll __strtoll
11805 #endif
11806 #include <stdio.h>
11807 extern long long int strtoll(char *s, char **, int); 
11808 static int bad = 0;
11809 int check(char *s, long long ell, int een) {
11810         long long gll;
11811         errno = 0;
11812         gll = strtoll(s, 0, 10);
11813         if (!((gll == ell) && (errno == een)))
11814                 bad++;
11815 }
11816 int main() {
11817         check(" 1",                                      1LL, 0);
11818         check(" 0",                                      0LL, 0);
11819         check("-1",                                     -1LL, 0);
11820         check("-9223372036854775808", -9223372036854775808LL, 0);
11821         check("-9223372036854775808", -9223372036854775808LL, 0);
11822         check(" 9223372036854775807",  9223372036854775807LL, 0);
11823         check("-9223372036854775808", -9223372036854775808LL, 0);
11824         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
11825         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
11826         if (!bad)
11827                 printf("ok\n");
11828 }
11829 EOCP
11830         set try
11831         if eval $compile; then
11832                 case "`./try`" in
11833                 ok) echo "Your strtoll() seems to be working okay." ;;
11834                 *) cat <<EOM >&4
11835 Your strtoll() doesn't seem to be working okay.
11836 EOM
11837                    d_strtoll="$undef"
11838                    ;;
11839                 esac
11840         fi
11841         ;;
11842 esac
11843
11844 : see if strtoul exists
11845 set strtoul d_strtoul
11846 eval $inlibc
11847
11848 : see if strtoull exists
11849 set strtoull d_strtoull
11850 eval $inlibc
11851
11852 case "$d_longlong-$d_strtoull" in
11853 "$define-$define")
11854         $cat <<EOM
11855 Checking whether your strtoull() works okay...
11856 EOM
11857         $cat >try.c <<'EOCP'
11858 #include <errno.h>
11859 #ifdef __hpux
11860 #define strtoull __strtoull
11861 #endif
11862 #include <stdio.h>
11863 extern unsigned long long int strtoull(char *s, char **, int); 
11864 static int bad = 0;
11865 int check(char *s, long long eull, int een) {
11866         long long gull;
11867         errno = 0;
11868         gull = strtoull(s, 0, 10);
11869         if (!((gull == eull) && (errno == een)))
11870                 bad++;
11871 }
11872 int main() {
11873         check(" 1",                                       1LL, 0);
11874         check(" 0",                                       0LL, 0);
11875         check("18446744073709551615", 18446744073709551615ULL, 0);
11876         check("18446744073709551616", 18446744073709551615ULL, ERANGE);
11877         if (!bad)
11878                 printf("ok\n");
11879 }
11880 EOCP
11881         set try
11882         if eval $compile; then
11883                 case "`./try`" in
11884                 ok) echo "Your strtoull() seems to be working okay." ;;
11885                 *) cat <<EOM >&4
11886 Your strtoull() doesn't seem to be working okay.
11887 EOM
11888                    d_strtoull="$undef"
11889                    ;;
11890                 esac
11891         fi
11892         ;;
11893 esac
11894
11895 : see if strtouq exists
11896 set strtouq d_strtouq
11897 eval $inlibc
11898
11899 : see if strxfrm exists
11900 set strxfrm d_strxfrm
11901 eval $inlibc
11902
11903 : see if symlink exists
11904 set symlink d_symlink
11905 eval $inlibc
11906
11907 : see if syscall exists
11908 set syscall d_syscall
11909 eval $inlibc
11910
11911 : see if sysconf exists
11912 set sysconf d_sysconf
11913 eval $inlibc
11914
11915 : see if system exists
11916 set system d_system
11917 eval $inlibc
11918
11919 : see if tcgetpgrp exists
11920 set tcgetpgrp d_tcgetpgrp
11921 eval $inlibc
11922
11923 : see if tcsetpgrp exists
11924 set tcsetpgrp d_tcsetpgrp
11925 eval $inlibc
11926
11927 : see if prototype for telldir is available
11928 echo " "
11929 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
11930 eval $hasproto
11931
11932 : see if this is a sys/times.h system
11933 set sys/times.h i_systimes
11934 eval $inhdr
11935
11936 : see if times exists
11937 echo " "
11938 if set times val -f d_times; eval $csym; $val; then
11939         echo 'times() found.' >&4
11940         d_times="$define"
11941         inc=''
11942         case "$i_systimes" in
11943         "$define") inc='sys/times.h';;
11944         esac
11945         rp="What is the type returned by times() on this system?"
11946         set clock_t clocktype long stdio.h sys/types.h $inc
11947         eval $typedef_ask
11948 else
11949         echo 'times() NOT found, hope that will do.' >&4
11950         d_times="$undef"
11951         clocktype='int'
11952 fi
11953
11954 : see if truncate exists
11955 set truncate d_truncate
11956 eval $inlibc
11957
11958 : see if tzname[] exists
11959 echo " "
11960 if set tzname val -a d_tzname; eval $csym; $val; then
11961         val="$define"
11962         echo 'tzname[] found.' >&4
11963 else
11964         val="$undef"
11965         echo 'tzname[] NOT found.' >&4
11966 fi
11967 set d_tzname
11968 eval $setvar
11969
11970 : see if umask exists
11971 set umask d_umask
11972 eval $inlibc
11973
11974 : see if ustat exists
11975 set ustat d_ustat
11976 eval $inlibc
11977
11978 : backward compatibility for d_hvfork
11979 if test X$d_hvfork != X; then
11980         d_vfork="$d_hvfork"
11981         d_hvfork=''
11982 fi
11983 : see if there is a vfork
11984 val=''
11985 set vfork val
11986 eval $inlibc
11987
11988 : Ok, but do we want to use it. vfork is reportedly unreliable in 
11989 : perl on Solaris 2.x, and probably elsewhere.
11990 case "$val" in
11991 $define)
11992         echo " "
11993         case "$usevfork" in
11994         false) dflt='n';;
11995         *) dflt='y';;
11996         esac
11997         cat <<'EOM'
11998  
11999 Perl can only use a vfork() that doesn't suffer from strict
12000 restrictions on calling functions or modifying global data in
12001 the child.  For example, glibc-2.1 contains such a vfork()
12002 that is unsuitable.  If your system provides a proper fork()
12003 call, chances are that you do NOT want perl to use vfork().
12004
12005 EOM
12006         rp="Do you still want to use vfork()?"
12007         . ./myread
12008         case "$ans" in
12009         y|Y) ;;
12010         *)
12011                 echo "Ok, we won't use vfork()."
12012                 val="$undef"
12013                 ;;
12014         esac
12015         ;;
12016 esac
12017 set d_vfork
12018 eval $setvar
12019 case "$d_vfork" in
12020 $define) usevfork='true';;
12021 *) usevfork='false';;
12022 esac
12023
12024 : see if this is an sysdir system
12025 set sys/dir.h i_sysdir
12026 eval $inhdr
12027
12028 : see if this is an sysndir system
12029 set sys/ndir.h i_sysndir
12030 eval $inhdr
12031
12032 : see if closedir exists
12033 set closedir d_closedir
12034 eval $inlibc
12035
12036 case "$d_closedir" in
12037 "$define")
12038         echo " "
12039         echo "Checking whether closedir() returns a status..." >&4
12040         cat > closedir.c <<EOM
12041 #$i_dirent I_DIRENT             /**/
12042 #$i_sysdir I_SYS_DIR            /**/
12043 #$i_sysndir I_SYS_NDIR          /**/
12044 #$i_systypes I_SYS_TYPES        /**/
12045
12046 #if defined(I_SYS_TYPES)
12047 #include <sys/types.h>
12048 #endif
12049 #if defined(I_DIRENT)
12050 #include <dirent.h>
12051 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
12052 #include <sys/dir.h>
12053 #endif
12054 #else
12055 #ifdef I_SYS_NDIR
12056 #include <sys/ndir.h>
12057 #else
12058 #ifdef I_SYS_DIR
12059 #ifdef hp9000s500
12060 #include <ndir.h>       /* may be wrong in the future */
12061 #else
12062 #include <sys/dir.h>
12063 #endif
12064 #endif
12065 #endif
12066 #endif 
12067 int main() { return closedir(opendir(".")); }
12068 EOM
12069         set closedir
12070         if eval $compile_ok; then
12071                 if ./closedir > /dev/null 2>&1 ; then
12072                         echo "Yes, it does."
12073                         val="$undef"
12074                 else
12075                         echo "No, it doesn't."
12076                         val="$define"
12077                 fi
12078         else
12079                 echo "(I can't seem to compile the test program--assuming it doesn't)"
12080                 val="$define"
12081         fi
12082         ;;
12083 *)
12084         val="$undef";
12085         ;;
12086 esac
12087 set d_void_closedir
12088 eval $setvar
12089 $rm -f closedir*
12090 : check for volatile keyword
12091 echo " "
12092 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
12093 $cat >try.c <<'EOCP'
12094 int main()
12095 {
12096         typedef struct _goo_struct goo_struct;
12097         goo_struct * volatile goo = ((goo_struct *)0);
12098         struct _goo_struct {
12099                 long long_int;
12100                 int reg_int;
12101                 char char_var;
12102         };
12103         typedef unsigned short foo_t;
12104         char *volatile foo;
12105         volatile int bar;
12106         volatile foo_t blech;
12107         foo = foo;
12108 }
12109 EOCP
12110 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
12111         val="$define"
12112         echo "Yup, it does."
12113 else
12114         val="$undef"
12115         echo "Nope, it doesn't."
12116 fi
12117 set d_volatile
12118 eval $setvar
12119 $rm -f try.*
12120
12121 : see if there is a wait4
12122 set wait4 d_wait4
12123 eval $inlibc
12124
12125 : see if waitpid exists
12126 set waitpid d_waitpid
12127 eval $inlibc
12128
12129 : see if wcstombs exists
12130 set wcstombs d_wcstombs
12131 eval $inlibc
12132
12133 : see if wctomb exists
12134 set wctomb d_wctomb
12135 eval $inlibc
12136
12137 : preserve RCS keywords in files with variable substitution, grrr
12138 Date='$Date'
12139 Id='$Id'
12140 Log='$Log'
12141 RCSfile='$RCSfile'
12142 Revision='$Revision'
12143
12144 case "$crosscompile" in
12145 ''|[nN]*) crosscompile="$undef" ;;
12146 esac
12147
12148 case "$osname" in
12149 next|rhapsody|darwin) multiarch="$define" ;;
12150 esac
12151 case "$multiarch" in
12152 ''|[nN]*) multiarch="$undef" ;;
12153 esac
12154
12155 : check for alignment requirements
12156 echo " "
12157 case "$crosscompile$multiarch" in
12158 *$define*)
12159         $cat <<EOM
12160 You seem to be either cross-compiling or doing a multiarchitecture build,
12161 skipping the memory alignment check.
12162
12163 EOM
12164         case "$alignbytes" in
12165         '') alignbytes=8 ;;
12166         esac
12167         ;;
12168 *)
12169         case "$alignbytes" in
12170         '') echo "Checking alignment constraints..." >&4
12171                 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
12172                         $cat >try.c <<'EOCP'
12173 typedef long double NV;
12174 EOCP
12175                 else
12176                         $cat >try.c <<'EOCP'
12177 typedef double NV;
12178 EOCP
12179                 fi
12180                 $cat >>try.c <<'EOCP'
12181 #include <stdio.h>
12182 struct foobar {
12183         char foo;
12184         NV bar;
12185 } try_algn;
12186 int main()
12187 {
12188     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
12189     return(0);
12190 }
12191 EOCP
12192                 set try
12193                 if eval $compile_ok; then
12194                         dflt=`./try`
12195                 else
12196                         dflt='8'
12197                         echo "(I can't seem to compile the test program...)"
12198                 fi
12199                 ;;
12200         *) dflt="$alignbytes"
12201                 ;;
12202         esac
12203         rp="Doubles must be aligned on a how-many-byte boundary?"
12204         . ./myread
12205         alignbytes="$ans"
12206         $rm -f try.c try
12207         ;;
12208 esac
12209
12210
12211 : set the base revision
12212 baserev=5.0
12213
12214 : check for ordering of bytes in a long
12215 echo " "
12216 case "$crosscompile$multiarch" in
12217 *$define*)
12218         $cat <<EOM
12219 You seem to be either cross-compiling or doing a multiarchitecture build,
12220 skipping the byteorder check.
12221
12222 EOM
12223         byteorder='0xffff'
12224         ;;
12225 *)
12226         case "$byteorder" in
12227         '')
12228                 $cat <<'EOM'
12229 In the following, larger digits indicate more significance.  A big-endian
12230 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
12231 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
12232 machines may have weird orders like 3412.  A Cray will report 87654321,
12233 an Alpha will report 12345678. If the test program works the default is
12234 probably right.
12235 I'm now running the test program...
12236 EOM
12237                 $cat >try.c <<'EOCP'
12238 #include <stdio.h>
12239 int main()
12240 {
12241         int i;
12242         union {
12243                 unsigned long l;
12244                 char c[sizeof(long)];
12245         } u;
12246
12247         if (sizeof(long) > 4)
12248                 u.l = (0x08070605L << 32) | 0x04030201L;
12249         else
12250                 u.l = 0x04030201L;
12251         for (i = 0; i < sizeof(long); i++)
12252                 printf("%c", u.c[i]+'0');
12253         printf("\n");
12254         exit(0);
12255 }
12256 EOCP
12257                 xxx_prompt=y
12258                 set try
12259                 if eval $compile && ./try > /dev/null; then
12260                         dflt=`./try`
12261                         case "$dflt" in
12262                         [1-4][1-4][1-4][1-4]|12345678|87654321)
12263                                 echo "(The test program ran ok.)"
12264                                 echo "byteorder=$dflt"
12265                                 xxx_prompt=n
12266                         ;;
12267                         ????|????????) echo "(The test program ran ok.)" ;;
12268                         *) echo "(The test program didn't run right for some reason.)" ;;
12269                         esac
12270                 else
12271                         dflt='4321'
12272                         cat <<'EOM'
12273 (I can't seem to compile the test program.  Guessing big-endian...)
12274 EOM
12275                 fi
12276                 case "$xxx_prompt" in
12277                 y)
12278                         rp="What is the order of bytes in a long?"
12279                         . ./myread
12280                         byteorder="$ans"
12281                         ;;
12282                 *)      byteorder=$dflt
12283                         ;;
12284                 esac
12285                 ;;
12286         esac
12287         $rm -f try.c try
12288         ;;
12289 esac
12290
12291
12292 : how do we catenate cpp tokens here?
12293 echo " "
12294 echo "Checking to see how your cpp does stuff like catenate tokens..." >&4
12295 $cat >cpp_stuff.c <<'EOCP'
12296 #define RCAT(a,b)a/**/b
12297 #define ACAT(a,b)a ## b
12298 RCAT(Rei,ser)
12299 ACAT(Cir,cus)
12300 EOCP
12301 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
12302 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
12303         echo "Oh!  Smells like ANSI's been here." >&4
12304         echo "We can catify or stringify, separately or together!"
12305         cpp_stuff=42
12306 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
12307         echo "Ah, yes!  The good old days!" >&4
12308         echo "However, in the good old days we don't know how to stringify and"
12309         echo "catify at the same time."
12310         cpp_stuff=1
12311 else
12312         $cat >&4 <<EOM
12313 Hmm, I don't seem to be able to catenate tokens with your cpp.  You're going
12314 to have to edit the values of CAT[2-5] in config.h...
12315 EOM
12316         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
12317 fi
12318 $rm -f cpp_stuff.*
12319
12320 : see if this is a db.h system
12321 set db.h i_db
12322 eval $inhdr
12323
12324 case "$i_db" in
12325 $define)
12326         : Check db version.
12327         echo " "
12328         echo "Checking Berkeley DB version ..." >&4
12329         $cat >try.c <<EOCP
12330 #$d_const HASCONST
12331 #ifndef HASCONST
12332 #define const
12333 #endif
12334 #include <sys/types.h>
12335 #include <stdio.h>
12336 #include <db.h>
12337 int main()
12338 {
12339 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
12340     int Major, Minor, Patch ;
12341     unsigned long Version ;
12342     (void)db_version(&Major, &Minor, &Patch) ;
12343     printf("You have Berkeley DB Version 2 or greater\n");
12344
12345     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
12346                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
12347     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
12348                 Major, Minor, Patch) ;
12349
12350     /* check that db.h & libdb are compatible */
12351     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
12352         printf("db.h and libdb are incompatible\n") ;
12353         exit(3);        
12354     }
12355
12356     printf("db.h and libdb are compatible\n") ;
12357
12358     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
12359                 + DB_VERSION_PATCH ;
12360
12361     /* needs to be >= 2.3.4 */
12362     if (Version < 2003004) {
12363     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
12364         printf("but Perl needs Berkeley DB 2.3.4 or greater\n") ;
12365         exit(2);        
12366     }
12367
12368     exit(0);
12369 #else
12370 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
12371     printf("You have Berkeley DB Version 1\n");
12372     exit(0);    /* DB version < 2: the coast is clear. */
12373 #else
12374     exit(1);    /* <db.h> not Berkeley DB? */
12375 #endif
12376 #endif
12377 }
12378 EOCP
12379         set try
12380         if eval $compile_ok && ./try; then
12381                 echo 'Looks OK.' >&4
12382         else
12383                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
12384                 i_db=$undef
12385                 case " $libs " in
12386                 *"-ldb "*)
12387                         : Remove db from list of libraries to use
12388                         echo "Removing unusable -ldb from library list" >&4
12389                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
12390                         shift
12391                         libs="$*"
12392                         echo "libs = $libs" >&4
12393                         ;;
12394                 esac
12395         fi
12396         $rm -f try.*
12397         ;;
12398 esac
12399
12400 case "$i_db" in
12401 define)
12402         : Check the return type needed for hash 
12403         echo " "
12404         echo "Checking return type needed for hash for Berkeley DB ..." >&4
12405         $cat >try.c <<EOCP
12406 #$d_const HASCONST
12407 #ifndef HASCONST
12408 #define const
12409 #endif
12410 #include <sys/types.h>
12411 #include <db.h>
12412
12413 #ifndef DB_VERSION_MAJOR
12414 u_int32_t hash_cb (ptr, size)
12415 const void *ptr;
12416 size_t size;
12417 {
12418 }
12419 HASHINFO info;
12420 int main()
12421 {
12422         info.hash = hash_cb;
12423 }
12424 #endif
12425 EOCP
12426         if $cc $ccflags -c try.c >try.out 2>&1 ; then
12427                 if $contains warning try.out >>/dev/null 2>&1 ; then
12428                         db_hashtype='int'
12429                 else
12430                         db_hashtype='u_int32_t'
12431                 fi
12432         else
12433                 : XXX Maybe we should just give up here.
12434                 db_hashtype=u_int32_t
12435                 $cat try.out >&4
12436                 echo "Help:  I can't seem to compile the db test program." >&4
12437                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
12438         fi
12439         $rm -f try.*
12440         echo "Your version of Berkeley DB uses $db_hashtype for hash."
12441         ;;
12442 *)      db_hashtype=u_int32_t
12443         ;;
12444 esac
12445 case "$i_db" in
12446 define)
12447         : Check the return type needed for prefix 
12448         echo " "
12449         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
12450         cat >try.c <<EOCP
12451 #$d_const HASCONST
12452 #ifndef HASCONST
12453 #define const
12454 #endif
12455 #include <sys/types.h>
12456 #include <db.h>
12457
12458 #ifndef DB_VERSION_MAJOR
12459 size_t prefix_cb (key1, key2)
12460 const DBT *key1;
12461 const DBT *key2;
12462 {
12463 }
12464 BTREEINFO info;
12465 int main()
12466 {
12467         info.prefix = prefix_cb;
12468 }
12469 #endif
12470 EOCP
12471         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
12472                 if $contains warning try.out >>/dev/null 2>&1 ; then
12473                         db_prefixtype='int'
12474                 else
12475                         db_prefixtype='size_t'
12476                 fi
12477         else
12478                 db_prefixtype='size_t'
12479                 : XXX Maybe we should just give up here.
12480                 $cat try.out >&4
12481                 echo "Help:  I can't seem to compile the db test program." >&4
12482                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
12483         fi
12484         $rm -f try.*
12485         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
12486         ;;
12487 *)      db_prefixtype='size_t'
12488         ;;
12489 esac
12490
12491 : check for void type
12492 echo " "
12493 echo "Checking to see how well your C compiler groks the void type..." >&4
12494 case "$voidflags" in
12495 '')
12496         $cat >try.c <<'EOCP'
12497 #if TRY & 1
12498 void sub() {
12499 #else
12500 sub() {
12501 #endif
12502         extern void moo();      /* function returning void */
12503         void (*goo)();          /* ptr to func returning void */
12504 #if TRY & 8
12505         void *hue;              /* generic ptr */
12506 #endif
12507 #if TRY & 2
12508         void (*foo[10])();
12509 #endif
12510
12511 #if TRY & 4
12512         if(goo == moo) {
12513                 exit(0);
12514         }
12515 #endif
12516         exit(0);
12517 }
12518 int main() { sub(); }
12519 EOCP
12520         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
12521                 voidflags=$defvoidused
12522         echo "Good.  It appears to support void to the level $package wants.">&4
12523                 if $contains warning .out >/dev/null 2>&1; then
12524                         echo "However, you might get some warnings that look like this:"
12525                         $cat .out
12526                 fi
12527         else
12528 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
12529                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
12530                         echo "It supports 1..."
12531                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
12532                                 echo "It also supports 2..."
12533                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
12534                                         voidflags=7
12535                                         echo "And it supports 4 but not 8 definitely."
12536                                 else
12537                                         echo "It doesn't support 4..."
12538                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
12539                                                 voidflags=11
12540                                                 echo "But it supports 8."
12541                                         else
12542                                                 voidflags=3
12543                                                 echo "Neither does it support 8."
12544                                         fi
12545                                 fi
12546                         else
12547                                 echo "It does not support 2..."
12548                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
12549                                         voidflags=13
12550                                         echo "But it supports 4 and 8."
12551                                 else
12552                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
12553                                                 voidflags=5
12554                                                 echo "And it supports 4 but has not heard about 8."
12555                                         else
12556                                                 echo "However it supports 8 but not 4."
12557                                         fi
12558                                 fi
12559                         fi
12560                 else
12561                         echo "There is no support at all for void."
12562                         voidflags=0
12563                 fi
12564         fi
12565 esac
12566 case "$voidflags" in
12567 "$defvoidused") ;;
12568 *)      $cat >&4 <<'EOM'
12569   Support flag bits are:
12570     1: basic void declarations.
12571     2: arrays of pointers to functions returning void.
12572     4: operations between pointers to and addresses of void functions.
12573     8: generic void pointers.
12574 EOM
12575         dflt="$voidflags";
12576         rp="Your void support flags add up to what?"
12577         . ./myread
12578         voidflags="$ans"
12579         ;;
12580 esac
12581 $rm -f try.* .out
12582
12583
12584 : How can we generate normalized random numbers ?
12585 echo " "
12586 echo "Looking for a random number function..." >&4
12587 case "$randfunc" in
12588 '')
12589         if set drand48 val -f; eval $csym; $val; then
12590                 dflt="drand48"
12591                 echo "Good, found drand48()." >&4
12592         elif set random val -f; eval $csym; $val; then
12593                 dflt="random"
12594                 echo "OK, found random()." >&4
12595         else
12596                 dflt="rand"
12597                 echo "Yick, looks like I have to use rand()." >&4
12598         fi
12599         echo " "
12600         ;;
12601 *)
12602         dflt="$randfunc"
12603         ;;
12604 esac
12605 cont=true
12606
12607 case "$ccflags" in
12608 *-Dmy_rand=*|*-Dmy_srand=*)
12609         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
12610         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
12611         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
12612         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
12613         ;;
12614 esac
12615
12616 while $test "$cont"; do
12617         rp="Use which function to generate random numbers?"
12618         . ./myread
12619         if $test "$ans" = "$dflt"; then
12620                 : null
12621         else
12622                 randbits=''
12623         fi
12624         randfunc="$ans"
12625         if set $ans val -f; eval $csym; $val; then
12626                 cont=''
12627         else
12628                 dflt=y
12629                 rp="I cannot find function $ans. Use that name anyway?"
12630                 . ./myread
12631                 dflt=rand
12632                 case "$ans" in
12633                         [yY]*) cont='';;
12634                 esac
12635         fi
12636         case "$cont" in
12637         '')
12638                 case "$randfunc" in
12639                 drand48)
12640                         drand01="drand48()"
12641                         seedfunc="srand48"
12642                         randbits=48
12643                         randseedtype=long
12644                         ;;
12645                 rand|random)
12646                         case "$randbits" in
12647                         '')
12648 echo "Checking to see how many bits your $randfunc() function produces..." >&4
12649                                 $cat >try.c <<EOCP
12650 #$i_unistd I_UNISTD
12651 #$i_stdlib I_STDLIB
12652 #include <stdio.h>
12653 #ifdef I_UNISTD
12654 #  include <unistd.h>
12655 #endif
12656 #ifdef I_STDLIB
12657 #  include <stdlib.h>
12658 #endif
12659 int main()
12660 {
12661         register int i;
12662         register unsigned long tmp;
12663         register unsigned long max = 0L;
12664
12665         for (i = 1000; i; i--) {
12666                 tmp = (unsigned long) $randfunc();
12667                 if (tmp > max) max = tmp;
12668         }
12669         for (i = 0; max; i++)
12670                 max /= 2;
12671         printf("%d\n",i);
12672 }
12673 EOCP
12674                                 set try
12675                                 if eval $compile_ok; then
12676                                         dflt=`try`
12677                                 else
12678                                         dflt='?'
12679                                         echo "(I can't seem to compile the test program...)"
12680                                 fi
12681                                 ;;
12682                         *)
12683                                 dflt="$randbits"
12684                                 ;;
12685                         esac
12686                         rp="How many bits does your $randfunc() function produce?"
12687                         . ./myread
12688                         randbits="$ans"
12689                         $rm -f try.c try
12690                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
12691                         seedfunc="s$randfunc"
12692                         randseedtype=unsigned
12693                         ;;
12694                 *)
12695                         dflt="31"
12696                         rp="How many bits does your $randfunc() function produce?"
12697                         . ./myread
12698                         randbits="$ans"
12699                         seedfunc="s$randfunc"
12700                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
12701                         if set $seedfunc val -f; eval $csym; $val; then
12702                                 echo "(Using $seedfunc() to seed random generator)"
12703                         else
12704                                 echo "(Warning: no $seedfunc() to seed random generator)"
12705                                 seedfunc=rand
12706                         fi
12707                         randseedtype=unsigned
12708                         ;;
12709                 esac
12710                 ;;
12711         esac
12712 done
12713
12714 echo " "
12715 echo "Determining whether or not we are on an EBCDIC system..." >&4
12716 $cat >tebcdic.c <<'EOM'
12717 int main()
12718 {
12719   if ('M'==0xd4) return 0;
12720   return 1;
12721 }
12722 EOM
12723
12724 val=$undef
12725 set tebcdic
12726 if eval $compile_ok; then
12727         if ./tebcdic; then
12728                 echo "You have EBCDIC." >&4
12729                 val="$define"
12730         else
12731                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin." >&4
12732         fi
12733 else
12734         echo "I'm unable to compile the test program." >&4
12735         echo "I'll assume ASCII or some ISO Latin." >&4
12736 fi
12737 $rm -f tebcdic.c tebcdic
12738 set ebcdic
12739 eval $setvar
12740
12741 echo " "
12742 $cat >&4 <<EOM
12743 Checking how to flush all pending stdio output...
12744 EOM
12745 # I only know how to find the first 32 possibly open files on SunOS.
12746 # See also hints/sunos_4_1.sh and util.c  --AD
12747 case "$osname" in
12748 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
12749 esac
12750 $cat >>try.c <<EOCP
12751 #include <stdio.h>
12752 #$i_unistd I_UNISTD
12753 #ifdef I_UNISTD
12754 # include <unistd.h>
12755 #endif
12756 #$d_sysconf HAS_SYSCONF
12757 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
12758 #ifdef HAS_STDIO_STREAM_ARRAY
12759 # define STDIO_STREAM_ARRAY $stdio_stream_array
12760 #endif
12761 int main() {
12762   FILE* p = fopen("try.out", "w");
12763 #ifdef TRY_FPUTC
12764   fputc('x', p);
12765 #else
12766 # ifdef TRY_FPRINTF
12767   fprintf(p, "x");
12768 # endif
12769 #endif
12770 #ifdef TRY_FFLUSH_NULL
12771   fflush(NULL);
12772 #endif
12773 #ifdef TRY_FFLUSH_ALL
12774   {
12775     long open_max = -1;
12776 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
12777     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
12778 # else
12779 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
12780     open_max = sysconf(_SC_OPEN_MAX);
12781 #  else
12782 #   ifdef FOPEN_MAX
12783     open_max = FOPEN_MAX;
12784 #   else
12785 #    ifdef OPEN_MAX
12786     open_max = OPEN_MAX;
12787 #    else
12788 #     ifdef _NFILE
12789     open_max = _NFILE;
12790 #     endif
12791 #    endif
12792 #   endif
12793 #  endif
12794 # endif 
12795 # ifdef HAS_STDIO_STREAM_ARRAY
12796     if (open_max > 0) {
12797       long i;
12798       for (i = 0; i < open_max; i++)
12799             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
12800                 STDIO_STREAM_ARRAY[i]._file < open_max &&
12801                 STDIO_STREAM_ARRAY[i]._flag)
12802                 fflush(&STDIO_STREAM_ARRAY[i]);
12803     }   
12804   }
12805 # endif
12806 #endif
12807   _exit(42);
12808 }
12809 EOCP
12810 : first we have to find out how _not_ to flush
12811 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
12812     output=''
12813     set try -DTRY_FPUTC
12814     if eval $compile; then
12815             $rm -f try.out
12816             ./try$exe_ext 2>/dev/null
12817             if $test ! -s try.out -a "X$?" = X42; then
12818                 output=-DTRY_FPUTC
12819             fi
12820     fi
12821     case "$output" in
12822     '')
12823             set try -DTRY_FPRINTF
12824             $rm -f try.out
12825             if eval $compile; then
12826                     $rm -f try.out
12827                     ./try$exe_ext 2>/dev/null
12828                     if $test ! -s try.out -a "X$?" = X42; then
12829                         output=-DTRY_FPRINTF
12830                     fi
12831             fi
12832         ;;
12833     esac
12834 fi
12835 : check for fflush NULL behaviour
12836 case "$fflushNULL" in
12837 '')     set try -DTRY_FFLUSH_NULL $output
12838         if eval $compile; then
12839                 $rm -f try.out
12840                 ./try$exe_ext 2>/dev/null
12841                 code="$?"
12842                 if $test -s try.out -a "X$code" = X42; then
12843                         fflushNULL="`$cat try.out`"
12844                 else
12845                         if $test "X$code" != X42; then
12846                                 $cat >&4 <<EOM
12847 (If this test failed, don't worry, we'll try another method shortly.)
12848 EOM
12849                         fi
12850                 fi
12851         fi
12852         $rm -f core try.core core.try.*
12853         case "$fflushNULL" in
12854         x)      $cat >&4 <<EOM
12855 Your fflush(NULL) works okay for output streams.
12856 Let's see if it clobbers input pipes...
12857 EOM
12858 # As of mid-March 2000 all versions of Solaris appear to have a stdio
12859 # bug that improperly flushes the input end of pipes.  So we avoid the
12860 # autoflush on fork/system/exec support for now. :-(
12861 $cat >tryp.c <<EOCP
12862 #include <stdio.h>
12863 int
12864 main(int argc, char **argv)
12865 {
12866     char buf[1024];
12867     int i;
12868     char *bp = buf;
12869     while (1) {
12870         while ((i = getc(stdin)) != -1
12871                && (*bp++ = i) != '\n'
12872                && bp < &buf[1024])
12873         /* DO NOTHING */ ;
12874         *bp = '\0';
12875         fprintf(stdout, "%s", buf);
12876         fflush(NULL);
12877         if (i == -1)
12878             return 0;
12879         bp = buf;
12880     }
12881 }
12882 EOCP
12883                 fflushNULL="$define"
12884                 set tryp
12885                 if eval $compile; then
12886                     $rm -f tryp.out
12887                     $cat tryp.c | ./tryp$exe_ext 2>/dev/null > tryp.out
12888                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
12889                        $cat >&4 <<EOM
12890 fflush(NULL) seems to behave okay with input streams.
12891 EOM
12892                         fflushNULL="$define"
12893                     else
12894                         $cat >&4 <<EOM
12895 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
12896 EOM
12897                         fflushNULL="$undef"
12898                     fi
12899                 fi
12900                 $rm -f core tryp.c tryp.core core.tryp.*
12901                 ;;
12902         '')     $cat >&4 <<EOM
12903 Your fflush(NULL) isn't working (contrary to ANSI C).
12904 EOM
12905                 fflushNULL="$undef"
12906                 ;;
12907         *)      $cat >&4 <<EOM
12908 Cannot figure out whether your fflush(NULL) works or not.
12909 I'm assuming it doesn't (contrary to ANSI C).
12910 EOM
12911                 fflushNULL="$undef"
12912                 ;;
12913         esac
12914         ;;
12915 $define|true|[yY]*)
12916         fflushNULL="$define"
12917         ;;
12918 *)
12919         fflushNULL="$undef"
12920         ;;
12921 esac
12922 : check explicit looping only if NULL did not work, and if the pipe
12923 : bug does not show up on an explicit flush too
12924 case "$fflushNULL" in
12925 "$undef")
12926         $cat >tryp.c <<EOCP
12927 #include <stdio.h>
12928 int
12929 main(int argc, char **argv)
12930 {
12931     char buf[1024];
12932     int i;
12933     char *bp = buf;
12934     while (1) {
12935         while ((i = getc(stdin)) != -1
12936                && (*bp++ = i) != '\n'
12937                && bp < &buf[1024])
12938         /* DO NOTHING */ ;
12939         *bp = '\0';
12940         fprintf(stdout, "%s", buf);
12941         fflush(stdin);
12942         if (i == -1)
12943             return 0;
12944         bp = buf;
12945     }
12946 }
12947 EOCP
12948         set tryp
12949         if eval $compile; then
12950             $rm -f tryp.out
12951             $cat tryp.c | ./tryp$exe_ext 2>/dev/null > tryp.out
12952             if cmp tryp.c tryp.out >/dev/null 2>&1; then
12953                $cat >&4 <<EOM
12954 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
12955 EOM
12956                 : now check for fflushall behaviour
12957                 case "$fflushall" in
12958                 '')     set try -DTRY_FFLUSH_ALL $output
12959                         if eval $compile; then
12960                                 $cat >&4 <<EOM
12961 (Now testing the other method--but note that this also may fail.)
12962 EOM
12963                                 $rm -f try.out
12964                                 ./try$exe_ext 2>/dev/null
12965                                 if $test -s try.out -a "X$?" = X42; then
12966                                         fflushall="`$cat try.out`"
12967                                 fi
12968                         fi
12969                         $rm -f core try.core core.try.*
12970                         case "$fflushall" in
12971                         x)      $cat >&4 <<EOM
12972 Whew. Flushing explicitly all the stdio streams works.
12973 EOM
12974                                 fflushall="$define"
12975                                 ;;
12976                         '')     $cat >&4 <<EOM
12977 Sigh. Flushing explicitly all the stdio streams doesn't work.
12978 EOM
12979                                 fflushall="$undef"
12980                                 ;;
12981                         *)      $cat >&4 <<EOM
12982 Cannot figure out whether flushing stdio streams explicitly works or not.
12983 I'm assuming it doesn't.
12984 EOM
12985                                 fflushall="$undef"
12986                                 ;;
12987                         esac
12988                         ;;
12989                 "$define"|true|[yY]*)
12990                         fflushall="$define"
12991                         ;;
12992                 *)
12993                         fflushall="$undef"
12994                         ;;
12995                 esac
12996             else
12997                 $cat >&4 <<EOM
12998 All is futile.  Even fflush(stdin) clobbers input pipes!
12999 EOM
13000                 fflushall="$undef"
13001             fi
13002         else
13003             fflushall="$undef"
13004         fi
13005         $rm -f core tryp.c tryp.core core.tryp.*
13006         ;;
13007 *)      fflushall="$undef"
13008         ;;
13009 esac
13010
13011 case "$fflushNULL$fflushall" in
13012 undefundef)
13013         $cat <<EOM
13014 OK, I give up.  I cannot figure out how to flush pending stdio output.
13015 We won't be flushing handles at all before fork/exec/popen.
13016 EOM
13017         ;;
13018 esac
13019 $rm -f try.* try$exe_ext
13020
13021 : Store the full pathname to the ar program for use in the C program
13022 : Respect a hint or command line value for full_ar.
13023 case "$full_ar" in
13024 '') full_ar=$ar ;;
13025 esac
13026
13027 : Store the full pathname to the sed program for use in the C program
13028 full_sed=$sed
13029
13030 : see what type gids are declared as in the kernel
13031 echo " "
13032 echo "Looking for the type for group ids returned by getgid()."
13033 set gid_t gidtype xxx stdio.h sys/types.h
13034 eval $typedef
13035 case "$gidtype" in
13036 xxx)
13037         xxx=`./findhdr sys/user.h`
13038         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
13039         case $1 in
13040         unsigned) dflt="$1 $2" ;;
13041         *) dflt="$1" ;;
13042         esac
13043         ;;
13044 *) dflt="$gidtype";;
13045 esac
13046 case "$gidtype" in
13047 gid_t) echo "gid_t found." ;;
13048 *)      rp="What is the type for group ids returned by getgid()?"
13049         . ./myread
13050         gidtype="$ans"
13051         ;;
13052 esac
13053
13054 echo " "
13055 case "$gidtype" in
13056 *_t) zzz="$gidtype"     ;;
13057 *)   zzz="gid"          ;;
13058 esac
13059 echo "Checking the size of $zzz..." >&4 
13060 cat > try.c <<EOCP
13061 #include <sys/types.h>
13062 #include <stdio.h>
13063 int main() {
13064     printf("%d\n", (int)sizeof($gidtype));
13065     exit(0);
13066 }
13067 EOCP
13068 set try
13069 if eval $compile_ok; then
13070         yyy=`./try`
13071         case "$yyy" in
13072         '')     gidsize=4
13073                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
13074                 ;;
13075         *)      gidsize=$yyy
13076                 echo "Your $zzz is $gidsize bytes long."
13077                 ;;
13078         esac
13079 else
13080         gidsize=4
13081         echo "(I can't compile the test program--guessing $gidsize.)" >&4
13082 fi
13083
13084
13085 echo " "
13086 case "$gidtype" in
13087 *_t) zzz="$gidtype"     ;;
13088 *)   zzz="gid"          ;;
13089 esac
13090 echo "Checking the sign of $zzz..." >&4 
13091 cat > try.c <<EOCP
13092 #include <sys/types.h>
13093 #include <stdio.h>
13094 int main() {
13095         $gidtype foo = -1;
13096         if (foo < 0)
13097                 printf("-1\n");
13098         else
13099                 printf("1\n");
13100 }
13101 EOCP
13102 set try
13103 if eval $compile; then
13104         yyy=`./try`
13105         case "$yyy" in
13106         '')     gidsign=1
13107                 echo "(I can't execute the test program--guessing unsigned.)" >&4
13108                 ;;
13109         *)      gidsign=$yyy
13110                 case "$gidsign" in
13111                  1) echo "Your $zzz is unsigned." ;;
13112                 -1) echo "Your $zzz is signed."   ;;
13113                 esac
13114                 ;;
13115         esac
13116 else
13117         gidsign=1
13118         echo "(I can't compile the test program--guessing unsigned.)" >&4
13119 fi
13120
13121
13122 echo " "
13123
13124 if $test X"$quadtype" != X; then
13125
13126 echo "Checking how to print 64-bit integers..." >&4
13127
13128 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
13129         $cat >try.c <<'EOCP'
13130 #include <sys/types.h>
13131 #include <stdio.h>
13132 int main() {
13133   int q = 12345678901;
13134   printf("%ld\n", q);
13135 }
13136 EOCP
13137         set try
13138         if eval $compile; then
13139                 yyy=`./try$exe_ext`
13140                 case "$yyy" in
13141                 12345678901)
13142                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
13143                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
13144                         echo "We will use %d."
13145                         ;;
13146                 esac
13147         fi
13148 fi
13149
13150 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
13151         $cat >try.c <<'EOCP'
13152 #include <sys/types.h>
13153 #include <stdio.h>
13154 int main() {
13155   long q = 12345678901;
13156   printf("%ld\n", q);
13157 }
13158 EOCP
13159         set try
13160         if eval $compile; then
13161                 yyy=`./try$exe_ext`
13162                 case "$yyy" in
13163                 12345678901)
13164                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
13165                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
13166                         echo "We will use %ld."
13167                         ;;
13168                 esac
13169         fi
13170 fi
13171
13172 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
13173         $cat >try.c <<'EOCP'
13174 #include <sys/types.h>
13175 #include <inttypes.h>
13176 #include <stdio.h>
13177 int main() {
13178   int64_t q = 12345678901;
13179   printf("%" PRId64 "\n", q);
13180 }
13181 EOCP
13182         set try
13183         if eval $compile; then
13184                 yyy=`./try$exe_ext`
13185                 case "$yyy" in
13186                 12345678901)
13187                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
13188                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
13189                         echo "We will use the C9X style."
13190                         ;;
13191                 esac
13192         fi
13193 fi
13194
13195 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
13196         $cat >try.c <<'EOCP'
13197 #include <sys/types.h>
13198 #include <stdio.h>
13199 int main() {
13200   long long q = 12345678901LL; /* AIX cc requires the LL prefix. */
13201   printf("%lld\n", q);
13202 }
13203 EOCP
13204         set try
13205         if eval $compile; then
13206                 yyy=`./try$exe_ext`
13207                 case "$yyy" in
13208                 12345678901)
13209                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
13210                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
13211                         echo "We will use the %lld style."
13212                         ;;
13213                 esac
13214         fi
13215 fi
13216
13217 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
13218         $cat >try.c <<EOCP
13219 #include <sys/types.h>
13220 #include <stdio.h>
13221 int main() {
13222   $quadtype q = 12345678901;
13223   printf("%Ld\n", q);
13224 }
13225 EOCP
13226         set try
13227         if eval $compile; then
13228                 yyy=`./try$exe_ext`
13229                 case "$yyy" in
13230                 12345678901)
13231                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
13232                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
13233                         echo "We will use %Ld."
13234                         ;;
13235                 esac
13236         fi
13237 fi
13238
13239 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
13240         $cat >try.c <<EOCP
13241 #include <sys/types.h>
13242 #include <stdio.h>
13243 int main() {
13244   $quadtype q = 12345678901;
13245   printf("%qd\n", q);
13246 }
13247 EOCP
13248         set try
13249         if eval $compile; then
13250                 yyy=`./try$exe_ext`
13251                 case "$yyy" in
13252                 12345678901)
13253                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
13254                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
13255                         echo "We will use %qd."
13256                         ;;
13257                 esac
13258         fi
13259 fi
13260
13261 if $test X"$sPRId64" = X; then
13262         echo "Cannot figure out how to print 64-bit integers." >&4
13263 fi
13264
13265 $rm -f try try.*
13266
13267 fi
13268
13269 case "$sPRId64" in
13270 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef"; 
13271         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef"; 
13272         ;;
13273 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define"; 
13274         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define"; 
13275         ;;
13276 esac
13277
13278
13279 echo " "
13280 $echo "Checking the format strings to be used for Perl's internal types..." >&4
13281
13282 if $test X"$ivsize" = X8; then
13283         ivdformat="$sPRId64"
13284         uvuformat="$sPRIu64"
13285         uvoformat="$sPRIo64"
13286         uvxformat="$sPRIx64"
13287         uvXUformat="$sPRIXU64"
13288 else
13289         if $test X"$ivsize" = X"$longsize"; then
13290                 ivdformat='"ld"'
13291                 uvuformat='"lu"'
13292                 uvoformat='"lo"'
13293                 uvxformat='"lx"'
13294                 uvXUformat='"lX"'
13295         else
13296                 if $test X"$ivsize" = X"$intsize"; then
13297                         ivdformat='"d"'
13298                         uvuformat='"u"'
13299                         uvoformat='"o"'
13300                         uvxformat='"x"'
13301                         uvXUformat='"X"'
13302                 else
13303                         : far out
13304                         if $test X"$ivsize" = X"$shortsize"; then
13305                                 ivdformat='"hd"'
13306                                 uvuformat='"hu"'
13307                                 uvoformat='"ho"'
13308                                 uvxformat='"hx"'
13309                                 uvXUformat='"hX"'
13310                         fi
13311                 fi
13312         fi
13313 fi
13314
13315 if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
13316         nveformat="$sPRIeldbl"
13317         nvfformat="$sPRIfldbl"
13318         nvgformat="$sPRIgldbl"
13319         nvEUformat="$sPRIEUldbl"
13320         nvFUformat="$sPRIFUldbl"
13321         nvGUformat="$sPRIGUldbl"
13322 else
13323         nveformat='"e"'
13324         nvfformat='"f"'
13325         nvgformat='"g"'
13326         nvEUformat='"E"'
13327         nvFUformat='"F"'
13328         nvGUformat='"G"'
13329 fi
13330
13331 case "$ivdformat" in
13332 '') echo "$0: Fatal: failed to find format strings, cannot continue." >& 4
13333     exit 1
13334     ;;
13335 esac
13336
13337
13338 echo " "
13339 $echo "Checking the format string to be used for gids..." >&4
13340
13341 case "$gidsign" in
13342 -1)     if $test X"$gidsize" = X"$ivsize"; then
13343                 gidformat="$ivdformat"
13344         else
13345                 if $test X"$gidsize" = X"$longsize"; then
13346                         gidformat='"ld"'
13347                 else
13348                         if $test X"$gidsize" = X"$intsize"; then
13349                                 gidformat='"d"'
13350                         else
13351                                 if $test X"$gidsize" = X"$shortsize"; then
13352                                         gidformat='"hd"'
13353                                 fi
13354                         fi
13355                 fi
13356         fi
13357         ;;
13358 *)      if $test X"$gidsize" = X"$uvsize"; then
13359                 gidformat="$uvuformat"
13360         else
13361                 if $test X"$gidsize" = X"$longsize"; then
13362                         gidformat='"lu"'
13363                 else
13364                         if $test X"$gidsize" = X"$intsize"; then
13365                                 gidformat='"u"'
13366                         else
13367                                 if $test X"$gidsize" = X"$shortsize"; then
13368                                         gidformat='"hu"'
13369                                 fi
13370                         fi
13371                 fi
13372         fi
13373         ;;
13374 esac
13375
13376 : see if getgroups exists
13377 set getgroups d_getgrps
13378 eval $inlibc
13379
13380 : see if setgroups exists
13381 set setgroups d_setgrps
13382 eval $inlibc
13383
13384
13385 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
13386 echo " "
13387 case "$d_getgrps$d_setgrps" in
13388 *define*)
13389         case "$groupstype" in
13390         '') dflt="$gidtype" ;;
13391         *)  dflt="$groupstype" ;;
13392         esac
13393         $cat <<EOM
13394 What type of pointer is the second argument to getgroups() and setgroups()?
13395 Usually this is the same as group ids, $gidtype, but not always.
13396
13397 EOM
13398         rp='What type pointer is the second argument to getgroups() and setgroups()?'
13399         . ./myread
13400         groupstype="$ans"
13401         ;;
13402 *)  groupstype="$gidtype";;
13403 esac
13404
13405 echo " "
13406 echo "Checking if your $make program sets \$(MAKE)..." >&4
13407 case "$make_set_make" in
13408 '')
13409         $sed 's/^X //' > testmake.mak << 'EOF'
13410 Xall:
13411 X       @echo 'maketemp="$(MAKE)"'
13412 EOF
13413         case "`$make -f testmake.mak 2>/dev/null`" in
13414         *maketemp=*) make_set_make='#' ;;
13415         *)      make_set_make="MAKE=$make" ;;
13416         esac
13417         $rm -f testmake.mak
13418         ;;
13419 esac
13420 case "$make_set_make" in
13421 '#') echo "Yup, it does.";;
13422 *) echo "Nope, it doesn't.";;
13423 esac
13424
13425 : see what type is used for mode_t
13426 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
13427 set mode_t modetype int stdio.h sys/types.h
13428 eval $typedef_ask
13429
13430 : define a fucntion to check prototypes
13431 $cat > protochk <<EOSH
13432 $startsh
13433 cc="$cc"
13434 optimize="$optimize"
13435 ccflags="$ccflags"
13436 prototype="$prototype"
13437 define="$define"
13438 rm=$rm
13439 EOSH
13440
13441 $cat >> protochk <<'EOSH'
13442
13443 $rm -f try.c
13444 foo="$1"
13445 shift
13446 while test $# -ge 2; do
13447         case "$1" in
13448                 $define) echo "#include <$2>" >> try.c ;;
13449                 literal) echo "$2" >> try.c ;;
13450         esac
13451     shift 2
13452 done
13453 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
13454 cat >> try.c <<'EOCP'
13455 #ifdef CAN_PROTOTYPE
13456 #define _(args) args
13457 #else
13458 #define _(args) ()
13459 #endif
13460 EOCP
13461 echo "$foo" >> try.c
13462 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
13463 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
13464 status=$?
13465 $rm -f try.[co]
13466 exit $status
13467 EOSH
13468 chmod +x protochk
13469 $eunicefix protochk
13470
13471 : see what type is used for size_t
13472 rp="What is the type used for the length parameter for string functions?"
13473 set size_t sizetype 'unsigned int' stdio.h sys/types.h
13474 eval $typedef_ask
13475
13476 : check for type of arguments to gethostbyaddr. 
13477 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
13478         case "$d_gethbyaddr" in
13479         $define)
13480                 $cat <<EOM
13481
13482 Checking to see what type of arguments are accepted by gethostbyaddr().
13483 EOM
13484                 hdrs="$define sys/types.h
13485                         $d_socket sys/socket.h 
13486                         $i_niin netinet/in.h 
13487                         $i_netdb netdb.h
13488                         $i_unistd unistd.h"
13489                 : The first arg can 'char *' or 'void *'
13490                 : The second arg is some of integral type
13491                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
13492                         for yyy in size_t long int; do
13493                                 case "$netdb_host_type" in
13494                                 '')     try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
13495                                         if ./protochk "$try" $hdrs; then
13496                                                 echo "Your system accepts $xxx for the first arg."
13497                                                 echo "...and $yyy for the second arg."
13498                                                 netdb_host_type="$xxx"
13499                                                 netdb_hlen_type="$yyy"
13500                                         fi
13501                                         ;;
13502                                 esac
13503                         done
13504                 done
13505                 : In case none of those worked, prompt the user.
13506                 case "$netdb_host_type" in
13507                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
13508                         dflt='char *'
13509                         . ./myread
13510                         netdb_host_type=$ans
13511                         rp='What is the type for the 2nd argument to gethostbyaddr?'
13512                         dflt="$sizetype"
13513                         . ./myread
13514                         netdb_hlen_type=$ans
13515                         ;;
13516                 esac
13517                 ;;
13518         *)      : no gethostbyaddr, so pick harmless defaults
13519                 netdb_host_type='char *'
13520                 netdb_hlen_type="$sizetype"
13521                 ;;
13522         esac
13523         # Remove the "const" if needed. -- but then we'll have a 
13524         # prototype clash!
13525         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
13526 fi
13527
13528 : check for type of argument to gethostbyname. 
13529 if test "X$netdb_name_type" = X ; then
13530         case "$d_gethbyname" in
13531         $define)
13532                 $cat <<EOM
13533
13534 Checking to see what type of argument is accepted by gethostbyname().
13535 EOM
13536                 hdrs="$define sys/types.h
13537                         $d_socket sys/socket.h 
13538                         $i_niin netinet/in.h 
13539                         $i_netdb netdb.h
13540                         $i_unistd unistd.h"
13541                 for xxx in "const char *" "char *"; do
13542                         case "$netdb_name_type" in
13543                         '')     try="extern struct hostent *gethostbyname($xxx);"
13544                                 if ./protochk "$try" $hdrs; then
13545                                         echo "Your system accepts $xxx."
13546                                         netdb_name_type="$xxx"
13547                                 fi
13548                                 ;;
13549                         esac
13550                 done
13551                 : In case none of those worked, prompt the user.
13552                 case "$netdb_name_type" in
13553                 '')     rp='What is the type for the 1st argument to gethostbyname?'
13554                         dflt='char *'
13555                         . ./myread
13556                         netdb_name_type=$ans
13557                         ;;
13558                 esac
13559                 ;;
13560         *)      : no gethostbyname, so pick harmless default
13561                 netdb_name_type='char *'
13562                 ;;
13563         esac
13564 fi
13565
13566 : check for type of 1st argument to getnetbyaddr. 
13567 if test "X$netdb_net_type" = X ; then
13568         case "$d_getnbyaddr" in
13569         $define)
13570                 $cat <<EOM
13571
13572 Checking to see what type of 1st argument is accepted by getnetbyaddr().
13573 EOM
13574                 hdrs="$define sys/types.h
13575                         $d_socket sys/socket.h 
13576                         $i_niin netinet/in.h 
13577                         $i_netdb netdb.h
13578                         $i_unistd unistd.h"
13579                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
13580                         case "$netdb_net_type" in
13581                         '')     try="extern struct netent *getnetbyaddr($xxx, int);"
13582                                 if ./protochk "$try" $hdrs; then
13583                                         echo "Your system accepts $xxx."
13584                                         netdb_net_type="$xxx"
13585                                 fi
13586                                 ;;
13587                         esac
13588                 done
13589                 : In case none of those worked, prompt the user.
13590                 case "$netdb_net_type" in
13591                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
13592                         dflt='long'
13593                         . ./myread
13594                         netdb_net_type=$ans
13595                         ;;
13596                 esac
13597                 ;;
13598         *)      : no getnetbyaddr, so pick harmless default
13599                 netdb_net_type='long'
13600                 ;;
13601         esac
13602 fi
13603 : locate the preferred pager for this system
13604 case "$pager" in
13605 '')
13606         dflt=''
13607         case "$pg" in
13608         /*) dflt=$pg;;
13609         esac
13610         case "$more" in
13611         /*) dflt=$more;;
13612         esac
13613         case "$less" in
13614         /*) dflt=$less;;
13615         esac
13616         case "$dflt" in
13617         '') dflt=/usr/ucb/more;;
13618         esac
13619         ;;
13620 *) dflt="$pager";;
13621 esac
13622 echo " "
13623 fn=f/
13624 rp='What pager is used on your system?'
13625 . ./getfile
13626 pager="$ans"
13627
13628 : see what type pids are declared as in the kernel
13629 rp="What is the type of process ids on this system?"
13630 set pid_t pidtype int stdio.h sys/types.h
13631 eval $typedef_ask
13632
13633 : Find earliest binary compatible site_perl subdirectory perl can use.
13634 case "$bincompat5005" in
13635 "$define") xs_apiversion='5.005' ;;
13636 *) xs_apiversion=$version ;;   # The current site_perl version.
13637 esac
13638 : Find earliest pure perl site_perl subdirectory perl can use.
13639 : The versioned directories started at 5.005.
13640 pm_apiversion='5.005'
13641
13642 : check for length of pointer
13643 echo " "
13644 case "$ptrsize" in
13645 '')
13646         echo "Checking to see how big your pointers are..." >&4
13647         if test "$voidflags" -gt 7; then
13648                 echo '#define VOID_PTR char *' > try.c
13649         else
13650                 echo '#define VOID_PTR void *' > try.c
13651         fi
13652         $cat >>try.c <<'EOCP'
13653 #include <stdio.h>
13654 int main()
13655 {
13656     printf("%d\n", (int)sizeof(VOID_PTR));
13657     exit(0);
13658 }
13659 EOCP
13660         set try
13661         if eval $compile_ok; then
13662                 ptrsize=`./try`
13663                 echo "Your pointers are $ptrsize bytes long."
13664         else
13665                 dflt='4'
13666                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
13667                 rp="What is the size of a pointer (in bytes)?"
13668                 . ./myread
13669                 ptrsize="$ans"
13670         fi
13671         ;;
13672 esac
13673 $rm -f try.c try
13674
13675 : see if ar generates random libraries by itself
13676 echo " "
13677 echo "Checking how to generate random libraries on your machine..." >&4
13678 echo 'int bar1() { return bar2(); }' > bar1.c
13679 echo 'int bar2() { return 2; }' > bar2.c
13680 $cat > foo.c <<'EOP'
13681 int main() { printf("%d\n", bar1()); exit(0); }
13682 EOP
13683 $cc $ccflags -c bar1.c >/dev/null 2>&1
13684 $cc $ccflags -c bar2.c >/dev/null 2>&1
13685 $cc $ccflags -c foo.c >/dev/null 2>&1
13686 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
13687 if $cc $ccflags $ldflags -o foobar foo$_o bar$_a $libs > /dev/null 2>&1 &&
13688         ./foobar >/dev/null 2>&1; then
13689         echo "$ar appears to generate random libraries itself."
13690         orderlib=false
13691         ranlib=":"
13692 elif $ar ts bar$_a >/dev/null 2>&1 &&
13693         $cc $ccflags $ldflags -o foobar foo$_o bar$_a $libs > /dev/null 2>&1 &&
13694         ./foobar >/dev/null 2>&1; then
13695                 echo "a table of contents needs to be added with '$ar ts'."
13696                 orderlib=false
13697                 ranlib="$ar ts"
13698 else
13699         case "$ranlib" in
13700         :) ranlib='';;
13701         '')
13702                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
13703                 $test -f $ranlib || ranlib=''
13704                 ;;
13705         esac
13706         if $test -n "$ranlib"; then
13707                 echo "your system has '$ranlib'; we'll use that."
13708                 orderlib=false
13709         else
13710                 echo "your system doesn't seem to support random libraries"
13711                 echo "so we'll use lorder and tsort to order the libraries."
13712                 orderlib=true
13713                 ranlib=":"
13714         fi
13715 fi
13716 $rm -f foo* bar* 
13717
13718 : check for type of arguments to select. 
13719 case "$selecttype" in
13720 '') case "$d_select" in
13721         $define)
13722                 echo " "
13723                 $cat <<EOM
13724 Checking to see what type of arguments are accepted by select().
13725 EOM
13726                 hdrs="$define sys/types.h
13727                         $i_systime sys/time.h 
13728                         $i_sysselct sys/select.h
13729                         $d_socket sys/socket.h"
13730                 : The first arg can be int, unsigned, or size_t
13731                 : The last arg may or may not be 'const'
13732                 val=''
13733                 : void pointer has been seen but using that
13734                 : breaks the selectminbits test
13735                 for xxx in 'fd_set *' 'int *'; do
13736                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
13737                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
13738                                         case "$val" in
13739                                         '')     try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
13740                                                 if ./protochk "$try" $hdrs; then
13741                                                         echo "Your system accepts $xxx."
13742                                                         val="$xxx"
13743                                                 fi
13744                                                 ;;
13745                                         esac
13746                                 done
13747                         done
13748                 done
13749                 case "$val" in
13750                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
13751                         case "$d_fd_set" in
13752                                 $define) dflt="fd_set *" ;;
13753                                 *)              dflt="int *" ;;
13754                         esac
13755                         . ./myread
13756                         val=$ans
13757                         ;;
13758                 esac
13759                 selecttype="$val"
13760                 ;;
13761         *)      : no select, so pick a harmless default
13762                 selecttype='int *'
13763                 ;;
13764         esac
13765         ;;
13766 esac
13767
13768 : check for the select 'width'
13769 case "$selectminbits" in
13770 '') case "$d_select" in
13771         $define)
13772                 $cat <<EOM
13773
13774 Checking to see on how many bits at a time your select() operates...
13775 EOM
13776                 $cat >try.c <<EOCP
13777 #include <sys/types.h>
13778 #$i_time I_TIME
13779 #$i_systime I_SYS_TIME
13780 #$i_systimek I_SYS_TIME_KERNEL
13781 #ifdef I_TIME
13782 #   include <time.h>
13783 #endif
13784 #ifdef I_SYS_TIME
13785 #   ifdef I_SYS_TIME_KERNEL
13786 #       define KERNEL
13787 #   endif
13788 #   include <sys/time.h>
13789 #   ifdef I_SYS_TIME_KERNEL
13790 #       undef KERNEL
13791 #   endif
13792 #endif
13793 #$i_sysselct I_SYS_SELECT
13794 #ifdef I_SYS_SELECT
13795 #include <sys/select.h>
13796 #endif
13797 #$d_socket HAS_SOCKET
13798 #ifdef HAS_SOCKET
13799 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
13800 #endif
13801 #include <stdio.h>
13802 $selecttype b;
13803 #define S sizeof(*(b))
13804 #define MINBITS 64
13805 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
13806 #define NBITS  (NBYTES * 8)
13807 int main() {
13808     char s[NBYTES];
13809     struct timeval t;
13810     int i;
13811     FILE* fp;
13812     int fd;
13813
13814     fclose(stdin);
13815     fp = fopen("try.c", "r");
13816     if (fp == 0)
13817       exit(1);
13818     fd = fileno(fp);
13819     if (fd < 0)
13820       exit(2);
13821     b = ($selecttype)s;
13822     for (i = 0; i < NBITS; i++)
13823         FD_SET(i, b);
13824     t.tv_sec  = 0;
13825     t.tv_usec = 0;
13826     select(fd + 1, b, 0, 0, &t);
13827     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
13828     printf("%d\n", i + 1);
13829     return 0;
13830 }
13831 EOCP
13832                 set try
13833                 if eval $compile_ok; then
13834                         selectminbits=`./try`
13835                         case "$selectminbits" in
13836                         '')     cat >&4 <<EOM
13837 Cannot figure out on how many bits at a time your select() operates.
13838 I'll play safe and guess it is 32 bits.
13839 EOM
13840                                 selectminbits=32
13841                                 bits="32 bits"
13842                                 ;;
13843                         1)      bits="1 bit" ;;
13844                         *)      bits="$selectminbits bits" ;;
13845                         esac
13846                         echo "Your select() operates on $bits at a time." >&4
13847                 else
13848                         rp='What is the minimum number of bits your select() operates on?'
13849                         case "$byteorder" in
13850                         1234|12345678)  dflt=32 ;;
13851                         *)              dflt=1  ;;
13852                         esac
13853                         . ./myread
13854                         val=$ans
13855                         selectminbits="$val"
13856                 fi
13857                 $rm -f try.* try
13858                 ;;
13859         *)      : no select, so pick a harmless default
13860                 selectminbits='32'
13861                 ;;
13862         esac
13863         ;;
13864 esac
13865
13866 : Trace out the files included by signal.h, then look for SIGxxx names.
13867 : Remove SIGARRAYSIZE used by HPUX.
13868 : Remove SIGSTKSIZE used by Linux.
13869 : Remove SIGSTKSZ used by Posix.
13870 : Remove SIGTYP void lines used by OS2.
13871 : Some cpps, like os390, dont give the file name anywhere
13872 if [ "X$fieldn" = X ]; then
13873         : Just make some guesses.  We check them later.
13874         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
13875 else
13876         xxx=`echo '#include <signal.h>' |
13877         $cppstdin $cppminus $cppflags 2>/dev/null |
13878         $grep '^[       ]*#.*include' | 
13879         $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sort | $uniq`
13880 fi
13881 : Check this list of files to be sure we have parsed the cpp output ok.
13882 : This will also avoid potentially non-existent files, such 
13883 : as ../foo/bar.h
13884 xxxfiles=''
13885 for xx in $xxx /dev/null ; do
13886         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
13887 done
13888 : If we have found no files, at least try signal.h
13889 case "$xxxfiles" in
13890 '')     xxxfiles=`./findhdr signal.h` ;;
13891 esac
13892 xxx=`awk '
13893 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
13894         print substr($2, 4, 20)
13895 }
13896 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
13897         print substr($3, 4, 20)
13898 }' $xxxfiles`
13899 : Append some common names just in case the awk scan failed.
13900 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
13901 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
13902 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
13903 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
13904 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
13905
13906 : generate a few handy files for later
13907 $cat > signal.c <<'EOCP'
13908 #include <sys/types.h>
13909 #include <signal.h>
13910 #include <stdio.h>
13911 int main() {
13912
13913 /* Strange style to avoid deeply-nested #if/#else/#endif */
13914 #ifndef NSIG
13915 #  ifdef _NSIG
13916 #    define NSIG (_NSIG)
13917 #  endif
13918 #endif
13919
13920 #ifndef NSIG
13921 #  ifdef SIGMAX
13922 #    define NSIG (SIGMAX+1)
13923 #  endif
13924 #endif
13925
13926 #ifndef NSIG
13927 #  ifdef SIG_MAX
13928 #    define NSIG (SIG_MAX+1)
13929 #  endif
13930 #endif
13931
13932 #ifndef NSIG
13933 #  ifdef MAXSIG
13934 #    define NSIG (MAXSIG+1)
13935 #  endif
13936 #endif
13937
13938 #ifndef NSIG
13939 #  ifdef MAX_SIG
13940 #    define NSIG (MAX_SIG+1)
13941 #  endif
13942 #endif
13943
13944 #ifndef NSIG
13945 #  ifdef SIGARRAYSIZE
13946 #    define NSIG (SIGARRAYSIZE+1) /* Not sure of the +1 */
13947 #  endif
13948 #endif
13949
13950 #ifndef NSIG
13951 #  ifdef _sys_nsig
13952 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
13953 #  endif
13954 #endif
13955
13956 /* Default to some arbitrary number that's big enough to get most
13957    of the common signals.
13958 */
13959 #ifndef NSIG
13960 #    define NSIG 50
13961 #endif
13962
13963 printf("NSIG %d\n", NSIG);
13964
13965 #ifndef JUST_NSIG
13966
13967 EOCP
13968
13969 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
13970 {
13971         printf "#ifdef SIG"; printf $1; printf "\n"
13972         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
13973         printf $1; printf ");\n"
13974         printf "#endif\n"
13975 }
13976 END {
13977         printf "#endif /* JUST_NSIG */\n";
13978         printf "exit(0);\n}\n";
13979 }
13980 ' >>signal.c
13981 $cat >signal.awk <<'EOP'
13982 BEGIN { ndups = 0 }
13983 $1 ~ /^NSIG$/ { nsig = $2 }
13984 ($1 !~ /^NSIG$/) && (NF == 2) {
13985     if ($2 > maxsig) { maxsig = $2 }
13986     if (sig_name[$2]) {
13987         dup_name[ndups] = $1
13988         dup_num[ndups] = $2
13989         ndups++ 
13990     }
13991     else {
13992         sig_name[$2] = $1
13993         sig_num[$2] = $2
13994     }
13995 }
13996 END { 
13997     if (nsig == 0) {
13998         nsig = maxsig + 1
13999     }
14000     printf("NSIG %d\n", nsig);
14001     for (n = 1; n < nsig; n++) {
14002         if (sig_name[n]) {
14003             printf("%s %d\n", sig_name[n], sig_num[n])
14004         }
14005         else {
14006             printf("NUM%d %d\n", n, n) 
14007         }
14008     }
14009     for (n = 0; n < ndups; n++) {
14010         printf("%s %d\n", dup_name[n], dup_num[n])
14011     }
14012 }
14013 EOP
14014 $cat >signal_cmd <<EOS
14015 $startsh
14016 if $test -s signal.lst; then
14017     echo "Using your existing signal.lst file"
14018         exit 0
14019 fi
14020 xxx="$xxx"
14021 EOS
14022 $cat >>signal_cmd <<'EOS'
14023
14024 set signal
14025 if eval $compile_ok; then
14026         ./signal$_exe | $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
14027 else
14028         echo "(I can't seem be able to compile the whole test program)" >&4
14029         echo "(I'll try it in little pieces.)" >&4
14030         set signal -DJUST_NSIG
14031         if eval $compile_ok; then
14032                 ./signal$_exe > signal.nsg
14033                 $cat signal.nsg
14034         else
14035                 echo "I can't seem to figure out how many signals you have." >&4
14036                 echo "Guessing 50." >&4
14037                 echo 'NSIG 50' > signal.nsg
14038         fi
14039         : Now look at all the signal names, one at a time.
14040         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
14041                 $cat > signal.c <<EOCP
14042 #include <sys/types.h>
14043 #include <signal.h>
14044 #include <stdio.h>
14045 int main() {
14046 printf("$xx %d\n", SIG${xx});
14047 return 0;
14048 }
14049 EOCP
14050                 set signal
14051                 if eval $compile; then
14052                         echo "SIG${xx} found."
14053                         ./signal$_exe  >> signal.ls1
14054                 else
14055                         echo "SIG${xx} NOT found."
14056                 fi
14057         done
14058         if $test -s signal.ls1; then
14059                 $cat signal.nsg signal.ls1 |
14060                         $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
14061         fi
14062
14063 fi
14064 if $test -s signal.lst; then
14065         :
14066 else
14067         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
14068         echo 'kill -l' >signal
14069         set X `csh -f <signal`
14070         $rm -f signal
14071         shift
14072         case $# in
14073         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
14074         esac
14075         echo $@ | $tr ' ' $trnl | \
14076             $awk '{ printf "%s %d\n", $1, ++s; }
14077                   END { printf "NSIG %d\n", ++s }' >signal.lst
14078 fi
14079 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
14080 EOS
14081 chmod a+x signal_cmd
14082 $eunicefix signal_cmd
14083
14084 : generate list of signal names
14085 echo " "
14086 case "$sig_name_init" in
14087 '') doinit=yes ;;
14088 *)  case "$sig_num_init" in
14089     ''|*,*) doinit=yes ;;
14090     esac ;;
14091 esac
14092 case "$doinit" in
14093 yes)
14094         echo "Generating a list of signal names and numbers..." >&4
14095         . ./signal_cmd
14096         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
14097         sig_name=`$awk 'BEGIN { printf "ZERO " }
14098                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
14099         sig_num=`$awk  'BEGIN { printf "0 " }
14100                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
14101         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
14102                              !/^NSIG/   { printf "\"%s\", ", $1 }
14103                              END        { printf "0\n" }' signal.lst`
14104         sig_num_init=`$awk  'BEGIN      { printf "0, " }
14105                              !/^NSIG/   { printf "%d, ", $2}
14106                              END        { printf "0\n"}' signal.lst`
14107         ;;
14108 esac
14109 echo "The following $sig_count signals are available:"
14110 echo " "
14111 echo $sig_name | $awk \
14112 'BEGIN { linelen = 0 }
14113 {
14114         for (i = 1; i <= NF; i++) {
14115                 name = "SIG" $i " "
14116                 linelen = linelen + length(name)
14117                 if (linelen > 70) {
14118                         printf "\n"
14119                         linelen = length(name)
14120                 }
14121                 printf "%s", name
14122         }
14123         printf "\n"
14124 }'
14125 $rm -f signal signal.c signal.awk signal.lst signal_cmd 
14126
14127 echo " "
14128 case "$sizetype" in
14129 *_t) zzz="$sizetype"    ;;
14130 *)   zzz="filesize"     ;;
14131 esac
14132 echo "Checking the size of $zzz..." >&4 
14133 cat > try.c <<EOCP
14134 #include <sys/types.h>
14135 #include <stdio.h>
14136 int main() {
14137     printf("%d\n", (int)sizeof($sizetype));
14138     exit(0);
14139 }
14140 EOCP
14141 set try
14142 if eval $compile_ok; then
14143         yyy=`./try`
14144         case "$yyy" in
14145         '')     sizesize=4
14146                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
14147                 ;;
14148         *)      sizesize=$yyy
14149                 echo "Your $zzz size is $sizesize bytes."
14150                 ;;
14151         esac
14152 else
14153         sizesize=4
14154         echo "(I can't compile the test program--guessing $sizesize.)" >&4
14155 fi
14156
14157
14158 : check for socklen_t
14159 echo " "
14160 echo "Checking to see if you have socklen_t..." >&4
14161 $cat >try.c <<EOCP
14162 #include <sys/types.h>
14163 #$d_socket HAS_SOCKET
14164 #ifdef HAS_SOCKET
14165 #include <sys/socket.h>
14166 #endif
14167 int main() { socklen_t x = 16; }
14168 EOCP
14169 set try
14170 if eval $compile; then
14171         val="$define"
14172         echo "You have socklen_t."
14173 else
14174         val="$undef"
14175         echo "You do not have socklen_t."
14176         case "$sizetype" in
14177         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
14178         esac
14179 fi
14180 $rm -f try try.*
14181 set d_socklen_t
14182 eval $setvar
14183
14184 : check for type of the size argument to socket calls
14185 case "$d_socket" in
14186 "$define")
14187         $cat <<EOM
14188
14189 Checking to see what type is the last argument of accept().
14190 EOM
14191         hdrs="$define sys/types.h $d_socket sys/socket.h" 
14192         yyy=''
14193         case "$d_socklen_t" in
14194         "$define") yyy="$yyy socklen_t"
14195         esac
14196         yyy="$yyy $sizetype int long unsigned"
14197         for xxx in $yyy; do
14198                 case "$socksizetype" in
14199                 '')     try="extern int accept(int, struct sockaddr *, $xxx *);"
14200                         if ./protochk "$try" $hdrs; then
14201                                 echo "Your system accepts '$xxx *' for the last argument of accept()."
14202                                 socksizetype="$xxx"
14203                         fi
14204                         ;;
14205                 esac
14206         done
14207 : In case none of those worked, prompt the user.
14208         case "$socksizetype" in
14209         '')     rp='What is the type for socket address structure sizes?'
14210                 dflt='int'
14211                 . ./myread
14212                 socksizetype=$ans
14213                 ;;
14214         esac
14215         ;;
14216 *)      : no sockets, so pick relatively harmless default
14217         socksizetype='int'
14218         ;;
14219 esac
14220
14221 : see what type is used for signed size_t
14222 set ssize_t ssizetype int stdio.h sys/types.h
14223 eval $typedef
14224 dflt="$ssizetype"
14225 $cat > ssize.c <<EOM
14226 #include <stdio.h>
14227 #include <sys/types.h>
14228 #define Size_t $sizetype
14229 #define SSize_t $dflt
14230 int main()
14231 {
14232         if (sizeof(Size_t) == sizeof(SSize_t))
14233                 printf("$dflt\n");
14234         else if (sizeof(Size_t) == sizeof(int))
14235                 printf("int\n");
14236         else 
14237                 printf("long\n");
14238         exit(0);
14239 }
14240 EOM
14241 echo " "
14242 set ssize
14243 if eval $compile_ok && ./ssize > /dev/null; then
14244         ssizetype=`./ssize`
14245         echo "I'll be using $ssizetype for functions returning a byte count." >&4
14246 else
14247         $cat >&4 <<EOM
14248 Help! I can't compile and run the ssize_t test program: please enlighten me!
14249 (This is probably a misconfiguration in your system or libraries, and
14250 you really ought to fix it.  Still, I'll try anyway.)
14251
14252 I need a type that is the same size as $sizetype, but is guaranteed to
14253 be signed.  Common values are ssize_t, int and long.
14254
14255 EOM
14256         rp="What signed type is the same size as $sizetype?"
14257         . ./myread
14258         ssizetype="$ans"
14259 fi
14260 $rm -f ssize ssize.*
14261
14262 : see what type of char stdio uses.
14263 echo " "
14264 if $contains 'unsigned.*char.*_ptr;' `./findhdr stdio.h` >/dev/null 2>&1 ; then
14265         echo "Your stdio uses unsigned chars." >&4
14266         stdchar="unsigned char"
14267 else
14268         echo "Your stdio uses signed chars." >&4
14269         stdchar="char"
14270 fi
14271
14272 : see if time exists
14273 echo " "
14274 if test "X$d_time" = X -o X"$timetype" = X; then
14275     if set time val -f d_time; eval $csym; $val; then
14276                 echo 'time() found.' >&4
14277                 val="$define"
14278                 rp="What is the type returned by time() on this system?"
14279                 set time_t timetype long stdio.h sys/types.h
14280                 eval $typedef_ask
14281     else
14282                 echo 'time() not found, hope that will do.' >&4
14283                 val="$undef"
14284                 timetype='int';
14285     fi
14286     set d_time
14287     eval $setvar
14288 fi
14289
14290 : see what type uids are declared as in the kernel
14291 echo " "
14292 echo "Looking for the type for user ids returned by getuid()."
14293 set uid_t uidtype xxx stdio.h sys/types.h
14294 eval $typedef
14295 case "$uidtype" in
14296 xxx)
14297         xxx=`./findhdr sys/user.h`
14298         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
14299         case $1 in
14300         unsigned) dflt="$1 $2" ;;
14301         *) dflt="$1" ;;
14302         esac
14303         ;;
14304 *) dflt="$uidtype";;
14305 esac
14306 case "$uidtype" in
14307 uid_t)  echo "uid_t found." ;;
14308 *)      rp="What is the type for user ids returned by getuid()?"
14309         . ./myread
14310         uidtype="$ans"
14311         ;;
14312 esac
14313
14314 echo " "
14315 case "$uidtype" in
14316 *_t) zzz="$uidtype"     ;;
14317 *)   zzz="uid"          ;;
14318 esac
14319 echo "Checking the size of $zzz..." >&4 
14320 cat > try.c <<EOCP
14321 #include <sys/types.h>
14322 #include <stdio.h>
14323 int main() {
14324     printf("%d\n", (int)sizeof($uidtype));
14325     exit(0);
14326 }
14327 EOCP
14328 set try
14329 if eval $compile_ok; then
14330         yyy=`./try`
14331         case "$yyy" in
14332         '')     uidsize=4
14333                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
14334                 ;;
14335         *)      uidsize=$yyy
14336                 echo "Your $zzz is $uidsize bytes long."
14337                 ;;
14338         esac
14339 else
14340         uidsize=4
14341         echo "(I can't compile the test program--guessing $uidsize.)" >&4
14342 fi
14343
14344 echo " "
14345 case "$uidtype" in
14346 *_t) zzz="$uidtype"     ;;
14347 *)   zzz="uid"          ;;
14348 esac
14349 echo "Checking the sign of $zzz..." >&4
14350 cat > try.c <<EOCP
14351 #include <sys/types.h>
14352 #include <stdio.h>
14353 int main() {
14354         $uidtype foo = -1;
14355         if (foo < 0)
14356                 printf("-1\n");
14357         else
14358                 printf("1\n");
14359 }
14360 EOCP
14361 set try
14362 if eval $compile; then
14363         yyy=`./try`
14364         case "$yyy" in
14365         '')     uidsign=1
14366                 echo "(I can't execute the test program--guessing unsigned.)" >&4
14367                 ;;
14368         *)      uidsign=$yyy
14369                 case "$uidsign" in
14370                  1) echo "Your $zzz is unsigned." ;;
14371                 -1) echo "Your $zzz is signed."   ;;
14372                 esac
14373                 ;;
14374         esac
14375 else
14376         uidsign=1
14377         echo "(I can't compile the test program--guessing unsigned.)" >&4
14378 fi
14379
14380
14381
14382 echo " "
14383 $echo "Checking the format string to be used for uids..." >&4
14384
14385 case "$uidsign" in
14386 -1)     if $test X"$uidsize" = X"$ivsize"; then
14387                 uidformat="$ivdformat"
14388         else
14389                 if $test X"$uidsize" = X"$longsize"; then
14390                         uidformat='"ld"'
14391                 else
14392                         if $test X"$uidsize" = X"$intsize"; then
14393                                 uidformat='"d"'
14394                         else
14395                                 if $test X"$uidsize" = X"$shortsize"; then
14396                                         uidformat='"hd"'
14397                                 fi
14398                         fi
14399                 fi
14400         fi
14401         ;;
14402 *)      if $test X"$uidsize" = X"$uvsize"; then
14403                 uidformat="$uvuformat"
14404         else
14405                 if $test X"$uidsize" = X"$longsize"; then
14406                         uidformat='"lu"'
14407                 else
14408                         if $test X"$uidsize" = X"$intsize"; then
14409                                 uidformat='"u"'
14410                         else
14411                                 if $test X"$uidsize" = X"$shortsize"; then
14412                                         uidformat='"hu"'
14413                                 fi
14414                         fi
14415                 fi
14416         fi
14417         ;;
14418 esac
14419
14420 : see if dbm.h is available
14421 : see if dbmclose exists
14422 set dbmclose d_dbmclose
14423 eval $inlibc
14424
14425 case "$d_dbmclose" in
14426 $define)
14427         set dbm.h i_dbm
14428         eval $inhdr
14429         case "$i_dbm" in
14430         $define)
14431                 val="$undef"
14432                 set i_rpcsvcdbm
14433                 eval $setvar
14434                 ;;
14435         *)      set rpcsvc/dbm.h i_rpcsvcdbm
14436                 eval $inhdr
14437                 ;;
14438         esac
14439         ;;
14440 *)      echo "We won't be including <dbm.h>"
14441         val="$undef"
14442         set i_dbm
14443         eval $setvar
14444         val="$undef"
14445         set i_rpcsvcdbm
14446         eval $setvar
14447         ;;
14448 esac
14449
14450 : see if this is a sys/file.h system
14451 val=''
14452 set sys/file.h val
14453 eval $inhdr
14454
14455 : do we need to include sys/file.h ?
14456 case "$val" in
14457 "$define")
14458         echo " "
14459         if $h_sysfile; then
14460                 val="$define"
14461                 echo "We'll be including <sys/file.h>." >&4
14462         else
14463                 val="$undef"
14464                 echo "We won't be including <sys/file.h>." >&4
14465         fi
14466         ;;
14467 *)
14468         h_sysfile=false
14469         ;;
14470 esac
14471 set i_sysfile
14472 eval $setvar
14473
14474 : see if fcntl.h is there
14475 val=''
14476 set fcntl.h val
14477 eval $inhdr
14478
14479 : see if we can include fcntl.h
14480 case "$val" in
14481 "$define")
14482         echo " "
14483         if $h_fcntl; then
14484                 val="$define"
14485                 echo "We'll be including <fcntl.h>." >&4
14486         else
14487                 val="$undef"
14488                 if $h_sysfile; then
14489         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
14490                 else
14491                         echo "We won't be including <fcntl.h>." >&4
14492                 fi
14493         fi
14494         ;;
14495 *)
14496         h_fcntl=false
14497         val="$undef"
14498         ;;
14499 esac
14500 set i_fcntl
14501 eval $setvar
14502
14503 : see if this is a iconv.h system
14504 set iconv.h i_iconv
14505 eval $inhdr
14506
14507 : see if this is a ieeefp.h system
14508 set ieeefp.h i_ieeefp
14509 eval $inhdr
14510
14511 : see if this is a libutil.h system
14512 set libutil.h i_libutil
14513 eval $inhdr
14514
14515 : see if locale.h is available
14516 set locale.h i_locale
14517 eval $inhdr
14518
14519 : see if mach cthreads are available
14520 if test "X$usethreads" = "X$define"; then
14521         set mach/cthreads.h i_machcthr
14522         eval $inhdr
14523 else
14524         i_machcthr="$undef"
14525 fi
14526
14527
14528
14529 : see if this is a math.h system
14530 set math.h i_math
14531 eval $inhdr
14532
14533 : see if this is a mntent.h system
14534 set mntent.h i_mntent
14535 eval $inhdr
14536
14537 : see if ndbm.h is available
14538 set ndbm.h t_ndbm
14539 eval $inhdr
14540 case "$t_ndbm" in
14541 $define)
14542         : see if dbm_open exists
14543         set dbm_open d_dbm_open
14544         eval $inlibc
14545         case "$d_dbm_open" in
14546         $undef)
14547                 t_ndbm="$undef"
14548                 echo "We won't be including <ndbm.h>"
14549                 ;;
14550         esac
14551         ;;
14552 esac
14553 val="$t_ndbm"
14554 set i_ndbm
14555 eval $setvar
14556
14557 : see if net/errno.h is available
14558 val=''
14559 set net/errno.h val
14560 eval $inhdr
14561
14562 : Unfortunately, it causes problems on some systems.  Arrgh.
14563 case "$val" in
14564 $define)
14565         cat > try.c <<'EOM'
14566 #include <stdio.h>
14567 #include <errno.h>
14568 #include <net/errno.h>
14569 int func()
14570 {
14571         return ENOTSOCK;
14572 }
14573 EOM
14574         if $cc $ccflags -c try.c >/dev/null 2>&1; then
14575                 echo "We'll be including <net/errno.h>." >&4
14576         else
14577                 echo "We won't be including <net/errno.h>." >&4
14578                 val="$undef"
14579         fi
14580         $rm -f try.* try
14581         ;;
14582 esac
14583 set i_neterrno
14584 eval $setvar
14585
14586 : see if netinet/tcp.h is available
14587 set netinet/tcp.h i_netinettcp
14588 eval $inhdr
14589
14590 : see if this is a poll.h system
14591 set poll.h i_poll
14592 eval $inhdr
14593
14594 : see if this is a prot.h system
14595 set prot.h i_prot
14596 eval $inhdr
14597
14598 echo " "
14599 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4 
14600 $cat <<'EOSH' > Cppsym.know
14601 a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
14602 AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
14603 alliant alpha am29000 AM29000 amiga AMIGAOS AMIX
14604 ansi ANSI_C_SOURCE apollo ardent atarist att386 att3b BeOS
14605 BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
14606 BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
14607 bull c cadmus clipper CMU COFF COMPILER_VERSION
14608 concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
14609 CYGWIN DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
14610 Dynix DynixPTX ELF encore EPI EXTENSIONS FILE_OFFSET_BITS
14611 FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
14612 GNU_SOURCE GNUC GNUC_MINOR GO32 gould GOULD_PN
14613 H3050R H3050RX hbullx20 hcx host_mips
14614 hp200 hp300 hp700 HP700 hp800 hp9000
14615 hp9000s200 hp9000s300 hp9000s400 hp9000s500
14616 hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
14617 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
14618 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
14619 INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
14620 LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
14621 LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
14622 Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
14623 LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
14624 M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
14625 M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
14626 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
14627 MATH_HAS_NO_SIDE_EFFECTS
14628 mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
14629 mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
14630 mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
14631 MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
14632 mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
14633 NetBSD news1500 news1700 news1800 news1900 news3700
14634 news700 news800 news900 NeXT NLS ns16000 ns32000
14635 ns32016 ns32332 ns32k nsc32000
14636 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
14637 pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
14638 pc532 pdp11 PGC PIC plexus PORTAR posix
14639 POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
14640 POSIX_C_SOURCE POSIX_SOURCE POWER
14641 PROTOTYPES PWB pyr QNX R3000 REENTRANT RES Rhapsody RISC6000
14642 riscix riscos RT scs SCO sequent sgi SGI_SOURCE sinix
14643 SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
14644 sony sony_news sonyrisc sparc sparclite spectrum
14645 stardent stdc STDC_EXT stratos sun sun3 sun386
14646 Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
14647 SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
14648 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
14649 sysV68 sysV88 Tek4132 Tek4300 titan
14650 tower tower32 tower32_200 tower32_600 tower32_700
14651 tower32_800 tower32_850 tss
14652 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
14653 ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
14654 unix UNIX95 UNIX99 unixpc unos USGr4 USGr4_2
14655 Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms xenix Xenix286
14656 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
14657 XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
14658 z8000
14659 EOSH
14660 # Maybe put other stuff here too.
14661 cat <<EOSH >>Cppsym.know
14662 $osname
14663 EOSH
14664 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
14665 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
14666 $cat Cppsym.know > Cppsym.c
14667 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | sort | uniq > Cppsym.know
14668 $rm -f Cppsym.a Cppsym.b Cppsym.c
14669 cat <<EOSH > Cppsym
14670 $startsh
14671 if $test \$# -gt 0; then
14672     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
14673     if $test -s Cppsym.got; then
14674         $rm -f Cppsym.got
14675         exit 0
14676     fi
14677     $rm -f Cppsym.got
14678     exit 1
14679 else
14680     $tr " " "$trnl" | ./Cppsym.try
14681     exit 0
14682 fi
14683 EOSH
14684 chmod +x Cppsym
14685 $eunicefix Cppsym
14686 cat <<EOSH > Cppsym.try
14687 $startsh
14688 cat <<'EOCP' > try.c
14689 #include <stdio.h>
14690 int main() {
14691 EOCP
14692 $awk \\
14693 EOSH
14694 cat <<'EOSH' >> Cppsym.try
14695 'length($1) > 0 {
14696     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
14697     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
14698     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
14699     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
14700 }'       >> try.c
14701 echo '}' >> try.c
14702 EOSH
14703 cat <<EOSH >> Cppsym.try
14704 ccflags="$ccflags"
14705 case "$osname-$gccversion" in
14706 irix-) ccflags="\$ccflags -woff 1178" ;;
14707 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
14708 esac
14709 $cc $optimize \$ccflags $ldflags -o try try.c $libs && ./try$exe_ext
14710 EOSH
14711 chmod +x Cppsym.try
14712 $eunicefix Cppsym.try
14713 ./Cppsym < Cppsym.know > Cppsym.true
14714 : now check the C compiler for additional symbols
14715 postprocess_cc_v=''
14716 case "$osname" in
14717 aix) postprocess_cc_v="|$tr , ' '" ;;
14718 esac
14719 $cat >ccsym <<EOS
14720 $startsh
14721 $cat >tmp.c <<EOF
14722 extern int foo;
14723 EOF
14724 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
14725 do
14726         case "\$i" in
14727         -D*) echo "\$i" | $sed 's/^-D//';;
14728         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A\(.*\)(\(.*\))/\1=\2/';;
14729         esac
14730 done
14731 $rm -f try.c
14732 EOS
14733 postprocess_cc_v=''
14734 chmod +x ccsym
14735 $eunicefix ccsym
14736 ./ccsym > ccsym1.raw
14737 if $test -s ccsym1.raw; then
14738        $sort ccsym1.raw | $uniq >ccsym.raw
14739 else
14740        mv ccsym1.raw ccsym.raw
14741 fi
14742
14743 $awk '/\=/ { print $0; next }
14744         { print $0"=1" }' ccsym.raw >ccsym.list
14745 $awk '/\=/ { print $0; next }
14746         { print $0"=1" }' Cppsym.true >ccsym.true
14747 $comm -13 ccsym.true ccsym.list >ccsym.own
14748 $comm -12 ccsym.true ccsym.list >ccsym.com
14749 $comm -23 ccsym.true ccsym.list >ccsym.cpp
14750 also=''
14751 if $test -z ccsym.raw; then
14752         echo "Your C compiler doesn't seem to define any symbols!" >&4
14753         echo " "
14754         echo "However, your C preprocessor defines the following symbols:"
14755         $cat Cppsym.true
14756         ccsymbols=''
14757         cppsymbols=`$cat Cppsym.true`
14758         cppsymbols=`echo $cppsymbols`
14759         cppccsymbols="$cppsymbols"
14760 else
14761         if $test -s ccsym.com; then
14762                 echo "Your C compiler and pre-processor define these symbols:"
14763                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
14764                 also='also '
14765                 symbols='ones'
14766                 cppccsymbols=`$cat ccsym.com`
14767                 cppccsymbols=`echo $cppccsymbols`
14768                 $test "$silent" || sleep 1
14769         fi
14770         if $test -s ccsym.cpp; then
14771                 $test "$also" && echo " "
14772                 echo "Your C pre-processor ${also}defines the following symbols:"
14773                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
14774                 also='further '
14775                 cppsymbols=`$cat ccsym.cpp`
14776                 cppsymbols=`echo $cppsymbols`
14777                 $test "$silent" || sleep 1
14778         fi
14779         if $test -s ccsym.own; then
14780                 $test "$also" && echo " "
14781                 echo "Your C compiler ${also}defines the following cpp symbols:"
14782                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
14783                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
14784                 ccsymbols=`$cat ccsym.own`
14785                 ccsymbols=`echo $ccsymbols`
14786                 $test "$silent" || sleep 1
14787         fi
14788 fi
14789 $rm -f ccsym* Cppsym.*
14790
14791 : see if this is a termio system
14792 val="$undef"
14793 val2="$undef"
14794 val3="$undef"
14795 if $test `./findhdr termios.h`; then
14796         set tcsetattr i_termios
14797         eval $inlibc
14798         val3="$i_termios"
14799 fi
14800 echo " "
14801 case "$val3" in
14802 "$define") echo "You have POSIX termios.h... good!" >&4;;
14803 *) if ./Cppsym pyr; then
14804                 case "`/bin/universe`" in
14805                 ucb) if $test `./findhdr sgtty.h`; then
14806                                 val2="$define"
14807                                 echo "<sgtty.h> found." >&4
14808                         else
14809                                 echo "System is pyramid with BSD universe."
14810                                 echo "<sgtty.h> not found--you could have problems." >&4
14811                         fi;;
14812                 *) if $test `./findhdr termio.h`; then
14813                                 val="$define"
14814                                 echo "<termio.h> found." >&4
14815                         else
14816                                 echo "System is pyramid with USG universe."
14817                                 echo "<termio.h> not found--you could have problems." >&4
14818                         fi;;
14819                 esac
14820         elif ./usg; then
14821                 if $test `./findhdr termio.h`; then
14822                         echo "<termio.h> found." >&4
14823                         val="$define"
14824                 elif $test `./findhdr sgtty.h`; then
14825                         echo "<sgtty.h> found." >&4
14826                         val2="$define"
14827                 else
14828 echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
14829                 fi
14830         else
14831                 if $test `./findhdr sgtty.h`; then
14832                         echo "<sgtty.h> found." >&4
14833                         val2="$define"
14834                 elif $test `./findhdr termio.h`; then
14835                         echo "<termio.h> found." >&4
14836                         val="$define"
14837                 else
14838 echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
14839                 fi
14840         fi;;
14841 esac
14842 set i_termio; eval $setvar
14843 val=$val2; set i_sgtty; eval $setvar
14844 val=$val3; set i_termios; eval $setvar
14845
14846 : see if this is a shadow.h system
14847 set shadow.h i_shadow
14848 eval $inhdr
14849
14850 : see if this is a socks.h system
14851 set socks.h i_socks
14852 eval $inhdr
14853
14854 : see if stdarg is available
14855 echo " "
14856 if $test `./findhdr stdarg.h`; then
14857         echo "<stdarg.h> found." >&4
14858         valstd="$define"
14859 else
14860         echo "<stdarg.h> NOT found." >&4
14861         valstd="$undef"
14862 fi
14863
14864 : see if varags is available
14865 echo " "
14866 if $test `./findhdr varargs.h`; then
14867         echo "<varargs.h> found." >&4
14868 else
14869         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
14870 fi
14871
14872 : set up the varargs testing programs
14873 $cat > varargs.c <<EOP
14874 #ifdef I_STDARG
14875 #include <stdarg.h>
14876 #endif
14877 #ifdef I_VARARGS
14878 #include <varargs.h>
14879 #endif
14880
14881 #ifdef I_STDARG
14882 int f(char *p, ...)
14883 #else
14884 int f(va_alist)
14885 va_dcl
14886 #endif
14887 {
14888         va_list ap;
14889 #ifndef I_STDARG
14890         char *p;
14891 #endif
14892 #ifdef I_STDARG
14893         va_start(ap,p);
14894 #else
14895         va_start(ap);
14896         p = va_arg(ap, char *);
14897 #endif
14898         va_end(ap);
14899 }
14900 EOP
14901 $cat > varargs <<EOP
14902 $startsh
14903 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
14904         echo "true"
14905 else
14906         echo "false"
14907 fi
14908 $rm -f varargs$_o
14909 EOP
14910 chmod +x varargs
14911
14912 : now check which varargs header should be included
14913 echo " "
14914 i_varhdr=''
14915 case "$valstd" in
14916 "$define")
14917         if `./varargs I_STDARG`; then
14918                 val='stdarg.h'
14919         elif `./varargs I_VARARGS`; then
14920                 val='varargs.h'
14921         fi
14922         ;;
14923 *)
14924         if `./varargs I_VARARGS`; then
14925                 val='varargs.h'
14926         fi
14927         ;;
14928 esac
14929 case "$val" in
14930 '')
14931 echo "I could not find the definition for va_dcl... You have problems..." >&4
14932         val="$undef"; set i_stdarg; eval $setvar
14933         val="$undef"; set i_varargs; eval $setvar
14934         ;;
14935 *) 
14936         set i_varhdr
14937         eval $setvar
14938         case "$i_varhdr" in
14939         stdarg.h)
14940                 val="$define"; set i_stdarg; eval $setvar
14941                 val="$undef"; set i_varargs; eval $setvar
14942                 ;;
14943         varargs.h)
14944                 val="$undef"; set i_stdarg; eval $setvar
14945                 val="$define"; set i_varargs; eval $setvar
14946                 ;;
14947         esac
14948         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
14949 esac
14950 $rm -f varargs*
14951
14952 : see if stddef is available
14953 set stddef.h i_stddef
14954 eval $inhdr
14955
14956 : see if this is a sunmath.h system
14957 set sunmath.h i_sunmath
14958 eval $inhdr
14959
14960 : see if sys/access.h is available
14961 set sys/access.h i_sysaccess
14962 eval $inhdr
14963
14964 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
14965 set sys/filio.h i_sysfilio
14966 eval $inhdr
14967 echo " "
14968 if $test `./findhdr sys/ioctl.h`; then
14969         val="$define"
14970         echo '<sys/ioctl.h> found.' >&4
14971 else
14972         val="$undef"
14973         if $test $i_sysfilio = "$define"; then
14974             echo '<sys/ioctl.h> NOT found.' >&4
14975         else
14976                 $test $i_sgtty = "$define" && xxx="sgtty.h"
14977                 $test $i_termio = "$define" && xxx="termio.h"
14978                 $test $i_termios = "$define" && xxx="termios.h"
14979 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
14980         fi
14981 fi
14982 set i_sysioctl
14983 eval $setvar
14984
14985
14986 : see if this is a syslog.h system
14987 set syslog.h i_syslog
14988 eval $inhdr
14989
14990
14991 : see if this is a sys/mode.h system
14992 set sys/mode.h i_sysmode
14993 eval $inhdr
14994
14995 : see if sys/resource.h has to be included
14996 set sys/resource.h i_sysresrc
14997 eval $inhdr
14998
14999 : see if sys/security.h is available
15000 set sys/security.h i_syssecrt
15001 eval $inhdr
15002
15003 : see if this is a sys/statvfs.h system
15004 set sys/statvfs.h i_sysstatvfs
15005 eval $inhdr
15006
15007 : see if this is a sys/uio.h system
15008 set sys/uio.h i_sysuio
15009 eval $inhdr
15010
15011 : see if this is a sys/un.h system
15012 set sys/un.h i_sysun
15013 eval $inhdr
15014
15015
15016 : see if this is a sys/utsname.h system
15017 set sys/utsname.h i_sysutsname
15018 eval $inhdr
15019
15020 : see if this is a syswait system
15021 set sys/wait.h i_syswait
15022 eval $inhdr
15023
15024 : see if this is a ustat.h system
15025 set ustat.h i_ustat
15026 eval $inhdr
15027
15028 : see if this is an utime system
15029 set utime.h i_utime
15030 eval $inhdr
15031
15032 : see if this is a values.h system
15033 set values.h i_values
15034 eval $inhdr
15035
15036 : see if this is a vfork system
15037 case "$d_vfork" in
15038 "$define")
15039         set vfork.h i_vfork
15040         eval $inhdr
15041         ;;
15042 *)
15043         i_vfork="$undef"
15044         ;;
15045 esac
15046
15047 : see if gdbm.h is available
15048 set gdbm.h t_gdbm
15049 eval $inhdr
15050 case "$t_gdbm" in
15051 $define)
15052         : see if gdbm_open exists
15053         set gdbm_open d_gdbm_open
15054         eval $inlibc
15055         case "$d_gdbm_open" in
15056         $undef)
15057                 t_gdbm="$undef"
15058                 echo "We won't be including <gdbm.h>"
15059                 ;;
15060         esac
15061         ;;
15062 esac
15063 val="$t_gdbm"
15064 set i_gdbm
15065 eval $setvar
15066
15067 echo " "
15068 echo "Looking for extensions..." >&4
15069 : If we are using the old config.sh, known_extensions may contain
15070 : old or inaccurate or duplicate values.
15071 known_extensions=''
15072 nonxs_extensions=''
15073 : We do not use find because it might not be available.
15074 : We do not just use MANIFEST because the user may have dropped
15075 : some additional extensions into the source tree and expect them
15076 : to be built.
15077
15078 : Function to recursively find available extensions, ignoring DynaLoader
15079 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
15080 find_extensions='
15081     for xxx in *; do
15082        case "$xxx" in
15083            DynaLoader|dynaload) ;;
15084            *)
15085            if $test -f $xxx/$xxx.xs; then
15086                known_extensions="$known_extensions $1$xxx";
15087            elif $test -f $xxx/Makefile.PL; then
15088                nonxs_extensions="$nonxs_extensions $1$xxx";
15089            else
15090                if $test -d $xxx -a $# -lt 10; then
15091                    set $1$xxx/ $*;
15092                    cd $xxx;
15093                    eval $find_extensions;
15094                    cd ..;
15095                    shift;
15096                fi;
15097            fi
15098            ;;
15099        esac;
15100     done'
15101 tdir=`pwd`
15102 cd $rsrc/ext
15103 set X
15104 shift
15105 eval $find_extensions
15106 set X $nonxs_extensions
15107 shift
15108 nonxs_extensions="$*"
15109 set X $known_extensions
15110 shift
15111 known_extensions="$*"
15112 cd $tdir
15113
15114 : Now see which are supported on this system.
15115 avail_ext=''
15116 for xxx in $known_extensions ; do
15117         case "$xxx" in
15118         DB_File|db_file)
15119                 case "$i_db" in
15120                 $define) avail_ext="$avail_ext $xxx" ;;
15121                 esac
15122                 ;;
15123         GDBM_File|gdbm_fil)
15124                 case "$i_gdbm" in 
15125                 $define) avail_ext="$avail_ext $xxx" ;;
15126                 esac
15127                 ;;
15128         NDBM_File|ndbm_fil)
15129                 case "$i_ndbm" in
15130                 $define)
15131                     case "$osname-$use64bitint" in
15132                     hpux-define)
15133                         case "$libs" in
15134                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
15135                         esac
15136                         ;;
15137                     *) avail_ext="$avail_ext $xxx" ;;
15138                     esac
15139                     ;;
15140                 esac
15141                 ;;
15142         ODBM_File|odbm_fil) 
15143                 case "${i_dbm}${i_rpcsvcdbm}" in
15144                 *"${define}"*)
15145                     case "$osname-$use64bitint" in
15146                     hpux-define)
15147                         case "$libs" in
15148                         *-ldbm*) avail_ext="$avail_ext $xxx" ;;
15149                         esac
15150                         ;;
15151                     *) avail_ext="$avail_ext $xxx" ;;
15152                     esac
15153                     ;;
15154                 esac
15155                 ;;
15156         POSIX|posix)
15157                 case "$useposix" in
15158                 true|define|y) avail_ext="$avail_ext $xxx" ;;
15159                 esac
15160                 ;;
15161         Opcode|opcode)
15162                 case "$useopcode" in
15163                 true|define|y) avail_ext="$avail_ext $xxx" ;;
15164                 esac
15165                 ;;
15166         Socket|socket)
15167                 case "$d_socket" in 
15168                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
15169                 esac
15170                 ;;
15171         Sys/Syslog|sys/syslog)
15172                 : XXX syslog requires socket
15173                 case "$d_socket" in 
15174                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
15175                 esac
15176                 ;;
15177         Thread|thread)
15178                 case "$usethreads" in 
15179                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
15180                 esac
15181                 ;;
15182         IPC/SysV|ipc/sysv)
15183                 : XXX Do we need a useipcsysv variable here
15184                 case "${d_msg}${d_sem}${d_shm}" in 
15185                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
15186                 esac
15187                 ;;
15188         *)      avail_ext="$avail_ext $xxx"
15189                 ;;
15190         esac
15191 done
15192
15193 set X $avail_ext
15194 shift
15195 avail_ext="$*"
15196
15197 : Now see which nonxs extensions are supported on this system.
15198 : For now assume all are.
15199 nonxs_ext=''
15200 for xxx in $nonxs_extensions ; do
15201         case "$xxx" in
15202         *)      nonxs_ext="$nonxs_ext $xxx"
15203                 ;;
15204         esac
15205 done
15206
15207 set X $nonxs_ext
15208 shift
15209 nonxs_ext="$*"
15210
15211 case $usedl in
15212 $define)
15213         $cat <<EOM
15214 A number of extensions are supplied with $package.  You may choose to
15215 compile these extensions for dynamic loading (the default), compile
15216 them into the $package executable (static loading), or not include
15217 them at all.  Answer "none" to include no extensions.
15218 Note that DynaLoader is always built and need not be mentioned here.
15219
15220 EOM
15221         case "$dynamic_ext" in
15222         '') dflt="$avail_ext" ;;
15223         *)      dflt="$dynamic_ext"
15224                 # Perhaps we are reusing an old out-of-date config.sh.
15225                 case "$hint" in
15226                 previous)
15227                         if test X"$dynamic_ext" != X"$avail_ext"; then
15228                                 $cat <<EOM
15229 NOTICE:  Your previous config.sh list may be incorrect. 
15230 The extensions now available to you are 
15231         ${avail_ext}
15232 but the default list from your previous config.sh is
15233         ${dynamic_ext} 
15234
15235 EOM
15236                         fi
15237                         ;;
15238                 esac
15239                 ;;
15240         esac
15241         case "$dflt" in
15242         '')     dflt=none;;
15243         esac
15244         rp="What extensions do you wish to load dynamically?"
15245         . ./myread
15246         case "$ans" in
15247         none) dynamic_ext=' ' ;;
15248         *) dynamic_ext="$ans" ;;
15249         esac
15250
15251         case "$static_ext" in
15252         '')
15253                 : Exclude those already listed in dynamic linking
15254                 dflt=''
15255                 for xxx in $avail_ext; do
15256                         case " $dynamic_ext " in
15257                         *" $xxx "*) ;;
15258                         *) dflt="$dflt $xxx" ;;
15259                         esac
15260                 done
15261                 set X $dflt
15262                 shift
15263                 dflt="$*"
15264                 ;;
15265         *)  dflt="$static_ext" 
15266                 ;;
15267         esac
15268
15269         case "$dflt" in
15270         '')     dflt=none;;
15271         esac
15272         rp="What extensions do you wish to load statically?"
15273         . ./myread
15274         case "$ans" in
15275         none) static_ext=' ' ;;
15276         *) static_ext="$ans" ;;
15277         esac
15278         ;;
15279 *)
15280         $cat <<EOM
15281 A number of extensions are supplied with $package.  Answer "none" 
15282 to include no extensions. 
15283 Note that DynaLoader is always built and need not be mentioned here.
15284
15285 EOM
15286         case "$static_ext" in
15287         '') dflt="$avail_ext" ;;
15288         *)      dflt="$static_ext"
15289                 # Perhaps we are reusing an old out-of-date config.sh.
15290                 case "$hint" in
15291                 previous)
15292                         if test X"$static_ext" != X"$avail_ext"; then
15293                                 $cat <<EOM
15294 NOTICE:  Your previous config.sh list may be incorrect. 
15295 The extensions now available to you are 
15296         ${avail_ext}
15297 but the default list from your previous config.sh is
15298         ${static_ext} 
15299
15300 EOM
15301                         fi
15302                         ;;
15303                 esac
15304                 ;;
15305         esac
15306         : Exclude those that are not xs extensions
15307         case "$dflt" in
15308         '')     dflt=none;;
15309         esac
15310         rp="What extensions do you wish to include?"
15311         . ./myread
15312         case "$ans" in
15313         none) static_ext=' ' ;;
15314         *) static_ext="$ans" ;;
15315         esac
15316         ;;
15317 esac
15318
15319 set X $dynamic_ext $static_ext $nonxs_ext
15320 shift
15321 extensions="$*"
15322
15323 : Remove build directory name from cppstdin so it can be used from
15324 : either the present location or the final installed location.
15325 echo " "
15326 : Get out of the UU directory to get correct path name.
15327 cd ..
15328 case "$cppstdin" in
15329 `pwd`/cppstdin)
15330         echo "Stripping down cppstdin path name"
15331         cppstdin=cppstdin
15332         ;;
15333 esac
15334 cd UU
15335
15336 : end of configuration questions
15337 echo " "
15338 echo "End of configuration questions."
15339 echo " "
15340
15341 : back to where it started
15342 if test -d ../UU; then
15343         cd ..
15344 fi
15345
15346 : configuration may be patched via a 'config.over' file
15347 if $test -f config.over; then
15348         echo " "
15349         dflt=y
15350         rp='I see a config.over file.  Do you wish to load it?'
15351         . UU/myread
15352         case "$ans" in
15353         n*) echo "OK, I'll ignore it.";;
15354         *)      . ./config.over
15355                 echo "Configuration override changes have been loaded."
15356                 ;;
15357         esac
15358 fi
15359
15360 : in case they want portability, strip down executable paths
15361 case "$d_portable" in
15362 "$define")
15363         echo " "
15364         echo "Stripping down executable paths..." >&4
15365         for file in $loclist $trylist; do
15366                 eval temp=\$$file
15367                 eval $file=`basename $temp`
15368         done
15369         ;;
15370 esac
15371
15372 : create config.sh file
15373 echo " "
15374 echo "Creating config.sh..." >&4
15375 $spitshell <<EOT >config.sh
15376 $startsh
15377 #
15378 # This file was produced by running the Configure script. It holds all the
15379 # definitions figured out by Configure. Should you modify one of these values,
15380 # do not forget to propagate your changes by running "Configure -der". You may
15381 # instead choose to run each of the .SH files by yourself, or "Configure -S".
15382 #
15383
15384 # Package name      : $package
15385 # Source directory  : $src
15386 # Configuration time: $cf_time
15387 # Configured by     : $cf_by
15388 # Target system     : $myuname
15389
15390 Author='$Author'
15391 Date='$Date'
15392 Header='$Header'
15393 Id='$Id'
15394 Locker='$Locker'
15395 Log='$Log'
15396 Mcc='$Mcc'
15397 RCSfile='$RCSfile'
15398 Revision='$Revision'
15399 Source='$Source'
15400 State='$State'
15401 _a='$_a'
15402 _exe='$_exe'
15403 _o='$_o'
15404 afs='$afs'
15405 alignbytes='$alignbytes'
15406 ansi2knr='$ansi2knr'
15407 aphostname='$aphostname'
15408 api_revision='$api_revision'
15409 api_subversion='$api_subversion'
15410 api_version='$api_version'
15411 api_versionstring='$api_versionstring'
15412 ar='$ar'
15413 archlib='$archlib'
15414 archlibexp='$archlibexp'
15415 archname64='$archname64'
15416 archname='$archname'
15417 archobjs='$archobjs'
15418 awk='$awk'
15419 baserev='$baserev'
15420 bash='$bash'
15421 bin='$bin'
15422 bincompat5005='$bincompat5005'
15423 binexp='$binexp'
15424 bison='$bison'
15425 byacc='$byacc'
15426 byteorder='$byteorder'
15427 c='$c'
15428 castflags='$castflags'
15429 cat='$cat'
15430 cc='$cc'
15431 cccdlflags='$cccdlflags'
15432 ccdlflags='$ccdlflags'
15433 ccflags='$ccflags'
15434 ccflags_uselargefiles='$ccflags_uselargefiles'
15435 ccname='$ccname'
15436 ccsymbols='$ccsymbols'
15437 ccversion='$ccversion'
15438 cf_by='$cf_by'
15439 cf_email='$cf_email'
15440 cf_time='$cf_time'
15441 charsize='$charsize'
15442 chgrp='$chgrp'
15443 chmod='$chmod'
15444 chown='$chown'
15445 clocktype='$clocktype'
15446 comm='$comm'
15447 compress='$compress'
15448 contains='$contains'
15449 cp='$cp'
15450 cpio='$cpio'
15451 cpp='$cpp'
15452 cpp_stuff='$cpp_stuff'
15453 cppccsymbols='$cppccsymbols'
15454 cppflags='$cppflags'
15455 cpplast='$cpplast'
15456 cppminus='$cppminus'
15457 cpprun='$cpprun'
15458 cppstdin='$cppstdin'
15459 cppsymbols='$cppsymbols'
15460 crosscompile='$crosscompile'
15461 cryptlib='$cryptlib'
15462 csh='$csh'
15463 d_Gconvert='$d_Gconvert'
15464 d_PRIEUldbl='$d_PRIEUldbl'
15465 d_PRIFUldbl='$d_PRIFUldbl'
15466 d_PRIGUldbl='$d_PRIGUldbl'
15467 d_PRIXU64='$d_PRIXU64'
15468 d_PRId64='$d_PRId64'
15469 d_PRIeldbl='$d_PRIeldbl'
15470 d_PRIfldbl='$d_PRIfldbl'
15471 d_PRIgldbl='$d_PRIgldbl'
15472 d_PRIi64='$d_PRIi64'
15473 d_PRIo64='$d_PRIo64'
15474 d_PRIu64='$d_PRIu64'
15475 d_PRIx64='$d_PRIx64'
15476 d_SCNfldbl='$d_SCNfldbl'
15477 d_access='$d_access'
15478 d_accessx='$d_accessx'
15479 d_alarm='$d_alarm'
15480 d_archlib='$d_archlib'
15481 d_atolf='$d_atolf'
15482 d_atoll='$d_atoll'
15483 d_attribut='$d_attribut'
15484 d_bcmp='$d_bcmp'
15485 d_bcopy='$d_bcopy'
15486 d_bincompat5005='$d_bincompat5005'
15487 d_bsd='$d_bsd'
15488 d_bsdgetpgrp='$d_bsdgetpgrp'
15489 d_bsdsetpgrp='$d_bsdsetpgrp'
15490 d_bzero='$d_bzero'
15491 d_casti32='$d_casti32'
15492 d_castneg='$d_castneg'
15493 d_charvspr='$d_charvspr'
15494 d_chown='$d_chown'
15495 d_chroot='$d_chroot'
15496 d_chsize='$d_chsize'
15497 d_closedir='$d_closedir'
15498 d_const='$d_const'
15499 d_crypt='$d_crypt'
15500 d_csh='$d_csh'
15501 d_cuserid='$d_cuserid'
15502 d_dbl_dig='$d_dbl_dig'
15503 d_difftime='$d_difftime'
15504 d_dirnamlen='$d_dirnamlen'
15505 d_dlerror='$d_dlerror'
15506 d_dlopen='$d_dlopen'
15507 d_dlsymun='$d_dlsymun'
15508 d_dosuid='$d_dosuid'
15509 d_drand48proto='$d_drand48proto'
15510 d_dup2='$d_dup2'
15511 d_eaccess='$d_eaccess'
15512 d_endgrent='$d_endgrent'
15513 d_endhent='$d_endhent'
15514 d_endnent='$d_endnent'
15515 d_endpent='$d_endpent'
15516 d_endpwent='$d_endpwent'
15517 d_endsent='$d_endsent'
15518 d_eofnblk='$d_eofnblk'
15519 d_eunice='$d_eunice'
15520 d_fchmod='$d_fchmod'
15521 d_fchown='$d_fchown'
15522 d_fcntl='$d_fcntl'
15523 d_fd_macros='$d_fd_macros'
15524 d_fd_set='$d_fd_set'
15525 d_fds_bits='$d_fds_bits'
15526 d_fgetpos='$d_fgetpos'
15527 d_flexfnam='$d_flexfnam'
15528 d_flock='$d_flock'
15529 d_fork='$d_fork'
15530 d_fpathconf='$d_fpathconf'
15531 d_fpos64_t='$d_fpos64_t'
15532 d_frexpl='$d_frexpl'
15533 d_fs_data_s='$d_fs_data_s'
15534 d_fseeko='$d_fseeko'
15535 d_fsetpos='$d_fsetpos'
15536 d_fstatfs='$d_fstatfs'
15537 d_fstatvfs='$d_fstatvfs'
15538 d_ftello='$d_ftello'
15539 d_ftime='$d_ftime'
15540 d_getcwd='$d_getcwd'
15541 d_getespwnam='$d_getespwnam'
15542 d_getfsstat='$d_getfsstat'
15543 d_getgrent='$d_getgrent'
15544 d_getgrps='$d_getgrps'
15545 d_gethbyaddr='$d_gethbyaddr'
15546 d_gethbyname='$d_gethbyname'
15547 d_gethent='$d_gethent'
15548 d_gethname='$d_gethname'
15549 d_gethostprotos='$d_gethostprotos'
15550 d_getlogin='$d_getlogin'
15551 d_getmnt='$d_getmnt'
15552 d_getmntent='$d_getmntent'
15553 d_getnbyaddr='$d_getnbyaddr'
15554 d_getnbyname='$d_getnbyname'
15555 d_getnent='$d_getnent'
15556 d_getnetprotos='$d_getnetprotos'
15557 d_getpbyname='$d_getpbyname'
15558 d_getpbynumber='$d_getpbynumber'
15559 d_getpent='$d_getpent'
15560 d_getpgid='$d_getpgid'
15561 d_getpgrp2='$d_getpgrp2'
15562 d_getpgrp='$d_getpgrp'
15563 d_getppid='$d_getppid'
15564 d_getprior='$d_getprior'
15565 d_getprotoprotos='$d_getprotoprotos'
15566 d_getprpwnam='$d_getprpwnam'
15567 d_getpwent='$d_getpwent'
15568 d_getsbyname='$d_getsbyname'
15569 d_getsbyport='$d_getsbyport'
15570 d_getsent='$d_getsent'
15571 d_getservprotos='$d_getservprotos'
15572 d_getspnam='$d_getspnam'
15573 d_gettimeod='$d_gettimeod'
15574 d_gnulibc='$d_gnulibc'
15575 d_grpasswd='$d_grpasswd'
15576 d_hasmntopt='$d_hasmntopt'
15577 d_htonl='$d_htonl'
15578 d_iconv='$d_iconv'
15579 d_index='$d_index'
15580 d_inetaton='$d_inetaton'
15581 d_int64_t='$d_int64_t'
15582 d_isascii='$d_isascii'
15583 d_isnan='$d_isnan'
15584 d_isnanl='$d_isnanl'
15585 d_killpg='$d_killpg'
15586 d_lchown='$d_lchown'
15587 d_ldbl_dig='$d_ldbl_dig'
15588 d_link='$d_link'
15589 d_locconv='$d_locconv'
15590 d_lockf='$d_lockf'
15591 d_longdbl='$d_longdbl'
15592 d_longlong='$d_longlong'
15593 d_lseekproto='$d_lseekproto'
15594 d_lstat='$d_lstat'
15595 d_madvise='$d_madvise'
15596 d_mblen='$d_mblen'
15597 d_mbstowcs='$d_mbstowcs'
15598 d_mbtowc='$d_mbtowc'
15599 d_memchr='$d_memchr'
15600 d_memcmp='$d_memcmp'
15601 d_memcpy='$d_memcpy'
15602 d_memmove='$d_memmove'
15603 d_memset='$d_memset'
15604 d_mkdir='$d_mkdir'
15605 d_mkdtemp='$d_mkdtemp'
15606 d_mkfifo='$d_mkfifo'
15607 d_mkstemp='$d_mkstemp'
15608 d_mkstemps='$d_mkstemps'
15609 d_mktime='$d_mktime'
15610 d_mmap='$d_mmap'
15611 d_modfl='$d_modfl'
15612 d_mprotect='$d_mprotect'
15613 d_msg='$d_msg'
15614 d_msg_ctrunc='$d_msg_ctrunc'
15615 d_msg_dontroute='$d_msg_dontroute'
15616 d_msg_oob='$d_msg_oob'
15617 d_msg_peek='$d_msg_peek'
15618 d_msg_proxy='$d_msg_proxy'
15619 d_msgctl='$d_msgctl'
15620 d_msgget='$d_msgget'
15621 d_msgrcv='$d_msgrcv'
15622 d_msgsnd='$d_msgsnd'
15623 d_msync='$d_msync'
15624 d_munmap='$d_munmap'
15625 d_mymalloc='$d_mymalloc'
15626 d_nice='$d_nice'
15627 d_nv_preserves_uv='$d_nv_preserves_uv'
15628 d_nv_preserves_uv_bits='$d_nv_preserves_uv_bits'
15629 d_off64_t='$d_off64_t'
15630 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
15631 d_oldpthreads='$d_oldpthreads'
15632 d_oldsock='$d_oldsock'
15633 d_open3='$d_open3'
15634 d_pathconf='$d_pathconf'
15635 d_pause='$d_pause'
15636 d_perl_otherlibdirs='$d_perl_otherlibdirs'
15637 d_phostname='$d_phostname'
15638 d_pipe='$d_pipe'
15639 d_poll='$d_poll'
15640 d_portable='$d_portable'
15641 d_pthread_yield='$d_pthread_yield'
15642 d_pwage='$d_pwage'
15643 d_pwchange='$d_pwchange'
15644 d_pwclass='$d_pwclass'
15645 d_pwcomment='$d_pwcomment'
15646 d_pwexpire='$d_pwexpire'
15647 d_pwgecos='$d_pwgecos'
15648 d_pwpasswd='$d_pwpasswd'
15649 d_pwquota='$d_pwquota'
15650 d_qgcvt='$d_qgcvt'
15651 d_quad='$d_quad'
15652 d_readdir='$d_readdir'
15653 d_readlink='$d_readlink'
15654 d_rename='$d_rename'
15655 d_rewinddir='$d_rewinddir'
15656 d_rmdir='$d_rmdir'
15657 d_safebcpy='$d_safebcpy'
15658 d_safemcpy='$d_safemcpy'
15659 d_sanemcmp='$d_sanemcmp'
15660 d_sched_yield='$d_sched_yield'
15661 d_scm_rights='$d_scm_rights'
15662 d_seekdir='$d_seekdir'
15663 d_select='$d_select'
15664 d_sem='$d_sem'
15665 d_semctl='$d_semctl'
15666 d_semctl_semid_ds='$d_semctl_semid_ds'
15667 d_semctl_semun='$d_semctl_semun'
15668 d_semget='$d_semget'
15669 d_semop='$d_semop'
15670 d_setegid='$d_setegid'
15671 d_seteuid='$d_seteuid'
15672 d_setgrent='$d_setgrent'
15673 d_setgrps='$d_setgrps'
15674 d_sethent='$d_sethent'
15675 d_setlinebuf='$d_setlinebuf'
15676 d_setlocale='$d_setlocale'
15677 d_setnent='$d_setnent'
15678 d_setpent='$d_setpent'
15679 d_setpgid='$d_setpgid'
15680 d_setpgrp2='$d_setpgrp2'
15681 d_setpgrp='$d_setpgrp'
15682 d_setprior='$d_setprior'
15683 d_setproctitle='$d_setproctitle'
15684 d_setpwent='$d_setpwent'
15685 d_setregid='$d_setregid'
15686 d_setresgid='$d_setresgid'
15687 d_setresuid='$d_setresuid'
15688 d_setreuid='$d_setreuid'
15689 d_setrgid='$d_setrgid'
15690 d_setruid='$d_setruid'
15691 d_setsent='$d_setsent'
15692 d_setsid='$d_setsid'
15693 d_setvbuf='$d_setvbuf'
15694 d_sfio='$d_sfio'
15695 d_shm='$d_shm'
15696 d_shmat='$d_shmat'
15697 d_shmatprototype='$d_shmatprototype'
15698 d_shmctl='$d_shmctl'
15699 d_shmdt='$d_shmdt'
15700 d_shmget='$d_shmget'
15701 d_sigaction='$d_sigaction'
15702 d_sigsetjmp='$d_sigsetjmp'
15703 d_socket='$d_socket'
15704 d_socklen_t='$d_socklen_t'
15705 d_sockpair='$d_sockpair'
15706 d_socks5_init='$d_socks5_init'
15707 d_sqrtl='$d_sqrtl'
15708 d_statblks='$d_statblks'
15709 d_statfs_f_flags='$d_statfs_f_flags'
15710 d_statfs_s='$d_statfs_s'
15711 d_statvfs='$d_statvfs'
15712 d_stdio_cnt_lval='$d_stdio_cnt_lval'
15713 d_stdio_ptr_lval='$d_stdio_ptr_lval'
15714 d_stdio_stream_array='$d_stdio_stream_array'
15715 d_stdiobase='$d_stdiobase'
15716 d_stdstdio='$d_stdstdio'
15717 d_strchr='$d_strchr'
15718 d_strcoll='$d_strcoll'
15719 d_strctcpy='$d_strctcpy'
15720 d_strerrm='$d_strerrm'
15721 d_strerror='$d_strerror'
15722 d_strtod='$d_strtod'
15723 d_strtol='$d_strtol'
15724 d_strtold='$d_strtold'
15725 d_strtoll='$d_strtoll'
15726 d_strtoul='$d_strtoul'
15727 d_strtoull='$d_strtoull'
15728 d_strtouq='$d_strtouq'
15729 d_strxfrm='$d_strxfrm'
15730 d_suidsafe='$d_suidsafe'
15731 d_symlink='$d_symlink'
15732 d_syscall='$d_syscall'
15733 d_sysconf='$d_sysconf'
15734 d_sysernlst='$d_sysernlst'
15735 d_syserrlst='$d_syserrlst'
15736 d_system='$d_system'
15737 d_tcgetpgrp='$d_tcgetpgrp'
15738 d_tcsetpgrp='$d_tcsetpgrp'
15739 d_telldir='$d_telldir'
15740 d_telldirproto='$d_telldirproto'
15741 d_time='$d_time'
15742 d_times='$d_times'
15743 d_truncate='$d_truncate'
15744 d_tzname='$d_tzname'
15745 d_umask='$d_umask'
15746 d_uname='$d_uname'
15747 d_union_semun='$d_union_semun'
15748 d_ustat='$d_ustat'
15749 d_vendorarch='$d_vendorarch'
15750 d_vendorbin='$d_vendorbin'
15751 d_vendorlib='$d_vendorlib'
15752 d_vfork='$d_vfork'
15753 d_void_closedir='$d_void_closedir'
15754 d_voidsig='$d_voidsig'
15755 d_voidtty='$d_voidtty'
15756 d_volatile='$d_volatile'
15757 d_vprintf='$d_vprintf'
15758 d_wait4='$d_wait4'
15759 d_waitpid='$d_waitpid'
15760 d_wcstombs='$d_wcstombs'
15761 d_wctomb='$d_wctomb'
15762 d_xenix='$d_xenix'
15763 date='$date'
15764 db_hashtype='$db_hashtype'
15765 db_prefixtype='$db_prefixtype'
15766 defvoidused='$defvoidused'
15767 direntrytype='$direntrytype'
15768 dlext='$dlext'
15769 dlsrc='$dlsrc'
15770 doublesize='$doublesize'
15771 drand01='$drand01'
15772 dynamic_ext='$dynamic_ext'
15773 eagain='$eagain'
15774 ebcdic='$ebcdic'
15775 echo='$echo'
15776 egrep='$egrep'
15777 emacs='$emacs'
15778 eunicefix='$eunicefix'
15779 exe_ext='$exe_ext'
15780 expr='$expr'
15781 extensions='$extensions'
15782 fflushNULL='$fflushNULL'
15783 fflushall='$fflushall'
15784 find='$find'
15785 firstmakefile='$firstmakefile'
15786 flex='$flex'
15787 fpossize='$fpossize'
15788 fpostype='$fpostype'
15789 freetype='$freetype'
15790 full_ar='$full_ar'
15791 full_csh='$full_csh'
15792 full_sed='$full_sed'
15793 gccosandvers='$gccosandvers'
15794 gccversion='$gccversion'
15795 gidformat='$gidformat'
15796 gidsign='$gidsign'
15797 gidsize='$gidsize'
15798 gidtype='$gidtype'
15799 glibpth='$glibpth'
15800 grep='$grep'
15801 groupcat='$groupcat'
15802 groupstype='$groupstype'
15803 gzip='$gzip'
15804 h_fcntl='$h_fcntl'
15805 h_sysfile='$h_sysfile'
15806 hint='$hint'
15807 hostcat='$hostcat'
15808 huge='$huge'
15809 i16size='$i16size'
15810 i16type='$i16type'
15811 i32size='$i32size'
15812 i32type='$i32type'
15813 i64size='$i64size'
15814 i64type='$i64type'
15815 i8size='$i8size'
15816 i8type='$i8type'
15817 i_arpainet='$i_arpainet'
15818 i_bsdioctl='$i_bsdioctl'
15819 i_db='$i_db'
15820 i_dbm='$i_dbm'
15821 i_dirent='$i_dirent'
15822 i_dld='$i_dld'
15823 i_dlfcn='$i_dlfcn'
15824 i_fcntl='$i_fcntl'
15825 i_float='$i_float'
15826 i_gdbm='$i_gdbm'
15827 i_grp='$i_grp'
15828 i_iconv='$i_iconv'
15829 i_ieeefp='$i_ieeefp'
15830 i_inttypes='$i_inttypes'
15831 i_libutil='$i_libutil'
15832 i_limits='$i_limits'
15833 i_locale='$i_locale'
15834 i_machcthr='$i_machcthr'
15835 i_malloc='$i_malloc'
15836 i_math='$i_math'
15837 i_memory='$i_memory'
15838 i_mntent='$i_mntent'
15839 i_ndbm='$i_ndbm'
15840 i_netdb='$i_netdb'
15841 i_neterrno='$i_neterrno'
15842 i_netinettcp='$i_netinettcp'
15843 i_niin='$i_niin'
15844 i_poll='$i_poll'
15845 i_prot='$i_prot'
15846 i_pthread='$i_pthread'
15847 i_pwd='$i_pwd'
15848 i_rpcsvcdbm='$i_rpcsvcdbm'
15849 i_sfio='$i_sfio'
15850 i_sgtty='$i_sgtty'
15851 i_shadow='$i_shadow'
15852 i_socks='$i_socks'
15853 i_stdarg='$i_stdarg'
15854 i_stddef='$i_stddef'
15855 i_stdlib='$i_stdlib'
15856 i_string='$i_string'
15857 i_sunmath='$i_sunmath'
15858 i_sysaccess='$i_sysaccess'
15859 i_sysdir='$i_sysdir'
15860 i_sysfile='$i_sysfile'
15861 i_sysfilio='$i_sysfilio'
15862 i_sysin='$i_sysin'
15863 i_sysioctl='$i_sysioctl'
15864 i_syslog='$i_syslog'
15865 i_sysmman='$i_sysmman'
15866 i_sysmode='$i_sysmode'
15867 i_sysmount='$i_sysmount'
15868 i_sysndir='$i_sysndir'
15869 i_sysparam='$i_sysparam'
15870 i_sysresrc='$i_sysresrc'
15871 i_syssecrt='$i_syssecrt'
15872 i_sysselct='$i_sysselct'
15873 i_syssockio='$i_syssockio'
15874 i_sysstat='$i_sysstat'
15875 i_sysstatfs='$i_sysstatfs'
15876 i_sysstatvfs='$i_sysstatvfs'
15877 i_systime='$i_systime'
15878 i_systimek='$i_systimek'
15879 i_systimes='$i_systimes'
15880 i_systypes='$i_systypes'
15881 i_sysuio='$i_sysuio'
15882 i_sysun='$i_sysun'
15883 i_sysutsname='$i_sysutsname'
15884 i_sysvfs='$i_sysvfs'
15885 i_syswait='$i_syswait'
15886 i_termio='$i_termio'
15887 i_termios='$i_termios'
15888 i_time='$i_time'
15889 i_unistd='$i_unistd'
15890 i_ustat='$i_ustat'
15891 i_utime='$i_utime'
15892 i_values='$i_values'
15893 i_varargs='$i_varargs'
15894 i_varhdr='$i_varhdr'
15895 i_vfork='$i_vfork'
15896 ignore_versioned_solibs='$ignore_versioned_solibs'
15897 inc_version_list='$inc_version_list'
15898 inc_version_list_init='$inc_version_list_init'
15899 incpath='$incpath'
15900 inews='$inews'
15901 installarchlib='$installarchlib'
15902 installbin='$installbin'
15903 installman1dir='$installman1dir'
15904 installman3dir='$installman3dir'
15905 installprefix='$installprefix'
15906 installprefixexp='$installprefixexp'
15907 installprivlib='$installprivlib'
15908 installscript='$installscript'
15909 installsitearch='$installsitearch'
15910 installsitebin='$installsitebin'
15911 installsitelib='$installsitelib'
15912 installstyle='$installstyle'
15913 installusrbinperl='$installusrbinperl'
15914 installvendorarch='$installvendorarch'
15915 installvendorbin='$installvendorbin'
15916 installvendorlib='$installvendorlib'
15917 intsize='$intsize'
15918 ivdformat='$ivdformat'
15919 ivsize='$ivsize'
15920 ivtype='$ivtype'
15921 known_extensions='$known_extensions'
15922 ksh='$ksh'
15923 large='$large'
15924 ld='$ld'
15925 lddlflags='$lddlflags'
15926 ldflags='$ldflags'
15927 ldflags_uselargefiles='$ldflags_uselargefiles'
15928 ldlibpthname='$ldlibpthname'
15929 less='$less'
15930 lib_ext='$lib_ext'
15931 libc='$libc'
15932 libperl='$libperl'
15933 libpth='$libpth'
15934 libs='$libs'
15935 libsdirs='$libsdirs'
15936 libsfiles='$libsfiles'
15937 libsfound='$libsfound'
15938 libspath='$libspath'
15939 libswanted='$libswanted'
15940 libswanted_uselargefiles='$libswanted_uselargefiles'
15941 line='$line'
15942 lint='$lint'
15943 lkflags='$lkflags'
15944 ln='$ln'
15945 lns='$lns'
15946 locincpth='$locincpth'
15947 loclibpth='$loclibpth'
15948 longdblsize='$longdblsize'
15949 longlongsize='$longlongsize'
15950 longsize='$longsize'
15951 lp='$lp'
15952 lpr='$lpr'
15953 ls='$ls'
15954 lseeksize='$lseeksize'
15955 lseektype='$lseektype'
15956 mail='$mail'
15957 mailx='$mailx'
15958 make='$make'
15959 make_set_make='$make_set_make'
15960 mallocobj='$mallocobj'
15961 mallocsrc='$mallocsrc'
15962 malloctype='$malloctype'
15963 man1dir='$man1dir'
15964 man1direxp='$man1direxp'
15965 man1ext='$man1ext'
15966 man3dir='$man3dir'
15967 man3direxp='$man3direxp'
15968 man3ext='$man3ext'
15969 medium='$medium'
15970 mips_type='$mips_type'
15971 mkdir='$mkdir'
15972 mmaptype='$mmaptype'
15973 models='$models'
15974 modetype='$modetype'
15975 more='$more'
15976 multiarch='$multiarch'
15977 mv='$mv'
15978 myarchname='$myarchname'
15979 mydomain='$mydomain'
15980 myhostname='$myhostname'
15981 myuname='$myuname'
15982 n='$n'
15983 netdb_hlen_type='$netdb_hlen_type'
15984 netdb_host_type='$netdb_host_type'
15985 netdb_name_type='$netdb_name_type'
15986 netdb_net_type='$netdb_net_type'
15987 nm='$nm'
15988 nm_opt='$nm_opt'
15989 nm_so_opt='$nm_so_opt'
15990 nonxs_ext='$nonxs_ext'
15991 nroff='$nroff'
15992 nvEUformat='$nvEUformat'
15993 nvFUformat='$nvFUformat'
15994 nvGUformat='$nvGUformat'
15995 nveformat='$nveformat'
15996 nvfformat='$nvfformat'
15997 nvgformat='$nvgformat'
15998 nvsize='$nvsize'
15999 nvtype='$nvtype'
16000 o_nonblock='$o_nonblock'
16001 obj_ext='$obj_ext'
16002 old_pthread_create_joinable='$old_pthread_create_joinable'
16003 optimize='$optimize'
16004 orderlib='$orderlib'
16005 osname='$osname'
16006 osvers='$osvers'
16007 otherlibdirs='$otherlibdirs'
16008 package='$package'
16009 pager='$pager'
16010 passcat='$passcat'
16011 patchlevel='$patchlevel'
16012 path_sep='$path_sep'
16013 perl5='$perl5'
16014 perl='$perl'
16015 perladmin='$perladmin'
16016 perlpath='$perlpath'
16017 pg='$pg'
16018 phostname='$phostname'
16019 pidtype='$pidtype'
16020 plibpth='$plibpth'
16021 pm_apiversion='$pm_apiversion'
16022 pmake='$pmake'
16023 pr='$pr'
16024 prefix='$prefix'
16025 prefixexp='$prefixexp'
16026 privlib='$privlib'
16027 privlibexp='$privlibexp'
16028 prototype='$prototype'
16029 ptrsize='$ptrsize'
16030 quadkind='$quadkind'
16031 quadtype='$quadtype'
16032 randbits='$randbits'
16033 randfunc='$randfunc'
16034 randseedtype='$randseedtype'
16035 ranlib='$ranlib'
16036 rd_nodata='$rd_nodata'
16037 revision='$revision'
16038 rm='$rm'
16039 rmail='$rmail'
16040 runnm='$runnm'
16041 sPRIEUldbl='$sPRIEUldbl'
16042 sPRIFUldbl='$sPRIFUldbl'
16043 sPRIGUldbl='$sPRIGUldbl'
16044 sPRIXU64='$sPRIXU64'
16045 sPRId64='$sPRId64'
16046 sPRIeldbl='$sPRIeldbl'
16047 sPRIfldbl='$sPRIfldbl'
16048 sPRIgldbl='$sPRIgldbl'
16049 sPRIi64='$sPRIi64'
16050 sPRIo64='$sPRIo64'
16051 sPRIu64='$sPRIu64'
16052 sPRIx64='$sPRIx64'
16053 sSCNfldbl='$sSCNfldbl'
16054 sched_yield='$sched_yield'
16055 scriptdir='$scriptdir'
16056 scriptdirexp='$scriptdirexp'
16057 sed='$sed'
16058 seedfunc='$seedfunc'
16059 selectminbits='$selectminbits'
16060 selecttype='$selecttype'
16061 sendmail='$sendmail'
16062 sh='$sh'
16063 shar='$shar'
16064 sharpbang='$sharpbang'
16065 shmattype='$shmattype'
16066 shortsize='$shortsize'
16067 shrpenv='$shrpenv'
16068 shsharp='$shsharp'
16069 sig_count='$sig_count'
16070 sig_name='$sig_name'
16071 sig_name_init='$sig_name_init'
16072 sig_num='$sig_num'
16073 sig_num_init='$sig_num_init'
16074 signal_t='$signal_t'
16075 sitearch='$sitearch'
16076 sitearchexp='$sitearchexp'
16077 sitebin='$sitebin'
16078 sitebinexp='$sitebinexp'
16079 sitelib='$sitelib'
16080 sitelib_stem='$sitelib_stem'
16081 sitelibexp='$sitelibexp'
16082 siteprefix='$siteprefix'
16083 siteprefixexp='$siteprefixexp'
16084 sizesize='$sizesize'
16085 sizetype='$sizetype'
16086 sleep='$sleep'
16087 smail='$smail'
16088 small='$small'
16089 so='$so'
16090 sockethdr='$sockethdr'
16091 socketlib='$socketlib'
16092 socksizetype='$socksizetype'
16093 sort='$sort'
16094 spackage='$spackage'
16095 spitshell='$spitshell'
16096 split='$split'
16097 src='$src'
16098 ssizetype='$ssizetype'
16099 startperl='$startperl'
16100 startsh='$startsh'
16101 static_ext='$static_ext'
16102 stdchar='$stdchar'
16103 stdio_base='$stdio_base'
16104 stdio_bufsiz='$stdio_bufsiz'
16105 stdio_cnt='$stdio_cnt'
16106 stdio_filbuf='$stdio_filbuf'
16107 stdio_ptr='$stdio_ptr'
16108 stdio_stream_array='$stdio_stream_array'
16109 strings='$strings'
16110 submit='$submit'
16111 subversion='$subversion'
16112 sysman='$sysman'
16113 tail='$tail'
16114 tar='$tar'
16115 tbl='$tbl'
16116 tee='$tee'
16117 test='$test'
16118 timeincl='$timeincl'
16119 timetype='$timetype'
16120 touch='$touch'
16121 tr='$tr'
16122 trnl='$trnl'
16123 troff='$troff'
16124 u16size='$u16size'
16125 u16type='$u16type'
16126 u32size='$u32size'
16127 u32type='$u32type'
16128 u64size='$u64size'
16129 u64type='$u64type'
16130 u8size='$u8size'
16131 u8type='$u8type'
16132 uidformat='$uidformat'
16133 uidsign='$uidsign'
16134 uidsize='$uidsize'
16135 uidtype='$uidtype'
16136 uname='$uname'
16137 uniq='$uniq'
16138 uquadtype='$uquadtype'
16139 use5005threads='$use5005threads'
16140 use64bitall='$use64bitall'
16141 use64bitint='$use64bitint'
16142 usedl='$usedl'
16143 useithreads='$useithreads'
16144 uselargefiles='$uselargefiles'
16145 uselongdouble='$uselongdouble'
16146 usemorebits='$usemorebits'
16147 usemultiplicity='$usemultiplicity'
16148 usemymalloc='$usemymalloc'
16149 usenm='$usenm'
16150 useopcode='$useopcode'
16151 useperlio='$useperlio'
16152 useposix='$useposix'
16153 usesfio='$usesfio'
16154 useshrplib='$useshrplib'
16155 usesocks='$usesocks'
16156 usethreads='$usethreads'
16157 usevendorprefix='$usevendorprefix'
16158 usevfork='$usevfork'
16159 usrinc='$usrinc'
16160 uuname='$uuname'
16161 uvXUformat='$uvXUformat'
16162 uvoformat='$uvoformat'
16163 uvsize='$uvsize'
16164 uvtype='$uvtype'
16165 uvuformat='$uvuformat'
16166 uvxformat='$uvxformat'
16167 vendorarch='$vendorarch'
16168 vendorarchexp='$vendorarchexp'
16169 vendorbin='$vendorbin'
16170 vendorbinexp='$vendorbinexp'
16171 vendorlib='$vendorlib'
16172 vendorlib_stem='$vendorlib_stem'
16173 vendorlibexp='$vendorlibexp'
16174 vendorprefix='$vendorprefix'
16175 vendorprefixexp='$vendorprefixexp'
16176 version='$version'
16177 vi='$vi'
16178 voidflags='$voidflags'
16179 xlibpth='$xlibpth'
16180 xs_apiversion='$xs_apiversion'
16181 zcat='$zcat'
16182 zip='$zip'
16183 EOT
16184
16185 : Add in command line options if available
16186 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
16187
16188 : add special variables
16189 $test -f $src/patchlevel.h && \
16190 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
16191 echo "CONFIGDOTSH=true" >>config.sh
16192
16193 : propagate old symbols
16194 if $test -f UU/config.sh; then
16195         <UU/config.sh sort | uniq >UU/oldconfig.sh
16196         sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
16197         sort | uniq -u >UU/oldsyms
16198         set X `cat UU/oldsyms`
16199         shift
16200         case $# in
16201         0) ;;
16202         *)
16203                 cat <<EOM
16204 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
16205 EOM
16206                 echo "# Variables propagated from previous config.sh file." >>config.sh
16207                 for sym in `cat UU/oldsyms`; do
16208                         echo "    Propagating $hint variable "'$'"$sym..."
16209                         eval 'tmp="$'"${sym}"'"'
16210                         echo "$tmp" | \
16211                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
16212                 done
16213                 ;;
16214         esac
16215 fi
16216
16217 : Finish up by extracting the .SH files
16218 case "$alldone" in
16219 exit)
16220         $rm -rf UU
16221         echo "Done."
16222         exit 0
16223         ;;
16224 cont)
16225         ;;
16226 '')
16227         dflt=''
16228         nostick=true
16229         $cat <<EOM
16230
16231 If you'd like to make any changes to the config.sh file before I begin
16232 to configure things, do it as a shell escape now (e.g. !vi config.sh).
16233
16234 EOM
16235         rp="Press return or use a shell escape to edit config.sh:"
16236         . UU/myread
16237         nostick=''
16238         case "$ans" in
16239         '') ;;
16240         *) : in case they cannot read
16241                 sh 1>&4 -c "$ans";;
16242         esac
16243         ;;
16244 esac
16245
16246 : if this fails, just run all the .SH files by hand
16247 . ./config.sh
16248
16249 echo " "
16250 exec 1>&4
16251 . ./UU/extract
16252
16253 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
16254         dflt=y
16255         case "$silent" in
16256         true) ;;
16257         *)
16258                 $cat <<EOM
16259
16260 Now you need to generate make dependencies by running "$make depend".
16261 You might prefer to run it in background: "$make depend > makedepend.out &"
16262 It can take a while, so you might not want to run it right now.
16263
16264 EOM
16265                 ;;
16266         esac
16267         rp="Run $make depend now?"
16268         . UU/myread
16269         case "$ans" in
16270         y*)
16271                 $make depend && echo "Now you must run a $make."
16272                 ;;
16273         *)
16274                 echo "You must run '$make depend' then '$make'."
16275                 ;;
16276         esac
16277 elif test -f [Mm]akefile; then
16278         echo " "
16279         echo "Now you must run a $make."
16280 else
16281         echo "Done."
16282 fi
16283
16284 if $test -f Policy.sh; then
16285     $cat <<EOM
16286
16287 If you compile $package on a different machine or from a different object
16288 directory, copy the Policy.sh file from this object directory to the
16289 new one before you run Configure -- this will help you with most of
16290 the policy defaults.
16291
16292 EOM
16293 fi
16294 if $test -f config.msg; then
16295     echo "Hmm.  I also noted the following information while running:"
16296     echo " "
16297     $cat config.msg >&4
16298     $rm -f config.msg
16299 fi
16300 $rm -f kit*isdone ark*isdone
16301 $rm -rf UU
16302
16303 : End of Configure
16304