d4b6dba8561d9c7911809c817137bc6618be66a9
[p5sagit/p5-mst-13.2.git] / Configure
1 #! /bin/sh
2 #
3 # If these # comments don't work, trim them. Don't worry about any other
4 # shell scripts, Configure will trim # comments from them for you.
5 #
6 # (If you are trying to port this package to a machine without sh,
7 # I would suggest you have a look at the prototypical config_h.SH file
8 # and edit it to reflect your system. Some packages may include samples
9 # of config.h for certain machines, so you might look for one of those.)
10 #
11 # Yes, you may rip this off to use in other distribution packages. This
12 # script belongs to the public domain and cannot be copyrighted.
13 #
14 # (Note: this Configure script was generated automatically. Rather than
15 # working with this copy of Configure, you may wish to get metaconfig.
16 # The dist-3.0 package (which contains metaconfig) was posted in
17 # comp.sources.misc and is available on CPAN under authors/id/RAM so
18 # you may fetch it yourself from your nearest archive site.)
19 #
20
21 # $Id: Head.U,v 3.0.1.9 1997/02/28 15:02:09 ram Exp $
22 #
23 # Generated on Wed Aug 30 03:53:15 EET DST 2000 [metaconfig 3.0 PL70]
24 # (with additional metaconfig patches by perlbug@perl.org)
25
26 cat >/tmp/c1$$ <<EOF
27 ARGGGHHHH!!!!!
28
29 SCO csh still thinks true is false.  Write to SCO today and tell them that next
30 year Configure ought to "rm /bin/csh" unless they fix their blasted shell. :-)
31
32 (Actually, Configure ought to just patch csh in place.  Hmm.  Hmmmmm.  All
33 we'd have to do is go in and swap the && and || tokens, wherever they are.)
34
35 [End of diatribe. We now return you to your regularly scheduled programming...]
36 EOF
37 cat >/tmp/c2$$ <<EOF
38
39 OOPS!  You naughty creature!  You didn't run Configure with sh!
40 I will attempt to remedy the situation by running sh for you...
41 EOF
42
43 true || cat /tmp/c1$$ /tmp/c2$$
44 true || exec sh $0 $argv:q
45
46 (exit $?0) || cat /tmp/c2$$
47 (exit $?0) || exec sh $0 $argv:q
48 rm -f /tmp/c1$$ /tmp/c2$$
49
50 : compute my invocation name
51 me=$0
52 case "$0" in
53 */*)
54         me=`echo $0 | sed -e 's!.*/\(.*\)!\1!' 2>/dev/null`
55         test "$me" || me=$0
56         ;;
57 esac
58
59 : Proper separator for the PATH environment variable
60 p_=:
61 : On OS/2 this directory should exist if this is not floppy only system :-]
62 if test -d c:/. ; then
63     if test -n "$OS2_SHELL"; then
64                 p_=\;
65                 PATH=`cmd /c "echo %PATH%" | tr '\\\\' / `
66                 OS2_SHELL=`cmd /c "echo %OS2_SHELL%" | tr '\\\\' / | tr '[A-Z]' '[a-z]'`
67         elif test -n "$DJGPP"; then
68                 p_=\;
69         fi
70 fi
71
72 : Proper PATH setting
73 paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin'
74 paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin"
75 paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin"
76 paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin"
77 paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb"
78 paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /usr/ccs/bin"
79 paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib"
80 paths="$paths /sbin /usr/sbin /usr/libexec"
81
82 for p in $paths
83 do
84         case "$p_$PATH$p_" in
85         *$p_$p$p_*) ;;
86         *) test -d $p && PATH=$PATH$p_$p ;;
87         esac
88 done
89
90 PATH=.$p_$PATH
91 export PATH
92
93 : shall we be using ksh?
94 inksh=''
95 needksh=''
96 avoidksh=''
97 newsh=/bin/ksh
98 changesh=''
99 if (PATH=.; alias -x) >/dev/null 2>&1; then
100                 inksh=true
101 fi
102 if test -f /hp-ux -a -f /bin/ksh; then
103         needksh='to avoid sh bug in "here document" expansion'
104 fi
105 if test -d /usr/lpp -a -f /usr/bin/bsh -a -f /usr/bin/uname; then
106         if test X`/usr/bin/uname -v` = X4; then
107                 avoidksh="to avoid AIX 4's /bin/sh"
108                 newsh=/usr/bin/bsh
109         fi
110 fi
111 if test -f /osf_boot -a -f /usr/sbin/setld; then
112         if test X`/usr/bin/uname -s` = XOSF1; then
113                 avoidksh="to avoid Digital UNIX' ksh"
114                 newsh=/bin/sh
115                 unset BIN_SH # if this is 'xpg4' sh will start up ksh
116         fi
117 fi
118 case "$inksh/$needksh" in
119 /[a-z]*)
120                 ENV=''
121                 changesh=true
122                 reason="$needksh"
123         ;;
124 esac
125 case "$inksh/$avoidksh" in
126 true/[a-z]*)
127         changesh=true
128         reason="$avoidksh"
129         ;;
130 esac
131 case "$inksh/$needksh-$avoidksh-" in
132 true/--)
133                 cat <<EOM
134 (I see you are using the Korn shell.  Some ksh's blow up on $me,
135 mainly on older exotic systems.  If yours does, try the Bourne shell instead.)
136 EOM
137         ;;
138 esac
139 case "$changesh" in
140 true)
141         echo "(Feeding myself to $newsh $reason.)"
142         case "$0" in
143         Configure|*/Configure) exec $newsh $0 "$@";;
144         *) exec $newsh Configure "$@";;
145         esac
146         ;;
147 esac
148
149 : if needed set CDPATH to a harmless value that is not chatty
150 : avoid bash 2.02 problems with empty CDPATH.
151 case "$CDPATH" in
152 '')     ;;
153 *)      case "$SHELL" in
154         *bash*) CDPATH='.' ;;
155         *)              CDPATH='' ;;
156         esac
157         ;;
158 esac
159 : Configure runs within the UU subdirectory
160 test -d UU || mkdir UU
161 cd UU && rm -f ./*
162
163 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 ccname=''
602 gccosandvers=''
603 gccversion=''
604 gidformat=''
605 gidsign=''
606 gidsize=''
607 gidtype=''
608 groupstype=''
609 h_fcntl=''
610 h_sysfile=''
611 i_arpainet=''
612 db_hashtype=''
613 db_prefixtype=''
614 i_db=''
615 i_dbm=''
616 i_rpcsvcdbm=''
617 d_dirnamlen=''
618 direntrytype=''
619 i_dirent=''
620 i_dld=''
621 i_dlfcn=''
622 i_fcntl=''
623 i_float=''
624 i_gdbm=''
625 d_grpasswd=''
626 i_grp=''
627 i_iconv=''
628 i_ieeefp=''
629 i_inttypes=''
630 i_libutil=''
631 i_limits=''
632 i_locale=''
633 i_machcthr=''
634 i_malloc=''
635 i_math=''
636 i_memory=''
637 i_mntent=''
638 i_ndbm=''
639 i_netdb=''
640 i_neterrno=''
641 i_netinettcp=''
642 i_niin=''
643 i_sysin=''
644 i_poll=''
645 i_prot=''
646 i_pthread=''
647 d_pwage=''
648 d_pwchange=''
649 d_pwclass=''
650 d_pwcomment=''
651 d_pwexpire=''
652 d_pwgecos=''
653 d_pwpasswd=''
654 d_pwquota=''
655 i_pwd=''
656 i_sfio=''
657 i_shadow=''
658 i_socks=''
659 i_stddef=''
660 i_stdlib=''
661 i_string=''
662 strings=''
663 i_sunmath=''
664 i_sysaccess=''
665 i_sysdir=''
666 i_sysfile=''
667 d_voidtty=''
668 i_bsdioctl=''
669 i_sysfilio=''
670 i_sysioctl=''
671 i_syssockio=''
672 i_syslog=''
673 i_sysmman=''
674 i_sysmode=''
675 i_sysmount=''
676 i_sysndir=''
677 i_sysparam=''
678 i_sysresrc=''
679 i_syssecrt=''
680 i_sysselct=''
681 i_sysstat=''
682 i_sysstatfs=''
683 i_sysstatvfs=''
684 i_systimes=''
685 i_systypes=''
686 i_sysuio=''
687 i_sysun=''
688 i_sysutsname=''
689 i_sysvfs=''
690 i_syswait=''
691 i_sgtty=''
692 i_termio=''
693 i_termios=''
694 i_systime=''
695 i_systimek=''
696 i_time=''
697 timeincl=''
698 i_unistd=''
699 i_ustat=''
700 i_utime=''
701 i_values=''
702 i_stdarg=''
703 i_varargs=''
704 i_varhdr=''
705 i_vfork=''
706 inc_version_list=''
707 inc_version_list_init=''
708 installprefix=''
709 installprefixexp=''
710 installstyle=''
711 installusrbinperl=''
712 intsize=''
713 longsize=''
714 shortsize=''
715 libc=''
716 ldlibpthname=''
717 libperl=''
718 shrpenv=''
719 useshrplib=''
720 glibpth=''
721 libpth=''
722 loclibpth=''
723 plibpth=''
724 xlibpth=''
725 ignore_versioned_solibs=''
726 libs=''
727 libsdirs=''
728 libsfiles=''
729 libsfound=''
730 libspath=''
731 lns=''
732 d_PRIEldbl=''
733 d_PRIFldbl=''
734 d_PRIGldbl=''
735 d_PRIeldbl=''
736 d_PRIfldbl=''
737 d_PRIgldbl=''
738 sPRIEldbl=''
739 sPRIFldbl=''
740 sPRIGldbl=''
741 sPRIeldbl=''
742 sPRIfldbl=''
743 sPRIgldbl=''
744 lseeksize=''
745 lseektype=''
746 make_set_make=''
747 d_mymalloc=''
748 freetype=''
749 mallocobj=''
750 mallocsrc=''
751 malloctype=''
752 usemymalloc=''
753 installman1dir=''
754 man1dir=''
755 man1direxp=''
756 man1ext=''
757 installman3dir=''
758 man3dir=''
759 man3direxp=''
760 man3ext=''
761 huge=''
762 large=''
763 medium=''
764 models=''
765 small=''
766 split=''
767 modetype=''
768 multiarch=''
769 mydomain=''
770 myhostname=''
771 phostname=''
772 c=''
773 n=''
774 d_eofnblk=''
775 eagain=''
776 o_nonblock=''
777 rd_nodata=''
778 netdb_hlen_type=''
779 netdb_host_type=''
780 netdb_name_type=''
781 netdb_net_type=''
782 groupcat=''
783 hostcat=''
784 passcat=''
785 orderlib=''
786 ranlib=''
787 d_perl_otherlibdirs=''
788 otherlibdirs=''
789 package=''
790 spackage=''
791 pager=''
792 api_revision=''
793 api_subversion=''
794 api_version=''
795 api_versionstring=''
796 patchlevel=''
797 revision=''
798 subversion=''
799 version=''
800 perl5=''
801 perladmin=''
802 perlpath=''
803 d_nv_preserves_uv=''
804 d_nv_preserves_uv_bits=''
805 i16size=''
806 i16type=''
807 i32size=''
808 i32type=''
809 i64size=''
810 i64type=''
811 i8size=''
812 i8type=''
813 ivsize=''
814 ivtype=''
815 nvsize=''
816 nvtype=''
817 u16size=''
818 u16type=''
819 u32size=''
820 u32type=''
821 u64size=''
822 u64type=''
823 u8size=''
824 u8type=''
825 uvsize=''
826 uvtype=''
827 ivdformat=''
828 nvEformat=''
829 nvFformat=''
830 nvGformat=''
831 nveformat=''
832 nvfformat=''
833 nvgformat=''
834 uvXformat=''
835 uvoformat=''
836 uvuformat=''
837 uvxformat=''
838 pidtype=''
839 prefix=''
840 prefixexp=''
841 installprivlib=''
842 privlib=''
843 privlibexp=''
844 prototype=''
845 ptrsize=''
846 d_PRIX64=''
847 d_PRId64=''
848 d_PRIi64=''
849 d_PRIo64=''
850 d_PRIu64=''
851 d_PRIx64=''
852 sPRIX64=''
853 sPRId64=''
854 sPRIi64=''
855 sPRIo64=''
856 sPRIu64=''
857 sPRIx64=''
858 d_quad=''
859 quadkind=''
860 quadtype=''
861 uquadtype=''
862 drand01=''
863 randbits=''
864 randfunc=''
865 randseedtype=''
866 seedfunc=''
867 installscript=''
868 scriptdir=''
869 scriptdirexp=''
870 selectminbits=''
871 selecttype=''
872 sh=''
873 sig_count=''
874 sig_name=''
875 sig_name_init=''
876 sig_num=''
877 sig_num_init=''
878 installsitearch=''
879 sitearch=''
880 sitearchexp=''
881 installsitebin=''
882 sitebin=''
883 sitebinexp=''
884 installsitelib=''
885 sitelib=''
886 sitelib_stem=''
887 sitelibexp=''
888 siteprefix=''
889 siteprefixexp=''
890 sizesize=''
891 sizetype=''
892 so=''
893 socksizetype=''
894 sharpbang=''
895 shsharp=''
896 spitshell=''
897 src=''
898 ssizetype=''
899 startperl=''
900 startsh=''
901 stdchar=''
902 d_stdio_stream_array=''
903 stdio_stream_array=''
904 sysman=''
905 trnl=''
906 uidformat=''
907 uidsign=''
908 uidsize=''
909 uidtype=''
910 archname64=''
911 use64bitall=''
912 use64bitint=''
913 ccflags_uselargefiles=''
914 ldflags_uselargefiles=''
915 libswanted_uselargefiles=''
916 uselargefiles=''
917 uselongdouble=''
918 usemorebits=''
919 usemultiplicity=''
920 nm_opt=''
921 nm_so_opt=''
922 runnm=''
923 usenm=''
924 useperlio=''
925 usesocks=''
926 d_oldpthreads=''
927 use5005threads=''
928 useithreads=''
929 usethreads=''
930 incpath=''
931 mips_type=''
932 usrinc=''
933 d_vendorarch=''
934 installvendorarch=''
935 vendorarch=''
936 vendorarchexp=''
937 d_vendorbin=''
938 installvendorbin=''
939 vendorbin=''
940 vendorbinexp=''
941 d_vendorlib=''
942 installvendorlib=''
943 vendorlib=''
944 vendorlib_stem=''
945 vendorlibexp=''
946 usevendorprefix=''
947 vendorprefix=''
948 vendorprefixexp=''
949 defvoidused=''
950 voidflags=''
951 pm_apiversion=''
952 xs_apiversion=''
953 CONFIG=''
954
955 define='define'
956 undef='undef'
957 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
958 rmlist=''
959
960 : We must find out about Eunice early
961 eunicefix=':'
962 if test -f /etc/unixtovms; then
963         eunicefix=/etc/unixtovms
964 fi
965 if test -f /etc/unixtovms.exe; then
966         eunicefix=/etc/unixtovms.exe
967 fi
968
969 i_whoami=''
970 : set useposix=false in your hint file to disable the POSIX extension.
971 useposix=true
972 : set useopcode=false in your hint file to disable the Opcode extension.
973 useopcode=true
974 : Trailing extension.  Override this in a hint file, if needed.
975 _exe=''
976 : Extra object files, if any, needed on this platform.
977 archobjs=''
978 : Possible local include directories to search.
979 : Set locincpth to "" in a hint file to defeat local include searches.
980 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
981 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
982 :
983 : no include file wanted by default
984 inclwanted=''
985
986 groupstype=''
987 : change the next line if compiling for Xenix/286 on Xenix/386
988 xlibpth='/usr/lib/386 /lib/386'
989 : Possible local library directories to search.
990 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
991 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
992
993 : general looking path for locating libraries
994 glibpth="/usr/lib/large /lib /usr/lib $xlibpth"
995 glibpth="$glibpth /lib/large /usr/lib/small /lib/small"
996 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
997 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
998 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
999
1000 : Private path used by Configure to find libraries.  Its value
1001 : is prepended to libpth. This variable takes care of special
1002 : machines, like the mips.  Usually, it should be empty.
1003 plibpth=''
1004
1005 : default library list
1006 libswanted=''
1007 : some systems want to use only the non-versioned libso:s
1008 ignore_versioned_solibs=''
1009 ccflags_uselargefiles=''
1010 ldflags_uselargefiles=''
1011 libswanted_uselargefiles=''
1012 : set usemultiplicity on the Configure command line to enable multiplicity.
1013 : set usesocks on the Configure command line to enable socks.
1014 : set usethreads on the Configure command line to enable threads.
1015 : full support for void wanted by default
1016 defvoidused=15
1017
1018 : List of libraries we want.
1019 : If anyone needs -lnet, put it in a hint file.
1020 libswanted='sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl'
1021 libswanted="$libswanted dld ld sun m c cposix posix"
1022 libswanted="$libswanted ndir dir crypt sec"
1023 libswanted="$libswanted ucb bsd BSD PW x iconv util"
1024 : We probably want to search /usr/shlib before most other libraries.
1025 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1026 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1027 glibpth="/usr/shlib $glibpth"
1028 : Do not use vfork unless overridden by a hint file.
1029 usevfork=false
1030
1031 : Find the basic shell for Bourne shell scripts
1032 case "$sh" in
1033 '')
1034         case "$SYSTYPE" in
1035         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1036         *) xxx='/bin/sh';;
1037         esac
1038         if test -f "$xxx"; then
1039                 sh="$xxx"
1040         else
1041                 : Build up a list and do a single loop so we can 'break' out.
1042                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1043                 for xxx in sh bash ksh pdksh ash; do
1044                         for p in $pth; do
1045                                 try="$try ${p}/${xxx}"
1046                         done
1047                 done
1048                 for xxx in $try; do
1049                         if test -f "$xxx"; then
1050                                 sh="$xxx";
1051                                 break
1052                         elif test -f "$xxx.exe"; then
1053                                 sh="$xxx";
1054                                 break
1055                         fi
1056                 done
1057         fi
1058         ;;
1059 esac
1060
1061 case "$sh" in
1062 '')     cat <<EOM >&2
1063 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
1064
1065 Usually it's in /bin/sh.  How did you even get this far?
1066 Please contact me (Perl Maintainers) at perlbug@perl.org and 
1067 we'll try to straighten this all out.
1068 EOM
1069         exit 1
1070         ;;
1071 esac
1072
1073 : see if sh knows # comments
1074 if `$sh -c '#' >/dev/null 2>&1`; then
1075         shsharp=true
1076         spitshell=cat
1077         xcat=/bin/cat
1078         test -f $xcat || xcat=/usr/bin/cat
1079         echo "#!$xcat" >try
1080         $eunicefix try
1081         chmod +x try
1082         ./try > today
1083         if test -s today; then
1084                 sharpbang='#!'
1085         else
1086                 echo "#! $xcat" > try
1087                 $eunicefix try
1088                 chmod +x try
1089                 ./try > today
1090                 if test -s today; then
1091                         sharpbang='#! '
1092                 else
1093                         sharpbang=': use '
1094                 fi
1095         fi
1096 else
1097         echo " "
1098         echo "Your $sh doesn't grok # comments--I will strip them later on."
1099         shsharp=false
1100         cd ..
1101         echo "exec grep -v '^[  ]*#'" >spitshell
1102         chmod +x spitshell
1103         $eunicefix spitshell
1104         spitshell=`pwd`/spitshell
1105         cd UU
1106         echo "I presume that if # doesn't work, #! won't work either!"
1107         sharpbang=': use '
1108 fi
1109 rm -f try today
1110
1111 : figure out how to guarantee sh startup
1112 case "$startsh" in
1113 '') startsh=${sharpbang}${sh} ;;
1114 *)
1115 esac
1116 cat >try <<EOSS
1117 $startsh
1118 set abc
1119 test "$?abc" != 1
1120 EOSS
1121
1122 chmod +x try
1123 $eunicefix try
1124 if ./try; then
1125         : echo "Yup, it does."
1126 else
1127         echo "Hmm... '$startsh' does not guarantee sh startup..."
1128         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1129 fi
1130 rm -f try
1131
1132
1133 : Save command line options in file UU/cmdline.opt for later use in
1134 : generating config.sh.
1135 cat > cmdline.opt <<EOSH
1136 # Configure command line arguments.
1137 config_arg0='$0'
1138 config_args='$*'
1139 config_argc=$#
1140 EOSH
1141 argn=1
1142 for arg in "$@"; do
1143         cat >>cmdline.opt <<EOSH
1144 config_arg$argn='$arg'
1145 EOSH
1146         argn=`expr $argn + 1`
1147 done
1148
1149 : produce awk script to parse command line options
1150 cat >options.awk <<'EOF'
1151 BEGIN {
1152         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1153
1154         len = length(optstr);
1155         for (i = 1; i <= len; i++) {
1156                 c = substr(optstr, i, 1);
1157                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1158                 if (a == ":") {
1159                         arg[c] = 1;
1160                         i++;
1161                 }
1162                 opt[c] = 1;
1163         }
1164 }
1165 {
1166         expect = 0;
1167         str = $0;
1168         if (substr(str, 1, 1) != "-") {
1169                 printf("'%s'\n", str);
1170                 next;
1171         }
1172         len = length($0);
1173         for (i = 2; i <= len; i++) {
1174                 c = substr(str, i, 1);
1175                 if (!opt[c]) {
1176                         printf("-%s\n", substr(str, i));
1177                         next;
1178                 }
1179                 printf("-%s\n", c);
1180                 if (arg[c]) {
1181                         if (i < len)
1182                                 printf("'%s'\n", substr(str, i + 1));
1183                         else
1184                                 expect = 1;
1185                         next;
1186                 }
1187         }
1188 }
1189 END {
1190         if (expect)
1191                 print "?";
1192 }
1193 EOF
1194
1195 : process the command line options
1196 set X `for arg in "$@"; do echo "X$arg"; done |
1197         sed -e s/X// | awk -f options.awk`
1198 eval "set $*"
1199 shift
1200 rm -f options.awk
1201
1202 : set up default values
1203 fastread=''
1204 reuseval=false
1205 config_sh=''
1206 alldone=''
1207 error=''
1208 silent=''
1209 extractsh=''
1210 override=''
1211 knowitall=''
1212 rm -f optdef.sh posthint.sh
1213 cat >optdef.sh <<EOS
1214 $startsh
1215 EOS
1216
1217
1218 : option parsing
1219 while test $# -gt 0; do
1220         case "$1" in
1221         -d) shift; fastread=yes;;
1222         -e) shift; alldone=cont;;
1223         -f)
1224                 shift
1225                 cd ..
1226                 if test -r "$1"; then
1227                         config_sh="$1"
1228                 else
1229                         echo "$me: cannot read config file $1." >&2
1230                         error=true
1231                 fi
1232                 cd UU
1233                 shift;;
1234         -h) shift; error=true;;
1235         -r) shift; reuseval=true;;
1236         -s) shift; silent=true; realsilent=true;;
1237         -E) shift; alldone=exit;;
1238         -K) shift; knowitall=true;;
1239         -O) shift; override=true;;
1240         -S) shift; silent=true; extractsh=true;;
1241         -D)
1242                 shift
1243                 case "$1" in
1244                 *=)
1245                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1246                         echo "$me: ignoring -D $1" >&2
1247                         ;;
1248                 *=*) echo "$1" | \
1249                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1250                 *) echo "$1='define'" >> optdef.sh;;
1251                 esac
1252                 shift
1253                 ;;
1254         -U)
1255                 shift
1256                 case "$1" in
1257                 *=) echo "$1" >> optdef.sh;;
1258                 *=*)
1259                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1260                         echo "$me: ignoring -U $1" >&2
1261                         ;;
1262                 *) echo "$1='undef'" >> optdef.sh;;
1263                 esac
1264                 shift
1265                 ;;
1266         -A)
1267             shift
1268             xxx=''
1269             yyy="$1"
1270             zzz=''
1271             uuu=undef
1272             case "$yyy" in
1273             *=*) zzz=`echo $yyy|sed 's!=.*!!'`
1274                  case "$zzz" in
1275                  *:*) zzz='' ;;
1276                  *)   xxx=append
1277                       zzz=" "`echo $yyy|sed 's!^[^=]*=!!'` 
1278                       yyy=`echo $yyy|sed 's!=.*!!'` ;;
1279                  esac
1280                  ;;
1281             esac
1282             case "$xxx" in
1283             '')  case "$yyy" in
1284                  *:*) xxx=`echo $yyy|sed 's!:.*!!'`
1285                       yyy=`echo $yyy|sed 's!^[^:]*:!!'`
1286                       zzz=`echo $yyy|sed 's!^[^=]*=!!'`
1287                       yyy=`echo $yyy|sed 's!=.*!!'` ;;
1288                  *)   xxx=`echo $yyy|sed 's!:.*!!'`
1289                       yyy=`echo $yyy|sed 's!^[^:]*:!!'` ;;
1290                  esac
1291                  ;;       
1292             esac
1293             case "$xxx" in
1294             append)
1295                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1296             clear)
1297                 echo "$yyy=''"                  >> posthint.sh ;;
1298             define)
1299                 case "$zzz" in
1300                 '') zzz=define ;;
1301                 esac
1302                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1303             eval)
1304                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1305             prepend)
1306                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1307             undef)
1308                 case "$zzz" in
1309                 '') zzz="$uuu" ;;
1310                 esac
1311                 echo "$yyy=$zzz"                >> posthint.sh ;;
1312             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1313             esac
1314             shift
1315             ;;
1316         -V) echo "$me generated by metaconfig 3.0 PL70." >&2
1317             exit 0;;
1318         --) break;;
1319         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1320         *) break;;
1321         esac
1322 done
1323
1324 case "$error" in
1325 true)
1326         cat >&2 <<EOM
1327 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1328                  [-U symbol] [-U symbol=] [-A command:symbol...]
1329   -d : use defaults for all answers.
1330   -e : go on without questioning past the production of config.sh.
1331   -f : specify an alternate default configuration file.
1332   -h : print this help message and exit (with an error status).
1333   -r : reuse C symbols value if possible (skips costly nm extraction).
1334   -s : silent mode, only echoes questions and essential information.
1335   -D : define symbol to have some value:
1336          -D symbol         symbol gets the value 'define'
1337          -D symbol=value   symbol gets the value 'value'
1338   -E : stop at the end of questions, after having produced config.sh.
1339   -K : do not use unless you know what you are doing.
1340   -O : let -D and -U override definitions from loaded configuration file.
1341   -S : perform variable substitutions on all .SH files (can mix with -f)
1342   -U : undefine symbol:
1343          -U symbol    symbol gets the value 'undef'
1344          -U symbol=   symbol gets completely empty
1345   -A : manipulate symbol after the platform specific hints have been applied:
1346          -A symbol=value                append " "value to symbol
1347          -A append:symbol=value         append value to symbol
1348          -A define:symbol=value         define symbol to have value
1349          -A clear:symbol                define symbol to be ''
1350          -A define:symbol               define symbol to be 'define'
1351          -A eval:symbol=value           define symbol to be eval of value
1352          -A prepend:symbol=value        prepend value to symbol
1353          -A undef:symbol                define symbol to be 'undef'
1354          -A undef:symbol=               define symbol to be ''
1355   -V : print version number and exit (with a zero status).
1356 EOM
1357         exit 1
1358         ;;
1359 esac
1360
1361 : Sanity checks
1362 case "$fastread$alldone" in
1363 yescont|yesexit) ;;
1364 *)
1365         case "$extractsh" in
1366         true) ;;
1367         *)
1368                 if test ! -t 0; then
1369                         echo "Say 'sh Configure', not 'sh <Configure'"
1370                         exit 1
1371                 fi
1372                 ;;
1373         esac
1374         ;;
1375 esac
1376
1377 exec 4>&1
1378 case "$silent" in
1379 true) exec 1>/dev/null;;
1380 esac
1381
1382 : run the defines and the undefines, if any, but leave the file out there...
1383 touch optdef.sh
1384 . ./optdef.sh
1385 : create the posthint manipulation script and leave the file out there...
1386 touch posthint.sh
1387
1388 : set package name
1389 package=perl5
1390 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1391 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1392 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1393 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1394 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1395 esac
1396
1397 : Some greps do not return status, grrr.
1398 echo "grimblepritz" >grimble
1399 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1400         contains=contains
1401 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1402         contains=grep
1403 else
1404         contains=contains
1405 fi
1406 rm -f grimble
1407 : the following should work in any shell
1408 case "$contains" in
1409 contains*)
1410         echo " "
1411         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1412         cat >contains <<'EOSS'
1413 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1414 EOSS
1415 chmod +x contains
1416 esac
1417
1418 : Find the path to the source tree
1419 case "$src" in
1420 '') case "$0" in
1421     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1422          case "$src" in
1423          /*)    ;;
1424          *)     src=`cd ../$src && pwd` ;;
1425          esac
1426          ;;
1427     *)   src='.';;
1428     esac;;
1429 esac
1430 case "$src" in
1431 '')     src=/
1432         rsrc=/
1433         ;;
1434 /*) rsrc="$src";;
1435 *) rsrc="../$src";;
1436 esac
1437 if test -f $rsrc/Configure && \
1438         $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1439 then
1440    : found it, so we are ok.
1441 else
1442         rsrc=''
1443         for src in . .. ../.. ../../.. ../../../..; do
1444                 if test -f ../$src/Configure && \
1445                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1446                 then
1447                         rsrc=../$src
1448                         break
1449                 fi
1450         done
1451 fi
1452 case "$rsrc" in
1453 '')
1454         cat <<EOM >&4
1455
1456 Sorry, I can't seem to locate the source dir for $package.  Please start
1457 Configure with an explicit path -- i.e. /some/path/Configure.
1458
1459 EOM
1460         exit 1
1461         ;;
1462 ../.)   rsrc='..';;
1463 *)
1464         echo " "
1465         echo "Sources for $package found in \"$src\"." >&4
1466         ;;
1467 esac
1468
1469 : script used to extract .SH files with variable substitutions
1470 cat >extract <<'EOS'
1471 CONFIGDOTSH=true
1472 echo "Doing variable substitutions on .SH files..."
1473 if test -f $src/MANIFEST; then
1474         set x `awk '{print $1}' <$src/MANIFEST | grep '\.SH$'`
1475 else
1476         echo "(Looking for .SH files under the source directory.)"
1477         set x `(cd $src; find . -name "*.SH" -print)`
1478 fi
1479 shift
1480 case $# in
1481 0) set x `(cd $src; echo *.SH)`; shift;;
1482 esac
1483 if test ! -f $src/$1; then
1484         shift
1485 fi
1486 mkdir_p='
1487 name=$1;
1488 create="";
1489 while test $name; do
1490         if test ! -d "$name"; then
1491                 create="$name $create";
1492                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1493                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1494         else
1495                 name="";
1496         fi;
1497 done;
1498 for file in $create; do
1499         mkdir $file;
1500 done
1501 '
1502 for file in $*; do
1503         case "$src" in
1504         ".")
1505                 case "$file" in
1506                 */*)
1507                         dir=`expr X$file : 'X\(.*\)/'`
1508                         file=`expr X$file : 'X.*/\(.*\)'`
1509                         (cd $dir && . ./$file)
1510                         ;;
1511                 *)
1512                         . ./$file
1513                         ;;
1514                 esac
1515                 ;;
1516         *)
1517                 case "$file" in
1518                 */*)
1519                         dir=`expr X$file : 'X\(.*\)/'`
1520                         file=`expr X$file : 'X.*/\(.*\)'`
1521                         (set x $dir; shift; eval $mkdir_p)
1522                         sh <$src/$dir/$file
1523                         ;;
1524                 *)
1525                         sh <$src/$file
1526                         ;;
1527                 esac
1528                 ;;
1529         esac
1530 done
1531 if test -f $src/config_h.SH; then
1532         if test ! -f config.h; then
1533         : oops, they left it out of MANIFEST, probably, so do it anyway.
1534         . $src/config_h.SH
1535         fi
1536 fi
1537 EOS
1538
1539 : extract files and exit if asked to do so
1540 case "$extractsh" in
1541 true)
1542         case "$realsilent" in
1543         true) ;;
1544         *) exec 1>&4;;
1545         esac
1546         case "$config_sh" in
1547         '') config_sh='config.sh';;
1548         esac
1549         echo " "
1550         echo "Fetching answers from $config_sh..."
1551         cd ..
1552         . $config_sh
1553         test "$override" && . ./optdef.sh
1554         echo " "
1555         . UU/extract
1556         rm -rf UU
1557         echo "Done."
1558         exit 0
1559         ;;
1560 esac
1561
1562 : Eunice requires " " instead of "", can you believe it
1563 echo " "
1564 : Here we go...
1565 echo "Beginning of configuration questions for $package."
1566
1567 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1568
1569 : first determine how to suppress newline on echo command
1570 echo " "
1571 echo "Checking echo to see how to suppress newlines..."
1572 (echo "hi there\c" ; echo " ") >.echotmp
1573 if $contains c .echotmp >/dev/null 2>&1 ; then
1574         echo "...using -n."
1575         n='-n'
1576         c=''
1577 else
1578         cat <<'EOM'
1579 ...using \c
1580 EOM
1581         n=''
1582         c='\c'
1583 fi
1584 echo $n "The star should be here-->$c"
1585 echo '*'
1586 rm -f .echotmp
1587
1588 : Now test for existence of everything in MANIFEST
1589 echo " "
1590 if test -f $rsrc/MANIFEST; then
1591         echo "First let's make sure your kit is complete.  Checking..." >&4
1592         awk '$1 !~ /PACK[A-Z]+/ {print $1}' $rsrc/MANIFEST | split -50
1593         rm -f missing
1594         tmppwd=`pwd`
1595         for filelist in x??; do
1596                 (cd $rsrc; ls `cat $tmppwd/$filelist` >/dev/null 2>>$tmppwd/missing)
1597         done
1598         if test -s missing; then
1599                 cat missing >&4
1600                 cat >&4 <<'EOM'
1601
1602 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1603
1604 You have the option of continuing the configuration process, despite the
1605 distinct possibility that your kit is damaged, by typing 'y'es.  If you
1606 do, don't blame me if something goes wrong.  I advise you to type 'n'o
1607 and contact the author (perlbug@perl.org).
1608
1609 EOM
1610                 echo $n "Continue? [n] $c" >&4
1611                 read ans
1612                 case "$ans" in
1613                 y*)
1614                         echo "Continuing..." >&4
1615                         rm -f missing
1616                         ;;
1617                 *)
1618                         echo "ABORTING..." >&4
1619                         kill $$
1620                         ;;
1621                 esac
1622         else
1623                 echo "Looks good..."
1624         fi
1625 else
1626         echo "There is no MANIFEST file.  I hope your kit is complete !"
1627 fi
1628 rm -f missing x??
1629
1630 echo " "
1631 : Find the appropriate value for a newline for tr
1632 if test -n "$DJGPP"; then
1633        trnl='\012'
1634 fi
1635 if test X"$trnl" = X; then
1636         case "`echo foo|tr '\n' x 2>/dev/null`" in
1637         foox) trnl='\n' ;;
1638         esac
1639 fi
1640 if test X"$trnl" = X; then
1641         case "`echo foo|tr '\012' x 2>/dev/null`" in
1642         foox) trnl='\012' ;;
1643         esac
1644 fi
1645 if test X"$trnl" = X; then
1646         cat <<EOM >&2
1647
1648 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
1649
1650 EOM
1651         exit 1
1652 fi
1653
1654 : compute the number of columns on the terminal for proper question formatting
1655 case "$COLUMNS" in
1656 '') COLUMNS='80';;
1657 esac
1658
1659 : set up the echo used in my read
1660 myecho="case \"\$xxxm\" in
1661 '') echo $n \"\$rp $c\" >&4;;
1662 *) case \"\$rp\" in
1663         '') echo $n \"[\$xxxm] $c\";;
1664         *)
1665                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
1666                         echo \"\$rp\" >&4
1667                         echo $n \"[\$xxxm] $c\" >&4
1668                 else
1669                         echo $n \"\$rp [\$xxxm] $c\" >&4
1670                 fi
1671                 ;;
1672         esac;;
1673 esac"
1674
1675 : now set up to do reads with possible shell escape and default assignment
1676 cat <<EOSC >myread
1677 $startsh
1678 xxxm=\$dflt
1679 $myecho
1680 ans='!'
1681 case "\$fastread" in
1682 yes) case "\$dflt" in
1683         '') ;;
1684         *) ans='';
1685                 case "\$silent-\$rp" in
1686                 true-) ;;
1687                 *) echo " " >&4;;
1688                 esac;;
1689         esac;;
1690 *) case "\$silent" in
1691         true) case "\$rp" in
1692                 '') ans='';;
1693                 esac;;
1694         esac;;
1695 esac
1696 while expr "X\$ans" : "X!" >/dev/null; do
1697         read answ
1698         set x \$xxxm
1699         shift
1700         aok=''; eval "ans=\\"\$answ\\"" && aok=y
1701         case  "\$answ" in
1702         "!")
1703                 sh 1>&4
1704                 echo " "
1705                 $myecho
1706                 ;;
1707         !*)
1708                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
1709                 shift
1710                 sh 1>&4 -c "\$*"
1711                 echo " "
1712                 $myecho
1713                 ;;
1714         "\$ans")
1715                 case "\$ans" in
1716                 \\&*)
1717                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
1718                         shift
1719                         case "\$1" in
1720                         -d)
1721                                 fastread=yes
1722                                 echo "(OK, I'll run with -d after this question.)" >&4
1723                                 ;;
1724                         -*)
1725                                 echo "*** Sorry, \$1 not supported yet." >&4
1726                                 ;;
1727                         esac
1728                         $myecho
1729                         ans=!
1730                         ;;
1731                 esac;;
1732         *)
1733                 case "\$aok" in
1734                 y)
1735                         echo "*** Substitution done -- please confirm."
1736                         xxxm="\$ans"
1737                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
1738                         xxxm="\$ans"
1739                         ans=!
1740                         ;;
1741                 *)
1742                         echo "*** Error -- try again."
1743                         ans=!
1744                         ;;
1745                 esac
1746                 $myecho
1747                 ;;
1748         esac
1749         case "\$ans\$xxxm\$nostick" in
1750         '')
1751                 ans=!
1752                 $myecho
1753                 ;;
1754         esac
1755 done
1756 case "\$ans" in
1757 '') ans="\$xxxm";;
1758 esac
1759 EOSC
1760
1761 : create .config dir to save info across Configure sessions
1762 test -d ../.config || mkdir ../.config
1763 cat >../.config/README <<EOF
1764 This directory created by Configure to save information that should
1765 persist across sessions for $package.
1766
1767 You may safely delete it if you wish.
1768 EOF
1769
1770 xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
1771 case "$usedevel" in
1772 $define|true|[yY]*) ;;
1773 *) case "$xversion" in
1774    *[13579])
1775         cat >&4 <<EOH
1776 *** WHOA THERE!!! ***
1777
1778     This is an UNSTABLE DEVELOPMENT release.
1779     The version of this $package distribution is $xversion, that is, odd,
1780     (as opposed to even) and that signifies a development release.
1781     If you want a maintenance release, you want an even-numbered version.)
1782
1783     Do ***NOT*** install this into production use.
1784     Data corruption and crashes are possible.
1785
1786     It is most seriously suggested that you do not continue any further
1787     unless you want to help in developing and debugging Perl.
1788
1789 EOH
1790         rp='Do you really want to continue?'
1791         dflt='n'
1792         . ./myread
1793         case "$ans" in
1794         [yY]) echo >&4 "Okay, continuing." ;;
1795         *) echo >&4 "Okay, bye."
1796            exit 1
1797            ;;
1798         esac
1799         ;;
1800     esac
1801     ;;
1802 esac
1803
1804 : general instructions
1805 needman=true
1806 firsttime=true
1807 user=`(logname) 2>/dev/null`
1808 case "$user" in
1809 '') user=`whoami 2>&1`;;
1810 esac
1811 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
1812         firsttime=false
1813         echo " "
1814         rp='Would you like to see the instructions?'
1815         dflt=n
1816         . ./myread
1817         case "$ans" in
1818         [yY]*) ;;
1819         *) needman=false;;
1820         esac
1821 fi
1822 if $needman; then
1823         cat <<EOH
1824
1825 This installation shell script will examine your system and ask you questions
1826 to determine how the perl5 package should be installed. If you get
1827 stuck on a question, you may use a ! shell escape to start a subshell or
1828 execute a command.  Many of the questions will have default answers in square
1829 brackets; typing carriage return will give you the default.
1830
1831 On some of the questions which ask for file or directory names you are allowed
1832 to use the ~name construct to specify the login directory belonging to "name",
1833 even if you don't have a shell which knows about that.  Questions where this is
1834 allowed will be marked "(~name ok)".
1835
1836 EOH
1837         rp=''
1838         dflt='Type carriage return to continue'
1839         . ./myread
1840         cat <<'EOH'
1841
1842 The prompter used in this script allows you to use shell variables and
1843 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
1844 in the default answer, as if the default line was a set of arguments given to a
1845 script shell.  This means you may also use $* to repeat the whole default line,
1846 so you do not have to re-type everything to add something to the default.
1847
1848 Everytime there is a substitution, you will have to confirm.  If there is an
1849 error (e.g. an unmatched backtick), the default answer will remain unchanged
1850 and you will be prompted again.
1851
1852 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
1853 the questions and use the computed defaults (or the previous answers if there
1854 was already a config.sh file). Type 'Configure -h' for a list of options.
1855 You may also start interactively and then answer '& -d' at any prompt to turn
1856 on the non-interactive behaviour for the remainder of the execution.
1857
1858 EOH
1859         . ./myread
1860         cat <<EOH
1861
1862 Much effort has been expended to ensure that this shell script will run on any
1863 Unix system.  If despite that it blows up on yours, your best bet is to edit
1864 Configure and run it again.  If you can't run Configure for some reason,
1865 you'll have to generate a config.sh file by hand.  Whatever problems you
1866 have, let me (perlbug@perl.org) know how I blew it.
1867
1868 This installation script affects things in two ways:
1869
1870 1) it may do direct variable substitutions on some of the files included
1871    in this kit.
1872 2) it builds a config.h file for inclusion in C programs.  You may edit
1873    any of these files as the need arises after running this script.
1874
1875 If you make a mistake on a question, there is no easy way to back up to it
1876 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
1877 files.  Configure will offer to let you do this before it runs the SH files.
1878
1879 EOH
1880         dflt='Type carriage return to continue'
1881         . ./myread
1882         case "$firsttime" in
1883         true) echo $user >>../.config/instruct;;
1884         esac
1885 fi
1886
1887 : find out where common programs are
1888 echo " "
1889 echo "Locating common programs..." >&4
1890 cat <<EOSC >loc
1891 $startsh
1892 case \$# in
1893 0) exit 1;;
1894 esac
1895 thing=\$1
1896 shift
1897 dflt=\$1
1898 shift
1899 for dir in \$*; do
1900         case "\$thing" in
1901         .)
1902         if test -d \$dir/\$thing; then
1903                 echo \$dir
1904                 exit 0
1905         fi
1906         ;;
1907         *)
1908         for thisthing in \$dir/\$thing; do
1909                 : just loop through to pick last item
1910         done
1911         if test -f \$thisthing; then
1912                 echo \$thisthing
1913                 exit 0
1914         elif test -f \$dir/\$thing.exe; then
1915                 if test -n "$DJGPP"; then
1916                         echo \$dir/\$thing.exe
1917                 else
1918                         : on Eunice apparently
1919                         echo \$dir/\$thing
1920                 fi
1921                 exit 0
1922         fi
1923         ;;
1924         esac
1925 done
1926 echo \$dflt
1927 exit 1
1928 EOSC
1929 chmod +x loc
1930 $eunicefix loc
1931 loclist="
1932 awk
1933 cat
1934 comm
1935 cp
1936 echo
1937 expr
1938 grep
1939 ls
1940 make
1941 mkdir
1942 rm
1943 sed
1944 sort
1945 touch
1946 tr
1947 uniq
1948 "
1949 trylist="
1950 Mcc
1951 ar
1952 byacc
1953 cpp
1954 csh
1955 date
1956 egrep
1957 gzip
1958 less
1959 ln
1960 more
1961 nm
1962 nroff
1963 pg
1964 test
1965 uname
1966 zip
1967 "
1968 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1969 pth="$pth /lib /usr/lib"
1970 for file in $loclist; do
1971         eval xxx=\$$file
1972         case "$xxx" in
1973         /*|?:[\\/]*)
1974                 if test -f "$xxx"; then
1975                         : ok
1976                 else
1977                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
1978                         xxx=`./loc $file $file $pth`
1979                 fi
1980                 ;;
1981         '') xxx=`./loc $file $file $pth`;;
1982         *) xxx=`./loc $xxx $xxx $pth`;;
1983         esac
1984         eval $file=$xxx
1985         eval _$file=$xxx
1986         case "$xxx" in
1987         /*)
1988                 echo $file is in $xxx.
1989                 ;;
1990         ?:[\\/]*)
1991                 echo $file is in $xxx.
1992                 ;;
1993         *)
1994                 echo "I don't know where '$file' is, and my life depends on it." >&4
1995                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
1996                 exit 1
1997                 ;;
1998         esac
1999 done
2000 echo " "
2001 echo "Don't worry if any of the following aren't found..."
2002 say=offhand
2003 for file in $trylist; do
2004         eval xxx=\$$file
2005         case "$xxx" in
2006         /*|?:[\\/]*)
2007                 if test -f "$xxx"; then
2008                         : ok
2009                 else
2010                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2011                         xxx=`./loc $file $file $pth`
2012                 fi
2013                 ;;
2014         '') xxx=`./loc $file $file $pth`;;
2015         *) xxx=`./loc $xxx $xxx $pth`;;
2016         esac
2017         eval $file=$xxx
2018         eval _$file=$xxx
2019         case "$xxx" in
2020         /*)
2021                 echo $file is in $xxx.
2022                 ;;
2023         ?:[\\/]*)
2024                 echo $file is in $xxx.
2025                 ;;
2026         *)
2027                 echo "I don't see $file out there, $say."
2028                 say=either
2029                 ;;
2030         esac
2031 done
2032 case "$egrep" in
2033 egrep)
2034         echo "Substituting grep for egrep."
2035         egrep=$grep
2036         ;;
2037 esac
2038 case "$ln" in
2039 ln)
2040         echo "Substituting cp for ln."
2041         ln=$cp
2042         ;;
2043 esac
2044 case "$test" in
2045 test)
2046         echo "Hopefully test is built into your sh."
2047         ;;
2048 *)
2049         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2050                 echo "Using the test built into your sh."
2051                 test=test
2052                 _test=test
2053         fi
2054         ;;
2055 esac
2056 case "$echo" in
2057 echo)
2058         echo "Hopefully echo is built into your sh."
2059         ;;
2060 '') ;;
2061 *)
2062         echo " "
2063 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2064         $echo $n "hi there$c" >foo1
2065         echo $n "hi there$c" >foo2
2066         if cmp foo1 foo2 >/dev/null 2>&1; then
2067                 echo "They are compatible.  In fact, they may be identical."
2068         else
2069                 case "$n" in
2070                 '-n') n='' c='\c';;
2071                 *) n='-n' c='';;
2072                 esac
2073                 cat <<FOO
2074 They are not compatible!  You are probably running ksh on a non-USG system.
2075 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2076 have echo built in and we may have to run some Bourne shell scripts.  That
2077 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2078
2079 FOO
2080                 $echo $n "The star should be here-->$c"
2081                 $echo "*"
2082         fi
2083         $rm -f foo1 foo2
2084         ;;
2085 esac
2086
2087 cat <<EOS >checkcc
2088 $startsh
2089 EOS
2090 cat <<'EOSC' >>checkcc
2091 case "$cc" in
2092 '') ;;
2093 *)  $rm -f try try.*
2094     $cat >try.c <<EOM
2095 int main(int argc, char *argv[]) {
2096   return 0;
2097 }
2098 EOM
2099     if $cc -o try try.c; then
2100        :
2101     else
2102         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2103         despair=yes
2104         trygcc=yes
2105         case "$cc" in
2106         *gcc*) trygcc=no ;;
2107         esac
2108         case "`$cc -v -c try.c 2>&1`" in
2109         *gcc*) trygcc=no ;;
2110         esac
2111         if $test X"$trygcc" = Xyes; then
2112             if gcc -o try -c try.c; then
2113                 echo " "
2114                 echo "You seem to have a working gcc, though." >&4
2115                 rp="Would you like to use it?"
2116                 dflt=y
2117                 if $test -f myread; then
2118                     . ./myread
2119                 else
2120                     if $test -f UU/myread; then
2121                         . ./UU/myread
2122                     else
2123                         echo "Cannot find myread, sorry.  Aborting." >&2
2124                         exit 1
2125                     fi
2126                 fi  
2127                 case "$ans" in
2128                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no ;;
2129                 esac
2130             fi
2131         fi
2132         if $test X"$despair" = Xyes; then
2133             echo "You need to find a working C compiler." >&4
2134             echo "I cannot continue any further, aborting." >&4
2135             exit 1
2136         fi
2137     fi
2138     $rm -f try try.*
2139     ;;
2140 esac
2141 EOSC
2142
2143 : determine whether symbolic links are supported
2144 echo " "
2145 $touch blurfl
2146 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2147         echo "Symbolic links are supported." >&4
2148         lns="$ln -s"
2149 else
2150         echo "Symbolic links are NOT supported." >&4
2151         lns="$ln"
2152 fi
2153 $rm -f blurfl sym
2154
2155 : see whether [:lower:] and [:upper:] are supported character classes
2156 echo " "
2157 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2158 ABYZ)
2159         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2160         up='[:upper:]'
2161         low='[:lower:]'
2162         ;;
2163 *)      # There is a discontinuity in EBCDIC between 'I' and 'J'
2164         # (0xc9 and 0xd1), therefore that is a nice testing point.
2165         if test "X$up" = X -o "X$low" = X; then
2166             case "`echo IJ | $tr '[I-J]' '[i-j]' 2>/dev/null`" in
2167             ij) up='[A-Z]'
2168                 low='[a-z]'
2169                 ;;
2170             esac
2171         fi
2172         if test "X$up" = X -o "X$low" = X; then
2173             case "`echo IJ | $tr I-J i-j 2>/dev/null`" in
2174             ij) up='A-Z'
2175                 low='a-z'
2176                 ;;
2177             esac
2178         fi
2179         if test "X$up" = X -o "X$low" = X; then
2180             case "`echo IJ | od -x 2>/dev/null`" in
2181             *C9D1*|*c9d1*)
2182                 echo "Hey, this might be EBCDIC." >&4
2183                 if test "X$up" = X -o "X$low" = X; then
2184                     case "`echo IJ | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
2185                     ij) up='[A-IJ-RS-Z]'
2186                         low='[a-ij-rs-z]'
2187                         ;;
2188                     esac
2189                 fi
2190                 if test "X$up" = X -o "X$low" = X; then
2191                     case "`echo IJ | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
2192                     ij) up='A-IJ-RS-Z'
2193                         low='a-ij-rs-z'
2194                         ;;
2195                     esac
2196                 fi
2197                 ;;
2198             esac
2199         fi
2200 esac
2201 case "`echo IJ | $tr \"$up\" \"$low\" 2>/dev/null`" in
2202 ij)
2203     echo "Using $up and $low to convert case." >&4
2204     ;;
2205 *)
2206     echo "I don't know how to translate letters from upper to lower case." >&4
2207     echo "Your tr is not acting any way I know of." >&4
2208     exit 1
2209     ;;
2210 esac
2211 : set up the translation script tr, must be called with ./tr of course
2212 cat >tr <<EOSC
2213 $startsh
2214 case "\$1\$2" in
2215 '[A-Z][a-z]') exec $tr '$up' '$low';;
2216 '[a-z][A-Z]') exec $tr '$low' '$up';;
2217 esac
2218 exec $tr "\$@"
2219 EOSC
2220 chmod +x tr
2221 $eunicefix tr
2222
2223 : Try to determine whether config.sh was made on this system
2224 case "$config_sh" in
2225 '')
2226 myuname=`$uname -a 2>/dev/null`
2227 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
2228 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
2229 # because the A-Z/a-z are not consecutive.
2230 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
2231         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
2232 newmyuname="$myuname"
2233 dflt=n
2234 case "$knowitall" in
2235 '')
2236         if test -f ../config.sh; then
2237                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
2238                         eval "`grep myuname= ../config.sh`"
2239                 fi
2240                 if test "X$myuname" = "X$newmyuname"; then
2241                         dflt=y
2242                 fi
2243         fi
2244         ;;
2245 *) dflt=y;;
2246 esac
2247
2248 : Get old answers from old config file if Configure was run on the
2249 : same system, otherwise use the hints.
2250 hint=default
2251 cd ..
2252 if test -f config.sh; then
2253         echo " "
2254         rp="I see a config.sh file.  Shall I use it to set the defaults?"
2255         . UU/myread
2256         case "$ans" in
2257         n*|N*) echo "OK, I'll ignore it."; mv config.sh config.sh.old;;
2258         *)  echo "Fetching default answers from your old config.sh file..." >&4
2259                 tmp_n="$n"
2260                 tmp_c="$c"
2261                 tmp_sh="$sh"
2262                 . ./config.sh
2263                 cp config.sh UU
2264                 n="$tmp_n"
2265                 c="$tmp_c"
2266                 : Older versions did not always set $sh.  Catch re-use of such
2267                 : an old config.sh.
2268                 case "$sh" in
2269                 '') sh="$tmp_sh" ;;
2270                 esac
2271                 hint=previous
2272                 ;;
2273         esac
2274 fi
2275 . ./UU/checkcc
2276 if test ! -f config.sh; then
2277         $cat <<EOM
2278
2279 First time through, eh?  I have some defaults handy for some systems
2280 that need some extra help getting the Configure answers right:
2281
2282 EOM
2283         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
2284         dflt=''
2285         : Half the following guesses are probably wrong... If you have better
2286         : tests or hints, please send them to perlbug@perl.org
2287         : The metaconfig authors would also appreciate a copy...
2288         $test -f /irix && osname=irix
2289         $test -f /xenix && osname=sco_xenix
2290         $test -f /dynix && osname=dynix
2291         $test -f /dnix && osname=dnix
2292         $test -f /lynx.os && osname=lynxos
2293         $test -f /unicos && osname=unicos && osvers=`$uname -r`
2294         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
2295         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
2296         $test -f /bin/mips && /bin/mips && osname=mips
2297         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
2298                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
2299         $test -d /usr/apollo/bin && osname=apollo
2300         $test -f /etc/saf/_sactab && osname=svr4
2301         $test -d /usr/include/minix && osname=minix
2302         if $test -d /MachTen -o -d /MachTen_Folder; then
2303                 osname=machten
2304                 if $test -x /sbin/version; then
2305                         osvers=`/sbin/version | $awk '{print $2}' |
2306                         $sed -e 's/[A-Za-z]$//'`
2307                 elif $test -x /usr/etc/version; then
2308                         osvers=`/usr/etc/version | $awk '{print $2}' |
2309                         $sed -e 's/[A-Za-z]$//'`
2310                 else
2311                         osvers="$2.$3"
2312                 fi
2313         fi
2314
2315         $test -f /sys/posix.dll &&
2316                 $test -f /usr/bin/what &&
2317                 set X `/usr/bin/what /sys/posix.dll` &&
2318                 $test "$3" = UWIN &&
2319                 osname=uwin &&
2320                 osvers="$5"
2321
2322         if $test -f $uname; then
2323                 set X $myuname
2324                 shift
2325
2326                 case "$5" in
2327                 fps*) osname=fps ;;
2328                 mips*)
2329                         case "$4" in
2330                         umips) osname=umips ;;
2331                         *) osname=mips ;;
2332                         esac;;
2333                 [23]100) osname=mips ;;
2334                 next*) osname=next ;;
2335                 i386*)
2336                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
2337                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
2338                                 osname='sco'
2339                                 osvers=$tmp
2340                         elif $test -f /etc/kconfig; then
2341                                 osname=isc
2342                                 if test "$lns" = "$ln -s"; then
2343                                         osvers=4
2344                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
2345                                         osvers=3
2346                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
2347                                         osvers=2
2348                                 fi
2349                         fi
2350                         tmp=''
2351                         ;;
2352                 pc*)
2353                         if test -n "$DJGPP"; then
2354                                 osname=dos
2355                                 osvers=djgpp
2356                         fi
2357                         ;;
2358                 esac
2359
2360                 case "$1" in
2361                 aix) osname=aix
2362                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
2363                         case "$tmp" in
2364                         'not found') osvers="$4"."$3" ;;
2365                         '<3240'|'<>3240') osvers=3.2.0 ;;
2366                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
2367                         '=3250'|'>3250') osvers=3.2.5 ;;
2368                         *) osvers=$tmp;;
2369                         esac
2370                         ;;
2371                 bsd386) osname=bsd386
2372                         osvers=`$uname -r`
2373                         ;;
2374                 cygwin*) osname=cygwin
2375                         osvers="$3"
2376                         ;;
2377                 *dc.osx) osname=dcosx
2378                         osvers="$3"
2379                         ;;
2380                 dnix) osname=dnix
2381                         osvers="$3"
2382                         ;;
2383                 domainos) osname=apollo
2384                         osvers="$3"
2385                         ;;
2386                 dgux) osname=dgux 
2387                         osvers="$3"
2388                         ;;
2389                 dynixptx*) osname=dynixptx
2390                         osvers=`echo "$4"|sed 's/^v//'`
2391                         ;;
2392                 freebsd) osname=freebsd 
2393                         osvers="$3" ;;
2394                 genix) osname=genix ;;
2395                 hp*) osname=hpux 
2396                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
2397                         ;;
2398                 irix*) osname=irix
2399                         case "$3" in
2400                         4*) osvers=4 ;;
2401                         5*) osvers=5 ;;
2402                         *)      osvers="$3" ;;
2403                         esac
2404                         ;;
2405                 linux) osname=linux
2406                         case "$3" in
2407                         *)      osvers="$3" ;;
2408                         esac
2409                         ;;
2410                 MiNT) osname=mint
2411                         ;;
2412                 netbsd*) osname=netbsd
2413                         osvers="$3"
2414                         ;;
2415                 news-os) osvers="$3"
2416                         case "$3" in
2417                         4*) osname=newsos4 ;;
2418                         *) osname=newsos ;;
2419                         esac
2420                         ;;
2421                 next*) osname=next ;;
2422                 POSIX-BC | posix-bc ) osname=posix-bc
2423                         osvers="$3"
2424                         ;;
2425                 powerux | power_ux | powermax_os | powermaxos | \
2426                 powerunix | power_unix) osname=powerux
2427                         osvers="$3"
2428                         ;;
2429                 qnx) osname=qnx
2430                         osvers="$4"
2431                         ;;
2432                 solaris) osname=solaris
2433                         case "$3" in
2434                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
2435                         *)      osvers="$3" ;;
2436                         esac
2437                         ;;
2438                 sunos) osname=sunos
2439                         case "$3" in
2440                         5*) osname=solaris
2441                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
2442                         *)      osvers="$3" ;;
2443                         esac
2444                         ;;
2445                 titanos) osname=titanos
2446                         case "$3" in
2447                         1*) osvers=1 ;;
2448                         2*) osvers=2 ;;
2449                         3*) osvers=3 ;;
2450                         4*) osvers=4 ;;
2451                         *)      osvers="$3" ;;
2452                         esac
2453                         ;;
2454                 ultrix) osname=ultrix
2455                         osvers="$3"
2456                         ;;
2457                 osf1|mls+)      case "$5" in
2458                                 alpha)
2459                                         osname=dec_osf
2460                                         osvers=`sizer -v | awk '{print $3}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
2461                                         case "$osvers" in
2462                                         [1-9].[0-9]*) ;;
2463                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
2464                                         esac
2465                                         ;;
2466                         hp*)    osname=hp_osf1  ;;
2467                         mips)   osname=mips_osf1 ;;
2468                         esac
2469                         ;;
2470                 unixware) osname=svr5
2471                         osvers="$4"
2472                         ;;
2473                 uts) osname=uts
2474                         osvers="$3"
2475                         ;;
2476                 $2) case "$osname" in
2477                         *isc*) ;;
2478                         *freebsd*) ;;
2479                         svr*)
2480                                 : svr4.x or possibly later
2481                                 case "svr$3" in 
2482                                 ${osname}*)
2483                                         osname=svr$3
2484                                         osvers=$4
2485                                         ;;
2486                                 esac
2487                                 case "$osname" in
2488                                 svr4.0)
2489                                         : Check for ESIX
2490                                         if test -f /stand/boot ; then
2491                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
2492                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
2493                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
2494                                                         if test -n "$isesix"; then
2495                                                                 osname=esix4
2496                                                         fi
2497                                                 fi
2498                                         fi
2499                                         ;;
2500                                 esac
2501                                 ;;
2502                         *)      if test -f /etc/systemid; then
2503                                         osname=sco
2504                                         set `echo $3 | $sed 's/\./ /g'` $4
2505                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
2506                                                 osvers=$1.$2.$3
2507                                         elif $test -f $src/hints/sco_$1_$2.sh; then
2508                                                 osvers=$1.$2
2509                                         elif $test -f $src/hints/sco_$1.sh; then
2510                                                 osvers=$1
2511                                         fi
2512                                 else
2513                                         case "$osname" in
2514                                         '') : Still unknown.  Probably a generic Sys V.
2515                                                 osname="sysv"
2516                                                 osvers="$3"
2517                                                 ;;
2518                                         esac
2519                                 fi
2520                                 ;;
2521                         esac
2522                         ;;
2523                 *)      case "$osname" in
2524                         '') : Still unknown.  Probably a generic BSD.
2525                                 osname="$1"
2526                                 osvers="$3"
2527                                 ;;
2528                         esac
2529                         ;;
2530                 esac
2531         else
2532                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
2533                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
2534                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
2535                                 osname=news_os
2536                         fi
2537                         $rm -f UU/kernel.what
2538                 elif test -d c:/.; then
2539                         set X $myuname
2540                         osname=os2
2541                         osvers="$5"
2542                 fi
2543         fi
2544         
2545         : Now look for a hint file osname_osvers, unless one has been
2546         : specified already.
2547         case "$hintfile" in
2548         ''|' ')
2549                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
2550                 : Also try without trailing minor version numbers.
2551                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
2552                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
2553                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
2554                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
2555                 case "$file" in
2556                 '') dflt=none ;;
2557                 *)  case "$osvers" in
2558                         '') dflt=$file
2559                                 ;;
2560                         *)  if $test -f $src/hints/$file.sh ; then
2561                                         dflt=$file
2562                                 elif $test -f $src/hints/$xfile.sh ; then
2563                                         dflt=$xfile
2564                                 elif $test -f $src/hints/$xxfile.sh ; then
2565                                         dflt=$xxfile
2566                                 elif $test -f $src/hints/$xxxfile.sh ; then
2567                                         dflt=$xxxfile
2568                                 elif $test -f $src/hints/$xxxxfile.sh ; then
2569                                         dflt=$xxxxfile
2570                                 elif $test -f "$src/hints/${osname}.sh" ; then
2571                                         dflt="${osname}"
2572                                 else
2573                                         dflt=none
2574                                 fi
2575                                 ;;
2576                         esac
2577                         ;;
2578                 esac
2579                 if $test -f Policy.sh ; then
2580                         case "$dflt" in
2581                         *Policy*) ;;
2582                         none) dflt="Policy" ;;
2583                         *) dflt="Policy $dflt" ;;
2584                         esac
2585                 fi
2586                 ;;
2587         *)
2588                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
2589                 ;;
2590         esac
2591
2592         if $test -f Policy.sh ; then
2593                 $cat <<EOM
2594
2595 There's also a Policy hint file available, which should make the
2596 site-specific (policy) questions easier to answer.
2597 EOM
2598
2599         fi
2600
2601         $cat <<EOM
2602
2603 You may give one or more space-separated answers, or "none" if appropriate.
2604 A well-behaved OS will have no hints, so answering "none" or just "Policy"
2605 is a good thing.  DO NOT give a wrong version or a wrong OS.
2606
2607 EOM
2608
2609         rp="Which of these apply, if any?"
2610         . UU/myread
2611         tans=$ans
2612         for file in $tans; do
2613                 if $test X$file = XPolicy -a -f Policy.sh; then
2614                         . Policy.sh
2615                         $cat Policy.sh >> UU/config.sh
2616                 elif $test -f $src/hints/$file.sh; then
2617                         . $src/hints/$file.sh
2618                         $cat $src/hints/$file.sh >> UU/config.sh
2619                 elif $test X$tans = X -o X$tans = Xnone ; then
2620                         : nothing
2621                 else
2622                         : Give one chance to correct a possible typo.
2623                         echo "$file.sh does not exist"
2624                         dflt=$file
2625                         rp="hint to use instead?"
2626                         . UU/myread
2627                         for file in $ans; do
2628                                 if $test -f "$src/hints/$file.sh"; then
2629                                         . $src/hints/$file.sh
2630                                         $cat $src/hints/$file.sh >> UU/config.sh
2631                                 elif $test X$ans = X -o X$ans = Xnone ; then
2632                                         : nothing
2633                                 else
2634                                         echo "$file.sh does not exist -- ignored."
2635                                 fi
2636                         done
2637                 fi
2638         done
2639
2640         hint=recommended
2641         : Remember our hint file for later.
2642         if $test -f "$src/hints/$file.sh" ; then
2643                 hintfile="$file"
2644         else
2645                 hintfile=''
2646         fi
2647 fi
2648 cd UU
2649 ;;
2650 *)
2651         echo " "
2652         echo "Fetching default answers from $config_sh..." >&4
2653         tmp_n="$n"
2654         tmp_c="$c"
2655         cd ..
2656         cp $config_sh config.sh 2>/dev/null
2657         chmod +w config.sh
2658         . ./config.sh
2659         cd UU
2660         cp ../config.sh .
2661         n="$tmp_n"
2662         c="$tmp_c"
2663         hint=previous
2664         ;;
2665 esac
2666 test "$override" && . ./optdef.sh
2667 myuname="$newmyuname"
2668
2669 : Restore computed paths
2670 for file in $loclist $trylist; do
2671         eval $file="\$_$file"
2672 done
2673
2674 cat << EOM
2675
2676 Configure uses the operating system name and version to set some defaults.
2677 The default value is probably right if the name rings a bell. Otherwise,
2678 since spelling matters for me, either accept the default or answer "none"
2679 to leave it blank.
2680
2681 EOM
2682 case "$osname" in
2683         ''|' ')
2684                 case "$hintfile" in
2685                 ''|' '|none) dflt=none ;;
2686                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
2687                 esac
2688                 ;;
2689         *) dflt="$osname" ;;
2690 esac
2691 rp="Operating system name?"
2692 . ./myread
2693 case "$ans" in
2694 none)  osname='' ;;
2695 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
2696 esac
2697 echo " "
2698 case "$osvers" in
2699         ''|' ')
2700                 case "$hintfile" in
2701                 ''|' '|none) dflt=none ;;
2702                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
2703                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
2704                         case "$dflt" in
2705                         ''|' ') dflt=none ;;
2706                         esac
2707                         ;;
2708                 esac
2709                 ;;
2710         *) dflt="$osvers" ;;
2711 esac
2712 rp="Operating system version?"
2713 . ./myread
2714 case "$ans" in
2715 none)  osvers='' ;;
2716 *) osvers="$ans" ;;
2717 esac
2718
2719
2720 . ./posthint.sh
2721
2722 : who configured the system
2723 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
2724 cf_by=`(logname) 2>/dev/null`
2725 case "$cf_by" in
2726 "")
2727         cf_by=`(whoami) 2>/dev/null`
2728         case "$cf_by" in
2729         "") cf_by=unknown ;;
2730         esac ;;
2731 esac
2732
2733 : set up the script used to warn in case of inconsistency
2734 cat <<EOS >whoa
2735 $startsh
2736 EOS
2737 cat <<'EOSC' >>whoa
2738 dflt=y
2739 echo " "
2740 echo "*** WHOA THERE!!! ***" >&4
2741 echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
2742 rp="    Keep the $hint value?"
2743 . ./myread
2744 case "$ans" in
2745 y) td=$was; tu=$was;;
2746 esac
2747 EOSC
2748
2749 : function used to set $1 to $val
2750 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
2751 case "$val$was" in
2752 $define$undef) . ./whoa; eval "$var=\$td";;
2753 $undef$define) . ./whoa; eval "$var=\$tu";;
2754 *) eval "$var=$val";;
2755 esac'
2756
2757 case "$usethreads" in
2758 $define|true|[yY]*)     dflt='y';;
2759 *) dflt='n';;
2760 esac
2761 cat <<EOM
2762
2763 Perl can be built to take advantage of threads on some systems.
2764 To do so, Configure can be run with -Dusethreads.
2765
2766 Note that threading is a highly experimental feature, and
2767 some known race conditions still remain.  If you choose to try
2768 it, be very sure to not actually deploy it for production
2769 purposes.  README.threads has more details, and is required
2770 reading if you enable threads.
2771
2772 If this doesn't make any sense to you, just accept the default '$dflt'.
2773 EOM
2774 rp='Build a threading Perl?'
2775 . ./myread
2776 case "$ans" in
2777 y|Y)    val="$define" ;;
2778 *)      val="$undef" ;;
2779 esac
2780 set usethreads
2781 eval $setvar
2782
2783 case "$usethreads" in
2784 $define)
2785         $cat <<EOM
2786
2787 As of 5.5.640, Perl has two different internal threading implementations,
2788 the 5.005 version (5005threads) and an interpreter-based version
2789 (ithreads) that has one interpreter per thread.  Both are very 
2790 experimental.  This arrangement exists to help developers work out
2791 which one is better.
2792
2793 If you're a casual user, you probably don't want interpreter-threads
2794 at this time.  There doesn't yet exist a way to create threads from
2795 within Perl in this model, i.e., "use Thread;" will NOT work.
2796 EOM
2797         : Default to ithreads unless overridden on command line or with
2798         : old config.sh
2799         dflt='y'
2800         case "$use5005threads" in
2801                 $define|true|[yY]*) dflt='n';;
2802         esac
2803         case "$useithreads" in
2804                 $undef|false|[nN]*) dflt='n';;
2805         esac
2806         rp='Use interpreter-based ithreads?'
2807         . ./myread
2808         case "$ans" in
2809         y|Y)    val="$define" ;;
2810         *)      val="$undef" ;;
2811         esac
2812         set useithreads
2813         eval $setvar
2814         : Now set use5005threads to the opposite value.
2815         case "$useithreads" in
2816         $define) val="$undef" ;;
2817         *) val="$define" ;;
2818         esac
2819         set use5005threads
2820         eval $setvar
2821         ;;
2822 *)
2823         useithreads="$undef"
2824         use5005threads="$undef"
2825         ;;
2826 esac
2827
2828 case "$d_oldpthreads" in
2829 '')     : Configure tests would be welcome here.  For now, assume undef.
2830         val="$undef" ;;
2831 *)      val="$d_oldpthreads" ;;
2832 esac
2833 set d_oldpthreads
2834 eval $setvar
2835
2836
2837 case "$usethreads" in
2838 "$define"|true|[yY]*)
2839 : Look for a hint-file generated 'call-back-unit'.  If the
2840 : user has specified that a threading perl is to be built,
2841 : we may need to set or change some other defaults.
2842         if $test -f usethreads.cbu; then
2843                 echo "Your platform has some specific hints for threaded builds, using them..."
2844                 . ./usethreads.cbu
2845         else
2846                 $cat <<EOM
2847 (Your platform doesn't have any specific hints for threaded builds.
2848  Assuming POSIX threads, then.)
2849 EOM
2850         fi
2851         ;;
2852 esac
2853
2854 cat <<EOM
2855
2856 Perl can be built so that multiple Perl interpreters can coexist
2857 within the same Perl executable.
2858 EOM
2859
2860 case "$useithreads" in
2861 $define)
2862         cat <<EOM
2863 This multiple interpreter support is required for interpreter-based threads.
2864 EOM
2865         val="$define"
2866         ;;
2867 *)      case "$usemultiplicity" in
2868         $define|true|[yY]*)     dflt='y';;
2869         *) dflt='n';;
2870         esac
2871         echo " "
2872         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
2873         rp='Build Perl for multiplicity?'
2874         . ./myread
2875         case "$ans" in
2876         y|Y)    val="$define" ;;
2877         *)      val="$undef" ;;
2878         esac
2879         ;;
2880 esac
2881 set usemultiplicity
2882 eval $setvar
2883
2884 : determine where manual pages are on this system
2885 echo " "
2886 case "$sysman" in
2887 '') 
2888         syspath='/usr/man/man1 /usr/man/mann /usr/man/manl /usr/man/local/man1'
2889         syspath="$syspath /usr/man/u_man/man1 /usr/share/man/man1"
2890         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
2891         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
2892         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
2893         sysman=`./loc . /usr/man/man1 $syspath`
2894         ;;
2895 esac
2896 if $test -d "$sysman"; then
2897         echo "System manual is in $sysman." >&4
2898 else
2899         echo "Could not find manual pages in source form." >&4
2900 fi
2901
2902 : see what memory models we can support
2903 case "$models" in
2904 '')
2905         $cat >pdp11.c <<'EOP'
2906 int main() {
2907 #ifdef pdp11
2908         exit(0);
2909 #else
2910         exit(1);
2911 #endif
2912 }
2913 EOP
2914         case "$cc" in
2915         '') modelcc="$cc" ;;
2916         *) modelcc="cc" ;;
2917         esac
2918         ( $modelcc -o pdp11 pdp11.c ) >/dev/null 2>&1
2919         if $test -f pdp11 && ./pdp11 2>/dev/null; then
2920                 dflt='unsplit split'
2921         else
2922                 tans=`./loc . X /lib/small /lib/large /usr/lib/small /usr/lib/large /lib/medium /usr/lib/medium /lib/huge`
2923                 case "$tans" in
2924                 X) dflt='none';;
2925                 *) if $test -d /lib/small || $test -d /usr/lib/small; then
2926                                 dflt='small'
2927                         else
2928                                 dflt=''
2929                         fi
2930                         if $test -d /lib/medium || $test -d /usr/lib/medium; then
2931                                 dflt="$dflt medium"
2932                         fi
2933                         if $test -d /lib/large || $test -d /usr/lib/large; then
2934                                 dflt="$dflt large"
2935                         fi
2936                         if $test -d /lib/huge || $test -d /usr/lib/huge; then
2937                                 dflt="$dflt huge"
2938                         fi
2939                 esac
2940         fi;;
2941 *) dflt="$models";;
2942 esac
2943 $cat <<EOM
2944  
2945 Some systems have different model sizes.  On most systems they are called
2946 small, medium, large, and huge.  On the PDP11 they are called unsplit and
2947 split.  If your system doesn't support different memory models, say "none".
2948 If you wish to force everything to one memory model, say "none" here and
2949 put the appropriate flags later when it asks you for other cc and ld flags.
2950 Venix systems may wish to put "none" and let the compiler figure things out.
2951 (In the following question multiple model names should be space separated.)
2952
2953 The default for most systems is "none".
2954
2955 EOM
2956 rp="Which memory models are supported?"
2957 . ./myread
2958 models="$ans"
2959
2960 case "$models" in
2961 none)
2962         small=''
2963         medium=''
2964         large=''
2965         huge=''
2966         unsplit=''
2967         split=''
2968         ;;
2969 *split)
2970         case "$split" in
2971         '') if $contains '\-i' $sysman/ld.1 >/dev/null 2>&1 || \
2972                          $contains '\-i' $sysman/cc.1 >/dev/null 2>&1; then
2973                         dflt='-i'
2974                 else
2975                         dflt='none'
2976                 fi;;
2977         *) dflt="$split";;
2978         esac
2979         rp="What flag indicates separate I and D space?"
2980         . ./myread
2981         tans="$ans"
2982         case "$tans" in
2983         none) tans='';;
2984         esac
2985         split="$tans"
2986         unsplit='';;
2987 *large*|*small*|*medium*|*huge*)
2988         case "$models" in
2989         *large*)
2990                 case "$large" in
2991                 '') dflt='-Ml';;
2992                 *) dflt="$large";;
2993                 esac
2994         rp="What flag indicates large model?"
2995         . ./myread
2996         tans="$ans"
2997         case "$tans" in
2998         none) tans='';
2999         esac
3000         large="$tans";;
3001         *) large='';;
3002         esac
3003         case "$models" in
3004         *huge*) case "$huge" in
3005                 '') dflt='-Mh';;
3006                 *) dflt="$huge";;
3007                 esac
3008                 rp="What flag indicates huge model?"
3009                 . ./myread
3010                 tans="$ans"
3011                 case "$tans" in
3012                 none) tans='';
3013                 esac
3014                 huge="$tans";;
3015         *) huge="$large";;
3016         esac
3017         case "$models" in
3018         *medium*) case "$medium" in
3019                 '') dflt='-Mm';;
3020                 *) dflt="$medium";;
3021                 esac
3022                 rp="What flag indicates medium model?"
3023                 . ./myread
3024                 tans="$ans"
3025                 case "$tans" in
3026                 none) tans='';
3027                 esac
3028                 medium="$tans";;
3029         *) medium="$large";;
3030         esac
3031         case "$models" in
3032         *small*) case "$small" in
3033                 '') dflt='none';;
3034                 *) dflt="$small";;
3035                 esac
3036                 rp="What flag indicates small model?"
3037                 . ./myread
3038                 tans="$ans"
3039                 case "$tans" in
3040                 none) tans='';
3041                 esac
3042                 small="$tans";;
3043         *) small='';;
3044         esac
3045         ;;
3046 *)
3047         echo "Unrecognized memory models--you may have to edit Makefile.SH" >&4
3048         ;;
3049 esac
3050 $rm -f pdp11.* pdp11
3051
3052 : make some quick guesses about what we are up against
3053 echo " "
3054 $echo $n "Hmm...  $c"
3055 echo exit 1 >bsd
3056 echo exit 1 >usg
3057 echo exit 1 >v7
3058 echo exit 1 >osf1
3059 echo exit 1 >eunice
3060 echo exit 1 >xenix
3061 echo exit 1 >venix
3062 echo exit 1 >os2
3063 d_bsd="$undef"
3064 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
3065 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
3066 then
3067         echo "Looks kind of like an OSF/1 system, but we'll see..."
3068         echo exit 0 >osf1
3069 elif test `echo abc | tr a-z A-Z` = Abc ; then
3070         xxx=`./loc addbib blurfl $pth`
3071         if $test -f $xxx; then
3072         echo "Looks kind of like a USG system with BSD features, but we'll see..."
3073                 echo exit 0 >bsd
3074                 echo exit 0 >usg
3075         else
3076                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
3077                         echo "Looks kind of like an extended USG system, but we'll see..."
3078                 else
3079                         echo "Looks kind of like a USG system, but we'll see..."
3080                 fi
3081                 echo exit 0 >usg
3082         fi
3083 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
3084         echo "Looks kind of like a BSD system, but we'll see..."
3085         d_bsd="$define"
3086         echo exit 0 >bsd
3087 else
3088         echo "Looks kind of like a Version 7 system, but we'll see..."
3089         echo exit 0 >v7
3090 fi
3091 case "$eunicefix" in
3092 *unixtovms*)
3093         $cat <<'EOI'
3094 There is, however, a strange, musty smell in the air that reminds me of
3095 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
3096 EOI
3097         echo exit 0 >eunice
3098         d_eunice="$define"
3099 : it so happens the Eunice I know will not run shell scripts in Unix format
3100         ;;
3101 *)
3102         echo " "
3103         echo "Congratulations.  You aren't running Eunice."
3104         d_eunice="$undef"
3105         ;;
3106 esac
3107 : Detect OS2.  The p_ variable is set above in the Head.U unit.
3108 case "$p_" in
3109 :) ;;
3110 *)
3111         $cat <<'EOI'
3112 I have the feeling something is not exactly right, however...don't tell me...
3113 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
3114 EOI
3115         echo exit 0 >os2
3116         ;;
3117 esac
3118 if test -f /xenix; then
3119         echo "Actually, this looks more like a XENIX system..."
3120         echo exit 0 >xenix
3121         d_xenix="$define"
3122 else
3123         echo " "
3124         echo "It's not Xenix..."
3125         d_xenix="$undef"
3126 fi
3127 chmod +x xenix
3128 $eunicefix xenix
3129 if test -f /venix; then
3130         echo "Actually, this looks more like a VENIX system..."
3131         echo exit 0 >venix
3132 else
3133         echo " "
3134         if ./xenix; then
3135                 : null
3136         else
3137                 echo "Nor is it Venix..."
3138         fi
3139 fi
3140 chmod +x bsd usg v7 osf1 eunice xenix venix os2
3141 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
3142 $rm -f foo
3143
3144 : see if we need a special compiler
3145 echo " "
3146 if ./usg; then
3147         case "$cc" in
3148         '') case "$Mcc" in
3149                 /*) dflt='Mcc';;
3150                 *) case "$large" in
3151                         -M*) dflt='cc';;
3152                         *)      if $contains '\-M' $sysman/cc.1 >/dev/null 2>&1 ; then
3153                                         if $contains '\-M' $sysman/cpp.1 >/dev/null 2>&1; then
3154                                                 dflt='cc'
3155                                         else
3156                                                 dflt='cc -M'
3157                                         fi
3158                                 else
3159                                         dflt='cc'
3160                                 fi;;
3161                         esac;;
3162                 esac;;
3163         *)  dflt="$cc";;
3164         esac
3165         case "$dflt" in
3166         *M*)    $cat <<'EOM'
3167 On some older systems the default C compiler will not resolve multiple global
3168 references that happen to have the same name.  On some such systems the "Mcc"
3169 command may be used to force these to be resolved.  On other systems a "cc -M"
3170 command is required.  (Note that the -M flag on other systems indicates a
3171 memory model to use!) If you have the Gnu C compiler, you might wish to use
3172 that instead.
3173
3174 EOM
3175         ;;
3176         esac
3177         rp="Use which C compiler?"
3178         . ./myread
3179         cc="$ans"
3180 else
3181         case "$cc" in
3182         '') dflt=cc;;
3183         *) dflt="$cc";;
3184         esac
3185         rp="Use which C compiler?"
3186         . ./myread
3187         cc="$ans"
3188 fi
3189 : Look for a hint-file generated 'call-back-unit'.  Now that the
3190 : user has specified the compiler, we may need to set or change some
3191 : other defaults.
3192 if $test -f cc.cbu; then
3193     . ./cc.cbu
3194 fi
3195 . ./checkcc
3196
3197 echo " "
3198 echo "Checking for GNU cc in disguise and/or its version number..." >&4
3199 $cat >gccvers.c <<EOM
3200 #include <stdio.h>
3201 int main() {
3202 #ifdef __GNUC__
3203 #ifdef __VERSION__
3204         printf("%s\n", __VERSION__);
3205 #else
3206         printf("%s\n", "1");
3207 #endif
3208 #endif
3209         exit(0);
3210 }
3211 EOM
3212 if $cc $ldflags -o gccvers gccvers.c; then
3213         gccversion=`./gccvers`
3214         case "$gccversion" in
3215         '') echo "You are not using GNU cc." ;;
3216         *)  echo "You are using GNU cc $gccversion."
3217             ccname=gcc  
3218             ;;
3219         esac
3220 else
3221         echo " "
3222         echo "*** WHOA THERE!!! ***" >&4
3223         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
3224         case "$knowitall" in
3225         '')
3226         echo "    You'd better start hunting for one and let me know about it." >&4
3227                 exit 1
3228                 ;;
3229         esac
3230 fi
3231 $rm -f gccvers*
3232 case "$gccversion" in
3233 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
3234 esac
3235 case "$gccversion" in
3236 '') gccosandvers='' ;;
3237 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
3238    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
3239    gccshortvers=''
3240    case "$gccosandvers" in
3241    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
3242    $osname$osvers) ;; # looking good
3243    $osname*) cat <<EOM >&4
3244
3245 *** WHOA THERE!!! ***
3246
3247     Your gcc has not been compiled for the exact release of
3248     your operating system ($gccosandvers versus $osname$osvers).
3249
3250     In general it is a good idea to keep gcc synchronized with
3251     the operating system because otherwise serious problems
3252     may ensue when trying to compile software, like Perl.
3253
3254     I'm trying to be optimistic here, though, and will continue.
3255     If later during the configuration and build icky compilation
3256     problems appear (headerfile conflicts being the most common
3257     manifestation), I suggest reinstalling the gcc to match
3258     your operating system release.
3259
3260 EOM
3261       ;;
3262    *) gccosandvers='' ;; # failed to parse, better be silent
3263    esac
3264    ;;
3265 esac
3266 case "$ccname" in
3267 '') ccname="$cc" ;;
3268 esac
3269
3270 : see how we invoke the C preprocessor
3271 echo " "
3272 echo "Now, how can we feed standard input to your C preprocessor..." >&4
3273 cat <<'EOT' >testcpp.c
3274 #define ABC abc
3275 #define XYZ xyz
3276 ABC.XYZ
3277 EOT
3278 cd ..
3279 if test ! -f cppstdin; then
3280         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
3281                 # AIX cc -E doesn't show the absolute headerfile
3282                 # locations but we'll cheat by using the -M flag.
3283                 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
3284         else
3285                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
3286         fi
3287 else
3288         echo "Keeping your $hint cppstdin wrapper."
3289 fi
3290 chmod 755 cppstdin
3291 wrapper=`pwd`/cppstdin
3292 ok='false'
3293 cd UU
3294
3295 if $test "X$cppstdin" != "X" && \
3296         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
3297         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3298 then
3299         echo "You used to use $cppstdin $cppminus so we'll use that again."
3300         case "$cpprun" in
3301         '') echo "But let's see if we can live without a wrapper..." ;;
3302         *)
3303                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
3304                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3305                 then
3306                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
3307                         ok='true'
3308                 else
3309                         echo "(However, $cpprun $cpplast does not work, let's see...)"
3310                 fi
3311                 ;;
3312         esac
3313 else
3314         case "$cppstdin" in
3315         '') ;;
3316         *)
3317                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
3318                 ;;
3319         esac
3320 fi
3321
3322 if $ok; then
3323         : nothing
3324 elif echo 'Maybe "'"$cc"' -E" will work...'; \
3325         $cc -E <testcpp.c >testcpp.out 2>&1; \
3326         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3327         echo "Yup, it does."
3328         x_cpp="$cc -E"
3329         x_minus='';
3330 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
3331         $cc -E - <testcpp.c >testcpp.out 2>&1; \
3332         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3333         echo "Yup, it does."
3334         x_cpp="$cc -E"
3335         x_minus='-';
3336 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
3337         $cc -P <testcpp.c >testcpp.out 2>&1; \
3338         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3339         echo "Yipee, that works!"
3340         x_cpp="$cc -P"
3341         x_minus='';
3342 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
3343         $cc -P - <testcpp.c >testcpp.out 2>&1; \
3344         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3345         echo "At long last!"
3346         x_cpp="$cc -P"
3347         x_minus='-';
3348 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
3349         $cpp <testcpp.c >testcpp.out 2>&1; \
3350         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3351         echo "It works!"
3352         x_cpp="$cpp"
3353         x_minus='';
3354 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
3355         $cpp - <testcpp.c >testcpp.out 2>&1; \
3356         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3357         echo "Hooray, it works!  I was beginning to wonder."
3358         x_cpp="$cpp"
3359         x_minus='-';
3360 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
3361         $wrapper <testcpp.c >testcpp.out 2>&1; \
3362         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3363         x_cpp="$wrapper"
3364         x_minus=''
3365         echo "Eureka!"
3366 else
3367         dflt=''
3368         rp="No dice.  I can't find a C preprocessor.  Name one:"
3369         . ./myread
3370         x_cpp="$ans"
3371         x_minus=''
3372         $x_cpp <testcpp.c >testcpp.out 2>&1
3373         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3374                 echo "OK, that will do." >&4
3375         else
3376 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
3377                 exit 1
3378         fi
3379 fi
3380
3381 case "$ok" in
3382 false)
3383         cppstdin="$x_cpp"
3384         cppminus="$x_minus"
3385         cpprun="$x_cpp"
3386         cpplast="$x_minus"
3387         set X $x_cpp
3388         shift
3389         case "$1" in
3390         "$cpp")
3391                 echo "Perhaps can we force $cc -E using a wrapper..."
3392                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
3393                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3394                 then
3395                         echo "Yup, we can."
3396                         cppstdin="$wrapper"
3397                         cppminus='';
3398                 else
3399                         echo "Nope, we'll have to live without it..."
3400                 fi
3401                 ;;
3402         esac
3403         case "$cpprun" in
3404         "$wrapper")
3405                 cpprun=''
3406                 cpplast=''
3407                 ;;
3408         esac
3409         ;;
3410 esac
3411
3412 case "$cppstdin" in
3413 "$wrapper"|'cppstdin') ;;
3414 *) $rm -f $wrapper;;
3415 esac
3416 $rm -f testcpp.c testcpp.out
3417
3418 : decide how portable to be.  Allow command line overrides.
3419 case "$d_portable" in
3420 "$undef") ;;
3421 *)      d_portable="$define" ;;
3422 esac
3423
3424 : set up shell script to do ~ expansion
3425 cat >filexp <<EOSS
3426 $startsh
3427 : expand filename
3428 case "\$1" in
3429  ~/*|~)
3430         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3431         ;;
3432  ~*)
3433         if $test -f /bin/csh; then
3434                 /bin/csh -f -c "glob \$1"
3435                 failed=\$?
3436                 echo ""
3437                 exit \$failed
3438         else
3439                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3440                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3441                 if $test ! -d "\$dir"; then
3442                         me=\`basename \$0\`
3443                         echo "\$me: can't locate home directory for: \$name" >&2
3444                         exit 1
3445                 fi
3446                 case "\$1" in
3447                 */*)
3448                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3449                         ;;
3450                 *)
3451                         echo \$dir
3452                         ;;
3453                 esac
3454         fi
3455         ;;
3456 *)
3457         echo \$1
3458         ;;
3459 esac
3460 EOSS
3461 chmod +x filexp
3462 $eunicefix filexp
3463
3464 : now set up to get a file name
3465 cat <<EOS >getfile
3466 $startsh
3467 EOS
3468 cat <<'EOSC' >>getfile
3469 tilde=''
3470 fullpath=''
3471 already=''
3472 skip=''
3473 none_ok=''
3474 exp_file=''
3475 nopath_ok=''
3476 orig_rp="$rp"
3477 orig_dflt="$dflt"
3478 case "$gfpth" in
3479 '') gfpth='.' ;;
3480 esac
3481
3482 case "$fn" in
3483 *\(*)
3484         expr $fn : '.*(\(.*\)).*' | tr ',' $trnl >getfile.ok
3485         fn=`echo $fn | sed 's/(.*)//'`
3486         ;;
3487 esac
3488
3489 case "$fn" in
3490 *:*)
3491         loc_file=`expr $fn : '.*:\(.*\)'`
3492         fn=`expr $fn : '\(.*\):.*'`
3493         ;;
3494 esac
3495
3496 case "$fn" in
3497 *~*) tilde=true;;
3498 esac
3499 case "$fn" in
3500 */*) fullpath=true;;
3501 esac
3502 case "$fn" in
3503 *+*) skip=true;;
3504 esac
3505 case "$fn" in
3506 *n*) none_ok=true;;
3507 esac
3508 case "$fn" in
3509 *e*) exp_file=true;;
3510 esac
3511 case "$fn" in
3512 *p*) nopath_ok=true;;
3513 esac
3514
3515 case "$fn" in
3516 *f*) type='File';;
3517 *d*) type='Directory';;
3518 *l*) type='Locate';;
3519 esac
3520
3521 what="$type"
3522 case "$what" in
3523 Locate) what='File';;
3524 esac
3525
3526 case "$exp_file" in
3527 '')
3528         case "$d_portable" in
3529         "$define") ;;
3530         *) exp_file=true;;
3531         esac
3532         ;;
3533 esac
3534
3535 cd ..
3536 while test "$type"; do
3537         redo=''
3538         rp="$orig_rp"
3539         dflt="$orig_dflt"
3540         case "$tilde" in
3541         true) rp="$rp (~name ok)";;
3542         esac
3543         . UU/myread
3544         if test -f UU/getfile.ok && \
3545                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3546         then
3547                 value="$ans"
3548                 ansexp="$ans"
3549                 break
3550         fi
3551         case "$ans" in
3552         none)
3553                 value=''
3554                 ansexp=''
3555                 case "$none_ok" in
3556                 true) type='';;
3557                 esac
3558                 ;;
3559         *)
3560                 case "$tilde" in
3561                 '') value="$ans"
3562                         ansexp="$ans";;
3563                 *)
3564                         value=`UU/filexp $ans`
3565                         case $? in
3566                         0)
3567                                 if test "$ans" != "$value"; then
3568                                         echo "(That expands to $value on this system.)"
3569                                 fi
3570                                 ;;
3571                         *) value="$ans";;
3572                         esac
3573                         ansexp="$value"
3574                         case "$exp_file" in
3575                         '') value="$ans";;
3576                         esac
3577                         ;;
3578                 esac
3579                 case "$fullpath" in
3580                 true)
3581                         case "$ansexp" in
3582                         /*) value="$ansexp" ;;
3583                         [a-zA-Z]:/*) value="$ansexp" ;;
3584                         *)
3585                                 redo=true
3586                                 case "$already" in
3587                                 true)
3588                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
3589                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
3590                                         ;;
3591                                 *)
3592                                 echo "Please give a full path name, starting with slash." >&4
3593                                         case "$tilde" in
3594                                         true)
3595                                 echo "Note that using ~name is ok provided it expands well." >&4
3596                                                 already=true
3597                                                 ;;
3598                                         esac
3599                                 esac
3600                                 ;;
3601                         esac
3602                         ;;
3603                 esac
3604                 case "$redo" in
3605                 '')
3606                         case "$type" in
3607                         File)
3608                                 for fp in $gfpth; do
3609                                         if test "X$fp" = X.; then
3610                                             pf="$ansexp"
3611                                         else    
3612                                             pf="$fp/$ansexp"
3613                                         fi
3614                                         if test -f "$pf"; then
3615                                                 type=''
3616                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3617                                         then
3618                                                 echo "($value is not a plain file, but that's ok.)"
3619                                                 type=''
3620                                         fi
3621                                         if test X"$type" = X; then
3622                                             value="$pf"
3623                                             break
3624                                         fi
3625                                 done
3626                                 ;;
3627                         Directory)
3628                                 for fp in $gfpth; do
3629                                         if test "X$fp" = X.; then
3630                                             dir="$ans"
3631                                             direxp="$ansexp"
3632                                         else    
3633                                             dir="$fp/$ansexp"
3634                                             direxp="$fp/$ansexp"
3635                                         fi
3636                                         if test -d "$direxp"; then
3637                                                 type=''
3638                                                 value="$dir"
3639                                                 break
3640                                         fi
3641                                 done
3642                                 ;;
3643                         Locate)
3644                                 if test -d "$ansexp"; then
3645                                         echo "(Looking for $loc_file in directory $value.)"
3646                                         value="$value/$loc_file"
3647                                         ansexp="$ansexp/$loc_file"
3648                                 fi
3649                                 if test -f "$ansexp"; then
3650                                         type=''
3651                                 fi
3652                                 case "$nopath_ok" in
3653                                 true)   case "$value" in
3654                                         */*) ;;
3655                                         *)      echo "Assuming $value will be in people's path."
3656                                                 type=''
3657                                                 ;;
3658                                         esac
3659                                         ;;
3660                                 esac
3661                                 ;;
3662                         esac
3663
3664                         case "$skip" in
3665                         true) type='';
3666                         esac
3667
3668                         case "$type" in
3669                         '') ;;
3670                         *)
3671                                 if test "$fastread" = yes; then
3672                                         dflt=y
3673                                 else
3674                                         dflt=n
3675                                 fi
3676                                 rp="$what $value doesn't exist.  Use that name anyway?"
3677                                 . UU/myread
3678                                 dflt=''
3679                                 case "$ans" in
3680                                 y*) type='';;
3681                                 *) echo " ";;
3682                                 esac
3683                                 ;;
3684                         esac
3685                         ;;
3686                 esac
3687                 ;;
3688         esac
3689 done
3690 cd UU
3691 ans="$value"
3692 rp="$orig_rp"
3693 dflt="$orig_dflt"
3694 rm -f getfile.ok
3695 test "X$gfpthkeep" != Xy && gfpth=""
3696 EOSC
3697
3698 : What should the include directory be ?
3699 echo " "
3700 $echo $n "Hmm...  $c"
3701 dflt='/usr/include'
3702 incpath=''
3703 mips_type=''
3704 if $test -f /bin/mips && /bin/mips; then
3705         echo "Looks like a MIPS system..."
3706         $cat >usr.c <<'EOCP'
3707 #ifdef SYSTYPE_BSD43
3708 /bsd43
3709 #endif
3710 EOCP
3711         if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
3712                 dflt='/bsd43/usr/include'
3713                 incpath='/bsd43'
3714                 mips_type='BSD 4.3'
3715         else
3716                 mips_type='System V'
3717         fi
3718         $rm -f usr.c usr.out
3719         echo "and you're compiling with the $mips_type compiler and libraries."
3720         xxx_prompt=y
3721         echo "exit 0" >mips
3722 else
3723         echo "Doesn't look like a MIPS system."
3724         xxx_prompt=n
3725         echo "exit 1" >mips
3726 fi
3727 chmod +x mips
3728 $eunicefix mips
3729 case "$usrinc" in
3730 '') ;;
3731 *) dflt="$usrinc";;
3732 esac
3733 case "$xxx_prompt" in
3734 y)      fn=d/
3735         echo " "
3736         rp='Where are the include files you want to use?'
3737         . ./getfile
3738         usrinc="$ans"
3739         ;;
3740 *)      usrinc="$dflt"
3741         ;;
3742 esac
3743
3744 : Set private lib path
3745 case "$plibpth" in
3746 '') if ./mips; then
3747                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
3748         fi;;
3749 esac
3750 case "$libpth" in
3751 ' ') dlist='';;
3752 '') dlist="$loclibpth $plibpth $glibpth";;
3753 *) dlist="$libpth";;
3754 esac
3755
3756 : Now check and see which directories actually exist, avoiding duplicates
3757 libpth=''
3758 for xxx in $dlist
3759 do
3760     if $test -d $xxx; then
3761                 case " $libpth " in
3762                 *" $xxx "*) ;;
3763                 *) libpth="$libpth $xxx";;
3764                 esac
3765     fi
3766 done
3767 $cat <<'EOM'
3768
3769 Some systems have incompatible or broken versions of libraries.  Among
3770 the directories listed in the question below, please remove any you
3771 know not to be holding relevant libraries, and add any that are needed.
3772 Say "none" for none.
3773
3774 EOM
3775 case "$libpth" in
3776 '') dflt='none';;
3777 *)
3778         set X $libpth
3779         shift
3780         dflt=${1+"$@"}
3781         ;;
3782 esac
3783 rp="Directories to use for library searches?"
3784 . ./myread
3785 case "$ans" in
3786 none) libpth=' ';;
3787 *) libpth="$ans";;
3788 esac
3789
3790 : compute shared library extension
3791 case "$so" in
3792 '')
3793         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
3794                 dflt='sl'
3795         else
3796                 dflt='so'
3797         fi
3798         ;;
3799 *) dflt="$so";;
3800 esac
3801 $cat <<EOM
3802
3803 On some systems, shared libraries may be available.  Answer 'none' if
3804 you want to suppress searching of shared libraries for the remainder
3805 of this configuration.
3806
3807 EOM
3808 rp='What is the file extension used for shared libraries?'
3809 . ./myread
3810 so="$ans"
3811
3812 : Define several unixisms.
3813 : Hints files or command line option can be used to override them.
3814 : The convoluted testing is in case hints files set either the old
3815 : or the new name.
3816 case "$_exe" in
3817 '')     case "$exe_ext" in
3818     '') ;;
3819         *)      _exe="$exe_ext" ;;
3820         esac
3821         ;;
3822 esac
3823 case "$_a" in
3824 '')     case "$lib_ext" in
3825     '') _a='.a';;
3826         *)      _a="$lib_ext" ;;
3827         esac
3828         ;;
3829 esac
3830 case "$_o" in
3831 '') case "$obj_ext" in
3832         '')     _o='.o';;
3833         *)      _o="$obj_ext";;
3834         esac
3835         ;;
3836 esac
3837 case "$p_" in
3838 '') case "$path_sep" in
3839         '')     p_=':';;
3840         *)      p_="$path_sep";;
3841         esac
3842         ;;
3843 esac
3844 exe_ext=$_exe
3845 lib_ext=$_a
3846 obj_ext=$_o
3847 path_sep=$p_
3848
3849 : Which makefile gets called first.  This is used by make depend.
3850 case "$firstmakefile" in
3851 '') firstmakefile='makefile';;
3852 esac
3853
3854 case "$usesocks" in
3855 $define|true|[yY]*)     dflt='y';;
3856 *) dflt='n';;
3857 esac
3858 cat <<EOM
3859
3860 Perl can be built to use the SOCKS proxy protocol library.  To do so,
3861 Configure must be run with -Dusesocks.
3862
3863 If this doesn't make any sense to you, just accept the default '$dflt'.
3864 EOM
3865 rp='Build Perl for SOCKS?'
3866 . ./myread
3867 case "$ans" in
3868 y|Y)    val="$define" ;;     
3869 *)      val="$undef" ;;
3870 esac
3871 set usesocks
3872 eval $setvar
3873
3874 : Looking for optional libraries
3875 echo " "
3876 echo "Checking for optional libraries..." >&4
3877 case "$libs" in
3878 ' '|'') dflt='';;
3879 *) dflt="$libs";;
3880 esac
3881 case "$libswanted" in
3882 '') libswanted='c_s';;
3883 esac
3884 case "$usesocks" in
3885 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
3886 esac
3887 libsfound=''
3888 libsfiles=''
3889 libsdirs=''
3890 libspath=''
3891 for thisdir in $libpth $xlibpth; do
3892   test -d $thisdir && libspath="$libspath $thisdir"
3893 done
3894 for thislib in $libswanted; do
3895         for thisdir in $libspath; do
3896             xxx=''
3897             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
3898                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|tail -1`
3899                 $test -f "$xxx" && eval $libscheck
3900                 $test -f "$xxx" && libstyle=shared
3901             fi
3902             if test ! -f "$xxx"; then
3903                 xxx=$thisdir/lib$thislib.$so
3904                 $test -f "$xxx" && eval $libscheck
3905                 $test -f "$xxx" && libstyle=shared
3906             fi  
3907             if test ! -f "$xxx"; then
3908                 xxx=$thisdir/lib$thislib$_a
3909                 $test -f "$xxx" && eval $libscheck
3910                 $test -f "$xxx" && libstyle=static
3911             fi
3912             if test ! -f "$xxx"; then
3913                 xxx=$thisdir/$thislib$_a
3914                 $test -f "$xxx" && eval $libscheck
3915                 $test -f "$xxx" && libstyle=static
3916             fi
3917             if test ! -f "$xxx"; then
3918                 xxx=$thisdir/lib${thislib}_s$_a
3919                 $test -f "$xxx" && eval $libscheck
3920                 $test -f "$xxx" && libstyle=static
3921                 $test -f "$xxx" && thislib=${thislib}_s
3922             fi
3923             if test ! -f "$xxx"; then
3924                 xxx=$thisdir/Slib$thislib$_a
3925                 $test -f "$xxx" && eval $libscheck
3926                 $test -f "$xxx" && libstyle=static
3927             fi
3928             if $test -f "$xxx"; then
3929                 case "$libstyle" in
3930                 shared) echo "Found -l$thislib (shared)." ;;
3931                 static) echo "Found -l$thislib." ;;
3932                 *)      echo "Found -l$thislib ($libstyle)." ;;
3933                 esac
3934                 case " $dflt " in
3935                 *"-l$thislib "*);;
3936                 *) dflt="$dflt -l$thislib"
3937                    libsfound="$libsfound $xxx"
3938                    yyy=`basename $xxx`
3939                    libsfiles="$libsfiles $yyy"
3940                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
3941                    case " $libsdirs " in
3942                    *" $yyy "*) ;;
3943                    *) libsdirs="$libsdirs $yyy" ;;
3944                    esac
3945                    ;;
3946                 esac
3947                 break
3948             fi  
3949         done
3950         if $test ! -f "$xxx"; then
3951             echo "No -l$thislib."
3952         fi
3953 done
3954 set X $dflt
3955 shift
3956 dflt="$*"
3957 case "$libs" in
3958 '') dflt="$dflt";;
3959 *) dflt="$libs";;
3960 esac
3961 case "$dflt" in
3962 ' '|'') dflt='none';;
3963 esac
3964
3965 $cat <<EOM
3966
3967 In order to compile $package on your machine, a number of libraries
3968 are usually needed.  Include any other special libraries here as well.
3969 Say "none" for none.  The default list is almost always right.
3970 EOM
3971
3972 echo " "
3973 rp="What libraries to use?"
3974 . ./myread
3975 case "$ans" in
3976 none) libs=' ';;
3977 *) libs="$ans";;
3978 esac
3979
3980 : determine optimization, if desired, or use for debug flag also
3981 case "$optimize" in
3982 ' '|$undef) dflt='none';;
3983 '') dflt='-O';;
3984 *) dflt="$optimize";;
3985 esac
3986 $cat <<EOH
3987
3988 By default, $package compiles with the -O flag to use the optimizer.
3989 Alternately, you might want to use the symbolic debugger, which uses
3990 the -g flag (on traditional Unix systems).  Either flag can be
3991 specified here.  To use neither flag, specify the word "none".
3992
3993 EOH
3994 rp="What optimizer/debugger flag should be used?"
3995 . ./myread
3996 optimize="$ans"
3997 case "$optimize" in
3998 'none') optimize=" ";;
3999 esac
4000
4001 dflt=''
4002 : We will not override a previous value, but we might want to
4003 : augment a hint file
4004 case "$hint" in
4005 default|recommended)
4006         case "$gccversion" in
4007         1*) dflt='-fpcc-struct-return' ;;
4008         esac
4009         case "$optimize" in
4010         *-g*) dflt="$dflt -DDEBUGGING";;
4011         esac
4012         case "$gccversion" in
4013         2*) if test -d /etc/conf/kconfig.d &&
4014                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
4015                 then
4016                         dflt="$dflt -posix"
4017                 fi
4018                 ;;
4019         esac
4020         case "$gccversion" in
4021         1*) ;;
4022         2.[0-8]*) ;;
4023         ?*)     echo " "
4024                 echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
4025                 echo 'int main(void) { return 0; }' > gcctest.c
4026                 if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
4027                         echo "Yes, it does." 2>&1
4028                         case "$ccflags" in
4029                         *strict-aliasing*) 
4030                                 echo "Leaving current flags $ccflags alone." 2>&1
4031                                 ;;
4032                         *) dflt="$dflt -fno-strict-aliasing" ;;
4033                         esac
4034                 else
4035                         echo "Nope, it doesn't, but that's ok." 2>&1
4036                 fi
4037                 ;;
4038         esac
4039         ;;
4040 esac
4041
4042 case "$mips_type" in
4043 *BSD*|'') inclwanted="$locincpth $usrinc";;
4044 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
4045 esac
4046 for thisincl in $inclwanted; do
4047         if $test -d $thisincl; then
4048                 if $test x$thisincl != x$usrinc; then
4049                         case "$dflt" in
4050                         *$thisincl*);;
4051                         *) dflt="$dflt -I$thisincl";;
4052                         esac
4053                 fi
4054         fi
4055 done
4056
4057 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
4058         xxx=true;
4059 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
4060         xxx=true;
4061 else
4062         xxx=false;
4063 fi;
4064 if $xxx; then
4065         case "$dflt" in
4066         *$2*);;
4067         *) dflt="$dflt -D$2";;
4068         esac;
4069 fi'
4070
4071 set signal.h LANGUAGE_C; eval $inctest
4072
4073 case "$usesocks" in
4074 $define)
4075         ccflags="$ccflags -DSOCKS"
4076         ;;
4077 esac
4078
4079 case "$hint" in
4080 default|recommended) dflt="$ccflags $dflt" ;;
4081 *) dflt="$ccflags";;
4082 esac
4083
4084 case "$dflt" in
4085 ''|' ') dflt=none;;
4086 esac
4087 $cat <<EOH
4088
4089 Your C compiler may want other flags.  For this question you should include
4090 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
4091 but you should NOT include libraries or ld flags like -lwhatever.  If you
4092 want $package to honor its debug switch, you should include -DDEBUGGING here.
4093 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
4094
4095 To use no flags, specify the word "none".
4096
4097 EOH
4098 set X $dflt
4099 shift
4100 dflt=${1+"$@"}
4101 rp="Any additional cc flags?"
4102 . ./myread
4103 case "$ans" in
4104 none) ccflags='';;
4105 *) ccflags="$ans";;
4106 esac
4107
4108 : the following weeds options from ccflags that are of no interest to cpp
4109 cppflags="$ccflags"
4110 case "$gccversion" in
4111 1*) cppflags="$cppflags -D__GNUC__"
4112 esac
4113 case "$mips_type" in
4114 '');;
4115 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
4116 esac
4117 case "$cppflags" in
4118 '');;
4119 *)
4120         echo " "
4121         echo "Let me guess what the preprocessor flags are..." >&4
4122         set X $cppflags
4123         shift
4124         cppflags=''
4125         $cat >cpp.c <<'EOM'
4126 #define BLURFL foo
4127
4128 BLURFL xx LFRULB
4129 EOM
4130         previous=''
4131         for flag in $*
4132         do
4133                 case "$flag" in
4134                 -*) ftry="$flag";;
4135                 *) ftry="$previous $flag";;
4136                 esac
4137                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
4138                         >cpp1.out 2>/dev/null && \
4139                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
4140                         >cpp2.out 2>/dev/null && \
4141                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
4142                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
4143                 then
4144                         cppflags="$cppflags $ftry"
4145                         previous=''
4146                 else
4147                         previous="$flag"
4148                 fi
4149         done
4150         set X $cppflags
4151         shift
4152         cppflags=${1+"$@"}
4153         case "$cppflags" in
4154         *-*)  echo "They appear to be: $cppflags";;
4155         esac
4156         $rm -f cpp.c cpp?.out
4157         ;;
4158 esac
4159
4160 : flags used in final linking phase
4161 case "$ldflags" in
4162 '') if ./venix; then
4163                 dflt='-i -z'
4164         else
4165                 dflt=''
4166         fi
4167         case "$ccflags" in
4168         *-posix*) dflt="$dflt -posix" ;;
4169         esac
4170         ;;
4171 *) dflt="$ldflags";;
4172 esac
4173
4174 : Try to guess additional flags to pick up local libraries.
4175 for thislibdir in $libpth; do
4176         case " $loclibpth " in
4177         *" $thislibdir "*)
4178                 case "$dflt " in 
4179                 *"-L$thislibdir "*) ;;
4180                 *)  dflt="$dflt -L$thislibdir" ;;
4181                 esac
4182                 ;;
4183         esac
4184 done
4185
4186 case "$dflt" in
4187 '') dflt='none' ;;
4188 esac
4189
4190 $cat <<EOH
4191
4192 Your C linker may need flags.  For this question you should
4193 include -L/whatever and any other flags used by the C linker, but you
4194 should NOT include libraries like -lwhatever.
4195
4196 Make sure you include the appropriate -L/path flags if your C linker
4197 does not normally search all of the directories you specified above,
4198 namely
4199         $libpth
4200 To use no flags, specify the word "none".
4201
4202 EOH
4203
4204 rp="Any additional ld flags (NOT including libraries)?"
4205 . ./myread
4206 case "$ans" in
4207 none) ldflags='';;
4208 *) ldflags="$ans";;
4209 esac
4210 rmlist="$rmlist pdp11"
4211
4212 : coherency check
4213 echo " "
4214 echo "Checking your choice of C compiler and flags for coherency..." >&4
4215 $cat > try.c <<'EOF'
4216 #include <stdio.h>
4217 int main() { printf("Ok\n"); exit(0); }
4218 EOF
4219 set X $cc $optimize $ccflags -o try $ldflags try.c $libs
4220 shift
4221 $cat >try.msg <<'EOM'
4222 I've tried to compile and run the following simple program:
4223
4224 EOM
4225 $cat try.c >> try.msg
4226
4227 $cat >> try.msg <<EOM
4228
4229 I used the command:
4230
4231         $*
4232         ./try
4233
4234 and I got the following output:
4235
4236 EOM
4237 dflt=y
4238 if sh -c "$cc $optimize $ccflags -o try $ldflags try.c $libs" >>try.msg 2>&1; then
4239         if sh -c './try' >>try.msg 2>&1; then
4240                 xxx=`./try`
4241                 case "$xxx" in
4242                 "Ok") dflt=n ;;
4243                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
4244                         case " $libs " in
4245                         *" -lsfio "*)
4246                                 cat >> try.msg <<'EOQS'
4247 If $libs contains -lsfio, and sfio is mis-configured, then it
4248 sometimes (apparently) runs and exits with a 0 status, but with no
4249 output!  It may have to do with sfio's use of _exit vs. exit.
4250
4251 EOQS
4252                                 rp="You have a big problem.  Shall I abort Configure"
4253                                 dflt=y
4254                                 ;;
4255                         esac
4256                         ;;
4257                 esac
4258         else
4259                 echo "The program compiled OK, but exited with status $?." >>try.msg
4260                 rp="You have a problem.  Shall I abort Configure"
4261                 dflt=y
4262         fi
4263 else
4264         echo "I can't compile the test program." >>try.msg
4265         rp="You have a BIG problem.  Shall I abort Configure"
4266         dflt=y
4267 fi
4268 case "$dflt" in
4269 y)
4270         $cat try.msg >&4
4271         case "$knowitall" in
4272         '')
4273                 echo "(The supplied flags or libraries might be incorrect.)"
4274                 ;;
4275         *) dflt=n;;
4276         esac
4277         echo " "
4278         . ./myread
4279         case "$ans" in
4280         n*|N*) ;;
4281         *)      echo "Ok.  Stopping Configure." >&4
4282                 exit 1
4283                 ;;
4284         esac
4285         ;;
4286 n) echo "OK, that should do.";;
4287 esac
4288 $rm -f try try.* core
4289
4290 : define an is-a-typedef? function
4291 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
4292 case "$inclist" in
4293 "") inclist="sys/types.h";;
4294 esac;
4295 eval "varval=\$$var";
4296 case "$varval" in
4297 "")
4298         $rm -f temp.c;
4299         for inc in $inclist; do
4300                 echo "#include <$inc>" >>temp.c;
4301         done;
4302         echo "#ifdef $type" >> temp.c;
4303         echo "printf(\"We have $type\");" >> temp.c;
4304         echo "#endif" >> temp.c;
4305         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
4306         if $contains $type temp.E >/dev/null 2>&1; then
4307                 eval "$var=\$type";
4308         else
4309                 eval "$var=\$def";
4310         fi;
4311         $rm -f temp.?;;
4312 *) eval "$var=\$varval";;
4313 esac'
4314
4315 : define an is-a-typedef? function that prompts if the type is not available.
4316 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
4317 case "$inclist" in
4318 "") inclist="sys/types.h";;
4319 esac;
4320 eval "varval=\$$var";
4321 case "$varval" in
4322 "")
4323         $rm -f temp.c;
4324         for inc in $inclist; do
4325                 echo "#include <$inc>" >>temp.c;
4326         done;
4327         echo "#ifdef $type" >> temp.c;
4328         echo "printf(\"We have $type\");" >> temp.c;
4329         echo "#endif" >> temp.c;
4330         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
4331         echo " " ;
4332         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
4333         if $contains $type temp.E >/dev/null 2>&1; then
4334                 echo "$type found." >&4;
4335                 eval "$var=\$type";
4336         else
4337                 echo "$type NOT found." >&4;
4338                 dflt="$def";
4339                 . ./myread ;
4340                 eval "$var=\$ans";
4341         fi;
4342         $rm -f temp.?;;
4343 *) eval "$var=\$varval";;
4344 esac'
4345
4346 : define a shorthand compile call
4347 compile='
4348 mc_file=$1;
4349 shift;
4350 $cc $optimize $ccflags $ldflags -o ${mc_file} $* ${mc_file}.c $libs > /dev/null 2>&1;'
4351 : define a shorthand compile call for compilations that should be ok.
4352 compile_ok='
4353 mc_file=$1;
4354 shift;
4355 $cc $optimize $ccflags $ldflags -o ${mc_file} $* ${mc_file}.c $libs;'
4356
4357 : check for lengths of integral types
4358 echo " "
4359 case "$intsize" in
4360 '')
4361         echo "Checking to see how big your integers are..." >&4
4362         $cat >intsize.c <<'EOCP'
4363 #include <stdio.h>
4364 int main()
4365 {
4366         printf("intsize=%d;\n", (int)sizeof(int));
4367         printf("longsize=%d;\n", (int)sizeof(long));
4368         printf("shortsize=%d;\n", (int)sizeof(short));
4369         exit(0);
4370 }
4371 EOCP
4372         set intsize
4373         if eval $compile_ok && ./intsize > /dev/null; then
4374                 eval `./intsize`
4375                 echo "Your integers are $intsize bytes long."
4376                 echo "Your long integers are $longsize bytes long."
4377                 echo "Your short integers are $shortsize bytes long."
4378         else
4379                 $cat >&4 <<EOM
4380 !
4381 Help! I can't compile and run the intsize test program: please enlighten me!
4382 (This is probably a misconfiguration in your system or libraries, and
4383 you really ought to fix it.  Still, I'll try anyway.)
4384 !
4385 EOM
4386                 dflt=4
4387                 rp="What is the size of an integer (in bytes)?"
4388                 . ./myread
4389                 intsize="$ans"
4390                 dflt=$intsize
4391                 rp="What is the size of a long integer (in bytes)?"
4392                 . ./myread
4393                 longsize="$ans"
4394                 dflt=2
4395                 rp="What is the size of a short integer (in bytes)?"
4396                 . ./myread
4397                 shortsize="$ans"
4398         fi
4399         ;;
4400 esac
4401 $rm -f intsize intsize.*
4402
4403 : see what type lseek is declared as in the kernel
4404 rp="What is the type used for lseek's offset on this system?"
4405 set off_t lseektype long stdio.h sys/types.h
4406 eval $typedef_ask
4407
4408 echo " "
4409 echo "Checking to see how big your file offsets are..." >&4
4410 $cat >try.c <<EOCP
4411 #include <sys/types.h>
4412 #include <stdio.h>
4413 int main()
4414 {
4415     printf("%d\n", (int)sizeof($lseektype));
4416     return(0); 
4417 }
4418 EOCP
4419 set try
4420 if eval $compile_ok; then
4421         lseeksize=`./try`
4422         echo "Your file offsets are $lseeksize bytes long."
4423 else
4424         dflt=$longsize
4425         echo " "
4426         echo "(I can't seem to compile the test program.  Guessing...)"
4427         rp="What is the size of your file offsets (in bytes)?"
4428         . ./myread
4429         lseeksize="$ans"
4430 fi
4431 $rm -f try.c try
4432
4433 : see what type file positions are declared as in the library
4434 rp="What is the type for file position used by fsetpos()?"
4435 set fpos_t fpostype long stdio.h sys/types.h
4436 eval $typedef_ask
4437
4438 echo " "
4439 case "$fpostype" in
4440 *_t) zzz="$fpostype"    ;;
4441 *)   zzz="fpos_t"       ;;
4442 esac
4443 echo "Checking the size of $zzz..." >&4 
4444 cat > try.c <<EOCP
4445 #include <sys/types.h>
4446 #include <stdio.h>
4447 int main() {
4448     printf("%d\n", (int)sizeof($fpostype));
4449     exit(0);
4450 }
4451 EOCP
4452 set try
4453 if eval $compile_ok; then
4454         yyy=`./try`
4455         case "$yyy" in
4456         '')     fpossize=4
4457                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
4458                 ;;
4459         *)      fpossize=$yyy
4460                 echo "Your $zzz is $fpossize bytes long."
4461                 ;;
4462         esac
4463 else
4464         dflt="$longsize"
4465         echo " " >&4
4466         echo "(I can't compile the test program.  Guessing...)" >&4
4467         rp="What is the size of your file positions (in bytes)?"
4468         . ./myread
4469         fpossize="$ans"
4470 fi
4471
4472
4473
4474 # Backward compatibility (uselfs is deprecated).
4475 case "$uselfs" in
4476 "$define"|true|[yY]*)
4477         cat <<EOM >&4
4478
4479 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
4480 EOM
4481         uselargefiles="$define"
4482         ;;
4483 esac                          
4484
4485 case "$lseeksize:$fpossize" in
4486 8:8) cat <<EOM
4487
4488 You can have files larger than 2 gigabytes.
4489 EOM
4490    val="$define" ;;
4491 *)    case "$uselargefiles" in
4492    "$undef"|false|[nN]*) dflt='n' ;;
4493    *)   dflt='y' ;;
4494    esac
4495    cat <<EOM
4496
4497 Perl can be built to understand large files (files larger than 2 gigabytes)
4498 on some systems.  To do so, Configure can be run with -Duselargefiles.
4499
4500 If this doesn't make any sense to you, just accept the default '$dflt'.
4501 EOM
4502    rp='Try to understand large files, if available?'
4503    . ./myread
4504    case "$ans" in
4505    y|Y)         val="$define" ;;
4506    *)           val="$undef"  ;;
4507    esac
4508    ;;
4509 esac
4510 set uselargefiles
4511 eval $setvar
4512 case "$uselargefiles" in
4513 "$define")
4514 : Look for a hint-file generated 'call-back-unit'.  If the
4515 : user has specified that a large files perl is to be built,
4516 : we may need to set or change some other defaults.
4517         if $test -f uselargefiles.cbu; then
4518                 echo "Your platform has some specific hints for large file builds, using them..."
4519                 . ./uselargefiles.cbu
4520                 echo " "
4521                 echo "Rechecking to see how big your file offsets are..." >&4
4522                 $cat >try.c <<EOCP
4523 #include <sys/types.h>
4524 #include <stdio.h>
4525 int main()
4526 {
4527     printf("%d\n", (int)sizeof($lseektype));
4528     return(0); 
4529 }
4530 EOCP
4531                 set try
4532                 if eval $compile_ok; then
4533                         lseeksize=`./try`
4534                         $echo "Your file offsets are now $lseeksize bytes long."
4535                 else
4536                         dflt="$lseeksize"
4537                         echo " "
4538                         echo "(I can't seem to compile the test program.  Guessing...)"
4539                         rp="What is the size of your file offsets (in bytes)?"
4540                         . ./myread
4541                         lseeksize="$ans"
4542                 fi
4543                 case "$fpostype" in
4544                 *_t) zzz="$fpostype"    ;;
4545                 *)   zzz="fpos_t"       ;;
4546                 esac
4547                 $echo $n "Rechecking the size of $zzz...$c" >&4 
4548                 $cat > try.c <<EOCP
4549 #include <sys/types.h>
4550 #include <stdio.h>
4551 int main() {
4552     printf("%d\n", (int)sizeof($fpostype));
4553     exit(0);
4554 }
4555 EOCP
4556                 set try
4557                 if eval $compile_ok; then
4558                         yyy=`./try`
4559                         dflt="$lseeksize"
4560                         case "$yyy" in
4561                         '')     echo " "
4562                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
4563                                 ;;
4564                         *)      fpossize=$yyy
4565                                 echo " $fpossize bytes." >&4
4566                                 ;;
4567                         esac
4568                 else
4569                         dflt="$fpossize"
4570                         echo " "
4571                         echo "(I can't compile the test program.  Guessing...)" >&4
4572                         rp="What is the size of your file positions (in bytes)?"
4573                         . ./myread
4574                         fpossize="$ans"
4575                 fi
4576                 $rm -f try.c try
4577         fi
4578         ;;
4579 esac
4580
4581
4582 case "$usemorebits" in
4583 "$define"|true|[yY]*)
4584         use64bitint="$define"
4585         uselongdouble="$define"
4586         usemorebits="$define"
4587         ;;
4588 *)      usemorebits="$undef"
4589         ;;
4590 esac
4591
4592
4593 case "$uselonglong" in
4594 "$define"|true|[yY]*)
4595         cat <<EOM >&4
4596
4597 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
4598 EOM
4599         use64bitint="$define"
4600         ;;
4601 esac                          
4602 case "$use64bits" in
4603 "$define"|true|[yY]*)
4604         cat <<EOM >&4
4605
4606 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
4607 EOM
4608         use64bitint="$define"
4609         ;;
4610 esac                          
4611 case "$use64bitints" in
4612 "$define"|true|[yY]*)
4613         cat <<EOM >&4
4614
4615 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
4616 EOM
4617         use64bitint="$define"
4618         ;;
4619 esac                          
4620 case "$use64bitsint" in
4621 "$define"|true|[yY]*)
4622         cat <<EOM >&4
4623
4624 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
4625 EOM
4626         use64bitint="$define"
4627         ;;
4628 esac                          
4629 case "$uselonglongs" in
4630 "$define"|true|[yY]*)
4631         cat <<EOM >&4
4632
4633 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
4634 EOM
4635         use64bitint="$define"
4636         ;;
4637 esac                          
4638 case "$use64bitsall" in
4639 "$define"|true|[yY]*)
4640         cat <<EOM >&4
4641
4642 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
4643 EOM
4644         use64bitall="$define"
4645         ;;
4646 esac                          
4647
4648 case "$ccflags" in
4649 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
4650 esac
4651 case "$use64bitall" in
4652 "$define"|true|[yY]*) use64bitint="$define" ;;
4653 esac
4654
4655 case "$longsize" in
4656 8) cat <<EOM
4657
4658 You have natively 64-bit long integers.
4659 EOM
4660    val="$define"
4661    ;;
4662 *) case "$use64bitint" in
4663    "$define"|true|[yY]*) dflt='y';;
4664    *) dflt='n';;
4665    esac
4666    cat <<EOM
4667
4668 Perl can be built to take advantage of 64-bit integer types
4669 on some systems.  To do so, Configure can be run with -Duse64bitint.
4670 Choosing this option will most probably introduce binary incompatibilities.
4671
4672 If this doesn't make any sense to you, just accept the default '$dflt'.
4673 EOM
4674    rp='Try to use 64-bit integers, if available?'
4675    . ./myread
4676    case "$ans" in
4677    [yY]*) val="$define" ;;
4678    *)     val="$undef"  ;;
4679    esac
4680    ;;
4681 esac
4682 set use64bitint
4683 eval $setvar
4684
4685 case "$use64bitall" in
4686 "$define"|true|[yY]*) dflt='y' ;;
4687 *) case "$longsize" in
4688    8) dflt='y' ;;
4689    *) dflt='n' ;;
4690    esac
4691    ;;
4692 esac    
4693 cat <<EOM
4694
4695 You may also choose to try maximal 64-bitness.  It means using as much
4696 64-bitness as possible on the platform.  This in turn means even more
4697 binary incompatibilities.  On the other hand, your platform may not
4698 have any more 64-bitness available than what you already have chosen.
4699
4700 If this doesn't make any sense to you, just accept the default '$dflt'.
4701 EOM
4702 rp='Try to use maximal 64-bit support, if available?'
4703 . ./myread
4704 case "$ans" in
4705 [yY]*) val="$define" ;;
4706 *)     val="$undef"  ;;
4707 esac
4708 set use64bitall
4709 eval $setvar
4710 case "$use64bitall" in
4711 "$define")
4712         case "$use64bitint" in
4713         "$undef")
4714                 cat <<EOM
4715
4716 Since you have chosen a maximally 64-bit build, I'm also turning on
4717 the use of 64-bit integers.
4718 EOM
4719                 use64bitint="$define" ;;
4720         esac
4721         ;;
4722 esac
4723
4724 case "$use64bitint" in
4725 "$define"|true|[yY]*)
4726 : Look for a hint-file generated 'call-back-unit'.  If the
4727 : user has specified that a 64-bit perl is to be built,
4728 : we may need to set or change some other defaults.
4729         if $test -f use64bitint.cbu; then
4730                 echo "Your platform has some specific hints for 64-bit integers, using them..."
4731                 . ./use64bitint.cbu
4732         fi
4733         case "$longsize" in
4734         4) case "$archname64" in
4735            '') archname64=64int ;;
4736            esac
4737            ;;
4738         esac
4739         ;;
4740 esac
4741
4742 case "$use64bitall" in
4743 "$define"|true|[yY]*)
4744 : Look for a hint-file generated 'call-back-unit'.  If the
4745 : user has specified that a maximally 64-bit perl is to be built,
4746 : we may need to set or change some other defaults.
4747         if $test -f use64bitall.cbu; then
4748                 echo "Your platform has some specific hints for 64-bit builds, using them..."
4749                 . ./use64bitall.cbu
4750         fi
4751         case "$longsize" in
4752         4) case "$archname64" in
4753            ''|64int) archname64=64all ;;
4754            esac
4755            ;;
4756         esac
4757         ;;
4758 esac
4759
4760 echo " "
4761 echo "Checking for GNU C Library..." >&4
4762 cat >gnulibc.c <<EOM
4763 #include <stdio.h>
4764 int main()
4765 {
4766 #ifdef __GLIBC__
4767     exit(0);
4768 #else
4769     exit(1);
4770 #endif
4771 }
4772 EOM
4773 set gnulibc
4774 if eval $compile_ok && ./gnulibc; then
4775         val="$define"
4776         echo "You are using the GNU C Library"
4777 else
4778         val="$undef"
4779         echo "You are not using the GNU C Library"
4780 fi
4781 $rm -f gnulibc*
4782 set d_gnulibc
4783 eval $setvar
4784
4785 : see if nm is to be used to determine whether a symbol is defined or not
4786 case "$usenm" in
4787 '')
4788         dflt=''
4789         case "$d_gnulibc" in
4790         "$define")
4791                 echo " "
4792                 echo "nm probably won't work on the GNU C Library." >&4
4793                 dflt=n
4794                 ;;
4795         esac
4796         case "$dflt" in
4797         '') 
4798                 if $test "$osname" = aix -a ! -f /lib/syscalls.exp; then
4799                         echo " "
4800                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
4801                         echo "'nm' won't be sufficient on this sytem." >&4
4802                         dflt=n
4803                 fi
4804                 ;;
4805         esac
4806         case "$dflt" in
4807         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
4808                 if $test $dflt -gt 20; then
4809                         dflt=y
4810                 else
4811                         dflt=n
4812                 fi
4813                 ;;
4814         esac
4815         ;;
4816 *)
4817         case "$usenm" in
4818         true|$define) dflt=y;;
4819         *) dflt=n;;
4820         esac
4821         ;;
4822 esac
4823 $cat <<EOM
4824
4825 I can use $nm to extract the symbols from your C libraries. This
4826 is a time consuming task which may generate huge output on the disk (up
4827 to 3 megabytes) but that should make the symbols extraction faster. The
4828 alternative is to skip the 'nm' extraction part and to compile a small
4829 test program instead to determine whether each symbol is present. If
4830 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
4831 this may be the best solution.
4832
4833 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
4834
4835 EOM
4836 rp="Shall I use $nm to extract C symbols from the libraries?"
4837 . ./myread
4838 case "$ans" in
4839 [Nn]*) usenm=false;;
4840 *) usenm=true;;
4841 esac
4842
4843 runnm=$usenm
4844 case "$reuseval" in
4845 true) runnm=false;;
4846 esac
4847
4848 : nm options which may be necessary
4849 case "$nm_opt" in
4850 '') if $test -f /mach_boot; then
4851                 nm_opt=''       # Mach
4852         elif $test -d /usr/ccs/lib; then
4853                 nm_opt='-p'     # Solaris (and SunOS?)
4854         elif $test -f /dgux; then
4855                 nm_opt='-p'     # DG-UX
4856         elif $test -f /lib64/rld; then
4857                 nm_opt='-p'     # 64-bit Irix
4858         else
4859                 nm_opt=''
4860         fi;;
4861 esac
4862
4863 : nm options which may be necessary for shared libraries but illegal
4864 : for archive libraries.  Thank you, Linux.
4865 case "$nm_so_opt" in
4866 '')     case "$myuname" in
4867         *linux*)
4868                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
4869                         nm_so_opt='--dynamic'
4870                 fi
4871                 ;;
4872         esac
4873         ;;
4874 esac
4875
4876 case "$runnm" in
4877 true)
4878 : get list of predefined functions in a handy place
4879 echo " "
4880 case "$libc" in
4881 '') libc=unknown
4882         case "$libs" in
4883         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
4884         esac
4885         ;;
4886 esac
4887 libnames='';
4888 case "$libs" in
4889 '') ;;
4890 *)  for thislib in $libs; do
4891         case "$thislib" in
4892         -lc|-lc_s)
4893                 : Handle C library specially below.
4894                 ;;
4895         -l*)
4896                 thislib=`echo $thislib | $sed -e 's/^-l//'`
4897                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
4898                         :
4899                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
4900                         :
4901                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
4902                         :
4903                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
4904                         :
4905                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
4906                         :
4907                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
4908                         :
4909                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
4910                         :
4911                 else
4912                         try=''
4913                 fi
4914                 libnames="$libnames $try"
4915                 ;;
4916         *) libnames="$libnames $thislib" ;;
4917         esac
4918         done
4919         ;;
4920 esac
4921 xxx=normal
4922 case "$libc" in
4923 unknown)
4924         set /lib/libc.$so
4925         for xxx in $libpth; do
4926                 $test -r $1 || set $xxx/libc.$so
4927                 : The messy sed command sorts on library version numbers.
4928                 $test -r $1 || \
4929                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
4930                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
4931                                 h
4932                                 s/[0-9][0-9]*/0000&/g
4933                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
4934                                 G
4935                                 s/\n/ /' | \
4936                          sort | $sed -e 's/^.* //'`
4937                 eval set \$$#
4938         done
4939         $test -r $1 || set /usr/ccs/lib/libc.$so
4940         $test -r $1 || set /lib/libsys_s$_a
4941         ;;
4942 *)
4943         set blurfl
4944         ;;
4945 esac
4946 if $test -r "$1"; then
4947         echo "Your (shared) C library seems to be in $1."
4948         libc="$1"
4949 elif $test -r /lib/libc && $test -r /lib/clib; then
4950         echo "Your C library seems to be in both /lib/clib and /lib/libc."
4951         xxx=apollo
4952         libc='/lib/clib /lib/libc'
4953         if $test -r /lib/syslib; then
4954                 echo "(Your math library is in /lib/syslib.)"
4955                 libc="$libc /lib/syslib"
4956         fi
4957 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
4958         echo "Your C library seems to be in $libc, as you said before."
4959 elif $test -r $incpath/usr/lib/libc$_a; then
4960         libc=$incpath/usr/lib/libc$_a;
4961         echo "Your C library seems to be in $libc.  That's fine."
4962 elif $test -r /lib/libc$_a; then
4963         libc=/lib/libc$_a;
4964         echo "Your C library seems to be in $libc.  You're normal."
4965 else
4966         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
4967                 :
4968         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
4969                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
4970         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
4971                 :
4972         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
4973                 :
4974         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
4975                 :
4976         else
4977                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
4978         fi
4979         if $test -r "$tans"; then
4980                 echo "Your C library seems to be in $tans, of all places."
4981                 libc=$tans
4982         else
4983                 libc='blurfl'
4984         fi
4985 fi
4986 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
4987         dflt="$libc"
4988         cat <<EOM
4989
4990 If the guess above is wrong (which it might be if you're using a strange
4991 compiler, or your machine supports multiple models), you can override it here.
4992
4993 EOM
4994 else
4995         dflt=''
4996         echo $libpth | tr ' ' $trnl | sort | uniq > libpath
4997         cat >&4 <<EOM
4998 I can't seem to find your C library.  I've looked in the following places:
4999
5000 EOM
5001         $sed 's/^/      /' libpath
5002         cat <<EOM
5003
5004 None of these seems to contain your C library. I need to get its name...
5005
5006 EOM
5007 fi
5008 fn=f
5009 rp='Where is your C library?'
5010 . ./getfile
5011 libc="$ans"
5012
5013 echo " "
5014 echo $libc $libnames | tr ' ' $trnl | sort | uniq > libnames
5015 set X `cat libnames`
5016 shift
5017 xxx=files
5018 case $# in 1) xxx=file; esac
5019 echo "Extracting names from the following $xxx for later perusal:" >&4
5020 echo " "
5021 $sed 's/^/      /' libnames >&4
5022 echo " "
5023 $echo $n "This may take a while...$c" >&4
5024
5025 for file in $*; do
5026         case $file in
5027         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
5028         *) $nm $nm_opt $file 2>/dev/null;;
5029         esac
5030 done >libc.tmp
5031
5032 $echo $n ".$c"
5033 $grep fprintf libc.tmp > libc.ptf
5034 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
5035 xrun='eval "<libc.tmp $com >libc.list"; echo "done" >&4'
5036 xxx='[ADTSIW]'
5037 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *_[_.]*//p' -e 's/^.* $xxx  *//p'";\
5038         eval $xscan;\
5039         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5040                 eval $xrun
5041 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
5042         eval $xscan;\
5043         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5044                 eval $xrun
5045 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
5046         eval $xscan;\
5047         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5048                 eval $xrun
5049 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
5050         eval $xscan;\
5051         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5052                 eval $xrun
5053 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
5054         eval $xscan;\
5055         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5056                 eval $xrun
5057 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
5058         eval $xscan;\
5059         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5060                 eval $xrun
5061 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
5062                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
5063         eval $xscan;\
5064         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5065                 eval $xrun
5066 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
5067         eval $xscan;\
5068         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5069                 eval $xrun
5070 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
5071         eval $xscan;\
5072         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5073                 eval $xrun
5074 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
5075         eval $xscan;\
5076         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5077                 eval $xrun
5078 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
5079         eval $xscan;\
5080         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5081                 eval $xrun
5082 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
5083         eval $xscan;\
5084         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5085                 eval $xrun
5086 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
5087         eval $xscan;\
5088         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5089                 eval $xrun
5090 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
5091         eval $xscan;\
5092         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5093                 eval $xrun
5094 else
5095         $nm -p $* 2>/dev/null >libc.tmp
5096         $grep fprintf libc.tmp > libc.ptf
5097         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
5098                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
5099         then
5100                 nm_opt='-p'
5101                 eval $xrun
5102         else
5103                 echo " "
5104                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
5105                 com=''
5106                 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
5107                         for thisname in $libnames $libc; do
5108                                 $ar t $thisname >>libc.tmp
5109                         done
5110                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
5111                         echo "Ok." >&4
5112                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
5113                         # Repeat libc to extract forwarders to DLL entries too
5114                         for thisname in $libnames $libc; do
5115                                 $ar tv $thisname >>libc.tmp
5116                                 # Revision 50 of EMX has bug in $ar.
5117                                 # it will not extract forwarders to DLL entries
5118                                 # Use emximp which will extract exactly them.
5119                                 emximp -o tmp.imp $thisname \
5120                                     2>/dev/null && \
5121                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
5122                                     < tmp.imp >>libc.tmp
5123                                 $rm tmp.imp
5124                         done
5125                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
5126                         echo "Ok." >&4
5127                 else
5128                         echo "$ar didn't seem to work right." >&4
5129                         echo "Maybe this is a Cray...trying bld instead..." >&4
5130                         if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
5131                         then
5132                                 for thisname in $libnames; do
5133                                         bld t $libnames | \
5134                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
5135                                         $ar t $thisname >>libc.tmp
5136                                 done
5137                                 echo "Ok." >&4
5138                         else
5139                                 echo "That didn't work either.  Giving up." >&4
5140                                 exit 1
5141                         fi
5142                 fi
5143         fi
5144 fi
5145 nm_extract="$com"
5146 if $test -f /lib/syscalls.exp; then
5147         echo " "
5148         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
5149         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*$/\1/p' /lib/syscalls.exp >>libc.list
5150 fi
5151 ;;
5152 esac
5153 $rm -f libnames libpath
5154
5155 : is a C symbol defined?
5156 csym='tlook=$1;
5157 case "$3" in
5158 -v) tf=libc.tmp; tc=""; tdc="";;
5159 -a) tf=libc.tmp; tc="[0]"; tdc="[]";;
5160 *) tlook="^$1\$"; tf=libc.list; tc="()"; tdc="()";;
5161 esac;
5162 tx=yes;
5163 case "$reuseval-$4" in
5164 true-) ;;
5165 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
5166 esac;
5167 case "$tx" in
5168 yes)
5169         case "$runnm" in
5170         true)
5171                 if $contains $tlook $tf >/dev/null 2>&1;
5172                 then tval=true;
5173                 else tval=false;
5174                 fi;;
5175         *)
5176                 echo "int main() { extern short $1$tdc; printf(\"%hd\", $1$tc); }" > t.c;
5177                 if $cc $optimize $ccflags $ldflags -o t t.c $libs >/dev/null 2>&1;
5178                 then tval=true;
5179                 else tval=false;
5180                 fi;
5181                 $rm -f t t.c;;
5182         esac;;
5183 *)
5184         case "$tval" in
5185         $define) tval=true;;
5186         *) tval=false;;
5187         esac;;
5188 esac;
5189 eval "$2=$tval"'
5190
5191 : define an is-in-libc? function
5192 inlibc='echo " "; td=$define; tu=$undef;
5193 sym=$1; var=$2; eval "was=\$$2";
5194 tx=yes;
5195 case "$reuseval$was" in
5196 true) ;;
5197 true*) tx=no;;
5198 esac;
5199 case "$tx" in
5200 yes)
5201         set $sym tres -f;
5202         eval $csym;
5203         case "$tres" in
5204         true)
5205                 echo "$sym() found." >&4;
5206                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
5207         *)
5208                 echo "$sym() NOT found." >&4;
5209                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
5210         esac;;
5211 *)
5212         case "$was" in
5213         $define) echo "$sym() found." >&4;;
5214         *) echo "$sym() NOT found." >&4;;
5215         esac;;
5216 esac'
5217
5218 : see if sqrtl exists
5219 set sqrtl d_sqrtl
5220 eval $inlibc
5221
5222 case "$ccflags" in
5223 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
5224 esac
5225
5226 case "$uselongdouble" in
5227 $define|true|[yY]*)     dflt='y';;
5228 *) dflt='n';;
5229 esac
5230 cat <<EOM
5231
5232 Perl can be built to take advantage of long doubles which
5233 (if available) may give more accuracy and range for floating point numbers.
5234
5235 If this doesn't make any sense to you, just accept the default '$dflt'.
5236 EOM
5237 rp='Try to use long doubles if available?'
5238 . ./myread
5239 case "$ans" in
5240 y|Y)    val="$define"   ;;
5241 *)      val="$undef"    ;;
5242 esac
5243 set uselongdouble
5244 eval $setvar
5245
5246 case "$uselongdouble" in
5247 true|[yY]*) uselongdouble="$define" ;;
5248 esac
5249
5250 case "$uselongdouble" in
5251 $define)
5252 : Look for a hint-file generated 'call-back-unit'.  If the
5253 : user has specified that long doubles should be used,
5254 : we may need to set or change some other defaults.
5255         if $test -f uselongdouble.cbu; then
5256                 echo "Your platform has some specific hints for long doubles, using them..."
5257                 . ./uselongdouble.cbu
5258         else
5259                 $cat <<EOM
5260 (Your platform doesn't have any specific hints for long doubles.)
5261 EOM
5262         fi
5263         ;;
5264 esac
5265
5266 case "$uselongdouble:$d_sqrtl" in
5267 $define:$undef)
5268                 $cat <<EOM >&4
5269
5270 *** You requested the use of long doubles but you do not seem to have
5271 *** the mathematic functions for long doubles.  I'm disabling the use
5272 *** of long doubles.
5273
5274 EOM
5275         uselongdouble=$undef
5276         ;;
5277 esac
5278
5279 : determine the architecture name
5280 echo " "
5281 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
5282         tarch=`arch`"-$osname"
5283 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
5284         if uname -m > tmparch 2>&1 ; then
5285                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
5286                         -e 's/$/'"-$osname/" tmparch`
5287         else
5288                 tarch="$osname"
5289         fi
5290         $rm -f tmparch
5291 else
5292         tarch="$osname"
5293 fi
5294 case "$myarchname" in
5295 ''|"$tarch") ;;
5296 *)
5297         echo "(Your architecture name used to be $myarchname.)"
5298         archname=''
5299         ;;
5300 esac
5301 myarchname="$tarch"
5302 case "$archname" in
5303 '') dflt="$tarch";;
5304 *) dflt="$archname";;
5305 esac
5306 rp='What is your architecture name'
5307 . ./myread
5308 archname="$ans"
5309 case "$usethreads" in
5310 $define)
5311         echo "Threads selected." >&4
5312         case "$archname" in
5313         *-thread*) echo "...and architecture name already has -thread." >&4
5314                 ;;
5315         *)      archname="$archname-thread"
5316                 echo "...setting architecture name to $archname." >&4
5317                 ;;
5318         esac
5319         ;;
5320 esac
5321 case "$usemultiplicity" in
5322 $define)
5323         echo "Multiplicity selected." >&4
5324         case "$archname" in
5325         *-multi*) echo "...and architecture name already has -multi." >&4
5326                 ;;
5327         *)      archname="$archname-multi"
5328                 echo "...setting architecture name to $archname." >&4
5329                 ;;
5330         esac
5331         ;;
5332 esac
5333 case "$use64bitint$use64bitall" in
5334 *"$define"*)
5335         case "$archname64" in
5336         '')
5337                 ;;
5338         *)
5339                 case "$use64bitint" in
5340                 "$define") echo "64 bit integers selected." >&4 ;;
5341                 esac
5342                 case "$use64bitall" in
5343                 "$define") echo "64 bit memory model selected." >&4 ;;
5344                 esac
5345                 case "$archname" in
5346                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
5347                         ;;
5348                 *)      archname="$archname-$archname64"
5349                         echo "...setting architecture name to $archname." >&4
5350                         ;;
5351                 esac
5352                 ;;
5353         esac
5354 esac
5355 case "$uselongdouble" in
5356 $define)
5357         echo "Long doubles selected." >&4
5358         case "$archname" in
5359         *-ld*) echo "...and architecture name already has -ld." >&4
5360                 ;;
5361         *)      archname="$archname-ld"
5362                 echo "...setting architecture name to $archname." >&4
5363                 ;;
5364         esac
5365         ;;
5366 esac
5367
5368 : determine root of directory hierarchy where package will be installed.
5369 case "$prefix" in
5370 '')
5371         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
5372         ;;
5373 *)
5374         dflt="$prefix"
5375         ;;
5376 esac
5377 $cat <<EOM
5378
5379 By default, $package will be installed in $dflt/bin, manual pages
5380 under $dflt/man, etc..., i.e. with $dflt as prefix for all
5381 installation directories. Typically this is something like /usr/local.
5382 If you wish to have binaries under /usr/bin but other parts of the
5383 installation under /usr/local, that's ok: you will be prompted
5384 separately for each of the installation directories, the prefix being
5385 only used to set the defaults.
5386
5387 EOM
5388 fn=d~
5389 rp='Installation prefix to use?'
5390 . ./getfile
5391 oldprefix=''
5392 case "$prefix" in
5393 '') ;;
5394 *)
5395         case "$ans" in
5396         "$prefix") ;;
5397         *) oldprefix="$prefix";;
5398         esac
5399         ;;
5400 esac
5401 prefix="$ans"
5402 prefixexp="$ansexp"
5403
5404 : is AFS running?
5405 echo " "
5406 case "$afs" in
5407 $define|true)   afs=true ;;
5408 $undef|false)   afs=false ;;
5409 *)      if test -d /afs; then
5410                 afs=true
5411         else
5412                 afs=false
5413         fi
5414         ;;
5415 esac
5416 if $afs; then
5417         echo "AFS may be running... I'll be extra cautious then..." >&4
5418 else
5419         echo "AFS does not seem to be running..." >&4
5420 fi
5421
5422 : determine installation prefix for where package is to be installed.
5423 if $afs; then 
5424 $cat <<EOM
5425
5426 Since you are running AFS, I need to distinguish the directory in which
5427 files will reside from the directory in which they are installed (and from
5428 which they are presumably copied to the former directory by occult means).
5429
5430 EOM
5431         case "$installprefix" in
5432         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
5433         *) dflt="$installprefix";;
5434         esac
5435 else
5436 $cat <<EOM
5437
5438 In some special cases, particularly when building $package for distribution,
5439 it is convenient to distinguish between the directory in which files should 
5440 be installed from the directory ($prefix) in which they 
5441 will eventually reside.  For most users, these two directories are the same.
5442
5443 EOM
5444         case "$installprefix" in
5445         '') dflt=$prefix ;;
5446         *) dflt=$installprefix;;
5447         esac
5448 fi
5449 fn=d~
5450 rp='What installation prefix should I use for installing files?'
5451 . ./getfile
5452 installprefix="$ans"
5453 installprefixexp="$ansexp"
5454
5455 : set the prefixit variable, to compute a suitable default value
5456 prefixit='case "$3" in
5457 ""|none)
5458         case "$oldprefix" in
5459         "") eval "$1=\"\$$2\"";;
5460         *)
5461                 case "$3" in
5462                 "") eval "$1=";;
5463                 none)
5464                         eval "tp=\"\$$2\"";
5465                         case "$tp" in
5466                         ""|" ") eval "$1=\"\$$2\"";;
5467                         *) eval "$1=";;
5468                         esac;;
5469                 esac;;
5470         esac;;
5471 *)
5472         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
5473         case "$tp" in
5474         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
5475         /*-$oldprefix/*|\~*-$oldprefix/*)
5476                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
5477         *) eval "$1=\"\$$2\"";;
5478         esac;;
5479 esac'
5480
5481
5482 : get the patchlevel
5483 echo " "
5484 echo "Getting the current patchlevel..." >&4
5485 if $test -r $rsrc/patchlevel.h;then
5486         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
5487         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
5488         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
5489         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
5490         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
5491         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
5492 else
5493         revision=0
5494         patchlevel=0
5495         subversion=0
5496         api_revision=0
5497         api_version=0
5498         api_subversion=0
5499 fi
5500 $echo "(You have $package version $patchlevel subversion $subversion.)"
5501 case "$osname" in
5502 dos|vms)
5503         : XXX Should be a Configure test for double-dots in filenames.
5504         version=`echo $revision $patchlevel $subversion | \
5505                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
5506         api_versionstring=`echo $api_revision $api_version $api_subversion | \
5507                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
5508         ;;
5509 *)
5510         version=`echo $revision $patchlevel $subversion | \
5511                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
5512         api_versionstring=`echo $api_revision $api_version $api_subversion | \
5513                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
5514         ;;
5515 esac
5516 : Special case the 5.005_xx maintenance series, which used 5.005
5517 : without any subversion label as a subdirectory in $sitelib
5518 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
5519         api_versionstring='5.005'
5520 fi
5521
5522 : determine installation style
5523 : For now, try to deduce it from prefix unless it is already set.
5524 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
5525 case "$installstyle" in
5526 '')     case "$prefix" in
5527                 *perl*) dflt='lib';;
5528                 *) dflt='lib/perl5' ;;
5529         esac
5530         ;;
5531 *)      dflt="$installstyle" ;;
5532 esac
5533 : Probably not worth prompting for this since we prompt for all
5534 : the directories individually, and the prompt would be too long and
5535 : confusing anyway.
5536 installstyle=$dflt
5537
5538 : determine where private library files go
5539 : Usual default is /usr/local/lib/perl5/$version.
5540 : Also allow things like /opt/perl/lib/$version, since 
5541 : /opt/perl/lib/perl5... would be redundant.
5542 : The default "style" setting is made in installstyle.U
5543 case "$installstyle" in
5544 *lib/perl5*) set dflt privlib lib/$package/$version ;;
5545 *)       set dflt privlib lib/$version ;;
5546 esac
5547 eval $prefixit
5548 $cat <<EOM
5549
5550 There are some auxiliary files for $package that need to be put into a
5551 private library directory that is accessible by everyone.
5552
5553 EOM
5554 fn=d~+
5555 rp='Pathname where the private library files will reside?'
5556 . ./getfile
5557 privlib="$ans"
5558 privlibexp="$ansexp"
5559 : Change installation prefix, if necessary.
5560 if $test X"$prefix" != X"$installprefix"; then
5561         installprivlib=`echo $privlibexp | sed "s#^$prefix#$installprefix#"`
5562 else
5563         installprivlib="$privlibexp"
5564 fi
5565
5566 : set the prefixup variable, to restore leading tilda escape
5567 prefixup='case "$prefixexp" in
5568 "$prefix") ;;
5569 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
5570 esac'
5571
5572 : determine where public architecture dependent libraries go
5573 set archlib archlib
5574 eval $prefixit
5575 : privlib default is /usr/local/lib/$package/$version
5576 : archlib default is /usr/local/lib/$package/$version/$archname
5577 : privlib may have an optional trailing /share.
5578 tdflt=`echo $privlib | $sed 's,/share$,,'`
5579 tdflt=$tdflt/$archname
5580 case "$archlib" in
5581 '')     dflt=$tdflt
5582         ;;
5583 *)      dflt="$archlib"
5584     ;;
5585 esac
5586 $cat <<EOM
5587
5588 $spackage contains architecture-dependent library files.  If you are
5589 sharing libraries in a heterogeneous environment, you might store
5590 these files in a separate location.  Otherwise, you can just include
5591 them with the rest of the public library files.
5592
5593 EOM
5594 fn=d+~
5595 rp='Where do you want to put the public architecture-dependent libraries?'
5596 . ./getfile
5597 archlib="$ans"
5598 archlibexp="$ansexp"
5599 if $test X"$archlib" = X"$privlib"; then
5600         d_archlib="$undef"
5601 else
5602         d_archlib="$define"
5603 fi
5604 : Change installation prefix, if necessary.
5605 if $test X"$prefix" != X"$installprefix"; then
5606         installarchlib=`echo $archlibexp | sed "s#^$prefix#$installprefix#"`
5607 else
5608         installarchlib="$archlibexp"
5609 fi
5610
5611
5612 : Binary compatibility with 5.005 is not possible for builds
5613 : with advanced features
5614 case "$usethreads$usemultiplicity" in
5615 *define*)
5616         bincompat5005="$undef"
5617         d_bincompat5005="$undef"
5618         ;;
5619 *)      $cat <<EOM
5620
5621 This version of Perl can be compiled for binary compatibility with 5.005.
5622 If you decide to do so, you will be able to continue using most of the
5623 extensions that were compiled for Perl 5.005.
5624
5625 EOM
5626         case "$bincompat5005$d_bincompat5005" in
5627         *"$undef"*) dflt=n ;;
5628         *) dflt=y ;;
5629         esac
5630         rp='Binary compatibility with Perl 5.005?'
5631         . ./myread
5632         case "$ans" in
5633         y*) val="$define" ;;
5634         *)  val="$undef" ;;
5635         esac
5636         set d_bincompat5005
5637         eval $setvar
5638         case "$d_bincompat5005" in
5639         "$define")
5640                 bincompat5005="$define"
5641                 ;;
5642         *)      bincompat5005="$undef"
5643                 d_bincompat5005="$undef"
5644                 ;;
5645         esac
5646         ;;
5647 esac
5648
5649
5650 : see if setuid scripts can be secure
5651 $cat <<EOM
5652
5653 Some kernels have a bug that prevents setuid #! scripts from being
5654 secure.  Some sites have disabled setuid #! scripts because of this.
5655
5656 First let's decide if your kernel supports secure setuid #! scripts.
5657 (If setuid #! scripts would be secure but have been disabled anyway,
5658 don't say that they are secure if asked.)
5659
5660 EOM
5661
5662 val="$undef"
5663 if $test -d /dev/fd; then
5664         echo "#!$ls" >reflect
5665         chmod +x,u+s reflect
5666         ./reflect >flect 2>&1
5667         if $contains "/dev/fd" flect >/dev/null; then
5668                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
5669                 val="$define"
5670         else
5671                 $cat <<EOM
5672 If you are not sure if they are secure, I can check but I'll need a
5673 username and password different from the one you are using right now.
5674 If you don't have such a username or don't want me to test, simply
5675 enter 'none'.
5676
5677 EOM
5678                 rp='Other username to test security of setuid scripts with?'
5679                 dflt='none'
5680                 . ./myread
5681                 case "$ans" in
5682                 n|none)
5683                         case "$d_suidsafe" in
5684                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
5685                                 dflt=n;;
5686                         "$undef")
5687                                 echo "Well, the $hint value is *not* secure." >&4
5688                                 dflt=n;;
5689                         *)      echo "Well, the $hint value *is* secure." >&4
5690                                 dflt=y;;
5691                         esac
5692                         ;;
5693                 *)
5694                         $rm -f reflect flect
5695                         echo "#!$ls" >reflect
5696                         chmod +x,u+s reflect
5697                         echo >flect
5698                         chmod a+w flect
5699                         echo '"su" will (probably) prompt you for '"$ans's password."
5700                         su $ans -c './reflect >flect'
5701                         if $contains "/dev/fd" flect >/dev/null; then
5702                                 echo "Okay, it looks like setuid scripts are secure." >&4
5703                                 dflt=y
5704                         else
5705                                 echo "I don't think setuid scripts are secure." >&4
5706                                 dflt=n
5707                         fi
5708                         ;;
5709                 esac
5710                 rp='Does your kernel have *secure* setuid scripts?'
5711                 . ./myread
5712                 case "$ans" in
5713                 [yY]*)  val="$define";;
5714                 *)      val="$undef";;
5715                 esac
5716         fi
5717 else
5718         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
5719         echo "(That's for file descriptors, not floppy disks.)"
5720         val="$undef"
5721 fi
5722 set d_suidsafe
5723 eval $setvar
5724
5725 $rm -f reflect flect
5726
5727 : now see if they want to do setuid emulation
5728 echo " "
5729 val="$undef"
5730 case "$d_suidsafe" in
5731 "$define")
5732         val="$undef"
5733         echo "No need to emulate SUID scripts since they are secure here." >& 4
5734         ;;
5735 *)
5736         $cat <<EOM
5737 Some systems have disabled setuid scripts, especially systems where
5738 setuid scripts cannot be secure.  On systems where setuid scripts have
5739 been disabled, the setuid/setgid bits on scripts are currently
5740 useless.  It is possible for $package to detect those bits and emulate
5741 setuid/setgid in a secure fashion.  This emulation will only work if
5742 setuid scripts have been disabled in your kernel.
5743
5744 EOM
5745         case "$d_dosuid" in
5746         "$define") dflt=y ;;
5747         *) dflt=n ;;
5748         esac
5749         rp="Do you want to do setuid/setgid emulation?"
5750         . ./myread
5751         case "$ans" in
5752         [yY]*)  val="$define";;
5753         *)      val="$undef";;
5754         esac
5755         ;;
5756 esac
5757 set d_dosuid
5758 eval $setvar
5759
5760 : determine filename position in cpp output
5761 echo " "
5762 echo "Computing filename position in cpp output for #include directives..." >&4
5763 echo '#include <stdio.h>' > foo.c
5764 $cat >fieldn <<EOF
5765 $startsh
5766 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5767 $grep '^[       ]*#.*stdio\.h' | \
5768 while read cline; do
5769         pos=1
5770         set \$cline
5771         while $test \$# -gt 0; do
5772                 if $test -r \`echo \$1 | $tr -d '"'\`; then
5773                         echo "\$pos"
5774                         exit 0
5775                 fi
5776                 shift
5777                 pos=\`expr \$pos + 1\`
5778         done
5779 done
5780 EOF
5781 chmod +x fieldn
5782 fieldn=`./fieldn`
5783 $rm -f foo.c fieldn
5784 case $fieldn in
5785 '') pos='???';;
5786 1) pos=first;;
5787 2) pos=second;;
5788 3) pos=third;;
5789 *) pos="${fieldn}th";;
5790 esac
5791 echo "Your cpp writes the filename in the $pos field of the line."
5792
5793 : locate header file
5794 $cat >findhdr <<EOF
5795 $startsh
5796 wanted=\$1
5797 name=''
5798 for usrincdir in $usrinc
5799 do
5800         if test -f \$usrincdir/\$wanted; then
5801                 echo "\$usrincdir/\$wanted"
5802                 exit 0
5803         fi
5804 done
5805 awkprg='{ print \$$fieldn }'
5806 echo "#include <\$wanted>" > foo\$\$.c
5807 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5808 $grep "^[       ]*#.*\$wanted" | \
5809 while read cline; do
5810         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5811         case "\$name" in
5812         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5813         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5814         *) exit 2;;
5815         esac;
5816 done;
5817 #
5818 # status = 0: grep returned 0 lines, case statement not executed
5819 # status = 1: headerfile found
5820 # status = 2: while loop executed, no headerfile found
5821 #
5822 status=\$?
5823 $rm -f foo\$\$.c;
5824 if test \$status -eq 1; then
5825         exit 0;
5826 fi
5827 exit 1
5828 EOF
5829 chmod +x findhdr
5830
5831 : define an alternate in-header-list? function
5832 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5833 cont=true; xxf="echo \"<\$1> found.\" >&4";
5834 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5835 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5836 esac;
5837 case $# in 4) instead=instead;; *) instead="at last";; esac;
5838 while $test "$cont"; do
5839         xxx=`./findhdr $1`
5840         var=$2; eval "was=\$$2";
5841         if $test "$xxx" && $test -r "$xxx";
5842         then eval $xxf;
5843         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5844                 cont="";
5845         else eval $xxnf;
5846         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5847         set $yyy; shift; shift; yyy=$@;
5848         case $# in 0) cont="";;
5849         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5850                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5851         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5852                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5853         esac;
5854 done;
5855 while $test "$yyy";
5856 do set $yyy; var=$2; eval "was=\$$2";
5857         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5858         set $yyy; shift; shift; yyy=$@;
5859 done'
5860
5861 : see if this is a malloc.h system
5862 set malloc.h i_malloc
5863 eval $inhdr
5864
5865 : see if stdlib is available
5866 set stdlib.h i_stdlib
5867 eval $inhdr
5868
5869 : determine which malloc to compile in
5870 echo " "
5871 case "$usemymalloc" in
5872 ''|[yY]*|true|$define)  dflt='y' ;;
5873 *)      dflt='n' ;;
5874 esac
5875 rp="Do you wish to attempt to use the malloc that comes with $package?"
5876 . ./myread
5877 usemymalloc="$ans"
5878 case "$ans" in
5879 y*|true)
5880         usemymalloc='y'
5881         mallocsrc='malloc.c'
5882         mallocobj="malloc$_o"
5883         d_mymalloc="$define"
5884         case "$libs" in
5885         *-lmalloc*)
5886                 : Remove malloc from list of libraries to use
5887                 echo "Removing unneeded -lmalloc from library list" >&4
5888                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
5889                 shift
5890                 libs="$*"
5891                 echo "libs = $libs" >&4
5892                 ;;
5893         esac
5894         ;;
5895 *)
5896         usemymalloc='n'
5897         mallocsrc=''
5898         mallocobj=''
5899         d_mymalloc="$undef"
5900         ;;
5901 esac
5902
5903 : compute the return types of malloc and free
5904 echo " "
5905 $cat >malloc.c <<END
5906 #$i_malloc I_MALLOC
5907 #$i_stdlib I_STDLIB
5908 #include <stdio.h>
5909 #include <sys/types.h>
5910 #ifdef I_MALLOC
5911 #include <malloc.h>
5912 #endif
5913 #ifdef I_STDLIB
5914 #include <stdlib.h>
5915 #endif
5916 #ifdef TRY_MALLOC
5917 void *malloc();
5918 #endif
5919 #ifdef TRY_FREE
5920 void free();
5921 #endif
5922 END
5923 case "$malloctype" in
5924 '')
5925         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
5926                 malloctype='void *'
5927         else
5928                 malloctype='char *'
5929         fi
5930         ;;
5931 esac
5932 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
5933
5934 case "$freetype" in
5935 '')
5936         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
5937                 freetype='void'
5938         else
5939                 freetype='int'
5940         fi
5941         ;;
5942 esac
5943 echo "Your system uses $freetype free(), it would seem." >&4
5944 $rm -f malloc.[co]
5945 $cat <<EOM
5946
5947 After $package is installed, you may wish to install various
5948 add-on modules and utilities.  Typically, these add-ons will
5949 be installed under $prefix with the rest
5950 of this package.  However, you may wish to install such add-ons
5951 elsewhere under a different prefix.
5952
5953 If you do not wish to put everything under a single prefix, that's
5954 ok.  You will be prompted for the individual locations; this siteprefix
5955 is only used to suggest the defaults.
5956
5957 The default should be fine for most people.
5958
5959 EOM
5960 fn=d~+
5961 rp='Installation prefix to use for add-on modules and utilities?'
5962 : XXX Here might be another good place for an installstyle setting.
5963 case "$siteprefix" in
5964 '') dflt=$prefix ;;
5965 *)  dflt=$siteprefix ;;
5966 esac
5967 . ./getfile
5968 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
5969 oldsiteprefix=''
5970 case "$siteprefix" in
5971 '') ;;
5972 *)      case "$ans" in
5973         "$prefix") ;;
5974         *) oldsiteprefix="$prefix";;
5975         esac
5976         ;;
5977 esac
5978 siteprefix="$ans"
5979 siteprefixexp="$ansexp"
5980
5981 : determine where site specific libraries go.
5982 : Usual default is /usr/local/lib/perl5/site_perl/$version
5983 : The default "style" setting is made in installstyle.U
5984 : XXX No longer works with Prefixit stuff.
5985 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
5986 case "$sitelib" in
5987 '') case "$installstyle" in
5988         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
5989         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
5990         esac
5991         ;;
5992 *)      dflt="$sitelib"
5993         ;;
5994 esac
5995 $cat <<EOM
5996
5997 The installation process will create a directory for
5998 site-specific extensions and modules.  Most users find it convenient
5999 to place all site-specific files in this directory rather than in the
6000 main distribution directory.
6001
6002 EOM
6003 fn=d~+
6004 rp='Pathname for the site-specific library files?'
6005 . ./getfile
6006 sitelib="$ans"
6007 sitelibexp="$ansexp"
6008 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
6009 : Change installation prefix, if necessary.
6010 if $test X"$prefix" != X"$installprefix"; then
6011         installsitelib=`echo $sitelibexp | $sed "s#^$prefix#$installprefix#"`
6012 else
6013         installsitelib="$sitelibexp"
6014 fi
6015
6016 : determine where site specific architecture-dependent libraries go.
6017 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
6018 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
6019 : sitelib may have an optional trailing /share.
6020 case "$sitearch" in
6021 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
6022         dflt="$dflt/$archname"
6023         ;;
6024 *)      dflt="$sitearch"
6025         ;;
6026 esac
6027 set sitearch sitearch none
6028 eval $prefixit
6029 $cat <<EOM
6030
6031 The installation process will also create a directory for
6032 architecture-dependent site-specific extensions and modules.
6033
6034 EOM
6035 fn=d~+
6036 rp='Pathname for the site-specific architecture-dependent library files?'
6037 . ./getfile
6038 sitearch="$ans"
6039 sitearchexp="$ansexp"
6040 : Change installation prefix, if necessary.
6041 if $test X"$prefix" != X"$installprefix"; then
6042         installsitearch=`echo $sitearchexp | sed "s#^$prefix#$installprefix#"`
6043 else
6044         installsitearch="$sitearchexp"
6045 fi
6046
6047 $cat <<EOM
6048
6049 The installation process will also create a directory for
6050 vendor-supplied add-ons.  Vendors who supply perl with their system
6051 may find it convenient to place all vendor-supplied files in this
6052 directory rather than in the main distribution directory.  This will
6053 ease upgrades between binary-compatible maintenance versions of perl.
6054
6055 Of course you may also use these directories in whatever way you see
6056 fit.  For example, you might use them to access modules shared over a
6057 company-wide network.
6058
6059 The default answer should be fine for most people.
6060 This causes further questions about vendor add-ons to be skipped
6061 and no vendor-specific directories will be configured for perl.
6062
6063 EOM
6064 rp='Do you want to configure vendor-specific add-on directories?'
6065 case "$usevendorprefix" in
6066 define|true|[yY]*) dflt=y ;;
6067 *)      : User may have set vendorprefix directly on Configure command line.
6068         case "$vendorprefix" in
6069         ''|' ') dflt=n ;;
6070         *)      dflt=y ;;
6071         esac
6072         ;;
6073 esac
6074 . ./myread
6075 case "$ans" in
6076 [yY]*)  fn=d~+
6077         rp='Installation prefix to use for vendor-supplied add-ons?'
6078         case "$vendorprefix" in
6079         '') dflt='' ;;
6080         *)  dflt=$vendorprefix ;;
6081         esac
6082         . ./getfile
6083         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6084         oldvendorprefix=''
6085         case "$vendorprefix" in
6086         '') ;;
6087         *)      case "$ans" in
6088                 "$prefix") ;;
6089                 *) oldvendorprefix="$prefix";;
6090                 esac
6091                 ;;
6092         esac
6093         usevendorprefix="$define"
6094         vendorprefix="$ans"
6095         vendorprefixexp="$ansexp"
6096         ;;
6097 *)      usevendorprefix="$undef"
6098         vendorprefix=''
6099         vendorprefixexp=''
6100         ;;
6101 esac
6102
6103 case "$vendorprefix" in
6104 '')     d_vendorlib="$undef"
6105         vendorlib=''
6106         vendorlibexp=''
6107         ;;
6108 *)      d_vendorlib="$define"
6109         : determine where vendor-supplied modules go.
6110         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
6111         case "$vendorlib" in
6112         '')
6113                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6114                 case "$installstyle" in
6115                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
6116                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
6117                 esac
6118                 ;;
6119         *)      dflt="$vendorlib"
6120                 ;;
6121         esac
6122         fn=d~+
6123         rp='Pathname for the vendor-supplied library files?'
6124         . ./getfile
6125         vendorlib="$ans"
6126         vendorlibexp="$ansexp"
6127         ;;
6128 esac
6129 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
6130 : Change installation prefix, if necessary.
6131 if $test X"$prefix" != X"$installprefix"; then
6132         installvendorlib=`echo $vendorlibexp | $sed "s#^$prefix#$installprefix#"`
6133 else
6134         installvendorlib="$vendorlibexp"
6135 fi
6136
6137 case "$vendorprefix" in
6138 '')     d_vendorarch="$undef"
6139         vendorarch=''
6140         vendorarchexp=''
6141         ;;
6142 *)      d_vendorarch="$define"
6143         : determine where vendor-supplied architecture-dependent libraries go.
6144         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
6145         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
6146         : vendorlib may have an optional trailing /share.
6147         case "$vendorarch" in
6148         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
6149                 dflt="$dflt/$archname"
6150                 ;;
6151         *)      dflt="$vendorarch" ;;
6152         esac
6153         fn=d~+
6154         rp='Pathname for vendor-supplied architecture-dependent files?'
6155         . ./getfile
6156         vendorarch="$ans"
6157         vendorarchexp="$ansexp"
6158         ;;
6159 esac
6160 : Change installation prefix, if necessary.
6161 if $test X"$prefix" != X"$installprefix"; then
6162         installvendorarch=`echo $vendorarchexp | sed "s#^$prefix#$installprefix#"`
6163 else
6164         installvendorarch="$vendorarchexp"
6165 fi
6166
6167 : Final catch-all directories to search
6168 $cat <<EOM
6169
6170 Lastly, you can have perl look in other directories for extensions and
6171 modules in addition to those already specified.
6172 These directories will be searched after 
6173         $sitearch 
6174         $sitelib 
6175 EOM
6176 test X"$vendorlib" != "X" && echo '     ' $vendorlib
6177 test X"$vendorarch" != "X" && echo '    ' $vendorarch
6178 echo ' '
6179 case "$otherlibdirs" in
6180 ''|' ') dflt='none' ;;
6181 *)      dflt="$otherlibdirs" ;;
6182 esac
6183 $cat <<EOM
6184 Enter a colon-separated set of extra paths to include in perl's @INC
6185 search path, or enter 'none' for no extra paths.
6186
6187 EOM
6188
6189 rp='Colon-separated list of additional directories for perl to search?'
6190 . ./myread
6191 case "$ans" in
6192 ' '|''|none)    otherlibdirs=' ' ;;     
6193 *)      otherlibdirs="$ans" ;;
6194 esac
6195 case "$otherlibdirs" in
6196 ' ') val=$undef ;;
6197 *)      val=$define ;;
6198 esac
6199 set d_perl_otherlibdirs
6200 eval $setvar
6201
6202 : Cruising for prototypes
6203 echo " "
6204 echo "Checking out function prototypes..." >&4
6205 $cat >prototype.c <<'EOCP'
6206 int main(int argc, char *argv[]) {
6207         exit(0);}
6208 EOCP
6209 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
6210         echo "Your C compiler appears to support function prototypes."
6211         val="$define"
6212 else
6213         echo "Your C compiler doesn't seem to understand function prototypes."
6214         val="$undef"
6215 fi
6216 set prototype
6217 eval $setvar
6218 $rm -f prototype*
6219
6220 case "$prototype" in
6221 "$define") ;;
6222 *)      ansi2knr='ansi2knr'
6223         echo " "
6224         cat <<EOM >&4
6225
6226 $me:  FATAL ERROR:
6227 This version of $package can only be compiled by a compiler that 
6228 understands function prototypes.  Unfortunately, your C compiler 
6229         $cc $ccflags
6230 doesn't seem to understand them.  Sorry about that.
6231
6232 If GNU cc is available for your system, perhaps you could try that instead.  
6233
6234 Eventually, we hope to support building Perl with pre-ANSI compilers.
6235 If you would like to help in that effort, please contact <perlbug@perl.org>.
6236
6237 Aborting Configure now.
6238 EOM
6239         exit 2
6240         ;;
6241 esac
6242
6243 : determine where public executables go
6244 echo " "
6245 set dflt bin bin
6246 eval $prefixit
6247 fn=d~
6248 rp='Pathname where the public executables will reside?'
6249 . ./getfile
6250 if $test "X$ansexp" != "X$binexp"; then
6251         installbin=''
6252 fi
6253 bin="$ans"
6254 binexp="$ansexp"
6255 : Change installation prefix, if necessary.
6256 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
6257 if $test X"$prefix" != X"$installprefix"; then
6258         installbin=`echo $binexp | sed "s#^$prefix#$installprefix#"`
6259 else
6260         installbin="$binexp"
6261 fi
6262
6263 : Find perl5.005 or later.
6264 echo "Looking for a previously installed perl5.005 or later... "
6265 case "$perl5" in
6266 '')     for tdir in `echo "$binexp:$PATH" | $sed "s/$path_sep/ /g"`; do
6267                 : Check if this perl is recent and can load a simple module
6268                 if $test -x $tdir/perl && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6269                         perl5=$tdir/perl
6270                         break;
6271                 elif $test -x $tdir/perl5 && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6272                         perl5=$tdir/perl
6273                         break;
6274                 fi
6275         done
6276         ;;
6277 *)      perl5="$perl5"
6278         ;;
6279 esac
6280 case "$perl5" in
6281 '')     echo "None found.  That's ok.";;
6282 *)      echo "Using $perl5." ;;
6283 esac
6284
6285 : Determine list of previous versions to include in @INC
6286 $cat > getverlist <<EOPL
6287 #!$perl5 -w
6288 use File::Basename;
6289 \$api_versionstring = "$api_versionstring";
6290 \$version = "$version";
6291 \$stem = "$sitelib_stem";
6292 \$archname = "$archname";
6293 EOPL
6294         $cat >> getverlist <<'EOPL'
6295 # Can't have leading @ because metaconfig interprets it as a command!
6296 ;@inc_version_list=();
6297 # XXX Redo to do opendir/readdir? 
6298 if (-d $stem) {
6299     chdir($stem);
6300     ;@candidates = glob("5.*");
6301 }
6302 else {
6303     ;@candidates = ();
6304 }
6305
6306 # XXX ToDo:  These comparisons must be reworked when two-digit
6307 # subversions come along, so that 5.7.10 compares as greater than
6308 # 5.7.3!  By that time, hope that 5.6.x is sufficiently
6309 # widespread that we can use the built-in version vectors rather
6310 # than reinventing them here.  For 5.6.0, however, we must
6311 # assume this script will likely be run by 5.005_0x.  --AD 1/2000.
6312 foreach $d (@candidates) {
6313     if ($d lt $version) {
6314         if ($d ge $api_versionstring) {
6315             unshift(@inc_version_list, grep { -d } "$d/$archname", $d);
6316         }
6317         elsif ($d ge "5.005") {
6318             unshift(@inc_version_list, grep { -d } $d);
6319         }
6320     }
6321     else {
6322         # Skip newer version.  I.e. don't look in
6323         # 5.7.0 if we're installing 5.6.1.
6324     }
6325 }
6326
6327 if (@inc_version_list) {
6328     print join(' ', @inc_version_list);
6329 }
6330 else {
6331     # Blank space to preserve value for next Configure run.
6332     print " ";
6333 }
6334 EOPL
6335 chmod +x getverlist
6336 case "$inc_version_list" in
6337 '')     if test -x "$perl5"; then
6338                 dflt=`$perl5 getverlist`
6339         else
6340                 dflt='none'
6341         fi
6342         ;;
6343 $undef) dflt='none' ;;
6344 *)  dflt="$inc_version_list" ;;
6345 esac
6346 case "$dflt" in
6347 ''|' ') dflt=none ;;
6348 esac
6349 case "$dflt" in
6350 5.005) case "$bincompat5005" in
6351        $define|true|[yY]*) ;;
6352        *) dflt=none ;;
6353        esac
6354        ;;
6355 esac
6356 $cat <<'EOM'
6357
6358 In order to ease the process of upgrading, this version of perl 
6359 can be configured to use modules built and installed with earlier 
6360 versions of perl that were installed under $prefix.  Specify here
6361 the list of earlier versions that this version of perl should check.
6362 If Configure detected no earlier versions of perl installed under
6363 $prefix, then the list will be empty.  Answer 'none' to tell perl
6364 to not search earlier versions.
6365
6366 The default should almost always be sensible, so if you're not sure,
6367 just accept the default.
6368 EOM
6369
6370 rp='List of earlier versions to include in @INC?'
6371 . ./myread
6372 case "$ans" in
6373 [Nn]one|''|' ') inc_version_list=' ' ;;
6374 *) inc_version_list="$ans" ;;
6375 esac
6376 case "$inc_version_list" in
6377 ''|' ') 
6378         inc_version_list_init='0';;
6379 *)      inc_version_list_init=`echo $inc_version_list |
6380                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
6381         ;;
6382 esac
6383 $rm -f getverlist
6384
6385 : determine whether to install perl also as /usr/bin/perl
6386
6387 echo " "
6388 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
6389         $cat <<EOM
6390 Many scripts expect perl to be installed as /usr/bin/perl.
6391 I can install the perl you are about to compile also as /usr/bin/perl
6392 (in addition to $installbin/perl).
6393 EOM
6394         case "$installusrbinperl" in
6395         "$undef"|[nN]*) dflt='n';;
6396         *)              dflt='y';;
6397         esac
6398         rp="Do you want to install perl as /usr/bin/perl?"
6399         . ./myread
6400         case "$ans" in
6401         [yY]*)  val="$define";;
6402         *)      val="$undef" ;;
6403         esac
6404 else
6405         val="$undef"
6406 fi
6407 set installusrbinperl
6408 eval $setvar
6409
6410 : see if dld is available
6411 set dld.h i_dld
6412 eval $inhdr
6413
6414 : see if dlopen exists
6415 xxx_runnm="$runnm"
6416 runnm=false
6417 set dlopen d_dlopen
6418 eval $inlibc
6419 runnm="$xxx_runnm"
6420
6421 : determine which dynamic loading, if any, to compile in
6422 echo " "
6423 dldir="ext/DynaLoader"
6424 case "$usedl" in
6425 $define|y|true)
6426         dflt='y'
6427         usedl="$define"
6428         ;;
6429 $undef|n|false)
6430         dflt='n'
6431         usedl="$undef"
6432         ;;
6433 *) 
6434         dflt='n'
6435         case "$d_dlopen" in
6436             $define) dflt='y' ;;
6437         esac
6438         case "$i_dld" in
6439             $define) dflt='y' ;;
6440         esac
6441         : Does a dl_xxx.xs file exist for this operating system
6442         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
6443         ;;
6444 esac
6445 rp="Do you wish to use dynamic loading?"
6446 . ./myread
6447 usedl="$ans"
6448 case "$ans" in
6449 y*) usedl="$define"
6450         case "$dlsrc" in
6451         '')
6452                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
6453                         dflt="$dldir/dl_${osname}.xs"
6454                 elif $test "$d_dlopen" = "$define" ; then
6455                         dflt="$dldir/dl_dlopen.xs"
6456                 elif $test "$i_dld" = "$define" ; then
6457                         dflt="$dldir/dl_dld.xs"
6458                 else
6459                         dflt=''
6460                 fi
6461                 ;;
6462         *)      dflt="$dldir/$dlsrc"
6463                 ;;
6464         esac
6465     echo "The following dynamic loading files are available:"
6466         : Can not go over to $dldir because getfile has path hard-coded in.
6467         tdir=`pwd`; cd $rsrc; $ls -C $dldir/dl*.xs; cd $tdir
6468         rp="Source file to use for dynamic loading"
6469         fn="fne"
6470         gfpth="$src"
6471         . ./getfile
6472         usedl="$define"
6473         : emulate basename
6474         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
6475
6476         $cat << EOM
6477
6478 Some systems may require passing special flags to $cc -c to
6479 compile modules that will be used to create a shared library.
6480 To use no flags, say "none".
6481
6482 EOM
6483     case "$cccdlflags" in
6484     '') case "$gccversion" in
6485                 '') case "$osname" in
6486                         hpux)   dflt='+z' ;;
6487                         next)   dflt='none' ;;
6488                         irix*)  dflt='-KPIC' ;;
6489                         svr4*|esix*|solaris) dflt='-KPIC' ;;
6490                         sunos)  dflt='-pic' ;;
6491                         *)      dflt='none' ;;
6492                     esac
6493                         ;;
6494                 *)  case "$osname" in
6495                         svr4*|esix*|solaris) dflt='-fPIC' ;;
6496                         *)      dflt='-fpic' ;;
6497                     esac ;;
6498             esac ;;
6499         ' ') dflt='none' ;;
6500     *)  dflt="$cccdlflags" ;;
6501     esac
6502     rp="Any special flags to pass to $cc -c to compile shared library modules?"
6503     . ./myread
6504     case "$ans" in
6505     none) cccdlflags=' ' ;;
6506     *) cccdlflags="$ans" ;;
6507     esac
6508
6509     cat << EOM
6510
6511 Some systems use ld to create libraries that can be dynamically loaded,
6512 while other systems (such as those using ELF) use $cc.
6513
6514 EOM
6515         case "$ld" in
6516         '')     $cat >try.c <<'EOM'
6517 /* Test for whether ELF binaries are produced */
6518 #include <fcntl.h>
6519 #include <stdlib.h>
6520 int main() {
6521         char b[4];
6522         int i = open("a.out",O_RDONLY);
6523         if(i == -1) 
6524                 exit(1); /* fail */
6525         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
6526                 exit(0); /* succeed (yes, it's ELF) */
6527         else
6528                 exit(1); /* fail */
6529 }
6530 EOM
6531                 if $cc $ccflags try.c >/dev/null 2>&1 && ./a.out; then
6532                         cat <<EOM
6533 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
6534 EOM
6535                         dflt="$cc"
6536                 else
6537                         echo "I'll use ld to build dynamic libraries."
6538                         dflt='ld'
6539                 fi
6540                 rm -f try.c a.out
6541                 ;;
6542         *)      dflt="$ld"
6543                 ;;
6544         esac
6545
6546     rp="What command should be used to create dynamic libraries?"
6547     . ./myread
6548         ld="$ans"
6549
6550     cat << EOM
6551
6552 Some systems may require passing special flags to $ld to create a
6553 library that can be dynamically loaded.  If your ld flags include
6554 -L/other/path options to locate libraries outside your loader's normal
6555 search path, you may need to specify those -L options here as well.  To
6556 use no flags, say "none".
6557
6558 EOM
6559     case "$lddlflags" in
6560     '') case "$osname" in
6561                         beos) dflt='-nostart' ;;
6562                         hpux) dflt='-b';
6563                               case "$gccversion" in
6564                               '') dflt="$dflt +vnocompatwarnings" ;;
6565                               esac
6566                               ;;        
6567                         linux|irix*)    dflt='-shared' ;;
6568                         next)  dflt='none' ;;
6569                         solaris) dflt='-G' ;;
6570                         sunos) dflt='-assert nodefinitions' ;;
6571                         svr4*|esix*) dflt="-G $ldflags" ;;
6572                 *)     dflt='none' ;;
6573                         esac
6574                         ;;
6575     *) dflt="$lddlflags" ;;
6576     esac
6577
6578         : Try to guess additional flags to pick up local libraries.
6579         : Be careful not to append to a plain 'none'
6580         case "$dflt" in
6581         none) dflt='' ;;
6582         esac
6583         for thisflag in $ldflags; do
6584                 case "$thisflag" in
6585                 -L*|-R*)
6586                         case " $dflt " in
6587                         *" $thisflag "*) ;;
6588                         *) dflt="$dflt $thisflag" ;;
6589                         esac
6590                         ;;
6591                 esac
6592         done
6593
6594         case "$dflt" in
6595         ''|' ') dflt='none' ;;
6596         esac
6597
6598     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
6599     . ./myread
6600     case "$ans" in
6601     none) lddlflags=' ' ;;
6602     *) lddlflags="$ans" ;;
6603     esac
6604
6605         cat <<EOM
6606
6607 Some systems may require passing special flags to $cc to indicate that
6608 the resulting executable will use dynamic linking.  To use no flags,
6609 say "none".
6610
6611 EOM
6612     case "$ccdlflags" in
6613     '') case "$osname" in
6614                 hpux)   dflt='-Wl,-E' ;;
6615                 linux)  dflt='-rdynamic' ;;
6616                 next)   dflt='none' ;;
6617                 sunos)  dflt='none' ;;
6618                 *)      dflt='none' ;;
6619             esac ;;
6620     ' ')  dflt='none' ;;
6621     *)  dflt="$ccdlflags" ;;
6622     esac
6623     rp="Any special flags to pass to $cc to use dynamic linking?"
6624     . ./myread
6625     case "$ans" in
6626     none) ccdlflags=' ' ;;
6627     *) ccdlflags="$ans" ;;
6628     esac
6629     ;;
6630 *)  usedl="$undef"
6631         ld='ld'
6632     dlsrc='dl_none.xs'
6633     lddlflags=''
6634     ccdlflags=''
6635     ;;
6636 esac
6637
6638 also=''
6639 case "$usedl" in
6640 $undef)
6641         # No dynamic loading being used, so don't bother even to prompt.
6642         useshrplib='false'
6643         ;;
6644 *)      case "$useshrplib" in
6645         '')     case "$osname" in
6646                 svr4*|dgux|dynixptx|esix|powerux|beos|cygwin*)
6647                         dflt=y
6648                         also='Building a shared libperl is required for dynamic loading to work on your system.'
6649                         ;;
6650                 next*)
6651                         case "$osvers" in
6652                         4*)     dflt=y
6653                                 also='Building a shared libperl is needed for MAB support.'
6654                                 ;;
6655                         *)      dflt=n
6656                                 ;;
6657                         esac
6658                         ;;
6659                 *)      dflt=n
6660                         ;;
6661                 esac
6662                 ;;
6663         $define|true|[Yy]*)
6664                 dflt=y
6665                 ;;
6666         *)      dflt=n
6667                 ;;
6668         esac
6669         $cat << EOM
6670
6671 The perl executable is normally obtained by linking perlmain.c with
6672 libperl${_a}, any static extensions (usually just DynaLoader), and
6673 any other libraries needed on this system (such as -lm, etc.).  Since
6674 your system supports dynamic loading, it is probably possible to build
6675 a shared libperl.$so.  If you will have more than one executable linked
6676 to libperl.$so, this will significantly reduce the size of each
6677 executable, but it may have a noticeable affect on performance.  The
6678 default is probably sensible for your system.
6679 $also
6680
6681 EOM
6682         rp="Build a shared libperl.$so (y/n)"
6683         . ./myread
6684         case "$ans" in
6685         true|$define|[Yy]*)
6686                 useshrplib='true'  ;;
6687         *)      useshrplib='false' ;;
6688         esac
6689         ;;
6690 esac
6691
6692 case "$useshrplib" in
6693 true)
6694         case "$libperl" in
6695         '')
6696                 # Figure out a good name for libperl.so.  Since it gets stored in
6697                 # a version-specific architecture-dependent library, the version
6698                 # number isn't really that important, except for making cc/ld happy.
6699                 #
6700                 # A name such as libperl.so.3.1
6701                 majmin="libperl.$so.$patchlevel.$subversion"
6702                 # A name such as libperl.so.301
6703                 majonly=`echo $patchlevel $subversion |
6704                         $awk '{printf "%d%02d", $1, $2}'`
6705                 majonly=libperl.$so.$majonly
6706                 # I'd prefer to keep the os-specific stuff here to a minimum, and
6707                 # rely on figuring it out from the naming of libc.
6708                 case "${osname}${osvers}" in
6709                 next4*)
6710                         dflt=libperl.5.$so
6711                         # XXX How handle the --version stuff for MAB?
6712                         ;;
6713                 linux*)  # ld won't link with a bare -lperl otherwise.
6714                         dflt=libperl.$so
6715                         ;;
6716                 cygwin*) # include version
6717                         dflt=`echo libperl$version | sed -e 's/\./_/g'`$lib_ext
6718                         ;;
6719                 *)      # Try to guess based on whether libc has major.minor.
6720                         case "$libc" in
6721                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
6722                         *libc.$so.[0-9]*) dflt=$majonly ;;
6723                         *)      dflt=libperl.$so ;;
6724                         esac
6725                         ;;
6726                 esac
6727                 ;;
6728         *)      dflt=$libperl
6729                 ;;
6730         esac
6731         cat << EOM
6732
6733 I need to select a good name for the shared libperl.  If your system uses
6734 library names with major and minor numbers, then you might want something
6735 like $majmin.  Alternatively, if your system uses a single version
6736 number for shared libraries, then you might want to use $majonly.
6737 Or, your system might be quite happy with a simple libperl.$so.
6738
6739 Since the shared libperl will get installed into a version-specific
6740 architecture-dependent directory, the version number of the shared perl
6741 library probably isn't important, so the default should be o.k.
6742
6743 EOM
6744         rp='What name do you want to give to the shared libperl?'
6745         . ./myread
6746         libperl=$ans
6747         echo "Ok, I'll use $libperl"
6748         ;;
6749 *)
6750         libperl="libperl${_a}"
6751         ;;
6752 esac
6753
6754 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
6755 case "$shrpdir" in
6756 '') ;;
6757 *)      $cat >&4 <<EOM
6758 WARNING:  Use of the shrpdir variable for the installation location of
6759 the shared $libperl is not supported.  It was never documented and
6760 will not work in this version.  Let me (perlbug@perl.org)
6761 know of any problems this may cause.
6762
6763 EOM
6764         case "$shrpdir" in
6765         "$archlibexp/CORE")
6766                 $cat >&4 <<EOM
6767 But your current setting of $shrpdir is
6768 the default anyway, so it's harmless.
6769 EOM
6770                 ;;
6771         *)
6772                 $cat >&4 <<EOM
6773 Further, your current attempted setting of $shrpdir
6774 conflicts with the value of $archlibexp/CORE
6775 that installperl will use.
6776 EOM
6777                 ;;
6778         esac
6779         ;;
6780 esac
6781
6782 # How will the perl executable find the installed shared $libperl?
6783 # Add $xxx to ccdlflags.
6784 # If we can't figure out a command-line option, use $shrpenv to
6785 # set env LD_RUN_PATH.  The main perl makefile uses this.
6786 shrpdir=$archlibexp/CORE
6787 xxx=''
6788 tmp_shrpenv=''
6789 if "$useshrplib"; then
6790     case "$osname" in 
6791         aix)
6792                 # We'll set it in Makefile.SH...
6793                 ;;
6794         solaris|netbsd)
6795                 xxx="-R $shrpdir"
6796                 ;;
6797         freebsd)
6798                 xxx="-Wl,-R$shrpdir"
6799                 ;;
6800         linux|irix*|dec_osf)
6801                 xxx="-Wl,-rpath,$shrpdir"
6802                 ;;
6803         next)
6804                 # next doesn't like the default...
6805                 ;;
6806         beos)
6807                 # beos doesn't like the default, either.
6808                 ;;
6809         hpux*)
6810                 # hpux doesn't like the default, either.
6811                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
6812                 ;;
6813         *)
6814                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
6815                 ;;
6816         esac
6817         case "$xxx" in
6818         '') ;;
6819         *)      
6820                 # Only add $xxx if it isn't already in ccdlflags.
6821                 case " $ccdlflags " in
6822                 *" $xxx "*)     ;;
6823                 *)      ccdlflags="$ccdlflags $xxx"
6824                         cat <<EOM >&4
6825
6826 Adding $xxx to the flags
6827 passed to $ld so that the perl executable will find the 
6828 installed shared $libperl.
6829
6830 EOM
6831                         ;;
6832                 esac
6833                 ;;
6834         esac
6835 fi
6836 # Fix ccdlflags in AIX for building external extensions.
6837 # (For building Perl itself bare -bE:perl.exp is needed,
6838 #  Makefile.SH takes care of this.)
6839 case "$osname" in
6840 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
6841 esac
6842 # Respect a hint or command-line value.
6843 case "$shrpenv" in
6844 '') shrpenv="$tmp_shrpenv" ;;
6845 esac
6846 case "$ldlibpthname" in
6847 '')     ldlibpthname=LD_LIBRARY_PATH ;;
6848 none)   ldlibpthname='' ;;
6849 esac
6850
6851 : determine where manual pages go
6852 set man1dir man1dir none
6853 eval $prefixit
6854 $cat <<EOM
6855
6856 $spackage has manual pages available in source form.
6857 EOM
6858 case "$nroff" in
6859 nroff)
6860         echo "However, you don't have nroff, so they're probably useless to you."
6861         case "$man1dir" in
6862         '') man1dir="none";;
6863         esac;;
6864 esac
6865 echo "If you don't want the manual sources installed, answer 'none'."
6866 case "$man1dir" in
6867 ' ') dflt=none
6868         ;;
6869 '')
6870         lookpath="$prefixexp/man/man1 $prefixexp/man/l_man/man1"
6871         lookpath="$lookpath $prefixexp/man/p_man/man1"
6872         lookpath="$lookpath $prefixexp/man/u_man/man1"
6873         lookpath="$lookpath $prefixexp/man/man.1"
6874         case "$sysman" in
6875         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
6876         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
6877         esac
6878         set dflt
6879         eval $prefixup
6880         ;;
6881 *)  dflt="$man1dir"
6882         ;;
6883 esac
6884 echo " "
6885 fn=dn+~
6886 rp="Where do the main $spackage manual pages (source) go?"
6887 . ./getfile
6888 if $test "X$man1direxp" != "X$ansexp"; then
6889         installman1dir=''
6890 fi
6891 man1dir="$ans"
6892 man1direxp="$ansexp"
6893 case "$man1dir" in
6894 '')     man1dir=' '
6895         installman1dir='';;
6896 esac
6897
6898 : Change installation prefix, if necessary.
6899 if $test X"$prefix" != X"$installprefix"; then
6900         installman1dir=`echo $man1direxp | $sed "s#^$prefix#$installprefix#"`
6901 else
6902         installman1dir="$man1direxp"
6903 fi
6904
6905 : What suffix to use on installed man pages
6906
6907 case "$man1dir" in
6908 ' ')
6909         man1ext='0'
6910         ;;
6911 *)
6912         rp="What suffix should be used for the main $spackage man pages?"
6913         case "$man1ext" in
6914         '')     case "$man1dir" in
6915                 *1)  dflt=1 ;;
6916                 *1p) dflt=1p ;;
6917                 *1pm) dflt=1pm ;;
6918                 *l) dflt=l;;
6919                 *n) dflt=n;;
6920                 *o) dflt=o;;
6921                 *p) dflt=p;;
6922                 *C) dflt=C;;
6923                 *L) dflt=L;;
6924                 *L1) dflt=L1;;
6925                 *) dflt=1;;
6926                 esac
6927                 ;;
6928         *)      dflt="$man1ext";;
6929         esac
6930         . ./myread
6931         man1ext="$ans"
6932         ;;
6933 esac
6934
6935 : see if we can have long filenames
6936 echo " "
6937 first=123456789abcdef
6938 $rm -f $first
6939 if (echo hi >$first) 2>/dev/null; then
6940         if $test -f 123456789abcde; then
6941                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
6942                 val="$undef"
6943         else
6944                 echo 'You can have filenames longer than 14 characters.'>&4
6945                 val="$define"
6946         fi
6947 else
6948         $cat <<'EOM'
6949 You can't have filenames longer than 14 chars.
6950 You can't even think about them!
6951 EOM
6952         val="$undef"
6953 fi 
6954 set d_flexfnam
6955 eval $setvar
6956 $rm -rf 123456789abcde*
6957
6958 : determine where library module manual pages go
6959 set man3dir man3dir none
6960 eval $prefixit
6961 $cat <<EOM
6962
6963 $spackage has manual pages for many of the library modules.
6964 EOM
6965
6966 case "$nroff" in
6967 nroff)
6968         $cat <<'EOM'
6969 However, you don't have nroff, so they're probably useless to you.
6970 EOM
6971         case "$man3dir" in
6972         '') man3dir="none";;
6973         esac;;
6974 esac
6975
6976 case "$d_flexfnam" in
6977 undef)
6978         $cat <<'EOM'
6979 However, your system can't handle the long file names like File::Basename.3. 
6980 EOM
6981         case "$man3dir" in
6982         '') man3dir="none";;
6983         esac;;
6984 esac
6985
6986 echo "If you don't want the manual sources installed, answer 'none'."
6987 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6988 case "$man3dir" in
6989 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
6990         if $test -d "$privlib/man/man3"; then
6991                 cat <<EOM >&4
6992
6993 WARNING:  Previous versions of perl installed man3 pages into
6994 $privlib/man/man3.  This version will suggest a 
6995 new default of $dflt.  
6996 EOM
6997                 tdflt=$dflt
6998                 dflt='n'
6999                 rp='Do you wish to preserve the old behavior?(y/n)'
7000                 . ./myread
7001                 case "$ans" in
7002                 y*) dflt="$privlib/man/man3" ;;
7003                 *)  dflt=$tdflt ;;
7004                 esac
7005     fi
7006         ;;
7007 *)      dflt="$man3dir" ;;
7008 esac
7009 case "$dflt" in
7010 ' ') dflt=none ;;
7011 esac
7012 echo " "
7013 fn=dn+~
7014 rp="Where do the $package library man pages (source) go?"
7015 . ./getfile
7016 man3dir="$ans"
7017 man3direxp="$ansexp"
7018 case "$man3dir" in
7019 '')     man3dir=' '
7020         installman3dir='';;
7021 esac
7022
7023 : Change installation prefix, if necessary.
7024 if $test X"$prefix" != X"$installprefix"; then
7025         installman3dir=`echo $man3direxp | $sed "s#^$prefix#$installprefix#"`
7026 else
7027         installman3dir="$man3direxp"
7028 fi
7029
7030 : What suffix to use on installed man pages
7031 case "$man3dir" in
7032 ' ')
7033         man3ext='0'
7034         ;;
7035 *)
7036         rp="What suffix should be used for the $package library man pages?"
7037         case "$man3ext" in
7038         '')     case "$man3dir" in
7039                 *3)  dflt=3 ;;
7040                 *3p) dflt=3p ;;
7041                 *3pm) dflt=3pm ;;
7042                 *l) dflt=l;;
7043                 *n) dflt=n;;
7044                 *o) dflt=o;;
7045                 *p) dflt=p;;
7046                 *C) dflt=C;;
7047                 *L) dflt=L;;
7048                 *L3) dflt=L3;;
7049                 *) dflt=3;;
7050                 esac
7051                 ;;
7052         *)      dflt="$man3ext";;
7053         esac
7054         . ./myread
7055         man3ext="$ans"
7056         ;;
7057 esac
7058
7059 : see if we have to deal with yellow pages, now NIS.
7060 if $test -d /usr/etc/yp || $test -d /etc/yp; then
7061         if $test -f /usr/etc/nibindd; then
7062                 echo " "
7063                 echo "I'm fairly confident you're on a NeXT."
7064                 echo " "
7065                 rp='Do you get the hosts file via NetInfo?'
7066                 dflt=y
7067                 case "$hostcat" in
7068                 nidump*) ;;
7069                 '') ;;
7070                 *) dflt=n;;
7071                 esac
7072                 . ./myread
7073                 case "$ans" in
7074                 y*) hostcat='nidump hosts .';;
7075                 *)      case "$hostcat" in
7076                         nidump*) hostcat='';;
7077                         esac
7078                         ;;
7079                 esac
7080         fi
7081         case "$hostcat" in
7082         nidump*) ;;
7083         *)
7084                 case "$hostcat" in
7085                 *ypcat*) dflt=y;;
7086                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
7087                                 dflt=y
7088                         else
7089                                 dflt=n
7090                         fi;;
7091                 *) dflt=n;;
7092                 esac
7093                 echo " "
7094                 rp='Are you getting the hosts file via yellow pages?'
7095                 . ./myread
7096                 case "$ans" in
7097                 y*) hostcat='ypcat hosts';;
7098                 *) hostcat='cat /etc/hosts';;
7099                 esac
7100                 ;;
7101         esac
7102 fi
7103 case "$hostcat" in
7104 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
7105 esac
7106 case "$groupcat" in
7107 '') test -f /etc/group && groupcat='cat /etc/group';;
7108 esac
7109 case "$passcat" in
7110 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
7111 esac
7112
7113 : now get the host name
7114 echo " "
7115 echo "Figuring out host name..." >&4
7116 case "$myhostname" in
7117 '') cont=true
7118         echo 'Maybe "hostname" will work...'
7119         if tans=`sh -c hostname 2>&1` ; then
7120                 myhostname=$tans
7121                 phostname=hostname
7122                 cont=''
7123         fi
7124         ;;
7125 *) cont='';;
7126 esac
7127 if $test "$cont"; then
7128         if ./xenix; then
7129                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
7130                 if tans=`cat /etc/systemid 2>&1` ; then
7131                         myhostname=$tans
7132                         phostname='cat /etc/systemid'
7133                         echo "Whadyaknow.  Xenix always was a bit strange..."
7134                         cont=''
7135                 fi
7136         elif $test -r /etc/systemid; then
7137                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
7138         fi
7139 fi
7140 if $test "$cont"; then
7141         echo 'No, maybe "uuname -l" will work...'
7142         if tans=`sh -c 'uuname -l' 2>&1` ; then
7143                 myhostname=$tans
7144                 phostname='uuname -l'
7145         else
7146                 echo 'Strange.  Maybe "uname -n" will work...'
7147                 if tans=`sh -c 'uname -n' 2>&1` ; then
7148                         myhostname=$tans
7149                         phostname='uname -n'
7150                 else
7151                         echo 'Oh well, maybe I can mine it out of whoami.h...'
7152                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
7153                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
7154                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
7155                         else
7156                                 case "$myhostname" in
7157                                 '') echo "Does this machine have an identity crisis or something?"
7158                                         phostname='';;
7159                                 *)
7160                                         echo "Well, you said $myhostname before..."
7161                                         phostname='echo $myhostname';;
7162                                 esac
7163                         fi
7164                 fi
7165         fi
7166 fi
7167 : you do not want to know about this
7168 set $myhostname
7169 myhostname=$1
7170
7171 : verify guess
7172 if $test "$myhostname" ; then
7173         dflt=y
7174         rp='Your host name appears to be "'$myhostname'".'" Right?"
7175         . ./myread
7176         case "$ans" in
7177         y*) ;;
7178         *) myhostname='';;
7179         esac
7180 fi
7181
7182 : bad guess or no guess
7183 while $test "X$myhostname" = X ; do
7184         dflt=''
7185         rp="Please type the (one word) name of your host:"
7186         . ./myread
7187         myhostname="$ans"
7188 done
7189
7190 : translate upper to lower if necessary
7191 case "$myhostname" in
7192 *[A-Z]*)
7193         echo "(Normalizing case in your host name)"
7194         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
7195         ;;
7196 esac
7197
7198 case "$myhostname" in
7199 *.*)
7200         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
7201         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
7202         echo "(Trimming domain name from host name--host name is now $myhostname)"
7203         ;;
7204 *) case "$mydomain" in
7205         '')
7206                 {
7207                         test "X$hostcat" = "Xypcat hosts" &&
7208                         ypmatch "$myhostname" hosts 2>/dev/null |\
7209                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
7210                         $test -s hosts
7211                 } || {
7212                         test "X$hostcat" != "X" &&
7213                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
7214                                         /[       ]$myhostname[  . ]/p" > hosts
7215                 }
7216                 tmp_re="[       . ]"
7217                 $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
7218                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
7219                 dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
7220                         hosts | $sort | $uniq | \
7221                         $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
7222                 case `$echo X$dflt` in
7223                 X*\ *)  echo "(Several hosts in /etc/hosts matched hostname)"
7224                         dflt=.
7225                         ;;
7226                 X.) echo "(You do not have fully-qualified names in /etc/hosts)"
7227                         ;;
7228                 esac
7229                 case "$dflt" in
7230                 .)
7231                         tans=`./loc resolv.conf X /etc /usr/etc`
7232                         if $test -f "$tans"; then
7233                                 echo "(Attempting domain name extraction from $tans)"
7234                                 dflt=.`$sed -n -e 's/   / /g' \
7235                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
7236                                   | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
7237                                 case "$dflt" in
7238                                 .) dflt=.`$sed -n -e 's/        / /g' \
7239                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
7240                                      | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
7241                                         ;;
7242                                 esac
7243                         fi
7244                         ;;
7245                 esac
7246                 case "$dflt" in
7247                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
7248                         dflt=.`sh -c domainname 2>/dev/null`
7249                         case "$dflt" in
7250                         '') dflt='.';;
7251                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
7252                         esac
7253                         ;;
7254                 esac
7255                 case "$dflt" in
7256                 .) echo "(Lost all hope -- silly guess then)"
7257                         dflt='.uucp'
7258                         ;;
7259                 esac
7260                 $rm -f hosts
7261                 ;;
7262         *) dflt="$mydomain";;
7263         esac;;
7264 esac
7265 echo " "
7266 rp="What is your domain name?"
7267 . ./myread
7268 tans="$ans"
7269 case "$ans" in
7270 '') ;;
7271 .*) ;;
7272 *) tans=".$tans";;
7273 esac
7274 mydomain="$tans"
7275
7276 : translate upper to lower if necessary
7277 case "$mydomain" in
7278 *[A-Z]*)
7279         echo "(Normalizing case in your domain name)"
7280         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
7281         ;;
7282 esac
7283
7284 : a little sanity check here
7285 case "$phostname" in
7286 '') ;;
7287 *)
7288         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
7289         $myhostname$mydomain|$myhostname) ;;
7290         *)
7291                 case "$phostname" in
7292                 sed*)
7293                         echo "(That doesn't agree with your whoami.h file, by the way.)"
7294                         ;;
7295                 *)
7296                         echo "(That doesn't agree with your $phostname command, by the way.)"
7297                         ;;
7298                 esac
7299         ;;
7300         esac
7301         ;;
7302 esac
7303
7304 $cat <<EOM
7305
7306 I need to get your e-mail address in Internet format if possible, i.e.
7307 something like user@host.domain. Please answer accurately since I have
7308 no easy means to double check it. The default value provided below
7309 is most probably close to reality but may not be valid from outside
7310 your organization...
7311
7312 EOM
7313 cont=x
7314 while test "$cont"; do
7315         case "$cf_email" in
7316         '') dflt="$cf_by@$myhostname$mydomain";;
7317         *) dflt="$cf_email";;
7318         esac
7319         rp='What is your e-mail address?'
7320         . ./myread
7321         cf_email="$ans"
7322         case "$cf_email" in
7323         *@*.*) cont='' ;;
7324         *)
7325                 rp='Address does not look like an Internet one.  Use it anyway?'
7326                 case "$fastread" in
7327                 yes) dflt=y ;;
7328                 *) dflt=n ;;
7329                 esac
7330                 . ./myread
7331                 case "$ans" in
7332                 y*) cont='' ;;
7333                 *) echo " " ;;
7334                 esac
7335                 ;;
7336         esac
7337 done
7338
7339 $cat <<EOM
7340
7341 If you or somebody else will be maintaining perl at your site, please
7342 fill in the correct e-mail address here so that they may be contacted
7343 if necessary. Currently, the "perlbug" program included with perl
7344 will send mail to this address in addition to perlbug@perl.org. You may
7345 enter "none" for no administrator.
7346
7347 EOM
7348 case "$perladmin" in
7349 '') dflt="$cf_email";;
7350 *) dflt="$perladmin";;
7351 esac
7352 rp='Perl administrator e-mail address'
7353 . ./myread
7354 perladmin="$ans"
7355
7356 : figure out how to guarantee perl startup
7357 case "$startperl" in
7358 '')
7359         case "$sharpbang" in
7360         *!)
7361                 $cat <<EOH
7362
7363 I can use the #! construct to start perl on your system. This will
7364 make startup of perl scripts faster, but may cause problems if you
7365 want to share those scripts and perl is not in a standard place
7366 ($binexp/perl) on all your platforms. The alternative is to force
7367 a shell by starting the script with a single ':' character.
7368
7369 EOH
7370                 dflt="$binexp/perl"
7371                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
7372                 . ./myread
7373                 case "$ans" in
7374                 none)   startperl=": # use perl";;
7375                 *)      startperl="#!$ans"
7376                         if $test 30 -lt `echo "$ans" | wc -c`; then
7377                                 $cat >&4 <<EOM
7378
7379 WARNING:  Some systems limit the #! command to 32 characters.
7380 If you experience difficulty running Perl scripts with #!, try
7381 installing Perl in a directory with a shorter pathname.
7382
7383 EOM
7384                         fi ;;
7385                 esac
7386                 ;;
7387         *) startperl=": # use perl"
7388                 ;;
7389         esac
7390         ;;
7391 esac
7392 echo "I'll use $startperl to start perl scripts."
7393
7394 : figure best path for perl in scripts
7395 case "$perlpath" in
7396 '')
7397         perlpath="$binexp/perl"
7398         case "$startperl" in
7399         *!*) ;;
7400         *)
7401                 $cat <<EOH
7402
7403 I will use the "eval 'exec'" idiom to start Perl on your system.
7404 I can use the full path of your Perl binary for this purpose, but
7405 doing so may cause problems if you want to share those scripts and
7406 Perl is not always in a standard place ($binexp/perl).
7407
7408 EOH
7409                 dflt="$binexp/perl"
7410                 rp="What path shall I use in \"eval 'exec'\"?"
7411                 . ./myread
7412                 perlpath="$ans"
7413                 ;;
7414         esac
7415         ;;
7416 esac
7417 case "$startperl" in
7418 *!*)    ;;
7419 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
7420 esac
7421
7422 : determine where public executable scripts go
7423 set scriptdir scriptdir
7424 eval $prefixit
7425 case "$scriptdir" in
7426 '')
7427         dflt="$bin"
7428         : guess some guesses
7429         $test -d /usr/share/scripts && dflt=/usr/share/scripts
7430         $test -d /usr/share/bin     && dflt=/usr/share/bin
7431         $test -d /usr/local/script  && dflt=/usr/local/script
7432         $test -d /usr/local/scripts && dflt=/usr/local/scripts
7433         $test -d $prefixexp/script  && dflt=$prefixexp/script
7434         set dflt
7435         eval $prefixup
7436         ;;
7437 *)  dflt="$scriptdir"
7438         ;;
7439 esac
7440 $cat <<EOM
7441  
7442 Some installations have a separate directory just for executable scripts so
7443 that they can mount it across multiple architectures but keep the scripts in
7444 one spot.  You might, for example, have a subdirectory of /usr/share for this.
7445 Or you might just lump your scripts in with all your other executables.
7446  
7447 EOM
7448 fn=d~
7449 rp='Where do you keep publicly executable scripts?'
7450 . ./getfile
7451 if $test "X$ansexp" != "X$scriptdirexp"; then
7452         installscript=''
7453 fi
7454 scriptdir="$ans"
7455 scriptdirexp="$ansexp"
7456 : Change installation prefix, if necessary.
7457 if $test X"$prefix" != X"$installprefix"; then
7458         installscript=`echo $scriptdirexp | sed "s#^$prefix#$installprefix#"`
7459 else
7460         installscript="$scriptdirexp"
7461 fi
7462
7463 : determine where add-on public executables go
7464 case "$sitebin" in
7465 '')     dflt=$siteprefix/bin ;;
7466 *)      dflt=$sitebin ;;
7467 esac
7468 fn=d~
7469 rp='Pathname where the add-on public executables should be installed?'
7470 . ./getfile
7471 sitebin="$ans"
7472 sitebinexp="$ansexp"
7473 : Change installation prefix, if necessary.
7474 if $test X"$prefix" != X"$installprefix"; then
7475         installsitebin=`echo $sitebinexp | sed "s#^$prefix#$installprefix#"`
7476 else
7477         installsitebin="$sitebinexp"
7478 fi
7479
7480 case "$useperlio" in
7481 $define|true|[yY]*)     dflt='y';;
7482 *) dflt='n';;
7483 esac
7484 cat <<EOM
7485
7486 Previous version of $package used the standard IO mechanisms as defined
7487 in <stdio.h>.  Versions 5.003_02 and later of perl allow alternate IO
7488 mechanisms via a "PerlIO" abstraction, but the stdio mechanism is still
7489 the default.  This abstraction layer can use AT&T's sfio (if you already
7490 have sfio installed) or regular stdio.  Using PerlIO with sfio may cause
7491 problems with some extension modules.  Using PerlIO with stdio is safe,
7492 but it is slower than plain stdio and therefore is not the default.
7493
7494 If this doesn't make any sense to you, just accept the default '$dflt'.
7495 EOM
7496 rp='Use the experimental PerlIO abstraction layer?'
7497 . ./myread
7498 case "$ans" in
7499 y|Y) 
7500         val="$define"
7501         ;;     
7502 *)      
7503         echo "Ok, doing things the stdio way"
7504         val="$undef"
7505         ;;
7506 esac
7507 set useperlio
7508 eval $setvar 
7509
7510 case "$vendorprefix" in
7511 '')     d_vendorbin="$undef"
7512         vendorbin=''
7513         vendorbinexp=''
7514         ;;
7515 *)      d_vendorbin="$define"
7516         : determine where vendor-supplied executables go.
7517         case "$vendorbin" in
7518         '') dflt=$vendorprefix/bin ;;
7519         *)      dflt="$vendorbin" ;;
7520         esac
7521         fn=d~+
7522         rp='Pathname for the vendor-supplied executables directory?'
7523         . ./getfile
7524         vendorbin="$ans"
7525         vendorbinexp="$ansexp"
7526         ;;
7527 esac
7528 : Change installation prefix, if necessary.
7529 if $test X"$prefix" != X"$installprefix"; then
7530         installvendorbin=`echo $vendorbinexp | $sed "s#^$prefix#$installprefix#"`
7531 else
7532         installvendorbin="$vendorbinexp"
7533 fi
7534
7535 : see if qgcvt exists
7536 set qgcvt d_qgcvt
7537 eval $inlibc
7538
7539 : check for length of double
7540 echo " "
7541 case "$doublesize" in
7542 '')
7543         echo "Checking to see how big your double precision numbers are..." >&4
7544         $cat >try.c <<'EOCP'
7545 #include <stdio.h>
7546 int main()
7547 {
7548     printf("%d\n", (int)sizeof(double));
7549     exit(0);
7550 }
7551 EOCP
7552         set try
7553         if eval $compile_ok; then
7554                 doublesize=`./try`
7555                 echo "Your double is $doublesize bytes long."
7556         else
7557                 dflt='8'
7558                 echo "(I can't seem to compile the test program.  Guessing...)"
7559                 rp="What is the size of a double precision number (in bytes)?"
7560                 . ./myread
7561                 doublesize="$ans"
7562         fi
7563         ;;
7564 esac
7565 $rm -f try.c try
7566
7567 : check for long doubles
7568 echo " "
7569 echo "Checking to see if you have long double..." >&4
7570 echo 'int main() { long double x = 7.0; }' > try.c
7571 set try
7572 if eval $compile; then
7573         val="$define"
7574         echo "You have long double."
7575 else
7576         val="$undef"
7577         echo "You do not have long double."
7578 fi
7579 $rm try.*
7580 set d_longdbl
7581 eval $setvar
7582
7583 : check for length of long double
7584 case "${d_longdbl}${longdblsize}" in
7585 $define)
7586         echo " "
7587         echo "Checking to see how big your long doubles are..." >&4
7588         $cat >try.c <<'EOCP'
7589 #include <stdio.h>
7590 int main()
7591 {
7592         printf("%d\n", sizeof(long double));
7593 }
7594 EOCP
7595         set try
7596         set try
7597         if eval $compile; then
7598                 longdblsize=`./try$exe_ext`
7599                 echo "Your long doubles are $longdblsize bytes long."
7600         else
7601                 dflt='8'
7602                 echo " "
7603                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
7604                 rp="What is the size of a long double (in bytes)?"
7605                 . ./myread
7606                 longdblsize="$ans"
7607         fi
7608         if $test "X$doublesize" = "X$longdblsize"; then
7609                 echo "(That isn't any different from an ordinary double.)"
7610         fi      
7611         ;;
7612 esac
7613 $rm -f try.* try
7614
7615 echo " "
7616
7617 if $test X"$d_longdbl" = X"$define"; then
7618
7619 echo "Checking how to print long doubles..." >&4
7620
7621 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
7622         $cat >try.c <<'EOCP'
7623 #include <sys/types.h>
7624 #include <stdio.h>
7625 int main() {
7626   double d = 123.456;
7627   printf("%.3f\n", d);
7628 }
7629 EOCP
7630         set try
7631         if eval $compile; then
7632                 yyy=`./try$exe_ext`
7633                 case "$yyy" in
7634                 123.456)
7635                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
7636                         sPRIFldbl='"F"'; sPRIGldbl='"G"'; sPRIEldbl='"E"';
7637                         echo "We will use %f."
7638                         ;;
7639                 esac
7640         fi
7641 fi
7642
7643 if $test X"$sPRIfldbl" = X; then
7644         $cat >try.c <<'EOCP'
7645 #include <sys/types.h>
7646 #include <stdio.h>
7647 int main() {
7648   long double d = 123.456;
7649   printf("%.3llf\n", d);
7650 }
7651 EOCP
7652         set try
7653         if eval $compile; then
7654                 yyy=`./try$exe_ext`
7655                 case "$yyy" in
7656                 123.456)
7657                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
7658                         sPRIFldbl='"llF"'; sPRIGldbl='"llG"'; sPRIEldbl='"llE"';
7659                         echo "We will use %llf."
7660                         ;;
7661                 esac
7662         fi
7663 fi
7664
7665 if $test X"$sPRIfldbl" = X; then
7666         $cat >try.c <<'EOCP'
7667 #include <sys/types.h>
7668 #include <stdio.h>
7669 int main() {
7670   long double d = 123.456;
7671   printf("%.3Lf\n", d);
7672 }
7673 EOCP
7674         set try
7675         if eval $compile; then
7676                 yyy=`./try$exe_ext`
7677                 case "$yyy" in
7678                 123.456)
7679                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
7680                         sPRIFldbl='"LF"'; sPRIGldbl='"LG"'; sPRIEldbl='"LE"';
7681                         echo "We will use %Lf."
7682                         ;;
7683                 esac
7684         fi
7685 fi
7686
7687 if $test X"$sPRIfldbl" = X; then
7688         $cat >try.c <<'EOCP'
7689 #include <sys/types.h>
7690 #include <stdio.h>
7691 int main() {
7692   long double d = 123.456;
7693   printf("%.3lf\n", d);
7694 }
7695 EOCP
7696         set try
7697         if eval $compile; then
7698                 yyy=`./try$exe_ext`
7699                 case "$yyy" in
7700                 123.456)
7701                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
7702                         sPRIFldbl='"lF"'; sPRIGldbl='"lG"'; sPRIEldbl='"lE"';
7703                         echo "We will use %lf."
7704                         ;;
7705                 esac
7706         fi
7707 fi
7708
7709 if $test X"$sPRIfldbl" = X; then
7710         echo "Cannot figure out how to print long doubles." >&4
7711 fi
7712
7713 $rm -f try try.*
7714
7715 fi # d_longdbl
7716
7717 case "$sPRIfldbl" in
7718 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef"; 
7719         d_PRIFldbl="$undef"; d_PRIGldbl="$undef"; d_PRIEldbl="$undef"; 
7720         ;;
7721 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define"; 
7722         d_PRIFldbl="$define"; d_PRIGldbl="$define"; d_PRIEldbl="$define"; 
7723         ;;
7724 esac
7725
7726 : Check how to convert floats to strings.
7727 echo " "
7728 echo "Checking for an efficient way to convert floats to strings."
7729 echo " " > try.c
7730 case "$uselongdouble" in
7731 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
7732 esac
7733 case "$d_longdbl" in
7734 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
7735 esac
7736 case "$d_PRIgldbl" in
7737 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
7738 esac
7739 $cat >>try.c <<EOP
7740 #ifdef TRY_gconvert
7741 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
7742 char *myname = "gconvert";
7743 #endif
7744 #ifdef TRY_gcvt
7745 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
7746 char *myname = "gcvt";
7747 #endif
7748 #ifdef TRY_qgcvt
7749 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
7750 char *myname = "qgcvt";
7751 #define DOUBLETYPE long double
7752 #endif
7753 #ifdef TRY_sprintf
7754 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE) && defined(HAS_PRIgldbl)
7755 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
7756 #else
7757 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
7758 #endif
7759 char *myname = "sprintf";
7760 #endif
7761
7762 #ifndef DOUBLETYPE
7763 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
7764 #define DOUBLETYPE long double
7765 #else
7766 #define DOUBLETYPE double
7767 #endif
7768 #endif
7769
7770 #include <stdio.h>
7771
7772 #define I_STDLIB $i_stdlib
7773 #ifdef I_STDLIB
7774 #include <stdlib.h>
7775 #endif
7776
7777 int
7778 checkit(expect, got)
7779 char *expect;
7780 char *got;
7781 {
7782     if (strcmp(expect, got)) {
7783                 printf("%s oddity:  Expected %s, got %s\n",
7784                         myname, expect, got);
7785                 exit(1);
7786         }
7787 }
7788
7789 int main()
7790
7791         char buf[64]; 
7792         buf[63] = '\0';
7793
7794         /* This must be 1st test on (which?) platform */
7795         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
7796         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
7797         checkit("0.1", buf);
7798
7799         Gconvert((DOUBLETYPE)1.0, 8, 0, buf); 
7800         checkit("1", buf);
7801
7802         Gconvert((DOUBLETYPE)1.1, 8, 0, buf); 
7803         checkit("1.1", buf);
7804
7805         Gconvert((DOUBLETYPE)1.01, 8, 0, buf); 
7806         checkit("1.01", buf);
7807
7808         Gconvert((DOUBLETYPE)1.001, 8, 0, buf); 
7809         checkit("1.001", buf);
7810
7811         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf); 
7812         checkit("1.0001", buf);
7813
7814         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf); 
7815         checkit("1.00001", buf);
7816
7817         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf); 
7818         checkit("1.000001", buf);
7819
7820         Gconvert((DOUBLETYPE)0.0, 8, 0, buf); 
7821         checkit("0", buf);
7822
7823         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf); 
7824         checkit("-1", buf);
7825
7826         /* Some Linux gcvt's give 1.e+5 here. */
7827         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf); 
7828         checkit("100000", buf);
7829         
7830         /* Some Linux gcvt's give -1.e+5 here. */
7831         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf); 
7832         checkit("-100000", buf);
7833
7834         exit(0);
7835 }
7836 EOP
7837 case "$d_Gconvert" in
7838 gconvert*) xxx_list='gconvert gcvt sprintf' ;;
7839 gcvt*) xxx_list='gcvt gconvert sprintf' ;;
7840 *) xxx_list='sprintf gconvert gcvt' ;;
7841 esac
7842
7843 case "$d_longdbl$uselongdouble$d_PRIgldbl" in
7844 "$define$define$define")
7845     xxx_list="`echo $xxx_list|sed s/sprintf//`" 
7846     xxx_list="sprintf $xxx_list"
7847     case "$d_qgcvt" in
7848     "$define") xxx_list="qgcvt $xxx_list" ;;
7849     esac
7850     ;;
7851 esac
7852
7853 for xxx_convert in $xxx_list; do
7854         echo "Trying $xxx_convert..."
7855         $rm -f try try$_o
7856         set try -DTRY_$xxx_convert
7857         if eval $compile; then
7858                 echo "$xxx_convert() found." >&4
7859                 if ./try; then
7860                         echo "I'll use $xxx_convert to convert floats into a string." >&4
7861                         break;
7862                 else
7863                         echo "...But $xxx_convert didn't work as I expected."
7864                 fi
7865         else
7866                 echo "$xxx_convert NOT found." >&4
7867         fi
7868 done
7869         
7870 case "$xxx_convert" in
7871 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
7872 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
7873 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
7874 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
7875    "$define$define$define")
7876       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
7877    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
7878    esac
7879    ;;  
7880 esac
7881
7882 : Initialize h_fcntl
7883 h_fcntl=false
7884
7885 : Initialize h_sysfile
7886 h_sysfile=false
7887
7888 : access call always available on UNIX
7889 set access d_access
7890 eval $inlibc
7891
7892 : locate the flags for 'access()'
7893 case "$d_access" in
7894 "$define")
7895         echo " "
7896         $cat >access.c <<'EOCP'
7897 #include <sys/types.h>
7898 #ifdef I_FCNTL
7899 #include <fcntl.h>
7900 #endif
7901 #ifdef I_SYS_FILE
7902 #include <sys/file.h>
7903 #endif
7904 #ifdef I_UNISTD
7905 #include <unistd.h>
7906 #endif
7907 int main() {
7908         exit(R_OK);
7909 }
7910 EOCP
7911         : check sys/file.h first, no particular reason here
7912         if $test `./findhdr sys/file.h` && \
7913                 $cc $cppflags -DI_SYS_FILE -o access access.c >/dev/null 2>&1 ; then
7914                 h_sysfile=true;
7915                 echo "<sys/file.h> defines the *_OK access constants." >&4
7916         elif $test `./findhdr fcntl.h` && \
7917                 $cc $cppflags -DI_FCNTL -o access access.c >/dev/null 2>&1 ; then
7918                 h_fcntl=true;
7919                 echo "<fcntl.h> defines the *_OK access constants." >&4
7920         elif $test `./findhdr unistd.h` && \
7921                 $cc $cppflags -DI_UNISTD -o access access.c >/dev/null 2>&1 ; then
7922                 echo "<unistd.h> defines the *_OK access constants." >&4
7923         else
7924                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
7925         fi
7926         ;;
7927 esac
7928 $rm -f access*
7929
7930 : see if accessx exists
7931 set accessx d_accessx
7932 eval $inlibc
7933
7934 : see if alarm exists
7935 set alarm d_alarm
7936 eval $inlibc
7937
7938 : see if atolf exists
7939 set atolf d_atolf
7940 eval $inlibc
7941
7942 : see if atoll exists
7943 set atoll d_atoll
7944 eval $inlibc
7945
7946 : Look for GNU-cc style attribute checking
7947 echo " "
7948 echo "Checking whether your compiler can handle __attribute__ ..." >&4
7949 $cat >attrib.c <<'EOCP'
7950 #include <stdio.h>
7951 void croak (char* pat,...) __attribute__((format(printf,1,2),noreturn));
7952 EOCP
7953 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
7954         if $contains 'warning' attrib.out >/dev/null 2>&1; then
7955                 echo "Your C compiler doesn't fully support __attribute__."
7956                 val="$undef"
7957         else
7958                 echo "Your C compiler supports __attribute__."
7959                 val="$define"
7960         fi
7961 else
7962         echo "Your C compiler doesn't seem to understand __attribute__ at all."
7963         val="$undef"
7964 fi
7965 set d_attribut
7966 eval $setvar
7967 $rm -f attrib*
7968
7969 : see if bcmp exists
7970 set bcmp d_bcmp
7971 eval $inlibc
7972
7973 : see if bcopy exists
7974 set bcopy d_bcopy
7975 eval $inlibc
7976
7977 : see if this is a unistd.h system
7978 set unistd.h i_unistd
7979 eval $inhdr
7980
7981 : see if getpgrp exists
7982 set getpgrp d_getpgrp
7983 eval $inlibc
7984
7985 case "$d_getpgrp" in
7986 "$define")
7987         echo " "
7988         echo "Checking to see which flavor of getpgrp is in use..."
7989         $cat >set.c <<EOP
7990 #$i_unistd I_UNISTD
7991 #include <sys/types.h>
7992 #ifdef I_UNISTD
7993 #  include <unistd.h>
7994 #endif
7995 int main()
7996 {
7997         if (getuid() == 0) {
7998                 printf("(I see you are running Configure as super-user...)\n");
7999                 setuid(1);
8000         }
8001 #ifdef TRY_BSD_PGRP
8002         if (getpgrp(1) == 0)
8003                 exit(0);
8004 #else
8005         if (getpgrp() > 0)
8006                 exit(0);
8007 #endif
8008         exit(1);
8009 }
8010 EOP
8011         if $cc -DTRY_BSD_PGRP $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
8012                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
8013                 val="$define"
8014         elif $cc $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
8015                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
8016                 val="$undef"
8017         else
8018                 echo "I can't seem to compile and run the test program."
8019                 if ./usg; then
8020                         xxx="a USG one, i.e. you use getpgrp()."
8021                 else
8022                         # SVR4 systems can appear rather BSD-ish.
8023                         case "$i_unistd" in
8024                         $undef)
8025                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
8026                                 val="$define"
8027                                 ;;
8028                         $define)
8029                                 xxx="probably a USG one, i.e. you use getpgrp()."
8030                                 val="$undef"
8031                                 ;;
8032                         esac
8033                 fi
8034                 echo "Assuming your getpgrp is $xxx" >&4
8035         fi
8036         ;;
8037 *) val="$undef";;
8038 esac
8039 set d_bsdgetpgrp
8040 eval $setvar
8041 $rm -f set set.c
8042
8043 : see if setpgrp exists
8044 set setpgrp d_setpgrp
8045 eval $inlibc
8046
8047 case "$d_setpgrp" in
8048 "$define")
8049         echo " "
8050         echo "Checking to see which flavor of setpgrp is in use..."
8051         $cat >set.c <<EOP
8052 #$i_unistd I_UNISTD
8053 #include <sys/types.h>
8054 #ifdef I_UNISTD
8055 #  include <unistd.h>
8056 #endif
8057 int main()
8058 {
8059         if (getuid() == 0) {
8060                 printf("(I see you are running Configure as super-user...)\n");
8061                 setuid(1);
8062         }
8063 #ifdef TRY_BSD_PGRP
8064         if (-1 == setpgrp(1, 1))
8065                 exit(0);
8066 #else
8067         if (setpgrp() != -1)
8068                 exit(0);
8069 #endif
8070         exit(1);
8071 }
8072 EOP
8073         if $cc -DTRY_BSD_PGRP $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
8074                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
8075                 val="$define"
8076         elif $cc $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
8077                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
8078                 val="$undef"
8079         else
8080                 echo "(I can't seem to compile and run the test program.)"
8081                 if ./usg; then
8082                         xxx="a USG one, i.e. you use setpgrp()."
8083                 else
8084                         # SVR4 systems can appear rather BSD-ish.
8085                         case "$i_unistd" in
8086                         $undef)
8087                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
8088                                 val="$define"
8089                                 ;;
8090                         $define)
8091                                 xxx="probably a USG one, i.e. you use setpgrp()."
8092                                 val="$undef"
8093                                 ;;
8094                         esac
8095                 fi
8096                 echo "Assuming your setpgrp is $xxx" >&4
8097         fi
8098         ;;
8099 *) val="$undef";;
8100 esac
8101 set d_bsdsetpgrp
8102 eval $setvar
8103 $rm -f set set.c
8104 : see if bzero exists
8105 set bzero d_bzero
8106 eval $inlibc
8107
8108 : see if signal is declared as pointer to function returning int or void
8109 echo " "
8110 xxx=`./findhdr signal.h`
8111 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
8112 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
8113         echo "You have int (*signal())() instead of void." >&4
8114         val="$undef"
8115 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
8116         echo "You have void (*signal())()." >&4
8117         val="$define"
8118 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
8119         echo "You have int (*signal())() instead of void." >&4
8120         val="$undef"
8121 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
8122         echo "You have void (*signal())()." >&4
8123         val="$define"
8124 else
8125         case "$d_voidsig" in
8126         '')
8127         echo "I can't determine whether signal handler returns void or int..." >&4
8128                 dflt=void
8129                 rp="What type does your signal handler return?"
8130                 . ./myread
8131                 case "$ans" in
8132                 v*) val="$define";;
8133                 *) val="$undef";;
8134                 esac;;
8135         "$define")
8136                 echo "As you already told me, signal handler returns void." >&4
8137                 val="$define"
8138                 ;;
8139         *)      echo "As you already told me, signal handler returns int." >&4
8140                 val="$undef"
8141                 ;;
8142         esac
8143 fi
8144 set d_voidsig
8145 eval $setvar
8146 case "$d_voidsig" in
8147 "$define") signal_t="void";;
8148 *) signal_t="int";;
8149 esac
8150 $rm -f $$.tmp
8151
8152 : check for ability to cast large floats to 32-bit ints.
8153 echo " "
8154 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
8155 if $test "$intsize" -ge 4; then
8156         xxx=int
8157 else
8158         xxx=long
8159 fi
8160 $cat >try.c <<EOCP
8161 #include <stdio.h>
8162 #include <sys/types.h>
8163 #include <signal.h>
8164 $signal_t blech(s) int s; { exit(3); }
8165 int main()
8166 {
8167         $xxx i32;
8168         double f, g;
8169         int result = 0;
8170         char str[16];
8171         signal(SIGFPE, blech);
8172
8173         /* Don't let compiler optimize the test away.  Store the number 
8174            in a writable string for gcc to pass to sscanf under HP/UX.
8175         */
8176         sprintf(str, "2147483647");
8177         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
8178         g = 10 * f;
8179         i32  = ($xxx) g;
8180
8181         /* x86 processors will probably give 0x8000 0000, which is a
8182        sign change.  We don't want that.  We want to mimic SPARC
8183            behavior here, which is to preserve the sign and give
8184            back 0x7fff ffff.
8185         */
8186         if (i32 != ($xxx) f)
8187                 result |= 1;
8188         exit(result);
8189 }
8190 EOCP
8191 set try
8192 if eval $compile_ok; then
8193         ./try
8194         yyy=$?
8195 else
8196         echo "(I can't seem to compile the test program--assuming it can't)"
8197         yyy=1
8198 fi
8199 case "$yyy" in
8200 0)      val="$define"
8201         echo "Yup, it can."
8202         ;;
8203 *)      val="$undef"
8204         echo "Nope, it can't."
8205         ;;
8206 esac
8207 set d_casti32
8208 eval $setvar
8209 $rm -f try try.*
8210
8211 : check for ability to cast negative floats to unsigned
8212 echo " "
8213 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
8214 $cat >try.c <<EOCP
8215 #include <stdio.h>
8216 #include <sys/types.h>
8217 #include <signal.h>
8218 $signal_t blech(s) int s; { exit(7); }
8219 $signal_t blech_in_list(s) int s; { exit(4); }
8220 unsigned long dummy_long(p) unsigned long p; { return p; }
8221 unsigned int dummy_int(p) unsigned int p; { return p; }
8222 unsigned short dummy_short(p) unsigned short p; { return p; }
8223 int main()
8224 {
8225         double f;
8226         unsigned long along;
8227         unsigned int aint;
8228         unsigned short ashort;
8229         int result = 0;
8230         char str[16];
8231         
8232         /* Frustrate gcc-2.7.2's optimizer which failed this test with
8233            a direct f = -123. assignment.  gcc-2.8.0 reportedly
8234            optimized the whole file away
8235         */
8236         /* Store the number in a writable string for gcc to pass to 
8237            sscanf under HP/UX.
8238         */
8239         sprintf(str, "-123");
8240         sscanf(str, "%lf", &f);  /* f = -123.; */
8241
8242         signal(SIGFPE, blech);
8243         along = (unsigned long)f;
8244         aint = (unsigned int)f;
8245         ashort = (unsigned short)f;
8246         if (along != (unsigned long)-123)
8247                 result |= 1;
8248         if (aint != (unsigned int)-123)
8249                 result |= 1;
8250         if (ashort != (unsigned short)-123)
8251                 result |= 1;
8252         sprintf(str, "1073741824.");
8253         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
8254         f = f + f;
8255         along = 0;
8256         along = (unsigned long)f;
8257         if (along != 0x80000000)
8258                 result |= 2;
8259         f -= 1.;
8260         along = 0;
8261         along = (unsigned long)f;
8262         if (along != 0x7fffffff)
8263                 result |= 1;
8264         f += 2.;
8265         along = 0;
8266         along = (unsigned long)f;
8267         if (along != 0x80000001)
8268                 result |= 2;
8269         if (result)
8270                 exit(result);
8271         signal(SIGFPE, blech_in_list);
8272         sprintf(str, "123.");
8273         sscanf(str, "%lf", &f);  /* f = 123.; */
8274         along = dummy_long((unsigned long)f);
8275         aint = dummy_int((unsigned int)f);
8276         ashort = dummy_short((unsigned short)f);
8277         if (along != (unsigned long)123)
8278                 result |= 4;
8279         if (aint != (unsigned int)123)
8280                 result |= 4;
8281         if (ashort != (unsigned short)123)
8282                 result |= 4;
8283         exit(result);
8284
8285 }
8286 EOCP
8287 set try
8288 if eval $compile_ok; then
8289         ./try
8290         castflags=$?
8291 else
8292         echo "(I can't seem to compile the test program--assuming it can't)"
8293         castflags=7
8294 fi
8295 case "$castflags" in
8296 0)      val="$define"
8297         echo "Yup, it can."
8298         ;;
8299 *)      val="$undef"
8300         echo "Nope, it can't."
8301         ;;
8302 esac
8303 set d_castneg
8304 eval $setvar
8305 $rm -f try.*
8306
8307 : see if vprintf exists
8308 echo " "
8309 if set vprintf val -f d_vprintf; eval $csym; $val; then
8310         echo 'vprintf() found.' >&4
8311         val="$define"
8312         $cat >vprintf.c <<'EOF'
8313 #include <varargs.h>
8314
8315 int main() { xxx("foo"); }
8316
8317 xxx(va_alist)
8318 va_dcl
8319 {
8320         va_list args;
8321         char buf[10];
8322
8323         va_start(args);
8324         exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
8325 }
8326 EOF
8327         set vprintf
8328         if eval $compile && ./vprintf; then
8329                 echo "Your vsprintf() returns (int)." >&4
8330                 val2="$undef"
8331         else
8332                 echo "Your vsprintf() returns (char*)." >&4
8333                 val2="$define"
8334         fi
8335 else
8336         echo 'vprintf() NOT found.' >&4
8337                 val="$undef"
8338                 val2="$undef"
8339 fi
8340 set d_vprintf
8341 eval $setvar
8342 val=$val2
8343 set d_charvspr
8344 eval $setvar
8345
8346 : see if chown exists
8347 set chown d_chown
8348 eval $inlibc
8349
8350 : see if chroot exists
8351 set chroot d_chroot
8352 eval $inlibc
8353
8354 : see if chsize exists
8355 set chsize d_chsize
8356 eval $inlibc
8357
8358 : check for const keyword
8359 echo " "
8360 echo 'Checking to see if your C compiler knows about "const"...' >&4
8361 $cat >const.c <<'EOCP'
8362 typedef struct spug { int drokk; } spug;
8363 int main()
8364 {
8365         const char *foo;
8366         const spug y;
8367 }
8368 EOCP
8369 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
8370         val="$define"
8371         echo "Yup, it does."
8372 else
8373         val="$undef"
8374         echo "Nope, it doesn't."
8375 fi
8376 set d_const
8377 eval $setvar
8378
8379 : see if crypt exists
8380 echo " "
8381 if set crypt val -f d_crypt; eval $csym; $val; then
8382         echo 'crypt() found.' >&4
8383         val="$define"
8384         cryptlib=''
8385 else
8386         cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
8387         if $test -z "$cryptlib"; then
8388                 cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
8389         else
8390                 cryptlib=-lcrypt
8391         fi
8392         if $test -z "$cryptlib"; then
8393                 cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
8394         else
8395                 cryptlib=-lcrypt
8396         fi
8397         if $test -z "$cryptlib"; then
8398                 cryptlib=`./loc libcrypt$_a "" $libpth`
8399         else
8400                 cryptlib=-lcrypt
8401         fi
8402         if $test -z "$cryptlib"; then
8403                 echo 'crypt() NOT found.' >&4
8404                 val="$undef"
8405         else
8406                 val="$define"
8407         fi
8408 fi
8409 set d_crypt
8410 eval $setvar
8411
8412 : get csh whereabouts
8413 case "$csh" in
8414 'csh') val="$undef" ;;
8415 *) val="$define" ;;
8416 esac
8417 set d_csh
8418 eval $setvar
8419 : Respect a hint or command line value for full_csh.
8420 case "$full_csh" in
8421 '') full_csh=$csh ;;
8422 esac
8423
8424 : see if cuserid exists
8425 set cuserid d_cuserid
8426 eval $inlibc
8427
8428 : see if this is a limits.h system
8429 set limits.h i_limits
8430 eval $inhdr
8431
8432 : see if this is a float.h system
8433 set float.h i_float
8434 eval $inhdr
8435
8436 : See if number of significant digits in a double precision number is known
8437 echo " "
8438 $cat >dbl_dig.c <<EOM
8439 #$i_limits I_LIMITS
8440 #$i_float I_FLOAT
8441 #ifdef I_LIMITS
8442 #include <limits.h>
8443 #endif
8444 #ifdef I_FLOAT
8445 #include <float.h>
8446 #endif
8447 #ifdef DBL_DIG
8448 printf("Contains DBL_DIG");
8449 #endif
8450 EOM
8451 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
8452 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
8453         echo "DBL_DIG found." >&4
8454         val="$define"
8455 else
8456         echo "DBL_DIG NOT found." >&4
8457         val="$undef"
8458 fi
8459 $rm -f dbl_dig.?
8460 set d_dbl_dig
8461 eval $setvar
8462
8463 : see if difftime exists
8464 set difftime d_difftime
8465 eval $inlibc
8466
8467 : see if this is a dirent system
8468 echo " "
8469 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
8470         val="$define"
8471         echo "<dirent.h> found." >&4
8472 else
8473         val="$undef"
8474         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
8475                 echo "<sys/dir.h> found." >&4
8476                 echo " "
8477         else
8478                 xinc=`./findhdr sys/ndir.h`
8479         fi
8480         echo "<dirent.h> NOT found." >&4
8481 fi
8482 set i_dirent
8483 eval $setvar
8484
8485 : Look for type of directory structure.
8486 echo " "
8487 $cppstdin $cppflags $cppminus < "$xinc" > try.c
8488
8489 case "$direntrytype" in
8490 ''|' ')
8491         case "$i_dirent" in
8492         $define) guess1='struct dirent' ;;
8493         *) guess1='struct direct'  ;;
8494         esac
8495         ;;
8496 *)      guess1="$direntrytype"
8497         ;;
8498 esac
8499
8500 case "$guess1" in
8501 'struct dirent') guess2='struct direct' ;;
8502 *) guess2='struct dirent' ;;
8503 esac
8504                 
8505 if $contains "$guess1" try.c >/dev/null 2>&1; then
8506         direntrytype="$guess1"
8507         echo "Your directory entries are $direntrytype." >&4
8508 elif $contains "$guess2" try.c >/dev/null 2>&1; then
8509         direntrytype="$guess2"
8510         echo "Your directory entries seem to be $direntrytype." >&4
8511 else
8512         echo "I don't recognize your system's directory entries." >&4
8513         rp="What type is used for directory entries on this system?"
8514         dflt="$guess1"
8515         . ./myread
8516         direntrytype="$ans"
8517 fi
8518 $rm -f try.c
8519
8520
8521 : see if the directory entry stores field length
8522 echo " "
8523 $cppstdin $cppflags $cppminus < "$xinc" > try.c
8524 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
8525         echo "Good, your directory entry keeps length information in d_namlen." >&4
8526         val="$define"
8527 else
8528         echo "Your directory entry does not know about the d_namlen field." >&4
8529         val="$undef"
8530 fi
8531 set d_dirnamlen
8532 eval $setvar
8533 $rm -f try.c
8534
8535 : see if dlerror exists
8536 xxx_runnm="$runnm"
8537 runnm=false
8538 set dlerror d_dlerror
8539 eval $inlibc
8540 runnm="$xxx_runnm"
8541
8542 : see if dlfcn is available
8543 set dlfcn.h i_dlfcn
8544 eval $inhdr
8545
8546 case "$usedl" in
8547 $define|y|true)
8548         $cat << EOM
8549
8550 On a few systems, the dynamically loaded modules that perl generates and uses
8551 will need a different extension than shared libs. The default will probably
8552 be appropriate.
8553
8554 EOM
8555         case "$dlext" in
8556         '')     dflt="$so" ;;
8557         *)      dflt="$dlext" ;;
8558         esac
8559         rp='What is the extension of dynamically loaded modules'
8560         . ./myread
8561         dlext="$ans"
8562         ;;
8563 *)
8564         dlext="none"
8565         ;;
8566 esac
8567
8568 : Check if dlsym need a leading underscore
8569 echo " "
8570 val="$undef"
8571
8572 case "$dlsrc" in
8573 dl_dlopen.xs)
8574         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
8575         $cat >dyna.c <<'EOM'
8576 fred () { }
8577 EOM
8578
8579 $cat >fred.c<<EOM
8580
8581 #include <stdio.h>
8582 #$i_dlfcn I_DLFCN
8583 #ifdef I_DLFCN
8584 #include <dlfcn.h>      /* the dynamic linker include file for Sunos/Solaris */
8585 #else
8586 #include <sys/types.h>
8587 #include <nlist.h>
8588 #include <link.h>
8589 #endif
8590
8591 extern int fred() ;
8592
8593 int main()
8594 {
8595     void * handle ;
8596     void * symbol ;
8597 #ifndef RTLD_LAZY
8598     int mode = 1 ;
8599 #else
8600     int mode = RTLD_LAZY ;
8601 #endif
8602     handle = dlopen("./dyna.$dlext", mode) ;
8603     if (handle == NULL) {
8604         printf ("1\n") ;
8605         fflush (stdout) ;
8606         exit(0);
8607     }
8608     symbol = dlsym(handle, "fred") ;
8609     if (symbol == NULL) {
8610         /* try putting a leading underscore */
8611         symbol = dlsym(handle, "_fred") ;
8612         if (symbol == NULL) {
8613             printf ("2\n") ;
8614             fflush (stdout) ;
8615             exit(0);
8616         }
8617         printf ("3\n") ;
8618     }
8619     else
8620         printf ("4\n") ;
8621     fflush (stdout) ;
8622     exit(0);
8623 }
8624 EOM
8625         : Call the object file tmp-dyna.o in case dlext=o.
8626         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 && 
8627                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 && 
8628                 $ld $lddlflags -o dyna.$dlext tmp-dyna${_o} > /dev/null 2>&1 && 
8629                 $cc $ccflags -o fred $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1; then
8630                 xxx=`./fred`
8631                 case $xxx in
8632                 1)      echo "Test program failed using dlopen." >&4
8633                         echo "Perhaps you should not use dynamic loading." >&4;;
8634                 2)      echo "Test program failed using dlsym." >&4
8635                         echo "Perhaps you should not use dynamic loading." >&4;;
8636                 3)      echo "dlsym needs a leading underscore" >&4
8637                         val="$define" ;;
8638                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
8639                 esac
8640         else
8641                 echo "I can't compile and run the test program." >&4
8642                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
8643         fi
8644         ;;
8645 esac
8646                 
8647 $rm -f fred fred.? dyna.$dlext dyna.? tmp-dyna.?
8648
8649 set d_dlsymun
8650 eval $setvar
8651
8652 hasproto='varname=$1; func=$2; shift; shift;
8653 while $test $# -ge 2; do
8654         case "$1" in
8655         $define) echo "#include <$2>";;
8656         esac ;
8657     shift 2;
8658 done > try.c;
8659 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
8660 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
8661         echo "$func() prototype found.";
8662         val="$define";
8663 else
8664         echo "$func() prototype NOT found.";
8665         val="$undef";
8666 fi;
8667 set $varname;
8668 eval $setvar;
8669 $rm -f try.c tryout.c'
8670
8671 : see if prototype for drand48 is available
8672 echo " "
8673 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
8674 eval $hasproto
8675
8676 : see if dup2 exists
8677 set dup2 d_dup2
8678 eval $inlibc
8679
8680 : see if eaccess exists
8681 set eaccess d_eaccess
8682 eval $inlibc
8683
8684 : see if endgrent exists
8685 set endgrent d_endgrent
8686 eval $inlibc
8687
8688 : see if endhostent exists
8689 set endhostent d_endhent
8690 eval $inlibc
8691
8692 : see if endnetent exists
8693 set endnetent d_endnent
8694 eval $inlibc
8695
8696 : see if endprotoent exists
8697 set endprotoent d_endpent
8698 eval $inlibc
8699
8700 : see if endpwent exists
8701 set endpwent d_endpwent
8702 eval $inlibc
8703
8704 : see if endservent exists
8705 set endservent d_endsent
8706 eval $inlibc
8707
8708 : Locate the flags for 'open()'
8709 echo " "
8710 $cat >open3.c <<'EOCP'
8711 #include <sys/types.h>
8712 #ifdef I_FCNTL
8713 #include <fcntl.h>
8714 #endif
8715 #ifdef I_SYS_FILE
8716 #include <sys/file.h>
8717 #endif
8718 int main() {
8719         if(O_RDONLY);
8720 #ifdef O_TRUNC
8721         exit(0);
8722 #else
8723         exit(1);
8724 #endif
8725 }
8726 EOCP
8727 : check sys/file.h first to get FREAD on Sun
8728 if $test `./findhdr sys/file.h` && \
8729                 set open3 -DI_SYS_FILE && eval $compile; then
8730         h_sysfile=true;
8731         echo "<sys/file.h> defines the O_* constants..." >&4
8732         if ./open3; then
8733                 echo "and you have the 3 argument form of open()." >&4
8734                 val="$define"
8735         else
8736                 echo "but not the 3 argument form of open().  Oh, well." >&4
8737                 val="$undef"
8738         fi
8739 elif $test `./findhdr fcntl.h` && \
8740                 set open3 -DI_FCNTL && eval $compile; then
8741         h_fcntl=true;
8742         echo "<fcntl.h> defines the O_* constants..." >&4
8743         if ./open3; then
8744                 echo "and you have the 3 argument form of open()." >&4
8745                 val="$define"
8746         else
8747                 echo "but not the 3 argument form of open().  Oh, well." >&4
8748                 val="$undef"
8749         fi
8750 else
8751         val="$undef"
8752         echo "I can't find the O_* constant definitions!  You got problems." >&4
8753 fi
8754 set d_open3
8755 eval $setvar
8756 $rm -f open3*
8757
8758 : see which of string.h or strings.h is needed
8759 echo " "
8760 strings=`./findhdr string.h`
8761 if $test "$strings" && $test -r "$strings"; then
8762         echo "Using <string.h> instead of <strings.h>." >&4
8763         val="$define"
8764 else
8765         val="$undef"
8766         strings=`./findhdr strings.h`
8767         if $test "$strings" && $test -r "$strings"; then
8768                 echo "Using <strings.h> instead of <string.h>." >&4
8769         else
8770                 echo "No string header found -- You'll surely have problems." >&4
8771         fi
8772 fi
8773 set i_string
8774 eval $setvar
8775 case "$i_string" in
8776 "$undef") strings=`./findhdr strings.h`;;
8777 *)        strings=`./findhdr string.h`;;
8778 esac
8779
8780 : check for non-blocking I/O stuff
8781 case "$h_sysfile" in
8782 true) echo "#include <sys/file.h>" > head.c;;
8783 *)
8784         case "$h_fcntl" in
8785         true) echo "#include <fcntl.h>" > head.c;;
8786         *) echo "#include <sys/fcntl.h>" > head.c;;
8787         esac
8788         ;;
8789 esac
8790 echo " "
8791 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
8792 case "$o_nonblock" in
8793 '')
8794         $cat head.c > try.c
8795         $cat >>try.c <<'EOCP'
8796 #include <stdio.h>
8797 int main() {
8798 #ifdef O_NONBLOCK
8799         printf("O_NONBLOCK\n");
8800         exit(0);
8801 #endif
8802 #ifdef O_NDELAY
8803         printf("O_NDELAY\n");
8804         exit(0);
8805 #endif
8806 #ifdef FNDELAY
8807         printf("FNDELAY\n");
8808         exit(0);
8809 #endif
8810         exit(0);
8811 }
8812 EOCP
8813         set try
8814         if eval $compile_ok; then
8815                 o_nonblock=`./try`
8816                 case "$o_nonblock" in
8817                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
8818                 *) echo "Seems like we can use $o_nonblock.";;
8819                 esac
8820         else
8821                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
8822         fi
8823         ;;
8824 *) echo "Using $hint value $o_nonblock.";;
8825 esac
8826 $rm -f try try.* .out core
8827
8828 echo " "
8829 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
8830 case "$eagain" in
8831 '')
8832         $cat head.c > try.c
8833         $cat >>try.c <<EOCP
8834 #include <errno.h>
8835 #include <sys/types.h>
8836 #include <signal.h>
8837 #include <stdio.h> 
8838 #define MY_O_NONBLOCK $o_nonblock
8839 #ifndef errno  /* XXX need better Configure test */
8840 extern int errno;
8841 #endif
8842 #$i_unistd I_UNISTD
8843 #ifdef I_UNISTD
8844 #include <unistd.h>
8845 #endif
8846 #$i_string I_STRING
8847 #ifdef I_STRING
8848 #include <string.h>
8849 #else
8850 #include <strings.h>
8851 #endif
8852 $signal_t blech(x) int x; { exit(3); }
8853 EOCP
8854         $cat >> try.c <<'EOCP'
8855 int main()
8856 {
8857         int pd[2];
8858         int pu[2];
8859         char buf[1];
8860         char string[100];
8861
8862         pipe(pd);       /* Down: child -> parent */
8863         pipe(pu);       /* Up: parent -> child */
8864         if (0 != fork()) {
8865                 int ret;
8866                 close(pd[1]);   /* Parent reads from pd[0] */
8867                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
8868                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
8869                         exit(1);
8870                 signal(SIGALRM, blech);
8871                 alarm(5);
8872                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
8873                         exit(2);
8874                 sprintf(string, "%d\n", ret);
8875                 write(2, string, strlen(string));
8876                 alarm(0);
8877 #ifdef EAGAIN
8878                 if (errno == EAGAIN) {
8879                         printf("EAGAIN\n");
8880                         goto ok;
8881                 }
8882 #endif
8883 #ifdef EWOULDBLOCK
8884                 if (errno == EWOULDBLOCK)
8885                         printf("EWOULDBLOCK\n");
8886 #endif
8887         ok:
8888                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
8889                 sleep(2);                               /* Give it time to close our pipe */
8890                 alarm(5);
8891                 ret = read(pd[0], buf, 1);      /* Should read EOF */
8892                 alarm(0);
8893                 sprintf(string, "%d\n", ret);
8894                 write(3, string, strlen(string));
8895                 exit(0);
8896         }
8897
8898         close(pd[0]);                   /* We write to pd[1] */
8899         close(pu[1]);                   /* We read from pu[0] */
8900         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
8901         close(pd[1]);                   /* Pipe pd is now fully closed! */
8902         exit(0);                                /* Bye bye, thank you for playing! */
8903 }
8904 EOCP
8905         set try
8906         if eval $compile_ok; then
8907                 echo "$startsh" >mtry
8908                 echo "./try >try.out 2>try.ret 3>try.err || exit 4" >>mtry
8909                 chmod +x mtry
8910                 ./mtry >/dev/null 2>&1
8911                 case $? in
8912                 0) eagain=`$cat try.out`;;
8913                 1) echo "Could not perform non-blocking setting!";;
8914                 2) echo "I did a successful read() for something that was not there!";;
8915                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
8916                 *) echo "Something terribly wrong happened during testing.";;
8917                 esac
8918                 rd_nodata=`$cat try.ret`
8919                 echo "A read() system call with no data present returns $rd_nodata."
8920                 case "$rd_nodata" in
8921                 0|-1) ;;
8922                 *)
8923                         echo "(That's peculiar, fixing that to be -1.)"
8924                         rd_nodata=-1
8925                         ;;
8926                 esac
8927                 case "$eagain" in
8928                 '')
8929                         echo "Forcing errno EAGAIN on read() with no data available."
8930                         eagain=EAGAIN
8931                         ;;
8932                 *)
8933                         echo "Your read() sets errno to $eagain when no data is available."
8934                         ;;
8935                 esac
8936                 status=`$cat try.err`
8937                 case "$status" in
8938                 0) echo "And it correctly returns 0 to signal EOF.";;
8939                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
8940                 *) echo "However, your read() returns '$status' on EOF??";;
8941                 esac
8942                 val="$define"
8943                 if test "$status" = "$rd_nodata"; then
8944                         echo "WARNING: you can't distinguish between EOF and no data!"
8945                         val="$undef"
8946                 fi
8947         else
8948                 echo "I can't compile the test program--assuming errno EAGAIN will do."
8949                 eagain=EAGAIN
8950         fi
8951         set d_eofnblk
8952         eval $setvar
8953         ;;
8954 *)
8955         echo "Using $hint value $eagain."
8956         echo "Your read() returns $rd_nodata when no data is present."
8957         case "$d_eofnblk" in
8958         "$define") echo "And you can see EOF because read() returns 0.";;
8959         "$undef") echo "But you can't see EOF status from read() returned value.";;
8960         *)
8961                 echo "(Assuming you can't see EOF status from read anyway.)"
8962                 d_eofnblk=$undef
8963                 ;;
8964         esac
8965         ;;
8966 esac
8967 $rm -f try try.* .out core head.c mtry
8968
8969 : see if fchmod exists
8970 set fchmod d_fchmod
8971 eval $inlibc
8972
8973 : see if fchown exists
8974 set fchown d_fchown
8975 eval $inlibc
8976
8977 : see if this is an fcntl system
8978 set fcntl d_fcntl
8979 eval $inlibc
8980
8981 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
8982 while $test $# -ge 2; do
8983         case "$1" in
8984         $define) echo "#include <$2>";;
8985         esac ;
8986     shift 2;
8987 done > try.c;
8988 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
8989 set try;
8990 if eval $compile; then
8991         val="$define";
8992 else
8993         val="$undef";
8994 fi;
8995 set $varname;
8996 eval $setvar;
8997 $rm -f try.c try.o'
8998
8999 socketlib=''
9000 sockethdr=''
9001 : see whether socket exists
9002 echo " "
9003 $echo $n "Hmm... $c" >&4
9004 if set socket val -f d_socket; eval $csym; $val; then
9005         echo "Looks like you have Berkeley networking support." >&4
9006         d_socket="$define"
9007         if set setsockopt val -f; eval $csym; $val; then
9008                 d_oldsock="$undef"
9009         else
9010                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
9011                 d_oldsock="$define"
9012         fi
9013 else
9014         if $contains socklib libc.list >/dev/null 2>&1; then
9015                 echo "Looks like you have Berkeley networking support." >&4
9016                 d_socket="$define"
9017                 : we will have to assume that it supports the 4.2 BSD interface
9018                 d_oldsock="$undef"
9019         else
9020                 echo "You don't have Berkeley networking in libc$_a..." >&4
9021                 if test "X$d_socket" = "X$define"; then
9022                    echo "...but you seem to believe that you have sockets." >&4
9023                 else
9024                         for net in net socket
9025                         do
9026                                 if test -f /usr/lib/lib$net$_a; then
9027                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
9028                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
9029                                         if $contains socket libc.list >/dev/null 2>&1; then
9030                                                 d_socket="$define"
9031                                                 socketlib="-l$net"
9032                                                 case "$net" in
9033                                                 net)
9034                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
9035                                                         sockethdr="-I/usr/netinclude"
9036                                                         ;;
9037                                                 esac
9038                                                 echo "Found Berkeley sockets interface in lib$net." >& 4 
9039                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
9040                                                         d_oldsock="$undef"
9041                                                 else
9042                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
9043                                                         d_oldsock="$define"
9044                                                 fi
9045                                                 break
9046                                         fi
9047                                 fi
9048                         done
9049                         if test "X$d_socket" != "X$define"; then
9050                            echo "or anywhere else I see." >&4
9051                            d_socket="$undef"
9052                            d_oldsock="$undef"
9053                         fi
9054                 fi
9055         fi
9056 fi
9057
9058 : see if socketpair exists
9059 set socketpair d_sockpair
9060 eval $inlibc
9061
9062
9063 echo " "
9064 echo "Checking the availability of certain socket constants..." >& 4
9065 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
9066         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
9067         $cat >try.c <<EOF
9068 #include <sys/types.h>
9069 #include <sys/socket.h>
9070 int main() {
9071     int i = $ENUM;
9072 }
9073 EOF
9074         val="$undef"
9075         set try; if eval $compile; then
9076                 val="$define"
9077         fi
9078         set d_${enum}; eval $setvar
9079         $rm -f try.c try
9080 done
9081
9082 : see if sys/select.h has to be included
9083 set sys/select.h i_sysselct
9084 eval $inhdr
9085
9086 : see if we should include time.h, sys/time.h, or both
9087 echo " "
9088 if test "X$timeincl" = X; then
9089         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
9090         $echo $n "I'm now running the test program...$c"
9091         $cat >try.c <<'EOCP'
9092 #include <sys/types.h>
9093 #ifdef I_TIME
9094 #include <time.h>
9095 #endif
9096 #ifdef I_SYSTIME
9097 #ifdef SYSTIMEKERNEL
9098 #define KERNEL
9099 #endif
9100 #include <sys/time.h>
9101 #endif
9102 #ifdef I_SYSSELECT
9103 #include <sys/select.h>
9104 #endif
9105 int main()
9106 {
9107         struct tm foo;
9108 #ifdef S_TIMEVAL
9109         struct timeval bar;
9110 #endif
9111 #ifdef S_TIMEZONE
9112         struct timezone tzp;
9113 #endif
9114         if (foo.tm_sec == foo.tm_sec)
9115                 exit(0);
9116 #ifdef S_TIMEVAL
9117         if (bar.tv_sec == bar.tv_sec)
9118                 exit(0);
9119 #endif
9120         exit(1);
9121 }
9122 EOCP
9123         flags=''
9124         for s_timezone in '-DS_TIMEZONE' ''; do
9125         sysselect=''
9126         for s_timeval in '-DS_TIMEVAL' ''; do
9127         for i_systimek in '' '-DSYSTIMEKERNEL'; do
9128         for i_time in '' '-DI_TIME'; do
9129         for i_systime in '-DI_SYSTIME' ''; do
9130                 case "$flags" in
9131                 '') $echo $n ".$c"
9132                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
9133                         if eval $compile; then
9134                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
9135                                 shift
9136                                 flags="$*"
9137                                 echo " "
9138                                 $echo $n "Succeeded with $flags$c"
9139                         fi
9140                         ;;
9141                 esac
9142         done
9143         done
9144         done
9145         done
9146         done
9147         timeincl=''
9148         echo " "
9149         case "$flags" in
9150         *SYSTIMEKERNEL*) i_systimek="$define"
9151                 timeincl=`./findhdr sys/time.h`
9152                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
9153         *) i_systimek="$undef";;
9154         esac
9155         case "$flags" in
9156         *I_TIME*) i_time="$define"
9157                 timeincl=`./findhdr time.h`" $timeincl"
9158                 echo "We'll include <time.h>." >&4;;
9159         *) i_time="$undef";;
9160         esac
9161         case "$flags" in
9162         *I_SYSTIME*) i_systime="$define"
9163                 timeincl=`./findhdr sys/time.h`" $timeincl"
9164                 echo "We'll include <sys/time.h>." >&4;;
9165         *) i_systime="$undef";;
9166         esac
9167         $rm -f try.c try
9168 fi
9169
9170 : check for fd_set items
9171 $cat <<EOM
9172
9173 Checking to see how well your C compiler handles fd_set and friends ...
9174 EOM
9175 $cat >fd_set.c <<EOCP
9176 #$i_systime I_SYS_TIME
9177 #$i_sysselct I_SYS_SELECT
9178 #$d_socket HAS_SOCKET
9179 #include <sys/types.h>
9180 #ifdef HAS_SOCKET
9181 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
9182 #endif
9183 #ifdef I_SYS_TIME
9184 #include <sys/time.h>
9185 #endif
9186 #ifdef I_SYS_SELECT
9187 #include <sys/select.h>
9188 #endif
9189 int main() {
9190         fd_set fds;
9191
9192 #ifdef TRYBITS
9193         if(fds.fds_bits);
9194 #endif
9195
9196 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
9197         exit(0);
9198 #else
9199         exit(1);
9200 #endif
9201 }
9202 EOCP
9203 set fd_set -DTRYBITS
9204 if eval $compile; then
9205         d_fds_bits="$define"
9206         d_fd_set="$define"
9207         echo "Well, your system knows about the normal fd_set typedef..." >&4
9208         if ./fd_set; then
9209                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
9210                 d_fd_macros="$define"
9211         else
9212                 $cat >&4 <<'EOM'
9213 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
9214 EOM
9215                 d_fd_macros="$undef"
9216         fi
9217 else
9218         $cat <<'EOM'
9219 Hmm, your compiler has some difficulty with fd_set.  Checking further...
9220 EOM
9221         set fd_set
9222         if eval $compile; then
9223                 d_fds_bits="$undef"
9224                 d_fd_set="$define"
9225                 echo "Well, your system has some sort of fd_set available..." >&4
9226                 if ./fd_set; then
9227                         echo "and you have the normal fd_set macros." >&4
9228                         d_fd_macros="$define"
9229                 else
9230                         $cat <<'EOM'
9231 but not the normal fd_set macros!  Gross!  More work for me...
9232 EOM
9233                         d_fd_macros="$undef"
9234                 fi
9235         else
9236         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
9237                 d_fd_set="$undef"
9238                 d_fds_bits="$undef"
9239                 d_fd_macros="$undef"
9240         fi
9241 fi
9242 $rm -f fd_set*
9243
9244 : see if fgetpos exists
9245 set fgetpos d_fgetpos
9246 eval $inlibc
9247
9248 : see if flock exists
9249 set flock d_flock
9250 eval $inlibc
9251
9252 : see if fork exists
9253 set fork d_fork
9254 eval $inlibc
9255
9256 : see if pathconf exists
9257 set pathconf d_pathconf
9258 eval $inlibc
9259
9260 : see if fpathconf exists
9261 set fpathconf d_fpathconf
9262 eval $inlibc
9263
9264
9265 : check for fpos64_t
9266 echo " "
9267 echo "Checking to see if you have fpos64_t..." >&4
9268 $cat >try.c <<EOCP
9269 #include <stdio.h>
9270 int main() { fpos64_t x = 7; }
9271 EOCP
9272 set try
9273 if eval $compile; then
9274         val="$define"
9275         echo "You have fpos64_t."
9276 else
9277         val="$undef"
9278         echo "You do not have fpos64_t."
9279         case "$fpossize" in
9280         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
9281         esac
9282 fi
9283 $rm -f try.* try
9284 set d_fpos64_t
9285 eval $setvar
9286
9287 : see if frexpl exists
9288 set frexpl d_frexpl
9289 eval $inlibc
9290
9291 hasstruct='varname=$1; struct=$2; shift; shift;
9292 while $test $# -ge 2; do
9293         case "$1" in
9294         $define) echo "#include <$2>";;
9295         esac ;
9296     shift 2;
9297 done > try.c;
9298 echo "int main () { struct $struct foo; }" >> try.c;
9299 set try;
9300 if eval $compile; then
9301         val="$define";
9302 else
9303         val="$undef";
9304 fi;
9305 set $varname;
9306 eval $setvar;
9307 $rm -f try.c try.o'
9308
9309 : see if this is a sys/param system
9310 set sys/param.h i_sysparam
9311 eval $inhdr
9312
9313 : see if this is a sys/mount.h system
9314 set sys/mount.h i_sysmount
9315 eval $inhdr
9316
9317 : see if sys/types.h has to be included
9318 set sys/types.h i_systypes
9319 eval $inhdr
9320
9321
9322 echo " "
9323 echo "Checking to see if your system supports struct fs_data..." >&4
9324 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
9325 eval $hasstruct
9326 case "$d_fs_data_s" in
9327 "$define")      echo "Yes, it does."   ;;
9328 *)              echo "No, it doesn't." ;;
9329 esac
9330
9331 : see if fseeko exists
9332 set fseeko d_fseeko
9333 eval $inlibc
9334 case "$longsize" in
9335 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
9336 esac
9337
9338 : see if fsetpos exists
9339 set fsetpos d_fsetpos
9340 eval $inlibc
9341
9342
9343 : see if fstatfs exists
9344 set fstatfs d_fstatfs
9345 eval $inlibc
9346
9347
9348 : see if statvfs exists
9349 set statvfs d_statvfs
9350 eval $inlibc
9351
9352 : see if fstatvfs exists
9353 set fstatvfs d_fstatvfs
9354 eval $inlibc
9355
9356
9357 : see if ftello exists
9358 set ftello d_ftello
9359 eval $inlibc
9360 case "$longsize" in
9361 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
9362 esac
9363
9364 : see if getcwd exists
9365 set getcwd d_getcwd
9366 eval $inlibc
9367
9368 : see if getespwnam exists
9369 set getespwnam d_getespwnam
9370 eval $inlibc
9371
9372
9373 : see if getfsstat exists
9374 set getfsstat d_getfsstat
9375 eval $inlibc
9376
9377 : see if getgrent exists
9378 set getgrent d_getgrent
9379 eval $inlibc
9380
9381 : see if gethostbyaddr exists
9382 set gethostbyaddr d_gethbyaddr
9383 eval $inlibc
9384
9385 : see if gethostbyname exists
9386 set gethostbyname d_gethbyname
9387 eval $inlibc
9388
9389 : see if gethostent exists
9390 set gethostent d_gethent
9391 eval $inlibc
9392
9393 : see how we will look up host name
9394 echo " "
9395 call=''
9396 if set gethostname val -f d_gethname; eval $csym; $val; then
9397         echo 'gethostname() found.' >&4
9398         d_gethname="$define"
9399         call=gethostname
9400 fi
9401 if set uname val -f d_uname; eval $csym; $val; then
9402         if ./xenix; then
9403                 $cat <<'EOM'
9404 uname() was found, but you're running xenix, and older versions of xenix
9405 have a broken uname(). If you don't really know whether your xenix is old
9406 enough to have a broken system call, use the default answer.
9407
9408 EOM
9409                 dflt=y
9410                 case "$d_uname" in
9411                 "$define") dflt=n;;
9412                 esac
9413                 rp='Is your uname() broken?'
9414                 . ./myread
9415                 case "$ans" in
9416                 n*) d_uname="$define"; call=uname;;
9417                 esac
9418         else
9419                 echo 'uname() found.' >&4
9420                 d_uname="$define"
9421                 case "$call" in
9422                 '') call=uname ;;
9423                 esac
9424         fi
9425 fi
9426 case "$d_gethname" in
9427 '') d_gethname="$undef";;
9428 esac
9429 case "$d_uname" in
9430 '') d_uname="$undef";;
9431 esac
9432 case "$d_uname$d_gethname" in
9433 *define*)
9434         dflt=n
9435         cat <<EOM
9436  
9437 Every now and then someone has a $call() that lies about the hostname
9438 but can't be fixed for political or economic reasons.  If you wish, I can
9439 pretend $call() isn't there and maybe compute hostname at run-time
9440 thanks to the '$phostname' command.
9441
9442 EOM
9443         rp="Shall I ignore $call() from now on?"
9444         . ./myread
9445         case "$ans" in
9446         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
9447         esac;;
9448 esac
9449 case "$phostname" in
9450 '') aphostname='';;
9451 *) case "$aphostname" in
9452         /*) ;;
9453         *) set X $phostname
9454                 shift
9455                 file=$1
9456                 shift
9457                 file=`./loc $file $file $pth`
9458                 aphostname=`echo $file $*`
9459                 ;;
9460         esac
9461         ;;
9462 esac
9463 case "$d_uname$d_gethname" in
9464 *define*) ;;
9465 *)
9466         case "$phostname" in
9467         '')
9468                 echo "There will be no way for $package to get your hostname." >&4;;
9469         *)
9470         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
9471                 ;;
9472         esac;;
9473 esac
9474 case "$d_phostname" in
9475 '') d_phostname="$undef";;
9476 esac
9477
9478 : see if this is a netdb.h system
9479 set netdb.h i_netdb
9480 eval $inhdr
9481
9482 : see if prototypes for various gethostxxx netdb.h functions are available
9483 echo " "
9484 set d_gethostprotos gethostent $i_netdb netdb.h
9485 eval $hasproto
9486
9487 : see if getlogin exists
9488 set getlogin d_getlogin
9489 eval $inlibc
9490
9491 : see if getmnt exists
9492 set getmnt d_getmnt
9493 eval $inlibc
9494
9495 : see if getmntent exists
9496 set getmntent d_getmntent
9497 eval $inlibc
9498
9499 : see if getnetbyaddr exists
9500 set getnetbyaddr d_getnbyaddr
9501 eval $inlibc
9502
9503 : see if getnetbyname exists
9504 set getnetbyname d_getnbyname
9505 eval $inlibc
9506
9507 : see if getnetent exists
9508 set getnetent d_getnent
9509 eval $inlibc
9510
9511 : see if prototypes for various getnetxxx netdb.h functions are available
9512 echo " "
9513 set d_getnetprotos getnetent $i_netdb netdb.h
9514 eval $hasproto
9515
9516
9517 : see if getprotobyname exists
9518 set getprotobyname d_getpbyname
9519 eval $inlibc
9520
9521 : see if getprotobynumber exists
9522 set getprotobynumber d_getpbynumber
9523 eval $inlibc
9524
9525 : see if getprotoent exists
9526 set getprotoent d_getpent
9527 eval $inlibc
9528
9529 : see if getpgid exists
9530 set getpgid d_getpgid
9531 eval $inlibc
9532
9533 : see if getpgrp2 exists
9534 set getpgrp2 d_getpgrp2
9535 eval $inlibc
9536
9537 : see if getppid exists
9538 set getppid d_getppid
9539 eval $inlibc
9540
9541 : see if getpriority exists
9542 set getpriority d_getprior
9543 eval $inlibc
9544
9545 : see if prototypes for various getprotoxxx netdb.h functions are available
9546 echo " "
9547 set d_getprotoprotos getprotoent $i_netdb netdb.h
9548 eval $hasproto
9549
9550 : see if getprpwnam exists
9551 set getprpwnam d_getprpwnam
9552 eval $inlibc
9553
9554 : see if getpwent exists
9555 set getpwent d_getpwent
9556 eval $inlibc
9557
9558
9559 : see if getservbyname exists
9560 set getservbyname d_getsbyname
9561 eval $inlibc
9562
9563 : see if getservbyport exists
9564 set getservbyport d_getsbyport
9565 eval $inlibc
9566
9567 : see if getservent exists
9568 set getservent d_getsent
9569 eval $inlibc
9570
9571 : see if prototypes for various getservxxx netdb.h functions are available
9572 echo " "
9573 set d_getservprotos getservent $i_netdb netdb.h
9574 eval $hasproto
9575
9576 : see if getspnam exists
9577 set getspnam d_getspnam
9578 eval $inlibc
9579
9580 : see if gettimeofday or ftime exists
9581 set gettimeofday d_gettimeod
9582 eval $inlibc
9583 case "$d_gettimeod" in
9584 "$undef")
9585         set ftime d_ftime 
9586         eval $inlibc
9587         ;;
9588 *)
9589         val="$undef"; set d_ftime; eval $setvar
9590         ;;
9591 esac
9592 case "$d_gettimeod$d_ftime" in
9593 "$undef$undef")
9594         echo " "
9595         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
9596         ;;
9597 esac
9598
9599 : see if this is an grp system
9600 set grp.h i_grp
9601 eval $inhdr
9602
9603 case "$i_grp" in
9604 $define)
9605         xxx=`./findhdr grp.h`
9606         $cppstdin $cppflags $cppminus < $xxx >$$.h
9607
9608         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
9609                 val="$define"
9610         else
9611                 val="$undef"
9612         fi
9613         set d_grpasswd
9614         eval $setvar
9615
9616         $rm -f $$.h
9617         ;;
9618 *)
9619         val="$undef";
9620         set d_grpasswd; eval $setvar
9621         ;;
9622 esac
9623
9624 : see if hasmntopt exists
9625 set hasmntopt d_hasmntopt
9626 eval $inlibc
9627
9628 : see if this is a netinet/in.h or sys/in.h system
9629 set netinet/in.h i_niin sys/in.h i_sysin
9630 eval $inhdr
9631
9632 : see if arpa/inet.h has to be included
9633 set arpa/inet.h i_arpainet
9634 eval $inhdr
9635
9636 : see if htonl --and friends-- exists
9637 val=''
9638 set htonl val
9639 eval $inlibc
9640
9641 : Maybe they are macros.
9642 case "$val" in
9643 $undef)
9644         $cat >htonl.c <<EOM
9645 #include <stdio.h>
9646 #include <sys/types.h>
9647 #$i_niin I_NETINET_IN
9648 #$i_sysin I_SYS_IN
9649 #$i_arpainet I_ARPA_INET
9650 #ifdef I_NETINET_IN
9651 #include <netinet/in.h>
9652 #endif
9653 #ifdef I_SYS_IN
9654 #include <sys/in.h>
9655 #endif
9656 #ifdef I_ARPA_INET
9657 #include <arpa/inet.h>
9658 #endif
9659 #ifdef htonl
9660 printf("Defined as a macro.");
9661 #endif
9662 EOM
9663         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
9664         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
9665                 val="$define"
9666                 echo "But it seems to be defined as a macro." >&4
9667         fi
9668         $rm -f htonl.?
9669         ;;
9670 esac
9671 set d_htonl
9672 eval $setvar
9673
9674 : see if iconv exists
9675 set iconv d_iconv
9676 eval $inlibc
9677
9678 : index or strchr
9679 echo " "
9680 if set index val -f; eval $csym; $val; then
9681         if set strchr val -f d_strchr; eval $csym; $val; then
9682                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
9683                         val="$define"
9684                         vali="$undef"
9685                         echo "strchr() found." >&4
9686                 else
9687                         val="$undef"
9688                         vali="$define"
9689                         echo "index() found." >&4
9690                 fi
9691         else
9692                 val="$undef"
9693                 vali="$define"
9694                 echo "index() found." >&4
9695         fi
9696 else
9697         if set strchr val -f d_strchr; eval $csym; $val; then
9698                 val="$define"
9699                 vali="$undef"
9700                 echo "strchr() found." >&4
9701         else
9702                 echo "No index() or strchr() found!" >&4
9703                 val="$undef"
9704                 vali="$undef"
9705         fi
9706 fi
9707 set d_strchr; eval $setvar
9708 val="$vali"
9709 set d_index; eval $setvar
9710
9711 : check whether inet_aton exists
9712 set inet_aton d_inetaton
9713 eval $inlibc
9714
9715 : see if inttypes.h is available
9716 : we want a real compile instead of Inhdr because some systems
9717 : have an inttypes.h which includes non-existent headers
9718 echo " "
9719 $cat >try.c <<EOCP
9720 #include <inttypes.h>
9721 int main() {
9722         static int32_t foo32 = 0x12345678;
9723 }
9724 EOCP
9725 set try
9726 if eval $compile; then
9727         echo "<inttypes.h> found." >&4
9728         val="$define"
9729 else
9730         echo "<inttypes.h> NOT found." >&4
9731         val="$undef"
9732 fi
9733 $rm -f try.c try
9734 set i_inttypes
9735 eval $setvar
9736
9737 : check for int64_t
9738 echo " "
9739 echo "Checking to see if you have int64_t..." >&4
9740 $cat >try.c <<EOCP
9741 #include <sys/types.h>
9742 #$i_inttypes I_INTTYPES
9743 #ifdef I_INTTYPES
9744 #include <inttypes.h>
9745 #endif
9746 int main() { int64_t x = 7; }
9747 EOCP
9748 set try
9749 if eval $compile; then
9750         val="$define"
9751         echo "You have int64_t."
9752 else
9753         val="$undef"
9754         echo "You do not have int64_t."
9755 fi
9756 $rm -f try try.*
9757 set d_int64_t
9758 eval $setvar
9759
9760 : Look for isascii
9761 echo " "
9762 $cat >isascii.c <<'EOCP'
9763 #include <stdio.h>
9764 #include <ctype.h>
9765 int main() {
9766         int c = 'A';
9767         if (isascii(c))
9768                 exit(0);
9769         else
9770                 exit(1);
9771 }
9772 EOCP
9773 set isascii
9774 if eval $compile; then
9775         echo "isascii() found." >&4
9776         val="$define"
9777 else
9778         echo "isascii() NOT found." >&4
9779         val="$undef"
9780 fi
9781 set d_isascii
9782 eval $setvar
9783 $rm -f isascii*
9784
9785 : see if isnan exists
9786 set isnan d_isnan
9787 eval $inlibc
9788
9789 : see if isnanl exists
9790 set isnanl d_isnanl
9791 eval $inlibc
9792
9793 : see if killpg exists
9794 set killpg d_killpg
9795 eval $inlibc
9796
9797 : see if lchown exists
9798 echo " "
9799 $cat > try.c <<'EOCP'
9800 /* System header to define __stub macros and hopefully few prototypes,
9801     which can conflict with char lchown(); below.  */
9802 #include <assert.h>
9803 /* Override any gcc2 internal prototype to avoid an error.  */
9804 /* We use char because int might match the return type of a gcc2
9805    builtin and then its argument prototype would still apply.  */
9806 char lchown();
9807 int main() {
9808     /*  The GNU C library defines this for functions which it implements
9809         to always fail with ENOSYS.  Some functions are actually named
9810         something starting with __ and the normal name is an alias.  */
9811 #if defined (__stub_lchown) || defined (__stub___lchown)
9812 choke me
9813 #else
9814 lchown();
9815 #endif
9816 ; return 0; }
9817 EOCP
9818 set try
9819 if eval $compile; then
9820     $echo "lchown() found." >&4
9821     val="$define"
9822 else
9823     $echo "lchown() NOT found." >&4
9824     val="$undef"
9825 fi
9826 set d_lchown
9827 eval $setvar
9828
9829 : See if number of significant digits in a double precision number is known
9830 echo " "
9831 $cat >ldbl_dig.c <<EOM
9832 #$i_limits I_LIMITS
9833 #$i_float I_FLOAT
9834 #ifdef I_LIMITS
9835 #include <limits.h>
9836 #endif
9837 #ifdef I_FLOAT
9838 #include <float.h>
9839 #endif
9840 #ifdef LDBL_DIG
9841 printf("Contains LDBL_DIG");
9842 #endif
9843 EOM
9844 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
9845 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
9846         echo "LDBL_DIG found." >&4
9847         val="$define"
9848 else
9849         echo "LDBL_DIG NOT found." >&4
9850         val="$undef"
9851 fi
9852 $rm -f ldbl_dig.?
9853 set d_ldbl_dig
9854 eval $setvar
9855
9856 : see if link exists
9857 set link d_link
9858 eval $inlibc
9859
9860 : see if localeconv exists
9861 set localeconv d_locconv
9862 eval $inlibc
9863
9864 : see if lockf exists
9865 set lockf d_lockf
9866 eval $inlibc
9867
9868 : check for long long
9869 echo " "
9870 echo "Checking to see if you have long long..." >&4
9871 echo 'int main() { long long x = 7; return 0; }' > try.c
9872 set try
9873 if eval $compile; then
9874         val="$define"
9875         echo "You have long long."
9876 else
9877         val="$undef"
9878         echo "You do not have long long."
9879 fi
9880 $rm try.*
9881 set d_longlong
9882 eval $setvar
9883
9884 : check for length of long long
9885 case "${d_longlong}${longlongsize}" in
9886 $define)
9887         echo " "
9888         echo "Checking to see how big your long longs are..." >&4
9889         $cat >try.c <<'EOCP'
9890 #include <stdio.h>
9891 int main()
9892 {
9893     printf("%d\n", (int)sizeof(long long));
9894     return(0);
9895 }
9896 EOCP
9897         set try
9898         if eval $compile_ok; then
9899                 longlongsize=`./try$exe_ext`
9900                 echo "Your long longs are $longlongsize bytes long."
9901         else
9902                 dflt='8'
9903                 echo " "
9904                 echo "(I can't seem to compile the test program.  Guessing...)"
9905                 rp="What is the size of a long long (in bytes)?"
9906                 . ./myread
9907                 longlongsize="$ans"
9908         fi
9909         if $test "X$longsize" = "X$longlongsize"; then
9910                 echo "(That isn't any different from an ordinary long.)"
9911         fi      
9912         ;;
9913 esac
9914 $rm -f try.* try
9915
9916 : see if prototype for lseek is available
9917 echo " "
9918 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
9919 eval $hasproto
9920
9921 : see if lstat exists
9922 set lstat d_lstat
9923 eval $inlibc
9924
9925 : see if madvise exists
9926 set madvise d_madvise
9927 eval $inlibc
9928
9929 : see if mblen exists
9930 set mblen d_mblen
9931 eval $inlibc
9932
9933 : see if mbstowcs exists
9934 set mbstowcs d_mbstowcs
9935 eval $inlibc
9936
9937 : see if mbtowc exists
9938 set mbtowc d_mbtowc
9939 eval $inlibc
9940
9941 : see if memchr exists
9942 set memchr d_memchr
9943 eval $inlibc
9944
9945 : see if memcmp exists
9946 set memcmp d_memcmp
9947 eval $inlibc
9948
9949 : see if memcpy exists
9950 set memcpy d_memcpy
9951 eval $inlibc
9952
9953 : see if memmove exists
9954 set memmove d_memmove
9955 eval $inlibc
9956
9957 : see if memset exists
9958 set memset d_memset
9959 eval $inlibc
9960
9961 : see if mkdir exists
9962 set mkdir d_mkdir
9963 eval $inlibc
9964
9965 : see if mkdtemp exists
9966 set mkdtemp d_mkdtemp
9967 eval $inlibc
9968
9969 : see if mkfifo exists
9970 set mkfifo d_mkfifo
9971 eval $inlibc
9972
9973 : see if mkstemp exists
9974 set mkstemp d_mkstemp
9975 eval $inlibc
9976
9977 : see if mkstemps exists
9978 set mkstemps d_mkstemps
9979 eval $inlibc
9980
9981 : see if mktime exists
9982 set mktime d_mktime
9983 eval $inlibc
9984
9985 : see if this is a sys/mman.h system
9986 set sys/mman.h i_sysmman
9987 eval $inhdr
9988
9989 : see if mmap exists
9990 set mmap d_mmap
9991 eval $inlibc
9992 : see what shmat returns
9993 : default to something harmless
9994 mmaptype='void *'
9995 case "$i_sysmman$d_mmap" in
9996 "$define$define")
9997         $cat >mmap.c <<'END'
9998 #include <sys/mman.h>
9999 void *mmap();
10000 END
10001         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
10002                 mmaptype='void *'
10003         else
10004                 mmaptype='caddr_t'
10005         fi
10006         echo "and it returns ($mmaptype)." >&4
10007         ;;
10008 esac
10009
10010
10011
10012 : see if modfl exists
10013 set modfl d_modfl
10014 eval $inlibc
10015
10016 : see if mprotect exists
10017 set mprotect d_mprotect
10018 eval $inlibc
10019
10020 : see if msgctl exists
10021 set msgctl d_msgctl
10022 eval $inlibc
10023
10024 : see if msgget exists
10025 set msgget d_msgget
10026 eval $inlibc
10027
10028 : see if msgsnd exists
10029 set msgsnd d_msgsnd
10030 eval $inlibc
10031
10032 : see if msgrcv exists
10033 set msgrcv d_msgrcv
10034 eval $inlibc
10035
10036 : see how much of the 'msg*(2)' library is present.
10037 h_msg=true
10038 echo " "
10039 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
10040 *"$undef"*) h_msg=false;;
10041 esac
10042 case "$osname" in
10043 freebsd)
10044     case "`ipcs 2>&1`" in
10045     "SVID messages"*"not configured"*)
10046         echo "Your $osname does not have the msg*(2) configured." >&4
10047         h_msg=false
10048         val="$undef"
10049         set msgctl d_msgctl
10050         eval $setvar
10051         set msgget d_msgget
10052         eval $setvar
10053         set msgsnd d_msgsnd
10054         eval $setvar
10055         set msgrcv d_msgrcv
10056         eval $setvar
10057         ;;
10058     esac
10059     ;;
10060 esac
10061 : we could also check for sys/ipc.h ...
10062 if $h_msg && $test `./findhdr sys/msg.h`; then
10063         echo "You have the full msg*(2) library." >&4
10064         val="$define"
10065 else
10066         echo "You don't have the full msg*(2) library." >&4
10067         val="$undef"
10068 fi
10069 set d_msg
10070 eval $setvar
10071
10072 : see if msync exists
10073 set msync d_msync
10074 eval $inlibc
10075
10076 : see if munmap exists
10077 set munmap d_munmap
10078 eval $inlibc
10079
10080 : see if nice exists
10081 set nice d_nice
10082 eval $inlibc
10083
10084
10085 echo " "
10086 echo "Checking which 64-bit integer type we could use..." >&4
10087
10088 case "$intsize" in
10089 8) val=int
10090    set quadtype
10091    eval $setvar
10092    val='"unsigned int"'
10093    set uquadtype
10094    eval $setvar
10095    quadkind=1
10096    ;;
10097 *) case "$longsize" in
10098    8) val=long
10099       set quadtype
10100       eval $setvar
10101       val='"unsigned long"'
10102       set uquadtype
10103       eval $setvar
10104       quadkind=2
10105       ;;
10106    *) case "$d_longlong:$longlongsize" in
10107       define:8)
10108         val='"long long"'
10109         set quadtype
10110         eval $setvar
10111         val='"unsigned long long"'
10112         set uquadtype
10113         eval $setvar
10114         quadkind=3
10115         ;;
10116       *) case "$d_int64_t" in
10117          define)
10118            val=int64_t
10119            set quadtype
10120            eval $setvar
10121            val=uint64_t
10122            set uquadtype
10123            eval $setvar
10124            quadkind=4
10125            ;;
10126          esac
10127          ;;
10128       esac
10129       ;;
10130    esac
10131    ;;
10132 esac
10133
10134 case "$quadtype" in
10135 '')     echo "Alas, no 64-bit integer types in sight." >&4
10136         d_quad="$undef"
10137         ;;
10138 *)      if test X"$use64bitint" = Xdefine -o X"$longsize" = X8; then
10139             verb="will"
10140         else
10141             verb="could"
10142         fi
10143         echo "We $verb use '$quadtype' for 64-bit integers." >&4
10144         d_quad="$define"
10145         ;;
10146 esac
10147
10148 : check for length of character
10149 echo " "
10150 case "$charsize" in
10151 '')
10152         echo "Checking to see how big your characters are (hey, you never know)..." >&4
10153         $cat >try.c <<'EOCP'
10154 #include <stdio.h>
10155 int main()
10156 {
10157     printf("%d\n", (int)sizeof(char));
10158     exit(0);
10159 }
10160 EOCP
10161         set try
10162         if eval $compile_ok; then
10163                 dflt=`./try`
10164         else
10165                 dflt='1'
10166                 echo "(I can't seem to compile the test program.  Guessing...)"
10167         fi
10168         ;;
10169 *)
10170         dflt="$charsize"
10171         ;;
10172 esac
10173 rp="What is the size of a character (in bytes)?"
10174 . ./myread
10175 charsize="$ans"
10176 $rm -f try.c try
10177
10178
10179 echo " "
10180 $echo "Choosing the C types to be used for Perl's internal types..." >&4
10181
10182 case "$use64bitint:$d_quad:$quadtype" in
10183 define:define:?*)
10184         ivtype="$quadtype"
10185         uvtype="$uquadtype"
10186         ivsize=8
10187         uvsize=8
10188         ;;
10189 *)      ivtype="long"
10190         uvtype="unsigned long"
10191         ivsize=$longsize
10192         uvsize=$longsize
10193         ;;
10194 esac
10195
10196 case "$uselongdouble:$d_longdbl" in
10197 define:define)
10198         nvtype="long double"
10199         nvsize=$longdblsize
10200         ;;
10201 *)      nvtype=double
10202         nvsize=$doublesize
10203         ;;
10204 esac
10205
10206 $echo "(IV will be "$ivtype", $ivsize bytes)"
10207 $echo "(UV will be "$uvtype", $uvsize bytes)"
10208 $echo "(NV will be "$nvtype", $nvsize bytes)"
10209
10210 $cat >try.c <<EOCP
10211 #$i_inttypes I_INTTYPES
10212 #ifdef I_INTTYPES
10213 #include <inttypes.h>
10214 #endif
10215 #include <stdio.h>
10216 int main() {
10217 #ifdef INT8
10218    int8_t i =  INT8_MAX;
10219   uint8_t u = UINT8_MAX;
10220   printf("int8_t\n");
10221 #endif
10222 #ifdef INT16
10223    int16_t i =  INT16_MAX;
10224   uint16_t i = UINT16_MAX;
10225   printf("int16_t\n");
10226 #endif
10227 #ifdef INT32
10228    int32_t i =  INT32_MAX;
10229   uint32_t u = UINT32_MAX;
10230   printf("int32_t\n");
10231 #endif
10232 }
10233 EOCP
10234
10235 case "$i8type" in
10236 '')     case "$charsize" in
10237         1)      i8type=char
10238                 u8type="unsigned char"
10239                 i8size=$charsize
10240                 u8size=$charsize
10241                 ;;
10242         esac
10243         ;;
10244 esac
10245 case "$i8type" in
10246 '')     set try -DINT8
10247         if eval $compile; then
10248                 case "`./try$exe_ext`" in
10249                 int8_t) i8type=int8_t
10250                         u8type=uint8_t
10251                         i8size=1
10252                         u8size=1
10253                         ;;
10254                 esac
10255         fi
10256         ;;
10257 esac
10258 case "$i8type" in
10259 '')     if $test $charsize -ge 1; then
10260                 i8type=char
10261                 u8type="unsigned char"
10262                 i8size=$charsize
10263                 u8size=$charsize
10264         fi
10265         ;;
10266 esac
10267
10268 case "$i16type" in
10269 '')     case "$shortsize" in
10270         2)      i16type=short
10271                 u16type="unsigned short"
10272                 i16size=$shortsize
10273                 u16size=$shortsize
10274                 ;;
10275         esac
10276         ;;
10277 esac
10278 case "$i16type" in
10279 '')     set try -DINT16
10280         if eval $compile; then
10281                 case "`./try$exe_ext`" in
10282                 int16_t)
10283                         i16type=int16_t
10284                         u16type=uint16_t
10285                         i16size=2
10286                         u16size=2
10287                         ;;
10288                 esac
10289         fi
10290         ;;
10291 esac
10292 case "$i16type" in
10293 '')     if $test $shortsize -ge 2; then
10294                 i16type=short
10295                 u16type="unsigned short"
10296                 i16size=$shortsize
10297                 u16size=$shortsize
10298         fi
10299         ;;
10300 esac
10301
10302 case "$i32type" in
10303 '')     case "$longsize" in
10304         4)      i32type=long
10305                 u32type="unsigned long"
10306                 i32size=$longsize
10307                 u32size=$longsize
10308                 ;;
10309         *)      case "$intsize" in
10310                 4)      i32type=int
10311                         u32type="unsigned int"
10312                         i32size=$intsize
10313                         u32size=$intsize
10314                         ;;
10315                 esac
10316                 ;;
10317         esac
10318         ;;
10319 esac
10320 case "$i32type" in
10321 '')     set try -DINT32
10322         if eval $compile; then
10323                 case "`./try$exe_ext`" in
10324                 int32_t)
10325                         i32type=int32_t
10326                         u32type=uint32_t
10327                         i32size=4
10328                         u32size=4
10329                         ;;
10330                 esac
10331         fi
10332         ;;
10333 esac
10334 case "$i32type" in
10335 '')     if $test $intsize -ge 4; then
10336                 i32type=int
10337                 u32type="unsigned int"
10338                 i32size=$intsize
10339                 u32size=$intsize
10340         fi
10341         ;;
10342 esac
10343
10344 case "$i64type" in
10345 '')     case "$d_quad:$quadtype" in
10346         define:?*)
10347                 i64type="$quadtype"
10348                 u64type="$uquadtype"
10349                 i64size=8
10350                 u64size=8
10351                 ;;
10352         esac
10353         ;;
10354 esac
10355
10356 $echo "Checking whether your NVs can preserve your UVs..." >&4
10357 $cat <<EOP >try.c
10358 #include <stdio.h>
10359 int main() {
10360     $uvtype k = ($uvtype)~0, l;
10361     $nvtype d;
10362     l = k;
10363     d = ($nvtype)l;
10364     l = ($uvtype)d;
10365     if (l == k)
10366        printf("preserve\n");
10367     exit(0);
10368 }
10369 EOP
10370 set try
10371 if eval $compile; then
10372         case "`./try$exe_ext`" in
10373         preserve) d_nv_preserves_uv="$define" ;;
10374         esac
10375 fi      
10376 case "$d_nv_preserves_uv" in
10377 $define) $echo "Yes, they can."  2>&1 ;;
10378 *)       $echo "No, they can't." 2>&1
10379          d_nv_preserves_uv="$undef"
10380          ;;
10381 esac
10382
10383 $rm -f try.* try
10384
10385 case "$d_nv_preserves_uv" in
10386 "$define") d_nv_preserves_uv_bits=`expr $uvsize \* 8` ;;
10387 *)      $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
10388         $cat <<EOP >try.c
10389 #include <stdio.h>
10390 int main() {
10391     $uvtype u = 0;
10392     int     n = 8 * $uvsize;
10393     int     i;
10394     for (i = 0; i < n; i++) {
10395       u = u << 1 | ($uvtype)1;
10396       if (($uvtype)($nvtype)u != u)
10397         break;
10398     }
10399     printf("%d\n", i);
10400     exit(0);
10401 }
10402 EOP
10403         set try
10404         if eval $compile; then
10405                 d_nv_preserves_uv_bits="`./try$exe_ext`"
10406         fi
10407         case "$d_nv_preserves_uv_bits" in
10408         [1-9]*) $echo "Your NVs can preserve $d_nv_preserves_uv_bits bits of your UVs."  2>&1 ;;
10409         *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
10410                 d_nv_preserves_uv_bits="$undef"
10411                 ;;
10412         esac
10413         $rm -f try.* try
10414         ;;
10415 esac
10416
10417
10418
10419 : check for off64_t
10420 echo " "
10421 echo "Checking to see if you have off64_t..." >&4
10422 $cat >try.c <<EOCP
10423 #include <sys/types.h>
10424 #include <unistd.h>
10425 int main() { off64_t x = 7; }
10426 EOCP
10427 set try
10428 if eval $compile; then
10429         val="$define"
10430         echo "You have off64_t."
10431 else
10432         val="$undef"
10433         echo "You do not have off64_t."
10434         case "$lseeksize" in
10435         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
10436         esac
10437 fi
10438 $rm -f try.* try
10439 set d_off64_t
10440 eval $setvar
10441
10442 : see if POSIX threads are available
10443 set pthread.h i_pthread
10444 eval $inhdr
10445
10446
10447
10448
10449 : how to create joinable pthreads
10450 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
10451         echo " "
10452         echo "Checking what constant to use for creating joinable pthreads..." >&4 
10453         $cat >try.c <<'EOCP'
10454 #include <pthread.h>
10455 int main() {
10456     int detachstate = JOINABLE;
10457 }
10458 EOCP
10459         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
10460         if eval $compile; then
10461                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
10462                 val="$undef" # Yes, undef.
10463                 set d_old_pthread_create_joinable
10464                 eval $setvar
10465                 val=""
10466                 set old_pthread_create_joinable
10467                 eval $setvar
10468         else
10469                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
10470                 if eval $compile; then
10471                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
10472                         val="$define"
10473                         set d_old_pthread_create_joinable
10474                         eval $setvar
10475                         val=PTHREAD_CREATE_UNDETACHED
10476                         set old_pthread_create_joinable
10477                         eval $setvar
10478                 else            
10479                         set try -DJOINABLE=__UNDETACHED
10480                         if eval $compile; then
10481                                 echo "You seem to use __UNDETACHED." >&4
10482                                 val="$define"
10483                                 set d_old_pthread_create_joinable
10484                                 eval $setvar
10485                                 val=__UNDETACHED
10486                                 set old_pthread_create_joinable
10487                                 eval $setvar
10488                         else
10489                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
10490                                 val="$define"
10491                                 set d_old_pthread_create_joinable
10492                                 eval $setvar
10493                                 val=0
10494                                 set old_pthread_create_joinable
10495                                 eval $setvar
10496                         fi
10497                 fi
10498         fi
10499         $rm -f try try.*
10500 else
10501     d_old_pthread_create_joinable="$undef"
10502     old_pthread_create_joinable=""
10503 fi
10504
10505 : see if pause exists
10506 set pause d_pause
10507 eval $inlibc
10508
10509 : see if pipe exists
10510 set pipe d_pipe
10511 eval $inlibc
10512
10513 : see if poll exists
10514 set poll d_poll
10515 eval $inlibc
10516
10517
10518 : see whether the various POSIXish _yields exist
10519 $cat >try.c <<EOP
10520 #include <pthread.h>
10521 #include <stdio.h>
10522 int main() {
10523 #ifdef SCHED_YIELD
10524         sched_yield();
10525 #else
10526 #ifdef PTHREAD_YIELD
10527         pthread_yield();
10528 #else
10529 #ifdef PTHREAD_YIELD_NULL
10530         pthread_yield(NULL);
10531 #endif
10532 #endif
10533 #endif
10534 }
10535 EOP
10536 : see if sched_yield exists
10537 set try -DSCHED_YIELD
10538 if eval $compile; then
10539     val="$define"
10540     sched_yield='sched_yield()'
10541 else
10542     val="$undef"
10543 fi
10544 case "$usethreads" in
10545 $define)
10546         case "$val" in
10547         $define) echo 'sched_yield() found.' >&4        ;;
10548         *)       echo 'sched_yield() NOT found.' >&4    ;;
10549         esac
10550 esac
10551 set d_sched_yield
10552 eval $setvar
10553
10554 : see if pthread_yield exists
10555 set try -DPTHREAD_YIELD
10556 if eval $compile; then
10557     val="$define"
10558     case "$sched_yield" in
10559     '') sched_yield='pthread_yield()' ;;
10560     esac
10561 else
10562     set try -DPTHREAD_YIELD_NULL
10563     if eval $compile; then
10564         val="$define"
10565         case "$sched_yield" in
10566         '') sched_yield='pthread_yield(NULL)' ;;
10567         esac
10568     else
10569         val="$undef"
10570     fi
10571 fi
10572 case "$usethreads" in
10573 $define)
10574         case "$val" in
10575         $define) echo 'pthread_yield() found.' >&4      ;;
10576         *)       echo 'pthread_yield() NOT found.' >&4  ;;
10577         esac
10578         ;;
10579 esac
10580 set d_pthread_yield
10581 eval $setvar
10582
10583 case "$sched_yield" in
10584 '') sched_yield=undef ;;
10585 esac
10586
10587 $rm -f try try.*
10588
10589 : see if this is a pwd.h system
10590 set pwd.h i_pwd
10591 eval $inhdr
10592
10593 case "$i_pwd" in
10594 $define)
10595         xxx=`./findhdr pwd.h`
10596         $cppstdin $cppflags $cppminus < $xxx >$$.h
10597
10598         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
10599                 val="$define"
10600         else
10601                 val="$undef"
10602         fi
10603         set d_pwquota
10604         eval $setvar
10605
10606         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
10607                 val="$define"
10608         else
10609                 val="$undef"
10610         fi
10611         set d_pwage
10612         eval $setvar
10613
10614         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
10615                 val="$define"
10616         else
10617                 val="$undef"
10618         fi
10619         set d_pwchange
10620         eval $setvar
10621
10622         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
10623                 val="$define"
10624         else
10625                 val="$undef"
10626         fi
10627         set d_pwclass
10628         eval $setvar
10629
10630         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
10631                 val="$define"
10632         else
10633                 val="$undef"
10634         fi
10635         set d_pwexpire
10636         eval $setvar
10637
10638         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
10639                 val="$define"
10640         else
10641                 val="$undef"
10642         fi
10643         set d_pwcomment
10644         eval $setvar
10645
10646         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
10647                 val="$define"
10648         else
10649                 val="$undef"
10650         fi
10651         set d_pwgecos
10652         eval $setvar
10653
10654         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
10655                 val="$define"
10656         else
10657                 val="$undef"
10658         fi
10659         set d_pwpasswd
10660         eval $setvar
10661
10662         $rm -f $$.h
10663         ;;
10664 *)
10665         val="$undef"; 
10666         set d_pwquota; eval $setvar
10667         set d_pwage; eval $setvar
10668         set d_pwchange; eval $setvar
10669         set d_pwclass; eval $setvar
10670         set d_pwexpire; eval $setvar
10671         set d_pwcomment; eval $setvar
10672         set d_pwgecos; eval $setvar
10673         set d_pwpasswd; eval $setvar
10674         ;;
10675 esac
10676
10677 : see if readdir and friends exist
10678 set readdir d_readdir
10679 eval $inlibc
10680 set seekdir d_seekdir
10681 eval $inlibc
10682 set telldir d_telldir
10683 eval $inlibc
10684 set rewinddir d_rewinddir
10685 eval $inlibc
10686
10687 : see if readlink exists
10688 set readlink d_readlink
10689 eval $inlibc
10690
10691 : see if rename exists
10692 set rename d_rename
10693 eval $inlibc
10694
10695 : see if rmdir exists
10696 set rmdir d_rmdir
10697 eval $inlibc
10698
10699 : see if memory.h is available.
10700 val=''
10701 set memory.h val
10702 eval $inhdr
10703
10704 : See if it conflicts with string.h
10705 case "$val" in
10706 $define)
10707         case "$strings" in
10708         '') ;;
10709         *)
10710                 $cppstdin $cppflags $cppminus < $strings > mem.h
10711                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
10712                         echo " "
10713                         echo "We won't be including <memory.h>."
10714                         val="$undef"
10715                 fi
10716                 $rm -f mem.h
10717                 ;;
10718         esac
10719 esac
10720 set i_memory
10721 eval $setvar
10722
10723 : can bcopy handle overlapping blocks?
10724 val="$undef"
10725 case "$d_bcopy" in
10726 "$define")
10727         echo " "
10728         echo "Checking to see if your bcopy() can do overlapping copies..." >&4
10729         $cat >try.c <<EOCP
10730 #$i_memory I_MEMORY
10731 #$i_stdlib I_STDLIB
10732 #$i_string I_STRING
10733 #$i_unistd I_UNISTD
10734 EOCP
10735         $cat >>try.c <<'EOCP'
10736 #include <stdio.h>
10737 #ifdef I_MEMORY
10738 #  include <memory.h>
10739 #endif
10740 #ifdef I_STDLIB
10741 #  include <stdlib.h>
10742 #endif
10743 #ifdef I_STRING
10744 #  include <string.h>
10745 #else
10746 #  include <strings.h>
10747 #endif
10748 #ifdef I_UNISTD
10749 #  include <unistd.h>  /* Needed for NetBSD */
10750 #endif
10751 int main()
10752 {
10753 char buf[128], abc[128];
10754 char *b;
10755 int len;
10756 int off;
10757 int align;
10758
10759 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
10760
10761 for (align = 7; align >= 0; align--) {
10762         for (len = 36; len; len--) {
10763                 b = buf+align;
10764                 bcopy(abc, b, len);
10765                 for (off = 1; off <= len; off++) {
10766                         bcopy(b, b+off, len);
10767                         bcopy(b+off, b, len);
10768                         if (bcmp(b, abc, len))
10769                                 exit(1);
10770                 }
10771         }
10772 }
10773 exit(0);
10774 }
10775 EOCP
10776         set try
10777         if eval $compile_ok; then
10778                 if ./try 2>/dev/null; then
10779                         echo "Yes, it can."
10780                         val="$define"
10781                 else
10782                         echo "It can't, sorry."
10783                         case "$d_memmove" in
10784                         "$define") echo "But that's Ok since you have memmove()." ;;
10785                         esac
10786                 fi
10787         else
10788                 echo "(I can't compile the test program, so we'll assume not...)"
10789                 case "$d_memmove" in
10790                 "$define") echo "But that's Ok since you have memmove()." ;;
10791                 esac
10792         fi
10793         ;;
10794 esac
10795 $rm -f try.* try core
10796 set d_safebcpy
10797 eval $setvar
10798
10799 : can memcpy handle overlapping blocks?
10800 val="$undef"
10801 case "$d_memcpy" in
10802 "$define")
10803         echo " "
10804         echo "Checking to see if your memcpy() can do overlapping copies..." >&4
10805         $cat >try.c <<EOCP
10806 #$i_memory I_MEMORY
10807 #$i_stdlib I_STDLIB
10808 #$i_string I_STRING
10809 #$i_unistd I_UNISTD
10810 EOCP
10811         $cat >>try.c <<'EOCP'
10812 #include <stdio.h>
10813 #ifdef I_MEMORY
10814 #  include <memory.h>
10815 #endif
10816 #ifdef I_STDLIB
10817 #  include <stdlib.h>
10818 #endif
10819 #ifdef I_STRING
10820 #  include <string.h>
10821 #else
10822 #  include <strings.h>
10823 #endif
10824 #ifdef I_UNISTD
10825 #  include <unistd.h>  /* Needed for NetBSD */
10826 #endif
10827 int main()
10828 {
10829 char buf[128], abc[128];
10830 char *b;
10831 int len;
10832 int off;
10833 int align;
10834
10835 /* Copy "abcde..." string to char abc[] so that gcc doesn't
10836    try to store the string in read-only memory. */
10837 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
10838
10839 for (align = 7; align >= 0; align--) {
10840         for (len = 36; len; len--) {
10841                 b = buf+align;
10842                 memcpy(b, abc, len);
10843                 for (off = 1; off <= len; off++) {
10844                         memcpy(b+off, b, len);
10845                         memcpy(b, b+off, len);
10846                         if (memcmp(b, abc, len))
10847                                 exit(1);
10848                 }
10849         }
10850 }
10851 exit(0);
10852 }
10853 EOCP
10854         set try
10855         if eval $compile_ok; then
10856                 if ./try 2>/dev/null; then
10857                         echo "Yes, it can."
10858                         val="$define"
10859                 else
10860                         echo "It can't, sorry."
10861                         case "$d_memmove" in
10862                         "$define") echo "But that's Ok since you have memmove()." ;;
10863                         esac
10864                 fi
10865         else
10866                 echo "(I can't compile the test program, so we'll assume not...)"
10867                 case "$d_memmove" in
10868                 "$define") echo "But that's Ok since you have memmove()." ;;
10869                 esac
10870         fi
10871         ;;
10872 esac
10873 $rm -f try.* try core
10874 set d_safemcpy
10875 eval $setvar
10876
10877 : can memcmp be trusted to compare relative magnitude?
10878 val="$undef"
10879 case "$d_memcmp" in
10880 "$define")
10881         echo " "
10882         echo "Checking if your memcmp() can compare relative magnitude..." >&4
10883         $cat >try.c <<EOCP
10884 #$i_memory I_MEMORY
10885 #$i_stdlib I_STDLIB
10886 #$i_string I_STRING
10887 #$i_unistd I_UNISTD
10888 EOCP
10889         $cat >>try.c <<'EOCP'
10890 #include <stdio.h>
10891 #ifdef I_MEMORY
10892 #  include <memory.h>
10893 #endif
10894 #ifdef I_STDLIB
10895 #  include <stdlib.h>
10896 #endif
10897 #ifdef I_STRING
10898 #  include <string.h>
10899 #else
10900 #  include <strings.h>
10901 #endif
10902 #ifdef I_UNISTD
10903 #  include <unistd.h>  /* Needed for NetBSD */
10904 #endif
10905 int main()
10906 {
10907 char a = -1;
10908 char b = 0;
10909 if ((a < b) && memcmp(&a, &b, 1) < 0)
10910         exit(1);
10911 exit(0);
10912 }
10913 EOCP
10914         set try
10915         if eval $compile_ok; then
10916                 if ./try 2>/dev/null; then
10917                         echo "Yes, it can."
10918                         val="$define"
10919                 else
10920                         echo "No, it can't (it uses signed chars)."
10921                 fi
10922         else
10923                 echo "(I can't compile the test program, so we'll assume not...)"
10924         fi
10925         ;;
10926 esac
10927 $rm -f try.* try core
10928 set d_sanemcmp
10929 eval $setvar
10930
10931 : see if select exists
10932 set select d_select
10933 eval $inlibc
10934
10935 : see if semctl exists
10936 set semctl d_semctl
10937 eval $inlibc
10938
10939 : see if semget exists
10940 set semget d_semget
10941 eval $inlibc
10942
10943 : see if semop exists
10944 set semop d_semop
10945 eval $inlibc
10946
10947 : see how much of the 'sem*(2)' library is present.
10948 h_sem=true
10949 echo " "
10950 case "$d_semctl$d_semget$d_semop" in
10951 *"$undef"*) h_sem=false;;
10952 esac
10953 case "$osname" in
10954 freebsd)
10955     case "`ipcs 2>&1`" in
10956     "SVID messages"*"not configured"*)
10957         echo "Your $osname does not have the sem*(2) configured." >&4
10958         h_sem=false
10959         val="$undef"
10960         set semctl d_semctl
10961         eval $setvar
10962         set semget d_semget
10963         eval $setvar
10964         set semop d_semop
10965         eval $setvar
10966         ;;
10967     esac
10968     ;;
10969 esac
10970 : we could also check for sys/ipc.h ...
10971 if $h_sem && $test `./findhdr sys/sem.h`; then
10972         echo "You have the full sem*(2) library." >&4
10973         val="$define"
10974 else
10975         echo "You don't have the full sem*(2) library." >&4
10976         val="$undef"
10977 fi
10978 set d_sem
10979 eval $setvar
10980
10981 : see whether sys/sem.h defines union semun
10982 echo " "
10983 $cat > try.c <<'END'
10984 #include <sys/types.h>
10985 #include <sys/ipc.h>
10986 #include <sys/sem.h>
10987 int main () { union semun semun; semun.buf = 0; }
10988 END
10989 set try
10990 if eval $compile; then
10991     echo "You have union semun in <sys/sem.h>." >&4
10992     val="$define"
10993 else
10994     echo "You do not have union semun in <sys/sem.h>." >&4
10995     val="$undef"
10996 fi
10997 $rm -f try try.c try.h
10998 set d_union_semun
10999 eval $setvar
11000
11001 : see how to do semctl IPC_STAT
11002 case "$d_sem" in
11003 $define)
11004     : see whether semctl IPC_STAT can use union semun
11005     echo " "
11006     $cat > try.h <<END
11007 #ifndef S_IRUSR
11008 #   ifdef S_IREAD
11009 #       define S_IRUSR S_IREAD
11010 #       define S_IWUSR S_IWRITE
11011 #       define S_IXUSR S_IEXEC
11012 #   else
11013 #       define S_IRUSR 0400
11014 #       define S_IWUSR 0200
11015 #       define S_IXUSR 0100
11016 #   endif
11017 #   define S_IRGRP (S_IRUSR>>3)
11018 #   define S_IWGRP (S_IWUSR>>3)
11019 #   define S_IXGRP (S_IXUSR>>3)
11020 #   define S_IROTH (S_IRUSR>>6)
11021 #   define S_IWOTH (S_IWUSR>>6)
11022 #   define S_IXOTH (S_IXUSR>>6)
11023 #endif
11024 #ifndef S_IRWXU
11025 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
11026 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
11027 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
11028 #endif
11029 END
11030
11031     $cat > try.c <<END
11032 #include <sys/types.h>
11033 #include <sys/ipc.h>
11034 #include <sys/sem.h>
11035 #include <sys/stat.h>
11036 #include <stdio.h>
11037 #include <errno.h>
11038 #include "try.h"
11039 #ifndef errno
11040 extern int errno;
11041 #endif
11042 #$d_union_semun HAS_UNION_SEMUN
11043 int main() {
11044     union semun
11045 #ifndef HAS_UNION_SEMUN
11046     {
11047         int val;
11048         struct semid_ds *buf;
11049         unsigned short *array;
11050     }
11051 #endif
11052     arg;
11053     int sem, st;
11054
11055 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
11056     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
11057     if (sem > -1) {
11058         struct semid_ds argbuf;
11059         arg.buf = &argbuf;
11060 #       ifdef IPC_STAT
11061         st = semctl(sem, 0, IPC_STAT, arg);
11062         if (st == 0)
11063             printf("semun\n");
11064         else
11065 #       endif /* IPC_STAT */
11066             printf("semctl IPC_STAT failed: errno = %d\n", errno);
11067 #       ifdef IPC_RMID
11068         if (semctl(sem, 0, IPC_RMID, arg) != 0)
11069 #       endif /* IPC_RMID */
11070             printf("semctl IPC_RMID failed: errno = %d\n", errno);
11071     } else
11072 #endif /* IPC_PRIVATE && ... */
11073         printf("semget failed: errno = %d\n", errno);
11074   return 0;
11075 }
11076 END
11077     val="$undef"
11078     set try
11079     if eval $compile; then
11080         xxx=`./try`
11081         case "$xxx" in
11082         semun) val="$define" ;;
11083         esac
11084     fi
11085     $rm -f try try.c
11086     set d_semctl_semun
11087     eval $setvar
11088     case "$d_semctl_semun" in
11089     $define)
11090         echo "You can use union semun for semctl IPC_STAT." >&4
11091         also='also'
11092         ;;
11093     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
11094         also=''
11095         ;;
11096     esac
11097
11098     : see whether semctl IPC_STAT can use struct semid_ds pointer
11099     $cat > try.c <<'END'
11100 #include <sys/types.h>
11101 #include <sys/ipc.h>
11102 #include <sys/sem.h>
11103 #include <sys/stat.h>
11104 #include "try.h"
11105 #include <stdio.h>
11106 #include <errno.h>
11107 #ifndef errno
11108 extern int errno;
11109 #endif
11110 int main() {
11111     struct semid_ds arg;
11112     int sem, st;
11113
11114 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
11115     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
11116     if (sem > -1) {
11117 #       ifdef IPC_STAT
11118         st = semctl(sem, 0, IPC_STAT, &arg);
11119         if (st == 0)
11120             printf("semid_ds\n");
11121         else
11122 #       endif /* IPC_STAT */
11123             printf("semctl IPC_STAT failed: errno = %d\n", errno);
11124 #       ifdef IPC_RMID
11125         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
11126 #       endif /* IPC_RMID */
11127             printf("semctl IPC_RMID failed: errno = %d\n", errno);
11128     } else
11129 #endif /* IPC_PRIVATE && ... */
11130         printf("semget failed: errno = %d\n", errno);
11131
11132     return 0;
11133 }
11134 END
11135     val="$undef"
11136     set try
11137     if eval $compile; then
11138         xxx=`./try`
11139         case "$xxx" in
11140         semid_ds) val="$define" ;;
11141         esac
11142     fi
11143     $rm -f try try.c
11144     set d_semctl_semid_ds
11145     eval $setvar
11146     case "$d_semctl_semid_ds" in
11147     $define)
11148         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
11149         ;;
11150     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
11151         ;;
11152     esac
11153     $rm -f try.h
11154     ;;
11155 *)  val="$undef"
11156
11157     # We do not have the full sem*(2) library, so assume we can not
11158     # use either.
11159
11160     set d_semctl_semun
11161     eval $setvar
11162
11163     set d_semctl_semid_ds
11164     eval $setvar
11165     ;;
11166 esac
11167
11168 : see if setegid exists
11169 set setegid d_setegid
11170 eval $inlibc
11171
11172 : see if seteuid exists
11173 set seteuid d_seteuid
11174 eval $inlibc
11175
11176 : see if setgrent exists
11177 set setgrent d_setgrent
11178 eval $inlibc
11179
11180 : see if sethostent exists
11181 set sethostent d_sethent
11182 eval $inlibc
11183
11184 : see if setlinebuf exists
11185 set setlinebuf d_setlinebuf
11186 eval $inlibc
11187
11188 : see if setlocale exists
11189 set setlocale d_setlocale
11190 eval $inlibc
11191
11192 : see if setnetent exists
11193 set setnetent d_setnent
11194 eval $inlibc
11195
11196 : see if setprotoent exists
11197 set setprotoent d_setpent
11198 eval $inlibc
11199
11200 : see if setpgid exists
11201 set setpgid d_setpgid
11202 eval $inlibc
11203
11204 : see if setpgrp2 exists
11205 set setpgrp2 d_setpgrp2
11206 eval $inlibc
11207
11208 : see if setpriority exists
11209 set setpriority d_setprior
11210 eval $inlibc
11211
11212 : see if setproctitle exists
11213 set setproctitle d_setproctitle
11214 eval $inlibc
11215
11216 : see if setpwent exists
11217 set setpwent d_setpwent
11218 eval $inlibc
11219
11220 : see if setregid exists
11221 set setregid d_setregid
11222 eval $inlibc
11223 set setresgid d_setresgid
11224 eval $inlibc
11225
11226 : see if setreuid exists
11227 set setreuid d_setreuid
11228 eval $inlibc
11229 set setresuid d_setresuid
11230 eval $inlibc
11231
11232 : see if setrgid exists
11233 set setrgid d_setrgid
11234 eval $inlibc
11235
11236 : see if setruid exists
11237 set setruid d_setruid
11238 eval $inlibc
11239
11240 : see if setservent exists
11241 set setservent d_setsent
11242 eval $inlibc
11243
11244 : see if setsid exists
11245 set setsid d_setsid
11246 eval $inlibc
11247
11248 : see if setvbuf exists
11249 set setvbuf d_setvbuf
11250 eval $inlibc
11251
11252 : see if sfio.h is available
11253 set sfio.h i_sfio
11254 eval $inhdr
11255
11256
11257 : see if sfio library is available
11258 case "$i_sfio" in
11259 $define)
11260         val=''
11261         set sfreserve val
11262         eval $inlibc
11263         ;;
11264 *)
11265         val="$undef"
11266         ;;
11267 esac
11268 : Ok, but do we want to use it.
11269 case "$val" in
11270 $define)
11271         case "$usesfio" in
11272         true|$define|[yY]*) dflt='y';;
11273         *) dflt='n';;
11274         esac
11275         echo "$package can use the sfio library, but it is experimental."
11276         case "$useperlio" in
11277         "$undef")
11278             echo "For sfio also the PerlIO abstraction layer is needed."
11279             echo "Earlier you said you wouldn't want that."
11280             ;;
11281         esac
11282         rp="You seem to have sfio available, do you want to try using it?"
11283         . ./myread
11284         case "$ans" in
11285         y|Y)    echo "Ok, turning on both sfio and PerlIO, then."
11286                 useperlio="$define"
11287                 val="$define"
11288                 ;;
11289         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
11290                 val="$undef"
11291                 : Remove sfio from list of libraries to use
11292                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
11293                 shift
11294                 libs="$*"
11295                 echo "libs = $libs" >&4
11296                 ;;
11297         esac
11298         ;;
11299 *)      case "$usesfio" in
11300         true|$define|[yY]*)
11301                 echo "Sorry, cannot find sfio on this machine." >&4
11302                 echo "Ignoring your setting of usesfio=$usesfio." >&4
11303                 val="$undef"
11304                 ;;
11305         esac
11306         ;;
11307 esac
11308 set d_sfio
11309 eval $setvar
11310 case "$d_sfio" in
11311 $define) usesfio='true';;
11312 *) usesfio='false';;
11313 esac
11314
11315 : see if shmctl exists
11316 set shmctl d_shmctl
11317 eval $inlibc
11318
11319 : see if shmget exists
11320 set shmget d_shmget
11321 eval $inlibc
11322
11323 : see if shmat exists
11324 set shmat d_shmat
11325 eval $inlibc
11326 : see what shmat returns
11327 case "$d_shmat" in
11328 "$define")
11329         $cat >shmat.c <<'END'
11330 #include <sys/shm.h>
11331 void *shmat();
11332 END
11333         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
11334                 shmattype='void *'
11335         else
11336                 shmattype='char *'
11337         fi
11338         echo "and it returns ($shmattype)." >&4
11339         : see if a prototype for shmat is available
11340         xxx=`./findhdr sys/shm.h`
11341         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
11342         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
11343                 val="$define"
11344         else
11345                 val="$undef"
11346         fi
11347         $rm -f shmat.[co]
11348         ;;
11349 *)
11350         val="$undef"
11351         ;;
11352 esac
11353 set d_shmatprototype
11354 eval $setvar
11355
11356 : see if shmdt exists
11357 set shmdt d_shmdt
11358 eval $inlibc
11359
11360 : see how much of the 'shm*(2)' library is present.
11361 h_shm=true
11362 echo " "
11363 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
11364 *"$undef"*) h_shm=false;;
11365 esac
11366 case "$osname" in
11367 freebsd)
11368     case "`ipcs 2>&1`" in
11369     "SVID shared memory"*"not configured"*)
11370         echo "Your $osname does not have the shm*(2) configured." >&4
11371         h_shm=false
11372         val="$undef"
11373         set shmctl d_shmctl
11374         evat $setvar
11375         set shmget d_shmget
11376         evat $setvar
11377         set shmat d_shmat
11378         evat $setvar
11379         set shmdt d_shmdt
11380         evat $setvar
11381         ;;
11382     esac
11383     ;;
11384 esac
11385 : we could also check for sys/ipc.h ...
11386 if $h_shm && $test `./findhdr sys/shm.h`; then
11387         echo "You have the full shm*(2) library." >&4
11388         val="$define"
11389 else
11390         echo "You don't have the full shm*(2) library." >&4
11391         val="$undef"
11392 fi
11393 set d_shm
11394 eval $setvar
11395
11396 echo " "
11397 : see if we have sigaction
11398 if set sigaction val -f d_sigaction; eval $csym; $val; then
11399         echo 'sigaction() found.' >&4
11400         $cat > try.c <<'EOP'
11401 #include <stdio.h>
11402 #include <sys/types.h>
11403 #include <signal.h>
11404 int main()
11405 {
11406     struct sigaction act, oact;
11407     act.sa_flags = 0;
11408     oact.sa_handler = 0;
11409     /* so that act and oact are used */
11410     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
11411 }
11412 EOP
11413         set try
11414         if eval $compile_ok; then
11415                 val="$define"
11416         else
11417                 echo "But you don't seem to have a useable struct sigaction." >&4
11418                 val="$undef"
11419         fi
11420 else
11421         echo 'sigaction NOT found.' >&4
11422         val="$undef"
11423 fi
11424 set d_sigaction; eval $setvar
11425 $rm -f try try$_o try.c
11426
11427 : see if sigsetjmp exists
11428 echo " "
11429 case "$d_sigsetjmp" in
11430 '')
11431         $cat >try.c <<'EOP'
11432 #include <setjmp.h>
11433 sigjmp_buf env;
11434 int set = 1;
11435 int main()
11436 {
11437         if (sigsetjmp(env,1))
11438                 exit(set);
11439         set = 0;
11440         siglongjmp(env, 1);
11441         exit(1);
11442 }
11443 EOP
11444         set try
11445         if eval $compile; then
11446                 if ./try >/dev/null 2>&1; then
11447                         echo "POSIX sigsetjmp found." >&4
11448                         val="$define"
11449                 else
11450                         $cat >&4 <<EOM
11451 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
11452 I'll ignore them.
11453 EOM
11454                         val="$undef"
11455                 fi
11456         else
11457                 echo "sigsetjmp not found." >&4
11458                 val="$undef"
11459         fi
11460         ;;
11461 *) val="$d_sigsetjmp"
11462         case "$d_sigsetjmp" in
11463         $define) echo "POSIX sigsetjmp found." >&4;;
11464         $undef) echo "sigsetjmp not found." >&4;;
11465         esac
11466         ;;
11467 esac
11468 set d_sigsetjmp
11469 eval $setvar
11470 $rm -f try.c try
11471
11472 : see if socks5_init exists
11473 set socks5_init d_socks5_init
11474 eval $inlibc
11475
11476 : see if sys/stat.h is available
11477 set sys/stat.h i_sysstat
11478 eval $inhdr
11479
11480
11481 : see if stat knows about block sizes
11482 echo " "
11483 echo "Checking to see if your struct stat has st_blocks field..." >&4
11484 set d_statblks stat st_blocks $i_sysstat sys/stat.h
11485 eval $hasfield
11486
11487
11488 : see if this is a sys/vfs.h system
11489 set sys/vfs.h i_sysvfs
11490 eval $inhdr
11491
11492
11493 : see if this is a sys/statfs.h system
11494 set sys/statfs.h i_sysstatfs
11495 eval $inhdr
11496
11497
11498 echo " "
11499 echo "Checking to see if your system supports struct statfs..." >&4
11500 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
11501 eval $hasstruct
11502 case "$d_statfs_s" in
11503 "$define")      echo "Yes, it does."   ;;
11504 *)              echo "No, it doesn't." ;;
11505 esac
11506
11507
11508
11509 : see if struct statfs knows about f_flags
11510 case "$d_statfs_s" in
11511 define) 
11512         echo " "
11513         echo "Checking to see if your struct statfs has f_flags field..." >&4
11514         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
11515         eval $hasfield
11516         ;;
11517 *)      val="$undef"
11518         set d_statfs_f_flags
11519         eval $setvar
11520         ;;
11521 esac
11522 case "$d_statfs_f_flags" in
11523 "$define")      echo "Yes, it does."   ;;
11524 *)              echo "No, it doesn't." ;;
11525 esac
11526
11527 : see if _ptr and _cnt from stdio act std
11528 echo " "
11529 if $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
11530         echo "(Looks like you have stdio.h from Linux.)"
11531         case "$stdio_ptr" in
11532         '') stdio_ptr='((fp)->_IO_read_ptr)'
11533                 ptr_lval=$define
11534                 ;;
11535         *)      ptr_lval=$d_stdio_ptr_lval;;
11536         esac
11537         case "$stdio_cnt" in
11538         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
11539                 cnt_lval=$undef
11540                 ;;
11541         *)      cnt_lval=$d_stdio_cnt_lval;;
11542         esac
11543         case "$stdio_base" in
11544         '') stdio_base='((fp)->_IO_read_base)';;
11545         esac
11546         case "$stdio_bufsiz" in
11547         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
11548         esac
11549 else
11550         case "$stdio_ptr" in
11551         '') stdio_ptr='((fp)->_ptr)'
11552                 ptr_lval=$define
11553                 ;;
11554         *)      ptr_lval=$d_stdio_ptr_lval;;
11555         esac
11556         case "$stdio_cnt" in
11557         '') stdio_cnt='((fp)->_cnt)'
11558                 cnt_lval=$define
11559                 ;;
11560         *)      cnt_lval=$d_stdio_cnt_lval;;
11561         esac
11562         case "$stdio_base" in
11563         '') stdio_base='((fp)->_base)';;
11564         esac
11565         case "$stdio_bufsiz" in
11566         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
11567         esac
11568 fi
11569 : test whether _ptr and _cnt really work
11570 echo "Checking how std your stdio is..." >&4
11571 $cat >try.c <<EOP
11572 #include <stdio.h>
11573 #define FILE_ptr(fp)    $stdio_ptr
11574 #define FILE_cnt(fp)    $stdio_cnt
11575 int main() {
11576         FILE *fp = fopen("try.c", "r");
11577         char c = getc(fp);
11578         if (
11579                 18 <= FILE_cnt(fp) &&
11580                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
11581         )
11582                 exit(0);
11583         exit(1);
11584 }
11585 EOP
11586 val="$undef"
11587 set try
11588 if eval $compile; then
11589         if ./try; then
11590                 echo "Your stdio acts pretty std."
11591                 val="$define"
11592         else
11593                 echo "Your stdio isn't very std."
11594         fi
11595 else
11596         echo "Your stdio doesn't appear very std."
11597 fi
11598 $rm -f try.c try
11599 set d_stdstdio
11600 eval $setvar
11601
11602 : Can _ptr be used as an lvalue?
11603 case "$d_stdstdio$ptr_lval" in
11604 $define$define) val=$define ;;
11605 *) val=$undef ;;
11606 esac
11607 set d_stdio_ptr_lval
11608 eval $setvar
11609
11610 : Can _cnt be used as an lvalue?
11611 case "$d_stdstdio$cnt_lval" in
11612 $define$define) val=$define ;;
11613 *) val=$undef ;;
11614 esac
11615 set d_stdio_cnt_lval
11616 eval $setvar
11617
11618 : see if _base is also standard
11619 val="$undef"
11620 case "$d_stdstdio" in
11621 $define)
11622         $cat >try.c <<EOP
11623 #include <stdio.h>
11624 #define FILE_base(fp)   $stdio_base
11625 #define FILE_bufsiz(fp) $stdio_bufsiz
11626 int main() {
11627         FILE *fp = fopen("try.c", "r");
11628         char c = getc(fp);
11629         if (
11630                 19 <= FILE_bufsiz(fp) &&
11631                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
11632         )
11633                 exit(0);
11634         exit(1);
11635 }
11636 EOP
11637         set try
11638         if eval $compile; then
11639                 if ./try; then
11640                         echo "And its _base field acts std."
11641                         val="$define"
11642                 else
11643                         echo "But its _base field isn't std."
11644                 fi
11645         else
11646                 echo "However, it seems to be lacking the _base field."
11647         fi
11648         $rm -f try.c try
11649         ;;
11650 esac
11651 set d_stdiobase
11652 eval $setvar
11653
11654 $cat >&4 <<EOM
11655 Checking how to access stdio streams by file descriptor number...
11656 EOM
11657 case "$stdio_stream_array" in
11658 '')     $cat >try.c <<EOCP
11659 #include <stdio.h>
11660 int main() {
11661   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
11662     printf("yes\n");
11663 }
11664 EOCP
11665         for s in _iob __iob __sF
11666         do
11667                 set try -DSTDIO_STREAM_ARRAY=$s
11668                 if eval $compile; then
11669                         case "`./try$exe_ext`" in
11670                         yes)    stdio_stream_array=$s; break ;;
11671                         esac
11672                 fi
11673         done
11674         $rm -f try.* try$exe_ext
11675 esac
11676 case "$stdio_stream_array" in
11677 '')     $cat >&4 <<EOM
11678 I can't figure out how to access stdio streams by file descriptor number.
11679 EOM
11680         d_stdio_stream_array="$undef"
11681         ;;
11682 *)      $cat >&4 <<EOM
11683 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
11684 EOM
11685         d_stdio_stream_array="$define"
11686         ;;
11687 esac
11688
11689 : see if strcoll exists
11690 set strcoll d_strcoll
11691 eval $inlibc
11692
11693 : check for structure copying
11694 echo " "
11695 echo "Checking to see if your C compiler can copy structs..." >&4
11696 $cat >try.c <<'EOCP'
11697 int main()
11698 {
11699         struct blurfl {
11700                 int dyick;
11701         } foo, bar;
11702
11703         foo = bar;
11704 }
11705 EOCP
11706 if $cc -c try.c >/dev/null 2>&1 ; then
11707         val="$define"
11708         echo "Yup, it can."
11709 else
11710         val="$undef"
11711         echo "Nope, it can't."
11712 fi
11713 set d_strctcpy
11714 eval $setvar
11715 $rm -f try.*
11716
11717 : see if strerror and/or sys_errlist[] exist
11718 echo " "
11719 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
11720     if set strerror val -f d_strerror; eval $csym; $val; then
11721                 echo 'strerror() found.' >&4
11722                 d_strerror="$define"
11723                 d_strerrm='strerror(e)'
11724                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
11725                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
11726                         d_syserrlst="$define"
11727                 else
11728                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
11729                         d_syserrlst="$undef"
11730                 fi
11731     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
11732                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
11733                 echo 'strerror() found in string header.' >&4
11734                 d_strerror="$define"
11735                 d_strerrm='strerror(e)'
11736                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
11737                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
11738                                 d_syserrlst="$define"
11739                 else
11740                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
11741                         d_syserrlst="$undef"
11742                 fi
11743     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
11744                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
11745                 d_strerror="$undef"
11746                 d_syserrlst="$define"
11747                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
11748     else
11749                 echo 'strerror() and sys_errlist[] NOT found.' >&4
11750                 d_strerror="$undef"
11751                 d_syserrlst="$undef"
11752                 d_strerrm='"unknown"'
11753     fi
11754 fi
11755
11756 : see if strtod exists
11757 set strtod d_strtod
11758 eval $inlibc
11759
11760 : see if strtol exists
11761 set strtol d_strtol
11762 eval $inlibc
11763
11764 : see if strtold exists
11765 set strtold d_strtold
11766 eval $inlibc
11767
11768 : see if strtoll exists
11769 set strtoll d_strtoll
11770 eval $inlibc
11771
11772 case "$d_longlong-$d_strtoll" in
11773 "$define-$define")
11774         $cat <<EOM
11775 Checking whether your strtoll() works okay...
11776 EOM
11777         $cat >try.c <<'EOCP'
11778 #include <errno.h>
11779 #ifdef __hpux
11780 #define strtoll __strtoll
11781 #endif
11782 #include <stdio.h>
11783 extern long long int strtoll(char *s, char **, int); 
11784 static int bad = 0;
11785 int check(char *s, long long ell, int een) {
11786         long long gll;
11787         errno = 0;
11788         gll = strtoll(s, 0, 10);
11789         if (!((gll == ell) && (errno == een)))
11790                 bad++;
11791 }
11792 int main() {
11793         check(" 1",                                      1LL, 0);
11794         check(" 0",                                      0LL, 0);
11795         check("-1",                                     -1LL, 0);
11796         check("-9223372036854775808", -9223372036854775808LL, 0);
11797         check("-9223372036854775808", -9223372036854775808LL, 0);
11798         check(" 9223372036854775807",  9223372036854775807LL, 0);
11799         check("-9223372036854775808", -9223372036854775808LL, 0);
11800         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
11801         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
11802         if (!bad)
11803                 printf("ok\n");
11804 }
11805 EOCP
11806         set try
11807         if eval $compile; then
11808                 case "`./try`" in
11809                 ok) echo "Your strtoll() seems to be working okay." ;;
11810                 *) cat <<EOM >&4
11811 Your strtoll() doesn't seem to be working okay.
11812 EOM
11813                    d_strtoll="$undef"
11814                    ;;
11815                 esac
11816         fi
11817         ;;
11818 esac
11819
11820 : see if strtoul exists
11821 set strtoul d_strtoul
11822 eval $inlibc
11823
11824 : see if strtoull exists
11825 set strtoull d_strtoull
11826 eval $inlibc
11827
11828 case "$d_longlong-$d_strtoull" in
11829 "$define-$define")
11830         $cat <<EOM
11831 Checking whether your strtoull() works okay...
11832 EOM
11833         $cat >try.c <<'EOCP'
11834 #include <errno.h>
11835 #ifdef __hpux
11836 #define strtoull __strtoull
11837 #endif
11838 #include <stdio.h>
11839 extern unsigned long long int strtoull(char *s, char **, int); 
11840 static int bad = 0;
11841 int check(char *s, long long eull, int een) {
11842         long long gull;
11843         errno = 0;
11844         gull = strtoull(s, 0, 10);
11845         if (!((gull == eull) && (errno == een)))
11846                 bad++;
11847 }
11848 int main() {
11849         check(" 1",                                       1LL, 0);
11850         check(" 0",                                       0LL, 0);
11851         check("18446744073709551615", 18446744073709551615ULL, 0);
11852         check("18446744073709551616", 18446744073709551615ULL, ERANGE);
11853         if (!bad)
11854                 printf("ok\n");
11855 }
11856 EOCP
11857         set try
11858         if eval $compile; then
11859                 case "`./try`" in
11860                 ok) echo "Your strtoull() seems to be working okay." ;;
11861                 *) cat <<EOM >&4
11862 Your strtoull() doesn't seem to be working okay.
11863 EOM
11864                    d_strtoull="$undef"
11865                    ;;
11866                 esac
11867         fi
11868         ;;
11869 esac
11870
11871 : see if strtouq exists
11872 set strtouq d_strtouq
11873 eval $inlibc
11874
11875 : see if strxfrm exists
11876 set strxfrm d_strxfrm
11877 eval $inlibc
11878
11879 : see if symlink exists
11880 set symlink d_symlink
11881 eval $inlibc
11882
11883 : see if syscall exists
11884 set syscall d_syscall
11885 eval $inlibc
11886
11887 : see if sysconf exists
11888 set sysconf d_sysconf
11889 eval $inlibc
11890
11891 : see if system exists
11892 set system d_system
11893 eval $inlibc
11894
11895 : see if tcgetpgrp exists
11896 set tcgetpgrp d_tcgetpgrp
11897 eval $inlibc
11898
11899 : see if tcsetpgrp exists
11900 set tcsetpgrp d_tcsetpgrp
11901 eval $inlibc
11902
11903 : see if prototype for telldir is available
11904 echo " "
11905 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
11906 eval $hasproto
11907
11908 : see if this is a sys/times.h system
11909 set sys/times.h i_systimes
11910 eval $inhdr
11911
11912 : see if times exists
11913 echo " "
11914 if set times val -f d_times; eval $csym; $val; then
11915         echo 'times() found.' >&4
11916         d_times="$define"
11917         inc=''
11918         case "$i_systimes" in
11919         "$define") inc='sys/times.h';;
11920         esac
11921         rp="What is the type returned by times() on this system?"
11922         set clock_t clocktype long stdio.h sys/types.h $inc
11923         eval $typedef_ask
11924 else
11925         echo 'times() NOT found, hope that will do.' >&4
11926         d_times="$undef"
11927         clocktype='int'
11928 fi
11929
11930 : see if truncate exists
11931 set truncate d_truncate
11932 eval $inlibc
11933
11934 : see if tzname[] exists
11935 echo " "
11936 if set tzname val -a d_tzname; eval $csym; $val; then
11937         val="$define"
11938         echo 'tzname[] found.' >&4
11939 else
11940         val="$undef"
11941         echo 'tzname[] NOT found.' >&4
11942 fi
11943 set d_tzname
11944 eval $setvar
11945
11946 : see if umask exists
11947 set umask d_umask
11948 eval $inlibc
11949
11950 : see if ustat exists
11951 set ustat d_ustat
11952 eval $inlibc
11953
11954 : backward compatibility for d_hvfork
11955 if test X$d_hvfork != X; then
11956         d_vfork="$d_hvfork"
11957         d_hvfork=''
11958 fi
11959 : see if there is a vfork
11960 val=''
11961 set vfork val
11962 eval $inlibc
11963
11964 : Ok, but do we want to use it. vfork is reportedly unreliable in 
11965 : perl on Solaris 2.x, and probably elsewhere.
11966 case "$val" in
11967 $define)
11968         echo " "
11969         case "$usevfork" in
11970         false) dflt='n';;
11971         *) dflt='y';;
11972         esac
11973         cat <<'EOM'
11974  
11975 Perl can only use a vfork() that doesn't suffer from strict
11976 restrictions on calling functions or modifying global data in
11977 the child.  For example, glibc-2.1 contains such a vfork()
11978 that is unsuitable.  If your system provides a proper fork()
11979 call, chances are that you do NOT want perl to use vfork().
11980
11981 EOM
11982         rp="Do you still want to use vfork()?"
11983         . ./myread
11984         case "$ans" in
11985         y|Y) ;;
11986         *)
11987                 echo "Ok, we won't use vfork()."
11988                 val="$undef"
11989                 ;;
11990         esac
11991         ;;
11992 esac
11993 set d_vfork
11994 eval $setvar
11995 case "$d_vfork" in
11996 $define) usevfork='true';;
11997 *) usevfork='false';;
11998 esac
11999
12000 : see if this is an sysdir system
12001 set sys/dir.h i_sysdir
12002 eval $inhdr
12003
12004 : see if this is an sysndir system
12005 set sys/ndir.h i_sysndir
12006 eval $inhdr
12007
12008 : see if closedir exists
12009 set closedir d_closedir
12010 eval $inlibc
12011
12012 case "$d_closedir" in
12013 "$define")
12014         echo " "
12015         echo "Checking whether closedir() returns a status..." >&4
12016         cat > closedir.c <<EOM
12017 #$i_dirent I_DIRENT             /**/
12018 #$i_sysdir I_SYS_DIR            /**/
12019 #$i_sysndir I_SYS_NDIR          /**/
12020 #$i_systypes I_SYS_TYPES        /**/
12021
12022 #if defined(I_SYS_TYPES)
12023 #include <sys/types.h>
12024 #endif
12025 #if defined(I_DIRENT)
12026 #include <dirent.h>
12027 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
12028 #include <sys/dir.h>
12029 #endif
12030 #else
12031 #ifdef I_SYS_NDIR
12032 #include <sys/ndir.h>
12033 #else
12034 #ifdef I_SYS_DIR
12035 #ifdef hp9000s500
12036 #include <ndir.h>       /* may be wrong in the future */
12037 #else
12038 #include <sys/dir.h>
12039 #endif
12040 #endif
12041 #endif
12042 #endif 
12043 int main() { return closedir(opendir(".")); }
12044 EOM
12045         set closedir
12046         if eval $compile_ok; then
12047                 if ./closedir > /dev/null 2>&1 ; then
12048                         echo "Yes, it does."
12049                         val="$undef"
12050                 else
12051                         echo "No, it doesn't."
12052                         val="$define"
12053                 fi
12054         else
12055                 echo "(I can't seem to compile the test program--assuming it doesn't)"
12056                 val="$define"
12057         fi
12058         ;;
12059 *)
12060         val="$undef";
12061         ;;
12062 esac
12063 set d_void_closedir
12064 eval $setvar
12065 $rm -f closedir*
12066 : check for volatile keyword
12067 echo " "
12068 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
12069 $cat >try.c <<'EOCP'
12070 int main()
12071 {
12072         typedef struct _goo_struct goo_struct;
12073         goo_struct * volatile goo = ((goo_struct *)0);
12074         struct _goo_struct {
12075                 long long_int;
12076                 int reg_int;
12077                 char char_var;
12078         };
12079         typedef unsigned short foo_t;
12080         char *volatile foo;
12081         volatile int bar;
12082         volatile foo_t blech;
12083         foo = foo;
12084 }
12085 EOCP
12086 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
12087         val="$define"
12088         echo "Yup, it does."
12089 else
12090         val="$undef"
12091         echo "Nope, it doesn't."
12092 fi
12093 set d_volatile
12094 eval $setvar
12095 $rm -f try.*
12096
12097 : see if there is a wait4
12098 set wait4 d_wait4
12099 eval $inlibc
12100
12101 : see if waitpid exists
12102 set waitpid d_waitpid
12103 eval $inlibc
12104
12105 : see if wcstombs exists
12106 set wcstombs d_wcstombs
12107 eval $inlibc
12108
12109 : see if wctomb exists
12110 set wctomb d_wctomb
12111 eval $inlibc
12112
12113 : preserve RCS keywords in files with variable substitution, grrr
12114 Date='$Date'
12115 Id='$Id'
12116 Log='$Log'
12117 RCSfile='$RCSfile'
12118 Revision='$Revision'
12119
12120 case "$crosscompile" in
12121 ''|[nN]*) crosscompile="$undef" ;;
12122 esac
12123
12124 case "$osname" in
12125 next|rhapsody|darwin) multiarch="$define" ;;
12126 esac
12127 case "$multiarch" in
12128 ''|[nN]*) multiarch="$undef" ;;
12129 esac
12130
12131 : check for alignment requirements
12132 echo " "
12133 case "$crosscompile$multiarch" in
12134 *$define*)
12135         $cat <<EOM
12136 You seem to be either cross-compiling or doing a multiarchitecture build,
12137 skipping the memory alignment check.
12138
12139 EOM
12140         case "$alignbytes" in
12141         '') alignbytes=8 ;;
12142         esac
12143         ;;
12144 *)
12145         case "$alignbytes" in
12146         '') echo "Checking alignment constraints..." >&4
12147                 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
12148                         $cat >try.c <<'EOCP'
12149 typedef long double NV;
12150 EOCP
12151                 else
12152                         $cat >try.c <<'EOCP'
12153 typedef double NV;
12154 EOCP
12155                 fi
12156                 $cat >>try.c <<'EOCP'
12157 #include <stdio.h>
12158 struct foobar {
12159         char foo;
12160         NV bar;
12161 } try_algn;
12162 int main()
12163 {
12164     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
12165     return(0);
12166 }
12167 EOCP
12168                 set try
12169                 if eval $compile_ok; then
12170                         dflt=`./try`
12171                 else
12172                         dflt='8'
12173                         echo "(I can't seem to compile the test program...)"
12174                 fi
12175                 ;;
12176         *) dflt="$alignbytes"
12177                 ;;
12178         esac
12179         rp="Doubles must be aligned on a how-many-byte boundary?"
12180         . ./myread
12181         alignbytes="$ans"
12182         $rm -f try.c try
12183         ;;
12184 esac
12185
12186
12187 : set the base revision
12188 baserev=5.0
12189
12190 : check for ordering of bytes in a long
12191 echo " "
12192 case "$crosscompile$multiarch" in
12193 *$define*)
12194         $cat <<EOM
12195 You seem to be either cross-compiling or doing a multiarchitecture build,
12196 skipping the byteorder check.
12197
12198 EOM
12199         byteorder='0xffff'
12200         ;;
12201 *)
12202         case "$byteorder" in
12203         '')
12204                 $cat <<'EOM'
12205 In the following, larger digits indicate more significance.  A big-endian
12206 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
12207 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
12208 machines may have weird orders like 3412.  A Cray will report 87654321,
12209 an Alpha will report 12345678. If the test program works the default is
12210 probably right.
12211 I'm now running the test program...
12212 EOM
12213                 $cat >try.c <<'EOCP'
12214 #include <stdio.h>
12215 int main()
12216 {
12217         int i;
12218         union {
12219                 unsigned long l;
12220                 char c[sizeof(long)];
12221         } u;
12222
12223         if (sizeof(long) > 4)
12224                 u.l = (0x08070605L << 32) | 0x04030201L;
12225         else
12226                 u.l = 0x04030201L;
12227         for (i = 0; i < sizeof(long); i++)
12228                 printf("%c", u.c[i]+'0');
12229         printf("\n");
12230         exit(0);
12231 }
12232 EOCP
12233                 xxx_prompt=y
12234                 set try
12235                 if eval $compile && ./try > /dev/null; then
12236                         dflt=`./try`
12237                         case "$dflt" in
12238                         [1-4][1-4][1-4][1-4]|12345678|87654321)
12239                                 echo "(The test program ran ok.)"
12240                                 echo "byteorder=$dflt"
12241                                 xxx_prompt=n
12242                         ;;
12243                         ????|????????) echo "(The test program ran ok.)" ;;
12244                         *) echo "(The test program didn't run right for some reason.)" ;;
12245                         esac
12246                 else
12247                         dflt='4321'
12248                         cat <<'EOM'
12249 (I can't seem to compile the test program.  Guessing big-endian...)
12250 EOM
12251                 fi
12252                 case "$xxx_prompt" in
12253                 y)
12254                         rp="What is the order of bytes in a long?"
12255                         . ./myread
12256                         byteorder="$ans"
12257                         ;;
12258                 *)      byteorder=$dflt
12259                         ;;
12260                 esac
12261                 ;;
12262         esac
12263         $rm -f try.c try
12264         ;;
12265 esac
12266
12267
12268 : how do we catenate cpp tokens here?
12269 echo " "
12270 echo "Checking to see how your cpp does stuff like catenate tokens..." >&4
12271 $cat >cpp_stuff.c <<'EOCP'
12272 #define RCAT(a,b)a/**/b
12273 #define ACAT(a,b)a ## b
12274 RCAT(Rei,ser)
12275 ACAT(Cir,cus)
12276 EOCP
12277 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
12278 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
12279         echo "Oh!  Smells like ANSI's been here." >&4
12280         echo "We can catify or stringify, separately or together!"
12281         cpp_stuff=42
12282 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
12283         echo "Ah, yes!  The good old days!" >&4
12284         echo "However, in the good old days we don't know how to stringify and"
12285         echo "catify at the same time."
12286         cpp_stuff=1
12287 else
12288         $cat >&4 <<EOM
12289 Hmm, I don't seem to be able to catenate tokens with your cpp.  You're going
12290 to have to edit the values of CAT[2-5] in config.h...
12291 EOM
12292         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
12293 fi
12294 $rm -f cpp_stuff.*
12295
12296 : see if this is a db.h system
12297 set db.h i_db
12298 eval $inhdr
12299
12300 case "$i_db" in
12301 $define)
12302         : Check db version.
12303         echo " "
12304         echo "Checking Berkeley DB version ..." >&4
12305         $cat >try.c <<EOCP
12306 #$d_const HASCONST
12307 #ifndef HASCONST
12308 #define const
12309 #endif
12310 #include <sys/types.h>
12311 #include <stdio.h>
12312 #include <db.h>
12313 int main()
12314 {
12315 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
12316     int Major, Minor, Patch ;
12317     unsigned long Version ;
12318     (void)db_version(&Major, &Minor, &Patch) ;
12319     printf("You have Berkeley DB Version 2 or greater\n");
12320
12321     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
12322                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
12323     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
12324                 Major, Minor, Patch) ;
12325
12326     /* check that db.h & libdb are compatible */
12327     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
12328         printf("db.h and libdb are incompatible\n") ;
12329         exit(3);        
12330     }
12331
12332     printf("db.h and libdb are compatible\n") ;
12333
12334     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
12335                 + DB_VERSION_PATCH ;
12336
12337     /* needs to be >= 2.3.4 */
12338     if (Version < 2003004) {
12339     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
12340         printf("but Perl needs Berkeley DB 2.3.4 or greater\n") ;
12341         exit(2);        
12342     }
12343
12344     exit(0);
12345 #else
12346 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
12347     printf("You have Berkeley DB Version 1\n");
12348     exit(0);    /* DB version < 2: the coast is clear. */
12349 #else
12350     exit(1);    /* <db.h> not Berkeley DB? */
12351 #endif
12352 #endif
12353 }
12354 EOCP
12355         set try
12356         if eval $compile_ok && ./try; then
12357                 echo 'Looks OK.' >&4
12358         else
12359                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
12360                 i_db=$undef
12361                 case " $libs " in
12362                 *"-ldb "*)
12363                         : Remove db from list of libraries to use
12364                         echo "Removing unusable -ldb from library list" >&4
12365                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
12366                         shift
12367                         libs="$*"
12368                         echo "libs = $libs" >&4
12369                         ;;
12370                 esac
12371         fi
12372         $rm -f try.*
12373         ;;
12374 esac
12375
12376 case "$i_db" in
12377 define)
12378         : Check the return type needed for hash 
12379         echo " "
12380         echo "Checking return type needed for hash for Berkeley DB ..." >&4
12381         $cat >try.c <<EOCP
12382 #$d_const HASCONST
12383 #ifndef HASCONST
12384 #define const
12385 #endif
12386 #include <sys/types.h>
12387 #include <db.h>
12388
12389 #ifndef DB_VERSION_MAJOR
12390 u_int32_t hash_cb (ptr, size)
12391 const void *ptr;
12392 size_t size;
12393 {
12394 }
12395 HASHINFO info;
12396 int main()
12397 {
12398         info.hash = hash_cb;
12399 }
12400 #endif
12401 EOCP
12402         if $cc $ccflags -c try.c >try.out 2>&1 ; then
12403                 if $contains warning try.out >>/dev/null 2>&1 ; then
12404                         db_hashtype='int'
12405                 else
12406                         db_hashtype='u_int32_t'
12407                 fi
12408         else
12409                 : XXX Maybe we should just give up here.
12410                 db_hashtype=u_int32_t
12411                 $cat try.out >&4
12412                 echo "Help:  I can't seem to compile the db test program." >&4
12413                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
12414         fi
12415         $rm -f try.*
12416         echo "Your version of Berkeley DB uses $db_hashtype for hash."
12417         ;;
12418 *)      db_hashtype=u_int32_t
12419         ;;
12420 esac
12421 case "$i_db" in
12422 define)
12423         : Check the return type needed for prefix 
12424         echo " "
12425         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
12426         cat >try.c <<EOCP
12427 #$d_const HASCONST
12428 #ifndef HASCONST
12429 #define const
12430 #endif
12431 #include <sys/types.h>
12432 #include <db.h>
12433
12434 #ifndef DB_VERSION_MAJOR
12435 size_t prefix_cb (key1, key2)
12436 const DBT *key1;
12437 const DBT *key2;
12438 {
12439 }
12440 BTREEINFO info;
12441 int main()
12442 {
12443         info.prefix = prefix_cb;
12444 }
12445 #endif
12446 EOCP
12447         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
12448                 if $contains warning try.out >>/dev/null 2>&1 ; then
12449                         db_prefixtype='int'
12450                 else
12451                         db_prefixtype='size_t'
12452                 fi
12453         else
12454                 db_prefixtype='size_t'
12455                 : XXX Maybe we should just give up here.
12456                 $cat try.out >&4
12457                 echo "Help:  I can't seem to compile the db test program." >&4
12458                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
12459         fi
12460         $rm -f try.*
12461         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
12462         ;;
12463 *)      db_prefixtype='size_t'
12464         ;;
12465 esac
12466
12467 : check for void type
12468 echo " "
12469 echo "Checking to see how well your C compiler groks the void type..." >&4
12470 case "$voidflags" in
12471 '')
12472         $cat >try.c <<'EOCP'
12473 #if TRY & 1
12474 void sub() {
12475 #else
12476 sub() {
12477 #endif
12478         extern void moo();      /* function returning void */
12479         void (*goo)();          /* ptr to func returning void */
12480 #if TRY & 8
12481         void *hue;              /* generic ptr */
12482 #endif
12483 #if TRY & 2
12484         void (*foo[10])();
12485 #endif
12486
12487 #if TRY & 4
12488         if(goo == moo) {
12489                 exit(0);
12490         }
12491 #endif
12492         exit(0);
12493 }
12494 int main() { sub(); }
12495 EOCP
12496         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
12497                 voidflags=$defvoidused
12498         echo "Good.  It appears to support void to the level $package wants.">&4
12499                 if $contains warning .out >/dev/null 2>&1; then
12500                         echo "However, you might get some warnings that look like this:"
12501                         $cat .out
12502                 fi
12503         else
12504 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
12505                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
12506                         echo "It supports 1..."
12507                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
12508                                 echo "It also supports 2..."
12509                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
12510                                         voidflags=7
12511                                         echo "And it supports 4 but not 8 definitely."
12512                                 else
12513                                         echo "It doesn't support 4..."
12514                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
12515                                                 voidflags=11
12516                                                 echo "But it supports 8."
12517                                         else
12518                                                 voidflags=3
12519                                                 echo "Neither does it support 8."
12520                                         fi
12521                                 fi
12522                         else
12523                                 echo "It does not support 2..."
12524                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
12525                                         voidflags=13
12526                                         echo "But it supports 4 and 8."
12527                                 else
12528                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
12529                                                 voidflags=5
12530                                                 echo "And it supports 4 but has not heard about 8."
12531                                         else
12532                                                 echo "However it supports 8 but not 4."
12533                                         fi
12534                                 fi
12535                         fi
12536                 else
12537                         echo "There is no support at all for void."
12538                         voidflags=0
12539                 fi
12540         fi
12541 esac
12542 case "$voidflags" in
12543 "$defvoidused") ;;
12544 *)      $cat >&4 <<'EOM'
12545   Support flag bits are:
12546     1: basic void declarations.
12547     2: arrays of pointers to functions returning void.
12548     4: operations between pointers to and addresses of void functions.
12549     8: generic void pointers.
12550 EOM
12551         dflt="$voidflags";
12552         rp="Your void support flags add up to what?"
12553         . ./myread
12554         voidflags="$ans"
12555         ;;
12556 esac
12557 $rm -f try.* .out
12558
12559
12560 : How can we generate normalized random numbers ?
12561 echo " "
12562 echo "Looking for a random number function..." >&4
12563 case "$randfunc" in
12564 '')
12565         if set drand48 val -f; eval $csym; $val; then
12566                 dflt="drand48"
12567                 echo "Good, found drand48()." >&4
12568         elif set random val -f; eval $csym; $val; then
12569                 dflt="random"
12570                 echo "OK, found random()." >&4
12571         else
12572                 dflt="rand"
12573                 echo "Yick, looks like I have to use rand()." >&4
12574         fi
12575         echo " "
12576         ;;
12577 *)
12578         dflt="$randfunc"
12579         ;;
12580 esac
12581 cont=true
12582
12583 case "$ccflags" in
12584 *-Dmy_rand=*|*-Dmy_srand=*)
12585         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
12586         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
12587         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
12588         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
12589         ;;
12590 esac
12591
12592 while $test "$cont"; do
12593         rp="Use which function to generate random numbers?"
12594         . ./myread
12595         if $test "$ans" = "$dflt"; then
12596                 : null
12597         else
12598                 randbits=''
12599         fi
12600         randfunc="$ans"
12601         if set $ans val -f; eval $csym; $val; then
12602                 cont=''
12603         else
12604                 dflt=y
12605                 rp="I cannot find function $ans. Use that name anyway?"
12606                 . ./myread
12607                 dflt=rand
12608                 case "$ans" in
12609                         [yY]*) cont='';;
12610                 esac
12611         fi
12612         case "$cont" in
12613         '')
12614                 case "$randfunc" in
12615                 drand48)
12616                         drand01="drand48()"
12617                         seedfunc="srand48"
12618                         randbits=48
12619                         randseedtype=long
12620                         ;;
12621                 rand|random)
12622                         case "$randbits" in
12623                         '')
12624 echo "Checking to see how many bits your $randfunc() function produces..." >&4
12625                                 $cat >try.c <<EOCP
12626 #$i_unistd I_UNISTD
12627 #$i_stdlib I_STDLIB
12628 #include <stdio.h>
12629 #ifdef I_UNISTD
12630 #  include <unistd.h>
12631 #endif
12632 #ifdef I_STDLIB
12633 #  include <stdlib.h>
12634 #endif
12635 int main()
12636 {
12637         register int i;
12638         register unsigned long tmp;
12639         register unsigned long max = 0L;
12640
12641         for (i = 1000; i; i--) {
12642                 tmp = (unsigned long) $randfunc();
12643                 if (tmp > max) max = tmp;
12644         }
12645         for (i = 0; max; i++)
12646                 max /= 2;
12647         printf("%d\n",i);
12648 }
12649 EOCP
12650                                 set try
12651                                 if eval $compile_ok; then
12652                                         dflt=`try`
12653                                 else
12654                                         dflt='?'
12655                                         echo "(I can't seem to compile the test program...)"
12656                                 fi
12657                                 ;;
12658                         *)
12659                                 dflt="$randbits"
12660                                 ;;
12661                         esac
12662                         rp="How many bits does your $randfunc() function produce?"
12663                         . ./myread
12664                         randbits="$ans"
12665                         $rm -f try.c try
12666                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
12667                         seedfunc="s$randfunc"
12668                         randseedtype=unsigned
12669                         ;;
12670                 *)
12671                         dflt="31"
12672                         rp="How many bits does your $randfunc() function produce?"
12673                         . ./myread
12674                         randbits="$ans"
12675                         seedfunc="s$randfunc"
12676                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
12677                         if set $seedfunc val -f; eval $csym; $val; then
12678                                 echo "(Using $seedfunc() to seed random generator)"
12679                         else
12680                                 echo "(Warning: no $seedfunc() to seed random generator)"
12681                                 seedfunc=rand
12682                         fi
12683                         randseedtype=unsigned
12684                         ;;
12685                 esac
12686                 ;;
12687         esac
12688 done
12689
12690 echo " "
12691 echo "Determining whether or not we are on an EBCDIC system..." >&4
12692 $cat >tebcdic.c <<'EOM'
12693 int main()
12694 {
12695   if ('M'==0xd4) return 0;
12696   return 1;
12697 }
12698 EOM
12699
12700 val=$undef
12701 set tebcdic
12702 if eval $compile_ok; then
12703         if ./tebcdic; then
12704                 echo "You have EBCDIC." >&4
12705                 val="$define"
12706         else
12707                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin." >&4
12708         fi
12709 else
12710         echo "I'm unable to compile the test program." >&4
12711         echo "I'll assume ASCII or some ISO Latin." >&4
12712 fi
12713 $rm -f tebcdic.c tebcdic
12714 set ebcdic
12715 eval $setvar
12716
12717 echo " "
12718 $cat >&4 <<EOM
12719 Checking how to flush all pending stdio output...
12720 EOM
12721 # I only know how to find the first 32 possibly open files on SunOS.
12722 # See also hints/sunos_4_1.sh and util.c  --AD
12723 case "$osname" in
12724 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
12725 esac
12726 $cat >>try.c <<EOCP
12727 #include <stdio.h>
12728 #$i_unistd I_UNISTD
12729 #ifdef I_UNISTD
12730 # include <unistd.h>
12731 #endif
12732 #$d_sysconf HAS_SYSCONF
12733 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
12734 #ifdef HAS_STDIO_STREAM_ARRAY
12735 # define STDIO_STREAM_ARRAY $stdio_stream_array
12736 #endif
12737 int main() {
12738   FILE* p = fopen("try.out", "w");
12739 #ifdef TRY_FPUTC
12740   fputc('x', p);
12741 #else
12742 # ifdef TRY_FPRINTF
12743   fprintf(p, "x");
12744 # endif
12745 #endif
12746 #ifdef TRY_FFLUSH_NULL
12747   fflush(NULL);
12748 #endif
12749 #ifdef TRY_FFLUSH_ALL
12750   {
12751     long open_max = -1;
12752 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
12753     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
12754 # else
12755 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
12756     open_max = sysconf(_SC_OPEN_MAX);
12757 #  else
12758 #   ifdef FOPEN_MAX
12759     open_max = FOPEN_MAX;
12760 #   else
12761 #    ifdef OPEN_MAX
12762     open_max = OPEN_MAX;
12763 #    else
12764 #     ifdef _NFILE
12765     open_max = _NFILE;
12766 #     endif
12767 #    endif
12768 #   endif
12769 #  endif
12770 # endif 
12771 # ifdef HAS_STDIO_STREAM_ARRAY
12772     if (open_max > 0) {
12773       long i;
12774       for (i = 0; i < open_max; i++)
12775             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
12776                 STDIO_STREAM_ARRAY[i]._file < open_max &&
12777                 STDIO_STREAM_ARRAY[i]._flag)
12778                 fflush(&STDIO_STREAM_ARRAY[i]);
12779     }   
12780   }
12781 # endif
12782 #endif
12783   _exit(42);
12784 }
12785 EOCP
12786 : first we have to find out how _not_ to flush
12787 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
12788     output=''
12789     set try -DTRY_FPUTC
12790     if eval $compile; then
12791             $rm -f try.out
12792             ./try$exe_ext 2>/dev/null
12793             if $test ! -s try.out -a "X$?" = X42; then
12794                 output=-DTRY_FPUTC
12795             fi
12796     fi
12797     case "$output" in
12798     '')
12799             set try -DTRY_FPRINTF
12800             $rm -f try.out
12801             if eval $compile; then
12802                     $rm -f try.out
12803                     ./try$exe_ext 2>/dev/null
12804                     if $test ! -s try.out -a "X$?" = X42; then
12805                         output=-DTRY_FPRINTF
12806                     fi
12807             fi
12808         ;;
12809     esac
12810 fi
12811 : check for fflush NULL behaviour
12812 case "$fflushNULL" in
12813 '')     set try -DTRY_FFLUSH_NULL $output
12814         if eval $compile; then
12815                 $rm -f try.out
12816                 ./try$exe_ext 2>/dev/null
12817                 code="$?"
12818                 if $test -s try.out -a "X$code" = X42; then
12819                         fflushNULL="`$cat try.out`"
12820                 else
12821                         if $test "X$code" != X42; then
12822                                 $cat >&4 <<EOM
12823 (If this test failed, don't worry, we'll try another method shortly.)
12824 EOM
12825                         fi
12826                 fi
12827         fi
12828         $rm -f core try.core core.try.*
12829         case "$fflushNULL" in
12830         x)      $cat >&4 <<EOM
12831 Your fflush(NULL) works okay for output streams.
12832 Let's see if it clobbers input pipes...
12833 EOM
12834 # As of mid-March 2000 all versions of Solaris appear to have a stdio
12835 # bug that improperly flushes the input end of pipes.  So we avoid the
12836 # autoflush on fork/system/exec support for now. :-(
12837 $cat >tryp.c <<EOCP
12838 #include <stdio.h>
12839 int
12840 main(int argc, char **argv)
12841 {
12842     char buf[1024];
12843     int i;
12844     char *bp = buf;
12845     while (1) {
12846         while ((i = getc(stdin)) != -1
12847                && (*bp++ = i) != '\n'
12848                && bp < &buf[1024])
12849         /* DO NOTHING */ ;
12850         *bp = '\0';
12851         fprintf(stdout, "%s", buf);
12852         fflush(NULL);
12853         if (i == -1)
12854             return 0;
12855         bp = buf;
12856     }
12857 }
12858 EOCP
12859                 fflushNULL="$define"
12860                 set tryp
12861                 if eval $compile; then
12862                     $rm -f tryp.out
12863                     $cat tryp.c | ./tryp$exe_ext 2>/dev/null > tryp.out
12864                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
12865                        $cat >&4 <<EOM
12866 fflush(NULL) seems to behave okay with input streams.
12867 EOM
12868                         fflushNULL="$define"
12869                     else
12870                         $cat >&4 <<EOM
12871 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
12872 EOM
12873                         fflushNULL="$undef"
12874                     fi
12875                 fi
12876                 $rm -f core tryp.c tryp.core core.tryp.*
12877                 ;;
12878         '')     $cat >&4 <<EOM
12879 Your fflush(NULL) isn't working (contrary to ANSI C).
12880 EOM
12881                 fflushNULL="$undef"
12882                 ;;
12883         *)      $cat >&4 <<EOM
12884 Cannot figure out whether your fflush(NULL) works or not.
12885 I'm assuming it doesn't (contrary to ANSI C).
12886 EOM
12887                 fflushNULL="$undef"
12888                 ;;
12889         esac
12890         ;;
12891 $define|true|[yY]*)
12892         fflushNULL="$define"
12893         ;;
12894 *)
12895         fflushNULL="$undef"
12896         ;;
12897 esac
12898 : check explicit looping only if NULL did not work, and if the pipe
12899 : bug does not show up on an explicit flush too
12900 case "$fflushNULL" in
12901 "$undef")
12902         $cat >tryp.c <<EOCP
12903 #include <stdio.h>
12904 int
12905 main(int argc, char **argv)
12906 {
12907     char buf[1024];
12908     int i;
12909     char *bp = buf;
12910     while (1) {
12911         while ((i = getc(stdin)) != -1
12912                && (*bp++ = i) != '\n'
12913                && bp < &buf[1024])
12914         /* DO NOTHING */ ;
12915         *bp = '\0';
12916         fprintf(stdout, "%s", buf);
12917         fflush(stdin);
12918         if (i == -1)
12919             return 0;
12920         bp = buf;
12921     }
12922 }
12923 EOCP
12924         set tryp
12925         if eval $compile; then
12926             $rm -f tryp.out
12927             $cat tryp.c | ./tryp$exe_ext 2>/dev/null > tryp.out
12928             if cmp tryp.c tryp.out >/dev/null 2>&1; then
12929                $cat >&4 <<EOM
12930 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
12931 EOM
12932                 : now check for fflushall behaviour
12933                 case "$fflushall" in
12934                 '')     set try -DTRY_FFLUSH_ALL $output
12935                         if eval $compile; then
12936                                 $cat >&4 <<EOM
12937 (Now testing the other method--but note that this also may fail.)
12938 EOM
12939                                 $rm -f try.out
12940                                 ./try$exe_ext 2>/dev/null
12941                                 if $test -s try.out -a "X$?" = X42; then
12942                                         fflushall="`$cat try.out`"
12943                                 fi
12944                         fi
12945                         $rm -f core try.core core.try.*
12946                         case "$fflushall" in
12947                         x)      $cat >&4 <<EOM
12948 Whew. Flushing explicitly all the stdio streams works.
12949 EOM
12950                                 fflushall="$define"
12951                                 ;;
12952                         '')     $cat >&4 <<EOM
12953 Sigh. Flushing explicitly all the stdio streams doesn't work.
12954 EOM
12955                                 fflushall="$undef"
12956                                 ;;
12957                         *)      $cat >&4 <<EOM
12958 Cannot figure out whether flushing stdio streams explicitly works or not.
12959 I'm assuming it doesn't.
12960 EOM
12961                                 fflushall="$undef"
12962                                 ;;
12963                         esac
12964                         ;;
12965                 "$define"|true|[yY]*)
12966                         fflushall="$define"
12967                         ;;
12968                 *)
12969                         fflushall="$undef"
12970                         ;;
12971                 esac
12972             else
12973                 $cat >&4 <<EOM
12974 All is futile.  Even fflush(stdin) clobbers input pipes!
12975 EOM
12976                 fflushall="$undef"
12977             fi
12978         else
12979             fflushall="$undef"
12980         fi
12981         $rm -f core tryp.c tryp.core core.tryp.*
12982         ;;
12983 *)      fflushall="$undef"
12984         ;;
12985 esac
12986
12987 case "$fflushNULL$fflushall" in
12988 undefundef)
12989         $cat <<EOM
12990 OK, I give up.  I cannot figure out how to flush pending stdio output.
12991 We won't be flushing handles at all before fork/exec/popen.
12992 EOM
12993         ;;
12994 esac
12995 $rm -f try.* try$exe_ext
12996
12997 : Store the full pathname to the ar program for use in the C program
12998 : Respect a hint or command line value for full_ar.
12999 case "$full_ar" in
13000 '') full_ar=$ar ;;
13001 esac
13002
13003 : Store the full pathname to the sed program for use in the C program
13004 full_sed=$sed
13005
13006 : see what type gids are declared as in the kernel
13007 echo " "
13008 echo "Looking for the type for group ids returned by getgid()."
13009 set gid_t gidtype xxx stdio.h sys/types.h
13010 eval $typedef
13011 case "$gidtype" in
13012 xxx)
13013         xxx=`./findhdr sys/user.h`
13014         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
13015         case $1 in
13016         unsigned) dflt="$1 $2" ;;
13017         *) dflt="$1" ;;
13018         esac
13019         ;;
13020 *) dflt="$gidtype";;
13021 esac
13022 case "$gidtype" in
13023 gid_t) echo "gid_t found." ;;
13024 *)      rp="What is the type for group ids returned by getgid()?"
13025         . ./myread
13026         gidtype="$ans"
13027         ;;
13028 esac
13029
13030 echo " "
13031 case "$gidtype" in
13032 *_t) zzz="$gidtype"     ;;
13033 *)   zzz="gid"          ;;
13034 esac
13035 echo "Checking the size of $zzz..." >&4 
13036 cat > try.c <<EOCP
13037 #include <sys/types.h>
13038 #include <stdio.h>
13039 int main() {
13040     printf("%d\n", (int)sizeof($gidtype));
13041     exit(0);
13042 }
13043 EOCP
13044 set try
13045 if eval $compile_ok; then
13046         yyy=`./try`
13047         case "$yyy" in
13048         '')     gidsize=4
13049                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
13050                 ;;
13051         *)      gidsize=$yyy
13052                 echo "Your $zzz is $gidsize bytes long."
13053                 ;;
13054         esac
13055 else
13056         gidsize=4
13057         echo "(I can't compile the test program--guessing $gidsize.)" >&4
13058 fi
13059
13060
13061 echo " "
13062 case "$gidtype" in
13063 *_t) zzz="$gidtype"     ;;
13064 *)   zzz="gid"          ;;
13065 esac
13066 echo "Checking the sign of $zzz..." >&4 
13067 cat > try.c <<EOCP
13068 #include <sys/types.h>
13069 #include <stdio.h>
13070 int main() {
13071         $gidtype foo = -1;
13072         if (foo < 0)
13073                 printf("-1\n");
13074         else
13075                 printf("1\n");
13076 }
13077 EOCP
13078 set try
13079 if eval $compile; then
13080         yyy=`./try`
13081         case "$yyy" in
13082         '')     gidsign=1
13083                 echo "(I can't execute the test program--guessing unsigned.)" >&4
13084                 ;;
13085         *)      gidsign=$yyy
13086                 case "$gidsign" in
13087                  1) echo "Your $zzz is unsigned." ;;
13088                 -1) echo "Your $zzz is signed."   ;;
13089                 esac
13090                 ;;
13091         esac
13092 else
13093         gidsign=1
13094         echo "(I can't compile the test program--guessing unsigned.)" >&4
13095 fi
13096
13097
13098 echo " "
13099
13100 if $test X"$quadtype" != X; then
13101
13102 echo "Checking how to print 64-bit integers..." >&4
13103
13104 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
13105         $cat >try.c <<'EOCP'
13106 #include <sys/types.h>
13107 #include <stdio.h>
13108 int main() {
13109   int q = 12345678901;
13110   printf("%ld\n", q);
13111 }
13112 EOCP
13113         set try
13114         if eval $compile; then
13115                 yyy=`./try$exe_ext`
13116                 case "$yyy" in
13117                 12345678901)
13118                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
13119                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIX64='"X"';
13120                         echo "We will use %d."
13121                         ;;
13122                 esac
13123         fi
13124 fi
13125
13126 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
13127         $cat >try.c <<'EOCP'
13128 #include <sys/types.h>
13129 #include <stdio.h>
13130 int main() {
13131   long q = 12345678901;
13132   printf("%ld\n", q);
13133 }
13134 EOCP
13135         set try
13136         if eval $compile; then
13137                 yyy=`./try$exe_ext`
13138                 case "$yyy" in
13139                 12345678901)
13140                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
13141                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIX64='"lX"';
13142                         echo "We will use %ld."
13143                         ;;
13144                 esac
13145         fi
13146 fi
13147
13148 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
13149         $cat >try.c <<'EOCP'
13150 #include <sys/types.h>
13151 #include <inttypes.h>
13152 #include <stdio.h>
13153 int main() {
13154   int64_t q = 12345678901;
13155   printf("%" PRId64 "\n", q);
13156 }
13157 EOCP
13158         set try
13159         if eval $compile; then
13160                 yyy=`./try$exe_ext`
13161                 case "$yyy" in
13162                 12345678901)
13163                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
13164                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIX64=PRIX64;
13165                         echo "We will use the C9X style."
13166                         ;;
13167                 esac
13168         fi
13169 fi
13170
13171 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
13172         $cat >try.c <<'EOCP'
13173 #include <sys/types.h>
13174 #include <stdio.h>
13175 int main() {
13176   long long q = 12345678901LL; /* AIX cc requires the LL prefix. */
13177   printf("%lld\n", q);
13178 }
13179 EOCP
13180         set try
13181         if eval $compile; then
13182                 yyy=`./try$exe_ext`
13183                 case "$yyy" in
13184                 12345678901)
13185                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
13186                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIX64='"llX"';
13187                         echo "We will use the %lld style."
13188                         ;;
13189                 esac
13190         fi
13191 fi
13192
13193 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
13194         $cat >try.c <<EOCP
13195 #include <sys/types.h>
13196 #include <stdio.h>
13197 int main() {
13198   $quadtype q = 12345678901;
13199   printf("%Ld\n", q);
13200 }
13201 EOCP
13202         set try
13203         if eval $compile; then
13204                 yyy=`./try$exe_ext`
13205                 case "$yyy" in
13206                 12345678901)
13207                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
13208                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIX64='"LX"';
13209                         echo "We will use %Ld."
13210                         ;;
13211                 esac
13212         fi
13213 fi
13214
13215 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
13216         $cat >try.c <<EOCP
13217 #include <sys/types.h>
13218 #include <stdio.h>
13219 int main() {
13220   $quadtype q = 12345678901;
13221   printf("%qd\n", q);
13222 }
13223 EOCP
13224         set try
13225         if eval $compile; then
13226                 yyy=`./try$exe_ext`
13227                 case "$yyy" in
13228                 12345678901)
13229                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
13230                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIX64='"qX"';
13231                         echo "We will use %qd."
13232                         ;;
13233                 esac
13234         fi
13235 fi
13236
13237 if $test X"$sPRId64" = X; then
13238         echo "Cannot figure out how to print 64-bit integers." >&4
13239 fi
13240
13241 $rm -f try try.*
13242
13243 fi
13244
13245 case "$sPRId64" in
13246 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef"; 
13247         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIX64="$undef"; 
13248         ;;
13249 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define"; 
13250         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIX64="$define"; 
13251         ;;
13252 esac
13253
13254
13255 echo " "
13256 $echo "Checking the format strings to be used for Perl's internal types..." >&4
13257
13258 if $test X"$ivsize" = X8; then
13259         ivdformat="$sPRId64"
13260         uvuformat="$sPRIu64"
13261         uvoformat="$sPRIo64"
13262         uvxformat="$sPRIx64"
13263         uvXformat="$sPRIX64"
13264 else
13265         if $test X"$ivsize" = X"$longsize"; then
13266                 ivdformat='"ld"'
13267                 uvuformat='"lu"'
13268                 uvoformat='"lo"'
13269                 uvxformat='"lx"'
13270                 uvXformat='"lX"'
13271         else
13272                 if $test X"$ivsize" = X"$intsize"; then
13273                         ivdformat='"d"'
13274                         uvuformat='"u"'
13275                         uvoformat='"o"'
13276                         uvxformat='"x"'
13277                         uvXformat='"X"'
13278                 else
13279                         : far out
13280                         if $test X"$ivsize" = X"$shortsize"; then
13281                                 ivdformat='"hd"'
13282                                 uvuformat='"hu"'
13283                                 uvoformat='"ho"'
13284                                 uvxformat='"hx"'
13285                                 uvXformat='"hX"'
13286                         fi
13287                 fi
13288         fi
13289 fi
13290
13291 if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
13292         nveformat="$sPRIeldbl"
13293         nvfformat="$sPRIfldbl"
13294         nvgformat="$sPRIgldbl"
13295         nvEformat="$sPRIEldbl"
13296         nvFformat="$sPRIFldbl"
13297         nvGformat="$sPRIGldbl"
13298 else
13299         nveformat='"e"'
13300         nvfformat='"f"'
13301         nvgformat='"g"'
13302         nvEformat='"E"'
13303         nvFformat='"F"'
13304         nvGformat='"G"'
13305 fi
13306
13307 case "$ivdformat" in
13308 '') echo "$0: Fatal: failed to find format strings, cannot continue." >& 4
13309     exit 1
13310     ;;
13311 esac
13312
13313
13314 echo " "
13315 $echo "Checking the format string to be used for gids..." >&4
13316
13317 case "$gidsign" in
13318 -1)     if $test X"$gidsize" = X"$ivsize"; then
13319                 gidformat="$ivdformat"
13320         else
13321                 if $test X"$gidsize" = X"$longsize"; then
13322                         gidformat='"ld"'
13323                 else
13324                         if $test X"$gidsize" = X"$intsize"; then
13325                                 gidformat='"d"'
13326                         else
13327                                 if $test X"$gidsize" = X"$shortsize"; then
13328                                         gidformat='"hd"'
13329                                 fi
13330                         fi
13331                 fi
13332         fi
13333         ;;
13334 *)      if $test X"$gidsize" = X"$uvsize"; then
13335                 gidformat="$uvuformat"
13336         else
13337                 if $test X"$gidsize" = X"$longsize"; then
13338                         gidformat='"lu"'
13339                 else
13340                         if $test X"$gidsize" = X"$intsize"; then
13341                                 gidformat='"u"'
13342                         else
13343                                 if $test X"$gidsize" = X"$shortsize"; then
13344                                         gidformat='"hu"'
13345                                 fi
13346                         fi
13347                 fi
13348         fi
13349         ;;
13350 esac
13351
13352 : see if getgroups exists
13353 set getgroups d_getgrps
13354 eval $inlibc
13355
13356 : see if setgroups exists
13357 set setgroups d_setgrps
13358 eval $inlibc
13359
13360
13361 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
13362 echo " "
13363 case "$d_getgrps$d_setgrps" in
13364 *define*)
13365         case "$groupstype" in
13366         '') dflt="$gidtype" ;;
13367         *)  dflt="$groupstype" ;;
13368         esac
13369         $cat <<EOM
13370 What type of pointer is the second argument to getgroups() and setgroups()?
13371 Usually this is the same as group ids, $gidtype, but not always.
13372
13373 EOM
13374         rp='What type pointer is the second argument to getgroups() and setgroups()?'
13375         . ./myread
13376         groupstype="$ans"
13377         ;;
13378 *)  groupstype="$gidtype";;
13379 esac
13380
13381 echo " "
13382 echo "Checking if your $make program sets \$(MAKE)..." >&4
13383 case "$make_set_make" in
13384 '')
13385         $sed 's/^X //' > testmake.mak << 'EOF'
13386 Xall:
13387 X       @echo 'maketemp="$(MAKE)"'
13388 EOF
13389         case "`$make -f testmake.mak 2>/dev/null`" in
13390         *maketemp=*) make_set_make='#' ;;
13391         *)      make_set_make="MAKE=$make" ;;
13392         esac
13393         $rm -f testmake.mak
13394         ;;
13395 esac
13396 case "$make_set_make" in
13397 '#') echo "Yup, it does.";;
13398 *) echo "Nope, it doesn't.";;
13399 esac
13400
13401 : see what type is used for mode_t
13402 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
13403 set mode_t modetype int stdio.h sys/types.h
13404 eval $typedef_ask
13405
13406 : define a fucntion to check prototypes
13407 $cat > protochk <<EOSH
13408 $startsh
13409 cc="$cc"
13410 optimize="$optimize"
13411 ccflags="$ccflags"
13412 prototype="$prototype"
13413 define="$define"
13414 rm=$rm
13415 EOSH
13416
13417 $cat >> protochk <<'EOSH'
13418
13419 $rm -f try.c
13420 foo="$1"
13421 shift
13422 while test $# -ge 2; do
13423         case "$1" in
13424                 $define) echo "#include <$2>" >> try.c ;;
13425                 literal) echo "$2" >> try.c ;;
13426         esac
13427     shift 2
13428 done
13429 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
13430 cat >> try.c <<'EOCP'
13431 #ifdef CAN_PROTOTYPE
13432 #define _(args) args
13433 #else
13434 #define _(args) ()
13435 #endif
13436 EOCP
13437 echo "$foo" >> try.c
13438 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
13439 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
13440 status=$?
13441 $rm -f try.[co]
13442 exit $status
13443 EOSH
13444 chmod +x protochk
13445 $eunicefix protochk
13446
13447 : see what type is used for size_t
13448 rp="What is the type used for the length parameter for string functions?"
13449 set size_t sizetype 'unsigned int' stdio.h sys/types.h
13450 eval $typedef_ask
13451
13452 : check for type of arguments to gethostbyaddr. 
13453 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
13454         case "$d_gethbyaddr" in
13455         $define)
13456                 $cat <<EOM
13457
13458 Checking to see what type of arguments are accepted by gethostbyaddr().
13459 EOM
13460                 hdrs="$define sys/types.h
13461                         $d_socket sys/socket.h 
13462                         $i_niin netinet/in.h 
13463                         $i_netdb netdb.h
13464                         $i_unistd unistd.h"
13465                 : The first arg can 'char *' or 'void *'
13466                 : The second arg is some of integral type
13467                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
13468                         for yyy in size_t long int; do
13469                                 case "$netdb_host_type" in
13470                                 '')     try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
13471                                         if ./protochk "$try" $hdrs; then
13472                                                 echo "Your system accepts $xxx for the first arg."
13473                                                 echo "...and $yyy for the second arg."
13474                                                 netdb_host_type="$xxx"
13475                                                 netdb_hlen_type="$yyy"
13476                                         fi
13477                                         ;;
13478                                 esac
13479                         done
13480                 done
13481                 : In case none of those worked, prompt the user.
13482                 case "$netdb_host_type" in
13483                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
13484                         dflt='char *'
13485                         . ./myread
13486                         netdb_host_type=$ans
13487                         rp='What is the type for the 2nd argument to gethostbyaddr?'
13488                         dflt="$sizetype"
13489                         . ./myread
13490                         netdb_hlen_type=$ans
13491                         ;;
13492                 esac
13493                 ;;
13494         *)      : no gethostbyaddr, so pick harmless defaults
13495                 netdb_host_type='char *'
13496                 netdb_hlen_type="$sizetype"
13497                 ;;
13498         esac
13499         # Remove the "const" if needed. -- but then we'll have a 
13500         # prototype clash!
13501         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
13502 fi
13503
13504 : check for type of argument to gethostbyname. 
13505 if test "X$netdb_name_type" = X ; then
13506         case "$d_gethbyname" in
13507         $define)
13508                 $cat <<EOM
13509
13510 Checking to see what type of argument is accepted by gethostbyname().
13511 EOM
13512                 hdrs="$define sys/types.h
13513                         $d_socket sys/socket.h 
13514                         $i_niin netinet/in.h 
13515                         $i_netdb netdb.h
13516                         $i_unistd unistd.h"
13517                 for xxx in "const char *" "char *"; do
13518                         case "$netdb_name_type" in
13519                         '')     try="extern struct hostent *gethostbyname($xxx);"
13520                                 if ./protochk "$try" $hdrs; then
13521                                         echo "Your system accepts $xxx."
13522                                         netdb_name_type="$xxx"
13523                                 fi
13524                                 ;;
13525                         esac
13526                 done
13527                 : In case none of those worked, prompt the user.
13528                 case "$netdb_name_type" in
13529                 '')     rp='What is the type for the 1st argument to gethostbyname?'
13530                         dflt='char *'
13531                         . ./myread
13532                         netdb_name_type=$ans
13533                         ;;
13534                 esac
13535                 ;;
13536         *)      : no gethostbyname, so pick harmless default
13537                 netdb_name_type='char *'
13538                 ;;
13539         esac
13540 fi
13541
13542 : check for type of 1st argument to getnetbyaddr. 
13543 if test "X$netdb_net_type" = X ; then
13544         case "$d_getnbyaddr" in
13545         $define)
13546                 $cat <<EOM
13547
13548 Checking to see what type of 1st argument is accepted by getnetbyaddr().
13549 EOM
13550                 hdrs="$define sys/types.h
13551                         $d_socket sys/socket.h 
13552                         $i_niin netinet/in.h 
13553                         $i_netdb netdb.h
13554                         $i_unistd unistd.h"
13555                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
13556                         case "$netdb_net_type" in
13557                         '')     try="extern struct netent *getnetbyaddr($xxx, int);"
13558                                 if ./protochk "$try" $hdrs; then
13559                                         echo "Your system accepts $xxx."
13560                                         netdb_net_type="$xxx"
13561                                 fi
13562                                 ;;
13563                         esac
13564                 done
13565                 : In case none of those worked, prompt the user.
13566                 case "$netdb_net_type" in
13567                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
13568                         dflt='long'
13569                         . ./myread
13570                         netdb_net_type=$ans
13571                         ;;
13572                 esac
13573                 ;;
13574         *)      : no getnetbyaddr, so pick harmless default
13575                 netdb_net_type='long'
13576                 ;;
13577         esac
13578 fi
13579 : locate the preferred pager for this system
13580 case "$pager" in
13581 '')
13582         dflt=''
13583         case "$pg" in
13584         /*) dflt=$pg;;
13585         esac
13586         case "$more" in
13587         /*) dflt=$more;;
13588         esac
13589         case "$less" in
13590         /*) dflt=$less;;
13591         esac
13592         case "$dflt" in
13593         '') dflt=/usr/ucb/more;;
13594         esac
13595         ;;
13596 *) dflt="$pager";;
13597 esac
13598 echo " "
13599 fn=f/
13600 rp='What pager is used on your system?'
13601 . ./getfile
13602 pager="$ans"
13603
13604 : see what type pids are declared as in the kernel
13605 rp="What is the type of process ids on this system?"
13606 set pid_t pidtype int stdio.h sys/types.h
13607 eval $typedef_ask
13608
13609 : Find earliest binary compatible site_perl subdirectory perl can use.
13610 case "$bincompat5005" in
13611 "$define") xs_apiversion='5.005' ;;
13612 *) xs_apiversion=$version ;;   # The current site_perl version.
13613 esac
13614 : Find earliest pure perl site_perl subdirectory perl can use.
13615 : The versioned directories started at 5.005.
13616 pm_apiversion='5.005'
13617
13618 : check for length of pointer
13619 echo " "
13620 case "$ptrsize" in
13621 '')
13622         echo "Checking to see how big your pointers are..." >&4
13623         if test "$voidflags" -gt 7; then
13624                 echo '#define VOID_PTR char *' > try.c
13625         else
13626                 echo '#define VOID_PTR void *' > try.c
13627         fi
13628         $cat >>try.c <<'EOCP'
13629 #include <stdio.h>
13630 int main()
13631 {
13632     printf("%d\n", (int)sizeof(VOID_PTR));
13633     exit(0);
13634 }
13635 EOCP
13636         set try
13637         if eval $compile_ok; then
13638                 ptrsize=`./try`
13639                 echo "Your pointers are $ptrsize bytes long."
13640         else
13641                 dflt='4'
13642                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
13643                 rp="What is the size of a pointer (in bytes)?"
13644                 . ./myread
13645                 ptrsize="$ans"
13646         fi
13647         ;;
13648 esac
13649 $rm -f try.c try
13650
13651 : see if ar generates random libraries by itself
13652 echo " "
13653 echo "Checking how to generate random libraries on your machine..." >&4
13654 echo 'int bar1() { return bar2(); }' > bar1.c
13655 echo 'int bar2() { return 2; }' > bar2.c
13656 $cat > foo.c <<'EOP'
13657 int main() { printf("%d\n", bar1()); exit(0); }
13658 EOP
13659 $cc $ccflags -c bar1.c >/dev/null 2>&1
13660 $cc $ccflags -c bar2.c >/dev/null 2>&1
13661 $cc $ccflags -c foo.c >/dev/null 2>&1
13662 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
13663 if $cc $ccflags $ldflags -o foobar foo$_o bar$_a $libs > /dev/null 2>&1 &&
13664         ./foobar >/dev/null 2>&1; then
13665         echo "$ar appears to generate random libraries itself."
13666         orderlib=false
13667         ranlib=":"
13668 elif $ar ts bar$_a >/dev/null 2>&1 &&
13669         $cc $ccflags $ldflags -o foobar foo$_o bar$_a $libs > /dev/null 2>&1 &&
13670         ./foobar >/dev/null 2>&1; then
13671                 echo "a table of contents needs to be added with '$ar ts'."
13672                 orderlib=false
13673                 ranlib="$ar ts"
13674 else
13675         case "$ranlib" in
13676         :) ranlib='';;
13677         '')
13678                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
13679                 $test -f $ranlib || ranlib=''
13680                 ;;
13681         esac
13682         if $test -n "$ranlib"; then
13683                 echo "your system has '$ranlib'; we'll use that."
13684                 orderlib=false
13685         else
13686                 echo "your system doesn't seem to support random libraries"
13687                 echo "so we'll use lorder and tsort to order the libraries."
13688                 orderlib=true
13689                 ranlib=":"
13690         fi
13691 fi
13692 $rm -f foo* bar* 
13693
13694 : check for type of arguments to select. 
13695 case "$selecttype" in
13696 '') case "$d_select" in
13697         $define)
13698                 echo " "
13699                 $cat <<EOM
13700 Checking to see what type of arguments are accepted by select().
13701 EOM
13702                 hdrs="$define sys/types.h
13703                         $i_systime sys/time.h 
13704                         $i_sysselct sys/select.h
13705                         $d_socket sys/socket.h"
13706                 : The first arg can be int, unsigned, or size_t
13707                 : The last arg may or may not be 'const'
13708                 val=''
13709                 : void pointer has been seen but using that
13710                 : breaks the selectminbits test
13711                 for xxx in 'fd_set *' 'int *'; do
13712                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
13713                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
13714                                         case "$val" in
13715                                         '')     try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
13716                                                 if ./protochk "$try" $hdrs; then
13717                                                         echo "Your system accepts $xxx."
13718                                                         val="$xxx"
13719                                                 fi
13720                                                 ;;
13721                                         esac
13722                                 done
13723                         done
13724                 done
13725                 case "$val" in
13726                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
13727                         case "$d_fd_set" in
13728                                 $define) dflt="fd_set *" ;;
13729                                 *)              dflt="int *" ;;
13730                         esac
13731                         . ./myread
13732                         val=$ans
13733                         ;;
13734                 esac
13735                 selecttype="$val"
13736                 ;;
13737         *)      : no select, so pick a harmless default
13738                 selecttype='int *'
13739                 ;;
13740         esac
13741         ;;
13742 esac
13743
13744 : check for the select 'width'
13745 case "$selectminbits" in
13746 '') case "$d_select" in
13747         $define)
13748                 $cat <<EOM
13749
13750 Checking to see on how many bits at a time your select() operates...
13751 EOM
13752                 $cat >try.c <<EOCP
13753 #include <sys/types.h>
13754 #$i_time I_TIME
13755 #$i_systime I_SYS_TIME
13756 #$i_systimek I_SYS_TIME_KERNEL
13757 #ifdef I_TIME
13758 #   include <time.h>
13759 #endif
13760 #ifdef I_SYS_TIME
13761 #   ifdef I_SYS_TIME_KERNEL
13762 #       define KERNEL
13763 #   endif
13764 #   include <sys/time.h>
13765 #   ifdef I_SYS_TIME_KERNEL
13766 #       undef KERNEL
13767 #   endif
13768 #endif
13769 #$i_sysselct I_SYS_SELECT
13770 #ifdef I_SYS_SELECT
13771 #include <sys/select.h>
13772 #endif
13773 #$d_socket HAS_SOCKET
13774 #ifdef HAS_SOCKET
13775 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
13776 #endif
13777 #include <stdio.h>
13778 $selecttype b;
13779 #define S sizeof(*(b))
13780 #define MINBITS 64
13781 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
13782 #define NBITS  (NBYTES * 8)
13783 int main() {
13784     char s[NBYTES];
13785     struct timeval t;
13786     int i;
13787     FILE* fp;
13788     int fd;
13789
13790     fclose(stdin);
13791     fp = fopen("try.c", "r");
13792     if (fp == 0)
13793       exit(1);
13794     fd = fileno(fp);
13795     if (fd < 0)
13796       exit(2);
13797     b = ($selecttype)s;
13798     for (i = 0; i < NBITS; i++)
13799         FD_SET(i, b);
13800     t.tv_sec  = 0;
13801     t.tv_usec = 0;
13802     select(fd + 1, b, 0, 0, &t);
13803     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
13804     printf("%d\n", i + 1);
13805     return 0;
13806 }
13807 EOCP
13808                 set try
13809                 if eval $compile_ok; then
13810                         selectminbits=`./try`
13811                         case "$selectminbits" in
13812                         '')     cat >&4 <<EOM
13813 Cannot figure out on how many bits at a time your select() operates.
13814 I'll play safe and guess it is 32 bits.
13815 EOM
13816                                 selectminbits=32
13817                                 bits="32 bits"
13818                                 ;;
13819                         1)      bits="1 bit" ;;
13820                         *)      bits="$selectminbits bits" ;;
13821                         esac
13822                         echo "Your select() operates on $bits at a time." >&4
13823                 else
13824                         rp='What is the minimum number of bits your select() operates on?'
13825                         case "$byteorder" in
13826                         1234|12345678)  dflt=32 ;;
13827                         *)              dflt=1  ;;
13828                         esac
13829                         . ./myread
13830                         val=$ans
13831                         selectminbits="$val"
13832                 fi
13833                 $rm -f try.* try
13834                 ;;
13835         *)      : no select, so pick a harmless default
13836                 selectminbits='32'
13837                 ;;
13838         esac
13839         ;;
13840 esac
13841
13842 : Trace out the files included by signal.h, then look for SIGxxx names.
13843 : Remove SIGARRAYSIZE used by HPUX.
13844 : Remove SIGSTKSIZE used by Linux.
13845 : Remove SIGSTKSZ used by Posix.
13846 : Remove SIGTYP void lines used by OS2.
13847 : Some cpps, like os390, dont give the file name anywhere
13848 if [ "X$fieldn" = X ]; then
13849         : Just make some guesses.  We check them later.
13850         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
13851 else
13852         xxx=`echo '#include <signal.h>' |
13853         $cppstdin $cppminus $cppflags 2>/dev/null |
13854         $grep '^[       ]*#.*include' | 
13855         $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sort | $uniq`
13856 fi
13857 : Check this list of files to be sure we have parsed the cpp output ok.
13858 : This will also avoid potentially non-existent files, such 
13859 : as ../foo/bar.h
13860 xxxfiles=''
13861 for xx in $xxx /dev/null ; do
13862         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
13863 done
13864 : If we have found no files, at least try signal.h
13865 case "$xxxfiles" in
13866 '')     xxxfiles=`./findhdr signal.h` ;;
13867 esac
13868 xxx=`awk '
13869 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
13870         print substr($2, 4, 20)
13871 }
13872 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
13873         print substr($3, 4, 20)
13874 }' $xxxfiles`
13875 : Append some common names just in case the awk scan failed.
13876 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
13877 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
13878 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
13879 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
13880 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
13881
13882 : generate a few handy files for later
13883 $cat > signal.c <<'EOCP'
13884 #include <sys/types.h>
13885 #include <signal.h>
13886 #include <stdio.h>
13887 int main() {
13888
13889 /* Strange style to avoid deeply-nested #if/#else/#endif */
13890 #ifndef NSIG
13891 #  ifdef _NSIG
13892 #    define NSIG (_NSIG)
13893 #  endif
13894 #endif
13895
13896 #ifndef NSIG
13897 #  ifdef SIGMAX
13898 #    define NSIG (SIGMAX+1)
13899 #  endif
13900 #endif
13901
13902 #ifndef NSIG
13903 #  ifdef SIG_MAX
13904 #    define NSIG (SIG_MAX+1)
13905 #  endif
13906 #endif
13907
13908 #ifndef NSIG
13909 #  ifdef MAXSIG
13910 #    define NSIG (MAXSIG+1)
13911 #  endif
13912 #endif
13913
13914 #ifndef NSIG
13915 #  ifdef MAX_SIG
13916 #    define NSIG (MAX_SIG+1)
13917 #  endif
13918 #endif
13919
13920 #ifndef NSIG
13921 #  ifdef SIGARRAYSIZE
13922 #    define NSIG (SIGARRAYSIZE+1) /* Not sure of the +1 */
13923 #  endif
13924 #endif
13925
13926 #ifndef NSIG
13927 #  ifdef _sys_nsig
13928 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
13929 #  endif
13930 #endif
13931
13932 /* Default to some arbitrary number that's big enough to get most
13933    of the common signals.
13934 */
13935 #ifndef NSIG
13936 #    define NSIG 50
13937 #endif
13938
13939 printf("NSIG %d\n", NSIG);
13940
13941 #ifndef JUST_NSIG
13942
13943 EOCP
13944
13945 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
13946 {
13947         printf "#ifdef SIG"; printf $1; printf "\n"
13948         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
13949         printf $1; printf ");\n"
13950         printf "#endif\n"
13951 }
13952 END {
13953         printf "#endif /* JUST_NSIG */\n";
13954         printf "exit(0);\n}\n";
13955 }
13956 ' >>signal.c
13957 $cat >signal.awk <<'EOP'
13958 BEGIN { ndups = 0 }
13959 $1 ~ /^NSIG$/ { nsig = $2 }
13960 ($1 !~ /^NSIG$/) && (NF == 2) {
13961     if ($2 > maxsig) { maxsig = $2 }
13962     if (sig_name[$2]) {
13963         dup_name[ndups] = $1
13964         dup_num[ndups] = $2
13965         ndups++ 
13966     }
13967     else {
13968         sig_name[$2] = $1
13969         sig_num[$2] = $2
13970     }
13971 }
13972 END { 
13973     if (nsig == 0) {
13974         nsig = maxsig + 1
13975     }
13976     printf("NSIG %d\n", nsig);
13977     for (n = 1; n < nsig; n++) {
13978         if (sig_name[n]) {
13979             printf("%s %d\n", sig_name[n], sig_num[n])
13980         }
13981         else {
13982             printf("NUM%d %d\n", n, n) 
13983         }
13984     }
13985     for (n = 0; n < ndups; n++) {
13986         printf("%s %d\n", dup_name[n], dup_num[n])
13987     }
13988 }
13989 EOP
13990 $cat >signal_cmd <<EOS
13991 $startsh
13992 if $test -s signal.lst; then
13993     echo "Using your existing signal.lst file"
13994         exit 0
13995 fi
13996 xxx="$xxx"
13997 EOS
13998 $cat >>signal_cmd <<'EOS'
13999
14000 set signal
14001 if eval $compile_ok; then
14002         ./signal$_exe | $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
14003 else
14004         echo "(I can't seem be able to compile the whole test program)" >&4
14005         echo "(I'll try it in little pieces.)" >&4
14006         set signal -DJUST_NSIG
14007         if eval $compile_ok; then
14008                 ./signal$_exe > signal.nsg
14009                 $cat signal.nsg
14010         else
14011                 echo "I can't seem to figure out how many signals you have." >&4
14012                 echo "Guessing 50." >&4
14013                 echo 'NSIG 50' > signal.nsg
14014         fi
14015         : Now look at all the signal names, one at a time.
14016         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
14017                 $cat > signal.c <<EOCP
14018 #include <sys/types.h>
14019 #include <signal.h>
14020 #include <stdio.h>
14021 int main() {
14022 printf("$xx %d\n", SIG${xx});
14023 return 0;
14024 }
14025 EOCP
14026                 set signal
14027                 if eval $compile; then
14028                         echo "SIG${xx} found."
14029                         ./signal$_exe  >> signal.ls1
14030                 else
14031                         echo "SIG${xx} NOT found."
14032                 fi
14033         done
14034         if $test -s signal.ls1; then
14035                 $cat signal.nsg signal.ls1 |
14036                         $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
14037         fi
14038
14039 fi
14040 if $test -s signal.lst; then
14041         :
14042 else
14043         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
14044         echo 'kill -l' >signal
14045         set X `csh -f <signal`
14046         $rm -f signal
14047         shift
14048         case $# in
14049         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
14050         esac
14051         echo $@ | $tr ' ' $trnl | \
14052             $awk '{ printf "%s %d\n", $1, ++s; }
14053                   END { printf "NSIG %d\n", ++s }' >signal.lst
14054 fi
14055 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
14056 EOS
14057 chmod a+x signal_cmd
14058 $eunicefix signal_cmd
14059
14060 : generate list of signal names
14061 echo " "
14062 case "$sig_name_init" in
14063 '') doinit=yes ;;
14064 *)  case "$sig_num_init" in
14065     ''|*,*) doinit=yes ;;
14066     esac ;;
14067 esac
14068 case "$doinit" in
14069 yes)
14070         echo "Generating a list of signal names and numbers..." >&4
14071         . ./signal_cmd
14072         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
14073         sig_name=`$awk 'BEGIN { printf "ZERO " }
14074                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
14075         sig_num=`$awk  'BEGIN { printf "0 " }
14076                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
14077         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
14078                              !/^NSIG/   { printf "\"%s\", ", $1 }
14079                              END        { printf "0\n" }' signal.lst`
14080         sig_num_init=`$awk  'BEGIN      { printf "0, " }
14081                              !/^NSIG/   { printf "%d, ", $2}
14082                              END        { printf "0\n"}' signal.lst`
14083         ;;
14084 esac
14085 echo "The following $sig_count signals are available:"
14086 echo " "
14087 echo $sig_name | $awk \
14088 'BEGIN { linelen = 0 }
14089 {
14090         for (i = 1; i <= NF; i++) {
14091                 name = "SIG" $i " "
14092                 linelen = linelen + length(name)
14093                 if (linelen > 70) {
14094                         printf "\n"
14095                         linelen = length(name)
14096                 }
14097                 printf "%s", name
14098         }
14099         printf "\n"
14100 }'
14101 $rm -f signal signal.c signal.awk signal.lst signal_cmd 
14102
14103 echo " "
14104 case "$sizetype" in
14105 *_t) zzz="$sizetype"    ;;
14106 *)   zzz="filesize"     ;;
14107 esac
14108 echo "Checking the size of $zzz..." >&4 
14109 cat > try.c <<EOCP
14110 #include <sys/types.h>
14111 #include <stdio.h>
14112 int main() {
14113     printf("%d\n", (int)sizeof($sizetype));
14114     exit(0);
14115 }
14116 EOCP
14117 set try
14118 if eval $compile_ok; then
14119         yyy=`./try`
14120         case "$yyy" in
14121         '')     sizesize=4
14122                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
14123                 ;;
14124         *)      sizesize=$yyy
14125                 echo "Your $zzz size is $sizesize bytes."
14126                 ;;
14127         esac
14128 else
14129         sizesize=4
14130         echo "(I can't compile the test program--guessing $sizesize.)" >&4
14131 fi
14132
14133
14134 : check for socklen_t
14135 echo " "
14136 echo "Checking to see if you have socklen_t..." >&4
14137 $cat >try.c <<EOCP
14138 #include <sys/types.h>
14139 #$d_socket HAS_SOCKET
14140 #ifdef HAS_SOCKET
14141 #include <sys/socket.h>
14142 #endif
14143 int main() { socklen_t x = 16; }
14144 EOCP
14145 set try
14146 if eval $compile; then
14147         val="$define"
14148         echo "You have socklen_t."
14149 else
14150         val="$undef"
14151         echo "You do not have socklen_t."
14152         case "$sizetype" in
14153         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
14154         esac
14155 fi
14156 $rm -f try try.*
14157 set d_socklen_t
14158 eval $setvar
14159
14160 : check for type of the size argument to socket calls
14161 case "$d_socket" in
14162 "$define")
14163         $cat <<EOM
14164
14165 Checking to see what type is the last argument of accept().
14166 EOM
14167         hdrs="$define sys/types.h $d_socket sys/socket.h" 
14168         yyy=''
14169         case "$d_socklen_t" in
14170         "$define") yyy="$yyy socklen_t"
14171         esac
14172         yyy="$yyy $sizetype int long unsigned"
14173         for xxx in $yyy; do
14174                 case "$socksizetype" in
14175                 '')     try="extern int accept(int, struct sockaddr *, $xxx *);"
14176                         if ./protochk "$try" $hdrs; then
14177                                 echo "Your system accepts '$xxx *' for the last argument of accept()."
14178                                 socksizetype="$xxx"
14179                         fi
14180                         ;;
14181                 esac
14182         done
14183 : In case none of those worked, prompt the user.
14184         case "$socksizetype" in
14185         '')     rp='What is the type for socket address structure sizes?'
14186                 dflt='int'
14187                 . ./myread
14188                 socksizetype=$ans
14189                 ;;
14190         esac
14191         ;;
14192 *)      : no sockets, so pick relatively harmless default
14193         socksizetype='int'
14194         ;;
14195 esac
14196
14197 : see what type is used for signed size_t
14198 set ssize_t ssizetype int stdio.h sys/types.h
14199 eval $typedef
14200 dflt="$ssizetype"
14201 $cat > ssize.c <<EOM
14202 #include <stdio.h>
14203 #include <sys/types.h>
14204 #define Size_t $sizetype
14205 #define SSize_t $dflt
14206 int main()
14207 {
14208         if (sizeof(Size_t) == sizeof(SSize_t))
14209                 printf("$dflt\n");
14210         else if (sizeof(Size_t) == sizeof(int))
14211                 printf("int\n");
14212         else 
14213                 printf("long\n");
14214         exit(0);
14215 }
14216 EOM
14217 echo " "
14218 set ssize
14219 if eval $compile_ok && ./ssize > /dev/null; then
14220         ssizetype=`./ssize`
14221         echo "I'll be using $ssizetype for functions returning a byte count." >&4
14222 else
14223         $cat >&4 <<EOM
14224 Help! I can't compile and run the ssize_t test program: please enlighten me!
14225 (This is probably a misconfiguration in your system or libraries, and
14226 you really ought to fix it.  Still, I'll try anyway.)
14227
14228 I need a type that is the same size as $sizetype, but is guaranteed to
14229 be signed.  Common values are ssize_t, int and long.
14230
14231 EOM
14232         rp="What signed type is the same size as $sizetype?"
14233         . ./myread
14234         ssizetype="$ans"
14235 fi
14236 $rm -f ssize ssize.*
14237
14238 : see what type of char stdio uses.
14239 echo " "
14240 if $contains 'unsigned.*char.*_ptr;' `./findhdr stdio.h` >/dev/null 2>&1 ; then
14241         echo "Your stdio uses unsigned chars." >&4
14242         stdchar="unsigned char"
14243 else
14244         echo "Your stdio uses signed chars." >&4
14245         stdchar="char"
14246 fi
14247
14248 : see if time exists
14249 echo " "
14250 if test "X$d_time" = X -o X"$timetype" = X; then
14251     if set time val -f d_time; eval $csym; $val; then
14252                 echo 'time() found.' >&4
14253                 val="$define"
14254                 rp="What is the type returned by time() on this system?"
14255                 set time_t timetype long stdio.h sys/types.h
14256                 eval $typedef_ask
14257     else
14258                 echo 'time() not found, hope that will do.' >&4
14259                 val="$undef"
14260                 timetype='int';
14261     fi
14262     set d_time
14263     eval $setvar
14264 fi
14265
14266 : see what type uids are declared as in the kernel
14267 echo " "
14268 echo "Looking for the type for user ids returned by getuid()."
14269 set uid_t uidtype xxx stdio.h sys/types.h
14270 eval $typedef
14271 case "$uidtype" in
14272 xxx)
14273         xxx=`./findhdr sys/user.h`
14274         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
14275         case $1 in
14276         unsigned) dflt="$1 $2" ;;
14277         *) dflt="$1" ;;
14278         esac
14279         ;;
14280 *) dflt="$uidtype";;
14281 esac
14282 case "$uidtype" in
14283 uid_t)  echo "uid_t found." ;;
14284 *)      rp="What is the type for user ids returned by getuid()?"
14285         . ./myread
14286         uidtype="$ans"
14287         ;;
14288 esac
14289
14290 echo " "
14291 case "$uidtype" in
14292 *_t) zzz="$uidtype"     ;;
14293 *)   zzz="uid"          ;;
14294 esac
14295 echo "Checking the size of $zzz..." >&4 
14296 cat > try.c <<EOCP
14297 #include <sys/types.h>
14298 #include <stdio.h>
14299 int main() {
14300     printf("%d\n", (int)sizeof($uidtype));
14301     exit(0);
14302 }
14303 EOCP
14304 set try
14305 if eval $compile_ok; then
14306         yyy=`./try`
14307         case "$yyy" in
14308         '')     uidsize=4
14309                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
14310                 ;;
14311         *)      uidsize=$yyy
14312                 echo "Your $zzz is $uidsize bytes long."
14313                 ;;
14314         esac
14315 else
14316         uidsize=4
14317         echo "(I can't compile the test program--guessing $uidsize.)" >&4
14318 fi
14319
14320 echo " "
14321 case "$uidtype" in
14322 *_t) zzz="$uidtype"     ;;
14323 *)   zzz="uid"          ;;
14324 esac
14325 echo "Checking the sign of $zzz..." >&4
14326 cat > try.c <<EOCP
14327 #include <sys/types.h>
14328 #include <stdio.h>
14329 int main() {
14330         $uidtype foo = -1;
14331         if (foo < 0)
14332                 printf("-1\n");
14333         else
14334                 printf("1\n");
14335 }
14336 EOCP
14337 set try
14338 if eval $compile; then
14339         yyy=`./try`
14340         case "$yyy" in
14341         '')     uidsign=1
14342                 echo "(I can't execute the test program--guessing unsigned.)" >&4
14343                 ;;
14344         *)      uidsign=$yyy
14345                 case "$uidsign" in
14346                  1) echo "Your $zzz is unsigned." ;;
14347                 -1) echo "Your $zzz is signed."   ;;
14348                 esac
14349                 ;;
14350         esac
14351 else
14352         uidsign=1
14353         echo "(I can't compile the test program--guessing unsigned.)" >&4
14354 fi
14355
14356
14357
14358 echo " "
14359 $echo "Checking the format string to be used for uids..." >&4
14360
14361 case "$uidsign" in
14362 -1)     if $test X"$uidsize" = X"$ivsize"; then
14363                 uidformat="$ivdformat"
14364         else
14365                 if $test X"$uidsize" = X"$longsize"; then
14366                         uidformat='"ld"'
14367                 else
14368                         if $test X"$uidsize" = X"$intsize"; then
14369                                 uidformat='"d"'
14370                         else
14371                                 if $test X"$uidsize" = X"$shortsize"; then
14372                                         uidformat='"hd"'
14373                                 fi
14374                         fi
14375                 fi
14376         fi
14377         ;;
14378 *)      if $test X"$uidsize" = X"$uvsize"; then
14379                 uidformat="$uvuformat"
14380         else
14381                 if $test X"$uidsize" = X"$longsize"; then
14382                         uidformat='"lu"'
14383                 else
14384                         if $test X"$uidsize" = X"$intsize"; then
14385                                 uidformat='"u"'
14386                         else
14387                                 if $test X"$uidsize" = X"$shortsize"; then
14388                                         uidformat='"hu"'
14389                                 fi
14390                         fi
14391                 fi
14392         fi
14393         ;;
14394 esac
14395
14396 : see if dbm.h is available
14397 : see if dbmclose exists
14398 set dbmclose d_dbmclose
14399 eval $inlibc
14400
14401 case "$d_dbmclose" in
14402 $define)
14403         set dbm.h i_dbm
14404         eval $inhdr
14405         case "$i_dbm" in
14406         $define)
14407                 val="$undef"
14408                 set i_rpcsvcdbm
14409                 eval $setvar
14410                 ;;
14411         *)      set rpcsvc/dbm.h i_rpcsvcdbm
14412                 eval $inhdr
14413                 ;;
14414         esac
14415         ;;
14416 *)      echo "We won't be including <dbm.h>"
14417         val="$undef"
14418         set i_dbm
14419         eval $setvar
14420         val="$undef"
14421         set i_rpcsvcdbm
14422         eval $setvar
14423         ;;
14424 esac
14425
14426 : see if this is a sys/file.h system
14427 val=''
14428 set sys/file.h val
14429 eval $inhdr
14430
14431 : do we need to include sys/file.h ?
14432 case "$val" in
14433 "$define")
14434         echo " "
14435         if $h_sysfile; then
14436                 val="$define"
14437                 echo "We'll be including <sys/file.h>." >&4
14438         else
14439                 val="$undef"
14440                 echo "We won't be including <sys/file.h>." >&4
14441         fi
14442         ;;
14443 *)
14444         h_sysfile=false
14445         ;;
14446 esac
14447 set i_sysfile
14448 eval $setvar
14449
14450 : see if fcntl.h is there
14451 val=''
14452 set fcntl.h val
14453 eval $inhdr
14454
14455 : see if we can include fcntl.h
14456 case "$val" in
14457 "$define")
14458         echo " "
14459         if $h_fcntl; then
14460                 val="$define"
14461                 echo "We'll be including <fcntl.h>." >&4
14462         else
14463                 val="$undef"
14464                 if $h_sysfile; then
14465         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
14466                 else
14467                         echo "We won't be including <fcntl.h>." >&4
14468                 fi
14469         fi
14470         ;;
14471 *)
14472         h_fcntl=false
14473         val="$undef"
14474         ;;
14475 esac
14476 set i_fcntl
14477 eval $setvar
14478
14479 : see if this is a iconv.h system
14480 set iconv.h i_iconv
14481 eval $inhdr
14482
14483 : see if this is a ieeefp.h system
14484 set ieeefp.h i_ieeefp
14485 eval $inhdr
14486
14487 : see if this is a libutil.h system
14488 set libutil.h i_libutil
14489 eval $inhdr
14490
14491 : see if locale.h is available
14492 set locale.h i_locale
14493 eval $inhdr
14494
14495 : see if mach cthreads are available
14496 if test "X$usethreads" = "X$define"; then
14497         set mach/cthreads.h i_machcthr
14498         eval $inhdr
14499 else
14500         i_machcthr="$undef"
14501 fi
14502
14503
14504
14505 : see if this is a math.h system
14506 set math.h i_math
14507 eval $inhdr
14508
14509 : see if this is a mntent.h system
14510 set mntent.h i_mntent
14511 eval $inhdr
14512
14513 : see if ndbm.h is available
14514 set ndbm.h t_ndbm
14515 eval $inhdr
14516 case "$t_ndbm" in
14517 $define)
14518         : see if dbm_open exists
14519         set dbm_open d_dbm_open
14520         eval $inlibc
14521         case "$d_dbm_open" in
14522         $undef)
14523                 t_ndbm="$undef"
14524                 echo "We won't be including <ndbm.h>"
14525                 ;;
14526         esac
14527         ;;
14528 esac
14529 val="$t_ndbm"
14530 set i_ndbm
14531 eval $setvar
14532
14533 : see if net/errno.h is available
14534 val=''
14535 set net/errno.h val
14536 eval $inhdr
14537
14538 : Unfortunately, it causes problems on some systems.  Arrgh.
14539 case "$val" in
14540 $define)
14541         cat > try.c <<'EOM'
14542 #include <stdio.h>
14543 #include <errno.h>
14544 #include <net/errno.h>
14545 int func()
14546 {
14547         return ENOTSOCK;
14548 }
14549 EOM
14550         if $cc $ccflags -c try.c >/dev/null 2>&1; then
14551                 echo "We'll be including <net/errno.h>." >&4
14552         else
14553                 echo "We won't be including <net/errno.h>." >&4
14554                 val="$undef"
14555         fi
14556         $rm -f try.* try
14557         ;;
14558 esac
14559 set i_neterrno
14560 eval $setvar
14561
14562 : see if netinet/tcp.h is available
14563 set netinet/tcp.h i_netinettcp
14564 eval $inhdr
14565
14566 : see if this is a poll.h system
14567 set poll.h i_poll
14568 eval $inhdr
14569
14570 : see if this is a prot.h system
14571 set prot.h i_prot
14572 eval $inhdr
14573
14574 echo " "
14575 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4 
14576 $cat <<'EOSH' > Cppsym.know
14577 a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
14578 AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
14579 alliant alpha am29000 AM29000 amiga AMIGAOS AMIX
14580 ansi ANSI_C_SOURCE apollo ardent atarist att386 att3b BeOS
14581 BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
14582 BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
14583 bull c cadmus clipper CMU COFF COMPILER_VERSION
14584 concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
14585 CYGWIN DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
14586 Dynix DynixPTX ELF encore EPI EXTENSIONS FILE_OFFSET_BITS
14587 FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
14588 GNU_SOURCE GNUC GNUC_MINOR GO32 gould GOULD_PN
14589 H3050R H3050RX hbullx20 hcx host_mips
14590 hp200 hp300 hp700 HP700 hp800 hp9000
14591 hp9000s200 hp9000s300 hp9000s400 hp9000s500
14592 hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
14593 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
14594 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
14595 INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
14596 LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
14597 LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
14598 Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
14599 LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
14600 M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
14601 M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
14602 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
14603 MATH_HAS_NO_SIDE_EFFECTS
14604 mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
14605 mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
14606 mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
14607 MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
14608 mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
14609 NetBSD news1500 news1700 news1800 news1900 news3700
14610 news700 news800 news900 NeXT NLS ns16000 ns32000
14611 ns32016 ns32332 ns32k nsc32000
14612 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
14613 pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
14614 pc532 pdp11 PGC PIC plexus PORTAR posix
14615 POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
14616 POSIX_C_SOURCE POSIX_SOURCE POWER
14617 PROTOTYPES PWB pyr QNX R3000 REENTRANT RES Rhapsody RISC6000
14618 riscix riscos RT scs SCO sequent sgi SGI_SOURCE sinix
14619 SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
14620 sony sony_news sonyrisc sparc sparclite spectrum
14621 stardent stdc STDC_EXT stratos sun sun3 sun386
14622 Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
14623 SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
14624 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
14625 sysV68 sysV88 Tek4132 Tek4300 titan
14626 tower tower32 tower32_200 tower32_600 tower32_700
14627 tower32_800 tower32_850 tss
14628 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
14629 ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
14630 unix UNIX95 UNIX99 unixpc unos USGr4 USGr4_2
14631 Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms xenix Xenix286
14632 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
14633 XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
14634 z8000
14635 EOSH
14636 # Maybe put other stuff here too.
14637 cat <<EOSH >>Cppsym.know
14638 $osname
14639 EOSH
14640 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
14641 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
14642 $cat Cppsym.know > Cppsym.c
14643 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | sort | uniq > Cppsym.know
14644 $rm -f Cppsym.a Cppsym.b Cppsym.c
14645 cat <<EOSH > Cppsym
14646 $startsh
14647 if $test \$# -gt 0; then
14648     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
14649     if $test -s Cppsym.got; then
14650         $rm -f Cppsym.got
14651         exit 0
14652     fi
14653     $rm -f Cppsym.got
14654     exit 1
14655 else
14656     $tr " " "$trnl" | ./Cppsym.try
14657     exit 0
14658 fi
14659 EOSH
14660 chmod +x Cppsym
14661 $eunicefix Cppsym
14662 cat <<EOSH > Cppsym.try
14663 $startsh
14664 cat <<'EOCP' > try.c
14665 #include <stdio.h>
14666 int main() {
14667 EOCP
14668 $awk \\
14669 EOSH
14670 cat <<'EOSH' >> Cppsym.try
14671 'length($1) > 0 {
14672     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
14673     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
14674     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
14675     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
14676 }'       >> try.c
14677 echo '}' >> try.c
14678 EOSH
14679 cat <<EOSH >> Cppsym.try
14680 ccflags="$ccflags"
14681 case "$osname-$gccversion" in
14682 irix-) ccflags="\$ccflags -woff 1178" ;;
14683 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
14684 esac
14685 $cc $optimize \$ccflags $ldflags -o try try.c $libs && ./try$exe_ext
14686 EOSH
14687 chmod +x Cppsym.try
14688 $eunicefix Cppsym.try
14689 ./Cppsym < Cppsym.know > Cppsym.true
14690 : now check the C compiler for additional symbols
14691 postprocess_cc_v=''
14692 case "$osname" in
14693 aix) postprocess_cc_v="|$tr , ' '" ;;
14694 esac
14695 $cat >ccsym <<EOS
14696 $startsh
14697 $cat >tmp.c <<EOF
14698 extern int foo;
14699 EOF
14700 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
14701 do
14702         case "\$i" in
14703         -D*) echo "\$i" | $sed 's/^-D//';;
14704         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A\(.*\)(\(.*\))/\1=\2/';;
14705         esac
14706 done
14707 $rm -f try.c
14708 EOS
14709 postprocess_cc_v=''
14710 chmod +x ccsym
14711 $eunicefix ccsym
14712 ./ccsym > ccsym1.raw
14713 if $test -s ccsym1.raw; then
14714        $sort ccsym1.raw | $uniq >ccsym.raw
14715 else
14716        mv ccsym1.raw ccsym.raw
14717 fi
14718
14719 $awk '/\=/ { print $0; next }
14720         { print $0"=1" }' ccsym.raw >ccsym.list
14721 $awk '/\=/ { print $0; next }
14722         { print $0"=1" }' Cppsym.true >ccsym.true
14723 $comm -13 ccsym.true ccsym.list >ccsym.own
14724 $comm -12 ccsym.true ccsym.list >ccsym.com
14725 $comm -23 ccsym.true ccsym.list >ccsym.cpp
14726 also=''
14727 if $test -z ccsym.raw; then
14728         echo "Your C compiler doesn't seem to define any symbols!" >&4
14729         echo " "
14730         echo "However, your C preprocessor defines the following symbols:"
14731         $cat Cppsym.true
14732         ccsymbols=''
14733         cppsymbols=`$cat Cppsym.true`
14734         cppsymbols=`echo $cppsymbols`
14735         cppccsymbols="$cppsymbols"
14736 else
14737         if $test -s ccsym.com; then
14738                 echo "Your C compiler and pre-processor define these symbols:"
14739                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
14740                 also='also '
14741                 symbols='ones'
14742                 cppccsymbols=`$cat ccsym.com`
14743                 cppccsymbols=`echo $cppccsymbols`
14744                 $test "$silent" || sleep 1
14745         fi
14746         if $test -s ccsym.cpp; then
14747                 $test "$also" && echo " "
14748                 echo "Your C pre-processor ${also}defines the following symbols:"
14749                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
14750                 also='further '
14751                 cppsymbols=`$cat ccsym.cpp`
14752                 cppsymbols=`echo $cppsymbols`
14753                 $test "$silent" || sleep 1
14754         fi
14755         if $test -s ccsym.own; then
14756                 $test "$also" && echo " "
14757                 echo "Your C compiler ${also}defines the following cpp symbols:"
14758                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
14759                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
14760                 ccsymbols=`$cat ccsym.own`
14761                 ccsymbols=`echo $ccsymbols`
14762                 $test "$silent" || sleep 1
14763         fi
14764 fi
14765 $rm -f ccsym* Cppsym.*
14766
14767 : see if this is a termio system
14768 val="$undef"
14769 val2="$undef"
14770 val3="$undef"
14771 if $test `./findhdr termios.h`; then
14772         set tcsetattr i_termios
14773         eval $inlibc
14774         val3="$i_termios"
14775 fi
14776 echo " "
14777 case "$val3" in
14778 "$define") echo "You have POSIX termios.h... good!" >&4;;
14779 *) if ./Cppsym pyr; then
14780                 case "`/bin/universe`" in
14781                 ucb) if $test `./findhdr sgtty.h`; then
14782                                 val2="$define"
14783                                 echo "<sgtty.h> found." >&4
14784                         else
14785                                 echo "System is pyramid with BSD universe."
14786                                 echo "<sgtty.h> not found--you could have problems." >&4
14787                         fi;;
14788                 *) if $test `./findhdr termio.h`; then
14789                                 val="$define"
14790                                 echo "<termio.h> found." >&4
14791                         else
14792                                 echo "System is pyramid with USG universe."
14793                                 echo "<termio.h> not found--you could have problems." >&4
14794                         fi;;
14795                 esac
14796         elif ./usg; then
14797                 if $test `./findhdr termio.h`; then
14798                         echo "<termio.h> found." >&4
14799                         val="$define"
14800                 elif $test `./findhdr sgtty.h`; then
14801                         echo "<sgtty.h> found." >&4
14802                         val2="$define"
14803                 else
14804 echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
14805                 fi
14806         else
14807                 if $test `./findhdr sgtty.h`; then
14808                         echo "<sgtty.h> found." >&4
14809                         val2="$define"
14810                 elif $test `./findhdr termio.h`; then
14811                         echo "<termio.h> found." >&4
14812                         val="$define"
14813                 else
14814 echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
14815                 fi
14816         fi;;
14817 esac
14818 set i_termio; eval $setvar
14819 val=$val2; set i_sgtty; eval $setvar
14820 val=$val3; set i_termios; eval $setvar
14821
14822 : see if this is a shadow.h system
14823 set shadow.h i_shadow
14824 eval $inhdr
14825
14826 : see if this is a socks.h system
14827 set socks.h i_socks
14828 eval $inhdr
14829
14830 : see if stdarg is available
14831 echo " "
14832 if $test `./findhdr stdarg.h`; then
14833         echo "<stdarg.h> found." >&4
14834         valstd="$define"
14835 else
14836         echo "<stdarg.h> NOT found." >&4
14837         valstd="$undef"
14838 fi
14839
14840 : see if varags is available
14841 echo " "
14842 if $test `./findhdr varargs.h`; then
14843         echo "<varargs.h> found." >&4
14844 else
14845         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
14846 fi
14847
14848 : set up the varargs testing programs
14849 $cat > varargs.c <<EOP
14850 #ifdef I_STDARG
14851 #include <stdarg.h>
14852 #endif
14853 #ifdef I_VARARGS
14854 #include <varargs.h>
14855 #endif
14856
14857 #ifdef I_STDARG
14858 int f(char *p, ...)
14859 #else
14860 int f(va_alist)
14861 va_dcl
14862 #endif
14863 {
14864         va_list ap;
14865 #ifndef I_STDARG
14866         char *p;
14867 #endif
14868 #ifdef I_STDARG
14869         va_start(ap,p);
14870 #else
14871         va_start(ap);
14872         p = va_arg(ap, char *);
14873 #endif
14874         va_end(ap);
14875 }
14876 EOP
14877 $cat > varargs <<EOP
14878 $startsh
14879 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
14880         echo "true"
14881 else
14882         echo "false"
14883 fi
14884 $rm -f varargs$_o
14885 EOP
14886 chmod +x varargs
14887
14888 : now check which varargs header should be included
14889 echo " "
14890 i_varhdr=''
14891 case "$valstd" in
14892 "$define")
14893         if `./varargs I_STDARG`; then
14894                 val='stdarg.h'
14895         elif `./varargs I_VARARGS`; then
14896                 val='varargs.h'
14897         fi
14898         ;;
14899 *)
14900         if `./varargs I_VARARGS`; then
14901                 val='varargs.h'
14902         fi
14903         ;;
14904 esac
14905 case "$val" in
14906 '')
14907 echo "I could not find the definition for va_dcl... You have problems..." >&4
14908         val="$undef"; set i_stdarg; eval $setvar
14909         val="$undef"; set i_varargs; eval $setvar
14910         ;;
14911 *) 
14912         set i_varhdr
14913         eval $setvar
14914         case "$i_varhdr" in
14915         stdarg.h)
14916                 val="$define"; set i_stdarg; eval $setvar
14917                 val="$undef"; set i_varargs; eval $setvar
14918                 ;;
14919         varargs.h)
14920                 val="$undef"; set i_stdarg; eval $setvar
14921                 val="$define"; set i_varargs; eval $setvar
14922                 ;;
14923         esac
14924         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
14925 esac
14926 $rm -f varargs*
14927
14928 : see if stddef is available
14929 set stddef.h i_stddef
14930 eval $inhdr
14931
14932 : see if this is a sunmath.h system
14933 set sunmath.h i_sunmath
14934 eval $inhdr
14935
14936 : see if sys/access.h is available
14937 set sys/access.h i_sysaccess
14938 eval $inhdr
14939
14940 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
14941 set sys/filio.h i_sysfilio
14942 eval $inhdr
14943 echo " "
14944 if $test `./findhdr sys/ioctl.h`; then
14945         val="$define"
14946         echo '<sys/ioctl.h> found.' >&4
14947 else
14948         val="$undef"
14949         if $test $i_sysfilio = "$define"; then
14950             echo '<sys/ioctl.h> NOT found.' >&4
14951         else
14952                 $test $i_sgtty = "$define" && xxx="sgtty.h"
14953                 $test $i_termio = "$define" && xxx="termio.h"
14954                 $test $i_termios = "$define" && xxx="termios.h"
14955 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
14956         fi
14957 fi
14958 set i_sysioctl
14959 eval $setvar
14960
14961
14962 : see if this is a syslog.h system
14963 set syslog.h i_syslog
14964 eval $inhdr
14965
14966
14967 : see if this is a sys/mode.h system
14968 set sys/mode.h i_sysmode
14969 eval $inhdr
14970
14971 : see if sys/resource.h has to be included
14972 set sys/resource.h i_sysresrc
14973 eval $inhdr
14974
14975 : see if sys/security.h is available
14976 set sys/security.h i_syssecrt
14977 eval $inhdr
14978
14979 : see if this is a sys/statvfs.h system
14980 set sys/statvfs.h i_sysstatvfs
14981 eval $inhdr
14982
14983 : see if this is a sys/uio.h system
14984 set sys/uio.h i_sysuio
14985 eval $inhdr
14986
14987 : see if this is a sys/un.h system
14988 set sys/un.h i_sysun
14989 eval $inhdr
14990
14991
14992 : see if this is a sys/utsname.h system
14993 set sys/utsname.h i_sysutsname
14994 eval $inhdr
14995
14996 : see if this is a syswait system
14997 set sys/wait.h i_syswait
14998 eval $inhdr
14999
15000 : see if this is a ustat.h system
15001 set ustat.h i_ustat
15002 eval $inhdr
15003
15004 : see if this is an utime system
15005 set utime.h i_utime
15006 eval $inhdr
15007
15008 : see if this is a values.h system
15009 set values.h i_values
15010 eval $inhdr
15011
15012 : see if this is a vfork system
15013 case "$d_vfork" in
15014 "$define")
15015         set vfork.h i_vfork
15016         eval $inhdr
15017         ;;
15018 *)
15019         i_vfork="$undef"
15020         ;;
15021 esac
15022
15023 : see if gdbm.h is available
15024 set gdbm.h t_gdbm
15025 eval $inhdr
15026 case "$t_gdbm" in
15027 $define)
15028         : see if gdbm_open exists
15029         set gdbm_open d_gdbm_open
15030         eval $inlibc
15031         case "$d_gdbm_open" in
15032         $undef)
15033                 t_gdbm="$undef"
15034                 echo "We won't be including <gdbm.h>"
15035                 ;;
15036         esac
15037         ;;
15038 esac
15039 val="$t_gdbm"
15040 set i_gdbm
15041 eval $setvar
15042
15043 echo " "
15044 echo "Looking for extensions..." >&4
15045 : If we are using the old config.sh, known_extensions may contain
15046 : old or inaccurate or duplicate values.
15047 known_extensions=''
15048 nonxs_extensions=''
15049 : We do not use find because it might not be available.
15050 : We do not just use MANIFEST because the user may have dropped
15051 : some additional extensions into the source tree and expect them
15052 : to be built.
15053
15054 : Function to recursively find available extensions, ignoring DynaLoader
15055 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
15056 find_extensions='
15057     for xxx in *; do
15058        case "$xxx" in
15059            DynaLoader|dynaload) ;;
15060            *)
15061            if $test -f $xxx/$xxx.xs; then
15062                known_extensions="$known_extensions $1$xxx";
15063            elif $test -f $xxx/Makefile.PL; then
15064                nonxs_extensions="$nonxs_extensions $1$xxx";
15065            else
15066                if $test -d $xxx -a $# -lt 10; then
15067                    set $1$xxx/ $*;
15068                    cd $xxx;
15069                    eval $find_extensions;
15070                    cd ..;
15071                    shift;
15072                fi;
15073            fi
15074            ;;
15075        esac;
15076     done'
15077 tdir=`pwd`
15078 cd $rsrc/ext
15079 set X
15080 shift
15081 eval $find_extensions
15082 set X $nonxs_extensions
15083 shift
15084 nonxs_extensions="$*"
15085 set X $known_extensions
15086 shift
15087 known_extensions="$*"
15088 cd $tdir
15089
15090 : Now see which are supported on this system.
15091 avail_ext=''
15092 for xxx in $known_extensions ; do
15093         case "$xxx" in
15094         DB_File|db_file)
15095                 case "$i_db" in
15096                 $define) avail_ext="$avail_ext $xxx" ;;
15097                 esac
15098                 ;;
15099         GDBM_File|gdbm_fil)
15100                 case "$i_gdbm" in 
15101                 $define) avail_ext="$avail_ext $xxx" ;;
15102                 esac
15103                 ;;
15104         NDBM_File|ndbm_fil)
15105                 case "$i_ndbm" in
15106                 $define)
15107                     case "$osname-$use64bitint" in
15108                     hpux-define)
15109                         case "$libs" in
15110                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
15111                         esac
15112                         ;;
15113                     *) avail_ext="$avail_ext $xxx" ;;
15114                     esac
15115                     ;;
15116                 esac
15117                 ;;
15118         ODBM_File|odbm_fil) 
15119                 case "${i_dbm}${i_rpcsvcdbm}" in
15120                 *"${define}"*)
15121                     case "$osname-$use64bitint" in
15122                     hpux-define)
15123                         case "$libs" in
15124                         *-ldbm*) avail_ext="$avail_ext $xxx" ;;
15125                         esac
15126                         ;;
15127                     *) avail_ext="$avail_ext $xxx" ;;
15128                     esac
15129                     ;;
15130                 esac
15131                 ;;
15132         POSIX|posix)
15133                 case "$useposix" in
15134                 true|define|y) avail_ext="$avail_ext $xxx" ;;
15135                 esac
15136                 ;;
15137         Opcode|opcode)
15138                 case "$useopcode" in
15139                 true|define|y) avail_ext="$avail_ext $xxx" ;;
15140                 esac
15141                 ;;
15142         Socket|socket)
15143                 case "$d_socket" in 
15144                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
15145                 esac
15146                 ;;
15147         Sys/Syslog|sys/syslog)
15148                 : XXX syslog requires socket
15149                 case "$d_socket" in 
15150                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
15151                 esac
15152                 ;;
15153         Thread|thread)
15154                 case "$usethreads" in 
15155                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
15156                 esac
15157                 ;;
15158         IPC/SysV|ipc/sysv)
15159                 : XXX Do we need a useipcsysv variable here
15160                 case "${d_msg}${d_sem}${d_shm}" in 
15161                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
15162                 esac
15163                 ;;
15164         *)      avail_ext="$avail_ext $xxx"
15165                 ;;
15166         esac
15167 done
15168
15169 set X $avail_ext
15170 shift
15171 avail_ext="$*"
15172
15173 : Now see which nonxs extensions are supported on this system.
15174 : For now assume all are.
15175 nonxs_ext=''
15176 for xxx in $nonxs_extensions ; do
15177         case "$xxx" in
15178         *)      nonxs_ext="$nonxs_ext $xxx"
15179                 ;;
15180         esac
15181 done
15182
15183 set X $nonxs_ext
15184 shift
15185 nonxs_ext="$*"
15186
15187 case $usedl in
15188 $define)
15189         $cat <<EOM
15190 A number of extensions are supplied with $package.  You may choose to
15191 compile these extensions for dynamic loading (the default), compile
15192 them into the $package executable (static loading), or not include
15193 them at all.  Answer "none" to include no extensions.
15194 Note that DynaLoader is always built and need not be mentioned here.
15195
15196 EOM
15197         case "$dynamic_ext" in
15198         '') dflt="$avail_ext" ;;
15199         *)      dflt="$dynamic_ext"
15200                 # Perhaps we are reusing an old out-of-date config.sh.
15201                 case "$hint" in
15202                 previous)
15203                         if test X"$dynamic_ext" != X"$avail_ext"; then
15204                                 $cat <<EOM
15205 NOTICE:  Your previous config.sh list may be incorrect. 
15206 The extensions now available to you are 
15207         ${avail_ext}
15208 but the default list from your previous config.sh is
15209         ${dynamic_ext} 
15210
15211 EOM
15212                         fi
15213                         ;;
15214                 esac
15215                 ;;
15216         esac
15217         case "$dflt" in
15218         '')     dflt=none;;
15219         esac
15220         rp="What extensions do you wish to load dynamically?"
15221         . ./myread
15222         case "$ans" in
15223         none) dynamic_ext=' ' ;;
15224         *) dynamic_ext="$ans" ;;
15225         esac
15226
15227         case "$static_ext" in
15228         '')
15229                 : Exclude those already listed in dynamic linking
15230                 dflt=''
15231                 for xxx in $avail_ext; do
15232                         case " $dynamic_ext " in
15233                         *" $xxx "*) ;;
15234                         *) dflt="$dflt $xxx" ;;
15235                         esac
15236                 done
15237                 set X $dflt
15238                 shift
15239                 dflt="$*"
15240                 ;;
15241         *)  dflt="$static_ext" 
15242                 ;;
15243         esac
15244
15245         case "$dflt" in
15246         '')     dflt=none;;
15247         esac
15248         rp="What extensions do you wish to load statically?"
15249         . ./myread
15250         case "$ans" in
15251         none) static_ext=' ' ;;
15252         *) static_ext="$ans" ;;
15253         esac
15254         ;;
15255 *)
15256         $cat <<EOM
15257 A number of extensions are supplied with $package.  Answer "none" 
15258 to include no extensions. 
15259 Note that DynaLoader is always built and need not be mentioned here.
15260
15261 EOM
15262         case "$static_ext" in
15263         '') dflt="$avail_ext" ;;
15264         *)      dflt="$static_ext"
15265                 # Perhaps we are reusing an old out-of-date config.sh.
15266                 case "$hint" in
15267                 previous)
15268                         if test X"$static_ext" != X"$avail_ext"; then
15269                                 $cat <<EOM
15270 NOTICE:  Your previous config.sh list may be incorrect. 
15271 The extensions now available to you are 
15272         ${avail_ext}
15273 but the default list from your previous config.sh is
15274         ${static_ext} 
15275
15276 EOM
15277                         fi
15278                         ;;
15279                 esac
15280                 ;;
15281         esac
15282         : Exclude those that are not xs extensions
15283         case "$dflt" in
15284         '')     dflt=none;;
15285         esac
15286         rp="What extensions do you wish to include?"
15287         . ./myread
15288         case "$ans" in
15289         none) static_ext=' ' ;;
15290         *) static_ext="$ans" ;;
15291         esac
15292         ;;
15293 esac
15294
15295 set X $dynamic_ext $static_ext $nonxs_ext
15296 shift
15297 extensions="$*"
15298
15299 : Remove build directory name from cppstdin so it can be used from
15300 : either the present location or the final installed location.
15301 echo " "
15302 : Get out of the UU directory to get correct path name.
15303 cd ..
15304 case "$cppstdin" in
15305 `pwd`/cppstdin)
15306         echo "Stripping down cppstdin path name"
15307         cppstdin=cppstdin
15308         ;;
15309 esac
15310 cd UU
15311
15312 : end of configuration questions
15313 echo " "
15314 echo "End of configuration questions."
15315 echo " "
15316
15317 : back to where it started
15318 if test -d ../UU; then
15319         cd ..
15320 fi
15321
15322 : configuration may be patched via a 'config.over' file
15323 if $test -f config.over; then
15324         echo " "
15325         dflt=y
15326         rp='I see a config.over file.  Do you wish to load it?'
15327         . UU/myread
15328         case "$ans" in
15329         n*) echo "OK, I'll ignore it.";;
15330         *)      . ./config.over
15331                 echo "Configuration override changes have been loaded."
15332                 ;;
15333         esac
15334 fi
15335
15336 : in case they want portability, strip down executable paths
15337 case "$d_portable" in
15338 "$define")
15339         echo " "
15340         echo "Stripping down executable paths..." >&4
15341         for file in $loclist $trylist; do
15342                 eval temp=\$$file
15343                 eval $file=`basename $temp`
15344         done
15345         ;;
15346 esac
15347
15348 : create config.sh file
15349 echo " "
15350 echo "Creating config.sh..." >&4
15351 $spitshell <<EOT >config.sh
15352 $startsh
15353 #
15354 # This file was produced by running the Configure script. It holds all the
15355 # definitions figured out by Configure. Should you modify one of these values,
15356 # do not forget to propagate your changes by running "Configure -der". You may
15357 # instead choose to run each of the .SH files by yourself, or "Configure -S".
15358 #
15359
15360 # Package name      : $package
15361 # Source directory  : $src
15362 # Configuration time: $cf_time
15363 # Configured by     : $cf_by
15364 # Target system     : $myuname
15365
15366 Author='$Author'
15367 Date='$Date'
15368 Header='$Header'
15369 Id='$Id'
15370 Locker='$Locker'
15371 Log='$Log'
15372 Mcc='$Mcc'
15373 RCSfile='$RCSfile'
15374 Revision='$Revision'
15375 Source='$Source'
15376 State='$State'
15377 _a='$_a'
15378 _exe='$_exe'
15379 _o='$_o'
15380 afs='$afs'
15381 alignbytes='$alignbytes'
15382 ansi2knr='$ansi2knr'
15383 aphostname='$aphostname'
15384 api_revision='$api_revision'
15385 api_subversion='$api_subversion'
15386 api_version='$api_version'
15387 api_versionstring='$api_versionstring'
15388 ar='$ar'
15389 archlib='$archlib'
15390 archlibexp='$archlibexp'
15391 archname64='$archname64'
15392 archname='$archname'
15393 archobjs='$archobjs'
15394 awk='$awk'
15395 baserev='$baserev'
15396 bash='$bash'
15397 bin='$bin'
15398 bincompat5005='$bincompat5005'
15399 binexp='$binexp'
15400 bison='$bison'
15401 byacc='$byacc'
15402 byteorder='$byteorder'
15403 c='$c'
15404 castflags='$castflags'
15405 cat='$cat'
15406 cc='$cc'
15407 cccdlflags='$cccdlflags'
15408 ccdlflags='$ccdlflags'
15409 ccflags='$ccflags'
15410 ccflags_uselargefiles='$ccflags_uselargefiles'
15411 ccname='$ccname'
15412 ccsymbols='$ccsymbols'
15413 cf_by='$cf_by'
15414 cf_email='$cf_email'
15415 cf_time='$cf_time'
15416 charsize='$charsize'
15417 chgrp='$chgrp'
15418 chmod='$chmod'
15419 chown='$chown'
15420 clocktype='$clocktype'
15421 comm='$comm'
15422 compress='$compress'
15423 contains='$contains'
15424 cp='$cp'
15425 cpio='$cpio'
15426 cpp='$cpp'
15427 cpp_stuff='$cpp_stuff'
15428 cppccsymbols='$cppccsymbols'
15429 cppflags='$cppflags'
15430 cpplast='$cpplast'
15431 cppminus='$cppminus'
15432 cpprun='$cpprun'
15433 cppstdin='$cppstdin'
15434 cppsymbols='$cppsymbols'
15435 crosscompile='$crosscompile'
15436 cryptlib='$cryptlib'
15437 csh='$csh'
15438 d_Gconvert='$d_Gconvert'
15439 d_PRIEldbl='$d_PRIEldbl'
15440 d_PRIFldbl='$d_PRIFldbl'
15441 d_PRIGldbl='$d_PRIGldbl'
15442 d_PRIX64='$d_PRIX64'
15443 d_PRId64='$d_PRId64'
15444 d_PRIeldbl='$d_PRIeldbl'
15445 d_PRIfldbl='$d_PRIfldbl'
15446 d_PRIgldbl='$d_PRIgldbl'
15447 d_PRIi64='$d_PRIi64'
15448 d_PRIo64='$d_PRIo64'
15449 d_PRIu64='$d_PRIu64'
15450 d_PRIx64='$d_PRIx64'
15451 d_access='$d_access'
15452 d_accessx='$d_accessx'
15453 d_alarm='$d_alarm'
15454 d_archlib='$d_archlib'
15455 d_atolf='$d_atolf'
15456 d_atoll='$d_atoll'
15457 d_attribut='$d_attribut'
15458 d_bcmp='$d_bcmp'
15459 d_bcopy='$d_bcopy'
15460 d_bincompat5005='$d_bincompat5005'
15461 d_bsd='$d_bsd'
15462 d_bsdgetpgrp='$d_bsdgetpgrp'
15463 d_bsdsetpgrp='$d_bsdsetpgrp'
15464 d_bzero='$d_bzero'
15465 d_casti32='$d_casti32'
15466 d_castneg='$d_castneg'
15467 d_charvspr='$d_charvspr'
15468 d_chown='$d_chown'
15469 d_chroot='$d_chroot'
15470 d_chsize='$d_chsize'
15471 d_closedir='$d_closedir'
15472 d_const='$d_const'
15473 d_crypt='$d_crypt'
15474 d_csh='$d_csh'
15475 d_cuserid='$d_cuserid'
15476 d_dbl_dig='$d_dbl_dig'
15477 d_difftime='$d_difftime'
15478 d_dirnamlen='$d_dirnamlen'
15479 d_dlerror='$d_dlerror'
15480 d_dlopen='$d_dlopen'
15481 d_dlsymun='$d_dlsymun'
15482 d_dosuid='$d_dosuid'
15483 d_drand48proto='$d_drand48proto'
15484 d_dup2='$d_dup2'
15485 d_eaccess='$d_eaccess'
15486 d_endgrent='$d_endgrent'
15487 d_endhent='$d_endhent'
15488 d_endnent='$d_endnent'
15489 d_endpent='$d_endpent'
15490 d_endpwent='$d_endpwent'
15491 d_endsent='$d_endsent'
15492 d_eofnblk='$d_eofnblk'
15493 d_eunice='$d_eunice'
15494 d_fchmod='$d_fchmod'
15495 d_fchown='$d_fchown'
15496 d_fcntl='$d_fcntl'
15497 d_fd_macros='$d_fd_macros'
15498 d_fd_set='$d_fd_set'
15499 d_fds_bits='$d_fds_bits'
15500 d_fgetpos='$d_fgetpos'
15501 d_flexfnam='$d_flexfnam'
15502 d_flock='$d_flock'
15503 d_fork='$d_fork'
15504 d_fpathconf='$d_fpathconf'
15505 d_fpos64_t='$d_fpos64_t'
15506 d_frexpl='$d_frexpl'
15507 d_fs_data_s='$d_fs_data_s'
15508 d_fseeko='$d_fseeko'
15509 d_fsetpos='$d_fsetpos'
15510 d_fstatfs='$d_fstatfs'
15511 d_fstatvfs='$d_fstatvfs'
15512 d_ftello='$d_ftello'
15513 d_ftime='$d_ftime'
15514 d_getcwd='$d_getcwd'
15515 d_getespwnam='$d_getespwnam'
15516 d_getfsstat='$d_getfsstat'
15517 d_getgrent='$d_getgrent'
15518 d_getgrps='$d_getgrps'
15519 d_gethbyaddr='$d_gethbyaddr'
15520 d_gethbyname='$d_gethbyname'
15521 d_gethent='$d_gethent'
15522 d_gethname='$d_gethname'
15523 d_gethostprotos='$d_gethostprotos'
15524 d_getlogin='$d_getlogin'
15525 d_getmnt='$d_getmnt'
15526 d_getmntent='$d_getmntent'
15527 d_getnbyaddr='$d_getnbyaddr'
15528 d_getnbyname='$d_getnbyname'
15529 d_getnent='$d_getnent'
15530 d_getnetprotos='$d_getnetprotos'
15531 d_getpbyname='$d_getpbyname'
15532 d_getpbynumber='$d_getpbynumber'
15533 d_getpent='$d_getpent'
15534 d_getpgid='$d_getpgid'
15535 d_getpgrp2='$d_getpgrp2'
15536 d_getpgrp='$d_getpgrp'
15537 d_getppid='$d_getppid'
15538 d_getprior='$d_getprior'
15539 d_getprotoprotos='$d_getprotoprotos'
15540 d_getprpwnam='$d_getprpwnam'
15541 d_getpwent='$d_getpwent'
15542 d_getsbyname='$d_getsbyname'
15543 d_getsbyport='$d_getsbyport'
15544 d_getsent='$d_getsent'
15545 d_getservprotos='$d_getservprotos'
15546 d_getspnam='$d_getspnam'
15547 d_gettimeod='$d_gettimeod'
15548 d_gnulibc='$d_gnulibc'
15549 d_grpasswd='$d_grpasswd'
15550 d_hasmntopt='$d_hasmntopt'
15551 d_htonl='$d_htonl'
15552 d_iconv='$d_iconv'
15553 d_index='$d_index'
15554 d_inetaton='$d_inetaton'
15555 d_int64_t='$d_int64_t'
15556 d_isascii='$d_isascii'
15557 d_isnan='$d_isnan'
15558 d_isnanl='$d_isnanl'
15559 d_killpg='$d_killpg'
15560 d_lchown='$d_lchown'
15561 d_ldbl_dig='$d_ldbl_dig'
15562 d_link='$d_link'
15563 d_locconv='$d_locconv'
15564 d_lockf='$d_lockf'
15565 d_longdbl='$d_longdbl'
15566 d_longlong='$d_longlong'
15567 d_lseekproto='$d_lseekproto'
15568 d_lstat='$d_lstat'
15569 d_madvise='$d_madvise'
15570 d_mblen='$d_mblen'
15571 d_mbstowcs='$d_mbstowcs'
15572 d_mbtowc='$d_mbtowc'
15573 d_memchr='$d_memchr'
15574 d_memcmp='$d_memcmp'
15575 d_memcpy='$d_memcpy'
15576 d_memmove='$d_memmove'
15577 d_memset='$d_memset'
15578 d_mkdir='$d_mkdir'
15579 d_mkdtemp='$d_mkdtemp'
15580 d_mkfifo='$d_mkfifo'
15581 d_mkstemp='$d_mkstemp'
15582 d_mkstemps='$d_mkstemps'
15583 d_mktime='$d_mktime'
15584 d_mmap='$d_mmap'
15585 d_modfl='$d_modfl'
15586 d_mprotect='$d_mprotect'
15587 d_msg='$d_msg'
15588 d_msg_ctrunc='$d_msg_ctrunc'
15589 d_msg_dontroute='$d_msg_dontroute'
15590 d_msg_oob='$d_msg_oob'
15591 d_msg_peek='$d_msg_peek'
15592 d_msg_proxy='$d_msg_proxy'
15593 d_msgctl='$d_msgctl'
15594 d_msgget='$d_msgget'
15595 d_msgrcv='$d_msgrcv'
15596 d_msgsnd='$d_msgsnd'
15597 d_msync='$d_msync'
15598 d_munmap='$d_munmap'
15599 d_mymalloc='$d_mymalloc'
15600 d_nice='$d_nice'
15601 d_nv_preserves_uv='$d_nv_preserves_uv'
15602 d_nv_preserves_uv_bits='$d_nv_preserves_uv_bits'
15603 d_off64_t='$d_off64_t'
15604 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
15605 d_oldpthreads='$d_oldpthreads'
15606 d_oldsock='$d_oldsock'
15607 d_open3='$d_open3'
15608 d_pathconf='$d_pathconf'
15609 d_pause='$d_pause'
15610 d_perl_otherlibdirs='$d_perl_otherlibdirs'
15611 d_phostname='$d_phostname'
15612 d_pipe='$d_pipe'
15613 d_poll='$d_poll'
15614 d_portable='$d_portable'
15615 d_pthread_yield='$d_pthread_yield'
15616 d_pwage='$d_pwage'
15617 d_pwchange='$d_pwchange'
15618 d_pwclass='$d_pwclass'
15619 d_pwcomment='$d_pwcomment'
15620 d_pwexpire='$d_pwexpire'
15621 d_pwgecos='$d_pwgecos'
15622 d_pwpasswd='$d_pwpasswd'
15623 d_pwquota='$d_pwquota'
15624 d_qgcvt='$d_qgcvt'
15625 d_quad='$d_quad'
15626 d_readdir='$d_readdir'
15627 d_readlink='$d_readlink'
15628 d_rename='$d_rename'
15629 d_rewinddir='$d_rewinddir'
15630 d_rmdir='$d_rmdir'
15631 d_safebcpy='$d_safebcpy'
15632 d_safemcpy='$d_safemcpy'
15633 d_sanemcmp='$d_sanemcmp'
15634 d_sched_yield='$d_sched_yield'
15635 d_scm_rights='$d_scm_rights'
15636 d_seekdir='$d_seekdir'
15637 d_select='$d_select'
15638 d_sem='$d_sem'
15639 d_semctl='$d_semctl'
15640 d_semctl_semid_ds='$d_semctl_semid_ds'
15641 d_semctl_semun='$d_semctl_semun'
15642 d_semget='$d_semget'
15643 d_semop='$d_semop'
15644 d_setegid='$d_setegid'
15645 d_seteuid='$d_seteuid'
15646 d_setgrent='$d_setgrent'
15647 d_setgrps='$d_setgrps'
15648 d_sethent='$d_sethent'
15649 d_setlinebuf='$d_setlinebuf'
15650 d_setlocale='$d_setlocale'
15651 d_setnent='$d_setnent'
15652 d_setpent='$d_setpent'
15653 d_setpgid='$d_setpgid'
15654 d_setpgrp2='$d_setpgrp2'
15655 d_setpgrp='$d_setpgrp'
15656 d_setprior='$d_setprior'
15657 d_setproctitle='$d_setproctitle'
15658 d_setpwent='$d_setpwent'
15659 d_setregid='$d_setregid'
15660 d_setresgid='$d_setresgid'
15661 d_setresuid='$d_setresuid'
15662 d_setreuid='$d_setreuid'
15663 d_setrgid='$d_setrgid'
15664 d_setruid='$d_setruid'
15665 d_setsent='$d_setsent'
15666 d_setsid='$d_setsid'
15667 d_setvbuf='$d_setvbuf'
15668 d_sfio='$d_sfio'
15669 d_shm='$d_shm'
15670 d_shmat='$d_shmat'
15671 d_shmatprototype='$d_shmatprototype'
15672 d_shmctl='$d_shmctl'
15673 d_shmdt='$d_shmdt'
15674 d_shmget='$d_shmget'
15675 d_sigaction='$d_sigaction'
15676 d_sigsetjmp='$d_sigsetjmp'
15677 d_socket='$d_socket'
15678 d_socklen_t='$d_socklen_t'
15679 d_sockpair='$d_sockpair'
15680 d_socks5_init='$d_socks5_init'
15681 d_sqrtl='$d_sqrtl'
15682 d_statblks='$d_statblks'
15683 d_statfs_f_flags='$d_statfs_f_flags'
15684 d_statfs_s='$d_statfs_s'
15685 d_statvfs='$d_statvfs'
15686 d_stdio_cnt_lval='$d_stdio_cnt_lval'
15687 d_stdio_ptr_lval='$d_stdio_ptr_lval'
15688 d_stdio_stream_array='$d_stdio_stream_array'
15689 d_stdiobase='$d_stdiobase'
15690 d_stdstdio='$d_stdstdio'
15691 d_strchr='$d_strchr'
15692 d_strcoll='$d_strcoll'
15693 d_strctcpy='$d_strctcpy'
15694 d_strerrm='$d_strerrm'
15695 d_strerror='$d_strerror'
15696 d_strtod='$d_strtod'
15697 d_strtol='$d_strtol'
15698 d_strtold='$d_strtold'
15699 d_strtoll='$d_strtoll'
15700 d_strtoul='$d_strtoul'
15701 d_strtoull='$d_strtoull'
15702 d_strtouq='$d_strtouq'
15703 d_strxfrm='$d_strxfrm'
15704 d_suidsafe='$d_suidsafe'
15705 d_symlink='$d_symlink'
15706 d_syscall='$d_syscall'
15707 d_sysconf='$d_sysconf'
15708 d_sysernlst='$d_sysernlst'
15709 d_syserrlst='$d_syserrlst'
15710 d_system='$d_system'
15711 d_tcgetpgrp='$d_tcgetpgrp'
15712 d_tcsetpgrp='$d_tcsetpgrp'
15713 d_telldir='$d_telldir'
15714 d_telldirproto='$d_telldirproto'
15715 d_time='$d_time'
15716 d_times='$d_times'
15717 d_truncate='$d_truncate'
15718 d_tzname='$d_tzname'
15719 d_umask='$d_umask'
15720 d_uname='$d_uname'
15721 d_union_semun='$d_union_semun'
15722 d_ustat='$d_ustat'
15723 d_vendorarch='$d_vendorarch'
15724 d_vendorbin='$d_vendorbin'
15725 d_vendorlib='$d_vendorlib'
15726 d_vfork='$d_vfork'
15727 d_void_closedir='$d_void_closedir'
15728 d_voidsig='$d_voidsig'
15729 d_voidtty='$d_voidtty'
15730 d_volatile='$d_volatile'
15731 d_vprintf='$d_vprintf'
15732 d_wait4='$d_wait4'
15733 d_waitpid='$d_waitpid'
15734 d_wcstombs='$d_wcstombs'
15735 d_wctomb='$d_wctomb'
15736 d_xenix='$d_xenix'
15737 date='$date'
15738 db_hashtype='$db_hashtype'
15739 db_prefixtype='$db_prefixtype'
15740 defvoidused='$defvoidused'
15741 direntrytype='$direntrytype'
15742 dlext='$dlext'
15743 dlsrc='$dlsrc'
15744 doublesize='$doublesize'
15745 drand01='$drand01'
15746 dynamic_ext='$dynamic_ext'
15747 eagain='$eagain'
15748 ebcdic='$ebcdic'
15749 echo='$echo'
15750 egrep='$egrep'
15751 emacs='$emacs'
15752 eunicefix='$eunicefix'
15753 exe_ext='$exe_ext'
15754 expr='$expr'
15755 extensions='$extensions'
15756 fflushNULL='$fflushNULL'
15757 fflushall='$fflushall'
15758 find='$find'
15759 firstmakefile='$firstmakefile'
15760 flex='$flex'
15761 fpossize='$fpossize'
15762 fpostype='$fpostype'
15763 freetype='$freetype'
15764 full_ar='$full_ar'
15765 full_csh='$full_csh'
15766 full_sed='$full_sed'
15767 gccosandvers='$gccosandvers'
15768 gccversion='$gccversion'
15769 gidformat='$gidformat'
15770 gidsign='$gidsign'
15771 gidsize='$gidsize'
15772 gidtype='$gidtype'
15773 glibpth='$glibpth'
15774 grep='$grep'
15775 groupcat='$groupcat'
15776 groupstype='$groupstype'
15777 gzip='$gzip'
15778 h_fcntl='$h_fcntl'
15779 h_sysfile='$h_sysfile'
15780 hint='$hint'
15781 hostcat='$hostcat'
15782 huge='$huge'
15783 i16size='$i16size'
15784 i16type='$i16type'
15785 i32size='$i32size'
15786 i32type='$i32type'
15787 i64size='$i64size'
15788 i64type='$i64type'
15789 i8size='$i8size'
15790 i8type='$i8type'
15791 i_arpainet='$i_arpainet'
15792 i_bsdioctl='$i_bsdioctl'
15793 i_db='$i_db'
15794 i_dbm='$i_dbm'
15795 i_dirent='$i_dirent'
15796 i_dld='$i_dld'
15797 i_dlfcn='$i_dlfcn'
15798 i_fcntl='$i_fcntl'
15799 i_float='$i_float'
15800 i_gdbm='$i_gdbm'
15801 i_grp='$i_grp'
15802 i_iconv='$i_iconv'
15803 i_ieeefp='$i_ieeefp'
15804 i_inttypes='$i_inttypes'
15805 i_libutil='$i_libutil'
15806 i_limits='$i_limits'
15807 i_locale='$i_locale'
15808 i_machcthr='$i_machcthr'
15809 i_malloc='$i_malloc'
15810 i_math='$i_math'
15811 i_memory='$i_memory'
15812 i_mntent='$i_mntent'
15813 i_ndbm='$i_ndbm'
15814 i_netdb='$i_netdb'
15815 i_neterrno='$i_neterrno'
15816 i_netinettcp='$i_netinettcp'
15817 i_niin='$i_niin'
15818 i_poll='$i_poll'
15819 i_prot='$i_prot'
15820 i_pthread='$i_pthread'
15821 i_pwd='$i_pwd'
15822 i_rpcsvcdbm='$i_rpcsvcdbm'
15823 i_sfio='$i_sfio'
15824 i_sgtty='$i_sgtty'
15825 i_shadow='$i_shadow'
15826 i_socks='$i_socks'
15827 i_stdarg='$i_stdarg'
15828 i_stddef='$i_stddef'
15829 i_stdlib='$i_stdlib'
15830 i_string='$i_string'
15831 i_sunmath='$i_sunmath'
15832 i_sysaccess='$i_sysaccess'
15833 i_sysdir='$i_sysdir'
15834 i_sysfile='$i_sysfile'
15835 i_sysfilio='$i_sysfilio'
15836 i_sysin='$i_sysin'
15837 i_sysioctl='$i_sysioctl'
15838 i_syslog='$i_syslog'
15839 i_sysmman='$i_sysmman'
15840 i_sysmode='$i_sysmode'
15841 i_sysmount='$i_sysmount'
15842 i_sysndir='$i_sysndir'
15843 i_sysparam='$i_sysparam'
15844 i_sysresrc='$i_sysresrc'
15845 i_syssecrt='$i_syssecrt'
15846 i_sysselct='$i_sysselct'
15847 i_syssockio='$i_syssockio'
15848 i_sysstat='$i_sysstat'
15849 i_sysstatfs='$i_sysstatfs'
15850 i_sysstatvfs='$i_sysstatvfs'
15851 i_systime='$i_systime'
15852 i_systimek='$i_systimek'
15853 i_systimes='$i_systimes'
15854 i_systypes='$i_systypes'
15855 i_sysuio='$i_sysuio'
15856 i_sysun='$i_sysun'
15857 i_sysutsname='$i_sysutsname'
15858 i_sysvfs='$i_sysvfs'
15859 i_syswait='$i_syswait'
15860 i_termio='$i_termio'
15861 i_termios='$i_termios'
15862 i_time='$i_time'
15863 i_unistd='$i_unistd'
15864 i_ustat='$i_ustat'
15865 i_utime='$i_utime'
15866 i_values='$i_values'
15867 i_varargs='$i_varargs'
15868 i_varhdr='$i_varhdr'
15869 i_vfork='$i_vfork'
15870 ignore_versioned_solibs='$ignore_versioned_solibs'
15871 inc_version_list='$inc_version_list'
15872 inc_version_list_init='$inc_version_list_init'
15873 incpath='$incpath'
15874 inews='$inews'
15875 installarchlib='$installarchlib'
15876 installbin='$installbin'
15877 installman1dir='$installman1dir'
15878 installman3dir='$installman3dir'
15879 installprefix='$installprefix'
15880 installprefixexp='$installprefixexp'
15881 installprivlib='$installprivlib'
15882 installscript='$installscript'
15883 installsitearch='$installsitearch'
15884 installsitebin='$installsitebin'
15885 installsitelib='$installsitelib'
15886 installstyle='$installstyle'
15887 installusrbinperl='$installusrbinperl'
15888 installvendorarch='$installvendorarch'
15889 installvendorbin='$installvendorbin'
15890 installvendorlib='$installvendorlib'
15891 intsize='$intsize'
15892 ivdformat='$ivdformat'
15893 ivsize='$ivsize'
15894 ivtype='$ivtype'
15895 known_extensions='$known_extensions'
15896 ksh='$ksh'
15897 large='$large'
15898 ld='$ld'
15899 lddlflags='$lddlflags'
15900 ldflags='$ldflags'
15901 ldflags_uselargefiles='$ldflags_uselargefiles'
15902 ldlibpthname='$ldlibpthname'
15903 less='$less'
15904 lib_ext='$lib_ext'
15905 libc='$libc'
15906 libperl='$libperl'
15907 libpth='$libpth'
15908 libs='$libs'
15909 libsdirs='$libsdirs'
15910 libsfiles='$libsfiles'
15911 libsfound='$libsfound'
15912 libspath='$libspath'
15913 libswanted='$libswanted'
15914 libswanted_uselargefiles='$libswanted_uselargefiles'
15915 line='$line'
15916 lint='$lint'
15917 lkflags='$lkflags'
15918 ln='$ln'
15919 lns='$lns'
15920 locincpth='$locincpth'
15921 loclibpth='$loclibpth'
15922 longdblsize='$longdblsize'
15923 longlongsize='$longlongsize'
15924 longsize='$longsize'
15925 lp='$lp'
15926 lpr='$lpr'
15927 ls='$ls'
15928 lseeksize='$lseeksize'
15929 lseektype='$lseektype'
15930 mail='$mail'
15931 mailx='$mailx'
15932 make='$make'
15933 make_set_make='$make_set_make'
15934 mallocobj='$mallocobj'
15935 mallocsrc='$mallocsrc'
15936 malloctype='$malloctype'
15937 man1dir='$man1dir'
15938 man1direxp='$man1direxp'
15939 man1ext='$man1ext'
15940 man3dir='$man3dir'
15941 man3direxp='$man3direxp'
15942 man3ext='$man3ext'
15943 medium='$medium'
15944 mips_type='$mips_type'
15945 mkdir='$mkdir'
15946 mmaptype='$mmaptype'
15947 models='$models'
15948 modetype='$modetype'
15949 more='$more'
15950 multiarch='$multiarch'
15951 mv='$mv'
15952 myarchname='$myarchname'
15953 mydomain='$mydomain'
15954 myhostname='$myhostname'
15955 myuname='$myuname'
15956 n='$n'
15957 netdb_hlen_type='$netdb_hlen_type'
15958 netdb_host_type='$netdb_host_type'
15959 netdb_name_type='$netdb_name_type'
15960 netdb_net_type='$netdb_net_type'
15961 nm='$nm'
15962 nm_opt='$nm_opt'
15963 nm_so_opt='$nm_so_opt'
15964 nonxs_ext='$nonxs_ext'
15965 nroff='$nroff'
15966 nvEformat='$nvEformat'
15967 nvFformat='$nvFformat'
15968 nvGformat='$nvGformat'
15969 nveformat='$nveformat'
15970 nvfformat='$nvfformat'
15971 nvgformat='$nvgformat'
15972 nvsize='$nvsize'
15973 nvtype='$nvtype'
15974 o_nonblock='$o_nonblock'
15975 obj_ext='$obj_ext'
15976 old_pthread_create_joinable='$old_pthread_create_joinable'
15977 optimize='$optimize'
15978 orderlib='$orderlib'
15979 osname='$osname'
15980 osvers='$osvers'
15981 otherlibdirs='$otherlibdirs'
15982 package='$package'
15983 pager='$pager'
15984 passcat='$passcat'
15985 patchlevel='$patchlevel'
15986 path_sep='$path_sep'
15987 perl5='$perl5'
15988 perl='$perl'
15989 perladmin='$perladmin'
15990 perlpath='$perlpath'
15991 pg='$pg'
15992 phostname='$phostname'
15993 pidtype='$pidtype'
15994 plibpth='$plibpth'
15995 pm_apiversion='$pm_apiversion'
15996 pmake='$pmake'
15997 pr='$pr'
15998 prefix='$prefix'
15999 prefixexp='$prefixexp'
16000 privlib='$privlib'
16001 privlibexp='$privlibexp'
16002 prototype='$prototype'
16003 ptrsize='$ptrsize'
16004 quadkind='$quadkind'
16005 quadtype='$quadtype'
16006 randbits='$randbits'
16007 randfunc='$randfunc'
16008 randseedtype='$randseedtype'
16009 ranlib='$ranlib'
16010 rd_nodata='$rd_nodata'
16011 revision='$revision'
16012 rm='$rm'
16013 rmail='$rmail'
16014 runnm='$runnm'
16015 sPRIEldbl='$sPRIEldbl'
16016 sPRIFldbl='$sPRIFldbl'
16017 sPRIGldbl='$sPRIGldbl'
16018 sPRIX64='$sPRIX64'
16019 sPRId64='$sPRId64'
16020 sPRIeldbl='$sPRIeldbl'
16021 sPRIfldbl='$sPRIfldbl'
16022 sPRIgldbl='$sPRIgldbl'
16023 sPRIi64='$sPRIi64'
16024 sPRIo64='$sPRIo64'
16025 sPRIu64='$sPRIu64'
16026 sPRIx64='$sPRIx64'
16027 sched_yield='$sched_yield'
16028 scriptdir='$scriptdir'
16029 scriptdirexp='$scriptdirexp'
16030 sed='$sed'
16031 seedfunc='$seedfunc'
16032 selectminbits='$selectminbits'
16033 selecttype='$selecttype'
16034 sendmail='$sendmail'
16035 sh='$sh'
16036 shar='$shar'
16037 sharpbang='$sharpbang'
16038 shmattype='$shmattype'
16039 shortsize='$shortsize'
16040 shrpenv='$shrpenv'
16041 shsharp='$shsharp'
16042 sig_count='$sig_count'
16043 sig_name='$sig_name'
16044 sig_name_init='$sig_name_init'
16045 sig_num='$sig_num'
16046 sig_num_init='$sig_num_init'
16047 signal_t='$signal_t'
16048 sitearch='$sitearch'
16049 sitearchexp='$sitearchexp'
16050 sitebin='$sitebin'
16051 sitebinexp='$sitebinexp'
16052 sitelib='$sitelib'
16053 sitelib_stem='$sitelib_stem'
16054 sitelibexp='$sitelibexp'
16055 siteprefix='$siteprefix'
16056 siteprefixexp='$siteprefixexp'
16057 sizesize='$sizesize'
16058 sizetype='$sizetype'
16059 sleep='$sleep'
16060 smail='$smail'
16061 small='$small'
16062 so='$so'
16063 sockethdr='$sockethdr'
16064 socketlib='$socketlib'
16065 socksizetype='$socksizetype'
16066 sort='$sort'
16067 spackage='$spackage'
16068 spitshell='$spitshell'
16069 split='$split'
16070 src='$src'
16071 ssizetype='$ssizetype'
16072 startperl='$startperl'
16073 startsh='$startsh'
16074 static_ext='$static_ext'
16075 stdchar='$stdchar'
16076 stdio_base='$stdio_base'
16077 stdio_bufsiz='$stdio_bufsiz'
16078 stdio_cnt='$stdio_cnt'
16079 stdio_filbuf='$stdio_filbuf'
16080 stdio_ptr='$stdio_ptr'
16081 stdio_stream_array='$stdio_stream_array'
16082 strings='$strings'
16083 submit='$submit'
16084 subversion='$subversion'
16085 sysman='$sysman'
16086 tail='$tail'
16087 tar='$tar'
16088 tbl='$tbl'
16089 tee='$tee'
16090 test='$test'
16091 timeincl='$timeincl'
16092 timetype='$timetype'
16093 touch='$touch'
16094 tr='$tr'
16095 trnl='$trnl'
16096 troff='$troff'
16097 u16size='$u16size'
16098 u16type='$u16type'
16099 u32size='$u32size'
16100 u32type='$u32type'
16101 u64size='$u64size'
16102 u64type='$u64type'
16103 u8size='$u8size'
16104 u8type='$u8type'
16105 uidformat='$uidformat'
16106 uidsign='$uidsign'
16107 uidsize='$uidsize'
16108 uidtype='$uidtype'
16109 uname='$uname'
16110 uniq='$uniq'
16111 uquadtype='$uquadtype'
16112 use5005threads='$use5005threads'
16113 use64bitall='$use64bitall'
16114 use64bitint='$use64bitint'
16115 usedl='$usedl'
16116 useithreads='$useithreads'
16117 uselargefiles='$uselargefiles'
16118 uselongdouble='$uselongdouble'
16119 usemorebits='$usemorebits'
16120 usemultiplicity='$usemultiplicity'
16121 usemymalloc='$usemymalloc'
16122 usenm='$usenm'
16123 useopcode='$useopcode'
16124 useperlio='$useperlio'
16125 useposix='$useposix'
16126 usesfio='$usesfio'
16127 useshrplib='$useshrplib'
16128 usesocks='$usesocks'
16129 usethreads='$usethreads'
16130 usevendorprefix='$usevendorprefix'
16131 usevfork='$usevfork'
16132 usrinc='$usrinc'
16133 uuname='$uuname'
16134 uvXformat='$uvXformat'
16135 uvoformat='$uvoformat'
16136 uvsize='$uvsize'
16137 uvtype='$uvtype'
16138 uvuformat='$uvuformat'
16139 uvxformat='$uvxformat'
16140 vendorarch='$vendorarch'
16141 vendorarchexp='$vendorarchexp'
16142 vendorbin='$vendorbin'
16143 vendorbinexp='$vendorbinexp'
16144 vendorlib='$vendorlib'
16145 vendorlib_stem='$vendorlib_stem'
16146 vendorlibexp='$vendorlibexp'
16147 vendorprefix='$vendorprefix'
16148 vendorprefixexp='$vendorprefixexp'
16149 version='$version'
16150 vi='$vi'
16151 voidflags='$voidflags'
16152 xlibpth='$xlibpth'
16153 xs_apiversion='$xs_apiversion'
16154 zcat='$zcat'
16155 zip='$zip'
16156 EOT
16157
16158 : Add in command line options if available
16159 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
16160
16161 : add special variables
16162 $test -f $src/patchlevel.h && \
16163 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
16164 echo "CONFIGDOTSH=true" >>config.sh
16165
16166 : propagate old symbols
16167 if $test -f UU/config.sh; then
16168         <UU/config.sh sort | uniq >UU/oldconfig.sh
16169         sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
16170         sort | uniq -u >UU/oldsyms
16171         set X `cat UU/oldsyms`
16172         shift
16173         case $# in
16174         0) ;;
16175         *)
16176                 cat <<EOM
16177 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
16178 EOM
16179                 echo "# Variables propagated from previous config.sh file." >>config.sh
16180                 for sym in `cat UU/oldsyms`; do
16181                         echo "    Propagating $hint variable "'$'"$sym..."
16182                         eval 'tmp="$'"${sym}"'"'
16183                         echo "$tmp" | \
16184                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
16185                 done
16186                 ;;
16187         esac
16188 fi
16189
16190 : Finish up by extracting the .SH files
16191 case "$alldone" in
16192 exit)
16193         $rm -rf UU
16194         echo "Done."
16195         exit 0
16196         ;;
16197 cont)
16198         ;;
16199 '')
16200         dflt=''
16201         nostick=true
16202         $cat <<EOM
16203
16204 If you'd like to make any changes to the config.sh file before I begin
16205 to configure things, do it as a shell escape now (e.g. !vi config.sh).
16206
16207 EOM
16208         rp="Press return or use a shell escape to edit config.sh:"
16209         . UU/myread
16210         nostick=''
16211         case "$ans" in
16212         '') ;;
16213         *) : in case they cannot read
16214                 sh 1>&4 -c "$ans";;
16215         esac
16216         ;;
16217 esac
16218
16219 : if this fails, just run all the .SH files by hand
16220 . ./config.sh
16221
16222 echo " "
16223 exec 1>&4
16224 . ./UU/extract
16225
16226 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
16227         dflt=y
16228         case "$silent" in
16229         true) ;;
16230         *)
16231                 $cat <<EOM
16232
16233 Now you need to generate make dependencies by running "$make depend".
16234 You might prefer to run it in background: "$make depend > makedepend.out &"
16235 It can take a while, so you might not want to run it right now.
16236
16237 EOM
16238                 ;;
16239         esac
16240         rp="Run $make depend now?"
16241         . UU/myread
16242         case "$ans" in
16243         y*)
16244                 $make depend && echo "Now you must run a $make."
16245                 ;;
16246         *)
16247                 echo "You must run '$make depend' then '$make'."
16248                 ;;
16249         esac
16250 elif test -f [Mm]akefile; then
16251         echo " "
16252         echo "Now you must run a $make."
16253 else
16254         echo "Done."
16255 fi
16256
16257 if $test -f Policy.sh; then
16258     $cat <<EOM
16259
16260 If you compile $package on a different machine or from a different object
16261 directory, copy the Policy.sh file from this object directory to the
16262 new one before you run Configure -- this will help you with most of
16263 the policy defaults.
16264
16265 EOM
16266 fi
16267 if $test -f config.msg; then
16268     echo "Hmm.  I also noted the following information while running:"
16269     echo " "
16270     $cat config.msg >&4
16271     $rm -f config.msg
16272 fi
16273 $rm -f kit*isdone ark*isdone
16274 $rm -rf UU
16275
16276 : End of Configure
16277