This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Fix Changes ordering.
[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 Aug 25 21:43:24 EET DST 2000 [metaconfig 3.0 PL70]
24 # (with additional metaconfig patches by perlbug@perl.com)
25
26 cat >/tmp/c1$$ <<EOF
27 ARGGGHHHH!!!!!
28
29 SCO csh still thinks true is false.  Write to SCO today and tell them that next
30 year Configure ought to "rm /bin/csh" unless they fix their blasted shell. :-)
31
32 (Actually, Configure ought to just patch csh in place.  Hmm.  Hmmmmm.  All
33 we'd have to do is go in and swap the && and || tokens, wherever they are.)
34
35 [End of diatribe. We now return you to your regularly scheduled programming...]
36 EOF
37 cat >/tmp/c2$$ <<EOF
38
39 OOPS!  You naughty creature!  You didn't run Configure with sh!
40 I will attempt to remedy the situation by running sh for you...
41 EOF
42
43 true || cat /tmp/c1$$ /tmp/c2$$
44 true || exec sh $0 $argv:q
45
46 (exit $?0) || cat /tmp/c2$$
47 (exit $?0) || exec sh $0 $argv:q
48 rm -f /tmp/c1$$ /tmp/c2$$
49
50 : compute my invocation name
51 me=$0
52 case "$0" in
53 */*)
54         me=`echo $0 | sed -e 's!.*/\(.*\)!\1!' 2>/dev/null`
55         test "$me" || me=$0
56         ;;
57 esac
58
59 : Proper separator for the PATH environment variable
60 p_=:
61 : On OS/2 this directory should exist if this is not floppy only system :-]
62 if test -d c:/. ; then
63     if test -n "$OS2_SHELL"; then
64                 p_=\;
65                 PATH=`cmd /c "echo %PATH%" | tr '\\\\' / `
66                 OS2_SHELL=`cmd /c "echo %OS2_SHELL%" | tr '\\\\' / | tr '[A-Z]' '[a-z]'`
67         elif test -n "$DJGPP"; then
68                 p_=\;
69         fi
70 fi
71
72 : Proper PATH setting
73 paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin'
74 paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin"
75 paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin"
76 paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin"
77 paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb"
78 paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /usr/ccs/bin"
79 paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib"
80 paths="$paths /sbin /usr/sbin /usr/libexec"
81
82 for p in $paths
83 do
84         case "$p_$PATH$p_" in
85         *$p_$p$p_*) ;;
86         *) test -d $p && PATH=$PATH$p_$p ;;
87         esac
88 done
89
90 PATH=.$p_$PATH
91 export PATH
92
93 : shall we be using ksh?
94 inksh=''
95 needksh=''
96 avoidksh=''
97 newsh=/bin/ksh
98 changesh=''
99 if (PATH=.; alias -x) >/dev/null 2>&1; then
100                 inksh=true
101 fi
102 if test -f /hp-ux -a -f /bin/ksh; then
103         needksh='to avoid sh bug in "here document" expansion'
104 fi
105 if test -d /usr/lpp -a -f /usr/bin/bsh -a -f /usr/bin/uname; then
106         if test X`/usr/bin/uname -v` = X4; then
107                 avoidksh="to avoid AIX 4's /bin/sh"
108                 newsh=/usr/bin/bsh
109         fi
110 fi
111 if test -f /osf_boot -a -f /usr/sbin/setld; then
112         if test X`/usr/bin/uname -s` = XOSF1; then
113                 avoidksh="to avoid Digital UNIX' ksh"
114                 newsh=/bin/sh
115                 unset BIN_SH # if this is 'xpg4' sh will start up ksh
116         fi
117 fi
118 case "$inksh/$needksh" in
119 /[a-z]*)
120                 ENV=''
121                 changesh=true
122                 reason="$needksh"
123         ;;
124 esac
125 case "$inksh/$avoidksh" in
126 true/[a-z]*)
127         changesh=true
128         reason="$avoidksh"
129         ;;
130 esac
131 case "$inksh/$needksh-$avoidksh-" in
132 true/--)
133                 cat <<EOM
134 (I see you are using the Korn shell.  Some ksh's blow up on $me,
135 mainly on older exotic systems.  If yours does, try the Bourne shell instead.)
136 EOM
137         ;;
138 esac
139 case "$changesh" in
140 true)
141         echo "(Feeding myself to $newsh $reason.)"
142         case "$0" in
143         Configure|*/Configure) exec $newsh $0 "$@";;
144         *) exec $newsh Configure "$@";;
145         esac
146         ;;
147 esac
148
149 : if needed set CDPATH to a harmless value that is not chatty
150 : avoid bash 2.02 problems with empty CDPATH.
151 case "$CDPATH" in
152 '')     ;;
153 *)      case "$SHELL" in
154         *bash*) CDPATH='.' ;;
155         *)              CDPATH='' ;;
156         esac
157         ;;
158 esac
159 : Configure runs within the UU subdirectory
160 test -d UU || mkdir UU
161 cd UU && rm -f ./*
162
163 ccsymbols=''
164 cppccsymbols=''
165 cppsymbols=''
166 dynamic_ext=''
167 extensions=''
168 known_extensions=''
169 nonxs_ext=''
170 static_ext=''
171 useopcode=''
172 useposix=''
173 d_bsd=''
174 d_eunice=''
175 d_xenix=''
176 eunicefix=''
177 Mcc=''
178 ar=''
179 awk=''
180 bash=''
181 bison=''
182 byacc=''
183 cat=''
184 chgrp=''
185 chmod=''
186 chown=''
187 comm=''
188 compress=''
189 cp=''
190 cpio=''
191 cpp=''
192 csh=''
193 date=''
194 echo=''
195 egrep=''
196 emacs=''
197 expr=''
198 find=''
199 flex=''
200 grep=''
201 gzip=''
202 inews=''
203 ksh=''
204 less=''
205 line=''
206 lint=''
207 ln=''
208 lp=''
209 lpr=''
210 ls=''
211 mail=''
212 mailx=''
213 make=''
214 mkdir=''
215 more=''
216 mv=''
217 nm=''
218 nroff=''
219 perl=''
220 pg=''
221 pmake=''
222 pr=''
223 rm=''
224 rmail=''
225 sed=''
226 sendmail=''
227 shar=''
228 sleep=''
229 smail=''
230 sort=''
231 submit=''
232 tail=''
233 tar=''
234 tbl=''
235 tee=''
236 test=''
237 touch=''
238 tr=''
239 troff=''
240 uname=''
241 uniq=''
242 uuname=''
243 vi=''
244 zcat=''
245 zip=''
246 full_ar=''
247 full_sed=''
248 libswanted=''
249 hint=''
250 myuname=''
251 osname=''
252 osvers=''
253 Author=''
254 Date=''
255 Header=''
256 Id=''
257 Locker=''
258 Log=''
259 RCSfile=''
260 Revision=''
261 Source=''
262 State=''
263 _a=''
264 _exe=''
265 _o=''
266 archobjs=''
267 exe_ext=''
268 firstmakefile=''
269 lib_ext=''
270 obj_ext=''
271 path_sep=''
272 afs=''
273 alignbytes=''
274 ansi2knr=''
275 archlib=''
276 archlibexp=''
277 d_archlib=''
278 installarchlib=''
279 archname=''
280 myarchname=''
281 d_atolf=''
282 d_atoll=''
283 baserev=''
284 bin=''
285 binexp=''
286 installbin=''
287 bincompat5005=''
288 d_bincompat5005=''
289 byteorder=''
290 cc=''
291 ccflags=''
292 cppflags=''
293 ldflags=''
294 lkflags=''
295 locincpth=''
296 optimize=''
297 cf_email=''
298 cf_by=''
299 cf_time=''
300 charsize=''
301 contains=''
302 cpp_stuff=''
303 cpplast=''
304 cppminus=''
305 cpprun=''
306 cppstdin=''
307 crosscompile=''
308 d_access=''
309 d_accessx=''
310 d_alarm=''
311 d_attribut=''
312 d_bcmp=''
313 d_bcopy=''
314 d_bzero=''
315 d_casti32=''
316 castflags=''
317 d_castneg=''
318 d_chown=''
319 d_chroot=''
320 d_chsize=''
321 d_closedir=''
322 d_void_closedir=''
323 d_const=''
324 cryptlib=''
325 d_crypt=''
326 d_csh=''
327 full_csh=''
328 d_cuserid=''
329 d_dbl_dig=''
330 d_difftime=''
331 d_dlerror=''
332 d_dlopen=''
333 d_dlsymun=''
334 d_dosuid=''
335 d_suidsafe=''
336 d_drand48proto=''
337 d_dup2=''
338 d_eaccess=''
339 d_endgrent=''
340 d_endhent=''
341 d_endnent=''
342 d_endpent=''
343 d_endpwent=''
344 d_endsent=''
345 d_fchmod=''
346 d_fchown=''
347 d_fcntl=''
348 d_fd_macros=''
349 d_fd_set=''
350 d_fds_bits=''
351 d_fgetpos=''
352 d_flexfnam=''
353 d_flock=''
354 d_fork=''
355 d_fpos64_t=''
356 d_frexpl=''
357 d_fs_data_s=''
358 d_fseeko=''
359 d_fsetpos=''
360 d_fstatfs=''
361 d_ftello=''
362 d_ftime=''
363 d_gettimeod=''
364 d_Gconvert=''
365 d_getcwd=''
366 d_getespwnam=''
367 d_getfsstat=''
368 d_getgrent=''
369 d_getgrps=''
370 d_gethbyaddr=''
371 d_gethbyname=''
372 d_gethent=''
373 aphostname=''
374 d_gethname=''
375 d_phostname=''
376 d_uname=''
377 d_gethostprotos=''
378 d_getlogin=''
379 d_getmnt=''
380 d_getmntent=''
381 d_getnbyaddr=''
382 d_getnbyname=''
383 d_getnent=''
384 d_getnetprotos=''
385 d_getpent=''
386 d_getpgid=''
387 d_getpgrp2=''
388 d_bsdgetpgrp=''
389 d_getpgrp=''
390 d_getppid=''
391 d_getprior=''
392 d_getpbyname=''
393 d_getpbynumber=''
394 d_getprotoprotos=''
395 d_getprpwnam=''
396 d_getpwent=''
397 d_getsent=''
398 d_getservprotos=''
399 d_getspnam=''
400 d_getsbyname=''
401 d_getsbyport=''
402 d_gnulibc=''
403 d_hasmntopt=''
404 d_htonl=''
405 d_iconv=''
406 d_inetaton=''
407 d_int64_t=''
408 d_isascii=''
409 d_isnan=''
410 d_isnanl=''
411 d_killpg=''
412 d_lchown=''
413 d_ldbl_dig=''
414 d_link=''
415 d_locconv=''
416 d_lockf=''
417 d_longdbl=''
418 longdblsize=''
419 d_longlong=''
420 longlongsize=''
421 d_lseekproto=''
422 d_lstat=''
423 d_madvise=''
424 d_mblen=''
425 d_mbstowcs=''
426 d_mbtowc=''
427 d_memchr=''
428 d_memcmp=''
429 d_memcpy=''
430 d_memmove=''
431 d_memset=''
432 d_mkdir=''
433 d_mkdtemp=''
434 d_mkfifo=''
435 d_mkstemp=''
436 d_mkstemps=''
437 d_mktime=''
438 d_mmap=''
439 mmaptype=''
440 d_modfl=''
441 d_mprotect=''
442 d_msg=''
443 d_msgctl=''
444 d_msgget=''
445 d_msgrcv=''
446 d_msgsnd=''
447 d_msync=''
448 d_munmap=''
449 d_nice=''
450 d_off64_t=''
451 d_open3=''
452 d_fpathconf=''
453 d_pathconf=''
454 d_pause=''
455 d_pipe=''
456 d_poll=''
457 d_portable=''
458 d_old_pthread_create_joinable=''
459 old_pthread_create_joinable=''
460 d_pthread_yield=''
461 d_sched_yield=''
462 sched_yield=''
463 d_qgcvt=''
464 d_readdir=''
465 d_rewinddir=''
466 d_seekdir=''
467 d_telldir=''
468 d_readlink=''
469 d_rename=''
470 d_rmdir=''
471 d_safebcpy=''
472 d_safemcpy=''
473 d_sanemcmp=''
474 d_select=''
475 d_sem=''
476 d_semctl=''
477 d_semget=''
478 d_semop=''
479 d_setegid=''
480 d_seteuid=''
481 d_setgrent=''
482 d_setgrps=''
483 d_sethent=''
484 d_setlinebuf=''
485 d_setlocale=''
486 d_setnent=''
487 d_setpent=''
488 d_setpgid=''
489 d_setpgrp2=''
490 d_bsdsetpgrp=''
491 d_setpgrp=''
492 d_setprior=''
493 d_setproctitle=''
494 d_setpwent=''
495 d_setregid=''
496 d_setresgid=''
497 d_setresuid=''
498 d_setreuid=''
499 d_setrgid=''
500 d_setruid=''
501 d_setsent=''
502 d_setsid=''
503 d_setvbuf=''
504 d_sfio=''
505 usesfio=''
506 d_shm=''
507 d_shmat=''
508 d_shmatprototype=''
509 shmattype=''
510 d_shmctl=''
511 d_shmdt=''
512 d_shmget=''
513 d_sigaction=''
514 d_sigsetjmp=''
515 d_msg_ctrunc=''
516 d_msg_dontroute=''
517 d_msg_oob=''
518 d_msg_peek=''
519 d_msg_proxy=''
520 d_oldsock=''
521 d_scm_rights=''
522 d_socket=''
523 d_sockpair=''
524 sockethdr=''
525 socketlib=''
526 d_socklen_t=''
527 d_socks5_init=''
528 d_sqrtl=''
529 d_statblks=''
530 d_statfs_f_flags=''
531 d_statfs_s=''
532 d_fstatvfs=''
533 d_statvfs=''
534 d_stdio_cnt_lval=''
535 d_stdio_ptr_lval=''
536 d_stdiobase=''
537 d_stdstdio=''
538 stdio_base=''
539 stdio_bufsiz=''
540 stdio_cnt=''
541 stdio_filbuf=''
542 stdio_ptr=''
543 d_index=''
544 d_strchr=''
545 d_strcoll=''
546 d_strctcpy=''
547 d_strerrm=''
548 d_strerror=''
549 d_sysernlst=''
550 d_syserrlst=''
551 d_strtod=''
552 d_strtol=''
553 d_strtold=''
554 d_strtoll=''
555 d_strtoul=''
556 d_strtoull=''
557 d_strtouq=''
558 d_strxfrm=''
559 d_symlink=''
560 d_syscall=''
561 d_sysconf=''
562 d_system=''
563 d_tcgetpgrp=''
564 d_tcsetpgrp=''
565 d_telldirproto=''
566 d_time=''
567 timetype=''
568 clocktype=''
569 d_times=''
570 d_truncate=''
571 d_tzname=''
572 d_umask=''
573 d_semctl_semid_ds=''
574 d_semctl_semun=''
575 d_union_semun=''
576 d_ustat=''
577 d_vfork=''
578 usevfork=''
579 d_voidsig=''
580 signal_t=''
581 d_volatile=''
582 d_charvspr=''
583 d_vprintf=''
584 d_wait4=''
585 d_waitpid=''
586 d_wcstombs=''
587 d_wctomb=''
588 dlext=''
589 cccdlflags=''
590 ccdlflags=''
591 dlsrc=''
592 ld=''
593 lddlflags=''
594 usedl=''
595 doublesize=''
596 ebcdic=''
597 fflushNULL=''
598 fflushall=''
599 fpossize=''
600 fpostype=''
601 gccosandvers=''
602 gccversion=''
603 gidformat=''
604 gidsign=''
605 gidsize=''
606 gidtype=''
607 groupstype=''
608 h_fcntl=''
609 h_sysfile=''
610 i_arpainet=''
611 db_hashtype=''
612 db_prefixtype=''
613 i_db=''
614 i_dbm=''
615 i_rpcsvcdbm=''
616 d_dirnamlen=''
617 direntrytype=''
618 i_dirent=''
619 i_dld=''
620 i_dlfcn=''
621 i_fcntl=''
622 i_float=''
623 i_gdbm=''
624 d_grpasswd=''
625 i_grp=''
626 i_iconv=''
627 i_ieeefp=''
628 i_inttypes=''
629 i_libutil=''
630 i_limits=''
631 i_locale=''
632 i_machcthr=''
633 i_malloc=''
634 i_math=''
635 i_memory=''
636 i_mntent=''
637 i_ndbm=''
638 i_netdb=''
639 i_neterrno=''
640 i_netinettcp=''
641 i_niin=''
642 i_sysin=''
643 i_poll=''
644 i_prot=''
645 i_pthread=''
646 d_pwage=''
647 d_pwchange=''
648 d_pwclass=''
649 d_pwcomment=''
650 d_pwexpire=''
651 d_pwgecos=''
652 d_pwpasswd=''
653 d_pwquota=''
654 i_pwd=''
655 i_sfio=''
656 i_shadow=''
657 i_socks=''
658 i_stddef=''
659 i_stdlib=''
660 i_string=''
661 strings=''
662 i_sunmath=''
663 i_sysaccess=''
664 i_sysdir=''
665 i_sysfile=''
666 d_voidtty=''
667 i_bsdioctl=''
668 i_sysfilio=''
669 i_sysioctl=''
670 i_syssockio=''
671 i_syslog=''
672 i_sysmman=''
673 i_sysmode=''
674 i_sysmount=''
675 i_sysndir=''
676 i_sysparam=''
677 i_sysresrc=''
678 i_syssecrt=''
679 i_sysselct=''
680 i_sysstat=''
681 i_sysstatfs=''
682 i_sysstatvfs=''
683 i_systimes=''
684 i_systypes=''
685 i_sysuio=''
686 i_sysun=''
687 i_sysutsname=''
688 i_sysvfs=''
689 i_syswait=''
690 i_sgtty=''
691 i_termio=''
692 i_termios=''
693 i_systime=''
694 i_systimek=''
695 i_time=''
696 timeincl=''
697 i_unistd=''
698 i_ustat=''
699 i_utime=''
700 i_values=''
701 i_stdarg=''
702 i_varargs=''
703 i_varhdr=''
704 i_vfork=''
705 inc_version_list=''
706 inc_version_list_init=''
707 installprefix=''
708 installprefixexp=''
709 installstyle=''
710 installusrbinperl=''
711 intsize=''
712 longsize=''
713 shortsize=''
714 libc=''
715 ldlibpthname=''
716 libperl=''
717 shrpenv=''
718 useshrplib=''
719 glibpth=''
720 libpth=''
721 loclibpth=''
722 plibpth=''
723 xlibpth=''
724 ignore_versioned_solibs=''
725 libs=''
726 libsdirs=''
727 libsfiles=''
728 libsfound=''
729 libspath=''
730 lns=''
731 d_PRIEldbl=''
732 d_PRIFldbl=''
733 d_PRIGldbl=''
734 d_PRIeldbl=''
735 d_PRIfldbl=''
736 d_PRIgldbl=''
737 sPRIEldbl=''
738 sPRIFldbl=''
739 sPRIGldbl=''
740 sPRIeldbl=''
741 sPRIfldbl=''
742 sPRIgldbl=''
743 lseeksize=''
744 lseektype=''
745 make_set_make=''
746 d_mymalloc=''
747 freetype=''
748 mallocobj=''
749 mallocsrc=''
750 malloctype=''
751 usemymalloc=''
752 installman1dir=''
753 man1dir=''
754 man1direxp=''
755 man1ext=''
756 installman3dir=''
757 man3dir=''
758 man3direxp=''
759 man3ext=''
760 huge=''
761 large=''
762 medium=''
763 models=''
764 small=''
765 split=''
766 modetype=''
767 multiarch=''
768 mydomain=''
769 myhostname=''
770 phostname=''
771 c=''
772 n=''
773 d_eofnblk=''
774 eagain=''
775 o_nonblock=''
776 rd_nodata=''
777 netdb_hlen_type=''
778 netdb_host_type=''
779 netdb_name_type=''
780 netdb_net_type=''
781 groupcat=''
782 hostcat=''
783 passcat=''
784 orderlib=''
785 ranlib=''
786 d_perl_otherlibdirs=''
787 otherlibdirs=''
788 package=''
789 spackage=''
790 pager=''
791 api_revision=''
792 api_subversion=''
793 api_version=''
794 api_versionstring=''
795 patchlevel=''
796 revision=''
797 subversion=''
798 version=''
799 perl5=''
800 perladmin=''
801 perlpath=''
802 d_nv_preserves_uv=''
803 d_nv_preserves_uv_bits=''
804 i16size=''
805 i16type=''
806 i32size=''
807 i32type=''
808 i64size=''
809 i64type=''
810 i8size=''
811 i8type=''
812 ivsize=''
813 ivtype=''
814 nvsize=''
815 nvtype=''
816 u16size=''
817 u16type=''
818 u32size=''
819 u32type=''
820 u64size=''
821 u64type=''
822 u8size=''
823 u8type=''
824 uvsize=''
825 uvtype=''
826 ivdformat=''
827 nvEformat=''
828 nvFformat=''
829 nvGformat=''
830 nveformat=''
831 nvfformat=''
832 nvgformat=''
833 uvXformat=''
834 uvoformat=''
835 uvuformat=''
836 uvxformat=''
837 pidtype=''
838 prefix=''
839 prefixexp=''
840 installprivlib=''
841 privlib=''
842 privlibexp=''
843 prototype=''
844 ptrsize=''
845 d_PRIX64=''
846 d_PRId64=''
847 d_PRIi64=''
848 d_PRIo64=''
849 d_PRIu64=''
850 d_PRIx64=''
851 sPRIX64=''
852 sPRId64=''
853 sPRIi64=''
854 sPRIo64=''
855 sPRIu64=''
856 sPRIx64=''
857 d_quad=''
858 quadkind=''
859 quadtype=''
860 uquadtype=''
861 drand01=''
862 randbits=''
863 randfunc=''
864 randseedtype=''
865 seedfunc=''
866 installscript=''
867 scriptdir=''
868 scriptdirexp=''
869 selectminbits=''
870 selecttype=''
871 sh=''
872 sig_count=''
873 sig_name=''
874 sig_name_init=''
875 sig_num=''
876 sig_num_init=''
877 installsitearch=''
878 sitearch=''
879 sitearchexp=''
880 installsitebin=''
881 sitebin=''
882 sitebinexp=''
883 installsitelib=''
884 sitelib=''
885 sitelib_stem=''
886 sitelibexp=''
887 siteprefix=''
888 siteprefixexp=''
889 sizesize=''
890 sizetype=''
891 so=''
892 socksizetype=''
893 sharpbang=''
894 shsharp=''
895 spitshell=''
896 src=''
897 ssizetype=''
898 startperl=''
899 startsh=''
900 stdchar=''
901 d_stdio_stream_array=''
902 stdio_stream_array=''
903 sysman=''
904 trnl=''
905 uidformat=''
906 uidsign=''
907 uidsize=''
908 uidtype=''
909 archname64=''
910 use64bitall=''
911 use64bitint=''
912 ccflags_uselargefiles=''
913 ldflags_uselargefiles=''
914 libswanted_uselargefiles=''
915 uselargefiles=''
916 uselongdouble=''
917 usemorebits=''
918 usemultiplicity=''
919 nm_opt=''
920 nm_so_opt=''
921 runnm=''
922 usenm=''
923 useperlio=''
924 usesocks=''
925 d_oldpthreads=''
926 use5005threads=''
927 useithreads=''
928 usethreads=''
929 incpath=''
930 mips_type=''
931 usrinc=''
932 d_vendorarch=''
933 installvendorarch=''
934 vendorarch=''
935 vendorarchexp=''
936 d_vendorbin=''
937 installvendorbin=''
938 vendorbin=''
939 vendorbinexp=''
940 d_vendorlib=''
941 installvendorlib=''
942 vendorlib=''
943 vendorlib_stem=''
944 vendorlibexp=''
945 usevendorprefix=''
946 vendorprefix=''
947 vendorprefixexp=''
948 defvoidused=''
949 voidflags=''
950 pm_apiversion=''
951 xs_apiversion=''
952 CONFIG=''
953
954 define='define'
955 undef='undef'
956 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
957 rmlist=''
958
959 : We must find out about Eunice early
960 eunicefix=':'
961 if test -f /etc/unixtovms; then
962         eunicefix=/etc/unixtovms
963 fi
964 if test -f /etc/unixtovms.exe; then
965         eunicefix=/etc/unixtovms.exe
966 fi
967
968 i_whoami=''
969 : set useposix=false in your hint file to disable the POSIX extension.
970 useposix=true
971 : set useopcode=false in your hint file to disable the Opcode extension.
972 useopcode=true
973 : Trailing extension.  Override this in a hint file, if needed.
974 _exe=''
975 : Extra object files, if any, needed on this platform.
976 archobjs=''
977 : Possible local include directories to search.
978 : Set locincpth to "" in a hint file to defeat local include searches.
979 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
980 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
981 :
982 : no include file wanted by default
983 inclwanted=''
984
985 groupstype=''
986 : change the next line if compiling for Xenix/286 on Xenix/386
987 xlibpth='/usr/lib/386 /lib/386'
988 : Possible local library directories to search.
989 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
990 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
991
992 : general looking path for locating libraries
993 glibpth="/usr/lib/large /lib /usr/lib $xlibpth"
994 glibpth="$glibpth /lib/large /usr/lib/small /lib/small"
995 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
996 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
997 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
998
999 : Private path used by Configure to find libraries.  Its value
1000 : is prepended to libpth. This variable takes care of special
1001 : machines, like the mips.  Usually, it should be empty.
1002 plibpth=''
1003
1004 : default library list
1005 libswanted=''
1006 : some systems want to use only the non-versioned libso:s
1007 ignore_versioned_solibs=''
1008 ccflags_uselargefiles=''
1009 ldflags_uselargefiles=''
1010 libswanted_uselargefiles=''
1011 : set usemultiplicity on the Configure command line to enable multiplicity.
1012 : set usesocks on the Configure command line to enable socks.
1013 : set usethreads on the Configure command line to enable threads.
1014 : full support for void wanted by default
1015 defvoidused=15
1016
1017 : List of libraries we want.
1018 : If anyone needs -lnet, put it in a hint file.
1019 libswanted='sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl'
1020 libswanted="$libswanted dld ld sun m c cposix posix"
1021 libswanted="$libswanted ndir dir crypt sec"
1022 libswanted="$libswanted ucb bsd BSD PW x iconv util"
1023 : We probably want to search /usr/shlib before most other libraries.
1024 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1025 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1026 glibpth="/usr/shlib $glibpth"
1027 : Do not use vfork unless overridden by a hint file.
1028 usevfork=false
1029
1030 : Find the basic shell for Bourne shell scripts
1031 case "$sh" in
1032 '')
1033         case "$SYSTYPE" in
1034         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1035         *) xxx='/bin/sh';;
1036         esac
1037         if test -f "$xxx"; then
1038                 sh="$xxx"
1039         else
1040                 : Build up a list and do a single loop so we can 'break' out.
1041                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1042                 for xxx in sh bash ksh pdksh ash; do
1043                         for p in $pth; do
1044                                 try="$try ${p}/${xxx}"
1045                         done
1046                 done
1047                 for xxx in $try; do
1048                         if test -f "$xxx"; then
1049                                 sh="$xxx";
1050                                 break
1051                         elif test -f "$xxx.exe"; then
1052                                 sh="$xxx";
1053                                 break
1054                         fi
1055                 done
1056         fi
1057         ;;
1058 esac
1059
1060 case "$sh" in
1061 '')     cat <<EOM >&2
1062 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
1063
1064 Usually it's in /bin/sh.  How did you even get this far?
1065 Please contact me (Perl Maintainers) at perlbug@perl.com and 
1066 we'll try to straighten this all out.
1067 EOM
1068         exit 1
1069         ;;
1070 esac
1071
1072 : see if sh knows # comments
1073 if `$sh -c '#' >/dev/null 2>&1`; then
1074         shsharp=true
1075         spitshell=cat
1076         xcat=/bin/cat
1077         test -f $xcat || xcat=/usr/bin/cat
1078         echo "#!$xcat" >try
1079         $eunicefix try
1080         chmod +x try
1081         ./try > today
1082         if test -s today; then
1083                 sharpbang='#!'
1084         else
1085                 echo "#! $xcat" > try
1086                 $eunicefix try
1087                 chmod +x try
1088                 ./try > today
1089                 if test -s today; then
1090                         sharpbang='#! '
1091                 else
1092                         sharpbang=': use '
1093                 fi
1094         fi
1095 else
1096         echo " "
1097         echo "Your $sh doesn't grok # comments--I will strip them later on."
1098         shsharp=false
1099         cd ..
1100         echo "exec grep -v '^[  ]*#'" >spitshell
1101         chmod +x spitshell
1102         $eunicefix spitshell
1103         spitshell=`pwd`/spitshell
1104         cd UU
1105         echo "I presume that if # doesn't work, #! won't work either!"
1106         sharpbang=': use '
1107 fi
1108 rm -f try today
1109
1110 : figure out how to guarantee sh startup
1111 case "$startsh" in
1112 '') startsh=${sharpbang}${sh} ;;
1113 *)
1114 esac
1115 cat >try <<EOSS
1116 $startsh
1117 set abc
1118 test "$?abc" != 1
1119 EOSS
1120
1121 chmod +x try
1122 $eunicefix try
1123 if ./try; then
1124         : echo "Yup, it does."
1125 else
1126         echo "Hmm... '$startsh' does not guarantee sh startup..."
1127         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1128 fi
1129 rm -f try
1130
1131
1132 : Save command line options in file UU/cmdline.opt for later use in
1133 : generating config.sh.
1134 cat > cmdline.opt <<EOSH
1135 # Configure command line arguments.
1136 config_arg0='$0'
1137 config_args='$*'
1138 config_argc=$#
1139 EOSH
1140 argn=1
1141 for arg in "$@"; do
1142         cat >>cmdline.opt <<EOSH
1143 config_arg$argn='$arg'
1144 EOSH
1145         argn=`expr $argn + 1`
1146 done
1147
1148 : produce awk script to parse command line options
1149 cat >options.awk <<'EOF'
1150 BEGIN {
1151         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1152
1153         len = length(optstr);
1154         for (i = 1; i <= len; i++) {
1155                 c = substr(optstr, i, 1);
1156                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1157                 if (a == ":") {
1158                         arg[c] = 1;
1159                         i++;
1160                 }
1161                 opt[c] = 1;
1162         }
1163 }
1164 {
1165         expect = 0;
1166         str = $0;
1167         if (substr(str, 1, 1) != "-") {
1168                 printf("'%s'\n", str);
1169                 next;
1170         }
1171         len = length($0);
1172         for (i = 2; i <= len; i++) {
1173                 c = substr(str, i, 1);
1174                 if (!opt[c]) {
1175                         printf("-%s\n", substr(str, i));
1176                         next;
1177                 }
1178                 printf("-%s\n", c);
1179                 if (arg[c]) {
1180                         if (i < len)
1181                                 printf("'%s'\n", substr(str, i + 1));
1182                         else
1183                                 expect = 1;
1184                         next;
1185                 }
1186         }
1187 }
1188 END {
1189         if (expect)
1190                 print "?";
1191 }
1192 EOF
1193
1194 : process the command line options
1195 set X `for arg in "$@"; do echo "X$arg"; done |
1196         sed -e s/X// | awk -f options.awk`
1197 eval "set $*"
1198 shift
1199 rm -f options.awk
1200
1201 : set up default values
1202 fastread=''
1203 reuseval=false
1204 config_sh=''
1205 alldone=''
1206 error=''
1207 silent=''
1208 extractsh=''
1209 override=''
1210 knowitall=''
1211 rm -f optdef.sh posthint.sh
1212 cat >optdef.sh <<EOS
1213 $startsh
1214 EOS
1215
1216
1217 : option parsing
1218 while test $# -gt 0; do
1219         case "$1" in
1220         -d) shift; fastread=yes;;
1221         -e) shift; alldone=cont;;
1222         -f)
1223                 shift
1224                 cd ..
1225                 if test -r "$1"; then
1226                         config_sh="$1"
1227                 else
1228                         echo "$me: cannot read config file $1." >&2
1229                         error=true
1230                 fi
1231                 cd UU
1232                 shift;;
1233         -h) shift; error=true;;
1234         -r) shift; reuseval=true;;
1235         -s) shift; silent=true; realsilent=true;;
1236         -E) shift; alldone=exit;;
1237         -K) shift; knowitall=true;;
1238         -O) shift; override=true;;
1239         -S) shift; silent=true; extractsh=true;;
1240         -D)
1241                 shift
1242                 case "$1" in
1243                 *=)
1244                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1245                         echo "$me: ignoring -D $1" >&2
1246                         ;;
1247                 *=*) echo "$1" | \
1248                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1249                 *) echo "$1='define'" >> optdef.sh;;
1250                 esac
1251                 shift
1252                 ;;
1253         -U)
1254                 shift
1255                 case "$1" in
1256                 *=) echo "$1" >> optdef.sh;;
1257                 *=*)
1258                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1259                         echo "$me: ignoring -U $1" >&2
1260                         ;;
1261                 *) echo "$1='undef'" >> optdef.sh;;
1262                 esac
1263                 shift
1264                 ;;
1265         -A)
1266             shift
1267             xxx=''
1268             yyy="$1"
1269             zzz=''
1270             uuu=undef
1271             case "$yyy" in
1272             *=*) zzz=`echo $yyy|sed 's!=.*!!'`
1273                  case "$zzz" in
1274                  *:*) zzz='' ;;
1275                  *)   xxx=append
1276                       zzz=" "`echo $yyy|sed 's!^[^=]*=!!'` 
1277                       yyy=`echo $yyy|sed 's!=.*!!'` ;;
1278                  esac
1279                  ;;
1280             esac
1281             case "$xxx" in
1282             '')  case "$yyy" in
1283                  *:*) xxx=`echo $yyy|sed 's!:.*!!'`
1284                       yyy=`echo $yyy|sed 's!^[^:]*:!!'`
1285                       zzz=`echo $yyy|sed 's!^[^=]*=!!'`
1286                       yyy=`echo $yyy|sed 's!=.*!!'` ;;
1287                  *)   xxx=`echo $yyy|sed 's!:.*!!'`
1288                       yyy=`echo $yyy|sed 's!^[^:]*:!!'` ;;
1289                  esac
1290                  ;;       
1291             esac
1292             case "$xxx" in
1293             append)
1294                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1295             clear)
1296                 echo "$yyy=''"                  >> posthint.sh ;;
1297             define)
1298                 case "$zzz" in
1299                 '') zzz=define ;;
1300                 esac
1301                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1302             eval)
1303                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1304             prepend)
1305                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1306             undef)
1307                 case "$zzz" in
1308                 '') zzz="$uuu" ;;
1309                 esac
1310                 echo "$yyy=$zzz"                >> posthint.sh ;;
1311             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1312             esac
1313             shift
1314             ;;
1315         -V) echo "$me generated by metaconfig 3.0 PL70." >&2
1316             exit 0;;
1317         --) break;;
1318         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1319         *) break;;
1320         esac
1321 done
1322
1323 case "$error" in
1324 true)
1325         cat >&2 <<EOM
1326 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1327                  [-U symbol] [-U symbol=] [-A command:symbol...]
1328   -d : use defaults for all answers.
1329   -e : go on without questioning past the production of config.sh.
1330   -f : specify an alternate default configuration file.
1331   -h : print this help message and exit (with an error status).
1332   -r : reuse C symbols value if possible (skips costly nm extraction).
1333   -s : silent mode, only echoes questions and essential information.
1334   -D : define symbol to have some value:
1335          -D symbol         symbol gets the value 'define'
1336          -D symbol=value   symbol gets the value 'value'
1337   -E : stop at the end of questions, after having produced config.sh.
1338   -K : do not use unless you know what you are doing.
1339   -O : let -D and -U override definitions from loaded configuration file.
1340   -S : perform variable substitutions on all .SH files (can mix with -f)
1341   -U : undefine symbol:
1342          -U symbol    symbol gets the value 'undef'
1343          -U symbol=   symbol gets completely empty
1344   -A : manipulate symbol after the platform specific hints have been applied:
1345          -A symbol=value                append " "value to symbol
1346          -A append:symbol=value         append value to symbol
1347          -A define:symbol=value         define symbol to have value
1348          -A clear:symbol                define symbol to be ''
1349          -A define:symbol               define symbol to be 'define'
1350          -A eval:symbol=value           define symbol to be eval of value
1351          -A prepend:symbol=value        prepend value to symbol
1352          -A undef:symbol                define symbol to be 'undef'
1353          -A undef:symbol=               define symbol to be ''
1354   -V : print version number and exit (with a zero status).
1355 EOM
1356         exit 1
1357         ;;
1358 esac
1359
1360 : Sanity checks
1361 case "$fastread$alldone" in
1362 yescont|yesexit) ;;
1363 *)
1364         case "$extractsh" in
1365         true) ;;
1366         *)
1367                 if test ! -t 0; then
1368                         echo "Say 'sh Configure', not 'sh <Configure'"
1369                         exit 1
1370                 fi
1371                 ;;
1372         esac
1373         ;;
1374 esac
1375
1376 exec 4>&1
1377 case "$silent" in
1378 true) exec 1>/dev/null;;
1379 esac
1380
1381 : run the defines and the undefines, if any, but leave the file out there...
1382 touch optdef.sh
1383 . ./optdef.sh
1384 : create the posthint manipulation script and leave the file out there...
1385 touch posthint.sh
1386
1387 : set package name
1388 package=perl5
1389 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1390 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1391 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1392 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1393 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1394 esac
1395
1396 : Some greps do not return status, grrr.
1397 echo "grimblepritz" >grimble
1398 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1399         contains=contains
1400 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1401         contains=grep
1402 else
1403         contains=contains
1404 fi
1405 rm -f grimble
1406 : the following should work in any shell
1407 case "$contains" in
1408 contains*)
1409         echo " "
1410         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1411         cat >contains <<'EOSS'
1412 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1413 EOSS
1414 chmod +x contains
1415 esac
1416
1417 : Find the path to the source tree
1418 case "$src" in
1419 '') case "$0" in
1420     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1421          case "$src" in
1422          /*)    ;;
1423          *)     src=`cd ../$src && pwd` ;;
1424          esac
1425          ;;
1426     *)   src='.';;
1427     esac;;
1428 esac
1429 case "$src" in
1430 '')     src=/
1431         rsrc=/
1432         ;;
1433 /*) rsrc="$src";;
1434 *) rsrc="../$src";;
1435 esac
1436 if test -f $rsrc/Configure && \
1437         $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1438 then
1439    : found it, so we are ok.
1440 else
1441         rsrc=''
1442         for src in . .. ../.. ../../.. ../../../..; do
1443                 if test -f ../$src/Configure && \
1444                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1445                 then
1446                         rsrc=../$src
1447                         break
1448                 fi
1449         done
1450 fi
1451 case "$rsrc" in
1452 '')
1453         cat <<EOM >&4
1454
1455 Sorry, I can't seem to locate the source dir for $package.  Please start
1456 Configure with an explicit path -- i.e. /some/path/Configure.
1457
1458 EOM
1459         exit 1
1460         ;;
1461 ../.)   rsrc='..';;
1462 *)
1463         echo " "
1464         echo "Sources for $package found in \"$src\"." >&4
1465         ;;
1466 esac
1467
1468 : script used to extract .SH files with variable substitutions
1469 cat >extract <<'EOS'
1470 CONFIGDOTSH=true
1471 echo "Doing variable substitutions on .SH files..."
1472 if test -f $src/MANIFEST; then
1473         set x `awk '{print $1}' <$src/MANIFEST | grep '\.SH$'`
1474 else
1475         echo "(Looking for .SH files under the source directory.)"
1476         set x `(cd $src; find . -name "*.SH" -print)`
1477 fi
1478 shift
1479 case $# in
1480 0) set x `(cd $src; echo *.SH)`; shift;;
1481 esac
1482 if test ! -f $src/$1; then
1483         shift
1484 fi
1485 mkdir_p='
1486 name=$1;
1487 create="";
1488 while test $name; do
1489         if test ! -d "$name"; then
1490                 create="$name $create";
1491                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1492                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1493         else
1494                 name="";
1495         fi;
1496 done;
1497 for file in $create; do
1498         mkdir $file;
1499 done
1500 '
1501 for file in $*; do
1502         case "$src" in
1503         ".")
1504                 case "$file" in
1505                 */*)
1506                         dir=`expr X$file : 'X\(.*\)/'`
1507                         file=`expr X$file : 'X.*/\(.*\)'`
1508                         (cd $dir && . ./$file)
1509                         ;;
1510                 *)
1511                         . ./$file
1512                         ;;
1513                 esac
1514                 ;;
1515         *)
1516                 case "$file" in
1517                 */*)
1518                         dir=`expr X$file : 'X\(.*\)/'`
1519                         file=`expr X$file : 'X.*/\(.*\)'`
1520                         (set x $dir; shift; eval $mkdir_p)
1521                         sh <$src/$dir/$file
1522                         ;;
1523                 *)
1524                         sh <$src/$file
1525                         ;;
1526                 esac
1527                 ;;
1528         esac
1529 done
1530 if test -f $src/config_h.SH; then
1531         if test ! -f config.h; then
1532         : oops, they left it out of MANIFEST, probably, so do it anyway.
1533         . $src/config_h.SH
1534         fi
1535 fi
1536 EOS
1537
1538 : extract files and exit if asked to do so
1539 case "$extractsh" in
1540 true)
1541         case "$realsilent" in
1542         true) ;;
1543         *) exec 1>&4;;
1544         esac
1545         case "$config_sh" in
1546         '') config_sh='config.sh';;
1547         esac
1548         echo " "
1549         echo "Fetching answers from $config_sh..."
1550         cd ..
1551         . $config_sh
1552         test "$override" && . ./optdef.sh
1553         echo " "
1554         . UU/extract
1555         rm -rf UU
1556         echo "Done."
1557         exit 0
1558         ;;
1559 esac
1560
1561 : Eunice requires " " instead of "", can you believe it
1562 echo " "
1563 : Here we go...
1564 echo "Beginning of configuration questions for $package."
1565
1566 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1567
1568 : first determine how to suppress newline on echo command
1569 echo " "
1570 echo "Checking echo to see how to suppress newlines..."
1571 (echo "hi there\c" ; echo " ") >.echotmp
1572 if $contains c .echotmp >/dev/null 2>&1 ; then
1573         echo "...using -n."
1574         n='-n'
1575         c=''
1576 else
1577         cat <<'EOM'
1578 ...using \c
1579 EOM
1580         n=''
1581         c='\c'
1582 fi
1583 echo $n "The star should be here-->$c"
1584 echo '*'
1585 rm -f .echotmp
1586
1587 : Now test for existence of everything in MANIFEST
1588 echo " "
1589 if test -f $rsrc/MANIFEST; then
1590         echo "First let's make sure your kit is complete.  Checking..." >&4
1591         awk '$1 !~ /PACK[A-Z]+/ {print $1}' $rsrc/MANIFEST | split -50
1592         rm -f missing
1593         tmppwd=`pwd`
1594         for filelist in x??; do
1595                 (cd $rsrc; ls `cat $tmppwd/$filelist` >/dev/null 2>>$tmppwd/missing)
1596         done
1597         if test -s missing; then
1598                 cat missing >&4
1599                 cat >&4 <<'EOM'
1600
1601 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1602
1603 You have the option of continuing the configuration process, despite the
1604 distinct possibility that your kit is damaged, by typing 'y'es.  If you
1605 do, don't blame me if something goes wrong.  I advise you to type 'n'o
1606 and contact the author (perlbug@perl.com).
1607
1608 EOM
1609                 echo $n "Continue? [n] $c" >&4
1610                 read ans
1611                 case "$ans" in
1612                 y*)
1613                         echo "Continuing..." >&4
1614                         rm -f missing
1615                         ;;
1616                 *)
1617                         echo "ABORTING..." >&4
1618                         kill $$
1619                         ;;
1620                 esac
1621         else
1622                 echo "Looks good..."
1623         fi
1624 else
1625         echo "There is no MANIFEST file.  I hope your kit is complete !"
1626 fi
1627 rm -f missing x??
1628
1629 echo " "
1630 : Find the appropriate value for a newline for tr
1631 if test -n "$DJGPP"; then
1632        trnl='\012'
1633 fi
1634 if test X"$trnl" = X; then
1635         case "`echo foo|tr '\n' x 2>/dev/null`" in
1636         foox) trnl='\n' ;;
1637         esac
1638 fi
1639 if test X"$trnl" = X; then
1640         case "`echo foo|tr '\012' x 2>/dev/null`" in
1641         foox) trnl='\012' ;;
1642         esac
1643 fi
1644 if test X"$trnl" = X; then
1645         cat <<EOM >&2
1646
1647 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
1648
1649 EOM
1650         exit 1
1651 fi
1652
1653 : compute the number of columns on the terminal for proper question formatting
1654 case "$COLUMNS" in
1655 '') COLUMNS='80';;
1656 esac
1657
1658 : set up the echo used in my read
1659 myecho="case \"\$xxxm\" in
1660 '') echo $n \"\$rp $c\" >&4;;
1661 *) case \"\$rp\" in
1662         '') echo $n \"[\$xxxm] $c\";;
1663         *)
1664                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
1665                         echo \"\$rp\" >&4
1666                         echo $n \"[\$xxxm] $c\" >&4
1667                 else
1668                         echo $n \"\$rp [\$xxxm] $c\" >&4
1669                 fi
1670                 ;;
1671         esac;;
1672 esac"
1673
1674 : now set up to do reads with possible shell escape and default assignment
1675 cat <<EOSC >myread
1676 $startsh
1677 xxxm=\$dflt
1678 $myecho
1679 ans='!'
1680 case "\$fastread" in
1681 yes) case "\$dflt" in
1682         '') ;;
1683         *) ans='';
1684                 case "\$silent-\$rp" in
1685                 true-) ;;
1686                 *) echo " " >&4;;
1687                 esac;;
1688         esac;;
1689 *) case "\$silent" in
1690         true) case "\$rp" in
1691                 '') ans='';;
1692                 esac;;
1693         esac;;
1694 esac
1695 while expr "X\$ans" : "X!" >/dev/null; do
1696         read answ
1697         set x \$xxxm
1698         shift
1699         aok=''; eval "ans=\\"\$answ\\"" && aok=y
1700         case  "\$answ" in
1701         "!")
1702                 sh 1>&4
1703                 echo " "
1704                 $myecho
1705                 ;;
1706         !*)
1707                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
1708                 shift
1709                 sh 1>&4 -c "\$*"
1710                 echo " "
1711                 $myecho
1712                 ;;
1713         "\$ans")
1714                 case "\$ans" in
1715                 \\&*)
1716                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
1717                         shift
1718                         case "\$1" in
1719                         -d)
1720                                 fastread=yes
1721                                 echo "(OK, I'll run with -d after this question.)" >&4
1722                                 ;;
1723                         -*)
1724                                 echo "*** Sorry, \$1 not supported yet." >&4
1725                                 ;;
1726                         esac
1727                         $myecho
1728                         ans=!
1729                         ;;
1730                 esac;;
1731         *)
1732                 case "\$aok" in
1733                 y)
1734                         echo "*** Substitution done -- please confirm."
1735                         xxxm="\$ans"
1736                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
1737                         xxxm="\$ans"
1738                         ans=!
1739                         ;;
1740                 *)
1741                         echo "*** Error -- try again."
1742                         ans=!
1743                         ;;
1744                 esac
1745                 $myecho
1746                 ;;
1747         esac
1748         case "\$ans\$xxxm\$nostick" in
1749         '')
1750                 ans=!
1751                 $myecho
1752                 ;;
1753         esac
1754 done
1755 case "\$ans" in
1756 '') ans="\$xxxm";;
1757 esac
1758 EOSC
1759
1760 : create .config dir to save info across Configure sessions
1761 test -d ../.config || mkdir ../.config
1762 cat >../.config/README <<EOF
1763 This directory created by Configure to save information that should
1764 persist across sessions for $package.
1765
1766 You may safely delete it if you wish.
1767 EOF
1768
1769 xpatchlevel=`awk '/define[      ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
1770 case "$usedevel" in
1771 $define|true|[yY]*) ;;
1772 *) case "$xpatchlevel" in
1773    *[13579])
1774         cat >&4 <<EOH
1775 *** WHOA THERE!!! ***
1776
1777     This is an UNSTABLE DEVELOPMENT release.
1778     (The patchlevel, $xpatchlevel, is odd--as opposed to even,
1779      and that signifies a development release.  If you want a
1780      maintenance release, you want an even-numbered release.)
1781
1782     Do ***NOT*** install this into production use.
1783     Data corruption and crashes are possible.
1784
1785     It is most seriously suggested that you do not continue any further
1786     unless you want to help in developing and debugging Perl.
1787
1788 EOH
1789         rp='Do you really want to continue?'
1790         dflt='n'
1791         . ./myread
1792         case "$ans" in
1793         [yY]) echo >&4 "Okay, continuing." ;;
1794         *) echo >&4 "Okay, bye."
1795            exit 1
1796            ;;
1797         esac
1798         ;;
1799     esac
1800     ;;
1801 esac
1802
1803 : general instructions
1804 needman=true
1805 firsttime=true
1806 user=`(logname) 2>/dev/null`
1807 case "$user" in
1808 '') user=`whoami 2>&1`;;
1809 esac
1810 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
1811         firsttime=false
1812         echo " "
1813         rp='Would you like to see the instructions?'
1814         dflt=n
1815         . ./myread
1816         case "$ans" in
1817         [yY]*) ;;
1818         *) needman=false;;
1819         esac
1820 fi
1821 if $needman; then
1822         cat <<EOH
1823
1824 This installation shell script will examine your system and ask you questions
1825 to determine how the perl5 package should be installed. If you get
1826 stuck on a question, you may use a ! shell escape to start a subshell or
1827 execute a command.  Many of the questions will have default answers in square
1828 brackets; typing carriage return will give you the default.
1829
1830 On some of the questions which ask for file or directory names you are allowed
1831 to use the ~name construct to specify the login directory belonging to "name",
1832 even if you don't have a shell which knows about that.  Questions where this is
1833 allowed will be marked "(~name ok)".
1834
1835 EOH
1836         rp=''
1837         dflt='Type carriage return to continue'
1838         . ./myread
1839         cat <<'EOH'
1840
1841 The prompter used in this script allows you to use shell variables and
1842 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
1843 in the default answer, as if the default line was a set of arguments given to a
1844 script shell.  This means you may also use $* to repeat the whole default line,
1845 so you do not have to re-type everything to add something to the default.
1846
1847 Everytime there is a substitution, you will have to confirm.  If there is an
1848 error (e.g. an unmatched backtick), the default answer will remain unchanged
1849 and you will be prompted again.
1850
1851 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
1852 the questions and use the computed defaults (or the previous answers if there
1853 was already a config.sh file). Type 'Configure -h' for a list of options.
1854 You may also start interactively and then answer '& -d' at any prompt to turn
1855 on the non-interactive behaviour for the remainder of the execution.
1856
1857 EOH
1858         . ./myread
1859         cat <<EOH
1860
1861 Much effort has been expended to ensure that this shell script will run on any
1862 Unix system.  If despite that it blows up on yours, your best bet is to edit
1863 Configure and run it again.  If you can't run Configure for some reason,
1864 you'll have to generate a config.sh file by hand.  Whatever problems you
1865 have, let me (perlbug@perl.com) know how I blew it.
1866
1867 This installation script affects things in two ways:
1868
1869 1) it may do direct variable substitutions on some of the files included
1870    in this kit.
1871 2) it builds a config.h file for inclusion in C programs.  You may edit
1872    any of these files as the need arises after running this script.
1873
1874 If you make a mistake on a question, there is no easy way to back up to it
1875 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
1876 files.  Configure will offer to let you do this before it runs the SH files.
1877
1878 EOH
1879         dflt='Type carriage return to continue'
1880         . ./myread
1881         case "$firsttime" in
1882         true) echo $user >>../.config/instruct;;
1883         esac
1884 fi
1885
1886 : find out where common programs are
1887 echo " "
1888 echo "Locating common programs..." >&4
1889 cat <<EOSC >loc
1890 $startsh
1891 case \$# in
1892 0) exit 1;;
1893 esac
1894 thing=\$1
1895 shift
1896 dflt=\$1
1897 shift
1898 for dir in \$*; do
1899         case "\$thing" in
1900         .)
1901         if test -d \$dir/\$thing; then
1902                 echo \$dir
1903                 exit 0
1904         fi
1905         ;;
1906         *)
1907         for thisthing in \$dir/\$thing; do
1908                 : just loop through to pick last item
1909         done
1910         if test -f \$thisthing; then
1911                 echo \$thisthing
1912                 exit 0
1913         elif test -f \$dir/\$thing.exe; then
1914                 if test -n "$DJGPP"; then
1915                         echo \$dir/\$thing.exe
1916                 else
1917                         : on Eunice apparently
1918                         echo \$dir/\$thing
1919                 fi
1920                 exit 0
1921         fi
1922         ;;
1923         esac
1924 done
1925 echo \$dflt
1926 exit 1
1927 EOSC
1928 chmod +x loc
1929 $eunicefix loc
1930 loclist="
1931 awk
1932 cat
1933 comm
1934 cp
1935 echo
1936 expr
1937 grep
1938 ls
1939 make
1940 mkdir
1941 rm
1942 sed
1943 sort
1944 touch
1945 tr
1946 uniq
1947 "
1948 trylist="
1949 Mcc
1950 ar
1951 byacc
1952 cpp
1953 csh
1954 date
1955 egrep
1956 gzip
1957 less
1958 ln
1959 more
1960 nm
1961 nroff
1962 pg
1963 test
1964 uname
1965 zip
1966 "
1967 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1968 pth="$pth /lib /usr/lib"
1969 for file in $loclist; do
1970         eval xxx=\$$file
1971         case "$xxx" in
1972         /*|?:[\\/]*)
1973                 if test -f "$xxx"; then
1974                         : ok
1975                 else
1976                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
1977                         xxx=`./loc $file $file $pth`
1978                 fi
1979                 ;;
1980         '') xxx=`./loc $file $file $pth`;;
1981         *) xxx=`./loc $xxx $xxx $pth`;;
1982         esac
1983         eval $file=$xxx
1984         eval _$file=$xxx
1985         case "$xxx" in
1986         /*)
1987                 echo $file is in $xxx.
1988                 ;;
1989         ?:[\\/]*)
1990                 echo $file is in $xxx.
1991                 ;;
1992         *)
1993                 echo "I don't know where '$file' is, and my life depends on it." >&4
1994                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
1995                 exit 1
1996                 ;;
1997         esac
1998 done
1999 echo " "
2000 echo "Don't worry if any of the following aren't found..."
2001 say=offhand
2002 for file in $trylist; do
2003         eval xxx=\$$file
2004         case "$xxx" in
2005         /*|?:[\\/]*)
2006                 if test -f "$xxx"; then
2007                         : ok
2008                 else
2009                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2010                         xxx=`./loc $file $file $pth`
2011                 fi
2012                 ;;
2013         '') xxx=`./loc $file $file $pth`;;
2014         *) xxx=`./loc $xxx $xxx $pth`;;
2015         esac
2016         eval $file=$xxx
2017         eval _$file=$xxx
2018         case "$xxx" in
2019         /*)
2020                 echo $file is in $xxx.
2021                 ;;
2022         ?:[\\/]*)
2023                 echo $file is in $xxx.
2024                 ;;
2025         *)
2026                 echo "I don't see $file out there, $say."
2027                 say=either
2028                 ;;
2029         esac
2030 done
2031 case "$egrep" in
2032 egrep)
2033         echo "Substituting grep for egrep."
2034         egrep=$grep
2035         ;;
2036 esac
2037 case "$ln" in
2038 ln)
2039         echo "Substituting cp for ln."
2040         ln=$cp
2041         ;;
2042 esac
2043 case "$test" in
2044 test)
2045         echo "Hopefully test is built into your sh."
2046         ;;
2047 *)
2048         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2049                 echo "Using the test built into your sh."
2050                 test=test
2051                 _test=test
2052         fi
2053         ;;
2054 esac
2055 case "$echo" in
2056 echo)
2057         echo "Hopefully echo is built into your sh."
2058         ;;
2059 '') ;;
2060 *)
2061         echo " "
2062 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2063         $echo $n "hi there$c" >foo1
2064         echo $n "hi there$c" >foo2
2065         if cmp foo1 foo2 >/dev/null 2>&1; then
2066                 echo "They are compatible.  In fact, they may be identical."
2067         else
2068                 case "$n" in
2069                 '-n') n='' c='\c';;
2070                 *) n='-n' c='';;
2071                 esac
2072                 cat <<FOO
2073 They are not compatible!  You are probably running ksh on a non-USG system.
2074 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2075 have echo built in and we may have to run some Bourne shell scripts.  That
2076 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2077
2078 FOO
2079                 $echo $n "The star should be here-->$c"
2080                 $echo "*"
2081         fi
2082         $rm -f foo1 foo2
2083         ;;
2084 esac
2085
2086 cat <<EOS >checkcc
2087 $startsh
2088 EOS
2089 cat <<'EOSC' >>checkcc
2090 case "$cc" in
2091 '') ;;
2092 *)  $rm -f try try.*
2093     $cat >try.c <<EOM
2094 int main(int argc, char *argv[]) {
2095   return 0;
2096 }
2097 EOM
2098     if $cc -o try try.c; then
2099        :
2100     else
2101         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2102         despair=yes
2103         trygcc=yes
2104         case "$cc" in
2105         *gcc*) trygcc=no ;;
2106         esac
2107         case "`$cc -v -c try.c 2>&1`" in
2108         *gcc*) trygcc=no ;;
2109         esac
2110         if $test X"$trygcc" = Xyes; then
2111             if gcc -o try -c try.c; then
2112                 echo " "
2113                 echo "You seem to have a working gcc, though." >&4
2114                 rp="Would you like to use it?"
2115                 dflt=y
2116                 if $test -f myread; then
2117                     . ./myread
2118                 else
2119                     if $test -f UU/myread; then
2120                         . ./UU/myread
2121                     else
2122                         echo "Cannot find myread, sorry.  Aborting." >&2
2123                         exit 1
2124                     fi
2125                 fi  
2126                 case "$ans" in
2127                 [yY]*) cc=gcc; ccflags=''; despair=no ;;
2128                 esac
2129             fi
2130         fi
2131         if $test X"$despair" = Xyes; then
2132             echo "You need to find a working C compiler." >&4
2133             echo "I cannot continue any further, aborting." >&4
2134             exit 1
2135         fi
2136     fi
2137     $rm -f try try.*
2138     ;;
2139 esac
2140 EOSC
2141
2142 : determine whether symbolic links are supported
2143 echo " "
2144 $touch blurfl
2145 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2146         echo "Symbolic links are supported." >&4
2147         lns="$ln -s"
2148 else
2149         echo "Symbolic links are NOT supported." >&4
2150         lns="$ln"
2151 fi
2152 $rm -f blurfl sym
2153
2154 : see whether [:lower:] and [:upper:] are supported character classes
2155 echo " "
2156 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2157 ABYZ)
2158         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2159         up='[:upper:]'
2160         low='[:lower:]'
2161         ;;
2162 *)      # There is a discontinuity in EBCDIC between 'I' and 'J'
2163         # (0xc9 and 0xd1), therefore that is a nice testing point.
2164         if test "X$up" = X -o "X$low" = X; then
2165             case "`echo IJ | $tr '[I-J]' '[i-j]' 2>/dev/null`" in
2166             ij) up='[A-Z]'
2167                 low='[a-z]'
2168                 ;;
2169             esac
2170         fi
2171         if test "X$up" = X -o "X$low" = X; then
2172             case "`echo IJ | $tr I-J i-j 2>/dev/null`" in
2173             ij) up='A-Z'
2174                 low='a-z'
2175                 ;;
2176             esac
2177         fi
2178         if test "X$up" = X -o "X$low" = X; then
2179             case "`echo IJ | od -x 2>/dev/null`" in
2180             *C9D1*|*c9d1*)
2181                 echo "Hey, this might be EBCDIC." >&4
2182                 if test "X$up" = X -o "X$low" = X; then
2183                     case "`echo IJ | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
2184                     ij) up='[A-IJ-RS-Z]'
2185                         low='[a-ij-rs-z]'
2186                         ;;
2187                     esac
2188                 fi
2189                 if test "X$up" = X -o "X$low" = X; then
2190                     case "`echo IJ | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
2191                     ij) up='A-IJ-RS-Z'
2192                         low='a-ij-rs-z'
2193                         ;;
2194                     esac
2195                 fi
2196                 ;;
2197             esac
2198         fi
2199 esac
2200 case "`echo IJ | $tr \"$up\" \"$low\" 2>/dev/null`" in
2201 ij)
2202     echo "Using $up and $low to convert case." >&4
2203     ;;
2204 *)
2205     echo "I don't know how to translate letters from upper to lower case." >&4
2206     echo "Your tr is not acting any way I know of." >&4
2207     exit 1
2208     ;;
2209 esac
2210 : set up the translation script tr, must be called with ./tr of course
2211 cat >tr <<EOSC
2212 $startsh
2213 case "\$1\$2" in
2214 '[A-Z][a-z]') exec $tr '$up' '$low';;
2215 '[a-z][A-Z]') exec $tr '$low' '$up';;
2216 esac
2217 exec $tr "\$@"
2218 EOSC
2219 chmod +x tr
2220 $eunicefix tr
2221
2222 : Try to determine whether config.sh was made on this system
2223 case "$config_sh" in
2224 '')
2225 myuname=`$uname -a 2>/dev/null`
2226 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
2227 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
2228 # because the A-Z/a-z are not consecutive.
2229 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
2230         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
2231 newmyuname="$myuname"
2232 dflt=n
2233 case "$knowitall" in
2234 '')
2235         if test -f ../config.sh; then
2236                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
2237                         eval "`grep myuname= ../config.sh`"
2238                 fi
2239                 if test "X$myuname" = "X$newmyuname"; then
2240                         dflt=y
2241                 fi
2242         fi
2243         ;;
2244 *) dflt=y;;
2245 esac
2246
2247 : Get old answers from old config file if Configure was run on the
2248 : same system, otherwise use the hints.
2249 hint=default
2250 cd ..
2251 if test -f config.sh; then
2252         echo " "
2253         rp="I see a config.sh file.  Shall I use it to set the defaults?"
2254         . UU/myread
2255         case "$ans" in
2256         n*|N*) echo "OK, I'll ignore it."; mv config.sh config.sh.old;;
2257         *)  echo "Fetching default answers from your old config.sh file..." >&4
2258                 tmp_n="$n"
2259                 tmp_c="$c"
2260                 tmp_sh="$sh"
2261                 . ./config.sh
2262                 cp config.sh UU
2263                 n="$tmp_n"
2264                 c="$tmp_c"
2265                 : Older versions did not always set $sh.  Catch re-use of such
2266                 : an old config.sh.
2267                 case "$sh" in
2268                 '') sh="$tmp_sh" ;;
2269                 esac
2270                 hint=previous
2271                 ;;
2272         esac
2273 fi
2274 . ./UU/checkcc
2275 if test ! -f config.sh; then
2276         $cat <<EOM
2277
2278 First time through, eh?  I have some defaults handy for some systems
2279 that need some extra help getting the Configure answers right:
2280
2281 EOM
2282         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
2283         dflt=''
2284         : Half the following guesses are probably wrong... If you have better
2285         : tests or hints, please send them to perlbug@perl.com
2286         : The metaconfig authors would also appreciate a copy...
2287         $test -f /irix && osname=irix
2288         $test -f /xenix && osname=sco_xenix
2289         $test -f /dynix && osname=dynix
2290         $test -f /dnix && osname=dnix
2291         $test -f /lynx.os && osname=lynxos
2292         $test -f /unicos && osname=unicos && osvers=`$uname -r`
2293         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
2294         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
2295         $test -f /bin/mips && /bin/mips && osname=mips
2296         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
2297                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
2298         $test -d /usr/apollo/bin && osname=apollo
2299         $test -f /etc/saf/_sactab && osname=svr4
2300         $test -d /usr/include/minix && osname=minix
2301         if $test -d /MachTen -o -d /MachTen_Folder; then
2302                 osname=machten
2303                 if $test -x /sbin/version; then
2304                         osvers=`/sbin/version | $awk '{print $2}' |
2305                         $sed -e 's/[A-Za-z]$//'`
2306                 elif $test -x /usr/etc/version; then
2307                         osvers=`/usr/etc/version | $awk '{print $2}' |
2308                         $sed -e 's/[A-Za-z]$//'`
2309                 else
2310                         osvers="$2.$3"
2311                 fi
2312         fi
2313
2314         $test -f /sys/posix.dll &&
2315                 $test -f /usr/bin/what &&
2316                 set X `/usr/bin/what /sys/posix.dll` &&
2317                 $test "$3" = UWIN &&
2318                 osname=uwin &&
2319                 osvers="$5"
2320
2321         if $test -f $uname; then
2322                 set X $myuname
2323                 shift
2324
2325                 case "$5" in
2326                 fps*) osname=fps ;;
2327                 mips*)
2328                         case "$4" in
2329                         umips) osname=umips ;;
2330                         *) osname=mips ;;
2331                         esac;;
2332                 [23]100) osname=mips ;;
2333                 next*) osname=next ;;
2334                 i386*)
2335                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
2336                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
2337                                 osname='sco'
2338                                 osvers=$tmp
2339                         elif $test -f /etc/kconfig; then
2340                                 osname=isc
2341                                 if test "$lns" = "$ln -s"; then
2342                                         osvers=4
2343                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
2344                                         osvers=3
2345                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
2346                                         osvers=2
2347                                 fi
2348                         fi
2349                         tmp=''
2350                         ;;
2351                 pc*)
2352                         if test -n "$DJGPP"; then
2353                                 osname=dos
2354                                 osvers=djgpp
2355                         fi
2356                         ;;
2357                 esac
2358
2359                 case "$1" in
2360                 aix) osname=aix
2361                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
2362                         case "$tmp" in
2363                         'not found') osvers="$4"."$3" ;;
2364                         '<3240'|'<>3240') osvers=3.2.0 ;;
2365                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
2366                         '=3250'|'>3250') osvers=3.2.5 ;;
2367                         *) osvers=$tmp;;
2368                         esac
2369                         ;;
2370                 bsd386) osname=bsd386
2371                         osvers=`$uname -r`
2372                         ;;
2373                 cygwin*) osname=cygwin
2374                         osvers="$3"
2375                         ;;
2376                 *dc.osx) osname=dcosx
2377                         osvers="$3"
2378                         ;;
2379                 dnix) osname=dnix
2380                         osvers="$3"
2381                         ;;
2382                 domainos) osname=apollo
2383                         osvers="$3"
2384                         ;;
2385                 dgux) osname=dgux 
2386                         osvers="$3"
2387                         ;;
2388                 dynixptx*) osname=dynixptx
2389                         osvers=`echo "$4"|sed 's/^v//'`
2390                         ;;
2391                 freebsd) osname=freebsd 
2392                         osvers="$3" ;;
2393                 genix) osname=genix ;;
2394                 hp*) osname=hpux 
2395                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
2396                         ;;
2397                 irix*) osname=irix
2398                         case "$3" in
2399                         4*) osvers=4 ;;
2400                         5*) osvers=5 ;;
2401                         *)      osvers="$3" ;;
2402                         esac
2403                         ;;
2404                 linux) osname=linux
2405                         case "$3" in
2406                         *)      osvers="$3" ;;
2407                         esac
2408                         ;;
2409                 MiNT) osname=mint
2410                         ;;
2411                 netbsd*) osname=netbsd
2412                         osvers="$3"
2413                         ;;
2414                 news-os) osvers="$3"
2415                         case "$3" in
2416                         4*) osname=newsos4 ;;
2417                         *) osname=newsos ;;
2418                         esac
2419                         ;;
2420                 next*) osname=next ;;
2421                 POSIX-BC | posix-bc ) osname=posix-bc
2422                         osvers="$3"
2423                         ;;
2424                 powerux | power_ux | powermax_os | powermaxos | \
2425                 powerunix | power_unix) osname=powerux
2426                         osvers="$3"
2427                         ;;
2428                 qnx) osname=qnx
2429                         osvers="$4"
2430                         ;;
2431                 solaris) osname=solaris
2432                         case "$3" in
2433                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
2434                         *)      osvers="$3" ;;
2435                         esac
2436                         ;;
2437                 sunos) osname=sunos
2438                         case "$3" in
2439                         5*) osname=solaris
2440                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
2441                         *)      osvers="$3" ;;
2442                         esac
2443                         ;;
2444                 titanos) osname=titanos
2445                         case "$3" in
2446                         1*) osvers=1 ;;
2447                         2*) osvers=2 ;;
2448                         3*) osvers=3 ;;
2449                         4*) osvers=4 ;;
2450                         *)      osvers="$3" ;;
2451                         esac
2452                         ;;
2453                 ultrix) osname=ultrix
2454                         osvers="$3"
2455                         ;;
2456                 osf1|mls+)      case "$5" in
2457                                 alpha)
2458                                         osname=dec_osf
2459                                         osvers=`sizer -v | awk '{print $3}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
2460                                         case "$osvers" in
2461                                         [1-9].[0-9]*) ;;
2462                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
2463                                         esac
2464                                         ;;
2465                         hp*)    osname=hp_osf1  ;;
2466                         mips)   osname=mips_osf1 ;;
2467                         esac
2468                         ;;
2469                 unixware) osname=svr5
2470                         osvers="$4"
2471                         ;;
2472                 uts) osname=uts
2473                         osvers="$3"
2474                         ;;
2475                 $2) case "$osname" in
2476                         *isc*) ;;
2477                         *freebsd*) ;;
2478                         svr*)
2479                                 : svr4.x or possibly later
2480                                 case "svr$3" in 
2481                                 ${osname}*)
2482                                         osname=svr$3
2483                                         osvers=$4
2484                                         ;;
2485                                 esac
2486                                 case "$osname" in
2487                                 svr4.0)
2488                                         : Check for ESIX
2489                                         if test -f /stand/boot ; then
2490                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
2491                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
2492                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
2493                                                         if test -n "$isesix"; then
2494                                                                 osname=esix4
2495                                                         fi
2496                                                 fi
2497                                         fi
2498                                         ;;
2499                                 esac
2500                                 ;;
2501                         *)      if test -f /etc/systemid; then
2502                                         osname=sco
2503                                         set `echo $3 | $sed 's/\./ /g'` $4
2504                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
2505                                                 osvers=$1.$2.$3
2506                                         elif $test -f $src/hints/sco_$1_$2.sh; then
2507                                                 osvers=$1.$2
2508                                         elif $test -f $src/hints/sco_$1.sh; then
2509                                                 osvers=$1
2510                                         fi
2511                                 else
2512                                         case "$osname" in
2513                                         '') : Still unknown.  Probably a generic Sys V.
2514                                                 osname="sysv"
2515                                                 osvers="$3"
2516                                                 ;;
2517                                         esac
2518                                 fi
2519                                 ;;
2520                         esac
2521                         ;;
2522                 *)      case "$osname" in
2523                         '') : Still unknown.  Probably a generic BSD.
2524                                 osname="$1"
2525                                 osvers="$3"
2526                                 ;;
2527                         esac
2528                         ;;
2529                 esac
2530         else
2531                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
2532                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
2533                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
2534                                 osname=news_os
2535                         fi
2536                         $rm -f UU/kernel.what
2537                 elif test -d c:/.; then
2538                         set X $myuname
2539                         osname=os2
2540                         osvers="$5"
2541                 fi
2542         fi
2543         
2544         : Now look for a hint file osname_osvers, unless one has been
2545         : specified already.
2546         case "$hintfile" in
2547         ''|' ')
2548                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
2549                 : Also try without trailing minor version numbers.
2550                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
2551                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
2552                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
2553                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
2554                 case "$file" in
2555                 '') dflt=none ;;
2556                 *)  case "$osvers" in
2557                         '') dflt=$file
2558                                 ;;
2559                         *)  if $test -f $src/hints/$file.sh ; then
2560                                         dflt=$file
2561                                 elif $test -f $src/hints/$xfile.sh ; then
2562                                         dflt=$xfile
2563                                 elif $test -f $src/hints/$xxfile.sh ; then
2564                                         dflt=$xxfile
2565                                 elif $test -f $src/hints/$xxxfile.sh ; then
2566                                         dflt=$xxxfile
2567                                 elif $test -f $src/hints/$xxxxfile.sh ; then
2568                                         dflt=$xxxxfile
2569                                 elif $test -f "$src/hints/${osname}.sh" ; then
2570                                         dflt="${osname}"
2571                                 else
2572                                         dflt=none
2573                                 fi
2574                                 ;;
2575                         esac
2576                         ;;
2577                 esac
2578                 if $test -f Policy.sh ; then
2579                         case "$dflt" in
2580                         *Policy*) ;;
2581                         none) dflt="Policy" ;;
2582                         *) dflt="Policy $dflt" ;;
2583                         esac
2584                 fi
2585                 ;;
2586         *)
2587                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
2588                 ;;
2589         esac
2590
2591         if $test -f Policy.sh ; then
2592                 $cat <<EOM
2593
2594 There's also a Policy hint file available, which should make the
2595 site-specific (policy) questions easier to answer.
2596 EOM
2597
2598         fi
2599
2600         $cat <<EOM
2601
2602 You may give one or more space-separated answers, or "none" if appropriate.
2603 A well-behaved OS will have no hints, so answering "none" or just "Policy"
2604 is a good thing.  DO NOT give a wrong version or a wrong OS.
2605
2606 EOM
2607
2608         rp="Which of these apply, if any?"
2609         . UU/myread
2610         tans=$ans
2611         for file in $tans; do
2612                 if $test X$file = XPolicy -a -f Policy.sh; then
2613                         . Policy.sh
2614                         $cat Policy.sh >> UU/config.sh
2615                 elif $test -f $src/hints/$file.sh; then
2616                         . $src/hints/$file.sh
2617                         $cat $src/hints/$file.sh >> UU/config.sh
2618                 elif $test X$tans = X -o X$tans = Xnone ; then
2619                         : nothing
2620                 else
2621                         : Give one chance to correct a possible typo.
2622                         echo "$file.sh does not exist"
2623                         dflt=$file
2624                         rp="hint to use instead?"
2625                         . UU/myread
2626                         for file in $ans; do
2627                                 if $test -f "$src/hints/$file.sh"; then
2628                                         . $src/hints/$file.sh
2629                                         $cat $src/hints/$file.sh >> UU/config.sh
2630                                 elif $test X$ans = X -o X$ans = Xnone ; then
2631                                         : nothing
2632                                 else
2633                                         echo "$file.sh does not exist -- ignored."
2634                                 fi
2635                         done
2636                 fi
2637         done
2638
2639         hint=recommended
2640         : Remember our hint file for later.
2641         if $test -f "$src/hints/$file.sh" ; then
2642                 hintfile="$file"
2643         else
2644                 hintfile=''
2645         fi
2646 fi
2647 cd UU
2648 ;;
2649 *)
2650         echo " "
2651         echo "Fetching default answers from $config_sh..." >&4
2652         tmp_n="$n"
2653         tmp_c="$c"
2654         cd ..
2655         cp $config_sh config.sh 2>/dev/null
2656         chmod +w config.sh
2657         . ./config.sh
2658         cd UU
2659         cp ../config.sh .
2660         n="$tmp_n"
2661         c="$tmp_c"
2662         hint=previous
2663         ;;
2664 esac
2665 test "$override" && . ./optdef.sh
2666 myuname="$newmyuname"
2667
2668 : Restore computed paths
2669 for file in $loclist $trylist; do
2670         eval $file="\$_$file"
2671 done
2672
2673 cat << EOM
2674
2675 Configure uses the operating system name and version to set some defaults.
2676 The default value is probably right if the name rings a bell. Otherwise,
2677 since spelling matters for me, either accept the default or answer "none"
2678 to leave it blank.
2679
2680 EOM
2681 case "$osname" in
2682         ''|' ')
2683                 case "$hintfile" in
2684                 ''|' '|none) dflt=none ;;
2685                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
2686                 esac
2687                 ;;
2688         *) dflt="$osname" ;;
2689 esac
2690 rp="Operating system name?"
2691 . ./myread
2692 case "$ans" in
2693 none)  osname='' ;;
2694 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
2695 esac
2696 echo " "
2697 case "$osvers" in
2698         ''|' ')
2699                 case "$hintfile" in
2700                 ''|' '|none) dflt=none ;;
2701                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
2702                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
2703                         case "$dflt" in
2704                         ''|' ') dflt=none ;;
2705                         esac
2706                         ;;
2707                 esac
2708                 ;;
2709         *) dflt="$osvers" ;;
2710 esac
2711 rp="Operating system version?"
2712 . ./myread
2713 case "$ans" in
2714 none)  osvers='' ;;
2715 *) osvers="$ans" ;;
2716 esac
2717
2718
2719 . ./posthint.sh
2720
2721 : who configured the system
2722 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
2723 cf_by=`(logname) 2>/dev/null`
2724 case "$cf_by" in
2725 "")
2726         cf_by=`(whoami) 2>/dev/null`
2727         case "$cf_by" in
2728         "") cf_by=unknown ;;
2729         esac ;;
2730 esac
2731
2732 : set up the script used to warn in case of inconsistency
2733 cat <<EOS >whoa
2734 $startsh
2735 EOS
2736 cat <<'EOSC' >>whoa
2737 dflt=y
2738 echo " "
2739 echo "*** WHOA THERE!!! ***" >&4
2740 echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
2741 rp="    Keep the $hint value?"
2742 . ./myread
2743 case "$ans" in
2744 y) td=$was; tu=$was;;
2745 esac
2746 EOSC
2747
2748 : function used to set $1 to $val
2749 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
2750 case "$val$was" in
2751 $define$undef) . ./whoa; eval "$var=\$td";;
2752 $undef$define) . ./whoa; eval "$var=\$tu";;
2753 *) eval "$var=$val";;
2754 esac'
2755
2756 case "$usethreads" in
2757 $define|true|[yY]*)     dflt='y';;
2758 *) dflt='n';;
2759 esac
2760 cat <<EOM
2761
2762 Perl can be built to take advantage of threads on some systems.
2763 To do so, Configure can be run with -Dusethreads.
2764
2765 Note that threading is a highly experimental feature, and
2766 some known race conditions still remain.  If you choose to try
2767 it, be very sure to not actually deploy it for production
2768 purposes.  README.threads has more details, and is required
2769 reading if you enable threads.
2770
2771 If this doesn't make any sense to you, just accept the default '$dflt'.
2772 EOM
2773 rp='Build a threading Perl?'
2774 . ./myread
2775 case "$ans" in
2776 y|Y)    val="$define" ;;
2777 *)      val="$undef" ;;
2778 esac
2779 set usethreads
2780 eval $setvar
2781
2782 case "$usethreads" in
2783 $define)
2784         $cat <<EOM
2785
2786 As of 5.5.640, Perl has two different internal threading implementations,
2787 the 5.005 version (5005threads) and an interpreter-based version
2788 (ithreads) that has one interpreter per thread.  Both are very 
2789 experimental.  This arrangement exists to help developers work out
2790 which one is better.
2791
2792 If you're a casual user, you probably don't want interpreter-threads
2793 at this time.  There doesn't yet exist a way to create threads from
2794 within Perl in this model, i.e., "use Thread;" will NOT work.
2795 EOM
2796         : Default to ithreads unless overridden on command line or with
2797         : old config.sh
2798         dflt='y'
2799         case "$use5005threads" in
2800                 $define|true|[yY]*) dflt='n';;
2801         esac
2802         case "$useithreads" in
2803                 $undef|false|[nN]*) dflt='n';;
2804         esac
2805         rp='Use interpreter-based ithreads?'
2806         . ./myread
2807         case "$ans" in
2808         y|Y)    val="$define" ;;
2809         *)      val="$undef" ;;
2810         esac
2811         set useithreads
2812         eval $setvar
2813         : Now set use5005threads to the opposite value.
2814         case "$useithreads" in
2815         $define) val="$undef" ;;
2816         *) val="$define" ;;
2817         esac
2818         set use5005threads
2819         eval $setvar
2820         ;;
2821 *)
2822         useithreads="$undef"
2823         use5005threads="$undef"
2824         ;;
2825 esac
2826
2827 case "$d_oldpthreads" in
2828 '')     : Configure tests would be welcome here.  For now, assume undef.
2829         val="$undef" ;;
2830 *)      val="$d_oldpthreads" ;;
2831 esac
2832 set d_oldpthreads
2833 eval $setvar
2834
2835
2836 case "$usethreads" in
2837 "$define"|true|[yY]*)
2838 : Look for a hint-file generated 'call-back-unit'.  If the
2839 : user has specified that a threading perl is to be built,
2840 : we may need to set or change some other defaults.
2841         if $test -f usethreads.cbu; then
2842                 echo "Your platform has some specific hints for threaded builds, using them..."
2843                 . ./usethreads.cbu
2844         else
2845                 $cat <<EOM
2846 (Your platform doesn't have any specific hints for threaded builds.
2847  Assuming POSIX threads, then.)
2848 EOM
2849         fi
2850         ;;
2851 esac
2852
2853 cat <<EOM
2854
2855 Perl can be built so that multiple Perl interpreters can coexist
2856 within the same Perl executable.
2857 EOM
2858
2859 case "$useithreads" in
2860 $define)
2861         cat <<EOM
2862 This multiple interpreter support is required for interpreter-based threads.
2863 EOM
2864         val="$define"
2865         ;;
2866 *)      case "$usemultiplicity" in
2867         $define|true|[yY]*)     dflt='y';;
2868         *) dflt='n';;
2869         esac
2870         echo " "
2871         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
2872         rp='Build Perl for multiplicity?'
2873         . ./myread
2874         case "$ans" in
2875         y|Y)    val="$define" ;;
2876         *)      val="$undef" ;;
2877         esac
2878         ;;
2879 esac
2880 set usemultiplicity
2881 eval $setvar
2882
2883 : determine where manual pages are on this system
2884 echo " "
2885 case "$sysman" in
2886 '') 
2887         syspath='/usr/man/man1 /usr/man/mann /usr/man/manl /usr/man/local/man1'
2888         syspath="$syspath /usr/man/u_man/man1 /usr/share/man/man1"
2889         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
2890         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
2891         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
2892         sysman=`./loc . /usr/man/man1 $syspath`
2893         ;;
2894 esac
2895 if $test -d "$sysman"; then
2896         echo "System manual is in $sysman." >&4
2897 else
2898         echo "Could not find manual pages in source form." >&4
2899 fi
2900
2901 : see what memory models we can support
2902 case "$models" in
2903 '')
2904         $cat >pdp11.c <<'EOP'
2905 int main() {
2906 #ifdef pdp11
2907         exit(0);
2908 #else
2909         exit(1);
2910 #endif
2911 }
2912 EOP
2913         case "$cc" in
2914         '') modelcc="$cc" ;;
2915         *) modelcc="cc" ;;
2916         esac
2917         ( $modelcc -o pdp11 pdp11.c ) >/dev/null 2>&1
2918         if $test -f pdp11 && ./pdp11 2>/dev/null; then
2919                 dflt='unsplit split'
2920         else
2921                 tans=`./loc . X /lib/small /lib/large /usr/lib/small /usr/lib/large /lib/medium /usr/lib/medium /lib/huge`
2922                 case "$tans" in
2923                 X) dflt='none';;
2924                 *) if $test -d /lib/small || $test -d /usr/lib/small; then
2925                                 dflt='small'
2926                         else
2927                                 dflt=''
2928                         fi
2929                         if $test -d /lib/medium || $test -d /usr/lib/medium; then
2930                                 dflt="$dflt medium"
2931                         fi
2932                         if $test -d /lib/large || $test -d /usr/lib/large; then
2933                                 dflt="$dflt large"
2934                         fi
2935                         if $test -d /lib/huge || $test -d /usr/lib/huge; then
2936                                 dflt="$dflt huge"
2937                         fi
2938                 esac
2939         fi;;
2940 *) dflt="$models";;
2941 esac
2942 $cat <<EOM
2943  
2944 Some systems have different model sizes.  On most systems they are called
2945 small, medium, large, and huge.  On the PDP11 they are called unsplit and
2946 split.  If your system doesn't support different memory models, say "none".
2947 If you wish to force everything to one memory model, say "none" here and
2948 put the appropriate flags later when it asks you for other cc and ld flags.
2949 Venix systems may wish to put "none" and let the compiler figure things out.
2950 (In the following question multiple model names should be space separated.)
2951
2952 The default for most systems is "none".
2953
2954 EOM
2955 rp="Which memory models are supported?"
2956 . ./myread
2957 models="$ans"
2958
2959 case "$models" in
2960 none)
2961         small=''
2962         medium=''
2963         large=''
2964         huge=''
2965         unsplit=''
2966         split=''
2967         ;;
2968 *split)
2969         case "$split" in
2970         '') if $contains '\-i' $sysman/ld.1 >/dev/null 2>&1 || \
2971                          $contains '\-i' $sysman/cc.1 >/dev/null 2>&1; then
2972                         dflt='-i'
2973                 else
2974                         dflt='none'
2975                 fi;;
2976         *) dflt="$split";;
2977         esac
2978         rp="What flag indicates separate I and D space?"
2979         . ./myread
2980         tans="$ans"
2981         case "$tans" in
2982         none) tans='';;
2983         esac
2984         split="$tans"
2985         unsplit='';;
2986 *large*|*small*|*medium*|*huge*)
2987         case "$models" in
2988         *large*)
2989                 case "$large" in
2990                 '') dflt='-Ml';;
2991                 *) dflt="$large";;
2992                 esac
2993         rp="What flag indicates large model?"
2994         . ./myread
2995         tans="$ans"
2996         case "$tans" in
2997         none) tans='';
2998         esac
2999         large="$tans";;
3000         *) large='';;
3001         esac
3002         case "$models" in
3003         *huge*) case "$huge" in
3004                 '') dflt='-Mh';;
3005                 *) dflt="$huge";;
3006                 esac
3007                 rp="What flag indicates huge model?"
3008                 . ./myread
3009                 tans="$ans"
3010                 case "$tans" in
3011                 none) tans='';
3012                 esac
3013                 huge="$tans";;
3014         *) huge="$large";;
3015         esac
3016         case "$models" in
3017         *medium*) case "$medium" in
3018                 '') dflt='-Mm';;
3019                 *) dflt="$medium";;
3020                 esac
3021                 rp="What flag indicates medium model?"
3022                 . ./myread
3023                 tans="$ans"
3024                 case "$tans" in
3025                 none) tans='';
3026                 esac
3027                 medium="$tans";;
3028         *) medium="$large";;
3029         esac
3030         case "$models" in
3031         *small*) case "$small" in
3032                 '') dflt='none';;
3033                 *) dflt="$small";;
3034                 esac
3035                 rp="What flag indicates small model?"
3036                 . ./myread
3037                 tans="$ans"
3038                 case "$tans" in
3039                 none) tans='';
3040                 esac
3041                 small="$tans";;
3042         *) small='';;
3043         esac
3044         ;;
3045 *)
3046         echo "Unrecognized memory models--you may have to edit Makefile.SH" >&4
3047         ;;
3048 esac
3049 $rm -f pdp11.* pdp11
3050
3051 : make some quick guesses about what we are up against
3052 echo " "
3053 $echo $n "Hmm...  $c"
3054 echo exit 1 >bsd
3055 echo exit 1 >usg
3056 echo exit 1 >v7
3057 echo exit 1 >osf1
3058 echo exit 1 >eunice
3059 echo exit 1 >xenix
3060 echo exit 1 >venix
3061 echo exit 1 >os2
3062 d_bsd="$undef"
3063 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
3064 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
3065 then
3066         echo "Looks kind of like an OSF/1 system, but we'll see..."
3067         echo exit 0 >osf1
3068 elif test `echo abc | tr a-z A-Z` = Abc ; then
3069         xxx=`./loc addbib blurfl $pth`
3070         if $test -f $xxx; then
3071         echo "Looks kind of like a USG system with BSD features, but we'll see..."
3072                 echo exit 0 >bsd
3073                 echo exit 0 >usg
3074         else
3075                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
3076                         echo "Looks kind of like an extended USG system, but we'll see..."
3077                 else
3078                         echo "Looks kind of like a USG system, but we'll see..."
3079                 fi
3080                 echo exit 0 >usg
3081         fi
3082 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
3083         echo "Looks kind of like a BSD system, but we'll see..."
3084         d_bsd="$define"
3085         echo exit 0 >bsd
3086 else
3087         echo "Looks kind of like a Version 7 system, but we'll see..."
3088         echo exit 0 >v7
3089 fi
3090 case "$eunicefix" in
3091 *unixtovms*)
3092         $cat <<'EOI'
3093 There is, however, a strange, musty smell in the air that reminds me of
3094 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
3095 EOI
3096         echo exit 0 >eunice
3097         d_eunice="$define"
3098 : it so happens the Eunice I know will not run shell scripts in Unix format
3099         ;;
3100 *)
3101         echo " "
3102         echo "Congratulations.  You aren't running Eunice."
3103         d_eunice="$undef"
3104         ;;
3105 esac
3106 : Detect OS2.  The p_ variable is set above in the Head.U unit.
3107 case "$p_" in
3108 :) ;;
3109 *)
3110         $cat <<'EOI'
3111 I have the feeling something is not exactly right, however...don't tell me...
3112 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
3113 EOI
3114         echo exit 0 >os2
3115         ;;
3116 esac
3117 if test -f /xenix; then
3118         echo "Actually, this looks more like a XENIX system..."
3119         echo exit 0 >xenix
3120         d_xenix="$define"
3121 else
3122         echo " "
3123         echo "It's not Xenix..."
3124         d_xenix="$undef"
3125 fi
3126 chmod +x xenix
3127 $eunicefix xenix
3128 if test -f /venix; then
3129         echo "Actually, this looks more like a VENIX system..."
3130         echo exit 0 >venix
3131 else
3132         echo " "
3133         if ./xenix; then
3134                 : null
3135         else
3136                 echo "Nor is it Venix..."
3137         fi
3138 fi
3139 chmod +x bsd usg v7 osf1 eunice xenix venix os2
3140 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
3141 $rm -f foo
3142
3143 : see if we need a special compiler
3144 echo " "
3145 if ./usg; then
3146         case "$cc" in
3147         '') case "$Mcc" in
3148                 /*) dflt='Mcc';;
3149                 *) case "$large" in
3150                         -M*) dflt='cc';;
3151                         *)      if $contains '\-M' $sysman/cc.1 >/dev/null 2>&1 ; then
3152                                         if $contains '\-M' $sysman/cpp.1 >/dev/null 2>&1; then
3153                                                 dflt='cc'
3154                                         else
3155                                                 dflt='cc -M'
3156                                         fi
3157                                 else
3158                                         dflt='cc'
3159                                 fi;;
3160                         esac;;
3161                 esac;;
3162         *)  dflt="$cc";;
3163         esac
3164         case "$dflt" in
3165         *M*)    $cat <<'EOM'
3166 On some older systems the default C compiler will not resolve multiple global
3167 references that happen to have the same name.  On some such systems the "Mcc"
3168 command may be used to force these to be resolved.  On other systems a "cc -M"
3169 command is required.  (Note that the -M flag on other systems indicates a
3170 memory model to use!) If you have the Gnu C compiler, you might wish to use
3171 that instead.
3172
3173 EOM
3174         ;;
3175         esac
3176         rp="Use which C compiler?"
3177         . ./myread
3178         cc="$ans"
3179 else
3180         case "$cc" in
3181         '') dflt=cc;;
3182         *) dflt="$cc";;
3183         esac
3184         rp="Use which C compiler?"
3185         . ./myread
3186         cc="$ans"
3187 fi
3188 : Look for a hint-file generated 'call-back-unit'.  Now that the
3189 : user has specified the compiler, we may need to set or change some
3190 : other defaults.
3191 if $test -f cc.cbu; then
3192     . ./cc.cbu
3193 fi
3194 . ./checkcc
3195
3196 echo " "
3197 echo "Checking for GNU cc in disguise and/or its version number..." >&4
3198 $cat >gccvers.c <<EOM
3199 #include <stdio.h>
3200 int main() {
3201 #ifdef __GNUC__
3202 #ifdef __VERSION__
3203         printf("%s\n", __VERSION__);
3204 #else
3205         printf("%s\n", "1");
3206 #endif
3207 #endif
3208         exit(0);
3209 }
3210 EOM
3211 if $cc $ldflags -o gccvers gccvers.c; then
3212         gccversion=`./gccvers`
3213         case "$gccversion" in
3214         '') echo "You are not using GNU cc." ;;
3215         *)  echo "You are using GNU cc $gccversion."
3216             ;;
3217         esac
3218 else
3219         echo " "
3220         echo "*** WHOA THERE!!! ***" >&4
3221         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
3222         case "$knowitall" in
3223         '')
3224         echo "    You'd better start hunting for one and let me know about it." >&4
3225                 exit 1
3226                 ;;
3227         esac
3228 fi
3229 $rm -f gccvers*
3230 case "$gccversion" in
3231 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
3232 esac
3233 case "$gccversion" in
3234 '') gccosandvers='' ;;
3235 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
3236    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
3237    gccshortvers=''
3238    case "$gccosandvers" in
3239    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
3240    $osname$osvers) ;; # looking good
3241    $osname*) cat <<EOM >&4
3242
3243 *** WHOA THERE!!! ***
3244
3245     Your gcc has not been compiled for the exact release of
3246     your operating system ($gccosandvers versus $osname$osvers).
3247
3248     In general it is a good idea to keep gcc synchronized with
3249     the operating system because otherwise serious problems
3250     may ensue when trying to compile software, like Perl.
3251
3252     I'm trying to be optimistic here, though, and will continue.
3253     If later during the configuration and build icky compilation
3254     problems appear (headerfile conflicts being the most common
3255     manifestation), I suggest reinstalling the gcc to match
3256     your operating system release.
3257
3258 EOM
3259       ;;
3260    *) gccosandvers='' ;; # failed to parse, better be silent
3261    esac
3262    ;;
3263 esac
3264
3265
3266
3267
3268 : see how we invoke the C preprocessor
3269 echo " "
3270 echo "Now, how can we feed standard input to your C preprocessor..." >&4
3271 cat <<'EOT' >testcpp.c
3272 #define ABC abc
3273 #define XYZ xyz
3274 ABC.XYZ
3275 EOT
3276 cd ..
3277 if test ! -f cppstdin; then
3278         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
3279                 # AIX cc -E doesn't show the absolute headerfile
3280                 # locations but we'll cheat by using the -M flag.
3281                 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
3282         else
3283                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
3284         fi
3285 else
3286         echo "Keeping your $hint cppstdin wrapper."
3287 fi
3288 chmod 755 cppstdin
3289 wrapper=`pwd`/cppstdin
3290 ok='false'
3291 cd UU
3292
3293 if $test "X$cppstdin" != "X" && \
3294         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
3295         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3296 then
3297         echo "You used to use $cppstdin $cppminus so we'll use that again."
3298         case "$cpprun" in
3299         '') echo "But let's see if we can live without a wrapper..." ;;
3300         *)
3301                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
3302                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3303                 then
3304                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
3305                         ok='true'
3306                 else
3307                         echo "(However, $cpprun $cpplast does not work, let's see...)"
3308                 fi
3309                 ;;
3310         esac
3311 else
3312         case "$cppstdin" in
3313         '') ;;
3314         *)
3315                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
3316                 ;;
3317         esac
3318 fi
3319
3320 if $ok; then
3321         : nothing
3322 elif echo 'Maybe "'"$cc"' -E" will work...'; \
3323         $cc -E <testcpp.c >testcpp.out 2>&1; \
3324         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3325         echo "Yup, it does."
3326         x_cpp="$cc -E"
3327         x_minus='';
3328 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
3329         $cc -E - <testcpp.c >testcpp.out 2>&1; \
3330         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3331         echo "Yup, it does."
3332         x_cpp="$cc -E"
3333         x_minus='-';
3334 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
3335         $cc -P <testcpp.c >testcpp.out 2>&1; \
3336         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3337         echo "Yipee, that works!"
3338         x_cpp="$cc -P"
3339         x_minus='';
3340 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
3341         $cc -P - <testcpp.c >testcpp.out 2>&1; \
3342         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3343         echo "At long last!"
3344         x_cpp="$cc -P"
3345         x_minus='-';
3346 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
3347         $cpp <testcpp.c >testcpp.out 2>&1; \
3348         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3349         echo "It works!"
3350         x_cpp="$cpp"
3351         x_minus='';
3352 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
3353         $cpp - <testcpp.c >testcpp.out 2>&1; \
3354         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3355         echo "Hooray, it works!  I was beginning to wonder."
3356         x_cpp="$cpp"
3357         x_minus='-';
3358 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
3359         $wrapper <testcpp.c >testcpp.out 2>&1; \
3360         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3361         x_cpp="$wrapper"
3362         x_minus=''
3363         echo "Eureka!"
3364 else
3365         dflt=''
3366         rp="No dice.  I can't find a C preprocessor.  Name one:"
3367         . ./myread
3368         x_cpp="$ans"
3369         x_minus=''
3370         $x_cpp <testcpp.c >testcpp.out 2>&1
3371         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3372                 echo "OK, that will do." >&4
3373         else
3374 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
3375                 exit 1
3376         fi
3377 fi
3378
3379 case "$ok" in
3380 false)
3381         cppstdin="$x_cpp"
3382         cppminus="$x_minus"
3383         cpprun="$x_cpp"
3384         cpplast="$x_minus"
3385         set X $x_cpp
3386         shift
3387         case "$1" in
3388         "$cpp")
3389                 echo "Perhaps can we force $cc -E using a wrapper..."
3390                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
3391                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3392                 then
3393                         echo "Yup, we can."
3394                         cppstdin="$wrapper"
3395                         cppminus='';
3396                 else
3397                         echo "Nope, we'll have to live without it..."
3398                 fi
3399                 ;;
3400         esac
3401         case "$cpprun" in
3402         "$wrapper")
3403                 cpprun=''
3404                 cpplast=''
3405                 ;;
3406         esac
3407         ;;
3408 esac
3409
3410 case "$cppstdin" in
3411 "$wrapper"|'cppstdin') ;;
3412 *) $rm -f $wrapper;;
3413 esac
3414 $rm -f testcpp.c testcpp.out
3415
3416 : decide how portable to be.  Allow command line overrides.
3417 case "$d_portable" in
3418 "$undef") ;;
3419 *)      d_portable="$define" ;;
3420 esac
3421
3422 : set up shell script to do ~ expansion
3423 cat >filexp <<EOSS
3424 $startsh
3425 : expand filename
3426 case "\$1" in
3427  ~/*|~)
3428         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3429         ;;
3430  ~*)
3431         if $test -f /bin/csh; then
3432                 /bin/csh -f -c "glob \$1"
3433                 failed=\$?
3434                 echo ""
3435                 exit \$failed
3436         else
3437                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3438                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3439                 if $test ! -d "\$dir"; then
3440                         me=\`basename \$0\`
3441                         echo "\$me: can't locate home directory for: \$name" >&2
3442                         exit 1
3443                 fi
3444                 case "\$1" in
3445                 */*)
3446                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3447                         ;;
3448                 *)
3449                         echo \$dir
3450                         ;;
3451                 esac
3452         fi
3453         ;;
3454 *)
3455         echo \$1
3456         ;;
3457 esac
3458 EOSS
3459 chmod +x filexp
3460 $eunicefix filexp
3461
3462 : now set up to get a file name
3463 cat <<EOS >getfile
3464 $startsh
3465 EOS
3466 cat <<'EOSC' >>getfile
3467 tilde=''
3468 fullpath=''
3469 already=''
3470 skip=''
3471 none_ok=''
3472 exp_file=''
3473 nopath_ok=''
3474 orig_rp="$rp"
3475 orig_dflt="$dflt"
3476 case "$gfpth" in
3477 '') gfpth='.' ;;
3478 esac
3479
3480 case "$fn" in
3481 *\(*)
3482         expr $fn : '.*(\(.*\)).*' | tr ',' $trnl >getfile.ok
3483         fn=`echo $fn | sed 's/(.*)//'`
3484         ;;
3485 esac
3486
3487 case "$fn" in
3488 *:*)
3489         loc_file=`expr $fn : '.*:\(.*\)'`
3490         fn=`expr $fn : '\(.*\):.*'`
3491         ;;
3492 esac
3493
3494 case "$fn" in
3495 *~*) tilde=true;;
3496 esac
3497 case "$fn" in
3498 */*) fullpath=true;;
3499 esac
3500 case "$fn" in
3501 *+*) skip=true;;
3502 esac
3503 case "$fn" in
3504 *n*) none_ok=true;;
3505 esac
3506 case "$fn" in
3507 *e*) exp_file=true;;
3508 esac
3509 case "$fn" in
3510 *p*) nopath_ok=true;;
3511 esac
3512
3513 case "$fn" in
3514 *f*) type='File';;
3515 *d*) type='Directory';;
3516 *l*) type='Locate';;
3517 esac
3518
3519 what="$type"
3520 case "$what" in
3521 Locate) what='File';;
3522 esac
3523
3524 case "$exp_file" in
3525 '')
3526         case "$d_portable" in
3527         "$define") ;;
3528         *) exp_file=true;;
3529         esac
3530         ;;
3531 esac
3532
3533 cd ..
3534 while test "$type"; do
3535         redo=''
3536         rp="$orig_rp"
3537         dflt="$orig_dflt"
3538         case "$tilde" in
3539         true) rp="$rp (~name ok)";;
3540         esac
3541         . UU/myread
3542         if test -f UU/getfile.ok && \
3543                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3544         then
3545                 value="$ans"
3546                 ansexp="$ans"
3547                 break
3548         fi
3549         case "$ans" in
3550         none)
3551                 value=''
3552                 ansexp=''
3553                 case "$none_ok" in
3554                 true) type='';;
3555                 esac
3556                 ;;
3557         *)
3558                 case "$tilde" in
3559                 '') value="$ans"
3560                         ansexp="$ans";;
3561                 *)
3562                         value=`UU/filexp $ans`
3563                         case $? in
3564                         0)
3565                                 if test "$ans" != "$value"; then
3566                                         echo "(That expands to $value on this system.)"
3567                                 fi
3568                                 ;;
3569                         *) value="$ans";;
3570                         esac
3571                         ansexp="$value"
3572                         case "$exp_file" in
3573                         '') value="$ans";;
3574                         esac
3575                         ;;
3576                 esac
3577                 case "$fullpath" in
3578                 true)
3579                         case "$ansexp" in
3580                         /*) value="$ansexp" ;;
3581                         [a-zA-Z]:/*) value="$ansexp" ;;
3582                         *)
3583                                 redo=true
3584                                 case "$already" in
3585                                 true)
3586                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
3587                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
3588                                         ;;
3589                                 *)
3590                                 echo "Please give a full path name, starting with slash." >&4
3591                                         case "$tilde" in
3592                                         true)
3593                                 echo "Note that using ~name is ok provided it expands well." >&4
3594                                                 already=true
3595                                                 ;;
3596                                         esac
3597                                 esac
3598                                 ;;
3599                         esac
3600                         ;;
3601                 esac
3602                 case "$redo" in
3603                 '')
3604                         case "$type" in
3605                         File)
3606                                 for fp in $gfpth; do
3607                                         if test "X$fp" = X.; then
3608                                             pf="$ansexp"
3609                                         else    
3610                                             pf="$fp/$ansexp"
3611                                         fi
3612                                         if test -f "$pf"; then
3613                                                 type=''
3614                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3615                                         then
3616                                                 echo "($value is not a plain file, but that's ok.)"
3617                                                 type=''
3618                                         fi
3619                                         if test X"$type" = X; then
3620                                             value="$pf"
3621                                             break
3622                                         fi
3623                                 done
3624                                 ;;
3625                         Directory)
3626                                 for fp in $gfpth; do
3627                                         if test "X$fp" = X.; then
3628                                             dir="$ans"
3629                                             direxp="$ansexp"
3630                                         else    
3631                                             dir="$fp/$ansexp"
3632                                             direxp="$fp/$ansexp"
3633                                         fi
3634                                         if test -d "$direxp"; then
3635                                                 type=''
3636                                                 value="$dir"
3637                                                 break
3638                                         fi
3639                                 done
3640                                 ;;
3641                         Locate)
3642                                 if test -d "$ansexp"; then
3643                                         echo "(Looking for $loc_file in directory $value.)"
3644                                         value="$value/$loc_file"
3645                                         ansexp="$ansexp/$loc_file"
3646                                 fi
3647                                 if test -f "$ansexp"; then
3648                                         type=''
3649                                 fi
3650                                 case "$nopath_ok" in
3651                                 true)   case "$value" in
3652                                         */*) ;;
3653                                         *)      echo "Assuming $value will be in people's path."
3654                                                 type=''
3655                                                 ;;
3656                                         esac
3657                                         ;;
3658                                 esac
3659                                 ;;
3660                         esac
3661
3662                         case "$skip" in
3663                         true) type='';
3664                         esac
3665
3666                         case "$type" in
3667                         '') ;;
3668                         *)
3669                                 if test "$fastread" = yes; then
3670                                         dflt=y
3671                                 else
3672                                         dflt=n
3673                                 fi
3674                                 rp="$what $value doesn't exist.  Use that name anyway?"
3675                                 . UU/myread
3676                                 dflt=''
3677                                 case "$ans" in
3678                                 y*) type='';;
3679                                 *) echo " ";;
3680                                 esac
3681                                 ;;
3682                         esac
3683                         ;;
3684                 esac
3685                 ;;
3686         esac
3687 done
3688 cd UU
3689 ans="$value"
3690 rp="$orig_rp"
3691 dflt="$orig_dflt"
3692 rm -f getfile.ok
3693 test "X$gfpthkeep" != Xy && gfpth=""
3694 EOSC
3695
3696 : What should the include directory be ?
3697 echo " "
3698 $echo $n "Hmm...  $c"
3699 dflt='/usr/include'
3700 incpath=''
3701 mips_type=''
3702 if $test -f /bin/mips && /bin/mips; then
3703         echo "Looks like a MIPS system..."
3704         $cat >usr.c <<'EOCP'
3705 #ifdef SYSTYPE_BSD43
3706 /bsd43
3707 #endif
3708 EOCP
3709         if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
3710                 dflt='/bsd43/usr/include'
3711                 incpath='/bsd43'
3712                 mips_type='BSD 4.3'
3713         else
3714                 mips_type='System V'
3715         fi
3716         $rm -f usr.c usr.out
3717         echo "and you're compiling with the $mips_type compiler and libraries."
3718         xxx_prompt=y
3719         echo "exit 0" >mips
3720 else
3721         echo "Doesn't look like a MIPS system."
3722         xxx_prompt=n
3723         echo "exit 1" >mips
3724 fi
3725 chmod +x mips
3726 $eunicefix mips
3727 case "$usrinc" in
3728 '') ;;
3729 *) dflt="$usrinc";;
3730 esac
3731 case "$xxx_prompt" in
3732 y)      fn=d/
3733         echo " "
3734         rp='Where are the include files you want to use?'
3735         . ./getfile
3736         usrinc="$ans"
3737         ;;
3738 *)      usrinc="$dflt"
3739         ;;
3740 esac
3741
3742 : Set private lib path
3743 case "$plibpth" in
3744 '') if ./mips; then
3745                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
3746         fi;;
3747 esac
3748 case "$libpth" in
3749 ' ') dlist='';;
3750 '') dlist="$loclibpth $plibpth $glibpth";;
3751 *) dlist="$libpth";;
3752 esac
3753
3754 : Now check and see which directories actually exist, avoiding duplicates
3755 libpth=''
3756 for xxx in $dlist
3757 do
3758     if $test -d $xxx; then
3759                 case " $libpth " in
3760                 *" $xxx "*) ;;
3761                 *) libpth="$libpth $xxx";;
3762                 esac
3763     fi
3764 done
3765 $cat <<'EOM'
3766
3767 Some systems have incompatible or broken versions of libraries.  Among
3768 the directories listed in the question below, please remove any you
3769 know not to be holding relevant libraries, and add any that are needed.
3770 Say "none" for none.
3771
3772 EOM
3773 case "$libpth" in
3774 '') dflt='none';;
3775 *)
3776         set X $libpth
3777         shift
3778         dflt=${1+"$@"}
3779         ;;
3780 esac
3781 rp="Directories to use for library searches?"
3782 . ./myread
3783 case "$ans" in
3784 none) libpth=' ';;
3785 *) libpth="$ans";;
3786 esac
3787
3788 : compute shared library extension
3789 case "$so" in
3790 '')
3791         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
3792                 dflt='sl'
3793         else
3794                 dflt='so'
3795         fi
3796         ;;
3797 *) dflt="$so";;
3798 esac
3799 $cat <<EOM
3800
3801 On some systems, shared libraries may be available.  Answer 'none' if
3802 you want to suppress searching of shared libraries for the remainder
3803 of this configuration.
3804
3805 EOM
3806 rp='What is the file extension used for shared libraries?'
3807 . ./myread
3808 so="$ans"
3809
3810 : Define several unixisms.
3811 : Hints files or command line option can be used to override them.
3812 : The convoluted testing is in case hints files set either the old
3813 : or the new name.
3814 case "$_exe" in
3815 '')     case "$exe_ext" in
3816     '') ;;
3817         *)      _exe="$exe_ext" ;;
3818         esac
3819         ;;
3820 esac
3821 case "$_a" in
3822 '')     case "$lib_ext" in
3823     '') _a='.a';;
3824         *)      _a="$lib_ext" ;;
3825         esac
3826         ;;
3827 esac
3828 case "$_o" in
3829 '') case "$obj_ext" in
3830         '')     _o='.o';;
3831         *)      _o="$obj_ext";;
3832         esac
3833         ;;
3834 esac
3835 case "$p_" in
3836 '') case "$path_sep" in
3837         '')     p_=':';;
3838         *)      p_="$path_sep";;
3839         esac
3840         ;;
3841 esac
3842 exe_ext=$_exe
3843 lib_ext=$_a
3844 obj_ext=$_o
3845 path_sep=$p_
3846
3847 : Which makefile gets called first.  This is used by make depend.
3848 case "$firstmakefile" in
3849 '') firstmakefile='makefile';;
3850 esac
3851
3852 case "$usesocks" in
3853 $define|true|[yY]*)     dflt='y';;
3854 *) dflt='n';;
3855 esac
3856 cat <<EOM
3857
3858 Perl can be built to use the SOCKS proxy protocol library.  To do so,
3859 Configure must be run with -Dusesocks.
3860
3861 If this doesn't make any sense to you, just accept the default '$dflt'.
3862 EOM
3863 rp='Build Perl for SOCKS?'
3864 . ./myread
3865 case "$ans" in
3866 y|Y)    val="$define" ;;     
3867 *)      val="$undef" ;;
3868 esac
3869 set usesocks
3870 eval $setvar
3871
3872 : Looking for optional libraries
3873 echo " "
3874 echo "Checking for optional libraries..." >&4
3875 case "$libs" in
3876 ' '|'') dflt='';;
3877 *) dflt="$libs";;
3878 esac
3879 case "$libswanted" in
3880 '') libswanted='c_s';;
3881 esac
3882 case "$usesocks" in
3883 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
3884 esac
3885 libsfound=''
3886 libsfiles=''
3887 libsdirs=''
3888 libspath=''
3889 for thisdir in $libpth $xlibpth; do
3890   test -d $thisdir && libspath="$libspath $thisdir"
3891 done
3892 for thislib in $libswanted; do
3893         for thisdir in $libspath; do
3894             xxx=''
3895             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
3896                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|tail -1`
3897                 $test -f "$xxx" && eval $libscheck
3898                 $test -f "$xxx" && libstyle=shared
3899             fi
3900             if test ! -f "$xxx"; then
3901                 xxx=$thisdir/lib$thislib.$so
3902                 $test -f "$xxx" && eval $libscheck
3903                 $test -f "$xxx" && libstyle=shared
3904             fi  
3905             if test ! -f "$xxx"; then
3906                 xxx=$thisdir/lib$thislib$_a
3907                 $test -f "$xxx" && eval $libscheck
3908                 $test -f "$xxx" && libstyle=static
3909             fi
3910             if test ! -f "$xxx"; then
3911                 xxx=$thisdir/$thislib$_a
3912                 $test -f "$xxx" && eval $libscheck
3913                 $test -f "$xxx" && libstyle=static
3914             fi
3915             if test ! -f "$xxx"; then
3916                 xxx=$thisdir/lib${thislib}_s$_a
3917                 $test -f "$xxx" && eval $libscheck
3918                 $test -f "$xxx" && libstyle=static
3919                 $test -f "$xxx" && thislib=${thislib}_s
3920             fi
3921             if test ! -f "$xxx"; then
3922                 xxx=$thisdir/Slib$thislib$_a
3923                 $test -f "$xxx" && eval $libscheck
3924                 $test -f "$xxx" && libstyle=static
3925             fi
3926             if $test -f "$xxx"; then
3927                 case "$libstyle" in
3928                 shared) echo "Found -l$thislib (shared)." ;;
3929                 static) echo "Found -l$thislib." ;;
3930                 *)      echo "Found -l$thislib ($libstyle)." ;;
3931                 esac
3932                 case " $dflt " in
3933                 *"-l$thislib "*);;
3934                 *) dflt="$dflt -l$thislib"
3935                    libsfound="$libsfound $xxx"
3936                    yyy=`basename $xxx`
3937                    libsfiles="$libsfiles $yyy"
3938                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
3939                    case " $libsdirs " in
3940                    *" $yyy "*) ;;
3941                    *) libsdirs="$libsdirs $yyy" ;;
3942                    esac
3943                    ;;
3944                 esac
3945                 break
3946             fi  
3947         done
3948         if $test ! -f "$xxx"; then
3949             echo "No -l$thislib."
3950         fi
3951 done
3952 set X $dflt
3953 shift
3954 dflt="$*"
3955 case "$libs" in
3956 '') dflt="$dflt";;
3957 *) dflt="$libs";;
3958 esac
3959 case "$dflt" in
3960 ' '|'') dflt='none';;
3961 esac
3962
3963 $cat <<EOM
3964
3965 In order to compile $package on your machine, a number of libraries
3966 are usually needed.  Include any other special libraries here as well.
3967 Say "none" for none.  The default list is almost always right.
3968 EOM
3969
3970 echo " "
3971 rp="What libraries to use?"
3972 . ./myread
3973 case "$ans" in
3974 none) libs=' ';;
3975 *) libs="$ans";;
3976 esac
3977
3978 : determine optimization, if desired, or use for debug flag also
3979 case "$optimize" in
3980 ' '|$undef) dflt='none';;
3981 '') dflt='-O';;
3982 *) dflt="$optimize";;
3983 esac
3984 $cat <<EOH
3985
3986 By default, $package compiles with the -O flag to use the optimizer.
3987 Alternately, you might want to use the symbolic debugger, which uses
3988 the -g flag (on traditional Unix systems).  Either flag can be
3989 specified here.  To use neither flag, specify the word "none".
3990
3991 EOH
3992 rp="What optimizer/debugger flag should be used?"
3993 . ./myread
3994 optimize="$ans"
3995 case "$optimize" in
3996 'none') optimize=" ";;
3997 esac
3998
3999 dflt=''
4000 : We will not override a previous value, but we might want to
4001 : augment a hint file
4002 case "$hint" in
4003 default|recommended)
4004         case "$gccversion" in
4005         1*) dflt='-fpcc-struct-return' ;;
4006         esac
4007         case "$optimize" in
4008         *-g*) dflt="$dflt -DDEBUGGING";;
4009         esac
4010         case "$gccversion" in
4011         2*) if test -d /etc/conf/kconfig.d &&
4012                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
4013                 then
4014                         dflt="$dflt -posix"
4015                 fi
4016                 ;;
4017         esac
4018         case "$gccversion" in
4019         1*) ;;
4020         2.[0-8]*) ;;
4021         ?*)     echo " "
4022                 echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
4023                 echo 'int main(void) { return 0; }' > gcctest.c
4024                 if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
4025                         echo "Yes, it does." 2>&1
4026                         case "$ccflags" in
4027                         *strict-aliasing*) 
4028                                 echo "Leaving current flags $ccflags alone." 2>&1
4029                                 ;;
4030                         *) dflt="$dflt -fno-strict-aliasing" ;;
4031                         esac
4032                 else
4033                         echo "Nope, it doesn't, but that's ok." 2>&1
4034                 fi
4035                 ;;
4036         esac
4037         ;;
4038 esac
4039
4040 case "$mips_type" in
4041 *BSD*|'') inclwanted="$locincpth $usrinc";;
4042 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
4043 esac
4044 for thisincl in $inclwanted; do
4045         if $test -d $thisincl; then
4046                 if $test x$thisincl != x$usrinc; then
4047                         case "$dflt" in
4048                         *$thisincl*);;
4049                         *) dflt="$dflt -I$thisincl";;
4050                         esac
4051                 fi
4052         fi
4053 done
4054
4055 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
4056         xxx=true;
4057 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
4058         xxx=true;
4059 else
4060         xxx=false;
4061 fi;
4062 if $xxx; then
4063         case "$dflt" in
4064         *$2*);;
4065         *) dflt="$dflt -D$2";;
4066         esac;
4067 fi'
4068
4069 set signal.h LANGUAGE_C; eval $inctest
4070
4071 case "$usesocks" in
4072 $define)
4073         ccflags="$ccflags -DSOCKS"
4074         ;;
4075 esac
4076
4077 case "$hint" in
4078 default|recommended) dflt="$ccflags $dflt" ;;
4079 *) dflt="$ccflags";;
4080 esac
4081
4082 case "$dflt" in
4083 ''|' ') dflt=none;;
4084 esac
4085 $cat <<EOH
4086
4087 Your C compiler may want other flags.  For this question you should include
4088 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
4089 but you should NOT include libraries or ld flags like -lwhatever.  If you
4090 want $package to honor its debug switch, you should include -DDEBUGGING here.
4091 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
4092
4093 To use no flags, specify the word "none".
4094
4095 EOH
4096 set X $dflt
4097 shift
4098 dflt=${1+"$@"}
4099 rp="Any additional cc flags?"
4100 . ./myread
4101 case "$ans" in
4102 none) ccflags='';;
4103 *) ccflags="$ans";;
4104 esac
4105
4106 : the following weeds options from ccflags that are of no interest to cpp
4107 cppflags="$ccflags"
4108 case "$gccversion" in
4109 1*) cppflags="$cppflags -D__GNUC__"
4110 esac
4111 case "$mips_type" in
4112 '');;
4113 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
4114 esac
4115 case "$cppflags" in
4116 '');;
4117 *)
4118         echo " "
4119         echo "Let me guess what the preprocessor flags are..." >&4
4120         set X $cppflags
4121         shift
4122         cppflags=''
4123         $cat >cpp.c <<'EOM'
4124 #define BLURFL foo
4125
4126 BLURFL xx LFRULB
4127 EOM
4128         previous=''
4129         for flag in $*
4130         do
4131                 case "$flag" in
4132                 -*) ftry="$flag";;
4133                 *) ftry="$previous $flag";;
4134                 esac
4135                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
4136                         >cpp1.out 2>/dev/null && \
4137                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
4138                         >cpp2.out 2>/dev/null && \
4139                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
4140                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
4141                 then
4142                         cppflags="$cppflags $ftry"
4143                         previous=''
4144                 else
4145                         previous="$flag"
4146                 fi
4147         done
4148         set X $cppflags
4149         shift
4150         cppflags=${1+"$@"}
4151         case "$cppflags" in
4152         *-*)  echo "They appear to be: $cppflags";;
4153         esac
4154         $rm -f cpp.c cpp?.out
4155         ;;
4156 esac
4157
4158 : flags used in final linking phase
4159 case "$ldflags" in
4160 '') if ./venix; then
4161                 dflt='-i -z'
4162         else
4163                 dflt=''
4164         fi
4165         case "$ccflags" in
4166         *-posix*) dflt="$dflt -posix" ;;
4167         esac
4168         ;;
4169 *) dflt="$ldflags";;
4170 esac
4171
4172 : Try to guess additional flags to pick up local libraries.
4173 for thislibdir in $libpth; do
4174         case " $loclibpth " in
4175         *" $thislibdir "*)
4176                 case "$dflt " in 
4177                 *"-L$thislibdir "*) ;;
4178                 *)  dflt="$dflt -L$thislibdir" ;;
4179                 esac
4180                 ;;
4181         esac
4182 done
4183
4184 case "$dflt" in
4185 '') dflt='none' ;;
4186 esac
4187
4188 $cat <<EOH
4189
4190 Your C linker may need flags.  For this question you should
4191 include -L/whatever and any other flags used by the C linker, but you
4192 should NOT include libraries like -lwhatever.
4193
4194 Make sure you include the appropriate -L/path flags if your C linker
4195 does not normally search all of the directories you specified above,
4196 namely
4197         $libpth
4198 To use no flags, specify the word "none".
4199
4200 EOH
4201
4202 rp="Any additional ld flags (NOT including libraries)?"
4203 . ./myread
4204 case "$ans" in
4205 none) ldflags='';;
4206 *) ldflags="$ans";;
4207 esac
4208 rmlist="$rmlist pdp11"
4209
4210 : coherency check
4211 echo " "
4212 echo "Checking your choice of C compiler and flags for coherency..." >&4
4213 $cat > try.c <<'EOF'
4214 #include <stdio.h>
4215 int main() { printf("Ok\n"); exit(0); }
4216 EOF
4217 set X $cc $optimize $ccflags -o try $ldflags try.c $libs
4218 shift
4219 $cat >try.msg <<'EOM'
4220 I've tried to compile and run the following simple program:
4221
4222 EOM
4223 $cat try.c >> try.msg
4224
4225 $cat >> try.msg <<EOM
4226
4227 I used the command:
4228
4229         $*
4230         ./try
4231
4232 and I got the following output:
4233
4234 EOM
4235 dflt=y
4236 if sh -c "$cc $optimize $ccflags -o try $ldflags try.c $libs" >>try.msg 2>&1; then
4237         if sh -c './try' >>try.msg 2>&1; then
4238                 xxx=`./try`
4239                 case "$xxx" in
4240                 "Ok") dflt=n ;;
4241                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
4242                         case " $libs " in
4243                         *" -lsfio "*)
4244                                 cat >> try.msg <<'EOQS'
4245 If $libs contains -lsfio, and sfio is mis-configured, then it
4246 sometimes (apparently) runs and exits with a 0 status, but with no
4247 output!  It may have to do with sfio's use of _exit vs. exit.
4248
4249 EOQS
4250                                 rp="You have a big problem.  Shall I abort Configure"
4251                                 dflt=y
4252                                 ;;
4253                         esac
4254                         ;;
4255                 esac
4256         else
4257                 echo "The program compiled OK, but exited with status $?." >>try.msg
4258                 rp="You have a problem.  Shall I abort Configure"
4259                 dflt=y
4260         fi
4261 else
4262         echo "I can't compile the test program." >>try.msg
4263         rp="You have a BIG problem.  Shall I abort Configure"
4264         dflt=y
4265 fi
4266 case "$dflt" in
4267 y)
4268         $cat try.msg >&4
4269         case "$knowitall" in
4270         '')
4271                 echo "(The supplied flags or libraries might be incorrect.)"
4272                 ;;
4273         *) dflt=n;;
4274         esac
4275         echo " "
4276         . ./myread
4277         case "$ans" in
4278         n*|N*) ;;
4279         *)      echo "Ok.  Stopping Configure." >&4
4280                 exit 1
4281                 ;;
4282         esac
4283         ;;
4284 n) echo "OK, that should do.";;
4285 esac
4286 $rm -f try try.* core
4287
4288 : define an is-a-typedef? function
4289 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
4290 case "$inclist" in
4291 "") inclist="sys/types.h";;
4292 esac;
4293 eval "varval=\$$var";
4294 case "$varval" in
4295 "")
4296         $rm -f temp.c;
4297         for inc in $inclist; do
4298                 echo "#include <$inc>" >>temp.c;
4299         done;
4300         echo "#ifdef $type" >> temp.c;
4301         echo "printf(\"We have $type\");" >> temp.c;
4302         echo "#endif" >> temp.c;
4303         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
4304         if $contains $type temp.E >/dev/null 2>&1; then
4305                 eval "$var=\$type";
4306         else
4307                 eval "$var=\$def";
4308         fi;
4309         $rm -f temp.?;;
4310 *) eval "$var=\$varval";;
4311 esac'
4312
4313 : define an is-a-typedef? function that prompts if the type is not available.
4314 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
4315 case "$inclist" in
4316 "") inclist="sys/types.h";;
4317 esac;
4318 eval "varval=\$$var";
4319 case "$varval" in
4320 "")
4321         $rm -f temp.c;
4322         for inc in $inclist; do
4323                 echo "#include <$inc>" >>temp.c;
4324         done;
4325         echo "#ifdef $type" >> temp.c;
4326         echo "printf(\"We have $type\");" >> temp.c;
4327         echo "#endif" >> temp.c;
4328         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
4329         echo " " ;
4330         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
4331         if $contains $type temp.E >/dev/null 2>&1; then
4332                 echo "$type found." >&4;
4333                 eval "$var=\$type";
4334         else
4335                 echo "$type NOT found." >&4;
4336                 dflt="$def";
4337                 . ./myread ;
4338                 eval "$var=\$ans";
4339         fi;
4340         $rm -f temp.?;;
4341 *) eval "$var=\$varval";;
4342 esac'
4343
4344 : define a shorthand compile call
4345 compile='
4346 mc_file=$1;
4347 shift;
4348 $cc $optimize $ccflags $ldflags -o ${mc_file} $* ${mc_file}.c $libs > /dev/null 2>&1;'
4349 : define a shorthand compile call for compilations that should be ok.
4350 compile_ok='
4351 mc_file=$1;
4352 shift;
4353 $cc $optimize $ccflags $ldflags -o ${mc_file} $* ${mc_file}.c $libs;'
4354
4355 : check for lengths of integral types
4356 echo " "
4357 case "$intsize" in
4358 '')
4359         echo "Checking to see how big your integers are..." >&4
4360         $cat >intsize.c <<'EOCP'
4361 #include <stdio.h>
4362 int main()
4363 {
4364         printf("intsize=%d;\n", (int)sizeof(int));
4365         printf("longsize=%d;\n", (int)sizeof(long));
4366         printf("shortsize=%d;\n", (int)sizeof(short));
4367         exit(0);
4368 }
4369 EOCP
4370         set intsize
4371         if eval $compile_ok && ./intsize > /dev/null; then
4372                 eval `./intsize`
4373                 echo "Your integers are $intsize bytes long."
4374                 echo "Your long integers are $longsize bytes long."
4375                 echo "Your short integers are $shortsize bytes long."
4376         else
4377                 $cat >&4 <<EOM
4378 !
4379 Help! I can't compile and run the intsize test program: please enlighten me!
4380 (This is probably a misconfiguration in your system or libraries, and
4381 you really ought to fix it.  Still, I'll try anyway.)
4382 !
4383 EOM
4384                 dflt=4
4385                 rp="What is the size of an integer (in bytes)?"
4386                 . ./myread
4387                 intsize="$ans"
4388                 dflt=$intsize
4389                 rp="What is the size of a long integer (in bytes)?"
4390                 . ./myread
4391                 longsize="$ans"
4392                 dflt=2
4393                 rp="What is the size of a short integer (in bytes)?"
4394                 . ./myread
4395                 shortsize="$ans"
4396         fi
4397         ;;
4398 esac
4399 $rm -f intsize intsize.*
4400
4401 : see what type lseek is declared as in the kernel
4402 rp="What is the type used for lseek's offset on this system?"
4403 set off_t lseektype long stdio.h sys/types.h
4404 eval $typedef_ask
4405
4406 echo " "
4407 echo "Checking to see how big your file offsets are..." >&4
4408 $cat >try.c <<EOCP
4409 #include <sys/types.h>
4410 #include <stdio.h>
4411 int main()
4412 {
4413     printf("%d\n", (int)sizeof($lseektype));
4414     return(0); 
4415 }
4416 EOCP
4417 set try
4418 if eval $compile_ok; then
4419         lseeksize=`./try`
4420         echo "Your file offsets are $lseeksize bytes long."
4421 else
4422         dflt=$longsize
4423         echo " "
4424         echo "(I can't seem to compile the test program.  Guessing...)"
4425         rp="What is the size of your file offsets (in bytes)?"
4426         . ./myread
4427         lseeksize="$ans"
4428 fi
4429 $rm -f try.c try
4430
4431 : see what type file positions are declared as in the library
4432 rp="What is the type for file position used by fsetpos()?"
4433 set fpos_t fpostype long stdio.h sys/types.h
4434 eval $typedef_ask
4435
4436 echo " "
4437 case "$fpostype" in
4438 *_t) zzz="$fpostype"    ;;
4439 *)   zzz="fpos_t"       ;;
4440 esac
4441 echo "Checking the size of $zzz..." >&4 
4442 cat > try.c <<EOCP
4443 #include <sys/types.h>
4444 #include <stdio.h>
4445 int main() {
4446     printf("%d\n", (int)sizeof($fpostype));
4447     exit(0);
4448 }
4449 EOCP
4450 set try
4451 if eval $compile_ok; then
4452         yyy=`./try`
4453         case "$yyy" in
4454         '')     fpossize=4
4455                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
4456                 ;;
4457         *)      fpossize=$yyy
4458                 echo "Your $zzz is $fpossize bytes long."
4459                 ;;
4460         esac
4461 else
4462         dflt="$longsize"
4463         echo " " >&4
4464         echo "(I can't compile the test program.  Guessing...)" >&4
4465         rp="What is the size of your file positions (in bytes)?"
4466         . ./myread
4467         fpossize="$ans"
4468 fi
4469
4470
4471
4472 # Backward compatibility (uselfs is deprecated).
4473 case "$uselfs" in
4474 "$define"|true|[yY]*)
4475         cat <<EOM >&4
4476
4477 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
4478 EOM
4479         uselargefiles="$define"
4480         ;;
4481 esac                          
4482
4483 case "$lseeksize:$fpossize" in
4484 8:8) cat <<EOM
4485
4486 You can have files larger than 2 gigabytes.
4487 EOM
4488    val="$define" ;;
4489 *)    case "$uselargefiles" in
4490    "$undef"|false|[nN]*) dflt='n' ;;
4491    *)   dflt='y' ;;
4492    esac
4493    cat <<EOM
4494
4495 Perl can be built to understand large files (files larger than 2 gigabytes)
4496 on some systems.  To do so, Configure can be run with -Duselargefiles.
4497
4498 If this doesn't make any sense to you, just accept the default '$dflt'.
4499 EOM
4500    rp='Try to understand large files, if available?'
4501    . ./myread
4502    case "$ans" in
4503    y|Y)         val="$define" ;;
4504    *)           val="$undef"  ;;
4505    esac
4506    ;;
4507 esac
4508 set uselargefiles
4509 eval $setvar
4510 case "$uselargefiles" in
4511 "$define")
4512 : Look for a hint-file generated 'call-back-unit'.  If the
4513 : user has specified that a large files perl is to be built,
4514 : we may need to set or change some other defaults.
4515         if $test -f uselargefiles.cbu; then
4516                 echo "Your platform has some specific hints for large file builds, using them..."
4517                 . ./uselargefiles.cbu
4518                 echo " "
4519                 echo "Rechecking to see how big your file offsets are..." >&4
4520                 $cat >try.c <<EOCP
4521 #include <sys/types.h>
4522 #include <stdio.h>
4523 int main()
4524 {
4525     printf("%d\n", (int)sizeof($lseektype));
4526     return(0); 
4527 }
4528 EOCP
4529                 set try
4530                 if eval $compile_ok; then
4531                         lseeksize=`./try`
4532                         $echo "Your file offsets are now $lseeksize bytes long."
4533                 else
4534                         dflt="$lseeksize"
4535                         echo " "
4536                         echo "(I can't seem to compile the test program.  Guessing...)"
4537                         rp="What is the size of your file offsets (in bytes)?"
4538                         . ./myread
4539                         lseeksize="$ans"
4540                 fi
4541                 case "$fpostype" in
4542                 *_t) zzz="$fpostype"    ;;
4543                 *)   zzz="fpos_t"       ;;
4544                 esac
4545                 $echo $n "Rechecking the size of $zzz...$c" >&4 
4546                 $cat > try.c <<EOCP
4547 #include <sys/types.h>
4548 #include <stdio.h>
4549 int main() {
4550     printf("%d\n", (int)sizeof($fpostype));
4551     exit(0);
4552 }
4553 EOCP
4554                 set try
4555                 if eval $compile_ok; then
4556                         yyy=`./try`
4557                         dflt="$lseeksize"
4558                         case "$yyy" in
4559                         '')     echo " "
4560                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
4561                                 ;;
4562                         *)      fpossize=$yyy
4563                                 echo " $fpossize bytes." >&4
4564                                 ;;
4565                         esac
4566                 else
4567                         dflt="$fpossize"
4568                         echo " "
4569                         echo "(I can't compile the test program.  Guessing...)" >&4
4570                         rp="What is the size of your file positions (in bytes)?"
4571                         . ./myread
4572                         fpossize="$ans"
4573                 fi
4574                 $rm -f try.c try
4575         fi
4576         ;;
4577 esac
4578
4579
4580 case "$usemorebits" in
4581 "$define"|true|[yY]*)
4582         use64bitint="$define"
4583         uselongdouble="$define"
4584         usemorebits="$define"
4585         ;;
4586 *)      usemorebits="$undef"
4587         ;;
4588 esac
4589
4590
4591 case "$uselonglong" in
4592 "$define"|true|[yY]*)
4593         cat <<EOM >&4
4594
4595 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
4596 EOM
4597         use64bitint="$define"
4598         ;;
4599 esac                          
4600 case "$use64bits" in
4601 "$define"|true|[yY]*)
4602         cat <<EOM >&4
4603
4604 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
4605 EOM
4606         use64bitint="$define"
4607         ;;
4608 esac                          
4609 case "$use64bitints" in
4610 "$define"|true|[yY]*)
4611         cat <<EOM >&4
4612
4613 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
4614 EOM
4615         use64bitint="$define"
4616         ;;
4617 esac                          
4618 case "$use64bitsint" in
4619 "$define"|true|[yY]*)
4620         cat <<EOM >&4
4621
4622 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
4623 EOM
4624         use64bitint="$define"
4625         ;;
4626 esac                          
4627 case "$uselonglongs" in
4628 "$define"|true|[yY]*)
4629         cat <<EOM >&4
4630
4631 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
4632 EOM
4633         use64bitint="$define"
4634         ;;
4635 esac                          
4636 case "$use64bitsall" in
4637 "$define"|true|[yY]*)
4638         cat <<EOM >&4
4639
4640 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
4641 EOM
4642         use64bitall="$define"
4643         ;;
4644 esac                          
4645
4646 case "$ccflags" in
4647 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
4648 esac
4649 case "$use64bitall" in
4650 "$define"|true|[yY]*) use64bitint="$define" ;;
4651 esac
4652
4653 case "$longsize" in
4654 8) cat <<EOM
4655
4656 You have natively 64-bit long integers.
4657 EOM
4658    val="$define"
4659    ;;
4660 *) case "$use64bitint" in
4661    "$define"|true|[yY]*) dflt='y';;
4662    *) dflt='n';;
4663    esac
4664    cat <<EOM
4665
4666 Perl can be built to take advantage of 64-bit integer types
4667 on some systems.  To do so, Configure can be run with -Duse64bitint.
4668 Choosing this option will most probably introduce binary incompatibilities.
4669
4670 If this doesn't make any sense to you, just accept the default '$dflt'.
4671 EOM
4672    rp='Try to use 64-bit integers, if available?'
4673    . ./myread
4674    case "$ans" in
4675    [yY]*) val="$define" ;;
4676    *)     val="$undef"  ;;
4677    esac
4678    ;;
4679 esac
4680 set use64bitint
4681 eval $setvar
4682
4683 case "$use64bitall" in
4684 "$define"|true|[yY]*) dflt='y' ;;
4685 *) case "$longsize" in
4686    8) dflt='y' ;;
4687    *) dflt='n' ;;
4688    esac
4689    ;;
4690 esac    
4691 cat <<EOM
4692
4693 You may also choose to try maximal 64-bitness.  It means using as much
4694 64-bitness as possible on the platform.  This in turn means even more
4695 binary incompatibilities.  On the other hand, your platform may not
4696 have any more 64-bitness available than what you already have chosen.
4697
4698 If this doesn't make any sense to you, just accept the default '$dflt'.
4699 EOM
4700 rp='Try to use maximal 64-bit support, if available?'
4701 . ./myread
4702 case "$ans" in
4703 [yY]*) val="$define" ;;
4704 *)     val="$undef"  ;;
4705 esac
4706 set use64bitall
4707 eval $setvar
4708 case "$use64bitall" in
4709 "$define")
4710         case "$use64bitint" in
4711         "$undef")
4712                 cat <<EOM
4713
4714 Since you have chosen a maximally 64-bit build, I'm also turning on
4715 the use of 64-bit integers.
4716 EOM
4717                 use64bitint="$define" ;;
4718         esac
4719         ;;
4720 esac
4721
4722 case "$use64bitint" in
4723 "$define"|true|[yY]*)
4724 : Look for a hint-file generated 'call-back-unit'.  If the
4725 : user has specified that a 64-bit perl is to be built,
4726 : we may need to set or change some other defaults.
4727         if $test -f use64bitint.cbu; then
4728                 echo "Your platform has some specific hints for 64-bit integers, using them..."
4729                 . ./use64bitint.cbu
4730         fi
4731         case "$longsize" in
4732         4) case "$archname64" in
4733            '') archname64=64int ;;
4734            esac
4735            ;;
4736         esac
4737         ;;
4738 esac
4739
4740 case "$use64bitall" in
4741 "$define"|true|[yY]*)
4742 : Look for a hint-file generated 'call-back-unit'.  If the
4743 : user has specified that a maximally 64-bit perl is to be built,
4744 : we may need to set or change some other defaults.
4745         if $test -f use64bitall.cbu; then
4746                 echo "Your platform has some specific hints for 64-bit builds, using them..."
4747                 . ./use64bitall.cbu
4748         fi
4749         case "$longsize" in
4750         4) case "$archname64" in
4751            ''|64int) archname64=64all ;;
4752            esac
4753            ;;
4754         esac
4755         ;;
4756 esac
4757
4758 : determine the architecture name
4759 echo " "
4760 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
4761         tarch=`arch`"-$osname"
4762 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
4763         if uname -m > tmparch 2>&1 ; then
4764                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
4765                         -e 's/$/'"-$osname/" tmparch`
4766         else
4767                 tarch="$osname"
4768         fi
4769         $rm -f tmparch
4770 else
4771         tarch="$osname"
4772 fi
4773 case "$myarchname" in
4774 ''|"$tarch") ;;
4775 *)
4776         echo "(Your architecture name used to be $myarchname.)"
4777         archname=''
4778         ;;
4779 esac
4780 myarchname="$tarch"
4781 case "$archname" in
4782 '') dflt="$tarch";;
4783 *) dflt="$archname";;
4784 esac
4785 rp='What is your architecture name'
4786 . ./myread
4787 archname="$ans"
4788 case "$usethreads" in
4789 $define)
4790         echo "Threads selected." >&4
4791         case "$archname" in
4792         *-thread*) echo "...and architecture name already has -thread." >&4
4793                 ;;
4794         *)      archname="$archname-thread"
4795                 echo "...setting architecture name to $archname." >&4
4796                 ;;
4797         esac
4798         ;;
4799 esac
4800 case "$usemultiplicity" in
4801 $define)
4802         echo "Multiplicity selected." >&4
4803         case "$archname" in
4804         *-multi*) echo "...and architecture name already has -multi." >&4
4805                 ;;
4806         *)      archname="$archname-multi"
4807                 echo "...setting architecture name to $archname." >&4
4808                 ;;
4809         esac
4810         ;;
4811 esac
4812 case "$use64bitint" in
4813 $define)
4814         case "$archname64" in
4815         '')
4816                 ;;
4817         *)
4818                 case "$archname" in
4819                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
4820                         ;;
4821                 *)      archname="$archname-$archname64"
4822                         echo "...setting architecture name to $archname." >&4
4823                         ;;
4824                 esac
4825                 ;;
4826         esac
4827 esac
4828
4829 : determine root of directory hierarchy where package will be installed.
4830 case "$prefix" in
4831 '')
4832         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
4833         ;;
4834 *)
4835         dflt="$prefix"
4836         ;;
4837 esac
4838 $cat <<EOM
4839
4840 By default, $package will be installed in $dflt/bin, manual pages
4841 under $dflt/man, etc..., i.e. with $dflt as prefix for all
4842 installation directories. Typically this is something like /usr/local.
4843 If you wish to have binaries under /usr/bin but other parts of the
4844 installation under /usr/local, that's ok: you will be prompted
4845 separately for each of the installation directories, the prefix being
4846 only used to set the defaults.
4847
4848 EOM
4849 fn=d~
4850 rp='Installation prefix to use?'
4851 . ./getfile
4852 oldprefix=''
4853 case "$prefix" in
4854 '') ;;
4855 *)
4856         case "$ans" in
4857         "$prefix") ;;
4858         *) oldprefix="$prefix";;
4859         esac
4860         ;;
4861 esac
4862 prefix="$ans"
4863 prefixexp="$ansexp"
4864
4865 : is AFS running?
4866 echo " "
4867 case "$afs" in
4868 $define|true)   afs=true ;;
4869 $undef|false)   afs=false ;;
4870 *)      if test -d /afs; then
4871                 afs=true
4872         else
4873                 afs=false
4874         fi
4875         ;;
4876 esac
4877 if $afs; then
4878         echo "AFS may be running... I'll be extra cautious then..." >&4
4879 else
4880         echo "AFS does not seem to be running..." >&4
4881 fi
4882
4883 : determine installation prefix for where package is to be installed.
4884 if $afs; then 
4885 $cat <<EOM
4886
4887 Since you are running AFS, I need to distinguish the directory in which
4888 files will reside from the directory in which they are installed (and from
4889 which they are presumably copied to the former directory by occult means).
4890
4891 EOM
4892         case "$installprefix" in
4893         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
4894         *) dflt="$installprefix";;
4895         esac
4896 else
4897 $cat <<EOM
4898
4899 In some special cases, particularly when building $package for distribution,
4900 it is convenient to distinguish between the directory in which files should 
4901 be installed from the directory ($prefix) in which they 
4902 will eventually reside.  For most users, these two directories are the same.
4903
4904 EOM
4905         case "$installprefix" in
4906         '') dflt=$prefix ;;
4907         *) dflt=$installprefix;;
4908         esac
4909 fi
4910 fn=d~
4911 rp='What installation prefix should I use for installing files?'
4912 . ./getfile
4913 installprefix="$ans"
4914 installprefixexp="$ansexp"
4915
4916 : set the prefixit variable, to compute a suitable default value
4917 prefixit='case "$3" in
4918 ""|none)
4919         case "$oldprefix" in
4920         "") eval "$1=\"\$$2\"";;
4921         *)
4922                 case "$3" in
4923                 "") eval "$1=";;
4924                 none)
4925                         eval "tp=\"\$$2\"";
4926                         case "$tp" in
4927                         ""|" ") eval "$1=\"\$$2\"";;
4928                         *) eval "$1=";;
4929                         esac;;
4930                 esac;;
4931         esac;;
4932 *)
4933         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
4934         case "$tp" in
4935         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
4936         /*-$oldprefix/*|\~*-$oldprefix/*)
4937                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
4938         *) eval "$1=\"\$$2\"";;
4939         esac;;
4940 esac'
4941
4942
4943 : get the patchlevel
4944 echo " "
4945 echo "Getting the current patchlevel..." >&4
4946 if $test -r $rsrc/patchlevel.h;then
4947         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
4948         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
4949         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4950         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
4951         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
4952         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4953 else
4954         revision=0
4955         patchlevel=0
4956         subversion=0
4957         api_revision=0
4958         api_version=0
4959         api_subversion=0
4960 fi
4961 $echo $n "(You have $package revision $revision" $c
4962 $echo $n " patchlevel $patchlevel" $c
4963 test 0 -eq "$subversion" || $echo $n " subversion $subversion" $c
4964 echo ".)"
4965 case "$osname" in
4966 dos|vms)
4967         : XXX Should be a Configure test for double-dots in filenames.
4968         version=`echo $revision $patchlevel $subversion | \
4969                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4970         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4971                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4972         ;;
4973 *)
4974         version=`echo $revision $patchlevel $subversion | \
4975                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4976         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4977                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4978         ;;
4979 esac
4980 : Special case the 5.005_xx maintenance series, which used 5.005
4981 : without any subversion label as a subdirectory in $sitelib
4982 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
4983         api_versionstring='5.005'
4984 fi
4985
4986 : determine installation style
4987 : For now, try to deduce it from prefix unless it is already set.
4988 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
4989 case "$installstyle" in
4990 '')     case "$prefix" in
4991                 *perl*) dflt='lib';;
4992                 *) dflt='lib/perl5' ;;
4993         esac
4994         ;;
4995 *)      dflt="$installstyle" ;;
4996 esac
4997 : Probably not worth prompting for this since we prompt for all
4998 : the directories individually, and the prompt would be too long and
4999 : confusing anyway.
5000 installstyle=$dflt
5001
5002 : determine where private library files go
5003 : Usual default is /usr/local/lib/perl5/$version.
5004 : Also allow things like /opt/perl/lib/$version, since 
5005 : /opt/perl/lib/perl5... would be redundant.
5006 : The default "style" setting is made in installstyle.U
5007 case "$installstyle" in
5008 *lib/perl5*) set dflt privlib lib/$package/$version ;;
5009 *)       set dflt privlib lib/$version ;;
5010 esac
5011 eval $prefixit
5012 $cat <<EOM
5013
5014 There are some auxiliary files for $package that need to be put into a
5015 private library directory that is accessible by everyone.
5016
5017 EOM
5018 fn=d~+
5019 rp='Pathname where the private library files will reside?'
5020 . ./getfile
5021 privlib="$ans"
5022 privlibexp="$ansexp"
5023 : Change installation prefix, if necessary.
5024 if $test X"$prefix" != X"$installprefix"; then
5025         installprivlib=`echo $privlibexp | sed "s#^$prefix#$installprefix#"`
5026 else
5027         installprivlib="$privlibexp"
5028 fi
5029
5030 : set the prefixup variable, to restore leading tilda escape
5031 prefixup='case "$prefixexp" in
5032 "$prefix") ;;
5033 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
5034 esac'
5035
5036 : determine where public architecture dependent libraries go
5037 set archlib archlib
5038 eval $prefixit
5039 : privlib default is /usr/local/lib/$package/$version
5040 : archlib default is /usr/local/lib/$package/$version/$archname
5041 : privlib may have an optional trailing /share.
5042 tdflt=`echo $privlib | $sed 's,/share$,,'`
5043 tdflt=$tdflt/$archname
5044 case "$archlib" in
5045 '')     dflt=$tdflt
5046         ;;
5047 *)      dflt="$archlib"
5048     ;;
5049 esac
5050 $cat <<EOM
5051
5052 $spackage contains architecture-dependent library files.  If you are
5053 sharing libraries in a heterogeneous environment, you might store
5054 these files in a separate location.  Otherwise, you can just include
5055 them with the rest of the public library files.
5056
5057 EOM
5058 fn=d+~
5059 rp='Where do you want to put the public architecture-dependent libraries?'
5060 . ./getfile
5061 archlib="$ans"
5062 archlibexp="$ansexp"
5063 if $test X"$archlib" = X"$privlib"; then
5064         d_archlib="$undef"
5065 else
5066         d_archlib="$define"
5067 fi
5068 : Change installation prefix, if necessary.
5069 if $test X"$prefix" != X"$installprefix"; then
5070         installarchlib=`echo $archlibexp | sed "s#^$prefix#$installprefix#"`
5071 else
5072         installarchlib="$archlibexp"
5073 fi
5074
5075
5076 : Binary compatibility with 5.005 is not possible for builds
5077 : with advanced features
5078 case "$usethreads$usemultiplicity" in
5079 *define*)
5080         bincompat5005="$undef"
5081         d_bincompat5005="$undef"
5082         ;;
5083 *)      $cat <<EOM
5084
5085 This version of Perl can be compiled for binary compatibility with 5.005.
5086 If you decide to do so, you will be able to continue using most of the
5087 extensions that were compiled for Perl 5.005.
5088
5089 EOM
5090         case "$bincompat5005$d_bincompat5005" in
5091         *"$undef"*) dflt=n ;;
5092         *) dflt=y ;;
5093         esac
5094         rp='Binary compatibility with Perl 5.005?'
5095         . ./myread
5096         case "$ans" in
5097         y*) val="$define" ;;
5098         *)  val="$undef" ;;
5099         esac
5100         set d_bincompat5005
5101         eval $setvar
5102         case "$d_bincompat5005" in
5103         "$define")
5104                 bincompat5005="$define"
5105                 ;;
5106         *)      bincompat5005="$undef"
5107                 d_bincompat5005="$undef"
5108                 ;;
5109         esac
5110         ;;
5111 esac
5112
5113
5114 : see if setuid scripts can be secure
5115 $cat <<EOM
5116
5117 Some kernels have a bug that prevents setuid #! scripts from being
5118 secure.  Some sites have disabled setuid #! scripts because of this.
5119
5120 First let's decide if your kernel supports secure setuid #! scripts.
5121 (If setuid #! scripts would be secure but have been disabled anyway,
5122 don't say that they are secure if asked.)
5123
5124 EOM
5125
5126 val="$undef"
5127 if $test -d /dev/fd; then
5128         echo "#!$ls" >reflect
5129         chmod +x,u+s reflect
5130         ./reflect >flect 2>&1
5131         if $contains "/dev/fd" flect >/dev/null; then
5132                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
5133                 val="$define"
5134         else
5135                 $cat <<EOM
5136 If you are not sure if they are secure, I can check but I'll need a
5137 username and password different from the one you are using right now.
5138 If you don't have such a username or don't want me to test, simply
5139 enter 'none'.
5140
5141 EOM
5142                 rp='Other username to test security of setuid scripts with?'
5143                 dflt='none'
5144                 . ./myread
5145                 case "$ans" in
5146                 n|none)
5147                         case "$d_suidsafe" in
5148                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
5149                                 dflt=n;;
5150                         "$undef")
5151                                 echo "Well, the $hint value is *not* secure." >&4
5152                                 dflt=n;;
5153                         *)      echo "Well, the $hint value *is* secure." >&4
5154                                 dflt=y;;
5155                         esac
5156                         ;;
5157                 *)
5158                         $rm -f reflect flect
5159                         echo "#!$ls" >reflect
5160                         chmod +x,u+s reflect
5161                         echo >flect
5162                         chmod a+w flect
5163                         echo '"su" will (probably) prompt you for '"$ans's password."
5164                         su $ans -c './reflect >flect'
5165                         if $contains "/dev/fd" flect >/dev/null; then
5166                                 echo "Okay, it looks like setuid scripts are secure." >&4
5167                                 dflt=y
5168                         else
5169                                 echo "I don't think setuid scripts are secure." >&4
5170                                 dflt=n
5171                         fi
5172                         ;;
5173                 esac
5174                 rp='Does your kernel have *secure* setuid scripts?'
5175                 . ./myread
5176                 case "$ans" in
5177                 [yY]*)  val="$define";;
5178                 *)      val="$undef";;
5179                 esac
5180         fi
5181 else
5182         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
5183         echo "(That's for file descriptors, not floppy disks.)"
5184         val="$undef"
5185 fi
5186 set d_suidsafe
5187 eval $setvar
5188
5189 $rm -f reflect flect
5190
5191 : now see if they want to do setuid emulation
5192 echo " "
5193 val="$undef"
5194 case "$d_suidsafe" in
5195 "$define")
5196         val="$undef"
5197         echo "No need to emulate SUID scripts since they are secure here." >& 4
5198         ;;
5199 *)
5200         $cat <<EOM
5201 Some systems have disabled setuid scripts, especially systems where
5202 setuid scripts cannot be secure.  On systems where setuid scripts have
5203 been disabled, the setuid/setgid bits on scripts are currently
5204 useless.  It is possible for $package to detect those bits and emulate
5205 setuid/setgid in a secure fashion.  This emulation will only work if
5206 setuid scripts have been disabled in your kernel.
5207
5208 EOM
5209         case "$d_dosuid" in
5210         "$define") dflt=y ;;
5211         *) dflt=n ;;
5212         esac
5213         rp="Do you want to do setuid/setgid emulation?"
5214         . ./myread
5215         case "$ans" in
5216         [yY]*)  val="$define";;
5217         *)      val="$undef";;
5218         esac
5219         ;;
5220 esac
5221 set d_dosuid
5222 eval $setvar
5223
5224 : determine filename position in cpp output
5225 echo " "
5226 echo "Computing filename position in cpp output for #include directives..." >&4
5227 echo '#include <stdio.h>' > foo.c
5228 $cat >fieldn <<EOF
5229 $startsh
5230 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5231 $grep '^[       ]*#.*stdio\.h' | \
5232 while read cline; do
5233         pos=1
5234         set \$cline
5235         while $test \$# -gt 0; do
5236                 if $test -r \`echo \$1 | $tr -d '"'\`; then
5237                         echo "\$pos"
5238                         exit 0
5239                 fi
5240                 shift
5241                 pos=\`expr \$pos + 1\`
5242         done
5243 done
5244 EOF
5245 chmod +x fieldn
5246 fieldn=`./fieldn`
5247 $rm -f foo.c fieldn
5248 case $fieldn in
5249 '') pos='???';;
5250 1) pos=first;;
5251 2) pos=second;;
5252 3) pos=third;;
5253 *) pos="${fieldn}th";;
5254 esac
5255 echo "Your cpp writes the filename in the $pos field of the line."
5256
5257 : locate header file
5258 $cat >findhdr <<EOF
5259 $startsh
5260 wanted=\$1
5261 name=''
5262 for usrincdir in $usrinc
5263 do
5264         if test -f \$usrincdir/\$wanted; then
5265                 echo "\$usrincdir/\$wanted"
5266                 exit 0
5267         fi
5268 done
5269 awkprg='{ print \$$fieldn }'
5270 echo "#include <\$wanted>" > foo\$\$.c
5271 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5272 $grep "^[       ]*#.*\$wanted" | \
5273 while read cline; do
5274         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5275         case "\$name" in
5276         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5277         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5278         *) exit 2;;
5279         esac;
5280 done;
5281 #
5282 # status = 0: grep returned 0 lines, case statement not executed
5283 # status = 1: headerfile found
5284 # status = 2: while loop executed, no headerfile found
5285 #
5286 status=\$?
5287 $rm -f foo\$\$.c;
5288 if test \$status -eq 1; then
5289         exit 0;
5290 fi
5291 exit 1
5292 EOF
5293 chmod +x findhdr
5294
5295 : define an alternate in-header-list? function
5296 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5297 cont=true; xxf="echo \"<\$1> found.\" >&4";
5298 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5299 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5300 esac;
5301 case $# in 4) instead=instead;; *) instead="at last";; esac;
5302 while $test "$cont"; do
5303         xxx=`./findhdr $1`
5304         var=$2; eval "was=\$$2";
5305         if $test "$xxx" && $test -r "$xxx";
5306         then eval $xxf;
5307         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5308                 cont="";
5309         else eval $xxnf;
5310         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5311         set $yyy; shift; shift; yyy=$@;
5312         case $# in 0) cont="";;
5313         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5314                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5315         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5316                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5317         esac;
5318 done;
5319 while $test "$yyy";
5320 do set $yyy; var=$2; eval "was=\$$2";
5321         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5322         set $yyy; shift; shift; yyy=$@;
5323 done'
5324
5325 : see if this is a malloc.h system
5326 set malloc.h i_malloc
5327 eval $inhdr
5328
5329 : see if stdlib is available
5330 set stdlib.h i_stdlib
5331 eval $inhdr
5332
5333 : determine which malloc to compile in
5334 echo " "
5335 case "$usemymalloc" in
5336 ''|[yY]*|true|$define)  dflt='y' ;;
5337 *)      dflt='n' ;;
5338 esac
5339 rp="Do you wish to attempt to use the malloc that comes with $package?"
5340 . ./myread
5341 usemymalloc="$ans"
5342 case "$ans" in
5343 y*|true)
5344         usemymalloc='y'
5345         mallocsrc='malloc.c'
5346         mallocobj="malloc$_o"
5347         d_mymalloc="$define"
5348         case "$libs" in
5349         *-lmalloc*)
5350                 : Remove malloc from list of libraries to use
5351                 echo "Removing unneeded -lmalloc from library list" >&4
5352                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
5353                 shift
5354                 libs="$*"
5355                 echo "libs = $libs" >&4
5356                 ;;
5357         esac
5358         ;;
5359 *)
5360         usemymalloc='n'
5361         mallocsrc=''
5362         mallocobj=''
5363         d_mymalloc="$undef"
5364         ;;
5365 esac
5366
5367 : compute the return types of malloc and free
5368 echo " "
5369 $cat >malloc.c <<END
5370 #$i_malloc I_MALLOC
5371 #$i_stdlib I_STDLIB
5372 #include <stdio.h>
5373 #include <sys/types.h>
5374 #ifdef I_MALLOC
5375 #include <malloc.h>
5376 #endif
5377 #ifdef I_STDLIB
5378 #include <stdlib.h>
5379 #endif
5380 #ifdef TRY_MALLOC
5381 void *malloc();
5382 #endif
5383 #ifdef TRY_FREE
5384 void free();
5385 #endif
5386 END
5387 case "$malloctype" in
5388 '')
5389         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
5390                 malloctype='void *'
5391         else
5392                 malloctype='char *'
5393         fi
5394         ;;
5395 esac
5396 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
5397
5398 case "$freetype" in
5399 '')
5400         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
5401                 freetype='void'
5402         else
5403                 freetype='int'
5404         fi
5405         ;;
5406 esac
5407 echo "Your system uses $freetype free(), it would seem." >&4
5408 $rm -f malloc.[co]
5409 $cat <<EOM
5410
5411 After $package is installed, you may wish to install various
5412 add-on modules and utilities.  Typically, these add-ons will
5413 be installed under $prefix with the rest
5414 of this package.  However, you may wish to install such add-ons
5415 elsewhere under a different prefix.
5416
5417 If you do not wish to put everything under a single prefix, that's
5418 ok.  You will be prompted for the individual locations; this siteprefix
5419 is only used to suggest the defaults.
5420
5421 The default should be fine for most people.
5422
5423 EOM
5424 fn=d~+
5425 rp='Installation prefix to use for add-on modules and utilities?'
5426 : XXX Here might be another good place for an installstyle setting.
5427 case "$siteprefix" in
5428 '') dflt=$prefix ;;
5429 *)  dflt=$siteprefix ;;
5430 esac
5431 . ./getfile
5432 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
5433 oldsiteprefix=''
5434 case "$siteprefix" in
5435 '') ;;
5436 *)      case "$ans" in
5437         "$prefix") ;;
5438         *) oldsiteprefix="$prefix";;
5439         esac
5440         ;;
5441 esac
5442 siteprefix="$ans"
5443 siteprefixexp="$ansexp"
5444
5445 : determine where site specific libraries go.
5446 : Usual default is /usr/local/lib/perl5/site_perl/$version
5447 : The default "style" setting is made in installstyle.U
5448 : XXX No longer works with Prefixit stuff.
5449 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
5450 case "$sitelib" in
5451 '') case "$installstyle" in
5452         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
5453         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
5454         esac
5455         ;;
5456 *)      dflt="$sitelib"
5457         ;;
5458 esac
5459 $cat <<EOM
5460
5461 The installation process will create a directory for
5462 site-specific extensions and modules.  Most users find it convenient
5463 to place all site-specific files in this directory rather than in the
5464 main distribution directory.
5465
5466 EOM
5467 fn=d~+
5468 rp='Pathname for the site-specific library files?'
5469 . ./getfile
5470 sitelib="$ans"
5471 sitelibexp="$ansexp"
5472 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
5473 : Change installation prefix, if necessary.
5474 if $test X"$prefix" != X"$installprefix"; then
5475         installsitelib=`echo $sitelibexp | $sed "s#^$prefix#$installprefix#"`
5476 else
5477         installsitelib="$sitelibexp"
5478 fi
5479
5480 : determine where site specific architecture-dependent libraries go.
5481 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
5482 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
5483 : sitelib may have an optional trailing /share.
5484 case "$sitearch" in
5485 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
5486         dflt="$dflt/$archname"
5487         ;;
5488 *)      dflt="$sitearch"
5489         ;;
5490 esac
5491 set sitearch sitearch none
5492 eval $prefixit
5493 $cat <<EOM
5494
5495 The installation process will also create a directory for
5496 architecture-dependent site-specific extensions and modules.
5497
5498 EOM
5499 fn=d~+
5500 rp='Pathname for the site-specific architecture-dependent library files?'
5501 . ./getfile
5502 sitearch="$ans"
5503 sitearchexp="$ansexp"
5504 : Change installation prefix, if necessary.
5505 if $test X"$prefix" != X"$installprefix"; then
5506         installsitearch=`echo $sitearchexp | sed "s#^$prefix#$installprefix#"`
5507 else
5508         installsitearch="$sitearchexp"
5509 fi
5510
5511 $cat <<EOM
5512
5513 The installation process will also create a directory for
5514 vendor-supplied add-ons.  Vendors who supply perl with their system
5515 may find it convenient to place all vendor-supplied files in this
5516 directory rather than in the main distribution directory.  This will
5517 ease upgrades between binary-compatible maintenance versions of perl.
5518
5519 Of course you may also use these directories in whatever way you see
5520 fit.  For example, you might use them to access modules shared over a
5521 company-wide network.
5522
5523 The default answer should be fine for most people.
5524 This causes further questions about vendor add-ons to be skipped
5525 and no vendor-specific directories will be configured for perl.
5526
5527 EOM
5528 rp='Do you want to configure vendor-specific add-on directories?'
5529 case "$usevendorprefix" in
5530 define|true|[yY]*) dflt=y ;;
5531 *)      : User may have set vendorprefix directly on Configure command line.
5532         case "$vendorprefix" in
5533         ''|' ') dflt=n ;;
5534         *)      dflt=y ;;
5535         esac
5536         ;;
5537 esac
5538 . ./myread
5539 case "$ans" in
5540 [yY]*)  fn=d~+
5541         rp='Installation prefix to use for vendor-supplied add-ons?'
5542         case "$vendorprefix" in
5543         '') dflt='' ;;
5544         *)  dflt=$vendorprefix ;;
5545         esac
5546         . ./getfile
5547         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
5548         oldvendorprefix=''
5549         case "$vendorprefix" in
5550         '') ;;
5551         *)      case "$ans" in
5552                 "$prefix") ;;
5553                 *) oldvendorprefix="$prefix";;
5554                 esac
5555                 ;;
5556         esac
5557         usevendorprefix="$define"
5558         vendorprefix="$ans"
5559         vendorprefixexp="$ansexp"
5560         ;;
5561 *)      usevendorprefix="$undef"
5562         vendorprefix=''
5563         vendorprefixexp=''
5564         ;;
5565 esac
5566
5567 case "$vendorprefix" in
5568 '')     d_vendorlib="$undef"
5569         vendorlib=''
5570         vendorlibexp=''
5571         ;;
5572 *)      d_vendorlib="$define"
5573         : determine where vendor-supplied modules go.
5574         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
5575         case "$vendorlib" in
5576         '')
5577                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
5578                 case "$installstyle" in
5579                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
5580                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
5581                 esac
5582                 ;;
5583         *)      dflt="$vendorlib"
5584                 ;;
5585         esac
5586         fn=d~+
5587         rp='Pathname for the vendor-supplied library files?'
5588         . ./getfile
5589         vendorlib="$ans"
5590         vendorlibexp="$ansexp"
5591         ;;
5592 esac
5593 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
5594 : Change installation prefix, if necessary.
5595 if $test X"$prefix" != X"$installprefix"; then
5596         installvendorlib=`echo $vendorlibexp | $sed "s#^$prefix#$installprefix#"`
5597 else
5598         installvendorlib="$vendorlibexp"
5599 fi
5600
5601 case "$vendorprefix" in
5602 '')     d_vendorarch="$undef"
5603         vendorarch=''
5604         vendorarchexp=''
5605         ;;
5606 *)      d_vendorarch="$define"
5607         : determine where vendor-supplied architecture-dependent libraries go.
5608         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
5609         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
5610         : vendorlib may have an optional trailing /share.
5611         case "$vendorarch" in
5612         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
5613                 dflt="$dflt/$archname"
5614                 ;;
5615         *)      dflt="$vendorarch" ;;
5616         esac
5617         fn=d~+
5618         rp='Pathname for vendor-supplied architecture-dependent files?'
5619         . ./getfile
5620         vendorarch="$ans"
5621         vendorarchexp="$ansexp"
5622         ;;
5623 esac
5624 : Change installation prefix, if necessary.
5625 if $test X"$prefix" != X"$installprefix"; then
5626         installvendorarch=`echo $vendorarchexp | sed "s#^$prefix#$installprefix#"`
5627 else
5628         installvendorarch="$vendorarchexp"
5629 fi
5630
5631 : Final catch-all directories to search
5632 $cat <<EOM
5633
5634 Lastly, you can have perl look in other directories for extensions and
5635 modules in addition to those already specified.
5636 These directories will be searched after 
5637         $sitearch 
5638         $sitelib 
5639 EOM
5640 test X"$vendorlib" != "X" && echo '     ' $vendorlib
5641 test X"$vendorarch" != "X" && echo '    ' $vendorarch
5642 echo ' '
5643 case "$otherlibdirs" in
5644 ''|' ') dflt='none' ;;
5645 *)      dflt="$otherlibdirs" ;;
5646 esac
5647 $cat <<EOM
5648 Enter a colon-separated set of extra paths to include in perl's @INC
5649 search path, or enter 'none' for no extra paths.
5650
5651 EOM
5652
5653 rp='Colon-separated list of additional directories for perl to search?'
5654 . ./myread
5655 case "$ans" in
5656 ' '|''|none)    otherlibdirs=' ' ;;     
5657 *)      otherlibdirs="$ans" ;;
5658 esac
5659 case "$otherlibdirs" in
5660 ' ') val=$undef ;;
5661 *)      val=$define ;;
5662 esac
5663 set d_perl_otherlibdirs
5664 eval $setvar
5665
5666 : Cruising for prototypes
5667 echo " "
5668 echo "Checking out function prototypes..." >&4
5669 $cat >prototype.c <<'EOCP'
5670 int main(int argc, char *argv[]) {
5671         exit(0);}
5672 EOCP
5673 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
5674         echo "Your C compiler appears to support function prototypes."
5675         val="$define"
5676 else
5677         echo "Your C compiler doesn't seem to understand function prototypes."
5678         val="$undef"
5679 fi
5680 set prototype
5681 eval $setvar
5682 $rm -f prototype*
5683
5684 case "$prototype" in
5685 "$define") ;;
5686 *)      ansi2knr='ansi2knr'
5687         echo " "
5688         cat <<EOM >&4
5689
5690 $me:  FATAL ERROR:
5691 This version of $package can only be compiled by a compiler that 
5692 understands function prototypes.  Unfortunately, your C compiler 
5693         $cc $ccflags
5694 doesn't seem to understand them.  Sorry about that.
5695
5696 If GNU cc is available for your system, perhaps you could try that instead.  
5697
5698 Eventually, we hope to support building Perl with pre-ANSI compilers.
5699 If you would like to help in that effort, please contact <perlbug@perl.org>.
5700
5701 Aborting Configure now.
5702 EOM
5703         exit 2
5704         ;;
5705 esac
5706
5707 : determine where public executables go
5708 echo " "
5709 set dflt bin bin
5710 eval $prefixit
5711 fn=d~
5712 rp='Pathname where the public executables will reside?'
5713 . ./getfile
5714 if $test "X$ansexp" != "X$binexp"; then
5715         installbin=''
5716 fi
5717 bin="$ans"
5718 binexp="$ansexp"
5719 : Change installation prefix, if necessary.
5720 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
5721 if $test X"$prefix" != X"$installprefix"; then
5722         installbin=`echo $binexp | sed "s#^$prefix#$installprefix#"`
5723 else
5724         installbin="$binexp"
5725 fi
5726
5727 : Find perl5.005 or later.
5728 echo "Looking for a previously installed perl5.005 or later... "
5729 case "$perl5" in
5730 '')     for tdir in `echo "$binexp:$PATH" | $sed "s/$path_sep/ /g"`; do
5731                 : Check if this perl is recent and can load a simple module
5732                 if $test -x $tdir/perl && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
5733                         perl5=$tdir/perl
5734                         break;
5735                 elif $test -x $tdir/perl5 && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
5736                         perl5=$tdir/perl
5737                         break;
5738                 fi
5739         done
5740         ;;
5741 *)      perl5="$perl5"
5742         ;;
5743 esac
5744 case "$perl5" in
5745 '')     echo "None found.  That's ok.";;
5746 *)      echo "Using $perl5." ;;
5747 esac
5748
5749 : Determine list of previous versions to include in @INC
5750 $cat > getverlist <<EOPL
5751 #!$perl5 -w
5752 use File::Basename;
5753 \$api_versionstring = "$api_versionstring";
5754 \$version = "$version";
5755 \$stem = "$sitelib_stem";
5756 \$archname = "$archname";
5757 EOPL
5758         $cat >> getverlist <<'EOPL'
5759 # Can't have leading @ because metaconfig interprets it as a command!
5760 ;@inc_version_list=();
5761 # XXX Redo to do opendir/readdir? 
5762 if (-d $stem) {
5763     chdir($stem);
5764     ;@candidates = glob("5.*");
5765 }
5766 else {
5767     ;@candidates = ();
5768 }
5769
5770 # XXX ToDo:  These comparisons must be reworked when two-digit
5771 # subversions come along, so that 5.7.10 compares as greater than
5772 # 5.7.3!  By that time, hope that 5.6.x is sufficiently
5773 # widespread that we can use the built-in version vectors rather
5774 # than reinventing them here.  For 5.6.0, however, we must
5775 # assume this script will likely be run by 5.005_0x.  --AD 1/2000.
5776 foreach $d (@candidates) {
5777     if ($d lt $version) {
5778         if ($d ge $api_versionstring) {
5779             unshift(@inc_version_list, grep { -d } "$d/$archname", $d);
5780         }
5781         elsif ($d ge "5.005") {
5782             unshift(@inc_version_list, grep { -d } $d);
5783         }
5784     }
5785     else {
5786         # Skip newer version.  I.e. don't look in
5787         # 5.7.0 if we're installing 5.6.1.
5788     }
5789 }
5790
5791 if (@inc_version_list) {
5792     print join(' ', @inc_version_list);
5793 }
5794 else {
5795     # Blank space to preserve value for next Configure run.
5796     print " ";
5797 }
5798 EOPL
5799 chmod +x getverlist
5800 case "$inc_version_list" in
5801 '')     if test -x "$perl5"; then
5802                 dflt=`$perl5 getverlist`
5803         else
5804                 dflt='none'
5805         fi
5806         ;;
5807 $undef) dflt='none' ;;
5808 *)  dflt="$inc_version_list" ;;
5809 esac
5810 case "$dflt" in
5811 ''|' ') dflt=none ;;
5812 esac
5813 case "$dflt" in
5814 5.005) case "$bincompat5005" in
5815        $define|true|[yY]*) ;;
5816        *) dflt=none ;;
5817        esac
5818        ;;
5819 esac
5820 $cat <<'EOM'
5821
5822 In order to ease the process of upgrading, this version of perl 
5823 can be configured to use modules built and installed with earlier 
5824 versions of perl that were installed under $prefix.  Specify here
5825 the list of earlier versions that this version of perl should check.
5826 If Configure detected no earlier versions of perl installed under
5827 $prefix, then the list will be empty.  Answer 'none' to tell perl
5828 to not search earlier versions.
5829
5830 The default should almost always be sensible, so if you're not sure,
5831 just accept the default.
5832 EOM
5833
5834 rp='List of earlier versions to include in @INC?'
5835 . ./myread
5836 case "$ans" in
5837 [Nn]one|''|' ') inc_version_list=' ' ;;
5838 *) inc_version_list="$ans" ;;
5839 esac
5840 case "$inc_version_list" in
5841 ''|' ') 
5842         inc_version_list_init='0';;
5843 *)      inc_version_list_init=`echo $inc_version_list |
5844                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
5845         ;;
5846 esac
5847 $rm -f getverlist
5848
5849 : determine whether to install perl also as /usr/bin/perl
5850
5851 echo " "
5852 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
5853         $cat <<EOM
5854 Many scripts expect perl to be installed as /usr/bin/perl.
5855 I can install the perl you are about to compile also as /usr/bin/perl
5856 (in addition to $installbin/perl).
5857 EOM
5858         case "$installusrbinperl" in
5859         "$undef"|[nN]*) dflt='n';;
5860         *)              dflt='y';;
5861         esac
5862         rp="Do you want to install perl as /usr/bin/perl?"
5863         . ./myread
5864         case "$ans" in
5865         [yY]*)  val="$define";;
5866         *)      val="$undef" ;;
5867         esac
5868 else
5869         val="$undef"
5870 fi
5871 set installusrbinperl
5872 eval $setvar
5873
5874 echo " "
5875 echo "Checking for GNU C Library..." >&4
5876 cat >gnulibc.c <<EOM
5877 #include <stdio.h>
5878 int main()
5879 {
5880 #ifdef __GLIBC__
5881     exit(0);
5882 #else
5883     exit(1);
5884 #endif
5885 }
5886 EOM
5887 set gnulibc
5888 if eval $compile_ok && ./gnulibc; then
5889         val="$define"
5890         echo "You are using the GNU C Library"
5891 else
5892         val="$undef"
5893         echo "You are not using the GNU C Library"
5894 fi
5895 $rm -f gnulibc*
5896 set d_gnulibc
5897 eval $setvar
5898
5899 : see if nm is to be used to determine whether a symbol is defined or not
5900 case "$usenm" in
5901 '')
5902         dflt=''
5903         case "$d_gnulibc" in
5904         "$define")
5905                 echo " "
5906                 echo "nm probably won't work on the GNU C Library." >&4
5907                 dflt=n
5908                 ;;
5909         esac
5910         case "$dflt" in
5911         '') 
5912                 if $test "$osname" = aix -a ! -f /lib/syscalls.exp; then
5913                         echo " "
5914                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
5915                         echo "'nm' won't be sufficient on this sytem." >&4
5916                         dflt=n
5917                 fi
5918                 ;;
5919         esac
5920         case "$dflt" in
5921         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
5922                 if $test $dflt -gt 20; then
5923                         dflt=y
5924                 else
5925                         dflt=n
5926                 fi
5927                 ;;
5928         esac
5929         ;;
5930 *)
5931         case "$usenm" in
5932         true|$define) dflt=y;;
5933         *) dflt=n;;
5934         esac
5935         ;;
5936 esac
5937 $cat <<EOM
5938
5939 I can use $nm to extract the symbols from your C libraries. This
5940 is a time consuming task which may generate huge output on the disk (up
5941 to 3 megabytes) but that should make the symbols extraction faster. The
5942 alternative is to skip the 'nm' extraction part and to compile a small
5943 test program instead to determine whether each symbol is present. If
5944 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
5945 this may be the best solution.
5946
5947 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
5948
5949 EOM
5950 rp="Shall I use $nm to extract C symbols from the libraries?"
5951 . ./myread
5952 case "$ans" in
5953 [Nn]*) usenm=false;;
5954 *) usenm=true;;
5955 esac
5956
5957 runnm=$usenm
5958 case "$reuseval" in
5959 true) runnm=false;;
5960 esac
5961
5962 : nm options which may be necessary
5963 case "$nm_opt" in
5964 '') if $test -f /mach_boot; then
5965                 nm_opt=''       # Mach
5966         elif $test -d /usr/ccs/lib; then
5967                 nm_opt='-p'     # Solaris (and SunOS?)
5968         elif $test -f /dgux; then
5969                 nm_opt='-p'     # DG-UX
5970         elif $test -f /lib64/rld; then
5971                 nm_opt='-p'     # 64-bit Irix
5972         else
5973                 nm_opt=''
5974         fi;;
5975 esac
5976
5977 : nm options which may be necessary for shared libraries but illegal
5978 : for archive libraries.  Thank you, Linux.
5979 case "$nm_so_opt" in
5980 '')     case "$myuname" in
5981         *linux*)
5982                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
5983                         nm_so_opt='--dynamic'
5984                 fi
5985                 ;;
5986         esac
5987         ;;
5988 esac
5989
5990 case "$runnm" in
5991 true)
5992 : get list of predefined functions in a handy place
5993 echo " "
5994 case "$libc" in
5995 '') libc=unknown
5996         case "$libs" in
5997         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
5998         esac
5999         ;;
6000 esac
6001 libnames='';
6002 case "$libs" in
6003 '') ;;
6004 *)  for thislib in $libs; do
6005         case "$thislib" in
6006         -lc|-lc_s)
6007                 : Handle C library specially below.
6008                 ;;
6009         -l*)
6010                 thislib=`echo $thislib | $sed -e 's/^-l//'`
6011                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
6012                         :
6013                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
6014                         :
6015                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
6016                         :
6017                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
6018                         :
6019                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
6020                         :
6021                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
6022                         :
6023                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
6024                         :
6025                 else
6026                         try=''
6027                 fi
6028                 libnames="$libnames $try"
6029                 ;;
6030         *) libnames="$libnames $thislib" ;;
6031         esac
6032         done
6033         ;;
6034 esac
6035 xxx=normal
6036 case "$libc" in
6037 unknown)
6038         set /lib/libc.$so
6039         for xxx in $libpth; do
6040                 $test -r $1 || set $xxx/libc.$so
6041                 : The messy sed command sorts on library version numbers.
6042                 $test -r $1 || \
6043                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
6044                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
6045                                 h
6046                                 s/[0-9][0-9]*/0000&/g
6047                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
6048                                 G
6049                                 s/\n/ /' | \
6050                          sort | $sed -e 's/^.* //'`
6051                 eval set \$$#
6052         done
6053         $test -r $1 || set /usr/ccs/lib/libc.$so
6054         $test -r $1 || set /lib/libsys_s$_a
6055         ;;
6056 *)
6057         set blurfl
6058         ;;
6059 esac
6060 if $test -r "$1"; then
6061         echo "Your (shared) C library seems to be in $1."
6062         libc="$1"
6063 elif $test -r /lib/libc && $test -r /lib/clib; then
6064         echo "Your C library seems to be in both /lib/clib and /lib/libc."
6065         xxx=apollo
6066         libc='/lib/clib /lib/libc'
6067         if $test -r /lib/syslib; then
6068                 echo "(Your math library is in /lib/syslib.)"
6069                 libc="$libc /lib/syslib"
6070         fi
6071 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
6072         echo "Your C library seems to be in $libc, as you said before."
6073 elif $test -r $incpath/usr/lib/libc$_a; then
6074         libc=$incpath/usr/lib/libc$_a;
6075         echo "Your C library seems to be in $libc.  That's fine."
6076 elif $test -r /lib/libc$_a; then
6077         libc=/lib/libc$_a;
6078         echo "Your C library seems to be in $libc.  You're normal."
6079 else
6080         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
6081                 :
6082         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
6083                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
6084         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
6085                 :
6086         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
6087                 :
6088         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
6089                 :
6090         else
6091                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
6092         fi
6093         if $test -r "$tans"; then
6094                 echo "Your C library seems to be in $tans, of all places."
6095                 libc=$tans
6096         else
6097                 libc='blurfl'
6098         fi
6099 fi
6100 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
6101         dflt="$libc"
6102         cat <<EOM
6103
6104 If the guess above is wrong (which it might be if you're using a strange
6105 compiler, or your machine supports multiple models), you can override it here.
6106
6107 EOM
6108 else
6109         dflt=''
6110         echo $libpth | tr ' ' $trnl | sort | uniq > libpath
6111         cat >&4 <<EOM
6112 I can't seem to find your C library.  I've looked in the following places:
6113
6114 EOM
6115         $sed 's/^/      /' libpath
6116         cat <<EOM
6117
6118 None of these seems to contain your C library. I need to get its name...
6119
6120 EOM
6121 fi
6122 fn=f
6123 rp='Where is your C library?'
6124 . ./getfile
6125 libc="$ans"
6126
6127 echo " "
6128 echo $libc $libnames | tr ' ' $trnl | sort | uniq > libnames
6129 set X `cat libnames`
6130 shift
6131 xxx=files
6132 case $# in 1) xxx=file; esac
6133 echo "Extracting names from the following $xxx for later perusal:" >&4
6134 echo " "
6135 $sed 's/^/      /' libnames >&4
6136 echo " "
6137 $echo $n "This may take a while...$c" >&4
6138
6139 for file in $*; do
6140         case $file in
6141         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
6142         *) $nm $nm_opt $file 2>/dev/null;;
6143         esac
6144 done >libc.tmp
6145
6146 $echo $n ".$c"
6147 $grep fprintf libc.tmp > libc.ptf
6148 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
6149 xrun='eval "<libc.tmp $com >libc.list"; echo "done" >&4'
6150 xxx='[ADTSIW]'
6151 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *_[_.]*//p' -e 's/^.* $xxx  *//p'";\
6152         eval $xscan;\
6153         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6154                 eval $xrun
6155 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
6156         eval $xscan;\
6157         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6158                 eval $xrun
6159 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
6160         eval $xscan;\
6161         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6162                 eval $xrun
6163 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
6164         eval $xscan;\
6165         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6166                 eval $xrun
6167 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
6168         eval $xscan;\
6169         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6170                 eval $xrun
6171 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
6172         eval $xscan;\
6173         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6174                 eval $xrun
6175 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
6176                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
6177         eval $xscan;\
6178         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6179                 eval $xrun
6180 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
6181         eval $xscan;\
6182         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6183                 eval $xrun
6184 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
6185         eval $xscan;\
6186         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6187                 eval $xrun
6188 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
6189         eval $xscan;\
6190         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6191                 eval $xrun
6192 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
6193         eval $xscan;\
6194         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6195                 eval $xrun
6196 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
6197         eval $xscan;\
6198         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6199                 eval $xrun
6200 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
6201         eval $xscan;\
6202         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6203                 eval $xrun
6204 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
6205         eval $xscan;\
6206         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6207                 eval $xrun
6208 else
6209         $nm -p $* 2>/dev/null >libc.tmp
6210         $grep fprintf libc.tmp > libc.ptf
6211         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
6212                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
6213         then
6214                 nm_opt='-p'
6215                 eval $xrun
6216         else
6217                 echo " "
6218                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
6219                 com=''
6220                 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
6221                         for thisname in $libnames $libc; do
6222                                 $ar t $thisname >>libc.tmp
6223                         done
6224                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
6225                         echo "Ok." >&4
6226                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
6227                         # Repeat libc to extract forwarders to DLL entries too
6228                         for thisname in $libnames $libc; do
6229                                 $ar tv $thisname >>libc.tmp
6230                                 # Revision 50 of EMX has bug in $ar.
6231                                 # it will not extract forwarders to DLL entries
6232                                 # Use emximp which will extract exactly them.
6233                                 emximp -o tmp.imp $thisname \
6234                                     2>/dev/null && \
6235                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
6236                                     < tmp.imp >>libc.tmp
6237                                 $rm tmp.imp
6238                         done
6239                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
6240                         echo "Ok." >&4
6241                 else
6242                         echo "$ar didn't seem to work right." >&4
6243                         echo "Maybe this is a Cray...trying bld instead..." >&4
6244                         if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
6245                         then
6246                                 for thisname in $libnames; do
6247                                         bld t $libnames | \
6248                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
6249                                         $ar t $thisname >>libc.tmp
6250                                 done
6251                                 echo "Ok." >&4
6252                         else
6253                                 echo "That didn't work either.  Giving up." >&4
6254                                 exit 1
6255                         fi
6256                 fi
6257         fi
6258 fi
6259 nm_extract="$com"
6260 if $test -f /lib/syscalls.exp; then
6261         echo " "
6262         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
6263         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*$/\1/p' /lib/syscalls.exp >>libc.list
6264 fi
6265 ;;
6266 esac
6267 $rm -f libnames libpath
6268
6269 : see if dld is available
6270 set dld.h i_dld
6271 eval $inhdr
6272
6273 : is a C symbol defined?
6274 csym='tlook=$1;
6275 case "$3" in
6276 -v) tf=libc.tmp; tc=""; tdc="";;
6277 -a) tf=libc.tmp; tc="[0]"; tdc="[]";;
6278 *) tlook="^$1\$"; tf=libc.list; tc="()"; tdc="()";;
6279 esac;
6280 tx=yes;
6281 case "$reuseval-$4" in
6282 true-) ;;
6283 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
6284 esac;
6285 case "$tx" in
6286 yes)
6287         case "$runnm" in
6288         true)
6289                 if $contains $tlook $tf >/dev/null 2>&1;
6290                 then tval=true;
6291                 else tval=false;
6292                 fi;;
6293         *)
6294                 echo "int main() { extern short $1$tdc; printf(\"%hd\", $1$tc); }" > t.c;
6295                 if $cc $optimize $ccflags $ldflags -o t t.c $libs >/dev/null 2>&1;
6296                 then tval=true;
6297                 else tval=false;
6298                 fi;
6299                 $rm -f t t.c;;
6300         esac;;
6301 *)
6302         case "$tval" in
6303         $define) tval=true;;
6304         *) tval=false;;
6305         esac;;
6306 esac;
6307 eval "$2=$tval"'
6308
6309 : define an is-in-libc? function
6310 inlibc='echo " "; td=$define; tu=$undef;
6311 sym=$1; var=$2; eval "was=\$$2";
6312 tx=yes;
6313 case "$reuseval$was" in
6314 true) ;;
6315 true*) tx=no;;
6316 esac;
6317 case "$tx" in
6318 yes)
6319         set $sym tres -f;
6320         eval $csym;
6321         case "$tres" in
6322         true)
6323                 echo "$sym() found." >&4;
6324                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
6325         *)
6326                 echo "$sym() NOT found." >&4;
6327                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
6328         esac;;
6329 *)
6330         case "$was" in
6331         $define) echo "$sym() found." >&4;;
6332         *) echo "$sym() NOT found." >&4;;
6333         esac;;
6334 esac'
6335
6336 : see if dlopen exists
6337 xxx_runnm="$runnm"
6338 runnm=false
6339 set dlopen d_dlopen
6340 eval $inlibc
6341 runnm="$xxx_runnm"
6342
6343 : determine which dynamic loading, if any, to compile in
6344 echo " "
6345 dldir="ext/DynaLoader"
6346 case "$usedl" in
6347 $define|y|true)
6348         dflt='y'
6349         usedl="$define"
6350         ;;
6351 $undef|n|false)
6352         dflt='n'
6353         usedl="$undef"
6354         ;;
6355 *) 
6356         dflt='n'
6357         case "$d_dlopen" in
6358             $define) dflt='y' ;;
6359         esac
6360         case "$i_dld" in
6361             $define) dflt='y' ;;
6362         esac
6363         : Does a dl_xxx.xs file exist for this operating system
6364         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
6365         ;;
6366 esac
6367 rp="Do you wish to use dynamic loading?"
6368 . ./myread
6369 usedl="$ans"
6370 case "$ans" in
6371 y*) usedl="$define"
6372         case "$dlsrc" in
6373         '')
6374                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
6375                         dflt="$dldir/dl_${osname}.xs"
6376                 elif $test "$d_dlopen" = "$define" ; then
6377                         dflt="$dldir/dl_dlopen.xs"
6378                 elif $test "$i_dld" = "$define" ; then
6379                         dflt="$dldir/dl_dld.xs"
6380                 else
6381                         dflt=''
6382                 fi
6383                 ;;
6384         *)      dflt="$dldir/$dlsrc"
6385                 ;;
6386         esac
6387     echo "The following dynamic loading files are available:"
6388         : Can not go over to $dldir because getfile has path hard-coded in.
6389         tdir=`pwd`; cd $rsrc; $ls -C $dldir/dl*.xs; cd $tdir
6390         rp="Source file to use for dynamic loading"
6391         fn="fne"
6392         gfpth="$src"
6393         . ./getfile
6394         usedl="$define"
6395         : emulate basename
6396         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
6397
6398         $cat << EOM
6399
6400 Some systems may require passing special flags to $cc -c to
6401 compile modules that will be used to create a shared library.
6402 To use no flags, say "none".
6403
6404 EOM
6405     case "$cccdlflags" in
6406     '') case "$gccversion" in
6407                 '') case "$osname" in
6408                         hpux)   dflt='+z' ;;
6409                         next)   dflt='none' ;;
6410                         irix*)  dflt='-KPIC' ;;
6411                         svr4*|esix*|solaris) dflt='-KPIC' ;;
6412                         sunos)  dflt='-pic' ;;
6413                         *)      dflt='none' ;;
6414                     esac
6415                         ;;
6416                 *)  case "$osname" in
6417                         svr4*|esix*|solaris) dflt='-fPIC' ;;
6418                         *)      dflt='-fpic' ;;
6419                     esac ;;
6420             esac ;;
6421         ' ') dflt='none' ;;
6422     *)  dflt="$cccdlflags" ;;
6423     esac
6424     rp="Any special flags to pass to $cc -c to compile shared library modules?"
6425     . ./myread
6426     case "$ans" in
6427     none) cccdlflags=' ' ;;
6428     *) cccdlflags="$ans" ;;
6429     esac
6430
6431     cat << EOM
6432
6433 Some systems use ld to create libraries that can be dynamically loaded,
6434 while other systems (such as those using ELF) use $cc.
6435
6436 EOM
6437         case "$ld" in
6438         '')     $cat >try.c <<'EOM'
6439 /* Test for whether ELF binaries are produced */
6440 #include <fcntl.h>
6441 #include <stdlib.h>
6442 int main() {
6443         char b[4];
6444         int i = open("a.out",O_RDONLY);
6445         if(i == -1) 
6446                 exit(1); /* fail */
6447         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
6448                 exit(0); /* succeed (yes, it's ELF) */
6449         else
6450                 exit(1); /* fail */
6451 }
6452 EOM
6453                 if $cc $ccflags try.c >/dev/null 2>&1 && ./a.out; then
6454                         cat <<EOM
6455 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
6456 EOM
6457                         dflt="$cc"
6458                 else
6459                         echo "I'll use ld to build dynamic libraries."
6460                         dflt='ld'
6461                 fi
6462                 rm -f try.c a.out
6463                 ;;
6464         *)      dflt="$ld"
6465                 ;;
6466         esac
6467
6468     rp="What command should be used to create dynamic libraries?"
6469     . ./myread
6470         ld="$ans"
6471
6472     cat << EOM
6473
6474 Some systems may require passing special flags to $ld to create a
6475 library that can be dynamically loaded.  If your ld flags include
6476 -L/other/path options to locate libraries outside your loader's normal
6477 search path, you may need to specify those -L options here as well.  To
6478 use no flags, say "none".
6479
6480 EOM
6481     case "$lddlflags" in
6482     '') case "$osname" in
6483                         beos) dflt='-nostart' ;;
6484                         hpux) dflt='-b';
6485                               case "$gccversion" in
6486                               '') dflt="$dflt +vnocompatwarnings" ;;
6487                               esac
6488                               ;;        
6489                         linux|irix*)    dflt='-shared' ;;
6490                         next)  dflt='none' ;;
6491                         solaris) dflt='-G' ;;
6492                         sunos) dflt='-assert nodefinitions' ;;
6493                         svr4*|esix*) dflt="-G $ldflags" ;;
6494                 *)     dflt='none' ;;
6495                         esac
6496                         ;;
6497     *) dflt="$lddlflags" ;;
6498     esac
6499
6500         : Try to guess additional flags to pick up local libraries.
6501         : Be careful not to append to a plain 'none'
6502         case "$dflt" in
6503         none) dflt='' ;;
6504         esac
6505         for thisflag in $ldflags; do
6506                 case "$thisflag" in
6507                 -L*)
6508                         case " $dflt " in
6509                         *" $thisflag "*) ;;
6510                         *) dflt="$dflt $thisflag" ;;
6511                         esac
6512                         ;;
6513                 esac
6514         done
6515
6516         case "$dflt" in
6517         ''|' ') dflt='none' ;;
6518         esac
6519
6520     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
6521     . ./myread
6522     case "$ans" in
6523     none) lddlflags=' ' ;;
6524     *) lddlflags="$ans" ;;
6525     esac
6526
6527         cat <<EOM
6528
6529 Some systems may require passing special flags to $cc to indicate that
6530 the resulting executable will use dynamic linking.  To use no flags,
6531 say "none".
6532
6533 EOM
6534     case "$ccdlflags" in
6535     '') case "$osname" in
6536                 hpux)   dflt='-Wl,-E' ;;
6537                 linux)  dflt='-rdynamic' ;;
6538                 next)   dflt='none' ;;
6539                 sunos)  dflt='none' ;;
6540                 *)      dflt='none' ;;
6541             esac ;;
6542     ' ')  dflt='none' ;;
6543     *)  dflt="$ccdlflags" ;;
6544     esac
6545     rp="Any special flags to pass to $cc to use dynamic linking?"
6546     . ./myread
6547     case "$ans" in
6548     none) ccdlflags=' ' ;;
6549     *) ccdlflags="$ans" ;;
6550     esac
6551     ;;
6552 *)  usedl="$undef"
6553         ld='ld'
6554     dlsrc='dl_none.xs'
6555     lddlflags=''
6556     ccdlflags=''
6557     ;;
6558 esac
6559
6560 also=''
6561 case "$usedl" in
6562 $undef)
6563         # No dynamic loading being used, so don't bother even to prompt.
6564         useshrplib='false'
6565         ;;
6566 *)      case "$useshrplib" in
6567         '')     case "$osname" in
6568                 svr4*|dgux|dynixptx|esix|powerux|beos|cygwin*)
6569                         dflt=y
6570                         also='Building a shared libperl is required for dynamic loading to work on your system.'
6571                         ;;
6572                 next*)
6573                         case "$osvers" in
6574                         4*)     dflt=y
6575                                 also='Building a shared libperl is needed for MAB support.'
6576                                 ;;
6577                         *)      dflt=n
6578                                 ;;
6579                         esac
6580                         ;;
6581                 *)      dflt=n
6582                         ;;
6583                 esac
6584                 ;;
6585         $define|true|[Yy]*)
6586                 dflt=y
6587                 ;;
6588         *)      dflt=n
6589                 ;;
6590         esac
6591         $cat << EOM
6592
6593 The perl executable is normally obtained by linking perlmain.c with
6594 libperl${_a}, any static extensions (usually just DynaLoader), and
6595 any other libraries needed on this system (such as -lm, etc.).  Since
6596 your system supports dynamic loading, it is probably possible to build
6597 a shared libperl.$so.  If you will have more than one executable linked
6598 to libperl.$so, this will significantly reduce the size of each
6599 executable, but it may have a noticeable affect on performance.  The
6600 default is probably sensible for your system.
6601 $also
6602
6603 EOM
6604         rp="Build a shared libperl.$so (y/n)"
6605         . ./myread
6606         case "$ans" in
6607         true|$define|[Yy]*)
6608                 useshrplib='true'  ;;
6609         *)      useshrplib='false' ;;
6610         esac
6611         ;;
6612 esac
6613
6614 case "$useshrplib" in
6615 true)
6616         case "$libperl" in
6617         '')
6618                 # Figure out a good name for libperl.so.  Since it gets stored in
6619                 # a version-specific architecture-dependent library, the version
6620                 # number isn't really that important, except for making cc/ld happy.
6621                 #
6622                 # A name such as libperl.so.3.1
6623                 majmin="libperl.$so.$patchlevel.$subversion"
6624                 # A name such as libperl.so.301
6625                 majonly=`echo $patchlevel $subversion |
6626                         $awk '{printf "%d%02d", $1, $2}'`
6627                 majonly=libperl.$so.$majonly
6628                 # I'd prefer to keep the os-specific stuff here to a minimum, and
6629                 # rely on figuring it out from the naming of libc.
6630                 case "${osname}${osvers}" in
6631                 next4*)
6632                         dflt=libperl.5.$so
6633                         # XXX How handle the --version stuff for MAB?
6634                         ;;
6635                 linux*)  # ld won't link with a bare -lperl otherwise.
6636                         dflt=libperl.$so
6637                         ;;
6638                 cygwin*) # include version
6639                         dflt=`echo libperl$version | sed -e 's/\./_/g'`$lib_ext
6640                         ;;
6641                 *)      # Try to guess based on whether libc has major.minor.
6642                         case "$libc" in
6643                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
6644                         *libc.$so.[0-9]*) dflt=$majonly ;;
6645                         *)      dflt=libperl.$so ;;
6646                         esac
6647                         ;;
6648                 esac
6649                 ;;
6650         *)      dflt=$libperl
6651                 ;;
6652         esac
6653         cat << EOM
6654
6655 I need to select a good name for the shared libperl.  If your system uses
6656 library names with major and minor numbers, then you might want something
6657 like $majmin.  Alternatively, if your system uses a single version
6658 number for shared libraries, then you might want to use $majonly.
6659 Or, your system might be quite happy with a simple libperl.$so.
6660
6661 Since the shared libperl will get installed into a version-specific
6662 architecture-dependent directory, the version number of the shared perl
6663 library probably isn't important, so the default should be o.k.
6664
6665 EOM
6666         rp='What name do you want to give to the shared libperl?'
6667         . ./myread
6668         libperl=$ans
6669         echo "Ok, I'll use $libperl"
6670         ;;
6671 *)
6672         libperl="libperl${_a}"
6673         ;;
6674 esac
6675
6676 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
6677 case "$shrpdir" in
6678 '') ;;
6679 *)      $cat >&4 <<EOM
6680 WARNING:  Use of the shrpdir variable for the installation location of
6681 the shared $libperl is not supported.  It was never documented and
6682 will not work in this version.  Let me (perlbug@perl.com)
6683 know of any problems this may cause.
6684
6685 EOM
6686         case "$shrpdir" in
6687         "$archlibexp/CORE")
6688                 $cat >&4 <<EOM
6689 But your current setting of $shrpdir is
6690 the default anyway, so it's harmless.
6691 EOM
6692                 ;;
6693         *)
6694                 $cat >&4 <<EOM
6695 Further, your current attempted setting of $shrpdir
6696 conflicts with the value of $archlibexp/CORE
6697 that installperl will use.
6698 EOM
6699                 ;;
6700         esac
6701         ;;
6702 esac
6703
6704 # How will the perl executable find the installed shared $libperl?
6705 # Add $xxx to ccdlflags.
6706 # If we can't figure out a command-line option, use $shrpenv to
6707 # set env LD_RUN_PATH.  The main perl makefile uses this.
6708 shrpdir=$archlibexp/CORE
6709 xxx=''
6710 tmp_shrpenv=''
6711 if "$useshrplib"; then
6712     case "$osname" in 
6713         aix)
6714                 # We'll set it in Makefile.SH...
6715                 ;;
6716         solaris|netbsd)
6717                 xxx="-R $shrpdir"
6718                 ;;
6719         freebsd)
6720                 xxx="-Wl,-R$shrpdir"
6721                 ;;
6722         linux|irix*|dec_osf)
6723                 xxx="-Wl,-rpath,$shrpdir"
6724                 ;;
6725         next)
6726                 # next doesn't like the default...
6727                 ;;
6728         beos)
6729                 # beos doesn't like the default, either.
6730                 ;;
6731         hpux*)
6732                 # hpux doesn't like the default, either.
6733                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
6734                 ;;
6735         *)
6736                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
6737                 ;;
6738         esac
6739         case "$xxx" in
6740         '') ;;
6741         *)      
6742                 # Only add $xxx if it isn't already in ccdlflags.
6743                 case " $ccdlflags " in
6744                 *" $xxx "*)     ;;
6745                 *)      ccdlflags="$ccdlflags $xxx"
6746                         cat <<EOM >&4
6747
6748 Adding $xxx to the flags
6749 passed to $ld so that the perl executable will find the 
6750 installed shared $libperl.
6751
6752 EOM
6753                         ;;
6754                 esac
6755                 ;;
6756         esac
6757 fi
6758 # Fix ccdlflags in AIX for building external extensions.
6759 # (For building Perl itself bare -bE:perl.exp is needed,
6760 #  Makefile.SH takes care of this.)
6761 case "$osname" in
6762 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
6763 esac
6764 # Respect a hint or command-line value.
6765 case "$shrpenv" in
6766 '') shrpenv="$tmp_shrpenv" ;;
6767 esac
6768 case "$ldlibpthname" in
6769 '')     ldlibpthname=LD_LIBRARY_PATH ;;
6770 none)   ldlibpthname='' ;;
6771 esac
6772
6773 : determine where manual pages go
6774 set man1dir man1dir none
6775 eval $prefixit
6776 $cat <<EOM
6777
6778 $spackage has manual pages available in source form.
6779 EOM
6780 case "$nroff" in
6781 nroff)
6782         echo "However, you don't have nroff, so they're probably useless to you."
6783         case "$man1dir" in
6784         '') man1dir="none";;
6785         esac;;
6786 esac
6787 echo "If you don't want the manual sources installed, answer 'none'."
6788 case "$man1dir" in
6789 ' ') dflt=none
6790         ;;
6791 '')
6792         lookpath="$prefixexp/man/man1 $prefixexp/man/l_man/man1"
6793         lookpath="$lookpath $prefixexp/man/p_man/man1"
6794         lookpath="$lookpath $prefixexp/man/u_man/man1"
6795         lookpath="$lookpath $prefixexp/man/man.1"
6796         case "$sysman" in
6797         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
6798         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
6799         esac
6800         set dflt
6801         eval $prefixup
6802         ;;
6803 *)  dflt="$man1dir"
6804         ;;
6805 esac
6806 echo " "
6807 fn=dn+~
6808 rp="Where do the main $spackage manual pages (source) go?"
6809 . ./getfile
6810 if $test "X$man1direxp" != "X$ansexp"; then
6811         installman1dir=''
6812 fi
6813 man1dir="$ans"
6814 man1direxp="$ansexp"
6815 case "$man1dir" in
6816 '')     man1dir=' '
6817         installman1dir='';;
6818 esac
6819
6820 : Change installation prefix, if necessary.
6821 if $test X"$prefix" != X"$installprefix"; then
6822         installman1dir=`echo $man1direxp | $sed "s#^$prefix#$installprefix#"`
6823 else
6824         installman1dir="$man1direxp"
6825 fi
6826
6827 : What suffix to use on installed man pages
6828
6829 case "$man1dir" in
6830 ' ')
6831         man1ext='0'
6832         ;;
6833 *)
6834         rp="What suffix should be used for the main $spackage man pages?"
6835         case "$man1ext" in
6836         '')     case "$man1dir" in
6837                 *1)  dflt=1 ;;
6838                 *1p) dflt=1p ;;
6839                 *1pm) dflt=1pm ;;
6840                 *l) dflt=l;;
6841                 *n) dflt=n;;
6842                 *o) dflt=o;;
6843                 *p) dflt=p;;
6844                 *C) dflt=C;;
6845                 *L) dflt=L;;
6846                 *L1) dflt=L1;;
6847                 *) dflt=1;;
6848                 esac
6849                 ;;
6850         *)      dflt="$man1ext";;
6851         esac
6852         . ./myread
6853         man1ext="$ans"
6854         ;;
6855 esac
6856
6857 : see if we can have long filenames
6858 echo " "
6859 first=123456789abcdef
6860 $rm -f $first
6861 if (echo hi >$first) 2>/dev/null; then
6862         if $test -f 123456789abcde; then
6863                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
6864                 val="$undef"
6865         else
6866                 echo 'You can have filenames longer than 14 characters.'>&4
6867                 val="$define"
6868         fi
6869 else
6870         $cat <<'EOM'
6871 You can't have filenames longer than 14 chars.
6872 You can't even think about them!
6873 EOM
6874         val="$undef"
6875 fi 
6876 set d_flexfnam
6877 eval $setvar
6878 $rm -rf 123456789abcde*
6879
6880 : determine where library module manual pages go
6881 set man3dir man3dir none
6882 eval $prefixit
6883 $cat <<EOM
6884
6885 $spackage has manual pages for many of the library modules.
6886 EOM
6887
6888 case "$nroff" in
6889 nroff)
6890         $cat <<'EOM'
6891 However, you don't have nroff, so they're probably useless to you.
6892 EOM
6893         case "$man3dir" in
6894         '') man3dir="none";;
6895         esac;;
6896 esac
6897
6898 case "$d_flexfnam" in
6899 undef)
6900         $cat <<'EOM'
6901 However, your system can't handle the long file names like File::Basename.3. 
6902 EOM
6903         case "$man3dir" in
6904         '') man3dir="none";;
6905         esac;;
6906 esac
6907
6908 echo "If you don't want the manual sources installed, answer 'none'."
6909 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6910 case "$man3dir" in
6911 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
6912         if $test -d "$privlib/man/man3"; then
6913                 cat <<EOM >&4
6914
6915 WARNING:  Previous versions of perl installed man3 pages into
6916 $privlib/man/man3.  This version will suggest a 
6917 new default of $dflt.  
6918 EOM
6919                 tdflt=$dflt
6920                 dflt='n'
6921                 rp='Do you wish to preserve the old behavior?(y/n)'
6922                 . ./myread
6923                 case "$ans" in
6924                 y*) dflt="$privlib/man/man3" ;;
6925                 *)  dflt=$tdflt ;;
6926                 esac
6927     fi
6928         ;;
6929 *)      dflt="$man3dir" ;;
6930 esac
6931 case "$dflt" in
6932 ' ') dflt=none ;;
6933 esac
6934 echo " "
6935 fn=dn+~
6936 rp="Where do the $package library man pages (source) go?"
6937 . ./getfile
6938 man3dir="$ans"
6939 man3direxp="$ansexp"
6940 case "$man3dir" in
6941 '')     man3dir=' '
6942         installman3dir='';;
6943 esac
6944
6945 : Change installation prefix, if necessary.
6946 if $test X"$prefix" != X"$installprefix"; then
6947         installman3dir=`echo $man3direxp | $sed "s#^$prefix#$installprefix#"`
6948 else
6949         installman3dir="$man3direxp"
6950 fi
6951
6952 : What suffix to use on installed man pages
6953 case "$man3dir" in
6954 ' ')
6955         man3ext='0'
6956         ;;
6957 *)
6958         rp="What suffix should be used for the $package library man pages?"
6959         case "$man3ext" in
6960         '')     case "$man3dir" in
6961                 *3)  dflt=3 ;;
6962                 *3p) dflt=3p ;;
6963                 *3pm) dflt=3pm ;;
6964                 *l) dflt=l;;
6965                 *n) dflt=n;;
6966                 *o) dflt=o;;
6967                 *p) dflt=p;;
6968                 *C) dflt=C;;
6969                 *L) dflt=L;;
6970                 *L3) dflt=L3;;
6971                 *) dflt=3;;
6972                 esac
6973                 ;;
6974         *)      dflt="$man3ext";;
6975         esac
6976         . ./myread
6977         man3ext="$ans"
6978         ;;
6979 esac
6980
6981 : see if we have to deal with yellow pages, now NIS.
6982 if $test -d /usr/etc/yp || $test -d /etc/yp; then
6983         if $test -f /usr/etc/nibindd; then
6984                 echo " "
6985                 echo "I'm fairly confident you're on a NeXT."
6986                 echo " "
6987                 rp='Do you get the hosts file via NetInfo?'
6988                 dflt=y
6989                 case "$hostcat" in
6990                 nidump*) ;;
6991                 '') ;;
6992                 *) dflt=n;;
6993                 esac
6994                 . ./myread
6995                 case "$ans" in
6996                 y*) hostcat='nidump hosts .';;
6997                 *)      case "$hostcat" in
6998                         nidump*) hostcat='';;
6999                         esac
7000                         ;;
7001                 esac
7002         fi
7003         case "$hostcat" in
7004         nidump*) ;;
7005         *)
7006                 case "$hostcat" in
7007                 *ypcat*) dflt=y;;
7008                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
7009                                 dflt=y
7010                         else
7011                                 dflt=n
7012                         fi;;
7013                 *) dflt=n;;
7014                 esac
7015                 echo " "
7016                 rp='Are you getting the hosts file via yellow pages?'
7017                 . ./myread
7018                 case "$ans" in
7019                 y*) hostcat='ypcat hosts';;
7020                 *) hostcat='cat /etc/hosts';;
7021                 esac
7022                 ;;
7023         esac
7024 fi
7025 case "$hostcat" in
7026 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
7027 esac
7028 case "$groupcat" in
7029 '') test -f /etc/group && groupcat='cat /etc/group';;
7030 esac
7031 case "$passcat" in
7032 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
7033 esac
7034
7035 : now get the host name
7036 echo " "
7037 echo "Figuring out host name..." >&4
7038 case "$myhostname" in
7039 '') cont=true
7040         echo 'Maybe "hostname" will work...'
7041         if tans=`sh -c hostname 2>&1` ; then
7042                 myhostname=$tans
7043                 phostname=hostname
7044                 cont=''
7045         fi
7046         ;;
7047 *) cont='';;
7048 esac
7049 if $test "$cont"; then
7050         if ./xenix; then
7051                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
7052                 if tans=`cat /etc/systemid 2>&1` ; then
7053                         myhostname=$tans
7054                         phostname='cat /etc/systemid'
7055                         echo "Whadyaknow.  Xenix always was a bit strange..."
7056                         cont=''
7057                 fi
7058         elif $test -r /etc/systemid; then
7059                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
7060         fi
7061 fi
7062 if $test "$cont"; then
7063         echo 'No, maybe "uuname -l" will work...'
7064         if tans=`sh -c 'uuname -l' 2>&1` ; then
7065                 myhostname=$tans
7066                 phostname='uuname -l'
7067         else
7068                 echo 'Strange.  Maybe "uname -n" will work...'
7069                 if tans=`sh -c 'uname -n' 2>&1` ; then
7070                         myhostname=$tans
7071                         phostname='uname -n'
7072                 else
7073                         echo 'Oh well, maybe I can mine it out of whoami.h...'
7074                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
7075                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
7076                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
7077                         else
7078                                 case "$myhostname" in
7079                                 '') echo "Does this machine have an identity crisis or something?"
7080                                         phostname='';;
7081                                 *)
7082                                         echo "Well, you said $myhostname before..."
7083                                         phostname='echo $myhostname';;
7084                                 esac
7085                         fi
7086                 fi
7087         fi
7088 fi
7089 : you do not want to know about this
7090 set $myhostname
7091 myhostname=$1
7092
7093 : verify guess
7094 if $test "$myhostname" ; then
7095         dflt=y
7096         rp='Your host name appears to be "'$myhostname'".'" Right?"
7097         . ./myread
7098         case "$ans" in
7099         y*) ;;
7100         *) myhostname='';;
7101         esac
7102 fi
7103
7104 : bad guess or no guess
7105 while $test "X$myhostname" = X ; do
7106         dflt=''
7107         rp="Please type the (one word) name of your host:"
7108         . ./myread
7109         myhostname="$ans"
7110 done
7111
7112 : translate upper to lower if necessary
7113 case "$myhostname" in
7114 *[A-Z]*)
7115         echo "(Normalizing case in your host name)"
7116         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
7117         ;;
7118 esac
7119
7120 case "$myhostname" in
7121 *.*)
7122         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
7123         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
7124         echo "(Trimming domain name from host name--host name is now $myhostname)"
7125         ;;
7126 *) case "$mydomain" in
7127         '')
7128                 {
7129                         test "X$hostcat" = "Xypcat hosts" &&
7130                         ypmatch "$myhostname" hosts 2>/dev/null |\
7131                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
7132                         $test -s hosts
7133                 } || {
7134                         test "X$hostcat" != "X" &&
7135                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
7136                                         /[       ]$myhostname[  . ]/p" > hosts
7137                 }
7138                 tmp_re="[       . ]"
7139                 $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
7140                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
7141                 dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
7142                         hosts | $sort | $uniq | \
7143                         $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
7144                 case `$echo X$dflt` in
7145                 X*\ *)  echo "(Several hosts in /etc/hosts matched hostname)"
7146                         dflt=.
7147                         ;;
7148                 X.) echo "(You do not have fully-qualified names in /etc/hosts)"
7149                         ;;
7150                 esac
7151                 case "$dflt" in
7152                 .)
7153                         tans=`./loc resolv.conf X /etc /usr/etc`
7154                         if $test -f "$tans"; then
7155                                 echo "(Attempting domain name extraction from $tans)"
7156                                 dflt=.`$sed -n -e 's/   / /g' \
7157                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
7158                                   | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
7159                                 case "$dflt" in
7160                                 .) dflt=.`$sed -n -e 's/        / /g' \
7161                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
7162                                      | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
7163                                         ;;
7164                                 esac
7165                         fi
7166                         ;;
7167                 esac
7168                 case "$dflt" in
7169                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
7170                         dflt=.`sh -c domainname 2>/dev/null`
7171                         case "$dflt" in
7172                         '') dflt='.';;
7173                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
7174                         esac
7175                         ;;
7176                 esac
7177                 case "$dflt" in
7178                 .) echo "(Lost all hope -- silly guess then)"
7179                         dflt='.uucp'
7180                         ;;
7181                 esac
7182                 $rm -f hosts
7183                 ;;
7184         *) dflt="$mydomain";;
7185         esac;;
7186 esac
7187 echo " "
7188 rp="What is your domain name?"
7189 . ./myread
7190 tans="$ans"
7191 case "$ans" in
7192 '') ;;
7193 .*) ;;
7194 *) tans=".$tans";;
7195 esac
7196 mydomain="$tans"
7197
7198 : translate upper to lower if necessary
7199 case "$mydomain" in
7200 *[A-Z]*)
7201         echo "(Normalizing case in your domain name)"
7202         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
7203         ;;
7204 esac
7205
7206 : a little sanity check here
7207 case "$phostname" in
7208 '') ;;
7209 *)
7210         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
7211         $myhostname$mydomain|$myhostname) ;;
7212         *)
7213                 case "$phostname" in
7214                 sed*)
7215                         echo "(That doesn't agree with your whoami.h file, by the way.)"
7216                         ;;
7217                 *)
7218                         echo "(That doesn't agree with your $phostname command, by the way.)"
7219                         ;;
7220                 esac
7221         ;;
7222         esac
7223         ;;
7224 esac
7225
7226 $cat <<EOM
7227
7228 I need to get your e-mail address in Internet format if possible, i.e.
7229 something like user@host.domain. Please answer accurately since I have
7230 no easy means to double check it. The default value provided below
7231 is most probably close to reality but may not be valid from outside
7232 your organization...
7233
7234 EOM
7235 cont=x
7236 while test "$cont"; do
7237         case "$cf_email" in
7238         '') dflt="$cf_by@$myhostname$mydomain";;
7239         *) dflt="$cf_email";;
7240         esac
7241         rp='What is your e-mail address?'
7242         . ./myread
7243         cf_email="$ans"
7244         case "$cf_email" in
7245         *@*.*) cont='' ;;
7246         *)
7247                 rp='Address does not look like an Internet one.  Use it anyway?'
7248                 case "$fastread" in
7249                 yes) dflt=y ;;
7250                 *) dflt=n ;;
7251                 esac
7252                 . ./myread
7253                 case "$ans" in
7254                 y*) cont='' ;;
7255                 *) echo " " ;;
7256                 esac
7257                 ;;
7258         esac
7259 done
7260
7261 $cat <<EOM
7262
7263 If you or somebody else will be maintaining perl at your site, please
7264 fill in the correct e-mail address here so that they may be contacted
7265 if necessary. Currently, the "perlbug" program included with perl
7266 will send mail to this address in addition to perlbug@perl.com. You may
7267 enter "none" for no administrator.
7268
7269 EOM
7270 case "$perladmin" in
7271 '') dflt="$cf_email";;
7272 *) dflt="$perladmin";;
7273 esac
7274 rp='Perl administrator e-mail address'
7275 . ./myread
7276 perladmin="$ans"
7277
7278 : figure out how to guarantee perl startup
7279 case "$startperl" in
7280 '')
7281         case "$sharpbang" in
7282         *!)
7283                 $cat <<EOH
7284
7285 I can use the #! construct to start perl on your system. This will
7286 make startup of perl scripts faster, but may cause problems if you
7287 want to share those scripts and perl is not in a standard place
7288 ($binexp/perl) on all your platforms. The alternative is to force
7289 a shell by starting the script with a single ':' character.
7290
7291 EOH
7292                 dflt="$binexp/perl"
7293                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
7294                 . ./myread
7295                 case "$ans" in
7296                 none)   startperl=": # use perl";;
7297                 *)      startperl="#!$ans"
7298                         if $test 30 -lt `echo "$ans" | wc -c`; then
7299                                 $cat >&4 <<EOM
7300
7301 WARNING:  Some systems limit the #! command to 32 characters.
7302 If you experience difficulty running Perl scripts with #!, try
7303 installing Perl in a directory with a shorter pathname.
7304
7305 EOM
7306                         fi ;;
7307                 esac
7308                 ;;
7309         *) startperl=": # use perl"
7310                 ;;
7311         esac
7312         ;;
7313 esac
7314 echo "I'll use $startperl to start perl scripts."
7315
7316 : figure best path for perl in scripts
7317 case "$perlpath" in
7318 '')
7319         perlpath="$binexp/perl"
7320         case "$startperl" in
7321         *!*) ;;
7322         *)
7323                 $cat <<EOH
7324
7325 I will use the "eval 'exec'" idiom to start Perl on your system.
7326 I can use the full path of your Perl binary for this purpose, but
7327 doing so may cause problems if you want to share those scripts and
7328 Perl is not always in a standard place ($binexp/perl).
7329
7330 EOH
7331                 dflt="$binexp/perl"
7332                 rp="What path shall I use in \"eval 'exec'\"?"
7333                 . ./myread
7334                 perlpath="$ans"
7335                 ;;
7336         esac
7337         ;;
7338 esac
7339 case "$startperl" in
7340 *!*)    ;;
7341 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
7342 esac
7343
7344 : determine where public executable scripts go
7345 set scriptdir scriptdir
7346 eval $prefixit
7347 case "$scriptdir" in
7348 '')
7349         dflt="$bin"
7350         : guess some guesses
7351         $test -d /usr/share/scripts && dflt=/usr/share/scripts
7352         $test -d /usr/share/bin     && dflt=/usr/share/bin
7353         $test -d /usr/local/script  && dflt=/usr/local/script
7354         $test -d /usr/local/scripts && dflt=/usr/local/scripts
7355         $test -d $prefixexp/script  && dflt=$prefixexp/script
7356         set dflt
7357         eval $prefixup
7358         ;;
7359 *)  dflt="$scriptdir"
7360         ;;
7361 esac
7362 $cat <<EOM
7363  
7364 Some installations have a separate directory just for executable scripts so
7365 that they can mount it across multiple architectures but keep the scripts in
7366 one spot.  You might, for example, have a subdirectory of /usr/share for this.
7367 Or you might just lump your scripts in with all your other executables.
7368  
7369 EOM
7370 fn=d~
7371 rp='Where do you keep publicly executable scripts?'
7372 . ./getfile
7373 if $test "X$ansexp" != "X$scriptdirexp"; then
7374         installscript=''
7375 fi
7376 scriptdir="$ans"
7377 scriptdirexp="$ansexp"
7378 : Change installation prefix, if necessary.
7379 if $test X"$prefix" != X"$installprefix"; then
7380         installscript=`echo $scriptdirexp | sed "s#^$prefix#$installprefix#"`
7381 else
7382         installscript="$scriptdirexp"
7383 fi
7384
7385 : determine where add-on public executables go
7386 case "$sitebin" in
7387 '')     dflt=$siteprefix/bin ;;
7388 *)      dflt=$sitebin ;;
7389 esac
7390 fn=d~
7391 rp='Pathname where the add-on public executables should be installed?'
7392 . ./getfile
7393 sitebin="$ans"
7394 sitebinexp="$ansexp"
7395 : Change installation prefix, if necessary.
7396 if $test X"$prefix" != X"$installprefix"; then
7397         installsitebin=`echo $sitebinexp | sed "s#^$prefix#$installprefix#"`
7398 else
7399         installsitebin="$sitebinexp"
7400 fi
7401
7402 : see if sqrtl exists
7403 set sqrtl d_sqrtl
7404 eval $inlibc
7405
7406 case "$ccflags" in
7407 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
7408 esac
7409
7410 case "$uselongdouble" in
7411 $define|true|[yY]*)     dflt='y';;
7412 *) dflt='n';;
7413 esac
7414 cat <<EOM
7415
7416 Perl can be built to take advantage of long doubles which
7417 (if available) may give more accuracy and range for floating point numbers.
7418
7419 If this doesn't make any sense to you, just accept the default '$dflt'.
7420 EOM
7421 rp='Try to use long doubles if available?'
7422 . ./myread
7423 case "$ans" in
7424 y|Y)    val="$define"   ;;
7425 *)      val="$undef"    ;;
7426 esac
7427 set uselongdouble
7428 eval $setvar
7429
7430 case "$uselongdouble" in
7431 true|[yY]*) uselongdouble="$define" ;;
7432 esac
7433
7434 case "$uselongdouble" in
7435 $define)
7436 : Look for a hint-file generated 'call-back-unit'.  If the
7437 : user has specified that long doubles should be used,
7438 : we may need to set or change some other defaults.
7439         if $test -f uselongdouble.cbu; then
7440                 echo "Your platform has some specific hints for long doubles, using them..."
7441                 . ./uselongdouble.cbu
7442         else
7443                 $cat <<EOM
7444 (Your platform doesn't have any specific hints for long doubles.)
7445 EOM
7446         fi
7447         ;;
7448 esac
7449
7450 case "$uselongdouble:$d_sqrtl" in
7451 $define:$undef)
7452                 $cat <<EOM >&4
7453
7454 *** You requested the use of long doubles but you do not seem to have
7455 *** the mathematic functions for long doubles.  I'm disabling the use
7456 *** of long doubles.
7457
7458 EOM
7459         uselongdouble=$undef
7460         ;;
7461 esac
7462
7463 case "$useperlio" in
7464 $define|true|[yY]*)     dflt='y';;
7465 *) dflt='n';;
7466 esac
7467 cat <<EOM
7468
7469 Previous version of $package used the standard IO mechanisms as defined
7470 in <stdio.h>.  Versions 5.003_02 and later of perl allow alternate IO
7471 mechanisms via a "PerlIO" abstraction, but the stdio mechanism is still
7472 the default.  This abstraction layer can use AT&T's sfio (if you already
7473 have sfio installed) or regular stdio.  Using PerlIO with sfio may cause
7474 problems with some extension modules.  Using PerlIO with stdio is safe,
7475 but it is slower than plain stdio and therefore is not the default.
7476
7477 If this doesn't make any sense to you, just accept the default '$dflt'.
7478 EOM
7479 rp='Use the experimental PerlIO abstraction layer?'
7480 . ./myread
7481 case "$ans" in
7482 y|Y) 
7483         val="$define"
7484         ;;     
7485 *)      
7486         echo "Ok, doing things the stdio way"
7487         val="$undef"
7488         ;;
7489 esac
7490 set useperlio
7491 eval $setvar 
7492
7493 case "$vendorprefix" in
7494 '')     d_vendorbin="$undef"
7495         vendorbin=''
7496         vendorbinexp=''
7497         ;;
7498 *)      d_vendorbin="$define"
7499         : determine where vendor-supplied executables go.
7500         case "$vendorbin" in
7501         '') dflt=$vendorprefix/bin ;;
7502         *)      dflt="$vendorbin" ;;
7503         esac
7504         fn=d~+
7505         rp='Pathname for the vendor-supplied executables directory?'
7506         . ./getfile
7507         vendorbin="$ans"
7508         vendorbinexp="$ansexp"
7509         ;;
7510 esac
7511 : Change installation prefix, if necessary.
7512 if $test X"$prefix" != X"$installprefix"; then
7513         installvendorbin=`echo $vendorbinexp | $sed "s#^$prefix#$installprefix#"`
7514 else
7515         installvendorbin="$vendorbinexp"
7516 fi
7517
7518 : see if qgcvt exists
7519 set qgcvt d_qgcvt
7520 eval $inlibc
7521
7522 : check for length of double
7523 echo " "
7524 case "$doublesize" in
7525 '')
7526         echo "Checking to see how big your double precision numbers are..." >&4
7527         $cat >try.c <<'EOCP'
7528 #include <stdio.h>
7529 int main()
7530 {
7531     printf("%d\n", (int)sizeof(double));
7532     exit(0);
7533 }
7534 EOCP
7535         set try
7536         if eval $compile_ok; then
7537                 doublesize=`./try`
7538                 echo "Your double is $doublesize bytes long."
7539         else
7540                 dflt='8'
7541                 echo "(I can't seem to compile the test program.  Guessing...)"
7542                 rp="What is the size of a double precision number (in bytes)?"
7543                 . ./myread
7544                 doublesize="$ans"
7545         fi
7546         ;;
7547 esac
7548 $rm -f try.c try
7549
7550 : check for long doubles
7551 echo " "
7552 echo "Checking to see if you have long double..." >&4
7553 echo 'int main() { long double x = 7.0; }' > try.c
7554 set try
7555 if eval $compile; then
7556         val="$define"
7557         echo "You have long double."
7558 else
7559         val="$undef"
7560         echo "You do not have long double."
7561 fi
7562 $rm try.*
7563 set d_longdbl
7564 eval $setvar
7565
7566 : check for length of long double
7567 case "${d_longdbl}${longdblsize}" in
7568 $define)
7569         echo " "
7570         echo "Checking to see how big your long doubles are..." >&4
7571         $cat >try.c <<'EOCP'
7572 #include <stdio.h>
7573 int main()
7574 {
7575         printf("%d\n", sizeof(long double));
7576 }
7577 EOCP
7578         set try
7579         set try
7580         if eval $compile; then
7581                 longdblsize=`./try$exe_ext`
7582                 echo "Your long doubles are $longdblsize bytes long."
7583         else
7584                 dflt='8'
7585                 echo " "
7586                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
7587                 rp="What is the size of a long double (in bytes)?"
7588                 . ./myread
7589                 longdblsize="$ans"
7590         fi
7591         if $test "X$doublesize" = "X$longdblsize"; then
7592                 echo "(That isn't any different from an ordinary double.)"
7593         fi      
7594         ;;
7595 esac
7596 $rm -f try.* try
7597
7598 echo " "
7599
7600 if $test X"$d_longdbl" = X"$define"; then
7601
7602 echo "Checking how to print long doubles..." >&4
7603
7604 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
7605         $cat >try.c <<'EOCP'
7606 #include <sys/types.h>
7607 #include <stdio.h>
7608 int main() {
7609   double d = 123.456;
7610   printf("%.3f\n", d);
7611 }
7612 EOCP
7613         set try
7614         if eval $compile; then
7615                 yyy=`./try$exe_ext`
7616                 case "$yyy" in
7617                 123.456)
7618                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
7619                         sPRIFldbl='"F"'; sPRIGldbl='"G"'; sPRIEldbl='"E"';
7620                         echo "We will use %f."
7621                         ;;
7622                 esac
7623         fi
7624 fi
7625
7626 if $test X"$sPRIfldbl" = X; then
7627         $cat >try.c <<'EOCP'
7628 #include <sys/types.h>
7629 #include <stdio.h>
7630 int main() {
7631   long double d = 123.456;
7632   printf("%.3llf\n", d);
7633 }
7634 EOCP
7635         set try
7636         if eval $compile; then
7637                 yyy=`./try$exe_ext`
7638                 case "$yyy" in
7639                 123.456)
7640                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
7641                         sPRIFldbl='"llF"'; sPRIGldbl='"llG"'; sPRIEldbl='"llE"';
7642                         echo "We will use %llf."
7643                         ;;
7644                 esac
7645         fi
7646 fi
7647
7648 if $test X"$sPRIfldbl" = X; then
7649         $cat >try.c <<'EOCP'
7650 #include <sys/types.h>
7651 #include <stdio.h>
7652 int main() {
7653   long double d = 123.456;
7654   printf("%.3Lf\n", d);
7655 }
7656 EOCP
7657         set try
7658         if eval $compile; then
7659                 yyy=`./try$exe_ext`
7660                 case "$yyy" in
7661                 123.456)
7662                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
7663                         sPRIFldbl='"LF"'; sPRIGldbl='"LG"'; sPRIEldbl='"LE"';
7664                         echo "We will use %Lf."
7665                         ;;
7666                 esac
7667         fi
7668 fi
7669
7670 if $test X"$sPRIfldbl" = X; then
7671         $cat >try.c <<'EOCP'
7672 #include <sys/types.h>
7673 #include <stdio.h>
7674 int main() {
7675   long double d = 123.456;
7676   printf("%.3lf\n", d);
7677 }
7678 EOCP
7679         set try
7680         if eval $compile; then
7681                 yyy=`./try$exe_ext`
7682                 case "$yyy" in
7683                 123.456)
7684                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
7685                         sPRIFldbl='"lF"'; sPRIGldbl='"lG"'; sPRIEldbl='"lE"';
7686                         echo "We will use %lf."
7687                         ;;
7688                 esac
7689         fi
7690 fi
7691
7692 if $test X"$sPRIfldbl" = X; then
7693         echo "Cannot figure out how to print long doubles." >&4
7694 fi
7695
7696 $rm -f try try.*
7697
7698 fi # d_longdbl
7699
7700 case "$sPRIfldbl" in
7701 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef"; 
7702         d_PRIFldbl="$undef"; d_PRIGldbl="$undef"; d_PRIEldbl="$undef"; 
7703         ;;
7704 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define"; 
7705         d_PRIFldbl="$define"; d_PRIGldbl="$define"; d_PRIEldbl="$define"; 
7706         ;;
7707 esac
7708
7709 : Check how to convert floats to strings.
7710 echo " "
7711 echo "Checking for an efficient way to convert floats to strings."
7712 echo " " > try.c
7713 case "$uselongdouble" in
7714 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
7715 esac
7716 case "$d_longdbl" in
7717 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
7718 esac
7719 case "$d_PRIgldbl" in
7720 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
7721 esac
7722 $cat >>try.c <<EOP
7723 #ifdef TRY_gconvert
7724 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
7725 char *myname = "gconvert";
7726 #endif
7727 #ifdef TRY_gcvt
7728 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
7729 char *myname = "gcvt";
7730 #endif
7731 #ifdef TRY_qgcvt
7732 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
7733 char *myname = "qgcvt";
7734 #define DOUBLETYPE long double
7735 #endif
7736 #ifdef TRY_sprintf
7737 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE) && defined(HAS_PRIgldbl)
7738 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
7739 #else
7740 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
7741 #endif
7742 char *myname = "sprintf";
7743 #endif
7744
7745 #ifndef DOUBLETYPE
7746 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
7747 #define DOUBLETYPE long double
7748 #else
7749 #define DOUBLETYPE double
7750 #endif
7751 #endif
7752
7753 #include <stdio.h>
7754
7755 #define I_STDLIB $i_stdlib
7756 #ifdef I_STDLIB
7757 #include <stdlib.h>
7758 #endif
7759
7760 int
7761 checkit(expect, got)
7762 char *expect;
7763 char *got;
7764 {
7765     if (strcmp(expect, got)) {
7766                 printf("%s oddity:  Expected %s, got %s\n",
7767                         myname, expect, got);
7768                 exit(1);
7769         }
7770 }
7771
7772 int main()
7773
7774         char buf[64]; 
7775         buf[63] = '\0';
7776
7777         /* This must be 1st test on (which?) platform */
7778         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
7779         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
7780         checkit("0.1", buf);
7781
7782         Gconvert((DOUBLETYPE)1.0, 8, 0, buf); 
7783         checkit("1", buf);
7784
7785         Gconvert((DOUBLETYPE)1.1, 8, 0, buf); 
7786         checkit("1.1", buf);
7787
7788         Gconvert((DOUBLETYPE)1.01, 8, 0, buf); 
7789         checkit("1.01", buf);
7790
7791         Gconvert((DOUBLETYPE)1.001, 8, 0, buf); 
7792         checkit("1.001", buf);
7793
7794         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf); 
7795         checkit("1.0001", buf);
7796
7797         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf); 
7798         checkit("1.00001", buf);
7799
7800         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf); 
7801         checkit("1.000001", buf);
7802
7803         Gconvert((DOUBLETYPE)0.0, 8, 0, buf); 
7804         checkit("0", buf);
7805
7806         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf); 
7807         checkit("-1", buf);
7808
7809         /* Some Linux gcvt's give 1.e+5 here. */
7810         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf); 
7811         checkit("100000", buf);
7812         
7813         /* Some Linux gcvt's give -1.e+5 here. */
7814         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf); 
7815         checkit("-100000", buf);
7816
7817         exit(0);
7818 }
7819 EOP
7820 case "$d_Gconvert" in
7821 gconvert*) xxx_list='gconvert gcvt sprintf' ;;
7822 gcvt*) xxx_list='gcvt gconvert sprintf' ;;
7823 *) xxx_list='sprintf gconvert gcvt' ;;
7824 esac
7825
7826 case "$d_longdbl$uselongdouble$d_PRIgldbl" in
7827 "$define$define$define")
7828     xxx_list="`echo $xxx_list|sed s/sprintf//`" 
7829     xxx_list="sprintf $xxx_list"
7830     case "$d_qgcvt" in
7831     "$define") xxx_list="qgcvt $xxx_list" ;;
7832     esac
7833     ;;
7834 esac
7835
7836 for xxx_convert in $xxx_list; do
7837         echo "Trying $xxx_convert..."
7838         $rm -f try try$_o
7839         set try -DTRY_$xxx_convert
7840         if eval $compile; then
7841                 echo "$xxx_convert() found." >&4
7842                 if ./try; then
7843                         echo "I'll use $xxx_convert to convert floats into a string." >&4
7844                         break;
7845                 else
7846                         echo "...But $xxx_convert didn't work as I expected."
7847                 fi
7848         else
7849                 echo "$xxx_convert NOT found." >&4
7850         fi
7851 done
7852         
7853 case "$xxx_convert" in
7854 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
7855 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
7856 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
7857 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
7858    "$define$define$define")
7859       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
7860    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
7861    esac
7862    ;;  
7863 esac
7864
7865 : Initialize h_fcntl
7866 h_fcntl=false
7867
7868 : Initialize h_sysfile
7869 h_sysfile=false
7870
7871 : access call always available on UNIX
7872 set access d_access
7873 eval $inlibc
7874
7875 : locate the flags for 'access()'
7876 case "$d_access" in
7877 "$define")
7878         echo " "
7879         $cat >access.c <<'EOCP'
7880 #include <sys/types.h>
7881 #ifdef I_FCNTL
7882 #include <fcntl.h>
7883 #endif
7884 #ifdef I_SYS_FILE
7885 #include <sys/file.h>
7886 #endif
7887 #ifdef I_UNISTD
7888 #include <unistd.h>
7889 #endif
7890 int main() {
7891         exit(R_OK);
7892 }
7893 EOCP
7894         : check sys/file.h first, no particular reason here
7895         if $test `./findhdr sys/file.h` && \
7896                 $cc $cppflags -DI_SYS_FILE -o access access.c >/dev/null 2>&1 ; then
7897                 h_sysfile=true;
7898                 echo "<sys/file.h> defines the *_OK access constants." >&4
7899         elif $test `./findhdr fcntl.h` && \
7900                 $cc $cppflags -DI_FCNTL -o access access.c >/dev/null 2>&1 ; then
7901                 h_fcntl=true;
7902                 echo "<fcntl.h> defines the *_OK access constants." >&4
7903         elif $test `./findhdr unistd.h` && \
7904                 $cc $cppflags -DI_UNISTD -o access access.c >/dev/null 2>&1 ; then
7905                 echo "<unistd.h> defines the *_OK access constants." >&4
7906         else
7907                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
7908         fi
7909         ;;
7910 esac
7911 $rm -f access*
7912
7913 : see if accessx exists
7914 set accessx d_accessx
7915 eval $inlibc
7916
7917 : see if alarm exists
7918 set alarm d_alarm
7919 eval $inlibc
7920
7921 : see if atolf exists
7922 set atolf d_atolf
7923 eval $inlibc
7924
7925 : see if atoll exists
7926 set atoll d_atoll
7927 eval $inlibc
7928
7929 : Look for GNU-cc style attribute checking
7930 echo " "
7931 echo "Checking whether your compiler can handle __attribute__ ..." >&4
7932 $cat >attrib.c <<'EOCP'
7933 #include <stdio.h>
7934 void croak (char* pat,...) __attribute__((format(printf,1,2),noreturn));
7935 EOCP
7936 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
7937         if $contains 'warning' attrib.out >/dev/null 2>&1; then
7938                 echo "Your C compiler doesn't fully support __attribute__."
7939                 val="$undef"
7940         else
7941                 echo "Your C compiler supports __attribute__."
7942                 val="$define"
7943         fi
7944 else
7945         echo "Your C compiler doesn't seem to understand __attribute__ at all."
7946         val="$undef"
7947 fi
7948 set d_attribut
7949 eval $setvar
7950 $rm -f attrib*
7951
7952 : see if bcmp exists
7953 set bcmp d_bcmp
7954 eval $inlibc
7955
7956 : see if bcopy exists
7957 set bcopy d_bcopy
7958 eval $inlibc
7959
7960 : see if this is a unistd.h system
7961 set unistd.h i_unistd
7962 eval $inhdr
7963
7964 : see if getpgrp exists
7965 set getpgrp d_getpgrp
7966 eval $inlibc
7967
7968 case "$d_getpgrp" in
7969 "$define")
7970         echo " "
7971         echo "Checking to see which flavor of getpgrp is in use..."
7972         $cat >set.c <<EOP
7973 #$i_unistd I_UNISTD
7974 #include <sys/types.h>
7975 #ifdef I_UNISTD
7976 #  include <unistd.h>
7977 #endif
7978 int main()
7979 {
7980         if (getuid() == 0) {
7981                 printf("(I see you are running Configure as super-user...)\n");
7982                 setuid(1);
7983         }
7984 #ifdef TRY_BSD_PGRP
7985         if (getpgrp(1) == 0)
7986                 exit(0);
7987 #else
7988         if (getpgrp() > 0)
7989                 exit(0);
7990 #endif
7991         exit(1);
7992 }
7993 EOP
7994         if $cc -DTRY_BSD_PGRP $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7995                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
7996                 val="$define"
7997         elif $cc $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7998                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
7999                 val="$undef"
8000         else
8001                 echo "I can't seem to compile and run the test program."
8002                 if ./usg; then
8003                         xxx="a USG one, i.e. you use getpgrp()."
8004                 else
8005                         # SVR4 systems can appear rather BSD-ish.
8006                         case "$i_unistd" in
8007                         $undef)
8008                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
8009                                 val="$define"
8010                                 ;;
8011                         $define)
8012                                 xxx="probably a USG one, i.e. you use getpgrp()."
8013                                 val="$undef"
8014                                 ;;
8015                         esac
8016                 fi
8017                 echo "Assuming your getpgrp is $xxx" >&4
8018         fi
8019         ;;
8020 *) val="$undef";;
8021 esac
8022 set d_bsdgetpgrp
8023 eval $setvar
8024 $rm -f set set.c
8025
8026 : see if setpgrp exists
8027 set setpgrp d_setpgrp
8028 eval $inlibc
8029
8030 case "$d_setpgrp" in
8031 "$define")
8032         echo " "
8033         echo "Checking to see which flavor of setpgrp is in use..."
8034         $cat >set.c <<EOP
8035 #$i_unistd I_UNISTD
8036 #include <sys/types.h>
8037 #ifdef I_UNISTD
8038 #  include <unistd.h>
8039 #endif
8040 int main()
8041 {
8042         if (getuid() == 0) {
8043                 printf("(I see you are running Configure as super-user...)\n");
8044                 setuid(1);
8045         }
8046 #ifdef TRY_BSD_PGRP
8047         if (-1 == setpgrp(1, 1))
8048                 exit(0);
8049 #else
8050         if (setpgrp() != -1)
8051                 exit(0);
8052 #endif
8053         exit(1);
8054 }
8055 EOP
8056         if $cc -DTRY_BSD_PGRP $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
8057                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
8058                 val="$define"
8059         elif $cc $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
8060                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
8061                 val="$undef"
8062         else
8063                 echo "(I can't seem to compile and run the test program.)"
8064                 if ./usg; then
8065                         xxx="a USG one, i.e. you use setpgrp()."
8066                 else
8067                         # SVR4 systems can appear rather BSD-ish.
8068                         case "$i_unistd" in
8069                         $undef)
8070                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
8071                                 val="$define"
8072                                 ;;
8073                         $define)
8074                                 xxx="probably a USG one, i.e. you use setpgrp()."
8075                                 val="$undef"
8076                                 ;;
8077                         esac
8078                 fi
8079                 echo "Assuming your setpgrp is $xxx" >&4
8080         fi
8081         ;;
8082 *) val="$undef";;
8083 esac
8084 set d_bsdsetpgrp
8085 eval $setvar
8086 $rm -f set set.c
8087 : see if bzero exists
8088 set bzero d_bzero
8089 eval $inlibc
8090
8091 : see if signal is declared as pointer to function returning int or void
8092 echo " "
8093 xxx=`./findhdr signal.h`
8094 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
8095 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
8096         echo "You have int (*signal())() instead of void." >&4
8097         val="$undef"
8098 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
8099         echo "You have void (*signal())()." >&4
8100         val="$define"
8101 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
8102         echo "You have int (*signal())() instead of void." >&4
8103         val="$undef"
8104 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
8105         echo "You have void (*signal())()." >&4
8106         val="$define"
8107 else
8108         case "$d_voidsig" in
8109         '')
8110         echo "I can't determine whether signal handler returns void or int..." >&4
8111                 dflt=void
8112                 rp="What type does your signal handler return?"
8113                 . ./myread
8114                 case "$ans" in
8115                 v*) val="$define";;
8116                 *) val="$undef";;
8117                 esac;;
8118         "$define")
8119                 echo "As you already told me, signal handler returns void." >&4
8120                 val="$define"
8121                 ;;
8122         *)      echo "As you already told me, signal handler returns int." >&4
8123                 val="$undef"
8124                 ;;
8125         esac
8126 fi
8127 set d_voidsig
8128 eval $setvar
8129 case "$d_voidsig" in
8130 "$define") signal_t="void";;
8131 *) signal_t="int";;
8132 esac
8133 $rm -f $$.tmp
8134
8135 : check for ability to cast large floats to 32-bit ints.
8136 echo " "
8137 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
8138 if $test "$intsize" -ge 4; then
8139         xxx=int
8140 else
8141         xxx=long
8142 fi
8143 $cat >try.c <<EOCP
8144 #include <stdio.h>
8145 #include <sys/types.h>
8146 #include <signal.h>
8147 $signal_t blech(s) int s; { exit(3); }
8148 int main()
8149 {
8150         $xxx i32;
8151         double f, g;
8152         int result = 0;
8153         char str[16];
8154         signal(SIGFPE, blech);
8155
8156         /* Don't let compiler optimize the test away.  Store the number 
8157            in a writable string for gcc to pass to sscanf under HP/UX.
8158         */
8159         sprintf(str, "2147483647");
8160         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
8161         g = 10 * f;
8162         i32  = ($xxx) g;
8163
8164         /* x86 processors will probably give 0x8000 0000, which is a
8165        sign change.  We don't want that.  We want to mimic SPARC
8166            behavior here, which is to preserve the sign and give
8167            back 0x7fff ffff.
8168         */
8169         if (i32 != ($xxx) f)
8170                 result |= 1;
8171         exit(result);
8172 }
8173 EOCP
8174 set try
8175 if eval $compile_ok; then
8176         ./try
8177         yyy=$?
8178 else
8179         echo "(I can't seem to compile the test program--assuming it can't)"
8180         yyy=1
8181 fi
8182 case "$yyy" in
8183 0)      val="$define"
8184         echo "Yup, it can."
8185         ;;
8186 *)      val="$undef"
8187         echo "Nope, it can't."
8188         ;;
8189 esac
8190 set d_casti32
8191 eval $setvar
8192 $rm -f try try.*
8193
8194 : check for ability to cast negative floats to unsigned
8195 echo " "
8196 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
8197 $cat >try.c <<EOCP
8198 #include <stdio.h>
8199 #include <sys/types.h>
8200 #include <signal.h>
8201 $signal_t blech(s) int s; { exit(7); }
8202 $signal_t blech_in_list(s) int s; { exit(4); }
8203 unsigned long dummy_long(p) unsigned long p; { return p; }
8204 unsigned int dummy_int(p) unsigned int p; { return p; }
8205 unsigned short dummy_short(p) unsigned short p; { return p; }
8206 int main()
8207 {
8208         double f;
8209         unsigned long along;
8210         unsigned int aint;
8211         unsigned short ashort;
8212         int result = 0;
8213         char str[16];
8214         
8215         /* Frustrate gcc-2.7.2's optimizer which failed this test with
8216            a direct f = -123. assignment.  gcc-2.8.0 reportedly
8217            optimized the whole file away
8218         */
8219         /* Store the number in a writable string for gcc to pass to 
8220            sscanf under HP/UX.
8221         */
8222         sprintf(str, "-123");
8223         sscanf(str, "%lf", &f);  /* f = -123.; */
8224
8225         signal(SIGFPE, blech);
8226         along = (unsigned long)f;
8227         aint = (unsigned int)f;
8228         ashort = (unsigned short)f;
8229         if (along != (unsigned long)-123)
8230                 result |= 1;
8231         if (aint != (unsigned int)-123)
8232                 result |= 1;
8233         if (ashort != (unsigned short)-123)
8234                 result |= 1;
8235         sprintf(str, "1073741824.");
8236         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
8237         f = f + f;
8238         along = 0;
8239         along = (unsigned long)f;
8240         if (along != 0x80000000)
8241                 result |= 2;
8242         f -= 1.;
8243         along = 0;
8244         along = (unsigned long)f;
8245         if (along != 0x7fffffff)
8246                 result |= 1;
8247         f += 2.;
8248         along = 0;
8249         along = (unsigned long)f;
8250         if (along != 0x80000001)
8251                 result |= 2;
8252         if (result)
8253                 exit(result);
8254         signal(SIGFPE, blech_in_list);
8255         sprintf(str, "123.");
8256         sscanf(str, "%lf", &f);  /* f = 123.; */
8257         along = dummy_long((unsigned long)f);
8258         aint = dummy_int((unsigned int)f);
8259         ashort = dummy_short((unsigned short)f);
8260         if (along != (unsigned long)123)
8261                 result |= 4;
8262         if (aint != (unsigned int)123)
8263                 result |= 4;
8264         if (ashort != (unsigned short)123)
8265                 result |= 4;
8266         exit(result);
8267
8268 }
8269 EOCP
8270 set try
8271 if eval $compile_ok; then
8272         ./try
8273         castflags=$?
8274 else
8275         echo "(I can't seem to compile the test program--assuming it can't)"
8276         castflags=7
8277 fi
8278 case "$castflags" in
8279 0)      val="$define"
8280         echo "Yup, it can."
8281         ;;
8282 *)      val="$undef"
8283         echo "Nope, it can't."
8284         ;;
8285 esac
8286 set d_castneg
8287 eval $setvar
8288 $rm -f try.*
8289
8290 : see if vprintf exists
8291 echo " "
8292 if set vprintf val -f d_vprintf; eval $csym; $val; then
8293         echo 'vprintf() found.' >&4
8294         val="$define"
8295         $cat >vprintf.c <<'EOF'
8296 #include <varargs.h>
8297
8298 int main() { xxx("foo"); }
8299
8300 xxx(va_alist)
8301 va_dcl
8302 {
8303         va_list args;
8304         char buf[10];
8305
8306         va_start(args);
8307         exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
8308 }
8309 EOF
8310         set vprintf
8311         if eval $compile && ./vprintf; then
8312                 echo "Your vsprintf() returns (int)." >&4
8313                 val2="$undef"
8314         else
8315                 echo "Your vsprintf() returns (char*)." >&4
8316                 val2="$define"
8317         fi
8318 else
8319         echo 'vprintf() NOT found.' >&4
8320                 val="$undef"
8321                 val2="$undef"
8322 fi
8323 set d_vprintf
8324 eval $setvar
8325 val=$val2
8326 set d_charvspr
8327 eval $setvar
8328
8329 : see if chown exists
8330 set chown d_chown
8331 eval $inlibc
8332
8333 : see if chroot exists
8334 set chroot d_chroot
8335 eval $inlibc
8336
8337 : see if chsize exists
8338 set chsize d_chsize
8339 eval $inlibc
8340
8341 : check for const keyword
8342 echo " "
8343 echo 'Checking to see if your C compiler knows about "const"...' >&4
8344 $cat >const.c <<'EOCP'
8345 typedef struct spug { int drokk; } spug;
8346 int main()
8347 {
8348         const char *foo;
8349         const spug y;
8350 }
8351 EOCP
8352 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
8353         val="$define"
8354         echo "Yup, it does."
8355 else
8356         val="$undef"
8357         echo "Nope, it doesn't."
8358 fi
8359 set d_const
8360 eval $setvar
8361
8362 : see if crypt exists
8363 echo " "
8364 if set crypt val -f d_crypt; eval $csym; $val; then
8365         echo 'crypt() found.' >&4
8366         val="$define"
8367         cryptlib=''
8368 else
8369         cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
8370         if $test -z "$cryptlib"; then
8371                 cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
8372         else
8373                 cryptlib=-lcrypt
8374         fi
8375         if $test -z "$cryptlib"; then
8376                 cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
8377         else
8378                 cryptlib=-lcrypt
8379         fi
8380         if $test -z "$cryptlib"; then
8381                 cryptlib=`./loc libcrypt$_a "" $libpth`
8382         else
8383                 cryptlib=-lcrypt
8384         fi
8385         if $test -z "$cryptlib"; then
8386                 echo 'crypt() NOT found.' >&4
8387                 val="$undef"
8388         else
8389                 val="$define"
8390         fi
8391 fi
8392 set d_crypt
8393 eval $setvar
8394
8395 : get csh whereabouts
8396 case "$csh" in
8397 'csh') val="$undef" ;;
8398 *) val="$define" ;;
8399 esac
8400 set d_csh
8401 eval $setvar
8402 : Respect a hint or command line value for full_csh.
8403 case "$full_csh" in
8404 '') full_csh=$csh ;;
8405 esac
8406
8407 : see if cuserid exists
8408 set cuserid d_cuserid
8409 eval $inlibc
8410
8411 : see if this is a limits.h system
8412 set limits.h i_limits
8413 eval $inhdr
8414
8415 : see if this is a float.h system
8416 set float.h i_float
8417 eval $inhdr
8418
8419 : See if number of significant digits in a double precision number is known
8420 echo " "
8421 $cat >dbl_dig.c <<EOM
8422 #$i_limits I_LIMITS
8423 #$i_float I_FLOAT
8424 #ifdef I_LIMITS
8425 #include <limits.h>
8426 #endif
8427 #ifdef I_FLOAT
8428 #include <float.h>
8429 #endif
8430 #ifdef DBL_DIG
8431 printf("Contains DBL_DIG");
8432 #endif
8433 EOM
8434 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
8435 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
8436         echo "DBL_DIG found." >&4
8437         val="$define"
8438 else
8439         echo "DBL_DIG NOT found." >&4
8440         val="$undef"
8441 fi
8442 $rm -f dbl_dig.?
8443 set d_dbl_dig
8444 eval $setvar
8445
8446 : see if difftime exists
8447 set difftime d_difftime
8448 eval $inlibc
8449
8450 : see if this is a dirent system
8451 echo " "
8452 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
8453         val="$define"
8454         echo "<dirent.h> found." >&4
8455 else
8456         val="$undef"
8457         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
8458                 echo "<sys/dir.h> found." >&4
8459                 echo " "
8460         else
8461                 xinc=`./findhdr sys/ndir.h`
8462         fi
8463         echo "<dirent.h> NOT found." >&4
8464 fi
8465 set i_dirent
8466 eval $setvar
8467
8468 : Look for type of directory structure.
8469 echo " "
8470 $cppstdin $cppflags $cppminus < "$xinc" > try.c
8471
8472 case "$direntrytype" in
8473 ''|' ')
8474         case "$i_dirent" in
8475         $define) guess1='struct dirent' ;;
8476         *) guess1='struct direct'  ;;
8477         esac
8478         ;;
8479 *)      guess1="$direntrytype"
8480         ;;
8481 esac
8482
8483 case "$guess1" in
8484 'struct dirent') guess2='struct direct' ;;
8485 *) guess2='struct dirent' ;;
8486 esac
8487                 
8488 if $contains "$guess1" try.c >/dev/null 2>&1; then
8489         direntrytype="$guess1"
8490         echo "Your directory entries are $direntrytype." >&4
8491 elif $contains "$guess2" try.c >/dev/null 2>&1; then
8492         direntrytype="$guess2"
8493         echo "Your directory entries seem to be $direntrytype." >&4
8494 else
8495         echo "I don't recognize your system's directory entries." >&4
8496         rp="What type is used for directory entries on this system?"
8497         dflt="$guess1"
8498         . ./myread
8499         direntrytype="$ans"
8500 fi
8501 $rm -f try.c
8502
8503
8504 : see if the directory entry stores field length
8505 echo " "
8506 $cppstdin $cppflags $cppminus < "$xinc" > try.c
8507 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
8508         echo "Good, your directory entry keeps length information in d_namlen." >&4
8509         val="$define"
8510 else
8511         echo "Your directory entry does not know about the d_namlen field." >&4
8512         val="$undef"
8513 fi
8514 set d_dirnamlen
8515 eval $setvar
8516 $rm -f try.c
8517
8518 : see if dlerror exists
8519 xxx_runnm="$runnm"
8520 runnm=false
8521 set dlerror d_dlerror
8522 eval $inlibc
8523 runnm="$xxx_runnm"
8524
8525 : see if dlfcn is available
8526 set dlfcn.h i_dlfcn
8527 eval $inhdr
8528
8529 case "$usedl" in
8530 $define|y|true)
8531         $cat << EOM
8532
8533 On a few systems, the dynamically loaded modules that perl generates and uses
8534 will need a different extension than shared libs. The default will probably
8535 be appropriate.
8536
8537 EOM
8538         case "$dlext" in
8539         '')     dflt="$so" ;;
8540         *)      dflt="$dlext" ;;
8541         esac
8542         rp='What is the extension of dynamically loaded modules'
8543         . ./myread
8544         dlext="$ans"
8545         ;;
8546 *)
8547         dlext="none"
8548         ;;
8549 esac
8550
8551 : Check if dlsym need a leading underscore
8552 echo " "
8553 val="$undef"
8554
8555 case "$dlsrc" in
8556 dl_dlopen.xs)
8557         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
8558         $cat >dyna.c <<'EOM'
8559 fred () { }
8560 EOM
8561
8562 $cat >fred.c<<EOM
8563
8564 #include <stdio.h>
8565 #$i_dlfcn I_DLFCN
8566 #ifdef I_DLFCN
8567 #include <dlfcn.h>      /* the dynamic linker include file for Sunos/Solaris */
8568 #else
8569 #include <sys/types.h>
8570 #include <nlist.h>
8571 #include <link.h>
8572 #endif
8573
8574 extern int fred() ;
8575
8576 int main()
8577 {
8578     void * handle ;
8579     void * symbol ;
8580 #ifndef RTLD_LAZY
8581     int mode = 1 ;
8582 #else
8583     int mode = RTLD_LAZY ;
8584 #endif
8585     handle = dlopen("./dyna.$dlext", mode) ;
8586     if (handle == NULL) {
8587         printf ("1\n") ;
8588         fflush (stdout) ;
8589         exit(0);
8590     }
8591     symbol = dlsym(handle, "fred") ;
8592     if (symbol == NULL) {
8593         /* try putting a leading underscore */
8594         symbol = dlsym(handle, "_fred") ;
8595         if (symbol == NULL) {
8596             printf ("2\n") ;
8597             fflush (stdout) ;
8598             exit(0);
8599         }
8600         printf ("3\n") ;
8601     }
8602     else
8603         printf ("4\n") ;
8604     fflush (stdout) ;
8605     exit(0);
8606 }
8607 EOM
8608         : Call the object file tmp-dyna.o in case dlext=o.
8609         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 && 
8610                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 && 
8611                 $ld $lddlflags -o dyna.$dlext tmp-dyna${_o} > /dev/null 2>&1 && 
8612                 $cc $ccflags -o fred $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1; then
8613                 xxx=`./fred`
8614                 case $xxx in
8615                 1)      echo "Test program failed using dlopen." >&4
8616                         echo "Perhaps you should not use dynamic loading." >&4;;
8617                 2)      echo "Test program failed using dlsym." >&4
8618                         echo "Perhaps you should not use dynamic loading." >&4;;
8619                 3)      echo "dlsym needs a leading underscore" >&4
8620                         val="$define" ;;
8621                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
8622                 esac
8623         else
8624                 echo "I can't compile and run the test program." >&4
8625                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
8626         fi
8627         ;;
8628 esac
8629                 
8630 $rm -f fred fred.? dyna.$dlext dyna.? tmp-dyna.?
8631
8632 set d_dlsymun
8633 eval $setvar
8634
8635 hasproto='varname=$1; func=$2; shift; shift;
8636 while $test $# -ge 2; do
8637         case "$1" in
8638         $define) echo "#include <$2>";;
8639         esac ;
8640     shift 2;
8641 done > try.c;
8642 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
8643 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
8644         echo "$func() prototype found.";
8645         val="$define";
8646 else
8647         echo "$func() prototype NOT found.";
8648         val="$undef";
8649 fi;
8650 set $varname;
8651 eval $setvar;
8652 $rm -f try.c tryout.c'
8653
8654 : see if prototype for drand48 is available
8655 echo " "
8656 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
8657 eval $hasproto
8658
8659 : see if dup2 exists
8660 set dup2 d_dup2
8661 eval $inlibc
8662
8663 : see if eaccess exists
8664 set eaccess d_eaccess
8665 eval $inlibc
8666
8667 : see if endgrent exists
8668 set endgrent d_endgrent
8669 eval $inlibc
8670
8671 : see if endhostent exists
8672 set endhostent d_endhent
8673 eval $inlibc
8674
8675 : see if endnetent exists
8676 set endnetent d_endnent
8677 eval $inlibc
8678
8679 : see if endprotoent exists
8680 set endprotoent d_endpent
8681 eval $inlibc
8682
8683 : see if endpwent exists
8684 set endpwent d_endpwent
8685 eval $inlibc
8686
8687 : see if endservent exists
8688 set endservent d_endsent
8689 eval $inlibc
8690
8691 : Locate the flags for 'open()'
8692 echo " "
8693 $cat >open3.c <<'EOCP'
8694 #include <sys/types.h>
8695 #ifdef I_FCNTL
8696 #include <fcntl.h>
8697 #endif
8698 #ifdef I_SYS_FILE
8699 #include <sys/file.h>
8700 #endif
8701 int main() {
8702         if(O_RDONLY);
8703 #ifdef O_TRUNC
8704         exit(0);
8705 #else
8706         exit(1);
8707 #endif
8708 }
8709 EOCP
8710 : check sys/file.h first to get FREAD on Sun
8711 if $test `./findhdr sys/file.h` && \
8712                 set open3 -DI_SYS_FILE && eval $compile; then
8713         h_sysfile=true;
8714         echo "<sys/file.h> defines the O_* constants..." >&4
8715         if ./open3; then
8716                 echo "and you have the 3 argument form of open()." >&4
8717                 val="$define"
8718         else
8719                 echo "but not the 3 argument form of open().  Oh, well." >&4
8720                 val="$undef"
8721         fi
8722 elif $test `./findhdr fcntl.h` && \
8723                 set open3 -DI_FCNTL && eval $compile; then
8724         h_fcntl=true;
8725         echo "<fcntl.h> defines the O_* constants..." >&4
8726         if ./open3; then
8727                 echo "and you have the 3 argument form of open()." >&4
8728                 val="$define"
8729         else
8730                 echo "but not the 3 argument form of open().  Oh, well." >&4
8731                 val="$undef"
8732         fi
8733 else
8734         val="$undef"
8735         echo "I can't find the O_* constant definitions!  You got problems." >&4
8736 fi
8737 set d_open3
8738 eval $setvar
8739 $rm -f open3*
8740
8741 : see which of string.h or strings.h is needed
8742 echo " "
8743 strings=`./findhdr string.h`
8744 if $test "$strings" && $test -r "$strings"; then
8745         echo "Using <string.h> instead of <strings.h>." >&4
8746         val="$define"
8747 else
8748         val="$undef"
8749         strings=`./findhdr strings.h`
8750         if $test "$strings" && $test -r "$strings"; then
8751                 echo "Using <strings.h> instead of <string.h>." >&4
8752         else
8753                 echo "No string header found -- You'll surely have problems." >&4
8754         fi
8755 fi
8756 set i_string
8757 eval $setvar
8758 case "$i_string" in
8759 "$undef") strings=`./findhdr strings.h`;;
8760 *)        strings=`./findhdr string.h`;;
8761 esac
8762
8763 : check for non-blocking I/O stuff
8764 case "$h_sysfile" in
8765 true) echo "#include <sys/file.h>" > head.c;;
8766 *)
8767         case "$h_fcntl" in
8768         true) echo "#include <fcntl.h>" > head.c;;
8769         *) echo "#include <sys/fcntl.h>" > head.c;;
8770         esac
8771         ;;
8772 esac
8773 echo " "
8774 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
8775 case "$o_nonblock" in
8776 '')
8777         $cat head.c > try.c
8778         $cat >>try.c <<'EOCP'
8779 #include <stdio.h>
8780 int main() {
8781 #ifdef O_NONBLOCK
8782         printf("O_NONBLOCK\n");
8783         exit(0);
8784 #endif
8785 #ifdef O_NDELAY
8786         printf("O_NDELAY\n");
8787         exit(0);
8788 #endif
8789 #ifdef FNDELAY
8790         printf("FNDELAY\n");
8791         exit(0);
8792 #endif
8793         exit(0);
8794 }
8795 EOCP
8796         set try
8797         if eval $compile_ok; then
8798                 o_nonblock=`./try`
8799                 case "$o_nonblock" in
8800                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
8801                 *) echo "Seems like we can use $o_nonblock.";;
8802                 esac
8803         else
8804                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
8805         fi
8806         ;;
8807 *) echo "Using $hint value $o_nonblock.";;
8808 esac
8809 $rm -f try try.* .out core
8810
8811 echo " "
8812 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
8813 case "$eagain" in
8814 '')
8815         $cat head.c > try.c
8816         $cat >>try.c <<EOCP
8817 #include <errno.h>
8818 #include <sys/types.h>
8819 #include <signal.h>
8820 #include <stdio.h> 
8821 #define MY_O_NONBLOCK $o_nonblock
8822 #ifndef errno  /* XXX need better Configure test */
8823 extern int errno;
8824 #endif
8825 #$i_unistd I_UNISTD
8826 #ifdef I_UNISTD
8827 #include <unistd.h>
8828 #endif
8829 #$i_string I_STRING
8830 #ifdef I_STRING
8831 #include <string.h>
8832 #else
8833 #include <strings.h>
8834 #endif
8835 $signal_t blech(x) int x; { exit(3); }
8836 EOCP
8837         $cat >> try.c <<'EOCP'
8838 int main()
8839 {
8840         int pd[2];
8841         int pu[2];
8842         char buf[1];
8843         char string[100];
8844
8845         pipe(pd);       /* Down: child -> parent */
8846         pipe(pu);       /* Up: parent -> child */
8847         if (0 != fork()) {
8848                 int ret;
8849                 close(pd[1]);   /* Parent reads from pd[0] */
8850                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
8851                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
8852                         exit(1);
8853                 signal(SIGALRM, blech);
8854                 alarm(5);
8855                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
8856                         exit(2);
8857                 sprintf(string, "%d\n", ret);
8858                 write(2, string, strlen(string));
8859                 alarm(0);
8860 #ifdef EAGAIN
8861                 if (errno == EAGAIN) {
8862                         printf("EAGAIN\n");
8863                         goto ok;
8864                 }
8865 #endif
8866 #ifdef EWOULDBLOCK
8867                 if (errno == EWOULDBLOCK)
8868                         printf("EWOULDBLOCK\n");
8869 #endif
8870         ok:
8871                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
8872                 sleep(2);                               /* Give it time to close our pipe */
8873                 alarm(5);
8874                 ret = read(pd[0], buf, 1);      /* Should read EOF */
8875                 alarm(0);
8876                 sprintf(string, "%d\n", ret);
8877                 write(3, string, strlen(string));
8878                 exit(0);
8879         }
8880
8881         close(pd[0]);                   /* We write to pd[1] */
8882         close(pu[1]);                   /* We read from pu[0] */
8883         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
8884         close(pd[1]);                   /* Pipe pd is now fully closed! */
8885         exit(0);                                /* Bye bye, thank you for playing! */
8886 }
8887 EOCP
8888         set try
8889         if eval $compile_ok; then
8890                 echo "$startsh" >mtry
8891                 echo "./try >try.out 2>try.ret 3>try.err || exit 4" >>mtry
8892                 chmod +x mtry
8893                 ./mtry >/dev/null 2>&1
8894                 case $? in
8895                 0) eagain=`$cat try.out`;;
8896                 1) echo "Could not perform non-blocking setting!";;
8897                 2) echo "I did a successful read() for something that was not there!";;
8898                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
8899                 *) echo "Something terribly wrong happened during testing.";;
8900                 esac
8901                 rd_nodata=`$cat try.ret`
8902                 echo "A read() system call with no data present returns $rd_nodata."
8903                 case "$rd_nodata" in
8904                 0|-1) ;;
8905                 *)
8906                         echo "(That's peculiar, fixing that to be -1.)"
8907                         rd_nodata=-1
8908                         ;;
8909                 esac
8910                 case "$eagain" in
8911                 '')
8912                         echo "Forcing errno EAGAIN on read() with no data available."
8913                         eagain=EAGAIN
8914                         ;;
8915                 *)
8916                         echo "Your read() sets errno to $eagain when no data is available."
8917                         ;;
8918                 esac
8919                 status=`$cat try.err`
8920                 case "$status" in
8921                 0) echo "And it correctly returns 0 to signal EOF.";;
8922                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
8923                 *) echo "However, your read() returns '$status' on EOF??";;
8924                 esac
8925                 val="$define"
8926                 if test "$status" = "$rd_nodata"; then
8927                         echo "WARNING: you can't distinguish between EOF and no data!"
8928                         val="$undef"
8929                 fi
8930         else
8931                 echo "I can't compile the test program--assuming errno EAGAIN will do."
8932                 eagain=EAGAIN
8933         fi
8934         set d_eofnblk
8935         eval $setvar
8936         ;;
8937 *)
8938         echo "Using $hint value $eagain."
8939         echo "Your read() returns $rd_nodata when no data is present."
8940         case "$d_eofnblk" in
8941         "$define") echo "And you can see EOF because read() returns 0.";;
8942         "$undef") echo "But you can't see EOF status from read() returned value.";;
8943         *)
8944                 echo "(Assuming you can't see EOF status from read anyway.)"
8945                 d_eofnblk=$undef
8946                 ;;
8947         esac
8948         ;;
8949 esac
8950 $rm -f try try.* .out core head.c mtry
8951
8952 : see if fchmod exists
8953 set fchmod d_fchmod
8954 eval $inlibc
8955
8956 : see if fchown exists
8957 set fchown d_fchown
8958 eval $inlibc
8959
8960 : see if this is an fcntl system
8961 set fcntl d_fcntl
8962 eval $inlibc
8963
8964 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
8965 while $test $# -ge 2; do
8966         case "$1" in
8967         $define) echo "#include <$2>";;
8968         esac ;
8969     shift 2;
8970 done > try.c;
8971 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
8972 set try;
8973 if eval $compile; then
8974         val="$define";
8975 else
8976         val="$undef";
8977 fi;
8978 set $varname;
8979 eval $setvar;
8980 $rm -f try.c try.o'
8981
8982 socketlib=''
8983 sockethdr=''
8984 : see whether socket exists
8985 echo " "
8986 $echo $n "Hmm... $c" >&4
8987 if set socket val -f d_socket; eval $csym; $val; then
8988         echo "Looks like you have Berkeley networking support." >&4
8989         d_socket="$define"
8990         if set setsockopt val -f; eval $csym; $val; then
8991                 d_oldsock="$undef"
8992         else
8993                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
8994                 d_oldsock="$define"
8995         fi
8996 else
8997         if $contains socklib libc.list >/dev/null 2>&1; then
8998                 echo "Looks like you have Berkeley networking support." >&4
8999                 d_socket="$define"
9000                 : we will have to assume that it supports the 4.2 BSD interface
9001                 d_oldsock="$undef"
9002         else
9003                 echo "You don't have Berkeley networking in libc$_a..." >&4
9004                 if test "X$d_socket" = "X$define"; then
9005                    echo "...but you seem to believe that you have sockets." >&4
9006                 else
9007                         for net in net socket
9008                         do
9009                                 if test -f /usr/lib/lib$net$_a; then
9010                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
9011                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
9012                                         if $contains socket libc.list >/dev/null 2>&1; then
9013                                                 d_socket="$define"
9014                                                 socketlib="-l$net"
9015                                                 case "$net" in
9016                                                 net)
9017                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
9018                                                         sockethdr="-I/usr/netinclude"
9019                                                         ;;
9020                                                 esac
9021                                                 echo "Found Berkeley sockets interface in lib$net." >& 4 
9022                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
9023                                                         d_oldsock="$undef"
9024                                                 else
9025                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
9026                                                         d_oldsock="$define"
9027                                                 fi
9028                                                 break
9029                                         fi
9030                                 fi
9031                         done
9032                         if test "X$d_socket" != "X$define"; then
9033                            echo "or anywhere else I see." >&4
9034                            d_socket="$undef"
9035                            d_oldsock="$undef"
9036                         fi
9037                 fi
9038         fi
9039 fi
9040
9041 : see if socketpair exists
9042 set socketpair d_sockpair
9043 eval $inlibc
9044
9045
9046 echo " "
9047 echo "Checking the availability of certain socket constants..." >& 4
9048 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
9049         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
9050         $cat >try.c <<EOF
9051 #include <sys/types.h>
9052 #include <sys/socket.h>
9053 int main() {
9054     int i = $ENUM;
9055 }
9056 EOF
9057         val="$undef"
9058         set try; if eval $compile; then
9059                 val="$define"
9060         fi
9061         set d_${enum}; eval $setvar
9062         $rm -f try.c try
9063 done
9064
9065 : see if sys/select.h has to be included
9066 set sys/select.h i_sysselct
9067 eval $inhdr
9068
9069 : see if we should include time.h, sys/time.h, or both
9070 echo " "
9071 if test "X$timeincl" = X; then
9072         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
9073         $echo $n "I'm now running the test program...$c"
9074         $cat >try.c <<'EOCP'
9075 #include <sys/types.h>
9076 #ifdef I_TIME
9077 #include <time.h>
9078 #endif
9079 #ifdef I_SYSTIME
9080 #ifdef SYSTIMEKERNEL
9081 #define KERNEL
9082 #endif
9083 #include <sys/time.h>
9084 #endif
9085 #ifdef I_SYSSELECT
9086 #include <sys/select.h>
9087 #endif
9088 int main()
9089 {
9090         struct tm foo;
9091 #ifdef S_TIMEVAL
9092         struct timeval bar;
9093 #endif
9094 #ifdef S_TIMEZONE
9095         struct timezone tzp;
9096 #endif
9097         if (foo.tm_sec == foo.tm_sec)
9098                 exit(0);
9099 #ifdef S_TIMEVAL
9100         if (bar.tv_sec == bar.tv_sec)
9101                 exit(0);
9102 #endif
9103         exit(1);
9104 }
9105 EOCP
9106         flags=''
9107         for s_timezone in '-DS_TIMEZONE' ''; do
9108         sysselect=''
9109         for s_timeval in '-DS_TIMEVAL' ''; do
9110         for i_systimek in '' '-DSYSTIMEKERNEL'; do
9111         for i_time in '' '-DI_TIME'; do
9112         for i_systime in '-DI_SYSTIME' ''; do
9113                 case "$flags" in
9114                 '') $echo $n ".$c"
9115                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
9116                         if eval $compile; then
9117                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
9118                                 shift
9119                                 flags="$*"
9120                                 echo " "
9121                                 $echo $n "Succeeded with $flags$c"
9122                         fi
9123                         ;;
9124                 esac
9125         done
9126         done
9127         done
9128         done
9129         done
9130         timeincl=''
9131         echo " "
9132         case "$flags" in
9133         *SYSTIMEKERNEL*) i_systimek="$define"
9134                 timeincl=`./findhdr sys/time.h`
9135                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
9136         *) i_systimek="$undef";;
9137         esac
9138         case "$flags" in
9139         *I_TIME*) i_time="$define"
9140                 timeincl=`./findhdr time.h`" $timeincl"
9141                 echo "We'll include <time.h>." >&4;;
9142         *) i_time="$undef";;
9143         esac
9144         case "$flags" in
9145         *I_SYSTIME*) i_systime="$define"
9146                 timeincl=`./findhdr sys/time.h`" $timeincl"
9147                 echo "We'll include <sys/time.h>." >&4;;
9148         *) i_systime="$undef";;
9149         esac
9150         $rm -f try.c try
9151 fi
9152
9153 : check for fd_set items
9154 $cat <<EOM
9155
9156 Checking to see how well your C compiler handles fd_set and friends ...
9157 EOM
9158 $cat >fd_set.c <<EOCP
9159 #$i_systime I_SYS_TIME
9160 #$i_sysselct I_SYS_SELECT
9161 #$d_socket HAS_SOCKET
9162 #include <sys/types.h>
9163 #ifdef HAS_SOCKET
9164 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
9165 #endif
9166 #ifdef I_SYS_TIME
9167 #include <sys/time.h>
9168 #endif
9169 #ifdef I_SYS_SELECT
9170 #include <sys/select.h>
9171 #endif
9172 int main() {
9173         fd_set fds;
9174
9175 #ifdef TRYBITS
9176         if(fds.fds_bits);
9177 #endif
9178
9179 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
9180         exit(0);
9181 #else
9182         exit(1);
9183 #endif
9184 }
9185 EOCP
9186 set fd_set -DTRYBITS
9187 if eval $compile; then
9188         d_fds_bits="$define"
9189         d_fd_set="$define"
9190         echo "Well, your system knows about the normal fd_set typedef..." >&4
9191         if ./fd_set; then
9192                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
9193                 d_fd_macros="$define"
9194         else
9195                 $cat >&4 <<'EOM'
9196 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
9197 EOM
9198                 d_fd_macros="$undef"
9199         fi
9200 else
9201         $cat <<'EOM'
9202 Hmm, your compiler has some difficulty with fd_set.  Checking further...
9203 EOM
9204         set fd_set
9205         if eval $compile; then
9206                 d_fds_bits="$undef"
9207                 d_fd_set="$define"
9208                 echo "Well, your system has some sort of fd_set available..." >&4
9209                 if ./fd_set; then
9210                         echo "and you have the normal fd_set macros." >&4
9211                         d_fd_macros="$define"
9212                 else
9213                         $cat <<'EOM'
9214 but not the normal fd_set macros!  Gross!  More work for me...
9215 EOM
9216                         d_fd_macros="$undef"
9217                 fi
9218         else
9219         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
9220                 d_fd_set="$undef"
9221                 d_fds_bits="$undef"
9222                 d_fd_macros="$undef"
9223         fi
9224 fi
9225 $rm -f fd_set*
9226
9227 : see if fgetpos exists
9228 set fgetpos d_fgetpos
9229 eval $inlibc
9230
9231 : see if flock exists
9232 set flock d_flock
9233 eval $inlibc
9234
9235 : see if fork exists
9236 set fork d_fork
9237 eval $inlibc
9238
9239 : see if pathconf exists
9240 set pathconf d_pathconf
9241 eval $inlibc
9242
9243 : see if fpathconf exists
9244 set fpathconf d_fpathconf
9245 eval $inlibc
9246
9247
9248 : check for fpos64_t
9249 echo " "
9250 echo "Checking to see if you have fpos64_t..." >&4
9251 $cat >try.c <<EOCP
9252 #include <stdio.h>
9253 int main() { fpos64_t x = 7; }
9254 EOCP
9255 set try
9256 if eval $compile; then
9257         val="$define"
9258         echo "You have fpos64_t."
9259 else
9260         val="$undef"
9261         echo "You do not have fpos64_t."
9262         case "$fpossize" in
9263         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
9264         esac
9265 fi
9266 $rm -f try.* try
9267 set d_fpos64_t
9268 eval $setvar
9269
9270 : see if frexpl exists
9271 set frexpl d_frexpl
9272 eval $inlibc
9273
9274 hasstruct='varname=$1; struct=$2; shift; shift;
9275 while $test $# -ge 2; do
9276         case "$1" in
9277         $define) echo "#include <$2>";;
9278         esac ;
9279     shift 2;
9280 done > try.c;
9281 echo "int main () { struct $struct foo; }" >> try.c;
9282 set try;
9283 if eval $compile; then
9284         val="$define";
9285 else
9286         val="$undef";
9287 fi;
9288 set $varname;
9289 eval $setvar;
9290 $rm -f try.c try.o'
9291
9292 : see if this is a sys/param system
9293 set sys/param.h i_sysparam
9294 eval $inhdr
9295
9296 : see if this is a sys/mount.h system
9297 set sys/mount.h i_sysmount
9298 eval $inhdr
9299
9300 : see if sys/types.h has to be included
9301 set sys/types.h i_systypes
9302 eval $inhdr
9303
9304
9305 echo " "
9306 echo "Checking to see if your system supports struct fs_data..." >&4
9307 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
9308 eval $hasstruct
9309 case "$d_fs_data_s" in
9310 "$define")      echo "Yes, it does."   ;;
9311 *)              echo "No, it doesn't." ;;
9312 esac
9313
9314 : see if fseeko exists
9315 set fseeko d_fseeko
9316 eval $inlibc
9317 case "$longsize" in
9318 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
9319 esac
9320
9321 : see if fsetpos exists
9322 set fsetpos d_fsetpos
9323 eval $inlibc
9324
9325
9326 : see if fstatfs exists
9327 set fstatfs d_fstatfs
9328 eval $inlibc
9329
9330
9331 : see if statvfs exists
9332 set statvfs d_statvfs
9333 eval $inlibc
9334
9335 : see if fstatvfs exists
9336 set fstatvfs d_fstatvfs
9337 eval $inlibc
9338
9339
9340 : see if ftello exists
9341 set ftello d_ftello
9342 eval $inlibc
9343 case "$longsize" in
9344 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
9345 esac
9346
9347 : see if getcwd exists
9348 set getcwd d_getcwd
9349 eval $inlibc
9350
9351 : see if getespwnam exists
9352 set getespwnam d_getespwnam
9353 eval $inlibc
9354
9355
9356 : see if getfsstat exists
9357 set getfsstat d_getfsstat
9358 eval $inlibc
9359
9360 : see if getgrent exists
9361 set getgrent d_getgrent
9362 eval $inlibc
9363
9364 : see if gethostbyaddr exists
9365 set gethostbyaddr d_gethbyaddr
9366 eval $inlibc
9367
9368 : see if gethostbyname exists
9369 set gethostbyname d_gethbyname
9370 eval $inlibc
9371
9372 : see if gethostent exists
9373 set gethostent d_gethent
9374 eval $inlibc
9375
9376 : see how we will look up host name
9377 echo " "
9378 call=''
9379 if set gethostname val -f d_gethname; eval $csym; $val; then
9380         echo 'gethostname() found.' >&4
9381         d_gethname="$define"
9382         call=gethostname
9383 fi
9384 if set uname val -f d_uname; eval $csym; $val; then
9385         if ./xenix; then
9386                 $cat <<'EOM'
9387 uname() was found, but you're running xenix, and older versions of xenix
9388 have a broken uname(). If you don't really know whether your xenix is old
9389 enough to have a broken system call, use the default answer.
9390
9391 EOM
9392                 dflt=y
9393                 case "$d_uname" in
9394                 "$define") dflt=n;;
9395                 esac
9396                 rp='Is your uname() broken?'
9397                 . ./myread
9398                 case "$ans" in
9399                 n*) d_uname="$define"; call=uname;;
9400                 esac
9401         else
9402                 echo 'uname() found.' >&4
9403                 d_uname="$define"
9404                 case "$call" in
9405                 '') call=uname ;;
9406                 esac
9407         fi
9408 fi
9409 case "$d_gethname" in
9410 '') d_gethname="$undef";;
9411 esac
9412 case "$d_uname" in
9413 '') d_uname="$undef";;
9414 esac
9415 case "$d_uname$d_gethname" in
9416 *define*)
9417         dflt=n
9418         cat <<EOM
9419  
9420 Every now and then someone has a $call() that lies about the hostname
9421 but can't be fixed for political or economic reasons.  If you wish, I can
9422 pretend $call() isn't there and maybe compute hostname at run-time
9423 thanks to the '$phostname' command.
9424
9425 EOM
9426         rp="Shall I ignore $call() from now on?"
9427         . ./myread
9428         case "$ans" in
9429         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
9430         esac;;
9431 esac
9432 case "$phostname" in
9433 '') aphostname='';;
9434 *) case "$aphostname" in
9435         /*) ;;
9436         *) set X $phostname
9437                 shift
9438                 file=$1
9439                 shift
9440                 file=`./loc $file $file $pth`
9441                 aphostname=`echo $file $*`
9442                 ;;
9443         esac
9444         ;;
9445 esac
9446 case "$d_uname$d_gethname" in
9447 *define*) ;;
9448 *)
9449         case "$phostname" in
9450         '')
9451                 echo "There will be no way for $package to get your hostname." >&4;;
9452         *)
9453         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
9454                 ;;
9455         esac;;
9456 esac
9457 case "$d_phostname" in
9458 '') d_phostname="$undef";;
9459 esac
9460
9461 : see if this is a netdb.h system
9462 set netdb.h i_netdb
9463 eval $inhdr
9464
9465 : see if prototypes for various gethostxxx netdb.h functions are available
9466 echo " "
9467 set d_gethostprotos gethostent $i_netdb netdb.h
9468 eval $hasproto
9469
9470 : see if getlogin exists
9471 set getlogin d_getlogin
9472 eval $inlibc
9473
9474 : see if getmnt exists
9475 set getmnt d_getmnt
9476 eval $inlibc
9477
9478 : see if getmntent exists
9479 set getmntent d_getmntent
9480 eval $inlibc
9481
9482 : see if getnetbyaddr exists
9483 set getnetbyaddr d_getnbyaddr
9484 eval $inlibc
9485
9486 : see if getnetbyname exists
9487 set getnetbyname d_getnbyname
9488 eval $inlibc
9489
9490 : see if getnetent exists
9491 set getnetent d_getnent
9492 eval $inlibc
9493
9494 : see if prototypes for various getnetxxx netdb.h functions are available
9495 echo " "
9496 set d_getnetprotos getnetent $i_netdb netdb.h
9497 eval $hasproto
9498
9499
9500 : see if getprotobyname exists
9501 set getprotobyname d_getpbyname
9502 eval $inlibc
9503
9504 : see if getprotobynumber exists
9505 set getprotobynumber d_getpbynumber
9506 eval $inlibc
9507
9508 : see if getprotoent exists
9509 set getprotoent d_getpent
9510 eval $inlibc
9511
9512 : see if getpgid exists
9513 set getpgid d_getpgid
9514 eval $inlibc
9515
9516 : see if getpgrp2 exists
9517 set getpgrp2 d_getpgrp2
9518 eval $inlibc
9519
9520 : see if getppid exists
9521 set getppid d_getppid
9522 eval $inlibc
9523
9524 : see if getpriority exists
9525 set getpriority d_getprior
9526 eval $inlibc
9527
9528 : see if prototypes for various getprotoxxx netdb.h functions are available
9529 echo " "
9530 set d_getprotoprotos getprotoent $i_netdb netdb.h
9531 eval $hasproto
9532
9533 : see if getprpwnam exists
9534 set getprpwnam d_getprpwnam
9535 eval $inlibc
9536
9537 : see if getpwent exists
9538 set getpwent d_getpwent
9539 eval $inlibc
9540
9541
9542 : see if getservbyname exists
9543 set getservbyname d_getsbyname
9544 eval $inlibc
9545
9546 : see if getservbyport exists
9547 set getservbyport d_getsbyport
9548 eval $inlibc
9549
9550 : see if getservent exists
9551 set getservent d_getsent
9552 eval $inlibc
9553
9554 : see if prototypes for various getservxxx netdb.h functions are available
9555 echo " "
9556 set d_getservprotos getservent $i_netdb netdb.h
9557 eval $hasproto
9558
9559 : see if getspnam exists
9560 set getspnam d_getspnam
9561 eval $inlibc
9562
9563 : see if gettimeofday or ftime exists
9564 set gettimeofday d_gettimeod
9565 eval $inlibc
9566 case "$d_gettimeod" in
9567 "$undef")
9568         set ftime d_ftime 
9569         eval $inlibc
9570         ;;
9571 *)
9572         val="$undef"; set d_ftime; eval $setvar
9573         ;;
9574 esac
9575 case "$d_gettimeod$d_ftime" in
9576 "$undef$undef")
9577         echo " "
9578         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
9579         ;;
9580 esac
9581
9582 : see if this is an grp system
9583 set grp.h i_grp
9584 eval $inhdr
9585
9586 case "$i_grp" in
9587 $define)
9588         xxx=`./findhdr grp.h`
9589         $cppstdin $cppflags $cppminus < $xxx >$$.h
9590
9591         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
9592                 val="$define"
9593         else
9594                 val="$undef"
9595         fi
9596         set d_grpasswd
9597         eval $setvar
9598
9599         $rm -f $$.h
9600         ;;
9601 *)
9602         val="$undef";
9603         set d_grpasswd; eval $setvar
9604         ;;
9605 esac
9606
9607 : see if hasmntopt exists
9608 set hasmntopt d_hasmntopt
9609 eval $inlibc
9610
9611 : see if this is a netinet/in.h or sys/in.h system
9612 set netinet/in.h i_niin sys/in.h i_sysin
9613 eval $inhdr
9614
9615 : see if arpa/inet.h has to be included
9616 set arpa/inet.h i_arpainet
9617 eval $inhdr
9618
9619 : see if htonl --and friends-- exists
9620 val=''
9621 set htonl val
9622 eval $inlibc
9623
9624 : Maybe they are macros.
9625 case "$val" in
9626 $undef)
9627         $cat >htonl.c <<EOM
9628 #include <stdio.h>
9629 #include <sys/types.h>
9630 #$i_niin I_NETINET_IN
9631 #$i_sysin I_SYS_IN
9632 #$i_arpainet I_ARPA_INET
9633 #ifdef I_NETINET_IN
9634 #include <netinet/in.h>
9635 #endif
9636 #ifdef I_SYS_IN
9637 #include <sys/in.h>
9638 #endif
9639 #ifdef I_ARPA_INET
9640 #include <arpa/inet.h>
9641 #endif
9642 #ifdef htonl
9643 printf("Defined as a macro.");
9644 #endif
9645 EOM
9646         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
9647         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
9648                 val="$define"
9649                 echo "But it seems to be defined as a macro." >&4
9650         fi
9651         $rm -f htonl.?
9652         ;;
9653 esac
9654 set d_htonl
9655 eval $setvar
9656
9657 : see if iconv exists
9658 set iconv d_iconv
9659 eval $inlibc
9660
9661 : index or strchr
9662 echo " "
9663 if set index val -f; eval $csym; $val; then
9664         if set strchr val -f d_strchr; eval $csym; $val; then
9665                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
9666                         val="$define"
9667                         vali="$undef"
9668                         echo "strchr() found." >&4
9669                 else
9670                         val="$undef"
9671                         vali="$define"
9672                         echo "index() found." >&4
9673                 fi
9674         else
9675                 val="$undef"
9676                 vali="$define"
9677                 echo "index() found." >&4
9678         fi
9679 else
9680         if set strchr val -f d_strchr; eval $csym; $val; then
9681                 val="$define"
9682                 vali="$undef"
9683                 echo "strchr() found." >&4
9684         else
9685                 echo "No index() or strchr() found!" >&4
9686                 val="$undef"
9687                 vali="$undef"
9688         fi
9689 fi
9690 set d_strchr; eval $setvar
9691 val="$vali"
9692 set d_index; eval $setvar
9693
9694 : check whether inet_aton exists
9695 set inet_aton d_inetaton
9696 eval $inlibc
9697
9698 : see if inttypes.h is available
9699 : we want a real compile instead of Inhdr because some systems
9700 : have an inttypes.h which includes non-existent headers
9701 echo " "
9702 $cat >try.c <<EOCP
9703 #include <inttypes.h>
9704 int main() {
9705         static int32_t foo32 = 0x12345678;
9706 }
9707 EOCP
9708 set try
9709 if eval $compile; then
9710         echo "<inttypes.h> found." >&4
9711         val="$define"
9712 else
9713         echo "<inttypes.h> NOT found." >&4
9714         val="$undef"
9715 fi
9716 $rm -f try.c try
9717 set i_inttypes
9718 eval $setvar
9719
9720 : check for int64_t
9721 echo " "
9722 echo "Checking to see if you have int64_t..." >&4
9723 $cat >try.c <<EOCP
9724 #include <sys/types.h>
9725 #$i_inttypes I_INTTYPES
9726 #ifdef I_INTTYPES
9727 #include <inttypes.h>
9728 #endif
9729 int main() { int64_t x = 7; }
9730 EOCP
9731 set try
9732 if eval $compile; then
9733         val="$define"
9734         echo "You have int64_t."
9735 else
9736         val="$undef"
9737         echo "You do not have int64_t."
9738 fi
9739 $rm -f try try.*
9740 set d_int64_t
9741 eval $setvar
9742
9743 : Look for isascii
9744 echo " "
9745 $cat >isascii.c <<'EOCP'
9746 #include <stdio.h>
9747 #include <ctype.h>
9748 int main() {
9749         int c = 'A';
9750         if (isascii(c))
9751                 exit(0);
9752         else
9753                 exit(1);
9754 }
9755 EOCP
9756 set isascii
9757 if eval $compile; then
9758         echo "isascii() found." >&4
9759         val="$define"
9760 else
9761         echo "isascii() NOT found." >&4
9762         val="$undef"
9763 fi
9764 set d_isascii
9765 eval $setvar
9766 $rm -f isascii*
9767
9768 : see if isnan exists
9769 set isnan d_isnan
9770 eval $inlibc
9771
9772 : see if isnanl exists
9773 set isnanl d_isnanl
9774 eval $inlibc
9775
9776 : see if killpg exists
9777 set killpg d_killpg
9778 eval $inlibc
9779
9780 : see if lchown exists
9781 echo " "
9782 $cat > try.c <<'EOCP'
9783 /* System header to define __stub macros and hopefully few prototypes,
9784     which can conflict with char lchown(); below.  */
9785 #include <assert.h>
9786 /* Override any gcc2 internal prototype to avoid an error.  */
9787 /* We use char because int might match the return type of a gcc2
9788    builtin and then its argument prototype would still apply.  */
9789 char lchown();
9790 int main() {
9791     /*  The GNU C library defines this for functions which it implements
9792         to always fail with ENOSYS.  Some functions are actually named
9793         something starting with __ and the normal name is an alias.  */
9794 #if defined (__stub_lchown) || defined (__stub___lchown)
9795 choke me
9796 #else
9797 lchown();
9798 #endif
9799 ; return 0; }
9800 EOCP
9801 set try
9802 if eval $compile; then
9803     $echo "lchown() found." >&4
9804     val="$define"
9805 else
9806     $echo "lchown() NOT found." >&4
9807     val="$undef"
9808 fi
9809 set d_lchown
9810 eval $setvar
9811
9812 : See if number of significant digits in a double precision number is known
9813 echo " "
9814 $cat >ldbl_dig.c <<EOM
9815 #$i_limits I_LIMITS
9816 #$i_float I_FLOAT
9817 #ifdef I_LIMITS
9818 #include <limits.h>
9819 #endif
9820 #ifdef I_FLOAT
9821 #include <float.h>
9822 #endif
9823 #ifdef LDBL_DIG
9824 printf("Contains LDBL_DIG");
9825 #endif
9826 EOM
9827 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
9828 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
9829         echo "LDBL_DIG found." >&4
9830         val="$define"
9831 else
9832         echo "LDBL_DIG NOT found." >&4
9833         val="$undef"
9834 fi
9835 $rm -f ldbl_dig.?
9836 set d_ldbl_dig
9837 eval $setvar
9838
9839 : see if link exists
9840 set link d_link
9841 eval $inlibc
9842
9843 : see if localeconv exists
9844 set localeconv d_locconv
9845 eval $inlibc
9846
9847 : see if lockf exists
9848 set lockf d_lockf
9849 eval $inlibc
9850
9851 : check for long long
9852 echo " "
9853 echo "Checking to see if you have long long..." >&4
9854 echo 'int main() { long long x = 7; return 0; }' > try.c
9855 set try
9856 if eval $compile; then
9857         val="$define"
9858         echo "You have long long."
9859 else
9860         val="$undef"
9861         echo "You do not have long long."
9862 fi
9863 $rm try.*
9864 set d_longlong
9865 eval $setvar
9866
9867 : check for length of long long
9868 case "${d_longlong}${longlongsize}" in
9869 $define)
9870         echo " "
9871         echo "Checking to see how big your long longs are..." >&4
9872         $cat >try.c <<'EOCP'
9873 #include <stdio.h>
9874 int main()
9875 {
9876     printf("%d\n", (int)sizeof(long long));
9877     return(0);
9878 }
9879 EOCP
9880         set try
9881         if eval $compile_ok; then
9882                 longlongsize=`./try$exe_ext`
9883                 echo "Your long longs are $longlongsize bytes long."
9884         else
9885                 dflt='8'
9886                 echo " "
9887                 echo "(I can't seem to compile the test program.  Guessing...)"
9888                 rp="What is the size of a long long (in bytes)?"
9889                 . ./myread
9890                 longlongsize="$ans"
9891         fi
9892         if $test "X$longsize" = "X$longlongsize"; then
9893                 echo "(That isn't any different from an ordinary long.)"
9894         fi      
9895         ;;
9896 esac
9897 $rm -f try.* try
9898
9899 : see if prototype for lseek is available
9900 echo " "
9901 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
9902 eval $hasproto
9903
9904 : see if lstat exists
9905 set lstat d_lstat
9906 eval $inlibc
9907
9908 : see if madvise exists
9909 set madvise d_madvise
9910 eval $inlibc
9911
9912 : see if mblen exists
9913 set mblen d_mblen
9914 eval $inlibc
9915
9916 : see if mbstowcs exists
9917 set mbstowcs d_mbstowcs
9918 eval $inlibc
9919
9920 : see if mbtowc exists
9921 set mbtowc d_mbtowc
9922 eval $inlibc
9923
9924 : see if memchr exists
9925 set memchr d_memchr
9926 eval $inlibc
9927
9928 : see if memcmp exists
9929 set memcmp d_memcmp
9930 eval $inlibc
9931
9932 : see if memcpy exists
9933 set memcpy d_memcpy
9934 eval $inlibc
9935
9936 : see if memmove exists
9937 set memmove d_memmove
9938 eval $inlibc
9939
9940 : see if memset exists
9941 set memset d_memset
9942 eval $inlibc
9943
9944 : see if mkdir exists
9945 set mkdir d_mkdir
9946 eval $inlibc
9947
9948 : see if mkdtemp exists
9949 set mkdtemp d_mkdtemp
9950 eval $inlibc
9951
9952 : see if mkfifo exists
9953 set mkfifo d_mkfifo
9954 eval $inlibc
9955
9956 : see if mkstemp exists
9957 set mkstemp d_mkstemp
9958 eval $inlibc
9959
9960 : see if mkstemps exists
9961 set mkstemps d_mkstemps
9962 eval $inlibc
9963
9964 : see if mktime exists
9965 set mktime d_mktime
9966 eval $inlibc
9967
9968 : see if this is a sys/mman.h system
9969 set sys/mman.h i_sysmman
9970 eval $inhdr
9971
9972 : see if mmap exists
9973 set mmap d_mmap
9974 eval $inlibc
9975 : see what shmat returns
9976 : default to something harmless
9977 mmaptype='void *'
9978 case "$i_sysmman$d_mmap" in
9979 "$define$define")
9980         $cat >mmap.c <<'END'
9981 #include <sys/mman.h>
9982 void *mmap();
9983 END
9984         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
9985                 mmaptype='void *'
9986         else
9987                 mmaptype='caddr_t'
9988         fi
9989         echo "and it returns ($mmaptype)." >&4
9990         ;;
9991 esac
9992
9993
9994
9995 : see if modfl exists
9996 set modfl d_modfl
9997 eval $inlibc
9998
9999 : see if mprotect exists
10000 set mprotect d_mprotect
10001 eval $inlibc
10002
10003 : see if msgctl exists
10004 set msgctl d_msgctl
10005 eval $inlibc
10006
10007 : see if msgget exists
10008 set msgget d_msgget
10009 eval $inlibc
10010
10011 : see if msgsnd exists
10012 set msgsnd d_msgsnd
10013 eval $inlibc
10014
10015 : see if msgrcv exists
10016 set msgrcv d_msgrcv
10017 eval $inlibc
10018
10019 : see how much of the 'msg*(2)' library is present.
10020 h_msg=true
10021 echo " "
10022 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
10023 *"$undef"*) h_msg=false;;
10024 esac
10025 case "$osname" in
10026 freebsd)
10027     case "`ipcs 2>&1`" in
10028     "SVID messages"*"not configured"*)
10029         echo "Your $osname does not have the msg*(2) configured." >&4
10030         h_msg=false
10031         val="$undef"
10032         set msgctl d_msgctl
10033         eval $setvar
10034         set msgget d_msgget
10035         eval $setvar
10036         set msgsnd d_msgsnd
10037         eval $setvar
10038         set msgrcv d_msgrcv
10039         eval $setvar
10040         ;;
10041     esac
10042     ;;
10043 esac
10044 : we could also check for sys/ipc.h ...
10045 if $h_msg && $test `./findhdr sys/msg.h`; then
10046         echo "You have the full msg*(2) library." >&4
10047         val="$define"
10048 else
10049         echo "You don't have the full msg*(2) library." >&4
10050         val="$undef"
10051 fi
10052 set d_msg
10053 eval $setvar
10054
10055 : see if msync exists
10056 set msync d_msync
10057 eval $inlibc
10058
10059 : see if munmap exists
10060 set munmap d_munmap
10061 eval $inlibc
10062
10063 : see if nice exists
10064 set nice d_nice
10065 eval $inlibc
10066
10067
10068 echo " "
10069 echo "Checking which 64-bit integer type we could use..." >&4
10070
10071 case "$intsize" in
10072 8) val=int
10073    set quadtype
10074    eval $setvar
10075    val='"unsigned int"'
10076    set uquadtype
10077    eval $setvar
10078    quadkind=1
10079    ;;
10080 *) case "$longsize" in
10081    8) val=long
10082       set quadtype
10083       eval $setvar
10084       val='"unsigned long"'
10085       set uquadtype
10086       eval $setvar
10087       quadkind=2
10088       ;;
10089    *) case "$d_longlong:$longlongsize" in
10090       define:8)
10091         val='"long long"'
10092         set quadtype
10093         eval $setvar
10094         val='"unsigned long long"'
10095         set uquadtype
10096         eval $setvar
10097         quadkind=3
10098         ;;
10099       *) case "$d_int64_t" in
10100          define)
10101            val=int64_t
10102            set quadtype
10103            eval $setvar
10104            val=uint64_t
10105            set uquadtype
10106            eval $setvar
10107            quadkind=4
10108            ;;
10109          esac
10110          ;;
10111       esac
10112       ;;
10113    esac
10114    ;;
10115 esac
10116
10117 case "$quadtype" in
10118 '')     echo "Alas, no 64-bit integer types in sight." >&4
10119         d_quad="$undef"
10120         ;;
10121 *)      if test X"$use64bitint" = Xdefine -o X"$longsize" = X8; then
10122             verb="will"
10123         else
10124             verb="could"
10125         fi
10126         echo "We $verb use '$quadtype' for 64-bit integers." >&4
10127         d_quad="$define"
10128         ;;
10129 esac
10130
10131 : check for length of character
10132 echo " "
10133 case "$charsize" in
10134 '')
10135         echo "Checking to see how big your characters are (hey, you never know)..." >&4
10136         $cat >try.c <<'EOCP'
10137 #include <stdio.h>
10138 int main()
10139 {
10140     printf("%d\n", (int)sizeof(char));
10141     exit(0);
10142 }
10143 EOCP
10144         set try
10145         if eval $compile_ok; then
10146                 dflt=`./try`
10147         else
10148                 dflt='1'
10149                 echo "(I can't seem to compile the test program.  Guessing...)"
10150         fi
10151         ;;
10152 *)
10153         dflt="$charsize"
10154         ;;
10155 esac
10156 rp="What is the size of a character (in bytes)?"
10157 . ./myread
10158 charsize="$ans"
10159 $rm -f try.c try
10160
10161
10162 echo " "
10163 $echo "Choosing the C types to be used for Perl's internal types..." >&4
10164
10165 case "$use64bitint:$d_quad:$quadtype" in
10166 define:define:?*)
10167         ivtype="$quadtype"
10168         uvtype="$uquadtype"
10169         ivsize=8
10170         uvsize=8
10171         ;;
10172 *)      ivtype="long"
10173         uvtype="unsigned long"
10174         ivsize=$longsize
10175         uvsize=$longsize
10176         ;;
10177 esac
10178
10179 case "$uselongdouble:$d_longdbl" in
10180 define:define)
10181         nvtype="long double"
10182         nvsize=$longdblsize
10183         ;;
10184 *)      nvtype=double
10185         nvsize=$doublesize
10186         ;;
10187 esac
10188
10189 $echo "(IV will be "$ivtype", $ivsize bytes)"
10190 $echo "(UV will be "$uvtype", $uvsize bytes)"
10191 $echo "(NV will be "$nvtype", $nvsize bytes)"
10192
10193 $cat >try.c <<EOCP
10194 #$i_inttypes I_INTTYPES
10195 #ifdef I_INTTYPES
10196 #include <inttypes.h>
10197 #endif
10198 #include <stdio.h>
10199 int main() {
10200 #ifdef INT8
10201    int8_t i =  INT8_MAX;
10202   uint8_t u = UINT8_MAX;
10203   printf("int8_t\n");
10204 #endif
10205 #ifdef INT16
10206    int16_t i =  INT16_MAX;
10207   uint16_t i = UINT16_MAX;
10208   printf("int16_t\n");
10209 #endif
10210 #ifdef INT32
10211    int32_t i =  INT32_MAX;
10212   uint32_t u = UINT32_MAX;
10213   printf("int32_t\n");
10214 #endif
10215 }
10216 EOCP
10217
10218 case "$i8type" in
10219 '')     case "$charsize" in
10220         1)      i8type=char
10221                 u8type="unsigned char"
10222                 i8size=$charsize
10223                 u8size=$charsize
10224                 ;;
10225         esac
10226         ;;
10227 esac
10228 case "$i8type" in
10229 '')     set try -DINT8
10230         if eval $compile; then
10231                 case "`./try$exe_ext`" in
10232                 int8_t) i8type=int8_t
10233                         u8type=uint8_t
10234                         i8size=1
10235                         u8size=1
10236                         ;;
10237                 esac
10238         fi
10239         ;;
10240 esac
10241 case "$i8type" in
10242 '')     if $test $charsize -ge 1; then
10243                 i8type=char
10244                 u8type="unsigned char"
10245                 i8size=$charsize
10246                 u8size=$charsize
10247         fi
10248         ;;
10249 esac
10250
10251 case "$i16type" in
10252 '')     case "$shortsize" in
10253         2)      i16type=short
10254                 u16type="unsigned short"
10255                 i16size=$shortsize
10256                 u16size=$shortsize
10257                 ;;
10258         esac
10259         ;;
10260 esac
10261 case "$i16type" in
10262 '')     set try -DINT16
10263         if eval $compile; then
10264                 case "`./try$exe_ext`" in
10265                 int16_t)
10266                         i16type=int16_t
10267                         u16type=uint16_t
10268                         i16size=2
10269                         u16size=2
10270                         ;;
10271                 esac
10272         fi
10273         ;;
10274 esac
10275 case "$i16type" in
10276 '')     if $test $shortsize -ge 2; then
10277                 i16type=short
10278                 u16type="unsigned short"
10279                 i16size=$shortsize
10280                 u16size=$shortsize
10281         fi
10282         ;;
10283 esac
10284
10285 case "$i32type" in
10286 '')     case "$longsize" in
10287         4)      i32type=long
10288                 u32type="unsigned long"
10289                 i32size=$longsize
10290                 u32size=$longsize
10291                 ;;
10292         *)      case "$intsize" in
10293                 4)      i32type=int
10294                         u32type="unsigned int"
10295                         i32size=$intsize
10296                         u32size=$intsize
10297                         ;;
10298                 esac
10299                 ;;
10300         esac
10301         ;;
10302 esac
10303 case "$i32type" in
10304 '')     set try -DINT32
10305         if eval $compile; then
10306                 case "`./try$exe_ext`" in
10307                 int32_t)
10308                         i32type=int32_t
10309                         u32type=uint32_t
10310                         i32size=4
10311                         u32size=4
10312                         ;;
10313                 esac
10314         fi
10315         ;;
10316 esac
10317 case "$i32type" in
10318 '')     if $test $intsize -ge 4; then
10319                 i32type=int
10320                 u32type="unsigned int"
10321                 i32size=$intsize
10322                 u32size=$intsize
10323         fi
10324         ;;
10325 esac
10326
10327 case "$i64type" in
10328 '')     case "$d_quad:$quadtype" in
10329         define:?*)
10330                 i64type="$quadtype"
10331                 u64type="$uquadtype"
10332                 i64size=8
10333                 u64size=8
10334                 ;;
10335         esac
10336         ;;
10337 esac
10338
10339 $echo "Checking whether your NVs can preserve your UVs..." >&4
10340 $cat <<EOP >try.c
10341 #include <stdio.h>
10342 int main() {
10343     $uvtype k = ($uvtype)~0, l;
10344     $nvtype d;
10345     l = k;
10346     d = ($nvtype)l;
10347     l = ($uvtype)d;
10348     if (l == k)
10349        printf("preserve\n");
10350     exit(0);
10351 }
10352 EOP
10353 set try
10354 if eval $compile; then
10355         case "`./try$exe_ext`" in
10356         preserve) d_nv_preserves_uv="$define" ;;
10357         esac
10358 fi      
10359 case "$d_nv_preserves_uv" in
10360 $define) $echo "Yes, they can."  2>&1 ;;
10361 *)       $echo "No, they can't." 2>&1
10362          d_nv_preserves_uv="$undef"
10363          ;;
10364 esac
10365
10366 $rm -f try.* try
10367
10368 case "$d_nv_preserves_uv" in
10369 "$define") d_nv_preserves_uv_bits=`expr $uvsize \* 8` ;;
10370 *)      $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
10371         $cat <<EOP >try.c
10372 #include <stdio.h>
10373 int main() {
10374     $uvtype u = 0;
10375     int     n = 8 * $uvsize;
10376     int     i;
10377     for (i = 0; i < n; i++) {
10378       u = u << 1 | ($uvtype)1;
10379       if (($uvtype)($nvtype)u != u)
10380         break;
10381     }
10382     printf("%d\n", i);
10383     exit(0);
10384 }
10385 EOP
10386         set try
10387         if eval $compile; then
10388                 d_nv_preserves_uv_bits="`./try$exe_ext`"
10389         fi
10390         case "$d_nv_preserves_uv_bits" in
10391         [1-9]*) $echo "Your NVs can preserve $d_nv_preserves_uv_bits bits of your UVs."  2>&1 ;;
10392         *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
10393                 d_nv_preserves_uv_bits="$undef"
10394                 ;;
10395         esac
10396         $rm -f try.* try
10397         ;;
10398 esac
10399
10400
10401
10402 : check for off64_t
10403 echo " "
10404 echo "Checking to see if you have off64_t..." >&4
10405 $cat >try.c <<EOCP
10406 #include <sys/types.h>
10407 #include <unistd.h>
10408 int main() { off64_t x = 7; }
10409 EOCP
10410 set try
10411 if eval $compile; then
10412         val="$define"
10413         echo "You have off64_t."
10414 else
10415         val="$undef"
10416         echo "You do not have off64_t."
10417         case "$lseeksize" in
10418         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
10419         esac
10420 fi
10421 $rm -f try.* try
10422 set d_off64_t
10423 eval $setvar
10424
10425 : see if POSIX threads are available
10426 set pthread.h i_pthread
10427 eval $inhdr
10428
10429
10430
10431
10432 : how to create joinable pthreads
10433 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
10434         echo " "
10435         echo "Checking what constant to use for creating joinable pthreads..." >&4 
10436         $cat >try.c <<'EOCP'
10437 #include <pthread.h>
10438 int main() {
10439     int detachstate = JOINABLE;
10440 }
10441 EOCP
10442         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
10443         if eval $compile; then
10444                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
10445                 val="$undef" # Yes, undef.
10446                 set d_old_pthread_create_joinable
10447                 eval $setvar
10448                 val=""
10449                 set old_pthread_create_joinable
10450                 eval $setvar
10451         else
10452                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
10453                 if eval $compile; then
10454                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
10455                         val="$define"
10456                         set d_old_pthread_create_joinable
10457                         eval $setvar
10458                         val=PTHREAD_CREATE_UNDETACHED
10459                         set old_pthread_create_joinable
10460                         eval $setvar
10461                 else            
10462                         set try -DJOINABLE=__UNDETACHED
10463                         if eval $compile; then
10464                                 echo "You seem to use __UNDETACHED." >&4
10465                                 val="$define"
10466                                 set d_old_pthread_create_joinable
10467                                 eval $setvar
10468                                 val=__UNDETACHED
10469                                 set old_pthread_create_joinable
10470                                 eval $setvar
10471                         else
10472                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
10473                                 val="$define"
10474                                 set d_old_pthread_create_joinable
10475                                 eval $setvar
10476                                 val=0
10477                                 set old_pthread_create_joinable
10478                                 eval $setvar
10479                         fi
10480                 fi
10481         fi
10482         $rm -f try try.*
10483 else
10484     d_old_pthread_create_joinable="$undef"
10485     old_pthread_create_joinable=""
10486 fi
10487
10488 : see if pause exists
10489 set pause d_pause
10490 eval $inlibc
10491
10492 : see if pipe exists
10493 set pipe d_pipe
10494 eval $inlibc
10495
10496 : see if poll exists
10497 set poll d_poll
10498 eval $inlibc
10499
10500
10501 : see whether the various POSIXish _yields exist
10502 $cat >try.c <<EOP
10503 #include <pthread.h>
10504 #include <stdio.h>
10505 int main() {
10506 #ifdef SCHED_YIELD
10507         sched_yield();
10508 #else
10509 #ifdef PTHREAD_YIELD
10510         pthread_yield();
10511 #else
10512 #ifdef PTHREAD_YIELD_NULL
10513         pthread_yield(NULL);
10514 #endif
10515 #endif
10516 #endif
10517 }
10518 EOP
10519 : see if sched_yield exists
10520 set try -DSCHED_YIELD
10521 if eval $compile; then
10522     val="$define"
10523     sched_yield='sched_yield()'
10524 else
10525     val="$undef"
10526 fi
10527 case "$usethreads" in
10528 $define)
10529         case "$val" in
10530         $define) echo 'sched_yield() found.' >&4        ;;
10531         *)       echo 'sched_yield() NOT found.' >&4    ;;
10532         esac
10533 esac
10534 set d_sched_yield
10535 eval $setvar
10536
10537 : see if pthread_yield exists
10538 set try -DPTHREAD_YIELD
10539 if eval $compile; then
10540     val="$define"
10541     case "$sched_yield" in
10542     '') sched_yield='pthread_yield()' ;;
10543     esac
10544 else
10545     set try -DPTHREAD_YIELD_NULL
10546     if eval $compile; then
10547         val="$define"
10548         case "$sched_yield" in
10549         '') sched_yield='pthread_yield(NULL)' ;;
10550         esac
10551     else
10552         val="$undef"
10553     fi
10554 fi
10555 case "$usethreads" in
10556 $define)
10557         case "$val" in
10558         $define) echo 'pthread_yield() found.' >&4      ;;
10559         *)       echo 'pthread_yield() NOT found.' >&4  ;;
10560         esac
10561         ;;
10562 esac
10563 set d_pthread_yield
10564 eval $setvar
10565
10566 case "$sched_yield" in
10567 '') sched_yield=undef ;;
10568 esac
10569
10570 $rm -f try try.*
10571
10572 : see if this is a pwd.h system
10573 set pwd.h i_pwd
10574 eval $inhdr
10575
10576 case "$i_pwd" in
10577 $define)
10578         xxx=`./findhdr pwd.h`
10579         $cppstdin $cppflags $cppminus < $xxx >$$.h
10580
10581         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
10582                 val="$define"
10583         else
10584                 val="$undef"
10585         fi
10586         set d_pwquota
10587         eval $setvar
10588
10589         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
10590                 val="$define"
10591         else
10592                 val="$undef"
10593         fi
10594         set d_pwage
10595         eval $setvar
10596
10597         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
10598                 val="$define"
10599         else
10600                 val="$undef"
10601         fi
10602         set d_pwchange
10603         eval $setvar
10604
10605         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
10606                 val="$define"
10607         else
10608                 val="$undef"
10609         fi
10610         set d_pwclass
10611         eval $setvar
10612
10613         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
10614                 val="$define"
10615         else
10616                 val="$undef"
10617         fi
10618         set d_pwexpire
10619         eval $setvar
10620
10621         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
10622                 val="$define"
10623         else
10624                 val="$undef"
10625         fi
10626         set d_pwcomment
10627         eval $setvar
10628
10629         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
10630                 val="$define"
10631         else
10632                 val="$undef"
10633         fi
10634         set d_pwgecos
10635         eval $setvar
10636
10637         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
10638                 val="$define"
10639         else
10640                 val="$undef"
10641         fi
10642         set d_pwpasswd
10643         eval $setvar
10644
10645         $rm -f $$.h
10646         ;;
10647 *)
10648         val="$undef"; 
10649         set d_pwquota; eval $setvar
10650         set d_pwage; eval $setvar
10651         set d_pwchange; eval $setvar
10652         set d_pwclass; eval $setvar
10653         set d_pwexpire; eval $setvar
10654         set d_pwcomment; eval $setvar
10655         set d_pwgecos; eval $setvar
10656         set d_pwpasswd; eval $setvar
10657         ;;
10658 esac
10659
10660 : see if readdir and friends exist
10661 set readdir d_readdir
10662 eval $inlibc
10663 set seekdir d_seekdir
10664 eval $inlibc
10665 set telldir d_telldir
10666 eval $inlibc
10667 set rewinddir d_rewinddir
10668 eval $inlibc
10669
10670 : see if readlink exists
10671 set readlink d_readlink
10672 eval $inlibc
10673
10674 : see if rename exists
10675 set rename d_rename
10676 eval $inlibc
10677
10678 : see if rmdir exists
10679 set rmdir d_rmdir
10680 eval $inlibc
10681
10682 : see if memory.h is available.
10683 val=''
10684 set memory.h val
10685 eval $inhdr
10686
10687 : See if it conflicts with string.h
10688 case "$val" in
10689 $define)
10690         case "$strings" in
10691         '') ;;
10692         *)
10693                 $cppstdin $cppflags $cppminus < $strings > mem.h
10694                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
10695                         echo " "
10696                         echo "We won't be including <memory.h>."
10697                         val="$undef"
10698                 fi
10699                 $rm -f mem.h
10700                 ;;
10701         esac
10702 esac
10703 set i_memory
10704 eval $setvar
10705
10706 : can bcopy handle overlapping blocks?
10707 val="$undef"
10708 case "$d_bcopy" in
10709 "$define")
10710         echo " "
10711         echo "Checking to see if your bcopy() can do overlapping copies..." >&4
10712         $cat >try.c <<EOCP
10713 #$i_memory I_MEMORY
10714 #$i_stdlib I_STDLIB
10715 #$i_string I_STRING
10716 #$i_unistd I_UNISTD
10717 EOCP
10718         $cat >>try.c <<'EOCP'
10719 #include <stdio.h>
10720 #ifdef I_MEMORY
10721 #  include <memory.h>
10722 #endif
10723 #ifdef I_STDLIB
10724 #  include <stdlib.h>
10725 #endif
10726 #ifdef I_STRING
10727 #  include <string.h>
10728 #else
10729 #  include <strings.h>
10730 #endif
10731 #ifdef I_UNISTD
10732 #  include <unistd.h>  /* Needed for NetBSD */
10733 #endif
10734 int main()
10735 {
10736 char buf[128], abc[128];
10737 char *b;
10738 int len;
10739 int off;
10740 int align;
10741
10742 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
10743
10744 for (align = 7; align >= 0; align--) {
10745         for (len = 36; len; len--) {
10746                 b = buf+align;
10747                 bcopy(abc, b, len);
10748                 for (off = 1; off <= len; off++) {
10749                         bcopy(b, b+off, len);
10750                         bcopy(b+off, b, len);
10751                         if (bcmp(b, abc, len))
10752                                 exit(1);
10753                 }
10754         }
10755 }
10756 exit(0);
10757 }
10758 EOCP
10759         set try
10760         if eval $compile_ok; then
10761                 if ./try 2>/dev/null; then
10762                         echo "Yes, it can."
10763                         val="$define"
10764                 else
10765                         echo "It can't, sorry."
10766                         case "$d_memmove" in
10767                         "$define") echo "But that's Ok since you have memmove()." ;;
10768                         esac
10769                 fi
10770         else
10771                 echo "(I can't compile the test program, so we'll assume not...)"
10772                 case "$d_memmove" in
10773                 "$define") echo "But that's Ok since you have memmove()." ;;
10774                 esac
10775         fi
10776         ;;
10777 esac
10778 $rm -f try.* try core
10779 set d_safebcpy
10780 eval $setvar
10781
10782 : can memcpy handle overlapping blocks?
10783 val="$undef"
10784 case "$d_memcpy" in
10785 "$define")
10786         echo " "
10787         echo "Checking to see if your memcpy() can do overlapping copies..." >&4
10788         $cat >try.c <<EOCP
10789 #$i_memory I_MEMORY
10790 #$i_stdlib I_STDLIB
10791 #$i_string I_STRING
10792 #$i_unistd I_UNISTD
10793 EOCP
10794         $cat >>try.c <<'EOCP'
10795 #include <stdio.h>
10796 #ifdef I_MEMORY
10797 #  include <memory.h>
10798 #endif
10799 #ifdef I_STDLIB
10800 #  include <stdlib.h>
10801 #endif
10802 #ifdef I_STRING
10803 #  include <string.h>
10804 #else
10805 #  include <strings.h>
10806 #endif
10807 #ifdef I_UNISTD
10808 #  include <unistd.h>  /* Needed for NetBSD */
10809 #endif
10810 int main()
10811 {
10812 char buf[128], abc[128];
10813 char *b;
10814 int len;
10815 int off;
10816 int align;
10817
10818 /* Copy "abcde..." string to char abc[] so that gcc doesn't
10819    try to store the string in read-only memory. */
10820 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
10821
10822 for (align = 7; align >= 0; align--) {
10823         for (len = 36; len; len--) {
10824                 b = buf+align;
10825                 memcpy(b, abc, len);
10826                 for (off = 1; off <= len; off++) {
10827                         memcpy(b+off, b, len);
10828                         memcpy(b, b+off, len);
10829                         if (memcmp(b, abc, len))
10830                                 exit(1);
10831                 }
10832         }
10833 }
10834 exit(0);
10835 }
10836 EOCP
10837         set try
10838         if eval $compile_ok; then
10839                 if ./try 2>/dev/null; then
10840                         echo "Yes, it can."
10841                         val="$define"
10842                 else
10843                         echo "It can't, sorry."
10844                         case "$d_memmove" in
10845                         "$define") echo "But that's Ok since you have memmove()." ;;
10846                         esac
10847                 fi
10848         else
10849                 echo "(I can't compile the test program, so we'll assume not...)"
10850                 case "$d_memmove" in
10851                 "$define") echo "But that's Ok since you have memmove()." ;;
10852                 esac
10853         fi
10854         ;;
10855 esac
10856 $rm -f try.* try core
10857 set d_safemcpy
10858 eval $setvar
10859
10860 : can memcmp be trusted to compare relative magnitude?
10861 val="$undef"
10862 case "$d_memcmp" in
10863 "$define")
10864         echo " "
10865         echo "Checking if your memcmp() can compare relative magnitude..." >&4
10866         $cat >try.c <<EOCP
10867 #$i_memory I_MEMORY
10868 #$i_stdlib I_STDLIB
10869 #$i_string I_STRING
10870 #$i_unistd I_UNISTD
10871 EOCP
10872         $cat >>try.c <<'EOCP'
10873 #include <stdio.h>
10874 #ifdef I_MEMORY
10875 #  include <memory.h>
10876 #endif
10877 #ifdef I_STDLIB
10878 #  include <stdlib.h>
10879 #endif
10880 #ifdef I_STRING
10881 #  include <string.h>
10882 #else
10883 #  include <strings.h>
10884 #endif
10885 #ifdef I_UNISTD
10886 #  include <unistd.h>  /* Needed for NetBSD */
10887 #endif
10888 int main()
10889 {
10890 char a = -1;
10891 char b = 0;
10892 if ((a < b) && memcmp(&a, &b, 1) < 0)
10893         exit(1);
10894 exit(0);
10895 }
10896 EOCP
10897         set try
10898         if eval $compile_ok; then
10899                 if ./try 2>/dev/null; then
10900                         echo "Yes, it can."
10901                         val="$define"
10902                 else
10903                         echo "No, it can't (it uses signed chars)."
10904                 fi
10905         else
10906                 echo "(I can't compile the test program, so we'll assume not...)"
10907         fi
10908         ;;
10909 esac
10910 $rm -f try.* try core
10911 set d_sanemcmp
10912 eval $setvar
10913
10914 : see if select exists
10915 set select d_select
10916 eval $inlibc
10917
10918 : see if semctl exists
10919 set semctl d_semctl
10920 eval $inlibc
10921
10922 : see if semget exists
10923 set semget d_semget
10924 eval $inlibc
10925
10926 : see if semop exists
10927 set semop d_semop
10928 eval $inlibc
10929
10930 : see how much of the 'sem*(2)' library is present.
10931 h_sem=true
10932 echo " "
10933 case "$d_semctl$d_semget$d_semop" in
10934 *"$undef"*) h_sem=false;;
10935 esac
10936 case "$osname" in
10937 freebsd)
10938     case "`ipcs 2>&1`" in
10939     "SVID messages"*"not configured"*)
10940         echo "Your $osname does not have the sem*(2) configured." >&4
10941         h_sem=false
10942         val="$undef"
10943         set semctl d_semctl
10944         eval $setvar
10945         set semget d_semget
10946         eval $setvar
10947         set semop d_semop
10948         eval $setvar
10949         ;;
10950     esac
10951     ;;
10952 esac
10953 : we could also check for sys/ipc.h ...
10954 if $h_sem && $test `./findhdr sys/sem.h`; then
10955         echo "You have the full sem*(2) library." >&4
10956         val="$define"
10957 else
10958         echo "You don't have the full sem*(2) library." >&4
10959         val="$undef"
10960 fi
10961 set d_sem
10962 eval $setvar
10963
10964 : see whether sys/sem.h defines union semun
10965 echo " "
10966 $cat > try.c <<'END'
10967 #include <sys/types.h>
10968 #include <sys/ipc.h>
10969 #include <sys/sem.h>
10970 int main () { union semun semun; semun.buf = 0; }
10971 END
10972 set try
10973 if eval $compile; then
10974     echo "You have union semun in <sys/sem.h>." >&4
10975     val="$define"
10976 else
10977     echo "You do not have union semun in <sys/sem.h>." >&4
10978     val="$undef"
10979 fi
10980 $rm -f try try.c try.h
10981 set d_union_semun
10982 eval $setvar
10983
10984 : see how to do semctl IPC_STAT
10985 case "$d_sem" in
10986 $define)
10987     : see whether semctl IPC_STAT can use union semun
10988     echo " "
10989     $cat > try.h <<END
10990 #ifndef S_IRUSR
10991 #   ifdef S_IREAD
10992 #       define S_IRUSR S_IREAD
10993 #       define S_IWUSR S_IWRITE
10994 #       define S_IXUSR S_IEXEC
10995 #   else
10996 #       define S_IRUSR 0400
10997 #       define S_IWUSR 0200
10998 #       define S_IXUSR 0100
10999 #   endif
11000 #   define S_IRGRP (S_IRUSR>>3)
11001 #   define S_IWGRP (S_IWUSR>>3)
11002 #   define S_IXGRP (S_IXUSR>>3)
11003 #   define S_IROTH (S_IRUSR>>6)
11004 #   define S_IWOTH (S_IWUSR>>6)
11005 #   define S_IXOTH (S_IXUSR>>6)
11006 #endif
11007 #ifndef S_IRWXU
11008 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
11009 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
11010 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
11011 #endif
11012 END
11013
11014     $cat > try.c <<END
11015 #include <sys/types.h>
11016 #include <sys/ipc.h>
11017 #include <sys/sem.h>
11018 #include <sys/stat.h>
11019 #include <stdio.h>
11020 #include <errno.h>
11021 #include "try.h"
11022 #ifndef errno
11023 extern int errno;
11024 #endif
11025 #$d_union_semun HAS_UNION_SEMUN
11026 int main() {
11027     union semun
11028 #ifndef HAS_UNION_SEMUN
11029     {
11030         int val;
11031         struct semid_ds *buf;
11032         unsigned short *array;
11033     }
11034 #endif
11035     arg;
11036     int sem, st;
11037
11038 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
11039     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
11040     if (sem > -1) {
11041         struct semid_ds argbuf;
11042         arg.buf = &argbuf;
11043 #       ifdef IPC_STAT
11044         st = semctl(sem, 0, IPC_STAT, arg);
11045         if (st == 0)
11046             printf("semun\n");
11047         else
11048 #       endif /* IPC_STAT */
11049             printf("semctl IPC_STAT failed: errno = %d\n", errno);
11050 #       ifdef IPC_RMID
11051         if (semctl(sem, 0, IPC_RMID, arg) != 0)
11052 #       endif /* IPC_RMID */
11053             printf("semctl IPC_RMID failed: errno = %d\n", errno);
11054     } else
11055 #endif /* IPC_PRIVATE && ... */
11056         printf("semget failed: errno = %d\n", errno);
11057   return 0;
11058 }
11059 END
11060     val="$undef"
11061     set try
11062     if eval $compile; then
11063         xxx=`./try`
11064         case "$xxx" in
11065         semun) val="$define" ;;
11066         esac
11067     fi
11068     $rm -f try try.c
11069     set d_semctl_semun
11070     eval $setvar
11071     case "$d_semctl_semun" in
11072     $define)
11073         echo "You can use union semun for semctl IPC_STAT." >&4
11074         also='also'
11075         ;;
11076     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
11077         also=''
11078         ;;
11079     esac
11080
11081     : see whether semctl IPC_STAT can use struct semid_ds pointer
11082     $cat > try.c <<'END'
11083 #include <sys/types.h>
11084 #include <sys/ipc.h>
11085 #include <sys/sem.h>
11086 #include <sys/stat.h>
11087 #include "try.h"
11088 #include <stdio.h>
11089 #include <errno.h>
11090 #ifndef errno
11091 extern int errno;
11092 #endif
11093 int main() {
11094     struct semid_ds arg;
11095     int sem, st;
11096
11097 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
11098     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
11099     if (sem > -1) {
11100 #       ifdef IPC_STAT
11101         st = semctl(sem, 0, IPC_STAT, &arg);
11102         if (st == 0)
11103             printf("semid_ds\n");
11104         else
11105 #       endif /* IPC_STAT */
11106             printf("semctl IPC_STAT failed: errno = %d\n", errno);
11107 #       ifdef IPC_RMID
11108         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
11109 #       endif /* IPC_RMID */
11110             printf("semctl IPC_RMID failed: errno = %d\n", errno);
11111     } else
11112 #endif /* IPC_PRIVATE && ... */
11113         printf("semget failed: errno = %d\n", errno);
11114
11115     return 0;
11116 }
11117 END
11118     val="$undef"
11119     set try
11120     if eval $compile; then
11121         xxx=`./try`
11122         case "$xxx" in
11123         semid_ds) val="$define" ;;
11124         esac
11125     fi
11126     $rm -f try try.c
11127     set d_semctl_semid_ds
11128     eval $setvar
11129     case "$d_semctl_semid_ds" in
11130     $define)
11131         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
11132         ;;
11133     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
11134         ;;
11135     esac
11136     $rm -f try.h
11137     ;;
11138 *)  val="$undef"
11139
11140     # We do not have the full sem*(2) library, so assume we can not
11141     # use either.
11142
11143     set d_semctl_semun
11144     eval $setvar
11145
11146     set d_semctl_semid_ds
11147     eval $setvar
11148     ;;
11149 esac
11150
11151 : see if setegid exists
11152 set setegid d_setegid
11153 eval $inlibc
11154
11155 : see if seteuid exists
11156 set seteuid d_seteuid
11157 eval $inlibc
11158
11159 : see if setgrent exists
11160 set setgrent d_setgrent
11161 eval $inlibc
11162
11163 : see if sethostent exists
11164 set sethostent d_sethent
11165 eval $inlibc
11166
11167 : see if setlinebuf exists
11168 set setlinebuf d_setlinebuf
11169 eval $inlibc
11170
11171 : see if setlocale exists
11172 set setlocale d_setlocale
11173 eval $inlibc
11174
11175 : see if setnetent exists
11176 set setnetent d_setnent
11177 eval $inlibc
11178
11179 : see if setprotoent exists
11180 set setprotoent d_setpent
11181 eval $inlibc
11182
11183 : see if setpgid exists
11184 set setpgid d_setpgid
11185 eval $inlibc
11186
11187 : see if setpgrp2 exists
11188 set setpgrp2 d_setpgrp2
11189 eval $inlibc
11190
11191 : see if setpriority exists
11192 set setpriority d_setprior
11193 eval $inlibc
11194
11195 : see if setproctitle exists
11196 set setproctitle d_setproctitle
11197 eval $inlibc
11198
11199 : see if setpwent exists
11200 set setpwent d_setpwent
11201 eval $inlibc
11202
11203 : see if setregid exists
11204 set setregid d_setregid
11205 eval $inlibc
11206 set setresgid d_setresgid
11207 eval $inlibc
11208
11209 : see if setreuid exists
11210 set setreuid d_setreuid
11211 eval $inlibc
11212 set setresuid d_setresuid
11213 eval $inlibc
11214
11215 : see if setrgid exists
11216 set setrgid d_setrgid
11217 eval $inlibc
11218
11219 : see if setruid exists
11220 set setruid d_setruid
11221 eval $inlibc
11222
11223 : see if setservent exists
11224 set setservent d_setsent
11225 eval $inlibc
11226
11227 : see if setsid exists
11228 set setsid d_setsid
11229 eval $inlibc
11230
11231 : see if setvbuf exists
11232 set setvbuf d_setvbuf
11233 eval $inlibc
11234
11235 : see if sfio.h is available
11236 set sfio.h i_sfio
11237 eval $inhdr
11238
11239
11240 : see if sfio library is available
11241 case "$i_sfio" in
11242 $define)
11243         val=''
11244         set sfreserve val
11245         eval $inlibc
11246         ;;
11247 *)
11248         val="$undef"
11249         ;;
11250 esac
11251 : Ok, but do we want to use it.
11252 case "$val" in
11253 $define)
11254         case "$usesfio" in
11255         true|$define|[yY]*) dflt='y';;
11256         *) dflt='n';;
11257         esac
11258         echo "$package can use the sfio library, but it is experimental."
11259         case "$useperlio" in
11260         "$undef")
11261             echo "For sfio also the PerlIO abstraction layer is needed."
11262             echo "Earlier you said you wouldn't want that."
11263             ;;
11264         esac
11265         rp="You seem to have sfio available, do you want to try using it?"
11266         . ./myread
11267         case "$ans" in
11268         y|Y)    echo "Ok, turning on both sfio and PerlIO, then."
11269                 useperlio="$define"
11270                 val="$define"
11271                 ;;
11272         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
11273                 val="$undef"
11274                 : Remove sfio from list of libraries to use
11275                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
11276                 shift
11277                 libs="$*"
11278                 echo "libs = $libs" >&4
11279                 ;;
11280         esac
11281         ;;
11282 *)      case "$usesfio" in
11283         true|$define|[yY]*)
11284                 echo "Sorry, cannot find sfio on this machine." >&4
11285                 echo "Ignoring your setting of usesfio=$usesfio." >&4
11286                 val="$undef"
11287                 ;;
11288         esac
11289         ;;
11290 esac
11291 set d_sfio
11292 eval $setvar
11293 case "$d_sfio" in
11294 $define) usesfio='true';;
11295 *) usesfio='false';;
11296 esac
11297
11298 : see if shmctl exists
11299 set shmctl d_shmctl
11300 eval $inlibc
11301
11302 : see if shmget exists
11303 set shmget d_shmget
11304 eval $inlibc
11305
11306 : see if shmat exists
11307 set shmat d_shmat
11308 eval $inlibc
11309 : see what shmat returns
11310 case "$d_shmat" in
11311 "$define")
11312         $cat >shmat.c <<'END'
11313 #include <sys/shm.h>
11314 void *shmat();
11315 END
11316         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
11317                 shmattype='void *'
11318         else
11319                 shmattype='char *'
11320         fi
11321         echo "and it returns ($shmattype)." >&4
11322         : see if a prototype for shmat is available
11323         xxx=`./findhdr sys/shm.h`
11324         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
11325         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
11326                 val="$define"
11327         else
11328                 val="$undef"
11329         fi
11330         $rm -f shmat.[co]
11331         ;;
11332 *)
11333         val="$undef"
11334         ;;
11335 esac
11336 set d_shmatprototype
11337 eval $setvar
11338
11339 : see if shmdt exists
11340 set shmdt d_shmdt
11341 eval $inlibc
11342
11343 : see how much of the 'shm*(2)' library is present.
11344 h_shm=true
11345 echo " "
11346 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
11347 *"$undef"*) h_shm=false;;
11348 esac
11349 case "$osname" in
11350 freebsd)
11351     case "`ipcs 2>&1`" in
11352     "SVID shared memory"*"not configured"*)
11353         echo "Your $osname does not have the shm*(2) configured." >&4
11354         h_shm=false
11355         val="$undef"
11356         set shmctl d_shmctl
11357         evat $setvar
11358         set shmget d_shmget
11359         evat $setvar
11360         set shmat d_shmat
11361         evat $setvar
11362         set shmdt d_shmdt
11363         evat $setvar
11364         ;;
11365     esac
11366     ;;
11367 esac
11368 : we could also check for sys/ipc.h ...
11369 if $h_shm && $test `./findhdr sys/shm.h`; then
11370         echo "You have the full shm*(2) library." >&4
11371         val="$define"
11372 else
11373         echo "You don't have the full shm*(2) library." >&4
11374         val="$undef"
11375 fi
11376 set d_shm
11377 eval $setvar
11378
11379 echo " "
11380 : see if we have sigaction
11381 if set sigaction val -f d_sigaction; eval $csym; $val; then
11382         echo 'sigaction() found.' >&4
11383         $cat > try.c <<'EOP'
11384 #include <stdio.h>
11385 #include <sys/types.h>
11386 #include <signal.h>
11387 int main()
11388 {
11389     struct sigaction act, oact;
11390     act.sa_flags = 0;
11391     oact.sa_handler = 0;
11392     /* so that act and oact are used */
11393     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
11394 }
11395 EOP
11396         set try
11397         if eval $compile_ok; then
11398                 val="$define"
11399         else
11400                 echo "But you don't seem to have a useable struct sigaction." >&4
11401                 val="$undef"
11402         fi
11403 else
11404         echo 'sigaction NOT found.' >&4
11405         val="$undef"
11406 fi
11407 set d_sigaction; eval $setvar
11408 $rm -f try try$_o try.c
11409
11410 : see if sigsetjmp exists
11411 echo " "
11412 case "$d_sigsetjmp" in
11413 '')
11414         $cat >try.c <<'EOP'
11415 #include <setjmp.h>
11416 sigjmp_buf env;
11417 int set = 1;
11418 int main()
11419 {
11420         if (sigsetjmp(env,1))
11421                 exit(set);
11422         set = 0;
11423         siglongjmp(env, 1);
11424         exit(1);
11425 }
11426 EOP
11427         set try
11428         if eval $compile; then
11429                 if ./try >/dev/null 2>&1; then
11430                         echo "POSIX sigsetjmp found." >&4
11431                         val="$define"
11432                 else
11433                         $cat >&4 <<EOM
11434 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
11435 I'll ignore them.
11436 EOM
11437                         val="$undef"
11438                 fi
11439         else
11440                 echo "sigsetjmp not found." >&4
11441                 val="$undef"
11442         fi
11443         ;;
11444 *) val="$d_sigsetjmp"
11445         case "$d_sigsetjmp" in
11446         $define) echo "POSIX sigsetjmp found." >&4;;
11447         $undef) echo "sigsetjmp not found." >&4;;
11448         esac
11449         ;;
11450 esac
11451 set d_sigsetjmp
11452 eval $setvar
11453 $rm -f try.c try
11454
11455 : see if socks5_init exists
11456 set socks5_init d_socks5_init
11457 eval $inlibc
11458
11459 : see if sys/stat.h is available
11460 set sys/stat.h i_sysstat
11461 eval $inhdr
11462
11463
11464 : see if stat knows about block sizes
11465 echo " "
11466 echo "Checking to see if your struct stat has st_blocks field..." >&4
11467 set d_statblks stat st_blocks $i_sysstat sys/stat.h
11468 eval $hasfield
11469
11470
11471 : see if this is a sys/vfs.h system
11472 set sys/vfs.h i_sysvfs
11473 eval $inhdr
11474
11475
11476 : see if this is a sys/statfs.h system
11477 set sys/statfs.h i_sysstatfs
11478 eval $inhdr
11479
11480
11481 echo " "
11482 echo "Checking to see if your system supports struct statfs..." >&4
11483 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
11484 eval $hasstruct
11485 case "$d_statfs_s" in
11486 "$define")      echo "Yes, it does."   ;;
11487 *)              echo "No, it doesn't." ;;
11488 esac
11489
11490
11491
11492 : see if struct statfs knows about f_flags
11493 case "$d_statfs_s" in
11494 define) 
11495         echo " "
11496         echo "Checking to see if your struct statfs has f_flags field..." >&4
11497         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
11498         eval $hasfield
11499         ;;
11500 *)      val="$undef"
11501         set d_statfs_f_flags
11502         eval $setvar
11503         ;;
11504 esac
11505 case "$d_statfs_f_flags" in
11506 "$define")      echo "Yes, it does."   ;;
11507 *)              echo "No, it doesn't." ;;
11508 esac
11509
11510 : see if _ptr and _cnt from stdio act std
11511 echo " "
11512 if $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
11513         echo "(Looks like you have stdio.h from Linux.)"
11514         case "$stdio_ptr" in
11515         '') stdio_ptr='((fp)->_IO_read_ptr)'
11516                 ptr_lval=$define
11517                 ;;
11518         *)      ptr_lval=$d_stdio_ptr_lval;;
11519         esac
11520         case "$stdio_cnt" in
11521         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
11522                 cnt_lval=$undef
11523                 ;;
11524         *)      cnt_lval=$d_stdio_cnt_lval;;
11525         esac
11526         case "$stdio_base" in
11527         '') stdio_base='((fp)->_IO_read_base)';;
11528         esac
11529         case "$stdio_bufsiz" in
11530         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
11531         esac
11532 else
11533         case "$stdio_ptr" in
11534         '') stdio_ptr='((fp)->_ptr)'
11535                 ptr_lval=$define
11536                 ;;
11537         *)      ptr_lval=$d_stdio_ptr_lval;;
11538         esac
11539         case "$stdio_cnt" in
11540         '') stdio_cnt='((fp)->_cnt)'
11541                 cnt_lval=$define
11542                 ;;
11543         *)      cnt_lval=$d_stdio_cnt_lval;;
11544         esac
11545         case "$stdio_base" in
11546         '') stdio_base='((fp)->_base)';;
11547         esac
11548         case "$stdio_bufsiz" in
11549         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
11550         esac
11551 fi
11552 : test whether _ptr and _cnt really work
11553 echo "Checking how std your stdio is..." >&4
11554 $cat >try.c <<EOP
11555 #include <stdio.h>
11556 #define FILE_ptr(fp)    $stdio_ptr
11557 #define FILE_cnt(fp)    $stdio_cnt
11558 int main() {
11559         FILE *fp = fopen("try.c", "r");
11560         char c = getc(fp);
11561         if (
11562                 18 <= FILE_cnt(fp) &&
11563                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
11564         )
11565                 exit(0);
11566         exit(1);
11567 }
11568 EOP
11569 val="$undef"
11570 set try
11571 if eval $compile; then
11572         if ./try; then
11573                 echo "Your stdio acts pretty std."
11574                 val="$define"
11575         else
11576                 echo "Your stdio isn't very std."
11577         fi
11578 else
11579         echo "Your stdio doesn't appear very std."
11580 fi
11581 $rm -f try.c try
11582 set d_stdstdio
11583 eval $setvar
11584
11585 : Can _ptr be used as an lvalue?
11586 case "$d_stdstdio$ptr_lval" in
11587 $define$define) val=$define ;;
11588 *) val=$undef ;;
11589 esac
11590 set d_stdio_ptr_lval
11591 eval $setvar
11592
11593 : Can _cnt be used as an lvalue?
11594 case "$d_stdstdio$cnt_lval" in
11595 $define$define) val=$define ;;
11596 *) val=$undef ;;
11597 esac
11598 set d_stdio_cnt_lval
11599 eval $setvar
11600
11601 : see if _base is also standard
11602 val="$undef"
11603 case "$d_stdstdio" in
11604 $define)
11605         $cat >try.c <<EOP
11606 #include <stdio.h>
11607 #define FILE_base(fp)   $stdio_base
11608 #define FILE_bufsiz(fp) $stdio_bufsiz
11609 int main() {
11610         FILE *fp = fopen("try.c", "r");
11611         char c = getc(fp);
11612         if (
11613                 19 <= FILE_bufsiz(fp) &&
11614                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
11615         )
11616                 exit(0);
11617         exit(1);
11618 }
11619 EOP
11620         set try
11621         if eval $compile; then
11622                 if ./try; then
11623                         echo "And its _base field acts std."
11624                         val="$define"
11625                 else
11626                         echo "But its _base field isn't std."
11627                 fi
11628         else
11629                 echo "However, it seems to be lacking the _base field."
11630         fi
11631         $rm -f try.c try
11632         ;;
11633 esac
11634 set d_stdiobase
11635 eval $setvar
11636
11637 $cat >&4 <<EOM
11638 Checking how to access stdio streams by file descriptor number...
11639 EOM
11640 case "$stdio_stream_array" in
11641 '')     $cat >try.c <<EOCP
11642 #include <stdio.h>
11643 int main() {
11644   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
11645     printf("yes\n");
11646 }
11647 EOCP
11648         for s in _iob __iob __sF
11649         do
11650                 set try -DSTDIO_STREAM_ARRAY=$s
11651                 if eval $compile; then
11652                         case "`./try$exe_ext`" in
11653                         yes)    stdio_stream_array=$s; break ;;
11654                         esac
11655                 fi
11656         done
11657         $rm -f try.* try$exe_ext
11658 esac
11659 case "$stdio_stream_array" in
11660 '')     $cat >&4 <<EOM
11661 I can't figure out how to access stdio streams by file descriptor number.
11662 EOM
11663         d_stdio_stream_array="$undef"
11664         ;;
11665 *)      $cat >&4 <<EOM
11666 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
11667 EOM
11668         d_stdio_stream_array="$define"
11669         ;;
11670 esac
11671
11672 : see if strcoll exists
11673 set strcoll d_strcoll
11674 eval $inlibc
11675
11676 : check for structure copying
11677 echo " "
11678 echo "Checking to see if your C compiler can copy structs..." >&4
11679 $cat >try.c <<'EOCP'
11680 int main()
11681 {
11682         struct blurfl {
11683                 int dyick;
11684         } foo, bar;
11685
11686         foo = bar;
11687 }
11688 EOCP
11689 if $cc -c try.c >/dev/null 2>&1 ; then
11690         val="$define"
11691         echo "Yup, it can."
11692 else
11693         val="$undef"
11694         echo "Nope, it can't."
11695 fi
11696 set d_strctcpy
11697 eval $setvar
11698 $rm -f try.*
11699
11700 : see if strerror and/or sys_errlist[] exist
11701 echo " "
11702 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
11703     if set strerror val -f d_strerror; eval $csym; $val; then
11704                 echo 'strerror() found.' >&4
11705                 d_strerror="$define"
11706                 d_strerrm='strerror(e)'
11707                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
11708                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
11709                         d_syserrlst="$define"
11710                 else
11711                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
11712                         d_syserrlst="$undef"
11713                 fi
11714     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
11715                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
11716                 echo 'strerror() found in string header.' >&4
11717                 d_strerror="$define"
11718                 d_strerrm='strerror(e)'
11719                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
11720                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
11721                                 d_syserrlst="$define"
11722                 else
11723                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
11724                         d_syserrlst="$undef"
11725                 fi
11726     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
11727                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
11728                 d_strerror="$undef"
11729                 d_syserrlst="$define"
11730                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
11731     else
11732                 echo 'strerror() and sys_errlist[] NOT found.' >&4
11733                 d_strerror="$undef"
11734                 d_syserrlst="$undef"
11735                 d_strerrm='"unknown"'
11736     fi
11737 fi
11738
11739 : see if strtod exists
11740 set strtod d_strtod
11741 eval $inlibc
11742
11743 : see if strtol exists
11744 set strtol d_strtol
11745 eval $inlibc
11746
11747 : see if strtold exists
11748 set strtold d_strtold
11749 eval $inlibc
11750
11751 : see if strtoll exists
11752 set strtoll d_strtoll
11753 eval $inlibc
11754
11755 case "$d_longlong-$d_strtoll" in
11756 "$define-$define")
11757         $cat <<EOM
11758 Checking whether your strtoll() works okay...
11759 EOM
11760         $cat >try.c <<'EOCP'
11761 #include <errno.h>
11762 #ifdef __hpux
11763 #define strtoll __strtoll
11764 #endif
11765 #include <stdio.h>
11766 extern long long int strtoll(char *s, char **, int); 
11767 static int bad = 0;
11768 int check(char *s, long long ell, int een) {
11769         long long gll;
11770         errno = 0;
11771         gll = strtoll(s, 0, 10);
11772         if (!((gll == ell) && (errno == een)))
11773                 bad++;
11774 }
11775 int main() {
11776         check(" 1",                                      1LL, 0);
11777         check(" 0",                                      0LL, 0);
11778         check("-1",                                     -1LL, 0);
11779         check("-9223372036854775808", -9223372036854775808LL, 0);
11780         check("-9223372036854775808", -9223372036854775808LL, 0);
11781         check(" 9223372036854775807",  9223372036854775807LL, 0);
11782         check("-9223372036854775808", -9223372036854775808LL, 0);
11783         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
11784         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
11785         if (!bad)
11786                 printf("ok\n");
11787 }
11788 EOCP
11789         set try
11790         if eval $compile; then
11791                 case "`./try`" in
11792                 ok) echo "Your strtoll() seems to be working okay." ;;
11793                 *) cat <<EOM >&4
11794 Your strtoll() doesn't seem to be working okay.
11795 EOM
11796                    d_strtoll="$undef"
11797                    ;;
11798                 esac
11799         fi
11800         ;;
11801 esac
11802
11803 : see if strtoul exists
11804 set strtoul d_strtoul
11805 eval $inlibc
11806
11807 : see if strtoull exists
11808 set strtoull d_strtoull
11809 eval $inlibc
11810
11811 case "$d_longlong-$d_strtoull" in
11812 "$define-$define")
11813         $cat <<EOM
11814 Checking whether your strtoull() works okay...
11815 EOM
11816         $cat >try.c <<'EOCP'
11817 #include <errno.h>
11818 #ifdef __hpux
11819 #define strtoull __strtoull
11820 #endif
11821 #include <stdio.h>
11822 extern unsigned long long int strtoull(char *s, char **, int); 
11823 static int bad = 0;
11824 int check(char *s, long long eull, int een) {
11825         long long gull;
11826         errno = 0;
11827         gull = strtoull(s, 0, 10);
11828         if (!((gull == eull) && (errno == een)))
11829                 bad++;
11830 }
11831 int main() {
11832         check(" 1",                                       1LL, 0);
11833         check(" 0",                                       0LL, 0);
11834         check("18446744073709551615", 18446744073709551615ULL, 0);
11835         check("18446744073709551616", 18446744073709551615ULL, ERANGE);
11836         if (!bad)
11837                 printf("ok\n");
11838 }
11839 EOCP
11840         set try
11841         if eval $compile; then
11842                 case "`./try`" in
11843                 ok) echo "Your strtoull() seems to be working okay." ;;
11844                 *) cat <<EOM >&4
11845 Your strtoull() doesn't seem to be working okay.
11846 EOM
11847                    d_strtoull="$undef"
11848                    ;;
11849                 esac
11850         fi
11851         ;;
11852 esac
11853
11854 : see if strtouq exists
11855 set strtouq d_strtouq
11856 eval $inlibc
11857
11858 : see if strxfrm exists
11859 set strxfrm d_strxfrm
11860 eval $inlibc
11861
11862 : see if symlink exists
11863 set symlink d_symlink
11864 eval $inlibc
11865
11866 : see if syscall exists
11867 set syscall d_syscall
11868 eval $inlibc
11869
11870 : see if sysconf exists
11871 set sysconf d_sysconf
11872 eval $inlibc
11873
11874 : see if system exists
11875 set system d_system
11876 eval $inlibc
11877
11878 : see if tcgetpgrp exists
11879 set tcgetpgrp d_tcgetpgrp
11880 eval $inlibc
11881
11882 : see if tcsetpgrp exists
11883 set tcsetpgrp d_tcsetpgrp
11884 eval $inlibc
11885
11886 : see if prototype for telldir is available
11887 echo " "
11888 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
11889 eval $hasproto
11890
11891 : see if this is a sys/times.h system
11892 set sys/times.h i_systimes
11893 eval $inhdr
11894
11895 : see if times exists
11896 echo " "
11897 if set times val -f d_times; eval $csym; $val; then
11898         echo 'times() found.' >&4
11899         d_times="$define"
11900         inc=''
11901         case "$i_systimes" in
11902         "$define") inc='sys/times.h';;
11903         esac
11904         rp="What is the type returned by times() on this system?"
11905         set clock_t clocktype long stdio.h sys/types.h $inc
11906         eval $typedef_ask
11907 else
11908         echo 'times() NOT found, hope that will do.' >&4
11909         d_times="$undef"
11910         clocktype='int'
11911 fi
11912
11913 : see if truncate exists
11914 set truncate d_truncate
11915 eval $inlibc
11916
11917 : see if tzname[] exists
11918 echo " "
11919 if set tzname val -a d_tzname; eval $csym; $val; then
11920         val="$define"
11921         echo 'tzname[] found.' >&4
11922 else
11923         val="$undef"
11924         echo 'tzname[] NOT found.' >&4
11925 fi
11926 set d_tzname
11927 eval $setvar
11928
11929 : see if umask exists
11930 set umask d_umask
11931 eval $inlibc
11932
11933 : see if ustat exists
11934 set ustat d_ustat
11935 eval $inlibc
11936
11937 : backward compatibility for d_hvfork
11938 if test X$d_hvfork != X; then
11939         d_vfork="$d_hvfork"
11940         d_hvfork=''
11941 fi
11942 : see if there is a vfork
11943 val=''
11944 set vfork val
11945 eval $inlibc
11946
11947 : Ok, but do we want to use it. vfork is reportedly unreliable in 
11948 : perl on Solaris 2.x, and probably elsewhere.
11949 case "$val" in
11950 $define)
11951         echo " "
11952         case "$usevfork" in
11953         false) dflt='n';;
11954         *) dflt='y';;
11955         esac
11956         cat <<'EOM'
11957  
11958 Perl can only use a vfork() that doesn't suffer from strict
11959 restrictions on calling functions or modifying global data in
11960 the child.  For example, glibc-2.1 contains such a vfork()
11961 that is unsuitable.  If your system provides a proper fork()
11962 call, chances are that you do NOT want perl to use vfork().
11963
11964 EOM
11965         rp="Do you still want to use vfork()?"
11966         . ./myread
11967         case "$ans" in
11968         y|Y) ;;
11969         *)
11970                 echo "Ok, we won't use vfork()."
11971                 val="$undef"
11972                 ;;
11973         esac
11974         ;;
11975 esac
11976 set d_vfork
11977 eval $setvar
11978 case "$d_vfork" in
11979 $define) usevfork='true';;
11980 *) usevfork='false';;
11981 esac
11982
11983 : see if this is an sysdir system
11984 set sys/dir.h i_sysdir
11985 eval $inhdr
11986
11987 : see if this is an sysndir system
11988 set sys/ndir.h i_sysndir
11989 eval $inhdr
11990
11991 : see if closedir exists
11992 set closedir d_closedir
11993 eval $inlibc
11994
11995 case "$d_closedir" in
11996 "$define")
11997         echo " "
11998         echo "Checking whether closedir() returns a status..." >&4
11999         cat > closedir.c <<EOM
12000 #$i_dirent I_DIRENT             /**/
12001 #$i_sysdir I_SYS_DIR            /**/
12002 #$i_sysndir I_SYS_NDIR          /**/
12003 #$i_systypes I_SYS_TYPES        /**/
12004
12005 #if defined(I_SYS_TYPES)
12006 #include <sys/types.h>
12007 #endif
12008 #if defined(I_DIRENT)
12009 #include <dirent.h>
12010 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
12011 #include <sys/dir.h>
12012 #endif
12013 #else
12014 #ifdef I_SYS_NDIR
12015 #include <sys/ndir.h>
12016 #else
12017 #ifdef I_SYS_DIR
12018 #ifdef hp9000s500
12019 #include <ndir.h>       /* may be wrong in the future */
12020 #else
12021 #include <sys/dir.h>
12022 #endif
12023 #endif
12024 #endif
12025 #endif 
12026 int main() { return closedir(opendir(".")); }
12027 EOM
12028         set closedir
12029         if eval $compile_ok; then
12030                 if ./closedir > /dev/null 2>&1 ; then
12031                         echo "Yes, it does."
12032                         val="$undef"
12033                 else
12034                         echo "No, it doesn't."
12035                         val="$define"
12036                 fi
12037         else
12038                 echo "(I can't seem to compile the test program--assuming it doesn't)"
12039                 val="$define"
12040         fi
12041         ;;
12042 *)
12043         val="$undef";
12044         ;;
12045 esac
12046 set d_void_closedir
12047 eval $setvar
12048 $rm -f closedir*
12049 : check for volatile keyword
12050 echo " "
12051 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
12052 $cat >try.c <<'EOCP'
12053 int main()
12054 {
12055         typedef struct _goo_struct goo_struct;
12056         goo_struct * volatile goo = ((goo_struct *)0);
12057         struct _goo_struct {
12058                 long long_int;
12059                 int reg_int;
12060                 char char_var;
12061         };
12062         typedef unsigned short foo_t;
12063         char *volatile foo;
12064         volatile int bar;
12065         volatile foo_t blech;
12066         foo = foo;
12067 }
12068 EOCP
12069 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
12070         val="$define"
12071         echo "Yup, it does."
12072 else
12073         val="$undef"
12074         echo "Nope, it doesn't."
12075 fi
12076 set d_volatile
12077 eval $setvar
12078 $rm -f try.*
12079
12080 : see if there is a wait4
12081 set wait4 d_wait4
12082 eval $inlibc
12083
12084 : see if waitpid exists
12085 set waitpid d_waitpid
12086 eval $inlibc
12087
12088 : see if wcstombs exists
12089 set wcstombs d_wcstombs
12090 eval $inlibc
12091
12092 : see if wctomb exists
12093 set wctomb d_wctomb
12094 eval $inlibc
12095
12096 : preserve RCS keywords in files with variable substitution, grrr
12097 Date='$Date'
12098 Id='$Id'
12099 Log='$Log'
12100 RCSfile='$RCSfile'
12101 Revision='$Revision'
12102
12103 case "$crosscompile" in
12104 ''|[nN]*) crosscompile="$undef" ;;
12105 esac
12106
12107 case "$osname" in
12108 next|rhapsody|darwin) multiarch="$define" ;;
12109 esac
12110 case "$multiarch" in
12111 ''|[nN]*) multiarch="$undef" ;;
12112 esac
12113
12114 : check for alignment requirements
12115 echo " "
12116 case "$crosscompile$multiarch" in
12117 *$define*)
12118         $cat <<EOM
12119 You seem to be either cross-compiling or doing a multiarchitecture build,
12120 skipping the memory alignment check.
12121
12122 EOM
12123         case "$alignbytes" in
12124         '') alignbytes=8 ;;
12125         esac
12126         ;;
12127 *)
12128         case "$alignbytes" in
12129         '') echo "Checking alignment constraints..." >&4
12130                 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
12131                         $cat >try.c <<'EOCP'
12132 typedef long double NV;
12133 EOCP
12134                 else
12135                         $cat >try.c <<'EOCP'
12136 typedef double NV;
12137 EOCP
12138                 fi
12139                 $cat >>try.c <<'EOCP'
12140 #include <stdio.h>
12141 struct foobar {
12142         char foo;
12143         NV bar;
12144 } try_algn;
12145 int main()
12146 {
12147     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
12148     return(0);
12149 }
12150 EOCP
12151                 set try
12152                 if eval $compile_ok; then
12153                         dflt=`./try`
12154                 else
12155                         dflt='8'
12156                         echo "(I can't seem to compile the test program...)"
12157                 fi
12158                 ;;
12159         *) dflt="$alignbytes"
12160                 ;;
12161         esac
12162         rp="Doubles must be aligned on a how-many-byte boundary?"
12163         . ./myread
12164         alignbytes="$ans"
12165         $rm -f try.c try
12166         ;;
12167 esac
12168
12169
12170 : set the base revision
12171 baserev=5.0
12172
12173 : check for ordering of bytes in a long
12174 echo " "
12175 case "$crosscompile$multiarch" in
12176 *$define*)
12177         $cat <<EOM
12178 You seem to be either cross-compiling or doing a multiarchitecture build,
12179 skipping the byteorder check.
12180
12181 EOM
12182         byteorder='0xffff'
12183         ;;
12184 *)
12185         case "$byteorder" in
12186         '')
12187                 $cat <<'EOM'
12188 In the following, larger digits indicate more significance.  A big-endian
12189 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
12190 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
12191 machines may have weird orders like 3412.  A Cray will report 87654321,
12192 an Alpha will report 12345678. If the test program works the default is
12193 probably right.
12194 I'm now running the test program...
12195 EOM
12196                 $cat >try.c <<'EOCP'
12197 #include <stdio.h>
12198 int main()
12199 {
12200         int i;
12201         union {
12202                 unsigned long l;
12203                 char c[sizeof(long)];
12204         } u;
12205
12206         if (sizeof(long) > 4)
12207                 u.l = (0x08070605L << 32) | 0x04030201L;
12208         else
12209                 u.l = 0x04030201L;
12210         for (i = 0; i < sizeof(long); i++)
12211                 printf("%c", u.c[i]+'0');
12212         printf("\n");
12213         exit(0);
12214 }
12215 EOCP
12216                 xxx_prompt=y
12217                 set try
12218                 if eval $compile && ./try > /dev/null; then
12219                         dflt=`./try`
12220                         case "$dflt" in
12221                         [1-4][1-4][1-4][1-4]|12345678|87654321)
12222                                 echo "(The test program ran ok.)"
12223                                 echo "byteorder=$dflt"
12224                                 xxx_prompt=n
12225                         ;;
12226                         ????|????????) echo "(The test program ran ok.)" ;;
12227                         *) echo "(The test program didn't run right for some reason.)" ;;
12228                         esac
12229                 else
12230                         dflt='4321'
12231                         cat <<'EOM'
12232 (I can't seem to compile the test program.  Guessing big-endian...)
12233 EOM
12234                 fi
12235                 case "$xxx_prompt" in
12236                 y)
12237                         rp="What is the order of bytes in a long?"
12238                         . ./myread
12239                         byteorder="$ans"
12240                         ;;
12241                 *)      byteorder=$dflt
12242                         ;;
12243                 esac
12244                 ;;
12245         esac
12246         $rm -f try.c try
12247         ;;
12248 esac
12249
12250
12251 : how do we catenate cpp tokens here?
12252 echo " "
12253 echo "Checking to see how your cpp does stuff like catenate tokens..." >&4
12254 $cat >cpp_stuff.c <<'EOCP'
12255 #define RCAT(a,b)a/**/b
12256 #define ACAT(a,b)a ## b
12257 RCAT(Rei,ser)
12258 ACAT(Cir,cus)
12259 EOCP
12260 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
12261 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
12262         echo "Oh!  Smells like ANSI's been here." >&4
12263         echo "We can catify or stringify, separately or together!"
12264         cpp_stuff=42
12265 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
12266         echo "Ah, yes!  The good old days!" >&4
12267         echo "However, in the good old days we don't know how to stringify and"
12268         echo "catify at the same time."
12269         cpp_stuff=1
12270 else
12271         $cat >&4 <<EOM
12272 Hmm, I don't seem to be able to catenate tokens with your cpp.  You're going
12273 to have to edit the values of CAT[2-5] in config.h...
12274 EOM
12275         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
12276 fi
12277 $rm -f cpp_stuff.*
12278
12279 : see if this is a db.h system
12280 set db.h i_db
12281 eval $inhdr
12282
12283 case "$i_db" in
12284 $define)
12285         : Check db version.
12286         echo " "
12287         echo "Checking Berkeley DB version ..." >&4
12288         $cat >try.c <<EOCP
12289 #$d_const HASCONST
12290 #ifndef HASCONST
12291 #define const
12292 #endif
12293 #include <sys/types.h>
12294 #include <stdio.h>
12295 #include <db.h>
12296 int main()
12297 {
12298 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
12299     int Major, Minor, Patch ;
12300     unsigned long Version ;
12301     (void)db_version(&Major, &Minor, &Patch) ;
12302     printf("You have Berkeley DB Version 2 or greater\n");
12303
12304     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
12305                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
12306     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
12307                 Major, Minor, Patch) ;
12308
12309     /* check that db.h & libdb are compatible */
12310     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
12311         printf("db.h and libdb are incompatible\n") ;
12312         exit(3);        
12313     }
12314
12315     printf("db.h and libdb are compatible\n") ;
12316
12317     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
12318                 + DB_VERSION_PATCH ;
12319
12320     /* needs to be >= 2.3.4 */
12321     if (Version < 2003004) {
12322     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
12323         printf("but Perl needs Berkeley DB 2.3.4 or greater\n") ;
12324         exit(2);        
12325     }
12326
12327     exit(0);
12328 #else
12329 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
12330     printf("You have Berkeley DB Version 1\n");
12331     exit(0);    /* DB version < 2: the coast is clear. */
12332 #else
12333     exit(1);    /* <db.h> not Berkeley DB? */
12334 #endif
12335 #endif
12336 }
12337 EOCP
12338         set try
12339         if eval $compile_ok && ./try; then
12340                 echo 'Looks OK.' >&4
12341         else
12342                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
12343                 i_db=$undef
12344                 case " $libs " in
12345                 *"-ldb "*)
12346                         : Remove db from list of libraries to use
12347                         echo "Removing unusable -ldb from library list" >&4
12348                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
12349                         shift
12350                         libs="$*"
12351                         echo "libs = $libs" >&4
12352                         ;;
12353                 esac
12354         fi
12355         $rm -f try.*
12356         ;;
12357 esac
12358
12359 case "$i_db" in
12360 define)
12361         : Check the return type needed for hash 
12362         echo " "
12363         echo "Checking return type needed for hash for Berkeley DB ..." >&4
12364         $cat >try.c <<EOCP
12365 #$d_const HASCONST
12366 #ifndef HASCONST
12367 #define const
12368 #endif
12369 #include <sys/types.h>
12370 #include <db.h>
12371
12372 #ifndef DB_VERSION_MAJOR
12373 u_int32_t hash_cb (ptr, size)
12374 const void *ptr;
12375 size_t size;
12376 {
12377 }
12378 HASHINFO info;
12379 int main()
12380 {
12381         info.hash = hash_cb;
12382 }
12383 #endif
12384 EOCP
12385         if $cc $ccflags -c try.c >try.out 2>&1 ; then
12386                 if $contains warning try.out >>/dev/null 2>&1 ; then
12387                         db_hashtype='int'
12388                 else
12389                         db_hashtype='u_int32_t'
12390                 fi
12391         else
12392                 : XXX Maybe we should just give up here.
12393                 db_hashtype=u_int32_t
12394                 $cat try.out >&4
12395                 echo "Help:  I can't seem to compile the db test program." >&4
12396                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
12397         fi
12398         $rm -f try.*
12399         echo "Your version of Berkeley DB uses $db_hashtype for hash."
12400         ;;
12401 *)      db_hashtype=u_int32_t
12402         ;;
12403 esac
12404 case "$i_db" in
12405 define)
12406         : Check the return type needed for prefix 
12407         echo " "
12408         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
12409         cat >try.c <<EOCP
12410 #$d_const HASCONST
12411 #ifndef HASCONST
12412 #define const
12413 #endif
12414 #include <sys/types.h>
12415 #include <db.h>
12416
12417 #ifndef DB_VERSION_MAJOR
12418 size_t prefix_cb (key1, key2)
12419 const DBT *key1;
12420 const DBT *key2;
12421 {
12422 }
12423 BTREEINFO info;
12424 int main()
12425 {
12426         info.prefix = prefix_cb;
12427 }
12428 #endif
12429 EOCP
12430         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
12431                 if $contains warning try.out >>/dev/null 2>&1 ; then
12432                         db_prefixtype='int'
12433                 else
12434                         db_prefixtype='size_t'
12435                 fi
12436         else
12437                 db_prefixtype='size_t'
12438                 : XXX Maybe we should just give up here.
12439                 $cat try.out >&4
12440                 echo "Help:  I can't seem to compile the db test program." >&4
12441                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
12442         fi
12443         $rm -f try.*
12444         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
12445         ;;
12446 *)      db_prefixtype='size_t'
12447         ;;
12448 esac
12449
12450 : check for void type
12451 echo " "
12452 echo "Checking to see how well your C compiler groks the void type..." >&4
12453 case "$voidflags" in
12454 '')
12455         $cat >try.c <<'EOCP'
12456 #if TRY & 1
12457 void sub() {
12458 #else
12459 sub() {
12460 #endif
12461         extern void moo();      /* function returning void */
12462         void (*goo)();          /* ptr to func returning void */
12463 #if TRY & 8
12464         void *hue;              /* generic ptr */
12465 #endif
12466 #if TRY & 2
12467         void (*foo[10])();
12468 #endif
12469
12470 #if TRY & 4
12471         if(goo == moo) {
12472                 exit(0);
12473         }
12474 #endif
12475         exit(0);
12476 }
12477 int main() { sub(); }
12478 EOCP
12479         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
12480                 voidflags=$defvoidused
12481         echo "Good.  It appears to support void to the level $package wants.">&4
12482                 if $contains warning .out >/dev/null 2>&1; then
12483                         echo "However, you might get some warnings that look like this:"
12484                         $cat .out
12485                 fi
12486         else
12487 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
12488                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
12489                         echo "It supports 1..."
12490                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
12491                                 echo "It also supports 2..."
12492                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
12493                                         voidflags=7
12494                                         echo "And it supports 4 but not 8 definitely."
12495                                 else
12496                                         echo "It doesn't support 4..."
12497                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
12498                                                 voidflags=11
12499                                                 echo "But it supports 8."
12500                                         else
12501                                                 voidflags=3
12502                                                 echo "Neither does it support 8."
12503                                         fi
12504                                 fi
12505                         else
12506                                 echo "It does not support 2..."
12507                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
12508                                         voidflags=13
12509                                         echo "But it supports 4 and 8."
12510                                 else
12511                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
12512                                                 voidflags=5
12513                                                 echo "And it supports 4 but has not heard about 8."
12514                                         else
12515                                                 echo "However it supports 8 but not 4."
12516                                         fi
12517                                 fi
12518                         fi
12519                 else
12520                         echo "There is no support at all for void."
12521                         voidflags=0
12522                 fi
12523         fi
12524 esac
12525 case "$voidflags" in
12526 "$defvoidused") ;;
12527 *)      $cat >&4 <<'EOM'
12528   Support flag bits are:
12529     1: basic void declarations.
12530     2: arrays of pointers to functions returning void.
12531     4: operations between pointers to and addresses of void functions.
12532     8: generic void pointers.
12533 EOM
12534         dflt="$voidflags";
12535         rp="Your void support flags add up to what?"
12536         . ./myread
12537         voidflags="$ans"
12538         ;;
12539 esac
12540 $rm -f try.* .out
12541
12542
12543 : How can we generate normalized random numbers ?
12544 echo " "
12545 echo "Looking for a random number function..." >&4
12546 case "$randfunc" in
12547 '')
12548         if set drand48 val -f; eval $csym; $val; then
12549                 dflt="drand48"
12550                 echo "Good, found drand48()." >&4
12551         elif set random val -f; eval $csym; $val; then
12552                 dflt="random"
12553                 echo "OK, found random()." >&4
12554         else
12555                 dflt="rand"
12556                 echo "Yick, looks like I have to use rand()." >&4
12557         fi
12558         echo " "
12559         ;;
12560 *)
12561         dflt="$randfunc"
12562         ;;
12563 esac
12564 cont=true
12565
12566 case "$ccflags" in
12567 *-Dmy_rand=*|*-Dmy_srand=*)
12568         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
12569         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
12570         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
12571         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
12572         ;;
12573 esac
12574
12575 while $test "$cont"; do
12576         rp="Use which function to generate random numbers?"
12577         . ./myread
12578         if $test "$ans" = "$dflt"; then
12579                 : null
12580         else
12581                 randbits=''
12582         fi
12583         randfunc="$ans"
12584         if set $ans val -f; eval $csym; $val; then
12585                 cont=''
12586         else
12587                 dflt=y
12588                 rp="I cannot find function $ans. Use that name anyway?"
12589                 . ./myread
12590                 dflt=rand
12591                 case "$ans" in
12592                         [yY]*) cont='';;
12593                 esac
12594         fi
12595         case "$cont" in
12596         '')
12597                 case "$randfunc" in
12598                 drand48)
12599                         drand01="drand48()"
12600                         seedfunc="srand48"
12601                         randbits=48
12602                         randseedtype=long
12603                         ;;
12604                 rand|random)
12605                         case "$randbits" in
12606                         '')
12607 echo "Checking to see how many bits your $randfunc() function produces..." >&4
12608                                 $cat >try.c <<EOCP
12609 #$i_unistd I_UNISTD
12610 #$i_stdlib I_STDLIB
12611 #include <stdio.h>
12612 #ifdef I_UNISTD
12613 #  include <unistd.h>
12614 #endif
12615 #ifdef I_STDLIB
12616 #  include <stdlib.h>
12617 #endif
12618 int main()
12619 {
12620         register int i;
12621         register unsigned long tmp;
12622         register unsigned long max = 0L;
12623
12624         for (i = 1000; i; i--) {
12625                 tmp = (unsigned long) $randfunc();
12626                 if (tmp > max) max = tmp;
12627         }
12628         for (i = 0; max; i++)
12629                 max /= 2;
12630         printf("%d\n",i);
12631 }
12632 EOCP
12633                                 set try
12634                                 if eval $compile_ok; then
12635                                         dflt=`try`
12636                                 else
12637                                         dflt='?'
12638                                         echo "(I can't seem to compile the test program...)"
12639                                 fi
12640                                 ;;
12641                         *)
12642                                 dflt="$randbits"
12643                                 ;;
12644                         esac
12645                         rp="How many bits does your $randfunc() function produce?"
12646                         . ./myread
12647                         randbits="$ans"
12648                         $rm -f try.c try
12649                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
12650                         seedfunc="s$randfunc"
12651                         randseedtype=unsigned
12652                         ;;
12653                 *)
12654                         dflt="31"
12655                         rp="How many bits does your $randfunc() function produce?"
12656                         . ./myread
12657                         randbits="$ans"
12658                         seedfunc="s$randfunc"
12659                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
12660                         if set $seedfunc val -f; eval $csym; $val; then
12661                                 echo "(Using $seedfunc() to seed random generator)"
12662                         else
12663                                 echo "(Warning: no $seedfunc() to seed random generator)"
12664                                 seedfunc=rand
12665                         fi
12666                         randseedtype=unsigned
12667                         ;;
12668                 esac
12669                 ;;
12670         esac
12671 done
12672
12673 echo " "
12674 echo "Determining whether or not we are on an EBCDIC system..." >&4
12675 $cat >tebcdic.c <<'EOM'
12676 int main()
12677 {
12678   if ('M'==0xd4) return 0;
12679   return 1;
12680 }
12681 EOM
12682
12683 val=$undef
12684 set tebcdic
12685 if eval $compile_ok; then
12686         if ./tebcdic; then
12687                 echo "You have EBCDIC." >&4
12688                 val="$define"
12689         else
12690                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin." >&4
12691         fi
12692 else
12693         echo "I'm unable to compile the test program." >&4
12694         echo "I'll assume ASCII or some ISO Latin." >&4
12695 fi
12696 $rm -f tebcdic.c tebcdic
12697 set ebcdic
12698 eval $setvar
12699
12700 echo " "
12701 $cat >&4 <<EOM
12702 Checking how to flush all pending stdio output...
12703 EOM
12704 # I only know how to find the first 32 possibly open files on SunOS.
12705 # See also hints/sunos_4_1.sh and util.c  --AD
12706 case "$osname" in
12707 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
12708 esac
12709 $cat >>try.c <<EOCP
12710 #include <stdio.h>
12711 #$i_unistd I_UNISTD
12712 #ifdef I_UNISTD
12713 # include <unistd.h>
12714 #endif
12715 #$d_sysconf HAS_SYSCONF
12716 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
12717 #ifdef HAS_STDIO_STREAM_ARRAY
12718 # define STDIO_STREAM_ARRAY $stdio_stream_array
12719 #endif
12720 int main() {
12721   FILE* p = fopen("try.out", "w");
12722 #ifdef TRY_FPUTC
12723   fputc('x', p);
12724 #else
12725 # ifdef TRY_FPRINTF
12726   fprintf(p, "x");
12727 # endif
12728 #endif
12729 #ifdef TRY_FFLUSH_NULL
12730   fflush(NULL);
12731 #endif
12732 #ifdef TRY_FFLUSH_ALL
12733   {
12734     long open_max = -1;
12735 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
12736     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
12737 # else
12738 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
12739     open_max = sysconf(_SC_OPEN_MAX);
12740 #  else
12741 #   ifdef FOPEN_MAX
12742     open_max = FOPEN_MAX;
12743 #   else
12744 #    ifdef OPEN_MAX
12745     open_max = OPEN_MAX;
12746 #    else
12747 #     ifdef _NFILE
12748     open_max = _NFILE;
12749 #     endif
12750 #    endif
12751 #   endif
12752 #  endif
12753 # endif 
12754 # ifdef HAS_STDIO_STREAM_ARRAY
12755     if (open_max > 0) {
12756       long i;
12757       for (i = 0; i < open_max; i++)
12758             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
12759                 STDIO_STREAM_ARRAY[i]._file < open_max &&
12760                 STDIO_STREAM_ARRAY[i]._flag)
12761                 fflush(&STDIO_STREAM_ARRAY[i]);
12762     }   
12763   }
12764 # endif
12765 #endif
12766   _exit(42);
12767 }
12768 EOCP
12769 : first we have to find out how _not_ to flush
12770 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
12771     output=''
12772     set try -DTRY_FPUTC
12773     if eval $compile; then
12774             $rm -f try.out
12775             ./try$exe_ext 2>/dev/null
12776             if $test ! -s try.out -a "X$?" = X42; then
12777                 output=-DTRY_FPUTC
12778             fi
12779     fi
12780     case "$output" in
12781     '')
12782             set try -DTRY_FPRINTF
12783             $rm -f try.out
12784             if eval $compile; then
12785                     $rm -f try.out
12786                     ./try$exe_ext 2>/dev/null
12787                     if $test ! -s try.out -a "X$?" = X42; then
12788                         output=-DTRY_FPRINTF
12789                     fi
12790             fi
12791         ;;
12792     esac
12793 fi
12794 : check for fflush NULL behaviour
12795 case "$fflushNULL" in
12796 '')     set try -DTRY_FFLUSH_NULL $output
12797         if eval $compile; then
12798                 $rm -f try.out
12799                 ./try$exe_ext 2>/dev/null
12800                 code="$?"
12801                 if $test -s try.out -a "X$code" = X42; then
12802                         fflushNULL="`$cat try.out`"
12803                 else
12804                         if $test "X$code" != X42; then
12805                                 $cat >&4 <<EOM
12806 (If this test failed, don't worry, we'll try another method shortly.)
12807 EOM
12808                         fi
12809                 fi
12810         fi
12811         $rm -f core try.core core.try.*
12812         case "$fflushNULL" in
12813         x)      $cat >&4 <<EOM
12814 Your fflush(NULL) works okay for output streams.
12815 Let's see if it clobbers input pipes...
12816 EOM
12817 # As of mid-March 2000 all versions of Solaris appear to have a stdio
12818 # bug that improperly flushes the input end of pipes.  So we avoid the
12819 # autoflush on fork/system/exec support for now. :-(
12820 $cat >tryp.c <<EOCP
12821 #include <stdio.h>
12822 int
12823 main(int argc, char **argv)
12824 {
12825     char buf[1024];
12826     int i;
12827     char *bp = buf;
12828     while (1) {
12829         while ((i = getc(stdin)) != -1
12830                && (*bp++ = i) != '\n'
12831                && bp < &buf[1024])
12832         /* DO NOTHING */ ;
12833         *bp = '\0';
12834         fprintf(stdout, "%s", buf);
12835         fflush(NULL);
12836         if (i == -1)
12837             return 0;
12838         bp = buf;
12839     }
12840 }
12841 EOCP
12842                 fflushNULL="$define"
12843                 set tryp
12844                 if eval $compile; then
12845                     $rm -f tryp.out
12846                     $cat tryp.c | ./tryp$exe_ext 2>/dev/null > tryp.out
12847                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
12848                        $cat >&4 <<EOM
12849 fflush(NULL) seems to behave okay with input streams.
12850 EOM
12851                         fflushNULL="$define"
12852                     else
12853                         $cat >&4 <<EOM
12854 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
12855 EOM
12856                         fflushNULL="$undef"
12857                     fi
12858                 fi
12859                 $rm -f core tryp.c tryp.core core.tryp.*
12860                 ;;
12861         '')     $cat >&4 <<EOM
12862 Your fflush(NULL) isn't working (contrary to ANSI C).
12863 EOM
12864                 fflushNULL="$undef"
12865                 ;;
12866         *)      $cat >&4 <<EOM
12867 Cannot figure out whether your fflush(NULL) works or not.
12868 I'm assuming it doesn't (contrary to ANSI C).
12869 EOM
12870                 fflushNULL="$undef"
12871                 ;;
12872         esac
12873         ;;
12874 $define|true|[yY]*)
12875         fflushNULL="$define"
12876         ;;
12877 *)
12878         fflushNULL="$undef"
12879         ;;
12880 esac
12881 : check explicit looping only if NULL did not work, and if the pipe
12882 : bug does not show up on an explicit flush too
12883 case "$fflushNULL" in
12884 "$undef")
12885         $cat >tryp.c <<EOCP
12886 #include <stdio.h>
12887 int
12888 main(int argc, char **argv)
12889 {
12890     char buf[1024];
12891     int i;
12892     char *bp = buf;
12893     while (1) {
12894         while ((i = getc(stdin)) != -1
12895                && (*bp++ = i) != '\n'
12896                && bp < &buf[1024])
12897         /* DO NOTHING */ ;
12898         *bp = '\0';
12899         fprintf(stdout, "%s", buf);
12900         fflush(stdin);
12901         if (i == -1)
12902             return 0;
12903         bp = buf;
12904     }
12905 }
12906 EOCP
12907         set tryp
12908         if eval $compile; then
12909             $rm -f tryp.out
12910             $cat tryp.c | ./tryp$exe_ext 2>/dev/null > tryp.out
12911             if cmp tryp.c tryp.out >/dev/null 2>&1; then
12912                $cat >&4 <<EOM
12913 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
12914 EOM
12915                 : now check for fflushall behaviour
12916                 case "$fflushall" in
12917                 '')     set try -DTRY_FFLUSH_ALL $output
12918                         if eval $compile; then
12919                                 $cat >&4 <<EOM
12920 (Now testing the other method--but note that this also may fail.)
12921 EOM
12922                                 $rm -f try.out
12923                                 ./try$exe_ext 2>/dev/null
12924                                 if $test -s try.out -a "X$?" = X42; then
12925                                         fflushall="`$cat try.out`"
12926                                 fi
12927                         fi
12928                         $rm -f core try.core core.try.*
12929                         case "$fflushall" in
12930                         x)      $cat >&4 <<EOM
12931 Whew. Flushing explicitly all the stdio streams works.
12932 EOM
12933                                 fflushall="$define"
12934                                 ;;
12935                         '')     $cat >&4 <<EOM
12936 Sigh. Flushing explicitly all the stdio streams doesn't work.
12937 EOM
12938                                 fflushall="$undef"
12939                                 ;;
12940                         *)      $cat >&4 <<EOM
12941 Cannot figure out whether flushing stdio streams explicitly works or not.
12942 I'm assuming it doesn't.
12943 EOM
12944                                 fflushall="$undef"
12945                                 ;;
12946                         esac
12947                         ;;
12948                 "$define"|true|[yY]*)
12949                         fflushall="$define"
12950                         ;;
12951                 *)
12952                         fflushall="$undef"
12953                         ;;
12954                 esac
12955             else
12956                 $cat >&4 <<EOM
12957 All is futile.  Even fflush(stdin) clobbers input pipes!
12958 EOM
12959                 fflushall="$undef"
12960             fi
12961         else
12962             fflushall="$undef"
12963         fi
12964         $rm -f core tryp.c tryp.core core.tryp.*
12965         ;;
12966 *)      fflushall="$undef"
12967         ;;
12968 esac
12969
12970 case "$fflushNULL$fflushall" in
12971 undefundef)
12972         $cat <<EOM
12973 OK, I give up.  I cannot figure out how to flush pending stdio output.
12974 We won't be flushing handles at all before fork/exec/popen.
12975 EOM
12976         ;;
12977 esac
12978 $rm -f try.* try$exe_ext
12979
12980 : Store the full pathname to the ar program for use in the C program
12981 : Respect a hint or command line value for full_ar.
12982 case "$full_ar" in
12983 '') full_ar=$ar ;;
12984 esac
12985
12986 : Store the full pathname to the sed program for use in the C program
12987 full_sed=$sed
12988
12989 : see what type gids are declared as in the kernel
12990 echo " "
12991 echo "Looking for the type for group ids returned by getgid()."
12992 set gid_t gidtype xxx stdio.h sys/types.h
12993 eval $typedef
12994 case "$gidtype" in
12995 xxx)
12996         xxx=`./findhdr sys/user.h`
12997         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
12998         case $1 in
12999         unsigned) dflt="$1 $2" ;;
13000         *) dflt="$1" ;;
13001         esac
13002         ;;
13003 *) dflt="$gidtype";;
13004 esac
13005 case "$gidtype" in
13006 gid_t) echo "gid_t found." ;;
13007 *)      rp="What is the type for group ids returned by getgid()?"
13008         . ./myread
13009         gidtype="$ans"
13010         ;;
13011 esac
13012
13013 echo " "
13014 case "$gidtype" in
13015 *_t) zzz="$gidtype"     ;;
13016 *)   zzz="gid"          ;;
13017 esac
13018 echo "Checking the size of $zzz..." >&4 
13019 cat > try.c <<EOCP
13020 #include <sys/types.h>
13021 #include <stdio.h>
13022 int main() {
13023     printf("%d\n", (int)sizeof($gidtype));
13024     exit(0);
13025 }
13026 EOCP
13027 set try
13028 if eval $compile_ok; then
13029         yyy=`./try`
13030         case "$yyy" in
13031         '')     gidsize=4
13032                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
13033                 ;;
13034         *)      gidsize=$yyy
13035                 echo "Your $zzz is $gidsize bytes long."
13036                 ;;
13037         esac
13038 else
13039         gidsize=4
13040         echo "(I can't compile the test program--guessing $gidsize.)" >&4
13041 fi
13042
13043
13044 echo " "
13045 case "$gidtype" in
13046 *_t) zzz="$gidtype"     ;;
13047 *)   zzz="gid"          ;;
13048 esac
13049 echo "Checking the sign of $zzz..." >&4 
13050 cat > try.c <<EOCP
13051 #include <sys/types.h>
13052 #include <stdio.h>
13053 int main() {
13054         $gidtype foo = -1;
13055         if (foo < 0)
13056                 printf("-1\n");
13057         else
13058                 printf("1\n");
13059 }
13060 EOCP
13061 set try
13062 if eval $compile; then
13063         yyy=`./try`
13064         case "$yyy" in
13065         '')     gidsign=1
13066                 echo "(I can't execute the test program--guessing unsigned.)" >&4
13067                 ;;
13068         *)      gidsign=$yyy
13069                 case "$gidsign" in
13070                  1) echo "Your $zzz is unsigned." ;;
13071                 -1) echo "Your $zzz is signed."   ;;
13072                 esac
13073                 ;;
13074         esac
13075 else
13076         gidsign=1
13077         echo "(I can't compile the test program--guessing unsigned.)" >&4
13078 fi
13079
13080
13081 echo " "
13082
13083 if $test X"$quadtype" != X; then
13084
13085 echo "Checking how to print 64-bit integers..." >&4
13086
13087 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
13088         $cat >try.c <<'EOCP'
13089 #include <sys/types.h>
13090 #include <stdio.h>
13091 int main() {
13092   int q = 12345678901;
13093   printf("%ld\n", q);
13094 }
13095 EOCP
13096         set try
13097         if eval $compile; then
13098                 yyy=`./try$exe_ext`
13099                 case "$yyy" in
13100                 12345678901)
13101                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
13102                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIX64='"X"';
13103                         echo "We will use %d."
13104                         ;;
13105                 esac
13106         fi
13107 fi
13108
13109 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
13110         $cat >try.c <<'EOCP'
13111 #include <sys/types.h>
13112 #include <stdio.h>
13113 int main() {
13114   long q = 12345678901;
13115   printf("%ld\n", q);
13116 }
13117 EOCP
13118         set try
13119         if eval $compile; then
13120                 yyy=`./try$exe_ext`
13121                 case "$yyy" in
13122                 12345678901)
13123                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
13124                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIX64='"lX"';
13125                         echo "We will use %ld."
13126                         ;;
13127                 esac
13128         fi
13129 fi
13130
13131 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
13132         $cat >try.c <<'EOCP'
13133 #include <sys/types.h>
13134 #include <inttypes.h>
13135 #include <stdio.h>
13136 int main() {
13137   int64_t q = 12345678901;
13138   printf("%" PRId64 "\n", q);
13139 }
13140 EOCP
13141         set try
13142         if eval $compile; then
13143                 yyy=`./try$exe_ext`
13144                 case "$yyy" in
13145                 12345678901)
13146                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
13147                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIX64=PRIX64;
13148                         echo "We will use the C9X style."
13149                         ;;
13150                 esac
13151         fi
13152 fi
13153
13154 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
13155         $cat >try.c <<'EOCP'
13156 #include <sys/types.h>
13157 #include <stdio.h>
13158 int main() {
13159   long long q = 12345678901LL; /* AIX cc requires the LL prefix. */
13160   printf("%lld\n", q);
13161 }
13162 EOCP
13163         set try
13164         if eval $compile; then
13165                 yyy=`./try$exe_ext`
13166                 case "$yyy" in
13167                 12345678901)
13168                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
13169                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIX64='"llX"';
13170                         echo "We will use the %lld style."
13171                         ;;
13172                 esac
13173         fi
13174 fi
13175
13176 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
13177         $cat >try.c <<EOCP
13178 #include <sys/types.h>
13179 #include <stdio.h>
13180 int main() {
13181   $quadtype q = 12345678901;
13182   printf("%Ld\n", q);
13183 }
13184 EOCP
13185         set try
13186         if eval $compile; then
13187                 yyy=`./try$exe_ext`
13188                 case "$yyy" in
13189                 12345678901)
13190                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
13191                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIX64='"LX"';
13192                         echo "We will use %Ld."
13193                         ;;
13194                 esac
13195         fi
13196 fi
13197
13198 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
13199         $cat >try.c <<EOCP
13200 #include <sys/types.h>
13201 #include <stdio.h>
13202 int main() {
13203   $quadtype q = 12345678901;
13204   printf("%qd\n", q);
13205 }
13206 EOCP
13207         set try
13208         if eval $compile; then
13209                 yyy=`./try$exe_ext`
13210                 case "$yyy" in
13211                 12345678901)
13212                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
13213                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIX64='"qX"';
13214                         echo "We will use %qd."
13215                         ;;
13216                 esac
13217         fi
13218 fi
13219
13220 if $test X"$sPRId64" = X; then
13221         echo "Cannot figure out how to print 64-bit integers." >&4
13222 fi
13223
13224 $rm -f try try.*
13225
13226 fi
13227
13228 case "$sPRId64" in
13229 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef"; 
13230         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIX64="$undef"; 
13231         ;;
13232 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define"; 
13233         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIX64="$define"; 
13234         ;;
13235 esac
13236
13237
13238 echo " "
13239 $echo "Checking the format strings to be used for Perl's internal types..." >&4
13240
13241 if $test X"$ivsize" = X8; then
13242         ivdformat="$sPRId64"
13243         uvuformat="$sPRIu64"
13244         uvoformat="$sPRIo64"
13245         uvxformat="$sPRIx64"
13246         uvXformat="$sPRIX64"
13247 else
13248         if $test X"$ivsize" = X"$longsize"; then
13249                 ivdformat='"ld"'
13250                 uvuformat='"lu"'
13251                 uvoformat='"lo"'
13252                 uvxformat='"lx"'
13253                 uvXformat='"lX"'
13254         else
13255                 if $test X"$ivsize" = X"$intsize"; then
13256                         ivdformat='"d"'
13257                         uvuformat='"u"'
13258                         uvoformat='"o"'
13259                         uvxformat='"x"'
13260                         uvXformat='"X"'
13261                 else
13262                         : far out
13263                         if $test X"$ivsize" = X"$shortsize"; then
13264                                 ivdformat='"hd"'
13265                                 uvuformat='"hu"'
13266                                 uvoformat='"ho"'
13267                                 uvxformat='"hx"'
13268                                 uvXformat='"hX"'
13269                         fi
13270                 fi
13271         fi
13272 fi
13273
13274 if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
13275         nveformat="$sPRIeldbl"
13276         nvfformat="$sPRIfldbl"
13277         nvgformat="$sPRIgldbl"
13278         nvEformat="$sPRIEldbl"
13279         nvFformat="$sPRIFldbl"
13280         nvGformat="$sPRIGldbl"
13281 else
13282         nveformat='"e"'
13283         nvfformat='"f"'
13284         nvgformat='"g"'
13285         nvEformat='"E"'
13286         nvFformat='"F"'
13287         nvGformat='"G"'
13288 fi
13289
13290 case "$ivdformat" in
13291 '') echo "$0: Fatal: failed to find format strings, cannot continue." >& 4
13292     exit 1
13293     ;;
13294 esac
13295
13296
13297 echo " "
13298 $echo "Checking the format string to be used for gids..." >&4
13299
13300 case "$gidsign" in
13301 -1)     if $test X"$gidsize" = X"$ivsize"; then
13302                 gidformat="$ivdformat"
13303         else
13304                 if $test X"$gidsize" = X"$longsize"; then
13305                         gidformat='"ld"'
13306                 else
13307                         if $test X"$gidsize" = X"$intsize"; then
13308                                 gidformat='"d"'
13309                         else
13310                                 if $test X"$gidsize" = X"$shortsize"; then
13311                                         gidformat='"hd"'
13312                                 fi
13313                         fi
13314                 fi
13315         fi
13316         ;;
13317 *)      if $test X"$gidsize" = X"$uvsize"; then
13318                 gidformat="$uvuformat"
13319         else
13320                 if $test X"$gidsize" = X"$longsize"; then
13321                         gidformat='"lu"'
13322                 else
13323                         if $test X"$gidsize" = X"$intsize"; then
13324                                 gidformat='"u"'
13325                         else
13326                                 if $test X"$gidsize" = X"$shortsize"; then
13327                                         gidformat='"hu"'
13328                                 fi
13329                         fi
13330                 fi
13331         fi
13332         ;;
13333 esac
13334
13335 : see if getgroups exists
13336 set getgroups d_getgrps
13337 eval $inlibc
13338
13339 : see if setgroups exists
13340 set setgroups d_setgrps
13341 eval $inlibc
13342
13343
13344 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
13345 echo " "
13346 case "$d_getgrps$d_setgrps" in
13347 *define*)
13348         case "$groupstype" in
13349         '') dflt="$gidtype" ;;
13350         *)  dflt="$groupstype" ;;
13351         esac
13352         $cat <<EOM
13353 What type of pointer is the second argument to getgroups() and setgroups()?
13354 Usually this is the same as group ids, $gidtype, but not always.
13355
13356 EOM
13357         rp='What type pointer is the second argument to getgroups() and setgroups()?'
13358         . ./myread
13359         groupstype="$ans"
13360         ;;
13361 *)  groupstype="$gidtype";;
13362 esac
13363
13364 echo " "
13365 echo "Checking if your $make program sets \$(MAKE)..." >&4
13366 case "$make_set_make" in
13367 '')
13368         $sed 's/^X //' > testmake.mak << 'EOF'
13369 Xall:
13370 X       @echo 'maketemp="$(MAKE)"'
13371 EOF
13372         case "`$make -f testmake.mak 2>/dev/null`" in
13373         *maketemp=*) make_set_make='#' ;;
13374         *)      make_set_make="MAKE=$make" ;;
13375         esac
13376         $rm -f testmake.mak
13377         ;;
13378 esac
13379 case "$make_set_make" in
13380 '#') echo "Yup, it does.";;
13381 *) echo "Nope, it doesn't.";;
13382 esac
13383
13384 : see what type is used for mode_t
13385 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
13386 set mode_t modetype int stdio.h sys/types.h
13387 eval $typedef_ask
13388
13389 : define a fucntion to check prototypes
13390 $cat > protochk <<EOSH
13391 $startsh
13392 cc="$cc"
13393 optimize="$optimize"
13394 ccflags="$ccflags"
13395 prototype="$prototype"
13396 define="$define"
13397 rm=$rm
13398 EOSH
13399
13400 $cat >> protochk <<'EOSH'
13401
13402 $rm -f try.c
13403 foo="$1"
13404 shift
13405 while test $# -ge 2; do
13406         case "$1" in
13407                 $define) echo "#include <$2>" >> try.c ;;
13408                 literal) echo "$2" >> try.c ;;
13409         esac
13410     shift 2
13411 done
13412 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
13413 cat >> try.c <<'EOCP'
13414 #ifdef CAN_PROTOTYPE
13415 #define _(args) args
13416 #else
13417 #define _(args) ()
13418 #endif
13419 EOCP
13420 echo "$foo" >> try.c
13421 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
13422 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
13423 status=$?
13424 $rm -f try.[co]
13425 exit $status
13426 EOSH
13427 chmod +x protochk
13428 $eunicefix protochk
13429
13430 : see what type is used for size_t
13431 rp="What is the type used for the length parameter for string functions?"
13432 set size_t sizetype 'unsigned int' stdio.h sys/types.h
13433 eval $typedef_ask
13434
13435 : check for type of arguments to gethostbyaddr. 
13436 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
13437         case "$d_gethbyaddr" in
13438         $define)
13439                 $cat <<EOM
13440
13441 Checking to see what type of arguments are accepted by gethostbyaddr().
13442 EOM
13443                 hdrs="$define sys/types.h
13444                         $d_socket sys/socket.h 
13445                         $i_niin netinet/in.h 
13446                         $i_netdb netdb.h
13447                         $i_unistd unistd.h"
13448                 : The first arg can 'char *' or 'void *'
13449                 : The second arg is some of integral type
13450                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
13451                         for yyy in size_t long int; do
13452                                 case "$netdb_host_type" in
13453                                 '')     try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
13454                                         if ./protochk "$try" $hdrs; then
13455                                                 echo "Your system accepts $xxx for the first arg."
13456                                                 echo "...and $yyy for the second arg."
13457                                                 netdb_host_type="$xxx"
13458                                                 netdb_hlen_type="$yyy"
13459                                         fi
13460                                         ;;
13461                                 esac
13462                         done
13463                 done
13464                 : In case none of those worked, prompt the user.
13465                 case "$netdb_host_type" in
13466                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
13467                         dflt='char *'
13468                         . ./myread
13469                         netdb_host_type=$ans
13470                         rp='What is the type for the 2nd argument to gethostbyaddr?'
13471                         dflt="$sizetype"
13472                         . ./myread
13473                         netdb_hlen_type=$ans
13474                         ;;
13475                 esac
13476                 ;;
13477         *)      : no gethostbyaddr, so pick harmless defaults
13478                 netdb_host_type='char *'
13479                 netdb_hlen_type="$sizetype"
13480                 ;;
13481         esac
13482         # Remove the "const" if needed. -- but then we'll have a 
13483         # prototype clash!
13484         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
13485 fi
13486
13487 : check for type of argument to gethostbyname. 
13488 if test "X$netdb_name_type" = X ; then
13489         case "$d_gethbyname" in
13490         $define)
13491                 $cat <<EOM
13492
13493 Checking to see what type of argument is accepted by gethostbyname().
13494 EOM
13495                 hdrs="$define sys/types.h
13496                         $d_socket sys/socket.h 
13497                         $i_niin netinet/in.h 
13498                         $i_netdb netdb.h
13499                         $i_unistd unistd.h"
13500                 for xxx in "const char *" "char *"; do
13501                         case "$netdb_name_type" in
13502                         '')     try="extern struct hostent *gethostbyname($xxx);"
13503                                 if ./protochk "$try" $hdrs; then
13504                                         echo "Your system accepts $xxx."
13505                                         netdb_name_type="$xxx"
13506                                 fi
13507                                 ;;
13508                         esac
13509                 done
13510                 : In case none of those worked, prompt the user.
13511                 case "$netdb_name_type" in
13512                 '')     rp='What is the type for the 1st argument to gethostbyname?'
13513                         dflt='char *'
13514                         . ./myread
13515                         netdb_name_type=$ans
13516                         ;;
13517                 esac
13518                 ;;
13519         *)      : no gethostbyname, so pick harmless default
13520                 netdb_name_type='char *'
13521                 ;;
13522         esac
13523 fi
13524
13525 : check for type of 1st argument to getnetbyaddr. 
13526 if test "X$netdb_net_type" = X ; then
13527         case "$d_getnbyaddr" in
13528         $define)
13529                 $cat <<EOM
13530
13531 Checking to see what type of 1st argument is accepted by getnetbyaddr().
13532 EOM
13533                 hdrs="$define sys/types.h
13534                         $d_socket sys/socket.h 
13535                         $i_niin netinet/in.h 
13536                         $i_netdb netdb.h
13537                         $i_unistd unistd.h"
13538                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
13539                         case "$netdb_net_type" in
13540                         '')     try="extern struct netent *getnetbyaddr($xxx, int);"
13541                                 if ./protochk "$try" $hdrs; then
13542                                         echo "Your system accepts $xxx."
13543                                         netdb_net_type="$xxx"
13544                                 fi
13545                                 ;;
13546                         esac
13547                 done
13548                 : In case none of those worked, prompt the user.
13549                 case "$netdb_net_type" in
13550                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
13551                         dflt='long'
13552                         . ./myread
13553                         netdb_net_type=$ans
13554                         ;;
13555                 esac
13556                 ;;
13557         *)      : no getnetbyaddr, so pick harmless default
13558                 netdb_net_type='long'
13559                 ;;
13560         esac
13561 fi
13562 : locate the preferred pager for this system
13563 case "$pager" in
13564 '')
13565         dflt=''
13566         case "$pg" in
13567         /*) dflt=$pg;;
13568         esac
13569         case "$more" in
13570         /*) dflt=$more;;
13571         esac
13572         case "$less" in
13573         /*) dflt=$less;;
13574         esac
13575         case "$dflt" in
13576         '') dflt=/usr/ucb/more;;
13577         esac
13578         ;;
13579 *) dflt="$pager";;
13580 esac
13581 echo " "
13582 fn=f/
13583 rp='What pager is used on your system?'
13584 . ./getfile
13585 pager="$ans"
13586
13587 : see what type pids are declared as in the kernel
13588 rp="What is the type of process ids on this system?"
13589 set pid_t pidtype int stdio.h sys/types.h
13590 eval $typedef_ask
13591
13592 : Find earliest binary compatible site_perl subdirectory perl can use.
13593 case "$bincompat5005" in
13594 "$define") xs_apiversion='5.005' ;;
13595 *) xs_apiversion=$version ;;   # The current site_perl version.
13596 esac
13597 : Find earliest pure perl site_perl subdirectory perl can use.
13598 : The versioned directories started at 5.005.
13599 pm_apiversion='5.005'
13600
13601 : check for length of pointer
13602 echo " "
13603 case "$ptrsize" in
13604 '')
13605         echo "Checking to see how big your pointers are..." >&4
13606         if test "$voidflags" -gt 7; then
13607                 echo '#define VOID_PTR char *' > try.c
13608         else
13609                 echo '#define VOID_PTR void *' > try.c
13610         fi
13611         $cat >>try.c <<'EOCP'
13612 #include <stdio.h>
13613 int main()
13614 {
13615     printf("%d\n", (int)sizeof(VOID_PTR));
13616     exit(0);
13617 }
13618 EOCP
13619         set try
13620         if eval $compile_ok; then
13621                 ptrsize=`./try`
13622                 echo "Your pointers are $ptrsize bytes long."
13623         else
13624                 dflt='4'
13625                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
13626                 rp="What is the size of a pointer (in bytes)?"
13627                 . ./myread
13628                 ptrsize="$ans"
13629         fi
13630         ;;
13631 esac
13632 $rm -f try.c try
13633
13634 : see if ar generates random libraries by itself
13635 echo " "
13636 echo "Checking how to generate random libraries on your machine..." >&4
13637 echo 'int bar1() { return bar2(); }' > bar1.c
13638 echo 'int bar2() { return 2; }' > bar2.c
13639 $cat > foo.c <<'EOP'
13640 int main() { printf("%d\n", bar1()); exit(0); }
13641 EOP
13642 $cc $ccflags -c bar1.c >/dev/null 2>&1
13643 $cc $ccflags -c bar2.c >/dev/null 2>&1
13644 $cc $ccflags -c foo.c >/dev/null 2>&1
13645 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
13646 if $cc $ccflags $ldflags -o foobar foo$_o bar$_a $libs > /dev/null 2>&1 &&
13647         ./foobar >/dev/null 2>&1; then
13648         echo "$ar appears to generate random libraries itself."
13649         orderlib=false
13650         ranlib=":"
13651 elif $ar ts bar$_a >/dev/null 2>&1 &&
13652         $cc $ccflags $ldflags -o foobar foo$_o bar$_a $libs > /dev/null 2>&1 &&
13653         ./foobar >/dev/null 2>&1; then
13654                 echo "a table of contents needs to be added with '$ar ts'."
13655                 orderlib=false
13656                 ranlib="$ar ts"
13657 else
13658         case "$ranlib" in
13659         :) ranlib='';;
13660         '')
13661                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
13662                 $test -f $ranlib || ranlib=''
13663                 ;;
13664         esac
13665         if $test -n "$ranlib"; then
13666                 echo "your system has '$ranlib'; we'll use that."
13667                 orderlib=false
13668         else
13669                 echo "your system doesn't seem to support random libraries"
13670                 echo "so we'll use lorder and tsort to order the libraries."
13671                 orderlib=true
13672                 ranlib=":"
13673         fi
13674 fi
13675 $rm -f foo* bar* 
13676
13677 : check for type of arguments to select. 
13678 case "$selecttype" in
13679 '') case "$d_select" in
13680         $define)
13681                 echo " "
13682                 $cat <<EOM
13683 Checking to see what type of arguments are accepted by select().
13684 EOM
13685                 hdrs="$define sys/types.h
13686                         $i_systime sys/time.h 
13687                         $i_sysselct sys/select.h
13688                         $d_socket sys/socket.h"
13689                 : The first arg can be int, unsigned, or size_t
13690                 : The last arg may or may not be 'const'
13691                 val=''
13692                 : void pointer has been seen but using that
13693                 : breaks the selectminbits test
13694                 for xxx in 'fd_set *' 'int *'; do
13695                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
13696                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
13697                                         case "$val" in
13698                                         '')     try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
13699                                                 if ./protochk "$try" $hdrs; then
13700                                                         echo "Your system accepts $xxx."
13701                                                         val="$xxx"
13702                                                 fi
13703                                                 ;;
13704                                         esac
13705                                 done
13706                         done
13707                 done
13708                 case "$val" in
13709                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
13710                         case "$d_fd_set" in
13711                                 $define) dflt="fd_set *" ;;
13712                                 *)              dflt="int *" ;;
13713                         esac
13714                         . ./myread
13715                         val=$ans
13716                         ;;
13717                 esac
13718                 selecttype="$val"
13719                 ;;
13720         *)      : no select, so pick a harmless default
13721                 selecttype='int *'
13722                 ;;
13723         esac
13724         ;;
13725 esac
13726
13727 : check for the select 'width'
13728 case "$selectminbits" in
13729 '') case "$d_select" in
13730         $define)
13731                 $cat <<EOM
13732
13733 Checking to see on how many bits at a time your select() operates...
13734 EOM
13735                 $cat >try.c <<EOCP
13736 #include <sys/types.h>
13737 #$i_time I_TIME
13738 #$i_systime I_SYS_TIME
13739 #$i_systimek I_SYS_TIME_KERNEL
13740 #ifdef I_TIME
13741 #   include <time.h>
13742 #endif
13743 #ifdef I_SYS_TIME
13744 #   ifdef I_SYS_TIME_KERNEL
13745 #       define KERNEL
13746 #   endif
13747 #   include <sys/time.h>
13748 #   ifdef I_SYS_TIME_KERNEL
13749 #       undef KERNEL
13750 #   endif
13751 #endif
13752 #$i_sysselct I_SYS_SELECT
13753 #ifdef I_SYS_SELECT
13754 #include <sys/select.h>
13755 #endif
13756 #$d_socket HAS_SOCKET
13757 #ifdef HAS_SOCKET
13758 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
13759 #endif
13760 #include <stdio.h>
13761 $selecttype b;
13762 #define S sizeof(*(b))
13763 #define MINBITS 64
13764 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
13765 #define NBITS  (NBYTES * 8)
13766 int main() {
13767     char s[NBYTES];
13768     struct timeval t;
13769     int i;
13770     FILE* fp;
13771     int fd;
13772
13773     fclose(stdin);
13774     fp = fopen("try.c", "r");
13775     if (fp == 0)
13776       exit(1);
13777     fd = fileno(fp);
13778     if (fd < 0)
13779       exit(2);
13780     b = ($selecttype)s;
13781     for (i = 0; i < NBITS; i++)
13782         FD_SET(i, b);
13783     t.tv_sec  = 0;
13784     t.tv_usec = 0;
13785     select(fd + 1, b, 0, 0, &t);
13786     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
13787     printf("%d\n", i + 1);
13788     return 0;
13789 }
13790 EOCP
13791                 set try
13792                 if eval $compile_ok; then
13793                         selectminbits=`./try`
13794                         case "$selectminbits" in
13795                         '')     cat >&4 <<EOM
13796 Cannot figure out on how many bits at a time your select() operates.
13797 I'll play safe and guess it is 32 bits.
13798 EOM
13799                                 selectminbits=32
13800                                 bits="32 bits"
13801                                 ;;
13802                         1)      bits="1 bit" ;;
13803                         *)      bits="$selectminbits bits" ;;
13804                         esac
13805                         echo "Your select() operates on $bits at a time." >&4
13806                 else
13807                         rp='What is the minimum number of bits your select() operates on?'
13808                         case "$byteorder" in
13809                         1234|12345678)  dflt=32 ;;
13810                         *)              dflt=1  ;;
13811                         esac
13812                         . ./myread
13813                         val=$ans
13814                         selectminbits="$val"
13815                 fi
13816                 $rm -f try.* try
13817                 ;;
13818         *)      : no select, so pick a harmless default
13819                 selectminbits='32'
13820                 ;;
13821         esac
13822         ;;
13823 esac
13824
13825 : Trace out the files included by signal.h, then look for SIGxxx names.
13826 : Remove SIGARRAYSIZE used by HPUX.
13827 : Remove SIGSTKSIZE used by Linux.
13828 : Remove SIGSTKSZ used by Posix.
13829 : Remove SIGTYP void lines used by OS2.
13830 : Some cpps, like os390, dont give the file name anywhere
13831 if [ "X$fieldn" = X ]; then
13832         : Just make some guesses.  We check them later.
13833         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
13834 else
13835         xxx=`echo '#include <signal.h>' |
13836         $cppstdin $cppminus $cppflags 2>/dev/null |
13837         $grep '^[       ]*#.*include' | 
13838         $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sort | $uniq`
13839 fi
13840 : Check this list of files to be sure we have parsed the cpp output ok.
13841 : This will also avoid potentially non-existent files, such 
13842 : as ../foo/bar.h
13843 xxxfiles=''
13844 for xx in $xxx /dev/null ; do
13845         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
13846 done
13847 : If we have found no files, at least try signal.h
13848 case "$xxxfiles" in
13849 '')     xxxfiles=`./findhdr signal.h` ;;
13850 esac
13851 xxx=`awk '
13852 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
13853         print substr($2, 4, 20)
13854 }
13855 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
13856         print substr($3, 4, 20)
13857 }' $xxxfiles`
13858 : Append some common names just in case the awk scan failed.
13859 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
13860 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
13861 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
13862 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
13863 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
13864
13865 : generate a few handy files for later
13866 $cat > signal.c <<'EOCP'
13867 #include <sys/types.h>
13868 #include <signal.h>
13869 #include <stdio.h>
13870 int main() {
13871
13872 /* Strange style to avoid deeply-nested #if/#else/#endif */
13873 #ifndef NSIG
13874 #  ifdef _NSIG
13875 #    define NSIG (_NSIG)
13876 #  endif
13877 #endif
13878
13879 #ifndef NSIG
13880 #  ifdef SIGMAX
13881 #    define NSIG (SIGMAX+1)
13882 #  endif
13883 #endif
13884
13885 #ifndef NSIG
13886 #  ifdef SIG_MAX
13887 #    define NSIG (SIG_MAX+1)
13888 #  endif
13889 #endif
13890
13891 #ifndef NSIG
13892 #  ifdef MAXSIG
13893 #    define NSIG (MAXSIG+1)
13894 #  endif
13895 #endif
13896
13897 #ifndef NSIG
13898 #  ifdef MAX_SIG
13899 #    define NSIG (MAX_SIG+1)
13900 #  endif
13901 #endif
13902
13903 #ifndef NSIG
13904 #  ifdef SIGARRAYSIZE
13905 #    define NSIG (SIGARRAYSIZE+1) /* Not sure of the +1 */
13906 #  endif
13907 #endif
13908
13909 #ifndef NSIG
13910 #  ifdef _sys_nsig
13911 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
13912 #  endif
13913 #endif
13914
13915 /* Default to some arbitrary number that's big enough to get most
13916    of the common signals.
13917 */
13918 #ifndef NSIG
13919 #    define NSIG 50
13920 #endif
13921
13922 printf("NSIG %d\n", NSIG);
13923
13924 #ifndef JUST_NSIG
13925
13926 EOCP
13927
13928 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
13929 {
13930         printf "#ifdef SIG"; printf $1; printf "\n"
13931         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
13932         printf $1; printf ");\n"
13933         printf "#endif\n"
13934 }
13935 END {
13936         printf "#endif /* JUST_NSIG */\n";
13937         printf "exit(0);\n}\n";
13938 }
13939 ' >>signal.c
13940 $cat >signal.awk <<'EOP'
13941 BEGIN { ndups = 0 }
13942 $1 ~ /^NSIG$/ { nsig = $2 }
13943 ($1 !~ /^NSIG$/) && (NF == 2) {
13944     if ($2 > maxsig) { maxsig = $2 }
13945     if (sig_name[$2]) {
13946         dup_name[ndups] = $1
13947         dup_num[ndups] = $2
13948         ndups++ 
13949     }
13950     else {
13951         sig_name[$2] = $1
13952         sig_num[$2] = $2
13953     }
13954 }
13955 END { 
13956     if (nsig == 0) {
13957         nsig = maxsig + 1
13958     }
13959     printf("NSIG %d\n", nsig);
13960     for (n = 1; n < nsig; n++) {
13961         if (sig_name[n]) {
13962             printf("%s %d\n", sig_name[n], sig_num[n])
13963         }
13964         else {
13965             printf("NUM%d %d\n", n, n) 
13966         }
13967     }
13968     for (n = 0; n < ndups; n++) {
13969         printf("%s %d\n", dup_name[n], dup_num[n])
13970     }
13971 }
13972 EOP
13973 $cat >signal_cmd <<EOS
13974 $startsh
13975 if $test -s signal.lst; then
13976     echo "Using your existing signal.lst file"
13977         exit 0
13978 fi
13979 xxx="$xxx"
13980 EOS
13981 $cat >>signal_cmd <<'EOS'
13982
13983 set signal
13984 if eval $compile_ok; then
13985         ./signal$_exe | $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
13986 else
13987         echo "(I can't seem be able to compile the whole test program)" >&4
13988         echo "(I'll try it in little pieces.)" >&4
13989         set signal -DJUST_NSIG
13990         if eval $compile_ok; then
13991                 ./signal$_exe > signal.nsg
13992                 $cat signal.nsg
13993         else
13994                 echo "I can't seem to figure out how many signals you have." >&4
13995                 echo "Guessing 50." >&4
13996                 echo 'NSIG 50' > signal.nsg
13997         fi
13998         : Now look at all the signal names, one at a time.
13999         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
14000                 $cat > signal.c <<EOCP
14001 #include <sys/types.h>
14002 #include <signal.h>
14003 #include <stdio.h>
14004 int main() {
14005 printf("$xx %d\n", SIG${xx});
14006 return 0;
14007 }
14008 EOCP
14009                 set signal
14010                 if eval $compile; then
14011                         echo "SIG${xx} found."
14012                         ./signal$_exe  >> signal.ls1
14013                 else
14014                         echo "SIG${xx} NOT found."
14015                 fi
14016         done
14017         if $test -s signal.ls1; then
14018                 $cat signal.nsg signal.ls1 |
14019                         $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
14020         fi
14021
14022 fi
14023 if $test -s signal.lst; then
14024         :
14025 else
14026         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
14027         echo 'kill -l' >signal
14028         set X `csh -f <signal`
14029         $rm -f signal
14030         shift
14031         case $# in
14032         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
14033         esac
14034         echo $@ | $tr ' ' $trnl | \
14035             $awk '{ printf "%s %d\n", $1, ++s; }
14036                   END { printf "NSIG %d\n", ++s }' >signal.lst
14037 fi
14038 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
14039 EOS
14040 chmod a+x signal_cmd
14041 $eunicefix signal_cmd
14042
14043 : generate list of signal names
14044 echo " "
14045 case "$sig_name_init" in
14046 '') doinit=yes ;;
14047 *)  case "$sig_num_init" in
14048     ''|*,*) doinit=yes ;;
14049     esac ;;
14050 esac
14051 case "$doinit" in
14052 yes)
14053         echo "Generating a list of signal names and numbers..." >&4
14054         . ./signal_cmd
14055         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
14056         sig_name=`$awk 'BEGIN { printf "ZERO " }
14057                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
14058         sig_num=`$awk  'BEGIN { printf "0 " }
14059                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
14060         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
14061                              !/^NSIG/   { printf "\"%s\", ", $1 }
14062                              END        { printf "0\n" }' signal.lst`
14063         sig_num_init=`$awk  'BEGIN      { printf "0, " }
14064                              !/^NSIG/   { printf "%d, ", $2}
14065                              END        { printf "0\n"}' signal.lst`
14066         ;;
14067 esac
14068 echo "The following $sig_count signals are available:"
14069 echo " "
14070 echo $sig_name | $awk \
14071 'BEGIN { linelen = 0 }
14072 {
14073         for (i = 1; i <= NF; i++) {
14074                 name = "SIG" $i " "
14075                 linelen = linelen + length(name)
14076                 if (linelen > 70) {
14077                         printf "\n"
14078                         linelen = length(name)
14079                 }
14080                 printf "%s", name
14081         }
14082         printf "\n"
14083 }'
14084 $rm -f signal signal.c signal.awk signal.lst signal_cmd 
14085
14086 echo " "
14087 case "$sizetype" in
14088 *_t) zzz="$sizetype"    ;;
14089 *)   zzz="filesize"     ;;
14090 esac
14091 echo "Checking the size of $zzz..." >&4 
14092 cat > try.c <<EOCP
14093 #include <sys/types.h>
14094 #include <stdio.h>
14095 int main() {
14096     printf("%d\n", (int)sizeof($sizetype));
14097     exit(0);
14098 }
14099 EOCP
14100 set try
14101 if eval $compile_ok; then
14102         yyy=`./try`
14103         case "$yyy" in
14104         '')     sizesize=4
14105                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
14106                 ;;
14107         *)      sizesize=$yyy
14108                 echo "Your $zzz size is $sizesize bytes."
14109                 ;;
14110         esac
14111 else
14112         sizesize=4
14113         echo "(I can't compile the test program--guessing $sizesize.)" >&4
14114 fi
14115
14116
14117 : check for socklen_t
14118 echo " "
14119 echo "Checking to see if you have socklen_t..." >&4
14120 $cat >try.c <<EOCP
14121 #include <sys/types.h>
14122 #$d_socket HAS_SOCKET
14123 #ifdef HAS_SOCKET
14124 #include <sys/socket.h>
14125 #endif
14126 int main() { socklen_t x = 16; }
14127 EOCP
14128 set try
14129 if eval $compile; then
14130         val="$define"
14131         echo "You have socklen_t."
14132 else
14133         val="$undef"
14134         echo "You do not have socklen_t."
14135         case "$sizetype" in
14136         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
14137         esac
14138 fi
14139 $rm -f try try.*
14140 set d_socklen_t
14141 eval $setvar
14142
14143 : check for type of the size argument to socket calls
14144 case "$d_socket" in
14145 "$define")
14146         $cat <<EOM
14147
14148 Checking to see what type is the last argument of accept().
14149 EOM
14150         hdrs="$define sys/types.h $d_socket sys/socket.h" 
14151         yyy=''
14152         case "$d_socklen_t" in
14153         "$define") yyy="$yyy socklen_t"
14154         esac
14155         yyy="$yyy $sizetype int long unsigned"
14156         for xxx in $yyy; do
14157                 case "$socksizetype" in
14158                 '')     try="extern int accept(int, struct sockaddr *, $xxx *);"
14159                         if ./protochk "$try" $hdrs; then
14160                                 echo "Your system accepts '$xxx *' for the last argument of accept()."
14161                                 socksizetype="$xxx"
14162                         fi
14163                         ;;
14164                 esac
14165         done
14166 : In case none of those worked, prompt the user.
14167         case "$socksizetype" in
14168         '')     rp='What is the type for socket address structure sizes?'
14169                 dflt='int'
14170                 . ./myread
14171                 socksizetype=$ans
14172                 ;;
14173         esac
14174         ;;
14175 *)      : no sockets, so pick relatively harmless default
14176         socksizetype='int'
14177         ;;
14178 esac
14179
14180 : see what type is used for signed size_t
14181 set ssize_t ssizetype int stdio.h sys/types.h
14182 eval $typedef
14183 dflt="$ssizetype"
14184 $cat > ssize.c <<EOM
14185 #include <stdio.h>
14186 #include <sys/types.h>
14187 #define Size_t $sizetype
14188 #define SSize_t $dflt
14189 int main()
14190 {
14191         if (sizeof(Size_t) == sizeof(SSize_t))
14192                 printf("$dflt\n");
14193         else if (sizeof(Size_t) == sizeof(int))
14194                 printf("int\n");
14195         else 
14196                 printf("long\n");
14197         exit(0);
14198 }
14199 EOM
14200 echo " "
14201 set ssize
14202 if eval $compile_ok && ./ssize > /dev/null; then
14203         ssizetype=`./ssize`
14204         echo "I'll be using $ssizetype for functions returning a byte count." >&4
14205 else
14206         $cat >&4 <<EOM
14207 Help! I can't compile and run the ssize_t test program: please enlighten me!
14208 (This is probably a misconfiguration in your system or libraries, and
14209 you really ought to fix it.  Still, I'll try anyway.)
14210
14211 I need a type that is the same size as $sizetype, but is guaranteed to
14212 be signed.  Common values are ssize_t, int and long.
14213
14214 EOM
14215         rp="What signed type is the same size as $sizetype?"
14216         . ./myread
14217         ssizetype="$ans"
14218 fi
14219 $rm -f ssize ssize.*
14220
14221 : see what type of char stdio uses.
14222 echo " "
14223 if $contains 'unsigned.*char.*_ptr;' `./findhdr stdio.h` >/dev/null 2>&1 ; then
14224         echo "Your stdio uses unsigned chars." >&4
14225         stdchar="unsigned char"
14226 else
14227         echo "Your stdio uses signed chars." >&4
14228         stdchar="char"
14229 fi
14230
14231 : see if time exists
14232 echo " "
14233 if test "X$d_time" = X -o X"$timetype" = X; then
14234     if set time val -f d_time; eval $csym; $val; then
14235                 echo 'time() found.' >&4
14236                 val="$define"
14237                 rp="What is the type returned by time() on this system?"
14238                 set time_t timetype long stdio.h sys/types.h
14239                 eval $typedef_ask
14240     else
14241                 echo 'time() not found, hope that will do.' >&4
14242                 val="$undef"
14243                 timetype='int';
14244     fi
14245     set d_time
14246     eval $setvar
14247 fi
14248
14249 : see what type uids are declared as in the kernel
14250 echo " "
14251 echo "Looking for the type for user ids returned by getuid()."
14252 set uid_t uidtype xxx stdio.h sys/types.h
14253 eval $typedef
14254 case "$uidtype" in
14255 xxx)
14256         xxx=`./findhdr sys/user.h`
14257         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
14258         case $1 in
14259         unsigned) dflt="$1 $2" ;;
14260         *) dflt="$1" ;;
14261         esac
14262         ;;
14263 *) dflt="$uidtype";;
14264 esac
14265 case "$uidtype" in
14266 uid_t)  echo "uid_t found." ;;
14267 *)      rp="What is the type for user ids returned by getuid()?"
14268         . ./myread
14269         uidtype="$ans"
14270         ;;
14271 esac
14272
14273 echo " "
14274 case "$uidtype" in
14275 *_t) zzz="$uidtype"     ;;
14276 *)   zzz="uid"          ;;
14277 esac
14278 echo "Checking the size of $zzz..." >&4 
14279 cat > try.c <<EOCP
14280 #include <sys/types.h>
14281 #include <stdio.h>
14282 int main() {
14283     printf("%d\n", (int)sizeof($uidtype));
14284     exit(0);
14285 }
14286 EOCP
14287 set try
14288 if eval $compile_ok; then
14289         yyy=`./try`
14290         case "$yyy" in
14291         '')     uidsize=4
14292                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
14293                 ;;
14294         *)      uidsize=$yyy
14295                 echo "Your $zzz is $uidsize bytes long."
14296                 ;;
14297         esac
14298 else
14299         uidsize=4
14300         echo "(I can't compile the test program--guessing $uidsize.)" >&4
14301 fi
14302
14303 echo " "
14304 case "$uidtype" in
14305 *_t) zzz="$uidtype"     ;;
14306 *)   zzz="uid"          ;;
14307 esac
14308 echo "Checking the sign of $zzz..." >&4
14309 cat > try.c <<EOCP
14310 #include <sys/types.h>
14311 #include <stdio.h>
14312 int main() {
14313         $uidtype foo = -1;
14314         if (foo < 0)
14315                 printf("-1\n");
14316         else
14317                 printf("1\n");
14318 }
14319 EOCP
14320 set try
14321 if eval $compile; then
14322         yyy=`./try`
14323         case "$yyy" in
14324         '')     uidsign=1
14325                 echo "(I can't execute the test program--guessing unsigned.)" >&4
14326                 ;;
14327         *)      uidsign=$yyy
14328                 case "$uidsign" in
14329                  1) echo "Your $zzz is unsigned." ;;
14330                 -1) echo "Your $zzz is signed."   ;;
14331                 esac
14332                 ;;
14333         esac
14334 else
14335         uidsign=1
14336         echo "(I can't compile the test program--guessing unsigned.)" >&4
14337 fi
14338
14339
14340
14341 echo " "
14342 $echo "Checking the format string to be used for uids..." >&4
14343
14344 case "$uidsign" in
14345 -1)     if $test X"$uidsize" = X"$ivsize"; then
14346                 uidformat="$ivdformat"
14347         else
14348                 if $test X"$uidsize" = X"$longsize"; then
14349                         uidformat='"ld"'
14350                 else
14351                         if $test X"$uidsize" = X"$intsize"; then
14352                                 uidformat='"d"'
14353                         else
14354                                 if $test X"$uidsize" = X"$shortsize"; then
14355                                         uidformat='"hd"'
14356                                 fi
14357                         fi
14358                 fi
14359         fi
14360         ;;
14361 *)      if $test X"$uidsize" = X"$uvsize"; then
14362                 uidformat="$uvuformat"
14363         else
14364                 if $test X"$uidsize" = X"$longsize"; then
14365                         uidformat='"lu"'
14366                 else
14367                         if $test X"$uidsize" = X"$intsize"; then
14368                                 uidformat='"u"'
14369                         else
14370                                 if $test X"$uidsize" = X"$shortsize"; then
14371                                         uidformat='"hu"'
14372                                 fi
14373                         fi
14374                 fi
14375         fi
14376         ;;
14377 esac
14378
14379 : see if dbm.h is available
14380 : see if dbmclose exists
14381 set dbmclose d_dbmclose
14382 eval $inlibc
14383
14384 case "$d_dbmclose" in
14385 $define)
14386         set dbm.h i_dbm
14387         eval $inhdr
14388         case "$i_dbm" in
14389         $define)
14390                 val="$undef"
14391                 set i_rpcsvcdbm
14392                 eval $setvar
14393                 ;;
14394         *)      set rpcsvc/dbm.h i_rpcsvcdbm
14395                 eval $inhdr
14396                 ;;
14397         esac
14398         ;;
14399 *)      echo "We won't be including <dbm.h>"
14400         val="$undef"
14401         set i_dbm
14402         eval $setvar
14403         val="$undef"
14404         set i_rpcsvcdbm
14405         eval $setvar
14406         ;;
14407 esac
14408
14409 : see if this is a sys/file.h system
14410 val=''
14411 set sys/file.h val
14412 eval $inhdr
14413
14414 : do we need to include sys/file.h ?
14415 case "$val" in
14416 "$define")
14417         echo " "
14418         if $h_sysfile; then
14419                 val="$define"
14420                 echo "We'll be including <sys/file.h>." >&4
14421         else
14422                 val="$undef"
14423                 echo "We won't be including <sys/file.h>." >&4
14424         fi
14425         ;;
14426 *)
14427         h_sysfile=false
14428         ;;
14429 esac
14430 set i_sysfile
14431 eval $setvar
14432
14433 : see if fcntl.h is there
14434 val=''
14435 set fcntl.h val
14436 eval $inhdr
14437
14438 : see if we can include fcntl.h
14439 case "$val" in
14440 "$define")
14441         echo " "
14442         if $h_fcntl; then
14443                 val="$define"
14444                 echo "We'll be including <fcntl.h>." >&4
14445         else
14446                 val="$undef"
14447                 if $h_sysfile; then
14448         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
14449                 else
14450                         echo "We won't be including <fcntl.h>." >&4
14451                 fi
14452         fi
14453         ;;
14454 *)
14455         h_fcntl=false
14456         val="$undef"
14457         ;;
14458 esac
14459 set i_fcntl
14460 eval $setvar
14461
14462 : see if this is a iconv.h system
14463 set iconv.h i_iconv
14464 eval $inhdr
14465
14466 : see if this is a ieeefp.h system
14467 set ieeefp.h i_ieeefp
14468 eval $inhdr
14469
14470 : see if this is a libutil.h system
14471 set libutil.h i_libutil
14472 eval $inhdr
14473
14474 : see if locale.h is available
14475 set locale.h i_locale
14476 eval $inhdr
14477
14478 : see if mach cthreads are available
14479 if test "X$usethreads" = "X$define"; then
14480         set mach/cthreads.h i_machcthr
14481         eval $inhdr
14482 else
14483         i_machcthr="$undef"
14484 fi
14485
14486
14487
14488 : see if this is a math.h system
14489 set math.h i_math
14490 eval $inhdr
14491
14492 : see if this is a mntent.h system
14493 set mntent.h i_mntent
14494 eval $inhdr
14495
14496 : see if ndbm.h is available
14497 set ndbm.h t_ndbm
14498 eval $inhdr
14499 case "$t_ndbm" in
14500 $define)
14501         : see if dbm_open exists
14502         set dbm_open d_dbm_open
14503         eval $inlibc
14504         case "$d_dbm_open" in
14505         $undef)
14506                 t_ndbm="$undef"
14507                 echo "We won't be including <ndbm.h>"
14508                 ;;
14509         esac
14510         ;;
14511 esac
14512 val="$t_ndbm"
14513 set i_ndbm
14514 eval $setvar
14515
14516 : see if net/errno.h is available
14517 val=''
14518 set net/errno.h val
14519 eval $inhdr
14520
14521 : Unfortunately, it causes problems on some systems.  Arrgh.
14522 case "$val" in
14523 $define)
14524         cat > try.c <<'EOM'
14525 #include <stdio.h>
14526 #include <errno.h>
14527 #include <net/errno.h>
14528 int func()
14529 {
14530         return ENOTSOCK;
14531 }
14532 EOM
14533         if $cc $ccflags -c try.c >/dev/null 2>&1; then
14534                 echo "We'll be including <net/errno.h>." >&4
14535         else
14536                 echo "We won't be including <net/errno.h>." >&4
14537                 val="$undef"
14538         fi
14539         $rm -f try.* try
14540         ;;
14541 esac
14542 set i_neterrno
14543 eval $setvar
14544
14545 : see if netinet/tcp.h is available
14546 set netinet/tcp.h i_netinettcp
14547 eval $inhdr
14548
14549 : see if this is a poll.h system
14550 set poll.h i_poll
14551 eval $inhdr
14552
14553 : see if this is a prot.h system
14554 set prot.h i_prot
14555 eval $inhdr
14556
14557 echo " "
14558 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4 
14559 $cat <<'EOSH' > Cppsym.know
14560 a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
14561 AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
14562 alliant alpha am29000 AM29000 amiga AMIGAOS AMIX
14563 ansi ANSI_C_SOURCE apollo ardent atarist att386 att3b BeOS
14564 BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
14565 BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
14566 bull c cadmus clipper CMU COFF COMPILER_VERSION
14567 concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
14568 CYGWIN DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
14569 Dynix DynixPTX ELF encore EPI EXTENSIONS FILE_OFFSET_BITS
14570 FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
14571 GNU_SOURCE GNUC GNUC_MINOR GO32 gould GOULD_PN
14572 H3050R H3050RX hbullx20 hcx host_mips
14573 hp200 hp300 hp700 HP700 hp800 hp9000
14574 hp9000s200 hp9000s300 hp9000s400 hp9000s500
14575 hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
14576 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
14577 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
14578 INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
14579 LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
14580 LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
14581 Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
14582 LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
14583 M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
14584 M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
14585 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
14586 MATH_HAS_NO_SIDE_EFFECTS
14587 mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
14588 mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
14589 mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
14590 MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
14591 mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
14592 NetBSD news1500 news1700 news1800 news1900 news3700
14593 news700 news800 news900 NeXT NLS ns16000 ns32000
14594 ns32016 ns32332 ns32k nsc32000
14595 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
14596 pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
14597 pc532 pdp11 PGC PIC plexus PORTAR posix
14598 POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
14599 POSIX_C_SOURCE POSIX_SOURCE POWER
14600 PROTOTYPES PWB pyr QNX R3000 REENTRANT RES Rhapsody RISC6000
14601 riscix riscos RT scs SCO sequent sgi SGI_SOURCE sinix
14602 SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
14603 sony sony_news sonyrisc sparc sparclite spectrum
14604 stardent stdc STDC_EXT stratos sun sun3 sun386
14605 Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
14606 SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
14607 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
14608 sysV68 sysV88 Tek4132 Tek4300 titan
14609 tower tower32 tower32_200 tower32_600 tower32_700
14610 tower32_800 tower32_850 tss
14611 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
14612 ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
14613 unix UNIX95 UNIX99 unixpc unos USGr4 USGr4_2
14614 Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms xenix Xenix286
14615 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
14616 XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
14617 z8000
14618 EOSH
14619 # Maybe put other stuff here too.
14620 cat <<EOSH >>Cppsym.know
14621 $osname
14622 EOSH
14623 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
14624 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
14625 $cat Cppsym.know > Cppsym.c
14626 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | sort | uniq > Cppsym.know
14627 $rm -f Cppsym.a Cppsym.b Cppsym.c
14628 cat <<EOSH > Cppsym
14629 $startsh
14630 if $test \$# -gt 0; then
14631     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
14632     if $test -s Cppsym.got; then
14633         $rm -f Cppsym.got
14634         exit 0
14635     fi
14636     $rm -f Cppsym.got
14637     exit 1
14638 else
14639     $tr " " "$trnl" | ./Cppsym.try
14640     exit 0
14641 fi
14642 EOSH
14643 chmod +x Cppsym
14644 $eunicefix Cppsym
14645 cat <<EOSH > Cppsym.try
14646 $startsh
14647 cat <<'EOCP' > try.c
14648 #include <stdio.h>
14649 int main() {
14650 EOCP
14651 $awk \\
14652 EOSH
14653 cat <<'EOSH' >> Cppsym.try
14654 'length($1) > 0 {
14655     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
14656     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
14657     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
14658     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
14659 }'       >> try.c
14660 echo '}' >> try.c
14661 EOSH
14662 cat <<EOSH >> Cppsym.try
14663 ccflags="$ccflags"
14664 case "$osname-$gccversion" in
14665 irix-) ccflags="\$ccflags -woff 1178" ;;
14666 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
14667 esac
14668 $cc $optimize \$ccflags $ldflags -o try try.c $libs && ./try$exe_ext
14669 EOSH
14670 chmod +x Cppsym.try
14671 $eunicefix Cppsym.try
14672 ./Cppsym < Cppsym.know > Cppsym.true
14673 : now check the C compiler for additional symbols
14674 postprocess_cc_v=''
14675 case "$osname" in
14676 aix) postprocess_cc_v="|$tr , ' '" ;;
14677 esac
14678 $cat >ccsym <<EOS
14679 $startsh
14680 $cat >tmp.c <<EOF
14681 extern int foo;
14682 EOF
14683 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
14684 do
14685         case "\$i" in
14686         -D*) echo "\$i" | $sed 's/^-D//';;
14687         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A\(.*\)(\(.*\))/\1=\2/';;
14688         esac
14689 done
14690 $rm -f try.c
14691 EOS
14692 postprocess_cc_v=''
14693 chmod +x ccsym
14694 $eunicefix ccsym
14695 ./ccsym > ccsym1.raw
14696 if $test -s ccsym1.raw; then
14697        $sort ccsym1.raw | $uniq >ccsym.raw
14698 else
14699        mv ccsym1.raw ccsym.raw
14700 fi
14701
14702 $awk '/\=/ { print $0; next }
14703         { print $0"=1" }' ccsym.raw >ccsym.list
14704 $awk '/\=/ { print $0; next }
14705         { print $0"=1" }' Cppsym.true >ccsym.true
14706 $comm -13 ccsym.true ccsym.list >ccsym.own
14707 $comm -12 ccsym.true ccsym.list >ccsym.com
14708 $comm -23 ccsym.true ccsym.list >ccsym.cpp
14709 also=''
14710 if $test -z ccsym.raw; then
14711         echo "Your C compiler doesn't seem to define any symbols!" >&4
14712         echo " "
14713         echo "However, your C preprocessor defines the following symbols:"
14714         $cat Cppsym.true
14715         ccsymbols=''
14716         cppsymbols=`$cat Cppsym.true`
14717         cppsymbols=`echo $cppsymbols`
14718         cppccsymbols="$cppsymbols"
14719 else
14720         if $test -s ccsym.com; then
14721                 echo "Your C compiler and pre-processor define these symbols:"
14722                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
14723                 also='also '
14724                 symbols='ones'
14725                 cppccsymbols=`$cat ccsym.com`
14726                 cppccsymbols=`echo $cppccsymbols`
14727                 $test "$silent" || sleep 1
14728         fi
14729         if $test -s ccsym.cpp; then
14730                 $test "$also" && echo " "
14731                 echo "Your C pre-processor ${also}defines the following symbols:"
14732                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
14733                 also='further '
14734                 cppsymbols=`$cat ccsym.cpp`
14735                 cppsymbols=`echo $cppsymbols`
14736                 $test "$silent" || sleep 1
14737         fi
14738         if $test -s ccsym.own; then
14739                 $test "$also" && echo " "
14740                 echo "Your C compiler ${also}defines the following cpp symbols:"
14741                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
14742                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
14743                 ccsymbols=`$cat ccsym.own`
14744                 ccsymbols=`echo $ccsymbols`
14745                 $test "$silent" || sleep 1
14746         fi
14747 fi
14748 $rm -f ccsym* Cppsym.*
14749
14750 : see if this is a termio system
14751 val="$undef"
14752 val2="$undef"
14753 val3="$undef"
14754 if $test `./findhdr termios.h`; then
14755         set tcsetattr i_termios
14756         eval $inlibc
14757         val3="$i_termios"
14758 fi
14759 echo " "
14760 case "$val3" in
14761 "$define") echo "You have POSIX termios.h... good!" >&4;;
14762 *) if ./Cppsym pyr; then
14763                 case "`/bin/universe`" in
14764                 ucb) if $test `./findhdr sgtty.h`; then
14765                                 val2="$define"
14766                                 echo "<sgtty.h> found." >&4
14767                         else
14768                                 echo "System is pyramid with BSD universe."
14769                                 echo "<sgtty.h> not found--you could have problems." >&4
14770                         fi;;
14771                 *) if $test `./findhdr termio.h`; then
14772                                 val="$define"
14773                                 echo "<termio.h> found." >&4
14774                         else
14775                                 echo "System is pyramid with USG universe."
14776                                 echo "<termio.h> not found--you could have problems." >&4
14777                         fi;;
14778                 esac
14779         elif ./usg; then
14780                 if $test `./findhdr termio.h`; then
14781                         echo "<termio.h> found." >&4
14782                         val="$define"
14783                 elif $test `./findhdr sgtty.h`; then
14784                         echo "<sgtty.h> found." >&4
14785                         val2="$define"
14786                 else
14787 echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
14788                 fi
14789         else
14790                 if $test `./findhdr sgtty.h`; then
14791                         echo "<sgtty.h> found." >&4
14792                         val2="$define"
14793                 elif $test `./findhdr termio.h`; then
14794                         echo "<termio.h> found." >&4
14795                         val="$define"
14796                 else
14797 echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
14798                 fi
14799         fi;;
14800 esac
14801 set i_termio; eval $setvar
14802 val=$val2; set i_sgtty; eval $setvar
14803 val=$val3; set i_termios; eval $setvar
14804
14805 : see if this is a shadow.h system
14806 set shadow.h i_shadow
14807 eval $inhdr
14808
14809 : see if this is a socks.h system
14810 set socks.h i_socks
14811 eval $inhdr
14812
14813 : see if stdarg is available
14814 echo " "
14815 if $test `./findhdr stdarg.h`; then
14816         echo "<stdarg.h> found." >&4
14817         valstd="$define"
14818 else
14819         echo "<stdarg.h> NOT found." >&4
14820         valstd="$undef"
14821 fi
14822
14823 : see if varags is available
14824 echo " "
14825 if $test `./findhdr varargs.h`; then
14826         echo "<varargs.h> found." >&4
14827 else
14828         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
14829 fi
14830
14831 : set up the varargs testing programs
14832 $cat > varargs.c <<EOP
14833 #ifdef I_STDARG
14834 #include <stdarg.h>
14835 #endif
14836 #ifdef I_VARARGS
14837 #include <varargs.h>
14838 #endif
14839
14840 #ifdef I_STDARG
14841 int f(char *p, ...)
14842 #else
14843 int f(va_alist)
14844 va_dcl
14845 #endif
14846 {
14847         va_list ap;
14848 #ifndef I_STDARG
14849         char *p;
14850 #endif
14851 #ifdef I_STDARG
14852         va_start(ap,p);
14853 #else
14854         va_start(ap);
14855         p = va_arg(ap, char *);
14856 #endif
14857         va_end(ap);
14858 }
14859 EOP
14860 $cat > varargs <<EOP
14861 $startsh
14862 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
14863         echo "true"
14864 else
14865         echo "false"
14866 fi
14867 $rm -f varargs$_o
14868 EOP
14869 chmod +x varargs
14870
14871 : now check which varargs header should be included
14872 echo " "
14873 i_varhdr=''
14874 case "$valstd" in
14875 "$define")
14876         if `./varargs I_STDARG`; then
14877                 val='stdarg.h'
14878         elif `./varargs I_VARARGS`; then
14879                 val='varargs.h'
14880         fi
14881         ;;
14882 *)
14883         if `./varargs I_VARARGS`; then
14884                 val='varargs.h'
14885         fi
14886         ;;
14887 esac
14888 case "$val" in
14889 '')
14890 echo "I could not find the definition for va_dcl... You have problems..." >&4
14891         val="$undef"; set i_stdarg; eval $setvar
14892         val="$undef"; set i_varargs; eval $setvar
14893         ;;
14894 *) 
14895         set i_varhdr
14896         eval $setvar
14897         case "$i_varhdr" in
14898         stdarg.h)
14899                 val="$define"; set i_stdarg; eval $setvar
14900                 val="$undef"; set i_varargs; eval $setvar
14901                 ;;
14902         varargs.h)
14903                 val="$undef"; set i_stdarg; eval $setvar
14904                 val="$define"; set i_varargs; eval $setvar
14905                 ;;
14906         esac
14907         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
14908 esac
14909 $rm -f varargs*
14910
14911 : see if stddef is available
14912 set stddef.h i_stddef
14913 eval $inhdr
14914
14915 : see if this is a sunmath.h system
14916 set sunmath.h i_sunmath
14917 eval $inhdr
14918
14919 : see if sys/access.h is available
14920 set sys/access.h i_sysaccess
14921 eval $inhdr
14922
14923 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
14924 set sys/filio.h i_sysfilio
14925 eval $inhdr
14926 echo " "
14927 if $test `./findhdr sys/ioctl.h`; then
14928         val="$define"
14929         echo '<sys/ioctl.h> found.' >&4
14930 else
14931         val="$undef"
14932         if $test $i_sysfilio = "$define"; then
14933             echo '<sys/ioctl.h> NOT found.' >&4
14934         else
14935                 $test $i_sgtty = "$define" && xxx="sgtty.h"
14936                 $test $i_termio = "$define" && xxx="termio.h"
14937                 $test $i_termios = "$define" && xxx="termios.h"
14938 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
14939         fi
14940 fi
14941 set i_sysioctl
14942 eval $setvar
14943
14944
14945 : see if this is a syslog.h system
14946 set syslog.h i_syslog
14947 eval $inhdr
14948
14949
14950 : see if this is a sys/mode.h system
14951 set sys/mode.h i_sysmode
14952 eval $inhdr
14953
14954 : see if sys/resource.h has to be included
14955 set sys/resource.h i_sysresrc
14956 eval $inhdr
14957
14958 : see if sys/security.h is available
14959 set sys/security.h i_syssecrt
14960 eval $inhdr
14961
14962 : see if this is a sys/statvfs.h system
14963 set sys/statvfs.h i_sysstatvfs
14964 eval $inhdr
14965
14966 : see if this is a sys/uio.h system
14967 set sys/uio.h i_sysuio
14968 eval $inhdr
14969
14970 : see if this is a sys/un.h system
14971 set sys/un.h i_sysun
14972 eval $inhdr
14973
14974
14975 : see if this is a sys/utsname.h system
14976 set sys/utsname.h i_sysutsname
14977 eval $inhdr
14978
14979 : see if this is a syswait system
14980 set sys/wait.h i_syswait
14981 eval $inhdr
14982
14983 : see if this is a ustat.h system
14984 set ustat.h i_ustat
14985 eval $inhdr
14986
14987 : see if this is an utime system
14988 set utime.h i_utime
14989 eval $inhdr
14990
14991 : see if this is a values.h system
14992 set values.h i_values
14993 eval $inhdr
14994
14995 : see if this is a vfork system
14996 case "$d_vfork" in
14997 "$define")
14998         set vfork.h i_vfork
14999         eval $inhdr
15000         ;;
15001 *)
15002         i_vfork="$undef"
15003         ;;
15004 esac
15005
15006 : see if gdbm.h is available
15007 set gdbm.h t_gdbm
15008 eval $inhdr
15009 case "$t_gdbm" in
15010 $define)
15011         : see if gdbm_open exists
15012         set gdbm_open d_gdbm_open
15013         eval $inlibc
15014         case "$d_gdbm_open" in
15015         $undef)
15016                 t_gdbm="$undef"
15017                 echo "We won't be including <gdbm.h>"
15018                 ;;
15019         esac
15020         ;;
15021 esac
15022 val="$t_gdbm"
15023 set i_gdbm
15024 eval $setvar
15025
15026 echo " "
15027 echo "Looking for extensions..." >&4
15028 : If we are using the old config.sh, known_extensions may contain
15029 : old or inaccurate or duplicate values.
15030 known_extensions=''
15031 nonxs_extensions=''
15032 : We do not use find because it might not be available.
15033 : We do not just use MANIFEST because the user may have dropped
15034 : some additional extensions into the source tree and expect them
15035 : to be built.
15036
15037 : Function to recursively find available extensions, ignoring DynaLoader
15038 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
15039 find_extensions='
15040     for xxx in *; do
15041        case "$xxx" in
15042            DynaLoader|dynaload) ;;
15043            *)
15044            if $test -f $xxx/$xxx.xs; then
15045                known_extensions="$known_extensions $1$xxx";
15046            elif $test -f $xxx/Makefile.PL; then
15047                nonxs_extensions="$nonxs_extensions $1$xxx";
15048            else
15049                if $test -d $xxx -a $# -lt 10; then
15050                    set $1$xxx/ $*;
15051                    cd $xxx;
15052                    eval $find_extensions;
15053                    cd ..;
15054                    shift;
15055                fi;
15056            fi
15057            ;;
15058        esac;
15059     done'
15060 tdir=`pwd`
15061 cd $rsrc/ext
15062 set X
15063 shift
15064 eval $find_extensions
15065 set X $nonxs_extensions
15066 shift
15067 nonxs_extensions="$*"
15068 set X $known_extensions
15069 shift
15070 known_extensions="$*"
15071 cd $tdir
15072
15073 : Now see which are supported on this system.
15074 avail_ext=''
15075 for xxx in $known_extensions ; do
15076         case "$xxx" in
15077         DB_File|db_file)
15078                 case "$i_db" in
15079                 $define) avail_ext="$avail_ext $xxx" ;;
15080                 esac
15081                 ;;
15082         GDBM_File|gdbm_fil)
15083                 case "$i_gdbm" in 
15084                 $define) avail_ext="$avail_ext $xxx" ;;
15085                 esac
15086                 ;;
15087         NDBM_File|ndbm_fil)
15088                 case "$i_ndbm" in
15089                 $define)
15090                     case "$osname-$use64bitint" in
15091                     hpux-define)
15092                         case "$libs" in
15093                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
15094                         esac
15095                         ;;
15096                     *) avail_ext="$avail_ext $xxx" ;;
15097                     esac
15098                     ;;
15099                 esac
15100                 ;;
15101         ODBM_File|odbm_fil) 
15102                 case "${i_dbm}${i_rpcsvcdbm}" in
15103                 *"${define}"*)
15104                     case "$osname-$use64bitint" in
15105                     hpux-define)
15106                         case "$libs" in
15107                         *-ldbm*) avail_ext="$avail_ext $xxx" ;;
15108                         esac
15109                         ;;
15110                     *) avail_ext="$avail_ext $xxx" ;;
15111                     esac
15112                     ;;
15113                 esac
15114                 ;;
15115         POSIX|posix)
15116                 case "$useposix" in
15117                 true|define|y) avail_ext="$avail_ext $xxx" ;;
15118                 esac
15119                 ;;
15120         Opcode|opcode)
15121                 case "$useopcode" in
15122                 true|define|y) avail_ext="$avail_ext $xxx" ;;
15123                 esac
15124                 ;;
15125         Socket|socket)
15126                 case "$d_socket" in 
15127                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
15128                 esac
15129                 ;;
15130         Sys/Syslog|sys/syslog)
15131                 : XXX syslog requires socket
15132                 case "$d_socket" in 
15133                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
15134                 esac
15135                 ;;
15136         Thread|thread)
15137                 case "$usethreads" in 
15138                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
15139                 esac
15140                 ;;
15141         IPC/SysV|ipc/sysv)
15142                 : XXX Do we need a useipcsysv variable here
15143                 case "${d_msg}${d_sem}${d_shm}" in 
15144                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
15145                 esac
15146                 ;;
15147         *)      avail_ext="$avail_ext $xxx"
15148                 ;;
15149         esac
15150 done
15151
15152 set X $avail_ext
15153 shift
15154 avail_ext="$*"
15155
15156 : Now see which nonxs extensions are supported on this system.
15157 : For now assume all are.
15158 nonxs_ext=''
15159 for xxx in $nonxs_extensions ; do
15160         case "$xxx" in
15161         *)      nonxs_ext="$nonxs_ext $xxx"
15162                 ;;
15163         esac
15164 done
15165
15166 set X $nonxs_ext
15167 shift
15168 nonxs_ext="$*"
15169
15170 case $usedl in
15171 $define)
15172         $cat <<EOM
15173 A number of extensions are supplied with $package.  You may choose to
15174 compile these extensions for dynamic loading (the default), compile
15175 them into the $package executable (static loading), or not include
15176 them at all.  Answer "none" to include no extensions.
15177 Note that DynaLoader is always built and need not be mentioned here.
15178
15179 EOM
15180         case "$dynamic_ext" in
15181         '') dflt="$avail_ext" ;;
15182         *)      dflt="$dynamic_ext"
15183                 # Perhaps we are reusing an old out-of-date config.sh.
15184                 case "$hint" in
15185                 previous)
15186                         if test X"$dynamic_ext" != X"$avail_ext"; then
15187                                 $cat <<EOM
15188 NOTICE:  Your previous config.sh list may be incorrect. 
15189 The extensions now available to you are 
15190         ${avail_ext}
15191 but the default list from your previous config.sh is
15192         ${dynamic_ext} 
15193
15194 EOM
15195                         fi
15196                         ;;
15197                 esac
15198                 ;;
15199         esac
15200         case "$dflt" in
15201         '')     dflt=none;;
15202         esac
15203         rp="What extensions do you wish to load dynamically?"
15204         . ./myread
15205         case "$ans" in
15206         none) dynamic_ext=' ' ;;
15207         *) dynamic_ext="$ans" ;;
15208         esac
15209
15210         case "$static_ext" in
15211         '')
15212                 : Exclude those already listed in dynamic linking
15213                 dflt=''
15214                 for xxx in $avail_ext; do
15215                         case " $dynamic_ext " in
15216                         *" $xxx "*) ;;
15217                         *) dflt="$dflt $xxx" ;;
15218                         esac
15219                 done
15220                 set X $dflt
15221                 shift
15222                 dflt="$*"
15223                 ;;
15224         *)  dflt="$static_ext" 
15225                 ;;
15226         esac
15227
15228         case "$dflt" in
15229         '')     dflt=none;;
15230         esac
15231         rp="What extensions do you wish to load statically?"
15232         . ./myread
15233         case "$ans" in
15234         none) static_ext=' ' ;;
15235         *) static_ext="$ans" ;;
15236         esac
15237         ;;
15238 *)
15239         $cat <<EOM
15240 A number of extensions are supplied with $package.  Answer "none" 
15241 to include no extensions. 
15242 Note that DynaLoader is always built and need not be mentioned here.
15243
15244 EOM
15245         case "$static_ext" in
15246         '') dflt="$avail_ext" ;;
15247         *)      dflt="$static_ext"
15248                 # Perhaps we are reusing an old out-of-date config.sh.
15249                 case "$hint" in
15250                 previous)
15251                         if test X"$static_ext" != X"$avail_ext"; then
15252                                 $cat <<EOM
15253 NOTICE:  Your previous config.sh list may be incorrect. 
15254 The extensions now available to you are 
15255         ${avail_ext}
15256 but the default list from your previous config.sh is
15257         ${static_ext} 
15258
15259 EOM
15260                         fi
15261                         ;;
15262                 esac
15263                 ;;
15264         esac
15265         : Exclude those that are not xs extensions
15266         case "$dflt" in
15267         '')     dflt=none;;
15268         esac
15269         rp="What extensions do you wish to include?"
15270         . ./myread
15271         case "$ans" in
15272         none) static_ext=' ' ;;
15273         *) static_ext="$ans" ;;
15274         esac
15275         ;;
15276 esac
15277
15278 set X $dynamic_ext $static_ext $nonxs_ext
15279 shift
15280 extensions="$*"
15281
15282 : Remove build directory name from cppstdin so it can be used from
15283 : either the present location or the final installed location.
15284 echo " "
15285 : Get out of the UU directory to get correct path name.
15286 cd ..
15287 case "$cppstdin" in
15288 `pwd`/cppstdin)
15289         echo "Stripping down cppstdin path name"
15290         cppstdin=cppstdin
15291         ;;
15292 esac
15293 cd UU
15294
15295 : end of configuration questions
15296 echo " "
15297 echo "End of configuration questions."
15298 echo " "
15299
15300 : back to where it started
15301 if test -d ../UU; then
15302         cd ..
15303 fi
15304
15305 : configuration may be patched via a 'config.over' file
15306 if $test -f config.over; then
15307         echo " "
15308         dflt=y
15309         rp='I see a config.over file.  Do you wish to load it?'
15310         . UU/myread
15311         case "$ans" in
15312         n*) echo "OK, I'll ignore it.";;
15313         *)      . ./config.over
15314                 echo "Configuration override changes have been loaded."
15315                 ;;
15316         esac
15317 fi
15318
15319 : in case they want portability, strip down executable paths
15320 case "$d_portable" in
15321 "$define")
15322         echo " "
15323         echo "Stripping down executable paths..." >&4
15324         for file in $loclist $trylist; do
15325                 eval temp=\$$file
15326                 eval $file=`basename $temp`
15327         done
15328         ;;
15329 esac
15330
15331 : create config.sh file
15332 echo " "
15333 echo "Creating config.sh..." >&4
15334 $spitshell <<EOT >config.sh
15335 $startsh
15336 #
15337 # This file was produced by running the Configure script. It holds all the
15338 # definitions figured out by Configure. Should you modify one of these values,
15339 # do not forget to propagate your changes by running "Configure -der". You may
15340 # instead choose to run each of the .SH files by yourself, or "Configure -S".
15341 #
15342
15343 # Package name      : $package
15344 # Source directory  : $src
15345 # Configuration time: $cf_time
15346 # Configured by     : $cf_by
15347 # Target system     : $myuname
15348
15349 Author='$Author'
15350 Date='$Date'
15351 Header='$Header'
15352 Id='$Id'
15353 Locker='$Locker'
15354 Log='$Log'
15355 Mcc='$Mcc'
15356 RCSfile='$RCSfile'
15357 Revision='$Revision'
15358 Source='$Source'
15359 State='$State'
15360 _a='$_a'
15361 _exe='$_exe'
15362 _o='$_o'
15363 afs='$afs'
15364 alignbytes='$alignbytes'
15365 ansi2knr='$ansi2knr'
15366 aphostname='$aphostname'
15367 api_revision='$api_revision'
15368 api_subversion='$api_subversion'
15369 api_version='$api_version'
15370 api_versionstring='$api_versionstring'
15371 ar='$ar'
15372 archlib='$archlib'
15373 archlibexp='$archlibexp'
15374 archname64='$archname64'
15375 archname='$archname'
15376 archobjs='$archobjs'
15377 awk='$awk'
15378 baserev='$baserev'
15379 bash='$bash'
15380 bin='$bin'
15381 bincompat5005='$bincompat5005'
15382 binexp='$binexp'
15383 bison='$bison'
15384 byacc='$byacc'
15385 byteorder='$byteorder'
15386 c='$c'
15387 castflags='$castflags'
15388 cat='$cat'
15389 cc='$cc'
15390 cccdlflags='$cccdlflags'
15391 ccdlflags='$ccdlflags'
15392 ccflags='$ccflags'
15393 ccflags_uselargefiles='$ccflags_uselargefiles'
15394 ccsymbols='$ccsymbols'
15395 cf_by='$cf_by'
15396 cf_email='$cf_email'
15397 cf_time='$cf_time'
15398 charsize='$charsize'
15399 chgrp='$chgrp'
15400 chmod='$chmod'
15401 chown='$chown'
15402 clocktype='$clocktype'
15403 comm='$comm'
15404 compress='$compress'
15405 contains='$contains'
15406 cp='$cp'
15407 cpio='$cpio'
15408 cpp='$cpp'
15409 cpp_stuff='$cpp_stuff'
15410 cppccsymbols='$cppccsymbols'
15411 cppflags='$cppflags'
15412 cpplast='$cpplast'
15413 cppminus='$cppminus'
15414 cpprun='$cpprun'
15415 cppstdin='$cppstdin'
15416 cppsymbols='$cppsymbols'
15417 crosscompile='$crosscompile'
15418 cryptlib='$cryptlib'
15419 csh='$csh'
15420 d_Gconvert='$d_Gconvert'
15421 d_PRIEldbl='$d_PRIEldbl'
15422 d_PRIFldbl='$d_PRIFldbl'
15423 d_PRIGldbl='$d_PRIGldbl'
15424 d_PRIX64='$d_PRIX64'
15425 d_PRId64='$d_PRId64'
15426 d_PRIeldbl='$d_PRIeldbl'
15427 d_PRIfldbl='$d_PRIfldbl'
15428 d_PRIgldbl='$d_PRIgldbl'
15429 d_PRIi64='$d_PRIi64'
15430 d_PRIo64='$d_PRIo64'
15431 d_PRIu64='$d_PRIu64'
15432 d_PRIx64='$d_PRIx64'
15433 d_access='$d_access'
15434 d_accessx='$d_accessx'
15435 d_alarm='$d_alarm'
15436 d_archlib='$d_archlib'
15437 d_atolf='$d_atolf'
15438 d_atoll='$d_atoll'
15439 d_attribut='$d_attribut'
15440 d_bcmp='$d_bcmp'
15441 d_bcopy='$d_bcopy'
15442 d_bincompat5005='$d_bincompat5005'
15443 d_bsd='$d_bsd'
15444 d_bsdgetpgrp='$d_bsdgetpgrp'
15445 d_bsdsetpgrp='$d_bsdsetpgrp'
15446 d_bzero='$d_bzero'
15447 d_casti32='$d_casti32'
15448 d_castneg='$d_castneg'
15449 d_charvspr='$d_charvspr'
15450 d_chown='$d_chown'
15451 d_chroot='$d_chroot'
15452 d_chsize='$d_chsize'
15453 d_closedir='$d_closedir'
15454 d_const='$d_const'
15455 d_crypt='$d_crypt'
15456 d_csh='$d_csh'
15457 d_cuserid='$d_cuserid'
15458 d_dbl_dig='$d_dbl_dig'
15459 d_difftime='$d_difftime'
15460 d_dirnamlen='$d_dirnamlen'
15461 d_dlerror='$d_dlerror'
15462 d_dlopen='$d_dlopen'
15463 d_dlsymun='$d_dlsymun'
15464 d_dosuid='$d_dosuid'
15465 d_drand48proto='$d_drand48proto'
15466 d_dup2='$d_dup2'
15467 d_eaccess='$d_eaccess'
15468 d_endgrent='$d_endgrent'
15469 d_endhent='$d_endhent'
15470 d_endnent='$d_endnent'
15471 d_endpent='$d_endpent'
15472 d_endpwent='$d_endpwent'
15473 d_endsent='$d_endsent'
15474 d_eofnblk='$d_eofnblk'
15475 d_eunice='$d_eunice'
15476 d_fchmod='$d_fchmod'
15477 d_fchown='$d_fchown'
15478 d_fcntl='$d_fcntl'
15479 d_fd_macros='$d_fd_macros'
15480 d_fd_set='$d_fd_set'
15481 d_fds_bits='$d_fds_bits'
15482 d_fgetpos='$d_fgetpos'
15483 d_flexfnam='$d_flexfnam'
15484 d_flock='$d_flock'
15485 d_fork='$d_fork'
15486 d_fpathconf='$d_fpathconf'
15487 d_fpos64_t='$d_fpos64_t'
15488 d_frexpl='$d_frexpl'
15489 d_fs_data_s='$d_fs_data_s'
15490 d_fseeko='$d_fseeko'
15491 d_fsetpos='$d_fsetpos'
15492 d_fstatfs='$d_fstatfs'
15493 d_fstatvfs='$d_fstatvfs'
15494 d_ftello='$d_ftello'
15495 d_ftime='$d_ftime'
15496 d_getcwd='$d_getcwd'
15497 d_getespwnam='$d_getespwnam'
15498 d_getfsstat='$d_getfsstat'
15499 d_getgrent='$d_getgrent'
15500 d_getgrps='$d_getgrps'
15501 d_gethbyaddr='$d_gethbyaddr'
15502 d_gethbyname='$d_gethbyname'
15503 d_gethent='$d_gethent'
15504 d_gethname='$d_gethname'
15505 d_gethostprotos='$d_gethostprotos'
15506 d_getlogin='$d_getlogin'
15507 d_getmnt='$d_getmnt'
15508 d_getmntent='$d_getmntent'
15509 d_getnbyaddr='$d_getnbyaddr'
15510 d_getnbyname='$d_getnbyname'
15511 d_getnent='$d_getnent'
15512 d_getnetprotos='$d_getnetprotos'
15513 d_getpbyname='$d_getpbyname'
15514 d_getpbynumber='$d_getpbynumber'
15515 d_getpent='$d_getpent'
15516 d_getpgid='$d_getpgid'
15517 d_getpgrp2='$d_getpgrp2'
15518 d_getpgrp='$d_getpgrp'
15519 d_getppid='$d_getppid'
15520 d_getprior='$d_getprior'
15521 d_getprotoprotos='$d_getprotoprotos'
15522 d_getprpwnam='$d_getprpwnam'
15523 d_getpwent='$d_getpwent'
15524 d_getsbyname='$d_getsbyname'
15525 d_getsbyport='$d_getsbyport'
15526 d_getsent='$d_getsent'
15527 d_getservprotos='$d_getservprotos'
15528 d_getspnam='$d_getspnam'
15529 d_gettimeod='$d_gettimeod'
15530 d_gnulibc='$d_gnulibc'
15531 d_grpasswd='$d_grpasswd'
15532 d_hasmntopt='$d_hasmntopt'
15533 d_htonl='$d_htonl'
15534 d_iconv='$d_iconv'
15535 d_index='$d_index'
15536 d_inetaton='$d_inetaton'
15537 d_int64_t='$d_int64_t'
15538 d_isascii='$d_isascii'
15539 d_isnan='$d_isnan'
15540 d_isnanl='$d_isnanl'
15541 d_killpg='$d_killpg'
15542 d_lchown='$d_lchown'
15543 d_ldbl_dig='$d_ldbl_dig'
15544 d_link='$d_link'
15545 d_locconv='$d_locconv'
15546 d_lockf='$d_lockf'
15547 d_longdbl='$d_longdbl'
15548 d_longlong='$d_longlong'
15549 d_lseekproto='$d_lseekproto'
15550 d_lstat='$d_lstat'
15551 d_madvise='$d_madvise'
15552 d_mblen='$d_mblen'
15553 d_mbstowcs='$d_mbstowcs'
15554 d_mbtowc='$d_mbtowc'
15555 d_memchr='$d_memchr'
15556 d_memcmp='$d_memcmp'
15557 d_memcpy='$d_memcpy'
15558 d_memmove='$d_memmove'
15559 d_memset='$d_memset'
15560 d_mkdir='$d_mkdir'
15561 d_mkdtemp='$d_mkdtemp'
15562 d_mkfifo='$d_mkfifo'
15563 d_mkstemp='$d_mkstemp'
15564 d_mkstemps='$d_mkstemps'
15565 d_mktime='$d_mktime'
15566 d_mmap='$d_mmap'
15567 d_modfl='$d_modfl'
15568 d_mprotect='$d_mprotect'
15569 d_msg='$d_msg'
15570 d_msg_ctrunc='$d_msg_ctrunc'
15571 d_msg_dontroute='$d_msg_dontroute'
15572 d_msg_oob='$d_msg_oob'
15573 d_msg_peek='$d_msg_peek'
15574 d_msg_proxy='$d_msg_proxy'
15575 d_msgctl='$d_msgctl'
15576 d_msgget='$d_msgget'
15577 d_msgrcv='$d_msgrcv'
15578 d_msgsnd='$d_msgsnd'
15579 d_msync='$d_msync'
15580 d_munmap='$d_munmap'
15581 d_mymalloc='$d_mymalloc'
15582 d_nice='$d_nice'
15583 d_nv_preserves_uv='$d_nv_preserves_uv'
15584 d_nv_preserves_uv_bits='$d_nv_preserves_uv_bits'
15585 d_off64_t='$d_off64_t'
15586 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
15587 d_oldpthreads='$d_oldpthreads'
15588 d_oldsock='$d_oldsock'
15589 d_open3='$d_open3'
15590 d_pathconf='$d_pathconf'
15591 d_pause='$d_pause'
15592 d_perl_otherlibdirs='$d_perl_otherlibdirs'
15593 d_phostname='$d_phostname'
15594 d_pipe='$d_pipe'
15595 d_poll='$d_poll'
15596 d_portable='$d_portable'
15597 d_pthread_yield='$d_pthread_yield'
15598 d_pwage='$d_pwage'
15599 d_pwchange='$d_pwchange'
15600 d_pwclass='$d_pwclass'
15601 d_pwcomment='$d_pwcomment'
15602 d_pwexpire='$d_pwexpire'
15603 d_pwgecos='$d_pwgecos'
15604 d_pwpasswd='$d_pwpasswd'
15605 d_pwquota='$d_pwquota'
15606 d_qgcvt='$d_qgcvt'
15607 d_quad='$d_quad'
15608 d_readdir='$d_readdir'
15609 d_readlink='$d_readlink'
15610 d_rename='$d_rename'
15611 d_rewinddir='$d_rewinddir'
15612 d_rmdir='$d_rmdir'
15613 d_safebcpy='$d_safebcpy'
15614 d_safemcpy='$d_safemcpy'
15615 d_sanemcmp='$d_sanemcmp'
15616 d_sched_yield='$d_sched_yield'
15617 d_scm_rights='$d_scm_rights'
15618 d_seekdir='$d_seekdir'
15619 d_select='$d_select'
15620 d_sem='$d_sem'
15621 d_semctl='$d_semctl'
15622 d_semctl_semid_ds='$d_semctl_semid_ds'
15623 d_semctl_semun='$d_semctl_semun'
15624 d_semget='$d_semget'
15625 d_semop='$d_semop'
15626 d_setegid='$d_setegid'
15627 d_seteuid='$d_seteuid'
15628 d_setgrent='$d_setgrent'
15629 d_setgrps='$d_setgrps'
15630 d_sethent='$d_sethent'
15631 d_setlinebuf='$d_setlinebuf'
15632 d_setlocale='$d_setlocale'
15633 d_setnent='$d_setnent'
15634 d_setpent='$d_setpent'
15635 d_setpgid='$d_setpgid'
15636 d_setpgrp2='$d_setpgrp2'
15637 d_setpgrp='$d_setpgrp'
15638 d_setprior='$d_setprior'
15639 d_setproctitle='$d_setproctitle'
15640 d_setpwent='$d_setpwent'
15641 d_setregid='$d_setregid'
15642 d_setresgid='$d_setresgid'
15643 d_setresuid='$d_setresuid'
15644 d_setreuid='$d_setreuid'
15645 d_setrgid='$d_setrgid'
15646 d_setruid='$d_setruid'
15647 d_setsent='$d_setsent'
15648 d_setsid='$d_setsid'
15649 d_setvbuf='$d_setvbuf'
15650 d_sfio='$d_sfio'
15651 d_shm='$d_shm'
15652 d_shmat='$d_shmat'
15653 d_shmatprototype='$d_shmatprototype'
15654 d_shmctl='$d_shmctl'
15655 d_shmdt='$d_shmdt'
15656 d_shmget='$d_shmget'
15657 d_sigaction='$d_sigaction'
15658 d_sigsetjmp='$d_sigsetjmp'
15659 d_socket='$d_socket'
15660 d_socklen_t='$d_socklen_t'
15661 d_sockpair='$d_sockpair'
15662 d_socks5_init='$d_socks5_init'
15663 d_sqrtl='$d_sqrtl'
15664 d_statblks='$d_statblks'
15665 d_statfs_f_flags='$d_statfs_f_flags'
15666 d_statfs_s='$d_statfs_s'
15667 d_statvfs='$d_statvfs'
15668 d_stdio_cnt_lval='$d_stdio_cnt_lval'
15669 d_stdio_ptr_lval='$d_stdio_ptr_lval'
15670 d_stdio_stream_array='$d_stdio_stream_array'
15671 d_stdiobase='$d_stdiobase'
15672 d_stdstdio='$d_stdstdio'
15673 d_strchr='$d_strchr'
15674 d_strcoll='$d_strcoll'
15675 d_strctcpy='$d_strctcpy'
15676 d_strerrm='$d_strerrm'
15677 d_strerror='$d_strerror'
15678 d_strtod='$d_strtod'
15679 d_strtol='$d_strtol'
15680 d_strtold='$d_strtold'
15681 d_strtoll='$d_strtoll'
15682 d_strtoul='$d_strtoul'
15683 d_strtoull='$d_strtoull'
15684 d_strtouq='$d_strtouq'
15685 d_strxfrm='$d_strxfrm'
15686 d_suidsafe='$d_suidsafe'
15687 d_symlink='$d_symlink'
15688 d_syscall='$d_syscall'
15689 d_sysconf='$d_sysconf'
15690 d_sysernlst='$d_sysernlst'
15691 d_syserrlst='$d_syserrlst'
15692 d_system='$d_system'
15693 d_tcgetpgrp='$d_tcgetpgrp'
15694 d_tcsetpgrp='$d_tcsetpgrp'
15695 d_telldir='$d_telldir'
15696 d_telldirproto='$d_telldirproto'
15697 d_time='$d_time'
15698 d_times='$d_times'
15699 d_truncate='$d_truncate'
15700 d_tzname='$d_tzname'
15701 d_umask='$d_umask'
15702 d_uname='$d_uname'
15703 d_union_semun='$d_union_semun'
15704 d_ustat='$d_ustat'
15705 d_vendorarch='$d_vendorarch'
15706 d_vendorbin='$d_vendorbin'
15707 d_vendorlib='$d_vendorlib'
15708 d_vfork='$d_vfork'
15709 d_void_closedir='$d_void_closedir'
15710 d_voidsig='$d_voidsig'
15711 d_voidtty='$d_voidtty'
15712 d_volatile='$d_volatile'
15713 d_vprintf='$d_vprintf'
15714 d_wait4='$d_wait4'
15715 d_waitpid='$d_waitpid'
15716 d_wcstombs='$d_wcstombs'
15717 d_wctomb='$d_wctomb'
15718 d_xenix='$d_xenix'
15719 date='$date'
15720 db_hashtype='$db_hashtype'
15721 db_prefixtype='$db_prefixtype'
15722 defvoidused='$defvoidused'
15723 direntrytype='$direntrytype'
15724 dlext='$dlext'
15725 dlsrc='$dlsrc'
15726 doublesize='$doublesize'
15727 drand01='$drand01'
15728 dynamic_ext='$dynamic_ext'
15729 eagain='$eagain'
15730 ebcdic='$ebcdic'
15731 echo='$echo'
15732 egrep='$egrep'
15733 emacs='$emacs'
15734 eunicefix='$eunicefix'
15735 exe_ext='$exe_ext'
15736 expr='$expr'
15737 extensions='$extensions'
15738 fflushNULL='$fflushNULL'
15739 fflushall='$fflushall'
15740 find='$find'
15741 firstmakefile='$firstmakefile'
15742 flex='$flex'
15743 fpossize='$fpossize'
15744 fpostype='$fpostype'
15745 freetype='$freetype'
15746 full_ar='$full_ar'
15747 full_csh='$full_csh'
15748 full_sed='$full_sed'
15749 gccosandvers='$gccosandvers'
15750 gccversion='$gccversion'
15751 gidformat='$gidformat'
15752 gidsign='$gidsign'
15753 gidsize='$gidsize'
15754 gidtype='$gidtype'
15755 glibpth='$glibpth'
15756 grep='$grep'
15757 groupcat='$groupcat'
15758 groupstype='$groupstype'
15759 gzip='$gzip'
15760 h_fcntl='$h_fcntl'
15761 h_sysfile='$h_sysfile'
15762 hint='$hint'
15763 hostcat='$hostcat'
15764 huge='$huge'
15765 i16size='$i16size'
15766 i16type='$i16type'
15767 i32size='$i32size'
15768 i32type='$i32type'
15769 i64size='$i64size'
15770 i64type='$i64type'
15771 i8size='$i8size'
15772 i8type='$i8type'
15773 i_arpainet='$i_arpainet'
15774 i_bsdioctl='$i_bsdioctl'
15775 i_db='$i_db'
15776 i_dbm='$i_dbm'
15777 i_dirent='$i_dirent'
15778 i_dld='$i_dld'
15779 i_dlfcn='$i_dlfcn'
15780 i_fcntl='$i_fcntl'
15781 i_float='$i_float'
15782 i_gdbm='$i_gdbm'
15783 i_grp='$i_grp'
15784 i_iconv='$i_iconv'
15785 i_ieeefp='$i_ieeefp'
15786 i_inttypes='$i_inttypes'
15787 i_libutil='$i_libutil'
15788 i_limits='$i_limits'
15789 i_locale='$i_locale'
15790 i_machcthr='$i_machcthr'
15791 i_malloc='$i_malloc'
15792 i_math='$i_math'
15793 i_memory='$i_memory'
15794 i_mntent='$i_mntent'
15795 i_ndbm='$i_ndbm'
15796 i_netdb='$i_netdb'
15797 i_neterrno='$i_neterrno'
15798 i_netinettcp='$i_netinettcp'
15799 i_niin='$i_niin'
15800 i_poll='$i_poll'
15801 i_prot='$i_prot'
15802 i_pthread='$i_pthread'
15803 i_pwd='$i_pwd'
15804 i_rpcsvcdbm='$i_rpcsvcdbm'
15805 i_sfio='$i_sfio'
15806 i_sgtty='$i_sgtty'
15807 i_shadow='$i_shadow'
15808 i_socks='$i_socks'
15809 i_stdarg='$i_stdarg'
15810 i_stddef='$i_stddef'
15811 i_stdlib='$i_stdlib'
15812 i_string='$i_string'
15813 i_sunmath='$i_sunmath'
15814 i_sysaccess='$i_sysaccess'
15815 i_sysdir='$i_sysdir'
15816 i_sysfile='$i_sysfile'
15817 i_sysfilio='$i_sysfilio'
15818 i_sysin='$i_sysin'
15819 i_sysioctl='$i_sysioctl'
15820 i_syslog='$i_syslog'
15821 i_sysmman='$i_sysmman'
15822 i_sysmode='$i_sysmode'
15823 i_sysmount='$i_sysmount'
15824 i_sysndir='$i_sysndir'
15825 i_sysparam='$i_sysparam'
15826 i_sysresrc='$i_sysresrc'
15827 i_syssecrt='$i_syssecrt'
15828 i_sysselct='$i_sysselct'
15829 i_syssockio='$i_syssockio'
15830 i_sysstat='$i_sysstat'
15831 i_sysstatfs='$i_sysstatfs'
15832 i_sysstatvfs='$i_sysstatvfs'
15833 i_systime='$i_systime'
15834 i_systimek='$i_systimek'
15835 i_systimes='$i_systimes'
15836 i_systypes='$i_systypes'
15837 i_sysuio='$i_sysuio'
15838 i_sysun='$i_sysun'
15839 i_sysutsname='$i_sysutsname'
15840 i_sysvfs='$i_sysvfs'
15841 i_syswait='$i_syswait'
15842 i_termio='$i_termio'
15843 i_termios='$i_termios'
15844 i_time='$i_time'
15845 i_unistd='$i_unistd'
15846 i_ustat='$i_ustat'
15847 i_utime='$i_utime'
15848 i_values='$i_values'
15849 i_varargs='$i_varargs'
15850 i_varhdr='$i_varhdr'
15851 i_vfork='$i_vfork'
15852 ignore_versioned_solibs='$ignore_versioned_solibs'
15853 inc_version_list='$inc_version_list'
15854 inc_version_list_init='$inc_version_list_init'
15855 incpath='$incpath'
15856 inews='$inews'
15857 installarchlib='$installarchlib'
15858 installbin='$installbin'
15859 installman1dir='$installman1dir'
15860 installman3dir='$installman3dir'
15861 installprefix='$installprefix'
15862 installprefixexp='$installprefixexp'
15863 installprivlib='$installprivlib'
15864 installscript='$installscript'
15865 installsitearch='$installsitearch'
15866 installsitebin='$installsitebin'
15867 installsitelib='$installsitelib'
15868 installstyle='$installstyle'
15869 installusrbinperl='$installusrbinperl'
15870 installvendorarch='$installvendorarch'
15871 installvendorbin='$installvendorbin'
15872 installvendorlib='$installvendorlib'
15873 intsize='$intsize'
15874 ivdformat='$ivdformat'
15875 ivsize='$ivsize'
15876 ivtype='$ivtype'
15877 known_extensions='$known_extensions'
15878 ksh='$ksh'
15879 large='$large'
15880 ld='$ld'
15881 lddlflags='$lddlflags'
15882 ldflags='$ldflags'
15883 ldflags_uselargefiles='$ldflags_uselargefiles'
15884 ldlibpthname='$ldlibpthname'
15885 less='$less'
15886 lib_ext='$lib_ext'
15887 libc='$libc'
15888 libperl='$libperl'
15889 libpth='$libpth'
15890 libs='$libs'
15891 libsdirs='$libsdirs'
15892 libsfiles='$libsfiles'
15893 libsfound='$libsfound'
15894 libspath='$libspath'
15895 libswanted='$libswanted'
15896 libswanted_uselargefiles='$libswanted_uselargefiles'
15897 line='$line'
15898 lint='$lint'
15899 lkflags='$lkflags'
15900 ln='$ln'
15901 lns='$lns'
15902 locincpth='$locincpth'
15903 loclibpth='$loclibpth'
15904 longdblsize='$longdblsize'
15905 longlongsize='$longlongsize'
15906 longsize='$longsize'
15907 lp='$lp'
15908 lpr='$lpr'
15909 ls='$ls'
15910 lseeksize='$lseeksize'
15911 lseektype='$lseektype'
15912 mail='$mail'
15913 mailx='$mailx'
15914 make='$make'
15915 make_set_make='$make_set_make'
15916 mallocobj='$mallocobj'
15917 mallocsrc='$mallocsrc'
15918 malloctype='$malloctype'
15919 man1dir='$man1dir'
15920 man1direxp='$man1direxp'
15921 man1ext='$man1ext'
15922 man3dir='$man3dir'
15923 man3direxp='$man3direxp'
15924 man3ext='$man3ext'
15925 medium='$medium'
15926 mips_type='$mips_type'
15927 mkdir='$mkdir'
15928 mmaptype='$mmaptype'
15929 models='$models'
15930 modetype='$modetype'
15931 more='$more'
15932 multiarch='$multiarch'
15933 mv='$mv'
15934 myarchname='$myarchname'
15935 mydomain='$mydomain'
15936 myhostname='$myhostname'
15937 myuname='$myuname'
15938 n='$n'
15939 netdb_hlen_type='$netdb_hlen_type'
15940 netdb_host_type='$netdb_host_type'
15941 netdb_name_type='$netdb_name_type'
15942 netdb_net_type='$netdb_net_type'
15943 nm='$nm'
15944 nm_opt='$nm_opt'
15945 nm_so_opt='$nm_so_opt'
15946 nonxs_ext='$nonxs_ext'
15947 nroff='$nroff'
15948 nvEformat='$nvEformat'
15949 nvFformat='$nvFformat'
15950 nvGformat='$nvGformat'
15951 nveformat='$nveformat'
15952 nvfformat='$nvfformat'
15953 nvgformat='$nvgformat'
15954 nvsize='$nvsize'
15955 nvtype='$nvtype'
15956 o_nonblock='$o_nonblock'
15957 obj_ext='$obj_ext'
15958 old_pthread_create_joinable='$old_pthread_create_joinable'
15959 optimize='$optimize'
15960 orderlib='$orderlib'
15961 osname='$osname'
15962 osvers='$osvers'
15963 otherlibdirs='$otherlibdirs'
15964 package='$package'
15965 pager='$pager'
15966 passcat='$passcat'
15967 patchlevel='$patchlevel'
15968 path_sep='$path_sep'
15969 perl5='$perl5'
15970 perl='$perl'
15971 perladmin='$perladmin'
15972 perlpath='$perlpath'
15973 pg='$pg'
15974 phostname='$phostname'
15975 pidtype='$pidtype'
15976 plibpth='$plibpth'
15977 pm_apiversion='$pm_apiversion'
15978 pmake='$pmake'
15979 pr='$pr'
15980 prefix='$prefix'
15981 prefixexp='$prefixexp'
15982 privlib='$privlib'
15983 privlibexp='$privlibexp'
15984 prototype='$prototype'
15985 ptrsize='$ptrsize'
15986 quadkind='$quadkind'
15987 quadtype='$quadtype'
15988 randbits='$randbits'
15989 randfunc='$randfunc'
15990 randseedtype='$randseedtype'
15991 ranlib='$ranlib'
15992 rd_nodata='$rd_nodata'
15993 revision='$revision'
15994 rm='$rm'
15995 rmail='$rmail'
15996 runnm='$runnm'
15997 sPRIEldbl='$sPRIEldbl'
15998 sPRIFldbl='$sPRIFldbl'
15999 sPRIGldbl='$sPRIGldbl'
16000 sPRIX64='$sPRIX64'
16001 sPRId64='$sPRId64'
16002 sPRIeldbl='$sPRIeldbl'
16003 sPRIfldbl='$sPRIfldbl'
16004 sPRIgldbl='$sPRIgldbl'
16005 sPRIi64='$sPRIi64'
16006 sPRIo64='$sPRIo64'
16007 sPRIu64='$sPRIu64'
16008 sPRIx64='$sPRIx64'
16009 sched_yield='$sched_yield'
16010 scriptdir='$scriptdir'
16011 scriptdirexp='$scriptdirexp'
16012 sed='$sed'
16013 seedfunc='$seedfunc'
16014 selectminbits='$selectminbits'
16015 selecttype='$selecttype'
16016 sendmail='$sendmail'
16017 sh='$sh'
16018 shar='$shar'
16019 sharpbang='$sharpbang'
16020 shmattype='$shmattype'
16021 shortsize='$shortsize'
16022 shrpenv='$shrpenv'
16023 shsharp='$shsharp'
16024 sig_count='$sig_count'
16025 sig_name='$sig_name'
16026 sig_name_init='$sig_name_init'
16027 sig_num='$sig_num'
16028 sig_num_init='$sig_num_init'
16029 signal_t='$signal_t'
16030 sitearch='$sitearch'
16031 sitearchexp='$sitearchexp'
16032 sitebin='$sitebin'
16033 sitebinexp='$sitebinexp'
16034 sitelib='$sitelib'
16035 sitelib_stem='$sitelib_stem'
16036 sitelibexp='$sitelibexp'
16037 siteprefix='$siteprefix'
16038 siteprefixexp='$siteprefixexp'
16039 sizesize='$sizesize'
16040 sizetype='$sizetype'
16041 sleep='$sleep'
16042 smail='$smail'
16043 small='$small'
16044 so='$so'
16045 sockethdr='$sockethdr'
16046 socketlib='$socketlib'
16047 socksizetype='$socksizetype'
16048 sort='$sort'
16049 spackage='$spackage'
16050 spitshell='$spitshell'
16051 split='$split'
16052 src='$src'
16053 ssizetype='$ssizetype'
16054 startperl='$startperl'
16055 startsh='$startsh'
16056 static_ext='$static_ext'
16057 stdchar='$stdchar'
16058 stdio_base='$stdio_base'
16059 stdio_bufsiz='$stdio_bufsiz'
16060 stdio_cnt='$stdio_cnt'
16061 stdio_filbuf='$stdio_filbuf'
16062 stdio_ptr='$stdio_ptr'
16063 stdio_stream_array='$stdio_stream_array'
16064 strings='$strings'
16065 submit='$submit'
16066 subversion='$subversion'
16067 sysman='$sysman'
16068 tail='$tail'
16069 tar='$tar'
16070 tbl='$tbl'
16071 tee='$tee'
16072 test='$test'
16073 timeincl='$timeincl'
16074 timetype='$timetype'
16075 touch='$touch'
16076 tr='$tr'
16077 trnl='$trnl'
16078 troff='$troff'
16079 u16size='$u16size'
16080 u16type='$u16type'
16081 u32size='$u32size'
16082 u32type='$u32type'
16083 u64size='$u64size'
16084 u64type='$u64type'
16085 u8size='$u8size'
16086 u8type='$u8type'
16087 uidformat='$uidformat'
16088 uidsign='$uidsign'
16089 uidsize='$uidsize'
16090 uidtype='$uidtype'
16091 uname='$uname'
16092 uniq='$uniq'
16093 uquadtype='$uquadtype'
16094 use5005threads='$use5005threads'
16095 use64bitall='$use64bitall'
16096 use64bitint='$use64bitint'
16097 usedl='$usedl'
16098 useithreads='$useithreads'
16099 uselargefiles='$uselargefiles'
16100 uselongdouble='$uselongdouble'
16101 usemorebits='$usemorebits'
16102 usemultiplicity='$usemultiplicity'
16103 usemymalloc='$usemymalloc'
16104 usenm='$usenm'
16105 useopcode='$useopcode'
16106 useperlio='$useperlio'
16107 useposix='$useposix'
16108 usesfio='$usesfio'
16109 useshrplib='$useshrplib'
16110 usesocks='$usesocks'
16111 usethreads='$usethreads'
16112 usevendorprefix='$usevendorprefix'
16113 usevfork='$usevfork'
16114 usrinc='$usrinc'
16115 uuname='$uuname'
16116 uvXformat='$uvXformat'
16117 uvoformat='$uvoformat'
16118 uvsize='$uvsize'
16119 uvtype='$uvtype'
16120 uvuformat='$uvuformat'
16121 uvxformat='$uvxformat'
16122 vendorarch='$vendorarch'
16123 vendorarchexp='$vendorarchexp'
16124 vendorbin='$vendorbin'
16125 vendorbinexp='$vendorbinexp'
16126 vendorlib='$vendorlib'
16127 vendorlib_stem='$vendorlib_stem'
16128 vendorlibexp='$vendorlibexp'
16129 vendorprefix='$vendorprefix'
16130 vendorprefixexp='$vendorprefixexp'
16131 version='$version'
16132 vi='$vi'
16133 voidflags='$voidflags'
16134 xlibpth='$xlibpth'
16135 xs_apiversion='$xs_apiversion'
16136 zcat='$zcat'
16137 zip='$zip'
16138 EOT
16139
16140 : Add in command line options if available
16141 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
16142
16143 : add special variables
16144 $test -f $src/patchlevel.h && \
16145 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
16146 echo "CONFIGDOTSH=true" >>config.sh
16147
16148 : propagate old symbols
16149 if $test -f UU/config.sh; then
16150         <UU/config.sh sort | uniq >UU/oldconfig.sh
16151         sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
16152         sort | uniq -u >UU/oldsyms
16153         set X `cat UU/oldsyms`
16154         shift
16155         case $# in
16156         0) ;;
16157         *)
16158                 cat <<EOM
16159 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
16160 EOM
16161                 echo "# Variables propagated from previous config.sh file." >>config.sh
16162                 for sym in `cat UU/oldsyms`; do
16163                         echo "    Propagating $hint variable "'$'"$sym..."
16164                         eval 'tmp="$'"${sym}"'"'
16165                         echo "$tmp" | \
16166                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
16167                 done
16168                 ;;
16169         esac
16170 fi
16171
16172 : Finish up by extracting the .SH files
16173 case "$alldone" in
16174 exit)
16175         $rm -rf UU
16176         echo "Done."
16177         exit 0
16178         ;;
16179 cont)
16180         ;;
16181 '')
16182         dflt=''
16183         nostick=true
16184         $cat <<EOM
16185
16186 If you'd like to make any changes to the config.sh file before I begin
16187 to configure things, do it as a shell escape now (e.g. !vi config.sh).
16188
16189 EOM
16190         rp="Press return or use a shell escape to edit config.sh:"
16191         . UU/myread
16192         nostick=''
16193         case "$ans" in
16194         '') ;;
16195         *) : in case they cannot read
16196                 sh 1>&4 -c "$ans";;
16197         esac
16198         ;;
16199 esac
16200
16201 : if this fails, just run all the .SH files by hand
16202 . ./config.sh
16203
16204 echo " "
16205 exec 1>&4
16206 . ./UU/extract
16207
16208 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
16209         dflt=y
16210         case "$silent" in
16211         true) ;;
16212         *)
16213                 $cat <<EOM
16214
16215 Now you need to generate make dependencies by running "$make depend".
16216 You might prefer to run it in background: "$make depend > makedepend.out &"
16217 It can take a while, so you might not want to run it right now.
16218
16219 EOM
16220                 ;;
16221         esac
16222         rp="Run $make depend now?"
16223         . UU/myread
16224         case "$ans" in
16225         y*)
16226                 $make depend && echo "Now you must run a $make."
16227                 ;;
16228         *)
16229                 echo "You must run '$make depend' then '$make'."
16230                 ;;
16231         esac
16232 elif test -f [Mm]akefile; then
16233         echo " "
16234         echo "Now you must run a $make."
16235 else
16236         echo "Done."
16237 fi
16238
16239 if $test -f Policy.sh; then
16240     $cat <<EOM
16241
16242 If you compile $package on a different machine or from a different object
16243 directory, copy the Policy.sh file from this object directory to the
16244 new one before you run Configure -- this will help you with most of
16245 the policy defaults.
16246
16247 EOM
16248 fi
16249 if $test -f config.msg; then
16250     echo "Hmm.  I also noted the following information while running:"
16251     echo " "
16252     $cat config.msg >&4
16253     $rm -f config.msg
16254 fi
16255 $rm -f kit*isdone ark*isdone
16256 $rm -rf UU
16257
16258 : End of Configure
16259